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