tyrell-components 1.0.0-RC13 → 1.0.0-RC14

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 (355) hide show
  1. package/README.md +1 -1
  2. package/css/tyrell-theme.css +167 -178
  3. package/css/tyrell.css +19 -0
  4. package/dist/tyrell-theme.css +167 -178
  5. package/dist/tyrell.css +19 -0
  6. package/dist/tyrell.js +1 -1
  7. package/lib/base/ty-component.d.ts +20 -10
  8. package/lib/base/ty-component.js +21 -144
  9. package/lib/components/button.d.ts +2 -16
  10. package/lib/components/button.js +0 -36
  11. package/lib/components/calendar-month.d.ts +2 -48
  12. package/lib/components/calendar-month.js +4 -166
  13. package/lib/components/calendar-navigation.d.ts +3 -48
  14. package/lib/components/calendar-navigation.js +3 -126
  15. package/lib/components/calendar.d.ts +3 -80
  16. package/lib/components/calendar.js +8 -230
  17. package/lib/components/checkbox.d.ts +4 -71
  18. package/lib/components/checkbox.js +7 -151
  19. package/lib/components/copy.d.ts +3 -56
  20. package/lib/components/copy.js +1 -120
  21. package/lib/components/date-picker.d.ts +13 -162
  22. package/lib/components/date-picker.js +41 -592
  23. package/lib/components/file-upload.d.ts +9 -15
  24. package/lib/components/file-upload.js +19 -41
  25. package/lib/components/icon.d.ts +3 -24
  26. package/lib/components/icon.js +1 -90
  27. package/lib/components/input.d.ts +7 -107
  28. package/lib/components/input.js +5 -193
  29. package/lib/components/modal.d.ts +17 -26
  30. package/lib/components/modal.js +57 -201
  31. package/lib/components/option.d.ts +2 -9
  32. package/lib/components/option.js +0 -48
  33. package/lib/components/popup.d.ts +2 -17
  34. package/lib/components/popup.js +8 -139
  35. package/lib/components/radio.d.ts +3 -23
  36. package/lib/components/radio.js +10 -65
  37. package/lib/components/resize-observer.d.ts +3 -30
  38. package/lib/components/resize-observer.js +12 -46
  39. package/lib/components/scroll-container.d.ts +2 -12
  40. package/lib/components/scroll-container.js +3 -46
  41. package/lib/components/select.d.ts +22 -153
  42. package/lib/components/select.js +33 -590
  43. package/lib/components/selected-tags.d.ts +4 -47
  44. package/lib/components/selected-tags.js +1 -95
  45. package/lib/components/step.d.ts +1 -6
  46. package/lib/components/step.js +0 -6
  47. package/lib/components/switch.d.ts +0 -11
  48. package/lib/components/switch.js +2 -36
  49. package/lib/components/tab.d.ts +1 -6
  50. package/lib/components/tab.js +0 -7
  51. package/lib/components/tabs.d.ts +5 -63
  52. package/lib/components/tabs.js +20 -283
  53. package/lib/components/tag.d.ts +2 -36
  54. package/lib/components/tag.js +5 -105
  55. package/lib/components/textarea.d.ts +6 -86
  56. package/lib/components/textarea.js +2 -173
  57. package/lib/components/tooltip.d.ts +3 -11
  58. package/lib/components/tooltip.js +24 -160
  59. package/lib/components/wizard.d.ts +6 -54
  60. package/lib/components/wizard.js +15 -228
  61. package/lib/icons/fontawesome/brands.d.ts +0 -1
  62. package/lib/icons/fontawesome/brands.js +0 -8
  63. package/lib/icons/fontawesome/regular.d.ts +0 -1
  64. package/lib/icons/fontawesome/regular.js +0 -8
  65. package/lib/icons/fontawesome/solid.d.ts +0 -1
  66. package/lib/icons/fontawesome/solid.js +0 -8
  67. package/lib/icons/heroicons/micro.d.ts +0 -1
  68. package/lib/icons/heroicons/micro.js +0 -8
  69. package/lib/icons/heroicons/mini.d.ts +0 -1
  70. package/lib/icons/heroicons/mini.js +0 -8
  71. package/lib/icons/heroicons/outline.d.ts +0 -1
  72. package/lib/icons/heroicons/outline.js +0 -8
  73. package/lib/icons/heroicons/solid.d.ts +0 -1
  74. package/lib/icons/heroicons/solid.js +0 -8
  75. package/lib/icons/lucide.d.ts +0 -1
  76. package/lib/icons/lucide.js +0 -1872
  77. package/lib/icons/material/filled.d.ts +0 -1
  78. package/lib/icons/material/filled.js +0 -10
  79. package/lib/icons/material/outlined.d.ts +0 -1
  80. package/lib/icons/material/outlined.js +0 -10
  81. package/lib/icons/material/round.d.ts +0 -1
  82. package/lib/icons/material/round.js +0 -10
  83. package/lib/icons/material/sharp.d.ts +0 -1
  84. package/lib/icons/material/sharp.js +0 -10
  85. package/lib/icons/material/two-tone.d.ts +0 -1
  86. package/lib/icons/material/two-tone.js +0 -10
  87. package/lib/index.d.ts +0 -1
  88. package/lib/index.js +0 -20
  89. package/lib/styles/button.d.ts +2 -20
  90. package/lib/styles/button.js +22 -122
  91. package/lib/styles/calendar-month.d.ts +1 -5
  92. package/lib/styles/calendar-month.js +4 -61
  93. package/lib/styles/calendar-navigation.d.ts +2 -6
  94. package/lib/styles/calendar-navigation.js +2 -27
  95. package/lib/styles/calendar.d.ts +1 -2
  96. package/lib/styles/calendar.js +1 -14
  97. package/lib/styles/checkbox.d.ts +0 -1
  98. package/lib/styles/checkbox.js +1 -23
  99. package/lib/styles/copy.d.ts +0 -1
  100. package/lib/styles/copy.js +2 -17
  101. package/lib/styles/custom-scrollbar.d.ts +1 -2
  102. package/lib/styles/custom-scrollbar.js +3 -18
  103. package/lib/styles/date-picker.d.ts +1 -5
  104. package/lib/styles/date-picker.js +35 -39
  105. package/lib/styles/file-upload.d.ts +1 -2
  106. package/lib/styles/file-upload.js +1 -16
  107. package/lib/styles/icon.d.ts +2 -6
  108. package/lib/styles/icon.js +7 -21
  109. package/lib/styles/input.d.ts +1 -6
  110. package/lib/styles/input.js +5 -54
  111. package/lib/styles/modal.d.ts +1 -2
  112. package/lib/styles/modal.js +21 -23
  113. package/lib/styles/option.d.ts +2 -6
  114. package/lib/styles/option.js +17 -12
  115. package/lib/styles/popup.d.ts +1 -2
  116. package/lib/styles/popup.js +26 -30
  117. package/lib/styles/radio.d.ts +0 -1
  118. package/lib/styles/radio.js +2 -16
  119. package/lib/styles/resize-observer.d.ts +1 -2
  120. package/lib/styles/resize-observer.js +0 -7
  121. package/lib/styles/scroll-container.d.ts +1 -2
  122. package/lib/styles/scroll-container.js +0 -19
  123. package/lib/styles/select-base.d.ts +0 -1
  124. package/lib/styles/select-base.js +68 -79
  125. package/lib/styles/select.d.ts +1 -2
  126. package/lib/styles/select.js +7 -15
  127. package/lib/styles/step.d.ts +1 -2
  128. package/lib/styles/step.js +0 -4
  129. package/lib/styles/switch.d.ts +0 -1
  130. package/lib/styles/switch.js +2 -20
  131. package/lib/styles/tab.d.ts +1 -2
  132. package/lib/styles/tab.js +0 -5
  133. package/lib/styles/tabs.d.ts +3 -11
  134. package/lib/styles/tabs.js +10 -48
  135. package/lib/styles/tag.d.ts +1 -5
  136. package/lib/styles/tag.js +2 -31
  137. package/lib/styles/textarea.d.ts +1 -2
  138. package/lib/styles/textarea.js +2 -45
  139. package/lib/styles/tooltip.d.ts +0 -1
  140. package/lib/styles/tooltip.js +0 -10
  141. package/lib/styles/wizard.d.ts +5 -21
  142. package/lib/styles/wizard.js +8 -88
  143. package/lib/types/common.d.ts +0 -2
  144. package/lib/types/common.js +0 -12
  145. package/lib/utils/calendar-utils.d.ts +4 -21
  146. package/lib/utils/calendar-utils.js +4 -177
  147. package/lib/utils/custom-scrollbar.d.ts +6 -20
  148. package/lib/utils/custom-scrollbar.js +1 -45
  149. package/lib/utils/flavor-sheet.d.ts +0 -1
  150. package/lib/utils/flavor-sheet.js +0 -23
  151. package/lib/utils/icon-registry.d.ts +0 -2
  152. package/lib/utils/icon-registry.js +1 -107
  153. package/lib/utils/icons.d.ts +0 -1
  154. package/lib/utils/icons.js +0 -9
  155. package/lib/utils/loader-registry.d.ts +0 -1
  156. package/lib/utils/loader-registry.js +0 -32
  157. package/lib/utils/locale.d.ts +2 -23
  158. package/lib/utils/locale.js +0 -86
  159. package/lib/utils/mobile.d.ts +0 -1
  160. package/lib/utils/mobile.js +0 -17
  161. package/lib/utils/number-format.d.ts +6 -3
  162. package/lib/utils/number-format.js +11 -67
  163. package/lib/utils/positioning.d.ts +50 -7
  164. package/lib/utils/positioning.js +52 -62
  165. package/lib/utils/property-capture.d.ts +5 -27
  166. package/lib/utils/property-capture.js +0 -108
  167. package/lib/utils/property-manager.d.ts +0 -1
  168. package/lib/utils/property-manager.js +0 -70
  169. package/lib/utils/resize-observer.d.ts +0 -1
  170. package/lib/utils/resize-observer.js +0 -36
  171. package/lib/utils/scroll-lock.d.ts +4 -11
  172. package/lib/utils/scroll-lock.js +0 -107
  173. package/lib/utils/styles.d.ts +0 -1
  174. package/lib/utils/styles.js +0 -24
  175. package/lib/version.d.ts +1 -2
  176. package/lib/version.js +1 -11
  177. package/package.json +2 -2
  178. package/lib/base/ty-component.d.ts.map +0 -1
  179. package/lib/base/ty-component.js.map +0 -1
  180. package/lib/components/button.d.ts.map +0 -1
  181. package/lib/components/button.js.map +0 -1
  182. package/lib/components/calendar-month.d.ts.map +0 -1
  183. package/lib/components/calendar-month.js.map +0 -1
  184. package/lib/components/calendar-navigation.d.ts.map +0 -1
  185. package/lib/components/calendar-navigation.js.map +0 -1
  186. package/lib/components/calendar.d.ts.map +0 -1
  187. package/lib/components/calendar.js.map +0 -1
  188. package/lib/components/checkbox.d.ts.map +0 -1
  189. package/lib/components/checkbox.js.map +0 -1
  190. package/lib/components/copy.d.ts.map +0 -1
  191. package/lib/components/copy.js.map +0 -1
  192. package/lib/components/date-picker.d.ts.map +0 -1
  193. package/lib/components/date-picker.js.map +0 -1
  194. package/lib/components/file-upload.d.ts.map +0 -1
  195. package/lib/components/file-upload.js.map +0 -1
  196. package/lib/components/icon.d.ts.map +0 -1
  197. package/lib/components/icon.js.map +0 -1
  198. package/lib/components/input.d.ts.map +0 -1
  199. package/lib/components/input.js.map +0 -1
  200. package/lib/components/modal.d.ts.map +0 -1
  201. package/lib/components/modal.js.map +0 -1
  202. package/lib/components/option.d.ts.map +0 -1
  203. package/lib/components/option.js.map +0 -1
  204. package/lib/components/popup.d.ts.map +0 -1
  205. package/lib/components/popup.js.map +0 -1
  206. package/lib/components/radio.d.ts.map +0 -1
  207. package/lib/components/radio.js.map +0 -1
  208. package/lib/components/resize-observer.d.ts.map +0 -1
  209. package/lib/components/resize-observer.js.map +0 -1
  210. package/lib/components/scroll-container.d.ts.map +0 -1
  211. package/lib/components/scroll-container.js.map +0 -1
  212. package/lib/components/select.d.ts.map +0 -1
  213. package/lib/components/select.js.map +0 -1
  214. package/lib/components/selected-tags.d.ts.map +0 -1
  215. package/lib/components/selected-tags.js.map +0 -1
  216. package/lib/components/step.d.ts.map +0 -1
  217. package/lib/components/step.js.map +0 -1
  218. package/lib/components/switch.d.ts.map +0 -1
  219. package/lib/components/switch.js.map +0 -1
  220. package/lib/components/tab.d.ts.map +0 -1
  221. package/lib/components/tab.js.map +0 -1
  222. package/lib/components/tabs.d.ts.map +0 -1
  223. package/lib/components/tabs.js.map +0 -1
  224. package/lib/components/tag.d.ts.map +0 -1
  225. package/lib/components/tag.js.map +0 -1
  226. package/lib/components/textarea.d.ts.map +0 -1
  227. package/lib/components/textarea.js.map +0 -1
  228. package/lib/components/tooltip.d.ts.map +0 -1
  229. package/lib/components/tooltip.js.map +0 -1
  230. package/lib/components/wizard.d.ts.map +0 -1
  231. package/lib/components/wizard.js.map +0 -1
  232. package/lib/icons/fontawesome/brands.d.ts.map +0 -1
  233. package/lib/icons/fontawesome/brands.js.map +0 -1
  234. package/lib/icons/fontawesome/regular.d.ts.map +0 -1
  235. package/lib/icons/fontawesome/regular.js.map +0 -1
  236. package/lib/icons/fontawesome/solid.d.ts.map +0 -1
  237. package/lib/icons/fontawesome/solid.js.map +0 -1
  238. package/lib/icons/heroicons/micro.d.ts.map +0 -1
  239. package/lib/icons/heroicons/micro.js.map +0 -1
  240. package/lib/icons/heroicons/mini.d.ts.map +0 -1
  241. package/lib/icons/heroicons/mini.js.map +0 -1
  242. package/lib/icons/heroicons/outline.d.ts.map +0 -1
  243. package/lib/icons/heroicons/outline.js.map +0 -1
  244. package/lib/icons/heroicons/solid.d.ts.map +0 -1
  245. package/lib/icons/heroicons/solid.js.map +0 -1
  246. package/lib/icons/lucide.d.ts.map +0 -1
  247. package/lib/icons/lucide.js.map +0 -1
  248. package/lib/icons/material/filled.d.ts.map +0 -1
  249. package/lib/icons/material/filled.js.map +0 -1
  250. package/lib/icons/material/outlined.d.ts.map +0 -1
  251. package/lib/icons/material/outlined.js.map +0 -1
  252. package/lib/icons/material/round.d.ts.map +0 -1
  253. package/lib/icons/material/round.js.map +0 -1
  254. package/lib/icons/material/sharp.d.ts.map +0 -1
  255. package/lib/icons/material/sharp.js.map +0 -1
  256. package/lib/icons/material/two-tone.d.ts.map +0 -1
  257. package/lib/icons/material/two-tone.js.map +0 -1
  258. package/lib/index.d.ts.map +0 -1
  259. package/lib/index.js.map +0 -1
  260. package/lib/styles/button.d.ts.map +0 -1
  261. package/lib/styles/button.js.map +0 -1
  262. package/lib/styles/calendar-month.d.ts.map +0 -1
  263. package/lib/styles/calendar-month.js.map +0 -1
  264. package/lib/styles/calendar-navigation.d.ts.map +0 -1
  265. package/lib/styles/calendar-navigation.js.map +0 -1
  266. package/lib/styles/calendar.d.ts.map +0 -1
  267. package/lib/styles/calendar.js.map +0 -1
  268. package/lib/styles/checkbox.d.ts.map +0 -1
  269. package/lib/styles/checkbox.js.map +0 -1
  270. package/lib/styles/copy.d.ts.map +0 -1
  271. package/lib/styles/copy.js.map +0 -1
  272. package/lib/styles/custom-scrollbar.d.ts.map +0 -1
  273. package/lib/styles/custom-scrollbar.js.map +0 -1
  274. package/lib/styles/date-picker.d.ts.map +0 -1
  275. package/lib/styles/date-picker.js.map +0 -1
  276. package/lib/styles/file-upload.d.ts.map +0 -1
  277. package/lib/styles/file-upload.js.map +0 -1
  278. package/lib/styles/icon.d.ts.map +0 -1
  279. package/lib/styles/icon.js.map +0 -1
  280. package/lib/styles/input.d.ts.map +0 -1
  281. package/lib/styles/input.js.map +0 -1
  282. package/lib/styles/modal.d.ts.map +0 -1
  283. package/lib/styles/modal.js.map +0 -1
  284. package/lib/styles/multiselect.d.ts +0 -8
  285. package/lib/styles/multiselect.d.ts.map +0 -1
  286. package/lib/styles/multiselect.js +0 -849
  287. package/lib/styles/multiselect.js.map +0 -1
  288. package/lib/styles/option.d.ts.map +0 -1
  289. package/lib/styles/option.js.map +0 -1
  290. package/lib/styles/popup.d.ts.map +0 -1
  291. package/lib/styles/popup.js.map +0 -1
  292. package/lib/styles/radio.d.ts.map +0 -1
  293. package/lib/styles/radio.js.map +0 -1
  294. package/lib/styles/resize-observer.d.ts.map +0 -1
  295. package/lib/styles/resize-observer.js.map +0 -1
  296. package/lib/styles/scroll-container.d.ts.map +0 -1
  297. package/lib/styles/scroll-container.js.map +0 -1
  298. package/lib/styles/select-base.d.ts.map +0 -1
  299. package/lib/styles/select-base.js.map +0 -1
  300. package/lib/styles/select.d.ts.map +0 -1
  301. package/lib/styles/select.js.map +0 -1
  302. package/lib/styles/step.d.ts.map +0 -1
  303. package/lib/styles/step.js.map +0 -1
  304. package/lib/styles/switch.d.ts.map +0 -1
  305. package/lib/styles/switch.js.map +0 -1
  306. package/lib/styles/tab.d.ts.map +0 -1
  307. package/lib/styles/tab.js.map +0 -1
  308. package/lib/styles/tabs.d.ts.map +0 -1
  309. package/lib/styles/tabs.js.map +0 -1
  310. package/lib/styles/tag.d.ts.map +0 -1
  311. package/lib/styles/tag.js.map +0 -1
  312. package/lib/styles/textarea.d.ts.map +0 -1
  313. package/lib/styles/textarea.js.map +0 -1
  314. package/lib/styles/tooltip.d.ts.map +0 -1
  315. package/lib/styles/tooltip.js.map +0 -1
  316. package/lib/styles/wizard.d.ts.map +0 -1
  317. package/lib/styles/wizard.js.map +0 -1
  318. package/lib/types/common.d.ts.map +0 -1
  319. package/lib/types/common.js.map +0 -1
  320. package/lib/utils/calendar-utils.d.ts.map +0 -1
  321. package/lib/utils/calendar-utils.js.map +0 -1
  322. package/lib/utils/custom-scrollbar.d.ts.map +0 -1
  323. package/lib/utils/custom-scrollbar.js.map +0 -1
  324. package/lib/utils/flavor-sheet.d.ts.map +0 -1
  325. package/lib/utils/flavor-sheet.js.map +0 -1
  326. package/lib/utils/icon-registry.d.ts.map +0 -1
  327. package/lib/utils/icon-registry.js.map +0 -1
  328. package/lib/utils/icons.d.ts.map +0 -1
  329. package/lib/utils/icons.js.map +0 -1
  330. package/lib/utils/loader-registry.d.ts.map +0 -1
  331. package/lib/utils/loader-registry.js.map +0 -1
  332. package/lib/utils/locale.d.ts.map +0 -1
  333. package/lib/utils/locale.js.map +0 -1
  334. package/lib/utils/mobile.d.ts.map +0 -1
  335. package/lib/utils/mobile.js.map +0 -1
  336. package/lib/utils/number-format.d.ts.map +0 -1
  337. package/lib/utils/number-format.js.map +0 -1
  338. package/lib/utils/parse-boolean.d.ts +0 -39
  339. package/lib/utils/parse-boolean.d.ts.map +0 -1
  340. package/lib/utils/parse-boolean.js +0 -58
  341. package/lib/utils/parse-boolean.js.map +0 -1
  342. package/lib/utils/positioning.d.ts.map +0 -1
  343. package/lib/utils/positioning.js.map +0 -1
  344. package/lib/utils/property-capture.d.ts.map +0 -1
  345. package/lib/utils/property-capture.js.map +0 -1
  346. package/lib/utils/property-manager.d.ts.map +0 -1
  347. package/lib/utils/property-manager.js.map +0 -1
  348. package/lib/utils/resize-observer.d.ts.map +0 -1
  349. package/lib/utils/resize-observer.js.map +0 -1
  350. package/lib/utils/scroll-lock.d.ts.map +0 -1
  351. package/lib/utils/scroll-lock.js.map +0 -1
  352. package/lib/utils/styles.d.ts.map +0 -1
  353. package/lib/utils/styles.js.map +0 -1
  354. package/lib/version.d.ts.map +0 -1
  355. package/lib/version.js.map +0 -1
