uxml-preview 0.5.0 → 0.5.1

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/CHANGELOG.md CHANGED
@@ -1,5 +1,106 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.5.1 — 2026-10-13
4
+
5
+ A cleanup release: nothing drawn changes except where a Unity dump said it was
6
+ wrong, and things that used to be dropped without a word are now said.
7
+
8
+ ### Behavior changes
9
+
10
+ - **More warnings.** Raised where there used to be silence: undocumented property
11
+ names, documented properties this preview does not draw, state pseudo-classes
12
+ Unity's pseudo-class page does not list (`:selected`, `:first-child`, made-up names), `@media` and
13
+ `@keyframes` blocks, and `display` values other than `flex`/`none`. A screen
14
+ that passed silently in 0.5.0 may now list warnings; it is drawn the same.
15
+ - **`reason` and `subject` on `Warning`.** Both optional, both **open sets** —
16
+ give unknown values a `default` branch. `WarningKind` does not grow and no
17
+ field was removed. See "For consumers" below.
18
+ - **`engines.node` is `>=22`** (was `>=18`). CI and Pages already ran on 22.
19
+ - A `background-image` that is not an asset reference (`linear-gradient()`)
20
+ is `unsupported-property` with `reason: 'not-uss'`, no longer
21
+ `asset-unresolved`, so a host stops looking for a file that cannot exist.
22
+ - Warning text says what the renderer did; facts about Unity moved to
23
+ `reason`/`subject`. No message points at a source file any more.
24
+ `:root` keeps `kind: 'version-dependent'` but has `reason: 'matches-unity'`.
25
+
26
+ - **Every USS property now has one handling path.** Whether a property exists,
27
+ inherits and is drawn is read from a registry transcribed from Unity's USS
28
+ property reference (95/99/102 rows for 6000.0/6.3/6.6, checked 2026-10-13).
29
+ New `unsupported-property` warnings where there used to be silence:
30
+ - 24 documented properties this preview does not draw (`text-shadow`,
31
+ `transition*`, `-unity-text-outline*`, `-unity-font`, `all`, ...) —
32
+ `reason: 'not-rendered'`; properties newer than 6000.0 say so
33
+ (`filter (Unity 6.3+)`).
34
+ - any name Unity does not document (`font-family`, `colour`, `transform`,
35
+ `-unity-foo`, ...) — `reason: 'not-uss'`, with the USS properties to
36
+ write instead in `subject.replacements` for eleven common CSS names.
37
+ - **Corrected warnings.** `filter`/`backdrop-filter` are USS since 6.3/6.6
38
+ and are reported as not drawn rather than as non-USS. `gap`, `row-gap`,
39
+ `column-gap`, `overflow-wrap` and `word-break` are in no Unity USS reference
40
+ table up to 6.6 and are reported as not USS rather than version-dependent.
41
+ The reference version is Unity 6.3 LTS; Unity 6.7 (beta) adds some of these
42
+ and is not supported in this release.
43
+ `background-size`/`-position`/`-repeat` are in 6000.0 and no longer warn.
44
+ `aspect-ratio` is reported as a 6.3+ property this preview does not lay out.
45
+ - **`<Bindings>` and `<ui:Columns>` are no longer laid out.** The only
46
+ change in this release that moves anything drawn, and it moves it to where
47
+ Unity puts it: dumps on 6000.0.40f1 and 6000.3.25f1 show neither element in
48
+ the visual hierarchy, while the preview drew each as a zero-height box that
49
+ shifted `space-between`/`space-around` siblings. Their two
50
+ `unsupported-control` warnings are replaced by one notice per document
51
+ that data bindings are not evaluated (`reason: 'not-rendered'`). A
52
+ `<ui:Column>`'s name still counts toward `duplicate-name-in-tree`, because
53
+ Unity gives it to the header column it builds.
54
+ - **One warning per declaration.** Property warnings are raised once where
55
+ the declaration is written, with `at` — including in rules that match
56
+ nothing — instead of once per element the value reached. An inherited
57
+ value is never reported again on descendants. Value-level warnings
58
+ (`width: 2em`, an unresolved image) also collapse to one per declaration.
59
+ A consumer counting occurrences will count fewer.
60
+ - Inheritance now follows Unity's USS reference table. Five properties that
61
+ Unity marks inherited and this package did not now inherit:
62
+ `text-shadow`, `-unity-editor-text-rendering-mode`, `-unity-text-generator`,
63
+ `-unity-material` (6.3+) and `-unity-text-auto-size` (6.3+).
64
+ `isInherited()` returns `true` for them, and `resolveStyles()` hands them to
65
+ descendants with an `inherited` origin. Nothing drawn changes: none of the
66
+ five is drawn by this preview.
67
+
68
+ ### Added
69
+
70
+ - `WarningReason`, `WarningSubject` types.
71
+ - `USS_STATES` (and `UssState`): the seven states Unity sets, from Unity's
72
+ pseudo-class page — without `:root` and `:selected`.
73
+ - `TEMPLATE_DEPTH_LIMIT` (32): how deep template expansion goes, for hosts
74
+ that prefetch template files.
75
+
76
+ ### For consumers
77
+
78
+ - **Read `subject`, not the message.** The failed URL is `subject.url`, the
79
+ asset path `subject.path` (with `form`), a refused states key `subject.key`,
80
+ a property `subject.property`/`value`. Seven message texts consumers match
81
+ on today are kept byte for byte in this release, but are not an API.
82
+ - **Use `reason` to separate the author's mistakes from the tool's limits.**
83
+ `not-uss` and `invalid-value` are the author's; `not-rendered` is this
84
+ preview's; `version-dependent` needs checking; `matches-unity` is not a
85
+ defect. Failing a screen on every `unsupported-property` would now fail
86
+ valid USS this preview merely does not draw.
87
+ - **A `not-rendered` warning with `subject.affectsLayout: true` means this
88
+ preview's coordinates may differ from Unity's.** In that case, do not treat
89
+ a coordinate-based finding (zero size, overflow) as settled. `affectsLayout`
90
+ comes from a new registry column judging what each property can do in Unity
91
+ (box or pixels), kept apart from what this preview does with it.
92
+ `subject.applied: 'paint'` marks a property drawn here but not laid out as
93
+ Unity would (`letter-spacing`, `word-spacing`: drawn, left out of text
94
+ measurement), which now raises a `not-rendered` warning of its own.
95
+ - Replace copied constants with `USS_STATES` and `TEMPLATE_DEPTH_LIMIT`.
96
+
97
+ ### Deferred to 0.6.0
98
+
99
+ `:enabled` applied automatically, `states` key warnings, the unused
100
+ `unsupported-unit` kind, and value-level checks (`hsl()`, `cubic-bezier()`,
101
+ `space-evenly`, `linear-gradient()` per Unity version, USS-only `cursor`
102
+ values). Listed in `docs/backlog.md`.
103
+
3
104
  ## 0.5.0 — 2026-08-26
