streetui 2.6.0 → 2.7.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/dist/bin.cjs +1 -1
- package/dist/bin.cjs.map +1 -1
- package/dist/bin.js +1 -1
- package/dist/bin.js.map +1 -1
- package/dist/create-bin.cjs +1 -1
- package/dist/create-bin.cjs.map +1 -1
- package/dist/create-bin.js +1 -1
- package/dist/create-bin.js.map +1 -1
- package/dist/{hydration-diagnostics-D1GlzulR.d.cts → hydration-diagnostics-Bh0-5vdC.d.cts} +1 -1
- package/dist/{hydration-diagnostics-D1GlzulR.d.ts → hydration-diagnostics-Bh0-5vdC.d.ts} +1 -1
- package/dist/index.cjs +1391 -207
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1022 -6
- package/dist/index.d.ts +1022 -6
- package/dist/index.js +1325 -207
- package/dist/index.js.map +1 -1
- package/dist/{renderer-interface-CmVlxE95.d.ts → renderer-interface-BOpzkWWQ.d.ts} +1 -1
- package/dist/{renderer-interface-BzLwBsyj.d.cts → renderer-interface-D0021Or5.d.cts} +1 -1
- package/dist/{server-BP651UK6.d.ts → server-CzcNNC9F.d.ts} +1 -1
- package/dist/{server-LJGg4GyH.d.cts → server-cE_Qhu4k.d.cts} +1 -1
- package/dist/server.cjs +8 -1
- package/dist/server.cjs.map +1 -1
- package/dist/server.d.cts +2 -2
- package/dist/server.d.ts +2 -2
- package/dist/server.js +8 -1
- package/dist/server.js.map +1 -1
- package/dist/testing.cjs +190 -183
- package/dist/testing.cjs.map +1 -1
- package/dist/testing.d.cts +3 -3
- package/dist/testing.d.ts +3 -3
- package/dist/testing.js +190 -183
- package/dist/testing.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// src/version.ts
|
|
2
|
-
var VERSION = "2.
|
|
2
|
+
var VERSION = "2.7.0";
|
|
3
3
|
|
|
4
4
|
// ../state/src/signal.ts
|
|
5
5
|
var _activeConsumer = null;
|
|
@@ -402,13 +402,13 @@ var HttpError = class extends Error {
|
|
|
402
402
|
statusText;
|
|
403
403
|
url;
|
|
404
404
|
body;
|
|
405
|
-
constructor(status, statusText, url,
|
|
405
|
+
constructor(status, statusText, url, body2) {
|
|
406
406
|
super(`HTTP ${status} ${statusText} for ${url}`);
|
|
407
407
|
this.name = "HttpError";
|
|
408
408
|
this.status = status;
|
|
409
409
|
this.statusText = statusText;
|
|
410
410
|
this.url = url;
|
|
411
|
-
this.body =
|
|
411
|
+
this.body = body2;
|
|
412
412
|
}
|
|
413
413
|
};
|
|
414
414
|
function joinUrl(baseUrl, path) {
|
|
@@ -426,20 +426,20 @@ function withQuery(url, query) {
|
|
|
426
426
|
return url.includes("?") ? `${url}&${qs}` : `${url}?${qs}`;
|
|
427
427
|
}
|
|
428
428
|
function createClient(config = {}) {
|
|
429
|
-
const doFetch = config.fetch ?? ((
|
|
429
|
+
const doFetch = config.fetch ?? ((input2, init) => {
|
|
430
430
|
if (typeof fetch === "undefined") {
|
|
431
431
|
throw new Error("createClient: no global fetch; pass { fetch } explicitly");
|
|
432
432
|
}
|
|
433
|
-
return fetch(
|
|
433
|
+
return fetch(input2, init);
|
|
434
434
|
});
|
|
435
|
-
async function request(method, path,
|
|
435
|
+
async function request(method, path, body2, reqConfig = {}) {
|
|
436
436
|
const url = withQuery(joinUrl(config.baseUrl, path), reqConfig.query);
|
|
437
437
|
const headers = { ...config.headers, ...reqConfig.headers };
|
|
438
438
|
const init = { method, headers };
|
|
439
439
|
if (reqConfig.signal !== void 0) init.signal = reqConfig.signal;
|
|
440
|
-
if (
|
|
440
|
+
if (body2 !== void 0) {
|
|
441
441
|
if (headers["Content-Type"] === void 0) headers["Content-Type"] = "application/json";
|
|
442
|
-
init.body = JSON.stringify(
|
|
442
|
+
init.body = JSON.stringify(body2);
|
|
443
443
|
}
|
|
444
444
|
const response = await doFetch(url, init);
|
|
445
445
|
const parsed = await parseBody(response);
|
|
@@ -466,17 +466,17 @@ function createClient(config = {}) {
|
|
|
466
466
|
};
|
|
467
467
|
}
|
|
468
468
|
async function parseBody(response) {
|
|
469
|
-
const
|
|
470
|
-
if (
|
|
469
|
+
const text2 = await response.text();
|
|
470
|
+
if (text2 === "") return void 0;
|
|
471
471
|
const type = response.headers.get("content-type") ?? "";
|
|
472
472
|
if (type.includes("application/json")) {
|
|
473
473
|
try {
|
|
474
|
-
return JSON.parse(
|
|
474
|
+
return JSON.parse(text2);
|
|
475
475
|
} catch {
|
|
476
|
-
return
|
|
476
|
+
return text2;
|
|
477
477
|
}
|
|
478
478
|
}
|
|
479
|
-
return
|
|
479
|
+
return text2;
|
|
480
480
|
}
|
|
481
481
|
|
|
482
482
|
// ../state/src/auth.ts
|
|
@@ -707,14 +707,14 @@ var DiagnosticCollector = class {
|
|
|
707
707
|
get hasWarnings() {
|
|
708
708
|
return this._diagnostics.some((d) => d.severity === "warning");
|
|
709
709
|
}
|
|
710
|
-
error(
|
|
711
|
-
this._diagnostics.push({ severity: "error", code, message, location: location ?? void 0, cause: cause ?? void 0 });
|
|
710
|
+
error(code2, message, location, cause) {
|
|
711
|
+
this._diagnostics.push({ severity: "error", code: code2, message, location: location ?? void 0, cause: cause ?? void 0 });
|
|
712
712
|
}
|
|
713
|
-
warn(
|
|
714
|
-
this._diagnostics.push({ severity: "warning", code, message, location: location ?? void 0, cause: void 0 });
|
|
713
|
+
warn(code2, message, location) {
|
|
714
|
+
this._diagnostics.push({ severity: "warning", code: code2, message, location: location ?? void 0, cause: void 0 });
|
|
715
715
|
}
|
|
716
|
-
info(
|
|
717
|
-
this._diagnostics.push({ severity: "info", code, message, location: location ?? void 0, cause: void 0 });
|
|
716
|
+
info(code2, message, location) {
|
|
717
|
+
this._diagnostics.push({ severity: "info", code: code2, message, location: location ?? void 0, cause: void 0 });
|
|
718
718
|
}
|
|
719
719
|
merge(other) {
|
|
720
720
|
for (const d of other.diagnostics) {
|
|
@@ -855,11 +855,11 @@ function safeStringify(value) {
|
|
|
855
855
|
if (typeof value === "string") return value;
|
|
856
856
|
if (value === null) return "null";
|
|
857
857
|
if (value === void 0) return "undefined";
|
|
858
|
-
const
|
|
859
|
-
if (
|
|
858
|
+
const t6 = typeof value;
|
|
859
|
+
if (t6 === "number" || t6 === "boolean" || t6 === "bigint" || t6 === "symbol") {
|
|
860
860
|
return String(value);
|
|
861
861
|
}
|
|
862
|
-
const ctor =
|
|
862
|
+
const ctor = t6 === "object" && value !== null ? value.constructor?.name ?? "Object" : t6;
|
|
863
863
|
return `[non-Error ${ctor}]`;
|
|
864
864
|
}
|
|
865
865
|
function describeError(error, context, options = {}) {
|
|
@@ -871,6 +871,884 @@ function reportError(sink, error, context, options = {}) {
|
|
|
871
871
|
return report;
|
|
872
872
|
}
|
|
873
873
|
|
|
874
|
+
// ../core/src/styling/canonical.ts
|
|
875
|
+
var LENGTH_PROPS = /* @__PURE__ */ new Set([
|
|
876
|
+
"inset",
|
|
877
|
+
"top",
|
|
878
|
+
"right",
|
|
879
|
+
"bottom",
|
|
880
|
+
"left",
|
|
881
|
+
"width",
|
|
882
|
+
"minWidth",
|
|
883
|
+
"maxWidth",
|
|
884
|
+
"height",
|
|
885
|
+
"minHeight",
|
|
886
|
+
"maxHeight",
|
|
887
|
+
"margin",
|
|
888
|
+
"marginTop",
|
|
889
|
+
"marginRight",
|
|
890
|
+
"marginBottom",
|
|
891
|
+
"marginLeft",
|
|
892
|
+
"padding",
|
|
893
|
+
"paddingTop",
|
|
894
|
+
"paddingRight",
|
|
895
|
+
"paddingBottom",
|
|
896
|
+
"paddingLeft",
|
|
897
|
+
"gap",
|
|
898
|
+
"rowGap",
|
|
899
|
+
"columnGap",
|
|
900
|
+
"flexBasis",
|
|
901
|
+
"borderWidth",
|
|
902
|
+
"borderRadius",
|
|
903
|
+
"fontSize",
|
|
904
|
+
"letterSpacing"
|
|
905
|
+
]);
|
|
906
|
+
function cssPropName(camel) {
|
|
907
|
+
if (camel.startsWith("--")) return camel;
|
|
908
|
+
return camel.replace(/[A-Z]/g, (m) => `-${m.toLowerCase()}`);
|
|
909
|
+
}
|
|
910
|
+
function cssValue(prop, value) {
|
|
911
|
+
if (typeof value === "number") {
|
|
912
|
+
if (value === 0) return "0";
|
|
913
|
+
return LENGTH_PROPS.has(prop) ? `${value}px` : String(value);
|
|
914
|
+
}
|
|
915
|
+
return value;
|
|
916
|
+
}
|
|
917
|
+
function sortDeep(value) {
|
|
918
|
+
if (Array.isArray(value)) return value.map(sortDeep);
|
|
919
|
+
if (value !== null && typeof value === "object") {
|
|
920
|
+
const out = {};
|
|
921
|
+
for (const key of Object.keys(value).sort()) {
|
|
922
|
+
const v = value[key];
|
|
923
|
+
if (v === void 0) continue;
|
|
924
|
+
out[key] = sortDeep(v);
|
|
925
|
+
}
|
|
926
|
+
return out;
|
|
927
|
+
}
|
|
928
|
+
return value;
|
|
929
|
+
}
|
|
930
|
+
function canonicalize(def) {
|
|
931
|
+
return JSON.stringify(sortDeep(def));
|
|
932
|
+
}
|
|
933
|
+
function hashIdentity(canonical) {
|
|
934
|
+
let h1 = 2166136261;
|
|
935
|
+
let h2 = 16777619 ^ canonical.length;
|
|
936
|
+
for (let i = 0; i < canonical.length; i++) {
|
|
937
|
+
const c = canonical.charCodeAt(i);
|
|
938
|
+
h1 ^= c;
|
|
939
|
+
h1 = Math.imul(h1, 16777619);
|
|
940
|
+
h2 = Math.imul(h2 ^ c, 2246822507);
|
|
941
|
+
}
|
|
942
|
+
const a = (h1 >>> 0).toString(36);
|
|
943
|
+
const b = (h2 >>> 0).toString(36);
|
|
944
|
+
return `s-${a}${b}`;
|
|
945
|
+
}
|
|
946
|
+
function identityOf(def) {
|
|
947
|
+
const canonical = canonicalize(def);
|
|
948
|
+
return { canonical, id: hashIdentity(canonical) };
|
|
949
|
+
}
|
|
950
|
+
|
|
951
|
+
// ../core/src/styling/registry.ts
|
|
952
|
+
var BAND_ORDER = ["tokens", "base", "responsive", "state", "variant"];
|
|
953
|
+
var StyleRegistry = class {
|
|
954
|
+
_entries = /* @__PURE__ */ new Map();
|
|
955
|
+
_seq = 0;
|
|
956
|
+
/** True once the registry has adopted a server-emitted stylesheet (§12). */
|
|
957
|
+
_adopted = false;
|
|
958
|
+
/**
|
|
959
|
+
* Register (idempotently) the CSS for a style identity. Returns the identity so
|
|
960
|
+
* callers can chain. Re-registering an existing id with the same css is a no-op;
|
|
961
|
+
* with different css it keeps the first registration (identity is content-derived,
|
|
962
|
+
* so this cannot happen for honest input and signals a hash collision if it does).
|
|
963
|
+
*/
|
|
964
|
+
register(id, band, css) {
|
|
965
|
+
const existing = this._entries.get(id);
|
|
966
|
+
if (existing !== void 0) return id;
|
|
967
|
+
this._entries.set(id, { id, band, css, seq: this._seq++ });
|
|
968
|
+
return id;
|
|
969
|
+
}
|
|
970
|
+
/** Whether an identity is already present (server-adopted or locally registered). */
|
|
971
|
+
has(id) {
|
|
972
|
+
return this._entries.has(id);
|
|
973
|
+
}
|
|
974
|
+
/** Number of distinct rules held (bounded by source diversity, not instances). */
|
|
975
|
+
get size() {
|
|
976
|
+
return this._entries.size;
|
|
977
|
+
}
|
|
978
|
+
/**
|
|
979
|
+
* Seed the registry from identities a server stylesheet already shipped (§12).
|
|
980
|
+
* We only need the *keys* to avoid re-emitting duplicates; the rule text is
|
|
981
|
+
* already in the adopted `<style>` element, so a placeholder css is stored.
|
|
982
|
+
*/
|
|
983
|
+
adoptServerIdentities(ids) {
|
|
984
|
+
for (const id of ids) {
|
|
985
|
+
if (!this._entries.has(id)) {
|
|
986
|
+
this._entries.set(id, { id, band: "base", css: "", seq: this._seq++ });
|
|
987
|
+
}
|
|
988
|
+
}
|
|
989
|
+
this._adopted = true;
|
|
990
|
+
}
|
|
991
|
+
get adopted() {
|
|
992
|
+
return this._adopted;
|
|
993
|
+
}
|
|
994
|
+
/** Serialize all rules to a single CSS string in deterministic band order. */
|
|
995
|
+
serializeCSS() {
|
|
996
|
+
if (this._entries.size === 0) return "";
|
|
997
|
+
const byBand = {
|
|
998
|
+
tokens: [],
|
|
999
|
+
base: [],
|
|
1000
|
+
responsive: [],
|
|
1001
|
+
state: [],
|
|
1002
|
+
variant: []
|
|
1003
|
+
};
|
|
1004
|
+
for (const e of this._entries.values()) {
|
|
1005
|
+
if (e.css.length > 0) byBand[e.band].push(e);
|
|
1006
|
+
}
|
|
1007
|
+
let out = "";
|
|
1008
|
+
for (const band of BAND_ORDER) {
|
|
1009
|
+
const list2 = byBand[band].sort((a, b) => a.seq - b.seq);
|
|
1010
|
+
for (const e of list2) out += e.css;
|
|
1011
|
+
}
|
|
1012
|
+
return out;
|
|
1013
|
+
}
|
|
1014
|
+
/** The ordered list of identities present (for the `data-streetui-css-keys` attr). */
|
|
1015
|
+
identities() {
|
|
1016
|
+
return [...this._entries.values()].sort((a, b) => a.seq - b.seq).map((e) => e.id);
|
|
1017
|
+
}
|
|
1018
|
+
/** Clear everything — test isolation and per-process reset only. */
|
|
1019
|
+
reset() {
|
|
1020
|
+
this._entries.clear();
|
|
1021
|
+
this._seq = 0;
|
|
1022
|
+
this._adopted = false;
|
|
1023
|
+
}
|
|
1024
|
+
};
|
|
1025
|
+
var styleRegistry = new StyleRegistry();
|
|
1026
|
+
|
|
1027
|
+
// ../core/src/styling/css.ts
|
|
1028
|
+
var BREAKPOINTS = {
|
|
1029
|
+
sm: 480,
|
|
1030
|
+
md: 768,
|
|
1031
|
+
lg: 1024,
|
|
1032
|
+
xl: 1280
|
|
1033
|
+
};
|
|
1034
|
+
var PSEUDO_SELECTOR = {
|
|
1035
|
+
hover: ":hover",
|
|
1036
|
+
focus: ":focus",
|
|
1037
|
+
focusVisible: ":focus-visible",
|
|
1038
|
+
focusWithin: ":focus-within",
|
|
1039
|
+
active: ":active",
|
|
1040
|
+
disabled: ":disabled",
|
|
1041
|
+
checked: ":checked",
|
|
1042
|
+
firstChild: ":first-child",
|
|
1043
|
+
lastChild: ":last-child"
|
|
1044
|
+
};
|
|
1045
|
+
function stateAttr(state) {
|
|
1046
|
+
return `data-${state}`;
|
|
1047
|
+
}
|
|
1048
|
+
function isResponsiveObject(v) {
|
|
1049
|
+
return v !== null && typeof v === "object";
|
|
1050
|
+
}
|
|
1051
|
+
function splitResponsive(props) {
|
|
1052
|
+
const base = [];
|
|
1053
|
+
const media = { sm: [], md: [], lg: [], xl: [] };
|
|
1054
|
+
for (const key of Object.keys(props).sort()) {
|
|
1055
|
+
if (key === "vars") {
|
|
1056
|
+
const vars = props.vars;
|
|
1057
|
+
if (vars) for (const vk of Object.keys(vars).sort()) base.push([vk, vars[vk]]);
|
|
1058
|
+
continue;
|
|
1059
|
+
}
|
|
1060
|
+
const raw = props[key];
|
|
1061
|
+
if (raw === void 0) continue;
|
|
1062
|
+
if (isResponsiveObject(raw)) {
|
|
1063
|
+
const r = raw;
|
|
1064
|
+
if (r.base !== void 0) base.push([key, r.base]);
|
|
1065
|
+
for (const bp of ["sm", "md", "lg", "xl"]) {
|
|
1066
|
+
if (r[bp] !== void 0) media[bp].push([key, r[bp]]);
|
|
1067
|
+
}
|
|
1068
|
+
} else {
|
|
1069
|
+
base.push([key, raw]);
|
|
1070
|
+
}
|
|
1071
|
+
}
|
|
1072
|
+
return { base, media };
|
|
1073
|
+
}
|
|
1074
|
+
function declBody(pairs) {
|
|
1075
|
+
let out = "";
|
|
1076
|
+
for (const [prop, val] of pairs) out += `${cssPropName(prop)}:${cssValue(prop, val)};`;
|
|
1077
|
+
return out;
|
|
1078
|
+
}
|
|
1079
|
+
function flatBody(props) {
|
|
1080
|
+
const pairs = [];
|
|
1081
|
+
for (const key of Object.keys(props).sort()) {
|
|
1082
|
+
if (key === "vars") {
|
|
1083
|
+
const vars = props.vars;
|
|
1084
|
+
if (vars) for (const vk of Object.keys(vars).sort()) pairs.push([vk, vars[vk]]);
|
|
1085
|
+
continue;
|
|
1086
|
+
}
|
|
1087
|
+
const raw = props[key];
|
|
1088
|
+
if (raw === void 0) continue;
|
|
1089
|
+
if (isResponsiveObject(raw)) {
|
|
1090
|
+
const b = raw.base;
|
|
1091
|
+
if (b !== void 0) pairs.push([key, b]);
|
|
1092
|
+
} else {
|
|
1093
|
+
pairs.push([key, raw]);
|
|
1094
|
+
}
|
|
1095
|
+
}
|
|
1096
|
+
return declBody(pairs);
|
|
1097
|
+
}
|
|
1098
|
+
function generateCSS(id, def) {
|
|
1099
|
+
const sel = `.${id}`;
|
|
1100
|
+
const { base, media } = splitResponsive(def);
|
|
1101
|
+
let baseCss = "";
|
|
1102
|
+
const baseBody = declBody(base);
|
|
1103
|
+
if (baseBody.length > 0) baseCss += `${sel}{${baseBody}}`;
|
|
1104
|
+
let hasResponsive = false;
|
|
1105
|
+
for (const bp of ["sm", "md", "lg", "xl"]) {
|
|
1106
|
+
if (media[bp].length > 0) {
|
|
1107
|
+
hasResponsive = true;
|
|
1108
|
+
baseCss += `@media (min-width:${BREAKPOINTS[bp]}px){${sel}{${declBody(media[bp])}}}`;
|
|
1109
|
+
}
|
|
1110
|
+
}
|
|
1111
|
+
let stateCss = "";
|
|
1112
|
+
if (def.on) {
|
|
1113
|
+
for (const ps of Object.keys(def.on).sort()) {
|
|
1114
|
+
const block = def.on[ps];
|
|
1115
|
+
if (!block) continue;
|
|
1116
|
+
const body2 = flatBody(block);
|
|
1117
|
+
if (body2.length > 0) stateCss += `${sel}${PSEUDO_SELECTOR[ps]}{${body2}}`;
|
|
1118
|
+
}
|
|
1119
|
+
}
|
|
1120
|
+
if (def.when) {
|
|
1121
|
+
for (const st of Object.keys(def.when).sort()) {
|
|
1122
|
+
const block = def.when[st];
|
|
1123
|
+
if (!block) continue;
|
|
1124
|
+
const body2 = flatBody(block);
|
|
1125
|
+
if (body2.length > 0) stateCss += `${sel}[${stateAttr(st)}]{${body2}}`;
|
|
1126
|
+
}
|
|
1127
|
+
}
|
|
1128
|
+
return { base: baseCss, state: stateCss, hasResponsive };
|
|
1129
|
+
}
|
|
1130
|
+
|
|
1131
|
+
// ../core/src/styling/tokens.ts
|
|
1132
|
+
function kebab(seg) {
|
|
1133
|
+
return seg.replace(/[A-Z]/g, (m) => `-${m.toLowerCase()}`);
|
|
1134
|
+
}
|
|
1135
|
+
function isLeaf(v) {
|
|
1136
|
+
return typeof v === "string" || typeof v === "number";
|
|
1137
|
+
}
|
|
1138
|
+
function walkTokens(tree, path, visit) {
|
|
1139
|
+
for (const key of Object.keys(tree).sort()) {
|
|
1140
|
+
const v = tree[key];
|
|
1141
|
+
const next = [...path, kebab(key)];
|
|
1142
|
+
if (isLeaf(v)) visit(`--${next.join("-")}`, v);
|
|
1143
|
+
else walkTokens(v, next, visit);
|
|
1144
|
+
}
|
|
1145
|
+
}
|
|
1146
|
+
function buildRefs(tree, path) {
|
|
1147
|
+
const out = {};
|
|
1148
|
+
for (const key of Object.keys(tree)) {
|
|
1149
|
+
const v = tree[key];
|
|
1150
|
+
const next = [...path, kebab(key)];
|
|
1151
|
+
out[key] = isLeaf(v) ? `var(--${next.join("-")})` : buildRefs(v, next);
|
|
1152
|
+
}
|
|
1153
|
+
return out;
|
|
1154
|
+
}
|
|
1155
|
+
function tokenIdentity(def) {
|
|
1156
|
+
const json = JSON.stringify({ light: def.light, dark: def.dark ?? null });
|
|
1157
|
+
let h = 2166136261;
|
|
1158
|
+
for (let i = 0; i < json.length; i++) {
|
|
1159
|
+
h ^= json.charCodeAt(i);
|
|
1160
|
+
h = Math.imul(h, 16777619);
|
|
1161
|
+
}
|
|
1162
|
+
return `t-${(h >>> 0).toString(36)}`;
|
|
1163
|
+
}
|
|
1164
|
+
function createThemeTokens(def) {
|
|
1165
|
+
const id = tokenIdentity(def);
|
|
1166
|
+
let root = "";
|
|
1167
|
+
walkTokens(def.light, [], (name, value) => {
|
|
1168
|
+
root += `${name}:${value};`;
|
|
1169
|
+
});
|
|
1170
|
+
let dark = "";
|
|
1171
|
+
if (def.dark) walkTokens(def.dark, [], (name, value) => {
|
|
1172
|
+
dark += `${name}:${value};`;
|
|
1173
|
+
});
|
|
1174
|
+
let css = root.length > 0 ? `:root{${root}}` : "";
|
|
1175
|
+
if (dark.length > 0) css += `[data-theme="dark"]{${dark}}`;
|
|
1176
|
+
styleRegistry.register(id, "tokens", css);
|
|
1177
|
+
return {
|
|
1178
|
+
ref: buildRefs(def.light, []),
|
|
1179
|
+
css,
|
|
1180
|
+
id
|
|
1181
|
+
};
|
|
1182
|
+
}
|
|
1183
|
+
var DEFAULT_TOKENS = {
|
|
1184
|
+
surface: { background: "#ffffff", raised: "#f7f7f8", sunken: "#eeeef1", overlay: "rgba(17,17,20,0.55)" },
|
|
1185
|
+
content: { primary: "#17171a", secondary: "#55555f", muted: "#666672", inverse: "#ffffff" },
|
|
1186
|
+
border: { default: "#e3e3e8", strong: "#c9c9d1", subtle: "#f0f0f3" },
|
|
1187
|
+
accent: { primary: "#4f46e5", hover: "#4338ca", contrast: "#ffffff" },
|
|
1188
|
+
focus: { ring: "#6366f1" },
|
|
1189
|
+
danger: { surface: "#fef2f2", border: "#fecaca", content: "#b91c1c", solid: "#dc2626" },
|
|
1190
|
+
success: { content: "#15803d", solid: "#16a34a" },
|
|
1191
|
+
space: { "0": "0", "1": "4px", "2": "8px", "3": "12px", "4": "16px", "5": "24px", "6": "32px", "8": "48px", "10": "64px" },
|
|
1192
|
+
radius: { sm: "4px", md: "8px", lg: "12px", xl: "16px", full: "9999px" },
|
|
1193
|
+
font: {
|
|
1194
|
+
sans: "ui-sans-serif,system-ui,-apple-system,Segoe UI,Roboto,Helvetica,Arial,sans-serif",
|
|
1195
|
+
mono: "ui-monospace,SFMono-Regular,Menlo,Consolas,monospace"
|
|
1196
|
+
},
|
|
1197
|
+
size: { xs: "12px", sm: "14px", md: "16px", lg: "18px", xl: "24px", "2xl": "32px", "3xl": "44px" },
|
|
1198
|
+
weight: { normal: "400", medium: "500", semibold: "600", bold: "700" },
|
|
1199
|
+
leading: { tight: "1.2", normal: "1.5", relaxed: "1.7" },
|
|
1200
|
+
shadow: {
|
|
1201
|
+
sm: "0 1px 2px rgba(17,17,20,0.08)",
|
|
1202
|
+
md: "0 4px 12px rgba(17,17,20,0.1)",
|
|
1203
|
+
lg: "0 12px 32px rgba(17,17,20,0.16)"
|
|
1204
|
+
},
|
|
1205
|
+
z: { base: "0", dropdown: "1000", overlay: "1100", toast: "1200" },
|
|
1206
|
+
duration: { fast: "120ms", base: "200ms", slow: "320ms" },
|
|
1207
|
+
easing: { standard: "cubic-bezier(0.2,0,0,1)", emphasized: "cubic-bezier(0.3,0,0,1)" }
|
|
1208
|
+
};
|
|
1209
|
+
var DARK_OVERRIDES = {
|
|
1210
|
+
surface: { background: "#0f0f12", raised: "#17171c", sunken: "#0a0a0d", overlay: "rgba(0,0,0,0.6)" },
|
|
1211
|
+
content: { primary: "#f4f4f6", secondary: "#b4b4bf", muted: "#7c7c88", inverse: "#17171a" },
|
|
1212
|
+
border: { default: "#2a2a31", strong: "#3a3a44", subtle: "#1e1e24" },
|
|
1213
|
+
accent: { primary: "#818cf8", hover: "#a5b4fc", contrast: "#0f0f12" },
|
|
1214
|
+
focus: { ring: "#a5b4fc" },
|
|
1215
|
+
danger: { surface: "#2a1416", border: "#5b1d1d", content: "#fca5a5", solid: "#ef4444" },
|
|
1216
|
+
success: { content: "#4ade80", solid: "#22c55e" }
|
|
1217
|
+
};
|
|
1218
|
+
var tokens = createThemeTokens({ light: DEFAULT_TOKENS, dark: DARK_OVERRIDES });
|
|
1219
|
+
|
|
1220
|
+
// ../core/src/styling/style.ts
|
|
1221
|
+
function style(def) {
|
|
1222
|
+
const { id } = identityOf(def);
|
|
1223
|
+
if (!styleRegistry.has(id)) {
|
|
1224
|
+
const gen = generateCSS(id, def);
|
|
1225
|
+
styleRegistry.register(id, gen.hasResponsive ? "responsive" : "base", gen.base);
|
|
1226
|
+
if (gen.state.length > 0) {
|
|
1227
|
+
styleRegistry.register(`${id}~state`, "state", gen.state);
|
|
1228
|
+
}
|
|
1229
|
+
}
|
|
1230
|
+
return id;
|
|
1231
|
+
}
|
|
1232
|
+
function cx(...parts) {
|
|
1233
|
+
let out = "";
|
|
1234
|
+
for (const p of parts) {
|
|
1235
|
+
if (!p) continue;
|
|
1236
|
+
out = out.length === 0 ? p : `${out} ${p}`;
|
|
1237
|
+
}
|
|
1238
|
+
return out;
|
|
1239
|
+
}
|
|
1240
|
+
function styleVariants(cfg) {
|
|
1241
|
+
const baseClass = cfg.base ? style(cfg.base) : "";
|
|
1242
|
+
const groupClasses = {};
|
|
1243
|
+
for (const group of Object.keys(cfg.variants)) {
|
|
1244
|
+
const values = cfg.variants[group];
|
|
1245
|
+
const map = {};
|
|
1246
|
+
for (const value of Object.keys(values)) map[value] = style(values[value]);
|
|
1247
|
+
groupClasses[group] = map;
|
|
1248
|
+
}
|
|
1249
|
+
const defaults = cfg.defaultVariants ?? {};
|
|
1250
|
+
return (selection) => {
|
|
1251
|
+
const parts = [];
|
|
1252
|
+
if (baseClass) parts.push(baseClass);
|
|
1253
|
+
for (const group of Object.keys(groupClasses)) {
|
|
1254
|
+
const chosen = selection?.[group] ?? defaults[group];
|
|
1255
|
+
if (chosen === void 0) continue;
|
|
1256
|
+
const cls = groupClasses[group][chosen];
|
|
1257
|
+
if (cls) parts.push(cls);
|
|
1258
|
+
}
|
|
1259
|
+
return cx(...parts);
|
|
1260
|
+
};
|
|
1261
|
+
}
|
|
1262
|
+
|
|
1263
|
+
// ../core/src/styling/reactive.ts
|
|
1264
|
+
function reactiveVarName(prop) {
|
|
1265
|
+
return `--s-${cssPropName(prop)}`;
|
|
1266
|
+
}
|
|
1267
|
+
function styleWithVars(staticDef, reactiveProps) {
|
|
1268
|
+
const vars = {};
|
|
1269
|
+
const bind = {};
|
|
1270
|
+
const dynamic = {};
|
|
1271
|
+
for (const prop of reactiveProps) {
|
|
1272
|
+
const varName = reactiveVarName(prop);
|
|
1273
|
+
vars[prop] = varName;
|
|
1274
|
+
bind[prop] = `style.${varName}`;
|
|
1275
|
+
dynamic[prop] = `var(${varName})`;
|
|
1276
|
+
}
|
|
1277
|
+
const merged = { ...staticDef, ...dynamic };
|
|
1278
|
+
return { class: style(merged), vars, bind };
|
|
1279
|
+
}
|
|
1280
|
+
function reactiveVarValue(prop, value) {
|
|
1281
|
+
return cssValue(prop, value);
|
|
1282
|
+
}
|
|
1283
|
+
|
|
1284
|
+
// ../core/src/styling/layout.ts
|
|
1285
|
+
var space = (k) => tokens.ref.space[k];
|
|
1286
|
+
function container(opts = {}) {
|
|
1287
|
+
const def = {
|
|
1288
|
+
width: "100%",
|
|
1289
|
+
maxWidth: opts.max ?? 1120,
|
|
1290
|
+
paddingLeft: space(opts.padX ?? "4"),
|
|
1291
|
+
paddingRight: space(opts.padX ?? "4"),
|
|
1292
|
+
...opts.center === false ? {} : { marginLeft: "auto", marginRight: "auto" }
|
|
1293
|
+
};
|
|
1294
|
+
return style(def);
|
|
1295
|
+
}
|
|
1296
|
+
var ALIGN = {
|
|
1297
|
+
start: "flex-start",
|
|
1298
|
+
center: "center",
|
|
1299
|
+
end: "flex-end",
|
|
1300
|
+
stretch: "stretch"
|
|
1301
|
+
};
|
|
1302
|
+
var JUSTIFY = {
|
|
1303
|
+
start: "flex-start",
|
|
1304
|
+
center: "center",
|
|
1305
|
+
end: "flex-end",
|
|
1306
|
+
between: "space-between",
|
|
1307
|
+
around: "space-around"
|
|
1308
|
+
};
|
|
1309
|
+
function stack(opts = {}) {
|
|
1310
|
+
return style({
|
|
1311
|
+
display: "flex",
|
|
1312
|
+
flexDirection: "column",
|
|
1313
|
+
gap: space(opts.gap ?? "4"),
|
|
1314
|
+
...opts.align ? { alignItems: ALIGN[opts.align] } : {},
|
|
1315
|
+
...opts.justify ? { justifyContent: JUSTIFY[opts.justify] } : {}
|
|
1316
|
+
});
|
|
1317
|
+
}
|
|
1318
|
+
function row(opts = {}) {
|
|
1319
|
+
return style({
|
|
1320
|
+
display: "flex",
|
|
1321
|
+
flexDirection: "row",
|
|
1322
|
+
gap: space(opts.gap ?? "4"),
|
|
1323
|
+
alignItems: opts.align ? ALIGN[opts.align] : "center",
|
|
1324
|
+
...opts.justify ? { justifyContent: JUSTIFY[opts.justify] } : {},
|
|
1325
|
+
...opts.wrap ? { flexWrap: "wrap" } : {}
|
|
1326
|
+
});
|
|
1327
|
+
}
|
|
1328
|
+
function grid(opts = {}) {
|
|
1329
|
+
const columns = opts.columns ?? "auto";
|
|
1330
|
+
const min = typeof opts.min === "number" ? `${opts.min}px` : opts.min ?? "220px";
|
|
1331
|
+
const template = columns === "auto" ? `repeat(auto-fill, minmax(${min}, 1fr))` : `repeat(${columns}, minmax(0, 1fr))`;
|
|
1332
|
+
return style({ display: "grid", gridTemplateColumns: template, gap: space(opts.gap ?? "4") });
|
|
1333
|
+
}
|
|
1334
|
+
function center(opts = {}) {
|
|
1335
|
+
return style({
|
|
1336
|
+
display: opts.inline ? "inline-flex" : "flex",
|
|
1337
|
+
alignItems: "center",
|
|
1338
|
+
justifyContent: "center",
|
|
1339
|
+
...opts.minHeight !== void 0 ? { minHeight: opts.minHeight } : {}
|
|
1340
|
+
});
|
|
1341
|
+
}
|
|
1342
|
+
function spacer(opts = {}) {
|
|
1343
|
+
return opts.size !== void 0 ? style({ flex: "0 0 auto", width: opts.size, height: opts.size }) : style({ flex: "1 1 0%" });
|
|
1344
|
+
}
|
|
1345
|
+
var layout = { container, stack, row, grid, center, spacer };
|
|
1346
|
+
|
|
1347
|
+
// ../core/src/styling/typography.ts
|
|
1348
|
+
var t = tokens.ref;
|
|
1349
|
+
var HEADING_SIZE = {
|
|
1350
|
+
1: t.size["3xl"],
|
|
1351
|
+
2: t.size["2xl"],
|
|
1352
|
+
3: t.size.xl,
|
|
1353
|
+
4: t.size.lg,
|
|
1354
|
+
5: t.size.md,
|
|
1355
|
+
6: t.size.sm
|
|
1356
|
+
};
|
|
1357
|
+
function heading(opts = {}) {
|
|
1358
|
+
const level = opts.level ?? 2;
|
|
1359
|
+
return style({
|
|
1360
|
+
fontFamily: t.font.sans,
|
|
1361
|
+
fontSize: HEADING_SIZE[level],
|
|
1362
|
+
fontWeight: level <= 2 ? t.weight.bold : t.weight.semibold,
|
|
1363
|
+
lineHeight: t.leading.tight,
|
|
1364
|
+
color: t.content.primary,
|
|
1365
|
+
letterSpacing: level <= 2 ? "-0.02em" : "-0.01em"
|
|
1366
|
+
});
|
|
1367
|
+
}
|
|
1368
|
+
function body(opts = {}) {
|
|
1369
|
+
const def = {
|
|
1370
|
+
fontFamily: t.font.sans,
|
|
1371
|
+
fontSize: t.size.md,
|
|
1372
|
+
fontWeight: t.weight.normal,
|
|
1373
|
+
lineHeight: t.leading.normal,
|
|
1374
|
+
color: opts.muted ? t.content.secondary : t.content.primary
|
|
1375
|
+
};
|
|
1376
|
+
return style(opts.measure !== void 0 ? { ...def, maxWidth: opts.measure } : def);
|
|
1377
|
+
}
|
|
1378
|
+
function label() {
|
|
1379
|
+
return style({
|
|
1380
|
+
fontFamily: t.font.sans,
|
|
1381
|
+
fontSize: t.size.sm,
|
|
1382
|
+
fontWeight: t.weight.medium,
|
|
1383
|
+
lineHeight: t.leading.normal,
|
|
1384
|
+
color: t.content.primary
|
|
1385
|
+
});
|
|
1386
|
+
}
|
|
1387
|
+
function caption() {
|
|
1388
|
+
return style({
|
|
1389
|
+
fontFamily: t.font.sans,
|
|
1390
|
+
fontSize: t.size.xs,
|
|
1391
|
+
fontWeight: t.weight.normal,
|
|
1392
|
+
lineHeight: t.leading.normal,
|
|
1393
|
+
color: t.content.muted
|
|
1394
|
+
});
|
|
1395
|
+
}
|
|
1396
|
+
function link() {
|
|
1397
|
+
return style({
|
|
1398
|
+
color: t.accent.primary,
|
|
1399
|
+
textDecoration: "underline",
|
|
1400
|
+
cursor: "pointer",
|
|
1401
|
+
borderRadius: t.radius.sm,
|
|
1402
|
+
on: {
|
|
1403
|
+
hover: { color: t.accent.hover },
|
|
1404
|
+
focusVisible: { outline: `2px solid ${t.focus.ring}` }
|
|
1405
|
+
}
|
|
1406
|
+
});
|
|
1407
|
+
}
|
|
1408
|
+
function code() {
|
|
1409
|
+
return style({
|
|
1410
|
+
fontFamily: t.font.mono,
|
|
1411
|
+
fontSize: "0.9em",
|
|
1412
|
+
background: t.surface.sunken,
|
|
1413
|
+
color: t.content.primary,
|
|
1414
|
+
borderRadius: t.radius.sm,
|
|
1415
|
+
paddingLeft: t.space["1"],
|
|
1416
|
+
paddingRight: t.space["1"],
|
|
1417
|
+
borderWidth: 1,
|
|
1418
|
+
borderStyle: "solid",
|
|
1419
|
+
borderColor: t.border.subtle
|
|
1420
|
+
});
|
|
1421
|
+
}
|
|
1422
|
+
function pre() {
|
|
1423
|
+
return style({
|
|
1424
|
+
fontFamily: t.font.mono,
|
|
1425
|
+
fontSize: t.size.sm,
|
|
1426
|
+
lineHeight: t.leading.relaxed,
|
|
1427
|
+
background: t.surface.sunken,
|
|
1428
|
+
color: t.content.primary,
|
|
1429
|
+
borderRadius: t.radius.md,
|
|
1430
|
+
borderWidth: 1,
|
|
1431
|
+
borderStyle: "solid",
|
|
1432
|
+
borderColor: t.border.subtle,
|
|
1433
|
+
padding: t.space["4"],
|
|
1434
|
+
overflowX: "auto",
|
|
1435
|
+
whiteSpace: "pre"
|
|
1436
|
+
});
|
|
1437
|
+
}
|
|
1438
|
+
function blockquote() {
|
|
1439
|
+
return style({
|
|
1440
|
+
fontFamily: t.font.sans,
|
|
1441
|
+
fontSize: t.size.lg,
|
|
1442
|
+
lineHeight: t.leading.relaxed,
|
|
1443
|
+
color: t.content.secondary,
|
|
1444
|
+
borderStyle: "solid",
|
|
1445
|
+
borderColor: t.accent.primary,
|
|
1446
|
+
paddingLeft: t.space["4"],
|
|
1447
|
+
marginLeft: 0
|
|
1448
|
+
});
|
|
1449
|
+
}
|
|
1450
|
+
function list() {
|
|
1451
|
+
return style({
|
|
1452
|
+
fontFamily: t.font.sans,
|
|
1453
|
+
fontSize: t.size.md,
|
|
1454
|
+
lineHeight: t.leading.normal,
|
|
1455
|
+
color: t.content.primary,
|
|
1456
|
+
display: "flex",
|
|
1457
|
+
flexDirection: "column",
|
|
1458
|
+
gap: t.space["2"]
|
|
1459
|
+
});
|
|
1460
|
+
}
|
|
1461
|
+
var text = { heading, body, label, caption, link, code, pre, blockquote, list };
|
|
1462
|
+
|
|
1463
|
+
// ../core/src/styling/a11y.ts
|
|
1464
|
+
var t2 = tokens.ref;
|
|
1465
|
+
function focusRing(opts = {}) {
|
|
1466
|
+
const color = opts.color ?? t2.focus.ring;
|
|
1467
|
+
const width = opts.width ?? 2;
|
|
1468
|
+
const offset = opts.offset ?? 2;
|
|
1469
|
+
return style({
|
|
1470
|
+
outline: "2px solid transparent",
|
|
1471
|
+
// reserve space; real ring shown on focus
|
|
1472
|
+
on: {
|
|
1473
|
+
focusVisible: {
|
|
1474
|
+
outline: `${width}px solid ${color}`,
|
|
1475
|
+
outlineOffset: offset
|
|
1476
|
+
}
|
|
1477
|
+
}
|
|
1478
|
+
});
|
|
1479
|
+
}
|
|
1480
|
+
function visuallyHidden() {
|
|
1481
|
+
return style({
|
|
1482
|
+
position: "absolute",
|
|
1483
|
+
width: 1,
|
|
1484
|
+
height: 1,
|
|
1485
|
+
padding: 0,
|
|
1486
|
+
margin: -1,
|
|
1487
|
+
overflow: "hidden",
|
|
1488
|
+
whiteSpace: "nowrap",
|
|
1489
|
+
border: 0,
|
|
1490
|
+
// clip to a zero-area rect so the node occupies no visual space
|
|
1491
|
+
clipPath: "inset(50%)"
|
|
1492
|
+
});
|
|
1493
|
+
}
|
|
1494
|
+
function skipLink() {
|
|
1495
|
+
return style({
|
|
1496
|
+
position: "absolute",
|
|
1497
|
+
left: t2.space["2"],
|
|
1498
|
+
top: -40,
|
|
1499
|
+
background: t2.surface.raised,
|
|
1500
|
+
color: t2.content.primary,
|
|
1501
|
+
padding: t2.space["2"],
|
|
1502
|
+
borderRadius: t2.radius.md,
|
|
1503
|
+
boxShadow: t2.shadow.md,
|
|
1504
|
+
transition: `top ${t2.duration.fast} ${t2.easing.standard}`,
|
|
1505
|
+
on: {
|
|
1506
|
+
focusVisible: { top: t2.space["2"], outline: `2px solid ${t2.focus.ring}`, outlineOffset: 2 }
|
|
1507
|
+
}
|
|
1508
|
+
});
|
|
1509
|
+
}
|
|
1510
|
+
var a11y = { focusRing, visuallyHidden, skipLink };
|
|
1511
|
+
|
|
1512
|
+
// ../core/src/styling/forms.ts
|
|
1513
|
+
var t3 = tokens.ref;
|
|
1514
|
+
var CONTROL_BASE = {
|
|
1515
|
+
fontFamily: t3.font.sans,
|
|
1516
|
+
fontSize: t3.size.md,
|
|
1517
|
+
lineHeight: t3.leading.normal,
|
|
1518
|
+
color: t3.content.primary,
|
|
1519
|
+
background: t3.surface.background,
|
|
1520
|
+
borderWidth: 1,
|
|
1521
|
+
borderStyle: "solid",
|
|
1522
|
+
borderColor: t3.border.strong,
|
|
1523
|
+
borderRadius: t3.radius.md,
|
|
1524
|
+
paddingTop: t3.space["2"],
|
|
1525
|
+
paddingBottom: t3.space["2"],
|
|
1526
|
+
paddingLeft: t3.space["3"],
|
|
1527
|
+
paddingRight: t3.space["3"],
|
|
1528
|
+
width: "100%",
|
|
1529
|
+
appearance: "none",
|
|
1530
|
+
transition: `border-color ${t3.duration.fast} ${t3.easing.standard}, box-shadow ${t3.duration.fast} ${t3.easing.standard}`,
|
|
1531
|
+
on: {
|
|
1532
|
+
focusVisible: { outline: "none", borderColor: t3.accent.primary, boxShadow: `0 0 0 3px ${t3.focus.ring}` },
|
|
1533
|
+
disabled: { opacity: 0.55, cursor: "not-allowed", background: t3.surface.sunken }
|
|
1534
|
+
},
|
|
1535
|
+
when: {
|
|
1536
|
+
invalid: { borderColor: t3.danger.border, boxShadow: `0 0 0 3px ${t3.danger.surface}` }
|
|
1537
|
+
}
|
|
1538
|
+
};
|
|
1539
|
+
function input() {
|
|
1540
|
+
return style(CONTROL_BASE);
|
|
1541
|
+
}
|
|
1542
|
+
function field() {
|
|
1543
|
+
return style({ display: "flex", flexDirection: "column", gap: t3.space["2"] });
|
|
1544
|
+
}
|
|
1545
|
+
function fieldLabel() {
|
|
1546
|
+
return style({
|
|
1547
|
+
fontFamily: t3.font.sans,
|
|
1548
|
+
fontSize: t3.size.sm,
|
|
1549
|
+
fontWeight: t3.weight.medium,
|
|
1550
|
+
color: t3.content.primary
|
|
1551
|
+
});
|
|
1552
|
+
}
|
|
1553
|
+
function fieldHelp() {
|
|
1554
|
+
return style({ fontFamily: t3.font.sans, fontSize: t3.size.xs, color: t3.content.muted });
|
|
1555
|
+
}
|
|
1556
|
+
function fieldError() {
|
|
1557
|
+
return style({
|
|
1558
|
+
fontFamily: t3.font.sans,
|
|
1559
|
+
fontSize: t3.size.xs,
|
|
1560
|
+
fontWeight: t3.weight.medium,
|
|
1561
|
+
color: t3.danger.content
|
|
1562
|
+
});
|
|
1563
|
+
}
|
|
1564
|
+
function button() {
|
|
1565
|
+
return style({
|
|
1566
|
+
fontFamily: t3.font.sans,
|
|
1567
|
+
fontSize: t3.size.md,
|
|
1568
|
+
fontWeight: t3.weight.semibold,
|
|
1569
|
+
lineHeight: t3.leading.normal,
|
|
1570
|
+
color: t3.accent.contrast,
|
|
1571
|
+
background: t3.accent.primary,
|
|
1572
|
+
borderWidth: 0,
|
|
1573
|
+
borderStyle: "solid",
|
|
1574
|
+
borderRadius: t3.radius.md,
|
|
1575
|
+
paddingTop: t3.space["2"],
|
|
1576
|
+
paddingBottom: t3.space["2"],
|
|
1577
|
+
paddingLeft: t3.space["4"],
|
|
1578
|
+
paddingRight: t3.space["4"],
|
|
1579
|
+
cursor: "pointer",
|
|
1580
|
+
appearance: "none",
|
|
1581
|
+
transition: `background ${t3.duration.fast} ${t3.easing.standard}`,
|
|
1582
|
+
on: {
|
|
1583
|
+
hover: { background: t3.accent.hover },
|
|
1584
|
+
focusVisible: { outline: "none", boxShadow: `0 0 0 3px ${t3.focus.ring}` },
|
|
1585
|
+
disabled: { opacity: 0.55, cursor: "not-allowed" }
|
|
1586
|
+
}
|
|
1587
|
+
});
|
|
1588
|
+
}
|
|
1589
|
+
var form = { field, input, label: fieldLabel, help: fieldHelp, error: fieldError, button };
|
|
1590
|
+
|
|
1591
|
+
// ../core/src/styling/overlays.ts
|
|
1592
|
+
var t4 = tokens.ref;
|
|
1593
|
+
function backdrop() {
|
|
1594
|
+
return style({
|
|
1595
|
+
position: "fixed",
|
|
1596
|
+
inset: 0,
|
|
1597
|
+
background: t4.surface.overlay,
|
|
1598
|
+
zIndex: t4.z.overlay
|
|
1599
|
+
});
|
|
1600
|
+
}
|
|
1601
|
+
function dialog() {
|
|
1602
|
+
return style({
|
|
1603
|
+
position: "relative",
|
|
1604
|
+
background: t4.surface.background,
|
|
1605
|
+
color: t4.content.primary,
|
|
1606
|
+
borderRadius: t4.radius.lg,
|
|
1607
|
+
boxShadow: t4.shadow.lg,
|
|
1608
|
+
borderWidth: 1,
|
|
1609
|
+
borderStyle: "solid",
|
|
1610
|
+
borderColor: t4.border.default,
|
|
1611
|
+
padding: t4.space["5"],
|
|
1612
|
+
maxWidth: "min(560px, calc(100vw - 32px))",
|
|
1613
|
+
width: "100%",
|
|
1614
|
+
zIndex: t4.z.overlay
|
|
1615
|
+
});
|
|
1616
|
+
}
|
|
1617
|
+
function popover() {
|
|
1618
|
+
return style({
|
|
1619
|
+
position: "absolute",
|
|
1620
|
+
background: t4.surface.raised,
|
|
1621
|
+
color: t4.content.primary,
|
|
1622
|
+
borderRadius: t4.radius.md,
|
|
1623
|
+
boxShadow: t4.shadow.md,
|
|
1624
|
+
borderWidth: 1,
|
|
1625
|
+
borderStyle: "solid",
|
|
1626
|
+
borderColor: t4.border.default,
|
|
1627
|
+
padding: t4.space["3"],
|
|
1628
|
+
zIndex: t4.z.dropdown
|
|
1629
|
+
});
|
|
1630
|
+
}
|
|
1631
|
+
function tooltip() {
|
|
1632
|
+
return style({
|
|
1633
|
+
position: "absolute",
|
|
1634
|
+
background: t4.content.primary,
|
|
1635
|
+
color: t4.surface.background,
|
|
1636
|
+
fontFamily: t4.font.sans,
|
|
1637
|
+
fontSize: t4.size.xs,
|
|
1638
|
+
lineHeight: t4.leading.tight,
|
|
1639
|
+
borderRadius: t4.radius.sm,
|
|
1640
|
+
paddingTop: t4.space["1"],
|
|
1641
|
+
paddingBottom: t4.space["1"],
|
|
1642
|
+
paddingLeft: t4.space["2"],
|
|
1643
|
+
paddingRight: t4.space["2"],
|
|
1644
|
+
maxWidth: 240,
|
|
1645
|
+
zIndex: t4.z.overlay,
|
|
1646
|
+
pointerEvents: "none"
|
|
1647
|
+
});
|
|
1648
|
+
}
|
|
1649
|
+
var MENU_BASE = {
|
|
1650
|
+
position: "absolute",
|
|
1651
|
+
background: t4.surface.background,
|
|
1652
|
+
color: t4.content.primary,
|
|
1653
|
+
borderRadius: t4.radius.md,
|
|
1654
|
+
boxShadow: t4.shadow.md,
|
|
1655
|
+
borderWidth: 1,
|
|
1656
|
+
borderStyle: "solid",
|
|
1657
|
+
borderColor: t4.border.default,
|
|
1658
|
+
paddingTop: t4.space["1"],
|
|
1659
|
+
paddingBottom: t4.space["1"],
|
|
1660
|
+
minWidth: 180,
|
|
1661
|
+
zIndex: t4.z.dropdown
|
|
1662
|
+
};
|
|
1663
|
+
function dropdown() {
|
|
1664
|
+
return style(MENU_BASE);
|
|
1665
|
+
}
|
|
1666
|
+
function dropdownItem() {
|
|
1667
|
+
return style({
|
|
1668
|
+
display: "flex",
|
|
1669
|
+
alignItems: "center",
|
|
1670
|
+
gap: t4.space["2"],
|
|
1671
|
+
fontFamily: t4.font.sans,
|
|
1672
|
+
fontSize: t4.size.sm,
|
|
1673
|
+
color: t4.content.primary,
|
|
1674
|
+
paddingTop: t4.space["2"],
|
|
1675
|
+
paddingBottom: t4.space["2"],
|
|
1676
|
+
paddingLeft: t4.space["3"],
|
|
1677
|
+
paddingRight: t4.space["3"],
|
|
1678
|
+
cursor: "pointer",
|
|
1679
|
+
on: {
|
|
1680
|
+
hover: { background: t4.surface.raised },
|
|
1681
|
+
disabled: { opacity: 0.5, cursor: "not-allowed" }
|
|
1682
|
+
},
|
|
1683
|
+
when: { selected: { background: t4.surface.sunken, fontWeight: t4.weight.medium } }
|
|
1684
|
+
});
|
|
1685
|
+
}
|
|
1686
|
+
function toast() {
|
|
1687
|
+
return style({
|
|
1688
|
+
background: t4.surface.raised,
|
|
1689
|
+
color: t4.content.primary,
|
|
1690
|
+
borderRadius: t4.radius.md,
|
|
1691
|
+
boxShadow: t4.shadow.lg,
|
|
1692
|
+
borderWidth: 1,
|
|
1693
|
+
borderStyle: "solid",
|
|
1694
|
+
borderColor: t4.border.default,
|
|
1695
|
+
padding: t4.space["3"],
|
|
1696
|
+
minWidth: 240,
|
|
1697
|
+
maxWidth: 420,
|
|
1698
|
+
zIndex: t4.z.toast
|
|
1699
|
+
});
|
|
1700
|
+
}
|
|
1701
|
+
var overlay = {
|
|
1702
|
+
backdrop,
|
|
1703
|
+
dialog,
|
|
1704
|
+
popover,
|
|
1705
|
+
tooltip,
|
|
1706
|
+
dropdown,
|
|
1707
|
+
dropdownItem,
|
|
1708
|
+
toast
|
|
1709
|
+
};
|
|
1710
|
+
|
|
1711
|
+
// ../core/src/styling/animation.ts
|
|
1712
|
+
var t5 = tokens.ref;
|
|
1713
|
+
var KEYFRAMES = {
|
|
1714
|
+
"streetui-fade-in": "from{opacity:0}to{opacity:1}",
|
|
1715
|
+
"streetui-fade-out": "from{opacity:1}to{opacity:0}",
|
|
1716
|
+
"streetui-scale-in": "from{opacity:0;transform:scale(.96)}to{opacity:1;transform:scale(1)}",
|
|
1717
|
+
"streetui-scale-out": "from{opacity:1;transform:scale(1)}to{opacity:0;transform:scale(.96)}",
|
|
1718
|
+
"streetui-slide-in-up": "from{opacity:0;transform:translateY(8px)}to{opacity:1;transform:translateY(0)}",
|
|
1719
|
+
"streetui-slide-out-down": "from{opacity:1;transform:translateY(0)}to{opacity:0;transform:translateY(8px)}",
|
|
1720
|
+
"streetui-spin": "to{transform:rotate(360deg)}"
|
|
1721
|
+
};
|
|
1722
|
+
function ensureKeyframes(name) {
|
|
1723
|
+
const id = `kf-${name}`;
|
|
1724
|
+
if (!styleRegistry.has(id)) {
|
|
1725
|
+
styleRegistry.register(id, "base", `@keyframes ${name}{${KEYFRAMES[name]}}`);
|
|
1726
|
+
}
|
|
1727
|
+
}
|
|
1728
|
+
function animate(name, opts = {}) {
|
|
1729
|
+
ensureKeyframes(name);
|
|
1730
|
+
const duration = t5.duration[opts.duration ?? "base"];
|
|
1731
|
+
const easing = t5.easing[opts.easing ?? "standard"];
|
|
1732
|
+
const iterations = opts.iterations ?? 1;
|
|
1733
|
+
const fill = opts.fill ?? "both";
|
|
1734
|
+
return style({
|
|
1735
|
+
animationName: name,
|
|
1736
|
+
animationDuration: duration,
|
|
1737
|
+
animationTimingFunction: easing,
|
|
1738
|
+
animationFillMode: fill,
|
|
1739
|
+
animationIterationCount: String(iterations),
|
|
1740
|
+
...opts.delay !== void 0 ? { animationDelay: opts.delay } : {}
|
|
1741
|
+
});
|
|
1742
|
+
}
|
|
1743
|
+
function transition(properties, opts = {}) {
|
|
1744
|
+
const props = typeof properties === "string" ? [properties] : properties;
|
|
1745
|
+
const duration = t5.duration[opts.duration ?? "base"];
|
|
1746
|
+
const easing = t5.easing[opts.easing ?? "standard"];
|
|
1747
|
+
const delay = opts.delay !== void 0 ? ` ${typeof opts.delay === "number" ? `${opts.delay}ms` : opts.delay}` : "";
|
|
1748
|
+
return props.map((p) => `${p} ${duration} ${easing}${delay}`).join(", ");
|
|
1749
|
+
}
|
|
1750
|
+
var animation = { animate, transition, keyframes: KEYFRAMES };
|
|
1751
|
+
|
|
874
1752
|
// ../graph/src/graph-node.ts
|
|
875
1753
|
var GraphNode = class _GraphNode {
|
|
876
1754
|
id;
|
|
@@ -1404,13 +2282,13 @@ var ContentBuilderBase = class {
|
|
|
1404
2282
|
this._node = _node;
|
|
1405
2283
|
this._graph = _graph;
|
|
1406
2284
|
}
|
|
1407
|
-
heading(
|
|
2285
|
+
heading(text2, options = {}) {
|
|
1408
2286
|
const props = { level: options.level ?? 1 };
|
|
1409
2287
|
if (options.class !== void 0) props["class"] = options.class;
|
|
1410
2288
|
if (options.id !== void 0) props["id"] = options.id;
|
|
1411
2289
|
applyA11yProps(props, options);
|
|
1412
2290
|
const node = this._graph.createNode("heading", { parent: this._node, props });
|
|
1413
|
-
const resolved = bindValue(this._graph, node, "text",
|
|
2291
|
+
const resolved = bindValue(this._graph, node, "text", text2);
|
|
1414
2292
|
node.setProp("text", resolved);
|
|
1415
2293
|
}
|
|
1416
2294
|
text(content, options = {}) {
|
|
@@ -1422,13 +2300,13 @@ var ContentBuilderBase = class {
|
|
|
1422
2300
|
const resolved = bindValue(this._graph, node, "text", content);
|
|
1423
2301
|
node.setProp("text", resolved);
|
|
1424
2302
|
}
|
|
1425
|
-
button(
|
|
2303
|
+
button(label2, options = {}) {
|
|
1426
2304
|
const props = {};
|
|
1427
2305
|
if (options.class !== void 0) props["class"] = options.class;
|
|
1428
2306
|
if (options.id !== void 0) props["id"] = options.id;
|
|
1429
2307
|
applyA11yProps(props, options);
|
|
1430
2308
|
const node = this._graph.createNode("button", { parent: this._node, props });
|
|
1431
|
-
const resolved = bindValue(this._graph, node, "label",
|
|
2309
|
+
const resolved = bindValue(this._graph, node, "label", label2);
|
|
1432
2310
|
node.setProp("label", resolved);
|
|
1433
2311
|
if (options.disabled !== void 0) {
|
|
1434
2312
|
const resolvedDisabled = bindValue(this._graph, node, "disabled", options.disabled);
|
|
@@ -1492,7 +2370,7 @@ var ContentBuilderBase = class {
|
|
|
1492
2370
|
if (options.id !== void 0) nodeOpts.key = options.id;
|
|
1493
2371
|
this._graph.createNode("image", nodeOpts);
|
|
1494
2372
|
}
|
|
1495
|
-
link(
|
|
2373
|
+
link(label2, options) {
|
|
1496
2374
|
const props = {
|
|
1497
2375
|
href: options.href,
|
|
1498
2376
|
external: options.external ?? false
|
|
@@ -1501,7 +2379,7 @@ var ContentBuilderBase = class {
|
|
|
1501
2379
|
if (options.id !== void 0) props["id"] = options.id;
|
|
1502
2380
|
applyA11yProps(props, options);
|
|
1503
2381
|
const node = this._graph.createNode("link", { parent: this._node, props });
|
|
1504
|
-
const resolved = bindValue(this._graph, node, "label",
|
|
2382
|
+
const resolved = bindValue(this._graph, node, "label", label2);
|
|
1505
2383
|
node.setProp("label", resolved);
|
|
1506
2384
|
if (options.onClick !== void 0) {
|
|
1507
2385
|
const handlerKey = `click:${node.id}`;
|
|
@@ -1685,9 +2563,9 @@ var ContainerBuilderBase = class extends ContentBuilderBase {
|
|
|
1685
2563
|
options.fallback(fb, currentError, retry);
|
|
1686
2564
|
},
|
|
1687
2565
|
// Healthy state → body, guarded against synchronous build throws.
|
|
1688
|
-
(
|
|
2566
|
+
(body2) => {
|
|
1689
2567
|
try {
|
|
1690
|
-
builder(
|
|
2568
|
+
builder(body2);
|
|
1691
2569
|
} catch (err) {
|
|
1692
2570
|
queueMicrotask(() => localError.set(err));
|
|
1693
2571
|
}
|
|
@@ -1970,8 +2848,8 @@ function validateGraph(graph) {
|
|
|
1970
2848
|
function validateNode(node, dc) {
|
|
1971
2849
|
switch (node.type) {
|
|
1972
2850
|
case "heading": {
|
|
1973
|
-
const
|
|
1974
|
-
if (
|
|
2851
|
+
const text2 = node.getProp("text");
|
|
2852
|
+
if (text2 === void 0 || text2 === "") {
|
|
1975
2853
|
dc.warn("COMPILER_EMPTY_HEADING", `Heading node "${node.id}" has no text content`, {
|
|
1976
2854
|
nodeId: node.id
|
|
1977
2855
|
});
|
|
@@ -2251,11 +3129,11 @@ var Runtime = class {
|
|
|
2251
3129
|
/**
|
|
2252
3130
|
* Mount the compiled application into the given DOM container.
|
|
2253
3131
|
*/
|
|
2254
|
-
mount(compiled,
|
|
3132
|
+
mount(compiled, container2) {
|
|
2255
3133
|
if (this._mounted) {
|
|
2256
3134
|
throw new Error("[Runtime] Already mounted. Call unmount() first.");
|
|
2257
3135
|
}
|
|
2258
|
-
this._renderHandle = this._renderer.mount(compiled,
|
|
3136
|
+
this._renderHandle = this._renderer.mount(compiled, container2);
|
|
2259
3137
|
this._mounted = true;
|
|
2260
3138
|
this._bindSignals(compiled.graph);
|
|
2261
3139
|
const self2 = this;
|
|
@@ -2284,11 +3162,11 @@ var Runtime = class {
|
|
|
2284
3162
|
* cannot hydrate. Signal binding is identical to `mount`, so the live client
|
|
2285
3163
|
* lifecycle is established the same way.
|
|
2286
3164
|
*/
|
|
2287
|
-
hydrate(compiled,
|
|
3165
|
+
hydrate(compiled, container2) {
|
|
2288
3166
|
if (this._mounted) {
|
|
2289
3167
|
throw new Error("[Runtime] Already mounted. Call unmount() first.");
|
|
2290
3168
|
}
|
|
2291
|
-
this._renderHandle = this._renderer.hydrate !== void 0 ? this._renderer.hydrate(compiled,
|
|
3169
|
+
this._renderHandle = this._renderer.hydrate !== void 0 ? this._renderer.hydrate(compiled, container2) : this._renderer.mount(compiled, container2);
|
|
2292
3170
|
this._mounted = true;
|
|
2293
3171
|
this._bindSignals(compiled.graph);
|
|
2294
3172
|
const self2 = this;
|
|
@@ -2463,8 +3341,8 @@ var BrowserDOMAdapter = class {
|
|
|
2463
3341
|
setProperty(element, name, value) {
|
|
2464
3342
|
element[name] = value;
|
|
2465
3343
|
}
|
|
2466
|
-
setTextContent(node,
|
|
2467
|
-
node.textContent =
|
|
3344
|
+
setTextContent(node, text2) {
|
|
3345
|
+
node.textContent = text2;
|
|
2468
3346
|
}
|
|
2469
3347
|
getTextContent(node) {
|
|
2470
3348
|
return node.textContent;
|
|
@@ -2704,9 +3582,9 @@ function serializeAttributes(el) {
|
|
|
2704
3582
|
}
|
|
2705
3583
|
}
|
|
2706
3584
|
}
|
|
2707
|
-
const
|
|
2708
|
-
if (
|
|
2709
|
-
parts.push(` style="${escapeHtmlAttr(
|
|
3585
|
+
const style2 = el._style;
|
|
3586
|
+
if (style2 !== null && !style2.isEmpty && !el.attributes.has("style")) {
|
|
3587
|
+
parts.push(` style="${escapeHtmlAttr(style2.toCss())}"`);
|
|
2710
3588
|
}
|
|
2711
3589
|
return parts.join("");
|
|
2712
3590
|
}
|
|
@@ -2829,16 +3707,16 @@ var ServerDOMAdapter = class {
|
|
|
2829
3707
|
setProperty(element, name, value) {
|
|
2830
3708
|
element.properties.set(name, value);
|
|
2831
3709
|
}
|
|
2832
|
-
setTextContent(node,
|
|
3710
|
+
setTextContent(node, text2) {
|
|
2833
3711
|
const n = asServer(node);
|
|
2834
3712
|
if (n.kind === "element" || n.kind === "fragment") {
|
|
2835
3713
|
const el = n;
|
|
2836
3714
|
el.children.length = 0;
|
|
2837
|
-
const
|
|
2838
|
-
|
|
2839
|
-
el.children.push(
|
|
3715
|
+
const t6 = new ServerText(text2);
|
|
3716
|
+
t6.parent = el;
|
|
3717
|
+
el.children.push(t6);
|
|
2840
3718
|
} else if (n.kind === "text") {
|
|
2841
|
-
n.data =
|
|
3719
|
+
n.data = text2;
|
|
2842
3720
|
}
|
|
2843
3721
|
}
|
|
2844
3722
|
getTextContent(node) {
|
|
@@ -2943,14 +3821,14 @@ function focusById(dom, root, id) {
|
|
|
2943
3821
|
dom.focus(el);
|
|
2944
3822
|
return true;
|
|
2945
3823
|
}
|
|
2946
|
-
function focusFirst(dom,
|
|
2947
|
-
const el = dom.querySelector(
|
|
3824
|
+
function focusFirst(dom, container2, selector = FOCUSABLE_SELECTOR) {
|
|
3825
|
+
const el = dom.querySelector(container2, selector);
|
|
2948
3826
|
if (el === null) return false;
|
|
2949
3827
|
dom.focus(el);
|
|
2950
3828
|
return true;
|
|
2951
3829
|
}
|
|
2952
|
-
function getFocusable(dom,
|
|
2953
|
-
return Array.from(dom.querySelectorAll(
|
|
3830
|
+
function getFocusable(dom, container2, selector = FOCUSABLE_SELECTOR) {
|
|
3831
|
+
return Array.from(dom.querySelectorAll(container2, selector)).filter(
|
|
2954
3832
|
(el) => dom.matches(el, selector)
|
|
2955
3833
|
);
|
|
2956
3834
|
}
|
|
@@ -2960,14 +3838,14 @@ function saveFocus(dom) {
|
|
|
2960
3838
|
function restoreFocus(dom, saved) {
|
|
2961
3839
|
if (saved !== null) dom.focus(saved);
|
|
2962
3840
|
}
|
|
2963
|
-
function focusInitial(dom,
|
|
2964
|
-
if (initialFocusId !== void 0 && focusById(dom,
|
|
2965
|
-
focusFirst(dom,
|
|
3841
|
+
function focusInitial(dom, container2, initialFocusId) {
|
|
3842
|
+
if (initialFocusId !== void 0 && focusById(dom, container2, initialFocusId)) return;
|
|
3843
|
+
focusFirst(dom, container2);
|
|
2966
3844
|
}
|
|
2967
|
-
function trapFocus(dom,
|
|
3845
|
+
function trapFocus(dom, container2) {
|
|
2968
3846
|
const onKeydown = (event) => {
|
|
2969
3847
|
if (event.key !== "Tab") return;
|
|
2970
|
-
const items = getFocusable(dom,
|
|
3848
|
+
const items = getFocusable(dom, container2);
|
|
2971
3849
|
if (items.length === 0) {
|
|
2972
3850
|
event.preventDefault();
|
|
2973
3851
|
return;
|
|
@@ -2975,7 +3853,7 @@ function trapFocus(dom, container) {
|
|
|
2975
3853
|
const first = items[0];
|
|
2976
3854
|
const last = items[items.length - 1];
|
|
2977
3855
|
const active = dom.activeElement();
|
|
2978
|
-
if (active === null || !dom.contains(
|
|
3856
|
+
if (active === null || !dom.contains(container2, active)) {
|
|
2979
3857
|
event.preventDefault();
|
|
2980
3858
|
dom.focus(first);
|
|
2981
3859
|
} else if (event.shiftKey && active === first) {
|
|
@@ -2986,26 +3864,26 @@ function trapFocus(dom, container) {
|
|
|
2986
3864
|
dom.focus(first);
|
|
2987
3865
|
}
|
|
2988
3866
|
};
|
|
2989
|
-
dom.addEventListener(
|
|
2990
|
-
return () => dom.removeEventListener(
|
|
3867
|
+
dom.addEventListener(container2, "keydown", onKeydown);
|
|
3868
|
+
return () => dom.removeEventListener(container2, "keydown", onKeydown);
|
|
2991
3869
|
}
|
|
2992
3870
|
var containmentStack = [];
|
|
2993
|
-
function containFocus(dom,
|
|
2994
|
-
const
|
|
2995
|
-
if (
|
|
3871
|
+
function containFocus(dom, container2) {
|
|
3872
|
+
const body2 = dom.body();
|
|
3873
|
+
if (body2 === null) return () => {
|
|
2996
3874
|
};
|
|
2997
|
-
containmentStack.push(
|
|
3875
|
+
containmentStack.push(container2);
|
|
2998
3876
|
const onFocusIn = (event) => {
|
|
2999
|
-
if (containmentStack[containmentStack.length - 1] !==
|
|
3877
|
+
if (containmentStack[containmentStack.length - 1] !== container2) return;
|
|
3000
3878
|
const target = event.target;
|
|
3001
|
-
if (target !== null && !dom.contains(
|
|
3002
|
-
focusFirst(dom,
|
|
3879
|
+
if (target !== null && !dom.contains(container2, target)) {
|
|
3880
|
+
focusFirst(dom, container2);
|
|
3003
3881
|
}
|
|
3004
3882
|
};
|
|
3005
|
-
dom.addEventListener(
|
|
3883
|
+
dom.addEventListener(body2, "focusin", onFocusIn);
|
|
3006
3884
|
return () => {
|
|
3007
|
-
dom.removeEventListener(
|
|
3008
|
-
const index = containmentStack.lastIndexOf(
|
|
3885
|
+
dom.removeEventListener(body2, "focusin", onFocusIn);
|
|
3886
|
+
const index = containmentStack.lastIndexOf(container2);
|
|
3009
3887
|
if (index !== -1) containmentStack.splice(index, 1);
|
|
3010
3888
|
};
|
|
3011
3889
|
}
|
|
@@ -3016,13 +3894,13 @@ function onEscape(dom, target, handler) {
|
|
|
3016
3894
|
dom.addEventListener(target, "keydown", onKeydown);
|
|
3017
3895
|
return () => dom.removeEventListener(target, "keydown", onKeydown);
|
|
3018
3896
|
}
|
|
3019
|
-
function rovingMenu(dom,
|
|
3897
|
+
function rovingMenu(dom, container2, selector = FOCUSABLE_SELECTOR) {
|
|
3020
3898
|
const onKeydown = (event) => {
|
|
3021
3899
|
const key = event.key;
|
|
3022
3900
|
const isActivate = key === "Enter" || key === " " || key === "Spacebar";
|
|
3023
3901
|
const isMove = key === "ArrowDown" || key === "ArrowUp" || key === "Home" || key === "End";
|
|
3024
3902
|
if (!isActivate && !isMove) return;
|
|
3025
|
-
const items = getFocusable(dom,
|
|
3903
|
+
const items = getFocusable(dom, container2, selector);
|
|
3026
3904
|
if (items.length === 0) return;
|
|
3027
3905
|
const active = dom.activeElement();
|
|
3028
3906
|
const index = active === null ? -1 : items.indexOf(active);
|
|
@@ -3040,8 +3918,8 @@ function rovingMenu(dom, container, selector = FOCUSABLE_SELECTOR) {
|
|
|
3040
3918
|
else next = index <= 0 ? items.length - 1 : index - 1;
|
|
3041
3919
|
dom.focus(items[next]);
|
|
3042
3920
|
};
|
|
3043
|
-
dom.addEventListener(
|
|
3044
|
-
return () => dom.removeEventListener(
|
|
3921
|
+
dom.addEventListener(container2, "keydown", onKeydown);
|
|
3922
|
+
return () => dom.removeEventListener(container2, "keydown", onKeydown);
|
|
3045
3923
|
}
|
|
3046
3924
|
|
|
3047
3925
|
// ../dom/src/live-region.ts
|
|
@@ -3056,8 +3934,8 @@ function makeRegion(dom, politeness) {
|
|
|
3056
3934
|
return el;
|
|
3057
3935
|
}
|
|
3058
3936
|
function createAnnouncer(dom) {
|
|
3059
|
-
const
|
|
3060
|
-
if (
|
|
3937
|
+
const body2 = dom.body();
|
|
3938
|
+
if (body2 === null) {
|
|
3061
3939
|
return { announce() {
|
|
3062
3940
|
}, clear() {
|
|
3063
3941
|
}, destroy() {
|
|
@@ -3065,8 +3943,8 @@ function createAnnouncer(dom) {
|
|
|
3065
3943
|
}
|
|
3066
3944
|
const polite = makeRegion(dom, "polite");
|
|
3067
3945
|
const assertive = makeRegion(dom, "assertive");
|
|
3068
|
-
dom.appendChild(
|
|
3069
|
-
dom.appendChild(
|
|
3946
|
+
dom.appendChild(body2, polite);
|
|
3947
|
+
dom.appendChild(body2, assertive);
|
|
3070
3948
|
let destroyed = false;
|
|
3071
3949
|
const write = (region, message) => {
|
|
3072
3950
|
dom.setTextContent(region, "");
|
|
@@ -3096,12 +3974,12 @@ function createAnnouncer(dom) {
|
|
|
3096
3974
|
}
|
|
3097
3975
|
|
|
3098
3976
|
// ../renderer/src/render-context.ts
|
|
3099
|
-
function createRenderContext(dom, graph,
|
|
3977
|
+
function createRenderContext(dom, graph, container2, hydrationDiagnostics, staticHTML) {
|
|
3100
3978
|
return {
|
|
3101
3979
|
dom,
|
|
3102
3980
|
graph,
|
|
3103
3981
|
instances: /* @__PURE__ */ new Map(),
|
|
3104
|
-
container,
|
|
3982
|
+
container: container2,
|
|
3105
3983
|
...hydrationDiagnostics !== void 0 ? { hydrationDiagnostics } : {},
|
|
3106
3984
|
...staticHTML !== void 0 ? { staticHTML } : {}
|
|
3107
3985
|
};
|
|
@@ -3199,6 +4077,13 @@ function applyProp(dom, element, name, value) {
|
|
|
3199
4077
|
}
|
|
3200
4078
|
return;
|
|
3201
4079
|
}
|
|
4080
|
+
if (name.startsWith("style.")) {
|
|
4081
|
+
const el = element;
|
|
4082
|
+
const prop = name.slice("style.".length);
|
|
4083
|
+
if (value === null || value === void 0) el.style.removeProperty(prop);
|
|
4084
|
+
else el.style.setProperty(prop, String(value));
|
|
4085
|
+
return;
|
|
4086
|
+
}
|
|
3202
4087
|
if (value === null || value === void 0 || value === false) {
|
|
3203
4088
|
dom.removeAttribute(element, name);
|
|
3204
4089
|
return;
|
|
@@ -3218,8 +4103,8 @@ function wireEvents(dom, graph, node, element, instance) {
|
|
|
3218
4103
|
if (handler === void 0) continue;
|
|
3219
4104
|
const domListener = (domEvent) => {
|
|
3220
4105
|
if (eventDesc.type === "input" || eventDesc.type === "change") {
|
|
3221
|
-
const
|
|
3222
|
-
handler(
|
|
4106
|
+
const input2 = domEvent.target;
|
|
4107
|
+
handler(input2.value);
|
|
3223
4108
|
} else if (eventDesc.type === "submit") {
|
|
3224
4109
|
domEvent.preventDefault();
|
|
3225
4110
|
handler(domEvent);
|
|
@@ -3563,7 +4448,7 @@ function nextFrame(cb) {
|
|
|
3563
4448
|
function splitClass(value) {
|
|
3564
4449
|
if (value === null) return [];
|
|
3565
4450
|
const out = [];
|
|
3566
|
-
for (const
|
|
4451
|
+
for (const t6 of value.split(/\s+/)) if (t6.length > 0) out.push(t6);
|
|
3567
4452
|
return out;
|
|
3568
4453
|
}
|
|
3569
4454
|
function addClasses(dom, el, classes2) {
|
|
@@ -3945,9 +4830,9 @@ function mountNode(ctx, graphNode, parentDom) {
|
|
|
3945
4830
|
return instance2;
|
|
3946
4831
|
}
|
|
3947
4832
|
if (graphNode.type === "text") {
|
|
3948
|
-
const
|
|
4833
|
+
const text2 = String(graphNode.getProp("text") ?? "");
|
|
3949
4834
|
const el2 = dom.createElement("span");
|
|
3950
|
-
const textNode = dom.createTextNode(
|
|
4835
|
+
const textNode = dom.createTextNode(text2);
|
|
3951
4836
|
dom.appendChild(el2, textNode);
|
|
3952
4837
|
applyNodeProps(ctx, graphNode, el2);
|
|
3953
4838
|
const instance2 = new NodeInstance(graphNode, el2);
|
|
@@ -3963,8 +4848,8 @@ function mountNode(ctx, graphNode, parentDom) {
|
|
|
3963
4848
|
const level = graphNode.getProp("level") ?? 1;
|
|
3964
4849
|
const tag2 = `h${level}`;
|
|
3965
4850
|
const el2 = dom.createElement(tag2);
|
|
3966
|
-
const
|
|
3967
|
-
dom.setTextContent(el2,
|
|
4851
|
+
const text2 = String(graphNode.getProp("text") ?? "");
|
|
4852
|
+
dom.setTextContent(el2, text2);
|
|
3968
4853
|
applyNodeProps(ctx, graphNode, el2);
|
|
3969
4854
|
const instance2 = new NodeInstance(graphNode, el2);
|
|
3970
4855
|
ctx.instances.set(graphNode.id, instance2);
|
|
@@ -4011,28 +4896,28 @@ function mountNode(ctx, graphNode, parentDom) {
|
|
|
4011
4896
|
}
|
|
4012
4897
|
if (graphNode.type === "code") {
|
|
4013
4898
|
const source = String(graphNode.getProp("text") ?? "");
|
|
4014
|
-
const
|
|
4899
|
+
const pre2 = dom.createElement("pre");
|
|
4015
4900
|
const codeEl = dom.createElement("code");
|
|
4016
4901
|
const textNode = dom.createTextNode(source);
|
|
4017
4902
|
dom.appendChild(codeEl, textNode);
|
|
4018
|
-
dom.appendChild(
|
|
4019
|
-
applyNodeProps(ctx, graphNode,
|
|
4020
|
-
const instance2 = new NodeInstance(graphNode,
|
|
4903
|
+
dom.appendChild(pre2, codeEl);
|
|
4904
|
+
applyNodeProps(ctx, graphNode, pre2);
|
|
4905
|
+
const instance2 = new NodeInstance(graphNode, pre2);
|
|
4021
4906
|
ctx.instances.set(graphNode.id, instance2);
|
|
4022
|
-
wireEvents(dom, graph, graphNode,
|
|
4907
|
+
wireEvents(dom, graph, graphNode, pre2, instance2);
|
|
4023
4908
|
if (graphNode.stateRefs.length !== 0) {
|
|
4024
|
-
wireSignalBindings(ctx, graphNode, instance2, textUpdate(dom,
|
|
4909
|
+
wireSignalBindings(ctx, graphNode, instance2, textUpdate(dom, pre2, textNode));
|
|
4025
4910
|
}
|
|
4026
|
-
dom.appendChild(parentDom,
|
|
4911
|
+
dom.appendChild(parentDom, pre2);
|
|
4027
4912
|
return instance2;
|
|
4028
4913
|
}
|
|
4029
4914
|
if (graphNode.type === "link") {
|
|
4030
4915
|
const el2 = dom.createElement("a");
|
|
4031
4916
|
const href = graphNode.getProp("href");
|
|
4032
|
-
const
|
|
4917
|
+
const label2 = graphNode.getProp("label");
|
|
4033
4918
|
const external = graphNode.getProp("external");
|
|
4034
4919
|
if (href !== void 0) dom.setAttribute(el2, "href", String(href));
|
|
4035
|
-
if (
|
|
4920
|
+
if (label2 !== void 0) dom.setTextContent(el2, String(label2));
|
|
4036
4921
|
if (external === true) {
|
|
4037
4922
|
dom.setAttribute(el2, "target", "_blank");
|
|
4038
4923
|
dom.setAttribute(el2, "rel", "noopener noreferrer");
|
|
@@ -4049,8 +4934,8 @@ function mountNode(ctx, graphNode, parentDom) {
|
|
|
4049
4934
|
}
|
|
4050
4935
|
if (graphNode.type === "button") {
|
|
4051
4936
|
const el2 = dom.createElement("button");
|
|
4052
|
-
const
|
|
4053
|
-
if (
|
|
4937
|
+
const label2 = graphNode.getProp("label");
|
|
4938
|
+
if (label2 !== void 0) dom.setTextContent(el2, String(label2));
|
|
4054
4939
|
const disabled = graphNode.getProp("disabled");
|
|
4055
4940
|
if (disabled === true) dom.setAttribute(el2, "disabled", "");
|
|
4056
4941
|
applyNodeProps(ctx, graphNode, el2);
|
|
@@ -4083,13 +4968,13 @@ function mountNode(ctx, graphNode, parentDom) {
|
|
|
4083
4968
|
applyNodeProps(ctx, graphNode, anchor);
|
|
4084
4969
|
const instance2 = new NodeInstance(graphNode, anchor);
|
|
4085
4970
|
ctx.instances.set(graphNode.id, instance2);
|
|
4086
|
-
const
|
|
4971
|
+
const body2 = dom.body();
|
|
4087
4972
|
let target = anchor;
|
|
4088
|
-
if (
|
|
4973
|
+
if (body2 !== null) {
|
|
4089
4974
|
const portalContainer = dom.createElement("div");
|
|
4090
4975
|
dom.setAttribute(portalContainer, "data-streetui-portal-container", "");
|
|
4091
|
-
dom.appendChild(
|
|
4092
|
-
instance2.trackCleanup(() => dom.removeChild(
|
|
4976
|
+
dom.appendChild(body2, portalContainer);
|
|
4977
|
+
instance2.trackCleanup(() => dom.removeChild(body2, portalContainer));
|
|
4093
4978
|
target = portalContainer;
|
|
4094
4979
|
}
|
|
4095
4980
|
for (const child of graphNode.children) {
|
|
@@ -4328,6 +5213,173 @@ function wireComponentBehavior(ctx, graphNode, instance) {
|
|
|
4328
5213
|
for (const cleanup of fn()) instance.trackCleanup(cleanup);
|
|
4329
5214
|
}
|
|
4330
5215
|
|
|
5216
|
+
// ../renderer/src/styling-transitions.ts
|
|
5217
|
+
var DURATION_MS = { fast: 120, base: 200, slow: 320 };
|
|
5218
|
+
function activeClass(props, duration, easing) {
|
|
5219
|
+
return style({ transition: transition(props, { duration, easing }) });
|
|
5220
|
+
}
|
|
5221
|
+
function fadeTransition(opts = {}) {
|
|
5222
|
+
const duration = opts.duration ?? "base";
|
|
5223
|
+
const easing = opts.easing ?? "standard";
|
|
5224
|
+
const active = activeClass(["opacity"], duration, easing);
|
|
5225
|
+
const hidden = style({ opacity: 0 });
|
|
5226
|
+
const shown = style({ opacity: 1 });
|
|
5227
|
+
return {
|
|
5228
|
+
enterActive: [active],
|
|
5229
|
+
enterFrom: [hidden],
|
|
5230
|
+
enterTo: [shown],
|
|
5231
|
+
leaveActive: [active],
|
|
5232
|
+
leaveFrom: [shown],
|
|
5233
|
+
leaveTo: [hidden],
|
|
5234
|
+
appear: opts.appear ?? false,
|
|
5235
|
+
duration: DURATION_MS[duration]
|
|
5236
|
+
};
|
|
5237
|
+
}
|
|
5238
|
+
function scaleTransition(opts = {}) {
|
|
5239
|
+
const duration = opts.duration ?? "base";
|
|
5240
|
+
const easing = opts.easing ?? "emphasized";
|
|
5241
|
+
const active = activeClass(["opacity", "transform"], duration, easing);
|
|
5242
|
+
const hidden = style({ opacity: 0, transform: "scale(.96)" });
|
|
5243
|
+
const shown = style({ opacity: 1, transform: "scale(1)" });
|
|
5244
|
+
return {
|
|
5245
|
+
enterActive: [active],
|
|
5246
|
+
enterFrom: [hidden],
|
|
5247
|
+
enterTo: [shown],
|
|
5248
|
+
leaveActive: [active],
|
|
5249
|
+
leaveFrom: [shown],
|
|
5250
|
+
leaveTo: [hidden],
|
|
5251
|
+
appear: opts.appear ?? false,
|
|
5252
|
+
duration: DURATION_MS[duration]
|
|
5253
|
+
};
|
|
5254
|
+
}
|
|
5255
|
+
function slideTransition(opts = {}) {
|
|
5256
|
+
const duration = opts.duration ?? "base";
|
|
5257
|
+
const easing = opts.easing ?? "standard";
|
|
5258
|
+
const active = activeClass(["opacity", "transform"], duration, easing);
|
|
5259
|
+
const hidden = style({ opacity: 0, transform: "translateY(8px)" });
|
|
5260
|
+
const shown = style({ opacity: 1, transform: "translateY(0)" });
|
|
5261
|
+
return {
|
|
5262
|
+
enterActive: [active],
|
|
5263
|
+
enterFrom: [hidden],
|
|
5264
|
+
enterTo: [shown],
|
|
5265
|
+
leaveActive: [active],
|
|
5266
|
+
leaveFrom: [shown],
|
|
5267
|
+
leaveTo: [hidden],
|
|
5268
|
+
appear: opts.appear ?? false,
|
|
5269
|
+
duration: DURATION_MS[duration]
|
|
5270
|
+
};
|
|
5271
|
+
}
|
|
5272
|
+
var transitions = { fadeTransition, scaleTransition, slideTransition };
|
|
5273
|
+
|
|
5274
|
+
// ../renderer/src/styles.ts
|
|
5275
|
+
var CSS_MARKER = "data-streetui-css";
|
|
5276
|
+
var CSS_KEYS = "data-streetui-css-keys";
|
|
5277
|
+
function renderStyles(options = {}) {
|
|
5278
|
+
const registry = options.registry ?? styleRegistry;
|
|
5279
|
+
const css = registry.serializeCSS();
|
|
5280
|
+
if (css.length === 0) return "";
|
|
5281
|
+
const keys = registry.identities().join(" ");
|
|
5282
|
+
return `<style ${CSS_MARKER} ${CSS_KEYS}="${keys}">${css}</style>`;
|
|
5283
|
+
}
|
|
5284
|
+
function adoptServerStyles(dom, root, options = {}) {
|
|
5285
|
+
const registry = options.registry ?? styleRegistry;
|
|
5286
|
+
const el = findStyleBlock(dom, root);
|
|
5287
|
+
if (el === null) return 0;
|
|
5288
|
+
const keysAttr = dom.getAttribute(el, CSS_KEYS);
|
|
5289
|
+
if (keysAttr === null || keysAttr.length === 0) {
|
|
5290
|
+
registry.adoptServerIdentities([]);
|
|
5291
|
+
return 0;
|
|
5292
|
+
}
|
|
5293
|
+
const ids = keysAttr.split(" ").filter((s) => s.length > 0);
|
|
5294
|
+
registry.adoptServerIdentities(ids);
|
|
5295
|
+
return ids.length;
|
|
5296
|
+
}
|
|
5297
|
+
function findStyleBlock(dom, root) {
|
|
5298
|
+
const head = dom.head();
|
|
5299
|
+
const scope = root ?? head;
|
|
5300
|
+
if (scope === null) return null;
|
|
5301
|
+
return searchDescendants(dom, scope);
|
|
5302
|
+
}
|
|
5303
|
+
function searchDescendants(dom, el) {
|
|
5304
|
+
if (dom.isElement(el) && dom.getAttribute(el, CSS_MARKER) !== null) return el;
|
|
5305
|
+
for (const child of dom.childNodes(el)) {
|
|
5306
|
+
if (!dom.isElement(child)) continue;
|
|
5307
|
+
const found = searchDescendants(dom, child);
|
|
5308
|
+
if (found !== null) return found;
|
|
5309
|
+
}
|
|
5310
|
+
return null;
|
|
5311
|
+
}
|
|
5312
|
+
|
|
5313
|
+
// ../renderer/src/theme.ts
|
|
5314
|
+
var DEFAULT_STORAGE_KEY = "streetui-theme";
|
|
5315
|
+
var CHOICES = ["light", "dark", "system"];
|
|
5316
|
+
function defaultThemeStorage(key = DEFAULT_STORAGE_KEY) {
|
|
5317
|
+
try {
|
|
5318
|
+
if (typeof localStorage !== "undefined") {
|
|
5319
|
+
return {
|
|
5320
|
+
read() {
|
|
5321
|
+
const v = localStorage.getItem(key);
|
|
5322
|
+
return v === "light" || v === "dark" || v === "system" ? v : null;
|
|
5323
|
+
},
|
|
5324
|
+
write(choice) {
|
|
5325
|
+
try {
|
|
5326
|
+
localStorage.setItem(key, choice);
|
|
5327
|
+
} catch {
|
|
5328
|
+
}
|
|
5329
|
+
}
|
|
5330
|
+
};
|
|
5331
|
+
}
|
|
5332
|
+
} catch {
|
|
5333
|
+
}
|
|
5334
|
+
let mem = null;
|
|
5335
|
+
return { read: () => mem, write: (c) => {
|
|
5336
|
+
mem = c;
|
|
5337
|
+
} };
|
|
5338
|
+
}
|
|
5339
|
+
function systemPrefersDark() {
|
|
5340
|
+
try {
|
|
5341
|
+
return typeof matchMedia !== "undefined" && matchMedia("(prefers-color-scheme: dark)").matches;
|
|
5342
|
+
} catch {
|
|
5343
|
+
return false;
|
|
5344
|
+
}
|
|
5345
|
+
}
|
|
5346
|
+
function createTheme(options = {}) {
|
|
5347
|
+
const storage = options.storage ?? defaultThemeStorage();
|
|
5348
|
+
const choice = signal(storage.read() ?? options.initial ?? "system");
|
|
5349
|
+
const resolved = derived(() => {
|
|
5350
|
+
const c = choice.get();
|
|
5351
|
+
if (c === "system") return systemPrefersDark() ? "dark" : "light";
|
|
5352
|
+
return c;
|
|
5353
|
+
});
|
|
5354
|
+
const label2 = derived(() => {
|
|
5355
|
+
const c = choice.get();
|
|
5356
|
+
return c === "light" ? "Theme: Light" : c === "dark" ? "Theme: Dark" : "Theme: System";
|
|
5357
|
+
});
|
|
5358
|
+
const root = options.root ?? (typeof document !== "undefined" ? document.documentElement : null);
|
|
5359
|
+
const stop = root !== null ? effect(() => {
|
|
5360
|
+
root.setAttribute("data-theme", resolved.get());
|
|
5361
|
+
}) : () => {
|
|
5362
|
+
};
|
|
5363
|
+
return {
|
|
5364
|
+
choice,
|
|
5365
|
+
resolved,
|
|
5366
|
+
label: label2,
|
|
5367
|
+
set(next) {
|
|
5368
|
+
choice.set(next);
|
|
5369
|
+
storage.write(next);
|
|
5370
|
+
},
|
|
5371
|
+
cycle() {
|
|
5372
|
+
const i = CHOICES.indexOf(choice.get());
|
|
5373
|
+
const next = CHOICES[(i + 1) % CHOICES.length];
|
|
5374
|
+
choice.set(next);
|
|
5375
|
+
storage.write(next);
|
|
5376
|
+
},
|
|
5377
|
+
dispose() {
|
|
5378
|
+
stop();
|
|
5379
|
+
}
|
|
5380
|
+
};
|
|
5381
|
+
}
|
|
5382
|
+
|
|
4331
5383
|
// ../renderer/src/hydration-diagnostics.ts
|
|
4332
5384
|
function formatHydrationDiagnostic(d) {
|
|
4333
5385
|
const at = ` at ${d.path}`;
|
|
@@ -4458,16 +5510,16 @@ function hydrateNode(ctx, graphNode, domNode, path) {
|
|
|
4458
5510
|
case "portal": {
|
|
4459
5511
|
const instance = new NodeInstance(graphNode, domNode);
|
|
4460
5512
|
ctx.instances.set(graphNode.id, instance);
|
|
4461
|
-
const
|
|
5513
|
+
const body2 = dom.body();
|
|
4462
5514
|
let target = domNode;
|
|
4463
|
-
if (
|
|
5515
|
+
if (body2 !== null) {
|
|
4464
5516
|
const portalContainer = dom.createElement("div");
|
|
4465
5517
|
dom.setAttribute(portalContainer, "data-streetui-portal-container", "");
|
|
4466
5518
|
for (const child of dom.childNodes(domNode)) {
|
|
4467
5519
|
dom.appendChild(portalContainer, child);
|
|
4468
5520
|
}
|
|
4469
|
-
dom.appendChild(
|
|
4470
|
-
instance.trackCleanup(() => dom.removeChild(
|
|
5521
|
+
dom.appendChild(body2, portalContainer);
|
|
5522
|
+
instance.trackCleanup(() => dom.removeChild(body2, portalContainer));
|
|
4471
5523
|
target = portalContainer;
|
|
4472
5524
|
}
|
|
4473
5525
|
hydrateChildren(ctx, graphNode, instance, target, path);
|
|
@@ -4612,9 +5664,9 @@ var StreetRenderHandle = class {
|
|
|
4612
5664
|
this._disposed = true;
|
|
4613
5665
|
this._rootInstance.dispose();
|
|
4614
5666
|
const dom = this._ctx.dom;
|
|
4615
|
-
const
|
|
4616
|
-
for (const child of dom.childNodes(
|
|
4617
|
-
dom.removeChild(
|
|
5667
|
+
const container2 = this._ctx.container;
|
|
5668
|
+
for (const child of dom.childNodes(container2)) {
|
|
5669
|
+
dom.removeChild(container2, child);
|
|
4618
5670
|
}
|
|
4619
5671
|
this._ctx.instances.clear();
|
|
4620
5672
|
}
|
|
@@ -4630,8 +5682,8 @@ var StreetRendererImpl = class {
|
|
|
4630
5682
|
this._hydrationDiagnostics = options.hydrationDiagnostics;
|
|
4631
5683
|
}
|
|
4632
5684
|
}
|
|
4633
|
-
mount(compiled,
|
|
4634
|
-
const ctx = createRenderContext(this._dom, compiled.graph,
|
|
5685
|
+
mount(compiled, container2) {
|
|
5686
|
+
const ctx = createRenderContext(this._dom, compiled.graph, container2);
|
|
4635
5687
|
const rootInstance = mountGraph(ctx);
|
|
4636
5688
|
this._wireSignals(ctx, rootInstance);
|
|
4637
5689
|
return new StreetRenderHandle(ctx, rootInstance);
|
|
@@ -4643,11 +5695,11 @@ var StreetRendererImpl = class {
|
|
|
4643
5695
|
* behavior (events + signal subscriptions). Mismatched subtrees are locally
|
|
4644
5696
|
* replaced. Returns the same handle type as `mount`.
|
|
4645
5697
|
*/
|
|
4646
|
-
hydrate(compiled,
|
|
5698
|
+
hydrate(compiled, container2) {
|
|
4647
5699
|
const ctx = createRenderContext(
|
|
4648
5700
|
this._dom,
|
|
4649
5701
|
compiled.graph,
|
|
4650
|
-
|
|
5702
|
+
container2,
|
|
4651
5703
|
this._hydrationDiagnostics
|
|
4652
5704
|
);
|
|
4653
5705
|
const rootInstance = hydrateGraph(ctx);
|
|
@@ -4666,12 +5718,12 @@ var STATE_MARKER_ATTR = "data-streetui-state";
|
|
|
4666
5718
|
function escapeForScript(json) {
|
|
4667
5719
|
let out = "";
|
|
4668
5720
|
for (const ch of json) {
|
|
4669
|
-
const
|
|
5721
|
+
const code2 = ch.charCodeAt(0);
|
|
4670
5722
|
if (ch === "<") out += "\\u003c";
|
|
4671
5723
|
else if (ch === ">") out += "\\u003e";
|
|
4672
5724
|
else if (ch === "&") out += "\\u0026";
|
|
4673
|
-
else if (
|
|
4674
|
-
else if (
|
|
5725
|
+
else if (code2 === 8232) out += "\\u2028";
|
|
5726
|
+
else if (code2 === 8233) out += "\\u2029";
|
|
4675
5727
|
else out += ch;
|
|
4676
5728
|
}
|
|
4677
5729
|
return out;
|
|
@@ -4684,10 +5736,10 @@ function serializeState(state) {
|
|
|
4684
5736
|
function readState(dom, root) {
|
|
4685
5737
|
const el = dom.querySelector(root, `script[${STATE_MARKER_ATTR}]`);
|
|
4686
5738
|
if (el === null) return {};
|
|
4687
|
-
const
|
|
4688
|
-
if (
|
|
5739
|
+
const text2 = dom.getTextContent(el);
|
|
5740
|
+
if (text2 === null || text2.length === 0) return {};
|
|
4689
5741
|
try {
|
|
4690
|
-
const parsed = JSON.parse(
|
|
5742
|
+
const parsed = JSON.parse(text2);
|
|
4691
5743
|
if (parsed !== null && typeof parsed === "object") {
|
|
4692
5744
|
return parsed;
|
|
4693
5745
|
}
|
|
@@ -4772,10 +5824,10 @@ function collectMaximalStaticRoots(graph) {
|
|
|
4772
5824
|
return roots;
|
|
4773
5825
|
}
|
|
4774
5826
|
function serializeStaticSubtree(dom, graph, root) {
|
|
4775
|
-
const
|
|
4776
|
-
const ctx = createRenderContext(dom, graph,
|
|
4777
|
-
const instance = mountNode(ctx, root,
|
|
4778
|
-
const html = dom.serializeInner(
|
|
5827
|
+
const container2 = dom.createElement("div");
|
|
5828
|
+
const ctx = createRenderContext(dom, graph, container2);
|
|
5829
|
+
const instance = mountNode(ctx, root, container2);
|
|
5830
|
+
const html = dom.serializeInner(container2);
|
|
4779
5831
|
instance.dispose();
|
|
4780
5832
|
ctx.instances.clear();
|
|
4781
5833
|
return html;
|
|
@@ -4806,10 +5858,10 @@ function renderToString(compiled, options = {}) {
|
|
|
4806
5858
|
const dom = options.domAdapter ?? new ServerDOMAdapter();
|
|
4807
5859
|
const plan = options.staticPlan === null ? void 0 : options.staticPlan ?? getStaticSSRPlan(compiled);
|
|
4808
5860
|
const staticHTML = plan !== void 0 && plan.size > 0 ? plan : void 0;
|
|
4809
|
-
const
|
|
4810
|
-
const ctx = createRenderContext(dom, compiled.graph,
|
|
5861
|
+
const container2 = dom.createElement("div");
|
|
5862
|
+
const ctx = createRenderContext(dom, compiled.graph, container2, void 0, staticHTML);
|
|
4811
5863
|
const rootInstance = mountGraph(ctx);
|
|
4812
|
-
const html = dom.serializeInner(
|
|
5864
|
+
const html = dom.serializeInner(container2);
|
|
4813
5865
|
rootInstance.dispose();
|
|
4814
5866
|
ctx.instances.clear();
|
|
4815
5867
|
return html;
|
|
@@ -4924,20 +5976,20 @@ function createMemoryHistory(initial = "/") {
|
|
|
4924
5976
|
if (qIndex < 0) return buildLocation(entry, "");
|
|
4925
5977
|
return buildLocation(entry.slice(0, qIndex), entry.slice(qIndex + 1));
|
|
4926
5978
|
};
|
|
4927
|
-
const
|
|
5979
|
+
const stack2 = [initial];
|
|
4928
5980
|
let index = 0;
|
|
4929
5981
|
return {
|
|
4930
5982
|
location() {
|
|
4931
|
-
return parse(
|
|
5983
|
+
return parse(stack2[index]);
|
|
4932
5984
|
},
|
|
4933
5985
|
push(pathname, search) {
|
|
4934
|
-
|
|
4935
|
-
|
|
4936
|
-
index =
|
|
5986
|
+
stack2.splice(index + 1);
|
|
5987
|
+
stack2.push(toUrl(pathname, search));
|
|
5988
|
+
index = stack2.length - 1;
|
|
4937
5989
|
notify();
|
|
4938
5990
|
},
|
|
4939
5991
|
replace(pathname, search) {
|
|
4940
|
-
|
|
5992
|
+
stack2[index] = toUrl(pathname, search);
|
|
4941
5993
|
notify();
|
|
4942
5994
|
},
|
|
4943
5995
|
back() {
|
|
@@ -4947,7 +5999,7 @@ function createMemoryHistory(initial = "/") {
|
|
|
4947
5999
|
}
|
|
4948
6000
|
},
|
|
4949
6001
|
forward() {
|
|
4950
|
-
if (index <
|
|
6002
|
+
if (index < stack2.length - 1) {
|
|
4951
6003
|
index++;
|
|
4952
6004
|
notify();
|
|
4953
6005
|
}
|
|
@@ -5047,7 +6099,7 @@ function isExternalHref(href) {
|
|
|
5047
6099
|
href.startsWith("//");
|
|
5048
6100
|
}
|
|
5049
6101
|
function mountRouter(router, options) {
|
|
5050
|
-
const { container } = options;
|
|
6102
|
+
const { container: container2 } = options;
|
|
5051
6103
|
const renderer = options.renderer ?? createRenderer();
|
|
5052
6104
|
const outletId = options.outletId ?? ROUTER_OUTLET_ID;
|
|
5053
6105
|
const interceptLinks = options.interceptLinks ?? true;
|
|
@@ -5065,8 +6117,8 @@ function mountRouter(router, options) {
|
|
|
5065
6117
|
node.setProp("_hydrationBoundary", true);
|
|
5066
6118
|
}
|
|
5067
6119
|
}
|
|
5068
|
-
shellMounted = hydrateMode ? shellRuntime.hydrate(shellCompiled,
|
|
5069
|
-
const found =
|
|
6120
|
+
shellMounted = hydrateMode ? shellRuntime.hydrate(shellCompiled, container2) : shellRuntime.mount(shellCompiled, container2);
|
|
6121
|
+
const found = container2.querySelector(`[id="${outletId}"]`);
|
|
5070
6122
|
if (found === null) {
|
|
5071
6123
|
throw new Error(
|
|
5072
6124
|
`[Router] The shell must contain a route outlet. Call routerOutlet(scope) (or add a container with id="${outletId}") inside your shell builder.`
|
|
@@ -5074,7 +6126,7 @@ function mountRouter(router, options) {
|
|
|
5074
6126
|
}
|
|
5075
6127
|
outlet = found;
|
|
5076
6128
|
} else {
|
|
5077
|
-
outlet =
|
|
6129
|
+
outlet = container2;
|
|
5078
6130
|
}
|
|
5079
6131
|
const routeTransition = options.transition !== void 0 ? resolveTransition(options.transition) : void 0;
|
|
5080
6132
|
const txDom = routeTransition !== void 0 ? new BrowserDOMAdapter() : void 0;
|
|
@@ -5187,12 +6239,12 @@ function mountRouter(router, options) {
|
|
|
5187
6239
|
router.navigate(href);
|
|
5188
6240
|
};
|
|
5189
6241
|
if (interceptLinks) {
|
|
5190
|
-
|
|
6242
|
+
container2.addEventListener("click", onClick);
|
|
5191
6243
|
}
|
|
5192
6244
|
return {
|
|
5193
6245
|
outlet,
|
|
5194
6246
|
unmount() {
|
|
5195
|
-
if (interceptLinks)
|
|
6247
|
+
if (interceptLinks) container2.removeEventListener("click", onClick);
|
|
5196
6248
|
stopRouteSub();
|
|
5197
6249
|
for (const [route, run] of pendingLeaves) {
|
|
5198
6250
|
run.cancel();
|
|
@@ -5225,8 +6277,8 @@ function pattern(regex, message = "Invalid format") {
|
|
|
5225
6277
|
}
|
|
5226
6278
|
function runValidators(value, validators) {
|
|
5227
6279
|
if (validators === void 0) return void 0;
|
|
5228
|
-
const
|
|
5229
|
-
for (const validate of
|
|
6280
|
+
const list2 = Array.isArray(validators) ? validators : [validators];
|
|
6281
|
+
for (const validate of list2) {
|
|
5230
6282
|
const error = validate(value);
|
|
5231
6283
|
if (error !== void 0) return error;
|
|
5232
6284
|
}
|
|
@@ -5278,31 +6330,31 @@ function createForm(config) {
|
|
|
5278
6330
|
};
|
|
5279
6331
|
fields.set(name, { api, value, touched, error, valid: valid2, dirty: dirty2, initial, unsub });
|
|
5280
6332
|
}
|
|
5281
|
-
const
|
|
6333
|
+
const field2 = (name) => {
|
|
5282
6334
|
const f = fields.get(name);
|
|
5283
6335
|
if (f === void 0) throw new Error(`Unknown form field: ${name}`);
|
|
5284
6336
|
return f;
|
|
5285
6337
|
};
|
|
5286
6338
|
const values = derived(() => {
|
|
5287
6339
|
const out = {};
|
|
5288
|
-
for (const name of names) out[name] =
|
|
6340
|
+
for (const name of names) out[name] = field2(name).value.get();
|
|
5289
6341
|
return out;
|
|
5290
6342
|
});
|
|
5291
6343
|
const errors = derived(() => {
|
|
5292
6344
|
const out = {};
|
|
5293
6345
|
for (const name of names) {
|
|
5294
|
-
const e =
|
|
6346
|
+
const e = field2(name).error.get();
|
|
5295
6347
|
if (e !== void 0) out[name] = e;
|
|
5296
6348
|
}
|
|
5297
6349
|
return out;
|
|
5298
6350
|
});
|
|
5299
6351
|
const touchedMap = derived(() => {
|
|
5300
6352
|
const out = {};
|
|
5301
|
-
for (const name of names) out[name] =
|
|
6353
|
+
for (const name of names) out[name] = field2(name).touched.get();
|
|
5302
6354
|
return out;
|
|
5303
6355
|
});
|
|
5304
|
-
const dirty = derived(() => names.some((n) =>
|
|
5305
|
-
const valid = derived(() => names.every((n) =>
|
|
6356
|
+
const dirty = derived(() => names.some((n) => field2(n).dirty.get()));
|
|
6357
|
+
const valid = derived(() => names.every((n) => field2(n).valid.get()));
|
|
5306
6358
|
const status = signal("idle");
|
|
5307
6359
|
const submitting = derived(() => status.get() === "submitting");
|
|
5308
6360
|
const submitted = derived(() => status.get() === "success");
|
|
@@ -5313,7 +6365,7 @@ function createForm(config) {
|
|
|
5313
6365
|
batch(() => {
|
|
5314
6366
|
for (const name of names) {
|
|
5315
6367
|
const next = partial[name];
|
|
5316
|
-
if (next !== void 0)
|
|
6368
|
+
if (next !== void 0) field2(name).value.set(next);
|
|
5317
6369
|
}
|
|
5318
6370
|
});
|
|
5319
6371
|
} finally {
|
|
@@ -5325,7 +6377,7 @@ function createForm(config) {
|
|
|
5325
6377
|
try {
|
|
5326
6378
|
batch(() => {
|
|
5327
6379
|
for (const name of names) {
|
|
5328
|
-
const f =
|
|
6380
|
+
const f = field2(name);
|
|
5329
6381
|
f.value.set(f.initial);
|
|
5330
6382
|
f.touched.set(false);
|
|
5331
6383
|
}
|
|
@@ -5338,7 +6390,7 @@ function createForm(config) {
|
|
|
5338
6390
|
}
|
|
5339
6391
|
async function submit() {
|
|
5340
6392
|
batch(() => {
|
|
5341
|
-
for (const name of names)
|
|
6393
|
+
for (const name of names) field2(name).touched.set(true);
|
|
5342
6394
|
});
|
|
5343
6395
|
if (!valid.peek()) {
|
|
5344
6396
|
return;
|
|
@@ -5378,7 +6430,7 @@ function createForm(config) {
|
|
|
5378
6430
|
submitted,
|
|
5379
6431
|
status,
|
|
5380
6432
|
submitError,
|
|
5381
|
-
field: (name) =>
|
|
6433
|
+
field: (name) => field2(name).api,
|
|
5382
6434
|
setValues,
|
|
5383
6435
|
submit,
|
|
5384
6436
|
reset,
|
|
@@ -5389,23 +6441,23 @@ function createForm(config) {
|
|
|
5389
6441
|
// ../context/src/context.ts
|
|
5390
6442
|
function createContext(defaultValue, description) {
|
|
5391
6443
|
const id = Symbol(description ?? "streetui.context");
|
|
5392
|
-
const
|
|
6444
|
+
const stack2 = [];
|
|
5393
6445
|
return {
|
|
5394
6446
|
id,
|
|
5395
6447
|
defaultValue,
|
|
5396
6448
|
provide(value, run) {
|
|
5397
|
-
|
|
6449
|
+
stack2.push(value);
|
|
5398
6450
|
try {
|
|
5399
6451
|
return run();
|
|
5400
6452
|
} finally {
|
|
5401
|
-
|
|
6453
|
+
stack2.pop();
|
|
5402
6454
|
}
|
|
5403
6455
|
},
|
|
5404
6456
|
consume() {
|
|
5405
|
-
return
|
|
6457
|
+
return stack2.length > 0 ? stack2[stack2.length - 1] : defaultValue;
|
|
5406
6458
|
},
|
|
5407
6459
|
hasProvider() {
|
|
5408
|
-
return
|
|
6460
|
+
return stack2.length > 0;
|
|
5409
6461
|
}
|
|
5410
6462
|
};
|
|
5411
6463
|
}
|
|
@@ -5525,7 +6577,7 @@ function inspectComponents(graph) {
|
|
|
5525
6577
|
}
|
|
5526
6578
|
function inspectInteractions(graph) {
|
|
5527
6579
|
const overlays = [];
|
|
5528
|
-
const
|
|
6580
|
+
const transitions2 = [];
|
|
5529
6581
|
graph.walk((node, depth) => {
|
|
5530
6582
|
const overlayFn = graph.getHandler(`__overlay__${node.id}`);
|
|
5531
6583
|
if (overlayFn !== void 0) {
|
|
@@ -5544,18 +6596,18 @@ function inspectInteractions(graph) {
|
|
|
5544
6596
|
}
|
|
5545
6597
|
const transitionFn = graph.getHandler(`__transition__${node.id}`);
|
|
5546
6598
|
if (transitionFn !== void 0) {
|
|
5547
|
-
const
|
|
5548
|
-
|
|
6599
|
+
const t6 = transitionFn();
|
|
6600
|
+
transitions2.push({
|
|
5549
6601
|
id: node.id,
|
|
5550
6602
|
key: node.key,
|
|
5551
6603
|
nodeType: node.type,
|
|
5552
|
-
duration:
|
|
5553
|
-
appear:
|
|
6604
|
+
duration: t6.duration,
|
|
6605
|
+
appear: t6.appear,
|
|
5554
6606
|
depth
|
|
5555
6607
|
});
|
|
5556
6608
|
}
|
|
5557
6609
|
});
|
|
5558
|
-
return { overlays, transitions };
|
|
6610
|
+
return { overlays, transitions: transitions2 };
|
|
5559
6611
|
}
|
|
5560
6612
|
|
|
5561
6613
|
// ../devtools/src/application.ts
|
|
@@ -5623,39 +6675,39 @@ var DEFAULT_PERF_THRESHOLDS = {
|
|
|
5623
6675
|
maxSignals: 1e3
|
|
5624
6676
|
};
|
|
5625
6677
|
function diagnosePerformance(compiled, thresholds = {}) {
|
|
5626
|
-
const
|
|
6678
|
+
const t6 = { ...DEFAULT_PERF_THRESHOLDS, ...thresholds };
|
|
5627
6679
|
const { perf } = inspectApplication(compiled);
|
|
5628
6680
|
const out = [];
|
|
5629
|
-
if (perf.totalNodes >
|
|
6681
|
+
if (perf.totalNodes > t6.maxNodes) {
|
|
5630
6682
|
out.push({
|
|
5631
6683
|
code: "large-graph",
|
|
5632
|
-
message: `Graph has ${perf.totalNodes} nodes (> ${
|
|
6684
|
+
message: `Graph has ${perf.totalNodes} nodes (> ${t6.maxNodes}); consider splitting the view or paginating.`,
|
|
5633
6685
|
observed: perf.totalNodes,
|
|
5634
|
-
threshold:
|
|
6686
|
+
threshold: t6.maxNodes
|
|
5635
6687
|
});
|
|
5636
6688
|
}
|
|
5637
|
-
if (perf.maxDepth >
|
|
6689
|
+
if (perf.maxDepth > t6.maxDepth) {
|
|
5638
6690
|
out.push({
|
|
5639
6691
|
code: "deep-tree",
|
|
5640
|
-
message: `Graph nests ${perf.maxDepth} levels deep (> ${
|
|
6692
|
+
message: `Graph nests ${perf.maxDepth} levels deep (> ${t6.maxDepth}); deep trees slow mount and reconciliation.`,
|
|
5641
6693
|
observed: perf.maxDepth,
|
|
5642
|
-
threshold:
|
|
6694
|
+
threshold: t6.maxDepth
|
|
5643
6695
|
});
|
|
5644
6696
|
}
|
|
5645
|
-
if (perf.largestChildCount >
|
|
6697
|
+
if (perf.largestChildCount > t6.maxChildCount) {
|
|
5646
6698
|
out.push({
|
|
5647
6699
|
code: "large-list",
|
|
5648
|
-
message: `A single node has ${perf.largestChildCount} children (> ${
|
|
6700
|
+
message: `A single node has ${perf.largestChildCount} children (> ${t6.maxChildCount}); large un-windowed lists dominate DOM cost.`,
|
|
5649
6701
|
observed: perf.largestChildCount,
|
|
5650
|
-
threshold:
|
|
6702
|
+
threshold: t6.maxChildCount
|
|
5651
6703
|
});
|
|
5652
6704
|
}
|
|
5653
|
-
if (perf.distinctSignals >
|
|
6705
|
+
if (perf.distinctSignals > t6.maxSignals) {
|
|
5654
6706
|
out.push({
|
|
5655
6707
|
code: "high-signal-fanout",
|
|
5656
|
-
message: `${perf.distinctSignals} distinct signals are bound (> ${
|
|
6708
|
+
message: `${perf.distinctSignals} distinct signals are bound (> ${t6.maxSignals}); heavy reactive fan-out increases update overhead.`,
|
|
5657
6709
|
observed: perf.distinctSignals,
|
|
5658
|
-
threshold:
|
|
6710
|
+
threshold: t6.maxSignals
|
|
5659
6711
|
});
|
|
5660
6712
|
}
|
|
5661
6713
|
return out;
|
|
@@ -5728,10 +6780,10 @@ function inspectRouter(router) {
|
|
|
5728
6780
|
isFallback: match.isFallback === true
|
|
5729
6781
|
};
|
|
5730
6782
|
}
|
|
5731
|
-
function inspectForm(
|
|
5732
|
-
const values =
|
|
5733
|
-
const errorsRaw =
|
|
5734
|
-
const touchedRaw =
|
|
6783
|
+
function inspectForm(form2, options = {}) {
|
|
6784
|
+
const values = form2.values.peek();
|
|
6785
|
+
const errorsRaw = form2.errors.peek();
|
|
6786
|
+
const touchedRaw = form2.touched.peek();
|
|
5735
6787
|
const errors = {};
|
|
5736
6788
|
for (const [k, v] of Object.entries(errorsRaw)) if (v !== void 0) errors[k] = v;
|
|
5737
6789
|
const touched = {};
|
|
@@ -5740,9 +6792,9 @@ function inspectForm(form, options = {}) {
|
|
|
5740
6792
|
fields: Object.keys(values),
|
|
5741
6793
|
errors,
|
|
5742
6794
|
touched,
|
|
5743
|
-
dirty:
|
|
5744
|
-
valid:
|
|
5745
|
-
status:
|
|
6795
|
+
dirty: form2.dirty.peek(),
|
|
6796
|
+
valid: form2.valid.peek(),
|
|
6797
|
+
status: form2.status.peek()
|
|
5746
6798
|
};
|
|
5747
6799
|
if (options.includeValues !== true) return base;
|
|
5748
6800
|
return { ...base, values: { ...values } };
|
|
@@ -5771,8 +6823,8 @@ function inspectEvents(graph) {
|
|
|
5771
6823
|
graph.walk((node, depth) => {
|
|
5772
6824
|
if (node.events.length === 0) return;
|
|
5773
6825
|
const types = node.events.map((e) => e.type);
|
|
5774
|
-
for (const
|
|
5775
|
-
byType[
|
|
6826
|
+
for (const t6 of types) {
|
|
6827
|
+
byType[t6] = (byType[t6] ?? 0) + 1;
|
|
5776
6828
|
totalHandlers += 1;
|
|
5777
6829
|
}
|
|
5778
6830
|
nodes.push({
|
|
@@ -5888,8 +6940,8 @@ function capture(compiled, sources, options) {
|
|
|
5888
6940
|
};
|
|
5889
6941
|
const live = {};
|
|
5890
6942
|
if (sources.signals !== void 0) {
|
|
5891
|
-
for (const [
|
|
5892
|
-
live[
|
|
6943
|
+
for (const [label2, sig] of Object.entries(sources.signals)) {
|
|
6944
|
+
live[label2] = inspectSignal(
|
|
5893
6945
|
sig,
|
|
5894
6946
|
options.redactSignals !== void 0 ? { redact: options.redactSignals } : {}
|
|
5895
6947
|
);
|
|
@@ -5941,7 +6993,7 @@ function capture(compiled, sources, options) {
|
|
|
5941
6993
|
}
|
|
5942
6994
|
function mapInspect(source, inspect) {
|
|
5943
6995
|
const out = {};
|
|
5944
|
-
for (const [
|
|
6996
|
+
for (const [label2, value] of Object.entries(source)) out[label2] = inspect(value);
|
|
5945
6997
|
return out;
|
|
5946
6998
|
}
|
|
5947
6999
|
function findNode(node, id) {
|
|
@@ -5963,8 +7015,8 @@ function formatSnapshot(s) {
|
|
|
5963
7015
|
` signals ${app.signalCount} \xB7 handlers ${app.eventHandlers} \xB7 bindings ${app.stateBindings} \xB7 errors ${app.errors} \xB7 warnings ${app.warnings}`
|
|
5964
7016
|
);
|
|
5965
7017
|
lines.push(`Signals: ${s.signals.boundSignalIds.length} bound in graph`);
|
|
5966
|
-
for (const [
|
|
5967
|
-
lines.push(` ${
|
|
7018
|
+
for (const [label2, sig] of Object.entries(s.signals.live)) {
|
|
7019
|
+
lines.push(` ${label2} [${sig.kind}] = ${format(sig.value)} \xB7 observers ${sig.observerCount ?? "?"}`);
|
|
5968
7020
|
}
|
|
5969
7021
|
if (s.components.length > 0) {
|
|
5970
7022
|
lines.push(`Components: ${s.components.length}`);
|
|
@@ -5981,8 +7033,8 @@ function formatSnapshot(s) {
|
|
|
5981
7033
|
}
|
|
5982
7034
|
if (s.transitions.length > 0) {
|
|
5983
7035
|
lines.push(`Transitions: ${s.transitions.length}`);
|
|
5984
|
-
for (const
|
|
5985
|
-
lines.push(` ${
|
|
7036
|
+
for (const t6 of s.transitions) {
|
|
7037
|
+
lines.push(` ${t6.key ?? t6.id} on <${t6.nodeType}> \xB7 ${t6.duration}ms${t6.appear ? " \xB7 appear" : ""}`);
|
|
5986
7038
|
}
|
|
5987
7039
|
}
|
|
5988
7040
|
if (s.router !== void 0) {
|
|
@@ -5990,26 +7042,26 @@ function formatSnapshot(s) {
|
|
|
5990
7042
|
}
|
|
5991
7043
|
if (s.resources !== void 0) {
|
|
5992
7044
|
lines.push("Resources:");
|
|
5993
|
-
for (const [
|
|
5994
|
-
lines.push(` ${
|
|
7045
|
+
for (const [label2, r] of Object.entries(s.resources)) {
|
|
7046
|
+
lines.push(` ${label2}: ${r.status}${r.loading ? " (loading)" : ""}${r.hasError ? ` !${r.errorName}` : ""}`);
|
|
5995
7047
|
}
|
|
5996
7048
|
}
|
|
5997
7049
|
if (s.mutations !== void 0) {
|
|
5998
7050
|
lines.push("Mutations:");
|
|
5999
|
-
for (const [
|
|
6000
|
-
lines.push(` ${
|
|
7051
|
+
for (const [label2, m] of Object.entries(s.mutations)) {
|
|
7052
|
+
lines.push(` ${label2}: ${m.status}${m.pending ? " (pending)" : ""}${m.hasError ? ` !${m.errorName}` : ""}`);
|
|
6001
7053
|
}
|
|
6002
7054
|
}
|
|
6003
7055
|
if (s.forms !== void 0) {
|
|
6004
7056
|
lines.push("Forms:");
|
|
6005
|
-
for (const [
|
|
6006
|
-
lines.push(` ${
|
|
7057
|
+
for (const [label2, f] of Object.entries(s.forms)) {
|
|
7058
|
+
lines.push(` ${label2}: ${f.valid ? "valid" : "invalid"} \xB7 ${f.status} \xB7 fields ${f.fields.length}`);
|
|
6007
7059
|
}
|
|
6008
7060
|
}
|
|
6009
7061
|
if (s.contexts !== void 0) {
|
|
6010
7062
|
lines.push("Contexts:");
|
|
6011
|
-
for (const [
|
|
6012
|
-
lines.push(` ${
|
|
7063
|
+
for (const [label2, c] of Object.entries(s.contexts)) {
|
|
7064
|
+
lines.push(` ${label2} (${c.description}): ${c.hasProvider ? "provided" : "no provider"}`);
|
|
6013
7065
|
}
|
|
6014
7066
|
}
|
|
6015
7067
|
if (s.i18n !== void 0) {
|
|
@@ -6031,7 +7083,7 @@ function formatSnapshot(s) {
|
|
|
6031
7083
|
lines.push(` ${m}`);
|
|
6032
7084
|
}
|
|
6033
7085
|
lines.push(
|
|
6034
|
-
`Events: ${s.events.nodes.length} node(s), ${s.events.totalHandlers} handler(s)` + (Object.keys(s.events.byType).length > 0 ? ` \xB7 ${Object.entries(s.events.byType).map(([
|
|
7086
|
+
`Events: ${s.events.nodes.length} node(s), ${s.events.totalHandlers} handler(s)` + (Object.keys(s.events.byType).length > 0 ? ` \xB7 ${Object.entries(s.events.byType).map(([t6, n]) => `${t6}\xD7${n}`).join(", ")}` : "")
|
|
6035
7087
|
);
|
|
6036
7088
|
lines.push(
|
|
6037
7089
|
`Signal graph: ${s.signalGraph.signals.length} signal(s), ${s.signalGraph.edges.length} binding edge(s)`
|
|
@@ -6072,9 +7124,9 @@ function stringifyValue(value) {
|
|
|
6072
7124
|
}
|
|
6073
7125
|
return String(value);
|
|
6074
7126
|
}
|
|
6075
|
-
function section(title, count,
|
|
7127
|
+
function section(title, count, body2) {
|
|
6076
7128
|
const badge = count === void 0 ? "" : ` <span class="st-count">${count}</span>`;
|
|
6077
|
-
return `<section class="st-panel"><h2>${escapeHtml(title)}${badge}</h2>${
|
|
7129
|
+
return `<section class="st-panel"><h2>${escapeHtml(title)}${badge}</h2>${body2}</section>`;
|
|
6078
7130
|
}
|
|
6079
7131
|
function ul(items) {
|
|
6080
7132
|
if (items.length === 0) return '<p class="st-empty">(none)</p>';
|
|
@@ -6108,7 +7160,7 @@ function renderDevToolsHTML(s) {
|
|
|
6108
7160
|
s.signals.boundSignalIds.length,
|
|
6109
7161
|
`<p class="st-dim">${s.signals.boundSignalIds.length} bound in graph \xB7 effects shown as observer counts (no global effect registry)</p>` + ul(
|
|
6110
7162
|
Object.entries(s.signals.live).map(
|
|
6111
|
-
([
|
|
7163
|
+
([label2, sig]) => `<code>${escapeHtml(label2)}</code> <span class="st-key">[${escapeHtml(sig.kind)}]</span> = <code>${escapeHtml(sig.value)}</code> <span class="st-dim">observers ${escapeHtml(sig.observerCount ?? "?")}</span>`
|
|
6112
7164
|
)
|
|
6113
7165
|
)
|
|
6114
7166
|
)
|
|
@@ -6129,7 +7181,7 @@ function renderDevToolsHTML(s) {
|
|
|
6129
7181
|
Object.keys(s.resources).length,
|
|
6130
7182
|
ul(
|
|
6131
7183
|
Object.entries(s.resources).map(
|
|
6132
|
-
([
|
|
7184
|
+
([label2, r]) => `<code>${escapeHtml(label2)}</code>: ${escapeHtml(r.status)}` + (r.loading ? ' <span class="st-dim">(loading)</span>' : "") + (r.hasError ? ` <span class="st-err">!${escapeHtml(r.errorName)}</span>` : "")
|
|
6133
7185
|
)
|
|
6134
7186
|
)
|
|
6135
7187
|
)
|
|
@@ -6153,7 +7205,7 @@ function renderDevToolsHTML(s) {
|
|
|
6153
7205
|
s.transitions.length,
|
|
6154
7206
|
ul(
|
|
6155
7207
|
s.transitions.map(
|
|
6156
|
-
(
|
|
7208
|
+
(t6) => `<code>${escapeHtml(t6.key ?? t6.id)}</code> on <code><${escapeHtml(t6.nodeType)}></code> <span class="st-dim">${t6.duration}ms${t6.appear ? " \xB7 appear" : ""}</span>`
|
|
6157
7209
|
)
|
|
6158
7210
|
)
|
|
6159
7211
|
)
|
|
@@ -6165,7 +7217,7 @@ function renderDevToolsHTML(s) {
|
|
|
6165
7217
|
Object.keys(s.forms).length,
|
|
6166
7218
|
ul(
|
|
6167
7219
|
Object.entries(s.forms).map(
|
|
6168
|
-
([
|
|
7220
|
+
([label2, f]) => `<code>${escapeHtml(label2)}</code>: ${f.valid ? "valid" : "invalid"} \xB7 ${escapeHtml(f.status)} \xB7 ${f.fields.length} field(s)`
|
|
6169
7221
|
)
|
|
6170
7222
|
)
|
|
6171
7223
|
)
|
|
@@ -6244,8 +7296,8 @@ var DEVTOOLS_TABS = [
|
|
|
6244
7296
|
var EMBED_ESCAPE = new RegExp("[<\\u2028\\u2029]", "g");
|
|
6245
7297
|
function embedJson(snapshot) {
|
|
6246
7298
|
return JSON.stringify(snapshot).replace(EMBED_ESCAPE, (ch) => {
|
|
6247
|
-
const
|
|
6248
|
-
return `\\u${
|
|
7299
|
+
const code2 = ch.charCodeAt(0).toString(16).padStart(4, "0");
|
|
7300
|
+
return `\\u${code2}`;
|
|
6249
7301
|
});
|
|
6250
7302
|
}
|
|
6251
7303
|
function renderInteractiveDevTools(snapshot, options = {}) {
|
|
@@ -6253,7 +7305,7 @@ function renderInteractiveDevTools(snapshot, options = {}) {
|
|
|
6253
7305
|
const title = options.title ?? `StreetUI DevTools \u2014 ${app.identity.name}`;
|
|
6254
7306
|
const initialTab = options.initialTab ?? DEVTOOLS_TABS[0].id;
|
|
6255
7307
|
const tabButtons = DEVTOOLS_TABS.map(
|
|
6256
|
-
(
|
|
7308
|
+
(t6) => `<button type="button" role="tab" class="st-tab" data-tab="${escapeHtml(t6.id)}"${t6.id === initialTab ? ' aria-selected="true"' : ' aria-selected="false"'}>${escapeHtml(t6.label)}</button>`
|
|
6257
7309
|
).join("");
|
|
6258
7310
|
return `<!doctype html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>${escapeHtml(title)}</title><style>${INTERACTIVE_CSS}</style></head><body class="st-dt"><header class="st-top"><h1>${escapeHtml(title)} <span class="st-dim">v${escapeHtml(app.identity.version)}</span></h1><button type="button" id="st-refresh" class="st-refresh">↻ Refresh</button></header><nav class="st-tabs" role="tablist" aria-label="DevTools panels">${tabButtons}</nav><main id="st-panel" class="st-body" role="tabpanel" aria-live="polite"></main><footer class="st-foot"><span class="st-dim">Structural inspection over one compiled graph. Not a production profiler; browser/AT conformance not claimed (gates BLOCKED).</span></footer><script type="application/json" id="st-data">${embedJson(snapshot)}</script><script>${CONTROLLER_JS.replace("__INITIAL_TAB__", JSON.stringify(initialTab))}</script></body></html>`;
|
|
6259
7311
|
}
|
|
@@ -6441,11 +7493,13 @@ export {
|
|
|
6441
7493
|
AppBuilder,
|
|
6442
7494
|
Application,
|
|
6443
7495
|
ApplicationGraph,
|
|
7496
|
+
BREAKPOINTS,
|
|
6444
7497
|
BaseNode,
|
|
6445
7498
|
BrowserDOMAdapter,
|
|
6446
7499
|
CleanupRegistry,
|
|
6447
7500
|
ContainerBuilderImpl,
|
|
6448
7501
|
DEFAULT_PERF_THRESHOLDS,
|
|
7502
|
+
DEFAULT_TOKENS,
|
|
6449
7503
|
DEVTOOLS_TABS,
|
|
6450
7504
|
DerivedSignal,
|
|
6451
7505
|
DiagnosticCollector,
|
|
@@ -6482,21 +7536,35 @@ export {
|
|
|
6482
7536
|
StreetFrameworkError,
|
|
6483
7537
|
StreetRenderHandle,
|
|
6484
7538
|
StreetRendererImpl,
|
|
7539
|
+
StyleRegistry,
|
|
6485
7540
|
TransitionController,
|
|
6486
7541
|
VERSION,
|
|
7542
|
+
a11y,
|
|
6487
7543
|
a11yIds,
|
|
7544
|
+
adoptServerStyles,
|
|
7545
|
+
animate,
|
|
7546
|
+
animation,
|
|
6488
7547
|
applyNodeProps,
|
|
6489
7548
|
applyProp,
|
|
7549
|
+
backdrop,
|
|
6490
7550
|
batch,
|
|
6491
7551
|
bindDomEvent,
|
|
7552
|
+
blockquote,
|
|
7553
|
+
body,
|
|
6492
7554
|
browserDOMAdapter,
|
|
7555
|
+
button,
|
|
6493
7556
|
buttonUpdate,
|
|
7557
|
+
canonicalize,
|
|
7558
|
+
caption,
|
|
7559
|
+
center,
|
|
7560
|
+
code,
|
|
6494
7561
|
compile,
|
|
6495
7562
|
compileGraph,
|
|
6496
7563
|
component,
|
|
6497
7564
|
consoleDiagnosticSink,
|
|
6498
7565
|
consoleHydrationDiagnosticSink,
|
|
6499
7566
|
containFocus,
|
|
7567
|
+
container,
|
|
6500
7568
|
createAnnouncer,
|
|
6501
7569
|
createApplication,
|
|
6502
7570
|
createAuthSession,
|
|
@@ -6515,31 +7583,53 @@ export {
|
|
|
6515
7583
|
createRuntime,
|
|
6516
7584
|
createStore,
|
|
6517
7585
|
createStreetEvent,
|
|
7586
|
+
createTheme,
|
|
7587
|
+
createThemeTokens,
|
|
7588
|
+
cssPropName,
|
|
7589
|
+
cssValue,
|
|
7590
|
+
cx,
|
|
7591
|
+
defaultThemeStorage,
|
|
6518
7592
|
defineConfig,
|
|
6519
7593
|
derived,
|
|
6520
7594
|
describeError,
|
|
6521
7595
|
diagnosePerformance,
|
|
7596
|
+
dialog,
|
|
7597
|
+
dropdown,
|
|
7598
|
+
dropdownItem,
|
|
6522
7599
|
effect,
|
|
6523
7600
|
email,
|
|
6524
7601
|
environment,
|
|
6525
7602
|
escapeHtml,
|
|
6526
7603
|
escapeHtmlAttr,
|
|
6527
7604
|
escapeHtmlText,
|
|
7605
|
+
fadeTransition,
|
|
7606
|
+
field,
|
|
7607
|
+
fieldError,
|
|
7608
|
+
fieldHelp,
|
|
7609
|
+
fieldLabel,
|
|
6528
7610
|
flushSync,
|
|
6529
7611
|
focusById,
|
|
6530
7612
|
focusFirst,
|
|
6531
7613
|
focusInitial,
|
|
7614
|
+
focusRing,
|
|
7615
|
+
form,
|
|
6532
7616
|
formatDiagnostic,
|
|
6533
7617
|
formatDiagnosticContext,
|
|
6534
7618
|
formatHydrationDiagnostic,
|
|
6535
7619
|
frameworkError,
|
|
6536
7620
|
generateApplicationId,
|
|
7621
|
+
generateCSS,
|
|
6537
7622
|
generateNodeId,
|
|
6538
7623
|
getFocusable,
|
|
6539
7624
|
getResolvedTransition,
|
|
6540
7625
|
globalEventBus,
|
|
7626
|
+
grid,
|
|
7627
|
+
hashIdentity,
|
|
7628
|
+
heading,
|
|
6541
7629
|
headingUpdate,
|
|
6542
7630
|
hydrateGraph,
|
|
7631
|
+
identityOf,
|
|
7632
|
+
input,
|
|
6543
7633
|
inputUpdate,
|
|
6544
7634
|
inspectApplication,
|
|
6545
7635
|
inspectComponents,
|
|
@@ -6560,7 +7650,11 @@ export {
|
|
|
6560
7650
|
isComponentDefinition,
|
|
6561
7651
|
isHeadContribution,
|
|
6562
7652
|
isTransitionConfig,
|
|
7653
|
+
label,
|
|
7654
|
+
layout,
|
|
7655
|
+
link,
|
|
6563
7656
|
linkUpdate,
|
|
7657
|
+
list,
|
|
6564
7658
|
matchPattern,
|
|
6565
7659
|
matchRoutes,
|
|
6566
7660
|
maxLength,
|
|
@@ -6575,13 +7669,18 @@ export {
|
|
|
6575
7669
|
normalizePath,
|
|
6576
7670
|
observerCount,
|
|
6577
7671
|
onEscape,
|
|
7672
|
+
overlay,
|
|
6578
7673
|
patchNode,
|
|
6579
7674
|
patchProp,
|
|
6580
7675
|
pattern,
|
|
7676
|
+
popover,
|
|
7677
|
+
pre,
|
|
6581
7678
|
printDiagnostics,
|
|
6582
7679
|
printGraph,
|
|
6583
7680
|
reactiveListItemKey,
|
|
6584
7681
|
reactiveListItemSignature,
|
|
7682
|
+
reactiveVarName,
|
|
7683
|
+
reactiveVarValue,
|
|
6585
7684
|
readState,
|
|
6586
7685
|
reconcileChildren,
|
|
6587
7686
|
reconcileChildrenByPlan,
|
|
@@ -6589,6 +7688,7 @@ export {
|
|
|
6589
7688
|
renderDevToolsReport,
|
|
6590
7689
|
renderHead,
|
|
6591
7690
|
renderInteractiveDevTools,
|
|
7691
|
+
renderStyles,
|
|
6592
7692
|
renderToString,
|
|
6593
7693
|
reportDiagnostic,
|
|
6594
7694
|
reportError,
|
|
@@ -6601,9 +7701,11 @@ export {
|
|
|
6601
7701
|
restoreFocus,
|
|
6602
7702
|
routerOutlet,
|
|
6603
7703
|
rovingMenu,
|
|
7704
|
+
row,
|
|
6604
7705
|
runElementTransition,
|
|
6605
7706
|
runValidators,
|
|
6606
7707
|
saveFocus,
|
|
7708
|
+
scaleTransition,
|
|
6607
7709
|
scheduleImmediate,
|
|
6608
7710
|
scheduleUpdate,
|
|
6609
7711
|
scheduler,
|
|
@@ -6613,13 +7715,29 @@ export {
|
|
|
6613
7715
|
serverDOMAdapter,
|
|
6614
7716
|
signal,
|
|
6615
7717
|
signalKind,
|
|
7718
|
+
skipLink,
|
|
7719
|
+
slideTransition,
|
|
7720
|
+
spacer,
|
|
6616
7721
|
splitTarget,
|
|
7722
|
+
stack,
|
|
7723
|
+
stateAttr,
|
|
6617
7724
|
streetui,
|
|
7725
|
+
style,
|
|
7726
|
+
styleRegistry,
|
|
7727
|
+
styleVariants,
|
|
7728
|
+
styleWithVars,
|
|
7729
|
+
text,
|
|
6618
7730
|
textUpdate,
|
|
6619
7731
|
toIdToken,
|
|
7732
|
+
toast,
|
|
7733
|
+
tokens,
|
|
7734
|
+
tooltip,
|
|
6620
7735
|
transformGraph,
|
|
7736
|
+
transition,
|
|
7737
|
+
transitions,
|
|
6621
7738
|
trapFocus,
|
|
6622
7739
|
validateGraph,
|
|
7740
|
+
visuallyHidden,
|
|
6623
7741
|
wireComponentBehavior,
|
|
6624
7742
|
wireEvents,
|
|
6625
7743
|
wireHeadBehavior,
|