@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,315 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
// @vitest-environment jsdom
|
|
3
|
+
import { createRegistryMeta, createSeededIdGenerator, p, s, toManifest, } from '@next-buildr/core';
|
|
4
|
+
import { act } from 'react';
|
|
5
|
+
import { createRoot } from 'react-dom/client';
|
|
6
|
+
import { afterEach, beforeEach, describe, expect, it } from 'vitest';
|
|
7
|
+
import { axe } from 'vitest-axe';
|
|
8
|
+
import * as matchers from 'vitest-axe/matchers';
|
|
9
|
+
import { ManifestProvider } from '../../app/manifest.js';
|
|
10
|
+
import { MessagesProvider } from '../../messages/index.js';
|
|
11
|
+
import { createEditorStore, EditorStoreProvider } from '../../store/index.js';
|
|
12
|
+
import { flattenTree } from './flatten.js';
|
|
13
|
+
import { LayersPanel } from './layers-panel.js';
|
|
14
|
+
expect.extend(matchers);
|
|
15
|
+
globalThis.IS_REACT_ACT_ENVIRONMENT = true;
|
|
16
|
+
const meta = (type, overrides = {}) => ({
|
|
17
|
+
type,
|
|
18
|
+
version: 1,
|
|
19
|
+
label: type.split('/')[1] ?? type,
|
|
20
|
+
category: 'content',
|
|
21
|
+
props: {},
|
|
22
|
+
contentCategories: ['flow'],
|
|
23
|
+
styles: { groups: [] },
|
|
24
|
+
runtime: 'shared',
|
|
25
|
+
...overrides,
|
|
26
|
+
});
|
|
27
|
+
const registry = createRegistryMeta({
|
|
28
|
+
components: [
|
|
29
|
+
meta('buildr/page', { capabilities: { root: true }, slots: { default: {} } }),
|
|
30
|
+
meta('buildr/box', { label: 'Box', icon: 'layout-grid', slots: { default: {} } }),
|
|
31
|
+
meta('buildr/text', { label: 'Text', props: { text: p.text({ default: '' }) } }),
|
|
32
|
+
],
|
|
33
|
+
});
|
|
34
|
+
const node = (id, type, extra = {}) => ({
|
|
35
|
+
id,
|
|
36
|
+
type,
|
|
37
|
+
...extra,
|
|
38
|
+
});
|
|
39
|
+
const fixture = () => ({
|
|
40
|
+
schemaVersion: 1,
|
|
41
|
+
root: 'root',
|
|
42
|
+
nodes: {
|
|
43
|
+
root: node('root', 'buildr/page', { slots: { default: ['boxNode001', 'boxNode002'] } }),
|
|
44
|
+
boxNode001: node('boxNode001', 'buildr/box', {
|
|
45
|
+
name: 'Hero',
|
|
46
|
+
slots: { default: ['textNodeA1', 'textNodeB1'] },
|
|
47
|
+
}),
|
|
48
|
+
boxNode002: node('boxNode002', 'buildr/box', { lock: { content: true } }),
|
|
49
|
+
textNodeA1: node('textNodeA1', 'buildr/text', { props: { text: s('A') } }),
|
|
50
|
+
textNodeB1: node('textNodeB1', 'buildr/text', { props: { text: s('B') } }),
|
|
51
|
+
},
|
|
52
|
+
components: {},
|
|
53
|
+
});
|
|
54
|
+
let container;
|
|
55
|
+
let root;
|
|
56
|
+
beforeEach(() => {
|
|
57
|
+
container = document.createElement('div');
|
|
58
|
+
document.body.append(container);
|
|
59
|
+
root = createRoot(container);
|
|
60
|
+
globalThis.ResizeObserver ??= class {
|
|
61
|
+
observe() { }
|
|
62
|
+
unobserve() { }
|
|
63
|
+
disconnect() { }
|
|
64
|
+
};
|
|
65
|
+
Element.prototype.scrollIntoView ??= () => { };
|
|
66
|
+
Element.prototype.hasPointerCapture ??= () => false;
|
|
67
|
+
});
|
|
68
|
+
afterEach(() => {
|
|
69
|
+
act(() => root.unmount());
|
|
70
|
+
document.body.innerHTML = '';
|
|
71
|
+
});
|
|
72
|
+
async function mount(doc = fixture()) {
|
|
73
|
+
const store = createEditorStore({
|
|
74
|
+
doc,
|
|
75
|
+
registry,
|
|
76
|
+
generateId: createSeededIdGenerator(9),
|
|
77
|
+
validationDelayMs: null,
|
|
78
|
+
});
|
|
79
|
+
await act(async () => root.render(_jsx(MessagesProvider, { locale: "en", children: _jsx(ManifestProvider, { manifest: toManifest(registry), children: _jsx(EditorStoreProvider, { store: store, children: _jsx(LayersPanel, {}) }) }) })));
|
|
80
|
+
return store;
|
|
81
|
+
}
|
|
82
|
+
const tree = () => container.querySelector('[role=tree]');
|
|
83
|
+
const items = () => [...container.querySelectorAll('[role=treeitem]')];
|
|
84
|
+
const labels = () => items().map((item) => item.querySelector('.bd-layer-label')?.textContent);
|
|
85
|
+
const press = (key, init = {}) => act(async () => {
|
|
86
|
+
tree().dispatchEvent(new KeyboardEvent('keydown', { key, bubbles: true, ...init }));
|
|
87
|
+
});
|
|
88
|
+
const pick = (store, id) => act(async () => store.select(id));
|
|
89
|
+
describe('flattenTree', () => {
|
|
90
|
+
it('lists the visible rows with their ARIA positions', () => {
|
|
91
|
+
const doc = fixture();
|
|
92
|
+
const collapsed = flattenTree(doc, new Set(['root']));
|
|
93
|
+
expect(collapsed.map((r) => [r.id, r.level, r.posInSet, r.setSize, r.expanded])).toEqual([
|
|
94
|
+
['root', 1, 1, 1, true],
|
|
95
|
+
['boxNode001', 2, 1, 2, false],
|
|
96
|
+
['boxNode002', 2, 2, 2, false],
|
|
97
|
+
]);
|
|
98
|
+
const open = flattenTree(doc, new Set(['root', 'boxNode001']));
|
|
99
|
+
expect(open.map((r) => r.id)).toEqual([
|
|
100
|
+
'root',
|
|
101
|
+
'boxNode001',
|
|
102
|
+
'textNodeA1',
|
|
103
|
+
'textNodeB1',
|
|
104
|
+
'boxNode002',
|
|
105
|
+
]);
|
|
106
|
+
expect(open[2]).toMatchObject({ level: 3, parentId: 'boxNode001', hasChildren: false });
|
|
107
|
+
});
|
|
108
|
+
it('does not loop on a document that reaches a node twice', () => {
|
|
109
|
+
const doc = fixture();
|
|
110
|
+
const cyclic = {
|
|
111
|
+
...doc,
|
|
112
|
+
nodes: {
|
|
113
|
+
...doc.nodes,
|
|
114
|
+
boxNode002: node('boxNode002', 'buildr/box', { slots: { default: ['root'] } }),
|
|
115
|
+
},
|
|
116
|
+
};
|
|
117
|
+
const rows = flattenTree(cyclic, new Set(['root', 'boxNode002']));
|
|
118
|
+
expect(rows.map((r) => r.id)).toEqual(['root', 'boxNode001', 'boxNode002']);
|
|
119
|
+
});
|
|
120
|
+
});
|
|
121
|
+
describe('LayersPanel', () => {
|
|
122
|
+
it('is an ARIA tree with names from the manifest and no accessibility violations', async () => {
|
|
123
|
+
await mount();
|
|
124
|
+
expect(tree().getAttribute('aria-label')).toBe('Layers');
|
|
125
|
+
expect(labels()).toEqual(['page', 'Hero', 'Box']);
|
|
126
|
+
const [, hero] = items();
|
|
127
|
+
expect(hero?.getAttribute('aria-level')).toBe('2');
|
|
128
|
+
expect(hero?.getAttribute('aria-posinset')).toBe('1');
|
|
129
|
+
expect(hero?.getAttribute('aria-setsize')).toBe('2');
|
|
130
|
+
expect(hero?.getAttribute('aria-expanded')).toBe('false');
|
|
131
|
+
expect(await axe(container)).toHaveNoViolations();
|
|
132
|
+
});
|
|
133
|
+
it('draws an svg icon per row: the named one, or the neutral box, never a letter', async () => {
|
|
134
|
+
await mount();
|
|
135
|
+
const icons = items().map((item) => item.querySelector('.bd-layer-icon svg'));
|
|
136
|
+
expect(icons.every((svg) => svg !== null)).toBe(true);
|
|
137
|
+
expect(icons.map((svg) => svg?.getAttribute('data-icon'))).toEqual([
|
|
138
|
+
'box',
|
|
139
|
+
'layout-grid',
|
|
140
|
+
'layout-grid',
|
|
141
|
+
]);
|
|
142
|
+
expect(icons[0]?.getAttribute('data-fallback')).toBe('true');
|
|
143
|
+
expect(icons[2]?.hasAttribute('data-fallback')).toBe(false);
|
|
144
|
+
expect(items().every((item) => item.querySelector('.bd-layer-icon')?.textContent === '')).toBe(true);
|
|
145
|
+
});
|
|
146
|
+
it('shows badges with accessible names', async () => {
|
|
147
|
+
await mount();
|
|
148
|
+
const [, , locked] = items();
|
|
149
|
+
expect(locked?.querySelector('[role=img]')?.getAttribute('aria-label')).toBe('Locked');
|
|
150
|
+
});
|
|
151
|
+
it('is operable with the keyboard alone', async () => {
|
|
152
|
+
const store = await mount();
|
|
153
|
+
await act(async () => tree().focus());
|
|
154
|
+
await press('ArrowDown');
|
|
155
|
+
expect(store.getState().selectedIds).toEqual(['root']);
|
|
156
|
+
await press('ArrowDown');
|
|
157
|
+
expect(store.getState().selectedIds).toEqual(['boxNode001']);
|
|
158
|
+
expect(tree().getAttribute('aria-activedescendant')).toBe(items().find((i) => i.dataset['nodeId'] === 'boxNode001')?.id);
|
|
159
|
+
await press('ArrowRight'); // expands
|
|
160
|
+
expect(labels()).toEqual(['page', 'Hero', 'Text', 'Text', 'Box']);
|
|
161
|
+
await press('ArrowRight'); // into the first child
|
|
162
|
+
expect(store.getState().selectedIds).toEqual(['textNodeA1']);
|
|
163
|
+
await press('ArrowLeft'); // out to the parent
|
|
164
|
+
expect(store.getState().selectedIds).toEqual(['boxNode001']);
|
|
165
|
+
await press('ArrowLeft'); // collapses
|
|
166
|
+
expect(labels()).toEqual(['page', 'Hero', 'Box']);
|
|
167
|
+
await press('End');
|
|
168
|
+
expect(store.getState().selectedIds).toEqual(['boxNode002']);
|
|
169
|
+
await press('Home');
|
|
170
|
+
expect(store.getState().selectedIds).toEqual(['root']);
|
|
171
|
+
await press('ArrowDown', { shiftKey: true });
|
|
172
|
+
expect(store.getState().selectedIds).toEqual(['root', 'boxNode001']);
|
|
173
|
+
});
|
|
174
|
+
it('renames with F2, and Escape leaves the name alone', async () => {
|
|
175
|
+
const store = await mount();
|
|
176
|
+
await pick(store, 'boxNode002');
|
|
177
|
+
await act(async () => tree().focus());
|
|
178
|
+
await press('F2');
|
|
179
|
+
const input = container.querySelector('input');
|
|
180
|
+
expect(input.getAttribute('aria-label')).toBe('Layer name');
|
|
181
|
+
await act(async () => {
|
|
182
|
+
input.value = 'Footer';
|
|
183
|
+
input.dispatchEvent(new KeyboardEvent('keydown', { key: 'Enter', bubbles: true }));
|
|
184
|
+
});
|
|
185
|
+
expect(store.getState().doc.nodes['boxNode002']?.name).toBe('Footer');
|
|
186
|
+
expect(store.getState().undoLabel).toBe('node.setAttr');
|
|
187
|
+
expect(container.querySelector('input')).toBeNull();
|
|
188
|
+
await press('F2');
|
|
189
|
+
await act(async () => {
|
|
190
|
+
const again = container.querySelector('input');
|
|
191
|
+
again.value = 'Nope';
|
|
192
|
+
again.dispatchEvent(new KeyboardEvent('keydown', { key: 'Escape', bubbles: true }));
|
|
193
|
+
});
|
|
194
|
+
expect(store.getState().doc.nodes['boxNode002']?.name).toBe('Footer');
|
|
195
|
+
});
|
|
196
|
+
it('deletes the selection with Delete, and reports what the rules refuse', async () => {
|
|
197
|
+
const store = await mount();
|
|
198
|
+
await pick(store, 'root');
|
|
199
|
+
await act(async () => tree().focus());
|
|
200
|
+
await press('Delete'); // the root is never removed: nothing happens
|
|
201
|
+
expect(store.getState().canUndo).toBe(false);
|
|
202
|
+
await pick(store, 'boxNode001');
|
|
203
|
+
await press('Delete');
|
|
204
|
+
expect(store.getState().doc.nodes['boxNode001']).toBeUndefined();
|
|
205
|
+
expect(labels()).toEqual(['page', 'Box']);
|
|
206
|
+
});
|
|
207
|
+
it('opens the ancestors of a node selected elsewhere, and marks it selected', async () => {
|
|
208
|
+
const store = await mount();
|
|
209
|
+
expect(labels()).toEqual(['page', 'Hero', 'Box']);
|
|
210
|
+
await act(async () => store.select('textNodeB1'));
|
|
211
|
+
expect(labels()).toEqual(['page', 'Hero', 'Text', 'Text', 'Box']);
|
|
212
|
+
const selected = items().filter((i) => i.getAttribute('aria-selected') === 'true');
|
|
213
|
+
expect(selected.map((i) => i.dataset['nodeId'])).toEqual(['textNodeB1']);
|
|
214
|
+
});
|
|
215
|
+
it('follows a click (with Ctrl adding), and hover goes both ways', async () => {
|
|
216
|
+
const store = await mount();
|
|
217
|
+
const row = (id) => items().find((i) => i.dataset['nodeId'] === id);
|
|
218
|
+
await act(async () => row('boxNode001').click());
|
|
219
|
+
expect(store.getState().selectedIds).toEqual(['boxNode001']);
|
|
220
|
+
await act(async () => {
|
|
221
|
+
row('boxNode002').dispatchEvent(new MouseEvent('click', { bubbles: true, ctrlKey: true }));
|
|
222
|
+
});
|
|
223
|
+
expect(store.getState().selectedIds).toEqual(['boxNode001', 'boxNode002']);
|
|
224
|
+
await act(async () => {
|
|
225
|
+
row('boxNode002').dispatchEvent(new PointerEvent('pointerover', { bubbles: true }));
|
|
226
|
+
});
|
|
227
|
+
expect(store.getState().hoveredId).toBe('boxNode002');
|
|
228
|
+
await act(async () => store.setHovered('boxNode001'));
|
|
229
|
+
expect(row('boxNode001').dataset['hovered']).toBe('true');
|
|
230
|
+
expect(row('boxNode002').dataset['hovered']).toBe('false');
|
|
231
|
+
});
|
|
232
|
+
it('toggles a row with its arrow, without selecting it', async () => {
|
|
233
|
+
const store = await mount();
|
|
234
|
+
const hero = items()[1];
|
|
235
|
+
await act(async () => hero.querySelector('[data-toggle]').click());
|
|
236
|
+
expect(labels()).toEqual(['page', 'Hero', 'Text', 'Text', 'Box']);
|
|
237
|
+
expect(store.getState().selectedIds).toEqual([]);
|
|
238
|
+
});
|
|
239
|
+
it('has a context menu: duplicate acts on the row the menu opened on', async () => {
|
|
240
|
+
const store = await mount();
|
|
241
|
+
const hero = items()[1];
|
|
242
|
+
await act(async () => {
|
|
243
|
+
hero.dispatchEvent(new MouseEvent('contextmenu', { bubbles: true, cancelable: true, clientX: 5, clientY: 5 }));
|
|
244
|
+
});
|
|
245
|
+
expect(store.getState().selectedIds).toEqual(['boxNode001']);
|
|
246
|
+
const menu = document.body.querySelector('[role=menu]');
|
|
247
|
+
expect(menu?.getAttribute('aria-label')).toBe('Layer actions');
|
|
248
|
+
const names = [...(menu?.querySelectorAll('[role=menuitem]') ?? [])].map((i) => i.textContent);
|
|
249
|
+
expect(names).toEqual(['Rename', 'Duplicate', 'Wrap in container', 'Unwrap', 'Delete']);
|
|
250
|
+
const duplicate = [...(menu?.querySelectorAll('[role=menuitem]') ?? [])].find((i) => i.textContent === 'Duplicate');
|
|
251
|
+
await act(async () => {
|
|
252
|
+
duplicate.click();
|
|
253
|
+
});
|
|
254
|
+
expect(store.getState().doc.nodes['root']?.slots?.['default']).toHaveLength(3);
|
|
255
|
+
});
|
|
256
|
+
it('opens the same context menu from the hover "more" button, without starting a rename', async () => {
|
|
257
|
+
const store = await mount();
|
|
258
|
+
const more = items()[1]?.querySelector('[data-more] button');
|
|
259
|
+
expect(more.getAttribute('aria-label')).toBe('More actions');
|
|
260
|
+
await act(async () => {
|
|
261
|
+
more.click();
|
|
262
|
+
});
|
|
263
|
+
expect(store.getState().selectedIds).toEqual(['boxNode001']);
|
|
264
|
+
const menu = document.body.querySelector('[role=menu]');
|
|
265
|
+
expect(menu?.getAttribute('aria-label')).toBe('Layer actions');
|
|
266
|
+
expect(container.querySelector('input')).toBeNull();
|
|
267
|
+
});
|
|
268
|
+
it('does not offer changes in a read-only document', async () => {
|
|
269
|
+
const store = await mount();
|
|
270
|
+
await act(async () => store.setReadOnly(true));
|
|
271
|
+
await pick(store, 'boxNode001');
|
|
272
|
+
await act(async () => tree().focus());
|
|
273
|
+
await press('Delete');
|
|
274
|
+
await press('F2');
|
|
275
|
+
expect(store.getState().doc.nodes['boxNode001']).toBeDefined();
|
|
276
|
+
expect(container.querySelector('input')).toBeNull();
|
|
277
|
+
});
|
|
278
|
+
});
|
|
279
|
+
describe('a large document', () => {
|
|
280
|
+
const big = () => {
|
|
281
|
+
const ids = Array.from({ length: 1000 }, (_, i) => `n${String(i).padStart(9, '0')}`);
|
|
282
|
+
const nodes = {
|
|
283
|
+
root: node('root', 'buildr/page', { slots: { default: ids } }),
|
|
284
|
+
};
|
|
285
|
+
for (const id of ids)
|
|
286
|
+
nodes[id] = node(id, 'buildr/text', { props: { text: s(id) } });
|
|
287
|
+
return { schemaVersion: 1, root: 'root', nodes, components: {} };
|
|
288
|
+
};
|
|
289
|
+
it('flattens 1000 nodes in well under 50 ms', () => {
|
|
290
|
+
const doc = big();
|
|
291
|
+
const open = new Set(['root']);
|
|
292
|
+
let best = Number.POSITIVE_INFINITY;
|
|
293
|
+
for (let i = 0; i < 5; i++) {
|
|
294
|
+
const start = performance.now();
|
|
295
|
+
expect(flattenTree(doc, open)).toHaveLength(1001);
|
|
296
|
+
best = Math.min(best, performance.now() - start);
|
|
297
|
+
}
|
|
298
|
+
expect(best).toBeLessThan(50);
|
|
299
|
+
});
|
|
300
|
+
it('renders only the rows in view, and renders them quickly', async () => {
|
|
301
|
+
const start = performance.now();
|
|
302
|
+
await mount(big());
|
|
303
|
+
const elapsed = performance.now() - start;
|
|
304
|
+
expect(items().length).toBeLessThan(40);
|
|
305
|
+
expect(elapsed).toBeLessThan(500);
|
|
306
|
+
const list = container.querySelector('.bd-layers-list');
|
|
307
|
+
expect(list.style.height).toBe(`${1001 * 28}px`);
|
|
308
|
+
});
|
|
309
|
+
it('scrolls the row of a far selection into view', async () => {
|
|
310
|
+
const store = await mount(big());
|
|
311
|
+
await act(async () => store.select('n000000900'));
|
|
312
|
+
const present = items().map((i) => i.dataset['nodeId']);
|
|
313
|
+
expect(present).toContain('n000000900');
|
|
314
|
+
});
|
|
315
|
+
});
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { type StoreApi } from 'zustand/vanilla';
|
|
2
|
+
import type { EditorStore } from '../store/index.ts';
|
|
3
|
+
import type { Clock, DocumentAdapter, DocumentRef, PersistenceState, PublishOutcome } from './types.ts';
|
|
4
|
+
/** How long to wait before retrying a failed save; the last delay repeats. */
|
|
5
|
+
export declare const RETRY_DELAYS_MS: readonly number[];
|
|
6
|
+
/** How often an idle, visible editor asks the backend whether somebody else saved. */
|
|
7
|
+
export declare const EXTERNAL_CHECK_INTERVAL_MS = 30000;
|
|
8
|
+
export declare const systemClock: Clock;
|
|
9
|
+
export interface PersistenceOptions {
|
|
10
|
+
readonly store: EditorStore;
|
|
11
|
+
readonly adapter: DocumentAdapter;
|
|
12
|
+
readonly ref: DocumentRef;
|
|
13
|
+
/** The revision the document was loaded at. */
|
|
14
|
+
readonly revision: number;
|
|
15
|
+
readonly debounceMs?: number;
|
|
16
|
+
readonly maxWaitMs?: number;
|
|
17
|
+
readonly clock?: Clock;
|
|
18
|
+
/** How often to look for saves made elsewhere (default 30 s; 0 turns it off). */
|
|
19
|
+
readonly externalCheckMs?: number;
|
|
20
|
+
/** Whether the tab is shown; nothing is polled while it is not (default: `document.visibilityState`). */
|
|
21
|
+
readonly isVisible?: () => boolean;
|
|
22
|
+
}
|
|
23
|
+
export interface PersistenceController {
|
|
24
|
+
readonly state: StoreApi<PersistenceState>;
|
|
25
|
+
/** Starts watching the store. Returns the function that stops it (timers cleared; no more saves). */
|
|
26
|
+
start(): () => void;
|
|
27
|
+
/** Saves now (Ctrl+S). Resolves when the save (and any that had to follow it) is over. */
|
|
28
|
+
saveNow(): Promise<void>;
|
|
29
|
+
/** After a conflict: takes the backend's document and drops the local changes. */
|
|
30
|
+
reload(): Promise<void>;
|
|
31
|
+
/** After a conflict: saves the local document over the backend's. */
|
|
32
|
+
overwrite(): Promise<void>;
|
|
33
|
+
/**
|
|
34
|
+
* Publishes the document: saves what is unsaved first, then asks the backend to publish that
|
|
35
|
+
* revision. Never rejects; what went wrong is in the outcome.
|
|
36
|
+
*/
|
|
37
|
+
publish(): Promise<PublishOutcome>;
|
|
38
|
+
/**
|
|
39
|
+
* Asks the backend for the current revision (`adapter.getRevision`) and, when somebody else saved,
|
|
40
|
+
* sets `state.external` (unchanged document) or moves to `conflict` (unsaved changes). Runs by
|
|
41
|
+
* itself every 30 s while the tab is visible; call it on window focus. Never rejects.
|
|
42
|
+
*/
|
|
43
|
+
checkExternal(): Promise<void>;
|
|
44
|
+
/** Whether closing the tab would lose something. */
|
|
45
|
+
hasUnsavedWork(): boolean;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* The autosave state machine (docs/state-management.md#autosave):
|
|
49
|
+
* `clean → dirty → saving → clean`, with `conflict` and `error` on the side. One save is in flight
|
|
50
|
+
* at a time; a change made while it runs is saved by the next one. Whether the document is dirty
|
|
51
|
+
* is read from the history (`cursorId` ≠ `savedCursorId`), so undoing back to the saved state is
|
|
52
|
+
* clean again.
|
|
53
|
+
*/
|
|
54
|
+
export declare function createPersistence(options: PersistenceOptions): PersistenceController;
|
|
55
|
+
//# sourceMappingURL=controller.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"controller.d.ts","sourceRoot":"","sources":["../../src/persistence/controller.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,KAAK,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAC7D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAErD,OAAO,KAAK,EACV,KAAK,EACL,eAAe,EACf,WAAW,EACX,gBAAgB,EAChB,cAAc,EAEf,MAAM,YAAY,CAAC;AAEpB,8EAA8E;AAC9E,eAAO,MAAM,eAAe,EAAE,SAAS,MAAM,EAAyB,CAAC;AAEvE,sFAAsF;AACtF,eAAO,MAAM,0BAA0B,QAAS,CAAC;AAEjD,eAAO,MAAM,WAAW,EAAE,KAIzB,CAAC;AAEF,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,KAAK,EAAE,WAAW,CAAC;IAC5B,QAAQ,CAAC,OAAO,EAAE,eAAe,CAAC;IAClC,QAAQ,CAAC,GAAG,EAAE,WAAW,CAAC;IAC1B,+CAA+C;IAC/C,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,KAAK,CAAC,EAAE,KAAK,CAAC;IACvB,iFAAiF;IACjF,QAAQ,CAAC,eAAe,CAAC,EAAE,MAAM,CAAC;IAClC,yGAAyG;IACzG,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,OAAO,CAAC;CACpC;AAED,MAAM,WAAW,qBAAqB;IACpC,QAAQ,CAAC,KAAK,EAAE,QAAQ,CAAC,gBAAgB,CAAC,CAAC;IAC3C,qGAAqG;IACrG,KAAK,IAAI,MAAM,IAAI,CAAC;IACpB,0FAA0F;IAC1F,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IACzB,kFAAkF;IAClF,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IACxB,qEAAqE;IACrE,SAAS,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IAC3B;;;OAGG;IACH,OAAO,IAAI,OAAO,CAAC,cAAc,CAAC,CAAC;IACnC;;;;OAIG;IACH,aAAa,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IAC/B,oDAAoD;IACpD,cAAc,IAAI,OAAO,CAAC;CAC3B;AAID;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,kBAAkB,GAAG,qBAAqB,CA4SpF"}
|