@pixerate/editor 0.26.1 → 0.28.0

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 (90) hide show
  1. package/README.md +32 -3
  2. package/dist/agent/index.cjs +56 -6
  3. package/dist/agent/index.cjs.map +1 -1
  4. package/dist/agent/index.d.cts +6 -4
  5. package/dist/agent/index.d.ts +6 -4
  6. package/dist/agent/index.js +51 -1
  7. package/dist/agent/index.js.map +1 -1
  8. package/dist/animation/index.cjs +62 -0
  9. package/dist/animation/index.cjs.map +1 -0
  10. package/dist/animation/index.d.cts +296 -0
  11. package/dist/animation/index.d.ts +296 -0
  12. package/dist/animation/index.js +62 -0
  13. package/dist/animation/index.js.map +1 -0
  14. package/dist/{builtins-Chj6zv_O.d.ts → builtins-haN82vjT.d.ts} +33 -3
  15. package/dist/{builtins-CdPcLwwF.d.cts → builtins-nMXh9sT3.d.cts} +33 -3
  16. package/dist/canvas/index.cjs +535 -737
  17. package/dist/canvas/index.cjs.map +1 -1
  18. package/dist/canvas/index.d.cts +74 -291
  19. package/dist/canvas/index.d.ts +74 -291
  20. package/dist/canvas/index.js +417 -619
  21. package/dist/canvas/index.js.map +1 -1
  22. package/dist/{chunk-X7HXL2SB.js → chunk-3RPOW4CS.js} +342 -16
  23. package/dist/chunk-3RPOW4CS.js.map +1 -0
  24. package/dist/{chunk-UBCFIABU.js → chunk-5H2OPMXZ.js} +183 -6
  25. package/dist/chunk-5H2OPMXZ.js.map +1 -0
  26. package/dist/chunk-A6PHCAGX.cjs +87 -0
  27. package/dist/chunk-A6PHCAGX.cjs.map +1 -0
  28. package/dist/{chunk-HRMEDT2L.js → chunk-D6AVOTSD.js} +6 -85
  29. package/dist/chunk-D6AVOTSD.js.map +1 -0
  30. package/dist/chunk-HXDMZQTD.cjs +497 -0
  31. package/dist/chunk-HXDMZQTD.cjs.map +1 -0
  32. package/dist/chunk-IB3ZHQAX.js +497 -0
  33. package/dist/chunk-IB3ZHQAX.js.map +1 -0
  34. package/dist/{chunk-4BVP64JJ.cjs → chunk-K2UYKJ6M.cjs} +24 -103
  35. package/dist/chunk-K2UYKJ6M.cjs.map +1 -0
  36. package/dist/{chunk-HDYMLS3X.cjs → chunk-MC2LQN5S.cjs} +196 -19
  37. package/dist/chunk-MC2LQN5S.cjs.map +1 -0
  38. package/dist/{chunk-XQFHLT53.js → chunk-MXZJ4PKN.js} +24 -10
  39. package/dist/chunk-MXZJ4PKN.js.map +1 -0
  40. package/dist/{chunk-LN2POBHT.cjs → chunk-OYEFRO3D.cjs} +28 -14
  41. package/dist/chunk-OYEFRO3D.cjs.map +1 -0
  42. package/dist/chunk-PWJARCI4.js +637 -0
  43. package/dist/chunk-PWJARCI4.js.map +1 -0
  44. package/dist/chunk-TGD52FEZ.js +87 -0
  45. package/dist/chunk-TGD52FEZ.js.map +1 -0
  46. package/dist/chunk-TTYCN6ZH.cjs +637 -0
  47. package/dist/chunk-TTYCN6ZH.cjs.map +1 -0
  48. package/dist/{chunk-NQF32I6Z.cjs → chunk-U7VGDSNY.cjs} +463 -137
  49. package/dist/chunk-U7VGDSNY.cjs.map +1 -0
  50. package/dist/commands/index.cjs +30 -410
  51. package/dist/commands/index.cjs.map +1 -1
  52. package/dist/commands/index.d.cts +1 -1
  53. package/dist/commands/index.d.ts +1 -1
  54. package/dist/commands/index.js +17 -397
  55. package/dist/commands/index.js.map +1 -1
  56. package/dist/{controller-CxXGOEmy.d.ts → controller-w6eRTjF8.d.cts} +67 -2
  57. package/dist/{controller-CxXGOEmy.d.cts → controller-w6eRTjF8.d.ts} +67 -2
  58. package/dist/extensions/index.cjs +25 -7
  59. package/dist/extensions/index.cjs.map +1 -1
  60. package/dist/extensions/index.d.cts +1 -1
  61. package/dist/extensions/index.d.ts +1 -1
  62. package/dist/extensions/index.js +32 -14
  63. package/dist/generation/index.cjs +3 -3
  64. package/dist/generation/index.cjs.map +1 -1
  65. package/dist/generation/index.js +3 -3
  66. package/dist/{index-jcJwmBYt.d.cts → index-C6gaQRH0.d.cts} +53 -4
  67. package/dist/{index-B273Zllk.d.ts → index-DXAv_R08.d.ts} +53 -4
  68. package/dist/index.cjs +57 -19
  69. package/dist/index.cjs.map +1 -1
  70. package/dist/index.d.cts +7 -5
  71. package/dist/index.d.ts +7 -5
  72. package/dist/index.js +132 -94
  73. package/dist/index.js.map +1 -1
  74. package/dist/spreadsheet/index.cjs +23 -3
  75. package/dist/spreadsheet/index.cjs.map +1 -1
  76. package/dist/spreadsheet/index.d.cts +76 -3
  77. package/dist/spreadsheet/index.d.ts +76 -3
  78. package/dist/spreadsheet/index.js +28 -8
  79. package/dist/tokens/index.cjs +4 -2
  80. package/dist/tokens/index.cjs.map +1 -1
  81. package/dist/tokens/index.js +6 -4
  82. package/package.json +6 -1
  83. package/dist/chunk-4BVP64JJ.cjs.map +0 -1
  84. package/dist/chunk-HDYMLS3X.cjs.map +0 -1
  85. package/dist/chunk-HRMEDT2L.js.map +0 -1
  86. package/dist/chunk-LN2POBHT.cjs.map +0 -1
  87. package/dist/chunk-NQF32I6Z.cjs.map +0 -1
  88. package/dist/chunk-UBCFIABU.js.map +0 -1
  89. package/dist/chunk-X7HXL2SB.js.map +0 -1
  90. package/dist/chunk-XQFHLT53.js.map +0 -1
