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