jsswift 1.0.53 → 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 CHANGED
@@ -27,7 +27,7 @@ Provide `<div id="app"></div>` in HTML and a module entrypoint. With Vite:
27
27
 
28
28
  ```js
29
29
  import 'jsswift';
30
- import 'jsswift/css/ui.css';
30
+ import 'jsswift/css/ui-light.css';
31
31
  const _ = window._;
32
32
 
33
33
  const name = _.rod('Prodotto 01');
@@ -64,7 +64,7 @@ const table = _.Table({
64
64
  ],
65
65
  pagination: false, hideFooter: true, hideStatus: true, minTableWidth: 700
66
66
  });
67
- const page = _.Page({}, _.Card({ title: 'Prodotti' }, edit, table));
67
+ const page = _.Page({}, _.div({}, _.h1('Prodotti'), edit, table));
68
68
  _.mount('#app', page);
69
69
  ```
70
70
 
@@ -87,7 +87,13 @@ 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
- 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.
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.
93
+
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.
95
+
96
+ Prefer supported props to rebuilding control styles: `_.Button({color:'primary', outline:true, dense:true}, 'Modifica')`. Use `_.Row({gap:'md', tablet:{gap:'lg'}})` with the responsive addon when breakpoint props are required. Read the focused component contract for additional options.
91
97
 
92
98
  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).
93
99
 
