tyrell-components 1.0.0-RC13 → 1.0.0-RC15

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 (358) hide show
  1. package/README.md +10 -2
  2. package/css/tyrell-theme.css +192 -180
  3. package/css/tyrell.css +23 -0
  4. package/dist/tyrell-colors-static.css +1 -316
  5. package/dist/tyrell-theme.css +1 -1454
  6. package/dist/tyrell.css +1 -1371
  7. package/dist/tyrell.js +1 -1
  8. package/lib/base/ty-component.d.ts +20 -10
  9. package/lib/base/ty-component.js +196 -319
  10. package/lib/components/button.d.ts +3 -17
  11. package/lib/components/button.js +261 -295
  12. package/lib/components/calendar-month.d.ts +4 -50
  13. package/lib/components/calendar-month.js +443 -582
  14. package/lib/components/calendar-navigation.d.ts +3 -48
  15. package/lib/components/calendar-navigation.js +239 -362
  16. package/lib/components/calendar.d.ts +8 -83
  17. package/lib/components/calendar.js +616 -829
  18. package/lib/components/checkbox.d.ts +5 -72
  19. package/lib/components/checkbox.js +273 -416
  20. package/lib/components/copy.d.ts +4 -57
  21. package/lib/components/copy.js +280 -397
  22. package/lib/components/date-picker.d.ts +21 -163
  23. package/lib/components/date-picker.js +1143 -1674
  24. package/lib/components/file-upload.d.ts +9 -15
  25. package/lib/components/file-upload.js +404 -426
  26. package/lib/components/icon.d.ts +3 -24
  27. package/lib/components/icon.js +141 -230
  28. package/lib/components/input.d.ts +8 -108
  29. package/lib/components/input.js +593 -784
  30. package/lib/components/modal.d.ts +17 -26
  31. package/lib/components/modal.js +340 -484
  32. package/lib/components/option.d.ts +2 -9
  33. package/lib/components/option.js +168 -216
  34. package/lib/components/popup.d.ts +2 -17
  35. package/lib/components/popup.js +249 -380
  36. package/lib/components/radio.d.ts +5 -25
  37. package/lib/components/radio.js +407 -461
  38. package/lib/components/resize-observer.d.ts +3 -30
  39. package/lib/components/resize-observer.js +69 -103
  40. package/lib/components/scroll-container.d.ts +2 -12
  41. package/lib/components/scroll-container.js +293 -338
  42. package/lib/components/select.d.ts +87 -159
  43. package/lib/components/select.js +1609 -2090
  44. package/lib/components/selected-tags.d.ts +5 -48
  45. package/lib/components/selected-tags.js +188 -276
  46. package/lib/components/step.d.ts +1 -6
  47. package/lib/components/step.js +62 -68
  48. package/lib/components/switch.d.ts +1 -12
  49. package/lib/components/switch.js +214 -247
  50. package/lib/components/tab.d.ts +1 -6
  51. package/lib/components/tab.js +62 -69
  52. package/lib/components/tabs.d.ts +6 -63
  53. package/lib/components/tabs.js +545 -777
  54. package/lib/components/tag.d.ts +3 -37
  55. package/lib/components/tag.js +236 -335
  56. package/lib/components/textarea.d.ts +7 -87
  57. package/lib/components/textarea.js +457 -627
  58. package/lib/components/tooltip.d.ts +3 -11
  59. package/lib/components/tooltip.js +307 -443
  60. package/lib/components/wizard.d.ts +6 -54
  61. package/lib/components/wizard.js +405 -618
  62. package/lib/icons/fontawesome/brands.d.ts +0 -1
  63. package/lib/icons/fontawesome/brands.js +0 -8
  64. package/lib/icons/fontawesome/regular.d.ts +0 -1
  65. package/lib/icons/fontawesome/regular.js +0 -8
  66. package/lib/icons/fontawesome/solid.d.ts +0 -1
  67. package/lib/icons/fontawesome/solid.js +0 -8
  68. package/lib/icons/heroicons/micro.d.ts +0 -1
  69. package/lib/icons/heroicons/micro.js +392 -400
  70. package/lib/icons/heroicons/mini.d.ts +0 -1
  71. package/lib/icons/heroicons/mini.js +382 -390
  72. package/lib/icons/heroicons/outline.d.ts +0 -1
  73. package/lib/icons/heroicons/outline.js +337 -345
  74. package/lib/icons/heroicons/solid.d.ts +0 -1
  75. package/lib/icons/heroicons/solid.js +407 -415
  76. package/lib/icons/lucide.d.ts +0 -1
  77. package/lib/icons/lucide.js +24479 -26351
  78. package/lib/icons/material/filled.d.ts +0 -1
  79. package/lib/icons/material/filled.js +9653 -9663
  80. package/lib/icons/material/outlined.d.ts +0 -1
  81. package/lib/icons/material/outlined.js +10271 -10281
  82. package/lib/icons/material/round.d.ts +0 -1
  83. package/lib/icons/material/round.js +10495 -10505
  84. package/lib/icons/material/sharp.d.ts +0 -1
  85. package/lib/icons/material/sharp.js +9905 -9915
  86. package/lib/icons/material/two-tone.d.ts +0 -1
  87. package/lib/icons/material/two-tone.js +12792 -12802
  88. package/lib/index.d.ts +0 -1
  89. package/lib/index.js +21 -41
  90. package/lib/styles/button.d.ts +2 -20
  91. package/lib/styles/button.js +202 -404
  92. package/lib/styles/calendar-month.d.ts +1 -5
  93. package/lib/styles/calendar-month.js +127 -244
  94. package/lib/styles/calendar-navigation.d.ts +2 -6
  95. package/lib/styles/calendar-navigation.js +64 -104
  96. package/lib/styles/calendar.d.ts +1 -2
  97. package/lib/styles/calendar.js +9 -22
  98. package/lib/styles/checkbox.d.ts +0 -1
  99. package/lib/styles/checkbox.js +45 -94
  100. package/lib/styles/copy.d.ts +0 -1
  101. package/lib/styles/copy.js +67 -106
  102. package/lib/styles/custom-scrollbar.d.ts +1 -2
  103. package/lib/styles/custom-scrollbar.js +80 -115
  104. package/lib/styles/date-picker.d.ts +1 -5
  105. package/lib/styles/date-picker.js +261 -335
  106. package/lib/styles/field-size.d.ts +6 -0
  107. package/lib/styles/field-size.js +91 -0
  108. package/lib/styles/file-upload.d.ts +1 -2
  109. package/lib/styles/file-upload.js +143 -188
  110. package/lib/styles/icon.d.ts +2 -6
  111. package/lib/styles/icon.js +92 -170
  112. package/lib/styles/input.d.ts +1 -6
  113. package/lib/styles/input.js +125 -290
  114. package/lib/styles/modal.d.ts +1 -2
  115. package/lib/styles/modal.js +71 -108
  116. package/lib/styles/option.d.ts +2 -6
  117. package/lib/styles/option.js +49 -64
  118. package/lib/styles/popup.d.ts +1 -2
  119. package/lib/styles/popup.js +42 -77
  120. package/lib/styles/radio.d.ts +0 -1
  121. package/lib/styles/radio.js +69 -110
  122. package/lib/styles/resize-observer.d.ts +1 -2
  123. package/lib/styles/resize-observer.js +2 -12
  124. package/lib/styles/scroll-container.d.ts +1 -2
  125. package/lib/styles/scroll-container.js +100 -149
  126. package/lib/styles/select-base.d.ts +0 -1
  127. package/lib/styles/select-base.js +597 -785
  128. package/lib/styles/select.d.ts +1 -2
  129. package/lib/styles/select.js +140 -236
  130. package/lib/styles/step.d.ts +1 -2
  131. package/lib/styles/step.js +22 -33
  132. package/lib/styles/switch.d.ts +0 -1
  133. package/lib/styles/switch.js +34 -73
  134. package/lib/styles/tab.d.ts +1 -2
  135. package/lib/styles/tab.js +22 -34
  136. package/lib/styles/tabs.d.ts +3 -11
  137. package/lib/styles/tabs.js +190 -222
  138. package/lib/styles/tag.d.ts +1 -5
  139. package/lib/styles/tag.js +136 -218
  140. package/lib/styles/textarea.d.ts +1 -2
  141. package/lib/styles/textarea.js +210 -319
  142. package/lib/styles/tooltip.d.ts +0 -1
  143. package/lib/styles/tooltip.js +3 -13
  144. package/lib/styles/wizard.d.ts +5 -21
  145. package/lib/styles/wizard.js +170 -306
  146. package/lib/types/common.d.ts +2 -2
  147. package/lib/types/common.js +6 -17
  148. package/lib/utils/calendar-utils.d.ts +4 -21
  149. package/lib/utils/calendar-utils.js +100 -273
  150. package/lib/utils/custom-scrollbar.d.ts +6 -20
  151. package/lib/utils/custom-scrollbar.js +273 -317
  152. package/lib/utils/flavor-sheet.d.ts +0 -1
  153. package/lib/utils/flavor-sheet.js +14 -37
  154. package/lib/utils/icon-registry.d.ts +0 -2
  155. package/lib/utils/icon-registry.js +137 -243
  156. package/lib/utils/icons.d.ts +0 -1
  157. package/lib/utils/icons.js +0 -9
  158. package/lib/utils/loader-registry.d.ts +0 -1
  159. package/lib/utils/loader-registry.js +3 -35
  160. package/lib/utils/locale.d.ts +2 -23
  161. package/lib/utils/locale.js +34 -120
  162. package/lib/utils/mobile.d.ts +0 -1
  163. package/lib/utils/mobile.js +1 -18
  164. package/lib/utils/number-format.d.ts +6 -3
  165. package/lib/utils/number-format.js +54 -110
  166. package/lib/utils/positioning.d.ts +50 -7
  167. package/lib/utils/positioning.js +224 -234
  168. package/lib/utils/property-capture.d.ts +5 -27
  169. package/lib/utils/property-capture.js +36 -144
  170. package/lib/utils/property-manager.d.ts +0 -1
  171. package/lib/utils/property-manager.js +126 -196
  172. package/lib/utils/resize-observer.d.ts +0 -1
  173. package/lib/utils/resize-observer.js +23 -59
  174. package/lib/utils/scroll-lock.d.ts +4 -11
  175. package/lib/utils/scroll-lock.js +65 -172
  176. package/lib/utils/styles.d.ts +0 -1
  177. package/lib/utils/styles.js +17 -41
  178. package/lib/version.d.ts +1 -2
  179. package/lib/version.js +1 -11
  180. package/package.json +4 -4
  181. package/lib/base/ty-component.d.ts.map +0 -1
  182. package/lib/base/ty-component.js.map +0 -1
  183. package/lib/components/button.d.ts.map +0 -1
  184. package/lib/components/button.js.map +0 -1
  185. package/lib/components/calendar-month.d.ts.map +0 -1
  186. package/lib/components/calendar-month.js.map +0 -1
  187. package/lib/components/calendar-navigation.d.ts.map +0 -1
  188. package/lib/components/calendar-navigation.js.map +0 -1
  189. package/lib/components/calendar.d.ts.map +0 -1
  190. package/lib/components/calendar.js.map +0 -1
  191. package/lib/components/checkbox.d.ts.map +0 -1
  192. package/lib/components/checkbox.js.map +0 -1
  193. package/lib/components/copy.d.ts.map +0 -1
  194. package/lib/components/copy.js.map +0 -1
  195. package/lib/components/date-picker.d.ts.map +0 -1
  196. package/lib/components/date-picker.js.map +0 -1
  197. package/lib/components/file-upload.d.ts.map +0 -1
  198. package/lib/components/file-upload.js.map +0 -1
  199. package/lib/components/icon.d.ts.map +0 -1
  200. package/lib/components/icon.js.map +0 -1
  201. package/lib/components/input.d.ts.map +0 -1
  202. package/lib/components/input.js.map +0 -1
  203. package/lib/components/modal.d.ts.map +0 -1
  204. package/lib/components/modal.js.map +0 -1
  205. package/lib/components/option.d.ts.map +0 -1
  206. package/lib/components/option.js.map +0 -1
  207. package/lib/components/popup.d.ts.map +0 -1
  208. package/lib/components/popup.js.map +0 -1
  209. package/lib/components/radio.d.ts.map +0 -1
  210. package/lib/components/radio.js.map +0 -1
  211. package/lib/components/resize-observer.d.ts.map +0 -1
  212. package/lib/components/resize-observer.js.map +0 -1
  213. package/lib/components/scroll-container.d.ts.map +0 -1
  214. package/lib/components/scroll-container.js.map +0 -1
  215. package/lib/components/select.d.ts.map +0 -1
  216. package/lib/components/select.js.map +0 -1
  217. package/lib/components/selected-tags.d.ts.map +0 -1
  218. package/lib/components/selected-tags.js.map +0 -1
  219. package/lib/components/step.d.ts.map +0 -1
  220. package/lib/components/step.js.map +0 -1
  221. package/lib/components/switch.d.ts.map +0 -1
  222. package/lib/components/switch.js.map +0 -1
  223. package/lib/components/tab.d.ts.map +0 -1
  224. package/lib/components/tab.js.map +0 -1
  225. package/lib/components/tabs.d.ts.map +0 -1
  226. package/lib/components/tabs.js.map +0 -1
  227. package/lib/components/tag.d.ts.map +0 -1
  228. package/lib/components/tag.js.map +0 -1
  229. package/lib/components/textarea.d.ts.map +0 -1
  230. package/lib/components/textarea.js.map +0 -1
  231. package/lib/components/tooltip.d.ts.map +0 -1
  232. package/lib/components/tooltip.js.map +0 -1
  233. package/lib/components/wizard.d.ts.map +0 -1
  234. package/lib/components/wizard.js.map +0 -1
  235. package/lib/icons/fontawesome/brands.d.ts.map +0 -1
  236. package/lib/icons/fontawesome/brands.js.map +0 -1
  237. package/lib/icons/fontawesome/regular.d.ts.map +0 -1
  238. package/lib/icons/fontawesome/regular.js.map +0 -1
  239. package/lib/icons/fontawesome/solid.d.ts.map +0 -1
  240. package/lib/icons/fontawesome/solid.js.map +0 -1
  241. package/lib/icons/heroicons/micro.d.ts.map +0 -1
  242. package/lib/icons/heroicons/micro.js.map +0 -1
  243. package/lib/icons/heroicons/mini.d.ts.map +0 -1
  244. package/lib/icons/heroicons/mini.js.map +0 -1
  245. package/lib/icons/heroicons/outline.d.ts.map +0 -1
  246. package/lib/icons/heroicons/outline.js.map +0 -1
  247. package/lib/icons/heroicons/solid.d.ts.map +0 -1
  248. package/lib/icons/heroicons/solid.js.map +0 -1
  249. package/lib/icons/lucide.d.ts.map +0 -1
  250. package/lib/icons/lucide.js.map +0 -1
  251. package/lib/icons/material/filled.d.ts.map +0 -1
  252. package/lib/icons/material/filled.js.map +0 -1
  253. package/lib/icons/material/outlined.d.ts.map +0 -1
  254. package/lib/icons/material/outlined.js.map +0 -1
  255. package/lib/icons/material/round.d.ts.map +0 -1
  256. package/lib/icons/material/round.js.map +0 -1
  257. package/lib/icons/material/sharp.d.ts.map +0 -1
  258. package/lib/icons/material/sharp.js.map +0 -1
  259. package/lib/icons/material/two-tone.d.ts.map +0 -1
  260. package/lib/icons/material/two-tone.js.map +0 -1
  261. package/lib/index.d.ts.map +0 -1
  262. package/lib/index.js.map +0 -1
  263. package/lib/styles/button.d.ts.map +0 -1
  264. package/lib/styles/button.js.map +0 -1
  265. package/lib/styles/calendar-month.d.ts.map +0 -1
  266. package/lib/styles/calendar-month.js.map +0 -1
  267. package/lib/styles/calendar-navigation.d.ts.map +0 -1
  268. package/lib/styles/calendar-navigation.js.map +0 -1
  269. package/lib/styles/calendar.d.ts.map +0 -1
  270. package/lib/styles/calendar.js.map +0 -1
  271. package/lib/styles/checkbox.d.ts.map +0 -1
  272. package/lib/styles/checkbox.js.map +0 -1
  273. package/lib/styles/copy.d.ts.map +0 -1
  274. package/lib/styles/copy.js.map +0 -1
  275. package/lib/styles/custom-scrollbar.d.ts.map +0 -1
  276. package/lib/styles/custom-scrollbar.js.map +0 -1
  277. package/lib/styles/date-picker.d.ts.map +0 -1
  278. package/lib/styles/date-picker.js.map +0 -1
  279. package/lib/styles/file-upload.d.ts.map +0 -1
  280. package/lib/styles/file-upload.js.map +0 -1
  281. package/lib/styles/icon.d.ts.map +0 -1
  282. package/lib/styles/icon.js.map +0 -1
  283. package/lib/styles/input.d.ts.map +0 -1
  284. package/lib/styles/input.js.map +0 -1
  285. package/lib/styles/modal.d.ts.map +0 -1
  286. package/lib/styles/modal.js.map +0 -1
  287. package/lib/styles/multiselect.d.ts +0 -8
  288. package/lib/styles/multiselect.d.ts.map +0 -1
  289. package/lib/styles/multiselect.js +0 -849
  290. package/lib/styles/multiselect.js.map +0 -1
  291. package/lib/styles/option.d.ts.map +0 -1
  292. package/lib/styles/option.js.map +0 -1
  293. package/lib/styles/popup.d.ts.map +0 -1
  294. package/lib/styles/popup.js.map +0 -1
  295. package/lib/styles/radio.d.ts.map +0 -1
  296. package/lib/styles/radio.js.map +0 -1
  297. package/lib/styles/resize-observer.d.ts.map +0 -1
  298. package/lib/styles/resize-observer.js.map +0 -1
  299. package/lib/styles/scroll-container.d.ts.map +0 -1
  300. package/lib/styles/scroll-container.js.map +0 -1
  301. package/lib/styles/select-base.d.ts.map +0 -1
  302. package/lib/styles/select-base.js.map +0 -1
  303. package/lib/styles/select.d.ts.map +0 -1
  304. package/lib/styles/select.js.map +0 -1
  305. package/lib/styles/step.d.ts.map +0 -1
  306. package/lib/styles/step.js.map +0 -1
  307. package/lib/styles/switch.d.ts.map +0 -1
  308. package/lib/styles/switch.js.map +0 -1
  309. package/lib/styles/tab.d.ts.map +0 -1
  310. package/lib/styles/tab.js.map +0 -1
  311. package/lib/styles/tabs.d.ts.map +0 -1
  312. package/lib/styles/tabs.js.map +0 -1
  313. package/lib/styles/tag.d.ts.map +0 -1
  314. package/lib/styles/tag.js.map +0 -1
  315. package/lib/styles/textarea.d.ts.map +0 -1
  316. package/lib/styles/textarea.js.map +0 -1
  317. package/lib/styles/tooltip.d.ts.map +0 -1
  318. package/lib/styles/tooltip.js.map +0 -1
  319. package/lib/styles/wizard.d.ts.map +0 -1
  320. package/lib/styles/wizard.js.map +0 -1
  321. package/lib/types/common.d.ts.map +0 -1
  322. package/lib/types/common.js.map +0 -1
  323. package/lib/utils/calendar-utils.d.ts.map +0 -1
  324. package/lib/utils/calendar-utils.js.map +0 -1
  325. package/lib/utils/custom-scrollbar.d.ts.map +0 -1
  326. package/lib/utils/custom-scrollbar.js.map +0 -1
  327. package/lib/utils/flavor-sheet.d.ts.map +0 -1
  328. package/lib/utils/flavor-sheet.js.map +0 -1
  329. package/lib/utils/icon-registry.d.ts.map +0 -1
  330. package/lib/utils/icon-registry.js.map +0 -1
  331. package/lib/utils/icons.d.ts.map +0 -1
  332. package/lib/utils/icons.js.map +0 -1
  333. package/lib/utils/loader-registry.d.ts.map +0 -1
  334. package/lib/utils/loader-registry.js.map +0 -1
  335. package/lib/utils/locale.d.ts.map +0 -1
  336. package/lib/utils/locale.js.map +0 -1
  337. package/lib/utils/mobile.d.ts.map +0 -1
  338. package/lib/utils/mobile.js.map +0 -1
  339. package/lib/utils/number-format.d.ts.map +0 -1
  340. package/lib/utils/number-format.js.map +0 -1
  341. package/lib/utils/parse-boolean.d.ts +0 -39
  342. package/lib/utils/parse-boolean.d.ts.map +0 -1
  343. package/lib/utils/parse-boolean.js +0 -58
  344. package/lib/utils/parse-boolean.js.map +0 -1
  345. package/lib/utils/positioning.d.ts.map +0 -1
  346. package/lib/utils/positioning.js.map +0 -1
  347. package/lib/utils/property-capture.d.ts.map +0 -1
  348. package/lib/utils/property-capture.js.map +0 -1
  349. package/lib/utils/property-manager.d.ts.map +0 -1
  350. package/lib/utils/property-manager.js.map +0 -1
  351. package/lib/utils/resize-observer.d.ts.map +0 -1
  352. package/lib/utils/resize-observer.js.map +0 -1
  353. package/lib/utils/scroll-lock.d.ts.map +0 -1
  354. package/lib/utils/scroll-lock.js.map +0 -1
  355. package/lib/utils/styles.d.ts.map +0 -1
  356. package/lib/utils/styles.js.map +0 -1
  357. package/lib/version.d.ts.map +0 -1
  358. package/lib/version.js.map +0 -1
