tyrell-components 1.0.0-TC9 → 1.0.0-rc.22

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 (393) hide show
  1. package/AGENTS.md +122 -0
  2. package/CHANGELOG.md +1541 -0
  3. package/README.md +71 -53
  4. package/bin/tyrell.mjs +77 -0
  5. package/css/tyrell-colors-static.css +1 -0
  6. package/css/tyrell-theme.css +1 -0
  7. package/css/tyrell.css +1 -1783
  8. package/dist/tyrell-colors-static.css +1 -0
  9. package/dist/tyrell-theme.css +1 -0
  10. package/dist/tyrell.css +1 -1783
  11. package/dist/tyrell.js +1 -1
  12. package/guides/AGENT_INSTRUCTIONS.md +124 -0
  13. package/guides/AI_GUIDE.md +53 -0
  14. package/guides/CSS_GUIDE.md +1016 -0
  15. package/guides/DATASTAR_TY_GUIDE.md +657 -0
  16. package/guides/ICONS_GUIDE.md +212 -0
  17. package/guides/TY_GUIDE.md +937 -0
  18. package/guides/clj/CLOJURESCRIPT_GUIDE.md +300 -0
  19. package/guides/clj/CODE_SPLITTING.md +279 -0
  20. package/guides/clj/COMPONENT_GUIDE.md +391 -0
  21. package/guides/clj/HELIX_TY_GUIDE.md +428 -0
  22. package/guides/clj/I18N_GUIDE.md +478 -0
  23. package/guides/clj/LAYOUT_GUIDE.md +273 -0
  24. package/guides/clj/QUICKSTART.md +266 -0
  25. package/guides/clj/REAGENT_TY_GUIDE.md +408 -0
  26. package/guides/clj/REPLICANT_TY_GUIDE.md +623 -0
  27. package/guides/clj/ROUTING_GUIDE.md +346 -0
  28. package/guides/clj/UIX_TY_GUIDE.md +319 -0
  29. package/guides/js/HTMX_TY_GUIDE.md +252 -0
  30. package/guides/js/JAVASCRIPT_GUIDE.md +388 -0
  31. package/guides/js/REACT_TY_GUIDE.md +983 -0
  32. package/guides/js/SVELTE_TY_GUIDE.md +682 -0
  33. package/guides/js/TYCOMPONENT_GUIDE.md +962 -0
  34. package/guides/js/VUE_TY_GUIDE.md +738 -0
  35. package/lib/base/ty-component.d.ts +57 -13
  36. package/lib/base/ty-component.js +266 -292
  37. package/lib/components/button.d.ts +33 -18
  38. package/lib/components/button.js +317 -267
  39. package/lib/components/calendar-month.d.ts +30 -47
  40. package/lib/components/calendar-month.js +455 -429
  41. package/lib/components/calendar-navigation.d.ts +41 -49
  42. package/lib/components/calendar-navigation.js +287 -346
  43. package/lib/components/calendar.d.ts +73 -83
  44. package/lib/components/calendar.js +837 -762
  45. package/lib/components/checkbox.d.ts +26 -75
  46. package/lib/components/checkbox.js +298 -391
  47. package/lib/components/copy.d.ts +20 -60
  48. package/lib/components/copy.js +276 -380
  49. package/lib/components/date-picker.d.ts +100 -183
  50. package/lib/components/date-picker.js +1155 -1570
  51. package/lib/components/file-upload.d.ts +16 -15
  52. package/lib/components/file-upload.js +436 -426
  53. package/lib/components/icon.d.ts +3 -24
  54. package/lib/components/icon.js +141 -230
  55. package/lib/components/input.d.ts +93 -108
  56. package/lib/components/input.js +734 -710
  57. package/lib/components/modal.d.ts +39 -29
  58. package/lib/components/modal.js +419 -438
  59. package/lib/components/option.d.ts +20 -35
  60. package/lib/components/option.js +184 -309
  61. package/lib/components/popup.d.ts +2 -17
  62. package/lib/components/popup.js +353 -347
  63. package/lib/components/radio.d.ts +33 -25
  64. package/lib/components/radio.js +433 -422
  65. package/lib/components/resize-observer.d.ts +3 -30
  66. package/lib/components/resize-observer.js +71 -103
  67. package/lib/components/scroll-container.d.ts +21 -14
  68. package/lib/components/scroll-container.js +292 -234
  69. package/lib/components/select.d.ts +458 -0
  70. package/lib/components/select.js +1458 -0
  71. package/lib/components/selected-tags.d.ts +60 -0
  72. package/lib/components/selected-tags.js +225 -0
  73. package/lib/components/sortable.d.ts +175 -0
  74. package/lib/components/sortable.js +1844 -0
  75. package/lib/components/step.d.ts +1 -6
  76. package/lib/components/step.js +62 -68
  77. package/lib/components/switch.d.ts +15 -15
  78. package/lib/components/switch.js +237 -231
  79. package/lib/components/tab.d.ts +50 -7
  80. package/lib/components/tab.js +203 -69
  81. package/lib/components/tabs.d.ts +19 -64
  82. package/lib/components/tabs.js +600 -618
  83. package/lib/components/tag.d.ts +14 -52
  84. package/lib/components/tag.js +231 -306
  85. package/lib/components/textarea.d.ts +58 -89
  86. package/lib/components/textarea.js +523 -573
  87. package/lib/components/tooltip.d.ts +8 -13
  88. package/lib/components/tooltip.js +322 -409
  89. package/lib/components/wizard.d.ts +7 -54
  90. package/lib/components/wizard.js +376 -606
  91. package/lib/icons/fontawesome/brands.d.ts +0 -1
  92. package/lib/icons/fontawesome/brands.js +0 -8
  93. package/lib/icons/fontawesome/regular.d.ts +0 -1
  94. package/lib/icons/fontawesome/regular.js +0 -8
  95. package/lib/icons/fontawesome/solid.d.ts +0 -1
  96. package/lib/icons/fontawesome/solid.js +0 -8
  97. package/lib/icons/heroicons/micro.d.ts +0 -1
  98. package/lib/icons/heroicons/micro.js +392 -400
  99. package/lib/icons/heroicons/mini.d.ts +0 -1
  100. package/lib/icons/heroicons/mini.js +382 -390
  101. package/lib/icons/heroicons/outline.d.ts +0 -1
  102. package/lib/icons/heroicons/outline.js +337 -345
  103. package/lib/icons/heroicons/solid.d.ts +0 -1
  104. package/lib/icons/heroicons/solid.js +407 -415
  105. package/lib/icons/lucide.d.ts +0 -1
  106. package/lib/icons/lucide.js +24479 -26351
  107. package/lib/icons/material/filled.d.ts +0 -1
  108. package/lib/icons/material/filled.js +9653 -9663
  109. package/lib/icons/material/outlined.d.ts +0 -1
  110. package/lib/icons/material/outlined.js +10271 -10281
  111. package/lib/icons/material/round.d.ts +0 -1
  112. package/lib/icons/material/round.js +10495 -10505
  113. package/lib/icons/material/sharp.d.ts +0 -1
  114. package/lib/icons/material/sharp.js +9905 -9915
  115. package/lib/icons/material/two-tone.d.ts +0 -1
  116. package/lib/icons/material/two-tone.js +12792 -12802
  117. package/lib/index.d.ts +7 -4
  118. package/lib/index.js +26 -39
  119. package/lib/styles/button.d.ts +24 -7
  120. package/lib/styles/button.js +285 -445
  121. package/lib/styles/calendar-month.d.ts +7 -6
  122. package/lib/styles/calendar-month.js +158 -226
  123. package/lib/styles/calendar-navigation.d.ts +2 -6
  124. package/lib/styles/calendar-navigation.js +108 -127
  125. package/lib/styles/calendar.d.ts +3 -3
  126. package/lib/styles/calendar.js +87 -23
  127. package/lib/styles/checkbox.d.ts +7 -6
  128. package/lib/styles/checkbox.js +101 -15
  129. package/lib/styles/copy.d.ts +3 -2
  130. package/lib/styles/copy.js +91 -71
  131. package/lib/styles/custom-scrollbar.d.ts +1 -2
  132. package/lib/styles/custom-scrollbar.js +80 -115
  133. package/lib/styles/date-picker.d.ts +4 -6
  134. package/lib/styles/date-picker.js +321 -388
  135. package/lib/styles/field-size.d.ts +6 -0
  136. package/lib/styles/field-size.js +91 -0
  137. package/lib/styles/file-upload.d.ts +1 -2
  138. package/lib/styles/file-upload.js +143 -188
  139. package/lib/styles/icon.d.ts +2 -6
  140. package/lib/styles/icon.js +92 -170
  141. package/lib/styles/input.d.ts +4 -7
  142. package/lib/styles/input.js +148 -643
  143. package/lib/styles/modal.d.ts +1 -2
  144. package/lib/styles/modal.js +127 -108
  145. package/lib/styles/option.d.ts +2 -6
  146. package/lib/styles/option.js +53 -96
  147. package/lib/styles/popup.d.ts +1 -2
  148. package/lib/styles/popup.js +47 -77
  149. package/lib/styles/radio.d.ts +3 -2
  150. package/lib/styles/radio.js +90 -116
  151. package/lib/styles/resize-observer.d.ts +1 -2
  152. package/lib/styles/resize-observer.js +2 -12
  153. package/lib/styles/scroll-container.d.ts +1 -2
  154. package/lib/styles/scroll-container.js +103 -146
  155. package/lib/styles/select-base.d.ts +8 -0
  156. package/lib/styles/select-base.js +752 -0
  157. package/lib/styles/select.d.ts +11 -0
  158. package/lib/styles/select.js +229 -0
  159. package/lib/styles/sortable.d.ts +16 -0
  160. package/lib/styles/sortable.js +85 -0
  161. package/lib/styles/step.d.ts +1 -2
  162. package/lib/styles/step.js +15 -34
  163. package/lib/styles/switch.d.ts +3 -2
  164. package/lib/styles/switch.js +52 -68
  165. package/lib/styles/tab.d.ts +1 -2
  166. package/lib/styles/tab.js +86 -34
  167. package/lib/styles/tabs.d.ts +3 -11
  168. package/lib/styles/tabs.js +204 -162
  169. package/lib/styles/tag.d.ts +2 -6
  170. package/lib/styles/tag.js +168 -362
  171. package/lib/styles/textarea.d.ts +1 -2
  172. package/lib/styles/textarea.js +238 -306
  173. package/lib/styles/tooltip.d.ts +4 -3
  174. package/lib/styles/tooltip.js +3 -131
  175. package/lib/styles/wizard.d.ts +8 -20
  176. package/lib/styles/wizard.js +306 -295
  177. package/lib/types/common.d.ts +9 -8
  178. package/lib/types/common.js +8 -5
  179. package/lib/utils/calendar-utils.d.ts +49 -65
  180. package/lib/utils/calendar-utils.js +158 -343
  181. package/lib/utils/custom-scrollbar.d.ts +6 -20
  182. package/lib/utils/custom-scrollbar.js +273 -317
  183. package/lib/utils/flavor-sheet.d.ts +31 -0
  184. package/lib/utils/flavor-sheet.js +17 -0
  185. package/lib/utils/icon-registry.d.ts +0 -15
  186. package/lib/utils/icon-registry.js +138 -279
  187. package/lib/utils/icons.d.ts +9 -0
  188. package/lib/utils/icons.js +1 -0
  189. package/lib/utils/loader-registry.d.ts +2 -3
  190. package/lib/utils/loader-registry.js +3 -35
  191. package/lib/utils/locale.d.ts +2 -80
  192. package/lib/utils/locale.js +30 -205
  193. package/lib/utils/mobile.d.ts +0 -1
  194. package/lib/utils/mobile.js +1 -18
  195. package/lib/utils/number-format.d.ts +6 -24
  196. package/lib/utils/number-format.js +53 -136
  197. package/lib/utils/positioning.d.ts +72 -22
  198. package/lib/utils/positioning.js +224 -298
  199. package/lib/utils/property-capture.d.ts +5 -27
  200. package/lib/utils/property-capture.js +36 -144
  201. package/lib/utils/property-manager.d.ts +6 -6
  202. package/lib/utils/property-manager.js +127 -196
  203. package/lib/utils/resize-observer.d.ts +0 -1
  204. package/lib/utils/resize-observer.js +23 -59
  205. package/lib/utils/scroll-lock.d.ts +10 -11
  206. package/lib/utils/scroll-lock.js +165 -173
  207. package/lib/utils/styles.d.ts +0 -6
  208. package/lib/utils/styles.js +17 -48
  209. package/lib/utils/upgrade-properties.d.ts +21 -0
  210. package/lib/utils/upgrade-properties.js +47 -0
  211. package/lib/utils/validity.d.ts +122 -0
  212. package/lib/utils/validity.js +289 -0
  213. package/lib/version.d.ts +1 -2
  214. package/lib/version.js +1 -11
  215. package/package.json +66 -18
  216. package/lib/base/ty-component.d.ts.map +0 -1
  217. package/lib/base/ty-component.js.map +0 -1
  218. package/lib/components/button.d.ts.map +0 -1
  219. package/lib/components/button.js.map +0 -1
  220. package/lib/components/calendar-month.d.ts.map +0 -1
  221. package/lib/components/calendar-month.js.map +0 -1
  222. package/lib/components/calendar-navigation.d.ts.map +0 -1
  223. package/lib/components/calendar-navigation.js.map +0 -1
  224. package/lib/components/calendar.d.ts.map +0 -1
  225. package/lib/components/calendar.js.map +0 -1
  226. package/lib/components/checkbox.d.ts.map +0 -1
  227. package/lib/components/checkbox.js.map +0 -1
  228. package/lib/components/copy.d.ts.map +0 -1
  229. package/lib/components/copy.js.map +0 -1
  230. package/lib/components/date-picker.d.ts.map +0 -1
  231. package/lib/components/date-picker.js.map +0 -1
  232. package/lib/components/dropdown.d.ts +0 -404
  233. package/lib/components/dropdown.d.ts.map +0 -1
  234. package/lib/components/dropdown.js +0 -1563
  235. package/lib/components/dropdown.js.map +0 -1
  236. package/lib/components/file-upload.d.ts.map +0 -1
  237. package/lib/components/file-upload.js.map +0 -1
  238. package/lib/components/icon.d.ts.map +0 -1
  239. package/lib/components/icon.js.map +0 -1
  240. package/lib/components/input.d.ts.map +0 -1
  241. package/lib/components/input.js.map +0 -1
  242. package/lib/components/modal.d.ts.map +0 -1
  243. package/lib/components/modal.js.map +0 -1
  244. package/lib/components/multiselect.d.ts +0 -408
  245. package/lib/components/multiselect.d.ts.map +0 -1
  246. package/lib/components/multiselect.js +0 -1611
  247. package/lib/components/multiselect.js.map +0 -1
  248. package/lib/components/option.d.ts.map +0 -1
  249. package/lib/components/option.js.map +0 -1
  250. package/lib/components/popup.d.ts.map +0 -1
  251. package/lib/components/popup.js.map +0 -1
  252. package/lib/components/radio.d.ts.map +0 -1
  253. package/lib/components/radio.js.map +0 -1
  254. package/lib/components/resize-observer.d.ts.map +0 -1
  255. package/lib/components/resize-observer.js.map +0 -1
  256. package/lib/components/scroll-container.d.ts.map +0 -1
  257. package/lib/components/scroll-container.js.map +0 -1
  258. package/lib/components/step.d.ts.map +0 -1
  259. package/lib/components/step.js.map +0 -1
  260. package/lib/components/switch.d.ts.map +0 -1
  261. package/lib/components/switch.js.map +0 -1
  262. package/lib/components/tab.d.ts.map +0 -1
  263. package/lib/components/tab.js.map +0 -1
  264. package/lib/components/tabs.d.ts.map +0 -1
  265. package/lib/components/tabs.js.map +0 -1
  266. package/lib/components/tag.d.ts.map +0 -1
  267. package/lib/components/tag.js.map +0 -1
  268. package/lib/components/textarea.d.ts.map +0 -1
  269. package/lib/components/textarea.js.map +0 -1
  270. package/lib/components/tooltip.d.ts.map +0 -1
  271. package/lib/components/tooltip.js.map +0 -1
  272. package/lib/components/wizard.d.ts.map +0 -1
  273. package/lib/components/wizard.js.map +0 -1
  274. package/lib/icons/fontawesome/brands.d.ts.map +0 -1
  275. package/lib/icons/fontawesome/brands.js.map +0 -1
  276. package/lib/icons/fontawesome/regular.d.ts.map +0 -1
  277. package/lib/icons/fontawesome/regular.js.map +0 -1
  278. package/lib/icons/fontawesome/solid.d.ts.map +0 -1
  279. package/lib/icons/fontawesome/solid.js.map +0 -1
  280. package/lib/icons/heroicons/micro.d.ts.map +0 -1
  281. package/lib/icons/heroicons/micro.js.map +0 -1
  282. package/lib/icons/heroicons/mini.d.ts.map +0 -1
  283. package/lib/icons/heroicons/mini.js.map +0 -1
  284. package/lib/icons/heroicons/outline.d.ts.map +0 -1
  285. package/lib/icons/heroicons/outline.js.map +0 -1
  286. package/lib/icons/heroicons/solid.d.ts.map +0 -1
  287. package/lib/icons/heroicons/solid.js.map +0 -1
  288. package/lib/icons/lucide.d.ts.map +0 -1
  289. package/lib/icons/lucide.js.map +0 -1
  290. package/lib/icons/material/filled.d.ts.map +0 -1
  291. package/lib/icons/material/filled.js.map +0 -1
  292. package/lib/icons/material/outlined.d.ts.map +0 -1
  293. package/lib/icons/material/outlined.js.map +0 -1
  294. package/lib/icons/material/round.d.ts.map +0 -1
  295. package/lib/icons/material/round.js.map +0 -1
  296. package/lib/icons/material/sharp.d.ts.map +0 -1
  297. package/lib/icons/material/sharp.js.map +0 -1
  298. package/lib/icons/material/two-tone.d.ts.map +0 -1
  299. package/lib/icons/material/two-tone.js.map +0 -1
  300. package/lib/index.d.ts.map +0 -1
  301. package/lib/index.js.map +0 -1
  302. package/lib/styles/button.d.ts.map +0 -1
  303. package/lib/styles/button.js.map +0 -1
  304. package/lib/styles/calendar-month.d.ts.map +0 -1
  305. package/lib/styles/calendar-month.js.map +0 -1
  306. package/lib/styles/calendar-navigation.d.ts.map +0 -1
  307. package/lib/styles/calendar-navigation.js.map +0 -1
  308. package/lib/styles/calendar.d.ts.map +0 -1
  309. package/lib/styles/calendar.js.map +0 -1
  310. package/lib/styles/checkbox.d.ts.map +0 -1
  311. package/lib/styles/checkbox.js.map +0 -1
  312. package/lib/styles/copy.d.ts.map +0 -1
  313. package/lib/styles/copy.js.map +0 -1
  314. package/lib/styles/custom-scrollbar.d.ts.map +0 -1
  315. package/lib/styles/custom-scrollbar.js.map +0 -1
  316. package/lib/styles/date-picker.d.ts.map +0 -1
  317. package/lib/styles/date-picker.js.map +0 -1
  318. package/lib/styles/dropdown.d.ts +0 -12
  319. package/lib/styles/dropdown.d.ts.map +0 -1
  320. package/lib/styles/dropdown.js +0 -1048
  321. package/lib/styles/dropdown.js.map +0 -1
  322. package/lib/styles/file-upload.d.ts.map +0 -1
  323. package/lib/styles/file-upload.js.map +0 -1
  324. package/lib/styles/icon.d.ts.map +0 -1
  325. package/lib/styles/icon.js.map +0 -1
  326. package/lib/styles/input.d.ts.map +0 -1
  327. package/lib/styles/input.js.map +0 -1
  328. package/lib/styles/modal.d.ts.map +0 -1
  329. package/lib/styles/modal.js.map +0 -1
  330. package/lib/styles/multiselect.d.ts +0 -6
  331. package/lib/styles/multiselect.d.ts.map +0 -1
  332. package/lib/styles/multiselect.js +0 -837
  333. package/lib/styles/multiselect.js.map +0 -1
  334. package/lib/styles/option.d.ts.map +0 -1
  335. package/lib/styles/option.js.map +0 -1
  336. package/lib/styles/popup.d.ts.map +0 -1
  337. package/lib/styles/popup.js.map +0 -1
  338. package/lib/styles/radio.d.ts.map +0 -1
  339. package/lib/styles/radio.js.map +0 -1
  340. package/lib/styles/resize-observer.d.ts.map +0 -1
  341. package/lib/styles/resize-observer.js.map +0 -1
  342. package/lib/styles/scroll-container.d.ts.map +0 -1
  343. package/lib/styles/scroll-container.js.map +0 -1
  344. package/lib/styles/step.d.ts.map +0 -1
  345. package/lib/styles/step.js.map +0 -1
  346. package/lib/styles/switch.d.ts.map +0 -1
  347. package/lib/styles/switch.js.map +0 -1
  348. package/lib/styles/tab.d.ts.map +0 -1
  349. package/lib/styles/tab.js.map +0 -1
  350. package/lib/styles/tabs.d.ts.map +0 -1
  351. package/lib/styles/tabs.js.map +0 -1
  352. package/lib/styles/tag.d.ts.map +0 -1
  353. package/lib/styles/tag.js.map +0 -1
  354. package/lib/styles/textarea.d.ts.map +0 -1
  355. package/lib/styles/textarea.js.map +0 -1
  356. package/lib/styles/tooltip.d.ts.map +0 -1
  357. package/lib/styles/tooltip.js.map +0 -1
  358. package/lib/styles/wizard.d.ts.map +0 -1
  359. package/lib/styles/wizard.js.map +0 -1
  360. package/lib/types/common.d.ts.map +0 -1
  361. package/lib/types/common.js.map +0 -1
  362. package/lib/utils/calendar-utils.d.ts.map +0 -1
  363. package/lib/utils/calendar-utils.js.map +0 -1
  364. package/lib/utils/custom-scrollbar.d.ts.map +0 -1
  365. package/lib/utils/custom-scrollbar.js.map +0 -1
  366. package/lib/utils/icon-registry.d.ts.map +0 -1
  367. package/lib/utils/icon-registry.js.map +0 -1
  368. package/lib/utils/loader-registry.d.ts.map +0 -1
  369. package/lib/utils/loader-registry.js.map +0 -1
  370. package/lib/utils/locale.d.ts.map +0 -1
  371. package/lib/utils/locale.js.map +0 -1
  372. package/lib/utils/mobile.d.ts.map +0 -1
  373. package/lib/utils/mobile.js.map +0 -1
  374. package/lib/utils/number-format.d.ts.map +0 -1
  375. package/lib/utils/number-format.js.map +0 -1
  376. package/lib/utils/parse-boolean.d.ts +0 -39
  377. package/lib/utils/parse-boolean.d.ts.map +0 -1
  378. package/lib/utils/parse-boolean.js +0 -58
  379. package/lib/utils/parse-boolean.js.map +0 -1
  380. package/lib/utils/positioning.d.ts.map +0 -1
  381. package/lib/utils/positioning.js.map +0 -1
  382. package/lib/utils/property-capture.d.ts.map +0 -1
  383. package/lib/utils/property-capture.js.map +0 -1
  384. package/lib/utils/property-manager.d.ts.map +0 -1
  385. package/lib/utils/property-manager.js.map +0 -1
  386. package/lib/utils/resize-observer.d.ts.map +0 -1
  387. package/lib/utils/resize-observer.js.map +0 -1
  388. package/lib/utils/scroll-lock.d.ts.map +0 -1
  389. package/lib/utils/scroll-lock.js.map +0 -1
  390. package/lib/utils/styles.d.ts.map +0 -1
  391. package/lib/utils/styles.js.map +0 -1
  392. package/lib/version.d.ts.map +0 -1
  393. package/lib/version.js.map +0 -1