@@ -131,7 +131,34 @@ interface ComponentCommandTarget {
131
131
  canGoToMainComponent(id?: string): true | string;
132
132
  list(): unknown;
133
133
  inspect(id?: string): unknown;
134
+ addVariant?(setId?: string, options?: {
135
+ from?: string;
136
+ variant?: Record<string, string>;
137
+ position?: {
138
+ x: number;
139
+ y: number;
140
+ };
141
+ defaultValue?: string;
142
+ }): ComponentActionResult;
143
+ canAddVariant?(setId?: string, options?: {
144
+ from?: string;
145
+ variant?: Record<string, string>;
146
+ }): true | string;
147
+ removeVariant?(variantId?: string): ComponentActionResult;
148
+ canRemoveVariant?(variantId?: string): true | string;
149
+ setVariantProperties?(values: Record<string, string>, variantId?: string, options?: {
150
+ defaultValue?: string;
151
+ }): ComponentActionResult;
152
+ canSetVariantProperties?(values?: Record<string, string>, variantId?: string): true | string;
153
+ renameVariantProperty?(name: string, newName: string, setId?: string): ComponentActionResult;
154
+ canRenameVariantProperty?(name?: string, newName?: string, setId?: string): true | string;
155
+ renameVariantValue?(property: string, value: string, newValue: string, setId?: string): ComponentActionResult;
156
+ canRenameVariantValue?(property?: string, value?: string, newValue?: string, setId?: string): true | string;
134
157
  }
