@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,699 @@
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 { _ as _extends } from "@swc/helpers/_/_extends";
17
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
18
+ import { canvas, collectThirdPartyAuthorCssUrlHosts, collectThirdPartyAuthorSxUrlHosts } from "@aglyn/aglyn";
19
+ import { mdiClose, mdiPlus } from "@aglyn/shared-data-mdi";
20
+ import { canonicalSxProperties, expandSxAliases, isAtomicSxValue } from "@aglyn/shared-data-enums";
21
+ import { MdiIcon } from "@aglyn/shared-ui-jsx";
22
+ import { FIELD_MUTED_STYLES, FieldMuteButton } from "@aglyn/shared-ui-jsx-forms";
23
+ import { Autocomplete, Button, IconButton, Stack, TextField, ToggleButton, ToggleButtonGroup, Typography } from "@mui/material";
24
+ import { observer } from "mobx-react-lite";
25
+ import { useCallback, useEffect, useMemo, useState } from "react";
26
+ import useAglynBesignerFlag from "../hooks/use-aglyn-besigner-flag.js";
27
+ import { buildStyleMute, toggleMutedStyle } from "../utils/muted-styles.js";
28
+ import { readSxValue } from "../utils/responsive-sx.js";
29
+ import { applyStylePartialToSx } from "../utils/style-field-groups.js";
30
+ import { getNodeStyleTarget } from "../utils/style-target.js";
31
+ /**
32
+ * Curated, grouped suggestions for the builder's property picker
33
+ * (freeSolo, so any CSS/sx property still works).
34
+ */ const CSS_PROPERTY_SUGGESTIONS = [
35
+ ...[
36
+ 'width',
37
+ 'height',
38
+ 'minWidth',
39
+ 'maxWidth',
40
+ 'minHeight',
41
+ 'maxHeight',
42
+ 'overflow',
43
+ 'position',
44
+ 'top',
45
+ 'right',
46
+ 'bottom',
47
+ 'left',
48
+ 'zIndex'
49
+ ].map((name)=>({
50
+ group: 'Layout',
51
+ name
52
+ })),
53
+ ...[
54
+ 'margin',
55
+ 'padding',
56
+ 'gap',
57
+ 'rowGap',
58
+ 'columnGap'
59
+ ].map((name)=>({
60
+ group: 'Spacing',
61
+ name
62
+ })),
63
+ ...[
64
+ 'fontSize',
65
+ 'fontWeight',
66
+ 'fontFamily',
67
+ 'lineHeight',
68
+ 'letterSpacing',
69
+ 'textTransform',
70
+ 'textDecoration',
71
+ 'whiteSpace'
72
+ ].map((name)=>({
73
+ group: 'Typography',
74
+ name
75
+ })),
76
+ ...[
77
+ 'color',
78
+ 'backgroundColor',
79
+ 'background',
80
+ 'backgroundImage',
81
+ 'backgroundSize',
82
+ 'backgroundPosition',
83
+ 'opacity'
84
+ ].map((name)=>({
85
+ group: 'Background & color',
86
+ name
87
+ })),
88
+ ...[
89
+ 'border',
90
+ 'borderRadius',
91
+ 'borderColor',
92
+ 'borderWidth',
93
+ 'borderStyle',
94
+ 'outline'
95
+ ].map((name)=>({
96
+ group: 'Border',
97
+ name
98
+ })),
99
+ ...[
100
+ 'boxShadow',
101
+ 'transform',
102
+ 'transition',
103
+ 'filter',
104
+ 'cursor',
105
+ 'objectFit',
106
+ 'aspectRatio'
107
+ ].map((name)=>({
108
+ group: 'Effects',
109
+ name
110
+ }))
111
+ ];
112
+ const kebabToCamel = (name)=>name.replace(/-([a-z])/g, (match, letter)=>letter.toUpperCase());
113
+ const camelToKebab = (name)=>name.replace(/[A-Z]/g, (letter)=>`-${letter.toLowerCase()}`);
114
+ /** Parses `prop: value;` CSS declarations into a JSS record (AGL-332). */ export function parseCssDeclarations(css) {
115
+ const result = {};
116
+ for (const raw of css.split(';')){
117
+ const declaration = raw.trim();
118
+ if (!declaration) continue;
119
+ const colon = declaration.indexOf(':');
120
+ if (colon <= 0) continue;
121
+ const property = kebabToCamel(declaration.slice(0, colon).trim());
122
+ const value = declaration.slice(colon + 1).trim();
123
+ if (property && value) result[property] = value;
124
+ }
125
+ return result;
126
+ }
127
+ /**
128
+ * The scalar declarations the Builder rows and the CSS tab show for `sx`,
129
+ * named in the Styles panel's own spelling (AGL-2390).
130
+ *
131
+ * MUI honours two names for the same declaration, and every other control
132
+ * in this panel is named for the CSS longhand (AGL-2207). Listing the raw
133
+ * keys made this form the one place that said `bgcolor` where the Colors
134
+ * group said `backgroundColor` and BoxStyler said `paddingTop` — the same
135
+ * node, two vocabularies, and the author with no way to tell that the two
136
+ * rows were one declaration. The expansion is a pure renaming of what
137
+ * already renders (order preserved, non-atomic values left alone), and it
138
+ * is what makes the row's × and the CSS tab's clear reach the key that is
139
+ * actually painting.
140
+ *
141
+ * The JSS tab deliberately does NOT go through here: it edits the stored
142
+ * document verbatim, which is the escape hatch for everything the named
143
+ * controls cannot express.
144
+ */ export function customCssDeclarations(sx, breakpoint) {
145
+ const source = expandSxAliases(sx != null ? sx : {}, {
146
+ deep: true
147
+ });
148
+ const out = [];
149
+ for (const property of Object.keys(source)){
150
+ const value = readSxValue(source, property, breakpoint);
151
+ if (value === undefined || value === null) continue;
152
+ if (typeof value === 'object') continue; // selectors/nested — JSON tab
153
+ out.push({
154
+ property,
155
+ value: String(value)
156
+ });
157
+ }
158
+ return out;
159
+ }
160
+ /** Serializes scalar sx entries into CSS declarations for the CSS tab. */ export function serializeCssDeclarations(sx, breakpoint) {
161
+ return customCssDeclarations(sx, breakpoint).map(({ property, value })=>`${camelToKebab(property)}: ${value};`).join('\n');
162
+ }
163
+ /**
164
+ * The declaration(s) one named property writes, in the panel's spelling.
165
+ *
166
+ * The property field is free-solo and the CSS tab takes any declaration, so
167
+ * an author can type `bgcolor` or `py` at any time — this form is the one
168
+ * seam in the product where a fresh alias can still enter a document. It
169
+ * resolves the name the same way {@link expandSxAliases} resolves a stored
170
+ * one, so what the author typed and what the panel reads back agree.
171
+ *
172
+ * A value the expansion cannot carry per-side — `p: '10px 20px'`, the CSS
173
+ * shorthand's own syntax — keeps the name the author gave it rather than
174
+ * being copied onto four longhands CSS would drop. Clearing always expands,
175
+ * because a cleared alias has to take every longhand it was painting with
176
+ * it.
177
+ */ export function canonicalCssPartial(property, value) {
178
+ const canonical = canonicalSxProperties(property);
179
+ const expandable = canonical.length === 1 || value === undefined || isAtomicSxValue(value);
180
+ if (!canonical.length || !expandable) return {
181
+ [property]: value
182
+ };
183
+ return Object.fromEntries(canonical.map((name)=>[
184
+ name,
185
+ value
186
+ ]));
187
+ }
188
+ /**
189
+ * Applies custom-CSS edits to `sx` — the write both the Builder rows and
190
+ * the CSS tab's Apply go through (AGL-2390).
191
+ *
192
+ * Routed through the Styles panel's own write seam so this form cannot
193
+ * drift from it again: {@link applyStylePartialToSx} expands the alias keys
194
+ * the edit COLLIDES with before writing, which is what makes clearing a
195
+ * declaration actually clear (deleting `backgroundColor` while a `bgcolor`
196
+ * underneath keeps painting is AGL-2207's sharper failure) and what stops a
197
+ * write leaving two spellings of one declaration in the record.
198
+ *
199
+ * Scheme-agnostic (`null`): this form has always written the base slice,
200
+ * and the dark-preview scoping belongs to the named color fields.
201
+ */ export function applyCustomCssEdits(sx, edits, breakpoint) {
202
+ const partial = {};
203
+ for (const [property, value] of Object.entries(edits)){
204
+ if (!property) continue;
205
+ Object.assign(partial, canonicalCssPartial(property, value === '' ? undefined : value));
206
+ }
207
+ return applyStylePartialToSx(sx, partial, breakpoint, null);
208
+ }
209
+ /**
210
+ * Un-applied CSS / JSS text, held ACROSS an unmount of this form (AGL-2486).
211
+ *
212
+ * The JSS tab is the one control in the Styles panel whose work lives only
213
+ * in React state until Apply — and this form is mounted under
214
+ * `withLastSelectedNode`, which renders "Select an element" the instant the
215
+ * canvas selection empties. Anything that clears the selection therefore
216
+ * UNMOUNTS the editor, and a `useState('')` buffer takes the author's
217
+ * half-typed sx document with it. Measured on a live besigner: a selection
218
+ * held with no keyboard or pointer input at all lost the editor 46s in, so
219
+ * this is not something the author can avoid by typing carefully — it is
220
+ * why the wipe reads as random, and why it gets blamed on whichever key was
221
+ * pressed last.
222
+ *
223
+ * Keyed by node AND style target, so a component instance's root and its
224
+ * leaves each keep their own pending text, and re-selecting the element
225
+ * hands the author back exactly what they had typed. An entry lives only
226
+ * while the text DIFFERS from the stored document: applying it, or typing
227
+ * it back to what sx already says, drops the entry, so this never resurrects
228
+ * a draft the author has already resolved.
229
+ *
230
+ * Deliberately not persisted beyond the page: it is un-applied text, not a
231
+ * document, and the crash-recovery draft store is the thing that owns
232
+ * surviving a reload.
233
+ */ const pendingDrafts = new Map();
234
+ const draftKey = (nodeId, overrideKey, mode)=>[
235
+ nodeId,
236
+ overrideKey,
237
+ mode
238
+ ].join('\x00');
239
+ /** Drops every pending draft — test seam, and a hard reset for the canvas. */ export function resetPendingCustomCssDrafts() {
240
+ pendingDrafts.clear();
241
+ }
242
+ /**
243
+ * Why a JSS buffer cannot be applied, or `null` when it is ready
244
+ * (AGL-2486). Rendered live as the author types, so "nothing happened when
245
+ * I pressed Apply" is never the first sign that the text does not parse.
246
+ *
247
+ * Mid-edit JSON is TRANSIENTLY invalid by nature — `{"a": 1,` is what every
248
+ * new property looks like a keystroke before it is finished — so this is a
249
+ * hint, never a block on typing and never a reason to touch the document.
250
+ *
251
+ * An empty buffer is called out rather than treated as `{}`: `JSON.parse`
252
+ * would need a fallback to accept it at all, and silently reading "" as
253
+ * "delete every style on this element" is the most destructive thing this
254
+ * panel could do with an accidental Select-All. Clearing all styles stays
255
+ * available, spelled `{}`, which nobody types by accident.
256
+ */ export function jsonDraftProblem(text) {
257
+ const trimmed = (text != null ? text : '').trim();
258
+ if (!trimmed) {
259
+ return 'Empty — type {} to clear every style on this element.';
260
+ }
261
+ let parsed;
262
+ try {
263
+ parsed = JSON.parse(trimmed);
264
+ } catch (unused) {
265
+ return 'Not valid JSON yet — Apply will not change anything until it parses.';
266
+ }
267
+ // Explicit `=== null` and an array check: `strictNullChecks` is off
268
+ // repo-wide, so `!parsed` would fold `null`, `0` and `""` together, and
269
+ // `typeof null` is `'object'`.
270
+ if (typeof parsed !== 'object' || parsed === null || Array.isArray(parsed)) {
271
+ return 'The sx value must be a JSON object.';
272
+ }
273
+ return null;
274
+ }
275
+ /**
276
+ * Custom CSS for the selected element's `sx` (AGL-332): a friendly
277
+ * builder (property + value rows), a raw CSS mode, and a raw JSS/JSON
278
+ * mode. Builder and CSS edits respect the active breakpoint scope; the
279
+ * JSON mode edits the full sx document (including responsive objects and
280
+ * nested selectors) verbatim.
281
+ */ export const CustomCssForm = observer((props)=>{
282
+ var _target_sx, _ref, _ref1;
283
+ const { node, breakpoint, overrideKey } = props;
284
+ // Same target the rest of the Styles panel writes (AGL-1306/1332): a
285
+ // plain node's own sx, or the instance override slice the panel's style
286
+ // target names — root, or one leaf inside the component.
287
+ const target = useMemo(()=>getNodeStyleTarget(node, overrideKey), [
288
+ node,
289
+ overrideKey
290
+ ]);
291
+ const nodeSx = (_target_sx = target.sx) != null ? _target_sx : {};
292
+ const [mode, setMode] = useState('builder');
293
+ const [cssDraft, setCssDraft] = useState('');
294
+ const [jsonDraft, setJsonDraft] = useState('');
295
+ const [error, setError] = useState(null);
296
+ const rows = useMemo(()=>customCssDeclarations(nodeSx, breakpoint), // eslint-disable-next-line react-hooks/exhaustive-deps
297
+ [
298
+ JSON.stringify(nodeSx),
299
+ breakpoint
300
+ ]);
301
+ const [draftRow, setDraftRow] = useState({
302
+ property: '',
303
+ value: ''
304
+ });
305
+ // Declarations switched off for comparison (AGL-2486). Canvas only, and
306
+ // the same flag every other row in the panel writes, so a property muted
307
+ // here and the same property muted from its typed field are one state.
308
+ // The builder lists BASE scalar declarations only — a state slice is a
309
+ // nested object it skips — so these mutes carry no state scope.
310
+ const [mutedStyles, setMutedStyles] = useAglynBesignerFlag('mutedStyles');
311
+ const rowMute = useCallback((property)=>buildStyleMute(property, property, {
312
+ nodeId: node == null ? void 0 : node.$id,
313
+ state: null,
314
+ breakpoint,
315
+ // Every row the builder lists is, by construction, declared.
316
+ scopeValues: {
317
+ [property]: true
318
+ },
319
+ mutedStyles,
320
+ onToggle: (target)=>setMutedStyles((current)=>toggleMutedStyle(current, target))
321
+ }), [
322
+ node,
323
+ breakpoint,
324
+ mutedStyles,
325
+ setMutedStyles
326
+ ]);
327
+ const nodeId = (_ref = node == null ? void 0 : node.$id) != null ? _ref : '';
328
+ /** What the STORED document says, in each tab's spelling. */ const storedCss = useMemo(()=>serializeCssDeclarations(nodeSx, breakpoint), // eslint-disable-next-line react-hooks/exhaustive-deps
329
+ [
330
+ JSON.stringify(nodeSx),
331
+ breakpoint
332
+ ]);
333
+ const storedJson = useMemo(()=>JSON.stringify(nodeSx, null, 2), // eslint-disable-next-line react-hooks/exhaustive-deps
334
+ [
335
+ JSON.stringify(nodeSx)
336
+ ]);
337
+ /**
338
+ * Records (or drops) the author's un-applied text for one tab, so an
339
+ * unmount cannot take it (AGL-2486). Text equal to the stored document is
340
+ * not a draft at all, so it clears the entry rather than pinning a value
341
+ * that would then shadow a later change from elsewhere in the panel.
342
+ */ const rememberDraft = useCallback((draftMode, value, stored)=>{
343
+ const key = draftKey(nodeId, target.overrideKey, draftMode);
344
+ if (value === stored) pendingDrafts.delete(key);
345
+ else pendingDrafts.set(key, value);
346
+ }, [
347
+ nodeId,
348
+ target.overrideKey
349
+ ]);
350
+ useEffect(()=>{
351
+ // A pending draft wins over the stored document — that is the whole
352
+ // point of keeping it. `!== undefined` rather than a truthiness test:
353
+ // `''` is a legitimate buffer the author emptied on purpose, and with
354
+ // `strictNullChecks` off `if (!pending)` would silently discard it.
355
+ const pendingCss = pendingDrafts.get(draftKey(nodeId, target.overrideKey, 'css'));
356
+ const pendingJson = pendingDrafts.get(draftKey(nodeId, target.overrideKey, 'json'));
357
+ setCssDraft(pendingCss !== undefined ? pendingCss : storedCss);
358
+ setJsonDraft(pendingJson !== undefined ? pendingJson : storedJson);
359
+ setError(null);
360
+ // Re-seeded on the override target too (AGL-1332): switching from the
361
+ // component root to a leaf must reload the drafts, or a stale CSS
362
+ // buffer would be written back onto the newly picked target.
363
+ // eslint-disable-next-line react-hooks/exhaustive-deps
364
+ }, [
365
+ mode,
366
+ nodeId,
367
+ target.overrideKey
368
+ ]);
369
+ /**
370
+ * Live "is this appliable yet" verdict for the JSS tab (AGL-2486) — a
371
+ * caption only. Nothing here writes, so a buffer that stops parsing
372
+ * mid-property changes the hint and leaves the document alone.
373
+ */ const jsonProblem = useMemo(()=>mode === 'json' ? jsonDraftProblem(jsonDraft) : null, [
374
+ mode,
375
+ jsonDraft
376
+ ]);
377
+ // Passive off-site url() hint (AGL-1737) — the "warn" half of AGL-1725's
378
+ // warn-and-disclose, for the panel with no per-field description to carry
379
+ // it. Names the hosts a url() in the CURRENT value would make every
380
+ // visitor's browser contact: the live draft in the CSS and JSON modes
381
+ // (ahead of Apply, so the author reads it while typing), the committed sx
382
+ // in the builder (whose rows write live). A caption and nothing more — it
383
+ // never blocks a value, and it deliberately does not touch how or when
384
+ // this form commits (an attribute panel edit commits on blur, and that
385
+ // behavior is load-bearing).
386
+ const thirdPartyHosts = useMemo(()=>{
387
+ if (mode === 'css') return collectThirdPartyAuthorCssUrlHosts(cssDraft);
388
+ if (mode === 'json') {
389
+ try {
390
+ return collectThirdPartyAuthorSxUrlHosts(JSON.parse(jsonDraft || '{}'));
391
+ } catch (unused) {
392
+ // Mid-edit JSON — scan the raw text so the hint tracks typing.
393
+ return collectThirdPartyAuthorCssUrlHosts(jsonDraft);
394
+ }
395
+ }
396
+ return collectThirdPartyAuthorSxUrlHosts(nodeSx);
397
+ // eslint-disable-next-line react-hooks/exhaustive-deps
398
+ }, [
399
+ mode,
400
+ cssDraft,
401
+ jsonDraft,
402
+ JSON.stringify(nodeSx)
403
+ ]);
404
+ const writeProperty = useCallback((property, value)=>{
405
+ if (!node || !property) return;
406
+ // Coalesced per property (AGL-1204): the builder rows write on every
407
+ // keystroke, so typing one value is one undo step, and editing a
408
+ // different property starts another. The write goes through the style
409
+ // target (AGL-1306), so this is undoable on an instance's override
410
+ // layer exactly as on a plain node's own sx.
411
+ canvas.transact(()=>{
412
+ var _target_sx;
413
+ target.setSx(applyCustomCssEdits((_target_sx = target.sx) != null ? _target_sx : {}, {
414
+ [property]: value
415
+ }, breakpoint));
416
+ }, [
417
+ 'sx',
418
+ node.$id,
419
+ breakpoint != null ? breakpoint : 'base',
420
+ property
421
+ ].join(':'));
422
+ }, [
423
+ node,
424
+ target,
425
+ breakpoint
426
+ ]);
427
+ const applyCss = useCallback(()=>{
428
+ if (!node) return;
429
+ const parsed = parseCssDeclarations(cssDraft);
430
+ // Uncoalesced: pressing Apply is one deliberate commit, however many
431
+ // declarations it carries (AGL-1204).
432
+ canvas.transact(()=>{
433
+ var _target_sx;
434
+ // One edit map, applied once: declarations no longer in the draft
435
+ // clear, the rest write. Both halves resolve their spelling through
436
+ // `applyCustomCssEdits`, so a row the author deleted takes the alias
437
+ // that was painting it with it, and a declaration they typed under
438
+ // MUI's spelling lands where every other control can read it.
439
+ const edits = {};
440
+ for (const row of rows){
441
+ if (!(row.property in parsed)) edits[row.property] = undefined;
442
+ }
443
+ Object.assign(edits, parsed);
444
+ target.setSx(applyCustomCssEdits((_target_sx = target.sx) != null ? _target_sx : {}, edits, breakpoint));
445
+ });
446
+ setError(null);
447
+ // Applied text is no longer un-applied.
448
+ pendingDrafts.delete(draftKey(nodeId, target.overrideKey, 'css'));
449
+ }, [
450
+ node,
451
+ target,
452
+ cssDraft,
453
+ rows,
454
+ breakpoint,
455
+ nodeId
456
+ ]);
457
+ /**
458
+ * Commits the JSS buffer — the ONLY path from this tab to the document
459
+ * (AGL-2486).
460
+ *
461
+ * A buffer that does not parse to a JSON object is a NON-COMMIT: it sets
462
+ * the inline error and returns, leaving both the document and the text
463
+ * exactly as they are, so the author can keep editing from where they
464
+ * were. There is no blur, change or unmount handler anywhere in this form
465
+ * that reaches the document — Apply is the whole seam, which is what
466
+ * makes a transiently invalid buffer harmless.
467
+ */ const applyJson = useCallback(()=>{
468
+ if (!node) return;
469
+ const problem = jsonDraftProblem(jsonDraft);
470
+ if (problem !== null) {
471
+ setError(problem);
472
+ return;
473
+ }
474
+ // Re-parsed rather than carried out of the guard: `jsonDraftProblem`
475
+ // owns the verdict, and one function deciding while another commits is
476
+ // how "valid enough to pass, wrong shape to store" gets in.
477
+ const parsed = JSON.parse(jsonDraft.trim());
478
+ // Replacing sx wholesale is the single most destructive edit this panel
479
+ // offers, so it is the one that most needs to be undoable (AGL-1204).
480
+ canvas.transact(()=>{
481
+ target.setSx(parsed);
482
+ });
483
+ setError(null);
484
+ pendingDrafts.delete(draftKey(nodeId, target.overrideKey, 'json'));
485
+ }, [
486
+ node,
487
+ target,
488
+ jsonDraft,
489
+ nodeId
490
+ ]);
491
+ return /*#__PURE__*/ _jsxs(Stack, {
492
+ spacing: 1.5,
493
+ children: [
494
+ /*#__PURE__*/ _jsxs(ToggleButtonGroup, {
495
+ size: "small",
496
+ exclusive: true,
497
+ fullWidth: true,
498
+ value: mode,
499
+ onChange: (event, value)=>value && setMode(value),
500
+ children: [
501
+ /*#__PURE__*/ _jsx(ToggleButton, {
502
+ value: "builder",
503
+ children: 'Builder'
504
+ }),
505
+ /*#__PURE__*/ _jsx(ToggleButton, {
506
+ value: "css",
507
+ children: 'CSS'
508
+ }),
509
+ /*#__PURE__*/ _jsx(ToggleButton, {
510
+ value: "json",
511
+ children: 'JSS (sx)'
512
+ })
513
+ ]
514
+ }),
515
+ mode === 'builder' ? /*#__PURE__*/ _jsxs(Stack, {
516
+ spacing: 1,
517
+ children: [
518
+ rows.map((row)=>{
519
+ const mute = rowMute(row.property);
520
+ return /*#__PURE__*/ _jsxs(Stack, {
521
+ direction: "row",
522
+ spacing: 1,
523
+ sx: [
524
+ {
525
+ alignItems: 'center'
526
+ },
527
+ (mute == null ? void 0 : mute.muted) ? FIELD_MUTED_STYLES : null
528
+ ],
529
+ children: [
530
+ /*#__PURE__*/ _jsx(TextField, {
531
+ size: "small",
532
+ value: row.property,
533
+ disabled: true,
534
+ sx: {
535
+ flex: 1
536
+ }
537
+ }),
538
+ /*#__PURE__*/ _jsx(TextField, {
539
+ size: "small",
540
+ value: row.value,
541
+ onChange: (event)=>writeProperty(row.property, event.target.value),
542
+ sx: {
543
+ flex: 1
544
+ }
545
+ }),
546
+ /*#__PURE__*/ _jsx(FieldMuteButton, {
547
+ mute: mute
548
+ }),
549
+ /*#__PURE__*/ _jsx(IconButton, {
550
+ size: "small",
551
+ "aria-label": `Remove ${row.property}`,
552
+ onClick: ()=>writeProperty(row.property, undefined),
553
+ children: /*#__PURE__*/ _jsx(MdiIcon, {
554
+ path: mdiClose.path,
555
+ size: 0.7
556
+ })
557
+ })
558
+ ]
559
+ }, row.property);
560
+ }),
561
+ /*#__PURE__*/ _jsxs(Stack, {
562
+ direction: "row",
563
+ spacing: 1,
564
+ sx: {
565
+ alignItems: 'center'
566
+ },
567
+ children: [
568
+ /*#__PURE__*/ _jsx(Autocomplete, {
569
+ freeSolo: true,
570
+ size: "small",
571
+ options: CSS_PROPERTY_SUGGESTIONS,
572
+ groupBy: (option)=>typeof option === 'string' ? '' : option.group,
573
+ getOptionLabel: (option)=>typeof option === 'string' ? option : option.name,
574
+ inputValue: draftRow.property,
575
+ onInputChange: (event, value)=>setDraftRow((prev)=>_extends({}, prev, {
576
+ property: value
577
+ })),
578
+ renderInput: (params)=>/*#__PURE__*/ _jsx(TextField, _extends({}, params, {
579
+ placeholder: "property"
580
+ })),
581
+ sx: {
582
+ flex: 1
583
+ }
584
+ }),
585
+ /*#__PURE__*/ _jsx(TextField, {
586
+ size: "small",
587
+ placeholder: "value",
588
+ value: draftRow.value,
589
+ onChange: (event)=>setDraftRow((prev)=>_extends({}, prev, {
590
+ value: event.target.value
591
+ })),
592
+ sx: {
593
+ flex: 1
594
+ }
595
+ }),
596
+ /*#__PURE__*/ _jsx(IconButton, {
597
+ size: "small",
598
+ "aria-label": "Add property",
599
+ disabled: !draftRow.property.trim() || !draftRow.value.trim(),
600
+ onClick: ()=>{
601
+ writeProperty(kebabToCamel(draftRow.property.trim()), draftRow.value.trim());
602
+ setDraftRow({
603
+ property: '',
604
+ value: ''
605
+ });
606
+ },
607
+ children: /*#__PURE__*/ _jsx(MdiIcon, {
608
+ path: mdiPlus.path,
609
+ size: 0.8
610
+ })
611
+ })
612
+ ]
613
+ })
614
+ ]
615
+ }) : null,
616
+ mode === 'css' ? /*#__PURE__*/ _jsxs(Stack, {
617
+ spacing: 1,
618
+ children: [
619
+ /*#__PURE__*/ _jsx(TextField, {
620
+ multiline: true,
621
+ minRows: 5,
622
+ value: cssDraft,
623
+ onChange: (event)=>{
624
+ setCssDraft(event.target.value);
625
+ rememberDraft('css', event.target.value, storedCss);
626
+ },
627
+ placeholder: 'border-radius: 8px;\nbox-shadow: 0 2px 8px rgba(0,0,0,0.2);',
628
+ slotProps: {
629
+ htmlInput: {
630
+ style: {
631
+ fontFamily: 'monospace',
632
+ fontSize: 12
633
+ }
634
+ }
635
+ }
636
+ }),
637
+ /*#__PURE__*/ _jsx(Button, {
638
+ size: "small",
639
+ variant: "outlined",
640
+ onClick: applyCss,
641
+ children: 'Apply CSS'
642
+ })
643
+ ]
644
+ }) : null,
645
+ mode === 'json' ? /*#__PURE__*/ _jsxs(Stack, {
646
+ spacing: 1,
647
+ children: [
648
+ /*#__PURE__*/ _jsx(Typography, {
649
+ variant: "caption",
650
+ color: "text.secondary",
651
+ children: 'Full sx document — supports responsive objects ' + '({ xs, sm, … }) and nested selectors ("&:hover").'
652
+ }),
653
+ /*#__PURE__*/ _jsx(TextField, {
654
+ multiline: true,
655
+ minRows: 6,
656
+ value: jsonDraft,
657
+ onChange: (event)=>{
658
+ setJsonDraft(event.target.value);
659
+ rememberDraft('json', event.target.value, storedJson);
660
+ // A keystroke that fixes the JSON clears a stale Apply error;
661
+ // it never raises one, so typing is not nagged mid-property.
662
+ if (error && jsonDraftProblem(event.target.value) === null) {
663
+ setError(null);
664
+ }
665
+ },
666
+ error: Boolean(error),
667
+ helperText: (_ref1 = error != null ? error : jsonProblem) != null ? _ref1 : undefined,
668
+ slotProps: {
669
+ htmlInput: {
670
+ style: {
671
+ fontFamily: 'monospace',
672
+ fontSize: 12
673
+ }
674
+ }
675
+ }
676
+ }),
677
+ /*#__PURE__*/ _jsx(Button, {
678
+ size: "small",
679
+ variant: "outlined",
680
+ onClick: applyJson,
681
+ children: 'Apply JSS'
682
+ })
683
+ ]
684
+ }) : null,
685
+ thirdPartyHosts.length ? // Same voice as the Custom HTML `css` description (AGL-1737), with
686
+ // the host named back so the consequence is attached to the value
687
+ // the author typed rather than left as general prose.
688
+ /*#__PURE__*/ _jsx(Typography, {
689
+ variant: "caption",
690
+ color: "text.secondary",
691
+ children: 'A url() here points off your site — every visitor’s browser ' + `will contact ${thirdPartyHosts.join(', ')}, disclosing their ` + 'IP address and which page they are on. Insecure http:// URLs ' + 'are not loaded.'
692
+ }) : null
693
+ ]
694
+ });
695
+ });
696
+ CustomCssForm.displayName = 'CustomCssForm';
697
+ export default CustomCssForm;
698
+
699
+ //# sourceMappingURL=custom-css-form.component.js.map