@@ -0,0 +1,17 @@
1
+ import { FLAVORS } from '../types/common.js';
2
+ export function syncCustomFlavorSheet(shadow, sheet, flavor, css) {
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;
17
+ }
@@ -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)
@@ -17,14 +16,6 @@ export declare function getCachedIcon(name: string): Promise<string | null>;
17
16
  * @param icons Object mapping icon names to SVG strings
18
17
  */
19
18
  export declare function registerIcons(icons: Record<string, string>): void;
20
- /**
21
- * Register a single icon
22
- * Always updates memory and notifies watchers immediately
23
- * Cache update happens in background (only if different from cached version)
24
- * @param name Icon name
25
- * @param svg SVG string
26
- */
27
- export declare function registerIcon(name: string, svg: string): void;
28
19
  /**
29
20
  * Lookup an icon by name from memory
30
21
  * NOTE: This does NOT check cache - use getCachedIcon() for that
@@ -60,11 +51,6 @@ export declare function removeWatcher(id: string): void;
60
51
  * @returns Array of icon names
61
52
  */
62
53
  export declare function getIconNames(): string[];
63
- /**
64
- * Get registry size (memory only)
65
- * @returns Number of registered icons in memory
66
- */
67
- export declare function getIconCount(): number;
68
54
  /**
69
55
  * Get cache statistics
70
56
  * @returns Promise with cache info
@@ -75,4 +61,3 @@ export declare function getCacheInfo(): Promise<{
75
61
  available: boolean;
76
62
  iconCount?: number;
77
63
  }>;
78
- //# sourceMappingURL=icon-registry.d.ts.map
@@ -1,304 +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
- * Register a single icon
137
- * Always updates memory and notifies watchers immediately
138
- * Cache update happens in background (only if different from cached version)
139
- * @param name Icon name
140
- * @param svg SVG string
141
- */
142
- export function registerIcon(name, svg) {
143
- // Always set in memory registry (fast, synchronous)
144
- iconRegistry.set(name, svg);
145
- // Notify watchers immediately (synchronous)
146
- scheduleNotification(new Set([name]));
147
- // Compare with cache in background to avoid unnecessary cache writes
148
- getCachedIcon(name).then(cachedSvg => {
149
- // Only write to cache if content actually changed
150
- if (cachedSvg !== svg) {
151
- cacheIcon(name, svg).catch(() => {
152
- // Error already logged in cacheIcon
153
- });
154
- }
155
- // If cachedSvg === svg, skip cache write (already up to date)
156
- }).catch(() => {
157
- // No cached version or error reading cache - write new icon
158
- cacheIcon(name, svg).catch(() => {
159
- // Error already logged in cacheIcon
160
- });
161
- });
162
- }
163
- /**
164
- * Lookup an icon by name from memory
165
- * NOTE: This does NOT check cache - use getCachedIcon() for that
166
- * @param name Icon name
167
- * @returns SVG string or undefined
168
- */
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
+ }
169
76
  export function getIcon(name) {
170
- return iconRegistry.get(name);
171
- }
172
- /**
173
- * Check if an icon exists in memory
174
- * NOTE: This does NOT check cache
175
- * @param name Icon name
176
- * @returns true if icon is registered in memory
177
- */
77
+ return iconRegistry.get(name);
78
+ }
178
79
  export function hasIcon(name) {
179
- return iconRegistry.has(name);
80
+ return iconRegistry.has(name);
180
81
  }
