jsswift 1.0.54 → 2.0.0
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/AI.md +10 -2
- package/README.md +2 -2
- package/dist/css/animation.css +36 -36
- package/dist/css/base.css +374 -374
- package/dist/css/docs.css +54 -54
- package/dist/css/fonts-nunito.css +2 -2
- package/dist/css/min-ui.css +1 -1
- package/dist/css/responsive-base.css +549 -549
- package/dist/css/responsive.css +3225 -3225
- package/dist/css/ui-components.css +2902 -2930
- package/dist/css/ui-light.css +3853 -3881
- package/dist/css/ui-light.min.css +1 -1
- package/dist/css/ui.css +6530 -6558
- package/dist/css/ui.min.css +1 -1
- package/dist/documentions/AI.md +10 -2
- package/dist/documentions/README.md +1 -0
- package/dist/documentions/application-rules.md +2 -2
- package/dist/documentions/components/toolbar.md +1 -1
- package/dist/documentions/examples/crud.md +5 -3
- package/dist/documentions/getting-started.md +4 -0
- package/dist/documentions/knowledge-map.json +22 -1
- package/dist/documentions/ui/themes.md +39 -0
- package/dist/jsswift.js +5685 -12485
- package/dist/jsswift.min.js +12 -12
- package/dist/min-jsswift.js +12 -12
- package/package.json +2 -2
package/dist/documentions/AI.md
CHANGED
|
@@ -87,7 +87,9 @@ Dialog returns an API object, not a node to mount: `open(overrides?)`, `close()`
|
|
|
87
87
|
|
|
88
88
|
## Existing CSS and optional assets
|
|
89
89
|
|
|
90
|
-
|
|
90
|
+
CSS classes and theme variables use `jss-` (for example `--jss-primary`). Update old `cms-` overrides when upgrading; do not mix JS and CSS namespace versions.
|
|
91
|
+
|
|
92
|
+
The UI stylesheet includes component styles, theme variables, and responsive rules. Start with native components. Prefer documented `color`, `dense`, `padding`, `radius`, `shadow`, and breakpoint props to overrides of internal `.jss-*` classes. Read [common props](ui/common-props.md) only for an additional inherited prop; component-specific definitions take precedence. Use custom CSS for remaining page requirements.
|
|
91
93
|
|
|
92
94
|
For pages using component defaults and application-owned media queries, import `jsswift/css/ui-light.css` instead of `ui.css`. It retains base tokens, colors, `dense`/`outline`, layout and unprefixed sizing/spacing utilities. For `tablet`, `pc`/`desktop` or legacy breakpoint classes, additionally import `jsswift/css/responsive.css` **after** the light stylesheet. `ui.css` remains the complete compatible entry; do not import both full and light. The light entry keeps component-specific mobile rules and does not remove JavaScript props. `ui-light.min.css` is also available.
|
|
93
95
|
|
|
@@ -141,8 +143,14 @@ For taller catalogue fields, set the shared height variable on their application
|
|
|
141
143
|
|
|
142
144
|
```css
|
|
143
145
|
.catalogue-filters {
|
|
144
|
-
--
|
|
146
|
+
--jss-input-height-default: 40px;
|
|
145
147
|
}
|
|
146
148
|
```
|
|
147
149
|
|
|
148
150
|
Check the border, floating label, error message and keyboard focus at desktop and mobile sizes. A passing CRUD test does not verify these visual states. Keep failed server startup, retry incidents, cached input and uncached input separate when comparing repeated benchmark runs.
|
|
151
|
+
|
|
152
|
+
## Theme and lifecycle essentials
|
|
153
|
+
|
|
154
|
+
base.css is already included. Use `_.setTheme('dark')` or `_.setTheme('light')`; persistence defaults to `jsswift:theme`. At startup restore with `_.setTheme(_.getTheme())`. Customize the existing `--jss-primary-600`/`--jss-primary-700` palette values after the UI import. See [base CSS and themes](ui/themes.md) only for additional theme requirements.
|
|
155
|
+
|
|
156
|
+
Replace component subtrees with `_.mount(host, nextContent)` (default clear:true), which cleans up previous effects and subscriptions. Native `replaceChildren`/`innerHTML` alone do not run JSswift cleanup. Keep shared models owned by the application alive.
|
|
@@ -12,6 +12,7 @@ Build applications with JSswift by reading only the smallest focused guide. Exac
|
|
|
12
12
|
| State and controlled inputs | [reactivity.md](reactivity.md) |
|
|
13
13
|
| Layout and breakpoints | [ui/layout-and-responsive.md](ui/layout-and-responsive.md) |
|
|
14
14
|
| Forms | [ui/forms.md](ui/forms.md) |
|
|
15
|
+
| Base CSS, theme tokens and component colors | [ui/themes.md](ui/themes.md) |
|
|
15
16
|
| Router, store, HTTP, auth, themes | [platform.md](platform.md) |
|
|
16
17
|
| Tables, feedback, dialogs, menus | [ui/data-feedback-overlays.md](ui/data-feedback-overlays.md) |
|
|
17
18
|
| Exact component API | components/<component>.md only |
|
|
@@ -8,12 +8,12 @@ Open [components/README.md](components/README.md) to choose a family, then open
|
|
|
8
8
|
|
|
9
9
|
## Use the existing CSS first
|
|
10
10
|
|
|
11
|
-
Import `jsswift/css/ui.css` once. JSswift already supplies component styles, theme variables, and responsive layout rules. Start with the native appearance. Use documented props such as `color`, `dense`, `padding`, `radius`, `shadow`, and responsive overrides before writing custom CSS. Prefer theme variables from the installed stylesheet for shared colors and typography.
|
|
11
|
+
Import `jsswift/css/ui-light.css` once; add `responsive.css` for breakpoint props, or choose complete `ui.css`. JSswift already supplies component styles, theme variables, and responsive layout rules. Start with the native appearance. Use documented props such as `color`, `dense`, `padding`, `radius`, `shadow`, and responsive overrides before writing custom CSS. Prefer theme variables from the installed stylesheet for shared colors and typography.
|
|
12
12
|
|
|
13
13
|
Custom CSS is appropriate for page-specific visuals or requirements the documented props do not cover. Keep it scoped to application classes; avoid recreating buttons, fields, cards, table cells, pagination, or dialog internals. Read the exact component contract before choosing a prop.
|
|
14
14
|
|
|
15
15
|
## Keep discovery focused
|
|
16
16
|
|
|
17
|
-
Read
|
|
17
|
+
Read AI.md alone first. Use its supported subset directly; read a contract only for an API absent from that guide. Batch independent file reads; do not concatenate the whole catalog, extract it with Python, or search the framework source when the documented contract already answers the question. When a contract is missing or ambiguous, inspect only the relevant implementation and report the gap. Build after the first complete implementation, then correct concrete failures.
|
|
18
18
|
|
|
19
19
|
Run comparative benchmarks in an isolated workspace, with equivalent instructions for every stack.
|
|
@@ -27,7 +27,7 @@ Exact JSswift UI contract. Shared definitions listed in `commonProps` are in [co
|
|
|
27
27
|
"wrap": {"type": "boolean|string", "description": "Allows children to wrap to new lines.", "default": null, "values": null, "category": "general"},
|
|
28
28
|
"align": {"type": "stretch|flex-start|center|flex-end|baseline", "description": "Alignment of content along the cross axis (e.g. left/center/right).", "default": null, "values": ["left", "center", "right"], "category": "general"},
|
|
29
29
|
"justify": {"type": "flex-start|center|flex-end|space-between|space-around|space-evenly", "description": "Justification of items along the main axis.", "default": null, "values": ["start", "center", "end", "space-between", "space-around", "space-evenly"], "category": "general"},
|
|
30
|
-
"gap": {"type": "string|number (e.g. '8px' or 'var(--
|
|
30
|
+
"gap": {"type": "string|number (e.g. '8px' or 'var(--jss-s-md)')", "description": "Gap/spacing between child elements.", "default": null, "values": null, "category": "general"},
|
|
31
31
|
"beforeClass": {"type": "string", "description": "Component configuration for \"beforeClass\". When not handled internally, it is forwarded to the root element.", "default": null, "values": null, "category": "general"},
|
|
32
32
|
"startClass": {"type": "string", "description": "Component configuration for \"startClass\". When not handled internally, it is forwarded to the root element.", "default": null, "values": null, "category": "general"},
|
|
33
33
|
"bodyClass": {"type": "string", "description": "Component configuration for \"bodyClass\". When not handled internally, it is forwarded to the root element.", "default": null, "values": null, "category": "general"},
|
|
@@ -50,12 +50,12 @@ const filter = _.Select({label:'Filtro categoria',options:[{value:'',label:'Tutt
|
|
|
50
50
|
function render() {
|
|
51
51
|
const found = rows.filter(r => r.name.toLowerCase().includes(query.trim().toLowerCase()) && (!category || r.category === category));
|
|
52
52
|
const pages = Math.max(1,Math.ceil(found.length/5)); page = Math.min(page,pages);
|
|
53
|
-
|
|
53
|
+
_.mount(host, _.Table({rows:found.slice((page-1)*5,page*5),rowKey:'id',pagination:false,hideFooter:true,hideStatus:true,minTableWidth:600,emptyText:'Nessun prodotto trovato',
|
|
54
54
|
columns:[{key:'name',sortable:false,label:'Nome'},{key:'category',sortable:false,label:'Categoria'},{key:'price',sortable:false,label:'Prezzo',format:value => priceFormat.format(value)},{key:'quantity',sortable:false,label:'Quantità'},
|
|
55
55
|
{key:'actions',label:'Azioni',render:r => _.Button({id:`edit-${r.id}`,onClick:() => edit(r)},'Modifica')}] }));
|
|
56
|
-
|
|
56
|
+
_.mount(pager, [_.span(`${found.length} prodotti — pagina ${page}/${pages}`),
|
|
57
57
|
_.Button({id:'previous',disabled:page===1,onClick:() => {page--;render();document.getElementById('previous').focus();}},'Precedente'),
|
|
58
|
-
_.Button({id:'next',disabled:page===pages,onClick:() => {page++;render();document.getElementById('next').focus();}},'Successiva'));
|
|
58
|
+
_.Button({id:'next',disabled:page===pages,onClick:() => {page++;render();document.getElementById('next').focus();}},'Successiva')]);
|
|
59
59
|
}
|
|
60
60
|
_.mount('#app', _.div({style:{minWidth:0}}, add, search, filter, host, pager, notice)); render();
|
|
61
61
|
```
|
|
@@ -78,3 +78,5 @@ Build success alone does not verify this flow. In a browser, record these result
|
|
|
78
78
|
The example uses public field APIs and rod values. If a browser is unavailable, report these interactions as unverified rather than deriving them from pure-logic assertions.
|
|
79
79
|
|
|
80
80
|
Table supplies its own Card and empty state. This example disables column sorting because it supplies a page slice; sort the complete filtered data before slicing if global sorting is required. For dashboard counters prefer `_.Kpi({title, value, note})`. Preserve field input transparency and use the container height variable described in [AI guide](../AI.md#catalogue-surfaces-and-field-styling).
|
|
81
|
+
|
|
82
|
+
Lifecycle: `_.mount(host, nextContent)` clears the previous subtree through JSswift cleanup (default `clear:true`). Its returned function unmounts the new content. Use this for replacing component subtrees; native `replaceChildren`, `innerHTML` or `remove` alone do not invoke registered JSswift cleanup. Keep shared models alive until their application owner disposes them.
|
|
@@ -59,3 +59,7 @@ import 'jsswift/css/responsive.css';
|
|
|
59
59
|
```
|
|
60
60
|
|
|
61
61
|
The light entry includes base.css, animation.css, component styles and generated unprefixed utilities. It preserves color, dense, outline, tokens, base layout and component-specific mobile styles. Breakpoint props remain in JavaScript; their generated CSS requires the responsive addon. Load the addon after the light entry. Use either full CSS or light plus optional addon, not both full and light. Both new light exports also exist under `@jsswift/ui`. This changes application CSS size, not JavaScript or npm installation size.
|
|
62
|
+
|
|
63
|
+
## CSS namespace migration
|
|
64
|
+
|
|
65
|
+
Component classes, overlay IDs and CSS custom properties now use `jss-` instead of `cms-`, without compatibility aliases. Update application selectors and theme overrides together, for example `.jss-control` and `--jss-primary`. Component APIs and npm import paths remain unchanged. Rebuild JS and CSS together; do not mix runtimes and styles from different namespace versions. This is an intentionally incompatible CSS namespace change.
|
|
@@ -220,6 +220,27 @@
|
|
|
220
220
|
"paths": [
|
|
221
221
|
"examples/crud.md"
|
|
222
222
|
]
|
|
223
|
+
},
|
|
224
|
+
{
|
|
225
|
+
"id": "themes",
|
|
226
|
+
"title": "Base CSS, theme tokens and native component styling",
|
|
227
|
+
"keywords": [
|
|
228
|
+
"base.css",
|
|
229
|
+
"theme",
|
|
230
|
+
"themes",
|
|
231
|
+
"tema",
|
|
232
|
+
"color",
|
|
233
|
+
"colors",
|
|
234
|
+
"colori",
|
|
235
|
+
"palette",
|
|
236
|
+
"dark",
|
|
237
|
+
"light",
|
|
238
|
+
"outline",
|
|
239
|
+
"dense"
|
|
240
|
+
],
|
|
241
|
+
"paths": [
|
|
242
|
+
"ui/themes.md"
|
|
243
|
+
]
|
|
223
244
|
}
|
|
224
245
|
],
|
|
225
246
|
"components": [
|
|
@@ -983,5 +1004,5 @@
|
|
|
983
1004
|
"documentAliases": {
|
|
984
1005
|
"components/button.md": "components/btn.md"
|
|
985
1006
|
},
|
|
986
|
-
"packageVersion": "
|
|
1007
|
+
"packageVersion": "2.0.0"
|
|
987
1008
|
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
# Base CSS, themes and component props
|
|
2
|
+
|
|
3
|
+
Both ui.css and ui-light.css include base.css. Do not import base.css again. It supplies shared color scales, semantic theme variables, typography and component tokens. Light CSS omits breakpoint utilities, not the default theme or color/dense/outline props.
|
|
4
|
+
|
|
5
|
+
## Shared theme
|
|
6
|
+
|
|
7
|
+
```js
|
|
8
|
+
_.setTheme('light', {persist:false});
|
|
9
|
+
_.setTheme('dark');
|
|
10
|
+
_.toggleTheme(['light', 'dark']);
|
|
11
|
+
const current = _.getTheme();
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
setTheme writes data-theme on the document root and persists by default under jsswift:theme. Use persist:false for an ephemeral preview. Apply the restored value at startup with `_.setTheme(_.getTheme())`; theme helpers do not synthesize a palette for arbitrary theme names. base.css defines light and dark rules; custom themes need matching CSS.
|
|
15
|
+
|
|
16
|
+
For a brand color, override the existing scale after importing JSswift CSS:
|
|
17
|
+
|
|
18
|
+
```css
|
|
19
|
+
:root {
|
|
20
|
+
--jss-primary-600: #2563eb;
|
|
21
|
+
--jss-primary-700: #1d4ed8;
|
|
22
|
+
}
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
Semantic variables such as --jss-primary, --jss-primary-hover, --jss-bg and --jss-text connect the palette to components. Dark/brand selectors may override them; check computed values in each desired theme. Scope custom colors to an application container when they should not affect the whole page. Do not rename internal selectors to build a theme.
|
|
26
|
+
|
|
27
|
+
## Individual components
|
|
28
|
+
|
|
29
|
+
```js
|
|
30
|
+
_.Button({color:'primary', outline:true, dense:true}, 'Modifica');
|
|
31
|
+
_.Input({label:'Nome', radius:8});
|
|
32
|
+
_.Kpi({title:'Disponibili', value:9, note:'Con scorte', radius:12, shadow:'none'});
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
Use documented component props before custom CSS. dense is component-specific: do not assume every component supports it. A page background belongs to an application container; preserve the transparent native Input background and its surrounding control border. Props affect the component, whereas theme variables can affect every descendant.
|
|
36
|
+
|
|
37
|
+
## Verification
|
|
38
|
+
|
|
39
|
+
Check light/dark computed colors, border/focus/error states, and mobile dimensions. Measure contrast for text/background pairs, including disabled states where appropriate. A screenshot or a valid color token alone does not establish accessibility compliance.
|