@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,820 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2026 Aglyn LLC
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/ import { _ as _extends } from "@swc/helpers/_/_extends";
|
|
17
|
+
import { _ as _object_without_properties_loose } from "@swc/helpers/_/_object_without_properties_loose";
|
|
18
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
19
|
+
import { canvas, isFeatureEnabled, NODE_ROOT_ID } from "@aglyn/aglyn";
|
|
20
|
+
import * as Besigner from "@aglyn/besigner";
|
|
21
|
+
import { ICON_VARIANT_COLLAPSIBLE_CLOSE, ICON_VARIANT_COLLAPSIBLE_OPEN, ICON_VARIANT_MODIFY_DRAG, ICON_VARIANT_SHOW_MORE_VERTICAL, ICON_VARIANT_VISIBILITY_HIDDEN, ICON_VARIANT_VISIBILITY_SHOWN } from "@aglyn/shared-data-enums";
|
|
22
|
+
import { MdiIcon } from "@aglyn/shared-ui-jsx";
|
|
23
|
+
import { generateComponentClassKeys, styled } from "@aglyn/shared-ui-theme";
|
|
24
|
+
import { noop } from "@aglyn/shared-util-tools";
|
|
25
|
+
import { Box, ClickAwayListener, Collapse, Divider, IconButton, List as MuiList, ListItem as MuiListItem, ListItemButton as MuiListItemButton, listItemButtonClasses, listItemClasses, ListItemIcon as MuiListItemIcon, ListItemText as MuiListItemText, Popper, Stack, Tooltip } from "@mui/material";
|
|
26
|
+
import clsx from "clsx";
|
|
27
|
+
import uniq from "lodash-es/uniq.js";
|
|
28
|
+
import { observer } from "mobx-react-lite";
|
|
29
|
+
import { createContext, forwardRef, useCallback, useContext, useEffect, useMemo, useRef, useState } from "react";
|
|
30
|
+
import useLeafDrag from "../hooks/use-leaf-drag.js";
|
|
31
|
+
import useLeafDrop from "../hooks/use-leaf-drop.js";
|
|
32
|
+
import { isAncestorHidden, isNodeHiddenByAuthor, isNodeHiddenOnSite } from "../utils/canvas-reveal.js";
|
|
33
|
+
import ComponentIconComponent from "./component-icon.component.js";
|
|
34
|
+
import NodeContextMenu from "./node-context-menu.js";
|
|
35
|
+
const classKey = generateComponentClassKeys('TreeView', [
|
|
36
|
+
'root',
|
|
37
|
+
'subTreeView',
|
|
38
|
+
'treeItem',
|
|
39
|
+
'treeListItem',
|
|
40
|
+
'dragHandle',
|
|
41
|
+
'moreButton',
|
|
42
|
+
'visibilityButton',
|
|
43
|
+
'itemSelected',
|
|
44
|
+
'itemHovered',
|
|
45
|
+
'itemIsDragging',
|
|
46
|
+
'itemIsDragOver'
|
|
47
|
+
]);
|
|
48
|
+
const TreeView = styled(MuiList)(({ theme })=>({
|
|
49
|
+
alignItems: 'stretch',
|
|
50
|
+
flexDirection: 'column',
|
|
51
|
+
width: 'fit-content',
|
|
52
|
+
minWidth: '100%',
|
|
53
|
+
[`& .${listItemButtonClasses.root}`]: {
|
|
54
|
+
zIndex: 0,
|
|
55
|
+
paddingTop: 0,
|
|
56
|
+
paddingBottom: 0,
|
|
57
|
+
// paddingLeft: 0,
|
|
58
|
+
borderTopLeftRadius: 4,
|
|
59
|
+
borderBottomLeftRadius: 4,
|
|
60
|
+
[[
|
|
61
|
+
`&:hover`,
|
|
62
|
+
`&.${listItemButtonClasses.focusVisible}`,
|
|
63
|
+
`&.${listItemButtonClasses.selected}`,
|
|
64
|
+
`&.${classKey.itemSelected}`
|
|
65
|
+
].join(',')]: {
|
|
66
|
+
backgroundColor: 'transparent'
|
|
67
|
+
}
|
|
68
|
+
},
|
|
69
|
+
[`& .${listItemClasses.root}`]: {
|
|
70
|
+
alignItems: 'stretch',
|
|
71
|
+
flexDirection: 'column',
|
|
72
|
+
borderTopLeftRadius: 4,
|
|
73
|
+
borderBottomLeftRadius: 4,
|
|
74
|
+
[`> .${classKey.treeListItem}`]: {
|
|
75
|
+
borderTopLeftRadius: 4,
|
|
76
|
+
borderBottomLeftRadius: 4,
|
|
77
|
+
[`& .${classKey.dragHandle}, & .${classKey.moreButton}`]: {
|
|
78
|
+
visibility: 'hidden'
|
|
79
|
+
},
|
|
80
|
+
// An open menu keeps its own button on screen — the pointer has left
|
|
81
|
+
// the row to reach the menu, so the hover rule no longer holds it.
|
|
82
|
+
[`& .${classKey.moreButton}[aria-expanded='true']`]: {
|
|
83
|
+
visibility: 'visible'
|
|
84
|
+
},
|
|
85
|
+
[`&:hover, &.${classKey.itemHovered}`]: {
|
|
86
|
+
[`& .${classKey.dragHandle}, & .${classKey.moreButton}`]: {
|
|
87
|
+
visibility: 'visible'
|
|
88
|
+
},
|
|
89
|
+
backgroundColor: `rgba(${theme.vars.palette.primary.darkChannel} / calc(${theme.vars.palette.action.hoverOpacity} + 0.2))`,
|
|
90
|
+
[`&:has(> .${listItemButtonClasses.focusVisible})`]: {
|
|
91
|
+
backgroundColor: `rgba(${theme.vars.palette.primary.darkChannel} / calc(${theme.vars.palette.action.focusOpacity} + 0.3))`
|
|
92
|
+
}
|
|
93
|
+
},
|
|
94
|
+
[`&:has(> .${listItemButtonClasses.focusVisible})`]: {
|
|
95
|
+
backgroundColor: `rgba(${theme.vars.palette.primary.darkChannel} / calc(${theme.vars.palette.action.focusOpacity} + 0.2))`
|
|
96
|
+
}
|
|
97
|
+
},
|
|
98
|
+
[`&.${classKey.itemSelected}`]: {
|
|
99
|
+
[`> .${classKey.treeListItem}`]: {
|
|
100
|
+
backgroundColor: `rgba(${theme.vars.palette.secondary.mainChannel} / ${theme.vars.palette.action.selectedOpacity})`,
|
|
101
|
+
[`&:hover, &.${classKey.itemHovered}`]: {
|
|
102
|
+
backgroundColor: `rgba(${theme.vars.palette.secondary.mainChannel} / calc(${theme.vars.palette.action.selectedOpacity} + 0.2))`,
|
|
103
|
+
[`&:has(> .${listItemButtonClasses.focusVisible})`]: {
|
|
104
|
+
backgroundColor: `rgba(${theme.vars.palette.secondary.mainChannel} / calc(${theme.vars.palette.action.selectedOpacity} + 0.2))`
|
|
105
|
+
}
|
|
106
|
+
},
|
|
107
|
+
[`&:has(> .${listItemButtonClasses.focusVisible})`]: {
|
|
108
|
+
backgroundColor: `rgba(${theme.vars.palette.secondary.mainChannel} / ${theme.vars.palette.action.activatedOpacity})`
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
}));
|
|
114
|
+
TreeView.displayName = 'TreeView';
|
|
115
|
+
/**
|
|
116
|
+
* The hierarchy's depth cue (AGL-2486).
|
|
117
|
+
*
|
|
118
|
+
* What this replaces was a per-level background tint, and every tint of that
|
|
119
|
+
* shape has the same fault: it COMPOSITES. Each ancestor of the selection
|
|
120
|
+
* painted its own overlay, so the row at depth n sat under n of them and its
|
|
121
|
+
* background walked one step further toward the ink for every level. Against
|
|
122
|
+
* the console's light palette the previous ramp crossed WCAG AA at the
|
|
123
|
+
* seventh level (3.85:1) and reached 1.33:1 by the twelfth — the label and
|
|
124
|
+
* the row had met. Dark mode looked right for the arithmetic reason that the
|
|
125
|
+
* same darkening moves AWAY from light text, which is exactly why no single
|
|
126
|
+
* tint direction can serve both schemes.
|
|
127
|
+
*
|
|
128
|
+
* Capping the ramp was tried and is not a fix either. A cap only decides
|
|
129
|
+
* WHERE the cue stops working: past the cap every level paints the same
|
|
130
|
+
* background, so depth 6 and depth 16 are indistinguishable, and the issue
|
|
131
|
+
* asks for a cue that reads at depth 8 as clearly as at depth 1.
|
|
132
|
+
*
|
|
133
|
+
* So the cue is POSITIONAL rather than tonal. Each nesting level draws one
|
|
134
|
+
* vertical guide in the row's indent gutter — depth is read by counting
|
|
135
|
+
* lines, the way a tree view is read everywhere else. Guides are a fixed
|
|
136
|
+
* colour and a fixed alpha at every level, and they live in the gutter, so
|
|
137
|
+
* nothing is painted behind the label at all: the row's background is
|
|
138
|
+
* `background.paper` at depth 1 and at depth 40, in both schemes, and the
|
|
139
|
+
* text-vs-background contrast ratio is therefore a constant rather than a
|
|
140
|
+
* function of depth. `hierarchy-depth-contrast.spec.ts` measures it.
|
|
141
|
+
*
|
|
142
|
+
* The branch containing the selection is still marked — that is what the old
|
|
143
|
+
* tint was for — by colouring THAT row's guides with the accent instead. One
|
|
144
|
+
* row, one element, no stacking possible.
|
|
145
|
+
*/ /** Horizontal indent one nesting level adds, in px. */ export const HIERARCHY_INDENT_STEP = 23;
|
|
146
|
+
/** Width of one guide line, in px. */ export const HIERARCHY_GUIDE_WIDTH = 1;
|
|
147
|
+
/**
|
|
148
|
+
* Alpha of a guide, over the ink colour of whichever scheme is active.
|
|
149
|
+
*
|
|
150
|
+
* Drawn from `text.primary` rather than `divider` so the one value serves
|
|
151
|
+
* both schemes: the ink is dark on light and light on dark, so the guide
|
|
152
|
+
* always moves AWAY from the surface it sits on instead of toward the label
|
|
153
|
+
* — the failure mode of a fixed-direction tint, in miniature.
|
|
154
|
+
*
|
|
155
|
+
* 0.45 clears WCAG 1.4.11 (3:1 for a non-text cue) in the WORST of the four
|
|
156
|
+
* surface/scheme pairings, and is not a number picked by eye: the measured
|
|
157
|
+
* ratios are 3.35 and 3.32 in light, 3.89 and 4.19 in dark. `divider`, at
|
|
158
|
+
* 0.12, measures 1.31 — legible as a hairline between panels, invisible as
|
|
159
|
+
* the thing you are being asked to count. `hierarchy-depth-contrast.spec.ts`
|
|
160
|
+
* re-derives all four.
|
|
161
|
+
*/ export const HIERARCHY_GUIDE_ALPHA = 0.45;
|
|
162
|
+
/**
|
|
163
|
+
* Guides a row at `depth` draws, and how wide a gutter they occupy.
|
|
164
|
+
*
|
|
165
|
+
* Deliberately unbounded and deliberately linear: the count IS the depth, so
|
|
166
|
+
* the cue keeps saying something new at every level. It can afford to,
|
|
167
|
+
* because nothing here is cumulative — a guide is drawn beside the label,
|
|
168
|
+
* never behind it.
|
|
169
|
+
*/ export function hierarchyGuideCount(depth) {
|
|
170
|
+
// `strictNullChecks` is off repo-wide, so compare rather than truth-test.
|
|
171
|
+
return depth >= 2 ? depth - 1 : 0;
|
|
172
|
+
}
|
|
173
|
+
export function hierarchyGutterWidth(depth) {
|
|
174
|
+
return hierarchyGuideCount(depth) * HIERARCHY_INDENT_STEP;
|
|
175
|
+
}
|
|
176
|
+
/**
|
|
177
|
+
* The depth-dependent CSS a tree row gets, as a plain object.
|
|
178
|
+
*
|
|
179
|
+
* Exported so the contrast spec can read the STYLES rather than a
|
|
180
|
+
* description of them: the check that no key here is a background COLOUR is
|
|
181
|
+
* what makes "the depth cue never accumulates toward the text" a property of
|
|
182
|
+
* the code instead of a claim in a comment.
|
|
183
|
+
*/ export function hierarchyDepthStyles(depth, colors) {
|
|
184
|
+
const gutter = hierarchyGutterWidth(depth);
|
|
185
|
+
if (!(gutter > 0)) return {};
|
|
186
|
+
const gutterFor = (color)=>({
|
|
187
|
+
// A gradient rather than n nested borders: the rows are siblings that
|
|
188
|
+
// pad themselves (see the button's `paddingLeft`), not physically
|
|
189
|
+
// nested boxes, so there is no element per level to hang a border on.
|
|
190
|
+
backgroundImage: `repeating-linear-gradient(to right, ${color} 0 ${HIERARCHY_GUIDE_WIDTH}px, transparent ${HIERARCHY_GUIDE_WIDTH}px ${HIERARCHY_INDENT_STEP}px)`,
|
|
191
|
+
backgroundRepeat: 'no-repeat',
|
|
192
|
+
// Clipped to the indent gutter, so the guides stop where the label
|
|
193
|
+
// starts and no line is ever drawn behind text.
|
|
194
|
+
backgroundSize: `${gutter}px 100%`,
|
|
195
|
+
backgroundPosition: 'left top'
|
|
196
|
+
});
|
|
197
|
+
const row = `> .${classKey.treeListItem} > .${listItemButtonClasses.root}`;
|
|
198
|
+
return {
|
|
199
|
+
[row]: gutterFor(colors.guide),
|
|
200
|
+
// The row whose subtree holds the selection. Applied to the row's own
|
|
201
|
+
// button — one element per row, never an ancestor box wrapping its
|
|
202
|
+
// descendants — so however many ancestors match, none of them can
|
|
203
|
+
// stack on top of another.
|
|
204
|
+
[`&:has(.${classKey.subTreeView}):has(.${classKey.itemSelected}) ${row}`]: gutterFor(colors.activeGuide)
|
|
205
|
+
};
|
|
206
|
+
}
|
|
207
|
+
const TreeItem = styled(MuiListItem, {
|
|
208
|
+
shouldForwardProp (propName) {
|
|
209
|
+
return propName !== 'depth';
|
|
210
|
+
}
|
|
211
|
+
})(({ theme, depth = 1 })=>{
|
|
212
|
+
const tv = theme.vars || theme;
|
|
213
|
+
return hierarchyDepthStyles(depth, {
|
|
214
|
+
guide: `rgba(${tv.palette.text.primaryChannel} / ${HIERARCHY_GUIDE_ALPHA})`,
|
|
215
|
+
// Full strength, and the same accent the selected row already uses. A
|
|
216
|
+
// hairline is a small target for a hue cue, and `#e040fb` measures 3.34
|
|
217
|
+
// against the lightest surface and 3.78 against the darkest — dropping
|
|
218
|
+
// its alpha to soften it would spend the whole margin.
|
|
219
|
+
activeGuide: tv.palette.secondary.main
|
|
220
|
+
});
|
|
221
|
+
});
|
|
222
|
+
TreeItem.displayName = 'TreeItem';
|
|
223
|
+
const DragHandle = styled(MuiListItemIcon, {
|
|
224
|
+
shouldForwardProp (propName) {
|
|
225
|
+
return propName !== 'draggingEnabled';
|
|
226
|
+
}
|
|
227
|
+
})(({ theme, draggingEnabled })=>({
|
|
228
|
+
minWidth: 23,
|
|
229
|
+
padding: theme.spacing(0.75),
|
|
230
|
+
paddingLeft: 0,
|
|
231
|
+
borderRadius: '4px',
|
|
232
|
+
cursor: 'move',
|
|
233
|
+
pointerEvents: !draggingEnabled ? 'none' : undefined,
|
|
234
|
+
opacity: !draggingEnabled ? 0.5 : undefined,
|
|
235
|
+
zIndex: 1
|
|
236
|
+
}));
|
|
237
|
+
DragHandle.displayName = 'DragHandle';
|
|
238
|
+
const NodeTreeItem = observer(/*#__PURE__*/ forwardRef((props, ref)=>{
|
|
239
|
+
var _schema_flags, _node_nodes;
|
|
240
|
+
const { nodeId, className } = props, rest = _object_without_properties_loose(props, [
|
|
241
|
+
"nodeId",
|
|
242
|
+
"className"
|
|
243
|
+
]);
|
|
244
|
+
const { expanded, closeIcon, expandIcon, onItemSelect, onItemHover, onItemToggle, onItemFocus } = useContext(TreeViewContext);
|
|
245
|
+
// console.log('NodeTreeItem', [...expanded])
|
|
246
|
+
const node = canvas.getNode(nodeId);
|
|
247
|
+
const schema = node == null ? void 0 : node.componentSchema;
|
|
248
|
+
const nodeLabel = node == null ? void 0 : node.labelShort;
|
|
249
|
+
const breadcrumbPath = (node == null ? void 0 : node.breadcrumbPath) || [];
|
|
250
|
+
const depth = (breadcrumbPath == null ? void 0 : breadcrumbPath.length) - 1;
|
|
251
|
+
const isRootNode = canvas.isRootNode(node);
|
|
252
|
+
const dragAllowed = isFeatureEnabled(schema == null ? void 0 : (_schema_flags = schema.flags) == null ? void 0 : _schema_flags.dragging);
|
|
253
|
+
const collapseIn = expanded == null ? void 0 : expanded.some((i)=>i === nodeId);
|
|
254
|
+
const isSelected = Besigner.focus.isNodeSelected(node);
|
|
255
|
+
const isHovered = Besigner.focus.isNodeHovered(node);
|
|
256
|
+
const dragDisabled = Boolean(isRootNode || !dragAllowed);
|
|
257
|
+
/**
|
|
258
|
+
* The row's eye: this element's VISIBILITY.
|
|
259
|
+
*
|
|
260
|
+
* `display: none`, on the canvas and on the published site, and nothing
|
|
261
|
+
* reveals it. The plain "I do not want this on the page" switch every
|
|
262
|
+
* layer tree has — and, because it is a node FIELD composed last rather
|
|
263
|
+
* than a style, hiding a Stack laid out with `display: flex` gives that
|
|
264
|
+
* flex back the moment it is shown again.
|
|
265
|
+
*
|
|
266
|
+
* It does NOT write `aglyn-hidden`. That class means something else that
|
|
267
|
+
* looks the same from outside — "starts hidden, and an interaction shows
|
|
268
|
+
* it", for a mega-menu panel or a drawer — and it is part of a runtime
|
|
269
|
+
* contract that the show/hide steps and the canvas reveal both read. A
|
|
270
|
+
* visibility toggle that wrote it would enrol every hidden element in a
|
|
271
|
+
* choreography it is not part of. That switch is on the ⋮ menu, named
|
|
272
|
+
* for what it does.
|
|
273
|
+
*/ const authorHidden = isNodeHiddenByAuthor(node);
|
|
274
|
+
const hiddenOnSite = isNodeHiddenOnSite(node);
|
|
275
|
+
/**
|
|
276
|
+
* Dimmed for either reason. Both mean the element is not on the page,
|
|
277
|
+
* and a reader scanning the tree is asking that question, not which
|
|
278
|
+
* mechanism answered it.
|
|
279
|
+
*
|
|
280
|
+
* Only the OUTERMOST hidden layer draws it: CSS opacity multiplies
|
|
281
|
+
* through nesting, so a panel inside a hidden drawer would fade to 0.2
|
|
282
|
+
* if every hidden level applied its own.
|
|
283
|
+
*/ const dimsSubtree = (authorHidden || hiddenOnSite) && !isAncestorHidden(node);
|
|
284
|
+
const toggleVisibility = useCallback((e)=>{
|
|
285
|
+
// The row is a button and a drop target; without this the click
|
|
286
|
+
// also selects the row under the control.
|
|
287
|
+
e.stopPropagation();
|
|
288
|
+
e.preventDefault();
|
|
289
|
+
if (isRootNode) return;
|
|
290
|
+
// Through the canvas so it records an undo step and reaches the node
|
|
291
|
+
// the MAP holds — see `updateNodeFields`.
|
|
292
|
+
canvas.updateNodeFields(node, {
|
|
293
|
+
hidden: !authorHidden
|
|
294
|
+
});
|
|
295
|
+
}, [
|
|
296
|
+
node,
|
|
297
|
+
isRootNode,
|
|
298
|
+
authorHidden
|
|
299
|
+
]);
|
|
300
|
+
const { attributes: dragAttributes, transform, isDragging, setNodeRef: setDraggableNodeRef, listeners: draggableListeners } = useLeafDrag(node, Besigner.DragType.TREE);
|
|
301
|
+
const style = transform ? {
|
|
302
|
+
transform: `translate3d(${transform.x}px, ${transform.y}px, 0)`,
|
|
303
|
+
cursor: 'grab',
|
|
304
|
+
opacity: 0.5
|
|
305
|
+
} : undefined;
|
|
306
|
+
const { setNodeRef: setDroppableNodeRef, isOver } = useLeafDrop(node, undefined, 'tree');
|
|
307
|
+
const [menuAnchor, setMenuAnchor] = useState(null);
|
|
308
|
+
/** The open menu, so its own scrolling can be told from the page's. */ const menuRef = useRef(null);
|
|
309
|
+
const menuOpen = Boolean(menuAnchor);
|
|
310
|
+
const closeMenu = useCallback(()=>setMenuAnchor(null), []);
|
|
311
|
+
/**
|
|
312
|
+
* The anchor for one pointer event: the row's right edge, the pointer's
|
|
313
|
+
* height. Read once, at the moment of the click — a fixed rect, so the
|
|
314
|
+
* menu cannot drift while it is open.
|
|
315
|
+
*/ const anchorFor = useCallback((e)=>{
|
|
316
|
+
var _ref, _ref1;
|
|
317
|
+
var _e_currentTarget;
|
|
318
|
+
const row = (_ref = (_e_currentTarget = e.currentTarget) == null ? void 0 : _e_currentTarget.closest(`.${classKey.treeListItem}`)) != null ? _ref : e.currentTarget;
|
|
319
|
+
const rect = row == null ? void 0 : row.getBoundingClientRect();
|
|
320
|
+
if (!rect) return null;
|
|
321
|
+
/**
|
|
322
|
+
* The PANEL's edge, not the row's.
|
|
323
|
+
*
|
|
324
|
+
* A deep row is wider than the panel — the hierarchy scrolls
|
|
325
|
+
* horizontally, and indentation is what makes it — so `row.right` is a
|
|
326
|
+
* coordinate off the side of the visible panel, and a menu placed
|
|
327
|
+
* there opens in the middle of the canvas with a gap behind it. The
|
|
328
|
+
* nearest ancestor that actually scrolls is the panel, and its right
|
|
329
|
+
* edge is the boundary the menu should start from.
|
|
330
|
+
*
|
|
331
|
+
* Falls back to the row when nothing above it scrolls, which is the
|
|
332
|
+
* case the row's own edge is the right answer for.
|
|
333
|
+
*/ let scroller = row;
|
|
334
|
+
while(scroller && scroller.scrollWidth <= scroller.clientWidth){
|
|
335
|
+
scroller = scroller.parentElement;
|
|
336
|
+
}
|
|
337
|
+
const bound = scroller == null ? void 0 : scroller.getBoundingClientRect();
|
|
338
|
+
const x = Math.min(rect.right, (_ref1 = bound == null ? void 0 : bound.right) != null ? _ref1 : rect.right);
|
|
339
|
+
const y = e.clientY || rect.top + rect.height / 2;
|
|
340
|
+
return {
|
|
341
|
+
getBoundingClientRect: ()=>new DOMRect(x, y, 0, 0)
|
|
342
|
+
};
|
|
343
|
+
}, []);
|
|
344
|
+
const toggleMenu = useCallback((e)=>{
|
|
345
|
+
// The row is a button and the tree item is a drop target; without this
|
|
346
|
+
// the click also selects and re-focuses the row underneath the menu.
|
|
347
|
+
e.stopPropagation();
|
|
348
|
+
e.preventDefault();
|
|
349
|
+
const next = anchorFor(e);
|
|
350
|
+
setMenuAnchor((open)=>open ? null : next);
|
|
351
|
+
}, [
|
|
352
|
+
anchorFor
|
|
353
|
+
]);
|
|
354
|
+
/**
|
|
355
|
+
* Right-click opens the same menu at the pointer. The row already carries
|
|
356
|
+
* every action a node has, and a layer tree that does not answer a
|
|
357
|
+
* right-click is one people assume is broken — they find the ⋮ eventually
|
|
358
|
+
* and read it as a workaround.
|
|
359
|
+
*
|
|
360
|
+
* `preventDefault` suppresses the browser's own menu, which is the whole
|
|
361
|
+
* point; nothing is lost, since the row holds no text to copy and no link
|
|
362
|
+
* to open.
|
|
363
|
+
*/ // Escape as well as a click outside. A menu opened by a right-click is
|
|
364
|
+
// dismissed with Escape everywhere else, and the keyboard is the only way
|
|
365
|
+
// out for anyone not using a pointer. On the document rather than the
|
|
366
|
+
// Paper: the menu does not take focus when it opens, so a handler on it
|
|
367
|
+
// would never see the key.
|
|
368
|
+
useEffect(()=>{
|
|
369
|
+
if (!menuOpen) return;
|
|
370
|
+
const onKeyDown = (event)=>{
|
|
371
|
+
if (event.key === 'Escape') closeMenu();
|
|
372
|
+
};
|
|
373
|
+
/**
|
|
374
|
+
* Scrolling dismisses it, which is what every native context menu does.
|
|
375
|
+
* The alternative is worse than it sounds: the menu is anchored to a
|
|
376
|
+
* point on screen, so scrolling the hierarchy slides the row out from
|
|
377
|
+
* under a menu that stays put — leaving a menu for an element the
|
|
378
|
+
* reader can no longer see, hanging over the canvas.
|
|
379
|
+
*
|
|
380
|
+
* Capture phase: the hierarchy scrolls inside its own container, and a
|
|
381
|
+
* scroll event from an element does not bubble to the document.
|
|
382
|
+
*/ const onScroll = (event)=>{
|
|
383
|
+
var _menuRef_current;
|
|
384
|
+
// Not the menu's own scroll. The Paper caps its height and scrolls,
|
|
385
|
+
// so a long menu is scrolled the same way anything else is — and
|
|
386
|
+
// dismissing it for that is dismissing it for being used.
|
|
387
|
+
const target = event.target;
|
|
388
|
+
if (target && ((_menuRef_current = menuRef.current) == null ? void 0 : _menuRef_current.contains(target))) return;
|
|
389
|
+
closeMenu();
|
|
390
|
+
};
|
|
391
|
+
document.addEventListener('keydown', onKeyDown);
|
|
392
|
+
document.addEventListener('scroll', onScroll, true);
|
|
393
|
+
return ()=>{
|
|
394
|
+
document.removeEventListener('keydown', onKeyDown);
|
|
395
|
+
document.removeEventListener('scroll', onScroll, true);
|
|
396
|
+
};
|
|
397
|
+
}, [
|
|
398
|
+
menuOpen,
|
|
399
|
+
closeMenu
|
|
400
|
+
]);
|
|
401
|
+
/**
|
|
402
|
+
* Right-click anywhere on the row opens the same menu. The row already
|
|
403
|
+
* carries every action a node has, and a layer tree that does not answer
|
|
404
|
+
* a right-click is one people assume is broken — they find the ⋮
|
|
405
|
+
* eventually and read it as a workaround.
|
|
406
|
+
*
|
|
407
|
+
* Anchored to the ROW rather than the pointer, which is the usual desktop
|
|
408
|
+
* convention and is wrong here: a menu at the cursor opens wherever in
|
|
409
|
+
* the panel the pointer happened to be, on top of the layer list. Off the
|
|
410
|
+
* row it always starts at the panel's edge and spills into the canvas.
|
|
411
|
+
*
|
|
412
|
+
* `preventDefault` suppresses the browser's own menu, which is the whole
|
|
413
|
+
* point; nothing is lost, since the row holds no text to copy and no link
|
|
414
|
+
* to open.
|
|
415
|
+
*/ const openMenuOnRow = useCallback((e)=>{
|
|
416
|
+
e.preventDefault();
|
|
417
|
+
e.stopPropagation();
|
|
418
|
+
setMenuAnchor(anchorFor(e));
|
|
419
|
+
}, [
|
|
420
|
+
anchorFor
|
|
421
|
+
]);
|
|
422
|
+
if (!node) return /*#__PURE__*/ _jsx(_Fragment, {
|
|
423
|
+
children: "'Invalid node'"
|
|
424
|
+
});
|
|
425
|
+
return /*#__PURE__*/ _jsxs(TreeItem, _extends({
|
|
426
|
+
ref: ref,
|
|
427
|
+
// ref={setDraggableNodeRef}
|
|
428
|
+
"data-aglyn-node": nodeId
|
|
429
|
+
}, dragAttributes, {
|
|
430
|
+
depth: depth,
|
|
431
|
+
onMouseEnter: (e)=>onItemHover(e, nodeId),
|
|
432
|
+
onFocus: (e)=>onItemFocus(e, nodeId),
|
|
433
|
+
className: clsx(className, classKey.treeItem, {
|
|
434
|
+
[classKey.itemSelected]: isSelected,
|
|
435
|
+
[classKey.itemHovered]: isHovered,
|
|
436
|
+
[classKey.itemIsDragging]: isDragging,
|
|
437
|
+
[classKey.itemIsDragOver]: isOver
|
|
438
|
+
}),
|
|
439
|
+
disablePadding: true,
|
|
440
|
+
style: style,
|
|
441
|
+
sx: dimsSubtree ? {
|
|
442
|
+
// A hidden layer reads as hidden at a glance, without being
|
|
443
|
+
// selected or hovered — the row is the only place it is
|
|
444
|
+
// always on screen, because on the canvas it is by
|
|
445
|
+
// definition the thing you cannot see.
|
|
446
|
+
//
|
|
447
|
+
// On the TreeItem rather than the row, so the dim carries to
|
|
448
|
+
// every layer underneath: a container that does not ship
|
|
449
|
+
// takes its contents with it, and a full-strength child row
|
|
450
|
+
// inside a dimmed parent reads as "this one still ships".
|
|
451
|
+
//
|
|
452
|
+
// Held at 0.45 rather than hidden outright so names stay
|
|
453
|
+
// legible, and nothing here changes what the rows DO — a
|
|
454
|
+
// hidden element is still one you select, drag, rename and
|
|
455
|
+
// style.
|
|
456
|
+
opacity: 0.45,
|
|
457
|
+
fontStyle: 'italic'
|
|
458
|
+
} : undefined
|
|
459
|
+
}, rest, {
|
|
460
|
+
children: [
|
|
461
|
+
/*#__PURE__*/ _jsxs(Stack, {
|
|
462
|
+
ref: (e)=>{
|
|
463
|
+
setDraggableNodeRef(e);
|
|
464
|
+
setDroppableNodeRef(e);
|
|
465
|
+
},
|
|
466
|
+
className: classKey.treeListItem,
|
|
467
|
+
direction: "row",
|
|
468
|
+
onContextMenu: openMenuOnRow,
|
|
469
|
+
children: [
|
|
470
|
+
!isRootNode && /*#__PURE__*/ _jsx(MuiListItemIcon, _extends({}, draggableListeners, {
|
|
471
|
+
className: classKey.dragHandle,
|
|
472
|
+
draggable: true,
|
|
473
|
+
sx: {
|
|
474
|
+
minWidth: 23,
|
|
475
|
+
padding: 0.75,
|
|
476
|
+
pl: 0,
|
|
477
|
+
borderRadius: '4px',
|
|
478
|
+
cursor: 'move',
|
|
479
|
+
pointerEvents: dragDisabled ? 'none' : undefined,
|
|
480
|
+
opacity: dragDisabled ? 0.5 : undefined,
|
|
481
|
+
zIndex: 1
|
|
482
|
+
},
|
|
483
|
+
children: /*#__PURE__*/ _jsx(MdiIcon, {
|
|
484
|
+
color: "inherit",
|
|
485
|
+
fontSize: "inherit",
|
|
486
|
+
path: ICON_VARIANT_MODIFY_DRAG.path
|
|
487
|
+
})
|
|
488
|
+
})),
|
|
489
|
+
/*#__PURE__*/ _jsxs(MuiListItemButton, {
|
|
490
|
+
sx: {
|
|
491
|
+
// The gutter the depth guides are drawn in — one source for
|
|
492
|
+
// both, or the lines would stop landing on the level
|
|
493
|
+
// boundaries they mark.
|
|
494
|
+
paddingLeft: `${hierarchyGutterWidth(depth)}px`
|
|
495
|
+
},
|
|
496
|
+
onClick: (e)=>onItemSelect(e, nodeId),
|
|
497
|
+
onMouseOver: (e)=>onItemHover(e, nodeId),
|
|
498
|
+
dense: true,
|
|
499
|
+
children: [
|
|
500
|
+
/*#__PURE__*/ _jsx(MuiListItemIcon, {
|
|
501
|
+
sx: {
|
|
502
|
+
minWidth: 20,
|
|
503
|
+
mr: '1px'
|
|
504
|
+
},
|
|
505
|
+
children: /*#__PURE__*/ _jsx(IconButton, {
|
|
506
|
+
color: "default",
|
|
507
|
+
// The chevron is the only control in the row that is not the
|
|
508
|
+
// row itself, and it had no name in any form — a screen
|
|
509
|
+
// reader announced "button", and hovering it said nothing.
|
|
510
|
+
// It states which way it will go, not which way it points.
|
|
511
|
+
"aria-label": collapseIn ? 'Collapse children' : 'Expand children',
|
|
512
|
+
title: collapseIn ? 'Collapse children' : 'Expand children',
|
|
513
|
+
sx: {
|
|
514
|
+
padding: '2px',
|
|
515
|
+
visibility: !(node == null ? void 0 : node.hasNodes) ? 'hidden' : 'visible'
|
|
516
|
+
},
|
|
517
|
+
disabled: !(node == null ? void 0 : node.hasNodes),
|
|
518
|
+
onClick: (e)=>onItemToggle(e, nodeId),
|
|
519
|
+
children: collapseIn ? closeIcon : expandIcon
|
|
520
|
+
})
|
|
521
|
+
}),
|
|
522
|
+
/*#__PURE__*/ _jsx(MuiListItemIcon, {
|
|
523
|
+
sx: {
|
|
524
|
+
minWidth: 20,
|
|
525
|
+
mr: 0.5,
|
|
526
|
+
fontSize: 14,
|
|
527
|
+
padding: 0.2,
|
|
528
|
+
borderRadius: '0.25em',
|
|
529
|
+
backgroundColor: 'background.default',
|
|
530
|
+
border: 1,
|
|
531
|
+
borderColor: 'divider',
|
|
532
|
+
boxShadow: 1,
|
|
533
|
+
color: 'primary',
|
|
534
|
+
display: 'flex',
|
|
535
|
+
alignItems: 'center',
|
|
536
|
+
flexDirection: 'column'
|
|
537
|
+
},
|
|
538
|
+
children: /*#__PURE__*/ _jsx(ComponentIconComponent, {
|
|
539
|
+
component: node == null ? void 0 : node.componentSchema,
|
|
540
|
+
node: node
|
|
541
|
+
})
|
|
542
|
+
}),
|
|
543
|
+
/*#__PURE__*/ _jsx(MuiListItemText, {
|
|
544
|
+
primary: nodeLabel,
|
|
545
|
+
slotProps: {
|
|
546
|
+
primary: {
|
|
547
|
+
noWrap: true,
|
|
548
|
+
sx: {
|
|
549
|
+
maxWidth: '180px',
|
|
550
|
+
width: 'fit-content',
|
|
551
|
+
textOverflow: 'ellipsis'
|
|
552
|
+
}
|
|
553
|
+
}
|
|
554
|
+
}
|
|
555
|
+
})
|
|
556
|
+
]
|
|
557
|
+
}),
|
|
558
|
+
!isRootNode && /*#__PURE__*/ _jsx(Tooltip, {
|
|
559
|
+
title: authorHidden ? 'Hidden. Click to show it.' : hiddenOnSite ? 'Starts hidden until an interaction shows it. Click to hide it outright.' : 'Visible. Click to hide it — here and on the published site.',
|
|
560
|
+
children: /*#__PURE__*/ _jsx(IconButton, {
|
|
561
|
+
"aria-label": authorHidden ? `Show ${nodeLabel}` : `Hide ${nodeLabel}`,
|
|
562
|
+
"aria-pressed": authorHidden,
|
|
563
|
+
className: classKey.visibilityButton,
|
|
564
|
+
color: "default",
|
|
565
|
+
onClick: toggleVisibility,
|
|
566
|
+
size: "small",
|
|
567
|
+
sx: {
|
|
568
|
+
alignSelf: 'center',
|
|
569
|
+
flexShrink: 0,
|
|
570
|
+
padding: '2px',
|
|
571
|
+
color: 'text.disabled',
|
|
572
|
+
// Quiet on a visible element and permanent on a hidden one:
|
|
573
|
+
// an eye on every row at full strength turns the hierarchy
|
|
574
|
+
// into a column of icons, and the state worth seeing at a
|
|
575
|
+
// glance is which elements the site does NOT ship. Focus
|
|
576
|
+
// brings it back, so it is reachable by keyboard on a row
|
|
577
|
+
// the pointer never touches.
|
|
578
|
+
opacity: authorHidden ? 1 : 0,
|
|
579
|
+
transition: 'opacity 120ms',
|
|
580
|
+
'&:focus-visible': {
|
|
581
|
+
opacity: 1
|
|
582
|
+
},
|
|
583
|
+
[`.${classKey.treeListItem}:hover &`]: {
|
|
584
|
+
opacity: 1
|
|
585
|
+
}
|
|
586
|
+
},
|
|
587
|
+
children: /*#__PURE__*/ _jsx(MdiIcon, {
|
|
588
|
+
fontSize: "inherit",
|
|
589
|
+
path: authorHidden ? ICON_VARIANT_VISIBILITY_HIDDEN.path : ICON_VARIANT_VISIBILITY_SHOWN.path
|
|
590
|
+
})
|
|
591
|
+
})
|
|
592
|
+
}),
|
|
593
|
+
/*#__PURE__*/ _jsx(IconButton, {
|
|
594
|
+
"aria-label": `Actions for ${nodeLabel}`,
|
|
595
|
+
"aria-expanded": menuOpen,
|
|
596
|
+
"aria-haspopup": "menu",
|
|
597
|
+
className: classKey.moreButton,
|
|
598
|
+
color: "default",
|
|
599
|
+
onClick: toggleMenu,
|
|
600
|
+
size: "small",
|
|
601
|
+
sx: {
|
|
602
|
+
alignSelf: 'center',
|
|
603
|
+
flexShrink: 0,
|
|
604
|
+
padding: '2px',
|
|
605
|
+
mr: 0.25
|
|
606
|
+
},
|
|
607
|
+
children: /*#__PURE__*/ _jsx(MdiIcon, {
|
|
608
|
+
fontSize: "inherit",
|
|
609
|
+
path: ICON_VARIANT_SHOW_MORE_VERTICAL.path
|
|
610
|
+
})
|
|
611
|
+
}),
|
|
612
|
+
menuOpen && /*#__PURE__*/ _jsx(Popper, {
|
|
613
|
+
anchorEl: menuAnchor,
|
|
614
|
+
open: true,
|
|
615
|
+
/**
|
|
616
|
+
* Opens SIDEWAYS, into the canvas (AGL-1405).
|
|
617
|
+
*
|
|
618
|
+
* Below the row it covered the hierarchy — including the layer
|
|
619
|
+
* being acted on, which is the one thing you want to keep
|
|
620
|
+
* looking at while you read the menu, and it left almost no
|
|
621
|
+
* panel to click on to dismiss it. To the right there is a
|
|
622
|
+
* whole canvas to spill over, and it belongs to no control.
|
|
623
|
+
*
|
|
624
|
+
* The fallbacks matter for the narrow-window case: `left-*`
|
|
625
|
+
* only wins when the canvas edge is closer than the menu is
|
|
626
|
+
* wide, and `bottom-start` is the last resort.
|
|
627
|
+
*/ placement: "right-start",
|
|
628
|
+
/**
|
|
629
|
+
* Kept inside the viewport. Without these the menu was laid
|
|
630
|
+
* out beside its anchor whatever room was left, so a row near
|
|
631
|
+
* the bottom of a long hierarchy pushed a 500px menu off the
|
|
632
|
+
* bottom of the document — and the PAGE grew a scrollbar to
|
|
633
|
+
* contain it, which moves the editor's own chrome under the
|
|
634
|
+
* reader.
|
|
635
|
+
*
|
|
636
|
+
* `flip` picks another side when this one does not fit;
|
|
637
|
+
* `preventOverflow` on the cross axis slides it up so a menu
|
|
638
|
+
* anchored near the bottom edge still lands fully on screen.
|
|
639
|
+
* The Paper caps its own height and scrolls, so a menu taller
|
|
640
|
+
* than the window is reachable rather than clipped.
|
|
641
|
+
*/ modifiers: [
|
|
642
|
+
{
|
|
643
|
+
name: 'flip',
|
|
644
|
+
enabled: true,
|
|
645
|
+
options: {
|
|
646
|
+
fallbackPlacements: [
|
|
647
|
+
'right-end',
|
|
648
|
+
'left-start',
|
|
649
|
+
'left-end',
|
|
650
|
+
'bottom-start'
|
|
651
|
+
],
|
|
652
|
+
padding: 8
|
|
653
|
+
}
|
|
654
|
+
},
|
|
655
|
+
{
|
|
656
|
+
name: 'preventOverflow',
|
|
657
|
+
enabled: true,
|
|
658
|
+
options: {
|
|
659
|
+
altAxis: true,
|
|
660
|
+
padding: 8
|
|
661
|
+
}
|
|
662
|
+
},
|
|
663
|
+
// Clear of the row it belongs to, so the layer's name and
|
|
664
|
+
// its eye stay readable beside the open menu.
|
|
665
|
+
{
|
|
666
|
+
name: 'offset',
|
|
667
|
+
options: {
|
|
668
|
+
offset: [
|
|
669
|
+
0,
|
|
670
|
+
6
|
|
671
|
+
]
|
|
672
|
+
}
|
|
673
|
+
}
|
|
674
|
+
],
|
|
675
|
+
// Above the panel, below dialogs and drawers — the same band
|
|
676
|
+
// the canvas overlay's copy of this menu sits in.
|
|
677
|
+
sx: {
|
|
678
|
+
zIndex: (theme)=>theme.zIndex.modal - 1
|
|
679
|
+
},
|
|
680
|
+
children: /*#__PURE__*/ _jsx(ClickAwayListener, {
|
|
681
|
+
onClickAway: closeMenu,
|
|
682
|
+
children: /*#__PURE__*/ _jsx(NodeContextMenu, {
|
|
683
|
+
ref: menuRef,
|
|
684
|
+
node: node,
|
|
685
|
+
onAction: closeMenu
|
|
686
|
+
})
|
|
687
|
+
})
|
|
688
|
+
})
|
|
689
|
+
]
|
|
690
|
+
}),
|
|
691
|
+
(node == null ? void 0 : node.hasNodes) && /*#__PURE__*/ _jsxs(Box, {
|
|
692
|
+
className: classKey.subTreeView,
|
|
693
|
+
sx: {
|
|
694
|
+
position: 'relative'
|
|
695
|
+
},
|
|
696
|
+
children: [
|
|
697
|
+
/*#__PURE__*/ _jsx(Divider, {
|
|
698
|
+
orientation: "vertical",
|
|
699
|
+
sx: {
|
|
700
|
+
position: 'absolute',
|
|
701
|
+
height: 1,
|
|
702
|
+
left: `${depth <= 1 ? depth < 1 ? 20 - 9 : 34 : depth * 23 + 11}px`,
|
|
703
|
+
zIndex: 0,
|
|
704
|
+
pointerEvents: 'none'
|
|
705
|
+
}
|
|
706
|
+
}),
|
|
707
|
+
/*#__PURE__*/ _jsx(Collapse, {
|
|
708
|
+
unmountOnExit: true,
|
|
709
|
+
in: collapseIn,
|
|
710
|
+
children: /*#__PURE__*/ _jsx(TreeView, {
|
|
711
|
+
disablePadding: true,
|
|
712
|
+
children: node == null ? void 0 : (_node_nodes = node.nodes) == null ? void 0 : _node_nodes.map((nodeId)=>/*#__PURE__*/ _jsx(NodeTreeItem, {
|
|
713
|
+
nodeId: nodeId
|
|
714
|
+
}, nodeId))
|
|
715
|
+
})
|
|
716
|
+
})
|
|
717
|
+
]
|
|
718
|
+
})
|
|
719
|
+
]
|
|
720
|
+
}));
|
|
721
|
+
}));
|
|
722
|
+
NodeTreeItem.displayName = 'NodeTreeItem';
|
|
723
|
+
const TreeViewContext = /*#__PURE__*/ createContext({
|
|
724
|
+
expanded: [],
|
|
725
|
+
// selected: null,
|
|
726
|
+
closeIcon: '●',
|
|
727
|
+
expandIcon: '○',
|
|
728
|
+
onItemSelect: noop,
|
|
729
|
+
onItemToggle: noop,
|
|
730
|
+
onItemHover: noop,
|
|
731
|
+
onItemFocus: noop
|
|
732
|
+
});
|
|
733
|
+
const CloseIcon = /*#__PURE__*/ _jsx(MdiIcon, {
|
|
734
|
+
fontSize: "small",
|
|
735
|
+
path: ICON_VARIANT_COLLAPSIBLE_CLOSE.path
|
|
736
|
+
});
|
|
737
|
+
const ExpandIcon = /*#__PURE__*/ _jsx(MdiIcon, {
|
|
738
|
+
fontSize: "small",
|
|
739
|
+
path: ICON_VARIANT_COLLAPSIBLE_OPEN.path
|
|
740
|
+
});
|
|
741
|
+
export const NodeTreeView = observer(/*#__PURE__*/ forwardRef((props, ref)=>{
|
|
742
|
+
const { TreeViewProps } = props, rest = _object_without_properties_loose(props, [
|
|
743
|
+
"TreeViewProps"
|
|
744
|
+
]);
|
|
745
|
+
const allExpanded = Besigner.focus.getAllExpanded();
|
|
746
|
+
const manuallyCollapsed = Besigner.focus.getManuallyCollapsed();
|
|
747
|
+
const expanded = useMemo(()=>{
|
|
748
|
+
const paths = allExpanded.reduce((acc, i)=>{
|
|
749
|
+
return [
|
|
750
|
+
...acc,
|
|
751
|
+
...(i == null ? void 0 : i.breadcrumbPath) || []
|
|
752
|
+
];
|
|
753
|
+
}, []);
|
|
754
|
+
return uniq(paths).filter((id)=>!manuallyCollapsed.includes(id));
|
|
755
|
+
}, [
|
|
756
|
+
allExpanded,
|
|
757
|
+
manuallyCollapsed
|
|
758
|
+
]);
|
|
759
|
+
const handleTreeItemToggle = useCallback((e, $id)=>{
|
|
760
|
+
e.stopPropagation();
|
|
761
|
+
e.preventDefault();
|
|
762
|
+
const node = canvas.getNode($id);
|
|
763
|
+
if (!node) return;
|
|
764
|
+
Besigner.focus.toggleNodeExpansion(node);
|
|
765
|
+
}, []);
|
|
766
|
+
const handleTreeItemSelect = useCallback((e, $id)=>{
|
|
767
|
+
e.stopPropagation();
|
|
768
|
+
e.preventDefault();
|
|
769
|
+
const node = canvas.getNode($id);
|
|
770
|
+
if (!node) return;
|
|
771
|
+
// Multi-selection modifiers (AGL-8): Shift ranges from the anchor,
|
|
772
|
+
// Cmd/Ctrl toggles membership, plain click single-selects.
|
|
773
|
+
if (e.shiftKey) {
|
|
774
|
+
Besigner.focus.rangeSelectNode(node);
|
|
775
|
+
} else {
|
|
776
|
+
Besigner.focus.handleNodeSelection(node, e.metaKey || e.ctrlKey);
|
|
777
|
+
}
|
|
778
|
+
}, []);
|
|
779
|
+
const handleTreeItemHover = useCallback((e, $id)=>{
|
|
780
|
+
const node = canvas.getNode($id);
|
|
781
|
+
if (!node) return;
|
|
782
|
+
Besigner.focus.setHoveredNode(node);
|
|
783
|
+
}, []);
|
|
784
|
+
const handleTreeItemFocus = useCallback((e, $id)=>{
|
|
785
|
+
e.stopPropagation();
|
|
786
|
+
const node = canvas.getNode($id);
|
|
787
|
+
if (!node) return;
|
|
788
|
+
Besigner.focus.setHoveredNode(node);
|
|
789
|
+
}, []);
|
|
790
|
+
return /*#__PURE__*/ _jsx(TreeViewContext.Provider, {
|
|
791
|
+
value: {
|
|
792
|
+
expanded: expanded,
|
|
793
|
+
closeIcon: CloseIcon,
|
|
794
|
+
expandIcon: ExpandIcon,
|
|
795
|
+
onItemFocus: handleTreeItemFocus,
|
|
796
|
+
onItemHover: handleTreeItemHover,
|
|
797
|
+
onItemSelect: handleTreeItemSelect,
|
|
798
|
+
onItemToggle: handleTreeItemToggle
|
|
799
|
+
},
|
|
800
|
+
children: /*#__PURE__*/ _jsx(Box, _extends({
|
|
801
|
+
ref: ref,
|
|
802
|
+
component: "nav",
|
|
803
|
+
id: 'aglyn:node-tree-view',
|
|
804
|
+
"aria-label": "canvas nodes navigator"
|
|
805
|
+
}, rest, {
|
|
806
|
+
children: /*#__PURE__*/ _jsx(TreeView, _extends({
|
|
807
|
+
className: classKey.root
|
|
808
|
+
}, TreeViewProps, {
|
|
809
|
+
children: /*#__PURE__*/ _jsx(NodeTreeItem, {
|
|
810
|
+
nodeId: NODE_ROOT_ID
|
|
811
|
+
})
|
|
812
|
+
}))
|
|
813
|
+
}))
|
|
814
|
+
});
|
|
815
|
+
}));
|
|
816
|
+
NodeTreeView.displayName = 'NodeTreeView';
|
|
817
|
+
NodeTreeView.aglyn = true;
|
|
818
|
+
export default NodeTreeView;
|
|
819
|
+
|
|
820
|
+
//# sourceMappingURL=node-tree-view.js.map
|