@@ -1,40 +1,17 @@
1
- /**
2
- * Custom (non-built-in) flavor support.
3
- *
4
- * Built-in flavors get static per-flavor CSS in each component's stylesheet.
5
- * Any other flavor string is a custom flavor: the component generates the
6
- * same wiring at runtime, pointed at the user's design tokens
7
- * (--ty-color-X / --ty-bg-X / --ty-solid-X / ...), and adopts it as a
8
- * constructed stylesheet.
9
- *
10
- * Why an adopted sheet: render() implementations replace shadowRoot.innerHTML
11
- * (which would destroy an injected <style> element), and inline style on the
12
- * host would defeat page-level overrides. Adopted sheets survive renders, and
13
- * outer-document rules on the host still take precedence over :host rules —
14
- * so `ty-tag[flavor="X"] { --tag-bg: ... }` escape hatches keep working.
15
- */
16
1
  import { FLAVORS } from '../types/common.js';
17
- /**
18
- * Keep a shadow root's custom-flavor sheet in sync with the current flavor.
19
- *
20
- * Built-in flavors (and anything that isn't a plain identifier, so attribute
21
- * values can't inject CSS) remove the sheet. Custom flavors get `css(parts)`
22
- * adopted into the shadow root. Returns the sheet to store for the next call.
23
- */
24
2
  export function syncCustomFlavorSheet(shadow, sheet, flavor, css) {
25
- const full = String(flavor || '');
26
- const base = full.replace(/[+-]$/, '');
27
- if (FLAVORS.includes(base) || !/^[A-Za-z][A-Za-z0-9_-]*$/.test(base)) {
28
- if (sheet) {
29
- shadow.adoptedStyleSheets = shadow.adoptedStyleSheets.filter((s) => s !== sheet);
30
- }
31
- return null;
32
- }
33
- if (!sheet) {
34
- sheet = new CSSStyleSheet();
35
- shadow.adoptedStyleSheets = [...shadow.adoptedStyleSheets, sheet];
36
- }
37
- sheet.replaceSync(css({ flavor: full, base, shade: full.slice(base.length) }));
38
- return sheet;
3
+ const full = String(flavor || '');
4
+ const base = full.replace(/[+-]$/, '');
5
+ if (FLAVORS.includes(base) || !/^[A-Za-z][A-Za-z0-9_-]*$/.test(base)) {
6
+ if (sheet) {
7
+ shadow.adoptedStyleSheets = shadow.adoptedStyleSheets.filter((s) => s !== sheet);
8
+ }
9
+ return null;
10
+ }
11
+ if (!sheet) {
12
+ sheet = new CSSStyleSheet();
13
+ shadow.adoptedStyleSheets = [...shadow.adoptedStyleSheets, sheet];
14
+ }
15
+ sheet.replaceSync(css({ flavor: full, base, shade: full.slice(base.length) }));
16
+ return sheet;
39
17
  }
