tyrell-components 1.0.0-TC7

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 (330) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +221 -0
  3. package/css/tyrell.css +1783 -0
  4. package/dist/tyrell.css +1783 -0
  5. package/dist/tyrell.js +2 -0
  6. package/lib/base/ty-component.d.ts +133 -0
  7. package/lib/base/ty-component.d.ts.map +1 -0
  8. package/lib/base/ty-component.js +297 -0
  9. package/lib/base/ty-component.js.map +1 -0
  10. package/lib/components/button.d.ts +126 -0
  11. package/lib/components/button.d.ts.map +1 -0
  12. package/lib/components/button.js +244 -0
  13. package/lib/components/button.js.map +1 -0
  14. package/lib/components/calendar-month.d.ts +132 -0
  15. package/lib/components/calendar-month.d.ts.map +1 -0
  16. package/lib/components/calendar-month.js +440 -0
  17. package/lib/components/calendar-month.js.map +1 -0
  18. package/lib/components/calendar-navigation.d.ts +137 -0
  19. package/lib/components/calendar-navigation.d.ts.map +1 -0
  20. package/lib/components/calendar-navigation.js +366 -0
  21. package/lib/components/calendar-navigation.js.map +1 -0
  22. package/lib/components/calendar.d.ts +166 -0
  23. package/lib/components/calendar.d.ts.map +1 -0
  24. package/lib/components/calendar.js +774 -0
  25. package/lib/components/calendar.js.map +1 -0
  26. package/lib/components/checkbox.d.ts +189 -0
  27. package/lib/components/checkbox.d.ts.map +1 -0
  28. package/lib/components/checkbox.js +400 -0
  29. package/lib/components/checkbox.js.map +1 -0
  30. package/lib/components/copy.d.ts +180 -0
  31. package/lib/components/copy.d.ts.map +1 -0
  32. package/lib/components/copy.js +393 -0
  33. package/lib/components/copy.js.map +1 -0
  34. package/lib/components/date-picker.d.ts +379 -0
  35. package/lib/components/date-picker.d.ts.map +1 -0
  36. package/lib/components/date-picker.js +1586 -0
  37. package/lib/components/date-picker.js.map +1 -0
  38. package/lib/components/dropdown.d.ts +402 -0
  39. package/lib/components/dropdown.d.ts.map +1 -0
  40. package/lib/components/dropdown.js +1564 -0
  41. package/lib/components/dropdown.js.map +1 -0
  42. package/lib/components/icon.d.ts +107 -0
  43. package/lib/components/icon.d.ts.map +1 -0
  44. package/lib/components/icon.js +230 -0
  45. package/lib/components/icon.js.map +1 -0
  46. package/lib/components/input.d.ts +270 -0
  47. package/lib/components/input.d.ts.map +1 -0
  48. package/lib/components/input.js +721 -0
  49. package/lib/components/input.js.map +1 -0
  50. package/lib/components/modal.d.ts +58 -0
  51. package/lib/components/modal.d.ts.map +1 -0
  52. package/lib/components/modal.js +473 -0
  53. package/lib/components/modal.js.map +1 -0
  54. package/lib/components/multiselect.d.ts +397 -0
  55. package/lib/components/multiselect.d.ts.map +1 -0
  56. package/lib/components/multiselect.js +1580 -0
  57. package/lib/components/multiselect.js.map +1 -0
  58. package/lib/components/option.d.ts +66 -0
  59. package/lib/components/option.d.ts.map +1 -0
  60. package/lib/components/option.js +314 -0
  61. package/lib/components/option.js.map +1 -0
  62. package/lib/components/popup.d.ts +43 -0
  63. package/lib/components/popup.d.ts.map +1 -0
  64. package/lib/components/popup.js +380 -0
  65. package/lib/components/popup.js.map +1 -0
  66. package/lib/components/radio.d.ts +198 -0
  67. package/lib/components/radio.d.ts.map +1 -0
  68. package/lib/components/radio.js +437 -0
  69. package/lib/components/radio.js.map +1 -0
  70. package/lib/components/resize-observer.d.ts +48 -0
  71. package/lib/components/resize-observer.d.ts.map +1 -0
  72. package/lib/components/resize-observer.js +108 -0
  73. package/lib/components/resize-observer.js.map +1 -0
  74. package/lib/components/scroll-container.d.ts +51 -0
  75. package/lib/components/scroll-container.d.ts.map +1 -0
  76. package/lib/components/scroll-container.js +239 -0
  77. package/lib/components/scroll-container.js.map +1 -0
  78. package/lib/components/step.d.ts +26 -0
  79. package/lib/components/step.d.ts.map +1 -0
  80. package/lib/components/step.js +75 -0
  81. package/lib/components/step.js.map +1 -0
  82. package/lib/components/switch.d.ts +111 -0
  83. package/lib/components/switch.d.ts.map +1 -0
  84. package/lib/components/switch.js +240 -0
  85. package/lib/components/switch.js.map +1 -0
  86. package/lib/components/tab.d.ts +23 -0
  87. package/lib/components/tab.d.ts.map +1 -0
  88. package/lib/components/tab.js +76 -0
  89. package/lib/components/tab.js.map +1 -0
  90. package/lib/components/tabs.d.ts +93 -0
  91. package/lib/components/tabs.d.ts.map +1 -0
  92. package/lib/components/tabs.js +653 -0
  93. package/lib/components/tabs.js.map +1 -0
  94. package/lib/components/tag.d.ts +144 -0
  95. package/lib/components/tag.d.ts.map +1 -0
  96. package/lib/components/tag.js +314 -0
  97. package/lib/components/tag.js.map +1 -0
  98. package/lib/components/textarea.d.ts +241 -0
  99. package/lib/components/textarea.d.ts.map +1 -0
  100. package/lib/components/textarea.js +585 -0
  101. package/lib/components/textarea.js.map +1 -0
  102. package/lib/components/tooltip.d.ts +40 -0
  103. package/lib/components/tooltip.d.ts.map +1 -0
  104. package/lib/components/tooltip.js +439 -0
  105. package/lib/components/tooltip.js.map +1 -0
  106. package/lib/components/wizard.d.ts +86 -0
  107. package/lib/components/wizard.d.ts.map +1 -0
  108. package/lib/components/wizard.js +636 -0
  109. package/lib/components/wizard.js.map +1 -0
  110. package/lib/icons/fontawesome/brands.d.ts +557 -0
  111. package/lib/icons/fontawesome/brands.d.ts.map +1 -0
  112. package/lib/icons/fontawesome/brands.js +557 -0
  113. package/lib/icons/fontawesome/brands.js.map +1 -0
  114. package/lib/icons/fontawesome/regular.d.ts +281 -0
  115. package/lib/icons/fontawesome/regular.d.ts.map +1 -0
  116. package/lib/icons/fontawesome/regular.js +281 -0
  117. package/lib/icons/fontawesome/regular.js.map +1 -0
  118. package/lib/icons/fontawesome/solid.d.ts +1992 -0
  119. package/lib/icons/fontawesome/solid.d.ts.map +1 -0
  120. package/lib/icons/fontawesome/solid.js +1992 -0
  121. package/lib/icons/fontawesome/solid.js.map +1 -0
  122. package/lib/icons/heroicons/micro.d.ts +324 -0
  123. package/lib/icons/heroicons/micro.d.ts.map +1 -0
  124. package/lib/icons/heroicons/micro.js +1032 -0
  125. package/lib/icons/heroicons/micro.js.map +1 -0
  126. package/lib/icons/heroicons/mini.d.ts +332 -0
  127. package/lib/icons/heroicons/mini.d.ts.map +1 -0
  128. package/lib/icons/heroicons/mini.js +1038 -0
  129. package/lib/icons/heroicons/mini.js.map +1 -0
  130. package/lib/icons/heroicons/outline.d.ts +332 -0
  131. package/lib/icons/heroicons/outline.d.ts.map +1 -0
  132. package/lib/icons/heroicons/outline.js +993 -0
  133. package/lib/icons/heroicons/outline.js.map +1 -0
  134. package/lib/icons/heroicons/solid.d.ts +332 -0
  135. package/lib/icons/heroicons/solid.d.ts.map +1 -0
  136. package/lib/icons/heroicons/solid.js +1063 -0
  137. package/lib/icons/heroicons/solid.js.map +1 -0
  138. package/lib/icons/lucide.d.ts +1872 -0
  139. package/lib/icons/lucide.d.ts.map +1 -0
  140. package/lib/icons/lucide.js +28212 -0
  141. package/lib/icons/lucide.js.map +1 -0
  142. package/lib/icons/material/filled.d.ts +2180 -0
  143. package/lib/icons/material/filled.d.ts.map +1 -0
  144. package/lib/icons/material/filled.js +14003 -0
  145. package/lib/icons/material/filled.js.map +1 -0
  146. package/lib/icons/material/outlined.d.ts +2142 -0
  147. package/lib/icons/material/outlined.d.ts.map +1 -0
  148. package/lib/icons/material/outlined.js +14545 -0
  149. package/lib/icons/material/outlined.js.map +1 -0
  150. package/lib/icons/material/round.d.ts +2147 -0
  151. package/lib/icons/material/round.d.ts.map +1 -0
  152. package/lib/icons/material/round.js +14779 -0
  153. package/lib/icons/material/round.js.map +1 -0
  154. package/lib/icons/material/sharp.d.ts +2147 -0
  155. package/lib/icons/material/sharp.d.ts.map +1 -0
  156. package/lib/icons/material/sharp.js +14189 -0
  157. package/lib/icons/material/sharp.js.map +1 -0
  158. package/lib/icons/material/two-tone.d.ts +2185 -0
  159. package/lib/icons/material/two-tone.d.ts.map +1 -0
  160. package/lib/icons/material/two-tone.js +17152 -0
  161. package/lib/icons/material/two-tone.js.map +1 -0
  162. package/lib/index.d.ts +78 -0
  163. package/lib/index.d.ts.map +1 -0
  164. package/lib/index.js +71 -0
  165. package/lib/index.js.map +1 -0
  166. package/lib/styles/button.d.ts +14 -0
  167. package/lib/styles/button.d.ts.map +1 -0
  168. package/lib/styles/button.js +457 -0
  169. package/lib/styles/button.js.map +1 -0
  170. package/lib/styles/calendar-month.d.ts +6 -0
  171. package/lib/styles/calendar-month.d.ts.map +1 -0
  172. package/lib/styles/calendar-month.js +229 -0
  173. package/lib/styles/calendar-month.js.map +1 -0
  174. package/lib/styles/calendar-navigation.d.ts +6 -0
  175. package/lib/styles/calendar-navigation.d.ts.map +1 -0
  176. package/lib/styles/calendar-navigation.js +125 -0
  177. package/lib/styles/calendar-navigation.js.map +1 -0
  178. package/lib/styles/calendar.d.ts +6 -0
  179. package/lib/styles/calendar.d.ts.map +1 -0
  180. package/lib/styles/calendar.js +28 -0
  181. package/lib/styles/calendar.js.map +1 -0
  182. package/lib/styles/checkbox.d.ts +9 -0
  183. package/lib/styles/checkbox.d.ts.map +1 -0
  184. package/lib/styles/checkbox.js +19 -0
  185. package/lib/styles/checkbox.js.map +1 -0
  186. package/lib/styles/copy.d.ts +7 -0
  187. package/lib/styles/copy.d.ts.map +1 -0
  188. package/lib/styles/copy.js +94 -0
  189. package/lib/styles/copy.js.map +1 -0
  190. package/lib/styles/custom-scrollbar.d.ts +6 -0
  191. package/lib/styles/custom-scrollbar.d.ts.map +1 -0
  192. package/lib/styles/custom-scrollbar.js +157 -0
  193. package/lib/styles/custom-scrollbar.js.map +1 -0
  194. package/lib/styles/date-picker.d.ts +6 -0
  195. package/lib/styles/date-picker.d.ts.map +1 -0
  196. package/lib/styles/date-picker.js +400 -0
  197. package/lib/styles/date-picker.js.map +1 -0
  198. package/lib/styles/dropdown.d.ts +12 -0
  199. package/lib/styles/dropdown.d.ts.map +1 -0
  200. package/lib/styles/dropdown.js +983 -0
  201. package/lib/styles/dropdown.js.map +1 -0
  202. package/lib/styles/icon.d.ts +6 -0
  203. package/lib/styles/icon.d.ts.map +1 -0
  204. package/lib/styles/icon.js +231 -0
  205. package/lib/styles/icon.js.map +1 -0
  206. package/lib/styles/input.d.ts +7 -0
  207. package/lib/styles/input.d.ts.map +1 -0
  208. package/lib/styles/input.js +685 -0
  209. package/lib/styles/input.js.map +1 -0
  210. package/lib/styles/modal.d.ts +8 -0
  211. package/lib/styles/modal.d.ts.map +1 -0
  212. package/lib/styles/modal.js +134 -0
  213. package/lib/styles/modal.js.map +1 -0
  214. package/lib/styles/multiselect.d.ts +6 -0
  215. package/lib/styles/multiselect.d.ts.map +1 -0
  216. package/lib/styles/multiselect.js +774 -0
  217. package/lib/styles/multiselect.js.map +1 -0
  218. package/lib/styles/option.d.ts +6 -0
  219. package/lib/styles/option.d.ts.map +1 -0
  220. package/lib/styles/option.js +116 -0
  221. package/lib/styles/option.js.map +1 -0
  222. package/lib/styles/popup.d.ts +8 -0
  223. package/lib/styles/popup.d.ts.map +1 -0
  224. package/lib/styles/popup.js +95 -0
  225. package/lib/styles/popup.js.map +1 -0
  226. package/lib/styles/radio.d.ts +8 -0
  227. package/lib/styles/radio.d.ts.map +1 -0
  228. package/lib/styles/radio.js +160 -0
  229. package/lib/styles/radio.js.map +1 -0
  230. package/lib/styles/resize-observer.d.ts +6 -0
  231. package/lib/styles/resize-observer.d.ts.map +1 -0
  232. package/lib/styles/resize-observer.js +18 -0
  233. package/lib/styles/resize-observer.js.map +1 -0
  234. package/lib/styles/scroll-container.d.ts +6 -0
  235. package/lib/styles/scroll-container.d.ts.map +1 -0
  236. package/lib/styles/scroll-container.js +198 -0
  237. package/lib/styles/scroll-container.js.map +1 -0
  238. package/lib/styles/step.d.ts +5 -0
  239. package/lib/styles/step.d.ts.map +1 -0
  240. package/lib/styles/step.js +50 -0
  241. package/lib/styles/step.js.map +1 -0
  242. package/lib/styles/switch.d.ts +9 -0
  243. package/lib/styles/switch.d.ts.map +1 -0
  244. package/lib/styles/switch.js +100 -0
  245. package/lib/styles/switch.js.map +1 -0
  246. package/lib/styles/tab.d.ts +5 -0
  247. package/lib/styles/tab.d.ts.map +1 -0
  248. package/lib/styles/tab.js +51 -0
  249. package/lib/styles/tab.js.map +1 -0
  250. package/lib/styles/tabs.d.ts +13 -0
  251. package/lib/styles/tabs.d.ts.map +1 -0
  252. package/lib/styles/tabs.js +184 -0
  253. package/lib/styles/tabs.js.map +1 -0
  254. package/lib/styles/tag.d.ts +6 -0
  255. package/lib/styles/tag.d.ts.map +1 -0
  256. package/lib/styles/tag.js +415 -0
  257. package/lib/styles/tag.js.map +1 -0
  258. package/lib/styles/textarea.d.ts +6 -0
  259. package/lib/styles/textarea.d.ts.map +1 -0
  260. package/lib/styles/textarea.js +350 -0
  261. package/lib/styles/textarea.js.map +1 -0
  262. package/lib/styles/tooltip.d.ts +9 -0
  263. package/lib/styles/tooltip.d.ts.map +1 -0
  264. package/lib/styles/tooltip.js +136 -0
  265. package/lib/styles/tooltip.js.map +1 -0
  266. package/lib/styles/wizard.d.ts +25 -0
  267. package/lib/styles/wizard.d.ts.map +1 -0
  268. package/lib/styles/wizard.js +325 -0
  269. package/lib/styles/wizard.js.map +1 -0
  270. package/lib/types/common.d.ts +143 -0
  271. package/lib/types/common.d.ts.map +1 -0
  272. package/lib/types/common.js +5 -0
  273. package/lib/types/common.js.map +1 -0
  274. package/lib/utils/calendar-utils.d.ts +176 -0
  275. package/lib/utils/calendar-utils.d.ts.map +1 -0
  276. package/lib/utils/calendar-utils.js +370 -0
  277. package/lib/utils/calendar-utils.js.map +1 -0
  278. package/lib/utils/custom-scrollbar.d.ts +82 -0
  279. package/lib/utils/custom-scrollbar.d.ts.map +1 -0
  280. package/lib/utils/custom-scrollbar.js +320 -0
  281. package/lib/utils/custom-scrollbar.js.map +1 -0
  282. package/lib/utils/icon-registry.d.ts +78 -0
  283. package/lib/utils/icon-registry.d.ts.map +1 -0
  284. package/lib/utils/icon-registry.js +304 -0
  285. package/lib/utils/icon-registry.js.map +1 -0
  286. package/lib/utils/locale.d.ts +136 -0
  287. package/lib/utils/locale.d.ts.map +1 -0
  288. package/lib/utils/locale.js +213 -0
  289. package/lib/utils/locale.js.map +1 -0
  290. package/lib/utils/mobile.d.ts +14 -0
  291. package/lib/utils/mobile.d.ts.map +1 -0
  292. package/lib/utils/mobile.js +21 -0
  293. package/lib/utils/mobile.js.map +1 -0
  294. package/lib/utils/number-format.d.ts +83 -0
  295. package/lib/utils/number-format.d.ts.map +1 -0
  296. package/lib/utils/number-format.js +143 -0
  297. package/lib/utils/number-format.js.map +1 -0
  298. package/lib/utils/parse-boolean.d.ts +39 -0
  299. package/lib/utils/parse-boolean.d.ts.map +1 -0
  300. package/lib/utils/parse-boolean.js +58 -0
  301. package/lib/utils/parse-boolean.js.map +1 -0
  302. package/lib/utils/positioning.d.ts +143 -0
  303. package/lib/utils/positioning.d.ts.map +1 -0
  304. package/lib/utils/positioning.js +308 -0
  305. package/lib/utils/positioning.js.map +1 -0
  306. package/lib/utils/property-capture.d.ts +132 -0
  307. package/lib/utils/property-capture.d.ts.map +1 -0
  308. package/lib/utils/property-capture.js +152 -0
  309. package/lib/utils/property-capture.js.map +1 -0
  310. package/lib/utils/property-manager.d.ts +90 -0
  311. package/lib/utils/property-manager.d.ts.map +1 -0
  312. package/lib/utils/property-manager.js +197 -0
  313. package/lib/utils/property-manager.js.map +1 -0
  314. package/lib/utils/resize-observer.d.ts +42 -0
  315. package/lib/utils/resize-observer.d.ts.map +1 -0
  316. package/lib/utils/resize-observer.js +71 -0
  317. package/lib/utils/resize-observer.js.map +1 -0
  318. package/lib/utils/scroll-lock.d.ts +79 -0
  319. package/lib/utils/scroll-lock.d.ts.map +1 -0
  320. package/lib/utils/scroll-lock.js +197 -0
  321. package/lib/utils/scroll-lock.js.map +1 -0
  322. package/lib/utils/styles.d.ts +27 -0
  323. package/lib/utils/styles.d.ts.map +1 -0
  324. package/lib/utils/styles.js +53 -0
  325. package/lib/utils/styles.js.map +1 -0
  326. package/lib/version.d.ts +8 -0
  327. package/lib/version.d.ts.map +1 -0
  328. package/lib/version.js +11 -0
  329. package/lib/version.js.map +1 -0
  330. package/package.json +159 -0
