jsgui3-server 0.0.148 → 0.0.150

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 (154) hide show
  1. package/.github/agents/Mobile Developer.agent.md +89 -0
  2. package/.github/workflows/control-scan-manifest-check.yml +31 -0
  3. package/AGENTS.md +4 -0
  4. package/README.md +215 -3
  5. package/admin-ui/client.js +81 -51
  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/dev-status.svg +139 -0
  15. package/docs/admin-extension-guide.md +345 -0
  16. package/docs/api-reference.md +301 -43
  17. package/docs/books/adaptive-control-improvements/01-control-candidate-matrix.md +122 -0
  18. package/docs/books/adaptive-control-improvements/02-tier-1-layout-playbooks.md +207 -0
  19. package/docs/books/adaptive-control-improvements/03-tier-2-navigation-form-overlay.md +140 -0
  20. package/docs/books/adaptive-control-improvements/04-cross-cutting-platform-functionality.md +141 -0
  21. package/docs/books/adaptive-control-improvements/05-styling-theming-density-upgrades.md +114 -0
  22. package/docs/books/adaptive-control-improvements/06-testing-quality-gates.md +97 -0
  23. package/docs/books/adaptive-control-improvements/07-delivery-roadmap-and-ownership.md +137 -0
  24. package/docs/books/adaptive-control-improvements/08-appendix-tier1-acceptance-and-pr-templates.md +261 -0
  25. package/docs/books/adaptive-control-improvements/README.md +66 -0
  26. package/docs/books/admin-ui-authentication/01-threat-model-and-goals.md +124 -0
  27. package/docs/books/admin-ui-authentication/02-session-model-and-token-model.md +75 -0
  28. package/docs/books/admin-ui-authentication/03-auth-middleware-patterns.md +77 -0
  29. package/docs/books/admin-ui-authentication/README.md +25 -0
  30. package/docs/books/creating-a-new-admin-ui/01-introduction-and-vision.md +130 -0
  31. package/docs/books/creating-a-new-admin-ui/02-architecture-and-data-flow.md +298 -0
  32. package/docs/books/creating-a-new-admin-ui/03-server-introspection.md +381 -0
  33. package/docs/books/creating-a-new-admin-ui/04-admin-module-adapter-layer.md +592 -0
  34. package/docs/books/creating-a-new-admin-ui/05-domain-controls-stat-cards-and-gauges.md +513 -0
  35. package/docs/books/creating-a-new-admin-ui/06-domain-controls-process-manager.md +544 -0
  36. package/docs/books/creating-a-new-admin-ui/07-domain-controls-resource-pool-inspector.md +493 -0
  37. package/docs/books/creating-a-new-admin-ui/08-domain-controls-route-table-and-api-explorer.md +586 -0
  38. package/docs/books/creating-a-new-admin-ui/09-domain-controls-log-viewer-and-activity-feed.md +490 -0
  39. package/docs/books/creating-a-new-admin-ui/10-domain-controls-build-status-and-bundle-inspector.md +526 -0
  40. package/docs/books/creating-a-new-admin-ui/11-domain-controls-configuration-panel.md +808 -0
  41. package/docs/books/creating-a-new-admin-ui/12-admin-shell-layout-sidebar-navigation.md +210 -0
  42. package/docs/books/creating-a-new-admin-ui/13-telemetry-integration.md +556 -0
  43. package/docs/books/creating-a-new-admin-ui/14-realtime-sse-observable-integration.md +485 -0
  44. package/docs/books/creating-a-new-admin-ui/15-styling-theming-aero-design-system.md +521 -0
  45. package/docs/books/creating-a-new-admin-ui/16-testing-and-quality-assurance.md +147 -0
  46. package/docs/books/creating-a-new-admin-ui/17-next-steps-process-resource-roadmap.md +356 -0
  47. package/docs/books/creating-a-new-admin-ui/README.md +68 -0
  48. package/docs/books/device-adaptive-composition/01-platform-feature-audit.md +177 -0
  49. package/docs/books/device-adaptive-composition/02-responsive-composition-model.md +187 -0
  50. package/docs/books/device-adaptive-composition/03-data-model-vs-view-model.md +231 -0
  51. package/docs/books/device-adaptive-composition/04-styling-theme-breakpoints.md +234 -0
  52. package/docs/books/device-adaptive-composition/05-showcase-app-multi-device-assessment.md +193 -0
  53. package/docs/books/device-adaptive-composition/06-implementation-patterns-and-apis.md +346 -0
  54. package/docs/books/device-adaptive-composition/07-testing-harness-and-quality-gates.md +265 -0
  55. package/docs/books/device-adaptive-composition/08-roadmap-and-adoption-plan.md +250 -0
  56. package/docs/books/device-adaptive-composition/README.md +47 -0
  57. package/docs/books/jsgui3-bundling-research-book/00-table-of-contents.md +35 -0
  58. package/docs/books/jsgui3-bundling-research-book/01-pipeline-and-runtime-semantics.md +34 -0
  59. package/docs/books/jsgui3-bundling-research-book/02-javascript-bundling-core.md +36 -0
  60. package/docs/books/jsgui3-bundling-research-book/03-style-extraction-and-css-compilation.md +35 -0
  61. package/docs/books/jsgui3-bundling-research-book/04-static-publishing-and-delivery.md +39 -0
  62. package/docs/books/jsgui3-bundling-research-book/05-current-limits-and-size-bloat-vectors.md +25 -0
  63. package/docs/books/jsgui3-bundling-research-book/06-unused-module-elimination-strategy.md +77 -0
  64. package/docs/books/jsgui3-bundling-research-book/07-jsgui3-html-control-and-mixin-pruning.md +63 -0
  65. package/docs/books/jsgui3-bundling-research-book/08-test-and-verification-methodology.md +43 -0
  66. package/docs/books/jsgui3-bundling-research-book/09-roadmap-and-rollout.md +42 -0
  67. package/docs/books/jsgui3-bundling-research-book/10-further-research-strategies-and-upgrades.md +211 -0
  68. package/docs/books/jsgui3-bundling-research-book/README.md +35 -0
  69. package/docs/bundling-system-deep-dive.md +9 -4
  70. package/docs/comparison-report-express-plex-cpanel.md +549 -0
  71. package/docs/comprehensive-documentation.md +49 -18
  72. package/docs/configuration-reference.md +152 -27
  73. package/docs/core/README.md +19 -0
  74. package/docs/core/jsgui3-server-core-book/00-table-of-contents.md +21 -0
  75. package/docs/core/jsgui3-server-core-book/01-startup-readiness-state-machine.md +41 -0
  76. package/docs/core/jsgui3-server-core-book/02-resource-abstraction-and-lifecycle.md +92 -0
  77. package/docs/core/jsgui3-server-core-book/03-resource-pool-and-event-topology.md +47 -0
  78. package/docs/core/jsgui3-server-core-book/04-sse-publisher-semantics.md +41 -0
  79. package/docs/core/jsgui3-server-core-book/05-serve-factory-resource-wiring.md +46 -0
  80. package/docs/core/jsgui3-server-core-book/06-e2e-testing-methodology.md +48 -0
  81. package/docs/core/jsgui3-server-core-book/07-defect-detection-and-hardening-loop.md +47 -0
  82. package/docs/designs/server-admin-interface-aero.svg +611 -0
  83. package/docs/publishers-guide.md +59 -4
  84. package/docs/resources-guide.md +184 -35
  85. package/docs/simple-server-api-design.md +72 -17
  86. package/docs/system-architecture.md +18 -14
  87. package/docs/troubleshooting.md +84 -53
  88. package/examples/controls/15) window, observable SSE/server.js +6 -1
  89. package/examples/controls/19) window, auto observable ui/server.js +9 -0
  90. package/examples/controls/20) window, task manager app/README.md +133 -0
  91. package/examples/controls/20) window, task manager app/client.js +797 -0
  92. package/examples/controls/20) window, task manager app/server.js +178 -0
  93. package/examples/controls/6) window, color_palette/client.js +165 -68
  94. package/examples/controls/9) window, date picker/client.js +362 -76
  95. package/examples/controls/9b) window, shared data.model mirrored date pickers/client.js +104 -83
  96. package/examples/jsgui3-html/06) theming/client.js +22 -1
  97. package/examples/jsgui3-html/10) binding-debugger/client.js +137 -1
  98. package/http/responders/static/Static_Route_HTTP_Responder.js +52 -34
  99. package/lab/experiments/capture-color-controls.js +196 -0
  100. package/lab/results/screenshots/color-controls/full_page.png +0 -0
  101. package/lab/results/screenshots/color-controls/section_1_color_grid_12x12.png +0 -0
  102. package/lab/results/screenshots/color-controls/section_2_color_grid_4x2.png +0 -0
  103. package/lab/results/screenshots/color-controls/section_3_color_palette.png +0 -0
  104. package/lab/results/screenshots/color-controls/section_4_palette_comparison.png +0 -0
  105. package/lab/results/screenshots/color-controls/section_5_raw_swatches.png +0 -0
  106. package/lab/results/screenshots/color-controls/section_6_optimized_crayola.png +0 -0
  107. package/lab/results/screenshots/color-controls/section_7_pastel_palette.png +0 -0
  108. package/lab/results/screenshots/color-controls/section_8_extended_144.png +0 -0
  109. package/lab/screenshot-utils.js +248 -0
  110. package/module.js +12 -0
  111. package/package.json +12 -2
  112. package/publishers/Publishers.js +4 -3
  113. package/publishers/helpers/assigners/static-compressed-response-buffers/Single_Control_Webpage_Server_Static_Compressed_Response_Buffers_Assigner.js +5 -5
  114. package/publishers/http-sse-publisher.js +341 -0
  115. package/resources/process-resource.js +950 -0
  116. package/resources/processors/bundlers/js/esbuild/Advanced_JS_Bundler_Using_ESBuild.js +129 -33
  117. package/resources/processors/bundlers/js/esbuild/Core_JS_Non_Minifying_Bundler_Using_ESBuild.js +18 -7
  118. package/resources/processors/bundlers/js/esbuild/JSGUI3_HTML_Control_Optimizer.js +829 -0
  119. package/resources/remote-process-resource.js +355 -0
  120. package/resources/server-resource-pool.js +354 -41
  121. package/serve-factory.js +442 -259
  122. package/server.js +288 -13
  123. package/tests/README.md +71 -4
  124. package/tests/admin-ui-jsgui-controls.test.js +581 -0
  125. package/tests/admin-ui-render.test.js +24 -0
  126. package/tests/assigners.test.js +56 -40
  127. package/tests/bundling-default-control-elimination.puppeteer.test.js +260 -0
  128. package/tests/configuration-validation.test.js +21 -18
  129. package/tests/content-analysis.test.js +7 -6
  130. package/tests/control-optimizer-cache-behavior.test.js +52 -0
  131. package/tests/control-scan-manifest-regression.test.js +144 -0
  132. package/tests/end-to-end.test.js +15 -14
  133. package/tests/error-handling.test.js +222 -179
  134. package/tests/fixtures/bundling-default-button-client.js +37 -0
  135. package/tests/fixtures/bundling-default-window-client.js +34 -0
  136. package/tests/fixtures/control_scan_manifest_expectations.json +48 -0
  137. package/tests/fixtures/resource-monitor-client.js +319 -0
  138. package/tests/helpers/puppeteer-e2e-harness.js +317 -0
  139. package/tests/http-sse-publisher.test.js +136 -0
  140. package/tests/performance.test.js +69 -65
  141. package/tests/process-resource.test.js +138 -0
  142. package/tests/publishers.test.js +7 -7
  143. package/tests/remote-process-resource.test.js +160 -0
  144. package/tests/sass-controls.e2e.test.js +7 -1
  145. package/tests/serve-resources.test.js +270 -0
  146. package/tests/serve.test.js +120 -50
  147. package/tests/server-resource-pool.test.js +106 -0
  148. package/tests/small-controls-bundle-size.test.js +252 -0
  149. package/tests/test-runner.js +14 -1
  150. package/tests/window-examples.puppeteer.test.js +204 -1
  151. package/tests/window-resource-integration.puppeteer.test.js +585 -0
  152. package/tests/temp_invalid.js +0 -7
  153. package/tests/temp_invalid_utf8.js +0 -1
  154. package/tests/temp_malformed.js +0 -10
