x4js 2.0.28 → 2.0.31

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 (69) hide show
  1. package/.vscode/launch.json +14 -0
  2. package/.vscode/settings.json +2 -0
  3. package/ai-comments.txt +97 -0
  4. package/demo/assets/house-light.svg +1 -0
  5. package/demo/assets/radio.svg +4 -0
  6. package/demo/index.html +12 -0
  7. package/demo/main.scss +23 -0
  8. package/demo/main.ts +324 -0
  9. package/demo/package.json +26 -0
  10. package/demo/scss.d.ts +4 -0
  11. package/demo/svg.d.ts +1 -0
  12. package/demo/tsconfig.json +14 -0
  13. package/lib/types/x4js.d.ts +0 -2374
  14. package/package.json +23 -47
  15. package/src/colors.scss +246 -0
  16. package/src/components/boxes/boxes.module.scss +1 -1
  17. package/src/components/boxes/boxes.ts +139 -28
  18. package/src/components/button/button.ts +76 -29
  19. package/src/components/combobox/combobox.ts +1 -1
  20. package/src/components/dialog/dialog.ts +4 -0
  21. package/src/components/gridview/gridview.ts +104 -6
  22. package/src/components/icon/icon.ts +42 -14
  23. package/src/components/input/input.ts +146 -74
  24. package/src/components/keyboard/keyboard.module.scss +1 -1
  25. package/src/components/keyboard/keyboard.ts +31 -9
  26. package/src/components/label/label.module.scss +9 -0
  27. package/src/components/label/label.ts +10 -6
  28. package/src/components/link/link.module.scss +44 -0
  29. package/src/components/link/link.ts +7 -1
  30. package/src/components/listbox/listbox.module.scss +18 -4
  31. package/src/components/listbox/listbox.ts +32 -12
  32. package/src/components/menu/menu.module.scss +14 -2
  33. package/src/components/menu/menu.ts +1 -1
  34. package/src/components/messages/messages.ts +13 -5
  35. package/src/components/panel/panel.module.scss +7 -0
  36. package/src/components/popup/popup.ts +14 -10
  37. package/src/components/propgrid/propgrid.ts +1 -1
  38. package/src/components/shared.scss +4 -0
  39. package/src/components/spreadsheet/spreadsheet.ts +81 -34
  40. package/src/components/tabs/tabs.module.scss +1 -0
  41. package/src/components/textarea/textarea.ts +8 -2
  42. package/src/components/textedit/textedit.ts +7 -0
  43. package/src/components/themes.scss +2 -0
  44. package/src/components/tooltips/tooltips.ts +15 -3
  45. package/src/core/component.ts +358 -162
  46. package/src/core/core_application.ts +129 -32
  47. package/src/core/core_colors.ts +382 -119
  48. package/src/core/core_data.ts +73 -86
  49. package/src/core/core_dom.ts +10 -0
  50. package/src/core/core_dragdrop.ts +32 -7
  51. package/src/core/core_element.ts +111 -4
  52. package/src/core/core_events.ts +48 -11
  53. package/src/core/core_i18n.ts +2 -0
  54. package/src/core/core_pdf.ts +454 -0
  55. package/src/core/core_router.ts +64 -5
  56. package/src/core/core_state.ts +1 -0
  57. package/src/core/core_styles.ts +11 -12
  58. package/src/core/core_svg.ts +346 -51
  59. package/src/core/core_tools.ts +105 -17
  60. package/src/x4.d.ts +10 -0
  61. package/src/x4.ts +1 -0
  62. package/src/x4tsx.d.ts +2 -1
  63. package/tsconfig.json +11 -0
  64. package/lib/README.txt +0 -20
  65. package/lib/cjs/x4.css +0 -1
  66. package/lib/cjs/x4.js +0 -2
  67. package/lib/esm/x4.css +0 -1
  68. package/lib/esm/x4.mjs +0 -2
  69. package/lib/styles/x4.css +0 -1
