@formicoidea/labre-core 0.41.0 → 0.42.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 +384 -0
- package/dist/_pkgs/affine-block-bookmark/bookmark-block.js +2 -2
- package/dist/_pkgs/affine-block-edgeless-text/edgeless-toolbar/config.js +7 -1
- package/dist/_pkgs/affine-block-embed/embed-figma-block/embed-figma-block.js +2 -1
- package/dist/_pkgs/affine-block-embed/embed-github-block/embed-github-block.js +2 -1
- package/dist/_pkgs/affine-block-embed/embed-iframe-block/consts.d.ts +2 -0
- package/dist/_pkgs/affine-block-embed/embed-iframe-block/consts.js +5 -0
- package/dist/_pkgs/affine-block-embed/embed-iframe-block/embed-iframe-block.d.ts +1 -0
- package/dist/_pkgs/affine-block-embed/embed-iframe-block/embed-iframe-block.js +30 -8
- package/dist/_pkgs/affine-block-embed/embed-iframe-block/utils.d.ts +8 -0
- package/dist/_pkgs/affine-block-embed/embed-iframe-block/utils.js +19 -0
- package/dist/_pkgs/affine-block-embed/embed-loom-block/embed-loom-block.js +2 -1
- package/dist/_pkgs/affine-block-embed/embed-youtube-block/embed-youtube-block.js +2 -1
- package/dist/_pkgs/affine-block-frame/frame-manager.js +1 -1
- package/dist/_pkgs/affine-block-frame/frame-tool.js +1 -1
- package/dist/_pkgs/affine-block-frame/frame-toolbar.js +6 -1
- package/dist/_pkgs/affine-block-list/list-keymap.js +7 -0
- package/dist/_pkgs/affine-block-note/note-keymap.js +7 -1
- package/dist/_pkgs/affine-block-paragraph/paragraph-keymap.js +7 -1
- package/dist/_pkgs/affine-block-root/commands/pivot-commands.js +1 -8
- package/dist/_pkgs/affine-block-root/commands/tag-commands.js +1 -8
- package/dist/_pkgs/affine-block-root/edgeless/edgeless-keyboard.d.ts +9 -0
- package/dist/_pkgs/affine-block-root/edgeless/edgeless-keyboard.js +51 -0
- package/dist/_pkgs/affine-block-root/edgeless/edgeless-root-block.d.ts +22 -0
- package/dist/_pkgs/affine-block-root/edgeless/edgeless-root-block.js +46 -0
- package/dist/_pkgs/affine-block-root/edgeless/utils/pinch-zoom.d.ts +21 -0
- package/dist/_pkgs/affine-block-root/edgeless/utils/pinch-zoom.js +24 -0
- package/dist/_pkgs/affine-block-root/edgeless/utils/query.js +8 -0
- package/dist/_pkgs/affine-block-root/keyboard/keymap.js +1 -16
- package/dist/_pkgs/affine-block-surface/element-model/index.d.ts +21 -3
- package/dist/_pkgs/affine-block-surface/element-model/index.js +14 -2
- package/dist/_pkgs/affine-block-surface/extensions/export-svg/command.d.ts +23 -0
- package/dist/_pkgs/affine-block-surface/extensions/export-svg/command.js +89 -0
- package/dist/_pkgs/affine-block-surface/extensions/export-svg/index.d.ts +7 -0
- package/dist/_pkgs/affine-block-surface/extensions/export-svg/index.js +5 -0
- package/dist/_pkgs/affine-block-surface/extensions/export-svg/render.d.ts +41 -0
- package/dist/_pkgs/affine-block-surface/extensions/export-svg/render.js +70 -0
- package/dist/_pkgs/affine-block-surface/extensions/export-svg/svg-context.d.ts +49 -0
- package/dist/_pkgs/affine-block-surface/extensions/export-svg/svg-context.js +257 -0
- package/dist/_pkgs/affine-block-surface/extensions/export-svg/tagged-path.d.ts +16 -0
- package/dist/_pkgs/affine-block-surface/extensions/export-svg/tagged-path.js +24 -0
- package/dist/_pkgs/affine-block-surface/extensions/export-svg/toolbar.d.ts +24 -0
- package/dist/_pkgs/affine-block-surface/extensions/export-svg/toolbar.js +66 -0
- package/dist/_pkgs/affine-block-surface/extensions/index.d.ts +4 -0
- package/dist/_pkgs/affine-block-surface/extensions/index.js +4 -0
- package/dist/_pkgs/affine-block-surface/extensions/interchange-import.d.ts +66 -4
- package/dist/_pkgs/affine-block-surface/extensions/interchange-import.js +241 -11
- package/dist/_pkgs/affine-block-surface/extensions/interchange.d.ts +18 -0
- package/dist/_pkgs/affine-block-surface/extensions/legend-toolbar.d.ts +81 -0
- package/dist/_pkgs/affine-block-surface/extensions/legend-toolbar.js +81 -0
- package/dist/_pkgs/affine-block-surface/extensions/legend.d.ts +136 -0
- package/dist/_pkgs/affine-block-surface/extensions/legend.js +439 -0
- package/dist/_pkgs/affine-block-surface/extensions/reading-widget.d.ts +17 -3
- package/dist/_pkgs/affine-block-surface/extensions/reading-widget.js +35 -13
- package/dist/_pkgs/affine-block-surface/extensions/reading.d.ts +61 -1
- package/dist/_pkgs/affine-block-surface/extensions/reading.js +85 -39
- package/dist/_pkgs/affine-block-surface/extensions/record-action.d.ts +66 -0
- package/dist/_pkgs/affine-block-surface/extensions/record-action.js +145 -0
- package/dist/_pkgs/affine-block-surface/extensions/validation.d.ts +253 -28
- package/dist/_pkgs/affine-block-surface/extensions/validation.js +489 -41
- package/dist/_pkgs/affine-block-surface/framework-background/background-view.d.ts +115 -0
- package/dist/_pkgs/affine-block-surface/framework-background/background-view.js +185 -0
- package/dist/_pkgs/affine-block-surface/framework-background/index.d.ts +1 -0
- package/dist/_pkgs/affine-block-surface/framework-background/index.js +1 -0
- package/dist/_pkgs/affine-block-surface/framework-background/labels.d.ts +16 -1
- package/dist/_pkgs/affine-block-surface/framework-background/labels.js +31 -21
- package/dist/_pkgs/affine-block-surface/framework-background/renderer.js +29 -5
- package/dist/_pkgs/affine-block-surface/framework-background/stacking.d.ts +6 -4
- package/dist/_pkgs/affine-block-surface/framework-background/stacking.js +56 -8
- package/dist/_pkgs/affine-block-surface/renderer/canvas-renderer.d.ts +12 -0
- package/dist/_pkgs/affine-block-surface/renderer/canvas-renderer.js +15 -0
- package/dist/_pkgs/affine-block-surface/view.js +8 -1
- package/dist/_pkgs/affine-block-surface-ref/configs/slash-menu.js +1 -1
- package/dist/_pkgs/affine-components/color-picker/button.d.ts +56 -1
- package/dist/_pkgs/affine-components/color-picker/button.js +168 -23
- package/dist/_pkgs/affine-components/color-picker/framework-palette.d.ts +106 -0
- package/dist/_pkgs/affine-components/color-picker/framework-palette.js +177 -0
- package/dist/_pkgs/affine-components/color-picker/index.d.ts +2 -0
- package/dist/_pkgs/affine-components/color-picker/index.js +2 -0
- package/dist/_pkgs/affine-components/color-picker/palette-carousel.d.ts +85 -0
- package/dist/_pkgs/affine-components/color-picker/palette-carousel.js +440 -0
- package/dist/_pkgs/affine-components/edgeless-shape-color-picker/color-picker.d.ts +31 -1
- package/dist/_pkgs/affine-components/edgeless-shape-color-picker/color-picker.js +189 -63
- package/dist/_pkgs/affine-components/resource/resource.js +29 -16
- package/dist/_pkgs/affine-components/translations.d.ts +8 -0
- package/dist/_pkgs/affine-components/translations.js +17 -0
- package/dist/_pkgs/affine-foundation/view.js +2 -1
- package/dist/_pkgs/affine-gfx-brush/element-renderer.js +2 -2
- package/dist/_pkgs/affine-gfx-brush/toolbar/configs/brush.js +6 -1
- package/dist/_pkgs/affine-gfx-brush/toolbar/configs/highlighter.js +6 -1
- package/dist/_pkgs/affine-gfx-connector/connector-manager.d.ts +9 -1
- package/dist/_pkgs/affine-gfx-connector/connector-manager.js +61 -0
- package/dist/_pkgs/affine-gfx-connector/element-renderer/connector-dom/index.d.ts +7 -1
- package/dist/_pkgs/affine-gfx-connector/element-renderer/connector-dom/index.js +87 -17
- package/dist/_pkgs/affine-gfx-connector/element-renderer/index.js +78 -17
- package/dist/_pkgs/affine-gfx-connector/element-renderer/utils.d.ts +24 -2
- package/dist/_pkgs/affine-gfx-connector/element-renderer/utils.js +31 -8
- package/dist/_pkgs/affine-gfx-connector/text/edgeless-connector-label-editor.d.ts +124 -3
- package/dist/_pkgs/affine-gfx-connector/text/edgeless-connector-label-editor.js +216 -54
- package/dist/_pkgs/affine-gfx-connector/text/text.d.ts +13 -4
- package/dist/_pkgs/affine-gfx-connector/text/text.js +13 -44
- package/dist/_pkgs/affine-gfx-connector/toolbar/config.d.ts +56 -0
- package/dist/_pkgs/affine-gfx-connector/toolbar/config.js +72 -4
- package/dist/_pkgs/affine-gfx-connector/toolbar/hollow-endpoint-icons.d.ts +8 -0
- package/dist/_pkgs/affine-gfx-connector/toolbar/hollow-endpoint-icons.js +118 -0
- package/dist/_pkgs/affine-gfx-connector/view/view.d.ts +37 -1
- package/dist/_pkgs/affine-gfx-connector/view/view.js +97 -8
- package/dist/_pkgs/affine-gfx-group/command/group-api.js +1 -1
- package/dist/_pkgs/affine-gfx-group/store.js +0 -2
- package/dist/_pkgs/affine-gfx-group/translations.d.ts +9 -10
- package/dist/_pkgs/affine-gfx-group/translations.js +9 -13
- package/dist/_pkgs/affine-gfx-mindmap/templates/index.js +1 -1
- package/dist/_pkgs/affine-gfx-mindmap/toolbar/basket-elements.js +1 -1
- package/dist/_pkgs/affine-gfx-mindmap/toolbar/utils/import-mindmap.js +2 -2
- package/dist/_pkgs/affine-gfx-mindmap/translations.d.ts +1 -1
- package/dist/_pkgs/affine-gfx-mindmap/translations.js +1 -1
- package/dist/_pkgs/affine-gfx-shape/element-renderer/highlighter.js +2 -2
- package/dist/_pkgs/affine-gfx-shape/overlay/polygon-drawing-overlay.d.ts +6 -0
- package/dist/_pkgs/affine-gfx-shape/overlay/polygon-drawing-overlay.js +30 -1
- package/dist/_pkgs/affine-gfx-shape/polygon-tool.d.ts +20 -1
- package/dist/_pkgs/affine-gfx-shape/polygon-tool.js +9 -1
- package/dist/_pkgs/affine-gfx-shape/toolbar/config.js +6 -1
- package/dist/_pkgs/affine-gfx-shape/toolbar/palette-color-action.js +11 -1
- package/dist/_pkgs/affine-gfx-template/builtin/other.js +1 -1
- package/dist/_pkgs/affine-gfx-template/snapshot-from-action.js +32 -119
- package/dist/_pkgs/affine-gfx-template/toolbar/template-type.d.ts +1 -1
- package/dist/_pkgs/affine-gfx-text/dblclick-add-edgeless-text.d.ts +13 -1
- package/dist/_pkgs/affine-gfx-text/dblclick-add-edgeless-text.js +19 -4
- package/dist/_pkgs/affine-gfx-text/edgeless-text-editor.d.ts +41 -0
- package/dist/_pkgs/affine-gfx-text/edgeless-text-editor.js +57 -2
- package/dist/_pkgs/affine-gfx-text/toolbar/actions.d.ts +8 -1
- package/dist/_pkgs/affine-gfx-text/toolbar/actions.js +12 -2
- package/dist/_pkgs/affine-gfx-text/translations.d.ts +1 -0
- package/dist/_pkgs/affine-gfx-text/translations.js +2 -1
- package/dist/_pkgs/affine-inline-preset/markdown.js +5 -1
- package/dist/_pkgs/affine-model/consts/connector.d.ts +28 -2
- package/dist/_pkgs/affine-model/consts/connector.js +26 -0
- package/dist/_pkgs/affine-model/elements/bpmn/pool.js +1 -1
- package/dist/_pkgs/affine-model/elements/brush/brush.js +1 -1
- package/dist/_pkgs/affine-model/elements/c4/board.js +1 -1
- package/dist/_pkgs/affine-model/elements/c4/boundary.js +1 -1
- package/dist/_pkgs/affine-model/elements/connector/connector.d.ts +135 -0
- package/dist/_pkgs/affine-model/elements/connector/connector.js +246 -5
- package/dist/_pkgs/affine-model/elements/connector/end-label.d.ts +83 -0
- package/dist/_pkgs/affine-model/elements/connector/end-label.js +119 -0
- package/dist/_pkgs/affine-model/elements/connector/index.d.ts +1 -0
- package/dist/_pkgs/affine-model/elements/connector/index.js +1 -0
- package/dist/_pkgs/affine-model/elements/context-map/context-map.js +1 -1
- package/dist/_pkgs/affine-model/elements/core-domain/core-domain.d.ts +28 -0
- package/dist/_pkgs/affine-model/elements/core-domain/core-domain.js +129 -2
- package/dist/_pkgs/affine-model/elements/cynefin/cynefin.d.ts +8 -0
- package/dist/_pkgs/affine-model/elements/cynefin/cynefin.js +45 -2
- package/dist/_pkgs/affine-model/elements/edgy/board.js +1 -1
- package/dist/_pkgs/affine-model/elements/edgy/facets.js +1 -1
- package/dist/_pkgs/affine-model/elements/estuarine/estuarine.d.ts +6 -0
- package/dist/_pkgs/affine-model/elements/estuarine/estuarine.js +36 -2
- package/dist/_pkgs/affine-model/elements/event-storming/event-storming.d.ts +18 -7
- package/dist/_pkgs/affine-model/elements/event-storming/event-storming.js +23 -8
- package/dist/_pkgs/affine-model/elements/framework-background/background.d.ts +16 -0
- package/dist/_pkgs/affine-model/elements/framework-background/background.js +18 -0
- package/dist/_pkgs/affine-model/elements/highlighter/highlighter.js +1 -1
- package/dist/_pkgs/affine-model/elements/index.d.ts +8 -0
- package/dist/_pkgs/affine-model/elements/index.js +1 -0
- package/dist/_pkgs/affine-model/elements/shape/shape.js +1 -1
- package/dist/_pkgs/affine-model/elements/text/text.js +1 -1
- package/dist/_pkgs/affine-model/elements/uml/band.d.ts +39 -0
- package/dist/_pkgs/affine-model/elements/uml/band.js +31 -0
- package/dist/_pkgs/affine-model/elements/uml/diagram.d.ts +158 -0
- package/dist/_pkgs/affine-model/elements/uml/diagram.js +229 -0
- package/dist/_pkgs/affine-model/elements/uml/fragment.d.ts +161 -0
- package/dist/_pkgs/affine-model/elements/uml/fragment.js +205 -0
- package/dist/_pkgs/affine-model/elements/uml/index.d.ts +8 -0
- package/dist/_pkgs/affine-model/elements/uml/index.js +8 -0
- package/dist/_pkgs/affine-model/elements/uml/lifeline.d.ts +77 -0
- package/dist/_pkgs/affine-model/elements/uml/lifeline.js +89 -0
- package/dist/_pkgs/affine-model/elements/uml/node.d.ts +142 -0
- package/dist/_pkgs/affine-model/elements/uml/node.js +190 -0
- package/dist/_pkgs/affine-model/elements/uml/partition.d.ts +106 -0
- package/dist/_pkgs/affine-model/elements/uml/partition.js +172 -0
- package/dist/_pkgs/affine-model/elements/uml/region.d.ts +75 -0
- package/dist/_pkgs/affine-model/elements/uml/region.js +150 -0
- package/dist/_pkgs/affine-model/elements/uml/subject.d.ts +37 -0
- package/dist/_pkgs/affine-model/elements/uml/subject.js +108 -0
- package/dist/_pkgs/affine-model/elements/wardley/wardley.js +1 -1
- package/dist/_pkgs/affine-shared/services/embed-iframe/embed-iframe-config.d.ts +1 -0
- package/dist/_pkgs/affine-shared/services/font-loader/config.d.ts +7 -0
- package/dist/_pkgs/affine-shared/services/font-loader/config.js +43 -0
- package/dist/_pkgs/affine-shared/services/pivot-materiality-publisher.js +1 -9
- package/dist/_pkgs/affine-shared/services/telemetry-service/document-damage-watcher.d.ts +53 -0
- package/dist/_pkgs/affine-shared/services/telemetry-service/document-damage-watcher.js +95 -0
- package/dist/_pkgs/affine-shared/services/telemetry-service/index.d.ts +1 -0
- package/dist/_pkgs/affine-shared/services/telemetry-service/index.js +1 -0
- package/dist/_pkgs/affine-shared/services/telemetry-service/lifecycle.d.ts +26 -1
- package/dist/_pkgs/affine-shared/services/telemetry-service/telemetry-service.d.ts +2 -2
- package/dist/_pkgs/affine-shared/services/toolbar-service/command-action.d.ts +34 -0
- package/dist/_pkgs/affine-shared/services/toolbar-service/command-action.js +63 -0
- package/dist/_pkgs/affine-shared/services/toolbar-service/index.d.ts +1 -0
- package/dist/_pkgs/affine-shared/services/toolbar-service/index.js +1 -0
- package/dist/_pkgs/affine-shared/services/translation-service/chrome.d.ts +77 -7
- package/dist/_pkgs/affine-shared/services/translation-service/chrome.js +97 -7
- package/dist/_pkgs/affine-shared/styles/index.d.ts +1 -0
- package/dist/_pkgs/affine-shared/styles/index.js +1 -0
- package/dist/_pkgs/affine-shared/styles/motion.d.ts +14 -0
- package/dist/_pkgs/affine-shared/styles/motion.js +38 -0
- package/dist/_pkgs/affine-shared/utils/event.d.ts +10 -0
- package/dist/_pkgs/affine-shared/utils/event.js +20 -0
- package/dist/_pkgs/affine-shared/utils/file/filesys.d.ts +16 -0
- package/dist/_pkgs/affine-shared/utils/file/filesys.js +25 -0
- package/dist/_pkgs/affine-shared/utils/index.d.ts +1 -0
- package/dist/_pkgs/affine-shared/utils/index.js +1 -0
- package/dist/_pkgs/affine-shared/utils/link-preview-refresh.d.ts +12 -0
- package/dist/_pkgs/affine-shared/utils/link-preview-refresh.js +13 -0
- package/dist/_pkgs/affine-widget-edgeless-toolbar/catalogue/artefact-catalogue-widget.d.ts +12 -4
- package/dist/_pkgs/affine-widget-edgeless-toolbar/catalogue/artefact-catalogue-widget.js +27 -4
- package/dist/_pkgs/affine-widget-edgeless-toolbar/create-popper.js +13 -0
- package/dist/_pkgs/affine-widget-edgeless-toolbar/index.d.ts +2 -0
- package/dist/_pkgs/affine-widget-edgeless-toolbar/index.js +2 -0
- package/dist/_pkgs/affine-widget-edgeless-toolbar/menu/command-menu.d.ts +80 -0
- package/dist/_pkgs/affine-widget-edgeless-toolbar/menu/command-menu.js +270 -81
- package/dist/_pkgs/affine-widget-edgeless-toolbar/menu/senior-menu-selection.d.ts +15 -0
- package/dist/_pkgs/affine-widget-edgeless-toolbar/menu/senior-menu-selection.js +15 -0
- package/dist/_pkgs/affine-widget-edgeless-toolbar/panel/font-weight-and-style-panel.js +8 -1
- package/dist/_pkgs/affine-widget-edgeless-toolbar/placement/artefact-ghost-overlay.d.ts +42 -0
- package/dist/_pkgs/affine-widget-edgeless-toolbar/placement/artefact-ghost-overlay.js +100 -0
- package/dist/_pkgs/affine-widget-edgeless-toolbar/placement/artefact-placement-tool.d.ts +100 -0
- package/dist/_pkgs/affine-widget-edgeless-toolbar/placement/artefact-placement-tool.js +274 -0
- package/dist/_pkgs/affine-widget-edgeless-toolbar/placement/index.d.ts +3 -0
- package/dist/_pkgs/affine-widget-edgeless-toolbar/placement/index.js +3 -0
- package/dist/_pkgs/affine-widget-edgeless-toolbar/placement/translate-created.d.ts +25 -0
- package/dist/_pkgs/affine-widget-edgeless-toolbar/placement/translate-created.js +67 -0
- package/dist/_pkgs/affine-widget-edgeless-toolbar/view.js +5 -0
- package/dist/_pkgs/global/gfx/xywh.js +7 -0
- package/dist/_pkgs/std/extension/command-registry.d.ts +158 -1
- package/dist/_pkgs/std/extension/command-registry.js +22 -0
- package/dist/_pkgs/std/gfx/index.d.ts +1 -1
- package/dist/_pkgs/std/gfx/interactivity/gfx-view-event-handler.d.ts +12 -0
- package/dist/_pkgs/std/gfx/interactivity/gfx-view-event-handler.js +20 -1
- package/dist/_pkgs/std/gfx/interactivity/manager.d.ts +10 -0
- package/dist/_pkgs/std/gfx/interactivity/manager.js +12 -0
- package/dist/_pkgs/std/gfx/model/surface/element-model.js +12 -7
- package/dist/_pkgs/std/gfx/model/surface/surface-model.d.ts +56 -0
- package/dist/_pkgs/std/gfx/model/surface/surface-model.js +84 -3
- package/dist/_pkgs/std/gfx/view/view.d.ts +11 -2
- package/dist/_pkgs/std/gfx/view/view.js +16 -2
- package/dist/commands.d.ts +6 -0
- package/dist/commands.js +8 -1
- package/dist/frameworks.d.ts +9 -0
- package/dist/frameworks.js +19 -0
- package/dist/translations.js +16 -0
- package/package.json +9 -4
- package/dist/_pkgs/affine-gfx-group/group-watcher.d.ts +0 -1
- package/dist/_pkgs/affine-gfx-group/group-watcher.js +0 -20
|
@@ -2,7 +2,7 @@ import { ViewExtensionProvider, } from '../affine-ext-loader/index.js';
|
|
|
2
2
|
import { BlockViewExtension, CommandExtension, FlavourExtension, } from '../std/index.js';
|
|
3
3
|
import { literal } from 'lit/static-html.js';
|
|
4
4
|
import { effects } from './effects.js';
|
|
5
|
-
import { auditCommands, EdgelessCRUDExtension, EdgelessLegacySlotExtension, EditPropsMiddlewareBuilder, mapQualityCommands, mapQualityWidget, ReadingManager, readingProposalWidget, readingToolbarExtension, SpotlightManager, ValidationManager, validationExceptionToolbarExtension, ValidationOverlay, violationDetailWidget, } from './extensions/index.js';
|
|
5
|
+
import { auditCommands, EdgelessCRUDExtension, EdgelessLegacySlotExtension, EditPropsMiddlewareBuilder, exportSvgCommands, exportSvgToolbarExtension, mapQualityCommands, mapQualityWidget, ReadingManager, readingProposalWidget, readingToolbarExtension, SpotlightManager, ValidationManager, validationExceptionToolbarExtension, ValidationOverlay, violationDetailWidget, } from './extensions/index.js';
|
|
6
6
|
import { ExportManagerExtension } from './extensions/export-manager/export-manager.js';
|
|
7
7
|
import { BackgroundStackingExtension } from './framework-background/stacking.js';
|
|
8
8
|
import { ElementHighlightOverlay } from './renderer/element-highlight-overlay.js';
|
|
@@ -65,6 +65,13 @@ export class SurfaceViewExtension extends ViewExtensionProvider {
|
|
|
65
65
|
// extension does.
|
|
66
66
|
context.register(mapQualityWidget);
|
|
67
67
|
context.register(CommandExtension(mapQualityCommands));
|
|
68
|
+
// "Export SVG" in the "⋮" of every framework board, and the one command
|
|
69
|
+
// behind it. Generic like the two above and registered on the same terms:
|
|
70
|
+
// a board is a `FrameworkBackgroundElementModel`, whatever framework drew
|
|
71
|
+
// it, so the picture it takes away needs no framework at all
|
|
72
|
+
// (`docs/adr/0025`). Nothing is offered until a board is selected.
|
|
73
|
+
context.register(CommandExtension(exportSvgCommands));
|
|
74
|
+
context.register(exportSvgToolbarExtension);
|
|
68
75
|
}
|
|
69
76
|
else {
|
|
70
77
|
context.register(BlockViewExtension('affine:surface', literal `affine-surface-void`));
|
|
@@ -83,7 +83,7 @@ const surfaceRefSlashMenuConfig = {
|
|
|
83
83
|
const rootX = x;
|
|
84
84
|
const rootY = centerVertical - rootH / 2;
|
|
85
85
|
// Translated HERE and once: the captions are document content the
|
|
86
|
-
// moment they land (ADR
|
|
86
|
+
// moment they land (ADR 0023), so the host's catalogue is asked at
|
|
87
87
|
// placement and never again.
|
|
88
88
|
const root = {
|
|
89
89
|
children: [],
|
|
@@ -1,20 +1,50 @@
|
|
|
1
1
|
import type { Color, ColorScheme, Palette } from '../../affine-model/index.js';
|
|
2
2
|
import type { BlockStdScope } from '../../std/index.js';
|
|
3
|
-
import { LitElement } from 'lit';
|
|
3
|
+
import { LitElement, type PropertyValues } from 'lit';
|
|
4
4
|
import type { EditorMenuButton } from '../toolbar/menu-button.js';
|
|
5
|
+
import type { PaletteGroup } from './framework-palette.js';
|
|
6
|
+
import { type PaletteCarouselDirection } from './palette-carousel.js';
|
|
5
7
|
import type { PickColorEvent } from './types.js';
|
|
6
8
|
type Type = 'normal' | 'custom';
|
|
7
9
|
declare const EdgelessColorPickerButton_base: typeof LitElement & import("../../global/utils/types.js").Constructor<import("../../global/lit/with-disposable.js").DisposableClass>;
|
|
8
10
|
export declare class EdgelessColorPickerButton extends EdgelessColorPickerButton_base {
|
|
9
11
|
#private;
|
|
12
|
+
static styles: import("lit").CSSResult;
|
|
10
13
|
switchToCustomTab: (e: MouseEvent) => void;
|
|
11
14
|
get colorWithoutAlpha(): string;
|
|
12
15
|
get customButtonStyle(): {
|
|
13
16
|
'--b': string;
|
|
14
17
|
'--c': string;
|
|
15
18
|
};
|
|
19
|
+
/**
|
|
20
|
+
* The page of {@link paletteGroups} currently on screen — the one the caller
|
|
21
|
+
* asked for until the user pages away from it, and never reset by a re-render
|
|
22
|
+
* (a toolbar rebuilds `paletteGroups` on every update, so reading the prop
|
|
23
|
+
* back would undo the click that moved the carousel).
|
|
24
|
+
*/
|
|
25
|
+
get groupIndex(): number;
|
|
26
|
+
/**
|
|
27
|
+
* The swatches on screen: the carousel's current page — unless there is no
|
|
28
|
+
* carousel. A single page means no framework offered hues, and then the
|
|
29
|
+
* caller's own {@link palettes} wins: that is how a Wardley node keeps its
|
|
30
|
+
* notation swatches when the Wardley flag is off, its node toolbar being
|
|
31
|
+
* always-on while its palette is not (`docs/adr/0009`).
|
|
32
|
+
*/
|
|
33
|
+
get activePalettes(): readonly Palette[];
|
|
34
|
+
/**
|
|
35
|
+
* "Custom" is measured against the UNION of the pages, not the one on screen:
|
|
36
|
+
* a Wardley blue is one of the offered swatches whichever page is showing,
|
|
37
|
+
* and paging to `Default` must not make the element look custom-coloured.
|
|
38
|
+
*/
|
|
16
39
|
get isCustomColor(): boolean;
|
|
17
40
|
get tabContentPadding(): string;
|
|
41
|
+
/**
|
|
42
|
+
* A NEW selection re-opens on ITS framework: the page the user paged to
|
|
43
|
+
* belongs to the element they were recolouring, not to the next one. Only a
|
|
44
|
+
* change of {@link activeGroupKey} clears it, so paging survives the
|
|
45
|
+
* re-render the click itself provokes.
|
|
46
|
+
*/
|
|
47
|
+
willUpdate(changed: PropertyValues): void;
|
|
18
48
|
firstUpdated(): void;
|
|
19
49
|
render(): import("lit-html").TemplateResult<1>;
|
|
20
50
|
accessor originalColor: Color;
|
|
@@ -25,6 +55,31 @@ export declare class EdgelessColorPickerButton extends EdgelessColorPickerButton
|
|
|
25
55
|
accessor label: string;
|
|
26
56
|
accessor menuButton: EditorMenuButton;
|
|
27
57
|
accessor palettes: Palette[];
|
|
58
|
+
/**
|
|
59
|
+
* The carousel's pages, base palette first (`docs/adr/0027`). Empty — every
|
|
60
|
+
* call site that has not opted in — falls back to {@link palettes} and draws
|
|
61
|
+
* no header, which is exactly the panel this component rendered before.
|
|
62
|
+
*/
|
|
63
|
+
accessor paletteGroups: readonly PaletteGroup[];
|
|
64
|
+
/** The page to open on: the framework of the selected element, usually. */
|
|
65
|
+
accessor activeGroupKey: string | undefined;
|
|
66
|
+
/**
|
|
67
|
+
* Component state only, never persisted: which page the user paged TO.
|
|
68
|
+
* `undefined` means "still on the one the caller asked for".
|
|
69
|
+
*/
|
|
70
|
+
accessor pickedGroupIndex: number | undefined;
|
|
71
|
+
/**
|
|
72
|
+
* View state, like {@link pickedGroupIndex}: whether the header's list of
|
|
73
|
+
* pages is showing IN PLACE of the swatch grid. Reset when the picker
|
|
74
|
+
* re-opens and when the selection changes, so it never greets a new element.
|
|
75
|
+
*/
|
|
76
|
+
accessor paletteListOpen: boolean;
|
|
77
|
+
/**
|
|
78
|
+
* View state again: which way the page on screen arrived, so the swatches
|
|
79
|
+
* and the name slide in from the right side of the panel. Never persisted,
|
|
80
|
+
* and cleared with the rest when the selection changes.
|
|
81
|
+
*/
|
|
82
|
+
accessor pageDirection: PaletteCarouselDirection;
|
|
28
83
|
accessor pick: (event: PickColorEvent) => void;
|
|
29
84
|
/**
|
|
30
85
|
* Optional, forwarded to the nested `edgeless-color-panel` — see
|
|
@@ -40,6 +40,7 @@ import { choose } from 'lit/directives/choose.js';
|
|
|
40
40
|
import { ifDefined } from 'lit/directives/if-defined.js';
|
|
41
41
|
import { styleMap } from 'lit/directives/style-map.js';
|
|
42
42
|
import { when } from 'lit-html/directives/when.js';
|
|
43
|
+
import { paletteCarouselPage, paletteCarouselStyles, paletteCarouselWheel, renderPaletteCarousel, } from './palette-carousel.js';
|
|
43
44
|
import { calcCustomButtonStyle, keepColor, packColorsWith, preprocessColor, rgbaToHex8, } from './utils.js';
|
|
44
45
|
let EdgelessColorPickerButton = (() => {
|
|
45
46
|
let _classSuper = WithDisposable(LitElement);
|
|
@@ -67,6 +68,21 @@ let EdgelessColorPickerButton = (() => {
|
|
|
67
68
|
let _palettes_decorators;
|
|
68
69
|
let _palettes_initializers = [];
|
|
69
70
|
let _palettes_extraInitializers = [];
|
|
71
|
+
let _paletteGroups_decorators;
|
|
72
|
+
let _paletteGroups_initializers = [];
|
|
73
|
+
let _paletteGroups_extraInitializers = [];
|
|
74
|
+
let _activeGroupKey_decorators;
|
|
75
|
+
let _activeGroupKey_initializers = [];
|
|
76
|
+
let _activeGroupKey_extraInitializers = [];
|
|
77
|
+
let _pickedGroupIndex_decorators;
|
|
78
|
+
let _pickedGroupIndex_initializers = [];
|
|
79
|
+
let _pickedGroupIndex_extraInitializers = [];
|
|
80
|
+
let _paletteListOpen_decorators;
|
|
81
|
+
let _paletteListOpen_initializers = [];
|
|
82
|
+
let _paletteListOpen_extraInitializers = [];
|
|
83
|
+
let _pageDirection_decorators;
|
|
84
|
+
let _pageDirection_initializers = [];
|
|
85
|
+
let _pageDirection_extraInitializers = [];
|
|
70
86
|
let _pick_decorators;
|
|
71
87
|
let _pick_initializers = [];
|
|
72
88
|
let _pick_extraInitializers = [];
|
|
@@ -96,6 +112,11 @@ let EdgelessColorPickerButton = (() => {
|
|
|
96
112
|
_label_decorators = [property()];
|
|
97
113
|
_menuButton_decorators = [query('editor-menu-button')];
|
|
98
114
|
_palettes_decorators = [property({ attribute: false })];
|
|
115
|
+
_paletteGroups_decorators = [property({ attribute: false })];
|
|
116
|
+
_activeGroupKey_decorators = [property({ attribute: false })];
|
|
117
|
+
_pickedGroupIndex_decorators = [state()];
|
|
118
|
+
_paletteListOpen_decorators = [state()];
|
|
119
|
+
_pageDirection_decorators = [state()];
|
|
99
120
|
_pick_decorators = [property({ attribute: false })];
|
|
100
121
|
_std_decorators = [property({ attribute: false })];
|
|
101
122
|
_tabType_decorators = [state()];
|
|
@@ -110,6 +131,11 @@ let EdgelessColorPickerButton = (() => {
|
|
|
110
131
|
__esDecorate(this, null, _label_decorators, { kind: "accessor", name: "label", static: false, private: false, access: { has: obj => "label" in obj, get: obj => obj.label, set: (obj, value) => { obj.label = value; } }, metadata: _metadata }, _label_initializers, _label_extraInitializers);
|
|
111
132
|
__esDecorate(this, null, _menuButton_decorators, { kind: "accessor", name: "menuButton", static: false, private: false, access: { has: obj => "menuButton" in obj, get: obj => obj.menuButton, set: (obj, value) => { obj.menuButton = value; } }, metadata: _metadata }, _menuButton_initializers, _menuButton_extraInitializers);
|
|
112
133
|
__esDecorate(this, null, _palettes_decorators, { kind: "accessor", name: "palettes", static: false, private: false, access: { has: obj => "palettes" in obj, get: obj => obj.palettes, set: (obj, value) => { obj.palettes = value; } }, metadata: _metadata }, _palettes_initializers, _palettes_extraInitializers);
|
|
134
|
+
__esDecorate(this, null, _paletteGroups_decorators, { kind: "accessor", name: "paletteGroups", static: false, private: false, access: { has: obj => "paletteGroups" in obj, get: obj => obj.paletteGroups, set: (obj, value) => { obj.paletteGroups = value; } }, metadata: _metadata }, _paletteGroups_initializers, _paletteGroups_extraInitializers);
|
|
135
|
+
__esDecorate(this, null, _activeGroupKey_decorators, { kind: "accessor", name: "activeGroupKey", static: false, private: false, access: { has: obj => "activeGroupKey" in obj, get: obj => obj.activeGroupKey, set: (obj, value) => { obj.activeGroupKey = value; } }, metadata: _metadata }, _activeGroupKey_initializers, _activeGroupKey_extraInitializers);
|
|
136
|
+
__esDecorate(this, null, _pickedGroupIndex_decorators, { kind: "accessor", name: "pickedGroupIndex", static: false, private: false, access: { has: obj => "pickedGroupIndex" in obj, get: obj => obj.pickedGroupIndex, set: (obj, value) => { obj.pickedGroupIndex = value; } }, metadata: _metadata }, _pickedGroupIndex_initializers, _pickedGroupIndex_extraInitializers);
|
|
137
|
+
__esDecorate(this, null, _paletteListOpen_decorators, { kind: "accessor", name: "paletteListOpen", static: false, private: false, access: { has: obj => "paletteListOpen" in obj, get: obj => obj.paletteListOpen, set: (obj, value) => { obj.paletteListOpen = value; } }, metadata: _metadata }, _paletteListOpen_initializers, _paletteListOpen_extraInitializers);
|
|
138
|
+
__esDecorate(this, null, _pageDirection_decorators, { kind: "accessor", name: "pageDirection", static: false, private: false, access: { has: obj => "pageDirection" in obj, get: obj => obj.pageDirection, set: (obj, value) => { obj.pageDirection = value; } }, metadata: _metadata }, _pageDirection_initializers, _pageDirection_extraInitializers);
|
|
113
139
|
__esDecorate(this, null, _pick_decorators, { kind: "accessor", name: "pick", static: false, private: false, access: { has: obj => "pick" in obj, get: obj => obj.pick, set: (obj, value) => { obj.pick = value; } }, metadata: _metadata }, _pick_initializers, _pick_extraInitializers);
|
|
114
140
|
__esDecorate(this, null, _std_decorators, { kind: "accessor", name: "std", static: false, private: false, access: { has: obj => "std" in obj, get: obj => obj.std, set: (obj, value) => { obj.std = value; } }, metadata: _metadata }, _std_initializers, _std_extraInitializers);
|
|
115
141
|
__esDecorate(this, null, _tabType_decorators, { kind: "accessor", name: "tabType", static: false, private: false, access: { has: obj => "tabType" in obj, get: obj => obj.tabType, set: (obj, value) => { obj.tabType = value; } }, metadata: _metadata }, _tabType_initializers, _tabType_extraInitializers);
|
|
@@ -118,6 +144,7 @@ let EdgelessColorPickerButton = (() => {
|
|
|
118
144
|
__esDecorate(this, null, _enableCustomColor_decorators, { kind: "accessor", name: "enableCustomColor", static: false, private: false, access: { has: obj => "enableCustomColor" in obj, get: obj => obj.enableCustomColor, set: (obj, value) => { obj.enableCustomColor = value; } }, metadata: _metadata }, _enableCustomColor_initializers, _enableCustomColor_extraInitializers);
|
|
119
145
|
if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
120
146
|
}
|
|
147
|
+
static { this.styles = paletteCarouselStyles; }
|
|
121
148
|
#select;
|
|
122
149
|
get colorWithoutAlpha() {
|
|
123
150
|
return keepColor(this.color.startsWith('--')
|
|
@@ -130,8 +157,40 @@ let EdgelessColorPickerButton = (() => {
|
|
|
130
157
|
get customButtonStyle() {
|
|
131
158
|
return calcCustomButtonStyle(this.color, this.isCustomColor, this);
|
|
132
159
|
}
|
|
160
|
+
/**
|
|
161
|
+
* The page of {@link paletteGroups} currently on screen — the one the caller
|
|
162
|
+
* asked for until the user pages away from it, and never reset by a re-render
|
|
163
|
+
* (a toolbar rebuilds `paletteGroups` on every update, so reading the prop
|
|
164
|
+
* back would undo the click that moved the carousel).
|
|
165
|
+
*/
|
|
166
|
+
get groupIndex() {
|
|
167
|
+
if (this.pickedGroupIndex !== undefined)
|
|
168
|
+
return this.pickedGroupIndex;
|
|
169
|
+
const asked = this.paletteGroups.findIndex(group => group.key === this.activeGroupKey);
|
|
170
|
+
return asked < 0 ? 0 : asked;
|
|
171
|
+
}
|
|
172
|
+
/**
|
|
173
|
+
* The swatches on screen: the carousel's current page — unless there is no
|
|
174
|
+
* carousel. A single page means no framework offered hues, and then the
|
|
175
|
+
* caller's own {@link palettes} wins: that is how a Wardley node keeps its
|
|
176
|
+
* notation swatches when the Wardley flag is off, its node toolbar being
|
|
177
|
+
* always-on while its palette is not (`docs/adr/0009`).
|
|
178
|
+
*/
|
|
179
|
+
get activePalettes() {
|
|
180
|
+
if (this.paletteGroups.length < 2)
|
|
181
|
+
return this.palettes;
|
|
182
|
+
return this.paletteGroups[this.groupIndex]?.palettes ?? this.palettes;
|
|
183
|
+
}
|
|
184
|
+
/**
|
|
185
|
+
* "Custom" is measured against the UNION of the pages, not the one on screen:
|
|
186
|
+
* a Wardley blue is one of the offered swatches whichever page is showing,
|
|
187
|
+
* and paging to `Default` must not make the element look custom-coloured.
|
|
188
|
+
*/
|
|
133
189
|
get isCustomColor() {
|
|
134
|
-
|
|
190
|
+
const offered = this.paletteGroups.length > 1
|
|
191
|
+
? this.paletteGroups.flatMap(group => group.palettes)
|
|
192
|
+
: this.palettes;
|
|
193
|
+
return !offered
|
|
135
194
|
.map(({ value }) => resolveColor(value, this.theme))
|
|
136
195
|
.includes(this.color);
|
|
137
196
|
}
|
|
@@ -143,9 +202,26 @@ let EdgelessColorPickerButton = (() => {
|
|
|
143
202
|
this.pick?.({ type: 'pick', detail });
|
|
144
203
|
this.pick?.({ type: 'end' });
|
|
145
204
|
}
|
|
205
|
+
/**
|
|
206
|
+
* A NEW selection re-opens on ITS framework: the page the user paged to
|
|
207
|
+
* belongs to the element they were recolouring, not to the next one. Only a
|
|
208
|
+
* change of {@link activeGroupKey} clears it, so paging survives the
|
|
209
|
+
* re-render the click itself provokes.
|
|
210
|
+
*/
|
|
211
|
+
willUpdate(changed) {
|
|
212
|
+
if (changed.has('activeGroupKey')) {
|
|
213
|
+
this.pickedGroupIndex = undefined;
|
|
214
|
+
this.paletteListOpen = false;
|
|
215
|
+
this.pageDirection = 'settle';
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
/** Page, and remember which way it went, for the entry animation. */
|
|
219
|
+
#page;
|
|
146
220
|
firstUpdated() {
|
|
147
221
|
this.disposables.addFromEvent(this.menuButton, 'toggle', (e) => {
|
|
148
222
|
const opened = e.detail;
|
|
223
|
+
// A re-opened picker shows its swatches, never the list it was left on.
|
|
224
|
+
this.paletteListOpen = false;
|
|
149
225
|
if (!opened && this.tabType !== 'normal') {
|
|
150
226
|
this.tabType = 'normal';
|
|
151
227
|
}
|
|
@@ -177,29 +253,53 @@ let EdgelessColorPickerButton = (() => {
|
|
|
177
253
|
[
|
|
178
254
|
'normal',
|
|
179
255
|
() => html `
|
|
180
|
-
<div
|
|
256
|
+
<div
|
|
257
|
+
data-orientation="vertical"
|
|
258
|
+
@wheel=${paletteCarouselWheel({
|
|
259
|
+
groups: this.paletteGroups,
|
|
260
|
+
index: this.groupIndex,
|
|
261
|
+
onPage: this.#page,
|
|
262
|
+
open: this.paletteListOpen,
|
|
263
|
+
})}
|
|
264
|
+
>
|
|
181
265
|
<slot name="other"></slot>
|
|
182
266
|
<slot name="separator"></slot>
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
267
|
+
${renderPaletteCarousel({
|
|
268
|
+
groups: this.paletteGroups,
|
|
269
|
+
index: this.groupIndex,
|
|
270
|
+
onPage: this.#page,
|
|
271
|
+
onToggle: open => (this.paletteListOpen = open),
|
|
272
|
+
open: this.paletteListOpen,
|
|
273
|
+
direction: this.pageDirection,
|
|
274
|
+
std: this.std,
|
|
275
|
+
theme: this.theme,
|
|
276
|
+
})}
|
|
277
|
+
${when(!this.paletteListOpen, () => paletteCarouselPage({
|
|
278
|
+
groups: this.paletteGroups,
|
|
279
|
+
index: this.groupIndex,
|
|
280
|
+
direction: this.pageDirection,
|
|
281
|
+
}, html `
|
|
282
|
+
<edgeless-color-panel
|
|
283
|
+
role="listbox"
|
|
284
|
+
class=${ifDefined(this.colorPanelClass)}
|
|
285
|
+
.value=${this.color}
|
|
286
|
+
.theme=${this.theme}
|
|
287
|
+
.palettes=${this.activePalettes}
|
|
288
|
+
.hollowCircle=${this.hollowCircle}
|
|
289
|
+
.hasTransparent=${false}
|
|
290
|
+
.std=${this.std}
|
|
291
|
+
@select=${this.#select}
|
|
292
|
+
>
|
|
293
|
+
${when(this.enableCustomColor, () => html `
|
|
294
|
+
<edgeless-color-custom-button
|
|
295
|
+
slot="custom"
|
|
296
|
+
style=${styleMap(this.customButtonStyle)}
|
|
297
|
+
?active=${this.isCustomColor}
|
|
298
|
+
@click=${this.switchToCustomTab}
|
|
299
|
+
></edgeless-color-custom-button>
|
|
300
|
+
`)}
|
|
301
|
+
</edgeless-color-panel>
|
|
302
|
+
`))}
|
|
203
303
|
</div>
|
|
204
304
|
`,
|
|
205
305
|
],
|
|
@@ -246,6 +346,41 @@ let EdgelessColorPickerButton = (() => {
|
|
|
246
346
|
#palettes_accessor_storage;
|
|
247
347
|
get palettes() { return this.#palettes_accessor_storage; }
|
|
248
348
|
set palettes(value) { this.#palettes_accessor_storage = value; }
|
|
349
|
+
#paletteGroups_accessor_storage;
|
|
350
|
+
/**
|
|
351
|
+
* The carousel's pages, base palette first (`docs/adr/0027`). Empty — every
|
|
352
|
+
* call site that has not opted in — falls back to {@link palettes} and draws
|
|
353
|
+
* no header, which is exactly the panel this component rendered before.
|
|
354
|
+
*/
|
|
355
|
+
get paletteGroups() { return this.#paletteGroups_accessor_storage; }
|
|
356
|
+
set paletteGroups(value) { this.#paletteGroups_accessor_storage = value; }
|
|
357
|
+
#activeGroupKey_accessor_storage;
|
|
358
|
+
/** The page to open on: the framework of the selected element, usually. */
|
|
359
|
+
get activeGroupKey() { return this.#activeGroupKey_accessor_storage; }
|
|
360
|
+
set activeGroupKey(value) { this.#activeGroupKey_accessor_storage = value; }
|
|
361
|
+
#pickedGroupIndex_accessor_storage;
|
|
362
|
+
/**
|
|
363
|
+
* Component state only, never persisted: which page the user paged TO.
|
|
364
|
+
* `undefined` means "still on the one the caller asked for".
|
|
365
|
+
*/
|
|
366
|
+
get pickedGroupIndex() { return this.#pickedGroupIndex_accessor_storage; }
|
|
367
|
+
set pickedGroupIndex(value) { this.#pickedGroupIndex_accessor_storage = value; }
|
|
368
|
+
#paletteListOpen_accessor_storage;
|
|
369
|
+
/**
|
|
370
|
+
* View state, like {@link pickedGroupIndex}: whether the header's list of
|
|
371
|
+
* pages is showing IN PLACE of the swatch grid. Reset when the picker
|
|
372
|
+
* re-opens and when the selection changes, so it never greets a new element.
|
|
373
|
+
*/
|
|
374
|
+
get paletteListOpen() { return this.#paletteListOpen_accessor_storage; }
|
|
375
|
+
set paletteListOpen(value) { this.#paletteListOpen_accessor_storage = value; }
|
|
376
|
+
#pageDirection_accessor_storage;
|
|
377
|
+
/**
|
|
378
|
+
* View state again: which way the page on screen arrived, so the swatches
|
|
379
|
+
* and the name slide in from the right side of the panel. Never persisted,
|
|
380
|
+
* and cleared with the rest when the selection changes.
|
|
381
|
+
*/
|
|
382
|
+
get pageDirection() { return this.#pageDirection_accessor_storage; }
|
|
383
|
+
set pageDirection(value) { this.#pageDirection_accessor_storage = value; }
|
|
249
384
|
#pick_accessor_storage;
|
|
250
385
|
get pick() { return this.#pick_accessor_storage; }
|
|
251
386
|
set pick(value) { this.#pick_accessor_storage = value; }
|
|
@@ -280,6 +415,11 @@ let EdgelessColorPickerButton = (() => {
|
|
|
280
415
|
// refresh menu's position
|
|
281
416
|
this.menuButton.show(true);
|
|
282
417
|
};
|
|
418
|
+
/** Page, and remember which way it went, for the entry animation. */
|
|
419
|
+
this.#page = (index, direction) => {
|
|
420
|
+
this.pickedGroupIndex = index;
|
|
421
|
+
this.pageDirection = direction;
|
|
422
|
+
};
|
|
283
423
|
this.#originalColor_accessor_storage = __runInitializers(this, _originalColor_initializers, void 0);
|
|
284
424
|
this.#color_accessor_storage = (__runInitializers(this, _originalColor_extraInitializers), __runInitializers(this, _color_initializers, void 0));
|
|
285
425
|
this.#colorPanelClass_accessor_storage = (__runInitializers(this, _color_extraInitializers), __runInitializers(this, _colorPanelClass_initializers, undefined));
|
|
@@ -288,7 +428,12 @@ let EdgelessColorPickerButton = (() => {
|
|
|
288
428
|
this.#label_accessor_storage = (__runInitializers(this, _isText_extraInitializers), __runInitializers(this, _label_initializers, void 0));
|
|
289
429
|
this.#menuButton_accessor_storage = (__runInitializers(this, _label_extraInitializers), __runInitializers(this, _menuButton_initializers, void 0));
|
|
290
430
|
this.#palettes_accessor_storage = (__runInitializers(this, _menuButton_extraInitializers), __runInitializers(this, _palettes_initializers, DefaultTheme.Palettes));
|
|
291
|
-
this.#
|
|
431
|
+
this.#paletteGroups_accessor_storage = (__runInitializers(this, _palettes_extraInitializers), __runInitializers(this, _paletteGroups_initializers, []));
|
|
432
|
+
this.#activeGroupKey_accessor_storage = (__runInitializers(this, _paletteGroups_extraInitializers), __runInitializers(this, _activeGroupKey_initializers, undefined));
|
|
433
|
+
this.#pickedGroupIndex_accessor_storage = (__runInitializers(this, _activeGroupKey_extraInitializers), __runInitializers(this, _pickedGroupIndex_initializers, undefined));
|
|
434
|
+
this.#paletteListOpen_accessor_storage = (__runInitializers(this, _pickedGroupIndex_extraInitializers), __runInitializers(this, _paletteListOpen_initializers, false));
|
|
435
|
+
this.#pageDirection_accessor_storage = (__runInitializers(this, _paletteListOpen_extraInitializers), __runInitializers(this, _pageDirection_initializers, 'settle'));
|
|
436
|
+
this.#pick_accessor_storage = (__runInitializers(this, _pageDirection_extraInitializers), __runInitializers(this, _pick_initializers, void 0));
|
|
292
437
|
this.#std_accessor_storage = (__runInitializers(this, _pick_extraInitializers), __runInitializers(this, _std_initializers, undefined));
|
|
293
438
|
this.#tabType_accessor_storage = (__runInitializers(this, _std_extraInitializers), __runInitializers(this, _tabType_initializers, 'normal'));
|
|
294
439
|
this.#theme_accessor_storage = (__runInitializers(this, _tabType_extraInitializers), __runInitializers(this, _theme_initializers, void 0));
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The framework palettes a colour picker offers as a CAROUSEL, and the rule
|
|
3
|
+
* that decides which page it opens on (`docs/adr/0027`).
|
|
4
|
+
*
|
|
5
|
+
* Three pieces, in dependency order:
|
|
6
|
+
*
|
|
7
|
+
* 1. **The seam** — {@link FrameworkPaletteExtension}, registered from a
|
|
8
|
+
* framework's FLAG-GATED view extension. Offering hues is TOOLING, so a
|
|
9
|
+
* framework switched off disappears from the carousel while every colour it
|
|
10
|
+
* ever wrote stays exactly where it is (`docs/adr/0009`).
|
|
11
|
+
* 2. **The resolver** — {@link frameworkOfElement}: which framework a selected
|
|
12
|
+
* element belongs to, from what the document already says.
|
|
13
|
+
* 3. **The builder** — {@link frameworkPaletteGroups}: the carousel a toolbar
|
|
14
|
+
* hands the picker, base palette first and never hidden (DESIGN.md, "The
|
|
15
|
+
* Coexisting Palettes Rule").
|
|
16
|
+
*
|
|
17
|
+
* Nothing here is written to a document: a picked swatch is still a plain
|
|
18
|
+
* stored colour value, and `packages/affine/model` is untouched.
|
|
19
|
+
*/
|
|
20
|
+
import { type Palette } from '../../affine-model/index.js';
|
|
21
|
+
import { type ChromeWording } from '../../affine-shared/services/index.js';
|
|
22
|
+
import { type BlockStdScope, type FrameworkId } from '../../std/index.js';
|
|
23
|
+
import { type GfxController, type GfxModel } from '../../std/gfx/index.js';
|
|
24
|
+
import type { ExtensionType } from '../../store/index.js';
|
|
25
|
+
import type { NamedPalette } from './types.js';
|
|
26
|
+
/**
|
|
27
|
+
* A framework's contribution to the carousel: its own name and its own hues.
|
|
28
|
+
*
|
|
29
|
+
* `palettes` is the framework's existing `*_PALETTE_LIST` — the same array its
|
|
30
|
+
* node toolbar already seeds its picker with — so registering one is a
|
|
31
|
+
* one-liner in the view extension and no palette is restated.
|
|
32
|
+
*/
|
|
33
|
+
export type FrameworkPalette = {
|
|
34
|
+
framework: FrameworkId;
|
|
35
|
+
/** The framework's own name, as the carousel prints it. */
|
|
36
|
+
labelWording: ChromeWording;
|
|
37
|
+
palettes: NamedPalette[];
|
|
38
|
+
};
|
|
39
|
+
/**
|
|
40
|
+
* A framework registers its palette here, and nothing else registers one.
|
|
41
|
+
* Multi-instance, keyed by {@link FrameworkPalette.framework}, exactly like
|
|
42
|
+
* `TemplateCategoryIdentifier` (`gfx/template/src/contribute.ts`): two
|
|
43
|
+
* extensions claiming the same framework collide at set-up
|
|
44
|
+
* (`DuplicateServiceDefinitionError`) rather than showing the page twice.
|
|
45
|
+
*/
|
|
46
|
+
export declare const FrameworkPaletteIdentifier: import("../../global/di/types.js").ServiceIdentifier<FrameworkPalette> & (<U extends FrameworkPalette = FrameworkPalette>(variant: import("../../global/di/types.js").ServiceVariant) => import("../../global/di/types.js").ServiceIdentifier<U>);
|
|
47
|
+
/**
|
|
48
|
+
* Register a framework's palette. Call it from `setup()` of the FLAG-GATED
|
|
49
|
+
* view extension, beside the senior tool:
|
|
50
|
+
*
|
|
51
|
+
* ```ts
|
|
52
|
+
* context.register(FrameworkPaletteExtension(WARDLEY_FRAMEWORK_PALETTE));
|
|
53
|
+
* ```
|
|
54
|
+
*/
|
|
55
|
+
export declare function FrameworkPaletteExtension(...palettes: FrameworkPalette[]): ExtensionType;
|
|
56
|
+
/** One page of the carousel. */
|
|
57
|
+
export type PaletteGroup = {
|
|
58
|
+
/** {@link BASE_PALETTE_KEY} for the editor's own palette, else a `FrameworkId`. */
|
|
59
|
+
key: string;
|
|
60
|
+
/** Already resolved through the host's catalogue — ready to print. */
|
|
61
|
+
label: string;
|
|
62
|
+
palettes: readonly Palette[];
|
|
63
|
+
};
|
|
64
|
+
/** The whole carousel, plus the page it opens on. */
|
|
65
|
+
export type PaletteCarousel = {
|
|
66
|
+
groups: PaletteGroup[];
|
|
67
|
+
activeKey: string;
|
|
68
|
+
};
|
|
69
|
+
/** The key of the page that is never a framework's and never hidden. */
|
|
70
|
+
export declare const BASE_PALETTE_KEY = "default";
|
|
71
|
+
/**
|
|
72
|
+
* Which framework this element belongs to, read off the document.
|
|
73
|
+
*
|
|
74
|
+
* Three tiers, checked in order:
|
|
75
|
+
*
|
|
76
|
+
* 1. **Its own role's namespace.** A role id is `<framework>:<role>`, so a
|
|
77
|
+
* Wardley component says `wardley` and a Wardley map says it too — boards
|
|
78
|
+
* carry roles like everything else.
|
|
79
|
+
* 2. **For a connector, its ends.** A link is drawn between artefacts and
|
|
80
|
+
* belongs to what it links; a plain connector stamps no role of its own.
|
|
81
|
+
* Both ends must agree, otherwise the link crosses two notations and the
|
|
82
|
+
* board below gets the last word.
|
|
83
|
+
* 3. **The smallest board that contains it.** A native shape dropped on a
|
|
84
|
+
* Wardley map is being used as part of that map, whatever it stamps.
|
|
85
|
+
*
|
|
86
|
+
* `undefined` — a neutral element on the bare canvas — means "no framework",
|
|
87
|
+
* and the carousel then simply opens on the base palette.
|
|
88
|
+
*/
|
|
89
|
+
export declare function frameworkOfElement(gfx: GfxController, model: GfxModel): FrameworkId | undefined;
|
|
90
|
+
/**
|
|
91
|
+
* The framework a whole selection belongs to — the one they all share, or
|
|
92
|
+
* `undefined` as soon as two of them disagree. A picker serving a mixed
|
|
93
|
+
* selection has no framework of origin to open on, so it opens on the base
|
|
94
|
+
* palette, which is true of every element in it.
|
|
95
|
+
*/
|
|
96
|
+
export declare function frameworkOfSelection(gfx: GfxController, models: readonly GfxModel[]): FrameworkId | undefined;
|
|
97
|
+
/**
|
|
98
|
+
* The carousel a contextual toolbar hands its colour picker.
|
|
99
|
+
*
|
|
100
|
+
* The base palette is page one and is ALWAYS there (DESIGN.md, "The Coexisting
|
|
101
|
+
* Palettes Rule"); the frameworks whose tooling is on follow, in
|
|
102
|
+
* {@link FRAMEWORK_IDS} order so the pages read the same way on every board.
|
|
103
|
+
* `activeKey` is the framework of the selection when that framework is on the
|
|
104
|
+
* carousel, else the base palette.
|
|
105
|
+
*/
|
|
106
|
+
export declare function frameworkPaletteGroups(std: BlockStdScope, models: readonly GfxModel[], basePalettes: readonly Palette[]): PaletteCarousel;
|