jsgui3-server 0.0.144 → 0.0.146

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 (71) hide show
  1. package/docs/jsgui3-html-improvement-ideas.md +162 -0
  2. package/docs/jsgui3-html-improvement-ideas.svg +151 -0
  3. package/docs/jsgui3-sass-patterns-book/01-vision-and-goals.md +31 -0
  4. package/docs/jsgui3-sass-patterns-book/02-stack-map.md +40 -0
  5. package/docs/jsgui3-sass-patterns-book/03-control-local-sass.md +60 -0
  6. package/docs/jsgui3-sass-patterns-book/04-extension-and-variants.md +76 -0
  7. package/docs/jsgui3-sass-patterns-book/05-theming-and-tokens.md +54 -0
  8. package/docs/jsgui3-sass-patterns-book/06-workspace-overrides.md +45 -0
  9. package/docs/jsgui3-sass-patterns-book/07-resource-and-bundling.md +46 -0
  10. package/docs/jsgui3-sass-patterns-book/08-examples.md +62 -0
  11. package/docs/jsgui3-sass-patterns-book/09-testing-and-adoption.md +27 -0
  12. package/docs/jsgui3-sass-patterns-book/README.md +23 -0
  13. package/docs/troubleshooting.md +44 -4
  14. package/examples/controls/14) window, canvas/client.js +1 -1
  15. package/examples/controls/14b) window, canvas (improved renderer)/client.js +1 -1
  16. package/examples/controls/14d) window, canvas globe/EarthGlobeRenderer.js +19 -14
  17. package/examples/controls/14d) window, canvas globe/client.js +1 -1
  18. package/examples/controls/14d) window, canvas globe/pipeline/TransformStage.js +5 -5
  19. package/examples/controls/14e) window, canvas multithreaded/client.js +1 -1
  20. package/examples/controls/14f) window, canvas polyglobe/client.js +1 -1
  21. package/examples/controls/16) window, form container/client.js +254 -0
  22. package/examples/controls/16) window, form container/server.js +20 -0
  23. package/examples/controls/17) window, mvvm binding/client.js +530 -0
  24. package/examples/controls/17) window, mvvm binding/server.js +20 -0
  25. package/examples/jsgui3-html/01) mvvm-counter/client.js +648 -0
  26. package/examples/jsgui3-html/01) mvvm-counter/server.js +21 -0
  27. package/examples/jsgui3-html/02) date-transform/client.js +764 -0
  28. package/examples/jsgui3-html/02) date-transform/server.js +21 -0
  29. package/examples/jsgui3-html/03) form-validation/client.js +1045 -0
  30. package/examples/jsgui3-html/03) form-validation/server.js +21 -0
  31. package/examples/jsgui3-html/04) data-grid/client.js +738 -0
  32. package/examples/jsgui3-html/04) data-grid/server.js +21 -0
  33. package/examples/jsgui3-html/05) master-detail/client.js +649 -0
  34. package/examples/jsgui3-html/05) master-detail/server.js +21 -0
  35. package/examples/jsgui3-html/06) theming/client.js +514 -0
  36. package/examples/jsgui3-html/06) theming/server.js +21 -0
  37. package/examples/jsgui3-html/07) mixins/client.js +465 -0
  38. package/examples/jsgui3-html/07) mixins/server.js +21 -0
  39. package/examples/jsgui3-html/08) router/client.js +372 -0
  40. package/examples/jsgui3-html/08) router/server.js +21 -0
  41. package/examples/jsgui3-html/09) resource-transform/client.js +692 -0
  42. package/examples/jsgui3-html/09) resource-transform/server.js +21 -0
  43. package/examples/jsgui3-html/10) binding-debugger/client.js +810 -0
  44. package/examples/jsgui3-html/10) binding-debugger/server.js +21 -0
  45. package/examples/jsgui3-html/README.md +48 -0
  46. package/http/responders/static/Static_Route_HTTP_Responder.js +25 -20
  47. package/package.json +3 -3
  48. package/publishers/http-webpageorsite-publisher.js +3 -1
  49. package/resources/processors/bundlers/js/esbuild/Core_JS_Non_Minifying_Bundler_Using_ESBuild.js +87 -100
  50. package/resources/processors/bundlers/js/esbuild/Core_JS_Single_File_Minifying_Bundler_Using_ESBuild.js +89 -60
  51. package/serve-factory.js +12 -5
  52. package/server.js +103 -85
  53. package/tests/README.md +52 -9
  54. package/tests/bundlers.test.js +53 -47
  55. package/tests/end-to-end.test.js +336 -365
  56. package/tests/examples-controls.e2e.test.js +15 -1
  57. package/tests/fixtures/end-to-end-client.js +54 -0
  58. package/tests/fixtures/jsgui3-html/binding_debugger_expectations.json +15 -0
  59. package/tests/fixtures/jsgui3-html/counter_expectations.json +31 -0
  60. package/tests/fixtures/jsgui3-html/data_grid_expectations.json +26 -0
  61. package/tests/fixtures/jsgui3-html/date_transform_expectations.json +26 -0
  62. package/tests/fixtures/jsgui3-html/form_validation_expectations.json +27 -0
  63. package/tests/fixtures/jsgui3-html/master_detail_expectations.json +15 -0
  64. package/tests/fixtures/jsgui3-html/mixins_expectations.json +10 -0
  65. package/tests/fixtures/jsgui3-html/resource_transform_expectations.json +11 -0
  66. package/tests/fixtures/jsgui3-html/router_expectations.json +10 -0
  67. package/tests/fixtures/jsgui3-html/theming_expectations.json +10 -0
  68. package/tests/jsgui3-html-examples.puppeteer.test.js +537 -0
  69. package/tests/sass-controls.e2e.test.js +123 -9
  70. package/tests/test-runner.js +1 -0
  71. package/tests/window-examples.puppeteer.test.js +217 -1
