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