stylegallery 0.1.6 → 0.1.7
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/DOMAINS.md +4 -4
- package/GOVERNANCE.md +1 -1
- package/LICENSE +28 -0
- package/LICENSE-DOCS +42 -0
- package/NOTICE +38 -0
- package/README.md +25 -6
- package/consumer-reference/agent-native/README.md +7 -7
- package/consumer-reference/agent-native/v2/admission-policy.json +171 -1
- package/consumer-reference/agent-native/v2/material-registry.json +1 -1
- package/consumer-reference/agent-native/v2/schema/admission-policy.schema.json +2 -2
- package/design-engineering/component-contract.md +19 -3
- package/design-engineering/decision-tree.md +1 -0
- package/design-engineering/index.md +48 -0
- package/design-engineering/loading-and-feedback.md +91 -0
- package/design-engineering/native-interaction-contracts.md +94 -0
- package/design-engineering/state-management/decision-tree.md +60 -0
- package/design-engineering/state-management/index.md +61 -0
- package/design-engineering/state-management/patterns/derived-state.md +85 -0
- package/design-engineering/state-management/patterns/draft-and-baseline.md +86 -0
- package/design-engineering/state-management/patterns/id-selection.md +85 -0
- package/design-engineering/state-management/patterns/identity-reset.md +89 -0
- package/design-engineering/state-management/patterns/latest-request-wins.md +94 -0
- package/design-engineering/state-management/patterns/optimistic-overlay.md +98 -0
- package/design-engineering/state-management/patterns/single-flight.md +92 -0
- package/design-engineering/state-management/patterns/single-owner.md +89 -0
- package/design-engineering/state-management/patterns/submitted-snapshot.md +107 -0
- package/design-engineering/state-management/patterns/unsaved-navigation.md +100 -0
- package/design-engineering/state-management/patterns/url-state.md +96 -0
- package/design-engineering/state-management/patterns/versioned-restore.md +95 -0
- package/design-engineering/state-management/recipes/delete-undo.md +65 -0
- package/design-engineering/state-management/recipes/index.md +64 -0
- package/design-engineering/state-management/recipes/multi-step-form.md +65 -0
- package/design-engineering/state-management/recipes/search-detail.md +65 -0
- package/design-engineering/state-management/recipes/settings-save.md +64 -0
- package/design-engineering/state-management/state-brief.md +83 -0
- package/design-engineering/state-management/verification.md +65 -0
- package/design-engineering/text-input-and-internationalization.md +91 -0
- package/design-engineering/worked-examples.md +2 -0
- package/design-terminology/conflict-cases.md +50 -7
- package/design-terminology/index.md +6 -0
- package/design-terminology/interaction-semantics.md +87 -0
- package/design-terminology/source-vocabularies.md +17 -1
- package/design-terminology/token-semantics.md +90 -0
- package/design-terminology/typography-semantics.md +86 -0
- package/log.md +29 -0
- package/motion/accessible-motion.md +90 -0
- package/motion/index.md +7 -0
- package/motion/interaction-recipes.md +8 -2
- package/motion/interruption-and-retargeting.md +90 -0
- package/motion/observed-choreography.md +73 -0
- package/motion/rendering-and-performance.md +89 -0
- package/package.json +60 -8
- package/platform-guides/adaptive-navigation.md +85 -0
- package/platform-guides/index.md +6 -0
- package/platform-guides/input-and-focus.md +91 -0
- package/platform-guides/preferences-and-accessibility.md +90 -0
- package/scripts/compiler/README.md +112 -0
- package/scripts/compiler/cli.mjs +51 -0
- package/scripts/compiler/mcp.mjs +53 -0
- package/scripts/compiler/operations.mjs +70 -0
- package/scripts/compiler/runtime.mjs +156 -0
- package/scripts/sg-entry.mjs +20 -0
- package/scripts/sg-server.mjs +20 -0
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
---
|
|
2
|
+
type: Domain Guide
|
|
3
|
+
title: Unsaved Changes And Navigation
|
|
4
|
+
description: Make leaving an edited screen an explicit decision without losing the current draft.
|
|
5
|
+
domain: design-engineering
|
|
6
|
+
lifecycle: experimental
|
|
7
|
+
provenance_kind: local
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# Unsaved Changes And Navigation
|
|
11
|
+
|
|
12
|
+
## Repository Boundary
|
|
13
|
+
|
|
14
|
+
Make leaving an edited screen an explicit decision without losing the current draft. This pattern belongs to Design Engineering and adds no Layout CSS or shared store implementation.
|
|
15
|
+
|
|
16
|
+
## Reusable Method
|
|
17
|
+
|
|
18
|
+
Use when route changes can discard meaningful user work. Do not interrupt navigation for harmless transient selection or derived values.
|
|
19
|
+
|
|
20
|
+
### State Model And Ownership
|
|
21
|
+
|
|
22
|
+
The form owns dirty; the router integration owns a pending destination and guard status. The confirmation owns a decision, not a second copy of form data. Save-and-leave must recheck dirty after acknowledgement.
|
|
23
|
+
|
|
24
|
+
### Transitions
|
|
25
|
+
|
|
26
|
+
| Event and precondition | Next state | Effect or invariant |
|
|
27
|
+
| --- | --- | --- |
|
|
28
|
+
| Navigate while clean | Destination committed | Leave normally |
|
|
29
|
+
| Navigate while dirty | Decision pending | Retain current screen and destination |
|
|
30
|
+
| Cancel decision | Pending cleared | Stay and return focus |
|
|
31
|
+
| Discard decision | Destination committed | Explicitly abandon draft |
|
|
32
|
+
| Save fails or later edits remain | Stay | Preserve draft and offer recovery |
|
|
33
|
+
|
|
34
|
+
### Minimal Executable Example
|
|
35
|
+
|
|
36
|
+
Run this standalone JavaScript block with Node.js 22 or newer, or run all pattern examples from a repository checkout with `npm run test:state-management`. The assertions exercise the local model, not a browser or backend.
|
|
37
|
+
|
|
38
|
+
```js
|
|
39
|
+
import assert from "node:assert/strict";
|
|
40
|
+
let dirty = true, pending = null, location = "editor";
|
|
41
|
+
function navigate(to) {
|
|
42
|
+
if (dirty) pending = to;
|
|
43
|
+
else location = to;
|
|
44
|
+
}
|
|
45
|
+
function decide(choice) {
|
|
46
|
+
if (choice === "cancel") pending = null;
|
|
47
|
+
if (choice === "discard" && pending !== null) {
|
|
48
|
+
dirty = false;
|
|
49
|
+
location = pending;
|
|
50
|
+
pending = null;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
navigate("list");
|
|
54
|
+
decide("cancel");
|
|
55
|
+
assert.equal(location, "editor");
|
|
56
|
+
assert.equal(dirty, true);
|
|
57
|
+
navigate("list");
|
|
58
|
+
decide("discard");
|
|
59
|
+
assert.equal(location, "list");
|
|
60
|
+
assert.equal(pending, null);
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
### What Breaks If Removed
|
|
64
|
+
|
|
65
|
+
If route mutation happens before the guard, the form may already be destroyed when Cancel runs. If any save success releases navigation, later unsaved edits can still be lost.
|
|
66
|
+
|
|
67
|
+
### Composition And Substitution
|
|
68
|
+
|
|
69
|
+
Use [submitted snapshot](submitted-snapshot.md) for Save-and-leave and [URL state](url-state.md) for committed destinations. A pending destination is not a committed URL.
|
|
70
|
+
|
|
71
|
+
## Opinionated Guidance
|
|
72
|
+
|
|
73
|
+
Declare what a second navigation attempt does while confirmation is open: this model replaces the destination with the latest attempt. Verify the displayed decision matches it.
|
|
74
|
+
|
|
75
|
+
## Platform-Specific Guidance
|
|
76
|
+
|
|
77
|
+
In-app routing and document unload have different capabilities. Browser unload prompts are constrained and unreliable as a sole recovery strategy; use optional draft persistence when needed. Verify keyboard focus entry/return for the confirmation.
|
|
78
|
+
|
|
79
|
+
Platform reference: [MDN API documentation](https://developer.mozilla.org/en-US/docs/Web/API/Window/beforeunload_event), checked 2026-09-16. This supports the named browser boundary; the model and product policy remain local synthesis.
|
|
80
|
+
|
|
81
|
+
## Unsupported Absolutes
|
|
82
|
+
|
|
83
|
+
An in-memory guard cannot guarantee preservation after process termination or device failure.
|
|
84
|
+
|
|
85
|
+
## Verification Contract
|
|
86
|
+
|
|
87
|
+
- Cancel a guarded route change; values and focus return to the editor.
|
|
88
|
+
- Attempt another destination while the decision is open; apply the declared policy.
|
|
89
|
+
- Save A, edit B, then acknowledge A; do not leave with dirty B.
|
|
90
|
+
|
|
91
|
+
Record actual outcomes separately using the [verification matrix](../verification.md).
|
|
92
|
+
|
|
93
|
+
## Source, License, And Attribution
|
|
94
|
+
|
|
95
|
+
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.
|
|
96
|
+
|
|
97
|
+
## IA Navigation
|
|
98
|
+
|
|
99
|
+
Parent: [State Management](../index.md).
|
|
100
|
+
Next: [Continue the state management route](../recipes/index.md).
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
---
|
|
2
|
+
type: Domain Guide
|
|
3
|
+
title: URL State And History
|
|
4
|
+
description: Keep shareable screen state consistent across links, refresh, and browser history.
|
|
5
|
+
domain: design-engineering
|
|
6
|
+
lifecycle: experimental
|
|
7
|
+
provenance_kind: local
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# URL State And History
|
|
11
|
+
|
|
12
|
+
## Repository Boundary
|
|
13
|
+
|
|
14
|
+
Keep shareable screen state consistent across links, refresh, and browser history. This pattern belongs to Design Engineering and adds no Layout CSS or shared store implementation.
|
|
15
|
+
|
|
16
|
+
## Reusable Method
|
|
17
|
+
|
|
18
|
+
Use for committed search, filters, pagination, and selected IDs that should be shareable. Keep secrets, sensitive drafts, and hover state out of URLs.
|
|
19
|
+
|
|
20
|
+
### State Model And Ownership
|
|
21
|
+
|
|
22
|
+
The route owns committed query state; a text field may own an uncommitted buffer. Parsing supplies validated defaults. User commits write URL parameters; history navigation reads them without writing a new entry.
|
|
23
|
+
|
|
24
|
+
### Transitions
|
|
25
|
+
|
|
26
|
+
| Event and precondition | Next state | Effect or invariant |
|
|
27
|
+
| --- | --- | --- |
|
|
28
|
+
| Open or history traversal | Parsed route state | Render without another push |
|
|
29
|
+
| Commit filter | New route; page reset | Push a meaningful navigation entry |
|
|
30
|
+
| Normalize invalid input | Validated defaults | Replace only under declared canonicalization policy |
|
|
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 `npm 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
|
+
function readRoute(href) {
|
|
39
|
+
const u = new URL(href);
|
|
40
|
+
const raw = u.searchParams.get("page") ?? "1";
|
|
41
|
+
const n = /^\d+$/.test(raw) ? Number(raw) : NaN;
|
|
42
|
+
return { q: u.searchParams.get("q") ?? "", page: Number.isSafeInteger(n) && n > 0 ? n : 1 };
|
|
43
|
+
}
|
|
44
|
+
function commitQuery(href, q) {
|
|
45
|
+
const u = new URL(href);
|
|
46
|
+
if (q) u.searchParams.set("q", q); else u.searchParams.delete("q");
|
|
47
|
+
u.searchParams.delete("page");
|
|
48
|
+
return u.href;
|
|
49
|
+
}
|
|
50
|
+
const original = "https://example.test/items?q=A&page=3&view=grid#results";
|
|
51
|
+
const changed = commitQuery(original, "B & C");
|
|
52
|
+
assert.deepEqual(readRoute(changed), { q: "B & C", page: 1 });
|
|
53
|
+
assert.equal(new URL(changed).searchParams.get("view"), "grid");
|
|
54
|
+
assert.equal(new URL(changed).hash, "#results");
|
|
55
|
+
assert.deepEqual(readRoute(original), { q: "A", page: 3 }); // Back reads old URL.
|
|
56
|
+
assert.equal(readRoute("https://example.test/?page=Infinity").page, 1);
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
### What Breaks If Removed
|
|
60
|
+
|
|
61
|
+
Writing a new history entry in response to a history event creates a loop. Keeping the old page after changing the filter can display an apparently empty collection. Rebuilding the URL from scratch can drop unrelated parameters or fragments.
|
|
62
|
+
|
|
63
|
+
### Composition And Substitution
|
|
64
|
+
|
|
65
|
+
Use [latest request wins](latest-request-wins.md) for data reads and [unsaved navigation](unsaved-navigation.md) before committing a destructive route change. Reset local input from history only under the declared editing policy.
|
|
66
|
+
|
|
67
|
+
## Opinionated Guidance
|
|
68
|
+
|
|
69
|
+
Decide push versus replace from meaningful navigation steps. Do not make every keystroke a Back-button stop by accident.
|
|
70
|
+
|
|
71
|
+
## Platform-Specific Guidance
|
|
72
|
+
|
|
73
|
+
Browser adapters must handle popstate and their router's navigation API; the pure URL functions do not install listeners. SSR and client must use the same parser and defaults.
|
|
74
|
+
|
|
75
|
+
Platform reference: [MDN API documentation](https://developer.mozilla.org/en-US/docs/Web/API/History/pushState), checked 2026-09-16. This supports the named browser boundary; the model and product policy remain local synthesis.
|
|
76
|
+
|
|
77
|
+
## Unsupported Absolutes
|
|
78
|
+
|
|
79
|
+
A URL is not a safe persistence medium for private data, nor does parsing prove authorization to access a selected entity.
|
|
80
|
+
|
|
81
|
+
## Verification Contract
|
|
82
|
+
|
|
83
|
+
- Commit query B from page 3; reset to page 1 and preserve unrelated parameters.
|
|
84
|
+
- Back, Forward, reload, and paste a deep link; displayed controls agree with the URL.
|
|
85
|
+
- Reject malformed page values; avoid URL-to-state-to-URL loops.
|
|
86
|
+
|
|
87
|
+
Record actual outcomes separately using the [verification matrix](../verification.md).
|
|
88
|
+
|
|
89
|
+
## Source, License, And Attribution
|
|
90
|
+
|
|
91
|
+
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.
|
|
92
|
+
|
|
93
|
+
## IA Navigation
|
|
94
|
+
|
|
95
|
+
Parent: [State Management](../index.md).
|
|
96
|
+
Next: [Continue the state management route](../recipes/index.md).
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
---
|
|
2
|
+
type: Domain Guide
|
|
3
|
+
title: Versioned And Scoped State Restore
|
|
4
|
+
description: Restore persisted preferences only when their schema and ownership scope are valid.
|
|
5
|
+
domain: design-engineering
|
|
6
|
+
lifecycle: experimental
|
|
7
|
+
provenance_kind: local
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# Versioned And Scoped State Restore
|
|
11
|
+
|
|
12
|
+
## Repository Boundary
|
|
13
|
+
|
|
14
|
+
Restore persisted preferences only when their schema and ownership scope are valid. This pattern belongs to Design Engineering and adds no Layout CSS or shared store implementation.
|
|
15
|
+
|
|
16
|
+
## Reusable Method
|
|
17
|
+
|
|
18
|
+
Use for intentional persistence of non-sensitive preferences or drafts with a declared retention policy. Keep state in memory if cross-session recovery has no user value.
|
|
19
|
+
|
|
20
|
+
### State Model And Ownership
|
|
21
|
+
|
|
22
|
+
The persistence adapter owns a versioned envelope and scope key. Decoding validates shape and allowed values before applying. This example rejects old versions; migration is a separate explicit function. Current user edits outrank a late restore.
|
|
23
|
+
|
|
24
|
+
### Transitions
|
|
25
|
+
|
|
26
|
+
| Event and precondition | Next state | Effect or invariant |
|
|
27
|
+
| --- | --- | --- |
|
|
28
|
+
| Read valid current-scope record | Restored values | Apply only before later local edits |
|
|
29
|
+
| Malformed, old, or wrong-scope record | Defaults | Preserve current usable state |
|
|
30
|
+
| Write fails | In-memory state retained | Expose persistence failure where recovery matters |
|
|
31
|
+
| Logout or scope change | New scoped state | Do not reuse another account's envelope |
|
|
32
|
+
|
|
33
|
+
### Minimal Executable Example
|
|
34
|
+
|
|
35
|
+
Run this standalone JavaScript block with Node.js 22 or newer, or run all pattern examples from a repository checkout with `npm run test:state-management`. The assertions exercise the local model, not a browser or backend.
|
|
36
|
+
|
|
37
|
+
```js
|
|
38
|
+
import assert from "node:assert/strict";
|
|
39
|
+
function restore(raw, scope) {
|
|
40
|
+
try {
|
|
41
|
+
const record = JSON.parse(raw);
|
|
42
|
+
if (!record || record.version !== 1 || record.scope !== scope) return "compact";
|
|
43
|
+
return ["compact", "comfortable"].includes(record.density) ? record.density : "compact";
|
|
44
|
+
} catch { return "compact"; }
|
|
45
|
+
}
|
|
46
|
+
const raw = JSON.stringify({ version: 1, scope: "account:A", density: "comfortable" });
|
|
47
|
+
assert.equal(restore(raw, "account:A"), "comfortable");
|
|
48
|
+
assert.equal(restore(raw, "account:B"), "compact");
|
|
49
|
+
assert.equal(restore("{broken", "account:A"), "compact");
|
|
50
|
+
assert.equal(restore(JSON.stringify({ version: 0 }), "account:A"), "compact");
|
|
51
|
+
let editRevision = 0, density = "compact";
|
|
52
|
+
const restoreStartedAt = editRevision;
|
|
53
|
+
density = "comfortable"; editRevision++;
|
|
54
|
+
if (editRevision === restoreStartedAt) density = restore(null, "account:A");
|
|
55
|
+
assert.equal(density, "comfortable");
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
### What Breaks If Removed
|
|
59
|
+
|
|
60
|
+
Blind JSON parsing can crash startup. An unscoped storage key leaks settings across accounts. Applying a delayed restore unconditionally overwrites edits made while storage was loading.
|
|
61
|
+
|
|
62
|
+
### Composition And Substitution
|
|
63
|
+
|
|
64
|
+
Use [identity reset](identity-reset.md) for account changes. Persist only source values from [derived state](derived-state.md); do not restore loading flags, request IDs, or obsolete cached errors.
|
|
65
|
+
|
|
66
|
+
## Opinionated Guidance
|
|
67
|
+
|
|
68
|
+
Choose migration, expiry, and multi-tab conflict policies before persisting. A version field without a decoder or migration rule is not a compatibility strategy.
|
|
69
|
+
|
|
70
|
+
## Platform-Specific Guidance
|
|
71
|
+
|
|
72
|
+
Browser storage access and writes can throw or be unavailable; guard the adapter as well as parsing. Server rendering cannot read browser storage. Define hydration fallback and cross-tab event handling separately.
|
|
73
|
+
|
|
74
|
+
Platform reference: [MDN API documentation](https://developer.mozilla.org/en-US/docs/Web/API/Window/localStorage), checked 2026-09-16. This supports the named browser boundary; the model and product policy remain local synthesis.
|
|
75
|
+
|
|
76
|
+
## Unsupported Absolutes
|
|
77
|
+
|
|
78
|
+
Persistence does not guarantee availability, confidentiality, or synchronization across devices.
|
|
79
|
+
|
|
80
|
+
## Verification Contract
|
|
81
|
+
|
|
82
|
+
- Decode corrupt, missing, old-version, and wrong-account records; use valid defaults.
|
|
83
|
+
- Edit before an asynchronous restore finishes; preserve the edit.
|
|
84
|
+
- Simulate unavailable storage and quota failure; keep the screen usable.
|
|
85
|
+
|
|
86
|
+
Record actual outcomes separately using the [verification matrix](../verification.md).
|
|
87
|
+
|
|
88
|
+
## Source, License, And Attribution
|
|
89
|
+
|
|
90
|
+
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.
|
|
91
|
+
|
|
92
|
+
## IA Navigation
|
|
93
|
+
|
|
94
|
+
Parent: [State Management](../index.md).
|
|
95
|
+
Next: [Continue the state management route](../recipes/index.md).
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
---
|
|
2
|
+
type: Domain Guide
|
|
3
|
+
title: Deletion And Supported Undo
|
|
4
|
+
description: Remove the intended entity and provide recovery that matches actual backend capabilities.
|
|
5
|
+
domain: design-engineering
|
|
6
|
+
lifecycle: experimental
|
|
7
|
+
provenance_kind: local
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# Deletion And Supported Undo
|
|
11
|
+
|
|
12
|
+
## Repository Boundary
|
|
13
|
+
|
|
14
|
+
Remove the intended entity and provide recovery that matches actual backend capabilities. This is a consumer interaction composition in Design Engineering. Spatial structure comes from [List Detail](../../../recipes/list-detail.md); this recipe adds no reusable Layout behavior.
|
|
15
|
+
|
|
16
|
+
## Reusable Method
|
|
17
|
+
|
|
18
|
+
### Selected Pattern Stack
|
|
19
|
+
|
|
20
|
+
[ID selection](../patterns/id-selection.md), [single flight](../patterns/single-flight.md), optionally [optimistic overlay](../patterns/optimistic-overlay.md).
|
|
21
|
+
|
|
22
|
+
### Ownership And Event Flow
|
|
23
|
+
|
|
24
|
+
The collection owner tracks entities by ID. A per-entity deletion operation owns request identity and outcome. Confirmation owns a decision; an undo operation owns a real restore token or an explicitly cancellable pre-commit deletion.
|
|
25
|
+
|
|
26
|
+
Activate → confirm if required → submit deletion → reconcile acknowledgement → recover focus. Offer Undo only when a backend restore or a declared delayed-commit cancellation exists. A UI-only inverse patch cannot undo a committed deletion.
|
|
27
|
+
|
|
28
|
+
### Composition And Substitution
|
|
29
|
+
|
|
30
|
+
Use pending-until-confirmed deletion by default in this recipe. An optimistic overlay is substitutable only with a recovery contract. Confirmation and Undo solve different product decisions and are not interchangeable by appearance.
|
|
31
|
+
|
|
32
|
+
### Acceptance Sequences
|
|
33
|
+
|
|
34
|
+
| Sequence | Expected outcome |
|
|
35
|
+
| --- | --- |
|
|
36
|
+
| Cancel confirmation | No deletion effect; return focus to invoker |
|
|
37
|
+
| Fail definitively while filters change | Keep or restore the intended ID without reverting unrelated data |
|
|
38
|
+
| Lose response after submission | Mark outcome uncertain and reconcile before repeating |
|
|
39
|
+
| Delete the last row | Show empty state and move focus to a logical heading |
|
|
40
|
+
| Undo expires or restoration fails | Explain failure and reconcile actual collection state |
|
|
41
|
+
|
|
42
|
+
## Opinionated Guidance
|
|
43
|
+
|
|
44
|
+
Keep the ownership boundaries visible when composing the patterns. One screen can combine these mechanisms without making every value global. Record the rejected alternative and its user-visible cost in the [state brief](../state-brief.md).
|
|
45
|
+
|
|
46
|
+
## Platform-Specific Guidance
|
|
47
|
+
|
|
48
|
+
Restore focus after confirmation and after removal of the invoker. Announce the affected entity and the real undo availability; animation completion must not authorize deletion.
|
|
49
|
+
|
|
50
|
+
## Unsupported Absolutes
|
|
51
|
+
|
|
52
|
+
These acceptance sequences are proposed integration checks, not captured product evidence. Pattern model tests do not prove this entire screen, its backend, or its focus behavior.
|
|
53
|
+
|
|
54
|
+
## Verification Contract
|
|
55
|
+
|
|
56
|
+
Adapt every acceptance row to the consumer and record actual results with the [verification matrix](../verification.md). Include the ordinary successful task and at least one interrupted task. The initial handoff is `consumer_reference: not_applicable` because this fictional recipe selects no consumer profile or conformance record.
|
|
57
|
+
|
|
58
|
+
## Source, License, And Attribution
|
|
59
|
+
|
|
60
|
+
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.
|
|
61
|
+
|
|
62
|
+
## IA Navigation
|
|
63
|
+
|
|
64
|
+
Parent: [State Management](index.md).
|
|
65
|
+
Next: [Continue the state management route](../verification.md).
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
# State Management Recipes
|
|
2
|
+
|
|
3
|
+
Domain classification: design-engineering. Lifecycle: `experimental`.
|
|
4
|
+
|
|
5
|
+
## Repository Boundary
|
|
6
|
+
|
|
7
|
+
These are Design Engineering behavior recipes. The root `recipes/` directory remains the Layout corpus. A behavior recipe may reference a Layout recipe but cannot import state logic into its reusable CSS.
|
|
8
|
+
|
|
9
|
+
## Reusable Method
|
|
10
|
+
|
|
11
|
+
Choose a task, then review its owner map, event flow, substitution rules, and acceptance sequences.
|
|
12
|
+
|
|
13
|
+
- [Settings with explicit save](settings-save.md): draft, submission, acknowledgement, and guarded departure.
|
|
14
|
+
- [Search filters and detail](search-detail.md): route state, out-of-order reads, and stable selection.
|
|
15
|
+
- [Multi-step form](multi-step-form.md): retained fields, validation, branching, and final submit.
|
|
16
|
+
- [Deletion and supported undo](delete-undo.md): identity, duplicate policy, recovery, and actual reversibility.
|
|
17
|
+
|
|
18
|
+
### Composition Matrix
|
|
19
|
+
|
|
20
|
+
`E` means essential to this recipe's declared behavior; `S` means substitutable when the stated requirement changes; `O` is optional with its own contract; `—` means not required. Pattern names link to their standalone contracts.
|
|
21
|
+
|
|
22
|
+
| Pattern | Settings | Search/detail | Multi-step form | Delete/undo |
|
|
23
|
+
| --- | --- | --- | --- | --- |
|
|
24
|
+
| [Single owner](../patterns/single-owner.md) | E | E | E | E |
|
|
25
|
+
| [Derived state](../patterns/derived-state.md) | E | E | E | O |
|
|
26
|
+
| [ID selection](../patterns/id-selection.md) | — | E | — | E |
|
|
27
|
+
| [Draft/baseline](../patterns/draft-and-baseline.md) | E | — | E | — |
|
|
28
|
+
| [Submitted snapshot](../patterns/submitted-snapshot.md) | E | — | E | — |
|
|
29
|
+
| [Unsaved navigation](../patterns/unsaved-navigation.md) | E | — | E | — |
|
|
30
|
+
| [Latest request wins](../patterns/latest-request-wins.md) | O | E | O | — |
|
|
31
|
+
| [Single flight](../patterns/single-flight.md) | E | — | E | E |
|
|
32
|
+
| [Optimistic overlay](../patterns/optimistic-overlay.md) | O | — | — | S |
|
|
33
|
+
| [URL state](../patterns/url-state.md) | O | S | O | O |
|
|
34
|
+
| [Identity reset](../patterns/identity-reset.md) | E | E | E | E |
|
|
35
|
+
| [Versioned restore](../patterns/versioned-restore.md) | O | — | O | — |
|
|
36
|
+
|
|
37
|
+
Single owner and identity reset are lifecycle foundations in these recipes even where the short stack emphasizes task-specific mechanisms. For a fixed identity, reset may be implemented simply by disposal; reused screens must invalidate their old generation.
|
|
38
|
+
|
|
39
|
+
Substitution risks: replacing URL state loses history/deep-link recovery unless another navigation owner provides it. Replacing a pending deletion with an optimistic overlay requires definitive rejection versus uncertain-outcome handling. Replacing explicit save with autosave changes the recipe and needs a separate write ordering contract.
|
|
40
|
+
|
|
41
|
+
## Opinionated Guidance
|
|
42
|
+
|
|
43
|
+
Keep compositions smaller than the complete catalog. Optional restore and optimistic display should solve a named user need. Do not create a new primitive merely because a screen combines several existing ones.
|
|
44
|
+
|
|
45
|
+
## Platform-Specific Guidance
|
|
46
|
+
|
|
47
|
+
Keep native form behavior, router transitions, and focus restoration in the consuming UI. Model examples have no rendered geometry; use the linked Layout recipes to name scroll and source-order ownership.
|
|
48
|
+
|
|
49
|
+
## Unsupported Absolutes
|
|
50
|
+
|
|
51
|
+
The matrix describes proposed compositions, not universal requirements for every settings or search screen. It does not claim that all combinations have executed browser evidence.
|
|
52
|
+
|
|
53
|
+
## Verification Contract
|
|
54
|
+
|
|
55
|
+
Each recipe must expose a unique ownership map, a failure interleaving, and the consequence of replacing an essential choice. Execute consumer integration sequences separately from the 12 pattern model examples.
|
|
56
|
+
|
|
57
|
+
## Source, License, And Attribution
|
|
58
|
+
|
|
59
|
+
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.
|
|
60
|
+
|
|
61
|
+
## IA Navigation
|
|
62
|
+
|
|
63
|
+
Parent: [State Management](../index.md).
|
|
64
|
+
Next: [Continue the state management route](../verification.md).
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
---
|
|
2
|
+
type: Domain Guide
|
|
3
|
+
title: Multi-Step Form With Retained Draft
|
|
4
|
+
description: Retain entered values across steps and guard progression and final submission.
|
|
5
|
+
domain: design-engineering
|
|
6
|
+
lifecycle: experimental
|
|
7
|
+
provenance_kind: local
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# Multi-Step Form With Retained Draft
|
|
11
|
+
|
|
12
|
+
## Repository Boundary
|
|
13
|
+
|
|
14
|
+
Retain entered values across steps and guard progression and final submission. This is a consumer interaction composition in Design Engineering. Spatial structure comes from [Form Flow](../../../recipes/form-flow.md); this recipe adds no reusable Layout behavior.
|
|
15
|
+
|
|
16
|
+
## Reusable Method
|
|
17
|
+
|
|
18
|
+
### Selected Pattern Stack
|
|
19
|
+
|
|
20
|
+
[single owner](../patterns/single-owner.md), [draft/baseline](../patterns/draft-and-baseline.md), [submitted snapshot](../patterns/submitted-snapshot.md), [unsaved navigation](../patterns/unsaved-navigation.md).
|
|
21
|
+
|
|
22
|
+
### Ownership And Event Flow
|
|
23
|
+
|
|
24
|
+
The flow owns all field values and current step; each field emits intents. Validity is derived from relevant fields. The final operation owns the submitted snapshot. Unmounting a step does not destroy the flow draft.
|
|
25
|
+
|
|
26
|
+
Edit → validate current step → advance if allowed. Back preserves values. Changing an earlier answer recomputes eligibility and invalidates dependent values under an explicit policy. Final Submit captures the whole valid draft once.
|
|
27
|
+
|
|
28
|
+
### Composition And Substitution
|
|
29
|
+
|
|
30
|
+
An in-memory step is enough when deep links are not a requirement; use URL state when they are. Versioned restore is optional for long flows and requires retention/privacy decisions. Do not persist request-pending flags.
|
|
31
|
+
|
|
32
|
+
### Acceptance Sequences
|
|
33
|
+
|
|
34
|
+
| Sequence | Expected outcome |
|
|
35
|
+
| --- | --- |
|
|
36
|
+
| Advance, go Back, revisit | Values persist; errors follow current validity |
|
|
37
|
+
| Change an earlier branching answer | Hidden dependent answers are cleared or excluded under declared policy |
|
|
38
|
+
| Deep-link to a later step | Guard prerequisites or redirect without silently submitting |
|
|
39
|
+
| Fail final submission | Retain all fields and provide a route to the relevant error |
|
|
40
|
+
| Edit while final save completes | Preserve later edits using snapshot semantics |
|
|
41
|
+
|
|
42
|
+
## Opinionated Guidance
|
|
43
|
+
|
|
44
|
+
Keep the ownership boundaries visible when composing the patterns. One screen can combine these mechanisms without making every value global. Record the rejected alternative and its user-visible cost in the [state brief](../state-brief.md).
|
|
45
|
+
|
|
46
|
+
## Platform-Specific Guidance
|
|
47
|
+
|
|
48
|
+
Announce step context and move focus to the step heading or first invalid field as appropriate. Step order, DOM order, and validation routes must agree.
|
|
49
|
+
|
|
50
|
+
## Unsupported Absolutes
|
|
51
|
+
|
|
52
|
+
These acceptance sequences are proposed integration checks, not captured product evidence. Pattern model tests do not prove this entire screen, its backend, or its focus behavior.
|
|
53
|
+
|
|
54
|
+
## Verification Contract
|
|
55
|
+
|
|
56
|
+
Adapt every acceptance row to the consumer and record actual results with the [verification matrix](../verification.md). Include the ordinary successful task and at least one interrupted task. The initial handoff is `consumer_reference: not_applicable` because this fictional recipe selects no consumer profile or conformance record.
|
|
57
|
+
|
|
58
|
+
## Source, License, And Attribution
|
|
59
|
+
|
|
60
|
+
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.
|
|
61
|
+
|
|
62
|
+
## IA Navigation
|
|
63
|
+
|
|
64
|
+
Parent: [State Management](index.md).
|
|
65
|
+
Next: [Continue the state management route](../verification.md).
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
---
|
|
2
|
+
type: Domain Guide
|
|
3
|
+
title: Search Filters And Detail Selection
|
|
4
|
+
description: Preserve query context and entity identity across asynchronous search and history navigation.
|
|
5
|
+
domain: design-engineering
|
|
6
|
+
lifecycle: experimental
|
|
7
|
+
provenance_kind: local
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# Search Filters And Detail Selection
|
|
11
|
+
|
|
12
|
+
## Repository Boundary
|
|
13
|
+
|
|
14
|
+
Preserve query context and entity identity across asynchronous search and history navigation. This is a consumer interaction composition in Design Engineering. Spatial structure comes from [List Detail](../../../recipes/list-detail.md); this recipe adds no reusable Layout behavior.
|
|
15
|
+
|
|
16
|
+
## Reusable Method
|
|
17
|
+
|
|
18
|
+
### Selected Pattern Stack
|
|
19
|
+
|
|
20
|
+
[URL state](../patterns/url-state.md), [latest request wins](../patterns/latest-request-wins.md), [ID selection](../patterns/id-selection.md), [derived state](../patterns/derived-state.md).
|
|
21
|
+
|
|
22
|
+
### Ownership And Event Flow
|
|
23
|
+
|
|
24
|
+
The field owns its typing buffer; the route owns committed query/filter/page; the request owner holds results and query identity; the screen or route owns selected ID. A result collection is not necessarily the full entity inventory.
|
|
25
|
+
|
|
26
|
+
Commit query → reset page → update history → start read → accept only matching outcome. Back reads the route and starts the corresponding read without pushing another entry. Selected detail may be fetched separately with its own keyed request owner.
|
|
27
|
+
|
|
28
|
+
### Composition And Substitution
|
|
29
|
+
|
|
30
|
+
URL state can be replaced by screen-local committed state when sharing/history is explicitly unnecessary. Stable identity and stale-read handling remain essential. Debounce may reduce traffic but cannot substitute for request correlation.
|
|
31
|
+
|
|
32
|
+
### Acceptance Sequences
|
|
33
|
+
|
|
34
|
+
| Sequence | Expected outcome |
|
|
35
|
+
| --- | --- |
|
|
36
|
+
| Request A/B, resolve B/A | B results and status remain displayed |
|
|
37
|
+
| Change query on page 3 | Commit new query with page 1 |
|
|
38
|
+
| Back then Forward | Controls, query identity, and results follow route history |
|
|
39
|
+
| Selected item absent from filtered page | Retain or explicitly mark unavailable; do not infer deletion |
|
|
40
|
+
| Delete selected entity authoritatively | Apply missing-detail policy and recover focus |
|
|
41
|
+
|
|
42
|
+
## Opinionated Guidance
|
|
43
|
+
|
|
44
|
+
Keep the ownership boundaries visible when composing the patterns. One screen can combine these mechanisms without making every value global. Record the rejected alternative and its user-visible cost in the [state brief](../state-brief.md).
|
|
45
|
+
|
|
46
|
+
## Platform-Specific Guidance
|
|
47
|
+
|
|
48
|
+
Preserve typed input during IME composition. Label previous results during refresh; an empty accepted result must differ from loading or failure.
|
|
49
|
+
|
|
50
|
+
## Unsupported Absolutes
|
|
51
|
+
|
|
52
|
+
These acceptance sequences are proposed integration checks, not captured product evidence. Pattern model tests do not prove this entire screen, its backend, or its focus behavior.
|
|
53
|
+
|
|
54
|
+
## Verification Contract
|
|
55
|
+
|
|
56
|
+
Adapt every acceptance row to the consumer and record actual results with the [verification matrix](../verification.md). Include the ordinary successful task and at least one interrupted task. The initial handoff is `consumer_reference: not_applicable` because this fictional recipe selects no consumer profile or conformance record.
|
|
57
|
+
|
|
58
|
+
## Source, License, And Attribution
|
|
59
|
+
|
|
60
|
+
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.
|
|
61
|
+
|
|
62
|
+
## IA Navigation
|
|
63
|
+
|
|
64
|
+
Parent: [State Management](index.md).
|
|
65
|
+
Next: [Continue the state management route](../verification.md).
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
---
|
|
2
|
+
type: Domain Guide
|
|
3
|
+
title: Settings With Explicit Save
|
|
4
|
+
description: Edit and save preferences without losing later input or leaving with unsaved work.
|
|
5
|
+
domain: design-engineering
|
|
6
|
+
lifecycle: experimental
|
|
7
|
+
provenance_kind: local
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# Settings With Explicit Save
|
|
11
|
+
|
|
12
|
+
## Repository Boundary
|
|
13
|
+
|
|
14
|
+
Edit and save preferences without losing later input or leaving with unsaved work. This is a consumer interaction composition in Design Engineering. Spatial structure comes from [SaaS Settings](../../../recipes/saas-settings.md); this recipe adds no reusable Layout behavior.
|
|
15
|
+
|
|
16
|
+
## Reusable Method
|
|
17
|
+
|
|
18
|
+
### Selected Pattern Stack
|
|
19
|
+
|
|
20
|
+
[draft/baseline](../patterns/draft-and-baseline.md), [submitted snapshot](../patterns/submitted-snapshot.md), [single flight](../patterns/single-flight.md), [unsaved navigation](../patterns/unsaved-navigation.md).
|
|
21
|
+
|
|
22
|
+
### Ownership And Event Flow
|
|
23
|
+
|
|
24
|
+
The form owns draft; the server owns persisted data; the save attempt owns the snapshot; the router owns pending departure. Dirty is derived. Account changes invalidate the entire form generation.
|
|
25
|
+
|
|
26
|
+
Edit → validate → capture snapshot → save → reconcile acknowledgement → re-evaluate dirty. For Save-and-leave, leave only after successful reconciliation and only if no newer edits remain.
|
|
27
|
+
|
|
28
|
+
### Composition And Substitution
|
|
29
|
+
|
|
30
|
+
Explicit-save semantics require the snapshot and draft separation. A single-flight guard can share or ignore repeats; queuing requires a separately defined sequence of snapshots. Immediate autosave is a different recipe with debounce, ordering, and conflict rules.
|
|
31
|
+
|
|
32
|
+
### Acceptance Sequences
|
|
33
|
+
|
|
34
|
+
| Sequence | Expected outcome |
|
|
35
|
+
| --- | --- |
|
|
36
|
+
| Submit A, edit B, acknowledge A | Baseline A; draft B remains dirty; stay if leaving was requested |
|
|
37
|
+
| Save fails, then retry | Preserve draft and release the operation guard |
|
|
38
|
+
| Remote revision conflict | Preserve draft; offer reload/merge under consumer policy |
|
|
39
|
+
| Cancel departure | Keep draft and return focus to the invoker |
|
|
40
|
+
|
|
41
|
+
## Opinionated Guidance
|
|
42
|
+
|
|
43
|
+
Keep the ownership boundaries visible when composing the patterns. One screen can combine these mechanisms without making every value global. Record the rejected alternative and its user-visible cost in the [state brief](../state-brief.md).
|
|
44
|
+
|
|
45
|
+
## Platform-Specific Guidance
|
|
46
|
+
|
|
47
|
+
The form must connect errors to fields and announce completion without implying newer edits were saved. A disabled submit control is not the duplicate guard.
|
|
48
|
+
|
|
49
|
+
## Unsupported Absolutes
|
|
50
|
+
|
|
51
|
+
These acceptance sequences are proposed integration checks, not captured product evidence. Pattern model tests do not prove this entire screen, its backend, or its focus behavior.
|
|
52
|
+
|
|
53
|
+
## Verification Contract
|
|
54
|
+
|
|
55
|
+
Adapt every acceptance row to the consumer and record actual results with the [verification matrix](../verification.md). Include the ordinary successful task and at least one interrupted task. The initial handoff is `consumer_reference: not_applicable` because this fictional recipe selects no consumer profile or conformance record.
|
|
56
|
+
|
|
57
|
+
## Source, License, And Attribution
|
|
58
|
+
|
|
59
|
+
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.
|
|
60
|
+
|
|
61
|
+
## IA Navigation
|
|
62
|
+
|
|
63
|
+
Parent: [State Management](index.md).
|
|
64
|
+
Next: [Continue the state management route](../verification.md).
|