stylegallery 0.1.6 → 0.1.8

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.
Files changed (97) hide show
  1. package/AGENTS.md +13 -1
  2. package/DOMAINS.md +10 -6
  3. package/GOVERNANCE.md +14 -12
  4. package/LICENSE +28 -0
  5. package/LICENSE-DOCS +42 -0
  6. package/NOTICE +38 -0
  7. package/README.md +47 -15
  8. package/consumer-reference/agent-native/README.md +7 -7
  9. package/consumer-reference/agent-native/v2/admission-policy.json +196 -31
  10. package/consumer-reference/agent-native/v2/material-registry.json +1 -1
  11. package/consumer-reference/agent-native/v2/schema/admission-policy.schema.json +3 -3
  12. package/consumer-reference/agent-native/v2/schema/material-record.schema.json +1 -1
  13. package/design-engineering/component-contract.md +19 -3
  14. package/design-engineering/decision-tree.md +1 -0
  15. package/design-engineering/index.md +48 -0
  16. package/design-engineering/loading-and-feedback.md +91 -0
  17. package/design-engineering/native-interaction-contracts.md +94 -0
  18. package/design-engineering/state-management/decision-tree.md +60 -0
  19. package/design-engineering/state-management/index.md +61 -0
  20. package/design-engineering/state-management/patterns/derived-state.md +85 -0
  21. package/design-engineering/state-management/patterns/draft-and-baseline.md +86 -0
  22. package/design-engineering/state-management/patterns/id-selection.md +85 -0
  23. package/design-engineering/state-management/patterns/identity-reset.md +89 -0
  24. package/design-engineering/state-management/patterns/latest-request-wins.md +94 -0
  25. package/design-engineering/state-management/patterns/optimistic-overlay.md +98 -0
  26. package/design-engineering/state-management/patterns/single-flight.md +92 -0
  27. package/design-engineering/state-management/patterns/single-owner.md +89 -0
  28. package/design-engineering/state-management/patterns/submitted-snapshot.md +107 -0
  29. package/design-engineering/state-management/patterns/unsaved-navigation.md +100 -0
  30. package/design-engineering/state-management/patterns/url-state.md +96 -0
  31. package/design-engineering/state-management/patterns/versioned-restore.md +95 -0
  32. package/design-engineering/state-management/recipes/delete-undo.md +65 -0
  33. package/design-engineering/state-management/recipes/index.md +64 -0
  34. package/design-engineering/state-management/recipes/multi-step-form.md +65 -0
  35. package/design-engineering/state-management/recipes/search-detail.md +65 -0
  36. package/design-engineering/state-management/recipes/settings-save.md +64 -0
  37. package/design-engineering/state-management/state-brief.md +83 -0
  38. package/design-engineering/state-management/verification.md +65 -0
  39. package/design-engineering/text-input-and-internationalization.md +91 -0
  40. package/design-engineering/worked-examples.md +2 -0
  41. package/design-terminology/conflict-cases.md +51 -8
  42. package/design-terminology/index.md +6 -0
  43. package/design-terminology/interaction-semantics.md +87 -0
  44. package/design-terminology/source-kinds.md +1 -1
  45. package/design-terminology/source-vocabularies.md +17 -1
  46. package/design-terminology/token-semantics.md +90 -0
  47. package/design-terminology/typography-semantics.md +86 -0
  48. package/expression/brand-studies.md +50 -0
  49. package/expression/direction-brief.md +71 -0
  50. package/expression/directions/nocturne-editorial.md +80 -0
  51. package/expression/directions/warm-print.md +73 -0
  52. package/expression/index.md +40 -0
  53. package/expression/techniques/gradient-atmosphere.md +107 -0
  54. package/expression/techniques/grain-and-texture.md +83 -0
  55. package/expression/techniques/webgl-hero.md +123 -0
  56. package/guides/vocabulary.md +1 -1
  57. package/index.md +3 -3
  58. package/log.md +64 -0
  59. package/motion/accessible-motion.md +90 -0
  60. package/motion/index.md +9 -0
  61. package/motion/interaction-recipes.md +8 -2
  62. package/motion/interruption-and-retargeting.md +90 -0
  63. package/motion/observed-choreography.md +73 -0
  64. package/motion/rendering-and-performance.md +89 -0
  65. package/motion/techniques/kinetic-type.md +145 -0
  66. package/motion/techniques/scroll-choreography.md +154 -0
  67. package/package.json +76 -21
  68. package/platform-guides/adaptive-navigation.md +85 -0
  69. package/platform-guides/compatibility-matrix.md +1 -1
  70. package/platform-guides/index.md +6 -0
  71. package/platform-guides/input-and-focus.md +91 -0
  72. package/platform-guides/preferences-and-accessibility.md +90 -0
  73. package/quality/claim-records/stylegallery-multidomain-scope.md +2 -2
  74. package/quality/evidence/executable-evidence.md +1 -1
  75. package/quality/index.md +1 -2
  76. package/scripts/agent-native/v2/material-admission.mjs +1 -1
  77. package/scripts/agent-native/v2/material-identity.mjs +2 -2
  78. package/scripts/compiler/README.md +112 -0
  79. package/scripts/compiler/cli.mjs +51 -0
  80. package/scripts/compiler/mcp.mjs +53 -0
  81. package/scripts/compiler/operations.mjs +70 -0
  82. package/scripts/compiler/runtime.mjs +156 -0
  83. package/scripts/sg-entry.mjs +20 -0
  84. package/scripts/sg-server.mjs +20 -0
  85. package/showcase/README.md +113 -0
  86. package/game-ui/classification.md +0 -82
  87. package/game-ui/decision-tree.md +0 -81
  88. package/game-ui/index.md +0 -45
  89. package/game-ui/reference-record.md +0 -62
  90. package/game-ui/screen-hierarchy.md +0 -107
  91. package/game-ui/screen-recipes.md +0 -101
  92. package/game-ui/unity/architecture.md +0 -166
  93. package/game-ui/unity/cli-loop.md +0 -84
  94. package/game-ui/unity/org-wiki.md +0 -146
  95. package/game-ui/unity/repository-map.md +0 -102
  96. package/game-ui/unity/ui-systems.md +0 -85
  97. package/game-ui/verification-workflow.md +0 -100