@@ -40,13 +40,7 @@ export declare abstract class TyComponent<T = any> extends HTMLElement {
40
40
  * Sync property value to HTML attribute
41
41
  */
42
42
  private _syncPropertyToAttribute;
43
- /**
44
- * Convert camelCase to kebab-case
45
- */
46
43
  private _toKebabCase;
47
- /**
48
- * Convert kebab-case to camelCase
49
- */
50
44
  private _toCamelCase;
51
45
  /**
52
46
  * Attribute changed callback - unified for all components
@@ -126,9 +120,26 @@ export declare abstract class TyComponent<T = any> extends HTMLElement {
126
120
  * the role element as aria-label, giving it an accessible name.
127
121
  */
128
122
  protected applyLabelName(roleEl: HTMLElement): void;
129
- /**
130
- * Form reset callback - called when form.reset() is invoked
131
- * Resets component to its default value
123
+ private _handlingActivationClick;
124
+ /**
125
+ * Guard for click-driven toggle handlers (checkbox/switch) on components
126
+ * whose whole host is the click target AND that expect a wrapping
127
+ * <label> to delegate to them. Some browsers still forward a label's own
128
+ * synthetic click to the associated control even when the original click
129
+ * already targeted that control directly, firing 'click' twice for one
130
+ * user gesture. Both arrive synchronously in the same task, so a flag
131
+ * cleared on the next microtask catches only the spurious duplicate —
132
+ * two genuinely separate clicks are always in different tasks.
133
+ */
134
+ protected isDuplicateActivationClick(): boolean;
135
+ private _resetDefaults;
136
+ /**
137
+ * Form reset callback - called when form.reset() is invoked.
138
+ * Restores every formValue-bearing property to its attribute-declared
139
+ * default captured at first connect (native defaultValue/defaultChecked
140
+ * semantics). Non-form state (e.g. a checkbox's submission `value`, a
141
+ * ty-radio's option `value`) is deliberately left alone — the old
142
+ * blanket 'value' reset corrupted radio groups by wiping child values.
132
143
  */
133
144
  formResetCallback(): void;
134
145
  /**
@@ -137,4 +148,3 @@ export declare abstract class TyComponent<T = any> extends HTMLElement {
137
148
  */
138
149
  protected onFormReset(): void;
139
150
  }
