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,137 @@
1
+ # Chapter 7 — Delivery Roadmap and Ownership
2
+
3
+ This chapter turns the playbooks into an executable delivery sequence.
4
+
5
+ ## 7.1 Phase Plan
6
+
7
+ ### Phase 1 — Foundation (Platform Utilities)
8
+
9
+ Deliver:
10
+
11
+ 1. View environment service
12
+ 2. Adaptive composition helper
13
+ 3. Responsive parameter resolution
14
+ 4. Initial mode-attribute + density token overlays
15
+
16
+ Exit criteria:
17
+
18
+ - utility APIs are documented and used in at least one upgraded control
19
+ - root mode attributes update correctly in runtime
20
+
21
+ ### Phase 2 — Tier 1 Controls
22
+
23
+ Deliver in this order:
24
+
25
+ 1. Master_Detail
26
+ 2. Split_Pane
27
+ 3. Tabbed_Panel
28
+ 4. Data_Table
29
+
30
+ Exit criteria:
31
+
32
+ - all Tier 1 controls pass required matrix assertions
33
+ - no regressions in desktop baseline behavior
34
+
35
+ ### Phase 3 — Tier 2 Controls
36
+
37
+ Deliver:
38
+
39
+ 1. Sidebar_Nav
40
+ 2. Toolbar
41
+ 3. Modal
42
+ 4. Form_Container
43
+
44
+ Exit criteria:
45
+
46
+ - shell navigation and core form workflows are adaptive across matrix
47
+
48
+ ### Phase 4 — Tier 3/4 and polish
49
+
50
+ Deliver:
51
+
52
+ - Window/Window_Manager adaptive constraints
53
+ - Wizard and secondary control adjustments
54
+ - density/touch refinements and final a11y polish
55
+
56
+ Exit criteria:
57
+
58
+ - project-level adaptive checklist reaches defined target threshold
59
+
60
+ ## 7.2 Ownership Model
61
+
62
+ Recommend three streams in parallel:
63
+
64
+ 1. Platform stream:
65
+ - shared utilities, root attributes, token overlays
66
+ 2. Control stream:
67
+ - Tier 1/Tier 2 upgrades using shared utilities
68
+ 3. QA stream:
69
+ - viewport-matrix suites, screenshot artifacts, regression checks
70
+
71
+ This avoids serial bottlenecks and keeps quality moving with implementation.
72
+
73
+ ## 7.3 Milestone Definitions
74
+
75
+ ### Milestone A — “Adaptive Infrastructure Ready”
76
+
77
+ - foundation utilities merged
78
+ - one control successfully migrated using new pattern
79
+
80
+ ### Milestone B — “Shell Controls Ready”
81
+
82
+ - Tier 1 control set complete except Data_Table
83
+ - shell behaviors validated across matrix
84
+
85
+ ### Milestone C — “Data-Dense Ready”
86
+
87
+ - Data_Table mode family complete
88
+ - key data workflows verified on phone/tablet/desktop
89
+
90
+ ### Milestone D — “Catalog Ready (Primary)”
91
+
92
+ - Tier 2 controls complete
93
+ - quality checklist green for prioritized control set
94
+
95
+ ## 7.4 Risk Register
96
+
97
+ ### Risk 1: control-level bespoke implementations diverge
98
+
99
+ Mitigation:
100
+
101
+ - enforce shared helper usage in review criteria
102
+
103
+ ### Risk 2: adaptive state leaks into domain model
104
+
105
+ Mitigation:
106
+
107
+ - explicit model-layer audit in PR checklist
108
+
109
+ ### Risk 3: desktop regressions during mobile improvements
110
+
111
+ Mitigation:
112
+
113
+ - mandatory desktop matrix profiles and before/after screenshots
114
+
115
+ ### Risk 4: test burden slows delivery
116
+
117
+ Mitigation:
118
+
119
+ - reusable matrix runner and assertion helper library
120
+
121
+ ## 7.5 Definition of Done for the Program
122
+
123
+ The adaptive control improvement program is complete when:
124
+
125
+ 1. Tier 1 and Tier 2 controls are upgraded and documented.
126
+ 2. Shared adaptive utilities are adopted consistently.
127
+ 3. Mode-attribute and density-token styling policies are in place.
128
+ 4. Viewport-matrix quality gates are integrated in regular testing.
129
+ 5. The resulting developer path for adaptive control work is easier than ad-hoc responsive code.
130
+
131
+ ---
132
+
133
+ This concludes the implementation-focused adaptive control improvement book.
134
+
135
+ For implementation reviews and pull requests, continue with:
136
+
137
+ - `08-appendix-tier1-acceptance-and-pr-templates.md`
@@ -0,0 +1,261 @@
1
+ # Chapter 8 — Appendix: Tier 1 Acceptance Checklists and PR Templates
2
+
3
+ This appendix provides implementation-ready acceptance criteria and copy/paste PR templates
4
+ for the first four Tier 1 controls:
5
+
6
+ 1. Master_Detail
7
+ 2. Split_Pane
8
+ 3. Tabbed_Panel
9
+ 4. Data_Table
10
+
11
+ Use this appendix as the final gate before merge.
12
+
13
+ ## 8.1 Shared Tier 1 Acceptance Gate
14
+
15
+ Every Tier 1 control PR must satisfy all items below.
16
+
17
+ ### A. Layer and state architecture
18
+
19
+ - [ ] Adaptive behavior is mapped to Layer B/C/D (not Layer A domain logic).
20
+ - [ ] No viewport/layout/density state is stored in `data.model`.
21
+ - [ ] Resolved adaptive state is in `view.data.model`.
22
+ - [ ] Transient UI state is in `view.model`.
23
+
24
+ ### B. Composition and environment
25
+
26
+ - [ ] Uses shared environment contract (`layout_mode`, `density_mode`, `interaction_mode`, `motion_mode`).
27
+ - [ ] Uses adaptive composition branching (or equivalent shared helper), not ad-hoc per-method viewport checks.
28
+ - [ ] Supports phone, tablet, desktop behavior as defined in this book.
29
+ - [ ] Preserves backward compatibility for desktop behavior unless explicitly changed.
30
+
31
+ ### C. Styling and theming
32
+
33
+ - [ ] Uses mode attributes (`data-layout-mode` etc.) for adaptive styling policy.
34
+ - [ ] Adaptive-relevant hardcoded spacing/sizing values are tokenized.
35
+ - [ ] Touch-target policy is satisfied in touch contexts (minimum 44px where actionable).
36
+ - [ ] Reduced-motion behavior is respected for adaptive transitions.
37
+
38
+ ### D. Accessibility and interaction
39
+
40
+ - [ ] Keyboard paths remain valid after mode transitions.
41
+ - [ ] ARIA roles/attributes remain correct after adaptive morphing.
42
+ - [ ] Focus management and focus return behavior are defined for overlays/morphs.
43
+
44
+ ### E. Testing and validation
45
+
46
+ - [ ] Viewport matrix includes: 390x844, 844x390, 768x1024, 1024x768, 1280x720, 1920x1080.
47
+ - [ ] P0 assertions pass in all profiles.
48
+ - [ ] P1 assertions pass in all profiles.
49
+ - [ ] P2 assertions pass for controls where touch/visual ergonomics are central.
50
+ - [ ] No new console errors during mode/orientation transitions.
51
+
52
+ ### F. Documentation and delivery
53
+
54
+ - [ ] Control docs updated with adaptive mode behavior.
55
+ - [ ] PR includes before/after screenshots for required profiles.
56
+ - [ ] PR notes include known limitations and follow-ups.
57
+
58
+ ## 8.2 Master_Detail Checklist
59
+
60
+ ### Required behavior
61
+
62
+ - [ ] Desktop: dual-pane (master + detail) default.
63
+ - [ ] Tablet portrait: detail can be inline or overlay per resolved presentation mode.
64
+ - [ ] Phone: list-first flow with detail in sheet/full detail panel pattern.
65
+
66
+ ### State and composition
67
+
68
+ - [ ] `selected_id` remains domain state in `data.model`.
69
+ - [ ] `detail_presentation` is resolved in `view.data.model`.
70
+ - [ ] `detail_open` is transient in `view.model`.
71
+ - [ ] Mode transition preserves selected item.
72
+
73
+ ### Interaction and a11y
74
+
75
+ - [ ] Selecting master item updates detail in all modes.
76
+ - [ ] Keyboard selection (Enter/Space) remains valid after morph.
77
+ - [ ] Overlay detail has focus containment and proper close return target.
78
+
79
+ ### Test-specific
80
+
81
+ - [ ] No horizontal overflow in phone profiles.
82
+ - [ ] Selection-change event contract remains stable.
83
+
84
+ ## 8.3 Split_Pane Checklist
85
+
86
+ ### Required behavior
87
+
88
+ - [ ] Desktop pointer mode: split + resize handle behavior retained.
89
+ - [ ] Phone mode: no tiny drag-handle dependency (stack/toggle behavior used).
90
+ - [ ] Tablet behavior follows defined portrait/landscape policy.
91
+
92
+ ### State and composition
93
+
94
+ - [ ] `split_enabled` and orientation policy live in `view.data.model`.
95
+ - [ ] Live ratio and active pane state are `view.model` (session-level).
96
+ - [ ] Domain model remains device-agnostic.
97
+
98
+ ### Interaction and a11y
99
+
100
+ - [ ] Pointer-only resize paths are gated by interaction mode.
101
+ - [ ] Keyboard accessibility remains valid for pane switching controls.
102
+ - [ ] Focus order is stable across orientation and mode changes.
103
+
104
+ ### Test-specific
105
+
106
+ - [ ] Desktop drag resize min/max bounds still pass.
107
+ - [ ] Phone profile has a usable pane-switch affordance.
108
+
109
+ ## 8.4 Tabbed_Panel Checklist
110
+
111
+ ### Required behavior
112
+
113
+ - [ ] Narrow profiles use defined overflow strategy (`scroll`, `fit`, or `overflow_menu`).
114
+ - [ ] Active tab remains visible/selectable in all profiles.
115
+ - [ ] Desktop behavior remains functionally equivalent to prior baseline.
116
+
117
+ ### State and composition
118
+
119
+ - [ ] Tab content definitions remain domain-side.
120
+ - [ ] `tab_layout` is resolved in `view.data.model`.
121
+ - [ ] Active tab and overflow menu open state are in `view.model`.
122
+
123
+ ### Interaction and a11y
124
+
125
+ - [ ] Arrow/Home/End keyboard semantics preserved in all supported layouts.
126
+ - [ ] `aria-selected` and control linkage attributes remain correct post-transition.
127
+ - [ ] Focus behavior is deterministic when overflow menu opens/closes.
128
+
129
+ ### Test-specific
130
+
131
+ - [ ] Mode transitions do not break tab/page pairing.
132
+ - [ ] Touch target policy passes for tab labels in touch profiles.
133
+
134
+ ## 8.5 Data_Table Checklist
135
+
136
+ ### Required behavior
137
+
138
+ - [ ] Desktop: full grid mode with existing advanced interactions retained.
139
+ - [ ] Tablet: reduced/prioritized column mode.
140
+ - [ ] Phone: card/list representation with access to secondary fields.
141
+
142
+ ### State and composition
143
+
144
+ - [ ] Row data/filter/sort/selection remain in domain model structures.
145
+ - [ ] `table_mode` and `visible_columns` resolved in `view.data.model`.
146
+ - [ ] Expanded-row and transient interaction state remains in `view.model`.
147
+
148
+ ### Interaction and a11y
149
+
150
+ - [ ] Selection semantics remain consistent across mode changes.
151
+ - [ ] Keyboard navigation remains valid in grid modes.
152
+ - [ ] Pointer-only features (for example column drag resize) are correctly gated.
153
+
154
+ ### Test-specific
155
+
156
+ - [ ] Switching between table modes preserves selected row identity.
157
+ - [ ] No data-loss in presentation transitions (grid ⇄ card/list).
158
+ - [ ] Performance and rendering remain acceptable for representative row counts.
159
+
160
+ ## 8.6 Generic Tier 1 PR Template
161
+
162
+ Use this template for any Tier 1 adaptive control PR.
163
+
164
+ Repository shortcut:
165
+
166
+ - `.github/pull_request_template_adaptive_tier1.md`
167
+
168
+ ```md
169
+ # Adaptive Upgrade: <Control_Name>
170
+
171
+ ## Summary
172
+ - Control: <Control_Name>
173
+ - Tier: Tier 1
174
+ - Scope: <brief summary>
175
+
176
+ ## Book Alignment
177
+ - Four-layer impact: <A/B/C/D>
178
+ - Model placement:
179
+ - data.model: <...>
180
+ - view.data.model: <...>
181
+ - view.model: <...>
182
+ - Composition approach: <CSS-only | JS-composition | hybrid>
183
+
184
+ ## Behavior by Mode
185
+ - Phone: <...>
186
+ - Tablet: <...>
187
+ - Desktop: <...>
188
+
189
+ ## Implementation Notes
190
+ - Shared adaptive utilities used: <...>
191
+ - Compatibility notes: <...>
192
+ - Known tradeoffs: <...>
193
+
194
+ ## Testing
195
+ - Viewport profiles covered: 390x844, 844x390, 768x1024, 1024x768, 1280x720, 1920x1080
196
+ - P0 status: <pass/fail>
197
+ - P1 status: <pass/fail>
198
+ - P2 status: <pass/fail>
199
+ - Console error check: <clean/issues>
200
+
201
+ ## Evidence
202
+ - Screenshots: <paths>
203
+ - Test files: <paths>
204
+
205
+ ## Checklist
206
+ - [ ] Shared Tier 1 gate complete
207
+ - [ ] Control-specific gate complete
208
+ - [ ] Docs updated
209
+ ```
210
+
211
+ ## 8.7 Control-Specific PR Template Add-ons
212
+
213
+ Append one of these blocks to the generic template.
214
+
215
+ ### Master_Detail add-on
216
+
217
+ ```md
218
+ ## Master_Detail Specific Checks
219
+ - [ ] Selection persistence across mode transitions
220
+ - [ ] Detail presentation policy implemented (inline/overlay/sheet)
221
+ - [ ] Keyboard select behavior validated in all modes
222
+ ```
223
+
224
+ ### Split_Pane add-on
225
+
226
+ ```md
227
+ ## Split_Pane Specific Checks
228
+ - [ ] Touch mode disables tiny-handle dependency
229
+ - [ ] Desktop resize path unchanged and validated
230
+ - [ ] Orientation and pane focus order validated
231
+ ```
232
+
233
+ ### Tabbed_Panel add-on
234
+
235
+ ```md
236
+ ## Tabbed_Panel Specific Checks
237
+ - [ ] Overflow strategy implemented and validated
238
+ - [ ] ARIA and keyboard behavior intact after layout changes
239
+ - [ ] Active tab visibility guaranteed in narrow profiles
240
+ ```
241
+
242
+ ### Data_Table add-on
243
+
244
+ ```md
245
+ ## Data_Table Specific Checks
246
+ - [ ] Grid/tablet/card-list mode family implemented
247
+ - [ ] Visible column policy resolved by mode
248
+ - [ ] Selection and sort/filter consistency across mode changes validated
249
+ ```
250
+
251
+ ## 8.8 Reviewer Fast-Path Checklist
252
+
253
+ For rapid review, reviewers can verify in this order:
254
+
255
+ 1. State placement sanity (`data.model` vs view models)
256
+ 2. Mode behavior correctness (phone/tablet/desktop)
257
+ 3. Keyboard/ARIA integrity
258
+ 4. Viewport matrix evidence and pass status
259
+ 5. Desktop regression risk and screenshot evidence
260
+
261
+ If all five checks are green, the PR is generally safe to merge.
@@ -0,0 +1,66 @@
1
+ # Adaptive Control Improvements for jsgui3-html
2
+
3
+ This book is a companion to the existing device-adaptive composition book.
4
+
5
+ - Foundation principles: `docs/books/device-adaptive-composition/`
6
+ - This book: concrete control and platform improvements to implement those principles across the current control catalog.
7
+
8
+ ## Why This Book
9
+
10
+ The existing adaptive book defines architecture, model boundaries, styling strategy, and rollout phases.
11
+ What it intentionally does not do in depth is provide a control-by-control implementation playbook.
12
+
13
+ This book fills that gap by answering:
14
+
15
+ 1. Which controls should be upgraded first and why
16
+ 2. What specific changes each control needs in composition, state placement, styling, and interaction
17
+ 3. Which cross-cutting platform functions should be added to reduce repeated code
18
+ 4. What test matrix and quality gates are required before rollout
19
+
20
+ ## Scope
21
+
22
+ Primary focus:
23
+
24
+ - Large layout and shell controls
25
+ - Navigation controls with mobile/orientation impacts
26
+ - Data-dense controls that need structural adaptation
27
+ - Cross-cutting adaptive utilities and token updates
28
+
29
+ Secondary focus:
30
+
31
+ - Utility controls with strong phone/tablet behavior implications
32
+
33
+ Out of scope:
34
+
35
+ - Rewriting stable atomic controls that already adapt via tokens
36
+ - Visual redesigns unrelated to adaptive behavior
37
+
38
+ ## Core Alignment (from Device-Adaptive Composition Book)
39
+
40
+ This book explicitly applies:
41
+
42
+ - Chapter 2: Four-layer model (A/B/C/D)
43
+ - Chapter 3: adaptive state in view models, not domain model
44
+ - Chapter 4: mode attributes and token overrides
45
+ - Chapter 6: environment service + adaptive composition helper patterns
46
+ - Chapter 7: viewport-matrix quality gates
47
+ - Chapter 8: phased rollout
48
+
49
+ ## Reading Order
50
+
51
+ 1. `01-control-candidate-matrix.md`
52
+ 2. `02-tier-1-layout-playbooks.md`
53
+ 3. `03-tier-2-navigation-form-overlay.md`
54
+ 4. `04-cross-cutting-platform-functionality.md`
55
+ 5. `05-styling-theming-density-upgrades.md`
56
+ 6. `06-testing-quality-gates.md`
57
+ 7. `07-delivery-roadmap-and-ownership.md`
58
+ 8. `08-appendix-tier1-acceptance-and-pr-templates.md`
59
+
60
+ ## Quick Start (Implementers)
61
+
62
+ 1. Build cross-cutting infrastructure from Chapter 4 first.
63
+ 2. Upgrade Tier 1 controls from Chapter 2 in priority order.
64
+ 3. Add/extend responsive tests from Chapter 6 as each control ships.
65
+ 4. Move through Tier 2 playbooks from Chapter 3.
66
+ 5. Track delivery against Chapter 7 ownership and milestones.
@@ -0,0 +1,124 @@
1
+ # Chapter 1 — Threat Model and Goals
2
+
3
+ ## Why this chapter first
4
+
5
+ Authentication design becomes expensive when started too late. The Admin UI already has telemetry endpoints and an SSE channel, so this chapter defines what we are protecting and what can wait.
6
+
7
+ ## Assets to protect
8
+
9
+ For jsgui3-server admin surfaces, primary assets are:
10
+
11
+ 1. **Control-plane actions**
12
+ - starting/stopping resources
13
+ - changing runtime config
14
+ - registering/removing routes
15
+ 2. **Sensitive observability data**
16
+ - host/process metadata
17
+ - route inventories
18
+ - internal resource names and states
19
+ 3. **Availability**
20
+ - preventing abuse of SSE streams and expensive endpoints
21
+
22
+ ## Threat model (practical)
23
+
24
+ ### External attacker
25
+ - Can probe `/admin` and `/api/admin/*` endpoints.
26
+ - Tries default credentials, weak tokens, replay, or unauthenticated access.
27
+
28
+ ### Internal but unauthorized user
29
+ - Has network access but should not have admin privileges.
30
+ - Attempts to read diagnostic state or execute write actions.
31
+
32
+ ### Session theft and browser attacks
33
+ - Cookie theft, CSRF, XSS-assisted token misuse.
34
+ - Stale sessions after role changes.
35
+
36
+ ### Operational mistakes
37
+ - Admin endpoint exposed publicly by accident.
38
+ - Weak defaults in non-production become production behavior.
39
+
40
+ ## Security goals
41
+
42
+ ### G1: Default deny for admin APIs
43
+ - Any `/api/admin/*` endpoint should require auth by default.
44
+ - Explicit allow-list only for bootstrapping/health if needed.
45
+
46
+ ### G2: Separate read and write permissions
47
+ - Read-only operators should access telemetry.
48
+ - Mutating operations require stronger roles.
49
+
50
+ ### G3: Short-lived, revocable sessions
51
+ - Session invalidation should take effect quickly.
52
+ - SSE clients must be disconnected when auth is revoked.
53
+
54
+ ### G4: Browser-safe auth transport
55
+ - Prefer secure, httpOnly cookies for web-admin sessions.
56
+ - Apply CSRF protection for state-changing endpoints.
57
+
58
+ ### G5: Deployment-safe defaults
59
+ - Clear behavior in dev vs production.
60
+ - Explicit configuration for trusted origins and cookie policy.
61
+
62
+ ## Non-goals for first implementation phase
63
+
64
+ To keep delivery realistic, v1 auth does **not** need:
65
+
66
+ - Multi-tenant federation (SAML/OIDC enterprise SSO) on day one.
67
+ - Fine-grained per-resource ACL matrices.
68
+ - Full audit analytics UI before basic enforcement exists.
69
+
70
+ ## Phased implementation plan
71
+
72
+ ### Phase A — Guard rails (immediate)
73
+ - Keep admin UI read-only while auth is incomplete.
74
+ - Avoid adding new mutation endpoints.
75
+ - Document intended privileged operations.
76
+
77
+ ### Phase B — Baseline authentication
78
+ - Add login/logout endpoint pair.
79
+ - Add session issuance + validation middleware.
80
+ - Require auth for all `/api/admin/v1/*` and `/admin/v1`.
81
+
82
+ ### Phase C — Authorization and hardening
83
+ - Introduce roles: `admin_read`, `admin_write`.
84
+ - Add CSRF for write paths.
85
+ - Add rate limiting and SSE connection caps.
86
+
87
+ ### Phase D — Operational maturity
88
+ - Session revocation, inactivity expiry, and rotation.
89
+ - Structured security/audit logs.
90
+ - Runbook for emergency lockout and credential reset.
91
+
92
+ ## Design constraints from current codebase
93
+
94
+ Given existing server patterns:
95
+
96
+ - Admin routes are registered through router adapters.
97
+ - SSE is already used for live events.
98
+ - The current v1 UI is telemetry-first and can remain read-only safely.
99
+
100
+ This means we can adopt auth incrementally without blocking current UI progress.
101
+
102
+ ## Decision points (to finalize in next chapter)
103
+
104
+ 1. Session storage model: in-memory vs Redis-backed.
105
+ 2. Credential source: static bootstrap admin vs user store resource.
106
+ 3. Cookie strategy: strict same-site policy for local-only admin vs configurable for reverse proxies.
107
+ 4. Role model shape: two-role minimal model vs extensible claims model.
108
+
109
+ ## Selected v1 decisions (current)
110
+
111
+ The following decisions are now selected for v1 implementation:
112
+
113
+ 1. **Session storage model:** in-memory sessions.
114
+ 2. **Credential source:** user resource/store (not env-bootstrap only).
115
+ 3. **Protection scope:** protect both `/admin/v1` and `/api/admin/v1/*` immediately.
116
+
117
+ These choices keep the first auth rollout simple while still enforcing an end-to-end protected admin surface.
118
+
119
+ ## Exit criteria for this chapter
120
+
121
+ Before coding auth middleware, agree on:
122
+ - which endpoints require `admin_read` vs `admin_write`,
123
+ - session lifecycle requirements,
124
+ - dev/prod default policy matrix.
@@ -0,0 +1,75 @@
1
+ # Chapter 2 — Session Model and Token Model (v1 Decision)
2
+
3
+ ## Chosen model for v1
4
+
5
+ This project uses **stateful in-memory sessions** for admin authentication in v1.
6
+
7
+ ### Why this model now
8
+
9
+ - Fastest path to safe protection of `/admin/v1` and `/api/admin/v1/*`.
10
+ - Works with existing single-process server setup.
11
+ - Easy to reason about and debug while auth surface stabilizes.
12
+
13
+ ### Trade-offs
14
+
15
+ - Sessions are lost on server restart.
16
+ - Not suitable for multi-instance horizontal scaling without shared storage.
17
+ - Requires follow-up for production HA (Phase D).
18
+
19
+ ## Session shape
20
+
21
+ A session record contains:
22
+
23
+ - `session_id`
24
+ - `user` (`username`, `roles`)
25
+ - `created_at`
26
+ - `expires_at`
27
+
28
+ Cookie name: `jsgui_admin_v1_sid`
29
+
30
+ Cookie policy (v1):
31
+
32
+ - `HttpOnly`
33
+ - `SameSite=Lax`
34
+ - `Path=/`
35
+ - `Secure` enabled in production mode
36
+
37
+ ## User credential source (v1)
38
+
39
+ Credentials are validated against an **in-process user store resource-like service**.
40
+
41
+ - Primary bootstrap path: `ADMIN_V1_USER` + `ADMIN_V1_PASSWORD`.
42
+ - Development fallback (non-production only): `admin/admin`.
43
+ - Production without explicit password keeps login disabled until configured.
44
+
45
+ ## Endpoint policy
46
+
47
+ Public endpoints:
48
+
49
+ - `POST /api/admin/v1/auth/login`
50
+ - `POST /api/admin/v1/auth/logout`
51
+ - `GET /api/admin/v1/auth/session`
52
+ - `GET /admin/v1/login`
53
+
54
+ Protected endpoints:
55
+
56
+ - `GET /admin/v1`
57
+ - `GET /api/admin/v1/status`
58
+ - `GET /api/admin/v1/resources`
59
+ - `GET /api/admin/v1/routes`
60
+ - `GET /api/admin/v1/events`
61
+
62
+ ## Request flow
63
+
64
+ 1. Browser requests `/admin/v1`.
65
+ 2. If unauthenticated, server redirects to `/admin/v1/login`.
66
+ 3. Login form posts credentials to `/api/admin/v1/auth/login`.
67
+ 4. Server validates credentials and issues session cookie.
68
+ 5. Browser returns to `/admin/v1` and can access protected APIs.
69
+
70
+ ## Planned evolution (post-v1)
71
+
72
+ - Move session store to Redis or equivalent shared backing store.
73
+ - Add idle timeout refresh strategy.
74
+ - Add session revocation events and forced SSE disconnect.
75
+ - Add CSRF protections for write endpoints before mutation APIs launch.