@silverpoint/core 0.2.0 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -0
- package/dist/catalog.d.ts +97 -0
- package/dist/catalog.js +8002 -0
- package/dist/catalog.js.map +1 -0
- package/dist/chunk-KFBSQH5G.js +34 -0
- package/dist/chunk-KFBSQH5G.js.map +1 -0
- package/dist/chunk-OLYKR5PS.js +632 -0
- package/dist/chunk-OLYKR5PS.js.map +1 -0
- package/dist/chunk-PD4MD7JU.js +170 -0
- package/dist/chunk-PD4MD7JU.js.map +1 -0
- package/dist/dashboard-demos.d.ts +2 -1
- package/dist/index.d.ts +10 -55
- package/dist/index.js +36 -793
- package/dist/index.js.map +1 -1
- package/dist/model-CLhtoG75.d.ts +53 -0
- package/dist/{types-D1hjElfL.d.ts → props-Dq8FC8GG.d.ts} +369 -143
- package/dist/types-B81k-s9_.d.ts +148 -0
- package/dist/ui-demos.d.ts +17 -0
- package/dist/ui-demos.js +129 -0
- package/dist/ui-demos.js.map +1 -0
- package/dist/ui.d.ts +545 -0
- package/dist/ui.js +716 -0
- package/dist/ui.js.map +1 -0
- package/package.json +19 -1
package/dist/ui.js
ADDED
|
@@ -0,0 +1,716 @@
|
|
|
1
|
+
import { DEFAULTS } from './chunk-KFBSQH5G.js';
|
|
2
|
+
import { round2, roundPathData, arcPath, circlePath, diagnose, resolveSeed } from './chunk-OLYKR5PS.js';
|
|
3
|
+
|
|
4
|
+
// src/ui/catalog.ts
|
|
5
|
+
var BATCH = {
|
|
6
|
+
Button: "B1",
|
|
7
|
+
Input: "B1",
|
|
8
|
+
Checkbox: "B1",
|
|
9
|
+
Switch: "B1",
|
|
10
|
+
Card: "B1",
|
|
11
|
+
Divider: "B1",
|
|
12
|
+
RadioGroup: "B2",
|
|
13
|
+
Segmented: "B2",
|
|
14
|
+
Tabs: "B2",
|
|
15
|
+
Slider: "B2",
|
|
16
|
+
Rate: "B2"
|
|
17
|
+
};
|
|
18
|
+
var row = (name, group, states) => Object.freeze({
|
|
19
|
+
name,
|
|
20
|
+
batch: BATCH[name] ?? "B3",
|
|
21
|
+
slug: name.replace(/[A-Z]/g, (m, i) => (i ? "-" : "") + m.toLowerCase()),
|
|
22
|
+
component: `Sp${name}`,
|
|
23
|
+
group,
|
|
24
|
+
states: Object.freeze([...states])
|
|
25
|
+
});
|
|
26
|
+
var UI_COMPONENTS = /* @__PURE__ */ Object.freeze([
|
|
27
|
+
row("Button", "actions", ["default", "primary", "danger", "disabled"]),
|
|
28
|
+
row("Input", "data-entry", ["empty", "filled", "invalid", "disabled"]),
|
|
29
|
+
row("Checkbox", "data-entry", ["unchecked", "checked", "indeterminate", "disabled"]),
|
|
30
|
+
row("RadioGroup", "data-entry", ["selected", "disabled-item"]),
|
|
31
|
+
row("Switch", "data-entry", ["off", "on", "disabled"]),
|
|
32
|
+
row("Slider", "data-entry", ["marks", "disabled"]),
|
|
33
|
+
row("Rate", "data-entry", ["three", "read-only"]),
|
|
34
|
+
row("Segmented", "data-entry", ["first", "middle"]),
|
|
35
|
+
row("Tabs", "navigation", ["first", "disabled-tab"]),
|
|
36
|
+
row("Steps", "navigation", ["current", "error"]),
|
|
37
|
+
row("Card", "data-display", ["plain", "titled"]),
|
|
38
|
+
row("Tag", "data-display", ["tone-1", "closable"]),
|
|
39
|
+
row("Badge", "data-display", ["count", "dot", "overflow"]),
|
|
40
|
+
row("Divider", "data-display", ["plain", "text"]),
|
|
41
|
+
row("Progress", "feedback", ["line", "circle", "indeterminate"]),
|
|
42
|
+
row("Alert", "feedback", ["info", "success", "warning", "error"]),
|
|
43
|
+
row("Skeleton", "feedback", ["paragraph", "avatar"])
|
|
44
|
+
]);
|
|
45
|
+
|
|
46
|
+
// src/ui/value.ts
|
|
47
|
+
var DEFAULT_RANGE = { min: 0, max: 100, step: 1 };
|
|
48
|
+
function warn(component, property, message) {
|
|
49
|
+
if (process.env.NODE_ENV !== "production") diagnose("SP017", component, { property, message });
|
|
50
|
+
}
|
|
51
|
+
var tidy = (x) => Number.parseFloat(x.toPrecision(12));
|
|
52
|
+
function uiRange(range, component = "UiValue") {
|
|
53
|
+
const { min, max, step } = range;
|
|
54
|
+
const stepOk = step === void 0 || Number.isFinite(step) && step > 0;
|
|
55
|
+
if (Number.isFinite(min) && Number.isFinite(max) && min < max && stepOk) return range;
|
|
56
|
+
warn(component, "min", `The range ${min}..${max} step ${step} is not valid; 0..100 step 1 is used.`);
|
|
57
|
+
return DEFAULT_RANGE;
|
|
58
|
+
}
|
|
59
|
+
function uiValue(value, range, component = "UiValue") {
|
|
60
|
+
const valid = uiRange(range, component);
|
|
61
|
+
const { min, max, step } = valid;
|
|
62
|
+
let next = Number.isFinite(value) ? Math.min(Math.max(value, min), max) : min;
|
|
63
|
+
if (step !== void 0) {
|
|
64
|
+
const steps = Math.min(Math.round((next - min) / step), Math.floor(tidy((max - min) / step)));
|
|
65
|
+
next = tidy(min + steps * step);
|
|
66
|
+
}
|
|
67
|
+
const corrected = valid !== range || next !== value;
|
|
68
|
+
if (next !== value) warn(component, "value", `${value} is drawn as ${next}.`);
|
|
69
|
+
return { value: next, fraction: round2((next - min) / (max - min)), corrected };
|
|
70
|
+
}
|
|
71
|
+
function uiRateCount(count, component = "SpRate") {
|
|
72
|
+
if (count === void 0) return 5;
|
|
73
|
+
const next = Number.isFinite(count) ? Math.min(Math.max(Math.round(count), 1), 10) : 5;
|
|
74
|
+
if (next !== count) warn(component, "count", `${count} is drawn as ${next}.`);
|
|
75
|
+
return next;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
// src/ui/progress.ts
|
|
79
|
+
var UI_PROGRESS_VIEWBOX = 100;
|
|
80
|
+
function uiProgressArc(fraction, stroke) {
|
|
81
|
+
const centre = UI_PROGRESS_VIEWBOX / 2;
|
|
82
|
+
const radius = centre - stroke / 2;
|
|
83
|
+
const frame2 = { cx: centre, cy: centre, radius };
|
|
84
|
+
const f = Number.isFinite(fraction) ? Math.min(Math.max(fraction, 0), 1) : 0;
|
|
85
|
+
return {
|
|
86
|
+
track: { d: roundPathData(circlePath(centre, centre, radius)), role: "encoding", part: "rule" },
|
|
87
|
+
fill: { d: roundPathData(arcPath(frame2, radius, 0, f * 2 * Math.PI)), role: "encoding", part: "ink" }
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
// src/ui/items.ts
|
|
92
|
+
function uiItems(items, component) {
|
|
93
|
+
const seen = /* @__PURE__ */ new Set();
|
|
94
|
+
const kept = [];
|
|
95
|
+
for (const item of items) {
|
|
96
|
+
if (item.key !== "" && !seen.has(item.key)) {
|
|
97
|
+
seen.add(item.key);
|
|
98
|
+
kept.push(item);
|
|
99
|
+
} else if (process.env.NODE_ENV !== "production") {
|
|
100
|
+
const why = item.key === "" ? "An item has an empty key" : `The key "${item.key}" repeats`;
|
|
101
|
+
diagnose("SP019", component, { property: "items", message: `${why}; that item is skipped.` });
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
return kept.length === items.length ? items : kept;
|
|
105
|
+
}
|
|
106
|
+
function uiSelectedKey(items, value, fallback) {
|
|
107
|
+
if (items.some((item) => item.key === value && item.disabled !== true)) return value;
|
|
108
|
+
return fallback === "first" ? items.find((item) => item.disabled !== true)?.key ?? null : null;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
// src/ui/steps.ts
|
|
112
|
+
function uiSteps(items, current, component = "SpSteps") {
|
|
113
|
+
const steps = uiItems(items, component);
|
|
114
|
+
if (steps.length === 0) return [];
|
|
115
|
+
const last = steps.length - 1;
|
|
116
|
+
const at = Number.isFinite(current) ? Math.min(Math.max(Math.round(current), 0), last) : 0;
|
|
117
|
+
if (at !== current && process.env.NODE_ENV !== "production") {
|
|
118
|
+
diagnose("SP017", component, { property: "current", message: `${current} is drawn as ${at}.` });
|
|
119
|
+
}
|
|
120
|
+
const statuses = steps.map((item, i) => item.status ?? (i < at ? "finish" : i === at ? "process" : "wait"));
|
|
121
|
+
return steps.map((item, i) => ({ key: item.key, status: statuses[i], connector: i < last ? statuses[i + 1] : null, current: i === at }));
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
// src/ui/keyboard.ts
|
|
125
|
+
function direction(key, orientation, dir) {
|
|
126
|
+
if (orientation === "vertical") return key === "ArrowDown" ? 1 : key === "ArrowUp" ? -1 : 0;
|
|
127
|
+
const forward = key === "ArrowRight" ? 1 : key === "ArrowLeft" ? -1 : 0;
|
|
128
|
+
return dir === "rtl" ? -forward : forward;
|
|
129
|
+
}
|
|
130
|
+
function uiRovingKey(state, key, orientation, dir) {
|
|
131
|
+
const { index, count, disabled } = state;
|
|
132
|
+
const enabled = (i2) => disabled[i2] !== true;
|
|
133
|
+
if (key === "Home" || key === "End") {
|
|
134
|
+
const step2 = key === "Home" ? 1 : -1;
|
|
135
|
+
for (let n = 0, i2 = key === "Home" ? 0 : count - 1; n < count; n++, i2 += step2) if (enabled(i2)) return i2;
|
|
136
|
+
return index;
|
|
137
|
+
}
|
|
138
|
+
const step = direction(key, orientation, dir);
|
|
139
|
+
if (step === 0) return index;
|
|
140
|
+
let i = index < 0 || index >= count ? step > 0 ? -1 : count : index;
|
|
141
|
+
for (let n = 0; n < count; n++) {
|
|
142
|
+
i = ((i + step) % count + count) % count;
|
|
143
|
+
if (enabled(i)) return i;
|
|
144
|
+
}
|
|
145
|
+
return index;
|
|
146
|
+
}
|
|
147
|
+
var ROVING = /* @__PURE__ */ new Set(["ArrowLeft", "ArrowRight", "ArrowUp", "ArrowDown", "Home", "End"]);
|
|
148
|
+
var uiIsRovingKey = (key) => ROVING.has(key);
|
|
149
|
+
|
|
150
|
+
// src/ui/roving.ts
|
|
151
|
+
function uiRovingFocus(event, root2, selector, orientation, activate) {
|
|
152
|
+
const { key } = event;
|
|
153
|
+
if (!uiIsRovingKey(key)) return;
|
|
154
|
+
const items = Array.from(root2.querySelectorAll(selector));
|
|
155
|
+
const index = items.indexOf(root2.ownerDocument?.activeElement);
|
|
156
|
+
if (index < 0) return;
|
|
157
|
+
const axis = orientation !== "both" ? orientation : key === "ArrowUp" || key === "ArrowDown" ? "vertical" : "horizontal";
|
|
158
|
+
const dir = root2.closest("[dir]")?.getAttribute("dir") === "rtl" ? "rtl" : "ltr";
|
|
159
|
+
const next = uiRovingKey({ index, count: items.length, disabled: items.map((item) => item.disabled === true) }, key, axis, dir);
|
|
160
|
+
if (next === index) return;
|
|
161
|
+
event.preventDefault();
|
|
162
|
+
items[next].focus();
|
|
163
|
+
if (activate) items[next].click();
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
// src/ui/frame.ts
|
|
167
|
+
var UI_FRAME_KINDS = /* @__PURE__ */ Object.freeze({
|
|
168
|
+
control: Object.freeze({ size: 24, slice: 8, radius: 2 }),
|
|
169
|
+
pill: Object.freeze({ size: 36, slice: 12, radius: 12 }),
|
|
170
|
+
box: Object.freeze({ size: 16, slice: 8, radius: 2 }),
|
|
171
|
+
card: Object.freeze({ size: 48, slice: 16, radius: 2 }),
|
|
172
|
+
round: Object.freeze({ size: 24, slice: 12, radius: 12 })
|
|
173
|
+
});
|
|
174
|
+
var MAX_VARIANTS = 6;
|
|
175
|
+
function uiFrameVariant(seed, id, variants) {
|
|
176
|
+
const n = Number.isFinite(variants) ? Math.min(Math.max(Math.floor(variants), 1), MAX_VARIANTS) : 1;
|
|
177
|
+
if (seed === void 0 && !id) return 0;
|
|
178
|
+
return resolveSeed(seed, id ?? "") % n;
|
|
179
|
+
}
|
|
180
|
+
var INSET = 0.5;
|
|
181
|
+
function roundedSquare(size, radius) {
|
|
182
|
+
const lo = INSET;
|
|
183
|
+
const hi = size - INSET;
|
|
184
|
+
const r = Math.min(radius, (hi - lo) / 2);
|
|
185
|
+
const arc = (x, y) => `A${r},${r},0,0,1,${x},${y}`;
|
|
186
|
+
return `M${lo + r},${lo}H${hi - r}${arc(hi, lo + r)}V${hi - r}${arc(hi - r, hi)}H${lo + r}${arc(lo, hi - r)}V${lo + r}${arc(lo + r, lo)}Z`;
|
|
187
|
+
}
|
|
188
|
+
function uiFrameOutline(kind) {
|
|
189
|
+
const { size, radius } = UI_FRAME_KINDS[kind];
|
|
190
|
+
const box = { x: 0, y: 0, width: size, height: size };
|
|
191
|
+
return {
|
|
192
|
+
viewBox: box,
|
|
193
|
+
plot: box,
|
|
194
|
+
strokes: [{ d: roundPathData(roundedSquare(size, radius)), role: "ornament", part: "ink" }],
|
|
195
|
+
labels: [],
|
|
196
|
+
hitAreas: [],
|
|
197
|
+
defs: []
|
|
198
|
+
};
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
// src/ui/names.ts
|
|
202
|
+
function uiRequireName(component, text2, label) {
|
|
203
|
+
if (process.env.NODE_ENV === "production") return;
|
|
204
|
+
if (text2?.trim() || label?.trim()) return;
|
|
205
|
+
diagnose("SP018", component, { property: "label" });
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
// src/ui/tokens.ts
|
|
209
|
+
var UI_TOKEN_DEFAULTS = /* @__PURE__ */ Object.freeze({
|
|
210
|
+
frame: "css",
|
|
211
|
+
frameVariants: 1,
|
|
212
|
+
controlHeight: Object.freeze({ sm: 24, md: 32, lg: 40 }),
|
|
213
|
+
radius: 2,
|
|
214
|
+
focusWidth: 2,
|
|
215
|
+
tone: Object.freeze({ selected: 3, primary: 2, danger: 4, disabled: 1, alertError: 1 })
|
|
216
|
+
});
|
|
217
|
+
var MIN_HEIGHT = 24;
|
|
218
|
+
var MIN_FOCUS = 2;
|
|
219
|
+
var within = (value, lo, hi, fallback) => Number.isFinite(value) ? Math.min(Math.max(value, lo), hi) : fallback;
|
|
220
|
+
function resolveUiTokens(ground) {
|
|
221
|
+
const ui = ground.ui ?? UI_TOKEN_DEFAULTS;
|
|
222
|
+
const inked = ui.frame === "inked" && ground.tonalMechanism === "hatch";
|
|
223
|
+
const { sm, md, lg } = ui.controlHeight;
|
|
224
|
+
return {
|
|
225
|
+
frame: inked ? "inked" : "css",
|
|
226
|
+
frameVariants: inked ? Math.round(within(ui.frameVariants, 1, 6, 1)) : 1,
|
|
227
|
+
controlHeight: {
|
|
228
|
+
sm: within(sm, MIN_HEIGHT, Infinity, 24),
|
|
229
|
+
md: within(md, MIN_HEIGHT, Infinity, 32),
|
|
230
|
+
lg: within(lg, MIN_HEIGHT, Infinity, 40)
|
|
231
|
+
},
|
|
232
|
+
radius: within(ui.radius, 0, Infinity, 2),
|
|
233
|
+
focusWidth: within(ui.focusWidth, MIN_FOCUS, Infinity, 2),
|
|
234
|
+
tone: ui.tone
|
|
235
|
+
};
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
// src/ui/tone.ts
|
|
239
|
+
var RAD = Math.PI / 180;
|
|
240
|
+
var EPSILON = 1e-6;
|
|
241
|
+
var TILE_SPAN = 24;
|
|
242
|
+
function family(gap, angle) {
|
|
243
|
+
const sin = Math.sin(angle * RAD);
|
|
244
|
+
const cos = Math.cos(angle * RAD);
|
|
245
|
+
const lines = Math.max(2, Math.round(TILE_SPAN / gap));
|
|
246
|
+
const width = Math.abs(sin) < EPSILON ? lines * gap : lines * gap / Math.abs(sin);
|
|
247
|
+
const height = Math.abs(cos) < EPSILON ? lines * gap : lines * gap / Math.abs(cos);
|
|
248
|
+
const offset = (x, y) => -sin * x + cos * y;
|
|
249
|
+
const corners = [offset(0, 0), offset(width, 0), offset(0, height), offset(width, height)];
|
|
250
|
+
const first = Math.ceil(Math.min(...corners) / gap - 0.5);
|
|
251
|
+
const last = Math.floor(Math.max(...corners) / gap - 0.5);
|
|
252
|
+
const strokes = [];
|
|
253
|
+
for (let k = first; k <= last; k++) {
|
|
254
|
+
const c = (k + 0.5) * gap;
|
|
255
|
+
const at = (t) => ({ x: -sin * c + cos * t, y: cos * c + sin * t, t });
|
|
256
|
+
const hits = [
|
|
257
|
+
Math.abs(cos) > EPSILON ? [(0 + sin * c) / cos, (width + sin * c) / cos] : [],
|
|
258
|
+
Math.abs(sin) > EPSILON ? [(0 - cos * c) / sin, (height - cos * c) / sin] : []
|
|
259
|
+
].flat().map(at).filter((p) => p.x >= -EPSILON && p.x <= width + EPSILON && p.y >= -EPSILON && p.y <= height + EPSILON).sort((a, b) => a.t - b.t);
|
|
260
|
+
const from = hits[0];
|
|
261
|
+
const to = hits.at(-1);
|
|
262
|
+
if (!from || !to || to.t - from.t < EPSILON * 1e3) continue;
|
|
263
|
+
const clamp = (v, hi) => round2(Math.min(Math.max(v, 0), hi));
|
|
264
|
+
const w = round2(width);
|
|
265
|
+
const h = round2(height);
|
|
266
|
+
strokes.push({
|
|
267
|
+
d: `M${clamp(from.x, w)},${clamp(from.y, h)}L${clamp(to.x, w)},${clamp(to.y, h)}`,
|
|
268
|
+
role: "ornament",
|
|
269
|
+
part: "ink"
|
|
270
|
+
});
|
|
271
|
+
}
|
|
272
|
+
return { width: round2(width), height: round2(height), strokes };
|
|
273
|
+
}
|
|
274
|
+
function uiToneTile(spec) {
|
|
275
|
+
if (spec.style === "weight") return [];
|
|
276
|
+
const layers = [family(spec.gap, spec.angle)];
|
|
277
|
+
if (spec.style === "cross-hatch") layers.push(family(spec.gap, spec.angle + 90));
|
|
278
|
+
return layers;
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
// src/ui/view-kit.ts
|
|
282
|
+
function clean(attrs) {
|
|
283
|
+
const out = {};
|
|
284
|
+
for (const [name, value] of Object.entries(attrs)) if (value !== void 0 && value !== false) out[name] = value;
|
|
285
|
+
return out;
|
|
286
|
+
}
|
|
287
|
+
var el = (tag, attrs, children = [], bind) => ({
|
|
288
|
+
tag,
|
|
289
|
+
attrs: clean(attrs),
|
|
290
|
+
children,
|
|
291
|
+
...bind ? { bind } : {}
|
|
292
|
+
});
|
|
293
|
+
var text = (value) => ({ text: value });
|
|
294
|
+
var slot = (name) => ({ slot: name });
|
|
295
|
+
function root(slug, props, r, attrs = {}) {
|
|
296
|
+
return {
|
|
297
|
+
class: ["sp-ui", `sp-${slug}`, `sp-ground-${r.ground}`, props.className].filter(Boolean).join(" "),
|
|
298
|
+
"data-ground": r.ground,
|
|
299
|
+
"data-substrate": r.substrate,
|
|
300
|
+
"data-mode": r.mode,
|
|
301
|
+
"data-size": r.size,
|
|
302
|
+
"data-frame": String(r.frame),
|
|
303
|
+
...attrs
|
|
304
|
+
};
|
|
305
|
+
}
|
|
306
|
+
var frame = (kind) => el("span", { part: "sp-frame", "data-kind": kind, "aria-hidden": "true" });
|
|
307
|
+
var tone = (value, kind) => el("span", { part: "sp-tone", "data-tone": value, "data-kind": kind, "aria-hidden": "true" });
|
|
308
|
+
var UI_GLYPHS = Object.freeze({
|
|
309
|
+
tick: "M3.5,8.5L6.5,11.5L12.5,4.5",
|
|
310
|
+
dash: "M4,8H12",
|
|
311
|
+
cross: "M4.5,4.5L11.5,11.5M11.5,4.5L4.5,11.5",
|
|
312
|
+
warning: "M8,2.5L14.5,13.5H1.5Z M8,6.5V9.5 M8,11.5V11.5",
|
|
313
|
+
/** A radio's selection: filled by ui.css. */
|
|
314
|
+
dot: "M11,8A3,3 0 1,1 5,8A3,3 0 1,1 11,8Z",
|
|
315
|
+
/** A Rate mark (C-2). */
|
|
316
|
+
lozenge: "M8,1.5L14.5,8L8,14.5L1.5,8Z",
|
|
317
|
+
info: "M14.5,8A6.5,6.5 0 1,1 1.5,8A6.5,6.5 0 1,1 14.5,8Z M8,7.5V11.5 M8,4.75V4.75"
|
|
318
|
+
});
|
|
319
|
+
var glyph = (name) => el("svg", { part: "sp-mark", "data-glyph": name, viewBox: "0 0 16 16", "aria-hidden": "true" }, [el("path", { d: UI_GLYPHS[name] })]);
|
|
320
|
+
var sr = (value) => el("span", { class: "sp-ui-sr" }, [text(value)]);
|
|
321
|
+
var baseOf = (props) => props.id ?? props.name;
|
|
322
|
+
function nativeInput(type, attrs) {
|
|
323
|
+
return el("input", { type, class: "sp-ui-native", ...attrs }, [], "native");
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
// src/ui/view.ts
|
|
327
|
+
var FRAME_SLOTS = 6;
|
|
328
|
+
function resolveUi(props, env) {
|
|
329
|
+
const { provider = {}, cell = {} } = env;
|
|
330
|
+
const ground = props.ground ?? cell.ground ?? provider.ground ?? DEFAULTS.ground;
|
|
331
|
+
return {
|
|
332
|
+
ground: typeof ground === "string" ? ground : ground.name,
|
|
333
|
+
substrate: props.substrate ?? cell.substrate ?? provider.substrate ?? DEFAULTS.substrate,
|
|
334
|
+
mode: env.forcedPrecision ? "precision" : props.mode ?? cell.mode ?? provider.mode ?? DEFAULTS.mode,
|
|
335
|
+
size: props.size ?? "md",
|
|
336
|
+
frame: uiFrameVariant(props.seed, props.id, FRAME_SLOTS)
|
|
337
|
+
};
|
|
338
|
+
}
|
|
339
|
+
function uiButtonView(props, r, content) {
|
|
340
|
+
uiRequireName("SpButton", content.text, props.label);
|
|
341
|
+
const variant = props.variant ?? "default";
|
|
342
|
+
const link = props.href !== void 0;
|
|
343
|
+
const toned = props.disabled ? "disabled" : variant === "default" ? void 0 : variant;
|
|
344
|
+
return el(
|
|
345
|
+
link ? "a" : "button",
|
|
346
|
+
root("button", props, r, {
|
|
347
|
+
id: props.id,
|
|
348
|
+
type: link ? void 0 : props.type ?? "button",
|
|
349
|
+
href: link && !props.disabled ? props.href : void 0,
|
|
350
|
+
disabled: !link && props.disabled === true,
|
|
351
|
+
"aria-disabled": link && props.disabled ? "true" : void 0,
|
|
352
|
+
"aria-label": props.label,
|
|
353
|
+
"data-variant": variant,
|
|
354
|
+
"data-block": props.block ? "true" : void 0
|
|
355
|
+
}),
|
|
356
|
+
[
|
|
357
|
+
frame("control"),
|
|
358
|
+
...toned ? [tone(toned, "control")] : [],
|
|
359
|
+
...variant === "danger" ? [glyph("cross")] : [],
|
|
360
|
+
el("span", { class: toned ? "sp-ui-label sp-ui-plate" : "sp-ui-label" }, [slot("content")])
|
|
361
|
+
]
|
|
362
|
+
);
|
|
363
|
+
}
|
|
364
|
+
function uiInputView(props, r, state) {
|
|
365
|
+
const base = baseOf(props);
|
|
366
|
+
const message = props.message ? props.message : void 0;
|
|
367
|
+
const messageId = message && base ? `${base}--message` : void 0;
|
|
368
|
+
return el("span", root("input", props, r, { "data-invalid": props.invalid ? "true" : void 0 }), [
|
|
369
|
+
el("span", { class: "sp-ui-box" }, [
|
|
370
|
+
frame("control"),
|
|
371
|
+
...state.prefix ? [el("span", { class: "sp-ui-affix", "data-slot": "prefix" }, [slot("prefix")])] : [],
|
|
372
|
+
el(
|
|
373
|
+
"input",
|
|
374
|
+
{
|
|
375
|
+
class: "sp-ui-control",
|
|
376
|
+
id: props.id,
|
|
377
|
+
type: props.type ?? "text",
|
|
378
|
+
name: props.name,
|
|
379
|
+
value: state.value,
|
|
380
|
+
placeholder: props.placeholder,
|
|
381
|
+
disabled: props.disabled === true,
|
|
382
|
+
readonly: props.readOnly === true,
|
|
383
|
+
"aria-label": props.label,
|
|
384
|
+
"aria-invalid": props.invalid ? "true" : void 0,
|
|
385
|
+
"aria-describedby": messageId
|
|
386
|
+
},
|
|
387
|
+
[],
|
|
388
|
+
"native"
|
|
389
|
+
),
|
|
390
|
+
...state.suffix ? [el("span", { class: "sp-ui-affix", "data-slot": "suffix" }, [slot("suffix")])] : [],
|
|
391
|
+
...props.invalid ? [glyph("warning")] : []
|
|
392
|
+
]),
|
|
393
|
+
...message ? [el("span", { class: "sp-ui-message", id: messageId }, [text(message)])] : []
|
|
394
|
+
]);
|
|
395
|
+
}
|
|
396
|
+
function nativeCheckbox(props, checked, role) {
|
|
397
|
+
return el(
|
|
398
|
+
"input",
|
|
399
|
+
{ type: "checkbox", class: "sp-ui-native", role, id: props.id, name: props.name, checked, disabled: props.disabled === true },
|
|
400
|
+
[],
|
|
401
|
+
"native"
|
|
402
|
+
);
|
|
403
|
+
}
|
|
404
|
+
function uiCheckboxView(props, r, state) {
|
|
405
|
+
return el("label", root("checkbox", props, r, { "data-indeterminate": props.indeterminate ? "true" : void 0 }), [
|
|
406
|
+
nativeCheckbox(props, state.checked),
|
|
407
|
+
el("span", { class: "sp-ui-box", "aria-hidden": "true" }, [frame("box"), tone("selected", "box"), glyph("tick"), glyph("dash")]),
|
|
408
|
+
el("span", { class: "sp-ui-label" }, [text(props.label)])
|
|
409
|
+
]);
|
|
410
|
+
}
|
|
411
|
+
function uiSwitchView(props, r, state) {
|
|
412
|
+
return el("label", root("switch", props, r), [
|
|
413
|
+
nativeCheckbox(props, state.checked, "switch"),
|
|
414
|
+
el("span", { class: "sp-ui-track", "aria-hidden": "true" }, [frame("pill"), tone("selected", "pill"), el("span", { part: "sp-knob" })]),
|
|
415
|
+
el("span", { class: "sp-ui-label" }, [text(props.label)])
|
|
416
|
+
]);
|
|
417
|
+
}
|
|
418
|
+
function uiCardView(props, r, slots) {
|
|
419
|
+
const titled = props.title !== void 0;
|
|
420
|
+
const titleId = titled && props.id ? `${props.id}--title` : void 0;
|
|
421
|
+
const header = titled || slots.extra;
|
|
422
|
+
return el(
|
|
423
|
+
titled ? "article" : "section",
|
|
424
|
+
root("card", props, r, { id: props.id, "aria-labelledby": titleId, "aria-label": titled && !titleId ? props.title : void 0 }),
|
|
425
|
+
[
|
|
426
|
+
frame("card"),
|
|
427
|
+
...header ? [
|
|
428
|
+
el("div", { class: "sp-ui-card-header" }, [
|
|
429
|
+
...titled ? [el(`h${props.headingLevel ?? 3}`, { class: "sp-ui-card-title", id: titleId }, [text(props.title)])] : [],
|
|
430
|
+
...slots.extra ? [el("div", { class: "sp-ui-card-extra" }, [slot("extra")])] : []
|
|
431
|
+
]),
|
|
432
|
+
el("span", { part: "sp-rule", "aria-hidden": "true" })
|
|
433
|
+
] : [],
|
|
434
|
+
el("div", { class: "sp-ui-card-body" }, [slot("content")]),
|
|
435
|
+
...slots.footer ? [el("div", { class: "sp-ui-card-footer" }, [slot("footer")])] : []
|
|
436
|
+
]
|
|
437
|
+
);
|
|
438
|
+
}
|
|
439
|
+
function uiDividerView(props, r) {
|
|
440
|
+
const vertical = props.orientation === "vertical";
|
|
441
|
+
const rule = () => el("span", { part: "sp-rule", "aria-hidden": "true" });
|
|
442
|
+
return el(
|
|
443
|
+
"div",
|
|
444
|
+
root("divider", props, r, {
|
|
445
|
+
id: props.id,
|
|
446
|
+
role: "separator",
|
|
447
|
+
"aria-orientation": vertical ? "vertical" : void 0,
|
|
448
|
+
"data-orientation": vertical ? "vertical" : "horizontal",
|
|
449
|
+
"data-align": props.text ? props.align ?? "center" : void 0
|
|
450
|
+
}),
|
|
451
|
+
props.text ? [rule(), el("span", { class: "sp-ui-divider-text" }, [text(props.text)]), rule()] : [rule()]
|
|
452
|
+
);
|
|
453
|
+
}
|
|
454
|
+
|
|
455
|
+
// src/ui/view-b2.ts
|
|
456
|
+
var heighten = () => el("span", { part: "sp-heighten", "aria-hidden": "true" });
|
|
457
|
+
var legend = (label, forSight) => el("legend", { class: forSight ? "sp-ui-legend" : "sp-ui-legend sp-ui-sr" }, [text(label)]);
|
|
458
|
+
var groupName = (props) => props.name ?? (props.id ? `${props.id}--value` : void 0);
|
|
459
|
+
function uiRadioGroupView(props, r, state) {
|
|
460
|
+
const items = uiItems(props.items, "SpRadioGroup");
|
|
461
|
+
const value = uiSelectedKey(items, state.value, "none");
|
|
462
|
+
return el("fieldset", root("radio-group", props, r, { id: props.id, "data-orientation": props.orientation ?? "vertical" }), [
|
|
463
|
+
legend(props.label, true),
|
|
464
|
+
...items.map(
|
|
465
|
+
(item) => el("label", { class: "sp-ui-item", "data-key": item.key, "data-disabled": item.disabled ? "true" : void 0 }, [
|
|
466
|
+
nativeInput("radio", {
|
|
467
|
+
id: props.id ? `${props.id}--${item.key}` : void 0,
|
|
468
|
+
name: props.name,
|
|
469
|
+
value: item.key,
|
|
470
|
+
checked: item.key === value,
|
|
471
|
+
disabled: item.disabled === true
|
|
472
|
+
}),
|
|
473
|
+
el("span", { class: "sp-ui-box", "aria-hidden": "true" }, [frame("round"), tone("selected", "round"), glyph("dot")]),
|
|
474
|
+
el("span", { class: "sp-ui-label" }, [text(item.label)])
|
|
475
|
+
])
|
|
476
|
+
)
|
|
477
|
+
]);
|
|
478
|
+
}
|
|
479
|
+
function uiSegmentedView(props, r, state) {
|
|
480
|
+
const items = uiItems(props.items, "SpSegmented");
|
|
481
|
+
const value = uiSelectedKey(items, state.value, "first");
|
|
482
|
+
const name = groupName(props);
|
|
483
|
+
return el("fieldset", root("segmented", props, r, { id: props.id, "data-block": props.block ? "true" : void 0 }), [
|
|
484
|
+
legend(props.label, false),
|
|
485
|
+
el("span", { class: "sp-ui-segments" }, [
|
|
486
|
+
frame("control"),
|
|
487
|
+
...items.map((item) => {
|
|
488
|
+
const selected = item.key === value;
|
|
489
|
+
return el("label", { class: "sp-ui-item", "data-key": item.key, "data-disabled": item.disabled ? "true" : void 0 }, [
|
|
490
|
+
nativeInput("radio", { name, value: item.key, checked: selected, disabled: item.disabled === true }),
|
|
491
|
+
el("span", { class: "sp-ui-segment" }, [
|
|
492
|
+
...selected ? [tone("selected", "control"), heighten()] : [],
|
|
493
|
+
el("span", { class: selected ? "sp-ui-label sp-ui-plate" : "sp-ui-label" }, [text(item.label)])
|
|
494
|
+
])
|
|
495
|
+
]);
|
|
496
|
+
})
|
|
497
|
+
])
|
|
498
|
+
]);
|
|
499
|
+
}
|
|
500
|
+
function uiTabsView(props, r, state) {
|
|
501
|
+
const items = uiItems(props.items, "SpTabs");
|
|
502
|
+
const value = uiSelectedKey(items, state.value, "first");
|
|
503
|
+
const vertical = props.orientation === "vertical";
|
|
504
|
+
const id = props.id;
|
|
505
|
+
return el("div", root("tabs", props, r, { id, "data-orientation": vertical ? "vertical" : "horizontal" }), [
|
|
506
|
+
el("div", { class: "sp-ui-tablist", role: "tablist", "aria-label": props.label, "aria-orientation": vertical ? "vertical" : void 0 }, [
|
|
507
|
+
...items.map((item) => {
|
|
508
|
+
const selected = item.key === value;
|
|
509
|
+
return el(
|
|
510
|
+
"button",
|
|
511
|
+
{
|
|
512
|
+
type: "button",
|
|
513
|
+
class: "sp-ui-tab",
|
|
514
|
+
role: "tab",
|
|
515
|
+
id: id ? `${id}--tab-${item.key}` : void 0,
|
|
516
|
+
"aria-selected": selected ? "true" : "false",
|
|
517
|
+
"aria-controls": id ? `${id}--panel-${item.key}` : void 0,
|
|
518
|
+
tabindex: selected ? "0" : "-1",
|
|
519
|
+
disabled: item.disabled === true,
|
|
520
|
+
"data-key": item.key
|
|
521
|
+
},
|
|
522
|
+
[...selected ? [heighten()] : [], el("span", { class: "sp-ui-label" }, [text(item.label)])],
|
|
523
|
+
"native"
|
|
524
|
+
);
|
|
525
|
+
}),
|
|
526
|
+
el("span", { part: "sp-rule", "aria-hidden": "true" })
|
|
527
|
+
]),
|
|
528
|
+
el("div", { class: "sp-ui-tabpanels" }, [slot("content")])
|
|
529
|
+
]);
|
|
530
|
+
}
|
|
531
|
+
function uiTabPanelView(props, tabs) {
|
|
532
|
+
const { id } = tabs;
|
|
533
|
+
return el(
|
|
534
|
+
"div",
|
|
535
|
+
{
|
|
536
|
+
class: "sp-ui-tabpanel",
|
|
537
|
+
role: "tabpanel",
|
|
538
|
+
id: id ? `${id}--panel-${props.value}` : void 0,
|
|
539
|
+
"aria-labelledby": id ? `${id}--tab-${props.value}` : void 0,
|
|
540
|
+
tabindex: "0",
|
|
541
|
+
hidden: props.value !== tabs.value
|
|
542
|
+
},
|
|
543
|
+
[slot("content")]
|
|
544
|
+
);
|
|
545
|
+
}
|
|
546
|
+
function uiSliderView(props, r, state) {
|
|
547
|
+
const valid = uiRange({ min: props.min ?? 0, max: props.max ?? 100, step: props.step ?? 1 }, "SpSlider");
|
|
548
|
+
const { value, fraction } = uiValue(state.value, valid, "SpSlider");
|
|
549
|
+
const span = valid.max - valid.min;
|
|
550
|
+
const marks = (props.marks ?? []).filter((m) => Number.isFinite(m) && m >= valid.min && m <= valid.max);
|
|
551
|
+
return el("label", root("slider", props, r, { style: `--sp-ui-fraction: ${fraction}`, "data-disabled": props.disabled ? "true" : void 0 }), [
|
|
552
|
+
el("span", { class: "sp-ui-label" }, [text(props.label)]),
|
|
553
|
+
el("span", { class: "sp-ui-rail" }, [
|
|
554
|
+
el("span", { part: "sp-track", "aria-hidden": "true" }),
|
|
555
|
+
el("span", { part: "sp-fill", "aria-hidden": "true" }, [tone("selected", "pill")]),
|
|
556
|
+
el("span", { part: "sp-thumb sp-heighten", "aria-hidden": "true" }),
|
|
557
|
+
el(
|
|
558
|
+
"input",
|
|
559
|
+
{
|
|
560
|
+
type: "range",
|
|
561
|
+
class: "sp-ui-range",
|
|
562
|
+
id: props.id,
|
|
563
|
+
name: props.name,
|
|
564
|
+
min: String(valid.min),
|
|
565
|
+
max: String(valid.max),
|
|
566
|
+
step: String(valid.step ?? 1),
|
|
567
|
+
value: String(value),
|
|
568
|
+
disabled: props.disabled === true
|
|
569
|
+
},
|
|
570
|
+
[],
|
|
571
|
+
"native"
|
|
572
|
+
)
|
|
573
|
+
]),
|
|
574
|
+
...marks.length ? [
|
|
575
|
+
el(
|
|
576
|
+
"span",
|
|
577
|
+
{ class: "sp-ui-scale", "aria-hidden": "true" },
|
|
578
|
+
marks.map((m) => el("span", { class: "sp-ui-scale-mark", style: `--sp-ui-at: ${round2((m - valid.min) / span)}` }, [text(String(m))]))
|
|
579
|
+
)
|
|
580
|
+
] : []
|
|
581
|
+
]);
|
|
582
|
+
}
|
|
583
|
+
function uiRateView(props, r, state) {
|
|
584
|
+
const count = uiRateCount(props.count);
|
|
585
|
+
const { value } = uiValue(state.value, { min: 0, max: count, step: 1 }, "SpRate");
|
|
586
|
+
const name = groupName(props);
|
|
587
|
+
const readOnly = props.readOnly === true;
|
|
588
|
+
return el(
|
|
589
|
+
"fieldset",
|
|
590
|
+
root("rate", props, r, {
|
|
591
|
+
id: props.id,
|
|
592
|
+
role: readOnly ? "radiogroup" : void 0,
|
|
593
|
+
"aria-readonly": readOnly ? "true" : void 0,
|
|
594
|
+
"data-readonly": readOnly ? "true" : void 0
|
|
595
|
+
}),
|
|
596
|
+
[
|
|
597
|
+
legend(props.label, false),
|
|
598
|
+
...Array.from({ length: count }, (_, i) => {
|
|
599
|
+
const n = i + 1;
|
|
600
|
+
const filled = n <= value;
|
|
601
|
+
return el("label", { class: "sp-ui-item", "data-filled": filled ? "true" : void 0 }, [
|
|
602
|
+
nativeInput("radio", { name, value: String(n), checked: n === value, disabled: props.disabled === true, "aria-label": String(n) }),
|
|
603
|
+
el("span", { class: "sp-ui-box", "aria-hidden": "true" }, [...filled ? [tone("selected", "round")] : [], glyph("lozenge")])
|
|
604
|
+
]);
|
|
605
|
+
})
|
|
606
|
+
]
|
|
607
|
+
);
|
|
608
|
+
}
|
|
609
|
+
|
|
610
|
+
// src/ui/view-b3.ts
|
|
611
|
+
var closeButton = (label) => el("button", { type: "button", class: "sp-ui-close", "aria-label": label }, [glyph("cross")], "close");
|
|
612
|
+
function uiStepsView(props, r) {
|
|
613
|
+
const steps = uiSteps(props.items, props.current);
|
|
614
|
+
const titles = new Map(props.items.map((item) => [item.key, item]));
|
|
615
|
+
return el(
|
|
616
|
+
"ol",
|
|
617
|
+
root("steps", props, r, { id: props.id, "aria-label": props.label, "data-orientation": props.orientation === "vertical" ? "vertical" : "horizontal" }),
|
|
618
|
+
steps.map((step, i) => {
|
|
619
|
+
const item = titles.get(step.key);
|
|
620
|
+
const mark = step.status === "finish" ? glyph("tick") : step.status === "error" ? glyph("cross") : text(String(i + 1));
|
|
621
|
+
return el("li", { class: "sp-ui-step", "data-status": step.status, "aria-current": step.current ? "step" : void 0 }, [
|
|
622
|
+
el("span", { class: "sp-ui-step-mark", part: step.current ? "sp-heighten" : void 0, "aria-hidden": "true" }, [mark]),
|
|
623
|
+
el("span", { class: "sp-ui-step-text" }, [
|
|
624
|
+
el("span", { class: "sp-ui-step-title" }, [text(item.title)]),
|
|
625
|
+
...item.description ? [el("span", { class: "sp-ui-step-description" }, [text(item.description)])] : []
|
|
626
|
+
]),
|
|
627
|
+
// Exact, dashed while it leads to a step still waiting (C-4, DD-026).
|
|
628
|
+
...step.connector ? [el("span", { part: "sp-connector", "data-status": step.connector, "aria-hidden": "true" })] : []
|
|
629
|
+
]);
|
|
630
|
+
})
|
|
631
|
+
);
|
|
632
|
+
}
|
|
633
|
+
function uiTagView(props, r, content) {
|
|
634
|
+
const level = String(props.tone ?? 1);
|
|
635
|
+
const label = props.closeLabel ?? (content.text ? `Remove ${content.text}` : "Remove");
|
|
636
|
+
return el("span", root("tag", props, r, { id: props.id, "data-tone": level }), [
|
|
637
|
+
frame("control"),
|
|
638
|
+
tone(level, "control"),
|
|
639
|
+
el("span", { class: "sp-ui-label sp-ui-plate" }, [slot("content")]),
|
|
640
|
+
...props.closable ? [closeButton(label)] : []
|
|
641
|
+
]);
|
|
642
|
+
}
|
|
643
|
+
function uiBadgeView(props, r, content) {
|
|
644
|
+
const max = props.max ?? 99;
|
|
645
|
+
const count = props.count !== void 0 && Number.isFinite(props.count) ? Math.max(Math.round(props.count), 0) : void 0;
|
|
646
|
+
const shown = count === void 0 ? void 0 : count > max ? `${max}+` : String(count);
|
|
647
|
+
const dot = props.dot === true;
|
|
648
|
+
uiRequireName("SpBadge", content.text ?? (dot ? void 0 : shown), props.label);
|
|
649
|
+
return el("span", root("badge", props, r, { id: props.id }), [
|
|
650
|
+
el("span", { class: "sp-ui-label" }, [slot("content")]),
|
|
651
|
+
...dot ? [el("span", { class: "sp-ui-badge-dot", "aria-hidden": "true" })] : shown !== void 0 ? [el("span", { class: "sp-ui-badge-count" }, [frame("pill"), el("span", { class: "sp-ui-badge-text" }, [text(shown)])])] : [],
|
|
652
|
+
...props.label ? [sr(props.label)] : []
|
|
653
|
+
]);
|
|
654
|
+
}
|
|
655
|
+
var RING = 8;
|
|
656
|
+
function uiProgressView(props, r) {
|
|
657
|
+
const determinate = props.value !== void 0;
|
|
658
|
+
const { value, fraction } = determinate ? uiValue(props.value, { min: 0, max: 100 }, "SpProgress") : { value: 0, fraction: 0 };
|
|
659
|
+
const circle = props.shape === "circle";
|
|
660
|
+
const drawing = circle ? (() => {
|
|
661
|
+
const arc = uiProgressArc(determinate ? fraction : 0.25, RING);
|
|
662
|
+
return el("svg", { class: "sp-ui-ring", viewBox: `0 0 ${UI_PROGRESS_VIEWBOX} ${UI_PROGRESS_VIEWBOX}`, "aria-hidden": "true" }, [
|
|
663
|
+
el("path", { class: "sp-ui-ring-track", d: arc.track.d }),
|
|
664
|
+
el("path", { class: "sp-ui-ring-fill", d: arc.fill.d })
|
|
665
|
+
]);
|
|
666
|
+
})() : el("span", { class: "sp-ui-rail" }, [
|
|
667
|
+
el("span", { part: "sp-track", "aria-hidden": "true" }),
|
|
668
|
+
el("span", { part: "sp-fill", "aria-hidden": "true" }, [tone(determinate ? "selected" : "1", "pill")])
|
|
669
|
+
]);
|
|
670
|
+
return el(
|
|
671
|
+
"div",
|
|
672
|
+
root("progress", props, r, {
|
|
673
|
+
id: props.id,
|
|
674
|
+
role: "progressbar",
|
|
675
|
+
"aria-label": props.label,
|
|
676
|
+
"aria-valuemin": "0",
|
|
677
|
+
"aria-valuemax": "100",
|
|
678
|
+
"aria-valuenow": determinate ? String(value) : void 0,
|
|
679
|
+
"data-shape": circle ? "circle" : "line",
|
|
680
|
+
"data-indeterminate": determinate ? void 0 : "true",
|
|
681
|
+
style: determinate ? `--sp-ui-fraction: ${fraction}` : void 0
|
|
682
|
+
}),
|
|
683
|
+
[drawing, ...determinate && props.showValue !== false ? [el("span", { class: "sp-ui-value", "aria-hidden": "true" }, [text(`${value}%`)])] : []]
|
|
684
|
+
);
|
|
685
|
+
}
|
|
686
|
+
var ALERT_GLYPHS = { info: "info", success: "tick", warning: "warning", error: "cross" };
|
|
687
|
+
function uiAlertView(props, r, state) {
|
|
688
|
+
const kind = props.kind ?? "info";
|
|
689
|
+
const error = kind === "error";
|
|
690
|
+
return el("div", root("alert", props, r, { id: props.id, role: error || kind === "warning" ? "alert" : "status", "data-kind": kind }), [
|
|
691
|
+
frame("card"),
|
|
692
|
+
...error ? [tone("alertError", "card")] : [],
|
|
693
|
+
glyph(ALERT_GLYPHS[kind]),
|
|
694
|
+
el("div", { class: error ? "sp-ui-alert-body sp-ui-plate" : "sp-ui-alert-body" }, [
|
|
695
|
+
...props.title ? [el("div", { class: "sp-ui-alert-title" }, [text(props.title)])] : [],
|
|
696
|
+
el("div", { class: "sp-ui-alert-text" }, [slot("content")])
|
|
697
|
+
]),
|
|
698
|
+
...state.closable ? [closeButton(props.closeLabel ?? "Close")] : []
|
|
699
|
+
]);
|
|
700
|
+
}
|
|
701
|
+
function uiSkeletonView(props, r) {
|
|
702
|
+
const lines = props.lines !== void 0 && Number.isFinite(props.lines) ? Math.min(Math.max(Math.round(props.lines), 1), 8) : 3;
|
|
703
|
+
return el("div", root("skeleton", props, r, { id: props.id, "aria-busy": "true" }), [
|
|
704
|
+
sr(props.label ?? "Loading"),
|
|
705
|
+
...props.avatar ? [el("span", { class: "sp-ui-skeleton-avatar", "aria-hidden": "true" }, [tone("1", "round")])] : [],
|
|
706
|
+
el(
|
|
707
|
+
"span",
|
|
708
|
+
{ class: "sp-ui-skeleton-lines", "aria-hidden": "true" },
|
|
709
|
+
Array.from({ length: lines }, () => el("span", { class: "sp-ui-skeleton-line" }, [tone("1", "control")]))
|
|
710
|
+
)
|
|
711
|
+
]);
|
|
712
|
+
}
|
|
713
|
+
|
|
714
|
+
export { UI_COMPONENTS, UI_FRAME_KINDS, UI_GLYPHS, UI_PROGRESS_VIEWBOX, UI_TOKEN_DEFAULTS, resolveUi, resolveUiTokens, uiAlertView, uiBadgeView, uiButtonView, uiCardView, uiCheckboxView, uiDividerView, uiFrameOutline, uiFrameVariant, uiInputView, uiIsRovingKey, uiItems, uiProgressArc, uiProgressView, uiRadioGroupView, uiRange, uiRateCount, uiRateView, uiRequireName, uiRovingFocus, uiRovingKey, uiSegmentedView, uiSelectedKey, uiSkeletonView, uiSliderView, uiSteps, uiStepsView, uiSwitchView, uiTabPanelView, uiTabsView, uiTagView, uiToneTile, uiValue };
|
|
715
|
+
//# sourceMappingURL=ui.js.map
|
|
716
|
+
//# sourceMappingURL=ui.js.map
|