@formicoidea/labre-core 0.32.0 → 0.33.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/attachment-block.js +1 -1
- package/dist/_pkgs/affine-block-callout/callout-block.js +1 -1
- package/dist/_pkgs/affine-block-code/code-block-inline.js +1 -1
- package/dist/_pkgs/affine-block-code/code-toolbar/config.js +3 -1
- package/dist/_pkgs/affine-block-code/code-toolbar/index.js +1 -1
- package/dist/_pkgs/affine-block-database/data-source.js +1 -2
- package/dist/_pkgs/affine-block-database/external-data-source.js +1 -1
- package/dist/_pkgs/affine-block-edgeless-text/edgeless-text-block.js +1 -1
- package/dist/_pkgs/affine-block-edgeless-text/edgeless-toolbar/config.js +1 -1
- package/dist/_pkgs/affine-block-embed/embed-figma-block/embed-figma-service.js +1 -1
- package/dist/_pkgs/affine-block-embed/embed-iframe-block/configs/toolbar.js +2 -2
- package/dist/_pkgs/affine-block-embed-doc/embed-linked-doc-block/configs/toolbar.js +1 -1
- package/dist/_pkgs/affine-block-embed-doc/embed-linked-doc-block/utils.js +1 -1
- package/dist/_pkgs/affine-block-embed-doc/embed-synced-doc-block/configs/toolbar.js +1 -1
- package/dist/_pkgs/affine-block-embed-doc/embed-synced-doc-block/embed-synced-doc-block.js +1 -1
- package/dist/_pkgs/affine-block-frame/frame-manager.js +3 -1
- package/dist/_pkgs/affine-block-frame/frame-tool.js +1 -1
- package/dist/_pkgs/affine-block-image/components/page-image-block.js +1 -1
- package/dist/_pkgs/affine-block-image/image-edgeless-block.js +1 -1
- package/dist/_pkgs/affine-block-list/utils/forward-delete.js +1 -1
- package/dist/_pkgs/affine-block-note/commands/select-block.js +1 -1
- package/dist/_pkgs/affine-block-note/commands/select-blocks-between.js +1 -1
- package/dist/_pkgs/affine-block-note/move-block.js +1 -1
- package/dist/_pkgs/affine-block-paragraph/utils/forward-delete.js +2 -2
- package/dist/_pkgs/affine-block-paragraph/utils/merge-with-prev.js +1 -1
- package/dist/_pkgs/affine-block-root/edgeless/configs/toolbar/more.js +1 -1
- package/dist/_pkgs/affine-block-root/edgeless/edgeless-keyboard.js +1 -1
- package/dist/_pkgs/affine-block-root/edgeless/utils/clipboard-utils.js +1 -1
- package/dist/_pkgs/affine-block-surface/adapters/markdown/element-adapter/type.js +1 -1
- package/dist/_pkgs/affine-block-surface/adapters/plain-text/element-adapter/type.js +1 -1
- package/dist/_pkgs/affine-block-surface/element-model/index.d.ts +18 -3
- package/dist/_pkgs/affine-block-surface/element-model/index.js +12 -2
- package/dist/_pkgs/affine-block-surface/extensions/audit.js +23 -6
- package/dist/_pkgs/affine-block-surface/extensions/crud-extension.js +10 -5
- package/dist/_pkgs/affine-block-surface/extensions/editor-anchored-panel.js +2 -1
- package/dist/_pkgs/affine-block-surface/extensions/element-renderer.js +1 -1
- package/dist/_pkgs/affine-block-surface/extensions/export-manager/export-manager.js +1 -1
- 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 +172 -0
- package/dist/_pkgs/affine-block-surface/extensions/interchange-import.js +393 -0
- package/dist/_pkgs/affine-block-surface/extensions/interchange.d.ts +306 -0
- package/dist/_pkgs/affine-block-surface/extensions/interchange.js +64 -0
- package/dist/_pkgs/affine-block-surface/extensions/map-quality-widget.js +61 -61
- package/dist/_pkgs/affine-block-surface/extensions/morph-toolbar.d.ts +248 -0
- package/dist/_pkgs/affine-block-surface/extensions/morph-toolbar.js +248 -0
- package/dist/_pkgs/affine-block-surface/extensions/reading-widget.js +78 -80
- package/dist/_pkgs/affine-block-surface/extensions/reading.js +2 -2
- package/dist/_pkgs/affine-block-surface/extensions/svg-sketch.d.ts +107 -0
- package/dist/_pkgs/affine-block-surface/extensions/svg-sketch.js +958 -0
- package/dist/_pkgs/affine-block-surface/extensions/validation.d.ts +809 -20
- package/dist/_pkgs/affine-block-surface/extensions/validation.js +1661 -50
- package/dist/_pkgs/affine-block-surface/extensions/violation-detail-widget.d.ts +50 -6
- package/dist/_pkgs/affine-block-surface/extensions/violation-detail-widget.js +129 -32
- package/dist/_pkgs/affine-block-surface/framework-background/def.d.ts +289 -0
- package/dist/_pkgs/affine-block-surface/framework-background/def.js +126 -1
- package/dist/_pkgs/affine-block-surface/framework-background/labels.d.ts +42 -2
- package/dist/_pkgs/affine-block-surface/framework-background/labels.js +80 -4
- package/dist/_pkgs/affine-block-surface/framework-background/renderer.js +172 -11
- package/dist/_pkgs/affine-block-surface/renderer/overlay.js +1 -1
- package/dist/_pkgs/affine-block-surface-ref/portal/note.js +2 -2
- package/dist/_pkgs/affine-block-table/commands.js +1 -1
- package/dist/_pkgs/affine-components/edgeless-shape-color-picker/color-picker.js +1 -1
- package/dist/_pkgs/affine-components/embed-card-modal/embed-card-edit-modal.js +1 -1
- package/dist/_pkgs/affine-components/filterable-list/styles.js +1 -1
- package/dist/_pkgs/affine-components/peek/peekable.js +1 -1
- package/dist/_pkgs/affine-components/toolbar/index.d.ts +1 -0
- package/dist/_pkgs/affine-components/toolbar/index.js +1 -0
- package/dist/_pkgs/affine-components/toolbar/menu-button.js +1 -1
- package/dist/_pkgs/affine-components/toolbar/picker-menu.d.ts +55 -0
- package/dist/_pkgs/affine-components/toolbar/picker-menu.js +47 -0
- package/dist/_pkgs/affine-fragment-frame-panel/body/frame-panel-body.js +2 -2
- package/dist/_pkgs/affine-fragment-frame-panel/header/frame-panel-header.js +2 -2
- package/dist/_pkgs/affine-fragment-frame-panel/header/frames-setting-menu.js +1 -1
- package/dist/_pkgs/affine-fragment-outline/mobile-outline-panel.js +1 -1
- package/dist/_pkgs/affine-gfx-brush/toolbar/components/pen/pen-tool-button.js +1 -1
- package/dist/_pkgs/affine-gfx-connector/connector-manager.js +7 -10
- package/dist/_pkgs/affine-gfx-connector/connector-tool.d.ts +19 -1
- package/dist/_pkgs/affine-gfx-connector/connector-tool.js +10 -2
- package/dist/_pkgs/affine-gfx-connector/connector-watcher.js +1 -4
- package/dist/_pkgs/affine-gfx-connector/direction/direction-reveal.js +2 -1
- package/dist/_pkgs/affine-gfx-connector/direction/invert-direction.js +1 -3
- package/dist/_pkgs/affine-gfx-connector/element-renderer/index.js +1 -1
- package/dist/_pkgs/affine-gfx-connector/element-renderer/utils.js +1 -1
- package/dist/_pkgs/affine-gfx-connector/toolbar/config.js +1 -1
- package/dist/_pkgs/affine-gfx-mindmap/adapter/markdown/index.js +1 -1
- package/dist/_pkgs/affine-gfx-mindmap/adapter/utils.js +1 -1
- package/dist/_pkgs/affine-gfx-mindmap/templates/index.js +583 -4
- package/dist/_pkgs/affine-gfx-mindmap/toolbar/mindmap-menu.js +23 -23
- package/dist/_pkgs/affine-gfx-mindmap/toolbar/mindmap-tool-button.js +5 -1
- package/dist/_pkgs/affine-gfx-mindmap/view/utils.js +1 -1
- package/dist/_pkgs/affine-gfx-note/overlay/overlay.js +1 -1
- package/dist/_pkgs/affine-gfx-note/toolbar/note-senior-button.js +1 -1
- package/dist/_pkgs/affine-gfx-shape/consts.js +1 -1
- package/dist/_pkgs/affine-gfx-shape/draggable/shape-draggable.js +1 -1
- package/dist/_pkgs/affine-gfx-shape/element-renderer/shape/polygon.js +17 -9
- package/dist/_pkgs/affine-gfx-shape/element-renderer/shape/utils.js +8 -3
- package/dist/_pkgs/affine-gfx-shape/element-view.js +19 -12
- package/dist/_pkgs/affine-gfx-shape/overlay/polygon-drawing-overlay.js +1 -1
- package/dist/_pkgs/affine-gfx-shape/overlay/polygon-vertex-editing-overlay.js +12 -7
- package/dist/_pkgs/affine-gfx-shape/overlay/shape-overlay.js +1 -1
- package/dist/_pkgs/affine-gfx-shape/polygon-tool.js +4 -2
- package/dist/_pkgs/affine-gfx-shape/shape-tool.js +1 -1
- package/dist/_pkgs/affine-gfx-shape/text/edgeless-shape-text-editor.js +1 -3
- package/dist/_pkgs/affine-gfx-template/builtin/other.js +66 -17
- package/dist/_pkgs/affine-gfx-template/toolbar/overlay-scrollbar.js +1 -1
- package/dist/_pkgs/affine-gfx-template/toolbar/template-panel.js +1 -1
- package/dist/_pkgs/affine-gfx-text/toolbar/actions.js +1 -1
- package/dist/_pkgs/affine-inline-link/command.js +1 -1
- package/dist/_pkgs/affine-inline-preset/command/format-block.js +1 -1
- package/dist/_pkgs/affine-inline-preset/command/format-native.js +2 -2
- package/dist/_pkgs/affine-inline-preset/command/format-text.js +1 -1
- package/dist/_pkgs/affine-inline-preset/inline-spec.js +1 -1
- package/dist/_pkgs/affine-inline-reference/reference-node/reference-node.js +1 -1
- package/dist/_pkgs/affine-model/elements/bpmn/node.d.ts +40 -7
- package/dist/_pkgs/affine-model/elements/bpmn/node.js +4 -2
- package/dist/_pkgs/affine-model/elements/bpmn/pool.d.ts +74 -17
- package/dist/_pkgs/affine-model/elements/bpmn/pool.js +55 -26
- package/dist/_pkgs/affine-model/elements/c4/board.d.ts +88 -0
- package/dist/_pkgs/affine-model/elements/c4/board.js +128 -0
- package/dist/_pkgs/affine-model/elements/c4/boundary.d.ts +63 -0
- package/dist/_pkgs/affine-model/elements/c4/boundary.js +134 -0
- package/dist/_pkgs/affine-model/elements/c4/index.d.ts +3 -0
- package/dist/_pkgs/affine-model/elements/c4/index.js +3 -0
- package/dist/_pkgs/affine-model/elements/c4/node.d.ts +97 -0
- package/dist/_pkgs/affine-model/elements/c4/node.js +130 -0
- package/dist/_pkgs/affine-model/elements/connector/connector.js +1 -1
- package/dist/_pkgs/affine-model/elements/context-map/context-map.d.ts +27 -0
- package/dist/_pkgs/affine-model/elements/context-map/context-map.js +94 -0
- package/dist/_pkgs/affine-model/elements/context-map/index.d.ts +1 -0
- package/dist/_pkgs/affine-model/elements/context-map/index.js +1 -0
- package/dist/_pkgs/affine-model/elements/core-domain/core-domain.d.ts +34 -17
- package/dist/_pkgs/affine-model/elements/core-domain/core-domain.js +28 -26
- package/dist/_pkgs/affine-model/elements/event-storming/event-storming.d.ts +36 -0
- package/dist/_pkgs/affine-model/elements/event-storming/event-storming.js +103 -0
- package/dist/_pkgs/affine-model/elements/event-storming/index.d.ts +1 -0
- package/dist/_pkgs/affine-model/elements/event-storming/index.js +1 -0
- package/dist/_pkgs/affine-model/elements/index.d.ts +11 -0
- package/dist/_pkgs/affine-model/elements/index.js +3 -0
- package/dist/_pkgs/affine-model/elements/shape/api/polygon.js +2 -8
- package/dist/_pkgs/affine-shared/adapters/html/block-adapter.js +1 -1
- package/dist/_pkgs/affine-shared/adapters/markdown/block-adapter.js +1 -1
- package/dist/_pkgs/affine-shared/adapters/markdown/delta-converter.js +1 -1
- package/dist/_pkgs/affine-shared/adapters/notion-html/block-adapter.js +1 -1
- package/dist/_pkgs/affine-shared/adapters/notion-html/delta-converter.js +1 -1
- package/dist/_pkgs/affine-shared/adapters/plain-text/block-adapter.js +1 -1
- package/dist/_pkgs/affine-shared/adapters/plain-text/delta-converter.js +1 -1
- package/dist/_pkgs/affine-shared/adapters/utils/color.js +5 -2
- package/dist/_pkgs/affine-shared/commands/model-crud/draft-selected-models.js +1 -1
- package/dist/_pkgs/affine-shared/commands/selection/focus-block-end.js +1 -1
- package/dist/_pkgs/affine-shared/commands/selection/focus-block-start.js +1 -1
- package/dist/_pkgs/affine-shared/consts/index.d.ts +10 -0
- package/dist/_pkgs/affine-shared/consts/index.js +10 -0
- package/dist/_pkgs/affine-shared/services/artefact-catalogue-service.d.ts +55 -0
- package/dist/_pkgs/affine-shared/services/artefact-catalogue-service.js +35 -0
- package/dist/_pkgs/affine-shared/services/audit-service.d.ts +11 -0
- package/dist/_pkgs/affine-shared/services/command-usage-service.d.ts +31 -0
- package/dist/_pkgs/affine-shared/services/command-usage-service.js +109 -0
- package/dist/_pkgs/affine-shared/services/comment-service/block-comment-manager.js +1 -1
- package/dist/_pkgs/affine-shared/services/doc-display-meta-service.js +1 -1
- package/dist/_pkgs/affine-shared/services/embed-iframe/embed-iframe-config.js +1 -1
- 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/pivot-materiality-publisher.js +2 -1
- package/dist/_pkgs/affine-shared/services/telemetry-service/lifecycle.d.ts +73 -1
- package/dist/_pkgs/affine-shared/services/toolbar-service/registry.d.ts +44 -0
- package/dist/_pkgs/affine-shared/services/toolbar-service/registry.js +161 -3
- package/dist/_pkgs/affine-shared/services/universe-tag-defs-service.js +5 -3
- package/dist/_pkgs/affine-shared/test-utils/affine-template.js +1 -1
- package/dist/_pkgs/affine-shared/utils/edgeless.js +1 -1
- package/dist/_pkgs/affine-shared/utils/file/filesys.d.ts +34 -0
- package/dist/_pkgs/affine-shared/utils/file/filesys.js +48 -7
- package/dist/_pkgs/affine-shared/utils/zod-schema.js +1 -3
- package/dist/_pkgs/affine-widget-drag-handle/utils.js +1 -1
- package/dist/_pkgs/affine-widget-edgeless-auto-connect/index.js +1 -1
- package/dist/_pkgs/affine-widget-edgeless-dragging-area/edgeless-dragging-area-rect.js +1 -1
- package/dist/_pkgs/affine-widget-edgeless-toolbar/catalogue/artefact-catalogue-default.d.ts +14 -0
- package/dist/_pkgs/affine-widget-edgeless-toolbar/catalogue/artefact-catalogue-default.js +40 -0
- package/dist/_pkgs/affine-widget-edgeless-toolbar/catalogue/artefact-catalogue-widget.d.ts +158 -0
- package/dist/_pkgs/affine-widget-edgeless-toolbar/catalogue/artefact-catalogue-widget.js +572 -0
- package/dist/_pkgs/affine-widget-edgeless-toolbar/catalogue/catalogue-groups.d.ts +46 -0
- package/dist/_pkgs/affine-widget-edgeless-toolbar/catalogue/catalogue-groups.js +66 -0
- package/dist/_pkgs/affine-widget-edgeless-toolbar/catalogue/chord-format.d.ts +13 -0
- package/dist/_pkgs/affine-widget-edgeless-toolbar/catalogue/chord-format.js +50 -0
- package/dist/_pkgs/affine-widget-edgeless-toolbar/edgeless-toolbar.d.ts +6 -0
- package/dist/_pkgs/affine-widget-edgeless-toolbar/edgeless-toolbar.js +15 -5
- package/dist/_pkgs/affine-widget-edgeless-toolbar/effects.d.ts +2 -0
- package/dist/_pkgs/affine-widget-edgeless-toolbar/effects.js +2 -0
- package/dist/_pkgs/affine-widget-edgeless-toolbar/extension/index.d.ts +7 -0
- package/dist/_pkgs/affine-widget-edgeless-toolbar/index.d.ts +4 -0
- package/dist/_pkgs/affine-widget-edgeless-toolbar/index.js +4 -0
- package/dist/_pkgs/affine-widget-edgeless-toolbar/menu/command-menu.d.ts +19 -0
- package/dist/_pkgs/affine-widget-edgeless-toolbar/menu/command-menu.js +51 -10
- package/dist/_pkgs/affine-widget-edgeless-toolbar/view.js +9 -0
- package/dist/_pkgs/affine-widget-keyboard-toolbar/keyboard-tool-panel.js +1 -1
- package/dist/_pkgs/affine-widget-linked-doc/import-doc/import-doc.js +1 -1
- package/dist/_pkgs/affine-widget-linked-doc/linked-doc-popover.js +1 -1
- package/dist/_pkgs/affine-widget-page-dragging-area/index.js +1 -1
- package/dist/_pkgs/affine-widget-remote-selection/doc/doc-remote-selection.js +1 -1
- package/dist/_pkgs/affine-widget-toolbar/toolbar.js +6 -2
- package/dist/_pkgs/affine-widget-toolbar/utils.js +6 -2
- package/dist/_pkgs/data-view/view-presets/calendar/pc/actions.js +8 -12
- package/dist/_pkgs/data-view/view-presets/calendar/pc/view.js +52 -40
- package/dist/_pkgs/data-view/view-presets/table/mobile/group.js +3 -1
- package/dist/_pkgs/data-view/view-presets/table/pc/group.js +3 -1
- package/dist/_pkgs/std/clipboard/utils.js +4 -1
- package/dist/_pkgs/std/extension/command-registry.d.ts +159 -5
- package/dist/_pkgs/std/extension/command-registry.js +202 -4
- package/dist/_pkgs/std/extension/shortcut.js +2 -1
- package/dist/_pkgs/std/gfx/grid.js +1 -1
- package/dist/_pkgs/std/gfx/index.d.ts +1 -1
- package/dist/_pkgs/std/gfx/model/surface/element-model.d.ts +160 -0
- package/dist/_pkgs/std/gfx/model/surface/element-model.js +75 -1
- package/dist/_pkgs/std/gfx/model/surface/role.js +5 -3
- package/dist/_pkgs/std/gfx/model/surface/surface-model.js +2 -1
- package/dist/_pkgs/std/gfx/selection.js +1 -1
- package/dist/_pkgs/std/gfx/viewport.js +1 -1
- package/dist/_pkgs/std/inline/extensions/inline-manager.js +1 -1
- package/dist/_pkgs/std/inline/extensions/markdown-matcher.js +1 -1
- package/dist/_pkgs/store/model/store/crud.js +4 -1
- package/dist/commands.js +1 -1
- package/dist/extensions/command-usage.d.ts +23 -0
- package/dist/extensions/command-usage.js +37 -0
- package/dist/extensions/view.js +12 -0
- package/dist/frameworks.js +32 -0
- package/dist/translations.js +90 -2
- package/package.json +1 -1
|
@@ -355,43 +355,43 @@ let EdgelessMindmapMenu = (() => {
|
|
|
355
355
|
const showNext = dragOut && !cancelled;
|
|
356
356
|
const isActive = this._style$.value === mindMap.style;
|
|
357
357
|
return html `
|
|
358
|
-
|
|
359
|
-
|
|
358
|
+
<div class="mindmap-item" data-is-active=${isActive}>
|
|
359
|
+
${isBeingDragged
|
|
360
360
|
? html `<button
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
361
|
+
style="transform: translateY(${showNext ? 0 : 64}px)"
|
|
362
|
+
class="next"
|
|
363
|
+
>
|
|
364
|
+
${mindMap.icon}
|
|
365
|
+
</button>`
|
|
366
366
|
: nothing}
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
367
|
+
<button
|
|
368
|
+
style="opacity: ${isBeingDragged ? 0 : 1}"
|
|
369
|
+
@mousedown=${(e) => {
|
|
370
370
|
this.draggableController.onMouseDown(e, {
|
|
371
371
|
preview: mindMap.icon,
|
|
372
372
|
data: mindMap,
|
|
373
373
|
standardWidth: 350,
|
|
374
374
|
});
|
|
375
375
|
}}
|
|
376
|
-
|
|
376
|
+
@touchstart=${(e) => {
|
|
377
377
|
this.draggableController.onTouchStart(e, {
|
|
378
378
|
preview: mindMap.icon,
|
|
379
379
|
data: mindMap,
|
|
380
380
|
standardWidth: 350,
|
|
381
381
|
});
|
|
382
382
|
}}
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
383
|
+
@click=${() => this.onActiveStyleChange?.(mindMap.style)}
|
|
384
|
+
>
|
|
385
|
+
${mindMap.icon}
|
|
386
|
+
</button>
|
|
387
|
+
<affine-tooltip tip-position="top" .offset=${12}>
|
|
388
|
+
<affine-tooltip-content-with-shortcut
|
|
389
|
+
data-tip="${'Mind Map'}"
|
|
390
|
+
data-shortcup="${'M'}"
|
|
391
|
+
></affine-tooltip-content-with-shortcut>
|
|
392
|
+
</affine-tooltip>
|
|
393
|
+
</div>
|
|
394
|
+
`;
|
|
395
395
|
})}
|
|
396
396
|
${this.std.store
|
|
397
397
|
.get(FeatureFlagService)
|
|
@@ -314,7 +314,11 @@ let EdgelessMindmapToolButton = (() => {
|
|
|
314
314
|
return html `<edgeless-toolbar-button
|
|
315
315
|
class="edgeless-mindmap-button"
|
|
316
316
|
?withHover=${true}
|
|
317
|
-
.tooltip=${popper
|
|
317
|
+
.tooltip=${popper
|
|
318
|
+
? ''
|
|
319
|
+
: this.variant === 'mindmap'
|
|
320
|
+
? 'Mind Map'
|
|
321
|
+
: 'Others'}
|
|
318
322
|
.tooltipOffset=${4}
|
|
319
323
|
@click=${this._toggleMenu}
|
|
320
324
|
style="width: 100%; height: 100%; display: inline-block"
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { fitContent } from '../../affine-gfx-shape/index.js';
|
|
2
2
|
import { applyNodeStyle, LayoutType, } from '../../affine-model/index.js';
|
|
3
3
|
import { assertType } from '../../global/utils/index.js';
|
|
4
|
-
import { generateKeyBetween
|
|
4
|
+
import { generateKeyBetween } from '../../std/gfx/index.js';
|
|
5
5
|
import isEqual from 'lodash-es/isEqual.js';
|
|
6
6
|
import last from 'lodash-es/last.js';
|
|
7
7
|
import * as Y from 'yjs';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { getSurfaceComponent, ToolOverlay
|
|
1
|
+
import { getSurfaceComponent, ToolOverlay } from '../../affine-block-surface/index.js';
|
|
2
2
|
import { DefaultTheme } from '../../affine-model/index.js';
|
|
3
3
|
import { ThemeProvider } from '../../affine-shared/services/index.js';
|
|
4
4
|
import { effect } from '@preact/signals-core';
|
|
@@ -33,7 +33,7 @@ var __runInitializers = (this && this.__runInitializers) || function (thisArg, i
|
|
|
33
33
|
return useValue ? value : void 0;
|
|
34
34
|
};
|
|
35
35
|
import { Heading1Icon, LinkIcon, TextIcon, } from '../../affine-components/icons/index.js';
|
|
36
|
-
import { EditPropsStore, ThemeProvider
|
|
36
|
+
import { EditPropsStore, ThemeProvider } from '../../affine-shared/services/index.js';
|
|
37
37
|
import { EdgelessToolbarToolMixin } from '../../affine-widget-edgeless-toolbar/index.js';
|
|
38
38
|
import { SignalWatcher } from '../../global/lit/index.js';
|
|
39
39
|
import { computed } from '@preact/signals-core';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { DEFAULT_ROUGHNESS, LineWidth, StrokeStyle
|
|
1
|
+
import { DEFAULT_ROUGHNESS, LineWidth, StrokeStyle } from '../affine-model/index.js';
|
|
2
2
|
export const SHAPE_OVERLAY_WIDTH = 100;
|
|
3
3
|
export const SHAPE_OVERLAY_HEIGHT = 100;
|
|
4
4
|
export const SHAPE_OVERLAY_OFFSET_X = 6;
|
|
@@ -33,7 +33,7 @@ var __runInitializers = (this && this.__runInitializers) || function (thisArg, i
|
|
|
33
33
|
return useValue ? value : void 0;
|
|
34
34
|
};
|
|
35
35
|
import { CanvasElementType, DefaultTool, EdgelessCRUDIdentifier, } from '../../affine-block-surface/index.js';
|
|
36
|
-
import { getShapeRadius, getShapeType, ShapeType
|
|
36
|
+
import { getShapeRadius, getShapeType, ShapeType } from '../../affine-model/index.js';
|
|
37
37
|
import { EditPropsStore, TelemetryProvider, ThemeProvider, ViewportElementProvider, } from '../../affine-shared/services/index.js';
|
|
38
38
|
import { EdgelessDraggableElementController, EdgelessToolbarToolMixin, } from '../../affine-widget-edgeless-toolbar/index.js';
|
|
39
39
|
import { SignalWatcher } from '../../global/lit/index.js';
|
|
@@ -29,11 +29,11 @@ export function polygon(model, ctx, matrix, renderer, rc, colors) {
|
|
|
29
29
|
else {
|
|
30
30
|
// Convert normalized vertices to absolute coordinates for rough.js
|
|
31
31
|
const absPoints = vertices.map(v => [v[0] * renderWidth, v[1] * renderHeight]);
|
|
32
|
-
const smoothFlags = 'smoothFlags' in model && model.smoothFlags
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
32
|
+
const smoothFlags = 'smoothFlags' in model && model.smoothFlags ? model.smoothFlags : null;
|
|
33
|
+
const controlPoints = 'controlPoints' in model &&
|
|
34
|
+
model.controlPoints
|
|
35
|
+
? model
|
|
36
|
+
.controlPoints
|
|
37
37
|
: null;
|
|
38
38
|
const hasBezier = smoothFlags && smoothFlags.some(f => f);
|
|
39
39
|
if (hasBezier) {
|
|
@@ -52,8 +52,12 @@ export function polygon(model, ctx, matrix, renderer, rc, colors) {
|
|
|
52
52
|
let cp1x, cp1y;
|
|
53
53
|
const customCurr = controlPoints?.[i];
|
|
54
54
|
if (currSmooth) {
|
|
55
|
-
cp1x = customCurr
|
|
56
|
-
|
|
55
|
+
cp1x = customCurr
|
|
56
|
+
? customCurr[2] * renderWidth
|
|
57
|
+
: cx + (nx - cx) / 3;
|
|
58
|
+
cp1y = customCurr
|
|
59
|
+
? customCurr[3] * renderHeight
|
|
60
|
+
: cy + (ny - cy) / 3;
|
|
57
61
|
}
|
|
58
62
|
else {
|
|
59
63
|
cp1x = cx;
|
|
@@ -62,8 +66,12 @@ export function polygon(model, ctx, matrix, renderer, rc, colors) {
|
|
|
62
66
|
let cp2x, cp2y;
|
|
63
67
|
const customNext = controlPoints?.[next];
|
|
64
68
|
if (nextSmooth) {
|
|
65
|
-
cp2x = customNext
|
|
66
|
-
|
|
69
|
+
cp2x = customNext
|
|
70
|
+
? customNext[0] * renderWidth
|
|
71
|
+
: nx + (cx - nx) / 3;
|
|
72
|
+
cp2y = customNext
|
|
73
|
+
? customNext[1] * renderHeight
|
|
74
|
+
: ny + (cy - ny) / 3;
|
|
67
75
|
}
|
|
68
76
|
else {
|
|
69
77
|
cp2x = nx;
|
|
@@ -116,8 +116,10 @@ function drawPolygon(ctx, width, height, shapeModel) {
|
|
|
116
116
|
const smoothFlags = 'smoothFlags' in shapeModel && shapeModel.smoothFlags
|
|
117
117
|
? shapeModel.smoothFlags
|
|
118
118
|
: null;
|
|
119
|
-
const controlPoints = 'controlPoints' in shapeModel &&
|
|
120
|
-
|
|
119
|
+
const controlPoints = 'controlPoints' in shapeModel &&
|
|
120
|
+
shapeModel.controlPoints
|
|
121
|
+
? shapeModel
|
|
122
|
+
.controlPoints
|
|
121
123
|
: null;
|
|
122
124
|
const count = vertices.length;
|
|
123
125
|
if (count === 0)
|
|
@@ -131,7 +133,10 @@ function drawPolygon(ctx, width, height, shapeModel) {
|
|
|
131
133
|
}
|
|
132
134
|
}
|
|
133
135
|
else {
|
|
134
|
-
const abs = (v) => [
|
|
136
|
+
const abs = (v) => [
|
|
137
|
+
v[0] * width,
|
|
138
|
+
v[1] * height,
|
|
139
|
+
];
|
|
135
140
|
ctx.moveTo(vertices[0][0] * width, vertices[0][1] * height);
|
|
136
141
|
for (let i = 0; i < count; i++) {
|
|
137
142
|
const next = (i + 1) % count;
|
|
@@ -146,8 +146,7 @@ export class ShapeElementView extends GfxElementModelView {
|
|
|
146
146
|
return;
|
|
147
147
|
}
|
|
148
148
|
// 'B' key toggles Bezier smoothing on the hovered vertex
|
|
149
|
-
if ((evt.key === 'b' || evt.key === 'B') &&
|
|
150
|
-
this._vertexEditingOverlay) {
|
|
149
|
+
if ((evt.key === 'b' || evt.key === 'B') && this._vertexEditingOverlay) {
|
|
151
150
|
const idx = this._vertexEditingOverlay.hoveredVertexIndex;
|
|
152
151
|
if (idx >= 0) {
|
|
153
152
|
evt.preventDefault();
|
|
@@ -192,7 +191,8 @@ export class ShapeElementView extends GfxElementModelView {
|
|
|
192
191
|
const verts = this.model.vertices;
|
|
193
192
|
if (verts && this._pendingVertexIndex < verts.length) {
|
|
194
193
|
this._isDraggingVertex = true;
|
|
195
|
-
this._vertexEditingOverlay.activeVertexIndex =
|
|
194
|
+
this._vertexEditingOverlay.activeVertexIndex =
|
|
195
|
+
this._pendingVertexIndex;
|
|
196
196
|
this.model.stash('xywh');
|
|
197
197
|
this.model.stash('vertices');
|
|
198
198
|
this.model.stash('controlPoints');
|
|
@@ -214,8 +214,10 @@ export class ShapeElementView extends GfxElementModelView {
|
|
|
214
214
|
// Bezier handle drag
|
|
215
215
|
if (this._pendingBezierHandle) {
|
|
216
216
|
this._isDraggingBezierHandle = true;
|
|
217
|
-
this._vertexEditingOverlay.activeBezierHandleIndex =
|
|
218
|
-
|
|
217
|
+
this._vertexEditingOverlay.activeBezierHandleIndex =
|
|
218
|
+
this._pendingBezierHandle.vertexIndex;
|
|
219
|
+
this._vertexEditingOverlay.activeBezierHandleType =
|
|
220
|
+
this._pendingBezierHandle.handleIndex;
|
|
219
221
|
this.model.stash('xywh');
|
|
220
222
|
this.model.stash('vertices');
|
|
221
223
|
this.model.stash('controlPoints');
|
|
@@ -237,7 +239,9 @@ export class ShapeElementView extends GfxElementModelView {
|
|
|
237
239
|
const dx = curMX - this._pointerStartModelCoord[0];
|
|
238
240
|
const dy = curMY - this._pointerStartModelCoord[1];
|
|
239
241
|
// Bezier handle drag
|
|
240
|
-
if (this._isDraggingBezierHandle &&
|
|
242
|
+
if (this._isDraggingBezierHandle &&
|
|
243
|
+
this._pendingBezierHandle &&
|
|
244
|
+
this._bezierDragStartModelCoord) {
|
|
241
245
|
this._vertexEditingOverlay.moveBezierHandle(this._pendingBezierHandle.vertexIndex, this._pendingBezierHandle.handleIndex, this._bezierDragStartModelCoord[0] + dx, this._bezierDragStartModelCoord[1] + dy);
|
|
242
246
|
this._syncConnectorPaths();
|
|
243
247
|
this._surfaceComponent?.refresh();
|
|
@@ -283,7 +287,11 @@ export class ShapeElementView extends GfxElementModelView {
|
|
|
283
287
|
this._surfaceComponent?.refresh();
|
|
284
288
|
}
|
|
285
289
|
});
|
|
286
|
-
this._dragHandlerDisposers = [
|
|
290
|
+
this._dragHandlerDisposers = [
|
|
291
|
+
dragstartDisposer,
|
|
292
|
+
dragmoveDisposer,
|
|
293
|
+
dragendDisposer,
|
|
294
|
+
];
|
|
287
295
|
}
|
|
288
296
|
/**
|
|
289
297
|
* Exit polygon vertex editing mode: clear overlay editing state,
|
|
@@ -346,15 +354,14 @@ export class ShapeElementView extends GfxElementModelView {
|
|
|
346
354
|
// Record which vertex (if any) the pointer pressed on. The registered
|
|
347
355
|
// dragstart handler (added in _enterVertexEditingMode) reads
|
|
348
356
|
// _pendingVertexIndex to decide whether to enter vertex-drag mode.
|
|
349
|
-
this.on('pointerdown',
|
|
357
|
+
this.on('pointerdown', e => {
|
|
350
358
|
if (!this._vertexEditingOverlay?.isEditing) {
|
|
351
359
|
// Outside editing mode no vertex drag is possible.
|
|
352
360
|
this._pendingVertexIndex = -1;
|
|
353
361
|
return;
|
|
354
362
|
}
|
|
355
363
|
const [mx, my] = this.gfx.viewport.toModelCoord(e.x, e.y);
|
|
356
|
-
this._pendingVertexIndex =
|
|
357
|
-
this._vertexEditingOverlay.hitTestVertex(mx, my);
|
|
364
|
+
this._pendingVertexIndex = this._vertexEditingOverlay.hitTestVertex(mx, my);
|
|
358
365
|
// If no vertex hit, check bezier handle hit
|
|
359
366
|
if (this._pendingVertexIndex < 0) {
|
|
360
367
|
this._pendingBezierHandle =
|
|
@@ -365,7 +372,7 @@ export class ShapeElementView extends GfxElementModelView {
|
|
|
365
372
|
}
|
|
366
373
|
});
|
|
367
374
|
// Listen for pointer move to update hover state on the overlay
|
|
368
|
-
this.on('pointermove',
|
|
375
|
+
this.on('pointermove', e => {
|
|
369
376
|
if (!this._vertexEditingOverlay)
|
|
370
377
|
return;
|
|
371
378
|
const [mx, my] = this.gfx.viewport.toModelCoord(e.x, e.y);
|
|
@@ -393,7 +400,7 @@ export class ShapeElementView extends GfxElementModelView {
|
|
|
393
400
|
}
|
|
394
401
|
});
|
|
395
402
|
// Click on edge midpoint to insert a new vertex (in editing mode)
|
|
396
|
-
this.on('click',
|
|
403
|
+
this.on('click', e => {
|
|
397
404
|
if (!this._vertexEditingOverlay)
|
|
398
405
|
return;
|
|
399
406
|
if (!this._vertexEditingOverlay.isEditing)
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ToolOverlay
|
|
1
|
+
import { ToolOverlay } from '../../affine-block-surface/index.js';
|
|
2
2
|
import { ShapeElementModel, ShapeType } from '../../affine-model/index.js';
|
|
3
3
|
import { Bound, getBezierCurveBoundingBox, } from '../../global/gfx/index.js';
|
|
4
4
|
// ─── Visual constants ───────────────────────────────────────────────────────
|
|
@@ -86,8 +86,7 @@ export class PolygonVertexEditingOverlay extends ToolOverlay {
|
|
|
86
86
|
if (!this._elementId)
|
|
87
87
|
return null;
|
|
88
88
|
const el = this.gfx.getElementById(this._elementId);
|
|
89
|
-
if (el instanceof ShapeElementModel &&
|
|
90
|
-
el.shapeType === ShapeType.Polygon) {
|
|
89
|
+
if (el instanceof ShapeElementModel && el.shapeType === ShapeType.Polygon) {
|
|
91
90
|
return el;
|
|
92
91
|
}
|
|
93
92
|
return null;
|
|
@@ -361,7 +360,7 @@ export class PolygonVertexEditingOverlay extends ToolOverlay {
|
|
|
361
360
|
return null;
|
|
362
361
|
const bound = Bound.deserialize(model.xywh);
|
|
363
362
|
const zoom = this.gfx.viewport.zoom;
|
|
364
|
-
const hitDist = BEZIER_HANDLE_RADIUS * 2 / zoom;
|
|
363
|
+
const hitDist = (BEZIER_HANDLE_RADIUS * 2) / zoom;
|
|
365
364
|
// Inverse-rotate incoming world coordinates into polygon's local space
|
|
366
365
|
let localX = modelX;
|
|
367
366
|
let localY = modelY;
|
|
@@ -759,7 +758,9 @@ export class PolygonVertexEditingOverlay extends ToolOverlay {
|
|
|
759
758
|
return;
|
|
760
759
|
const bound = Bound.deserialize(model.xywh);
|
|
761
760
|
const count = model.vertices.length;
|
|
762
|
-
let flags = model.smoothFlags
|
|
761
|
+
let flags = model.smoothFlags
|
|
762
|
+
? [...model.smoothFlags]
|
|
763
|
+
: new Array(count).fill(false);
|
|
763
764
|
// Ensure flags array matches vertex count
|
|
764
765
|
while (flags.length < count)
|
|
765
766
|
flags.push(false);
|
|
@@ -1034,8 +1035,12 @@ export class PolygonVertexEditingOverlay extends ToolOverlay {
|
|
|
1034
1035
|
const mx = (ax + bx) / 2;
|
|
1035
1036
|
const my = (ay + by) / 2;
|
|
1036
1037
|
const isHoveredMid = i === this.hoveredMidpointIndex;
|
|
1037
|
-
const midR = (isHoveredMid
|
|
1038
|
-
|
|
1038
|
+
const midR = (isHoveredMid
|
|
1039
|
+
? MIDPOINT_HANDLE_HOVER_RADIUS
|
|
1040
|
+
: MIDPOINT_HANDLE_RADIUS) / zoom;
|
|
1041
|
+
const midFill = isHoveredMid
|
|
1042
|
+
? MIDPOINT_HOVER_FILL_COLOR
|
|
1043
|
+
: MIDPOINT_FILL_COLOR;
|
|
1039
1044
|
ctx.beginPath();
|
|
1040
1045
|
ctx.arc(mx, my, midR, 0, Math.PI * 2);
|
|
1041
1046
|
ctx.fillStyle = midFill;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { getSurfaceComponent, ToolOverlay, } from '../../affine-block-surface/index.js';
|
|
2
|
-
import { DefaultTheme
|
|
2
|
+
import { DefaultTheme } from '../../affine-model/index.js';
|
|
3
3
|
import { ThemeProvider } from '../../affine-shared/services/index.js';
|
|
4
4
|
import { assertType } from '../../global/utils/index.js';
|
|
5
5
|
import { effect } from '@preact/signals-core';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { CanvasElementType, DefaultTool, EXCLUDING_MOUSE_OUT_CLASS_LIST, } from '../affine-block-surface/index.js';
|
|
2
|
-
import { DefaultTheme, ShapeType
|
|
2
|
+
import { DefaultTheme, ShapeType } from '../affine-model/index.js';
|
|
3
3
|
import { EditPropsStore, TelemetryProvider, ThemeProvider, } from '../affine-shared/services/index.js';
|
|
4
4
|
import { hasClassNameInList } from '../affine-shared/utils/index.js';
|
|
5
5
|
import { Bound } from '../global/gfx/index.js';
|
|
@@ -233,7 +233,9 @@ export class PolygonTool extends BaseTool {
|
|
|
233
233
|
vertices: normalizedVertices,
|
|
234
234
|
isClosed: true,
|
|
235
235
|
smoothFlags: smoothFlagsForModel,
|
|
236
|
-
...(controlPointsForModel
|
|
236
|
+
...(controlPointsForModel
|
|
237
|
+
? { controlPoints: controlPointsForModel }
|
|
238
|
+
: {}),
|
|
237
239
|
});
|
|
238
240
|
this.std.getOptional(TelemetryProvider)?.track('CanvasElementAdded', {
|
|
239
241
|
control: 'canvas:draw',
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { CanvasElementType, DefaultTool, EXCLUDING_MOUSE_OUT_CLASS_LIST, } from '../affine-block-surface/index.js';
|
|
2
|
-
import { DefaultTheme, getShapeType, ShapeType
|
|
2
|
+
import { DefaultTheme, getShapeType, ShapeType } from '../affine-model/index.js';
|
|
3
3
|
import { EditPropsStore, TelemetryProvider, ThemeProvider, } from '../affine-shared/services/index.js';
|
|
4
4
|
import { hasClassNameInList } from '../affine-shared/utils/index.js';
|
|
5
5
|
import { Bound } from '../global/gfx/index.js';
|
|
@@ -415,9 +415,7 @@ let EdgelessShapeTextEditor = (() => {
|
|
|
415
415
|
// override rich-text style (height: 100%)
|
|
416
416
|
height: 'initial',
|
|
417
417
|
minHeight: autoWidth ? '1em' : `${rect.height}px`,
|
|
418
|
-
maxWidth: constrainedAutoWidth
|
|
419
|
-
? `${this.element.maxWidth}px`
|
|
420
|
-
: undefined,
|
|
418
|
+
maxWidth: constrainedAutoWidth ? `${this.element.maxWidth}px` : undefined,
|
|
421
419
|
boxSizing: 'border-box',
|
|
422
420
|
fontSize: effectiveShapeFontSize(this.element) + 'px',
|
|
423
421
|
fontFamily: TextUtils.wrapFontFamily(this.element.fontFamily),
|
|
@@ -73,8 +73,19 @@ function swot() {
|
|
|
73
73
|
// ── Kanban (To do / Doing / Done) ─────────────────────────────────────
|
|
74
74
|
function kanban() {
|
|
75
75
|
const colOpts = { fill: '#f4f4f5', stroke: MUTED, sw: 1.5, radius: 10 };
|
|
76
|
-
const head = {
|
|
77
|
-
|
|
76
|
+
const head = {
|
|
77
|
+
fontSize: 18,
|
|
78
|
+
weight: FontWeight.Medium,
|
|
79
|
+
align: TextAlign.Center,
|
|
80
|
+
};
|
|
81
|
+
const card = (x, y, fill, stroke) => rect(x, y, 188, 60, {
|
|
82
|
+
fill,
|
|
83
|
+
stroke,
|
|
84
|
+
sw: 1.5,
|
|
85
|
+
radius: 8,
|
|
86
|
+
text: 'Card',
|
|
87
|
+
fontSize: 14,
|
|
88
|
+
});
|
|
78
89
|
return {
|
|
79
90
|
c1: rect(0, 0, 220, 420, colOpts),
|
|
80
91
|
c2: rect(244, 0, 220, 420, colOpts),
|
|
@@ -92,7 +103,10 @@ function kanban() {
|
|
|
92
103
|
// ── Business Model Canvas (Strategyzer 9-block layout) ────────────────
|
|
93
104
|
function bmc() {
|
|
94
105
|
const blk = { stroke: DARK, sw: 1.5 };
|
|
95
|
-
const t = (x, y, s) => label(x + 12, y + 12, 180, 22, s, {
|
|
106
|
+
const t = (x, y, s) => label(x + 12, y + 12, 180, 22, s, {
|
|
107
|
+
fontSize: 14,
|
|
108
|
+
weight: FontWeight.Medium,
|
|
109
|
+
});
|
|
96
110
|
const hdr = (x, s) => ({
|
|
97
111
|
box: rect(x, 8, 128, 34, { stroke: MUTED, sw: 1 }),
|
|
98
112
|
txt: label(x + 8, 16, 120, 18, s, { fontSize: 11, color: '#5f6368' }),
|
|
@@ -106,24 +120,45 @@ function bmc() {
|
|
|
106
120
|
fontSize: 24,
|
|
107
121
|
weight: FontWeight.Medium,
|
|
108
122
|
}),
|
|
109
|
-
h1b: h1.box,
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
123
|
+
h1b: h1.box,
|
|
124
|
+
h1t: h1.txt,
|
|
125
|
+
h2b: h2.box,
|
|
126
|
+
h2t: h2.txt,
|
|
127
|
+
h3b: h3.box,
|
|
128
|
+
h3t: h3.txt,
|
|
129
|
+
h4b: h4.box,
|
|
130
|
+
h4t: h4.txt,
|
|
131
|
+
kp: rect(0, 56, 196, 300, blk),
|
|
132
|
+
ka: rect(200, 56, 196, 146, blk),
|
|
133
|
+
kr: rect(200, 206, 196, 150, blk),
|
|
134
|
+
vp: rect(400, 56, 196, 300, blk),
|
|
135
|
+
cr: rect(600, 56, 196, 146, blk),
|
|
136
|
+
ch: rect(600, 206, 196, 150, blk),
|
|
114
137
|
cs: rect(800, 56, 196, 300, blk),
|
|
115
|
-
cost: rect(0, 360, 496, 84, blk),
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
138
|
+
cost: rect(0, 360, 496, 84, blk),
|
|
139
|
+
rev: rect(500, 360, 496, 84, blk),
|
|
140
|
+
tkp: t(0, 56, 'Key partnerships'),
|
|
141
|
+
tka: t(200, 56, 'Key activities'),
|
|
142
|
+
tkr: t(200, 206, 'Key resources'),
|
|
143
|
+
tvp: t(400, 56, 'Value propositions'),
|
|
144
|
+
tcr: t(600, 56, 'Customer relationships'),
|
|
145
|
+
tch: t(600, 206, 'Channels'),
|
|
119
146
|
tcs: t(800, 56, 'Customer segments'),
|
|
120
|
-
tcost: t(0, 360, 'Cost structure'),
|
|
147
|
+
tcost: t(0, 360, 'Cost structure'),
|
|
148
|
+
trev: t(500, 360, 'Revenue streams'),
|
|
121
149
|
};
|
|
122
150
|
}
|
|
123
151
|
// ── Fishbone / Ishikawa (spine + arrowhead bones + CATEGORY/ITEM) ─────
|
|
124
152
|
function fishbone() {
|
|
125
153
|
const cat = (x, y) => rect(x, y, 150, 44, { text: 'CATEGORY', fontSize: 13 });
|
|
126
|
-
const item = (x, y, n) => rect(x, y, 130, 40, {
|
|
154
|
+
const item = (x, y, n) => rect(x, y, 130, 40, {
|
|
155
|
+
stroke: MUTED,
|
|
156
|
+
sw: 1.4,
|
|
157
|
+
dash: true,
|
|
158
|
+
text: n,
|
|
159
|
+
textColor: '#5f6368',
|
|
160
|
+
fontSize: 13,
|
|
161
|
+
});
|
|
127
162
|
const out = {
|
|
128
163
|
spine: line(80, 360, 1120, 360, { sw: 6 }),
|
|
129
164
|
head: rect(1124, 332, 130, 56, { text: 'Effect', fontSize: 16 }),
|
|
@@ -156,13 +191,22 @@ function gantt() {
|
|
|
156
191
|
for (let i = 0; i < 6; i++) {
|
|
157
192
|
const x = 220 + i * 130;
|
|
158
193
|
out[`g${i}`] = line(x, 40, x, 268, { stroke: '#e0e0e0', sw: 1 });
|
|
159
|
-
out[`w${i}`] = label(x - 16, 12, 40, 20, `W${i + 1}`, {
|
|
194
|
+
out[`w${i}`] = label(x - 16, 12, 40, 20, `W${i + 1}`, {
|
|
195
|
+
fontSize: 12,
|
|
196
|
+
color: '#5f6368',
|
|
197
|
+
align: TextAlign.Center,
|
|
198
|
+
});
|
|
160
199
|
}
|
|
161
200
|
rows.forEach((name, r) => {
|
|
162
201
|
const y = 56 + r * 52;
|
|
163
202
|
out[`t${r}`] = label(0, y + 6, 180, 24, name, { fontSize: 14 });
|
|
164
203
|
const [bx, bw, fill] = bars[r];
|
|
165
|
-
out[`b${r}`] = rect(bx, y, bw, 28, {
|
|
204
|
+
out[`b${r}`] = rect(bx, y, bw, 28, {
|
|
205
|
+
fill,
|
|
206
|
+
stroke: fill,
|
|
207
|
+
sw: 0,
|
|
208
|
+
radius: 6,
|
|
209
|
+
});
|
|
166
210
|
});
|
|
167
211
|
return out;
|
|
168
212
|
}
|
|
@@ -175,7 +219,12 @@ const previews = {
|
|
|
175
219
|
gantt: `<svg ${ATTRS} fill="none"><path d="M40 14 V70 M62 14 V70 M84 14 V70 M106 14 V70" stroke="#e0e0e0"/><rect x="40" y="22" width="34" height="8" rx="2" fill="#4574c4"/><rect x="52" y="36" width="44" height="8" rx="2" fill="#2f9e95"/><rect x="62" y="50" width="50" height="8" rx="2" fill="#d99a2b"/><rect x="84" y="64" width="28" height="8" rx="2" fill="#43a06b"/></svg>`,
|
|
176
220
|
};
|
|
177
221
|
function t(name, preview, elements) {
|
|
178
|
-
return {
|
|
222
|
+
return {
|
|
223
|
+
name,
|
|
224
|
+
type: 'template',
|
|
225
|
+
preview,
|
|
226
|
+
content: makeTemplateSnapshot(elements, name),
|
|
227
|
+
};
|
|
179
228
|
}
|
|
180
229
|
export const otherTemplateCategory = {
|
|
181
230
|
name: 'Other',
|
|
@@ -32,7 +32,7 @@ var __runInitializers = (this && this.__runInitializers) || function (thisArg, i
|
|
|
32
32
|
}
|
|
33
33
|
return useValue ? value : void 0;
|
|
34
34
|
};
|
|
35
|
-
import { on, once, requestConnectedFrame
|
|
35
|
+
import { on, once, requestConnectedFrame } from '../../affine-shared/utils/index.js';
|
|
36
36
|
import { DisposableGroup } from '../../global/disposable/index.js';
|
|
37
37
|
import { css, html, LitElement } from 'lit';
|
|
38
38
|
import { query } from 'lit/decorators.js';
|
|
@@ -34,7 +34,7 @@ var __runInitializers = (this && this.__runInitializers) || function (thisArg, i
|
|
|
34
34
|
};
|
|
35
35
|
import { DefaultTool } from '../../affine-block-surface/index.js';
|
|
36
36
|
import { darkToolbarStyles, lightToolbarStyles, } from '../../affine-components/toolbar/index.js';
|
|
37
|
-
import { EditPropsStore, ThemeProvider
|
|
37
|
+
import { EditPropsStore, ThemeProvider } from '../../affine-shared/services/index.js';
|
|
38
38
|
import { requestConnectedFrame, stopPropagation, } from '../../affine-shared/utils/index.js';
|
|
39
39
|
import { EdgelessDraggableElementController } from '../../affine-widget-edgeless-toolbar/index.js';
|
|
40
40
|
import { WithDisposable } from '../../global/lit/index.js';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { EdgelessCRUDIdentifier, TextUtils
|
|
1
|
+
import { EdgelessCRUDIdentifier, TextUtils } from '../../affine-block-surface/index.js';
|
|
2
2
|
import { packColor, } from '../../affine-components/color-picker/index.js';
|
|
3
3
|
import { EditorChevronDown } from '../../affine-components/toolbar/index.js';
|
|
4
4
|
import { DefaultTheme, FontFamily, FontStyle, FontWeight, resolveColor, TextAlign, } from '../../affine-model/index.js';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { INLINE_ROOT_ATTR
|
|
1
|
+
import { INLINE_ROOT_ATTR } from '../std/inline/index.js';
|
|
2
2
|
import { toggleLinkPopup } from './link-node/link-popup/toggle-link-popup.js';
|
|
3
3
|
export const toggleLink = (ctx, next) => {
|
|
4
4
|
const selection = document.getSelection();
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { getSelectedBlocksCommand } from '../../affine-shared/commands/index.js';
|
|
2
|
-
import { INLINE_ROOT_ATTR
|
|
2
|
+
import { INLINE_ROOT_ATTR } from '../../std/inline/index.js';
|
|
3
3
|
import { FORMAT_BLOCK_SUPPORT_FLAVOURS } from './consts.js';
|
|
4
4
|
// for block selection
|
|
5
5
|
export const formatBlockCommand = (ctx, next) => {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { BLOCK_ID_ATTR
|
|
2
|
-
import { INLINE_ROOT_ATTR
|
|
1
|
+
import { BLOCK_ID_ATTR } from '../../std/index.js';
|
|
2
|
+
import { INLINE_ROOT_ATTR } from '../../std/inline/index.js';
|
|
3
3
|
import { FORMAT_NATIVE_SUPPORT_FLAVOURS } from './consts.js';
|
|
4
4
|
// for native range
|
|
5
5
|
export const formatNativeCommand = (ctx, next) => {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { clearMarksOnDiscontinuousInput } from '../../affine-rich-text/index.js';
|
|
2
2
|
import { getSelectedBlocksCommand } from '../../affine-shared/commands/index.js';
|
|
3
|
-
import { INLINE_ROOT_ATTR
|
|
3
|
+
import { INLINE_ROOT_ATTR } from '../../std/inline/index.js';
|
|
4
4
|
import { FORMAT_TEXT_SUPPORT_FLAVOURS } from './consts.js';
|
|
5
5
|
// for text selection
|
|
6
6
|
export const formatTextCommand = (ctx, next) => {
|
|
@@ -34,7 +34,7 @@ var __runInitializers = (this && this.__runInitializers) || function (thisArg, i
|
|
|
34
34
|
};
|
|
35
35
|
import { whenHover } from '../../affine-components/hover/index.js';
|
|
36
36
|
import { Peekable } from '../../affine-components/peek/index.js';
|
|
37
|
-
import { DEFAULT_DOC_NAME, REFERENCE_NODE
|
|
37
|
+
import { DEFAULT_DOC_NAME, REFERENCE_NODE } from '../../affine-shared/consts/index.js';
|
|
38
38
|
import { DocDisplayMetaProvider, ToolbarRegistryIdentifier, } from '../../affine-shared/services/index.js';
|
|
39
39
|
import { affineTextStyles } from '../../affine-shared/styles/index.js';
|
|
40
40
|
import { cloneReferenceInfo, referenceToNode, } from '../../affine-shared/utils/index.js';
|