@toyu-ui/solid 0.1.0 → 0.2.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.
@@ -0,0 +1,124 @@
1
+ @layer tokens, product-theme, product-components;
2
+
3
+ @layer product-theme {
4
+ [data-design-system='plain'] {
5
+ color-scheme: light dark;
6
+
7
+ --ty-design-name: plain;
8
+ --ty-color-background: Canvas;
9
+ --ty-color-on-background: CanvasText;
10
+ --ty-color-surface: Canvas;
11
+ --ty-color-surface-hover: color-mix(in srgb, CanvasText 6%, Canvas);
12
+ --ty-color-surface-pressed: color-mix(in srgb, CanvasText 10%, Canvas);
13
+ --ty-color-surface-elevated: Canvas;
14
+ --ty-color-text: CanvasText;
15
+ --ty-color-text-muted: color-mix(in srgb, CanvasText 70%, Canvas);
16
+ --ty-color-border: color-mix(in srgb, CanvasText 24%, Canvas);
17
+ --ty-color-border-strong: color-mix(in srgb, CanvasText 44%, Canvas);
18
+ --ty-color-accent: LinkText;
19
+ --ty-color-on-accent: Canvas;
20
+ --ty-color-danger: Mark;
21
+ --ty-color-on-danger: Canvas;
22
+
23
+ --ty-font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
24
+ --ty-font-size-100: 0.75rem;
25
+ --ty-font-size-200: 0.875rem;
26
+ --ty-font-size-300: 1rem;
27
+ --ty-font-size-400: 1.25rem;
28
+ --ty-font-size-500: 1.5rem;
29
+ --ty-font-weight-regular: 400;
30
+ --ty-font-weight-medium: 500;
31
+ --ty-font-weight-semibold: 600;
32
+ --ty-font-weight-bold: 700;
33
+ --ty-line-height-100: 1rem;
34
+ --ty-line-height-200: 1.25rem;
35
+ --ty-line-height-300: 1.5rem;
36
+ --ty-line-height-400: 1.75rem;
37
+ --ty-letter-spacing-label: 0;
38
+
39
+ --ty-space-0: 0;
40
+ --ty-space-1: 0.25rem;
41
+ --ty-space-2: 0.5rem;
42
+ --ty-space-3: 0.75rem;
43
+ --ty-space-4: 1rem;
44
+ --ty-space-5: 1.25rem;
45
+ --ty-space-6: 1.5rem;
46
+ --ty-space-8: 2rem;
47
+ --ty-space-10: 2.5rem;
48
+
49
+ --ty-radius-0: 0;
50
+ --ty-radius-1: 0.125rem;
51
+ --ty-radius-2: 0.25rem;
52
+ --ty-radius-3: 0.375rem;
53
+ --ty-radius-4: 0.5rem;
54
+ --ty-radius-pill: 9999px;
55
+
56
+ --ty-stroke-thin: 1px;
57
+ --ty-stroke-thick: 2px;
58
+ --ty-focus-width: 2px;
59
+ --ty-focus-offset: 2px;
60
+ --ty-focus-color: Highlight;
61
+
62
+ --ty-duration-fast: 100ms;
63
+ --ty-duration-normal: 150ms;
64
+ --ty-duration-slow: 240ms;
65
+ --ty-easing-standard: ease;
66
+ --ty-motion-feedback-duration: var(--ty-duration-fast);
67
+ --ty-motion-content-duration: var(--ty-duration-normal);
68
+ --ty-motion-easing: var(--ty-easing-standard);
69
+
70
+ --ty-control-radius: var(--ty-radius-2);
71
+ --ty-control-border-width: var(--ty-stroke-thin);
72
+ --ty-control-font-size: var(--ty-font-size-200);
73
+ --ty-control-padding-inline: var(--ty-space-3);
74
+ --ty-control-padding-block: var(--ty-space-1);
75
+ --ty-control-gap: var(--ty-space-2);
76
+ --ty-control-min-block-size: 2rem;
77
+
78
+ --ty-layout-page-gutter: clamp(1rem, 3vw, 2rem);
79
+ --ty-layout-card-gap: var(--ty-space-4);
80
+ --ty-layout-section-gap: var(--ty-space-6);
81
+ --ty-layout-content-measure: 72rem;
82
+
83
+ background: var(--ty-color-background);
84
+ color: var(--ty-color-text);
85
+ font-family: var(--ty-font-family);
86
+ }
87
+
88
+ [data-design-system='plain'][data-color-scheme='light'] {
89
+ color-scheme: light;
90
+ }
91
+
92
+ [data-design-system='plain'][data-color-scheme='dark'] {
93
+ color-scheme: dark;
94
+ }
95
+ }
96
+
97
+ @layer product-components {
98
+ [data-design-system='plain'] tyui-button,
99
+ [data-design-system='plain'] tyui-input,
100
+ [data-design-system='plain'] tyui-checkbox,
101
+ [data-design-system='plain'] tyui-radio,
102
+ [data-design-system='plain'] tyui-radio-group {
103
+ font-family: var(--ty-font-family);
104
+ }
105
+
106
+ [data-design-system='plain'] tyui-button {
107
+ --ty-button-radius: var(--ty-control-radius);
108
+ --ty-button-min-block-size: var(--ty-control-min-block-size);
109
+ --ty-button-padding-inline: var(--ty-control-padding-inline);
110
+ --ty-button-padding-block: var(--ty-control-padding-block);
111
+ --ty-button-gap: var(--ty-control-gap);
112
+ --ty-button-font-size: var(--ty-control-font-size);
113
+ --ty-button-border-width: var(--ty-control-border-width);
114
+ }
115
+
116
+ [data-design-system='plain'] tyui-input {
117
+ --ty-input-radius: var(--ty-control-radius);
118
+ --ty-input-min-block-size: var(--ty-control-min-block-size);
119
+ --ty-input-padding-inline: var(--ty-control-padding-inline);
120
+ --ty-input-padding-block: var(--ty-control-padding-block);
121
+ --ty-input-gap: var(--ty-control-gap);
122
+ --ty-input-font-size: var(--ty-control-font-size);
123
+ }
124
+ }
package/design.d.ts ADDED
@@ -0,0 +1,20 @@
1
+ import { Accessor } from 'solid-js';
2
+ export type TyuiDesignName = 'plain' | 'atmospheric-glass' | 'fluent-web';
3
+ export type TyuiDesignAlias = 'glass' | 'fluent';
4
+ export type TyuiDesignInput = TyuiDesignName | TyuiDesignAlias;
5
+ export type TyuiColorScheme = 'light' | 'dark' | 'auto';
6
+ export type TyuiDesignOptions = {
7
+ target?: Element | undefined;
8
+ colorScheme?: TyuiColorScheme | undefined;
9
+ };
10
+ export type TyuiDesignAttributes = {
11
+ 'data-design-system': TyuiDesignName;
12
+ 'data-color-scheme'?: Exclude<TyuiColorScheme, 'auto'> | undefined;
13
+ };
14
+ export declare function resolveTyuiDesignName(design: TyuiDesignInput): TyuiDesignName;
15
+ export declare function getTyuiDesignAttributes(design: TyuiDesignInput, options?: Pick<TyuiDesignOptions, 'colorScheme'>): TyuiDesignAttributes;
16
+ export declare function setTyuiDesign(design: TyuiDesignInput, options?: TyuiDesignOptions): Element | undefined;
17
+ export declare function clearTyuiDesign(target?: HTMLElement): Element | undefined;
18
+ export declare function createTyuiDesignEffect(design: Accessor<TyuiDesignInput>, options?: Omit<TyuiDesignOptions, 'colorScheme'> & {
19
+ colorScheme?: Accessor<TyuiColorScheme | undefined> | TyuiColorScheme | undefined;
20
+ }): void;
package/design.js ADDED
@@ -0,0 +1,43 @@
1
+ import { createEffect as s } from "solid-js";
2
+ const o = {
3
+ plain: "plain",
4
+ glass: "atmospheric-glass",
5
+ "atmospheric-glass": "atmospheric-glass",
6
+ fluent: "fluent-web",
7
+ "fluent-web": "fluent-web"
8
+ };
9
+ function a(e) {
10
+ return o[e];
11
+ }
12
+ function n(e, t = {}) {
13
+ const c = {
14
+ "data-design-system": a(e)
15
+ };
16
+ return t.colorScheme && t.colorScheme !== "auto" && (c["data-color-scheme"] = t.colorScheme), c;
17
+ }
18
+ function i(e, t = {}) {
19
+ const c = t.target ?? globalThis.document?.documentElement;
20
+ if (!c) return;
21
+ const r = n(e, t);
22
+ return c.setAttribute("data-design-system", r["data-design-system"]), r["data-color-scheme"] ? c.setAttribute("data-color-scheme", r["data-color-scheme"]) : c.removeAttribute("data-color-scheme"), c;
23
+ }
24
+ function l(e = globalThis.document?.documentElement) {
25
+ if (e)
26
+ return e.removeAttribute("data-design-system"), e.removeAttribute("data-color-scheme"), e;
27
+ }
28
+ function m(e, t = {}) {
29
+ s(() => {
30
+ const c = typeof t.colorScheme == "function" ? t.colorScheme() : t.colorScheme;
31
+ i(e(), {
32
+ target: t.target,
33
+ colorScheme: c
34
+ });
35
+ });
36
+ }
37
+ export {
38
+ l as clearTyuiDesign,
39
+ m as createTyuiDesignEffect,
40
+ n as getTyuiDesignAttributes,
41
+ a as resolveTyuiDesignName,
42
+ i as setTyuiDesign
43
+ };
package/index.d.ts CHANGED
@@ -3,4 +3,5 @@ export * from './checkbox';
3
3
  export * from './input';