@@ -123,3 +129,28 @@ Apply focus indicators to every selector through `:is`, rather than placing the
123
129
  ```
124
130
 
125
131
  When MCP is configured, request missing component details with `jsswift_read({id:"component:table", section:"props", keys:["pagination","hideFooter"]})`. `section` supports props, events, methods and slots; omit it for the full document. Inherited props are resolved automatically; unknown keys return an error. This reduces returned text, not the API knowledge needed by the task.
132
+
133
+
134
+ ## Catalogue surfaces and field styling
135
+
136
+ Use `_.Kpi({title:'Disponibili', value:9, note:'Con quantità maggiore di zero'})` for dashboard metrics; it already supplies the metric layout. [Additional Kpi options](components/kpi.md).
137
+
138
+ Table already returns a Card: place it in a structural `_.div`, without another Card around it. Use `hideStatus:true` with an application-owned counter, and `emptyText:'Nessun prodotto trovato'` for a single empty message. When passing a paginated slice, set each data column's `sortable:false` unless the application sorts the full filtered dataset before slicing; built-in sorting sees only supplied rows.
139
+
140
+ Input's border belongs to its outer control; the native input is transparent. Preserve that transparency: broad rules such as `.filters input {background:white}` can cover the curved border when a surrounding Card supplies a larger radius. Apply page backgrounds to structural containers. Set a field's own `radius` when it should not inherit the surrounding surface radius. Avoid clipping controls with `overflow:hidden`, which can also clip focus indicators.
141
+
142
+ For taller catalogue fields, set the shared height variable on their application-owned container; do not force a height or background on native `input` and `select` descendants:
143
+
144
+ ```css
145
+ .catalogue-filters {
146
+ --jss-input-height-default: 40px;
147
+ }
148
+ ```
149
+
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.
package/README.md CHANGED
@@ -1,7 +1,7 @@
1
1
  # JSswift
2
2
 
3
- Start with [AI.md](AI.md) for imports, field models with `_.rod()`, Input, Select, Button, Card, Table and Dialog. Use its supported examples directly before reading other contracts.
3
+ **First read only [AI.md](AI.md), in a separate read operation.** It covers imports, rod field models, Input, Select, Button, Card, Table and Dialog. Implement its supported examples before opening additional contracts.
4
4
 
5
5
  For an API absent from that guide, use [knowledge-map.json](dist/documentions/knowledge-map.json) to locate the exact document. Read only the relevant contract; avoid concatenating the component catalog or searching runtime bundles for documentation.
6
6
 
7
- Import `jsswift` and `jsswift/css/ui.css`. Component CSS is included; fonts and Tabler are optional. The read-only `@jsswift/knowledge-mcp` is an optional discovery interface when configured in your AI client.
7
+ Import `jsswift` and `jsswift/css/ui-light.css`; add `jsswift/css/responsive.css` when using breakpoint props. `ui.css` remains the complete alternative. Component CSS is included; fonts and Tabler are optional. The read-only `@jsswift/knowledge-mcp` is an optional discovery interface when configured in your AI client.
@@ -1,52 +1,52 @@
1
1
  :root {
2
- --cms-anim-dur: 500ms;
3
- --cms-anim-ease: cubic-bezier(0.2, 0.7, 0.2, 1);
4
- --cms-anim-distance: 12px;
5
- --cms-anim-scale: 0.98;
6
- --cms-anim-in: cms-fade-in;
7
- --cms-anim-out: cms-fade-out;
2
+ --jss-anim-dur: 500ms;
3
+ --jss-anim-ease: cubic-bezier(0.2, 0.7, 0.2, 1);
4
+ --jss-anim-distance: 12px;
5
+ --jss-anim-scale: 0.98;
6
+ --jss-anim-in: jss-fade-in;
7
+ --jss-anim-out: jss-fade-out;
8
8
  }
9
9
 
10
- .cms-animate {
11
- animation-duration: var(--cms-anim-dur);
12
- animation-timing-function: var(--cms-anim-ease);
10
+ .jss-animate {
11
+ animation-duration: var(--jss-anim-dur);
12
+ animation-timing-function: var(--jss-anim-ease);
13
13
  animation-fill-mode: both;
14
14
  will-change: opacity, transform;
15
15
  }
16
16
 
17
- .cms-animate.in {
18
- animation-name: var(--cms-anim-in);
17
+ .jss-animate.in {
18
+ animation-name: var(--jss-anim-in);
19
19
  }
20
20
 
21
- .cms-animate.out {
22
- animation-name: var(--cms-anim-out);
21
+ .jss-animate.out {
22
+ animation-name: var(--jss-anim-out);
23
23
  }
24
24
 
25
- .cms-animate.fade.in {
26
- animation-name: cms-fade-in;
25
+ .jss-animate.fade.in {
26
+ animation-name: jss-fade-in;
27
27
  }
28
28
 
29
- .cms-animate.fade.out {
30
- animation-name: cms-fade-out;
29
+ .jss-animate.fade.out {
30
+ animation-name: jss-fade-out;
31
31
  }
32
32
 
33
- .cms-animate.slide.in {
34
- animation-name: cms-slide-in;
33
+ .jss-animate.slide.in {
34
+ animation-name: jss-slide-in;
35
35
  }
36
36
 
37
- .cms-animate.slide.out {
38
- animation-name: cms-slide-out;
37
+ .jss-animate.slide.out {
38
+ animation-name: jss-slide-out;
39
39
  }
40
40
 
41
- .cms-animate.scale.in {
42
- animation-name: cms-scale-in;
41
+ .jss-animate.scale.in {
42
+ animation-name: jss-scale-in;
43
43
  }
44
44
 
45
- .cms-animate.scale.out {
46
- animation-name: cms-scale-out;
45
+ .jss-animate.scale.out {
46
+ animation-name: jss-scale-out;
47
47
  }
48
48
 
49
- @keyframes cms-fade-in {
49
+ @keyframes jss-fade-in {
50
50
  from {
51
51
  opacity: 0;
52
52
  }
@@ -56,7 +56,7 @@
56
56
  }
57
57
  }
58
58
 
59
- @keyframes cms-fade-out {
59
+ @keyframes jss-fade-out {
60
60
  from {
61
61
  opacity: 1;
62
62
  }
@@ -66,10 +66,10 @@
66
66
  }
67
67
  }
68
68
 
69
- @keyframes cms-slide-in {
69
+ @keyframes jss-slide-in {
70
70
  from {
71
71
  opacity: 0;
72
- transform: translateY(var(--cms-anim-distance));
72
+ transform: translateY(var(--jss-anim-distance));
73
73
  }
74
74
 
75
75
  to {
@@ -78,7 +78,7 @@
78
78
  }
79
79
  }
80
80
 
81
- @keyframes cms-slide-out {
81
+ @keyframes jss-slide-out {
82
82
  from {
83
83
  opacity: 1;
84
84
  transform: translateY(0);
@@ -86,14 +86,14 @@
86
86
 
87
87
  to {
88
88
  opacity: 0;
89
- transform: translateY(var(--cms-anim-distance));
89
+ transform: translateY(var(--jss-anim-distance));
90
90
  }
91
91
  }
92
92
 
93
- @keyframes cms-scale-in {
93
+ @keyframes jss-scale-in {
94
94
  from {
95
95
  opacity: 0;
96
- transform: scale(var(--cms-anim-scale));
96
+ transform: scale(var(--jss-anim-scale));
97
97
  }
98
98
 
99
99
  to {
@@ -102,7 +102,7 @@
102
102
  }
103
103
  }
104
104
 
105
- @keyframes cms-scale-out {
105
+ @keyframes jss-scale-out {
106
106
  from {
107
107
  opacity: 1;
108
108
  transform: scale(1);
@@ -110,12 +110,12 @@
110
110
 
111
111
  to {
112
112
  opacity: 0;
113
- transform: scale(var(--cms-anim-scale));
113
+ transform: scale(var(--jss-anim-scale));
114
114
  }
115
115
  }
116
116
 
117
117
  @media (prefers-reduced-motion: reduce) {
118
- .cms-animate {
118
+ .jss-animate {
119
119
  animation-duration: 1ms;
120
120
  }
121
121
  }