181
- /**
182
- * Clear all registered icons from memory and cache
183
- */
184
82
  export async function clearIcons() {
185
- const allIcons = new Set(iconRegistry.keys());
186
- iconRegistry.clear();
187
- // Clear cache
188
- if ('caches' in window) {
189
- try {
190
- await caches.delete(CACHE_NAME);
191
- oldCachesCleared = false; // Allow re-clearing next time
192
- }
193
- catch (err) {
194
- console.warn('[ty-icons] Failed to clear icon cache:', err);
195
- }
196
- }
197
- scheduleNotification(allIcons);
198
- }
199
- /**
200
- * Add a watcher for registry changes
201
- * @param id Unique watcher ID
202
- * @param iconName Optional icon name to watch (for selective notification)
203
- * @param callback Function to call when watched icons change
204
- */
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
+ }
205
96
  export function addWatcher(id, iconName, callback) {
206
- watchers.set(id, callback);
207
- if (iconName) {
208
- watcherIconNames.set(id, iconName);
209
- }
210
- }
211
- /**
212
- * Remove a watcher
213
- * @param id Watcher ID to remove
214
- */
97
+ watchers.set(id, callback);
98
+ if (iconName) {
99
+ watcherIconNames.set(id, iconName);
100
+ }
101
+ }
215
102
  export function removeWatcher(id) {
216
- watchers.delete(id);
217
- watcherIconNames.delete(id);
103
+ watchers.delete(id);
104
+ watcherIconNames.delete(id);
218
105
  }
