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,210 @@
1
+ # Chapter 12: Admin Shell Layout, Sidebar, & Navigation
2
+
3
+ ## Overview
4
+
5
+ The Admin Shell (`admin-ui/v1/controls/admin_shell.js`) is the root control for Admin UI v1. It is implemented as a jsgui3 control-first composition with no direct `document.querySelector(...)`, `innerHTML`, or manual DOM node construction for shell navigation/rendering.
6
+
7
+ The shell provides:
8
+
9
+ - Toolbar with page title and SSE connection dot.
10
+ - Sidebar navigation for built-in and custom sections.
11
+ - Main content area with a dashboard section and a dynamic section.
12
+ - Status bar text updates.
13
+ - Responsive interactions (hamburger + overlay + phone tab bar).
14
+
15
+ ## Implemented Shell Structure
16
+
17
+ The shell composes these top-level regions:
18
+
19
+ - `.as-sidebar`
20
+ - `.as-main`
21
+ - `.as-toolbar`
22
+ - `.as-content`
23
+ - `.as-section-dashboard`
24
+ - `.as-section-dynamic`
25
+ - `.as-statusbar`
26
+ - `.as-sidebar-overlay`
27
+ - `.as-bottom-bar`
28
+
29
+ The default active section is `dashboard`.
30
+
31
+ ## Control-First Navigation Model
32
+
33
+ The implementation tracks interactive controls explicitly:
34
+
35
+ - `this._nav_items` for sidebar items.
36
+ - `this._tab_items` for phone tab items.
37
+ - `this._section_labels` for section title lookup.
38
+
39
+ Each nav/tab item is a jsgui control with click handlers attached via `control.on('click', ...)`.
40
+
41
+ ```javascript
42
+ _add_nav_item(nav, label, id, active, options = {}) {
43
+ const item = new controls.div({
44
+ context: this.context,
45
+ class: 'as-nav-item' + (active ? ' active' : '')
46
+ });
47
+
48
+ item.dom.attributes['data-section'] = id;
49
+ item.add((options.icon ? options.icon + ' ' : '') + label);
50
+ nav.add(item);
51
+
52
+ this._nav_items.push({
53
+ id,
54
+ label: options.title || label,
55
+ control: item,
56
+ is_custom: !!options.is_custom
57
+ });
58
+
59
+ item.on('click', () => {
60
+ this._activate_section_from_nav(id, options.title || label);
61
+ });
62
+
63
+ return item;
64
+ }
65
+ ```
66
+
67
+ ## Section Routing
68
+
69
+ Section routing is handled by `_select_section(section_id)`.
70
+
71
+ - `dashboard` shows dashboard section and hides dynamic section.
72
+ - `resources`, `routes`, `settings` show dynamic section and render data panels.
73
+ - `custom:*` routes to custom section renderer.
74
+
75
+ ```javascript
76
+ _select_section(section) {
77
+ this._active_section = section;
78
+
79
+ if (section === 'dashboard') {
80
+ this._dashboard_section.remove_class('hidden');
81
+ this._dynamic_section.add_class('hidden');
82
+ this._set_status_text('Dashboard view');
83
+ return Promise.resolve();
84
+ }
85
+
86
+ this._dashboard_section.add_class('hidden');
87
+ this._dynamic_section.remove_class('hidden');
88
+
89
+ if (section === 'resources') return this._render_resources_section();
90
+ if (section === 'routes') return this._render_routes_section();
91
+ if (section === 'settings') return this._render_settings_section();
92
+ if (section.startsWith('custom:')) {
93
+ const custom_id = section.substring(7);
94
+ const custom_section = this._custom_sections_list.find((s) => s.id === custom_id);
95
+ if (custom_section) return this._render_custom_section(custom_section);
96
+ }
97
+
98
+ return Promise.resolve();
99
+ }
100
+ ```
101
+
102
+ ## Dynamic Content Rendering
103
+
104
+ Dynamic section rendering uses jsgui controls rather than HTML strings.
105
+
106
+ Helper builders:
107
+
108
+ - `_create_panel(title)`
109
+ - `_create_table_panel(title, column_names, rows_data)`
110
+ - `_create_kv_row(key_text, value_text)`
111
+
112
+ Read-only built-in sections:
113
+
114
+ - `Resources` (`GET /api/admin/v1/resources`)
115
+ - `Routes` (`GET /api/admin/v1/routes`)
116
+ - `Settings` (`GET /api/admin/v1/status`)
117
+
118
+ Each section supports:
119
+
120
+ - Loading state (`_render_loading(...)`)
121
+ - Empty state (`_render_empty(...)`)
122
+ - Error state with interactive retry button (`_render_error(...)`)
123
+
124
+ ## Custom Section Lifecycle
125
+
126
+ Custom sections are loaded from:
127
+
128
+ - `GET /api/admin/v1/custom-sections`
129
+
130
+ Behavior:
131
+
132
+ 1. Existing custom nav items are removed.
133
+ 2. A separator (`.as-nav-separator`) is ensured.
134
+ 3. New custom nav controls are appended.
135
+ 4. Clicking a custom nav item clears phone tab active state and routes to `custom:<id>`.
136
+
137
+ This refresh behavior avoids duplicate nav entries after repeated metadata fetches.
138
+
139
+ ## Responsive Interaction Pattern
140
+
141
+ The shell supports responsive navigation modes:
142
+
143
+ - Sidebar/hamburger/overlay for tablet and phone widths.
144
+ - Bottom tab bar for phone sections (`dashboard`, `resources`, `routes`, `settings`).
145
+
146
+ Key methods:
147
+
148
+ - `_toggle_sidebar()`
149
+ - `_close_sidebar()`
150
+ - `_set_active_nav(section_id)`
151
+ - `_set_active_tab(section_id)`
152
+
153
+ Layout mode is stored on the body as `data-layout-mode` (`desktop`, `tablet`, `phone`) via `_update_layout_mode()`.
154
+
155
+ ## Activation and SSE Lifecycle
156
+
157
+ Activation is idempotent:
158
+
159
+ - `super.activate()` runs once (jsgui core active state)
160
+ - shell startup logic runs once via `_client_bootstrapped`
161
+
162
+ Startup steps:
163
+
164
+ 1. Resolve layout mode and bind `window.resize` listener.
165
+ 2. Fetch initial status (`/api/admin/v1/status`).
166
+ 3. Connect SSE (`/api/admin/v1/events`).
167
+ 4. Load custom sections.
168
+
169
+ SSE behavior:
170
+
171
+ - `open`: status dot becomes online, status text updated.
172
+ - `heartbeat`: updates cards and last-update timestamp.
173
+ - `error`: status dot offline, reconnect scheduled with backoff (`1s` doubling up to `30s`).
174
+
175
+ ## Route and Publisher Wiring
176
+
177
+ Admin UI v1 is served on:
178
+
179
+ - `/admin/v1` (UI)
180
+ - `/api/admin/v1/*` (auth-protected admin APIs)
181
+
182
+ The shell is bundled from:
183
+
184
+ - `admin-ui/v1/client.js` (entry point)
185
+ - `admin-ui/v1/controls/admin_shell.js` (root control)
186
+
187
+ ## Current File Layout (Implemented)
188
+
189
+ ```text
190
+ admin-ui/v1/
191
+ ├── client.js
192
+ ├── server.js
193
+ ├── admin_auth_service.js
194
+ ├── admin_user_store.js
195
+ ├── controls/
196
+ │ ├── admin_shell.js
197
+ │ ├── group_box.js
198
+ │ └── stat_card.js
199
+ └── utils/
200
+ └── formatters.js
201
+ ```
202
+
203
+ ## Verification Checklist
204
+
205
+ - Sidebar and tab clicks update active state and page title.
206
+ - Dynamic section renders loading/error/empty/data states.
207
+ - Retry and logout buttons are interactive controls.
208
+ - Custom section refresh does not duplicate nav items.
209
+ - SSE open/error/heartbeat transitions are handled.
210
+ - No direct DOM selection/string patching in shell navigation/render pipeline.