40
- //# sourceMappingURL=flavor-sheet.js.map
@@ -1,7 +1,6 @@
1
1
  /**
2
2
  * Icon Registry System
3
3
  * Simple icon storage and retrieval with Cache API persistence
4
- * PORTED FROM: clj/ty/icons.cljs
5
4
  */
6
5
  /**
7
6
  * Read icon directly from cache (for immediate rendering)
@@ -62,4 +61,3 @@ export declare function getCacheInfo(): Promise<{
62
61
  available: boolean;
63
62
  iconCount?: number;
64
63
  }>;
65
- //# sourceMappingURL=icon-registry.d.ts.map
@@ -1,269 +1,163 @@
1
- /**
2
- * Icon Registry System
3
- * Simple icon storage and retrieval with Cache API persistence
4
- * PORTED FROM: clj/ty/icons.cljs
5
- */
6
1
  import { VERSION } from '../version.js';
7
- /** Icon registry - maps icon names to SVG strings */
8
2
  const iconRegistry = new Map();
9
- /** Watchers for registry changes - now receives Set of changed icon names */
10
3
  const watchers = new Map();
11
- /** Track which icons each watcher cares about (for selective notification) */
12
4
  const watcherIconNames = new Map();
13
- /** Pending notifications - batched for performance */
14
5
  let pendingNotifications = null;
