@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.
- package/LICENSE +201 -0
- package/README.md +7 -0
- package/package.json +73 -0
- package/src/besigner.d.ts +88 -0
- package/src/besigner.js +89 -0
- package/src/besigner.js.map +1 -0
- package/src/index.d.ts +17 -0
- package/src/index.js +18 -0
- package/src/index.js.map +1 -0
- package/src/lib/box-styler/box-styler.d.ts +57 -0
- package/src/lib/box-styler/box-styler.js +240 -0
- package/src/lib/box-styler/box-styler.js.map +1 -0
- package/src/lib/box-styler/components/box-diagram.d.ts +89 -0
- package/src/lib/box-styler/components/box-diagram.js +661 -0
- package/src/lib/box-styler/components/box-diagram.js.map +1 -0
- package/src/lib/box-styler/components/legend.d.ts +56 -0
- package/src/lib/box-styler/components/legend.js +130 -0
- package/src/lib/box-styler/components/legend.js.map +1 -0
- package/src/lib/box-styler/components/spacing-editor.d.ts +55 -0
- package/src/lib/box-styler/components/spacing-editor.js +347 -0
- package/src/lib/box-styler/components/spacing-editor.js.map +1 -0
- package/src/lib/box-styler/constants.d.ts +17 -0
- package/src/lib/box-styler/constants.js +30 -0
- package/src/lib/box-styler/constants.js.map +1 -0
- package/src/lib/box-styler/index.d.ts +2 -0
- package/src/lib/box-styler/index.js +4 -0
- package/src/lib/box-styler/index.js.map +1 -0
- package/src/lib/box-styler/region-fills.d.ts +107 -0
- package/src/lib/box-styler/region-fills.js +139 -0
- package/src/lib/box-styler/region-fills.js.map +1 -0
- package/src/lib/box-styler/spacing-value.d.ts +104 -0
- package/src/lib/box-styler/spacing-value.js +223 -0
- package/src/lib/box-styler/spacing-value.js.map +1 -0
- package/src/lib/box-styler/types.d.ts +29 -0
- package/src/lib/box-styler/types.js +18 -0
- package/src/lib/box-styler/types.js.map +1 -0
- package/src/lib/components/accordion-list.component.d.ts +50 -0
- package/src/lib/components/accordion-list.component.js +228 -0
- package/src/lib/components/accordion-list.component.js.map +1 -0
- package/src/lib/components/add-controls.component.d.ts +22 -0
- package/src/lib/components/add-controls.component.js +50 -0
- package/src/lib/components/add-controls.component.js.map +1 -0
- package/src/lib/components/app-bar-breadcrumbs.component.d.ts +29 -0
- package/src/lib/components/app-bar-breadcrumbs.component.js +279 -0
- package/src/lib/components/app-bar-breadcrumbs.component.js.map +1 -0
- package/src/lib/components/app-bar-primary.component.d.ts +21 -0
- package/src/lib/components/app-bar-primary.component.js +108 -0
- package/src/lib/components/app-bar-primary.component.js.map +1 -0
- package/src/lib/components/app-bar-secondary.component.d.ts +21 -0
- package/src/lib/components/app-bar-secondary.component.js +94 -0
- package/src/lib/components/app-bar-secondary.component.js.map +1 -0
- package/src/lib/components/aside-panel.component.d.ts +23 -0
- package/src/lib/components/aside-panel.component.js +505 -0
- package/src/lib/components/aside-panel.component.js.map +1 -0
- package/src/lib/components/besigner-conflict-alert.component.d.ts +36 -0
- package/src/lib/components/besigner-conflict-alert.component.js +51 -0
- package/src/lib/components/besigner-conflict-alert.component.js.map +1 -0
- package/src/lib/components/besigner-dnd-context.component.d.ts +32 -0
- package/src/lib/components/besigner-dnd-context.component.js +75 -0
- package/src/lib/components/besigner-dnd-context.component.js.map +1 -0
- package/src/lib/components/besigner-draft-alert.component.d.ts +70 -0
- package/src/lib/components/besigner-draft-alert.component.js +155 -0
- package/src/lib/components/besigner-draft-alert.component.js.map +1 -0
- package/src/lib/components/besigner-root-provider.component.d.ts +33 -0
- package/src/lib/components/besigner-root-provider.component.js +68 -0
- package/src/lib/components/besigner-root-provider.component.js.map +1 -0
- package/src/lib/components/binding-preview-controls.component.d.ts +28 -0
- package/src/lib/components/binding-preview-controls.component.js +63 -0
- package/src/lib/components/binding-preview-controls.component.js.map +1 -0
- package/src/lib/components/closeable-drawer.component.d.ts +32 -0
- package/src/lib/components/closeable-drawer.component.js +134 -0
- package/src/lib/components/closeable-drawer.component.js.map +1 -0
- package/src/lib/components/component-accordion-list.d.ts +28 -0
- package/src/lib/components/component-accordion-list.js +205 -0
- package/src/lib/components/component-accordion-list.js.map +1 -0
- package/src/lib/components/component-icon.component.d.ts +32 -0
- package/src/lib/components/component-icon.component.js +51 -0
- package/src/lib/components/component-icon.component.js.map +1 -0
- package/src/lib/components/component-picker.d.ts +27 -0
- package/src/lib/components/component-picker.js +368 -0
- package/src/lib/components/component-picker.js.map +1 -0
- package/src/lib/components/components-grid-list.component.d.ts +31 -0
- package/src/lib/components/components-grid-list.component.js +162 -0
- package/src/lib/components/components-grid-list.component.js.map +1 -0
- package/src/lib/components/custom-css-form.component.d.ts +115 -0
- package/src/lib/components/custom-css-form.component.js +699 -0
- package/src/lib/components/custom-css-form.component.js.map +1 -0
- package/src/lib/components/device-preview-controls.component.d.ts +22 -0
- package/src/lib/components/device-preview-controls.component.js +150 -0
- package/src/lib/components/device-preview-controls.component.js.map +1 -0
- package/src/lib/components/dnd/canvas-drop-indicator.d.ts +20 -0
- package/src/lib/components/dnd/canvas-drop-indicator.js +61 -0
- package/src/lib/components/dnd/canvas-drop-indicator.js.map +1 -0
- package/src/lib/components/dnd/draggable-droppable.d.ts +31 -0
- package/src/lib/components/dnd/draggable-droppable.js +383 -0
- package/src/lib/components/dnd/draggable-droppable.js.map +1 -0
- package/src/lib/components/dnd/draggable.d.ts +42 -0
- package/src/lib/components/dnd/draggable.js +66 -0
- package/src/lib/components/dnd/draggable.js.map +1 -0
- package/src/lib/components/dnd/drop-indicator.d.ts +31 -0
- package/src/lib/components/dnd/drop-indicator.js +139 -0
- package/src/lib/components/dnd/drop-indicator.js.map +1 -0
- package/src/lib/components/dnd/droppable.d.ts +43 -0
- package/src/lib/components/dnd/droppable.js +63 -0
- package/src/lib/components/dnd/droppable.js.map +1 -0
- package/src/lib/components/element-card.component.d.ts +23 -0
- package/src/lib/components/element-card.component.js +49 -0
- package/src/lib/components/element-card.component.js.map +1 -0
- package/src/lib/components/element-classes-field.component.d.ts +41 -0
- package/src/lib/components/element-classes-field.component.js +140 -0
- package/src/lib/components/element-classes-field.component.js.map +1 -0
- package/src/lib/components/element-detail-overlay.component.d.ts +55 -0
- package/src/lib/components/element-detail-overlay.component.js +157 -0
- package/src/lib/components/element-detail-overlay.component.js.map +1 -0
- package/src/lib/components/element-detail.component.d.ts +56 -0
- package/src/lib/components/element-detail.component.js +171 -0
- package/src/lib/components/element-detail.component.js.map +1 -0
- package/src/lib/components/element-info-details.component.d.ts +18 -0
- package/src/lib/components/element-info-details.component.js +169 -0
- package/src/lib/components/element-info-details.component.js.map +1 -0
- package/src/lib/components/element-interactions-form.component.d.ts +21 -0
- package/src/lib/components/element-interactions-form.component.js +199 -0
- package/src/lib/components/element-interactions-form.component.js.map +1 -0
- package/src/lib/components/element-preview.component.d.ts +75 -0
- package/src/lib/components/element-preview.component.js +346 -0
- package/src/lib/components/element-preview.component.js.map +1 -0
- package/src/lib/components/element-props-form.component.d.ts +565 -0
- package/src/lib/components/element-props-form.component.js +2392 -0
- package/src/lib/components/element-props-form.component.js.map +1 -0
- package/src/lib/components/element-styles-form-template.component.d.ts +27 -0
- package/src/lib/components/element-styles-form-template.component.js +89 -0
- package/src/lib/components/element-styles-form-template.component.js.map +1 -0
- package/src/lib/components/element-styles-form.component.d.ts +52 -0
- package/src/lib/components/element-styles-form.component.js +1350 -0
- package/src/lib/components/element-styles-form.component.js.map +1 -0
- package/src/lib/components/empty-document-slot.d.ts +39 -0
- package/src/lib/components/empty-document-slot.js +121 -0
- package/src/lib/components/empty-document-slot.js.map +1 -0
- package/src/lib/components/empty-results.d.ts +22 -0
- package/src/lib/components/empty-results.js +131 -0
- package/src/lib/components/empty-results.js.map +1 -0
- package/src/lib/components/history-controls.component.d.ts +21 -0
- package/src/lib/components/history-controls.component.js +67 -0
- package/src/lib/components/history-controls.component.js.map +1 -0
- package/src/lib/components/inline-markdown-editor.component.d.ts +17 -0
- package/src/lib/components/inline-markdown-editor.component.js +220 -0
- package/src/lib/components/inline-markdown-editor.component.js.map +1 -0
- package/src/lib/components/inline-text-editor.component.d.ts +48 -0
- package/src/lib/components/inline-text-editor.component.js +905 -0
- package/src/lib/components/inline-text-editor.component.js.map +1 -0
- package/src/lib/components/insert-token-menu.component.d.ts +86 -0
- package/src/lib/components/insert-token-menu.component.js +232 -0
- package/src/lib/components/insert-token-menu.component.js.map +1 -0
- package/src/lib/components/instance-attr-overrides.component.d.ts +50 -0
- package/src/lib/components/instance-attr-overrides.component.js +298 -0
- package/src/lib/components/instance-attr-overrides.component.js.map +1 -0
- package/src/lib/components/interact-controls.component.d.ts +22 -0
- package/src/lib/components/interact-controls.component.js +74 -0
- package/src/lib/components/interact-controls.component.js.map +1 -0
- package/src/lib/components/markdown-attribute-field.component.d.ts +40 -0
- package/src/lib/components/markdown-attribute-field.component.js +103 -0
- package/src/lib/components/markdown-attribute-field.component.js.map +1 -0
- package/src/lib/components/node-card.d.ts +24 -0
- package/src/lib/components/node-card.js +86 -0
- package/src/lib/components/node-card.js.map +1 -0
- package/src/lib/components/node-context-menu.d.ts +25 -0
- package/src/lib/components/node-context-menu.js +558 -0
- package/src/lib/components/node-context-menu.js.map +1 -0
- package/src/lib/components/node-leaf.d.ts +39 -0
- package/src/lib/components/node-leaf.js +628 -0
- package/src/lib/components/node-leaf.js.map +1 -0
- package/src/lib/components/node-outline.d.ts +24 -0
- package/src/lib/components/node-outline.js +156 -0
- package/src/lib/components/node-outline.js.map +1 -0
- package/src/lib/components/node-overlay.d.ts +23 -0
- package/src/lib/components/node-overlay.js +299 -0
- package/src/lib/components/node-overlay.js.map +1 -0
- package/src/lib/components/node-quick-actions.d.ts +24 -0
- package/src/lib/components/node-quick-actions.js +284 -0
- package/src/lib/components/node-quick-actions.js.map +1 -0
- package/src/lib/components/node-tree-view.d.ts +106 -0
- package/src/lib/components/node-tree-view.js +820 -0
- package/src/lib/components/node-tree-view.js.map +1 -0
- package/src/lib/components/panel-controls.component.d.ts +22 -0
- package/src/lib/components/panel-controls.component.js +76 -0
- package/src/lib/components/panel-controls.component.js.map +1 -0
- package/src/lib/components/picker-search-field.d.ts +38 -0
- package/src/lib/components/picker-search-field.js +79 -0
- package/src/lib/components/picker-search-field.js.map +1 -0
- package/src/lib/components/plugin-settings-field.component.d.ts +38 -0
- package/src/lib/components/plugin-settings-field.component.js +264 -0
- package/src/lib/components/plugin-settings-field.component.js.map +1 -0
- package/src/lib/components/properties-dialog.component.d.ts +22 -0
- package/src/lib/components/properties-dialog.component.js +40 -0
- package/src/lib/components/properties-dialog.component.js.map +1 -0
- package/src/lib/components/property-binding-field.component.d.ts +142 -0
- package/src/lib/components/property-binding-field.component.js +325 -0
- package/src/lib/components/property-binding-field.component.js.map +1 -0
- package/src/lib/components/property-values-form.component.d.ts +43 -0
- package/src/lib/components/property-values-form.component.js +223 -0
- package/src/lib/components/property-values-form.component.js.map +1 -0
- package/src/lib/components/scheme-preview-controls.component.d.ts +26 -0
- package/src/lib/components/scheme-preview-controls.component.js +56 -0
- package/src/lib/components/scheme-preview-controls.component.js.map +1 -0
- package/src/lib/components/screen-link-field.component.d.ts +118 -0
- package/src/lib/components/screen-link-field.component.js +282 -0
- package/src/lib/components/screen-link-field.component.js.map +1 -0
- package/src/lib/components/site-theme-color-tokens-provider.component.d.ts +33 -0
- package/src/lib/components/site-theme-color-tokens-provider.component.js +53 -0
- package/src/lib/components/site-theme-color-tokens-provider.component.js.map +1 -0
- package/src/lib/components/subtree-json-dialog.component.d.ts +46 -0
- package/src/lib/components/subtree-json-dialog.component.js +125 -0
- package/src/lib/components/subtree-json-dialog.component.js.map +1 -0
- package/src/lib/components/token-pill.component.d.ts +51 -0
- package/src/lib/components/token-pill.component.js +164 -0
- package/src/lib/components/token-pill.component.js.map +1 -0
- package/src/lib/components/token-text-field.component.d.ts +146 -0
- package/src/lib/components/token-text-field.component.js +603 -0
- package/src/lib/components/token-text-field.component.js.map +1 -0
- package/src/lib/components/tree/tree-list.d.ts +6 -0
- package/src/lib/components/tree/tree-list.js +108 -0
- package/src/lib/components/tree/tree-list.js.map +1 -0
- package/src/lib/components/viewport-canvas.component.d.ts +23 -0
- package/src/lib/components/viewport-canvas.component.js +128 -0
- package/src/lib/components/viewport-canvas.component.js.map +1 -0
- package/src/lib/components/viewport-frame.component.d.ts +47 -0
- package/src/lib/components/viewport-frame.component.js +332 -0
- package/src/lib/components/viewport-frame.component.js.map +1 -0
- package/src/lib/components/viewport-root.component.d.ts +22 -0
- package/src/lib/components/viewport-root.component.js +112 -0
- package/src/lib/components/viewport-root.component.js.map +1 -0
- package/src/lib/components/viewport-zoom-controls.d.ts +29 -0
- package/src/lib/components/viewport-zoom-controls.js +147 -0
- package/src/lib/components/viewport-zoom-controls.js.map +1 -0
- package/src/lib/components/workspace-editor.component.d.ts +23 -0
- package/src/lib/components/workspace-editor.component.js +191 -0
- package/src/lib/components/workspace-editor.component.js.map +1 -0
- package/src/lib/components/workspace-panel.component.d.ts +28 -0
- package/src/lib/components/workspace-panel.component.js +147 -0
- package/src/lib/components/workspace-panel.component.js.map +1 -0
- package/src/lib/constants/sample-data.d.ts +18 -0
- package/src/lib/constants/sample-data.js +106 -0
- package/src/lib/constants/sample-data.js.map +1 -0
- package/src/lib/constants/shared.d.ts +17 -0
- package/src/lib/constants/shared.js +18 -0
- package/src/lib/constants/shared.js.map +1 -0
- package/src/lib/contexts/besigner-app-context.d.ts +30 -0
- package/src/lib/contexts/besigner-app-context.js +41 -0
- package/src/lib/contexts/besigner-app-context.js.map +1 -0
- package/src/lib/contexts/binding-picker-context.d.ts +78 -0
- package/src/lib/contexts/binding-picker-context.js +21 -0
- package/src/lib/contexts/binding-picker-context.js.map +1 -0
- package/src/lib/contexts/canvas-host-tokens-context.d.ts +49 -0
- package/src/lib/contexts/canvas-host-tokens-context.js +63 -0
- package/src/lib/contexts/canvas-host-tokens-context.js.map +1 -0
- package/src/lib/contexts/canvas-reveal-context.d.ts +32 -0
- package/src/lib/contexts/canvas-reveal-context.js +34 -0
- package/src/lib/contexts/canvas-reveal-context.js.map +1 -0
- package/src/lib/contexts/component-promotion-context.d.ts +89 -0
- package/src/lib/contexts/component-promotion-context.js +21 -0
- package/src/lib/contexts/component-promotion-context.js.map +1 -0
- package/src/lib/contexts/components-drawer-context.provider.d.ts +32 -0
- package/src/lib/contexts/components-drawer-context.provider.js +80 -0
- package/src/lib/contexts/components-drawer-context.provider.js.map +1 -0
- package/src/lib/contexts/element-drawer-context.d.ts +1005 -0
- package/src/lib/contexts/element-drawer-context.js +45 -0
- package/src/lib/contexts/element-drawer-context.js.map +1 -0
- package/src/lib/contexts/inspected-selection.d.ts +32 -0
- package/src/lib/contexts/inspected-selection.js +38 -0
- package/src/lib/contexts/inspected-selection.js.map +1 -0
- package/src/lib/contexts/inspector-extras-context.d.ts +56 -0
- package/src/lib/contexts/inspector-extras-context.js +35 -0
- package/src/lib/contexts/inspector-extras-context.js.map +1 -0
- package/src/lib/contexts/interactions-context.d.ts +99 -0
- package/src/lib/contexts/interactions-context.js +22 -0
- package/src/lib/contexts/interactions-context.js.map +1 -0
- package/src/lib/contexts/layout-chrome-context.d.ts +37 -0
- package/src/lib/contexts/layout-chrome-context.js +75 -0
- package/src/lib/contexts/layout-chrome-context.js.map +1 -0
- package/src/lib/contexts/media-asset-facts-context.d.ts +74 -0
- package/src/lib/contexts/media-asset-facts-context.js +27 -0
- package/src/lib/contexts/media-asset-facts-context.js.map +1 -0
- package/src/lib/contexts/media-picker-context.d.ts +88 -0
- package/src/lib/contexts/media-picker-context.js +21 -0
- package/src/lib/contexts/media-picker-context.js.map +1 -0
- package/src/lib/contexts/rendered-canvas-elements.d.ts +42 -0
- package/src/lib/contexts/rendered-canvas-elements.js +79 -0
- package/src/lib/contexts/rendered-canvas-elements.js.map +1 -0
- package/src/lib/contexts/repeat-record-context.d.ts +38 -0
- package/src/lib/contexts/repeat-record-context.js +21 -0
- package/src/lib/contexts/repeat-record-context.js.map +1 -0
- package/src/lib/contexts/repeat-rows-context.d.ts +53 -0
- package/src/lib/contexts/repeat-rows-context.js +38 -0
- package/src/lib/contexts/repeat-rows-context.js.map +1 -0
- package/src/lib/contexts/toolbar-extras-context.d.ts +31 -0
- package/src/lib/contexts/toolbar-extras-context.js +33 -0
- package/src/lib/contexts/toolbar-extras-context.js.map +1 -0
- package/src/lib/drafts/besigner-draft-store.d.ts +110 -0
- package/src/lib/drafts/besigner-draft-store.js +125 -0
- package/src/lib/drafts/besigner-draft-store.js.map +1 -0
- package/src/lib/drafts/besigner-server-draft.d.ts +130 -0
- package/src/lib/drafts/besigner-server-draft.js +211 -0
- package/src/lib/drafts/besigner-server-draft.js.map +1 -0
- package/src/lib/form-fields/components/shared/inline-form-control.d.ts +32 -0
- package/src/lib/form-fields/components/shared/inline-form-control.js +85 -0
- package/src/lib/form-fields/components/shared/inline-form-control.js.map +1 -0
- package/src/lib/form-fields/components/shared/toggle-button-form-control.d.ts +33 -0
- package/src/lib/form-fields/components/shared/toggle-button-form-control.js +83 -0
- package/src/lib/form-fields/components/shared/toggle-button-form-control.js.map +1 -0
- package/src/lib/form-fields/form-fields.d.ts +20 -0
- package/src/lib/form-fields/form-fields.js +21 -0
- package/src/lib/form-fields/form-fields.js.map +1 -0
- package/src/lib/form-fields/index.d.ts +1 -0
- package/src/lib/form-fields/index.js +3 -0
- package/src/lib/form-fields/index.js.map +1 -0
- package/src/lib/hooks/use-add-element-drawer-callback.d.ts +28 -0
- package/src/lib/hooks/use-add-element-drawer-callback.js +112 -0
- package/src/lib/hooks/use-add-element-drawer-callback.js.map +1 -0
- package/src/lib/hooks/use-aglyn-besigner-flag.d.ts +23 -0
- package/src/lib/hooks/use-aglyn-besigner-flag.js +47 -0
- package/src/lib/hooks/use-aglyn-besigner-flag.js.map +1 -0
- package/src/lib/hooks/use-aglyn-besigner-panel-value.d.ts +23 -0
- package/src/lib/hooks/use-aglyn-besigner-panel-value.js +54 -0
- package/src/lib/hooks/use-aglyn-besigner-panel-value.js.map +1 -0
- package/src/lib/hooks/use-aglyn-besigner-panel.d.ts +23 -0
- package/src/lib/hooks/use-aglyn-besigner-panel.js +47 -0
- package/src/lib/hooks/use-aglyn-besigner-panel.js.map +1 -0
- package/src/lib/hooks/use-anchored-rect.d.ts +68 -0
- package/src/lib/hooks/use-anchored-rect.js +131 -0
- package/src/lib/hooks/use-anchored-rect.js.map +1 -0
- package/src/lib/hooks/use-besigner-app-context.d.ts +18 -0
- package/src/lib/hooks/use-besigner-app-context.js +19 -0
- package/src/lib/hooks/use-besigner-app-context.js.map +1 -0
- package/src/lib/hooks/use-besigner-document.d.ts +309 -0
- package/src/lib/hooks/use-besigner-document.js +500 -0
- package/src/lib/hooks/use-besigner-document.js.map +1 -0
- package/src/lib/hooks/use-besigner-draft.d.ts +209 -0
- package/src/lib/hooks/use-besigner-draft.js +429 -0
- package/src/lib/hooks/use-besigner-draft.js.map +1 -0
- package/src/lib/hooks/use-clipboard-callbacks.d.ts +29 -0
- package/src/lib/hooks/use-clipboard-callbacks.js +82 -0
- package/src/lib/hooks/use-clipboard-callbacks.js.map +1 -0
- package/src/lib/hooks/use-clipboard-shortcuts.d.ts +52 -0
- package/src/lib/hooks/use-clipboard-shortcuts.js +102 -0
- package/src/lib/hooks/use-clipboard-shortcuts.js.map +1 -0
- package/src/lib/hooks/use-component-propagation-notice.d.ts +96 -0
- package/src/lib/hooks/use-component-propagation-notice.js +177 -0
- package/src/lib/hooks/use-component-propagation-notice.js.map +1 -0
- package/src/lib/hooks/use-debounced-commit.d.ts +43 -0
- package/src/lib/hooks/use-debounced-commit.js +88 -0
- package/src/lib/hooks/use-debounced-commit.js.map +1 -0
- package/src/lib/hooks/use-delete-element-callback.d.ts +24 -0
- package/src/lib/hooks/use-delete-element-callback.js +82 -0
- package/src/lib/hooks/use-delete-element-callback.js.map +1 -0
- package/src/lib/hooks/use-detail-hover-intent.d.ts +76 -0
- package/src/lib/hooks/use-detail-hover-intent.js +123 -0
- package/src/lib/hooks/use-detail-hover-intent.js.map +1 -0
- package/src/lib/hooks/use-document-repair-callbacks.d.ts +50 -0
- package/src/lib/hooks/use-document-repair-callbacks.js +237 -0
- package/src/lib/hooks/use-document-repair-callbacks.js.map +1 -0
- package/src/lib/hooks/use-insert-token-options.d.ts +52 -0
- package/src/lib/hooks/use-insert-token-options.js +230 -0
- package/src/lib/hooks/use-insert-token-options.js.map +1 -0
- package/src/lib/hooks/use-leaf-drag.d.ts +24 -0
- package/src/lib/hooks/use-leaf-drag.js +28 -0
- package/src/lib/hooks/use-leaf-drag.js.map +1 -0
- package/src/lib/hooks/use-leaf-drop.d.ts +31 -0
- package/src/lib/hooks/use-leaf-drop.js +43 -0
- package/src/lib/hooks/use-leaf-drop.js.map +1 -0
- package/src/lib/hooks/use-markdown-media-picker.d.ts +63 -0
- package/src/lib/hooks/use-markdown-media-picker.js +110 -0
- package/src/lib/hooks/use-markdown-media-picker.js.map +1 -0
- package/src/lib/hooks/use-media-asset-facts-overlay.d.ts +43 -0
- package/src/lib/hooks/use-media-asset-facts-overlay.js +133 -0
- package/src/lib/hooks/use-media-asset-facts-overlay.js.map +1 -0
- package/src/lib/hooks/use-move-node-callbacks.d.ts +22 -0
- package/src/lib/hooks/use-move-node-callbacks.js +57 -0
- package/src/lib/hooks/use-move-node-callbacks.js.map +1 -0
- package/src/lib/hooks/use-node-with-host-tokens.d.ts +42 -0
- package/src/lib/hooks/use-node-with-host-tokens.js +59 -0
- package/src/lib/hooks/use-node-with-host-tokens.js.map +1 -0
- package/src/lib/hooks/use-picker-filter.d.ts +61 -0
- package/src/lib/hooks/use-picker-filter.js +122 -0
- package/src/lib/hooks/use-picker-filter.js.map +1 -0
- package/src/lib/hooks/use-repeat-preview.d.ts +64 -0
- package/src/lib/hooks/use-repeat-preview.js +214 -0
- package/src/lib/hooks/use-repeat-preview.js.map +1 -0
- package/src/lib/hooks/use-repeat-sources.d.ts +17 -0
- package/src/lib/hooks/use-repeat-sources.js +41 -0
- package/src/lib/hooks/use-repeat-sources.js.map +1 -0
- package/src/lib/hooks/use-visible-component-categories.d.ts +37 -0
- package/src/lib/hooks/use-visible-component-categories.js +79 -0
- package/src/lib/hooks/use-visible-component-categories.js.map +1 -0
- package/src/lib/utils/active-host-theme.d.ts +28 -0
- package/src/lib/utils/active-host-theme.js +77 -0
- package/src/lib/utils/active-host-theme.js.map +1 -0
- package/src/lib/utils/attr-target.d.ts +170 -0
- package/src/lib/utils/attr-target.js +229 -0
- package/src/lib/utils/attr-target.js.map +1 -0
- package/src/lib/utils/attribute-field-value.d.ts +21 -0
- package/src/lib/utils/attribute-field-value.js +28 -0
- package/src/lib/utils/attribute-field-value.js.map +1 -0
- package/src/lib/utils/canvas-context-menu.d.ts +28 -0
- package/src/lib/utils/canvas-context-menu.js +56 -0
- package/src/lib/utils/canvas-context-menu.js.map +1 -0
- package/src/lib/utils/canvas-reveal.d.ts +115 -0
- package/src/lib/utils/canvas-reveal.js +165 -0
- package/src/lib/utils/canvas-reveal.js.map +1 -0
- package/src/lib/utils/describe-element.d.ts +72 -0
- package/src/lib/utils/describe-element.js +159 -0
- package/src/lib/utils/describe-element.js.map +1 -0
- package/src/lib/utils/device-preview-styles.d.ts +89 -0
- package/src/lib/utils/device-preview-styles.js +228 -0
- package/src/lib/utils/device-preview-styles.js.map +1 -0
- package/src/lib/utils/docs-help.d.ts +22 -0
- package/src/lib/utils/docs-help.generated.d.ts +47 -0
- package/src/lib/utils/docs-help.generated.js +229 -0
- package/src/lib/utils/docs-help.generated.js.map +1 -0
- package/src/lib/utils/docs-help.js +37 -0
- package/src/lib/utils/docs-help.js.map +1 -0
- package/src/lib/utils/held-answers-store.d.ts +59 -0
- package/src/lib/utils/held-answers-store.js +94 -0
- package/src/lib/utils/held-answers-store.js.map +1 -0
- package/src/lib/utils/in-place-edit-surface.d.ts +118 -0
- package/src/lib/utils/in-place-edit-surface.js +164 -0
- package/src/lib/utils/in-place-edit-surface.js.map +1 -0
- package/src/lib/utils/inline-markdown-edit.store.d.ts +71 -0
- package/src/lib/utils/inline-markdown-edit.store.js +90 -0
- package/src/lib/utils/inline-markdown-edit.store.js.map +1 -0
- package/src/lib/utils/inline-text-edit.store.d.ts +85 -0
- package/src/lib/utils/inline-text-edit.store.js +78 -0
- package/src/lib/utils/inline-text-edit.store.js.map +1 -0
- package/src/lib/utils/instance-leaf-hit.d.ts +39 -0
- package/src/lib/utils/instance-leaf-hit.js +56 -0
- package/src/lib/utils/instance-leaf-hit.js.map +1 -0
- package/src/lib/utils/muted-classes.d.ts +76 -0
- package/src/lib/utils/muted-classes.js +108 -0
- package/src/lib/utils/muted-classes.js.map +1 -0
- package/src/lib/utils/muted-styles.d.ts +125 -0
- package/src/lib/utils/muted-styles.js +193 -0
- package/src/lib/utils/muted-styles.js.map +1 -0
- package/src/lib/utils/numeric-text-value.d.ts +42 -0
- package/src/lib/utils/numeric-text-value.js +47 -0
- package/src/lib/utils/numeric-text-value.js.map +1 -0
- package/src/lib/utils/preset-interactions.d.ts +37 -0
- package/src/lib/utils/preset-interactions.js +87 -0
- package/src/lib/utils/preset-interactions.js.map +1 -0
- package/src/lib/utils/publish-failure-message.d.ts +35 -0
- package/src/lib/utils/publish-failure-message.js +51 -0
- package/src/lib/utils/publish-failure-message.js.map +1 -0
- package/src/lib/utils/rank-picker-results.d.ts +45 -0
- package/src/lib/utils/rank-picker-results.js +136 -0
- package/src/lib/utils/rank-picker-results.js.map +1 -0
- package/src/lib/utils/responsive-sx.d.ts +65 -0
- package/src/lib/utils/responsive-sx.js +129 -0
- package/src/lib/utils/responsive-sx.js.map +1 -0
- package/src/lib/utils/rich-text-commands.d.ts +28 -0
- package/src/lib/utils/rich-text-commands.js +43 -0
- package/src/lib/utils/rich-text-commands.js.map +1 -0
- package/src/lib/utils/sanitize-rich-text.d.ts +52 -0
- package/src/lib/utils/sanitize-rich-text.js +173 -0
- package/src/lib/utils/sanitize-rich-text.js.map +1 -0
- package/src/lib/utils/state-sx.d.ts +255 -0
- package/src/lib/utils/state-sx.js +338 -0
- package/src/lib/utils/state-sx.js.map +1 -0
- package/src/lib/utils/style-field-groups.d.ts +136 -0
- package/src/lib/utils/style-field-groups.js +874 -0
- package/src/lib/utils/style-field-groups.js.map +1 -0
- package/src/lib/utils/style-field-search.d.ts +84 -0
- package/src/lib/utils/style-field-search.js +505 -0
- package/src/lib/utils/style-field-search.js.map +1 -0
- package/src/lib/utils/style-target.d.ts +69 -0
- package/src/lib/utils/style-target.js +203 -0
- package/src/lib/utils/style-target.js.map +1 -0
- package/src/lib/utils/theme-scale-options.d.ts +169 -0
- package/src/lib/utils/theme-scale-options.js +702 -0
- package/src/lib/utils/theme-scale-options.js.map +1 -0
- package/src/lib/utils/token-editable-dom.d.ts +82 -0
- package/src/lib/utils/token-editable-dom.js +280 -0
- package/src/lib/utils/token-editable-dom.js.map +1 -0
- package/src/lib/utils/token-segments.d.ts +111 -0
- package/src/lib/utils/token-segments.js +246 -0
- package/src/lib/utils/token-segments.js.map +1 -0
- package/src/lib/utils/visibility-styles.d.ts +38 -0
- package/src/lib/utils/visibility-styles.js +54 -0
- package/src/lib/utils/visibility-styles.js.map +1 -0
|
@@ -0,0 +1,603 @@
|
|
|
1
|
+
import { _ as _extends } from "@swc/helpers/_/_extends";
|
|
2
|
+
import { _ as _object_without_properties_loose } from "@swc/helpers/_/_object_without_properties_loose";
|
|
3
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
4
|
+
/**
|
|
5
|
+
* @license
|
|
6
|
+
* Copyright 2026 Aglyn LLC
|
|
7
|
+
*
|
|
8
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
9
|
+
* you may not use this file except in compliance with the License.
|
|
10
|
+
* You may obtain a copy of the License at
|
|
11
|
+
*
|
|
12
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
13
|
+
*
|
|
14
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
15
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
16
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
17
|
+
* See the License for the specific language governing permissions and
|
|
18
|
+
* limitations under the License.
|
|
19
|
+
*/ import { FormFieldGrid, useFieldApi, validationError } from "@aglyn/shared-ui-jsx-forms";
|
|
20
|
+
import { mdiImageSearch } from "@aglyn/shared-data-mdi";
|
|
21
|
+
import { MdiIcon } from "@aglyn/shared-ui-jsx";
|
|
22
|
+
import { Box, IconButton, InputAdornment, TextField as MuiTextField } from "@mui/material";
|
|
23
|
+
import { useContext, forwardRef, memo, useCallback, useEffect, useImperativeHandle, useLayoutEffect, useMemo, useRef, useState } from "react";
|
|
24
|
+
import MediaPickerContext from "../contexts/media-picker-context.js";
|
|
25
|
+
import { readTokenSegmentsFromDom, selectionUnitsWithin, setSelectionUnits, TOKEN_PILL_ATTR } from "../utils/token-editable-dom.js";
|
|
26
|
+
import { hasUnmaterializedTokens, parseTokenSegments, serializeTokenSegments, spliceSegmentsAtUnits, textSegment, tokenSegment, resolveTokenLabel } from "../utils/token-segments.js";
|
|
27
|
+
import { InsertTokenAdornment, InsertTokenMenu } from "./insert-token-menu.component.js";
|
|
28
|
+
import { TokenPill, TokenPillPopover, tokenPillContainerSx } from "./token-pill.component.js";
|
|
29
|
+
/**
|
|
30
|
+
* TokenTextField (AGL-586): the attributes-panel editor for token-capable
|
|
31
|
+
* free-text attributes. A contentEditable surface styled as a MUI
|
|
32
|
+
* TextField renders the value as plain text plus atomic {@link TokenPill}
|
|
33
|
+
* badges — users see resolved NAMES while the serialized value (what
|
|
34
|
+
* react-final-form holds and the node stores) keeps the raw id-based
|
|
35
|
+
* `{{...}}` grammar. Typing edits text natively; pills are clickable to
|
|
36
|
+
* replace or remove; the {x} adornment inserts at the caret (AGL-583).
|
|
37
|
+
*
|
|
38
|
+
* Model/DOM contract (mirrors the AGL-582 markdown editor): the segment
|
|
39
|
+
* model is source of truth ONLY at version bumps. Between bumps the
|
|
40
|
+
* browser owns the DOM — every `input` event silently syncs the model and
|
|
41
|
+
* emits through `input.onChange`, so the AGL-567 debounced commit treats
|
|
42
|
+
* pill edits exactly like keystrokes. Structural edits (insert/replace/
|
|
43
|
+
* remove pill, paste, Enter-newline) re-render from the model and restore
|
|
44
|
+
* the selection from unit offsets (text char = 1 unit, pill = 1 unit).
|
|
45
|
+
*
|
|
46
|
+
* Raw `{{...}}` typed by hand materializes into a pill on BLUR, not per
|
|
47
|
+
* keystroke: materializing mid-typing would re-render under the caret and
|
|
48
|
+
* fight the IME/undo stack, while on blur there is no caret to disturb.
|
|
49
|
+
*
|
|
50
|
+
* Undo: native browser undo survives for plain typing runs (no re-render
|
|
51
|
+
* happens between keystrokes), but any pill materialization/insert/remove
|
|
52
|
+
* re-renders the surface and truncates the native undo stack — the same
|
|
53
|
+
* trade the markdown editor makes, without its custom history (the canvas
|
|
54
|
+
* model keeps its own undo at commit granularity, AGL-567).
|
|
55
|
+
*/ /** Mapper key for the attributes form (editor-internal, never persisted). */ export const TOKEN_TEXT_FIELD_COMPONENT = 'aglyn-token-text-field';
|
|
56
|
+
const renderSegments = (segments, labelContext)=>segments.map((segment, index)=>{
|
|
57
|
+
var _segment_token, _segment_token1;
|
|
58
|
+
return segment.type === 'token' ? /*#__PURE__*/ _jsx(TokenPill, {
|
|
59
|
+
token: (_segment_token = segment.token) != null ? _segment_token : segment.value,
|
|
60
|
+
resolved: resolveTokenLabel((_segment_token1 = segment.token) != null ? _segment_token1 : segment.value, labelContext)
|
|
61
|
+
}, index) : segment.value;
|
|
62
|
+
});
|
|
63
|
+
/**
|
|
64
|
+
* The contentEditable input rendered INSIDE MUI's InputBase (via
|
|
65
|
+
* `inputComponent`), so the border, label notch, focus ring and disabled
|
|
66
|
+
* styling all come from the real TextField machinery.
|
|
67
|
+
*/ /**
|
|
68
|
+
* Exported for the AGL-2486 regression test only — a numeric model value must
|
|
69
|
+
* not spin this into "Maximum update depth exceeded". `TokenTextField` needs a
|
|
70
|
+
* `<Form>` context (`useFieldApi`), so the loop cannot be reached through it
|
|
71
|
+
* without standing up react-form-renderer around a bug that lives entirely in
|
|
72
|
+
* this inner component.
|
|
73
|
+
*/ export const TokenEditableInput = /*#__PURE__*/ memo(/*#__PURE__*/ forwardRef(function TokenEditableInput(props, ref) {
|
|
74
|
+
const { tokenValue: rawTokenValue, onTokenValueChange, multiline, labelContextRef, handleRef, onPillClick, className, disabled, placeholder, onFocus, onBlur } = props, rest = _object_without_properties_loose(props, [
|
|
75
|
+
"tokenValue",
|
|
76
|
+
"onTokenValueChange",
|
|
77
|
+
"multiline",
|
|
78
|
+
"labelContextRef",
|
|
79
|
+
"handleRef",
|
|
80
|
+
"onPillClick",
|
|
81
|
+
"className",
|
|
82
|
+
"disabled",
|
|
83
|
+
"placeholder",
|
|
84
|
+
"onFocus",
|
|
85
|
+
"onBlur"
|
|
86
|
+
]);
|
|
87
|
+
/**
|
|
88
|
+
* The model value as TEXT, whatever the schema actually stored.
|
|
89
|
+
*
|
|
90
|
+
* `tokenValue` is typed `string`, but `strictNullChecks` is off repo-wide
|
|
91
|
+
* and a schema's `initialValue` reaches this untouched — so a numeric
|
|
92
|
+
* default arrives as a NUMBER. That was not hypothetical: the element
|
|
93
|
+
* animation fields (AGL-2486) declare `TEXT_FIELD` with
|
|
94
|
+
* `ANIMATION_DEFAULT_DURATION_MS = 600` and `ANIMATION_DEFAULT_DELAY_MS =
|
|
95
|
+
* 0`, and the attributes memo rewrites TEXT_FIELD to this editor.
|
|
96
|
+
*
|
|
97
|
+
* The damage was an INFINITE RENDER LOOP, not a mis-render. `emit`
|
|
98
|
+
* serializes segments and stores a STRING in `lastEmittedRef`, and the
|
|
99
|
+
* sync effect below skips on `tokenValue === lastEmittedRef.current`.
|
|
100
|
+
* `600 === '600'` is false, so the guard never held: every render
|
|
101
|
+
* re-parsed the model and bumped `version`, and React eventually threw
|
|
102
|
+
* "Maximum update depth exceeded".
|
|
103
|
+
*
|
|
104
|
+
* Coerced at the boundary rather than fixed at the one call site, because
|
|
105
|
+
* the next numeric default would reintroduce it. `null`/`undefined`
|
|
106
|
+
* become `''` explicitly — `String(null)` is the string "null", which
|
|
107
|
+
* would render the word in the box, and `0` must survive as "0" rather
|
|
108
|
+
* than being swallowed as falsy.
|
|
109
|
+
*/ const tokenValue = typeof rawTokenValue === 'string' ? rawTokenValue : rawTokenValue === null || rawTokenValue === undefined ? '' : String(rawTokenValue);
|
|
110
|
+
const editableRef = useRef(null);
|
|
111
|
+
const segmentsRef = useRef(null);
|
|
112
|
+
if (segmentsRef.current == null) {
|
|
113
|
+
segmentsRef.current = parseTokenSegments(tokenValue);
|
|
114
|
+
}
|
|
115
|
+
const lastEmittedRef = useRef(tokenValue);
|
|
116
|
+
const pendingSelectionRef = useRef(null);
|
|
117
|
+
const [version, setVersion] = useState(0);
|
|
118
|
+
// MUI focuses the input through `inputRef` on label clicks; `.value`
|
|
119
|
+
// keeps InputBase's filled-state probe from reading `undefined`.
|
|
120
|
+
useImperativeHandle(ref, ()=>({
|
|
121
|
+
focus: ()=>{
|
|
122
|
+
var _editableRef_current;
|
|
123
|
+
return (_editableRef_current = editableRef.current) == null ? void 0 : _editableRef_current.focus();
|
|
124
|
+
},
|
|
125
|
+
get value () {
|
|
126
|
+
return lastEmittedRef.current;
|
|
127
|
+
},
|
|
128
|
+
node: editableRef.current
|
|
129
|
+
}));
|
|
130
|
+
// External value changes (form reset, AI rewrite, undo at canvas
|
|
131
|
+
// level): anything this surface didn't just emit re-parses the model.
|
|
132
|
+
useEffect(()=>{
|
|
133
|
+
if (tokenValue === lastEmittedRef.current) return;
|
|
134
|
+
segmentsRef.current = parseTokenSegments(tokenValue);
|
|
135
|
+
lastEmittedRef.current = tokenValue;
|
|
136
|
+
pendingSelectionRef.current = null;
|
|
137
|
+
setVersion((current)=>current + 1);
|
|
138
|
+
}, [
|
|
139
|
+
tokenValue
|
|
140
|
+
]);
|
|
141
|
+
const emit = useCallback((segments)=>{
|
|
142
|
+
segmentsRef.current = segments;
|
|
143
|
+
let serialized = serializeTokenSegments(segments);
|
|
144
|
+
// An emptied contentEditable leaves a stray <br> behind in most
|
|
145
|
+
// browsers — a value that is exactly one newline means "empty".
|
|
146
|
+
if (serialized === '\n') serialized = '';
|
|
147
|
+
lastEmittedRef.current = serialized;
|
|
148
|
+
onTokenValueChange(serialized);
|
|
149
|
+
return serialized;
|
|
150
|
+
}, [
|
|
151
|
+
onTokenValueChange
|
|
152
|
+
]);
|
|
153
|
+
/** Structural edit: re-render from the model + restore the caret. */ const commitStructural = useCallback((segments, selection)=>{
|
|
154
|
+
emit(segments);
|
|
155
|
+
pendingSelectionRef.current = selection;
|
|
156
|
+
setVersion((current)=>current + 1);
|
|
157
|
+
}, [
|
|
158
|
+
emit
|
|
159
|
+
]);
|
|
160
|
+
useLayoutEffect(()=>{
|
|
161
|
+
const pending = pendingSelectionRef.current;
|
|
162
|
+
if (!pending || !editableRef.current) return;
|
|
163
|
+
pendingSelectionRef.current = null;
|
|
164
|
+
editableRef.current.focus();
|
|
165
|
+
setSelectionUnits(editableRef.current, pending.start, pending.end);
|
|
166
|
+
}, [
|
|
167
|
+
version
|
|
168
|
+
]);
|
|
169
|
+
// Plain typing: silent model sync — no re-render, the DOM is already
|
|
170
|
+
// correct and the caret must not move (AGL-582 pattern).
|
|
171
|
+
const handleInput = useCallback((_event)=>{
|
|
172
|
+
if (!editableRef.current) return;
|
|
173
|
+
emit(readTokenSegmentsFromDom(editableRef.current));
|
|
174
|
+
}, [
|
|
175
|
+
emit
|
|
176
|
+
]);
|
|
177
|
+
const handleKeyDown = useCallback((event)=>{
|
|
178
|
+
var _ref, _ref1;
|
|
179
|
+
if (event.key !== 'Enter' || event.nativeEvent.isComposing) return;
|
|
180
|
+
// Single-line surfaces swallow Enter (a contentEditable would
|
|
181
|
+
// otherwise fork the DOM into divs); multiline inserts a literal
|
|
182
|
+
// newline as a model edit so the DOM stays flat text + pills.
|
|
183
|
+
event.preventDefault();
|
|
184
|
+
if (!multiline || !editableRef.current) return;
|
|
185
|
+
const current = readTokenSegmentsFromDom(editableRef.current);
|
|
186
|
+
const selection = selectionUnitsWithin(editableRef.current);
|
|
187
|
+
const { segments, caretUnit } = spliceSegmentsAtUnits(current, [
|
|
188
|
+
textSegment('\n')
|
|
189
|
+
], (_ref = selection == null ? void 0 : selection.start) != null ? _ref : null, (_ref1 = selection == null ? void 0 : selection.end) != null ? _ref1 : null);
|
|
190
|
+
commitStructural(segments, {
|
|
191
|
+
start: caretUnit,
|
|
192
|
+
end: caretUnit
|
|
193
|
+
});
|
|
194
|
+
}, [
|
|
195
|
+
commitStructural,
|
|
196
|
+
multiline
|
|
197
|
+
]);
|
|
198
|
+
// Paste is plain-text only; pasted `{{...}}` materializes immediately
|
|
199
|
+
// (the paste is already a structural, selection-restoring edit).
|
|
200
|
+
const handlePaste = useCallback((event)=>{
|
|
201
|
+
var _ref, _ref1, _ref2;
|
|
202
|
+
var _event_clipboardData;
|
|
203
|
+
event.preventDefault();
|
|
204
|
+
if (!editableRef.current) return;
|
|
205
|
+
const raw = (_ref = (_event_clipboardData = event.clipboardData) == null ? void 0 : _event_clipboardData.getData('text/plain')) != null ? _ref : '';
|
|
206
|
+
if (!raw) return;
|
|
207
|
+
const text = multiline ? raw : raw.replace(/\s*\n+\s*/g, ' ');
|
|
208
|
+
const current = readTokenSegmentsFromDom(editableRef.current);
|
|
209
|
+
const selection = selectionUnitsWithin(editableRef.current);
|
|
210
|
+
const { segments, caretUnit } = spliceSegmentsAtUnits(current, parseTokenSegments(text), (_ref1 = selection == null ? void 0 : selection.start) != null ? _ref1 : null, (_ref2 = selection == null ? void 0 : selection.end) != null ? _ref2 : null);
|
|
211
|
+
commitStructural(segments, {
|
|
212
|
+
start: caretUnit,
|
|
213
|
+
end: caretUnit
|
|
214
|
+
});
|
|
215
|
+
}, [
|
|
216
|
+
commitStructural,
|
|
217
|
+
multiline
|
|
218
|
+
]);
|
|
219
|
+
// Raw `{{...}}` typed by hand becomes a pill when focus leaves — the
|
|
220
|
+
// least caret-disruptive point (see the component doc block).
|
|
221
|
+
const handleBlur = useCallback((event)=>{
|
|
222
|
+
var _segmentsRef_current;
|
|
223
|
+
onBlur == null ? void 0 : onBlur(event);
|
|
224
|
+
const segments = (_segmentsRef_current = segmentsRef.current) != null ? _segmentsRef_current : [];
|
|
225
|
+
if (!hasUnmaterializedTokens(segments)) return;
|
|
226
|
+
commitStructural(parseTokenSegments(serializeTokenSegments(segments)), null);
|
|
227
|
+
}, [
|
|
228
|
+
commitStructural,
|
|
229
|
+
onBlur
|
|
230
|
+
]);
|
|
231
|
+
// Pill clicks bubble to the surface (delegation keeps pills dumb).
|
|
232
|
+
const handleClick = useCallback((event)=>{
|
|
233
|
+
var _pill_getAttribute;
|
|
234
|
+
var _editableRef_current;
|
|
235
|
+
const pill = event.target.closest == null ? void 0 : event.target.closest.call(event.target, `[${TOKEN_PILL_ATTR}]`);
|
|
236
|
+
if (!pill || !((_editableRef_current = editableRef.current) == null ? void 0 : _editableRef_current.contains(pill))) return;
|
|
237
|
+
const pills = Array.from(editableRef.current.querySelectorAll(`[${TOKEN_PILL_ATTR}]`));
|
|
238
|
+
onPillClick(pill, pills.indexOf(pill), (_pill_getAttribute = pill.getAttribute(TOKEN_PILL_ATTR)) != null ? _pill_getAttribute : '');
|
|
239
|
+
}, [
|
|
240
|
+
onPillClick
|
|
241
|
+
]);
|
|
242
|
+
/** Index (within segments) of the nth token segment. */ const segmentIndexOfToken = (tokenIndex)=>{
|
|
243
|
+
var _segmentsRef_current;
|
|
244
|
+
const segments = (_segmentsRef_current = segmentsRef.current) != null ? _segmentsRef_current : [];
|
|
245
|
+
let seen = -1;
|
|
246
|
+
for(let index = 0; index < segments.length; index++){
|
|
247
|
+
var _segments_index;
|
|
248
|
+
if (((_segments_index = segments[index]) == null ? void 0 : _segments_index.type) === 'token' && ++seen === tokenIndex) {
|
|
249
|
+
return index;
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
return -1;
|
|
253
|
+
};
|
|
254
|
+
useImperativeHandle(handleRef, ()=>({
|
|
255
|
+
captureSelection: ()=>editableRef.current ? selectionUnitsWithin(editableRef.current) : null,
|
|
256
|
+
insertToken: (token, capture)=>{
|
|
257
|
+
var _segmentsRef_current, _ref, _ref1;
|
|
258
|
+
const { segments, caretUnit } = spliceSegmentsAtUnits((_segmentsRef_current = segmentsRef.current) != null ? _segmentsRef_current : [], [
|
|
259
|
+
tokenSegment(token)
|
|
260
|
+
], (_ref = capture == null ? void 0 : capture.start) != null ? _ref : null, (_ref1 = capture == null ? void 0 : capture.end) != null ? _ref1 : null);
|
|
261
|
+
commitStructural(segments, {
|
|
262
|
+
start: caretUnit,
|
|
263
|
+
end: caretUnit
|
|
264
|
+
});
|
|
265
|
+
},
|
|
266
|
+
replaceTokenAt: (tokenIndex, token)=>{
|
|
267
|
+
var _segmentsRef_current;
|
|
268
|
+
const index = segmentIndexOfToken(tokenIndex);
|
|
269
|
+
if (index < 0) return;
|
|
270
|
+
const segments = [
|
|
271
|
+
...(_segmentsRef_current = segmentsRef.current) != null ? _segmentsRef_current : []
|
|
272
|
+
];
|
|
273
|
+
segments[index] = tokenSegment(token);
|
|
274
|
+
commitStructural(segments, null);
|
|
275
|
+
},
|
|
276
|
+
removeTokenAt: (tokenIndex)=>{
|
|
277
|
+
var _segmentsRef_current;
|
|
278
|
+
const index = segmentIndexOfToken(tokenIndex);
|
|
279
|
+
if (index < 0) return;
|
|
280
|
+
const segments = [
|
|
281
|
+
...(_segmentsRef_current = segmentsRef.current) != null ? _segmentsRef_current : []
|
|
282
|
+
];
|
|
283
|
+
segments.splice(index, 1);
|
|
284
|
+
commitStructural(segments, null);
|
|
285
|
+
}
|
|
286
|
+
}), [
|
|
287
|
+
commitStructural
|
|
288
|
+
]);
|
|
289
|
+
// Children are FROZEN per version (AGL-582 pattern): parent re-renders
|
|
290
|
+
// (form state changes every keystroke) receive identical element
|
|
291
|
+
// references, so React never touches the browser-managed DOM. A
|
|
292
|
+
// version bump swaps the key, remounting cleanly from the model.
|
|
293
|
+
// Label context is read at render time; renamed variables re-label on
|
|
294
|
+
// the next structural edit rather than yanking the caret mid-typing.
|
|
295
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
296
|
+
const children = useMemo(()=>{
|
|
297
|
+
var _segmentsRef_current;
|
|
298
|
+
return renderSegments((_segmentsRef_current = segmentsRef.current) != null ? _segmentsRef_current : [], labelContextRef.current);
|
|
299
|
+
}, [
|
|
300
|
+
version
|
|
301
|
+
]);
|
|
302
|
+
return /*#__PURE__*/ _jsx(Box, _extends({
|
|
303
|
+
ref: editableRef,
|
|
304
|
+
component: "div",
|
|
305
|
+
contentEditable: !disabled,
|
|
306
|
+
suppressContentEditableWarning: true,
|
|
307
|
+
role: "textbox",
|
|
308
|
+
"aria-multiline": Boolean(multiline),
|
|
309
|
+
"data-placeholder": placeholder != null ? placeholder : '',
|
|
310
|
+
"data-testid": "token-text-field",
|
|
311
|
+
className: className,
|
|
312
|
+
onInput: handleInput,
|
|
313
|
+
onKeyDown: handleKeyDown,
|
|
314
|
+
onPaste: handlePaste,
|
|
315
|
+
onFocus: onFocus,
|
|
316
|
+
onBlur: handleBlur,
|
|
317
|
+
onClick: handleClick
|
|
318
|
+
}, rest, {
|
|
319
|
+
sx: _extends({
|
|
320
|
+
outline: 'none',
|
|
321
|
+
width: '100%',
|
|
322
|
+
whiteSpace: 'pre-wrap',
|
|
323
|
+
wordBreak: 'break-word',
|
|
324
|
+
minHeight: multiline ? '4.5em' : undefined,
|
|
325
|
+
'&:empty::before': {
|
|
326
|
+
content: 'attr(data-placeholder)',
|
|
327
|
+
color: 'text.disabled'
|
|
328
|
+
}
|
|
329
|
+
}, tokenPillContainerSx),
|
|
330
|
+
children: children
|
|
331
|
+
}), version);
|
|
332
|
+
}));
|
|
333
|
+
/**
|
|
334
|
+
* The "Browse media" end adornment (AGL-2236).
|
|
335
|
+
*
|
|
336
|
+
* The control every `src` field's helper text has named since AGL-1215 —
|
|
337
|
+
* "Pick from your media library with 'Browse media'" — and which, until now,
|
|
338
|
+
* lived at the BOTTOM of the Attributes panel, below the Save Element
|
|
339
|
+
* button, separated from the field it fills by every other attribute the
|
|
340
|
+
* element declares. On the Image element that is six fields and a submit
|
|
341
|
+
* button of scroll, and with a single media attribute the button read only
|
|
342
|
+
* "Browse media", naming no field. Authors reported it as missing, which for
|
|
343
|
+
* a no-code product it effectively was: the documented way to change an
|
|
344
|
+
* image was to hand-type a `media:org:…/…` reference.
|
|
345
|
+
*
|
|
346
|
+
* Mousedown is prevented so the field keeps focus while the dialog opens —
|
|
347
|
+
* the same reason {@link InsertTokenAdornment} does it. Losing focus here
|
|
348
|
+
* would flush the AGL-567 debounce and commit a half-typed value on the way
|
|
349
|
+
* to picking a different one.
|
|
350
|
+
*/ export function BrowseMediaAdornment(props) {
|
|
351
|
+
const { onBrowse } = props;
|
|
352
|
+
return /*#__PURE__*/ _jsx(InputAdornment, {
|
|
353
|
+
position: "end",
|
|
354
|
+
children: /*#__PURE__*/ _jsx(IconButton, {
|
|
355
|
+
"aria-label": "Browse media",
|
|
356
|
+
title: "Browse media",
|
|
357
|
+
size: "small",
|
|
358
|
+
edge: "end",
|
|
359
|
+
onMouseDown: (event)=>event.preventDefault(),
|
|
360
|
+
onClick: ()=>onBrowse(),
|
|
361
|
+
children: /*#__PURE__*/ _jsx(MdiIcon, {
|
|
362
|
+
path: mdiImageSearch.path,
|
|
363
|
+
fontSize: "small"
|
|
364
|
+
})
|
|
365
|
+
})
|
|
366
|
+
});
|
|
367
|
+
}
|
|
368
|
+
BrowseMediaAdornment.displayName = 'BrowseMediaAdornment';
|
|
369
|
+
/**
|
|
370
|
+
* The data-driven-forms field (registered as
|
|
371
|
+
* {@link TOKEN_TEXT_FIELD_COMPONENT} in the attributes mapper). The
|
|
372
|
+
* serialized string flows through react-final-form exactly like the plain
|
|
373
|
+
* TextField it replaces — the AGL-567 debounced autosave sees ordinary
|
|
374
|
+
* value changes and commits through the existing path.
|
|
375
|
+
*/ export const TokenTextField = (props)=>{
|
|
376
|
+
var _ref, _ref1, _ref2;
|
|
377
|
+
const _useFieldApi = useFieldApi(props), { input, isReadOnly, isDisabled, placeholder, isRequired, label, helperText, description, validateOnMount, meta, multiline, tokenOptions = [], tokenLabelContext = {}, FormFieldGridProps = {}, // Destructured, never spread onto the input: it is a function, and
|
|
378
|
+
// `...rest` lands on a DOM element.
|
|
379
|
+
onBrowseMedia, // Swallowed: htmlInput props from legacy schemas don't apply to a
|
|
380
|
+
// contentEditable surface.
|
|
381
|
+
inputProps: _inputProps } = _useFieldApi, rest = _object_without_properties_loose(_useFieldApi, [
|
|
382
|
+
"input",
|
|
383
|
+
"isReadOnly",
|
|
384
|
+
"isDisabled",
|
|
385
|
+
"placeholder",
|
|
386
|
+
"isRequired",
|
|
387
|
+
"label",
|
|
388
|
+
"helperText",
|
|
389
|
+
"description",
|
|
390
|
+
"validateOnMount",
|
|
391
|
+
"meta",
|
|
392
|
+
"multiline",
|
|
393
|
+
"tokenOptions",
|
|
394
|
+
"tokenLabelContext",
|
|
395
|
+
"FormFieldGridProps",
|
|
396
|
+
"onBrowseMedia",
|
|
397
|
+
"inputProps"
|
|
398
|
+
]);
|
|
399
|
+
const invalid = validationError(meta, validateOnMount);
|
|
400
|
+
// The site's approved image hosts, for the media warning below. Read from
|
|
401
|
+
// the SAME context that supplies "Browse media", so a designer mounted
|
|
402
|
+
// without a media provider simply has no list and warns about nothing.
|
|
403
|
+
const { approvedImageHosts } = useContext(MediaPickerContext);
|
|
404
|
+
const handleRef = useRef(null);
|
|
405
|
+
// Ref so the frozen editable children read fresh labels at render time
|
|
406
|
+
// without re-rendering on every context identity change.
|
|
407
|
+
const labelContextRef = useRef(tokenLabelContext);
|
|
408
|
+
labelContextRef.current = tokenLabelContext;
|
|
409
|
+
const [insertMenu, setInsertMenu] = useState(null);
|
|
410
|
+
const [pillMenu, setPillMenu] = useState(null);
|
|
411
|
+
const value = typeof input.value === 'string' ? input.value : input.value == null ? '' : String(input.value);
|
|
412
|
+
const handleOpenInsert = useCallback((anchor)=>{
|
|
413
|
+
var _ref;
|
|
414
|
+
var _handleRef_current;
|
|
415
|
+
// The adornment's mousedown is prevented (AGL-583), so the surface
|
|
416
|
+
// selection is still live here — capture it in unit offsets.
|
|
417
|
+
setInsertMenu({
|
|
418
|
+
anchorEl: anchor,
|
|
419
|
+
capture: (_ref = (_handleRef_current = handleRef.current) == null ? void 0 : _handleRef_current.captureSelection()) != null ? _ref : null,
|
|
420
|
+
replaceIndex: null
|
|
421
|
+
});
|
|
422
|
+
}, []);
|
|
423
|
+
const handleInsert = useCallback((token)=>{
|
|
424
|
+
if ((insertMenu == null ? void 0 : insertMenu.replaceIndex) != null) {
|
|
425
|
+
var _handleRef_current;
|
|
426
|
+
(_handleRef_current = handleRef.current) == null ? void 0 : _handleRef_current.replaceTokenAt(insertMenu.replaceIndex, token);
|
|
427
|
+
} else {
|
|
428
|
+
var _ref;
|
|
429
|
+
var _handleRef_current1;
|
|
430
|
+
(_handleRef_current1 = handleRef.current) == null ? void 0 : _handleRef_current1.insertToken(token, (_ref = insertMenu == null ? void 0 : insertMenu.capture) != null ? _ref : null);
|
|
431
|
+
}
|
|
432
|
+
setInsertMenu(null);
|
|
433
|
+
}, [
|
|
434
|
+
insertMenu
|
|
435
|
+
]);
|
|
436
|
+
const handlePillClick = useCallback((anchorEl, tokenIndex, token)=>{
|
|
437
|
+
setPillMenu({
|
|
438
|
+
anchorEl,
|
|
439
|
+
tokenIndex,
|
|
440
|
+
token
|
|
441
|
+
});
|
|
442
|
+
}, []);
|
|
443
|
+
const handlePillReplace = useCallback(()=>{
|
|
444
|
+
if (pillMenu) {
|
|
445
|
+
setInsertMenu({
|
|
446
|
+
anchorEl: pillMenu.anchorEl,
|
|
447
|
+
capture: null,
|
|
448
|
+
replaceIndex: pillMenu.tokenIndex
|
|
449
|
+
});
|
|
450
|
+
}
|
|
451
|
+
setPillMenu(null);
|
|
452
|
+
}, [
|
|
453
|
+
pillMenu
|
|
454
|
+
]);
|
|
455
|
+
const handlePillRemove = useCallback(()=>{
|
|
456
|
+
var _handleRef_current;
|
|
457
|
+
if (pillMenu) (_handleRef_current = handleRef.current) == null ? void 0 : _handleRef_current.removeTokenAt(pillMenu.tokenIndex);
|
|
458
|
+
setPillMenu(null);
|
|
459
|
+
}, [
|
|
460
|
+
pillMenu
|
|
461
|
+
]);
|
|
462
|
+
/**
|
|
463
|
+
* "This image will be blocked on the published page" (AGL-1152).
|
|
464
|
+
*
|
|
465
|
+
* The published site's `img-src` is built from the owner's approved-host
|
|
466
|
+
* list, so an external URL from a host they have not approved renders as a
|
|
467
|
+
* broken image for every visitor — and the author is the last person who
|
|
468
|
+
* would find out, because the besigner canvas has no such policy. Saying it
|
|
469
|
+
* HERE, at the moment the URL is typed, is the whole reason enforcing the
|
|
470
|
+
* policy is safe to do at all.
|
|
471
|
+
*
|
|
472
|
+
* Deliberately a WARNING, not a validation error: the value is legitimate,
|
|
473
|
+
* the author may be about to approve the host, and refusing the keystroke
|
|
474
|
+
* would make the picker unusable while they do. It also never fires on:
|
|
475
|
+
*
|
|
476
|
+
* - a non-media field (`onBrowseMedia` is the discriminator the panel
|
|
477
|
+
* already uses for "this attribute holds media");
|
|
478
|
+
* - a relative path, a `media:` reference, a `data:`/`blob:` URL, or
|
|
479
|
+
* anything unparseable — none of those reach an external host;
|
|
480
|
+
* - a token-bearing value, because `{{...}}` resolves at render and the
|
|
481
|
+
* host is not knowable here;
|
|
482
|
+
* - ANY value when the list is not known (see the context docs), because a
|
|
483
|
+
* warning that fires on everything is one authors learn to ignore.
|
|
484
|
+
*/ const externalHostWarning = useMemo(()=>{
|
|
485
|
+
if (!onBrowseMedia) return null;
|
|
486
|
+
if (!approvedImageHosts) return null;
|
|
487
|
+
const raw = typeof value === 'string' ? value.trim() : '';
|
|
488
|
+
if (!raw || raw.includes('{{')) return null;
|
|
489
|
+
if (!/^https?:\/\//i.test(raw)) return null;
|
|
490
|
+
let hostname = '';
|
|
491
|
+
try {
|
|
492
|
+
hostname = new URL(raw).hostname.toLowerCase();
|
|
493
|
+
} catch (unused) {
|
|
494
|
+
return null;
|
|
495
|
+
}
|
|
496
|
+
if (!hostname) return null;
|
|
497
|
+
// Same-origin and the pinned Storage host are always served.
|
|
498
|
+
if (hostname === 'firebasestorage.googleapis.com') return null;
|
|
499
|
+
const approved = approvedImageHosts.some((entry)=>{
|
|
500
|
+
const candidate = String(entry != null ? entry : '').trim().toLowerCase();
|
|
501
|
+
if (!candidate) return false;
|
|
502
|
+
if (candidate.startsWith('*.')) {
|
|
503
|
+
const suffix = candidate.slice(1) // ".example.com"
|
|
504
|
+
;
|
|
505
|
+
return hostname.endsWith(suffix);
|
|
506
|
+
}
|
|
507
|
+
return hostname === candidate;
|
|
508
|
+
});
|
|
509
|
+
if (approved) return null;
|
|
510
|
+
return `${hostname} is not an approved image host for this site, so this image will not load for visitors. Add it under Setup → Approved image hosts.`;
|
|
511
|
+
}, [
|
|
512
|
+
onBrowseMedia,
|
|
513
|
+
approvedImageHosts,
|
|
514
|
+
value
|
|
515
|
+
]);
|
|
516
|
+
return /*#__PURE__*/ _jsxs(FormFieldGrid, _extends({}, FormFieldGridProps, {
|
|
517
|
+
children: [
|
|
518
|
+
/*#__PURE__*/ _jsx(MuiTextField, _extends({
|
|
519
|
+
fullWidth: true,
|
|
520
|
+
error: !!invalid,
|
|
521
|
+
helperText: invalid || (meta.touched || validateOnMount) && meta.warning || externalHostWarning || helperText || description,
|
|
522
|
+
disabled: isDisabled,
|
|
523
|
+
label: label,
|
|
524
|
+
required: isRequired,
|
|
525
|
+
onFocus: input.onFocus,
|
|
526
|
+
onBlur: input.onBlur,
|
|
527
|
+
slotProps: {
|
|
528
|
+
// The surface holds pills, not text MUI can measure — keep the
|
|
529
|
+
// label out of the way permanently.
|
|
530
|
+
inputLabel: {
|
|
531
|
+
shrink: true
|
|
532
|
+
},
|
|
533
|
+
input: {
|
|
534
|
+
readOnly: isReadOnly,
|
|
535
|
+
// The surface is a contentEditable that WRAPS, but MUI's
|
|
536
|
+
// single-line input root is a fixed-height flex row (AGL-1214).
|
|
537
|
+
// A long unbroken value — a media URL is the common case —
|
|
538
|
+
// painted straight through the outline and over the next
|
|
539
|
+
// field's label. Let the root grow, and keep the token-insert
|
|
540
|
+
// adornment pinned to the first line rather than centred
|
|
541
|
+
// against a now-tall box.
|
|
542
|
+
sx: {
|
|
543
|
+
height: 'auto',
|
|
544
|
+
alignItems: 'flex-start',
|
|
545
|
+
// The contentEditable IS `.MuiInputBase-input`, and MUI pins
|
|
546
|
+
// that to one line's height for a non-multiline field. The
|
|
547
|
+
// surface wraps regardless, so the content just painted
|
|
548
|
+
// outside the outline. Cap it and scroll instead of letting a
|
|
549
|
+
// long URL push the panel around.
|
|
550
|
+
'& .MuiInputBase-input': {
|
|
551
|
+
height: 'auto',
|
|
552
|
+
maxHeight: '8.5em',
|
|
553
|
+
overflowY: 'auto'
|
|
554
|
+
},
|
|
555
|
+
'& .MuiInputAdornment-root': {
|
|
556
|
+
mt: '4px'
|
|
557
|
+
}
|
|
558
|
+
},
|
|
559
|
+
inputComponent: TokenEditableInput,
|
|
560
|
+
inputProps: {
|
|
561
|
+
tokenValue: value,
|
|
562
|
+
onTokenValueChange: input.onChange,
|
|
563
|
+
multiline: Boolean(multiline),
|
|
564
|
+
labelContextRef,
|
|
565
|
+
handleRef,
|
|
566
|
+
onPillClick: handlePillClick,
|
|
567
|
+
placeholder,
|
|
568
|
+
disabled: isDisabled || isReadOnly
|
|
569
|
+
},
|
|
570
|
+
endAdornment: /*#__PURE__*/ _jsxs(_Fragment, {
|
|
571
|
+
children: [
|
|
572
|
+
onBrowseMedia ? /*#__PURE__*/ _jsx(BrowseMediaAdornment, {
|
|
573
|
+
onBrowse: onBrowseMedia
|
|
574
|
+
}) : null,
|
|
575
|
+
/*#__PURE__*/ _jsx(InsertTokenAdornment, {
|
|
576
|
+
onOpen: (anchor)=>handleOpenInsert(anchor)
|
|
577
|
+
})
|
|
578
|
+
]
|
|
579
|
+
})
|
|
580
|
+
}
|
|
581
|
+
}
|
|
582
|
+
}, rest)),
|
|
583
|
+
/*#__PURE__*/ _jsx(InsertTokenMenu, {
|
|
584
|
+
anchorEl: (_ref = insertMenu == null ? void 0 : insertMenu.anchorEl) != null ? _ref : null,
|
|
585
|
+
open: Boolean(insertMenu),
|
|
586
|
+
onClose: ()=>setInsertMenu(null),
|
|
587
|
+
options: tokenOptions,
|
|
588
|
+
onInsert: handleInsert
|
|
589
|
+
}),
|
|
590
|
+
/*#__PURE__*/ _jsx(TokenPillPopover, {
|
|
591
|
+
anchorEl: (_ref1 = pillMenu == null ? void 0 : pillMenu.anchorEl) != null ? _ref1 : null,
|
|
592
|
+
token: (_ref2 = pillMenu == null ? void 0 : pillMenu.token) != null ? _ref2 : '',
|
|
593
|
+
onClose: ()=>setPillMenu(null),
|
|
594
|
+
onReplace: handlePillReplace,
|
|
595
|
+
onRemove: handlePillRemove
|
|
596
|
+
})
|
|
597
|
+
]
|
|
598
|
+
}));
|
|
599
|
+
};
|
|
600
|
+
TokenTextField.displayName = 'TokenTextField';
|
|
601
|
+
export default TokenTextField;
|
|
602
|
+
|
|
603
|
+
//# sourceMappingURL=token-text-field.component.js.map
|