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