@@ -0,0 +1,133 @@
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
+ import { PropertyManager, PropertyConfig, PropertyChange } from '../utils/property-manager.js';
12
+ /**
13
+ * Base class for all Ty components with unified property lifecycle
14
+ */
15
+ export declare abstract class TyComponent<T = any> extends HTMLElement {
16
+ static formAssociated: boolean;
17
+ protected static properties: Record<string, PropertyConfig>;
18
+ protected props: PropertyManager<T>;
19
+ protected _internals: ElementInternals;
20
+ protected _connected: boolean;
21
+ protected _rendered: boolean;
22
+ constructor();
23
+ /**
24
+ * Define which attributes to observe
25
+ * Auto-generated from property configuration
26
+ * Returns kebab-case attribute names (e.g., 'minHeight' -> 'min-height')
27
+ */
28
+ static get observedAttributes(): string[];
29
+ /**
30
+ * Unified property setter
31
+ * Use this in your property setters instead of direct field assignment
32
+ */
33
+ protected setProperty(name: string, value: any): void;
34
+ /**
35
+ * Unified property getter
36
+ * Use this in your property getters
37
+ */
38
+ protected getProperty(name: string): any;
39
+ /**
40
+ * Sync property value to HTML attribute
41
+ */
42
+ private _syncPropertyToAttribute;
43
+ /**
44
+ * Convert camelCase to kebab-case
45
+ */
46
+ private _toKebabCase;
47
+ /**
48
+ * Convert kebab-case to camelCase
49
+ */
50
+ private _toCamelCase;
51
+ /**
52
+ * Attribute changed callback - unified for all components
53
+ */
54
+ attributeChangedCallback(name: string, oldValue: string | null, newValue: string | null): void;
55
+ /**
56
+ * Connected callback - handle pre-set properties
57
+ */
58
+ connectedCallback(): void;
59
+ /**
60
+ * Disconnected callback
61
+ */
62
+ disconnectedCallback(): void;
63
+ /**
64
+ * Capture properties that were set before connectedCallback
65
+ * (React, Vue, Reagent set properties before element is connected)
66
+ */
67
+ private _capturePreSetProperties;
68
+ /**
69
+ * THE CORE LIFECYCLE METHOD
70
+ * All property changes flow through here
71
+ *
72
+ * Lifecycle order:
73
+ * 1. Update internal state (onPropertiesChanged hook)
74
+ * 2. Sync form value (if formValue property changed)
75
+ * 3. Render (if visual property changed)
76
+ * 4. Emit events (if emitChange property changed)
77
+ */
78
+ private _handlePropertyChanges;
79
+ /**
80
+ * Emit property change events for properties that require it
81
+ * Uses 'prop:change' event to avoid conflicts with user interaction 'change' events
82
+ */
83
+ private _emitChangeEvents;
84
+ /**
85
+ * Update form value via ElementInternals
86
+ * Subclasses can override to customize form value
87
+ */
88
+ protected updateFormValue(): void;
89
+ /**
90
+ * Get the form value for this component
91
+ * Default: return 'value' property
92
+ * Override for custom behavior
93
+ */
94
+ protected getFormValue(): File | string | FormData | null;
95
+ /**
96
+ * Render the component
97
+ * Subclasses MUST implement this
98
+ */
99
+ protected abstract render(): void;
100
+ /**
101
+ * Hook: Called when properties change
102
+ * Subclasses can override to update internal state
103
+ *
104
+ * This is called BEFORE rendering, so you can update
105
+ * internal state here and it will be reflected in the render
106
+ */
107
+ protected onPropertiesChanged(changes: PropertyChange[]): void;
108
+ /**
109
+ * Hook: Called when component is connected
110
+ * Use this instead of overriding connectedCallback
111
+ */
112
+ protected onConnect(): void;
113
+ /**
114
+ * Hook: Called when component is disconnected
115
+ * Use this for cleanup instead of overriding disconnectedCallback
116
+ */
117
+ protected onDisconnect(): void;
118
+ /**
119
+ * Get the form element this component is associated with
120
+ */
121
+ get form(): HTMLFormElement | null;
122
+ /**
123
+ * Form reset callback - called when form.reset() is invoked
124
+ * Resets component to its default value
125
+ */
126
+ formResetCallback(): void;
127
+ /**
128
+ * Hook: Called when form is reset
129
+ * Subclasses can override to perform additional reset actions
130
+ */
131
+ protected onFormReset(): void;
132
+ }
133
+ //# sourceMappingURL=ty-component.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ty-component.d.ts","s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ACH,SAAS,CAAC,eAAe,IAAI,IAAI;IAKjC;;;;OAIG;IACH,SAAS,CAAC,YAAY,IAAI,IAAI,GAAG,MAAM,GAAG,QAAQ,GAAG,IAAI;IAIzD;;;OAGG;IACH,SAAS,CAAC,QAAQ,CAAC,MAAM,IAAI,IAAI;IAEjC;;;;;;OAMG;IACH,SAAS,CAAC,mBAAmB,CAAC,OAAO,EAAE,cAAc,EAAE,GAAG,IAAI;IAK9D;;;OAGG;IACH,SAAS,CAAC,SAAS,IAAI,IAAI;IAI3B;;;OAGG;IACH,SAAS,CAAC,YAAY,IAAI,IAAI;IAI9B;;OAEG;IACH,IAAI,IAAI,IAAI,eAAe,GAAG,IAAI,CAEjC;IAED;;;OAGG;IACH,iBAAiB,IAAI,IAAI;IAgBzB;;;OAGG;IACH,SAAS,CAAC,WAAW,IAAI,IAAI;CAI9B"}
@@ -0,0 +1,297 @@
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
+ import { PropertyManager } from '../utils/property-manager.js';
12
+ /**
13
+ * Base class for all Ty components with unified property lifecycle
14
+ */
15
+ export class TyComponent extends HTMLElement {
16
+ constructor() {
17
+ super();
18
+ // Track if component is connected
19
+ this._connected = false;
20
+ // Track if initial render happened
21
+ this._rendered = false;
22
+ // Initialize property manager
23
+ const ctor = this.constructor;
24
+ this.props = new PropertyManager(ctor.properties);
25
+ // Form association
26
+ this._internals = this.attachInternals();
27
+ // Setup shadow DOM (subclasses can override by checking if shadowRoot exists)
28
+ if (!this.shadowRoot) {
29
+ this.attachShadow({ mode: 'open' });
30
+ }
31
+ }
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
+ static get observedAttributes() {
38
+ const attrs = [];
39
+ for (const [name, config] of Object.entries(this.properties)) {
40
+ attrs.push(name.replace(/([a-z])([A-Z])/g, '$1-$2').toLowerCase());
41
+ // Include alias names so attributeChangedCallback fires for them
42
+ if (config.aliases) {
43
+ for (const alias of Object.keys(config.aliases)) {
44
+ attrs.push(alias);
45
+ }
46
+ }
47
+ }
48
+ return attrs;
49
+ }
50
+ /**
51
+ * Unified property setter
52
+ * Use this in your property setters instead of direct field assignment
53
+ */
54
+ setProperty(name, value) {
55
+ const change = this.props.updateProperty(name, value, 'property');
56
+ if (change) {
57
+ // Sync to attribute (kebab-case)
58
+ this._syncPropertyToAttribute(change);
59
+ // Handle the change through unified lifecycle
60
+ this._handlePropertyChanges([change]);
61
+ }
62
+ }
63
+ /**
64
+ * Unified property getter
65
+ * Use this in your property getters
66
+ */
67
+ getProperty(name) {
68
+ return this.props.get(name);
69
+ }
70
+ /**
71
+ * Sync property value to HTML attribute
72
+ */
73
+ _syncPropertyToAttribute(change) {
74
+ const { name, newValue } = change;
75
+ const config = this.props.getConfig(name);
76
+ if (!config)
77
+ return;
78
+ // Convert to kebab-case for attribute
79
+ const attrName = this._toKebabCase(name);
80
+ // Handle different types
81
+ if (config.type === 'boolean') {
82
+ if (newValue) {
83
+ this.setAttribute(attrName, '');
84
+ }
85
+ else {
86
+ this.removeAttribute(attrName);
87
+ }
88
+ }
89
+ else if (newValue === null || newValue === undefined) {
90
+ this.removeAttribute(attrName);
91
+ }
92
+ else if (typeof newValue === 'object') {
93
+ this.setAttribute(attrName, JSON.stringify(newValue));
94
+ }
95
+ else {
96
+ this.setAttribute(attrName, String(newValue));
97
+ }
98
+ }
99
+ /**
100
+ * Convert camelCase to kebab-case
101
+ */
102
+ _toKebabCase(str) {
103
+ return str.replace(/([a-z])([A-Z])/g, '$1-$2').toLowerCase();
104
+ }
105
+ /**
106
+ * Convert kebab-case to camelCase
107
+ */
108
+ _toCamelCase(str) {
109
+ return str.replace(/-([a-z])/g, (_, letter) => letter.toUpperCase());
110
+ }
111
+ /**
112
+ * Attribute changed callback - unified for all components
113
+ */
114
+ attributeChangedCallback(name, oldValue, newValue) {
115
+ if (oldValue === newValue)
116
+ return;
117
+ // Check if this is an alias (e.g., not-searchable)
118
+ let change = this.props.handleAlias(name, newValue);
119
+ 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
+ const camelName = this._toCamelCase(name);
123
+ const propName = this.props.hasConfig(name) ? name : camelName;
124
+ change = this.props.updateProperty(propName, newValue, 'attribute');
125
+ }
126
+ if (change) {
127
+ this._handlePropertyChanges([change]);
128
+ }
129
+ }
130
+ /**
131
+ * Connected callback - handle pre-set properties
132
+ */
133
+ connectedCallback() {
134
+ this._connected = true;
135
+ // Capture pre-set properties (React/Vue/Reagent pattern)
136
+ const preSetProps = this._capturePreSetProperties();
137
+ // Batch process all pre-set properties
138
+ if (preSetProps.length > 0) {
139
+ this._handlePropertyChanges(preSetProps);
140
+ }
141
+ // Initialize component (subclass hook)
142
+ this.onConnect();
143
+ // Initial render
144
+ if (!this._rendered) {
145
+ this.render();
146
+ this._rendered = true;
147
+ }
148
+ }
149
+ /**
150
+ * Disconnected callback
151
+ */
152
+ disconnectedCallback() {
153
+ this._connected = false;
154
+ this.onDisconnect();
155
+ }
156
+ /**
157
+ * Capture properties that were set before connectedCallback
158
+ * (React, Vue, Reagent set properties before element is connected)
159
+ */
160
+ _capturePreSetProperties() {
161
+ const changes = [];
162
+ const ctor = this.constructor;
163
+ for (const propName of Object.keys(ctor.properties)) {
164
+ // Check if property was set on the element before connection
165
+ const descriptor = Object.getOwnPropertyDescriptor(this, propName);
166
+ if (descriptor && descriptor.value !== undefined) {
167
+ const change = this.props.updateProperty(propName, descriptor.value, 'property');
168
+ if (change) {
169
+ changes.push(change);
170
+ }
171
+ }
172
+ }
173
+ return changes;
174
+ }
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
+ _handlePropertyChanges(changes) {
186
+ if (changes.length === 0)
187
+ return;
188
+ // 1. Update internal state (subclass-specific)
189
+ this.onPropertiesChanged(changes);
190
+ // 2. Sync form value if needed
191
+ const formValueChanged = changes.some(c => this.props.isFormValue(c.name));
192
+ if (formValueChanged) {
193
+ this.updateFormValue();
194
+ }
195
+ // 3. Render only if visual properties changed AND component is connected
196
+ const visualChanged = changes.some(c => this.props.isVisual(c.name));
197
+ if (visualChanged && this._connected) {
198
+ this.render();
199
+ }
200
+ // 4. Emit change events if configured
201
+ this._emitChangeEvents(changes);
202
+ }
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
+ _emitChangeEvents(changes) {
208
+ for (const change of changes) {
209
+ if (this.props.shouldEmitChange(change.name)) {
210
+ this.dispatchEvent(new CustomEvent('prop:change', {
211
+ detail: {
212
+ property: change.name,
213
+ oldValue: change.oldValue,
214
+ newValue: change.newValue
215
+ },
216
+ bubbles: true,
217
+ composed: true
218
+ }));
219
+ }
220
+ }
221
+ }
222
+ /**
223
+ * Update form value via ElementInternals
224
+ * Subclasses can override to customize form value
225
+ */
226
+ updateFormValue() {
227
+ const formValue = this.getFormValue();
228
+ this._internals.setFormValue(formValue);
229
+ }
230
+ /**
231
+ * Get the form value for this component
232
+ * Default: return 'value' property
233
+ * Override for custom behavior
234
+ */
235
+ getFormValue() {
236
+ return this.props.get('value') ?? null;
237
+ }
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
+ onPropertiesChanged(changes) {
246
+ // Default: no-op
247
+ // Subclasses can override to update _state, _config, etc.
248
+ }
249
+ /**
250
+ * Hook: Called when component is connected
251
+ * Use this instead of overriding connectedCallback
252
+ */
253
+ onConnect() {
254
+ // Default: no-op
255
+ }
256
+ /**
257
+ * Hook: Called when component is disconnected
258
+ * Use this for cleanup instead of overriding disconnectedCallback
259
+ */
260
+ onDisconnect() {
261
+ // Default: no-op
262
+ }
263
+ /**
264
+ * Get the form element this component is associated with
265
+ */
266
+ get form() {
267
+ return this._internals.form;
268
+ }
269
+ /**
270
+ * Form reset callback - called when form.reset() is invoked
271
+ * Resets component to its default value
272
+ */
273
+ formResetCallback() {
274
+ // Get the default value from property configuration
275
+ const ctor = this.constructor;
276
+ const valueConfig = ctor.properties['value'];
277
+ if (valueConfig) {
278
+ const defaultValue = valueConfig.default ?? '';
279
+ // Reset the value property through setProperty to trigger lifecycle
280
+ this.setProperty('value', defaultValue);
281
+ }
282
+ // Call subclass hook for custom reset behavior
283
+ this.onFormReset();
284
+ }
285
+ /**
286
+ * Hook: Called when form is reset
287
+ * Subclasses can override to perform additional reset actions
288
+ */
289
+ onFormReset() {
290
+ // Default: no-op
291
+ // Subclasses can override to reset additional state
292
+ }
293
+ }
294
+ TyComponent.formAssociated = true;
295
+ // Subclasses must define their property configuration
296
+ TyComponent.properties = {};
297
+ //# sourceMappingURL=ty-component.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ty-component.js","sourceRoot":"","sources":["../../src/base/ty-component.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,eAAe,EAAkC,MAAM,8BAA8B,CAAA;AAE9F;;GAEG;AACH,MAAM,OAAgB,WAAqB,SAAQ,WAAW;IAkB5D;QACE,KAAK,EAAE,CAAA;QAPT,kCAAkC;QACxB,eAAU,GAAG,KAAK,CAAA;QAE5B,mCAAmC;QACzB,cAAS,GAAG,KAAK,CAAA;QAKzB,8BAA8B;QAC9B,MAAM,IAAI,GAAG,IAAI,CAAC,WAAiC,CAAA;QACnD,IAAI,CAAC,K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B;IACnB,CAAC;IAED;;;OAGG;IACO,YAAY;QACpB,iBAAiB;IACnB,CAAC;IAED;;OAEG;IACH,IAAI,IAAI;QACN,OAAO,IAAI,CAAC,UAAU,CAAC,IAAI,CAAA;IAC7B,CAAC;IAED;;;OAGG;IACH,iBAAiB;QACf,oDAAoD;QACpD,MAAM,IAAI,GAAG,IAAI,CAAC,WAAiC,CAAA;QACnD,MAAM,WAAW,GAAG,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,CAAA;QAE5C,IAAI,WAAW,EAAE,CAAC;YAChB,MAAM,YAAY,GAAG,WAAW,CAAC,OAAO,IAAI,EAAE,CAAA;YAE9C,oEAAoE;YACpE,IAAI,CAAC,WAAW,CAAC,OAAO,EAAE,YAAY,CAAC,CAAA;QACzC,CAAC;QAED,+CAA+C;QAC/C,IAAI,CAAC,WAAW,EAAE,CAAA;IACpB,CAAC;IAED;;;OAGG;IACO,WAAW;QACnB,iBAAiB;QACjB,oDAAoD;IACtD,CAAC;;AA5UM,0BAAc,GAAG,IAAI,AAAP,CAAO;AAE5B,sDAAsD;AACrC,sBAAU,GAAmC,EAAE,AAArC,CAAqC"}
@@ -0,0 +1,126 @@
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
+ import type { Flavor, Size, TyButtonElement } from "../types/common.js";
12
+ import { TyComponent } from "../base/ty-component.js";
13
+ import type { PropertyChange } from "../utils/property-manager.js";
14
+ type Appearance = "solid" | "outlined" | "ghost";
15
+ interface ButtonState {
16
+ flavor: Flavor;
17
+ size: Size;
18
+ appearance: Appearance;
19
+ disabled: boolean;
20
+ type: "button" | "submit" | "reset";
21
+ pill: boolean;
22
+ action: boolean;
23
+ wide: boolean;
24
+ name: string;
25
+ value: string;
26
+ }
27
+ /**
28
+ * Ty Button Component
29
+ *
30
+ * @example
31
+ * ```html
32
+ * <ty-button flavor="primary">Default solid</ty-button>
33
+ * <ty-button appearance="outlined" flavor="danger">Outlined</ty-button>
34
+ * <ty-button appearance="ghost" flavor="success+">Ghost stronger</ty-button>
35
+ * ```
36
+ */
37
+ export declare class TyButton extends TyComponent<ButtonState> implements TyButtonElement {
38
+ static formAssociated: boolean;
39
+ protected static properties: {
40
+ flavor: {
41
+ type: "string";
42
+ visual: boolean;
43
+ default: string;
44
+ };
45
+ size: {
46
+ type: "string";
47
+ visual: boolean;
48
+ default: string;
49
+ validate: (v: any) => boolean;
50
+ coerce: (v: any) => any;
51
+ };
52
+ appearance: {
53
+ type: "string";
54
+ visual: boolean;
55
+ default: string;
56
+ validate: (v: any) => boolean;
57
+ coerce: (v: any) => any;
58
+ };
59
+ disabled: {
60
+ type: "boolean";
61
+ visual: boolean;
62
+ default: boolean;
63
+ };
64
+ type: {
65
+ type: "string";
66
+ visual: boolean;
67
+ default: string;
68
+ };
69
+ pill: {
70
+ type: "boolean";
71
+ visual: boolean;
72
+ default: boolean;
73
+ };
74
+ action: {
75
+ type: "boolean";
76
+ visual: boolean;
77
+ default: boolean;
78
+ };
79
+ wide: {
80
+ type: "boolean";
81
+ visual: boolean;
82
+ default: boolean;
83
+ };
84
+ name: {
85
+ type: "string";
86
+ default: string;
87
+ };
88
+ value: {
89
+ type: "string";
90
+ default: string;
91
+ };
92
+ };
93
+ private _structureInitialized;
94
+ constructor();
95
+ protected onConnect(): void;
96
+ protected onDisconnect(): void;
97
+ protected onPropertiesChanged(_changes: PropertyChange[]): void;
98
+ get flavor(): Flavor;
99
+ set flavor(value: Flavor);
100
+ get size(): Size;
101
+ set size(value: Size);
102
+ get appearance(): Appearance;
103
+ set appearance(value: Appearance);
104
+ get disabled(): boolean;
105
+ set disabled(value: boolean);
106
+ get type(): "button" | "submit" | "reset";
107
+ set type(value: "button" | "submit" | "reset");
108
+ get pill(): boolean;
109
+ set pill(value: boolean);
110
+ get action(): boolean;
111
+ set action(value: boolean);
112
+ get wide(): boolean;
113
+ set wide(value: boolean);
114
+ get name(): string;
115
+ set name(value: string);
116
+ get value(): string;
117
+ set value(value: string);
118
+ /** Parse the optional `+`/`-` shade suffix from a flavor string. */
119
+ private parseFlavor;
120
+ private buildClasses;
121
+ private handleFormAction;
122
+ private initializeButtonStructure;
123
+ protected render(): void;
124
+ }
125
+ export {};
126
+ //# sourceMappingURL=button.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"button.d.ts","sourceRoot":"","sources":["../../src/components/button.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACxE,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AACtD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAInE,KAAK,UAAU,GAAG,OAAO,GAAG,UAAU,GAAG,OAAO,CAAC;AAEjD,UAAU,WAAW;IACnB,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,IAAI,CAAC;IACX,UAAU,EAAE,UAAU,CAAC;IACvB,QAAQ,EAAE,OAAO,CAAC;IAClB,IAAI,EAAE,QAAQ,GAAG,QAAQ,GAAG,OAAO,CAAC;IACpC,IAAI,EAAE,OAAO,CAAC;IACd,MAAM,EAAE,OAAO,CAAC;IAChB,IAAI,EAAE,OAAO,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;CACf;AAED;;;;;;;;;GASG;AACH,qBAAa,QACX,SAAQ,WAAW,CAAC,WAAW,CAC/B,YAAW,eAAe;IAE1B,MAAM,CAAC,cAAc,UAAQ;IAE7B,SAAS,CAAC,MAAM,CAAC,UAAU;;;;;;;;;;0BAUT,GAAG;wBACL,GAAG;;;;;;0BAYD,GAAG;wBACL,GA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