@uniweb/kit 0.10.10 → 0.10.11

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uniweb/kit",
3
- "version": "0.10.10",
3
+ "version": "0.10.11",
4
4
  "description": "Standard component library for Uniweb foundations",
5
5
  "type": "module",
6
6
  "exports": {
@@ -8,7 +8,8 @@
8
8
  "./xref": "./src/xref/index.js",
9
9
  "./theme-tokens.css": "./src/theme-tokens.css",
10
10
  "./prose-tokens.css": "./src/prose-tokens.css",
11
- "./callout-tokens.css": "./src/callout-tokens.css"
11
+ "./callout-tokens.css": "./src/callout-tokens.css",
12
+ "./math-tokens.css": "./src/math-tokens.css"
12
13
  },
13
14
  "files": [
14
15
  "src",
@@ -42,8 +43,8 @@
42
43
  "fuse.js": "^7.0.0",
43
44
  "shiki": "^3.0.0",
44
45
  "tailwind-merge": "^3.6.0",
45
- "@uniweb/semantic-parser": "1.2.1",
46
46
  "@uniweb/core": "0.8.1",
47
+ "@uniweb/semantic-parser": "1.2.1",
47
48
  "@uniweb/scene": "0.1.2"
48
49
  },
49
50
  "peerDependencies": {
@@ -0,0 +1,80 @@
1
+ /*
2
+ * MathML layout for Temml-produced math.
3
+ *
4
+ * Usage — one line in the foundation's stylesheet:
5
+ *
6
+ * @import "@uniweb/kit/math-tokens.css";
7
+ *
8
+ * `prose-tokens.css` already imports this, so a foundation using that needs
9
+ * nothing further. This file exists separately because rendering math and
10
+ * setting up prose typography are different decisions: the academic template
11
+ * has 23 equations and no prose column, and while these rules lived inside
12
+ * prose-tokens it shipped its maths unstyled — matrices with their rows
13
+ * touching, `=` signs out of line, no equation numbers — with nothing to point
14
+ * at. Correct metrics are not a typography opt-in.
15
+ *
16
+ * press emits the same declarations into its EPUB and Paged.js output, since
17
+ * those lanes carry their own stylesheets and cannot import this one. The two
18
+ * copies are pinned by `framework/_contracts/math-css-parity.test.js`.
19
+ */
20
+
21
+ /* ─── Math (Temml → MathML) ────────────────────────────────────────────────────
22
+ Browsers render MathML natively, so it is easy to conclude math needs no CSS.
23
+ It needs these, for two separate reasons.
24
+
25
+ Temml emits class hooks and expects a stylesheet to define them: `tml-left`
26
+ and `tml-right` carry the `&` column alignment of an `aligned` environment,
27
+ `tml-jot` its extra row spacing. Undefined, a derivation's `=` signs drift
28
+ out of line and its rows sit flush. Those three declarations are Temml's own.
29
+
30
+ The `math mtd` rule is not. Temml's stylesheet only *adjusts* row spacing for
31
+ jot, on the stated assumption that mtd already gets 0.5ex of vertical padding
32
+ "per MathML-Core and user-agent CSS" — but a pristine mtd measures 0px in
33
+ Chrome (2026-07). A pmatrix or cases carries no tml-* class at all, so
34
+ Temml's stylesheet alone fixes the derivation and leaves the matrix touching.
35
+
36
+ These live here rather than in their own opt-in file because correct math
37
+ metrics are not a design choice the way callout colours are — a site that
38
+ sets its typography should not also have to know this.
39
+
40
+ press ships the same declarations to the EPUB and Paged.js lanes, which have
41
+ their own stylesheets and cannot import this one. That duplicate is pinned by
42
+ `framework/_contracts/math-css-parity.test.js`, not by trust. */
43
+ .tml-right { text-align: right; }
44
+ .tml-left { text-align: left; }
45
+ .tml-sml-pad { padding-left: 0.05em; }
46
+ math mtd { padding-top: 0.5ex; padding-bottom: 0.5ex; }
47
+ math mtable.tml-jot mtd { padding-top: 0.7ex; padding-bottom: 0.7ex; }
48
+
49
+ /* AMS auto-numbering. Which equations number is the AUTHOR's choice, made in
50
+ LaTeX: `align` and `equation` number, `aligned` and the starred forms do not.
51
+ Without these two rules that choice was discarded -- `align` and `align*`
52
+ rendered identically, so an author who asked for numbers silently got none. */
53
+ .tml-eqn::before {
54
+ counter-increment: tmlEqnNo;
55
+ content: "(" counter(tmlEqnNo) ")";
56
+ }
57
+ body {
58
+ counter-reset: tmlEqnNo;
59
+ }
60
+ /* Display math needs CSS block layout, not MathML layout, for an equation TAG
61
+ to reach the right margin: the tag rides in an mtable whose `width:100%`
62
+ Chromium ignores under `display: block math`, collapsing the spacer cells so
63
+ "(1)" sits glued to the equation instead of at the margin.
64
+
65
+ `!important` is not decoration. Temml emits `style="display:block math"` on
66
+ every display formula unconditionally — no option turns it off — so an inline
67
+ style beats any rule we write, including Temml's own `math.tml-display
68
+ { display: block }`, which is exactly what this restores. Fixing it here
69
+ rather than in the generator also repairs math that was already built.
70
+
71
+ Scoped with :has() to formulas that actually carry a tag. Switching every
72
+ display formula to CSS block layout would left-align the lot -- MathML layout
73
+ is what centres them -- so an unnumbered derivation or matrix keeps
74
+ `display: block math` and stays centred. Where :has() is unsupported the tag
75
+ simply does not reach the margin; nothing else changes. */
76
+ math.tml-display:has(.tml-eqn) {
77
+ display: block !important;
78
+ width: 100%;
79
+ }
80
+
@@ -1,3 +1,16 @@
1
+ /*
2
+ * Maths is NOT included here. A foundation that renders equations imports
3
+ * `@uniweb/kit/math-tokens.css` as well — MathML needs its own layout rules,
4
+ * and prose typography does not imply them.
5
+ *
6
+ * They were briefly one file, and that is what shipped the academic template's
7
+ * equations unstyled: 23 of them, no prose column, so it imported neither. The
8
+ * fix is not to make prose pull maths in behind the reader's back — that just
9
+ * restates "prose implies maths" one indirection out, and leaves two ways to
10
+ * get one stylesheet. Each of kit's entry points owns one concern and the
11
+ * foundation composes them.
12
+ */
13
+
1
14
  /*
2
15
  * Tailwind Typography, wired to the theme.
3
16
  *
@@ -108,64 +121,3 @@
108
121
  .prose :is(h1, h2, h3, h4, figure, table, .math-display) {
109
122
  scroll-margin-top: calc(var(--header-height, 4rem) + 1rem);
110
123
  }
111
-
112
- /* ─── Math (Temml → MathML) ────────────────────────────────────────────────────
113
- Browsers render MathML natively, so it is easy to conclude math needs no CSS.
114
- It needs these, for two separate reasons.
115
-
116
- Temml emits class hooks and expects a stylesheet to define them: `tml-left`
117
- and `tml-right` carry the `&` column alignment of an `aligned` environment,
118
- `tml-jot` its extra row spacing. Undefined, a derivation's `=` signs drift
119
- out of line and its rows sit flush. Those three declarations are Temml's own.
120
-
121
- The `math mtd` rule is not. Temml's stylesheet only *adjusts* row spacing for
122
- jot, on the stated assumption that mtd already gets 0.5ex of vertical padding
123
- "per MathML-Core and user-agent CSS" — but a pristine mtd measures 0px in
124
- Chrome (2026-07). A pmatrix or cases carries no tml-* class at all, so
125
- Temml's stylesheet alone fixes the derivation and leaves the matrix touching.
126
-
127
- These live here rather than in their own opt-in file because correct math
128
- metrics are not a design choice the way callout colours are — a site that
129
- sets its typography should not also have to know this.
130
-
131
- press ships the same declarations to the EPUB and Paged.js lanes, which have
132
- their own stylesheets and cannot import this one. That duplicate is pinned by
133
- `framework/_contracts/math-css-parity.test.js`, not by trust. */
134
- .tml-right { text-align: right; }
135
- .tml-left { text-align: left; }
136
- .tml-sml-pad { padding-left: 0.05em; }
137
- math mtd { padding-top: 0.5ex; padding-bottom: 0.5ex; }
138
- math mtable.tml-jot mtd { padding-top: 0.7ex; padding-bottom: 0.7ex; }
139
-
140
- /* AMS auto-numbering. Which equations number is the AUTHOR's choice, made in
141
- LaTeX: `align` and `equation` number, `aligned` and the starred forms do not.
142
- Without these two rules that choice was discarded -- `align` and `align*`
143
- rendered identically, so an author who asked for numbers silently got none. */
144
- .tml-eqn::before {
145
- counter-increment: tmlEqnNo;
146
- content: "(" counter(tmlEqnNo) ")";
147
- }
148
- body {
149
- counter-reset: tmlEqnNo;
150
- }
151
- /* Display math needs CSS block layout, not MathML layout, for an equation TAG
152
- to reach the right margin: the tag rides in an mtable whose `width:100%`
153
- Chromium ignores under `display: block math`, collapsing the spacer cells so
154
- "(1)" sits glued to the equation instead of at the margin.
155
-
156
- `!important` is not decoration. Temml emits `style="display:block math"` on
157
- every display formula unconditionally — no option turns it off — so an inline
158
- style beats any rule we write, including Temml's own `math.tml-display
159
- { display: block }`, which is exactly what this restores. Fixing it here
160
- rather than in the generator also repairs math that was already built.
161
-
162
- Scoped with :has() to formulas that actually carry a tag. Switching every
163
- display formula to CSS block layout would left-align the lot -- MathML layout
164
- is what centres them -- so an unnumbered derivation or matrix keeps
165
- `display: block math` and stays centred. Where :has() is unsupported the tag
166
- simply does not reach the margin; nothing else changes. */
167
- math.tml-display:has(.tml-eqn) {
168
- display: block !important;
169
- width: 100%;
170
- }
171
-