@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,298 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2026 Aglyn LLC
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/ import { _ as _extends } from "@swc/helpers/_/_extends";
|
|
17
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
18
|
+
import { canvas, components, listInstanceStyleTargets, REUSABLE_INSTANCE_COMPONENT_ID, STYLE_OVERRIDES_ROOT_KEY } from "@aglyn/aglyn";
|
|
19
|
+
import { FormRenderer, FormSpy, useFormApi } from "@aglyn/shared-ui-jsx-forms";
|
|
20
|
+
import { HelpTip } from "@aglyn/shared-ui-jsx";
|
|
21
|
+
import { Box, Chip, Grid, MenuItem, TextField, Tooltip, Typography } from "@mui/material";
|
|
22
|
+
import { observer } from "mobx-react-lite";
|
|
23
|
+
import { toJS } from "mobx";
|
|
24
|
+
import { memo, useCallback, useContext, useEffect, useMemo, useRef, useState } from "react";
|
|
25
|
+
import { ComponentPromotionContext } from "../contexts/component-promotion-context.js";
|
|
26
|
+
import { useDebouncedCommit } from "../hooks/use-debounced-commit.js";
|
|
27
|
+
import { besignerDocsUrl } from "../utils/docs-help.js";
|
|
28
|
+
import { getNodeAttrTarget, listInstanceAttrFields } from "../utils/attr-target.js";
|
|
29
|
+
/**
|
|
30
|
+
* Schedules a commit when the form's values change and it is dirty — the same
|
|
31
|
+
* shape as the Attributes form's `AutoSaveOnChange`, and for the same reason:
|
|
32
|
+
* MUI Select renders through a Portal, so its change never reaches the
|
|
33
|
+
* `<form>` as a DOM event.
|
|
34
|
+
*
|
|
35
|
+
* The first render is skipped. Seeding the form is not an edit, and
|
|
36
|
+
* committing on mount would write an override slice for every instance whose
|
|
37
|
+
* panel was merely OPENED.
|
|
38
|
+
*/ const AttrOverrideAutoSave = /*#__PURE__*/ memo(function AttrOverrideAutoSave({ values, pristine, valid, onSchedule }) {
|
|
39
|
+
const isFirstRender = useRef(true);
|
|
40
|
+
useEffect(()=>{
|
|
41
|
+
if (isFirstRender.current) {
|
|
42
|
+
isFirstRender.current = false;
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
if (!pristine && valid) onSchedule();
|
|
46
|
+
}, [
|
|
47
|
+
values
|
|
48
|
+
]); // eslint-disable-line react-hooks/exhaustive-deps
|
|
49
|
+
return null;
|
|
50
|
+
});
|
|
51
|
+
/**
|
|
52
|
+
* The override form's shell (AGL-1899).
|
|
53
|
+
*
|
|
54
|
+
* Autosaving on a debounce, exactly like the Attributes form's own template
|
|
55
|
+
* (AGL-567) — an override is an attribute edit and should not need a second
|
|
56
|
+
* kind of Save button — but with NO submit button of its own: this form is
|
|
57
|
+
* nested inside the Attributes panel, and a second `type="submit"` control
|
|
58
|
+
* beside "Save Element" is two buttons that look like they do the same thing
|
|
59
|
+
* and do not.
|
|
60
|
+
*
|
|
61
|
+
* `onBlur` flushes, so switching selection or clicking away cannot strand an
|
|
62
|
+
* edit inside the debounce window.
|
|
63
|
+
*/ const InstanceAttrFormTemplate = ({ formFields, schema })=>{
|
|
64
|
+
const { handleSubmit } = useFormApi();
|
|
65
|
+
const { schedule, flush } = useDebouncedCommit(handleSubmit);
|
|
66
|
+
return /*#__PURE__*/ _jsxs(Box, {
|
|
67
|
+
onBlur: flush,
|
|
68
|
+
children: [
|
|
69
|
+
schema == null ? void 0 : schema.title,
|
|
70
|
+
/*#__PURE__*/ _jsx(Grid, {
|
|
71
|
+
spacing: 2,
|
|
72
|
+
container: true,
|
|
73
|
+
children: formFields
|
|
74
|
+
}),
|
|
75
|
+
/*#__PURE__*/ _jsx(FormSpy, {
|
|
76
|
+
subscription: {
|
|
77
|
+
values: true,
|
|
78
|
+
pristine: true,
|
|
79
|
+
valid: true
|
|
80
|
+
},
|
|
81
|
+
children: ({ values, pristine, valid })=>/*#__PURE__*/ _jsx(AttrOverrideAutoSave, {
|
|
82
|
+
values: values,
|
|
83
|
+
pristine: pristine,
|
|
84
|
+
valid: valid,
|
|
85
|
+
onSchedule: schedule
|
|
86
|
+
})
|
|
87
|
+
})
|
|
88
|
+
]
|
|
89
|
+
});
|
|
90
|
+
};
|
|
91
|
+
/**
|
|
92
|
+
* Per-instance ATTRIBUTE overrides for a reusable-component instance
|
|
93
|
+
* (AGL-1899) — the attribute-side twin of the Styles panel's override
|
|
94
|
+
* section (AGL-1332).
|
|
95
|
+
*
|
|
96
|
+
* An instance renders the component's CURRENT nodes; this section layers one
|
|
97
|
+
* placement's own prop values over one node inside it, so a single page's CTA
|
|
98
|
+
* can be `outlined` while every other placement stays `contained` — without
|
|
99
|
+
* the component declaring a prop for it, without detaching, and without
|
|
100
|
+
* pinning the instance to a component version. The graft merges the slice per
|
|
101
|
+
* named prop, so a prop the component ADDS later still reaches this instance
|
|
102
|
+
* with the component's new default.
|
|
103
|
+
*
|
|
104
|
+
* Content is deliberately not editable here: a component's text rides its
|
|
105
|
+
* declared `{{prop.*}}` props and the canvas's double-click editor (AGL-1304),
|
|
106
|
+
* and `children`/`html` are refused by the writer so this panel never becomes
|
|
107
|
+
* a second control writing the same rendered string.
|
|
108
|
+
*/ export const InstanceAttrOverrides = observer(function InstanceAttrOverrides({ node: selectedNode, componentMapper }) {
|
|
109
|
+
var _canvas_getNode, _target_attrs, _ref, _ref1;
|
|
110
|
+
var _definition_nodes;
|
|
111
|
+
// The node as the CANVAS currently holds it (AGL-2486 / `f68aadabe`).
|
|
112
|
+
//
|
|
113
|
+
// Undo, a co-edit apply and a draft restore all REPLACE the node map with
|
|
114
|
+
// fresh instances. A panel holding the node OBJECT would go on writing to a
|
|
115
|
+
// detached copy — the write lands on an orphan, nothing throws, and the
|
|
116
|
+
// header still says UP TO DATE. Resolving by `$id` at the point of use is
|
|
117
|
+
// the only form that cannot strand itself, and reading it inside an
|
|
118
|
+
// `observer` is also what re-renders this section after an undo.
|
|
119
|
+
const node = (selectedNode == null ? void 0 : selectedNode.$id) ? (_canvas_getNode = canvas.getNode(selectedNode.$id)) != null ? _canvas_getNode : selectedNode : selectedNode;
|
|
120
|
+
const { definitions } = useContext(ComponentPromotionContext);
|
|
121
|
+
const isInstance = (node == null ? void 0 : node.componentId) === REUSABLE_INSTANCE_COMPONENT_ID;
|
|
122
|
+
const definition = useMemo(()=>{
|
|
123
|
+
var _node_props;
|
|
124
|
+
if (!isInstance) return undefined;
|
|
125
|
+
const refId = node == null ? void 0 : (_node_props = node.props) == null ? void 0 : _node_props.refId;
|
|
126
|
+
return refId ? definitions == null ? void 0 : definitions[refId] : undefined;
|
|
127
|
+
}, [
|
|
128
|
+
isInstance,
|
|
129
|
+
node,
|
|
130
|
+
definitions
|
|
131
|
+
]);
|
|
132
|
+
// The SAME target list the Styles panel offers, from the same walker, so
|
|
133
|
+
// the two panels name the same parts of a component in the same order and
|
|
134
|
+
// an override written by one is addressed identically by the other.
|
|
135
|
+
const targets = useMemo(()=>listInstanceStyleTargets(definition), [
|
|
136
|
+
definition
|
|
137
|
+
]);
|
|
138
|
+
// Which target is being edited, held per selection rather than in an
|
|
139
|
+
// effect: switching nodes must land on the component root, and deriving it
|
|
140
|
+
// from the current `node.$id` cannot render one frame aimed at the
|
|
141
|
+
// PREVIOUS instance's leaf.
|
|
142
|
+
const [picked, setPicked] = useState({
|
|
143
|
+
key: STYLE_OVERRIDES_ROOT_KEY
|
|
144
|
+
});
|
|
145
|
+
const pickedKey = picked.nodeId && picked.nodeId === (node == null ? void 0 : node.$id) ? picked.key : STYLE_OVERRIDES_ROOT_KEY;
|
|
146
|
+
// A leaf the component no longer has falls back to the root rather than
|
|
147
|
+
// aiming the panel at a slice nothing renders. An unloaded definition
|
|
148
|
+
// offers nothing yet, so it is not evidence the key is stale.
|
|
149
|
+
const overrideKey = !targets.length || targets.some((entry)=>entry.key === pickedKey) ? pickedKey : STYLE_OVERRIDES_ROOT_KEY;
|
|
150
|
+
const target = useMemo(()=>getNodeAttrTarget(node, overrideKey), [
|
|
151
|
+
node,
|
|
152
|
+
overrideKey
|
|
153
|
+
]);
|
|
154
|
+
const pickedTarget = targets.find((entry)=>entry.key === overrideKey);
|
|
155
|
+
const defNode = pickedTarget ? definition == null ? void 0 : (_definition_nodes = definition.nodes) == null ? void 0 : _definition_nodes[pickedTarget.componentInternalId] : undefined;
|
|
156
|
+
const attrFields = useMemo(()=>listInstanceAttrFields(defNode), [
|
|
157
|
+
defNode
|
|
158
|
+
]);
|
|
159
|
+
// Read during render (observer): tracks the live slice, so the chips update
|
|
160
|
+
// as edits land and as they are cleared.
|
|
161
|
+
const overriddenProps = Object.keys((_target_attrs = target.attrs) != null ? _target_attrs : {});
|
|
162
|
+
const overriddenKeys = new Set(Object.keys((_ref = node == null ? void 0 : node.attrOverrides) != null ? _ref : {}));
|
|
163
|
+
const targetLabel = useCallback((entry)=>entry.isRoot ? 'Component root' : entry.name || entry.componentId && components.getLabel(entry.componentId) || entry.componentInternalId, []);
|
|
164
|
+
const handleTargetChange = useCallback((event)=>{
|
|
165
|
+
setPicked({
|
|
166
|
+
nodeId: node == null ? void 0 : node.$id,
|
|
167
|
+
key: event.target.value
|
|
168
|
+
});
|
|
169
|
+
}, [
|
|
170
|
+
node == null ? void 0 : node.$id
|
|
171
|
+
]);
|
|
172
|
+
const handleSave = useCallback((values)=>{
|
|
173
|
+
// One undoable step. `setAttrs` drops every non-override value by key,
|
|
174
|
+
// so a form that hands back a field per declared attribute — most of
|
|
175
|
+
// them empty — stores only what this instance actually chose.
|
|
176
|
+
canvas.transact(()=>target.setAttrs(values));
|
|
177
|
+
}, [
|
|
178
|
+
target
|
|
179
|
+
]);
|
|
180
|
+
const handleClear = useCallback((prop)=>()=>{
|
|
181
|
+
// Undoable and uncoalesced: clearing a chip DISCARDS an override, which
|
|
182
|
+
// is the one edit here that most needs a way back.
|
|
183
|
+
canvas.transact(()=>target.clearAttr(prop));
|
|
184
|
+
}, [
|
|
185
|
+
target
|
|
186
|
+
]);
|
|
187
|
+
// Re-seeds the form when the selection or the target changes. NOT keyed on
|
|
188
|
+
// the slice's contents: the form owns the typed value while the author is
|
|
189
|
+
// in it, and re-seeding on every commit would fight the field for the
|
|
190
|
+
// cursor — the shape behind an update loop, not merely a nuisance.
|
|
191
|
+
const seedKey = `${(_ref1 = node == null ? void 0 : node.$id) != null ? _ref1 : ''}:${overrideKey}`;
|
|
192
|
+
const initialValues = useMemo(()=>{
|
|
193
|
+
var _toJS;
|
|
194
|
+
return (_toJS = toJS(target.attrs)) != null ? _toJS : {};
|
|
195
|
+
}, // eslint-disable-next-line react-hooks/exhaustive-deps
|
|
196
|
+
[
|
|
197
|
+
seedKey
|
|
198
|
+
]);
|
|
199
|
+
if (!isInstance || !targets.length) return null;
|
|
200
|
+
return /*#__PURE__*/ _jsxs(Box, {
|
|
201
|
+
sx: {
|
|
202
|
+
mt: 2
|
|
203
|
+
},
|
|
204
|
+
children: [
|
|
205
|
+
/*#__PURE__*/ _jsxs(Typography, {
|
|
206
|
+
variant: "overline",
|
|
207
|
+
color: "text.secondary",
|
|
208
|
+
component: "div",
|
|
209
|
+
sx: {
|
|
210
|
+
display: 'flex',
|
|
211
|
+
alignItems: 'center'
|
|
212
|
+
},
|
|
213
|
+
children: [
|
|
214
|
+
'Attribute overrides',
|
|
215
|
+
/*#__PURE__*/ _jsx(HelpTip, {
|
|
216
|
+
title: "Attribute overrides",
|
|
217
|
+
excerpt: "Give one placement of a component its own attribute values — a different button variant, size or link — without changing the component or detaching. Empty means the component's own value.",
|
|
218
|
+
href: besignerDocsUrl('reusableComponents', '#override-an-attribute-on-one-instance'),
|
|
219
|
+
sx: {
|
|
220
|
+
ml: 0.25,
|
|
221
|
+
fontSize: '0.9em'
|
|
222
|
+
}
|
|
223
|
+
})
|
|
224
|
+
]
|
|
225
|
+
}),
|
|
226
|
+
targets.length > 1 ? /*#__PURE__*/ _jsx(TextField, {
|
|
227
|
+
select: true,
|
|
228
|
+
fullWidth: true,
|
|
229
|
+
size: "small",
|
|
230
|
+
margin: "dense",
|
|
231
|
+
label: "Override target",
|
|
232
|
+
value: overrideKey,
|
|
233
|
+
onChange: handleTargetChange,
|
|
234
|
+
helperText: target.isLeafOverride ? 'Setting attributes on one element inside the component, on ' + 'this instance only.' : "Setting attributes on the component's outer element, on " + 'this instance only. Pick an element inside it to override ' + 'that part.',
|
|
235
|
+
children: targets.map((entry)=>/*#__PURE__*/ _jsxs(MenuItem, {
|
|
236
|
+
value: entry.key,
|
|
237
|
+
// Nesting reads as nesting: the definition's tree is the only
|
|
238
|
+
// map an author has of what is inside a component.
|
|
239
|
+
sx: {
|
|
240
|
+
pl: 2 + entry.depth * 1.5
|
|
241
|
+
},
|
|
242
|
+
children: [
|
|
243
|
+
targetLabel(entry),
|
|
244
|
+
overriddenKeys.has(entry.key) ? ' •' : ''
|
|
245
|
+
]
|
|
246
|
+
}, entry.key))
|
|
247
|
+
}) : null,
|
|
248
|
+
/*#__PURE__*/ _jsxs(Box, {
|
|
249
|
+
sx: {
|
|
250
|
+
mt: 0.5,
|
|
251
|
+
mb: 1
|
|
252
|
+
},
|
|
253
|
+
children: [
|
|
254
|
+
/*#__PURE__*/ _jsx(Tooltip, {
|
|
255
|
+
title: 'Attributes set here apply to this instance only, layered over ' + "the component's own values. Other placements keep the " + 'component, and component updates still flow through. Leave a ' + "field empty to use the component's value.",
|
|
256
|
+
children: /*#__PURE__*/ _jsx(Chip, {
|
|
257
|
+
size: "small",
|
|
258
|
+
color: overriddenProps.length ? 'secondary' : 'default',
|
|
259
|
+
label: overriddenProps.length ? `Overridden here: ${overriddenProps.length}` : "Using the component's attributes"
|
|
260
|
+
})
|
|
261
|
+
}),
|
|
262
|
+
overriddenProps.map((prop)=>/*#__PURE__*/ _jsx(Tooltip, {
|
|
263
|
+
title: "Clear this override — the instance returns to the component's " + 'own value',
|
|
264
|
+
children: /*#__PURE__*/ _jsx(Chip, {
|
|
265
|
+
size: "small",
|
|
266
|
+
variant: "outlined",
|
|
267
|
+
sx: {
|
|
268
|
+
ml: 1,
|
|
269
|
+
mt: 0.5
|
|
270
|
+
},
|
|
271
|
+
label: prop,
|
|
272
|
+
onDelete: handleClear(prop)
|
|
273
|
+
})
|
|
274
|
+
}, prop))
|
|
275
|
+
]
|
|
276
|
+
}),
|
|
277
|
+
attrFields.length ? /*#__PURE__*/ _jsx(FormRenderer, {
|
|
278
|
+
componentMapper: componentMapper,
|
|
279
|
+
onSubmit: handleSave,
|
|
280
|
+
initialValues: initialValues,
|
|
281
|
+
schema: {
|
|
282
|
+
fields: attrFields.map((entry)=>entry.field)
|
|
283
|
+
},
|
|
284
|
+
children: (templateProps)=>/*#__PURE__*/ _jsx(InstanceAttrFormTemplate, _extends({}, templateProps))
|
|
285
|
+
}, seedKey) : // Said out loud rather than rendering an empty box: a component made
|
|
286
|
+
// of layout elements genuinely has nothing to override here, and an
|
|
287
|
+
// author should not be left wondering whether the panel failed.
|
|
288
|
+
/*#__PURE__*/ _jsx(Typography, {
|
|
289
|
+
variant: "caption",
|
|
290
|
+
color: "text.secondary",
|
|
291
|
+
children: 'This part of the component has no attributes that can be ' + 'overridden per instance.'
|
|
292
|
+
})
|
|
293
|
+
]
|
|
294
|
+
});
|
|
295
|
+
});
|
|
296
|
+
export default InstanceAttrOverrides;
|
|
297
|
+
|
|
298
|
+
//# sourceMappingURL=instance-attr-overrides.component.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../../../../libs/besigner/feature/designer/src/lib/components/instance-attr-overrides.component.tsx"],"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 type * as Aglyn from '@aglyn/aglyn'\nimport {\n canvas,\n components,\n listInstanceStyleTargets,\n REUSABLE_INSTANCE_COMPONENT_ID,\n STYLE_OVERRIDES_ROOT_KEY,\n} from '@aglyn/aglyn'\nimport {\n FormRenderer,\n type FormRendererProps,\n type FormTemplateRenderProps,\n FormSpy,\n useFormApi,\n} from '@aglyn/shared-ui-jsx-forms'\nimport { HelpTip } from '@aglyn/shared-ui-jsx'\nimport {\n Box,\n Chip,\n Grid,\n MenuItem,\n TextField,\n Tooltip,\n Typography,\n} from '@mui/material'\nimport { observer } from 'mobx-react-lite'\nimport { toJS } from 'mobx'\nimport {\n type ChangeEvent,\n memo,\n useCallback,\n useContext,\n useEffect,\n useMemo,\n useRef,\n useState,\n} from 'react'\nimport { ComponentPromotionContext } from '../contexts/component-promotion-context'\nimport { useDebouncedCommit } from '../hooks/use-debounced-commit'\nimport { besignerDocsUrl } from '../utils/docs-help'\nimport {\n getNodeAttrTarget,\n listInstanceAttrFields,\n} from '../utils/attr-target'\n\n/**\n * Schedules a commit when the form's values change and it is dirty — the same\n * shape as the Attributes form's `AutoSaveOnChange`, and for the same reason:\n * MUI Select renders through a Portal, so its change never reaches the\n * `<form>` as a DOM event.\n *\n * The first render is skipped. Seeding the form is not an edit, and\n * committing on mount would write an override slice for every instance whose\n * panel was merely OPENED.\n */\nconst AttrOverrideAutoSave = memo(function AttrOverrideAutoSave({\n values,\n pristine,\n valid,\n onSchedule,\n}: {\n values: unknown\n pristine: boolean\n valid: boolean\n onSchedule: () => void\n}) {\n const isFirstRender = useRef(true)\n useEffect(() => {\n if (isFirstRender.current) {\n isFirstRender.current = false\n return\n }\n if (!pristine && valid) onSchedule()\n }, [values]) // eslint-disable-line react-hooks/exhaustive-deps\n return null\n})\n\n/**\n * The override form's shell (AGL-1899).\n *\n * Autosaving on a debounce, exactly like the Attributes form's own template\n * (AGL-567) — an override is an attribute edit and should not need a second\n * kind of Save button — but with NO submit button of its own: this form is\n * nested inside the Attributes panel, and a second `type=\"submit\"` control\n * beside \"Save Element\" is two buttons that look like they do the same thing\n * and do not.\n *\n * `onBlur` flushes, so switching selection or clicking away cannot strand an\n * edit inside the debounce window.\n */\nconst InstanceAttrFormTemplate = ({\n formFields,\n schema,\n}: FormTemplateRenderProps) => {\n const { handleSubmit } = useFormApi()\n const { schedule, flush } = useDebouncedCommit(handleSubmit)\n return (\n <Box onBlur={flush}>\n {schema?.title}\n <Grid spacing={2} container>\n {formFields as unknown as JSX.Node}\n </Grid>\n <FormSpy subscription={{ values: true, pristine: true, valid: true }}>\n {({ values, pristine, valid }) => (\n <AttrOverrideAutoSave\n values={values}\n pristine={pristine}\n valid={valid}\n onSchedule={schedule}\n />\n )}\n </FormSpy>\n </Box>\n )\n}\n\nexport interface InstanceAttrOverridesProps {\n /** The selected node, as the panel holds it. */\n node?: Aglyn.NodeSchema<any>\n /**\n * Passed in rather than imported, so this file does not import the\n * Attributes form that renders it (a cycle) — and so a caller can narrow\n * the editors on offer without this component knowing about any of them.\n */\n componentMapper: FormRendererProps['componentMapper']\n}\n\n/**\n * Per-instance ATTRIBUTE overrides for a reusable-component instance\n * (AGL-1899) — the attribute-side twin of the Styles panel's override\n * section (AGL-1332).\n *\n * An instance renders the component's CURRENT nodes; this section layers one\n * placement's own prop values over one node inside it, so a single page's CTA\n * can be `outlined` while every other placement stays `contained` — without\n * the component declaring a prop for it, without detaching, and without\n * pinning the instance to a component version. The graft merges the slice per\n * named prop, so a prop the component ADDS later still reaches this instance\n * with the component's new default.\n *\n * Content is deliberately not editable here: a component's text rides its\n * declared `{{prop.*}}` props and the canvas's double-click editor (AGL-1304),\n * and `children`/`html` are refused by the writer so this panel never becomes\n * a second control writing the same rendered string.\n */\nexport const InstanceAttrOverrides = observer(function InstanceAttrOverrides({\n node: selectedNode,\n componentMapper,\n}: InstanceAttrOverridesProps) {\n // The node as the CANVAS currently holds it (AGL-2486 / `f68aadabe`).\n //\n // Undo, a co-edit apply and a draft restore all REPLACE the node map with\n // fresh instances. A panel holding the node OBJECT would go on writing to a\n // detached copy — the write lands on an orphan, nothing throws, and the\n // header still says UP TO DATE. Resolving by `$id` at the point of use is\n // the only form that cannot strand itself, and reading it inside an\n // `observer` is also what re-renders this section after an undo.\n const node = (selectedNode?.$id\n ? (canvas.getNode(selectedNode.$id) ?? selectedNode)\n : selectedNode) as Aglyn.NodeSchema<any> | undefined\n\n const { definitions } = useContext(ComponentPromotionContext)\n const isInstance = node?.componentId === REUSABLE_INSTANCE_COMPONENT_ID\n const definition = useMemo(() => {\n if (!isInstance) return undefined\n const refId = (node?.props as { refId?: string } | undefined)?.refId\n return refId ? definitions?.[refId] : undefined\n }, [isInstance, node, definitions])\n\n // The SAME target list the Styles panel offers, from the same walker, so\n // the two panels name the same parts of a component in the same order and\n // an override written by one is addressed identically by the other.\n const targets = useMemo(\n () => listInstanceStyleTargets(definition),\n [definition],\n )\n\n // Which target is being edited, held per selection rather than in an\n // effect: switching nodes must land on the component root, and deriving it\n // from the current `node.$id` cannot render one frame aimed at the\n // PREVIOUS instance's leaf.\n const [picked, setPicked] = useState<{ nodeId?: string; key: string }>({\n key: STYLE_OVERRIDES_ROOT_KEY,\n })\n const pickedKey =\n picked.nodeId && picked.nodeId === node?.$id\n ? picked.key\n : STYLE_OVERRIDES_ROOT_KEY\n // A leaf the component no longer has falls back to the root rather than\n // aiming the panel at a slice nothing renders. An unloaded definition\n // offers nothing yet, so it is not evidence the key is stale.\n const overrideKey =\n !targets.length || targets.some((entry) => entry.key === pickedKey)\n ? pickedKey\n : STYLE_OVERRIDES_ROOT_KEY\n\n const target = useMemo(\n () => getNodeAttrTarget(node, overrideKey),\n [node, overrideKey],\n )\n\n const pickedTarget = targets.find((entry) => entry.key === overrideKey)\n const defNode = pickedTarget\n ? (definition?.nodes as Record<string, any> | undefined)?.[\n pickedTarget.componentInternalId\n ]\n : undefined\n const attrFields = useMemo(() => listInstanceAttrFields(defNode), [defNode])\n\n // Read during render (observer): tracks the live slice, so the chips update\n // as edits land and as they are cleared.\n const overriddenProps = Object.keys(target.attrs ?? {})\n const overriddenKeys = new Set(\n Object.keys((node?.attrOverrides as Record<string, any> | undefined) ?? {}),\n )\n\n const targetLabel = useCallback(\n (entry: Aglyn.InstanceStyleTarget) =>\n entry.isRoot\n ? 'Component root'\n : entry.name ||\n (entry.componentId && components.getLabel(entry.componentId)) ||\n entry.componentInternalId,\n [],\n )\n\n const handleTargetChange = useCallback(\n (event: ChangeEvent<HTMLInputElement>) => {\n setPicked({ nodeId: node?.$id, key: event.target.value })\n },\n [node?.$id],\n )\n\n const handleSave = useCallback(\n (values: Record<string, unknown>) => {\n // One undoable step. `setAttrs` drops every non-override value by key,\n // so a form that hands back a field per declared attribute — most of\n // them empty — stores only what this instance actually chose.\n canvas.transact(() => target.setAttrs(values))\n },\n [target],\n )\n\n const handleClear = useCallback(\n (prop: string) => () => {\n // Undoable and uncoalesced: clearing a chip DISCARDS an override, which\n // is the one edit here that most needs a way back.\n canvas.transact(() => target.clearAttr(prop))\n },\n [target],\n )\n\n // Re-seeds the form when the selection or the target changes. NOT keyed on\n // the slice's contents: the form owns the typed value while the author is\n // in it, and re-seeding on every commit would fight the field for the\n // cursor — the shape behind an update loop, not merely a nuisance.\n const seedKey = `${node?.$id ?? ''}:${overrideKey}`\n const initialValues = useMemo(\n () => (toJS(target.attrs) ?? {}) as Record<string, unknown>,\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [seedKey],\n )\n\n if (!isInstance || !targets.length) return null\n\n return (\n <Box sx={{ mt: 2 }}>\n <Typography\n variant=\"overline\"\n color=\"text.secondary\"\n component=\"div\"\n sx={{ display: 'flex', alignItems: 'center' }}\n >\n {'Attribute overrides'}\n <HelpTip\n title=\"Attribute overrides\"\n excerpt=\"Give one placement of a component its own attribute values — a different button variant, size or link — without changing the component or detaching. Empty means the component's own value.\"\n href={besignerDocsUrl(\n 'reusableComponents',\n '#override-an-attribute-on-one-instance',\n )}\n sx={{ ml: 0.25, fontSize: '0.9em' }}\n />\n </Typography>\n {targets.length > 1 ? (\n <TextField\n select\n fullWidth\n size=\"small\"\n margin=\"dense\"\n label=\"Override target\"\n value={overrideKey}\n onChange={handleTargetChange}\n helperText={\n target.isLeafOverride\n ? 'Setting attributes on one element inside the component, on ' +\n 'this instance only.'\n : \"Setting attributes on the component's outer element, on \" +\n 'this instance only. Pick an element inside it to override ' +\n 'that part.'\n }\n >\n {targets.map((entry) => (\n <MenuItem\n key={entry.key}\n value={entry.key}\n // Nesting reads as nesting: the definition's tree is the only\n // map an author has of what is inside a component.\n sx={{ pl: 2 + entry.depth * 1.5 }}\n >\n {targetLabel(entry)}\n {overriddenKeys.has(entry.key) ? ' •' : ''}\n </MenuItem>\n ))}\n </TextField>\n ) : null}\n <Box sx={{ mt: 0.5, mb: 1 }}>\n <Tooltip\n title={\n 'Attributes set here apply to this instance only, layered over ' +\n \"the component's own values. Other placements keep the \" +\n 'component, and component updates still flow through. Leave a ' +\n \"field empty to use the component's value.\"\n }\n >\n <Chip\n size=\"small\"\n color={overriddenProps.length ? 'secondary' : 'default'}\n label={\n overriddenProps.length\n ? `Overridden here: ${overriddenProps.length}`\n : \"Using the component's attributes\"\n }\n />\n </Tooltip>\n {overriddenProps.map((prop) => (\n <Tooltip\n key={prop}\n title={\n \"Clear this override — the instance returns to the component's \" +\n 'own value'\n }\n >\n <Chip\n size=\"small\"\n variant=\"outlined\"\n sx={{ ml: 1, mt: 0.5 }}\n label={prop}\n onDelete={handleClear(prop)}\n />\n </Tooltip>\n ))}\n </Box>\n {attrFields.length ? (\n <FormRenderer\n key={seedKey}\n componentMapper={componentMapper}\n onSubmit={handleSave}\n initialValues={initialValues}\n schema={{ fields: attrFields.map((entry) => entry.field) }}\n >\n {(templateProps: FormTemplateRenderProps) => (\n <InstanceAttrFormTemplate {...templateProps} />\n )}\n </FormRenderer>\n ) : (\n // Said out loud rather than rendering an empty box: a component made\n // of layout elements genuinely has nothing to override here, and an\n // author should not be left wondering whether the panel failed.\n <Typography variant=\"caption\" color=\"text.secondary\">\n {'This part of the component has no attributes that can be ' +\n 'overridden per instance.'}\n </Typography>\n )}\n </Box>\n )\n})\n\nexport default InstanceAttrOverrides\n"],"names":["canvas","components","listInstanceStyleTargets","REUSABLE_INSTANCE_COMPONENT_ID","STYLE_OVERRIDES_ROOT_KEY","FormRenderer","FormSpy","useFormApi","HelpTip","Box","Chip","Grid","MenuItem","TextField","Tooltip","Typography","observer","toJS","memo","useCallback","useContext","useEffect","useMemo","useRef","useState","ComponentPromotionContext","useDebouncedCommit","besignerDocsUrl","getNodeAttrTarget","listInstanceAttrFields","AttrOverrideAutoSave","values","pristine","valid","onSchedule","isFirstRender","current","InstanceAttrFormTemplate","formFields","schema","handleSubmit","schedule","flush","onBlur","title","spacing","container","subscription","InstanceAttrOverrides","node","selectedNode","componentMapper","target","definition","$id","getNode","definitions","isInstance","componentId","undefined","refId","props","targets","picked","setPicked","key","pickedKey","nodeId","overrideKey","length","some","entry","pickedTarget","find","defNode","nodes","componentInternalId","attrFields","overriddenProps","Object","keys","attrs","overriddenKeys","Set","attrOverrides","targetLabel","isRoot","name","getLabel","handleTargetChange","event","value","handleSave","transact","setAttrs","handleClear","prop","clearAttr","seedKey","initialValues","sx","mt","variant","color","component","display","alignItems","excerpt","href","ml","fontSize","select","fullWidth","size","margin","label","onChange","helperText","isLeafOverride","map","pl","depth","has","mb","onDelete","onSubmit","fields","field","templateProps"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC;;AAGD,SACEA,MAAM,EACNC,UAAU,EACVC,wBAAwB,EACxBC,8BAA8B,EAC9BC,wBAAwB,QACnB,eAAc;AACrB,SACEC,YAAY,EAGZC,OAAO,EACPC,UAAU,QACL,6BAA4B;AACnC,SAASC,OAAO,QAAQ,uBAAsB;AAC9C,SACEC,GAAG,EACHC,IAAI,EACJC,IAAI,EACJC,QAAQ,EACRC,SAAS,EACTC,OAAO,EACPC,UAAU,QACL,gBAAe;AACtB,SAASC,QAAQ,QAAQ,kBAAiB;AAC1C,SAASC,IAAI,QAAQ,OAAM;AAC3B,SAEEC,IAAI,EACJC,WAAW,EACXC,UAAU,EACVC,SAAS,EACTC,OAAO,EACPC,MAAM,EACNC,QAAQ,QACH,QAAO;AACd,SAASC,yBAAyB,QAAQ,6CAAyC;AACnF,SAASC,kBAAkB,QAAQ,mCAA+B;AAClE,SAASC,eAAe,QAAQ,wBAAoB;AACpD,SACEC,iBAAiB,EACjBC,sBAAsB,QACjB,0BAAsB;AAE7B;;;;;;;;;CASC,GACD,MAAMC,qCAAuBZ,KAAK,SAASY,qBAAqB,EAC9DC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XnBA;;;YAgBVnB,WAAWR,MAAM,iBAChB,KAAChE;gBAEC8C,iBAAiBA;gBACjB0E,UAAUjC;gBACVO,eAAeA;gBACf5D,QAAQ;oBAAEuF,QAAQjD,WAAW0C,GAAG,CAAC,CAAChD,QAAUA,MAAMwD,KAAK;gBAAE;0BAExD,CAACC,8BACA,KAAC3F,uCAA6B2F;eAP3B9B,WAWP,qEAAqE;YACrE,oEAAoE;YACpE,gEAAgE;0BAChE,KAACnF;gBAAWuF,SAAQ;gBAAUC,OAAM;0BACjC,8DACC;;;;AAKZ,GAAE;AAEF,eAAevD,sBAAqB"}
|
|
@@ -0,0 +1,22 @@
|
|
|
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 StackProps } from '@mui/material';
|
|
18
|
+
export interface InteractControlsProps extends StackProps {
|
|
19
|
+
}
|
|
20
|
+
declare const InteractControlsComponent: import("react").ForwardRefExoticComponent<Omit<InteractControlsProps, "ref"> & import("react").RefAttributes<any>>;
|
|
21
|
+
export { InteractControlsComponent };
|
|
22
|
+
export default InteractControlsComponent;
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { _ as _extends } from "@swc/helpers/_/_extends";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
/**
|
|
4
|
+
* @license
|
|
5
|
+
* Copyright 2026 Aglyn LLC
|
|
6
|
+
*
|
|
7
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
8
|
+
* you may not use this file except in compliance with the License.
|
|
9
|
+
* You may obtain a copy of the License at
|
|
10
|
+
*
|
|
11
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
12
|
+
*
|
|
13
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
14
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
15
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
16
|
+
* See the License for the specific language governing permissions and
|
|
17
|
+
* limitations under the License.
|
|
18
|
+
*/ import { InteractionModeFlag } from "@aglyn/besigner";
|
|
19
|
+
import { ICON_VARIANT_MODIFY_MODE_REARRANGE, ICON_VARIANT_MODIFY_MODE_SELECT } from "@aglyn/shared-data-enums";
|
|
20
|
+
import { MdiIcon } from "@aglyn/shared-ui-jsx";
|
|
21
|
+
import { Stack as MuiStack, ToggleButton as MuiToggleButton, ToggleButtonGroup as MuiToggleButtonGroup, Tooltip as MuiTooltip } from "@mui/material";
|
|
22
|
+
import { forwardRef, useCallback } from "react";
|
|
23
|
+
import useAglynBesignerFlag from "../hooks/use-aglyn-besigner-flag.js";
|
|
24
|
+
const InteractControlsComponent = /*#__PURE__*/ forwardRef((props, ref)=>{
|
|
25
|
+
const {} = props, rest = _extends({}, props);
|
|
26
|
+
const [interactMode, setInteractMode] = useAglynBesignerFlag('interactMode');
|
|
27
|
+
const handleInteractModeClick = useCallback((event, value)=>{
|
|
28
|
+
setInteractMode(InteractionModeFlag[InteractionModeFlag[value]]);
|
|
29
|
+
}, [
|
|
30
|
+
setInteractMode
|
|
31
|
+
]);
|
|
32
|
+
return /*#__PURE__*/ _jsx(MuiStack, _extends({
|
|
33
|
+
ref: ref,
|
|
34
|
+
direction: "row",
|
|
35
|
+
spacing: 1
|
|
36
|
+
}, rest, {
|
|
37
|
+
children: /*#__PURE__*/ _jsxs(MuiToggleButtonGroup, {
|
|
38
|
+
size: "small",
|
|
39
|
+
value: interactMode,
|
|
40
|
+
onChange: handleInteractModeClick,
|
|
41
|
+
exclusive: true,
|
|
42
|
+
children: [
|
|
43
|
+
/*#__PURE__*/ _jsx(MuiTooltip, {
|
|
44
|
+
title: 'Direct selection',
|
|
45
|
+
children: /*#__PURE__*/ _jsx(MuiToggleButton, {
|
|
46
|
+
selected: interactMode === InteractionModeFlag.SELECT,
|
|
47
|
+
value: InteractionModeFlag.SELECT,
|
|
48
|
+
children: /*#__PURE__*/ _jsx(MdiIcon, {
|
|
49
|
+
fontSize: "inherit",
|
|
50
|
+
path: ICON_VARIANT_MODIFY_MODE_SELECT.path
|
|
51
|
+
})
|
|
52
|
+
})
|
|
53
|
+
}),
|
|
54
|
+
/*#__PURE__*/ _jsx(MuiTooltip, {
|
|
55
|
+
title: 'Rearrange',
|
|
56
|
+
children: /*#__PURE__*/ _jsx(MuiToggleButton, {
|
|
57
|
+
selected: interactMode === InteractionModeFlag.REARRANGE,
|
|
58
|
+
value: InteractionModeFlag.REARRANGE,
|
|
59
|
+
children: /*#__PURE__*/ _jsx(MdiIcon, {
|
|
60
|
+
fontSize: "inherit",
|
|
61
|
+
path: ICON_VARIANT_MODIFY_MODE_REARRANGE.path
|
|
62
|
+
})
|
|
63
|
+
})
|
|
64
|
+
})
|
|
65
|
+
]
|
|
66
|
+
})
|
|
67
|
+
}));
|
|
68
|
+
});
|
|
69
|
+
InteractControlsComponent.displayName = 'InteractControlsComponent';
|
|
70
|
+
InteractControlsComponent.aglyn = true;
|
|
71
|
+
export { InteractControlsComponent };
|
|
72
|
+
export default InteractControlsComponent;
|
|
73
|
+
|
|
74
|
+
//# sourceMappingURL=interact-controls.component.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../../../../libs/besigner/feature/designer/src/lib/components/interact-controls.component.tsx"],"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 { InteractionModeFlag } from '@aglyn/besigner'\nimport {\n ICON_VARIANT_MODIFY_MODE_REARRANGE,\n ICON_VARIANT_MODIFY_MODE_SELECT,\n} from '@aglyn/shared-data-enums'\nimport { MdiIcon } from '@aglyn/shared-ui-jsx'\nimport {\n Stack as MuiStack,\n type StackProps,\n ToggleButton as MuiToggleButton,\n ToggleButtonGroup as MuiToggleButtonGroup,\n Tooltip as MuiTooltip,\n} from '@mui/material'\nimport { forwardRef, MouseEvent, useCallback } from 'react'\nimport useAglynBesignerFlag from '../hooks/use-aglyn-besigner-flag'\n\nexport interface InteractControlsProps extends StackProps {}\n\nconst InteractControlsComponent = forwardRef<any, InteractControlsProps>(\n (props, ref) => {\n const { ...rest } = props\n const [interactMode, setInteractMode] = useAglynBesignerFlag('interactMode')\n const handleInteractModeClick = useCallback(\n (event: MouseEvent<HTMLElement>, value: any) => {\n setInteractMode(InteractionModeFlag[InteractionModeFlag[value]])\n },\n [setInteractMode],\n )\n\n return (\n <MuiStack ref={ref} direction=\"row\" spacing={1} {...rest}>\n <MuiToggleButtonGroup\n size=\"small\"\n value={interactMode}\n onChange={handleInteractModeClick}\n exclusive\n >\n <MuiTooltip title={'Direct selection'}>\n <MuiToggleButton\n selected={interactMode === InteractionModeFlag.SELECT}\n value={InteractionModeFlag.SELECT}\n >\n <MdiIcon\n fontSize=\"inherit\"\n path={ICON_VARIANT_MODIFY_MODE_SELECT.path}\n />\n </MuiToggleButton>\n </MuiTooltip>\n <MuiTooltip title={'Rearrange'}>\n <MuiToggleButton\n selected={interactMode === InteractionModeFlag.REARRANGE}\n value={InteractionModeFlag.REARRANGE}\n >\n <MdiIcon\n fontSize=\"inherit\"\n path={ICON_VARIANT_MODIFY_MODE_REARRANGE.path}\n />\n </MuiToggleButton>\n </MuiTooltip>\n </MuiToggleButtonGroup>\n </MuiStack>\n )\n },\n)\nInteractControlsComponent.displayName = 'InteractControlsComponent'\nInteractControlsComponent.aglyn = true\n\nexport { InteractControlsComponent }\nexport default InteractControlsComponent\n"],"names":["InteractionModeFlag","ICON_VARIANT_MODIFY_MODE_REARRANGE","ICON_VARIANT_MODIFY_MODE_SELECT","MdiIcon","Stack","MuiStack","ToggleButton","MuiToggleButton","ToggleButtonGroup","MuiToggleButtonGroup","Tooltip","MuiTooltip","forwardRef","useCallback","useAglynBesignerFlag","InteractControlsComponent","props","ref","rest","interactMode","setInteractMode","handleInteractModeClick","event","value","direction","spacing","size","onChange","exclusive","title","selected","SELECT","fontSize","path","REARRANGE","displayName","aglyn"],"mappings":";;AAAA;;;;;;;;;;;;;;;CAeC,GAED,SAASA,mBAAmB,QAAQ,kBAAiB;AACrD,SACEC,kCAAkC,EAClCC,+BAA+B,QAC1B,2BAA0B;AACjC,SAASC,OAAO,QAAQ,uBAAsB;AAC9C,SACEC,SAASC,QAAQ,EAEjBC,gBAAgBC,eAAe,EAC/BC,qBAAqBC,oBAAoB,EACzCC,WAAWC,UAAU,QAChB,gBAAe;AACtB,SAASC,UAAU,EAAcC,WAAW,QAAQ,QAAO;AAC3D,OAAOC,0BAA0B,sCAAkC;AAInE,MAAMC,0CAA4BH,WAChC,CAACI,OAAOC;IACN,MAAM,EAAW,GAAGD,OAATE,oBAASF;IACpB,MAAM,CAACG,cAAcC,gBAAgB,GAAGN,qBAAqB;IAC7D,MAAMO,0BAA0BR,YAC9B,CAACS,OAAgCC;QAC/BH,gBAAgBpB,mBAAmB,CAACA,mBAAmB,CAACuB,MAAM,CAAC;IACjE,GACA;QAACH;KAAgB;IAGnB,qBACE,KAACf;QAASY,KAAKA;QAAKO,WAAU;QAAMC,SAAS;OAAOP;kBAClD,cAAA,MAACT;YACCiB,MAAK;YACLH,OAAOJ;YACPQ,UAAUN;YACVO,SAAS;;8BAET,KAACjB;oBAAWkB,OAAO;8BACjB,cAAA,KAACtB;wBACCuB,UAAUX,iBAAiBnB,oBAAoB+B,MAAM;wBACrDR,OAAOvB,oBAAoB+B,MAAM;kCAEjC,cAAA,KAAC5B;4BACC6B,UAAS;4BACTC,MAAM/B,gCAAgC+B,IAAI;;;;8BAIhD,KAACtB;oBAAWkB,OAAO;8BACjB,cAAA,KAACtB;wBACCuB,UAAUX,iBAAiBnB,oBAAoBkC,SAAS;wBACxDX,OAAOvB,oBAAoBkC,SAAS;kCAEpC,cAAA,KAAC/B;4BACC6B,UAAS;4BACTC,MAAMhC,mCAAmCgC,IAAI;;;;;;;AAO3D;AAEFlB,0BAA0BoB,WAAW,GAAG;AACxCpB,0BAA0BqB,KAAK,GAAG;AAElC,SAASrB,yBAAyB,GAAE;AACpC,eAAeA,0BAAyB"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/** Mapper key for the attributes form (editor-internal, never persisted). */
|
|
2
|
+
export declare const MARKDOWN_ATTRIBUTE_FIELD_COMPONENT = "aglyn-markdown-attribute-field";
|
|
3
|
+
/**
|
|
4
|
+
* A markdown-lite attribute, edited with the WYSIWYG the console already
|
|
5
|
+
* ships (AGL-1616).
|
|
6
|
+
*
|
|
7
|
+
* The Markdown component's whole document is ONE `content` attribute, and it
|
|
8
|
+
* was a plain textarea: correcting the published Privacy Policy meant
|
|
9
|
+
* preparing a 13 KB paste of raw markdown-lite (AGL-1594). The same editor the
|
|
10
|
+
* blog and the marketplace listing editor use is now the field.
|
|
11
|
+
*
|
|
12
|
+
* ## Commit semantics — the part that can lose an author's work
|
|
13
|
+
*
|
|
14
|
+
* A besigner attribute commits on a 250 ms debounce, flushed when focus leaves
|
|
15
|
+
* the form and again on unmount (`useDebouncedCommit`, AGL-567). That is only
|
|
16
|
+
* safe while every edit has already reached react-final-form by the time a
|
|
17
|
+
* flush runs. `MarkdownVisualEditor` emits on every input event rather than on
|
|
18
|
+
* blur, so it does — and this wrapper must not undo that:
|
|
19
|
+
*
|
|
20
|
+
* - `input.onChange` is called straight from the editor's `onChange`, never
|
|
21
|
+
* deferred to a blur of our own. The toolbar, the link popover and the
|
|
22
|
+
* source/visual toggle all move focus (two of them into a portal outside the
|
|
23
|
+
* `<form>`), so a blur-committed wrapper would strand everything typed since
|
|
24
|
+
* the previous one — silently, with the canvas still showing the right text.
|
|
25
|
+
* - Nothing here re-derives the value. The editor re-parses its row model
|
|
26
|
+
* whenever the incoming `value` differs from what it last emitted, which
|
|
27
|
+
* resets the undo history and the caret; handing back anything but the
|
|
28
|
+
* editor's own string would do that mid-sentence.
|
|
29
|
+
*
|
|
30
|
+
* The toolbar's image action reaches the host's media library through
|
|
31
|
+
* `useMarkdownMediaPicker` (AGL-1645) — the same `MediaPickerContext` this
|
|
32
|
+
* panel's own Browse button uses one field away. Opening it is a modal that
|
|
33
|
+
* takes focus, which is safe here for the reason above and no other: the value
|
|
34
|
+
* is already in the form before the dialog opens.
|
|
35
|
+
*/
|
|
36
|
+
export declare function MarkdownAttributeField(props: Record<string, unknown>): import("react").JSX.Element;
|
|
37
|
+
export declare namespace MarkdownAttributeField {
|
|
38
|
+
var displayName: string;
|
|
39
|
+
}
|
|
40
|
+
export default MarkdownAttributeField;
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2026 Aglyn LLC
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/ 'use client';
|
|
17
|
+
import { _ as _extends } from "@swc/helpers/_/_extends";
|
|
18
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
19
|
+
import { MarkdownField } from "@aglyn/aglyn-markdown-editor";
|
|
20
|
+
import { FormFieldGrid, useFieldApi } from "@aglyn/shared-ui-jsx-forms";
|
|
21
|
+
import { Stack, Typography } from "@mui/material";
|
|
22
|
+
import { useCallback } from "react";
|
|
23
|
+
import { useMarkdownMediaPicker } from "../hooks/use-markdown-media-picker.js";
|
|
24
|
+
/** Mapper key for the attributes form (editor-internal, never persisted). */ export const MARKDOWN_ATTRIBUTE_FIELD_COMPONENT = 'aglyn-markdown-attribute-field';
|
|
25
|
+
/**
|
|
26
|
+
* A markdown-lite attribute, edited with the WYSIWYG the console already
|
|
27
|
+
* ships (AGL-1616).
|
|
28
|
+
*
|
|
29
|
+
* The Markdown component's whole document is ONE `content` attribute, and it
|
|
30
|
+
* was a plain textarea: correcting the published Privacy Policy meant
|
|
31
|
+
* preparing a 13 KB paste of raw markdown-lite (AGL-1594). The same editor the
|
|
32
|
+
* blog and the marketplace listing editor use is now the field.
|
|
33
|
+
*
|
|
34
|
+
* ## Commit semantics — the part that can lose an author's work
|
|
35
|
+
*
|
|
36
|
+
* A besigner attribute commits on a 250 ms debounce, flushed when focus leaves
|
|
37
|
+
* the form and again on unmount (`useDebouncedCommit`, AGL-567). That is only
|
|
38
|
+
* safe while every edit has already reached react-final-form by the time a
|
|
39
|
+
* flush runs. `MarkdownVisualEditor` emits on every input event rather than on
|
|
40
|
+
* blur, so it does — and this wrapper must not undo that:
|
|
41
|
+
*
|
|
42
|
+
* - `input.onChange` is called straight from the editor's `onChange`, never
|
|
43
|
+
* deferred to a blur of our own. The toolbar, the link popover and the
|
|
44
|
+
* source/visual toggle all move focus (two of them into a portal outside the
|
|
45
|
+
* `<form>`), so a blur-committed wrapper would strand everything typed since
|
|
46
|
+
* the previous one — silently, with the canvas still showing the right text.
|
|
47
|
+
* - Nothing here re-derives the value. The editor re-parses its row model
|
|
48
|
+
* whenever the incoming `value` differs from what it last emitted, which
|
|
49
|
+
* resets the undo history and the caret; handing back anything but the
|
|
50
|
+
* editor's own string would do that mid-sentence.
|
|
51
|
+
*
|
|
52
|
+
* The toolbar's image action reaches the host's media library through
|
|
53
|
+
* `useMarkdownMediaPicker` (AGL-1645) — the same `MediaPickerContext` this
|
|
54
|
+
* panel's own Browse button uses one field away. Opening it is a modal that
|
|
55
|
+
* takes focus, which is safe here for the reason above and no other: the value
|
|
56
|
+
* is already in the form before the dialog opens.
|
|
57
|
+
*/ export function MarkdownAttributeField(props) {
|
|
58
|
+
const { input, label, description, isDisabled, help, FormFieldGridProps } = useFieldApi(props);
|
|
59
|
+
const { editorRef, onPickImageFromMedia } = useMarkdownMediaPicker();
|
|
60
|
+
const value = typeof input.value === 'string' ? input.value : '';
|
|
61
|
+
const handleChange = useCallback((next)=>{
|
|
62
|
+
input.onChange(next);
|
|
63
|
+
}, [
|
|
64
|
+
input
|
|
65
|
+
]);
|
|
66
|
+
// Inside the shared grid wrapper, so the corner controls every field has —
|
|
67
|
+
// the help tip, and the `{}` that binds it to a property — reach this one.
|
|
68
|
+
return /*#__PURE__*/ _jsx(FormFieldGrid, _extends({
|
|
69
|
+
help: help
|
|
70
|
+
}, FormFieldGridProps != null ? FormFieldGridProps : {}, {
|
|
71
|
+
children: /*#__PURE__*/ _jsxs(Stack, {
|
|
72
|
+
spacing: 0.5,
|
|
73
|
+
sx: {
|
|
74
|
+
width: '100%'
|
|
75
|
+
},
|
|
76
|
+
"data-testid": "markdown-attribute-field",
|
|
77
|
+
children: [
|
|
78
|
+
/*#__PURE__*/ _jsx(MarkdownField, {
|
|
79
|
+
label: String(label != null ? label : 'Content'),
|
|
80
|
+
value: value,
|
|
81
|
+
onChange: handleChange,
|
|
82
|
+
editorRef: editorRef,
|
|
83
|
+
onPickImageFromMedia: onPickImageFromMedia,
|
|
84
|
+
minHeight: 220
|
|
85
|
+
}),
|
|
86
|
+
description ? /*#__PURE__*/ _jsx(Typography, {
|
|
87
|
+
variant: "caption",
|
|
88
|
+
color: "text.secondary",
|
|
89
|
+
children: String(description)
|
|
90
|
+
}) : null,
|
|
91
|
+
isDisabled ? /*#__PURE__*/ _jsx(Typography, {
|
|
92
|
+
variant: "caption",
|
|
93
|
+
color: "text.secondary",
|
|
94
|
+
children: 'This attribute is read-only here.'
|
|
95
|
+
}) : null
|
|
96
|
+
]
|
|
97
|
+
})
|
|
98
|
+
}));
|
|
99
|
+
}
|
|
100
|
+
MarkdownAttributeField.displayName = 'MarkdownAttributeField';
|
|
101
|
+
export default MarkdownAttributeField;
|
|
102
|
+
|
|
103
|
+
//# sourceMappingURL=markdown-attribute-field.component.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../../../../libs/besigner/feature/designer/src/lib/components/markdown-attribute-field.component.tsx"],"sourcesContent":["/**\n * @license\n * Copyright 2026 Aglyn LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n'use client'\n\nimport { MarkdownField } from '@aglyn/aglyn-markdown-editor'\nimport {\n FormFieldGrid,\n type FormFieldGridProps,\n useFieldApi,\n} from '@aglyn/shared-ui-jsx-forms'\nimport { Stack, Typography } from '@mui/material'\nimport { useCallback } from 'react'\nimport { useMarkdownMediaPicker } from '../hooks/use-markdown-media-picker'\n\n/** Mapper key for the attributes form (editor-internal, never persisted). */\nexport const MARKDOWN_ATTRIBUTE_FIELD_COMPONENT =\n 'aglyn-markdown-attribute-field'\n\n/**\n * A markdown-lite attribute, edited with the WYSIWYG the console already\n * ships (AGL-1616).\n *\n * The Markdown component's whole document is ONE `content` attribute, and it\n * was a plain textarea: correcting the published Privacy Policy meant\n * preparing a 13 KB paste of raw markdown-lite (AGL-1594). The same editor the\n * blog and the marketplace listing editor use is now the field.\n *\n * ## Commit semantics — the part that can lose an author's work\n *\n * A besigner attribute commits on a 250 ms debounce, flushed when focus leaves\n * the form and again on unmount (`useDebouncedCommit`, AGL-567). That is only\n * safe while every edit has already reached react-final-form by the time a\n * flush runs. `MarkdownVisualEditor` emits on every input event rather than on\n * blur, so it does — and this wrapper must not undo that:\n *\n * - `input.onChange` is called straight from the editor's `onChange`, never\n * deferred to a blur of our own. The toolbar, the link popover and the\n * source/visual toggle all move focus (two of them into a portal outside the\n * `<form>`), so a blur-committed wrapper would strand everything typed since\n * the previous one — silently, with the canvas still showing the right text.\n * - Nothing here re-derives the value. The editor re-parses its row model\n * whenever the incoming `value` differs from what it last emitted, which\n * resets the undo history and the caret; handing back anything but the\n * editor's own string would do that mid-sentence.\n *\n * The toolbar's image action reaches the host's media library through\n * `useMarkdownMediaPicker` (AGL-1645) — the same `MediaPickerContext` this\n * panel's own Browse button uses one field away. Opening it is a modal that\n * takes focus, which is safe here for the reason above and no other: the value\n * is already in the form before the dialog opens.\n */\nexport function MarkdownAttributeField(props: Record<string, unknown>) {\n const { input, label, description, isDisabled, help, FormFieldGridProps } =\n useFieldApi(props as never)\n const { editorRef, onPickImageFromMedia } = useMarkdownMediaPicker()\n\n const value = typeof input.value === 'string' ? input.value : ''\n\n const handleChange = useCallback(\n (next: string) => {\n input.onChange(next)\n },\n [input],\n )\n\n // Inside the shared grid wrapper, so the corner controls every field has —\n // the help tip, and the `{}` that binds it to a property — reach this one.\n return (\n <FormFieldGrid\n help={help as FormFieldGridProps['help']}\n {...((FormFieldGridProps as FormFieldGridProps | undefined) ?? {})}\n >\n <Stack spacing={0.5} sx={{ width: '100%' }} data-testid=\"markdown-attribute-field\">\n <MarkdownField\n label={String(label ?? 'Content')}\n value={value}\n onChange={handleChange}\n editorRef={editorRef}\n onPickImageFromMedia={onPickImageFromMedia}\n minHeight={220}\n />\n {description ? (\n <Typography variant=\"caption\" color=\"text.secondary\">\n {String(description)}\n </Typography>\n ) : null}\n {isDisabled ? (\n <Typography variant=\"caption\" color=\"text.secondary\">\n {'This attribute is read-only here.'}\n </Typography>\n ) : null}\n </Stack>\n </FormFieldGrid>\n )\n}\n\nMarkdownAttributeField.displayName = 'MarkdownAttributeField'\n\nexport default MarkdownAttributeField\n"],"names":["MarkdownField","FormFieldGrid","useFieldApi","Stack","Typography","useCallback","useMarkdownMediaPicker","MARKDOWN_ATTRIBUTE_FIELD_COMPONENT","MarkdownAttributeField","props","input","label","description","isDisabled","help","FormFieldGridProps","editorRef","onPickImageFromMedia","value","handleChange","next","onChange","spacing","sx","width","data-testid","String","minHeight","variant","color","displayName"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GACD;;;AAEA,SAASA,aAAa,QAAQ,+BAA8B;AAC5D,SACEC,aAAa,EAEbC,WAAW,QACN,6BAA4B;AACnC,SAASC,KAAK,EAAEC,UAAU,QAAQ,gBAAe;AACjD,SAASC,WAAW,QAAQ,QAAO;AACnC,SAASC,sBAAsB,QAAQ,wCAAoC;AAE3E,2EAA2E,GAC3E,OAAO,MAAMC,qCACX,iCAAgC;AAElC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAgCC,GACD,OAAO,SAASC,uBAAuBC,KAA8B;IACnE,MAAM,EAAEC,KAAK,EAAEC,KAAK,EAAEC,WAAW,EAAEC,UAAU,EAAEC,IAAI,EAAEC,kBAAkB,EAAE,GACvEb,YAAYO;IACd,MAAM,EAAEO,SAAS,EAAEC,oBAAoB,EAAE,GAAGX;IAE5C,MAAMY,QAAQ,OAAOR,MAAMQ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