4
4
  export * from './radio';
5
5
  export * from './radio-group';
6
+ export * from './design';
6
7
  export * from './jsx';
package/index.js CHANGED
@@ -1,12 +1,18 @@
1
- import { Button as t } from "./button.js";
2
- import { Checkbox as e } from "./checkbox.js";
1
+ import { Button as r } from "./button.js";
2
+ import { Checkbox as i } from "./checkbox.js";
3
3
  import { Input as f } from "./input.js";
4
- import { Radio as u } from "./radio.js";
5
- import { RadioGroup as d } from "./radio-group.js";
4
+ import { Radio as s } from "./radio.js";
5
+ import { RadioGroup as n } from "./radio-group.js";
6
+ import { clearTyuiDesign as g, createTyuiDesignEffect as a, getTyuiDesignAttributes as y, resolveTyuiDesignName as D, setTyuiDesign as T } from "./design.js";
6
7
  export {
7
- t as Button,
8
- e as Checkbox,
8
+ r as Button,
9
+ i as Checkbox,
9
10
  f as Input,
10
- u as Radio,
11
- d as RadioGroup
11
+ s as Radio,
12
+ n as RadioGroup,
13
+ g as clearTyuiDesign,
14
+ a as createTyuiDesignEffect,
15
+ y as getTyuiDesignAttributes,
16
+ D as resolveTyuiDesignName,
17
+ T as setTyuiDesign
12
18
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@toyu-ui/solid",
3
- "version": "0.1.0",
3
+ "version": "0.2.0",
4
4
  "keywords": [
5
5
  "tanstack-intent"
6
6
  ],
@@ -15,7 +15,9 @@
15
15
  "directory": "libs/solid"
16
16
  },