4
105
 
5
106
  ### Known limitations
package/README.md CHANGED
@@ -25,12 +25,12 @@ stylesheet comes out wrong.</sub>
25
25
  npm install uxml-preview
26
26
  ```
27
27
 
28
- > **v0.5.0.** Five controls (`VisualElement`, `Label`, `Button`,
28
+ > **v0.5.1.** Five controls (`VisualElement`, `Label`, `Button`,
29
29
  > `Image`, `ScrollView`), everything else drawn as a plain box with a warning,
30
30
  > and a support matrix that says plainly what has not been measured.
31
31
  > Read [what is not verified yet](#what-is-not-verified-yet) before relying on it.
32
32
  >
33
- > **v0.5.0.** 컨트롤 5종(`VisualElement`, `Label`, `Button`,
33
+ > **v0.5.1.** 컨트롤 5종(`VisualElement`, `Label`, `Button`,
34
34
  > `Image`, `ScrollView`)이고, 나머지는 경고와 함께 일반 박스로 그립니다.
35
35
  > 검증되지 않은 부분은 지원 범위표에 그대로 적어뒀습니다. 쓰시기 전에
36
36
  > [아직 검증되지 않은 것](#아직-검증되지-않은-것)을 먼저 봐주세요.
@@ -124,7 +124,7 @@ Full plan: [`docs/ROADMAP.md`](docs/ROADMAP.md)
124
124
  The support matrix is deliberately conservative — see
125
125
  [`docs/supported.en.md`](docs/supported.en.md) for the full table.
126
126
 
127
- - **Slots are not supported in v0.5.0.** They were measured alive in Unity
127
+ - **Slots are not supported in v0.5.1.** They were measured alive in Unity
128
128
  6000.0.40f1; slot children are not placed and `template-slot-unsupported` is
129
129
  reported.
130
130
  - **A `style` AttributeOverride is not applied.** Unity ignores it during import,
@@ -406,7 +406,7 @@ Unity 6000.0.40f1에서 살아 있음을 실측했지만 이번 범위 밖이라
406
406
  지원 범위는 일부러 보수적으로 적었습니다. 전체 표는
407
407
  [`docs/supported.md`](docs/supported.md)에 있습니다.
408
408
 
409
- - **v0.5.0은 슬롯을 지원하지 않습니다.** Unity 6000.0.40f1에서 살아 있음을
409
+ - **v0.5.1은 슬롯을 지원하지 않습니다.** Unity 6000.0.40f1에서 살아 있음을
410
410
  실측했지만 슬롯 자식은 배치하지 않고 `template-slot-unsupported`로 보고합니다
411
411
  - **`style` AttributeOverride는 적용하지 않습니다.** Unity가 import 과정에서
412
412
  무시하는 동작을 따르며, 그럴듯하지만 틀린 결과 대신
@@ -53,3 +53,10 @@ SOFTWARE.
53
53
  Vite, Vitest, TypeScript, jsdom, pixelmatch and pngjs are development
54
54
  dependencies. They are not redistributed in either artifact above, so they carry
55
55
  no notice obligation here.
56
+
57
+ ## Test fixtures in the source repository
58
+
59
+ `tests/fixtures/external/` holds UXML and USS files from six open-source Unity
60
+ projects (MIT, and one Unlicense), used only as test input. They are not in the
61
+ npm package or the site. Each source's licence file sits in its folder, and
62
+ `tests/fixtures/external/README.md` lists the origins.
package/dist/index.d.ts CHANGED
@@ -7,8 +7,8 @@ import { LayoutBox, MeasureText } from './layout/yoga';
7
7
  * below are still signatures only; implementations land in Phases 2–4.
8
8
  * See docs/ROADMAP.md.
9
9
  */
10
- export type { Span, SourceRef, NodeId, ElementName, Attribute, ElementSpans, ElementNode, Combinator, SimpleSelector, SelectorPart, Selector, Declaration, Rule, SheetItem, StyleSheet, WarningKind, WarningKindMap, Warning, UxmlDocument, StyleOrigin, } from './model/types';
11
- export { collectDependencies, expandTemplates } from './template/expand';
10
+ export type { Span, SourceRef, NodeId, ElementName, Attribute, ElementSpans, ElementNode, Combinator, SimpleSelector, SelectorPart, Selector, Declaration, Rule, SheetItem, StyleSheet, WarningKind, WarningKindMap, WarningReason, WarningSubject, Warning, UxmlDocument, StyleOrigin, } from './model/types';
11
+ export { collectDependencies, expandTemplates, TEMPLATE_DEPTH_LIMIT } from './template/expand';
12
12
  export type { TemplateExpansion, TemplateResolver } from './template/expand';
13
13
  export { loadLayoutEngine, isLayoutEngineReady, liveNodeCount } from './layout/yoga';
14
14
  export type { LayoutBox, MeasureText, TextContext, TextMetrics } from './layout/yoga';
@@ -19,6 +19,8 @@ export { resolveStyles, explainProperty } from './style/resolve';
19
19
  export type { Candidate, ComputedStyle, ComputedValue, ResolveOptions, ResolveResult, } from './style/resolve';
20
20
  export type { Specificity } from './style/specificity';
21
21
  export { isInherited } from './style/properties';
22
+ export { USS_STATES } from './style/registry';
23
+ export type { UssState } from './style/registry';
22
24
  export { KNOWN_DIVERGENCES } from './known-divergences';
23
25
  export type { KnownDivergence } from './known-divergences';
24
26
  /**
@@ -143,13 +145,4 @@ export interface RenderResult {
143
145
  */
144
146
  dispose(): void;
145
147
  }
146
- /**
147
- * Purpose: draw a document into a container element.
148
- * Deps/Effects: replaces the container's children and allocates Yoga nodes.
149
- * Call `dispose()` on the result before rendering again.
150
- * Requires: `await loadLayoutEngine()` once, first. Yoga is WebAssembly and
151
- * cannot be loaded synchronously; keeping that await out here is
152
- * what lets this function stay synchronous, which the playground
153
- * and the golden tests both want.
154
- */
155
148
  export declare function render(doc: UxmlDocument, container: HTMLElement, options?: RenderOptions): RenderResult;