15
6
  let notificationTimer = null;
16
- /** Cache API configuration */
17
7
  const CACHE_NAME = `ty-icons-v${VERSION}`;
18
- // Use a fake URL base for Cache API (requires valid URL format)
19
8
  const CACHE_URL_BASE = 'https://ty-icons.local/';
20
- /** Track in-flight cache reads to avoid duplicate work */
21
9
  const cacheReadPromises = new Map();
22
- /** Flag to track if old caches have been cleared */
23
10
  let oldCachesCleared = false;
24
- /**
25
- * Clear old cache versions on first use
26
- * This runs lazily the first time any icon is requested
27
- */
28
11
  async function clearOldCaches() {
29
- if (oldCachesCleared || !('caches' in window))
30
- return;
31
- oldCachesCleared = true;
32
- try {
33
- const cacheNames = await caches.keys();
34
- const oldCaches = cacheNames.filter(name => name.startsWith('ty-icons-v') && name !== CACHE_NAME);
35
- await Promise.all(oldCaches.map(name => caches.delete(name)));
36
- if (oldCaches.length > 0) {
37
- console.log(`🗑️ Cleared ${oldCaches.length} old icon cache(s)`);
38
- }
39
- }
40
- catch (err) {
41
- console.warn('[ty-icons] Failed to clear old caches:', err);
42
- }
43
- }
44
- /**
45
- * Cache an icon in Cache API (non-blocking background operation)
46
- * @param name Icon name
47
- * @param svg SVG string
48
- */
12
+ if (oldCachesCleared || !('caches' in window))
13
+ return;
14
+ oldCachesCleared = true;
15
+ try {
16
+ const cacheNames = await caches.keys();
17
+ const oldCaches = cacheNames.filter(name => name.startsWith('ty-icons-v') && name !== CACHE_NAME);
18
+ await Promise.all(oldCaches.map(name => caches.delete(name)));
19
+ if (oldCaches.length > 0) {
20
+ console.log(`🗑️ Cleared ${oldCaches.length} old icon cache(s)`);
21
+ }
22
+ }
23
+ catch (err) {
24
+ console.warn('[ty-icons] Failed to clear old caches:', err);
25
+ }
26
+ }
49
27
  async function cacheIcon(name, svg) {
50
- if (!('caches' in window))
51
- return;
52
- try {
53
- const cache = await caches.open(CACHE_NAME);
54
- const response = new Response(svg, {
55
- headers: { 'Content-Type': 'image/svg+xml' }
56
- });
57
- // Cache API requires valid URLs
58
- await cache.put(`${CACHE_URL_BASE}${name}`, response);
59
- }
60
- catch (err) {
61
- // Silent fail - caching is an optimization, not critical
62
- console.warn(`[ty-icons] Failed to cache icon "${name}":`, err);
63
- }
64
- }
65
- /**
66
- * Read icon directly from cache (for immediate rendering)
67
- * This is the key function that prevents icon twitching!
68
- * @param name Icon name
69
- * @returns Promise<string | null> - SVG string from cache or null
70
- */
28
+ if (!('caches' in window))
29
+ return;
30
+ try {
31
+ const cache = await caches.open(CACHE_NAME);
32
+ const response = new Response(svg, {
33
+ headers: { 'Content-Type': 'image/svg+xml' }
34
+ });
35
+ await cache.put(`${CACHE_URL_BASE}${name}`, response);
36
+ }
37
+ catch (err) {
38
+ console.warn(`[ty-icons] Failed to cache icon "${name}":`, err);
39
+ }
40
+ }
71
41
  export async function getCachedIcon(name) {
72
- // Check if we already have a read in progress for this icon
73
- const existingPromise = cacheReadPromises.get(name);
74
- if (existingPromise) {
75
- return existingPromise;
76
- }
77
- // Create new read promise
78
- const readPromise = (async () => {
79
- try {
80
- // Clear old caches on first cache access
81
- await clearOldCaches();
82
- const cache = await caches.open(CACHE_NAME);
83
- const response = await cache.match(`${CACHE_URL_BASE}${name}`);
84
- if (response) {
85
- return await response.text();
86
- }
87
- }
88
- catch (err) {
89
- console.warn(`[ty-icons] Failed to read icon "${name}" from cache:`, err);
90
- }
91
- return null;
92
- })();
93
- // Store promise to avoid duplicate work
94
- cacheReadPromises.set(name, readPromise);
95
- // Clean up promise after completion
96
- readPromise.finally(() => {
97
- cacheReadPromises.delete(name);
98
- });
99
- return readPromise;
100
- }
101
- /**
102
- * Register multiple icons at once
103
- * Always updates memory and notifies watchers immediately
104
- * Cache update happens in background (only if different from cached version)
105
- * @param icons Object mapping icon names to SVG strings
106
- */
42
+ const existingPromise = cacheReadPromises.get(name);
43
+ if (existingPromise) {
44
+ return existingPromise;
45
+ }
46
+ const readPromise = (async () => {
47
+ try {
48
+ await clearOldCaches();
49
+ const cache = await caches.open(CACHE_NAME);
50
+ const response = await cache.match(`${CACHE_URL_BASE}${name}`);
51
+ if (response) {
52
+ return await response.text();
53
+ }
54
+ }
55
+ catch (err) {
56
+ console.warn(`[ty-icons] Failed to read icon "${name}" from cache:`, err);
57
+ }
58
+ return null;
59
+ })();
60
+ cacheReadPromises.set(name, readPromise);
61
+ readPromise.finally(() => {
62
+ cacheReadPromises.delete(name);
63
+ });
64
+ return readPromise;
65
+ }
107
66
  export function registerIcons(icons) {
108
- const changedIcons = new Set();
109
- Object.entries(icons).forEach(([name, svg]) => {
110
- // Always set in memory registry (fast, synchronous)
111
- iconRegistry.set(name, svg);
112
- changedIcons.add(name);
113
- // Compare with cache in background to avoid unnecessary cache writes
114
- /*getCachedIcon(name).then(cachedSvg => {
115
- // Only write to cache if content actually changed
116
- if (cachedSvg !== svg) {
117
- cacheIcon(name, svg).catch(() => {
118
- // Error already logged in cacheIcon
119
- })
120
- }
121
- // If cachedSvg === svg, skip cache write (already up to date)
122
- }).catch(() => {
123
- // No cached version or error reading cache - write new icon
124
- cacheIcon(name, svg).catch(() => {
125
- // Error already logged in cacheIcon
126
- })
127
- })
128
- */
129
- });
130
- // Notify watchers immediately (synchronous)
131
- if (changedIcons.size > 0) {
132
- scheduleNotification(changedIcons);
133
- }
134
- }
135
- /**
136
- * Lookup an icon by name from memory
137
- * NOTE: This does NOT check cache - use getCachedIcon() for that
138
- * @param name Icon name
139
- * @returns SVG string or undefined
140
- */
67
+ const changedIcons = new Set();
68
+ Object.entries(icons).forEach(([name, svg]) => {
69
+ iconRegistry.set(name, svg);
70
+ changedIcons.add(name);
71
+ });
72
+ if (changedIcons.size > 0) {
73
+ scheduleNotification(changedIcons);
74
+ }
75
+ }
141
76
  export function getIcon(name) {
142
- return iconRegistry.get(name);
143
- }
144
- /**
145
- * Check if an icon exists in memory
146
- * NOTE: This does NOT check cache
147
- * @param name Icon name
148
- * @returns true if icon is registered in memory
149
- */
77
+ return iconRegistry.get(name);
78
+ }
150
79
  export function hasIcon(name) {
151
- return iconRegistry.has(name);
80
+ return iconRegistry.has(name);
152
81
  }