17
17
  "type": "module",
18
- "sideEffects": false,
18
+ "sideEffects": [
19
+ "**/*.css"
20
+ ],
19
21
  "main": "./index.js",
20
22
  "module": "./index.js",
21
23
  "types": "./index.d.ts",
@@ -48,6 +50,30 @@
48
50
  "types": "./jsx.d.ts",
49
51
  "default": "./jsx.js"
50
52
  },
53
+ "./design": {
54
+ "types": "./design.d.ts",
55
+ "default": "./design.js"
56
+ },
57
+ "./design/plain.css": {
58
+ "types": "./design/css.d.ts",
59
+ "default": "./design/plain.css"
60
+ },
61
+ "./design/glass.css": {
62
+ "types": "./design/css.d.ts",
63
+ "default": "./design/glass.css"
64
+ },
65
+ "./design/atmospheric-glass.css": {
66
+ "types": "./design/css.d.ts",
67
+ "default": "./design/atmospheric-glass.css"
68
+ },
69
+ "./design/fluent.css": {
70
+ "types": "./design/css.d.ts",
71
+ "default": "./design/fluent.css"
72
+ },
73
+ "./design/fluent-web.css": {
74
+ "types": "./design/css.d.ts",
75
+ "default": "./design/fluent-web.css"
76
+ },
51
77
  "./define": {
52
78
  "types": "./define.d.ts",
53
79
  "default": "./define.js"