mechanica 2.0.0-alpha.2 → 2.0.0-alpha.4

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 (208) hide show
  1. package/dist/chunks/{ImagePickerDialog-DZyxrbfv.js → ImagePickerDialog-BfjNtRoR.js} +411 -7
  2. package/dist/chunks/create-mechanica-CnBFiyfJ.js +721 -0
  3. package/dist/chunks/editor-BYMvxQTM.js +3080 -0
  4. package/dist/chunks/page-assets-BjIm0jws.js +953 -0
  5. package/dist/chunks/preview-G5_AFI5P.js +173 -0
  6. package/dist/cli.js +0 -0
  7. package/dist/composer.js +4968 -0
  8. package/dist/editor.css +3994 -1508
  9. package/dist/editor.js +519 -2737
  10. package/dist/index.js +149 -9
  11. package/dist/plugin.js +928 -58
  12. package/dist/types/cli/build.d.ts +4 -4
  13. package/dist/types/cli/export.d.ts +23 -5
  14. package/dist/types/cli/images.d.ts +15 -0
  15. package/dist/types/core/composed.d.ts +15 -0
  16. package/dist/types/core/composer-components.d.ts +26 -0
  17. package/dist/types/core/create-mechanica.d.ts +8 -1
  18. package/dist/types/core/data-registry.d.ts +2 -0
  19. package/dist/types/core/define-data.d.ts +6 -0
  20. package/dist/types/core/define-mechanica-app.d.ts +2 -1
  21. package/dist/types/core/field-types.d.ts +17 -0
  22. package/dist/types/core/image.d.ts +71 -0
  23. package/dist/types/core/index.d.ts +6 -0
  24. package/dist/types/core/link.d.ts +33 -4
  25. package/dist/types/core/load-blocks.d.ts +10 -4
  26. package/dist/types/core/render-blocks.d.ts +7 -0
  27. package/dist/types/core/state.d.ts +3 -1
  28. package/dist/types/core/use-locale.d.ts +25 -0
  29. package/dist/types/editor/composer/composer.d.ts +36 -0
  30. package/dist/types/editor/composer/lib/abs.d.ts +58 -0
  31. package/dist/types/editor/composer/lib/canvas-drop-target.d.ts +26 -0
  32. package/dist/types/editor/composer/lib/canvas-drop.d.ts +37 -0
  33. package/dist/types/editor/composer/lib/canvas-overlay.d.ts +77 -0
  34. package/dist/types/editor/composer/lib/canvas-view.d.ts +34 -0
  35. package/dist/types/editor/composer/lib/canvas.d.ts +24 -0
  36. package/dist/types/editor/composer/lib/class-css.d.ts +43 -0
  37. package/dist/types/editor/composer/lib/class-groups.d.ts +35 -0
  38. package/dist/types/editor/composer/lib/clipboard.d.ts +13 -0
  39. package/dist/types/editor/composer/lib/composer-history.d.ts +17 -0
  40. package/dist/types/editor/composer/lib/composer-store.d.ts +123 -0
  41. package/dist/types/editor/composer/lib/design-tokens.d.ts +13 -0
  42. package/dist/types/editor/composer/lib/elements-meta.d.ts +39 -0
  43. package/dist/types/editor/composer/lib/inspector-props.d.ts +38 -0
  44. package/dist/types/editor/composer/lib/keys.d.ts +13 -0
  45. package/dist/types/editor/composer/lib/marquee.d.ts +10 -0
  46. package/dist/types/editor/composer/lib/normalize-template.d.ts +29 -0
  47. package/dist/types/editor/composer/lib/padding.d.ts +32 -0
  48. package/dist/types/editor/composer/lib/scrub.d.ts +6 -0
  49. package/dist/types/editor/composer/lib/use-insert-dnd.d.ts +33 -0
  50. package/dist/types/editor/composer/lib/use-layer-dnd.d.ts +22 -0
  51. package/dist/types/editor/lib/block-meta.d.ts +8 -1
  52. package/dist/types/editor/lib/image-crop.d.ts +70 -0
  53. package/dist/types/editor/lib/image-size.d.ts +55 -0
  54. package/dist/types/editor/lib/keyboard.d.ts +19 -0
  55. package/dist/types/editor/lib/page-list.d.ts +7 -0
  56. package/dist/types/editor/lib/shortcuts.d.ts +4 -1
  57. package/dist/types/editor/lib/store.d.ts +16 -0
  58. package/dist/types/editor/widget-api.d.ts +4 -1
  59. package/dist/types/elements/emit-css.d.ts +31 -0
  60. package/dist/types/elements/index.d.ts +9 -0
  61. package/dist/types/elements/style-vars.d.ts +48 -0
  62. package/dist/types/vite/collect-components.d.ts +19 -0
  63. package/dist/types/vite/collect-composed.d.ts +15 -0
  64. package/dist/types/vite/dev/assets-store.d.ts +50 -2
  65. package/dist/types/vite/dev/composed-store.d.ts +41 -0
  66. package/dist/types/vite/dev/composer.d.ts +15 -0
  67. package/dist/types/vite/dev/data-store.d.ts +20 -4
  68. package/dist/types/vite/dev/image-preview.d.ts +46 -0
  69. package/dist/types/vite/dev/middleware.d.ts +3 -0
  70. package/dist/types/vite/dev/page-state.d.ts +9 -2
  71. package/dist/types/vite/dev/pages-store.d.ts +81 -17
  72. package/dist/types/vite/entries.d.ts +29 -0
  73. package/dist/types/vite/plugin.d.ts +38 -0
  74. package/dist/types/vite/read-breakpoints.d.ts +17 -0
  75. package/dist/widgets.js +1 -1
  76. package/package.json +6 -2
  77. package/src/cli/build.ts +5 -6
  78. package/src/cli/cli.ts +12 -2
  79. package/src/cli/export.ts +0 -0
  80. package/src/cli/images.ts +67 -0
  81. package/src/cli/shot.ts +14 -6
  82. package/src/core/composed.ts +45 -0
  83. package/src/core/composer-components.ts +31 -0
  84. package/src/core/create-mechanica.ts +21 -2
  85. package/src/core/data-registry.ts +3 -0
  86. package/src/core/define-data.ts +6 -0
  87. package/src/core/define-mechanica-app.ts +3 -1
  88. package/src/core/field-types.ts +16 -1
  89. package/src/core/image.ts +107 -0
  90. package/src/core/index.ts +9 -0
  91. package/src/core/link.ts +23 -6
  92. package/src/core/load-blocks.ts +25 -4
  93. package/src/core/preview.ts +10 -1
  94. package/src/core/render-blocks.ts +35 -11
  95. package/src/core/state.ts +3 -1
  96. package/src/core/use-locale.ts +40 -0
  97. package/src/editor/EditorApp.vue +45 -3
  98. package/src/editor/components/BlockPalette.vue +90 -0
  99. package/src/editor/components/BlockSettings.vue +43 -1
  100. package/src/editor/components/DataSettings.vue +59 -1
  101. package/src/editor/components/IconField.vue +201 -0
  102. package/src/editor/components/LocaleSwitcher.vue +239 -0
  103. package/src/editor/components/VPopover.vue +8 -2
  104. package/src/editor/components/VSelect.vue +38 -16
  105. package/src/editor/composer/ComposerApp.vue +220 -0
  106. package/src/editor/composer/components/AlignGrid.vue +74 -0
  107. package/src/editor/composer/components/AnchorGrid.vue +36 -0
  108. package/src/editor/composer/components/BindField.vue +42 -0
  109. package/src/editor/composer/components/BoxSideInput.vue +141 -0
  110. package/src/editor/composer/components/CanvasOverlay.vue +488 -0
  111. package/src/editor/composer/components/ClassStylePreview.vue +82 -0
  112. package/src/editor/composer/components/ColorField.vue +36 -0
  113. package/src/editor/composer/components/ComponentFields.vue +39 -0
  114. package/src/editor/composer/components/ComposerCanvas.vue +376 -0
  115. package/src/editor/composer/components/ComposerInspector.vue +506 -0
  116. package/src/editor/composer/components/ComposerLayers.vue +28 -0
  117. package/src/editor/composer/components/ComposerSettings.vue +52 -0
  118. package/src/editor/composer/components/InsertToolbar.vue +96 -0
  119. package/src/editor/composer/components/LayerNode.vue +69 -0
  120. package/src/editor/composer/components/MultiSelectPanel.vue +57 -0
  121. package/src/editor/composer/components/NumInput.vue +121 -0
  122. package/src/editor/composer/components/OverrideLabel.vue +21 -0
  123. package/src/editor/composer/components/PropToggle.vue +42 -0
  124. package/src/editor/composer/components/PropsSection.vue +51 -0
  125. package/src/editor/composer/components/SegControl.vue +30 -0
  126. package/src/editor/composer/components/SizeInput.vue +62 -0
  127. package/src/editor/composer/composer.ts +220 -0
  128. package/src/editor/composer/lib/abs.ts +78 -0
  129. package/src/editor/composer/lib/canvas-drop-target.ts +103 -0
  130. package/src/editor/composer/lib/canvas-drop.ts +78 -0
  131. package/src/editor/composer/lib/canvas-overlay.ts +168 -0
  132. package/src/editor/composer/lib/canvas-view.ts +75 -0
  133. package/src/editor/composer/lib/canvas.ts +65 -0
  134. package/src/editor/composer/lib/class-css.ts +103 -0
  135. package/src/editor/composer/lib/class-groups.ts +86 -0
  136. package/src/editor/composer/lib/clipboard.ts +25 -0
  137. package/src/editor/composer/lib/composer-history.ts +81 -0
  138. package/src/editor/composer/lib/composer-store.ts +546 -0
  139. package/src/editor/composer/lib/design-tokens.ts +46 -0
  140. package/src/editor/composer/lib/elements-meta.ts +123 -0
  141. package/src/editor/composer/lib/inspector-props.ts +76 -0
  142. package/src/editor/composer/lib/keys.ts +14 -0
  143. package/src/editor/composer/lib/marquee.ts +26 -0
  144. package/src/editor/composer/lib/normalize-template.ts +51 -0
  145. package/src/editor/composer/lib/padding.ts +71 -0
  146. package/src/editor/composer/lib/scrub.ts +9 -0
  147. package/src/editor/composer/lib/use-insert-dnd.ts +131 -0
  148. package/src/editor/composer/lib/use-layer-dnd.ts +99 -0
  149. package/src/editor/composer/styles/composer.scss +1657 -0
  150. package/src/editor/dialogs/ImageCropDialog.vue +360 -0
  151. package/src/editor/dialogs/ImagePickerDialog.vue +34 -5
  152. package/src/editor/dialogs/PagesDialog.vue +67 -2
  153. package/src/editor/editor.ts +74 -6
  154. package/src/editor/fields/editors/ImageField.vue +61 -15
  155. package/src/editor/icons/align-center.svg +1 -0
  156. package/src/editor/icons/align-left.svg +1 -0
  157. package/src/editor/icons/align-right.svg +1 -0
  158. package/src/editor/icons/bolt.svg +1 -0
  159. package/src/editor/icons/button.svg +1 -0
  160. package/src/editor/icons/column.svg +1 -0
  161. package/src/editor/icons/component.svg +1 -0
  162. package/src/editor/icons/corner.svg +1 -0
  163. package/src/editor/icons/desktop.svg +1 -0
  164. package/src/editor/icons/fill.svg +1 -0
  165. package/src/editor/icons/frame.svg +1 -0
  166. package/src/editor/icons/gap.svg +1 -0
  167. package/src/editor/icons/globe.svg +1 -0
  168. package/src/editor/icons/height.svg +1 -0
  169. package/src/editor/icons/limits.svg +1 -0
  170. package/src/editor/icons/margin.svg +1 -0
  171. package/src/editor/icons/mobile.svg +1 -0
  172. package/src/editor/icons/position.svg +1 -0
  173. package/src/editor/icons/row.svg +1 -0
  174. package/src/editor/icons/sides.svg +1 -0
  175. package/src/editor/icons/tablet.svg +1 -0
  176. package/src/editor/icons/text.svg +1 -0
  177. package/src/editor/icons/width.svg +1 -0
  178. package/src/editor/icons/wrap.svg +1 -0
  179. package/src/editor/lib/block-meta.ts +27 -1
  180. package/src/editor/lib/block-preview.ts +9 -3
  181. package/src/editor/lib/image-crop.ts +174 -0
  182. package/src/editor/lib/image-size.ts +154 -0
  183. package/src/editor/lib/keyboard.ts +29 -0
  184. package/src/editor/lib/page-list.ts +7 -0
  185. package/src/editor/lib/shortcuts.ts +7 -2
  186. package/src/editor/lib/store.ts +36 -0
  187. package/src/editor/props-panel/SchemaForm.vue +108 -9
  188. package/src/editor/widget-api.ts +5 -2
  189. package/src/elements/elements.scss +69 -0
  190. package/src/elements/emit-css.ts +153 -0
  191. package/src/elements/index.ts +135 -0
  192. package/src/elements/style-vars.ts +230 -0
  193. package/src/virtual-modules.d.ts +5 -0
  194. package/src/vite/collect-components.ts +58 -0
  195. package/src/vite/collect-composed.ts +49 -0
  196. package/src/vite/dev/assets-store.ts +182 -10
  197. package/src/vite/dev/composed-store.ts +99 -0
  198. package/src/vite/dev/composer.ts +46 -0
  199. package/src/vite/dev/data-store.ts +94 -8
  200. package/src/vite/dev/image-preview.ts +102 -0
  201. package/src/vite/dev/middleware.ts +177 -11
  202. package/src/vite/dev/page-state.ts +77 -9
  203. package/src/vite/dev/pages-store.ts +278 -40
  204. package/src/vite/entries.ts +74 -6
  205. package/src/vite/plugin.ts +195 -13
  206. package/src/vite/read-breakpoints.ts +47 -0
  207. package/dist/chunks/page-assets-D0cofAGb.js +0 -534
  208. package/dist/chunks/preview-B17SIZrO.js +0 -431