219
- /**
220
- * Schedule notification for changed icons (batched and deferred)
221
- */
222
106
  function scheduleNotification(changedIcons) {
223
- // Accumulate changed icons
224
- if (!pendingNotifications) {
225
- pendingNotifications = new Set();
226
- }
227
- changedIcons.forEach(name => pendingNotifications.add(name));
228
- // Cancel existing timer
229
- if (notificationTimer !== null) {
230
- clearTimeout(notificationTimer);
231
- }
232
- // Schedule notification using requestIdleCallback or setTimeout
233
- const scheduleCallback = typeof requestIdleCallback !== 'undefined'
234
- ? requestIdleCallback
235
- : (cb) => setTimeout(cb, 0);
236
- notificationTimer = scheduleCallback(() => {
237
- const toNotify = pendingNotifications;
238
- pendingNotifications = null;
239
- notificationTimer = null;
240
- // Only notify if we have icons to notify about
241
- if (toNotify && toNotify.size > 0) {
242
- notifyWatchers(toNotify);
243
- }
244
- });
245
- }
246
- /**
247
- * Notify watchers of changed icons (selective notification)
248
- */
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
+ }
249
126
  function notifyWatchers(changedIcons) {
250
- watchers.forEach((callback, watcherId) => {
251
- const watchedIcon = watcherIconNames.get(watcherId);
252
- // If watcher is watching a specific icon, only notify if that icon changed
253
- if (watchedIcon) {
254
- if (changedIcons.has(watchedIcon)) {
255
- callback(new Set([watchedIcon]));
256
- }
257
- }
258
- else {
259
- // Watcher wants all changes
260
- callback(changedIcons);
261
- }
262
- });
263
- }
264
- /**
265
- * Get all registered icon names (memory only, not cache)
266
- * @returns Array of icon names
267
- */
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
+ }
268
139
  export function getIconNames() {
269
- return Array.from(iconRegistry.keys());
270
- }
271
- /**
272
- * Get registry size (memory only)
273
- * @returns Number of registered icons in memory
274
- */
275
- export function getIconCount() {
276
- return iconRegistry.size;
277
- }
278
- /**
279
- * Get cache statistics
280
- * @returns Promise with cache info
281
- */
140
+ return Array.from(iconRegistry.keys());
141
+ }
282
142
  export async function getCacheInfo() {
283
- const info = {
284
- version: VERSION,
285
- cacheName: CACHE_NAME,
286
- available: 'caches' in window
287
- };
288
- if (!info.available)
289
- return info;
290
- try {
291
- const cache = await caches.open(CACHE_NAME);
292
- const keys = await cache.keys();
293
- const iconKeys = keys.filter(req => req.url.startsWith(CACHE_URL_BASE));
294
- return {
295
- ...info,
296
- iconCount: iconKeys.length
297
- };
298
- }
299
- catch (err) {
300
- console.warn('[ty-icons] Failed to get cache info:', err);
301
- return info;
302
- }
303
- }
304
- //# 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
+ }
@@ -0,0 +1,9 @@
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
+ 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>";
@@ -0,0 +1 @@
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>`;
@@ -2,8 +2,8 @@
2
2
  * Global loader-icon registry.
3
3
  *
4
4
  * Set once at app bootstrap to override the default spinner SVG used by
5
- * every loading-aware component (`ty-button`, `ty-dropdown`, `ty-multiselect`,
6
- * etc.). Components call `getLoaderSvg()` on every render, so changing the
5
+ * every loading-aware component (`ty-button`, `ty-select`, etc.). Components
6
+ * call `getLoaderSvg()` on every render, so changing the
7
7
  * registered SVG affects future renders.
8
8
  *
9
9
  * The wrapper element rotates the SVG with `transform: rotate()`, so prefer
@@ -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-dropdown`, `ty-multiselect`,
6
- * etc.). Components 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.
@@ -50,63 +30,6 @@
50
30
  * ```
51
31
  */
52
32
  export declare function getEffectiveLocale(element: HTMLElement, explicitLocale?: string | null): string;
53
- /**
54
- * Normalize a locale string to BCP 47 format.
55
- * Handles common variations and ensures consistency.
56
- *
57
- * @param locale - The locale string to normalize
58
- * @returns Normalized locale string
59
- *
60
- * @example
61
- * ```typescript
62
- * normalizeLocale('en') // 'en'
63
- * normalizeLocale('en_US') // 'en-US'
64
- * normalizeLocale('EN-us') // 'en-US'
65
- * ```
66
- */
67
- export declare function normalizeLocale(locale: string): string;
68
- /**
69
- * Check if a locale string is valid BCP 47 format.
70
- *
71
- * @param locale - The locale string to validate
72
- * @returns true if valid, false otherwise
73
- *
74
- * @example
75
- * ```typescript
76
- * isValidLocale('en-US') // true
77
- * isValidLocale('fr') // true
78
- * isValidLocale('invalid!') // false
79
- * ```
80
- */
81
- export declare function isValidLocale(locale: string): boolean;
82
- /**
83
- * Get the language code from a locale (e.g., 'en' from 'en-US').
84
- *
85
- * @param locale - The locale string
86
- * @returns The language code
87
- *
88
- * @example
89
- * ```typescript
90
- * getLanguageCode('en-US') // 'en'
91
- * getLanguageCode('fr-FR') // 'fr'
92
- * getLanguageCode('de') // 'de'
93
- * ```
94
- */
95
- export declare function getLanguageCode(locale: string): string;
96
- /**
97
- * Get the region/country code from a locale (e.g., 'US' from 'en-US').
98
- *
99
- * @param locale - The locale string
100
- * @returns The region code, or undefined if not present
101
- *
102
- * @example
103
- * ```typescript
104
- * getRegionCode('en-US') // 'US'
105
- * getRegionCode('fr-FR') // 'FR'
106
- * getRegionCode('de') // undefined
107
- * ```
108
- */
109
- export declare function getRegionCode(locale: string): string | undefined;
110
33
  /**
111
34
  * Create a MutationObserver to watch for lang attribute changes.
112
35
  * Useful for components that need to react to dynamic locale changes.
@@ -133,4 +56,3 @@ export declare function getRegionCode(locale: string): string | undefined;
133
56
  * ```
134
57
  */
135
58
  export declare function observeLocaleChanges(element: HTMLElement, callback: (newLocale: string) => void): () => void;
136
- //# sourceMappingURL=locale.d.ts.map