@floegence/floe-webapp-core 0.36.42 → 0.36.44
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/icons/index.d.ts +2 -0
- package/dist/components/icons/index.js +419 -397
- package/dist/components/workbench/WorkbenchCanvas.d.ts +45 -2
- package/dist/components/workbench/WorkbenchCanvas.js +265 -66
- package/dist/components/workbench/WorkbenchCanvasField.d.ts +47 -2
- package/dist/components/workbench/WorkbenchCanvasField.js +258 -78
- package/dist/components/workbench/WorkbenchFilterBar.d.ts +9 -7
- package/dist/components/workbench/WorkbenchFilterBar.js +233 -145
- package/dist/components/workbench/WorkbenchLayerObjects.d.ts +136 -0
- package/dist/components/workbench/WorkbenchLayerObjects.js +999 -0
- package/dist/components/workbench/WorkbenchOverlay.d.ts +4 -1
- package/dist/components/workbench/WorkbenchOverlay.js +59 -29
- package/dist/components/workbench/WorkbenchSurface.d.ts +23 -11
- package/dist/components/workbench/WorkbenchSurface.js +315 -195
- package/dist/components/workbench/WorkbenchWidget.js +37 -37
- package/dist/components/workbench/index.d.ts +2 -1
- package/dist/components/workbench/types.d.ts +96 -1
- package/dist/components/workbench/types.js +12 -4
- package/dist/components/workbench/useWorkbenchModel.d.ts +62 -4
- package/dist/components/workbench/useWorkbenchModel.js +790 -253
- package/dist/components/workbench/widgets/widgetRegistry.d.ts +1 -1
- package/dist/components/workbench/workbenchHelpers.d.ts +5 -5
- package/dist/components/workbench/workbenchHelpers.js +345 -154
- package/dist/components/workbench/workbenchOptions.d.ts +43 -0
- package/dist/components/workbench/workbenchOptions.js +112 -0
- package/dist/full.js +620 -618
- package/dist/icons.js +71 -69
- package/dist/styles.css +1 -1
- package/dist/workbench.css +1122 -26
- package/dist/workbench.js +52 -36
- 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<
|
|
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
|
|
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<
|
|
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.
|
|
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<
|
|
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
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
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
|
|
9
|
-
return
|
|
9
|
+
function xt(t) {
|
|
10
|
+
return t.renderMode ?? "canvas_scaled";
|
|
10
11
|
}
|
|
11
|
-
function
|
|
12
|
-
return
|
|
12
|
+
function gt(t) {
|
|
13
|
+
return t.projectedSurfaceScaleBehavior ?? "stable_transform";
|
|
13
14
|
}
|
|
14
|
-
function
|
|
15
|
-
const
|
|
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:
|
|
18
|
-
worldX:
|
|
19
|
-
worldY:
|
|
20
|
-
worldWidth:
|
|
21
|
-
worldHeight:
|
|
22
|
-
screenX:
|
|
23
|
-
screenY:
|
|
24
|
-
screenWidth:
|
|
25
|
-
screenHeight:
|
|
26
|
-
viewportScale:
|
|
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
|
|
30
|
+
function yt(t) {
|
|
30
31
|
return {
|
|
31
|
-
ready:
|
|
32
|
-
rect:
|
|
32
|
+
ready: t.ready,
|
|
33
|
+
rect: Y(t)
|
|
33
34
|
};
|
|
34
35
|
}
|
|
35
|
-
function
|
|
36
|
-
return
|
|
37
|
-
x: Number.isFinite(
|
|
38
|
-
y: Number.isFinite(
|
|
39
|
-
scale: Number.isFinite(
|
|
40
|
-
} : { ...
|
|
41
|
-
}
|
|
42
|
-
function
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
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:
|
|
55
|
-
type:
|
|
56
|
-
title:
|
|
57
|
-
x: Number.isFinite(
|
|
58
|
-
y: Number.isFinite(
|
|
59
|
-
width: Number.isFinite(
|
|
60
|
-
height: Number.isFinite(
|
|
61
|
-
z_index: Number.isFinite(
|
|
62
|
-
created_at_unix_ms: Number.isFinite(
|
|
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
|
-
}),
|
|
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:
|
|
69
|
-
locked: typeof
|
|
70
|
-
filters:
|
|
71
|
-
selectedWidgetId:
|
|
72
|
-
theme:
|
|
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
|
|
76
|
-
const
|
|
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
|
-
],
|
|
83
|
-
const
|
|
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-${
|
|
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:
|
|
91
|
-
height:
|
|
92
|
-
z_index:
|
|
93
|
-
created_at_unix_ms:
|
|
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:
|
|
99
|
-
viewport: { ...
|
|
240
|
+
widgets: n,
|
|
241
|
+
viewport: { ...k },
|
|
100
242
|
locked: !1,
|
|
101
|
-
filters:
|
|
102
|
-
selectedWidgetId:
|
|
103
|
-
theme:
|
|
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
|
|
107
|
-
function
|
|
108
|
-
const
|
|
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:
|
|
111
|
-
y:
|
|
112
|
-
scale:
|
|
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
|
|
116
|
-
const
|
|
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
|
-
|
|
119
|
-
a / Math.max(
|
|
313
|
+
n / Math.max(t.widget.width, 1),
|
|
314
|
+
a / Math.max(t.widget.height, 1)
|
|
120
315
|
),
|
|
121
|
-
|
|
122
|
-
|
|
316
|
+
i,
|
|
317
|
+
e
|
|
123
318
|
);
|
|
124
|
-
return
|
|
125
|
-
widget:
|
|
126
|
-
scale:
|
|
127
|
-
frameWidth:
|
|
128
|
-
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
|
|
132
|
-
return
|
|
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
|
|
135
|
-
const
|
|
136
|
-
for (const [
|
|
137
|
-
|
|
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:
|
|
140
|
-
topRenderLayer: Math.max(
|
|
334
|
+
byWidgetId: e,
|
|
335
|
+
topRenderLayer: Math.max(i.length, 1)
|
|
141
336
|
};
|
|
142
337
|
}
|
|
143
|
-
function
|
|
144
|
-
const
|
|
145
|
-
let
|
|
146
|
-
return
|
|
147
|
-
}
|
|
148
|
-
function
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
const
|
|
153
|
-
if (
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
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
|
-
|
|
357
|
+
x = u < -10;
|
|
166
358
|
break;
|
|
167
359
|
case "down":
|
|
168
|
-
|
|
360
|
+
x = u > 10;
|
|
169
361
|
break;
|
|
170
362
|
case "left":
|
|
171
|
-
|
|
363
|
+
x = r < -10;
|
|
172
364
|
break;
|
|
173
365
|
case "right":
|
|
174
|
-
|
|
366
|
+
x = r > 10;
|
|
175
367
|
break;
|
|
176
368
|
}
|
|
177
|
-
if (!
|
|
178
|
-
const
|
|
179
|
-
Math.abs(
|
|
180
|
-
Math.abs(
|
|
181
|
-
),
|
|
182
|
-
|
|
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
|
|
187
|
-
return Math.max(
|
|
378
|
+
function A(t, i = b, e = W) {
|
|
379
|
+
return Math.max(i, Math.min(e, t));
|
|
188
380
|
}
|
|
189
|
-
function
|
|
190
|
-
return 16 + Math.max(1,
|
|
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
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
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";
|