@jxsuite/runtime 1.3.1 → 2.0.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/runtime.js CHANGED
@@ -44,7 +44,7 @@ var toHandlerKey = cacheStringFunction((str) => {
44
44
  });
45
45
  var hasChanged = (value, oldValue) => !Object.is(value, oldValue);
46
46
  var specialBooleanAttrs = `itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly`;
47
- var isBooleanAttr = /* @__PURE__ */ makeMap(specialBooleanAttrs + `,async,autofocus,autoplay,controls,default,defer,disabled,hidden,inert,loop,open,required,reversed,scoped,seamless,checked,muted,multiple,selected`);
47
+ var isBooleanAttr = /* @__PURE__ */ makeMap(specialBooleanAttrs + `,async,autofocus,autoplay,controls,default,defer,disabled,inert,loop,open,required,reversed,scoped,seamless,checked,muted,multiple,selected`);
48
48
 
49
49
  // ../../node_modules/@vue/reactivity/dist/reactivity.esm-bundler.js
50
50
  function warn(msg, ...args) {
@@ -1384,6 +1384,80 @@ function computed(getterOrOptions, debugOptions, isSSR = false) {
1384
1384
  return cRef;
1385
1385
  }
1386
1386
 
1387
+ // ../schema/src/intl.ts
1388
+ var DEFAULT_FORMAT_LOCALE = "en-US";
1389
+ var DEFAULT_TIME_ZONE = "UTC";
1390
+ var INTL_HELPERS = [
1391
+ {
1392
+ api: "Intl.NumberFormat",
1393
+ params: ["value", "locale", "options"],
1394
+ path: "Intl/formatNumber",
1395
+ summary: "Format a number for a locale — grouping, decimals, currency, percent, units."
1396
+ },
1397
+ {
1398
+ api: "Intl.DateTimeFormat",
1399
+ params: ["value", "locale", "options"],
1400
+ path: "Intl/formatDate",
1401
+ summary: "Format a date or timestamp for a locale. Pass `timeZone` in options."
1402
+ },
1403
+ {
1404
+ api: "Intl.RelativeTimeFormat",
1405
+ params: ["value", "unit", "locale", "options"],
1406
+ path: "Intl/formatRelativeTime",
1407
+ summary: 'Format a relative time — `-3, "day"` becomes "3 days ago".'
1408
+ },
1409
+ {
1410
+ api: "Intl.ListFormat",
1411
+ params: ["values", "locale", "options"],
1412
+ path: "Intl/formatList",
1413
+ summary: 'Join a list the way a locale does — "a, b, and c", not a hand-written comma join.'
1414
+ },
1415
+ {
1416
+ api: "Intl.PluralRules",
1417
+ params: ["value", "locale", "options"],
1418
+ path: "Intl/plural",
1419
+ summary: 'Which plural category a number falls in ("one", "few", "other") — many languages have ' + "more than two, so a ternary on `n === 1` is wrong outside English."
1420
+ },
1421
+ {
1422
+ api: "Intl.Collator",
1423
+ params: ["a", "b", "locale", "options"],
1424
+ path: "Intl/compare",
1425
+ summary: "Compare two strings for sorting. `<` and `sort()` order by UTF-16 code unit, which puts " + '"Zebra" before "apple" and sorts every accented word into the wrong place.'
1426
+ },
1427
+ {
1428
+ api: "Intl.DisplayNames",
1429
+ params: ["code", "type", "locale", "options"],
1430
+ path: "Intl/displayName",
1431
+ summary: 'The name of a language, region, script or currency in a locale — "de" as "German" or ' + '"Deutsch", from CLDR rather than a hand-kept table.'
1432
+ },
1433
+ {
1434
+ api: "Intl.Segmenter",
1435
+ params: ["value", "granularity", "locale"],
1436
+ path: "Intl/segment",
1437
+ summary: "Split text into graphemes, words or sentences (UAX #29). `[...str]` splits code points, " + "so it cuts an emoji with a skin-tone modifier in half."
1438
+ }
1439
+ ];
1440
+ var INTL_HELPER_PATHS = INTL_HELPERS.map((helper) => helper.path);
1441
+ var INTL_LOCALE_PARAM = Object.fromEntries(INTL_HELPERS.map((helper) => [helper.path, helper.params.indexOf("locale")]));
1442
+
1443
+ // src/pointer.ts
1444
+ function unescapeToken(token) {
1445
+ return token.replaceAll("~1", "/").replaceAll("~0", "~");
1446
+ }
1447
+ function refSegments(path) {
1448
+ if (path === "") {
1449
+ return [];
1450
+ }
1451
+ return path.split("/").map((token) => unescapeToken(token));
1452
+ }
1453
+ function readPath(root, path) {
1454
+ let current = root;
1455
+ for (const key of refSegments(path)) {
1456
+ current = current?.[key];
1457
+ }
1458
+ return current;
1459
+ }
1460
+
1387
1461
  // src/expression.ts
1388
1462
  function scopeMap(state) {
1389
1463
  const map = state.$map;
@@ -1504,15 +1578,42 @@ var BLESSED_GLOBALS = new Set([
1504
1578
  "Array/of",
1505
1579
  "String/fromCharCode",
1506
1580
  "String/fromCodePoint",
1507
- "Intl/formatNumber",
1508
- "Intl/formatDate",
1509
- "Intl/formatRelativeTime"
1581
+ ...INTL_HELPER_PATHS
1510
1582
  ]);
1511
1583
  var BLESSED_HELPERS = {
1512
- "Intl/formatDate": (value, locale, options) => new Intl.DateTimeFormat(locale, options).format(new Date(value)),
1513
- "Intl/formatNumber": (value, locale, options) => new Intl.NumberFormat(locale, options).format(value),
1514
- "Intl/formatRelativeTime": (value, unit, locale, options) => new Intl.RelativeTimeFormat(locale, options).format(value, unit)
1584
+ "Intl/compare": (a, b, locale, options) => new Intl.Collator(locale ?? DEFAULT_FORMAT_LOCALE, options).compare(a, b),
1585
+ "Intl/displayName": (code, type, locale, options) => new Intl.DisplayNames(locale ?? DEFAULT_FORMAT_LOCALE, {
1586
+ ...options,
1587
+ type: type ?? "language"
1588
+ }).of(code),
1589
+ "Intl/formatDate": (value, locale, options) => new Intl.DateTimeFormat(locale ?? DEFAULT_FORMAT_LOCALE, {
1590
+ timeZone: DEFAULT_TIME_ZONE,
1591
+ ...options
1592
+ }).format(new Date(value)),
1593
+ "Intl/formatList": (values, locale, options) => new Intl.ListFormat(locale ?? DEFAULT_FORMAT_LOCALE, options).format(values),
1594
+ "Intl/formatNumber": (value, locale, options) => new Intl.NumberFormat(locale ?? DEFAULT_FORMAT_LOCALE, options).format(value),
1595
+ "Intl/formatRelativeTime": (value, unit, locale, options) => new Intl.RelativeTimeFormat(locale ?? DEFAULT_FORMAT_LOCALE, options).format(value, unit),
1596
+ "Intl/plural": (value, locale, options) => new Intl.PluralRules(locale ?? DEFAULT_FORMAT_LOCALE, options).select(value),
1597
+ "Intl/segment": (value, granularity, locale) => [
1598
+ ...new Intl.Segmenter(locale ?? DEFAULT_FORMAT_LOCALE, {
1599
+ granularity: granularity ?? "grapheme"
1600
+ }).segment(value)
1601
+ ].map((part) => part.segment)
1515
1602
  };
1603
+ function withPageLocale(path, args, state) {
1604
+ const index = INTL_LOCALE_PARAM[path];
1605
+ if (index === undefined || index < 0 || args[index] != null) {
1606
+ return args;
1607
+ }
1608
+ const page = state.$page;
1609
+ const locale = page?.locale;
1610
+ if (typeof locale !== "string" || locale === "") {
1611
+ return args;
1612
+ }
1613
+ const filled = [...args];
1614
+ filled[index] = locale;
1615
+ return filled;
1616
+ }
1516
1617
  function isBlessedGlobal(ref2) {
1517
1618
  return ref2.startsWith("window#/") && BLESSED_GLOBALS.has(ref2.slice("window#/".length));
1518
1619
  }
@@ -1584,15 +1685,10 @@ function resolveExprRef(ref2, state, event, iterCtx) {
1584
1685
  return parts.length > 2 ? getPath(base, parts.slice(2).join("/")) : base;
1585
1686
  }
1586
1687
  if (ref2.startsWith("#/state/")) {
1587
- const sub = ref2.slice("#/state/".length);
1588
- const slash = sub.indexOf("/");
1589
- if (slash === -1) {
1590
- return state[sub];
1591
- }
1592
- return getPath(state[sub.slice(0, slash)], sub.slice(slash + 1));
1688
+ return readPath(state, ref2.slice("#/state/".length));
1593
1689
  }
1594
1690
  if (ref2.startsWith("parent#/")) {
1595
- return state[ref2.slice("parent#/".length)];
1691
+ return readPath(state, ref2.slice("parent#/".length));
1596
1692
  }
1597
1693
  if (ref2.startsWith("window#/")) {
1598
1694
  return getPath(globalThis.window, ref2.slice("window#/".length));
@@ -1600,7 +1696,7 @@ function resolveExprRef(ref2, state, event, iterCtx) {
1600
1696
  if (ref2.startsWith("document#/")) {
1601
1697
  return getPath(globalThis.document, ref2.slice("document#/".length));
1602
1698
  }
1603
- return state[ref2] ?? null;
1699
+ return readPath(state, ref2) ?? null;
1604
1700
  }
1605
1701
  function resolveWritableRef(ref2, state, _event, iterCtx) {
1606
1702
  if (ref2.startsWith("$map/")) {
@@ -1632,7 +1728,7 @@ function resolveWritableRef(ref2, state, _event, iterCtx) {
1632
1728
  if (slash === -1) {
1633
1729
  return { key: sub, obj: state };
1634
1730
  }
1635
- const parts = sub.split("/");
1731
+ const parts = refSegments(sub);
1636
1732
  const lastKey = parts.pop();
1637
1733
  let obj = state;
1638
1734
  for (const p of parts) {
@@ -1678,7 +1774,7 @@ function evaluateNode(node, state, event, iterCtx, trace) {
1678
1774
  const globalPath = calleeRef.slice("window#/".length);
1679
1775
  const helper = BLESSED_HELPERS[globalPath];
1680
1776
  if (helper) {
1681
- return helper(...argValues);
1777
+ return helper(...withPageLocale(globalPath, argValues, state));
1682
1778
  }
1683
1779
  const fn = getPath(globalThis.window, globalPath);
1684
1780
  const lastSlash = globalPath.lastIndexOf("/");
@@ -1867,11 +1963,7 @@ function evaluateNode(node, state, event, iterCtx, trace) {
1867
1963
  return;
1868
1964
  }
1869
1965
  function getPath(obj, path) {
1870
- let current = obj;
1871
- for (const k of path.split(/[./]/)) {
1872
- current = current?.[k];
1873
- }
1874
- return current;
1966
+ return readPath(obj, path);
1875
1967
  }
1876
1968
  function evaluateOperand(operand, state, event, iterCtx) {
1877
1969
  return resolveOperand(operand, state, event, iterCtx);
@@ -1925,7 +2017,7 @@ function isTemplateString(value) {
1925
2017
  return typeof value === "string" && value.includes("${");
1926
2018
  }
1927
2019
  function bodyReturnsValue(body) {
1928
- return /\breturn\b/.test(body);
2020
+ return /\breturn\b[^\S\n]*(?![;}\s]|$)/.test(body);
1929
2021
  }
1930
2022
  function paramNames(parameters) {
1931
2023
  if (!parameters) {
@@ -1933,6 +2025,12 @@ function paramNames(parameters) {
1933
2025
  }
1934
2026
  return parameters.map((p) => typeof p === "string" ? p : p.name);
1935
2027
  }
2028
+ function isTagExpression(tagName) {
2029
+ return isJsonObject(tagName) && isJsonObject(tagName.$expression);
2030
+ }
2031
+ function isPrivateStateKey(key) {
2032
+ return key.startsWith("#");
2033
+ }
1936
2034
 
1937
2035
  // src/statements.ts
1938
2036
  function statementKind(statement) {
@@ -2002,6 +2100,45 @@ async function runStatements(statements, state, event, opts = {}) {
2002
2100
  }
2003
2101
  }
2004
2102
 
2103
+ // src/cookie.ts
2104
+ var HOST_PREFIX = "__Host-";
2105
+ var SECURE_PREFIX = "__Secure-";
2106
+ function readCookie(header, name) {
2107
+ for (const pair of header.split(";")) {
2108
+ const eq = pair.indexOf("=");
2109
+ if (eq === -1) {
2110
+ continue;
2111
+ }
2112
+ if (pair.slice(0, eq).trim() === name) {
2113
+ return pair.slice(eq + 1);
2114
+ }
2115
+ }
2116
+ return null;
2117
+ }
2118
+ function serializeCookie(name, value, options) {
2119
+ const hostPrefixed = name.startsWith(HOST_PREFIX);
2120
+ const parts = [`${name}=${encodeURIComponent(JSON.stringify(value))}`];
2121
+ if (options.maxAge !== undefined) {
2122
+ parts.push(`Max-Age=${options.maxAge}`);
2123
+ }
2124
+ const path = hostPrefixed ? "/" : options.path;
2125
+ if (path) {
2126
+ parts.push(`Path=${path}`);
2127
+ }
2128
+ if (options.domain && !hostPrefixed) {
2129
+ parts.push(`Domain=${options.domain}`);
2130
+ }
2131
+ const { sameSite } = options;
2132
+ const secure = options.secure === true || hostPrefixed || name.startsWith(SECURE_PREFIX) || sameSite?.toLowerCase() === "none";
2133
+ if (secure) {
2134
+ parts.push("Secure");
2135
+ }
2136
+ if (sameSite) {
2137
+ parts.push(`SameSite=${sameSite}`);
2138
+ }
2139
+ return parts.join("; ");
2140
+ }
2141
+
2005
2142
  // src/runtime.ts
2006
2143
  var SUPPORTED_SCHEMA_VERSION = 1;
2007
2144
  var _schemaVersionWarned = false;
@@ -2069,6 +2206,10 @@ var _serverFnConfig = { skip: false };
2069
2206
  function setSkipServerFunctions(v) {
2070
2207
  _serverFnConfig.skip = v;
2071
2208
  }
2209
+ var _autoRequestConfig = { skip: false };
2210
+ function setSkipAutoRequests(v) {
2211
+ _autoRequestConfig.skip = v;
2212
+ }
2072
2213
  var _resolveToken = null;
2073
2214
  function setResolveToken(token) {
2074
2215
  _resolveToken = token || null;
@@ -2426,7 +2567,7 @@ function renderNode(def2, state, options) {
2426
2567
  console.warn(`Jx: a $ref child ("${refTarget}") is not a supported component instance; register the ` + `component in $elements and use its custom-element tag instead (spec §13).`);
2427
2568
  }
2428
2569
  }
2429
- const tagName = def2.tagName ?? "div";
2570
+ const tagName = resolveTagName(def2.tagName, localState);
2430
2571
  const isCustomEl = tagName.includes("-") && customElements.get(tagName);
2431
2572
  if (def2.$props && isCustomEl) {
2432
2573
  return renderCustomElementWithProps(def2, localState, options, path);
@@ -2726,9 +2867,23 @@ function renderMappedArrayInto(parentEl, arrayDef, state, options) {
2726
2867
  });
2727
2868
  });
2728
2869
  }
2870
+ function resolveTagName(tagName, scope) {
2871
+ if (typeof tagName === "string") {
2872
+ return tagName;
2873
+ }
2874
+ if (!isTagExpression(tagName)) {
2875
+ return "div";
2876
+ }
2877
+ const expression = tagName.$expression;
2878
+ if (expression.operator === "?:") {
2879
+ return evaluateOperand(expression.target, scope, null) ? expression.value : expression.initial;
2880
+ }
2881
+ const key = evaluateOperand(expression.target, scope, null);
2882
+ return expression.cases[String(key)] ?? expression.default;
2883
+ }
2729
2884
  function renderSwitch(def2, state, options) {
2730
2885
  const path = options?._path ?? [];
2731
- const container = document.createElement(def2.tagName ?? "div");
2886
+ const container = document.createElement(resolveTagName(def2.tagName, state));
2732
2887
  if (options?.onNodeCreated) {
2733
2888
  options.onNodeCreated(container, path, def2, state);
2734
2889
  }
@@ -2737,7 +2892,7 @@ function renderSwitch(def2, state, options) {
2737
2892
  applyAttributes(container, def2.attributes ?? {}, state);
2738
2893
  let generation = 0;
2739
2894
  effect(() => {
2740
- container.innerHTML = "";
2895
+ container.replaceChildren();
2741
2896
  if (!isRefObj(def2.$switch)) {
2742
2897
  return;
2743
2898
  }
@@ -2747,7 +2902,8 @@ function renderSwitch(def2, state, options) {
2747
2902
  return;
2748
2903
  }
2749
2904
  if (isRefObj(caseDef)) {
2750
- const gen = generation += 1;
2905
+ generation += 1;
2906
+ const gen = generation;
2751
2907
  const { href } = new URL(caseDef.$ref, location.href);
2752
2908
  resolve(href).then(async (doc) => {
2753
2909
  if (gen !== generation) {
@@ -2757,7 +2913,7 @@ function renderSwitch(def2, state, options) {
2757
2913
  if (gen !== generation) {
2758
2914
  return;
2759
2915
  }
2760
- container.innerHTML = "";
2916
+ container.replaceChildren();
2761
2917
  const childOpts2 = options ? { ...options, _path: [...path, "cases", key] } : undefined;
2762
2918
  container.append(renderNode(doc, childScope, childOpts2));
2763
2919
  }).catch((error) => console.error("Jx $switch: failed to load external case", caseDef.$ref, error));
@@ -2777,7 +2933,7 @@ async function resolvePrototype(def2, state, key, base) {
2777
2933
  const s = ref(null);
2778
2934
  const debounceMs = def2.debounce ?? 0;
2779
2935
  let debounceTimer = null;
2780
- if (!def2.manual) {
2936
+ if (!def2.manual && !_autoRequestConfig.skip) {
2781
2937
  effect(() => {
2782
2938
  let url;
2783
2939
  if (isTemplateString(def2.url)) {
@@ -2858,36 +3014,19 @@ async function resolvePrototype(def2, state, key, base) {
2858
3014
  case "Cookie": {
2859
3015
  const name = def2.name ?? key;
2860
3016
  const read = () => {
2861
- const m = document.cookie.match(new RegExp(`(?:^|; )${name}=([^;]*)`));
2862
- if (!m) {
3017
+ const raw = readCookie(document.cookie, name);
3018
+ if (raw === null) {
2863
3019
  return null;
2864
3020
  }
2865
3021
  try {
2866
- return JSON.parse(decodeURIComponent(m[1]));
3022
+ return JSON.parse(decodeURIComponent(raw));
2867
3023
  } catch {
2868
- return m[1];
3024
+ return raw;
2869
3025
  }
2870
3026
  };
2871
3027
  const cookieState = ref(read() ?? def2.default ?? null);
2872
3028
  effect(() => {
2873
- const v = cookieState.value;
2874
- let s = `${name}=${encodeURIComponent(JSON.stringify(v))}`;
2875
- if (def2.maxAge !== undefined) {
2876
- s += `; Max-Age=${def2.maxAge}`;
2877
- }
2878
- if (def2.path) {
2879
- s += `; Path=${def2.path}`;
2880
- }
2881
- if (def2.domain) {
2882
- s += `; Domain=${def2.domain}`;
2883
- }
2884
- if (def2.secure) {
2885
- s += `; Secure`;
2886
- }
2887
- if (def2.sameSite) {
2888
- s += `; SameSite=${def2.sameSite}`;
2889
- }
2890
- document.cookie = s;
3029
+ document.cookie = serializeCookie(name, cookieState.value, def2);
2891
3030
  });
2892
3031
  return cookieState;
2893
3032
  }
@@ -3295,15 +3434,10 @@ function resolveRef(refPath, state) {
3295
3434
  return parts.length > 2 ? getPath2(base, parts.slice(2).join("/")) : base;
3296
3435
  }
3297
3436
  if (refPath.startsWith("#/state/")) {
3298
- const sub = refPath.slice("#/state/".length);
3299
- const slash = sub.indexOf("/");
3300
- if (slash === -1) {
3301
- return state[sub];
3302
- }
3303
- return getPath2(state[sub.slice(0, slash)], sub.slice(slash + 1));
3437
+ return readPath(state, refPath.slice("#/state/".length));
3304
3438
  }
3305
3439
  if (refPath.startsWith("parent#/")) {
3306
- return state[refPath.slice("parent#/".length)];
3440
+ return readPath(state, refPath.slice("parent#/".length));
3307
3441
  }
3308
3442
  if (refPath.startsWith("window#/")) {
3309
3443
  return getPath2(globalThis.window, refPath.slice("window#/".length));
@@ -3311,7 +3445,7 @@ function resolveRef(refPath, state) {
3311
3445
  if (refPath.startsWith("document#/")) {
3312
3446
  return getPath2(globalThis.document, refPath.slice("document#/".length));
3313
3447
  }
3314
- return state[refPath] ?? null;
3448
+ return readPath(state, refPath) ?? null;
3315
3449
  }
3316
3450
  function isSignal(v) {
3317
3451
  return isRef(v);
@@ -3323,15 +3457,29 @@ function isNestedSelector(k) {
3323
3457
  return k.startsWith(":") || k.startsWith(".") || k.startsWith("&") || k.startsWith("[");
3324
3458
  }
3325
3459
  function getPath2(obj, path) {
3326
- let current = obj;
3327
- for (const k of path.split(/[./]/)) {
3328
- current = current?.[k];
3460
+ return readPath(obj, path);
3461
+ }
3462
+ var _privatePropWarned = new Set;
3463
+ function refusePrivateProp(key, where) {
3464
+ if (!isPrivateStateKey(key)) {
3465
+ return false;
3329
3466
  }
3330
- return current;
3467
+ const seen = where === undefined ? key : `${where}:${key}`;
3468
+ if (!_privatePropWarned.has(seen)) {
3469
+ _privatePropWarned.add(seen);
3470
+ console.warn(`Jx: "${key}" is private state (spec.md §5.6) and cannot be set through $props` + `${where === undefined ? "" : ` (${where})`}. The write was ignored; rename the entry without the leading # to make it part of the component's interface.`);
3471
+ }
3472
+ return true;
3473
+ }
3474
+ function _resetPrivatePropWarnings() {
3475
+ _privatePropWarned.clear();
3331
3476
  }
3332
3477
  function mergeProps(def2, parentState) {
3333
3478
  const child = Object.create(parentState);
3334
3479
  for (const [k, v] of Object.entries(def2.$props ?? {})) {
3480
+ if (refusePrivateProp(k, "$props")) {
3481
+ continue;
3482
+ }
3335
3483
  child[k] = isRefObj(v) ? resolveRef(v.$ref, parentState) : v;
3336
3484
  }
3337
3485
  return child;
@@ -3415,7 +3563,7 @@ function injectHead(entries, _base) {
3415
3563
  el.setAttribute(k, String(v));
3416
3564
  }
3417
3565
  if (entry.textContent) {
3418
- el.textContent = entry.textContent;
3566
+ el.textContent = typeof entry.textContent === "object" ? JSON.stringify(entry.textContent, null, 2) : entry.textContent;
3419
3567
  }
3420
3568
  document.head.append(el);
3421
3569
  }
@@ -3467,6 +3615,9 @@ async function defineElement(source, baseUrl) {
3467
3615
  try {
3468
3616
  const props = JSON.parse(propsAttr);
3469
3617
  for (const [key, val] of Object.entries(props)) {
3618
+ if (refusePrivateProp(key, "data-jx-props")) {
3619
+ continue;
3620
+ }
3470
3621
  if (key in (def2.state ?? {})) {
3471
3622
  state[key] = val;
3472
3623
  }
@@ -3477,17 +3628,27 @@ async function defineElement(source, baseUrl) {
3477
3628
  const propAttrNames = this.getAttributeNames().filter((name) => name.startsWith("props.") && name.length > "props.".length);
3478
3629
  for (const name of propAttrNames) {
3479
3630
  const key = name.slice("props.".length);
3631
+ if (refusePrivateProp(key, "props.* attribute")) {
3632
+ this.removeAttribute(name);
3633
+ continue;
3634
+ }
3480
3635
  if (key in (def2.state ?? {})) {
3481
3636
  state[key] = this.getAttribute(name);
3482
3637
  this.removeAttribute(name);
3483
3638
  }
3484
3639
  }
3485
3640
  for (const key of Object.keys(def2.state ?? {})) {
3641
+ if (isPrivateStateKey(key)) {
3642
+ continue;
3643
+ }
3486
3644
  if (key in this && this[key] !== undefined) {
3487
3645
  state[key] = this[key];
3488
3646
  }
3489
3647
  }
3490
3648
  for (const key of Object.keys(def2.state ?? {})) {
3649
+ if (isPrivateStateKey(key)) {
3650
+ continue;
3651
+ }
3491
3652
  if (!(key in HTMLElement.prototype)) {
3492
3653
  Object.defineProperty(this, key, {
3493
3654
  configurable: true,
@@ -3500,7 +3661,7 @@ async function defineElement(source, baseUrl) {
3500
3661
  }
3501
3662
  this._state = state;
3502
3663
  const slottedChildren = [...this.childNodes];
3503
- this.innerHTML = "";
3664
+ this.replaceChildren();
3504
3665
  if (!this.style.display) {
3505
3666
  this.style.display = "block";
3506
3667
  }
@@ -3544,11 +3705,14 @@ async function defineElement(source, baseUrl) {
3544
3705
  customElements.define(tagName, ElementClass);
3545
3706
  }
3546
3707
  function renderCustomElementWithProps(def2, state, options, path) {
3547
- const el = document.createElement(def2.tagName ?? "div");
3708
+ const el = document.createElement(resolveTagName(def2.tagName, state));
3548
3709
  if (options?.onNodeCreated) {
3549
3710
  options.onNodeCreated(el, path ?? [], def2, state);
3550
3711
  }
3551
3712
  for (const [key, val] of Object.entries(def2.$props ?? {})) {
3713
+ if (refusePrivateProp(key, "$props")) {
3714
+ continue;
3715
+ }
3552
3716
  if (isRefObj(val)) {
3553
3717
  const refVal = val;
3554
3718
  const resolved = resolveRef(refVal.$ref, state);
@@ -3598,7 +3762,7 @@ function distributeSlots(host, slottedChildren) {
3598
3762
  const name = slot.getAttribute("name");
3599
3763
  const matches = name ? named.get(name) ?? [] : unnamed;
3600
3764
  if (matches.length > 0) {
3601
- slot.innerHTML = "";
3765
+ slot.replaceChildren();
3602
3766
  for (const child of matches) {
3603
3767
  slot.append(child);
3604
3768
  }
@@ -3611,12 +3775,14 @@ export {
3611
3775
  setStampPropBindings,
3612
3776
  setSkipServerFunctions,
3613
3777
  setSkipContentResolution,
3778
+ setSkipAutoRequests,
3614
3779
  setRootMedia,
3615
3780
  setResolveToken,
3616
3781
  setCanvasViewportTranspose,
3617
3782
  setCanvasDelinkAnchors,
3618
3783
  schemeSelectors,
3619
3784
  runScoped,
3785
+ resolveTagName,
3620
3786
  resolveRef,
3621
3787
  resolvePrototype,
3622
3788
  resolve,
@@ -3631,6 +3797,7 @@ export {
3631
3797
  camelToKebab,
3632
3798
  buildScope,
3633
3799
  applyStyle,
3800
+ _resetPrivatePropWarnings,
3634
3801
  SUPPORTED_SCHEMA_VERSION,
3635
3802
  RESERVED_KEYS,
3636
3803
  Jx,
@@ -3638,5 +3805,5 @@ export {
3638
3805
  COLOR_SCHEME_ATTR
3639
3806
  };
3640
3807
 
3641
- //# debugId=3209CA09C3B270F064756E2164756E21
3808
+ //# debugId=38D6F60E1C2F6F7A64756E2164756E21
3642
3809
  //# sourceMappingURL=runtime.js.map