@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,338 @@
|
|
|
1
|
+
import { _ as _extends } from "@swc/helpers/_/_extends";
|
|
2
|
+
/**
|
|
3
|
+
* @license
|
|
4
|
+
* Copyright 2026 Aglyn LLC
|
|
5
|
+
*
|
|
6
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
7
|
+
* you may not use this file except in compliance with the License.
|
|
8
|
+
* You may obtain a copy of the License at
|
|
9
|
+
*
|
|
10
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
+
*
|
|
12
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
13
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
14
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
15
|
+
* See the License for the specific language governing permissions and
|
|
16
|
+
* limitations under the License.
|
|
17
|
+
*/ import { mergeNodeSx, mergeSchemeValue } from "@aglyn/aglyn";
|
|
18
|
+
import isEqual from "lodash-es/isEqual.js";
|
|
19
|
+
/**
|
|
20
|
+
* Interaction-state style slices for the Styles panel (AGL-2486 item 39).
|
|
21
|
+
*
|
|
22
|
+
* Hover, focus and active states are reachable in the document already — the
|
|
23
|
+
* JSS tab's own caption advertises nested selectors — but only by typing raw
|
|
24
|
+
* sx, which most of this panel's audience cannot do. These slices are the
|
|
25
|
+
* picker for the same capability.
|
|
26
|
+
*
|
|
27
|
+
* ## What is stored is the REAL selector
|
|
28
|
+
*
|
|
29
|
+
* A state slice is `node.sx['&:hover']`, not a reserved `@state hover` key.
|
|
30
|
+
* That choice is what makes this feature need NO renderer change at all:
|
|
31
|
+
* MUI's `styleFunctionSx` hands an unrecognised object key straight back to
|
|
32
|
+
* itself (`wrapper.sx = value; css[styleKey] = styleFunctionSx(wrapper)`), so
|
|
33
|
+
* the slice gets the full sx treatment — palette tokens, system-prop aliases
|
|
34
|
+
* (`bgcolor`), and responsive breakpoint objects — identically on the canvas,
|
|
35
|
+
* in Preview and on the published page. A reserved key would have needed a
|
|
36
|
+
* substitution pass on every render path, and the recorded reason the scheme
|
|
37
|
+
* slices work is that there is exactly ONE such path.
|
|
38
|
+
*
|
|
39
|
+
* It also means the panel and the JSS tab are editing the same thing rather
|
|
40
|
+
* than two representations of it, and that an author who already hand-wrote
|
|
41
|
+
* `&:hover` finds the panel showing it.
|
|
42
|
+
*
|
|
43
|
+
* ## Nesting order: state OUTER, scheme INNER, breakpoints innermost
|
|
44
|
+
*
|
|
45
|
+
* ```ts
|
|
46
|
+
* { '&:hover': { '@scheme dark': { color: { xs: '#eee', md: '#fff' } } } }
|
|
47
|
+
* ```
|
|
48
|
+
*
|
|
49
|
+
* Not a new invariant — `scheme-rendering.spec.tsx` already proves
|
|
50
|
+
* `resolveSchemeSx` resolves exactly this shape, because it recurses into
|
|
51
|
+
* nested selector objects. The REVERSE order would be a bug: `mergeSchemeValue`
|
|
52
|
+
* replaces a nested object wholesale, so a `@scheme dark` slice containing
|
|
53
|
+
* `&:hover` would clobber the light hover block rather than merge with it.
|
|
54
|
+
*
|
|
55
|
+
* ## The scrub is not bypassed
|
|
56
|
+
*
|
|
57
|
+
* `sanitizeAuthorSx` walks nested records with no key filtering, and
|
|
58
|
+
* `leaf-author-css.spec.tsx` already asserts that a `url(http://…)` inside an
|
|
59
|
+
* `&:hover` slice is rewritten to `about:invalid`. Author CSS in a state slice
|
|
60
|
+
* goes through the same scrub as author CSS anywhere else.
|
|
61
|
+
*/ /**
|
|
62
|
+
* The interaction states the panel offers, in the order the chip row shows
|
|
63
|
+
* them.
|
|
64
|
+
*
|
|
65
|
+
* ## Why plain `:focus` is deliberately absent — do not "fix" this
|
|
66
|
+
*
|
|
67
|
+
* `:focus` matches on mouse and touch focus as well as keyboard focus, so the
|
|
68
|
+
* overwhelmingly common thing an author does with a `:focus` control is remove
|
|
69
|
+
* the ring they consider ugly on click — and that removes it for keyboard
|
|
70
|
+
* users too, who have no other way to tell where they are on the page. Adding
|
|
71
|
+
* the field would mean shipping a purpose-built UI for an accessibility
|
|
72
|
+
* regression, on a product whose authors are explicitly not expected to know
|
|
73
|
+
* CSS.
|
|
74
|
+
*
|
|
75
|
+
* `:focus-visible` is the same capability without that failure mode: the
|
|
76
|
+
* browser only matches it when it judges a focus indicator should be shown
|
|
77
|
+
* (keyboard and programmatic focus, not a mouse click), so styling it can
|
|
78
|
+
* essentially only ADD an indicator. That covers the legitimate reason to
|
|
79
|
+
* style focus — making the ring match the brand — while making the harmful
|
|
80
|
+
* one much harder to reach by accident.
|
|
81
|
+
*
|
|
82
|
+
* An author with a genuine `:focus` need still has the JSS (sx) tab, which
|
|
83
|
+
* accepts any selector. That friction is the point: it is reachable by someone
|
|
84
|
+
* who knows what they are doing and not by someone clicking through a panel.
|
|
85
|
+
*/ export const SX_STATES = Object.freeze([
|
|
86
|
+
'hover',
|
|
87
|
+
'active',
|
|
88
|
+
'focusVisible',
|
|
89
|
+
'disabled'
|
|
90
|
+
]);
|
|
91
|
+
/** The CSS selector each state is stored under in `node.sx`. */ export const SX_STATE_SELECTORS = Object.freeze({
|
|
92
|
+
hover: '&:hover',
|
|
93
|
+
active: '&:active',
|
|
94
|
+
focusVisible: '&:focus-visible',
|
|
95
|
+
disabled: '&:disabled'
|
|
96
|
+
});
|
|
97
|
+
/**
|
|
98
|
+
* Chip labels. **Keep them short — this row must never wrap.**
|
|
99
|
+
*
|
|
100
|
+
* These shipped once as "Focus (keyboard)", to stop a bare "Focus" implying
|
|
101
|
+
* that the mouse-click ring is what you are styling. The reasoning was right
|
|
102
|
+
* and the label was wrong: measured against the styles panel, the five chips
|
|
103
|
+
* needed **368px** of the **359px** a default 375px panel has, so `Disabled`
|
|
104
|
+
*
|
|
105
|
+
* Short labels bring the row to 272px, which fits every panel width down to
|
|
106
|
+
* about 290px, and {@link SX_STATE_LABEL_MAX} pins them so the next person to
|
|
107
|
+
* reach for a clarifying parenthetical gets a failing test instead of a
|
|
108
|
+
* wrapped row.
|
|
109
|
+
*
|
|
110
|
+
* The keyboard nuance did not get dropped, it moved somewhere better than a
|
|
111
|
+
* label: {@link SX_STATE_DESCRIPTIONS} carries the full rule in the chip
|
|
112
|
+
* tooltip, and {@link SX_STATE_PROSE} puts "keyboard focus" in the preview
|
|
113
|
+
* banner — which appears the moment Focus is selected, so it is READ rather
|
|
114
|
+
* than hovered for. That is the same job the long label was doing, done where
|
|
115
|
+
* there is room for it.
|
|
116
|
+
*/ export const SX_STATE_LABELS = Object.freeze({
|
|
117
|
+
hover: 'Hover',
|
|
118
|
+
active: 'Active',
|
|
119
|
+
focusVisible: 'Focus',
|
|
120
|
+
disabled: 'Disabled'
|
|
121
|
+
});
|
|
122
|
+
/**
|
|
123
|
+
* The longest a chip label may be before the row stops fitting a narrow
|
|
124
|
+
* panel. `Disabled` is 8 and is the longest today; the budget is measured,
|
|
125
|
+
* not guessed — see {@link SX_STATE_LABELS}.
|
|
126
|
+
*/ export const SX_STATE_LABEL_MAX = 8;
|
|
127
|
+
/** The same states in running prose — banners, the override chips. */ export const SX_STATE_PROSE = Object.freeze({
|
|
128
|
+
hover: 'hover',
|
|
129
|
+
active: 'active',
|
|
130
|
+
focusVisible: 'keyboard focus',
|
|
131
|
+
disabled: 'disabled'
|
|
132
|
+
});
|
|
133
|
+
/**
|
|
134
|
+
* What each state means, in the panel's voice — shown as the chip tooltip so
|
|
135
|
+
* an author can tell `Active` (held down) from `Focus` (keyboard) without
|
|
136
|
+
* knowing the selectors.
|
|
137
|
+
*/ export const SX_STATE_DESCRIPTIONS = Object.freeze({
|
|
138
|
+
hover: 'While the pointer is over this element.',
|
|
139
|
+
active: 'While this element is being pressed or clicked.',
|
|
140
|
+
focusVisible: 'While this element has keyboard focus. Styling this state adds to the ' + 'focus indicator keyboard visitors rely on — it will not show on a ' + 'plain mouse click.',
|
|
141
|
+
disabled: 'While this element is disabled. Only form controls can be disabled.'
|
|
142
|
+
});
|
|
143
|
+
const STATE_SELECTOR_SET = new Set(Object.values(SX_STATE_SELECTORS));
|
|
144
|
+
/** Whether an sx key is one of the state selectors this module owns. */ export function isSxStateSelector(key) {
|
|
145
|
+
return STATE_SELECTOR_SET.has(key);
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* The state a stored selector belongs to, or null when the key is not one of
|
|
149
|
+
* ours. Lets a surface that lists RAW sx keys — the instance-override chips —
|
|
150
|
+
* name a slice the way the chip row does instead of printing `&:hover` at an
|
|
151
|
+
* author who never typed it.
|
|
152
|
+
*/ export function sxStateForSelector(key) {
|
|
153
|
+
var _SX_STATES_find;
|
|
154
|
+
return (_SX_STATES_find = SX_STATES.find((state)=>SX_STATE_SELECTORS[state] === key)) != null ? _SX_STATES_find : null;
|
|
155
|
+
}
|
|
156
|
+
/** The override-chip label for a raw sx key, or null to fall through. */ export function sxStateSliceLabel(key) {
|
|
157
|
+
const state = sxStateForSelector(key);
|
|
158
|
+
return state ? `${SX_STATE_PROSE[state]} state` : null;
|
|
159
|
+
}
|
|
160
|
+
const isPlainObject = (value)=>typeof value === 'object' && value !== null && !Array.isArray(value);
|
|
161
|
+
/**
|
|
162
|
+
* The stored slice for a state, or undefined when the element has none.
|
|
163
|
+
*
|
|
164
|
+
* `state: null` is the base scope and returns the record itself, so callers
|
|
165
|
+
* can pass the panel's active scope through without branching.
|
|
166
|
+
*/ export function readStateSlice(sx, state) {
|
|
167
|
+
if (!state) return sx;
|
|
168
|
+
const slice = sx == null ? void 0 : sx[SX_STATE_SELECTORS[state]];
|
|
169
|
+
return isPlainObject(slice) ? slice : undefined;
|
|
170
|
+
}
|
|
171
|
+
/**
|
|
172
|
+
* What the element actually LOOKS like in a state: the base styles with the
|
|
173
|
+
* state slice merged over them, which is what the browser paints because a
|
|
174
|
+
* `:hover` block only overrides the properties it names.
|
|
175
|
+
*
|
|
176
|
+
* This is what the panel reads from, so a field the author has not overridden
|
|
177
|
+
* for hover shows the inherited base value rather than empty — the same
|
|
178
|
+
* reading the breakpoint scope gives, and the reason the write seam can skip
|
|
179
|
+
* a value that would not change anything.
|
|
180
|
+
*
|
|
181
|
+
* `mergeNodeSx` is the house merge: responsive objects cascade mobile-first,
|
|
182
|
+
* `@scheme dark` and nested selector blocks merge key by key. Reusing it keeps
|
|
183
|
+
* the panel's reading identical to the graft's.
|
|
184
|
+
*
|
|
185
|
+
* Returns the input BY IDENTITY at base scope or when no slice exists, which
|
|
186
|
+
* is every element that has never been given a state style.
|
|
187
|
+
*/ /**
|
|
188
|
+
* The element's base styles with every state selector removed — the baseline a
|
|
189
|
+
* state slice is a difference FROM. Returned by identity when the element
|
|
190
|
+
* carries no state slices at all, which is every element today.
|
|
191
|
+
*/ export function stripStateSlices(sx) {
|
|
192
|
+
if (!sx) return sx;
|
|
193
|
+
if (!Object.keys(sx).some(isSxStateSelector)) return sx;
|
|
194
|
+
const base = _extends({}, sx);
|
|
195
|
+
for (const selector of STATE_SELECTOR_SET)delete base[selector];
|
|
196
|
+
return base;
|
|
197
|
+
}
|
|
198
|
+
export function stateScopedSx(sx, state) {
|
|
199
|
+
const slice = state ? readStateSlice(sx, state) : undefined;
|
|
200
|
+
if (!slice) return sx;
|
|
201
|
+
// Every state selector is dropped from the reading: the slice being edited
|
|
202
|
+
// is merged in below, and a SIBLING state's block is not part of what this
|
|
203
|
+
// state looks like.
|
|
204
|
+
const base = stripStateSlices(sx);
|
|
205
|
+
return mergeNodeSx(base, slice);
|
|
206
|
+
}
|
|
207
|
+
/**
|
|
208
|
+
* Replaces one state's slice, removing it entirely when it comes back empty.
|
|
209
|
+
*
|
|
210
|
+
* An emptied slice is DELETED rather than stored as `{}` — the same rule
|
|
211
|
+
* `writeSxValue` applies to an emptied scheme slice and `getNodeStyleTarget`
|
|
212
|
+
* applies to an emptied instance override. A `{}` left behind would make
|
|
213
|
+
* "does this element have a hover style" answer yes forever, which the chip's
|
|
214
|
+
* own dot indicator and the override badge both read.
|
|
215
|
+
*
|
|
216
|
+
* Returns a new record; the input is never mutated.
|
|
217
|
+
*/ export function writeStateSlice(sx, state, slice) {
|
|
218
|
+
const next = _extends({}, sx);
|
|
219
|
+
const selector = SX_STATE_SELECTORS[state];
|
|
220
|
+
if (slice && Object.keys(slice).length > 0) next[selector] = slice;
|
|
221
|
+
else delete next[selector];
|
|
222
|
+
return next;
|
|
223
|
+
}
|
|
224
|
+
/**
|
|
225
|
+
* The slice implied by an edited state-scope reading (AGL-2486).
|
|
226
|
+
*
|
|
227
|
+
* The panel edits the MERGED record — base with the slice over it, which is
|
|
228
|
+
* what the element actually looks like in that state — so the write has to be
|
|
229
|
+
* split back out: only what genuinely differs from the base belongs in the
|
|
230
|
+
* slice. That split is what gives the three behaviours the panel needs, all
|
|
231
|
+
* from one rule:
|
|
232
|
+
*
|
|
233
|
+
* - a property the author changed for this state lands in the slice;
|
|
234
|
+
* - a property the author set back to the base value LEAVES the slice, because
|
|
235
|
+
* a `:hover` block that restates the base paints nothing and would show as a
|
|
236
|
+
* permanent override in the chip's dot;
|
|
237
|
+
* - a property the author cleared leaves the slice too, so the state falls
|
|
238
|
+
* back to inheriting the base — which is the only thing a pseudo-class block
|
|
239
|
+
* can express, since CSS has no way to un-declare a property.
|
|
240
|
+
*
|
|
241
|
+
* `base` must already have the state selectors stripped (which
|
|
242
|
+
* {@link stateScopedSx} does), or a sibling state's block would read as a
|
|
243
|
+
* difference and be copied in.
|
|
244
|
+
*/ export function deriveStateSlice(base, edited) {
|
|
245
|
+
const slice = {};
|
|
246
|
+
for (const [key, value] of Object.entries(edited != null ? edited : {})){
|
|
247
|
+
if (isSxStateSelector(key)) continue;
|
|
248
|
+
if (isEqual(base == null ? void 0 : base[key], value)) continue;
|
|
249
|
+
slice[key] = value;
|
|
250
|
+
}
|
|
251
|
+
return slice;
|
|
252
|
+
}
|
|
253
|
+
/** Whether the element carries any styles for this state. */ export function sxHasStateSlice(sx, state) {
|
|
254
|
+
const slice = readStateSlice(sx, state);
|
|
255
|
+
return !!slice && Object.keys(slice).length > 0;
|
|
256
|
+
}
|
|
257
|
+
/** Every state the element currently carries a slice for, in chip order. */ export function sxStatesWithSlices(sx) {
|
|
258
|
+
return SX_STATES.filter((state)=>sxHasStateSlice(sx, state));
|
|
259
|
+
}
|
|
260
|
+
/**
|
|
261
|
+
* Components that put a real tab stop / focusable control in the DOM. Matched
|
|
262
|
+
* on the component id, which is the only thing the panel reliably knows about
|
|
263
|
+
* an element before it renders.
|
|
264
|
+
*/ const INTERACTIVE_COMPONENT_PATTERN = /button|link|anchor|field|input|select|checkbox|radio|switch|slider|tabs?$|menuitem|textarea|toggle|rating|autocomplete/i;
|
|
265
|
+
/**
|
|
266
|
+
* The advisory to show under the state chips, or null when the state makes
|
|
267
|
+
* plain sense on this element (AGL-2486 item 39).
|
|
268
|
+
*
|
|
269
|
+
* States are deliberately NOT constrained by element type. A hover effect on a
|
|
270
|
+
* Box or Section wrapping a link is among the commonest real designs, and
|
|
271
|
+
* refusing it would block more good work than it prevents mistakes. But
|
|
272
|
+
* `:focus-visible` on something with no tab stop and `:disabled` on something
|
|
273
|
+
* that cannot be disabled will simply never fire, and an author who styles one
|
|
274
|
+
* and sees nothing has no way to find out why. So: allow it, and say so.
|
|
275
|
+
*/ export function stateAdvisory(state, element) {
|
|
276
|
+
var _element_componentId;
|
|
277
|
+
if (state !== 'focusVisible' && state !== 'disabled') return null;
|
|
278
|
+
const interactive = !!element.hasHref || !!element.hasTabIndex || INTERACTIVE_COMPONENT_PATTERN.test((_element_componentId = element.componentId) != null ? _element_componentId : '');
|
|
279
|
+
if (interactive) return null;
|
|
280
|
+
if (state === 'disabled') {
|
|
281
|
+
return 'Only form controls — buttons, inputs, selects — can be disabled. On ' + 'this element these styles are valid but will never show. You can still ' + 'set them if a plugin or custom code disables it.';
|
|
282
|
+
}
|
|
283
|
+
return 'This element cannot receive keyboard focus today, so these styles will ' + 'never show. They will start working if you make it a link or a button, ' + 'or give it a tab stop.';
|
|
284
|
+
}
|
|
285
|
+
/**
|
|
286
|
+
* CANVAS ONLY: renders an element as if it were in the given state, by
|
|
287
|
+
* hoisting that state's slice over the base declarations (AGL-2486 item 39).
|
|
288
|
+
*
|
|
289
|
+
* You cannot hover an element while working in a side panel, so a state whose
|
|
290
|
+
* styles you cannot see is a state you cannot design. This is what holds the
|
|
291
|
+
* state on — and it is deliberately NOT a toggle that can be left on and
|
|
292
|
+
* published by mistake: selecting the state in the panel's chip row IS the
|
|
293
|
+
* hold, so you cannot be editing the hover slice and not see hover, and
|
|
294
|
+
* returning to `Default` ends it. It lives in editor UI state and never enters
|
|
295
|
+
* the document, so Preview and the published page cannot receive it.
|
|
296
|
+
*
|
|
297
|
+
* Applied through `LeafSxTransformContext` — the SAME canvas-only seam the
|
|
298
|
+
* artboard device-width transform already uses, at the one point in `Leaf`
|
|
299
|
+
* where the merged sx reaches the element. There is still exactly one
|
|
300
|
+
* substitution path, and the tenant never mounts the provider.
|
|
301
|
+
*
|
|
302
|
+
* Runs on the fully merged sx AFTER scheme resolution, so a slice that carried
|
|
303
|
+
* `@scheme dark` has already collapsed to the active scheme's values by the
|
|
304
|
+
* time it is hoisted. `mergeSchemeValue` does the per-value merge so a
|
|
305
|
+
* responsive override keeps the base's other breakpoints.
|
|
306
|
+
*
|
|
307
|
+
* The hoisted selector is removed, so what renders is exactly the state's
|
|
308
|
+
* appearance rather than the state's appearance plus a live `:hover` that
|
|
309
|
+
* would repaint the same declarations. Sibling states are left untouched.
|
|
310
|
+
*
|
|
311
|
+
* Returns the input BY IDENTITY when there is nothing to hoist.
|
|
312
|
+
*/ export function hoistStateSx(sx, state) {
|
|
313
|
+
if (!state) return sx;
|
|
314
|
+
const selector = SX_STATE_SELECTORS[state];
|
|
315
|
+
if (Array.isArray(sx)) {
|
|
316
|
+
let changed = false;
|
|
317
|
+
const next = sx.map((entry)=>{
|
|
318
|
+
const value = hoistStateSx(entry, state);
|
|
319
|
+
if (value !== entry) changed = true;
|
|
320
|
+
return value;
|
|
321
|
+
});
|
|
322
|
+
return changed ? next : sx;
|
|
323
|
+
}
|
|
324
|
+
if (!isPlainObject(sx)) return sx;
|
|
325
|
+
const slice = sx[selector];
|
|
326
|
+
if (!isPlainObject(slice)) return sx;
|
|
327
|
+
const out = _extends({}, sx);
|
|
328
|
+
delete out[selector];
|
|
329
|
+
for (const [key, value] of Object.entries(slice)){
|
|
330
|
+
const merged = mergeSchemeValue(out[key], value);
|
|
331
|
+
if (merged === undefined) delete out[key];
|
|
332
|
+
else out[key] = merged;
|
|
333
|
+
}
|
|
334
|
+
return out;
|
|
335
|
+
}
|
|
336
|
+
export default SX_STATES;
|
|
337
|
+
|
|
338
|
+
//# sourceMappingURL=state-sx.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../../../../libs/besigner/feature/designer/src/lib/utils/state-sx.ts"],"sourcesContent":["/**\n * @license\n * Copyright 2026 Aglyn LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { mergeNodeSx, mergeSchemeValue } from '@aglyn/aglyn'\nimport type { BesignerStateFlag } from '@aglyn/besigner'\nimport isEqual from 'lodash-es/isEqual.js'\n\n/**\n * Interaction-state style slices for the Styles panel (AGL-2486 item 39).\n *\n * Hover, focus and active states are reachable in the document already — the\n * JSS tab's own caption advertises nested selectors — but only by typing raw\n * sx, which most of this panel's audience cannot do. These slices are the\n * picker for the same capability.\n *\n * ## What is stored is the REAL selector\n *\n * A state slice is `node.sx['&:hover']`, not a reserved `@state hover` key.\n * That choice is what makes this feature need NO renderer change at all:\n * MUI's `styleFunctionSx` hands an unrecognised object key straight back to\n * itself (`wrapper.sx = value; css[styleKey] = styleFunctionSx(wrapper)`), so\n * the slice gets the full sx treatment — palette tokens, system-prop aliases\n * (`bgcolor`), and responsive breakpoint objects — identically on the canvas,\n * in Preview and on the published page. A reserved key would have needed a\n * substitution pass on every render path, and the recorded reason the scheme\n * slices work is that there is exactly ONE such path.\n *\n * It also means the panel and the JSS tab are editing the same thing rather\n * than two representations of it, and that an author who already hand-wrote\n * `&:hover` finds the panel showing it.\n *\n * ## Nesting order: state OUTER, scheme INNER, breakpoints innermost\n *\n * ```ts\n * { '&:hover': { '@scheme dark': { color: { xs: '#eee', md: '#fff' } } } }\n * ```\n *\n * Not a new invariant — `scheme-rendering.spec.tsx` already proves\n * `resolveSchemeSx` resolves exactly this shape, because it recurses into\n * nested selector objects. The REVERSE order would be a bug: `mergeSchemeValue`\n * replaces a nested object wholesale, so a `@scheme dark` slice containing\n * `&:hover` would clobber the light hover block rather than merge with it.\n *\n * ## The scrub is not bypassed\n *\n * `sanitizeAuthorSx` walks nested records with no key filtering, and\n * `leaf-author-css.spec.tsx` already asserts that a `url(http://…)` inside an\n * `&:hover` slice is rewritten to `about:invalid`. Author CSS in a state slice\n * goes through the same scrub as author CSS anywhere else.\n */\n\n/**\n * The interaction states the panel offers, in the order the chip row shows\n * them.\n *\n * ## Why plain `:focus` is deliberately absent — do not \"fix\" this\n *\n * `:focus` matches on mouse and touch focus as well as keyboard focus, so the\n * overwhelmingly common thing an author does with a `:focus` control is remove\n * the ring they consider ugly on click — and that removes it for keyboard\n * users too, who have no other way to tell where they are on the page. Adding\n * the field would mean shipping a purpose-built UI for an accessibility\n * regression, on a product whose authors are explicitly not expected to know\n * CSS.\n *\n * `:focus-visible` is the same capability without that failure mode: the\n * browser only matches it when it judges a focus indicator should be shown\n * (keyboard and programmatic focus, not a mouse click), so styling it can\n * essentially only ADD an indicator. That covers the legitimate reason to\n * style focus — making the ring match the brand — while making the harmful\n * one much harder to reach by accident.\n *\n * An author with a genuine `:focus` need still has the JSS (sx) tab, which\n * accepts any selector. That friction is the point: it is reachable by someone\n * who knows what they are doing and not by someone clicking through a panel.\n */\nexport const SX_STATES: readonly BesignerStateFlag[] = Object.freeze([\n 'hover',\n 'active',\n 'focusVisible',\n 'disabled',\n])\n\n/**\n * Alias of the canvas flag union, which is declared in `@aglyn/besigner` so\n * the flag store that HOLDS the state and the panel that WRITES the slice\n * cannot drift apart.\n */\nexport type SxState = BesignerStateFlag\n\n/** The CSS selector each state is stored under in `node.sx`. */\nexport const SX_STATE_SELECTORS: Readonly<Record<SxState, string>> =\n Object.freeze({\n hover: '&:hover',\n active: '&:active',\n focusVisible: '&:focus-visible',\n disabled: '&:disabled',\n })\n\n/**\n * Chip labels. **Keep them short — this row must never wrap.**\n *\n * These shipped once as \"Focus (keyboard)\", to stop a bare \"Focus\" implying\n * that the mouse-click ring is what you are styling. The reasoning was right\n * and the label was wrong: measured against the styles panel, the five chips\n * needed **368px** of the **359px** a default 375px panel has, so `Disabled`\n *\n * Short labels bring the row to 272px, which fits every panel width down to\n * about 290px, and {@link SX_STATE_LABEL_MAX} pins them so the next person to\n * reach for a clarifying parenthetical gets a failing test instead of a\n * wrapped row.\n *\n * The keyboard nuance did not get dropped, it moved somewhere better than a\n * label: {@link SX_STATE_DESCRIPTIONS} carries the full rule in the chip\n * tooltip, and {@link SX_STATE_PROSE} puts \"keyboard focus\" in the preview\n * banner — which appears the moment Focus is selected, so it is READ rather\n * than hovered for. That is the same job the long label was doing, done where\n * there is room for it.\n */\nexport const SX_STATE_LABELS: Readonly<Record<SxState, string>> = Object.freeze({\n hover: 'Hover',\n active: 'Active',\n focusVisible: 'Focus',\n disabled: 'Disabled',\n})\n\n/**\n * The longest a chip label may be before the row stops fitting a narrow\n * panel. `Disabled` is 8 and is the longest today; the budget is measured,\n * not guessed — see {@link SX_STATE_LABELS}.\n */\nexport const SX_STATE_LABEL_MAX = 8\n\n/** The same states in running prose — banners, the override chips. */\nexport const SX_STATE_PROSE: Readonly<Record<SxState, string>> = Object.freeze({\n hover: 'hover',\n active: 'active',\n focusVisible: 'keyboard focus',\n disabled: 'disabled',\n})\n\n/**\n * What each state means, in the panel's voice — shown as the chip tooltip so\n * an author can tell `Active` (held down) from `Focus` (keyboard) without\n * knowing the selectors.\n */\nexport const SX_STATE_DESCRIPTIONS: Readonly<Record<SxState, string>> =\n Object.freeze({\n hover: 'While the pointer is over this element.',\n active: 'While this element is being pressed or clicked.',\n focusVisible:\n 'While this element has keyboard focus. Styling this state adds to the ' +\n 'focus indicator keyboard visitors rely on — it will not show on a ' +\n 'plain mouse click.',\n disabled: 'While this element is disabled. Only form controls can be disabled.',\n })\n\nconst STATE_SELECTOR_SET: ReadonlySet<string> = new Set(\n Object.values(SX_STATE_SELECTORS),\n)\n\n/** Whether an sx key is one of the state selectors this module owns. */\nexport function isSxStateSelector(key: string): boolean {\n return STATE_SELECTOR_SET.has(key)\n}\n\n/**\n * The state a stored selector belongs to, or null when the key is not one of\n * ours. Lets a surface that lists RAW sx keys — the instance-override chips —\n * name a slice the way the chip row does instead of printing `&:hover` at an\n * author who never typed it.\n */\nexport function sxStateForSelector(key: string): SxState | null {\n return (\n SX_STATES.find((state) => SX_STATE_SELECTORS[state] === key) ?? null\n )\n}\n\n/** The override-chip label for a raw sx key, or null to fall through. */\nexport function sxStateSliceLabel(key: string): string | null {\n const state = sxStateForSelector(key)\n return state ? `${SX_STATE_PROSE[state]} state` : null\n}\n\nconst isPlainObject = (value: unknown): value is Record<string, any> =>\n typeof value === 'object' && value !== null && !Array.isArray(value)\n\n/**\n * The stored slice for a state, or undefined when the element has none.\n *\n * `state: null` is the base scope and returns the record itself, so callers\n * can pass the panel's active scope through without branching.\n */\nexport function readStateSlice(\n sx: Record<string, any> | undefined,\n state: SxState | null,\n): Record<string, any> | undefined {\n if (!state) return sx\n const slice = sx?.[SX_STATE_SELECTORS[state]]\n return isPlainObject(slice) ? slice : undefined\n}\n\n/**\n * What the element actually LOOKS like in a state: the base styles with the\n * state slice merged over them, which is what the browser paints because a\n * `:hover` block only overrides the properties it names.\n *\n * This is what the panel reads from, so a field the author has not overridden\n * for hover shows the inherited base value rather than empty — the same\n * reading the breakpoint scope gives, and the reason the write seam can skip\n * a value that would not change anything.\n *\n * `mergeNodeSx` is the house merge: responsive objects cascade mobile-first,\n * `@scheme dark` and nested selector blocks merge key by key. Reusing it keeps\n * the panel's reading identical to the graft's.\n *\n * Returns the input BY IDENTITY at base scope or when no slice exists, which\n * is every element that has never been given a state style.\n */\n/**\n * The element's base styles with every state selector removed — the baseline a\n * state slice is a difference FROM. Returned by identity when the element\n * carries no state slices at all, which is every element today.\n */\nexport function stripStateSlices(\n sx: Record<string, any> | undefined,\n): Record<string, any> | undefined {\n if (!sx) return sx\n if (!Object.keys(sx).some(isSxStateSelector)) return sx\n const base: Record<string, any> = { ...sx }\n for (const selector of STATE_SELECTOR_SET) delete base[selector]\n return base\n}\n\nexport function stateScopedSx(\n sx: Record<string, any> | undefined,\n state: SxState | null,\n): Record<string, any> | undefined {\n const slice = state ? readStateSlice(sx, state) : undefined\n if (!slice) return sx\n // Every state selector is dropped from the reading: the slice being edited\n // is merged in below, and a SIBLING state's block is not part of what this\n // state looks like.\n const base = stripStateSlices(sx)\n return mergeNodeSx(base, slice) as Record<string, any>\n}\n\n/**\n * Replaces one state's slice, removing it entirely when it comes back empty.\n *\n * An emptied slice is DELETED rather than stored as `{}` — the same rule\n * `writeSxValue` applies to an emptied scheme slice and `getNodeStyleTarget`\n * applies to an emptied instance override. A `{}` left behind would make\n * \"does this element have a hover style\" answer yes forever, which the chip's\n * own dot indicator and the override badge both read.\n *\n * Returns a new record; the input is never mutated.\n */\nexport function writeStateSlice(\n sx: Record<string, any> | undefined,\n state: SxState,\n slice: Record<string, any> | undefined,\n): Record<string, any> {\n const next: Record<string, any> = { ...sx }\n const selector = SX_STATE_SELECTORS[state]\n if (slice && Object.keys(slice).length > 0) next[selector] = slice\n else delete next[selector]\n return next\n}\n\n/**\n * The slice implied by an edited state-scope reading (AGL-2486).\n *\n * The panel edits the MERGED record — base with the slice over it, which is\n * what the element actually looks like in that state — so the write has to be\n * split back out: only what genuinely differs from the base belongs in the\n * slice. That split is what gives the three behaviours the panel needs, all\n * from one rule:\n *\n * - a property the author changed for this state lands in the slice;\n * - a property the author set back to the base value LEAVES the slice, because\n * a `:hover` block that restates the base paints nothing and would show as a\n * permanent override in the chip's dot;\n * - a property the author cleared leaves the slice too, so the state falls\n * back to inheriting the base — which is the only thing a pseudo-class block\n * can express, since CSS has no way to un-declare a property.\n *\n * `base` must already have the state selectors stripped (which\n * {@link stateScopedSx} does), or a sibling state's block would read as a\n * difference and be copied in.\n */\nexport function deriveStateSlice(\n base: Record<string, any> | undefined,\n edited: Record<string, any> | undefined,\n): Record<string, any> {\n const slice: Record<string, any> = {}\n for (const [key, value] of Object.entries(edited ?? {})) {\n if (isSxStateSelector(key)) continue\n if (isEqual(base?.[key], value)) continue\n slice[key] = value\n }\n return slice\n}\n\n/** Whether the element carries any styles for this state. */\nexport function sxHasStateSlice(\n sx: Record<string, any> | undefined,\n state: SxState,\n): boolean {\n const slice = readStateSlice(sx, state)\n return !!slice && Object.keys(slice).length > 0\n}\n\n/** Every state the element currently carries a slice for, in chip order. */\nexport function sxStatesWithSlices(\n sx: Record<string, any> | undefined,\n): SxState[] {\n return SX_STATES.filter((state) => sxHasStateSlice(sx, state))\n}\n\n/**\n * Components that put a real tab stop / focusable control in the DOM. Matched\n * on the component id, which is the only thing the panel reliably knows about\n * an element before it renders.\n */\nconst INTERACTIVE_COMPONENT_PATTERN =\n /button|link|anchor|field|input|select|checkbox|radio|switch|slider|tabs?$|menuitem|textarea|toggle|rating|autocomplete/i\n\n/**\n * The advisory to show under the state chips, or null when the state makes\n * plain sense on this element (AGL-2486 item 39).\n *\n * States are deliberately NOT constrained by element type. A hover effect on a\n * Box or Section wrapping a link is among the commonest real designs, and\n * refusing it would block more good work than it prevents mistakes. But\n * `:focus-visible` on something with no tab stop and `:disabled` on something\n * that cannot be disabled will simply never fire, and an author who styles one\n * and sees nothing has no way to find out why. So: allow it, and say so.\n */\nexport function stateAdvisory(\n state: SxState | null,\n element: { componentId?: string; hasHref?: boolean; hasTabIndex?: boolean },\n): string | null {\n if (state !== 'focusVisible' && state !== 'disabled') return null\n const interactive =\n !!element.hasHref ||\n !!element.hasTabIndex ||\n INTERACTIVE_COMPONENT_PATTERN.test(element.componentId ?? '')\n if (interactive) return null\n if (state === 'disabled') {\n return (\n 'Only form controls — buttons, inputs, selects — can be disabled. On ' +\n 'this element these styles are valid but will never show. You can still ' +\n 'set them if a plugin or custom code disables it.'\n )\n }\n return (\n 'This element cannot receive keyboard focus today, so these styles will ' +\n 'never show. They will start working if you make it a link or a button, ' +\n 'or give it a tab stop.'\n )\n}\n\n/**\n * CANVAS ONLY: renders an element as if it were in the given state, by\n * hoisting that state's slice over the base declarations (AGL-2486 item 39).\n *\n * You cannot hover an element while working in a side panel, so a state whose\n * styles you cannot see is a state you cannot design. This is what holds the\n * state on — and it is deliberately NOT a toggle that can be left on and\n * published by mistake: selecting the state in the panel's chip row IS the\n * hold, so you cannot be editing the hover slice and not see hover, and\n * returning to `Default` ends it. It lives in editor UI state and never enters\n * the document, so Preview and the published page cannot receive it.\n *\n * Applied through `LeafSxTransformContext` — the SAME canvas-only seam the\n * artboard device-width transform already uses, at the one point in `Leaf`\n * where the merged sx reaches the element. There is still exactly one\n * substitution path, and the tenant never mounts the provider.\n *\n * Runs on the fully merged sx AFTER scheme resolution, so a slice that carried\n * `@scheme dark` has already collapsed to the active scheme's values by the\n * time it is hoisted. `mergeSchemeValue` does the per-value merge so a\n * responsive override keeps the base's other breakpoints.\n *\n * The hoisted selector is removed, so what renders is exactly the state's\n * appearance rather than the state's appearance plus a live `:hover` that\n * would repaint the same declarations. Sibling states are left untouched.\n *\n * Returns the input BY IDENTITY when there is nothing to hoist.\n */\nexport function hoistStateSx<T>(sx: T, state: SxState | null): T {\n if (!state) return sx\n const selector = SX_STATE_SELECTORS[state]\n if (Array.isArray(sx)) {\n let changed = false\n const next = sx.map((entry) => {\n const value = hoistStateSx(entry, state)\n if (value !== entry) changed = true\n return value\n })\n return (changed ? next : sx) as unknown as T\n }\n if (!isPlainObject(sx)) return sx\n const slice = (sx as Record<string, any>)[selector]\n if (!isPlainObject(slice)) return sx\n const out: Record<string, any> = { ...(sx as Record<string, any>) }\n delete out[selector]\n for (const [key, value] of Object.entries(slice)) {\n const merged = mergeSchemeValue(out[key], value)\n if (merged === undefined) delete out[key]\n else out[key] = merged\n }\n return out as unknown as T\n}\n\nexport default SX_STATES\n"],"names":["mergeNodeSx","mergeSchemeValue","isEqual","SX_STATES","Object","freeze","SX_STATE_SELECTORS","hover","active","focusVisible","disabled","SX_STATE_LABELS","SX_STATE_LABEL_MAX","SX_STATE_PROSE","SX_STATE_DESCRIPTIONS","STATE_SELECTOR_SET","Set","values","isSxStateSelector","key","has","sxStateForSelector","find","state","sxStateSliceLabel","isPlainObject","value","Array","isArray","readStateSlice","sx","slice","undefined","stripStateSlices","keys","some","base","selector","stateScopedSx","writeStateSlice","next","length","deriveStateSlice","edited","entries","sxHasStateSlice","sxStatesWithSlices","filter","INTERACTIVE_COMPONENT_PATTERN","stateAdvisory","element","interactive","hasHref","hasTabIndex","test","componentId","hoistStateSx","changed","map","entry","out","merged"],"mappings":"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"}
|
|
@@ -0,0 +1,136 @@
|
|
|
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 SxScheme } from '@aglyn/aglyn-node-renderer';
|
|
18
|
+
import { type SxBreakpoint } from './responsive-sx';
|
|
19
|
+
import type { StyleThemeScales } from './theme-scale-options';
|
|
20
|
+
/**
|
|
21
|
+
* First-class style controls beyond the base panel (AGL-540): layout,
|
|
22
|
+
* colors, sizing, typography, borders & shadows, position & overflow, and
|
|
23
|
+
* grid/flex-child fields, rendered as accordion groups in the styles
|
|
24
|
+
* panel. Everything still writes through the responsive-sx pipeline, so
|
|
25
|
+
* breakpoint scoping (AGL-333) applies to every field here.
|
|
26
|
+
*
|
|
27
|
+
* Consolidation (AGL-587): every style field has exactly one home. The
|
|
28
|
+
* loose base form is gone — display/float live in Layout, color/
|
|
29
|
+
* backgroundColor in Colors.
|
|
30
|
+
*
|
|
31
|
+
* The layout half was consolidated again in AGL-2486: `Flexbox & Grids`
|
|
32
|
+
* and `Grid & Flex Child` were two sections describing the same two CSS
|
|
33
|
+
* layout models, and every typed field of both now lives in one group
|
|
34
|
+
* ({@link buildFlexGridGroup}) under the panel's alignment toggles.
|
|
35
|
+
*/
|
|
36
|
+
export interface StyleFieldGroup {
|
|
37
|
+
$id: string;
|
|
38
|
+
label: string;
|
|
39
|
+
fields: Array<Record<string, unknown> & {
|
|
40
|
+
name: string;
|
|
41
|
+
}>;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Longest description a HALF-width field may carry: two lines at the ~170px
|
|
45
|
+
* a half column gets in the docked panel. Measured against the panel's own
|
|
46
|
+
* 0.75rem caption type, not guessed.
|
|
47
|
+
*/
|
|
48
|
+
export declare const HALF_WIDTH_DESCRIPTION_LIMIT = 52;
|
|
49
|
+
/** Panel context a few fields word themselves against (AGL-1338). */
|
|
50
|
+
export interface StyleFieldGroupOptions {
|
|
51
|
+
/**
|
|
52
|
+
* The panel is editing a component INSTANCE's override slice rather
|
|
53
|
+
* than a node's own sx (AGL-1332). Only the Background Fill control
|
|
54
|
+
* cares so far, and it cares a lot: an unset field there means "the
|
|
55
|
+
* component's own fill keeps painting", not "nothing paints", so the
|
|
56
|
+
* unset choice has to be named for what it does.
|
|
57
|
+
*/
|
|
58
|
+
isInstanceOverride?: boolean;
|
|
59
|
+
/**
|
|
60
|
+
* The site theme's own scales for the three fields that had no connection
|
|
61
|
+
* to it (AGL-2486, item 12): font size, font weight and z-index. Built
|
|
62
|
+
* from the live theme by {@link buildStyleThemeScales}, so a host that
|
|
63
|
+
* retuned its type scale offers its own values. Absent (a spec, a theme
|
|
64
|
+
* still loading) simply means no scale is offered — every one of these
|
|
65
|
+
* fields still takes a raw value.
|
|
66
|
+
*/
|
|
67
|
+
themeScales?: StyleThemeScales;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Builds the style accordion groups. `presetColors` feeds the color
|
|
71
|
+
* pickers with the site theme's palette, mirroring the base styles form.
|
|
72
|
+
*/
|
|
73
|
+
export declare function buildStyleFieldGroups(presetColors: string[], options?: StyleFieldGroupOptions): StyleFieldGroup[];
|
|
74
|
+
/**
|
|
75
|
+
* The typed fields of the single Flexbox & Grid section (AGL-2486).
|
|
76
|
+
*
|
|
77
|
+
* The panel used to answer "how do I lay this out?" in two places. A
|
|
78
|
+
* `Flexbox & Grids` accordion held the alignment toggles and the gaps; a
|
|
79
|
+
* separate `Grid & Flex Child` accordion, four sections further down, held
|
|
80
|
+
* the track lists, the item placement and the flex-child sizing. Both were
|
|
81
|
+
* about the same two CSS layout models, neither was complete, and their
|
|
82
|
+
* names did not divide the properties the way the names suggested:
|
|
83
|
+
* `alignSelf` and `justifySelf` are per-ITEM properties and lived in the
|
|
84
|
+
* container section, while `gridTemplateColumns` is a CONTAINER property
|
|
85
|
+
* and lived in the child one.
|
|
86
|
+
*
|
|
87
|
+
* So they are one section now, in reading order: how the container spaces
|
|
88
|
+
* its children (the gaps), what tracks it defines (the grid template), and
|
|
89
|
+
* where this element sits inside its own parent (placement and flex
|
|
90
|
+
* sizing). The alignment toggles render above these, from the panel — they
|
|
91
|
+
* are icon-button groups rather than schema fields and they read far better
|
|
92
|
+
* than the free-text equivalents would.
|
|
93
|
+
*
|
|
94
|
+
* Every property both sections carried is still here; the whole point is
|
|
95
|
+
* that nothing had to be dropped to stop saying it twice.
|
|
96
|
+
*/
|
|
97
|
+
export declare function buildFlexGridGroup(options?: StyleFieldGroupOptions): StyleFieldGroup;
|
|
98
|
+
/** Field names owned by a group — the only keys its save may touch. */
|
|
99
|
+
export declare function styleGroupFieldNames(group: StyleFieldGroup): string[];
|
|
100
|
+
/**
|
|
101
|
+
* The sx partial a group save is allowed to produce: exactly its own
|
|
102
|
+
* field names. Keys owned by other groups (or by the custom-CSS editor)
|
|
103
|
+
* never appear, so one group's auto-save can never clear another's
|
|
104
|
+
* values (AGL-540).
|
|
105
|
+
*/
|
|
106
|
+
export declare function computeStylePartial(fieldNames: readonly string[], values: Record<string, unknown> | undefined): Record<string, unknown>;
|
|
107
|
+
/** Picks a group's own values out of the effective sx value map. */
|
|
108
|
+
export declare function pickStyleValues(fieldNames: readonly string[], values: Record<string, unknown> | undefined): Record<string, unknown>;
|
|
109
|
+
/**
|
|
110
|
+
* Style fields that carry a COLOR and therefore scope to the artboard's
|
|
111
|
+
* color scheme (AGL-588): while the canvas previews DARK, edits to these
|
|
112
|
+
* fields write into the sx dark slice so light keeps its own values.
|
|
113
|
+
* Everything else (spacing, sizing, layout…) is scheme-agnostic and
|
|
114
|
+
* always writes the base, no matter which scheme is previewed.
|
|
115
|
+
*/
|
|
116
|
+
export declare const SCHEME_SCOPED_STYLE_FIELDS: readonly ["color", "backgroundColor", "borderColor", "backgroundImage"];
|
|
117
|
+
/** Whether edits to this style field scope to the previewed color scheme. */
|
|
118
|
+
export declare function isSchemeScopedStyleField(name: string): boolean;
|
|
119
|
+
/**
|
|
120
|
+
* Merges a partial of style values into an sx object at the active
|
|
121
|
+
* breakpoint + scheme scope (AGL-333 / AGL-588). Unchanged values are
|
|
122
|
+
* skipped so effective (inherited) readings never get pinned into a
|
|
123
|
+
* breakpoint or scheme slice by round-tripping through a form. Empty
|
|
124
|
+
* strings clear, and purely numeric text is stored as a NUMBER — see
|
|
125
|
+
* {@link normalizeStyleValue}.
|
|
126
|
+
*/
|
|
127
|
+
export declare function applyStylePartialToSx(sx: Record<string, any> | undefined, partial: Record<string, unknown>, breakpoint: SxBreakpoint | null, scheme: SxScheme | null): Record<string, any>;
|
|
128
|
+
/**
|
|
129
|
+
* Effective scalar style values at the active breakpoint + scheme scope
|
|
130
|
+
* — feeds the styles panel's forms and controls. Color-bearing fields
|
|
131
|
+
* resolve through the dark slice while the artboard previews dark
|
|
132
|
+
* (falling back to base where no override exists — exactly what
|
|
133
|
+
* renders); everything else reads the base. Responsive objects resolve
|
|
134
|
+
* to their active slice; nested objects are skipped.
|
|
135
|
+
*/
|
|
136
|
+
export declare function computeEffectiveStyleValues(sx: Record<string, any> | undefined, breakpoint: SxBreakpoint | null, scheme: SxScheme | null): Record<string, any>;
|