package/package.json CHANGED
@@ -1,51 +1,27 @@
1
1
  {
2
- "name": "x4js",
3
- "version": "2.0.28",
4
- "description": "X4 framework",
5
- "author": "etienne cochard",
6
- "license": "MIT",
7
- "repository": {
8
- "type": "git",
9
- "url": "git+https://github.com/rlibre/x4.git"
10
- },
11
- "bugs": {
12
- "url": "https://github.com/rlibre/x4/issues"
13
- },
14
- "keywords": [
15
- "typescript",
16
- "framework",
17
- "sap",
18
- "web",
19
- "desktop",
20
- "application"
21
- ],
2
+ "name": "x4js",
3
+ "version": "2.0.31",
4
+ "type": "module",
5
+ "main": "src/x4.ts",
6
+ "module": "src/x4.ts",
7
+ "types": "src/x4.ts",
8
+ "exports": {
9
+ ".": "./src/x4.ts"
10
+ },
22
11
  "scripts": {
23
- "build": "x4build --watch --hmr --serve",
24
- "build-release": "x4build --release",
25
- "prepack": "node scripts/prepack.mjs"
26
- },
27
- "homepage": "https://x4js.org",
28
- "files": ["lib","src"],
29
- "types": "./src/x4.ts",
30
- "module": "./lib/esm/x4.mjs",
31
- "main": "./lib/cjs/x4.js",
32
- "exports": {
33
- ".": {
34
- "types": "./src/x4.ts",
35
- "module": "./lib/esm/x4.mjs",
36
- "require": "./lib/cjs/x4.js"
37
- }
38
- },
39
- "x4build": {
40
- "entryPoints": [
41
- "src/x4.ts"
42
- ],
43
- "outdir": "lib"
12
+ "build": "x4build --watch --hmr --serve",
13
+ "build-release": "x4build --release"
44
14
  },
15
+
16
+ "repository": {
17
+ "type": "git",
18
+ "url": "git+https://github.com/rlibre/x4.git"
19
+ },
20
+ "homepage": "https://x4js.org",
21
+ "keywords": ["typescript","framework","sap","web","desktop","application"
22
+ ],
45
23
  "devDependencies": {
46
- "typescript": "^5.8.3",
47
- "x4build": "^1.6.8",
48
- "esbuild-plugin-d.ts": "^1.3",
49
- "esbuild-sass-plugin": "^3.3"
50
- }
51
- }
24
+ "typescript": "^5.8.3",
25
+ "x4build": "^1.6.8"
26
+ }
27
+ }
@@ -0,0 +1,246 @@
1
+ :root {
2
+ --color-red-50: oklch(0.971 0.013 17.38);
3
+ --color-red-100: oklch(0.936 0.032 17.717);
4
+ --color-red-200: oklch(0.885 0.062 18.334);
5
+ --color-red-300: oklch(0.808 0.114 19.571);
6
+ --color-red-400: oklch(0.704 0.191 22.216);
7
+ --color-red-500: oklch(0.637 0.237 25.331);
8
+ --color-red-600: oklch(0.577 0.245 27.325);
9
+ --color-red-700: oklch(0.505 0.213 27.518);
10
+ --color-red-800: oklch(0.444 0.177 26.899);
11
+ --color-red-900: oklch(0.396 0.141 25.723);
12
+ --color-red-950: oklch(0.258 0.092 26.042);
13
+ --color-orange-50: oklch(0.98 0.016 73.684);
14
+ --color-orange-100: oklch(0.954 0.038 75.164);
15
+ --color-orange-200: oklch(0.901 0.076 70.697);
16
+ --color-orange-300: oklch(0.837 0.128 66.29);
17
+ --color-orange-400: oklch(0.75 0.183 55.934);
18
+ --color-orange-500: oklch(0.705 0.213 47.604);
19
+ --color-orange-600: oklch(0.646 0.222 41.116);
20
+ --color-orange-700: oklch(0.553 0.195 38.402);
21
+ --color-orange-800: oklch(0.47 0.157 37.304);
22
+ --color-orange-900: oklch(0.408 0.123 38.172);
23
+ --color-orange-950: oklch(0.266 0.079 36.259);
24
+ --color-amber-50: oklch(0.987 0.022 95.277);
25
+ --color-amber-100: oklch(0.962 0.059 95.617);
26
+ --color-amber-200: oklch(0.924 0.12 95.746);
27
+ --color-amber-300: oklch(0.879 0.169 91.605);
28
+ --color-amber-400: oklch(0.828 0.189 84.429);
29
+ --color-amber-500: oklch(0.769 0.188 70.08);
30
+ --color-amber-600: oklch(0.666 0.179 58.318);
31
+ --color-amber-700: oklch(0.555 0.163 48.998);
32
+ --color-amber-800: oklch(0.473 0.137 46.201);
33
+ --color-amber-900: oklch(0.414 0.112 45.904);
34
+ --color-amber-950: oklch(0.279 0.077 45.635);
35
+ --color-yellow-50: oklch(0.987 0.026 102.212);
36
+ --color-yellow-100: oklch(0.973 0.071 103.193);
37
+ --color-yellow-200: oklch(0.945 0.129 101.54);
38
+ --color-yellow-300: oklch(0.905 0.182 98.111);
39
+ --color-yellow-400: oklch(0.852 0.199 91.936);
40
+ --color-yellow-500: oklch(0.795 0.184 86.047);
41
+ --color-yellow-600: oklch(0.681 0.162 75.834);
42
+ --color-yellow-700: oklch(0.554 0.135 66.442);
43
+ --color-yellow-800: oklch(0.476 0.114 61.907);
44
+ --color-yellow-900: oklch(0.421 0.095 57.708);
45
+ --color-yellow-950: oklch(0.286 0.066 53.813);
46
+ --color-lime-50: oklch(0.986 0.031 120.757);
47
+ --color-lime-100: oklch(0.967 0.067 122.328);
48
+ --color-lime-200: oklch(0.938 0.127 124.321);
49
+ --color-lime-300: oklch(0.897 0.196 126.665);
50
+ --color-lime-400: oklch(0.841 0.238 128.85);
51
+ --color-lime-500: oklch(0.768 0.233 130.85);
52
+ --color-lime-600: oklch(0.648 0.2 131.684);
53
+ --color-lime-700: oklch(0.532 0.157 131.589);
54
+ --color-lime-800: oklch(0.453 0.124 130.933);
55
+ --color-lime-900: oklch(0.405 0.101 131.063);
56
+ --color-lime-950: oklch(0.274 0.072 132.109);
57
+ --color-green-50: oklch(0.982 0.018 155.826);
58
+ --color-green-100: oklch(0.962 0.044 156.743);
59
+ --color-green-200: oklch(0.925 0.084 155.995);
60
+ --color-green-300: oklch(0.871 0.15 154.449);
61
+ --color-green-400: oklch(0.792 0.209 151.711);
62
+ --color-green-500: oklch(0.723 0.219 149.579);
63
+ --color-green-600: oklch(0.627 0.194 149.214);
64
+ --color-green-700: oklch(0.527 0.154 150.069);
65
+ --color-green-800: oklch(0.448 0.119 151.328);
66
+ --color-green-900: oklch(0.393 0.095 152.535);
67
+ --color-green-950: oklch(0.266 0.065 152.934);
68
+ --color-emerald-50: oklch(0.979 0.021 166.113);
69
+ --color-emerald-100: oklch(0.95 0.052 163.051);
70
+ --color-emerald-200: oklch(0.905 0.093 164.15);
71
+ --color-emerald-300: oklch(0.845 0.143 164.978);
72
+ --color-emerald-400: oklch(0.765 0.177 163.223);
73
+ --color-emerald-500: oklch(0.696 0.17 162.48);
74
+ --color-emerald-600: oklch(0.596 0.145 163.225);
75
+ --color-emerald-700: oklch(0.508 0.118 165.612);
76
+ --color-emerald-800: oklch(0.432 0.095 166.913);
77
+ --color-emerald-900: oklch(0.378 0.077 168.94);
78
+ --color-emerald-950: oklch(0.262 0.051 172.552);
79
+ --color-teal-50: oklch(0.984 0.014 180.72);
80
+ --color-teal-100: oklch(0.953 0.051 180.801);
81
+ --color-teal-200: oklch(0.91 0.096 180.426);
82
+ --color-teal-300: oklch(0.855 0.138 181.071);
83
+ --color-teal-400: oklch(0.777 0.152 181.912);
84
+ --color-teal-500: oklch(0.704 0.14 182.503);
85
+ --color-teal-600: oklch(0.6 0.118 184.704);
86
+ --color-teal-700: oklch(0.511 0.096 186.391);
87
+ --color-teal-800: oklch(0.437 0.078 188.216);
88
+ --color-teal-900: oklch(0.386 0.063 188.416);
89
+ --color-teal-950: oklch(0.277 0.046 192.524);
90
+ --color-cyan-50: oklch(0.984 0.019 200.873);
91
+ --color-cyan-100: oklch(0.956 0.045 203.388);
92
+ --color-cyan-200: oklch(0.917 0.08 205.041);
93
+ --color-cyan-300: oklch(0.865 0.127 207.078);
94
+ --color-cyan-400: oklch(0.789 0.154 211.53);
95
+ --color-cyan-500: oklch(0.715 0.143 215.221);
96
+ --color-cyan-600: oklch(0.609 0.126 221.723);
97
+ --color-cyan-700: oklch(0.52 0.105 223.128);
98
+ --color-cyan-800: oklch(0.45 0.085 224.283);
99
+ --color-cyan-900: oklch(0.398 0.07 227.392);
100
+ --color-cyan-950: oklch(0.302 0.056 229.695);
101
+ --color-sky-50: oklch(0.977 0.013 236.62);
102
+ --color-sky-100: oklch(0.951 0.026 236.824);
103
+ --color-sky-200: oklch(0.901 0.058 230.902);
104
+ --color-sky-300: oklch(0.828 0.111 230.318);
105
+ --color-sky-400: oklch(0.746 0.16 232.661);
106
+ --color-sky-500: oklch(0.685 0.169 237.323);
107
+ --color-sky-600: oklch(0.588 0.158 241.966);
108
+ --color-sky-700: oklch(0.5 0.134 242.749);
109
+ --color-sky-800: oklch(0.443 0.11 240.79);
110
+ --color-sky-900: oklch(0.391 0.09 240.876);
111
+ --color-sky-950: oklch(0.293 0.066 243.157);
112
+ --color-blue-50: oklch(0.97 0.014 254.604);
113
+ --color-blue-100: oklch(0.932 0.032 255.585);
114
+ --color-blue-200: oklch(0.882 0.059 254.128);
115
+ --color-blue-300: oklch(0.809 0.105 251.813);
116
+ --color-blue-400: oklch(0.707 0.165 254.624);
117
+ --color-blue-500: oklch(0.623 0.214 259.815);
118
+ --color-blue-600: oklch(0.546 0.245 262.881);
119
+ --color-blue-700: oklch(0.488 0.243 264.376);
120
+ --color-blue-800: oklch(0.424 0.199 265.638);
121
+ --color-blue-900: oklch(0.379 0.146 265.522);
122
+ --color-blue-950: oklch(0.282 0.091 267.935);
123
+ --color-indigo-50: oklch(0.962 0.018 272.314);
124
+ --color-indigo-100: oklch(0.93 0.034 272.788);
125
+ --color-indigo-200: oklch(0.87 0.065 274.039);
126
+ --color-indigo-300: oklch(0.785 0.115 274.713);
127
+ --color-indigo-400: oklch(0.673 0.182 276.935);
128
+ --color-indigo-500: oklch(0.585 0.233 277.117);
129
+ --color-indigo-600: oklch(0.511 0.262 276.966);
130
+ --color-indigo-700: oklch(0.457 0.24 277.023);
131
+ --color-indigo-800: oklch(0.398 0.195 277.366);
132
+ --color-indigo-900: oklch(0.359 0.144 278.697);
133
+ --color-indigo-950: oklch(0.257 0.09 281.288);
134
+ --color-violet-50: oklch(0.969 0.016 293.756);
135
+ --color-violet-100: oklch(0.943 0.029 294.588);
136
+ --color-violet-200: oklch(0.894 0.057 293.283);
137
+ --color-violet-300: oklch(0.811 0.111 293.571);
138
+ --color-violet-400: oklch(0.702 0.183 293.541);
139
+ --color-violet-500: oklch(0.606 0.25 292.717);
140
+ --color-violet-600: oklch(0.541 0.281 293.009);
141
+ --color-violet-700: oklch(0.491 0.27 292.581);
142
+ --color-violet-800: oklch(0.432 0.232 292.759);
143
+ --color-violet-900: oklch(0.38 0.189 293.745);
144
+ --color-violet-950: oklch(0.283 0.141 291.089);
145
+ --color-purple-50: oklch(0.977 0.014 308.299);
146
+ --color-purple-100: oklch(0.946 0.033 307.174);
147
+ --color-purple-200: oklch(0.902 0.063 306.703);
148
+ --color-purple-300: oklch(0.827 0.119 306.383);
149
+ --color-purple-400: oklch(0.714 0.203 305.504);
150
+ --color-purple-500: oklch(0.627 0.265 303.9);
151
+ --color-purple-600: oklch(0.558 0.288 302.321);
152
+ --color-purple-700: oklch(0.496 0.265 301.924);
153
+ --color-purple-800: oklch(0.438 0.218 303.724);
154
+ --color-purple-900: oklch(0.381 0.176 304.987);
155
+ --color-purple-950: oklch(0.291 0.149 302.717);
156
+ --color-fuchsia-50: oklch(0.977 0.017 320.058);
157
+ --color-fuchsia-100: oklch(0.952 0.037 318.852);
158
+ --color-fuchsia-200: oklch(0.903 0.076 319.62);
159
+ --color-fuchsia-300: oklch(0.833 0.145 321.434);
160
+ --color-fuchsia-400: oklch(0.74 0.238 322.16);
161
+ --color-fuchsia-500: oklch(0.667 0.295 322.15);
162
+ --color-fuchsia-600: oklch(0.591 0.293 322.896);
163
+ --color-fuchsia-700: oklch(0.518 0.253 323.949);
164
+ --color-fuchsia-800: oklch(0.452 0.211 324.591);
165
+ --color-fuchsia-900: oklch(0.401 0.17 325.612);
166
+ --color-fuchsia-950: oklch(0.293 0.136 325.661);
167
+ --color-pink-50: oklch(0.971 0.014 343.198);
168
+ --color-pink-100: oklch(0.948 0.028 342.258);
169
+ --color-pink-200: oklch(0.899 0.061 343.231);
170
+ --color-pink-300: oklch(0.823 0.12 346.018);
171
+ --color-pink-400: oklch(0.718 0.202 349.761);
172
+ --color-pink-500: oklch(0.656 0.241 354.308);
173
+ --color-pink-600: oklch(0.592 0.249 0.584);
174
+ --color-pink-700: oklch(0.525 0.223 3.958);
175
+ --color-pink-800: oklch(0.459 0.187 3.815);
176
+ --color-pink-900: oklch(0.408 0.153 2.432);
177
+ --color-pink-950: oklch(0.284 0.109 3.907);
178
+ --color-rose-50: oklch(0.969 0.015 12.422);
179
+ --color-rose-100: oklch(0.941 0.03 12.58);
180
+ --color-rose-200: oklch(0.892 0.058 10.001);
181
+ --color-rose-300: oklch(0.81 0.117 11.638);
182
+ --color-rose-400: oklch(0.712 0.194 13.428);
183
+ --color-rose-500: oklch(0.645 0.246 16.439);
184
+ --color-rose-600: oklch(0.586 0.253 17.585);
185
+ --color-rose-700: oklch(0.514 0.222 16.935);
186
+ --color-rose-800: oklch(0.455 0.188 13.697);
187
+ --color-rose-900: oklch(0.41 0.159 10.272);
188
+ --color-rose-950: oklch(0.271 0.105 12.094);
189
+ --color-slate-50: oklch(0.984 0.003 247.858);
190
+ --color-slate-100: oklch(0.968 0.007 247.896);
191
+ --color-slate-200: oklch(0.929 0.013 255.508);
192
+ --color-slate-300: oklch(0.869 0.022 252.894);
193
+ --color-slate-400: oklch(0.704 0.04 256.788);
194
+ --color-slate-500: oklch(0.554 0.046 257.417);
195
+ --color-slate-600: oklch(0.446 0.043 257.281);
196
+ --color-slate-700: oklch(0.372 0.044 257.287);
197
+ --color-slate-800: oklch(0.279 0.041 260.031);
198
+ --color-slate-900: oklch(0.208 0.042 265.755);
199
+ --color-slate-950: oklch(0.129 0.042 264.695);
200
+ --color-gray-50: oklch(0.985 0.002 247.839);
201
+ --color-gray-100: oklch(0.967 0.003 264.542);
202
+ --color-gray-200: oklch(0.928 0.006 264.531);
203
+ --color-gray-300: oklch(0.872 0.01 258.338);
204
+ --color-gray-400: oklch(0.707 0.022 261.325);
205
+ --color-gray-500: oklch(0.551 0.027 264.364);
206
+ --color-gray-600: oklch(0.446 0.03 256.802);
207
+ --color-gray-700: oklch(0.373 0.034 259.733);
208
+ --color-gray-800: oklch(0.278 0.033 256.848);
209
+ --color-gray-900: oklch(0.21 0.034 264.665);
210
+ --color-gray-950: oklch(0.13 0.028 261.692);
211
+ --color-zinc-50: oklch(0.985 0 0);
212
+ --color-zinc-100: oklch(0.967 0.001 286.375);
213
+ --color-zinc-200: oklch(0.92 0.004 286.32);
214
+ --color-zinc-300: oklch(0.871 0.006 286.286);
215
+ --color-zinc-400: oklch(0.705 0.015 286.067);
216
+ --color-zinc-500: oklch(0.552 0.016 285.938);
217
+ --color-zinc-600: oklch(0.442 0.017 285.786);
218
+ --color-zinc-700: oklch(0.37 0.013 285.805);
219
+ --color-zinc-800: oklch(0.274 0.006 286.033);
220
+ --color-zinc-900: oklch(0.21 0.006 285.885);
221
+ --color-zinc-950: oklch(0.141 0.005 285.823);
222
+ --color-neutral-50: oklch(0.985 0 0);
223
+ --color-neutral-100: oklch(0.97 0 0);
224
+ --color-neutral-200: oklch(0.922 0 0);
225
+ --color-neutral-300: oklch(0.87 0 0);
226
+ --color-neutral-400: oklch(0.708 0 0);
227
+ --color-neutral-500: oklch(0.556 0 0);
228
+ --color-neutral-600: oklch(0.439 0 0);
229
+ --color-neutral-700: oklch(0.371 0 0);
230
+ --color-neutral-800: oklch(0.269 0 0);
231
+ --color-neutral-900: oklch(0.205 0 0);
232
+ --color-neutral-950: oklch(0.145 0 0);
233
+ --color-stone-50: oklch(0.985 0.001 106.423);
234
+ --color-stone-100: oklch(0.97 0.001 106.424);
235
+ --color-stone-200: oklch(0.923 0.003 48.717);
236
+ --color-stone-300: oklch(0.869 0.005 56.366);
237
+ --color-stone-400: oklch(0.709 0.01 56.259);
238
+ --color-stone-500: oklch(0.553 0.013 58.071);
239
+ --color-stone-600: oklch(0.444 0.011 73.639);
240
+ --color-stone-700: oklch(0.374 0.01 67.558);
241
+ --color-stone-800: oklch(0.268 0.007 34.298);
242
+ --color-stone-900: oklch(0.216 0.006 56.043);
243
+ --color-stone-950: oklch(0.147 0.004 49.25);
244
+ --color-black: #000;
245
+ --color-white: #fff;
246
+ }
@@ -36,7 +36,7 @@
36
36
  }
