@dou-ui/flow 0.1.0-alpha.17 → 0.1.0-alpha.19
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"flow-comments.js","names":["_sfc_main"],"sources":["../../src/components/flow-comments.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { MessageCircleIcon } from '@dou-ui/icons'\nimport {\n DouCommentThread,\n useFloating,\n useLayer,\n useZIndex,\n type CommentThread,\n type VirtualElement,\n} from 'dou-ui'\nimport { computed, nextTick, shallowRef, useTemplateRef, watch } from 'vue'\nimport type { FlowComments } from '../comments'\nimport type { FlowCommentAnchor } from '../context'\nimport { format, type FlowMessages } from '../locale'\n\n/*\n * The comments over the canvas: a marker on each node and edge with open\n * threads, and the card with the threads of the one opened, or the box\n * for a thread being started.\n */\n\nexport interface FlowCommentMarker {\n key: string\n anchor: FlowCommentAnchor\n /** The open threads there, oldest first, counted on the marker; empty for a thread being started. */\n threads: string[]\n /** The threads its card shows: the open ones, and a resolved one opened from outside. */\n shown: string[]\n /** A thread is being started here. */\n pending: boolean\n /** Where it goes, in px within the editor. */\n x: number\n y: number\n /** Above an edge's label: a finger's target keeps clear of the label. */\n lifted: boolean\n /**\n * A pin on a point of a node: its place among the open pins there, from\n * 1; `0` for one being started or a resolved one opened from outside.\n */\n number?: number\n /** The name of the node it is on, for screen readers. */\n node?: string\n}\n\nconst props = defineProps<{\n comments: FlowComments\n markers: FlowCommentMarker[]\n messages: FlowMessages\n /** Gives the focus back to what a thread is about, after the card closes. */\n restore: (anchor: FlowCommentAnchor | null) => void\n}>()\n\nconst { comments } = props\nconst panel = shallowRef<HTMLElement | null>(null)\nconst markerEls = new Map<string, HTMLElement>()\n\n/** The marker the card belongs to: the active thread's, or the one being started. */\nconst current = computed<FlowCommentMarker | null>(() => {\n if (comments.pending.value) return props.markers.find((m) => m.pending) ?? null\n const id = comments.active.value\n return (id && props.markers.find((m) => m.shown.includes(id))) || null\n})\n\n/** The threads the card shows: every open one there, or the active one opened from elsewhere. */\nconst shown = computed<CommentThread[]>(() => {\n const marker = current.value\n if (!marker || comments.pending.value) return []\n const byId = new Map(comments.threads.value.map((t) => [t.id, t]))\n return marker.shown.flatMap((id) => byId.get(id) ?? [])\n})\n\nconst open = computed(() => !!current.value)\n\nconst layer = shallowRef<HTMLElement | null>(null)\n/** The marker has been panned out of the editor: the card waits, hidden, until it is back. */\nconst away = computed(() => {\n const marker = current.value\n const el = layer.value\n if (!marker || !el) return false\n return marker.x < 0 || marker.y < 0 || marker.x > el.clientWidth || marker.y > el.clientHeight\n})\n\n// Hiding the card drops the focus in it: give it back when the card returns.\nlet awayFocus: HTMLElement | null = null\nwatch(away, async (now) => {\n if (now) {\n const el = document.activeElement\n awayFocus = el instanceof HTMLElement && panel.value?.contains(el) ? el : null\n return\n }\n const el = awayFocus\n awayFocus = null\n await nextTick()\n const at = document.activeElement\n if (el?.isConnected && (!at || at === document.body)) el.focus({ preventScroll: true })\n})\n\nconst anchor: VirtualElement = {\n getBoundingClientRect() {\n const marker = current.value\n const el = marker && markerEls.get(marker.key)\n
|
|
1
|
+
{"version":3,"file":"flow-comments.js","names":["_sfc_main"],"sources":["../../src/components/flow-comments.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { MessageCircleIcon } from '@dou-ui/icons'\nimport {\n DouCommentThread,\n useFloating,\n useLayer,\n useZIndex,\n type CommentThread,\n type VirtualElement,\n} from 'dou-ui'\nimport { computed, nextTick, shallowRef, useTemplateRef, watch } from 'vue'\nimport type { FlowComments } from '../comments'\nimport type { FlowCommentAnchor } from '../context'\nimport { format, type FlowMessages } from '../locale'\n\n/*\n * The comments over the canvas: a marker on each node and edge with open\n * threads, and the card with the threads of the one opened, or the box\n * for a thread being started.\n */\n\nexport interface FlowCommentMarker {\n key: string\n anchor: FlowCommentAnchor\n /** The open threads there, oldest first, counted on the marker; empty for a thread being started. */\n threads: string[]\n /** The threads its card shows: the open ones, and a resolved one opened from outside. */\n shown: string[]\n /** A thread is being started here. */\n pending: boolean\n /** Where it goes, in px within the editor. */\n x: number\n y: number\n /** Above an edge's label: a finger's target keeps clear of the label. */\n lifted: boolean\n /**\n * A pin on a point of a node: its place among the open pins there, from\n * 1; `0` for one being started or a resolved one opened from outside.\n */\n number?: number\n /** The name of the node it is on, for screen readers. */\n node?: string\n}\n\nconst props = defineProps<{\n comments: FlowComments\n markers: FlowCommentMarker[]\n messages: FlowMessages\n /** Gives the focus back to what a thread is about, after the card closes. */\n restore: (anchor: FlowCommentAnchor | null) => void\n}>()\n\nconst { comments } = props\nconst panel = shallowRef<HTMLElement | null>(null)\nconst markerEls = new Map<string, HTMLElement>()\n\n/** The marker the card belongs to: the active thread's, or the one being started. */\nconst current = computed<FlowCommentMarker | null>(() => {\n if (comments.pending.value) return props.markers.find((m) => m.pending) ?? null\n const id = comments.active.value\n return (id && props.markers.find((m) => m.shown.includes(id))) || null\n})\n\n/** The threads the card shows: every open one there, or the active one opened from elsewhere. */\nconst shown = computed<CommentThread[]>(() => {\n const marker = current.value\n if (!marker || comments.pending.value) return []\n const byId = new Map(comments.threads.value.map((t) => [t.id, t]))\n return marker.shown.flatMap((id) => byId.get(id) ?? [])\n})\n\nconst open = computed(() => !!current.value)\n\nconst layer = shallowRef<HTMLElement | null>(null)\n/** The marker has been panned out of the editor: the card waits, hidden, until it is back. */\nconst away = computed(() => {\n const marker = current.value\n const el = layer.value\n if (!marker || !el) return false\n return marker.x < 0 || marker.y < 0 || marker.x > el.clientWidth || marker.y > el.clientHeight\n})\n\n// Hiding the card drops the focus in it: give it back when the card returns.\nlet awayFocus: HTMLElement | null = null\nwatch(away, async (now) => {\n if (now) {\n const el = document.activeElement\n awayFocus = el instanceof HTMLElement && panel.value?.contains(el) ? el : null\n return\n }\n const el = awayFocus\n awayFocus = null\n await nextTick()\n const at = document.activeElement\n if (el?.isConnected && (!at || at === document.body)) el.focus({ preventScroll: true })\n})\n\n/** Narrower than this, the card can't sit beside a node: it goes under (or over) the whole node. */\nconst NARROW = 600\n\nconst anchor: VirtualElement = {\n getBoundingClientRect() {\n const marker = current.value\n const el = marker && markerEls.get(marker.key)\n if (!el) return new DOMRect()\n const rect = el.getBoundingClientRect()\n const root = layer.value\n if (!root || root.clientWidth >= NARROW || !('node' in marker.anchor)) return rect\n // on a phone, the card would cover the node it is about\n const node = root\n .closest('.dou-flow-editor')\n ?.querySelector(`[data-node-id=\"${CSS.escape(marker.anchor.node)}\"]`)\n if (!node) return rect\n const box = node.getBoundingClientRect()\n const left = Math.min(rect.left, box.left)\n const top = Math.min(rect.top, box.top)\n return new DOMRect(\n left,\n top,\n Math.max(rect.right, box.right) - left,\n Math.max(rect.bottom, box.bottom) - top,\n )\n },\n}\n\nconst { style, placement, update } = useFloating(() => (open.value ? anchor : null), panel, {\n open,\n placement: 'bottom-start',\n offset: 6,\n})\nconst { next } = useZIndex()\nconst zIndex = shallowRef(0)\nwatch(open, (value) => value && (zIndex.value = next()), { immediate: true })\n// follows its marker as the canvas pans and zooms\nwatch(\n () => current.value && [current.value.x, current.value.y],\n () => open.value && void nextTick(update),\n)\n\nlet lastAnchor: FlowCommentAnchor | null = null\nwatch(current, (marker) => marker && (lastAnchor = marker.anchor), { immediate: true })\n\nconst focusLost = () => {\n const el = document.activeElement\n return !el || el === document.body || !!panel.value?.contains(el)\n}\n\nfunction close() {\n const refocus = focusLost()\n comments.close()\n if (refocus) props.restore(lastAnchor)\n}\n\nuseLayer({\n open,\n elements: () => [panel.value, ...markerEls.values()],\n onEscape: () => close(),\n onOutside: () => comments.close(),\n})\n\nconst views = useTemplateRef<InstanceType<typeof DouCommentThread>[]>('views')\n// asked to (the keyboard shortcut, or a thread just started): the reply box\nwatch(\n () => comments.focusRequest.value,\n async () => {\n await nextTick()\n await nextTick()\n const id = comments.active.value\n const index = shown.value.findIndex((t) => t.id === id)\n views.value?.[Math.max(0, index)]?.focus()\n },\n)\n\n// a thread resolved or removed from the card: back to what it is about,\n// once the card is gone\nfunction onClosed() {\n const el = document.activeElement\n if (!el || el === document.body) props.restore(lastAnchor)\n}\n\n/**\n * When the thread being started was opened. A tap that starts one (the\n * whiteboard's comment tool) is followed by the click the browser makes\n * from it, which lands on the new pin just drawn under the finger: that\n * one doesn't close it.\n */\nlet startedAt = -Infinity\nwatch(\n () => comments.pending.value,\n (now) => now && (startedAt = performance.now()),\n)\n\nfunction press(marker: FlowCommentMarker, event: MouseEvent) {\n if (marker.pending && performance.now() - startedAt < 500) return\n if (current.value?.key === marker.key) return comments.close()\n // pressed from the keyboard (no clicks counted): straight into the reply box;\n // a click or tap only shows the threads, without bringing up a phone's keyboard\n const focus = event.detail === 0\n const [first] = marker.threads\n if (first) comments.show(first, focus)\n else comments.start(marker.anchor, focus)\n}\n\nconst label = (marker: FlowCommentMarker) =>\n marker.number\n ? format(props.messages.commentPin, { number: marker.number, node: marker.node ?? '' })\n : marker.threads.length\n ? format(props.messages.comments, { count: marker.threads.length })\n : props.messages.comment\n</script>\n\n<template>\n <div ref=\"layer\" class=\"dou-flow-editor__comments\">\n <button\n v-for=\"marker in markers\"\n :key=\"marker.key\"\n :ref=\"\n (el) => (el ? markerEls.set(marker.key, el as HTMLElement) : markerEls.delete(marker.key))\n \"\n type=\"button\"\n class=\"dou-flow-editor__comment\"\n :class=\"{\n 'is-active': current?.key === marker.key,\n 'is-new': !marker.threads.length,\n 'is-node': 'node' in marker.anchor && marker.number === undefined,\n 'is-pin': marker.number !== undefined,\n 'is-lifted': marker.lifted,\n }\"\n :style=\"{ translate: `${marker.x}px ${marker.y}px` }\"\n :aria-label=\"label(marker)\"\n :aria-expanded=\"current?.key === marker.key\"\n :data-thread=\"marker.threads[0]\"\n @click=\"press(marker, $event)\"\n >\n <span v-if=\"marker.number\" class=\"dou-flow-editor__comment-count\">{{ marker.number }}</span>\n <template v-else>\n <MessageCircleIcon aria-hidden=\"true\" />\n <span\n v-if=\"marker.number === undefined && marker.threads.length > 1\"\n class=\"dou-flow-editor__comment-count\"\n >{{ marker.threads.length }}</span\n >\n </template>\n </button>\n </div>\n <Transition name=\"dou-floating\" @after-leave=\"onClosed\">\n <div\n v-if=\"open\"\n ref=\"panel\"\n class=\"dou-floating dou-flow-editor__comment-card\"\n :class=\"{ 'is-away': away }\"\n role=\"dialog\"\n :aria-label=\"messages.comment\"\n :style=\"[style, { zIndex }]\"\n :data-placement=\"placement\"\n >\n <template v-if=\"comments.pending.value\">\n <DouCommentThread\n ref=\"views\"\n key=\"new\"\n :thread=\"null\"\n :author=\"comments.author.value\"\n :autofocus=\"comments.pendingFocus.value\"\n @action=\"comments.apply\"\n @cancel=\"close\"\n />\n </template>\n <template v-else>\n <DouCommentThread\n v-for=\"thread in shown\"\n :key=\"thread.id\"\n ref=\"views\"\n :thread=\"thread\"\n :author=\"comments.author.value\"\n :readonly=\"!comments.writable.value\"\n @action=\"comments.apply\"\n @cancel=\"close\"\n />\n </template>\n </div>\n </Transition>\n</template>\n"],"mappings":""}
|
|
@@ -6,6 +6,7 @@ import { MessageCircleIcon } from "@dou-ui/icons";
|
|
|
6
6
|
var _hoisted_1 = [
|
|
7
7
|
"aria-label",
|
|
8
8
|
"aria-expanded",
|
|
9
|
+
"data-thread",
|
|
9
10
|
"onClick"
|
|
10
11
|
];
|
|
11
12
|
var _hoisted_2 = {
|
|
@@ -17,6 +18,7 @@ var _hoisted_3 = {
|
|
|
17
18
|
class: "dou-flow-editor__comment-count"
|
|
18
19
|
};
|
|
19
20
|
var _hoisted_4 = ["aria-label", "data-placement"];
|
|
21
|
+
var NARROW = 600;
|
|
20
22
|
var flow_comments_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineComponent({
|
|
21
23
|
__name: "flow-comments",
|
|
22
24
|
props: {
|
|
@@ -65,10 +67,20 @@ var flow_comments_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ de
|
|
|
65
67
|
const at = document.activeElement;
|
|
66
68
|
if (el?.isConnected && (!at || at === document.body)) el.focus({ preventScroll: true });
|
|
67
69
|
});
|
|
70
|
+
/** Narrower than this, the card can't sit beside a node: it goes under (or over) the whole node. */
|
|
68
71
|
const anchor = { getBoundingClientRect() {
|
|
69
72
|
const marker = current.value;
|
|
70
73
|
const el = marker && markerEls.get(marker.key);
|
|
71
|
-
|
|
74
|
+
if (!el) return new DOMRect();
|
|
75
|
+
const rect = el.getBoundingClientRect();
|
|
76
|
+
const root = layer.value;
|
|
77
|
+
if (!root || root.clientWidth >= NARROW || !("node" in marker.anchor)) return rect;
|
|
78
|
+
const node = root.closest(".dou-flow-editor")?.querySelector(`[data-node-id="${CSS.escape(marker.anchor.node)}"]`);
|
|
79
|
+
if (!node) return rect;
|
|
80
|
+
const box = node.getBoundingClientRect();
|
|
81
|
+
const left = Math.min(rect.left, box.left);
|
|
82
|
+
const top = Math.min(rect.top, box.top);
|
|
83
|
+
return new DOMRect(left, top, Math.max(rect.right, box.right) - left, Math.max(rect.bottom, box.bottom) - top);
|
|
72
84
|
} };
|
|
73
85
|
const { style, placement, update } = useFloating(() => open.value ? anchor : null, panel, {
|
|
74
86
|
open,
|
|
@@ -149,6 +161,7 @@ var flow_comments_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ de
|
|
|
149
161
|
style: normalizeStyle({ translate: `${marker.x}px ${marker.y}px` }),
|
|
150
162
|
"aria-label": label(marker),
|
|
151
163
|
"aria-expanded": current.value?.key === marker.key,
|
|
164
|
+
"data-thread": marker.threads[0],
|
|
152
165
|
onClick: ($event) => press(marker, $event)
|
|
153
166
|
}, [marker.number ? (openBlock(), createElementBlock("span", _hoisted_2, toDisplayString(marker.number), 1)) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [createVNode(unref(MessageCircleIcon), { "aria-hidden": "true" }), marker.number === void 0 && marker.threads.length > 1 ? (openBlock(), createElementBlock("span", _hoisted_3, toDisplayString(marker.threads.length), 1)) : createCommentVNode("", true)], 64))], 14, _hoisted_1);
|
|
154
167
|
}), 128))], 512), createVNode(Transition, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"flow-comments.vue_vue_type_script_setup_true_lang.js","names":["_openBlock","_createElementBlock","_Fragment","_createElementVNode","_renderList","_unref","_normalizeClass","_normalizeStyle","_toDisplayString","_createVNode","_createCommentVNode","_Transition","_withCtx","_createBlock"],"sources":["../../src/components/flow-comments.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { MessageCircleIcon } from '@dou-ui/icons'\nimport {\n DouCommentThread,\n useFloating,\n useLayer,\n useZIndex,\n type CommentThread,\n type VirtualElement,\n} from 'dou-ui'\nimport { computed, nextTick, shallowRef, useTemplateRef, watch } from 'vue'\nimport type { FlowComments } from '../comments'\nimport type { FlowCommentAnchor } from '../context'\nimport { format, type FlowMessages } from '../locale'\n\n/*\n * The comments over the canvas: a marker on each node and edge with open\n * threads, and the card with the threads of the one opened, or the box\n * for a thread being started.\n */\n\nexport interface FlowCommentMarker {\n key: string\n anchor: FlowCommentAnchor\n /** The open threads there, oldest first, counted on the marker; empty for a thread being started. */\n threads: string[]\n /** The threads its card shows: the open ones, and a resolved one opened from outside. */\n shown: string[]\n /** A thread is being started here. */\n pending: boolean\n /** Where it goes, in px within the editor. */\n x: number\n y: number\n /** Above an edge's label: a finger's target keeps clear of the label. */\n lifted: boolean\n /**\n * A pin on a point of a node: its place among the open pins there, from\n * 1; `0` for one being started or a resolved one opened from outside.\n */\n number?: number\n /** The name of the node it is on, for screen readers. */\n node?: string\n}\n\nconst props = defineProps<{\n comments: FlowComments\n markers: FlowCommentMarker[]\n messages: FlowMessages\n /** Gives the focus back to what a thread is about, after the card closes. */\n restore: (anchor: FlowCommentAnchor | null) => void\n}>()\n\nconst { comments } = props\nconst panel = shallowRef<HTMLElement | null>(null)\nconst markerEls = new Map<string, HTMLElement>()\n\n/** The marker the card belongs to: the active thread's, or the one being started. */\nconst current = computed<FlowCommentMarker | null>(() => {\n if (comments.pending.value) return props.markers.find((m) => m.pending) ?? null\n const id = comments.active.value\n return (id && props.markers.find((m) => m.shown.includes(id))) || null\n})\n\n/** The threads the card shows: every open one there, or the active one opened from elsewhere. */\nconst shown = computed<CommentThread[]>(() => {\n const marker = current.value\n if (!marker || comments.pending.value) return []\n const byId = new Map(comments.threads.value.map((t) => [t.id, t]))\n return marker.shown.flatMap((id) => byId.get(id) ?? [])\n})\n\nconst open = computed(() => !!current.value)\n\nconst layer = shallowRef<HTMLElement | null>(null)\n/** The marker has been panned out of the editor: the card waits, hidden, until it is back. */\nconst away = computed(() => {\n const marker = current.value\n const el = layer.value\n if (!marker || !el) return false\n return marker.x < 0 || marker.y < 0 || marker.x > el.clientWidth || marker.y > el.clientHeight\n})\n\n// Hiding the card drops the focus in it: give it back when the card returns.\nlet awayFocus: HTMLElement | null = null\nwatch(away, async (now) => {\n if (now) {\n const el = document.activeElement\n awayFocus = el instanceof HTMLElement && panel.value?.contains(el) ? el : null\n return\n }\n const el = awayFocus\n awayFocus = null\n await nextTick()\n const at = document.activeElement\n if (el?.isConnected && (!at || at === document.body)) el.focus({ preventScroll: true })\n})\n\nconst anchor: VirtualElement = {\n getBoundingClientRect() {\n const marker = current.value\n const el = marker && markerEls.get(marker.key)\n return el ? el.getBoundingClientRect() : new DOMRect()\n },\n}\n\nconst { style, placement, update } = useFloating(() => (open.value ? anchor : null), panel, {\n open,\n placement: 'bottom-start',\n offset: 6,\n})\nconst { next } = useZIndex()\nconst zIndex = shallowRef(0)\nwatch(open, (value) => value && (zIndex.value = next()), { immediate: true })\n// follows its marker as the canvas pans and zooms\nwatch(\n () => current.value && [current.value.x, current.value.y],\n () => open.value && void nextTick(update),\n)\n\nlet lastAnchor: FlowCommentAnchor | null = null\nwatch(current, (marker) => marker && (lastAnchor = marker.anchor), { immediate: true })\n\nconst focusLost = () => {\n const el = document.activeElement\n return !el || el === document.body || !!panel.value?.contains(el)\n}\n\nfunction close() {\n const refocus = focusLost()\n comments.close()\n if (refocus) props.restore(lastAnchor)\n}\n\nuseLayer({\n open,\n elements: () => [panel.value, ...markerEls.values()],\n onEscape: () => close(),\n onOutside: () => comments.close(),\n})\n\nconst views = useTemplateRef<InstanceType<typeof DouCommentThread>[]>('views')\n// asked to (the keyboard shortcut, or a thread just started): the reply box\nwatch(\n () => comments.focusRequest.value,\n async () => {\n await nextTick()\n await nextTick()\n const id = comments.active.value\n const index = shown.value.findIndex((t) => t.id === id)\n views.value?.[Math.max(0, index)]?.focus()\n },\n)\n\n// a thread resolved or removed from the card: back to what it is about,\n// once the card is gone\nfunction onClosed() {\n const el = document.activeElement\n if (!el || el === document.body) props.restore(lastAnchor)\n}\n\n/**\n * When the thread being started was opened. A tap that starts one (the\n * whiteboard's comment tool) is followed by the click the browser makes\n * from it, which lands on the new pin just drawn under the finger: that\n * one doesn't close it.\n */\nlet startedAt = -Infinity\nwatch(\n () => comments.pending.value,\n (now) => now && (startedAt = performance.now()),\n)\n\nfunction press(marker: FlowCommentMarker, event: MouseEvent) {\n if (marker.pending && performance.now() - startedAt < 500) return\n if (current.value?.key === marker.key) return comments.close()\n // pressed from the keyboard (no clicks counted): straight into the reply box;\n // a click or tap only shows the threads, without bringing up a phone's keyboard\n const focus = event.detail === 0\n const [first] = marker.threads\n if (first) comments.show(first, focus)\n else comments.start(marker.anchor, focus)\n}\n\nconst label = (marker: FlowCommentMarker) =>\n marker.number\n ? format(props.messages.commentPin, { number: marker.number, node: marker.node ?? '' })\n : marker.threads.length\n ? format(props.messages.comments, { count: marker.threads.length })\n : props.messages.comment\n</script>\n\n<template>\n <div ref=\"layer\" class=\"dou-flow-editor__comments\">\n <button\n v-for=\"marker in markers\"\n :key=\"marker.key\"\n :ref=\"\n (el) => (el ? markerEls.set(marker.key, el as HTMLElement) : markerEls.delete(marker.key))\n \"\n type=\"button\"\n class=\"dou-flow-editor__comment\"\n :class=\"{\n 'is-active': current?.key === marker.key,\n 'is-new': !marker.threads.length,\n 'is-node': 'node' in marker.anchor && marker.number === undefined,\n 'is-pin': marker.number !== undefined,\n 'is-lifted': marker.lifted,\n }\"\n :style=\"{ translate: `${marker.x}px ${marker.y}px` }\"\n :aria-label=\"label(marker)\"\n :aria-expanded=\"current?.key === marker.key\"\n @click=\"press(marker, $event)\"\n >\n <span v-if=\"marker.number\" class=\"dou-flow-editor__comment-count\">{{ marker.number }}</span>\n <template v-else>\n <MessageCircleIcon aria-hidden=\"true\" />\n <span\n v-if=\"marker.number === undefined && marker.threads.length > 1\"\n class=\"dou-flow-editor__comment-count\"\n >{{ marker.threads.length }}</span\n >\n </template>\n </button>\n </div>\n <Transition name=\"dou-floating\" @after-leave=\"onClosed\">\n <div\n v-if=\"open\"\n ref=\"panel\"\n class=\"dou-floating dou-flow-editor__comment-card\"\n :class=\"{ 'is-away': away }\"\n role=\"dialog\"\n :aria-label=\"messages.comment\"\n :style=\"[style, { zIndex }]\"\n :data-placement=\"placement\"\n >\n <template v-if=\"comments.pending.value\">\n <DouCommentThread\n ref=\"views\"\n key=\"new\"\n :thread=\"null\"\n :author=\"comments.author.value\"\n :autofocus=\"comments.pendingFocus.value\"\n @action=\"comments.apply\"\n @cancel=\"close\"\n />\n </template>\n <template v-else>\n <DouCommentThread\n v-for=\"thread in shown\"\n :key=\"thread.id\"\n ref=\"views\"\n :thread=\"thread\"\n :author=\"comments.author.value\"\n :readonly=\"!comments.writable.value\"\n @action=\"comments.apply\"\n @cancel=\"close\"\n />\n </template>\n </div>\n </Transition>\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;EA4CA,MAAM,QAAQ;EAQd,MAAM,EAAE,aAAa;EACrB,MAAM,QAAQ,WAA+B,IAAI;EACjD,MAAM,4BAAY,IAAI,IAAyB;;EAG/C,MAAM,UAAU,eAAyC;GACvD,IAAI,SAAS,QAAQ,OAAO,OAAO,MAAM,QAAQ,MAAM,MAAM,EAAE,OAAO,KAAK;GAC3E,MAAM,KAAK,SAAS,OAAO;GAC3B,OAAQ,MAAM,MAAM,QAAQ,MAAM,MAAM,EAAE,MAAM,SAAS,EAAE,CAAC,KAAM;EACpE,C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,CAAC,SAAS;MAC7B,UAAQA,MAAA,QAAA,CAAQ,CAAC;MACjB,UAAQ"}
|
|
1
|
+
{"version":3,"file":"flow-comments.vue_vue_type_script_setup_true_lang.js","names":["_openBlock","_createElementBlock","_Fragment","_createElementVNode","_renderList","_unref","_normalizeClass","_normalizeStyle","_toDisplayString","_createVNode","_createCommentVNode","_Transition","_withCtx","_createBlock"],"sources":["../../src/components/flow-comments.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { MessageCircleIcon } from '@dou-ui/icons'\nimport {\n DouCommentThread,\n useFloating,\n useLayer,\n useZIndex,\n type CommentThread,\n type VirtualElement,\n} from 'dou-ui'\nimport { computed, nextTick, shallowRef, useTemplateRef, watch } from 'vue'\nimport type { FlowComments } from '../comments'\nimport type { FlowCommentAnchor } from '../context'\nimport { format, type FlowMessages } from '../locale'\n\n/*\n * The comments over the canvas: a marker on each node and edge with open\n * threads, and the card with the threads of the one opened, or the box\n * for a thread being started.\n */\n\nexport interface FlowCommentMarker {\n key: string\n anchor: FlowCommentAnchor\n /** The open threads there, oldest first, counted on the marker; empty for a thread being started. */\n threads: string[]\n /** The threads its card shows: the open ones, and a resolved one opened from outside. */\n shown: string[]\n /** A thread is being started here. */\n pending: boolean\n /** Where it goes, in px within the editor. */\n x: number\n y: number\n /** Above an edge's label: a finger's target keeps clear of the label. */\n lifted: boolean\n /**\n * A pin on a point of a node: its place among the open pins there, from\n * 1; `0` for one being started or a resolved one opened from outside.\n */\n number?: number\n /** The name of the node it is on, for screen readers. */\n node?: string\n}\n\nconst props = defineProps<{\n comments: FlowComments\n markers: FlowCommentMarker[]\n messages: FlowMessages\n /** Gives the focus back to what a thread is about, after the card closes. */\n restore: (anchor: FlowCommentAnchor | null) => void\n}>()\n\nconst { comments } = props\nconst panel = shallowRef<HTMLElement | null>(null)\nconst markerEls = new Map<string, HTMLElement>()\n\n/** The marker the card belongs to: the active thread's, or the one being started. */\nconst current = computed<FlowCommentMarker | null>(() => {\n if (comments.pending.value) return props.markers.find((m) => m.pending) ?? null\n const id = comments.active.value\n return (id && props.markers.find((m) => m.shown.includes(id))) || null\n})\n\n/** The threads the card shows: every open one there, or the active one opened from elsewhere. */\nconst shown = computed<CommentThread[]>(() => {\n const marker = current.value\n if (!marker || comments.pending.value) return []\n const byId = new Map(comments.threads.value.map((t) => [t.id, t]))\n return marker.shown.flatMap((id) => byId.get(id) ?? [])\n})\n\nconst open = computed(() => !!current.value)\n\nconst layer = shallowRef<HTMLElement | null>(null)\n/** The marker has been panned out of the editor: the card waits, hidden, until it is back. */\nconst away = computed(() => {\n const marker = current.value\n const el = layer.value\n if (!marker || !el) return false\n return marker.x < 0 || marker.y < 0 || marker.x > el.clientWidth || marker.y > el.clientHeight\n})\n\n// Hiding the card drops the focus in it: give it back when the card returns.\nlet awayFocus: HTMLElement | null = null\nwatch(away, async (now) => {\n if (now) {\n const el = document.activeElement\n awayFocus = el instanceof HTMLElement && panel.value?.contains(el) ? el : null\n return\n }\n const el = awayFocus\n awayFocus = null\n await nextTick()\n const at = document.activeElement\n if (el?.isConnected && (!at || at === document.body)) el.focus({ preventScroll: true })\n})\n\n/** Narrower than this, the card can't sit beside a node: it goes under (or over) the whole node. */\nconst NARROW = 600\n\nconst anchor: VirtualElement = {\n getBoundingClientRect() {\n const marker = current.value\n const el = marker && markerEls.get(marker.key)\n if (!el) return new DOMRect()\n const rect = el.getBoundingClientRect()\n const root = layer.value\n if (!root || root.clientWidth >= NARROW || !('node' in marker.anchor)) return rect\n // on a phone, the card would cover the node it is about\n const node = root\n .closest('.dou-flow-editor')\n ?.querySelector(`[data-node-id=\"${CSS.escape(marker.anchor.node)}\"]`)\n if (!node) return rect\n const box = node.getBoundingClientRect()\n const left = Math.min(rect.left, box.left)\n const top = Math.min(rect.top, box.top)\n return new DOMRect(\n left,\n top,\n Math.max(rect.right, box.right) - left,\n Math.max(rect.bottom, box.bottom) - top,\n )\n },\n}\n\nconst { style, placement, update } = useFloating(() => (open.value ? anchor : null), panel, {\n open,\n placement: 'bottom-start',\n offset: 6,\n})\nconst { next } = useZIndex()\nconst zIndex = shallowRef(0)\nwatch(open, (value) => value && (zIndex.value = next()), { immediate: true })\n// follows its marker as the canvas pans and zooms\nwatch(\n () => current.value && [current.value.x, current.value.y],\n () => open.value && void nextTick(update),\n)\n\nlet lastAnchor: FlowCommentAnchor | null = null\nwatch(current, (marker) => marker && (lastAnchor = marker.anchor), { immediate: true })\n\nconst focusLost = () => {\n const el = document.activeElement\n return !el || el === document.body || !!panel.value?.contains(el)\n}\n\nfunction close() {\n const refocus = focusLost()\n comments.close()\n if (refocus) props.restore(lastAnchor)\n}\n\nuseLayer({\n open,\n elements: () => [panel.value, ...markerEls.values()],\n onEscape: () => close(),\n onOutside: () => comments.close(),\n})\n\nconst views = useTemplateRef<InstanceType<typeof DouCommentThread>[]>('views')\n// asked to (the keyboard shortcut, or a thread just started): the reply box\nwatch(\n () => comments.focusRequest.value,\n async () => {\n await nextTick()\n await nextTick()\n const id = comments.active.value\n const index = shown.value.findIndex((t) => t.id === id)\n views.value?.[Math.max(0, index)]?.focus()\n },\n)\n\n// a thread resolved or removed from the card: back to what it is about,\n// once the card is gone\nfunction onClosed() {\n const el = document.activeElement\n if (!el || el === document.body) props.restore(lastAnchor)\n}\n\n/**\n * When the thread being started was opened. A tap that starts one (the\n * whiteboard's comment tool) is followed by the click the browser makes\n * from it, which lands on the new pin just drawn under the finger: that\n * one doesn't close it.\n */\nlet startedAt = -Infinity\nwatch(\n () => comments.pending.value,\n (now) => now && (startedAt = performance.now()),\n)\n\nfunction press(marker: FlowCommentMarker, event: MouseEvent) {\n if (marker.pending && performance.now() - startedAt < 500) return\n if (current.value?.key === marker.key) return comments.close()\n // pressed from the keyboard (no clicks counted): straight into the reply box;\n // a click or tap only shows the threads, without bringing up a phone's keyboard\n const focus = event.detail === 0\n const [first] = marker.threads\n if (first) comments.show(first, focus)\n else comments.start(marker.anchor, focus)\n}\n\nconst label = (marker: FlowCommentMarker) =>\n marker.number\n ? format(props.messages.commentPin, { number: marker.number, node: marker.node ?? '' })\n : marker.threads.length\n ? format(props.messages.comments, { count: marker.threads.length })\n : props.messages.comment\n</script>\n\n<template>\n <div ref=\"layer\" class=\"dou-flow-editor__comments\">\n <button\n v-for=\"marker in markers\"\n :key=\"marker.key\"\n :ref=\"\n (el) => (el ? markerEls.set(marker.key, el as HTMLElement) : markerEls.delete(marker.key))\n \"\n type=\"button\"\n class=\"dou-flow-editor__comment\"\n :class=\"{\n 'is-active': current?.key === marker.key,\n 'is-new': !marker.threads.length,\n 'is-node': 'node' in marker.anchor && marker.number === undefined,\n 'is-pin': marker.number !== undefined,\n 'is-lifted': marker.lifted,\n }\"\n :style=\"{ translate: `${marker.x}px ${marker.y}px` }\"\n :aria-label=\"label(marker)\"\n :aria-expanded=\"current?.key === marker.key\"\n :data-thread=\"marker.threads[0]\"\n @click=\"press(marker, $event)\"\n >\n <span v-if=\"marker.number\" class=\"dou-flow-editor__comment-count\">{{ marker.number }}</span>\n <template v-else>\n <MessageCircleIcon aria-hidden=\"true\" />\n <span\n v-if=\"marker.number === undefined && marker.threads.length > 1\"\n class=\"dou-flow-editor__comment-count\"\n >{{ marker.threads.length }}</span\n >\n </template>\n </button>\n </div>\n <Transition name=\"dou-floating\" @after-leave=\"onClosed\">\n <div\n v-if=\"open\"\n ref=\"panel\"\n class=\"dou-floating dou-flow-editor__comment-card\"\n :class=\"{ 'is-away': away }\"\n role=\"dialog\"\n :aria-label=\"messages.comment\"\n :style=\"[style, { zIndex }]\"\n :data-placement=\"placement\"\n >\n <template v-if=\"comments.pending.value\">\n <DouCommentThread\n ref=\"views\"\n key=\"new\"\n :thread=\"null\"\n :author=\"comments.author.value\"\n :autofocus=\"comments.pendingFocus.value\"\n @action=\"comments.apply\"\n @cancel=\"close\"\n />\n </template>\n <template v-else>\n <DouCommentThread\n v-for=\"thread in shown\"\n :key=\"thread.id\"\n ref=\"views\"\n :thread=\"thread\"\n :author=\"comments.author.value\"\n :readonly=\"!com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": "0.1.0-alpha.19",
|
|
4
4
|
"description": "DouUI 的流程编辑器:在无限画布上拖动节点、连接端口",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"vue",
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
"build": "vite build && vue-tsc -p tsconfig.build.json && bun scripts/build-style.ts"
|
|
55
55
|
},
|
|
56
56
|
"peerDependencies": {
|
|
57
|
-
"dou-ui": "0.1.0-alpha.
|
|
57
|
+
"dou-ui": "0.1.0-alpha.19",
|
|
58
58
|
"vue": "^3.5.0",
|
|
59
59
|
"yjs": "^13.6.0"
|
|
60
60
|
},
|
|
@@ -64,7 +64,7 @@
|
|
|
64
64
|
}
|
|
65
65
|
},
|
|
66
66
|
"dependencies": {
|
|
67
|
-
"@dou-ui/icons": "0.1.0-alpha.
|
|
67
|
+
"@dou-ui/icons": "0.1.0-alpha.19"
|
|
68
68
|
},
|
|
69
69
|
"devDependencies": {
|
|
70
70
|
"y-protocols": "^1.0.7",
|