@cratis/scene 0.223.0 → 0.223.1
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/PrototypeComponentRegistry.d.ts +1 -1
- package/dist/Prototypes/index.d.ts +1 -1
- package/dist/Prototypes/index.js +176 -129
- package/dist/Prototypes/{Editor/editorTypes.d.ts → prototypeTypes.d.ts} +3 -3
- package/dist/scene.css +1 -1
- package/package.json +1 -12
- package/dist/Prototypes/Editor/PrototypeOverlayFrame.d.ts +0 -23
- package/dist/Prototypes/Editor/fitOverlay.d.ts +0 -14
- package/dist/Prototypes/Editor/layoutContainers/LayoutArrangement.d.ts +0 -8
- package/dist/Prototypes/Editor/layoutContainers/LayoutContainerDescriptor.d.ts +0 -10
- package/dist/Prototypes/Editor/layoutContainers/LayoutContainerSurface.d.ts +0 -7
- package/dist/Prototypes/Editor/layoutContainers/arrangementStyle.d.ts +0 -4
- package/dist/Prototypes/Editor/layoutContainers/createLayoutContainerComponent.d.ts +0 -5
- package/dist/Prototypes/Editor/layoutContainers/index.d.ts +0 -5
- package/dist/Prototypes/Editor/layoutContainers/registerLayoutContainers.d.ts +0 -3
- package/dist/ScreenEditor/index.d.ts +0 -2
- package/dist/ScreenEditor/index.js +0 -235
- package/dist/renderPrototypeElement-Xm7OIVPs.js +0 -58
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { UIElement } from './UIElement';
|
|
2
2
|
import type { ComponentState, IComponent, PrototypeComponentConstructor } from './IComponent';
|
|
3
|
-
import type { PrototypeSurfaceElement } from './Prototypes/
|
|
3
|
+
import type { PrototypeSurfaceElement } from './Prototypes/prototypeTypes';
|
|
4
4
|
declare global {
|
|
5
5
|
interface Window {
|
|
6
6
|
__cratisPrototypeComponents?: Record<string, Record<string, PrototypeComponentConstructor>>;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export * from './Rendering';
|
|
2
|
-
export * from './
|
|
2
|
+
export * from './prototypeTypes';
|
package/dist/Prototypes/index.js
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import { c as
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
var L = {
|
|
1
|
+
import { c as L, f as h, k as ft } from "../Scene-DaQtzf1e.js";
|
|
2
|
+
import { createContext as U, useContext as S, useEffect as j } from "react";
|
|
3
|
+
import { Fragment as D, jsx as a, jsxs as T } from "react/jsx-runtime";
|
|
4
|
+
import { createPortal as V } from "react-dom";
|
|
5
|
+
var R = {
|
|
7
6
|
prototypeThumbnail: {
|
|
8
7
|
openEditor: "Open prototype editor",
|
|
9
8
|
windowTitle: "Prototype",
|
|
@@ -13,26 +12,26 @@ var L = {
|
|
|
13
12
|
title: "Prototype preview",
|
|
14
13
|
close: "Close preview"
|
|
15
14
|
}
|
|
16
|
-
},
|
|
17
|
-
value:
|
|
18
|
-
children:
|
|
19
|
-
}),
|
|
15
|
+
}, k = U(R), F = () => S(k), Tt = ({ messages: e, children: t }) => /* @__PURE__ */ a(k.Provider, {
|
|
16
|
+
value: e,
|
|
17
|
+
children: t
|
|
18
|
+
}), q = [
|
|
20
19
|
"#f66",
|
|
21
20
|
"#fa0",
|
|
22
21
|
"#3c3"
|
|
23
|
-
],
|
|
22
|
+
], J = ({ size: e }) => /* @__PURE__ */ a(D, { children: q.map((t, o) => /* @__PURE__ */ a("div", {
|
|
24
23
|
className: "prototype-window-traffic-light",
|
|
25
24
|
style: {
|
|
26
|
-
border: `${
|
|
27
|
-
...
|
|
28
|
-
width:
|
|
29
|
-
height:
|
|
25
|
+
border: `${e ? Math.max(1, e / 8) : 1.5}px solid ${t}`,
|
|
26
|
+
...e ? {
|
|
27
|
+
width: e,
|
|
28
|
+
height: e
|
|
30
29
|
} : {}
|
|
31
30
|
}
|
|
32
|
-
},
|
|
31
|
+
}, o)) }), M = 16, K = 8, Q = {
|
|
33
32
|
width: 180,
|
|
34
33
|
height: 36
|
|
35
|
-
},
|
|
34
|
+
}, X = {
|
|
36
35
|
dataTable: {
|
|
37
36
|
width: 360,
|
|
38
37
|
height: 120
|
|
@@ -49,32 +48,68 @@ var L = {
|
|
|
49
48
|
width: 300,
|
|
50
49
|
height: 150
|
|
51
50
|
}
|
|
52
|
-
},
|
|
53
|
-
function
|
|
54
|
-
let
|
|
55
|
-
return
|
|
56
|
-
if (!
|
|
57
|
-
position:
|
|
58
|
-
size:
|
|
51
|
+
}, Y = (e) => !(e.width > 0) || !(e.height > 0);
|
|
52
|
+
function Z(e, t) {
|
|
53
|
+
let o = M;
|
|
54
|
+
return e.map((r) => {
|
|
55
|
+
if (!r.native || !Y(r.size)) return {
|
|
56
|
+
position: r.position,
|
|
57
|
+
size: r.size
|
|
59
58
|
};
|
|
60
|
-
const
|
|
61
|
-
if (!
|
|
62
|
-
position:
|
|
63
|
-
size:
|
|
59
|
+
const i = X[r.name] ?? Q;
|
|
60
|
+
if (!t) return {
|
|
61
|
+
position: r.position,
|
|
62
|
+
size: i
|
|
64
63
|
};
|
|
65
64
|
const s = {
|
|
66
|
-
x:
|
|
67
|
-
y:
|
|
65
|
+
x: M,
|
|
66
|
+
y: o
|
|
68
67
|
};
|
|
69
|
-
return
|
|
68
|
+
return o += i.height + K, {
|
|
70
69
|
position: s,
|
|
71
|
-
size:
|
|
70
|
+
size: i
|
|
72
71
|
};
|
|
73
72
|
});
|
|
74
73
|
}
|
|
75
|
-
var
|
|
76
|
-
|
|
77
|
-
|
|
74
|
+
var z = (e) => {
|
|
75
|
+
const t = e;
|
|
76
|
+
if (t.position && typeof t.position.x == "number") return {
|
|
77
|
+
x: t.position.x,
|
|
78
|
+
y: t.position.y ?? 0
|
|
79
|
+
};
|
|
80
|
+
const o = t.properties?.canvas ?? {};
|
|
81
|
+
return {
|
|
82
|
+
x: o.x ?? 0,
|
|
83
|
+
y: o.y ?? 0
|
|
84
|
+
};
|
|
85
|
+
}, tt = (e) => {
|
|
86
|
+
const t = e;
|
|
87
|
+
return t.size && typeof t.size.width == "number" ? {
|
|
88
|
+
width: t.size.width,
|
|
89
|
+
height: t.size.height ?? 0
|
|
90
|
+
} : {
|
|
91
|
+
width: t.width ?? 0,
|
|
92
|
+
height: t.height ?? 0
|
|
93
|
+
};
|
|
94
|
+
}, E = (e) => {
|
|
95
|
+
const t = e;
|
|
96
|
+
if (typeof t.componentName != "string" || t.componentName.includes(".")) return;
|
|
97
|
+
const o = t.properties && typeof t.properties == "object" ? t.properties : {}, r = [
|
|
98
|
+
o.label,
|
|
99
|
+
o.text,
|
|
100
|
+
o.title,
|
|
101
|
+
t.componentName
|
|
102
|
+
].find((i) => typeof i == "string" && i.length > 0);
|
|
103
|
+
return typeof r == "string" ? {
|
|
104
|
+
type: t.componentName,
|
|
105
|
+
label: r
|
|
106
|
+
} : void 0;
|
|
107
|
+
}, W = (e) => {
|
|
108
|
+
const t = e, o = [t.name, t.componentName].find((r) => typeof r == "string" && r.length > 0);
|
|
109
|
+
return typeof o == "string" ? o : "";
|
|
110
|
+
}, et = (e) => {
|
|
111
|
+
switch (e) {
|
|
112
|
+
case h.flexRow:
|
|
78
113
|
return {
|
|
79
114
|
display: "flex",
|
|
80
115
|
flexDirection: "row",
|
|
@@ -83,14 +118,14 @@ var tt = (t) => {
|
|
|
83
118
|
padding: 12,
|
|
84
119
|
alignContent: "flex-start"
|
|
85
120
|
};
|
|
86
|
-
case
|
|
121
|
+
case h.flexColumn:
|
|
87
122
|
return {
|
|
88
123
|
display: "flex",
|
|
89
124
|
flexDirection: "column",
|
|
90
125
|
gap: 12,
|
|
91
126
|
padding: 12
|
|
92
127
|
};
|
|
93
|
-
case
|
|
128
|
+
case h.grid:
|
|
94
129
|
return {
|
|
95
130
|
display: "grid",
|
|
96
131
|
gridTemplateColumns: "repeat(auto-fill, minmax(180px, 1fr))",
|
|
@@ -101,158 +136,170 @@ var tt = (t) => {
|
|
|
101
136
|
default:
|
|
102
137
|
return {};
|
|
103
138
|
}
|
|
104
|
-
},
|
|
105
|
-
const
|
|
106
|
-
native:
|
|
107
|
-
name: String(
|
|
108
|
-
position:
|
|
109
|
-
size:
|
|
110
|
-
})), !
|
|
111
|
-
element:
|
|
112
|
-
...
|
|
113
|
-
})),
|
|
139
|
+
}, ot = 900, rt = 640, it = 40, nt = 150, at = 16, st = ({ elements: e, windowSize: t, layout: o = h.absolute, onClick: r, width: i = nt, titleBarHeight: s = at, openTitle: c }) => {
|
|
140
|
+
const p = F().prototypeThumbnail, f = t && t.width > 0 ? t.width : ot, m = t && t.height > 0 ? t.height : rt, d = o !== h.absolute, l = o === h.grid, y = e.filter(Boolean).map(L), B = Z(y.map((n) => ({
|
|
141
|
+
native: E(n) !== void 0,
|
|
142
|
+
name: String(n.componentName ?? ""),
|
|
143
|
+
position: z(n),
|
|
144
|
+
size: tt(n)
|
|
145
|
+
})), !d), w = f, H = Math.max(1, m - it), b = i / w, C = Math.round(w * b), O = Math.round(H * b), $ = y.map((n, v) => ({
|
|
146
|
+
element: n,
|
|
147
|
+
...B[v]
|
|
148
|
+
})), P = /* @__PURE__ */ T(D, { children: [/* @__PURE__ */ T("div", {
|
|
114
149
|
className: "prototype-thumbnail-title-bar",
|
|
115
150
|
style: { height: s },
|
|
116
|
-
children: [/* @__PURE__ */
|
|
151
|
+
children: [/* @__PURE__ */ a(J, { size: Math.round(s * 0.375) }), /* @__PURE__ */ a("span", {
|
|
117
152
|
className: "prototype-thumbnail-title",
|
|
118
|
-
children:
|
|
153
|
+
children: p.windowTitle
|
|
119
154
|
})]
|
|
120
|
-
}), /* @__PURE__ */
|
|
155
|
+
}), /* @__PURE__ */ a("div", {
|
|
121
156
|
className: "prototype-thumbnail-body",
|
|
122
157
|
inert: !0,
|
|
123
|
-
children: /* @__PURE__ */
|
|
158
|
+
children: /* @__PURE__ */ a("div", {
|
|
124
159
|
className: "prototype-thumbnail-canvas-scaler",
|
|
125
160
|
style: {
|
|
126
|
-
width:
|
|
127
|
-
height:
|
|
161
|
+
width: w,
|
|
162
|
+
height: H,
|
|
128
163
|
transform: `scale(${b})`,
|
|
129
164
|
transformOrigin: "top left",
|
|
130
|
-
...
|
|
165
|
+
...et(o)
|
|
131
166
|
},
|
|
132
|
-
children:
|
|
133
|
-
const I = String(
|
|
167
|
+
children: $.map(({ element: n, position: v, size: g }) => {
|
|
168
|
+
const I = String(n.id), N = d ? {
|
|
134
169
|
position: "relative",
|
|
135
|
-
width:
|
|
136
|
-
height:
|
|
170
|
+
width: l ? "100%" : g.width,
|
|
171
|
+
height: g.height,
|
|
137
172
|
flexShrink: 0
|
|
138
173
|
} : {
|
|
139
174
|
position: "absolute",
|
|
140
|
-
left:
|
|
141
|
-
top:
|
|
142
|
-
width:
|
|
143
|
-
height:
|
|
175
|
+
left: v.x,
|
|
176
|
+
top: v.y,
|
|
177
|
+
width: g.width,
|
|
178
|
+
height: g.height
|
|
144
179
|
};
|
|
145
|
-
if ("RenderPrototype" in
|
|
180
|
+
if ("RenderPrototype" in n && typeof n.RenderPrototype == "function") return /* @__PURE__ */ a("div", {
|
|
146
181
|
style: {
|
|
147
|
-
...
|
|
182
|
+
...N,
|
|
148
183
|
pointerEvents: "none",
|
|
149
184
|
overflow: "hidden"
|
|
150
185
|
},
|
|
151
|
-
children:
|
|
152
|
-
component:
|
|
153
|
-
label:
|
|
186
|
+
children: n.RenderPrototype({
|
|
187
|
+
component: n,
|
|
188
|
+
label: n.label
|
|
154
189
|
})
|
|
155
190
|
}, I);
|
|
156
|
-
const
|
|
157
|
-
return /* @__PURE__ */
|
|
158
|
-
className: `prototype-thumbnail-element${
|
|
159
|
-
style:
|
|
160
|
-
children:
|
|
191
|
+
const x = E(n), G = x ? " prototype-thumbnail-element--native" : "type" in n && typeof n.type == "string" ? ` prototype-thumbnail-element--${n.type}` : "";
|
|
192
|
+
return /* @__PURE__ */ a("div", {
|
|
193
|
+
className: `prototype-thumbnail-element${G}`,
|
|
194
|
+
style: N,
|
|
195
|
+
children: x && /* @__PURE__ */ a("span", {
|
|
161
196
|
className: "prototype-thumbnail-element__label",
|
|
162
|
-
children:
|
|
197
|
+
children: x.label
|
|
163
198
|
})
|
|
164
199
|
}, I);
|
|
165
200
|
})
|
|
166
201
|
})
|
|
167
202
|
})] }), _ = {
|
|
168
|
-
width:
|
|
169
|
-
height: s +
|
|
203
|
+
width: C,
|
|
204
|
+
height: s + O
|
|
170
205
|
};
|
|
171
|
-
return
|
|
206
|
+
return r ? /* @__PURE__ */ a("button", {
|
|
172
207
|
className: "prototype-thumbnail",
|
|
173
|
-
onClick:
|
|
174
|
-
title: c ??
|
|
208
|
+
onClick: r,
|
|
209
|
+
title: c ?? p.openEditor,
|
|
175
210
|
style: _,
|
|
176
|
-
children:
|
|
177
|
-
}) : /* @__PURE__ */
|
|
211
|
+
children: P
|
|
212
|
+
}) : /* @__PURE__ */ a("div", {
|
|
178
213
|
className: "prototype-thumbnail",
|
|
179
214
|
role: "img",
|
|
180
|
-
"aria-label":
|
|
215
|
+
"aria-label": p.windowTitle,
|
|
181
216
|
style: _,
|
|
182
|
-
children:
|
|
217
|
+
children: P
|
|
183
218
|
});
|
|
184
|
-
},
|
|
185
|
-
const
|
|
219
|
+
}, pt = 900, ht = 640, A = 40, lt = 24, dt = 0.9, ct = 0.85, mt = (e, t) => {
|
|
220
|
+
const o = e && e.width > 0 ? e.width : pt, r = e && e.height > 0 ? e.height : ht, i = Math.max(0.1, Math.min(1, t.width * dt / o, t.height * ct / r)), s = Math.round(o * i);
|
|
186
221
|
return {
|
|
187
222
|
width: s,
|
|
188
|
-
canvasHeight: Math.round(Math.max(1,
|
|
189
|
-
titleBarHeight: Math.max(lt, Math.round(
|
|
223
|
+
canvasHeight: Math.round(Math.max(1, r - A) * (s / o)),
|
|
224
|
+
titleBarHeight: Math.max(lt, Math.round(A * i))
|
|
190
225
|
};
|
|
191
|
-
},
|
|
226
|
+
}, yt = () => typeof window > "u" ? {
|
|
192
227
|
width: 1280,
|
|
193
228
|
height: 800
|
|
194
229
|
} : {
|
|
195
230
|
width: window.innerWidth,
|
|
196
231
|
height: window.innerHeight
|
|
197
|
-
},
|
|
198
|
-
if (!
|
|
199
|
-
const
|
|
200
|
-
return `translate(${Math.round(
|
|
201
|
-
}, u = (
|
|
202
|
-
const s =
|
|
203
|
-
|
|
204
|
-
const
|
|
205
|
-
|
|
232
|
+
}, vt = (e, t, o, r) => {
|
|
233
|
+
if (!e || e.width <= 0) return;
|
|
234
|
+
const i = (r.width - t) / 2, s = (r.height - o) / 2;
|
|
235
|
+
return `translate(${Math.round(e.left - i)}px, ${Math.round(e.top - s)}px) scale(${(e.width / t).toFixed(4)})`;
|
|
236
|
+
}, u = (e) => e.stopPropagation(), Et = ({ elements: e, windowSize: t, layout: o = h.absolute, sourceRect: r, onClose: i }) => {
|
|
237
|
+
const s = F().prototypePreview ?? R.prototypePreview;
|
|
238
|
+
j(() => {
|
|
239
|
+
const l = (y) => {
|
|
240
|
+
y.key === "Escape" && i();
|
|
206
241
|
};
|
|
207
|
-
return window.addEventListener("keydown",
|
|
208
|
-
}, [
|
|
209
|
-
const c =
|
|
242
|
+
return window.addEventListener("keydown", l), () => window.removeEventListener("keydown", l);
|
|
243
|
+
}, [i]);
|
|
244
|
+
const c = yt(), p = mt(t, c), f = p.titleBarHeight + p.canvasHeight, m = vt(r, p.width, f, c), d = /* @__PURE__ */ a("div", {
|
|
210
245
|
className: "prototype-preview-backdrop",
|
|
211
246
|
role: "dialog",
|
|
212
247
|
"aria-modal": "true",
|
|
213
248
|
"aria-label": s.title,
|
|
214
|
-
onClick:
|
|
249
|
+
onClick: i,
|
|
215
250
|
onPointerDown: u,
|
|
216
251
|
onMouseDown: u,
|
|
217
252
|
onWheel: u,
|
|
218
253
|
onDoubleClick: u,
|
|
219
|
-
children: /* @__PURE__ */
|
|
254
|
+
children: /* @__PURE__ */ T("div", {
|
|
220
255
|
className: "prototype-preview-window",
|
|
221
|
-
style:
|
|
222
|
-
onClick: (
|
|
223
|
-
children: [/* @__PURE__ */
|
|
224
|
-
elements:
|
|
225
|
-
windowSize:
|
|
226
|
-
layout:
|
|
227
|
-
width:
|
|
228
|
-
titleBarHeight:
|
|
229
|
-
}), /* @__PURE__ */
|
|
256
|
+
style: m ? { "--prototype-preview-from": m } : void 0,
|
|
257
|
+
onClick: (l) => l.stopPropagation(),
|
|
258
|
+
children: [/* @__PURE__ */ a(st, {
|
|
259
|
+
elements: e,
|
|
260
|
+
windowSize: t,
|
|
261
|
+
layout: o,
|
|
262
|
+
width: p.width,
|
|
263
|
+
titleBarHeight: p.titleBarHeight
|
|
264
|
+
}), /* @__PURE__ */ a("button", {
|
|
230
265
|
type: "button",
|
|
231
266
|
className: "prototype-preview-close",
|
|
232
267
|
"aria-label": s.close,
|
|
233
268
|
title: s.close,
|
|
234
|
-
onClick:
|
|
269
|
+
onClick: i,
|
|
235
270
|
children: "×"
|
|
236
271
|
})]
|
|
237
272
|
})
|
|
238
273
|
});
|
|
239
|
-
return typeof document > "u" ?
|
|
240
|
-
},
|
|
274
|
+
return typeof document > "u" ? d : V(d, document.body);
|
|
275
|
+
}, Ht = (e) => {
|
|
276
|
+
const t = L(e);
|
|
277
|
+
if ("RenderPrototype" in t && typeof t.RenderPrototype == "function") return t.RenderPrototype({
|
|
278
|
+
component: t,
|
|
279
|
+
label: t.label ?? W(t)
|
|
280
|
+
});
|
|
281
|
+
const o = E(t);
|
|
282
|
+
return /* @__PURE__ */ a("div", {
|
|
283
|
+
className: "prototype-unrendered-element",
|
|
284
|
+
"data-prototype-element": o?.type,
|
|
285
|
+
children: o?.label ?? W(t)
|
|
286
|
+
});
|
|
287
|
+
}, Pt = 15;
|
|
241
288
|
export {
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
289
|
+
ft as AnchorEdges,
|
|
290
|
+
h as PrototypeLayout,
|
|
291
|
+
Et as PrototypePreview,
|
|
292
|
+
st as PrototypeThumbnail,
|
|
293
|
+
k as SceneMessagesContext,
|
|
294
|
+
Tt as SceneMessagesProvider,
|
|
295
|
+
J as TrafficLights,
|
|
296
|
+
Pt as allAnchorEdgesForEditor,
|
|
297
|
+
R as defaultSceneMessages,
|
|
298
|
+
W as elementCaption,
|
|
299
|
+
z as elementPosition,
|
|
300
|
+
tt as elementSize,
|
|
301
|
+
mt as fitPrototypePreview,
|
|
302
|
+
E as nativePreview,
|
|
303
|
+
Ht as renderPrototypeElement,
|
|
304
|
+
F as useSceneMessages
|
|
258
305
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { AnchorEdges } from '
|
|
2
|
-
import { PrototypeLayout } from '
|
|
3
|
-
import type { IComponent } from '
|
|
1
|
+
import { AnchorEdges } from '../AnchorEdges';
|
|
2
|
+
import { PrototypeLayout } from '../Layout/PrototypeLayout';
|
|
3
|
+
import type { IComponent } from '../IComponent';
|
|
4
4
|
export type ResizeHandle = 'n' | 's' | 'e' | 'w' | 'nw' | 'ne' | 'sw' | 'se';
|
|
5
5
|
export type PrototypeSurfaceElementType = string;
|
|
6
6
|
export type PrototypeElementType = PrototypeSurfaceElementType;
|
package/dist/scene.css
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
.prototype-
|
|
1
|
+
.prototype-window-traffic-light{box-sizing:border-box;background:0 0;border-radius:50%;width:12px;height:12px}.prototype-thumbnail{cursor:default;box-sizing:border-box;background:var(--surface-card);border:none;flex-direction:column;flex-shrink:0;padding:0;display:flex;position:relative;overflow:hidden}.prototype-thumbnail:is(button){cursor:pointer}.prototype-thumbnail-title-bar{border-bottom:1px solid var(--surface-200);background:var(--surface-50);flex-shrink:0;align-items:center;gap:3px;padding:0 5px;display:flex;position:relative}.prototype-thumbnail-title{text-align:center;color:var(--text-color-secondary);pointer-events:none;font-family:system-ui,sans-serif;font-size:8px;position:absolute;left:0;right:0}.prototype-thumbnail-body{background:var(--surface-ground);flex:1;position:relative;overflow:hidden}.prototype-thumbnail-canvas-scaler{position:absolute;top:0;left:0}.prototype-thumbnail-element{box-sizing:border-box;background:var(--surface-200);border:1px solid var(--surface-300);border-radius:2px;position:absolute}.prototype-thumbnail-element--button,.prototype-thumbnail-element--button-hot{background:var(--surface-200);border:1px solid var(--surface-300)}.prototype-thumbnail-element--button-hot{background:var(--primary-color);border-color:var(--primary-color);opacity:.7}.prototype-thumbnail-element--native{color:var(--text-color);text-align:center;justify-content:center;align-items:center;padding:2px 6px;font-family:system-ui,sans-serif;font-size:12px;display:flex;overflow:hidden}.prototype-thumbnail-element__label{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.prototype-thumbnail-element--text-input{background:var(--surface-0);border:1px solid var(--surface-300)}.prototype-thumbnail-element--label{border-bottom:1px solid var(--surface-300);background:0 0}.prototype-thumbnail-element--checkbox,.prototype-thumbnail-element--radio,.prototype-thumbnail-element--dropdown{background:var(--surface-0);border:1px solid var(--surface-300)}.prototype-thumbnail-element--image{background:var(--surface-100);border:1px dashed var(--surface-300)}.prototype-thumbnail-element--panel{background:var(--surface-50);border:1px solid var(--surface-200)}.prototype-thumbnail-element--data-table{background:var(--surface-0);border:1px solid var(--surface-300)}.prototype-thumbnail-element--toolbar{background:var(--surface-100);border:1px solid var(--surface-200)}.prototype-thumbnail-element--kpi-card{background:var(--surface-100);border:1px solid var(--primary-300,var(--surface-300));border-radius:3px}.prototype-thumbnail-element--bar-chart{background:var(--surface-0);border:1px solid var(--surface-300);background-image:repeating-linear-gradient(to top, var(--primary-400,#7c6fe0) 0px, var(--primary-400,#7c6fe0) 60%, transparent 60%, transparent 100%);background-position:10% 0,35% 0,60% 0,85% 0;background-repeat:no-repeat;background-size:20% 100%}.prototype-thumbnail-element--line-chart{background:var(--surface-0);border:1px solid var(--surface-300)}.prototype-thumbnail-element--pie-chart{background:var(--surface-0);border:1px solid var(--surface-300);border-radius:50%}.prototype-thumbnail-element--progress-bar{background:var(--surface-100);border:1px solid var(--surface-300);background-image:linear-gradient(to right, var(--primary-400,#7c6fe0) 0%, var(--primary-400,#7c6fe0) 55%, transparent 55%)}.prototype-thumbnail-element--activity-feed{background:var(--surface-0);border:1px solid var(--surface-300);background-image:repeating-linear-gradient(to bottom, transparent 0px, transparent 3px, var(--surface-200) 3px, var(--surface-200) 4px);background-size:100% 8px}.prototype-thumbnail-element--nav-topbar{background:var(--surface-100);border:1px solid var(--surface-200);border-radius:2px 2px 0 0}.prototype-thumbnail-element--nav-footer{background:var(--surface-100);border:1px solid var(--surface-200);border-radius:0 0 2px 2px}.prototype-thumbnail-element--nav-sidebar{background:var(--surface-50);border:1px solid var(--surface-200);border-radius:2px 0 0 2px}.prototype-thumbnail-element--content-area{background:var(--surface-ground);border:1.5px dashed var(--surface-300)}.prototype-thumbnail-element--command-form{background:var(--surface-0);border:1px solid var(--surface-300);background-image:repeating-linear-gradient(to bottom, transparent 0px, transparent 5px, var(--surface-100) 5px, var(--surface-100) 8px);background-position:0 4px;background-size:100% 12px}.prototype-preview-backdrop{z-index:1000;cursor:default;background:#00000073;justify-content:center;align-items:center;animation:.16s ease-out prototype-preview-fade;display:flex;position:fixed;inset:0}.prototype-preview-window{border:1px solid var(--surface-300);transform-origin:0 0;border-radius:8px;animation:.22s cubic-bezier(.2,.8,.2,1) prototype-preview-zoom;position:relative;overflow:hidden;box-shadow:0 24px 64px #00000073}.prototype-preview-window .prototype-thumbnail-title{font-size:13px}.prototype-preview-window .prototype-thumbnail-title-bar{gap:8px;padding:0 12px}.prototype-preview-close{z-index:1;width:28px;height:28px;color:var(--text-color-secondary);cursor:pointer;background:0 0;border:none;border-radius:50%;font-size:18px;line-height:1;position:absolute;top:6px;right:8px}.prototype-preview-close:hover{background:var(--surface-200);color:var(--text-color)}@keyframes prototype-preview-zoom{0%{transform:var(--prototype-preview-from,scale(.9));opacity:.4}to{opacity:1;transform:none}}@keyframes prototype-preview-fade{0%{background:0 0}to{background:#00000073}}@media (prefers-reduced-motion:reduce){.prototype-preview-backdrop,.prototype-preview-window{animation:none}}.prototype-unrendered-element{box-sizing:border-box;border:1px solid var(--cratis-surface-border,var(--surface-300));border-radius:var(--cratis-border-radius,4px);background:var(--cratis-surface-hover,var(--surface-200));min-height:28px;color:var(--cratis-text-secondary-color,var(--text-color-secondary));text-overflow:ellipsis;white-space:nowrap;padding:4px 8px;font-size:12px;overflow:hidden}
|
|
2
2
|
/*$vite$:1*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cratis/scene",
|
|
3
|
-
"version": "0.223.
|
|
3
|
+
"version": "0.223.1",
|
|
4
4
|
"description": "Cratis Scene: renders Studio prototypes as thumbnails and previews.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Cratis",
|
|
@@ -9,14 +9,11 @@
|
|
|
9
9
|
"main": "./dist/index.js",
|
|
10
10
|
"types": "./dist/index.d.ts",
|
|
11
11
|
"scripts": {
|
|
12
|
-
"dev": "yarn g:dev",
|
|
13
|
-
"build": "yarn g:build",
|
|
14
12
|
"lint": "yarn g:lint",
|
|
15
13
|
"lint:ci": "yarn g:lint:ci",
|
|
16
14
|
"test": "yarn g:test",
|
|
17
15
|
"test:watch": "yarn g:test:watch",
|
|
18
16
|
"compile": "yarn g:compile",
|
|
19
|
-
"preview": "yarn g:preview",
|
|
20
17
|
"up": "yarn g:up",
|
|
21
18
|
"dev:storybook": "yarn g:dev:storybook --port 6010",
|
|
22
19
|
"build-storybook": "yarn g:build:storybook",
|
|
@@ -32,10 +29,6 @@
|
|
|
32
29
|
"types": "./dist/Prototypes/index.d.ts",
|
|
33
30
|
"import": "./dist/Prototypes/index.js"
|
|
34
31
|
},
|
|
35
|
-
"./ScreenEditor": {
|
|
36
|
-
"types": "./dist/ScreenEditor/index.d.ts",
|
|
37
|
-
"import": "./dist/ScreenEditor/index.js"
|
|
38
|
-
},
|
|
39
32
|
"./styles": "./dist/scene.css"
|
|
40
33
|
},
|
|
41
34
|
"files": [
|
|
@@ -54,10 +47,6 @@
|
|
|
54
47
|
"types": "./dist/Prototypes/index.d.ts",
|
|
55
48
|
"import": "./dist/Prototypes/index.js"
|
|
56
49
|
},
|
|
57
|
-
"./ScreenEditor": {
|
|
58
|
-
"types": "./dist/ScreenEditor/index.d.ts",
|
|
59
|
-
"import": "./dist/ScreenEditor/index.js"
|
|
60
|
-
},
|
|
61
50
|
"./styles": "./dist/scene.css"
|
|
62
51
|
}
|
|
63
52
|
},
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import React, { type ReactNode } from 'react';
|
|
2
|
-
export declare const inspectorWidth = 360;
|
|
3
|
-
export interface OverlaySize {
|
|
4
|
-
width: number;
|
|
5
|
-
height: number;
|
|
6
|
-
}
|
|
7
|
-
export interface PrototypeOverlayFrameState {
|
|
8
|
-
size: OverlaySize;
|
|
9
|
-
setSize: (size: OverlaySize) => void;
|
|
10
|
-
isInspectorOpen: boolean;
|
|
11
|
-
toggleInspector: () => void;
|
|
12
|
-
close: () => void;
|
|
13
|
-
}
|
|
14
|
-
export interface PrototypeOverlayFrameProps {
|
|
15
|
-
sourceRect: DOMRect;
|
|
16
|
-
initialSize?: OverlaySize;
|
|
17
|
-
centerOffsetX?: number;
|
|
18
|
-
children: (state: PrototypeOverlayFrameState) => ReactNode;
|
|
19
|
-
renderInspector?: (state: PrototypeOverlayFrameState) => ReactNode;
|
|
20
|
-
canClose?: (size: OverlaySize) => Promise<boolean>;
|
|
21
|
-
onClosed: (size: OverlaySize) => void;
|
|
22
|
-
}
|
|
23
|
-
export declare const PrototypeOverlayFrame: ({ sourceRect, initialSize, centerOffsetX, children, renderInspector, canClose, onClosed }: PrototypeOverlayFrameProps) => React.JSX.Element;
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
export interface OverlayViewport {
|
|
2
|
-
width: number;
|
|
3
|
-
height: number;
|
|
4
|
-
}
|
|
5
|
-
export interface FittedOverlay {
|
|
6
|
-
width: number;
|
|
7
|
-
height: number;
|
|
8
|
-
offsetX: number;
|
|
9
|
-
}
|
|
10
|
-
export declare const overlayMargin = 8;
|
|
11
|
-
export declare function fitOverlay(size: {
|
|
12
|
-
width: number;
|
|
13
|
-
height: number;
|
|
14
|
-
}, viewport: OverlayViewport, requestedOffsetX: number): FittedOverlay;
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import type { ComponentType } from 'react';
|
|
2
|
-
import type { LayoutArrangement } from './LayoutArrangement';
|
|
3
|
-
export interface LayoutContainerDescriptor {
|
|
4
|
-
type: string;
|
|
5
|
-
name: string;
|
|
6
|
-
arrangement: LayoutArrangement;
|
|
7
|
-
icon?: ComponentType<{
|
|
8
|
-
className?: string;
|
|
9
|
-
}>;
|
|
10
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import type { PrototypeComponentRenderProps } from '../../../IComponent';
|
|
2
|
-
import { LayoutArrangement } from './LayoutArrangement';
|
|
3
|
-
export interface LayoutContainerSurfaceProps extends PrototypeComponentRenderProps {
|
|
4
|
-
arrangement: LayoutArrangement;
|
|
5
|
-
}
|
|
6
|
-
export declare const LayoutContainerSurface: ({ component, arrangement, isDragOver }: LayoutContainerSurfaceProps) => import("react").JSX.Element;
|
|
7
|
-
export { LayoutArrangement };
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import type { CSSProperties } from 'react';
|
|
2
|
-
import { LayoutArrangement } from './LayoutArrangement';
|
|
3
|
-
export declare const arrangementStyle: (arrangement: LayoutArrangement) => CSSProperties;
|
|
4
|
-
export declare const isFlowArrangement: (arrangement: LayoutArrangement) => boolean;
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import type { PrototypeComponentConstructor } from '../../../IComponent';
|
|
2
|
-
import type { LayoutContainerDescriptor } from './LayoutContainerDescriptor';
|
|
3
|
-
export declare const layoutContainerLibrary = "StudioLayout";
|
|
4
|
-
export declare const layoutContainerCategory = "Layout";
|
|
5
|
-
export declare const createLayoutContainerComponent: (descriptor: LayoutContainerDescriptor) => PrototypeComponentConstructor;
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import type { PrototypeComponentLibraryDefinition } from '../editorTypes';
|
|
2
|
-
import type { LayoutContainerDescriptor } from './LayoutContainerDescriptor';
|
|
3
|
-
export declare const registerLayoutContainers: (descriptors: LayoutContainerDescriptor[]) => PrototypeComponentLibraryDefinition;
|
|
@@ -1,235 +0,0 @@
|
|
|
1
|
-
import { c as J, u as K, x as Q } from "../Scene-DaQtzf1e.js";
|
|
2
|
-
import { i as Z, r as tt, t as et } from "../renderPrototypeElement-Xm7OIVPs.js";
|
|
3
|
-
import { useCallback as f, useEffect as X, useRef as E, useState as v } from "react";
|
|
4
|
-
import { jsx as w, jsxs as z } from "react/jsx-runtime";
|
|
5
|
-
function ot(t, r, n) {
|
|
6
|
-
const i = Math.max(1, Math.min(t.width, r.width - 16)), h = Math.max(1, Math.min(t.height, r.height - 16)), a = Math.max(0, (r.width - i) / 2 - 8);
|
|
7
|
-
return {
|
|
8
|
-
width: i,
|
|
9
|
-
height: h,
|
|
10
|
-
offsetX: Math.min(a, Math.max(-a, n))
|
|
11
|
-
};
|
|
12
|
-
}
|
|
13
|
-
var L = 900, $ = 640, rt = 320, nt = 300, yt = 360, it = (t) => t ? {
|
|
14
|
-
width: t.width > 0 ? t.width : L,
|
|
15
|
-
height: t.height > 0 ? t.height : $
|
|
16
|
-
} : {
|
|
17
|
-
width: L,
|
|
18
|
-
height: $
|
|
19
|
-
}, at = [
|
|
20
|
-
"n",
|
|
21
|
-
"s",
|
|
22
|
-
"e",
|
|
23
|
-
"w",
|
|
24
|
-
"ne",
|
|
25
|
-
"nw",
|
|
26
|
-
"se",
|
|
27
|
-
"sw"
|
|
28
|
-
], gt = ({ sourceRect: t, initialSize: r, centerOffsetX: n = 0, children: i, renderInspector: h, canClose: a, onClosed: l }) => {
|
|
29
|
-
const [s, y] = v("entering"), [p, H] = v(() => it(r)), C = E(p);
|
|
30
|
-
C.current = p;
|
|
31
|
-
const [g, k] = v(!1), [P, _] = v(() => ({
|
|
32
|
-
width: window.innerWidth,
|
|
33
|
-
height: window.innerHeight
|
|
34
|
-
}));
|
|
35
|
-
X(() => {
|
|
36
|
-
const e = () => _({
|
|
37
|
-
width: window.innerWidth,
|
|
38
|
-
height: window.innerHeight
|
|
39
|
-
});
|
|
40
|
-
return window.addEventListener("resize", e), () => window.removeEventListener("resize", e);
|
|
41
|
-
}, []);
|
|
42
|
-
const O = f(() => k((e) => !e), []), b = E(null);
|
|
43
|
-
X(() => {
|
|
44
|
-
const e = requestAnimationFrame(() => y("visible"));
|
|
45
|
-
return () => cancelAnimationFrame(e);
|
|
46
|
-
}, []);
|
|
47
|
-
const I = f(async () => {
|
|
48
|
-
a && !await a(C.current) || (y("closing"), setTimeout(() => l(C.current), 300));
|
|
49
|
-
}, [a, l]), Y = (e, o) => {
|
|
50
|
-
o.stopPropagation(), o.preventDefault(), b.current = {
|
|
51
|
-
direction: e,
|
|
52
|
-
startX: o.clientX,
|
|
53
|
-
startY: o.clientY,
|
|
54
|
-
startWidth: p.width,
|
|
55
|
-
startHeight: p.height
|
|
56
|
-
}, o.target.setPointerCapture(o.pointerId);
|
|
57
|
-
}, G = f((e) => {
|
|
58
|
-
const o = b.current;
|
|
59
|
-
if (!o) return;
|
|
60
|
-
const { direction: m } = o;
|
|
61
|
-
let F = o.startWidth, T = o.startHeight;
|
|
62
|
-
if (m.includes("e") || m.includes("w")) {
|
|
63
|
-
const M = m.includes("e") ? e.clientX - o.startX : o.startX - e.clientX;
|
|
64
|
-
F = Math.max(rt, o.startWidth + M * 2);
|
|
65
|
-
}
|
|
66
|
-
if (m.includes("s") || m.includes("n")) {
|
|
67
|
-
const M = m.includes("s") ? e.clientY - o.startY : o.startY - e.clientY;
|
|
68
|
-
T = Math.max(nt, o.startHeight + M * 2);
|
|
69
|
-
}
|
|
70
|
-
H({
|
|
71
|
-
width: F,
|
|
72
|
-
height: T
|
|
73
|
-
});
|
|
74
|
-
}, []), N = f(() => {
|
|
75
|
-
b.current = null;
|
|
76
|
-
}, []), c = ot(p, P, n - (g ? 360 / 2 : 0)), S = c.offsetX, W = {
|
|
77
|
-
size: p,
|
|
78
|
-
setSize: H,
|
|
79
|
-
isInspectorOpen: g,
|
|
80
|
-
toggleInspector: O,
|
|
81
|
-
close: () => {
|
|
82
|
-
I();
|
|
83
|
-
}
|
|
84
|
-
}, R = t.left + t.width / 2, j = t.top + t.height / 2, U = P.width / 2 + S - c.width / 2, B = P.height / 2 - c.height / 2, q = `${R - U}px ${j - B}px`, A = [
|
|
85
|
-
"prototype-editor-overlay-content",
|
|
86
|
-
s === "visible" ? "prototype-editor-overlay-content--visible" : "",
|
|
87
|
-
s === "closing" ? "prototype-editor-overlay-content--closing" : ""
|
|
88
|
-
].join(" "), V = ["prototype-editor-overlay-backdrop", s === "visible" ? "prototype-editor-overlay-backdrop--visible" : ""].join(" ");
|
|
89
|
-
return /* @__PURE__ */ z("div", {
|
|
90
|
-
className: V,
|
|
91
|
-
"data-testid": "studio-screen-editor-backdrop",
|
|
92
|
-
onClick: I,
|
|
93
|
-
children: [/* @__PURE__ */ z("div", {
|
|
94
|
-
className: A,
|
|
95
|
-
"data-testid": "studio-screen-editor-frame",
|
|
96
|
-
style: {
|
|
97
|
-
transformOrigin: q,
|
|
98
|
-
width: c.width,
|
|
99
|
-
height: c.height,
|
|
100
|
-
marginLeft: -(c.width / 2) + S,
|
|
101
|
-
marginTop: -(c.height / 2)
|
|
102
|
-
},
|
|
103
|
-
onClick: (e) => e.stopPropagation(),
|
|
104
|
-
onPointerDown: (e) => e.stopPropagation(),
|
|
105
|
-
children: [s === "visible" && at.map((e) => /* @__PURE__ */ w("div", {
|
|
106
|
-
className: `prototype-editor-overlay-resize prototype-editor-overlay-resize--${e}`,
|
|
107
|
-
onPointerDown: (o) => Y(e, o),
|
|
108
|
-
onPointerMove: G,
|
|
109
|
-
onPointerUp: N,
|
|
110
|
-
onPointerCancel: N
|
|
111
|
-
}, e)), i(W)]
|
|
112
|
-
}), h && /* @__PURE__ */ w("aside", {
|
|
113
|
-
className: `prototype-editor-overlay-inspector${g && s === "visible" ? " prototype-editor-overlay-inspector--open" : ""}`,
|
|
114
|
-
style: { width: 360 },
|
|
115
|
-
"aria-hidden": !g,
|
|
116
|
-
inert: !g,
|
|
117
|
-
onClick: (e) => e.stopPropagation(),
|
|
118
|
-
onPointerDown: (e) => e.stopPropagation(),
|
|
119
|
-
children: h(W)
|
|
120
|
-
})]
|
|
121
|
-
});
|
|
122
|
-
}, d = /* @__PURE__ */ (function(t) {
|
|
123
|
-
return t.Row = "row", t.Column = "column", t.Grid = "grid", t.Wrap = "wrap", t.Freeform = "freeform", t.Grouping = "grouping", t;
|
|
124
|
-
})({}), x = 8, st = (t) => {
|
|
125
|
-
switch (t) {
|
|
126
|
-
case d.Row:
|
|
127
|
-
return {
|
|
128
|
-
display: "flex",
|
|
129
|
-
flexDirection: "row",
|
|
130
|
-
gap: x
|
|
131
|
-
};
|
|
132
|
-
case d.Wrap:
|
|
133
|
-
return {
|
|
134
|
-
display: "flex",
|
|
135
|
-
flexDirection: "row",
|
|
136
|
-
flexWrap: "wrap",
|
|
137
|
-
gap: x
|
|
138
|
-
};
|
|
139
|
-
case d.Grid:
|
|
140
|
-
return {
|
|
141
|
-
display: "grid",
|
|
142
|
-
gridTemplateColumns: "repeat(auto-fill, minmax(120px, 1fr))",
|
|
143
|
-
gap: x
|
|
144
|
-
};
|
|
145
|
-
case d.Freeform:
|
|
146
|
-
return { position: "relative" };
|
|
147
|
-
case d.Column:
|
|
148
|
-
case d.Grouping:
|
|
149
|
-
return {
|
|
150
|
-
display: "flex",
|
|
151
|
-
flexDirection: "column",
|
|
152
|
-
gap: x
|
|
153
|
-
};
|
|
154
|
-
}
|
|
155
|
-
}, lt = (t) => t !== d.Freeform, ct = ({ component: t, arrangement: r, isDragOver: n }) => {
|
|
156
|
-
const i = (t.children ?? []).filter(Boolean).map(J), h = lt(r);
|
|
157
|
-
return /* @__PURE__ */ z("div", {
|
|
158
|
-
className: `prototype-layout-container${n ? " prototype-layout-container--drag-over" : ""}`,
|
|
159
|
-
"data-layout-arrangement": r,
|
|
160
|
-
style: st(r),
|
|
161
|
-
children: [i.length === 0 && /* @__PURE__ */ w("div", {
|
|
162
|
-
className: "prototype-layout-container__empty",
|
|
163
|
-
"aria-hidden": "true"
|
|
164
|
-
}), i.map((a) => {
|
|
165
|
-
const l = Z(a), s = tt(a), y = {
|
|
166
|
-
width: l.width > 0 ? l.width : void 0,
|
|
167
|
-
height: l.height > 0 ? l.height : void 0
|
|
168
|
-
};
|
|
169
|
-
return /* @__PURE__ */ w("div", {
|
|
170
|
-
className: "prototype-layout-container__item",
|
|
171
|
-
style: h ? y : {
|
|
172
|
-
position: "absolute",
|
|
173
|
-
left: s.x,
|
|
174
|
-
top: s.y,
|
|
175
|
-
...y
|
|
176
|
-
},
|
|
177
|
-
children: et(a)
|
|
178
|
-
}, String(a.id));
|
|
179
|
-
})]
|
|
180
|
-
});
|
|
181
|
-
}, u = "StudioLayout", D = "Layout", dt = (t) => {
|
|
182
|
-
class r extends Q {
|
|
183
|
-
componentName = t.type;
|
|
184
|
-
category = D;
|
|
185
|
-
library = u;
|
|
186
|
-
initialSize = {
|
|
187
|
-
width: 260,
|
|
188
|
-
height: 140
|
|
189
|
-
};
|
|
190
|
-
resizeBehavior = "both";
|
|
191
|
-
acceptsChildren = !0;
|
|
192
|
-
get toolbarIcon() {
|
|
193
|
-
return t.icon;
|
|
194
|
-
}
|
|
195
|
-
RenderPrototype(i) {
|
|
196
|
-
return /* @__PURE__ */ w(ct, {
|
|
197
|
-
...i,
|
|
198
|
-
arrangement: t.arrangement
|
|
199
|
-
});
|
|
200
|
-
}
|
|
201
|
-
}
|
|
202
|
-
return r;
|
|
203
|
-
}, wt = (t) => {
|
|
204
|
-
const r = {};
|
|
205
|
-
for (const n of t) {
|
|
206
|
-
const i = dt(n);
|
|
207
|
-
r[n.type] = i, r[`${u}.${n.type}`] = i;
|
|
208
|
-
}
|
|
209
|
-
return K(u, r), {
|
|
210
|
-
name: u,
|
|
211
|
-
bundlePath: "",
|
|
212
|
-
categories: [{
|
|
213
|
-
name: D,
|
|
214
|
-
components: t.map((n) => ({
|
|
215
|
-
name: n.name,
|
|
216
|
-
category: D,
|
|
217
|
-
library: u,
|
|
218
|
-
bundlePath: "",
|
|
219
|
-
type: `${u}.${n.type}`,
|
|
220
|
-
component: new r[n.type]()
|
|
221
|
-
}))
|
|
222
|
-
}]
|
|
223
|
-
};
|
|
224
|
-
};
|
|
225
|
-
export {
|
|
226
|
-
d as LayoutArrangement,
|
|
227
|
-
gt as PrototypeOverlayFrame,
|
|
228
|
-
st as arrangementStyle,
|
|
229
|
-
dt as createLayoutContainerComponent,
|
|
230
|
-
yt as inspectorWidth,
|
|
231
|
-
lt as isFlowArrangement,
|
|
232
|
-
D as layoutContainerCategory,
|
|
233
|
-
u as layoutContainerLibrary,
|
|
234
|
-
wt as registerLayoutContainers
|
|
235
|
-
};
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
import { c as p } from "./Scene-DaQtzf1e.js";
|
|
2
|
-
import { jsx as s } from "react/jsx-runtime";
|
|
3
|
-
var y = (n) => {
|
|
4
|
-
const e = n;
|
|
5
|
-
if (e.position && typeof e.position.x == "number") return {
|
|
6
|
-
x: e.position.x,
|
|
7
|
-
y: e.position.y ?? 0
|
|
8
|
-
};
|
|
9
|
-
const t = e.properties?.canvas ?? {};
|
|
10
|
-
return {
|
|
11
|
-
x: t.x ?? 0,
|
|
12
|
-
y: t.y ?? 0
|
|
13
|
-
};
|
|
14
|
-
}, d = (n) => {
|
|
15
|
-
const e = n;
|
|
16
|
-
return e.size && typeof e.size.width == "number" ? {
|
|
17
|
-
width: e.size.width,
|
|
18
|
-
height: e.size.height ?? 0
|
|
19
|
-
} : {
|
|
20
|
-
width: e.width ?? 0,
|
|
21
|
-
height: e.height ?? 0
|
|
22
|
-
};
|
|
23
|
-
}, a = (n) => {
|
|
24
|
-
const e = n;
|
|
25
|
-
if (typeof e.componentName != "string" || e.componentName.includes(".")) return;
|
|
26
|
-
const t = e.properties && typeof e.properties == "object" ? e.properties : {}, o = [
|
|
27
|
-
t.label,
|
|
28
|
-
t.text,
|
|
29
|
-
t.title,
|
|
30
|
-
e.componentName
|
|
31
|
-
].find((r) => typeof r == "string" && r.length > 0);
|
|
32
|
-
return typeof o == "string" ? {
|
|
33
|
-
type: e.componentName,
|
|
34
|
-
label: o
|
|
35
|
-
} : void 0;
|
|
36
|
-
}, i = (n) => {
|
|
37
|
-
const e = n, t = [e.name, e.componentName].find((o) => typeof o == "string" && o.length > 0);
|
|
38
|
-
return typeof t == "string" ? t : "";
|
|
39
|
-
}, l = (n) => {
|
|
40
|
-
const e = p(n);
|
|
41
|
-
if ("RenderPrototype" in e && typeof e.RenderPrototype == "function") return e.RenderPrototype({
|
|
42
|
-
component: e,
|
|
43
|
-
label: e.label ?? i(e)
|
|
44
|
-
});
|
|
45
|
-
const t = a(e);
|
|
46
|
-
return /* @__PURE__ */ s("div", {
|
|
47
|
-
className: "prototype-unrendered-element",
|
|
48
|
-
"data-prototype-element": t?.type,
|
|
49
|
-
children: t?.label ?? i(e)
|
|
50
|
-
});
|
|
51
|
-
};
|
|
52
|
-
export {
|
|
53
|
-
a,
|
|
54
|
-
d as i,
|
|
55
|
-
i as n,
|
|
56
|
-
y as r,
|
|
57
|
-
l as t
|
|
58
|
-
};
|