@astryxdesign/native 0.7.5-canary.5b691cd → 0.7.5-canary.60178b8
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/apple/Package.swift +1 -1
- package/apple/README.md +1 -0
- package/apple/Sources/Astryx/Avatar/Avatar.spec.md +41 -32
- package/apple/Sources/Astryx/Avatar/Avatar.swift +96 -19
- package/apple/Sources/Astryx/Avatar/AvatarStatusDot.spec.md +162 -0
- package/apple/Sources/Astryx/Avatar/AvatarStatusDot.swift +181 -0
- package/apple/Sources/Astryx/Icon/Icon.spec.md +2 -0
- package/apple/Sources/Astryx/Icon/Icon.swift +4 -0
- package/apple/Sources/Astryx/Localization/AstryxStrings.swift +36 -0
- package/apple/Sources/Astryx/Resources/af.lproj/Localizable.strings +15 -0
- package/apple/Sources/Astryx/Resources/ar.lproj/Localizable.strings +15 -0
- package/apple/Sources/Astryx/Resources/ca.lproj/Localizable.strings +15 -0
- package/apple/Sources/Astryx/Resources/cs.lproj/Localizable.strings +15 -0
- package/apple/Sources/Astryx/Resources/da.lproj/Localizable.strings +15 -0
- package/apple/Sources/Astryx/Resources/de.lproj/Localizable.strings +15 -0
- package/apple/Sources/Astryx/Resources/el.lproj/Localizable.strings +15 -0
- package/apple/Sources/Astryx/Resources/en.lproj/Localizable.strings +15 -0
- package/apple/Sources/Astryx/Resources/es.lproj/Localizable.strings +15 -0
- package/apple/Sources/Astryx/Resources/fi.lproj/Localizable.strings +15 -0
- package/apple/Sources/Astryx/Resources/fr.lproj/Localizable.strings +15 -0
- package/apple/Sources/Astryx/Resources/he.lproj/Localizable.strings +15 -0
- package/apple/Sources/Astryx/Resources/hu.lproj/Localizable.strings +15 -0
- package/apple/Sources/Astryx/Resources/it.lproj/Localizable.strings +15 -0
- package/apple/Sources/Astryx/Resources/ja.lproj/Localizable.strings +15 -0
- package/apple/Sources/Astryx/Resources/ko.lproj/Localizable.strings +15 -0
- package/apple/Sources/Astryx/Resources/nb.lproj/Localizable.strings +15 -0
- package/apple/Sources/Astryx/Resources/nl.lproj/Localizable.strings +15 -0
- package/apple/Sources/Astryx/Resources/pl.lproj/Localizable.strings +15 -0
- package/apple/Sources/Astryx/Resources/pt-BR.lproj/Localizable.strings +15 -0
- package/apple/Sources/Astryx/Resources/pt-PT.lproj/Localizable.strings +15 -0
- package/apple/Sources/Astryx/Resources/ro.lproj/Localizable.strings +15 -0
- package/apple/Sources/Astryx/Resources/ru.lproj/Localizable.strings +15 -0
- package/apple/Sources/Astryx/Resources/sr.lproj/Localizable.strings +15 -0
- package/apple/Sources/Astryx/Resources/sv.lproj/Localizable.strings +15 -0
- package/apple/Sources/Astryx/Resources/tr.lproj/Localizable.strings +15 -0
- package/apple/Sources/Astryx/Resources/uk.lproj/Localizable.strings +15 -0
- package/apple/Sources/Astryx/Resources/vi.lproj/Localizable.strings +15 -0
- package/apple/Sources/Astryx/Resources/zh-Hans.lproj/Localizable.strings +15 -0
- package/apple/Sources/Astryx/Resources/zh-Hant.lproj/Localizable.strings +15 -0
- package/apple/Sources/Astryx/Thumbnail/Thumbnail.spec.md +191 -0
- package/apple/Sources/Astryx/Thumbnail/Thumbnail.swift +357 -0
- package/apple/Sources/Astryx/Tooltip/TooltipPresenter.swift +17 -4
- package/apple/Sources/Astryx/Wire/AstryxNodeView.swift +6 -1
- package/apple/Sources/AstryxNative/Generated/AstryxNode.swift +6 -0
- package/apple/Sources/AstryxNative/Generated/Avatar.swift +2 -0
- package/apple/Sources/AstryxNative/Generated/AvatarStatusDot.swift +78 -0
- package/apple/Sources/AstryxNative/Generated/Thumbnail.swift +123 -0
- package/apple/Tests/AstryxTests/AvatarStatusDotTests.swift +255 -0
- package/apple/Tests/AstryxTests/AvatarTests.swift +35 -35
- package/apple/Tests/AstryxTests/ThumbnailTests.swift +204 -0
- package/dist/components/Avatar.d.ts.map +1 -1
- package/dist/components/Avatar.js +2 -1
- package/dist/components/AvatarStatusDot.d.ts +10 -0
- package/dist/components/AvatarStatusDot.d.ts.map +1 -0
- package/dist/components/AvatarStatusDot.js +9 -0
- package/dist/components/Thumbnail.d.ts +10 -0
- package/dist/components/Thumbnail.d.ts.map +1 -0
- package/dist/components/Thumbnail.js +10 -0
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/index.js +4 -0
- package/dist/types/android.d.ts +28 -4
- package/dist/types/core.d.ts +17 -0
- package/dist/types/ios.d.ts +28 -4
- package/dist/types/macos.d.ts +28 -4
- package/dist/types/shared.d.ts +28 -4
- package/dist/types/windows.d.ts +28 -4
- package/package.json +3 -3
- package/src/components/Avatar.ts +2 -1
- package/src/components/AvatarStatusDot.ts +20 -0
- package/src/components/Thumbnail.ts +21 -0
- package/src/components/index.ts +4 -0
- package/src/contract/contracts.test.ts +44 -2
package/apple/Package.swift
CHANGED
|
@@ -28,7 +28,7 @@ let package = Package(
|
|
|
28
28
|
dependencies: ["AstryxNative"],
|
|
29
29
|
path: "Sources/Astryx",
|
|
30
30
|
// Each component's spec lives beside its view (AST-093 FR1).
|
|
31
|
-
exclude: ["Avatar/Avatar.spec.md", "Icon/Icon.spec.md"],
|
|
31
|
+
exclude: ["Avatar/Avatar.spec.md", "Avatar/AvatarStatusDot.spec.md", "Icon/Icon.spec.md", "Thumbnail/Thumbnail.spec.md"],
|
|
32
32
|
resources: [.process("Resources")]
|
|
33
33
|
),
|
|
34
34
|
.testTarget(name: "AstryxNativeTests", dependencies: ["AstryxNative"], path: "Tests/AstryxNativeTests"),
|
package/apple/README.md
CHANGED
|
@@ -32,6 +32,7 @@ apple/
|
|
|
32
32
|
│ │ ├── Heading/ # Heading
|
|
33
33
|
│ │ ├── Button/ # Button
|
|
34
34
|
│ │ ├── TextInput/ # TextInput
|
|
35
|
+
│ │ ├── Thumbnail/ # Thumbnail, Thumbnail.spec.md
|
|
35
36
|
│ │ ├── Card/ # Card
|
|
36
37
|
│ │ └── Banner/ # Banner
|
|
37
38
|
│ └── AstryxNative/ # contracts, wire, logic host (module AstryxNative)
|
|
@@ -14,6 +14,7 @@ review_triggers: [public-api, behavior, layout, theming, accessibility]
|
|
|
14
14
|
verified_by:
|
|
15
15
|
[
|
|
16
16
|
packages/native/apple/Tests/AstryxTests/AvatarTests.swift,
|
|
17
|
+
packages/native/apple/Tests/AstryxTests/AvatarStatusDotTests.swift,
|
|
17
18
|
packages/native/src/contract/contracts.test.ts,
|
|
18
19
|
packages/native/src/contract/parseDocType.test.ts,
|
|
19
20
|
]
|
|
@@ -29,15 +30,15 @@ system_specs: [spec:AST-082, spec:AST-093]
|
|
|
29
30
|
|
|
30
31
|
## Contract at a glance
|
|
31
32
|
|
|
32
|
-
| Area | Contract
|
|
33
|
-
| ----------------------- |
|
|
34
|
-
| Public contract | `Avatar(_ name: String? = nil, src:, fallbackSrc:, alt:, size: AvatarSize?, shape: AvatarShape?, tooltip: AvatarTooltip?, href:, onClick:)` and `Avatar(_ props: AvatarProps)`, a SwiftUI `View` in module `Astryx`. `size` is the named sizes `xsm` to `xl`. |
|
|
35
|
-
| Behavior | Draws the image at `src`, else `fallbackSrc`, else initials from `name` on the theme's neutral plate, else a person symbol, clipped to its shape. With `href` it is a SwiftUI `Link`; with only `onClick` it is a button; it draws the same either way.
|
|
36
|
-
| End-user impact | A person sees the same picture, initials, and shape as on the web, and VoiceOver reads the avatar's name, or skips a decorative one.
|
|
37
|
-
| Builder impact | An app passes a name and an image URL, and optionally tooltip words
|
|
38
|
-
| Compatibility/readiness | Additive: a new view and generated `AvatarProps`. Draft; built and tested on macOS and the iOS Simulator; device captures are attached to the change.
|
|
39
|
-
| Review checks | Reject a size or shape beyond the contract, a disabled state, a link or button that draws differently from the static avatar, a layout that grows for the touch target, or a static avatar VoiceOver reads without a name.
|
|
40
|
-
| Governing rules | `spec:AST-082` FR3, FR4, FR7; `spec:AST-093` FR1–FR5; the Swift component API (A1–A9), theme environment, and accessibility records under `packages/native/specs/swift/library/`.
|
|
33
|
+
| Area | Contract |
|
|
34
|
+
| ----------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
35
|
+
| Public contract | `Avatar(_ name: String? = nil, src:, fallbackSrc:, alt:, size: AvatarSize?, shape: AvatarShape?, tooltip: AvatarTooltip?, href:, status:, onClick:)` and `Avatar(_ props: AvatarProps, status:)`, a SwiftUI `View` in module `Astryx`. `size` is the named sizes `xsm` to `xl`. |
|
|
36
|
+
| Behavior | Draws the image at `src`, else `fallbackSrc`, else initials from `name` on the theme's neutral plate, else a person symbol, clipped to its shape. With `href` it is a SwiftUI `Link`; with only `onClick` it is a button; it draws the same either way. |
|
|
37
|
+
| End-user impact | A person sees the same picture, initials, and shape as on the web, and VoiceOver reads the avatar's name, or skips a decorative one. |
|
|
38
|
+
| Builder impact | An app passes a name and an image URL, and optionally tooltip words and an `AvatarStatusDot`. Pixel sizes, `target`, and `rel` have no Swift form; an `href` must be an absolute URL. |
|
|
39
|
+
| Compatibility/readiness | Additive: a new view and generated `AvatarProps`. Draft; built and tested on macOS and the iOS Simulator; device captures are attached to the change. |
|
|
40
|
+
| Review checks | Reject a size or shape beyond the contract, a disabled state, a link or button that draws differently from the static avatar, a layout that grows for the touch target, or a static avatar VoiceOver reads without a name. |
|
|
41
|
+
| Governing rules | `spec:AST-082` FR3, FR4, FR7; `spec:AST-093` FR1–FR5; the Swift component API (A1–A9), theme environment, and accessibility records under `packages/native/specs/swift/library/`. |
|
|
41
42
|
|
|
42
43
|
This table is a review projection; the body below is authoritative.
|
|
43
44
|
|
|
@@ -70,7 +71,7 @@ Consumer migration instructions belong in consumer docs and release notes.
|
|
|
70
71
|
|
|
71
72
|
- The meaning of the props, the initials rule, and the size scale — owned by
|
|
72
73
|
`component:Avatar`.
|
|
73
|
-
-
|
|
74
|
+
- Avatar groups, which have no Swift view.
|
|
74
75
|
|
|
75
76
|
## Public concepts
|
|
76
77
|
|
|
@@ -83,15 +84,16 @@ Consumer migration instructions belong in consumer docs and release notes.
|
|
|
83
84
|
|
|
84
85
|
## Behavioral and layout contract
|
|
85
86
|
|
|
86
|
-
| ID | Candidate invariant
|
|
87
|
-
| --- |
|
|
88
|
-
| FR1 | The view MUST show the image at `src`; when it is absent or fails, the image at `fallbackSrc`; then initials from a `name` that is not blank; then a person symbol. The fallback image loads only after `src` fails or when there is no `src`; while an image loads, the initials or the person symbol show.
|
|
89
|
-
| FR2 | Initials MUST follow core's rule: the first letter, digit, or emoji of the first and last words that have one, uppercased, skipping leading punctuation, keeping a whole emoji, flag, or joined emoji sequence. A name with none shows the person symbol and still names the avatar.
|
|
90
|
-
| FR3 | The avatar MUST be a square of 20, 24, 36, 48, or 128 points for `xsm` to `xl` at the default text size, grown with Dynamic Type up to 1.6 times and never shrunk, so it and its initials grow with the name beside them without swallowing a row (`spec:AST-082` FR11). It is clipped to a circle, to the theme's `radius.element`, or to a square.
|
|
91
|
-
| FR4 | Initials and the person symbol MUST draw in `color.textSecondary` on `color.neutral`; initials use the theme's body family at medium weight and 40% of the side.
|
|
92
|
-
| FR5 | With an `href` that is an absolute URL (it has a scheme), the avatar MUST be a SwiftUI `Link`; with `onClick` too, `onClick` runs as it opens and the URL then goes to the app's own URL handler, or the system's. An `href` that is not an absolute URL, such as a web path, MUST stop a development build with a message naming it; a release build draws the avatar without a link, as a button with `onClick` or static. With only `onClick`, a SwiftUI `Button`. Either draws exactly as the static avatar, and the avatar has no disabled state.
|
|
93
|
-
| FR6 | Both initializers MUST build the same `AvatarProps`; `name` is the unlabeled first parameter
|
|
94
|
-
|
|
|
87
|
+
| ID | Candidate invariant | Basis | Draft review state |
|
|
88
|
+
| --- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------- | ------------------ |
|
|
89
|
+
| FR1 | The view MUST show the image at `src`; when it is absent or fails, the image at `fallbackSrc`; then initials from a `name` that is not blank; then a person symbol. The fallback image loads only after `src` fails or when there is no `src`; while an image loads, the initials or the person symbol show. | core `Avatar` fallback order; `spec:AST-093` FR2 | verify |
|
|
90
|
+
| FR2 | Initials MUST follow core's rule: the first letter, digit, or emoji of the first and last words that have one, uppercased, skipping leading punctuation, keeping a whole emoji, flag, or joined emoji sequence. A name with none shows the person symbol and still names the avatar. | core `Avatar` initials | verify |
|
|
91
|
+
| FR3 | The avatar MUST be a square of 20, 24, 36, 48, or 128 points for `xsm` to `xl` at the default text size, grown with Dynamic Type up to 1.6 times and never shrunk, so it and its initials grow with the name beside them without swallowing a row (`spec:AST-082` FR11). It is clipped to a circle, to the theme's `radius.element`, or to a square. | core `Avatar` sizes and shapes | verify |
|
|
92
|
+
| FR4 | Initials and the person symbol MUST draw in `color.textSecondary` on `color.neutral`; initials use the theme's body family at medium weight and 40% of the side. | core `Avatar` fallback styles; `spec:AST-093` FR4 | verify |
|
|
93
|
+
| FR5 | With an `href` that is an absolute URL (it has a scheme), the avatar MUST be a SwiftUI `Link`; with `onClick` too, `onClick` runs as it opens and the URL then goes to the app's own URL handler, or the system's. An `href` that is not an absolute URL, such as a web path, MUST stop a development build with a message naming it; a release build draws the avatar without a link, as a button with `onClick` or static. With only `onClick`, a SwiftUI `Button`. Either draws exactly as the static avatar, and the avatar has no disabled state. | Swift component API A4 | verify |
|
|
94
|
+
| FR6 | Both initializers MUST build the same `AvatarProps`; `name` is the unlabeled first parameter, a single trailing closure is the status, and `onClick` comes last. Base props come through `AvatarProps`: with `isHidden` the view draws nothing; `id` becomes the accessibility identifier. | Swift component API A2–A4, A7; `spec:AST-082` FR7 | verify |
|
|
95
|
+
| FR7 | The `status` slot MUST draw its content, usually one `AvatarStatusDot`, outside the avatar's clip, placed from the content's own size, in the same layout pass, as core places any status: on a circle centered on the circle's edge at the bottom trailing 45° point, on a rounded or square avatar overhanging the bottom trailing corner by a quarter of its size, mirrored in right-to-left layouts. It MUST NOT change the avatar's size or layout, gives a dot the avatar's side for its size tier, and lets other content grow with Dynamic Type no faster than the avatar, up to the text size at its 1.6 times growth: the content still grows with Dynamic Type (`spec:AST-082` FR11), up to its owner's growth, since the owner sizes what it holds (Swift slots S4). | core `Avatar` status position; Swift slots S4 | verify |
|
|
96
|
+
| FR8 | `tooltip` MUST resolve, as core does, to the name for `nil` or `true`, the given words for a string, and nothing for `false` or blank words, and MUST show through the Astryx tooltip (`architecture:native-swift-library-tooltip`), with the focus and touch the Tooltip by input table below states: a static avatar is a tab stop and opens on a tap; a link or button keeps its focus and its tap. Given words are the VoiceOver hint. On the wire it is the web value, a string or a Bool. | core `Avatar` `tooltip`; core `Tooltip`; `spec:AST-082` FR3 | verify |
|
|
95
97
|
|
|
96
98
|
**Tooltip by input (FR8).** The Astryx tooltip's rules apply; this table
|
|
97
99
|
states Avatar's choices.
|
|
@@ -129,7 +131,9 @@ states Avatar's choices.
|
|
|
129
131
|
### Transformation and precedence order
|
|
130
132
|
|
|
131
133
|
- **ORD1 — Picture.** `src` → `fallbackSrc` → initials → person symbol.
|
|
132
|
-
- **ORD2 — Name.** `alt` → `name
|
|
134
|
+
- **ORD2 — Name.** `alt` → `name`, where a blank string is none; then
|
|
135
|
+
compose with the status label (AR6), a dot's label before another
|
|
136
|
+
element's.
|
|
133
137
|
- **ORD3 — Control.** `href` (link) → `onClick` (button) → static.
|
|
134
138
|
|
|
135
139
|
### Performance and resources
|
|
@@ -140,7 +144,8 @@ states Avatar's choices.
|
|
|
140
144
|
## Accessibility contract
|
|
141
145
|
|
|
142
146
|
- **AR1 — Named or decorative.** A static avatar with a name is one image
|
|
143
|
-
element named by `alt`, else `name
|
|
147
|
+
element named by `alt`, else `name`, composed with its status label (AR6);
|
|
148
|
+
without a name and without a status label it is hidden from VoiceOver.
|
|
144
149
|
A link or button avatar is one element with the link or button trait and the
|
|
145
150
|
same name; the initials are never an element of their own (Swift
|
|
146
151
|
accessibility X1, X5).
|
|
@@ -156,6 +161,10 @@ states Avatar's choices.
|
|
|
156
161
|
`color.textSecondary` on `color.neutral`, as core's Avatar does. In the
|
|
157
162
|
default and neutral themes' dark appearance that pair is below 4.5:1, in
|
|
158
163
|
core as well; the fix belongs to the theme tokens.
|
|
164
|
+
- **AR6 — Status in the name.** The status label joins the avatar's name as
|
|
165
|
+
core's message composes it ("Ada Lovelace, Online"); a status label alone
|
|
166
|
+
names an otherwise unnamed avatar. The label comes from an `AvatarStatusDot` or a labeled `Icon` in the slot, at any depth, as core reads the `label` of the element passed as `status`, and a dot's label wins, as core's reported dot label does; SwiftUI cannot read a label from other
|
|
167
|
+
views, so theirs does not join.
|
|
159
168
|
|
|
160
169
|
## Design relationships
|
|
161
170
|
|
|
@@ -185,15 +194,16 @@ Theme values read: `color.neutral`, `color.textSecondary`, `radius.element`,
|
|
|
185
194
|
|
|
186
195
|
## Verification map
|
|
187
196
|
|
|
188
|
-
| Contract | Verification
|
|
189
|
-
| ------------- |
|
|
190
|
-
| FR1, FR2 | `AvatarTests.swift` initials and fallback tests
|
|
191
|
-
| FR3, FR4 | `AvatarTests.swift` size, text-size growth, shape, and two-theme renders
|
|
192
|
-
| FR5, AR2, AR4 | `AvatarTests.swift` link and button renders; tap, trait, tap-area, warning, `linkURL`, and web-path tests
|
|
193
|
-
| FR8 | `AvatarTests.swift` tooltip words, focus and touch, VoiceOver hint, and wire tests; `TooltipPresenterTests.swift` for each input; `contracts.test.ts`; `parseDocType.test.ts`
|
|
194
|
-
| FR6 | `AvatarTests.swift` initializer and hidden tests; `contracts.test.ts`
|
|
195
|
-
|
|
|
196
|
-
|
|
|
197
|
+
| Contract | Verification | Representative states | Mutation or failure expectation | Audit section |
|
|
198
|
+
| ------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ | ---------------------------- |
|
|
199
|
+
| FR1, FR2 | `AvatarTests.swift` initials and fallback tests | core's initials cases; blank and symbol names | a wrong initial or a missing person symbol fails | `audit:swift/Avatar/picture` |
|
|
200
|
+
| FR3, FR4 | `AvatarTests.swift` size, text-size growth, shape, and two-theme renders | each size; xx-large and the largest text size; circle and square; light, dark, butter | a wrong side, no growth or growth past 1.6 times, an unclipped corner, or a color of its own fails | `audit:swift/Avatar/look` |
|
|
201
|
+
| FR5, AR2, AR4 | `AvatarTests.swift` link and button renders; tap, trait, tap-area, warning, `linkURL`, and web-path tests | static, link, button; malformed, relative, and empty `href` | a link or button that draws differently, a malformed `href` made a link, a web path not flagged, or an unflagged unnamed tap fails | `audit:swift/Avatar/control` |
|
|
202
|
+
| FR8 | `AvatarTests.swift` tooltip words, focus and touch, VoiceOver hint, and wire tests; `TooltipPresenterTests.swift` for each input; `contracts.test.ts`; `parseDocType.test.ts` | name, `true`, words, `false`, blank, no name; static, link, button | a wrong tooltip, a static avatar that is not a tab stop or does not open on a tap, a control that loses its tap, or a wire value that is not the web's fails | `audit:swift/Avatar/tooltip` |
|
|
203
|
+
| FR6 | `AvatarTests.swift` initializer and hidden tests; `contracts.test.ts` | both initializers; `isHidden`; named sizes | differing props, a drawn hidden avatar, or a pixel size in Swift fails | `audit:swift/Avatar/api` |
|
|
204
|
+
| FR7, AR6 | `AvatarStatusDotTests.swift` placement renders of a dot and of other content at its measured place, size, an icon's growth at the largest text size, dot-label-wins, and name tests; the label preference that carries a label into the rendered name is not measured (AR3) | circle and square at `lg`; name with and without a status | a dot that changes the avatar's size, sits off the edge, or leaves the name without its label fails | `audit:swift/Avatar/status` |
|
|
205
|
+
| AR1 | `AvatarTests.swift` naming and trait tests | `alt`, `name`, blank, none | a wrong name or a named decorative avatar fails | `audit:swift/Avatar/a11y` |
|
|
206
|
+
| AR5 | `AvatarTests.swift` two-theme renders draw the initials in core's tokens | default and neutral, light and dark | initials in tokens other than core's fail | `audit:swift/Avatar/look` |
|
|
197
207
|
|
|
198
208
|
## Decision log
|
|
199
209
|
|
|
@@ -201,8 +211,7 @@ No component-local decision is recorded.
|
|
|
201
211
|
|
|
202
212
|
## Open questions
|
|
203
213
|
|
|
204
|
-
|
|
205
|
-
has no Swift view, so it stays on the web until one exists.
|
|
214
|
+
None.
|
|
206
215
|
|
|
207
216
|
## Content boundary
|
|
208
217
|
|
|
@@ -11,12 +11,15 @@ import os
|
|
|
11
11
|
/// Avatar("Ada Lovelace", src: "https://example.com/ada.jpg")
|
|
12
12
|
/// Avatar("Ada Lovelace", size: .lg, shape: .rounded)
|
|
13
13
|
/// Avatar("Ada Lovelace", href: "https://example.com/ada")
|
|
14
|
-
/// Avatar("Ada Lovelace") {
|
|
14
|
+
/// Avatar("Ada Lovelace") { AvatarStatusDot(variant: .success, label: "Online") }
|
|
15
|
+
/// Avatar("Ada Lovelace", onClick: showProfile)
|
|
15
16
|
/// ```
|
|
16
|
-
public struct Avatar: View {
|
|
17
|
+
public struct Avatar<Status: View>: View {
|
|
17
18
|
/// The contract the view draws, the same for both initializers.
|
|
18
19
|
public let props: AvatarProps
|
|
20
|
+
let status: Status
|
|
19
21
|
@Environment(\.astryx) private var astryx
|
|
22
|
+
@State private var statusLabel: String?
|
|
20
23
|
|
|
21
24
|
/// An avatar from its labeled props.
|
|
22
25
|
/// - Parameters:
|
|
@@ -28,6 +31,7 @@ public struct Avatar: View {
|
|
|
28
31
|
/// - shape: `circle`, `rounded`, or `square`; `nil` is `circle` (core `shape`).
|
|
29
32
|
/// - tooltip: Words shown where there is a pointer: `nil` or `true` the name, a string those words, `false` none (core `tooltip`).
|
|
30
33
|
/// - href: A URL the system opens when the avatar is tapped; the avatar becomes a link (core `href`).
|
|
34
|
+
/// - status: An `AvatarStatusDot` in the bottom trailing corner; a single trailing closure is this (core `status`).
|
|
31
35
|
/// - onClick: Runs when the avatar is tapped; without `href` the avatar becomes a button (core `onClick`).
|
|
32
36
|
public init(
|
|
33
37
|
_ name: String? = nil,
|
|
@@ -38,18 +42,21 @@ public struct Avatar: View {
|
|
|
38
42
|
shape: AvatarShape? = nil,
|
|
39
43
|
tooltip: AvatarTooltip? = nil,
|
|
40
44
|
href: String? = nil,
|
|
45
|
+
@ViewBuilder status: () -> Status = { EmptyView() },
|
|
41
46
|
onClick: (() -> Void)? = nil
|
|
42
47
|
) {
|
|
43
48
|
self.init(
|
|
44
49
|
AvatarProps(
|
|
45
50
|
src: src, fallbackSrc: fallbackSrc, name: name, alt: alt, size: size, shape: shape, tooltip: tooltip, href: href,
|
|
46
51
|
onClick: onClick
|
|
47
|
-
)
|
|
52
|
+
),
|
|
53
|
+
status: status)
|
|
48
54
|
}
|
|
49
55
|
|
|
50
56
|
/// An avatar from its generated contract, for generated and wire-driven callers.
|
|
51
|
-
public init(_ props: AvatarProps) {
|
|
57
|
+
public init(_ props: AvatarProps, @ViewBuilder status: () -> Status = { EmptyView() }) {
|
|
52
58
|
self.props = props
|
|
59
|
+
self.status = status()
|
|
53
60
|
}
|
|
54
61
|
|
|
55
62
|
public var body: some View {
|
|
@@ -74,7 +81,9 @@ public struct Avatar: View {
|
|
|
74
81
|
assertionFailure(
|
|
75
82
|
"Avatar href \"\(props.href ?? "")\" is not an absolute URL an app can open; it draws without a link.")
|
|
76
83
|
}
|
|
77
|
-
|
|
84
|
+
// The avatar's own name: a status label alone does not name a person.
|
|
85
|
+
let ownName = Avatar.meaningful(props.alt) ?? Avatar.meaningful(props.name)
|
|
86
|
+
if Avatar.needsNameWarning(tap: tap, isNamed: ownName != nil) {
|
|
78
87
|
Logger(subsystem: "Astryx", category: "Avatar").warning(
|
|
79
88
|
"An Avatar with href or onClick has no alt or name, so VoiceOver reads it without a name.")
|
|
80
89
|
}
|
|
@@ -184,8 +193,40 @@ public struct Avatar: View {
|
|
|
184
193
|
}
|
|
185
194
|
.frame(width: side, height: side)
|
|
186
195
|
.clipShape(AvatarShapeOutline(shape: resolvedShape, radius: cornerRadius))
|
|
196
|
+
.overlay {
|
|
197
|
+
// Outside the clip, so the status is never cut off. The layout places
|
|
198
|
+
// it from its own size; SwiftUI mirrors the placement in right-to-left
|
|
199
|
+
// layouts, so it sits on the bottom leading corner there.
|
|
200
|
+
AvatarStatusPlacement(side: side, shape: resolvedShape) {
|
|
201
|
+
status
|
|
202
|
+
.environment(\.astryxAvatarSide, side)
|
|
203
|
+
// The owner sizes what it holds (slots S4): status content never
|
|
204
|
+
// grows with text faster than the avatar does.
|
|
205
|
+
.dynamicTypeSize(...Avatar<EmptyView>.statusTypeSizeCap)
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
.onPreferenceChange(AvatarStatusLabelKey.self) { label in
|
|
209
|
+
statusLabel = label?.text
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
/// How far the status content's bottom trailing corner moves out from the
|
|
214
|
+
/// avatar's, sized from the content itself, as core places any status: on a
|
|
215
|
+
/// circle its center sits on the edge at the bottom trailing 45° point; on a
|
|
216
|
+
/// rounded or square avatar it overhangs the corner by a quarter of its size.
|
|
217
|
+
nonisolated static func statusOffset(content: CGSize, side: CGFloat, shape: AvatarShape) -> CGSize {
|
|
218
|
+
switch shape {
|
|
219
|
+
case .circle:
|
|
220
|
+
return CGSize(width: content.width / 2 - side * circleEdgeInset, height: content.height / 2 - side * circleEdgeInset)
|
|
221
|
+
case .rounded, .square:
|
|
222
|
+
return CGSize(width: content.width / 4, height: content.height / 4)
|
|
223
|
+
}
|
|
187
224
|
}
|
|
188
225
|
|
|
226
|
+
/// Where a 45-degree line meets a circle, as a fraction of its side from
|
|
227
|
+
/// the square's corner: (1 − 1/√2) / 2.
|
|
228
|
+
nonisolated static var circleEdgeInset: CGFloat { (1 - 1 / 2.squareRoot()) / 2 }
|
|
229
|
+
|
|
189
230
|
/// The fallback: initials on the neutral plate, else a person symbol.
|
|
190
231
|
private var plate: some View {
|
|
191
232
|
ZStack {
|
|
@@ -219,6 +260,12 @@ public struct Avatar: View {
|
|
|
219
260
|
/// The most an avatar grows with Dynamic Type.
|
|
220
261
|
nonisolated static var maximumTextScale: CGFloat { 1.6 }
|
|
221
262
|
|
|
263
|
+
/// The largest text size status content grows to: the largest whose text
|
|
264
|
+
/// scale stays within the avatar's own growth (`maximumTextScale`).
|
|
265
|
+
nonisolated static var statusTypeSizeCap: DynamicTypeSize {
|
|
266
|
+
DynamicTypeSize.allCases.last { astryxTextScale(for: $0) <= maximumTextScale } ?? .large
|
|
267
|
+
}
|
|
268
|
+
|
|
222
269
|
nonisolated static func side(for size: AvatarSize, textScale: CGFloat) -> CGFloat {
|
|
223
270
|
(points(for: size) * min(max(textScale, 1), maximumTextScale)).rounded()
|
|
224
271
|
}
|
|
@@ -248,7 +295,16 @@ public struct Avatar: View {
|
|
|
248
295
|
/// The name VoiceOver reads: `alt`, else `name`; `nil` when neither
|
|
249
296
|
/// carries anything, and then a static avatar is decorative.
|
|
250
297
|
var accessibilityLabel: String? {
|
|
251
|
-
Avatar.meaningful(props.alt) ?? Avatar.meaningful(props.name)
|
|
298
|
+
Avatar.accessibleName(name: Avatar.meaningful(props.alt) ?? Avatar.meaningful(props.name), status: statusLabel)
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
/// The name with the status dot's label: "Ada Lovelace, Online" in the
|
|
302
|
+
/// person's language; either alone when the other is absent.
|
|
303
|
+
nonisolated static func accessibleName(name: String?, status: String?) -> String? {
|
|
304
|
+
switch (name, status) {
|
|
305
|
+
case let (name?, status?): AstryxStrings.avatarNameWithStatus(name: name, status: status)
|
|
306
|
+
case let (name, status): name ?? status
|
|
307
|
+
}
|
|
252
308
|
}
|
|
253
309
|
|
|
254
310
|
/// The URL the avatar opens, or `nil` when it has no usable `href`.
|
|
@@ -291,21 +347,21 @@ public struct Avatar: View {
|
|
|
291
347
|
/// words that have one, uppercased. Leading punctuation in a word is skipped.
|
|
292
348
|
nonisolated static func initials(from name: String) -> String {
|
|
293
349
|
let letters = name.split(whereSeparator: { $0.isWhitespace }).compactMap { word in
|
|
294
|
-
word.first(where:
|
|
350
|
+
word.first(where: avatarCanStandForAWord)
|
|
295
351
|
}
|
|
296
352
|
guard let first = letters.first else { return "" }
|
|
297
353
|
guard letters.count > 1, let last = letters.last else { return String(first).uppercased() }
|
|
298
354
|
return (String(first) + String(last)).uppercased()
|
|
299
355
|
}
|
|
356
|
+
}
|
|
300
357
|
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
}
|
|
358
|
+
/// A letter, a digit, or an emoji, as core's `\p{L}`, `\p{N}`,
|
|
359
|
+
/// `\p{Extended_Pictographic}`, and `\p{Regional_Indicator}`.
|
|
360
|
+
func avatarCanStandForAWord(_ character: Character) -> Bool {
|
|
361
|
+
if character.isLetter || character.isNumber { return true }
|
|
362
|
+
guard let scalar = character.unicodeScalars.first else { return false }
|
|
363
|
+
// `isEmoji` also covers `#`, `*`, and the digits, which are ASCII.
|
|
364
|
+
return scalar.value > 0x7F && scalar.properties.isEmoji
|
|
309
365
|
}
|
|
310
366
|
|
|
311
367
|
/// Draws the image at a URL: `loading` while it loads, `failure` when it
|
|
@@ -366,16 +422,37 @@ private struct AvatarShapeOutline: Shape {
|
|
|
366
422
|
}
|
|
367
423
|
}
|
|
368
424
|
|
|
425
|
+
/// Places the status content at the avatar's bottom trailing corner from the
|
|
426
|
+
/// content's own size (`Avatar.statusOffset`), in the same layout pass, so it
|
|
427
|
+
/// is in place from the first frame whatever it holds.
|
|
428
|
+
private struct AvatarStatusPlacement: Layout {
|
|
429
|
+
let side: CGFloat
|
|
430
|
+
let shape: AvatarShape
|
|
431
|
+
|
|
432
|
+
func sizeThatFits(proposal: ProposedViewSize, subviews: Subviews, cache: inout ()) -> CGSize {
|
|
433
|
+
proposal.replacingUnspecifiedDimensions(by: CGSize(width: side, height: side))
|
|
434
|
+
}
|
|
435
|
+
|
|
436
|
+
func placeSubviews(in bounds: CGRect, proposal: ProposedViewSize, subviews: Subviews, cache: inout ()) {
|
|
437
|
+
for subview in subviews {
|
|
438
|
+
let size = subview.sizeThatFits(.unspecified)
|
|
439
|
+
let offset = Avatar<EmptyView>.statusOffset(content: size, side: side, shape: shape)
|
|
440
|
+
let origin = CGPoint(x: bounds.maxX - size.width + offset.width, y: bounds.maxY - size.height + offset.height)
|
|
441
|
+
subview.place(at: origin, anchor: .topLeading, proposal: ProposedViewSize(size))
|
|
442
|
+
}
|
|
443
|
+
}
|
|
444
|
+
}
|
|
445
|
+
|
|
369
446
|
/// One element named by the avatar's label. A static avatar without a label
|
|
370
447
|
/// is hidden; an interactive one keeps its link or button trait.
|
|
371
448
|
private struct AvatarName: ViewModifier {
|
|
372
449
|
let label: String?
|
|
373
|
-
let tap: Avatar
|
|
450
|
+
let tap: Avatar<EmptyView>.Tap
|
|
374
451
|
|
|
375
452
|
func body(content: Content) -> some View {
|
|
376
453
|
let isNamed = label != nil
|
|
377
|
-
let added = Avatar
|
|
378
|
-
let removed = Avatar
|
|
454
|
+
let added = Avatar<EmptyView>.addedTraits(tap: tap, isNamed: isNamed)
|
|
455
|
+
let removed = Avatar<EmptyView>.removedTraits(tap: tap, isNamed: isNamed)
|
|
379
456
|
if let label {
|
|
380
457
|
if tap == .none {
|
|
381
458
|
// One image element named by the name.
|
|
@@ -400,7 +477,7 @@ private struct AvatarTarget: ViewModifier {
|
|
|
400
477
|
let side: CGFloat
|
|
401
478
|
|
|
402
479
|
func body(content: Content) -> some View {
|
|
403
|
-
content.contentShape(.interaction, Rectangle().inset(by: -Avatar
|
|
480
|
+
content.contentShape(.interaction, Rectangle().inset(by: -Avatar<EmptyView>.tapOutset(side: side)))
|
|
404
481
|
}
|
|
405
482
|
}
|
|
406
483
|
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
---
|
|
2
|
+
schema_version: 3
|
|
3
|
+
template_version: 7
|
|
4
|
+
kind: component
|
|
5
|
+
id: component:swift/AvatarStatusDot
|
|
6
|
+
platform_of: component:AvatarStatusDot
|
|
7
|
+
authority: draft
|
|
8
|
+
archive_reason: null
|
|
9
|
+
superseded_by: null
|
|
10
|
+
approved_by: null
|
|
11
|
+
approved_at: null
|
|
12
|
+
owners: [cixzhang]
|
|
13
|
+
review_triggers: [public-api, behavior, theming, accessibility]
|
|
14
|
+
verified_by:
|
|
15
|
+
[
|
|
16
|
+
packages/native/apple/Tests/AstryxTests/AvatarStatusDotTests.swift,
|
|
17
|
+
packages/native/src/contract/contracts.test.ts,
|
|
18
|
+
]
|
|
19
|
+
modules: []
|
|
20
|
+
families: []
|
|
21
|
+
design_specs: []
|
|
22
|
+
architecture: []
|
|
23
|
+
contributing: []
|
|
24
|
+
system_specs: [spec:AST-082, spec:AST-093]
|
|
25
|
+
---
|
|
26
|
+
|
|
27
|
+
# AvatarStatusDot (Swift) component contract
|
|
28
|
+
|
|
29
|
+
## Contract at a glance
|
|
30
|
+
|
|
31
|
+
| Area | Contract |
|
|
32
|
+
| ----------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
33
|
+
| Public contract | `AvatarStatusDot(variant: AvatarStatusDotVariant? = nil, label: String? = nil)` and `AvatarStatusDot(_ props: AvatarStatusDotProps)`, a SwiftUI `View`, placed in `Avatar`'s `status` slot. |
|
|
34
|
+
| Behavior | Draws core's dot at the tier for its avatar's size: `success` filled, `neutral` a ring, `error` a minus bar, each in theme tokens with a surface border. Its label joins the avatar's name. |
|
|
35
|
+
| End-user impact | A person sees who is online, away, or busy by shape as well as color, and VoiceOver reads it with the person's name ("Ada Lovelace, Online"). |
|
|
36
|
+
| Builder impact | An app puts the dot in the avatar's trailing closure with a label. A custom icon inside the dot has no Swift form. |
|
|
37
|
+
| Compatibility/readiness | Additive: a new view, generated `AvatarStatusDotProps`, and core's name-with-status message in the Swift string catalogs. Draft; built and tested on macOS and the iOS Simulator; device captures are attached. |
|
|
38
|
+
| Review checks | Reject a status shown by color alone, a dot that resizes or moves the avatar, a dot that VoiceOver reads separately inside an avatar, or a color that is not a theme token. |
|
|
39
|
+
| Governing rules | `spec:AST-082` FR4, FR7; `spec:AST-093` FR1–FR5; the Swift component API, slots (S4), theme environment, and accessibility (X1, X6) records under `packages/native/specs/swift/library/`. |
|
|
40
|
+
|
|
41
|
+
This table is a review projection; the body below is authoritative.
|
|
42
|
+
|
|
43
|
+
## Intent
|
|
44
|
+
|
|
45
|
+
AvatarStatusDot on Apple platforms shows a person's status on their avatar by
|
|
46
|
+
shape and color, sized from the avatar, and gives the avatar its words.
|
|
47
|
+
|
|
48
|
+
## Compatibility and migration
|
|
49
|
+
|
|
50
|
+
- Released default preserved: `not yet released`
|
|
51
|
+
- Compatibility class: additive
|
|
52
|
+
- Controlled/uncontrolled behavior: not applicable
|
|
53
|
+
- Migration decision: none
|
|
54
|
+
|
|
55
|
+
Consumer migration instructions belong in consumer docs and release notes.
|
|
56
|
+
|
|
57
|
+
## Ownership boundary
|
|
58
|
+
|
|
59
|
+
**Owns**
|
|
60
|
+
|
|
61
|
+
- The dot's size tier, fill, border, and shape glyph per variant.
|
|
62
|
+
- Reporting its label to the avatar that holds it.
|
|
63
|
+
|
|
64
|
+
**Does not own / non-goals**
|
|
65
|
+
|
|
66
|
+
- Where the dot sits and how the name is composed — owned by
|
|
67
|
+
`component:swift/Avatar` (FR7, AR6).
|
|
68
|
+
- The meaning of the variants — owned by `component:AvatarStatusDot`.
|
|
69
|
+
|
|
70
|
+
## Public concepts
|
|
71
|
+
|
|
72
|
+
| Concept | Closed values or states | Meaning | Availability by variant/orientation/state | Default | Owner | Stability | Invalid-value behavior |
|
|
73
|
+
| ------- | ----------------------------- | -------------------------------------------------------- | ----------------------------------------- | --------- | --------------------------- | ------------ | ---------------------- |
|
|
74
|
+
| variant | `success`, `neutral`, `error` | filled dot, ring, minus bar | always | `success` | `component:AvatarStatusDot` | experimental | none |
|
|
75
|
+
| tier | small, medium, large | 10, 20, 32 point dot for avatars up to 36, 72, and above | from the avatar; small alone | small | `component:AvatarStatusDot` | experimental | none |
|
|
76
|
+
|
|
77
|
+
## Behavioral and layout contract
|
|
78
|
+
|
|
79
|
+
| ID | Candidate invariant | Basis | Draft review state |
|
|
80
|
+
| --- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------- | ------------------ |
|
|
81
|
+
| FR1 | The dot MUST take core's tier for its avatar's side: up to 36 points a 10-point dot with a 1-point border and 1-point glyph stroke; up to 72 a 20-point dot, 2-point border, 1.5-point stroke; larger a 32-point dot, 4-point border, 2-point stroke. Outside an avatar it is small. | core `AvatarStatusDot` size tiers | verify |
|
|
82
|
+
| FR2 | `success` MUST fill with `color.success` and draw no glyph; `neutral` MUST fill with `color.backgroundSurface` and draw a ring in `color.textSecondary` on the inner field; `error` MUST fill with `color.error` and draw a round-capped bar in `color.onError` across three quarters of the inner field. Every dot has a `color.backgroundSurface` border. The plates are the strong status fills, `color.success` and `color.error`, and their ink is the matching content role, `color.onSuccess` and `color.onError`, as core's are (`architecture:theme-tokens` INV11). | core `AvatarStatusDot` styles | verify |
|
|
83
|
+
| FR3 | Both initializers MUST build the same `AvatarStatusDotProps`. Base props come through `AvatarStatusDotProps`: with `isHidden` the view draws nothing; `id` becomes the accessibility identifier. | Swift component API A2, A3, A7 | verify |
|
|
84
|
+
|
|
85
|
+
### Allowed variation
|
|
86
|
+
|
|
87
|
+
- **AV1 — Glyph drawing.** The ring and bar are SwiftUI shapes at core's stroke
|
|
88
|
+
widths, not core's SVG.
|
|
89
|
+
|
|
90
|
+
### Representative states
|
|
91
|
+
|
|
92
|
+
| State | Required invariant | Allowed variation |
|
|
93
|
+
| -------------------------- | ---------------------------------- | ----------------- |
|
|
94
|
+
| each variant | its fill, glyph, and border | AV1 |
|
|
95
|
+
| each tier | its dot, border, and stroke | none |
|
|
96
|
+
| on a circle and a square | placed by `component:swift/Avatar` | none |
|
|
97
|
+
| light and dark, two themes | each theme's colors | none |
|
|
98
|
+
|
|
99
|
+
### Transformation and precedence order
|
|
100
|
+
|
|
101
|
+
- **ORD1 — Tier.** The avatar's side → small outside an avatar.
|
|
102
|
+
|
|
103
|
+
### Performance and resources
|
|
104
|
+
|
|
105
|
+
- **PR1 — Shapes only.** The dot draws SwiftUI shapes and loads nothing.
|
|
106
|
+
|
|
107
|
+
## Accessibility contract
|
|
108
|
+
|
|
109
|
+
- **AR1 — Inside an avatar.** The dot's label reaches VoiceOver through the
|
|
110
|
+
avatar's name, and the dot is not a separate element (Swift accessibility
|
|
111
|
+
X5).
|
|
112
|
+
- **AR2 — Alone.** A labeled dot outside an avatar is one image element named
|
|
113
|
+
by its label; an unlabeled one is hidden (X1).
|
|
114
|
+
- **AR3 — Not by color alone.** Each variant has its own shape (X6, Differentiate
|
|
115
|
+
Without Color).
|
|
116
|
+
- **AR4 — Rendered tree not measured.** Tests assert what the view sets; the
|
|
117
|
+
rendered accessibility tree is not measured until an app-hosted target
|
|
118
|
+
exists.
|
|
119
|
+
|
|
120
|
+
## Design relationships
|
|
121
|
+
|
|
122
|
+
| Anatomy or state | Design requirement | Representation authority | Hierarchy role | Component contract |
|
|
123
|
+
| ---------------- | ----------------------------------------------- | ------------------------ | -------------- | ------------------ |
|
|
124
|
+
| Dot and glyph | Apple Human Interface Guidelines, Accessibility | prescribed by core | supporting | FR1, FR2 |
|
|
125
|
+
|
|
126
|
+
The component implements design requirements without copying their rationale.
|
|
127
|
+
|
|
128
|
+
Platform control: SwiftUI has no status badge control for an image, so the dot
|
|
129
|
+
is drawn from SwiftUI shapes (`spec:AST-093` FR2). Guideline page:
|
|
130
|
+
Accessibility in the Apple Human Interface Guidelines.
|
|
131
|
+
|
|
132
|
+
Theme values read: `color.success`, `color.error`, `color.onSuccess`, `color.onError`, `color.backgroundSurface`,
|
|
133
|
+
`color.textSecondary`.
|
|
134
|
+
|
|
135
|
+
## Family and system relationships
|
|
136
|
+
|
|
137
|
+
- `component:AvatarStatusDot` owns the variants and tiers; this record states
|
|
138
|
+
only how Swift draws them.
|
|
139
|
+
- `component:swift/Avatar` owns the dot's placement and the composed name.
|
|
140
|
+
|
|
141
|
+
## Verification map
|
|
142
|
+
|
|
143
|
+
| Contract | Verification | Representative states | Mutation or failure expectation | Audit section |
|
|
144
|
+
| -------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------ | ---------------------------------- |
|
|
145
|
+
| FR1 | `AvatarStatusDotTests.swift` tier test | 36, 48, 128 points; no avatar | a wrong dot, border, or stroke fails | `audit:swift/AvatarStatusDot/tier` |
|
|
146
|
+
| FR2 | `AvatarStatusDotTests.swift` variant render, ring sides, and the busy bar in Y2K | each variant at the large tier; neutral, butter, dark; Y2K light, where on-error and the surface differ | a wrong fill, a missing ring side or glyph, a bar not in on-error, or a glyph on success fails | `audit:swift/AvatarStatusDot/look` |
|
|
147
|
+
| FR3 | `AvatarStatusDotTests.swift` initializer test; `contracts.test.ts` | both initializers | differing props fail | `audit:swift/AvatarStatusDot/api` |
|
|
148
|
+
| AR1, AR2 | `AvatarStatusDotTests.swift` composed-name, standalone-trait, and hidden tests; the label the dot reports to its avatar in a rendered tree is not measured (`component:swift/Avatar` AR3) | name with and without a status; a dot alone with and without a label | a composed name without the status label, or a standalone dot without its label and image trait, fails | `audit:swift/AvatarStatusDot/a11y` |
|
|
149
|
+
|
|
150
|
+
## Decision log
|
|
151
|
+
|
|
152
|
+
No component-local decision is recorded.
|
|
153
|
+
|
|
154
|
+
## Open questions
|
|
155
|
+
|
|
156
|
+
- **OQ1 — A custom icon in the dot.** (`human-api`) Core's `icon` is free-form
|
|
157
|
+
content; it reaches Swift once the contract has the shared icon-name slot.
|
|
158
|
+
|
|
159
|
+
## Content boundary
|
|
160
|
+
|
|
161
|
+
This file does not duplicate consumer prop tables/examples, current audit
|
|
162
|
+
results, implementation steps, or family/system rules. It links to their owners.
|