@toyu-ui/elements 0.1.0

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 (57) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +79 -0
  3. package/button/tyui-button.d.ts +27 -0
  4. package/button.d.ts +1 -0
  5. package/button.js +339 -0
  6. package/center/tyui-center.d.ts +13 -0
  7. package/center.d.ts +1 -0
  8. package/center.js +39 -0
  9. package/checkbox/tyui-checkbox.d.ts +25 -0
  10. package/checkbox.d.ts +1 -0
  11. package/checkbox.js +288 -0
  12. package/cluster/tyui-cluster.d.ts +16 -0
  13. package/cluster.d.ts +1 -0
  14. package/cluster.js +53 -0
  15. package/container/tyui-container.d.ts +14 -0
  16. package/container.d.ts +1 -0
  17. package/container.js +44 -0
  18. package/custom-elements.json +1651 -0
  19. package/flex/tyui-flex.d.ts +22 -0
  20. package/flex.d.ts +1 -0
  21. package/flex.js +66 -0
  22. package/frame/tyui-frame.d.ts +13 -0
  23. package/frame.d.ts +1 -0
  24. package/frame.js +35 -0
  25. package/grid/tyui-grid.d.ts +20 -0
  26. package/grid.d.ts +1 -0
  27. package/grid.js +59 -0
  28. package/index.d.ts +12 -0
  29. package/index.js +26 -0
  30. package/input/tyui-input.d.ts +40 -0
  31. package/input.d.ts +1 -0
  32. package/input.js +345 -0
  33. package/layout/layout-helpers.d.ts +9 -0
  34. package/layout-helpers-C2WgKm6F.js +171 -0
  35. package/package.json +91 -0
  36. package/radio/tyui-radio.d.ts +21 -0
  37. package/radio-group/tyui-radio-group.d.ts +28 -0
  38. package/radio-group.d.ts +1 -0
  39. package/radio-group.js +234 -0
  40. package/radio.d.ts +1 -0
  41. package/radio.js +239 -0
  42. package/sidebar/tyui-sidebar.d.ts +17 -0
  43. package/sidebar.d.ts +1 -0
  44. package/sidebar.js +53 -0
  45. package/skills/button/SKILL.md +49 -0
  46. package/skills/center/SKILL.md +45 -0
  47. package/skills/checkbox/SKILL.md +39 -0
  48. package/skills/cluster/SKILL.md +44 -0
  49. package/skills/components/SKILL.md +53 -0
  50. package/skills/container/SKILL.md +42 -0
  51. package/skills/flex/SKILL.md +45 -0
  52. package/skills/frame/SKILL.md +42 -0
  53. package/skills/grid/SKILL.md +44 -0
  54. package/skills/input/SKILL.md +59 -0
  55. package/skills/radio/SKILL.md +49 -0
  56. package/skills/radio-group/SKILL.md +51 -0
  57. package/skills/sidebar/SKILL.md +43 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Juro Kapsiar
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,79 @@
1
+ <p align="center">
2
+ <h1><span color="blue">T</span><span color="cyan">Y</span>UI</h1>
3
+ </p>
4
+
5
+ <p align="center">
6
+ <strong>framework-neutral component library</strong>
7
+ </p>
8
+
9
+ <p align="center">
10
+ <a href="https://github.com/jurokapsiar/tyui"><img src="https://img.shields.io/badge/version-0.0.0-blue?style=flat-square" alt="Version" /></a>
11
+ <a href="https://yarnpkg.com/"><img src="https://img.shields.io/badge/Yarn-4.5.0-2C8EBB?style=flat-square&logo=yarn&logoColor=white" alt="Yarn" /></a>
12
+ <a href="https://nx.dev/"><img src="https://img.shields.io/badge/Nx-22.6.5-143055?style=flat-square&logo=nx&logoColor=white" alt="Nx" /></a>
13
+ <a href="https://www.typescriptlang.org/"><img src="https://img.shields.io/badge/TypeScript-6.0.3-3178C6?style=flat-square&logo=typescript&logoColor=white" alt="TypeScript" /></a>
14
+ <a href="https://vite.dev/"><img src="https://img.shields.io/badge/Vite-7.1.11-646CFF?style=flat-square&logo=vite&logoColor=white" alt="Vite" /></a>
15
+ <a href="https://storybook.js.org/"><img src="https://img.shields.io/badge/Storybook-10.3.5-FF4785?style=flat-square&logo=storybook&logoColor=white" alt="Storybook" /></a>
16
+ <a href="https://lit.dev/"><img src="https://img.shields.io/badge/Lit-3.3.2-324FFF?style=flat-square&logo=lit&logoColor=white" alt="Lit" /></a>
17
+ <a href="https://www.solidjs.com/"><img src="https://img.shields.io/badge/Solid-1.9.13-2C4F7C?style=flat-square&logo=solid&logoColor=white" alt="Solid" /></a>
18
+ <a href="https://vitest.dev/"><img src="https://img.shields.io/badge/Vitest-4.1.5-6E9F18?style=flat-square&logo=vitest&logoColor=white" alt="Vitest" /></a>
19
+ <a href="https://playwright.dev/"><img src="https://img.shields.io/badge/Playwright-1.59.1-2EAD33?style=flat-square&logo=playwright&logoColor=white" alt="Playwright" /></a>
20
+ </p>
21
+
22
+ <p align="center">
23
+ <a href="#availability">Availability</a> &middot;
24
+ <a href="#architecture">Architecture</a> &middot;
25
+ <a href="#commands">Commands</a> &middot;
26
+ <a href="#specs-and-decisions">Specs And Decisions</a>
27
+ </p>
28
+
29
+ ---
30
+
31
+ **TYUI** is a framework-neutral component library. It is an experiment, not intended to be used by anybody really.
32
+
33
+ Codex interviewed me, asked bunch of interesting questions about design systems, component libraries, accessibility. Used [APG patterns](https://www.w3.org/WAI/ARIA/apg/patterns/) and [Fluent UI React v9](https://react.fluentui.dev/) as a reference for behaviors, API and other aspects. Then implemented the specs.
34
+
35
+ The library is intended to be AI firendly - agents should have access to all underlying information, component intnets, usage patterns and best practices.
36
+
37
+ Desing is proposed to be a separate layer. It should be possible to generate the design layer based on the standardized [design.md](https://github.com/google-labs-code/design.md/blob/main/docs/spec.md).
38
+
39
+ **Warning:** This is 100% AI generated and not polished. Visuals and user experience will be rough. As part of the experiment I might also want to find out if agents can fine tune the behaviors and visuals of the components so that they can be considered well crafted. But for now they are not.
40
+
41
+ ## Availability
42
+
43
+ Storybook is deployed as [Github page](https://jurokapsiar.github.io/tyui/).
44
+ Packages are not yet available - they might be if I decide to use the library in my personal projects.
45
+
46
+ ## Architecture
47
+
48
+ - `libs/core`: plain TypeScript behavior, state machines, and accessibility logic.
49
+ - `libs/elements`: native Custom Element implementations.
50
+ - `libs/define`: opt-in custom-element registration functions.
51
+ - `libs/solid`: Solid JSX typing and optional thin wrappers.
52
+ - `libs/testing`: shared testing helpers.
53
+ - `apps/solid-example`: Solid + Vite consumer example.
54
+ - `apps/vanilla-example`: vanilla + Vite consumer example.
55
+
56
+ The component implementation should remain in `core` and `elements`. Framework packages should only improve typing and ergonomics.
57
+
58
+ ## Commands
59
+
60
+ ```sh
61
+ yarn install
62
+ yarn build
63
+ yarn test
64
+ yarn typecheck
65
+ yarn playwright:image
66
+ yarn dev:solid
67
+ yarn dev:vanilla
68
+ yarn storybook
69
+ ```
70
+
71
+ ## Specs And Decisions
72
+
73
+ - `spec/requirements.md`
74
+ - `spec/architecture.md`
75
+ - `spec/testing.md`
76
+ - `spec/component-contract-template.md`
77
+ - `adr/0001-native-custom-elements.md`
78
+ - `adr/0002-solid-integration-surface.md`
79
+ - `ai/components/*.md`
@@ -0,0 +1,27 @@
1
+ export type TyuiButtonAppearance = 'default' | 'secondary' | 'primary' | 'outline' | 'subtle' | 'transparent';
2
+ export type TyuiButtonSize = 'small' | 'medium' | 'large';
3
+ export type TyuiButtonShape = 'rounded' | 'circular' | 'square';
4
+ export type TyuiButtonIconPosition = 'before' | 'after';
5
+ export type TyuiButtonType = 'button' | 'submit' | 'reset';
6
+ export declare class TyuiButtonElement extends HTMLElement {
7
+ #private;
8
+ static observedAttributes: string[];
9
+ constructor();
10
+ get appearance(): TyuiButtonAppearance;
11
+ set appearance(value: TyuiButtonAppearance);
12
+ get disabled(): boolean;
13
+ set disabled(value: boolean);
14
+ get disabledFocusable(): boolean;
15
+ set disabledFocusable(value: boolean);
16
+ get iconPosition(): TyuiButtonIconPosition;
17
+ set iconPosition(value: TyuiButtonIconPosition);
18
+ get shape(): TyuiButtonShape;
19
+ set shape(value: TyuiButtonShape);
20
+ get size(): TyuiButtonSize;
21
+ set size(value: TyuiButtonSize);
22
+ get type(): TyuiButtonType;
23
+ set type(value: TyuiButtonType);
24
+ connectedCallback(): void;
25
+ attributeChangedCallback(): void;
26
+ focus(options?: FocusOptions): void;
27
+ }
package/button.d.ts ADDED
@@ -0,0 +1 @@
1
+ export * from './button/tyui-button';
package/button.js ADDED
@@ -0,0 +1,339 @@
1
+ const i = new CSSStyleSheet();
2
+ i.replaceSync(`
3
+ @layer ty.component-base {
4
+ :host {
5
+ display: inline-block;
6
+ color: inherit;
7
+ font: inherit;
8
+ }
9
+
10
+ [part='control'] {
11
+ appearance: none;
12
+ box-sizing: border-box;
13
+ display: inline-flex;
14
+ align-items: center;
15
+ justify-content: center;
16
+ gap: var(--ty-button-gap, var(--ty-control-gap, 0.5rem));
17
+ min-block-size: var(--ty-button-min-block-size, var(--ty-control-min-block-size, 2rem));
18
+ min-inline-size: var(--ty-button-min-inline-size, 6rem);
19
+ padding:
20
+ var(--ty-button-padding-block, var(--ty-control-padding-block, 0.375rem))
21
+ var(--ty-button-padding-inline, var(--ty-control-padding-inline, 0.75rem));
22
+ border:
23
+ var(--ty-button-border-width, var(--ty-control-border-width, 1px))
24
+ solid
25
+ var(--ty-button-border-color, var(--ty-color-border, ButtonBorder));
26
+ border-radius: var(--ty-button-radius, var(--ty-control-radius, 0.375rem));
27
+ background: var(--ty-button-background, var(--ty-color-surface, ButtonFace));
28
+ color: var(--ty-button-foreground, var(--ty-color-text, ButtonText));
29
+ font-family: var(--ty-font-family, inherit);
30
+ font-size: var(--ty-button-font-size, var(--ty-control-font-size, 0.875rem));
31
+ font-weight: var(--ty-button-font-weight, var(--ty-font-weight-semibold, 600));
32
+ line-height: var(--ty-button-line-height, 1.25rem);
33
+ cursor: pointer;
34
+ text-align: center;
35
+ transition:
36
+ background-color var(--ty-motion-feedback-duration, 120ms) var(--ty-motion-easing, ease),
37
+ border-color var(--ty-motion-feedback-duration, 120ms) var(--ty-motion-easing, ease),
38
+ color var(--ty-motion-feedback-duration, 120ms) var(--ty-motion-easing, ease),
39
+ box-shadow var(--ty-motion-feedback-duration, 120ms) var(--ty-motion-easing, ease);
40
+ }
41
+
42
+ :host([size='small']) [part='control'] {
43
+ --ty-button-min-block-size: 1.5rem;
44
+ --ty-button-min-inline-size: 4rem;
45
+ --ty-button-padding-block: 0.1875rem;
46
+ --ty-button-padding-inline: var(--ty-space-2, 0.5rem);
47
+ --ty-button-font-size: var(--ty-font-size-100, 0.75rem);
48
+ --ty-button-font-weight: var(--ty-font-weight-regular, 400);
49
+ --ty-button-line-height: 1rem;
50
+ --_ty-button-icon-size: 1.25rem;
51
+ --_ty-button-icon-gap: var(--ty-space-1, 0.25rem);
52
+ }
53
+
54
+ :host(:not([size='small']):not([size='large'])),
55
+ :host([size='medium']) {
56
+ --ty-button-min-block-size: 2rem;
57
+ --ty-button-min-inline-size: 6rem;
58
+ --ty-button-padding-block: 0.3125rem;
59
+ --ty-button-padding-inline: var(--ty-space-3, 0.75rem);
60
+ --ty-button-font-size: var(--ty-font-size-200, 0.875rem);
61
+ --ty-button-font-weight: var(--ty-font-weight-semibold, 600);
62
+ --ty-button-line-height: 1.25rem;
63
+ --_ty-button-icon-size: 1.25rem;
64
+ --_ty-button-icon-gap: var(--ty-space-2, 0.5rem);
65
+ }
66
+
67
+ :host([size='large']) [part='control'] {
68
+ --ty-button-min-block-size: 2.5rem;
69
+ --ty-button-min-inline-size: 6rem;
70
+ --ty-button-padding-block: 0.5rem;
71
+ --ty-button-padding-inline: var(--ty-space-4, 1rem);
72
+ --ty-button-font-size: var(--ty-font-size-300, 1rem);
73
+ --ty-button-font-weight: var(--ty-font-weight-semibold, 600);
74
+ --ty-button-line-height: 1.375rem;
75
+ --_ty-button-icon-size: 1.5rem;
76
+ --_ty-button-icon-gap: var(--ty-space-2, 0.5rem);
77
+ }
78
+
79
+ :host([shape='rounded']) [part='control'] {
80
+ --ty-button-radius: var(--ty-control-radius, var(--ty-radius-2, 0.5rem));
81
+ }
82
+
83
+ :host([shape='circular']) [part='control'] {
84
+ --ty-button-radius: var(--ty-radius-pill, 9999px);
85
+ }
86
+
87
+ :host([shape='square']) [part='control'] {
88
+ --ty-button-radius: var(--ty-radius-0, 0);
89
+ }
90
+
91
+ :host([appearance='default']) [part='control'],
92
+ :host([appearance='secondary']) [part='control'],
93
+ :host(:not([appearance])) [part='control'] {
94
+ --ty-button-background: var(--ty-color-surface, ButtonFace);
95
+ --ty-button-background-hover: var(--ty-color-surface-hover, ButtonFace);
96
+ --ty-button-background-active: var(--ty-color-surface-pressed, ButtonFace);
97
+ --ty-button-foreground: var(--ty-color-text, ButtonText);
98
+ --ty-button-border-color: var(--ty-color-border, ButtonBorder);
99
+ --ty-button-border-color-hover: var(--ty-color-border-strong, ButtonText);
100
+ }
101
+
102
+ :host([appearance='primary']) [part='control'] {
103
+ --ty-button-background: var(--ty-color-accent, Highlight);
104
+ --ty-button-background-hover: var(--ty-color-accent-hover, Highlight);
105
+ --ty-button-background-active: var(--ty-color-accent-pressed, Highlight);
106
+ --ty-button-foreground: var(--ty-color-on-accent, HighlightText);
107
+ --ty-button-border-color: transparent;
108
+ --ty-button-border-color-hover: transparent;
109
+ }
110
+
111
+ :host([appearance='outline']) [part='control'] {
112
+ --ty-button-background: transparent;
113
+ --ty-button-background-hover: var(--ty-color-surface-hover, ButtonFace);
114
+ --ty-button-background-active: var(--ty-color-surface-pressed, ButtonFace);
115
+ --ty-button-foreground: var(--ty-color-text, ButtonText);
116
+ --ty-button-border-color: var(--ty-color-border-strong, ButtonText);
117
+ --ty-button-border-color-hover: var(--ty-color-border-strong, ButtonText);
118
+ }
119
+
120
+ :host([appearance='subtle']) [part='control'] {
121
+ --ty-button-background: transparent;
122
+ --ty-button-background-hover: var(--ty-color-surface-hover, ButtonFace);
123
+ --ty-button-background-active: var(--ty-color-surface-pressed, ButtonFace);
124
+ --ty-button-foreground: var(--ty-color-text, ButtonText);
125
+ --ty-button-border-color: transparent;
126
+ --ty-button-border-color-hover: transparent;
127
+ }
128
+
129
+ :host([appearance='transparent']) [part='control'] {
130
+ --ty-button-background: transparent;
131
+ --ty-button-background-hover: transparent;
132
+ --ty-button-background-active: transparent;
133
+ --ty-button-foreground: var(--ty-color-text, ButtonText);
134
+ --ty-button-foreground-hover: var(--ty-color-text-muted, ButtonText);
135
+ --ty-button-border-color: transparent;
136
+ --ty-button-border-color-hover: transparent;
137
+ }
138
+
139
+ [part='control']:hover:not(:disabled):not([aria-disabled='true']) {
140
+ background: var(--ty-button-background-hover, var(--ty-button-background));
141
+ border-color: var(--ty-button-border-color-hover, var(--ty-button-border-color));
142
+ color: var(--ty-button-foreground-hover, var(--ty-button-foreground));
143
+ }
144
+
145
+ [part='control']:active:not(:disabled):not([aria-disabled='true']) {
146
+ background: var(--ty-button-background-active, var(--ty-button-background-hover));
147
+ }
148
+
149
+ [part='control']:disabled,
150
+ [part='control'][aria-disabled='true'] {
151
+ background: var(--ty-button-disabled-background, var(--ty-color-disabled-surface, ButtonFace));
152
+ border-color: var(--ty-button-disabled-border-color, var(--ty-color-disabled-border, GrayText));
153
+ color: var(--ty-button-disabled-foreground, var(--ty-color-disabled-text, GrayText));
154
+ cursor: not-allowed;
155
+ }
156
+
157
+ [part='control']:focus-visible {
158
+ outline: var(--ty-focus-width, 2px) solid var(--ty-focus-color, Highlight);
159
+ outline-offset: var(--ty-focus-offset, 2px);
160
+ box-shadow: inset 0 0 0 2px var(--ty-focus-inner-color, Canvas);
161
+ }
162
+
163
+ [part='control'][data-icon-only] {
164
+ min-inline-size: unset;
165
+ aspect-ratio: 1;
166
+ padding-inline: var(--ty-button-padding-block);
167
+ }
168
+
169
+ [part='label'] {
170
+ min-inline-size: 0;
171
+ }
172
+
173
+ ::slotted([slot='icon']) {
174
+ flex: none;
175
+ inline-size: var(--_ty-button-icon-size, 1.25rem);
176
+ block-size: var(--_ty-button-icon-size, 1.25rem);
177
+ }
178
+
179
+ [part='control'][data-icon-position='before']:not([data-icon-only]) ::slotted([slot='icon']) {
180
+ margin-inline-end: var(--_ty-button-icon-gap, 0.5rem);
181
+ }
182
+
183
+ [part='control'][data-icon-position='after']:not([data-icon-only]) ::slotted([slot='icon']) {
184
+ margin-inline-start: var(--_ty-button-icon-gap, 0.5rem);
185
+ }
186
+
187
+ @media (forced-colors: active) {
188
+ [part='control'] {
189
+ forced-color-adjust: none;
190
+ background: ButtonFace;
191
+ border-color: ButtonText;
192
+ color: ButtonText;
193
+ }
194
+
195
+ [part='control']:disabled,
196
+ [part='control'][aria-disabled='true'] {
197
+ border-color: GrayText;
198
+ color: GrayText;
199
+ }
200
+
201
+ [part='control']:focus-visible {
202
+ outline-color: Highlight;
203
+ box-shadow: none;
204
+ }
205
+ }
206
+
207
+ @media (prefers-reduced-motion: reduce) {
208
+ [part='control'] {
209
+ transition-duration: 0ms;
210
+ }
211
+ }
212
+ }
213
+ `);
214
+ const s = document.createElement("template");
215
+ s.innerHTML = `
216
+ <button part="control" type="button">
217
+ <slot name="icon"></slot>
218
+ <span part="label"><slot></slot></span>
219
+ </button>
220
+ `;
221
+ function n(a, t, e) {
222
+ return t.includes(a) ? a : e;
223
+ }
224
+ class c extends HTMLElement {
225
+ static observedAttributes = [
226
+ "appearance",
227
+ "disabled",
228
+ "disabled-focusable",
229
+ "icon-position",
230
+ "shape",
231
+ "size",
232
+ "type"
233
+ ];
234
+ #t;
235
+ #e;
236
+ #r;
237
+ constructor() {
238
+ super();
239
+ const t = this.attachShadow({ mode: "open", delegatesFocus: !0 });
240
+ t.adoptedStyleSheets = [i], t.append(s.content.cloneNode(!0));
241
+ const e = t.querySelector("button"), o = t.querySelector('slot[name="icon"]'), r = t.querySelector("slot:not([name])");
242
+ if (!(e instanceof HTMLButtonElement))
243
+ throw new Error("TyuiButtonElement template is missing its button.");
244
+ if (!(o instanceof HTMLSlotElement) || !(r instanceof HTMLSlotElement))
245
+ throw new Error("TyuiButtonElement template is missing expected slots.");
246
+ this.#t = e, this.#e = o, this.#r = r, this.#t.addEventListener("click", this.#n, {
247
+ capture: !0
248
+ }), this.#t.addEventListener("keydown", this.#n, {
249
+ capture: !0
250
+ }), this.#e.addEventListener("slotchange", this.#o), this.#r.addEventListener("slotchange", this.#o);
251
+ }
252
+ get appearance() {
253
+ return n(
254
+ this.getAttribute("appearance"),
255
+ ["default", "secondary", "primary", "outline", "subtle", "transparent"],
256
+ "default"
257
+ );
258
+ }
259
+ set appearance(t) {
260
+ this.setAttribute("appearance", t);
261
+ }
262
+ get disabled() {
263
+ return this.hasAttribute("disabled");
264
+ }
265
+ set disabled(t) {
266
+ this.toggleAttribute("disabled", t);
267
+ }
268
+ get disabledFocusable() {
269
+ return this.hasAttribute("disabled-focusable");
270
+ }
271
+ set disabledFocusable(t) {
272
+ this.toggleAttribute("disabled-focusable", t);
273
+ }
274
+ get iconPosition() {
275
+ return n(this.getAttribute("icon-position"), ["before", "after"], "before");
276
+ }
277
+ set iconPosition(t) {
278
+ this.setAttribute("icon-position", t);
279
+ }
280
+ get shape() {
281
+ return n(
282
+ this.getAttribute("shape"),
283
+ ["rounded", "circular", "square"],
284
+ "rounded"
285
+ );
286
+ }
287
+ set shape(t) {
288
+ this.setAttribute("shape", t);
289
+ }
290
+ get size() {
291
+ return n(this.getAttribute("size"), ["small", "medium", "large"], "medium");
292
+ }
293
+ set size(t) {
294
+ this.setAttribute("size", t);
295
+ }
296
+ get type() {
297
+ return n(this.getAttribute("type"), ["button", "submit", "reset"], "button");
298
+ }
299
+ set type(t) {
300
+ this.setAttribute("type", t);
301
+ }
302
+ connectedCallback() {
303
+ this.#a(), this.#o();
304
+ }
305
+ attributeChangedCallback() {
306
+ this.#o();
307
+ }
308
+ focus(t) {
309
+ this.#t.focus(t);
310
+ }
311
+ #a() {
312
+ this.hasAttribute("appearance") || this.setAttribute("appearance", "default"), this.hasAttribute("size") || this.setAttribute("size", "medium"), this.hasAttribute("shape") || this.setAttribute("shape", "rounded"), this.hasAttribute("icon-position") || this.setAttribute("icon-position", "before"), this.hasAttribute("type") || this.setAttribute("type", "button");
313
+ }
314
+ #n = (t) => {
315
+ if (!(!this.disabledFocusable || this.disabled)) {
316
+ if (t.type === "keydown") {
317
+ const e = t.key;
318
+ if (e !== "Enter" && e !== " ") return;
319
+ }
320
+ t.preventDefault(), t.stopImmediatePropagation();
321
+ }
322
+ };
323
+ #o = () => {
324
+ const t = this.iconPosition, e = this.#i();
325
+ this.#t.type = this.type, this.#t.disabled = this.disabled, this.#t.toggleAttribute("data-icon-only", e), this.#t.dataset.appearance = this.appearance === "default" ? "secondary" : this.appearance, this.#t.dataset.size = this.size, this.#t.dataset.shape = this.shape, this.#t.dataset.iconPosition = t, this.disabledFocusable && !this.disabled ? this.#t.setAttribute("aria-disabled", "true") : this.#t.removeAttribute("aria-disabled");
326
+ const o = this.#e, r = this.#t.querySelector('[part="label"]');
327
+ r && t === "after" && o.nextElementSibling !== null ? this.#t.append(o) : r && t === "before" && o.nextElementSibling !== r && this.#t.insertBefore(o, r);
328
+ };
329
+ #i() {
330
+ if (!(this.#e.assignedElements({ flatten: !0 }).length > 0)) return !1;
331
+ for (const e of this.childNodes)
332
+ if (e.nodeType === Node.TEXT_NODE && (e.textContent ?? "").trim().length > 0 || e.nodeType === Node.ELEMENT_NODE && e.slot !== "icon")
333
+ return !1;
334
+ return !0;
335
+ }
336
+ }
337
+ export {
338
+ c as TyuiButtonElement
339
+ };
@@ -0,0 +1,13 @@
1
+ export type TyuiCenterGutter = '0' | '1' | '2' | '3' | '4' | 'page';
2
+ export declare class TyuiCenterElement extends HTMLElement {
3
+ #private;
4
+ static observedAttributes: string[];
5
+ connectedCallback(): void;
6
+ attributeChangedCallback(): void;
7
+ get measure(): string;
8
+ set measure(value: string);
9
+ get gutter(): TyuiCenterGutter;
10
+ set gutter(value: TyuiCenterGutter);
11
+ get intrinsic(): boolean;
12
+ set intrinsic(value: boolean);
13
+ }
package/center.d.ts ADDED
@@ -0,0 +1 @@
1
+ export * from './center/tyui-center';
package/center.js ADDED
@@ -0,0 +1,39 @@
1
+ import { i as n, s as e, n as i, a as s, l as u, b as c } from "./layout-helpers-C2WgKm6F.js";
2
+ const a = ["0", "1", "2", "3", "4", "page"];
3
+ function g(r) {
4
+ const t = i(r, a, "page");
5
+ return t === "page" ? "var(--ty-page-gutter, 1rem)" : c(t, "3");
6
+ }
7
+ class h extends HTMLElement {
8
+ static observedAttributes = ["gutter", "intrinsic", "measure"];
9
+ connectedCallback() {
10
+ n(), this.#t();
11
+ }
12
+ attributeChangedCallback() {
13
+ this.#t();
14
+ }
15
+ get measure() {
16
+ return this.getAttribute("measure") ?? "65ch";
17
+ }
18
+ set measure(t) {
19
+ e(this, "measure", t);
20
+ }
21
+ get gutter() {
22
+ return i(this.getAttribute("gutter"), a, "page");
23
+ }
24
+ set gutter(t) {
25
+ e(this, "gutter", t);
26
+ }
27
+ get intrinsic() {
28
+ return this.hasAttribute("intrinsic");
29
+ }
30
+ set intrinsic(t) {
31
+ e(this, "intrinsic", t);
32
+ }
33
+ #t() {
34
+ s(this, "--ty-center-measure", u(this.measure, "65ch")), s(this, "--ty-center-gutter", g(this.getAttribute("gutter")));
35
+ }
36
+ }
37
+ export {
38
+ h as TyuiCenterElement
39
+ };
@@ -0,0 +1,25 @@
1
+ export type TyuiCheckboxEvent = Event;
2
+ export declare class TyuiCheckboxElement extends HTMLElement {
3
+ #private;
4
+ static formAssociated: boolean;
5
+ static observedAttributes: string[];
6
+ constructor();
7
+ get checked(): boolean;
8
+ set checked(value: boolean);
9
+ get disabled(): boolean;
10
+ set disabled(value: boolean);
11
+ get indeterminate(): boolean;
12
+ set indeterminate(value: boolean);
13
+ get name(): string;
14
+ set name(value: string);
15
+ get required(): boolean;
16
+ set required(value: boolean);
17
+ get value(): string;
18
+ set value(value: string);
19
+ get validity(): ValidityState;
20
+ connectedCallback(): void;
21
+ attributeChangedCallback(name: string, _oldValue: string | null, newValue: string | null): void;
22
+ focus(options?: FocusOptions): void;
23
+ checkValidity(): boolean;
24
+ reportValidity(): boolean;
25
+ }
package/checkbox.d.ts ADDED
@@ -0,0 +1 @@
1
+ export * from './checkbox/tyui-checkbox';