37
37
 
38
38
  &>*:not(.selected) {
39
- display: none;
39
+ display: none !important;
40
40
  }
41
41
  }
42
42
 
@@ -14,18 +14,20 @@
14
14
  * that can be found in the LICENSE file or at https://opensource.org/licenses/MIT.
15
15
  **/
16
16
 
17
- import { asap, class_ns, isArray, isNumber, isString } from '../../core/core_tools';
18
- import { Component, ComponentContent, ComponentEvents, ComponentProps, EvSelectionChange } from "../../core/component"
17
+ import { asap, class_ns, isArray, isNumber } from '../../core/core_tools';
18
+ import { Component, ComponentEvents, ComponentProps, EvSelectionChange } from "../../core/component"
19
+ import { EventCallback } from '../../core/core_events';
19
20
 
20
21
  import "./boxes.module.scss";
21
- import { EventCallback } from '../../core/core_events';
22
22
 
23
23
  export interface BoxProps extends ComponentProps {
24
+ /** Optional HTML tag to use for the box. */
24
25
  tag?: string;
25
26
  }
26
27
 
27
28
  /**
28
- *
29
+ * A generic container component for grouping and laying out child components.
30
+ * The CSS class for this component is automatically generated as `x4box`.
29
31
  */
30
32
 
31
33
  @class_ns( "x4" )