158
+ /** The variant-editing part of a `ComponentCommandTarget` (present on the components controller). */
159
+ type VariantCommandTarget = Required<Pick<ComponentCommandTarget, 'addVariant' | 'canAddVariant' | 'removeVariant' | 'canRemoveVariant' | 'setVariantProperties' | 'canSetVariantProperties' | 'renameVariantProperty' | 'canRenameVariantProperty' | 'renameVariantValue' | 'canRenameVariantValue'>>;
160
+ /** Whether a command target can edit variants. */
161
+ declare function hasVariantCommands(controller: ComponentCommandTarget): controller is ComponentCommandTarget & VariantCommandTarget;
135
162
  interface ComponentCommandOptions {
136
163
  /** Id prefix (default `canvas.`). */
137
164
  prefix?: string;
@@ -145,8 +172,11 @@ interface ComponentCommandOptions {
145
172
  * (`{ componentId, parentId?, x?, y?, properties? }`), `canvas.detachInstance`,
146
173
  * `canvas.resetOverrides` (`{ id?, group? }`), `canvas.pushOverrides`, `canvas.goToMainComponent`,
147
174
  * `canvas.swapInstance` (`{ componentId, ids? }`), `canvas.setInstanceProperties`
148
- * (`{ properties, ids? }`: variant and component property values), `canvas.restoreMainComponent`
149
- * and the read-only `canvas.listComponents` / `canvas.inspectInstance`. Each action is one
175
+ * (`{ properties, ids? }`: variant and component property values), `canvas.restoreMainComponent`,
176
+ * the variant editors `canvas.addVariant` (`{ setId?, from?, variant?, x?, y? }`),
177
+ * `canvas.removeVariant` (`{ id? }`), `canvas.setVariantProperties` (`{ values, id? }`),
178
+ * `canvas.renameVariantProperty` (`{ name, newName, setId? }`) and `canvas.renameVariantValue`
179
+ * (`{ property, value, newValue, setId? }`) when the target has them, and the read-only `canvas.listComponents` / `canvas.inspectInstance`. Each action is one
150
180
  * undoable step when the controller has a history; enablement explains why it cannot run.
151
181
  */
152
182
  declare function createComponentCommands(controller: ComponentCommandTarget, options?: ComponentCommandOptions): CommandSpec[];
@@ -173,4 +203,4 @@ interface SpreadsheetCommandOptions {
173
203
  /** Palette / agent commands for common spreadsheet table actions (no default shortcuts). */
174
204
  declare function createSpreadsheetCommands(controller: SpreadsheetCommandTarget, options?: SpreadsheetCommandOptions): CommandSpec[];
175
205
 
176
- export { type ArrangeCommandOptions as A, type ComponentCommandOptions as C, DEFAULT_HISTORY_SHORTCUTS as D, type HistoryCommandOptions as H, type ShapeCommandOptions as S, type ArrangeCommandTarget as a, type ComponentCommandTarget as b, type HistoryCommandTarget as c, type ShapeCommandTarget as d, type SpreadsheetCommandOptions as e, type SpreadsheetCommandTarget as f, createArrangeCommands as g, createComponentCommands as h, createHistoryCommands as i, createShapeCommands as j, createSpreadsheetCommands as k, matchHistoryShortcut as m };
206
+ export { type ArrangeCommandOptions as A, type ComponentCommandOptions as C, DEFAULT_HISTORY_SHORTCUTS as D, type HistoryCommandOptions as H, type ShapeCommandOptions as S, type ArrangeCommandTarget as a, type ComponentCommandTarget as b, type HistoryCommandTarget as c, type ShapeCommandTarget as d, type SpreadsheetCommandOptions as e, type SpreadsheetCommandTarget as f, createArrangeCommands as g, createComponentCommands as h, createHistoryCommands as i, createShapeCommands as j, createSpreadsheetCommands as k, hasVariantCommands as l, matchHistoryShortcut as m };
@@ -131,7 +131,34 @@ interface ComponentCommandTarget {
131
131
  canGoToMainComponent(id?: string): true | string;
132
132
  list(): unknown;
133
133
  inspect(id?: string): unknown;
134
+ addVariant?(setId?: string, options?: {
135
+ from?: string;
136
+ variant?: Record<string, string>;
137
+ position?: {
138
+ x: number;
139
+ y: number;
140
+ };
141
+ defaultValue?: string;
142
+ }): ComponentActionResult;
143
+ canAddVariant?(setId?: string, options?: {
144
+ from?: string;
145
+ variant?: Record<string, string>;
146
+ }): true | string;
147
+ removeVariant?(variantId?: string): ComponentActionResult;
148
+ canRemoveVariant?(variantId?: string): true | string;
149
+ setVariantProperties?(values: Record<string, string>, variantId?: string, options?: {
150
+ defaultValue?: string;
151
+ }): ComponentActionResult;
152
+ canSetVariantProperties?(values?: Record<string, string>, variantId?: string): true | string;
153
+ renameVariantProperty?(name: string, newName: string, setId?: string): ComponentActionResult;
154
+ canRenameVariantProperty?(name?: string, newName?: string, setId?: string): true | string;
155
+ renameVariantValue?(property: string, value: string, newValue: string, setId?: string): ComponentActionResult;
156
+ canRenameVariantValue?(property?: string, value?: string, newValue?: string, setId?: string): true | string;
134
157
  }
158
+ /** The variant-editing part of a `ComponentCommandTarget` (present on the components controller). */
159
+ type VariantCommandTarget = Required<Pick<ComponentCommandTarget, 'addVariant' | 'canAddVariant' | 'removeVariant' | 'canRemoveVariant' | 'setVariantProperties' | 'canSetVariantProperties' | 'renameVariantProperty' | 'canRenameVariantProperty' | 'renameVariantValue' | 'canRenameVariantValue'>>;
160
+ /** Whether a command target can edit variants. */
161
+ declare function hasVariantCommands(controller: ComponentCommandTarget): controller is ComponentCommandTarget & VariantCommandTarget;
135
162
  interface ComponentCommandOptions {
136
163
  /** Id prefix (default `canvas.`). */
137
164
  prefix?: string;
@@ -145,8 +172,11 @@ interface ComponentCommandOptions {
145
172
  * (`{ componentId, parentId?, x?, y?, properties? }`), `canvas.detachInstance`,
146
173
  * `canvas.resetOverrides` (`{ id?, group? }`), `canvas.pushOverrides`, `canvas.goToMainComponent`,
147
174
  * `canvas.swapInstance` (`{ componentId, ids? }`), `canvas.setInstanceProperties`
148
- * (`{ properties, ids? }`: variant and component property values), `canvas.restoreMainComponent`
149
- * and the read-only `canvas.listComponents` / `canvas.inspectInstance`. Each action is one
175
+ * (`{ properties, ids? }`: variant and component property values), `canvas.restoreMainComponent`,
176
+ * the variant editors `canvas.addVariant` (`{ setId?, from?, variant?, x?, y? }`),
177
+ * `canvas.removeVariant` (`{ id? }`), `canvas.setVariantProperties` (`{ values, id? }`),
178
+ * `canvas.renameVariantProperty` (`{ name, newName, setId? }`) and `canvas.renameVariantValue`
179
+ * (`{ property, value, newValue, setId? }`) when the target has them, and the read-only `canvas.listComponents` / `canvas.inspectInstance`. Each action is one
150
180
  * undoable step when the controller has a history; enablement explains why it cannot run.
151
181
  */
152
182
  declare function createComponentCommands(controller: ComponentCommandTarget, options?: ComponentCommandOptions): CommandSpec[];
@@ -173,4 +203,4 @@ interface SpreadsheetCommandOptions {
173
203
  /** Palette / agent commands for common spreadsheet table actions (no default shortcuts). */
174
204
  declare function createSpreadsheetCommands(controller: SpreadsheetCommandTarget, options?: SpreadsheetCommandOptions): CommandSpec[];
175
205
 
176
- export { type ArrangeCommandOptions as A, type ComponentCommandOptions as C, DEFAULT_HISTORY_SHORTCUTS as D, type HistoryCommandOptions as H, type ShapeCommandOptions as S, type ArrangeCommandTarget as a, type ComponentCommandTarget as b, type HistoryCommandTarget as c, type ShapeCommandTarget as d, type SpreadsheetCommandOptions as e, type SpreadsheetCommandTarget as f, createArrangeCommands as g, createComponentCommands as h, createHistoryCommands as i, createShapeCommands as j, createSpreadsheetCommands as k, matchHistoryShortcut as m };
206
+ export { type ArrangeCommandOptions as A, type ComponentCommandOptions as C, DEFAULT_HISTORY_SHORTCUTS as D, type HistoryCommandOptions as H, type ShapeCommandOptions as S, type ArrangeCommandTarget as a, type ComponentCommandTarget as b, type HistoryCommandTarget as c, type ShapeCommandTarget as d, type SpreadsheetCommandOptions as e, type SpreadsheetCommandTarget as f, createArrangeCommands as g, createComponentCommands as h, createHistoryCommands as i, createShapeCommands as j, createSpreadsheetCommands as k, hasVariantCommands as l, matchHistoryShortcut as m };