Preloaded addons #23
Labels
No labels
bug
discussion
documentation
duplicate
enhancement
good first issue
help wanted
invalid
Jameson
joke
options window
question
Split!
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
sparkle-devs/sparkle#23
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
As part of my goal to rewrite Jameson as a series of Sparkle addons and Sparkle as a series of Jameson components, I need a way to add preloaded addons: addons which a fork loads at startup and which can be enabled/disabled but not removed.
What follows is my idea for how this should be done.
API layout
In the lines immediately after
<script src="src/sparkle.js"></script>, the fork would place this code, wheresrc/addon.jsis the relative path of a preloaded addon:This code will wait for the fork to fully initialize, and then instruct Sparkle to load the addon. If the addon has been disabled, this will fail silently with no errors.
(Before anyone asks, don't worry, I've already made
waitForSnapReady()available to forks inacd7191.)UI/UX aspects
Whenever the user opens the list of addons and a premade addon's displayed, the following aspects will be changed:
@Mojavesoft-Group/sparkle-team Anybody up to the task?
Please direct all development for this issue to the
preloaded-addonsbranch.I think a "disable/enable" button would also work well with user-downloaded addons (temporarily remove addon, but turn it on later)
Agreed.
I've made an addon enabler/disabler:
It automatically saves your addon disable preferences! Any concerns or changes needed?
I love it! I don't like the slash icon though, can you make the dropdown arrow larger and use that instead?
I think a better way would be a tick box at the left of the text, that way it doesn't interfere with the delete button
Real quick, I think implementing a "ModDisplayerMorph" is good
Basically its a morph, that takes in a object- either a Mod which is currently loaded, or the info object for a addon from the repo.
It would handle both of them, and allow viewing info, changelogs, etc etc you know the drill.
Should I commit this? Or is there anything else to change?
Looks good to me, would you please commit to the preloaded-addons branch though? That way, the master branch won't be half-broken while this feature is being developed.
I'll do that, although this is just the enable/disable, nothing else.
I've added the enable/disable in the preloaded-addons branch!
I am mostly on board with the whole Sparkle-replacing-Snap-mods thing (the mod developer just has to make lots of addons instead of modding snap source code), so I'll continue with the preloaded stuff
Thanks so much! Great work.
@e016 One little tidbit though: I changed the button colors in the main branch to make them look a bit less jarring, would you please copy those changes over to
preloaded-addonstoo?I don't know if this is on topic, but the only issue in my eyes with the mod-replacing-forks thing is.. compatiblity. For something like Split!, that modifies Snap! a whole darn lot. That could provide incompatibilly with other mods.
And, just like some other stuff, I've grown to like the idea. The idea of being able to simply just load a mod and get the blocks of Split!, or get the extra features of Snavanced, etc etc. Now the issue is, we don't want users to just create projects needing all of that randomly. We already know people don't like enabling JS for projects. Now how this could work is of course is that we could partner up with the Snap! team (that's probably not happening, though) and have a system for that to redirect projects to the correct mods.
That's certainly one way to accomplish that task.
I think we might be able to embed metadata about sparkle addons (e.g: uses split or jameson addons) and have Sparkle recommend those addons
Sure, but wouldn't that be pushing Sparkle's feature set a bit too far? My philosophy is that Sparkle should be an integratable addons manager with a few addon-facing APIs and nothing else. All other functionality is to be accomplished by addons and Snap! or one of its forks.
Idea: maybe for forks embedding Sparkle, we should make Sparkle more "module" nice, where you can include the sparkle JS file, and then run a SparkleSDK.init(opts) function with that kind of info, including preloaded icons. Then, for the extension, we can keep the sparkle code and add a extra initialization code to run that function.
Are you proposing that both the integrated Sparkle and the Sparkle extension execute the same custom code? Wouldn't that cause a race condition?
No. I'm saying that the extension can do that if Sparkle isn't included in a fork, and for he forks that do include can customize Sparkle
Why would a fork contain metadata for Sparkle if it didn't already integrate it? It's not like integrating Sparkle is hard, it's just downloading a file and editing another.
As in, preloaded addons. The topic of this issue 😉
I'm still really confused about what you mean. Are you proposing that the extension be used as a way of customizing an integrated Sparkle instance?
Nononono.
There will be a single sparkle.js. That exports a object, SparkleSDK (basically
__sparkle__). That has a function, main. You pass in a object with options to that function. Forks can do this for preloaded addons.Then, the main sparkle extension of course still has sparkle.js, but includes a main.js right after (content scripts) that run that main function.
Are you proposing a system in which Sparkle itself is not included in the fork, but rather a piece of code for communicating with the Sparkle extension?
No! The fork will have its own Sparkle, that it has a script tag a- like now, but it must have code to call main on it.
So you have to manually call main() if you're integrating Sparkle into a Snap! fork?
So the fork can activate Sparkle later on instead of starting it up at once?
Yeah, but with SparkleSDK of course
Yes, and it also lets you pass an object as a parameter into main, letting you do things like
By SparkleSDK, what do you mean exactly? We officially ditched the SDK branding when we moved to my organization.
For the global object sparkle exports. So maybe "Sparkle" is better?
That's actually a pretty good idea! @e016 Do you think that you could implement this?
I would call that
window.__sparkle__. It's not a pretty name, but it's rather unambiguous.Maybe also just a Sparkle class you create and call main, kind of like Snap!'s IDE_Morph?
Actually, that would be even better!
I would, that's why I suggested the idea :~)
Oh! Awesome! I assumed that you might not have been ready to develop it yet, because that's how I am with my ideas for Sparkle.
Okay! Because like it would separate concerns from one another. There's no global functiona, just Sparkle functiona that like the mod manager morph gets
(the moprhs would have the Sparkle class passed in to the constructor)
Alright! Would
__crackle__be renamed into__sparkle__, or would the two be different?Well, it would be replaced by Sparkle. The Sparkle class is just that, you then create it in another script.
Oh, ok. Could it work like this?
I propose renaming it to
Sparkle.__crackle__, whereSparkleis a Sparkle object. I think that we should still keep both, because having the name Crackle in the source code reminds us of how far we've gotten.That looks good to me.
Ill implement it on another branch!
Yeah, although I feel like that could be confusing for some devs.
Shouldn't it be just a global "Sparkle" or "sparkle"? We can just put a comment below Sparkle "orginally Crackle" or some easter egg in it.
If
window.__crackle__becomessparkle, then where will we store the fork-facing APIs for Sparkle? The point ofwindow.__crackle__is storing internal states that shouldn't be modified by other code (hence the underscores).Well, forks will just create the Sparkle class. And yesh, they can modify that stuff, but does that really matter?
Yes. It's quite possible that a fork's developer(s) might get the idea of messing with the internal state of Sparkle, under the mistaken assumption that this is supported behavior.
Well, then we can document it. Or we could use # fields
What are # fields?
Wouldn't those prevent forks from reading these attributes though? Using # fields would also break Jameson's Sparkle library.
True.. What do you propose?
Sparkle.__crackle__.