@@ -34,7 +36,9 @@ export class Box<P extends BoxProps=BoxProps,E extends ComponentEvents=Component
34
36
 
35
37
 
36
38
  /**
37
- *
39
+ * A horizontal box layout component.
40
+ * Arranges child components in a horizontal line.
41
+ * The CSS class for this component is automatically generated as `x4hbox`.
38
42
  */
39
43
 
40
44
  @class_ns( "x4" )
@@ -42,7 +46,9 @@ export class HBox<P extends BoxProps=BoxProps,E extends ComponentEvents=Componen
42
46
  }
43
47
 
44
48
  /**
45
- *
49
+ * A vertical box layout component.
50
+ * Arranges child components in a vertical stack.
51
+ * The CSS class for this component is automatically generated as `x4vbox`.
46
52
  */
47
53
 
48
54
  @class_ns( "x4" )
@@ -53,42 +59,53 @@ export class VBox<P extends BoxProps=BoxProps,E extends ComponentEvents=Componen
53
59
  }
54
60
 
55
61
 
62
+ type ContentBuilder = ( ) => Component;
63
+
64
+
56
65
  /**
57
- * stack of widgets where only one widget is visible at a time
66
+ * Represents an item in a {@link StackBox}.
58
67
  */
59
68
 
60
- type ContentBuilder = ( ) => Component;
61
-
62
69
  interface StackItem {
70
+ /** Unique name for the stack item. */
63
71
  name: string;
72
+ /** Content of the stack item, either a component or a builder function. */
64
73
  content: Component | ContentBuilder;
65
74
  title?: string;
66
75
  }
