@kerf-js/core 0.1.0 → 0.1.1-nightly.20261112.42

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/docs/fonts.md CHANGED
@@ -45,7 +45,8 @@ face sets `preload: false`, others only with `preload: true`. Other options: `di
45
45
  to the font's default if the source never sets it. An axis set to two values stays. A value kerf can't read from the
46
46
  source (`var()`, a template, an expression) keeps every axis. `wght`, `wdth`, `opsz`, `slnt` and `ital` are never
47
47
  pinned: CSS drives them. A pinned value applies to every use of the face, so a face used both with and without the
48
- setting needs the axis declared.
48
+ setting needs the axis declared. An axis named in `axes` is cut to that range, or to one value when the range is a
49
+ point, so `axes: { wght: [500, 700] }` drops the rest of the weight axis.
49
50
  - **Characters.** `latin` becomes two files. The core is preloaded: ASCII, common punctuation, and every other latin
50
51
  character in your source. The rest is fetched through `unicode-range` only by a page that shows one of those
51
52
  characters, so text from a database still gets the face, after a fallback-matched swap.
package/docs/theme.md CHANGED
@@ -120,13 +120,22 @@ veneer({
120
120
  })
121
121
  ```
122
122
 
123
- The properties are `size weight leading tracking case font`. A number is px for `size` and `tracking`. A role's name is
124
- lowercase. veneer's own roles take only the tokens veneer has for them.
123
+ The properties are `size weight leading tracking case font opsz`. A number is px for `size` and `tracking`. A role's
124
+ name is lowercase. veneer's own roles take only the tokens veneer has for them, and `opsz`. `opsz` is the face's optical
125
+ size, set as `font-variation-settings: "opsz" <n>`, so a face without the axis ignores it; `'auto'` leaves it to the
126
+ font size, as `font-optical-sizing` does.
127
+
128
+ A pseudo-element can't take `data-role`, so a role with `firstLetter: true` also sets the first letter of any element
129
+ that names it in `data-first-letter`: a script initial on a serif paragraph is
130
+ `initial: { size: 70, leading: 0, font: '"Mea Culpa", Georgia, serif', firstLetter: true }` and
131
+ `<Text role="narrative" data-first-letter="initial">`.
125
132
 
126
133
  Any property can change with the viewport: `base` holds below the first breakpoint, and each other key is a min-width
127
134
  in px. `size` and `tracking` can also be fluid, `{ min, max, from, to }` in px: `min` at the `from` width, `max` at
128
135
  `to`, held outside them. Inside a breakpoint, `from` is the breakpoint. Each breakpoint is a media query that sets the
129
- tokens, so there is no script; a fluid line runs on `vw` to meet them, in the user's rem.
136
+ tokens, so there is no script; a fluid line runs on `vw` to meet them, in the user's rem (`--veneer-rem`). A page that
137
+ imports `kerf:tokens/veneer` without veneer's stylesheet gets `--veneer-rem: 1rem` from the tokens, so its fluid sizes
138
+ hold, and `<Heading>` and `<Text>` bring only their role rules there, not veneer's sheet.
130
139
 
