@pixerate/editor 0.25.0 → 0.26.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 (113) hide show
  1. package/README.md +30 -0
  2. package/THIRD_PARTY_NOTICES.md +11 -0
  3. package/dist/agent/index.cjs +174 -11
  4. package/dist/agent/index.cjs.map +1 -1
  5. package/dist/agent/index.d.cts +18 -4
  6. package/dist/agent/index.d.ts +18 -4
  7. package/dist/agent/index.js +167 -4
  8. package/dist/agent/index.js.map +1 -1
  9. package/dist/{arrangeShortcuts-B8O3f8-P.d.cts → arrange-BICutYPk.d.cts} +243 -29
  10. package/dist/{arrangeShortcuts-sLlD2rSX.d.ts → arrange-BICutYPk.d.ts} +243 -29
  11. package/dist/builtins-CdPcLwwF.d.cts +176 -0
  12. package/dist/builtins-Chj6zv_O.d.ts +176 -0
  13. package/dist/canvas/index.cjs +3917 -19
  14. package/dist/canvas/index.cjs.map +1 -1
  15. package/dist/canvas/index.d.cts +1232 -7
  16. package/dist/canvas/index.d.ts +1232 -7
  17. package/dist/canvas/index.js +3916 -18
  18. package/dist/canvas/index.js.map +1 -1
  19. package/dist/chunk-3CC7OPUQ.cjs +831 -0
  20. package/dist/chunk-3CC7OPUQ.cjs.map +1 -0
  21. package/dist/{chunk-7WISYZFO.cjs → chunk-66IMF6OD.cjs} +174 -67
  22. package/dist/chunk-66IMF6OD.cjs.map +1 -0
  23. package/dist/{chunk-AL6JMGWW.cjs → chunk-CS6NZWWA.cjs} +24 -24
  24. package/dist/{chunk-AL6JMGWW.cjs.map → chunk-CS6NZWWA.cjs.map} +1 -1
  25. package/dist/{chunk-C7P22VIP.cjs → chunk-EWCOFSCQ.cjs} +17 -6
  26. package/dist/chunk-EWCOFSCQ.cjs.map +1 -0
  27. package/dist/chunk-HDYMLS3X.cjs +409 -0
  28. package/dist/chunk-HDYMLS3X.cjs.map +1 -0
  29. package/dist/{chunk-V3CHHWOE.cjs → chunk-HNDSPZ5T.cjs} +4 -4
  30. package/dist/{chunk-V3CHHWOE.cjs.map → chunk-HNDSPZ5T.cjs.map} +1 -1
  31. package/dist/{chunk-X4N4WUKB.cjs → chunk-IFHKKVXH.cjs} +150 -38
  32. package/dist/chunk-IFHKKVXH.cjs.map +1 -0
  33. package/dist/chunk-KRGXUQ2Y.js +1696 -0
  34. package/dist/chunk-KRGXUQ2Y.js.map +1 -0
  35. package/dist/{chunk-PO6A6QQH.cjs → chunk-LN2POBHT.cjs} +742 -970
  36. package/dist/chunk-LN2POBHT.cjs.map +1 -0
  37. package/dist/chunk-MR2764X2.js +831 -0
  38. package/dist/chunk-MR2764X2.js.map +1 -0
  39. package/dist/{chunk-WSQKHXW7.cjs → chunk-NQF32I6Z.cjs} +1209 -457
  40. package/dist/chunk-NQF32I6Z.cjs.map +1 -0
  41. package/dist/{chunk-NAXVVS5I.js → chunk-QJSOZFCZ.js} +2 -2
  42. package/dist/{chunk-UAKDG62Z.js → chunk-SWE3NPOU.js} +116 -4
  43. package/dist/chunk-SWE3NPOU.js.map +1 -0
  44. package/dist/chunk-TXXNBDQX.cjs +1696 -0
  45. package/dist/chunk-TXXNBDQX.cjs.map +1 -0
  46. package/dist/chunk-UBCFIABU.js +409 -0
  47. package/dist/chunk-UBCFIABU.js.map +1 -0
  48. package/dist/{chunk-ECCCYKGL.js → chunk-UKI64KUD.js} +147 -40
  49. package/dist/chunk-UKI64KUD.js.map +1 -0
  50. package/dist/{chunk-QGYDWPRM.js → chunk-WON34HKM.js} +2 -2
  51. package/dist/{chunk-RR7F5GUM.js → chunk-X7HXL2SB.js} +941 -189
  52. package/dist/chunk-X7HXL2SB.js.map +1 -0
  53. package/dist/{chunk-IXHSYOVY.js → chunk-XQFHLT53.js} +638 -866
  54. package/dist/chunk-XQFHLT53.js.map +1 -0
  55. package/dist/{chunk-FH6F67DN.js → chunk-ZRNHGAQT.js} +17 -6
  56. package/dist/{chunk-FH6F67DN.js.map → chunk-ZRNHGAQT.js.map} +1 -1
  57. package/dist/commands/index.cjs +352 -4
  58. package/dist/commands/index.cjs.map +1 -1
  59. package/dist/commands/index.d.cts +37 -108
  60. package/dist/commands/index.d.ts +37 -108
  61. package/dist/commands/index.js +351 -3
  62. package/dist/commands/index.js.map +1 -1
  63. package/dist/compare/index.cjs +3 -3
  64. package/dist/compare/index.js +2 -2
  65. package/dist/{controller-BIJiNoVs.d.cts → controller-CxXGOEmy.d.cts} +209 -13
  66. package/dist/{controller-BIJiNoVs.d.ts → controller-CxXGOEmy.d.ts} +209 -13
  67. package/dist/export/index.cjs +36 -0
  68. package/dist/export/index.cjs.map +1 -0
  69. package/dist/export/index.d.cts +243 -0
  70. package/dist/export/index.d.ts +243 -0
  71. package/dist/export/index.js +36 -0
  72. package/dist/export/index.js.map +1 -0
  73. package/dist/extensions/index.cjs +54 -6
  74. package/dist/extensions/index.cjs.map +1 -1
  75. package/dist/extensions/index.d.cts +7 -2
  76. package/dist/extensions/index.d.ts +7 -2
  77. package/dist/extensions/index.js +59 -11
  78. package/dist/{index-7a6bHTLy.d.ts → index-B273Zllk.d.ts} +211 -207
  79. package/dist/{index-Csd5qI8u.d.cts → index-jcJwmBYt.d.cts} +211 -207
  80. package/dist/index.cjs +146 -32
  81. package/dist/index.cjs.map +1 -1
  82. package/dist/index.d.cts +50 -14
  83. package/dist/index.d.ts +50 -14
  84. package/dist/index.js +138 -24
  85. package/dist/index.js.map +1 -1
  86. package/dist/registry-CED5C0lA.d.cts +204 -0
  87. package/dist/registry-CED5C0lA.d.ts +204 -0
  88. package/dist/{registry-D32LpIc4.d.cts → registry-D0GADKc7.d.cts} +1 -1
  89. package/dist/{registry-evKTP4ls.d.ts → registry-DhVUZioj.d.ts} +1 -1
  90. package/dist/serializers/index.cjs +6 -4
  91. package/dist/serializers/index.cjs.map +1 -1
  92. package/dist/serializers/index.d.cts +15 -4
  93. package/dist/serializers/index.d.ts +15 -4
  94. package/dist/serializers/index.js +5 -3
  95. package/dist/spreadsheet/index.cjs +33 -3
  96. package/dist/spreadsheet/index.cjs.map +1 -1
  97. package/dist/spreadsheet/index.d.cts +106 -3
  98. package/dist/spreadsheet/index.d.ts +106 -3
  99. package/dist/spreadsheet/index.js +32 -2
  100. package/package.json +10 -1
  101. package/dist/chunk-7WISYZFO.cjs.map +0 -1
  102. package/dist/chunk-C7P22VIP.cjs.map +0 -1
  103. package/dist/chunk-ECCCYKGL.js.map +0 -1
  104. package/dist/chunk-IXHSYOVY.js.map +0 -1
  105. package/dist/chunk-PO6A6QQH.cjs.map +0 -1
  106. package/dist/chunk-RR7F5GUM.js.map +0 -1
  107. package/dist/chunk-UAKDG62Z.js.map +0 -1
  108. package/dist/chunk-WSQKHXW7.cjs.map +0 -1
  109. package/dist/chunk-X4N4WUKB.cjs.map +0 -1
  110. package/dist/types-DX4Mh4SL.d.cts +0 -217
  111. package/dist/types-DX4Mh4SL.d.ts +0 -217
  112. /package/dist/{chunk-NAXVVS5I.js.map → chunk-QJSOZFCZ.js.map} +0 -0
  113. /package/dist/{chunk-QGYDWPRM.js.map → chunk-WON34HKM.js.map} +0 -0
