@verajs/renderer 0.1.5 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +975 -27
- package/dist/development/vera-renderer-hydrate.d.ts +32 -13
- package/dist/development/vera-renderer-hydrate.d.ts.map +1 -1
- package/dist/development/vera-renderer-hydrate.js +1786 -231
- package/dist/development/vera-renderer-hydrate.js.map +1 -1
- package/dist/development/vera-renderer-keyed.d.ts +17 -0
- package/dist/development/vera-renderer-keyed.d.ts.map +1 -0
- package/dist/development/vera-renderer-keyed.js +322 -0
- package/dist/development/vera-renderer-keyed.js.map +1 -0
- package/dist/development/vera-renderer-profiler.d.ts +57 -17
- package/dist/development/vera-renderer-profiler.d.ts.map +1 -1
- package/dist/development/vera-renderer-profiler.js +1419 -206
- package/dist/development/vera-renderer-profiler.js.map +1 -1
- package/dist/development/vera-renderer-slots.d.ts +103 -0
- package/dist/development/vera-renderer-slots.d.ts.map +1 -0
- package/dist/development/vera-renderer-slots.js +1387 -0
- package/dist/development/vera-renderer-slots.js.map +1 -0
- package/dist/development/vera-renderer-spread.d.ts +51 -0
- package/dist/development/vera-renderer-spread.d.ts.map +1 -0
- package/dist/development/vera-renderer-spread.js +499 -0
- package/dist/development/vera-renderer-spread.js.map +1 -0
- package/dist/development/vera-renderer-tag.d.ts +61 -0
- package/dist/development/vera-renderer-tag.d.ts.map +1 -0
- package/dist/development/vera-renderer-tag.js +727 -0
- package/dist/development/vera-renderer-tag.js.map +1 -0
- package/dist/development/vera-renderer.d.ts +41 -16
- package/dist/development/vera-renderer.d.ts.map +1 -1
- package/dist/development/vera-renderer.js +1349 -197
- package/dist/development/vera-renderer.js.map +1 -1
- package/dist/vera-renderer-hydrate.min.js +1 -1
- package/dist/vera-renderer-hydrate.min.js.map +1 -1
- package/dist/vera-renderer-keyed.min.js +2 -0
- package/dist/vera-renderer-keyed.min.js.map +1 -0
- package/dist/vera-renderer-slots.min.js +2 -0
- package/dist/vera-renderer-slots.min.js.map +1 -0
- package/dist/vera-renderer-spread.min.js +2 -0
- package/dist/vera-renderer-spread.min.js.map +1 -0
- package/dist/vera-renderer-tag.min.js +2 -0
- package/dist/vera-renderer-tag.min.js.map +1 -0
- package/dist/vera-renderer.min.js +1 -1
- package/dist/vera-renderer.min.js.map +1 -1
- package/package.json +24 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vera-renderer-tag.js","sources":["../../src/dev-values.ts","../../src/spread.ts","../../src/tag.ts"],"sourcesContent":["/**\n * `__DEV__` only: the one home for *\"is this value something an attribute can carry?\"*\n *\n * **Why it is a closed vocabulary and not a predicate.** The first design asked whether a value\n * stringifies meaningfully — `String(v) === '[object Object]'` means it lost its data. Driven\n * through 16 value shapes rather than reasoned about, that broke four ways, and the first is\n * disqualifying: `String()` THROWS on `Object.create(null)`, on `{ toString: null }`, and on any\n * object whose `toString` throws — so a diagnostic would have killed the page for an author using\n * the recommended dictionary idiom. It also passed `[\"a\",\"b\"]` as `\"a,b\"` (one junk class, if that\n * was a `class` binding) and `new Date()` as a timezone-bearing string, which is an SSR/CSR\n * divergence manufactured out of correct-looking code. And it passed `Symbol('s')` while\n * `` `${sym}` `` throws — a guard and its sink disagreeing about a single expression.\n *\n * \"Does it stringify meaningfully\" is an OPEN predicate over an unbounded, environment-dependent\n * space, and open predicates cannot be audited. So the test is inverted and closed: **primitives\n * pass; everything else is reported; anything else that should pass is a named row added on\n * evidence.** The list has exactly one member so far.\n *\n * Credit where it is due: the four breaks were found by the omni engine's session, which drove the\n * shapes rather than arguing about them, and the closed-vocabulary form is theirs.\n */\n\n/**\n * Blessed non-primitives — types whose `toString` IS the value the author means.\n *\n * Tested by brand rather than `instanceof`, which is false across realms: a `URL` built in an\n * iframe is not `instanceof` the parent's `URL`, and a diagnostic that fires on a correct value in\n * one frame and not another is worse than none.\n */\nconst brand = (value: object) => Object.prototype.toString.call(value);\n\n/** One message per element+name+kind, so a value rebuilt every render does not flood the console. */\nlet reported: Set<string> | undefined;\n\n/**\n * Returns the complaint, or `null` when the value is fine. Never throws — the shapes that break a\n * naive guard are exactly the ones worth reporting, so they reach the `object` arm and are named.\n */\nexport const attributeValueComplaint = (tag: string, name: string, value: unknown): string | null => {\n const type = typeof value;\n if (type === 'string' || type === 'number' || type === 'boolean' || type === 'bigint') return null;\n if (type === 'object' && brand(value as object) === '[object URL]') return null;\n\n /**\n * Keyed by BRAND, not by `typeof` — `Date`, `Array` and a plain object are all `'object'`, so a\n * coarser key reported whichever arrived first and silently swallowed the rest. An author who\n * fixed the Date would never have been told about the array.\n */\n const key = `${tag}|${name}|${type === 'object' ? brand(value as object) : type}`;\n reported ??= new Set();\n if (reported.has(key)) return null;\n reported.add(key);\n\n /**\n * A function into an attribute is never what the author meant, but the REASON matters: on a\n * custom element the Lit-era convention is that complex values are set as properties, so\n * `<my-chart formatter={fn}>` is a coherent intention that this sink simply cannot express. The\n * message names the binding that can, rather than blaming the author.\n */\n const said = type === 'function'\n ? `a function, which becomes its own SOURCE TEXT`\n : type === 'symbol'\n ? `a symbol, which every DOM conversion refuses`\n : Array.isArray(value)\n ? `an array, which becomes its members joined by commas`\n : brand(value as object) === '[object Date]'\n ? `a Date, whose text carries the TIMEZONE of whichever side rendered it`\n : `an ${type}, which cannot survive as text`;\n\n /**\n * Returned WITHOUT the `[vera]` prefix, which each call site writes as a literal.\n * `tests/diagnostics-convention.test.mjs` reads the prefix off the call, so a message handed over\n * as a variable is invisible to it — and its answer to that is an allowance list. Taking the\n * allowance would have excused these two calls rather than checked them, which is the\n * reclassification this audit keeps refusing; the literal at the call site is what every other\n * diagnostic in the repo does anyway.\n */\n return (\n `renderer: the attribute \\`${name}\\` on <${tag}> was given ${said}. ` +\n `An attribute value is a string and nothing else.\\n` +\n `If the element is meant to RECEIVE this value, bind a property instead — \\`.${name}=\\${value}\\` ` +\n `— which is how a custom element takes anything that is not text. If it is meant to be read as ` +\n `text, convert it where you know what it means: \\`date.toISOString()\\`, \\`list.join(' ')\\`. ` +\n `A Date in particular serializes with the SERVER's timezone on one side and the browser's on ` +\n `the other, so it will not survive hydration.`\n );\n};\n","import { attributeValueComplaint } from './dev-values.js';\n/**\n * `<div ${spread(props)}>` — bindings whose names are not known when the template is parsed.\n *\n * Template renderers bake attribute names in at parse time; that is what makes them small and fast,\n * and it is why neither this renderer nor lit-html has had spread. Lit's spread PR has sat open as a\n * draft since 2021, blocked on the questions answered below.\n *\n * **Why this ships separately.** The renderer holds one property read — a value at element position\n * carrying `_$apply$` applies itself — and nothing else, so a base bundle grows 16 B rather than\n * 176 B and an app that never spreads pays only that. Core and the renderer are the two packages\n * where weight is absolute; this is not one of them, but it is still measured.\n *\n * The sigil rules are repeated here rather than shared through `@verajs/shared-utils`. That was\n * tried: a shared resolver has to hand back both a kind and a name, and the tuple it allocates cost\n * the renderer 10 B. Principle #5 permits deliberate duplication where two callers can legitimately\n * diverge; #7 decides it, because the renderer is where bytes are not negotiable.\n */\n\nconst ATTR = 0;\nconst PROPERTY = 1;\nconst BOOLEAN = 2;\n/** `!name` — a property compared against the live DOM rather than against what this last wrote. */\nconst LIVE = 3;\nconst EVENT = 4;\nconst REF = 5;\n\n/**\n * A key that cannot be written into a tag, and therefore cannot be used at all.\n *\n * Measured in Chromium, `setAttribute` accepts `\"`, `'` and `<` and rejects whitespace, `>`, `=`,\n * `/` and NUL — but a name carrying a quote or a `<` cannot survive **markup**, so `@verajs/ssr`\n * has to refuse it, and a key that works here and vanishes server-side is worse than one that works\n * nowhere. The rule is therefore the HTML attribute-name restriction (control characters,\n * whitespace, `\"`, `'`, `>`, `/`, `=`) plus `<` and a backtick, applied identically on both sides.\n *\n * Skipped rather than thrown. `setAttribute` throws `InvalidCharacterError` on some of these, which\n * took down the whole render — for one bad key in a props bag, on a binding whose entire purpose is\n * names that are not known until runtime.\n *\n * The control-character range is the point of the rule, not a mistake in it: a name carrying one\n * is exactly what must never reach markup.\n */\n// eslint-disable-next-line no-control-regex\nconst UNSAFE_NAME = /^$|[\\s\"'>/=<`]|[\\u0000-\\u001f\\u007f]/;\n\n/**\n * **Sinks spread refuses, because spread is the one place the template security model breaks.**\n *\n * The renderer's posture on `.innerHTML` (README, \"security\") rests on three properties of the\n * template spelling: greppable, obviously yours, reviewable as the decision it is. A spread key\n * arrives at RUNTIME inside a props object — often built from data — and has none of the three:\n * `spread(fromJson)` carrying `.innerHTML` or an inline `onclick` attribute is markup or code\n * injection through a door no grep can see. So spread refuses the sinks and points at the template\n * spelling, which remains fully available to an author who means it.\n *\n * The list, deliberately minimal and named: `innerHTML`/`outerHTML` as property or live-property\n * keys; `srcdoc` as an attribute (an iframe's inline document); and any attribute whose name the\n * browser would treat as an inline handler (`on…` in any casing) — EXCEPT the documented event\n * spelling `on` + Capital, which the constructor converts to a real listener and which therefore\n * never becomes an attribute. The exemption mirrors the constructor's test byte for byte, because\n * `ONCLICK` must not slip through as \"looks like the event spelling\": the constructor only\n * converts a lowercase `on`, so only that exact shape is exempt.\n *\n * Returns the hint for the diagnostic, or null for a permitted key.\n */\nconst refusedSink = (key: string): string | null => {\n const first = key[0];\n if (first === '.' || first === '!') {\n const name = key.slice(1);\n if (name === 'innerHTML' || name === 'outerHTML')\n return 'write it in the template — html`<div .innerHTML=${trusted}>` — sanitized first (renderer README, security note)';\n /**\n * `element.__proto__ = value` is not a property write — it hits Object.prototype's\n * `__proto__` ACCESSOR and replaces the element's prototype, stripping every DOM method it\n * has. The element is bricked, and the crash lands LATER, in whatever binding next calls\n * `removeAttribute` on it — a data-driven render-kill with a stack that names the renderer\n * and not the data. Found by the run-14 payload probe; there is no legitimate use, so unlike\n * `.innerHTML` there is no template spelling to point at.\n */\n /** The deliberate twin of the same refusal in `AttrPart`'s constructor (`./renderer.ts`), for\n * the template spellings `.name` / `!name`. Independent bundles, neither imports the other, so\n * the rule is copied — and a fix visits both. `tests/dangerous-binding-matrix.test.mjs` holds\n * the two spellings to the same answer. */\n if (name === '__proto__')\n return \"assigning __proto__ replaces the element's own prototype and destroys it — no property write does this, and no use of it is legitimate\";\n return null;\n }\n if (first === '?' || first === '@' || first === '&') return null;\n /** The event spelling the constructor converts: `on` + Capital, lowercase `on` only. */\n if (first === 'o' && key.charCodeAt(1) === 110 && key.charCodeAt(2) > 64 && key.charCodeAt(2) < 91) return null;\n const lower = key.toLowerCase();\n if (lower === 'srcdoc') return 'an inline iframe document is markup injection by definition — bind it in the template if you truly mean it';\n if (lower.length > 2 && lower.startsWith('on'))\n return 'an inline handler attribute is code from data — pass a function as `on` + Capital (onClick) or `@click` instead';\n return null;\n};\n\n/** Module-local: one identity comparison, not a global symbol-registry lookup per binding. */\nconst UNSET = Symbol();\n\n/**\n * A class, not an object literal, so `handleEvent` exists once on the prototype. As a literal it was\n * a fresh closure per bound key — allocation proportional to the size of every props bag.\n */\nclass Binding {\n _kind: number;\n _name: string;\n _element: Element;\n /** What the element held before this binding took over. Releasing puts it back. */\n _initial: unknown;\n _committed: unknown = UNSET;\n _handler: EventListener | null = null;\n\n constructor(element: Element, key: string) {\n const first = key[0];\n let kind =\n first === '.'\n ? PROPERTY\n : first === '?'\n ? BOOLEAN\n : first === '@'\n ? EVENT\n : first === '&'\n ? REF\n : first === '!'\n ? LIVE\n : ATTR;\n let name = kind ? key.slice(1) : key;\n /** `on` + a capital: `onClick` ≡ `@click`. All-lowercase `onclick` never reaches here — it is\n * an inline-handler attribute, which `refusedSink` rejects before a binding exists. */\n if (kind === ATTR && first === 'o' && key.charCodeAt(1) === 110 && key.charCodeAt(2) > 64 && key.charCodeAt(2) < 91) {\n kind = EVENT;\n name = key.slice(2).toLowerCase();\n }\n this._kind = kind;\n this._name = name;\n this._element = element;\n this._initial =\n kind === ATTR\n ? element.getAttribute(name)\n : kind === BOOLEAN\n ? element.hasAttribute(name)\n : kind === PROPERTY || kind === LIVE\n ? (element as unknown as Record<string, unknown>)[name]\n : null;\n }\n\n /**\n * **Two shapes, because `addEventListener` takes two** — the same rule `AttrPart.handleEvent`\n * applies, and it did not travel here when that one was fixed. A function is called with the\n * element as `this`; an object with a `handleEvent` method is invoked through it — the platform's\n * own `EventListenerObject` protocol, which every engine accepts. This called `.call()`\n * unconditionally, so `spread({ onClick: { handleEvent } })` bound without complaint, never\n * fired, and raised `this._handler.call is not a function` on **every** dispatch — while the\n * identical value through a written `@click` worked.\n *\n * Anything else is inert rather than throwing, exactly as there: development names it at the\n * binding (see the event branch in `write`), where the mistake still is.\n */\n handleEvent(event: Event) {\n const handler = this._handler as EventListener | EventListenerObject | null;\n if (typeof handler === 'function') handler.call(this._element as never, event);\n else if (typeof (handler as EventListenerObject)?.handleEvent === 'function')\n (handler as EventListenerObject).handleEvent(event);\n }\n}\n\n/**\n * Keyed by the **part**, not the element.\n *\n * Keyed by element, `<div ${spread(a)} ${spread(b)}>` shares one map: whichever applies second sees\n * the other's keys as absent from its own props and releases them. Measured — the first spread's\n * attributes silently vanished. The part is one per element-position slot, which is exactly the\n * ownership boundary, and the renderer reuses it across renders.\n */\nconst owned = new WeakMap<object, Map<string, Binding>>();\n\nconst write = (binding: Binding, value: unknown) => {\n /** One comparison per key per render — the same dirty check a written binding gets. */\n /**\n * A live property asks the element rather than its own memory — see `AttrPart` in the renderer.\n * The dirty check is what keeps a field someone typed into, and it is exactly wrong for a control\n * whose DOM state changes when a *sibling* is interacted with, a radio group being the case.\n */\n if (binding._kind === LIVE) {\n binding._committed = value;\n const live = binding._element as unknown as Record<string, unknown>;\n if (live[binding._name] !== value) live[binding._name] = value;\n return;\n }\n if (value === binding._committed) return;\n binding._committed = value;\n const element = binding._element;\n const name = binding._name;\n const kind = binding._kind;\n if (kind === ATTR) {\n if (value == null) element.removeAttribute(name);\n else {\n if (__DEV__) {\n const complaint = attributeValueComplaint(element.localName, name, value);\n if (complaint !== null) console.warn(`[vera] ${complaint}`);\n }\n /**\n * `` `${value}` ``, never `String(value)` — the two differ on exactly one thing and it is the\n * one that matters here. `String(sym)` returns `\"Symbol(s)\"` while every DOM conversion and\n * `@verajs/ssr`'s own escaper throw, so this sink was the ONLY one of three that accepted a\n * symbol, writing to the client an attribute the server refuses to produce. The rule was\n * already recorded in `@verajs/ssr`'s `escapeHtml` — \"serving Symbol(s) into markup the client\n * cannot reproduce does not make anything work, it moves the failure across the boundary and\n * strips the context\" — and this file used the other form anyway. A house rule written down\n * in one of three homes is a house rule in none of them.\n */\n element.setAttribute(name, `${value}`);\n }\n } else if (kind === PROPERTY) {\n (element as unknown as Record<string, unknown>)[name] = value;\n } else if (kind === BOOLEAN) {\n element.toggleAttribute(name, !!value);\n } else if (kind === REF) {\n /**\n * `&name` is the written form's ref sigil (`<input &field=${myRef} />`), and it was the one\n * binding kind a spread could not express: the key fell through to `ATTR` and\n * `setAttribute('&field', …)` threw on the client while the server wrote `&field=\"[object\n * Object]\"` into the markup. A function is called with the element, an object gets it assigned\n * to `.value` — the same two shapes `AttrPart` handles.\n */\n if (typeof value === 'function') (value as (el: Element) => void)(element);\n else if (value !== null && typeof value === 'object') (value as { value: unknown }).value = element;\n } else {\n /**\n * A listener is validated when a *user* clicks, which in development may be never — so it is\n * checked where it is written, the same rule `AttrPart` applies to `@event`. `false` stays\n * silent: `{ onClick: enabled && onClick }` is the ordinary conditional form and already\n * behaves correctly, since `handleEvent` finds nothing callable and does nothing.\n */\n if (__DEV__ && value != null && value !== false && typeof value !== 'function' &&\n typeof (value as EventListenerObject)?.handleEvent !== 'function')\n console.warn(\n `[vera] spread: @${name} on <${element.localName}> was given ` +\n `${typeof value === 'object' ? 'an object with no handleEvent method' : `a ${typeof value}`}, ` +\n `which cannot listen — the event will do nothing.\\n` +\n `Pass a function, or an object with a handleEvent method. A missing handler is ` +\n `\\`undefined\\` or \\`false\\`, both of which are fine; this is neither.`\n );\n if (binding._handler === null && value != null) element.addEventListener(name, binding);\n binding._handler = (value as EventListener) ?? null;\n }\n};\n\n/**\n * A key that disappeared between renders restores what the element held before the binding existed.\n *\n * This is the question Lit's PR is stuck on, and the trap is asking it as \"what value means absent\".\n * For a property there is no answer: assigning `undefined` runs through coercing setters, so\n * dropping `.value` yields `\"\"` rather than reverting, and `delete` cannot remove a prototype\n * accessor. Asked instead as *\"undo what this binding did\"* it is well defined for every kind and\n * never invents a value the author did not write — the initial state was, by definition, acceptable\n * before the binding arrived.\n *\n * And asked that way it needs no code of its own: releasing is writing the initial value back.\n * `null` removes an attribute, `false` untoggles a boolean, `undefined` restores a property to\n * pristine, and an event handler falls to `null` — every case the existing commit already handles.\n * The separate per-kind teardown this replaced was fourteen lines saying the same thing twice.\n *\n * Deliberately unguarded by an ownership check (`is the value still the one we wrote?`). That only\n * matters when a component reassigns a property its parent is binding, which is already confused;\n * per principle #3 the machinery waits for evidence rather than being pre-built.\n */\nfunction apply(this: { _props: Record<string, unknown> }, element: Element, part: object) {\n const props = this._props;\n let bindings = owned.get(part);\n if (bindings === undefined) owned.set(part, (bindings = new Map()));\n\n /**\n * Counted here rather than with `Object.keys(props).length`, which allocates an array on every\n * render of every spread — garbage in the render path, for a number already being walked.\n */\n let count = 0;\n for (const key in props) {\n count++;\n /**\n * Counted before it is skipped, so the size comparison below still describes the key set — a\n * refused key that changed the count would make every render look like a removal.\n */\n if (UNSAFE_NAME.test(key[0] === '.' || key[0] === '?' || key[0] === '@' || key[0] === '&' ? key.slice(1) : key)) {\n if (__DEV__)\n console.warn(\n `[vera] spread: ignoring the key ${JSON.stringify(key)} — an attribute name ` +\n `cannot contain whitespace, a quote, \\`<\\`, \\`>\\`, \\`/\\`, \\`=\\` or a control character, ` +\n `and one that cannot be written into markup would not survive server rendering.`\n );\n continue;\n }\n /** Counted above for the same reason the unsafe skip is. */\n const refused = refusedSink(key);\n if (refused !== null) {\n if (__DEV__)\n console.warn(\n `[vera] spread: refusing ${JSON.stringify(key)} — spread names arrive at runtime, which is ` +\n `exactly the property that makes this sink unreviewable; ${refused}.`\n );\n continue;\n }\n let binding = bindings.get(key);\n if (binding === undefined) bindings.set(key, (binding = new Binding(element, key)));\n write(binding, props[key]);\n }\n\n /**\n * A size mismatch is the only way a key can have gone: every key in `props` was just visited, so\n * equal sizes means equal sets. The steady-state render of an unchanged shape — overwhelmingly the\n * common case — costs one integer comparison, not a scan.\n */\n if (bindings.size !== count) {\n for (const [key, binding] of bindings) {\n if (key in props) continue;\n bindings.delete(key);\n write(binding, binding._initial);\n }\n }\n}\n\n/**\n * The server half of the protocol: hand back every binding, resolved, and let the renderer that\n * asked decide what belongs in markup.\n *\n * Deliberately *not* a serializer. This package knows what a key means — `.value` is a property,\n * `?disabled` a boolean, `onClick` an event — and nothing else. Whether a property belongs in\n * server markup (`value`, `checked`, `selected` do; the rest are client state) and how a value is\n * escaped are `@verajs/ssr`'s decisions, and principle #8 wants escaping in exactly one place. So\n * this returns data, never a string.\n *\n * Kinds are single characters rather than the module's numeric constants, because this crosses a\n * package boundary: `a`ttribute, `b`oolean, `p`roperty, `e`vent, `r`ef. A ref is client state with\n * no markup, exactly like an event, and the serializer drops both.\n */\nfunction attributes(this: { _props: Record<string, unknown> }): [string, string, unknown][] {\n const out: [string, string, unknown][] = [];\n for (const key in this._props) {\n /** The client refusal, applied at the serializer boundary too — one predicate, both renders.\n * Without this, a refused key was merely inert in the browser and LIVE in server markup. */\n if (refusedSink(key) !== null) continue;\n const first = key[0];\n /** `!` reports as a property: the server has nothing to re-read, so it serializes as `.` does. */\n const kind =\n first === '.' || first === '!'\n ? 'p'\n : first === '?'\n ? 'b'\n : first === '@'\n ? 'e'\n : first === '&'\n ? 'r'\n : 'a';\n if (kind !== 'a') {\n out.push([kind, key.slice(1), this._props[key]]);\n } else if (first === 'o' && key.charCodeAt(1) === 110 && key.charCodeAt(2) > 64 && key.charCodeAt(2) < 91) {\n out.push(['e', key.slice(2).toLowerCase(), this._props[key]]);\n } else {\n out.push(['a', key, this._props[key]]);\n }\n }\n return out;\n}\n\n/**\n * Branded rather than duck-typed: the element position already means \"element ref\", and a props bag\n * is indistinguishable from a ref object — `{ value: 5 }` is legitimately either.\n */\nexport const spread = (props: Record<string, unknown>) => {\n /**\n * **A props bag that is not an object is iterated anyway, and a browser accepts the result.**\n *\n * Everything below reads `props` with `Object.keys`/`Object.entries`, which answer for any value:\n * a **string** yields its character indices, so `spread('text')` sets four attributes named `0`,\n * `1`, `2`, `3` — measured in Chromium, with no error and no warning. A number, a boolean and\n * `null` yield nothing at all, so `spread(someUndefinedVariable)` applies no props and says\n * nothing, which reads as a renderer that ignored the spread.\n *\n * **jsdom hides this rather than catching it.** It implements the XML Name production and throws\n * `InvalidCharacterError` on `setAttribute('0', …)`, so a probe under jsdom sees a loud failure\n * for the case a real engine performs silently — the inverse of the usual trap, and the reason\n * this was verified in a browser before being called a defect (`tests/browser/spread-names.test.js`\n * records the engines' actual rule).\n *\n * Warned and ignored rather than thrown, which is exactly what an unusable *key* already does a\n * few lines above: one bad props bag should not cost the render.\n *\n * **The message is `__DEV__`-only; the refusal is not.** They were both inside the guard, which\n * made the two builds behave differently for the same code — and differently in the direction that\n * hides the bug. Measured: `spread('text')` applies nothing in development, so the app under test\n * looks fine; in production the string is iterated by character index and the element ends up with\n * attributes named `0`, `1`, `2` and `3` (under jsdom, an `InvalidCharacterError` instead — the\n * usual inversion, and why this was measured against both builds rather than reasoned about).\n *\n * A diagnostic belongs in `__DEV__`. A guard that changes what the program does cannot, or the\n * development build stops being a faithful model of the production one, which is the property that\n * makes testing in it worth anything. Costs 27 B gzipped (842 → 869, A-B-A) and buys the two builds agreeing.\n */\n if (props === null || typeof props !== 'object' || Array.isArray(props)) {\n if (__DEV__)\n console.warn(\n `[vera] spread: ignoring a props bag that is not a plain object — received ` +\n `${Array.isArray(props) ? 'an array' : typeof props === 'object' ? 'null' : `a ${typeof props}`}. ` +\n `A string is iterated by character index, so \\`spread('text')\\` would set attributes named ` +\n `0, 1, 2 and 3; anything else applies nothing at all. This is usually an import or a ` +\n `property that resolved to something unexpected.`\n );\n props = {};\n }\n return {\n _props: props,\n _$apply$: apply,\n _$attrs$: attributes,\n };\n};\n","import { spread } from './spread.js';\n\n/**\n * `@verajs/renderer/tag` — an element whose **tag name** is decided at runtime.\n *\n * A template renderer bakes tag names into its statics; that is what makes template identity work\n * and what every fast path in this renderer depends on. So a runtime tag cannot be a binding — it\n * has to become part of the statics *before* the renderer sees the template, which is what this\n * entry does. Downstream nothing changes: the renderer, `@verajs/ssr` and hydration all receive an\n * ordinary template and are unaware this exists.\n *\n * ```js\n * import { html, tag } from '@verajs/renderer/tag';\n *\n * const HEADING = { 1: tag`h1`, 2: tag`h2`, 3: tag`h3` };\n * const H = HEADING[state.level];\n * html`<${H} class=\"title\">${state.text}</${H}>`;\n * ```\n *\n * **A tag is also a JSX component**, so the same value works in both notations with no compiler\n * change — `<H className=\"title\">{state.text}</H>` compiles to `H({…})`, which is exactly what a\n * capitalized JSX tag already compiles to.\n *\n * Additive, like `@verajs/renderer/spread` and unlike the other entries: it inlines no renderer\n * internals, so it is safe alongside any of them.\n */\n\n/** The brand a tag carries. `_$…$` is exempt from this package's `/^_[a-z]/` property mangling. */\nconst STATIC = '_$static$';\n\ntype Tag = ((props?: Record<string, unknown>) => unknown) & { [STATIC]: string };\n\n/**\n * Spliced statics, keyed by the call site's own `strings` array and then by the tags in it.\n *\n * The cache is the whole reason this works. `_shape === value.strings` is the renderer's identity\n * check, so a fresh array per render would never match and every render would rebuild the subtree.\n * A `WeakMap` on the call site's array means the entries die with the module that holds them, and\n * the inner keys are bounded by the tags in the source — which is exactly what `tag` refusing a\n * string guarantees.\n */\nconst caches = new WeakMap<TemplateStringsArray, Map<string, string[]>>();\n\n/**\n * The `html` to use in a template containing a runtime tag. With no tags in it, this is the\n * ordinary template shape and costs one loop.\n *\n * It builds `{ _$litType$: 1, strings, values }` directly rather than calling core's `html`, so this\n * entry keeps the renderer's independence from core. The consequence is that a `setHtml` swap does\n * not reach here — which is right, since a swapped `html` belongs to a different renderer and this\n * is a renderer feature.\n */\nexport const html = (strings: TemplateStringsArray, ...values: unknown[]) => {\n let key = '';\n for (let i = 0; i < values.length; i++) {\n const value = values[i] as Tag | undefined;\n if (value && value[STATIC] !== undefined) key += `${i}:${value[STATIC]};`;\n /**\n * A non-tag in **tag position** — `<${name}>` with a string. The refusal is the whole security\n * property of this entry, and it lived only in `tag` itself, which guards interpolation into a\n * tag literal. Reaching the position through `html` instead produced no error and no element:\n * the base scanner reads the expression as an element ref on a tag with no name, and the page\n * gets escaped punctuation where the markup should be.\n *\n * The static before a value is what identifies the position, so this is the one place that can\n * see it. `__DEV__`-only; production carries neither the check nor the text.\n */\n else if (__DEV__ && (strings[i].endsWith('<') || strings[i].endsWith('</'))) {\n throw new Error(\n `tag: a ${value === null ? 'null' : typeof value} cannot become markup. ` +\n `Only a tag may be interpolated into tag position:\\n\\n` +\n ` const heading = tag\\`h\\${level}\\`; // built from other tags\\n` +\n ` html\\`<\\${heading}>…</\\${heading}>\\`\\n\\n` +\n `That is what keeps the set of tags an app can produce fixed by its source.`\n );\n }\n }\n if (key === '') return { ['_$litType$']: 1, strings, values };\n\n let byTags = caches.get(strings);\n if (byTags === undefined) caches.set(strings, (byTags = new Map()));\n let spliced = byTags.get(key);\n if (spliced === undefined) {\n spliced = [];\n let run = strings[0];\n for (let i = 0; i < values.length; i++) {\n const value = values[i] as Tag | undefined;\n if (value && value[STATIC] !== undefined) run += value[STATIC] + strings[i + 1];\n else {\n spliced.push(run);\n run = strings[i + 1];\n }\n }\n spliced.push(run);\n byTags.set(key, spliced);\n }\n\n const bindings: unknown[] = [];\n for (let i = 0; i < values.length; i++) {\n const value = values[i] as Tag | undefined;\n if (!(value && value[STATIC] !== undefined)) bindings.push(value);\n }\n return { ['_$litType$']: 1, strings: spliced, values: bindings };\n};\n\n/**\n * React's names, mapped the way `@verajs/jsx` maps them on a written element — so `<H1\n * className=\"t\" disabled={d}>` and `<h1 className=\"t\" disabled={d}>` mean the same thing.\n *\n * Not cosmetic. Passed through raw, `disabled={false}` becomes the attribute `disabled=\"false\"`,\n * and any value at all disables the control; `className` lands as `classname` and never applies.\n *\n * Deliberately duplicated from the transform rather than shared through a package: the two are\n * build-time and runtime, and `tests/jsx-name-mapping.test.mjs` asserts they agree on every key —\n * which is the drift protection a shared module would have bought, without the dependency.\n */\nconst NAME_MAP: Record<string, string> = { className: 'class', htmlFor: 'for' };\nconst PROPERTIES: Record<string, string> = { value: '.value', checked: '.checked' };\nconst DEFAULTS: Record<string, string> = { defaultValue: 'value', defaultChecked: '?checked' };\n/**\n * The props that name a BINDING rather than an attribute — and the reason this table is here and\n * not in the transform's twin.\n *\n * The compiler must NOT rewrite these on a component: `<Card ref={r}>` hands `ref` to `Card`, which\n * decides what it means, exactly as React does. But a tag's component forwards to a real element,\n * so at THIS boundary — and only here — `ref` has a binding to become. Before 2026-09-12 it had\n * none: it fell through to the attribute sink and `<H ref={r}>` wrote the FUNCTION'S SOURCE TEXT\n * into the DOM as `ref=\"el => (got = el)\"`, which under SSR shipped the closure body to the client,\n * while the identical `<h1 ref={r}>` bound correctly.\n */\nconst BINDINGS: Record<string, string> = { ref: '&ref' };\nexport const BOOLEAN_ATTRIBUTES = new Set([\n 'disabled', 'hidden', 'readonly', 'required', 'open', 'selected', 'multiple',\n 'autofocus', 'autoplay', 'controls', 'loop', 'muted', 'playsinline', 'inert', 'reversed',\n]);\n\nexport const jsxName = (key: string): string =>\n NAME_MAP[key] ?? PROPERTIES[key] ?? DEFAULTS[key] ?? BINDINGS[key] ?? (BOOLEAN_ATTRIBUTES.has(key) ? `?${key}` : key);\n\n/**\n * Declares a tag name.\n *\n * **A string can never become one.** Only another tag may be interpolated, so the set of tags an\n * app can produce is fixed by its source — which is what keeps a tag out of reach of a request, and\n * incidentally what bounds the template cache. There is no `unsafeStatic` here for the same reason\n * there is no `unsafeHTML`: a sanctioned opt-out reads as blessed in tutorials and in review.\n */\nexport const tag = (strings: TemplateStringsArray, ...values: unknown[]): Tag => {\n /**\n * A *template tag*, so it is written `` tag`h1` `` and not `tag('h1')`. The call form is the\n * likelier mistake of the two and failed with `Cannot read properties of undefined (reading '0')`,\n * which says nothing about either.\n */\n if (__DEV__ && (!strings || !Array.isArray((strings as unknown as { raw?: unknown[] }).raw)))\n throw new TypeError(\n `tag: expected a template literal and received ${String(strings)}. ` +\n \"It is a tagged template — write tag`h1`, not tag('h1').\"\n );\n let text = strings[0];\n for (let i = 0; i < values.length; i++) {\n const value = values[i] as Tag | undefined;\n if (!value || value[STATIC] === undefined)\n throw new Error('tag: only another tag may be interpolated — a string cannot become markup');\n text += value[STATIC] + strings[i + 1];\n }\n\n /**\n * **A tag's text must be an element NAME.** Until this, it was an unconstrained string spliced\n * straight into the statics — so `` tag`div onclick=x` `` produced markup rather than a tag, and\n * the name of this export was a description of intent rather than of behaviour.\n *\n * The concrete failure it closes is a cache collision. Spliced statics key on\n * `` `${i}:${text};` `` per tag, joined with separators the text was free to contain, so two\n * DIFFERENT tag assignments at one call site could derive the same key and reuse each other's\n * markup. Measured: at a two-tag call site, `(a, \"b;1:c\")` and `(\"a;1:b\", c)` both derive\n * `\"0:a;1:b;1:c;\"`, and the second render came back as the FIRST one's markup.\n *\n * Escaping the separators would have fixed that one collision. Constraining the name fixes the\n * class — no name can contain a separator, so no key can be ambiguous, and the export delivers\n * what it is called. A closed grammar beats a wider escape, which is the same ruling this audit\n * reached for the attribute-value sink.\n *\n * Unconditional, like the interpolation refusal above and unlike the shape check: both are about\n * what may become markup, and a production build is where that matters most.\n */\n if (!/^[a-zA-Z][a-zA-Z0-9._-]*$/.test(text))\n throw new Error(\n /**\n * The THROW is unconditional; its EXPLANATION is not. Carrying the full sentence cost 178 B\n * gzipped here — most of a 1.9 KB entry — for text an author reads once and a production\n * page never reaches. Core's static-render refusal is shaped the same way for the same\n * measurement.\n */\n __DEV__\n ? `tag: ${JSON.stringify(text)} is not an element name. A tag names ONE element — letters, ` +\n `then letters, digits, '.', '_' or '-' — and nothing else becomes markup here.\\n` +\n `Attributes and content belong in the template: html\\`<\\${heading} class=\"title\">…</\\${heading}>\\`.`\n : 'tag: not an element name'\n );\n\n /**\n * The tag is a function, which is what makes it a JSX component: the compiler emits `H({…})` for\n * a capitalized tag, and this is what receives that call. `children` is JSX's own key; everything\n * else goes through `spread`, since the names are not known when this template is written.\n */\n const self = ((\n { children, key, dangerouslySetInnerHTML: rawHtml, ...props }: Record<string, unknown> = {}\n ) => {\n /**\n * **`key` and `dangerouslySetInnerHTML` come out of the bag by name**, because neither is an\n * attribute and the sink they fell into accepts anything. `key` became the literal attribute\n * `key=\"7\"` on the element AND cost the list its identity — rows then reconciled positionally,\n * so focus, scroll and input state followed the index rather than the item.\n *\n * `@verajs/jsx` consumes `key` into `keyed(…)` before this is ever called, so the compiled path\n * never reaches here. This is the HAND-CALL backstop — `H({ key: id })` — where no compiler is\n * looking, and dropping it silently would be a refusal with no channel, hence the warning.\n */\n if (__DEV__ && key !== undefined)\n console.warn(\n `[vera] tag: \\`key\\` does nothing on a tag component and has been dropped — a key marks a ` +\n `template for list reconciliation, and this call returns one rather than being one.\\n` +\n `In JSX, write it and the compiler handles it: \\`<Row key=\\${id}>\\` becomes ` +\n `\\`keyed(id, Row({…}))\\`. Calling by hand, wrap it yourself: \\`keyed(id, Row({…}))\\`.`\n );\n /**\n * **`dangerouslySetInnerHTML` cannot work here, and that is a security property rather than a\n * gap.** A tag reaches its element through `spread`, and `spread` REFUSES `.innerHTML` on\n * purpose: its names arrive at runtime, which is what makes that sink unreviewable. Mapping the\n * prop was tried and measured — 37 B for a value `spread` then declined, so the bytes bought a\n * console message. Refused here instead, where the reason can be said.\n */\n if (__DEV__ && rawHtml !== undefined)\n console.warn(\n `[vera] tag: \\`dangerouslySetInnerHTML\\` is not available on a tag component and has been ` +\n `dropped. A tag binds through \\`spread\\`, whose names are only known at runtime — so it ` +\n `refuses \\`.innerHTML\\` outright rather than open an unreviewable HTML sink.\\n` +\n `Write the element directly, with the value sanitized first: ` +\n `html\\`<\\${Tag} .innerHTML=\\${trusted}>\\` (see the renderer README's security note).`\n );\n const mapped: Record<string, unknown> = {};\n for (const name in props) mapped[jsxName(name)] = props[name];\n return html`<${self} ${spread(mapped)}>${children}</${self}>`;\n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AC/B;AAEH;;;;AAIG;AACH,IAAA,MAAM,IAAI,IAAI,CACZ,EAAE,QAAQ,EAAE,GAAG,EAAE,uBAAuB,EAAE,OAAO,EAAE,GAAG,KAAK,EAAA,GAA8B,EAAE,KACzF;AACF;;;;;;;;;AASG;AACH,QAAA,IAAI,OAAO,IAAI,GAAG,KAAK,SAAS;YAC9B,OAAO,CAAC,IAAI,CACV,CAAA,yFAAA,CAA2F;gBACzF,CAAA,oFAAA,CAAsF;gBACtF,CAAA,2EAAA,CAA6E;AAC7E,gBAAA,CAAA,oFAAA,CAAsF,CACzF;AACH;;;;;;AAMG;AACH,QAAA,IAAI,OAAO,IAAI,OAAO,KAAK,SAAS;YAClC,OAAO,CAAC,IAAI,CACV,CAAA,yFAAA,CAA2F;gBACzF,CAAA,uFAAA,CAAyF;gBACzF,CAAA,6EAAA,CAA+E;gBAC/E,CAAA,4DAAA,CAA8D;AAC9D,gBAAA,CAAA,mFAAA,CAAqF,CACxF;QACH,MAAM,MAAM,GAA4B,EAAE;QAC1C,KAAK,MAAM,IAAI,IAAI,KAAK;YAAE,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,GAAG,KAAK,CAAC,IAAI,CAAC;AAC7D,QAAA,OAAO,IAAI,CAAA,CAAA,CAAA,EAAI,IAAI,IAAI,MAAM,CAAC,MAAM,CAAC,CAAA,CAAA,EAAI,QAAQ,CAAA,EAAA,EAAK,IAAI,GAAG;AAC/D,IAAA,CAAC,CAAQ;AACT,IAAA,IAAI,CAAC,MAAM,CAAC,GAAG,IAAI;AACnB,IAAA,OAAO,IAAI;AACb;;;;"}
|
|
@@ -65,15 +65,6 @@ type TemplateResult = {
|
|
|
65
65
|
/** Set by `keyed()`; drives keyed list reconciliation. */
|
|
66
66
|
key?: unknown;
|
|
67
67
|
};
|
|
68
|
-
/**
|
|
69
|
-
* Marks a template result with a stable key so list reconciliation moves it instead of rewriting
|
|
70
|
-
* it. Key all items in a list or none — mixing is undefined behaviour, as are duplicate keys.
|
|
71
|
-
*
|
|
72
|
-
* ```js
|
|
73
|
-
* rows.map((r) => keyed(r.id, html`<tr>...</tr>`))
|
|
74
|
-
* ```
|
|
75
|
-
*/
|
|
76
|
-
declare const keyed: <T>(key: unknown, result: T) => T;
|
|
77
68
|
/**
|
|
78
69
|
* Preserves the DOM of templates a child position toggles away from, instead of destroying it —
|
|
79
70
|
* form values, scroll positions and media playback survive the round trip (lit-html calls this
|
|
@@ -82,21 +73,55 @@ declare const keyed: <T>(key: unknown, result: T) => T;
|
|
|
82
73
|
* ```js
|
|
83
74
|
* html`<div>${hold(editing ? editor() : viewer())}</div>`
|
|
84
75
|
* ```
|
|
76
|
+
*
|
|
77
|
+
* **Anything that is not a template passes straight through.** There is nothing to park for a
|
|
78
|
+
* string, a list, `null` or `false`, and the branch that produces one is the ordinary shape of the
|
|
79
|
+
* expression this wraps — `hold(editing && editor())`, `hold(row ?? null)`. Wrapping those handed
|
|
80
|
+
* the renderer a `{ $h }` carrying a non-template, which reached the held-commit path and threw on
|
|
81
|
+
* `result.strings`: a whole render lost, from a value the same expression renders happily one
|
|
82
|
+
* character to the left. Decided here rather than in the renderer so the hot path pays nothing.
|
|
85
83
|
*/
|
|
86
|
-
declare const hold: (result:
|
|
84
|
+
declare const hold: <T>(result: T) => T | {
|
|
87
85
|
$h: TemplateResult;
|
|
88
86
|
};
|
|
89
87
|
/**
|
|
90
|
-
*
|
|
91
|
-
*
|
|
92
|
-
*
|
|
88
|
+
* Writes a template result into a container. The renderer's imperative draw: no reactivity, no
|
|
89
|
+
* lifecycle, no knowledge of components. Slots into Vera via `wire([renderer])`; core's built-in
|
|
90
|
+
* `html` tag already produces the accepted shape, so no `setHtml` call is required — though
|
|
91
|
+
* lit-html's `html` also works, its results being structurally identical.
|
|
92
|
+
*
|
|
93
|
+
* **It owns its own range and nothing else.** The first call appends a marker and anchors a root
|
|
94
|
+
* part there; later calls with the same container reuse that part and walk only the value slots, so
|
|
95
|
+
* nodes are updated in place rather than rebuilt. Content that was already in the container stays.
|
|
93
96
|
*
|
|
94
|
-
*
|
|
97
|
+
* **Named for the relationship, not the act.** It was `render` until 0.2.0, which collided with
|
|
98
|
+
* core's `render` — a different function, with a different arity, that declares a *reactive*
|
|
99
|
+
* template and commits a component's setup. Both were public and both were documented, so a reader
|
|
100
|
+
* who knew one misread the other. `renderElement` and `renderDom` were considered and rejected: this
|
|
101
|
+
* renders *into* a container, and the container is a `Node` — a shadow root and a fragment are both
|
|
102
|
+
* valid, so "element" would be a lie in the type. Argument order is lit-html's on purpose.
|
|
103
|
+
*
|
|
104
|
+
* HYDRATION lives in `@verajs/renderer/hydrate` — a drop-in superset entry whose `renderInto` adopts
|
|
95
105
|
* existing server-rendered children on first render. SSR apps import from there instead of here;
|
|
96
106
|
* this entry carries zero hydration code.
|
|
97
107
|
*/
|
|
98
|
-
declare const
|
|
108
|
+
declare const renderInto: (result: unknown, container: Node) => void;
|
|
109
|
+
declare const renderer: {
|
|
110
|
+
name: string;
|
|
111
|
+
on: "render";
|
|
112
|
+
fn: never;
|
|
113
|
+
priority: number;
|
|
114
|
+
/**
|
|
115
|
+
* Typed against the registry `wire` actually hands over, not a narrower shape that happens to
|
|
116
|
+
* describe the one lookup this makes. A structural `{ get(name: 'value'): … }` is **not**
|
|
117
|
+
* assignable from `Inserts`, so `wire([renderer])` failed to compile in a consumer's project while
|
|
118
|
+
* this repo's own typecheck — which reads sources, not the shipped `.d.ts` — saw nothing.
|
|
119
|
+
*/
|
|
120
|
+
connect: (given: {
|
|
121
|
+
get(name: never): unknown;
|
|
122
|
+
}) => void;
|
|
123
|
+
};
|
|
99
124
|
|
|
100
|
-
export { hold,
|
|
125
|
+
export { hold, renderInto, renderer };
|
|
101
126
|
export type { TemplateResult };
|
|
102
127
|
//# sourceMappingURL=vera-renderer.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vera-renderer.d.ts","sources":["
|
|
1
|
+
{"version":3,"file":"vera-renderer.d.ts","sources":["../../src/renderer.ts"],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0DG;AAEH,KAAA,cAAS;AAYT;;;;;;;;;;;;;;;AAeG;AACH;AAEI;;AAGJ;;;AAGG;AACH,cAAA,IAAA;AACA,QAAM,cAAgB;AACtB;AAugBI;AACE;;AAEE;;AAEI;AACE;;;;;;;;;;;;AAYG;;AAEH;AACE,cAAA,UAAA,+BAAW,IAAA;;AACX;AAAG;;;AAGL;;;;AAIG;AACH;;AAEE;;;;;;","names":[]}
|