@formicoidea/labre-core 0.49.0 → 0.51.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/dist/_pkgs/affine-block-attachment/asset-picker.d.ts +24 -0
- package/dist/_pkgs/affine-block-attachment/asset-picker.js +87 -0
- package/dist/_pkgs/affine-block-attachment/configs/slash-menu.js +3 -20
- package/dist/_pkgs/affine-block-attachment/index.d.ts +1 -0
- package/dist/_pkgs/affine-block-attachment/index.js +1 -0
- package/dist/_pkgs/affine-block-attachment/utils.d.ts +9 -1
- package/dist/_pkgs/affine-block-attachment/utils.js +9 -0
- package/dist/_pkgs/affine-block-bookmark/adapters/markdown/markdown.js +14 -1
- package/dist/_pkgs/affine-block-bookmark/adapters/notion-html.js +5 -1
- package/dist/_pkgs/affine-block-database/adapters/markdown.js +5 -3
- package/dist/_pkgs/affine-block-embed/common/adapters/html.js +5 -3
- package/dist/_pkgs/affine-block-embed/common/adapters/markdown.js +11 -0
- package/dist/_pkgs/affine-block-frame/frame-template.d.ts +58 -0
- package/dist/_pkgs/affine-block-frame/frame-template.js +207 -0
- package/dist/_pkgs/affine-block-frame/frame-toolbar.js +19 -3
- package/dist/_pkgs/affine-block-frame/index.d.ts +1 -0
- package/dist/_pkgs/affine-block-frame/index.js +1 -0
- package/dist/_pkgs/affine-block-frame/translations.d.ts +7 -0
- package/dist/_pkgs/affine-block-frame/translations.js +16 -1
- package/dist/_pkgs/affine-block-frame/view.js +6 -0
- package/dist/_pkgs/affine-block-image/asset-picker.d.ts +63 -0
- package/dist/_pkgs/affine-block-image/asset-picker.js +183 -0
- package/dist/_pkgs/affine-block-image/commands/insert-images.d.ts +5 -0
- package/dist/_pkgs/affine-block-image/commands/insert-images.js +8 -8
- package/dist/_pkgs/affine-block-image/components/page-image-block.d.ts +11 -0
- package/dist/_pkgs/affine-block-image/components/page-image-block.js +81 -12
- package/dist/_pkgs/affine-block-image/configs/replace-action.d.ts +9 -0
- package/dist/_pkgs/affine-block-image/configs/replace-action.js +27 -0
- package/dist/_pkgs/affine-block-image/configs/toolbar.js +6 -0
- package/dist/_pkgs/affine-block-image/crop/crop-controller.d.ts +46 -0
- package/dist/_pkgs/affine-block-image/crop/crop-controller.js +104 -0
- package/dist/_pkgs/affine-block-image/crop/crop-math.d.ts +70 -0
- package/dist/_pkgs/affine-block-image/crop/crop-math.js +141 -0
- package/dist/_pkgs/affine-block-image/crop/crop-overlay.d.ts +57 -0
- package/dist/_pkgs/affine-block-image/crop/crop-overlay.js +343 -0
- package/dist/_pkgs/affine-block-image/crop/crop-toolbar.d.ts +12 -0
- package/dist/_pkgs/affine-block-image/crop/crop-toolbar.js +78 -0
- package/dist/_pkgs/affine-block-image/crop/write-crop.d.ts +16 -0
- package/dist/_pkgs/affine-block-image/crop/write-crop.js +57 -0
- package/dist/_pkgs/affine-block-image/edgeless-clipboard-config.js +4 -1
- package/dist/_pkgs/affine-block-image/effects.js +2 -0
- package/dist/_pkgs/affine-block-image/image-block.d.ts +2 -0
- package/dist/_pkgs/affine-block-image/image-block.js +2 -0
- package/dist/_pkgs/affine-block-image/image-edgeless-block.d.ts +2 -0
- package/dist/_pkgs/affine-block-image/image-edgeless-block.js +36 -8
- package/dist/_pkgs/affine-block-image/image-resize-manager.js +15 -0
- package/dist/_pkgs/affine-block-image/index.d.ts +1 -0
- package/dist/_pkgs/affine-block-image/index.js +1 -0
- package/dist/_pkgs/affine-block-image/translations.d.ts +15 -0
- package/dist/_pkgs/affine-block-image/translations.js +43 -0
- package/dist/_pkgs/affine-block-image/utils.d.ts +13 -0
- package/dist/_pkgs/affine-block-image/utils.js +10 -1
- package/dist/_pkgs/affine-block-root/clipboard/page-clipboard.js +5 -0
- package/dist/_pkgs/affine-block-root/commands/page-export-commands.d.ts +2 -0
- package/dist/_pkgs/affine-block-root/commands/page-export-commands.js +71 -0
- package/dist/_pkgs/affine-block-root/index.d.ts +1 -0
- package/dist/_pkgs/affine-block-root/index.js +1 -0
- package/dist/_pkgs/affine-block-root/view.js +8 -0
- package/dist/_pkgs/affine-block-surface/extensions/drawio-export/capability.d.ts +30 -0
- package/dist/_pkgs/affine-block-surface/extensions/drawio-export/capability.js +44 -0
- package/dist/_pkgs/affine-block-surface/extensions/drawio-export/colors.d.ts +26 -0
- package/dist/_pkgs/affine-block-surface/extensions/drawio-export/colors.js +82 -0
- package/dist/_pkgs/affine-block-surface/extensions/drawio-export/command.d.ts +18 -0
- package/dist/_pkgs/affine-block-surface/extensions/drawio-export/command.js +91 -0
- package/dist/_pkgs/affine-block-surface/extensions/drawio-export/index.d.ts +3 -0
- package/dist/_pkgs/affine-block-surface/extensions/drawio-export/index.js +3 -0
- package/dist/_pkgs/affine-block-surface/extensions/drawio-export/writer.d.ts +50 -0
- package/dist/_pkgs/affine-block-surface/extensions/drawio-export/writer.js +732 -0
- package/dist/_pkgs/affine-block-surface/extensions/export-manager/draw-image-block.d.ts +12 -0
- package/dist/_pkgs/affine-block-surface/extensions/export-manager/draw-image-block.js +15 -0
- package/dist/_pkgs/affine-block-surface/extensions/export-manager/export-manager.js +7 -1
- package/dist/_pkgs/affine-block-surface/extensions/export-svg/command.d.ts +7 -1
- package/dist/_pkgs/affine-block-surface/extensions/export-svg/command.js +60 -1
- package/dist/_pkgs/affine-block-surface/extensions/export-svg/index.d.ts +2 -2
- package/dist/_pkgs/affine-block-surface/extensions/export-svg/index.js +2 -2
- package/dist/_pkgs/affine-block-surface/extensions/export-svg/marker-version.d.ts +6 -0
- package/dist/_pkgs/affine-block-surface/extensions/export-svg/marker-version.js +8 -0
- package/dist/_pkgs/affine-block-surface/extensions/export-svg/render.d.ts +28 -1
- package/dist/_pkgs/affine-block-surface/extensions/export-svg/render.js +66 -6
- package/dist/_pkgs/affine-block-surface/extensions/export-svg/svg-context.d.ts +2 -7
- package/dist/_pkgs/affine-block-surface/extensions/export-svg/svg-context.js +2 -6
- package/dist/_pkgs/affine-block-surface/extensions/index.d.ts +2 -0
- package/dist/_pkgs/affine-block-surface/extensions/index.js +2 -0
- package/dist/_pkgs/affine-block-surface/extensions/interchange-export.d.ts +84 -0
- package/dist/_pkgs/affine-block-surface/extensions/interchange-export.js +150 -0
- package/dist/_pkgs/affine-block-surface/extensions/interchange-import.js +24 -2
- package/dist/_pkgs/affine-block-surface/extensions/interchange.d.ts +23 -2
- package/dist/_pkgs/affine-block-surface/extensions/interchange.js +4 -1
- package/dist/_pkgs/affine-block-surface/extensions/legend-role.d.ts +18 -0
- package/dist/_pkgs/affine-block-surface/extensions/legend-role.js +20 -0
- package/dist/_pkgs/affine-block-surface/extensions/legend.d.ts +2 -19
- package/dist/_pkgs/affine-block-surface/extensions/legend.js +2 -18
- package/dist/_pkgs/affine-block-surface/extensions/svg-sanitize.d.ts +67 -0
- package/dist/_pkgs/affine-block-surface/extensions/svg-sanitize.js +235 -0
- package/dist/_pkgs/affine-block-surface/extensions/svg-sketch-translations.d.ts +1 -0
- package/dist/_pkgs/affine-block-surface/extensions/svg-sketch-translations.js +9 -0
- package/dist/_pkgs/affine-block-surface/extensions/svg-sketch.d.ts +17 -13
- package/dist/_pkgs/affine-block-surface/extensions/svg-sketch.js +52 -80
- package/dist/_pkgs/affine-block-surface/extensions/xml-element.d.ts +98 -0
- package/dist/_pkgs/affine-block-surface/extensions/xml-element.js +261 -0
- package/dist/_pkgs/affine-block-surface/extensions/xml-reader.d.ts +238 -0
- package/dist/_pkgs/affine-block-surface/extensions/xml-reader.js +570 -0
- package/dist/_pkgs/affine-block-surface/framework-background/def.js +1 -1
- package/dist/_pkgs/affine-block-surface/interchange-headless.d.ts +29 -0
- package/dist/_pkgs/affine-block-surface/interchange-headless.js +32 -0
- package/dist/_pkgs/affine-block-surface/view.js +22 -2
- package/dist/_pkgs/affine-block-table/adapters/utils.js +24 -1
- package/dist/_pkgs/affine-components/color-picker/color-panel.d.ts +11 -0
- package/dist/_pkgs/affine-components/color-picker/color-panel.js +87 -12
- package/dist/_pkgs/affine-components/color-picker/framework-palette.d.ts +8 -0
- package/dist/_pkgs/affine-components/color-picker/framework-palette.js +11 -3
- package/dist/_pkgs/affine-components/color-picker/icons.d.ts +9 -0
- package/dist/_pkgs/affine-components/color-picker/icons.js +12 -0
- package/dist/_pkgs/affine-gfx-note/toolbar/note-menu.js +5 -8
- package/dist/_pkgs/affine-gfx-template/contribute.d.ts +14 -4
- package/dist/_pkgs/affine-gfx-template/contribute.js +47 -6
- package/dist/_pkgs/affine-gfx-template/toolbar/builtin-templates.d.ts +7 -2
- package/dist/_pkgs/affine-gfx-template/toolbar/builtin-templates.js +14 -40
- package/dist/_pkgs/affine-gfx-template/toolbar/resolve-name.d.ts +1 -1
- package/dist/_pkgs/affine-gfx-template/toolbar/resolve-name.js +1 -1
- package/dist/_pkgs/affine-gfx-template/toolbar/template-panel.d.ts +4 -4
- package/dist/_pkgs/affine-gfx-template/toolbar/template-panel.js +9 -9
- package/dist/_pkgs/affine-gfx-template/toolbar/template-type.d.ts +2 -4
- package/dist/_pkgs/affine-gfx-template/translations.d.ts +5 -0
- package/dist/_pkgs/affine-gfx-template/translations.js +9 -0
- package/dist/_pkgs/affine-inline-footnote/adapters/markdown/inline-delta.js +6 -0
- package/dist/_pkgs/affine-inline-footnote/adapters/markdown/markdown-inline.js +7 -0
- package/dist/_pkgs/affine-inline-link/adapters/html/html-inline.js +4 -1
- package/dist/_pkgs/affine-inline-link/adapters/html/inline-delta.js +3 -1
- package/dist/_pkgs/affine-inline-link/adapters/markdown/inline-delta.js +4 -1
- package/dist/_pkgs/affine-inline-link/adapters/notion-html/html-inline.js +2 -1
- package/dist/_pkgs/affine-inline-link/link-node/affine-link.d.ts +7 -0
- package/dist/_pkgs/affine-inline-link/link-node/affine-link.js +37 -0
- package/dist/_pkgs/affine-inline-link/link-node/index.d.ts +1 -0
- package/dist/_pkgs/affine-inline-link/link-node/index.js +1 -0
- package/dist/_pkgs/affine-inline-link/link-node/propose-views.d.ts +22 -0
- package/dist/_pkgs/affine-inline-link/link-node/propose-views.js +59 -0
- package/dist/_pkgs/affine-model/blocks/database/types.d.ts +28 -0
- package/dist/_pkgs/affine-model/blocks/image/image-crop.d.ts +48 -0
- package/dist/_pkgs/affine-model/blocks/image/image-crop.js +78 -0
- package/dist/_pkgs/affine-model/blocks/image/image-model.d.ts +6 -0
- package/dist/_pkgs/affine-model/blocks/image/image-model.js +2 -0
- package/dist/_pkgs/affine-model/blocks/image/index.d.ts +1 -0
- package/dist/_pkgs/affine-model/blocks/image/index.js +1 -0
- package/dist/_pkgs/affine-model/consts/shape.d.ts +2 -0
- package/dist/_pkgs/affine-model/consts/shape.js +5 -0
- package/dist/_pkgs/affine-model/elements/bpmn/consts.d.ts +31 -0
- package/dist/_pkgs/affine-model/elements/bpmn/consts.js +31 -0
- package/dist/_pkgs/affine-model/elements/bpmn/index.d.ts +1 -0
- package/dist/_pkgs/affine-model/elements/bpmn/index.js +1 -0
- package/dist/_pkgs/affine-model/elements/bpmn/pool.d.ts +0 -25
- package/dist/_pkgs/affine-model/elements/bpmn/pool.js +1 -25
- package/dist/_pkgs/affine-model/elements/shape/shape.d.ts +0 -2
- package/dist/_pkgs/affine-model/elements/shape/shape.js +1 -2
- package/dist/_pkgs/affine-model/elements/uml/consts.d.ts +133 -0
- package/dist/_pkgs/affine-model/elements/uml/consts.js +107 -0
- package/dist/_pkgs/affine-model/elements/uml/diagram.d.ts +1 -79
- package/dist/_pkgs/affine-model/elements/uml/diagram.js +1 -53
- package/dist/_pkgs/affine-model/elements/uml/fragment.d.ts +0 -15
- package/dist/_pkgs/affine-model/elements/uml/fragment.js +1 -15
- package/dist/_pkgs/affine-model/elements/uml/index.d.ts +1 -0
- package/dist/_pkgs/affine-model/elements/uml/index.js +1 -0
- package/dist/_pkgs/affine-model/elements/uml/partition.d.ts +0 -20
- package/dist/_pkgs/affine-model/elements/uml/partition.js +1 -20
- package/dist/_pkgs/affine-model/elements/uml/region.d.ts +0 -11
- package/dist/_pkgs/affine-model/elements/uml/region.js +1 -11
- package/dist/_pkgs/affine-model/headless.d.ts +19 -0
- package/dist/_pkgs/affine-model/headless.js +19 -0
- package/dist/_pkgs/affine-shared/headless.d.ts +10 -0
- package/dist/_pkgs/affine-shared/headless.js +10 -0
- package/dist/_pkgs/affine-shared/services/asset-picker-service.d.ts +63 -0
- package/dist/_pkgs/affine-shared/services/asset-picker-service.js +20 -0
- package/dist/_pkgs/affine-shared/services/data-source-picker-service.d.ts +6 -3
- package/dist/_pkgs/affine-shared/services/frame-template-service.d.ts +83 -0
- package/dist/_pkgs/affine-shared/services/frame-template-service.js +17 -0
- package/dist/_pkgs/affine-shared/services/index.d.ts +2 -0
- package/dist/_pkgs/affine-shared/services/index.js +2 -0
- package/dist/_pkgs/affine-shared/services/translation-service/chrome.d.ts +6 -0
- package/dist/_pkgs/affine-shared/services/translation-service/chrome.js +10 -0
- package/dist/_pkgs/affine-widget-drag-handle/watchers/drag-event-watcher.js +8 -3
- package/dist/_pkgs/affine-widget-keyboard-toolbar/config.js +4 -16
- package/dist/_pkgs/affine-widget-linked-doc/transformers/html.d.ts +7 -0
- package/dist/_pkgs/affine-widget-linked-doc/transformers/html.js +25 -24
- package/dist/_pkgs/affine-widget-linked-doc/transformers/index.d.ts +1 -1
- package/dist/_pkgs/affine-widget-linked-doc/transformers/markdown.d.ts +7 -0
- package/dist/_pkgs/affine-widget-linked-doc/transformers/markdown.js +26 -25
- package/dist/_pkgs/affine-widget-linked-doc/transformers/utils.d.ts +23 -0
- package/dist/_pkgs/affine-widget-linked-doc/transformers/utils.js +14 -0
- package/dist/_pkgs/data-view/core/common/properties.d.ts +29 -0
- package/dist/_pkgs/data-view/core/common/properties.js +110 -8
- package/dist/_pkgs/data-view/core/common/property-menu.d.ts +44 -1
- package/dist/_pkgs/data-view/core/common/property-menu.js +100 -3
- package/dist/_pkgs/data-view/core/component/tags/color-carousel.d.ts +41 -0
- package/dist/_pkgs/data-view/core/component/tags/color-carousel.js +199 -0
- package/dist/_pkgs/data-view/core/component/tags/color-menu.d.ts +49 -0
- package/dist/_pkgs/data-view/core/component/tags/color-menu.js +123 -0
- package/dist/_pkgs/data-view/core/component/tags/index.d.ts +3 -0
- package/dist/_pkgs/data-view/core/component/tags/index.js +3 -0
- package/dist/_pkgs/data-view/core/component/tags/multi-tag-select.d.ts +8 -1
- package/dist/_pkgs/data-view/core/component/tags/multi-tag-select.js +21 -20
- package/dist/_pkgs/data-view/core/component/tags/softened-colors.d.ts +42 -0
- package/dist/_pkgs/data-view/core/component/tags/softened-colors.js +79 -0
- package/dist/_pkgs/data-view/core/data-view.d.ts +8 -1
- package/dist/_pkgs/data-view/core/data-view.js +18 -2
- package/dist/_pkgs/data-view/core/effect.js +2 -1
- package/dist/_pkgs/data-view/core/filter/eval.d.ts +6 -1
- package/dist/_pkgs/data-view/core/filter/eval.js +7 -2
- package/dist/_pkgs/data-view/core/group-by/renderer/select-group.d.ts +3 -0
- package/dist/_pkgs/data-view/core/group-by/renderer/select-group.js +119 -71
- package/dist/_pkgs/data-view/core/view/color-rules.d.ts +85 -0
- package/dist/_pkgs/data-view/core/view/color-rules.js +165 -0
- package/dist/_pkgs/data-view/core/view/index.d.ts +1 -0
- package/dist/_pkgs/data-view/core/view/index.js +1 -0
- package/dist/_pkgs/data-view/property-presets/multi-select/cell-renderer.js +1 -0
- package/dist/_pkgs/data-view/property-presets/select/cell-renderer.js +1 -0
- package/dist/_pkgs/data-view/translations.d.ts +34 -0
- package/dist/_pkgs/data-view/translations.js +80 -0
- package/dist/_pkgs/data-view/view-presets/gallery/gallery-view.js +7 -1
- package/dist/_pkgs/data-view/view-presets/kanban/mobile/card.js +6 -1
- package/dist/_pkgs/data-view/view-presets/kanban/pc/card.js +6 -1
- package/dist/_pkgs/data-view/view-presets/list/list-view.js +4 -0
- package/dist/_pkgs/data-view/view-presets/table/mobile/row.js +3 -0
- package/dist/_pkgs/data-view/view-presets/table/pc/header/database-header-column.d.ts +3 -1
- package/dist/_pkgs/data-view/view-presets/table/pc/header/database-header-column.js +149 -175
- package/dist/_pkgs/data-view/view-presets/table/pc/row/row.js +6 -0
- package/dist/_pkgs/data-view/widget-presets/tools/presets/view-options/color-rules-menu.d.ts +12 -0
- package/dist/_pkgs/data-view/widget-presets/tools/presets/view-options/color-rules-menu.js +206 -0
- package/dist/_pkgs/data-view/widget-presets/tools/presets/view-options/view-options.js +16 -2
- package/dist/_pkgs/data-view/widget-presets/tools/presets/view-options/view-settings.d.ts +4 -2
- package/dist/_pkgs/data-view/widget-presets/tools/presets/view-options/view-settings.js +11 -2
- package/dist/commands.js +5 -2
- package/dist/host-panels.d.ts +21 -1
- package/dist/host-panels.js +50 -10
- package/dist/interchange.d.ts +1 -0
- package/dist/interchange.js +1 -0
- package/dist/model/headless.d.ts +1 -0
- package/dist/model/headless.js +1 -0
- package/dist/shared/headless.d.ts +1 -0
- package/dist/shared/headless.js +1 -0
- package/dist/translations.js +8 -1
- package/package.json +13 -1
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
var __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
|
|
2
|
+
function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }
|
|
3
|
+
var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
|
|
4
|
+
var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
|
|
5
|
+
var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
|
|
6
|
+
var _, done = false;
|
|
7
|
+
for (var i = decorators.length - 1; i >= 0; i--) {
|
|
8
|
+
var context = {};
|
|
9
|
+
for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
|
|
10
|
+
for (var p in contextIn.access) context.access[p] = contextIn.access[p];
|
|
11
|
+
context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
|
|
12
|
+
var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
|
|
13
|
+
if (kind === "accessor") {
|
|
14
|
+
if (result === void 0) continue;
|
|
15
|
+
if (result === null || typeof result !== "object") throw new TypeError("Object expected");
|
|
16
|
+
if (_ = accept(result.get)) descriptor.get = _;
|
|
17
|
+
if (_ = accept(result.set)) descriptor.set = _;
|
|
18
|
+
if (_ = accept(result.init)) initializers.unshift(_);
|
|
19
|
+
}
|
|
20
|
+
else if (_ = accept(result)) {
|
|
21
|
+
if (kind === "field") initializers.unshift(_);
|
|
22
|
+
else descriptor[key] = _;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
if (target) Object.defineProperty(target, contextIn.name, descriptor);
|
|
26
|
+
done = true;
|
|
27
|
+
};
|
|
28
|
+
var __runInitializers = (this && this.__runInitializers) || function (thisArg, initializers, value) {
|
|
29
|
+
var useValue = arguments.length > 2;
|
|
30
|
+
for (var i = 0; i < initializers.length; i++) {
|
|
31
|
+
value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
|
|
32
|
+
}
|
|
33
|
+
return useValue ? value : void 0;
|
|
34
|
+
};
|
|
35
|
+
import { paletteCarouselPage, paletteCarouselStyles, paletteCarouselWheel, renderPaletteCarousel, } from '../../../../affine-components/color-picker/index.js';
|
|
36
|
+
import { ColorScheme } from '../../../../affine-model/index.js';
|
|
37
|
+
import { css, html, LitElement, nothing } from 'lit';
|
|
38
|
+
import { property, state } from 'lit/decorators.js';
|
|
39
|
+
/**
|
|
40
|
+
* The database colour grid when it has more than one page (ADR 0036
|
|
41
|
+
* amendment of 2026-10-14, "framework pages"): the canvas carousel's own
|
|
42
|
+
* header, list and page (`renderPaletteCarousel`, `paletteCarouselPage`,
|
|
43
|
+
* ADR 0027) above the same `<edgeless-color-panel>` a single page shows.
|
|
44
|
+
*
|
|
45
|
+
* An element, not a render helper as on the canvas: a menu entry is a
|
|
46
|
+
* function the menu calls again on every render, so the page on screen and
|
|
47
|
+
* the open list need a home that outlives one call. Nothing here is
|
|
48
|
+
* persisted; a pick bubbles as the panel's own `select` event.
|
|
49
|
+
*/
|
|
50
|
+
let DataViewColorCarousel = (() => {
|
|
51
|
+
let _classSuper = LitElement;
|
|
52
|
+
let _current_decorators;
|
|
53
|
+
let _current_initializers = [];
|
|
54
|
+
let _current_extraInitializers = [];
|
|
55
|
+
let _direction_decorators;
|
|
56
|
+
let _direction_initializers = [];
|
|
57
|
+
let _direction_extraInitializers = [];
|
|
58
|
+
let _groups_decorators;
|
|
59
|
+
let _groups_initializers = [];
|
|
60
|
+
let _groups_extraInitializers = [];
|
|
61
|
+
let _listOpen_decorators;
|
|
62
|
+
let _listOpen_initializers = [];
|
|
63
|
+
let _listOpen_extraInitializers = [];
|
|
64
|
+
let _pickedIndex_decorators;
|
|
65
|
+
let _pickedIndex_initializers = [];
|
|
66
|
+
let _pickedIndex_extraInitializers = [];
|
|
67
|
+
let _std_decorators;
|
|
68
|
+
let _std_initializers = [];
|
|
69
|
+
let _std_extraInitializers = [];
|
|
70
|
+
return class DataViewColorCarousel extends _classSuper {
|
|
71
|
+
static {
|
|
72
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
73
|
+
_current_decorators = [property({ attribute: false })];
|
|
74
|
+
_direction_decorators = [state()];
|
|
75
|
+
_groups_decorators = [property({ attribute: false })];
|
|
76
|
+
_listOpen_decorators = [state()];
|
|
77
|
+
_pickedIndex_decorators = [state()];
|
|
78
|
+
_std_decorators = [property({ attribute: false })];
|
|
79
|
+
__esDecorate(this, null, _current_decorators, { kind: "accessor", name: "current", static: false, private: false, access: { has: obj => "current" in obj, get: obj => obj.current, set: (obj, value) => { obj.current = value; } }, metadata: _metadata }, _current_initializers, _current_extraInitializers);
|
|
80
|
+
__esDecorate(this, null, _direction_decorators, { kind: "accessor", name: "direction", static: false, private: false, access: { has: obj => "direction" in obj, get: obj => obj.direction, set: (obj, value) => { obj.direction = value; } }, metadata: _metadata }, _direction_initializers, _direction_extraInitializers);
|
|
81
|
+
__esDecorate(this, null, _groups_decorators, { kind: "accessor", name: "groups", static: false, private: false, access: { has: obj => "groups" in obj, get: obj => obj.groups, set: (obj, value) => { obj.groups = value; } }, metadata: _metadata }, _groups_initializers, _groups_extraInitializers);
|
|
82
|
+
__esDecorate(this, null, _listOpen_decorators, { kind: "accessor", name: "listOpen", static: false, private: false, access: { has: obj => "listOpen" in obj, get: obj => obj.listOpen, set: (obj, value) => { obj.listOpen = value; } }, metadata: _metadata }, _listOpen_initializers, _listOpen_extraInitializers);
|
|
83
|
+
__esDecorate(this, null, _pickedIndex_decorators, { kind: "accessor", name: "pickedIndex", static: false, private: false, access: { has: obj => "pickedIndex" in obj, get: obj => obj.pickedIndex, set: (obj, value) => { obj.pickedIndex = value; } }, metadata: _metadata }, _pickedIndex_initializers, _pickedIndex_extraInitializers);
|
|
84
|
+
__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);
|
|
85
|
+
if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
86
|
+
}
|
|
87
|
+
static { this.styles = [
|
|
88
|
+
paletteCarouselStyles,
|
|
89
|
+
css `
|
|
90
|
+
:host {
|
|
91
|
+
display: block;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
.dv-color-carousel {
|
|
95
|
+
display: flex;
|
|
96
|
+
flex-direction: column;
|
|
97
|
+
padding: 4px;
|
|
98
|
+
}
|
|
99
|
+
`,
|
|
100
|
+
]; }
|
|
101
|
+
/** The page on screen: the one the user paged to, else the current colour's. */
|
|
102
|
+
get pageIndex() {
|
|
103
|
+
if (this.pickedIndex !== undefined)
|
|
104
|
+
return this.pickedIndex;
|
|
105
|
+
const holding = this.groups.findIndex(group => group.palettes.some(palette => palette.value === this.current));
|
|
106
|
+
return Math.max(holding, 0);
|
|
107
|
+
}
|
|
108
|
+
updated() {
|
|
109
|
+
if (!this._refocusHeader)
|
|
110
|
+
return;
|
|
111
|
+
this._refocusHeader = false;
|
|
112
|
+
this.renderRoot
|
|
113
|
+
.querySelector('.palette-carousel-name')
|
|
114
|
+
?.focus();
|
|
115
|
+
}
|
|
116
|
+
render() {
|
|
117
|
+
const { groups, listOpen, direction } = this;
|
|
118
|
+
const index = this.pageIndex;
|
|
119
|
+
const page = groups[index];
|
|
120
|
+
if (!page)
|
|
121
|
+
return nothing;
|
|
122
|
+
return html `<div
|
|
123
|
+
class="dv-color-carousel"
|
|
124
|
+
data-orientation="vertical"
|
|
125
|
+
@wheel=${paletteCarouselWheel({
|
|
126
|
+
groups,
|
|
127
|
+
index,
|
|
128
|
+
onPage: this._page,
|
|
129
|
+
open: listOpen,
|
|
130
|
+
})}
|
|
131
|
+
>
|
|
132
|
+
${renderPaletteCarousel({
|
|
133
|
+
groups,
|
|
134
|
+
index,
|
|
135
|
+
onPage: this._page,
|
|
136
|
+
onToggle: this._toggle,
|
|
137
|
+
open: listOpen,
|
|
138
|
+
direction,
|
|
139
|
+
std: this.std,
|
|
140
|
+
theme: ColorScheme.Light,
|
|
141
|
+
})}
|
|
142
|
+
${listOpen
|
|
143
|
+
? nothing
|
|
144
|
+
: paletteCarouselPage({ groups, index, direction }, html `<edgeless-color-panel
|
|
145
|
+
data-testid="dv-color-grid"
|
|
146
|
+
.palettes=${page.palettes}
|
|
147
|
+
.value=${this.current}
|
|
148
|
+
.theme=${ColorScheme.Light}
|
|
149
|
+
.columns=${5}
|
|
150
|
+
></edgeless-color-panel>`)}
|
|
151
|
+
</div>`;
|
|
152
|
+
}
|
|
153
|
+
#current_accessor_storage;
|
|
154
|
+
get current() { return this.#current_accessor_storage; }
|
|
155
|
+
set current(value) { this.#current_accessor_storage = value; }
|
|
156
|
+
#direction_accessor_storage;
|
|
157
|
+
get direction() { return this.#direction_accessor_storage; }
|
|
158
|
+
set direction(value) { this.#direction_accessor_storage = value; }
|
|
159
|
+
#groups_accessor_storage;
|
|
160
|
+
/** The pages, the ten chip colours first (`selectOptionColorPages`). */
|
|
161
|
+
get groups() { return this.#groups_accessor_storage; }
|
|
162
|
+
set groups(value) { this.#groups_accessor_storage = value; }
|
|
163
|
+
#listOpen_accessor_storage;
|
|
164
|
+
get listOpen() { return this.#listOpen_accessor_storage; }
|
|
165
|
+
set listOpen(value) { this.#listOpen_accessor_storage = value; }
|
|
166
|
+
#pickedIndex_accessor_storage;
|
|
167
|
+
get pickedIndex() { return this.#pickedIndex_accessor_storage; }
|
|
168
|
+
set pickedIndex(value) { this.#pickedIndex_accessor_storage = value; }
|
|
169
|
+
#std_accessor_storage;
|
|
170
|
+
/** Only for the header's own wording ("Choose a palette"). */
|
|
171
|
+
get std() { return this.#std_accessor_storage; }
|
|
172
|
+
set std(value) { this.#std_accessor_storage = value; }
|
|
173
|
+
constructor() {
|
|
174
|
+
super(...arguments);
|
|
175
|
+
this._refocusHeader = false;
|
|
176
|
+
this._page = (index, direction) => {
|
|
177
|
+
this.pickedIndex = index;
|
|
178
|
+
this.direction = direction;
|
|
179
|
+
};
|
|
180
|
+
/**
|
|
181
|
+
* Closing the list removes the button that had the focus; the keyboard
|
|
182
|
+
* path goes on from the header, one Tab away from the new page's grid.
|
|
183
|
+
*/
|
|
184
|
+
this._toggle = (open) => {
|
|
185
|
+
this._refocusHeader =
|
|
186
|
+
!open && this.listOpen && !!this.shadowRoot?.activeElement;
|
|
187
|
+
this.listOpen = open;
|
|
188
|
+
};
|
|
189
|
+
this.#current_accessor_storage = __runInitializers(this, _current_initializers, null);
|
|
190
|
+
this.#direction_accessor_storage = (__runInitializers(this, _current_extraInitializers), __runInitializers(this, _direction_initializers, 'settle'));
|
|
191
|
+
this.#groups_accessor_storage = (__runInitializers(this, _direction_extraInitializers), __runInitializers(this, _groups_initializers, []));
|
|
192
|
+
this.#listOpen_accessor_storage = (__runInitializers(this, _groups_extraInitializers), __runInitializers(this, _listOpen_initializers, false));
|
|
193
|
+
this.#pickedIndex_accessor_storage = (__runInitializers(this, _listOpen_extraInitializers), __runInitializers(this, _pickedIndex_initializers, undefined));
|
|
194
|
+
this.#std_accessor_storage = (__runInitializers(this, _pickedIndex_extraInitializers), __runInitializers(this, _std_initializers, undefined));
|
|
195
|
+
__runInitializers(this, _std_extraInitializers);
|
|
196
|
+
}
|
|
197
|
+
};
|
|
198
|
+
})();
|
|
199
|
+
export { DataViewColorCarousel };
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { type FrameworkPalette, type NamedPalette, type PaletteGroup } from '../../../../affine-components/color-picker/index.js';
|
|
2
|
+
import type { MenuConfig } from '../../../../affine-components/context-menu/index.js';
|
|
3
|
+
import { type ChromeWording } from '../../../../affine-shared/services/index.js';
|
|
4
|
+
import type { BlockStdScope } from '../../../../std/index.js';
|
|
5
|
+
/**
|
|
6
|
+
* The select options' palette as the canvas swatch grid's palettes. A
|
|
7
|
+
* swatch's value is the option colour string itself, so a pick writes what
|
|
8
|
+
* the former menu rows wrote (ADR 0036 amendment of 2026-10-14). The grid
|
|
9
|
+
* gets no `std` (a popup renders outside the editor), so it shows a label
|
|
10
|
+
* wording's fallback: the name is resolved here and handed over as that
|
|
11
|
+
* fallback.
|
|
12
|
+
*/
|
|
13
|
+
export declare function selectOptionColorPalettes(say: (wording: ChromeWording) => string): NamedPalette[];
|
|
14
|
+
/**
|
|
15
|
+
* One framework palette as a page of softened chip colours (ADR 0036
|
|
16
|
+
* amendment of 2026-10-14, "framework pages"): each swatch softened from its
|
|
17
|
+
* light value by `softenedChipColor`, named with the framework's own swatch
|
|
18
|
+
* wording (or the default theme's for the shared neutrals), resolved here as
|
|
19
|
+
* the grid gets no `std`. A value that softens to nothing (transparent) and
|
|
20
|
+
* a second swatch softening to the same string are left out.
|
|
21
|
+
*/
|
|
22
|
+
export declare function softenedFrameworkPalettes(framework: FrameworkPalette, say: (wording: ChromeWording) => string): NamedPalette[];
|
|
23
|
+
/**
|
|
24
|
+
* The pages of the database colour grid: the ten chip colours first, always
|
|
25
|
+
* there, then one page per framework palette this editor registered, in the
|
|
26
|
+
* canvas carousel's order (`contributedFrameworkPalettes`). A palette is
|
|
27
|
+
* registered by its framework's FLAG-GATED view extension, so a framework
|
|
28
|
+
* switched off offers no page: tooling only (ADR 0009), what was picked from
|
|
29
|
+
* it keeps painting. Without `std` (a context outside an editor), the first
|
|
30
|
+
* page alone.
|
|
31
|
+
*/
|
|
32
|
+
export declare function selectOptionColorPages(say: (wording: ChromeWording) => string, std?: BlockStdScope): PaletteGroup[];
|
|
33
|
+
/**
|
|
34
|
+
* The select options' colour picker as one menu entry: the canvas swatch
|
|
35
|
+
* grid (`<edgeless-color-panel>`), the current colour ringed. One copy, read
|
|
36
|
+
* by an option's menu (`multi-tag-select.ts`), by a colour rule's (ADR
|
|
37
|
+
* 0036) and by the kanban group header's, so all pick from the same pages
|
|
38
|
+
* with the same words. A pick closes the menu, as the menu rows it replaces
|
|
39
|
+
* did. With framework pages (`std` given, a framework on), the grid sits
|
|
40
|
+
* under the canvas carousel's header (`<dv-color-carousel>`) and opens on
|
|
41
|
+
* the page that holds the current colour; with the first page alone, the DOM
|
|
42
|
+
* is the single grid it always was.
|
|
43
|
+
*/
|
|
44
|
+
export declare function selectOptionColorGrid(options: {
|
|
45
|
+
current: string | undefined;
|
|
46
|
+
say: (wording: ChromeWording) => string;
|
|
47
|
+
select: (color: string) => void;
|
|
48
|
+
std?: BlockStdScope;
|
|
49
|
+
}): MenuConfig[];
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
import { BASE_PALETTE_KEY, contributedFrameworkPalettes, } from '../../../../affine-components/color-picker/index.js';
|
|
2
|
+
import { PALETTE_GROUP_DEFAULT } from '../../../../affine-components/translations.js';
|
|
3
|
+
import { ColorScheme } from '../../../../affine-model/index.js';
|
|
4
|
+
import { PALETTE_NAME_WORDINGS, } from '../../../../affine-shared/services/index.js';
|
|
5
|
+
import { html } from 'lit';
|
|
6
|
+
import { selectOptionColors } from './colors.js';
|
|
7
|
+
import { softenedChipColor } from './softened-colors.js';
|
|
8
|
+
/**
|
|
9
|
+
* The select options' palette as the canvas swatch grid's palettes. A
|
|
10
|
+
* swatch's value is the option colour string itself, so a pick writes what
|
|
11
|
+
* the former menu rows wrote (ADR 0036 amendment of 2026-10-14). The grid
|
|
12
|
+
* gets no `std` (a popup renders outside the editor), so it shows a label
|
|
13
|
+
* wording's fallback: the name is resolved here and handed over as that
|
|
14
|
+
* fallback.
|
|
15
|
+
*/
|
|
16
|
+
export function selectOptionColorPalettes(say) {
|
|
17
|
+
return selectOptionColors.map(item => ({
|
|
18
|
+
key: item.color,
|
|
19
|
+
value: item.color,
|
|
20
|
+
labelWording: [
|
|
21
|
+
item.wording?.[0] ?? item.name,
|
|
22
|
+
item.wording ? say(item.wording) : item.name,
|
|
23
|
+
],
|
|
24
|
+
}));
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* One framework palette as a page of softened chip colours (ADR 0036
|
|
28
|
+
* amendment of 2026-10-14, "framework pages"): each swatch softened from its
|
|
29
|
+
* light value by `softenedChipColor`, named with the framework's own swatch
|
|
30
|
+
* wording (or the default theme's for the shared neutrals), resolved here as
|
|
31
|
+
* the grid gets no `std`. A value that softens to nothing (transparent) and
|
|
32
|
+
* a second swatch softening to the same string are left out.
|
|
33
|
+
*/
|
|
34
|
+
export function softenedFrameworkPalettes(framework, say) {
|
|
35
|
+
const seen = new Set();
|
|
36
|
+
const page = [];
|
|
37
|
+
for (const palette of framework.palettes) {
|
|
38
|
+
const value = softenedChipColor(palette.value);
|
|
39
|
+
if (!value || seen.has(value))
|
|
40
|
+
continue;
|
|
41
|
+
seen.add(value);
|
|
42
|
+
const wording = palette.labelWording ?? PALETTE_NAME_WORDINGS[palette.key];
|
|
43
|
+
page.push({
|
|
44
|
+
key: palette.key,
|
|
45
|
+
value,
|
|
46
|
+
...(wording ? { labelWording: [wording[0], say(wording)] } : {}),
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
return page;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* The pages of the database colour grid: the ten chip colours first, always
|
|
53
|
+
* there, then one page per framework palette this editor registered, in the
|
|
54
|
+
* canvas carousel's order (`contributedFrameworkPalettes`). A palette is
|
|
55
|
+
* registered by its framework's FLAG-GATED view extension, so a framework
|
|
56
|
+
* switched off offers no page: tooling only (ADR 0009), what was picked from
|
|
57
|
+
* it keeps painting. Without `std` (a context outside an editor), the first
|
|
58
|
+
* page alone.
|
|
59
|
+
*/
|
|
60
|
+
export function selectOptionColorPages(say, std) {
|
|
61
|
+
const base = {
|
|
62
|
+
key: BASE_PALETTE_KEY,
|
|
63
|
+
label: say(PALETTE_GROUP_DEFAULT),
|
|
64
|
+
palettes: selectOptionColorPalettes(say),
|
|
65
|
+
};
|
|
66
|
+
if (!std)
|
|
67
|
+
return [base];
|
|
68
|
+
const frameworks = contributedFrameworkPalettes(std)
|
|
69
|
+
.map(framework => ({
|
|
70
|
+
key: framework.framework,
|
|
71
|
+
label: say(framework.labelWording),
|
|
72
|
+
palettes: softenedFrameworkPalettes(framework, say),
|
|
73
|
+
}))
|
|
74
|
+
.filter(group => group.palettes.length > 0);
|
|
75
|
+
return [base, ...frameworks];
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* The select options' colour picker as one menu entry: the canvas swatch
|
|
79
|
+
* grid (`<edgeless-color-panel>`), the current colour ringed. One copy, read
|
|
80
|
+
* by an option's menu (`multi-tag-select.ts`), by a colour rule's (ADR
|
|
81
|
+
* 0036) and by the kanban group header's, so all pick from the same pages
|
|
82
|
+
* with the same words. A pick closes the menu, as the menu rows it replaces
|
|
83
|
+
* did. With framework pages (`std` given, a framework on), the grid sits
|
|
84
|
+
* under the canvas carousel's header (`<dv-color-carousel>`) and opens on
|
|
85
|
+
* the page that holds the current colour; with the first page alone, the DOM
|
|
86
|
+
* is the single grid it always was.
|
|
87
|
+
*/
|
|
88
|
+
export function selectOptionColorGrid(options) {
|
|
89
|
+
const groups = selectOptionColorPages(options.say, options.std);
|
|
90
|
+
return [
|
|
91
|
+
menu => {
|
|
92
|
+
const onSelect = (event) => {
|
|
93
|
+
event.stopPropagation();
|
|
94
|
+
const color = event.detail.value;
|
|
95
|
+
if (typeof color !== 'string')
|
|
96
|
+
return;
|
|
97
|
+
options.select(color);
|
|
98
|
+
menu.options.onComplete?.();
|
|
99
|
+
menu.close();
|
|
100
|
+
};
|
|
101
|
+
if (groups.length > 1) {
|
|
102
|
+
return html `<dv-color-carousel
|
|
103
|
+
.groups=${groups}
|
|
104
|
+
.current=${options.current ?? null}
|
|
105
|
+
.std=${options.std}
|
|
106
|
+
@select=${onSelect}
|
|
107
|
+
></dv-color-carousel>`;
|
|
108
|
+
}
|
|
109
|
+
// The scheme only picks a side of a dark/light pair; an option colour
|
|
110
|
+
// is a CSS variable string, resolved by the page's own theme.
|
|
111
|
+
return html `<div style="padding: 4px;">
|
|
112
|
+
<edgeless-color-panel
|
|
113
|
+
data-testid="dv-color-grid"
|
|
114
|
+
.palettes=${groups[0]?.palettes ?? []}
|
|
115
|
+
.value=${options.current ?? null}
|
|
116
|
+
.theme=${ColorScheme.Light}
|
|
117
|
+
.columns=${5}
|
|
118
|
+
@select=${onSelect}
|
|
119
|
+
></edgeless-color-panel>
|
|
120
|
+
</div>`;
|
|
121
|
+
},
|
|
122
|
+
];
|
|
123
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type PopupTarget } from '../../../../affine-components/context-menu/index.js';
|
|
2
2
|
import { type ChromeWording } from '../../../../affine-shared/services/index.js';
|
|
3
|
-
import { ShadowlessElement } from '../../../../std/index.js';
|
|
3
|
+
import { type BlockStdScope, ShadowlessElement } from '../../../../std/index.js';
|
|
4
4
|
import { type ReadonlySignal } from '@preact/signals-core';
|
|
5
5
|
import type { SelectTag } from '../../logical/index.js';
|
|
6
6
|
export type TagOptionEdits = 'all' | 'create-rename';
|
|
@@ -59,6 +59,8 @@ export declare class MultiTagSelect extends MultiTagSelect_base {
|
|
|
59
59
|
accessor value: ReadonlySignal<string[]>;
|
|
60
60
|
accessor initialDraftText: string | undefined;
|
|
61
61
|
accessor wording: ((wording: ChromeWording) => string) | undefined;
|
|
62
|
+
/** See `TagSelectOptions.std`: the popup renders outside the editor. */
|
|
63
|
+
accessor std: BlockStdScope | undefined;
|
|
62
64
|
private say;
|
|
63
65
|
}
|
|
64
66
|
declare global {
|
|
@@ -70,6 +72,11 @@ export type TagSelectOptions = {
|
|
|
70
72
|
name: string;
|
|
71
73
|
minWidth?: number;
|
|
72
74
|
container?: HTMLElement;
|
|
75
|
+
/**
|
|
76
|
+
* The editor the opener renders in, for the colour grid's framework pages
|
|
77
|
+
* (ADR 0036 amendment of 2026-10-14); absent, the ten chip colours alone.
|
|
78
|
+
*/
|
|
79
|
+
std?: BlockStdScope;
|
|
73
80
|
} & TagManagerOptions;
|
|
74
81
|
export declare const popTagSelect: (target: PopupTarget, ops: TagSelectOptions) => () => void;
|
|
75
82
|
export {};
|
|
@@ -58,7 +58,8 @@ import { defaultActivators } from '../../utils/wc-dnd/sensors/index.js';
|
|
|
58
58
|
import { createSortContext, sortable, } from '../../utils/wc-dnd/sort/sort-context.js';
|
|
59
59
|
import { verticalListSortingStrategy } from '../../utils/wc-dnd/sort/strategies/index.js';
|
|
60
60
|
import { arrayMove } from '../../utils/wc-dnd/utils/array-move.js';
|
|
61
|
-
import {
|
|
61
|
+
import { selectOptionColorGrid } from './color-menu.js';
|
|
62
|
+
import { getTagColor } from './colors.js';
|
|
62
63
|
import { selectedStyle, selectOptionContentStyle, selectOptionDragHandlerStyle, selectOptionIconStyle, selectOptionNewIconStyle, selectOptionsContainerStyle, selectOptionsTipsStyle, selectOptionStyle, tagContainerStyle, tagDeleteIconStyle, tagSelectContainerStyle, tagSelectInputContainerStyle, tagSelectInputStyle, tagTextStyle, } from './styles-css.js';
|
|
63
64
|
const englishWording = (wording) => wording[1];
|
|
64
65
|
// Parent elements that can hand over a tag draft typed in the table.
|
|
@@ -197,6 +198,9 @@ let MultiTagSelect = (() => {
|
|
|
197
198
|
let _wording_decorators;
|
|
198
199
|
let _wording_initializers = [];
|
|
199
200
|
let _wording_extraInitializers = [];
|
|
201
|
+
let _std_decorators;
|
|
202
|
+
let _std_initializers = [];
|
|
203
|
+
let _std_extraInitializers = [];
|
|
200
204
|
return class MultiTagSelect extends _classSuper {
|
|
201
205
|
static {
|
|
202
206
|
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
@@ -209,6 +213,7 @@ let MultiTagSelect = (() => {
|
|
|
209
213
|
_value_decorators = [property({ attribute: false })];
|
|
210
214
|
_initialDraftText_decorators = [property({ attribute: false })];
|
|
211
215
|
_wording_decorators = [property({ attribute: false })];
|
|
216
|
+
_std_decorators = [property({ attribute: false })];
|
|
212
217
|
__esDecorate(this, null, _mode_decorators, { kind: "accessor", name: "mode", static: false, private: false, access: { has: obj => "mode" in obj, get: obj => obj.mode, set: (obj, value) => { obj.mode = value; } }, metadata: _metadata }, _mode_initializers, _mode_extraInitializers);
|
|
213
218
|
__esDecorate(this, null, _onChange_decorators, { kind: "accessor", name: "onChange", static: false, private: false, access: { has: obj => "onChange" in obj, get: obj => obj.onChange, set: (obj, value) => { obj.onChange = value; } }, metadata: _metadata }, _onChange_initializers, _onChange_extraInitializers);
|
|
214
219
|
__esDecorate(this, null, _onComplete_decorators, { kind: "accessor", name: "onComplete", static: false, private: false, access: { has: obj => "onComplete" in obj, get: obj => obj.onComplete, set: (obj, value) => { obj.onComplete = value; } }, metadata: _metadata }, _onComplete_initializers, _onComplete_extraInitializers);
|
|
@@ -218,6 +223,7 @@ let MultiTagSelect = (() => {
|
|
|
218
223
|
__esDecorate(this, null, _value_decorators, { kind: "accessor", name: "value", static: false, private: false, access: { has: obj => "value" in obj, get: obj => obj.value, set: (obj, value) => { obj.value = value; } }, metadata: _metadata }, _value_initializers, _value_extraInitializers);
|
|
219
224
|
__esDecorate(this, null, _initialDraftText_decorators, { kind: "accessor", name: "initialDraftText", static: false, private: false, access: { has: obj => "initialDraftText" in obj, get: obj => obj.initialDraftText, set: (obj, value) => { obj.initialDraftText = value; } }, metadata: _metadata }, _initialDraftText_initializers, _initialDraftText_extraInitializers);
|
|
220
225
|
__esDecorate(this, null, _wording_decorators, { kind: "accessor", name: "wording", static: false, private: false, access: { has: obj => "wording" in obj, get: obj => obj.wording, set: (obj, value) => { obj.wording = value; } }, metadata: _metadata }, _wording_initializers, _wording_extraInitializers);
|
|
226
|
+
__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);
|
|
221
227
|
if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
222
228
|
}
|
|
223
229
|
get text() {
|
|
@@ -381,6 +387,10 @@ let MultiTagSelect = (() => {
|
|
|
381
387
|
#wording_accessor_storage;
|
|
382
388
|
get wording() { return this.#wording_accessor_storage; }
|
|
383
389
|
set wording(value) { this.#wording_accessor_storage = value; }
|
|
390
|
+
#std_accessor_storage;
|
|
391
|
+
/** See `TagSelectOptions.std`: the popup renders outside the editor. */
|
|
392
|
+
get std() { return this.#std_accessor_storage; }
|
|
393
|
+
set std(value) { this.#std_accessor_storage = value; }
|
|
384
394
|
say(wording) {
|
|
385
395
|
return (this.wording ?? englishWording)(wording);
|
|
386
396
|
}
|
|
@@ -423,24 +433,13 @@ let MultiTagSelect = (() => {
|
|
|
423
433
|
}),
|
|
424
434
|
menu.group({
|
|
425
435
|
name: 'color',
|
|
426
|
-
items:
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
}
|
|
433
|
-
return menu.action({
|
|
434
|
-
name: item.wording ? this.say(item.wording) : item.name,
|
|
435
|
-
prefix: html ` <div style=${styles}></div>`,
|
|
436
|
-
isSelected: option.color === item.color,
|
|
437
|
-
select: () => {
|
|
438
|
-
this.tagManager.changeTag({
|
|
439
|
-
id: option.id,
|
|
440
|
-
color: item.color,
|
|
441
|
-
});
|
|
442
|
-
},
|
|
443
|
-
});
|
|
436
|
+
items: selectOptionColorGrid({
|
|
437
|
+
current: option.color,
|
|
438
|
+
say: wording => this.say(wording),
|
|
439
|
+
std: this.std,
|
|
440
|
+
select: color => {
|
|
441
|
+
this.tagManager.changeTag({ id: option.id, color });
|
|
442
|
+
},
|
|
444
443
|
}),
|
|
445
444
|
}),
|
|
446
445
|
],
|
|
@@ -519,7 +518,8 @@ let MultiTagSelect = (() => {
|
|
|
519
518
|
this.#value_accessor_storage = __runInitializers(this, _value_initializers, void 0);
|
|
520
519
|
this.#initialDraftText_accessor_storage = (__runInitializers(this, _value_extraInitializers), __runInitializers(this, _initialDraftText_initializers, void 0));
|
|
521
520
|
this.#wording_accessor_storage = (__runInitializers(this, _initialDraftText_extraInitializers), __runInitializers(this, _wording_initializers, undefined));
|
|
522
|
-
__runInitializers(this, _wording_extraInitializers);
|
|
521
|
+
this.#std_accessor_storage = (__runInitializers(this, _wording_extraInitializers), __runInitializers(this, _std_initializers, undefined));
|
|
522
|
+
__runInitializers(this, _std_extraInitializers);
|
|
523
523
|
}
|
|
524
524
|
};
|
|
525
525
|
})();
|
|
@@ -626,6 +626,7 @@ export const popTagSelect = (target, ops) => {
|
|
|
626
626
|
component.optionEdits = ops.optionEdits ?? 'all';
|
|
627
627
|
component.initialDraftText = ops.initialDraftText;
|
|
628
628
|
component.wording = ops.wording;
|
|
629
|
+
component.std = ops.std;
|
|
629
630
|
component.onComplete = () => {
|
|
630
631
|
ops.onComplete?.();
|
|
631
632
|
remove();
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import type { Color } from '../../../../affine-model/index.js';
|
|
2
|
+
/**
|
|
3
|
+
* A framework colour SOFTENED into a chip colour (ADR 0036 amendment of
|
|
4
|
+
* 2026-10-14, "framework pages"): one theme-adaptive CSS string,
|
|
5
|
+
*
|
|
6
|
+
* color-mix(in srgb, #rrggbb NN%, var(--affine-v2-layer-background-primary))
|
|
7
|
+
*
|
|
8
|
+
* which reads as a pastel tint on the light page background and as a deep
|
|
9
|
+
* one on the dark, so the chip's primary text stays readable in both, the
|
|
10
|
+
* way the ten `selectOptionColors` do through their own light/dark tokens.
|
|
11
|
+
*
|
|
12
|
+
* The token is spelled LITERALLY, never through `cssVarV2`: a host may
|
|
13
|
+
* rename the theme's variables (the Labre app's `@labre/theme` answers
|
|
14
|
+
* `cssVarV2` with `--labre-v2-*`) and keeps the `--affine-v2-*` names as
|
|
15
|
+
* aliases in every theme scope, so the literal spelling is the one that
|
|
16
|
+
* paints under every host and the one a stored value can rely on forever.
|
|
17
|
+
*/
|
|
18
|
+
export declare const SOFTENED_BACKGROUND_TOKEN = "--affine-v2-layer-background-primary";
|
|
19
|
+
/**
|
|
20
|
+
* The colour's share of a softened swatch, in percent. 30% keeps the light
|
|
21
|
+
* tint pale enough for the light theme's primary text (worst case, black:
|
|
22
|
+
* 8.8:1) and the dark one deep enough for the dark theme's (worst case,
|
|
23
|
+
* white: 5.4:1), measured with the theme's own tokens by
|
|
24
|
+
* `softened-chip-colors.unit.spec.ts` in `@labre/affine`.
|
|
25
|
+
*/
|
|
26
|
+
export declare const SOFTENED_SHARE = 30;
|
|
27
|
+
/**
|
|
28
|
+
* A colour is ALREADY pastel when it is a mix of at most this share of some
|
|
29
|
+
* colour with white. It then keeps its light look exactly: the stored source
|
|
30
|
+
* is that more saturated colour, mixed back at the share that reproduces the
|
|
31
|
+
* pastel on white, so only the dark theme sees it change. 35% is the largest
|
|
32
|
+
* share at which even a white source stays dark enough for the dark theme's
|
|
33
|
+
* primary text (4.6:1; 36% would give 4.4:1).
|
|
34
|
+
*/
|
|
35
|
+
export declare const PASTEL_MAX_SHARE = 35;
|
|
36
|
+
/**
|
|
37
|
+
* The softened chip colour of a framework colour, from its LIGHT value, or
|
|
38
|
+
* `undefined` for a value that is not a plain `#rrggbb` (transparent, a CSS
|
|
39
|
+
* variable, an alpha colour): those offer no swatch.
|
|
40
|
+
*/
|
|
41
|
+
export declare function softenedChipColor(color: Color): string | undefined;
|
|
42
|
+
export declare function isSoftenedChipColor(value: unknown): value is string;
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A framework colour SOFTENED into a chip colour (ADR 0036 amendment of
|
|
3
|
+
* 2026-10-14, "framework pages"): one theme-adaptive CSS string,
|
|
4
|
+
*
|
|
5
|
+
* color-mix(in srgb, #rrggbb NN%, var(--affine-v2-layer-background-primary))
|
|
6
|
+
*
|
|
7
|
+
* which reads as a pastel tint on the light page background and as a deep
|
|
8
|
+
* one on the dark, so the chip's primary text stays readable in both, the
|
|
9
|
+
* way the ten `selectOptionColors` do through their own light/dark tokens.
|
|
10
|
+
*
|
|
11
|
+
* The token is spelled LITERALLY, never through `cssVarV2`: a host may
|
|
12
|
+
* rename the theme's variables (the Labre app's `@labre/theme` answers
|
|
13
|
+
* `cssVarV2` with `--labre-v2-*`) and keeps the `--affine-v2-*` names as
|
|
14
|
+
* aliases in every theme scope, so the literal spelling is the one that
|
|
15
|
+
* paints under every host and the one a stored value can rely on forever.
|
|
16
|
+
*/
|
|
17
|
+
export const SOFTENED_BACKGROUND_TOKEN = '--affine-v2-layer-background-primary';
|
|
18
|
+
/**
|
|
19
|
+
* The colour's share of a softened swatch, in percent. 30% keeps the light
|
|
20
|
+
* tint pale enough for the light theme's primary text (worst case, black:
|
|
21
|
+
* 8.8:1) and the dark one deep enough for the dark theme's (worst case,
|
|
22
|
+
* white: 5.4:1), measured with the theme's own tokens by
|
|
23
|
+
* `softened-chip-colors.unit.spec.ts` in `@labre/affine`.
|
|
24
|
+
*/
|
|
25
|
+
export const SOFTENED_SHARE = 30;
|
|
26
|
+
/**
|
|
27
|
+
* A colour is ALREADY pastel when it is a mix of at most this share of some
|
|
28
|
+
* colour with white. It then keeps its light look exactly: the stored source
|
|
29
|
+
* is that more saturated colour, mixed back at the share that reproduces the
|
|
30
|
+
* pastel on white, so only the dark theme sees it change. 35% is the largest
|
|
31
|
+
* share at which even a white source stays dark enough for the dark theme's
|
|
32
|
+
* primary text (4.6:1; 36% would give 4.4:1).
|
|
33
|
+
*/
|
|
34
|
+
export const PASTEL_MAX_SHARE = 35;
|
|
35
|
+
const LIGHT_BACKGROUND = 255;
|
|
36
|
+
const HEX6 = /^#([0-9a-f]{6})$/i;
|
|
37
|
+
const channels = (hex) => {
|
|
38
|
+
const match = HEX6.exec(hex);
|
|
39
|
+
if (!match?.[1])
|
|
40
|
+
return undefined;
|
|
41
|
+
const value = Number.parseInt(match[1], 16);
|
|
42
|
+
return [(value >> 16) & 0xff, (value >> 8) & 0xff, value & 0xff];
|
|
43
|
+
};
|
|
44
|
+
const toHex = (rgb) => `#${rgb.map(value => value.toString(16).padStart(2, '0')).join('')}`;
|
|
45
|
+
const lightValue = (color) => typeof color === 'string'
|
|
46
|
+
? color
|
|
47
|
+
: 'light' in color
|
|
48
|
+
? color.light
|
|
49
|
+
: color.normal;
|
|
50
|
+
/**
|
|
51
|
+
* The softened chip colour of a framework colour, from its LIGHT value, or
|
|
52
|
+
* `undefined` for a value that is not a plain `#rrggbb` (transparent, a CSS
|
|
53
|
+
* variable, an alpha colour): those offer no swatch.
|
|
54
|
+
*/
|
|
55
|
+
export function softenedChipColor(color) {
|
|
56
|
+
const rgb = channels(lightValue(color));
|
|
57
|
+
if (!rgb)
|
|
58
|
+
return undefined;
|
|
59
|
+
// The smallest share at which this colour is a mix with white.
|
|
60
|
+
const needed = Math.ceil(100 * (1 - Math.min(...rgb) / LIGHT_BACKGROUND));
|
|
61
|
+
const pastel = needed <= PASTEL_MAX_SHARE;
|
|
62
|
+
const share = pastel ? Math.max(needed, SOFTENED_SHARE) : SOFTENED_SHARE;
|
|
63
|
+
const ratio = share / 100;
|
|
64
|
+
const source = pastel
|
|
65
|
+
? rgb.map(value => Math.min(255, Math.max(0, Math.round((value - (1 - ratio) * LIGHT_BACKGROUND) / ratio))))
|
|
66
|
+
: rgb;
|
|
67
|
+
return `color-mix(in srgb, ${toHex(source)} ${share}%, var(${SOFTENED_BACKGROUND_TOKEN}))`;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Exactly the shape {@link softenedChipColor} writes, and nothing else: one
|
|
71
|
+
* lowercase `#rrggbb`, an integer share from 1 to 100, the one background
|
|
72
|
+
* token. A stored string goes into a style only through this check or the
|
|
73
|
+
* palette list (ADR 0036 §4), so a crafted value (a second declaration, a
|
|
74
|
+
* `url(`, another variable) is refused, not painted.
|
|
75
|
+
*/
|
|
76
|
+
const SOFTENED_CHIP_COLOR = new RegExp(`^color-mix\\(in srgb, #[0-9a-f]{6} (?:100|[1-9][0-9]?)%, var\\(${SOFTENED_BACKGROUND_TOKEN}\\)\\)$`);
|
|
77
|
+
export function isSoftenedChipColor(value) {
|
|
78
|
+
return typeof value === 'string' && SOFTENED_CHIP_COLOR.test(value);
|
|
79
|
+
}
|