153
- /**
154
- * Clear all registered icons from memory and cache
155
- */
156
82
  export async function clearIcons() {
157
- const allIcons = new Set(iconRegistry.keys());
158
- iconRegistry.clear();
159
- // Clear cache
160
- if ('caches' in window) {
161
- try {
162
- await caches.delete(CACHE_NAME);
163
- oldCachesCleared = false; // Allow re-clearing next time
164
- }
165
- catch (err) {
166
- console.warn('[ty-icons] Failed to clear icon cache:', err);
167
- }
168
- }
169
- scheduleNotification(allIcons);
170
- }
171
- /**
172
- * Add a watcher for registry changes
173
- * @param id Unique watcher ID
174
- * @param iconName Optional icon name to watch (for selective notification)
175
- * @param callback Function to call when watched icons change
176
- */
83
+ const allIcons = new Set(iconRegistry.keys());
84
+ iconRegistry.clear();
85
+ if ('caches' in window) {
86
+ try {
87
+ await caches.delete(CACHE_NAME);
88
+ oldCachesCleared = false;
89
+ }
90
+ catch (err) {
91
+ console.warn('[ty-icons] Failed to clear icon cache:', err);
92
+ }
93
+ }
94
+ scheduleNotification(allIcons);
95
+ }
177
96
  export function addWatcher(id, iconName, callback) {
178
- watchers.set(id, callback);
179
- if (iconName) {
180
- watcherIconNames.set(id, iconName);
181
- }
182
- }
183
- /**
184
- * Remove a watcher
185
- * @param id Watcher ID to remove
186
- */
97
+ watchers.set(id, callback);
98
+ if (iconName) {
99
+ watcherIconNames.set(id, iconName);
100
+ }
101
+ }
187
102
  export function removeWatcher(id) {
188
- watchers.delete(id);
189
- watcherIconNames.delete(id);
103
+ watchers.delete(id);
104
+ watcherIconNames.delete(id);
190
105
  }
