@floegence/floe-webapp-core 0.36.43 → 0.36.45

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