@floegence/floe-webapp-core 0.36.41 → 0.36.43
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/components/icons/index.d.ts +2 -0
- package/dist/components/icons/index.js +419 -397
- package/dist/components/ui/FloatingWindow.d.ts +3 -0
- package/dist/components/ui/FloatingWindow.js +181 -181
- package/dist/components/ui/floatingWindowGeometry.d.ts +15 -0
- package/dist/components/ui/floatingWindowGeometry.js +80 -48
- package/dist/components/ui/index.d.ts +1 -0
- package/dist/components/workbench/WorkbenchCanvas.d.ts +45 -2
- package/dist/components/workbench/WorkbenchCanvas.js +265 -66
- package/dist/components/workbench/WorkbenchCanvasField.d.ts +47 -2
- package/dist/components/workbench/WorkbenchCanvasField.js +258 -78
- package/dist/components/workbench/WorkbenchFilterBar.d.ts +9 -7
- package/dist/components/workbench/WorkbenchFilterBar.js +233 -145
- package/dist/components/workbench/WorkbenchLayerObjects.d.ts +136 -0
- package/dist/components/workbench/WorkbenchLayerObjects.js +986 -0
- package/dist/components/workbench/WorkbenchOverlay.d.ts +4 -1
- package/dist/components/workbench/WorkbenchOverlay.js +59 -29
- package/dist/components/workbench/WorkbenchSurface.d.ts +23 -11
- package/dist/components/workbench/WorkbenchSurface.js +315 -195
- package/dist/components/workbench/WorkbenchWidget.js +37 -37
- package/dist/components/workbench/index.d.ts +2 -1
- package/dist/components/workbench/types.d.ts +96 -1
- package/dist/components/workbench/types.js +12 -4
- package/dist/components/workbench/useWorkbenchModel.d.ts +62 -4
- package/dist/components/workbench/useWorkbenchModel.js +790 -253
- package/dist/components/workbench/widgets/widgetRegistry.d.ts +1 -1
- package/dist/components/workbench/workbenchHelpers.d.ts +5 -5
- package/dist/components/workbench/workbenchHelpers.js +345 -154
- package/dist/components/workbench/workbenchOptions.d.ts +43 -0
- package/dist/components/workbench/workbenchOptions.js +112 -0
- package/dist/full.js +620 -616
- package/dist/icons.js +71 -69
- package/dist/styles.css +1 -1
- package/dist/ui.js +42 -40
- package/dist/workbench.css +1117 -26
- package/dist/workbench.js +52 -36
- package/package.json +1 -1
|
@@ -0,0 +1,986 @@
|
|
|
1
|
+
import { insert as y, createComponent as v, memo as p, effect as W, addEventListener as N, use as Z, setAttribute as g, classList as ue, style as ee, template as R, setStyleProperty as q, delegateEvents as Me } from "solid-js/web";
|
|
2
|
+
import { createMemo as $, For as V, Show as F, createSignal as B, onCleanup as te, createEffect as ae, untrack as oe } from "solid-js";
|
|
3
|
+
import { GripVertical as Se, Check as Le, Copy as De, Trash as me, ChevronDown as Oe, Minus as We, Plus as Ne } from "../icons/index.js";
|
|
4
|
+
import { startHotInteraction as Ce } from "../../utils/hotInteraction.js";
|
|
5
|
+
import { startPointerSession as ze } from "../ui/pointerSession.js";
|
|
6
|
+
import { WORKBENCH_STICKY_NOTE_COLORS as Ge, WORKBENCH_REGION_FILL_OPTIONS as je, WORKBENCH_BACKGROUND_MATERIALS as Ae, WORKBENCH_TEXT_FONT_OPTIONS as se, WORKBENCH_TEXT_COLOR_OPTIONS as Fe, WORKBENCH_TEXT_EMOJI_OPTIONS as Be } from "./workbenchOptions.js";
|
|
7
|
+
import { createWorkbenchWidgetSurfaceMetrics as He } from "./workbenchHelpers.js";
|
|
8
|
+
var Ue = /* @__PURE__ */ R('<div class=workbench-sticky__actions data-floe-workbench-sticky-local=true><button type=button class=workbench-sticky__tool aria-label="Copy sticky note content"></button><button type=button class=workbench-sticky__tool aria-label="Change sticky note color"title="Change sticky note color"><span class=workbench-sticky__color-dot aria-hidden=true></span></button><button type=button class="workbench-sticky__tool is-danger"aria-label="Delete sticky note"title="Delete sticky note">'), Xe = /* @__PURE__ */ R('<button type=button class="workbench-layer-resize workbench-sticky__resize"aria-label="Resize sticky note">'), Ye = /* @__PURE__ */ R('<article class=workbench-sticky data-floe-canvas-interactive=true data-floe-workbench-widget-root=true data-wb-plane=work data-wb-object-kind=sticky tabindex=0><div class=workbench-sticky__surface><header class=workbench-sticky__header><button type=button class=workbench-sticky__grip aria-label="Drag sticky note"data-floe-workbench-sticky-local=true data-wb-part=move></button></header><div class=workbench-sticky__body role=textbox aria-multiline=true aria-label="Sticky note body"data-floe-workbench-text-selection-surface=true data-wb-text-editor=plain data-floe-workbench-sticky-local=true data-wb-part=content>'), Ke = /* @__PURE__ */ R("<article class=workbench-text-annotation data-wb-plane=annotation data-wb-object-kind=text data-wb-part=body><div class=workbench-text-annotation__content data-floe-workbench-text-selection-surface=true data-wb-text-editor=plain data-wb-part=content>"), Ve = /* @__PURE__ */ R("<article class=workbench-background-region data-wb-plane=background data-wb-object-kind=region data-wb-part=body>"), Je = /* @__PURE__ */ R('<div class=workbench-text-font-popover role=menu aria-label="Bold font">'), qe = /* @__PURE__ */ R("<div class=workbench-text-emoji-popover role=menu aria-label=Emoji>"), Qe = /* @__PURE__ */ R('<div class="workbench-layer-control workbench-layer-control--text"data-floe-canvas-interactive=true data-wb-plane=overlay data-wb-object-kind=text data-wb-part=toolbar><div class="workbench-layer-control__selection is-text"aria-hidden=true></div><div class=workbench-text-annotation__toolbar data-floe-canvas-interactive=true><button type=button aria-label="Move text"title="Move text"class="workbench-layer-mini-button workbench-layer-move-handle"data-wb-part=move></button><div class=workbench-text-font-picker data-floe-canvas-interactive=true><button type=button aria-label="Choose bold font"aria-haspopup=menu title="Choose bold font"class=workbench-text-font-trigger><span class=workbench-text-font-trigger__sample>Aa</span><span class=workbench-text-font-trigger__label></span></button></div><div class=workbench-text-size-stepper role=group aria-label="Text size"><button type=button aria-label="Decrease text size"title="Decrease text size"class=workbench-text-size-stepper__button></button><input class=workbench-text-annotation__size-input type=text inputmode=numeric pattern=[0-9]* aria-label="Text size value"><button type=button aria-label="Increase text size"title="Increase text size"class=workbench-text-size-stepper__button></button></div><div class=workbench-text-emoji-picker data-floe-canvas-interactive=true><button type=button aria-label="Insert emoji"aria-haspopup=menu title="Insert emoji"class=workbench-text-emoji-trigger>✨</button></div><button type=button class=workbench-layer-mini-button></button><button type=button class="workbench-layer-mini-button is-danger"aria-label="Delete text"></button></div><button type=button class=workbench-layer-resize aria-label="Resize text"data-wb-part=resize>'), Ze = /* @__PURE__ */ R("<button type=button role=menuitemradio class=workbench-text-font-option><span class=workbench-text-font-option__sample>Aa</span><span class=workbench-text-font-option__label>"), pe = /* @__PURE__ */ R("<button type=button class=workbench-layer-swatch>"), et = /* @__PURE__ */ R("<button type=button role=menuitem class=workbench-text-emoji-option>"), tt = /* @__PURE__ */ R('<div class="workbench-layer-control workbench-layer-control--region"data-floe-canvas-interactive=true data-wb-plane=overlay data-wb-object-kind=region data-wb-part=toolbar><div class="workbench-layer-control__selection is-region"aria-hidden=true></div><div class=workbench-background-region__toolbar data-floe-canvas-interactive=true><div class=workbench-region-material-group role=group aria-label="Region material"></div><button type=button class=workbench-layer-mini-button>%</button><button type=button class="workbench-layer-mini-button is-danger"aria-label="Delete background region"></button></div><button type=button class=workbench-layer-resize aria-label="Resize background region"data-wb-part=resize>'), it = /* @__PURE__ */ R('<button type=button class="workbench-layer-swatch workbench-layer-swatch--region">'), nt = /* @__PURE__ */ R("<button type=button class=workbench-region-material><span class=workbench-region-material__sample aria-hidden=true>"), ot = /* @__PURE__ */ R("<div class=workbench-background-layer>"), at = /* @__PURE__ */ R("<div class=workbench-annotation-layer>"), rt = /* @__PURE__ */ R("<div class=workbench-control-overlay-layer data-wb-plane=overlay>");
|
|
9
|
+
const lt = 190, ct = 132, dt = 180, st = 120, ut = 96, mt = 42, $e = {
|
|
10
|
+
solid: "Solid",
|
|
11
|
+
dotted: "Dotted",
|
|
12
|
+
grid: "Grid",
|
|
13
|
+
hatched: "Hatched",
|
|
14
|
+
glass: "Glass"
|
|
15
|
+
}, ht = {
|
|
16
|
+
amber: "is-amber",
|
|
17
|
+
sage: "is-sage",
|
|
18
|
+
azure: "is-azure",
|
|
19
|
+
coral: "is-coral",
|
|
20
|
+
rose: "is-rose",
|
|
21
|
+
graphite: "is-graphite"
|
|
22
|
+
};
|
|
23
|
+
function Et() {
|
|
24
|
+
const e = /* @__PURE__ */ new Map();
|
|
25
|
+
return {
|
|
26
|
+
register(i, o) {
|
|
27
|
+
return e.set(i, o), () => {
|
|
28
|
+
e.get(i) === o && e.delete(i);
|
|
29
|
+
};
|
|
30
|
+
},
|
|
31
|
+
get(i) {
|
|
32
|
+
return e.get(i);
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
function Ee(e) {
|
|
37
|
+
return [...e].sort((i, o) => i.z_index !== o.z_index ? i.z_index - o.z_index : i.created_at_unix_ms !== o.created_at_unix_ms ? i.created_at_unix_ms - o.created_at_unix_ms : i.id.localeCompare(o.id));
|
|
38
|
+
}
|
|
39
|
+
function Pe(e) {
|
|
40
|
+
return new Map(e.map((i) => [i.id, i]));
|
|
41
|
+
}
|
|
42
|
+
function Ie(e, i) {
|
|
43
|
+
const o = e.findIndex((n) => n === i);
|
|
44
|
+
return e[(o + 1) % e.length] ?? e[0];
|
|
45
|
+
}
|
|
46
|
+
function _e(e, i, o) {
|
|
47
|
+
ae(() => {
|
|
48
|
+
if (!e() || typeof document > "u") return;
|
|
49
|
+
const n = (r) => {
|
|
50
|
+
const t = i();
|
|
51
|
+
t && r.target instanceof Node && t.contains(r.target) || o();
|
|
52
|
+
}, a = (r) => {
|
|
53
|
+
r.key === "Escape" && o();
|
|
54
|
+
};
|
|
55
|
+
document.addEventListener("pointerdown", n, !0), document.addEventListener("keydown", a), te(() => {
|
|
56
|
+
document.removeEventListener("pointerdown", n, !0), document.removeEventListener("keydown", a);
|
|
57
|
+
});
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
function bt(e, i) {
|
|
61
|
+
if (!e || e.rangeCount <= 0) return !1;
|
|
62
|
+
const o = e.getRangeAt(0).commonAncestorContainer;
|
|
63
|
+
return o === i || i.contains(o);
|
|
64
|
+
}
|
|
65
|
+
function Te(e) {
|
|
66
|
+
const [i, o] = B(), [n, a] = B(!1), [r, t] = B(!1), m = () => i()?.textContent ?? e.value(), _ = (x) => o(x), c = (x) => {
|
|
67
|
+
const u = x.textContent ?? "";
|
|
68
|
+
u !== e.value() && e.onCommit(u);
|
|
69
|
+
};
|
|
70
|
+
return ae(() => {
|
|
71
|
+
const x = i();
|
|
72
|
+
if (!x || n() || r()) return;
|
|
73
|
+
const u = e.value();
|
|
74
|
+
(x.textContent ?? "") !== u && (x.textContent = u);
|
|
75
|
+
}), {
|
|
76
|
+
bind: _,
|
|
77
|
+
readText: m,
|
|
78
|
+
focus: () => i()?.focus(),
|
|
79
|
+
insertTextAtSelection: (x) => {
|
|
80
|
+
const u = i();
|
|
81
|
+
if (!u) return;
|
|
82
|
+
u.focus();
|
|
83
|
+
const z = document.getSelection(), C = bt(z, u), L = C && z ? z.getRangeAt(0) : document.createRange();
|
|
84
|
+
C || (L.selectNodeContents(u), L.collapse(!1)), L.deleteContents();
|
|
85
|
+
const b = document.createTextNode(x);
|
|
86
|
+
L.insertNode(b), L.setStartAfter(b), L.collapse(!0), z?.removeAllRanges(), z?.addRange(L), c(u);
|
|
87
|
+
},
|
|
88
|
+
handleFocus: () => {
|
|
89
|
+
t(!0);
|
|
90
|
+
},
|
|
91
|
+
handleBlur: (x) => {
|
|
92
|
+
n() || c(x.currentTarget), t(!1);
|
|
93
|
+
},
|
|
94
|
+
handleInput: (x) => {
|
|
95
|
+
n() || x.isComposing || c(x.currentTarget);
|
|
96
|
+
},
|
|
97
|
+
handleCompositionStart: () => {
|
|
98
|
+
a(!0);
|
|
99
|
+
},
|
|
100
|
+
handleCompositionEnd: (x) => {
|
|
101
|
+
c(x.currentTarget), a(!1);
|
|
102
|
+
}
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
function wt(e) {
|
|
106
|
+
return Math.max(8, Math.min(160, Math.round(e)));
|
|
107
|
+
}
|
|
108
|
+
function Y(e) {
|
|
109
|
+
e.stopPropagation();
|
|
110
|
+
}
|
|
111
|
+
function K(e) {
|
|
112
|
+
e.stopPropagation();
|
|
113
|
+
}
|
|
114
|
+
function M(e) {
|
|
115
|
+
e.preventDefault(), e.stopPropagation();
|
|
116
|
+
}
|
|
117
|
+
function T(e) {
|
|
118
|
+
e.stopPropagation();
|
|
119
|
+
}
|
|
120
|
+
function re(e, i, o) {
|
|
121
|
+
return e?.kind === i && e.id === o ? e : null;
|
|
122
|
+
}
|
|
123
|
+
function le(e) {
|
|
124
|
+
const [i, o] = B(null);
|
|
125
|
+
let n;
|
|
126
|
+
return te(() => {
|
|
127
|
+
n?.stop({
|
|
128
|
+
reason: "manual_stop",
|
|
129
|
+
commit: !1
|
|
130
|
+
}), n = void 0, oe(i)?.stopInteraction();
|
|
131
|
+
}), {
|
|
132
|
+
position: $(() => {
|
|
133
|
+
const t = i();
|
|
134
|
+
return t ? {
|
|
135
|
+
x: t.worldX,
|
|
136
|
+
y: t.worldY
|
|
137
|
+
} : e.readPosition();
|
|
138
|
+
}),
|
|
139
|
+
isDragging: () => i() !== null,
|
|
140
|
+
beginDrag: (t) => {
|
|
141
|
+
if (t.button !== 0) return;
|
|
142
|
+
t.preventDefault(), t.stopPropagation(), n?.stop({
|
|
143
|
+
reason: "manual_stop",
|
|
144
|
+
commit: !1
|
|
145
|
+
});
|
|
146
|
+
const m = e.readPosition(), _ = Math.max(e.viewportScale(), 1e-3), c = Ce({
|
|
147
|
+
kind: "drag",
|
|
148
|
+
cursor: "grabbing"
|
|
149
|
+
});
|
|
150
|
+
let k = !1;
|
|
151
|
+
e.onInteractionStart?.();
|
|
152
|
+
const S = () => {
|
|
153
|
+
k || (k = !0, c(), e.onInteractionEnd?.());
|
|
154
|
+
};
|
|
155
|
+
o({
|
|
156
|
+
pointerId: t.pointerId,
|
|
157
|
+
startClientX: t.clientX,
|
|
158
|
+
startClientY: t.clientY,
|
|
159
|
+
startWorldX: m.x,
|
|
160
|
+
startWorldY: m.y,
|
|
161
|
+
worldX: m.x,
|
|
162
|
+
worldY: m.y,
|
|
163
|
+
scale: _,
|
|
164
|
+
moved: !1,
|
|
165
|
+
stopInteraction: S
|
|
166
|
+
}), n = ze({
|
|
167
|
+
pointerEvent: t,
|
|
168
|
+
captureEl: t.currentTarget,
|
|
169
|
+
onMove: (s) => {
|
|
170
|
+
let l = null;
|
|
171
|
+
o((d) => !d || d.pointerId !== s.pointerId ? d : (l = {
|
|
172
|
+
x: d.startWorldX + (s.clientX - d.startClientX) / d.scale,
|
|
173
|
+
y: d.startWorldY + (s.clientY - d.startClientY) / d.scale
|
|
174
|
+
}, {
|
|
175
|
+
...d,
|
|
176
|
+
worldX: l.x,
|
|
177
|
+
worldY: l.y,
|
|
178
|
+
moved: d.moved || Math.abs(l.x - d.startWorldX) > 2 || Math.abs(l.y - d.startWorldY) > 2
|
|
179
|
+
})), l && e.onPreviewMove?.(l);
|
|
180
|
+
},
|
|
181
|
+
onEnd: ({
|
|
182
|
+
commit: s
|
|
183
|
+
}) => {
|
|
184
|
+
const l = oe(i);
|
|
185
|
+
if (l && s) {
|
|
186
|
+
const d = {
|
|
187
|
+
x: l.worldX,
|
|
188
|
+
y: l.worldY
|
|
189
|
+
};
|
|
190
|
+
e.onCommitStart?.(d), l.moved && e.onCommitMove(d);
|
|
191
|
+
}
|
|
192
|
+
l?.stopInteraction(), o(null), n = void 0, e.onPreviewEnd?.();
|
|
193
|
+
}
|
|
194
|
+
});
|
|
195
|
+
}
|
|
196
|
+
};
|
|
197
|
+
}
|
|
198
|
+
function he(e) {
|
|
199
|
+
const [i, o] = B(null);
|
|
200
|
+
let n;
|
|
201
|
+
return te(() => {
|
|
202
|
+
n?.stop({
|
|
203
|
+
reason: "manual_stop",
|
|
204
|
+
commit: !1
|
|
205
|
+
}), n = void 0, oe(i)?.stopInteraction();
|
|
206
|
+
}), {
|
|
207
|
+
size: $(() => {
|
|
208
|
+
const t = i();
|
|
209
|
+
return t ? {
|
|
210
|
+
width: t.width,
|
|
211
|
+
height: t.height
|
|
212
|
+
} : e.readSize();
|
|
213
|
+
}),
|
|
214
|
+
isResizing: () => i() !== null,
|
|
215
|
+
beginResize: (t) => {
|
|
216
|
+
if (t.button !== 0) return;
|
|
217
|
+
t.preventDefault(), t.stopPropagation(), n?.stop({
|
|
218
|
+
reason: "manual_stop",
|
|
219
|
+
commit: !1
|
|
220
|
+
});
|
|
221
|
+
const m = e.readSize(), _ = Math.max(e.viewportScale(), 1e-3), c = Ce({
|
|
222
|
+
kind: "resize",
|
|
223
|
+
cursor: "nwse-resize"
|
|
224
|
+
});
|
|
225
|
+
let k = !1;
|
|
226
|
+
e.onInteractionStart?.();
|
|
227
|
+
const S = () => {
|
|
228
|
+
k || (k = !0, c(), e.onInteractionEnd?.());
|
|
229
|
+
};
|
|
230
|
+
o({
|
|
231
|
+
pointerId: t.pointerId,
|
|
232
|
+
startClientX: t.clientX,
|
|
233
|
+
startClientY: t.clientY,
|
|
234
|
+
startWidth: m.width,
|
|
235
|
+
startHeight: m.height,
|
|
236
|
+
width: m.width,
|
|
237
|
+
height: m.height,
|
|
238
|
+
scale: _,
|
|
239
|
+
stopInteraction: S
|
|
240
|
+
}), n = ze({
|
|
241
|
+
pointerEvent: t,
|
|
242
|
+
captureEl: t.currentTarget,
|
|
243
|
+
onMove: (s) => {
|
|
244
|
+
let l = null;
|
|
245
|
+
o((d) => !d || d.pointerId !== s.pointerId ? d : (l = {
|
|
246
|
+
width: Math.max(e.minWidth, d.startWidth + (s.clientX - d.startClientX) / d.scale),
|
|
247
|
+
height: Math.max(e.minHeight, d.startHeight + (s.clientY - d.startClientY) / d.scale)
|
|
248
|
+
}, {
|
|
249
|
+
...d,
|
|
250
|
+
width: l.width,
|
|
251
|
+
height: l.height
|
|
252
|
+
})), l && e.onPreviewResize?.(l);
|
|
253
|
+
},
|
|
254
|
+
onEnd: ({
|
|
255
|
+
commit: s
|
|
256
|
+
}) => {
|
|
257
|
+
const l = oe(i);
|
|
258
|
+
l && s && e.onCommitResize({
|
|
259
|
+
width: l.width,
|
|
260
|
+
height: l.height
|
|
261
|
+
}), l?.stopInteraction(), o(null), n = void 0, e.onPreviewEnd?.();
|
|
262
|
+
}
|
|
263
|
+
});
|
|
264
|
+
}
|
|
265
|
+
};
|
|
266
|
+
}
|
|
267
|
+
function Pt(e) {
|
|
268
|
+
const i = Te({
|
|
269
|
+
value: () => e.item.body,
|
|
270
|
+
onCommit: (w) => e.onUpdate(e.item.id, {
|
|
271
|
+
body: w
|
|
272
|
+
})
|
|
273
|
+
}), [o, n] = B(!1);
|
|
274
|
+
let a;
|
|
275
|
+
const r = () => {
|
|
276
|
+
typeof window > "u" || a === void 0 || (window.clearTimeout(a), a = void 0);
|
|
277
|
+
}, t = () => {
|
|
278
|
+
n(!0), r(), !(typeof window > "u") && (a = window.setTimeout(() => {
|
|
279
|
+
a = void 0, n(!1);
|
|
280
|
+
}, 720));
|
|
281
|
+
};
|
|
282
|
+
te(() => r());
|
|
283
|
+
const m = async () => {
|
|
284
|
+
typeof navigator > "u" || !navigator.clipboard?.writeText || (await navigator.clipboard.writeText(i.readText()), t());
|
|
285
|
+
}, _ = (w) => {
|
|
286
|
+
w.button === 0 && (e.onSelect(e.item.id), !e.locked && (w.target instanceof Element && w.target.closest('[data-floe-workbench-sticky-local="true"]') || (e.onStartOptimisticFront?.(e.item.id), c.beginDrag(w))));
|
|
287
|
+
}, c = le({
|
|
288
|
+
viewportScale: () => e.viewportScale,
|
|
289
|
+
readPosition: () => ({
|
|
290
|
+
x: e.item.x,
|
|
291
|
+
y: e.item.y
|
|
292
|
+
}),
|
|
293
|
+
onCommitMove: (w) => e.onCommitMove(e.item.id, w),
|
|
294
|
+
onCommitStart: () => e.onCommitFront?.(e.item.id),
|
|
295
|
+
onInteractionStart: () => e.onLayoutInteractionStart?.(),
|
|
296
|
+
onInteractionEnd: () => e.onLayoutInteractionEnd?.()
|
|
297
|
+
}), k = he({
|
|
298
|
+
viewportScale: () => e.viewportScale,
|
|
299
|
+
readSize: () => ({
|
|
300
|
+
width: e.item.width,
|
|
301
|
+
height: e.item.height
|
|
302
|
+
}),
|
|
303
|
+
minWidth: lt,
|
|
304
|
+
minHeight: ct,
|
|
305
|
+
onCommitResize: (w) => e.onCommitResize(e.item.id, w),
|
|
306
|
+
onInteractionStart: () => e.onLayoutInteractionStart?.(),
|
|
307
|
+
onInteractionEnd: () => e.onLayoutInteractionEnd?.()
|
|
308
|
+
}), S = $(() => c.position()), s = $(() => k.size()), l = $(() => {
|
|
309
|
+
if (e.projectedViewport)
|
|
310
|
+
return He({
|
|
311
|
+
widgetId: e.item.id,
|
|
312
|
+
worldX: S().x,
|
|
313
|
+
worldY: S().y,
|
|
314
|
+
worldWidth: s().width,
|
|
315
|
+
worldHeight: s().height,
|
|
316
|
+
viewport: e.projectedViewport(),
|
|
317
|
+
ready: e.surfaceReady ?? !0
|
|
318
|
+
});
|
|
319
|
+
}), d = $(() => l()?.rect.viewportScale ?? Math.max(e.viewportScale, 1e-3)), G = $(() => ({
|
|
320
|
+
width: `${s().width}px`,
|
|
321
|
+
height: `${s().height}px`,
|
|
322
|
+
transform: e.projectedViewport ? `translate(${l()?.rect.screenX ?? 0}px, ${l()?.rect.screenY ?? 0}px) scale(${d()})` : `translate(${S().x}px, ${S().y}px)`,
|
|
323
|
+
"transform-origin": "0 0",
|
|
324
|
+
"z-index": `${e.selected || e.optimisticFront || c.isDragging() || k.isResizing() ? e.topRenderLayer + 1 : e.renderLayer}`
|
|
325
|
+
}));
|
|
326
|
+
return (() => {
|
|
327
|
+
var w = Ye(), x = w.firstChild, u = x.firstChild, z = u.firstChild, C = u.nextSibling;
|
|
328
|
+
w.$$contextmenu = (b) => {
|
|
329
|
+
b.preventDefault(), b.stopPropagation(), e.onContextMenu?.(b, e.item);
|
|
330
|
+
}, w.addEventListener("focus", () => e.onSelect(e.item.id)), w.$$pointerdown = _, z.$$pointerdown = (b) => {
|
|
331
|
+
e.onSelect(e.item.id), e.onStartOptimisticFront?.(e.item.id), c.beginDrag(b);
|
|
332
|
+
}, y(z, v(Se, {
|
|
333
|
+
class: "w-3.5 h-3.5"
|
|
334
|
+
})), N(C, "compositionend", i.handleCompositionEnd), N(C, "compositionstart", i.handleCompositionStart), N(C, "input", i.handleInput, !0), N(C, "blur", i.handleBlur), N(C, "focus", i.handleFocus), C.$$pointerdown = (b) => {
|
|
335
|
+
b.stopPropagation(), e.onSelect(e.item.id);
|
|
336
|
+
};
|
|
337
|
+
var L = i.bind;
|
|
338
|
+
return typeof L == "function" ? Z(L, C) : i.bind = C, g(C, "spellcheck", !1), y(w, v(F, {
|
|
339
|
+
get when() {
|
|
340
|
+
return p(() => !!e.selected)() && !e.locked;
|
|
341
|
+
},
|
|
342
|
+
get children() {
|
|
343
|
+
var b = Ue(), O = b.firstChild, j = O.nextSibling, H = j.nextSibling;
|
|
344
|
+
return O.$$click = async (E) => {
|
|
345
|
+
T(E), await m();
|
|
346
|
+
}, O.$$pointerdown = M, y(O, v(F, {
|
|
347
|
+
get when() {
|
|
348
|
+
return o();
|
|
349
|
+
},
|
|
350
|
+
get fallback() {
|
|
351
|
+
return v(De, {
|
|
352
|
+
class: "w-3.5 h-3.5"
|
|
353
|
+
});
|
|
354
|
+
},
|
|
355
|
+
get children() {
|
|
356
|
+
return v(Le, {
|
|
357
|
+
class: "w-3.5 h-3.5"
|
|
358
|
+
});
|
|
359
|
+
}
|
|
360
|
+
})), j.$$click = (E) => {
|
|
361
|
+
T(E), e.onUpdate(e.item.id, {
|
|
362
|
+
color: Ie(Ge, e.item.color)
|
|
363
|
+
});
|
|
364
|
+
}, j.$$pointerdown = M, H.$$click = (E) => {
|
|
365
|
+
T(E), e.onDelete(e.item.id);
|
|
366
|
+
}, H.$$pointerdown = M, y(H, v(me, {
|
|
367
|
+
class: "w-3.5 h-3.5"
|
|
368
|
+
})), W((E) => {
|
|
369
|
+
var A = !!o(), D = o() ? "Sticky note content copied" : "Copy sticky note content";
|
|
370
|
+
return A !== E.e && O.classList.toggle("is-success", E.e = A), D !== E.t && g(O, "title", E.t = D), E;
|
|
371
|
+
}, {
|
|
372
|
+
e: void 0,
|
|
373
|
+
t: void 0
|
|
374
|
+
}), b;
|
|
375
|
+
}
|
|
376
|
+
}), null), y(w, v(F, {
|
|
377
|
+
get when() {
|
|
378
|
+
return !e.locked;
|
|
379
|
+
},
|
|
380
|
+
get children() {
|
|
381
|
+
var b = Xe();
|
|
382
|
+
return N(b, "pointerdown", k.beginResize, !0), b;
|
|
383
|
+
}
|
|
384
|
+
}), null), W((b) => {
|
|
385
|
+
var O = {
|
|
386
|
+
"is-selected": e.selected,
|
|
387
|
+
"is-locked": e.locked,
|
|
388
|
+
"is-filtered-out": e.filtered,
|
|
389
|
+
"is-dragging": c.isDragging(),
|
|
390
|
+
"is-resizing": k.isResizing(),
|
|
391
|
+
"is-copied": o(),
|
|
392
|
+
[ht[e.item.color]]: !0
|
|
393
|
+
}, j = e.item.id, H = e.item.id, E = e.item.id, A = G(), D = e.locked ? !1 : "plaintext-only", J = e.locked ? "true" : void 0;
|
|
394
|
+
return b.e = ue(w, O, b.e), j !== b.t && g(w, "data-floe-workbench-widget-id", b.t = j), H !== b.a && g(w, "data-wb-object-id", b.a = H), E !== b.o && g(w, "data-floe-workbench-sticky-id", b.o = E), b.i = ee(w, A, b.i), D !== b.n && g(C, "contenteditable", b.n = D), J !== b.s && g(C, "aria-disabled", b.s = J), b;
|
|
395
|
+
}, {
|
|
396
|
+
e: void 0,
|
|
397
|
+
t: void 0,
|
|
398
|
+
a: void 0,
|
|
399
|
+
o: void 0,
|
|
400
|
+
i: void 0,
|
|
401
|
+
n: void 0,
|
|
402
|
+
s: void 0
|
|
403
|
+
}), w;
|
|
404
|
+
})();
|
|
405
|
+
}
|
|
406
|
+
function gt(e) {
|
|
407
|
+
const i = Te({
|
|
408
|
+
value: () => e.item.text,
|
|
409
|
+
onCommit: (t) => e.onUpdate(e.item.id, {
|
|
410
|
+
text: t
|
|
411
|
+
})
|
|
412
|
+
});
|
|
413
|
+
ae(() => {
|
|
414
|
+
const t = e.textEditorRegistry;
|
|
415
|
+
if (!t) return;
|
|
416
|
+
const m = t.register(e.item.id, {
|
|
417
|
+
focus: i.focus,
|
|
418
|
+
insertTextAtSelection: i.insertTextAtSelection,
|
|
419
|
+
readText: i.readText
|
|
420
|
+
});
|
|
421
|
+
te(m);
|
|
422
|
+
});
|
|
423
|
+
const o = le({
|
|
424
|
+
viewportScale: () => e.viewportScale,
|
|
425
|
+
readPosition: () => ({
|
|
426
|
+
x: e.item.x,
|
|
427
|
+
y: e.item.y
|
|
428
|
+
}),
|
|
429
|
+
onCommitMove: (t) => e.onCommitMove(e.item.id, t),
|
|
430
|
+
onPreviewMove: (t) => e.onPreviewGeometry?.({
|
|
431
|
+
kind: "annotation",
|
|
432
|
+
id: e.item.id,
|
|
433
|
+
x: t.x,
|
|
434
|
+
y: t.y,
|
|
435
|
+
width: e.item.width,
|
|
436
|
+
height: e.item.height
|
|
437
|
+
}),
|
|
438
|
+
onPreviewEnd: () => e.onPreviewGeometry?.(null)
|
|
439
|
+
}), n = $(() => {
|
|
440
|
+
const t = re(e.preview, "annotation", e.item.id);
|
|
441
|
+
return {
|
|
442
|
+
x: t?.x ?? o.position().x,
|
|
443
|
+
y: t?.y ?? o.position().y,
|
|
444
|
+
width: t?.width ?? e.item.width,
|
|
445
|
+
height: t?.height ?? e.item.height
|
|
446
|
+
};
|
|
447
|
+
}), a = $(() => ({
|
|
448
|
+
width: `${n().width}px`,
|
|
449
|
+
height: `${n().height}px`,
|
|
450
|
+
transform: `translate(${n().x}px, ${n().y}px)`,
|
|
451
|
+
"z-index": `${e.item.z_index}`,
|
|
452
|
+
"--workbench-text-color": e.item.color,
|
|
453
|
+
"--workbench-text-size": `${e.item.font_size}px`,
|
|
454
|
+
"--workbench-text-weight": `${e.item.font_weight}`,
|
|
455
|
+
"--workbench-text-align": e.item.align,
|
|
456
|
+
"--workbench-text-family": e.item.font_family
|
|
457
|
+
})), r = (t) => {
|
|
458
|
+
!e.editable || t.button !== 0 || t.target instanceof Element && t.target.closest(".workbench-text-annotation__content") || (t.stopPropagation(), e.onSelect(e.item.id));
|
|
459
|
+
};
|
|
460
|
+
return (() => {
|
|
461
|
+
var t = Ke(), m = t.firstChild;
|
|
462
|
+
t.$$contextmenu = (c) => {
|
|
463
|
+
e.editable && (c.preventDefault(), c.stopPropagation(), e.onSelect(e.item.id), e.onContextMenu?.(c, e.item));
|
|
464
|
+
}, t.$$pointerdown = r, N(m, "compositionend", i.handleCompositionEnd), N(m, "compositionstart", i.handleCompositionStart), N(m, "input", i.handleInput, !0), N(m, "blur", i.handleBlur), m.addEventListener("focus", (c) => {
|
|
465
|
+
i.handleFocus(c), e.editable && e.onSelect(e.item.id);
|
|
466
|
+
}), m.$$pointerdown = (c) => {
|
|
467
|
+
!e.editable || c.button !== 0 || e.onSelect(e.item.id);
|
|
468
|
+
};
|
|
469
|
+
var _ = i.bind;
|
|
470
|
+
return typeof _ == "function" ? Z(_, m) : i.bind = m, g(m, "spellcheck", !1), W((c) => {
|
|
471
|
+
var k = !!e.selected, S = !!e.editable, s = e.editable ? "true" : void 0, l = e.item.id, d = a(), G = e.editable ? "plaintext-only" : !1, w = e.editable ? 0 : void 0, x = e.editable ? "textbox" : void 0, u = e.editable ? "true" : void 0, z = e.editable ? void 0 : "true";
|
|
472
|
+
return k !== c.e && t.classList.toggle("is-selected", c.e = k), S !== c.t && t.classList.toggle("is-editable", c.t = S), s !== c.a && g(t, "data-floe-canvas-interactive", c.a = s), l !== c.o && g(t, "data-wb-object-id", c.o = l), c.i = ee(t, d, c.i), G !== c.n && g(m, "contenteditable", c.n = G), w !== c.s && g(m, "tabindex", c.s = w), x !== c.h && g(m, "role", c.h = x), u !== c.r && g(m, "aria-multiline", c.r = u), z !== c.d && g(m, "aria-disabled", c.d = z), c;
|
|
473
|
+
}, {
|
|
474
|
+
e: void 0,
|
|
475
|
+
t: void 0,
|
|
476
|
+
a: void 0,
|
|
477
|
+
o: void 0,
|
|
478
|
+
i: void 0,
|
|
479
|
+
n: void 0,
|
|
480
|
+
s: void 0,
|
|
481
|
+
h: void 0,
|
|
482
|
+
r: void 0,
|
|
483
|
+
d: void 0
|
|
484
|
+
}), t;
|
|
485
|
+
})();
|
|
486
|
+
}
|
|
487
|
+
function vt(e) {
|
|
488
|
+
const i = le({
|
|
489
|
+
viewportScale: () => e.viewportScale,
|
|
490
|
+
readPosition: () => ({
|
|
491
|
+
x: e.item.x,
|
|
492
|
+
y: e.item.y
|
|
493
|
+
}),
|
|
494
|
+
onCommitMove: (r) => e.onCommitMove(e.item.id, r),
|
|
495
|
+
onPreviewMove: (r) => e.onPreviewGeometry?.({
|
|
496
|
+
kind: "background_layer",
|
|
497
|
+
id: e.item.id,
|
|
498
|
+
x: r.x,
|
|
499
|
+
y: r.y,
|
|
500
|
+
width: e.item.width,
|
|
501
|
+
height: e.item.height
|
|
502
|
+
}),
|
|
503
|
+
onPreviewEnd: () => e.onPreviewGeometry?.(null)
|
|
504
|
+
}), o = $(() => {
|
|
505
|
+
const r = re(e.preview, "background_layer", e.item.id);
|
|
506
|
+
return {
|
|
507
|
+
x: r?.x ?? i.position().x,
|
|
508
|
+
y: r?.y ?? i.position().y,
|
|
509
|
+
width: r?.width ?? e.item.width,
|
|
510
|
+
height: r?.height ?? e.item.height
|
|
511
|
+
};
|
|
512
|
+
}), n = $(() => ({
|
|
513
|
+
width: `${o().width}px`,
|
|
514
|
+
height: `${o().height}px`,
|
|
515
|
+
transform: `translate(${o().x}px, ${o().y}px)`,
|
|
516
|
+
"z-index": `${e.item.z_index}`,
|
|
517
|
+
"--workbench-region-fill": e.item.fill,
|
|
518
|
+
"--workbench-region-ink": `color-mix(in srgb, ${e.item.fill} 48%, var(--foreground, #111) 52%)`,
|
|
519
|
+
"--workbench-region-opacity": `${e.item.opacity}`
|
|
520
|
+
})), a = (r) => {
|
|
521
|
+
!e.editable || r.button !== 0 || r.target instanceof Element && r.target.closest(".workbench-background-region__toolbar, .workbench-layer-resize") || (e.onSelect(e.item.id), i.beginDrag(r));
|
|
522
|
+
};
|
|
523
|
+
return (() => {
|
|
524
|
+
var r = Ve();
|
|
525
|
+
return r.$$contextmenu = (t) => {
|
|
526
|
+
e.editable && (t.preventDefault(), t.stopPropagation(), e.onSelect(e.item.id), e.onContextMenu?.(t, e.item));
|
|
527
|
+
}, r.addEventListener("focus", () => e.editable && e.onSelect(e.item.id)), r.$$pointerdown = a, W((t) => {
|
|
528
|
+
var m = {
|
|
529
|
+
"is-selected": e.selected,
|
|
530
|
+
"is-editable": e.editable,
|
|
531
|
+
[`is-material-${e.item.material}`]: !0
|
|
532
|
+
}, _ = e.editable ? "true" : void 0, c = e.item.id, k = n(), S = e.editable ? 0 : void 0;
|
|
533
|
+
return t.e = ue(r, m, t.e), _ !== t.t && g(r, "data-floe-canvas-interactive", t.t = _), c !== t.a && g(r, "data-wb-object-id", t.a = c), t.o = ee(r, k, t.o), S !== t.i && g(r, "tabindex", t.i = S), t;
|
|
534
|
+
}, {
|
|
535
|
+
e: void 0,
|
|
536
|
+
t: void 0,
|
|
537
|
+
a: void 0,
|
|
538
|
+
o: void 0,
|
|
539
|
+
i: void 0
|
|
540
|
+
}), r;
|
|
541
|
+
})();
|
|
542
|
+
}
|
|
543
|
+
function ft(e) {
|
|
544
|
+
let i, o, n;
|
|
545
|
+
const [a, r] = B(""), [t, m] = B(!1), [_, c] = B(!1), k = $(() => se.find((u) => u.fontFamily === e.item.font_family) ?? se[0]), S = le({
|
|
546
|
+
viewportScale: () => e.viewportScale,
|
|
547
|
+
readPosition: () => ({
|
|
548
|
+
x: e.item.x,
|
|
549
|
+
y: e.item.y
|
|
550
|
+
}),
|
|
551
|
+
onCommitMove: (u) => e.onCommitMove(e.item.id, u),
|
|
552
|
+
onPreviewMove: (u) => e.onPreviewGeometry?.({
|
|
553
|
+
kind: "annotation",
|
|
554
|
+
id: e.item.id,
|
|
555
|
+
x: u.x,
|
|
556
|
+
y: u.y,
|
|
557
|
+
width: e.item.width,
|
|
558
|
+
height: e.item.height
|
|
559
|
+
}),
|
|
560
|
+
onPreviewEnd: () => e.onPreviewGeometry?.(null)
|
|
561
|
+
}), s = he({
|
|
562
|
+
viewportScale: () => e.viewportScale,
|
|
563
|
+
readSize: () => ({
|
|
564
|
+
width: e.item.width,
|
|
565
|
+
height: e.item.height
|
|
566
|
+
}),
|
|
567
|
+
minWidth: ut,
|
|
568
|
+
minHeight: mt,
|
|
569
|
+
onCommitResize: (u) => e.onCommitResize(e.item.id, u),
|
|
570
|
+
onPreviewResize: (u) => e.onPreviewGeometry?.({
|
|
571
|
+
kind: "annotation",
|
|
572
|
+
id: e.item.id,
|
|
573
|
+
x: e.item.x,
|
|
574
|
+
y: e.item.y,
|
|
575
|
+
width: u.width,
|
|
576
|
+
height: u.height
|
|
577
|
+
}),
|
|
578
|
+
onPreviewEnd: () => e.onPreviewGeometry?.(null)
|
|
579
|
+
}), l = $(() => {
|
|
580
|
+
const u = re(e.preview, "annotation", e.item.id);
|
|
581
|
+
return {
|
|
582
|
+
x: u?.x ?? S.position().x,
|
|
583
|
+
y: u?.y ?? S.position().y,
|
|
584
|
+
width: s.size().width,
|
|
585
|
+
height: s.size().height
|
|
586
|
+
};
|
|
587
|
+
}), d = $(() => ({
|
|
588
|
+
width: `${l().width}px`,
|
|
589
|
+
height: `${l().height}px`,
|
|
590
|
+
transform: `translate(${l().x}px, ${l().y}px)`,
|
|
591
|
+
"z-index": `${e.item.z_index}`,
|
|
592
|
+
"--workbench-layer-control-inverse-scale": `${1 / Math.max(e.viewportScale, 1e-3)}`
|
|
593
|
+
})), G = () => Ie(["left", "center", "right"], e.item.align), w = (u) => {
|
|
594
|
+
if (!Number.isFinite(u)) return;
|
|
595
|
+
const z = wt(u);
|
|
596
|
+
r(String(z)), e.onUpdate(e.item.id, {
|
|
597
|
+
font_size: z
|
|
598
|
+
});
|
|
599
|
+
}, x = () => {
|
|
600
|
+
const u = a().trim(), z = Number(u);
|
|
601
|
+
if (u.length > 0 && Number.isFinite(z)) {
|
|
602
|
+
w(z);
|
|
603
|
+
return;
|
|
604
|
+
}
|
|
605
|
+
r(String(e.item.font_size));
|
|
606
|
+
};
|
|
607
|
+
return ae(() => {
|
|
608
|
+
typeof document < "u" && document.activeElement === i || r(String(e.item.font_size));
|
|
609
|
+
}), _e(t, () => o, () => m(!1)), _e(_, () => n, () => c(!1)), (() => {
|
|
610
|
+
var u = Qe(), z = u.firstChild, C = z.nextSibling, L = C.firstChild, b = L.nextSibling, O = b.firstChild, j = O.firstChild, H = j.nextSibling, E = b.nextSibling, A = E.firstChild, D = A.nextSibling, J = D.nextSibling, U = E.nextSibling, ce = U.firstChild, ie = U.nextSibling, de = ie.nextSibling, Re = C.nextSibling;
|
|
611
|
+
C.$$click = K, C.$$pointerdown = Y, L.$$click = T, N(L, "pointerdown", S.beginDrag, !0), y(L, v(Se, {
|
|
612
|
+
class: "w-3.5 h-3.5"
|
|
613
|
+
})), b.$$click = K, b.$$pointerdown = Y;
|
|
614
|
+
var be = o;
|
|
615
|
+
typeof be == "function" ? Z(be, b) : o = b, O.$$click = (h) => {
|
|
616
|
+
T(h), m((f) => !f);
|
|
617
|
+
}, O.$$pointerdown = M, y(H, () => k().label), y(O, v(Oe, {
|
|
618
|
+
class: "workbench-text-font-trigger__icon"
|
|
619
|
+
}), null), y(b, v(F, {
|
|
620
|
+
get when() {
|
|
621
|
+
return t();
|
|
622
|
+
},
|
|
623
|
+
get children() {
|
|
624
|
+
var h = Je();
|
|
625
|
+
return y(h, v(V, {
|
|
626
|
+
each: se,
|
|
627
|
+
children: (f) => (() => {
|
|
628
|
+
var P = Ze(), X = P.firstChild, ne = X.nextSibling;
|
|
629
|
+
return P.$$click = (I) => {
|
|
630
|
+
T(I), e.onUpdate(e.item.id, {
|
|
631
|
+
font_family: f.fontFamily,
|
|
632
|
+
font_weight: f.fontWeight
|
|
633
|
+
}), m(!1);
|
|
634
|
+
}, P.$$pointerdown = M, y(ne, () => f.label), W((I) => {
|
|
635
|
+
var Q = e.item.font_family === f.fontFamily, ve = `Use ${f.label} bold font`, fe = `${f.label} bold`, ye = e.item.font_family === f.fontFamily, xe = f.fontFamily, ke = `${f.fontWeight}`;
|
|
636
|
+
return Q !== I.e && g(P, "aria-checked", I.e = Q), ve !== I.t && g(P, "aria-label", I.t = ve), fe !== I.a && g(P, "title", I.a = fe), ye !== I.o && P.classList.toggle("is-active", I.o = ye), xe !== I.i && q(X, "font-family", I.i = xe), ke !== I.n && q(X, "font-weight", I.n = ke), I;
|
|
637
|
+
}, {
|
|
638
|
+
e: void 0,
|
|
639
|
+
t: void 0,
|
|
640
|
+
a: void 0,
|
|
641
|
+
o: void 0,
|
|
642
|
+
i: void 0,
|
|
643
|
+
n: void 0
|
|
644
|
+
}), P;
|
|
645
|
+
})()
|
|
646
|
+
})), h;
|
|
647
|
+
}
|
|
648
|
+
}), null), E.$$click = K, E.$$pointerdown = Y, A.$$click = (h) => {
|
|
649
|
+
T(h), w(e.item.font_size - 1);
|
|
650
|
+
}, A.$$pointerdown = M, y(A, v(We, {
|
|
651
|
+
class: "w-3 h-3"
|
|
652
|
+
})), D.$$keydown = (h) => {
|
|
653
|
+
h.key === "Enter" && (h.preventDefault(), x(), h.currentTarget.blur());
|
|
654
|
+
}, D.addEventListener("blur", x), D.$$input = (h) => r(h.currentTarget.value), D.$$click = K, D.$$pointerdown = Y;
|
|
655
|
+
var we = i;
|
|
656
|
+
typeof we == "function" ? Z(we, D) : i = D, J.$$click = (h) => {
|
|
657
|
+
T(h), w(e.item.font_size + 1);
|
|
658
|
+
}, J.$$pointerdown = M, y(J, v(Ne, {
|
|
659
|
+
class: "w-3 h-3"
|
|
660
|
+
})), y(C, v(V, {
|
|
661
|
+
each: Fe,
|
|
662
|
+
children: (h) => (() => {
|
|
663
|
+
var f = pe();
|
|
664
|
+
return f.$$click = (P) => {
|
|
665
|
+
T(P), e.onUpdate(e.item.id, {
|
|
666
|
+
color: h
|
|
667
|
+
});
|
|
668
|
+
}, f.$$pointerdown = M, g(f, "aria-label", `Use text color ${h}`), q(f, "background", h), W(() => f.classList.toggle("is-active", e.item.color === h)), f;
|
|
669
|
+
})()
|
|
670
|
+
}), U), U.$$click = K, U.$$pointerdown = Y;
|
|
671
|
+
var ge = n;
|
|
672
|
+
return typeof ge == "function" ? Z(ge, U) : n = U, ce.$$click = (h) => {
|
|
673
|
+
T(h), c((f) => !f);
|
|
674
|
+
}, ce.$$pointerdown = M, y(U, v(F, {
|
|
675
|
+
get when() {
|
|
676
|
+
return _();
|
|
677
|
+
},
|
|
678
|
+
get children() {
|
|
679
|
+
var h = qe();
|
|
680
|
+
return y(h, v(V, {
|
|
681
|
+
each: Be,
|
|
682
|
+
children: (f) => (() => {
|
|
683
|
+
var P = et();
|
|
684
|
+
return P.$$click = (X) => {
|
|
685
|
+
T(X), e.textEditorRegistry?.get(e.item.id)?.insertTextAtSelection(f), c(!1);
|
|
686
|
+
}, P.$$pointerdown = M, g(P, "aria-label", `Insert emoji ${f}`), g(P, "title", `Insert ${f}`), y(P, f), P;
|
|
687
|
+
})()
|
|
688
|
+
})), h;
|
|
689
|
+
}
|
|
690
|
+
}), null), ie.$$click = (h) => {
|
|
691
|
+
T(h), e.onUpdate(e.item.id, {
|
|
692
|
+
align: G()
|
|
693
|
+
});
|
|
694
|
+
}, ie.$$pointerdown = M, y(ie, () => e.item.align), de.$$click = (h) => {
|
|
695
|
+
T(h), e.onDelete(e.item.id);
|
|
696
|
+
}, de.$$pointerdown = M, y(de, v(me, {
|
|
697
|
+
class: "w-3.5 h-3.5"
|
|
698
|
+
})), N(Re, "pointerdown", s.beginResize, !0), W((h) => {
|
|
699
|
+
var f = e.item.id, P = d(), X = t(), ne = k().fontFamily, I = `${k().fontWeight}`, Q = _();
|
|
700
|
+
return f !== h.e && g(u, "data-wb-object-id", h.e = f), h.t = ee(u, P, h.t), X !== h.a && g(O, "aria-expanded", h.a = X), ne !== h.o && q(j, "font-family", h.o = ne), I !== h.i && q(j, "font-weight", h.i = I), Q !== h.n && g(ce, "aria-expanded", h.n = Q), h;
|
|
701
|
+
}, {
|
|
702
|
+
e: void 0,
|
|
703
|
+
t: void 0,
|
|
704
|
+
a: void 0,
|
|
705
|
+
o: void 0,
|
|
706
|
+
i: void 0,
|
|
707
|
+
n: void 0
|
|
708
|
+
}), W(() => D.value = a()), u;
|
|
709
|
+
})();
|
|
710
|
+
}
|
|
711
|
+
function yt(e) {
|
|
712
|
+
const i = he({
|
|
713
|
+
viewportScale: () => e.viewportScale,
|
|
714
|
+
readSize: () => ({
|
|
715
|
+
width: e.item.width,
|
|
716
|
+
height: e.item.height
|
|
717
|
+
}),
|
|
718
|
+
minWidth: dt,
|
|
719
|
+
minHeight: st,
|
|
720
|
+
onCommitResize: (a) => e.onCommitResize(e.item.id, a),
|
|
721
|
+
onPreviewResize: (a) => e.onPreviewGeometry?.({
|
|
722
|
+
kind: "background_layer",
|
|
723
|
+
id: e.item.id,
|
|
724
|
+
x: e.item.x,
|
|
725
|
+
y: e.item.y,
|
|
726
|
+
width: a.width,
|
|
727
|
+
height: a.height
|
|
728
|
+
}),
|
|
729
|
+
onPreviewEnd: () => e.onPreviewGeometry?.(null)
|
|
730
|
+
}), o = $(() => {
|
|
731
|
+
const a = re(e.preview, "background_layer", e.item.id);
|
|
732
|
+
return {
|
|
733
|
+
x: a?.x ?? e.item.x,
|
|
734
|
+
y: a?.y ?? e.item.y,
|
|
735
|
+
width: i.size().width,
|
|
736
|
+
height: i.size().height
|
|
737
|
+
};
|
|
738
|
+
}), n = $(() => ({
|
|
739
|
+
width: `${o().width}px`,
|
|
740
|
+
height: `${o().height}px`,
|
|
741
|
+
transform: `translate(${o().x}px, ${o().y}px)`,
|
|
742
|
+
"z-index": `${e.item.z_index}`,
|
|
743
|
+
"--workbench-layer-control-inverse-scale": `${1 / Math.max(e.viewportScale, 1e-3)}`,
|
|
744
|
+
"--workbench-region-fill": e.item.fill,
|
|
745
|
+
"--workbench-region-ink": `color-mix(in srgb, ${e.item.fill} 48%, var(--foreground, #111) 52%)`
|
|
746
|
+
}));
|
|
747
|
+
return (() => {
|
|
748
|
+
var a = tt(), r = a.firstChild, t = r.nextSibling, m = t.firstChild, _ = m.nextSibling, c = _.firstChild, k = _.nextSibling, S = t.nextSibling;
|
|
749
|
+
return t.$$click = K, t.$$pointerdown = Y, y(t, v(V, {
|
|
750
|
+
each: je,
|
|
751
|
+
children: (s) => (() => {
|
|
752
|
+
var l = it();
|
|
753
|
+
return l.$$click = (d) => {
|
|
754
|
+
T(d), e.onUpdate(e.item.id, {
|
|
755
|
+
fill: s
|
|
756
|
+
});
|
|
757
|
+
}, l.$$pointerdown = M, g(l, "aria-label", `Use region color ${s}`), q(l, "background", s), W(() => l.classList.toggle("is-active", e.item.fill === s)), l;
|
|
758
|
+
})()
|
|
759
|
+
}), m), m.$$click = K, m.$$pointerdown = Y, y(m, v(V, {
|
|
760
|
+
each: Ae,
|
|
761
|
+
children: (s) => (() => {
|
|
762
|
+
var l = nt();
|
|
763
|
+
return l.$$click = (d) => {
|
|
764
|
+
T(d), e.onUpdate(e.item.id, {
|
|
765
|
+
material: s
|
|
766
|
+
});
|
|
767
|
+
}, l.$$pointerdown = M, W((d) => {
|
|
768
|
+
var G = `Use region material ${$e[s]}`, w = $e[s], x = {
|
|
769
|
+
"is-active": e.item.material === s,
|
|
770
|
+
[`is-${s}`]: !0
|
|
771
|
+
};
|
|
772
|
+
return G !== d.e && g(l, "aria-label", d.e = G), w !== d.t && g(l, "title", d.t = w), d.a = ue(l, x, d.a), d;
|
|
773
|
+
}, {
|
|
774
|
+
e: void 0,
|
|
775
|
+
t: void 0,
|
|
776
|
+
a: void 0
|
|
777
|
+
}), l;
|
|
778
|
+
})()
|
|
779
|
+
})), _.$$click = (s) => {
|
|
780
|
+
T(s), e.onUpdate(e.item.id, {
|
|
781
|
+
opacity: e.item.opacity >= 0.88 ? 0.42 : e.item.opacity + 0.18
|
|
782
|
+
});
|
|
783
|
+
}, _.$$pointerdown = M, y(_, () => Math.round(e.item.opacity * 100), c), k.$$click = (s) => {
|
|
784
|
+
T(s), e.onDelete(e.item.id);
|
|
785
|
+
}, k.$$pointerdown = M, y(k, v(me, {
|
|
786
|
+
class: "w-3.5 h-3.5"
|
|
787
|
+
})), N(S, "pointerdown", i.beginResize, !0), W((s) => {
|
|
788
|
+
var l = e.item.id, d = n();
|
|
789
|
+
return l !== s.e && g(a, "data-wb-object-id", s.e = l), s.t = ee(a, d, s.t), s;
|
|
790
|
+
}, {
|
|
791
|
+
e: void 0,
|
|
792
|
+
t: void 0
|
|
793
|
+
}), a;
|
|
794
|
+
})();
|
|
795
|
+
}
|
|
796
|
+
function It(e) {
|
|
797
|
+
const i = $(() => Pe(e.items)), o = $(() => Ee(e.items).map((n) => n.id));
|
|
798
|
+
return (() => {
|
|
799
|
+
var n = ot();
|
|
800
|
+
return y(n, v(V, {
|
|
801
|
+
get each() {
|
|
802
|
+
return o();
|
|
803
|
+
},
|
|
804
|
+
children: (a) => {
|
|
805
|
+
const r = $(() => i().get(a) ?? null);
|
|
806
|
+
return v(F, {
|
|
807
|
+
get when() {
|
|
808
|
+
return r();
|
|
809
|
+
},
|
|
810
|
+
children: (t) => v(vt, {
|
|
811
|
+
get item() {
|
|
812
|
+
return t();
|
|
813
|
+
},
|
|
814
|
+
get selected() {
|
|
815
|
+
return p(() => e.selectedObject?.kind === "background_layer")() && e.selectedObject.id === a;
|
|
816
|
+
},
|
|
817
|
+
get editable() {
|
|
818
|
+
return e.editable;
|
|
819
|
+
},
|
|
820
|
+
get viewportScale() {
|
|
821
|
+
return e.viewport.scale;
|
|
822
|
+
},
|
|
823
|
+
get preview() {
|
|
824
|
+
return e.preview;
|
|
825
|
+
},
|
|
826
|
+
get onPreviewGeometry() {
|
|
827
|
+
return e.onPreviewGeometry;
|
|
828
|
+
},
|
|
829
|
+
get onSelect() {
|
|
830
|
+
return e.onSelect;
|
|
831
|
+
},
|
|
832
|
+
get onContextMenu() {
|
|
833
|
+
return e.onContextMenu;
|
|
834
|
+
},
|
|
835
|
+
get onCommitMove() {
|
|
836
|
+
return e.onCommitMove;
|
|
837
|
+
}
|
|
838
|
+
})
|
|
839
|
+
});
|
|
840
|
+
}
|
|
841
|
+
})), W((a) => {
|
|
842
|
+
var r = !!e.editable, t = !!e.filtered;
|
|
843
|
+
return r !== a.e && n.classList.toggle("is-editable", a.e = r), t !== a.t && n.classList.toggle("is-filtered-out", a.t = t), a;
|
|
844
|
+
}, {
|
|
845
|
+
e: void 0,
|
|
846
|
+
t: void 0
|
|
847
|
+
}), n;
|
|
848
|
+
})();
|
|
849
|
+
}
|
|
850
|
+
function Tt(e) {
|
|
851
|
+
const i = $(() => Pe(e.items)), o = $(() => Ee(e.items).map((n) => n.id));
|
|
852
|
+
return (() => {
|
|
853
|
+
var n = at();
|
|
854
|
+
return y(n, v(V, {
|
|
855
|
+
get each() {
|
|
856
|
+
return o();
|
|
857
|
+
},
|
|
858
|
+
children: (a) => {
|
|
859
|
+
const r = $(() => i().get(a) ?? null);
|
|
860
|
+
return v(F, {
|
|
861
|
+
get when() {
|
|
862
|
+
return r();
|
|
863
|
+
},
|
|
864
|
+
children: (t) => v(gt, {
|
|
865
|
+
get item() {
|
|
866
|
+
return t();
|
|
867
|
+
},
|
|
868
|
+
get selected() {
|
|
869
|
+
return p(() => e.selectedObject?.kind === "annotation")() && e.selectedObject.id === a;
|
|
870
|
+
},
|
|
871
|
+
get editable() {
|
|
872
|
+
return e.editable;
|
|
873
|
+
},
|
|
874
|
+
get viewportScale() {
|
|
875
|
+
return e.viewport.scale;
|
|
876
|
+
},
|
|
877
|
+
get preview() {
|
|
878
|
+
return e.preview;
|
|
879
|
+
},
|
|
880
|
+
get onPreviewGeometry() {
|
|
881
|
+
return e.onPreviewGeometry;
|
|
882
|
+
},
|
|
883
|
+
get textEditorRegistry() {
|
|
884
|
+
return e.textEditorRegistry;
|
|
885
|
+
},
|
|
886
|
+
get onSelect() {
|
|
887
|
+
return e.onSelect;
|
|
888
|
+
},
|
|
889
|
+
get onContextMenu() {
|
|
890
|
+
return e.onContextMenu;
|
|
891
|
+
},
|
|
892
|
+
get onCommitMove() {
|
|
893
|
+
return e.onCommitMove;
|
|
894
|
+
},
|
|
895
|
+
get onUpdate() {
|
|
896
|
+
return e.onUpdate;
|
|
897
|
+
}
|
|
898
|
+
})
|
|
899
|
+
});
|
|
900
|
+
}
|
|
901
|
+
})), W((a) => {
|
|
902
|
+
var r = !!e.editable, t = !!e.filtered;
|
|
903
|
+
return r !== a.e && n.classList.toggle("is-editable", a.e = r), t !== a.t && n.classList.toggle("is-filtered-out", a.t = t), a;
|
|
904
|
+
}, {
|
|
905
|
+
e: void 0,
|
|
906
|
+
t: void 0
|
|
907
|
+
}), n;
|
|
908
|
+
})();
|
|
909
|
+
}
|
|
910
|
+
function Rt(e) {
|
|
911
|
+
const i = $(() => e.selectedObject?.kind === "annotation" ? e.annotations.find((n) => n.id === e.selectedObject?.id && n.kind === "text") ?? null : null), o = $(() => e.selectedObject?.kind === "background_layer" ? e.backgroundLayers.find((n) => n.id === e.selectedObject?.id) ?? null : null);
|
|
912
|
+
return (() => {
|
|
913
|
+
var n = rt();
|
|
914
|
+
return y(n, v(F, {
|
|
915
|
+
get when() {
|
|
916
|
+
return p(() => !!e.editable)() && o();
|
|
917
|
+
},
|
|
918
|
+
children: (a) => v(yt, {
|
|
919
|
+
get item() {
|
|
920
|
+
return a();
|
|
921
|
+
},
|
|
922
|
+
get viewportScale() {
|
|
923
|
+
return e.viewport.scale;
|
|
924
|
+
},
|
|
925
|
+
get preview() {
|
|
926
|
+
return e.preview;
|
|
927
|
+
},
|
|
928
|
+
get onPreviewGeometry() {
|
|
929
|
+
return e.onPreviewGeometry;
|
|
930
|
+
},
|
|
931
|
+
get onCommitResize() {
|
|
932
|
+
return e.onCommitBackgroundResize;
|
|
933
|
+
},
|
|
934
|
+
get onUpdate() {
|
|
935
|
+
return e.onUpdateBackgroundLayer;
|
|
936
|
+
},
|
|
937
|
+
get onDelete() {
|
|
938
|
+
return e.onDeleteBackgroundLayer;
|
|
939
|
+
}
|
|
940
|
+
})
|
|
941
|
+
}), null), y(n, v(F, {
|
|
942
|
+
get when() {
|
|
943
|
+
return p(() => !!e.editable)() && i();
|
|
944
|
+
},
|
|
945
|
+
children: (a) => v(ft, {
|
|
946
|
+
get item() {
|
|
947
|
+
return a();
|
|
948
|
+
},
|
|
949
|
+
get viewportScale() {
|
|
950
|
+
return e.viewport.scale;
|
|
951
|
+
},
|
|
952
|
+
get preview() {
|
|
953
|
+
return e.preview;
|
|
954
|
+
},
|
|
955
|
+
get onPreviewGeometry() {
|
|
956
|
+
return e.onPreviewGeometry;
|
|
957
|
+
},
|
|
958
|
+
get textEditorRegistry() {
|
|
959
|
+
return e.textEditorRegistry;
|
|
960
|
+
},
|
|
961
|
+
get onCommitMove() {
|
|
962
|
+
return e.onCommitAnnotationMove;
|
|
963
|
+
},
|
|
964
|
+
get onCommitResize() {
|
|
965
|
+
return e.onCommitAnnotationResize;
|
|
966
|
+
},
|
|
967
|
+
get onUpdate() {
|
|
968
|
+
return e.onUpdateTextAnnotation;
|
|
969
|
+
},
|
|
970
|
+
get onDelete() {
|
|
971
|
+
return e.onDeleteAnnotation;
|
|
972
|
+
}
|
|
973
|
+
})
|
|
974
|
+
}), null), W(() => n.classList.toggle("is-editable", !!e.editable)), n;
|
|
975
|
+
})();
|
|
976
|
+
}
|
|
977
|
+
Me(["pointerdown", "contextmenu", "input", "click", "keydown"]);
|
|
978
|
+
export {
|
|
979
|
+
Tt as WorkbenchAnnotationLayerView,
|
|
980
|
+
It as WorkbenchBackgroundLayerView,
|
|
981
|
+
vt as WorkbenchBackgroundRegion,
|
|
982
|
+
Rt as WorkbenchLayerControlOverlayView,
|
|
983
|
+
Pt as WorkbenchStickyNote,
|
|
984
|
+
gt as WorkbenchTextAnnotation,
|
|
985
|
+
Et as createWorkbenchTextEditorRegistry
|
|
986
|
+
};
|