kerfjs 5.0.0-beta.13 → 5.0.0-beta.131

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.
Files changed (94) hide show
  1. package/CHANGELOG.md +3384 -108
  2. package/README.md +101 -37
  3. package/ai/cursorrules +127 -68
  4. package/ai/manifest.json +36 -7
  5. package/ai/skill.md +167 -86
  6. package/ai/ui-skill.md +18 -0
  7. package/dist/actions.d.ts +1 -1
  8. package/dist/actions.js +10 -6
  9. package/dist/actions.js.map +1 -1
  10. package/dist/array-signal.js +1 -1
  11. package/dist/async.d.ts +7 -3
  12. package/dist/async.js +39 -22
  13. package/dist/async.js.map +1 -1
  14. package/dist/attach.js +1 -66
  15. package/dist/attach.js.map +1 -1
  16. package/dist/{chunk-GY4XV2UV.js → chunk-4TX6YJDM.js} +10 -3
  17. package/dist/chunk-4TX6YJDM.js.map +1 -0
  18. package/dist/{chunk-SVATPF5R.js → chunk-5QDM6HPD.js} +637 -277
  19. package/dist/chunk-5QDM6HPD.js.map +1 -0
  20. package/dist/{chunk-QIP723L4.js → chunk-5WRGJZV6.js} +3 -2
  21. package/dist/chunk-5WRGJZV6.js.map +1 -0
  22. package/dist/chunk-AP2FT33F.js +87 -0
  23. package/dist/chunk-AP2FT33F.js.map +1 -0
  24. package/dist/chunk-BTOKH5FA.js +70 -0
  25. package/dist/chunk-BTOKH5FA.js.map +1 -0
  26. package/dist/{chunk-ZDCJZCNO.js → chunk-GGADRIQO.js} +168 -97
  27. package/dist/chunk-GGADRIQO.js.map +1 -0
  28. package/dist/chunk-KOEGJCIS.js +65 -0
  29. package/dist/chunk-KOEGJCIS.js.map +1 -0
  30. package/dist/{chunk-HW7KSM2Y.js → chunk-KUHXPPJ4.js} +1 -1
  31. package/dist/chunk-KUHXPPJ4.js.map +1 -0
  32. package/dist/{chunk-UZJ6I4T6.js → chunk-MK42GLPV.js} +1 -1
  33. package/dist/chunk-MK42GLPV.js.map +1 -0
  34. package/dist/chunk-N4VHHOCM.js +27 -0
  35. package/dist/chunk-N4VHHOCM.js.map +1 -0
  36. package/dist/{chunk-V46JKE44.js → chunk-NRPLVJVR.js} +43 -14
  37. package/dist/chunk-NRPLVJVR.js.map +1 -0
  38. package/dist/{chunk-LVH3GC6B.js → chunk-QOAB2ESQ.js} +3 -3
  39. package/dist/chunk-QOAB2ESQ.js.map +1 -0
  40. package/dist/{chunk-KZJXHFIB.js → chunk-V322Z7FX.js} +5 -5
  41. package/dist/chunk-V322Z7FX.js.map +1 -0
  42. package/dist/{delegate-CL9VTZFb.d.ts → delegate--CrfgYtC.d.ts} +0 -34
  43. package/dist/dev.d.ts +46 -15
  44. package/dist/dev.js +185 -40
  45. package/dist/dev.js.map +1 -1
  46. package/dist/html.js +20 -8
  47. package/dist/html.js.map +1 -1
  48. package/dist/index.d.ts +98 -13
  49. package/dist/index.js +49 -21
  50. package/dist/index.js.map +1 -1
  51. package/dist/jsx-runtime.d.ts +25 -10
  52. package/dist/jsx-runtime.js +1 -1
  53. package/dist/list.d.ts +7 -3
  54. package/dist/list.js +236 -78
  55. package/dist/list.js.map +1 -1
  56. package/dist/overlay.d.ts +287 -142
  57. package/dist/overlay.js +1040 -369
  58. package/dist/overlay.js.map +1 -1
  59. package/dist/remount.js +2 -2
  60. package/dist/remount.js.map +1 -1
  61. package/dist/router.d.ts +22 -6
  62. package/dist/router.js +58 -19
  63. package/dist/router.js.map +1 -1
  64. package/dist/scope.d.ts +45 -8
  65. package/dist/scope.js +69 -30
  66. package/dist/scope.js.map +1 -1
  67. package/dist/testing.js +1 -1
  68. package/dist/timing.d.ts +17 -7
  69. package/dist/timing.js +8 -3
  70. package/dist/timing.js.map +1 -1
  71. package/llms.txt +17 -6
  72. package/package.json +48 -12
  73. package/setup/apply.mjs +202 -0
  74. package/setup/cli.mjs +95 -0
  75. package/setup/common.mjs +91 -0
  76. package/setup/detect.mjs +274 -0
  77. package/setup/index.d.mts +39 -0
  78. package/setup/index.mjs +1290 -0
  79. package/setup/jsonc.mjs +201 -0
  80. package/setup/state.schema.json +57 -0
  81. package/setup/ui-baseline.mjs +210 -0
  82. package/dist/chunk-GY4XV2UV.js.map +0 -1
  83. package/dist/chunk-HW7KSM2Y.js.map +0 -1
  84. package/dist/chunk-KPXIOG2C.js +0 -54
  85. package/dist/chunk-KPXIOG2C.js.map +0 -1
  86. package/dist/chunk-KZJXHFIB.js.map +0 -1
  87. package/dist/chunk-LVH3GC6B.js.map +0 -1
  88. package/dist/chunk-QIP723L4.js.map +0 -1
  89. package/dist/chunk-SVATPF5R.js.map +0 -1
  90. package/dist/chunk-U6FK33SG.js +0 -20
  91. package/dist/chunk-U6FK33SG.js.map +0 -1
  92. package/dist/chunk-UZJ6I4T6.js.map +0 -1
  93. package/dist/chunk-V46JKE44.js.map +0 -1
  94. package/dist/chunk-ZDCJZCNO.js.map +0 -1
