@weasel-js/editing 0.0.0-stage → 1.19.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (81) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +48 -2
  3. package/dist/actions/align/action.js +102 -0
  4. package/dist/actions/align/action.js.map +1 -0
  5. package/dist/actions/align/align.js +114 -0
  6. package/dist/actions/align/align.js.map +1 -0
  7. package/dist/actions/clipboard/action.js +130 -0
  8. package/dist/actions/clipboard/action.js.map +1 -0
  9. package/dist/actions/distribute/action.js +93 -0
  10. package/dist/actions/distribute/action.js.map +1 -0
  11. package/dist/actions/distribute/distribute.js +60 -0
  12. package/dist/actions/distribute/distribute.js.map +1 -0
  13. package/dist/actions/distribute/plan.js +55 -0
  14. package/dist/actions/distribute/plan.js.map +1 -0
  15. package/dist/actions/edit/createPaintAction.js +109 -0
  16. package/dist/actions/edit/createPaintAction.js.map +1 -0
  17. package/dist/actions/edit/duplicate.js +91 -0
  18. package/dist/actions/edit/duplicate.js.map +1 -0
  19. package/dist/actions/edit/escape.js +34 -0
  20. package/dist/actions/edit/escape.js.map +1 -0
  21. package/dist/actions/edit/group.js +277 -0
  22. package/dist/actions/edit/group.js.map +1 -0
  23. package/dist/actions/edit/ingest.js +112 -0
  24. package/dist/actions/edit/ingest.js.map +1 -0
  25. package/dist/actions/edit/nudge.js +93 -0
  26. package/dist/actions/edit/nudge.js.map +1 -0
  27. package/dist/actions/edit/selectAll.js +48 -0
  28. package/dist/actions/edit/selectAll.js.map +1 -0
  29. package/dist/actions/edit/setFill.js +52 -0
  30. package/dist/actions/edit/setFill.js.map +1 -0
  31. package/dist/actions/edit/setFillOpacity.js +26 -0
  32. package/dist/actions/edit/setFillOpacity.js.map +1 -0
  33. package/dist/actions/edit/setStroke.js +57 -0
  34. package/dist/actions/edit/setStroke.js.map +1 -0
  35. package/dist/actions/edit/setStrokeOpacity.js +28 -0
  36. package/dist/actions/edit/setStrokeOpacity.js.map +1 -0
  37. package/dist/actions/edit/setStrokeWidth.js +48 -0
  38. package/dist/actions/edit/setStrokeWidth.js.map +1 -0
  39. package/dist/actions/edit/setVertexColor.js +38 -0
  40. package/dist/actions/edit/setVertexColor.js.map +1 -0
  41. package/dist/actions/flip/action.js +204 -0
  42. package/dist/actions/flip/action.js.map +1 -0
  43. package/dist/actions/flip/helpers.js +80 -0
  44. package/dist/actions/flip/helpers.js.map +1 -0
  45. package/dist/actions/pathfinder/action.js +107 -0
  46. package/dist/actions/pathfinder/action.js.map +1 -0
  47. package/dist/actions/pathfinder/booleanGroupAction.js +111 -0
  48. package/dist/actions/pathfinder/booleanGroupAction.js.map +1 -0
  49. package/dist/actions/pathfinder/keymap.js +51 -0
  50. package/dist/actions/pathfinder/keymap.js.map +1 -0
  51. package/dist/actions/reorder/reorder.js +243 -0
  52. package/dist/actions/reorder/reorder.js.map +1 -0
  53. package/dist/actions/transformAgain/action.js +88 -0
  54. package/dist/actions/transformAgain/action.js.map +1 -0
  55. package/dist/actions/transformAgain/transformSelection.js +35 -0
  56. package/dist/actions/transformAgain/transformSelection.js.map +1 -0
  57. package/dist/engineStandardActions.js +45 -0
  58. package/dist/engineStandardActions.js.map +1 -0
  59. package/dist/index.d.ts +679 -0
  60. package/dist/index.js +37 -0
  61. package/dist/namedPresets.js +71 -0
  62. package/dist/namedPresets.js.map +1 -0
  63. package/dist/presets/arrange.js +51 -0
  64. package/dist/presets/arrange.js.map +1 -0
  65. package/dist/presets/composites.js +43 -0
  66. package/dist/presets/composites.js.map +1 -0
  67. package/dist/presets/edit.js +113 -0
  68. package/dist/presets/edit.js.map +1 -0
  69. package/dist/presets/ingest.js +13 -0
  70. package/dist/presets/ingest.js.map +1 -0
  71. package/dist/presets/pathfinder.js +23 -0
  72. package/dist/presets/pathfinder.js.map +1 -0
  73. package/dist/presets/select.js +18 -0
  74. package/dist/presets/select.js.map +1 -0
  75. package/dist/presets/tools.js +15 -0
  76. package/dist/presets/tools.js.map +1 -0
  77. package/dist/presets/transform.js +39 -0
  78. package/dist/presets/transform.js.map +1 -0
  79. package/dist/useStandardActions.js +26 -0
  80. package/dist/useStandardActions.js.map +1 -0
  81. package/package.json +59 -4