67
76
 
68
77
  /**
69
- *
78
+ * Events specific to the {@link StackBox} component.
70
79
  */
71
80
 
72
81
  interface StackeBoxEvents extends ComponentEvents {
82
+ /** Fired when the current page changes. */
73
83
  pageChange?: EvSelectionChange;
74
84
  }
75
85
 
86
+ /**
87
+ * Properties for the {@link StackBox} component.
88
+ */
89
+
76
90
  export interface StackBoxProps extends Omit<ComponentProps,"content"> {
91
+ /** Name of the default page to display. */
77
92
  default: string;
93
+
94
+ /** List of stack items. */
78
95
  items: StackItem[];
96
+
97
+ /** Callback for page change events. */
79
98
  pageChange?: EventCallback<EvSelectionChange>;
80
99
  }
81
100
 
82
- /**
83
- *
84
- */
85
101
 
86
102
  interface StackItemEx extends StackItem {
87
103
  page: Component;
88
104
  }
89
105
 
90
106
  /**
91
- *
107
+ * A stack of widgets where only one widget is visible at a time.
108
+ * The CSS class for this component is automatically generated as `x4stackbox`.
92
109
  */
93
110
 
94
111
  @class_ns( "x4" )
@@ -114,6 +131,11 @@ export class StackBox<P extends StackBoxProps = StackBoxProps, E extends StackeB
114
131
  }