191
- /**
192
- * Schedule notification for changed icons (batched and deferred)
193
- */
194
106
  function scheduleNotification(changedIcons) {
195
- // Accumulate changed icons
196
- if (!pendingNotifications) {
197
- pendingNotifications = new Set();
198
- }
199
- changedIcons.forEach(name => pendingNotifications.add(name));
200
- // Cancel existing timer
201
- if (notificationTimer !== null) {
202
- clearTimeout(notificationTimer);
203
- }
204
- // Schedule notification using requestIdleCallback or setTimeout
205
- const scheduleCallback = typeof requestIdleCallback !== 'undefined'
206
- ? requestIdleCallback
207
- : (cb) => setTimeout(cb, 0);
208
- notificationTimer = scheduleCallback(() => {
209
- const toNotify = pendingNotifications;
210
- pendingNotifications = null;
211
- notificationTimer = null;
212
- // Only notify if we have icons to notify about
213
- if (toNotify && toNotify.size > 0) {
214
- notifyWatchers(toNotify);
215
- }
216
- });
217
- }
218
- /**
219
- * Notify watchers of changed icons (selective notification)
220
- */
107
+ if (!pendingNotifications) {
108
+ pendingNotifications = new Set();
109
+ }
110
+ changedIcons.forEach(name => pendingNotifications.add(name));
111
+ if (notificationTimer !== null) {
112
+ clearTimeout(notificationTimer);
113
+ }
114
+ const scheduleCallback = typeof requestIdleCallback !== 'undefined'
115
+ ? requestIdleCallback
116
+ : (cb) => setTimeout(cb, 0);
117
+ notificationTimer = scheduleCallback(() => {
118
+ const toNotify = pendingNotifications;
119
+ pendingNotifications = null;
120
+ notificationTimer = null;
121
+ if (toNotify && toNotify.size > 0) {
122
+ notifyWatchers(toNotify);
123
+ }
124
+ });
125
+ }
221
126
  function notifyWatchers(changedIcons) {
222
- watchers.forEach((callback, watcherId) => {
223
- const watchedIcon = watcherIconNames.get(watcherId);
224
- // If watcher is watching a specific icon, only notify if that icon changed
225
- if (watchedIcon) {
226
- if (changedIcons.has(watchedIcon)) {
227
- callback(new Set([watchedIcon]));
228
- }
229
- }
230
- else {
231
- // Watcher wants all changes
232
- callback(changedIcons);
233
- }
234
- });
235
- }
236
- /**
237
- * Get all registered icon names (memory only, not cache)
238
- * @returns Array of icon names
239
- */
127
+ watchers.forEach((callback, watcherId) => {
128
+ const watchedIcon = watcherIconNames.get(watcherId);
129
+ if (watchedIcon) {
130
+ if (changedIcons.has(watchedIcon)) {
131
+ callback(new Set([watchedIcon]));
132
+ }
133
+ }
134
+ else {
135
+ callback(changedIcons);
136
+ }
137
+ });
138
+ }
240
139
  export function getIconNames() {
241
- return Array.from(iconRegistry.keys());
140
+ return Array.from(iconRegistry.keys());
242
141
  }
