Commit 711e2eb
fix(16): solid hoist <style> to document.head via __rozieInjectStyle
ITEM-1-RESIDUAL closure. Closes the LAST gated cell in the VR matrix —
ThemedButtonConsumer · solid now passes byte-identical. Full matrix:
254 passed / 0 skipped / 0 failed (was 1 skipped after Item 3 + the two
residuals).
Root cause (caught visually by Dan — bold font missing in the Solid
render). Solid had no CSS Modules pipeline, so emitStyle inlined each
component's scoped CSS as a sibling `<style>` JSX element in the
rendered tree. When a consumer composed a wrapper, the wrapper's
`<style>` rendered AFTER the consumer's (one wrapper `<style>` per
wrapper INSTANCE, all positioned as children of the consumer's
container). Source-order made the wrapper's same-specificity rules win
— the `.btn { font: inherit }` shorthand reset font-weight back to
"normal", wiping the consumer's `.extra-variant { font-weight: 600 }`
override. Visible symptom: 4 buttons rendered with correct colors but
WITHOUT bold text, 454×52 vs 474×52 baseline (3 108 px diff).
Every other target hoists styles to `<head>` once per component class
(Vue `<style scoped>` via SFC compiler, React CSS Modules, Svelte
`:global { }` Item-2 path, Angular `ViewEncapsulation.Emulated`, Lit
`static styles = css\`\``). Solid was the lone target emitting inline
`<style>` siblings.
Fix. Switch Solid emit from inline `<style>` JSX to a module-top
`__rozieInjectStyle('<name>-<hash>', \`<css>\`);` side-effect statement
that runs ONCE at module-load time. Wrapper modules are loaded BEFORE
consumer modules (consumer's `import X from '...'` resolves wrapper
first), so wrapper styles land in `<head>` first and consumer styles
second — restoring the source-order cascade that lets consumer rules
win same-specificity races.
Runtime helper is HMR-safe: a module-scoped `Map<key, HTMLStyleElement>`
deduplicates by cache key (per-component scope hash); when an already-
injected key receives different CSS text, the existing `<style>`
element's `textContent` is updated in place rather than appending a
duplicate. SSR is a no-op (`typeof document === 'undefined'` guard);
Rozie's v1 Solid scope is client-side rendering.
Files:
- packages/runtime/solid/src/injectStyle.ts (NEW) — the runtime
helper, with `Map<key, HTMLStyleElement>` cache + textContent-refresh
on key-collision (HMR-safe)
- packages/runtime/solid/src/index.ts — export `__rozieInjectStyle`
- packages/targets/solid/src/emit/emitStyle.ts — signature gains
`componentName` arg; result shape switches from `styleJsx` to
`injectStatement` + `needsInjectHelper` flag; both scoped + :root
sections fold into a single injection (separated by newline) keyed
by `'<name>-<hash>'`
- packages/targets/solid/src/emit/shell.ts — `ShellParts` field
renamed `styleJsx` → `styleInjectStatement`; spliced at module top
in both code paths (moduleParts + ms.append); inline `<style>`
fragment-wrap removed from the JSX return
- packages/targets/solid/src/emitSolid.ts — threads new field;
registers `__rozieInjectStyle` runtime import when present
- packages/targets/solid/src/rewrite/collectSolidImports.ts — adds
`'__rozieInjectStyle'` to the RuntimeSolidImport enum
- 8 target-solid snapshot fixtures + 23 dist-parity .solid.tsx +
6 regressions .solid.tsx — reblessed (uniform shape change: inline
`<style>` removed from JSX, `__rozieInjectStyle(...)` added to
module preamble + import added to the `@rozie/runtime-solid` line)
- tests/visual-regression/specs/matrix.spec.ts — PHASE_14_1_FOLLOWUP
set now EMPTY; closure comment captures the full three-stage Solid
fix path
Verification:
- turbo run typecheck --force --continue: 47/47 green
- turbo run test --continue: 46/46 green (target-solid 188/188,
dist-parity 512/512, regressions 53/53)
- solid-vite test:e2e: 6/6 green INCLUDING the
`HMR preserves Counter state across a <style> edit (QA-04)` test —
confirms the Map-based cache + textContent-refresh handles HMR
correctly
- tools/ci-repro/vr.sh -g ThemedButtonConsumer.*solid: cell passes
byte-identical (was 3 108 px diff)
- tools/ci-repro/vr.sh (full matrix): 254 passed / 0 skipped /
0 failed — every cell green; PHASE_14_1_FOLLOWUP fully closed
The full pre-Phase-16 cleanup arc:
- Pre-session: 229 passed / 25 skipped (16 of those skips were the
five PHASE_14_1_FOLLOWUP cells across solid+svelte+lit)
- Post-cleanup: 254 passed / 0 skipped / 0 failed — 25 cells unlocked
across 7 commits (Items 1/2/3 + Item-1-residual + Item-2-residual +
Item-1-cascade closure + Item-2-PortalListStyled-revert sub-fix).
Solid is now at full cross-target parity for the cross-SFC composition
and consumer-style-override cases — matching Vue/React/Svelte/Angular/
Lit on every cell in the matrix.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent 6c551d9 commit 711e2eb
43 files changed
Lines changed: 614 additions & 539 deletions
File tree
- packages
- runtime/solid/src
- targets/solid/src
- __tests__/fixtures
- emit
- rewrite
- tests
- dist-parity/fixtures
- regressions/fixtures
- 06.4-inline-expression-handler
- 06.4-lit-checkbox-rmodel
- 06.4-lit-onmount-arrow-cleanup
- D-SM-01-nested-slot-declared
- D-VR-03-solid-controllable-no-props
- vue-slot-vif-wrapper-strip
- visual-regression/specs
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
| 31 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
Lines changed: 4 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
| 3 | + | |
3 | 4 | | |
4 | 5 | | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
5 | 9 | | |
6 | 10 | | |
7 | 11 | | |
| |||
16 | 20 | | |
17 | 21 | | |
18 | 22 | | |
19 | | - | |
20 | | - | |
21 | | - | |
22 | 23 | | |
23 | 24 | | |
24 | 25 | | |
| |||
27 | 28 | | |
28 | 29 | | |
29 | 30 | | |
30 | | - | |
31 | 31 | | |
32 | 32 | | |
Lines changed: 5 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
3 | 8 | | |
4 | 9 | | |
5 | 10 | | |
| |||
11 | 16 | | |
12 | 17 | | |
13 | 18 | | |
14 | | - | |
15 | | - | |
16 | | - | |
17 | | - | |
18 | 19 | | |
19 | 20 | | |
20 | 21 | | |
21 | 22 | | |
22 | 23 | | |
23 | | - | |
24 | 24 | | |
25 | 25 | | |
Lines changed: 7 additions & 8 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
4 | 10 | | |
5 | 11 | | |
6 | 12 | | |
| |||
29 | 35 | | |
30 | 36 | | |
31 | 37 | | |
32 | | - | |
33 | | - | |
34 | | - | |
35 | | - | |
36 | | - | |
37 | | - | |
38 | 38 | | |
39 | 39 | | |
40 | 40 | | |
41 | 41 | | |
42 | 42 | | |
43 | 43 | | |
44 | 44 | | |
45 | | - | |
46 | 45 | | |
47 | 46 | | |
Lines changed: 14 additions & 15 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
4 | 17 | | |
5 | 18 | | |
6 | 19 | | |
| |||
77 | 90 | | |
78 | 91 | | |
79 | 92 | | |
80 | | - | |
81 | | - | |
82 | | - | |
83 | | - | |
84 | | - | |
85 | | - | |
86 | | - | |
87 | | - | |
88 | | - | |
89 | | - | |
90 | | - | |
91 | | - | |
92 | | - | |
93 | 93 | | |
94 | 94 | | |
95 | 95 | | |
| |||
100 | 100 | | |
101 | 101 | | |
102 | 102 | | |
103 | | - | |
104 | 103 | | |
105 | 104 | | |
Lines changed: 27 additions & 28 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
4 | 30 | | |
5 | 31 | | |
6 | 32 | | |
| |||
70 | 96 | | |
71 | 97 | | |
72 | 98 | | |
73 | | - | |
74 | | - | |
75 | | - | |
76 | | - | |
77 | | - | |
78 | | - | |
79 | | - | |
80 | | - | |
81 | | - | |
82 | | - | |
83 | | - | |
84 | | - | |
85 | | - | |
86 | | - | |
87 | | - | |
88 | | - | |
89 | | - | |
90 | | - | |
91 | | - | |
92 | | - | |
93 | | - | |
94 | | - | |
95 | | - | |
96 | | - | |
97 | | - | |
98 | | - | |
99 | 99 | | |
100 | 100 | | |
101 | 101 | | |
| |||
110 | 110 | | |
111 | 111 | | |
112 | 112 | | |
113 | | - | |
114 | 113 | | |
115 | 114 | | |
Lines changed: 6 additions & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
4 | 9 | | |
5 | 10 | | |
6 | 11 | | |
| |||
41 | 46 | | |
42 | 47 | | |
43 | 48 | | |
44 | | - | |
45 | | - | |
46 | | - | |
47 | | - | |
48 | | - | |
49 | 49 | | |
50 | 50 | | |
51 | 51 | | |
| |||
55 | 55 | | |
56 | 56 | | |
57 | 57 | | |
58 | | - | |
59 | 58 | | |
60 | 59 | | |
Lines changed: 8 additions & 9 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
4 | 11 | | |
5 | 12 | | |
6 | 13 | | |
| |||
58 | 65 | | |
59 | 66 | | |
60 | 67 | | |
61 | | - | |
62 | | - | |
63 | | - | |
64 | | - | |
65 | | - | |
66 | | - | |
67 | | - | |
68 | 68 | | |
69 | 69 | | |
70 | 70 | | |
| |||
85 | 85 | | |
86 | 86 | | |
87 | 87 | | |
88 | | - | |
89 | 88 | | |
90 | 89 | | |
Lines changed: 5 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
3 | 8 | | |
4 | 9 | | |
5 | 10 | | |
| |||
14 | 19 | | |
15 | 20 | | |
16 | 21 | | |
17 | | - | |
18 | | - | |
19 | | - | |
20 | | - | |
21 | 22 | | |
22 | 23 | | |
23 | 24 | | |
| |||
27 | 28 | | |
28 | 29 | | |
29 | 30 | | |
30 | | - | |
31 | 31 | | |
32 | 32 | | |
0 commit comments