@@ -0,0 +1,162 @@
1
+ # JSGUI3-HTML Improvement Ideas
2
+
3
+ This document outlines improvement opportunities for `jsgui3-html` controls based on inspecting the current control catalog under `node_modules/jsgui3-html/controls`.
4
+
5
+ ## Control Inventory Snapshot (Observed)
6
+
7
+ Source: `node_modules/jsgui3-html/controls/controls.js` and `controls/organised/*`.
8
+
9
+ ### Core (0-core)
10
+
11
+ - 0-basic / 0-native-compositional
12
+ - button, checkbox, date-picker, dropdown-list, file-upload, icon, radio-button, Select_Options, Text_Input
13
+ - 0-basic / 1-compositional
14
+ - calendar, combo-box, context-menu, color-grid, color-palette, grid, list, scroll-view, scrollbar
15
+ - item, item-selector, menu-node, month-view, text-item, Text_Field
16
+ - toggle-button, plus-minus-toggle-button, radio-button-group, timespan-selector
17
+ - status indicators: Indicator, Status_Indicator, Validation_Status_Indicator
18
+ - 0-core / 1-advanced
19
+ - Canvas, login, popup-menu-button, string-span
20
+
21
+ ### Standard (1-standard)
22
+
23
+ - 0-viewer
24
+ - array, object, object-kvp, number, string
25
+ - 1-editor
26
+ - form_field / FormField, PropertyEditor / property_editor, Rich_Text_Editor
27
+ - array/object/number/string editors
28
+ - 2-misc
29
+ - left-right-arrows-selector, up-down-arrow-buttons
30
+ - 3-page
31
+ - standard-web-page, message-web-page
32
+ - 4-data
33
+ - data-item, data-row, data-filter
34
+ - 5-ui
35
+ - tree, tree-node, file-tree, file-tree-node
36
+ - toolbar, toolbox, horizontal-menu, horizontal-slider
37
+ - line-chart, search-bar, audio-volume, media-scrubber
38
+ - 6-layout
39
+ - panel, titled-panel, title-bar, window, modal
40
+ - tabbed-panel, tile-slide, vertical-expander, single-line
41
+ - app/multi-layout-mode
42
+
43
+ ### Showcase (2-showcase)
44
+
45
+ - icon-library
46
+
47
+ ### Notes / Legacy
48
+
49
+ - `controls/connected/data-grid.js` exists but is commented out in `controls.js`.
50
+ - `controls/old/*` contains historical controls (item, item-view).
51
+ - `controls/swaps/notes.md` references progressive enhancement and swapping native controls.
52
+ - Naming duplication: `FormField.js` vs `form_field.js`, `PropertyEditor.js` vs `property_editor.js`.
53
+
54
+ ## Improvement Themes
55
+
56
+ ### 1) Add Missing Core Controls
57
+
58
+ These should be small, reliable building blocks with strong HTML parity and predictable activation.
59
+
60
+ - Textarea
61
+ - Password, email, url, tel inputs
62
+ - Number input with stepper (native + stylized)
63
+ - Range slider (native) + stepped slider
64
+ - Progress bar, meter
65
+ - Switch/toggle (native checkbox + styled)
66
+ - Chip/tag input
67
+ - Inline validation message control
68
+ - Breadcrumbs, pagination
69
+ - Tooltip/popover
70
+ - Notification/toast, alert banner
71
+ - Badge/pill
72
+
73
+ ### 2) Data & Collection Controls
74
+
75
+ The existing data controls are minimal; add richer, reusable data views.
76
+
77
+ - Data table with sorting, filtering, pagination
78
+ - Virtualized list/grid for large datasets
79
+ - Tree-table hybrid (folders with columns)
80
+ - List reordering (drag-and-drop)
81
+ - Master/detail split view
82
+ - Data grid should reconnect to `controls/connected/data-grid.js` with a modern API
83
+
84
+ ### 3) Layout + Navigation Expansion
85
+
86
+ The layout set is strong but missing higher-level patterns.
87
+
88
+ - Split pane / resizable panes
89
+ - Accordion / collapsible sections
90
+ - Sidebar + responsive drawer
91
+ - Tab variants (vertical, icon tabs, overflow)
92
+ - Stepper / wizard layout
93
+ - Layout primitives: stack, cluster, center, grid-with-gap
94
+
95
+ ### 4) Form & Editor Features
96
+
97
+ Existing editors need feature depth, validation, and accessibility.
98
+
99
+ - Form container with built-in validation routing
100
+ - Field-level error display + status badges
101
+ - Input masking (date, currency, phone)
102
+ - Autosize text field / textarea
103
+ - Rich text editor improvements: toolbar, markdown, paste sanitization
104
+ - Object editor: expand/collapse, add/remove key-values, schema-driven rendering
105
+
106
+ ### 5) Feature Depth for Existing Controls
107
+
108
+ Concrete enhancements based on a quick control scan:
109
+
110
+ - Checkbox: fix `el_radio` typo in change handler, add `checked` sync, keyboard focus state
111
+ - Date picker: add min/max, locale formatting, keyboard navigation, week start configuration
112
+ - Dropdown/list/combobox: async options, filtering, typeahead, ARIA roles
113
+ - Window/panel: snap, dock, maximize, z-index management, resize handles
114
+ - Tree/file tree: lazy loading, multi-select, drag reparent, keyboard navigation
115
+ - Scrollbar/scroll-view: horizontal + vertical sync, scroll inertia
116
+
117
+ ### 6) Accessibility + Semantics
118
+
119
+ - Standardize ARIA roles, labels, and keyboard handling
120
+ - Focus ring consistency and tab order control
121
+ - High contrast mode + reduced motion theme
122
+ - Screen reader text for icon-only buttons
123
+
124
+ ### 7) Theming + Styling System
125
+
126
+ - Token-driven theme layer (color, spacing, radius, typography)
127
+ - Control style overrides via theme context
128
+ - Light/dark/system themes with CSS variables
129
+ - CSS layering: base, component, utility
130
+ - Improve `swaps` approach for progressive enhancement of native elements
131
+
132
+ ### 8) Consistency + Packaging
133
+
134
+ - Normalize naming and case conventions in control filenames
135
+ - Reduce duplicate editor components (FormField vs form_field)
136
+ - Clarify which controls are core vs showcase
137
+ - Provide explicit exports for stable public API
138
+
139
+ ## Suggested Roadmap
140
+
141
+ ### Phase 1: Core and Reliability
142
+
143
+ - Add missing native inputs (textarea, number, range)
144
+ - Fix known control bugs (checkbox `el_radio` reference)
145
+ - Normalize control naming duplication
146
+ - Basic accessibility pass across core controls
147
+
148
+ ### Phase 2: Data + Forms
149
+
150
+ - Data table + virtualized list
151
+ - Form container + validation hooks
152
+ - Object editor improvements
153
+
154
+ ### Phase 3: Layout + UX Features
155
+
156
+ - Split panes, accordion, responsive drawer
157
+ - Enhanced window management
158
+ - Theme system and style tokens
159
+
160
+ ## Visual Summary
161
+
162
+ See `docs/jsgui3-html-improvement-ideas.svg` for an Industrial Luxury Obsidian themed diagram of these ideas.
@@ -0,0 +1,151 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" width="1600" height="1000" viewBox="0 0 1600 1000" role="img" aria-label="JSGUI3-HTML improvement ideas diagram">
2
+ <defs>
3
+ <linearGradient id="bg_grad" x1="0" y1="0" x2="1" y2="1">
4
+ <stop offset="0%" stop-color="#0a0b0e" />
5
+ <stop offset="45%" stop-color="#101419" />
6
+ <stop offset="100%" stop-color="#141a20" />
7
+ </linearGradient>
8
+ <radialGradient id="highlight_grad" cx="70%" cy="20%" r="60%">
9
+ <stop offset="0%" stop-color="#2a2f36" stop-opacity="0.7" />
10
+ <stop offset="70%" stop-color="#0a0b0e" stop-opacity="0" />
11
+ </radialGradient>
12
+ <linearGradient id="gold_grad" x1="0" y1="0" x2="1" y2="0">
13
+ <stop offset="0%" stop-color="#8f7a3c" />
14
+ <stop offset="50%" stop-color="#d2b86a" />
15
+ <stop offset="100%" stop-color="#8f7a3c" />
16
+ </linearGradient>
17
+ <linearGradient id="steel_grad" x1="0" y1="0" x2="0" y2="1">
18
+ <stop offset="0%" stop-color="#1b2127" />
19
+ <stop offset="100%" stop-color="#11151a" />
20
+ </linearGradient>
21
+ <pattern id="grid_pattern" width="40" height="40" patternUnits="userSpaceOnUse">
22
+ <path d="M 40 0 L 0 0 0 40" fill="none" stroke="#1a2026" stroke-width="1" />
23
+ </pattern>
24
+ <filter id="soft_glow" x="-50%" y="-50%" width="200%" height="200%">
25
+ <feDropShadow dx="0" dy="0" stdDeviation="6" flood-color="#c9b26b" flood-opacity="0.4" />
26
+ </filter>
27
+ <filter id="panel_shadow" x="-50%" y="-50%" width="200%" height="200%">
28
+ <feDropShadow dx="0" dy="4" stdDeviation="10" flood-color="#000000" flood-opacity="0.6" />
29
+ </filter>
30
+ </defs>
31
+
32
+ <rect width="1600" height="1000" fill="url(#bg_grad)" />
33
+ <rect width="1600" height="1000" fill="url(#grid_pattern)" opacity="0.35" />
34
+ <rect width="1600" height="1000" fill="url(#highlight_grad)" />
35
+
36
+ <!-- Obsidian shards -->
37
+ <polygon points="120,80 360,40 420,140 180,210" fill="#0e1217" opacity="0.9" />
38
+ <polygon points="1320,90 1540,60 1580,200 1360,240" fill="#0e1217" opacity="0.85" />
39
+ <polygon points="420,820 640,760 720,900 480,950" fill="#0d1116" opacity="0.9" />
40
+ <polygon points="1080,760 1360,700 1460,860 1160,930" fill="#0d1116" opacity="0.85" />
41
+
42
+ <!-- Decorative gold rails -->
43
+ <path d="M 80 120 L 1520 120" stroke="url(#gold_grad)" stroke-width="2" opacity="0.7" />
44
+ <path d="M 80 900 L 1520 900" stroke="url(#gold_grad)" stroke-width="2" opacity="0.6" />
45
+ <path d="M 140 150 L 140 870" stroke="#3a3220" stroke-width="1" opacity="0.5" />
46
+ <path d="M 1460 150 L 1460 870" stroke="#3a3220" stroke-width="1" opacity="0.5" />
47
+
48
+ <!-- Title -->
49
+ <text x="120" y="95" fill="#e5d6a2" font-size="36" font-family="Trebuchet MS, Arial, sans-serif" letter-spacing="2">
50
+ JSGUI3-HTML IMPROVEMENT MAP
51
+ </text>
52
+ <text x="120" y="125" fill="#9aa1a8" font-size="16" font-family="Trebuchet MS, Arial, sans-serif" letter-spacing="1">
53
+ Industrial Luxury Obsidian theme | Control Expansion + Feature Depth
54
+ </text>
55
+
56
+ <!-- Central crest -->
57
+ <circle cx="800" cy="500" r="120" fill="url(#steel_grad)" stroke="url(#gold_grad)" stroke-width="3" filter="url(#soft_glow)" />
58
+ <circle cx="800" cy="500" r="90" fill="#0f141a" stroke="#2c3138" stroke-width="2" />
59
+ <text x="800" y="485" fill="#e5d6a2" font-size="22" font-family="Trebuchet MS, Arial, sans-serif" text-anchor="middle">
60
+ CONTROL SYSTEMS
61
+ </text>
62
+ <text x="800" y="515" fill="#9aa1a8" font-size="14" font-family="Trebuchet MS, Arial, sans-serif" text-anchor="middle">
63
+ themes | behavior | data
64
+ </text>
65
+
66
+ <!-- Panels -->
67
+ <g filter="url(#panel_shadow)">
68
+ <rect x="120" y="180" width="560" height="220" rx="18" fill="#11161c" stroke="#2c333b" stroke-width="2" />
69
+ <rect x="920" y="180" width="560" height="220" rx="18" fill="#11161c" stroke="#2c333b" stroke-width="2" />
70
+ <rect x="120" y="430" width="560" height="220" rx="18" fill="#11161c" stroke="#2c333b" stroke-width="2" />
71
+ <rect x="920" y="430" width="560" height="220" rx="18" fill="#11161c" stroke="#2c333b" stroke-width="2" />
72
+ <rect x="120" y="680" width="560" height="200" rx="18" fill="#11161c" stroke="#2c333b" stroke-width="2" />
73
+ <rect x="920" y="680" width="560" height="200" rx="18" fill="#11161c" stroke="#2c333b" stroke-width="2" />
74
+ </g>
75
+
76
+ <!-- Panel headings -->
77
+ <text x="160" y="220" fill="#e5d6a2" font-size="20" font-family="Trebuchet MS, Arial, sans-serif" letter-spacing="1">
78
+ CORE CONTROL EXPANSION
79
+ </text>
80
+ <text x="960" y="220" fill="#e5d6a2" font-size="20" font-family="Trebuchet MS, Arial, sans-serif" letter-spacing="1">
81
+ FORM AND EDITOR DEPTH
82
+ </text>
83
+ <text x="160" y="470" fill="#e5d6a2" font-size="20" font-family="Trebuchet MS, Arial, sans-serif" letter-spacing="1">
84
+ DATA AND COLLECTION
85
+ </text>
86
+ <text x="960" y="470" fill="#e5d6a2" font-size="20" font-family="Trebuchet MS, Arial, sans-serif" letter-spacing="1">
87
+ LAYOUT AND NAVIGATION
88
+ </text>
89
+ <text x="160" y="720" fill="#e5d6a2" font-size="20" font-family="Trebuchet MS, Arial, sans-serif" letter-spacing="1">
90
+ ACCESSIBILITY AND THEME
91
+ </text>
92
+ <text x="960" y="720" fill="#e5d6a2" font-size="20" font-family="Trebuchet MS, Arial, sans-serif" letter-spacing="1">
93
+ INFRA AND DX
94
+ </text>
95
+
96
+ <!-- Panel bullets -->
97
+ <g fill="#c3c8ce" font-size="14" font-family="Trebuchet MS, Arial, sans-serif">
98
+ <text x="160" y="252">- textarea, number, range, progress, meter</text>
99
+ <text x="160" y="274">- switch, badge, tooltip, toast, breadcrumb</text>
100
+ <text x="160" y="296">- chip input, pagination, notification banner</text>
101
+ <text x="160" y="318">- standard icon buttons and input masks</text>
102
+
103
+ <text x="960" y="252">- form container + validation hooks</text>
104
+ <text x="960" y="274">- field error display and status badges</text>
105
+ <text x="960" y="296">- object editor schema rendering</text>
106
+ <text x="960" y="318">- rich text toolbar + paste sanitization</text>
107
+
108
+ <text x="160" y="502">- data table with sort, filter, paginate</text>
109
+ <text x="160" y="524">- virtual list/grid for large data</text>
110
+ <text x="160" y="546">- tree-table hybrid + lazy load</text>
111
+ <text x="160" y="568">- reconnect modern data grid module</text>
112
+
113
+ <text x="960" y="502">- split panes + resizable layout</text>
114
+ <text x="960" y="524">- accordion, drawer, wizard stepper</text>
115
+ <text x="960" y="546">- tab variants + overflow handling</text>
116
+ <text x="960" y="568">- window snap, dock, z-order</text>
117
+
118
+ <text x="160" y="752">- ARIA roles and focus management</text>
119
+ <text x="160" y="774">- keyboard navigation standards</text>
120
+ <text x="160" y="796">- theming tokens + CSS variables</text>
121
+ <text x="160" y="818">- high contrast + reduced motion</text>
122
+
123
+ <text x="960" y="752">- normalize duplicate control names</text>
124
+ <text x="960" y="774">- stable public API surface</text>
125
+ <text x="960" y="796">- test harnesses + visual regressions</text>
126
+ <text x="960" y="818">- structured docs and sample gallery</text>
127
+ </g>
128
+
129
+ <!-- Connectors -->
130
+ <g stroke="#3b3f46" stroke-width="1" opacity="0.7">
131
+ <line x1="680" y1="290" x2="720" y2="410" />
132
+ <line x1="920" y1="290" x2="880" y2="410" />
133
+ <line x1="680" y1="540" x2="720" y2="540" />
134
+ <line x1="920" y1="540" x2="880" y2="540" />
135
+ <line x1="680" y1="790" x2="720" y2="600" />
136
+ <line x1="920" y1="790" x2="880" y2="600" />
137
+ </g>
138
+
139
+ <!-- Gold accents -->
140
+ <g stroke="url(#gold_grad)" stroke-width="2" opacity="0.8">
141
+ <line x1="120" y1="410" x2="680" y2="410" />
142
+ <line x1="920" y1="410" x2="1480" y2="410" />
143
+ <line x1="120" y1="660" x2="680" y2="660" />
144
+ <line x1="920" y1="660" x2="1480" y2="660" />
145
+ </g>
146
+
147
+ <!-- Footer note -->
148
+ <text x="120" y="950" fill="#7f8790" font-size="13" font-family="Trebuchet MS, Arial, sans-serif">
149
+ Diagram companion to docs/jsgui3-html-improvement-ideas.md
150
+ </text>
151
+ </svg>
@@ -0,0 +1,31 @@
1
+ # Vision and goals
2
+
3
+ This chapter frames the goals for Sass in JSGUI3 and the tradeoffs that shape the patterns in later chapters.
4
+
5
+ ## Goals
6
+
7
+ - Co-locate styles with controls so behavior and styling evolve together.
8
+ - Allow controls to be extended with additional Sass or CSS without editing upstream repos.
9
+ - Support project-wide theming that can override defaults across multiple workspaces.
10
+ - Keep the style pipeline deterministic, with predictable ordering and output.
11
+ - Enable server-specific styling for examples, demos, or host apps.
12
+
13
+ ## Non-goals
14
+
15
+ - No single theming system must be enforced for all projects.
16
+ - No requirement to use Sass for every control; plain CSS should remain first-class.
17
+ - No requirement to change the client runtime to parse Sass at runtime.
18
+
19
+ ## Suggested outcomes
20
+
21
+ - A shared pattern for control-local Sass, with explicit layering rules.
22
+ - A theme token vocabulary for controls, backed by CSS variables.
23
+ - Workspace-level overrides that can be injected ahead of or after control styles.
24
+ - A consistent way to configure Sass load paths and shared sources.
25
+
26
+ ## Where to implement
27
+
28
+ - Control-local styles: `jsgui3-html` control classes.
29
+ - Theme tokens: `jsgui3-html` theme mixins, plus server-provided defaults.
30
+ - Workspace overrides: `jsgui3-server` style configuration and bundlers.
31
+ - Docs and examples: `jsgui3-server/examples` and `jsgui3-html/docs`.
@@ -0,0 +1,40 @@
1
+ # Stack map
2
+
3
+ This map shows how styles flow through the JSGUI3 stack today and where new patterns can attach.
4
+
5
+ ## Current flow (summary)
6
+
7
+ 1. Control classes can define static `css`, `scss`, or `sass` template literals.
8
+ 2. The server extracts style segments from the client bundle source.
9
+ 3. The style bundler compiles Sass and outputs a single CSS bundle.
10
+ 4. The CSS bundle is served via the website CSS resource.
11
+ 5. Controls apply theme tokens via CSS variables and `data-theme` attributes.
12
+
13
+ ## Key integration points
14
+
15
+ - Extraction and ordering
16
+ - `resources/processors/extractors/js/css_and_js/AST_Node/CSS_And_JS_From_JS_String_Using_AST_Node_Extractor.js`
17
+ - `style_segments` preserve per-control ordering as they appear in source files.
18
+
19
+ - Sass compilation and bundling
20
+ - `resources/processors/bundlers/style-bundler.js`
21
+ - `resources/processors/compilers/SASS_Compiler.js`
22
+
23
+ - CSS resource delivery
24
+ - `resources/website-css-resource.js`
25
+ - `resources/website-javascript-resource.js`
26
+
27
+ - Theme tokens
28
+ - `jsgui3-html/control_mixins/theme.js`
29
+
30
+ ## Suggested additions to the stack
31
+
32
+ - A theme registry module that can merge theme tokens from multiple packages.
33
+ - A style layering policy that is explicit about ordering (base, component, overrides).
34
+ - A workspace override registry that can be shared across servers.
35
+
36
+ ## Where to implement
37
+
38
+ - Theme registry: `jsgui3-html` or a new `jsgui3-theme` package.
39
+ - Style layering policy: `jsgui3-server` style bundler plus docs in `jsgui3-html`.
40
+ - Workspace override registry: `jsgui3-server` configuration with reusable defaults.
@@ -0,0 +1,60 @@
1
+ # Control-local Sass patterns
2
+
3
+ Control-local Sass keeps styles next to the control that owns them. The key is to scope selectors and define a predictable ordering that survives bundling.
4
+
5
+ ## Pattern: control-local style blocks
6
+
7
+ - Use `Control_Name.css` for immediate, small styles.
8
+ - Use `Control_Name.scss` for Sass variables, mixins, or nesting.
9
+ - Use `Control_Name.sass` when you prefer indented Sass syntax.
10
+ - Keep selectors scoped to a class or `data-jsgui-type` to avoid global collisions.
11
+
12
+ Example pattern (conceptual):
13
+
14
+ ```javascript
15
+ class Example_Control extends Control {
16
+ constructor(spec = {}) {
17
+ spec.__type_name = spec.__type_name || 'example_control';
18
+ super(spec);
19
+ this.add_class('example-control');
20
+ }
21
+ }
22
+
23
+ Example_Control.scss = `
24
+ $accent_color: #3355aa;
25
+ .example-control {
26
+ border: 1px solid $accent_color;
27
+ }
28
+ `;
29
+ ```
30
+
31
+ ## Pattern: explicit ordering
32
+
33
+ Ordering is preserved by the extraction pipeline when styles appear in source order. This makes it safe to stack `css`, `scss`, and `sass` in the same file as long as the intent is clear.
34
+
35
+ Suggested ordering inside a control file:
36
+
37
+ 1. `Control_Name.css` for base layout or reset
38
+ 2. `Control_Name.scss` for token-driven styles
39
+ 3. `Control_Name.sass` for optional variant overrides
40
+
41
+ ## Pattern: selector scoping
42
+
43
+ Preferred scoping approaches:
44
+
45
+ - `.control-class` on the root node
46
+ - `[data-jsgui-type="control_name"]` when the class is not reliable
47
+ - `.control-class .sub-part` for internal elements
48
+
49
+ Avoid styling generic tags without a parent scope.
50
+
51
+ ## Suggestions for improvement
52
+
53
+ - Add a documented style layering convention (base, component, override) and enforce it in examples.
54
+ - Add an optional `Control_Name.style_layers = [...]` API so the bundler can order styles even when code files are concatenated.
55
+
56
+ ## Where to implement
57
+
58
+ - Co-located styles: `jsgui3-html` control classes.
59
+ - Layering API: `jsgui3-server` extractor and style bundler.
60
+ - Documentation updates: `docs/controls-development.md` plus this book.
@@ -0,0 +1,76 @@
1
+ # Extending controls and variants
2
+
3
+ Extensions should allow new styles without editing upstream controls. The pattern is to subclass the base control, add a new CSS class, and attach Sass to the subclass.
4
+
5
+ ## Pattern: subclass with extra Sass
6
+
7
+ ```javascript
8
+ class Window_Tight extends Window {
9
+ constructor(spec = {}) {
10
+ spec.__type_name = spec.__type_name || 'window_tight';
11
+ super(spec);
12
+ this.add_class('window-tight');
13
+ }
14
+ }
15
+
16
+ Window_Tight.scss = `
17
+ .window-tight .title-bar {
18
+ padding: 4px 8px;
19
+ }
20
+ `;
21
+ ```
22
+
23
+ ## Pattern: variants with data attributes
24
+
25
+ A variant can be toggled by setting a data attribute in the control spec and using a scoped selector:
26
+
27
+ ```javascript
28
+ class Panel_Variant extends Panel {
29
+ constructor(spec = {}) {
30
+ spec.__type_name = spec.__type_name || 'panel_variant';
31
+ super(spec);
32
+ if (spec.variant) {
33
+ this.dom.attributes['data-variant'] = String(spec.variant);
34
+ }
35
+ }
36
+ }
37
+
38
+ Panel_Variant.scss = `
39
+ .panel[data-variant="compact"] {
40
+ gap: 6px;
41
+ }
42
+ `;
43
+ ```
44
+
45
+ ## Pattern: compositional wrappers
46
+
47
+ When subclassing is not practical, wrap the base control and style the wrapper.
48
+
49
+ ```javascript
50
+ class Window_Frame extends Control {
51
+ constructor(spec = {}) {
52
+ spec.__type_name = spec.__type_name || 'window_frame';
53
+ super(spec);
54
+ this.add_class('window-frame');
55
+ const window_ctrl = new Window({ context: this.context });
56
+ this.add(window_ctrl);
57
+ }
58
+ }
59
+
60
+ Window_Frame.scss = `
61
+ .window-frame {
62
+ padding: 8px;
63
+ }
64
+ `;
65
+ ```
66
+
67
+ ## Suggestions for improvement
68
+
69
+ - Add a documented override order for base control CSS versus subclass CSS.
70
+ - Add a style namespace helper to reduce selector duplication.
71
+
72
+ ## Where to implement
73
+
74
+ - Subclassing patterns: `jsgui3-html` controls and examples.
75
+ - Override ordering: `jsgui3-server` style bundler and extractor.
76
+ - Namespace helper: new mixin in `jsgui3-html/control_mixins`.
@@ -0,0 +1,54 @@
1
+ # Theme tokens and runtime theming
2
+
3
+ Theme tokens let controls share a common vocabulary for color, spacing, and typography. The current JSGUI3 theme mixin can set CSS variables and `data-theme` attributes, which makes CSS variable theming a natural fit.
4
+
5
+ ## Pattern: CSS variables as the public theme API
6
+
7
+ - Controls should use CSS variables for colors, spacing, radii, and font styles.
8
+ - Sass can define fallback values and combine tokens with calculations.
9
+ - The HTML output should include `data-theme` on a root node when a theme is active.
10
+
11
+ Example Sass pattern:
12
+
13
+ ```scss
14
+ .window {
15
+ background: var(--theme-surface, #ffffff);
16
+ color: var(--theme-text, #1b1b1b);
17
+ border-color: var(--theme-border, #c0c0c0);
18
+ }
19
+ ```
20
+
21
+ ## Pattern: theme token maps
22
+
23
+ Allow a theme to be provided as a token map:
24
+
25
+ ```javascript
26
+ const theme_tokens = {
27
+ surface: '#f7f7f7',
28
+ text: '#1f1f1f',
29
+ border: '#c7c7c7'
30
+ };
31
+
32
+ const window_ctrl = new Window({
33
+ context,
34
+ theme_tokens
35
+ });
36
+ ```
37
+
38
+ ## Suggested token layers
39
+
40
+ - Global tokens for the design system: `--theme-surface`, `--theme-text`, `--theme-border`.
41
+ - Component tokens for customization: `--window-title-bg`, `--window-title-text`.
42
+ - State tokens for validation or status: `--status-error`, `--status-success`.
43
+
44
+ ## Suggestions for improvement
45
+
46
+ - Publish a default token catalog in `jsgui3-html` so controls can rely on a stable set of names.
47
+ - Add a theme registry that merges tokens from multiple packages, with a final override layer from the host workspace.
48
+ - Define a `data-theme` selection policy at the document root to avoid per-control configuration.
49
+
50
+ ## Where to implement
51
+
52
+ - Token catalog and defaults: `jsgui3-html` control CSS and docs.
53
+ - Theme registry: a new `jsgui3-theme` package or a module in `jsgui3-html`.
54
+ - Workspace overrides: `jsgui3-server` config that injects token overrides before bundling.
@@ -0,0 +1,45 @@
1
+ # Workspace overrides and shared themes
2
+
3
+ Workspace overrides allow a server or host app to change the look of upstream controls without editing the upstream repo. The server style configuration already supports extra Sass sources and load paths.
4
+
5
+ ## Pattern: server-injected Sass sources
6
+
7
+ The server can inject shared Sass sources for a workspace:
8
+
9
+ ```javascript
10
+ Server.serve({
11
+ Ctrl: Demo_UI,
12
+ style: {
13
+ load_paths: ['styles', 'themes'],
14
+ scss_sources: ["@use 'theme_tokens';"],
15
+ sass_sources: []
16
+ }
17
+ });
18
+ ```
19
+
20
+ This pattern lets the workspace override tokens or provide mixins that are available to all control-local Sass.
21
+
22
+ ## Pattern: theme packages
23
+
24
+ Create a theme package that exports Sass partials and token maps. Suggested structure:
25
+
26
+ - `themes/<theme_name>/_tokens.scss`
27
+ - `themes/<theme_name>/_components.scss`
28
+ - `themes/<theme_name>/index.scss`
29
+
30
+ Then add the theme directory to `load_paths` and include it in `scss_sources`.
31
+
32
+ ## Pattern: host-specific CSS
33
+
34
+ Server-owned CSS can be appended or prepended to the bundle for host-specific layout or typography. This is useful for `examples/` and other demos.
35
+
36
+ ## Suggestions for improvement
37
+
38
+ - Add a `style.layers` configuration that defines ordering for base styles, theme styles, and overrides.
39
+ - Add a workspace theme manifest format (JSON or JS) that maps theme names to Sass entry points.
40
+
41
+ ## Where to implement
42
+
43
+ - Workspace injection: `jsgui3-server` style config passed into the bundler.
44
+ - Theme packages: separate repos that can be added to `load_paths`.
45
+ - Examples: `jsgui3-server/examples` with a `styles/` directory and `Demo_UI.scss` overrides.
@@ -0,0 +1,46 @@
1
+ # Resource pipeline and bundling
2
+
3
+ This chapter proposes ways to make the Sass pipeline predictable and extensible, while building on the current server resources.
4
+
5
+ ## Current entry points
6
+
7
+ - Style extraction: `resources/processors/extractors/js/css_and_js/AST_Node/CSS_And_JS_From_JS_String_Using_AST_Node_Extractor.js`
8
+ - Sass compilation: `resources/processors/bundlers/style-bundler.js`
9
+ - CSS resource: `resources/website-css-resource.js`
10
+ - JS resource: `resources/website-javascript-resource.js`
11
+
12
+ ## Pattern: deterministic ordering
13
+
14
+ The extractor already returns `style_segments` in source order. A suggested improvement is to make ordering explicit in the bundler with named layers:
15
+
16
+ - layer: `base`
17
+ - layer: `component`
18
+ - layer: `override`
19
+
20
+ This can be implemented by grouping `style_segments` before compilation.
21
+
22
+ ## Pattern: caching and invalidation
23
+
24
+ Suggested improvements for faster rebuilds:
25
+
26
+ - Cache compiled Sass output keyed by file hash and style config.
27
+ - Invalidate cache only when control source or theme sources change.
28
+ - Track `load_paths` and `scss_sources` in the cache key.
29
+
30
+ ## Pattern: sourcemap policy
31
+
32
+ The style config already supports sourcemaps, inline maps, and source content. A suggested policy is:
33
+
34
+ - Enable inline maps only when a single Sass compilation pass is used.
35
+ - Disable inline maps when mixing `.sass` and `.scss` to avoid inaccurate mappings.
36
+
37
+ ## Suggestions for improvement
38
+
39
+ - Add a public hook so other workspaces can provide a custom style bundler without forking the server.
40
+ - Add a `style.debug` flag to log the style pipeline steps in a consistent format.
41
+
42
+ ## Where to implement
43
+
44
+ - Layer ordering and caching: `resources/processors/bundlers/style-bundler.js`.
45
+ - Debug hooks: `resources/website-css-resource.js` and `resources/website-javascript-resource.js`.
46
+ - Custom bundler hook: server configuration and resource factory in `jsgui3-server`.