@floegence/floe-webapp-core 0.36.42 → 0.36.43

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (31) hide show
  1. package/dist/components/icons/index.d.ts +2 -0
  2. package/dist/components/icons/index.js +419 -397
  3. package/dist/components/workbench/WorkbenchCanvas.d.ts +45 -2
  4. package/dist/components/workbench/WorkbenchCanvas.js +265 -66
  5. package/dist/components/workbench/WorkbenchCanvasField.d.ts +47 -2
  6. package/dist/components/workbench/WorkbenchCanvasField.js +258 -78
  7. package/dist/components/workbench/WorkbenchFilterBar.d.ts +9 -7
  8. package/dist/components/workbench/WorkbenchFilterBar.js +233 -145
  9. package/dist/components/workbench/WorkbenchLayerObjects.d.ts +136 -0
  10. package/dist/components/workbench/WorkbenchLayerObjects.js +986 -0
  11. package/dist/components/workbench/WorkbenchOverlay.d.ts +4 -1
  12. package/dist/components/workbench/WorkbenchOverlay.js +59 -29
  13. package/dist/components/workbench/WorkbenchSurface.d.ts +23 -11
  14. package/dist/components/workbench/WorkbenchSurface.js +315 -195
  15. package/dist/components/workbench/WorkbenchWidget.js +37 -37
  16. package/dist/components/workbench/index.d.ts +2 -1
  17. package/dist/components/workbench/types.d.ts +96 -1
  18. package/dist/components/workbench/types.js +12 -4
  19. package/dist/components/workbench/useWorkbenchModel.d.ts +62 -4
  20. package/dist/components/workbench/useWorkbenchModel.js +790 -253
  21. package/dist/components/workbench/widgets/widgetRegistry.d.ts +1 -1
  22. package/dist/components/workbench/workbenchHelpers.d.ts +5 -5
  23. package/dist/components/workbench/workbenchHelpers.js +345 -154
  24. package/dist/components/workbench/workbenchOptions.d.ts +43 -0
  25. package/dist/components/workbench/workbenchOptions.js +112 -0
  26. package/dist/full.js +620 -618
  27. package/dist/icons.js +71 -69
  28. package/dist/styles.css +1 -1
  29. package/dist/workbench.css +1117 -26
  30. package/dist/workbench.js +52 -36
  31. package/package.json +1 -1
@@ -9,6 +9,6 @@ export interface WidgetRegistryEntry extends WorkbenchWidgetDefinition {
9
9
  }
10
10
  export declare const WIDGET_REGISTRY: readonly WidgetRegistryEntry[];
11
11
  export declare function resolveWorkbenchWidgetDefinitions(widgetDefinitions?: readonly WorkbenchWidgetDefinition[]): readonly WorkbenchWidgetDefinition[];
12
- export declare function createWorkbenchFilterState(widgetDefinitions?: readonly WorkbenchWidgetDefinition[], filters?: Partial<Record<WorkbenchWidgetType, boolean>>): Record<WorkbenchWidgetType, boolean>;
12
+ export declare function createWorkbenchFilterState(widgetDefinitions?: readonly WorkbenchWidgetDefinition[], filters?: Partial<Record<string, boolean>>): Record<string, boolean>;
13
13
  export declare function isValidWorkbenchWidgetType(type: unknown, widgetDefinitions?: readonly WorkbenchWidgetDefinition[]): type is WorkbenchWidgetType;
14
14
  export declare function getWidgetEntry(type: WorkbenchWidgetType, widgetDefinitions?: readonly WorkbenchWidgetDefinition[]): WorkbenchWidgetDefinition;
@@ -1,4 +1,4 @@
1
- import { type WorkbenchProjectedSurfaceScaleBehavior, type WorkbenchProjectedRect, type WorkbenchState, type WorkbenchViewport, type WorkbenchWidgetDefinition, type WorkbenchWidgetItem, type WorkbenchWidgetRenderMode, type WorkbenchWidgetSurfaceMetrics, type WorkbenchWidgetType } from './types';
1
+ import { type WorkbenchProjectedSurfaceScaleBehavior, type WorkbenchProjectedRect, type WorkbenchState, type WorkbenchViewport, type WorkbenchWidgetDefinition, type WorkbenchWidgetItem, type WorkbenchWidgetRenderMode, type WorkbenchWidgetSurfaceMetrics } from './types';
2
2
  export declare function createWorkbenchId(): string;
3
3
  export declare function resolveWorkbenchWidgetRenderMode(definition: WorkbenchWidgetDefinition): WorkbenchWidgetRenderMode;
4
4
  export declare function resolveWorkbenchProjectedSurfaceScaleBehavior(definition: WorkbenchWidgetDefinition): WorkbenchProjectedSurfaceScaleBehavior;
@@ -15,7 +15,7 @@ export declare function createWorkbenchWidgetSurfaceMetrics(input: CreateWorkben
15
15
  ready: boolean;
16
16
  }): WorkbenchWidgetSurfaceMetrics;
