@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.
- package/dist/components/ui/InfiniteCanvas.js +39 -39
- package/dist/components/workbench/WorkbenchCanvas.js +195 -100
- package/dist/components/workbench/WorkbenchCanvasField.d.ts +6 -0
- package/dist/components/workbench/WorkbenchCanvasField.js +142 -123
- package/dist/components/workbench/WorkbenchFilterBar.js +10 -10
- package/dist/components/workbench/WorkbenchLayerObjects.d.ts +9 -0
- package/dist/components/workbench/WorkbenchLayerObjects.js +820 -612
- package/dist/components/workbench/WorkbenchSurface.js +3 -0
- package/dist/components/workbench/WorkbenchWidget.js +299 -292
- package/dist/components/workbench/useWorkbenchModel.js +250 -237
- package/dist/components/workbench/workbenchHelpers.d.ts +21 -2
- package/dist/components/workbench/workbenchHelpers.js +305 -259
- package/dist/components/workbench/workbenchOwnerSafeAccessors.d.ts +2 -0
- package/dist/components/workbench/workbenchOwnerSafeAccessors.js +10 -0
- package/dist/styles.css +1 -1
- package/dist/workbench.css +136 -15
- package/package.json +1 -1
|
@@ -1,184 +1,191 @@
|
|
|
1
|
-
import { DEFAULT_WORKBENCH_VIEWPORT as
|
|
2
|
-
import { WORKBENCH_DEFAULT_BACKGROUND_MATERIAL as
|
|
3
|
-
import { resolveWorkbenchWidgetDefinitions as
|
|
4
|
-
import { DEFAULT_WORKBENCH_THEME as
|
|
5
|
-
function
|
|
6
|
-
const
|
|
7
|
-
return
|
|
8
|
-
}
|
|
9
|
-
function
|
|
10
|
-
return
|
|
11
|
-
}
|
|
12
|
-
function
|
|
13
|
-
return
|
|
14
|
-
}
|
|
15
|
-
function
|
|
16
|
-
const
|
|
1
|
+
import { DEFAULT_WORKBENCH_VIEWPORT as O, WORKBENCH_BACKGROUND_REGION_FILTER_ID as D, WORKBENCH_LAYER_COMPONENT_FILTER_IDS as K } from "./types.js";
|
|
2
|
+
import { WORKBENCH_DEFAULT_BACKGROUND_MATERIAL as E, WORKBENCH_DEFAULT_REGION_FILL as S, WORKBENCH_DEFAULT_TEXT_COLOR as R, WORKBENCH_DEFAULT_TEXT_FONT as N, WORKBENCH_DEFAULT_STICKY_NOTE_COLOR as T, resolveWorkbenchTextFontOption as P, WORKBENCH_BACKGROUND_MATERIALS as U, WORKBENCH_STICKY_NOTE_COLORS as X, WORKBENCH_TEXT_COLOR_OPTIONS as j, WORKBENCH_REGION_FILL_OPTIONS as V } from "./workbenchOptions.js";
|
|
3
|
+
import { resolveWorkbenchWidgetDefinitions as z, getWidgetEntry as C, createWorkbenchFilterState as A, isValidWorkbenchWidgetType as Y } from "./widgets/widgetRegistry.js";
|
|
4
|
+
import { DEFAULT_WORKBENCH_THEME as H, isWorkbenchThemeId as G } from "./workbenchThemes.js";
|
|
5
|
+
function $() {
|
|
6
|
+
const e = globalThis.crypto;
|
|
7
|
+
return e && typeof e.randomUUID == "function" ? `wb-${e.randomUUID()}` : `wb-${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 8)}`;
|
|
8
|
+
}
|
|
9
|
+
function We(e) {
|
|
10
|
+
return e.renderMode ?? "canvas_scaled";
|
|
11
|
+
}
|
|
12
|
+
function ke(e) {
|
|
13
|
+
return e.projectedSurfaceScaleBehavior ?? "stable_transform";
|
|
14
|
+
}
|
|
15
|
+
function q(e) {
|
|
16
|
+
const t = Number.isFinite(e.viewport.scale) && e.viewport.scale > 0 ? e.viewport.scale : 1, n = typeof window < "u" && Number.isFinite(window.devicePixelRatio) && window.devicePixelRatio > 0 ? window.devicePixelRatio : 1, o = Math.round((e.viewport.x + e.worldX * t) * n) / n, i = Math.round((e.viewport.y + e.worldY * t) * n) / n;
|
|
17
17
|
return {
|
|
18
|
-
widgetId:
|
|
19
|
-
worldX:
|
|
20
|
-
worldY:
|
|
21
|
-
worldWidth:
|
|
22
|
-
worldHeight:
|
|
18
|
+
widgetId: e.widgetId,
|
|
19
|
+
worldX: e.worldX,
|
|
20
|
+
worldY: e.worldY,
|
|
21
|
+
worldWidth: e.worldWidth,
|
|
22
|
+
worldHeight: e.worldHeight,
|
|
23
23
|
screenX: o,
|
|
24
|
-
screenY:
|
|
25
|
-
screenWidth:
|
|
26
|
-
screenHeight:
|
|
27
|
-
viewportScale:
|
|
24
|
+
screenY: i,
|
|
25
|
+
screenWidth: e.worldWidth * t,
|
|
26
|
+
screenHeight: e.worldHeight * t,
|
|
27
|
+
viewportScale: t
|
|
28
28
|
};
|
|
29
29
|
}
|
|
30
|
-
function
|
|
30
|
+
function Me(e) {
|
|
31
31
|
return {
|
|
32
|
-
ready:
|
|
33
|
-
rect:
|
|
32
|
+
ready: e.ready,
|
|
33
|
+
rect: q(e)
|
|
34
34
|
};
|
|
35
35
|
}
|
|
36
|
-
function
|
|
37
|
-
return
|
|
38
|
-
x: Number.isFinite(
|
|
39
|
-
y: Number.isFinite(
|
|
40
|
-
scale: Number.isFinite(
|
|
41
|
-
} : { ...
|
|
36
|
+
function Z(e) {
|
|
37
|
+
return e ? {
|
|
38
|
+
x: Number.isFinite(e.x) ? e.x : 0,
|
|
39
|
+
y: Number.isFinite(e.y) ? e.y : 0,
|
|
40
|
+
scale: Number.isFinite(e.scale) && e.scale > 0 ? e.scale : 1
|
|
41
|
+
} : { ...O };
|
|
42
42
|
}
|
|
43
|
-
function
|
|
44
|
-
const
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
43
|
+
function J(e, t) {
|
|
44
|
+
const n = Z(e);
|
|
45
|
+
return {
|
|
46
|
+
...n,
|
|
47
|
+
scale: b(n.scale, fe(t).minScale, g)
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
function Q(e, t) {
|
|
51
|
+
const n = A(t, e);
|
|
52
|
+
for (const o of K)
|
|
53
|
+
n[o] = typeof e?.[o] == "boolean" ? !!e[o] : !0;
|
|
54
|
+
return n;
|
|
48
55
|
}
|
|
49
|
-
function
|
|
50
|
-
return !!
|
|
56
|
+
function y(e) {
|
|
57
|
+
return !!e && typeof e == "object" && !Array.isArray(e);
|
|
51
58
|
}
|
|
52
|
-
function f(
|
|
53
|
-
return String(
|
|
59
|
+
function f(e) {
|
|
60
|
+
return String(e ?? "").trim();
|
|
54
61
|
}
|
|
55
|
-
function
|
|
56
|
-
const
|
|
57
|
-
return Number.isFinite(
|
|
62
|
+
function d(e, t) {
|
|
63
|
+
const n = Number(e);
|
|
64
|
+
return Number.isFinite(n) ? n : t;
|
|
58
65
|
}
|
|
59
|
-
function
|
|
60
|
-
const
|
|
61
|
-
return
|
|
66
|
+
function m(e, t) {
|
|
67
|
+
const n = d(e, t);
|
|
68
|
+
return n > 0 ? n : t;
|
|
62
69
|
}
|
|
63
|
-
function
|
|
64
|
-
const
|
|
65
|
-
return
|
|
70
|
+
function W(e, t) {
|
|
71
|
+
const n = f(e);
|
|
72
|
+
return n.length > 0 && n.length <= 128 ? n : `${t}-${$()}`;
|
|
66
73
|
}
|
|
67
|
-
function
|
|
68
|
-
return
|
|
74
|
+
function v(e) {
|
|
75
|
+
return p(e);
|
|
69
76
|
}
|
|
70
|
-
function
|
|
71
|
-
const
|
|
72
|
-
return
|
|
77
|
+
function ee(e, t) {
|
|
78
|
+
const n = f(e);
|
|
79
|
+
return n || (t === "annotation" || t === "background" ? D : "select");
|
|
73
80
|
}
|
|
74
|
-
function
|
|
75
|
-
const o = f(
|
|
76
|
-
return
|
|
81
|
+
function w(e, t, n) {
|
|
82
|
+
const o = f(e);
|
|
83
|
+
return t.includes(o) ? o : n;
|
|
77
84
|
}
|
|
78
|
-
function
|
|
79
|
-
return
|
|
85
|
+
function te(e) {
|
|
86
|
+
return w(e, X, T);
|
|
80
87
|
}
|
|
81
|
-
function
|
|
82
|
-
if (!
|
|
83
|
-
const
|
|
88
|
+
function ne(e) {
|
|
89
|
+
if (!y(e)) return null;
|
|
90
|
+
const t = Date.now();
|
|
84
91
|
return {
|
|
85
|
-
id:
|
|
92
|
+
id: W(e.id, "sticky"),
|
|
86
93
|
kind: "sticky_note",
|
|
87
|
-
body: f(
|
|
88
|
-
color:
|
|
89
|
-
x:
|
|
90
|
-
y:
|
|
91
|
-
width:
|
|
92
|
-
height:
|
|
93
|
-
z_index: Math.max(0, Math.trunc(
|
|
94
|
-
created_at_unix_ms: Math.max(0, Math.trunc(
|
|
95
|
-
updated_at_unix_ms: Math.max(0, Math.trunc(
|
|
94
|
+
body: f(e.body) || "Untitled note",
|
|
95
|
+
color: te(e.color),
|
|
96
|
+
x: d(e.x, 0),
|
|
97
|
+
y: d(e.y, 0),
|
|
98
|
+
width: m(e.width, 260),
|
|
99
|
+
height: m(e.height, 190),
|
|
100
|
+
z_index: Math.max(0, Math.trunc(d(e.z_index, 1))),
|
|
101
|
+
created_at_unix_ms: Math.max(0, Math.trunc(d(e.created_at_unix_ms, t))),
|
|
102
|
+
updated_at_unix_ms: Math.max(0, Math.trunc(d(e.updated_at_unix_ms, t)))
|
|
96
103
|
};
|
|
97
104
|
}
|
|
98
|
-
function
|
|
99
|
-
if (!Array.isArray(
|
|
100
|
-
const
|
|
101
|
-
return
|
|
105
|
+
function ie(e) {
|
|
106
|
+
if (!Array.isArray(e)) return [];
|
|
107
|
+
const t = /* @__PURE__ */ new Set();
|
|
108
|
+
return e.map((n) => ne(n)).filter((n) => !n || t.has(n.id) ? !1 : (t.add(n.id), !0));
|
|
102
109
|
}
|
|
103
|
-
const
|
|
104
|
-
function
|
|
105
|
-
return
|
|
110
|
+
const re = ["left", "center", "right"];
|
|
111
|
+
function oe(e) {
|
|
112
|
+
return re.includes(e) ? e : "left";
|
|
106
113
|
}
|
|
107
|
-
function
|
|
108
|
-
if (!
|
|
109
|
-
const
|
|
114
|
+
function ae(e) {
|
|
115
|
+
if (!y(e)) return null;
|
|
116
|
+
const t = Date.now(), n = P(e.font_family);
|
|
110
117
|
return {
|
|
111
|
-
id:
|
|
118
|
+
id: W(e.id, "text"),
|
|
112
119
|
kind: "text",
|
|
113
|
-
text: f(
|
|
114
|
-
font_family:
|
|
115
|
-
font_size: Math.max(8, Math.min(160, Math.round(
|
|
116
|
-
font_weight:
|
|
117
|
-
color:
|
|
118
|
-
align:
|
|
119
|
-
x:
|
|
120
|
-
y:
|
|
121
|
-
width:
|
|
122
|
-
height:
|
|
123
|
-
z_index: Math.max(0, Math.trunc(
|
|
124
|
-
created_at_unix_ms: Math.max(0, Math.trunc(
|
|
125
|
-
updated_at_unix_ms: Math.max(0, Math.trunc(
|
|
120
|
+
text: f(e.text) || "Text",
|
|
121
|
+
font_family: n.fontFamily,
|
|
122
|
+
font_size: Math.max(8, Math.min(160, Math.round(d(e.font_size, 28)))),
|
|
123
|
+
font_weight: n.fontWeight,
|
|
124
|
+
color: w(e.color, j, R),
|
|
125
|
+
align: oe(e.align),
|
|
126
|
+
x: d(e.x, 0),
|
|
127
|
+
y: d(e.y, 0),
|
|
128
|
+
width: m(e.width, 280),
|
|
129
|
+
height: m(e.height, 84),
|
|
130
|
+
z_index: Math.max(0, Math.trunc(d(e.z_index, 1))),
|
|
131
|
+
created_at_unix_ms: Math.max(0, Math.trunc(d(e.created_at_unix_ms, t))),
|
|
132
|
+
updated_at_unix_ms: Math.max(0, Math.trunc(d(e.updated_at_unix_ms, t)))
|
|
126
133
|
};
|
|
127
134
|
}
|
|
128
|
-
function
|
|
129
|
-
if (!Array.isArray(
|
|
130
|
-
const
|
|
131
|
-
return
|
|
135
|
+
function ce(e) {
|
|
136
|
+
if (!Array.isArray(e)) return [];
|
|
137
|
+
const t = /* @__PURE__ */ new Set();
|
|
138
|
+
return e.map((n) => ae(n)).filter((n) => !n || t.has(n.id) ? !1 : (t.add(n.id), !0));
|
|
132
139
|
}
|
|
133
|
-
function
|
|
134
|
-
return
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
140
|
+
function de(e) {
|
|
141
|
+
return w(
|
|
142
|
+
e,
|
|
143
|
+
U,
|
|
144
|
+
E
|
|
138
145
|
);
|
|
139
146
|
}
|
|
140
|
-
function
|
|
141
|
-
if (!
|
|
142
|
-
const
|
|
147
|
+
function se(e) {
|
|
148
|
+
if (!y(e)) return null;
|
|
149
|
+
const t = Date.now();
|
|
143
150
|
return {
|
|
144
|
-
id:
|
|
145
|
-
name: f(
|
|
146
|
-
fill:
|
|
147
|
-
opacity: Math.max(0.08, Math.min(1,
|
|
148
|
-
material:
|
|
149
|
-
x:
|
|
150
|
-
y:
|
|
151
|
-
width:
|
|
152
|
-
height:
|
|
153
|
-
z_index: Math.max(0, Math.trunc(
|
|
154
|
-
created_at_unix_ms: Math.max(0, Math.trunc(
|
|
155
|
-
updated_at_unix_ms: Math.max(0, Math.trunc(
|
|
151
|
+
id: W(e.id, "region"),
|
|
152
|
+
name: f(e.name) || "Canvas region",
|
|
153
|
+
fill: w(e.fill, V, S),
|
|
154
|
+
opacity: Math.max(0.08, Math.min(1, d(e.opacity, 0.72))),
|
|
155
|
+
material: de(e.material),
|
|
156
|
+
x: d(e.x, 0),
|
|
157
|
+
y: d(e.y, 0),
|
|
158
|
+
width: m(e.width, 560),
|
|
159
|
+
height: m(e.height, 360),
|
|
160
|
+
z_index: Math.max(0, Math.trunc(d(e.z_index, 1))),
|
|
161
|
+
created_at_unix_ms: Math.max(0, Math.trunc(d(e.created_at_unix_ms, t))),
|
|
162
|
+
updated_at_unix_ms: Math.max(0, Math.trunc(d(e.updated_at_unix_ms, t)))
|
|
156
163
|
};
|
|
157
164
|
}
|
|
158
|
-
function
|
|
159
|
-
if (!Array.isArray(
|
|
160
|
-
const
|
|
161
|
-
return
|
|
162
|
-
}
|
|
163
|
-
function
|
|
164
|
-
if (
|
|
165
|
-
const
|
|
166
|
-
if (
|
|
167
|
-
if (
|
|
168
|
-
if (
|
|
169
|
-
if (
|
|
170
|
-
return { kind:
|
|
165
|
+
function he(e) {
|
|
166
|
+
if (!Array.isArray(e)) return [];
|
|
167
|
+
const t = /* @__PURE__ */ new Set();
|
|
168
|
+
return e.map((n) => se(n)).filter((n) => !n || t.has(n.id) ? !1 : (t.add(n.id), !0));
|
|
169
|
+
}
|
|
170
|
+
function le(e, t, n, o, i, a) {
|
|
171
|
+
if (y(e)) {
|
|
172
|
+
const c = f(e.kind), s = f(e.id);
|
|
173
|
+
if (c === "widget" && t.some((l) => l.id === s)) return { kind: c, id: s };
|
|
174
|
+
if (c === "sticky_note" && n.some((l) => l.id === s)) return { kind: c, id: s };
|
|
175
|
+
if (c === "annotation" && o.some((l) => l.id === s)) return { kind: c, id: s };
|
|
176
|
+
if (c === "background_layer" && i.some((l) => l.id === s))
|
|
177
|
+
return { kind: c, id: s };
|
|
171
178
|
}
|
|
172
179
|
return a ? { kind: "widget", id: a } : null;
|
|
173
180
|
}
|
|
174
|
-
function
|
|
175
|
-
const
|
|
176
|
-
if (!
|
|
181
|
+
function Ne(e, t = {}) {
|
|
182
|
+
const n = z(t.widgetDefinitions), o = t.createFallbackState ?? (() => _e(n)), i = e;
|
|
183
|
+
if (!i || i.version !== 1 || !Array.isArray(i.widgets))
|
|
177
184
|
return o();
|
|
178
|
-
const a =
|
|
179
|
-
(r) => !!r && typeof r.id == "string" &&
|
|
185
|
+
const a = i.widgets.filter(
|
|
186
|
+
(r) => !!r && typeof r.id == "string" && Y(r.type, n) && typeof r.title == "string"
|
|
180
187
|
).map((r) => {
|
|
181
|
-
const u =
|
|
188
|
+
const u = C(r.type, n);
|
|
182
189
|
return {
|
|
183
190
|
id: r.id,
|
|
184
191
|
type: r.type,
|
|
@@ -190,75 +197,75 @@ function wt(t, i = {}) {
|
|
|
190
197
|
z_index: Number.isFinite(r.z_index) && r.z_index >= 0 ? r.z_index : 1,
|
|
191
198
|
created_at_unix_ms: Number.isFinite(r.created_at_unix_ms) ? r.created_at_unix_ms : Date.now()
|
|
192
199
|
};
|
|
193
|
-
}),
|
|
200
|
+
}), c = typeof i.selectedWidgetId == "string" && a.some((r) => r.id === i.selectedWidgetId) ? i.selectedWidgetId : null, s = ie(i.stickyNotes), l = ce(i.annotations), x = he(i.backgroundLayers), h = v(i.mode), _ = J(i.viewport, h);
|
|
194
201
|
return {
|
|
195
202
|
version: 1,
|
|
196
203
|
widgets: a,
|
|
197
|
-
viewport:
|
|
198
|
-
locked: typeof
|
|
199
|
-
filters:
|
|
200
|
-
selectedWidgetId:
|
|
201
|
-
theme:
|
|
202
|
-
mode:
|
|
203
|
-
activeTool:
|
|
204
|
-
selectedObject:
|
|
205
|
-
|
|
204
|
+
viewport: _,
|
|
205
|
+
locked: typeof i.locked == "boolean" ? i.locked : !1,
|
|
206
|
+
filters: Q(i.filters, n),
|
|
207
|
+
selectedWidgetId: c,
|
|
208
|
+
theme: G(i.theme) ? i.theme : H,
|
|
209
|
+
mode: h,
|
|
210
|
+
activeTool: ee(i.activeTool, h),
|
|
211
|
+
selectedObject: le(
|
|
212
|
+
i.selectedObject,
|
|
206
213
|
a,
|
|
207
214
|
s,
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
215
|
+
l,
|
|
216
|
+
x,
|
|
217
|
+
c
|
|
211
218
|
),
|
|
212
219
|
stickyNotes: s,
|
|
213
|
-
annotations:
|
|
214
|
-
backgroundLayers:
|
|
220
|
+
annotations: l,
|
|
221
|
+
backgroundLayers: x
|
|
215
222
|
};
|
|
216
223
|
}
|
|
217
|
-
function
|
|
218
|
-
const
|
|
224
|
+
function _e(e) {
|
|
225
|
+
const t = z(e), n = Date.now(), o = [
|
|
219
226
|
{ type: "terminal", title: "dev · terminal", x: 80, y: 80 },
|
|
220
227
|
{ type: "file-browser", title: "project · files", x: 600, y: 80 },
|
|
221
228
|
{ type: "system-monitor", title: "host · system monitor", x: 80, y: 420 },
|
|
222
229
|
{ type: "log-viewer", title: "services · logs", x: 540, y: 500 },
|
|
223
230
|
{ type: "code-editor", title: "Counter.tsx", x: 1e3, y: 180 }
|
|
224
|
-
],
|
|
225
|
-
const s =
|
|
231
|
+
], i = o.filter((a) => t.some((c) => c.type === a.type)).map((a, c) => {
|
|
232
|
+
const s = C(a.type, t);
|
|
226
233
|
return {
|
|
227
|
-
id: `wb-seed-${
|
|
234
|
+
id: `wb-seed-${c + 1}`,
|
|
228
235
|
type: a.type,
|
|
229
236
|
title: a.title,
|
|
230
237
|
x: a.x,
|
|
231
238
|
y: a.y,
|
|
232
239
|
width: s.defaultSize.width,
|
|
233
240
|
height: s.defaultSize.height,
|
|
234
|
-
z_index:
|
|
235
|
-
created_at_unix_ms:
|
|
241
|
+
z_index: c + 1,
|
|
242
|
+
created_at_unix_ms: n - (o.length - c) * 6e5
|
|
236
243
|
};
|
|
237
244
|
});
|
|
238
245
|
return {
|
|
239
246
|
version: 1,
|
|
240
|
-
widgets:
|
|
241
|
-
viewport: { ...
|
|
247
|
+
widgets: i,
|
|
248
|
+
viewport: { ...O },
|
|
242
249
|
locked: !1,
|
|
243
|
-
filters:
|
|
244
|
-
selectedWidgetId:
|
|
245
|
-
theme:
|
|
250
|
+
filters: A(t),
|
|
251
|
+
selectedWidgetId: i[0]?.id ?? null,
|
|
252
|
+
theme: H,
|
|
246
253
|
mode: "work",
|
|
247
254
|
activeTool: "select",
|
|
248
|
-
selectedObject:
|
|
255
|
+
selectedObject: i[0] ? { kind: "widget", id: i[0].id } : null,
|
|
249
256
|
stickyNotes: [
|
|
250
257
|
{
|
|
251
258
|
id: "wb-seed-sticky-1",
|
|
252
259
|
kind: "sticky_note",
|
|
253
260
|
body: "Confirm the rollout checklist before touching production.",
|
|
254
|
-
color:
|
|
261
|
+
color: T,
|
|
255
262
|
x: 930,
|
|
256
263
|
y: 620,
|
|
257
264
|
width: 270,
|
|
258
265
|
height: 170,
|
|
259
|
-
z_index:
|
|
260
|
-
created_at_unix_ms:
|
|
261
|
-
updated_at_unix_ms:
|
|
266
|
+
z_index: i.length + 1,
|
|
267
|
+
created_at_unix_ms: n - 25e4,
|
|
268
|
+
updated_at_unix_ms: n - 25e4
|
|
262
269
|
}
|
|
263
270
|
],
|
|
264
271
|
annotations: [
|
|
@@ -276,131 +283,170 @@ function ct(t) {
|
|
|
276
283
|
width: 320,
|
|
277
284
|
height: 82,
|
|
278
285
|
z_index: 1,
|
|
279
|
-
created_at_unix_ms:
|
|
280
|
-
updated_at_unix_ms:
|
|
286
|
+
created_at_unix_ms: n - 24e4,
|
|
287
|
+
updated_at_unix_ms: n - 24e4
|
|
281
288
|
}
|
|
282
289
|
],
|
|
283
290
|
backgroundLayers: [
|
|
284
291
|
{
|
|
285
292
|
id: "wb-seed-region-1",
|
|
286
293
|
name: "Review lane",
|
|
287
|
-
fill:
|
|
294
|
+
fill: S,
|
|
288
295
|
opacity: 0.58,
|
|
289
|
-
material:
|
|
296
|
+
material: E,
|
|
290
297
|
x: 512,
|
|
291
298
|
y: 360,
|
|
292
299
|
width: 760,
|
|
293
300
|
height: 520,
|
|
294
301
|
z_index: 1,
|
|
295
|
-
created_at_unix_ms:
|
|
296
|
-
updated_at_unix_ms:
|
|
302
|
+
created_at_unix_ms: n - 26e4,
|
|
303
|
+
updated_at_unix_ms: n - 26e4
|
|
297
304
|
}
|
|
298
305
|
]
|
|
299
306
|
};
|
|
300
307
|
}
|
|
301
|
-
const
|
|
302
|
-
function
|
|
303
|
-
|
|
308
|
+
const Oe = 1.18, Ee = 200, I = 0.35, L = 0.2, k = I, g = 2.2, ue = 48;
|
|
309
|
+
function p(e) {
|
|
310
|
+
return e === "annotation" || e === "background" ? "background" : "work";
|
|
311
|
+
}
|
|
312
|
+
function fe(e) {
|
|
313
|
+
return p(e) === "background" ? {
|
|
314
|
+
mode: "background",
|
|
315
|
+
label: "Composition Mode",
|
|
316
|
+
minScale: L,
|
|
317
|
+
workLayerLocked: !0,
|
|
318
|
+
layerEditingEnabled: !0
|
|
319
|
+
} : {
|
|
320
|
+
mode: "work",
|
|
321
|
+
label: "Work Mode",
|
|
322
|
+
minScale: I,
|
|
323
|
+
workLayerLocked: !1,
|
|
324
|
+
layerEditingEnabled: !1
|
|
325
|
+
};
|
|
326
|
+
}
|
|
327
|
+
function Se(e) {
|
|
328
|
+
const t = b(
|
|
329
|
+
e.scale,
|
|
330
|
+
e.minScale ?? L,
|
|
331
|
+
g
|
|
332
|
+
);
|
|
333
|
+
if (e.frameWidth <= 0 || e.frameHeight <= 0 || e.viewport.scale <= 0)
|
|
334
|
+
return { ...e.viewport, scale: t };
|
|
335
|
+
const n = (e.frameWidth / 2 - e.viewport.x) / e.viewport.scale, o = (e.frameHeight / 2 - e.viewport.y) / e.viewport.scale;
|
|
336
|
+
return {
|
|
337
|
+
x: e.frameWidth / 2 - n * t,
|
|
338
|
+
y: e.frameHeight / 2 - o * t,
|
|
339
|
+
scale: t
|
|
340
|
+
};
|
|
341
|
+
}
|
|
342
|
+
function me(e) {
|
|
343
|
+
const t = b(e.scale, k, g);
|
|
304
344
|
return {
|
|
305
|
-
x:
|
|
306
|
-
y:
|
|
307
|
-
scale:
|
|
345
|
+
x: e.frameWidth / 2 - (e.widget.x + e.widget.width / 2) * t,
|
|
346
|
+
y: e.frameHeight / 2 - (e.widget.y + e.widget.height / 2) * t,
|
|
347
|
+
scale: t
|
|
308
348
|
};
|
|
309
349
|
}
|
|
310
|
-
function
|
|
311
|
-
const
|
|
350
|
+
function Re(e) {
|
|
351
|
+
const t = e.minScale ?? k, n = e.maxScale ?? g, o = e.paddingPx ?? ue, i = Math.max(e.frameWidth - o * 2, 1), a = Math.max(e.frameHeight - o * 2, 1), c = b(
|
|
312
352
|
Math.min(
|
|
313
|
-
|
|
314
|
-
a / Math.max(
|
|
353
|
+
i / Math.max(e.widget.width, 1),
|
|
354
|
+
a / Math.max(e.widget.height, 1)
|
|
315
355
|
),
|
|
316
|
-
|
|
317
|
-
|
|
356
|
+
t,
|
|
357
|
+
n
|
|
318
358
|
);
|
|
319
|
-
return
|
|
320
|
-
widget:
|
|
321
|
-
scale:
|
|
322
|
-
frameWidth:
|
|
323
|
-
frameHeight:
|
|
359
|
+
return me({
|
|
360
|
+
widget: e.widget,
|
|
361
|
+
scale: c,
|
|
362
|
+
frameWidth: e.frameWidth,
|
|
363
|
+
frameHeight: e.frameHeight
|
|
324
364
|
});
|
|
325
365
|
}
|
|
326
|
-
function
|
|
327
|
-
return
|
|
366
|
+
function xe(e, t) {
|
|
367
|
+
return e.z_index !== t.z_index ? e.z_index - t.z_index : e.created_at_unix_ms !== t.created_at_unix_ms ? e.created_at_unix_ms - t.created_at_unix_ms : e.id.localeCompare(t.id);
|
|
328
368
|
}
|
|
329
|
-
function
|
|
330
|
-
const
|
|
331
|
-
for (const [o,
|
|
332
|
-
|
|
369
|
+
function Te(e) {
|
|
370
|
+
const t = [...e].sort(xe), n = /* @__PURE__ */ new Map();
|
|
371
|
+
for (const [o, i] of t.entries())
|
|
372
|
+
n.set(i.id, o + 1);
|
|
333
373
|
return {
|
|
334
|
-
byWidgetId:
|
|
335
|
-
topRenderLayer: Math.max(
|
|
374
|
+
byWidgetId: n,
|
|
375
|
+
topRenderLayer: Math.max(t.length, 1)
|
|
336
376
|
};
|
|
337
377
|
}
|
|
338
|
-
function
|
|
339
|
-
const
|
|
340
|
-
let o =
|
|
341
|
-
return o +
|
|
342
|
-
}
|
|
343
|
-
function
|
|
344
|
-
const
|
|
345
|
-
if (
|
|
346
|
-
if (!
|
|
347
|
-
const a =
|
|
348
|
-
if (!a) return
|
|
349
|
-
const
|
|
350
|
-
let
|
|
351
|
-
for (const
|
|
352
|
-
if (
|
|
353
|
-
const
|
|
354
|
-
let
|
|
355
|
-
switch (
|
|
378
|
+
function ze(e) {
|
|
379
|
+
const t = typeof window < "u" ? window.innerWidth : 1280, n = typeof window < "u" ? window.innerHeight : 800;
|
|
380
|
+
let o = e.clientX, i = e.clientY;
|
|
381
|
+
return o + e.menuWidth > t && (o = Math.max(0, t - e.menuWidth - 8)), i + e.menuHeight > n && (i = Math.max(0, n - e.menuHeight - 8)), { left: o, top: i };
|
|
382
|
+
}
|
|
383
|
+
function Ce(e, t, n, o) {
|
|
384
|
+
const i = e.filter((h) => o[h.type]);
|
|
385
|
+
if (i.length === 0) return null;
|
|
386
|
+
if (!t) return i[0] ?? null;
|
|
387
|
+
const a = i.find((h) => h.id === t);
|
|
388
|
+
if (!a) return i[0] ?? null;
|
|
389
|
+
const c = a.x + a.width / 2, s = a.y + a.height / 2;
|
|
390
|
+
let l = null, x = 1 / 0;
|
|
391
|
+
for (const h of i) {
|
|
392
|
+
if (h.id === t) continue;
|
|
393
|
+
const _ = h.x + h.width / 2 - c, r = h.y + h.height / 2 - s;
|
|
394
|
+
let u = !1;
|
|
395
|
+
switch (n) {
|
|
356
396
|
case "up":
|
|
357
|
-
|
|
397
|
+
u = r < -10;
|
|
358
398
|
break;
|
|
359
399
|
case "down":
|
|
360
|
-
|
|
400
|
+
u = r > 10;
|
|
361
401
|
break;
|
|
362
402
|
case "left":
|
|
363
|
-
|
|
403
|
+
u = _ < -10;
|
|
364
404
|
break;
|
|
365
405
|
case "right":
|
|
366
|
-
|
|
406
|
+
u = _ > 10;
|
|
367
407
|
break;
|
|
368
408
|
}
|
|
369
|
-
if (!
|
|
370
|
-
const F = Math.sqrt(
|
|
371
|
-
Math.abs(
|
|
372
|
-
Math.abs(
|
|
373
|
-
), M = F * (1 +
|
|
374
|
-
M <
|
|
409
|
+
if (!u) continue;
|
|
410
|
+
const F = Math.sqrt(_ * _ + r * r), B = Math.atan2(
|
|
411
|
+
Math.abs(n === "up" || n === "down" ? _ : r),
|
|
412
|
+
Math.abs(n === "up" || n === "down" ? r : _)
|
|
413
|
+
), M = F * (1 + B * 1.5);
|
|
414
|
+
M < x && (x = M, l = h);
|
|
375
415
|
}
|
|
376
|
-
return
|
|
416
|
+
return l;
|
|
377
417
|
}
|
|
378
|
-
function
|
|
379
|
-
return Math.max(
|
|
418
|
+
function b(e, t = k, n = g) {
|
|
419
|
+
return Math.max(t, Math.min(n, e));
|
|
380
420
|
}
|
|
381
|
-
function
|
|
382
|
-
return 16 + Math.max(1,
|
|
421
|
+
function Ae(e, t = 0) {
|
|
422
|
+
return 16 + Math.max(1, e) * 32 + Math.max(0, t) * 9;
|
|
383
423
|
}
|
|
384
424
|
export {
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
425
|
+
Oe as WORKBENCH_CANVAS_ZOOM_STEP,
|
|
426
|
+
L as WORKBENCH_COMPOSITION_MIN_SCALE,
|
|
427
|
+
Ee as WORKBENCH_CONTEXT_MENU_WIDTH_PX,
|
|
428
|
+
g as WORKBENCH_MAX_SCALE,
|
|
429
|
+
k as WORKBENCH_MIN_SCALE,
|
|
430
|
+
ue as WORKBENCH_VIEWPORT_FIT_PADDING_PX,
|
|
431
|
+
I as WORKBENCH_WORK_MIN_SCALE,
|
|
432
|
+
b as clampScale,
|
|
433
|
+
ze as createContextMenuPosition,
|
|
434
|
+
_e as createDefaultWorkbenchState,
|
|
435
|
+
$ as createWorkbenchId,
|
|
436
|
+
q as createWorkbenchProjectedRect,
|
|
437
|
+
Te as createWorkbenchRenderLayerMap,
|
|
438
|
+
Se as createWorkbenchViewportAtScale,
|
|
439
|
+
me as createWorkbenchViewportCenteredOnWidget,
|
|
440
|
+
Re as createWorkbenchViewportFitForWidget,
|
|
441
|
+
Me as createWorkbenchWidgetSurfaceMetrics,
|
|
442
|
+
Ae as estimateContextMenuHeight,
|
|
443
|
+
Ce as findNearestWidget,
|
|
444
|
+
p as normalizeWorkbenchInteractionMode,
|
|
445
|
+
fe as resolveWorkbenchModeStrategy,
|
|
446
|
+
ke as resolveWorkbenchProjectedSurfaceScaleBehavior,
|
|
447
|
+
We as resolveWorkbenchWidgetRenderMode,
|
|
448
|
+
Q as sanitizeFilters,
|
|
449
|
+
Z as sanitizeViewport,
|
|
450
|
+
Ne as sanitizeWorkbenchState,
|
|
451
|
+
J as sanitizeWorkbenchViewportForMode
|
|
406
452
|
};
|