131
140
  ```ts
132
141
  veneer({
File without changes
@@ -0,0 +1,52 @@
1
+ // Which top-level bindings the routes can render: each route and layout file's own, then whatever those read, call or
2
+ // render, across imports and barrels by name. Only these hold islands. A barrel names every component of a package,
3
+ // and a call site in one nothing renders would still get its island, its chunk and that chunk's CSS on every page.
4
+ //
5
+ // It errs the same way as the rest: what it can't follow by name keeps a whole module. A namespace keeps every binding
6
+ // of its module, a module that runs as it loads keeps all of its own, and a name read as a value (`loose`) is kept
7
+ // wherever the module that reads it loads.
8
+ export function reach(entries, mods, local, tagOf) {
9
+ const nodes = new Set()
10
+ const loaded = new Set()
11
+ const whole = new Set()
12
+ const queue = []
13
+ const named = (mod, name) => add(local(mod, name, new Set()))
14
+ const add = (t) => {
15
+ if (t?.ns) keep(t.ns)
16
+ else if (t && typeof t === 'object' && !nodes.has(t)) {
17
+ nodes.add(t)
18
+ queue.push(t)
19
+ load(t.mod)
20
+ }
21
+ }
22
+ const linked = (mod, spec) => mods.get(mod.resolved.get(spec))
23
+ const load = (mod) => {
24
+ if (!mod || loaded.has(mod)) return
25
+ loaded.add(mod)
26
+ if (mod.facts.effects) keep(mod)
27
+ for (const u of mod.facts.loose) named(mod, u)
28
+ for (const s of mod.facts.side ?? []) load(linked(mod, s))
29
+ }
30
+ const keep = (mod) => {
31
+ if (!mod || whole.has(mod)) return
32
+ whole.add(mod)
33
+ load(mod)
34
+ for (const n of mod.facts.nodes) add(n)
35
+ for (const e of mod.facts.exports) if (e.source) keep(linked(mod, e.source))
36
+ for (const s of mod.facts.stars) keep(linked(mod, s))
37
+ }
38
+ // `export * as K` makes a name of a whole module, which the bindings don't follow: it is kept wherever it is
39
+ for (const m of mods.values())
40
+ for (const e of m.facts.exports) if (e.source && e.imported === '*') keep(linked(m, e.source))
41
+ for (const file of entries) keep(mods.get(file))
42
+ while (queue.length) {
43
+ const n = queue.pop()
44
+ for (const u of [...n.uses, ...n.calls]) named(n.mod, u)
45
+ for (const s of n.sites) {
46
+ add(tagOf(n.mod, s))
47
+ for (const a of s.attrs) for (const u of a.uses) named(n.mod, u)
48
+ for (const u of s.kids.uses) named(n.mod, u)
49
+ }
50
+ }
51
+ return nodes
52
+ }
@@ -25,6 +25,7 @@ import { gather } from './hydration/graph.mjs'
25
25
  import { bindings } from './hydration/bindings.mjs'
26
26
  import { classify } from './hydration/classify.mjs'
27
27
  import { buildReport } from './hydration/report.mjs'
28
+ import { reach } from './hydration/reach.mjs'
28
29
 
29
30
  /**
30
31
  * @param {object} o
@@ -39,6 +40,9 @@ export async function solve({ entries, transform, resolve, rel, cache = new Map(
39
40
  const mods = await gather(entries, transform, resolve, cache)
40
41
  const { exported, local, tagOf } = bindings(mods)
41
42
  const { client, all, isClient, interactive, hoist, inner } = classify(mods, local, tagOf)
43
+ // A call site no route can render is never an island (hydration/reach.mjs).
44
+ const reached = reach(entries, mods, local, tagOf)
45
+ const sites = (n) => (reached.has(n) ? inner(n) : [])
42
46
  return buildReport(
43
47
  entries,
44
48
  lazy,
@@ -50,7 +54,7 @@ export async function solve({ entries, transform, resolve, rel, cache = new Map(
50
54
  isClient,
51
55
  interactive,
52
56
  hoist,
53
- inner,
57
+ sites,
54
58
  rel,
55
59
  )
56
60
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kerf-js/core",
3
- "version": "0.1.0",
3
+ "version": "0.1.1-nightly.20261112.42",
4
4
  "description": "kerf: a fine-grained reactive TSX framework. Runtime, compiler binding, Vite plugin and test utilities.",
5
5
  "keywords": [
6
6
  "kerf"
@@ -109,13 +109,13 @@
109
109
  }
110
110
  },
111
111
  "optionalDependencies": {
112
- "@kerf-js/compiler-darwin-arm64": "0.1.0",
113
- "@kerf-js/compiler-darwin-x64": "0.1.0",
114
- "@kerf-js/compiler-linux-arm64-gnu": "0.1.0",
115
- "@kerf-js/compiler-linux-arm64-musl": "0.1.0",
116
- "@kerf-js/compiler-linux-x64-gnu": "0.1.0",
117
- "@kerf-js/compiler-linux-x64-musl": "0.1.0",
118
- "@kerf-js/compiler-win32-x64": "0.1.0"
112
+ "@kerf-js/compiler-darwin-arm64": "0.1.1-nightly.20261112.42",
113
+ "@kerf-js/compiler-darwin-x64": "0.1.1-nightly.20261112.42",
114
+ "@kerf-js/compiler-linux-arm64-gnu": "0.1.1-nightly.20261112.42",
115
+ "@kerf-js/compiler-linux-arm64-musl": "0.1.1-nightly.20261112.42",
116
+ "@kerf-js/compiler-linux-x64-gnu": "0.1.1-nightly.20261112.42",
117
+ "@kerf-js/compiler-linux-x64-musl": "0.1.1-nightly.20261112.42",
118
+ "@kerf-js/compiler-win32-x64": "0.1.1-nightly.20261112.42"
119
119
  },
120
120
  "engines": {
121
121
  "node": ">=24"