-
Notifications
You must be signed in to change notification settings - Fork 4
Actions
Actions is in the RFC stage
Actions are to be usable in a similar manner to InkScape’s actions, however it is strictly not InkScapes actions, for the following reasons
- Inkscape uses a copyleft license, which is nice until it’s not for certain contexts. So no code will be based on InkScape’s source code.
- Inkscape actions are built for Inkscape, whereas our actions are intended for use by anyone wanting to make a vector editor
- Inkscape uses its own DSL, whereas we’d rather use a well known, embeddable scripting language
- Too many actions, we'd like to make a simple set of composable actions (e.g. cut = copy + delete)
- Take inspiration from modern editors
- Graphite is a vector editor that is procedural and reversible/non-destructive. We’d like actions to be the same
An action is essentially a method which takes in some arguments and changes the state of the application. Actions are pure functions; the application is expected to take the result and update it's own state to send to the next action.
UI actions take the state and produce some UI output to the user application
enum UIAction {
/// Display dialog with markdown content
Dialog { content: String },
/// Write content to clipboard
Clipboard { content: String },
}
Returns the list of actions and their specification.
- 📥 Input: Nothing
- 🌟 Output: UIAction::Dialog
Copy the selected element(s) to clipboard
- 📥 Input: State
- 🌟 Ouput: UIAction::Clipboard
Starts document serialization flow. Form submission should act Export Submit
- 📥 Input: State
- 🌟 Ouput: UIAction::Form
Serializes the document based on the provided options. Options may (optionally) be gathered from Export Start
- 📥 Input: State, Export Options
- 🌟 Ouput: UIAction::Form
Constructor for document. Effect of new state can be decided by the application (e.g. whether to overwrite existing state or create new tab)
- 📥 Input: New Options
- 🌟 Output: State
Serializes document
Manipulation actions take the application state and a set of options as input to produce a new
Align each element on a given axis
- Input: State, Alignment Axis
- Output: State
Wraps each selected element in a hyperlink. Selection moved to links.
- 📥 Input: State, URL
- 🌟 Output: State
Creates a deep copy of each selected element and puts it after the selected element. Selection moved to clones.
- 📥 Input: State
- 🌟 Output: State
Removes each selected element from the document.
- 📥 Input: State
- 🌟 Output: State
State tracks the following
- The DOM tree
- List of selected elements
- Deletion stack
- rpc
- bindings
- scripting