@floegence/floe-webapp-core 0.36.27 → 0.36.30
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/workbench/WorkbenchContextMenu.js +25 -25
- package/dist/components/workbench/WorkbenchWidget.js +234 -182
- package/dist/components/workbench/index.d.ts +1 -1
- package/dist/components/workbench/types.d.ts +2 -0
- package/dist/components/workbench/useWorkbenchModel.js +131 -115
- package/dist/components/workbench/workbenchHelpers.d.ts +2 -1
- package/dist/components/workbench/workbenchHelpers.js +87 -83
- package/dist/styles.css +1 -1
- package/dist/workbench.css +30 -0
- package/dist/workbench.js +13 -12
- package/package.json +1 -1
|
@@ -5,6 +5,7 @@ export type BuiltinWorkbenchWidgetType = 'terminal' | 'file-browser' | 'system-m
|
|
|
5
5
|
export type WorkbenchWidgetType = BuiltinWorkbenchWidgetType | (string & {});
|
|
6
6
|
export declare const WORKBENCH_WIDGET_TYPES: readonly WorkbenchWidgetType[];
|
|
7
7
|
export type WorkbenchWidgetRenderMode = 'canvas_scaled' | 'projected_surface';
|
|
8
|
+
export type WorkbenchProjectedSurfaceScaleBehavior = 'stable_transform' | 'settle_sharp_zoom';
|
|
8
9
|
export type WorkbenchCanvasOwnerReason = 'initial' | 'background_pointer' | 'background_focus' | 'selection_cleared' | (string & {});
|
|
9
10
|
export type WorkbenchWidgetOwnerReason = 'pointer' | 'focus' | 'activation' | (string & {});
|
|
10
11
|
export type WorkbenchInputOwner = {
|
|
@@ -112,6 +113,7 @@ export interface WorkbenchWidgetDefinition<TWidgetType extends string = Workbenc
|
|
|
112
113
|
group?: string;
|
|
113
114
|
singleton?: boolean;
|
|
114
115
|
renderMode?: WorkbenchWidgetRenderMode;
|
|
116
|
+
projectedSurfaceScaleBehavior?: WorkbenchProjectedSurfaceScaleBehavior;
|
|
115
117
|
}
|
|
116
118
|
export interface WorkbenchWidgetItem<TWidgetType extends string = WorkbenchWidgetType> {
|
|
117
119
|
id: string;
|
|
@@ -1,50 +1,74 @@
|
|
|
1
|
-
import { createSignal as
|
|
2
|
-
import { ArrowUp as
|
|
3
|
-
import { getTopZIndex as
|
|
4
|
-
import { resolveWorkbenchWidgetDefinitions as
|
|
1
|
+
import { createSignal as A, createMemo as r, onCleanup as Ct } from "solid-js";
|
|
2
|
+
import { ArrowUp as bt, Copy as kt, Trash as Ft } from "../icons/index.js";
|
|
3
|
+
import { getTopZIndex as It, createContextMenuPosition as Mt, createWorkbenchId as vt, createWorkbenchViewportCenteredOnWidget as K, findNearestWidget as Xt, clampScale as Yt, WORKBENCH_CANVAS_ZOOM_STEP as L, WORKBENCH_MIN_SCALE as yt, createWorkbenchViewportFitForWidget as Ot, WORKBENCH_CONTEXT_MENU_WIDTH_PX as _t, estimateContextMenuHeight as zt } from "./workbenchHelpers.js";
|
|
4
|
+
import { resolveWorkbenchWidgetDefinitions as Tt, getWidgetEntry as j, createWorkbenchFilterState as Vt } from "./widgets/widgetRegistry.js";
|
|
5
5
|
function Kt(c) {
|
|
6
|
-
const [
|
|
7
|
-
let d = null,
|
|
8
|
-
const l = c.state, m = r(() => l().widgets),
|
|
9
|
-
() =>
|
|
10
|
-
),
|
|
6
|
+
const [x, S] = A(null), [U, N] = A(null), [D, G] = A({ width: 0, height: 0 });
|
|
7
|
+
let d = null, p = null;
|
|
8
|
+
const l = c.state, m = r(() => l().widgets), h = r(() => l().viewport), J = r(() => l().locked), H = r(() => l().filters), F = r(() => l().selectedWidgetId), Q = r(() => l().theme), I = r(() => It(m())), tt = r(() => `${Math.round(h().scale * 100)}%`), et = () => typeof c.widgetDefinitions == "function" ? c.widgetDefinitions() : c.widgetDefinitions, w = r(
|
|
9
|
+
() => Tt(et())
|
|
10
|
+
), M = (t, e) => {
|
|
11
11
|
const n = Number.isFinite(t) && t > 0 ? t : 0, i = Number.isFinite(e) && e > 0 ? e : 0, o = { width: n, height: i }, s = D();
|
|
12
12
|
return s.width === n && s.height === i ? s : (G(o), o);
|
|
13
13
|
}, R = () => {
|
|
14
|
-
|
|
15
|
-
}, a = () => d ?
|
|
14
|
+
p?.disconnect(), p = null;
|
|
15
|
+
}, a = () => d ? M(d.clientWidth, d.clientHeight) : M(0, 0), nt = (t) => {
|
|
16
16
|
if (d === (t ?? null)) {
|
|
17
17
|
a();
|
|
18
18
|
return;
|
|
19
19
|
}
|
|
20
|
-
R(), d = t ?? null, a(), !(!d || typeof ResizeObserver > "u") && (
|
|
20
|
+
R(), d = t ?? null, a(), !(!d || typeof ResizeObserver > "u") && (p = new ResizeObserver((e) => {
|
|
21
21
|
const n = e[0];
|
|
22
|
-
|
|
22
|
+
M(
|
|
23
23
|
n?.contentRect.width ?? d?.clientWidth ?? 0,
|
|
24
24
|
n?.contentRect.height ?? d?.clientHeight ?? 0
|
|
25
25
|
);
|
|
26
|
-
}),
|
|
26
|
+
}), p.observe(d));
|
|
27
27
|
};
|
|
28
28
|
Ct(() => {
|
|
29
29
|
R(), d = null;
|
|
30
30
|
});
|
|
31
31
|
const it = (t) => {
|
|
32
|
-
|
|
32
|
+
S({
|
|
33
33
|
clientX: t.clientX,
|
|
34
34
|
clientY: t.clientY,
|
|
35
35
|
worldX: t.worldX,
|
|
36
36
|
worldY: t.worldY
|
|
37
37
|
});
|
|
38
38
|
}, ot = (t, e) => {
|
|
39
|
-
f(e.id),
|
|
39
|
+
f(e.id), S({
|
|
40
40
|
clientX: t.clientX,
|
|
41
41
|
clientY: t.clientY,
|
|
42
42
|
worldX: e.x,
|
|
43
43
|
worldY: e.y,
|
|
44
44
|
widgetId: e.id
|
|
45
45
|
});
|
|
46
|
-
},
|
|
47
|
-
const
|
|
46
|
+
}, g = () => S(null), ct = (t) => l().widgets.find((e) => e.id === t) ?? null, C = (t) => l().widgets.find((e) => e.type === t) ?? null, st = (t, e) => {
|
|
47
|
+
const n = t.singleton ? C(t.type) : null;
|
|
48
|
+
return n ? {
|
|
49
|
+
id: `goto-${t.type}`,
|
|
50
|
+
kind: "action",
|
|
51
|
+
verb: "go_to",
|
|
52
|
+
widgetType: t.type,
|
|
53
|
+
label: `Go to ${t.label}`,
|
|
54
|
+
icon: t.icon,
|
|
55
|
+
existingWidgetId: n.id,
|
|
56
|
+
onSelect: () => {
|
|
57
|
+
W(n, { centerViewport: !0 }), g();
|
|
58
|
+
}
|
|
59
|
+
} : {
|
|
60
|
+
id: `add-${t.type}`,
|
|
61
|
+
kind: "action",
|
|
62
|
+
verb: "add",
|
|
63
|
+
widgetType: t.type,
|
|
64
|
+
label: `Add ${t.label}`,
|
|
65
|
+
icon: t.icon,
|
|
66
|
+
onSelect: () => {
|
|
67
|
+
X(t.type, e.worldX, e.worldY), g();
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
}, E = r(() => {
|
|
71
|
+
const t = x();
|
|
48
72
|
if (!t) return [];
|
|
49
73
|
if (t.widgetId) {
|
|
50
74
|
const e = m().find((i) => i.id === t.widgetId), n = [];
|
|
@@ -52,9 +76,9 @@ function Kt(c) {
|
|
|
52
76
|
id: "bring-to-front",
|
|
53
77
|
kind: "action",
|
|
54
78
|
label: "Bring to Front",
|
|
55
|
-
icon:
|
|
79
|
+
icon: bt,
|
|
56
80
|
onSelect: () => {
|
|
57
|
-
f(e.id),
|
|
81
|
+
f(e.id), g();
|
|
58
82
|
}
|
|
59
83
|
}), n.push({
|
|
60
84
|
id: "duplicate",
|
|
@@ -62,7 +86,7 @@ function Kt(c) {
|
|
|
62
86
|
label: "Duplicate",
|
|
63
87
|
icon: kt,
|
|
64
88
|
onSelect: () => {
|
|
65
|
-
B(e.type, e.x + 32, e.y + 32),
|
|
89
|
+
B(e.type, e.x + 32, e.y + 32), g();
|
|
66
90
|
}
|
|
67
91
|
})), n.push({ id: "separator-delete", kind: "separator" }), n.push({
|
|
68
92
|
id: "delete",
|
|
@@ -71,185 +95,177 @@ function Kt(c) {
|
|
|
71
95
|
icon: Ft,
|
|
72
96
|
destructive: !0,
|
|
73
97
|
onSelect: () => {
|
|
74
|
-
t.widgetId &&
|
|
98
|
+
t.widgetId && Y(t.widgetId), g();
|
|
75
99
|
}
|
|
76
100
|
}), n;
|
|
77
101
|
}
|
|
78
|
-
return w().map((e) => (
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
label: `Add ${e.label}`,
|
|
82
|
-
icon: e.icon,
|
|
83
|
-
onSelect: () => {
|
|
84
|
-
v(e.type, t.worldX, t.worldY), h();
|
|
85
|
-
}
|
|
86
|
-
}));
|
|
87
|
-
}), st = r(() => {
|
|
88
|
-
const t = W();
|
|
102
|
+
return w().map((e) => st(e, t));
|
|
103
|
+
}), rt = r(() => {
|
|
104
|
+
const t = x();
|
|
89
105
|
if (!t) return;
|
|
90
106
|
const e = E(), n = e.filter((o) => o.kind === "action").length, i = e.filter((o) => o.kind === "separator").length;
|
|
91
|
-
return
|
|
107
|
+
return Mt({
|
|
92
108
|
clientX: t.clientX,
|
|
93
109
|
clientY: t.clientY,
|
|
94
|
-
menuWidth:
|
|
110
|
+
menuWidth: _t,
|
|
95
111
|
menuHeight: zt(n, i)
|
|
96
112
|
});
|
|
97
|
-
}),
|
|
98
|
-
const i = j(t, w()), o = i.singleton ?
|
|
113
|
+
}), v = (t, e, n) => {
|
|
114
|
+
const i = j(t, w()), o = i.singleton ? C(t) : null;
|
|
99
115
|
if (o)
|
|
100
|
-
return
|
|
101
|
-
const s = i.defaultSize,
|
|
102
|
-
id:
|
|
116
|
+
return W(o, { centerViewport: !0 });
|
|
117
|
+
const s = i.defaultSize, u = {
|
|
118
|
+
id: vt(),
|
|
103
119
|
type: t,
|
|
104
120
|
title: i.defaultTitle,
|
|
105
121
|
x: e,
|
|
106
122
|
y: n,
|
|
107
123
|
width: s.width,
|
|
108
124
|
height: s.height,
|
|
109
|
-
z_index:
|
|
125
|
+
z_index: I() + 1,
|
|
110
126
|
created_at_unix_ms: Date.now()
|
|
111
127
|
};
|
|
112
128
|
return c.setState((k) => ({
|
|
113
129
|
...k,
|
|
114
|
-
widgets: [...k.widgets,
|
|
115
|
-
selectedWidgetId:
|
|
116
|
-
})),
|
|
117
|
-
},
|
|
130
|
+
widgets: [...k.widgets, u],
|
|
131
|
+
selectedWidgetId: u.id
|
|
132
|
+
})), u;
|
|
133
|
+
}, X = (t, e, n) => {
|
|
118
134
|
const i = j(t, w()).defaultSize;
|
|
119
|
-
return
|
|
120
|
-
}, B = (t, e, n) =>
|
|
135
|
+
return v(t, e - i.width / 2, n - i.height / 2);
|
|
136
|
+
}, B = (t, e, n) => v(t, e, n), Y = (t) => {
|
|
121
137
|
c.setState((e) => ({
|
|
122
138
|
...e,
|
|
123
139
|
widgets: e.widgets.filter((n) => n.id !== t),
|
|
124
140
|
selectedWidgetId: e.selectedWidgetId === t ? null : e.selectedWidgetId
|
|
125
141
|
}));
|
|
126
|
-
},
|
|
127
|
-
|
|
142
|
+
}, dt = (t) => {
|
|
143
|
+
N(t);
|
|
128
144
|
}, f = (t) => {
|
|
129
|
-
|
|
130
|
-
const e =
|
|
145
|
+
N(t);
|
|
146
|
+
const e = I(), n = m().find((i) => i.id === t);
|
|
131
147
|
n && n.z_index < e && c.setState((i) => ({
|
|
132
148
|
...i,
|
|
133
149
|
widgets: i.widgets.map(
|
|
134
150
|
(o) => o.id === t ? { ...o, z_index: e + 1 } : o
|
|
135
151
|
)
|
|
136
152
|
}));
|
|
137
|
-
},
|
|
153
|
+
}, lt = (t, e) => {
|
|
138
154
|
c.setState((n) => ({
|
|
139
155
|
...n,
|
|
140
156
|
widgets: n.widgets.map(
|
|
141
157
|
(i) => i.id === t ? { ...i, x: e.x, y: e.y } : i
|
|
142
158
|
)
|
|
143
159
|
}));
|
|
144
|
-
},
|
|
160
|
+
}, at = (t, e) => {
|
|
145
161
|
c.setState((n) => ({
|
|
146
162
|
...n,
|
|
147
163
|
widgets: n.widgets.map(
|
|
148
164
|
(i) => i.id === t ? { ...i, width: e.width, height: e.height } : i
|
|
149
165
|
)
|
|
150
166
|
}));
|
|
151
|
-
},
|
|
167
|
+
}, y = (t) => {
|
|
152
168
|
c.setState((e) => ({ ...e, viewport: t }));
|
|
153
169
|
}, q = (t) => {
|
|
154
|
-
const e =
|
|
155
|
-
t === "in" ? e.scale *
|
|
156
|
-
),
|
|
170
|
+
const e = h(), n = a(), i = (n.width / 2 - e.x) / e.scale, o = (n.height / 2 - e.y) / e.scale, s = Yt(
|
|
171
|
+
t === "in" ? e.scale * L : e.scale / L
|
|
172
|
+
), u = {
|
|
157
173
|
x: n.width / 2 - i * s,
|
|
158
174
|
y: n.height / 2 - o * s,
|
|
159
175
|
scale: s
|
|
160
176
|
};
|
|
161
|
-
|
|
162
|
-
},
|
|
177
|
+
y(u);
|
|
178
|
+
}, gt = () => {
|
|
163
179
|
c.setState((t) => ({ ...t, locked: !t.locked }));
|
|
164
|
-
},
|
|
180
|
+
}, ut = (t) => {
|
|
165
181
|
c.setState((e) => ({
|
|
166
182
|
...e,
|
|
167
183
|
filters: { ...e.filters, [t]: !e.filters[t] }
|
|
168
184
|
}));
|
|
169
|
-
},
|
|
185
|
+
}, ht = (t) => {
|
|
170
186
|
c.setState((e) => {
|
|
171
187
|
const n = { ...e.filters };
|
|
172
188
|
for (const i of Object.keys(n))
|
|
173
189
|
n[i] = i === t;
|
|
174
190
|
return { ...e, filters: n };
|
|
175
191
|
});
|
|
176
|
-
},
|
|
192
|
+
}, ft = () => {
|
|
177
193
|
const t = Vt(w());
|
|
178
194
|
c.setState((e) => ({
|
|
179
195
|
...e,
|
|
180
196
|
filters: t
|
|
181
197
|
}));
|
|
182
|
-
},
|
|
198
|
+
}, b = (t) => {
|
|
183
199
|
c.setState((e) => ({ ...e, selectedWidgetId: t }));
|
|
184
200
|
}, P = () => {
|
|
185
201
|
c.setState(
|
|
186
202
|
(t) => t.selectedWidgetId === null ? t : { ...t, selectedWidgetId: null }
|
|
187
203
|
);
|
|
188
|
-
},
|
|
189
|
-
const t = a(), e =
|
|
204
|
+
}, mt = () => {
|
|
205
|
+
const t = a(), e = h();
|
|
190
206
|
return {
|
|
191
207
|
worldX: t.width > 0 ? (t.width / 2 - e.x) / e.scale : 240,
|
|
192
208
|
worldY: t.height > 0 ? (t.height / 2 - e.y) / e.scale : 180
|
|
193
209
|
};
|
|
194
210
|
};
|
|
195
211
|
let O = 0;
|
|
196
|
-
const
|
|
212
|
+
const wt = () => {
|
|
197
213
|
O += 1;
|
|
198
|
-
},
|
|
199
|
-
const e =
|
|
214
|
+
}, _ = (t) => {
|
|
215
|
+
const e = h(), n = e.x, i = e.y, o = e.scale, s = performance.now(), u = 360, k = ++O, St = (T) => 1 - Math.pow(1 - T, 3), $ = (T) => {
|
|
200
216
|
if (k !== O) return;
|
|
201
|
-
const
|
|
202
|
-
|
|
203
|
-
x: n + (t.x - n) *
|
|
204
|
-
y: i + (t.y - i) *
|
|
205
|
-
scale: o + (t.scale - o) *
|
|
206
|
-
}),
|
|
217
|
+
const pt = T - s, Z = Math.min(Math.max(pt / u, 0), 1), V = St(Z);
|
|
218
|
+
y({
|
|
219
|
+
x: n + (t.x - n) * V,
|
|
220
|
+
y: i + (t.y - i) * V,
|
|
221
|
+
scale: o + (t.scale - o) * V
|
|
222
|
+
}), Z < 1 && requestAnimationFrame($);
|
|
207
223
|
};
|
|
208
|
-
requestAnimationFrame(
|
|
209
|
-
},
|
|
224
|
+
requestAnimationFrame($);
|
|
225
|
+
}, z = (t) => {
|
|
210
226
|
const e = a();
|
|
211
|
-
e.width === 0 || e.height === 0 ||
|
|
227
|
+
e.width === 0 || e.height === 0 || _(K({
|
|
212
228
|
widget: t,
|
|
213
|
-
scale:
|
|
229
|
+
scale: h().scale,
|
|
214
230
|
frameWidth: e.width,
|
|
215
231
|
frameHeight: e.height
|
|
216
232
|
}));
|
|
217
|
-
},
|
|
233
|
+
}, Wt = (t) => {
|
|
218
234
|
const e = a();
|
|
219
|
-
e.width === 0 || e.height === 0 ||
|
|
235
|
+
e.width === 0 || e.height === 0 || _(Ot({
|
|
220
236
|
widget: t,
|
|
221
237
|
frameWidth: e.width,
|
|
222
238
|
frameHeight: e.height
|
|
223
239
|
}));
|
|
224
|
-
},
|
|
240
|
+
}, xt = (t) => {
|
|
225
241
|
const e = a();
|
|
226
|
-
e.width === 0 || e.height === 0 ||
|
|
242
|
+
e.width === 0 || e.height === 0 || _(K({
|
|
227
243
|
widget: t,
|
|
228
244
|
scale: yt,
|
|
229
245
|
frameWidth: e.width,
|
|
230
246
|
frameHeight: e.height
|
|
231
247
|
}));
|
|
232
|
-
},
|
|
248
|
+
}, W = (t, e = {}) => (b(t.id), f(t.id), e.centerViewport !== !1 && z(t), t);
|
|
233
249
|
return {
|
|
234
250
|
widgets: m,
|
|
235
|
-
viewport:
|
|
251
|
+
viewport: h,
|
|
236
252
|
canvasFrameSize: D,
|
|
237
253
|
locked: J,
|
|
238
254
|
filters: H,
|
|
239
255
|
selectedWidgetId: F,
|
|
240
256
|
theme: Q,
|
|
241
|
-
topZIndex:
|
|
257
|
+
topZIndex: I,
|
|
242
258
|
scaleLabel: tt,
|
|
243
259
|
optimisticFrontWidgetId: U,
|
|
244
260
|
widgetDefinitions: w,
|
|
245
261
|
setCanvasFrameRef: nt,
|
|
246
262
|
contextMenu: {
|
|
247
|
-
state:
|
|
263
|
+
state: x,
|
|
248
264
|
items: E,
|
|
249
|
-
position:
|
|
250
|
-
close:
|
|
265
|
+
position: rt,
|
|
266
|
+
close: g,
|
|
251
267
|
retarget: (t) => {
|
|
252
|
-
t.preventDefault(), t.stopPropagation(),
|
|
268
|
+
t.preventDefault(), t.stopPropagation(), S({
|
|
253
269
|
clientX: t.clientX,
|
|
254
270
|
clientY: t.clientY,
|
|
255
271
|
worldX: 0,
|
|
@@ -260,26 +276,26 @@ function Kt(c) {
|
|
|
260
276
|
canvas: {
|
|
261
277
|
openCanvasContextMenu: it,
|
|
262
278
|
openWidgetContextMenu: ot,
|
|
263
|
-
selectWidget:
|
|
279
|
+
selectWidget: b,
|
|
264
280
|
clearSelection: P,
|
|
265
|
-
startOptimisticFront:
|
|
281
|
+
startOptimisticFront: dt,
|
|
266
282
|
commitFront: f,
|
|
267
|
-
commitMove:
|
|
268
|
-
commitResize:
|
|
269
|
-
commitViewport:
|
|
270
|
-
cancelViewportNavigation:
|
|
283
|
+
commitMove: lt,
|
|
284
|
+
commitResize: at,
|
|
285
|
+
commitViewport: y,
|
|
286
|
+
cancelViewportNavigation: wt
|
|
271
287
|
},
|
|
272
288
|
hud: {
|
|
273
289
|
zoomIn: () => q("in"),
|
|
274
290
|
zoomOut: () => q("out")
|
|
275
291
|
},
|
|
276
292
|
lock: {
|
|
277
|
-
toggle:
|
|
293
|
+
toggle: gt
|
|
278
294
|
},
|
|
279
295
|
filter: {
|
|
280
|
-
toggle:
|
|
281
|
-
solo:
|
|
282
|
-
showAll:
|
|
296
|
+
toggle: ut,
|
|
297
|
+
solo: ht,
|
|
298
|
+
showAll: ft
|
|
283
299
|
},
|
|
284
300
|
navigation: {
|
|
285
301
|
handleArrowNavigation: (t) => {
|
|
@@ -289,12 +305,12 @@ function Kt(c) {
|
|
|
289
305
|
t,
|
|
290
306
|
H()
|
|
291
307
|
);
|
|
292
|
-
e &&
|
|
308
|
+
e && W(e);
|
|
293
309
|
},
|
|
294
|
-
centerOnWidget:
|
|
295
|
-
focusWidget:
|
|
296
|
-
fitWidget: (t) => (
|
|
297
|
-
overviewWidget: (t) => (
|
|
310
|
+
centerOnWidget: z,
|
|
311
|
+
focusWidget: W,
|
|
312
|
+
fitWidget: (t) => (b(t.id), f(t.id), Wt(t), t),
|
|
313
|
+
overviewWidget: (t) => (b(t.id), f(t.id), xt(t), t)
|
|
298
314
|
},
|
|
299
315
|
selection: {
|
|
300
316
|
clear: P
|
|
@@ -302,26 +318,26 @@ function Kt(c) {
|
|
|
302
318
|
widgetActions: {
|
|
303
319
|
deleteSelected: () => {
|
|
304
320
|
const t = F();
|
|
305
|
-
t &&
|
|
321
|
+
t && Y(t);
|
|
306
322
|
},
|
|
307
|
-
deleteWidget:
|
|
308
|
-
addWidget:
|
|
309
|
-
addWidgetAtCursor:
|
|
323
|
+
deleteWidget: Y,
|
|
324
|
+
addWidget: v,
|
|
325
|
+
addWidgetAtCursor: X,
|
|
310
326
|
addWidgetCentered: B,
|
|
311
327
|
ensureWidget: (t, e) => {
|
|
312
|
-
const n =
|
|
328
|
+
const n = C(t);
|
|
313
329
|
if (n)
|
|
314
|
-
return
|
|
315
|
-
const i =
|
|
330
|
+
return W(n, { centerViewport: e?.centerViewport ?? !0 });
|
|
331
|
+
const i = mt(), o = X(
|
|
316
332
|
t,
|
|
317
333
|
e?.worldX ?? i.worldX,
|
|
318
334
|
e?.worldY ?? i.worldY
|
|
319
335
|
);
|
|
320
|
-
return (e?.centerViewport ?? !0) && o &&
|
|
336
|
+
return (e?.centerViewport ?? !0) && o && z(o), o;
|
|
321
337
|
}
|
|
322
338
|
},
|
|
323
339
|
queries: {
|
|
324
|
-
findWidgetByType:
|
|
340
|
+
findWidgetByType: C,
|
|
325
341
|
findWidgetById: ct
|
|
326
342
|
},
|
|
327
343
|
appearance: {
|
|
@@ -330,8 +346,8 @@ function Kt(c) {
|
|
|
330
346
|
}
|
|
331
347
|
},
|
|
332
348
|
handleCloseRequest: () => {
|
|
333
|
-
if (
|
|
334
|
-
|
|
349
|
+
if (x()) {
|
|
350
|
+
g();
|
|
335
351
|
return;
|
|
336
352
|
}
|
|
337
353
|
c.onClose();
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { 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, type WorkbenchWidgetType } from './types';
|
|
2
2
|
export declare function createWorkbenchId(): string;
|
|
3
3
|
export declare function resolveWorkbenchWidgetRenderMode(definition: WorkbenchWidgetDefinition): WorkbenchWidgetRenderMode;
|
|
4
|
+
export declare function resolveWorkbenchProjectedSurfaceScaleBehavior(definition: WorkbenchWidgetDefinition): WorkbenchProjectedSurfaceScaleBehavior;
|
|
4
5
|
export interface CreateWorkbenchProjectedRectInput {
|
|
5
6
|
widgetId: string;
|
|
6
7
|
worldX: number;
|