@astryxdesign/core 0.7.4 → 0.7.5-canary.bfe8e0d
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 +4 -4
- package/src/Icon/Icon.spec.md +40 -29
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@astryxdesign/core",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.5-canary.bfe8e0d",
|
|
4
4
|
"displayName": "Astryx Core",
|
|
5
5
|
"description": "The component library. Accessible, themeable React components with built-in spacing, dark mode, and StyleX styling.",
|
|
6
6
|
"author": "Meta Open Source",
|
|
@@ -792,6 +792,8 @@
|
|
|
792
792
|
"react-dom": ">=19.0.0"
|
|
793
793
|
},
|
|
794
794
|
"devDependencies": {
|
|
795
|
+
"@astryxdesign/a11y-spec": "0.7.5-canary.bfe8e0d",
|
|
796
|
+
"@astryxdesign/cli": "0.7.5-canary.bfe8e0d",
|
|
795
797
|
"@babel/cli": "^7.29.7",
|
|
796
798
|
"@babel/core": "^7.29.7",
|
|
797
799
|
"@babel/preset-react": "^7.29.7",
|
|
@@ -802,9 +804,7 @@
|
|
|
802
804
|
"@testing-library/jest-dom": "^6.6.0",
|
|
803
805
|
"@testing-library/react": "^16.3.2",
|
|
804
806
|
"@types/babel__core": "^7.20.5",
|
|
805
|
-
"tailwindcss": "^4.3.2"
|
|
806
|
-
"@astryxdesign/a11y-spec": "0.0.0",
|
|
807
|
-
"@astryxdesign/cli": "0.7.4"
|
|
807
|
+
"tailwindcss": "^4.3.2"
|
|
808
808
|
},
|
|
809
809
|
"dependencies": {
|
|
810
810
|
"intl-messageformat": "^11.2.9"
|
package/src/Icon/Icon.spec.md
CHANGED
|
@@ -27,7 +27,7 @@ architecture:
|
|
|
27
27
|
architecture:public-component-api,
|
|
28
28
|
]
|
|
29
29
|
contributing: []
|
|
30
|
-
system_specs: []
|
|
30
|
+
system_specs: [spec:AST-087]
|
|
31
31
|
---
|
|
32
32
|
|
|
33
33
|
# Icon component contract
|
|
@@ -53,6 +53,7 @@ Consumer migration instructions belong in consumer docs and release notes.
|
|
|
53
53
|
**Owns**
|
|
54
54
|
|
|
55
55
|
- Accepting a semantic icon key or a supplied icon component as the glyph source.
|
|
56
|
+
- Passing the resolved size and a variant the entry can receive to a registry entry.
|
|
56
57
|
- Resolving explicit, component-owned contextual, and standalone size defaults.
|
|
57
58
|
- Applying Icon's size, color, theming target, and accessibility semantics to
|
|
58
59
|
the rendered glyph.
|
|
@@ -71,12 +72,13 @@ Consumer migration instructions belong in consumer docs and release notes.
|
|
|
71
72
|
|
|
72
73
|
## Public concepts
|
|
73
74
|
|
|
74
|
-
| Concept | Closed values or states | Meaning
|
|
75
|
-
| ------------- | --------------------------------------------------------- |
|
|
76
|
-
| Glyph source | semantic key, namespaced extension key, or icon component | Selects the visual symbol.
|
|
77
|
-
| Size | `xsm`, `sm`, `md`, `lg` | Selects the icon box size.
|
|
78
|
-
| Color | documented semantic and palette values | Selects the glyph color or inherits it from context.
|
|
79
|
-
| Accessibility | decorative or meaningfully labelled | Controls whether assistive technology receives the glyph.
|
|
75
|
+
| Concept | Closed values or states | Meaning | Availability by variant/orientation/state | Default | Owner | Stability | Invalid-value behavior |
|
|
76
|
+
| ------------- | --------------------------------------------------------- | ---------------------------------------------------------- | ------------------------------------------------ | ----------------------------------------------- | ---------------- | --------- | --------------------------------------------------------------------------------- |
|
|
77
|
+
| Glyph source | semantic key, namespaced extension key, or icon component | Selects the visual symbol. | Every render | Required | `component:Icon` | Stable | TypeScript rejects unsupported built-in string values. |
|
|
78
|
+
| Size | `xsm`, `sm`, `md`, `lg` | Selects the icon box size. | Every rendered glyph | nearest component-owned default; otherwise `md` | `component:Icon` | Stable | TypeScript rejects unsupported values. |
|
|
79
|
+
| Color | documented semantic and palette values | Selects the glyph color or inherits it from context. | Every rendered glyph | `inherit` | `component:Icon` | Stable | TypeScript rejects unsupported values. |
|
|
80
|
+
| Accessibility | decorative or meaningfully labelled | Controls whether assistive technology receives the glyph. | Every rendered glyph | Decorative | `component:Icon` | Stable | Empty labels use the decorative behavior. |
|
|
81
|
+
| Variant | names in `IconVariantMap`; the active theme lists its own | Requests a theme's alternate artwork for a registry glyph. | Registry glyphs only; never a supplied component | None | `component:Icon` | Stable | TypeScript rejects unknown names; an unlisted variant renders the normal artwork. |
|
|
80
82
|
|
|
81
83
|
A namespaced key that does not resolve currently renders nothing. This is
|
|
82
84
|
existing behavior, not an intentional fallback promise.
|
|
@@ -86,13 +88,15 @@ existing behavior, not an intentional fallback promise.
|
|
|
86
88
|
Requirements identify their basis so observed code is not mistaken for an
|
|
87
89
|
intentional decision.
|
|
88
90
|
|
|
89
|
-
| ID | Candidate invariant
|
|
90
|
-
| --- |
|
|
91
|
-
| FR1 | Icon MUST present at most one glyph from the supplied semantic key, namespaced key, or icon component.
|
|
92
|
-
| FR2 | Every rendered glyph MUST carry the `icon` theming target with its resolved size and selected color reflected as target data.
|
|
93
|
-
| FR3 | Icon MUST apply the resolved size as width and height for every glyph, plus font size where needed for 1em-based icon sources. This sizing contract MUST NOT promise an HTML or SVG element type.
|
|
94
|
-
| FR4 | Supported SVG and styling escape hatches MUST retain their established merge and override behavior.
|
|
95
|
-
| FR5 | An explicit Icon `size` MUST win. Without one, Icon MUST use the nearest default supplied by an owning Astryx component for its documented icon slot; without such a default, Icon MUST use `md`.
|
|
91
|
+
| ID | Candidate invariant | Basis | Draft review state |
|
|
92
|
+
| --- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------- | ------------------------------------------------------- |
|
|
93
|
+
| FR1 | Icon MUST present at most one glyph from the supplied semantic key, namespaced key, or icon component. | Documented promise and current tests. | Settled intent. |
|
|
94
|
+
| FR2 | Every rendered glyph MUST carry the `icon` theming target with its resolved size and selected color reflected as target data. | Current source, docs, and theming tests. | Settled intent. |
|
|
95
|
+
| FR3 | Icon MUST apply the resolved size as width and height for every glyph, plus font size where needed for 1em-based icon sources. This sizing contract MUST NOT promise an HTML or SVG element type. | Human decision, current source, and tests. | Settled intent. |
|
|
96
|
+
| FR4 | Supported SVG and styling escape hatches MUST retain their established merge and override behavior. | Current source and regression tests. | Current compatibility behavior; verify before changing. |
|
|
97
|
+
| FR5 | An explicit Icon `size` MUST win. Without one, Icon MUST use the nearest default supplied by an owning Astryx component for its documented icon slot; without such a default, Icon MUST use `md`. | Component-size precedence and Button sizing decision. | Settled intent. |
|
|
98
|
+
| FR6 | In registry mode, Icon MUST pass `{size, variant}` to the selected entry, where `size` is the size resolved by ORD1 and `variant` is the requested variant when the active theme lists it and, for a theme-supplied entry, the theme that defined the entry lists it too, otherwise `undefined`. A supplied icon component MUST NOT receive `variant`, Icon MUST NOT forward `variant` to the DOM, and the `icon` target MUST NOT reflect it. | `spec:AST-087` FR1–FR5 and FR9. | Settled intent. |
|
|
99
|
+
| FR7 | The `icon` target MUST guarantee `width` and `height` on its `size:*` selectors as reviewed target-specific additions, so a theme sets each size's dimension. Without theme styles, sizes are 12, 16, 20, and 24px at a 16px root and scale with the root font size. | `spec:AST-087` FR10. | Settled intent. |
|
|
96
100
|
|
|
97
101
|
### Allowed variation
|
|
98
102
|
|
|
@@ -109,15 +113,18 @@ intentional decision.
|
|
|
109
113
|
|
|
110
114
|
### Representative states
|
|
111
115
|
|
|
112
|
-
| State | Required invariant
|
|
113
|
-
| -------------------------------- |
|
|
114
|
-
| Semantic key | One resolved glyph carries the `icon` target.
|
|
115
|
-
| Namespaced extension key | A resolved extension glyph carries the `icon` target.
|
|
116
|
-
| Supplied icon component | The supplied glyph carries the `icon` target.
|
|
117
|
-
| Standalone Icon without `size` | The resolved size is `md`.
|
|
118
|
-
| Owned icon slot without `size` | The nearest documented component default is used.
|
|
119
|
-
| Explicit Icon size in owned slot | The explicit Icon size wins over the contextual default.
|
|
120
|
-
| Unresolved namespaced key | No glyph is currently rendered.
|
|
116
|
+
| State | Required invariant | Allowed variation |
|
|
117
|
+
| -------------------------------- | ---------------------------------------------------------------------------------- | ---------------------------------------------- |
|
|
118
|
+
| Semantic key | One resolved glyph carries the `icon` target. | Theme, registry, or built-in artwork. |
|
|
119
|
+
| Namespaced extension key | A resolved extension glyph carries the `icon` target. | Consumer- or library-owned artwork. |
|
|
120
|
+
| Supplied icon component | The supplied glyph carries the `icon` target. | Component implementation and SVG internals. |
|
|
121
|
+
| Standalone Icon without `size` | The resolved size is `md`. | Glyph source and color. |
|
|
122
|
+
| Owned icon slot without `size` | The nearest documented component default is used. | The owning component's declared size mapping. |
|
|
123
|
+
| Explicit Icon size in owned slot | The explicit Icon size wins over the contextual default. | Any supported Icon size. |
|
|
124
|
+
| Unresolved namespaced key | No glyph is currently rendered. | No fallback behavior is established by intent. |
|
|
125
|
+
| Listed variant | The entry receives the size and the variant when its defining theme also lists it. | The theme's artwork for that request. |
|
|
126
|
+
| Unlisted or omitted variant | The entry receives `variant: undefined`. | The theme's normal artwork. |
|
|
127
|
+
| Variant on a supplied component | The component renders as given without `variant`. | Component implementation. |
|
|
121
128
|
|
|
122
129
|
### Transformation and precedence order
|
|
123
130
|
|
|
@@ -172,6 +179,8 @@ not promise a `span`, `svg`, or other element type.
|
|
|
172
179
|
rules for the `icon` target.
|
|
173
180
|
- `architecture:icon-resolution-and-component-slots` owns semantic-key and
|
|
174
181
|
component-slot resolution before Icon renders the selected source.
|
|
182
|
+
- `spec:AST-087` decides the `variant` request, theme-listed variant names, and
|
|
183
|
+
theme-set size dimensions.
|
|
175
184
|
- `architecture:public-component-api` owns admission and compatibility rules for
|
|
176
185
|
Icon's public props and observable defaults.
|
|
177
186
|
- The owning component or family specifies each contextual Icon-size mapping.
|
|
@@ -181,12 +190,14 @@ not promise a `span`, `svg`, or other element type.
|
|
|
181
190
|
|
|
182
191
|
## Verification map
|
|
183
192
|
|
|
184
|
-
| Contract | Verification | Representative states
|
|
185
|
-
| ------------------- | ------------------------------------------------------------------------------ |
|
|
186
|
-
| FR1, FR3, FR5 | `Icon.test.tsx` sizing suites and `IconButton.test.tsx` contextual-size suites | standalone default; Button sizes; explicit override; both modes
|
|
187
|
-
| FR2, FR4 | `Icon.test.tsx` target/styling suites plus source inspection | Both source modes; size and color variants
|
|
188
|
-
| AR1, AR2, AR3 | `Icon.test.tsx` accessible-name suites | Decorative, labelled, explicit ARIA override
|
|
189
|
-
|
|
|
193
|
+
| Contract | Verification | Representative states | Mutation or failure expectation | Audit section |
|
|
194
|
+
| ------------------- | ------------------------------------------------------------------------------ | ---------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------- |
|
|
195
|
+
| FR1, FR3, FR5 | `Icon.test.tsx` sizing suites and `IconButton.test.tsx` contextual-size suites | standalone default; Button sizes; explicit override; both modes | Breaking source rendering, standalone fallback, contextual mapping, explicit precedence, or cross-mode sizing fails assertions. | `audit:Icon/behavior` |
|
|
196
|
+
| FR2, FR4 | `Icon.test.tsx` target/styling suites plus source inspection | Both source modes; size and color variants | Removing the target or breaking override composition fails existing assertions; `data-color` reflection currently lacks focused assertions. | `audit:Icon/theming` |
|
|
197
|
+
| AR1, AR2, AR3 | `Icon.test.tsx` accessible-name suites | Decorative, labelled, explicit ARIA override | Changing default or labelled semantics fails accessibility assertions. | `audit:Icon/accessibility` |
|
|
198
|
+
| FR6 | `Icon.test.tsx` variant suites (pending) | listed, unlisted, and omitted variant; no active list; inherited entry under a replaced list; supplied component | An unlisted variant, or one the entry's defining theme does not list, reaches an entry, or `variant` reaches a supplied component or the DOM. | `audit:Icon/behavior` |
|
|
199
|
+
| FR7 | Theme styling tests for each size (pending) | each size with and without theme styles | A themed size does not change the glyph dimension, or an unstyled size changes. | `audit:Icon/theming` |
|
|
200
|
+
| Theming anatomy map | `scripts/check-knowledge.mjs` | Canonical consumer anatomy and current target | Missing, extra, prefixed, or stale mappings fail repository validation. | `audit:Icon/theming` |
|
|
190
201
|
|
|
191
202
|
Focused coverage for `data-color` on both glyph source modes is a checkable test
|
|
192
203
|
gap; source inspection is the current evidence for that part of FR2.
|