jsgui3-server 0.0.145 → 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.
- package/docs/jsgui3-sass-patterns-book/01-vision-and-goals.md +31 -0
- package/docs/jsgui3-sass-patterns-book/02-stack-map.md +40 -0
- package/docs/jsgui3-sass-patterns-book/03-control-local-sass.md +60 -0
- package/docs/jsgui3-sass-patterns-book/04-extension-and-variants.md +76 -0
- package/docs/jsgui3-sass-patterns-book/05-theming-and-tokens.md +54 -0
- package/docs/jsgui3-sass-patterns-book/06-workspace-overrides.md +45 -0
- package/docs/jsgui3-sass-patterns-book/07-resource-and-bundling.md +46 -0
- package/docs/jsgui3-sass-patterns-book/08-examples.md +62 -0
- package/docs/jsgui3-sass-patterns-book/09-testing-and-adoption.md +27 -0
- package/docs/jsgui3-sass-patterns-book/README.md +23 -0
- package/docs/troubleshooting.md +44 -4
- package/examples/controls/14) window, canvas/client.js +1 -1
- package/examples/controls/14b) window, canvas (improved renderer)/client.js +1 -1
- package/examples/controls/14d) window, canvas globe/client.js +1 -1
- package/examples/controls/14e) window, canvas multithreaded/client.js +1 -1
- package/examples/controls/14f) window, canvas polyglobe/client.js +1 -1
- package/examples/controls/16) window, form container/client.js +254 -0
- package/examples/controls/16) window, form container/server.js +20 -0
- package/examples/controls/17) window, mvvm binding/client.js +530 -0
- package/examples/controls/17) window, mvvm binding/server.js +20 -0
- package/package.json +3 -3
- package/resources/processors/bundlers/js/esbuild/Core_JS_Non_Minifying_Bundler_Using_ESBuild.js +87 -100
- package/resources/processors/bundlers/js/esbuild/Core_JS_Single_File_Minifying_Bundler_Using_ESBuild.js +89 -60
- package/tests/README.md +45 -9
- package/tests/bundlers.test.js +53 -47
- package/tests/examples-controls.e2e.test.js +3 -1
- package/tests/sass-controls.e2e.test.js +123 -9
|
@@ -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`.
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
# Small examples
|
|
2
|
+
|
|
3
|
+
These examples are minimal and focus on how Sass can be placed near controls, extended, and overridden per server.
|
|
4
|
+
|
|
5
|
+
## Example 1: control-local Sass
|
|
6
|
+
|
|
7
|
+
```javascript
|
|
8
|
+
class Toast_Notice extends Control {
|
|
9
|
+
constructor(spec = {}) {
|
|
10
|
+
spec.__type_name = spec.__type_name || 'toast_notice';
|
|
11
|
+
super(spec);
|
|
12
|
+
this.add_class('toast-notice');
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
Toast_Notice.scss = `
|
|
17
|
+
.toast-notice {
|
|
18
|
+
background: var(--theme-surface, #1f1f1f);
|
|
19
|
+
color: var(--theme-on-surface, #ffffff);
|
|
20
|
+
padding: 8px 12px;
|
|
21
|
+
}
|
|
22
|
+
`;
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## Example 2: extending a control with new Sass
|
|
26
|
+
|
|
27
|
+
```javascript
|
|
28
|
+
class Window_Compact extends Window {
|
|
29
|
+
constructor(spec = {}) {
|
|
30
|
+
spec.__type_name = spec.__type_name || 'window_compact';
|
|
31
|
+
super(spec);
|
|
32
|
+
this.add_class('window-compact');
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
Window_Compact.scss = `
|
|
37
|
+
.window-compact .title-bar {
|
|
38
|
+
font-size: 0.85em;
|
|
39
|
+
}
|
|
40
|
+
`;
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
## Example 3: workspace override via server config
|
|
44
|
+
|
|
45
|
+
```javascript
|
|
46
|
+
Server.serve({
|
|
47
|
+
Ctrl: Demo_UI,
|
|
48
|
+
style: {
|
|
49
|
+
load_paths: ['styles/themes'],
|
|
50
|
+
scss_sources: [
|
|
51
|
+
"@use 'obsidian_theme' as *;",
|
|
52
|
+
":root { --theme-surface: $obsidian_surface; }"
|
|
53
|
+
]
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
## Where to implement
|
|
59
|
+
|
|
60
|
+
- Control-local Sass: `jsgui3-html` control files or app-specific controls.
|
|
61
|
+
- Workspace overrides: `jsgui3-server` configuration for the host app.
|
|
62
|
+
- Theme tokens: a theme package consumed via `load_paths`.
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# Testing and adoption plan
|
|
2
|
+
|
|
3
|
+
This chapter proposes how to validate Sass behavior and phase it into new workspaces.
|
|
4
|
+
|
|
5
|
+
## Testing suggestions
|
|
6
|
+
|
|
7
|
+
- Add control-level Sass tests to confirm extraction order and compilation.
|
|
8
|
+
- Add theme override tests that validate token overrides in bundled CSS.
|
|
9
|
+
- Add sourcemap tests when a single compilation pass is used.
|
|
10
|
+
|
|
11
|
+
Relevant test locations:
|
|
12
|
+
|
|
13
|
+
- `tests/sass-controls.e2e.test.js`
|
|
14
|
+
- `tests/bundlers.test.js`
|
|
15
|
+
|
|
16
|
+
## Incremental adoption plan
|
|
17
|
+
|
|
18
|
+
1. Define token vocabulary in `jsgui3-html` control CSS.
|
|
19
|
+
2. Introduce a theme package with token overrides.
|
|
20
|
+
3. Add server-level `scss_sources` for the theme in examples.
|
|
21
|
+
4. Expand theme package usage in additional workspaces.
|
|
22
|
+
|
|
23
|
+
## Where to implement
|
|
24
|
+
|
|
25
|
+
- Test coverage: `jsgui3-server/tests`.
|
|
26
|
+
- Token vocabulary: `jsgui3-html` controls and docs.
|
|
27
|
+
- Theme package: new repo, consumed via `style.load_paths`.
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# JSGUI3 Sass Patterns Book
|
|
2
|
+
|
|
3
|
+
This book is a set of proposals for how Sass and CSS can be used across the JSGUI3 stack. It focuses on co-locating styles with controls, supporting project-wide theming, and allowing workspace-level overrides without losing default styles.
|
|
4
|
+
|
|
5
|
+
The intent is to document patterns and where they could be implemented, not to prescribe a single build system. Each chapter includes a short "Where to implement" section that points at the relevant layer.
|
|
6
|
+
|
|
7
|
+
## Table of contents
|
|
8
|
+
|
|
9
|
+
1. Vision and goals - `01-vision-and-goals.md`
|
|
10
|
+
2. Stack map - `02-stack-map.md`
|
|
11
|
+
3. Control-local Sass patterns - `03-control-local-sass.md`
|
|
12
|
+
4. Extending controls and variants - `04-extension-and-variants.md`
|
|
13
|
+
5. Theme tokens and runtime theming - `05-theming-and-tokens.md`
|
|
14
|
+
6. Workspace overrides and shared themes - `06-workspace-overrides.md`
|
|
15
|
+
7. Resource pipeline and bundling - `07-resource-and-bundling.md`
|
|
16
|
+
8. Small examples - `08-examples.md`
|
|
17
|
+
9. Testing and adoption plan - `09-testing-and-adoption.md`
|
|
18
|
+
|
|
19
|
+
## Scope notes
|
|
20
|
+
|
|
21
|
+
- These are implementation suggestions that build on existing JSGUI3 behavior.
|
|
22
|
+
- The Sass compiler is already in use in the server pipeline, so patterns lean on that capability.
|
|
23
|
+
- Examples are minimal and designed to be adapted into other workspaces.
|
package/docs/troubleshooting.md
CHANGED
|
@@ -743,8 +743,48 @@ controls.MinimalControl = MinimalControl;
|
|
|
743
743
|
module.exports = jsgui;
|
|
744
744
|
```
|
|
745
745
|
|
|
746
|
-
This minimal setup helps isolate whether the issue is with your specific code or the framework itself.
|
|
747
|
-
|
|
748
|
-
---
|
|
749
|
-
|
|
746
|
+
This minimal setup helps isolate whether the issue is with your specific code or the framework itself.
|
|
747
|
+
|
|
748
|
+
---
|
|
749
|
+
|
|
750
|
+
## Bundling and Test Failures
|
|
751
|
+
|
|
752
|
+
### `waiting for wp_publisher ready` or Publisher Ready Timeout
|
|
753
|
+
|
|
754
|
+
**Symptoms:**
|
|
755
|
+
- Tests hang while starting servers
|
|
756
|
+
- Logs show `waiting for wp_publisher ready`
|
|
757
|
+
- Tests time out without a clear stack trace
|
|
758
|
+
|
|
759
|
+
**Likely cause:** the JS/CSS bundler failed before emitting `ready`.
|
|
760
|
+
|
|
761
|
+
**What to check:**
|
|
762
|
+
1. Look earlier in the log for bundler errors (esbuild, Sass, file resolution).
|
|
763
|
+
2. Confirm `sass` is installed if you are running Sass tests.
|
|
764
|
+
3. Validate the client entry path passed to `src_path_client_js`.
|
|
765
|
+
|
|
766
|
+
### esbuild platform mismatch (Windows vs WSL)
|
|
767
|
+
|
|
768
|
+
**Symptoms:**
|
|
769
|
+
- Error: `You installed esbuild for another platform than the one you're currently using`
|
|
770
|
+
|
|
771
|
+
**Cause:** `node_modules` was installed on a different OS and reused in this environment.
|
|
772
|
+
|
|
773
|
+
**Fix:**
|
|
774
|
+
1. Remove the existing `node_modules` from the current workspace.
|
|
775
|
+
2. Reinstall dependencies in the current environment:
|
|
776
|
+
```bash
|
|
777
|
+
npm install
|
|
778
|
+
```
|
|
779
|
+
3. If you prefer to keep the lockfile untouched, use:
|
|
780
|
+
```bash
|
|
781
|
+
npm ci
|
|
782
|
+
```
|
|
783
|
+
4. As a fast workaround, you can try:
|
|
784
|
+
```bash
|
|
785
|
+
npm rebuild esbuild
|
|
786
|
+
```
|
|
787
|
+
|
|
788
|
+
---
|
|
789
|
+
|
|
750
790
|
Remember: Most issues can be resolved by carefully checking the console output, verifying file paths, and ensuring proper control lifecycle management. Start with the basics and work systematically through the possible causes.
|
|
@@ -515,7 +515,7 @@ class Demo_UI extends Active_HTML_Document {
|
|
|
515
515
|
});
|
|
516
516
|
windowCtrl.size = [1000, 1000];
|
|
517
517
|
|
|
518
|
-
const canvas = new controls.
|
|
518
|
+
const canvas = new controls.Canvas({ context });
|
|
519
519
|
canvas.dom.attributes.id = 'globeCanvas';
|
|
520
520
|
canvas.size = [900, 900];
|
|
521
521
|
|