115
132
  }
116
133
 
134
+ /**
135
+ * Adds a new item to the stack.
136
+ * @param item - The item to add.
137
+ */
138
+
117
139
  addItem( item: StackItem ) {
118
140
  this._items.push( {
119
141
  name: item.name,
@@ -122,6 +144,11 @@ export class StackBox<P extends StackBoxProps = StackBoxProps, E extends StackeB
122
144
  });
123
145
  }
124
146
 
147
+ /**
148
+ * Removes an item from the stack by its name.
149
+ * @param name - The name of the item to remove.
150
+ */
151
+
125
152
  removeItem( name: string ) {
126
153
  const index = this._items.findIndex( x => x.name==name );
127
154
  if( index>=0 ) {
@@ -134,10 +161,17 @@ export class StackBox<P extends StackBoxProps = StackBoxProps, E extends StackeB
134
161
  }
135
162
  }
136
163
 
164
+ /**
165
+ * Selects a page by its name.
166
+ * @param name - The name of the page to select.
167
+ * @returns The selected page component, if any.
168
+ */
169
+
137
170
  select( name: string ) {
138
171
  let sel = this.query( `:scope > .selected` );
139
172
  if( sel ) {
140
173
  sel.setClass( "selected", false );
174
+ (sel as any).deactivate?.( );
141
175
  }
142
176
 
143
177
  this._cur = this._items.findIndex( x => x.name==name );
@@ -181,8 +215,10 @@ export class StackBox<P extends StackBoxProps = StackBoxProps, E extends StackeB
181
215
  }
