An open source design system that's fully customizable and agent ready
TypeScript
spec(AST-082): open string sets, portable projections, and typed slot forms (#8070)
Cindy Zhang2a0aa4a6216c
diff --git a/docs/specs/AST-082-native-first-surfaces/spec.md b/docs/specs/AST-082-native-first-surfaces/spec.mdindex afb7beae5c..4a27a37c8d 100644--- a/docs/specs/AST-082-native-first-surfaces/spec.md+++ b/docs/specs/AST-082-native-first-surfaces/spec.md@@ -90,12 +90,31 @@ depends only on runtimes it can maintain.the supported platforms, and never renders a silent substitute.- **FR4 — The core contract is portable.** Every core prop has a form in eachlanguage a supported platform's apps are written in, including Swift and- Kotlin: strings, numbers, booleans, closed string sets, arrays, records of- these, optional values, and callbacks whose arguments are portable. Free-form- content (`ReactNode`) and render functions are not portable. They belong to the- web contract and to any platform contract whose implementation runs React; the- core expresses content as a typed slot instead, such as text, an icon, or a- named Astryx component.+ Kotlin: strings, numbers, booleans, closed string sets, open string sets,+ arrays, records of these, optional values, and callbacks whose arguments are+ portable.+ - An **open string set** is a set of built-in names that a theme or an+ application extends, as core's augmentable maps are. Its wire value is the+ name, the same as on the web. Each native platform's type for it is a+ string-backed value with a constant for each built-in name, and that+ platform's theme build adds a constant for each name the theme declares, as+ the web theme build writes the TypeScript augmentation. Any name decodes; a+ platform that receives a name it has no rule for draws the component's base+ look, as the web does for an augmented name with no built-in style.+ - A prop whose web type is wider than these kinds may name a portable closed+ set of the values every platform supports, each mapped to one web value,+ such as Button `width`: `content` (the default) or `fill`, where `fill` is+ the web's `'100%'`. The prop's other web values stay in the web contract.+ - Free-form content (`ReactNode`) and render functions are not portable. They+ belong to the web contract and to any platform contract whose implementation+ runs React; the core expresses content as a typed slot instead. A **text**+ slot is a string. An **icon** slot is a shared icon name (FR17), which each+ platform resolves the way FR17 says; on a native platform, in a development+ build an unknown name stops with a message that names the icon, and in a+ release build it draws nothing. A **content** slot holds named Astryx+ components. A platform contract may accept a wider form for the same slot,+ such as a React node on the web; the slot keeps one meaning, and the core+ form is what every native platform accepts.- **FR5 — Platform props are platform-scoped types.** `@astryxdesign/core`exposes the core contracts and the web contracts; its default types are the webcontracts, unchanged for web callers. `@astryxdesign/native` exposes the native@@ -257,7 +276,9 @@ depends only on runtimes it can maintain.mounted rules, and rendered web markup are byte-identical whether or not thenative package is installed. The web contract keeps every prop and base prop ithas today. A removal that FR7 or FR8 implies for a web caller is a breaking- change and ships only in a planned minor under `spec:AST-017`.+ change and ships only in a planned minor under `spec:AST-017`, and so does+ making an existing web prop an icon slot where the web renders a string as+ text today.- **FR15 — Native support ships on the canary channel until a platform issupported.** `@astryxdesign/native` is a private, canary-only package(`spec:AST-033/FR4`): it publishes only to the canary channel and never as a@@ -350,23 +371,23 @@ depends only on runtimes it can maintain.## Verification-| Contract | Verification | Representative states | Mutation or failure expectation |-| -------- | ---------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |-| FR1, FR3 | Component documentation metadata check, plus type and build tests importing a platform-specific component | a shared component; a web-only component; a component on some native platforms; an unsupported platform | A component declares no platforms, claims an unsupported native platform, or an unsupported import type-checks, builds, or renders a substitute |-| FR4 | Contract generation to TypeScript, Swift, and Kotlin, compiled in each language | every core prop kind; a free-form content or render-function prop in the core | A core prop has no Swift or Kotlin form, or a non-portable prop enters the core |-| FR5, FR6 | Type checks of fixture apps against each package and condition | core default (web); each native condition; `shared`; a platform prop in another platform's file and in a shared file | A platform prop type-checks under another platform's condition or under `shared`, a core prop is missing under any condition, or web types change |-| FR7 | Generated base-prop surfaces per platform, plus runtime targeting tests | shared base props; a core-owned concept; a core prop that reuses a base name; each targeted part | A shared base prop differs by platform, an owned concept's base prop overrides the core prop, or base props reach a different part on another platform |-| FR8 | Contract name check over every component | core prop vs platform prop; Swift and Kotlin keywords; platform toolkit names; reclaimed names; one name in two platform contracts | A collision passes, a reclaimed name is undeclared, or a same-named platform prop appears in a merged type |-| FR9 | Documentation and CLI output checks | core only; each platform selection; native package absent | Output for one platform lists another platform's prop, or a prop is unmarked |-| FR10 | `defineNativeTheme` unit and type tests, plus a resolution test per platform | durable `material` only; entry with and without a range; overlapping entries; platform `components`; native theme extension; a token in native configuration; platform term outside its entry or range | A token can be set, a platform term type-checks outside its entry or range, an entry applies outside its platform or range, overlap order is ignored, or extension drops members |-| FR11 | FR12 experience scores per scenario step, oldest and newest supported OS | navigation, sheet, menu, picker, switch, text entry, scrolling, keyboard shortcut, large text; a capability newer than the running OS | A step draws a custom control where the platform provides one, misses the touch-target minimum, ignores the text-size setting, or breaks on the oldest supported OS |-| FR12 | Scenario replay on candidates and reference, on real release builds and devices | each scenario on each candidate and the toolkit reference; oldest and newest supported OS; a lower-end device per platform | A candidate is scored without the reference, on a debug build, on emulation only, on one OS version, or on a different scenario set, or a visual score is given without device captures |-| FR13 | Dependency manifest audit of each native platform package | platform SDK; first-party project; a React Native out-of-tree desktop platform; third-party optional integration; third-party fork | A third-party library or fork is required to install, build, or render on the platform |-| FR14 | Compiler and render output comparison, core dependency graph check, and a web type surface diff | each maintained theme with and without the native package installed; runtime-mounted and built CSS; components; web types before and after | Any byte of CSS, mounted rules, or rendered web markup differs, core depends on native, or a web prop disappears outside a planned minor |-| FR15 | Package metadata and release-channel checks | native package manifest; a stable release; a canary release | The native package is publishable as a stable release before a platform is supported |-| FR16 | Package-boundary check, plus a native fixture app installed and bundled without `react-dom` or StyleX | an import of the portable entry; an import of a core component or the web theme entry from native; a listed build-time read from a native build script; an unlisted one; a core import of native; a core contract change | Native resolves a DOM type, `react-dom`, StyleX, or a web module; either direction of the boundary is crossed, an unlisted build-time read passes; or a core contract change does not reach native contracts on the next build |-| FR17 | Icon map coverage check per native platform, plus override resolution tests | every built-in name; a namespaced name; a theme platform icon with and without a version range; an app-registered icon | A built-in name has no platform default, a theme or app icon fails to replace the default, a scoped icon applies outside its range, or a web icon is substituted |-| FR18 | Type tests over `PortableTheme` and `DefinedTheme`, token resolution tests per color mode, and `defineNativeTheme` reporting tests | each maintained theme; a theme with component overrides, icons, indicators, media surfaces, and adaptations; light and dark; a length, a color, and a font token | `DefinedTheme` changes for a web caller, a portable token needs CSS to resolve, `PortableTheme` references a React or DOM type, or a web part with content is dropped without a report |+| Contract | Verification | Representative states | Mutation or failure expectation |+| -------- | ---------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |+| FR1, FR3 | Component documentation metadata check, plus type and build tests importing a platform-specific component | a shared component; a web-only component; a component on some native platforms; an unsupported platform | A component declares no platforms, claims an unsupported native platform, or an unsupported import type-checks, builds, or renders a substitute |+| FR4 | Contract generation to TypeScript, Swift, and Kotlin, compiled in each language | every core prop kind; an open string set with a built-in name, a theme-declared name, and a name the platform has no rule for; a projected prop at each portable value and at a web-only value; a text, icon, and content slot, and a web call site passing a wider form; a free-form content or render-function prop in the core | A core prop has no Swift or Kotlin form, a non-portable prop enters the core, a theme-declared name is rejected by a platform type, an unknown open-set name fails instead of drawing the base look, a wire value differs from the web value, a projected value maps to a different web value or a web-only value reaches a native type, or a slot accepts a wider form on a platform that cannot render it |+| FR5, FR6 | Type checks of fixture apps against each package and condition | core default (web); each native condition; `shared`; a platform prop in another platform's file and in a shared file | A platform prop type-checks under another platform's condition or under `shared`, a core prop is missing under any condition, or web types change |+| FR7 | Generated base-prop surfaces per platform, plus runtime targeting tests | shared base props; a core-owned concept; a core prop that reuses a base name; each targeted part | A shared base prop differs by platform, an owned concept's base prop overrides the core prop, or base props reach a different part on another platform |+| FR8 | Contract name check over every component | core prop vs platform prop; Swift and Kotlin keywords; platform toolkit names; reclaimed names; one name in two platform contracts | A collision passes, a reclaimed name is undeclared, or a same-named platform prop appears in a merged type |+| FR9 | Documentation and CLI output checks | core only; each platform selection; native package absent | Output for one platform lists another platform's prop, or a prop is unmarked |+| FR10 | `defineNativeTheme` unit and type tests, plus a resolution test per platform | durable `material` only; entry with and without a range; overlapping entries; platform `components`; native theme extension; a token in native configuration; platform term outside its entry or range | A token can be set, a platform term type-checks outside its entry or range, an entry applies outside its platform or range, overlap order is ignored, or extension drops members |+| FR11 | FR12 experience scores per scenario step, oldest and newest supported OS | navigation, sheet, menu, picker, switch, text entry, scrolling, keyboard shortcut, large text; a capability newer than the running OS | A step draws a custom control where the platform provides one, misses the touch-target minimum, ignores the text-size setting, or breaks on the oldest supported OS |+| FR12 | Scenario replay on candidates and reference, on real release builds and devices | each scenario on each candidate and the toolkit reference; oldest and newest supported OS; a lower-end device per platform | A candidate is scored without the reference, on a debug build, on emulation only, on one OS version, or on a different scenario set, or a visual score is given without device captures |+| FR13 | Dependency manifest audit of each native platform package | platform SDK; first-party project; a React Native out-of-tree desktop platform; third-party optional integration; third-party fork | A third-party library or fork is required to install, build, or render on the platform |+| FR14 | Compiler and render output comparison, core dependency graph check, and a web type surface diff | each maintained theme with and without the native package installed; runtime-mounted and built CSS; components; web types before and after; an existing web prop that renders a string as text becomes an icon slot | Any byte of CSS, mounted rules, or rendered web markup differs, core depends on native, or a web prop disappears outside a planned minor, or an existing web prop that renders a string as text becomes an icon slot in a patch rather than a planned minor |+| FR15 | Package metadata and release-channel checks | native package manifest; a stable release; a canary release | The native package is publishable as a stable release before a platform is supported |+| FR16 | Package-boundary check, plus a native fixture app installed and bundled without `react-dom` or StyleX | an import of the portable entry; an import of a core component or the web theme entry from native; a listed build-time read from a native build script; an unlisted one; a core import of native; a core contract change | Native resolves a DOM type, `react-dom`, StyleX, or a web module; either direction of the boundary is crossed, an unlisted build-time read passes; or a core contract change does not reach native contracts on the next build |+| FR17 | Icon map coverage check per native platform, plus override resolution tests | every built-in name; a namespaced name; a theme platform icon with and without a version range; an app-registered icon; an icon slot given an unknown name in a development and a release build | A built-in name has no platform default, a theme or app icon fails to replace the default, a scoped icon applies outside its range, a web icon is substituted, or an unknown name draws something in a release build or does not stop a development build with its name |+| FR18 | Type tests over `PortableTheme` and `DefinedTheme`, token resolution tests per color mode, and `defineNativeTheme` reporting tests | each maintained theme; a theme with component overrides, icons, indicators, media surfaces, and adaptations; light and dark; a length, a color, and a font token | `DefinedTheme` changes for a web caller, a portable token needs CSS to resolve, `PortableTheme` references a React or DOM type, or a web part with content is dropped without a report |## Decision log@@ -522,6 +543,22 @@ nothing for web callers, because `DefinedTheme` is still the whole.Rejected: native reading the whole `DefinedTheme`, because it carries Reactelements, CSS maps, and DOM-typed imports native cannot use.+### DEC-12 — Open sets extend per theme, and a wider web type may project to native++**Reference:** `spec:AST-082/DEC-12`+**Decider:** cixzhang, 2026-10-23++A theme's own variants reach every platform the way they reach the web: the+platform theme build adds the theme's names to a string-backed type, so code+names them like built-ins, and any name decodes, so a newer theme never breaks+an older app. Where a web prop accepts values no native platform can honor,+the core names the few that every platform supports instead of leaving the+prop web-only.++Rejected: an enum of built-in names with a case for any other string, because+theme names would stay plain strings and the theme build would generate+nothing.+## Open questions- **OQ1 — What thresholds make a candidate supported?** (`human-design`)