@@ -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.
@@ -0,0 +1,114 @@
1
+ # Chapter 5 — Styling, Theming, and Density Upgrades
2
+
3
+ This chapter converts adaptive composition into reliable visual behavior by extending existing token and theme practices.
4
+
5
+ ## 5.1 Current Baseline
6
+
7
+ `css/jsgui-tokens.css` already provides:
8
+
9
+ - strong base spacing and typography scales
10
+ - light/dark token bridges
11
+ - admin control token bridge (`--admin-*`)
12
+ - reduced-motion token durations
13
+
14
+ This is a strong foundation; the required improvements are additive.
15
+
16
+ ## 5.2 Mode-Attribute Styling Policy
17
+
18
+ Use mode attributes as the primary adaptive selector strategy:
19
+
20
+ - `[data-layout-mode="phone"]`
21
+ - `[data-layout-mode="tablet"]`
22
+ - `[data-layout-mode="desktop"]`
23
+ - `[data-density-mode="compact|cozy|comfortable"]`
24
+ - `[data-interaction-mode="touch|pointer|hybrid"]`
25
+
26
+ Avoid distributing raw `@media` breakpoints through control CSS except where absolutely necessary.
27
+
28
+ ## 5.3 Density Override Profiles
29
+
30
+ Define explicit density token overlays:
31
+
32
+ - Compact:
33
+ - tighter spacing and row heights for high-density desktop/power users
34
+ - Cozy (default):
35
+ - current baseline behavior
36
+ - Comfortable:
37
+ - larger spacing and text rhythm for readability/accessibility
38
+
39
+ Token categories to override:
40
+
41
+ - `--j-space-*`
42
+ - `--admin-font-size`
43
+ - `--admin-row-height`
44
+ - `--admin-cell-padding`
45
+ - selected control-specific paddings where needed
46
+
47
+ ## 5.4 Touch Interaction Floor
48
+
49
+ When `data-interaction-mode="touch"` is active:
50
+
51
+ - enforce minimum target height/width of 44px for actionable elements
52
+ - ensure spacing prevents accidental tap overlap
53
+ - prefer sheet/drawer transitions that preserve direct manipulation expectations
54
+
55
+ This should be implemented via token and selector policy, not one-off control hacks.
56
+
57
+ ## 5.5 Control-Specific Styling Upgrades
58
+
59
+ ### Master_Detail
60
+
61
+ - move hardcoded color/border values to admin tokens
62
+ - adjust master list item padding per density mode
63
+ - enforce phone-friendly detail panel spacing in sheet/overlay mode
64
+
65
+ ### Tabbed_Panel
66
+
67
+ - tokenized active indicator thickness and spacing
68
+ - compact mode icon-first treatment while preserving ARIA labels
69
+ - touch mode minimum tab target sizing
70
+
71
+ ### Split_Pane
72
+
73
+ - hide/de-emphasize drag handle in phone mode
74
+ - expose pointer-focused affordance only when interaction mode allows
75
+
76
+ ### Data_Table
77
+
78
+ - mode-specific row density token sets
79
+ - readable card mode typography and spacing
80
+ - tokenized header/background contrasts for high-density modes
81
+
82
+ ### Sidebar_Nav / Toolbar
83
+
84
+ - icon rail paddings and hit area tuning
85
+ - overflow menu spacing and typography consistency across density modes
86
+
87
+ ### Modal / Form_Container
88
+
89
+ - sheet/full-screen presentation spacing in phone mode
90
+ - form section spacing scales tied to density
91
+
92
+ ## 5.6 Theme Profile Extension
93
+
94
+ Theme persistence object should include:
95
+
96
+ - selected theme
97
+ - preferred density
98
+ - optional token overrides
99
+
100
+ It should exclude:
101
+
102
+ - runtime layout mode
103
+ - runtime viewport dimensions
104
+
105
+ ## 5.7 Styling Quality Gates
106
+
107
+ A control styling upgrade is complete when:
108
+
109
+ 1. All hardcoded adaptive-relevant spacing/sizing values are tokenized.
110
+ 2. Mode-attribute selectors exist for behavior differences.
111
+ 3. Touch target minimums pass in touch profiles.
112
+ 4. Compact and comfortable density modes remain readable and usable.
113
+
114
+ Next: testing gates that verify composition and styling behavior across the viewport matrix.
@@ -0,0 +1,97 @@
1
+ # Chapter 6 — Testing and Quality Gates for Adaptive Upgrades
2
+
3
+ Responsive behavior is a quality gate, not an optional enhancement.
4
+
5
+ This chapter defines mandatory test coverage for the improvements in this book.
6
+
7
+ ## 6.1 Viewport Matrix
8
+
9
+ Minimum matrix for all Tier 1 and Tier 2 controls:
10
+
11
+ 1. Phone portrait: 390×844
12
+ 2. Phone landscape: 844×390
13
+ 3. Tablet portrait: 768×1024
14
+ 4. Tablet landscape: 1024×768
15
+ 5. Desktop narrow: 1280×720
16
+ 6. Desktop wide: 1920×1080
17
+
18
+ ## 6.2 Assertion Classes
19
+
20
+ ### P0 — Structural integrity
21
+
22
+ - no horizontal overflow
23
+ - control renders with non-zero functional area
24
+ - primary action path remains available
25
+
26
+ ### P1 — Adaptive behavior integrity
27
+
28
+ - mode-specific composition appears as specified
29
+ - state transitions preserve user context where intended
30
+ - keyboard and ARIA semantics remain correct after morphs
31
+
32
+ ### P2 — Visual and ergonomic integrity
33
+
34
+ - density mode variants maintain readability
35
+ - touch target sizing and spacing pass thresholds
36
+ - reduced-motion users receive non-disorienting transitions
37
+
38
+ ## 6.3 Tier-Specific Test Scope
39
+
40
+ ### Tier 1
41
+
42
+ - full P0 + P1 + P2 matrix required before merge
43
+
44
+ ### Tier 2
45
+
46
+ - full P0 + P1 required
47
+ - P2 mandatory for touch-heavy controls (`Toolbar`, `Sidebar_Nav`, `Modal`)
48
+
49
+ ### Tier 3/4
50
+
51
+ - P0 mandatory
52
+ - selective P1/P2 where risk justifies coverage
53
+
54
+ ## 6.4 Test Harness Pattern
55
+
56
+ Use self-contained E2E files per control:
57
+
58
+ - build SSR test page
59
+ - activate client behavior
60
+ - run matrix assertions
61
+ - capture screenshots per viewport
62
+ - tear down server/browser
63
+
64
+ This follows project testing guidance and avoids cross-test coupling.
65
+
66
+ ## 6.5 Required Regression Scenarios
67
+
68
+ Every upgraded control must include:
69
+
70
+ 1. Mode transition scenario (phone → desktop and desktop → phone)
71
+ 2. Orientation transition scenario (portrait ↔ landscape)
72
+ 3. Keyboard-only navigation scenario
73
+ 4. Touch interaction scenario (for touch-relevant controls)
74
+ 5. Reduced-motion behavior scenario where animations exist
75
+
76
+ ## 6.6 Exit Criteria Per Control
77
+
78
+ A control upgrade is complete when:
79
+
80
+ 1. Functional tests pass on all required viewport profiles.
81
+ 2. No new console errors are introduced by mode transitions.
82
+ 3. Screenshot set is captured for review and retained in expected location.
83
+ 4. Existing desktop behavior remains backward compatible unless explicitly changed.
84
+
85
+ ## 6.7 Program-Level Quality Dashboard
86
+
87
+ Track adaptive rollout readiness with a simple control checklist:
88
+
89
+ - composition complete
90
+ - state placement audited
91
+ - token/mode styling complete
92
+ - P0/P1/P2 tests green
93
+ - docs updated
94
+
95
+ This should be maintained alongside roadmap execution to prevent partially adaptive shipping.
96
+
97
+ Next: delivery sequencing, ownership model, and milestone plan.