@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
|
@@ -40,13 +40,13 @@ import { SignalWatcher, WithDisposable } from '../../global/lit/index.js';
|
|
|
40
40
|
import { stdContext } from '../../std/index.js';
|
|
41
41
|
import { consume } from '@lit/context';
|
|
42
42
|
import { batch, signal } from '@preact/signals-core';
|
|
43
|
-
import { css, html, LitElement } from 'lit';
|
|
44
|
-
import { property, query } from 'lit/decorators.js';
|
|
43
|
+
import { css, html, LitElement, nothing } from 'lit';
|
|
44
|
+
import { property, query, state } from 'lit/decorators.js';
|
|
45
45
|
import { choose } from 'lit-html/directives/choose.js';
|
|
46
46
|
import { repeat } from 'lit-html/directives/repeat.js';
|
|
47
47
|
import { styleMap } from 'lit-html/directives/style-map.js';
|
|
48
48
|
import { when } from 'lit-html/directives/when.js';
|
|
49
|
-
import { calcCustomButtonStyle, keepColor, packColorsWith, preprocessColor, rgbaToHex8, } from '../color-picker/index.js';
|
|
49
|
+
import { calcCustomButtonStyle, keepColor, packColorsWith, paletteCarouselPage, paletteCarouselStyles, paletteCarouselWheel, preprocessColor, renderPaletteCarousel, rgbaToHex8, } from '../color-picker/index.js';
|
|
50
50
|
import { BORDER_COLOR_LABEL, COLOR_LABEL, FILL_COLOR_LABEL, } from '../translations.js';
|
|
51
51
|
let EdgelessShapeColorPicker = (() => {
|
|
52
52
|
let _classSuper = WithDisposable(SignalWatcher(LitElement));
|
|
@@ -59,6 +59,21 @@ let EdgelessShapeColorPicker = (() => {
|
|
|
59
59
|
let _palettes_decorators;
|
|
60
60
|
let _palettes_initializers = [];
|
|
61
61
|
let _palettes_extraInitializers = [];
|
|
62
|
+
let _paletteGroups_decorators;
|
|
63
|
+
let _paletteGroups_initializers = [];
|
|
64
|
+
let _paletteGroups_extraInitializers = [];
|
|
65
|
+
let _activeGroupKey_decorators;
|
|
66
|
+
let _activeGroupKey_initializers = [];
|
|
67
|
+
let _activeGroupKey_extraInitializers = [];
|
|
68
|
+
let _pickedGroupIndex_decorators;
|
|
69
|
+
let _pickedGroupIndex_initializers = [];
|
|
70
|
+
let _pickedGroupIndex_extraInitializers = [];
|
|
71
|
+
let _paletteListOpen_decorators;
|
|
72
|
+
let _paletteListOpen_initializers = [];
|
|
73
|
+
let _paletteListOpen_extraInitializers = [];
|
|
74
|
+
let _pageDirection_decorators;
|
|
75
|
+
let _pageDirection_initializers = [];
|
|
76
|
+
let _pageDirection_extraInitializers = [];
|
|
62
77
|
let _menuButton_decorators;
|
|
63
78
|
let _menuButton_initializers = [];
|
|
64
79
|
let _menuButton_extraInitializers = [];
|
|
@@ -68,10 +83,20 @@ let EdgelessShapeColorPicker = (() => {
|
|
|
68
83
|
_std_decorators = [consume({ context: stdContext })];
|
|
69
84
|
_payload_decorators = [property({ attribute: false })];
|
|
70
85
|
_palettes_decorators = [property({ attribute: false })];
|
|
86
|
+
_paletteGroups_decorators = [property({ attribute: false })];
|
|
87
|
+
_activeGroupKey_decorators = [property({ attribute: false })];
|
|
88
|
+
_pickedGroupIndex_decorators = [state()];
|
|
89
|
+
_paletteListOpen_decorators = [state()];
|
|
90
|
+
_pageDirection_decorators = [state()];
|
|
71
91
|
_menuButton_decorators = [query('editor-menu-button')];
|
|
72
92
|
__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);
|
|
73
93
|
__esDecorate(this, null, _payload_decorators, { kind: "accessor", name: "payload", static: false, private: false, access: { has: obj => "payload" in obj, get: obj => obj.payload, set: (obj, value) => { obj.payload = value; } }, metadata: _metadata }, _payload_initializers, _payload_extraInitializers);
|
|
74
94
|
__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);
|
|
95
|
+
__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);
|
|
96
|
+
__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);
|
|
97
|
+
__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);
|
|
98
|
+
__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);
|
|
99
|
+
__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);
|
|
75
100
|
__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);
|
|
76
101
|
if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
77
102
|
}
|
|
@@ -95,6 +120,8 @@ let EdgelessShapeColorPicker = (() => {
|
|
|
95
120
|
color: ${unsafeCSSVarV2('text/secondary')};
|
|
96
121
|
font-weight: 400;
|
|
97
122
|
}
|
|
123
|
+
|
|
124
|
+
${paletteCarouselStyles}
|
|
98
125
|
`; }
|
|
99
126
|
#pickFillColor;
|
|
100
127
|
#pickStrokeColor;
|
|
@@ -103,8 +130,41 @@ let EdgelessShapeColorPicker = (() => {
|
|
|
103
130
|
#calcCustomButtonStyle(color, isCustomColor) {
|
|
104
131
|
return calcCustomButtonStyle(color, isCustomColor, this);
|
|
105
132
|
}
|
|
133
|
+
/**
|
|
134
|
+
* The page of {@link paletteGroups} on screen — see the twin getter on
|
|
135
|
+
* `edgeless-color-picker-button` for why a click wins over the prop.
|
|
136
|
+
*/
|
|
137
|
+
get groupIndex() {
|
|
138
|
+
if (this.pickedGroupIndex !== undefined)
|
|
139
|
+
return this.pickedGroupIndex;
|
|
140
|
+
const asked = this.paletteGroups.findIndex(group => group.key === this.activeGroupKey);
|
|
141
|
+
return asked < 0 ? 0 : asked;
|
|
142
|
+
}
|
|
143
|
+
/** The page on screen, or the caller's own list when there is no carousel. */
|
|
144
|
+
get activePalettes() {
|
|
145
|
+
if (this.paletteGroups.length < 2)
|
|
146
|
+
return this.palettes;
|
|
147
|
+
return this.paletteGroups[this.groupIndex]?.palettes ?? this.palettes;
|
|
148
|
+
}
|
|
149
|
+
/**
|
|
150
|
+
* A new selection re-opens on ITS framework — see the twin on
|
|
151
|
+
* `edgeless-color-picker-button`.
|
|
152
|
+
*/
|
|
153
|
+
willUpdate(changed) {
|
|
154
|
+
if (changed.has('activeGroupKey')) {
|
|
155
|
+
this.pickedGroupIndex = undefined;
|
|
156
|
+
this.paletteListOpen = false;
|
|
157
|
+
this.pageDirection = 'settle';
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
/** Page, and remember which way it went — see the twin. */
|
|
161
|
+
#page;
|
|
162
|
+
/** Measured against the UNION of the pages, for the reason the twin states. */
|
|
106
163
|
#calcCustomButtonState(color, theme) {
|
|
107
|
-
|
|
164
|
+
const offered = this.paletteGroups.length > 1
|
|
165
|
+
? this.paletteGroups.flatMap(group => group.palettes)
|
|
166
|
+
: this.palettes;
|
|
167
|
+
return !offered
|
|
108
168
|
.map(({ value }) => resolveColor(value, theme))
|
|
109
169
|
.includes(color);
|
|
110
170
|
}
|
|
@@ -126,13 +186,15 @@ let EdgelessShapeColorPicker = (() => {
|
|
|
126
186
|
firstUpdated() {
|
|
127
187
|
this.disposables.addFromEvent(this.menuButton, 'toggle', (e) => {
|
|
128
188
|
const opened = e.detail;
|
|
189
|
+
// A re-opened picker shows its swatches, never the list it was left on.
|
|
190
|
+
this.paletteListOpen = false;
|
|
129
191
|
if (!opened && this.tabType$.peek() === 'custom') {
|
|
130
192
|
this.tabType$.value = 'normal';
|
|
131
193
|
}
|
|
132
194
|
});
|
|
133
195
|
}
|
|
134
196
|
render() {
|
|
135
|
-
const { tabType$: { value: tabType }, colorType$: { value: colorType },
|
|
197
|
+
const { tabType$: { value: tabType }, colorType$: { value: colorType }, activePalettes, fillColorWithoutAlpha, payload: { fillColor, strokeColor, strokeWidth, strokeStyle, originalFillColor, originalStrokeColor, theme, enableCustomColor, }, } = this;
|
|
136
198
|
return html `
|
|
137
199
|
<editor-menu-button
|
|
138
200
|
.contentPadding="${tabType === 'normal' ? '8px' : '0px'}"
|
|
@@ -152,69 +214,96 @@ let EdgelessShapeColorPicker = (() => {
|
|
|
152
214
|
</editor-icon-button>
|
|
153
215
|
`}
|
|
154
216
|
>
|
|
155
|
-
<div
|
|
217
|
+
<div
|
|
218
|
+
class="pickers"
|
|
219
|
+
data-orientation="vertical"
|
|
220
|
+
@wheel=${paletteCarouselWheel({
|
|
221
|
+
groups: this.paletteGroups,
|
|
222
|
+
index: this.groupIndex,
|
|
223
|
+
onPage: this.#page,
|
|
224
|
+
open: this.paletteListOpen,
|
|
225
|
+
})}
|
|
226
|
+
>
|
|
156
227
|
${choose(tabType, [
|
|
157
228
|
[
|
|
158
229
|
'normal',
|
|
159
230
|
() => {
|
|
160
231
|
return html `
|
|
161
|
-
${
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
},
|
|
171
|
-
{
|
|
172
|
-
label: this.std
|
|
173
|
-
? translateKey(this.std, ...BORDER_COLOR_LABEL)
|
|
174
|
-
: BORDER_COLOR_LABEL[1],
|
|
175
|
-
type: 'strokeColor',
|
|
176
|
-
value: strokeColor,
|
|
177
|
-
hollowCircle: true,
|
|
178
|
-
onPick: this.#pickStrokeColor,
|
|
179
|
-
},
|
|
180
|
-
], item => item.type, ({ label, type, value, onPick, hollowCircle }) => html `
|
|
181
|
-
<div class="picker-label">${label}</div>
|
|
182
|
-
<edgeless-color-panel
|
|
183
|
-
aria-label="${label}"
|
|
184
|
-
role="listbox"
|
|
185
|
-
.hasTransparent=${false}
|
|
186
|
-
.hollowCircle=${hollowCircle}
|
|
187
|
-
.value=${value}
|
|
188
|
-
.theme=${theme}
|
|
189
|
-
.palettes=${palettes}
|
|
190
|
-
.std=${this.std}
|
|
191
|
-
@select=${onPick}
|
|
192
|
-
>
|
|
193
|
-
${when(enableCustomColor, () => {
|
|
194
|
-
const isCustomColor = this.#calcCustomButtonState(value, theme);
|
|
195
|
-
const styleInfo = this.#calcCustomButtonStyle(value, isCustomColor);
|
|
196
|
-
return html `
|
|
197
|
-
<edgeless-color-custom-button
|
|
198
|
-
slot="custom"
|
|
199
|
-
style=${styleMap(styleInfo)}
|
|
200
|
-
?active=${isCustomColor}
|
|
201
|
-
@click=${() => this.#switchToCustomWith(type)}
|
|
202
|
-
></edgeless-color-custom-button>
|
|
203
|
-
`;
|
|
232
|
+
${renderPaletteCarousel({
|
|
233
|
+
groups: this.paletteGroups,
|
|
234
|
+
index: this.groupIndex,
|
|
235
|
+
onPage: this.#page,
|
|
236
|
+
onToggle: open => (this.paletteListOpen = open),
|
|
237
|
+
open: this.paletteListOpen,
|
|
238
|
+
direction: this.pageDirection,
|
|
239
|
+
std: this.std,
|
|
240
|
+
theme,
|
|
204
241
|
})}
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
242
|
+
${this.paletteListOpen
|
|
243
|
+
? nothing
|
|
244
|
+
: html `${repeat([
|
|
245
|
+
{
|
|
246
|
+
label: this.std
|
|
247
|
+
? translateKey(this.std, ...FILL_COLOR_LABEL)
|
|
248
|
+
: FILL_COLOR_LABEL[1],
|
|
249
|
+
type: 'fillColor',
|
|
250
|
+
value: fillColor,
|
|
251
|
+
hollowCircle: false,
|
|
252
|
+
onPick: this.#pickFillColor,
|
|
253
|
+
},
|
|
254
|
+
{
|
|
255
|
+
label: this.std
|
|
256
|
+
? translateKey(this.std, ...BORDER_COLOR_LABEL)
|
|
257
|
+
: BORDER_COLOR_LABEL[1],
|
|
258
|
+
type: 'strokeColor',
|
|
259
|
+
value: strokeColor,
|
|
260
|
+
hollowCircle: true,
|
|
261
|
+
onPick: this.#pickStrokeColor,
|
|
262
|
+
},
|
|
263
|
+
], item => item.type, ({ label, type, value, onPick, hollowCircle, }) => html `
|
|
264
|
+
<div class="picker-label">${label}</div>
|
|
265
|
+
${paletteCarouselPage({
|
|
266
|
+
groups: this.paletteGroups,
|
|
267
|
+
index: this.groupIndex,
|
|
268
|
+
direction: this.pageDirection,
|
|
269
|
+
}, html `
|
|
270
|
+
<edgeless-color-panel
|
|
271
|
+
aria-label="${label}"
|
|
272
|
+
role="listbox"
|
|
273
|
+
.hasTransparent=${false}
|
|
274
|
+
.hollowCircle=${hollowCircle}
|
|
275
|
+
.value=${value}
|
|
276
|
+
.theme=${theme}
|
|
277
|
+
.palettes=${activePalettes}
|
|
278
|
+
.std=${this.std}
|
|
279
|
+
@select=${onPick}
|
|
280
|
+
>
|
|
281
|
+
${when(enableCustomColor, () => {
|
|
282
|
+
const isCustomColor = this.#calcCustomButtonState(value, theme);
|
|
283
|
+
const styleInfo = this.#calcCustomButtonStyle(value, isCustomColor);
|
|
284
|
+
return html `
|
|
285
|
+
<edgeless-color-custom-button
|
|
286
|
+
slot="custom"
|
|
287
|
+
style=${styleMap(styleInfo)}
|
|
288
|
+
?active=${isCustomColor}
|
|
289
|
+
@click=${() => this.#switchToCustomWith(type)}
|
|
290
|
+
></edgeless-color-custom-button>
|
|
291
|
+
`;
|
|
292
|
+
})}
|
|
293
|
+
</edgeless-color-panel>
|
|
294
|
+
`)}
|
|
295
|
+
`)}
|
|
296
|
+
<div class="picker-label">
|
|
297
|
+
${this.std
|
|
298
|
+
? translateKey(this.std, ...BOARD_BORDER_STYLE_LABEL)
|
|
299
|
+
: BOARD_BORDER_STYLE_LABEL[1]}
|
|
300
|
+
</div>
|
|
301
|
+
<edgeless-line-styles-panel
|
|
302
|
+
class="picker"
|
|
303
|
+
.lineSize=${strokeWidth}
|
|
304
|
+
.lineStyle=${strokeStyle}
|
|
305
|
+
@select=${this.#pickStrokeStyle}
|
|
306
|
+
></edgeless-line-styles-panel>`}
|
|
218
307
|
`;
|
|
219
308
|
},
|
|
220
309
|
],
|
|
@@ -245,6 +334,33 @@ let EdgelessShapeColorPicker = (() => {
|
|
|
245
334
|
#palettes_accessor_storage;
|
|
246
335
|
get palettes() { return this.#palettes_accessor_storage; }
|
|
247
336
|
set palettes(value) { this.#palettes_accessor_storage = value; }
|
|
337
|
+
#paletteGroups_accessor_storage;
|
|
338
|
+
/**
|
|
339
|
+
* The carousel's pages, base palette first (`docs/adr/0027`). Empty falls
|
|
340
|
+
* back to {@link palettes} and draws no header — the panel as it was.
|
|
341
|
+
*/
|
|
342
|
+
get paletteGroups() { return this.#paletteGroups_accessor_storage; }
|
|
343
|
+
set paletteGroups(value) { this.#paletteGroups_accessor_storage = value; }
|
|
344
|
+
#activeGroupKey_accessor_storage;
|
|
345
|
+
/** The page to open on: the framework of the selected element, usually. */
|
|
346
|
+
get activeGroupKey() { return this.#activeGroupKey_accessor_storage; }
|
|
347
|
+
set activeGroupKey(value) { this.#activeGroupKey_accessor_storage = value; }
|
|
348
|
+
#pickedGroupIndex_accessor_storage;
|
|
349
|
+
/** Component state only, never persisted: which page the user paged TO. */
|
|
350
|
+
get pickedGroupIndex() { return this.#pickedGroupIndex_accessor_storage; }
|
|
351
|
+
set pickedGroupIndex(value) { this.#pickedGroupIndex_accessor_storage = value; }
|
|
352
|
+
#paletteListOpen_accessor_storage;
|
|
353
|
+
/**
|
|
354
|
+
* View state too: whether the header's list of pages is showing IN PLACE of
|
|
355
|
+
* the two grids and the line styles — see the twin on
|
|
356
|
+
* `edgeless-color-picker-button`.
|
|
357
|
+
*/
|
|
358
|
+
get paletteListOpen() { return this.#paletteListOpen_accessor_storage; }
|
|
359
|
+
set paletteListOpen(value) { this.#paletteListOpen_accessor_storage = value; }
|
|
360
|
+
#pageDirection_accessor_storage;
|
|
361
|
+
/** Which way the page arrived — see the twin. Both grids take it together. */
|
|
362
|
+
get pageDirection() { return this.#pageDirection_accessor_storage; }
|
|
363
|
+
set pageDirection(value) { this.#pageDirection_accessor_storage = value; }
|
|
248
364
|
#menuButton_accessor_storage;
|
|
249
365
|
get menuButton() { return this.#menuButton_accessor_storage; }
|
|
250
366
|
set menuButton(value) { this.#menuButton_accessor_storage = value; }
|
|
@@ -297,9 +413,19 @@ let EdgelessShapeColorPicker = (() => {
|
|
|
297
413
|
cancelable: true,
|
|
298
414
|
}));
|
|
299
415
|
};
|
|
416
|
+
/** Page, and remember which way it went — see the twin. */
|
|
417
|
+
this.#page = (index, direction) => {
|
|
418
|
+
this.pickedGroupIndex = index;
|
|
419
|
+
this.pageDirection = direction;
|
|
420
|
+
};
|
|
300
421
|
this.#payload_accessor_storage = __runInitializers(this, _payload_initializers, void 0);
|
|
301
422
|
this.#palettes_accessor_storage = (__runInitializers(this, _payload_extraInitializers), __runInitializers(this, _palettes_initializers, DefaultTheme.Palettes));
|
|
302
|
-
this.#
|
|
423
|
+
this.#paletteGroups_accessor_storage = (__runInitializers(this, _palettes_extraInitializers), __runInitializers(this, _paletteGroups_initializers, []));
|
|
424
|
+
this.#activeGroupKey_accessor_storage = (__runInitializers(this, _paletteGroups_extraInitializers), __runInitializers(this, _activeGroupKey_initializers, undefined));
|
|
425
|
+
this.#pickedGroupIndex_accessor_storage = (__runInitializers(this, _activeGroupKey_extraInitializers), __runInitializers(this, _pickedGroupIndex_initializers, undefined));
|
|
426
|
+
this.#paletteListOpen_accessor_storage = (__runInitializers(this, _pickedGroupIndex_extraInitializers), __runInitializers(this, _paletteListOpen_initializers, false));
|
|
427
|
+
this.#pageDirection_accessor_storage = (__runInitializers(this, _paletteListOpen_extraInitializers), __runInitializers(this, _pageDirection_initializers, 'settle'));
|
|
428
|
+
this.#menuButton_accessor_storage = (__runInitializers(this, _pageDirection_extraInitializers), __runInitializers(this, _menuButton_initializers, void 0));
|
|
303
429
|
__runInitializers(this, _menuButton_extraInitializers);
|
|
304
430
|
}
|
|
305
431
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { translateKey } from '../../affine-shared/services/index.js';
|
|
2
|
-
import { computed, effect, signal, } from '@preact/signals-core';
|
|
2
|
+
import { computed, effect, signal, untracked, } from '@preact/signals-core';
|
|
3
3
|
import { RESOURCE_NOT_FOUND_WORDINGS, RESOURCE_RETRIEVE_FAILED_WORDINGS, } from '../translations.js';
|
|
4
4
|
export class ResourceController {
|
|
5
5
|
constructor(blobId$, kind = 'File',
|
|
@@ -71,30 +71,43 @@ export class ResourceController {
|
|
|
71
71
|
return result;
|
|
72
72
|
}
|
|
73
73
|
updateState(state) {
|
|
74
|
-
|
|
74
|
+
// `peek()`, never `.value`: merging must not subscribe whatever effect
|
|
75
|
+
// happens to be running to `state$`, otherwise the write below re-runs
|
|
76
|
+
// that effect, which writes again — see `subscribe()` and issue #319.
|
|
77
|
+
this.state$.value = { ...this.state$.peek(), ...state };
|
|
75
78
|
}
|
|
76
79
|
// The explicit return type keeps declaration emit off signals-core's
|
|
77
80
|
// `DisposeFn`, whose `[Symbol.dispose]` member tsc cannot serialize.
|
|
78
81
|
subscribe() {
|
|
79
82
|
return effect(() => {
|
|
83
|
+
// Only the blob id is tracked: a new id re-runs the effect, nothing else
|
|
84
|
+
// does. The subscription body stays `untracked` because a host whose
|
|
85
|
+
// `blobState$` replays on subscribe (a `BehaviorSubject`) writes `state$`
|
|
86
|
+
// synchronously from inside this very effect; tracked, that write would
|
|
87
|
+
// re-run the effect, re-subscribe, replay, write again — until
|
|
88
|
+
// signals-core gives up with `Cycle detected` (issue #319).
|
|
80
89
|
const blobId = this.blobId$.value;
|
|
81
90
|
if (!blobId)
|
|
82
91
|
return;
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
errorMessage
|
|
94
|
-
|
|
95
|
-
|
|
92
|
+
return untracked(() => {
|
|
93
|
+
const blobState$ = this.engine?.blobState$(blobId);
|
|
94
|
+
if (!blobState$)
|
|
95
|
+
return;
|
|
96
|
+
const subscription = blobState$.subscribe(state => {
|
|
97
|
+
let { uploading, downloading, errorMessage } = state;
|
|
98
|
+
if (state.overSize) {
|
|
99
|
+
uploading = false;
|
|
100
|
+
downloading = false;
|
|
101
|
+
}
|
|
102
|
+
else if ((uploading || downloading) && errorMessage) {
|
|
103
|
+
errorMessage = null;
|
|
104
|
+
}
|
|
105
|
+
// A later emission can land while some unrelated effect is being
|
|
106
|
+
// evaluated; it must not become a dependency of that effect either.
|
|
107
|
+
untracked(() => this.updateState({ ...state, uploading, downloading, errorMessage }));
|
|
108
|
+
});
|
|
109
|
+
return () => subscription.unsubscribe();
|
|
96
110
|
});
|
|
97
|
-
return () => subscription.unsubscribe();
|
|
98
111
|
});
|
|
99
112
|
}
|
|
100
113
|
async blob() {
|
|
@@ -23,6 +23,14 @@ export declare const COLOR_PICKER_TAB_CUSTOM: ChromeWording;
|
|
|
23
23
|
export declare const COLOR_PICKER_MODE_NORMAL: ChromeWording;
|
|
24
24
|
export declare const COLOR_PICKER_MODE_LIGHT: ChromeWording;
|
|
25
25
|
export declare const COLOR_PICKER_MODE_DARK: ChromeWording;
|
|
26
|
+
/**
|
|
27
|
+
* The carousel's own two words (`docs/adr/0027`). The PAGE names are not
|
|
28
|
+
* here: the base page is the one below, and a framework's page is named by the
|
|
29
|
+
* framework itself, through the `labelWording` it registers — the same key its
|
|
30
|
+
* senior button already uses.
|
|
31
|
+
*/
|
|
32
|
+
export declare const PALETTE_GROUP_DEFAULT: ChromeWording;
|
|
33
|
+
export declare const PALETTE_GROUP_CHOOSE: ChromeWording;
|
|
26
34
|
export { COLOR_LABEL, FILL_COLOR_LABEL };
|
|
27
35
|
export declare const BORDER_COLOR_LABEL: ChromeWording;
|
|
28
36
|
export declare const CONTEXT_MENU_NO_RESULTS: ChromeWording;
|
|
@@ -51,6 +51,21 @@ export const COLOR_PICKER_MODE_DARK = [
|
|
|
51
51
|
'com.labre.color-picker.mode.dark',
|
|
52
52
|
'Dark',
|
|
53
53
|
];
|
|
54
|
+
/* ── Palette carousel (the framework pages of a colour picker) ───────── */
|
|
55
|
+
/**
|
|
56
|
+
* The carousel's own two words (`docs/adr/0027`). The PAGE names are not
|
|
57
|
+
* here: the base page is the one below, and a framework's page is named by the
|
|
58
|
+
* framework itself, through the `labelWording` it registers — the same key its
|
|
59
|
+
* senior button already uses.
|
|
60
|
+
*/
|
|
61
|
+
export const PALETTE_GROUP_DEFAULT = [
|
|
62
|
+
'com.labre.color-picker.palette.default',
|
|
63
|
+
'Default',
|
|
64
|
+
];
|
|
65
|
+
export const PALETTE_GROUP_CHOOSE = [
|
|
66
|
+
'com.labre.color-picker.palette.choose',
|
|
67
|
+
'Choose a palette',
|
|
68
|
+
];
|
|
54
69
|
/* ── Shape colour picker ─────────────────────────────────────────────── */
|
|
55
70
|
export { COLOR_LABEL, FILL_COLOR_LABEL };
|
|
56
71
|
export const BORDER_COLOR_LABEL = [
|
|
@@ -408,6 +423,8 @@ export const COMPONENTS_WORDINGS = [
|
|
|
408
423
|
COLOR_PICKER_MODE_NORMAL,
|
|
409
424
|
COLOR_PICKER_MODE_LIGHT,
|
|
410
425
|
COLOR_PICKER_MODE_DARK,
|
|
426
|
+
PALETTE_GROUP_DEFAULT,
|
|
427
|
+
PALETTE_GROUP_CHOOSE,
|
|
411
428
|
BORDER_COLOR_LABEL,
|
|
412
429
|
CONTEXT_MENU_NO_RESULTS,
|
|
413
430
|
CONTEXT_MENU_DONE,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { FileDropExtension } from '../affine-components/drop-indicator/index.js';
|
|
2
2
|
import { PeekViewExtension, } from '../affine-components/peek/index.js';
|
|
3
3
|
import { ViewExtensionProvider, } from '../affine-ext-loader/index.js';
|
|
4
|
-
import { AutoClearSelectionService, BlockCommentManager, BlockLifecycleTelemetryWatcher, CitationService, DefaultOpenDocExtension, DNDAPIExtension, DocDisplayMetaService, DocModeService, EditPropsStore, EmbedOptionService, FileSizeLimitService, FontConfigExtension, fontConfigSchema, FontLoaderService, LinkPreviewCache, LinkPreviewCacheConfigSchema, LinkPreviewCacheExtension, LinkPreviewService, PageViewportServiceExtension, PivotMaterialityPublisher, TelemetryExtension, ThemeService, ToolbarRegistryExtension, } from '../affine-shared/services/index.js';
|
|
4
|
+
import { AutoClearSelectionService, BlockCommentManager, BlockLifecycleTelemetryWatcher, CitationService, DefaultOpenDocExtension, DNDAPIExtension, DocDisplayMetaService, DocModeService, DocumentDamageTelemetryWatcher, EditPropsStore, EmbedOptionService, FileSizeLimitService, FontConfigExtension, fontConfigSchema, FontLoaderService, LinkPreviewCache, LinkPreviewCacheConfigSchema, LinkPreviewCacheExtension, LinkPreviewService, PageViewportServiceExtension, PivotMaterialityPublisher, TelemetryExtension, ThemeService, ToolbarRegistryExtension, } from '../affine-shared/services/index.js';
|
|
5
5
|
import { InteractivityManager, ToolController } from '../std/gfx/index.js';
|
|
6
6
|
import { z } from 'zod';
|
|
7
7
|
import { clipboardConfigs } from './clipboard.js';
|
|
@@ -44,6 +44,7 @@ export class FoundationViewExtension extends ViewExtensionProvider {
|
|
|
44
44
|
BlockCommentManager,
|
|
45
45
|
// Inert without an injected TelemetryService; see telemetry README.
|
|
46
46
|
BlockLifecycleTelemetryWatcher,
|
|
47
|
+
DocumentDamageTelemetryWatcher,
|
|
47
48
|
]);
|
|
48
49
|
context.register(clipboardConfigs);
|
|
49
50
|
if (this.isEdgeless(context.scope)) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ElementRendererExtension, } from '../affine-block-surface/index.js';
|
|
1
|
+
import { ElementRendererExtension, taggedPath2D, } from '../affine-block-surface/index.js';
|
|
2
2
|
import { DefaultTheme } from '../affine-model/index.js';
|
|
3
3
|
export const brush = (model, ctx, matrix, renderer) => {
|
|
4
4
|
const { rotate } = model;
|
|
@@ -8,6 +8,6 @@ export const brush = (model, ctx, matrix, renderer) => {
|
|
|
8
8
|
ctx.setTransform(matrix.translateSelf(cx, cy).rotateSelf(rotate).translateSelf(-cx, -cy));
|
|
9
9
|
const color = renderer.getColorValue(model.color, DefaultTheme.black, true);
|
|
10
10
|
ctx.fillStyle = color;
|
|
11
|
-
ctx.fill(
|
|
11
|
+
ctx.fill(taggedPath2D(model.commands));
|
|
12
12
|
};
|
|
13
13
|
export const BrushElementRendererExtension = ElementRendererExtension('brush', brush);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { EdgelessCRUDIdentifier } from '../../../affine-block-surface/index.js';
|
|
2
|
-
import { packColor, } from '../../../affine-components/color-picker/index.js';
|
|
2
|
+
import { frameworkPaletteGroups, packColor, } from '../../../affine-components/color-picker/index.js';
|
|
3
3
|
import { BrushElementModel, DefaultTheme, LineWidth, resolveColor, } from '../../../affine-model/index.js';
|
|
4
4
|
import { ToolbarModuleExtension, translateKey, } from '../../../affine-shared/services/index.js';
|
|
5
5
|
import { getMostCommonResolvedValue, getMostCommonValue, } from '../../../affine-shared/utils/index.js';
|
|
@@ -72,6 +72,9 @@ export const brushToolbarConfig = {
|
|
|
72
72
|
break;
|
|
73
73
|
}
|
|
74
74
|
};
|
|
75
|
+
// A stroke drawn on a framework board opens on that framework's hues
|
|
76
|
+
// (`docs/adr/0027`); the editor palette stays page one.
|
|
77
|
+
const carousel = frameworkPaletteGroups(ctx.std, models, DefaultTheme.Palettes);
|
|
75
78
|
return html `
|
|
76
79
|
<edgeless-color-picker-button
|
|
77
80
|
class="color"
|
|
@@ -81,6 +84,8 @@ export const brushToolbarConfig = {
|
|
|
81
84
|
.theme=${theme}
|
|
82
85
|
.originalColor=${originalColor}
|
|
83
86
|
.enableCustomColor=${enableCustomColor}
|
|
87
|
+
.paletteGroups=${carousel.groups}
|
|
88
|
+
.activeGroupKey=${carousel.activeKey}
|
|
84
89
|
.std=${ctx.std}
|
|
85
90
|
>
|
|
86
91
|
</edgeless-color-picker-button>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { EdgelessCRUDIdentifier } from '../../../affine-block-surface/index.js';
|
|
2
|
-
import { adjustColorAlpha, keepColor, packColor, } from '../../../affine-components/color-picker/index.js';
|
|
2
|
+
import { adjustColorAlpha, frameworkPaletteGroups, keepColor, packColor, } from '../../../affine-components/color-picker/index.js';
|
|
3
3
|
import { DEFAULT_HIGHLIGHTER_LINE_WIDTH, DefaultTheme, HIGHLIGHTER_LINE_WIDTHS, HighlighterElementModel, resolveColor, } from '../../../affine-model/index.js';
|
|
4
4
|
import { ToolbarModuleExtension, translateKey, } from '../../../affine-shared/services/index.js';
|
|
5
5
|
import { getMostCommonResolvedValue, getMostCommonValue, } from '../../../affine-shared/utils/index.js';
|
|
@@ -82,6 +82,9 @@ export const highlighterToolbarConfig = {
|
|
|
82
82
|
control: 'color picker',
|
|
83
83
|
});
|
|
84
84
|
};
|
|
85
|
+
// A highlight drawn over a framework board opens on that framework's
|
|
86
|
+
// hues (`docs/adr/0027`); the short stroke palette stays page one.
|
|
87
|
+
const carousel = frameworkPaletteGroups(ctx.std, models, DefaultTheme.StrokeColorShortPalettes);
|
|
85
88
|
return html `
|
|
86
89
|
<edgeless-color-picker-button
|
|
87
90
|
.colorPanelClass="${'one-way small'}"
|
|
@@ -91,6 +94,8 @@ export const highlighterToolbarConfig = {
|
|
|
91
94
|
.theme=${theme}
|
|
92
95
|
.originalColor=${originalColor}
|
|
93
96
|
.palettes=${DefaultTheme.StrokeColorShortPalettes}
|
|
97
|
+
.paletteGroups=${carousel.groups}
|
|
98
|
+
.activeGroupKey=${carousel.activeKey}
|
|
94
99
|
.shouldKeepColor=${true}
|
|
95
100
|
.enableCustomColor=${false}
|
|
96
101
|
.std=${ctx.std}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { AStarRunner, Overlay } from '../affine-block-surface/index.js';
|
|
2
|
-
import { type BrushElementModel, type Connection, ConnectorElementModel, GroupElementModel, type LocalConnectorElementModel } from '../affine-model/index.js';
|
|
2
|
+
import { type BrushElementModel, type Connection, ConnectorElementModel, type ConnectorLabelEnd, GroupElementModel, type LocalConnectorElementModel } from '../affine-model/index.js';
|
|
3
3
|
import type { IBound, IVec } from '../global/gfx/index.js';
|
|
4
4
|
import { Bound, PointLocation } from '../global/gfx/index.js';
|
|
5
5
|
import type { BlockStdScope } from '../std/index.js';
|
|
@@ -26,6 +26,14 @@ export declare function isCenterAnchorEligible(ele: GfxModel): boolean;
|
|
|
26
26
|
*/
|
|
27
27
|
export declare function isCenterAnchorEnabled(std: BlockStdScope): boolean;
|
|
28
28
|
export declare function isConnectorWithLabel(model: GfxModel | GfxLocalElementModel): boolean;
|
|
29
|
+
/**
|
|
30
|
+
* The end-label twin of `isConnectorWithLabel`: a connector carrying a painted
|
|
31
|
+
* label beside its `source` / `target` endpoint.
|
|
32
|
+
*
|
|
33
|
+
* A `LocalConnectorElementModel` has no labels at all — it is the preview a
|
|
34
|
+
* drag paints — so the `instanceof` is the guard, exactly as above.
|
|
35
|
+
*/
|
|
36
|
+
export declare function isConnectorWithEndLabel(model: GfxModel | GfxLocalElementModel, end: ConnectorLabelEnd): boolean;
|
|
29
37
|
export declare function calculateNearestLocation(point: IVec, bounds: IBound, locations?: IVec[], shortestDistance?: number): IVec;
|
|
30
38
|
export declare function isConnectorAndBindingsAllSelected(connector: ConnectorElementModel | LocalConnectorElementModel, selected: GfxModel[]): boolean;
|
|
31
39
|
export declare function getAnchors(ele: GfxModel, includeCenterAnchor?: boolean): {
|
|
@@ -160,6 +160,46 @@ function computePerimeterPointForCenterAnchor(connectable, centerPoint, otherPoi
|
|
|
160
160
|
export function isConnectorWithLabel(model) {
|
|
161
161
|
return model instanceof ConnectorElementModel && model.hasLabel();
|
|
162
162
|
}
|
|
163
|
+
/**
|
|
164
|
+
* The end-label twin of `isConnectorWithLabel`: a connector carrying a painted
|
|
165
|
+
* label beside its `source` / `target` endpoint.
|
|
166
|
+
*
|
|
167
|
+
* A `LocalConnectorElementModel` has no labels at all — it is the preview a
|
|
168
|
+
* drag paints — so the `instanceof` is the guard, exactly as above.
|
|
169
|
+
*/
|
|
170
|
+
export function isConnectorWithEndLabel(model, end) {
|
|
171
|
+
return model instanceof ConnectorElementModel && model.hasEndLabel(end);
|
|
172
|
+
}
|
|
173
|
+
/**
|
|
174
|
+
* Translates one end label's box by how far its endpoint moved, so the label
|
|
175
|
+
* keeps the position the author gave it RELATIVE to that end.
|
|
176
|
+
*
|
|
177
|
+
* `ConnectorPathGenerator.updatePath` is the only caller: the label follows the
|
|
178
|
+
* end on every re-route, and on nothing else.
|
|
179
|
+
*/
|
|
180
|
+
function followEndpoint(model, end, previousPath) {
|
|
181
|
+
const box = model.endLabelXYWH(end);
|
|
182
|
+
if (!box || !model.hasEndLabel(end))
|
|
183
|
+
return;
|
|
184
|
+
const nextPath = model.absolutePath;
|
|
185
|
+
if (nextPath.length === 0 || previousPath.length === 0)
|
|
186
|
+
return;
|
|
187
|
+
const endpointOf = (path) => end === 'source' ? path[0] : path[path.length - 1];
|
|
188
|
+
const from = endpointOf(previousPath);
|
|
189
|
+
const to = endpointOf(nextPath);
|
|
190
|
+
const dx = to[0] - from[0];
|
|
191
|
+
const dy = to[1] - from[1];
|
|
192
|
+
if (dx === 0 && dy === 0)
|
|
193
|
+
return;
|
|
194
|
+
const [x, y, w, h] = box;
|
|
195
|
+
const moved = [x + dx, y + dy, w, h];
|
|
196
|
+
if (end === 'source') {
|
|
197
|
+
model.sourceLabelXYWH = moved;
|
|
198
|
+
}
|
|
199
|
+
else {
|
|
200
|
+
model.targetLabelXYWH = moved;
|
|
201
|
+
}
|
|
202
|
+
}
|
|
163
203
|
export function calculateNearestLocation(point, bounds, locations = ConnectorEndpointLocations, shortestDistance = Number.POSITIVE_INFINITY) {
|
|
164
204
|
const { x, y, w, h } = bounds;
|
|
165
205
|
return locations
|
|
@@ -1000,6 +1040,10 @@ export class ConnectorPathGenerator extends PathGenerator {
|
|
|
1000
1040
|
const relativePoints = points.map((p) => {
|
|
1001
1041
|
return p.setVec(Vec.sub(p, [bound.x, bound.y]));
|
|
1002
1042
|
});
|
|
1043
|
+
// Captured before the assignment below rebuilds it: the end labels are
|
|
1044
|
+
// re-anchored by how far THEIR endpoint travelled, which is only knowable
|
|
1045
|
+
// against the path this call replaces.
|
|
1046
|
+
const previousPath = connector.absolutePath;
|
|
1003
1047
|
connector.updatingPath = true;
|
|
1004
1048
|
// the property assignment order matters
|
|
1005
1049
|
connector.xywh = bound.serialize();
|
|
@@ -1015,6 +1059,23 @@ export class ConnectorPathGenerator extends PathGenerator {
|
|
|
1015
1059
|
model.labelXYWH = [cx - w / 2, cy - h / 2, w, h];
|
|
1016
1060
|
}
|
|
1017
1061
|
}
|
|
1062
|
+
// The end labels follow THEIR OWN endpoint, not the connector's centre.
|
|
1063
|
+
// Dragging one of the two nodes moves one end and leaves the other where
|
|
1064
|
+
// it was: re-deriving both boxes from the offset distance (what the centre
|
|
1065
|
+
// label does) would recentre them, and translating both by the element's
|
|
1066
|
+
// delta would slide the far one off its line. Translating each by its
|
|
1067
|
+
// endpoint's delta is the only rule under which a `0..*` typed beside an
|
|
1068
|
+
// end stays beside that end — and the only one that preserves a box the
|
|
1069
|
+
// author dragged somewhere else. Same persistence gate as above: these are
|
|
1070
|
+
// `@field()`s too, so a watching peer must not write them.
|
|
1071
|
+
if (connector instanceof ConnectorElementModel) {
|
|
1072
|
+
const mayPersist = (options?.persistLabelXYWH ?? true) &&
|
|
1073
|
+
!connector.surface?.store?.readonly;
|
|
1074
|
+
if (mayPersist) {
|
|
1075
|
+
followEndpoint(connector, 'source', previousPath);
|
|
1076
|
+
followEndpoint(connector, 'target', previousPath);
|
|
1077
|
+
}
|
|
1078
|
+
}
|
|
1018
1079
|
connector.updatingPath = false;
|
|
1019
1080
|
}
|
|
1020
1081
|
_computeStartEndPoint(connector) {
|