@@ -13,15 +13,15 @@
13
13
  "media_type": { "const": "text/markdown" },
14
14
  "allowed_materials": {
15
15
  "type": "array",
16
- "minItems": 147,
17
- "maxItems": 147,
16
+ "minItems": 180,
17
+ "maxItems": 180,
18
18
  "items": {
19
19
  "type": "object",
20
20
  "additionalProperties": false,
21
21
  "required": ["repository_path", "domain", "lifecycle"],
22
22
  "properties": {
23
23
  "repository_path": { "type": "string", "pattern": "^(?!/)(?!.*(?:^|/)\\.{1,2}(?:/|$))[A-Za-z0-9._ -]+(?:/[A-Za-z0-9._ -]+)*\\.md$" },
24
- "domain": { "enum": ["layout", "motion", "design-engineering", "game-ui", "platform-guides", "design-terminology", "shared"] },
24
+ "domain": { "enum": ["layout", "motion", "design-engineering", "platform-guides", "design-terminology", "expression", "shared"] },
25
25
  "lifecycle": { "enum": ["draft", "stable", "deprecated", "experimental", "generated"] }
26
26
  }
27
27
  }
@@ -15,6 +15,6 @@
15
15
  "source_sha256": { "type": "string", "pattern": "^[a-f0-9]{64}$" },
16
16
  "byte_length": { "type": "integer", "minimum": 0 },
17
17
  "lifecycle": { "enum": ["draft", "stable", "deprecated", "experimental", "generated"] },
18
- "domain": { "enum": ["layout", "motion", "design-engineering", "game-ui", "platform-guides", "design-terminology", "shared"] }
18
+ "domain": { "enum": ["layout", "motion", "design-engineering", "platform-guides", "design-terminology", "expression", "shared"] }
19
19
  }
20
20
  }
@@ -19,6 +19,8 @@ This contract describes consumer-owned behavior. It does not create a shared com
19
19
 
20
20
  Start with semantic HTML or the platform's native control. Name the public inputs, emitted events, internal state, and owner of persisted data. Then describe each transition and its observable outcome. Use the [Worked Examples](worked-examples.md) to check common failure paths.
21
21
 
22
+ For reusable ownership and transition mechanisms, use the [State Management catalog](state-management/index.md). The [submitted snapshot pattern](state-management/patterns/submitted-snapshot.md) provides an executable model of the save contract below.
23
+
22
24
  ## Contract Template
23
25
 
24
26
  | Field | Required answer |
@@ -29,7 +31,7 @@ Start with semantic HTML or the platform's native control. Name the public input
29
31
  | Outputs | Events, payload meaning, when they are emitted, who commits the result |
30
32
  | State | Initial, active, selected, disabled, pending, empty, error, completed as applicable |
31
33
  | State ownership | Controlled inputs versus internal temporary state; reconciliation rule |
32
- | Input and focus | Keyboard, pointer, touch, focus entry/return and unavailable actions |
34
+ | Input and focus | Keyboard, pointer, touch, focus entry/return and unavailable actions; for any drag operation, the separate single-pointer and keyboard alternatives |
33
35
  | Async ownership | Request identity, duplicate action policy, stale result handling, cancellation |
34
36
  | Content | Empty, long, localized, unbroken and unavailable data |
35
37
  | Spatial composition | Layout source, parent constraints, scroll owner and overflow behavior |
@@ -72,6 +74,20 @@ on result(identity, result):
72
74
 
73
75
  A real application also defines revision conflicts, server normalization, and retry semantics. The sketch is not a distributed consistency protocol. Its handoff is `consumer_reference: not_applicable` because this fictional example selects no consumer profile or conformance record.
74
76
 
