@next-buildr/editor 0.0.0-stage → 2.0.0
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 +21 -0
- package/dist/.tsbuildinfo +1 -0
- package/dist/app/builder-editor.d.ts +8 -0
- package/dist/app/builder-editor.d.ts.map +1 -0
- package/dist/app/builder-editor.js +14 -0
- package/dist/app/builder-editor.test.d.ts +2 -0
- package/dist/app/builder-editor.test.d.ts.map +1 -0
- package/dist/app/builder-editor.test.js +199 -0
- package/dist/app/config.d.ts +59 -0
- package/dist/app/config.d.ts.map +1 -0
- package/dist/app/config.js +18 -0
- package/dist/app/content-language.test.d.ts +2 -0
- package/dist/app/content-language.test.d.ts.map +1 -0
- package/dist/app/content-language.test.js +157 -0
- package/dist/app/editor-app.d.ts +17 -0
- package/dist/app/editor-app.d.ts.map +1 -0
- package/dist/app/editor-app.js +206 -0
- package/dist/app/editor-app.test.d.ts +2 -0
- package/dist/app/editor-app.test.d.ts.map +1 -0
- package/dist/app/editor-app.test.js +135 -0
- package/dist/app/layout.d.ts +32 -0
- package/dist/app/layout.d.ts.map +1 -0
- package/dist/app/layout.js +82 -0
- package/dist/app/manifest.d.ts +12 -0
- package/dist/app/manifest.d.ts.map +1 -0
- package/dist/app/manifest.js +17 -0
- package/dist/app/shell-panels.d.ts +15 -0
- package/dist/app/shell-panels.d.ts.map +1 -0
- package/dist/app/shell-panels.js +5 -0
- package/dist/app/small-screen.d.ts +12 -0
- package/dist/app/small-screen.d.ts.map +1 -0
- package/dist/app/small-screen.js +33 -0
- package/dist/app/small-screen.test.d.ts +2 -0
- package/dist/app/small-screen.test.d.ts.map +1 -0
- package/dist/app/small-screen.test.js +108 -0
- package/dist/app/status-info.d.ts +14 -0
- package/dist/app/status-info.d.ts.map +1 -0
- package/dist/app/status-info.js +34 -0
- package/dist/app/use-resizable.d.ts +34 -0
- package/dist/app/use-resizable.d.ts.map +1 -0
- package/dist/app/use-resizable.js +84 -0
- package/dist/canvas-host/canvas-frame.d.ts +53 -0
- package/dist/canvas-host/canvas-frame.d.ts.map +1 -0
- package/dist/canvas-host/canvas-frame.js +146 -0
- package/dist/canvas-host/canvas-frame.test.d.ts +2 -0
- package/dist/canvas-host/canvas-frame.test.d.ts.map +1 -0
- package/dist/canvas-host/canvas-frame.test.js +91 -0
- package/dist/canvas-host/host.d.ts +109 -0
- package/dist/canvas-host/host.d.ts.map +1 -0
- package/dist/canvas-host/host.js +293 -0
- package/dist/canvas-host/host.test.d.ts +2 -0
- package/dist/canvas-host/host.test.d.ts.map +1 -0
- package/dist/canvas-host/host.test.js +398 -0
- package/dist/canvas-host/index.d.ts +5 -0
- package/dist/canvas-host/index.d.ts.map +1 -0
- package/dist/canvas-host/index.js +2 -0
- package/dist/clipboard/clipboard.d.ts +38 -0
- package/dist/clipboard/clipboard.d.ts.map +1 -0
- package/dist/clipboard/clipboard.js +160 -0
- package/dist/clipboard/clipboard.test.d.ts +2 -0
- package/dist/clipboard/clipboard.test.d.ts.map +1 -0
- package/dist/clipboard/clipboard.test.js +457 -0
- package/dist/clipboard/format.d.ts +27 -0
- package/dist/clipboard/format.d.ts.map +1 -0
- package/dist/clipboard/format.js +37 -0
- package/dist/clipboard/index.d.ts +6 -0
- package/dist/clipboard/index.d.ts.map +1 -0
- package/dist/clipboard/index.js +3 -0
- package/dist/clipboard/react.d.ts +20 -0
- package/dist/clipboard/react.d.ts.map +1 -0
- package/dist/clipboard/react.js +71 -0
- package/dist/dialogs/index.d.ts +2 -0
- package/dist/dialogs/index.d.ts.map +1 -0
- package/dist/dialogs/index.js +1 -0
- package/dist/dialogs/media-picker/index.d.ts +7 -0
- package/dist/dialogs/media-picker/index.d.ts.map +1 -0
- package/dist/dialogs/media-picker/index.js +3 -0
- package/dist/dialogs/media-picker/library.d.ts +17 -0
- package/dist/dialogs/media-picker/library.d.ts.map +1 -0
- package/dist/dialogs/media-picker/library.js +9 -0
- package/dist/dialogs/media-picker/media-picker.d.ts +18 -0
- package/dist/dialogs/media-picker/media-picker.d.ts.map +1 -0
- package/dist/dialogs/media-picker/media-picker.js +99 -0
- package/dist/dialogs/media-picker/media-picker.test.d.ts +2 -0
- package/dist/dialogs/media-picker/media-picker.test.d.ts.map +1 -0
- package/dist/dialogs/media-picker/media-picker.test.js +161 -0
- package/dist/dialogs/media-picker/media-ref.d.ts +28 -0
- package/dist/dialogs/media-picker/media-ref.d.ts.map +1 -0
- package/dist/dialogs/media-picker/media-ref.js +52 -0
- package/dist/dnd/check.d.ts +8 -0
- package/dist/dnd/check.d.ts.map +1 -0
- package/dist/dnd/check.js +12 -0
- package/dist/dnd/destinations.d.ts +15 -0
- package/dist/dnd/destinations.d.ts.map +1 -0
- package/dist/dnd/destinations.js +43 -0
- package/dist/dnd/dnd-react.test.d.ts +2 -0
- package/dist/dnd/dnd-react.test.d.ts.map +1 -0
- package/dist/dnd/dnd-react.test.js +93 -0
- package/dist/dnd/dnd.test.d.ts +2 -0
- package/dist/dnd/dnd.test.d.ts.map +1 -0
- package/dist/dnd/dnd.test.js +327 -0
- package/dist/dnd/engine.d.ts +85 -0
- package/dist/dnd/engine.d.ts.map +1 -0
- package/dist/dnd/engine.js +185 -0
- package/dist/dnd/fragment.d.ts +6 -0
- package/dist/dnd/fragment.d.ts.map +1 -0
- package/dist/dnd/fragment.js +18 -0
- package/dist/dnd/geometry.d.ts +30 -0
- package/dist/dnd/geometry.d.ts.map +1 -0
- package/dist/dnd/geometry.js +31 -0
- package/dist/dnd/index.d.ts +14 -0
- package/dist/dnd/index.d.ts.map +1 -0
- package/dist/dnd/index.js +7 -0
- package/dist/dnd/move-to-dialog.d.ts +13 -0
- package/dist/dnd/move-to-dialog.d.ts.map +1 -0
- package/dist/dnd/move-to-dialog.js +30 -0
- package/dist/dnd/react.d.ts +43 -0
- package/dist/dnd/react.d.ts.map +1 -0
- package/dist/dnd/react.js +185 -0
- package/dist/dnd/tree-target.d.ts +29 -0
- package/dist/dnd/tree-target.d.ts.map +1 -0
- package/dist/dnd/tree-target.js +97 -0
- package/dist/fonts/LICENSE-inter.txt +93 -0
- package/dist/fonts/inter-latin-400-normal.woff2 +0 -0
- package/dist/fonts/inter-latin-500-normal.woff2 +0 -0
- package/dist/fonts/inter-latin-600-normal.woff2 +0 -0
- package/dist/fonts/inter-latin-ext-400-normal.woff2 +0 -0
- package/dist/fonts/inter-latin-ext-500-normal.woff2 +0 -0
- package/dist/fonts/inter-latin-ext-600-normal.woff2 +0 -0
- package/dist/index.d.ts +22 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +21 -0
- package/dist/messages/en.d.ts +335 -0
- package/dist/messages/en.d.ts.map +1 -0
- package/dist/messages/en.js +332 -0
- package/dist/messages/index.d.ts +16 -0
- package/dist/messages/index.d.ts.map +1 -0
- package/dist/messages/index.js +22 -0
- package/dist/messages/pl.d.ts +3 -0
- package/dist/messages/pl.d.ts.map +1 -0
- package/dist/messages/pl.js +327 -0
- package/dist/panels/breadcrumbs/breadcrumbs.d.ts +6 -0
- package/dist/panels/breadcrumbs/breadcrumbs.d.ts.map +1 -0
- package/dist/panels/breadcrumbs/breadcrumbs.js +24 -0
- package/dist/panels/breadcrumbs/breadcrumbs.test.d.ts +2 -0
- package/dist/panels/breadcrumbs/breadcrumbs.test.d.ts.map +1 -0
- package/dist/panels/breadcrumbs/breadcrumbs.test.js +56 -0
- package/dist/panels/index.d.ts +9 -0
- package/dist/panels/index.d.ts.map +1 -0
- package/dist/panels/index.js +6 -0
- package/dist/panels/insert/catalog.d.ts +30 -0
- package/dist/panels/insert/catalog.d.ts.map +1 -0
- package/dist/panels/insert/catalog.js +76 -0
- package/dist/panels/insert/catalog.order.test.d.ts +2 -0
- package/dist/panels/insert/catalog.order.test.d.ts.map +1 -0
- package/dist/panels/insert/catalog.order.test.js +17 -0
- package/dist/panels/insert/category-name.d.ts +4 -0
- package/dist/panels/insert/category-name.d.ts.map +1 -0
- package/dist/panels/insert/category-name.js +8 -0
- package/dist/panels/insert/index.d.ts +3 -0
- package/dist/panels/insert/index.d.ts.map +1 -0
- package/dist/panels/insert/index.js +2 -0
- package/dist/panels/insert/insert-panel.d.ts +7 -0
- package/dist/panels/insert/insert-panel.d.ts.map +1 -0
- package/dist/panels/insert/insert-panel.js +155 -0
- package/dist/panels/insert/insert-panel.test.d.ts +2 -0
- package/dist/panels/insert/insert-panel.test.d.ts.map +1 -0
- package/dist/panels/insert/insert-panel.test.js +323 -0
- package/dist/panels/insert/target.d.ts +17 -0
- package/dist/panels/insert/target.d.ts.map +1 -0
- package/dist/panels/insert/target.js +48 -0
- package/dist/panels/inspector/controls/boolean.d.ts +4 -0
- package/dist/panels/inspector/controls/boolean.d.ts.map +1 -0
- package/dist/panels/inspector/controls/boolean.js +4 -0
- package/dist/panels/inspector/controls/compound.d.ts +15 -0
- package/dist/panels/inspector/controls/compound.d.ts.map +1 -0
- package/dist/panels/inspector/controls/compound.js +99 -0
- package/dist/panels/inspector/controls/compound.test.d.ts +2 -0
- package/dist/panels/inspector/controls/compound.test.d.ts.map +1 -0
- package/dist/panels/inspector/controls/compound.test.js +195 -0
- package/dist/panels/inspector/controls/icon.d.ts +5 -0
- package/dist/panels/inspector/controls/icon.d.ts.map +1 -0
- package/dist/panels/inspector/controls/icon.js +6 -0
- package/dist/panels/inspector/controls/index.d.ts +13 -0
- package/dist/panels/inspector/controls/index.d.ts.map +1 -0
- package/dist/panels/inspector/controls/index.js +11 -0
- package/dist/panels/inspector/controls/label.d.ts +4 -0
- package/dist/panels/inspector/controls/label.d.ts.map +1 -0
- package/dist/panels/inspector/controls/label.js +8 -0
- package/dist/panels/inspector/controls/link.d.ts +5 -0
- package/dist/panels/inspector/controls/link.d.ts.map +1 -0
- package/dist/panels/inspector/controls/link.js +6 -0
- package/dist/panels/inspector/controls/media.d.ts +9 -0
- package/dist/panels/inspector/controls/media.d.ts.map +1 -0
- package/dist/panels/inspector/controls/media.js +21 -0
- package/dist/panels/inspector/controls/number.d.ts +10 -0
- package/dist/panels/inspector/controls/number.d.ts.map +1 -0
- package/dist/panels/inspector/controls/number.js +33 -0
- package/dist/panels/inspector/controls/rich-text-model.d.ts +20 -0
- package/dist/panels/inspector/controls/rich-text-model.d.ts.map +1 -0
- package/dist/panels/inspector/controls/rich-text-model.js +91 -0
- package/dist/panels/inspector/controls/rich-text.d.ts +10 -0
- package/dist/panels/inspector/controls/rich-text.d.ts.map +1 -0
- package/dist/panels/inspector/controls/rich-text.js +159 -0
- package/dist/panels/inspector/controls/select.d.ts +5 -0
- package/dist/panels/inspector/controls/select.d.ts.map +1 -0
- package/dist/panels/inspector/controls/select.js +16 -0
- package/dist/panels/inspector/controls/select.test.d.ts +2 -0
- package/dist/panels/inspector/controls/select.test.d.ts.map +1 -0
- package/dist/panels/inspector/controls/select.test.js +43 -0
- package/dist/panels/inspector/controls/text.d.ts +4 -0
- package/dist/panels/inspector/controls/text.d.ts.map +1 -0
- package/dist/panels/inspector/controls/text.js +5 -0
- package/dist/panels/inspector/controls/textarea.d.ts +4 -0
- package/dist/panels/inspector/controls/textarea.d.ts.map +1 -0
- package/dist/panels/inspector/controls/textarea.js +4 -0
- package/dist/panels/inspector/controls/types.d.ts +16 -0
- package/dist/panels/inspector/controls/types.d.ts.map +1 -0
- package/dist/panels/inspector/controls/types.js +1 -0
- package/dist/panels/inspector/index.d.ts +17 -0
- package/dist/panels/inspector/index.d.ts.map +1 -0
- package/dist/panels/inspector/index.js +9 -0
- package/dist/panels/inspector/inspector.d.ts +16 -0
- package/dist/panels/inspector/inspector.d.ts.map +1 -0
- package/dist/panels/inspector/inspector.js +116 -0
- package/dist/panels/inspector/inspector.test.d.ts +2 -0
- package/dist/panels/inspector/inspector.test.d.ts.map +1 -0
- package/dist/panels/inspector/inspector.test.js +328 -0
- package/dist/panels/inspector/props-panel.d.ts +26 -0
- package/dist/panels/inspector/props-panel.d.ts.map +1 -0
- package/dist/panels/inspector/props-panel.js +117 -0
- package/dist/panels/inspector/styles/box-model.d.ts +20 -0
- package/dist/panels/inspector/styles/box-model.d.ts.map +1 -0
- package/dist/panels/inspector/styles/box-model.js +31 -0
- package/dist/panels/inspector/styles/index.d.ts +5 -0
- package/dist/panels/inspector/styles/index.d.ts.map +1 -0
- package/dist/panels/inspector/styles/index.js +2 -0
- package/dist/panels/inspector/styles/model.d.ts +55 -0
- package/dist/panels/inspector/styles/model.d.ts.map +1 -0
- package/dist/panels/inspector/styles/model.js +111 -0
- package/dist/panels/inspector/styles/segments.d.ts +18 -0
- package/dist/panels/inspector/styles/segments.d.ts.map +1 -0
- package/dist/panels/inspector/styles/segments.js +75 -0
- package/dist/panels/inspector/styles/sides-editor.d.ts +34 -0
- package/dist/panels/inspector/styles/sides-editor.d.ts.map +1 -0
- package/dist/panels/inspector/styles/sides-editor.js +86 -0
- package/dist/panels/inspector/styles/style-inspector.d.ts +15 -0
- package/dist/panels/inspector/styles/style-inspector.d.ts.map +1 -0
- package/dist/panels/inspector/styles/style-inspector.js +219 -0
- package/dist/panels/inspector/styles/style-inspector.test.d.ts +2 -0
- package/dist/panels/inspector/styles/style-inspector.test.d.ts.map +1 -0
- package/dist/panels/inspector/styles/style-inspector.test.js +265 -0
- package/dist/panels/inspector/styles/token-picker.d.ts +15 -0
- package/dist/panels/inspector/styles/token-picker.d.ts.map +1 -0
- package/dist/panels/inspector/styles/token-picker.js +23 -0
- package/dist/panels/inspector/styles/use-style-value.d.ts +28 -0
- package/dist/panels/inspector/styles/use-style-value.d.ts.map +1 -0
- package/dist/panels/inspector/styles/use-style-value.js +51 -0
- package/dist/panels/inspector/value.d.ts +20 -0
- package/dist/panels/inspector/value.d.ts.map +1 -0
- package/dist/panels/inspector/value.js +32 -0
- package/dist/panels/inspector/values/analyze.d.ts +49 -0
- package/dist/panels/inspector/values/analyze.d.ts.map +1 -0
- package/dist/panels/inspector/values/analyze.js +115 -0
- package/dist/panels/inspector/values/data.d.ts +18 -0
- package/dist/panels/inspector/values/data.d.ts.map +1 -0
- package/dist/panels/inspector/values/data.js +10 -0
- package/dist/panels/inspector/values/translation.d.ts +20 -0
- package/dist/panels/inspector/values/translation.d.ts.map +1 -0
- package/dist/panels/inspector/values/translation.js +25 -0
- package/dist/panels/inspector/values/value-editor.d.ts +30 -0
- package/dist/panels/inspector/values/value-editor.d.ts.map +1 -0
- package/dist/panels/inspector/values/value-editor.js +191 -0
- package/dist/panels/inspector/values/values.test.d.ts +2 -0
- package/dist/panels/inspector/values/values.test.d.ts.map +1 -0
- package/dist/panels/inspector/values/values.test.js +173 -0
- package/dist/panels/issues/collect.d.ts +70 -0
- package/dist/panels/issues/collect.d.ts.map +1 -0
- package/dist/panels/issues/collect.js +96 -0
- package/dist/panels/issues/index.d.ts +5 -0
- package/dist/panels/issues/index.d.ts.map +1 -0
- package/dist/panels/issues/index.js +2 -0
- package/dist/panels/issues/issues-panel.d.ts +17 -0
- package/dist/panels/issues/issues-panel.d.ts.map +1 -0
- package/dist/panels/issues/issues-panel.js +77 -0
- package/dist/panels/layers/flatten.d.ts +28 -0
- package/dist/panels/layers/flatten.d.ts.map +1 -0
- package/dist/panels/layers/flatten.js +61 -0
- package/dist/panels/layers/layers-panel.d.ts +14 -0
- package/dist/panels/layers/layers-panel.d.ts.map +1 -0
- package/dist/panels/layers/layers-panel.js +428 -0
- package/dist/panels/layers/layers-panel.test.d.ts +2 -0
- package/dist/panels/layers/layers-panel.test.d.ts.map +1 -0
- package/dist/panels/layers/layers-panel.test.js +315 -0
- package/dist/persistence/controller.d.ts +55 -0
- package/dist/persistence/controller.d.ts.map +1 -0
- package/dist/persistence/controller.js +341 -0
- package/dist/persistence/index.d.ts +6 -0
- package/dist/persistence/index.d.ts.map +1 -0
- package/dist/persistence/index.js +3 -0
- package/dist/persistence/load.d.ts +35 -0
- package/dist/persistence/load.d.ts.map +1 -0
- package/dist/persistence/load.js +67 -0
- package/dist/persistence/persistence.test.d.ts +2 -0
- package/dist/persistence/persistence.test.d.ts.map +1 -0
- package/dist/persistence/persistence.test.js +483 -0
- package/dist/persistence/react.d.ts +18 -0
- package/dist/persistence/react.d.ts.map +1 -0
- package/dist/persistence/react.js +105 -0
- package/dist/persistence/types.d.ts +182 -0
- package/dist/persistence/types.d.ts.map +1 -0
- package/dist/persistence/types.js +1 -0
- package/dist/preview/index.d.ts +3 -0
- package/dist/preview/index.d.ts.map +1 -0
- package/dist/preview/index.js +2 -0
- package/dist/preview/prepare.d.ts +16 -0
- package/dist/preview/prepare.d.ts.map +1 -0
- package/dist/preview/prepare.js +21 -0
- package/dist/preview/preview.d.ts +27 -0
- package/dist/preview/preview.d.ts.map +1 -0
- package/dist/preview/preview.js +51 -0
- package/dist/preview/preview.test.d.ts +2 -0
- package/dist/preview/preview.test.d.ts.map +1 -0
- package/dist/preview/preview.test.js +129 -0
- package/dist/shortcuts/actions.d.ts +17 -0
- package/dist/shortcuts/actions.d.ts.map +1 -0
- package/dist/shortcuts/actions.js +85 -0
- package/dist/shortcuts/index.d.ts +11 -0
- package/dist/shortcuts/index.d.ts.map +1 -0
- package/dist/shortcuts/index.js +5 -0
- package/dist/shortcuts/keys.d.ts +29 -0
- package/dist/shortcuts/keys.d.ts.map +1 -0
- package/dist/shortcuts/keys.js +100 -0
- package/dist/shortcuts/map.d.ts +17 -0
- package/dist/shortcuts/map.d.ts.map +1 -0
- package/dist/shortcuts/map.js +31 -0
- package/dist/shortcuts/registry.d.ts +32 -0
- package/dist/shortcuts/registry.d.ts.map +1 -0
- package/dist/shortcuts/registry.js +53 -0
- package/dist/shortcuts/shortcuts.d.ts +32 -0
- package/dist/shortcuts/shortcuts.d.ts.map +1 -0
- package/dist/shortcuts/shortcuts.js +95 -0
- package/dist/shortcuts/shortcuts.test.d.ts +2 -0
- package/dist/shortcuts/shortcuts.test.d.ts.map +1 -0
- package/dist/shortcuts/shortcuts.test.js +263 -0
- package/dist/store/create-store.d.ts +13 -0
- package/dist/store/create-store.d.ts.map +1 -0
- package/dist/store/create-store.js +248 -0
- package/dist/store/index.d.ts +9 -0
- package/dist/store/index.d.ts.map +1 -0
- package/dist/store/index.js +5 -0
- package/dist/store/locale.d.ts +23 -0
- package/dist/store/locale.d.ts.map +1 -0
- package/dist/store/locale.js +31 -0
- package/dist/store/react.d.ts +17 -0
- package/dist/store/react.d.ts.map +1 -0
- package/dist/store/react.js +32 -0
- package/dist/store/selection.d.ts +32 -0
- package/dist/store/selection.d.ts.map +1 -0
- package/dist/store/selection.js +84 -0
- package/dist/store/selection.test.d.ts +2 -0
- package/dist/store/selection.test.d.ts.map +1 -0
- package/dist/store/selection.test.js +95 -0
- package/dist/store/selectors.d.ts +18 -0
- package/dist/store/selectors.d.ts.map +1 -0
- package/dist/store/selectors.js +39 -0
- package/dist/store/store.test.d.ts +2 -0
- package/dist/store/store.test.d.ts.map +1 -0
- package/dist/store/store.test.js +331 -0
- package/dist/store/types.d.ts +114 -0
- package/dist/store/types.d.ts.map +1 -0
- package/dist/store/types.js +1 -0
- package/dist/styles/tokens.test.d.ts +2 -0
- package/dist/styles/tokens.test.d.ts.map +1 -0
- package/dist/styles/tokens.test.js +199 -0
- package/dist/styles.css +2885 -0
- package/dist/toolbar/brand.d.ts +7 -0
- package/dist/toolbar/brand.d.ts.map +1 -0
- package/dist/toolbar/brand.js +11 -0
- package/dist/toolbar/breakpoint-control.d.ts +9 -0
- package/dist/toolbar/breakpoint-control.d.ts.map +1 -0
- package/dist/toolbar/breakpoint-control.js +23 -0
- package/dist/toolbar/editable-title.d.ts +14 -0
- package/dist/toolbar/editable-title.d.ts.map +1 -0
- package/dist/toolbar/editable-title.js +46 -0
- package/dist/toolbar/editable-title.test.d.ts +2 -0
- package/dist/toolbar/editable-title.test.d.ts.map +1 -0
- package/dist/toolbar/editable-title.test.js +53 -0
- package/dist/toolbar/index.d.ts +12 -0
- package/dist/toolbar/index.d.ts.map +1 -0
- package/dist/toolbar/index.js +5 -0
- package/dist/toolbar/locale-switcher.d.ts +10 -0
- package/dist/toolbar/locale-switcher.d.ts.map +1 -0
- package/dist/toolbar/locale-switcher.js +20 -0
- package/dist/toolbar/more-menu.d.ts +12 -0
- package/dist/toolbar/more-menu.d.ts.map +1 -0
- package/dist/toolbar/more-menu.js +47 -0
- package/dist/toolbar/panel-toggles.d.ts +9 -0
- package/dist/toolbar/panel-toggles.d.ts.map +1 -0
- package/dist/toolbar/panel-toggles.js +19 -0
- package/dist/toolbar/publish-dialog.d.ts +18 -0
- package/dist/toolbar/publish-dialog.d.ts.map +1 -0
- package/dist/toolbar/publish-dialog.js +49 -0
- package/dist/toolbar/publish.test.d.ts +2 -0
- package/dist/toolbar/publish.test.d.ts.map +1 -0
- package/dist/toolbar/publish.test.js +258 -0
- package/dist/toolbar/sample-picker.d.ts +18 -0
- package/dist/toolbar/sample-picker.d.ts.map +1 -0
- package/dist/toolbar/sample-picker.js +72 -0
- package/dist/toolbar/sample-picker.test.d.ts +2 -0
- package/dist/toolbar/sample-picker.test.d.ts.map +1 -0
- package/dist/toolbar/sample-picker.test.js +78 -0
- package/dist/toolbar/save-indicator.d.ts +8 -0
- package/dist/toolbar/save-indicator.d.ts.map +1 -0
- package/dist/toolbar/save-indicator.js +30 -0
- package/dist/toolbar/theme.d.ts +22 -0
- package/dist/toolbar/theme.d.ts.map +1 -0
- package/dist/toolbar/theme.js +46 -0
- package/dist/toolbar/theme.test.d.ts +2 -0
- package/dist/toolbar/theme.test.d.ts.map +1 -0
- package/dist/toolbar/theme.test.js +49 -0
- package/dist/toolbar/toolbar-centre.d.ts +13 -0
- package/dist/toolbar/toolbar-centre.d.ts.map +1 -0
- package/dist/toolbar/toolbar-centre.js +7 -0
- package/dist/toolbar/toolbar-left.d.ts +12 -0
- package/dist/toolbar/toolbar-left.d.ts.map +1 -0
- package/dist/toolbar/toolbar-left.js +16 -0
- package/dist/toolbar/toolbar-right.d.ts +19 -0
- package/dist/toolbar/toolbar-right.d.ts.map +1 -0
- package/dist/toolbar/toolbar-right.js +21 -0
- package/dist/toolbar/toolbar.d.ts +38 -0
- package/dist/toolbar/toolbar.d.ts.map +1 -0
- package/dist/toolbar/toolbar.js +27 -0
- package/dist/toolbar/toolbar.test.d.ts +2 -0
- package/dist/toolbar/toolbar.test.d.ts.map +1 -0
- package/dist/toolbar/toolbar.test.js +289 -0
- package/dist/toolbar/use-overflow-level.d.ts +9 -0
- package/dist/toolbar/use-overflow-level.d.ts.map +1 -0
- package/dist/toolbar/use-overflow-level.js +40 -0
- package/dist/toolbar/zoom-menu.d.ts +10 -0
- package/dist/toolbar/zoom-menu.d.ts.map +1 -0
- package/dist/toolbar/zoom-menu.js +17 -0
- package/dist/ui/icon.d.ts +102 -0
- package/dist/ui/icon.d.ts.map +1 -0
- package/dist/ui/icon.js +182 -0
- package/dist/ui/icon.test.d.ts +2 -0
- package/dist/ui/icon.test.d.ts.map +1 -0
- package/dist/ui/icon.test.js +115 -0
- package/dist/ui/index.d.ts +11 -0
- package/dist/ui/index.d.ts.map +1 -0
- package/dist/ui/index.js +5 -0
- package/dist/ui/panel.d.ts +18 -0
- package/dist/ui/panel.d.ts.map +1 -0
- package/dist/ui/panel.js +21 -0
- package/dist/ui/portal.d.ts +14 -0
- package/dist/ui/portal.d.ts.map +1 -0
- package/dist/ui/portal.js +14 -0
- package/dist/ui/primitives.d.ts +190 -0
- package/dist/ui/primitives.d.ts.map +1 -0
- package/dist/ui/primitives.js +164 -0
- package/dist/ui/primitives.test.d.ts +2 -0
- package/dist/ui/primitives.test.d.ts.map +1 -0
- package/dist/ui/primitives.test.js +215 -0
- package/dist/ui/toast.d.ts +39 -0
- package/dist/ui/toast.d.ts.map +1 -0
- package/dist/ui/toast.js +76 -0
- package/dist/ui/toast.test.d.ts +2 -0
- package/dist/ui/toast.test.d.ts.map +1 -0
- package/dist/ui/toast.test.js +95 -0
- package/package.json +66 -3
- package/README.md +0 -3
|
@@ -0,0 +1,428 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useCallback, useEffect, useId, useMemo, useRef, useState, } from 'react';
|
|
3
|
+
import { componentMeta, useManifest } from '../../app/manifest.js';
|
|
4
|
+
import { MoveToDialog, useDragAutoscroll, useDragAvailable, useDragPress, useDragState, useRegisterTree, } from '../../dnd/index.js';
|
|
5
|
+
import { useT } from '../../messages/index.js';
|
|
6
|
+
import { pathTo, useEditor, useEditorState } from '../../store/index.js';
|
|
7
|
+
import { ComponentIcon, ContextMenu, Icon, IconButton, Input, Tooltip, } from '../../ui/index.js';
|
|
8
|
+
import { flattenTree } from './flatten.js';
|
|
9
|
+
/** Every row is this tall, which is what lets the list render only the rows in view. */
|
|
10
|
+
export const ROW_HEIGHT = 28;
|
|
11
|
+
const OVERSCAN = 6;
|
|
12
|
+
/** Used until the list has been measured (and where nothing is laid out, as in tests). */
|
|
13
|
+
const FALLBACK_HEIGHT = 400;
|
|
14
|
+
/** Horizontal step per nesting level; CSS reads it as `--layer-indent`. */
|
|
15
|
+
const INDENT = 14;
|
|
16
|
+
/** The left padding of a row, before the indent; CSS reads it as `--layer-pad`. */
|
|
17
|
+
const PAD = 4;
|
|
18
|
+
/** The nodes that have an issue, from the last validation and accessibility run. */
|
|
19
|
+
function useIssueNodes() {
|
|
20
|
+
const validation = useEditorState((state) => state.validation);
|
|
21
|
+
return useMemo(() => {
|
|
22
|
+
const ids = new Set();
|
|
23
|
+
if (validation === undefined)
|
|
24
|
+
return ids;
|
|
25
|
+
for (const issue of validation.issues) {
|
|
26
|
+
const [head, id] = issue.path ?? [];
|
|
27
|
+
const named = issue.details?.['nodeId'];
|
|
28
|
+
if (head === 'nodes' && typeof id === 'string')
|
|
29
|
+
ids.add(id);
|
|
30
|
+
else if (typeof named === 'string')
|
|
31
|
+
ids.add(named);
|
|
32
|
+
}
|
|
33
|
+
for (const issue of validation.a11y)
|
|
34
|
+
ids.add(issue.nodeId);
|
|
35
|
+
return ids;
|
|
36
|
+
}, [validation]);
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* The document as a tree (docs/editor.md#layers): a WAI-ARIA tree that is fully operable with the
|
|
40
|
+
* keyboard, virtualized (only the rows in view exist), kept in step with the selection and hover in
|
|
41
|
+
* the store (the canvas and the tree show the same node), with rename, badges and a context menu.
|
|
42
|
+
* Focus stays on the tree and `aria-activedescendant` names the row; the selection follows it.
|
|
43
|
+
*/
|
|
44
|
+
export function LayersPanel({ wrapperType = 'buildr/box' }) {
|
|
45
|
+
const t = useT();
|
|
46
|
+
const store = useEditor();
|
|
47
|
+
const manifest = useManifest();
|
|
48
|
+
const treeId = useId();
|
|
49
|
+
const doc = useEditorState((state) => state.doc);
|
|
50
|
+
const selectedIds = useEditorState((state) => state.selectedIds);
|
|
51
|
+
const anchorId = useEditorState((state) => state.anchorId);
|
|
52
|
+
const hoveredId = useEditorState((state) => state.hoveredId);
|
|
53
|
+
const readOnly = useEditorState((state) => state.readOnly);
|
|
54
|
+
const issueNodes = useIssueNodes();
|
|
55
|
+
const [expanded, setExpanded] = useState(() => new Set([doc.root]));
|
|
56
|
+
const [renaming, setRenaming] = useState(null);
|
|
57
|
+
const [menuTarget, setMenuTarget] = useState(null);
|
|
58
|
+
const [notice, setNotice] = useState('');
|
|
59
|
+
const [scrollTop, setScrollTop] = useState(0);
|
|
60
|
+
const [height, setHeight] = useState(FALLBACK_HEIGHT);
|
|
61
|
+
const scroller = useRef(null);
|
|
62
|
+
const reveal = useRef(null);
|
|
63
|
+
const [moving, setMoving] = useState(null);
|
|
64
|
+
const press = useDragPress();
|
|
65
|
+
const canDrag = useDragAvailable();
|
|
66
|
+
const drop = useDragState((state) => (state.over === 'tree' ? state.tree : null));
|
|
67
|
+
const dropTarget = useDragState((state) => (state.over === 'tree' ? state.target : null));
|
|
68
|
+
const rows = useMemo(() => flattenTree(doc, expanded), [doc, expanded]);
|
|
69
|
+
useRegisterTree(() => {
|
|
70
|
+
const element = scroller.current;
|
|
71
|
+
if (element === null)
|
|
72
|
+
return undefined;
|
|
73
|
+
const box = element.getBoundingClientRect();
|
|
74
|
+
return {
|
|
75
|
+
viewport: { left: box.left, top: box.top, width: box.width, height: box.height },
|
|
76
|
+
scrollTop: element.scrollTop,
|
|
77
|
+
rows,
|
|
78
|
+
rowHeight: ROW_HEIGHT,
|
|
79
|
+
};
|
|
80
|
+
});
|
|
81
|
+
useDragAutoscroll(scroller);
|
|
82
|
+
const selected = useMemo(() => new Set(selectedIds), [selectedIds]);
|
|
83
|
+
const rowIndex = useMemo(() => new Map(rows.map((row, i) => [row.id, i])), [rows]);
|
|
84
|
+
// --- windowing ---
|
|
85
|
+
useEffect(() => {
|
|
86
|
+
const element = scroller.current;
|
|
87
|
+
if (element === null)
|
|
88
|
+
return;
|
|
89
|
+
const measure = () => setHeight(element.clientHeight > 0 ? element.clientHeight : FALLBACK_HEIGHT);
|
|
90
|
+
measure();
|
|
91
|
+
const Observer = globalThis.ResizeObserver;
|
|
92
|
+
if (Observer === undefined)
|
|
93
|
+
return;
|
|
94
|
+
const observer = new Observer(measure);
|
|
95
|
+
observer.observe(element);
|
|
96
|
+
return () => observer.disconnect();
|
|
97
|
+
}, []);
|
|
98
|
+
const first = Math.max(0, Math.floor(scrollTop / ROW_HEIGHT) - OVERSCAN);
|
|
99
|
+
const last = Math.min(rows.length, Math.ceil((scrollTop + height) / ROW_HEIGHT) + OVERSCAN);
|
|
100
|
+
const visible = rows.slice(first, last);
|
|
101
|
+
const scrollToIndex = useCallback((index) => {
|
|
102
|
+
const element = scroller.current;
|
|
103
|
+
if (element === null)
|
|
104
|
+
return;
|
|
105
|
+
const top = index * ROW_HEIGHT;
|
|
106
|
+
const view = element.clientHeight > 0 ? element.clientHeight : FALLBACK_HEIGHT;
|
|
107
|
+
let next = element.scrollTop;
|
|
108
|
+
if (top < next)
|
|
109
|
+
next = top;
|
|
110
|
+
else if (top + ROW_HEIGHT > next + view)
|
|
111
|
+
next = top + ROW_HEIGHT - view;
|
|
112
|
+
if (next !== element.scrollTop)
|
|
113
|
+
element.scrollTop = next;
|
|
114
|
+
setScrollTop(next);
|
|
115
|
+
}, []);
|
|
116
|
+
// --- the selection shows in the tree: its ancestors open, and it scrolls into view ---
|
|
117
|
+
// Only a change of the selection reveals; an edit elsewhere must not move the list.
|
|
118
|
+
// biome-ignore lint/correctness/useExhaustiveDependencies: see above
|
|
119
|
+
useEffect(() => {
|
|
120
|
+
if (anchorId === null)
|
|
121
|
+
return;
|
|
122
|
+
reveal.current = anchorId;
|
|
123
|
+
const ancestors = pathTo(doc, anchorId).slice(0, -1);
|
|
124
|
+
if (ancestors.some((id) => !expanded.has(id))) {
|
|
125
|
+
setExpanded((current) => new Set([...current, ...ancestors]));
|
|
126
|
+
}
|
|
127
|
+
}, [anchorId]);
|
|
128
|
+
// `anchorId` is here so that a new selection is looked for even when the rows did not change.
|
|
129
|
+
// biome-ignore lint/correctness/useExhaustiveDependencies: see above
|
|
130
|
+
useEffect(() => {
|
|
131
|
+
const id = reveal.current;
|
|
132
|
+
if (id === null)
|
|
133
|
+
return;
|
|
134
|
+
const index = rowIndex.get(id);
|
|
135
|
+
if (index === undefined)
|
|
136
|
+
return;
|
|
137
|
+
reveal.current = null;
|
|
138
|
+
scrollToIndex(index);
|
|
139
|
+
}, [rowIndex, scrollToIndex, anchorId]);
|
|
140
|
+
// --- doing things ---
|
|
141
|
+
const run = useCallback((command, label) => {
|
|
142
|
+
const result = store.dispatch(command, label !== undefined ? { label } : undefined);
|
|
143
|
+
setNotice(result.ok ? '' : result.error.message);
|
|
144
|
+
}, [store]);
|
|
145
|
+
const toggle = useCallback((id, open) => {
|
|
146
|
+
setExpanded((current) => {
|
|
147
|
+
const next = new Set(current);
|
|
148
|
+
if (open ?? !next.has(id))
|
|
149
|
+
next.add(id);
|
|
150
|
+
else
|
|
151
|
+
next.delete(id);
|
|
152
|
+
return next;
|
|
153
|
+
});
|
|
154
|
+
}, []);
|
|
155
|
+
const startRename = (id) => {
|
|
156
|
+
if (!readOnly && id !== doc.root)
|
|
157
|
+
setRenaming(id);
|
|
158
|
+
};
|
|
159
|
+
const commitRename = (id, text) => {
|
|
160
|
+
setRenaming(null);
|
|
161
|
+
scroller.current?.focus();
|
|
162
|
+
const name = text.trim();
|
|
163
|
+
const current = doc.nodes[id]?.name ?? '';
|
|
164
|
+
if (name === current)
|
|
165
|
+
return;
|
|
166
|
+
run({ type: 'node.setAttr', payload: { id, key: 'name', value: name === '' ? null : name } });
|
|
167
|
+
};
|
|
168
|
+
const removable = (ids) => ids.filter((id) => id !== doc.root);
|
|
169
|
+
const remove = () => {
|
|
170
|
+
const ids = removable(selectedIds);
|
|
171
|
+
if (ids.length > 0)
|
|
172
|
+
run({ type: 'node.remove', payload: { ids } });
|
|
173
|
+
};
|
|
174
|
+
// --- keyboard ---
|
|
175
|
+
const activeIndex = anchorId === null ? -1 : (rowIndex.get(anchorId) ?? -1);
|
|
176
|
+
const goTo = (index, mode) => {
|
|
177
|
+
const row = rows[Math.max(0, Math.min(rows.length - 1, index))];
|
|
178
|
+
if (row === undefined)
|
|
179
|
+
return;
|
|
180
|
+
store.select(row.id, { mode });
|
|
181
|
+
scrollToIndex(rowIndex.get(row.id) ?? 0);
|
|
182
|
+
};
|
|
183
|
+
const onKeyDown = (event) => {
|
|
184
|
+
if (event.target !== event.currentTarget || event.ctrlKey || event.metaKey || event.altKey) {
|
|
185
|
+
return;
|
|
186
|
+
}
|
|
187
|
+
const row = activeIndex >= 0 ? rows[activeIndex] : undefined;
|
|
188
|
+
const mode = event.shiftKey ? 'add' : 'replace';
|
|
189
|
+
let handled = true;
|
|
190
|
+
switch (event.key) {
|
|
191
|
+
case 'ArrowDown':
|
|
192
|
+
goTo(activeIndex + 1, mode);
|
|
193
|
+
break;
|
|
194
|
+
case 'ArrowUp':
|
|
195
|
+
goTo(activeIndex < 0 ? 0 : activeIndex - 1, mode);
|
|
196
|
+
break;
|
|
197
|
+
case 'Home':
|
|
198
|
+
goTo(0, mode);
|
|
199
|
+
break;
|
|
200
|
+
case 'End':
|
|
201
|
+
goTo(rows.length - 1, mode);
|
|
202
|
+
break;
|
|
203
|
+
case 'ArrowRight':
|
|
204
|
+
if (row === undefined)
|
|
205
|
+
goTo(0, 'replace');
|
|
206
|
+
else if (row.hasChildren && !row.expanded)
|
|
207
|
+
toggle(row.id, true);
|
|
208
|
+
else if (row.hasChildren)
|
|
209
|
+
goTo(activeIndex + 1, 'replace');
|
|
210
|
+
break;
|
|
211
|
+
case 'ArrowLeft':
|
|
212
|
+
if (row === undefined)
|
|
213
|
+
break;
|
|
214
|
+
if (row.expanded)
|
|
215
|
+
toggle(row.id, false);
|
|
216
|
+
else if (row.parentId !== null) {
|
|
217
|
+
store.select(row.parentId);
|
|
218
|
+
scrollToIndex(rowIndex.get(row.parentId) ?? 0);
|
|
219
|
+
}
|
|
220
|
+
break;
|
|
221
|
+
case 'Enter':
|
|
222
|
+
case ' ':
|
|
223
|
+
if (row !== undefined)
|
|
224
|
+
store.select(row.id, { mode: 'replace' });
|
|
225
|
+
break;
|
|
226
|
+
case 'F2':
|
|
227
|
+
if (row !== undefined)
|
|
228
|
+
startRename(row.id);
|
|
229
|
+
break;
|
|
230
|
+
case 'Delete':
|
|
231
|
+
case 'Backspace':
|
|
232
|
+
if (!readOnly)
|
|
233
|
+
remove();
|
|
234
|
+
break;
|
|
235
|
+
default:
|
|
236
|
+
handled = false;
|
|
237
|
+
}
|
|
238
|
+
if (handled)
|
|
239
|
+
event.preventDefault();
|
|
240
|
+
};
|
|
241
|
+
// --- pointer ---
|
|
242
|
+
const rowOf = (event) => {
|
|
243
|
+
const element = event.target?.closest?.('[data-node-id]');
|
|
244
|
+
return element?.getAttribute('data-node-id') ?? undefined;
|
|
245
|
+
};
|
|
246
|
+
const onClick = (event) => {
|
|
247
|
+
const id = rowOf(event);
|
|
248
|
+
if (id === undefined)
|
|
249
|
+
return;
|
|
250
|
+
if (event.target.closest('[data-more]') !== null)
|
|
251
|
+
return;
|
|
252
|
+
if (event.target.closest('[data-toggle]') !== null)
|
|
253
|
+
return toggle(id);
|
|
254
|
+
const mode = event.shiftKey ? 'add' : event.ctrlKey || event.metaKey ? 'toggle' : 'replace';
|
|
255
|
+
store.select(id, { mode });
|
|
256
|
+
scroller.current?.focus();
|
|
257
|
+
};
|
|
258
|
+
const onPointerDown = (event) => {
|
|
259
|
+
if (press === undefined || readOnly || renaming !== null)
|
|
260
|
+
return;
|
|
261
|
+
const id = rowOf(event);
|
|
262
|
+
if (id === undefined || id === doc.root)
|
|
263
|
+
return;
|
|
264
|
+
if (event.target.closest('[data-toggle], [data-more]') !== null)
|
|
265
|
+
return;
|
|
266
|
+
const ids = selected.has(id) ? removable(selectedIds) : [id];
|
|
267
|
+
if (ids.length === 0)
|
|
268
|
+
return;
|
|
269
|
+
const node = doc.nodes[id];
|
|
270
|
+
const label = ids.length > 1
|
|
271
|
+
? `${ids.length} ${t('dnd.ghost.nodes')}`
|
|
272
|
+
: (node?.name ?? componentMeta(manifest, node?.type ?? '')?.label ?? node?.type ?? id);
|
|
273
|
+
press({ kind: 'nodes', ids }, label, event);
|
|
274
|
+
};
|
|
275
|
+
const onDoubleClick = (event) => {
|
|
276
|
+
const id = rowOf(event);
|
|
277
|
+
if (id !== undefined &&
|
|
278
|
+
event.target.closest('[data-toggle], [data-more]') === null) {
|
|
279
|
+
startRename(id);
|
|
280
|
+
}
|
|
281
|
+
};
|
|
282
|
+
const onPointerOver = (event) => {
|
|
283
|
+
const id = rowOf(event) ?? null;
|
|
284
|
+
if (id !== hoveredId)
|
|
285
|
+
store.setHovered(id);
|
|
286
|
+
};
|
|
287
|
+
const onContextMenu = (event) => {
|
|
288
|
+
const id = rowOf(event) ?? anchorId;
|
|
289
|
+
if (id === null)
|
|
290
|
+
return;
|
|
291
|
+
if (!selected.has(id))
|
|
292
|
+
store.select(id);
|
|
293
|
+
setMenuTarget(id);
|
|
294
|
+
};
|
|
295
|
+
// --- the menu ---
|
|
296
|
+
// The helpers below only close over `doc`, which is a dependency.
|
|
297
|
+
// biome-ignore lint/correctness/useExhaustiveDependencies: see above
|
|
298
|
+
const menu = useMemo(() => {
|
|
299
|
+
const target = menuTarget === null ? undefined : doc.nodes[menuTarget];
|
|
300
|
+
if (target === undefined || menuTarget === null)
|
|
301
|
+
return [];
|
|
302
|
+
const ids = removable(selectedIds.includes(menuTarget) ? selectedIds : [menuTarget]);
|
|
303
|
+
const isRoot = menuTarget === doc.root;
|
|
304
|
+
const canWrap = componentMeta(manifest, wrapperType) !== undefined;
|
|
305
|
+
const move = canDrag
|
|
306
|
+
? [
|
|
307
|
+
{
|
|
308
|
+
id: 'move',
|
|
309
|
+
label: t('dnd.moveTo'),
|
|
310
|
+
disabled: readOnly || ids.length === 0,
|
|
311
|
+
onSelect: () => setMoving(ids),
|
|
312
|
+
},
|
|
313
|
+
]
|
|
314
|
+
: [];
|
|
315
|
+
return [
|
|
316
|
+
{
|
|
317
|
+
id: 'rename',
|
|
318
|
+
label: t('layers.menu.rename'),
|
|
319
|
+
disabled: readOnly || isRoot,
|
|
320
|
+
onSelect: () => startRename(menuTarget),
|
|
321
|
+
},
|
|
322
|
+
{
|
|
323
|
+
id: 'duplicate',
|
|
324
|
+
label: t('layers.menu.duplicate'),
|
|
325
|
+
disabled: readOnly || ids.length === 0,
|
|
326
|
+
onSelect: () => run({ type: 'node.duplicate', payload: { ids } }),
|
|
327
|
+
},
|
|
328
|
+
{
|
|
329
|
+
id: 'wrap',
|
|
330
|
+
label: t('layers.menu.wrap'),
|
|
331
|
+
disabled: readOnly || ids.length === 0 || !canWrap,
|
|
332
|
+
onSelect: () => run({ type: 'node.wrap', payload: { ids, wrapper: { type: wrapperType } } }),
|
|
333
|
+
},
|
|
334
|
+
{
|
|
335
|
+
id: 'unwrap',
|
|
336
|
+
label: t('layers.menu.unwrap'),
|
|
337
|
+
disabled: readOnly || isRoot || target.slots === undefined,
|
|
338
|
+
onSelect: () => run({ type: 'node.unwrap', payload: { id: menuTarget } }),
|
|
339
|
+
},
|
|
340
|
+
...move,
|
|
341
|
+
{
|
|
342
|
+
id: 'delete',
|
|
343
|
+
label: t('layers.menu.delete'),
|
|
344
|
+
danger: true,
|
|
345
|
+
disabled: readOnly || ids.length === 0,
|
|
346
|
+
onSelect: () => run({ type: 'node.remove', payload: { ids } }),
|
|
347
|
+
},
|
|
348
|
+
];
|
|
349
|
+
// biome-ignore lint/correctness/useExhaustiveDependencies: startRename and removable read the same inputs
|
|
350
|
+
}, [menuTarget, doc, selectedIds, manifest, wrapperType, readOnly, canDrag, t, run]);
|
|
351
|
+
const activeRow = activeIndex >= 0 ? rows[activeIndex] : undefined;
|
|
352
|
+
const rowDomId = (id) => `${treeId}-${id}`;
|
|
353
|
+
return (_jsxs("div", { className: "bd-layers", style: {
|
|
354
|
+
'--layer-row': `${ROW_HEIGHT}px`,
|
|
355
|
+
'--layer-indent': `${INDENT}px`,
|
|
356
|
+
'--layer-pad': `${PAD}px`,
|
|
357
|
+
}, children: [_jsx(ContextMenu, { items: menu, label: t('layers.menu'), children: _jsx("div", { ref: scroller, role: "tree", "aria-label": t('layers.title'), "aria-multiselectable": "true", "aria-activedescendant": activeRow !== undefined && activeIndex >= first && activeIndex < last
|
|
358
|
+
? rowDomId(activeRow.id)
|
|
359
|
+
: undefined, tabIndex: 0, className: "bd-layers-scroll", onScroll: (event) => setScrollTop(event.currentTarget.scrollTop), onKeyDown: onKeyDown, onClick: onClick, onPointerDown: onPointerDown, onDoubleClick: onDoubleClick, onPointerOver: onPointerOver, onPointerLeave: () => store.setHovered(null), onContextMenu: onContextMenu, children: _jsx("div", { className: "bd-layers-list", style: { height: rows.length * ROW_HEIGHT }, children: visible.map((row, i) => (_jsx(Layer, { row: row, top: (first + i) * ROW_HEIGHT, domId: rowDomId(row.id), selected: selected.has(row.id), hovered: hoveredId === row.id, hasIssue: issueNodes.has(row.id), drop: drop !== null && rows[drop.rowIndex]?.id === row.id
|
|
360
|
+
? dropTarget === null
|
|
361
|
+
? 'denied'
|
|
362
|
+
: drop.position
|
|
363
|
+
: undefined, renaming: renaming === row.id, onRename: (text) => commitRename(row.id, text), onCancelRename: () => {
|
|
364
|
+
setRenaming(null);
|
|
365
|
+
scroller.current?.focus();
|
|
366
|
+
} }, row.id))) }) }) }), _jsx("p", { className: "bd-layers-notice", role: "status", children: notice }), canDrag ? (_jsx(MoveToDialog, { open: moving !== null, onOpenChange: (open) => {
|
|
367
|
+
if (!open)
|
|
368
|
+
setMoving(null);
|
|
369
|
+
}, ids: moving ?? [] })) : null] }));
|
|
370
|
+
}
|
|
371
|
+
function Layer({ row, top, domId, selected, hovered, hasIssue, drop, renaming, onRename, onCancelRename, }) {
|
|
372
|
+
const t = useT();
|
|
373
|
+
const manifest = useManifest();
|
|
374
|
+
const { node } = row;
|
|
375
|
+
const meta = componentMeta(manifest, node.type);
|
|
376
|
+
const label = node.name ?? meta?.label ?? node.type;
|
|
377
|
+
const badges = [];
|
|
378
|
+
if (node.lock !== undefined)
|
|
379
|
+
badges.push({ key: 'layers.badge.lock', icon: 'lock' });
|
|
380
|
+
if (node.visibleIf !== undefined)
|
|
381
|
+
badges.push({ key: 'layers.badge.visibleIf', icon: 'eye' });
|
|
382
|
+
const bp = node.styles?.bp;
|
|
383
|
+
if (bp !== undefined && Object.keys(bp).length > 0) {
|
|
384
|
+
badges.push({ key: 'layers.badge.breakpoints', icon: 'monitor-smartphone' });
|
|
385
|
+
}
|
|
386
|
+
if (hasIssue)
|
|
387
|
+
badges.push({ key: 'layers.badge.issues', icon: 'triangle-alert' });
|
|
388
|
+
return (_jsxs("div", { role: "treeitem", id: domId, "data-node-id": row.id, "aria-level": row.level, "aria-posinset": row.posInSet, "aria-setsize": row.setSize, "aria-selected": selected, "aria-expanded": row.hasChildren ? row.expanded : undefined, className: "bd-layer", "data-selected": selected, "data-hovered": hovered, "data-drop": drop, style: {
|
|
389
|
+
top,
|
|
390
|
+
height: ROW_HEIGHT,
|
|
391
|
+
paddingLeft: PAD + (row.level - 1) * INDENT,
|
|
392
|
+
'--layer-level': row.level - 1,
|
|
393
|
+
}, children: [_jsx("span", { className: "bd-layer-toggle", "data-toggle": true, "aria-hidden": "true", children: row.hasChildren ? _jsx(Icon, { name: row.expanded ? 'chevron-down' : 'chevron-right' }) : null }), _jsx("span", { className: "bd-layer-icon", "data-icon": meta?.icon, "aria-hidden": "true", children: _jsx(ComponentIcon, { meta: meta }) }), renaming ? (_jsx(RenameField, { initial: node.name ?? '', placeholder: meta?.label ?? node.type, onCommit: onRename, onCancel: onCancelRename })) : (_jsx("span", { className: "bd-layer-label", children: label })), row.slot !== 'default' ? _jsx("span", { className: "bd-layer-slot", children: row.slot }) : null, badges.map((badge) => (_jsx(Tooltip, { content: t(badge.key), children: _jsx("span", { className: "bd-layer-badge", role: "img", "aria-label": t(badge.key), children: _jsx(Icon, { name: badge.icon }) }) }, badge.key))), _jsx("span", { className: "bd-layer-more", "data-more": true, children: _jsx(IconButton, { icon: "ellipsis", label: t('layers.more'), tabIndex: -1, onClick: (event) => {
|
|
394
|
+
// The menu is the tree's own context menu: ask for it where the button is.
|
|
395
|
+
event.stopPropagation();
|
|
396
|
+
const box = event.currentTarget.getBoundingClientRect();
|
|
397
|
+
event.currentTarget.dispatchEvent(new MouseEvent('contextmenu', {
|
|
398
|
+
bubbles: true,
|
|
399
|
+
cancelable: true,
|
|
400
|
+
clientX: box.left,
|
|
401
|
+
clientY: box.bottom,
|
|
402
|
+
}));
|
|
403
|
+
} }) })] }));
|
|
404
|
+
}
|
|
405
|
+
/** The name field of a layer being renamed: it ends once, whether by Enter, Escape or leaving it. */
|
|
406
|
+
function RenameField({ initial, placeholder, onCommit, onCancel }) {
|
|
407
|
+
const t = useT();
|
|
408
|
+
const finished = useRef(false);
|
|
409
|
+
const finish = (end) => {
|
|
410
|
+
if (finished.current)
|
|
411
|
+
return;
|
|
412
|
+
finished.current = true;
|
|
413
|
+
end();
|
|
414
|
+
};
|
|
415
|
+
return (_jsx(Input, { className: "bd-layer-rename", "aria-label": t('layers.rename'), defaultValue: initial, placeholder: placeholder,
|
|
416
|
+
// biome-ignore lint/a11y/noAutofocus: the field opens because the person asked to rename
|
|
417
|
+
autoFocus: true, onKeyDown: (event) => {
|
|
418
|
+
event.stopPropagation();
|
|
419
|
+
const text = event.currentTarget.value;
|
|
420
|
+
if (event.key === 'Enter')
|
|
421
|
+
finish(() => onCommit(text));
|
|
422
|
+
else if (event.key === 'Escape')
|
|
423
|
+
finish(onCancel);
|
|
424
|
+
}, onBlur: (event) => {
|
|
425
|
+
const text = event.currentTarget.value;
|
|
426
|
+
finish(() => onCommit(text));
|
|
427
|
+
}, onClick: (event) => event.stopPropagation() }));
|
|
428
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"layers-panel.test.d.ts","sourceRoot":"","sources":["../../../src/panels/layers/layers-panel.test.tsx"],"names":[],"mappings":""}
|