@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,68 @@
|
|
|
1
|
+
export interface AnchoredRect {
|
|
2
|
+
left: number;
|
|
3
|
+
top: number;
|
|
4
|
+
width: number;
|
|
5
|
+
height: number;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Tracks where an anchor element actually is, for the fixed overlays that edit
|
|
9
|
+
* a canvas element in place (AGL-1644).
|
|
10
|
+
*
|
|
11
|
+
* ## The bug this fixes
|
|
12
|
+
*
|
|
13
|
+
* `inline-text-editor` and `inline-markdown-editor` both anchored on a
|
|
14
|
+
* `getBoundingClientRect()` taken ONCE, when the double-click opened them. The
|
|
15
|
+
* rect was never recomputed, so scrolling the canvas — or resizing the window,
|
|
16
|
+
* or switching the artboard's device preview — left the editor sitting over
|
|
17
|
+
* unrelated chrome while the element it was editing had moved away. It matters
|
|
18
|
+
* most for the markdown editor, where the document is routinely taller than the
|
|
19
|
+
* viewport and scrolling mid-edit is ordinary rather than exceptional.
|
|
20
|
+
*
|
|
21
|
+
* ## Why the live rect IS "the canvas's own coordinate system"
|
|
22
|
+
*
|
|
23
|
+
* The overlays render outside the canvas' CLOSED shadow root, so viewport
|
|
24
|
+
* coordinates are the only frame of reference the two sides share — there is no
|
|
25
|
+
* canvas-space transform to be had from outside. `getBoundingClientRect()` on
|
|
26
|
+
* the live element is that shared frame, continuously: it already accounts for
|
|
27
|
+
* every ancestor's scroll, for the shadow host's own layout, and for any CSS
|
|
28
|
+
* transform in between.
|
|
29
|
+
*
|
|
30
|
+
* That last point is the pan/zoom answer. `ZoomablePanningComponent` is NOT
|
|
31
|
+
* currently mounted — the only reference to it in the canvas is a commented-out
|
|
32
|
+
* import in `viewport-canvas.component.tsx` — so there is no transform to
|
|
33
|
+
* handle today. If one is ever mounted, a live rect follows it with no further
|
|
34
|
+
* work, which a stored rect plus a hand-written transform never would.
|
|
35
|
+
*
|
|
36
|
+
* ## The listeners, and why they are the ones NodeOverlay already uses
|
|
37
|
+
*
|
|
38
|
+
* This is deliberately the same recipe as `node-overlay.tsx`, which solved this
|
|
39
|
+
* exact problem for the selection outline: a `ResizeObserver` on the element and
|
|
40
|
+
* on its shadow host, `resize` on the window, and — the one that matters here —
|
|
41
|
+
* a CAPTURE-phase `scroll` listener, because scroll does not bubble and the
|
|
42
|
+
* scrolling ancestor may be the canvas container, a panel, or the page body.
|
|
43
|
+
*
|
|
44
|
+
* ## The anchor is passed in, not looked up
|
|
45
|
+
*
|
|
46
|
+
* `Besigner.refs.get($id)` would cover three of the four ways these editors
|
|
47
|
+
* open, and silently miss the fourth: an instance prop edit (AGL-1304) anchors
|
|
48
|
+
* on a GRAFTED preview leaf, which is not a canvas node and has no ref. The
|
|
49
|
+
* call site already holds the exact element it measured, so it hands it over.
|
|
50
|
+
*
|
|
51
|
+
* With no anchor — a store opened without one, or a test — the fallback rect is
|
|
52
|
+
* returned unchanged, so the previous behavior is what a caller gets for free.
|
|
53
|
+
*/
|
|
54
|
+
export declare function useAnchoredRect(anchor: Element | undefined, fallback: AnchoredRect): AnchoredRect;
|
|
55
|
+
/**
|
|
56
|
+
* Keeps a following overlay reachable when its anchor leaves the viewport.
|
|
57
|
+
*
|
|
58
|
+
* The clamp is not a substitute for the tracking above and is not a second one:
|
|
59
|
+
* AGL-1624 clamped a rect that never changed, which is why its own author
|
|
60
|
+
* called it a floor rather than a fix. Applied to a LIVE rect it means what it
|
|
61
|
+
* says — while the element is off-screen the editor waits at the nearest edge,
|
|
62
|
+
* and it slides back onto the element the moment the element is visible again.
|
|
63
|
+
*
|
|
64
|
+
* Reading the viewport size at render is safe precisely because the hook above
|
|
65
|
+
* re-renders on every scroll and resize, so the value is never stale.
|
|
66
|
+
*/
|
|
67
|
+
export declare function clampToViewport(value: number, size: number, extent: number, margin?: number): number;
|
|
68
|
+
export default useAnchoredRect;
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2026 Aglyn LLC
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/ 'use client';
|
|
17
|
+
import { useIsomorphicLayoutEffect } from "@aglyn/shared-ui-jsx";
|
|
18
|
+
import { useState } from "react";
|
|
19
|
+
/**
|
|
20
|
+
* Tracks where an anchor element actually is, for the fixed overlays that edit
|
|
21
|
+
* a canvas element in place (AGL-1644).
|
|
22
|
+
*
|
|
23
|
+
* ## The bug this fixes
|
|
24
|
+
*
|
|
25
|
+
* `inline-text-editor` and `inline-markdown-editor` both anchored on a
|
|
26
|
+
* `getBoundingClientRect()` taken ONCE, when the double-click opened them. The
|
|
27
|
+
* rect was never recomputed, so scrolling the canvas — or resizing the window,
|
|
28
|
+
* or switching the artboard's device preview — left the editor sitting over
|
|
29
|
+
* unrelated chrome while the element it was editing had moved away. It matters
|
|
30
|
+
* most for the markdown editor, where the document is routinely taller than the
|
|
31
|
+
* viewport and scrolling mid-edit is ordinary rather than exceptional.
|
|
32
|
+
*
|
|
33
|
+
* ## Why the live rect IS "the canvas's own coordinate system"
|
|
34
|
+
*
|
|
35
|
+
* The overlays render outside the canvas' CLOSED shadow root, so viewport
|
|
36
|
+
* coordinates are the only frame of reference the two sides share — there is no
|
|
37
|
+
* canvas-space transform to be had from outside. `getBoundingClientRect()` on
|
|
38
|
+
* the live element is that shared frame, continuously: it already accounts for
|
|
39
|
+
* every ancestor's scroll, for the shadow host's own layout, and for any CSS
|
|
40
|
+
* transform in between.
|
|
41
|
+
*
|
|
42
|
+
* That last point is the pan/zoom answer. `ZoomablePanningComponent` is NOT
|
|
43
|
+
* currently mounted — the only reference to it in the canvas is a commented-out
|
|
44
|
+
* import in `viewport-canvas.component.tsx` — so there is no transform to
|
|
45
|
+
* handle today. If one is ever mounted, a live rect follows it with no further
|
|
46
|
+
* work, which a stored rect plus a hand-written transform never would.
|
|
47
|
+
*
|
|
48
|
+
* ## The listeners, and why they are the ones NodeOverlay already uses
|
|
49
|
+
*
|
|
50
|
+
* This is deliberately the same recipe as `node-overlay.tsx`, which solved this
|
|
51
|
+
* exact problem for the selection outline: a `ResizeObserver` on the element and
|
|
52
|
+
* on its shadow host, `resize` on the window, and — the one that matters here —
|
|
53
|
+
* a CAPTURE-phase `scroll` listener, because scroll does not bubble and the
|
|
54
|
+
* scrolling ancestor may be the canvas container, a panel, or the page body.
|
|
55
|
+
*
|
|
56
|
+
* ## The anchor is passed in, not looked up
|
|
57
|
+
*
|
|
58
|
+
* `Besigner.refs.get($id)` would cover three of the four ways these editors
|
|
59
|
+
* open, and silently miss the fourth: an instance prop edit (AGL-1304) anchors
|
|
60
|
+
* on a GRAFTED preview leaf, which is not a canvas node and has no ref. The
|
|
61
|
+
* call site already holds the exact element it measured, so it hands it over.
|
|
62
|
+
*
|
|
63
|
+
* With no anchor — a store opened without one, or a test — the fallback rect is
|
|
64
|
+
* returned unchanged, so the previous behavior is what a caller gets for free.
|
|
65
|
+
*/ export function useAnchoredRect(anchor, fallback) {
|
|
66
|
+
const [rect, setRect] = useState(null);
|
|
67
|
+
useIsomorphicLayoutEffect(()=>{
|
|
68
|
+
var _ref;
|
|
69
|
+
var _anchor_getRootNode;
|
|
70
|
+
if (!anchor || typeof anchor.getBoundingClientRect !== 'function') {
|
|
71
|
+
setRect(null);
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
74
|
+
const update = ()=>{
|
|
75
|
+
const next = anchor.getBoundingClientRect();
|
|
76
|
+
setRect({
|
|
77
|
+
left: next.left,
|
|
78
|
+
top: next.top,
|
|
79
|
+
width: next.width,
|
|
80
|
+
height: next.height
|
|
81
|
+
});
|
|
82
|
+
};
|
|
83
|
+
update();
|
|
84
|
+
// ResizeObserver is not in every jsdom setup; the listeners below still
|
|
85
|
+
// carry the case this issue is actually about.
|
|
86
|
+
const observer = typeof ResizeObserver === 'function' ? new ResizeObserver(update) : null;
|
|
87
|
+
observer == null ? void 0 : observer.observe(anchor);
|
|
88
|
+
const shadowHost = (_ref = (_anchor_getRootNode = anchor.getRootNode()) == null ? void 0 : _anchor_getRootNode.host) != null ? _ref : null;
|
|
89
|
+
if (shadowHost) observer == null ? void 0 : observer.observe(shadowHost);
|
|
90
|
+
window.addEventListener('resize', update, {
|
|
91
|
+
passive: true
|
|
92
|
+
});
|
|
93
|
+
// Scroll does not bubble: only a capture-phase listener on the window sees
|
|
94
|
+
// an ancestor scroll, and an ancestor scroll is the whole bug.
|
|
95
|
+
window.addEventListener('scroll', update, {
|
|
96
|
+
passive: true,
|
|
97
|
+
capture: true
|
|
98
|
+
});
|
|
99
|
+
return ()=>{
|
|
100
|
+
observer == null ? void 0 : observer.disconnect();
|
|
101
|
+
window.removeEventListener('resize', update);
|
|
102
|
+
window.removeEventListener('scroll', update, {
|
|
103
|
+
capture: true
|
|
104
|
+
});
|
|
105
|
+
};
|
|
106
|
+
}, [
|
|
107
|
+
anchor
|
|
108
|
+
]);
|
|
109
|
+
return rect != null ? rect : fallback;
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* Keeps a following overlay reachable when its anchor leaves the viewport.
|
|
113
|
+
*
|
|
114
|
+
* The clamp is not a substitute for the tracking above and is not a second one:
|
|
115
|
+
* AGL-1624 clamped a rect that never changed, which is why its own author
|
|
116
|
+
* called it a floor rather than a fix. Applied to a LIVE rect it means what it
|
|
117
|
+
* says — while the element is off-screen the editor waits at the nearest edge,
|
|
118
|
+
* and it slides back onto the element the moment the element is visible again.
|
|
119
|
+
*
|
|
120
|
+
* Reading the viewport size at render is safe precisely because the hook above
|
|
121
|
+
* re-renders on every scroll and resize, so the value is never stale.
|
|
122
|
+
*/ export function clampToViewport(value, size, extent, margin = 8) {
|
|
123
|
+
const max = extent - size - margin;
|
|
124
|
+
// A viewport smaller than the overlay has no satisfying answer; pin to the
|
|
125
|
+
// near edge rather than letting the clamp invert and push it off the other.
|
|
126
|
+
if (max <= margin) return margin;
|
|
127
|
+
return Math.min(Math.max(value, margin), max);
|
|
128
|
+
}
|
|
129
|
+
export default useAnchoredRect;
|
|
130
|
+
|
|
131
|
+
//# sourceMappingURL=use-anchored-rect.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../../../../libs/besigner/feature/designer/src/lib/hooks/use-anchored-rect.ts"],"sourcesContent":["/**\n * @license\n * Copyright 2026 Aglyn LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n'use client'\n\nimport { useIsomorphicLayoutEffect } from '@aglyn/shared-ui-jsx'\nimport { useState } from 'react'\n\nexport interface AnchoredRect {\n left: number\n top: number\n width: number\n height: number\n}\n\n/**\n * Tracks where an anchor element actually is, for the fixed overlays that edit\n * a canvas element in place (AGL-1644).\n *\n * ## The bug this fixes\n *\n * `inline-text-editor` and `inline-markdown-editor` both anchored on a\n * `getBoundingClientRect()` taken ONCE, when the double-click opened them. The\n * rect was never recomputed, so scrolling the canvas — or resizing the window,\n * or switching the artboard's device preview — left the editor sitting over\n * unrelated chrome while the element it was editing had moved away. It matters\n * most for the markdown editor, where the document is routinely taller than the\n * viewport and scrolling mid-edit is ordinary rather than exceptional.\n *\n * ## Why the live rect IS \"the canvas's own coordinate system\"\n *\n * The overlays render outside the canvas' CLOSED shadow root, so viewport\n * coordinates are the only frame of reference the two sides share — there is no\n * canvas-space transform to be had from outside. `getBoundingClientRect()` on\n * the live element is that shared frame, continuously: it already accounts for\n * every ancestor's scroll, for the shadow host's own layout, and for any CSS\n * transform in between.\n *\n * That last point is the pan/zoom answer. `ZoomablePanningComponent` is NOT\n * currently mounted — the only reference to it in the canvas is a commented-out\n * import in `viewport-canvas.component.tsx` — so there is no transform to\n * handle today. If one is ever mounted, a live rect follows it with no further\n * work, which a stored rect plus a hand-written transform never would.\n *\n * ## The listeners, and why they are the ones NodeOverlay already uses\n *\n * This is deliberately the same recipe as `node-overlay.tsx`, which solved this\n * exact problem for the selection outline: a `ResizeObserver` on the element and\n * on its shadow host, `resize` on the window, and — the one that matters here —\n * a CAPTURE-phase `scroll` listener, because scroll does not bubble and the\n * scrolling ancestor may be the canvas container, a panel, or the page body.\n *\n * ## The anchor is passed in, not looked up\n *\n * `Besigner.refs.get($id)` would cover three of the four ways these editors\n * open, and silently miss the fourth: an instance prop edit (AGL-1304) anchors\n * on a GRAFTED preview leaf, which is not a canvas node and has no ref. The\n * call site already holds the exact element it measured, so it hands it over.\n *\n * With no anchor — a store opened without one, or a test — the fallback rect is\n * returned unchanged, so the previous behavior is what a caller gets for free.\n */\nexport function useAnchoredRect(\n anchor: Element | undefined,\n fallback: AnchoredRect,\n): AnchoredRect {\n const [rect, setRect] = useState<AnchoredRect | null>(null)\n\n useIsomorphicLayoutEffect(() => {\n if (!anchor || typeof anchor.getBoundingClientRect !== 'function') {\n setRect(null)\n return\n }\n const update = () => {\n const next = anchor.getBoundingClientRect()\n setRect({\n left: next.left,\n top: next.top,\n width: next.width,\n height: next.height,\n })\n }\n update()\n\n // ResizeObserver is not in every jsdom setup; the listeners below still\n // carry the case this issue is actually about.\n const observer =\n typeof ResizeObserver === 'function' ? new ResizeObserver(update) : null\n observer?.observe(anchor)\n const shadowHost = (anchor.getRootNode() as ShadowRoot | null)?.host ?? null\n if (shadowHost) observer?.observe(shadowHost)\n\n window.addEventListener('resize', update, { passive: true })\n // Scroll does not bubble: only a capture-phase listener on the window sees\n // an ancestor scroll, and an ancestor scroll is the whole bug.\n window.addEventListener('scroll', update, { passive: true, capture: true })\n\n return () => {\n observer?.disconnect()\n window.removeEventListener('resize', update)\n window.removeEventListener('scroll', update, { capture: true })\n }\n }, [anchor])\n\n return rect ?? fallback\n}\n\n/**\n * Keeps a following overlay reachable when its anchor leaves the viewport.\n *\n * The clamp is not a substitute for the tracking above and is not a second one:\n * AGL-1624 clamped a rect that never changed, which is why its own author\n * called it a floor rather than a fix. Applied to a LIVE rect it means what it\n * says — while the element is off-screen the editor waits at the nearest edge,\n * and it slides back onto the element the moment the element is visible again.\n *\n * Reading the viewport size at render is safe precisely because the hook above\n * re-renders on every scroll and resize, so the value is never stale.\n */\nexport function clampToViewport(\n value: number,\n size: number,\n extent: number,\n margin = 8,\n): number {\n const max = extent - size - margin\n // A viewport smaller than the overlay has no satisfying answer; pin to the\n // near edge rather than letting the clamp invert and push it off the other.\n if (max <= margin) return margin\n return Math.min(Math.max(value, margin), max)\n}\n\nexport default useAnchoredRect\n"],"names":["useIsomorphicLayoutEffect","useState","useAnchoredRect","anchor","fallback","rect","setRect","getBoundingClientRect","update","next","left","top","width","height","observer","ResizeObserver","observe","shadowHost","getRootNode","host","window","addEventListener","passive","capture","disconnect","removeEventListener","clampToViewport","value","size","extent","margin","max","Math","min"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GACD;AAEA,SAASA,yBAAyB,QAAQ,uBAAsB;AAChE,SAASC,QAAQ,QAAQ,QAAO;AAShC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA8CC,GACD,OAAO,SAASC,gBACdC,MAA2B,EAC3BC,QAAsB;IAEtB,MAAM,CAACC,MAAMC,QAAQ,GAAGL,SAA8B;IAEtDD,0BAA0B;;YAqBJG;QApBpB,IAAI,CAACA,UAAU,OAAOA,OAAOI,qBAAqB,KAAK,YAAY;YACjED,QAAQ;YACR;QACF;QACA,MAAME,SAAS;YACb,MAAMC,OAAON,OAAOI,qBAAqB;YACzCD,QAAQ;gBACNI,MAAMD,KAAKC,IAAI;gBACfC,KAAKF,KAAKE,GAAG;gBACbC,OAAOH,KAAKG,KAAK;gBACjBC,QAAQJ,KAAKI,MAAM;YACrB;QACF;QACAL;QAEA,wEAAwE;QACxE,+CAA+C;QAC/C,MAAMM,WACJ,OAAOC,mBAAmB,aAAa,IAAIA,eAAeP,UAAU;QACtEM,4BAAAA,SAAUE,OAAO,CAACb;QAClB,MAAMc,sBAAcd,sBAAAA,OAAOe,WAAW,uBAAnB,AAACf,oBAA4CgB,IAAI,mBAAI;QACxE,IAAIF,YAAYH,4BAAAA,SAAUE,OAAO,CAACC;QAElCG,OAAOC,gBAAgB,CAAC,UAAUb,QAAQ;YAAEc,SAAS;QAAK;QAC1D,2EAA2E;QAC3E,+DAA+D;QAC/DF,OAAOC,gBAAgB,CAAC,UAAUb,QAAQ;YAAEc,SAAS;YAAMC,SAAS;QAAK;QAEzE,OAAO;YACLT,4BAAAA,SAAUU,UAAU;YACpBJ,OAAOK,mBAAmB,CAAC,UAAUjB;YACrCY,OAAOK,mBAAmB,CAAC,UAAUjB,QAAQ;gBAAEe,SAAS;YAAK;QAC/D;IACF,GAAG;QAACpB;KAAO;IAEX,OAAOE,eAAAA,OAAQD;AACjB;AAEA;;;;;;;;;;;CAWC,GACD,OAAO,SAASsB,gBACdC,KAAa,EACbC,IAAY,EACZC,MAAc,EACdC,SAAS,CAAC;IAEV,MAAMC,MAAMF,SAASD,OAAOE;IAC5B,2EAA2E;IAC3E,4EAA4E;IAC5E,IAAIC,OAAOD,QAAQ,OAAOA;IAC1B,OAAOE,KAAKC,GAAG,CAACD,KAAKD,GAAG,CAACJ,OAAOG,SAASC;AAC3C;AAEA,eAAe7B,gBAAe"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2022 Aglyn LLC
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
export { useBesignerAppContext, default as BesignerAppContext, } from '../contexts/besigner-app-context';
|
|
18
|
+
export { useBesignerAppContext as default } from '../contexts/besigner-app-context';
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2022 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
|
+
*/ export { useBesignerAppContext, default as BesignerAppContext } from "../contexts/besigner-app-context.js";
|
|
17
|
+
export { useBesignerAppContext as default } from "../contexts/besigner-app-context.js";
|
|
18
|
+
|
|
19
|
+
//# sourceMappingURL=use-besigner-app-context.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../../../../libs/besigner/feature/designer/src/lib/hooks/use-besigner-app-context.ts"],"sourcesContent":["/**\n * @license\n * Copyright 2022 Aglyn LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport {\n useBesignerAppContext,\n default as BesignerAppContext,\n} from '../contexts/besigner-app-context'\nexport { useBesignerAppContext as default } from '../contexts/besigner-app-context'\n"],"names":["useBesignerAppContext","default","BesignerAppContext"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GAED,SACEA,qBAAqB,EACrBC,WAAWC,kBAAkB,QACxB,sCAAkC;AACzC,SAASF,yBAAyBC,OAAO,QAAQ,sCAAkC"}
|
|
@@ -0,0 +1,309 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2026 Aglyn LLC
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
import type { Firestore } from 'firebase/firestore';
|
|
18
|
+
import type * as Aglyn from '@aglyn/aglyn';
|
|
19
|
+
import { type BesignerDraftIds } from '../drafts/besigner-draft-store';
|
|
20
|
+
import { type ServerDraftWrite } from '../drafts/besigner-server-draft';
|
|
21
|
+
import { type BesignerDraftState } from './use-besigner-draft';
|
|
22
|
+
/**
|
|
23
|
+
* How the host application surfaces a message. Deliberately a plain
|
|
24
|
+
* callback rather than a snackbar dependency: the console passes its
|
|
25
|
+
* `enqueueSnackbar`, and an embedder outside the console passes whatever it
|
|
26
|
+
* has (a toast, a console.log, nothing at all).
|
|
27
|
+
*/
|
|
28
|
+
export type BesignerNotify = (message: string, options?: {
|
|
29
|
+
variant?: 'info' | 'success' | 'warning' | 'error';
|
|
30
|
+
/**
|
|
31
|
+
* Presentation hints, passed through rather than derived from `variant`
|
|
32
|
+
* because the console's four editors deliberately mix them — a
|
|
33
|
+
* near-limit warning is transient, a concurrent-edit warning is not.
|
|
34
|
+
* An embedder without these concepts can ignore them.
|
|
35
|
+
*/
|
|
36
|
+
persist?: boolean;
|
|
37
|
+
allowDuplicate?: boolean;
|
|
38
|
+
}) => void;
|
|
39
|
+
/**
|
|
40
|
+
* Begins a loading indication and returns the function that ends it. Same
|
|
41
|
+
* contract as the console's `queueLoading`; defaults to a no-op.
|
|
42
|
+
*/
|
|
43
|
+
export type BesignerQueueLoading = () => () => void;
|
|
44
|
+
/**
|
|
45
|
+
* What this editor believes the stored document looked like when it last
|
|
46
|
+
* agreed with it, handed to `save` so a store can make the write
|
|
47
|
+
* conditional (AGL-1301) — a Firestore provider runs the same comparison
|
|
48
|
+
* inside a transaction, closing the window where a save lands between
|
|
49
|
+
* another writer's commit and the local snapshot's delivery.
|
|
50
|
+
*/
|
|
51
|
+
export interface BesignerSaveBaseline {
|
|
52
|
+
/** `versionStamp(...)` of the stored `updatedAt` at load/last agreement. */
|
|
53
|
+
baseStamp: string | null;
|
|
54
|
+
/** The stored nodes as of that agreement, in STORED shape. */
|
|
55
|
+
baseNodes: Aglyn.ProcessableNodes | undefined;
|
|
56
|
+
}
|
|
57
|
+
export interface BesignerDocumentSource<TData = unknown> {
|
|
58
|
+
/** The stored node map, or undefined while loading. */
|
|
59
|
+
nodes: Aglyn.ProcessableNodes | undefined;
|
|
60
|
+
/** Whatever the store stamps on write; used to detect concurrent edits. */
|
|
61
|
+
updatedAt?: unknown;
|
|
62
|
+
/**
|
|
63
|
+
* The snapshot `nodes` came from still carries writes this client made
|
|
64
|
+
* that the store has NOT acknowledged (Firestore's
|
|
65
|
+
* `snapshot.metadata.hasPendingWrites`).
|
|
66
|
+
*
|
|
67
|
+
* It decides whether the loaded document may be adopted as the *saved*
|
|
68
|
+
* state. It may not: a queued write is replayed into the first snapshot
|
|
69
|
+
* after a reload, so believing it would mean recording work the server
|
|
70
|
+
* never took as "already saved" — after which the editor is clean, Save is
|
|
71
|
+
* dead, and the canvas and the document disagree in silence (AGL-1262).
|
|
72
|
+
* Omitted (undefined) reads as confirmed, which is right for every store
|
|
73
|
+
* that has no such queue.
|
|
74
|
+
*/
|
|
75
|
+
pendingWrites?: boolean;
|
|
76
|
+
status?: 'idle' | 'loading' | 'success' | 'error';
|
|
77
|
+
error?: {
|
|
78
|
+
message?: string;
|
|
79
|
+
} | null;
|
|
80
|
+
/**
|
|
81
|
+
* Persists the node map. Rejecting surfaces as an error notification —
|
|
82
|
+
* except `ConcurrentEditError`, which surfaces through the same refusal
|
|
83
|
+
* UX as the listener-side guard (AGL-1301). `baseline` is what this
|
|
84
|
+
* editor last agreed the stored document looked like; a store that can
|
|
85
|
+
* make the write conditional should (see `saveNodesGuarded`), and one
|
|
86
|
+
* that cannot may ignore it.
|
|
87
|
+
*/
|
|
88
|
+
save: (nodes: Record<string, unknown>, baseline?: BesignerSaveBaseline) => Promise<void>;
|
|
89
|
+
data?: TData;
|
|
90
|
+
}
|
|
91
|
+
export interface UseBesignerDocumentOptions<TData = unknown> extends BesignerDocumentSource<TData> {
|
|
92
|
+
/**
|
|
93
|
+
* The word used in user-facing copy — 'screen', 'layout', 'component',
|
|
94
|
+
* 'template', 'email'. Keeps each editor's messages accurate without
|
|
95
|
+
* forking the logic.
|
|
96
|
+
*/
|
|
97
|
+
noun: string;
|
|
98
|
+
/** Canvas view type; reset to SCREEN on unmount. */
|
|
99
|
+
viewType?: Aglyn.HostViewType;
|
|
100
|
+
/**
|
|
101
|
+
* Identity of the open document. Changing it re-arms the canvas reset,
|
|
102
|
+
* which is what stops one document's nodes leaking into the next.
|
|
103
|
+
*/
|
|
104
|
+
documentKey?: string;
|
|
105
|
+
/**
|
|
106
|
+
* Identity for the local crash-recovery draft (AGL-1256). Omit and drafts
|
|
107
|
+
* are simply off for this editor.
|
|
108
|
+
*
|
|
109
|
+
* Deliberately separate from `documentKey`, which is not unique enough to
|
|
110
|
+
* key storage on: both email editors build it as
|
|
111
|
+
* `${templateKey}:${versionId}`, so a platform template and every host's
|
|
112
|
+
* override of the same key produce the same string.
|
|
113
|
+
*/
|
|
114
|
+
draft?: BesignerDraftIds;
|
|
115
|
+
/**
|
|
116
|
+
* Enables the SHARED working draft — the one `Save draft` writes and
|
|
117
|
+
* `Save & publish` clears. Omit and the editor keeps the local crash net
|
|
118
|
+
* alone, which is what a document with no versions to hang a draft off
|
|
119
|
+
* should do.
|
|
120
|
+
*/
|
|
121
|
+
firestore?: Firestore;
|
|
122
|
+
/**
|
|
123
|
+
* Other live editing sessions in this document's room, or null while
|
|
124
|
+
* presence has not settled — see `recoverableRoomSessions` (AGL-2486).
|
|
125
|
+
*
|
|
126
|
+
* Only the crash-recovery prompt reads it. The conflict guard deliberately
|
|
127
|
+
* does NOT: a room is a live-collaboration fact and saving must be
|
|
128
|
+
* protected whether or not presence is working at all.
|
|
129
|
+
*/
|
|
130
|
+
roomSessions?: number | null;
|
|
131
|
+
notify?: BesignerNotify;
|
|
132
|
+
queueLoading?: BesignerQueueLoading;
|
|
133
|
+
/** Called after a successful save, for activity logging. */
|
|
134
|
+
onSaved?: () => void;
|
|
135
|
+
/**
|
|
136
|
+
* Called when a save was REFUSED or FAILED — the document does not hold the
|
|
137
|
+
* canvas.
|
|
138
|
+
*
|
|
139
|
+
* `onSaved` not firing is not enough to tell a caller that, because it also
|
|
140
|
+
* stays silent for "nothing to save", where the document already holds the
|
|
141
|
+
* canvas and every follow-on step is safe. The two need opposite handling by
|
|
142
|
+
* anything that acts on a save: `handleSaveAndPublish` promotes the version
|
|
143
|
+
* pointer afterwards, and promoting past a refusal publishes a version whose
|
|
144
|
+
* document never received the edit.
|
|
145
|
+
*
|
|
146
|
+
* Fired for every path that leaves the stored tree unchanged against the
|
|
147
|
+
* author's intent: a stale-baseline conflict, an unpreparable canvas, the
|
|
148
|
+
* size guard, and a thrown write. Each has already explained itself in a
|
|
149
|
+
* toast, so a caller's job is only to stop.
|
|
150
|
+
*/
|
|
151
|
+
onSaveRefused?: () => void;
|
|
152
|
+
/**
|
|
153
|
+
* Overrides the success message. Defaults to `"<Noun> saved successfully"`;
|
|
154
|
+
* templates say simply "Template saved" and that copy is preserved rather
|
|
155
|
+
* than normalised by the extraction.
|
|
156
|
+
*/
|
|
157
|
+
savedMessage?: string;
|
|
158
|
+
/**
|
|
159
|
+
* Maps the stored node map into what the canvas should render, for
|
|
160
|
+
* documents whose storage shape is not a canvas tree.
|
|
161
|
+
*
|
|
162
|
+
* Reusable components and component-kind templates store a *definition*,
|
|
163
|
+
* rooted at the promoted node rather than the canvas root — rendering one
|
|
164
|
+
* unwrapped gives a canvas with no root and a blank editor (AGL-680).
|
|
165
|
+
* Defaults to identity; putting a document back into its stored shape is
|
|
166
|
+
* the caller's `save`, which already owns that direction (AGL-681).
|
|
167
|
+
*/
|
|
168
|
+
toCanvasNodes?: (nodes: Aglyn.ProcessableNodes) => Aglyn.ProcessableNodes;
|
|
169
|
+
/**
|
|
170
|
+
* The inverse of `toCanvasNodes`: maps the canvas tree back into the
|
|
171
|
+
* stored shape, and may refuse the save with a message.
|
|
172
|
+
*
|
|
173
|
+
* Runs *before* the size guard, so the guard measures what will actually
|
|
174
|
+
* be written rather than the canvas representation of it. A component-kind
|
|
175
|
+
* template that no longer has a single top-level element is rejected here
|
|
176
|
+
* (AGL-681).
|
|
177
|
+
*/
|
|
178
|
+
fromCanvasNodes?: (canvasNodes: Record<string, unknown>) => {
|
|
179
|
+
nodes: Record<string, unknown>;
|
|
180
|
+
} | {
|
|
181
|
+
error: string;
|
|
182
|
+
};
|
|
183
|
+
}
|
|
184
|
+
/** Who a shared working draft records as its last writer. */
|
|
185
|
+
export interface BesignerDraftAuthor {
|
|
186
|
+
uid?: string | null;
|
|
187
|
+
email?: string | null;
|
|
188
|
+
}
|
|
189
|
+
export interface UseBesignerDocumentResult {
|
|
190
|
+
/** True when the canvas differs from the last agreed state. */
|
|
191
|
+
saveAvailable: boolean;
|
|
192
|
+
/** True when someone else wrote this document since we loaded it. */
|
|
193
|
+
remoteChanged: boolean;
|
|
194
|
+
handleSave: () => Promise<void> | void;
|
|
195
|
+
/**
|
|
196
|
+
* Writes the SHARED working draft — what `Save draft` stores and
|
|
197
|
+
* `Save & publish` clears.
|
|
198
|
+
*
|
|
199
|
+
* Here rather than in each editor because of the one field an editor
|
|
200
|
+
* cannot get right on its own: `baseStamp`. A recovered draft is measured
|
|
201
|
+
* against `storedStamp`, which is this document's `updatedAt` — the
|
|
202
|
+
* VERSION document — and every console editor was stamping its draft from
|
|
203
|
+
* the PARENT document instead (`screens/{id}`, `components/{id}`, …). Two
|
|
204
|
+
* documents, two `updatedAt` fields, so the two values could only agree by
|
|
205
|
+
* coincidence: every working draft read back as "someone else saved this
|
|
206
|
+
* while you were editing", Restore was never offered, and the draft could
|
|
207
|
+
* never be recovered by anyone. Taking the stamp where the comparison is
|
|
208
|
+
* made is what stops the two drifting apart again.
|
|
209
|
+
*
|
|
210
|
+
* Resolves `'failed'` when this document cannot hold a shared draft — no
|
|
211
|
+
* `firestore`, or no draft ids — which is the same answer a rejected write
|
|
212
|
+
* gives, and the caller's handling of both is identical.
|
|
213
|
+
*
|
|
214
|
+
* Resolves `'unchanged'` WITHOUT writing when the canvas is clean
|
|
215
|
+
* (AGL-2874). A clean canvas is the stored document, so there is no draft
|
|
216
|
+
* to take — and writing one anyway would replace whatever saved draft the
|
|
217
|
+
* slot holds with a copy of the document it was drafted against.
|
|
218
|
+
*/
|
|
219
|
+
saveWorkingDraft: (author?: BesignerDraftAuthor) => Promise<ServerDraftWrite>;
|
|
220
|
+
/**
|
|
221
|
+
* Refuses, and says why, an action that would leave behind a saved draft
|
|
222
|
+
* this author has been offered and has not opened (AGL-2874). Returns true
|
|
223
|
+
* when the caller must stop.
|
|
224
|
+
*
|
|
225
|
+
* `'publish'` for Save & publish and a Publish click: publishing stores and
|
|
226
|
+
* promotes the canvas, and a canvas that never took the draft in would go
|
|
227
|
+
* live without it — after which the draft is cleared as published. `'save'`
|
|
228
|
+
* for a draft save, which would overwrite it, and for a save of the
|
|
229
|
+
* document, which moves the stamp the draft was taken against and leaves
|
|
230
|
+
* it unopenable.
|
|
231
|
+
*
|
|
232
|
+
* Only while the offer is ON SCREEN and can be opened: the refusal points
|
|
233
|
+
* at the banner's Open draft and Discard, and must never point at buttons
|
|
234
|
+
* that are not there.
|
|
235
|
+
*/
|
|
236
|
+
refuseOverUnopenedDraft: (action: 'save' | 'publish') => boolean;
|
|
237
|
+
/**
|
|
238
|
+
* Announce a write this editor is about to make to the SAME document
|
|
239
|
+
* outside `handleSave` — component properties are the first (AGL-1247).
|
|
240
|
+
*
|
|
241
|
+
* Without it the write's own echo is indistinguishable from a colleague's
|
|
242
|
+
* and trips the conflict guard, which pauses saving until reload: the
|
|
243
|
+
* editor accuses you of being someone else.
|
|
244
|
+
*/
|
|
245
|
+
markOwnWrite: () => void;
|
|
246
|
+
/**
|
|
247
|
+
* Unsaved work recovered from local storage after a crash or reload, and
|
|
248
|
+
* the two things the author can do about it (AGL-1256). Always present;
|
|
249
|
+
* `available` is false when there is nothing to offer.
|
|
250
|
+
*/
|
|
251
|
+
draft: BesignerDraftState;
|
|
252
|
+
/** JSON editor plumbing, identical in every editor. */
|
|
253
|
+
jsonOpen: boolean;
|
|
254
|
+
openJsonEditor: () => void;
|
|
255
|
+
closeJsonEditor: () => void;
|
|
256
|
+
handleJsonSave: (event: unknown, value: unknown) => void;
|
|
257
|
+
/**
|
|
258
|
+
* The document could not be read AND there is nothing to show for it
|
|
259
|
+
* (AGL-1066).
|
|
260
|
+
*
|
|
261
|
+
* Deliberately NOT "the read errored". Under `persistentLocalCache` a
|
|
262
|
+
* refused listen still serves the document from IndexedDB, and a refused
|
|
263
|
+
* listen can now reach `status: 'error'` — so an editor with a canvas full
|
|
264
|
+
* of the author's work would otherwise be replaced by "Not found" about two
|
|
265
|
+
* seconds into a stale session, mid-edit. Whether the console should keep
|
|
266
|
+
* SERVING that cached document is the question AGL-1066 settled as "keep
|
|
267
|
+
* serving, but stop presenting it as live"; the presentation half is the
|
|
268
|
+
* shell's re-auth banner and the refusal on save, not blanking the canvas.
|
|
269
|
+
*
|
|
270
|
+
* When the read failed and nothing ever arrived there is genuinely nothing
|
|
271
|
+
* to render, and this is true — which is the state the "Not found" branch
|
|
272
|
+
* was written for.
|
|
273
|
+
*/
|
|
274
|
+
hasError: boolean;
|
|
275
|
+
notFound: boolean;
|
|
276
|
+
/**
|
|
277
|
+
* The document is on screen but the server has stopped answering for it
|
|
278
|
+
* (AGL-1066) — cached content, no refresh coming. Saving is already refused
|
|
279
|
+
* by the seed guards; this is what an editor would surface to say why.
|
|
280
|
+
*/
|
|
281
|
+
staleContent: boolean;
|
|
282
|
+
}
|
|
283
|
+
/**
|
|
284
|
+
* Pushes a stored node map into the shared canvas singleton.
|
|
285
|
+
*
|
|
286
|
+
* The canvas root is guaranteed here rather than per editor (AGL-931). A map
|
|
287
|
+
* without one leaves the hierarchy showing 'Invalid node' with Add Element
|
|
288
|
+
* disabled — an editor the document can never be repaired from — and only
|
|
289
|
+
* the two definition-shaped editors passed a `toCanvasNodes` that repaired
|
|
290
|
+
* it. Doing it at the one point every editor loads through means no route
|
|
291
|
+
* can be added that forgets.
|
|
292
|
+
*/
|
|
293
|
+
export declare function setLocalNodes(value: Aglyn.ProcessableNodes): Aglyn.CanvasManager;
|
|
294
|
+
/**
|
|
295
|
+
* The document-agnostic half of a besigner editor.
|
|
296
|
+
*
|
|
297
|
+
* Everything here was copy-pasted across the console's four besigner routes
|
|
298
|
+
* (screens, layouts, components, templates) — canvas lifecycle, first load,
|
|
299
|
+
* concurrent-write detection (AGL-674), the size-guarded save (AGL-678) and
|
|
300
|
+
* the JSON editor. None of it is about hosts, orgs, themes or publishing,
|
|
301
|
+
* so none of it belongs in a console route.
|
|
302
|
+
*
|
|
303
|
+
* It has **no console and no host dependency** by design: the caller
|
|
304
|
+
* supplies the document source and the notify/loading adapters. That is
|
|
305
|
+
* what lets besigner drive a document that has no host — the platform email
|
|
306
|
+
* templates — and, longer term, run outside the console entirely.
|
|
307
|
+
*/
|
|
308
|
+
export declare function useBesignerDocument<TData = unknown>(options: UseBesignerDocumentOptions<TData>): UseBesignerDocumentResult;
|
|
309
|
+
export default useBesignerDocument;
|