243
- /**
244
- * Get cache statistics
245
- * @returns Promise with cache info
246
- */
247
142
  export async function getCacheInfo() {
248
- const info = {
249
- version: VERSION,
250
- cacheName: CACHE_NAME,
251
- available: 'caches' in window
252
- };
253
- if (!info.available)
254
- return info;
255
- try {
256
- const cache = await caches.open(CACHE_NAME);
257
- const keys = await cache.keys();
258
- const iconKeys = keys.filter(req => req.url.startsWith(CACHE_URL_BASE));
259
- return {
260
- ...info,
261
- iconCount: iconKeys.length
262
- };
263
- }
264
- catch (err) {
265
- console.warn('[ty-icons] Failed to get cache info:', err);
266
- return info;
267
- }
268
- }
269
- //# sourceMappingURL=icon-registry.js.map
143
+ const info = {
144
+ version: VERSION,
145
+ cacheName: CACHE_NAME,
146
+ available: 'caches' in window
147
+ };
148
+ if (!info.available)
149
+ return info;
150
+ try {
151
+ const cache = await caches.open(CACHE_NAME);
152
+ const keys = await cache.keys();
153
+ const iconKeys = keys.filter(req => req.url.startsWith(CACHE_URL_BASE));
154
+ return {
155
+ ...info,
156
+ iconCount: iconKeys.length
157
+ };
158
+ }
159
+ catch (err) {
160
+ console.warn('[ty-icons] Failed to get cache info:', err);
161
+ return info;
162
+ }
163
+ }
@@ -7,4 +7,3 @@
7
7
  */
