jsgui3-server 0.0.149 → 0.0.151

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 (106) hide show
  1. package/.github/agents/Mobile Developer.agent.md +89 -0
  2. package/.github/instructions/copilot.instructions.md +1 -0
  3. package/AGENTS.md +6 -0
  4. package/README.md +185 -0
  5. package/admin-ui/client.js +73 -43
  6. package/admin-ui/v1/admin_auth_service.js +197 -0
  7. package/admin-ui/v1/admin_user_store.js +71 -0
  8. package/admin-ui/v1/client.js +17 -0
  9. package/admin-ui/v1/controls/admin_shell.js +1399 -0
  10. package/admin-ui/v1/controls/group_box.js +84 -0
  11. package/admin-ui/v1/controls/stat_card.js +125 -0
  12. package/admin-ui/v1/server.js +658 -0
  13. package/admin-ui/v1/utils/formatters.js +68 -0
  14. package/docs/admin-extension-guide.md +345 -0
  15. package/docs/api-reference.md +383 -303
  16. package/docs/books/adaptive-control-improvements/01-control-candidate-matrix.md +122 -0
  17. package/docs/books/adaptive-control-improvements/02-tier-1-layout-playbooks.md +207 -0
  18. package/docs/books/adaptive-control-improvements/03-tier-2-navigation-form-overlay.md +140 -0
  19. package/docs/books/adaptive-control-improvements/04-cross-cutting-platform-functionality.md +141 -0
  20. package/docs/books/adaptive-control-improvements/05-styling-theming-density-upgrades.md +114 -0
  21. package/docs/books/adaptive-control-improvements/06-testing-quality-gates.md +97 -0
  22. package/docs/books/adaptive-control-improvements/07-delivery-roadmap-and-ownership.md +137 -0
  23. package/docs/books/adaptive-control-improvements/08-appendix-tier1-acceptance-and-pr-templates.md +261 -0
  24. package/docs/books/adaptive-control-improvements/README.md +66 -0
  25. package/docs/books/admin-ui-authentication/01-threat-model-and-goals.md +124 -0
  26. package/docs/books/admin-ui-authentication/02-session-model-and-token-model.md +75 -0
  27. package/docs/books/admin-ui-authentication/03-auth-middleware-patterns.md +77 -0
  28. package/docs/books/admin-ui-authentication/README.md +25 -0
  29. package/docs/books/creating-a-new-admin-ui/01-introduction-and-vision.md +130 -0
  30. package/docs/books/creating-a-new-admin-ui/02-architecture-and-data-flow.md +298 -0
  31. package/docs/books/creating-a-new-admin-ui/03-server-introspection.md +381 -0
  32. package/docs/books/creating-a-new-admin-ui/04-admin-module-adapter-layer.md +592 -0
  33. package/docs/books/creating-a-new-admin-ui/05-domain-controls-stat-cards-and-gauges.md +513 -0
  34. package/docs/books/creating-a-new-admin-ui/06-domain-controls-process-manager.md +544 -0
  35. package/docs/books/creating-a-new-admin-ui/07-domain-controls-resource-pool-inspector.md +493 -0
  36. package/docs/books/creating-a-new-admin-ui/08-domain-controls-route-table-and-api-explorer.md +586 -0
  37. package/docs/books/creating-a-new-admin-ui/09-domain-controls-log-viewer-and-activity-feed.md +490 -0
  38. package/docs/books/creating-a-new-admin-ui/10-domain-controls-build-status-and-bundle-inspector.md +526 -0
  39. package/docs/books/creating-a-new-admin-ui/11-domain-controls-configuration-panel.md +808 -0
  40. package/docs/books/creating-a-new-admin-ui/12-admin-shell-layout-sidebar-navigation.md +210 -0
  41. package/docs/books/creating-a-new-admin-ui/13-telemetry-integration.md +556 -0
  42. package/docs/books/creating-a-new-admin-ui/14-realtime-sse-observable-integration.md +485 -0
  43. package/docs/books/creating-a-new-admin-ui/15-styling-theming-aero-design-system.md +521 -0
  44. package/docs/books/creating-a-new-admin-ui/16-testing-and-quality-assurance.md +147 -0
  45. package/docs/books/creating-a-new-admin-ui/17-next-steps-process-resource-roadmap.md +356 -0
  46. package/docs/books/creating-a-new-admin-ui/README.md +68 -0
  47. package/docs/books/device-adaptive-composition/01-platform-feature-audit.md +177 -0
  48. package/docs/books/device-adaptive-composition/02-responsive-composition-model.md +187 -0
  49. package/docs/books/device-adaptive-composition/03-data-model-vs-view-model.md +231 -0
  50. package/docs/books/device-adaptive-composition/04-styling-theme-breakpoints.md +234 -0
  51. package/docs/books/device-adaptive-composition/05-showcase-app-multi-device-assessment.md +193 -0
  52. package/docs/books/device-adaptive-composition/06-implementation-patterns-and-apis.md +346 -0
  53. package/docs/books/device-adaptive-composition/07-testing-harness-and-quality-gates.md +265 -0
  54. package/docs/books/device-adaptive-composition/08-roadmap-and-adoption-plan.md +250 -0
  55. package/docs/books/device-adaptive-composition/README.md +47 -0
  56. package/docs/comparison-report-express-plex-cpanel.md +549 -0
  57. package/docs/comprehensive-documentation.md +220 -220
  58. package/docs/configuration-reference.md +227 -204
  59. package/docs/designs/server-admin-interface-aero.svg +611 -0
  60. package/docs/middleware-guide.md +236 -0
  61. package/docs/system-architecture.md +24 -18
  62. package/docs/troubleshooting.md +84 -53
  63. package/middleware/compression.js +217 -0
  64. package/middleware/index.js +15 -0
  65. package/module.js +19 -11
  66. package/package.json +1 -1
  67. package/serve-factory.js +29 -0
  68. package/server.js +280 -20
  69. package/tests/README.md +5 -0
  70. package/tests/admin-ui-jsgui-controls.test.js +581 -0
  71. package/tests/test-runner.js +1 -0
  72. package/.jsgui3-server-cache/jsgui3-html-shims/jsgui3-html-controls-shim-071799b982906680f5fd699d.js +0 -40
  73. package/.jsgui3-server-cache/jsgui3-html-shims/jsgui3-html-controls-shim-07352945ad5c92654fcb8b65.js +0 -39
  74. package/.jsgui3-server-cache/jsgui3-html-shims/jsgui3-html-controls-shim-138a601fadb6191ea314c6fd.js +0 -39
  75. package/.jsgui3-server-cache/jsgui3-html-shims/jsgui3-html-controls-shim-171f6c381c2cadf2e9fa7087.js +0 -39
  76. package/.jsgui3-server-cache/jsgui3-html-shims/jsgui3-html-controls-shim-1d973388156b84a04373fac9.js +0 -39
  77. package/.jsgui3-server-cache/jsgui3-html-shims/jsgui3-html-controls-shim-20e117bc8a10d2cd16234bbe.js +0 -40
  78. package/.jsgui3-server-cache/jsgui3-html-shims/jsgui3-html-controls-shim-2b028a82b0e5efddba42425f.js +0 -39
  79. package/.jsgui3-server-cache/jsgui3-html-shims/jsgui3-html-controls-shim-4518556cd5c7e059e82b22b8.js +0 -40
  80. package/.jsgui3-server-cache/jsgui3-html-shims/jsgui3-html-controls-shim-5bac1aa0f213902f718ed74f.js +0 -40
  81. package/.jsgui3-server-cache/jsgui3-html-shims/jsgui3-html-controls-shim-5f9996ac7822caf777d92f56.js +0 -39
  82. package/.jsgui3-server-cache/jsgui3-html-shims/jsgui3-html-controls-shim-60a92c702e65fd9cf748e3ec.js +0 -39
  83. package/.jsgui3-server-cache/jsgui3-html-shims/jsgui3-html-controls-shim-6164c1f8f738995c541895d2.js +0 -44
  84. package/.jsgui3-server-cache/jsgui3-html-shims/jsgui3-html-controls-shim-6718a85eb9e5aa782dd47a05.js +0 -45
  85. package/.jsgui3-server-cache/jsgui3-html-shims/jsgui3-html-controls-shim-69e280f14e37aee76a1d4675.js +0 -39
  86. package/.jsgui3-server-cache/jsgui3-html-shims/jsgui3-html-controls-shim-7570d1b030d44b111ed59c4c.js +0 -39
  87. package/.jsgui3-server-cache/jsgui3-html-shims/jsgui3-html-controls-shim-7798c9bbd55e510d5039f936.js +0 -42
  88. package/.jsgui3-server-cache/jsgui3-html-shims/jsgui3-html-controls-shim-78cd511ea1ef18ecb03d1be5.js +0 -40
  89. package/.jsgui3-server-cache/jsgui3-html-shims/jsgui3-html-controls-shim-7d482e0b95bcb5e3c543118b.js +0 -43
  90. package/.jsgui3-server-cache/jsgui3-html-shims/jsgui3-html-controls-shim-80e9476d1127c55b40fdb36f.js +0 -40
  91. package/.jsgui3-server-cache/jsgui3-html-shims/jsgui3-html-controls-shim-810ced55d5320a3088a05b13.js +0 -40
  92. package/.jsgui3-server-cache/jsgui3-html-shims/jsgui3-html-controls-shim-8423565f1a40e329afc8c6cf.js +0 -40
  93. package/.jsgui3-server-cache/jsgui3-html-shims/jsgui3-html-controls-shim-900bef783b8cee36506ec282.js +0 -39
  94. package/.jsgui3-server-cache/jsgui3-html-shims/jsgui3-html-controls-shim-a1a37aff6416fdad74040ddf.js +0 -39
  95. package/.jsgui3-server-cache/jsgui3-html-shims/jsgui3-html-controls-shim-ad48d5e8eda40f175b4df090.js +0 -39
  96. package/.jsgui3-server-cache/jsgui3-html-shims/jsgui3-html-controls-shim-aec5a2d963015528c9099462.js +0 -39
  97. package/.jsgui3-server-cache/jsgui3-html-shims/jsgui3-html-controls-shim-af9d34e0f1722fab9e28c269.js +0 -39
  98. package/.jsgui3-server-cache/jsgui3-html-shims/jsgui3-html-controls-shim-b818e4015e2f1fe86280b5ab.js +0 -41
  99. package/.jsgui3-server-cache/jsgui3-html-shims/jsgui3-html-controls-shim-bcb2541adc70b7aba61768c5.js +0 -44
  100. package/.jsgui3-server-cache/jsgui3-html-shims/jsgui3-html-controls-shim-bfe89d2c78ed44f95ed7dd73.js +0 -40
  101. package/.jsgui3-server-cache/jsgui3-html-shims/jsgui3-html-controls-shim-c06f04806a1e688e1187110c.js +0 -40
  102. package/.jsgui3-server-cache/jsgui3-html-shims/jsgui3-html-controls-shim-c3f3adf904f585afc544b96a.js +0 -39
  103. package/.jsgui3-server-cache/jsgui3-html-shims/jsgui3-html-controls-shim-d45acb873e1d8e32d5e60f2e.js +0 -39
  104. package/.jsgui3-server-cache/jsgui3-html-shims/jsgui3-html-controls-shim-db06f132533706f4a0163b8c.js +0 -39
  105. package/.jsgui3-server-cache/jsgui3-html-shims/jsgui3-html-controls-shim-f660f40d78b135fc8560a862.js +0 -39
  106. package/.jsgui3-server-cache/jsgui3-html-shims/jsgui3-html-controls-shim-f9dee4ec18a96e09bee06bae.js +0 -39