140
- //# sourceMappingURL=ty-component.d.ts.map
@@ -1,44 +1,22 @@
1
- /**
2
- * TyComponent - Base class for all Ty web components
3
- *
4
- * Provides unified property/attribute lifecycle management:
5
- * - Single code path for all property updates
6
- * - Declarative property configuration
7
- * - Predictable rendering behavior
8
- * - Form association support
9
- * - Property change events via 'prop:change' (separate from user 'change' events)
10
- */
11
1
  import { PropertyManager } from '../utils/property-manager.js';
12
- /**
13
- * Base class for all Ty components with unified property lifecycle
14
- */
15
2
  export class TyComponent extends HTMLElement {
16
3
  constructor() {
17
4
  super();
18
- // Track if component is connected
19
5
  this._connected = false;
20
- // Track if initial render happened
21
6
  this._rendered = false;
22
- // Initialize property manager
7
+ this._handlingActivationClick = false;
8
+ this._resetDefaults = null;
23
9
  const ctor = this.constructor;
24
10
  this.props = new PropertyManager(ctor.properties);
25
- // Form association
26
11
  this._internals = this.attachInternals();
27
- // Setup shadow DOM (subclasses can override by checking if shadowRoot exists)
28
12
  if (!this.shadowRoot) {
29
13
  this.attachShadow({ mode: 'open' });
30
14
  }
31
15
  }
32
- /**
33
- * Define which attributes to observe
34
- * Auto-generated from property configuration
35
- * Returns kebab-case attribute names (e.g., 'minHeight' -> 'min-height')
36
- */
37
16
  static get observedAttributes() {
38
17
  const attrs = [];
39
18
  for (const [name, config] of Object.entries(this.properties)) {
40
19
  attrs.push(name.replace(/([a-z])([A-Z])/g, '$1-$2').toLowerCase());
41
- // Include alias names so attributeChangedCallback fires for them
42
20
  if (config.aliases) {
43
21
  for (const alias of Object.keys(config.aliases)) {
44
22
  attrs.push(alias);
@@ -47,37 +25,22 @@ export class TyComponent extends HTMLElement {
47
25
  }
48
26
  return attrs;
49
27
  }
50
- /**
51
- * Unified property setter
52
- * Use this in your property setters instead of direct field assignment
53
- */
54
28
  setProperty(name, value) {
55
29
  const change = this.props.updateProperty(name, value, 'property');
56
30
  if (change) {
57
- // Sync to attribute (kebab-case)
58
31
  this._syncPropertyToAttribute(change);
59
- // Handle the change through unified lifecycle
60
32
  this._handlePropertyChanges([change]);
61
33
  }
62
34
  }
63
- /**
64
- * Unified property getter
65
- * Use this in your property getters
66
- */
67
35
  getProperty(name) {
68
36
  return this.props.get(name);
69
37
  }
70
- /**
71
- * Sync property value to HTML attribute
72
- */
73
38
  _syncPropertyToAttribute(change) {
74
39
  const { name, newValue } = change;
75
40
  const config = this.props.getConfig(name);
76
41
  if (!config)
77
42
  return;
78
- // Convert to kebab-case for attribute
79
43
  const attrName = this._toKebabCase(name);
80
- // Handle different types
81
44
  if (config.type === 'boolean') {
82
45
  if (newValue) {
83
46
  this.setAttribute(attrName, '');
@@ -96,29 +59,17 @@ export class TyComponent extends HTMLElement {
96
59
  this.setAttribute(attrName, String(newValue));
97
60
  }
98
61
  }
99
- /**
100
- * Convert camelCase to kebab-case
101
- */
102
62
  _toKebabCase(str) {
103
63
  return str.replace(/([a-z])([A-Z])/g, '$1-$2').toLowerCase();
104
64
  }
105
- /**
106
- * Convert kebab-case to camelCase
107
- */
108
65
  _toCamelCase(str) {
109
66
  return str.replace(/-([a-z])/g, (_, letter) => letter.toUpperCase());
110
67
  }
111
- /**
112
- * Attribute changed callback - unified for all components
113
- */
114
68
  attributeChangedCallback(name, oldValue, newValue) {
115
69
  if (oldValue === newValue)
116
70
  return;
117
- // Check if this is an alias (e.g., not-clearable)
118
71
  let change = this.props.handleAlias(name, newValue);
119
72
  if (!change) {
120
- // Properties may be registered with kebab-case (e.g., 'display-month')
121
- // or camelCase. Try the attribute name as-is first, then camelCase.
122
73
  const camelName = this._toCamelCase(name);
123
74
  const propName = this.props.hasConfig(name) ? name : camelName;
124
75
  change = this.props.updateProperty(propName, newValue, 'attribute');
@@ -127,41 +78,36 @@ export class TyComponent extends HTMLElement {
127
78
  this._handlePropertyChanges([change]);
128
79
  }
129
80
  }
130
- /**
131
- * Connected callback - handle pre-set properties
132
- */
133
81
  connectedCallback() {
134
82
  this._connected = true;
135
- // Capture pre-set properties (React/Vue/Reagent pattern)
83
+ if (!this._resetDefaults) {
84
+ this._resetDefaults = new Map();
85
+ const ctor = this.constructor;
86
+ for (const [name, config] of Object.entries(ctor.properties)) {
87
+ if (!config.formValue)
88
+ continue;
89
+ const attr = this.getAttribute(this._toKebabCase(name));
90
+ this._resetDefaults.set(name, attr ?? config.default ?? null);
91
+ }
92
+ }
136
93
  const preSetProps = this._capturePreSetProperties();
137
- // Batch process all pre-set properties
138
94
  if (preSetProps.length > 0) {
139
95
  this._handlePropertyChanges(preSetProps);
140
96
  }
141
- // Initialize component (subclass hook)
142
97
  this.onConnect();
143
- // Initial render
144
98
  if (!this._rendered) {
145
99
  this.render();
146
100
  this._rendered = true;
147
101
  }
148
102
  }
149
- /**
150
- * Disconnected callback
151
- */
152
103
  disconnectedCallback() {
153
104
  this._connected = false;
154
105
  this.onDisconnect();
155
106
  }
156
- /**
157
- * Capture properties that were set before connectedCallback
158
- * (React, Vue, Reagent set properties before element is connected)
159
- */
160
107
  _capturePreSetProperties() {
161
108
  const changes = [];
162
109
  const ctor = this.constructor;
163
110
  for (const propName of Object.keys(ctor.properties)) {
164
- // Check if property was set on the element before connection
165
111
  const descriptor = Object.getOwnPropertyDescriptor(this, propName);
166
112
  if (descriptor && descriptor.value !== undefined) {
167
113
  const change = this.props.updateProperty(propName, descriptor.value, 'property');
@@ -172,38 +118,20 @@ export class TyComponent extends HTMLElement {
172
118
  }
173
119
  return changes;
174
120
  }
175
- /**
176
- * THE CORE LIFECYCLE METHOD
177
- * All property changes flow through here
178
- *
179
- * Lifecycle order:
180
- * 1. Update internal state (onPropertiesChanged hook)
181
- * 2. Sync form value (if formValue property changed)
182
- * 3. Render (if visual property changed)
183
- * 4. Emit events (if emitChange property changed)
184
- */
185
121
  _handlePropertyChanges(changes) {
186
122
  if (changes.length === 0)
187
123
  return;
188
- // 1. Update internal state (subclass-specific)
189
124
  this.onPropertiesChanged(changes);
190
- // 2. Sync form value if needed
191
125
  const formValueChanged = changes.some(c => this.props.isFormValue(c.name));
192
126
  if (formValueChanged) {
193
127
  this.updateFormValue();
194
128
  }
195
- // 3. Render only if visual properties changed AND component is connected
196
129
  const visualChanged = changes.some(c => this.props.isVisual(c.name));
197
130
  if (visualChanged && this._connected) {
198
131
  this.render();
199
132
  }
200
- // 4. Emit change events if configured
201
133
  this._emitChangeEvents(changes);
202
134
  }
203
- /**
204
- * Emit property change events for properties that require it
205
- * Uses 'prop:change' event to avoid conflicts with user interaction 'change' events
206
- */
207
135
  _emitChangeEvents(changes) {
208
136
  for (const change of changes) {
209
137
  if (this.props.shouldEmitChange(change.name)) {
@@ -219,68 +147,28 @@ export class TyComponent extends HTMLElement {
219
147
  }
220
148
  }
221
149
  }
222
- /**
223
- * Update form value via ElementInternals
224
- * Subclasses can override to customize form value
225
- */
226
150
  updateFormValue() {
227
151
  const formValue = this.getFormValue();
228
152
  this._internals.setFormValue(formValue);
229
153
  }
230
- /**
231
- * Get the form value for this component
232
- * Default: return 'value' property
233
- * Override for custom behavior
234
- */
235
154
  getFormValue() {
236
155
  return this.props.get('value') ?? null;
237
156
  }
238
- /**
239
- * Hook: Called when properties change
240
- * Subclasses can override to update internal state
241
- *
242
- * This is called BEFORE rendering, so you can update
243
- * internal state here and it will be reflected in the render
244
- */
245
157
  onPropertiesChanged(changes) {
246
- // Default: no-op
247
- // Subclasses can override to update _state, _config, etc.
248
158
  }
249
- /**
250
- * Hook: Called when component is connected
251
- * Use this instead of overriding connectedCallback
252
- */
253
159
  onConnect() {
254
- // Default: no-op
255
160
  }
256
- /**
257
- * Hook: Called when component is disconnected
258
- * Use this for cleanup instead of overriding disconnectedCallback
259
- */
260
161
  onDisconnect() {
261
- // Default: no-op
262
162
  }
263
- /**
264
- * Get the form element this component is associated with
265
- */
266
163
  get form() {
267
164
  return this._internals.form;
268
165
  }
269
- /**
270
- * a11y helper for components whose ARIA role lives on an inner shadow element
271
- * (checkbox/switch/radio). A wrapping <label> names the form-associated HOST,
272
- * not the inner role element — so mirror the host's associated label text onto
273
- * the role element as aria-label, giving it an accessible name.
274
- */
275
166
  applyLabelName(roleEl) {
276
167
  let text = Array.from(this._internals.labels ?? [])
277
168
  .map((l) => l.textContent?.trim())
278
169
  .filter(Boolean)
279
170
  .join(' ');
280
171
  if (!text) {
281
- // Non-form-associated controls (e.g. ty-radio) aren't labelable, so the
282
- // wrapping <label> never appears in internals.labels — read it directly,
283
- // stripping this element's own subtree from the text.
284
172
  const lbl = this.closest('label');
285
173
  if (lbl) {
286
174
  const clone = lbl.cloneNode(true);
@@ -293,32 +181,21 @@ export class TyComponent extends HTMLElement {
293
181
  else
294
182
  roleEl.removeAttribute('aria-label');
295
183
  }
296
- /**
297
- * Form reset callback - called when form.reset() is invoked
298
- * Resets component to its default value
299
- */
184
+ isDuplicateActivationClick() {
185
+ if (this._handlingActivationClick)
186
+ return true;
187
+ this._handlingActivationClick = true;
188
+ queueMicrotask(() => { this._handlingActivationClick = false; });
189
+ return false;
190
+ }
300
191
  formResetCallback() {
301
- // Get the default value from property configuration
302
- const ctor = this.constructor;
303
- const valueConfig = ctor.properties['value'];
304
- if (valueConfig) {
305
- const defaultValue = valueConfig.default ?? '';
306
- // Reset the value property through setProperty to trigger lifecycle
307
- this.setProperty('value', defaultValue);
192
+ for (const [name, def] of this._resetDefaults ?? []) {
193
+ this.setProperty(name, def);
308
194
  }
309
- // Call subclass hook for custom reset behavior
310
195
  this.onFormReset();
311
196
  }
312
- /**
313
- * Hook: Called when form is reset
314
- * Subclasses can override to perform additional reset actions
315
- */
316
197
  onFormReset() {
317
- // Default: no-op
318
- // Subclasses can override to reset additional state
319
198
  }
320
199
  }
321
200
  TyComponent.formAssociated = true;
322
- // Subclasses must define their property configuration
323
201
  TyComponent.properties = {};
324
- //# sourceMappingURL=ty-component.js.map
@@ -1,12 +1,6 @@
1
1
  /**
2
- * TyButton Web Component
3
- *
4
- * Three appearance variants × six flavors × three tones (+/base/-).
5
- * appearance="solid" saturated brand fill (default)
6
- * appearance="outlined" transparent bg, text === border
7
- * appearance="ghost" text only, hover bg
8
- *
9
- * Append `+` or `-` to a flavor for stronger/softer tone (e.g. "primary+").
2
+ * TyButton Web Component — three appearances (solid/outlined/ghost) × six
3
+ * flavors × three tones. Append `+`/`-` to a flavor for stronger/softer tone.
10
4
  */
11
5
  import type { Flavor, Size, TyButtonElement } from "../types/common.js";
12
6
  import { TyComponent } from "../base/ty-component.js";
@@ -27,13 +21,6 @@ interface ButtonState {
27
21
  }
28
22
  /**
29
23
  * Ty Button Component
30
- *
31
- * @example
32
- * ```html
33
- * <ty-button flavor="primary">Default solid</ty-button>
34
- * <ty-button appearance="outlined" flavor="danger">Outlined</ty-button>
35
- * <ty-button appearance="ghost" flavor="success+">Ghost stronger</ty-button>
36
- * ```
37
24
  */
38
25
  export declare class TyButton extends TyComponent<ButtonState> implements TyButtonElement {
39
26
  static formAssociated: boolean;
@@ -147,4 +134,3 @@ export declare class TyButton extends TyComponent<ButtonState> implements TyButt
147
134
  protected render(): void;
148
135
  }
149
136
  export {};
150
- //# sourceMappingURL=button.d.ts.map
@@ -1,33 +1,12 @@
1
- /**
2
- * TyButton Web Component
3
- *
4
- * Three appearance variants × six flavors × three tones (+/base/-).
5
- * appearance="solid" saturated brand fill (default)
6
- * appearance="outlined" transparent bg, text === border
7
- * appearance="ghost" text only, hover bg
8
- *
9
- * Append `+` or `-` to a flavor for stronger/softer tone (e.g. "primary+").
10
- */
11
1
  import { TyComponent } from "../base/ty-component.js";
12
2
  import { ensureStyles, buildClassList } from "../utils/styles.js";
13
3
  import { buttonStyles, buttonCustomFlavorCss } from "../styles/button.js";
14
4
  import { syncCustomFlavorSheet } from "../utils/flavor-sheet.js";
15
5
  import { getLoaderSvg } from "../utils/loader-registry.js";
16
- /**
17
- * Ty Button Component
18
- *
19
- * @example
20
- * ```html
21
- * <ty-button flavor="primary">Default solid</ty-button>
22
- * <ty-button appearance="outlined" flavor="danger">Outlined</ty-button>
23
- * <ty-button appearance="ghost" flavor="success+">Ghost stronger</ty-button>
24
- * ```
25
- */
26
6
  export class TyButton extends TyComponent {
27
7
  constructor() {
28
8
  super();
29
9
  this._structureInitialized = false;
30
- // Adopted sheet with generated rules for a custom (non-built-in) flavor
31
10
  this._customFlavorSheet = null;
32
11
  ensureStyles(this.shadowRoot, { css: buttonStyles, id: "ty-button" });
33
12
  }
@@ -40,19 +19,10 @@ export class TyButton extends TyComponent {
40
19
  this._syncCustomFlavor();
41
20
  }
42
21
  }
43
- /**
44
- * Custom flavors: adopt generated per-flavor rules pointed at the user's
45
- * design tokens (--ty-solid-X / --ty-color-X / --ty-bg-X), falling back to
46
- * neutral for any token the user didn't define. Tone (+/-) is handled by
47
- * the tone-plus/tone-minus classes, so only the base flavor matters here.
48
- */
49
22
  _syncCustomFlavor() {
50
23
  const { base } = this.parseFlavor();
51
24
  this._customFlavorSheet = syncCustomFlavorSheet(this.shadowRoot, this._customFlavorSheet, base, () => buttonCustomFlavorCss(base));
52
25
  }
53
- // ============================================================================
54
- // PROPERTY ACCESSORS
55
- // ============================================================================
56
26
  get flavor() {
57
27
  return this.getProperty("flavor");
58
28
  }
@@ -125,10 +95,6 @@ export class TyButton extends TyComponent {
125
95
  set value(value) {
126
96
  this.setProperty("value", value);
127
97
  }
128
- // ============================================================================
129
- // INTERNAL
130
- // ============================================================================
131
- /** Parse the optional `+`/`-` shade suffix from a flavor string. */
132
98
  parseFlavor() {
133
99
  const f = this.flavor || "";
134
100
  if (f.length > 1 && f.endsWith("+"))
@@ -200,7 +166,6 @@ export class TyButton extends TyComponent {
200
166
  button.classList.toggle("loading", isLoading);
201
167
  if (isLoading) {
202
168
  button.setAttribute("aria-busy", "true");
203
- // Pull the latest registered loader SVG so registry changes take effect
204
169
  const loader = button.querySelector(".loader-icon");
205
170
  if (loader)
206
171
  loader.innerHTML = getLoaderSvg();
@@ -304,4 +269,3 @@ TyButton.properties = {
304
269
  if (!customElements.get("ty-button")) {
305
270
  customElements.define("ty-button", TyButton);
306
271
  }
307
- //# sourceMappingURL=button.js.map
@@ -1,39 +1,6 @@
1
1
  /**
2
- * TyCalendarMonth Web Component
3
- * PORTED FROM: cljs/ty/components/calendar_month.cljs
4
- *
5
- * A stateless, property-driven calendar month renderer with customizable
6
- * day content and styling.
7
- *
8
- * Features:
9
- * - 42-day grid (6 weeks × 7 days) with Monday-first ordering
10
- * - Localized weekday headers
11
- * - Custom day content rendering via dayContentFn
12
- * - Custom day classes via dayClassesFn
13
- * - Custom CSS injection via customCSS
14
- * - Responsive width system (width, minWidth, maxWidth)
15
- * - Rich day-click events with full context
16
- *
17
- * @example
18
- * ```html
19
- * <!-- Basic usage -->
20
- * <ty-calendar-month
21
- * display-year="2025"
22
- * display-month="10"
23
- * locale="en-US">
24
- * </ty-calendar-month>
25
- *
26
- * <!-- With custom rendering -->
27
- * <ty-calendar-month id="custom"></ty-calendar-month>
28
- * <script type="module">
29
- * const cal = document.getElementById('custom');
30
- * cal.dayContentFn = (ctx) => {
31
- * const el = document.createElement('div');
32
- * el.textContent = ctx.dayInMonth;
33
- * return el;
34
- * };
35
- * </script>
36
- * ```
2
+ * TyCalendarMonth Web Component — a stateless, property-driven calendar month
3
+ * renderer (42-day grid, Monday-first) with customizable day content/styling.
37
4
  */
38
5
  import { type DayContext } from '../utils/calendar-utils.js';
39
6
  /**
@@ -124,22 +91,13 @@ export declare class TyCalendarMonth extends HTMLElement {
124
91
  * Apply width-related properties as CSS custom properties
125
92
  */
126
93
  private applyWidthProperties;
127
- /**
128
- * Apply custom CSS to shadow root
129
- */
130
94
  private applyCustomCSS;
131
95
  /**
132
96
  * Force re-render of the calendar month
133
97
  * Useful when external data changes (e.g., async event loading)
134
98
  */
135
99
  refresh(): void;
136
- /**
137
- * Dispatch day-click custom event with day context
138
- */
139
100
  private dispatchDayClick;
140
- /**
141
- * Render a single day cell
142
- */
143
101
  /**
144
102
  * WAI-ARIA grid pattern: gridcell + roving tabindex (exactly one cell in
145
103
  * the whole grid is tabindex="0" at a time — the rest are -1, so Tab
@@ -147,9 +105,5 @@ export declare class TyCalendarMonth extends HTMLElement {
147
105
  * Disabled days are excluded from the roving set entirely.
148
106
  */
149
107
  private renderDayCell;
150
- /**
151
- * Main render function - property-based approach
152
- */
153
108
  private render;
154
109
  }
155
- //# sourceMappingURL=calendar-month.d.ts.map