@aglyn/besigner-ui 1.0.0-beta.143

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 (486) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +7 -0
  3. package/package.json +73 -0
  4. package/src/besigner.d.ts +88 -0
  5. package/src/besigner.js +89 -0
  6. package/src/besigner.js.map +1 -0
  7. package/src/index.d.ts +17 -0
  8. package/src/index.js +18 -0
  9. package/src/index.js.map +1 -0
  10. package/src/lib/box-styler/box-styler.d.ts +57 -0
  11. package/src/lib/box-styler/box-styler.js +240 -0
  12. package/src/lib/box-styler/box-styler.js.map +1 -0
  13. package/src/lib/box-styler/components/box-diagram.d.ts +89 -0
  14. package/src/lib/box-styler/components/box-diagram.js +661 -0
  15. package/src/lib/box-styler/components/box-diagram.js.map +1 -0
  16. package/src/lib/box-styler/components/legend.d.ts +56 -0
  17. package/src/lib/box-styler/components/legend.js +130 -0
  18. package/src/lib/box-styler/components/legend.js.map +1 -0
  19. package/src/lib/box-styler/components/spacing-editor.d.ts +55 -0
  20. package/src/lib/box-styler/components/spacing-editor.js +347 -0
  21. package/src/lib/box-styler/components/spacing-editor.js.map +1 -0
  22. package/src/lib/box-styler/constants.d.ts +17 -0
  23. package/src/lib/box-styler/constants.js +30 -0
  24. package/src/lib/box-styler/constants.js.map +1 -0
  25. package/src/lib/box-styler/index.d.ts +2 -0
  26. package/src/lib/box-styler/index.js +4 -0
  27. package/src/lib/box-styler/index.js.map +1 -0
  28. package/src/lib/box-styler/region-fills.d.ts +107 -0
  29. package/src/lib/box-styler/region-fills.js +139 -0
  30. package/src/lib/box-styler/region-fills.js.map +1 -0
  31. package/src/lib/box-styler/spacing-value.d.ts +104 -0
  32. package/src/lib/box-styler/spacing-value.js +223 -0
  33. package/src/lib/box-styler/spacing-value.js.map +1 -0
  34. package/src/lib/box-styler/types.d.ts +29 -0
  35. package/src/lib/box-styler/types.js +18 -0
  36. package/src/lib/box-styler/types.js.map +1 -0
  37. package/src/lib/components/accordion-list.component.d.ts +50 -0
  38. package/src/lib/components/accordion-list.component.js +228 -0
  39. package/src/lib/components/accordion-list.component.js.map +1 -0
  40. package/src/lib/components/add-controls.component.d.ts +22 -0
  41. package/src/lib/components/add-controls.component.js +50 -0
  42. package/src/lib/components/add-controls.component.js.map +1 -0
  43. package/src/lib/components/app-bar-breadcrumbs.component.d.ts +29 -0
  44. package/src/lib/components/app-bar-breadcrumbs.component.js +279 -0
  45. package/src/lib/components/app-bar-breadcrumbs.component.js.map +1 -0
  46. package/src/lib/components/app-bar-primary.component.d.ts +21 -0
  47. package/src/lib/components/app-bar-primary.component.js +108 -0
  48. package/src/lib/components/app-bar-primary.component.js.map +1 -0
  49. package/src/lib/components/app-bar-secondary.component.d.ts +21 -0
  50. package/src/lib/components/app-bar-secondary.component.js +94 -0
  51. package/src/lib/components/app-bar-secondary.component.js.map +1 -0
  52. package/src/lib/components/aside-panel.component.d.ts +23 -0
  53. package/src/lib/components/aside-panel.component.js +505 -0
  54. package/src/lib/components/aside-panel.component.js.map +1 -0
  55. package/src/lib/components/besigner-conflict-alert.component.d.ts +36 -0
  56. package/src/lib/components/besigner-conflict-alert.component.js +51 -0
  57. package/src/lib/components/besigner-conflict-alert.component.js.map +1 -0
  58. package/src/lib/components/besigner-dnd-context.component.d.ts +32 -0
  59. package/src/lib/components/besigner-dnd-context.component.js +75 -0
  60. package/src/lib/components/besigner-dnd-context.component.js.map +1 -0
  61. package/src/lib/components/besigner-draft-alert.component.d.ts +70 -0
  62. package/src/lib/components/besigner-draft-alert.component.js +155 -0
  63. package/src/lib/components/besigner-draft-alert.component.js.map +1 -0
  64. package/src/lib/components/besigner-root-provider.component.d.ts +33 -0
  65. package/src/lib/components/besigner-root-provider.component.js +68 -0
  66. package/src/lib/components/besigner-root-provider.component.js.map +1 -0
  67. package/src/lib/components/binding-preview-controls.component.d.ts +28 -0
  68. package/src/lib/components/binding-preview-controls.component.js +63 -0
  69. package/src/lib/components/binding-preview-controls.component.js.map +1 -0
  70. package/src/lib/components/closeable-drawer.component.d.ts +32 -0
  71. package/src/lib/components/closeable-drawer.component.js +134 -0
  72. package/src/lib/components/closeable-drawer.component.js.map +1 -0
  73. package/src/lib/components/component-accordion-list.d.ts +28 -0
  74. package/src/lib/components/component-accordion-list.js +205 -0
  75. package/src/lib/components/component-accordion-list.js.map +1 -0
  76. package/src/lib/components/component-icon.component.d.ts +32 -0
  77. package/src/lib/components/component-icon.component.js +51 -0
  78. package/src/lib/components/component-icon.component.js.map +1 -0
  79. package/src/lib/components/component-picker.d.ts +27 -0
  80. package/src/lib/components/component-picker.js +368 -0
  81. package/src/lib/components/component-picker.js.map +1 -0
  82. package/src/lib/components/components-grid-list.component.d.ts +31 -0
  83. package/src/lib/components/components-grid-list.component.js +162 -0
  84. package/src/lib/components/components-grid-list.component.js.map +1 -0
  85. package/src/lib/components/custom-css-form.component.d.ts +115 -0
  86. package/src/lib/components/custom-css-form.component.js +699 -0
  87. package/src/lib/components/custom-css-form.component.js.map +1 -0
  88. package/src/lib/components/device-preview-controls.component.d.ts +22 -0
  89. package/src/lib/components/device-preview-controls.component.js +150 -0
  90. package/src/lib/components/device-preview-controls.component.js.map +1 -0
  91. package/src/lib/components/dnd/canvas-drop-indicator.d.ts +20 -0
  92. package/src/lib/components/dnd/canvas-drop-indicator.js +61 -0
  93. package/src/lib/components/dnd/canvas-drop-indicator.js.map +1 -0
  94. package/src/lib/components/dnd/draggable-droppable.d.ts +31 -0
  95. package/src/lib/components/dnd/draggable-droppable.js +383 -0
  96. package/src/lib/components/dnd/draggable-droppable.js.map +1 -0
  97. package/src/lib/components/dnd/draggable.d.ts +42 -0
  98. package/src/lib/components/dnd/draggable.js +66 -0
  99. package/src/lib/components/dnd/draggable.js.map +1 -0
  100. package/src/lib/components/dnd/drop-indicator.d.ts +31 -0
  101. package/src/lib/components/dnd/drop-indicator.js +139 -0
  102. package/src/lib/components/dnd/drop-indicator.js.map +1 -0
  103. package/src/lib/components/dnd/droppable.d.ts +43 -0
  104. package/src/lib/components/dnd/droppable.js +63 -0
  105. package/src/lib/components/dnd/droppable.js.map +1 -0
  106. package/src/lib/components/element-card.component.d.ts +23 -0
  107. package/src/lib/components/element-card.component.js +49 -0
  108. package/src/lib/components/element-card.component.js.map +1 -0
  109. package/src/lib/components/element-classes-field.component.d.ts +41 -0
  110. package/src/lib/components/element-classes-field.component.js +140 -0
  111. package/src/lib/components/element-classes-field.component.js.map +1 -0
  112. package/src/lib/components/element-detail-overlay.component.d.ts +55 -0
  113. package/src/lib/components/element-detail-overlay.component.js +157 -0
  114. package/src/lib/components/element-detail-overlay.component.js.map +1 -0
  115. package/src/lib/components/element-detail.component.d.ts +56 -0
  116. package/src/lib/components/element-detail.component.js +171 -0
  117. package/src/lib/components/element-detail.component.js.map +1 -0
  118. package/src/lib/components/element-info-details.component.d.ts +18 -0
  119. package/src/lib/components/element-info-details.component.js +169 -0
  120. package/src/lib/components/element-info-details.component.js.map +1 -0
  121. package/src/lib/components/element-interactions-form.component.d.ts +21 -0
  122. package/src/lib/components/element-interactions-form.component.js +199 -0
  123. package/src/lib/components/element-interactions-form.component.js.map +1 -0
  124. package/src/lib/components/element-preview.component.d.ts +75 -0
  125. package/src/lib/components/element-preview.component.js +346 -0
  126. package/src/lib/components/element-preview.component.js.map +1 -0
  127. package/src/lib/components/element-props-form.component.d.ts +565 -0
  128. package/src/lib/components/element-props-form.component.js +2392 -0
  129. package/src/lib/components/element-props-form.component.js.map +1 -0
  130. package/src/lib/components/element-styles-form-template.component.d.ts +27 -0
  131. package/src/lib/components/element-styles-form-template.component.js +89 -0
  132. package/src/lib/components/element-styles-form-template.component.js.map +1 -0
  133. package/src/lib/components/element-styles-form.component.d.ts +52 -0
  134. package/src/lib/components/element-styles-form.component.js +1350 -0
  135. package/src/lib/components/element-styles-form.component.js.map +1 -0
  136. package/src/lib/components/empty-document-slot.d.ts +39 -0
  137. package/src/lib/components/empty-document-slot.js +121 -0
  138. package/src/lib/components/empty-document-slot.js.map +1 -0
  139. package/src/lib/components/empty-results.d.ts +22 -0
  140. package/src/lib/components/empty-results.js +131 -0
  141. package/src/lib/components/empty-results.js.map +1 -0
  142. package/src/lib/components/history-controls.component.d.ts +21 -0
  143. package/src/lib/components/history-controls.component.js +67 -0
  144. package/src/lib/components/history-controls.component.js.map +1 -0
  145. package/src/lib/components/inline-markdown-editor.component.d.ts +17 -0
  146. package/src/lib/components/inline-markdown-editor.component.js +220 -0
  147. package/src/lib/components/inline-markdown-editor.component.js.map +1 -0
  148. package/src/lib/components/inline-text-editor.component.d.ts +48 -0
  149. package/src/lib/components/inline-text-editor.component.js +905 -0
  150. package/src/lib/components/inline-text-editor.component.js.map +1 -0
  151. package/src/lib/components/insert-token-menu.component.d.ts +86 -0
  152. package/src/lib/components/insert-token-menu.component.js +232 -0
  153. package/src/lib/components/insert-token-menu.component.js.map +1 -0
  154. package/src/lib/components/instance-attr-overrides.component.d.ts +50 -0
  155. package/src/lib/components/instance-attr-overrides.component.js +298 -0
  156. package/src/lib/components/instance-attr-overrides.component.js.map +1 -0
  157. package/src/lib/components/interact-controls.component.d.ts +22 -0
  158. package/src/lib/components/interact-controls.component.js +74 -0
  159. package/src/lib/components/interact-controls.component.js.map +1 -0
  160. package/src/lib/components/markdown-attribute-field.component.d.ts +40 -0
  161. package/src/lib/components/markdown-attribute-field.component.js +103 -0
  162. package/src/lib/components/markdown-attribute-field.component.js.map +1 -0
  163. package/src/lib/components/node-card.d.ts +24 -0
  164. package/src/lib/components/node-card.js +86 -0
  165. package/src/lib/components/node-card.js.map +1 -0
  166. package/src/lib/components/node-context-menu.d.ts +25 -0
  167. package/src/lib/components/node-context-menu.js +558 -0
  168. package/src/lib/components/node-context-menu.js.map +1 -0
  169. package/src/lib/components/node-leaf.d.ts +39 -0
  170. package/src/lib/components/node-leaf.js +628 -0
  171. package/src/lib/components/node-leaf.js.map +1 -0
  172. package/src/lib/components/node-outline.d.ts +24 -0
  173. package/src/lib/components/node-outline.js +156 -0
  174. package/src/lib/components/node-outline.js.map +1 -0
  175. package/src/lib/components/node-overlay.d.ts +23 -0
  176. package/src/lib/components/node-overlay.js +299 -0
  177. package/src/lib/components/node-overlay.js.map +1 -0
  178. package/src/lib/components/node-quick-actions.d.ts +24 -0
  179. package/src/lib/components/node-quick-actions.js +284 -0
  180. package/src/lib/components/node-quick-actions.js.map +1 -0
  181. package/src/lib/components/node-tree-view.d.ts +106 -0
  182. package/src/lib/components/node-tree-view.js +820 -0
  183. package/src/lib/components/node-tree-view.js.map +1 -0
  184. package/src/lib/components/panel-controls.component.d.ts +22 -0
  185. package/src/lib/components/panel-controls.component.js +76 -0
  186. package/src/lib/components/panel-controls.component.js.map +1 -0
  187. package/src/lib/components/picker-search-field.d.ts +38 -0
  188. package/src/lib/components/picker-search-field.js +79 -0
  189. package/src/lib/components/picker-search-field.js.map +1 -0
  190. package/src/lib/components/plugin-settings-field.component.d.ts +38 -0
  191. package/src/lib/components/plugin-settings-field.component.js +264 -0
  192. package/src/lib/components/plugin-settings-field.component.js.map +1 -0
  193. package/src/lib/components/properties-dialog.component.d.ts +22 -0
  194. package/src/lib/components/properties-dialog.component.js +40 -0
  195. package/src/lib/components/properties-dialog.component.js.map +1 -0
  196. package/src/lib/components/property-binding-field.component.d.ts +142 -0
  197. package/src/lib/components/property-binding-field.component.js +325 -0
  198. package/src/lib/components/property-binding-field.component.js.map +1 -0
  199. package/src/lib/components/property-values-form.component.d.ts +43 -0
  200. package/src/lib/components/property-values-form.component.js +223 -0
  201. package/src/lib/components/property-values-form.component.js.map +1 -0
  202. package/src/lib/components/scheme-preview-controls.component.d.ts +26 -0
  203. package/src/lib/components/scheme-preview-controls.component.js +56 -0
  204. package/src/lib/components/scheme-preview-controls.component.js.map +1 -0
  205. package/src/lib/components/screen-link-field.component.d.ts +118 -0
  206. package/src/lib/components/screen-link-field.component.js +282 -0
  207. package/src/lib/components/screen-link-field.component.js.map +1 -0
  208. package/src/lib/components/site-theme-color-tokens-provider.component.d.ts +33 -0
  209. package/src/lib/components/site-theme-color-tokens-provider.component.js +53 -0
  210. package/src/lib/components/site-theme-color-tokens-provider.component.js.map +1 -0
  211. package/src/lib/components/subtree-json-dialog.component.d.ts +46 -0
  212. package/src/lib/components/subtree-json-dialog.component.js +125 -0
  213. package/src/lib/components/subtree-json-dialog.component.js.map +1 -0
  214. package/src/lib/components/token-pill.component.d.ts +51 -0
  215. package/src/lib/components/token-pill.component.js +164 -0
  216. package/src/lib/components/token-pill.component.js.map +1 -0
  217. package/src/lib/components/token-text-field.component.d.ts +146 -0
  218. package/src/lib/components/token-text-field.component.js +603 -0
  219. package/src/lib/components/token-text-field.component.js.map +1 -0
  220. package/src/lib/components/tree/tree-list.d.ts +6 -0
  221. package/src/lib/components/tree/tree-list.js +108 -0
  222. package/src/lib/components/tree/tree-list.js.map +1 -0
  223. package/src/lib/components/viewport-canvas.component.d.ts +23 -0
  224. package/src/lib/components/viewport-canvas.component.js +128 -0
  225. package/src/lib/components/viewport-canvas.component.js.map +1 -0
  226. package/src/lib/components/viewport-frame.component.d.ts +47 -0
  227. package/src/lib/components/viewport-frame.component.js +332 -0
  228. package/src/lib/components/viewport-frame.component.js.map +1 -0
  229. package/src/lib/components/viewport-root.component.d.ts +22 -0
  230. package/src/lib/components/viewport-root.component.js +112 -0
  231. package/src/lib/components/viewport-root.component.js.map +1 -0
  232. package/src/lib/components/viewport-zoom-controls.d.ts +29 -0
  233. package/src/lib/components/viewport-zoom-controls.js +147 -0
  234. package/src/lib/components/viewport-zoom-controls.js.map +1 -0
  235. package/src/lib/components/workspace-editor.component.d.ts +23 -0
  236. package/src/lib/components/workspace-editor.component.js +191 -0
  237. package/src/lib/components/workspace-editor.component.js.map +1 -0
  238. package/src/lib/components/workspace-panel.component.d.ts +28 -0
  239. package/src/lib/components/workspace-panel.component.js +147 -0
  240. package/src/lib/components/workspace-panel.component.js.map +1 -0
  241. package/src/lib/constants/sample-data.d.ts +18 -0
  242. package/src/lib/constants/sample-data.js +106 -0
  243. package/src/lib/constants/sample-data.js.map +1 -0
  244. package/src/lib/constants/shared.d.ts +17 -0
  245. package/src/lib/constants/shared.js +18 -0
  246. package/src/lib/constants/shared.js.map +1 -0
  247. package/src/lib/contexts/besigner-app-context.d.ts +30 -0
  248. package/src/lib/contexts/besigner-app-context.js +41 -0
  249. package/src/lib/contexts/besigner-app-context.js.map +1 -0
  250. package/src/lib/contexts/binding-picker-context.d.ts +78 -0
  251. package/src/lib/contexts/binding-picker-context.js +21 -0
  252. package/src/lib/contexts/binding-picker-context.js.map +1 -0
  253. package/src/lib/contexts/canvas-host-tokens-context.d.ts +49 -0
  254. package/src/lib/contexts/canvas-host-tokens-context.js +63 -0
  255. package/src/lib/contexts/canvas-host-tokens-context.js.map +1 -0
  256. package/src/lib/contexts/canvas-reveal-context.d.ts +32 -0
  257. package/src/lib/contexts/canvas-reveal-context.js +34 -0
  258. package/src/lib/contexts/canvas-reveal-context.js.map +1 -0
  259. package/src/lib/contexts/component-promotion-context.d.ts +89 -0
  260. package/src/lib/contexts/component-promotion-context.js +21 -0
  261. package/src/lib/contexts/component-promotion-context.js.map +1 -0
  262. package/src/lib/contexts/components-drawer-context.provider.d.ts +32 -0
  263. package/src/lib/contexts/components-drawer-context.provider.js +80 -0
  264. package/src/lib/contexts/components-drawer-context.provider.js.map +1 -0
  265. package/src/lib/contexts/element-drawer-context.d.ts +1005 -0
  266. package/src/lib/contexts/element-drawer-context.js +45 -0
  267. package/src/lib/contexts/element-drawer-context.js.map +1 -0
  268. package/src/lib/contexts/inspected-selection.d.ts +32 -0
  269. package/src/lib/contexts/inspected-selection.js +38 -0
  270. package/src/lib/contexts/inspected-selection.js.map +1 -0
  271. package/src/lib/contexts/inspector-extras-context.d.ts +56 -0
  272. package/src/lib/contexts/inspector-extras-context.js +35 -0
  273. package/src/lib/contexts/inspector-extras-context.js.map +1 -0
  274. package/src/lib/contexts/interactions-context.d.ts +99 -0
  275. package/src/lib/contexts/interactions-context.js +22 -0
  276. package/src/lib/contexts/interactions-context.js.map +1 -0
  277. package/src/lib/contexts/layout-chrome-context.d.ts +37 -0
  278. package/src/lib/contexts/layout-chrome-context.js +75 -0
  279. package/src/lib/contexts/layout-chrome-context.js.map +1 -0
  280. package/src/lib/contexts/media-asset-facts-context.d.ts +74 -0
  281. package/src/lib/contexts/media-asset-facts-context.js +27 -0
  282. package/src/lib/contexts/media-asset-facts-context.js.map +1 -0
  283. package/src/lib/contexts/media-picker-context.d.ts +88 -0
  284. package/src/lib/contexts/media-picker-context.js +21 -0
  285. package/src/lib/contexts/media-picker-context.js.map +1 -0
  286. package/src/lib/contexts/rendered-canvas-elements.d.ts +42 -0
  287. package/src/lib/contexts/rendered-canvas-elements.js +79 -0
  288. package/src/lib/contexts/rendered-canvas-elements.js.map +1 -0
  289. package/src/lib/contexts/repeat-record-context.d.ts +38 -0
  290. package/src/lib/contexts/repeat-record-context.js +21 -0
  291. package/src/lib/contexts/repeat-record-context.js.map +1 -0
  292. package/src/lib/contexts/repeat-rows-context.d.ts +53 -0
  293. package/src/lib/contexts/repeat-rows-context.js +38 -0
  294. package/src/lib/contexts/repeat-rows-context.js.map +1 -0
  295. package/src/lib/contexts/toolbar-extras-context.d.ts +31 -0
  296. package/src/lib/contexts/toolbar-extras-context.js +33 -0
  297. package/src/lib/contexts/toolbar-extras-context.js.map +1 -0
  298. package/src/lib/drafts/besigner-draft-store.d.ts +110 -0
  299. package/src/lib/drafts/besigner-draft-store.js +125 -0
  300. package/src/lib/drafts/besigner-draft-store.js.map +1 -0
  301. package/src/lib/drafts/besigner-server-draft.d.ts +130 -0
  302. package/src/lib/drafts/besigner-server-draft.js +211 -0
  303. package/src/lib/drafts/besigner-server-draft.js.map +1 -0
  304. package/src/lib/form-fields/components/shared/inline-form-control.d.ts +32 -0
  305. package/src/lib/form-fields/components/shared/inline-form-control.js +85 -0
  306. package/src/lib/form-fields/components/shared/inline-form-control.js.map +1 -0
  307. package/src/lib/form-fields/components/shared/toggle-button-form-control.d.ts +33 -0
  308. package/src/lib/form-fields/components/shared/toggle-button-form-control.js +83 -0
  309. package/src/lib/form-fields/components/shared/toggle-button-form-control.js.map +1 -0
  310. package/src/lib/form-fields/form-fields.d.ts +20 -0
  311. package/src/lib/form-fields/form-fields.js +21 -0
  312. package/src/lib/form-fields/form-fields.js.map +1 -0
  313. package/src/lib/form-fields/index.d.ts +1 -0
  314. package/src/lib/form-fields/index.js +3 -0
  315. package/src/lib/form-fields/index.js.map +1 -0
  316. package/src/lib/hooks/use-add-element-drawer-callback.d.ts +28 -0
  317. package/src/lib/hooks/use-add-element-drawer-callback.js +112 -0
  318. package/src/lib/hooks/use-add-element-drawer-callback.js.map +1 -0
  319. package/src/lib/hooks/use-aglyn-besigner-flag.d.ts +23 -0
  320. package/src/lib/hooks/use-aglyn-besigner-flag.js +47 -0
  321. package/src/lib/hooks/use-aglyn-besigner-flag.js.map +1 -0
  322. package/src/lib/hooks/use-aglyn-besigner-panel-value.d.ts +23 -0
  323. package/src/lib/hooks/use-aglyn-besigner-panel-value.js +54 -0
  324. package/src/lib/hooks/use-aglyn-besigner-panel-value.js.map +1 -0
  325. package/src/lib/hooks/use-aglyn-besigner-panel.d.ts +23 -0
  326. package/src/lib/hooks/use-aglyn-besigner-panel.js +47 -0
  327. package/src/lib/hooks/use-aglyn-besigner-panel.js.map +1 -0
  328. package/src/lib/hooks/use-anchored-rect.d.ts +68 -0
  329. package/src/lib/hooks/use-anchored-rect.js +131 -0
  330. package/src/lib/hooks/use-anchored-rect.js.map +1 -0
  331. package/src/lib/hooks/use-besigner-app-context.d.ts +18 -0
  332. package/src/lib/hooks/use-besigner-app-context.js +19 -0
  333. package/src/lib/hooks/use-besigner-app-context.js.map +1 -0
  334. package/src/lib/hooks/use-besigner-document.d.ts +309 -0
  335. package/src/lib/hooks/use-besigner-document.js +500 -0
  336. package/src/lib/hooks/use-besigner-document.js.map +1 -0
  337. package/src/lib/hooks/use-besigner-draft.d.ts +209 -0
  338. package/src/lib/hooks/use-besigner-draft.js +429 -0
  339. package/src/lib/hooks/use-besigner-draft.js.map +1 -0
  340. package/src/lib/hooks/use-clipboard-callbacks.d.ts +29 -0
  341. package/src/lib/hooks/use-clipboard-callbacks.js +82 -0
  342. package/src/lib/hooks/use-clipboard-callbacks.js.map +1 -0
  343. package/src/lib/hooks/use-clipboard-shortcuts.d.ts +52 -0
  344. package/src/lib/hooks/use-clipboard-shortcuts.js +102 -0
  345. package/src/lib/hooks/use-clipboard-shortcuts.js.map +1 -0
  346. package/src/lib/hooks/use-component-propagation-notice.d.ts +96 -0
  347. package/src/lib/hooks/use-component-propagation-notice.js +177 -0
  348. package/src/lib/hooks/use-component-propagation-notice.js.map +1 -0
  349. package/src/lib/hooks/use-debounced-commit.d.ts +43 -0
  350. package/src/lib/hooks/use-debounced-commit.js +88 -0
  351. package/src/lib/hooks/use-debounced-commit.js.map +1 -0
  352. package/src/lib/hooks/use-delete-element-callback.d.ts +24 -0
  353. package/src/lib/hooks/use-delete-element-callback.js +82 -0
  354. package/src/lib/hooks/use-delete-element-callback.js.map +1 -0
  355. package/src/lib/hooks/use-detail-hover-intent.d.ts +76 -0
  356. package/src/lib/hooks/use-detail-hover-intent.js +123 -0
  357. package/src/lib/hooks/use-detail-hover-intent.js.map +1 -0
  358. package/src/lib/hooks/use-document-repair-callbacks.d.ts +50 -0
  359. package/src/lib/hooks/use-document-repair-callbacks.js +237 -0
  360. package/src/lib/hooks/use-document-repair-callbacks.js.map +1 -0
  361. package/src/lib/hooks/use-insert-token-options.d.ts +52 -0
  362. package/src/lib/hooks/use-insert-token-options.js +230 -0
  363. package/src/lib/hooks/use-insert-token-options.js.map +1 -0
  364. package/src/lib/hooks/use-leaf-drag.d.ts +24 -0
  365. package/src/lib/hooks/use-leaf-drag.js +28 -0
  366. package/src/lib/hooks/use-leaf-drag.js.map +1 -0
  367. package/src/lib/hooks/use-leaf-drop.d.ts +31 -0
  368. package/src/lib/hooks/use-leaf-drop.js +43 -0
  369. package/src/lib/hooks/use-leaf-drop.js.map +1 -0
  370. package/src/lib/hooks/use-markdown-media-picker.d.ts +63 -0
  371. package/src/lib/hooks/use-markdown-media-picker.js +110 -0
  372. package/src/lib/hooks/use-markdown-media-picker.js.map +1 -0
  373. package/src/lib/hooks/use-media-asset-facts-overlay.d.ts +43 -0
  374. package/src/lib/hooks/use-media-asset-facts-overlay.js +133 -0
  375. package/src/lib/hooks/use-media-asset-facts-overlay.js.map +1 -0
  376. package/src/lib/hooks/use-move-node-callbacks.d.ts +22 -0
  377. package/src/lib/hooks/use-move-node-callbacks.js +57 -0
  378. package/src/lib/hooks/use-move-node-callbacks.js.map +1 -0
  379. package/src/lib/hooks/use-node-with-host-tokens.d.ts +42 -0
  380. package/src/lib/hooks/use-node-with-host-tokens.js +59 -0
  381. package/src/lib/hooks/use-node-with-host-tokens.js.map +1 -0
  382. package/src/lib/hooks/use-picker-filter.d.ts +61 -0
  383. package/src/lib/hooks/use-picker-filter.js +122 -0
  384. package/src/lib/hooks/use-picker-filter.js.map +1 -0
  385. package/src/lib/hooks/use-repeat-preview.d.ts +64 -0
  386. package/src/lib/hooks/use-repeat-preview.js +214 -0
  387. package/src/lib/hooks/use-repeat-preview.js.map +1 -0
  388. package/src/lib/hooks/use-repeat-sources.d.ts +17 -0
  389. package/src/lib/hooks/use-repeat-sources.js +41 -0
  390. package/src/lib/hooks/use-repeat-sources.js.map +1 -0
  391. package/src/lib/hooks/use-visible-component-categories.d.ts +37 -0
  392. package/src/lib/hooks/use-visible-component-categories.js +79 -0
  393. package/src/lib/hooks/use-visible-component-categories.js.map +1 -0
  394. package/src/lib/utils/active-host-theme.d.ts +28 -0
  395. package/src/lib/utils/active-host-theme.js +77 -0
  396. package/src/lib/utils/active-host-theme.js.map +1 -0
  397. package/src/lib/utils/attr-target.d.ts +170 -0
  398. package/src/lib/utils/attr-target.js +229 -0
  399. package/src/lib/utils/attr-target.js.map +1 -0
  400. package/src/lib/utils/attribute-field-value.d.ts +21 -0
  401. package/src/lib/utils/attribute-field-value.js +28 -0
  402. package/src/lib/utils/attribute-field-value.js.map +1 -0
  403. package/src/lib/utils/canvas-context-menu.d.ts +28 -0
  404. package/src/lib/utils/canvas-context-menu.js +56 -0
  405. package/src/lib/utils/canvas-context-menu.js.map +1 -0
  406. package/src/lib/utils/canvas-reveal.d.ts +115 -0
  407. package/src/lib/utils/canvas-reveal.js +165 -0
  408. package/src/lib/utils/canvas-reveal.js.map +1 -0
  409. package/src/lib/utils/describe-element.d.ts +72 -0
  410. package/src/lib/utils/describe-element.js +159 -0
  411. package/src/lib/utils/describe-element.js.map +1 -0
  412. package/src/lib/utils/device-preview-styles.d.ts +89 -0
  413. package/src/lib/utils/device-preview-styles.js +228 -0
  414. package/src/lib/utils/device-preview-styles.js.map +1 -0
  415. package/src/lib/utils/docs-help.d.ts +22 -0
  416. package/src/lib/utils/docs-help.generated.d.ts +47 -0
  417. package/src/lib/utils/docs-help.generated.js +229 -0
  418. package/src/lib/utils/docs-help.generated.js.map +1 -0
  419. package/src/lib/utils/docs-help.js +37 -0
  420. package/src/lib/utils/docs-help.js.map +1 -0
  421. package/src/lib/utils/held-answers-store.d.ts +59 -0
  422. package/src/lib/utils/held-answers-store.js +94 -0
  423. package/src/lib/utils/held-answers-store.js.map +1 -0
  424. package/src/lib/utils/in-place-edit-surface.d.ts +118 -0
  425. package/src/lib/utils/in-place-edit-surface.js +164 -0
  426. package/src/lib/utils/in-place-edit-surface.js.map +1 -0
  427. package/src/lib/utils/inline-markdown-edit.store.d.ts +71 -0
  428. package/src/lib/utils/inline-markdown-edit.store.js +90 -0
  429. package/src/lib/utils/inline-markdown-edit.store.js.map +1 -0
  430. package/src/lib/utils/inline-text-edit.store.d.ts +85 -0
  431. package/src/lib/utils/inline-text-edit.store.js +78 -0
  432. package/src/lib/utils/inline-text-edit.store.js.map +1 -0
  433. package/src/lib/utils/instance-leaf-hit.d.ts +39 -0
  434. package/src/lib/utils/instance-leaf-hit.js +56 -0
  435. package/src/lib/utils/instance-leaf-hit.js.map +1 -0
  436. package/src/lib/utils/muted-classes.d.ts +76 -0
  437. package/src/lib/utils/muted-classes.js +108 -0
  438. package/src/lib/utils/muted-classes.js.map +1 -0
  439. package/src/lib/utils/muted-styles.d.ts +125 -0
  440. package/src/lib/utils/muted-styles.js +193 -0
  441. package/src/lib/utils/muted-styles.js.map +1 -0
  442. package/src/lib/utils/numeric-text-value.d.ts +42 -0
  443. package/src/lib/utils/numeric-text-value.js +47 -0
  444. package/src/lib/utils/numeric-text-value.js.map +1 -0
  445. package/src/lib/utils/preset-interactions.d.ts +37 -0
  446. package/src/lib/utils/preset-interactions.js +87 -0
  447. package/src/lib/utils/preset-interactions.js.map +1 -0
  448. package/src/lib/utils/publish-failure-message.d.ts +35 -0
  449. package/src/lib/utils/publish-failure-message.js +51 -0
  450. package/src/lib/utils/publish-failure-message.js.map +1 -0
  451. package/src/lib/utils/rank-picker-results.d.ts +45 -0
  452. package/src/lib/utils/rank-picker-results.js +136 -0
  453. package/src/lib/utils/rank-picker-results.js.map +1 -0
  454. package/src/lib/utils/responsive-sx.d.ts +65 -0
  455. package/src/lib/utils/responsive-sx.js +129 -0
  456. package/src/lib/utils/responsive-sx.js.map +1 -0
  457. package/src/lib/utils/rich-text-commands.d.ts +28 -0
  458. package/src/lib/utils/rich-text-commands.js +43 -0
  459. package/src/lib/utils/rich-text-commands.js.map +1 -0
  460. package/src/lib/utils/sanitize-rich-text.d.ts +52 -0
  461. package/src/lib/utils/sanitize-rich-text.js +173 -0
  462. package/src/lib/utils/sanitize-rich-text.js.map +1 -0
  463. package/src/lib/utils/state-sx.d.ts +255 -0
  464. package/src/lib/utils/state-sx.js +338 -0
  465. package/src/lib/utils/state-sx.js.map +1 -0
  466. package/src/lib/utils/style-field-groups.d.ts +136 -0
  467. package/src/lib/utils/style-field-groups.js +874 -0
  468. package/src/lib/utils/style-field-groups.js.map +1 -0
  469. package/src/lib/utils/style-field-search.d.ts +84 -0
  470. package/src/lib/utils/style-field-search.js +505 -0
  471. package/src/lib/utils/style-field-search.js.map +1 -0
  472. package/src/lib/utils/style-target.d.ts +69 -0
  473. package/src/lib/utils/style-target.js +203 -0
  474. package/src/lib/utils/style-target.js.map +1 -0
  475. package/src/lib/utils/theme-scale-options.d.ts +169 -0
  476. package/src/lib/utils/theme-scale-options.js +702 -0
  477. package/src/lib/utils/theme-scale-options.js.map +1 -0
  478. package/src/lib/utils/token-editable-dom.d.ts +82 -0
  479. package/src/lib/utils/token-editable-dom.js +280 -0
  480. package/src/lib/utils/token-editable-dom.js.map +1 -0
  481. package/src/lib/utils/token-segments.d.ts +111 -0
  482. package/src/lib/utils/token-segments.js +246 -0
  483. package/src/lib/utils/token-segments.js.map +1 -0
  484. package/src/lib/utils/visibility-styles.d.ts +38 -0
  485. package/src/lib/utils/visibility-styles.js +54 -0
  486. package/src/lib/utils/visibility-styles.js.map +1 -0
