@brucesantos/design-space 0.9.1 → 0.9.2
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/CHANGELOG.md +22 -0
- package/README.md +10 -5
- package/dist/design-space.css +1 -1
- package/dist/index.js +851 -901
- package/dist/index.js.map +1 -1
- package/dist/shell/Panel.d.ts +2 -2
- package/dist/shell/icons.d.ts +1 -1
- package/dist/shell/labels.d.ts +1 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,145 +1,145 @@
|
|
|
1
|
-
import { jsx as n, jsxs as
|
|
2
|
-
import { useState as
|
|
3
|
-
import { r as
|
|
4
|
-
import { u as
|
|
5
|
-
function
|
|
6
|
-
const t = e.scenarios ?? [], s = e.routes ?? [], o = e.components ?? [], r = new Map(t.map((c) => [c.id, c])), i = new Map(o.map((c) => [c.id, c])), l = new Map((e.personas ?? []).map((c) => [c.id, c])), a = new Map((e.fixtures ?? []).map((c) => [c.id, c])),
|
|
1
|
+
import { jsx as n, jsxs as S, Fragment as Y } from "react/jsx-runtime";
|
|
2
|
+
import { useState as V, useRef as q, useCallback as U, useEffect as I, useMemo as D, useContext as ct, createContext as lt, useLayoutEffect as Ue } from "react";
|
|
3
|
+
import { r as xe, s as dt, h as oe, v as ut, a as ve, b as Ie, p as ht, P as $, c as We, C as be, d as Te, e as ae, t as ue, f as Ne, N as He, g as Be, i as pt, j as pe, k as ye, l as mt, m as _e, F as ft, n as wt, o as vt, q as bt } from "./index-Bj69Oe2X.js";
|
|
4
|
+
import { u as wn, H as vn, w as bn, x as gn, y as kn, z as Cn, A as Sn, B as xn, D as Nn, E as yn } from "./index-Bj69Oe2X.js";
|
|
5
|
+
function gt(e) {
|
|
6
|
+
const t = e.scenarios ?? [], s = e.routes ?? [], o = e.components ?? [], r = new Map(t.map((c) => [c.id, c])), i = new Map(o.map((c) => [c.id, c])), l = new Map((e.personas ?? []).map((c) => [c.id, c])), a = new Map((e.fixtures ?? []).map((c) => [c.id, c])), p = new Map((e.rules ?? []).map((c) => [c.id, c])), m = /* @__PURE__ */ new Map(), h = /* @__PURE__ */ new Map();
|
|
7
7
|
for (const c of t) {
|
|
8
|
-
const
|
|
9
|
-
if (!
|
|
10
|
-
const
|
|
11
|
-
|
|
12
|
-
const
|
|
13
|
-
|
|
8
|
+
const v = xe(s, c.route ?? "");
|
|
9
|
+
if (!v) continue;
|
|
10
|
+
const x = v.definition.path;
|
|
11
|
+
h.set(c.id, x);
|
|
12
|
+
const M = m.get(x) ?? [];
|
|
13
|
+
M.push(c), m.set(x, M);
|
|
14
14
|
}
|
|
15
|
-
const d = /* @__PURE__ */ new Set(),
|
|
15
|
+
const d = /* @__PURE__ */ new Set(), f = [];
|
|
16
16
|
for (const c of s) {
|
|
17
17
|
if (d.has(c.path)) continue;
|
|
18
18
|
d.add(c.path);
|
|
19
|
-
const
|
|
20
|
-
|
|
19
|
+
const v = m.get(c.path) ?? [];
|
|
20
|
+
f.push({
|
|
21
21
|
id: c.path,
|
|
22
|
-
name: c.name?.trim() ||
|
|
22
|
+
name: c.name?.trim() || v[0]?.title || c.path,
|
|
23
23
|
description: c.description,
|
|
24
24
|
route: c,
|
|
25
25
|
href: dt(c.path, c.params),
|
|
26
|
-
variations:
|
|
26
|
+
variations: v,
|
|
27
27
|
group: c.group?.trim() || void 0,
|
|
28
28
|
controls: Array.isArray(c.controls) ? c.controls : []
|
|
29
29
|
});
|
|
30
30
|
}
|
|
31
|
-
const
|
|
32
|
-
if (!(!c || !
|
|
33
|
-
return i.get(c)?.fixtures?.find((
|
|
34
|
-
}, w = (c = {}) => t.filter((
|
|
35
|
-
const
|
|
36
|
-
return
|
|
37
|
-
},
|
|
38
|
-
const { handoff:
|
|
39
|
-
return
|
|
40
|
-
...
|
|
41
|
-
variations:
|
|
31
|
+
const k = new Map(f.map((c) => [c.id, c])), g = (c) => c ? r.get(c) : void 0, L = (c) => c ? l.get(c) : void 0, P = L(e.defaultPersona)?.id, N = (c, v) => {
|
|
32
|
+
if (!(!c || !v))
|
|
33
|
+
return i.get(c)?.fixtures?.find((x) => x.id === v);
|
|
34
|
+
}, w = (c = {}) => t.filter((v) => oe(c.handoff, v.id)), u = (c) => {
|
|
35
|
+
const v = xe(s, c);
|
|
36
|
+
return v ? k.get(v.definition.path) : void 0;
|
|
37
|
+
}, C = (c = {}) => {
|
|
38
|
+
const { handoff: v } = c;
|
|
39
|
+
return v ? f.map((x) => ({
|
|
40
|
+
...x,
|
|
41
|
+
variations: x.variations.filter((M) => oe(v, M.id))
|
|
42
42
|
})).filter(
|
|
43
|
-
(
|
|
44
|
-
) :
|
|
45
|
-
},
|
|
46
|
-
const
|
|
47
|
-
for (const
|
|
48
|
-
for (const
|
|
49
|
-
return [...
|
|
50
|
-
},
|
|
43
|
+
(x) => x.variations.length > 0 || (v.routes ?? []).length > 0 && Ie(v, x.href)
|
|
44
|
+
) : f;
|
|
45
|
+
}, b = (c) => c ? c.permissions ? c.permissions : L(c.persona ?? P)?.permissions ?? [] : [], y = (c = {}) => je(C(c)), _ = (c, v) => {
|
|
46
|
+
const x = new Set(c?.route.components ?? []), M = v ? [v] : c?.variations ?? [];
|
|
47
|
+
for (const F of M)
|
|
48
|
+
for (const E of F.components ?? []) x.add(E);
|
|
49
|
+
return [...x];
|
|
50
|
+
}, z = (c) => o.filter((v) => ve(c, v.id));
|
|
51
51
|
return {
|
|
52
52
|
product: e,
|
|
53
|
-
screens:
|
|
53
|
+
screens: f,
|
|
54
54
|
issues: ut(e),
|
|
55
|
-
defaultPersona:
|
|
56
|
-
scenario:
|
|
55
|
+
defaultPersona: P,
|
|
56
|
+
scenario: g,
|
|
57
57
|
component: (c) => c ? i.get(c) : void 0,
|
|
58
|
-
componentFixture:
|
|
59
|
-
resolveComponentFixture: (c,
|
|
60
|
-
const
|
|
58
|
+
componentFixture: N,
|
|
59
|
+
resolveComponentFixture: (c, v) => {
|
|
60
|
+
const x = c ? i.get(c) : void 0, M = N(c, v), F = N(c, x?.defaultFixture) ?? x?.fixtures?.[0];
|
|
61
61
|
return {
|
|
62
|
-
fixture:
|
|
63
|
-
requestedId:
|
|
64
|
-
didFallback: !!(
|
|
62
|
+
fixture: M ?? F,
|
|
63
|
+
requestedId: v,
|
|
64
|
+
didFallback: !!(v && !M)
|
|
65
65
|
};
|
|
66
66
|
},
|
|
67
|
-
persona:
|
|
67
|
+
persona: L,
|
|
68
68
|
fixture: (c) => c ? a.get(c) : void 0,
|
|
69
|
-
rule: (c) => c ?
|
|
70
|
-
screen: (c) => c ?
|
|
71
|
-
screenForPath:
|
|
69
|
+
rule: (c) => c ? p.get(c) : void 0,
|
|
70
|
+
screen: (c) => c ? k.get(c) : void 0,
|
|
71
|
+
screenForPath: u,
|
|
72
72
|
screenOf: (c) => {
|
|
73
|
-
const
|
|
74
|
-
return
|
|
73
|
+
const v = c ? h.get(c.id) : void 0;
|
|
74
|
+
return v ? k.get(v) : void 0;
|
|
75
75
|
},
|
|
76
|
-
screensFor:
|
|
77
|
-
flows:
|
|
78
|
-
flowOf: (c,
|
|
76
|
+
screensFor: C,
|
|
77
|
+
flows: y,
|
|
78
|
+
flowOf: (c, v) => {
|
|
79
79
|
if (c)
|
|
80
|
-
return
|
|
80
|
+
return y(v).find((x) => x.name === c.group);
|
|
81
81
|
},
|
|
82
|
-
controlsOf: (c) => (c?.controls ?? []).flatMap((
|
|
83
|
-
resolveControls: (c,
|
|
84
|
-
rulesOf: (c) => (c?.rules ?? []).map((
|
|
85
|
-
permissionsOf:
|
|
86
|
-
scenariosForRoute: (c,
|
|
87
|
-
const
|
|
88
|
-
return
|
|
82
|
+
controlsOf: (c) => (c?.controls ?? []).flatMap((v) => v.controls ?? []),
|
|
83
|
+
resolveControls: (c, v = {}) => kt(c?.controls ?? [], v),
|
|
84
|
+
rulesOf: (c) => (c?.rules ?? []).map((v) => p.get(v)).filter((v) => !!v),
|
|
85
|
+
permissionsOf: b,
|
|
86
|
+
scenariosForRoute: (c, v) => {
|
|
87
|
+
const x = u(c);
|
|
88
|
+
return x ? x.variations.filter((M) => oe(v?.handoff, M.id)) : [];
|
|
89
89
|
},
|
|
90
90
|
activeScenarios: w,
|
|
91
|
-
search: (c,
|
|
92
|
-
const
|
|
93
|
-
return
|
|
94
|
-
(
|
|
91
|
+
search: (c, v) => {
|
|
92
|
+
const x = X(c), M = w(v);
|
|
93
|
+
return x ? M.filter(
|
|
94
|
+
(F) => X(
|
|
95
95
|
[
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
(
|
|
102
|
-
(
|
|
96
|
+
F.title,
|
|
97
|
+
F.id,
|
|
98
|
+
F.intent ?? "",
|
|
99
|
+
F.route,
|
|
100
|
+
L(F.persona)?.name ?? "",
|
|
101
|
+
(F.tags ?? []).join(" "),
|
|
102
|
+
(F.expected ?? []).join(" ")
|
|
103
103
|
].join(" ")
|
|
104
|
-
).includes(
|
|
105
|
-
) :
|
|
104
|
+
).includes(x)
|
|
105
|
+
) : M;
|
|
106
106
|
},
|
|
107
|
-
searchScreens: (c,
|
|
108
|
-
const
|
|
109
|
-
return
|
|
110
|
-
(
|
|
107
|
+
searchScreens: (c, v) => {
|
|
108
|
+
const x = X(c), M = C(v);
|
|
109
|
+
return x ? M.filter(
|
|
110
|
+
(F) => X(
|
|
111
111
|
[
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
...
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
(
|
|
112
|
+
F.name,
|
|
113
|
+
F.description ?? "",
|
|
114
|
+
F.id,
|
|
115
|
+
F.group ?? "",
|
|
116
|
+
...F.variations.flatMap((E) => [
|
|
117
|
+
E.title,
|
|
118
|
+
E.id,
|
|
119
|
+
(E.tags ?? []).join(" ")
|
|
120
120
|
])
|
|
121
121
|
].join(" ")
|
|
122
|
-
).includes(
|
|
123
|
-
) :
|
|
122
|
+
).includes(x)
|
|
123
|
+
) : M;
|
|
124
124
|
},
|
|
125
|
-
searchComponents: (c,
|
|
126
|
-
const
|
|
127
|
-
return
|
|
128
|
-
(
|
|
125
|
+
searchComponents: (c, v) => {
|
|
126
|
+
const x = X(c), M = z(v);
|
|
127
|
+
return x ? M.filter(
|
|
128
|
+
(F) => X(
|
|
129
129
|
[
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
130
|
+
F.name,
|
|
131
|
+
F.description ?? "",
|
|
132
|
+
F.group ?? "",
|
|
133
|
+
F.id,
|
|
134
|
+
F.source ?? ""
|
|
135
135
|
].join(" ")
|
|
136
|
-
).includes(
|
|
137
|
-
) :
|
|
136
|
+
).includes(x)
|
|
137
|
+
) : M;
|
|
138
138
|
},
|
|
139
|
-
componentsFor:
|
|
140
|
-
componentsOfScreen: (c,
|
|
141
|
-
usagesOf: (c,
|
|
142
|
-
(
|
|
139
|
+
componentsFor: z,
|
|
140
|
+
componentsOfScreen: (c, v) => _(c, v).map((x) => i.get(x)).filter((x) => !!x),
|
|
141
|
+
usagesOf: (c, v) => c ? C(v).filter(
|
|
142
|
+
(x) => x.route.components?.includes(c) || x.variations.some((M) => M.components?.includes(c))
|
|
143
143
|
) : []
|
|
144
144
|
};
|
|
145
145
|
}
|
|
@@ -169,12 +169,12 @@ function kt(e, t = {}) {
|
|
|
169
169
|
for (const a of l.controls ?? []) {
|
|
170
170
|
if (r.has(a.id)) continue;
|
|
171
171
|
r.add(a.id);
|
|
172
|
-
const
|
|
172
|
+
const p = (f) => f !== void 0 && (a.options ?? []).some((k) => k.value === f);
|
|
173
173
|
let m = ge(a);
|
|
174
|
-
const
|
|
175
|
-
h
|
|
174
|
+
const h = t.scenario?.controls?.[a.id];
|
|
175
|
+
p(h) && (m = h);
|
|
176
176
|
const d = i[a.id];
|
|
177
|
-
d !== void 0 && (
|
|
177
|
+
d !== void 0 && (p(d) ? m = d : o.push({ id: a.id, value: d, reason: "invalid-value", fallback: m })), s[a.id] = m;
|
|
178
178
|
}
|
|
179
179
|
for (const [l, a] of Object.entries(i))
|
|
180
180
|
r.has(l) || o.push({ id: l, value: a, reason: "unknown-control" });
|
|
@@ -189,180 +189,180 @@ const St = [
|
|
|
189
189
|
{ id: "desktop", label: "Desktop", width: 1280, height: 800 },
|
|
190
190
|
{ id: "fit", label: "Ajustar" },
|
|
191
191
|
{ id: "custom", label: "Personalizado" }
|
|
192
|
-
], Pe = 25, Ee = 150,
|
|
192
|
+
], Pe = 25, Ee = 150, me = 100;
|
|
193
193
|
function qe(e, t, s) {
|
|
194
194
|
const o = s !== void 0 ? e.screenForPath(s) : e.screenOf(t), r = t && o && e.screenOf(t)?.id === o.id ? t : void 0;
|
|
195
195
|
return { screen: o, scenario: r };
|
|
196
196
|
}
|
|
197
197
|
function $e(e, t, s) {
|
|
198
|
-
const o = new URLSearchParams(e), r = ht(o), i = o.get(
|
|
199
|
-
scenario:
|
|
198
|
+
const o = new URLSearchParams(e), r = ht(o), i = o.get($.component) ?? void 0, l = ve(r, i) ? t.component(i) : void 0, a = o.get($.scenario) ?? void 0, p = l || !oe(r, a) ? void 0 : t.scenario(a), m = o.get($.fixture) ?? void 0, h = l ? m ?? t.componentFixture(l.id, l.defaultFixture)?.id ?? l.fixtures?.[0]?.id : void 0, d = o.get($.network), f = l ? void 0 : qe(t, p, s), k = f?.screen && f.screen.controls.length > 0 ? t.resolveControls(f.screen, {
|
|
199
|
+
scenario: f.scenario,
|
|
200
200
|
requested: We(o)
|
|
201
201
|
}).values : void 0;
|
|
202
202
|
return {
|
|
203
|
-
scenario:
|
|
203
|
+
scenario: p?.id,
|
|
204
204
|
handoff: r,
|
|
205
205
|
component: l?.id,
|
|
206
206
|
// Precedência: URL, cenário, padrão do produto. O preview de componente não
|
|
207
207
|
// tem persona, então o padrão não se aplica a ele.
|
|
208
|
-
persona: o.get(
|
|
209
|
-
fixture: l ?
|
|
210
|
-
network: $t(d) ? d :
|
|
211
|
-
viewport: o.get(
|
|
212
|
-
customWidth: Tt(o.get(
|
|
213
|
-
themeMode: o.get(
|
|
214
|
-
locale: o.get(
|
|
215
|
-
dataSource: o.get(
|
|
208
|
+
persona: o.get($.persona) ?? p?.persona ?? (l ? void 0 : t.defaultPersona),
|
|
209
|
+
fixture: l ? h : m ?? p?.fixture,
|
|
210
|
+
network: $t(d) ? d : p?.network ?? "success",
|
|
211
|
+
viewport: o.get($.viewport) ?? "fit",
|
|
212
|
+
customWidth: Tt(o.get($.customWidth)),
|
|
213
|
+
themeMode: o.get($.themeMode) ?? t.product.theme?.modes?.[0],
|
|
214
|
+
locale: o.get($.locale) ?? t.product.theme?.locales?.[0],
|
|
215
|
+
dataSource: o.get($.dataSource) ?? t.product.dataSources?.default ?? "fixtures",
|
|
216
216
|
// Sem parâmetro, o tema do chrome fica em aberto: o shell resolve pela
|
|
217
217
|
// última escolha da pessoa e, na falta dela, pelo sistema.
|
|
218
|
-
chromeTheme: Mt(o.get(
|
|
218
|
+
chromeTheme: Mt(o.get($.chromeTheme)) ? o.get($.chromeTheme) : void 0,
|
|
219
219
|
// Chrome visível por padrão. `?chrome=0` é o modo de revisão limpa e captura
|
|
220
220
|
// de tela, então precisa ser explícito para não sumir sem pedido.
|
|
221
|
-
chrome: o.get(
|
|
222
|
-
inspector: o.get(
|
|
223
|
-
panelTab: Lt(o.get(
|
|
224
|
-
zoom: Ze(o.get(
|
|
225
|
-
rotated: o.get(
|
|
226
|
-
screenControls:
|
|
221
|
+
chrome: o.get($.chrome) !== "0",
|
|
222
|
+
inspector: o.get($.inspector) !== "0",
|
|
223
|
+
panelTab: Lt(o.get($.panelTab)) ? o.get($.panelTab) : "variations",
|
|
224
|
+
zoom: Ze(o.get($.zoom)),
|
|
225
|
+
rotated: o.get($.rotated) === "1",
|
|
226
|
+
screenControls: k
|
|
227
227
|
};
|
|
228
228
|
}
|
|
229
229
|
function se(e, t, s) {
|
|
230
230
|
const o = new URLSearchParams(), r = t.scenario(e.scenario);
|
|
231
|
-
if (e.component ? o.set(
|
|
232
|
-
const
|
|
233
|
-
for (const
|
|
234
|
-
const
|
|
235
|
-
|
|
231
|
+
if (e.component ? o.set($.component, e.component) : e.scenario && o.set($.scenario, e.scenario), e.persona && e.persona !== (r?.persona ?? t.defaultPersona) && o.set($.persona, e.persona), e.component && e.fixture ? o.set($.fixture, e.fixture) : e.fixture && e.fixture !== r?.fixture && o.set($.fixture, e.fixture), e.network !== (r?.network ?? "success") && o.set($.network, e.network), e.screenControls && !e.component) {
|
|
232
|
+
const h = qe(t, r, s), d = h.screen ? t.resolveControls(h.screen, { scenario: h.scenario }).values : {}, f = h.screen ? t.controlsOf(h.screen).map((k) => k.id) : Object.keys(e.screenControls);
|
|
233
|
+
for (const k of f) {
|
|
234
|
+
const g = e.screenControls[k];
|
|
235
|
+
g !== void 0 && g !== d[k] && o.set(`${be}${k}`, g);
|
|
236
236
|
}
|
|
237
237
|
}
|
|
238
|
-
e.viewport !== "fit" && o.set(
|
|
238
|
+
e.viewport !== "fit" && o.set($.viewport, e.viewport), e.viewport === "custom" && e.customWidth && o.set($.customWidth, String(e.customWidth));
|
|
239
239
|
const i = t.product.theme?.modes?.[0];
|
|
240
|
-
e.themeMode && e.themeMode !== i && o.set(
|
|
240
|
+
e.themeMode && e.themeMode !== i && o.set($.themeMode, e.themeMode);
|
|
241
241
|
const l = t.product.theme?.locales?.[0];
|
|
242
|
-
e.locale && e.locale !== l && o.set(
|
|
242
|
+
e.locale && e.locale !== l && o.set($.locale, e.locale);
|
|
243
243
|
const a = t.product.dataSources?.default ?? "fixtures";
|
|
244
|
-
e.dataSource && e.dataSource !== a && o.set(
|
|
245
|
-
const
|
|
246
|
-
|
|
244
|
+
e.dataSource && e.dataSource !== a && o.set($.dataSource, e.dataSource), e.chromeTheme && o.set($.chromeTheme, e.chromeTheme), e.chrome || o.set($.chrome, "0"), e.inspector || o.set($.inspector, "0"), e.panelTab === "info" && o.set($.panelTab, "info");
|
|
245
|
+
const p = Ze(e.zoom === void 0 ? null : String(e.zoom));
|
|
246
|
+
p !== me && o.set($.zoom, String(p)), e.rotated && o.set($.rotated, "1"), Te(o, e.handoff);
|
|
247
247
|
const m = o.toString();
|
|
248
248
|
return m ? `?${m}` : "";
|
|
249
249
|
}
|
|
250
250
|
function Ge(e, t = {}) {
|
|
251
|
-
const s = !!t.frame, [o, r] =
|
|
251
|
+
const s = !!t.frame, [o, r] = V(() => ke()), i = q(o), l = U((w) => {
|
|
252
252
|
i.current = w, r(w);
|
|
253
253
|
}, []);
|
|
254
254
|
I(() => {
|
|
255
|
-
const w = () => l(
|
|
255
|
+
const w = () => l(ke());
|
|
256
256
|
return window.addEventListener("popstate", w), () => window.removeEventListener("popstate", w);
|
|
257
257
|
}, [l]), I(() => {
|
|
258
258
|
if (!s || window.parent === window) return;
|
|
259
|
-
const w = window.location.origin,
|
|
260
|
-
const
|
|
261
|
-
if (
|
|
262
|
-
const { path:
|
|
263
|
-
window.history.replaceState(null, "",
|
|
259
|
+
const w = window.location.origin, u = (b) => {
|
|
260
|
+
const y = Be(b, { origin: w, source: window.parent });
|
|
261
|
+
if (y?.type !== "location") return;
|
|
262
|
+
const { path: _, search: z } = Ne(y.url);
|
|
263
|
+
window.history.replaceState(null, "", ue(_, z)), l({ path: _, search: z });
|
|
264
264
|
};
|
|
265
|
-
window.addEventListener("message",
|
|
266
|
-
const
|
|
265
|
+
window.addEventListener("message", u);
|
|
266
|
+
const C = ke();
|
|
267
267
|
return ae(
|
|
268
268
|
window.parent,
|
|
269
|
-
{ ds: 1, type: "ready", url:
|
|
269
|
+
{ ds: 1, type: "ready", url: ue(C.path, C.search) },
|
|
270
270
|
w
|
|
271
|
-
), () => window.removeEventListener("message",
|
|
271
|
+
), () => window.removeEventListener("message", u);
|
|
272
272
|
}, [s, l]);
|
|
273
273
|
const a = D(
|
|
274
274
|
() => $e(o.search, e, o.path),
|
|
275
275
|
[o.path, o.search, e]
|
|
276
|
-
),
|
|
277
|
-
(w,
|
|
276
|
+
), p = U(
|
|
277
|
+
(w, u, C = !1) => {
|
|
278
278
|
if (s) {
|
|
279
|
-
const
|
|
280
|
-
window.history.replaceState(null, "",
|
|
279
|
+
const y = ue(w, u), _ = Ne(y);
|
|
280
|
+
window.history.replaceState(null, "", y), l(_), ae(
|
|
281
281
|
window.parent === window ? void 0 : window.parent,
|
|
282
|
-
{ ds: 1, type: "navigate", url:
|
|
282
|
+
{ ds: 1, type: "navigate", url: y, replace: C },
|
|
283
283
|
window.location.origin
|
|
284
284
|
);
|
|
285
285
|
return;
|
|
286
286
|
}
|
|
287
|
-
const
|
|
288
|
-
|
|
287
|
+
const b = `${w}${u}`;
|
|
288
|
+
C ? window.history.replaceState(null, "", b) : window.history.pushState(null, "", b), l({ path: w, search: u });
|
|
289
289
|
},
|
|
290
290
|
[s, l]
|
|
291
291
|
), m = U(() => {
|
|
292
292
|
const w = i.current;
|
|
293
293
|
return w === o ? a : $e(w.search, e, w.path);
|
|
294
|
-
}, [a, o, e]),
|
|
294
|
+
}, [a, o, e]), h = U(
|
|
295
295
|
(w) => {
|
|
296
|
-
const
|
|
297
|
-
|
|
296
|
+
const u = i.current, C = { ...m(), ...w }, b = se(C, e, u.path);
|
|
297
|
+
b !== u.search && p(u.path, b, !0);
|
|
298
298
|
},
|
|
299
|
-
[m,
|
|
299
|
+
[m, p, e]
|
|
300
300
|
), d = U(
|
|
301
301
|
(w) => {
|
|
302
|
-
const
|
|
303
|
-
Object.entries(w).some(([
|
|
302
|
+
const u = m().screenControls ?? {};
|
|
303
|
+
Object.entries(w).some(([b, y]) => u[b] !== y) && h({ screenControls: { ...u, ...w } });
|
|
304
304
|
},
|
|
305
|
-
[m,
|
|
306
|
-
),
|
|
307
|
-
(w,
|
|
308
|
-
const
|
|
309
|
-
controls:
|
|
305
|
+
[m, h]
|
|
306
|
+
), f = U(
|
|
307
|
+
(w, u) => {
|
|
308
|
+
const C = xt(w, i.current, e, {
|
|
309
|
+
controls: u?.controls
|
|
310
310
|
});
|
|
311
|
-
|
|
311
|
+
p(C.path, C.search, u?.replace ?? !1);
|
|
312
312
|
},
|
|
313
|
-
[
|
|
314
|
-
),
|
|
313
|
+
[p, e]
|
|
314
|
+
), k = U(
|
|
315
315
|
(w) => {
|
|
316
|
-
const
|
|
317
|
-
if (!
|
|
318
|
-
const
|
|
316
|
+
const u = e.scenario(w);
|
|
317
|
+
if (!u || !oe(a.handoff, w)) return;
|
|
318
|
+
const C = {
|
|
319
319
|
...a,
|
|
320
|
-
scenario:
|
|
320
|
+
scenario: u.id,
|
|
321
321
|
component: void 0,
|
|
322
|
-
persona:
|
|
323
|
-
fixture:
|
|
324
|
-
network:
|
|
322
|
+
persona: u.persona,
|
|
323
|
+
fixture: u.fixture,
|
|
324
|
+
network: u.network ?? "success",
|
|
325
325
|
// Os controles voltam ao que o cenário fixa, sobre os padrões da tela.
|
|
326
326
|
screenControls: void 0
|
|
327
327
|
};
|
|
328
|
-
|
|
328
|
+
p(u.route, se(C, e, u.route), !1);
|
|
329
329
|
},
|
|
330
|
-
[a,
|
|
331
|
-
),
|
|
332
|
-
(w,
|
|
333
|
-
const
|
|
334
|
-
if (!
|
|
335
|
-
const
|
|
330
|
+
[a, p, e]
|
|
331
|
+
), g = U(
|
|
332
|
+
(w, u) => {
|
|
333
|
+
const C = e.component(w);
|
|
334
|
+
if (!C || !ve(a.handoff, w)) return;
|
|
335
|
+
const b = {
|
|
336
336
|
...a,
|
|
337
337
|
scenario: void 0,
|
|
338
|
-
component:
|
|
338
|
+
component: C.id,
|
|
339
339
|
persona: void 0,
|
|
340
340
|
fixture: void 0,
|
|
341
341
|
network: "success",
|
|
342
342
|
screenControls: void 0
|
|
343
343
|
};
|
|
344
|
-
|
|
344
|
+
b.fixture = e.componentFixture(C.id, C.defaultFixture)?.id ?? C.fixtures?.[0]?.id, p("/", se(b, e), u?.replace ?? !1);
|
|
345
345
|
},
|
|
346
|
-
[a,
|
|
347
|
-
),
|
|
348
|
-
(w,
|
|
349
|
-
const
|
|
350
|
-
if (!
|
|
351
|
-
const
|
|
352
|
-
if (
|
|
353
|
-
const
|
|
346
|
+
[a, p, e]
|
|
347
|
+
), L = U(
|
|
348
|
+
(w, u) => {
|
|
349
|
+
const C = e.screensFor({ handoff: a.handoff }).find((_) => _.id === w);
|
|
350
|
+
if (!C) return;
|
|
351
|
+
const b = C.variations[0];
|
|
352
|
+
if (b) {
|
|
353
|
+
const _ = {
|
|
354
354
|
...a,
|
|
355
|
-
scenario:
|
|
355
|
+
scenario: b.id,
|
|
356
356
|
component: void 0,
|
|
357
|
-
persona:
|
|
358
|
-
fixture:
|
|
359
|
-
network:
|
|
357
|
+
persona: b.persona,
|
|
358
|
+
fixture: b.fixture,
|
|
359
|
+
network: b.network ?? "success",
|
|
360
360
|
screenControls: void 0
|
|
361
361
|
};
|
|
362
|
-
|
|
362
|
+
p(b.route, se(_, e, b.route), u?.replace ?? !1);
|
|
363
363
|
return;
|
|
364
364
|
}
|
|
365
|
-
const
|
|
365
|
+
const y = {
|
|
366
366
|
...a,
|
|
367
367
|
scenario: void 0,
|
|
368
368
|
component: void 0,
|
|
@@ -371,52 +371,52 @@ function Ge(e, t = {}) {
|
|
|
371
371
|
network: "success",
|
|
372
372
|
screenControls: void 0
|
|
373
373
|
};
|
|
374
|
-
|
|
374
|
+
p(C.href, se(y, e, C.href), u?.replace ?? !1);
|
|
375
375
|
},
|
|
376
|
-
[a,
|
|
377
|
-
),
|
|
378
|
-
(w,
|
|
379
|
-
[
|
|
380
|
-
),
|
|
376
|
+
[a, p, e]
|
|
377
|
+
), P = U(
|
|
378
|
+
(w, u, C) => p(w || "/", u, C?.replace ?? !1),
|
|
379
|
+
[p]
|
|
380
|
+
), N = D(() => yt(a), [a]);
|
|
381
381
|
return {
|
|
382
382
|
location: o,
|
|
383
383
|
controls: a,
|
|
384
|
-
viewport:
|
|
385
|
-
setControls:
|
|
384
|
+
viewport: N,
|
|
385
|
+
setControls: h,
|
|
386
386
|
setScreenControls: d,
|
|
387
|
-
navigate:
|
|
388
|
-
openScenario:
|
|
389
|
-
openComponent:
|
|
390
|
-
openScreen:
|
|
391
|
-
go:
|
|
387
|
+
navigate: f,
|
|
388
|
+
openScenario: k,
|
|
389
|
+
openComponent: g,
|
|
390
|
+
openScreen: L,
|
|
391
|
+
go: P
|
|
392
392
|
};
|
|
393
393
|
}
|
|
394
|
-
function
|
|
395
|
-
const r = e.split("#")[0] ?? e, i = r.indexOf("?"), l = (i === -1 ? r : r.slice(0, i)) || "/", a = i === -1 ? void 0 : r.slice(i + 1),
|
|
396
|
-
let
|
|
394
|
+
function xt(e, t, s, o = {}) {
|
|
395
|
+
const r = e.split("#")[0] ?? e, i = r.indexOf("?"), l = (i === -1 ? r : r.slice(0, i)) || "/", a = i === -1 ? void 0 : r.slice(i + 1), p = new URLSearchParams(t.search), m = $e(t.search, s, t.path);
|
|
396
|
+
let h;
|
|
397
397
|
if (a === void 0 && o.controls === void 0)
|
|
398
|
-
|
|
398
|
+
h = new URLSearchParams(t.search), s.screenForPath(l)?.id !== s.screenForPath(t.path)?.id && pt(h);
|
|
399
399
|
else {
|
|
400
|
-
const
|
|
401
|
-
|
|
402
|
-
for (const [
|
|
403
|
-
!
|
|
404
|
-
m.scenario && !
|
|
405
|
-
for (const [
|
|
400
|
+
const f = new URLSearchParams(a ?? "");
|
|
401
|
+
h = new URLSearchParams();
|
|
402
|
+
for (const [k, g] of p)
|
|
403
|
+
!Nt(k) || f.has(k) || h.append(k, g);
|
|
404
|
+
m.scenario && !f.has($.scenario) && m.persona && m.persona !== s.defaultPersona && !h.has($.persona) && !f.has($.persona) && h.set($.persona, m.persona);
|
|
405
|
+
for (const [k, g] of f) h.append(k, g);
|
|
406
406
|
if (o.controls) {
|
|
407
|
-
const
|
|
408
|
-
for (const [
|
|
409
|
-
const
|
|
410
|
-
|
|
407
|
+
const k = s.screenForPath(l), g = s.scenario(h.get($.scenario) ?? void 0), L = g && k && s.screenOf(g)?.id === k.id ? g : void 0, P = k ? s.resolveControls(k, { scenario: L }).values : {};
|
|
408
|
+
for (const [N, w] of Object.entries(o.controls)) {
|
|
409
|
+
const u = `${be}${N}`;
|
|
410
|
+
P[N] === w ? h.delete(u) : h.set(u, w);
|
|
411
411
|
}
|
|
412
412
|
}
|
|
413
413
|
}
|
|
414
|
-
m.handoff && Te(
|
|
415
|
-
const d =
|
|
414
|
+
m.handoff && Te(h, m.handoff);
|
|
415
|
+
const d = h.toString();
|
|
416
416
|
return { path: l, search: d ? `?${d}` : "" };
|
|
417
417
|
}
|
|
418
|
-
function
|
|
419
|
-
return e.startsWith(
|
|
418
|
+
function Nt(e) {
|
|
419
|
+
return e.startsWith(be) ? !1 : e !== $.scenario && e !== $.fixture && e !== $.component;
|
|
420
420
|
}
|
|
421
421
|
function yt(e) {
|
|
422
422
|
if (e.viewport === "custom")
|
|
@@ -428,11 +428,11 @@ function yt(e) {
|
|
|
428
428
|
return e.rotated && t.width && t.height ? { ...t, width: t.height, height: t.width } : { ...t };
|
|
429
429
|
}
|
|
430
430
|
function Ze(e) {
|
|
431
|
-
if (e === null) return
|
|
431
|
+
if (e === null) return me;
|
|
432
432
|
const t = Number.parseInt(e, 10);
|
|
433
|
-
return Number.isFinite(t) ? Math.min(Ee, Math.max(Pe, t)) :
|
|
433
|
+
return Number.isFinite(t) ? Math.min(Ee, Math.max(Pe, t)) : me;
|
|
434
434
|
}
|
|
435
|
-
function
|
|
435
|
+
function ke() {
|
|
436
436
|
return typeof window > "u" ? { path: "/", search: "" } : { path: window.location.pathname, search: window.location.search };
|
|
437
437
|
}
|
|
438
438
|
function $t(e) {
|
|
@@ -449,51 +449,52 @@ function Tt(e) {
|
|
|
449
449
|
const t = Number.parseInt(e, 10);
|
|
450
450
|
return Number.isFinite(t) && t > 0 ? t : void 0;
|
|
451
451
|
}
|
|
452
|
-
const Pt = "@brucesantos/design-space", Fe = "0.9.
|
|
453
|
-
mobile: /* @__PURE__ */
|
|
452
|
+
const Pt = "@brucesantos/design-space", Fe = "0.9.2", Et = {
|
|
453
|
+
mobile: /* @__PURE__ */ S(Y, { children: [
|
|
454
454
|
/* @__PURE__ */ n("rect", { x: "7", y: "2.5", width: "10", height: "19", rx: "2" }),
|
|
455
455
|
/* @__PURE__ */ n("path", { d: "M11 18.5h2" })
|
|
456
456
|
] }),
|
|
457
|
-
tablet: /* @__PURE__ */
|
|
457
|
+
tablet: /* @__PURE__ */ S(Y, { children: [
|
|
458
458
|
/* @__PURE__ */ n("rect", { x: "4.5", y: "2.5", width: "15", height: "19", rx: "2" }),
|
|
459
459
|
/* @__PURE__ */ n("path", { d: "M11 18.5h2" })
|
|
460
460
|
] }),
|
|
461
|
-
desktop: /* @__PURE__ */
|
|
461
|
+
desktop: /* @__PURE__ */ S(Y, { children: [
|
|
462
462
|
/* @__PURE__ */ n("rect", { x: "2.5", y: "4", width: "19", height: "12.5", rx: "1.5" }),
|
|
463
463
|
/* @__PURE__ */ n("path", { d: "M8.5 20.5h7M12 16.5v4" })
|
|
464
464
|
] }),
|
|
465
465
|
fit: /* @__PURE__ */ n("path", { d: "M3 12h7M3 12l3-3M3 12l3 3M21 12h-7M21 12l-3-3M21 12l-3 3" }),
|
|
466
|
-
rotate: /* @__PURE__ */
|
|
466
|
+
rotate: /* @__PURE__ */ S(Y, { children: [
|
|
467
467
|
/* @__PURE__ */ n("path", { d: "M20 12a8 8 0 1 1-2.34-5.66" }),
|
|
468
468
|
/* @__PURE__ */ n("path", { d: "M20 4v4.5h-4.5" })
|
|
469
469
|
] }),
|
|
470
470
|
minus: /* @__PURE__ */ n("path", { d: "M5 12h14" }),
|
|
471
471
|
plus: /* @__PURE__ */ n("path", { d: "M5 12h14M12 5v14" }),
|
|
472
|
-
|
|
472
|
+
"arrow-up-right": /* @__PURE__ */ n("path", { d: "M7 17 17 7M8 7h9v9" }),
|
|
473
|
+
link: /* @__PURE__ */ S(Y, { children: [
|
|
473
474
|
/* @__PURE__ */ n("path", { d: "M10 14a4 4 0 0 0 5.66 0l3-3a4 4 0 0 0-5.66-5.66l-1 1" }),
|
|
474
475
|
/* @__PURE__ */ n("path", { d: "M14 10a4 4 0 0 0-5.66 0l-3 3a4 4 0 0 0 5.66 5.66l1-1" })
|
|
475
476
|
] }),
|
|
476
477
|
check: /* @__PURE__ */ n("path", { d: "M5 12.5l4.5 4.5L19 7.5" }),
|
|
477
478
|
fullscreen: /* @__PURE__ */ n("path", { d: "M4 9V4h5M15 4h5v5M20 15v5h-5M9 20H4v-5" }),
|
|
478
|
-
sun: /* @__PURE__ */
|
|
479
|
+
sun: /* @__PURE__ */ S(Y, { children: [
|
|
479
480
|
/* @__PURE__ */ n("circle", { cx: "12", cy: "12", r: "4" }),
|
|
480
481
|
/* @__PURE__ */ n("path", { d: "M12 2.5v2M12 19.5v2M4.6 4.6 6 6M18 18l1.4 1.4M2.5 12h2M19.5 12h2M4.6 19.4 6 18M18 6l1.4-1.4" })
|
|
481
482
|
] }),
|
|
482
483
|
moon: /* @__PURE__ */ n("path", { d: "M20 14.5A8 8 0 1 1 9.5 4a6.5 6.5 0 0 0 10.5 10.5Z" }),
|
|
483
|
-
panel: /* @__PURE__ */
|
|
484
|
+
panel: /* @__PURE__ */ S(Y, { children: [
|
|
484
485
|
/* @__PURE__ */ n("rect", { x: "3", y: "4", width: "18", height: "16", rx: "2" }),
|
|
485
486
|
/* @__PURE__ */ n("path", { d: "M15 4v16" })
|
|
486
487
|
] }),
|
|
487
|
-
alert: /* @__PURE__ */
|
|
488
|
+
alert: /* @__PURE__ */ S(Y, { children: [
|
|
488
489
|
/* @__PURE__ */ n("circle", { cx: "12", cy: "12", r: "9" }),
|
|
489
490
|
/* @__PURE__ */ n("path", { d: "M12 7.5v5.5M12 16.2v.3" })
|
|
490
491
|
] }),
|
|
491
492
|
chevron: /* @__PURE__ */ n("path", { d: "M9 6l6 6-6 6" }),
|
|
492
|
-
search: /* @__PURE__ */
|
|
493
|
+
search: /* @__PURE__ */ S(Y, { children: [
|
|
493
494
|
/* @__PURE__ */ n("circle", { cx: "11", cy: "11", r: "6.5" }),
|
|
494
495
|
/* @__PURE__ */ n("path", { d: "M20 20l-4.2-4.2" })
|
|
495
496
|
] }),
|
|
496
|
-
copy: /* @__PURE__ */
|
|
497
|
+
copy: /* @__PURE__ */ S(Y, { children: [
|
|
497
498
|
/* @__PURE__ */ n("rect", { x: "8.5", y: "8.5", width: "12", height: "12", rx: "2" }),
|
|
498
499
|
/* @__PURE__ */ n("path", { d: "M15.5 8.5V5.5a2 2 0 0 0-2-2h-8a2 2 0 0 0-2 2v8a2 2 0 0 0 2 2h3" })
|
|
499
500
|
] })
|
|
@@ -578,6 +579,7 @@ const ne = {
|
|
|
578
579
|
infoTab: "Informações",
|
|
579
580
|
resize: "Redimensionar o painel",
|
|
580
581
|
variationsList: "Variações da tela",
|
|
582
|
+
componentVariations: "Variações do componente",
|
|
581
583
|
defaultVariation: "Padrão",
|
|
582
584
|
defaultVariationHint: "A tela sem cenário declarado, sem fixture.",
|
|
583
585
|
noVariations: "Esta tela não tem variações.",
|
|
@@ -657,7 +659,7 @@ const ne = {
|
|
|
657
659
|
empty: "Nada para mostrar ainda",
|
|
658
660
|
emptyHint: "O produto ainda não registrou telas nem componentes."
|
|
659
661
|
}
|
|
660
|
-
},
|
|
662
|
+
}, cn = {
|
|
661
663
|
network: {
|
|
662
664
|
success: "Success",
|
|
663
665
|
loading: "Loading",
|
|
@@ -718,6 +720,7 @@ const ne = {
|
|
|
718
720
|
infoTab: "Information",
|
|
719
721
|
resize: "Resize panel",
|
|
720
722
|
variationsList: "Screen variations",
|
|
723
|
+
componentVariations: "Component variations",
|
|
721
724
|
defaultVariation: "Default",
|
|
722
725
|
defaultVariationHint: "The screen without a declared scenario or fixture.",
|
|
723
726
|
noVariations: "This screen has no variations.",
|
|
@@ -808,10 +811,10 @@ function Rt(e) {
|
|
|
808
811
|
return t;
|
|
809
812
|
}
|
|
810
813
|
const Ye = lt(ne);
|
|
811
|
-
function
|
|
814
|
+
function J() {
|
|
812
815
|
return ct(Ye);
|
|
813
816
|
}
|
|
814
|
-
const
|
|
817
|
+
const ln = ne.network, _t = [
|
|
815
818
|
{ id: "mobile", icon: "mobile" },
|
|
816
819
|
{ id: "tablet", icon: "tablet" },
|
|
817
820
|
{ id: "desktop", icon: "desktop" },
|
|
@@ -829,22 +832,22 @@ function Ft({
|
|
|
829
832
|
theme: i,
|
|
830
833
|
issues: l,
|
|
831
834
|
linkUrl: a,
|
|
832
|
-
onViewport:
|
|
835
|
+
onViewport: p,
|
|
833
836
|
onRotate: m,
|
|
834
|
-
onZoom:
|
|
837
|
+
onZoom: h,
|
|
835
838
|
onCleanReview: d,
|
|
836
|
-
onToggleTheme:
|
|
839
|
+
onToggleTheme: f
|
|
837
840
|
}) {
|
|
838
|
-
const
|
|
841
|
+
const k = J(), g = k.topbar, [L, P] = V(!1), N = (t === "mobile" || t === "tablet") && !!(s.width && s.height), w = async () => {
|
|
839
842
|
try {
|
|
840
843
|
await navigator.clipboard.writeText(a);
|
|
841
844
|
} catch {
|
|
842
|
-
window.prompt(
|
|
845
|
+
window.prompt(g.copyPrompt, a);
|
|
843
846
|
}
|
|
844
|
-
|
|
847
|
+
P(!0), window.setTimeout(() => P(!1), 1600);
|
|
845
848
|
};
|
|
846
|
-
return /* @__PURE__ */
|
|
847
|
-
/* @__PURE__ */
|
|
849
|
+
return /* @__PURE__ */ S("header", { className: "ds-topbar", "aria-label": g.region, children: [
|
|
850
|
+
/* @__PURE__ */ S("div", { className: "ds-topbar__product", children: [
|
|
848
851
|
/* @__PURE__ */ n("span", { className: "ds-topbar__name", children: e }),
|
|
849
852
|
/* @__PURE__ */ n(
|
|
850
853
|
"a",
|
|
@@ -853,26 +856,26 @@ function Ft({
|
|
|
853
856
|
href: `https://www.npmjs.com/package/${Pt}/v/${Fe}`,
|
|
854
857
|
target: "_blank",
|
|
855
858
|
rel: "noreferrer",
|
|
856
|
-
children:
|
|
859
|
+
children: g.engineVersion(Fe)
|
|
857
860
|
}
|
|
858
861
|
)
|
|
859
862
|
] }),
|
|
860
|
-
/* @__PURE__ */
|
|
861
|
-
/* @__PURE__ */
|
|
862
|
-
_t.map((
|
|
863
|
-
const
|
|
863
|
+
/* @__PURE__ */ S("div", { className: "ds-topbar__view", children: [
|
|
864
|
+
/* @__PURE__ */ S("div", { className: "ds-group", role: "group", "aria-label": g.viewportGroup, children: [
|
|
865
|
+
_t.map((u) => {
|
|
866
|
+
const C = k.viewport[u.id] ?? u.id;
|
|
864
867
|
return /* @__PURE__ */ n(
|
|
865
868
|
"button",
|
|
866
869
|
{
|
|
867
870
|
type: "button",
|
|
868
871
|
className: "ds-btn ds-btn--icon",
|
|
869
|
-
"aria-pressed": t ===
|
|
870
|
-
"aria-label":
|
|
871
|
-
title:
|
|
872
|
-
onClick: () =>
|
|
873
|
-
children: /* @__PURE__ */ n(H, { name:
|
|
872
|
+
"aria-pressed": t === u.id,
|
|
873
|
+
"aria-label": C,
|
|
874
|
+
title: C,
|
|
875
|
+
onClick: () => p(u.id),
|
|
876
|
+
children: /* @__PURE__ */ n(H, { name: u.icon })
|
|
874
877
|
},
|
|
875
|
-
|
|
878
|
+
u.id
|
|
876
879
|
);
|
|
877
880
|
}),
|
|
878
881
|
/* @__PURE__ */ n(
|
|
@@ -881,24 +884,24 @@ function Ft({
|
|
|
881
884
|
type: "button",
|
|
882
885
|
className: "ds-btn ds-btn--icon",
|
|
883
886
|
"aria-pressed": r,
|
|
884
|
-
"aria-label":
|
|
885
|
-
title:
|
|
886
|
-
disabled: !
|
|
887
|
+
"aria-label": g.rotate,
|
|
888
|
+
title: g.rotate,
|
|
889
|
+
disabled: !N,
|
|
887
890
|
onClick: m,
|
|
888
891
|
children: /* @__PURE__ */ n(H, { name: "rotate" })
|
|
889
892
|
}
|
|
890
893
|
)
|
|
891
894
|
] }),
|
|
892
|
-
/* @__PURE__ */
|
|
895
|
+
/* @__PURE__ */ S("div", { className: "ds-group", role: "group", children: [
|
|
893
896
|
/* @__PURE__ */ n(
|
|
894
897
|
"button",
|
|
895
898
|
{
|
|
896
899
|
type: "button",
|
|
897
900
|
className: "ds-btn ds-btn--icon",
|
|
898
|
-
"aria-label":
|
|
899
|
-
title:
|
|
901
|
+
"aria-label": g.zoomOut,
|
|
902
|
+
title: g.zoomOut,
|
|
900
903
|
disabled: o <= Pe,
|
|
901
|
-
onClick: () =>
|
|
904
|
+
onClick: () => h(ze(o, -1)),
|
|
902
905
|
children: /* @__PURE__ */ n(H, { name: "minus" })
|
|
903
906
|
}
|
|
904
907
|
),
|
|
@@ -907,10 +910,10 @@ function Ft({
|
|
|
907
910
|
{
|
|
908
911
|
type: "button",
|
|
909
912
|
className: "ds-btn ds-btn--zoom",
|
|
910
|
-
"aria-label":
|
|
911
|
-
title:
|
|
912
|
-
onClick: () =>
|
|
913
|
-
children:
|
|
913
|
+
"aria-label": g.zoomReset,
|
|
914
|
+
title: g.zoomReset,
|
|
915
|
+
onClick: () => h(me),
|
|
916
|
+
children: g.zoomValue(o)
|
|
914
917
|
}
|
|
915
918
|
),
|
|
916
919
|
/* @__PURE__ */ n(
|
|
@@ -918,10 +921,10 @@ function Ft({
|
|
|
918
921
|
{
|
|
919
922
|
type: "button",
|
|
920
923
|
className: "ds-btn ds-btn--icon",
|
|
921
|
-
"aria-label":
|
|
922
|
-
title:
|
|
924
|
+
"aria-label": g.zoomIn,
|
|
925
|
+
title: g.zoomIn,
|
|
923
926
|
disabled: o >= Ee,
|
|
924
|
-
onClick: () =>
|
|
927
|
+
onClick: () => h(ze(o, 1)),
|
|
925
928
|
children: /* @__PURE__ */ n(H, { name: "plus" })
|
|
926
929
|
}
|
|
927
930
|
)
|
|
@@ -931,23 +934,23 @@ function Ft({
|
|
|
931
934
|
{
|
|
932
935
|
type: "button",
|
|
933
936
|
className: "ds-btn ds-btn--icon",
|
|
934
|
-
"aria-label":
|
|
935
|
-
title:
|
|
937
|
+
"aria-label": g.cleanReview,
|
|
938
|
+
title: g.cleanReview,
|
|
936
939
|
onClick: d,
|
|
937
940
|
children: /* @__PURE__ */ n(H, { name: "fullscreen" })
|
|
938
941
|
}
|
|
939
942
|
)
|
|
940
943
|
] }),
|
|
941
|
-
/* @__PURE__ */
|
|
944
|
+
/* @__PURE__ */ S("div", { className: "ds-topbar__tools", children: [
|
|
942
945
|
/* @__PURE__ */ n(
|
|
943
946
|
"button",
|
|
944
947
|
{
|
|
945
948
|
type: "button",
|
|
946
949
|
className: "ds-btn ds-btn--icon",
|
|
947
|
-
"aria-label":
|
|
948
|
-
title:
|
|
950
|
+
"aria-label": L ? g.copied : g.copyLink,
|
|
951
|
+
title: L ? g.copied : g.copyLink,
|
|
949
952
|
onClick: w,
|
|
950
|
-
children: /* @__PURE__ */ n(H, { name:
|
|
953
|
+
children: /* @__PURE__ */ n(H, { name: L ? "check" : "link" })
|
|
951
954
|
}
|
|
952
955
|
),
|
|
953
956
|
/* @__PURE__ */ n(
|
|
@@ -955,9 +958,9 @@ function Ft({
|
|
|
955
958
|
{
|
|
956
959
|
type: "button",
|
|
957
960
|
className: "ds-btn ds-btn--icon",
|
|
958
|
-
"aria-label": i === "dark" ?
|
|
959
|
-
title: i === "dark" ?
|
|
960
|
-
onClick:
|
|
961
|
+
"aria-label": i === "dark" ? g.lightMode : g.darkMode,
|
|
962
|
+
title: i === "dark" ? g.lightMode : g.darkMode,
|
|
963
|
+
onClick: f,
|
|
961
964
|
children: /* @__PURE__ */ n(H, { name: i === "dark" ? "sun" : "moon" })
|
|
962
965
|
}
|
|
963
966
|
),
|
|
@@ -966,19 +969,19 @@ function Ft({
|
|
|
966
969
|
] });
|
|
967
970
|
}
|
|
968
971
|
function Ot({ issues: e }) {
|
|
969
|
-
const t =
|
|
972
|
+
const t = J(), [s, o] = V(!1), r = q(null), i = e.filter((p) => p.level === "error").length, l = e.length - i, a = t.topbar.diagnostics(i, l);
|
|
970
973
|
return I(() => {
|
|
971
974
|
if (!s) return;
|
|
972
|
-
const
|
|
973
|
-
r.current?.contains(
|
|
974
|
-
}, m = (
|
|
975
|
-
|
|
975
|
+
const p = (h) => {
|
|
976
|
+
r.current?.contains(h.target) || o(!1);
|
|
977
|
+
}, m = (h) => {
|
|
978
|
+
h.key === "Escape" && o(!1);
|
|
976
979
|
};
|
|
977
|
-
return window.addEventListener("pointerdown",
|
|
978
|
-
window.removeEventListener("pointerdown",
|
|
980
|
+
return window.addEventListener("pointerdown", p), window.addEventListener("keydown", m), () => {
|
|
981
|
+
window.removeEventListener("pointerdown", p), window.removeEventListener("keydown", m);
|
|
979
982
|
};
|
|
980
|
-
}, [s]), /* @__PURE__ */
|
|
981
|
-
/* @__PURE__ */
|
|
983
|
+
}, [s]), /* @__PURE__ */ S("div", { className: "ds-diagnostics", ref: r, children: [
|
|
984
|
+
/* @__PURE__ */ S(
|
|
982
985
|
"button",
|
|
983
986
|
{
|
|
984
987
|
type: "button",
|
|
@@ -987,40 +990,40 @@ function Ot({ issues: e }) {
|
|
|
987
990
|
"aria-expanded": s,
|
|
988
991
|
"aria-label": a,
|
|
989
992
|
title: a,
|
|
990
|
-
onClick: () => o((
|
|
993
|
+
onClick: () => o((p) => !p),
|
|
991
994
|
children: [
|
|
992
995
|
/* @__PURE__ */ n(H, { name: "alert" }),
|
|
993
996
|
/* @__PURE__ */ n("span", { children: i > 0 ? i : l })
|
|
994
997
|
]
|
|
995
998
|
}
|
|
996
999
|
),
|
|
997
|
-
s && /* @__PURE__ */
|
|
998
|
-
/* @__PURE__ */
|
|
1000
|
+
s && /* @__PURE__ */ S("div", { className: "ds-diagnostics__popover", role: "dialog", "aria-label": t.diagnostics.title, children: [
|
|
1001
|
+
/* @__PURE__ */ S("div", { className: "ds-diagnostics__head", children: [
|
|
999
1002
|
/* @__PURE__ */ n("strong", { children: t.diagnostics.title }),
|
|
1000
1003
|
/* @__PURE__ */ n("span", { className: "ds-muted", children: a })
|
|
1001
1004
|
] }),
|
|
1002
|
-
/* @__PURE__ */ n("ul", { className: "ds-diagnostics__list", children: e.map((
|
|
1003
|
-
/* @__PURE__ */ n("span", { className: "ds-diagnostics__level", children:
|
|
1004
|
-
/* @__PURE__ */ n("code", { className: "ds-diagnostics__where", children:
|
|
1005
|
-
/* @__PURE__ */ n("span", { className: "ds-diagnostics__message", children:
|
|
1006
|
-
] }, `${
|
|
1005
|
+
/* @__PURE__ */ n("ul", { className: "ds-diagnostics__list", children: e.map((p, m) => /* @__PURE__ */ S("li", { className: "ds-diagnostics__item", "data-level": p.level, children: [
|
|
1006
|
+
/* @__PURE__ */ n("span", { className: "ds-diagnostics__level", children: p.level === "error" ? t.diagnostics.error : t.diagnostics.warning }),
|
|
1007
|
+
/* @__PURE__ */ n("code", { className: "ds-diagnostics__where", children: p.where }),
|
|
1008
|
+
/* @__PURE__ */ n("span", { className: "ds-diagnostics__message", children: p.message })
|
|
1009
|
+
] }, `${p.where}-${m}`)) })
|
|
1007
1010
|
] })
|
|
1008
1011
|
] });
|
|
1009
1012
|
}
|
|
1010
1013
|
const zt = 16;
|
|
1011
1014
|
function Xe({ side: e, label: t, value: s, onChange: o, onStart: r, onEnd: i }) {
|
|
1012
|
-
const l =
|
|
1013
|
-
if (
|
|
1014
|
-
|
|
1015
|
+
const l = q(void 0), a = e === "left" ? 1 : -1, p = (f) => {
|
|
1016
|
+
if (f.button === 0) {
|
|
1017
|
+
f.preventDefault(), l.current = { x: f.clientX, width: s };
|
|
1015
1018
|
try {
|
|
1016
|
-
|
|
1019
|
+
f.currentTarget.setPointerCapture(f.pointerId);
|
|
1017
1020
|
} catch {
|
|
1018
1021
|
}
|
|
1019
1022
|
r?.();
|
|
1020
1023
|
}
|
|
1021
|
-
}, m = (
|
|
1022
|
-
l.current && o(l.current.width + (
|
|
1023
|
-
},
|
|
1024
|
+
}, m = (f) => {
|
|
1025
|
+
l.current && o(l.current.width + (f.clientX - l.current.x) * a);
|
|
1026
|
+
}, h = () => {
|
|
1024
1027
|
l.current && (l.current = void 0, i?.());
|
|
1025
1028
|
};
|
|
1026
1029
|
return /* @__PURE__ */ n(
|
|
@@ -1033,16 +1036,16 @@ function Xe({ side: e, label: t, value: s, onChange: o, onStart: r, onEnd: i })
|
|
|
1033
1036
|
"aria-label": t,
|
|
1034
1037
|
"aria-valuenow": s,
|
|
1035
1038
|
tabIndex: 0,
|
|
1036
|
-
onPointerDown:
|
|
1039
|
+
onPointerDown: p,
|
|
1037
1040
|
onPointerMove: m,
|
|
1038
|
-
onPointerUp:
|
|
1039
|
-
onPointerCancel:
|
|
1040
|
-
onLostPointerCapture:
|
|
1041
|
-
onKeyDown: (
|
|
1042
|
-
if (
|
|
1043
|
-
|
|
1044
|
-
const
|
|
1045
|
-
o(s +
|
|
1041
|
+
onPointerUp: h,
|
|
1042
|
+
onPointerCancel: h,
|
|
1043
|
+
onLostPointerCapture: h,
|
|
1044
|
+
onKeyDown: (f) => {
|
|
1045
|
+
if (f.key !== "ArrowLeft" && f.key !== "ArrowRight") return;
|
|
1046
|
+
f.preventDefault();
|
|
1047
|
+
const k = f.key === "ArrowRight" ? 1 : -1;
|
|
1048
|
+
o(s + k * a * zt);
|
|
1046
1049
|
}
|
|
1047
1050
|
}
|
|
1048
1051
|
);
|
|
@@ -1056,74 +1059,74 @@ function At({
|
|
|
1056
1059
|
onOpenComponent: i,
|
|
1057
1060
|
width: l,
|
|
1058
1061
|
onResize: a,
|
|
1059
|
-
onResizeStart:
|
|
1062
|
+
onResizeStart: p,
|
|
1060
1063
|
onResizeEnd: m
|
|
1061
1064
|
}) {
|
|
1062
|
-
const d =
|
|
1063
|
-
() => o || !
|
|
1065
|
+
const d = J().sidebar, [f, k] = V(""), [g, L] = V(() => /* @__PURE__ */ new Set()), P = q(null), N = e.screensFor({ handoff: t }), w = e.componentsFor(t), u = N.length > 0, C = w.length > 0, [b, y] = V(
|
|
1066
|
+
() => o || !u ? "components" : "screens"
|
|
1064
1067
|
);
|
|
1065
1068
|
I(() => {
|
|
1066
|
-
o &&
|
|
1067
|
-
}, [o, s,
|
|
1068
|
-
const
|
|
1069
|
+
o && C ? y("components") : s && u && y("screens");
|
|
1070
|
+
}, [o, s, C, u]);
|
|
1071
|
+
const _ = b;
|
|
1069
1072
|
I(() => {
|
|
1070
|
-
const
|
|
1071
|
-
|
|
1073
|
+
const E = (K) => {
|
|
1074
|
+
Kt(K) && (K.preventDefault(), P.current?.focus(), P.current?.select());
|
|
1072
1075
|
};
|
|
1073
|
-
return window.addEventListener("keydown",
|
|
1076
|
+
return window.addEventListener("keydown", E), () => window.removeEventListener("keydown", E);
|
|
1074
1077
|
}, []);
|
|
1075
|
-
const
|
|
1076
|
-
() => e.searchScreens(
|
|
1077
|
-
[t,
|
|
1078
|
+
const z = D(
|
|
1079
|
+
() => e.searchScreens(f, { handoff: t }),
|
|
1080
|
+
[t, f, e]
|
|
1078
1081
|
), c = D(
|
|
1079
|
-
() => e.searchComponents(
|
|
1080
|
-
[t,
|
|
1081
|
-
),
|
|
1082
|
-
const
|
|
1083
|
-
return
|
|
1082
|
+
() => e.searchComponents(f, t),
|
|
1083
|
+
[t, f, e]
|
|
1084
|
+
), v = D(() => Vt(c, d.ungrouped), [c, d.ungrouped]), x = D(() => je(z), [z]), M = f.trim().length > 0, F = (E) => L((K) => {
|
|
1085
|
+
const T = new Set(K);
|
|
1086
|
+
return T.has(E) ? T.delete(E) : T.add(E), T;
|
|
1084
1087
|
});
|
|
1085
|
-
return /* @__PURE__ */
|
|
1086
|
-
/* @__PURE__ */
|
|
1088
|
+
return /* @__PURE__ */ S("nav", { className: "ds-sidebar", "aria-label": d.region, style: { width: l }, children: [
|
|
1089
|
+
/* @__PURE__ */ S("div", { className: "ds-search", children: [
|
|
1087
1090
|
/* @__PURE__ */ n(H, { name: "search", size: 14 }),
|
|
1088
1091
|
/* @__PURE__ */ n(
|
|
1089
1092
|
"input",
|
|
1090
1093
|
{
|
|
1091
|
-
ref:
|
|
1094
|
+
ref: P,
|
|
1092
1095
|
className: "ds-input ds-search__input",
|
|
1093
1096
|
type: "search",
|
|
1094
|
-
value:
|
|
1097
|
+
value: f,
|
|
1095
1098
|
placeholder: d.searchPlaceholder,
|
|
1096
1099
|
"aria-label": d.searchLabel,
|
|
1097
|
-
onChange: (
|
|
1098
|
-
onKeyDown: (
|
|
1099
|
-
|
|
1100
|
+
onChange: (E) => k(E.target.value),
|
|
1101
|
+
onKeyDown: (E) => {
|
|
1102
|
+
E.key === "Escape" && k("");
|
|
1100
1103
|
}
|
|
1101
1104
|
}
|
|
1102
1105
|
),
|
|
1103
1106
|
/* @__PURE__ */ n("kbd", { className: "ds-kbd", "aria-hidden": "true", children: d.searchShortcut })
|
|
1104
1107
|
] }),
|
|
1105
|
-
/* @__PURE__ */
|
|
1108
|
+
/* @__PURE__ */ S("div", { className: "ds-tabs", role: "tablist", "aria-label": d.tabs, children: [
|
|
1106
1109
|
/* @__PURE__ */ n(
|
|
1107
1110
|
Ae,
|
|
1108
1111
|
{
|
|
1109
|
-
selected:
|
|
1112
|
+
selected: _ === "screens",
|
|
1110
1113
|
label: d.screensTab,
|
|
1111
|
-
count:
|
|
1112
|
-
onSelect: () =>
|
|
1114
|
+
count: M ? z.length : void 0,
|
|
1115
|
+
onSelect: () => y("screens")
|
|
1113
1116
|
}
|
|
1114
1117
|
),
|
|
1115
1118
|
/* @__PURE__ */ n(
|
|
1116
1119
|
Ae,
|
|
1117
1120
|
{
|
|
1118
|
-
selected:
|
|
1121
|
+
selected: _ === "components",
|
|
1119
1122
|
label: d.componentsTab,
|
|
1120
|
-
count:
|
|
1121
|
-
onSelect: () =>
|
|
1123
|
+
count: M ? c.length : void 0,
|
|
1124
|
+
onSelect: () => y("components")
|
|
1122
1125
|
}
|
|
1123
1126
|
)
|
|
1124
1127
|
] }),
|
|
1125
|
-
/* @__PURE__ */ n("div", { className: "ds-sidebar__list", role: "tabpanel", children:
|
|
1126
|
-
const
|
|
1128
|
+
/* @__PURE__ */ n("div", { className: "ds-sidebar__list", role: "tabpanel", children: _ === "screens" ? u ? z.length === 0 ? /* @__PURE__ */ n("p", { className: "ds-empty", children: d.noMatch(f) }) : x.map((E) => {
|
|
1129
|
+
const K = /* @__PURE__ */ n("ul", { className: "ds-items", children: E.screens.map((A) => /* @__PURE__ */ n(
|
|
1127
1130
|
Dt,
|
|
1128
1131
|
{
|
|
1129
1132
|
screen: A,
|
|
@@ -1132,55 +1135,55 @@ function At({
|
|
|
1132
1135
|
},
|
|
1133
1136
|
A.id
|
|
1134
1137
|
)) });
|
|
1135
|
-
if (
|
|
1136
|
-
const
|
|
1137
|
-
return /* @__PURE__ */
|
|
1138
|
-
/* @__PURE__ */
|
|
1138
|
+
if (E.name === void 0) return /* @__PURE__ */ n("div", { className: "ds-group-section", children: K }, "");
|
|
1139
|
+
const T = `screens:${E.name}`, O = g.has(T) && !M;
|
|
1140
|
+
return /* @__PURE__ */ S("section", { className: "ds-group-section", children: [
|
|
1141
|
+
/* @__PURE__ */ S(
|
|
1139
1142
|
"button",
|
|
1140
1143
|
{
|
|
1141
1144
|
type: "button",
|
|
1142
1145
|
className: "ds-group-section__head",
|
|
1143
|
-
"aria-expanded": !
|
|
1144
|
-
"aria-label": d.toggleGroup(
|
|
1145
|
-
onClick: () =>
|
|
1146
|
+
"aria-expanded": !O,
|
|
1147
|
+
"aria-label": d.toggleGroup(E.name),
|
|
1148
|
+
onClick: () => F(T),
|
|
1146
1149
|
children: [
|
|
1147
1150
|
/* @__PURE__ */ n(H, { name: "chevron", size: 12 }),
|
|
1148
|
-
/* @__PURE__ */ n("span", { children:
|
|
1149
|
-
/* @__PURE__ */ n("span", { className: "ds-count", children:
|
|
1151
|
+
/* @__PURE__ */ n("span", { children: E.name }),
|
|
1152
|
+
/* @__PURE__ */ n("span", { className: "ds-count", children: E.screens.length })
|
|
1150
1153
|
]
|
|
1151
1154
|
}
|
|
1152
1155
|
),
|
|
1153
|
-
!
|
|
1154
|
-
] },
|
|
1155
|
-
}) : /* @__PURE__ */ n("p", { className: "ds-empty", children: d.emptyScreens }) :
|
|
1156
|
-
const
|
|
1157
|
-
return /* @__PURE__ */
|
|
1158
|
-
/* @__PURE__ */
|
|
1156
|
+
!O && K
|
|
1157
|
+
] }, T);
|
|
1158
|
+
}) : /* @__PURE__ */ n("p", { className: "ds-empty", children: d.emptyScreens }) : C ? c.length === 0 ? /* @__PURE__ */ n("p", { className: "ds-empty", children: d.noMatch(f) }) : v.map(({ group: E, items: K }) => {
|
|
1159
|
+
const T = g.has(E) && !M;
|
|
1160
|
+
return /* @__PURE__ */ S("section", { className: "ds-group-section", children: [
|
|
1161
|
+
/* @__PURE__ */ S(
|
|
1159
1162
|
"button",
|
|
1160
1163
|
{
|
|
1161
1164
|
type: "button",
|
|
1162
1165
|
className: "ds-group-section__head",
|
|
1163
|
-
"aria-expanded": !
|
|
1164
|
-
"aria-label": d.toggleGroup(
|
|
1165
|
-
onClick: () =>
|
|
1166
|
+
"aria-expanded": !T,
|
|
1167
|
+
"aria-label": d.toggleGroup(E),
|
|
1168
|
+
onClick: () => F(E),
|
|
1166
1169
|
children: [
|
|
1167
1170
|
/* @__PURE__ */ n(H, { name: "chevron", size: 12 }),
|
|
1168
|
-
/* @__PURE__ */ n("span", { children:
|
|
1169
|
-
/* @__PURE__ */ n("span", { className: "ds-count", children:
|
|
1171
|
+
/* @__PURE__ */ n("span", { children: E }),
|
|
1172
|
+
/* @__PURE__ */ n("span", { className: "ds-count", children: K.length })
|
|
1170
1173
|
]
|
|
1171
1174
|
}
|
|
1172
1175
|
),
|
|
1173
|
-
!
|
|
1176
|
+
!T && /* @__PURE__ */ n("ul", { className: "ds-items", children: K.map((O) => /* @__PURE__ */ n("li", { children: /* @__PURE__ */ n(
|
|
1174
1177
|
"button",
|
|
1175
1178
|
{
|
|
1176
1179
|
type: "button",
|
|
1177
1180
|
className: "ds-item",
|
|
1178
|
-
"aria-current":
|
|
1179
|
-
onClick: () => i(
|
|
1180
|
-
children: /* @__PURE__ */ n("span", { className: "ds-item__title", children:
|
|
1181
|
+
"aria-current": O.id === o ? "true" : void 0,
|
|
1182
|
+
onClick: () => i(O.id),
|
|
1183
|
+
children: /* @__PURE__ */ n("span", { className: "ds-item__title", children: O.name })
|
|
1181
1184
|
}
|
|
1182
|
-
) },
|
|
1183
|
-
] },
|
|
1185
|
+
) }, O.id)) })
|
|
1186
|
+
] }, E);
|
|
1184
1187
|
}) : /* @__PURE__ */ n("p", { className: "ds-empty", children: d.emptyComponents }) }),
|
|
1185
1188
|
/* @__PURE__ */ n(
|
|
1186
1189
|
Xe,
|
|
@@ -1189,7 +1192,7 @@ function At({
|
|
|
1189
1192
|
label: d.resize,
|
|
1190
1193
|
value: l,
|
|
1191
1194
|
onChange: a,
|
|
1192
|
-
onStart:
|
|
1195
|
+
onStart: p,
|
|
1193
1196
|
onEnd: m
|
|
1194
1197
|
}
|
|
1195
1198
|
)
|
|
@@ -1201,7 +1204,7 @@ function Ae({
|
|
|
1201
1204
|
count: s,
|
|
1202
1205
|
onSelect: o
|
|
1203
1206
|
}) {
|
|
1204
|
-
return /* @__PURE__ */
|
|
1207
|
+
return /* @__PURE__ */ S(
|
|
1205
1208
|
"button",
|
|
1206
1209
|
{
|
|
1207
1210
|
type: "button",
|
|
@@ -1222,7 +1225,7 @@ function Dt({
|
|
|
1222
1225
|
active: t,
|
|
1223
1226
|
onOpen: s
|
|
1224
1227
|
}) {
|
|
1225
|
-
return /* @__PURE__ */ n("li", { children: /* @__PURE__ */
|
|
1228
|
+
return /* @__PURE__ */ n("li", { children: /* @__PURE__ */ S(
|
|
1226
1229
|
"button",
|
|
1227
1230
|
{
|
|
1228
1231
|
type: "button",
|
|
@@ -1236,7 +1239,7 @@ function Dt({
|
|
|
1236
1239
|
}
|
|
1237
1240
|
) });
|
|
1238
1241
|
}
|
|
1239
|
-
function
|
|
1242
|
+
function Vt(e, t) {
|
|
1240
1243
|
const s = /* @__PURE__ */ new Map();
|
|
1241
1244
|
for (const o of e) {
|
|
1242
1245
|
const r = o.group?.trim() || t, i = s.get(r) ?? [];
|
|
@@ -1244,7 +1247,7 @@ function Kt(e, t) {
|
|
|
1244
1247
|
}
|
|
1245
1248
|
return [...s].map(([o, r]) => ({ group: o, items: r }));
|
|
1246
1249
|
}
|
|
1247
|
-
function
|
|
1250
|
+
function Kt(e) {
|
|
1248
1251
|
return (e.metaKey || e.ctrlKey) && !e.altKey && !e.shiftKey && e.key.toLowerCase() === "k";
|
|
1249
1252
|
}
|
|
1250
1253
|
function Ut({
|
|
@@ -1257,32 +1260,32 @@ function Ut({
|
|
|
1257
1260
|
}) {
|
|
1258
1261
|
const l = r.pr, a = [`## ${e.name}`, ""];
|
|
1259
1262
|
e.description && a.push(e.description, ""), a.push(`\`${e.route.path}\``, "");
|
|
1260
|
-
const
|
|
1263
|
+
const p = o.deploymentUrl ? `https://${o.deploymentUrl}` : void 0, m = o.shortCommit ? l.commit(o.shortCommit) : void 0;
|
|
1261
1264
|
if (a.push(`### ${l.variations}`, ""), t.length === 0) {
|
|
1262
|
-
const
|
|
1263
|
-
ye(
|
|
1265
|
+
const h = new URL(e.href, o.origin);
|
|
1266
|
+
ye(h.searchParams, i), a.push(`- [${r.panel.defaultVariation}](${h.toString()})`);
|
|
1264
1267
|
}
|
|
1265
|
-
for (const
|
|
1266
|
-
const d =
|
|
1267
|
-
let
|
|
1268
|
-
if (
|
|
1269
|
-
const
|
|
1270
|
-
|
|
1271
|
-
} else m && (
|
|
1272
|
-
a.push(
|
|
1268
|
+
for (const h of t) {
|
|
1269
|
+
const d = pe(h, { origin: o.origin, overrides: i });
|
|
1270
|
+
let f = `- [${Qe(h.title)}](${d})`;
|
|
1271
|
+
if (p) {
|
|
1272
|
+
const k = pe(h, { origin: p, overrides: i });
|
|
1273
|
+
f += ` · [${m ?? l.immutableLink}](${k})`;
|
|
1274
|
+
} else m && (f += ` · ${m}`);
|
|
1275
|
+
a.push(f);
|
|
1273
1276
|
}
|
|
1274
1277
|
if (a.push(""), s.length > 0) {
|
|
1275
1278
|
a.push(`### ${l.components}`, ""), a.push(`| ${l.component} | ${l.source} |`, "| --- | --- |");
|
|
1276
|
-
for (const
|
|
1277
|
-
const d =
|
|
1278
|
-
a.push(`| ${
|
|
1279
|
+
for (const h of s) {
|
|
1280
|
+
const d = h.source ? `\`${fe(h.source)}\`` : l.empty;
|
|
1281
|
+
a.push(`| ${fe(h.name)} (\`${h.id}\`) | ${d} |`);
|
|
1279
1282
|
}
|
|
1280
1283
|
a.push("");
|
|
1281
1284
|
}
|
|
1282
1285
|
a.push(`### ${l.expected}`, ""), t.length === 0 && a.push(`**${r.panel.defaultVariation}**`, "", l.noExpected, "");
|
|
1283
|
-
for (const
|
|
1284
|
-
if (a.push(`**${
|
|
1285
|
-
for (const d of
|
|
1286
|
+
for (const h of t) {
|
|
1287
|
+
if (a.push(`**${h.title}**`, ""), h.expected?.length)
|
|
1288
|
+
for (const d of h.expected) a.push(`- ${d}`);
|
|
1286
1289
|
else
|
|
1287
1290
|
a.push(l.noExpected);
|
|
1288
1291
|
a.push("");
|
|
@@ -1291,7 +1294,7 @@ function Ut({
|
|
|
1291
1294
|
`).trimEnd()}
|
|
1292
1295
|
`;
|
|
1293
1296
|
}
|
|
1294
|
-
function
|
|
1297
|
+
function fe(e) {
|
|
1295
1298
|
return e.replace(/\|/g, "\\|").replace(/\n/g, " ");
|
|
1296
1299
|
}
|
|
1297
1300
|
function Qe(e) {
|
|
@@ -1305,61 +1308,61 @@ function It({
|
|
|
1305
1308
|
labels: r,
|
|
1306
1309
|
overrides: i
|
|
1307
1310
|
}) {
|
|
1308
|
-
const l = r.pr, a = [`## ${e.name}`, ""],
|
|
1311
|
+
const l = r.pr, a = [`## ${e.name}`, ""], p = o.deploymentUrl ? `https://${o.deploymentUrl}` : void 0, m = o.shortCommit ? l.commit(o.shortCommit) : void 0, h = (d, f) => {
|
|
1309
1312
|
if (s && s.screen.id === d.id) {
|
|
1310
|
-
const
|
|
1311
|
-
for (const
|
|
1312
|
-
for (const [
|
|
1313
|
-
return ye(
|
|
1313
|
+
const L = new URL(s.location.path || "/", f), P = new URLSearchParams(s.location.search);
|
|
1314
|
+
for (const N of mt) P.delete(N);
|
|
1315
|
+
for (const [N, w] of P) L.searchParams.append(N, w);
|
|
1316
|
+
return ye(L.searchParams, i), L.toString();
|
|
1314
1317
|
}
|
|
1315
|
-
const
|
|
1316
|
-
if (
|
|
1317
|
-
const
|
|
1318
|
-
return ye(
|
|
1318
|
+
const k = d.variations[0];
|
|
1319
|
+
if (k) return pe(k, { origin: f, overrides: i });
|
|
1320
|
+
const g = new URL(d.href, f);
|
|
1321
|
+
return ye(g.searchParams, i), g.toString();
|
|
1319
1322
|
};
|
|
1320
1323
|
for (const d of e.screens) {
|
|
1321
1324
|
a.push(`### ${d.name}`, ""), d.description && a.push(d.description, "");
|
|
1322
|
-
let
|
|
1323
|
-
if (
|
|
1325
|
+
let f = `\`${d.route.path}\` · [${l.open}](${h(d, o.origin)})`;
|
|
1326
|
+
if (p ? f += ` · [${m ?? l.immutableLink}](${h(d, p)})` : m && (f += ` · ${m}`), a.push(f, ""), d.controls.length > 0) {
|
|
1324
1327
|
a.push(`**${l.controls}**`, "");
|
|
1325
|
-
for (const
|
|
1326
|
-
a.push(`- ${ce(
|
|
1327
|
-
for (const w of
|
|
1328
|
-
const
|
|
1329
|
-
(
|
|
1328
|
+
for (const N of d.controls) {
|
|
1329
|
+
a.push(`- ${ce(N.title)} (\`${N.id}\`)`);
|
|
1330
|
+
for (const w of N.controls) {
|
|
1331
|
+
const u = ge(w), C = w.options.map(
|
|
1332
|
+
(b) => b.value === u ? `${ce(b.label)} (\`${b.value}\`, ${l.defaultOption})` : `${ce(b.label)} (\`${b.value}\`)`
|
|
1330
1333
|
).join(" · ");
|
|
1331
|
-
a.push(` - ${ce(w.label)} (\`c.${w.id}\`): ${
|
|
1334
|
+
a.push(` - ${ce(w.label)} (\`c.${w.id}\`): ${C}`);
|
|
1332
1335
|
}
|
|
1333
1336
|
}
|
|
1334
1337
|
a.push("");
|
|
1335
1338
|
}
|
|
1336
1339
|
if (d.variations.length > 0) {
|
|
1337
1340
|
a.push(`**${l.shortcuts}**`, "");
|
|
1338
|
-
for (const
|
|
1341
|
+
for (const N of d.variations)
|
|
1339
1342
|
a.push(
|
|
1340
|
-
`- [${Qe(
|
|
1343
|
+
`- [${Qe(N.title)}](${pe(N, { origin: o.origin, overrides: i })})`
|
|
1341
1344
|
);
|
|
1342
1345
|
a.push("");
|
|
1343
1346
|
}
|
|
1344
1347
|
a.push(`**${l.expected}**`, "");
|
|
1345
|
-
const
|
|
1346
|
-
(
|
|
1348
|
+
const k = s?.screen.id === d.id ? s.variation : void 0, g = k?.expected?.length ? k.expected : d.route.expected, L = d.variations.filter(
|
|
1349
|
+
(N) => N.expected?.length && N.id !== k?.id
|
|
1347
1350
|
);
|
|
1348
|
-
if (!
|
|
1349
|
-
for (const
|
|
1351
|
+
if (!g?.length && L.length === 0 && a.push(l.noExpected, ""), g?.length) {
|
|
1352
|
+
for (const N of g) a.push(`- ${N}`);
|
|
1350
1353
|
a.push("");
|
|
1351
1354
|
}
|
|
1352
|
-
for (const
|
|
1353
|
-
a.push(`*${
|
|
1354
|
-
for (const w of
|
|
1355
|
+
for (const N of L) {
|
|
1356
|
+
a.push(`*${N.title}*`, "");
|
|
1357
|
+
for (const w of N.expected ?? []) a.push(`- ${w}`);
|
|
1355
1358
|
a.push("");
|
|
1356
1359
|
}
|
|
1357
|
-
const
|
|
1358
|
-
if (
|
|
1360
|
+
const P = t.componentsOfScreen(d);
|
|
1361
|
+
if (P.length > 0) {
|
|
1359
1362
|
a.push(`**${l.components}**`, ""), a.push(`| ${l.component} | ${l.source} |`, "| --- | --- |");
|
|
1360
|
-
for (const
|
|
1361
|
-
const w =
|
|
1362
|
-
a.push(`| ${
|
|
1363
|
+
for (const N of P) {
|
|
1364
|
+
const w = N.source ? `\`${fe(N.source)}\`` : l.empty;
|
|
1365
|
+
a.push(`| ${fe(N.name)} (\`${N.id}\`) | ${w} |`);
|
|
1363
1366
|
}
|
|
1364
1367
|
a.push("");
|
|
1365
1368
|
}
|
|
@@ -1372,18 +1375,18 @@ function ce(e) {
|
|
|
1372
1375
|
return e.replace(/([*_[\]`])/g, "\\$1");
|
|
1373
1376
|
}
|
|
1374
1377
|
function Wt(e) {
|
|
1375
|
-
const { tab: t, onTab: s, width: o, onResize: r, onResizeStart: i, onResizeEnd: l } = e, a =
|
|
1376
|
-
const
|
|
1377
|
-
return
|
|
1378
|
-
}),
|
|
1378
|
+
const { tab: t, onTab: s, width: o, onResize: r, onResizeStart: i, onResizeEnd: l } = e, a = J().panel, [p, m] = V(""), h = q(null), d = q(null), [f, k] = V(!1), [g, L] = V(() => /* @__PURE__ */ new Set()), P = (w) => L((u) => {
|
|
1379
|
+
const C = new Set(u);
|
|
1380
|
+
return C.has(w) ? C.delete(w) : C.add(w), C;
|
|
1381
|
+
}), N = p.trim().length > 0;
|
|
1379
1382
|
return I(() => {
|
|
1380
|
-
const w = (
|
|
1381
|
-
|
|
1383
|
+
const w = (u) => {
|
|
1384
|
+
jt(u) && (u.preventDefault(), h.current?.focus(), h.current?.select());
|
|
1382
1385
|
};
|
|
1383
1386
|
return window.addEventListener("keydown", w), () => window.removeEventListener("keydown", w);
|
|
1384
1387
|
}, []), Ue(() => {
|
|
1385
|
-
|
|
1386
|
-
}), /* @__PURE__ */
|
|
1388
|
+
k(qt(d.current, p));
|
|
1389
|
+
}), /* @__PURE__ */ S("aside", { className: "ds-panel", "aria-label": a.region, style: { width: o }, children: [
|
|
1387
1390
|
/* @__PURE__ */ n(
|
|
1388
1391
|
Xe,
|
|
1389
1392
|
{
|
|
@@ -1395,15 +1398,15 @@ function Wt(e) {
|
|
|
1395
1398
|
onEnd: l
|
|
1396
1399
|
}
|
|
1397
1400
|
),
|
|
1398
|
-
/* @__PURE__ */
|
|
1401
|
+
/* @__PURE__ */ S("div", { className: "ds-search", children: [
|
|
1399
1402
|
/* @__PURE__ */ n(H, { name: "search", size: 14 }),
|
|
1400
1403
|
/* @__PURE__ */ n(
|
|
1401
1404
|
"input",
|
|
1402
1405
|
{
|
|
1403
|
-
ref:
|
|
1406
|
+
ref: h,
|
|
1404
1407
|
className: "ds-input ds-search__input",
|
|
1405
1408
|
type: "search",
|
|
1406
|
-
value:
|
|
1409
|
+
value: p,
|
|
1407
1410
|
placeholder: a.searchPlaceholder,
|
|
1408
1411
|
"aria-label": a.searchLabel,
|
|
1409
1412
|
onChange: (w) => m(w.target.value),
|
|
@@ -1414,7 +1417,7 @@ function Wt(e) {
|
|
|
1414
1417
|
),
|
|
1415
1418
|
/* @__PURE__ */ n("kbd", { className: "ds-kbd", "aria-hidden": "true", children: a.searchShortcut })
|
|
1416
1419
|
] }),
|
|
1417
|
-
/* @__PURE__ */
|
|
1420
|
+
/* @__PURE__ */ S("div", { className: "ds-tabs", role: "tablist", "aria-label": a.tabs, children: [
|
|
1418
1421
|
/* @__PURE__ */ n(
|
|
1419
1422
|
"button",
|
|
1420
1423
|
{
|
|
@@ -1440,9 +1443,9 @@ function Wt(e) {
|
|
|
1440
1443
|
}
|
|
1441
1444
|
)
|
|
1442
1445
|
] }),
|
|
1443
|
-
/* @__PURE__ */
|
|
1444
|
-
t === "variations" ? /* @__PURE__ */ n(Ht, { ...e, collapsed:
|
|
1445
|
-
|
|
1446
|
+
/* @__PURE__ */ S("div", { className: "ds-panel__body", role: "tabpanel", ref: d, children: [
|
|
1447
|
+
t === "variations" ? /* @__PURE__ */ n(Ht, { ...e, collapsed: g, onToggle: P, filtering: N }) : /* @__PURE__ */ n(Bt, { ...e }),
|
|
1448
|
+
f && /* @__PURE__ */ n("p", { className: "ds-empty", children: a.noMatch(p) })
|
|
1446
1449
|
] })
|
|
1447
1450
|
] });
|
|
1448
1451
|
}
|
|
@@ -1455,209 +1458,156 @@ function Ht({
|
|
|
1455
1458
|
componentFixture: i,
|
|
1456
1459
|
onOpenScenario: l,
|
|
1457
1460
|
onOpenComponent: a,
|
|
1458
|
-
onChange:
|
|
1459
|
-
collapsed: m,
|
|
1460
|
-
onToggle: p,
|
|
1461
|
-
filtering: d
|
|
1461
|
+
onChange: p
|
|
1462
1462
|
}) {
|
|
1463
|
-
const
|
|
1463
|
+
const m = J(), h = m.panel;
|
|
1464
1464
|
if (r) {
|
|
1465
1465
|
const u = r.fixtures ?? [];
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
|
|
1466
|
+
if (u.length === 0) return /* @__PURE__ */ n("p", { className: "ds-empty", children: h.noComponentVariations });
|
|
1467
|
+
const C = i.fixture;
|
|
1468
|
+
return /* @__PURE__ */ S("div", { className: "ds-vcards", children: [
|
|
1469
|
+
i.didFallback && i.requestedId && C && /* @__PURE__ */ n("p", { className: "ds-notice", children: h.fixtureFallback(i.requestedId, C.id) }),
|
|
1470
|
+
/* @__PURE__ */ n(le, { title: r.name, hint: C?.description, children: /* @__PURE__ */ n(
|
|
1471
|
+
ee,
|
|
1470
1472
|
{
|
|
1471
|
-
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
children: [
|
|
1476
|
-
/* @__PURE__ */ n("span", { className: "ds-item__title", children: $.label }),
|
|
1477
|
-
$.description && /* @__PURE__ */ n("span", { className: "ds-item__hint", children: $.description })
|
|
1478
|
-
]
|
|
1473
|
+
label: h.componentVariations,
|
|
1474
|
+
value: C?.id ?? "",
|
|
1475
|
+
options: u.map((b) => ({ value: b.id, label: b.label })),
|
|
1476
|
+
onChange: (b) => p({ fixture: b })
|
|
1479
1477
|
}
|
|
1480
|
-
) }
|
|
1478
|
+
) })
|
|
1481
1479
|
] });
|
|
1482
1480
|
}
|
|
1483
|
-
if (!s) return /* @__PURE__ */ n("p", { className: "ds-empty", children:
|
|
1484
|
-
const
|
|
1485
|
-
return /* @__PURE__ */
|
|
1486
|
-
/* @__PURE__ */
|
|
1487
|
-
/* @__PURE__ */ n(
|
|
1488
|
-
|
|
1481
|
+
if (!s) return /* @__PURE__ */ n("p", { className: "ds-empty", children: h.nothingSelected });
|
|
1482
|
+
const d = s.variations, f = e.product, k = f.theme?.modes ?? [], g = f.theme?.locales ?? [], L = f.dataSources?.adapters ?? [], P = t.screenControls ?? {}, N = o && Ct(o, P) ? o : void 0, w = (u, C) => p({ screenControls: { ...P, [u]: C } });
|
|
1483
|
+
return /* @__PURE__ */ S("div", { className: "ds-vcards", children: [
|
|
1484
|
+
/* @__PURE__ */ S(le, { title: h.context, children: [
|
|
1485
|
+
/* @__PURE__ */ n(
|
|
1486
|
+
ee,
|
|
1489
1487
|
{
|
|
1490
|
-
|
|
1488
|
+
label: h.persona,
|
|
1491
1489
|
value: t.persona ?? "",
|
|
1492
|
-
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
]
|
|
1490
|
+
options: [
|
|
1491
|
+
// Com persona padrão, "nenhuma" não é uma situação possível.
|
|
1492
|
+
...e.defaultPersona ? [] : [{ value: "", label: h.none }],
|
|
1493
|
+
...f.personas.map((u) => ({ value: u.id, label: u.name }))
|
|
1494
|
+
],
|
|
1495
|
+
onChange: (u) => p({ persona: u || void 0 })
|
|
1497
1496
|
}
|
|
1498
|
-
)
|
|
1499
|
-
/* @__PURE__ */ n(
|
|
1500
|
-
|
|
1497
|
+
),
|
|
1498
|
+
/* @__PURE__ */ n(
|
|
1499
|
+
ee,
|
|
1501
1500
|
{
|
|
1502
|
-
|
|
1501
|
+
label: h.network,
|
|
1503
1502
|
value: t.network,
|
|
1504
|
-
|
|
1505
|
-
|
|
1503
|
+
options: He.map((u) => ({ value: u, label: m.network[u] })),
|
|
1504
|
+
onChange: (u) => p({ network: u })
|
|
1506
1505
|
}
|
|
1507
|
-
)
|
|
1508
|
-
|
|
1509
|
-
|
|
1506
|
+
),
|
|
1507
|
+
k.length > 1 && /* @__PURE__ */ n(
|
|
1508
|
+
ee,
|
|
1510
1509
|
{
|
|
1511
|
-
|
|
1512
|
-
value: t.themeMode ??
|
|
1513
|
-
|
|
1514
|
-
|
|
1510
|
+
label: h.theme,
|
|
1511
|
+
value: t.themeMode ?? k[0],
|
|
1512
|
+
options: k.map((u) => ({ value: u, label: u })),
|
|
1513
|
+
onChange: (u) => p({ themeMode: u })
|
|
1515
1514
|
}
|
|
1516
|
-
)
|
|
1517
|
-
|
|
1518
|
-
|
|
1515
|
+
),
|
|
1516
|
+
g.length > 1 && /* @__PURE__ */ n(
|
|
1517
|
+
ee,
|
|
1519
1518
|
{
|
|
1520
|
-
|
|
1521
|
-
value: t.locale ??
|
|
1522
|
-
|
|
1523
|
-
|
|
1519
|
+
label: h.locale,
|
|
1520
|
+
value: t.locale ?? g[0],
|
|
1521
|
+
options: g.map((u) => ({ value: u, label: u })),
|
|
1522
|
+
onChange: (u) => p({ locale: u })
|
|
1524
1523
|
}
|
|
1525
|
-
)
|
|
1526
|
-
|
|
1527
|
-
|
|
1524
|
+
),
|
|
1525
|
+
L.length > 0 && /* @__PURE__ */ n(
|
|
1526
|
+
ee,
|
|
1528
1527
|
{
|
|
1529
|
-
|
|
1528
|
+
label: h.dataSource,
|
|
1530
1529
|
value: t.dataSource ?? "fixtures",
|
|
1531
|
-
|
|
1532
|
-
|
|
1533
|
-
|
|
1534
|
-
|
|
1535
|
-
|
|
1530
|
+
options: [
|
|
1531
|
+
{ value: "fixtures", label: h.fixturesOption },
|
|
1532
|
+
...L.map((u) => ({ value: u.id, label: u.label }))
|
|
1533
|
+
],
|
|
1534
|
+
onChange: (u) => p({ dataSource: u })
|
|
1536
1535
|
}
|
|
1537
|
-
)
|
|
1538
|
-
] })
|
|
1536
|
+
)
|
|
1537
|
+
] }),
|
|
1539
1538
|
s.controls.map((u) => {
|
|
1540
|
-
const
|
|
1541
|
-
return /* @__PURE__ */
|
|
1542
|
-
|
|
1539
|
+
const C = e.component(u.component);
|
|
1540
|
+
return /* @__PURE__ */ n(
|
|
1541
|
+
le,
|
|
1543
1542
|
{
|
|
1544
|
-
id: `group:${u.id}`,
|
|
1545
1543
|
title: u.title,
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
|
|
1555
|
-
|
|
1556
|
-
|
|
1557
|
-
|
|
1558
|
-
|
|
1559
|
-
value: b[F.id] ?? ge(F),
|
|
1560
|
-
onChange: (c) => S(F.id, c)
|
|
1561
|
-
},
|
|
1562
|
-
F.id
|
|
1563
|
-
)) })
|
|
1564
|
-
]
|
|
1544
|
+
hint: u.note,
|
|
1545
|
+
link: C ? { label: h.openComponent(C.name), onOpen: () => a(C.id) } : void 0,
|
|
1546
|
+
children: u.controls.map((b) => /* @__PURE__ */ n(
|
|
1547
|
+
ee,
|
|
1548
|
+
{
|
|
1549
|
+
label: b.label,
|
|
1550
|
+
hint: b.description,
|
|
1551
|
+
value: P[b.id] ?? ge(b),
|
|
1552
|
+
options: b.options ?? [],
|
|
1553
|
+
onChange: (y) => w(b.id, y)
|
|
1554
|
+
},
|
|
1555
|
+
b.id
|
|
1556
|
+
))
|
|
1565
1557
|
},
|
|
1566
1558
|
u.id
|
|
1567
1559
|
);
|
|
1568
1560
|
}),
|
|
1569
|
-
|
|
1570
|
-
ke,
|
|
1571
|
-
{
|
|
1572
|
-
id: "shortcuts",
|
|
1573
|
-
title: f.shortcuts,
|
|
1574
|
-
count: k.length || void 0,
|
|
1575
|
-
collapsed: m,
|
|
1576
|
-
onToggle: p,
|
|
1577
|
-
filtering: d,
|
|
1578
|
-
children: /* @__PURE__ */ n("ul", { className: "ds-items", "aria-label": f.variationsList, children: k.length === 0 ? /* @__PURE__ */ n("li", { children: /* @__PURE__ */ C("div", { className: "ds-item ds-item--stacked", "aria-current": "true", children: [
|
|
1579
|
-
/* @__PURE__ */ n("span", { className: "ds-item__title", children: f.defaultVariation }),
|
|
1580
|
-
/* @__PURE__ */ n("span", { className: "ds-item__hint", children: f.defaultVariationHint })
|
|
1581
|
-
] }) }) : k.map((u) => /* @__PURE__ */ n("li", { "data-ds-filter": !0, children: /* @__PURE__ */ n(
|
|
1582
|
-
"button",
|
|
1583
|
-
{
|
|
1584
|
-
type: "button",
|
|
1585
|
-
className: "ds-item",
|
|
1586
|
-
title: u.intent,
|
|
1587
|
-
"aria-current": N?.id === u.id ? "true" : void 0,
|
|
1588
|
-
onClick: () => l(u.id),
|
|
1589
|
-
children: /* @__PURE__ */ n("span", { className: "ds-item__title", children: u.title })
|
|
1590
|
-
}
|
|
1591
|
-
) }, u.id)) })
|
|
1592
|
-
}
|
|
1593
|
-
)
|
|
1594
|
-
] });
|
|
1595
|
-
}
|
|
1596
|
-
function ke({
|
|
1597
|
-
id: e,
|
|
1598
|
-
title: t,
|
|
1599
|
-
count: s,
|
|
1600
|
-
collapsed: o,
|
|
1601
|
-
onToggle: r,
|
|
1602
|
-
filtering: i,
|
|
1603
|
-
children: l
|
|
1604
|
-
}) {
|
|
1605
|
-
const a = Q().panel, h = o.has(e) && !i;
|
|
1606
|
-
return /* @__PURE__ */ C("section", { className: "ds-group-section", "data-ds-filter-group": !0, children: [
|
|
1607
|
-
/* @__PURE__ */ C(
|
|
1561
|
+
d.length > 0 && /* @__PURE__ */ n(le, { title: h.shortcuts, children: /* @__PURE__ */ n("ul", { className: "ds-items", "aria-label": h.variationsList, children: d.map((u) => /* @__PURE__ */ n("li", { "data-ds-filter": !0, children: /* @__PURE__ */ n(
|
|
1608
1562
|
"button",
|
|
1609
1563
|
{
|
|
1610
1564
|
type: "button",
|
|
1611
|
-
className: "ds-
|
|
1612
|
-
|
|
1613
|
-
"aria-
|
|
1614
|
-
onClick: () =>
|
|
1615
|
-
children:
|
|
1616
|
-
/* @__PURE__ */ n(H, { name: "chevron", size: 12 }),
|
|
1617
|
-
/* @__PURE__ */ n("span", { "data-ds-filter-title": !0, children: t }),
|
|
1618
|
-
s !== void 0 && /* @__PURE__ */ n("span", { className: "ds-count", children: s })
|
|
1619
|
-
]
|
|
1565
|
+
className: "ds-item",
|
|
1566
|
+
title: u.intent,
|
|
1567
|
+
"aria-current": N?.id === u.id ? "true" : void 0,
|
|
1568
|
+
onClick: () => l(u.id),
|
|
1569
|
+
children: /* @__PURE__ */ n("span", { className: "ds-item__title", children: u.title })
|
|
1620
1570
|
}
|
|
1621
|
-
),
|
|
1622
|
-
!h && l
|
|
1571
|
+
) }, u.id)) }) })
|
|
1623
1572
|
] });
|
|
1624
1573
|
}
|
|
1625
|
-
function
|
|
1626
|
-
|
|
1627
|
-
|
|
1574
|
+
function le({
|
|
1575
|
+
title: e,
|
|
1576
|
+
hint: t,
|
|
1577
|
+
link: s,
|
|
1578
|
+
children: o
|
|
1579
|
+
}) {
|
|
1580
|
+
return /* @__PURE__ */ S("section", { className: "ds-vcard", "data-ds-filter-group": !0, children: [
|
|
1581
|
+
/* @__PURE__ */ S("header", { className: "ds-vcard__head", title: t ? `${e} — ${t}` : e, children: [
|
|
1582
|
+
/* @__PURE__ */ n("h3", { className: "ds-vcard__title ds-section__title", "data-ds-filter-title": !0, children: e }),
|
|
1583
|
+
s && /* @__PURE__ */ n(
|
|
1584
|
+
"button",
|
|
1585
|
+
{
|
|
1586
|
+
type: "button",
|
|
1587
|
+
className: "ds-btn ds-btn--icon ds-vcard__link",
|
|
1588
|
+
"aria-label": s.label,
|
|
1589
|
+
title: s.label,
|
|
1590
|
+
onClick: s.onOpen,
|
|
1591
|
+
children: /* @__PURE__ */ n(H, { name: "arrow-up-right", size: 14 })
|
|
1592
|
+
}
|
|
1593
|
+
)
|
|
1594
|
+
] }),
|
|
1595
|
+
/* @__PURE__ */ n("div", { className: "ds-vcard__body", children: o })
|
|
1596
|
+
] });
|
|
1628
1597
|
}
|
|
1629
|
-
function
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
|
-
|
|
1598
|
+
function ee({
|
|
1599
|
+
label: e,
|
|
1600
|
+
hint: t,
|
|
1601
|
+
value: s,
|
|
1602
|
+
options: o,
|
|
1603
|
+
onChange: r
|
|
1633
1604
|
}) {
|
|
1634
|
-
|
|
1635
|
-
|
|
1636
|
-
/* @__PURE__ */ n("
|
|
1637
|
-
/* @__PURE__ */ n("div", { className: "ds-tabs ds-tabs--segmented", role: "radiogroup", "aria-labelledby": `ds-control-${e.id}`, children: o.map((r) => /* @__PURE__ */ n(
|
|
1638
|
-
"button",
|
|
1639
|
-
{
|
|
1640
|
-
type: "button",
|
|
1641
|
-
role: "radio",
|
|
1642
|
-
className: "ds-tab",
|
|
1643
|
-
"aria-checked": r.value === t,
|
|
1644
|
-
tabIndex: r.value === t ? 0 : -1,
|
|
1645
|
-
onClick: () => s(r.value),
|
|
1646
|
-
children: r.label
|
|
1647
|
-
},
|
|
1648
|
-
r.value
|
|
1649
|
-
)) }),
|
|
1650
|
-
e.description && /* @__PURE__ */ n("span", { className: "ds-field__hint", children: e.description })
|
|
1651
|
-
] }) : /* @__PURE__ */ n(te, { label: e.label, hint: e.description, children: /* @__PURE__ */ n("select", { className: "ds-select", value: t, onChange: (r) => s(r.target.value), children: o.map((r) => /* @__PURE__ */ n("option", { value: r.value, children: r.label }, r.value)) }) });
|
|
1652
|
-
}
|
|
1653
|
-
function te({ label: e, hint: t, children: s }) {
|
|
1654
|
-
return /* @__PURE__ */ C("label", { className: "ds-field", "data-ds-filter": !0, children: [
|
|
1655
|
-
/* @__PURE__ */ n("span", { className: "ds-field__label", children: e }),
|
|
1656
|
-
s,
|
|
1657
|
-
t && /* @__PURE__ */ n("span", { className: "ds-field__hint", children: t })
|
|
1605
|
+
return /* @__PURE__ */ S("label", { className: "ds-vcard__field", "data-ds-filter": !0, title: t ? `${e} — ${t}` : e, children: [
|
|
1606
|
+
/* @__PURE__ */ n("span", { className: "ds-visually-hidden", children: e }),
|
|
1607
|
+
/* @__PURE__ */ n("select", { className: "ds-select", value: s, onChange: (i) => r(i.target.value), children: o.map((i) => /* @__PURE__ */ n("option", { value: i.value, children: i.label }, i.value)) })
|
|
1658
1608
|
] });
|
|
1659
1609
|
}
|
|
1660
|
-
function
|
|
1610
|
+
function Bt({
|
|
1661
1611
|
registry: e,
|
|
1662
1612
|
controls: t,
|
|
1663
1613
|
deploy: s,
|
|
@@ -1666,121 +1616,121 @@ function qt({
|
|
|
1666
1616
|
variation: i,
|
|
1667
1617
|
component: l,
|
|
1668
1618
|
onOpenScenario: a,
|
|
1669
|
-
onOpenComponent:
|
|
1619
|
+
onOpenComponent: p,
|
|
1670
1620
|
onOpenScreen: m
|
|
1671
1621
|
}) {
|
|
1672
|
-
const
|
|
1622
|
+
const h = J(), d = h.info, [f, k] = V(!1);
|
|
1673
1623
|
if (l) {
|
|
1674
|
-
const
|
|
1675
|
-
return /* @__PURE__ */
|
|
1676
|
-
/* @__PURE__ */
|
|
1624
|
+
const b = e.usagesOf(l.id, { handoff: t.handoff });
|
|
1625
|
+
return /* @__PURE__ */ S("div", { className: "ds-info", children: [
|
|
1626
|
+
/* @__PURE__ */ S(te, { title: d.component, children: [
|
|
1677
1627
|
/* @__PURE__ */ n(W, { term: d.name, children: l.name }),
|
|
1678
1628
|
/* @__PURE__ */ n(W, { term: d.id, children: /* @__PURE__ */ n("code", { children: l.id }) }),
|
|
1679
1629
|
l.group && /* @__PURE__ */ n(W, { term: d.group, children: l.group }),
|
|
1680
1630
|
l.description && /* @__PURE__ */ n(W, { term: d.description, children: l.description }),
|
|
1681
1631
|
l.source && /* @__PURE__ */ n(W, { term: d.source, children: /* @__PURE__ */ n("code", { children: l.source }) })
|
|
1682
1632
|
] }),
|
|
1683
|
-
/* @__PURE__ */ n(
|
|
1684
|
-
const
|
|
1685
|
-
return /* @__PURE__ */
|
|
1633
|
+
/* @__PURE__ */ n(te, { title: d.usedIn, children: b.length === 0 ? /* @__PURE__ */ n("p", { className: "ds-muted", children: d.notUsed }) : /* @__PURE__ */ n("ul", { className: "ds-links", children: b.map((y) => {
|
|
1634
|
+
const _ = y.variations.find((z) => z.components?.includes(l.id)) ?? y.variations[0];
|
|
1635
|
+
return /* @__PURE__ */ S("li", { "data-ds-filter": !0, children: [
|
|
1686
1636
|
/* @__PURE__ */ n(
|
|
1687
1637
|
"button",
|
|
1688
1638
|
{
|
|
1689
1639
|
type: "button",
|
|
1690
1640
|
className: "ds-link",
|
|
1691
|
-
onClick: () =>
|
|
1692
|
-
children:
|
|
1641
|
+
onClick: () => _ ? a(_.id) : m?.(y.id),
|
|
1642
|
+
children: y.name
|
|
1693
1643
|
}
|
|
1694
1644
|
),
|
|
1695
|
-
/* @__PURE__ */ n("code", { className: "ds-muted", children:
|
|
1696
|
-
] },
|
|
1645
|
+
/* @__PURE__ */ n("code", { className: "ds-muted", children: y.id })
|
|
1646
|
+
] }, y.id);
|
|
1697
1647
|
}) }) })
|
|
1698
1648
|
] });
|
|
1699
1649
|
}
|
|
1700
|
-
if (!r) return /* @__PURE__ */ n("p", { className: "ds-empty", children:
|
|
1701
|
-
const
|
|
1702
|
-
const
|
|
1703
|
-
flow: { name:
|
|
1650
|
+
if (!r) return /* @__PURE__ */ n("p", { className: "ds-empty", children: h.panel.nothingSelected });
|
|
1651
|
+
const g = i ? e.componentsOfScreen(r, i) : e.componentsOfScreen(r), L = e.persona(t.persona ?? i?.persona), P = e.rulesOf(i), N = t.screenControls ?? {}, w = i?.expected?.length ? i.expected : r.route.expected, u = t.handoff ? { handoff: t.handoff } : void 0, C = async () => {
|
|
1652
|
+
const b = r.group ? e.flowOf(r, { handoff: t.handoff }) : void 0, y = b?.name ? It({
|
|
1653
|
+
flow: { name: b.name, screens: b.screens },
|
|
1704
1654
|
registry: e,
|
|
1705
1655
|
open: { screen: r, location: o, variation: i },
|
|
1706
1656
|
deploy: s,
|
|
1707
|
-
labels:
|
|
1708
|
-
overrides:
|
|
1657
|
+
labels: h,
|
|
1658
|
+
overrides: u
|
|
1709
1659
|
}) : Ut({
|
|
1710
1660
|
screen: r,
|
|
1711
1661
|
variations: r.variations,
|
|
1712
1662
|
components: e.componentsOfScreen(r),
|
|
1713
1663
|
deploy: s,
|
|
1714
|
-
labels:
|
|
1715
|
-
overrides:
|
|
1664
|
+
labels: h,
|
|
1665
|
+
overrides: u
|
|
1716
1666
|
});
|
|
1717
1667
|
try {
|
|
1718
|
-
await navigator.clipboard.writeText(
|
|
1668
|
+
await navigator.clipboard.writeText(y);
|
|
1719
1669
|
} catch {
|
|
1720
|
-
window.prompt(d.copyPrompt,
|
|
1670
|
+
window.prompt(d.copyPrompt, y);
|
|
1721
1671
|
}
|
|
1722
|
-
|
|
1672
|
+
k(!0), window.setTimeout(() => k(!1), 1600);
|
|
1723
1673
|
};
|
|
1724
|
-
return /* @__PURE__ */
|
|
1725
|
-
/* @__PURE__ */
|
|
1674
|
+
return /* @__PURE__ */ S("div", { className: "ds-info", children: [
|
|
1675
|
+
/* @__PURE__ */ S(te, { title: d.screen, children: [
|
|
1726
1676
|
/* @__PURE__ */ n(W, { term: d.name, children: r.name }),
|
|
1727
1677
|
/* @__PURE__ */ n(W, { term: d.route, children: /* @__PURE__ */ n("code", { children: r.route.path }) }),
|
|
1728
1678
|
r.group && /* @__PURE__ */ n(W, { term: d.flow, children: r.group }),
|
|
1729
1679
|
r.description && /* @__PURE__ */ n(W, { term: d.description, children: r.description }),
|
|
1730
|
-
/* @__PURE__ */ n(
|
|
1680
|
+
/* @__PURE__ */ n(de, { term: d.expected, items: w })
|
|
1731
1681
|
] }),
|
|
1732
|
-
r.controls.length > 0 && /* @__PURE__ */ n(
|
|
1733
|
-
(
|
|
1734
|
-
const
|
|
1735
|
-
return /* @__PURE__ */
|
|
1736
|
-
|
|
1682
|
+
r.controls.length > 0 && /* @__PURE__ */ n(te, { title: d.controls, children: r.controls.flatMap(
|
|
1683
|
+
(b) => b.controls.map((y) => {
|
|
1684
|
+
const _ = N[y.id] ?? ge(y), z = y.options.find((c) => c.value === _);
|
|
1685
|
+
return /* @__PURE__ */ S(W, { term: y.label, children: [
|
|
1686
|
+
z?.label ?? _,
|
|
1737
1687
|
" ",
|
|
1738
|
-
/* @__PURE__ */ n("code", { children: `c.${
|
|
1739
|
-
] }, `${
|
|
1688
|
+
/* @__PURE__ */ n("code", { children: `c.${y.id}=${_}` })
|
|
1689
|
+
] }, `${b.id}/${y.id}`);
|
|
1740
1690
|
})
|
|
1741
1691
|
) }),
|
|
1742
|
-
i && /* @__PURE__ */
|
|
1692
|
+
i && /* @__PURE__ */ S(te, { title: d.variation, children: [
|
|
1743
1693
|
/* @__PURE__ */ n(W, { term: d.name, children: i.title }),
|
|
1744
1694
|
/* @__PURE__ */ n(W, { term: d.id, children: /* @__PURE__ */ n("code", { children: i.id }) }),
|
|
1745
|
-
|
|
1695
|
+
L && /* @__PURE__ */ n(W, { term: d.persona, children: L.name }),
|
|
1746
1696
|
i.intent && /* @__PURE__ */ n(W, { term: d.intent, children: i.intent }),
|
|
1747
|
-
/* @__PURE__ */ n(
|
|
1748
|
-
/* @__PURE__ */ n(
|
|
1749
|
-
/* @__PURE__ */ n(
|
|
1697
|
+
/* @__PURE__ */ n(de, { term: d.preconditions, items: i.preconditions }),
|
|
1698
|
+
/* @__PURE__ */ n(de, { term: d.actions, items: i.actions }),
|
|
1699
|
+
/* @__PURE__ */ n(de, { term: d.rules, items: P.map((b) => b.statement) }),
|
|
1750
1700
|
i.ticket && /* @__PURE__ */ n(W, { term: d.ticket, children: /* @__PURE__ */ n("code", { children: i.ticket }) })
|
|
1751
1701
|
] }),
|
|
1752
|
-
|
|
1753
|
-
/* @__PURE__ */ n("button", { type: "button", className: "ds-link", onClick: () =>
|
|
1754
|
-
|
|
1755
|
-
] },
|
|
1756
|
-
/* @__PURE__ */
|
|
1757
|
-
/* @__PURE__ */ n(H, { name:
|
|
1758
|
-
/* @__PURE__ */ n("span", { children:
|
|
1702
|
+
g.length > 0 && /* @__PURE__ */ n(te, { title: d.components, children: /* @__PURE__ */ n("ul", { className: "ds-links", children: g.map((b) => /* @__PURE__ */ S("li", { "data-ds-filter": !0, children: [
|
|
1703
|
+
/* @__PURE__ */ n("button", { type: "button", className: "ds-link", onClick: () => p(b.id), children: b.name }),
|
|
1704
|
+
b.source && /* @__PURE__ */ n("code", { className: "ds-muted", children: b.source })
|
|
1705
|
+
] }, b.id)) }) }),
|
|
1706
|
+
/* @__PURE__ */ S("button", { type: "button", className: "ds-btn ds-btn--block", onClick: C, children: [
|
|
1707
|
+
/* @__PURE__ */ n(H, { name: f ? "check" : "copy", size: 14 }),
|
|
1708
|
+
/* @__PURE__ */ n("span", { children: f ? d.copiedForPr : d.copyForPr })
|
|
1759
1709
|
] })
|
|
1760
1710
|
] });
|
|
1761
1711
|
}
|
|
1762
|
-
function
|
|
1763
|
-
return /* @__PURE__ */
|
|
1712
|
+
function te({ title: e, children: t }) {
|
|
1713
|
+
return /* @__PURE__ */ S("section", { className: "ds-section", "data-ds-filter-group": !0, children: [
|
|
1764
1714
|
/* @__PURE__ */ n("h2", { className: "ds-section__title", children: e }),
|
|
1765
1715
|
/* @__PURE__ */ n("div", { className: "ds-defs", children: t })
|
|
1766
1716
|
] });
|
|
1767
1717
|
}
|
|
1768
1718
|
function W({ term: e, children: t }) {
|
|
1769
|
-
return /* @__PURE__ */
|
|
1719
|
+
return /* @__PURE__ */ S("dl", { className: "ds-def", "data-ds-filter": !0, children: [
|
|
1770
1720
|
/* @__PURE__ */ n("dt", { children: e }),
|
|
1771
1721
|
/* @__PURE__ */ n("dd", { children: t })
|
|
1772
1722
|
] });
|
|
1773
1723
|
}
|
|
1774
|
-
function
|
|
1775
|
-
return t?.length ? /* @__PURE__ */
|
|
1724
|
+
function de({ term: e, items: t }) {
|
|
1725
|
+
return t?.length ? /* @__PURE__ */ S("dl", { className: "ds-def", "data-ds-filter": !0, children: [
|
|
1776
1726
|
/* @__PURE__ */ n("dt", { children: e }),
|
|
1777
1727
|
/* @__PURE__ */ n("dd", { children: /* @__PURE__ */ n("ul", { className: "ds-list", children: t.map((s) => /* @__PURE__ */ n("li", { children: s }, s)) }) })
|
|
1778
1728
|
] }) : null;
|
|
1779
1729
|
}
|
|
1780
|
-
function
|
|
1730
|
+
function jt(e) {
|
|
1781
1731
|
return (e.metaKey || e.ctrlKey) && !e.altKey && !e.shiftKey && e.key.toLowerCase() === "f";
|
|
1782
1732
|
}
|
|
1783
|
-
function
|
|
1733
|
+
function qt(e, t) {
|
|
1784
1734
|
if (!e) return !1;
|
|
1785
1735
|
const s = X(t), o = [...e.querySelectorAll("[data-ds-filter]")];
|
|
1786
1736
|
for (const r of o)
|
|
@@ -1798,8 +1748,8 @@ function Zt(e, t) {
|
|
|
1798
1748
|
}
|
|
1799
1749
|
return s.length > 0 && o.length > 0 && o.every((r) => r.hidden);
|
|
1800
1750
|
}
|
|
1801
|
-
const
|
|
1802
|
-
function
|
|
1751
|
+
const Gt = 24;
|
|
1752
|
+
function Zt({
|
|
1803
1753
|
location: e,
|
|
1804
1754
|
viewport: t,
|
|
1805
1755
|
zoom: s,
|
|
@@ -1809,77 +1759,77 @@ function Xt({
|
|
|
1809
1759
|
onShortcut: l,
|
|
1810
1760
|
onEffectiveZoom: a
|
|
1811
1761
|
}) {
|
|
1812
|
-
const
|
|
1813
|
-
(
|
|
1814
|
-
|
|
1815
|
-
const
|
|
1762
|
+
const p = q(null), m = q(null), h = Yt(p), d = ue(e.path, e.search), [f] = V(d), k = q(d), g = q(d), L = typeof window > "u" ? "" : window.location.origin, P = U(
|
|
1763
|
+
(v) => {
|
|
1764
|
+
g.current = v;
|
|
1765
|
+
const x = m.current?.contentWindow;
|
|
1816
1766
|
try {
|
|
1817
|
-
|
|
1767
|
+
x?.location.replace(new URL(v, L).toString());
|
|
1818
1768
|
} catch {
|
|
1819
|
-
m.current && (m.current.src =
|
|
1769
|
+
m.current && (m.current.src = v);
|
|
1820
1770
|
}
|
|
1821
1771
|
},
|
|
1822
|
-
[
|
|
1772
|
+
[L]
|
|
1823
1773
|
);
|
|
1824
1774
|
I(() => {
|
|
1825
|
-
if (d ===
|
|
1826
|
-
const
|
|
1827
|
-
|
|
1828
|
-
}, [d,
|
|
1829
|
-
const
|
|
1830
|
-
const
|
|
1831
|
-
origin:
|
|
1775
|
+
if (d === k.current) return;
|
|
1776
|
+
const v = k.current;
|
|
1777
|
+
k.current = d, _e(v) !== _e(d) ? P(d) : ae(m.current?.contentWindow, { ds: 1, type: "location", url: d }, L);
|
|
1778
|
+
}, [d, P, L]), I(() => {
|
|
1779
|
+
const v = (x) => {
|
|
1780
|
+
const M = Be(x, {
|
|
1781
|
+
origin: L,
|
|
1832
1782
|
source: m.current?.contentWindow
|
|
1833
1783
|
});
|
|
1834
|
-
if (
|
|
1835
|
-
switch (
|
|
1784
|
+
if (M)
|
|
1785
|
+
switch (M.type) {
|
|
1836
1786
|
case "ready": {
|
|
1837
|
-
if (
|
|
1838
|
-
if (
|
|
1787
|
+
if (M.url === k.current) return;
|
|
1788
|
+
if (M.url === g.current) {
|
|
1839
1789
|
ae(
|
|
1840
1790
|
m.current?.contentWindow,
|
|
1841
|
-
{ ds: 1, type: "location", url:
|
|
1842
|
-
|
|
1791
|
+
{ ds: 1, type: "location", url: k.current },
|
|
1792
|
+
L
|
|
1843
1793
|
);
|
|
1844
1794
|
return;
|
|
1845
1795
|
}
|
|
1846
|
-
|
|
1796
|
+
k.current = M.url, g.current = M.url, i(M.url, !0);
|
|
1847
1797
|
return;
|
|
1848
1798
|
}
|
|
1849
1799
|
case "navigate":
|
|
1850
|
-
|
|
1800
|
+
k.current = M.url, i(M.url, M.replace);
|
|
1851
1801
|
return;
|
|
1852
1802
|
case "shortcut":
|
|
1853
|
-
l(
|
|
1803
|
+
l(M.key);
|
|
1854
1804
|
return;
|
|
1855
1805
|
default:
|
|
1856
1806
|
return;
|
|
1857
1807
|
}
|
|
1858
1808
|
};
|
|
1859
|
-
return window.addEventListener("message",
|
|
1860
|
-
}, [i, l,
|
|
1861
|
-
const
|
|
1809
|
+
return window.addEventListener("message", v), () => window.removeEventListener("message", v);
|
|
1810
|
+
}, [i, l, L]);
|
|
1811
|
+
const N = !!t.width, w = N ? Gt : 0, u = Math.max(0, h.width - w * 2), C = Math.max(0, h.height - w * 2), b = !t.width || u === 0 || t.width <= u, y = s === 100 && !b ? Math.max(10, Math.floor(u / t.width * 100)) : s, _ = y / 100;
|
|
1862
1812
|
I(() => {
|
|
1863
|
-
a?.(
|
|
1864
|
-
}, [
|
|
1865
|
-
const
|
|
1866
|
-
return /* @__PURE__ */ n("div", { className: "ds-canvas", ref:
|
|
1813
|
+
a?.(y);
|
|
1814
|
+
}, [y, a]);
|
|
1815
|
+
const z = t.width ?? u / _, c = t.height ?? C / _;
|
|
1816
|
+
return /* @__PURE__ */ n("div", { className: "ds-canvas", ref: p, "data-fit": N ? void 0 : "true", children: /* @__PURE__ */ n(
|
|
1867
1817
|
"div",
|
|
1868
1818
|
{
|
|
1869
1819
|
className: "ds-canvas__box",
|
|
1870
|
-
style: { width: Math.floor(
|
|
1820
|
+
style: { width: Math.floor(z * _), height: Math.floor(c * _) },
|
|
1871
1821
|
children: /* @__PURE__ */ n(
|
|
1872
1822
|
"iframe",
|
|
1873
1823
|
{
|
|
1874
1824
|
ref: m,
|
|
1875
1825
|
[ft]: "",
|
|
1876
1826
|
className: "ds-frame",
|
|
1877
|
-
src:
|
|
1827
|
+
src: f,
|
|
1878
1828
|
title: o,
|
|
1879
1829
|
style: {
|
|
1880
|
-
width: Math.floor(
|
|
1830
|
+
width: Math.floor(z),
|
|
1881
1831
|
height: Math.floor(c),
|
|
1882
|
-
transform:
|
|
1832
|
+
transform: _ === 1 ? void 0 : `scale(${_})`,
|
|
1883
1833
|
pointerEvents: r ? "none" : void 0
|
|
1884
1834
|
}
|
|
1885
1835
|
}
|
|
@@ -1887,15 +1837,15 @@ function Xt({
|
|
|
1887
1837
|
}
|
|
1888
1838
|
) });
|
|
1889
1839
|
}
|
|
1890
|
-
function
|
|
1891
|
-
const [t, s] =
|
|
1840
|
+
function Yt(e) {
|
|
1841
|
+
const [t, s] = V({ width: 0, height: 0 });
|
|
1892
1842
|
return Ue(() => {
|
|
1893
1843
|
const o = e.current;
|
|
1894
1844
|
if (!o) return;
|
|
1895
1845
|
const r = () => {
|
|
1896
1846
|
const l = o.clientWidth, a = o.clientHeight;
|
|
1897
1847
|
s(
|
|
1898
|
-
(
|
|
1848
|
+
(p) => p.width === l && p.height === a ? p : { width: l, height: a }
|
|
1899
1849
|
);
|
|
1900
1850
|
};
|
|
1901
1851
|
if (r(), typeof ResizeObserver > "u")
|
|
@@ -1927,35 +1877,35 @@ const Le = {
|
|
|
1927
1877
|
return new Promise(() => {
|
|
1928
1878
|
});
|
|
1929
1879
|
case "slow":
|
|
1930
|
-
return await
|
|
1880
|
+
return await Xt(Je), Me(t);
|
|
1931
1881
|
default:
|
|
1932
1882
|
return Me(t);
|
|
1933
1883
|
}
|
|
1934
1884
|
}
|
|
1935
1885
|
};
|
|
1936
|
-
function
|
|
1886
|
+
function dn(e) {
|
|
1937
1887
|
const { id: t, label: s, baseUrl: o, path: r, init: i, fallbackToFixture: l = !0 } = e;
|
|
1938
1888
|
return {
|
|
1939
1889
|
id: t,
|
|
1940
1890
|
label: s,
|
|
1941
1891
|
load: async (a) => {
|
|
1942
|
-
const
|
|
1892
|
+
const p = new URL(r ? r(a) : a.scenario.route, o);
|
|
1943
1893
|
try {
|
|
1944
|
-
const m = await fetch(
|
|
1894
|
+
const m = await fetch(p, i);
|
|
1945
1895
|
if (!m.ok) throw new Error(`${m.status} ${m.statusText}`);
|
|
1946
1896
|
return await m.json();
|
|
1947
1897
|
} catch (m) {
|
|
1948
1898
|
if (l) return Me(a.fixture);
|
|
1949
|
-
throw new Error(`Adapter "${t}" falhou em ${
|
|
1899
|
+
throw new Error(`Adapter "${t}" falhou em ${p.toString()}`, { cause: m });
|
|
1950
1900
|
}
|
|
1951
1901
|
}
|
|
1952
1902
|
};
|
|
1953
1903
|
}
|
|
1954
|
-
function
|
|
1904
|
+
function Xt(e) {
|
|
1955
1905
|
return new Promise((t) => setTimeout(t, e));
|
|
1956
1906
|
}
|
|
1957
|
-
function
|
|
1958
|
-
const { scenario: t, fixture: s, network: o, adapter: r } = e, [i, l] =
|
|
1907
|
+
function Qt(e) {
|
|
1908
|
+
const { scenario: t, fixture: s, network: o, adapter: r } = e, [i, l] = V({
|
|
1959
1909
|
data: void 0,
|
|
1960
1910
|
isLoading: !!t || o === "loading" || o === "slow",
|
|
1961
1911
|
error: void 0
|
|
@@ -1990,8 +1940,8 @@ function en(e) {
|
|
|
1990
1940
|
}
|
|
1991
1941
|
let a = !0;
|
|
1992
1942
|
l({ data: void 0, isLoading: !0, error: void 0 });
|
|
1993
|
-
const
|
|
1994
|
-
return Promise.resolve(
|
|
1943
|
+
const p = r ?? Le;
|
|
1944
|
+
return Promise.resolve(p.load({ scenario: t, fixture: s, network: o })).then((m) => {
|
|
1995
1945
|
a && l({ data: m, isLoading: !1, error: void 0 });
|
|
1996
1946
|
}).catch((m) => {
|
|
1997
1947
|
a && l({
|
|
@@ -2005,20 +1955,20 @@ function en(e) {
|
|
|
2005
1955
|
}, [t, s, o, r, e.screen]), i;
|
|
2006
1956
|
}
|
|
2007
1957
|
function De({ title: e, children: t }) {
|
|
2008
|
-
return /* @__PURE__ */
|
|
1958
|
+
return /* @__PURE__ */ S("div", { className: "ds-stage-empty", children: [
|
|
2009
1959
|
/* @__PURE__ */ n("h2", { className: "ds-stage-empty__title", children: e }),
|
|
2010
1960
|
t
|
|
2011
1961
|
] });
|
|
2012
1962
|
}
|
|
2013
|
-
function
|
|
2014
|
-
const s =
|
|
1963
|
+
function Jt({ product: e, registry: t }) {
|
|
1964
|
+
const s = J(), { location: o, controls: r, viewport: i, navigate: l, openScenario: a, setScreenControls: p } = Ge(
|
|
2015
1965
|
t,
|
|
2016
1966
|
{ frame: !0 }
|
|
2017
|
-
), m =
|
|
1967
|
+
), m = q(null);
|
|
2018
1968
|
I(() => {
|
|
2019
|
-
const
|
|
2020
|
-
if (
|
|
2021
|
-
const A =
|
|
1969
|
+
const T = (O) => {
|
|
1970
|
+
if (O.defaultPrevented || O.button !== 0 || O.metaKey || O.ctrlKey || O.shiftKey || O.altKey) return;
|
|
1971
|
+
const A = O.target?.closest?.("a[href]");
|
|
2022
1972
|
if (!(A instanceof HTMLAnchorElement) || A.target && A.target !== "_self" || A.hasAttribute("download")) return;
|
|
2023
1973
|
const j = A.getAttribute("href") ?? "";
|
|
2024
1974
|
if (j.startsWith("#")) return;
|
|
@@ -2028,115 +1978,115 @@ function tn({ product: e, registry: t }) {
|
|
|
2028
1978
|
} catch {
|
|
2029
1979
|
return;
|
|
2030
1980
|
}
|
|
2031
|
-
B.origin === window.location.origin && (
|
|
1981
|
+
B.origin === window.location.origin && (O.preventDefault(), l(`${B.pathname}${B.search}`));
|
|
2032
1982
|
};
|
|
2033
|
-
return document.addEventListener("click",
|
|
1983
|
+
return document.addEventListener("click", T), () => document.removeEventListener("click", T);
|
|
2034
1984
|
}, [l]), I(() => {
|
|
2035
|
-
const
|
|
1985
|
+
const T = (O) => {
|
|
2036
1986
|
if (window.parent === window) return;
|
|
2037
|
-
const A =
|
|
1987
|
+
const A = en(O);
|
|
2038
1988
|
if (!A) return;
|
|
2039
|
-
const j =
|
|
2040
|
-
A === "C" && j?.closest?.("input, textarea, select, [contenteditable='true'], [contenteditable='']") || (
|
|
1989
|
+
const j = O.target;
|
|
1990
|
+
A === "C" && j?.closest?.("input, textarea, select, [contenteditable='true'], [contenteditable='']") || (O.preventDefault(), ae(window.parent, { ds: 1, type: "shortcut", key: A }, window.location.origin));
|
|
2041
1991
|
};
|
|
2042
|
-
return window.addEventListener("keydown",
|
|
1992
|
+
return window.addEventListener("keydown", T), () => window.removeEventListener("keydown", T);
|
|
2043
1993
|
}, []), I(() => {
|
|
2044
|
-
const
|
|
2045
|
-
if (!
|
|
2046
|
-
const
|
|
2047
|
-
for (const j of
|
|
1994
|
+
const T = m.current;
|
|
1995
|
+
if (!T || !r.handoff) return;
|
|
1996
|
+
const O = () => {
|
|
1997
|
+
for (const j of T.querySelectorAll("a[href]")) {
|
|
2048
1998
|
const B = j.getAttribute("href");
|
|
2049
1999
|
if (!B || B.startsWith("#")) continue;
|
|
2050
|
-
let
|
|
2000
|
+
let Q;
|
|
2051
2001
|
try {
|
|
2052
|
-
|
|
2002
|
+
Q = new URL(B, window.location.href);
|
|
2053
2003
|
} catch {
|
|
2054
2004
|
continue;
|
|
2055
2005
|
}
|
|
2056
|
-
if (
|
|
2057
|
-
Te(
|
|
2058
|
-
const ie = `${
|
|
2006
|
+
if (Q.origin !== window.location.origin) continue;
|
|
2007
|
+
Te(Q.searchParams, r.handoff);
|
|
2008
|
+
const ie = `${Q.pathname}${Q.search}${Q.hash}`;
|
|
2059
2009
|
B !== ie && j.setAttribute("href", ie);
|
|
2060
2010
|
}
|
|
2061
2011
|
};
|
|
2062
|
-
|
|
2063
|
-
const A = new MutationObserver(
|
|
2064
|
-
return A.observe(
|
|
2012
|
+
O();
|
|
2013
|
+
const A = new MutationObserver(O);
|
|
2014
|
+
return A.observe(T, { subtree: !0, childList: !0, attributes: !0, attributeFilter: ["href"] }), () => A.disconnect();
|
|
2065
2015
|
}, [r.handoff]);
|
|
2066
|
-
const
|
|
2067
|
-
const
|
|
2016
|
+
const h = t.scenario(r.scenario), d = t.component(r.component), f = D(() => {
|
|
2017
|
+
const T = new URLSearchParams(o.search);
|
|
2068
2018
|
return {
|
|
2069
|
-
scenario:
|
|
2070
|
-
component:
|
|
2019
|
+
scenario: T.get($.scenario) ?? void 0,
|
|
2020
|
+
component: T.get($.component) ?? void 0
|
|
2071
2021
|
};
|
|
2072
|
-
}, [o.search]),
|
|
2022
|
+
}, [o.search]), k = !!(r.handoff && (f.scenario && !oe(r.handoff, f.scenario) || f.component && !ve(r.handoff, f.component) || !f.component && !Ie(r.handoff, o.path, e.scenarios))), g = D(
|
|
2073
2023
|
() => t.resolveComponentFixture(d?.id, d ? r.fixture : void 0),
|
|
2074
2024
|
[d, r.fixture, t]
|
|
2075
|
-
),
|
|
2076
|
-
const
|
|
2077
|
-
return typeof
|
|
2078
|
-
}, [
|
|
2079
|
-
const
|
|
2080
|
-
return
|
|
2081
|
-
}, [r.dataSource, e.dataSources?.adapters]), { data:
|
|
2082
|
-
scenario:
|
|
2083
|
-
fixture:
|
|
2025
|
+
), L = D(() => {
|
|
2026
|
+
const T = g.fixture?.data;
|
|
2027
|
+
return typeof T == "function" ? T() : T;
|
|
2028
|
+
}, [g.fixture]), P = t.persona(r.persona ?? h?.persona), N = t.fixture(r.fixture ?? h?.fixture), w = D(() => {
|
|
2029
|
+
const T = r.dataSource ?? "fixtures";
|
|
2030
|
+
return T === "fixtures" ? Le : e.dataSources?.adapters?.find((O) => O.id === T) ?? Le;
|
|
2031
|
+
}, [r.dataSource, e.dataSources?.adapters]), { data: u, isLoading: C, error: b } = Qt({
|
|
2032
|
+
scenario: h,
|
|
2033
|
+
fixture: N,
|
|
2084
2034
|
network: r.network,
|
|
2085
2035
|
adapter: w,
|
|
2086
2036
|
screen: o.path
|
|
2087
|
-
}),
|
|
2088
|
-
(
|
|
2089
|
-
[
|
|
2090
|
-
),
|
|
2037
|
+
}), y = D(() => h ? r.persona && r.persona !== (h.persona ?? t.defaultPersona) ? t.persona(r.persona)?.permissions ?? [] : t.permissionsOf(h) : t.persona(r.persona)?.permissions ?? [], [r.persona, t, h]), _ = r.screenControls, z = D(() => _ ?? {}, [_]), c = U(
|
|
2038
|
+
(T, O) => p({ [T]: O }),
|
|
2039
|
+
[p]
|
|
2040
|
+
), v = D(
|
|
2091
2041
|
() => ({
|
|
2092
|
-
scenario:
|
|
2093
|
-
persona:
|
|
2094
|
-
permissions:
|
|
2095
|
-
can: (
|
|
2096
|
-
data:
|
|
2097
|
-
fixture:
|
|
2042
|
+
scenario: h,
|
|
2043
|
+
persona: P,
|
|
2044
|
+
permissions: y,
|
|
2045
|
+
can: (T) => y.includes(T),
|
|
2046
|
+
data: u,
|
|
2047
|
+
fixture: N,
|
|
2098
2048
|
network: r.network,
|
|
2099
|
-
isLoading:
|
|
2100
|
-
error:
|
|
2101
|
-
rules: t.rulesOf(
|
|
2049
|
+
isLoading: C,
|
|
2050
|
+
error: b,
|
|
2051
|
+
rules: t.rulesOf(h),
|
|
2102
2052
|
viewport: i,
|
|
2103
2053
|
themeMode: r.themeMode,
|
|
2104
2054
|
locale: r.locale,
|
|
2105
2055
|
navigate: l,
|
|
2106
2056
|
openScenario: a,
|
|
2107
|
-
controls:
|
|
2057
|
+
controls: z,
|
|
2108
2058
|
setControl: c,
|
|
2109
|
-
setControls:
|
|
2059
|
+
setControls: p
|
|
2110
2060
|
}),
|
|
2111
2061
|
[
|
|
2112
|
-
|
|
2113
|
-
|
|
2062
|
+
h,
|
|
2063
|
+
P,
|
|
2064
|
+
y,
|
|
2114
2065
|
u,
|
|
2115
|
-
|
|
2116
|
-
x,
|
|
2066
|
+
N,
|
|
2117
2067
|
r.network,
|
|
2118
2068
|
r.themeMode,
|
|
2119
2069
|
r.locale,
|
|
2120
|
-
|
|
2121
|
-
|
|
2070
|
+
C,
|
|
2071
|
+
b,
|
|
2122
2072
|
t,
|
|
2123
2073
|
i,
|
|
2124
2074
|
l,
|
|
2125
2075
|
a,
|
|
2126
|
-
|
|
2076
|
+
z,
|
|
2127
2077
|
c,
|
|
2128
|
-
|
|
2078
|
+
p
|
|
2129
2079
|
]
|
|
2130
|
-
),
|
|
2131
|
-
|
|
2080
|
+
), x = xe(e.routes ?? [], o.path), M = e.wrapper, F = e.notFound, E = d?.preview, K = k ? /* @__PURE__ */ n(De, { title: s.shell.outsideHandoff, children: /* @__PURE__ */ n("p", { children: s.shell.outsideHandoffHint }) }) : E ? /* @__PURE__ */ n(
|
|
2081
|
+
E,
|
|
2132
2082
|
{
|
|
2133
|
-
fixture:
|
|
2134
|
-
data:
|
|
2083
|
+
fixture: g.fixture,
|
|
2084
|
+
data: L,
|
|
2135
2085
|
viewport: i,
|
|
2136
2086
|
themeMode: r.themeMode ?? "default",
|
|
2137
2087
|
locale: r.locale ?? "default"
|
|
2138
2088
|
}
|
|
2139
|
-
) :
|
|
2089
|
+
) : x ? /* @__PURE__ */ n(x.definition.screen, { params: x.params, context: v }) : F ? /* @__PURE__ */ n(F, { path: o.path }) : /* @__PURE__ */ n(De, { title: s.shell.noRoute, children: /* @__PURE__ */ S("p", { children: [
|
|
2140
2090
|
/* @__PURE__ */ n("code", { children: o.path }),
|
|
2141
2091
|
" ",
|
|
2142
2092
|
s.shell.noRouteHint
|
|
@@ -2144,10 +2094,10 @@ function tn({ product: e, registry: t }) {
|
|
|
2144
2094
|
return (
|
|
2145
2095
|
// `display: contents` deixa o layout do produto como se este nó não
|
|
2146
2096
|
// existisse: ele só serve de raiz para observar os links.
|
|
2147
|
-
/* @__PURE__ */ n("div", { ref: m, style: { display: "contents" }, children:
|
|
2097
|
+
/* @__PURE__ */ n("div", { ref: m, style: { display: "contents" }, children: M && !k ? /* @__PURE__ */ n(M, { context: v, children: K }) : K })
|
|
2148
2098
|
);
|
|
2149
2099
|
}
|
|
2150
|
-
function
|
|
2100
|
+
function en(e) {
|
|
2151
2101
|
if (!e.altKey) {
|
|
2152
2102
|
if (e.shiftKey && !e.metaKey && !e.ctrlKey && e.key === "C") return "C";
|
|
2153
2103
|
if ((e.metaKey || e.ctrlKey) && !e.shiftKey) {
|
|
@@ -2157,7 +2107,7 @@ function nn(e) {
|
|
|
2157
2107
|
}
|
|
2158
2108
|
}
|
|
2159
2109
|
}
|
|
2160
|
-
const
|
|
2110
|
+
const he = {
|
|
2161
2111
|
leftWidth: "ds:left-width",
|
|
2162
2112
|
rightWidth: "ds:right-width",
|
|
2163
2113
|
appearance: "ds:appearance"
|
|
@@ -2175,30 +2125,30 @@ function nt(e, t) {
|
|
|
2175
2125
|
} catch {
|
|
2176
2126
|
}
|
|
2177
2127
|
}
|
|
2178
|
-
function
|
|
2128
|
+
function Ve(e, t, s) {
|
|
2179
2129
|
return Math.round(Math.min(s, Math.max(t, e)));
|
|
2180
2130
|
}
|
|
2181
|
-
function
|
|
2182
|
-
const [r, i] =
|
|
2131
|
+
function Ke(e, t, s, o) {
|
|
2132
|
+
const [r, i] = V(() => {
|
|
2183
2133
|
const a = Number.parseInt(tt(e) ?? "", 10);
|
|
2184
|
-
return Number.isFinite(a) ?
|
|
2134
|
+
return Number.isFinite(a) ? Ve(a, s, o) : t;
|
|
2185
2135
|
}), l = U(
|
|
2186
2136
|
(a) => {
|
|
2187
|
-
const
|
|
2188
|
-
i(
|
|
2137
|
+
const p = Ve(a, s, o);
|
|
2138
|
+
i(p), nt(e, String(p));
|
|
2189
2139
|
},
|
|
2190
2140
|
[e, o, s]
|
|
2191
2141
|
);
|
|
2192
2142
|
return [r, l];
|
|
2193
2143
|
}
|
|
2194
|
-
function
|
|
2144
|
+
function tn() {
|
|
2195
2145
|
const e = "(prefers-color-scheme: dark)", t = () => {
|
|
2196
2146
|
try {
|
|
2197
2147
|
return window.matchMedia(e).matches ? "dark" : "light";
|
|
2198
2148
|
} catch {
|
|
2199
2149
|
return "light";
|
|
2200
2150
|
}
|
|
2201
|
-
}, [s, o] =
|
|
2151
|
+
}, [s, o] = V(t);
|
|
2202
2152
|
return I(() => {
|
|
2203
2153
|
let r;
|
|
2204
2154
|
try {
|
|
@@ -2210,85 +2160,85 @@ function on() {
|
|
|
2210
2160
|
return r.addEventListener?.("change", i), () => r?.removeEventListener?.("change", i);
|
|
2211
2161
|
}, []), s;
|
|
2212
2162
|
}
|
|
2213
|
-
function
|
|
2214
|
-
const e = tt(
|
|
2163
|
+
function nn() {
|
|
2164
|
+
const e = tt(he.appearance);
|
|
2215
2165
|
return e === "dark" || e === "light" ? e : void 0;
|
|
2216
2166
|
}
|
|
2217
|
-
function
|
|
2218
|
-
const t = D(() =>
|
|
2219
|
-
return /* @__PURE__ */ n(Ye.Provider, { value: s, children: o ? /* @__PURE__ */ n(
|
|
2167
|
+
function un({ product: e }) {
|
|
2168
|
+
const t = D(() => gt(e), [e]), s = D(() => Rt(e.theme?.labels), [e.theme?.labels]), [o] = V(() => wt());
|
|
2169
|
+
return /* @__PURE__ */ n(Ye.Provider, { value: s, children: o ? /* @__PURE__ */ n(Jt, { product: e, registry: t }) : /* @__PURE__ */ n(on, { product: e, registry: t }) });
|
|
2220
2170
|
}
|
|
2221
2171
|
const Ce = { initial: 290, min: 200, max: 480 }, Se = { initial: 320, min: 260, max: 560 };
|
|
2222
|
-
function
|
|
2223
|
-
const s =
|
|
2224
|
-
|
|
2225
|
-
const
|
|
2226
|
-
|
|
2172
|
+
function on({ product: e, registry: t }) {
|
|
2173
|
+
const s = J(), o = D(() => vt(e.deploy), [e.deploy]), { location: r, controls: i, viewport: l, setControls: a, openScenario: p, openComponent: m, openScreen: h, go: d } = Ge(t), f = q(r);
|
|
2174
|
+
f.current = r;
|
|
2175
|
+
const k = tn(), [g, L] = V(() => nn()), P = i.chromeTheme ?? g ?? k, [N, w] = Ke(
|
|
2176
|
+
he.leftWidth,
|
|
2227
2177
|
Ce.initial,
|
|
2228
2178
|
Ce.min,
|
|
2229
2179
|
Ce.max
|
|
2230
|
-
), [
|
|
2231
|
-
|
|
2180
|
+
), [u, C] = Ke(
|
|
2181
|
+
he.rightWidth,
|
|
2232
2182
|
Se.initial,
|
|
2233
2183
|
Se.min,
|
|
2234
2184
|
Se.max
|
|
2235
|
-
), [
|
|
2236
|
-
() => t.resolveComponentFixture(
|
|
2237
|
-
[
|
|
2238
|
-
),
|
|
2239
|
-
if (!
|
|
2240
|
-
const { invalid:
|
|
2241
|
-
scenario:
|
|
2185
|
+
), [b, y] = V(!1), _ = i.handoff, z = t.component(i.component), c = t.scenario(i.scenario), v = z ? void 0 : t.screensFor({ handoff: _ }).find((R) => R.id === t.screenForPath(r.path)?.id), x = v && c && v.variations.some((R) => R.id === c.id) ? c : void 0, M = D(
|
|
2186
|
+
() => t.resolveComponentFixture(z?.id, z ? i.fixture : void 0),
|
|
2187
|
+
[z, i.fixture, t]
|
|
2188
|
+
), F = D(() => {
|
|
2189
|
+
if (!v || v.controls.length === 0) return t.issues;
|
|
2190
|
+
const { invalid: R } = t.resolveControls(v, {
|
|
2191
|
+
scenario: x,
|
|
2242
2192
|
requested: We(r.search)
|
|
2243
2193
|
});
|
|
2244
|
-
return
|
|
2194
|
+
return R.length === 0 ? t.issues : [...R.map((Z) => ({
|
|
2245
2195
|
level: "warning",
|
|
2246
|
-
where: `url:${
|
|
2247
|
-
message:
|
|
2196
|
+
where: `url:${be}${Z.id}`,
|
|
2197
|
+
message: Z.reason === "invalid-value" ? s.diagnostics.invalidControl(Z.id, Z.value, Z.fallback ?? "") : s.diagnostics.unknownControl(Z.id, Z.value)
|
|
2248
2198
|
})), ...t.issues];
|
|
2249
|
-
}, [s, r.search, t,
|
|
2250
|
-
const
|
|
2251
|
-
return
|
|
2252
|
-
}, [r.search]), A = r.path === "/" && !
|
|
2199
|
+
}, [s, r.search, t, v, x]), E = t.screensFor({ handoff: _ })[0], K = t.componentsFor(_)[0], T = !E && !K, O = D(() => {
|
|
2200
|
+
const R = new URLSearchParams(r.search);
|
|
2201
|
+
return R.has($.scenario) || R.has($.component);
|
|
2202
|
+
}, [r.search]), A = r.path === "/" && !O && !t.screenForPath("/") && !T;
|
|
2253
2203
|
I(() => {
|
|
2254
|
-
A && (
|
|
2255
|
-
}, [
|
|
2204
|
+
A && (E ? h(E.id, { replace: !0 }) : K && m(K.id, { replace: !0 }));
|
|
2205
|
+
}, [K, E, m, h, A]);
|
|
2256
2206
|
const j = U(
|
|
2257
2207
|
() => a({ chrome: !i.chrome }),
|
|
2258
2208
|
[i.chrome, a]
|
|
2259
2209
|
), B = U(
|
|
2260
|
-
(
|
|
2261
|
-
if (
|
|
2210
|
+
(R) => {
|
|
2211
|
+
if (R === "C") {
|
|
2262
2212
|
j();
|
|
2263
2213
|
return;
|
|
2264
2214
|
}
|
|
2265
|
-
window.dispatchEvent(new KeyboardEvent("keydown", { key:
|
|
2215
|
+
window.dispatchEvent(new KeyboardEvent("keydown", { key: R.toLowerCase(), metaKey: !0 }));
|
|
2266
2216
|
},
|
|
2267
2217
|
[j]
|
|
2268
2218
|
);
|
|
2269
2219
|
I(() => {
|
|
2270
|
-
const
|
|
2271
|
-
!
|
|
2220
|
+
const R = (G) => {
|
|
2221
|
+
!G.shiftKey || G.metaKey || G.ctrlKey || G.altKey || G.key !== "C" || G.target?.closest?.("input, textarea, select, [contenteditable='true'], [contenteditable='']") || (G.preventDefault(), B(G.key));
|
|
2272
2222
|
};
|
|
2273
|
-
return window.addEventListener("keydown",
|
|
2223
|
+
return window.addEventListener("keydown", R), () => window.removeEventListener("keydown", R);
|
|
2274
2224
|
}, [B]);
|
|
2275
|
-
const
|
|
2276
|
-
(
|
|
2277
|
-
const { path:
|
|
2278
|
-
d(
|
|
2225
|
+
const Q = U(
|
|
2226
|
+
(R, G) => {
|
|
2227
|
+
const { path: Z, search: it } = Ne(R);
|
|
2228
|
+
d(Z, bt(it, f.current.search), { replace: G });
|
|
2279
2229
|
},
|
|
2280
2230
|
[d]
|
|
2281
2231
|
), ie = () => {
|
|
2282
|
-
const
|
|
2283
|
-
nt(
|
|
2284
|
-
}, re = (
|
|
2285
|
-
return /* @__PURE__ */
|
|
2232
|
+
const R = P === "dark" ? "light" : "dark";
|
|
2233
|
+
nt(he.appearance, R), L(R), a({ chromeTheme: R });
|
|
2234
|
+
}, re = (R) => a(R), ot = `${o.origin}${r.path}${r.search}`, rt = i.panelTab ?? "variations", Re = i.zoom ?? 100, [st, at] = V(Re);
|
|
2235
|
+
return /* @__PURE__ */ S(
|
|
2286
2236
|
"div",
|
|
2287
2237
|
{
|
|
2288
2238
|
className: "ds-root",
|
|
2289
|
-
"data-appearance":
|
|
2239
|
+
"data-appearance": P,
|
|
2290
2240
|
"data-chrome": i.chrome ? "visible" : "hidden",
|
|
2291
|
-
"data-resizing":
|
|
2241
|
+
"data-resizing": b ? "true" : void 0,
|
|
2292
2242
|
"data-viewport": l.id,
|
|
2293
2243
|
children: [
|
|
2294
2244
|
i.chrome && /* @__PURE__ */ n(
|
|
@@ -2300,45 +2250,45 @@ function sn({ product: e, registry: t }) {
|
|
|
2300
2250
|
viewport: l,
|
|
2301
2251
|
zoom: st,
|
|
2302
2252
|
rotated: !!i.rotated,
|
|
2303
|
-
theme:
|
|
2304
|
-
issues:
|
|
2253
|
+
theme: P,
|
|
2254
|
+
issues: F,
|
|
2305
2255
|
linkUrl: ot,
|
|
2306
|
-
onViewport: (
|
|
2256
|
+
onViewport: (R) => re({ viewport: R }),
|
|
2307
2257
|
onRotate: () => re({ rotated: !i.rotated }),
|
|
2308
|
-
onZoom: (
|
|
2258
|
+
onZoom: (R) => re({ zoom: R }),
|
|
2309
2259
|
onCleanReview: j,
|
|
2310
2260
|
onToggleTheme: ie
|
|
2311
2261
|
}
|
|
2312
2262
|
),
|
|
2313
|
-
/* @__PURE__ */
|
|
2263
|
+
/* @__PURE__ */ S("div", { className: "ds-body", children: [
|
|
2314
2264
|
i.chrome && /* @__PURE__ */ n(
|
|
2315
2265
|
At,
|
|
2316
2266
|
{
|
|
2317
2267
|
registry: t,
|
|
2318
|
-
handoff:
|
|
2319
|
-
activeScreen:
|
|
2320
|
-
activeComponent:
|
|
2321
|
-
onOpenScreen: (
|
|
2322
|
-
onOpenComponent: (
|
|
2323
|
-
width:
|
|
2268
|
+
handoff: _,
|
|
2269
|
+
activeScreen: v?.id,
|
|
2270
|
+
activeComponent: z?.id,
|
|
2271
|
+
onOpenScreen: (R) => h(R),
|
|
2272
|
+
onOpenComponent: (R) => m(R),
|
|
2273
|
+
width: N,
|
|
2324
2274
|
onResize: w,
|
|
2325
|
-
onResizeStart: () =>
|
|
2326
|
-
onResizeEnd: () =>
|
|
2275
|
+
onResizeStart: () => y(!0),
|
|
2276
|
+
onResizeEnd: () => y(!1)
|
|
2327
2277
|
}
|
|
2328
2278
|
),
|
|
2329
|
-
/* @__PURE__ */ n("main", { className: "ds-main", children:
|
|
2279
|
+
/* @__PURE__ */ n("main", { className: "ds-main", children: T ? /* @__PURE__ */ S("div", { className: "ds-chrome-empty", children: [
|
|
2330
2280
|
/* @__PURE__ */ n("h1", { className: "ds-chrome-empty__title", children: s.shell.empty }),
|
|
2331
2281
|
/* @__PURE__ */ n("p", { className: "ds-muted", children: s.shell.emptyHint })
|
|
2332
2282
|
] }) : A ? null : /* @__PURE__ */ n(
|
|
2333
|
-
|
|
2283
|
+
Zt,
|
|
2334
2284
|
{
|
|
2335
2285
|
location: r,
|
|
2336
2286
|
viewport: l,
|
|
2337
2287
|
zoom: Re,
|
|
2338
2288
|
onEffectiveZoom: at,
|
|
2339
2289
|
title: s.shell.frameTitle(e.name),
|
|
2340
|
-
resizing:
|
|
2341
|
-
onFrameNavigate:
|
|
2290
|
+
resizing: b,
|
|
2291
|
+
onFrameNavigate: Q,
|
|
2342
2292
|
onShortcut: B
|
|
2343
2293
|
}
|
|
2344
2294
|
) }),
|
|
@@ -2349,20 +2299,20 @@ function sn({ product: e, registry: t }) {
|
|
|
2349
2299
|
controls: i,
|
|
2350
2300
|
deploy: o,
|
|
2351
2301
|
location: r,
|
|
2352
|
-
screen:
|
|
2353
|
-
variation:
|
|
2354
|
-
component:
|
|
2355
|
-
componentFixture:
|
|
2302
|
+
screen: v,
|
|
2303
|
+
variation: x,
|
|
2304
|
+
component: z,
|
|
2305
|
+
componentFixture: M,
|
|
2356
2306
|
tab: rt,
|
|
2357
|
-
onTab: (
|
|
2358
|
-
onOpenScenario:
|
|
2359
|
-
onOpenComponent: (
|
|
2360
|
-
onOpenScreen: (
|
|
2307
|
+
onTab: (R) => re({ panelTab: R }),
|
|
2308
|
+
onOpenScenario: p,
|
|
2309
|
+
onOpenComponent: (R) => m(R),
|
|
2310
|
+
onOpenScreen: (R) => h(R),
|
|
2361
2311
|
onChange: re,
|
|
2362
|
-
width:
|
|
2363
|
-
onResize:
|
|
2364
|
-
onResizeStart: () =>
|
|
2365
|
-
onResizeEnd: () =>
|
|
2312
|
+
width: u,
|
|
2313
|
+
onResize: C,
|
|
2314
|
+
onResizeStart: () => y(!0),
|
|
2315
|
+
onResizeEnd: () => y(!1)
|
|
2366
2316
|
}
|
|
2367
2317
|
)
|
|
2368
2318
|
] }),
|
|
@@ -2381,70 +2331,70 @@ function sn({ product: e, registry: t }) {
|
|
|
2381
2331
|
}
|
|
2382
2332
|
);
|
|
2383
2333
|
}
|
|
2384
|
-
function
|
|
2334
|
+
function we(e) {
|
|
2385
2335
|
return new Date(e.length === 10 ? `${e}T00:00:00` : e);
|
|
2386
2336
|
}
|
|
2387
|
-
function
|
|
2388
|
-
const s =
|
|
2337
|
+
function hn(e, t) {
|
|
2338
|
+
const s = we(e), o = we(t);
|
|
2389
2339
|
let r = o.getFullYear() - s.getFullYear();
|
|
2390
2340
|
const i = o.getMonth() - s.getMonth();
|
|
2391
2341
|
return (i < 0 || i === 0 && o.getDate() < s.getDate()) && (r -= 1), r;
|
|
2392
2342
|
}
|
|
2393
|
-
function
|
|
2394
|
-
const s =
|
|
2343
|
+
function pn(e, t) {
|
|
2344
|
+
const s = we(e), o = we(t);
|
|
2395
2345
|
return Math.floor((o.getTime() - s.getTime()) / 864e5);
|
|
2396
2346
|
}
|
|
2397
2347
|
export {
|
|
2398
|
-
|
|
2348
|
+
be as CONTROL_PARAM_PREFIX,
|
|
2399
2349
|
ne as DEFAULT_LABELS,
|
|
2400
|
-
|
|
2401
|
-
|
|
2350
|
+
un as DesignSpace,
|
|
2351
|
+
cn as EN_US_LABELS,
|
|
2402
2352
|
ft as FRAME_ATTRIBUTE,
|
|
2403
|
-
|
|
2404
|
-
|
|
2405
|
-
|
|
2353
|
+
wn as FRAME_PARAM,
|
|
2354
|
+
vn as HANDOFF_PARAM,
|
|
2355
|
+
ln as NETWORK_LABELS,
|
|
2406
2356
|
He as NETWORK_STATES,
|
|
2407
|
-
|
|
2357
|
+
$ as PARAM,
|
|
2408
2358
|
Je as SLOW_NETWORK_DELAY_MS,
|
|
2409
2359
|
et as SimulatedNetworkError,
|
|
2410
2360
|
De as StageEmpty,
|
|
2411
2361
|
St as VIEWPORTS,
|
|
2412
|
-
|
|
2362
|
+
me as ZOOM_DEFAULT,
|
|
2413
2363
|
Ee as ZOOM_MAX,
|
|
2414
2364
|
Pe as ZOOM_MIN,
|
|
2415
|
-
|
|
2365
|
+
hn as ageInYears,
|
|
2416
2366
|
Te as applyHandoffScope,
|
|
2417
2367
|
ye as applyOverrides,
|
|
2418
2368
|
Ze as clampZoom,
|
|
2419
|
-
|
|
2420
|
-
|
|
2421
|
-
|
|
2422
|
-
|
|
2423
|
-
|
|
2369
|
+
bn as commitUrl,
|
|
2370
|
+
gn as componentUrl,
|
|
2371
|
+
dn as createHttpAdapter,
|
|
2372
|
+
gt as createRegistry,
|
|
2373
|
+
pn as daysBetween,
|
|
2424
2374
|
Le as fixtureAdapter,
|
|
2425
|
-
|
|
2426
|
-
|
|
2375
|
+
kn as formatIssues,
|
|
2376
|
+
vt as getDeployContext,
|
|
2427
2377
|
ve as handoffAllowsComponent,
|
|
2428
2378
|
Ie as handoffAllowsPath,
|
|
2429
2379
|
oe as handoffAllowsScenario,
|
|
2430
|
-
|
|
2431
|
-
|
|
2432
|
-
|
|
2380
|
+
Cn as hasErrors,
|
|
2381
|
+
Sn as matchPath,
|
|
2382
|
+
xn as normalizeHandoffScope,
|
|
2433
2383
|
X as normalizeSearch,
|
|
2434
2384
|
$e as parseControls,
|
|
2435
2385
|
ht as parseHandoffScope,
|
|
2436
|
-
|
|
2386
|
+
we as parseIsoDate,
|
|
2437
2387
|
Me as resolveFixture,
|
|
2438
2388
|
Rt as resolveLabels,
|
|
2439
|
-
|
|
2389
|
+
xe as resolveRoute,
|
|
2440
2390
|
yt as resolveViewport,
|
|
2441
|
-
|
|
2391
|
+
pe as scenarioUrl,
|
|
2442
2392
|
se as serializeControls,
|
|
2443
|
-
|
|
2393
|
+
Nn as serializeValue,
|
|
2444
2394
|
Ge as useDesignSpaceState,
|
|
2445
|
-
|
|
2446
|
-
|
|
2395
|
+
J as useLabels,
|
|
2396
|
+
Qt as useScenarioData,
|
|
2447
2397
|
ut as validateProduct,
|
|
2448
|
-
|
|
2398
|
+
yn as validateScenario
|
|
2449
2399
|
};
|
|
2450
2400
|
//# sourceMappingURL=index.js.map
|