jsswift 1.0.51 → 1.0.53
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 +14 -3
- package/dist/documentions/AI.md +14 -3
- package/dist/documentions/components/table.md +20 -1
- package/dist/documentions/examples/crud.md +14 -1
- package/dist/documentions/knowledge-map.json +1 -1
- package/dist/jsswift.js +328 -231
- package/dist/jsswift.min.js +3 -3
- package/dist/min-jsswift.js +3 -3
- package/package.json +1 -1
package/AI.md
CHANGED
|
@@ -10,6 +10,17 @@ If a required API is absent here, consult `knowledge-map.json` to find its exact
|
|
|
10
10
|
|
|
11
11
|
The installed package exposes this same guide as `AI.md` at its root and through `jsswift/AI.md`. `package.json` includes `jsswiftDocumentation` discovery paths. Do not inspect runtime bundles to discover documented APIs.
|
|
12
12
|
|
|
13
|
+
## Choose one starting route
|
|
14
|
+
|
|
15
|
+
| Task | First read | Stop condition |
|
|
16
|
+
| --- | --- | --- |
|
|
17
|
+
| Small page with the six components below | This guide | Implement the supported subset without opening component contracts. |
|
|
18
|
+
| Product CRUD with validation, persistence and focus | [CRUD example](examples/crud.md) | Reuse the example; do not also concatenate Input, Select, Dialog and Table contracts. |
|
|
19
|
+
| One missing prop or callback | Map → exact document, or selective MCP read | Read only the needed section; do not search the runtime bundle. |
|
|
20
|
+
| Custom appearance | Supported props below, then one relevant contract | Keep component styles; add CSS for page layout and task-specific visuals. |
|
|
21
|
+
|
|
22
|
+
The map locates a contract; it does not replace it. Avoid reading all of `ui/common-props.md` just to confirm examples already covered here. Structural helpers used below (`div`, `p`, `span`, `strong`) do not require a separate HTML/SVG guide. Read that guide only for additional helper behavior.
|
|
23
|
+
|
|
13
24
|
## Import, create, mount
|
|
14
25
|
|
|
15
26
|
Provide `<div id="app"></div>` in HTML and a module entrypoint. With Vite:
|
|
@@ -51,7 +62,7 @@ const table = _.Table({
|
|
|
51
62
|
{ key: 'name', label: 'Nome', render: (row, { value }) => _.strong(value) },
|
|
52
63
|
{ key: 'price', label: 'Prezzo', format: value => `${value} EUR` }
|
|
53
64
|
],
|
|
54
|
-
pagination: false, hideFooter: true, minTableWidth: 700
|
|
65
|
+
pagination: false, hideFooter: true, hideStatus: true, minTableWidth: 700
|
|
55
66
|
});
|
|
56
67
|
const page = _.Page({}, _.Card({ title: 'Prodotti' }, edit, table));
|
|
57
68
|
_.mount('#app', page);
|
|
@@ -76,7 +87,7 @@ Dialog returns an API object, not a node to mount: `open(overrides?)`, `close()`
|
|
|
76
87
|
|
|
77
88
|
## Existing CSS and optional assets
|
|
78
89
|
|
|
79
|
-
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 `.cms-*` classes. Read [common props](ui/common-props.md)
|
|
90
|
+
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 `.cms-*` 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.
|
|
80
91
|
|
|
81
92
|
System fonts are the default. Import `jsswift/css/fonts-nunito.css`, `jsswift/css/fonts-material.css`, or `jsswift/tabler` only when required; Material Symbols loads a remote Google font. See [setup](getting-started.md).
|
|
82
93
|
|
|
@@ -98,7 +109,7 @@ For a complete application flow, read [the compact CRUD example](examples/crud.m
|
|
|
98
109
|
|
|
99
110
|
Check whether browser tooling and server permissions are available before launching checks. Run Git commands only in a Git worktree; for example test `git rev-parse --is-inside-work-tree` before requesting a diff. Keep build, pure-logic tests and server startup results separate. An HTTP response confirms a reachable server, not that your startup command succeeded or that browser interactions work. Report environment failures separately from application failures. Test the implemented functions rather than rebuilding equivalent data inside an assertion.
|
|
100
111
|
|
|
101
|
-
Dialog autofocus preserves focus assigned inside `onOpen`; verify initial focus separately from validation focus and return focus. Field messages are associated with Input/Select through `aria-describedby` automatically.
|
|
112
|
+
Dialog autofocus preserves focus assigned inside `onOpen`; verify initial focus after the deferred autofocus has run, separately from validation focus and return focus. Record each check separately: initial field, Tab/Shift+Tab containment, Escape, and return to the current trigger. A focus-trap result does not prove initial focus. Field messages are associated with Input/Select through `aria-describedby` automatically.
|
|
102
113
|
|
|
103
114
|
## Focus CSS and targeted reads
|
|
104
115
|
|
package/dist/documentions/AI.md
CHANGED
|
@@ -10,6 +10,17 @@ If a required API is absent here, consult `knowledge-map.json` to find its exact
|
|
|
10
10
|
|
|
11
11
|
The installed package exposes this same guide as `AI.md` at its root and through `jsswift/AI.md`. `package.json` includes `jsswiftDocumentation` discovery paths. Do not inspect runtime bundles to discover documented APIs.
|
|
12
12
|
|
|
13
|
+
## Choose one starting route
|
|
14
|
+
|
|
15
|
+
| Task | First read | Stop condition |
|
|
16
|
+
| --- | --- | --- |
|
|
17
|
+
| Small page with the six components below | This guide | Implement the supported subset without opening component contracts. |
|
|
18
|
+
| Product CRUD with validation, persistence and focus | [CRUD example](examples/crud.md) | Reuse the example; do not also concatenate Input, Select, Dialog and Table contracts. |
|
|
19
|
+
| One missing prop or callback | Map → exact document, or selective MCP read | Read only the needed section; do not search the runtime bundle. |
|
|
20
|
+
| Custom appearance | Supported props below, then one relevant contract | Keep component styles; add CSS for page layout and task-specific visuals. |
|
|
21
|
+
|
|
22
|
+
The map locates a contract; it does not replace it. Avoid reading all of `ui/common-props.md` just to confirm examples already covered here. Structural helpers used below (`div`, `p`, `span`, `strong`) do not require a separate HTML/SVG guide. Read that guide only for additional helper behavior.
|
|
23
|
+
|
|
13
24
|
## Import, create, mount
|
|
14
25
|
|
|
15
26
|
Provide `<div id="app"></div>` in HTML and a module entrypoint. With Vite:
|
|
@@ -51,7 +62,7 @@ const table = _.Table({
|
|
|
51
62
|
{ key: 'name', label: 'Nome', render: (row, { value }) => _.strong(value) },
|
|
52
63
|
{ key: 'price', label: 'Prezzo', format: value => `${value} EUR` }
|
|
53
64
|
],
|
|
54
|
-
pagination: false, hideFooter: true, minTableWidth: 700
|
|
65
|
+
pagination: false, hideFooter: true, hideStatus: true, minTableWidth: 700
|
|
55
66
|
});
|
|
56
67
|
const page = _.Page({}, _.Card({ title: 'Prodotti' }, edit, table));
|
|
57
68
|
_.mount('#app', page);
|
|
@@ -76,7 +87,7 @@ Dialog returns an API object, not a node to mount: `open(overrides?)`, `close()`
|
|
|
76
87
|
|
|
77
88
|
## Existing CSS and optional assets
|
|
78
89
|
|
|
79
|
-
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 `.cms-*` classes. Read [common props](ui/common-props.md)
|
|
90
|
+
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 `.cms-*` 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.
|
|
80
91
|
|
|
81
92
|
System fonts are the default. Import `jsswift/css/fonts-nunito.css`, `jsswift/css/fonts-material.css`, or `jsswift/tabler` only when required; Material Symbols loads a remote Google font. See [setup](getting-started.md).
|
|
82
93
|
|
|
@@ -98,7 +109,7 @@ For a complete application flow, read [the compact CRUD example](examples/crud.m
|
|
|
98
109
|
|
|
99
110
|
Check whether browser tooling and server permissions are available before launching checks. Run Git commands only in a Git worktree; for example test `git rev-parse --is-inside-work-tree` before requesting a diff. Keep build, pure-logic tests and server startup results separate. An HTTP response confirms a reachable server, not that your startup command succeeded or that browser interactions work. Report environment failures separately from application failures. Test the implemented functions rather than rebuilding equivalent data inside an assertion.
|
|
100
111
|
|
|
101
|
-
Dialog autofocus preserves focus assigned inside `onOpen`; verify initial focus separately from validation focus and return focus. Field messages are associated with Input/Select through `aria-describedby` automatically.
|
|
112
|
+
Dialog autofocus preserves focus assigned inside `onOpen`; verify initial focus after the deferred autofocus has run, separately from validation focus and return focus. Record each check separately: initial field, Tab/Shift+Tab containment, Escape, and return to the current trigger. A focus-trap result does not prove initial focus. Field messages are associated with Input/Select through `aria-describedby` automatically.
|
|
102
113
|
|
|
103
114
|
## Focus CSS and targeted reads
|
|
104
115
|
|
|
@@ -37,6 +37,7 @@ Exact JSswift UI contract. Shared definitions listed in `commonProps` are in [co
|
|
|
37
37
|
"minTableWidth": {"type": "string|number", "description": "Component configuration for \"minTableWidth\". When not handled internally, it is forwarded to the root element.", "default": null, "values": null, "category": "general"},
|
|
38
38
|
"stickyHeader": {"type": "boolean", "description": "Keeps the header region sticky during scroll.", "default": null, "values": null, "category": "general"},
|
|
39
39
|
"hideHeader": {"type": "boolean", "description": "Component configuration for \"hideHeader\". When not handled internally, it is forwarded to the root element.", "default": null, "values": null, "category": "general"},
|
|
40
|
+
"hideStatus": {"type": "boolean", "description": "Hides the entire status row, including row count, filter/sort indicators and custom status content. Independent of toolbar, column headings and footer. Evaluated at creation.", "default": false, "values": null, "category": "layout"},
|
|
40
41
|
"hideFooter": {"type": "boolean", "description": "Component configuration for \"hideFooter\". When not handled internally, it is forwarded to the root element.", "default": null, "values": null, "category": "general"},
|
|
41
42
|
"dense": {"type": "boolean", "description": "Uses compact spacing and sizing.", "default": false, "values": null, "category": "layout"},
|
|
42
43
|
"striped": {"type": "boolean", "description": "Applies striped row styling.", "default": null, "values": null, "category": "general"},
|
|
@@ -96,4 +97,22 @@ Use the documented visibility and column style props before hiding or restyling
|
|
|
96
97
|
|
|
97
98
|
For application-owned filtering/paging, pass the already filtered page as `rows`, set `pagination: false` and `hideFooter: true`. `minTableWidth` keeps columns readable in a horizontally scrollable container. Provide counters and pager buttons outside Table.
|
|
98
99
|
|
|
99
|
-
`toolbarStart`, `toolbar` and `toolbarEnd` add content to the optional toolbar. The built-in row-count status is a separate region and remains visible even with `hideFooter: true`; it counts the rows supplied to Table, not the full application inventory.
|
|
100
|
+
`toolbarStart`, `toolbar` and `toolbarEnd` add content to the optional toolbar. The built-in row-count status is a separate region and remains visible even with `hideFooter: true`; it counts the rows supplied to Table, not the full application inventory. Use `hideStatus: true` to hide the entire status region, including custom status content. Do not confuse `hideHeader` (column headings) with the toolbar/status. Table has its own Card wrapper; nesting it in another Card may produce an additional frame. Customize using supported props and theme values first.
|
|
101
|
+
|
|
102
|
+
## Compose without duplicating the frame
|
|
103
|
+
|
|
104
|
+
Table already returns a Card. For a catalogue, mount it in a structural `_.div`, rather than wrapping it in another Card. Use `radius`, `shadow`, `padding` and `dense` before overriding internal classes. Keep toolbar content inside Table when it belongs to the table; keep application filters outside when they affect other parts of the page.
|
|
105
|
+
|
|
106
|
+
```js
|
|
107
|
+
const table = _.Table({
|
|
108
|
+
rows: products, rowKey: 'id',
|
|
109
|
+
columns: [{key: 'name', label: 'Nome'}],
|
|
110
|
+
toolbarStart: _.strong('Prodotti'),
|
|
111
|
+
minTableWidth: 600, shadow: 'none', radius: '12px'
|
|
112
|
+
});
|
|
113
|
+
_.mount('#app', _.div({style: {minWidth: 0}}, table));
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
For external paging, the status count describes the supplied page (for example, “5 righe”); an external total describes all filtered results. Choose whether both pieces of information are useful. `status` adds content; it does not replace or hide the built-in count. `hideFooter` only hides the footer. Do not use `hideHeader` to remove the status row. Use `hideStatus: true` to hide that row when the application supplies its own summary. It does not hide the toolbar, column headings or footer.
|
|
117
|
+
|
|
118
|
+
A grey surface or gradient is not a focus indicator. Inspect the Card/theme surface separately from `:focus-visible`; do not remove keyboard indicators to change a background. Custom table-cell styling is application CSS, and should remain scoped to an application class.
|
|
@@ -50,7 +50,7 @@ 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
|
-
host.replaceChildren(_.Table({rows:found.slice((page-1)*5,page*5),rowKey:'id',pagination:false,hideFooter:true,minTableWidth:600,
|
|
53
|
+
host.replaceChildren(_.Table({rows:found.slice((page-1)*5,page*5),rowKey:'id',pagination:false,hideFooter:true,hideStatus:true,minTableWidth:600,
|
|
54
54
|
columns:[{key:'name',label:'Nome'},{key:'category',label:'Categoria'},{key:'price',label:'Prezzo',format:value => priceFormat.format(value)},{key:'quantity',label:'Quantità'},
|
|
55
55
|
{key:'actions',label:'Azioni',render:r => _.Button({id:`edit-${r.id}`,onClick:() => edit(r)},'Modifica')}] }));
|
|
56
56
|
pager.replaceChildren(_.span(`${found.length} prodotti — pagina ${page}/${pages}`),
|
|
@@ -63,3 +63,16 @@ _.mount('#app', _.div({style:{minWidth:0}}, add, search, filter, host, pager, no
|
|
|
63
63
|
Application validation remains explicit. `error` marks the control invalid; rendered field messages are associated automatically. Use `ariaDescribedBy` for additional application-owned descriptions. This example does not provide delete, server synchronization or a complete visual design.
|
|
64
64
|
|
|
65
65
|
Performance: the currency formatter is reused. This small example rebuilds its table for clarity; profile larger datasets before changing rendering strategy. `onOpen` focuses the name field and automatic focus respects that choice.
|
|
66
|
+
|
|
67
|
+
## Verification checklist
|
|
68
|
+
|
|
69
|
+
Build success alone does not verify this flow. In a browser, record these results separately:
|
|
70
|
+
|
|
71
|
+
- Open the editor and, after deferred autofocus, check that the name control is active.
|
|
72
|
+
- Change the category, save, reopen, and reload: check the displayed value and persisted category.
|
|
73
|
+
- Reject blank fields, negative price and fractional quantity; check `aria-invalid` and the field error referenced by `aria-describedby`.
|
|
74
|
+
- Use Tab and Shift+Tab at both dialog boundaries, Escape to close, and check focus returns to the current trigger after rendering.
|
|
75
|
+
- Add and edit, reload, then search, filter and paginate; check persistence and page reset.
|
|
76
|
+
- At a narrow viewport, check page overflow and table scrolling. Measure contrast separately; screenshots alone do not establish contrast compliance.
|
|
77
|
+
|
|
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.
|