@@ -1,6 +1,6 @@
1
- import { effect, isSignal } from './chunk-U6FK33SG.js';
2
- import { flatten, wrapWithTags, mergeChildSegments } from './chunk-GY4XV2UV.js';
3
- import { devHooks } from './chunk-HW7KSM2Y.js';
1
+ import { effect, isSignal } from './chunk-N4VHHOCM.js';
2
+ import { isOverlayHost, flatten, wrapWithTags, mergeChildSegments } from './chunk-4TX6YJDM.js';
3
+ import { devHooks } from './chunk-KUHXPPJ4.js';
4
4
 
5
5
  // src/utils/syncFormProp.ts
6
6
  function syncFormProp(el, name, value, present) {
@@ -17,7 +17,14 @@ function syncFormProp(el, name, value, present) {
17
17
  }
18
18
 
19
19
  // src/utils/url-screen.ts
20
- var URL_ATTRS = /* @__PURE__ */ new Set(["href", "src", "xlink:href", "formaction", "action", "data"]);
20
+ var URL_ATTRS = /* @__PURE__ */ new Set([
21
+ "href",
22
+ "src",
23
+ "xlink:href",
24
+ "formaction",
25
+ "action",
26
+ "data"
27
+ ]);
21
28
  var DANGEROUS_SCHEMES = /* @__PURE__ */ new Set(["javascript", "vbscript"]);
22
29
  var INERT_JAVASCRIPT_URLS = /* @__PURE__ */ new Set([
23
30
  "javascript:",
@@ -36,24 +43,35 @@ function schemeOf(normalized) {
36
43
  const m = /^([a-zA-Z][a-zA-Z0-9+.-]*):/.exec(normalized);
37
44
  return m ? m[1].toLowerCase() : null;
38
45
  }
39
- function isDangerousDataUrl(normalized) {
46
+ function isDangerousDataUrl(normalized, imageSink) {
40
47
  const media = /^data:([^;,]*)/.exec(normalized.toLowerCase())?.[1].trim() ?? "";
41
- if (media === "" || media === "text/plain" || media === "text/css") return false;
42
- if (media === "image/svg+xml") return true;
48
+ if (media === "" || media === "text/plain" || media === "text/css")
49
+ return false;
50
+ if (media === "image/svg+xml") return !imageSink;
43
51
  if (media.startsWith("image/")) return false;
44
- if (media.startsWith("font/") || media.startsWith("application/font")) return false;
52
+ if (media.startsWith("font/") || media.startsWith("application/font"))
53
+ return false;
45
54
  if (media.startsWith("audio/") || media.startsWith("video/")) return false;
46
55
  return true;
47
56
  }
48
- function isDangerousUrlValue(name, value) {
49
- if (!URL_ATTRS.has(name.toLowerCase())) return false;
57
+ function isUrlAttrName(name) {
58
+ return URL_ATTRS.has(/[A-Z]/.test(name) ? name.toLowerCase() : name);
59
+ }
60
+ function isImageUrlSink(tag, name) {
61
+ return /^(?:img:src|image:(?:xlink:)?href)$/i.test(`${tag}:${name}`);
62
+ }
63
+ function isDangerousUrlValue(name, value, tag = "") {
64
+ return isUrlAttrName(name) && isDangerousUrl(value, isImageUrlSink(tag, name));
65
+ }
66
+ function isDangerousUrl(value, imageSink = false) {
67
+ if (!value.includes(":")) return false;
50
68
  const normalized = normalizeUrl(value);
51
69
  const scheme = schemeOf(normalized);
52
70
  if (scheme === null) return false;
53
71
  if (DANGEROUS_SCHEMES.has(scheme)) {
54
72
  return !INERT_JAVASCRIPT_URLS.has(normalized.trimEnd().toLowerCase());
55
73
  }
56
- return scheme === "data" && isDangerousDataUrl(normalized);
74
+ return scheme === "data" && isDangerousDataUrl(normalized, imageSink);
57
75
  }
58
76
  function dangerousUrlWarning(name, value) {
59
77
  return `dropped dangerous URL value for ${name}=${JSON.stringify(value.slice(0, DANGEROUS_URL_DIAGNOSTIC_VALUE_LENGTH))}. kerf blocks javascript:, vbscript:, and script-executing data: URLs (text/html, image/svg+xml, xml) in href/src/data/formaction/action/xlink:href by default. Wrap in raw() if this is intentional (e.g. bookmarklets), or sanitize upstream.`;
@@ -121,49 +139,54 @@ function bindText(signal) {
121
139
  }
122
140
  return null;
123
141
  }
124
- function wireBindings(rootEl, ctx, prevDisposers) {
142
+ function wireBindings(rootEl, ctx, prevDisposers, rows) {
125
143
  for (const d of prevDisposers) d();
126
144
  if (ctx.list.length === 0) return NO_DISPOSERS;
127
145
  const disposers = [];
128
- wireInto(rootEl, ctx.list, disposers);
146
+ try {
147
+ wireInto(rootEl, ctx.list, disposers, rows);
148
+ } catch (err) {
149
+ for (const d of disposers) d();
150
+ throw err;
151
+ }
129
152
  return disposers;
130
153
  }
131
154
  function wireRowBindings(rowNode, bindings) {
132
- const disposers = new Array(bindings.length);
155
+ const disposers = [];
133
156
  const rootIds = rowNode.getAttribute(BIND_ATTR_ROW);
134
157
  let rootIdSet = null;
135
- let descIndex = null;
136
- let textMarkers = null;
137
- for (let i = 0; i < bindings.length; i++) {
138
- const b = bindings[i];
139
- if (b.kind === "attr") {
140
- let onRoot = false;
141
- if (rootIds !== null) {
142
- if (rootIds === b.id) {
143
- onRoot = true;
144
- } else if (rootIds.indexOf(",") !== -1) {
145
- rootIdSet ??= new Set(rootIds.split(","));
146
- onRoot = rootIdSet.has(b.id);
158
+ let markers = null;
159
+ const rowMarkers = () => markers ??= indexMarkers(rowNode, BIND_ATTR_ROW, ROW_TEXT_PREFIX);
160
+ try {
161
+ for (let i = 0; i < bindings.length; i++) {
162
+ const b = bindings[i];
163
+ if (b.kind === "attr") {
164
+ let onRoot = false;
165
+ if (rootIds !== null) {
166
+ if (rootIds === b.id) {
167
+ onRoot = true;
168
+ } else if (rootIds.indexOf(",") !== -1) {
169
+ rootIdSet ??= new Set(rootIds.split(","));
170
+ onRoot = rootIdSet.has(b.id);
171
+ }
147
172
  }
148
- }
149
- let el;
150
- if (onRoot) {
151
- el = rowNode;
173
+ let el;
174
+ if (onRoot) {
175
+ el = rowNode;
176
+ } else {
177
+ el = rowMarkers().attrs.get(b.id);
178
+ }
179
+ if (el === void 0) continue;
180
+ disposers.push(attachAttrEffect(el, b.attr, b.signal));
152
181
  } else {
153
- descIndex ??= indexAttrEls(rowNode, BIND_ATTR_ROW);
154
- el = descIndex.get(b.id);
182
+ const marker = rowMarkers().texts.get(b.id);
183
+ if (marker === void 0) continue;
184
+ disposers.push(attachTextEffect(marker, b.signal));
155
185
  }
156
- if (el === void 0) continue;
157
- disposers[i] = attachAttrEffect(el, b.attr, b.signal);
158
- } else {
159
- if (textMarkers === null) {
160
- textMarkers = /* @__PURE__ */ new Map();
161
- collectComments(rowNode, ROW_TEXT_PREFIX, textMarkers);
162
- }
163
- const marker = textMarkers.get(b.id);
164
- if (marker === void 0) continue;
165
- disposers[i] = attachTextEffect(marker, b.signal);
166
186
  }
187
+ } catch (err) {
188
+ for (const d of disposers) d();
189
+ throw err;
167
190
  }
168
191
  return disposers;
169
192
  }
@@ -190,28 +213,35 @@ function carryOrRewireRowBindings(node, oldBindings, oldDisposers, newBindings)
190
213
  bindingDisposers: newLen > 0 ? wireRowBindings(node, newBindings) : void 0
191
214
  };
192
215
  }
193
- function wireInto(scope, bindings, disposers) {
194
- const attrEls = indexAttrEls(scope, BIND_ATTR);
195
- const textMarkers = /* @__PURE__ */ new Map();
196
- collectComments(scope, TEXT_MARKER_PREFIX, textMarkers);
216
+ function wireInto(scope, bindings, disposers, rows) {
217
+ const markers = indexMarkers(scope, BIND_ATTR, TEXT_MARKER_PREFIX, rows);
197
218
  for (const b of bindings) {
198
219
  if (b.kind === "attr") {
199
- const el = attrEls.get(b.id);
220
+ const el = markers.attrs.get(b.id);
200
221
  if (el === void 0) continue;
201
222
  disposers.push(attachAttrEffect(el, b.attr, b.signal));
202
223
  } else {
203
- const marker = textMarkers.get(b.id);
224
+ const marker = markers.texts.get(b.id);
204
225
  if (marker === void 0) continue;
205
226
  disposers.push(attachTextEffect(marker, b.signal));
206
227
  }
207
228
  }
208
229
  }
209
- function indexAttrEls(scope, attrName) {
210
- const map = /* @__PURE__ */ new Map();
211
- for (const el of scope.querySelectorAll(`[${attrName}]`)) {
212
- for (const id of el.getAttribute(attrName).split(",")) map.set(id, el);
230
+ function indexMarkers(node, attrName, textPrefix, skip, out = { attrs: /* @__PURE__ */ new Map(), texts: /* @__PURE__ */ new Map() }) {
231
+ for (let c = node.firstChild; c !== null; c = c.nextSibling) {
232
+ if (c.nodeType === Node.COMMENT_NODE) {
233
+ const data = c.data;
234
+ if (data.startsWith(textPrefix))
235
+ out.texts.set(data.slice(textPrefix.length), c);
236
+ } else if (c.nodeType === Node.ELEMENT_NODE) {
237
+ const el = c;
238
+ if (skip?.has(el) || isOverlayHost(el)) continue;
239
+ const ids = el.getAttribute(attrName);
240
+ if (ids !== null) for (const id of ids.split(",")) out.attrs.set(id, el);
241
+ indexMarkers(el, attrName, textPrefix, skip, out);
242
+ }
213
243
  }
214
- return map;
244
+ return out;
215
245
  }
216
246
  function attachAttrEffect(el, attr, signal) {
217
247
  return effect(() => setBoundAttr(el, attr, signal.value));
@@ -235,28 +265,28 @@ function attachTextEffect(marker, signal) {
235
265
  }
236
266
  function setBoundAttr(el, name, value) {
237
267
  if (value == null || value === false) {
238
- el.removeAttribute(name);
239
268
  syncFormProp(el, name, "", false);
269
+ el.removeAttribute(name);
240
270
  return;
241
271
  }
242
272
  if (value === true) {
243
- el.setAttribute(name, "");
244
273
  syncFormProp(el, name, "", true);
274
+ el.setAttribute(name, "");
245
275
  return;
246
276
  }
247
277
  if (isSafeHtmlValue(value)) {
248
- el.setAttribute(name, value.__html);
249
278
  syncFormProp(el, name, value.__html, true);
279
+ el.setAttribute(name, value.__html);
250
280
  return;
251
281
  }
252
282
  const str = String(value);
253
- if (isDangerousUrlValue(name, str)) {
283
+ if (isDangerousUrlValue(name, str, el.localName)) {
254
284
  reportDangerousUrl("kerf binding", name, str);
255
285
  el.removeAttribute(name);
256
286
  return;
257
287
  }
258
- el.setAttribute(name, str);
259
288
  syncFormProp(el, name, str, true);
289
+ el.setAttribute(name, str);
260
290
  }
261
291
  var SAFE_HTML_BRAND = /* @__PURE__ */ Symbol.for("kerfjs.SafeHtml");
262
292
  function isSafeHtmlValue(v) {
@@ -266,23 +296,33 @@ function coerceText(value) {
266
296
  if (value == null || typeof value === "boolean") return "";
267
297
  return String(value);
268
298
  }
269
- function collectComments(node, prefix, out) {
270
- for (let c = node.firstChild; c !== null; c = c.nextSibling) {
271
- if (c.nodeType === Node.COMMENT_NODE) {
272
- const data = c.data;
273
- if (data.startsWith(prefix)) out.set(data.slice(prefix.length), c);
274
- } else if (c.nodeType === Node.ELEMENT_NODE) {
275
- collectComments(c, prefix, out);
276
- }
277
- }
278
- }
279
299
 
280
300
  // src/utils/escapeHtml.ts
301
+ var ENTITIES = {
302
+ "&": "&amp;",
303
+ "<": "&lt;",
304
+ ">": "&gt;",
305
+ '"': "&quot;",
306
+ "'": "&#39;"
307
+ };
308
+ function escapeWith(str, special) {
309
+ special.lastIndex = 0;
310
+ let out = "";
311
+ let last = 0;
312
+ let match;
313
+ while (match = special.exec(str)) {
314
+ out += str.slice(last, match.index) + ENTITIES[match[0]];
315
+ last = special.lastIndex;
316
+ }
317
+ return last ? out + str.slice(last) : str;
318
+ }
319
+ var HTML_SPECIAL = /[&<>"]/g;
320
+ var ATTR_SPECIAL = /[&"'<>]/g;
281
321
  function escapeHtml(str) {
282
- return str.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;");
322
+ return escapeWith(str, HTML_SPECIAL);
283
323
  }
284
324
  function escapeAttr(str) {
285
- return str.replace(/&/g, "&amp;").replace(/"/g, "&quot;").replace(/'/g, "&#39;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
325
+ return escapeWith(str, ATTR_SPECIAL);
286
326
  }
287
327
 
288
328
  // src/utils/jsx-attr-aliases.ts
@@ -386,19 +426,27 @@ var ATTR_ALIASES = {
386
426
  // src/jsx-runtime.ts
387
427
  var SAFE_HTML_BRAND2 = /* @__PURE__ */ Symbol.for("kerfjs.SafeHtml");
388
428
  var SafeHtml = class {
389
- __html;
390
429
  __segment;
391
430
  // Branded so `isSafeHtml()` recognizes instances from any copy of this module.
392
431
  [SAFE_HTML_BRAND2] = true;
432
+ // The flattened HTML, computed on first read. A structured segment wraps its
433
+ // children's segments rather than their strings, so flattening eagerly made
434
+ // every element above an `each()` copy all of the list's row HTML again —
435
+ // O(depth × rows) per render, while `mount()` reads only the segment.
436
+ #html;
393
437
  constructor(input) {
394
438
  if (typeof input === "string") {
395
439
  this.__segment = { kind: "static", html: input };
396
- this.__html = input;
440
+ this.#html = input;
397
441
  } else {
398
442
  this.__segment = input;
399
- this.__html = flatten(input, false);
443
+ if (input.kind === "static") this.#html = input.html;
400
444
  }
401
445
  }
446
+ /** The flattened HTML string (what `toString()` returns). */
447
+ get __html() {
448
+ return this.#html ??= flatten(this.__segment, false);
449
+ }
402
450
  toString() {
403
451
  return this.__html;
404
452
  }
@@ -409,10 +457,10 @@ function isSafeHtml(value) {
409
457
  function raw(html) {
410
458
  return new SafeHtml(html);
411
459
  }
412
- function listSafeHtml(id, items, source) {
460
+ function _listSafeHtml(id, items, source) {
413
461
  return new SafeHtml({ kind: "list", id, items, source });
414
462
  }
415
- function granularListSafeHtml(id, items, patches, source) {
463
+ function _granularListSafeHtml(id, items, patches, source) {
416
464
  return new SafeHtml({ kind: "list", id, items, patches, source });
417
465
  }
418
466
  var VOID_TAGS = /* @__PURE__ */ new Set([
@@ -431,17 +479,22 @@ var VOID_TAGS = /* @__PURE__ */ new Set([
431
479
  "wbr"
432
480
  ]);
433
481
  function toSegment(child) {
434
- if (child == null || typeof child === "boolean") return { kind: "static", html: "" };
482
+ if (child == null || typeof child === "boolean")
483
+ return { kind: "static", html: "" };
435
484
  if (isSignal(child)) {
436
485
  const marker = bindText(child);
437
486
  if (marker !== null) return { kind: "static", html: marker };
438
487
  const v = child.value;
439
- return { kind: "static", html: v == null || typeof v === "boolean" ? "" : escapeHtml(String(v)) };
488
+ return {
489
+ kind: "static",
490
+ html: v == null || typeof v === "boolean" ? "" : escapeHtml(String(v))
491
+ };
440
492
  }
441
493
  if (isSafeHtml(child)) {
442
494
  return child.__segment ?? { kind: "static", html: child.__html };
443
495
  }
444
- if (typeof child === "string") return { kind: "static", html: escapeHtml(child) };
496
+ if (typeof child === "string")
497
+ return { kind: "static", html: escapeHtml(child) };
445
498
  if (typeof child === "number") return { kind: "static", html: String(child) };
446
499
  if (Array.isArray(child)) return mergeChildSegments(child.map(toSegment));
447
500
  const maybeNode = child;
@@ -451,7 +504,7 @@ function toSegment(child) {
451
504
  );
452
505
  }
453
506
  throw new Error(
454
- `JSX: unsupported child of type ${describeValue(child)}. Children must be SafeHtml, string, number, boolean, null, undefined, or an array of those. Common mistakes: passing a Signal/Store object directly (use signal.value or store.state.value), passing a function (call it first), or passing a Promise (await it before render).`
507
+ `JSX: unsupported child of type ${describeValue(child)}. Children must be SafeHtml, string, number, boolean, null, undefined, a signal/computed, or a nested array of those. Common mistakes: passing a Store object directly (use store.state.value), passing a function (call it first), or passing a Promise (await it before render).`
455
508
  );
456
509
  }
457
510
  function describeValue(v) {
@@ -485,12 +538,23 @@ See docs/5-event-delegation.md for the tier-1/tier-2/tier-3 model.`
485
538
  );
486
539
  }
487
540
  }
488
- function renderAttr(key, value) {
489
- return renderAttrNamed(key, ATTR_ALIASES[key] ?? key, value);
490
- }
491
- function renderAttrNamed(key, name, value) {
541
+ var VALIDATED_ATTR_NAMES = /* @__PURE__ */ new Map();
542
+ var VALIDATED_ATTR_NAMES_MAX = 1024;
543
+ function checkAttrName(key, name, isFn) {
544
+ const cached = VALIDATED_ATTR_NAMES.get(name);
545
+ if (cached !== void 0) return cached;
546
+ assertEmittableAttrName(key, name, isFn);
547
+ const isUrl = isUrlAttrName(name);
548
+ if (VALIDATED_ATTR_NAMES.size < VALIDATED_ATTR_NAMES_MAX)
549
+ VALIDATED_ATTR_NAMES.set(name, isUrl);
550
+ return isUrl;
551
+ }
552
+ function renderAttr(key, value, tag) {
553
+ return renderAttrNamed(key, ATTR_ALIASES[key] ?? key, value, tag);
554
+ }
555
+ function renderAttrNamed(key, name, value, tag) {
492
556
  if (value == null || value === false) return "";
493
- assertEmittableAttrName(key, name, typeof value === "function");
557
+ const isUrlAttr = checkAttrName(key, name, typeof value === "function");
494
558
  if (value === true) return ` ${name}`;
495
559
  let strValue;
496
560
  if (isSafeHtml(value)) {
@@ -498,7 +562,7 @@ function renderAttrNamed(key, name, value) {
498
562
  } else if (typeof value === "number") {
499
563
  strValue = String(value);
500
564
  } else if (typeof value === "string") {
501
- if (isDangerousUrlValue(name, value)) {
565
+ if (isUrlAttr && isDangerousUrl(value, isImageUrlSink(tag, name))) {
502
566
  reportDangerousUrl("JSX", name, value);
503
567
  return "";
504
568
  }
@@ -512,38 +576,45 @@ function renderAttrNamed(key, name, value) {
512
576
  }
513
577
  function jsx(tag, props) {
514
578
  if (typeof tag === "function") return tag(props);
515
- const { children, ...attrs } = props;
579
+ const children = props.children;
516
580
  let attrStr = "";
517
581
  let bindIds = null;
518
- for (const [k, v] of Object.entries(attrs)) {
582
+ for (const k in props) {
583
+ if (k === "children" || !Object.hasOwn(props, k)) continue;
584
+ const v = props[k];
519
585
  if (isSignal(v)) {
520
586
  const name = ATTR_ALIASES[k] ?? k;
521
- assertEmittableAttrName(k, name, false);
587
+ checkAttrName(k, name, false);
522
588
  const id = bindAttr(name, v);
523
589
  if (id !== null) {
524
590
  (bindIds ??= []).push(id);
525
591
  continue;
526
592
  }
527
- attrStr += renderAttr(k, v.value);
593
+ attrStr += renderAttr(k, v.value, tag);
528
594
  continue;
529
595
  }
530
- attrStr += renderAttr(k, v);
596
+ attrStr += renderAttr(k, v, tag);
531
597
  }
532
- if (bindIds !== null) attrStr += ` ${bindMarkerAttr()}="${bindIds.join(",")}"`;
598
+ if (bindIds !== null)
599
+ attrStr += ` ${bindMarkerAttr()}="${bindIds.join(",")}"`;
533
600
  if (VOID_TAGS.has(tag)) return new SafeHtml(`<${tag}${attrStr}>`);
534
601
  const childSegment = children != null ? toSegment(children) : { kind: "static", html: "" };
535
- return new SafeHtml(wrapWithTags(childSegment, `<${tag}${attrStr}>`, `</${tag}>`));
602
+ return new SafeHtml(
603
+ wrapWithTags(childSegment, `<${tag}${attrStr}>`, `</${tag}>`)
604
+ );
536
605
  }
537
606
  function Fragment({ children }) {
538
- return new SafeHtml(children != null ? toSegment(children) : { kind: "static", html: "" });
607
+ return new SafeHtml(
608
+ children != null ? toSegment(children) : { kind: "static", html: "" }
609
+ );
539
610
  }
540
611
  function _toSegment(child) {
541
612
  return toSegment(child);
542
613
  }
543
- function _renderAttrVerbatim(name, value) {
544
- return renderAttrNamed(name, name, value);
614
+ function _renderAttrVerbatim(name, value, tag) {
615
+ return renderAttrNamed(name, name, value, tag);
545
616
  }
546
617
 
547
- export { Fragment, ROW_TEXT_PREFIX, SafeHtml, TEXT_MARKER_PREFIX, _renderAttrVerbatim, _setBindingContext, _toSegment, assertEmittableAttrName, bindAttr, bindMarkerAttr, boundTextNodeOf, captureRowBindings, carryOrRewireRowBindings, disposeRowBindings, escapeHtml, granularListSafeHtml, isSafeHtml, jsx, listSafeHtml, newBindingContext, raw, syncFormProp, wireBindings, wireRowBindings };
618
+ export { Fragment, ROW_TEXT_PREFIX, SafeHtml, TEXT_MARKER_PREFIX, _granularListSafeHtml, _listSafeHtml, _renderAttrVerbatim, _setBindingContext, _toSegment, assertEmittableAttrName, bindAttr, bindMarkerAttr, boundTextNodeOf, captureRowBindings, carryOrRewireRowBindings, coerceText, disposeRowBindings, escapeHtml, isSafeHtml, jsx, newBindingContext, raw, syncFormProp, wireBindings, wireRowBindings };
548
619
 
549
- //# sourceMappingURL=chunk-ZDCJZCNO.js.map
620
+ //# sourceMappingURL=chunk-GGADRIQO.js.map