182
216
 
183
217
  /**
184
- *
185
- */
218
+ * Retrieves a page by its name.
219
+ * @param name - The name of the page to retrieve.
220
+ * @returns The page content, if found.
221
+ */
186
222
 
187
223
  getPage( name: string ) {
188
224
  const pg = this._items.find( x => x.name==name );
@@ -190,24 +226,28 @@ export class StackBox<P extends StackBoxProps = StackBoxProps, E extends StackeB
190
226
  }
191
227
 
192
228
  /**
193
- *
194
- */
229
+ * Gets the total number of pages in the stack.
230
+ * @returns The number of pages.
231
+ */
195
232
 
196
233
  getPageCount( ) {
197
234
  return this._items.length;
198
235
  }
199
236
 
200
237
  /**
201
- *
202
- */
238
+ * Enumerates the names of all pages in the stack.
239
+ * @returns An array of page names.
240
+ */
203
241
 
204
242
  enumPageNames( ) {
205
243
  return this._items.map( x => x.name );
206
244
  }
207
245
 
208
246
  /**
209
- *
210
- */
247
+ * Retrieves a stack item by its name.
248
+ * @param name - The name of the item to retrieve.
249
+ * @returns The stack item, if found.
250
+ */
211
251
 
212
252
  getItem( name: string ) {
213
253
  const pg = this._items.find( x => x.name==name );
@@ -215,8 +255,9 @@ export class StackBox<P extends StackBoxProps = StackBoxProps, E extends StackeB
215
255
  }
216
256
 
217
257
  /**
218
- *
219
- */
258
+ * Gets the name of the currently selected page.
259
+ * @returns The name of the current page, if any.
260
+ */
220
261
 
