@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,177 @@
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
+ */ 'use client';
17
+ import { _ as _extends } from "@swc/helpers/_/_extends";
18
+ import { collectReferencedComponentIds } from "@aglyn/aglyn";
19
+ import { useEffect, useRef } from "react";
20
+ /**
21
+ * Deterministic JSON: object keys sorted, so two snapshots of the same
22
+ * document cannot differ only by field order.
23
+ *
24
+ * `JSON.stringify` alone would be a false-positive generator — it preserves
25
+ * insertion order, and nothing promises a Firestore snapshot rebuilds a map
26
+ * in the order the last one did. A notice that fires when nothing changed
27
+ * teaches authors to ignore it, which costs more than the notice is worth.
28
+ */ function stableStringify(value) {
29
+ var _JSON_stringify;
30
+ if (value === null || typeof value !== 'object') return (_JSON_stringify = JSON.stringify(value)) != null ? _JSON_stringify : 'null';
31
+ if (Array.isArray(value)) return `[${value.map(stableStringify).join(',')}]`;
32
+ const keys = Object.keys(value).sort();
33
+ return `{${keys.map((key)=>`${JSON.stringify(key)}:${stableStringify(value[key])}`).join(',')}}`;
34
+ }
35
+ /**
36
+ * What a definition contributes to what is DRAWN.
37
+ *
38
+ * `icon` is deliberately excluded: it is editor chrome on the hierarchy row,
39
+ * and republishing a component only to change its glyph must not tell a
40
+ * screen author their page just changed. `rootId`, `nodes` and declared
41
+ * `props` are the three the graft consumes.
42
+ */ function renderSignature(definition) {
43
+ var _definition_props;
44
+ if (!definition) return undefined;
45
+ return stableStringify({
46
+ rootId: definition.rootId,
47
+ nodes: definition.nodes,
48
+ props: (_definition_props = definition.props) != null ? _definition_props : null
49
+ });
50
+ }
51
+ /**
52
+ * The changes one snapshot made to definitions THIS document renders
53
+ * (AGL-1898 phase 2), given the previous snapshot.
54
+ *
55
+ * Pulled out of the hook because the interesting rules are all here and all
56
+ * testable without a renderer:
57
+ *
58
+ * - **Only what this document renders.** The definitions map is per HOST, so
59
+ * it changes whenever any component in the site is published — most of
60
+ * them not on this page. The referenced set is transitive
61
+ * ({@link Aglyn.collectReferencedComponentIds}), because the shared
62
+ * component an author edits is usually reached through a nav or a card
63
+ * rather than placed on the screen itself. Filtering on direct instances
64
+ * would stay silent for exactly the case the feature exists for.
65
+ * - **Only what changed what is drawn.** Compared by render signature, not
66
+ * object identity: `useHostComponentDefinitions` rebuilds every definition
67
+ * object on every snapshot, so identity always differs and would report
68
+ * the whole page as changed each time a colleague published anything.
69
+ * - **A newly PLACED instance is not a change.** The baseline covers the
70
+ * whole map rather than the referenced subset, so dragging in a component
71
+ * that was already published reports nothing — its definition's signature
72
+ * never moved.
73
+ *
74
+ * The reference walk runs over previous ∪ current definitions so a component
75
+ * nested inside one that was just deleted is still reachable, rather than
76
+ * dropping out of the referenced set at the moment it most needs reporting.
77
+ */ export function diffRenderedComponentDefinitions(options) {
78
+ const { documents, previous, next, names } = options;
79
+ const merged = _extends({}, previous, next);
80
+ const referenced = new Set();
81
+ for (const document of documents){
82
+ if (!document) continue;
83
+ for (const id of collectReferencedComponentIds(document, merged)){
84
+ referenced.add(id);
85
+ }
86
+ }
87
+ const changes = [];
88
+ for (const id of referenced){
89
+ const before = renderSignature(previous[id]);
90
+ const after = renderSignature(next[id]);
91
+ if (before === after) continue;
92
+ changes.push({
93
+ id,
94
+ name: (names == null ? void 0 : names[id]) || id,
95
+ kind: before === undefined ? 'appeared' : after === undefined ? 'removed' : 'updated'
96
+ });
97
+ }
98
+ return changes;
99
+ }
100
+ /** Oxford-comma list: `a`, `a and b`, `a, b and c`. */ function joinNames(names) {
101
+ var _names_;
102
+ if (names.length <= 1) return (_names_ = names[0]) != null ? _names_ : '';
103
+ return `${names.slice(0, -1).join(', ')} and ${names[names.length - 1]}`;
104
+ }
105
+ /**
106
+ * The line an author reads when a component they are using changed under
107
+ * them (AGL-1898 phase 2).
108
+ *
109
+ * It says the canvas ALREADY updated, in the past tense, because it has —
110
+ * the graft re-ran before this message could be composed. The loop's real
111
+ * weakness was never the transport but the silence: an author publishes in
112
+ * the component tab, switches back, and cannot tell a working propagation
113
+ * from a broken one, because a component edit is usually too small to spot.
114
+ *
115
+ * Named, not counted. "A component updated" sends the author hunting; the
116
+ * name tells them where to look, and is the only part of this message that
117
+ * does any work.
118
+ */ export function describeComponentPropagation(changes) {
119
+ if (!changes.length) return '';
120
+ const names = joinNames(changes.map((change)=>change.name));
121
+ const plural = changes.length > 1;
122
+ if (changes.every((change)=>change.kind === 'removed')) {
123
+ // Not an update, and must not read like one: the instance is drawing a
124
+ // placeholder now, and saying "updated" would send the author looking
125
+ // for a change they cannot see.
126
+ return plural ? `${names} are no longer published, so this page shows placeholders where they were.` : `${names} is no longer published, so this page shows a placeholder where it was.`;
127
+ }
128
+ return plural ? `${names} were updated by their components — this page already shows the new versions.` : `${names} was updated by its component — this page already shows the new version.`;
129
+ }
130
+ /**
131
+ * Tells an author when a component this document renders changed under them
132
+ * (AGL-1898 phase 2).
133
+ *
134
+ * Phase 2's transport already works: `useHostComponentDefinitions` is a live
135
+ * listener, so publishing a component re-grafts every open canvas rendering
136
+ * it. What was missing is any sign that it happened. This adds NO reads —
137
+ * it is derived entirely from the snapshot stream the canvas already
138
+ * consumes — and deliberately reports only PUBLISHED changes, because that
139
+ * is what the parent doc carries and what the live site serves.
140
+ *
141
+ * The first settle is silent. Recording a baseline rather than reporting
142
+ * against an empty map is what stops a page announcing its own components on
143
+ * load, and is the reason `definitions === undefined` is not treated as
144
+ * `{}`.
145
+ */ export function useComponentPropagationNotice(options) {
146
+ const { documents, definitions, names, onPropagated } = options;
147
+ // Read through refs: this must fire on a SNAPSHOT, never on the author's
148
+ // own typing. `documents` is a fresh array on every render and the node
149
+ // map changes on every keystroke, so either in the dependency list would
150
+ // re-run the effect constantly — and with a stale-but-equal baseline, a
151
+ // change would then be reported once per keystroke instead of once.
152
+ const documentsRef = useRef(documents);
153
+ documentsRef.current = documents;
154
+ const namesRef = useRef(names);
155
+ namesRef.current = names;
156
+ const onPropagatedRef = useRef(onPropagated);
157
+ onPropagatedRef.current = onPropagated;
158
+ const previousRef = useRef(null);
159
+ useEffect(()=>{
160
+ if (!definitions) return;
161
+ const previous = previousRef.current;
162
+ previousRef.current = definitions;
163
+ if (!previous) return;
164
+ const changes = diffRenderedComponentDefinitions({
165
+ documents: documentsRef.current,
166
+ previous,
167
+ next: definitions,
168
+ names: namesRef.current
169
+ });
170
+ if (changes.length) onPropagatedRef.current(changes);
171
+ }, [
172
+ definitions
173
+ ]);
174
+ }
175
+ export default useComponentPropagationNotice;
176
+
177
+ //# sourceMappingURL=use-component-propagation-notice.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../../../../libs/besigner/feature/designer/src/lib/hooks/use-component-propagation-notice.ts"],"sourcesContent":["/**\n * @license\n * Copyright 2026 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'use client'\n\nimport type * as Aglyn from '@aglyn/aglyn'\nimport { collectReferencedComponentIds } from '@aglyn/aglyn'\nimport { useEffect, useRef } from 'react'\n\n/** What happened to one definition this document renders. */\nexport type ComponentPropagationKind = 'updated' | 'appeared' | 'removed'\n\nexport interface ComponentPropagationChange {\n /** Definition (host component) id. */\n id: string\n /** Its display name when known, else the id — never blank. */\n name: string\n kind: ComponentPropagationKind\n}\n\nexport interface ComponentPropagationNoticeOptions {\n /**\n * Node maps this canvas draws. More than one because the component an\n * author edits is usually in the LAYOUT — a site nav reached from a\n * screen — so a screen besigner passes its own nodes AND its bound\n * layout's, and a surface with only one passes one.\n */\n documents: (Record<string, unknown> | undefined | null)[]\n /**\n * The live host definitions map, `undefined` until the first snapshot\n * settles. Loading and \"this host has none\" must not look the same here:\n * treating loading as an empty map would report every component on the\n * page as removed and then re-appeared.\n */\n definitions: Record<string, Aglyn.ReusableComponentTree> | undefined\n /** Display names by definition id, for the copy. */\n names?: Record<string, string | undefined> | undefined\n /** Called once per snapshot that actually changed something rendered here. */\n onPropagated: (changes: ComponentPropagationChange[]) => void\n}\n\n/**\n * Deterministic JSON: object keys sorted, so two snapshots of the same\n * document cannot differ only by field order.\n *\n * `JSON.stringify` alone would be a false-positive generator — it preserves\n * insertion order, and nothing promises a Firestore snapshot rebuilds a map\n * in the order the last one did. A notice that fires when nothing changed\n * teaches authors to ignore it, which costs more than the notice is worth.\n */\nfunction stableStringify(value: unknown): string {\n if (value === null || typeof value !== 'object') return JSON.stringify(value) ?? 'null'\n if (Array.isArray(value)) return `[${value.map(stableStringify).join(',')}]`\n const keys = Object.keys(value as Record<string, unknown>).sort()\n return `{${keys\n .map(\n (key) =>\n `${JSON.stringify(key)}:${stableStringify(\n (value as Record<string, unknown>)[key],\n )}`,\n )\n .join(',')}}`\n}\n\n/**\n * What a definition contributes to what is DRAWN.\n *\n * `icon` is deliberately excluded: it is editor chrome on the hierarchy row,\n * and republishing a component only to change its glyph must not tell a\n * screen author their page just changed. `rootId`, `nodes` and declared\n * `props` are the three the graft consumes.\n */\nfunction renderSignature(\n definition: Aglyn.ReusableComponentTree | undefined,\n): string | undefined {\n if (!definition) return undefined\n return stableStringify({\n rootId: definition.rootId,\n nodes: definition.nodes,\n props: definition.props ?? null,\n })\n}\n\n/**\n * The changes one snapshot made to definitions THIS document renders\n * (AGL-1898 phase 2), given the previous snapshot.\n *\n * Pulled out of the hook because the interesting rules are all here and all\n * testable without a renderer:\n *\n * - **Only what this document renders.** The definitions map is per HOST, so\n * it changes whenever any component in the site is published — most of\n * them not on this page. The referenced set is transitive\n * ({@link Aglyn.collectReferencedComponentIds}), because the shared\n * component an author edits is usually reached through a nav or a card\n * rather than placed on the screen itself. Filtering on direct instances\n * would stay silent for exactly the case the feature exists for.\n * - **Only what changed what is drawn.** Compared by render signature, not\n * object identity: `useHostComponentDefinitions` rebuilds every definition\n * object on every snapshot, so identity always differs and would report\n * the whole page as changed each time a colleague published anything.\n * - **A newly PLACED instance is not a change.** The baseline covers the\n * whole map rather than the referenced subset, so dragging in a component\n * that was already published reports nothing — its definition's signature\n * never moved.\n *\n * The reference walk runs over previous ∪ current definitions so a component\n * nested inside one that was just deleted is still reachable, rather than\n * dropping out of the referenced set at the moment it most needs reporting.\n */\nexport function diffRenderedComponentDefinitions(options: {\n documents: (Record<string, unknown> | undefined | null)[]\n previous: Record<string, Aglyn.ReusableComponentTree>\n next: Record<string, Aglyn.ReusableComponentTree>\n names?: Record<string, string | undefined> | undefined\n}): ComponentPropagationChange[] {\n const { documents, previous, next, names } = options\n const merged = { ...previous, ...next }\n const referenced = new Set<string>()\n for (const document of documents) {\n if (!document) continue\n for (const id of collectReferencedComponentIds(\n document as Record<string, Aglyn.AglynNodeSchema | undefined>,\n merged,\n )) {\n referenced.add(id)\n }\n }\n\n const changes: ComponentPropagationChange[] = []\n for (const id of referenced) {\n const before = renderSignature(previous[id])\n const after = renderSignature(next[id])\n if (before === after) continue\n changes.push({\n id,\n name: names?.[id] || id,\n kind:\n before === undefined\n ? 'appeared'\n : after === undefined\n ? 'removed'\n : 'updated',\n })\n }\n return changes\n}\n\n/** Oxford-comma list: `a`, `a and b`, `a, b and c`. */\nfunction joinNames(names: string[]): string {\n if (names.length <= 1) return names[0] ?? ''\n return `${names.slice(0, -1).join(', ')} and ${names[names.length - 1]}`\n}\n\n/**\n * The line an author reads when a component they are using changed under\n * them (AGL-1898 phase 2).\n *\n * It says the canvas ALREADY updated, in the past tense, because it has —\n * the graft re-ran before this message could be composed. The loop's real\n * weakness was never the transport but the silence: an author publishes in\n * the component tab, switches back, and cannot tell a working propagation\n * from a broken one, because a component edit is usually too small to spot.\n *\n * Named, not counted. \"A component updated\" sends the author hunting; the\n * name tells them where to look, and is the only part of this message that\n * does any work.\n */\nexport function describeComponentPropagation(\n changes: ComponentPropagationChange[],\n): string {\n if (!changes.length) return ''\n const names = joinNames(changes.map((change) => change.name))\n const plural = changes.length > 1\n if (changes.every((change) => change.kind === 'removed')) {\n // Not an update, and must not read like one: the instance is drawing a\n // placeholder now, and saying \"updated\" would send the author looking\n // for a change they cannot see.\n return plural\n ? `${names} are no longer published, so this page shows placeholders where they were.`\n : `${names} is no longer published, so this page shows a placeholder where it was.`\n }\n return plural\n ? `${names} were updated by their components — this page already shows the new versions.`\n : `${names} was updated by its component — this page already shows the new version.`\n}\n\n/**\n * Tells an author when a component this document renders changed under them\n * (AGL-1898 phase 2).\n *\n * Phase 2's transport already works: `useHostComponentDefinitions` is a live\n * listener, so publishing a component re-grafts every open canvas rendering\n * it. What was missing is any sign that it happened. This adds NO reads —\n * it is derived entirely from the snapshot stream the canvas already\n * consumes — and deliberately reports only PUBLISHED changes, because that\n * is what the parent doc carries and what the live site serves.\n *\n * The first settle is silent. Recording a baseline rather than reporting\n * against an empty map is what stops a page announcing its own components on\n * load, and is the reason `definitions === undefined` is not treated as\n * `{}`.\n */\nexport function useComponentPropagationNotice(\n options: ComponentPropagationNoticeOptions,\n): void {\n const { documents, definitions, names, onPropagated } = options\n // Read through refs: this must fire on a SNAPSHOT, never on the author's\n // own typing. `documents` is a fresh array on every render and the node\n // map changes on every keystroke, so either in the dependency list would\n // re-run the effect constantly — and with a stale-but-equal baseline, a\n // change would then be reported once per keystroke instead of once.\n const documentsRef = useRef(documents)\n documentsRef.current = documents\n const namesRef = useRef(names)\n namesRef.current = names\n const onPropagatedRef = useRef(onPropagated)\n onPropagatedRef.current = onPropagated\n const previousRef = useRef<Record<string, Aglyn.ReusableComponentTree> | null>(\n null,\n )\n\n useEffect(() => {\n if (!definitions) return\n const previous = previousRef.current\n previousRef.current = definitions\n if (!previous) return\n const changes = diffRenderedComponentDefinitions({\n documents: documentsRef.current,\n previous,\n next: definitions,\n names: namesRef.current,\n })\n if (changes.length) onPropagatedRef.current(changes)\n }, [definitions])\n}\n\nexport default useComponentPropagationNotice\n"],"names":["collectReferencedComponentIds","useEffect","useRef","stableStringify","value","JSON","stringify","Array","isArray","map","join","keys","Object","sort","key","renderSignature","definition","undefined","rootId","nodes","props","diffRenderedComponentDefinitions","options","documents","previous","next","names","merged","referenced","Set","document","id","add","changes","before","after","push","name","kind","joinNames","length","slice","describeComponentPropagation","change","plural","every","useComponentPropagationNotice","definitions","onPropagated","documentsRef","current","namesRef","onPropagatedRef","previousRef"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GACD;;AAGA,SAASA,6BAA6B,QAAQ,eAAc;AAC5D,SAASC,SAAS,EAAEC,MAAM,QAAQ,QAAO;AAkCzC;;;;;;;;CAQC,GACD,SAASC,gBAAgB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AaC,OAAO,GAAG3B;IACvB,MAAM4B,WAAWjD,OAAOwB;IACxByB,SAASD,OAAO,GAAGxB;IACnB,MAAM0B,kBAAkBlD,OAAO8C;IAC/BI,gBAAgBF,OAAO,GAAGF;IAC1B,MAAMK,cAAcnD,OAClB;IAGFD,UAAU;QACR,IAAI,CAAC8C,aAAa;QAClB,MAAMvB,WAAW6B,YAAYH,OAAO;QACpCG,YAAYH,OAAO,GAAGH;QACtB,IAAI,CAACvB,UAAU;QACf,MAAMS,UAAUZ,iCAAiC;YAC/CE,WAAW0B,aAAaC,OAAO;YAC/B1B;YACAC,MAAMsB;YACNrB,OAAOyB,SAASD,OAAO;QACzB;QACA,IAAIjB,QAAQO,MAAM,EAAEY,gBAAgBF,OAAO,CAACjB;IAC9C,GAAG;QAACc;KAAY;AAClB;AAEA,eAAeD,8BAA6B"}
@@ -0,0 +1,43 @@
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
+ export declare const ATTRIBUTE_COMMIT_DEBOUNCE_MS = 250;
18
+ export interface DebouncedCommitOptions {
19
+ /**
20
+ * Upper bound on how long a continuously-rescheduled commit may be
21
+ * deferred. Without one, a trailing debounce starves under sustained
22
+ * activity: a long drag or an unbroken burst of typing keeps pushing the
23
+ * timer back and the commit never runs at all. Attribute edits do not need
24
+ * this (a keystroke burst ends in milliseconds); a draft snapshot does,
25
+ * because the whole point is that the work is on disk *before* the crash
26
+ * (AGL-1256). Omit for a pure trailing debounce.
27
+ */
28
+ maxWait?: number;
29
+ }
30
+ /**
31
+ * Debounces a commit callback and exposes an imperative `flush`. Rapid
32
+ * `schedule()` calls (keystrokes) coalesce into a single commit; `flush()`
33
+ * forces a pending commit out immediately (focus leaving a field, an explicit
34
+ * Save), and a pending commit is also flushed on unmount (panel close) so an
35
+ * in-flight edit is never dropped. `commit` may change identity between
36
+ * renders (react-final-form's `handleSubmit` does) — the latest is always used
37
+ * without resubscribing the timer.
38
+ */
39
+ export declare function useDebouncedCommit(commit: () => void, delay?: number, options?: DebouncedCommitOptions): {
40
+ schedule: () => void;
41
+ flush: () => void;
42
+ };
43
+ export default useDebouncedCommit;
@@ -0,0 +1,88 @@
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
+ */ import { useCallback, useEffect, useRef } from "react";
17
+ // Attribute edits commit to the node model on a short debounce, never once
18
+ // per keystroke (AGL-567). A commit runs `canvas.updateNodeProps`, which calls
19
+ // `saveHistory` — deep-cloning the ENTIRE node map onto the undo stack — and
20
+ // mutates the observable props the canvas tree renders from. Firing that on
21
+ // every character of a long value (a 30-plus-character External URL is the
22
+ // reproducer) floods the main thread with full-tree clones and full-tree
23
+ // re-renders faster than it can drain them, until the renderer process is
24
+ // killed ("Aw, Snap"). Short labels never typed enough characters to reach the
25
+ // tipping point, which is why only long URLs crashed. The data-driven-forms
26
+ // field keeps the typed value in its own local state, so typing stays
27
+ // responsive while the (expensive) model commit is deferred.
28
+ export const ATTRIBUTE_COMMIT_DEBOUNCE_MS = 250;
29
+ /**
30
+ * Debounces a commit callback and exposes an imperative `flush`. Rapid
31
+ * `schedule()` calls (keystrokes) coalesce into a single commit; `flush()`
32
+ * forces a pending commit out immediately (focus leaving a field, an explicit
33
+ * Save), and a pending commit is also flushed on unmount (panel close) so an
34
+ * in-flight edit is never dropped. `commit` may change identity between
35
+ * renders (react-final-form's `handleSubmit` does) — the latest is always used
36
+ * without resubscribing the timer.
37
+ */ export function useDebouncedCommit(commit, delay = ATTRIBUTE_COMMIT_DEBOUNCE_MS, options = {}) {
38
+ const { maxWait } = options;
39
+ const commitRef = useRef(commit);
40
+ commitRef.current = commit;
41
+ const timerRef = useRef(null);
42
+ const pendingRef = useRef(false);
43
+ /** When the currently-pending run was first scheduled, for `maxWait`. */ const pendingSinceRef = useRef(null);
44
+ const run = useCallback(()=>{
45
+ if (timerRef.current) {
46
+ clearTimeout(timerRef.current);
47
+ timerRef.current = null;
48
+ }
49
+ pendingRef.current = false;
50
+ pendingSinceRef.current = null;
51
+ commitRef.current();
52
+ }, []);
53
+ const flush = useCallback(()=>{
54
+ if (timerRef.current) {
55
+ clearTimeout(timerRef.current);
56
+ timerRef.current = null;
57
+ }
58
+ if (pendingRef.current) run();
59
+ }, [
60
+ run
61
+ ]);
62
+ const schedule = useCallback(()=>{
63
+ if (!pendingRef.current) pendingSinceRef.current = Date.now();
64
+ pendingRef.current = true;
65
+ if (maxWait !== undefined && pendingSinceRef.current !== null && Date.now() - pendingSinceRef.current >= maxWait) {
66
+ return run();
67
+ }
68
+ if (timerRef.current) clearTimeout(timerRef.current);
69
+ timerRef.current = setTimeout(run, delay);
70
+ return undefined;
71
+ }, [
72
+ delay,
73
+ maxWait,
74
+ run
75
+ ]);
76
+ // Flush any pending edit when the form tears down (panel close) so the last
77
+ // keystrokes are never lost.
78
+ useEffect(()=>flush, [
79
+ flush
80
+ ]);
81
+ return {
82
+ schedule,
83
+ flush
84
+ };
85
+ }
86
+ export default useDebouncedCommit;
87
+
88
+ //# sourceMappingURL=use-debounced-commit.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../../../../libs/besigner/feature/designer/src/lib/hooks/use-debounced-commit.ts"],"sourcesContent":["/**\n * @license\n * Copyright 2026 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 { useCallback, useEffect, useRef } from 'react'\n\n// Attribute edits commit to the node model on a short debounce, never once\n// per keystroke (AGL-567). A commit runs `canvas.updateNodeProps`, which calls\n// `saveHistory` — deep-cloning the ENTIRE node map onto the undo stack — and\n// mutates the observable props the canvas tree renders from. Firing that on\n// every character of a long value (a 30-plus-character External URL is the\n// reproducer) floods the main thread with full-tree clones and full-tree\n// re-renders faster than it can drain them, until the renderer process is\n// killed (\"Aw, Snap\"). Short labels never typed enough characters to reach the\n// tipping point, which is why only long URLs crashed. The data-driven-forms\n// field keeps the typed value in its own local state, so typing stays\n// responsive while the (expensive) model commit is deferred.\nexport const ATTRIBUTE_COMMIT_DEBOUNCE_MS = 250\n\nexport interface DebouncedCommitOptions {\n /**\n * Upper bound on how long a continuously-rescheduled commit may be\n * deferred. Without one, a trailing debounce starves under sustained\n * activity: a long drag or an unbroken burst of typing keeps pushing the\n * timer back and the commit never runs at all. Attribute edits do not need\n * this (a keystroke burst ends in milliseconds); a draft snapshot does,\n * because the whole point is that the work is on disk *before* the crash\n * (AGL-1256). Omit for a pure trailing debounce.\n */\n maxWait?: number\n}\n\n/**\n * Debounces a commit callback and exposes an imperative `flush`. Rapid\n * `schedule()` calls (keystrokes) coalesce into a single commit; `flush()`\n * forces a pending commit out immediately (focus leaving a field, an explicit\n * Save), and a pending commit is also flushed on unmount (panel close) so an\n * in-flight edit is never dropped. `commit` may change identity between\n * renders (react-final-form's `handleSubmit` does) — the latest is always used\n * without resubscribing the timer.\n */\nexport function useDebouncedCommit(\n commit: () => void,\n delay: number = ATTRIBUTE_COMMIT_DEBOUNCE_MS,\n options: DebouncedCommitOptions = {},\n) {\n const { maxWait } = options\n const commitRef = useRef(commit)\n commitRef.current = commit\n const timerRef = useRef<ReturnType<typeof setTimeout> | null>(null)\n const pendingRef = useRef(false)\n /** When the currently-pending run was first scheduled, for `maxWait`. */\n const pendingSinceRef = useRef<number | null>(null)\n\n const run = useCallback(() => {\n if (timerRef.current) {\n clearTimeout(timerRef.current)\n timerRef.current = null\n }\n pendingRef.current = false\n pendingSinceRef.current = null\n commitRef.current()\n }, [])\n\n const flush = useCallback(() => {\n if (timerRef.current) {\n clearTimeout(timerRef.current)\n timerRef.current = null\n }\n if (pendingRef.current) run()\n }, [run])\n\n const schedule = useCallback(() => {\n if (!pendingRef.current) pendingSinceRef.current = Date.now()\n pendingRef.current = true\n if (\n maxWait !== undefined &&\n pendingSinceRef.current !== null &&\n Date.now() - pendingSinceRef.current >= maxWait\n ) {\n return run()\n }\n if (timerRef.current) clearTimeout(timerRef.current)\n timerRef.current = setTimeout(run, delay)\n return undefined\n }, [delay, maxWait, run])\n\n // Flush any pending edit when the form tears down (panel close) so the last\n // keystrokes are never lost.\n useEffect(() => flush, [flush])\n\n return { schedule, flush }\n}\n\nexport default useDebouncedCommit\n"],"names":["useCallback","useEffect","useRef","ATTRIBUTE_COMMIT_DEBOUNCE_MS","useDebouncedCommit","commit","delay","options","maxWait","commitRef","current","timerRef","pendingRef","pendingSinceRef","run","clearTimeout","flush","schedule","Date","now","undefined","setTimeout"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GAED,SAASA,WAAW,EAAEC,SAAS,EAAEC,MAAM,QAAQ,QAAO;AAEtD,2EAA2E;AAC3E,+EAA+E;AAC/E,6EAA6E;AAC7E,4EAA4E;AAC5E,2EAA2E;AAC3E,yEAAy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7Bb,UAAU,IAAMe,OAAO;QAACA;KAAM;IAE9B,OAAO;QAAEC;QAAUD;IAAM;AAC3B;AAEA,eAAeZ,mBAAkB"}
@@ -0,0 +1,24 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2024 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 type * as Aglyn from '@aglyn/aglyn';
18
+ export declare function useDeleteElementCallback(): (node: Aglyn.NodeSchema) => Promise<void>;
19
+ /**
20
+ * Bulk variant for multi-selection (AGL-10/11): one confirm dialog, then
21
+ * deletes every given node (the root node is skipped defensively).
22
+ */
23
+ export declare function useDeleteElementsCallback(): (nodes: Aglyn.NodeSchema[]) => Promise<void>;
24
+ export default useDeleteElementCallback;
@@ -0,0 +1,82 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2024 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 { canvas } from "@aglyn/aglyn";
17
+ import * as Besigner from "@aglyn/besigner";
18
+ import { useConfirmationContext } from "@aglyn/shared-ui-jsx";
19
+ import { useCallback } from "react";
20
+ export function useDeleteElementCallback() {
21
+ const { confirm } = useConfirmationContext();
22
+ return useCallback((node)=>{
23
+ function handleDelete() {
24
+ // Resolved BEFORE the delete and applied after: sibling indices shift
25
+ // once it runs, and the successor has to be a node that survived it
26
+ // (AGL-2553). Hover still goes — the pointer was over what just left.
27
+ const candidates = Besigner.focus.resolveSelectionAfterDeletion([
28
+ node
29
+ ]);
30
+ Besigner.focus.clearHover();
31
+ canvas.deleteNode(node);
32
+ Besigner.focus.selectFirstSurviving(candidates);
33
+ }
34
+ return confirm({
35
+ title: 'Are you sure?',
36
+ description: "You are about to delete an element and all of its child elements from the canvas, please confirm the desired option. Press 'Delete' to confirm and delete the item(s). Press 'Cancel' to void the operation and close this dialog.",
37
+ confirmationText: 'Delete',
38
+ confirmationButtonProps: {
39
+ color: 'error'
40
+ }
41
+ }).then(handleDelete).catch(()=>{});
42
+ }, [
43
+ confirm
44
+ ]);
45
+ }
46
+ /**
47
+ * Bulk variant for multi-selection (AGL-10/11): one confirm dialog, then
48
+ * deletes every given node (the root node is skipped defensively).
49
+ */ export function useDeleteElementsCallback() {
50
+ const { confirm } = useConfirmationContext();
51
+ return useCallback((nodes)=>{
52
+ const deletable = nodes.filter((node)=>node && !canvas.isRootNode(node));
53
+ if (!deletable.length) return Promise.resolve();
54
+ function handleDelete() {
55
+ // Same two-phase resolve as the single delete (AGL-2553). The whole
56
+ // doomed set is handed over so the anchor is the first node that has
57
+ // a parent; candidates that were themselves deleted — or hung off
58
+ // something that was — are gone from the map by the time the
59
+ // selection is applied, and the next one wins.
60
+ const candidates = Besigner.focus.resolveSelectionAfterDeletion(deletable);
61
+ Besigner.focus.clearHover();
62
+ for (const node of deletable){
63
+ // A node may have been removed already as part of an ancestor.
64
+ if (canvas.getNode(node.$id)) canvas.deleteNode(node);
65
+ }
66
+ Besigner.focus.selectFirstSurviving(candidates);
67
+ }
68
+ return confirm({
69
+ title: 'Are you sure?',
70
+ description: `You are about to delete ${deletable.length} elements and all of ` + "their child elements from the canvas. Press 'Delete' to confirm " + "or 'Cancel' to void the operation.",
71
+ confirmationText: 'Delete',
72
+ confirmationButtonProps: {
73
+ color: 'error'
74
+ }
75
+ }).then(handleDelete).catch(()=>{});
76
+ }, [
77
+ confirm
78
+ ]);
79
+ }
80
+ export default useDeleteElementCallback;
81
+
82
+ //# sourceMappingURL=use-delete-element-callback.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../../../../libs/besigner/feature/designer/src/lib/hooks/use-delete-element-callback.ts"],"sourcesContent":["/**\n * @license\n * Copyright 2024 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 { canvas } from '@aglyn/aglyn'\nimport * as Besigner from '@aglyn/besigner'\nimport { useConfirmationContext } from '@aglyn/shared-ui-jsx'\nimport { useCallback } from 'react'\n\nexport function useDeleteElementCallback(): (\n node: Aglyn.NodeSchema,\n) => Promise<void> {\n const { confirm } = useConfirmationContext()\n\n return useCallback(\n (node: Aglyn.NodeSchema) => {\n function handleDelete() {\n // Resolved BEFORE the delete and applied after: sibling indices shift\n // once it runs, and the successor has to be a node that survived it\n // (AGL-2553). Hover still goes — the pointer was over what just left.\n const candidates = Besigner.focus.resolveSelectionAfterDeletion([node])\n Besigner.focus.clearHover()\n canvas.deleteNode(node)\n Besigner.focus.selectFirstSurviving(candidates)\n }\n\n return confirm({\n title: 'Are you sure?',\n description:\n \"You are about to delete an element and all of its child elements from the canvas, please confirm the desired option. Press 'Delete' to confirm and delete the item(s). Press 'Cancel' to void the operation and close this dialog.\",\n confirmationText: 'Delete',\n confirmationButtonProps: {\n color: 'error',\n },\n })\n .then(handleDelete)\n .catch(() => {})\n },\n [confirm],\n )\n}\n\n/**\n * Bulk variant for multi-selection (AGL-10/11): one confirm dialog, then\n * deletes every given node (the root node is skipped defensively).\n */\nexport function useDeleteElementsCallback(): (\n nodes: Aglyn.NodeSchema[],\n) => Promise<void> {\n const { confirm } = useConfirmationContext()\n\n return useCallback(\n (nodes: Aglyn.NodeSchema[]) => {\n const deletable = nodes.filter((node) => node && !canvas.isRootNode(node))\n if (!deletable.length) return Promise.resolve()\n\n function handleDelete() {\n // Same two-phase resolve as the single delete (AGL-2553). The whole\n // doomed set is handed over so the anchor is the first node that has\n // a parent; candidates that were themselves deleted — or hung off\n // something that was — are gone from the map by the time the\n // selection is applied, and the next one wins.\n const candidates =\n Besigner.focus.resolveSelectionAfterDeletion(deletable)\n Besigner.focus.clearHover()\n for (const node of deletable) {\n // A node may have been removed already as part of an ancestor.\n if (canvas.getNode(node.$id)) canvas.deleteNode(node)\n }\n Besigner.focus.selectFirstSurviving(candidates)\n }\n\n return confirm({\n title: 'Are you sure?',\n description:\n `You are about to delete ${deletable.length} elements and all of ` +\n \"their child elements from the canvas. Press 'Delete' to confirm \" +\n \"or 'Cancel' to void the operation.\",\n confirmationText: 'Delete',\n confirmationButtonProps: {\n color: 'error',\n },\n })\n .then(handleDelete)\n .catch(() => {})\n },\n [confirm],\n )\n}\n\nexport default useDeleteElementCallback\n"],"names":["canvas","Besigner","useConfirmationContext","useCallback","useDeleteElementCallback","confirm","node","handleDelete","candidates","focus","resolveSelectionAfterDeletion","clearHover","deleteNode","selectFirstSurviving","title","description","confirmationText","confirmationButtonProps","color","then","catch","useDeleteElementsCallback","nodes","deletable","filter","isRootNode","length","Promise","resolve","getNode","$id"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GAGD,SAASA,MAAM,QAAQ,eAAc;AACrC,YAAYC,cAAc,kBAAiB;AAC3C,SAASC,sBAAsB,QAAQ,uBAAsB;AAC7D,SAASC,WAAW,QAAQ,QAAO;AAEnC,OAAO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ACF,GACGC,IAAI,CAACZ,cACLa,KAAK,CAAC,KAAO;IAClB,GACA;QAACf;KAAQ;AAEb;AAEA,eAAeD,yBAAwB"}
@@ -0,0 +1,76 @@
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
+ /**
18
+ * How long the panel survives the pointer leaving, in ms.
19
+ *
20
+ * This is the forgiving path from the card to the panel: the two are
21
+ * separated by a gap, so travelling to a link inside the panel means
22
+ * leaving the card first. Dismissing on `mouseleave` is what makes a
23
+ * floating detail impossible to click — the content moves or vanishes on the
24
+ * way to it. Long enough to cross a gap diagonally, short enough that it
25
+ * does not linger once you have moved on.
26
+ */
27
+ export declare const DETAIL_CLOSE_DELAY_MS = 260;
28
+ export interface DetailTarget<T> {
29
+ item: T;
30
+ anchor: HTMLElement;
31
+ }
32
+ export interface HoverIntent<T> {
33
+ /** What the surface should describe: the pin wins over the pointer. */
34
+ active: DetailTarget<T> | null;
35
+ /** True while held open by a click rather than by the pointer. */
36
+ isPinned: boolean;
37
+ /** Pointer entered a card. */
38
+ open: (item: T, anchor: HTMLElement) => void;
39
+ /** Pointer left a card, or left the floating panel. */
40
+ scheduleClose: () => void;
41
+ /** Pointer entered the floating panel — cancels a pending close. */
42
+ keepOpen: () => void;
43
+ /** Click a card: holds it open, or releases it if it was already held. */
44
+ togglePin: (item: T, anchor: HTMLElement) => void;
45
+ /** Dismiss explicitly (close button, Escape, outside click). */
46
+ dismiss: () => void;
47
+ /**
48
+ * Dismiss AND stop responding to the pointer until {@link resume}.
49
+ *
50
+ * For a drag: the panel floats over the canvas, which is where the element
51
+ * is being dropped, so it has to leave the drop path the moment the drag
52
+ * starts — not on drop. Suspending rather than just dismissing is the
53
+ * other half: a drag crosses other cards on its way out, and each of those
54
+ * would otherwise re-open it mid-flight.
55
+ */
56
+ suspend: () => void;
57
+ resume: () => void;
58
+ }
59
+ /**
60
+ * Hover-with-intent for a floating detail panel (AGL-2486).
61
+ *
62
+ * Three behaviours, and every one of them exists because the naive version
63
+ * is unusable:
64
+ *
65
+ * - **A pin beats the pointer.** Once clicked, moving across other cards
66
+ * does not swap the content out from under you. Without this, everything
67
+ * inside the panel — Learn more, the attribute list — is unreachable,
68
+ * because reaching for it changes what it says.
69
+ * - **Closing is delayed.** See {@link DETAIL_CLOSE_DELAY_MS}.
70
+ * - **Only one is ever open**, because there is one piece of state, not one
71
+ * per card.
72
+ */
73
+ export declare function useDetailHoverIntent<T extends {
74
+ $id?: string;
75
+ }>(): HoverIntent<T>;
76
+ export default useDetailHoverIntent;