17
17
  export declare function sanitizeViewport(viewport: Partial<WorkbenchViewport> | undefined): WorkbenchViewport;
18
- export declare function sanitizeFilters(filters: Partial<Record<WorkbenchWidgetType, boolean>> | undefined, widgetDefinitions?: readonly WorkbenchWidgetDefinition[]): Record<WorkbenchWidgetType, boolean>;
18
+ export declare function sanitizeFilters(filters: Partial<Record<string, boolean>> | undefined, widgetDefinitions?: readonly WorkbenchWidgetDefinition[]): Record<string, boolean>;
19
19
  export interface SanitizeWorkbenchStateOptions {
20
20
  widgetDefinitions?: readonly WorkbenchWidgetDefinition[];
21
21
  createFallbackState?: () => WorkbenchState;
@@ -24,7 +24,7 @@ export declare function sanitizeWorkbenchState(input: unknown, options?: Sanitiz
24
24
  export declare function createDefaultWorkbenchState(widgetDefinitions?: readonly WorkbenchWidgetDefinition[]): WorkbenchState;
25
25
  export declare const WORKBENCH_CANVAS_ZOOM_STEP = 1.18;
26
26
  export declare const WORKBENCH_CONTEXT_MENU_WIDTH_PX = 200;
27
- export declare const WORKBENCH_MIN_SCALE = 0.45;
27
+ export declare const WORKBENCH_MIN_SCALE = 0.2;
28
28
  export declare const WORKBENCH_MAX_SCALE = 2.2;
29
29
  export declare const WORKBENCH_VIEWPORT_FIT_PADDING_PX = 48;
30
30
  export declare function createWorkbenchViewportCenteredOnWidget(options: {
@@ -45,7 +45,7 @@ export interface WorkbenchRenderLayerMap {
45
45
  byWidgetId: ReadonlyMap<string, number>;
46
46
  topRenderLayer: number;
47
47
  }
48
- export declare function createWorkbenchRenderLayerMap(widgets: readonly WorkbenchWidgetItem[]): WorkbenchRenderLayerMap;
48
+ export declare function createWorkbenchRenderLayerMap(widgets: readonly Pick<WorkbenchWidgetItem, 'id' | 'z_index' | 'created_at_unix_ms'>[]): WorkbenchRenderLayerMap;
49
49
  export declare function createContextMenuPosition(options: {
50
50
  clientX: number;
51
51
  clientY: number;
@@ -57,6 +57,6 @@ export declare function createContextMenuPosition(options: {
57
57
  };
58
58
  export declare function getTopZIndex(widgets: readonly WorkbenchWidgetItem[]): number;
59
59
  /** Spatial navigation: find nearest widget in a direction. */
60
- export declare function findNearestWidget(widgets: readonly WorkbenchWidgetItem[], currentId: string | null, direction: 'up' | 'down' | 'left' | 'right', filters: Record<WorkbenchWidgetType, boolean>): WorkbenchWidgetItem | null;
60
+ export declare function findNearestWidget(widgets: readonly WorkbenchWidgetItem[], currentId: string | null, direction: 'up' | 'down' | 'left' | 'right', filters: Record<string, boolean>): WorkbenchWidgetItem | null;
61
61
  export declare function clampScale(scale: number, min?: number, max?: number): number;
62
62
  export declare function estimateContextMenuHeight(actionCount: number, separatorCount?: number): number;
@@ -1,215 +1,406 @@
1
- import { DEFAULT_WORKBENCH_VIEWPORT as y } from "./types.js";
2
- import { resolveWorkbenchWidgetDefinitions as w, getWidgetEntry as _, createWorkbenchFilterState as W, isValidWorkbenchWidgetType as N } from "./widgets/widgetRegistry.js";
3
- import { DEFAULT_WORKBENCH_THEME as b, isWorkbenchThemeId as v } from "./workbenchThemes.js";
4
- function O() {
5
- const e = globalThis.crypto;
6
- return e && typeof e.randomUUID == "function" ? `wb-${e.randomUUID()}` : `wb-${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 8)}`;
1
+ import { DEFAULT_WORKBENCH_VIEWPORT as k, WORKBENCH_BACKGROUND_REGION_FILTER_ID as I, WORKBENCH_LAYER_COMPONENT_FILTER_IDS as L } from "./types.js";
2
+ import { WORKBENCH_DEFAULT_BACKGROUND_MATERIAL as O, WORKBENCH_DEFAULT_REGION_FILL as E, WORKBENCH_DEFAULT_TEXT_COLOR as R, WORKBENCH_DEFAULT_TEXT_FONT as N, WORKBENCH_DEFAULT_STICKY_NOTE_COLOR as S, resolveWorkbenchTextFontOption as B, WORKBENCH_BACKGROUND_MATERIALS as D, WORKBENCH_STICKY_NOTE_COLORS as K, WORKBENCH_TEXT_COLOR_OPTIONS as P, WORKBENCH_REGION_FILL_OPTIONS as U } from "./workbenchOptions.js";
3
+ import { resolveWorkbenchWidgetDefinitions as T, getWidgetEntry as z, createWorkbenchFilterState as p, isValidWorkbenchWidgetType as X } from "./widgets/widgetRegistry.js";
4
+ import { DEFAULT_WORKBENCH_THEME as C, isWorkbenchThemeId as j } from "./workbenchThemes.js";
5
+ function G() {
6
+ const t = globalThis.crypto;
7
+ return t && typeof t.randomUUID == "function" ? `wb-${t.randomUUID()}` : `wb-${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 8)}`;
7
8
  }
8
- function T(e) {
9
- return e.renderMode ?? "canvas_scaled";
9
+ function xt(t) {
10
+ return t.renderMode ?? "canvas_scaled";
10
11
  }
11
- function A(e) {
12
- return e.projectedSurfaceScaleBehavior ?? "stable_transform";
12
+ function gt(t) {
13
+ return t.projectedSurfaceScaleBehavior ?? "stable_transform";
13
14
  }
14
- function H(e) {
15
- const t = Number.isFinite(e.viewport.scale) && e.viewport.scale > 0 ? e.viewport.scale : 1, r = typeof window < "u" && Number.isFinite(window.devicePixelRatio) && window.devicePixelRatio > 0 ? window.devicePixelRatio : 1, d = Math.round((e.viewport.x + e.worldX * t) * r) / r, i = Math.round((e.viewport.y + e.worldY * t) * r) / r;
15
+ function Y(t) {
16
+ const i = Number.isFinite(t.viewport.scale) && t.viewport.scale > 0 ? t.viewport.scale : 1, e = typeof window < "u" && Number.isFinite(window.devicePixelRatio) && window.devicePixelRatio > 0 ? window.devicePixelRatio : 1, o = Math.round((t.viewport.x + t.worldX * i) * e) / e, n = Math.round((t.viewport.y + t.worldY * i) * e) / e;
16
17
  return {
17
- widgetId: e.widgetId,
18
- worldX: e.worldX,
19
- worldY: e.worldY,
20
- worldWidth: e.worldWidth,
21
- worldHeight: e.worldHeight,
22
- screenX: d,
23
- screenY: i,
24
- screenWidth: e.worldWidth * t,
25
- screenHeight: e.worldHeight * t,
26
- viewportScale: t
18
+ widgetId: t.widgetId,
19
+ worldX: t.worldX,
20
+ worldY: t.worldY,
21
+ worldWidth: t.worldWidth,
22
+ worldHeight: t.worldHeight,
23
+ screenX: o,
24
+ screenY: n,
25
+ screenWidth: t.worldWidth * i,
26
+ screenHeight: t.worldHeight * i,
27
+ viewportScale: i
27
28
  };
28
29
  }
29
- function B(e) {
30
+ function yt(t) {
30
31
  return {
31
- ready: e.ready,
32
- rect: H(e)
32
+ ready: t.ready,
33
+ rect: Y(t)
33
34
  };
34
35
  }
35
- function F(e) {
36
- return e ? {
37
- x: Number.isFinite(e.x) ? e.x : 0,
38
- y: Number.isFinite(e.y) ? e.y : 0,
39
- scale: Number.isFinite(e.scale) && e.scale > 0 ? e.scale : 1
40
- } : { ...y };
41
- }
42
- function E(e, t) {
43
- return W(t, e);
44
- }
45
- function X(e, t = {}) {
46
- const r = w(t.widgetDefinitions), d = t.createFallbackState ?? (() => I(r)), i = e;
47
- if (!i || i.version !== 1 || !Array.isArray(i.widgets))
48
- return d();
49
- const a = i.widgets.filter(
50
- (n) => !!n && typeof n.id == "string" && N(n.type, r) && typeof n.title == "string"
51
- ).map((n) => {
52
- const h = _(n.type, r);
36
+ function V(t) {
37
+ return t ? {
38
+ x: Number.isFinite(t.x) ? t.x : 0,
39
+ y: Number.isFinite(t.y) ? t.y : 0,
40
+ scale: Number.isFinite(t.scale) && t.scale > 0 ? t.scale : 1
41
+ } : { ...k };
42
+ }
43
+ function $(t, i) {
44
+ const e = p(i, t);
45
+ for (const o of L)
46
+ e[o] = typeof t?.[o] == "boolean" ? !!t[o] : !0;
47
+ return e;
48
+ }
49
+ function g(t) {
50
+ return !!t && typeof t == "object" && !Array.isArray(t);
51
+ }
52
+ function f(t) {
53
+ return String(t ?? "").trim();
54
+ }
55
+ function c(t, i) {
56
+ const e = Number(t);
57
+ return Number.isFinite(e) ? e : i;
58
+ }
59
+ function l(t, i) {
60
+ const e = c(t, i);
61
+ return e > 0 ? e : i;
62
+ }
63
+ function w(t, i) {
64
+ const e = f(t);
65
+ return e.length > 0 && e.length <= 128 ? e : `${i}-${G()}`;
66
+ }
67
+ function q(t) {
68
+ return t === "annotation" || t === "background" ? t : "work";
69
+ }
70
+ function Z(t, i) {
71
+ const e = f(t);
72
+ return e || (i === "annotation" || i === "background" ? I : "select");
73
+ }
74
+ function y(t, i, e) {
75
+ const o = f(t);
76
+ return i.includes(o) ? o : e;
77
+ }
78
+ function J(t) {
79
+ return y(t, K, S);
80
+ }
81
+ function Q(t) {
82
+ if (!g(t)) return null;
83
+ const i = Date.now();
84
+ return {
85
+ id: w(t.id, "sticky"),
86
+ kind: "sticky_note",
87
+ body: f(t.body) || "Untitled note",
88
+ color: J(t.color),
89
+ x: c(t.x, 0),
90
+ y: c(t.y, 0),
91
+ width: l(t.width, 260),
92
+ height: l(t.height, 190),
93
+ z_index: Math.max(0, Math.trunc(c(t.z_index, 1))),
94
+ created_at_unix_ms: Math.max(0, Math.trunc(c(t.created_at_unix_ms, i))),
95
+ updated_at_unix_ms: Math.max(0, Math.trunc(c(t.updated_at_unix_ms, i)))
96
+ };
97
+ }
98
+ function v(t) {
99
+ if (!Array.isArray(t)) return [];
100
+ const i = /* @__PURE__ */ new Set();
101
+ return t.map((e) => Q(e)).filter((e) => !e || i.has(e.id) ? !1 : (i.add(e.id), !0));
102
+ }
103
+ const tt = ["left", "center", "right"];
104
+ function et(t) {
105
+ return tt.includes(t) ? t : "left";
106
+ }
107
+ function it(t) {
108
+ if (!g(t)) return null;
109
+ const i = Date.now(), e = B(t.font_family);
110
+ return {
111
+ id: w(t.id, "text"),
112
+ kind: "text",
113
+ text: f(t.text) || "Text",
114
+ font_family: e.fontFamily,
115
+ font_size: Math.max(8, Math.min(160, Math.round(c(t.font_size, 28)))),
116
+ font_weight: e.fontWeight,
117
+ color: y(t.color, P, R),
118
+ align: et(t.align),
119
+ x: c(t.x, 0),
120
+ y: c(t.y, 0),
121
+ width: l(t.width, 280),
122
+ height: l(t.height, 84),
123
+ z_index: Math.max(0, Math.trunc(c(t.z_index, 1))),
124
+ created_at_unix_ms: Math.max(0, Math.trunc(c(t.created_at_unix_ms, i))),
125
+ updated_at_unix_ms: Math.max(0, Math.trunc(c(t.updated_at_unix_ms, i)))
126
+ };
127
+ }
128
+ function nt(t) {
129
+ if (!Array.isArray(t)) return [];
130
+ const i = /* @__PURE__ */ new Set();
131
+ return t.map((e) => it(e)).filter((e) => !e || i.has(e.id) ? !1 : (i.add(e.id), !0));
132
+ }
133
+ function rt(t) {
134
+ return y(
135
+ t,
136
+ D,
137
+ O
138
+ );
139
+ }
140
+ function ot(t) {
141
+ if (!g(t)) return null;
142
+ const i = Date.now();
143
+ return {
144
+ id: w(t.id, "region"),
145
+ name: f(t.name) || "Canvas region",
146
+ fill: y(t.fill, U, E),
147
+ opacity: Math.max(0.08, Math.min(1, c(t.opacity, 0.72))),
148
+ material: rt(t.material),
149
+ x: c(t.x, 0),
150
+ y: c(t.y, 0),
151
+ width: l(t.width, 560),
152
+ height: l(t.height, 360),
153
+ z_index: Math.max(0, Math.trunc(c(t.z_index, 1))),
154
+ created_at_unix_ms: Math.max(0, Math.trunc(c(t.created_at_unix_ms, i))),
155
+ updated_at_unix_ms: Math.max(0, Math.trunc(c(t.updated_at_unix_ms, i)))
156
+ };
157
+ }
158
+ function at(t) {
159
+ if (!Array.isArray(t)) return [];
160
+ const i = /* @__PURE__ */ new Set();
161
+ return t.map((e) => ot(e)).filter((e) => !e || i.has(e.id) ? !1 : (i.add(e.id), !0));
162
+ }
163
+ function dt(t, i, e, o, n, a) {
164
+ if (g(t)) {
165
+ const d = f(t.kind), s = f(t.id);
166
+ if (d === "widget" && i.some((h) => h.id === s)) return { kind: d, id: s };
167
+ if (d === "sticky_note" && e.some((h) => h.id === s)) return { kind: d, id: s };
168
+ if (d === "annotation" && o.some((h) => h.id === s)) return { kind: d, id: s };
169
+ if (d === "background_layer" && n.some((h) => h.id === s))
170
+ return { kind: d, id: s };
171
+ }
172
+ return a ? { kind: "widget", id: a } : null;
173
+ }
174
+ function wt(t, i = {}) {
175
+ const e = T(i.widgetDefinitions), o = i.createFallbackState ?? (() => ct(e)), n = t;
176
+ if (!n || n.version !== 1 || !Array.isArray(n.widgets))
177
+ return o();
178
+ const a = n.widgets.filter(
179
+ (r) => !!r && typeof r.id == "string" && X(r.type, e) && typeof r.title == "string"
180
+ ).map((r) => {
181
+ const u = z(r.type, e);
53
182
  return {
54
- id: n.id,
55
- type: n.type,
56
- title: n.title,
57
- x: Number.isFinite(n.x) ? n.x : 0,
58
- y: Number.isFinite(n.y) ? n.y : 0,
59
- width: Number.isFinite(n.width) && n.width > 0 ? n.width : h.defaultSize.width,
60
- height: Number.isFinite(n.height) && n.height > 0 ? n.height : h.defaultSize.height,
61
- z_index: Number.isFinite(n.z_index) && n.z_index >= 0 ? n.z_index : 1,
62
- created_at_unix_ms: Number.isFinite(n.created_at_unix_ms) ? n.created_at_unix_ms : Date.now()
183
+ id: r.id,
184
+ type: r.type,
185
+ title: r.title,
186
+ x: Number.isFinite(r.x) ? r.x : 0,
187
+ y: Number.isFinite(r.y) ? r.y : 0,
188
+ width: Number.isFinite(r.width) && r.width > 0 ? r.width : u.defaultSize.width,
189
+ height: Number.isFinite(r.height) && r.height > 0 ? r.height : u.defaultSize.height,
190
+ z_index: Number.isFinite(r.z_index) && r.z_index >= 0 ? r.z_index : 1,
191
+ created_at_unix_ms: Number.isFinite(r.created_at_unix_ms) ? r.created_at_unix_ms : Date.now()
63
192
  };
64
- }), c = typeof i.selectedWidgetId == "string" && a.some((n) => n.id === i.selectedWidgetId) ? i.selectedWidgetId : null;
193
+ }), d = typeof n.selectedWidgetId == "string" && a.some((r) => r.id === n.selectedWidgetId) ? n.selectedWidgetId : null, s = v(n.stickyNotes), h = nt(n.annotations), m = at(n.backgroundLayers), _ = q(n.mode);
65
194
  return {
66
195
  version: 1,
67
196
  widgets: a,
68
- viewport: F(i.viewport),
69
- locked: typeof i.locked == "boolean" ? i.locked : !1,
70
- filters: E(i.filters, r),
71
- selectedWidgetId: c,
72
- theme: v(i.theme) ? i.theme : b
197
+ viewport: V(n.viewport),
198
+ locked: typeof n.locked == "boolean" ? n.locked : !1,
199
+ filters: $(n.filters, e),
200
+ selectedWidgetId: d,
201
+ theme: j(n.theme) ? n.theme : C,
202
+ mode: _,
203
+ activeTool: Z(n.activeTool, _),
204
+ selectedObject: dt(
205
+ n.selectedObject,
206
+ a,
207
+ s,
208
+ h,
209
+ m,
210
+ d
211
+ ),
212
+ stickyNotes: s,
213
+ annotations: h,
214
+ backgroundLayers: m
73
215
  };
74
216
  }
75
- function I(e) {
76
- const t = w(e), r = Date.now(), d = [
217
+ function ct(t) {
218
+ const i = T(t), e = Date.now(), o = [
77
219
  { type: "terminal", title: "dev · terminal", x: 80, y: 80 },
78
220
  { type: "file-browser", title: "project · files", x: 600, y: 80 },
79
221
  { type: "system-monitor", title: "host · system monitor", x: 80, y: 420 },
80
222
  { type: "log-viewer", title: "services · logs", x: 540, y: 500 },
81
223
  { type: "code-editor", title: "Counter.tsx", x: 1e3, y: 180 }
82
- ], i = d.filter((a) => t.some((c) => c.type === a.type)).map((a, c) => {
83
- const n = _(a.type, t);
224
+ ], n = o.filter((a) => i.some((d) => d.type === a.type)).map((a, d) => {
225
+ const s = z(a.type, i);
84
226
  return {
85
- id: `wb-seed-${c + 1}`,
227
+ id: `wb-seed-${d + 1}`,
86
228
  type: a.type,
87
229
  title: a.title,
88
230
  x: a.x,
89
231
  y: a.y,
90
- width: n.defaultSize.width,
91
- height: n.defaultSize.height,
92
- z_index: c + 1,
93
- created_at_unix_ms: r - (d.length - c) * 6e5
232
+ width: s.defaultSize.width,
233
+ height: s.defaultSize.height,
234
+ z_index: d + 1,
235
+ created_at_unix_ms: e - (o.length - d) * 6e5
94
236
  };
95
237
  });
96
238
  return {
97
239
  version: 1,
98
- widgets: i,
99
- viewport: { ...y },
240
+ widgets: n,
241
+ viewport: { ...k },
100
242
  locked: !1,
101
- filters: W(t),
102
- selectedWidgetId: i[0]?.id ?? null,
103
- theme: b
243
+ filters: p(i),
244
+ selectedWidgetId: n[0]?.id ?? null,
245
+ theme: C,
246
+ mode: "work",
247
+ activeTool: "select",
248
+ selectedObject: n[0] ? { kind: "widget", id: n[0].id } : null,
249
+ stickyNotes: [
250
+ {
251
+ id: "wb-seed-sticky-1",
252
+ kind: "sticky_note",
253
+ body: "Confirm the rollout checklist before touching production.",
254
+ color: S,
255
+ x: 930,
256
+ y: 620,
257
+ width: 270,
258
+ height: 170,
259
+ z_index: n.length + 1,
260
+ created_at_unix_ms: e - 25e4,
261
+ updated_at_unix_ms: e - 25e4
262
+ }
263
+ ],
264
+ annotations: [
265
+ {
266
+ id: "wb-seed-text-1",
267
+ kind: "text",
268
+ text: "Release focus",
269
+ font_family: N.fontFamily,
270
+ font_size: 34,
271
+ font_weight: N.fontWeight,
272
+ color: R,
273
+ align: "left",
274
+ x: 588,
275
+ y: 378,
276
+ width: 320,
277
+ height: 82,
278
+ z_index: 1,
279
+ created_at_unix_ms: e - 24e4,
280
+ updated_at_unix_ms: e - 24e4
281
+ }
282
+ ],
283
+ backgroundLayers: [
284
+ {
285
+ id: "wb-seed-region-1",
286
+ name: "Review lane",
287
+ fill: E,
288
+ opacity: 0.58,
289
+ material: O,
290
+ x: 512,
291
+ y: 360,
292
+ width: 760,
293
+ height: 520,
294
+ z_index: 1,
295
+ created_at_unix_ms: e - 26e4,
296
+ updated_at_unix_ms: e - 26e4
297
+ }
298
+ ]
104
299
  };
105
300
  }
106
- const K = 1.18, U = 200, u = 0.45, m = 2.2, p = 48;
107
- function R(e) {
108
- const t = M(e.scale, u, m);
301
+ const bt = 1.18, Wt = 200, b = 0.2, W = 2.2, st = 48;
302
+ function ht(t) {
303
+ const i = A(t.scale, b, W);
109
304
  return {
110
- x: e.frameWidth / 2 - (e.widget.x + e.widget.width / 2) * t,
111
- y: e.frameHeight / 2 - (e.widget.y + e.widget.height / 2) * t,
112
- scale: t
305
+ x: t.frameWidth / 2 - (t.widget.x + t.widget.width / 2) * i,
306
+ y: t.frameHeight / 2 - (t.widget.y + t.widget.height / 2) * i,
307
+ scale: i
113
308
  };
114
309
  }
115
- function V(e) {
116
- const t = e.minScale ?? u, r = e.maxScale ?? m, d = e.paddingPx ?? p, i = Math.max(e.frameWidth - d * 2, 1), a = Math.max(e.frameHeight - d * 2, 1), c = M(
310
+ function Mt(t) {
311
+ const i = t.minScale ?? b, e = t.maxScale ?? W, o = t.paddingPx ?? st, n = Math.max(t.frameWidth - o * 2, 1), a = Math.max(t.frameHeight - o * 2, 1), d = A(
117
312
  Math.min(
118
- i / Math.max(e.widget.width, 1),
119
- a / Math.max(e.widget.height, 1)
313
+ n / Math.max(t.widget.width, 1),
314
+ a / Math.max(t.widget.height, 1)
120
315
  ),
121
- t,
122
- r
316
+ i,
317
+ e
123
318
  );
124
- return R({
125
- widget: e.widget,
126
- scale: c,
127
- frameWidth: e.frameWidth,
128
- frameHeight: e.frameHeight
319
+ return ht({
320
+ widget: t.widget,
321
+ scale: d,
322
+ frameWidth: t.frameWidth,
323
+ frameHeight: t.frameHeight
129
324
  });
130
325
  }
131
- function z(e, t) {
132
- 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);
326
+ function _t(t, i) {
327
+ return t.z_index !== i.z_index ? t.z_index - i.z_index : t.created_at_unix_ms !== i.created_at_unix_ms ? t.created_at_unix_ms - i.created_at_unix_ms : t.id.localeCompare(i.id);
133
328
  }
134
- function L(e) {
135
- const t = [...e].sort(z), r = /* @__PURE__ */ new Map();
136
- for (const [d, i] of t.entries())
137
- r.set(i.id, d + 1);
329
+ function Nt(t) {
330
+ const i = [...t].sort(_t), e = /* @__PURE__ */ new Map();
331
+ for (const [o, n] of i.entries())
332
+ e.set(n.id, o + 1);
138
333
  return {
139
- byWidgetId: r,
140
- topRenderLayer: Math.max(t.length, 1)
334
+ byWidgetId: e,
335
+ topRenderLayer: Math.max(i.length, 1)
141
336
  };
142
337
  }
143
- function Y(e) {
144
- const t = typeof window < "u" ? window.innerWidth : 1280, r = typeof window < "u" ? window.innerHeight : 800;
145
- let d = e.clientX, i = e.clientY;
146
- return d + e.menuWidth > t && (d = Math.max(0, t - e.menuWidth - 8)), i + e.menuHeight > r && (i = Math.max(0, r - e.menuHeight - 8)), { left: d, top: i };
147
- }
148
- function j(e) {
149
- return e.reduce((t, r) => Math.max(t, r.z_index), 1);
150
- }
151
- function $(e, t, r, d) {
152
- const i = e.filter((o) => d[o.type]);
153
- if (i.length === 0) return null;
154
- if (!t) return i[0] ?? null;
155
- const a = i.find((o) => o.id === t);
156
- if (!a) return i[0] ?? null;
157
- const c = a.x + a.width / 2, n = a.y + a.height / 2;
158
- let h = null, g = 1 / 0;
159
- for (const o of i) {
160
- if (o.id === t) continue;
161
- const s = o.x + o.width / 2 - c, l = o.y + o.height / 2 - n;
162
- let f = !1;
163
- switch (r) {
338
+ function kt(t) {
339
+ const i = typeof window < "u" ? window.innerWidth : 1280, e = typeof window < "u" ? window.innerHeight : 800;
340
+ let o = t.clientX, n = t.clientY;
341
+ return o + t.menuWidth > i && (o = Math.max(0, i - t.menuWidth - 8)), n + t.menuHeight > e && (n = Math.max(0, e - t.menuHeight - 8)), { left: o, top: n };
342
+ }
343
+ function Ot(t, i, e, o) {
344
+ const n = t.filter((_) => o[_.type]);
345
+ if (n.length === 0) return null;
346
+ if (!i) return n[0] ?? null;
347
+ const a = n.find((_) => _.id === i);
348
+ if (!a) return n[0] ?? null;
349
+ const d = a.x + a.width / 2, s = a.y + a.height / 2;
350
+ let h = null, m = 1 / 0;
351
+ for (const _ of n) {
352
+ if (_.id === i) continue;
353
+ const r = _.x + _.width / 2 - d, u = _.y + _.height / 2 - s;
354
+ let x = !1;
355
+ switch (e) {
164
356
  case "up":
165
- f = l < -10;
357
+ x = u < -10;
166
358
  break;
167
359
  case "down":
168
- f = l > 10;
360
+ x = u > 10;
169
361
  break;
170
362
  case "left":
171
- f = s < -10;
363
+ x = r < -10;
172
364
  break;
173
365
  case "right":
174
- f = s > 10;
366
+ x = r > 10;
175
367
  break;
176
368
  }
177
- if (!f) continue;
178
- const S = Math.sqrt(s * s + l * l), k = Math.atan2(
179
- Math.abs(r === "up" || r === "down" ? s : l),
180
- Math.abs(r === "up" || r === "down" ? l : s)
181
- ), x = S * (1 + k * 1.5);
182
- x < g && (g = x, h = o);
369
+ if (!x) continue;
370
+ const F = Math.sqrt(r * r + u * u), H = Math.atan2(
371
+ Math.abs(e === "up" || e === "down" ? r : u),
372
+ Math.abs(e === "up" || e === "down" ? u : r)
373
+ ), M = F * (1 + H * 1.5);
374
+ M < m && (m = M, h = _);
183
375
  }
184
376
  return h;
185
377
  }
186
- function M(e, t = u, r = m) {
187
- return Math.max(t, Math.min(r, e));
378
+ function A(t, i = b, e = W) {
379
+ return Math.max(i, Math.min(e, t));
188
380
  }
189
- function Z(e, t = 0) {
190
- return 16 + Math.max(1, e) * 32 + Math.max(0, t) * 9;
381
+ function Et(t, i = 0) {
382
+ return 16 + Math.max(1, t) * 32 + Math.max(0, i) * 9;
191
383
  }
192
384
  export {
193
- K as WORKBENCH_CANVAS_ZOOM_STEP,
194
- U as WORKBENCH_CONTEXT_MENU_WIDTH_PX,
195
- m as WORKBENCH_MAX_SCALE,
196
- u as WORKBENCH_MIN_SCALE,
197
- p as WORKBENCH_VIEWPORT_FIT_PADDING_PX,
198
- M as clampScale,
199
- Y as createContextMenuPosition,
200
- I as createDefaultWorkbenchState,
201
- O as createWorkbenchId,
202
- H as createWorkbenchProjectedRect,
203
- L as createWorkbenchRenderLayerMap,
204
- R as createWorkbenchViewportCenteredOnWidget,
205
- V as createWorkbenchViewportFitForWidget,
206
- B as createWorkbenchWidgetSurfaceMetrics,
207
- Z as estimateContextMenuHeight,
208
- $ as findNearestWidget,
209
- j as getTopZIndex,
210
- A as resolveWorkbenchProjectedSurfaceScaleBehavior,
211
- T as resolveWorkbenchWidgetRenderMode,
212
- E as sanitizeFilters,
213
- F as sanitizeViewport,
214
- X as sanitizeWorkbenchState
385
+ bt as WORKBENCH_CANVAS_ZOOM_STEP,
386
+ Wt as WORKBENCH_CONTEXT_MENU_WIDTH_PX,
387
+ W as WORKBENCH_MAX_SCALE,
388
+ b as WORKBENCH_MIN_SCALE,
389
+ st as WORKBENCH_VIEWPORT_FIT_PADDING_PX,
390
+ A as clampScale,
391
+ kt as createContextMenuPosition,
392
+ ct as createDefaultWorkbenchState,
393
+ G as createWorkbenchId,
394
+ Y as createWorkbenchProjectedRect,
395
+ Nt as createWorkbenchRenderLayerMap,
396
+ ht as createWorkbenchViewportCenteredOnWidget,
397
+ Mt as createWorkbenchViewportFitForWidget,
398
+ yt as createWorkbenchWidgetSurfaceMetrics,
399
+ Et as estimateContextMenuHeight,
400
+ Ot as findNearestWidget,
401
+ gt as resolveWorkbenchProjectedSurfaceScaleBehavior,
402
+ xt as resolveWorkbenchWidgetRenderMode,
403
+ $ as sanitizeFilters,
404
+ V as sanitizeViewport,
405
+ wt as sanitizeWorkbenchState
215
406
  };
@@ -0,0 +1,43 @@
1
+ export declare const WORKBENCH_TEXT_COLOR_OPTIONS: readonly ["#6b7280", "#64748b", "#71717a", "#78716c", "#7770a0", "#8a6b6b"];
2
+ export declare const WORKBENCH_DEFAULT_TEXT_COLOR: "#6b7280";
3
+ export declare const WORKBENCH_TEXT_FONT_OPTIONS: readonly [{
4
+ readonly id: "serif";
5
+ readonly label: "Serif";
6
+ readonly fontFamily: "ui-serif, Georgia, serif";
7
+ readonly fontWeight: 760;
8
+ }, {
9
+ readonly id: "sans";
10
+ readonly label: "Sans";
11
+ readonly fontFamily: "ui-sans-serif, -apple-system, BlinkMacSystemFont, \"Segoe UI\", sans-serif";
12
+ readonly fontWeight: 800;
13
+ }, {
14
+ readonly id: "round";
15
+ readonly label: "Round";
16
+ readonly fontFamily: "ui-rounded, \"SF Pro Rounded\", \"Arial Rounded MT Bold\", ui-sans-serif, sans-serif";
17
+ readonly fontWeight: 800;
18
+ }, {
19
+ readonly id: "mono";
20
+ readonly label: "Mono";
21
+ readonly fontFamily: "ui-monospace, \"SFMono-Regular\", Menlo, Consolas, monospace";
22
+ readonly fontWeight: 800;
23
+ }, {
24
+ readonly id: "condensed";
25
+ readonly label: "Cond";
26
+ readonly fontFamily: "Impact, Haettenschweiler, \"Arial Narrow Bold\", sans-serif";
27
+ readonly fontWeight: 700;
28
+ }];
29
+ export type WorkbenchTextFontOption = typeof WORKBENCH_TEXT_FONT_OPTIONS[number];
30
+ export declare const WORKBENCH_DEFAULT_TEXT_FONT: {
31
+ readonly id: "serif";
32
+ readonly label: "Serif";
33
+ readonly fontFamily: "ui-serif, Georgia, serif";
34
+ readonly fontWeight: 760;
35
+ };
36
+ export declare const WORKBENCH_TEXT_EMOJI_OPTIONS: readonly ["✨", "✅", "⚠️", "🔥", "💡", "🚀", "🎯", "📌", "🧭", "🧪", "🛠️", "📝", "👀", "🔎", "💬", "❓", "❗", "⭐", "❤️", "🔒", "🔗", "📎", "📅", "⏱️", "📊", "📈", "🏁", "🔖", "🧩", "⚙️", "🚧", "🧯", "📦", "🎉"];
37
+ export declare function resolveWorkbenchTextFontOption(fontFamily: unknown): WorkbenchTextFontOption;
38
+ export declare const WORKBENCH_REGION_FILL_OPTIONS: readonly ["#9da8a1", "#a79d8e", "#8fa1aa", "#a78f86", "#9ca184", "#9993a7"];
39
+ export declare const WORKBENCH_DEFAULT_REGION_FILL: "#9da8a1";
40
+ export declare const WORKBENCH_BACKGROUND_MATERIALS: readonly ["solid", "dotted", "grid", "hatched", "glass"];
41
+ export declare const WORKBENCH_DEFAULT_BACKGROUND_MATERIAL = "dotted";
42
+ export declare const WORKBENCH_STICKY_NOTE_COLORS: readonly ["amber", "sage", "azure", "coral", "rose"];
43
+ export declare const WORKBENCH_DEFAULT_STICKY_NOTE_COLOR = "amber";