221
262
  getCurPage( ) {
222
263
  const c = this._items[this._cur];
@@ -227,8 +268,19 @@ export class StackBox<P extends StackBoxProps = StackBoxProps, E extends StackeB
227
268
  // :: ASSIST BOX ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
228
269
 
229
270
 
271
+ /**
272
+ * A specialized stack box for assisted navigation, such as wizards or carousels.
273
+ * The CSS class for this component is automatically generated as `x4assistbox`.
274
+ */
275
+
230
276
  @class_ns( "x4" )
231
277
  export class AssistBox extends StackBox {
278
+
279
+ /**
280
+ * Selects the next or previous page in the stack.
281
+ * @param nxt - If `true`, selects the next page; otherwise, selects the previous page.
282
+ */
283
+
232
284
  selectNextPage( nxt = true ) {
233
285
  let p;
234
286
  if( nxt && this._cur<this._items.length-1 ) {
@@ -243,10 +295,20 @@ export class AssistBox extends StackBox {
243
295
  }
244
296
  }
245
297
 
298
+ /**
299
+ * Checks if the current page is the first page.
300
+ * @returns `true` if the current page is the first page.
301
+ */
302
+
246
303
  isFirstPage( ) {
247
304
  return this._cur==0;
248
305
  }
249
306
 
307
+ /**
308
+ * Checks if the current page is the last page.
309
+ * @returns `true` if the current page is the last page.
310
+ */
311
+
250
312
  isLastPage( ) {
251
313
  return this._cur==this._items.length-1;
252
314
  }
@@ -268,6 +330,11 @@ export interface GridBoxProps extends Omit<BoxProps,"content"> {
268
330
  items?: GridBoxItem[];
269
331
  }
270
332
 
333
+ /**
334
+ * Grid-based layout container.
335
+ * Auto-generates CSS class: `x4gridbox`.
336
+ */
337
+
271
338
  @class_ns("x4")
272
339
  export class GridBox<P extends GridBoxProps=GridBoxProps,E extends ComponentEvents=ComponentEvents> extends Box<P,E> {
273
340
 
@@ -287,6 +354,11 @@ export class GridBox<P extends GridBoxProps=GridBoxProps,E extends ComponentEven
287
354
  }
288
355
  }
289
356
 
357
+ /**
358
+ * Sets grid rows (e.g., `2`, `"1fr 2fr"`, `["1fr", "2fr"]`).
359
+ * @param r - Rows definition.
360
+ */
361
+
290
362
  setRows( r: number | string | string[] ) {
291
363
  if( isArray(r) ) {
292
364
  r = r.join( " " );
@@ -298,6 +370,11 @@ export class GridBox<P extends GridBoxProps=GridBoxProps,E extends ComponentEven
298
370
  this.setStyleValue( "gridTemplateRows", r );
299
371
  }
300
372
 
373
+ /**
374
+ * Sets grid columns (e.g., `3`, `"1fr 1fr"`, `["auto", "1fr"]`).
375
+ * @param r - Columns definition.
376
+ */
377
+
301
378
  setCols( r: number | string | string[] ) {
302
379
  if( isArray(r) ) {
303
380
  r = r.join( " " );
@@ -309,23 +386,38 @@ export class GridBox<P extends GridBoxProps=GridBoxProps,E extends ComponentEven
309
386
  this.setStyleValue( "gridTemplateColumns", r );
310
387
  }
311
388
 
389
+ /**
390
+ * Sets the number of rows.
391
+ * @param n - Row count.
392
+ */
393
+
312
394
  setRowCount( n: number ) {
313
395
  this.setStyleValue( "gridTemplateRows", `repeat(${n})` );
314
396
  }
315
397
 
398
+ /**
399
+ * Sets the number of columns.
400
+ * @param n - Column count.
401
+ */
402
+
316
403
  setColCount( n: number ) {
317
404
  this.setStyleValue( "gridTemplateColumns", `repeat(${n})` );
318
405
  }
319
406
 
320
407
  /**
321
- * @param t "a a a" "b c c" "b c c"
322
- * user item.setAttribute( "grid-area", "a" );
323
- */
408
+ * Sets grid template areas (e.g., `["a a", "b c"]`).
409
+ * @param t - Template strings.
410
+ */
324
411
 
325
412
  setTemplate( t: string[] ) {
326
413
  this.setAttribute( "grid-template-area", t.map( x => '"' + x + '"' ).join(" ") );
327
414
  }
328
415
 
416
+ /**
417
+ * Places items at specific grid positions.
418
+ * @param items - Array of `{row, col, item}`.
419
+ */
420
+
329
421
  setItems( items: GridBoxItem[] ) {
330
422
  items.forEach( x => {
331
423
  x.item.setStyle( {
@@ -348,6 +440,11 @@ interface MasonryProps extends Omit<BoxProps,"content"> {
348
440
  items: Component[];
349
441
  }
350
442
 
443
+ /**
444
+ * Masonry-style layout (Pinterest-like).
445
+ * Auto-generates CSS class: `x4masonrybox`.
446
+ */
447
+
351
448
  @class_ns("x4")
352
449
  export class MasonryBox extends Box<MasonryProps> {
353
450
 
@@ -363,6 +460,11 @@ export class MasonryBox extends Box<MasonryProps> {
363
460
  }
364
461
  }
365
462
 
463
+ /**
464
+ * Resizes a single masonry item.
465
+ * @param item - Item to resize.
466
+ */
467
+
366
468
  resizeItem(item: Component) {
367
469
  const style = this.getComputedStyle();
368
470
 
@@ -381,13 +483,22 @@ export class MasonryBox extends Box<MasonryProps> {
381
483
  }
382
484
  }
383
485
 
486
+ /**
487
+ * Resizes all items to fit the grid.
488
+ */
489
+
384
490
  resizeAllItems( ) {
385
491
  const els = this.queryAll( ".item" );
386
- els.forEach( itm => {;
492
+ els.forEach( itm => {
387
493
  this.resizeItem( itm );
388
494
  } );
389
495
  }
390
496
 
497
+ /**
498
+ * Sets masonry items.
499
+ * @param items - Array of components.
500
+ */
501
+
391
502
  setItems( items: Component[] ) {
392
503
  const els = items.map( x => {
393
504
  return new Box( {