@@ -0,0 +1,122 @@
1
+ # Chapter 1 — Control Candidate Matrix and Findings
2
+
3
+ ## Purpose
4
+
5
+ Prioritize the control catalog for adaptive upgrades based on real impact:
6
+
7
+ - Structural risk on phone/tablet/orientation change
8
+ - Data density and interaction complexity
9
+ - Existing gap between desktop and touch behavior
10
+ - Reuse value as a pattern for other controls
11
+
12
+ ## Evidence Snapshot
13
+
14
+ Recent source-level review identified these concrete issues in key controls:
15
+
16
+ - `master_detail.js`: fixed two-column grid (`minmax(180px, 240px) 1fr`) with no layout-mode branch.
17
+ - `tabbed-panel.js`: horizontal tab strip is vulnerable to overflow in narrow widths.
18
+ - `split_pane.js`: pointer-oriented resize interaction with no touch-first fallback.
19
+ - `data_table.js`: large data surface with no responsive column-priority/card transformation strategy.
20
+ - `sidebar_nav.js`: manual collapse exists, but no environment-driven auto-collapse/morph.
21
+ - `Toolbar.js`: no overflow strategy for narrow widths.
22
+ - `modal.js`: static size variants only; no automatic phone full-screen mode.
23
+ - `form_container.js`: no adaptive multi-column to single-column strategy.
24
+ - `status_dashboard.js`: strongest baseline due to grid auto-fit, but no explicit density/layout-mode policy.
25
+
26
+ ## Tiering Criteria
27
+
28
+ ### Impact score (1-5)
29
+
30
+ - 5: Breaks or heavily degrades on common phone/tablet layouts
31
+ - 4: Usable but substantially reduced usability on touch/narrow layouts
32
+ - 3: Mostly usable; quality or accessibility debt
33
+ - 2: Minor adaptive polish only
34
+ - 1: Already adaptive enough through existing composition/tokens
35
+
36
+ ### Effort score (1-5)
37
+
38
+ - 5: Significant API and behavior changes across composition + interaction + tests
39
+ - 4: Medium-high code and test work
40
+ - 3: Moderate scoped update
41
+ - 2: Small targeted update
42
+ - 1: Minimal changes
43
+
44
+ ## Candidate Matrix
45
+
46
+ | Control | Impact | Effort | Priority | Why now |
47
+ |---|---:|---:|---|---|
48
+ | Master_Detail | 5 | 3 | Tier 1 | Canonical two-pane pattern; immediate phone pain; good first pattern anchor |
49
+ | Tabbed_Panel | 5 | 4 | Tier 1 | High usage + overflow + keyboard/touch adaptation needs |
50
+ | Split_Pane | 5 | 4 | Tier 1 | Pointer-first behavior conflicts with touch/mobile |
51
+ | Data_Table | 5 | 5 | Tier 1 | Highest value for admin UIs; biggest adaptation gap |
52
+ | Sidebar_Nav | 4 | 3 | Tier 2 | Shell-level navigation needs auto morphing |
53
+ | Form_Container | 4 | 3 | Tier 2 | Forms must adapt cleanly across orientation and width |
54
+ | Modal | 4 | 2 | Tier 2 | Quick high-value upgrade for phone usability |
55
+ | Toolbar | 4 | 3 | Tier 2 | Navigation/action density requires overflow strategy |
56
+ | Window / Window_Manager | 3 | 4 | Tier 3 | Desktop metaphor must degrade predictably on touch |
57
+ | Wizard | 3 | 2 | Tier 3 | Stepper strip and nav controls need mobile pattern |
58
+ | Status_Dashboard | 2 | 2 | Tier 4 | Mostly good; needs explicit density/mode tuning |
59
+ | Drawer | 2 | 2 | Tier 4 | Good baseline; mostly environment integration and polish |
60
+
61
+ ## Top Discoveries
62
+
63
+ ### Discovery A — the highest-value pattern is the two-pane morph
64
+
65
+ `Master_Detail`, `Split_Pane`, and many app-level shells all need the same adaptive morph:
66
+
67
+ - Desktop: dual pane
68
+ - Tablet portrait: primary + secondary as revealable overlay
69
+ - Phone: stacked flow or drawer/sheet secondary
70
+
71
+ This should be implemented once as a reusable adaptive region pattern and reused.
72
+
73
+ ### Discovery B — navigation controls need shared overflow/morph infrastructure
74
+
75
+ `Tabbed_Panel`, `Sidebar_Nav`, and `Toolbar` all face narrow-width overflow and touch navigation constraints.
76
+
77
+ Without shared helpers, each control will reinvent:
78
+
79
+ - overflow detection
80
+ - “more” bucket behavior
81
+ - focus order and ARIA preservation across morphs
82
+
83
+ ### Discovery C — Data_Table is both a control and a mode family
84
+
85
+ Treat `Data_Table` as a multi-mode control family:
86
+
87
+ - Desktop mode: full grid
88
+ - Tablet mode: reduced columns + optional detail pane
89
+ - Phone mode: list/card mode with row expansion
90
+
91
+ Trying to keep a single static grid shape across all modes will keep mobile quality low.
92
+
93
+ ## Layer Analysis (A/B/C/D)
94
+
95
+ Applying the four-layer model:
96
+
97
+ - Layer A (Domain): mostly unaffected; business data stays stable.
98
+ - Layer B (View Composition): major work in Tier 1 and Tier 2 controls.
99
+ - Layer C (Adaptive Resolution): requires consistent environment service usage.
100
+ - Layer D (Concrete Render): token/mode-attribute CSS work across most controls.
101
+
102
+ ## Model Placement Rules for This Program
103
+
104
+ For all upgrades in this book:
105
+
106
+ - `data.model`: business entities, user-intent preferences that are device-agnostic.
107
+ - `view.data.model`: resolved adaptive state (layout_mode, visible_columns, region presentation state).
108
+ - `view.model`: transient interaction state (open/closed, active tab index, temporary scroll/focus state).
109
+
110
+ Never persist runtime viewport-derived values as domain data.
111
+
112
+ ## Success Criteria for Candidate Selection
113
+
114
+ A control is ready for implementation when:
115
+
116
+ 1. Target mode behavior is specified for phone, tablet, desktop.
117
+ 2. State placement is mapped to model layers.
118
+ 3. CSS mode-attribute strategy is identified.
119
+ 4. P0/P1/P2 viewport assertions are defined.
120
+ 5. Regression impact on existing desktop behavior is bounded.
121
+
122
+ Next: Tier 1 playbooks with concrete upgrade recipes.
@@ -0,0 +1,207 @@
1
+ # Chapter 2 — Tier 1 Layout Control Playbooks
2
+
3
+ Tier 1 controls are the highest-impact adaptive targets and should be implemented first.
4
+
5
+ Patterns applied:
6
+
7
+ - Chapter 2 pattern: Four-layer composition split
8
+ - Chapter 3 pattern: adaptive state in view models
9
+ - Chapter 6 pattern: `compose_adaptive()` and environment contract
10
+
11
+ ---
12
+
13
+ ## 2.1 Master_Detail
14
+
15
+ ### Current issue
16
+
17
+ Current CSS uses a fixed two-column grid and lacks mode-aware composition.
18
+
19
+ ### Target behavior by mode
20
+
21
+ - Phone:
22
+ - Single-column list-first flow
23
+ - Selecting an item opens detail in a sheet or full panel (configurable)
24
+ - Tablet:
25
+ - Portrait: list + toggleable detail overlay
26
+ - Landscape: dual-pane with narrower master width
27
+ - Desktop:
28
+ - Dual-pane default with stable side-by-side behavior
29
+
30
+ ### Composition strategy
31
+
32
+ Use discrete JS composition + mode-attribute CSS polish:
33
+
34
+ - JS for pane structure/morphing
35
+ - CSS for spacing, typography, transitions per mode
36
+
37
+ ### State placement
38
+
39
+ - `data.model`: items, selected_id
40
+ - `view.data.model`: layout_mode, detail_presentation (`inline` | `overlay` | `sheet`)
41
+ - `view.model`: detail_open, last_focus_item_id
42
+
43
+ ### Implementation steps
44
+
45
+ 1. Add `compose_phone_layout`, `compose_tablet_layout`, `compose_desktop_layout`.
46
+ 2. Route through `compose_adaptive`.
47
+ 3. Keep selected-item domain logic unchanged.
48
+ 4. Add detail open/close mechanics only in view state.
49
+ 5. Apply `[data-layout-mode]` CSS selectors for spacing and target sizes.
50
+
51
+ ### Test essentials
52
+
53
+ - P0: no horizontal overflow in all six viewports.
54
+ - P1: selecting master item updates detail in all modes.
55
+ - P1: overlay/sheet opens and closes with keyboard + click/touch.
56
+ - P2: touch hit targets are at least 44px in touch profiles.
57
+
58
+ ---
59
+
60
+ ## 2.2 Tabbed_Panel
61
+
62
+ ### Current issue
63
+
64
+ Tab strip is horizontal-first and can overflow on narrow screens.
65
+
66
+ ### Target behavior by mode
67
+
68
+ - Phone:
69
+ - Scrollable tab strip or compact segment mode
70
+ - Optional icon-first labels with hidden text fallback for a11y
71
+ - Tablet:
72
+ - Horizontal strip with controlled overflow handling
73
+ - Desktop:
74
+ - Existing behavior preserved with richer indicators
75
+
76
+ ### Composition strategy
77
+
78
+ Hybrid:
79
+
80
+ - JS: overflow bucket strategy and optional tab-list mode switching
81
+ - CSS: mode/density token scaling for tabs and indicators
82
+
83
+ ### State placement
84
+
85
+ - `data.model`: tab definitions/content
86
+ - `view.data.model`: tab_layout (`scroll`, `fit`, `overflow_menu`)
87
+ - `view.model`: active_tab_index, overflow_open
88
+
89
+ ### Implementation steps
90
+
91
+ 1. Add tab measurement logic in activation with SSR-safe guards.
92
+ 2. Resolve `tab_layout` from available width (container-aware where possible).
93
+ 3. Preserve keyboard navigation semantics and ARIA roles across modes.
94
+ 4. Ensure active indicator style uses tokens, not hardcoded colors.
95
+
96
+ ### Test essentials
97
+
98
+ - P0: active tab always visible and selectable across matrix.
99
+ - P1: keyboard navigation (arrows/home/end) remains correct in overflow mode.
100
+ - P1: ARIA (`aria-selected`, `aria-controls`) remains accurate after mode switches.
101
+ - P2: indicator and tab touch targets remain legible and accessible.
102
+
103
+ ---
104
+
105
+ ## 2.3 Split_Pane
106
+
107
+ ### Current issue
108
+
109
+ Resize interaction is pointer-centric; phone behavior should not rely on tiny drag handles.
110
+
111
+ ### Target behavior by mode
112
+
113
+ - Phone:
114
+ - Replace draggable split with stacked sections and toggle affordance
115
+ - Tablet:
116
+ - Optional split in landscape, stacked in portrait by default
117
+ - Desktop:
118
+ - Existing resizable split retained
119
+
120
+ ### Composition strategy
121
+
122
+ Discrete JS composition with interaction-mode rules:
123
+
124
+ - `touch` and narrow mode disable drag-resize
125
+ - `pointer` mode allows drag-resize with guardrails
126
+
127
+ ### State placement
128
+
129
+ - `data.model`: pane content/config (device-agnostic)
130
+ - `view.data.model`: split_enabled, orientation_mode, pane_ratio_policy
131
+ - `view.model`: current_ratio (session-level), active_pane
132
+
133
+ ### Implementation steps
134
+
135
+ 1. Introduce `split_enabled` resolver from layout and interaction mode.
136
+ 2. Add adaptive orientation defaults.
137
+ 3. Replace drag handle with mode-aware toggle controls on phone.
138
+ 4. Persist only user intent preferences (if any), not live viewport-derived ratio.
139
+
140
+ ### Test essentials
141
+
142
+ - P0: no unusable drag affordance in phone mode.
143
+ - P1: desktop drag-resize still works and obeys min/max boundaries.
144
+ - P1: orientation transitions preserve pane content and focus order.
145
+ - P2: touch mode controls meet target-size requirements.
146
+
147
+ ---
148
+
149
+ ## 2.4 Data_Table
150
+
151
+ ### Current issue
152
+
153
+ Data-dense behavior is desktop-oriented; lacks formal mode family for phone/tablet.
154
+
155
+ ### Target behavior by mode
156
+
157
+ - Phone:
158
+ - Card/list row presentation
159
+ - Primary fields shown inline; secondary fields in row detail expansion
160
+ - Tablet:
161
+ - Priority-column strategy + optional side detail panel
162
+ - Desktop:
163
+ - Full grid with advanced interactions (resize/frozen columns/etc.)
164
+
165
+ ### Composition strategy
166
+
167
+ Discrete JS mode family + CSS density scaling.
168
+
169
+ ### State placement
170
+
171
+ - `data.model`: rows, filters, sort state, selected ids
172
+ - `view.data.model`: table_mode (`grid` | `compact_grid` | `card_list`), visible_columns
173
+ - `view.model`: expanded_row_ids, hover/focus transient state
174
+
175
+ ### Implementation steps
176
+
177
+ 1. Introduce explicit render modes tied to layout mode.
178
+ 2. Add column priority metadata and `visible_columns` resolver.
179
+ 3. Implement phone card-list renderer behind mode switch.
180
+ 4. Gate pointer-only features (column drag resize) to pointer-capable contexts.
181
+ 5. Keep selection/filter/sort semantics identical across modes.
182
+
183
+ ### Test essentials
184
+
185
+ - P0: core CRUD-adjacent row interactions survive all modes.
186
+ - P1: selected row consistency across mode transition (phone ⇄ desktop).
187
+ - P1: keyboard nav remains valid where grid mode is active.
188
+ - P2: card/list readability and token-driven spacing in compact/comfortable density.
189
+
190
+ ---
191
+
192
+ ## 2.5 Tier 1 Implementation Order
193
+
194
+ Recommended order:
195
+
196
+ 1. Master_Detail
197
+ 2. Split_Pane
198
+ 3. Tabbed_Panel
199
+ 4. Data_Table
200
+
201
+ Rationale:
202
+
203
+ - Master_Detail and Split_Pane establish the reusable two-pane morph pattern.
204
+ - Tabbed_Panel establishes shared overflow and keyboard guarantees.
205
+ - Data_Table then reuses both pattern families in the highest-complexity control.
206
+
207
+ Next: Tier 2 controls (navigation, forms, overlays) that depend on the Tier 1 patterns.
@@ -0,0 +1,140 @@
1
+ # Chapter 3 — Tier 2 Playbooks: Navigation, Forms, and Overlays
2
+
3
+ Tier 2 focuses on controls that shape shell usability and input workflows.
4
+
5
+ ---
6
+
7
+ ## 3.1 Sidebar_Nav
8
+
9
+ ### Current issue
10
+
11
+ Sidebar supports collapse behavior, but not environment-driven automatic morphing.
12
+
13
+ ### Target behavior by mode
14
+
15
+ - Phone: drawer/overlay nav with explicit open/close controls
16
+ - Tablet: collapsed-icon rail by default; expandable overlay section groups
17
+ - Desktop: full inline sidebar
18
+
19
+ ### Composition approach
20
+
21
+ - Discrete JS morphing to drawer/rail/full variants
22
+ - CSS mode attributes for spacing and typography
23
+
24
+ ### State placement
25
+
26
+ - `data.model`: nav schema (sections/items), permissions
27
+ - `view.data.model`: nav_presentation (`drawer` | `rail` | `inline`)
28
+ - `view.model`: nav_open, expanded_section_ids
29
+
30
+ ### Key implementation notes
31
+
32
+ - Ensure focus trap only when in overlay drawer mode.
33
+ - Preserve section expansion state when moving between rail and inline where practical.
34
+ - Use existing Drawer behavior as foundational primitive where possible.
35
+
36
+ ---
37
+
38
+ ## 3.2 Toolbar
39
+
40
+ ### Current issue
41
+
42
+ No formal overflow policy for narrow layouts.
43
+
44
+ ### Target behavior by mode
45
+
46
+ - Phone: icon-first primary actions + overflow menu for secondary actions
47
+ - Tablet: mixed icon+label with medium overflow threshold
48
+ - Desktop: full action set inline
49
+
50
+ ### Composition approach
51
+
52
+ - Hybrid:
53
+ - JS for overflow resolution and action bucketing
54
+ - CSS for density and label visibility rules
55
+
56
+ ### State placement
57
+
58
+ - `data.model`: action registry and semantics
59
+ - `view.data.model`: visible_action_ids, overflow_action_ids
60
+ - `view.model`: overflow_open, focused_action_id
61
+
62
+ ### Key implementation notes
63
+
64
+ - Keep action semantics stable regardless of location (inline vs overflow).
65
+ - Preserve keyboard order and shortcut mappings.
66
+ - Avoid duplicate action handlers by sharing command layer.
67
+
68
+ ---
69
+
70
+ ## 3.3 Modal
71
+
72
+ ### Current issue
73
+
74
+ Size variants exist but no automatic phone-first adaptation.
75
+
76
+ ### Target behavior by mode
77
+
78
+ - Phone: full-screen modal (or sheet variant for low-criticality flows)
79
+ - Tablet: large centered modal with safe margins
80
+ - Desktop: existing size variants
81
+
82
+ ### Composition approach
83
+
84
+ - Mostly CSS/token policy with a small JS default resolver
85
+
86
+ ### State placement
87
+
88
+ - `data.model`: modal content model / business state
89
+ - `view.data.model`: resolved_modal_size, modal_presentation
90
+ - `view.model`: is_open, active_focus_scope
91
+
92
+ ### Key implementation notes
93
+
94
+ - Ensure ESC/backdrop behavior remains consistent.
95
+ - Focus return target should survive mode changes.
96
+ - Use motion tokens for transitions and respect reduced-motion.
97
+
98
+ ---
99
+
100
+ ## 3.4 Form_Container
101
+
102
+ ### Current issue
103
+
104
+ No explicit adaptive field grid strategy for orientation and width changes.
105
+
106
+ ### Target behavior by mode
107
+
108
+ - Phone: single-column form flow
109
+ - Tablet portrait: mostly single-column, selective two-column groups
110
+ - Tablet landscape/Desktop: two or more columns where appropriate
111
+
112
+ ### Composition approach
113
+
114
+ - Primarily CSS mode selectors for grid columns
115
+ - JS only for field-group structural changes where required
116
+
117
+ ### State placement
118
+
119
+ - `data.model`: form values and validation outcomes
120
+ - `view.data.model`: form_layout_mode, visible_field_groups
121
+ - `view.model`: active_field_id, section_expanded_state
122
+
123
+ ### Key implementation notes
124
+
125
+ - Keep validation state and messages independent of presentation layout.
126
+ - Avoid moving domain values during layout transitions.
127
+ - Ensure tab/focus order remains logical in both column and stacked modes.
128
+
129
+ ---
130
+
131
+ ## 3.5 Tier 2 Test Priorities
132
+
133
+ Required assertions for each upgraded Tier 2 control:
134
+
135
+ - P0: no horizontal overflow and all primary actions reachable.
136
+ - P1: keyboard and ARIA behavior preserved after adaptive morph.
137
+ - P1: orientation changes do not lose active/expanded/open state unexpectedly.
138
+ - P2: touch target and spacing quality in compact/cozy/comfortable densities.
139
+
140
+ Next: cross-cutting platform functionality needed so these upgrades do not duplicate logic.
@@ -0,0 +1,141 @@
1
+ # Chapter 4 — Cross-Cutting Platform Functionality
2
+
3
+ Control-specific improvements will be expensive and inconsistent unless shared adaptive infrastructure is added first.
4
+
5
+ This chapter defines those shared capabilities.
6
+
7
+ ## 4.1 View Environment Service (Required)
8
+
9
+ ### Responsibility
10
+
11
+ Resolve and publish:
12
+
13
+ - viewport dimensions + orientation
14
+ - layout_mode
15
+ - density_mode
16
+ - interaction_mode
17
+ - motion_mode
18
+
19
+ ### Why first
20
+
21
+ Without this, controls will continue ad-hoc viewport checks and duplicated breakpoint logic.
22
+
23
+ ### Output contract
24
+
25
+ ```js
26
+ context.view_environment = {
27
+ viewport: { width, height, orientation },
28
+ layout_mode: 'phone' | 'tablet' | 'desktop',
29
+ density_mode: 'compact' | 'cozy' | 'comfortable',
30
+ interaction_mode: 'touch' | 'pointer' | 'hybrid',
31
+ motion_mode: 'normal' | 'reduced'
32
+ };
33
+ ```
34
+
35
+ ### CSS bridge
36
+
37
+ Set root attributes:
38
+
39
+ - `data-layout-mode`
40
+ - `data-density-mode`
41
+ - `data-interaction-mode`
42
+ - `data-motion-mode`
43
+
44
+ ## 4.2 Adaptive Composition Helper (Required)
45
+
46
+ ### Responsibility
47
+
48
+ Single utility to switch composition branches by layout mode and recompose on mode change.
49
+
50
+ ### Why first
51
+
52
+ Prevents control-specific conditional composition boilerplate and inconsistent fallback behavior.
53
+
54
+ ### Baseline usage
55
+
56
+ ```js
57
+ compose_adaptive(this, {
58
+ phone: () => this.compose_phone(),
59
+ tablet: () => this.compose_tablet(),
60
+ desktop: () => this.compose_desktop()
61
+ });
62
+ ```
63
+
64
+ ## 4.3 Responsive Parameter Resolution (Required)
65
+
66
+ ### Responsibility
67
+
68
+ Allow mode-branching in control params resolved through a single path.
69
+
70
+ ### Why first
71
+
72
+ Many controls need per-mode variants (columns, row height, visible labels, etc.) without custom code per control.
73
+
74
+ ### Existing alignment
75
+
76
+ `control_mixins/theme_params.js` already centralizes param schemas and hook derivation, making it the right extension point.
77
+
78
+ ## 4.4 Container-Aware Mode Utility (Recommended)
79
+
80
+ ### Responsibility
81
+
82
+ Resolve local mode from control container width for embedded widgets.
83
+
84
+ ### Why
85
+
86
+ Viewport mode alone is insufficient for controls rendered in narrow side panels on desktop.
87
+
88
+ ### Priority
89
+
90
+ P2 relative to first shipping pass, but strongly recommended for table/tab/toolbar quality.
91
+
92
+ ## 4.5 Shared Overflow Policy Utility (Recommended)
93
+
94
+ ### Responsibility
95
+
96
+ Provide a reusable strategy for:
97
+
98
+ - action overflow bucketing
99
+ - tab overflow handling
100
+ - consistent keyboard/focus behavior in overflow menus
101
+
102
+ ### Why
103
+
104
+ `Tabbed_Panel`, `Toolbar`, and potentially `Horizontal_Menu` need similar overflow logic.
105
+
106
+ ## 4.6 Adaptive Region Morph Utility (Recommended)
107
+
108
+ ### Responsibility
109
+
110
+ Declare region morphs (inline sidebar ↔ rail ↔ drawer; panel ↔ sheet) in one consistent abstraction.
111
+
112
+ ### Why
113
+
114
+ Reduces repeated custom morph logic in shell controls.
115
+
116
+ ## 4.7 Other Functional Improvements
117
+
118
+ Beyond control-level updates, these functional additions materially improve adaptive behavior quality:
119
+
120
+ 1. Preference persistence boundary:
121
+ - persist theme + density preference
122
+ - do not persist runtime layout mode
123
+ 2. Focus restoration helpers for mode transitions:
124
+ - return focus to sensible targets when overlays close or mode morphs
125
+ 3. Motion policy adapter:
126
+ - enforce reduced-motion behavior for adaptive transitions
127
+ 4. Touch-target audit utility:
128
+ - runtime test utility for minimum target sizes on touch mode
129
+
130
+ ## 4.8 Dependency Order
131
+
132
+ Implement shared platform functionality in this order:
133
+
134
+ 1. View Environment Service
135
+ 2. Adaptive Composition Helper
136
+ 3. Responsive Parameter Resolution
137
+ 4. Shared Overflow Policy
138
+ 5. Adaptive Region Morph Utility
139
+ 6. Container-Aware Mode Utility
140
+
141
+ This order unlocks rapid control upgrades with minimal rework.