@@ -1,38 +1,92 @@
1
1
  import { Fragment, createBlock, createCommentVNode, createElementBlock, createElementVNode, createTextVNode, createVNode, defineComponent, inject, mergeProps, normalizeClass, onMounted, openBlock, ref, renderList, renderSlot, shallowReactive, toDisplayString, unref, withCtx, withModifiers } from "vue";
2
2
  //#region \0svg-glob:C:\Users\Den\Desktop\CURVES\mechanica\packages\mechanica\src\editor\icons
3
3
  var contents = {
4
+ "align-center": `<path d="M4 6h16M7 12h10M6 18h12"/>`,
5
+ "align-left": `<path d="M4 6h16M4 12h10M4 18h13"/>`,
6
+ "align-right": `<path d="M4 6h16M10 12h10M7 18h13"/>`,
4
7
  "arrow-down": `<path d="M12 5v14"/><path d="m19 12-7 7-7-7"/>`,
5
8
  "arrow-up": `<path d="M12 19V5"/><path d="m5 12 7-7 7 7"/>`,
6
9
  "bold": `<path d="M6 4h7a4 4 0 0 1 0 8H6z"/><path d="M6 12h8a4 4 0 0 1 0 8H6z"/>`,
10
+ "bolt": `<path d="M13 2 4.5 13.5H11l-1 8.5 8.5-11.5H12z"/>`,
7
11
  "book": `<path d="M2 3h6a4 4 0 0 1 4 4v14a3 3 0 0 0-3-3H2z"/><path d="M22 3h-6a4 4 0 0 0-4 4v14a3 3 0 0 1 3-3h7z"/>`,
12
+ "button": `<rect x="3" y="8" width="18" height="8" rx="4"/><path d="M8 12h8"/>`,
8
13
  "check": `<polyline points="20 6 9 17 4 12"/>`,
9
14
  "chevron-down": `<path d="m6 9 6 6 6-6"/>`,
10
15
  "close": `<path d="M18 6 6 18"/><path d="m6 6 12 12"/>`,
11
16
  "code": `<polyline points="16 18 22 12 16 6"/><polyline points="8 6 2 12 8 18"/>`,
17
+ "column": `<rect x="5" y="4" width="14" height="6.5" rx="1.6"/><rect x="5" y="13.5" width="14" height="6.5" rx="1.6"/>`,
18
+ "component": `<path d="M21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16z"/>`,
12
19
  "copy": `<rect width="14" height="14" x="8" y="8" rx="2" ry="2"/><path d="M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"/>`,
20
+ "corner": `<path d="M5 20v-9a6 6 0 0 1 6-6h9"/>`,
21
+ "desktop": `<rect x="3" y="4.5" width="18" height="12.5" rx="2"/><path d="M12 17v3"/><path d="M8.5 20.5h7"/>`,
13
22
  "ellipsis": `<circle cx="5" cy="12" r="2"/><circle cx="12" cy="12" r="2"/><circle cx="19" cy="12" r="2"/>`,
23
+ "fill": `<path d="M12 3.5c3.2 3.7 5.5 6.9 5.5 9.7a5.5 5.5 0 0 1-11 0c0-2.8 2.3-6 5.5-9.7z"/>`,
14
24
  "folder": `<path d="M3 7a2 2 0 0 1 2-2h4l2 2h8a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z"/>`,
25
+ "frame": `<rect x="4" y="4" width="16" height="16" rx="2"/><path d="M4 9.5h16M9.5 9.5V20"/>`,
26
+ "gap": `<rect x="2.5" y="5" width="5" height="14" rx="1.5"/><rect x="16.5" y="5" width="5" height="14" rx="1.5"/><path d="M9 12h6"/><path d="m10.5 10-1.5 2 1.5 2"/><path d="m13.5 10 1.5 2-1.5 2"/>`,
27
+ "globe": `<circle cx="12" cy="12" r="9"/><path d="M3 12h18"/><path d="M12 3a13.5 13.5 0 0 1 0 18a13.5 13.5 0 0 1 0-18"/>`,
15
28
  "grip": `<circle cx="9" cy="5" r="1.6"/><circle cx="9" cy="12" r="1.6"/><circle cx="9" cy="19" r="1.6"/><circle cx="15" cy="5" r="1.6"/><circle cx="15" cy="12" r="1.6"/><circle cx="15" cy="19" r="1.6"/>`,
29
+ "height": `<path d="M5 4h14"/><path d="M5 20h14"/><path d="M12 8v8"/><path d="m9.5 10.5 2.5-2.5 2.5 2.5"/><path d="m9.5 13.5 2.5 2.5 2.5-2.5"/>`,
16
30
  "image": `<rect width="18" height="18" x="3" y="3" rx="2" ry="2"/><circle cx="9" cy="9" r="2"/><path d="m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21"/>`,
17
31
  "info": `<circle cx="12" cy="12" r="9"/><line x1="12" y1="11" x2="12" y2="16"/><line x1="12" y1="8" x2="12.01" y2="8"/>`,
18
32
  "italic": `<line x1="19" y1="4" x2="10" y2="4"/><line x1="14" y1="20" x2="5" y2="20"/><line x1="15" y1="4" x2="9" y2="20"/>`,
33
+ "limits": `<rect x="3" y="3" width="18" height="18" rx="2"/><rect x="8" y="8" width="8" height="8" rx="1.5" stroke-dasharray="2.5 2.5"/>`,
34
+ "margin": `<rect x="8" y="8" width="8" height="8" rx="1"/><path d="M12 2.5v3"/><path d="M12 18.5v3"/><path d="M2.5 12h3"/><path d="M18.5 12h3"/>`,
19
35
  "menu": `<path d="M3 6h18"/><path d="M3 12h18"/><path d="M3 18h18"/>`,
36
+ "mobile": `<rect x="7" y="2.5" width="10" height="19" rx="2.2"/><path d="M10.75 18.25h2.5"/>`,
20
37
  "named-slots": `<rect x="4" y="4" width="16" height="16" rx="2.5" stroke-dasharray="3.5 3"/><path d="M12 4.5v15"/>`,
21
38
  "pencil": `<path d="M12 20h9"/><path d="M16.5 3.5a2.121 2.121 0 0 1 3 3L7 19l-4 1 1-4Z"/>`,
22
39
  "plus": `<path d="M12 5v14"/><path d="M5 12h14"/>`,
40
+ "position": `<circle cx="12" cy="12" r="5"/><path d="M12 2.5V5"/><path d="M12 19v2.5"/><path d="M2.5 12H5"/><path d="M19 12h2.5"/>`,
23
41
  "redo": `<path d="M21 7v6h-6"/><path d="M3 17a9 9 0 0 1 9-9 9 9 0 0 1 6 2.3L21 13"/>`,
42
+ "row": `<rect x="4" y="5" width="6.5" height="14" rx="1.6"/><rect x="13.5" y="5" width="6.5" height="14" rx="1.6"/>`,
24
43
  "search": `<circle cx="11" cy="11" r="7"/><path d="m21 21-4.35-4.35"/>`,
44
+ "sides": `<rect x="4" y="4" width="16" height="16" rx="2"/><rect x="9" y="9" width="6" height="6" rx="1"/>`,
25
45
  "sliders": `<line x1="21" x2="14" y1="4" y2="4"/><line x1="10" x2="3" y1="4" y2="4"/><line x1="21" x2="12" y1="12" y2="12"/><line x1="8" x2="3" y1="12" y2="12"/><line x1="21" x2="16" y1="20" y2="20"/><line x1="12" x2="3" y1="20" y2="20"/><line x1="14" x2="14" y1="2" y2="6"/><line x1="8" x2="8" y1="10" y2="14"/><line x1="16" x2="16" y1="18" y2="22"/>`,
26
46
  "slot": `<rect x="4" y="4" width="16" height="16" rx="2.5" stroke-dasharray="3.5 3"/>`,
27
47
  "strikethrough": `<path d="M16 4H9a3 3 0 0 0-2.83 4"/><path d="M14 12a4 4 0 0 1 0 8H6"/><line x1="4" y1="12" x2="20" y2="12"/>`,
28
48
  "table": `<rect x="3" y="4" width="18" height="16" rx="2" stroke="currentColor" stroke-width="2"/>
29
49
  <path d="M3 9.5H21M9.5 9.5V20M15.5 9.5V20" stroke="currentColor" stroke-width="2"/>`,
50
+ "tablet": `<rect x="4.5" y="3" width="15" height="18" rx="2"/><path d="M10.5 17.75h3"/>`,
51
+ "text": `<path d="M5 6.5V5h14v1.5M12 5v14M9.5 19h5"/>`,
30
52
  "trash": `<path d="M3 6h18"/><path d="M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6"/><path d="M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"/><path d="M10 11v6"/><path d="M14 11v6"/>`,
31
53
  "underline": `<path d="M6 4v6a6 6 0 0 0 12 0V4"/><line x1="4" y1="21" x2="20" y2="21"/>`,
32
54
  "undo": `<path d="M3 7v6h6"/><path d="M21 17a9 9 0 0 0-9-9 9 9 0 0 0-6 2.3L3 13"/>`,
33
- "upload": `<path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/><polyline points="17 8 12 3 7 8"/><line x1="12" x2="12" y1="3" y2="15"/>`
55
+ "upload": `<path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/><polyline points="17 8 12 3 7 8"/><line x1="12" x2="12" y1="3" y2="15"/>`,
56
+ "width": `<path d="M4 5v14"/><path d="M20 5v14"/><path d="M8 12h8"/><path d="m10.5 9.5-2.5 2.5 2.5 2.5"/><path d="m13.5 9.5 2.5 2.5-2.5 2.5"/>`,
57
+ "wrap": `<path d="M4 7h16M4 17h5"/><path d="M4 12h13a3 3 0 0 1 0 6h-2m2 0-2-2m2 2-2 2"/>`
34
58
  };
