@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.
- 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 +986 -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 +1117 -26
- package/dist/workbench.js +52 -36
- package/package.json +1 -1
|
@@ -1,24 +1,24 @@
|
|
|
1
1
|
import { spread as at, mergeProps as Rt, insert as s, createComponent as h, memo as Xt, effect as zt, style as Yt, template as gt, use as Dt, delegateEvents as jt } from "solid-js/web";
|
|
2
|
-
import { createMemo as
|
|
2
|
+
import { createMemo as u, createSignal as P, onCleanup as lt, untrack as _, createEffect as ct } from "solid-js";
|
|
3
3
|
import { startHotInteraction as Ft } from "../../utils/hotInteraction.js";
|
|
4
|
-
import { X as dt, Minus as st, Maximize as
|
|
4
|
+
import { X as dt, Minus as st, Maximize as ut, GripVertical as Ht } from "../icons/index.js";
|
|
5
5
|
import { CANVAS_WHEEL_INTERACTIVE_ATTR as Ot, WORKBENCH_WIDGET_SHELL_ATTR as Vt, resolveWorkbenchWidgetLocalTypingTarget as qt, resolveWorkbenchWidgetTextSelectionTarget as Bt, shouldActivateWorkbenchWidgetLocalTarget as Nt } from "../ui/localInteractionSurface.js";
|
|
6
|
-
import { startPointerSession as
|
|
6
|
+
import { startPointerSession as wt } from "../ui/pointerSession.js";
|
|
7
7
|
import { createWorkbenchWidgetSurfaceMetrics as Gt, resolveWorkbenchProjectedSurfaceScaleBehavior as Zt } from "./workbenchHelpers.js";
|
|
8
8
|
import { createWorkbenchEdgeAutoPanController as Kt, WORKBENCH_EDGE_AUTO_PAN_FRAME_SELECTOR as Ut, frameFromElement as Jt } from "./workbenchEdgeAutoPan.js";
|
|
9
9
|
import { resolveWorkbenchInteractionAdapter as Qt } from "./workbenchInteractionAdapter.js";
|
|
10
10
|
var te = /* @__PURE__ */ gt('<article class=workbench-widget><div class=workbench-widget__surface><header class=workbench-widget__header><span class=workbench-widget__traffic role=group aria-label="Window controls"><button type=button class="workbench-widget__traffic-dot workbench-widget__traffic-dot--close"aria-label="Close widget"title="Close widget"data-floe-canvas-interactive=true></button><button type=button class="workbench-widget__traffic-dot workbench-widget__traffic-dot--min"aria-label="Minimize widget to overview"title="Minimize widget to overview"data-floe-canvas-interactive=true></button><button type=button class="workbench-widget__traffic-dot workbench-widget__traffic-dot--max"aria-label="Zoom widget to fit viewport"title="Zoom widget to fit viewport"data-floe-canvas-interactive=true></button></span><span class=workbench-widget__badge aria-hidden=true></span><button type=button class=workbench-widget__drag aria-label="Drag widget"data-floe-canvas-interactive=true></button><div class=workbench-widget__title-area><span class=workbench-widget__title-dot aria-hidden=true></span><span class=workbench-widget__title></span></div><span class=workbench-widget__window-controls role=group aria-label="Window controls"><button type=button class="workbench-widget__window-control workbench-widget__window-control--min"aria-label="Minimize widget to overview"title="Minimize widget to overview"data-floe-canvas-interactive=true></button><button type=button class="workbench-widget__window-control workbench-widget__window-control--max"aria-label="Zoom widget to fit viewport"title="Zoom widget to fit viewport"data-floe-canvas-interactive=true></button><button type=button class="workbench-widget__window-control workbench-widget__window-control--close"aria-label="Remove widget"title="Remove widget"data-floe-canvas-interactive=true></button></span></header><div class=workbench-widget__body data-floe-canvas-interactive=true>'), ee = /* @__PURE__ */ gt('<div class=workbench-widget__resize aria-label="Resize widget"data-floe-canvas-interactive=true><svg class=workbench-widget__resize-glyph viewBox="0 0 12 12"aria-hidden=true><path d="M12 0 L0 12"></path><path d="M12 4 L4 12"></path><path d="M12 8 L8 12">');
|
|
11
11
|
const ie = 220, oe = 160, ne = 160;
|
|
12
12
|
function he(e) {
|
|
13
|
-
const d =
|
|
13
|
+
const d = u(() => Qt(e.interactionAdapter)), [b, I] = P(null), [M, X] = P(null), [ht, ft] = P(), [z, Y] = P(!1), [N, x] = P({
|
|
14
14
|
enabled: !1,
|
|
15
15
|
scale: 1
|
|
16
16
|
});
|
|
17
|
-
let v, S, k, T = null, mt = 0, _t = 0, m = null,
|
|
18
|
-
const
|
|
17
|
+
let v, S, k, T = null, mt = 0, _t = 0, m = null, $;
|
|
18
|
+
const p = /* @__PURE__ */ new Map();
|
|
19
19
|
let c;
|
|
20
20
|
const W = () => {
|
|
21
|
-
typeof window > "u" ||
|
|
21
|
+
typeof window > "u" || $ === void 0 || (window.clearTimeout($), $ = void 0);
|
|
22
22
|
}, G = (t, i) => {
|
|
23
23
|
const o = Ft({
|
|
24
24
|
kind: t,
|
|
@@ -67,18 +67,18 @@ function he(e) {
|
|
|
67
67
|
Y(!1), e.onSelect(e.widgetId), e.onCommitFront(e.widgetId);
|
|
68
68
|
}, D = () => {
|
|
69
69
|
Y(!1);
|
|
70
|
-
}, y =
|
|
70
|
+
}, y = u(() => e.selected || z()), vt = (t, i, o) => {
|
|
71
71
|
const a = {
|
|
72
72
|
token: ++_t,
|
|
73
73
|
wasSelected: i,
|
|
74
74
|
ownership: o
|
|
75
75
|
};
|
|
76
|
-
|
|
77
|
-
|
|
76
|
+
p.set(t, a), !i && o === "widget_local" && Y(!0), queueMicrotask(() => {
|
|
77
|
+
p.get(t)?.token === a.token && p.delete(t);
|
|
78
78
|
});
|
|
79
79
|
}, St = (t) => {
|
|
80
|
-
const i =
|
|
81
|
-
return i &&
|
|
80
|
+
const i = p.get(t) ?? null;
|
|
81
|
+
return i && p.delete(t), i;
|
|
82
82
|
};
|
|
83
83
|
ct(() => {
|
|
84
84
|
const t = c;
|
|
@@ -96,12 +96,12 @@ function he(e) {
|
|
|
96
96
|
t.removeEventListener("pointerdown", i, !0), t.removeEventListener("click", o, !0), t.removeEventListener("pointerup", a), t.removeEventListener("pointercancel", D);
|
|
97
97
|
});
|
|
98
98
|
});
|
|
99
|
-
const j = () => b() !== null, F = () => M() !== null, kt =
|
|
99
|
+
const j = () => b() !== null, F = () => M() !== null, kt = u(() => e.filtered || e.locked ? "cold" : y() ? "hot" : "warm"), E = (t) => d().resolveWidgetEventOwnership({
|
|
100
100
|
target: t,
|
|
101
101
|
widgetRoot: c ?? null,
|
|
102
102
|
interactiveSelector: d().interactiveSelector,
|
|
103
103
|
panSurfaceSelector: d().panSurfaceSelector
|
|
104
|
-
}),
|
|
104
|
+
}), $t = () => {
|
|
105
105
|
C(), c?.focus({
|
|
106
106
|
preventScroll: !0
|
|
107
107
|
});
|
|
@@ -111,7 +111,7 @@ function he(e) {
|
|
|
111
111
|
source: "local_pointer",
|
|
112
112
|
pointerType: t
|
|
113
113
|
}));
|
|
114
|
-
},
|
|
114
|
+
}, pt = (t) => {
|
|
115
115
|
if (!(!c || !t.isConnected || !c.contains(t)))
|
|
116
116
|
try {
|
|
117
117
|
t.focus({
|
|
@@ -130,7 +130,7 @@ function he(e) {
|
|
|
130
130
|
const o = m;
|
|
131
131
|
queueMicrotask(() => {
|
|
132
132
|
const a = () => {
|
|
133
|
-
!o || m?.token !== o.token || (
|
|
133
|
+
!o || m?.token !== o.token || (pt(o.target), m = null);
|
|
134
134
|
};
|
|
135
135
|
if (typeof requestAnimationFrame == "function") {
|
|
136
136
|
requestAnimationFrame(() => a());
|
|
@@ -139,7 +139,7 @@ function he(e) {
|
|
|
139
139
|
a();
|
|
140
140
|
});
|
|
141
141
|
}, Pt = (t) => {
|
|
142
|
-
if (t.button !== 0) return;
|
|
142
|
+
if (t.button !== 0 || e.locked) return;
|
|
143
143
|
const i = St(t.pointerId), o = i?.wasSelected ?? e.selected, a = i?.ownership ?? E(t.target), r = a === "widget_local" ? qt({
|
|
144
144
|
target: t.target,
|
|
145
145
|
widgetRoot: c ?? null,
|
|
@@ -179,7 +179,7 @@ function he(e) {
|
|
|
179
179
|
C(), K(t.pointerType || void 0);
|
|
180
180
|
}
|
|
181
181
|
}
|
|
182
|
-
}, L =
|
|
182
|
+
}, L = u(() => {
|
|
183
183
|
const t = b();
|
|
184
184
|
return t ? {
|
|
185
185
|
x: t.worldX,
|
|
@@ -188,7 +188,7 @@ function he(e) {
|
|
|
188
188
|
x: e.x,
|
|
189
189
|
y: e.y
|
|
190
190
|
};
|
|
191
|
-
}),
|
|
191
|
+
}), w = u(() => {
|
|
192
192
|
const t = M();
|
|
193
193
|
return t ? {
|
|
194
194
|
width: t.width,
|
|
@@ -197,31 +197,31 @@ function he(e) {
|
|
|
197
197
|
width: e.width,
|
|
198
198
|
height: e.height
|
|
199
199
|
};
|
|
200
|
-
}), H =
|
|
200
|
+
}), H = u(() => {
|
|
201
201
|
if (!(e.layoutMode !== "projected_surface" || !e.projectedViewport))
|
|
202
202
|
return Gt({
|
|
203
203
|
widgetId: e.widgetId,
|
|
204
204
|
worldX: L().x,
|
|
205
205
|
worldY: L().y,
|
|
206
|
-
worldWidth:
|
|
207
|
-
worldHeight:
|
|
206
|
+
worldWidth: w().width,
|
|
207
|
+
worldHeight: w().height,
|
|
208
208
|
viewport: e.projectedViewport(),
|
|
209
209
|
ready: e.surfaceReady ?? !0
|
|
210
210
|
});
|
|
211
|
-
}), O =
|
|
211
|
+
}), O = u(() => H()?.rect.viewportScale ?? Math.max(e.viewportScale, 1e-3)), U = u(() => e.layoutMode === "projected_surface" && Zt(e.definition) === "settle_sharp_zoom"), J = u(() => e.layoutMode === "projected_surface" && U() && N().enabled && N().scale > 1.001), It = u(() => {
|
|
212
212
|
if (e.layoutMode !== "projected_surface")
|
|
213
213
|
return;
|
|
214
214
|
const t = O();
|
|
215
215
|
return J() ? {
|
|
216
|
-
width: `${
|
|
217
|
-
height: `${
|
|
216
|
+
width: `${w().width}px`,
|
|
217
|
+
height: `${w().height}px`,
|
|
218
218
|
zoom: `${t}`
|
|
219
219
|
} : {
|
|
220
220
|
width: "100%",
|
|
221
221
|
height: "100%",
|
|
222
222
|
zoom: "1"
|
|
223
223
|
};
|
|
224
|
-
}), Mt =
|
|
224
|
+
}), Mt = u(() => {
|
|
225
225
|
const t = e.itemSnapshot().z_index, i = Number.isFinite(t) ? Math.max(1, Math.min(99, Math.round(t))) : 1;
|
|
226
226
|
return String(i).padStart(2, "0");
|
|
227
227
|
}), Q = (t) => {
|
|
@@ -230,12 +230,12 @@ function he(e) {
|
|
|
230
230
|
t.preventDefault(), t.stopPropagation(), e.onRequestFit(e.itemSnapshot());
|
|
231
231
|
}, et = (t) => {
|
|
232
232
|
t.preventDefault(), t.stopPropagation(), e.onRequestDelete(e.widgetId);
|
|
233
|
-
}, xt =
|
|
233
|
+
}, xt = u(() => {
|
|
234
234
|
const t = {
|
|
235
235
|
"z-index": j() || F() || e.optimisticFront ? `${e.topRenderLayer + 1}` : `${e.renderLayer}`
|
|
236
236
|
};
|
|
237
237
|
if (e.layoutMode === "projected_surface") {
|
|
238
|
-
const i = H()?.rect, o = O(), a = J(), r = a ? i?.screenWidth ??
|
|
238
|
+
const i = H()?.rect, o = O(), a = J(), r = a ? i?.screenWidth ?? w().width * o : w().width, n = a ? i?.screenHeight ?? w().height * o : w().height;
|
|
239
239
|
return {
|
|
240
240
|
...t,
|
|
241
241
|
width: `${r}px`,
|
|
@@ -246,8 +246,8 @@ function he(e) {
|
|
|
246
246
|
}
|
|
247
247
|
return {
|
|
248
248
|
...t,
|
|
249
|
-
width: `${
|
|
250
|
-
height: `${
|
|
249
|
+
width: `${w().width}px`,
|
|
250
|
+
height: `${w().height}px`,
|
|
251
251
|
transform: `translate(${L().x}px, ${L().y}px)`
|
|
252
252
|
};
|
|
253
253
|
});
|
|
@@ -274,8 +274,8 @@ function he(e) {
|
|
|
274
274
|
return;
|
|
275
275
|
W();
|
|
276
276
|
const i = t;
|
|
277
|
-
|
|
278
|
-
|
|
277
|
+
$ = window.setTimeout(() => {
|
|
278
|
+
$ = void 0, x((o) => Math.abs(o.scale - i) < 1e-3 ? {
|
|
279
279
|
enabled: !0,
|
|
280
280
|
scale: i
|
|
281
281
|
} : o);
|
|
@@ -327,7 +327,7 @@ function he(e) {
|
|
|
327
327
|
};
|
|
328
328
|
});
|
|
329
329
|
};
|
|
330
|
-
v =
|
|
330
|
+
v = wt({
|
|
331
331
|
pointerEvent: t,
|
|
332
332
|
captureEl: t.currentTarget,
|
|
333
333
|
onMove: a,
|
|
@@ -372,7 +372,7 @@ function he(e) {
|
|
|
372
372
|
};
|
|
373
373
|
});
|
|
374
374
|
};
|
|
375
|
-
S =
|
|
375
|
+
S = wt({
|
|
376
376
|
pointerEvent: t,
|
|
377
377
|
captureEl: t.currentTarget,
|
|
378
378
|
onMove: a,
|
|
@@ -433,7 +433,7 @@ function he(e) {
|
|
|
433
433
|
})), n.$$click = Q, n.$$pointerdown = (l) => l.stopPropagation(), s(n, h(st, {
|
|
434
434
|
class: "workbench-widget__traffic-icon",
|
|
435
435
|
"aria-hidden": "true"
|
|
436
|
-
})), g.$$click = tt, g.$$pointerdown = (l) => l.stopPropagation(), s(g, h(
|
|
436
|
+
})), g.$$click = tt, g.$$pointerdown = (l) => l.stopPropagation(), s(g, h(ut, {
|
|
437
437
|
class: "workbench-widget__traffic-icon",
|
|
438
438
|
"aria-hidden": "true"
|
|
439
439
|
})), s(f, Mt), V.$$pointerdown = it, s(V, h(Ht, {
|
|
@@ -446,7 +446,7 @@ function he(e) {
|
|
|
446
446
|
}, ot), s(ot, () => e.widgetTitle), A.$$click = Q, A.$$pointerdown = (l) => l.stopPropagation(), s(A, h(st, {
|
|
447
447
|
class: "workbench-widget__window-control-icon",
|
|
448
448
|
"aria-hidden": "true"
|
|
449
|
-
})), R.$$click = tt, R.$$pointerdown = (l) => l.stopPropagation(), s(R, h(
|
|
449
|
+
})), R.$$click = tt, R.$$pointerdown = (l) => l.stopPropagation(), s(R, h(ut, {
|
|
450
450
|
class: "workbench-widget__window-control-icon",
|
|
451
451
|
"aria-hidden": "true"
|
|
452
452
|
})), B.$$click = et, B.$$pointerdown = (l) => l.stopPropagation(), s(B, h(dt, {
|
|
@@ -477,7 +477,7 @@ function he(e) {
|
|
|
477
477
|
get filtered() {
|
|
478
478
|
return e.filtered;
|
|
479
479
|
},
|
|
480
|
-
requestActivate:
|
|
480
|
+
requestActivate: $t
|
|
481
481
|
});
|
|
482
482
|
}), s(i, (() => {
|
|
483
483
|
var l = Xt(() => !!e.locked);
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
export { WorkbenchOverlay, type WorkbenchOverlayProps, } from './WorkbenchOverlay';
|
|
2
|
-
export { WorkbenchSurface, type WorkbenchSurfaceApi, type WorkbenchContextMenuItemsResolver, type WorkbenchSurfaceProps, } from './WorkbenchSurface';
|
|
2
|
+
export { WorkbenchSurface, type WorkbenchSurfaceApi, type WorkbenchCreateAtOptions, type WorkbenchCreateWidgetOptions, type WorkbenchContextMenuItemsResolver, type WorkbenchSurfaceProps, } from './WorkbenchSurface';
|
|
3
3
|
export { WorkbenchContextMenu, type WorkbenchContextMenuItem, type WorkbenchContextMenuProps, } from './WorkbenchContextMenu';
|
|
4
4
|
export { useWorkbenchModel, type UseWorkbenchModelOptions } from './useWorkbenchModel';
|
|
5
5
|
export { WIDGET_REGISTRY, createWorkbenchFilterState, getWidgetEntry, isValidWorkbenchWidgetType, resolveWorkbenchWidgetDefinitions, type WidgetRegistryEntry, } from './widgets/widgetRegistry';
|
|
6
6
|
export * from './types';
|
|
7
7
|
export { sanitizeWorkbenchState, createDefaultWorkbenchState, createWorkbenchId, createWorkbenchProjectedRect, createWorkbenchRenderLayerMap, createWorkbenchViewportCenteredOnWidget, createWorkbenchViewportFitForWidget, createWorkbenchWidgetSurfaceMetrics, resolveWorkbenchProjectedSurfaceScaleBehavior, resolveWorkbenchWidgetRenderMode, type WorkbenchRenderLayerMap, } from './workbenchHelpers';
|
|
8
|
+
export { WORKBENCH_BACKGROUND_MATERIALS, WORKBENCH_DEFAULT_BACKGROUND_MATERIAL, WORKBENCH_DEFAULT_REGION_FILL, WORKBENCH_DEFAULT_STICKY_NOTE_COLOR, WORKBENCH_DEFAULT_TEXT_COLOR, WORKBENCH_DEFAULT_TEXT_FONT, WORKBENCH_REGION_FILL_OPTIONS, WORKBENCH_STICKY_NOTE_COLORS, WORKBENCH_TEXT_COLOR_OPTIONS, WORKBENCH_TEXT_EMOJI_OPTIONS, WORKBENCH_TEXT_FONT_OPTIONS, } from './workbenchOptions';
|
|
8
9
|
export { DEFAULT_WORKBENCH_THEME, WORKBENCH_THEME_IDS, WORKBENCH_THEMES, isWorkbenchThemeId, workbenchThemeMeta, type WorkbenchThemeId, type WorkbenchThemeMeta, type WorkbenchThemePreview, } from './workbenchThemes';
|
|
9
10
|
export { WorkbenchThemeSelector, type WorkbenchThemeSelectorProps, } from './WorkbenchThemeSelector';
|
|
@@ -126,6 +126,78 @@ export interface WorkbenchWidgetItem<TWidgetType extends string = WorkbenchWidge
|
|
|
126
126
|
z_index: number;
|
|
127
127
|
created_at_unix_ms: number;
|
|
128
128
|
}
|
|
129
|
+
export type WorkbenchInteractionMode = 'work' | 'annotation' | 'background';
|
|
130
|
+
export declare const WORKBENCH_STICKY_FILTER_ID = "sticky-note";
|
|
131
|
+
export declare const WORKBENCH_TEXT_FILTER_ID = "text";
|
|
132
|
+
export declare const WORKBENCH_BACKGROUND_REGION_FILTER_ID = "background-region";
|
|
133
|
+
export declare const WORKBENCH_LAYER_COMPONENT_FILTER_IDS: readonly ["sticky-note", "text", "background-region"];
|
|
134
|
+
export type WorkbenchLayerComponentFilterId = typeof WORKBENCH_LAYER_COMPONENT_FILTER_IDS[number];
|
|
135
|
+
export type WorkbenchDockToolId = 'select' | 'text' | 'sticky-note' | 'background-region' | (string & {});
|
|
136
|
+
export type WorkbenchSelection = {
|
|
137
|
+
kind: 'widget';
|
|
138
|
+
id: string;
|
|
139
|
+
} | {
|
|
140
|
+
kind: 'sticky_note';
|
|
141
|
+
id: string;
|
|
142
|
+
} | {
|
|
143
|
+
kind: 'annotation';
|
|
144
|
+
id: string;
|
|
145
|
+
} | {
|
|
146
|
+
kind: 'background_layer';
|
|
147
|
+
id: string;
|
|
148
|
+
};
|
|
149
|
+
export type WorkbenchStickyNoteColor = 'graphite' | 'sage' | 'amber' | 'azure' | 'coral' | 'rose';
|
|
150
|
+
export interface WorkbenchStickyNoteItem {
|
|
151
|
+
id: string;
|
|
152
|
+
kind: 'sticky_note';
|
|
153
|
+
body: string;
|
|
154
|
+
color: WorkbenchStickyNoteColor;
|
|
155
|
+
x: number;
|
|
156
|
+
y: number;
|
|
157
|
+
width: number;
|
|
158
|
+
height: number;
|
|
159
|
+
z_index: number;
|
|
160
|
+
created_at_unix_ms: number;
|
|
161
|
+
updated_at_unix_ms: number;
|
|
162
|
+
}
|
|
163
|
+
export type WorkbenchStickyNotePatch = Partial<Pick<WorkbenchStickyNoteItem, 'body' | 'color'>>;
|
|
164
|
+
export type WorkbenchTextAnnotationAlign = 'left' | 'center' | 'right';
|
|
165
|
+
export interface WorkbenchTextAnnotationItem {
|
|
166
|
+
id: string;
|
|
167
|
+
kind: 'text';
|
|
168
|
+
text: string;
|
|
169
|
+
font_family: string;
|
|
170
|
+
font_size: number;
|
|
171
|
+
font_weight: number;
|
|
172
|
+
color: string;
|
|
173
|
+
align: WorkbenchTextAnnotationAlign;
|
|
174
|
+
x: number;
|
|
175
|
+
y: number;
|
|
176
|
+
width: number;
|
|
177
|
+
height: number;
|
|
178
|
+
z_index: number;
|
|
179
|
+
created_at_unix_ms: number;
|
|
180
|
+
updated_at_unix_ms: number;
|
|
181
|
+
}
|
|
182
|
+
export type WorkbenchTextAnnotationPatch = Partial<Pick<WorkbenchTextAnnotationItem, 'text' | 'font_family' | 'font_size' | 'font_weight' | 'color' | 'align'>>;
|
|
183
|
+
export type WorkbenchTextAnnotationDefaults = Partial<Pick<WorkbenchTextAnnotationItem, 'font_family' | 'font_size' | 'font_weight' | 'color' | 'align' | 'width' | 'height'>>;
|
|
184
|
+
export type WorkbenchAnnotationItem = WorkbenchTextAnnotationItem;
|
|
185
|
+
export type WorkbenchBackgroundMaterial = 'solid' | 'dotted' | 'grid' | 'hatched' | 'glass';
|
|
186
|
+
export interface WorkbenchBackgroundLayer {
|
|
187
|
+
id: string;
|
|
188
|
+
name: string;
|
|
189
|
+
fill: string;
|
|
190
|
+
opacity: number;
|
|
191
|
+
material: WorkbenchBackgroundMaterial;
|
|
192
|
+
x: number;
|
|
193
|
+
y: number;
|
|
194
|
+
width: number;
|
|
195
|
+
height: number;
|
|
196
|
+
z_index: number;
|
|
197
|
+
created_at_unix_ms: number;
|
|
198
|
+
updated_at_unix_ms: number;
|
|
199
|
+
}
|
|
200
|
+
export type WorkbenchBackgroundLayerPatch = Partial<Pick<WorkbenchBackgroundLayer, 'fill' | 'opacity' | 'material' | 'name'>>;
|
|
129
201
|
export interface WorkbenchViewport {
|
|
130
202
|
x: number;
|
|
131
203
|
y: number;
|
|
@@ -136,15 +208,38 @@ export interface WorkbenchState<TWidgetType extends string = WorkbenchWidgetType
|
|
|
136
208
|
widgets: WorkbenchWidgetItem<TWidgetType>[];
|
|
137
209
|
viewport: WorkbenchViewport;
|
|
138
210
|
locked: boolean;
|
|
139
|
-
filters: Record<
|
|
211
|
+
filters: Record<string, boolean>;
|
|
140
212
|
selectedWidgetId: string | null;
|
|
141
213
|
theme: WorkbenchThemeId;
|
|
214
|
+
mode?: WorkbenchInteractionMode;
|
|
215
|
+
activeTool?: WorkbenchDockToolId;
|
|
216
|
+
selectedObject?: WorkbenchSelection | null;
|
|
217
|
+
stickyNotes?: WorkbenchStickyNoteItem[];
|
|
218
|
+
annotations?: WorkbenchAnnotationItem[];
|
|
219
|
+
backgroundLayers?: WorkbenchBackgroundLayer[];
|
|
142
220
|
}
|
|
221
|
+
export type WorkbenchContextMenuTarget = {
|
|
222
|
+
kind: 'canvas';
|
|
223
|
+
mode: WorkbenchInteractionMode;
|
|
224
|
+
} | {
|
|
225
|
+
kind: 'widget';
|
|
226
|
+
id: string;
|
|
227
|
+
} | {
|
|
228
|
+
kind: 'sticky_note';
|
|
229
|
+
id: string;
|
|
230
|
+
} | {
|
|
231
|
+
kind: 'annotation';
|
|
232
|
+
id: string;
|
|
233
|
+
} | {
|
|
234
|
+
kind: 'background_layer';
|
|
235
|
+
id: string;
|
|
236
|
+
};
|
|
143
237
|
export interface WorkbenchContextMenuState {
|
|
144
238
|
clientX: number;
|
|
145
239
|
clientY: number;
|
|
146
240
|
worldX: number;
|
|
147
241
|
worldY: number;
|
|
242
|
+
target?: WorkbenchContextMenuTarget;
|
|
148
243
|
widgetId?: string | null;
|
|
149
244
|
}
|
|
150
245
|
export declare const DEFAULT_WORKBENCH_VIEWPORT: WorkbenchViewport;
|
|
@@ -1,11 +1,19 @@
|
|
|
1
|
-
const
|
|
1
|
+
const t = [
|
|
2
2
|
"terminal",
|
|
3
3
|
"file-browser",
|
|
4
4
|
"system-monitor",
|
|
5
5
|
"log-viewer",
|
|
6
6
|
"code-editor"
|
|
7
|
-
],
|
|
7
|
+
], E = "sticky-note", _ = "text", o = "background-region", R = [
|
|
8
|
+
E,
|
|
9
|
+
_,
|
|
10
|
+
o
|
|
11
|
+
], e = { x: 80, y: 60, scale: 1 };
|
|
8
12
|
export {
|
|
9
|
-
|
|
10
|
-
|
|
13
|
+
e as DEFAULT_WORKBENCH_VIEWPORT,
|
|
14
|
+
o as WORKBENCH_BACKGROUND_REGION_FILTER_ID,
|
|
15
|
+
R as WORKBENCH_LAYER_COMPONENT_FILTER_IDS,
|
|
16
|
+
E as WORKBENCH_STICKY_FILTER_ID,
|
|
17
|
+
_ as WORKBENCH_TEXT_FILTER_ID,
|
|
18
|
+
t as WORKBENCH_WIDGET_TYPES
|
|
11
19
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { InfiniteCanvasContextMenuEvent } from '../../ui';
|
|
2
|
-
import { type WorkbenchWidgetDefinition, type WorkbenchContextMenuState, type WorkbenchState, type WorkbenchViewport, type WorkbenchWidgetItem, type WorkbenchWidgetType } from './types';
|
|
2
|
+
import { type WorkbenchWidgetDefinition, type WorkbenchContextMenuState, type WorkbenchSelection, type WorkbenchState, type WorkbenchAnnotationItem, type WorkbenchBackgroundLayerPatch, type WorkbenchStickyNoteItem, type WorkbenchStickyNotePatch, type WorkbenchViewport, type WorkbenchWidgetItem, type WorkbenchWidgetType, type WorkbenchBackgroundLayer, type WorkbenchDockToolId, type WorkbenchInteractionMode, type WorkbenchTextAnnotationDefaults, type WorkbenchTextAnnotationItem, type WorkbenchTextAnnotationPatch } from './types';
|
|
3
3
|
import type { WorkbenchThemeId } from './workbenchThemes';
|
|
4
4
|
import type { WorkbenchContextMenuItem } from './WorkbenchContextMenu';
|
|
5
5
|
export interface UseWorkbenchModelOptions {
|
|
@@ -7,17 +7,24 @@ export interface UseWorkbenchModelOptions {
|
|
|
7
7
|
setState: (updater: (prev: WorkbenchState) => WorkbenchState) => void;
|
|
8
8
|
onClose: () => void;
|
|
9
9
|
widgetDefinitions?: readonly WorkbenchWidgetDefinition[] | (() => readonly WorkbenchWidgetDefinition[] | undefined);
|
|
10
|
+
textAnnotationDefaults?: WorkbenchTextAnnotationDefaults | (() => WorkbenchTextAnnotationDefaults | undefined);
|
|
10
11
|
}
|
|
11
12
|
export declare function useWorkbenchModel(options: UseWorkbenchModelOptions): {
|
|
12
13
|
widgets: import("solid-js").Accessor<WorkbenchWidgetItem<WorkbenchWidgetType>[]>;
|
|
14
|
+
stickyNotes: import("solid-js").Accessor<WorkbenchStickyNoteItem[]>;
|
|
15
|
+
annotations: import("solid-js").Accessor<WorkbenchTextAnnotationItem[]>;
|
|
16
|
+
backgroundLayers: import("solid-js").Accessor<WorkbenchBackgroundLayer[]>;
|
|
13
17
|
viewport: import("solid-js").Accessor<WorkbenchViewport>;
|
|
14
18
|
canvasFrameSize: import("solid-js").Accessor<{
|
|
15
19
|
width: number;
|
|
16
20
|
height: number;
|
|
17
21
|
}>;
|
|
18
22
|
locked: import("solid-js").Accessor<boolean>;
|
|
19
|
-
filters: import("solid-js").Accessor<Record<
|
|
23
|
+
filters: import("solid-js").Accessor<Record<string, boolean>>;
|
|
20
24
|
selectedWidgetId: import("solid-js").Accessor<string | null>;
|
|
25
|
+
selectedObject: import("solid-js").Accessor<WorkbenchSelection | null>;
|
|
26
|
+
mode: import("solid-js").Accessor<WorkbenchInteractionMode>;
|
|
27
|
+
activeTool: import("solid-js").Accessor<WorkbenchDockToolId>;
|
|
21
28
|
theme: import("solid-js").Accessor<"terminal" | "default" | "aurora" | "vibrancy" | "mica" | "midnight">;
|
|
22
29
|
topZIndex: import("solid-js").Accessor<number>;
|
|
23
30
|
scaleLabel: import("solid-js").Accessor<string>;
|
|
@@ -37,7 +44,14 @@ export declare function useWorkbenchModel(options: UseWorkbenchModelOptions): {
|
|
|
37
44
|
canvas: {
|
|
38
45
|
openCanvasContextMenu: (event: InfiniteCanvasContextMenuEvent) => void;
|
|
39
46
|
openWidgetContextMenu: (event: MouseEvent, item: WorkbenchWidgetItem) => void;
|
|
47
|
+
openStickyNoteContextMenu: (event: MouseEvent, item: WorkbenchStickyNoteItem) => void;
|
|
48
|
+
openAnnotationContextMenu: (event: MouseEvent, item: WorkbenchAnnotationItem) => void;
|
|
49
|
+
openBackgroundLayerContextMenu: (event: MouseEvent, item: WorkbenchBackgroundLayer) => void;
|
|
40
50
|
selectWidget: (widgetId: string) => void;
|
|
51
|
+
selectObject: (selection: WorkbenchSelection | null) => void;
|
|
52
|
+
selectStickyNote: (noteId: string) => void;
|
|
53
|
+
selectAnnotation: (annotationId: string) => void;
|
|
54
|
+
selectBackgroundLayer: (layerId: string) => void;
|
|
41
55
|
clearSelection: () => void;
|
|
42
56
|
startOptimisticFront: (widgetId: string) => void;
|
|
43
57
|
commitFront: (widgetId: string) => void;
|
|
@@ -49,6 +63,31 @@ export declare function useWorkbenchModel(options: UseWorkbenchModelOptions): {
|
|
|
49
63
|
width: number;
|
|
50
64
|
height: number;
|
|
51
65
|
}) => void;
|
|
66
|
+
commitStickyFront: (noteId: string) => void;
|
|
67
|
+
commitStickyMove: (noteId: string, position: {
|
|
68
|
+
x: number;
|
|
69
|
+
y: number;
|
|
70
|
+
}) => void;
|
|
71
|
+
commitStickyResize: (noteId: string, size: {
|
|
72
|
+
width: number;
|
|
73
|
+
height: number;
|
|
74
|
+
}) => void;
|
|
75
|
+
commitAnnotationMove: (annotationId: string, position: {
|
|
76
|
+
x: number;
|
|
77
|
+
y: number;
|
|
78
|
+
}) => void;
|
|
79
|
+
commitAnnotationResize: (annotationId: string, size: {
|
|
80
|
+
width: number;
|
|
81
|
+
height: number;
|
|
82
|
+
}) => void;
|
|
83
|
+
commitBackgroundMove: (layerId: string, position: {
|
|
84
|
+
x: number;
|
|
85
|
+
y: number;
|
|
86
|
+
}) => void;
|
|
87
|
+
commitBackgroundResize: (layerId: string, size: {
|
|
88
|
+
width: number;
|
|
89
|
+
height: number;
|
|
90
|
+
}) => void;
|
|
52
91
|
commitViewport: (next: WorkbenchViewport) => void;
|
|
53
92
|
cancelViewportNavigation: () => void;
|
|
54
93
|
};
|
|
@@ -60,8 +99,8 @@ export declare function useWorkbenchModel(options: UseWorkbenchModelOptions): {
|
|
|
60
99
|
toggle: () => void;
|
|
61
100
|
};
|
|
62
101
|
filter: {
|
|
63
|
-
toggle: (type:
|
|
64
|
-
solo: (type:
|
|
102
|
+
toggle: (type: string) => void;
|
|
103
|
+
solo: (type: string, scope: readonly string[]) => void;
|
|
65
104
|
showAll: () => void;
|
|
66
105
|
};
|
|
67
106
|
navigation: {
|
|
@@ -79,21 +118,40 @@ export declare function useWorkbenchModel(options: UseWorkbenchModelOptions): {
|
|
|
79
118
|
widgetActions: {
|
|
80
119
|
deleteSelected: () => void;
|
|
81
120
|
deleteWidget: (widgetId: string) => void;
|
|
121
|
+
deleteStickyNote: (noteId: string) => void;
|
|
122
|
+
deleteAnnotation: (annotationId: string) => void;
|
|
123
|
+
deleteBackgroundLayer: (layerId: string) => void;
|
|
82
124
|
addWidget: (type: WorkbenchWidgetType, worldX: number, worldY: number) => WorkbenchWidgetItem<WorkbenchWidgetType>;
|
|
83
125
|
addWidgetAtCursor: (type: WorkbenchWidgetType, worldX: number, worldY: number) => WorkbenchWidgetItem<WorkbenchWidgetType>;
|
|
84
126
|
addWidgetCentered: (type: WorkbenchWidgetType, worldX: number, worldY: number) => WorkbenchWidgetItem<WorkbenchWidgetType>;
|
|
127
|
+
addStickyNoteAtCursor: (worldX: number, worldY: number) => WorkbenchStickyNoteItem;
|
|
128
|
+
addTextAnnotationAtCursor: (worldX: number, worldY: number) => WorkbenchTextAnnotationItem;
|
|
129
|
+
duplicateTextAnnotationFrom: (item: WorkbenchTextAnnotationItem) => WorkbenchTextAnnotationItem;
|
|
130
|
+
addBackgroundLayerAtCursor: (worldX: number, worldY: number) => WorkbenchBackgroundLayer;
|
|
131
|
+
duplicateBackgroundLayerFrom: (item: WorkbenchBackgroundLayer) => WorkbenchBackgroundLayer;
|
|
132
|
+
createActiveToolAt: (worldX: number, worldY: number) => WorkbenchStickyNoteItem | WorkbenchTextAnnotationItem | WorkbenchBackgroundLayer | null;
|
|
85
133
|
ensureWidget: (type: WorkbenchWidgetType, ensureOptions?: {
|
|
86
134
|
centerViewport?: boolean;
|
|
87
135
|
worldX?: number;
|
|
88
136
|
worldY?: number;
|
|
89
137
|
}) => WorkbenchWidgetItem<WorkbenchWidgetType>;
|
|
138
|
+
updateStickyNote: (noteId: string, patch: WorkbenchStickyNotePatch) => void;
|
|
139
|
+
updateTextAnnotation: (annotationId: string, patch: WorkbenchTextAnnotationPatch) => void;
|
|
140
|
+
updateBackgroundLayer: (layerId: string, patch: WorkbenchBackgroundLayerPatch) => void;
|
|
90
141
|
};
|
|
91
142
|
queries: {
|
|
92
143
|
findWidgetByType: (type: WorkbenchWidgetType) => WorkbenchWidgetItem<WorkbenchWidgetType> | null;
|
|
93
144
|
findWidgetById: (widgetId: string) => WorkbenchWidgetItem<WorkbenchWidgetType> | null;
|
|
145
|
+
findStickyNoteById: (noteId: string) => WorkbenchStickyNoteItem | null;
|
|
146
|
+
findAnnotationById: (annotationId: string) => WorkbenchTextAnnotationItem | null;
|
|
147
|
+
findBackgroundLayerById: (layerId: string) => WorkbenchBackgroundLayer | null;
|
|
94
148
|
};
|
|
95
149
|
appearance: {
|
|
96
150
|
setTheme: (next: WorkbenchThemeId) => void;
|
|
97
151
|
};
|
|
152
|
+
modes: {
|
|
153
|
+
setMode: (nextMode: WorkbenchInteractionMode) => void;
|
|
154
|
+
setActiveTool: (tool: WorkbenchDockToolId) => void;
|
|
155
|
+
};
|
|
98
156
|
handleCloseRequest: () => void;
|
|
99
157
|
};
|