package/dist/index.js ADDED
@@ -0,0 +1,37 @@
1
+ import { selectPreset } from "./presets/select.js";
2
+ import { movePreset, outlinePreset, resizePreset, rotatePreset } from "./presets/transform.js";
3
+ import { clipboardPreset, contextMenuPreset, deletePreset, duplicatePreset, editPreset, escapePreset, groupPreset, nudgePreset, selectAllPreset, stylePreset } from "./presets/edit.js";
4
+ import { alignPreset, arrangePreset, distributePreset, flipPreset, reorderPreset } from "./presets/arrange.js";
5
+ import { pathfinderPreset } from "./presets/pathfinder.js";
6
+ import { selectToolsPreset, shapeToolsPreset } from "./presets/tools.js";
7
+ import { drawPreset, pickPreset, transformPreset } from "./presets/composites.js";
8
+ import { ingestPreset } from "./presets/ingest.js";
9
+ import { FEATURE_ACTION_IDS, FEATURE_NAMES, FEATURE_PRESETS, KIT_STANDARD_ACTIONS, namedFeatures } from "./namedPresets.js";
10
+ import { KIT_STANDARD_ACTION_IDS, useStandardActions } from "./useStandardActions.js";
11
+ import { flipAction } from "./actions/flip/action.js";
12
+ import { reorderBackwardAction, reorderForwardAction } from "./actions/reorder/reorder.js";
13
+ import { alignBottomAction, alignCenterXAction, alignCenterYAction, alignLeftAction, alignRightAction, alignTopAction } from "./actions/align/action.js";
14
+ import { alignDeltaFor, alignTargetBounds, useAlign } from "./actions/align/align.js";
15
+ import { distributeHorizontalAction, distributeVerticalAction } from "./actions/distribute/action.js";
16
+ import { useDistribute } from "./actions/distribute/distribute.js";
17
+ import { ENGINE_STANDARD_ACTIONS } from "./engineStandardActions.js";
18
+ import { escapeAction } from "./actions/edit/escape.js";
19
+ import { selectAllAction } from "./actions/edit/selectAll.js";
20
+ import { duplicateAction, duplicateSelection } from "./actions/edit/duplicate.js";
21
+ import { groupAction, ungroupAction } from "./actions/edit/group.js";
22
+ import { nudgeDownAction, nudgeLeftAction, nudgeRightAction, nudgeUpAction } from "./actions/edit/nudge.js";
23
+ import { setFillAction } from "./actions/edit/setFill.js";
24
+ import { setFillOpacityAction } from "./actions/edit/setFillOpacity.js";
25
+ import { setStrokeAction } from "./actions/edit/setStroke.js";
26
+ import { setStrokeOpacityAction } from "./actions/edit/setStrokeOpacity.js";
27
+ import { setStrokeWidthAction } from "./actions/edit/setStrokeWidth.js";
28
+ import { setVertexColorAction } from "./actions/edit/setVertexColor.js";
29
+ import { ingestAction } from "./actions/edit/ingest.js";
30
+ import { transformAgainAction } from "./actions/transformAgain/action.js";
31
+ import { transformSelection } from "./actions/transformAgain/transformSelection.js";
32
+ import { clipboardCopyAction, clipboardCutAction, clipboardPasteAction, clipboardPasteEventAction } from "./actions/clipboard/action.js";
33
+ import { PATHFINDER_STROKES, pathfinderCropAction, pathfinderDivideAction, pathfinderExcludeAction, pathfinderIntersectAction, pathfinderMergeAction, pathfinderSubtractAction, pathfinderTrimAction, pathfinderUnionAction } from "./actions/pathfinder/action.js";
34
+ import { booleanGroupOps, makeBooleanGroup, makeBooleanGroupAction } from "./actions/pathfinder/booleanGroupAction.js";
35
+ import { PATHFINDER_KEYMAP, PATHFINDER_KEYMAP_ID, PATHFINDER_LEADER } from "./actions/pathfinder/keymap.js";
36
+
37
+ export { ENGINE_STANDARD_ACTIONS, FEATURE_ACTION_IDS, FEATURE_NAMES, FEATURE_PRESETS, KIT_STANDARD_ACTIONS, KIT_STANDARD_ACTION_IDS, PATHFINDER_KEYMAP, PATHFINDER_KEYMAP_ID, PATHFINDER_LEADER, PATHFINDER_STROKES, alignBottomAction, alignCenterXAction, alignCenterYAction, alignDeltaFor, alignLeftAction, alignPreset, alignRightAction, alignTargetBounds, alignTopAction, arrangePreset, booleanGroupOps, clipboardCopyAction, clipboardCutAction, clipboardPasteAction, clipboardPasteEventAction, clipboardPreset, contextMenuPreset, deletePreset, distributeHorizontalAction, distributePreset, distributeVerticalAction, drawPreset, duplicateAction, duplicatePreset, duplicateSelection, editPreset, escapeAction, escapePreset, flipAction, flipPreset, groupAction, groupPreset, ingestAction, ingestPreset, makeBooleanGroup, makeBooleanGroupAction, movePreset, namedFeatures, nudgeDownAction, nudgeLeftAction, nudgePreset, nudgeRightAction, nudgeUpAction, outlinePreset, pathfinderCropAction, pathfinderDivideAction, pathfinderExcludeAction, pathfinderIntersectAction, pathfinderMergeAction, pathfinderPreset, pathfinderSubtractAction, pathfinderTrimAction, pathfinderUnionAction, pickPreset, reorderBackwardAction, reorderForwardAction, reorderPreset, resizePreset, rotatePreset, selectAllAction, selectAllPreset, selectPreset, selectToolsPreset, setFillAction, setFillOpacityAction, setStrokeAction, setStrokeOpacityAction, setStrokeWidthAction, setVertexColorAction, shapeToolsPreset, stylePreset, transformAgainAction, transformPreset, transformSelection, ungroupAction, useAlign, useDistribute, useStandardActions };
@@ -0,0 +1,71 @@
1
+ import { alignPreset, arrangePreset, distributePreset, flipPreset, reorderPreset } from "./presets/arrange.js";
2
+ import { drawPreset, pickPreset, transformPreset } from "./presets/composites.js";
3
+ import { clipboardPreset, contextMenuPreset, deletePreset, duplicatePreset, editPreset, escapePreset, groupPreset, nudgePreset, selectAllPreset, stylePreset } from "./presets/edit.js";
4
+ import { ingestPreset } from "./presets/ingest.js";
5
+ import { pathfinderPreset } from "./presets/pathfinder.js";
6
+ import { selectPreset } from "./presets/select.js";
7
+ import { selectToolsPreset, shapeToolsPreset } from "./presets/tools.js";
8
+ import { movePreset, outlinePreset, resizePreset, rotatePreset } from "./presets/transform.js";
9
+ import { BASELINE_ACTIONS, toolDrivenActions, viewPreset, viewToolsPreset } from "@weasel-js/core";
10
+
11
+ // src/namedPresets.ts
12
+ /** Each kit preset by name, each after the presets it includes. */
13
+ var FEATURE_PRESETS = {
14
+ "tools:select": selectToolsPreset,
15
+ "tools:view": viewToolsPreset,
16
+ "tools:shape": shapeToolsPreset,
17
+ view: viewPreset,
18
+ select: selectPreset,
19
+ outline: outlinePreset,
20
+ pick: pickPreset,
21
+ move: movePreset,
22
+ resize: resizePreset,
23
+ rotate: rotatePreset,
24
+ transform: transformPreset,
25
+ escape: escapePreset,
26
+ contextMenu: contextMenuPreset,
27
+ selectAll: selectAllPreset,
28
+ duplicate: duplicatePreset,
29
+ delete: deletePreset,
30
+ group: groupPreset,
31
+ nudge: nudgePreset,
32
+ style: stylePreset,
33
+ clipboard: clipboardPreset,
34
+ edit: editPreset,
35
+ flip: flipPreset,
36
+ reorder: reorderPreset,
37
+ align: alignPreset,
38
+ distribute: distributePreset,
39
+ arrange: arrangePreset,
40
+ pathfinder: pathfinderPreset,
41
+ ingest: ingestPreset,
42
+ draw: drawPreset
43
+ };
44
+ /** Every kit preset's name, each after the presets it includes. */
45
+ var FEATURE_NAMES = Object.keys(FEATURE_PRESETS);
46
+ var FEATURES = FEATURE_NAMES;
47
+ /**
48
+ * The kit's presets for the given names, in order: `namedFeatures('pick', 'move')`
49
+ * is `[pickPreset, movePreset]`, and means exactly what passing those objects
50
+ * means. It resolves names only; nothing else is implied, so a canvas that
51
+ * pans and zooms names `'view'` (or `'draw'`, which includes it). Importing it
52
+ * puts every kit preset in the bundle; import the objects to carry only those.
53
+ */
54
+ function namedFeatures(...names) {
55
+ return names.map((n) => {
56
+ if (!Object.hasOwn(FEATURE_PRESETS, n)) throw new Error(`[namedFeatures] no kit preset is named "${n}"`);
57
+ return FEATURE_PRESETS[n];
58
+ });
59
+ }
60
+ /** The kit-standard action ids each preset registers itself, leaving out those of the presets it includes. */
61
+ var FEATURE_ACTION_IDS = Object.fromEntries(FEATURES.map((f) => [f, (FEATURE_PRESETS[f].actions ?? []).map((a) => a.id)]));
62
+ /** Every kit-standard action: the baseline, each kit preset's in table order, then the
63
+ * tool-driven ones. */
64
+ var KIT_STANDARD_ACTIONS = [
65
+ ...BASELINE_ACTIONS,
66
+ ...FEATURES.flatMap((f) => FEATURE_PRESETS[f].actions ?? []),
67
+ ...toolDrivenActions
68
+ ];
69
+
70
+ export { FEATURE_ACTION_IDS, FEATURE_NAMES, FEATURE_PRESETS, KIT_STANDARD_ACTIONS, namedFeatures };
71
+ //# sourceMappingURL=namedPresets.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"namedPresets.js","names":[],"sources":["../src/namedPresets.ts"],"sourcesContent":["/**\n * The kit's presets by name, core's view presets and editing's, for\n * `namedFeatures('draw')` and for listings that key presets by name. Importing\n * this module loads every preset's actions; a canvas handed preset objects\n * carries only those.\n */\nimport type { Action } from '@weasel-js/routing';\nimport type { FeaturePreset } from '@weasel-js/core';\nimport { alignPreset, arrangePreset, distributePreset, flipPreset, reorderPreset } from './presets/arrange';\nimport { drawPreset, pickPreset, transformPreset } from './presets/composites';\nimport {\n clipboardPreset, contextMenuPreset, deletePreset, duplicatePreset, editPreset, escapePreset, groupPreset,\n nudgePreset, selectAllPreset, stylePreset,\n} from './presets/edit';\nimport { ingestPreset } from './presets/ingest';\nimport { pathfinderPreset } from './presets/pathfinder';\nimport { selectPreset } from './presets/select';\nimport { toolDrivenActions, viewToolsPreset, BASELINE_ACTIONS, viewPreset } from '@weasel-js/core';\nimport { selectToolsPreset, shapeToolsPreset } from './presets/tools';\nimport { movePreset, outlinePreset, resizePreset, rotatePreset } from './presets/transform';\n\n/** Each kit preset by name, each after the presets it includes. */\nexport const FEATURE_PRESETS = {\n 'tools:select': selectToolsPreset,\n 'tools:view': viewToolsPreset,\n 'tools:shape': shapeToolsPreset,\n view: viewPreset,\n select: selectPreset,\n outline: outlinePreset,\n pick: pickPreset,\n move: movePreset,\n resize: resizePreset,\n rotate: rotatePreset,\n transform: transformPreset,\n escape: escapePreset,\n contextMenu: contextMenuPreset,\n selectAll: selectAllPreset,\n duplicate: duplicatePreset,\n delete: deletePreset,\n group: groupPreset,\n nudge: nudgePreset,\n style: stylePreset,\n clipboard: clipboardPreset,\n edit: editPreset,\n flip: flipPreset,\n reorder: reorderPreset,\n align: alignPreset,\n distribute: distributePreset,\n arrange: arrangePreset,\n pathfinder: pathfinderPreset,\n ingest: ingestPreset,\n draw: drawPreset,\n} as const satisfies Readonly<Record<string, FeaturePreset>>;\n\n/** A kit preset's name, as `namedFeatures` takes it. */\nexport type FeatureName = keyof typeof FEATURE_PRESETS;\n\n/** Every kit preset's name, each after the presets it includes. */\nexport const FEATURE_NAMES = Object.keys(FEATURE_PRESETS) as readonly FeatureName[];\nconst FEATURES = FEATURE_NAMES;\n\n/**\n * The kit's presets for the given names, in order: `namedFeatures('pick', 'move')`\n * is `[pickPreset, movePreset]`, and means exactly what passing those objects\n * means. It resolves names only; nothing else is implied, so a canvas that\n * pans and zooms names `'view'` (or `'draw'`, which includes it). Importing it\n * puts every kit preset in the bundle; import the objects to carry only those.\n */\nexport function namedFeatures(...names: readonly FeatureName[]): FeaturePreset[] {\n return names.map((n) => {\n if (!Object.hasOwn(FEATURE_PRESETS, n)) throw new Error(`[namedFeatures] no kit preset is named \"${n as string}\"`);\n return FEATURE_PRESETS[n];\n });\n}\n\n/** The kit-standard action ids each preset registers itself, leaving out those of the presets it includes. */\nexport const FEATURE_ACTION_IDS = Object.fromEntries(\n FEATURES.map((f): [FeatureName, readonly string[]] => [f, (FEATURE_PRESETS[f].actions ?? []).map((a) => a.id)]),\n) as Readonly<Record<FeatureName, readonly string[]>>;\n\n/** Every kit-standard action: the baseline, each kit preset's in table order, then the\n * tool-driven ones. */\nexport const KIT_STANDARD_ACTIONS: readonly Action[] = [\n ...BASELINE_ACTIONS,\n ...FEATURES.flatMap((f) => FEATURE_PRESETS[f].actions ?? []),\n ...toolDrivenActions,\n];\n"],"mappings":";;;;;;;;;;;;AAsBA,IAAa,kBAAkB;CAC7B,gBAAgB;CAChB,cAAc;CACd,eAAe;CACf,MAAM;CACN,QAAQ;CACR,SAAS;CACT,MAAM;CACN,MAAM;CACN,QAAQ;CACR,QAAQ;CACR,WAAW;CACX,QAAQ;CACR,aAAa;CACb,WAAW;CACX,WAAW;CACX,QAAQ;CACR,OAAO;CACP,OAAO;CACP,OAAO;CACP,WAAW;CACX,MAAM;CACN,MAAM;CACN,SAAS;CACT,OAAO;CACP,YAAY;CACZ,SAAS;CACT,YAAY;CACZ,QAAQ;CACR,MAAM;AACR;;AAMA,IAAa,gBAAgB,OAAO,KAAK,eAAe;AACxD,IAAM,WAAW;;;;;;;;AASjB,SAAgB,cAAc,GAAG,OAAgD;CAC/E,OAAO,MAAM,KAAK,MAAM;EACtB,IAAI,CAAC,OAAO,OAAO,iBAAiB,CAAC,GAAG,MAAM,IAAI,MAAM,2CAA2C,EAAY,EAAE;EACjH,OAAO,gBAAgB;CACzB,CAAC;AACH;;AAGA,IAAa,qBAAqB,OAAO,YACvC,SAAS,KAAK,MAAwC,CAAC,IAAI,gBAAgB,EAAE,CAAC,WAAW,CAAC,EAAA,CAAG,KAAK,MAAM,EAAE,EAAE,CAAC,CAAC,CAChH;;;AAIA,IAAa,uBAA0C;CACrD,GAAG;CACH,GAAG,SAAS,SAAS,MAAM,gBAAgB,EAAE,CAAC,WAAW,CAAC,CAAC;CAC3D,GAAG;AACL"}
@@ -0,0 +1,51 @@
1
+ import { alignBottomAction, alignCenterXAction, alignCenterYAction, alignLeftAction, alignRightAction, alignTopAction } from "../actions/align/action.js";
2
+ import { reorderBackwardAction, reorderForwardAction } from "../actions/reorder/reorder.js";
3
+ import { distributeHorizontalAction, distributeVerticalAction } from "../actions/distribute/action.js";
4
+ import { flipAction } from "../actions/flip/action.js";
5
+
6
+ // src/presets/arrange.ts
7
+ /** Flipping the selection. */
8
+ var flipPreset = {
9
+ id: "flip",
10
+ label: "Flip",
11
+ actions: [flipAction]
12
+ };
13
+ /** Bringing forward and sending backward. */
14
+ var reorderPreset = {
15
+ id: "reorder",
16
+ label: "Reorder",
17
+ actions: [reorderForwardAction, reorderBackwardAction]
18
+ };
19
+ /** Aligning edges and centers. */
20
+ var alignPreset = {
21
+ id: "align",
22
+ label: "Align",
23
+ actions: [
24
+ alignLeftAction,
25
+ alignCenterXAction,
26
+ alignRightAction,
27
+ alignTopAction,
28
+ alignCenterYAction,
29
+ alignBottomAction
30
+ ]
31
+ };
32
+ /** Distributing across or down. */
33
+ var distributePreset = {
34
+ id: "distribute",
35
+ label: "Distribute",
36
+ actions: [distributeHorizontalAction, distributeVerticalAction]
37
+ };
38
+ /** Align, distribute, reorder, and flip. */
39
+ var arrangePreset = {
40
+ id: "arrange",
41
+ label: "Arrange",
42
+ includes: [
43
+ flipPreset,
44
+ reorderPreset,
45
+ alignPreset,
46
+ distributePreset
47
+ ]
48
+ };
49
+
50
+ export { alignPreset, arrangePreset, distributePreset, flipPreset, reorderPreset };
51
+ //# sourceMappingURL=arrange.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"arrange.js","names":[],"sources":["../../src/presets/arrange.ts"],"sourcesContent":["import {\n alignBottomAction, alignCenterXAction, alignCenterYAction, alignLeftAction, alignRightAction, alignTopAction,\n} from '../actions/align/action';\nimport { reorderBackwardAction, reorderForwardAction } from '../actions/reorder/reorder';\nimport { distributeHorizontalAction, distributeVerticalAction } from '../actions/distribute/action';\nimport { flipAction } from '../actions/flip/action';\nimport type { FeaturePreset } from '@weasel-js/core';\n\n/** Flipping the selection. */\nexport const flipPreset: FeaturePreset = { id: 'flip', label: 'Flip', actions: [flipAction] };\n/** Bringing forward and sending backward. */\nexport const reorderPreset: FeaturePreset = {\n id: 'reorder', label: 'Reorder', actions: [reorderForwardAction, reorderBackwardAction],\n};\n/** Aligning edges and centers. */\nexport const alignPreset: FeaturePreset = {\n id: 'align',\n label: 'Align',\n actions: [alignLeftAction, alignCenterXAction, alignRightAction, alignTopAction, alignCenterYAction, alignBottomAction],\n};\n/** Distributing across or down. */\nexport const distributePreset: FeaturePreset = {\n id: 'distribute', label: 'Distribute', actions: [distributeHorizontalAction, distributeVerticalAction],\n};\n\n/** Align, distribute, reorder, and flip. */\nexport const arrangePreset: FeaturePreset = {\n id: 'arrange',\n label: 'Arrange',\n includes: [flipPreset, reorderPreset, alignPreset, distributePreset],\n};\n"],"mappings":";;;;;;;AASA,IAAa,aAA4B;CAAE,IAAI;CAAQ,OAAO;CAAQ,SAAS,CAAC,UAAU;AAAE;;AAE5F,IAAa,gBAA+B;CAC1C,IAAI;CAAW,OAAO;CAAW,SAAS,CAAC,sBAAsB,qBAAqB;AACxF;;AAEA,IAAa,cAA6B;CACxC,IAAI;CACJ,OAAO;CACP,SAAS;EAAC;EAAiB;EAAoB;EAAkB;EAAgB;EAAoB;CAAiB;AACxH;;AAEA,IAAa,mBAAkC;CAC7C,IAAI;CAAc,OAAO;CAAc,SAAS,CAAC,4BAA4B,wBAAwB;AACvG;;AAGA,IAAa,gBAA+B;CAC1C,IAAI;CACJ,OAAO;CACP,UAAU;EAAC;EAAY;EAAe;EAAa;CAAgB;AACrE"}
@@ -0,0 +1,43 @@
1
+ import { arrangePreset } from "./arrange.js";
2
+ import { editPreset } from "./edit.js";
3
+ import { ingestPreset } from "./ingest.js";
4
+ import { pathfinderPreset } from "./pathfinder.js";
5
+ import { selectPreset } from "./select.js";
6
+ import { movePreset, outlinePreset, resizePreset, rotatePreset } from "./transform.js";
7
+ import { viewPreset } from "@weasel-js/core";
8
+
9
+ // src/presets/composites.ts
10
+ /** Select, and the selection's outline. */
11
+ var pickPreset = {
12
+ id: "pick",
13
+ label: "Pick",
14
+ includes: [selectPreset, outlinePreset]
15
+ };
16
+ /** Resize and rotate handles. */
17
+ var transformPreset = {
18
+ id: "transform",
19
+ label: "Transform",
20
+ includes: [resizePreset, rotatePreset]
21
+ };
22
+ /** Every kit behavior: view, pick, transform, move, edit, arrange, the pathfinder, and ingest. Tools that make
23
+ * things are left to the canvas, through the `tools:` presets or `defaultTools`; path editing is
24
+ * `@weasel-js/path-tools`'. */
25
+ var drawPreset = {
26
+ id: "draw",
27
+ label: "Draw",
28
+ includes: [
29
+ viewPreset,
30
+ selectPreset,
31
+ outlinePreset,
32
+ resizePreset,
33
+ rotatePreset,
34
+ movePreset,
35
+ editPreset,
36
+ arrangePreset,
37
+ pathfinderPreset,
38
+ ingestPreset
39
+ ]
40
+ };
41
+
42
+ export { drawPreset, pickPreset, transformPreset };
43
+ //# sourceMappingURL=composites.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"composites.js","names":[],"sources":["../../src/presets/composites.ts"],"sourcesContent":["import type { FeaturePreset } from '@weasel-js/core';\nimport { arrangePreset } from './arrange';\nimport { editPreset } from './edit';\nimport { ingestPreset } from './ingest';\nimport { pathfinderPreset } from './pathfinder';\nimport { selectPreset } from './select';\nimport { movePreset, outlinePreset, resizePreset, rotatePreset } from './transform';\nimport { viewPreset } from '@weasel-js/core';\n\n/** Select, and the selection's outline. */\nexport const pickPreset: FeaturePreset = { id: 'pick', label: 'Pick', includes: [selectPreset, outlinePreset] };\n\n/** Resize and rotate handles. */\nexport const transformPreset: FeaturePreset = { id: 'transform', label: 'Transform', includes: [resizePreset, rotatePreset] };\n\n/** Every kit behavior: view, pick, transform, move, edit, arrange, the pathfinder, and ingest. Tools that make\n * things are left to the canvas, through the `tools:` presets or `defaultTools`; path editing is\n * `@weasel-js/path-tools`'. */\nexport const drawPreset: FeaturePreset = {\n id: 'draw',\n label: 'Draw',\n includes: [\n viewPreset, selectPreset, outlinePreset, resizePreset, rotatePreset, movePreset, editPreset, arrangePreset,\n pathfinderPreset, ingestPreset,\n ],\n};\n"],"mappings":";;;;;;;;;;AAUA,IAAa,aAA4B;CAAE,IAAI;CAAQ,OAAO;CAAQ,UAAU,CAAC,cAAc,aAAa;AAAE;;AAG9G,IAAa,kBAAiC;CAAE,IAAI;CAAa,OAAO;CAAa,UAAU,CAAC,cAAc,YAAY;AAAE;;;;AAK5H,IAAa,aAA4B;CACvC,IAAI;CACJ,OAAO;CACP,UAAU;EACR;EAAY;EAAc;EAAe;EAAc;EAAc;EAAY;EAAY;EAC7F;EAAkB;CACpB;AACF"}
@@ -0,0 +1,113 @@
1
+ import { duplicateAction } from "../actions/edit/duplicate.js";
2
+ import { escapeAction } from "../actions/edit/escape.js";
3
+ import { groupAction, ungroupAction } from "../actions/edit/group.js";
4
+ import { selectAllAction } from "../actions/edit/selectAll.js";
5
+ import { setFillAction } from "../actions/edit/setFill.js";
6
+ import { setFillOpacityAction } from "../actions/edit/setFillOpacity.js";
7
+ import { setStrokeAction } from "../actions/edit/setStroke.js";
8
+ import { setStrokeOpacityAction } from "../actions/edit/setStrokeOpacity.js";
9
+ import { setStrokeWidthAction } from "../actions/edit/setStrokeWidth.js";
10
+ import { setVertexColorAction } from "../actions/edit/setVertexColor.js";
11
+ import { transformAgainAction } from "../actions/transformAgain/action.js";
12
+ import { nudgeDownAction, nudgeLeftAction, nudgeRightAction, nudgeUpAction } from "../actions/edit/nudge.js";
13
+ import { clipboardCopyAction, clipboardCutAction, clipboardPasteAction, clipboardPasteEventAction } from "../actions/clipboard/action.js";
14
+ import { cancelGestureAction, contextMenuAction, deleteAction } from "@weasel-js/core";
15
+
16
+ // src/presets/edit.ts
17
+ /** Escape, and canceling the gesture in flight. */
18
+ var escapePreset = {
19
+ id: "escape",
20
+ label: "Escape",
21
+ actions: [escapeAction, cancelGestureAction]
22
+ };
23
+ /** The context menu. */
24
+ var contextMenuPreset = {
25
+ id: "contextMenu",
26
+ label: "Context menu",
27
+ actions: [contextMenuAction]
28
+ };
29
+ /** Cmd/Ctrl+A. */
30
+ var selectAllPreset = {
31
+ id: "selectAll",
32
+ label: "Select all",
33
+ actions: [selectAllAction]
34
+ };
35
+ /** Duplicate, and repeating the last transform. */
36
+ var duplicatePreset = {
37
+ id: "duplicate",
38
+ label: "Duplicate",
39
+ actions: [duplicateAction, transformAgainAction]
40
+ };
41
+ /** Deleting the selection. */
42
+ var deletePreset = {
43
+ id: "delete",
44
+ label: "Delete",
45
+ actions: [deleteAction]
46
+ };
47
+ /** Group and ungroup. */
48
+ var groupPreset = {
49
+ id: "group",
50
+ label: "Group",
51
+ actions: [groupAction, ungroupAction]
52
+ };
53
+ /** The arrow keys. */
54
+ var nudgePreset = {
55
+ id: "nudge",
56
+ label: "Nudge",
57
+ actions: [
58
+ nudgeUpAction,
59
+ nudgeDownAction,
60
+ nudgeLeftAction,
61
+ nudgeRightAction
62
+ ]
63
+ };
64
+ /** Fill and stroke, their opacities, the stroke's width, and a path's vertex colors. */
65
+ var stylePreset = {
66
+ id: "style",
67
+ label: "Style",
68
+ actions: [
69
+ setFillAction,
70
+ setStrokeAction,
71
+ setFillOpacityAction,
72
+ setStrokeOpacityAction,
73
+ setStrokeWidthAction,
74
+ setVertexColorAction
75
+ ]
76
+ };
77
+ /**
78
+ * Cut, copy, and paste.
79
+ *
80
+ * Cmd/Ctrl+V arrives as a DOM `paste` event, and two presets answer it. This
81
+ * one brings `clipboard.pasteEvent`, which pastes nodes a kit canvas copied
82
+ * and nothing else; `ingest` takes those plus images, SVG, files, and every
83
+ * OS drop. With both on, `ingest` answers alone.
84
+ */
85
+ var clipboardPreset = {
86
+ id: "clipboard",
87
+ label: "Clipboard",
88
+ actions: [
89
+ clipboardCutAction,
90
+ clipboardCopyAction,
91
+ clipboardPasteAction,
92
+ clipboardPasteEventAction
93
+ ]
94
+ };
95
+ /** Every edit preset above, and their keys. */
96
+ var editPreset = {
97
+ id: "edit",
98
+ label: "Edit",
99
+ includes: [
100
+ escapePreset,
101
+ contextMenuPreset,
102
+ selectAllPreset,
103
+ duplicatePreset,
104
+ deletePreset,
105
+ groupPreset,
106
+ nudgePreset,
107
+ stylePreset,
108
+ clipboardPreset
109
+ ]
110
+ };
111
+
112
+ export { clipboardPreset, contextMenuPreset, deletePreset, duplicatePreset, editPreset, escapePreset, groupPreset, nudgePreset, selectAllPreset, stylePreset };
113
+ //# sourceMappingURL=edit.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"edit.js","names":[],"sources":["../../src/presets/edit.ts"],"sourcesContent":["import { cancelGestureAction, deleteAction, contextMenuAction } from '@weasel-js/core';\nimport type { FeaturePreset } from '@weasel-js/core';\nimport { duplicateAction } from '../actions/edit/duplicate';\nimport { escapeAction } from '../actions/edit/escape';\nimport { groupAction, ungroupAction } from '../actions/edit/group';\nimport { selectAllAction } from '../actions/edit/selectAll';\nimport { setFillAction } from '../actions/edit/setFill';\nimport { setFillOpacityAction } from '../actions/edit/setFillOpacity';\nimport { setStrokeAction } from '../actions/edit/setStroke';\nimport { setStrokeOpacityAction } from '../actions/edit/setStrokeOpacity';\nimport { setStrokeWidthAction } from '../actions/edit/setStrokeWidth';\nimport { setVertexColorAction } from '../actions/edit/setVertexColor';\nimport { transformAgainAction } from '../actions/transformAgain/action';\nimport { nudgeDownAction, nudgeLeftAction, nudgeRightAction, nudgeUpAction } from '../actions/edit/nudge';\nimport { clipboardCopyAction, clipboardCutAction, clipboardPasteAction, clipboardPasteEventAction } from '../actions/clipboard/action';\n\n/** Escape, and canceling the gesture in flight. */\nexport const escapePreset: FeaturePreset = { id: 'escape', label: 'Escape', actions: [escapeAction, cancelGestureAction] };\n/** The context menu. */\nexport const contextMenuPreset: FeaturePreset = { id: 'contextMenu', label: 'Context menu', actions: [contextMenuAction] };\n/** Cmd/Ctrl+A. */\nexport const selectAllPreset: FeaturePreset = { id: 'selectAll', label: 'Select all', actions: [selectAllAction] };\n/** Duplicate, and repeating the last transform. */\nexport const duplicatePreset: FeaturePreset = { id: 'duplicate', label: 'Duplicate', actions: [duplicateAction, transformAgainAction] };\n/** Deleting the selection. */\nexport const deletePreset: FeaturePreset = { id: 'delete', label: 'Delete', actions: [deleteAction] };\n/** Group and ungroup. */\nexport const groupPreset: FeaturePreset = { id: 'group', label: 'Group', actions: [groupAction, ungroupAction] };\n/** The arrow keys. */\nexport const nudgePreset: FeaturePreset = {\n id: 'nudge', label: 'Nudge', actions: [nudgeUpAction, nudgeDownAction, nudgeLeftAction, nudgeRightAction],\n};\n/** Fill and stroke, their opacities, the stroke's width, and a path's vertex colors. */\nexport const stylePreset: FeaturePreset = {\n id: 'style',\n label: 'Style',\n actions: [\n setFillAction, setStrokeAction, setFillOpacityAction, setStrokeOpacityAction, setStrokeWidthAction, setVertexColorAction,\n ],\n};\n\n/**\n * Cut, copy, and paste.\n *\n * Cmd/Ctrl+V arrives as a DOM `paste` event, and two presets answer it. This\n * one brings `clipboard.pasteEvent`, which pastes nodes a kit canvas copied\n * and nothing else; `ingest` takes those plus images, SVG, files, and every\n * OS drop. With both on, `ingest` answers alone.\n */\nexport const clipboardPreset: FeaturePreset = {\n id: 'clipboard',\n label: 'Clipboard',\n actions: [clipboardCutAction, clipboardCopyAction, clipboardPasteAction, clipboardPasteEventAction],\n};\n\n/** Every edit preset above, and their keys. */\nexport const editPreset: FeaturePreset = {\n id: 'edit',\n label: 'Edit',\n includes: [\n escapePreset, contextMenuPreset, selectAllPreset, duplicatePreset, deletePreset, groupPreset, nudgePreset,\n stylePreset, clipboardPreset,\n ],\n};\n"],"mappings":";;;;;;;;;;;;;;;;;AAiBA,IAAa,eAA8B;CAAE,IAAI;CAAU,OAAO;CAAU,SAAS,CAAC,cAAc,mBAAmB;AAAE;;AAEzH,IAAa,oBAAmC;CAAE,IAAI;CAAe,OAAO;CAAgB,SAAS,CAAC,iBAAiB;AAAE;;AAEzH,IAAa,kBAAiC;CAAE,IAAI;CAAa,OAAO;CAAc,SAAS,CAAC,eAAe;AAAE;;AAEjH,IAAa,kBAAiC;CAAE,IAAI;CAAa,OAAO;CAAa,SAAS,CAAC,iBAAiB,oBAAoB;AAAE;;AAEtI,IAAa,eAA8B;CAAE,IAAI;CAAU,OAAO;CAAU,SAAS,CAAC,YAAY;AAAE;;AAEpG,IAAa,cAA6B;CAAE,IAAI;CAAS,OAAO;CAAS,SAAS,CAAC,aAAa,aAAa;AAAE;;AAE/G,IAAa,cAA6B;CACxC,IAAI;CAAS,OAAO;CAAS,SAAS;EAAC;EAAe;EAAiB;EAAiB;CAAgB;AAC1G;;AAEA,IAAa,cAA6B;CACxC,IAAI;CACJ,OAAO;CACP,SAAS;EACP;EAAe;EAAiB;EAAsB;EAAwB;EAAsB;CACtG;AACF;;;;;;;;;AAUA,IAAa,kBAAiC;CAC5C,IAAI;CACJ,OAAO;CACP,SAAS;EAAC;EAAoB;EAAqB;EAAsB;CAAyB;AACpG;;AAGA,IAAa,aAA4B;CACvC,IAAI;CACJ,OAAO;CACP,UAAU;EACR;EAAc;EAAmB;EAAiB;EAAiB;EAAc;EAAa;EAC9F;EAAa;CACf;AACF"}
@@ -0,0 +1,13 @@
1
+ import { ingestAction } from "../actions/edit/ingest.js";
2
+
3
+ // src/presets/ingest.ts
4
+ /** Dropped and pasted content: images, SVG, files, and whatever
5
+ * `ingestion.handlers` accept, on Cmd/Ctrl+V or an OS drop. */
6
+ var ingestPreset = {
7
+ id: "ingest",
8
+ label: "Ingest",
9
+ actions: [ingestAction]
10
+ };
11
+
12
+ export { ingestPreset };
13
+ //# sourceMappingURL=ingest.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ingest.js","names":[],"sources":["../../src/presets/ingest.ts"],"sourcesContent":["import type { FeaturePreset } from '@weasel-js/core';\nimport { ingestAction } from '../actions/edit/ingest';\n\n/** Dropped and pasted content: images, SVG, files, and whatever\n * `ingestion.handlers` accept, on Cmd/Ctrl+V or an OS drop. */\nexport const ingestPreset: FeaturePreset = {\n id: 'ingest',\n label: 'Ingest',\n actions: [ingestAction],\n};\n"],"mappings":";;;;;AAKA,IAAa,eAA8B;CACzC,IAAI;CACJ,OAAO;CACP,SAAS,CAAC,YAAY;AACxB"}
@@ -0,0 +1,23 @@
1
+ import { pathfinderCropAction, pathfinderDivideAction, pathfinderExcludeAction, pathfinderIntersectAction, pathfinderMergeAction, pathfinderSubtractAction, pathfinderTrimAction, pathfinderUnionAction } from "../actions/pathfinder/action.js";
2
+ import { makeBooleanGroupAction } from "../actions/pathfinder/booleanGroupAction.js";
3
+
4
+ // src/presets/pathfinder.ts
5
+ /** The pathfinder booleans, and the live boolean group. */
6
+ var pathfinderPreset = {
7
+ id: "pathfinder",
8
+ label: "Pathfinder",
9
+ actions: [
10
+ pathfinderUnionAction,
11
+ pathfinderSubtractAction,
12
+ pathfinderIntersectAction,
13
+ pathfinderExcludeAction,
14
+ pathfinderDivideAction,
15
+ pathfinderCropAction,
16
+ pathfinderTrimAction,
17
+ pathfinderMergeAction,
18
+ makeBooleanGroupAction
19
+ ]
20
+ };
21
+
22
+ export { pathfinderPreset };
23
+ //# sourceMappingURL=pathfinder.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pathfinder.js","names":[],"sources":["../../src/presets/pathfinder.ts"],"sourcesContent":["import type { FeaturePreset } from '@weasel-js/core';\nimport { pathfinderCropAction, pathfinderDivideAction, pathfinderExcludeAction, pathfinderIntersectAction, pathfinderMergeAction, pathfinderSubtractAction, pathfinderTrimAction, pathfinderUnionAction } from '../actions/pathfinder/action';\nimport { makeBooleanGroupAction } from '../actions/pathfinder/booleanGroupAction';\n\n/** The pathfinder booleans, and the live boolean group. */\nexport const pathfinderPreset: FeaturePreset = {\n id: 'pathfinder',\n label: 'Pathfinder',\n actions: [\n pathfinderUnionAction, pathfinderSubtractAction, pathfinderIntersectAction, pathfinderExcludeAction,\n pathfinderDivideAction, pathfinderCropAction, pathfinderTrimAction, pathfinderMergeAction,\n makeBooleanGroupAction,\n ],\n};\n"],"mappings":";;;;;AAKA,IAAa,mBAAkC;CAC7C,IAAI;CACJ,OAAO;CACP,SAAS;EACP;EAAuB;EAA0B;EAA2B;EAC5E;EAAwB;EAAsB;EAAsB;EACpE;CACF;AACF"}
@@ -0,0 +1,18 @@
1
+ import { selectToolsPreset } from "./tools.js";
2
+ import { areaSelectAction, clearSelectionAction, lassoSelectAction } from "@weasel-js/core";
3
+
4
+ // src/presets/select.ts
5
+ /** The select and lasso tools: click, marquee, lasso, and clearing on an empty click. */
6
+ var selectPreset = {
7
+ id: "select",
8
+ label: "Select",
9
+ actions: [
10
+ areaSelectAction,
11
+ lassoSelectAction,
12
+ clearSelectionAction
13
+ ],
14
+ includes: [selectToolsPreset]
15
+ };
16
+
17
+ export { selectPreset };
18
+ //# sourceMappingURL=select.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"select.js","names":[],"sources":["../../src/presets/select.ts"],"sourcesContent":["import { areaSelectAction, clearSelectionAction, lassoSelectAction } from '@weasel-js/core';\nimport type { FeaturePreset } from '@weasel-js/core';\nimport { selectToolsPreset } from './tools';\n\n/** The select and lasso tools: click, marquee, lasso, and clearing on an empty click. */\nexport const selectPreset: FeaturePreset = {\n id: 'select',\n label: 'Select',\n actions: [areaSelectAction, lassoSelectAction, clearSelectionAction],\n includes: [selectToolsPreset],\n};\n"],"mappings":";;;;;AAKA,IAAa,eAA8B;CACzC,IAAI;CACJ,OAAO;CACP,SAAS;EAAC;EAAkB;EAAmB;CAAoB;CACnE,UAAU,CAAC,iBAAiB;AAC9B"}
@@ -0,0 +1,15 @@
1
+ import { SELECT_TOOLS, SHAPE_TOOLS } from "@weasel-js/core";
2
+
3
+ // src/presets/tools.ts
4
+ var toolsOf = (set, label) => ({
5
+ id: `tools:${set.id}`,
6
+ label,
7
+ tools: [set]
8
+ });
9
+ /** The select tool and the lasso. */
10
+ var selectToolsPreset = toolsOf(SELECT_TOOLS, "Selection tools");
11
+ /** The tools that drag out a primitive: rect, ellipse, line, polygon, star. */
12
+ var shapeToolsPreset = toolsOf(SHAPE_TOOLS, "Shape tools");
13
+
14
+ export { selectToolsPreset, shapeToolsPreset };
15
+ //# sourceMappingURL=tools.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tools.js","names":[],"sources":["../../src/presets/tools.ts"],"sourcesContent":["import { SELECT_TOOLS, SHAPE_TOOLS } from '@weasel-js/core';\nimport type { ToolSet } from '@weasel-js/routing';\nimport type { FeaturePreset, BuiltinToolId } from '@weasel-js/core';\n\nconst toolsOf = (set: ToolSet<BuiltinToolId>, label: string): FeaturePreset =>\n ({ id: `tools:${set.id}`, label, tools: [set] });\n\n/** The select tool and the lasso. */\nexport const selectToolsPreset = toolsOf(SELECT_TOOLS, 'Selection tools');\n/** The tools that drag out a primitive: rect, ellipse, line, polygon, star. */\nexport const shapeToolsPreset = toolsOf(SHAPE_TOOLS, 'Shape tools');\n"],"mappings":";;;AAIA,IAAM,WAAW,KAA6B,WAC3C;CAAE,IAAI,SAAS,IAAI;CAAM;CAAO,OAAO,CAAC,GAAG;AAAE;;AAGhD,IAAa,oBAAoB,QAAQ,cAAc,iBAAiB;;AAExE,IAAa,mBAAmB,QAAQ,aAAa,aAAa"}
@@ -0,0 +1,39 @@
1
+ import { PRESET_CHROME, cloneAction, moveAction, resizeAction, rotateAction, selectionMoveContribution, selectionResizeContribution, selectionRotateContribution } from "@weasel-js/core";
2
+
3
+ // src/presets/transform.ts
4
+ /** The selection outline, drawn only while this is on. */
5
+ var outlinePreset = {
6
+ id: "outline",
7
+ label: "Outline",
8
+ chrome: PRESET_CHROME.outline
9
+ };
10
+ /** Resize handles, drawn and bound. A handle sits over the selected body, so
11
+ * it refines `move`, whose binding matches a handle drag too. */
12
+ var resizePreset = {
13
+ id: "resize",
14
+ label: "Resize",
15
+ refines: ["move"],
16
+ actions: [resizeAction],
17
+ ambient: () => selectionResizeContribution(),
18
+ chrome: PRESET_CHROME.resize
19
+ };
20
+ /** The rotation handle, drawn and bound. It refines `move` as `resize` does. */
21
+ var rotatePreset = {
22
+ id: "rotate",
23
+ label: "Rotate",
24
+ refines: ["move"],
25
+ actions: [rotateAction],
26
+ ambient: ({ rotate }) => selectionRotateContribution({ rotate }),
27
+ chrome: PRESET_CHROME.rotate
28
+ };
29
+ /** Drag a body to move it, Alt-drag to clone it, under any tool that does not
30
+ * claim the drag. */
31
+ var movePreset = {
32
+ id: "move",
33
+ label: "Move",
34
+ actions: [moveAction, cloneAction],
35
+ ambient: ({ move }) => selectionMoveContribution({ move })
36
+ };
37
+
38
+ export { movePreset, outlinePreset, resizePreset, rotatePreset };
39
+ //# sourceMappingURL=transform.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"transform.js","names":[],"sources":["../../src/presets/transform.ts"],"sourcesContent":["import { cloneAction, moveAction, resizeAction, rotateAction, PRESET_CHROME } from '@weasel-js/core';\nimport {\n selectionMoveContribution,\n selectionResizeContribution,\n selectionRotateContribution,\n} from '@weasel-js/core';\nimport type { FeaturePreset } from '@weasel-js/core';\n\n/** The selection outline, drawn only while this is on. */\nexport const outlinePreset: FeaturePreset = {\n id: 'outline',\n label: 'Outline',\n chrome: PRESET_CHROME.outline,\n};\n\n/** Resize handles, drawn and bound. A handle sits over the selected body, so\n * it refines `move`, whose binding matches a handle drag too. */\nexport const resizePreset: FeaturePreset = {\n id: 'resize',\n label: 'Resize',\n refines: ['move'],\n actions: [resizeAction],\n ambient: () => selectionResizeContribution(),\n chrome: PRESET_CHROME.resize,\n};\n\n/** The rotation handle, drawn and bound. It refines `move` as `resize` does. */\nexport const rotatePreset: FeaturePreset = {\n id: 'rotate',\n label: 'Rotate',\n refines: ['move'],\n actions: [rotateAction],\n ambient: ({ rotate }) => selectionRotateContribution({ rotate }),\n chrome: PRESET_CHROME.rotate,\n};\n\n/** Drag a body to move it, Alt-drag to clone it, under any tool that does not\n * claim the drag. */\nexport const movePreset: FeaturePreset = {\n id: 'move',\n label: 'Move',\n actions: [moveAction, cloneAction],\n ambient: ({ move }) => selectionMoveContribution({ move }),\n};\n"],"mappings":";;;;AASA,IAAa,gBAA+B;CAC1C,IAAI;CACJ,OAAO;CACP,QAAQ,cAAc;AACxB;;;AAIA,IAAa,eAA8B;CACzC,IAAI;CACJ,OAAO;CACP,SAAS,CAAC,MAAM;CAChB,SAAS,CAAC,YAAY;CACtB,eAAe,4BAA4B;CAC3C,QAAQ,cAAc;AACxB;;AAGA,IAAa,eAA8B;CACzC,IAAI;CACJ,OAAO;CACP,SAAS,CAAC,MAAM;CAChB,SAAS,CAAC,YAAY;CACtB,UAAU,EAAE,aAAa,4BAA4B,EAAE,OAAO,CAAC;CAC/D,QAAQ,cAAc;AACxB;;;AAIA,IAAa,aAA4B;CACvC,IAAI;CACJ,OAAO;CACP,SAAS,CAAC,YAAY,WAAW;CACjC,UAAU,EAAE,WAAW,0BAA0B,EAAE,KAAK,CAAC;AAC3D"}
@@ -0,0 +1,26 @@
1
+ import { KIT_STANDARD_ACTIONS } from "./namedPresets.js";
2
+ import { useActionSet, useStandardDeps } from "@weasel-js/core/engine";
3
+
4
+ // src/useStandardActions.ts
5
+ /** Every id `useStandardActions` can register, each kit preset's in turn and
6
+ * then the tool-driven ones. It holds `clipboard.pasteEvent` back while
7
+ * `ingest` is registered. */
8
+ var KIT_STANDARD_ACTION_IDS = KIT_STANDARD_ACTIONS.map((a) => a.id);
9
+ /**
10
+ * Register each kit-standard dep source and action descriptor into the
11
+ * surrounding `<ActionsProvider>` and `<DepRegistryProvider>` (typically
12
+ * provided by `<SceneCanvas>`); a silent no-op when either is absent.
13
+ *
14
+ * Each dep option is published as a live source in the dep registry under its
15
+ * canonical name (`selection`, `scene`, …). The source reads the latest
16
+ * option value at invocation time, so consumers don't have to memoize their
17
+ * dep objects.
18
+ */
19
+ function useStandardActions(opts) {
20
+ const { actions = KIT_STANDARD_ACTIONS, exclude, ...deps } = opts;
21
+ useStandardDeps(deps);
22
+ useActionSet(actions, exclude);
23
+ }
24
+
25
+ export { KIT_STANDARD_ACTION_IDS, useStandardActions };
26
+ //# sourceMappingURL=useStandardActions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useStandardActions.js","names":[],"sources":["../src/useStandardActions.ts"],"sourcesContent":["/**\n * `useStandardActions` — register the kit-standard action descriptors into the\n * nearest `<ActionsProvider>` and publish dep sources into the nearest\n * `<DepRegistryProvider>`. Falls back silently to a no-op when either is\n * not in scope.\n */\nimport type { Action } from '@weasel-js/routing';\nimport { KIT_STANDARD_ACTIONS } from './namedPresets';\nimport { useActionSet, useStandardDeps, type StandardDeps } from '@weasel-js/core/engine';\n\n/** Options for `useStandardActions`: which actions to register, and the deps they read. */\nexport interface UseStandardActionsOptions extends StandardDeps {\n /**\n * The actions to register, in order. Default: every kit-standard action\n * (`KIT_STANDARD_ACTION_IDS`). A preset's `actions` is a set in this form.\n */\n actions?: readonly Action[];\n /**\n * Ids of kit-standard actions to leave unregistered, so a consumer can bind\n * its own. Ids that name no kit action are ignored;\n * `KIT_STANDARD_ACTION_IDS` is the full list.\n */\n exclude?: Iterable<string>;\n}\n\n/** Every id `useStandardActions` can register, each kit preset's in turn and\n * then the tool-driven ones. It holds `clipboard.pasteEvent` back while\n * `ingest` is registered. */\nexport const KIT_STANDARD_ACTION_IDS: readonly string[] = KIT_STANDARD_ACTIONS.map((a) => a.id);\n\n/**\n * Register each kit-standard dep source and action descriptor into the\n * surrounding `<ActionsProvider>` and `<DepRegistryProvider>` (typically\n * provided by `<SceneCanvas>`); a silent no-op when either is absent.\n *\n * Each dep option is published as a live source in the dep registry under its\n * canonical name (`selection`, `scene`, …). The source reads the latest\n * option value at invocation time, so consumers don't have to memoize their\n * dep objects.\n */\nexport function useStandardActions(opts: UseStandardActionsOptions): void {\n const { actions = KIT_STANDARD_ACTIONS, exclude, ...deps } = opts;\n useStandardDeps(deps);\n useActionSet(actions, exclude);\n}\n"],"mappings":";;;;;;;AA4BA,IAAa,0BAA6C,qBAAqB,KAAK,MAAM,EAAE,EAAE;;;;;;;;;;;AAY9F,SAAgB,mBAAmB,MAAuC;CACxE,MAAM,EAAE,UAAU,sBAAsB,SAAS,GAAG,SAAS;CAC7D,gBAAgB,IAAI;CACpB,aAAa,SAAS,OAAO;AAC/B"}
package/package.json CHANGED
@@ -1,6 +1,61 @@
1
1
  {
2
2
  "name": "@weasel-js/editing",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "1.19.1",
4
+ "description": "Editing for a weasel canvas, as presets an app opts into: selecting, moving, resizing and rotating, the edit, arrange and Pathfinder commands, and paste and drop.",
5
+ "weasel": {
6
+ "tier": "plugin"
7
+ },
8
+ "license": "MIT",
9
+ "type": "module",
10
+ "sideEffects": false,
11
+ "main": "./dist/index.js",
12
+ "module": "./dist/index.js",
13
+ "types": "./dist/index.d.ts",
14
+ "exports": {
15
+ ".": {
16
+ "types": "./dist/index.d.ts",
17
+ "import": "./dist/index.js"
18
+ },
19
+ "./package.json": "./package.json"
20
+ },
21
+ "author": "orochi235",
22
+ "homepage": "https://orochi235.github.io/weasel/",
23
+ "repository": {
24
+ "type": "git",
25
+ "url": "git+https://github.com/orochi235/weasel.git",
26
+ "directory": "packages/editing"
27
+ },
28
+ "bugs": {
29
+ "url": "https://github.com/orochi235/weasel/issues"
30
+ },
31
+ "engines": {
32
+ "node": ">=24"
33
+ },
34
+ "files": [
35
+ "dist",
36
+ "README.md",
37
+ "LICENSE"
38
+ ],
39
+ "scripts": {
40
+ "build": "vite build && tsup",
41
+ "test": "node ../../scripts/package-test.mjs"
42
+ },
43
+ "dependencies": {
44
+ "@weasel-js/gestures": "1.19.1",
45
+ "@weasel-js/icons": "1.19.1",
46
+ "@weasel-js/paint": "1.19.1",
47
+ "@weasel-js/prefs-schema": "1.19.1",
48
+ "@weasel-js/react": "1.19.1",
49
+ "@weasel-js/registry": "1.19.1",
50
+ "@weasel-js/routing": "1.19.1"
51
+ },
52
+ "peerDependencies": {
53
+ "@weasel-js/core": "1.19.1",
54
+ "@weasel-js/geom": "1.19.1",
55
+ "react": ">=18"
56
+ },
57
+ "publishConfig": {
58
+ "access": "public",
59
+ "provenance": true
60
+ }
61
+ }