35
59
  var attrs = {
60
+ "align-center": {
61
+ "width": "24",
62
+ "height": "24",
63
+ "viewBox": "0 0 24 24",
64
+ "fill": "none",
65
+ "stroke": "currentColor",
66
+ "stroke-width": "1.6",
67
+ "stroke-linecap": "round",
68
+ "stroke-linejoin": "round"
69
+ },
70
+ "align-left": {
71
+ "width": "24",
72
+ "height": "24",
73
+ "viewBox": "0 0 24 24",
74
+ "fill": "none",
75
+ "stroke": "currentColor",
76
+ "stroke-width": "1.6",
77
+ "stroke-linecap": "round",
78
+ "stroke-linejoin": "round"
79
+ },
80
+ "align-right": {
81
+ "width": "24",
82
+ "height": "24",
83
+ "viewBox": "0 0 24 24",
84
+ "fill": "none",
85
+ "stroke": "currentColor",
86
+ "stroke-width": "1.6",
87
+ "stroke-linecap": "round",
88
+ "stroke-linejoin": "round"
89
+ },
36
90
  "arrow-down": {
37
91
  "viewBox": "0 0 24 24",
38
92
  "fill": "none",
@@ -57,6 +111,16 @@ var attrs = {
57
111
  "stroke-linecap": "round",
58
112
  "stroke-linejoin": "round"
59
113
  },
114
+ "bolt": {
115
+ "width": "24",
116
+ "height": "24",
117
+ "viewBox": "0 0 24 24",
118
+ "fill": "none",
119
+ "stroke": "currentColor",
120
+ "stroke-width": "1.6",
121
+ "stroke-linecap": "round",
122
+ "stroke-linejoin": "round"
123
+ },
60
124
  "book": {
61
125
  "viewBox": "0 0 24 24",
62
126
  "fill": "none",
@@ -65,6 +129,16 @@ var attrs = {
65
129
  "stroke-linecap": "round",
66
130
  "stroke-linejoin": "round"
67
131
  },
132
+ "button": {
133
+ "width": "24",
134
+ "height": "24",
135
+ "viewBox": "0 0 24 24",
136
+ "fill": "none",
137
+ "stroke": "currentColor",
138
+ "stroke-width": "1.6",
139
+ "stroke-linecap": "round",
140
+ "stroke-linejoin": "round"
141
+ },
68
142
  "check": {
69
143
  "viewBox": "0 0 24 24",
70
144
  "fill": "none",
@@ -97,6 +171,26 @@ var attrs = {
97
171
  "stroke-linecap": "round",
98
172
  "stroke-linejoin": "round"
99
173
  },
174
+ "column": {
175
+ "width": "24",
176
+ "height": "24",
177
+ "viewBox": "0 0 24 24",
178
+ "fill": "none",
179
+ "stroke": "currentColor",
180
+ "stroke-width": "1.6",
181
+ "stroke-linecap": "round",
182
+ "stroke-linejoin": "round"
183
+ },
184
+ "component": {
185
+ "width": "24",
186
+ "height": "24",
187
+ "viewBox": "0 0 24 24",
188
+ "fill": "none",
189
+ "stroke": "currentColor",
190
+ "stroke-width": "1.6",
191
+ "stroke-linecap": "round",
192
+ "stroke-linejoin": "round"
193
+ },
100
194
  "copy": {
101
195
  "viewBox": "0 0 24 24",
102
196
  "fill": "none",
@@ -105,10 +199,40 @@ var attrs = {
105
199
  "stroke-linecap": "round",
106
200
  "stroke-linejoin": "round"
107
201
  },
202
+ "corner": {
203
+ "width": "24",
204
+ "height": "24",
205
+ "viewBox": "0 0 24 24",
206
+ "fill": "none",
207
+ "stroke": "currentColor",
208
+ "stroke-width": "1.6",
209
+ "stroke-linecap": "round",
210
+ "stroke-linejoin": "round"
211
+ },
212
+ "desktop": {
213
+ "width": "24",
214
+ "height": "24",
215
+ "viewBox": "0 0 24 24",
216
+ "fill": "none",
217
+ "stroke": "currentColor",
218
+ "stroke-width": "1.6",
219
+ "stroke-linecap": "round",
220
+ "stroke-linejoin": "round"
221
+ },
108
222
  "ellipsis": {
109
223
  "viewBox": "0 0 24 24",
110
224
  "fill": "currentColor"
111
225
  },
226
+ "fill": {
227
+ "width": "24",
228
+ "height": "24",
229
+ "viewBox": "0 0 24 24",
230
+ "fill": "none",
231
+ "stroke": "currentColor",
232
+ "stroke-width": "1.6",
233
+ "stroke-linecap": "round",
234
+ "stroke-linejoin": "round"
235
+ },
112
236
  "folder": {
113
237
  "viewBox": "0 0 24 24",
114
238
  "fill": "none",
@@ -117,11 +241,51 @@ var attrs = {
117
241
  "stroke-linecap": "round",
118
242
  "stroke-linejoin": "round"
119
243
  },
244
+ "frame": {
245
+ "width": "24",
246
+ "height": "24",
247
+ "viewBox": "0 0 24 24",
248
+ "fill": "none",
249
+ "stroke": "currentColor",
250
+ "stroke-width": "1.6",
251
+ "stroke-linecap": "round",
252
+ "stroke-linejoin": "round"
253
+ },
254
+ "gap": {
255
+ "width": "24",
256
+ "height": "24",
257
+ "viewBox": "0 0 24 24",
258
+ "fill": "none",
259
+ "stroke": "currentColor",
260
+ "stroke-width": "1.6",
261
+ "stroke-linecap": "round",
262
+ "stroke-linejoin": "round"
263
+ },
264
+ "globe": {
265
+ "width": "24",
266
+ "height": "24",
267
+ "viewBox": "0 0 24 24",
268
+ "fill": "none",
269
+ "stroke": "currentColor",
270
+ "stroke-width": "1.7",
271
+ "stroke-linecap": "round",
272
+ "stroke-linejoin": "round"
273
+ },
120
274
  "grip": {
121
275
  "viewBox": "0 0 24 24",
122
276
  "fill": "currentColor",
123
277
  "stroke": "none"
124
278
  },
279
+ "height": {
280
+ "width": "24",
281
+ "height": "24",
282
+ "viewBox": "0 0 24 24",
283
+ "fill": "none",
284
+ "stroke": "currentColor",
285
+ "stroke-width": "1.6",
286
+ "stroke-linecap": "round",
287
+ "stroke-linejoin": "round"
288
+ },
125
289
  "image": {
126
290
  "width": "24",
127
291
  "height": "24",
@@ -148,6 +312,26 @@ var attrs = {
148
312
  "stroke-linecap": "round",
149
313
  "stroke-linejoin": "round"
150
314
  },
315
+ "limits": {
316
+ "width": "24",
317
+ "height": "24",
318
+ "viewBox": "0 0 24 24",
319
+ "fill": "none",
320
+ "stroke": "currentColor",
321
+ "stroke-width": "1.6",
322
+ "stroke-linecap": "round",
323
+ "stroke-linejoin": "round"
324
+ },
325
+ "margin": {
326
+ "width": "24",
327
+ "height": "24",
328
+ "viewBox": "0 0 24 24",
329
+ "fill": "none",
330
+ "stroke": "currentColor",
331
+ "stroke-width": "1.6",
332
+ "stroke-linecap": "round",
333
+ "stroke-linejoin": "round"
334
+ },
151
335
  "menu": {
152
336
  "viewBox": "0 0 24 24",
153
337
  "fill": "none",
@@ -156,6 +340,16 @@ var attrs = {
156
340
  "stroke-linecap": "round",
157
341
  "stroke-linejoin": "round"
158
342
  },
343
+ "mobile": {
344
+ "width": "24",
345
+ "height": "24",
346
+ "viewBox": "0 0 24 24",
347
+ "fill": "none",
348
+ "stroke": "currentColor",
349
+ "stroke-width": "1.6",
350
+ "stroke-linecap": "round",
351
+ "stroke-linejoin": "round"
352
+ },
159
353
  "named-slots": {
160
354
  "viewBox": "0 0 24 24",
161
355
  "fill": "none",
@@ -180,6 +374,16 @@ var attrs = {
180
374
  "stroke-linecap": "round",
181
375
  "stroke-linejoin": "round"
182
376
  },
377
+ "position": {
378
+ "width": "24",
379
+ "height": "24",
380
+ "viewBox": "0 0 24 24",
381
+ "fill": "none",
382
+ "stroke": "currentColor",
383
+ "stroke-width": "1.6",
384
+ "stroke-linecap": "round",
385
+ "stroke-linejoin": "round"
386
+ },
183
387
  "redo": {
184
388
  "viewBox": "0 0 24 24",
185
389
  "fill": "none",
@@ -188,6 +392,16 @@ var attrs = {
188
392
  "stroke-linecap": "round",
189
393
  "stroke-linejoin": "round"
190
394
  },
395
+ "row": {
396
+ "width": "24",
397
+ "height": "24",
398
+ "viewBox": "0 0 24 24",
399
+ "fill": "none",
400
+ "stroke": "currentColor",
401
+ "stroke-width": "1.6",
402
+ "stroke-linecap": "round",
403
+ "stroke-linejoin": "round"
404
+ },
191
405
  "search": {
192
406
  "viewBox": "0 0 24 24",
193
407
  "fill": "none",
@@ -196,6 +410,16 @@ var attrs = {
196
410
  "stroke-linecap": "round",
197
411
  "stroke-linejoin": "round"
198
412
  },
413
+ "sides": {
414
+ "width": "24",
415
+ "height": "24",
416
+ "viewBox": "0 0 24 24",
417
+ "fill": "none",
418
+ "stroke": "currentColor",
419
+ "stroke-width": "1.6",
420
+ "stroke-linecap": "round",
421
+ "stroke-linejoin": "round"
422
+ },
199
423
  "sliders": {
200
424
  "width": "24",
201
425
  "height": "24",
@@ -226,6 +450,26 @@ var attrs = {
226
450
  "viewBox": "0 0 24 24",
227
451
  "fill": "none"
228
452
  },
453
+ "tablet": {
454
+ "width": "24",
455
+ "height": "24",
456
+ "viewBox": "0 0 24 24",
457
+ "fill": "none",
458
+ "stroke": "currentColor",
459
+ "stroke-width": "1.6",
460
+ "stroke-linecap": "round",
461
+ "stroke-linejoin": "round"
462
+ },
463
+ "text": {
464
+ "width": "24",
465
+ "height": "24",
466
+ "viewBox": "0 0 24 24",
467
+ "fill": "none",
468
+ "stroke": "currentColor",
469
+ "stroke-width": "1.6",
470
+ "stroke-linecap": "round",
471
+ "stroke-linejoin": "round"
472
+ },
229
473
  "trash": {
230
474
  "viewBox": "0 0 24 24",
231
475
  "fill": "none",
@@ -259,6 +503,26 @@ var attrs = {
259
503
  "stroke-width": "2",
260
504
  "stroke-linecap": "round",
261
505
  "stroke-linejoin": "round"
506
+ },
507
+ "width": {
508
+ "width": "24",
509
+ "height": "24",
510
+ "viewBox": "0 0 24 24",
511
+ "fill": "none",
512
+ "stroke": "currentColor",
513
+ "stroke-width": "1.6",
514
+ "stroke-linecap": "round",
515
+ "stroke-linejoin": "round"
516
+ },
517
+ "wrap": {
518
+ "width": "24",
519
+ "height": "24",
520
+ "viewBox": "0 0 24 24",
521
+ "fill": "none",
522
+ "stroke": "currentColor",
523
+ "stroke-width": "1.6",
524
+ "stroke-linecap": "round",
525
+ "stroke-linejoin": "round"
262
526
  }
263
527
  };
264
528
  //#endregion
@@ -316,6 +580,127 @@ function useDialog() {
316
580
  return store;
317
581
  }
318
582
  //#endregion
583
+ //#region src/editor/lib/image-size.ts
584
+ /** Largest dimension below which no LQIP is generated — icons stay as-is. */
585
+ var LQIP_MIN_DIMENSION = 256;
586
+ /** Pixel width of the generated LQIP preview. */
587
+ var LQIP_WIDTH = 24;
588
+ /**
589
+ * Decode an image file locally: intrinsic dimensions plus — for images of
590
+ * {@link LQIP_MIN_DIMENSION}+ — a tiny data-URI preview for `<Image>`'s
591
+ * blur-up. Runs entirely in the browser (createImageBitmap + canvas), so no
592
+ * server-side image library is needed. Resolves `null` when the file can't be
593
+ * decoded (unsupported format, SVG, jsdom) — callers fall back gracefully.
594
+ */
595
+ async function analyzeImageFile(file) {
596
+ try {
597
+ const bitmap = await createImageBitmap(file);
598
+ const { width, height } = bitmap;
599
+ const info = {
600
+ width,
601
+ height
602
+ };
603
+ if (Math.max(width, height) >= LQIP_MIN_DIMENSION) {
604
+ const canvas = document.createElement("canvas");
605
+ canvas.width = LQIP_WIDTH;
606
+ canvas.height = Math.max(1, Math.round(height / width * LQIP_WIDTH));
607
+ const context = canvas.getContext("2d");
608
+ if (context) {
609
+ context.drawImage(bitmap, 0, 0, canvas.width, canvas.height);
610
+ const uri = canvas.toDataURL("image/webp", .6);
611
+ if (uri.startsWith("data:image/")) info.lqip = uri;
612
+ }
613
+ }
614
+ bitmap.close();
615
+ return info;
616
+ } catch {
617
+ return null;
618
+ }
619
+ }
620
+ /**
621
+ * {@link analyzeImageFile} for an already-uploaded URL: fetch the file and
622
+ * decode it locally. This is how *library picks* get dimensions + LQIP — there
623
+ * is no `File` in hand, only the asset's src. Null on any failure.
624
+ */
625
+ async function analyzeImageUrl(src) {
626
+ try {
627
+ const response = await fetch(src);
628
+ if (!response.ok) return null;
629
+ return await analyzeImageFile(await response.blob());
630
+ } catch {
631
+ return null;
632
+ }
633
+ }
634
+ /** Largest dimension a free (unsized) crop derivative is downscaled to. */
635
+ var CROP_MAX_DIMENSION = 2560;
636
+ /** WebP quality for cropped derivatives — the real rendered image, not an LQIP. */
637
+ var CROP_QUALITY = .85;
638
+ /**
639
+ * Crop + downscale an image entirely in the browser (createImageBitmap + canvas):
640
+ * take the {@link NormalizedRect} region of the source at `src`, scale it to fit
641
+ * `target` (or capped at {@link CROP_MAX_DIMENSION} when no target), and encode a
642
+ * WebP blob. Never upscales. Resolves `null` when the source can't be fetched or
643
+ * decoded (SVG, CORS, jsdom) — the caller keeps the focal-only path. The blob is
644
+ * uploaded as a derived asset; `width`/`height` are its intrinsic size.
645
+ */
646
+ async function renderCrop(src, rect, target = {}) {
647
+ try {
648
+ const response = await fetch(src);
649
+ if (!response.ok) return null;
650
+ const bitmap = await createImageBitmap(await response.blob());
651
+ const sx = rect.x * bitmap.width;
652
+ const sy = rect.y * bitmap.height;
653
+ const sw = rect.width * bitmap.width;
654
+ const sh = rect.height * bitmap.height;
655
+ if (sw < 1 || sh < 1) {
656
+ bitmap.close();
657
+ return null;
658
+ }
659
+ const scale = target.width && target.height ? Math.min(1, target.width / sw, target.height / sh) : Math.min(1, CROP_MAX_DIMENSION / Math.max(sw, sh));
660
+ const outW = Math.max(1, Math.round(sw * scale));
661
+ const outH = Math.max(1, Math.round(sh * scale));
662
+ const canvas = document.createElement("canvas");
663
+ canvas.width = outW;
664
+ canvas.height = outH;
665
+ const context = canvas.getContext("2d");
666
+ if (!context) {
667
+ bitmap.close();
668
+ return null;
669
+ }
670
+ context.drawImage(bitmap, sx, sy, sw, sh, 0, 0, outW, outH);
671
+ bitmap.close();
672
+ const blob = await canvasToBlob(canvas, "image/webp", CROP_QUALITY);
673
+ return blob ? {
674
+ blob,
675
+ width: outW,
676
+ height: outH
677
+ } : null;
678
+ } catch {
679
+ return null;
680
+ }
681
+ }
682
+ /** Promisified `canvas.toBlob` (jsdom lacks it → null, caller falls back). */
683
+ function canvasToBlob(canvas, type, quality) {
684
+ if (typeof canvas.toBlob !== "function") return Promise.resolve(null);
685
+ return new Promise((resolve) => canvas.toBlob((blob) => resolve(blob), type, quality));
686
+ }
687
+ /**
688
+ * Intrinsic pixel size of an image URL, via the browser's image loader.
689
+ * Resolves `null` when the image can't be loaded or reports no size — callers
690
+ * simply skip the dimensions then, never fail.
691
+ */
692
+ function readImageSize(src) {
693
+ return new Promise((resolve) => {
694
+ const image = new Image();
695
+ image.onload = () => resolve(image.naturalWidth > 0 ? {
696
+ width: image.naturalWidth,
697
+ height: image.naturalHeight
698
+ } : null);
699
+ image.onerror = () => resolve(null);
700
+ image.src = src;
701
+ });
702
+ }
703
+ //#endregion
319
704
  //#region src/editor/ui/VDialog.vue?vue&type=script&setup=true&lang.ts
320
705
  var _hoisted_1$1 = { class: "mech-modal__header" };
321
706
  var _hoisted_2$1 = { class: "mech-modal__title" };
@@ -389,7 +774,20 @@ var ImagePickerDialog_default = /*#__PURE__*/ _plugin_vue_export_helper_default(
389
774
  loaded.value = true;
390
775
  }
391
776
  }
392
- function select(value) {
777
+ async function select(value) {
778
+ const missingPreview = !value.previewSrc || value.previewSrc === value.src;
779
+ if (!value.width || !value.height || missingPreview) {
780
+ const info = await analyzeImageUrl(value.src);
781
+ const size = info ?? await readImageSize(value.src);
782
+ value = {
783
+ ...value,
784
+ ...size ? {
785
+ width: size.width,
786
+ height: size.height
787
+ } : {},
788
+ ...info?.lqip && missingPreview ? { previewSrc: info.lqip } : {}
789
+ };
790
+ }
393
791
  props.onSelect(value);
394
792
  dialog.back();
395
793
  }
@@ -397,10 +795,16 @@ var ImagePickerDialog_default = /*#__PURE__*/ _plugin_vue_export_helper_default(
397
795
  if (!uploader || busy.value) return;
398
796
  busy.value = true;
399
797
  try {
400
- const result = await uploader(file);
401
- select({
798
+ const [result, info] = await Promise.all([uploader(file), analyzeImageFile(file)]);
799
+ const width = result.width ?? info?.width;
800
+ const height = result.height ?? info?.height;
801
+ await select({
402
802
  src: result.src,
403
- previewSrc: result.previewSrc ?? result.src
803
+ previewSrc: result.previewSrc ?? info?.lqip ?? result.src,
804
+ ...width && height ? {
805
+ width,
806
+ height
807
+ } : {}
404
808
  });
405
809
  } finally {
406
810
  busy.value = false;
@@ -463,6 +867,6 @@ var ImagePickerDialog_default = /*#__PURE__*/ _plugin_vue_export_helper_default(
463
867
  });
464
868
  };
465
869
  }
466
- }), [["__scopeId", "data-v-ce3974a0"]]);
870
+ }), [["__scopeId", "data-v-4ef9dd0d"]]);
467
871
  //#endregion
468
- export { useDialog as a, dialogKey as i, VDialog_default as n, _plugin_vue_export_helper_default as o, createDialogStore as r, VIcon_default as s, ImagePickerDialog_default as t };
872
+ export { renderCrop as a, useDialog as c, contents as d, readImageSize as i, _plugin_vue_export_helper_default as l, VDialog_default as n, createDialogStore as o, analyzeImageFile as r, dialogKey as s, ImagePickerDialog_default as t, VIcon_default as u };