@@ -239,10 +239,10 @@ var CommandRegistry = (_class = class {
239
239
  }
240
240
  /** Like `execute`, but awaits async commands (rejections become `failed` results). */
241
241
  async executeAsync(id, params, context = this.context) {
242
- const outcome = this.execute(id, params, context);
243
- if (!outcome.ok || !isThenable(outcome.result)) return outcome;
242
+ const outcome2 = this.execute(id, params, context);
243
+ if (!outcome2.ok || !isThenable(outcome2.result)) return outcome2;
244
244
  try {
245
- const result = await outcome.result;
245
+ const result = await outcome2.result;
246
246
  this.notify();
247
247
  return { ok: true, id, result };
248
248
  } catch (error) {
@@ -872,6 +872,182 @@ function createShapeCommands(controller, options = {}) {
872
872
  }
873
873
  ];
874
874
  }
875
+ var outcome = (result) => {
876
+ if (!result.ok) throw new Error(result.reason);
877
+ return { ids: result.ids };
878
+ };
879
+ var ID_PARAM = { type: "string", description: "Instance (or layer inside one) to act on (default: the first selected node)." };
880
+ function createComponentCommands(controller, options = {}) {
881
+ const prefix = _nullishCoalesce(options.prefix, () => ( "canvas."));
882
+ const group = _nullishCoalesce(options.group, () => ( "Components"));
883
+ const scope = options.scope === null ? void 0 : _nullishCoalesce(options.scope, () => ( "canvas"));
884
+ const base = { group, ...scope ? { scope } : {} };
885
+ const idParams = { type: "object", properties: { id: ID_PARAM } };
886
+ return [
887
+ {
888
+ ...base,
889
+ id: `${prefix}createComponent`,
890
+ label: "Create Component",
891
+ keywords: ["component", "symbol", "main component", "reusable"],
892
+ description: "Turns the selected frame into a main component, or wraps the selection in one.",
893
+ params: IDS_PARAMS,
894
+ shortcut: "Mod+Alt+K",
895
+ enabled: (_ctx, params) => controller.canCreateComponent(_optionalChain([params, 'optionalAccess', _52 => _52.ids])),
896
+ run: (_ctx, params) => outcome(controller.createComponent(_optionalChain([params, 'optionalAccess', _53 => _53.ids])))
897
+ },
898
+ {
899
+ ...base,
900
+ id: `${prefix}combineAsVariants`,
901
+ label: "Combine as Variants",
902
+ keywords: ["component set", "variant", "variants"],
903
+ description: "Wraps the selected components in a component set.",
904
+ params: IDS_PARAMS,
905
+ enabled: (_ctx, params) => controller.canCombineAsVariants(_optionalChain([params, 'optionalAccess', _54 => _54.ids])),
906
+ run: (_ctx, params) => outcome(controller.combineAsVariants(_optionalChain([params, 'optionalAccess', _55 => _55.ids])))
907
+ },
908
+ {
909
+ ...base,
910
+ id: `${prefix}createInstance`,
911
+ label: "Create Instance",
912
+ keywords: ["instance", "insert component", "use component"],
913
+ description: "Places an instance of a component (or a component set\u2019s default variant).",
914
+ params: {
915
+ type: "object",
916
+ properties: {
917
+ componentId: { type: "string", description: "Component or component set id." },
918
+ parentId: { type: "string", description: "Frame to place it in (default: the canvas)." },
919
+ x: { type: "number", description: "X in the parent\u2019s space (default: next to the main)." },
920
+ y: { type: "number", description: "Y in the parent\u2019s space." },
921
+ properties: { type: "object", description: "Variant and component property values.", additionalProperties: true }
922
+ },
923
+ required: ["componentId"]
924
+ },
925
+ enabled: (_ctx, params) => _optionalChain([params, 'optionalAccess', _56 => _56.componentId]) === void 0 ? true : controller.canCreateInstance(params.componentId, params.parentId),
926
+ run: (_ctx, params) => outcome(
927
+ controller.createInstance(params.componentId, {
928
+ ...params.parentId !== void 0 ? { parentId: params.parentId } : {},
929
+ ...params.x !== void 0 || params.y !== void 0 ? { position: { x: _nullishCoalesce(params.x, () => ( 0)), y: _nullishCoalesce(params.y, () => ( 0)) } } : {},
930
+ ...params.properties ? { properties: params.properties } : {}
931
+ })
932
+ )
933
+ },
934
+ {
935
+ ...base,
936
+ id: `${prefix}detachInstance`,
937
+ label: "Detach Instance",
938
+ keywords: ["unlink", "break instance"],
939
+ description: "Turns the selected instances into plain frames that keep their look.",
940
+ params: IDS_PARAMS,
941
+ shortcut: "Mod+Alt+B",
942
+ enabled: (_ctx, params) => controller.canDetachInstance(_optionalChain([params, 'optionalAccess', _57 => _57.ids])),
943
+ run: (_ctx, params) => outcome(controller.detachInstance(_optionalChain([params, 'optionalAccess', _58 => _58.ids])))
944
+ },
945
+ {
946
+ ...base,
947
+ id: `${prefix}resetOverrides`,
948
+ label: "Reset All Changes",
949
+ keywords: ["reset instance", "reset overrides", "revert"],
950
+ description: "Resets the overrides of an instance (or of a layer, or one override group) to its main.",
951
+ params: {
952
+ type: "object",
953
+ properties: {
954
+ id: ID_PARAM,
955
+ group: { type: "string", description: 'One override group to reset, e.g. "data.label" or "shape.fill" (default: all).' }
956
+ }
957
+ },
958
+ enabled: (_ctx, params) => controller.canResetOverrides(_optionalChain([params, 'optionalAccess', _59 => _59.id])),
959
+ run: (_ctx, params) => outcome(controller.resetOverrides(_optionalChain([params, 'optionalAccess', _60 => _60.id]), _optionalChain([params, 'optionalAccess', _61 => _61.group])))
960
+ },
961
+ {
962
+ ...base,
963
+ id: `${prefix}pushOverrides`,
964
+ label: "Push Changes to Main Component",
965
+ keywords: ["push overrides", "update main component"],
966
+ description: "Copies the instance\u2019s overrides to its main component and every other instance.",
967
+ params: idParams,
968
+ enabled: (_ctx, params) => controller.canPushOverrides(_optionalChain([params, 'optionalAccess', _62 => _62.id])),
969
+ run: (_ctx, params) => outcome(controller.pushOverrides(_optionalChain([params, 'optionalAccess', _63 => _63.id])))
970
+ },
971
+ {
972
+ ...base,
973
+ id: `${prefix}goToMainComponent`,
974
+ label: "Go to Main Component",
975
+ keywords: ["main component", "find main", "reveal"],
976
+ description: "Selects the main component of the selected instance.",
977
+ params: idParams,
978
+ enabled: (_ctx, params) => controller.canGoToMainComponent(_optionalChain([params, 'optionalAccess', _64 => _64.id])),
979
+ run: (_ctx, params) => {
980
+ const main = controller.goToMainComponent(_optionalChain([params, 'optionalAccess', _65 => _65.id]));
981
+ if (!main) throw new Error("The main component was not found.");
982
+ return { id: main };
983
+ }
984
+ },
985
+ {
986
+ ...base,
987
+ id: `${prefix}swapInstance`,
988
+ label: "Swap Instance\u2026",
989
+ keywords: ["replace instance", "swap component"],
990
+ description: "Makes the selected instances show another component, keeping matching overrides.",
991
+ params: {
992
+ type: "object",
993
+ properties: {
994
+ componentId: { type: "string", description: "Component or component set to swap to." },
995
+ ids: IDS_PARAMS.properties.ids
996
+ },
997
+ required: ["componentId"]
998
+ },
999
+ enabled: (_ctx, params) => controller.canSwapInstance(_optionalChain([params, 'optionalAccess', _66 => _66.componentId]), _optionalChain([params, 'optionalAccess', _67 => _67.ids])),
1000
+ run: (_ctx, params) => outcome(controller.swapInstance(params.componentId, _optionalChain([params, 'optionalAccess', _68 => _68.ids])))
1001
+ },
1002
+ {
1003
+ ...base,
1004
+ id: `${prefix}setInstanceProperties`,
1005
+ label: "Set Instance Properties\u2026",
1006
+ keywords: ["variant", "switch variant", "component property", "toggle"],
1007
+ description: "Sets variant properties (switching variants) and component property values of the selected instances.",
1008
+ params: {
1009
+ type: "object",
1010
+ properties: {
1011
+ properties: { type: "object", description: "Property name \u2192 value (variant value, boolean, text or component id).", additionalProperties: true },
1012
+ ids: IDS_PARAMS.properties.ids
1013
+ },
1014
+ required: ["properties"]
1015
+ },
1016
+ enabled: (_ctx, params) => controller.canSetInstanceProperties(_optionalChain([params, 'optionalAccess', _69 => _69.ids])),
1017
+ run: (_ctx, params) => outcome(controller.setInstanceProperties(params.properties, _optionalChain([params, 'optionalAccess', _70 => _70.ids])))
1018
+ },
1019
+ {
1020
+ ...base,
1021
+ id: `${prefix}restoreMainComponent`,
1022
+ label: "Restore Main Component",
1023
+ keywords: ["missing main", "recover component"],
1024
+ description: "Turns an instance whose main was deleted back into the main component.",
1025
+ params: idParams,
1026
+ enabled: (_ctx, params) => controller.canRestoreMainComponent(_optionalChain([params, 'optionalAccess', _71 => _71.id])),
1027
+ run: (_ctx, params) => outcome(controller.restoreMainComponent(_optionalChain([params, 'optionalAccess', _72 => _72.id])))
1028
+ },
1029
+ {
1030
+ ...base,
1031
+ id: `${prefix}listComponents`,
1032
+ label: "List Components",
1033
+ keywords: ["components", "variants", "assets"],
1034
+ description: "Lists the components and component sets (with their variant options).",
1035
+ readOnly: true,
1036
+ run: () => controller.list()
1037
+ },
1038
+ {
1039
+ ...base,
1040
+ id: `${prefix}inspectInstance`,
1041
+ label: "Inspect Instance",
1042
+ keywords: ["instance", "overrides", "properties"],
1043
+ description: "Describes an instance: its main, variant, property values and overrides.",
1044
+ params: idParams,
1045
+ readOnly: true,
1046
+ enabled: (_ctx, params) => controller.inspect(_optionalChain([params, 'optionalAccess', _73 => _73.id])) ? true : "Select an instance.",
1047
+ run: (_ctx, params) => _nullishCoalesce(controller.inspect(_optionalChain([params, 'optionalAccess', _74 => _74.id])), () => ( null))
1048
+ }
1049
+ ];
1050
+ }
875
1051
  function createSpreadsheetCommands(controller, options = {}) {
876
1052
  const prefix = _nullishCoalesce(options.prefix, () => ( "spreadsheet."));
877
1053
  const scope = options.scope === null ? void 0 : _nullishCoalesce(options.scope, () => ( "spreadsheet"));
@@ -894,6 +1070,178 @@ function createSpreadsheetCommands(controller, options = {}) {
894
1070
  ];
895
1071
  }
896
1072
 
1073
+ // src/commands/animation.ts
1074
+ var EASING_DESCRIPTION = "Easing preset (linear, ease, ease-in, ease-out, ease-in-out, ease-in-back, ease-out-back, spring, hold) or a CSS cubic-bezier(x1, y1, x2, y2).";
1075
+ var VALUES = {
1076
+ type: "object",
1077
+ description: 'Property \u2192 value, e.g. {"x": 200, "opacity": 0.5, "fill": "#ff0000"}. Properties: x, y, width, height, rotation (degrees), scale, opacity (0\u20131), fill, stroke, strokeWidth, cornerRadius, motionPath (0\u20131).',
1078
+ additionalProperties: { type: ["number", "string"] }
1079
+ };
1080
+ function createCanvasAnimationCommands(controller, options = {}) {
1081
+ const prefix = _nullishCoalesce(options.prefix, () => ( "canvas.animation."));
1082
+ const group = _nullishCoalesce(options.group, () => ( "Animation"));
1083
+ const scope = options.scope === null ? void 0 : _nullishCoalesce(options.scope, () => ( "canvas"));
1084
+ const base = { group, ...scope ? { scope } : {} };
1085
+ const hasSelection = () => controller.getState().selection.length > 0 ? true : "Select keyframes first.";
1086
+ return [
1087
+ {
1088
+ ...base,
1089
+ id: `${prefix}togglePlay`,
1090
+ label: "Play / Pause Animation",
1091
+ keywords: ["play", "pause", "preview", "timeline"],
1092
+ description: "Plays or pauses the canvas animation from the playhead.",
1093
+ run: () => {
1094
+ controller.toggle();
1095
+ return { playing: controller.getState().playing, time: controller.getState().time };
1096
+ }
1097
+ },
1098
+ {
1099
+ ...base,
1100
+ id: `${prefix}play`,
1101
+ label: "Play Animation",
1102
+ keywords: ["preview", "timeline"],
1103
+ enabled: () => controller.getState().playing ? "Already playing." : true,
1104
+ run: () => controller.play()
1105
+ },
1106
+ {
1107
+ ...base,
1108
+ id: `${prefix}pause`,
1109
+ label: "Pause Animation",
1110
+ enabled: () => controller.getState().playing ? true : "Not playing.",
1111
+ run: () => controller.pause()
1112
+ },
1113
+ {
1114
+ ...base,
1115
+ id: `${prefix}stop`,
1116
+ label: "Stop Animation",
1117
+ keywords: ["rewind", "reset"],
1118
+ description: "Stops playback and returns to the start.",
1119
+ run: () => controller.stop()
1120
+ },
1121
+ {
1122
+ ...base,
1123
+ id: `${prefix}seek`,
1124
+ label: "Go to Time\u2026",
1125
+ keywords: ["playhead", "scrub", "time"],
1126
+ description: "Moves the playhead.",
1127
+ params: {
1128
+ type: "object",
1129
+ properties: { time: { type: "number", minimum: 0, description: "Time in milliseconds." } },
1130
+ required: ["time"]
1131
+ },
1132
+ run: (_ctx, params) => {
1133
+ controller.seek(params.time);
1134
+ return { time: controller.getState().time };
1135
+ }
1136
+ },
1137
+ {
1138
+ ...base,
1139
+ id: `${prefix}addKeyframe`,
1140
+ label: "Add Keyframe at Playhead",
1141
+ keywords: ["key", "animate", "record"],
1142
+ description: "Keys the selected nodes (or `ids`) at the playhead (or `time`): their animated properties, `properties`, or position.",
1143
+ params: {
1144
+ type: "object",
1145
+ properties: {
1146
+ ids: { type: "array", items: { type: "string" }, description: "Node ids (default: selected nodes)." },
1147
+ properties: { type: "array", items: { type: "string" }, description: "Properties to key (default: animated ones, or x and y)." },
1148
+ time: { type: "number", minimum: 0, description: "Time in ms (default: the playhead)." }
1149
+ }
1150
+ },
1151
+ run: (_ctx, params) => controller.addKeyframe(_optionalChain([params, 'optionalAccess', _75 => _75.ids]), _optionalChain([params, 'optionalAccess', _76 => _76.properties]), _optionalChain([params, 'optionalAccess', _77 => _77.time]))
1152
+ },
1153
+ {
1154
+ ...base,
1155
+ id: `${prefix}deleteKeyframes`,
1156
+ label: "Delete Keyframes",
1157
+ keywords: ["remove", "clear"],
1158
+ enabled: hasSelection,
1159
+ run: () => controller.deleteKeyframes()
1160
+ },
1161
+ {
1162
+ ...base,
1163
+ id: `${prefix}setEasing`,
1164
+ label: "Set Keyframe Easing\u2026",
1165
+ keywords: ["interpolation", "ease", "bezier", "spring", "hold", "curve"],
1166
+ description: "Sets the easing of the segments leaving the selected keyframes.",
1167
+ params: {
1168
+ type: "object",
1169
+ properties: { easing: { type: "string", description: EASING_DESCRIPTION } },
1170
+ required: ["easing"]
1171
+ },
1172
+ enabled: hasSelection,
1173
+ run: (_ctx, params) => controller.setEasing(params.easing)
1174
+ },
1175
+ {
1176
+ ...base,
1177
+ id: `${prefix}toggleRecord`,
1178
+ label: "Toggle Record Mode",
1179
+ keywords: ["auto key", "record", "keyframe"],
1180
+ description: "In record mode, changing a property at the playhead keys it.",
1181
+ run: () => {
1182
+ controller.toggleRecording();
1183
+ return { recording: controller.getState().recording };
1184
+ }
1185
+ },
1186
+ {
1187
+ ...base,
1188
+ id: `${prefix}nextKeyframe`,
1189
+ label: "Next Keyframe",
1190
+ keywords: ["jump", "navigate"],
1191
+ run: () => controller.nextKeyframe()
1192
+ },
1193
+ {
1194
+ ...base,
1195
+ id: `${prefix}previousKeyframe`,
1196
+ label: "Previous Keyframe",
1197
+ keywords: ["jump", "navigate"],
1198
+ run: () => controller.previousKeyframe()
1199
+ },
1200
+ {
1201
+ ...base,
1202
+ id: `${prefix}animateNode`,
1203
+ label: "Animate Node\u2026",
1204
+ keywords: ["tween", "transition", "move", "fade"],
1205
+ description: "Animates a node from `from` (default: its current values) to `to` over `duration` ms, starting at `delay` ms.",
1206
+ params: {
1207
+ type: "object",
1208
+ properties: {
1209
+ nodeId: { type: "string", description: "Node to animate." },
1210
+ to: VALUES,
1211
+ from: VALUES,
1212
+ duration: { type: "number", exclusiveMinimum: 0, description: "Duration in ms (default 1000)." },
1213
+ delay: { type: "number", minimum: 0, description: "Start time in ms (default 0)." },
1214
+ easing: { type: "string", description: EASING_DESCRIPTION }
1215
+ },
1216
+ required: ["nodeId", "to"]
1217
+ },
1218
+ run: (_ctx, params) => controller.animateNode(params.nodeId, {
1219
+ to: params.to,
1220
+ ...params.from ? { from: params.from } : {},
1221
+ ...params.duration !== void 0 ? { duration: params.duration } : {},
1222
+ ...params.delay !== void 0 ? { delay: params.delay } : {},
1223
+ ...params.easing !== void 0 ? { easing: params.easing } : {}
1224
+ })
1225
+ },
1226
+ {
1227
+ ...base,
1228
+ id: `${prefix}exportCss`,
1229
+ label: "Export Animation as CSS",
1230
+ keywords: ["keyframes", "css", "web animations"],
1231
+ description: "Returns CSS @keyframes for a node's animation.",
1232
+ readOnly: true,
1233
+ params: {
1234
+ type: "object",
1235
+ properties: { nodeId: { type: "string" } },
1236
+ required: ["nodeId"]
1237
+ },
1238
+ run: (_ctx, params) => controller.exportCss(params.nodeId)
1239
+ }
1240
+ ];
1241
+ }
1242
+
1243
+
1244
+
897
1245
 
898
1246
 
899
1247
 
@@ -929,5 +1277,5 @@ function createSpreadsheetCommands(controller, options = {}) {
929
1277
 
930
1278
 
931
1279
 
932
- exports.CommandRegistry = CommandRegistry; exports.CommandRegistryError = CommandRegistryError; exports.DEFAULT_HISTORY_SHORTCUTS = DEFAULT_HISTORY_SHORTCUTS; exports.DEFAULT_RECENT_LIMIT = DEFAULT_RECENT_LIMIT; exports.PLATFORMS = _chunk26BVFKHUcjs.PLATFORMS; exports.ShortcutMap = _chunk26BVFKHUcjs.ShortcutMap; exports.chordToString = _chunk26BVFKHUcjs.chordToString; exports.codeFromKey = _chunk26BVFKHUcjs.codeFromKey; exports.codeToKeyText = _chunk26BVFKHUcjs.codeToKeyText; exports.createArrangeCommands = createArrangeCommands; exports.createCommandPaletteController = createCommandPaletteController; exports.createCommandRegistry = createCommandRegistry; exports.createCommandToolProvider = createCommandToolProvider; exports.createHistoryCommands = createHistoryCommands; exports.createShapeCommands = createShapeCommands; exports.createSpreadsheetCommands = createSpreadsheetCommands; exports.defineCommand = defineCommand; exports.detectPlatform = _chunk26BVFKHUcjs.detectPlatform; exports.effectiveChord = _chunk26BVFKHUcjs.effectiveChord; exports.effectiveChordKey = _chunk26BVFKHUcjs.effectiveChordKey; exports.eventCode = _chunk26BVFKHUcjs.eventCode; exports.exactBonus = exactBonus; exports.formatShortcut = _chunk26BVFKHUcjs.formatShortcut; exports.fuzzyMatch = fuzzyMatch; exports.fuzzyScore = fuzzyScore; exports.isEditableEventTarget = _chunk26BVFKHUcjs.isEditableEventTarget; exports.keyToCode = _chunk26BVFKHUcjs.keyToCode; exports.matchHistoryShortcut = matchHistoryShortcut; exports.matchPaletteHotkey = matchPaletteHotkey; exports.normalizeChord = _chunk26BVFKHUcjs.normalizeChord; exports.parseChord = _chunk26BVFKHUcjs.parseChord; exports.pushRecent = pushRecent; exports.rankCommands = rankCommands; exports.shortcutCode = _chunk26BVFKHUcjs.shortcutCode; exports.toShortcutBindings = _chunk26BVFKHUcjs.toShortcutBindings;
1280
+ exports.CommandRegistry = CommandRegistry; exports.CommandRegistryError = CommandRegistryError; exports.DEFAULT_HISTORY_SHORTCUTS = DEFAULT_HISTORY_SHORTCUTS; exports.DEFAULT_RECENT_LIMIT = DEFAULT_RECENT_LIMIT; exports.PLATFORMS = _chunk26BVFKHUcjs.PLATFORMS; exports.ShortcutMap = _chunk26BVFKHUcjs.ShortcutMap; exports.chordToString = _chunk26BVFKHUcjs.chordToString; exports.codeFromKey = _chunk26BVFKHUcjs.codeFromKey; exports.codeToKeyText = _chunk26BVFKHUcjs.codeToKeyText; exports.createArrangeCommands = createArrangeCommands; exports.createCanvasAnimationCommands = createCanvasAnimationCommands; exports.createCommandPaletteController = createCommandPaletteController; exports.createCommandRegistry = createCommandRegistry; exports.createCommandToolProvider = createCommandToolProvider; exports.createComponentCommands = createComponentCommands; exports.createHistoryCommands = createHistoryCommands; exports.createShapeCommands = createShapeCommands; exports.createSpreadsheetCommands = createSpreadsheetCommands; exports.defineCommand = defineCommand; exports.detectPlatform = _chunk26BVFKHUcjs.detectPlatform; exports.effectiveChord = _chunk26BVFKHUcjs.effectiveChord; exports.effectiveChordKey = _chunk26BVFKHUcjs.effectiveChordKey; exports.eventCode = _chunk26BVFKHUcjs.eventCode; exports.exactBonus = exactBonus; exports.formatShortcut = _chunk26BVFKHUcjs.formatShortcut; exports.fuzzyMatch = fuzzyMatch; exports.fuzzyScore = fuzzyScore; exports.isEditableEventTarget = _chunk26BVFKHUcjs.isEditableEventTarget; exports.keyToCode = _chunk26BVFKHUcjs.keyToCode; exports.matchHistoryShortcut = matchHistoryShortcut; exports.matchPaletteHotkey = matchPaletteHotkey; exports.normalizeChord = _chunk26BVFKHUcjs.normalizeChord; exports.parseChord = _chunk26BVFKHUcjs.parseChord; exports.pushRecent = pushRecent; exports.rankCommands = rankCommands; exports.shortcutCode = _chunk26BVFKHUcjs.shortcutCode; exports.toShortcutBindings = _chunk26BVFKHUcjs.toShortcutBindings;
933
1281
  //# sourceMappingURL=index.cjs.map