77
+ ## Drag Operations Need Two Alternatives
78
+
79
+ When a component commits a value through dragging (reorder, slider thumb, resize handle, board column move), answer the Input and focus field once per input path:
80
+
81
+ | Path | Required answer |
82
+ | --- | --- |
83
+ | Drag | What previews, what release commits, what cancellation restores |
84
+ | Single pointer without dragging | Which click or tap controls reach the same committed value, and where they are visible without hover |
85
+ | Keyboard | Which keys reach the same committed value, and where focus rests afterwards |
86
+
87
+ [WCAG 2.2 Success Criterion 2.5.7](https://www.w3.org/TR/WCAG22/#dragging-movements) (Level AA) is the named source for the second row. Its Understanding document evaluates it independently from keyboard operation, so a keyboard handler does not answer it and pointer-only buttons do not answer the keyboard row. The criterion excepts dragging that is essential and functionality the user agent determines without author modification; a custom slider, sortable list, or pan surface owns all three rows. A swipe or flick is not an acceptable second row because it is still a path-based gesture. All paths emit the same output event with the same payload meaning, so validation, duplicate policy, and stale-result handling are not bypassed by the alternative. The motion and cancellation side is in [Drag And Settle](../motion/interaction-recipes.md#drag-and-settle).
88
+
89
+ This contract names what to declare. It does not establish conformance; that requires the consuming product's rendered behavior under the [accessibility evidence gate](../quality/gates/accessibility-evidence.md). [Target Size (Minimum)](https://www.w3.org/WAI/WCAG22/Understanding/target-size-minimum.html) is a different criterion for the size of those pointer controls and is measured in CSS pixels, not platform dp or pt.
90
+
75
91
  ## Opinionated Guidance
76
92
 
77
93
  Use state names that expose meaningful differences. Two booleans can accidentally permit “saved and failed”; a state transition table helps reveal impossible combinations. Do not merge input validity, request state, and persisted revision into one visual status.
@@ -86,11 +102,11 @@ A state table does not prove accessibility, successful persistence, race freedom
86
102
 
87
103
  ## Verification Contract
88
104
 
89
- Resolve responses out of order, edit during saving, fail then retry, activate repeatedly, and remove the component before completion. Inspect both persisted and displayed values. Include keyboard-only operation, long content, and constrained parents. Record actual outcomes; the table above is an unexecuted reference contract. Review when a public input, event, or state meaning changes.
105
+ Resolve responses out of order, edit during saving, fail then retry, activate repeatedly, and remove the component before completion. Inspect both persisted and displayed values. Include keyboard-only operation, long content, and constrained parents. For a drag operation, complete the task by drag, by click or tap without movement, and by keyboard, then compare the committed value, emitted event, and focus position. Record actual outcomes; the table above is an unexecuted reference contract. Review when a public input, event, or state meaning changes.
90
106
 
91
107
  ## Source, License, And Attribution
92
108
 
93
- Locally authored contract and pseudocode; no framework or upstream implementation is copied. Shared quality gates own evidence admissibility.
109
+ Locally authored contract and pseudocode; no framework or upstream implementation is copied. WCAG 2.2 (W3C Recommendation, 12 December 2024) and the informative Understanding pages for Success Criteria 2.5.7 (updated 10 August 2026) and 2.5.8 were rechecked on 2026-09-19 for the statements attributed to them; the three-path table is local synthesis and has not been executed against a product. Shared quality gates own evidence admissibility.
94
110
 
95
111
  ## IA Navigation
96
112
 
@@ -29,6 +29,7 @@ This route turns a product request into a bounded implementation decision. It ow
29
29
  | --- | --- | --- |
30
30
  | What should this screen contain? | [Webpage Generation Workflow](../guides/webpage-generation-workflow.md) | Content inventory and task model |
31
31
  | What owns size, flow, and scroll? | [Layout Planning Guide](../GUIDE.md) | Layout brief and pattern composition |
32
+ | Where should state live, and how do its transitions compose? | [State Management](state-management/index.md) | Owner map, selected patterns, and acceptance traces |
32
33
  | What happens after activation or failure? | [Component Contract](component-contract.md) | State, event, focus, and asynchronous ownership tables |
33
34
  | How should a form, search, or destructive action recover? | [Worked Examples](worked-examples.md) | Scenario-specific acceptance cases |
34
35
  | Does a product detail serve the task? | [Interface Craft Decisions](interface-craft.md) | Claim with an observable and evidence boundary |
@@ -18,6 +18,48 @@ Out of scope: a second universal principle set, unsupported claims of beauty or
18
18
 
19
19
  These workflows and worked cases are usable experimental guidance. Expected-result tables are test designs; actual product, engine, and reader evidence must be recorded separately. Review on a failed task, a source change, or a changed ownership contract.
20
20
 
21
+ ## State Management
22
+
23
+ Choose [State Management](state-management/index.md) for UI state ownership, transitions, asynchronous consistency, and lifetime. The collection contains 12 patterns and four behavior recipes within this domain.
24
+
25
+ ### Planning And Verification
26
+
27
+ - [State decision tree](state-management/decision-tree.md)
28
+ - [State brief](state-management/state-brief.md)
29
+ - [State verification matrix](state-management/verification.md)
30
+ - [State recipes and composition matrix](state-management/recipes/index.md)
31
+
32
+ ### Ownership And Derivation
33
+
34
+ - [Single owner and controlled inputs](state-management/patterns/single-owner.md)
35
+ - [Derived state](state-management/patterns/derived-state.md)
36
+ - [Selection by stable identity](state-management/patterns/id-selection.md)
37
+
38
+ ### Editing And Persistence
39
+
40
+ - [Draft and persisted baseline](state-management/patterns/draft-and-baseline.md)
41
+ - [Submitted snapshot](state-management/patterns/submitted-snapshot.md)
42
+ - [Unsaved navigation](state-management/patterns/unsaved-navigation.md)
43
+
44
+ ### Asynchronous Consistency
45
+
46
+ - [Latest request wins](state-management/patterns/latest-request-wins.md)
47
+ - [Single flight](state-management/patterns/single-flight.md)
48
+ - [Optimistic overlay](state-management/patterns/optimistic-overlay.md)
49
+
50
+ ### Navigation And Lifetime
51
+
52
+ - [URL state](state-management/patterns/url-state.md)
53
+ - [Identity reset](state-management/patterns/identity-reset.md)
54
+ - [Versioned restore](state-management/patterns/versioned-restore.md)
55
+
56
+ ### Screen Compositions
57
+
58
+ - [Settings save](state-management/recipes/settings-save.md)
59
+ - [Search and detail](state-management/recipes/search-detail.md)
60
+ - [Multi-step form](state-management/recipes/multi-step-form.md)
61
+ - [Delete and supported undo](state-management/recipes/delete-undo.md)
62
+
21
63
  ## Documents
22
64
 
23
65
  - [Interface Craft Decisions](interface-craft.md) connects product purpose, implementation detail, and verification without treating taste as proof.
@@ -28,6 +70,12 @@ These workflows and worked cases are usable experimental guidance. Expected-resu
28
70
 
29
71
  This domain proposes product-layer questions. [Quality Gates](../quality/index.md) remain the shared authority for claims, evidence families, accessibility precedence, rationale, and debt.
30
72
 
73
+ ## Source-Backed Deep Dives
74
+
75
+ - [Native Interaction Contracts](native-interaction-contracts.md). Choose dialog, disclosure, menu, popover, and combobox behavior.
76
+ - [Text Input And Internationalization](text-input-and-internationalization.md). Preserve IME composition, text units, mixed direction, and editing intent.
77
+ - [Loading, Progress, And Feedback](loading-and-feedback.md). Separate pending work, accepted results, announcements, and responsiveness.
78
+
31
79
  ## Domain Contract
32
80
 
33
81
  See [StyleGallery Domains](../DOMAINS.md) for lifecycle, provenance, page membership, and staleness rules.
@@ -0,0 +1,91 @@
1
+ ---
2
+ type: Domain Guide
3
+ title: Loading, Progress, And Feedback
4
+ description: Separate input acknowledgement, pending work, stale content, confirmed completion, and measurable responsiveness.
5
+ domain: design-engineering
6
+ lifecycle: experimental
7
+ provenance_kind: local
8
+ reviewed_on: 2026-09-21
9
+ ---
10
+
11
+ # Loading, Progress, And Feedback
12
+
13
+ Primary role: asynchronous presentation and measurement guide.
14
+
15
+ ## Repository Boundary
16
+
17
+ This page owns the product's account of pending work and results. Request authority remains in [State Management](state-management/index.md), motion in [Motion](../motion/index.md), and evidence claims in [Quality](../quality/index.md). A loading treatment is not a reusable Layout pattern.
18
+
19
+ ## Reusable Method
20
+
21
+ Identify the fact behind each displayed state. Distinguish input received, request started, work in progress, result accepted, result rendered, and result announced. Select a feedback mechanism only after its state owner and truth condition are explicit.
22
+
23
+ ### Source Findings
24
+
25
+ | Source | Bounded finding | Implication |
26
+ | --- | --- | --- |
27
+ | [HTML progress element](https://html.spec.whatwg.org/multipage/form-elements.html#the-progress-element) | A progress element can represent determinate or indeterminate task completion; omitting `value` expresses indeterminate progress. | Do not fabricate a percent complete when total work is unknown. |
28
+ | [WAI-ARIA 1.2 busy state](https://www.w3.org/TR/wai-aria-1.2/#aria-busy) | `aria-busy` indicates an element is being modified; assistive technologies may defer exposing changes while it is busy. | Clear the state on every terminal path and verify actual announcements. |
29
+ | [Status Messages explanation](https://www.w3.org/WAI/WCAG22/Understanding/status-messages.html) | A result summary may be a status message, while the entire returned result list is not thereby a status message. | Announce concise state/result information rather than every changing node. |
30
+ | [Interaction to Next Paint](https://web.dev/articles/inp) | INP measures interaction responsiveness through the next paint; good field responsiveness is described as at most 200 ms at the 75th percentile, assessed by device category. | Do not use that number as a required animation duration or server-response deadline. |
31
+ | [Optimize INP](https://web.dev/articles/optimize-inp) | Input delay, event processing, and presentation delay contribute to the interaction latency. | Diagnose which interval is slow before changing a loading indicator. |
32
+ | [Event Timing API](https://www.w3.org/TR/event-timing/) | The API defines event timing observations with implementation and exposure constraints. | Record the instrument and observation scope rather than treating callback time as total latency. |
33
+ | [Cumulative Layout Shift](https://web.dev/articles/cls) | CLS measures unexpected layout movement with defined exclusions and aggregation. | A stable placeholder can help spatial stability without proving timely or correct completion. |
34
+
35
+ Sources were inspected 2026-09-21. Browser metric guidance is a measurement convention, not a guarantee of perceived quality. Standards-track drafts and actual browser instrumentation must be distinguished.
36
+
37
+ ### State-To-Presentation Contract
38
+
39
+ | State | Required truth | Local presentation proposal |
40
+ | --- | --- | --- |
41
+ | Initial pending | No accepted content exists for this request. | Explain what is loading; use stationary structure if useful. |
42
+ | Refreshing | Previously accepted content remains visible while a new request runs. | Identify its freshness/query boundary and avoid implying it is the new result. |
43
+ | Partial result | Some units are accepted and others remain pending or failed. | Distinguish completed units from missing units and provide a bounded retry. |
44
+ | Determinate progress | A meaningful completed/total measure exists. | Expose that measure and its scope; distinguish upload from server processing. |
45
+ | Indeterminate progress | The operation runs but no honest completion ratio exists. | Explain the current stage without a fabricated percentage. |
46
+ | Success | The relevant authoritative result was accepted. | Make the result durable and expose the next action. |
47
+ | Failure or unknown outcome | Failure is confirmed, or acknowledgement is missing. | Preserve recoverable input; distinguish safe retry from possible duplicate work. |
48
+ | Cancel requested | A request to stop was issued. | Avoid claiming cancellation is complete until the contract supports that fact. |
49
+
50
+ These treatments are local proposals. A skeleton, toast, or spinner is neither mandatory nor sufficient for any row.
51
+
52
+ ### Worked Scenario: Search While Keeping Results
53
+
54
+ The user has query A results and submits B. Keep A visible under an explicit refreshing state. Accept B only if its request identity remains current. If A's late failure arrives while B is pending, it cannot clear B's busy state. If B fails, label the retained content as A and provide a retry tied to B.
55
+
56
+ The result summary, busy state, empty state, and visible records must describe the same accepted request. “No results” is a completed result, not a synonym for “nothing rendered yet.” A late finally handler can violate this even when success callbacks are guarded; use the [latest-request contract](state-management/patterns/latest-request-wins.md).
57
+
58
+ ### Worked Scenario: Save With An Unknown Outcome
59
+
60
+ The editor submits a snapshot. Connectivity drops after the server may have received it. The consumer must decide how to reconcile that uncertainty: a supported operation identity, refetch, or a documented recovery flow. Merely showing a retry button cannot prove that retrying is safe.
61
+
62
+ Keep the submitted snapshot distinct from edits made while saving. A successful acknowledgement for the earlier snapshot cannot mark the newer draft saved. Compose [submitted snapshot](state-management/patterns/submitted-snapshot.md) with [draft and baseline](state-management/patterns/draft-and-baseline.md).
63
+
64
+ ## Opinionated Guidance
65
+
66
+ Prefer feedback that explains the actual stage and preserves a useful next action. Evaluate delays before showing indicators against measured task frequency and latency distribution; do not turn a borrowed delay into a universal rule. Avoid artificially holding completed content merely to finish a decorative loading cycle.
67
+
68
+ Keep repeated announcements bounded. When several regions update, establish which summary owns the user-facing completion message instead of making every region assertive.
69
+
70
+ ## Platform-Specific Guidance
71
+
72
+ Native progress controls and web progress semantics differ in APIs and announcement behavior. Real screen-reader tests are needed for the selected combination. For reduced-motion loading treatment, use [Accessible Motion](../motion/accessible-motion.md); for app suspension and navigation lifetime, preserve the state owner's contract.
73
+
74
+ ## Unsupported Absolutes
75
+
76
+ A spinner cannot prove ongoing backend work. A good INP cannot prove a successful save. A zero CLS measurement cannot prove usable loading feedback. `aria-busy` alone does not guarantee that a specific message is spoken.
77
+
78
+ ## Verification Contract
79
+
80
+ The unexecuted scenario set includes immediate completion, slow completion, stale success, stale error, partial response, cancelled request, lost acknowledgement, retry, unmount, and reduced motion. Observe focus and announcements as well as the displayed status.
81
+
82
+ For latency claims, collect a timestamp for input, first useful presentation, authoritative result, and final presentation where each is observable. Name the clock boundary; client and server timestamps cannot be subtracted without a supported synchronization method. Separate local repeatable scenarios from field distributions. Re-review after request policy, feedback ownership, or instrumentation changes.
83
+
84
+ ## Source, License, And Attribution
85
+
86
+ Locally authored synthesis. The linked specifications and first-party performance guidance were inspected 2026-09-21. No source samples are reproduced. `consumer_reference: not_applicable` because no consumer request or evidence record is selected.
87
+
88
+ ## IA Navigation
89
+
90
+ Parent: [Design Engineering](index.md).
91
+ Next: [State Verification Matrix](state-management/verification.md).
@@ -0,0 +1,94 @@
1
+ ---
2
+ type: Domain Guide
3
+ title: Native Interaction Contracts
4
+ description: Choose disclosure, dialog, popover, menu, and combobox behavior by semantics, focus, dismissal, and input ownership.
5
+ domain: design-engineering
6
+ lifecycle: experimental
7
+ provenance_kind: local
8
+ reviewed_on: 2026-09-21
9
+ ---
10
+
11
+ # Native Interaction Contracts
12
+
13
+ Primary role: product component selection and behavior guide.
14
+
15
+ ## Repository Boundary
16
+
17
+ This guide extends the [Component Contract](component-contract.md) with source-backed decisions for native HTML and custom composites. It owns product behavior, not reusable Layout CSS. The [shared accessibility evidence contract](../quality/evidence/accessibility.md) remains the authority for evidence claims.
18
+
19
+ ## Reusable Method
20
+
21
+ Write the user's task, the information being exposed, whether background interaction remains available, and what closes the surface. Choose semantics before appearance. Then assign keyboard, focus, pointer, and state ownership. A floating rectangle is insufficient information to choose a component.
22
+
23
+ ### Mechanisms And Obligations
24
+
25
+ | Source | Bounded finding | Consumer responsibility |
26
+ | --- | --- | --- |
27
+ | [HTML interactive elements](https://html.spec.whatwg.org/multipage/interactive-elements.html) | `details` is a disclosure; `dialog` supports distinct modal and nonmodal presentation. `showModal()` participates in the modal/inert model. | Choose the right behavior, accessible name, initial focus, and close policy. |
28
+ | [HTML popover](https://html.spec.whatwg.org/multipage/popover.html) | The attribute adds presentation behavior to elements with their own semantics; custom menu keyboard behavior still needs implementation. | Select a semantic element or role and implement its interaction contract. |
29
+ | [APG modal dialog](https://www.w3.org/WAI/ARIA/apg/patterns/dialog-modal/) | The pattern describes contained keyboard navigation, focus placement, and return. Initial focus depends on content and task. | Test focus with long content and a missing invocation control. |
30
+ | [APG menu button](https://www.w3.org/WAI/ARIA/apg/patterns/menu-button/) | A menu button opens a menu of actions or functions with the menu keyboard model. | Do not assign menu roles solely because links appear in a dropdown. |
31
+ | [APG combobox](https://www.w3.org/WAI/ARIA/apg/patterns/combobox/) | A combobox has a value and a popup with defined keyboard/state relationships. | Specify text editing, suggestion navigation, selection, and escape separately. |
32
+ | [APG disclosure](https://www.w3.org/WAI/ARIA/apg/patterns/disclosure/) | The disclosure control exposes expanded/collapsed state and toggles associated content. | Keep the control name, state, and controlled content consistent. |
33
+ | [WAI-ARIA 1.2](https://www.w3.org/TR/wai-aria-1.2/#aria-disabled) | `aria-disabled` communicates disabled semantics. It does not implement event suppression. | Prevent disallowed activation in the application's actual event paths. |
34
+
35
+ HTML is a Living Standard; WAI-ARIA 1.2 is a Recommendation; APG is informative implementation guidance. Sources were inspected 2026-09-21. Pattern examples do not establish support for an unspecified browser and assistive-technology combination.
36
+
37
+ ### Selection Questions
38
+
39
+ | User need | Starting point | Question that can change the choice |
40
+ | --- | --- | --- |
41
+ | Reveal optional explanatory content | Native disclosure | Does this actually switch mutually exclusive views or choose a value? |
42
+ | Complete a bounded task while background interaction is unavailable | Modal dialog | Must the user compare or interact with the background during this task? |
43
+ | Temporarily expose nonmodal related content | Semantically appropriate element with popover behavior | Is the content a menu, a list of links, a form, or plain information? |
44
+ | Invoke commands from a compact control | Menu button and menu behavior | Are these ordinary navigation links better served by ordinary link navigation? |
45
+ | Edit a value with selectable suggestions | Combobox | Is an ordinary input, select, or separate search-result list sufficient? |
46
+
47
+ These are local selection heuristics. Similar visuals can correctly produce different DOM, focus, and keyboard behavior.
48
+
49
+ ### Worked Contract: Edit A Record
50
+
51
+ The user opens an editor from a list row. The consumer chooses a modal because this task intentionally suspends interaction with the list. Save commits a submitted snapshot; Close requests dismissal; an unsaved-change decision belongs to the state owner.
52
+
53
+ | Stage | Decision to record | Adversarial case |
54
+ | --- | --- | --- |
55
+ | Open | Accessible name and initial focus target | Long introduction would be scrolled out of view by focusing the first input. |
56
+ | Edit | Draft lifetime and field-error relationship | Background data refresh replaces the edited row. |
57
+ | Save | Request identity and pending activation rule | Enter and a pointer click arrive before the request settles. |
58
+ | Dismiss | Which paths request close and which discard changes | Escape, an outside interaction, and an explicit Cancel have different intended meanings. |
59
+ | Return | Valid focus destination after closing | The original row was deleted or filtered out. |
60
+
61
+ Compose [submitted snapshot](state-management/patterns/submitted-snapshot.md), [single flight](state-management/patterns/single-flight.md), and [unsaved navigation](state-management/patterns/unsaved-navigation.md) as needed. Animation completion cannot authorize a write or decide whether a draft is disposable.
62
+
63
+ ### Preserve Editing Inside Composites
64
+
65
+ An editable combobox has at least two responsibilities: editing text and navigating candidate options. Specify when Arrow keys move a candidate, when Enter accepts it, and when Escape dismisses suggestions while retaining the typed text. During IME composition, those keys may belong to the input method; follow [Text Input And Internationalization](text-input-and-internationalization.md).
66
+
67
+ A disabled-looking control needs a deliberate discoverability policy. Native `disabled` and `aria-disabled` have different behavior; choose which focus and activation behavior the task requires, and explain why an action is unavailable without relying only on color.
68
+
69
+ ## Opinionated Guidance
70
+
71
+ Prefer native semantics when they fit the task, and build the smallest custom behavior that remains necessary. Name the semantic reason for every role override. Treat multiple open surfaces as an ownership question: which surface receives Escape, where focus stays, and which state survives dismissal.
72
+
73
+ ## Platform-Specific Guidance
74
+
75
+ Native HTML behavior, browser support, and accessibility mappings are separate from framework component names. Record the browser, framework adapter, and assistive technology used in verification. A native platform's “popover” does not settle the web contract; compare [Interaction Semantics](../design-terminology/interaction-semantics.md) and [Platform Adaptation](../platform-guides/adaptation-workflow.md).
76
+
77
+ ## Unsupported Absolutes
78
+
79
+ Top-layer presentation does not imply modality. A role does not supply keyboard handlers. Native HTML does not remove the need for an accessible name or target verification. Escape does not intrinsically mean “discard all work.”
80
+
81
+ ## Verification Contract
82
+
83
+ The proposed matrix includes keyboard-only opening and closing, forward/backward Tab, active popup navigation, IME input, a removed opener, nested surface dismissal, long content, zoom, and reduced motion. Check visible behavior, DOM state, accessibility semantics, and the actual announcement path separately.
84
+
85
+ Record the selected widget model and expected key behavior before testing. Passing a self-written handler test establishes that handler's behavior, not conformance with APG or the platform. Compare observed behavior with the cited contract. No browser or screen-reader execution is claimed by this guide. Re-review when the widget model, browser, or focus owner changes.
86
+
87
+ ## Source, License, And Attribution
88
+
89
+ Locally authored synthesis of the official sources linked above, inspected 2026-09-21. No upstream examples or implementation are reproduced. `consumer_reference: not_applicable` because this guide selects no consumer component record.
90
+
91
+ ## IA Navigation
92
+
93
+ Parent: [Design Engineering](index.md).
94
+ Next: [Text Input And Internationalization](text-input-and-internationalization.md).
@@ -0,0 +1,60 @@
1
+ ---
2
+ type: Domain Guide
3
+ title: State Management Decision Tree
4
+ description: Route UI state problems to the smallest ownership or transition contract.
5
+ domain: design-engineering
6
+ lifecycle: experimental
7
+ provenance_kind: local
8
+ ---
9
+
10
+ # State Management Decision Tree
11
+
12
+ ## Repository Boundary
13
+
14
+ This route selects consumer behavior within Design Engineering. It does not choose a global store or redefine Layout patterns.
15
+
16
+ ## Reusable Method
17
+
18
+ | Question | Route | Decision to record |
19
+ | --- | --- | --- |
20
+ | Can the value be calculated from current inputs? | [Derived state](patterns/derived-state.md) | Source inputs and equality/invalidation |
21
+ | Do several controls write one accepted value? | [Single owner](patterns/single-owner.md) | Nearest surviving owner and intent API |
22
+ | Does selection change when rows reorder? | [ID selection](patterns/id-selection.md) | Stable identity and missing-item policy |
23
+ | Must edits survive Cancel or a failed save? | [Draft and baseline](patterns/draft-and-baseline.md) | Draft owner and baseline meaning |
24
+ | Can editing continue during saving? | [Submitted snapshot](patterns/submitted-snapshot.md) | Captured data and acknowledgement identity |
25
+ | Can leaving discard work? | [Unsaved navigation](patterns/unsaved-navigation.md) | Cancel, discard, and save-and-leave policy |
26
+ | Can replaceable reads finish out of order? | [Latest request wins](patterns/latest-request-wins.md) | Result acceptance identity |
27
+ | Can an operation be activated repeatedly? | [Single flight](patterns/single-flight.md) | Share, ignore, queue, or replace |
28
+ | Should a change appear before acknowledgement? | [Optimistic overlay](patterns/optimistic-overlay.md) | Rollback scope and uncertain outcome recovery |
29
+ | Should Back, reload, and links restore the view? | [URL state](patterns/url-state.md) | Committed route versus input buffer |
30
+ | Is the screen reused for another identity? | [Identity reset](patterns/identity-reset.md) | Generation and cleanup scope |
31
+ | Must state survive a new session? | [Versioned restore](patterns/versioned-restore.md) | Schema, account scope, migration and retention |
32
+
33
+ These questions can select several patterns. For search, first separate the input buffer from the committed URL, then attach a latest-wins request owner and selected ID. The [search recipe](recipes/search-detail.md) defines the joint contract.
34
+
35
+ Before adding another pattern, name a failure the existing set cannot express. Put a new combination in a recipe; add a primitive only when its owner or invariant is independently reusable.
36
+
37
+ ## Opinionated Guidance
38
+
39
+ Choose the failure and lifetime before the library. A cache, URL, form buffer, and session preference may share a screen without sharing an owner.
40
+
41
+ ## Platform-Specific Guidance
42
+
43
+ Transport cancellation, router guards, and storage hooks vary by framework and runtime. Record those adapter choices in the brief instead of assuming the abstract model implements them.
44
+
45
+ ## Unsupported Absolutes
46
+
47
+ A decision tree is not an exhaustive treatment of offline replication, collaboration, or server transactions. Escalate those requirements to a separately specified consistency protocol.
48
+
49
+ ## Verification Contract
50
+
51
+ Try routing a stale search result, lost edit, and wrong-account restore. Each must reach a named pattern and concrete failure trace. Revisit when two routes prescribe conflicting owners.
52
+
53
+ ## Source, License, And Attribution
54
+
55
+ Locally authored synthesis and examples. No upstream implementation is copied. These experimental contracts describe consumer-owned behavior; review when a failure, ownership change, or platform change invalidates an assumption.
56
+
57
+ ## IA Navigation
58
+
59
+ Parent: [State Management](index.md).
60
+ Next: [Continue the state management route](state-brief.md).
@@ -0,0 +1,61 @@
1
+ # State Management
2
+
3
+ Domain classification: design-engineering. Lifecycle: `experimental`.
4
+
5
+ ## Repository Boundary
6
+
7
+ State management is a Design Engineering topic, not a seventh domain. It owns consumer UI decisions about authoritative values, events, effects, reconciliation, and lifetime. Layout continues to own spatial composition; Motion owns optional presentation timing. Server transaction protocols, universal library rankings, and shared component implementations are outside this collection.
8
+
9
+ ## Reusable Method
10
+
11
+ Start with [the decision tree](decision-tree.md), fill in the [state brief](state-brief.md), select the smallest relevant patterns, then compose a [screen recipe](recipes/index.md). The [verification matrix](verification.md) separates expected behavior from observed evidence.
12
+
13
+ 한국어 검색 안내: 상태 관리, 상태 소유권, 파생 상태, 초안과 저장본, 비동기 요청 경합, URL 동기화, 상태 복원은 아래 패턴에서 찾을 수 있습니다.
14
+
15
+ ### Pattern Catalog
16
+
17
+ | Category | Pattern | Failure prevented |
18
+ | --- | --- | --- |
19
+ | Ownership and derivation | [Single Owner And Controlled Inputs](patterns/single-owner.md) | Keep one authoritative value when several controls edit the same setting. |
20
+ | Ownership and derivation | [Derived State From Authoritative Inputs](patterns/derived-state.md) | Prevent totals, filtered lists, and dirty flags from drifting away from their inputs. |
21
+ | Ownership and derivation | [Selection By Stable Identity](patterns/id-selection.md) | Keep selection attached to an entity while a collection reorders or refreshes. |
22
+ | Editing and persistence | [Draft And Persisted Baseline](patterns/draft-and-baseline.md) | Preserve editable work while distinguishing it from the last acknowledged saved value. |
23
+ | Editing and persistence | [Submitted Snapshot And Save Acknowledgement](patterns/submitted-snapshot.md) | Keep later edits dirty when an earlier submitted snapshot finishes saving. |
24
+ | Editing and persistence | [Unsaved Changes And Navigation](patterns/unsaved-navigation.md) | Make leaving an edited screen an explicit decision without losing the current draft. |
25
+ | Asynchronous consistency | [Latest Request Wins](patterns/latest-request-wins.md) | Prevent an older read response from replacing the result of a newer user intent. |
26
+ | Asynchronous consistency | [Single Flight And Duplicate Submission](patterns/single-flight.md) | Apply an explicit policy to repeated activation of one pending operation. |
27
+ | Asynchronous consistency | [Optimistic Overlay And Recovery](patterns/optimistic-overlay.md) | Show a speculative change while preserving an authoritative base for recovery. |
28
+ | Navigation and lifetime | [URL State And History](patterns/url-state.md) | Keep shareable screen state consistent across links, refresh, and browser history. |
29
+ | Navigation and lifetime | [Identity Boundary And Reset](patterns/identity-reset.md) | Prevent temporary state and pending outcomes from leaking across entity or account changes. |
30
+ | Navigation and lifetime | [Versioned And Scoped State Restore](patterns/versioned-restore.md) | Restore persisted preferences only when their schema and ownership scope are valid. |
31
+
32
+ ### Relationship To Existing Contracts
33
+
34
+ The [Component Contract](../component-contract.md) remains the public handoff for semantics, events, focus, and asynchronous ownership. Its save example remains in place. [Worked Examples](../worked-examples.md) supplies existing product scenarios; these patterns make their mechanisms individually selectable.
35
+
36
+ This collection contains 12 patterns in four categories and four [recipes](recipes/index.md). The [composition matrix](recipes/index.md#composition-matrix) records essential and replaceable choices. Plain JavaScript examples are the local executable reference; framework adapters must preserve their declared invariants.
37
+
38
+ ## Opinionated Guidance
39
+
40
+ Start by locating the authoritative value and its lifetime. Introduce a shared store only when shared ownership or subscriptions require it. Keep remote data authority distinct from local cache ownership, and model request status separately from draft validity and persisted revision.
41
+
42
+ ## Platform-Specific Guidance
43
+
44
+ Choose native controls and platform navigation before adapters. URL parsing, storage access, focus recovery, and framework disposal each need target-runtime checks beyond the Node examples.
45
+
46
+ ## Unsupported Absolutes
47
+
48
+ Neither a reducer nor a state machine guarantees race freedom. No library is the default for this collection. Local executable examples do not establish backend, accessibility, or browser conformance.
49
+
50
+ ## Verification Contract
51
+
52
+ A reader should find a pattern from a failure symptom, identify its owner and minimal implementation, compose it into a screen, and locate a repeatable acceptance sequence. Run `bun run test:state-management` for the 12 local examples; record browser and backend checks separately.
53
+
54
+ ## Source, License, And Attribution
55
+
56
+ Locally authored synthesis and examples. No upstream implementation is copied. These experimental contracts describe consumer-owned behavior; review when a failure, ownership change, or platform change invalidates an assumption.
57
+
58
+ ## IA Navigation
59
+
60
+ Parent: [Design Engineering](../index.md).
61
+ Next: [Continue the state management route](decision-tree.md).
@@ -0,0 +1,85 @@
1
+ ---
2
+ type: Domain Guide
3
+ title: Derived State From Authoritative Inputs
4
+ description: Prevent totals, filtered lists, and dirty flags from drifting away from their inputs.
5
+ domain: design-engineering
6
+ lifecycle: experimental
7
+ provenance_kind: local
8
+ ---
9
+
10
+ # Derived State From Authoritative Inputs
11
+
12
+ ## Repository Boundary
13
+
14
+ Prevent totals, filtered lists, and dirty flags from drifting away from their inputs. This pattern belongs to Design Engineering and adds no Layout CSS or shared store implementation.
15
+
16
+ ## Reusable Method
17
+
18
+ Use when a value is a deterministic projection of current inputs. Store historical snapshots when the task explicitly needs what was true at a previous event; those are not redundant current projections.
19
+
20
+ ### State Model And Ownership
21
+
22
+ Only source items and filter are writable. Visible items and total are computed. Memoization is optional and must include every dependency; its lifetime cannot change meaning.
23
+
24
+ ### Transitions
25
+
26
+ | Event and precondition | Next state | Effect or invariant |
27
+ | --- | --- | --- |
28
+ | Items change | New items | Recompute projection from current inputs |
29
+ | Filter changes | New filter | Project without mutating items |
30
+ | No matching items | Empty projection | Total is zero, not a separate empty flag |
31
+
32
+ ### Minimal Executable Example
33
+
34
+ Run this standalone JavaScript block with Node.js 22 or newer, or run all pattern examples from a repository checkout with `bun run test:state-management`. The assertions exercise the local model, not a browser or backend.
35
+
36
+ ```js
37
+ import assert from "node:assert/strict";
38
+ let items = [{ id: "a", price: 5 }, { id: "b", price: 12 }];
39
+ let minimum = 10;
40
+ const visible = () => items.filter(item => item.price >= minimum);
41
+ const total = () => visible().reduce((sum, item) => sum + item.price, 0);
42
+ assert.equal(total(), 12);
43
+ items = items.map(item => item.id === "b" ? { ...item, price: 7 } : item);
44
+ assert.deepEqual(visible(), []);
45
+ assert.equal(total(), 0);
46
+ minimum = 0;
47
+ assert.equal(total(), 12);
48
+ ```
49
+
50
+ ### What Breaks If Removed
51
+
52
+ An independently updated total can miss a deletion, filter change, or remote refresh. A memo keyed only by items stays stale after changing the filter.
53
+
54
+ ### Composition And Substitution
55
+
56
+ Combine with [ID selection](id-selection.md); derive the selected object from the current collection. Keep [submitted snapshots](submitted-snapshot.md) because they represent a past event.
57
+
58
+ ## Opinionated Guidance
59
+
60
+ Write down the projection before introducing another writable field. Define domain equality explicitly for dirty checks involving normalized dates, numbers, or nested data.
61
+
62
+ ## Platform-Specific Guidance
63
+
64
+ Framework memo and selector APIs have different invalidation rules. Verify dependency coverage and immutable update assumptions in the chosen adapter.
65
+
66
+ ## Unsupported Absolutes
67
+
68
+ Recomputing every projection is not always cheap; storing a cache can be valid if its invalidation contract is explicit.
69
+
70
+ ## Verification Contract
71
+
72
+ - Change each dependency independently and inspect the projection.
73
+ - Delete the final matching item and verify the empty result and zero total.
74
+ - If memoized, repeat with unchanged references and changed filter inputs.
75
+
76
+ Record actual outcomes separately using the [verification matrix](../verification.md).
77
+
78
+ ## Source, License, And Attribution
79
+
80
+ Locally authored synthesis and examples. No upstream implementation is copied. These experimental contracts describe consumer-owned behavior; review when a failure, ownership change, or platform change invalidates an assumption.
81
+
82
+ ## IA Navigation
83
+
84
+ Parent: [State Management](../index.md).
85
+ Next: [Continue the state management route](../recipes/index.md).