@@ -0,0 +1,383 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2023 Aglyn LLC
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */ import { _ as _extends } from "@swc/helpers/_/_extends";
17
+ import { canvas, FEATURE_FLAG, getInstanceEffectivePropText, inheritedMediaAlt, resolveInstanceLeafBinding, REUSABLE_INSTANCE_COMPONENT_ID, REUSABLE_INSTANCE_PROP_VALUES_KEY } from "@aglyn/aglyn";
18
+ import * as Besigner from "@aglyn/besigner";
19
+ import { mergeRefs, useId } from "@aglyn/shared-ui-jsx";
20
+ import { useDraggable, useDroppable } from "@dnd-kit/core";
21
+ import { CSS as css } from "@dnd-kit/utilities";
22
+ import { mergeProps } from "@react-aria/utils";
23
+ import { observer } from "mobx-react-lite";
24
+ import { Children, cloneElement, useContext, useEffect, useRef } from "react";
25
+ import ComponentPromotionContext from "../../contexts/component-promotion-context.js";
26
+ import { MediaPickerContext } from "../../contexts/media-picker-context.js";
27
+ import { findMarkdownAttributeName, inlineMarkdownEdit } from "../../utils/inline-markdown-edit.store.js";
28
+ import { inlineTextEdit, isInlineEditWithin } from "../../utils/inline-text-edit.store.js";
29
+ import { requestCanvasContextMenu } from "../../utils/canvas-context-menu.js";
30
+ import { findInstanceLeafAtPoint } from "../../utils/instance-leaf-hit.js";
31
+ import { findLeafTextElement } from "../../utils/in-place-edit-surface.js";
32
+ export const DraggableDroppable = observer((props)=>{
33
+ const { node, type, disableDragging, disableDropping, accept, children, idSuffix } = props;
34
+ const id = useId(node == null ? void 0 : node.$id);
35
+ const draggable = useDraggable({
36
+ id: `${id}:${type}${idSuffix || ''}`,
37
+ data: {
38
+ type,
39
+ node
40
+ },
41
+ disabled: disableDragging
42
+ });
43
+ const droppable = useDroppable({
44
+ id: `${id}:${type}${idSuffix || ''}`,
45
+ data: {
46
+ type,
47
+ node,
48
+ accept
49
+ },
50
+ disabled: disableDropping
51
+ });
52
+ const transform = draggable.transform;
53
+ const isTransforming = Boolean(draggable.transform);
54
+ const child = Children.only(children);
55
+ const style = _extends({}, child.props.style, {
56
+ // cursor: 'move',
57
+ outlineWidth: 2,
58
+ outlineOffset: -1,
59
+ outlineColor: 'grey',
60
+ outlineStyle: 'dotted',
61
+ // transform: css.Transform.toString(transform),
62
+ // scale: css.Scale.toString(transform),
63
+ translate: css.Translate.toString(transform)
64
+ }, isTransforming ? {
65
+ } : {}, droppable.isOver ? {
66
+ outlineColor: 'lime',
67
+ outlineStyle: 'solid',
68
+ outlineOffset: '3'
69
+ } : {}, draggable.isDragging ? {
70
+ outlineColor: 'grey',
71
+ outlineStyle: 'double',
72
+ outlineOffset: -1,
73
+ opacity: 0.5,
74
+ cursor: 'move'
75
+ } : {}, Besigner.pick.isPicking() ? {
76
+ cursor: 'crosshair'
77
+ } : {}, Besigner.pick.isPicking() && Besigner.focus.isNodeHovered(node) ? {
78
+ outlineColor: '#7c4dff',
79
+ outlineStyle: 'solid',
80
+ outlineWidth: 2,
81
+ outlineOffset: 2
82
+ } : {});
83
+ const ref = useRef(null);
84
+ // Instance-internals double-click (AGL-1304) needs the component
85
+ // definitions (hit-test) and the host's media picker (image props).
86
+ // Read through a ref so the listener effect below keeps its `[node]`
87
+ // dependency — context updates must not re-register DOM listeners.
88
+ const { definitions } = useContext(ComponentPromotionContext);
89
+ const { onPickMedia } = useContext(MediaPickerContext);
90
+ const instanceEditRef = useRef({
91
+ definitions,
92
+ onPickMedia
93
+ });
94
+ instanceEditRef.current = {
95
+ definitions,
96
+ onPickMedia
97
+ };
98
+ useEffect(()=>{
99
+ Besigner.refs.set(node.$id, ref);
100
+ return ()=>{
101
+ Besigner.refs.delete(node.$id);
102
+ };
103
+ }, [
104
+ node == null ? void 0 : node.$id
105
+ ]);
106
+ useEffect(()=>{
107
+ Besigner.handles.set(node.$id, _extends({}, draggable.listeners, {
108
+ style: isTransforming ? {
109
+ cursor: 'grab'
110
+ } : {
111
+ cursor: 'move'
112
+ }
113
+ }));
114
+ return ()=>{
115
+ Besigner.handles.delete(node.$id);
116
+ };
117
+ }, [
118
+ node.$id,
119
+ draggable.listeners,
120
+ isTransforming
121
+ ]);
122
+ useEffect(()=>{
123
+ const el = ref.current;
124
+ if (el) {
125
+ el.addEventListener('mouseover', handleMouseOver);
126
+ el.addEventListener('pointerover', handleMouseOver);
127
+ el.addEventListener('mousedown', handleMouseDown);
128
+ el.addEventListener('pointerdown', handleMouseDown);
129
+ el.addEventListener('dblclick', handleDoubleClick);
130
+ el.addEventListener('contextmenu', handleContextMenu);
131
+ return ()=>{
132
+ el.removeEventListener('mouseover', handleMouseOver);
133
+ el.removeEventListener('pointerover', handleMouseOver);
134
+ el.removeEventListener('mousedown', handleMouseDown);
135
+ el.removeEventListener('pointerdown', handleMouseDown);
136
+ el.removeEventListener('dblclick', handleDoubleClick);
137
+ el.removeEventListener('contextmenu', handleContextMenu);
138
+ };
139
+ }
140
+ /**
141
+ * Right-click opens this element's ⋮ menu (AGL-1405).
142
+ *
143
+ * A native listener like its neighbours, not an `onContextMenu` prop:
144
+ * React delegates at the root container and the canvas is a closed
145
+ * shadow root, so a delegated handler never sees the event.
146
+ *
147
+ * Selects first. The menu is rendered by the overlay, which only mounts
148
+ * for a selected or hovered node — and right-clicking an element is a
149
+ * statement about THAT element, so leaving the previous selection in
150
+ * place would open the wrong menu.
151
+ */ function handleContextMenu(e) {
152
+ if (isInlineEditWithin(el)) {
153
+ // An open text editor keeps the browser's own menu: cut, paste and
154
+ // spellcheck are the whole point of a right-click there.
155
+ e.stopPropagation();
156
+ return;
157
+ }
158
+ e.preventDefault();
159
+ e.stopPropagation();
160
+ Besigner.focus.setSelectedNode(node);
161
+ requestCanvasContextMenu(node == null ? void 0 : node.$id);
162
+ }
163
+ function handleMouseOver(e) {
164
+ // Same stand-down, same reason to consume it: a hover repaint while
165
+ // the author is typing is a re-render of the subtree they are
166
+ // editing, and an ancestor leaf would repaint for them instead.
167
+ if (isInlineEditWithin(el)) {
168
+ e.stopPropagation();
169
+ return;
170
+ }
171
+ e.preventDefault();
172
+ e.stopPropagation();
173
+ Besigner.focus.setHoveredNode(node);
174
+ }
175
+ function handleMouseDown(e) {
176
+ // Stand down while an edit is open in this leaf OR ANY LEAF INSIDE
177
+ // IT (AGL-2486) — but CONSUME the event rather than ignoring it.
178
+ //
179
+ // Two different mistakes produced the same symptom, an editor that
180
+ // was open, styled and completely uninteractive. First, asking only
181
+ // "is this leaf the node being edited?": a nested run — a Span
182
+ // typography inside a Typography — silenced its OWN leaf, the event
183
+ // bubbled to the ancestor leaf, and the ancestor called the
184
+ // `preventDefault` that suppresses caret placement. Second, standing
185
+ // down by simply returning: that also skipped `stopPropagation`, so
186
+ // the gesture carried on up to the viewport, which treats a
187
+ // mousedown on empty canvas as a deselect — and moving the selection
188
+ // off the node closes the editor. A drag meant to select three words
189
+ // tore the editor down instead.
190
+ //
191
+ // So: no `preventDefault`, because that is the caret; but still
192
+ // `stopPropagation`, because nothing else on this canvas should see
193
+ // a gesture aimed at text being edited. `stopPropagation` does not
194
+ // suppress a default action, only delivery.
195
+ if (isInlineEditWithin(el)) {
196
+ e.stopPropagation();
197
+ return;
198
+ }
199
+ e.preventDefault();
200
+ e.stopPropagation();
201
+ // Element-picker capture (AGL-574): while the interaction builder is
202
+ // picking, this click resolves the target and exits pick mode —
203
+ // never the normal select/navigate, so the designer's selection and
204
+ // the open interaction stay put.
205
+ if (Besigner.pick.isPicking()) {
206
+ Besigner.pick.handlePickClick(node.$id);
207
+ return;
208
+ }
209
+ // Canvas multi-selection modifiers (AGL-12), mirroring the
210
+ // hierarchy panel: Shift ranges, Cmd/Ctrl toggles.
211
+ const pointer = e;
212
+ if (pointer.shiftKey) {
213
+ Besigner.focus.rangeSelectNode(node);
214
+ } else {
215
+ Besigner.focus.handleNodeSelection(node, pointer.metaKey || pointer.ctrlKey);
216
+ }
217
+ }
218
+ function handleDoubleClick(e) {
219
+ var _node_componentSchema_flags, _node_componentSchema, _node_props;
220
+ // Prop-fed instance internals (AGL-1304): the rendered preview sits
221
+ // under `pointer-events: none`, so the double-click lands HERE, on
222
+ // the instance — hit-test the preview geometrically, map the grafted
223
+ // leaf back to the definition, and if a declared prop feeds it, edit
224
+ // that prop inline. Leaves the component owns stay locked (the
225
+ // selection this dblclick's mousedowns already made puts AGL-1303's
226
+ // "Edit component" in the panel — nothing extra to build).
227
+ if ((node == null ? void 0 : node.componentId) === REUSABLE_INSTANCE_COMPONENT_ID && Besigner.dnd.canDragNode(node)) {
228
+ if (handleInstanceDoubleClick(e)) {
229
+ e.preventDefault();
230
+ e.stopPropagation();
231
+ }
232
+ return;
233
+ }
234
+ // Locked nodes (layout chrome in the screen besigner) stay read-only —
235
+ // same gate the drag system uses — and while the interaction builder
236
+ // is picking a target, a double-click is two picks, never an edit.
237
+ if (!Besigner.dnd.canDragNode(node) || Besigner.pick.isPicking()) return;
238
+ // Inline text editing for components that declare textEditable.
239
+ const flag = node == null ? void 0 : (_node_componentSchema = node.componentSchema) == null ? void 0 : (_node_componentSchema_flags = _node_componentSchema.flags) == null ? void 0 : _node_componentSchema_flags.textEditable;
240
+ const editable = typeof flag === 'number' && (flag & FEATURE_FLAG.ENABLED) !== 0;
241
+ if (editable) {
242
+ var _findLeafTextElement;
243
+ e.preventDefault();
244
+ e.stopPropagation();
245
+ const root = e.currentTarget;
246
+ // The node's own `<aglyn-text>` whenever it renders one, and the
247
+ // root only as a fallback (AGL-2556). In-place editing EMPTIES
248
+ // whatever it is given, so handing it a composite's root deletes
249
+ // the chrome that composite built — for Accordion Summary that is
250
+ // the content div carrying MUI's `textAlign: 'start'`, without
251
+ // which the UA stylesheet centres the label inside the `<button>`
252
+ // for as long as the edit is open.
253
+ const element = (_findLeafTextElement = findLeafTextElement(root)) != null ? _findLeafTextElement : root;
254
+ const rect = element.getBoundingClientRect();
255
+ inlineTextEdit.open(node, {
256
+ left: rect.left,
257
+ top: rect.top,
258
+ width: rect.width,
259
+ height: rect.height
260
+ }, undefined, // The measured element travels with the rect so the overlay can
261
+ // re-measure on scroll instead of drifting (AGL-1644).
262
+ element);
263
+ return;
264
+ }
265
+ // In-place markdown editing (AGL-1624): a component whose schema
266
+ // declares a MARKDOWN attribute — the Markdown element's `content` is
267
+ // the one that exists — opens the WYSIWYG over the element, editing
268
+ // the whole document without a trip to the attributes panel.
269
+ //
270
+ // `stopPropagation` on the NATIVE event is what keeps the canvas still:
271
+ // React delegates `onDoubleClick` at the root container, so an event
272
+ // consumed here never reaches `ZoomablePanningComponent`'s
273
+ // double-click-to-zoom. That is the same guarantee the textEditable
274
+ // branch above has always relied on, not a new mechanism.
275
+ const markdownAttribute = findMarkdownAttributeName(node);
276
+ if (!markdownAttribute) return;
277
+ e.preventDefault();
278
+ e.stopPropagation();
279
+ const markdownElement = e.currentTarget;
280
+ const markdownRect = markdownElement.getBoundingClientRect();
281
+ const stored = (_node_props = node.props) == null ? void 0 : _node_props[markdownAttribute];
282
+ // The two mousedowns of a double-click TOGGLE selection, so by the time
283
+ // this fires the node has been selected and then deselected again.
284
+ // Editing an element is selecting it — the attributes panel should be
285
+ // showing it — and the editor closes when the selection moves off the
286
+ // node, so it has to be put back before the editor opens.
287
+ Besigner.focus.setSelectedNode(node);
288
+ inlineMarkdownEdit.open(node, {
289
+ left: markdownRect.left,
290
+ top: markdownRect.top,
291
+ width: markdownRect.width,
292
+ height: markdownRect.height
293
+ }, markdownAttribute, typeof stored === 'string' ? stored : '', markdownElement);
294
+ }
295
+ /** True when the double-click resolved to a prop edit it opened. */ function handleInstanceDoubleClick(pointer) {
296
+ var _node_props;
297
+ const { definitions, onPickMedia } = instanceEditRef.current;
298
+ const refId = node == null ? void 0 : (_node_props = node.props) == null ? void 0 : _node_props.refId;
299
+ const definition = refId ? definitions == null ? void 0 : definitions[refId] : undefined;
300
+ const container = ref.current;
301
+ if (!definition || !container) return false;
302
+ const hit = findInstanceLeafAtPoint(container, pointer.clientX, pointer.clientY);
303
+ if (!hit) return false;
304
+ // Text first: a leaf whose `children` a declared prop feeds opens
305
+ // the EXISTING inline editor, anchored on the clicked leaf, and the
306
+ // commit writes propValues[prop] on the instance (one undo entry,
307
+ // mirrored to peers like any node edit).
308
+ const text = resolveInstanceLeafBinding(hit.graftedId, node.$id, definition);
309
+ if (text == null ? void 0 : text.boundProp) {
310
+ const rect = hit.element.getBoundingClientRect();
311
+ inlineTextEdit.open(node, {
312
+ left: rect.left,
313
+ top: rect.top,
314
+ width: rect.width,
315
+ height: rect.height
316
+ }, {
317
+ propName: text.boundProp,
318
+ initialText: getInstanceEffectivePropText(node.props, definition.props, text.boundProp)
319
+ }, // The GRAFTED leaf, not the instance node: it is what was measured,
320
+ // and it is the one anchor `Besigner.refs` could never supply
321
+ // because it is not a canvas node (AGL-1644).
322
+ hit.element);
323
+ return true;
324
+ }
325
+ // Image half: `src` fed by a declared prop opens the host's media
326
+ // picker, committing the picked value to the same propValues slot —
327
+ // the exact pipeline the Attributes panel's Browse button uses.
328
+ const src = resolveInstanceLeafBinding(hit.graftedId, node.$id, definition, 'src');
329
+ if ((src == null ? void 0 : src.boundProp) && onPickMedia) {
330
+ const propName = src.boundProp;
331
+ // The SAME leaf's `alt`, if the component author bound one to a
332
+ // declared prop too (AGL-1896). Resolvable here and nowhere else
333
+ // in the instance pipeline: this path starts from a concrete leaf
334
+ // in the definition tree, so "which declared prop feeds this
335
+ // image's alt" is a lookup rather than a guess. The attributes
336
+ // panel only ever sees a declared prop's NAME, and no convention
337
+ // says which other prop is its alt — so it does not try.
338
+ const altBinding = resolveInstanceLeafBinding(hit.graftedId, node.$id, definition, 'alt');
339
+ onPickMedia((value, asset)=>{
340
+ var _current_props;
341
+ // Written through verbatim (media reference or raw URL — the
342
+ // host app decides; AGL-1215). Snapshot via toJSON like the
343
+ // panel: updateNodeProps REPLACES the props object.
344
+ const current = canvas.toJSON().nodes[node.$id];
345
+ // What the instance renders for the alt prop TODAY — its own
346
+ // override, else the component's default. Not the raw override:
347
+ // a component whose default alt is already a real sentence must
348
+ // not have it replaced just because this instance never set one.
349
+ const altPropName = altBinding == null ? void 0 : altBinding.boundProp;
350
+ const effectiveAlt = altPropName ? getInstanceEffectivePropText(current == null ? void 0 : current.props, definition.props, altPropName) : undefined;
351
+ const inheritedAlt = altPropName ? inheritedMediaAlt({
352
+ placementAlt: effectiveAlt,
353
+ assetAlt: asset == null ? void 0 : asset.alt
354
+ }) : undefined;
355
+ canvas.updateNodeProps(node, _extends({}, current == null ? void 0 : current.props, {
356
+ [REUSABLE_INSTANCE_PROP_VALUES_KEY]: _extends({}, current == null ? void 0 : (_current_props = current.props) == null ? void 0 : _current_props[REUSABLE_INSTANCE_PROP_VALUES_KEY], {
357
+ [propName]: value
358
+ }, inheritedAlt && altPropName ? {
359
+ [altPropName]: inheritedAlt
360
+ } : {})
361
+ }));
362
+ });
363
+ return true;
364
+ }
365
+ return false;
366
+ }
367
+ }, [
368
+ node
369
+ ]);
370
+ return /*#__PURE__*/ cloneElement(child, mergeProps(child.props, draggable.attributes, {
371
+ ref: mergeRefs(ref, child.props.ref, draggable.setNodeRef, droppable.setNodeRef),
372
+ style,
373
+ sx: {
374
+ '&, &:hover, &:focus': {
375
+ cursor: draggable.isDragging ? 'move' : 'initial'
376
+ }
377
+ }
378
+ }));
379
+ });
380
+ DraggableDroppable.displayName = 'DraggableDroppable';
381
+ export default DraggableDroppable;
382
+
383
+ //# sourceMappingURL=draggable-droppable.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../../../../../libs/besigner/feature/designer/src/lib/components/dnd/draggable-droppable.tsx"],"sourcesContent":["/**\n * @license\n * Copyright 2023 Aglyn LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type * as Aglyn from '@aglyn/aglyn'\nimport {\n canvas,\n FEATURE_FLAG,\n getInstanceEffectivePropText,\n inheritedMediaAlt,\n resolveInstanceLeafBinding,\n REUSABLE_INSTANCE_COMPONENT_ID,\n REUSABLE_INSTANCE_PROP_VALUES_KEY,\n} from '@aglyn/aglyn'\nimport * as Besigner from '@aglyn/besigner'\nimport { mergeRefs, useId } from '@aglyn/shared-ui-jsx'\nimport { useDraggable, useDroppable } from '@dnd-kit/core'\nimport { CSS as css } from '@dnd-kit/utilities'\nimport { mergeProps } from '@react-aria/utils'\nimport { observer } from 'mobx-react-lite'\nimport {\n Children,\n cloneElement,\n CSSProperties,\n useContext,\n useEffect,\n useRef,\n} from 'react'\nimport ComponentPromotionContext from '../../contexts/component-promotion-context'\nimport { MediaPickerContext } from '../../contexts/media-picker-context'\nimport {\n findMarkdownAttributeName,\n inlineMarkdownEdit,\n} from '../../utils/inline-markdown-edit.store'\nimport {\n inlineTextEdit,\n isInlineEditWithin,\n} from '../../utils/inline-text-edit.store'\nimport { requestCanvasContextMenu } from '../../utils/canvas-context-menu'\nimport { findInstanceLeafAtPoint } from '../../utils/instance-leaf-hit'\nimport { findLeafTextElement } from '../../utils/in-place-edit-surface'\n\nexport interface DraggableDroppableProps<T extends Aglyn.NodeSchema<any>> {\n children: JSX.Element\n node: T\n type: Besigner.DragType\n accept: Besigner.DragType[]\n disableDragging?: boolean\n disableDropping?: boolean\n idSuffix?: string\n}\n\nexport const DraggableDroppable = observer(\n <T extends Aglyn.NodeSchema<any>>(props: DraggableDroppableProps<T>) => {\n const {\n node,\n type,\n disableDragging,\n disableDropping,\n accept,\n children,\n idSuffix,\n } = props\n const id = useId(node?.$id)\n\n const draggable = useDraggable({\n id: `${id}:${type}${idSuffix || ''}`,\n data: { type, node },\n disabled: disableDragging,\n })\n\n const droppable = useDroppable({\n id: `${id}:${type}${idSuffix || ''}`,\n data: { type, node, accept },\n disabled: disableDropping,\n })\n\n const transform = draggable.transform\n const isTransforming = Boolean(draggable.transform)\n const child = Children.only(children)\n const style: CSSProperties = {\n ...child.props.style,\n // cursor: 'move',\n outlineWidth: 2,\n outlineOffset: -1,\n outlineColor: 'grey',\n outlineStyle: 'dotted',\n // transform: css.Transform.toString(transform),\n // scale: css.Scale.toString(transform),\n translate: css.Translate.toString(transform),\n\n ...(isTransforming\n ? {\n // transform: `translate3d(${transform.x}px, ${transform.y}px, 0)`,\n // cursor: 'grab',\n }\n : {}),\n ...(droppable.isOver\n ? {\n outlineColor: 'lime',\n outlineStyle: 'solid',\n outlineOffset: '3',\n }\n : {}),\n ...(draggable.isDragging\n ? {\n outlineColor: 'grey',\n outlineStyle: 'double',\n outlineOffset: -1 as any,\n opacity: 0.5,\n cursor: 'move',\n }\n : {}),\n // Element-picker affordance (AGL-574): while the interaction builder\n // is picking a target, every leaf shows the crosshair and the hovered\n // one gets a distinct violet ring — deliberately unlike the normal\n // selection/drop outlines so \"pick this\" reads as its own mode.\n ...(Besigner.pick.isPicking() ? { cursor: 'crosshair' } : {}),\n ...(Besigner.pick.isPicking() && Besigner.focus.isNodeHovered(node)\n ? {\n outlineColor: '#7c4dff',\n outlineStyle: 'solid',\n outlineWidth: 2,\n outlineOffset: 2 as any,\n }\n : {}),\n }\n\n const ref = useRef<HTMLElement>(null)\n\n // Instance-internals double-click (AGL-1304) needs the component\n // definitions (hit-test) and the host's media picker (image props).\n // Read through a ref so the listener effect below keeps its `[node]`\n // dependency — context updates must not re-register DOM listeners.\n const { definitions } = useContext(ComponentPromotionContext)\n const { onPickMedia } = useContext(MediaPickerContext)\n const instanceEditRef = useRef({ definitions, onPickMedia })\n instanceEditRef.current = { definitions, onPickMedia }\n\n useEffect(() => {\n Besigner.refs.set(node.$id, ref)\n return () => {\n Besigner.refs.delete(node.$id)\n }\n }, [node?.$id])\n\n useEffect(() => {\n Besigner.handles.set(node.$id, {\n ...draggable.listeners,\n style: isTransforming ? { cursor: 'grab' } : { cursor: 'move' },\n })\n return () => {\n Besigner.handles.delete(node.$id)\n }\n }, [node.$id, draggable.listeners, isTransforming])\n\n useEffect(() => {\n const el = ref.current\n if (el) {\n el.addEventListener('mouseover', handleMouseOver)\n el.addEventListener('pointerover', handleMouseOver)\n el.addEventListener('mousedown', handleMouseDown)\n el.addEventListener('pointerdown', handleMouseDown)\n el.addEventListener('dblclick', handleDoubleClick)\n el.addEventListener('contextmenu', handleContextMenu)\n\n return () => {\n el.removeEventListener('mouseover', handleMouseOver)\n el.removeEventListener('pointerover', handleMouseOver)\n el.removeEventListener('mousedown', handleMouseDown)\n el.removeEventListener('pointerdown', handleMouseDown)\n el.removeEventListener('dblclick', handleDoubleClick)\n el.removeEventListener('contextmenu', handleContextMenu)\n }\n }\n /**\n * Right-click opens this element's ⋮ menu (AGL-1405).\n *\n * A native listener like its neighbours, not an `onContextMenu` prop:\n * React delegates at the root container and the canvas is a closed\n * shadow root, so a delegated handler never sees the event.\n *\n * Selects first. The menu is rendered by the overlay, which only mounts\n * for a selected or hovered node — and right-clicking an element is a\n * statement about THAT element, so leaving the previous selection in\n * place would open the wrong menu.\n */\n function handleContextMenu(e: Event) {\n if (isInlineEditWithin(el)) {\n // An open text editor keeps the browser's own menu: cut, paste and\n // spellcheck are the whole point of a right-click there.\n e.stopPropagation()\n return\n }\n e.preventDefault()\n e.stopPropagation()\n Besigner.focus.setSelectedNode(node)\n requestCanvasContextMenu(node?.$id)\n }\n function handleMouseOver(e: Event) {\n // Same stand-down, same reason to consume it: a hover repaint while\n // the author is typing is a re-render of the subtree they are\n // editing, and an ancestor leaf would repaint for them instead.\n if (isInlineEditWithin(el)) {\n e.stopPropagation()\n return\n }\n e.preventDefault()\n e.stopPropagation()\n Besigner.focus.setHoveredNode(node)\n }\n function handleMouseDown(e: Event) {\n // Stand down while an edit is open in this leaf OR ANY LEAF INSIDE\n // IT (AGL-2486) — but CONSUME the event rather than ignoring it.\n //\n // Two different mistakes produced the same symptom, an editor that\n // was open, styled and completely uninteractive. First, asking only\n // \"is this leaf the node being edited?\": a nested run — a Span\n // typography inside a Typography — silenced its OWN leaf, the event\n // bubbled to the ancestor leaf, and the ancestor called the\n // `preventDefault` that suppresses caret placement. Second, standing\n // down by simply returning: that also skipped `stopPropagation`, so\n // the gesture carried on up to the viewport, which treats a\n // mousedown on empty canvas as a deselect — and moving the selection\n // off the node closes the editor. A drag meant to select three words\n // tore the editor down instead.\n //\n // So: no `preventDefault`, because that is the caret; but still\n // `stopPropagation`, because nothing else on this canvas should see\n // a gesture aimed at text being edited. `stopPropagation` does not\n // suppress a default action, only delivery.\n if (isInlineEditWithin(el)) {\n e.stopPropagation()\n return\n }\n e.preventDefault()\n e.stopPropagation()\n // Element-picker capture (AGL-574): while the interaction builder is\n // picking, this click resolves the target and exits pick mode —\n // never the normal select/navigate, so the designer's selection and\n // the open interaction stay put.\n if (Besigner.pick.isPicking()) {\n Besigner.pick.handlePickClick(node.$id)\n return\n }\n // Canvas multi-selection modifiers (AGL-12), mirroring the\n // hierarchy panel: Shift ranges, Cmd/Ctrl toggles.\n const pointer = e as globalThis.MouseEvent\n if (pointer.shiftKey) {\n Besigner.focus.rangeSelectNode(node)\n } else {\n Besigner.focus.handleNodeSelection(\n node,\n pointer.metaKey || pointer.ctrlKey,\n )\n }\n }\n function handleDoubleClick(e: Event) {\n // Prop-fed instance internals (AGL-1304): the rendered preview sits\n // under `pointer-events: none`, so the double-click lands HERE, on\n // the instance — hit-test the preview geometrically, map the grafted\n // leaf back to the definition, and if a declared prop feeds it, edit\n // that prop inline. Leaves the component owns stay locked (the\n // selection this dblclick's mousedowns already made puts AGL-1303's\n // \"Edit component\" in the panel — nothing extra to build).\n if (\n node?.componentId === REUSABLE_INSTANCE_COMPONENT_ID &&\n Besigner.dnd.canDragNode(node)\n ) {\n if (handleInstanceDoubleClick(e as globalThis.MouseEvent)) {\n e.preventDefault()\n e.stopPropagation()\n }\n return\n }\n // Locked nodes (layout chrome in the screen besigner) stay read-only —\n // same gate the drag system uses — and while the interaction builder\n // is picking a target, a double-click is two picks, never an edit.\n if (!Besigner.dnd.canDragNode(node) || Besigner.pick.isPicking()) return\n // Inline text editing for components that declare textEditable.\n const flag = node?.componentSchema?.flags?.textEditable\n const editable =\n typeof flag === 'number' && (flag & FEATURE_FLAG.ENABLED) !== 0\n if (editable) {\n e.preventDefault()\n e.stopPropagation()\n const root = e.currentTarget as Element\n // The node's own `<aglyn-text>` whenever it renders one, and the\n // root only as a fallback (AGL-2556). In-place editing EMPTIES\n // whatever it is given, so handing it a composite's root deletes\n // the chrome that composite built — for Accordion Summary that is\n // the content div carrying MUI's `textAlign: 'start'`, without\n // which the UA stylesheet centres the label inside the `<button>`\n // for as long as the edit is open.\n const element = findLeafTextElement(root) ?? root\n const rect = element.getBoundingClientRect()\n inlineTextEdit.open(\n node,\n {\n left: rect.left,\n top: rect.top,\n width: rect.width,\n height: rect.height,\n },\n undefined,\n // The measured element travels with the rect so the overlay can\n // re-measure on scroll instead of drifting (AGL-1644).\n element,\n )\n return\n }\n // In-place markdown editing (AGL-1624): a component whose schema\n // declares a MARKDOWN attribute — the Markdown element's `content` is\n // the one that exists — opens the WYSIWYG over the element, editing\n // the whole document without a trip to the attributes panel.\n //\n // `stopPropagation` on the NATIVE event is what keeps the canvas still:\n // React delegates `onDoubleClick` at the root container, so an event\n // consumed here never reaches `ZoomablePanningComponent`'s\n // double-click-to-zoom. That is the same guarantee the textEditable\n // branch above has always relied on, not a new mechanism.\n const markdownAttribute = findMarkdownAttributeName(node)\n if (!markdownAttribute) return\n e.preventDefault()\n e.stopPropagation()\n const markdownElement = e.currentTarget as Element\n const markdownRect = markdownElement.getBoundingClientRect()\n const stored = (node.props as Record<string, unknown> | undefined)?.[\n markdownAttribute\n ]\n // The two mousedowns of a double-click TOGGLE selection, so by the time\n // this fires the node has been selected and then deselected again.\n // Editing an element is selecting it — the attributes panel should be\n // showing it — and the editor closes when the selection moves off the\n // node, so it has to be put back before the editor opens.\n Besigner.focus.setSelectedNode(node)\n inlineMarkdownEdit.open(\n node,\n {\n left: markdownRect.left,\n top: markdownRect.top,\n width: markdownRect.width,\n height: markdownRect.height,\n },\n markdownAttribute,\n typeof stored === 'string' ? stored : '',\n markdownElement,\n )\n }\n /** True when the double-click resolved to a prop edit it opened. */\n function handleInstanceDoubleClick(pointer: globalThis.MouseEvent) {\n const { definitions, onPickMedia } = instanceEditRef.current\n const refId = (node?.props as { refId?: string } | undefined)?.refId\n const definition = refId ? definitions?.[refId] : undefined\n const container = ref.current\n if (!definition || !container) return false\n const hit = findInstanceLeafAtPoint(\n container,\n pointer.clientX,\n pointer.clientY,\n )\n if (!hit) return false\n // Text first: a leaf whose `children` a declared prop feeds opens\n // the EXISTING inline editor, anchored on the clicked leaf, and the\n // commit writes propValues[prop] on the instance (one undo entry,\n // mirrored to peers like any node edit).\n const text = resolveInstanceLeafBinding(\n hit.graftedId,\n node.$id,\n definition,\n )\n if (text?.boundProp) {\n const rect = hit.element.getBoundingClientRect()\n inlineTextEdit.open(\n node,\n {\n left: rect.left,\n top: rect.top,\n width: rect.width,\n height: rect.height,\n },\n {\n propName: text.boundProp,\n initialText: getInstanceEffectivePropText(\n node.props,\n definition.props,\n text.boundProp,\n ),\n },\n // The GRAFTED leaf, not the instance node: it is what was measured,\n // and it is the one anchor `Besigner.refs` could never supply\n // because it is not a canvas node (AGL-1644).\n hit.element,\n )\n return true\n }\n // Image half: `src` fed by a declared prop opens the host's media\n // picker, committing the picked value to the same propValues slot —\n // the exact pipeline the Attributes panel's Browse button uses.\n const src = resolveInstanceLeafBinding(\n hit.graftedId,\n node.$id,\n definition,\n 'src',\n )\n if (src?.boundProp && onPickMedia) {\n const propName = src.boundProp\n // The SAME leaf's `alt`, if the component author bound one to a\n // declared prop too (AGL-1896). Resolvable here and nowhere else\n // in the instance pipeline: this path starts from a concrete leaf\n // in the definition tree, so \"which declared prop feeds this\n // image's alt\" is a lookup rather than a guess. The attributes\n // panel only ever sees a declared prop's NAME, and no convention\n // says which other prop is its alt — so it does not try.\n const altBinding = resolveInstanceLeafBinding(\n hit.graftedId,\n node.$id,\n definition,\n 'alt',\n )\n onPickMedia((value, asset) => {\n // Written through verbatim (media reference or raw URL — the\n // host app decides; AGL-1215). Snapshot via toJSON like the\n // panel: updateNodeProps REPLACES the props object.\n const current = (canvas.toJSON().nodes as Record<string, any>)[\n node.$id\n ]\n // What the instance renders for the alt prop TODAY — its own\n // override, else the component's default. Not the raw override:\n // a component whose default alt is already a real sentence must\n // not have it replaced just because this instance never set one.\n const altPropName = altBinding?.boundProp\n const effectiveAlt = altPropName\n ? getInstanceEffectivePropText(\n current?.props,\n definition.props,\n altPropName,\n )\n : undefined\n const inheritedAlt = altPropName\n ? inheritedMediaAlt({\n placementAlt: effectiveAlt,\n assetAlt: asset?.alt,\n })\n : undefined\n canvas.updateNodeProps(node, {\n ...current?.props,\n [REUSABLE_INSTANCE_PROP_VALUES_KEY]: {\n ...current?.props?.[REUSABLE_INSTANCE_PROP_VALUES_KEY],\n [propName]: value,\n ...(inheritedAlt && altPropName\n ? { [altPropName]: inheritedAlt }\n : {}),\n },\n })\n })\n return true\n }\n return false\n }\n }, [node])\n\n return cloneElement(\n child,\n mergeProps(child.props, draggable.attributes, {\n ref: mergeRefs(\n ref,\n child.props.ref,\n draggable.setNodeRef,\n droppable.setNodeRef,\n ),\n style,\n sx: {\n '&, &:hover, &:focus': {\n cursor: draggable.isDragging ? 'move' : 'initial',\n },\n },\n }),\n )\n },\n)\n\nDraggableDroppable.displayName = 'DraggableDroppable'\n\nexport default DraggableDroppable\n"],"names":["canvas","FEATURE_FLAG","getInstanceEffectivePropText","inheritedMediaAlt","resolveInstanceLeafBinding","REUSABLE_INSTANCE_COMPONENT_ID","REUSABLE_INSTANCE_PROP_VALUES_KEY","Besigner","mergeRefs","useId","useDraggable","useDroppable","CSS","css","mergeProps","observer","Children","cloneElement","useContext","useEffect","useRef","ComponentPromotionContext","MediaPickerContext","findMarkdownAttributeName","inlineMarkdownEdit","inlineTextEdit","isInlineEditWithin","requestCanvasContextMenu","findInstanceLeafAtPoint","findLeafTextElement","DraggableDroppable","props","node","type","disableDragging","disableDropping","accept","children","idSuffix","id","$id","draggable","data","disabled","droppable","transform","isTransforming","Boolean","child","only","style","outlineWidth","outlineOffset","outlineColor","outlineStyle","translate","Translate","toString","isOver","isDragging","opacity","cursor","pick","isPicking","focus","isNodeHovered","ref","definitions","onPickMedia","instanceEditRef","current","refs","set","delete","handles","listeners","el","addEventListener","handleMouseOver","handleMouseDown","handleDoubleClick","handleContextMenu","removeEventListener","e","stopPropagation","preventDefault","setSelectedNode","setHoveredNode","handlePickClick","pointer","shiftKey","rangeSelectNode","handleNodeSelection","metaKey","ctrlKey","componentId","dnd","canDragNode","handleInstanceDoubleClick","flag","componentSchema","flags","textEditable","editable","ENABLED","root","currentTarget","element","rect","getBoundingClientRect","open","left","top","width","height","undefined","markdownAttribute","markdownElement","markdownRect","stored","refId","definition","container","hit","clientX","clientY","text","graftedId","boundProp","propName","initialText","src","altBinding","value","asset","toJSON","nodes","altPropName","effectiveAlt","inheritedAlt","placementAlt","assetAlt","alt","updateNodeProps","attributes","setNodeRef","sx","displayName"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC;AAGD,SACEA,MAAM,EACNC,YAAY,EACZC,4BAA4B,EAC5BC,iBAAiB,EACjBC,0BAA0B,EAC1BC,8BAA8B,EAC9BC,iCAAiC,QAC5B,eAAc;AACrB,YAAYC,cAAc,kBAAiB;AAC3C,SAASC,SAAS,EAAEC,KAAK,QAAQ,uBAAsB;AACvD,SAASC,YAAY,EAAEC,YAAY,QAAQ,gBAAe;AAC1D,SAASC,OAAOC,GAAG,QAAQ,qBAAoB;AAC/C,SAASC,UAAU,QAAQ,oBAAmB;AAC9C,SAASC,QAAQ,QAAQ,kBAAiB;AAC1C,SACEC,QAAQ,EACRC,YAAY,EAEZC,UAAU,EACVC,SAAS,EACTC,MAAM,QACD,QAAO;AACd,OAAOC,+BAA+B,gDAA4C;AAClF,SAASC,kBAAkB,QAAQ,yCAAqC;AACxE,SACEC,yBAAyB,EACzBC,kBAAkB,QACb,4CAAwC;AAC/C,SACEC,cAAc,EACdC,kBAAkB,QACb,wCAAoC;AAC3C,SAASC,wBAAwB,QAAQ,qCAAiC;AAC1E,SAASC,uBAAuB,QAAQ,mCAA+B;AACvE,SAASC,mBAAmB,QAAQ,uCAAmC;AAYvE,OAAO,MAAMC,qBAAqBf,SAChC,CAAkCgB;IAChC,MAAM,EACJC,IAAI,EACJC,IAAI,EACJC,eAAe,EACfC,eAAe,EACfC,MAAM,EACNC,QAAQ,EACRC,QAAQ,EACT,GAAGP;IACJ,MAAMQ,KAAK9B,MAAMuB,wBAAAA,KAAMQ,GAAG;IAE1B,MAAMC,YAAY/B,aAAa;QAC7B6B,IAA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S;oBACzC,MAAMU,eAAeD,cACjBvI,6BACEoE,2BAAAA,QAASvC,KAAK,EACd0F,WAAW1F,KAAK,EAChB0G,eAEFtB;oBACJ,MAAMwB,eAAeF,cACjBtI,kBAAkB;wBAChByI,cAAcF;wBACdG,QAAQ,EAAEP,yBAAAA,MAAOQ,GAAG;oBACtB,KACA3B;oBACJnH,OAAO+I,eAAe,CAAC/G,MAAM,aACxBsC,2BAAAA,QAASvC,KAAK;wBACjB,CAACzB,kCAAkC,EAAE,aAChCgE,4BAAAA,iBAAAA,QAASvC,KAAK,qBAAduC,cAAgB,CAAChE,kCAAkC;4BACtD,CAAC2H,SAAS,EAAEI;2BACRM,gBAAgBF,cAChB;4BAAE,CAACA,YAAY,EAAEE;wBAAa,IAC9B,CAAC;;gBAGX;gBACA,OAAO;YACT;YACA,OAAO;QACT;IACF,GAAG;QAAC3G;KAAK;IAET,qBAAOf,aACL+B,OACAlC,WAAWkC,MAAMjB,KAAK,EAAEU,UAAUuG,UAAU,EAAE;QAC5C9E,KAAK1D,UACH0D,KACAlB,MAAMjB,KAAK,CAACmC,GAAG,EACfzB,UAAUwG,UAAU,EACpBrG,UAAUqG,UAAU;QAEtB/F;QACAgG,IAAI;YACF,uBAAuB;gBACrBrF,QAAQpB,UAAUkB,UAAU,GAAG,SAAS;YAC1C;QACF;IACF;AAEJ,GACD;AAED7B,mBAAmBqH,WAAW,GAAG;AAEjC,eAAerH,mBAAkB"}
@@ -0,0 +1,42 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2023 Aglyn LLC
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ import * as Besigner from '@aglyn/besigner';
18
+ import { useDraggable } from '@dnd-kit/core';
19
+ import { CSSProperties, MutableRefObject } from 'react';
20
+ export interface DraggableChildProps<T extends {
21
+ $id?: string;
22
+ }> extends Omit<DraggableProps<T>, 'children'> {
23
+ draggable: ReturnType<typeof useDraggable>;
24
+ style: CSSProperties;
25
+ forwardRef: MutableRefObject<any>;
26
+ }
27
+ export type DraggableChild<T extends {
28
+ $id?: string;
29
+ }> = (props: DraggableChildProps<T>) => JSX.Element;
30
+ export interface DraggableProps<T extends {
31
+ $id?: string;
32
+ }> {
33
+ children: JSX.Element | DraggableChild<T>;
34
+ node: T;
35
+ type: Besigner.DragType;
36
+ disabled?: boolean;
37
+ idSuffix?: string;
38
+ }
39
+ declare const Draggable: import("react").FunctionComponent<DraggableProps<{
40
+ $id?: string;
41
+ }> & import("react").RefAttributes<unknown>>;
42
+ export default Draggable;
@@ -0,0 +1,66 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2023 Aglyn LLC
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */ import { _ as _extends } from "@swc/helpers/_/_extends";
17
+ import { _ as _object_without_properties_loose } from "@swc/helpers/_/_object_without_properties_loose";
18
+ import { mergeRefs, useId } from "@aglyn/shared-ui-jsx";
19
+ import { useDraggable } from "@dnd-kit/core";
20
+ import { mergeProps } from "@react-aria/utils";
21
+ import { observer } from "mobx-react-lite";
22
+ import { Children, cloneElement, forwardRef } from "react";
23
+ const Draggable = observer(/*#__PURE__*/ forwardRef((props, ref)=>{
24
+ const { children } = props, rest = _object_without_properties_loose(props, [
25
+ "children"
26
+ ]);
27
+ const { node, type, disabled, idSuffix } = rest;
28
+ const id = useId(node == null ? void 0 : node.$id);
29
+ const draggable = useDraggable({
30
+ id: `${id}:${type}${idSuffix || ''}`,
31
+ data: {
32
+ type,
33
+ node
34
+ },
35
+ disabled
36
+ });
37
+ const transform = draggable.transform;
38
+ const style = _extends({
39
+ cursor: 'move'
40
+ }, draggable.isDragging ? {
41
+ outlineColor: 'grey',
42
+ outlineStyle: 'double',
43
+ outlineOffset: '-1px',
44
+ opacity: 0.5,
45
+ cursor: 'move'
46
+ } : {}, transform ? {
47
+ transform: `translate3d(${transform.x}px, ${transform.y}px, 0)`,
48
+ cursor: 'grab'
49
+ } : {});
50
+ if (typeof children === 'function') {
51
+ return children(_extends({}, rest, {
52
+ style,
53
+ draggable,
54
+ forwardRef: ref
55
+ }));
56
+ }
57
+ const child = Children.only(children);
58
+ return /*#__PURE__*/ cloneElement(child, mergeProps(child.props, _extends({
59
+ ref: mergeRefs(ref, child.props.ref, draggable.setNodeRef),
60
+ style
61
+ }, draggable.listeners, draggable.attributes)));
62
+ }));
63
+ Draggable.displayName = 'Draggable';
64
+ export default Draggable;
65
+
66
+ //# sourceMappingURL=draggable.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../../../../../libs/besigner/feature/designer/src/lib/components/dnd/draggable.tsx"],"sourcesContent":["/**\n * @license\n * Copyright 2023 Aglyn LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport * as Besigner from '@aglyn/besigner'\nimport { mergeRefs, useId } from '@aglyn/shared-ui-jsx'\nimport { useDraggable } from '@dnd-kit/core'\nimport { mergeProps } from '@react-aria/utils'\nimport { observer } from 'mobx-react-lite'\nimport {\n Children,\n cloneElement,\n CSSProperties,\n forwardRef,\n MutableRefObject,\n} from 'react'\n\nexport interface DraggableChildProps<T extends { $id?: string }>\n extends Omit<DraggableProps<T>, 'children'> {\n draggable: ReturnType<typeof useDraggable>\n style: CSSProperties\n forwardRef: MutableRefObject<any>\n}\nexport type DraggableChild<T extends { $id?: string }> = (\n props: DraggableChildProps<T>,\n) => JSX.Element\n\nexport interface DraggableProps<T extends { $id?: string }> {\n children: JSX.Element | DraggableChild<T>\n node: T\n type: Besigner.DragType\n disabled?: boolean\n idSuffix?: string\n}\n\nconst Draggable = observer(\n forwardRef(<T extends { $id?: string }>(props: DraggableProps<T>, ref) => {\n const { children, ...rest } = props\n const { node, type, disabled, idSuffix } = rest\n const id = useId(node?.$id)\n\n const draggable = useDraggable({\n id: `${id}:${type}${idSuffix || ''}`,\n data: { type, node },\n disabled,\n })\n\n const transform = draggable.transform\n const style: CSSProperties = {\n cursor: 'move',\n ...(draggable.isDragging\n ? {\n outlineColor: 'grey',\n outlineStyle: 'double',\n outlineOffset: '-1px',\n opacity: 0.5,\n cursor: 'move',\n }\n : {}),\n ...(transform\n ? {\n transform: `translate3d(${transform.x}px, ${transform.y}px, 0)`,\n cursor: 'grab',\n }\n : {}),\n }\n\n if (typeof children === 'function') {\n return children({\n ...rest,\n style,\n draggable,\n forwardRef: ref,\n })\n }\n\n const child = Children.only(children)\n return cloneElement(\n child,\n mergeProps(child.props, {\n ref: mergeRefs(ref, child.props.ref, draggable.setNodeRef),\n style,\n ...draggable.listeners,\n ...draggable.attributes,\n }),\n )\n }),\n)\nDraggable.displayName = 'Draggable'\n\nexport default Draggable\n"],"names":["mergeRefs","useId","useDraggable","mergeProps","observer","Children","cloneElement","forwardRef","Draggable","props","ref","children","rest","node","type","disabled","idSuffix","id","$id","draggable","data","transform","style","cursor","isDragging","outlineColor","outlineStyle","outlineOffset","opacity","x","y","child","only","setNodeRef","listeners","attributes","displayName"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC;;AAGD,SAASA,SAAS,EAAEC,KAAK,QAAQ,uBAAsB;AACvD,SAASC,YAAY,QAAQ,gBAAe;AAC5C,SAASC,UAAU,QAAQ,oBAAmB;AAC9C,SAASC,QAAQ,QAAQ,kBAAiB;AAC1C,SACEC,QAAQ,EACRC,YAAY,EAEZC,UAAU,QAEL,QAAO;AAoBd,MAAMC,YAAYJ,uBAChBG,WAAW,CAA6BE,OAA0BC;IAChE,MAAM,EAAEC,QAAQ,EAAW,GAAGF,OAATG,wCAASH;;;IAC9B,MAAM,EAAEI,IAAI,EAAEC,IAAI,EAAEC,QAAQ,EAAEC,QAAQ,EAAE,GAAGJ;IAC3C,MAAMK,KAAKhB,MAAMY,wBAAAA,KAAMK,GAAG;IAE1B,MAAMC,YAAYjB,aAAa;QAC7Be,IAAI,GAAGA,GAAG,CAAC,EAAEH,OAAOE,YAAY,IAAI;QACpCI,MAAM;YAAEN;YAAMD;QAAK;QACnBE;IACF;IAEA,MAAMM,YAAYF,UAAUE,SAAS;IACrC,MAAMC,QAAuB;QAC3BC,QAAQ;OACJJ,UAAUK,UAAU,GACpB;QACEC,cAAc;QACdC,cAAc;QACdC,eAAe;QACfC,SAAS;QACTL,QAAQ;IACV,IACA,CAAC,GACDF,YACA;QACEA,WAAW,CAAC,YAAY,EAAEA,UAAUQ,CAAC,CAAC,IAAI,EAAER,UAAUS,CAAC,CAAC,MAAM,CAAC;QAC/DP,QAAQ;IACV,IACA,CAAC;IAGP,IAAI,OAAOZ,aAAa,YAAY;QAClC,OAAOA,SAAS,aACXC;YACHU;YACAH;YACAZ,YAAYG;;IAEhB;IAEA,MAAMqB,QAAQ1B,SAAS2B,IAAI,CAACrB;IAC5B,qBAAOL,aACLyB,OACA5B,WAAW4B,MAAMtB,KAAK,EAAE;QACtBC,KAAKV,UAAUU,KAAKqB,MAAMtB,KAAK,CAACC,GAAG,EAAES,UAAUc,UAAU;QACzDX;OACGH,UAAUe,SAAS,EACnBf,UAAUgB,UAAU;AAG7B;AAEF3B,UAAU4B,WAAW,GAAG;AAExB,eAAe5B,UAAS"}
@@ -0,0 +1,31 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2026 Aglyn LLC
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ import * as Besigner from '@aglyn/besigner';
18
+ import { type ClientRect } from '@dnd-kit/core';
19
+ import type { ComponentProps } from 'react';
20
+ declare const Indicator: import("@emotion/styled").StyledComponent<Omit<import("framer-motion").HTMLMotionProps<"div">, "ref"> & import("react").RefAttributes<HTMLDivElement> & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme> & {
21
+ variant?: "vertical" | "horizontal";
22
+ className?: string;
23
+ }, {}, {}>;
24
+ export interface DropIndicatorProps extends ComponentProps<typeof Indicator> {
25
+ visible?: boolean;
26
+ rect: ClientRect;
27
+ region: Besigner.DropRegion;
28
+ className?: string;
29
+ }
30
+ export declare const DropIndicator: import("react").ForwardRefExoticComponent<Omit<DropIndicatorProps, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
31
+ export default DropIndicator;