8
8
  /** Lucide `asterisk` — required-field indicator. */
9
9
  export declare const REQUIRED_ICON_SVG = "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M12 6v12\"/><path d=\"M17.196 9 6.804 15\"/><path d=\"m6.804 9 10.392 6\"/></svg>";
10
- //# sourceMappingURL=icons.d.ts.map
@@ -1,10 +1 @@
1
- /**
2
- * Shared inline SVG icons for shadow-DOM components.
3
- *
4
- * Kept inline (not the icon registry) because shadow roots must render
5
- * without registry setup. Styling hooks target the wrapper element
6
- * (e.g. `.required-icon svg`), never the svg's own classes.
7
- */
8
- /** Lucide `asterisk` — required-field indicator. */
9
1
  export const REQUIRED_ICON_SVG = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M12 6v12"/><path d="M17.196 9 6.804 15"/><path d="m6.804 9 10.392 6"/></svg>`;
10
- //# sourceMappingURL=icons.js.map
@@ -32,4 +32,3 @@ export declare function setLoaderSvg(svg: string | null): void;
32
32
  export declare function getLoaderSvg(): string;
33
33
  /** Reset the registered loader back to the built-in default. */
34
34
  export declare function resetLoaderSvg(): void;
35
- //# sourceMappingURL=loader-registry.d.ts.map
@@ -1,43 +1,11 @@
1
- /**
2
- * Global loader-icon registry.
3
- *
4
- * Set once at app bootstrap to override the default spinner SVG used by
5
- * every loading-aware component (`ty-button`, `ty-select`, etc.). Components
6
- * call `getLoaderSvg()` on every render, so changing the
7
- * registered SVG affects future renders.
8
- *
9
- * The wrapper element rotates the SVG with `transform: rotate()`, so prefer
10
- * a *static* SVG. If you must use a self-animating SVG, disable the wrapper
11
- * spin with the `--ty-loader-animation: none` CSS custom property.
12
- *
13
- * @example
14
- * import { setLoaderSvg } from 'tyrell-components'
15
- * setLoaderSvg('<svg viewBox="0 0 24 24">...</svg>')
16
- *
17
- * // CDN / vanilla
18
- * window.tyLoader.set('<svg ...>...</svg>')
19
- *
20
- * // Reset to default
21
- * setLoaderSvg(null)
22
- */
23
1
  const DEFAULT_LOADER_SVG = `<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg" aria-hidden="true"><circle cx="12" cy="12" r="10" stroke="currentColor" stroke-width="3" stroke-opacity="0.25"/><path d="M22 12a10 10 0 0 1-10 10" stroke="currentColor" stroke-width="3" stroke-linecap="round"/></svg>`;
24
2
  let customLoaderSvg = null;
25
- /**
26
- * Register a custom spinner SVG (markup string). Pass `null` to reset to
27
- * the built-in default.
28
- */
29
3
  export function setLoaderSvg(svg) {
30
- customLoaderSvg = svg && svg.trim() ? svg : null;
4
+ customLoaderSvg = svg && svg.trim() ? svg : null;
31
5
  }
32
- /**
33
- * Get the currently registered spinner SVG, or the built-in default if
34
- * none has been set. Components call this on every render.
35
- */
36
6
  export function getLoaderSvg() {
37
- return customLoaderSvg ?? DEFAULT_LOADER_SVG;
7
+ return customLoaderSvg ?? DEFAULT_LOADER_SVG;
38
8
  }
39
- /** Reset the registered loader back to the built-in default. */
40
9
  export function resetLoaderSvg() {
41
- customLoaderSvg = null;
10
+ customLoaderSvg = null;
42
11
  }
43
- //# sourceMappingURL=loader-registry.js.map
@@ -1,28 +1,8 @@
1
1
  /**
2
2
  * Locale Resolution Utilities
3
3
  *
4
- * Provides a cascade system for resolving locale/language preferences:
5
- * 1. Component's explicit `locale` attribute (highest priority)
6
- * 2. Closest ancestor's `lang` attribute
7
- * 3. Document root's `lang` attribute
8
- * 4. Browser's language preference
9
- * 5. 'en-US' fallback (lowest priority)
10
- *
11
- * This allows developers to set locale at any level:
12
- * - Per-component: <ty-input locale="fr-FR">
13
- * - Per-section: <div lang="de-DE"><ty-input></ty-input></div>
14
- * - Per-page: <html lang="es-ES">
15
- * - Browser default: Uses navigator.language
16
- *
17
- * @example
18
- * ```typescript
19
- * // In a component
20
- * class TyInput extends HTMLElement {
21
- * get locale(): string {
22
- * return getEffectiveLocale(this, this.getAttribute('locale'));
23
- * }
24
- * }
25
- * ```
4
+ * Cascade for resolving locale/language preferences, so developers can set it
5
+ * per-component, per-section, per-page, or fall back to the browser default.
26
6
  */
27
7
  /**
28
8
  * Get the effective locale for an element using the resolution cascade.
@@ -76,4 +56,3 @@ export declare function getEffectiveLocale(element: HTMLElement, explicitLocale?
76
56
  * ```
77
57
  */
78
58
  export declare function observeLocaleChanges(element: HTMLElement, callback: (newLocale: string) => void): () => void;
79
- //# sourceMappingURL=locale.d.ts.map