@vsreact/core 0.0.2 → 0.0.3

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.
package/src/index.ts CHANGED
@@ -1,24 +1,50 @@
1
- // vsreact public API. runtime must load first — it installs the
2
- // timer/console/microtask shims react depends on inside QuickJS.
3
- import "./runtime";
4
- import "./bridge";
5
-
6
- export { View, Text, Image, TextInput, NativeView } from "./primitives";
7
- export type {
8
- CommonProps,
9
- TextProps,
10
- ImageProps,
11
- TextInputProps,
12
- NativeViewProps,
13
- } from "./primitives";
14
- export { render, unmount } from "./render";
15
- export { native } from "./native";
16
- export { configureTheme, tw } from "./tw";
17
- export type { Style, ResolvedClasses } from "./tw";
18
- export { useTween, lerp, Easing } from "./animation";
19
- export type { TweenOptions, EasingFn } from "./animation";
20
- export { useParameter } from "./parameters";
21
- export type { ParameterState, ParameterHandle } from "./parameters";
22
- export { Knob, Slider, ParamKnob, ParamSlider, dragToValue } from "./controls";
23
- export type { KnobProps, SliderProps, ParamKnobProps, ParamSliderProps } from "./controls";
24
- export type { DragEventPayload } from "./primitives";
1
+ // @vsreact/core public API. runtime must load first — it installs the
2
+ // timer/console/microtask shims react depends on inside QuickJS.
3
+ import "./runtime";
4
+ import "./bridge";
5
+
6
+ export { View, Text, Image, TextInput, NativeView } from "./primitives";
7
+ export type {
8
+ CommonProps,
9
+ TextProps,
10
+ ImageProps,
11
+ TextInputProps,
12
+ NativeViewProps,
13
+ } from "./primitives";
14
+ export { render, unmount } from "./render";
15
+ export { native } from "./native";
16
+ export { useNativeEvent } from "./hooks";
17
+ export { configureTheme, tw } from "./tw";
18
+ export type { Style, ResolvedClasses } from "./tw";
19
+ export { cx } from "./cx";
20
+ export type { ClassValue } from "./cx";
21
+ export { useTween, useSpring, springStep, lerp, Easing } from "./animation";
22
+ export type { TweenOptions, SpringOptions, EasingFn } from "./animation";
23
+ export { useParameter } from "./parameters";
24
+ export type { ParameterState, ParameterHandle } from "./parameters";
25
+ export {
26
+ Knob,
27
+ Slider,
28
+ Toggle,
29
+ XYPad,
30
+ Segmented,
31
+ ParamKnob,
32
+ ParamSlider,
33
+ ParamToggle,
34
+ ParamXYPad,
35
+ ParamSegmented,
36
+ dragToValue,
37
+ } from "./controls";
38
+ export type {
39
+ KnobProps,
40
+ SliderProps,
41
+ ToggleProps,
42
+ XYPadProps,
43
+ SegmentedProps,
44
+ ParamKnobProps,
45
+ ParamSliderProps,
46
+ ParamToggleProps,
47
+ ParamXYPadProps,
48
+ ParamSegmentedProps,
49
+ } from "./controls";
50
+ export type { DragEventPayload } from "./primitives";
package/src/theme.ts CHANGED
@@ -1,7 +1,82 @@
1
1
  export type ThemeColors = Record<string, string>;
2
2
 
3
- // Tailwind v3 palettes (the curated subset VSReacT ships with).
3
+ // The full Tailwind v3 color palette.
4
4
  const palettes: Record<string, Record<string, string>> = {
5
+ slate: {
6
+ "50": "#f8fafc", "100": "#f1f5f9", "200": "#e2e8f0", "300": "#cbd5e1",
7
+ "400": "#94a3b8", "500": "#64748b", "600": "#475569", "700": "#334155",
8
+ "800": "#1e293b", "900": "#0f172a", "950": "#020617",
9
+ },
10
+ gray: {
11
+ "50": "#f9fafb", "100": "#f3f4f6", "200": "#e5e7eb", "300": "#d1d5db",
12
+ "400": "#9ca3af", "500": "#6b7280", "600": "#4b5563", "700": "#374151",
13
+ "800": "#1f2937", "900": "#111827", "950": "#030712",
14
+ },
15
+ stone: {
16
+ "50": "#fafaf9", "100": "#f5f5f4", "200": "#e7e5e4", "300": "#d6d3d1",
17
+ "400": "#a8a29e", "500": "#78716c", "600": "#57534e", "700": "#44403c",
18
+ "800": "#292524", "900": "#1c1917", "950": "#0c0a09",
19
+ },
20
+ orange: {
21
+ "50": "#fff7ed", "100": "#ffedd5", "200": "#fed7aa", "300": "#fdba74",
22
+ "400": "#fb923c", "500": "#f97316", "600": "#ea580c", "700": "#c2410c",
23
+ "800": "#9a3412", "900": "#7c2d12", "950": "#431407",
24
+ },
25
+ yellow: {
26
+ "50": "#fefce8", "100": "#fef9c3", "200": "#fef08a", "300": "#fde047",
27
+ "400": "#facc15", "500": "#eab308", "600": "#ca8a04", "700": "#a16207",
28
+ "800": "#854d0e", "900": "#713f12", "950": "#422006",
29
+ },
30
+ green: {
31
+ "50": "#f0fdf4", "100": "#dcfce7", "200": "#bbf7d0", "300": "#86efac",
32
+ "400": "#4ade80", "500": "#22c55e", "600": "#16a34a", "700": "#15803d",
33
+ "800": "#166534", "900": "#14532d", "950": "#052e16",
34
+ },
35
+ teal: {
36
+ "50": "#f0fdfa", "100": "#ccfbf1", "200": "#99f6e4", "300": "#5eead4",
37
+ "400": "#2dd4bf", "500": "#14b8a6", "600": "#0d9488", "700": "#0f766e",
38
+ "800": "#115e59", "900": "#134e4a", "950": "#042f2e",
39
+ },
40
+ cyan: {
41
+ "50": "#ecfeff", "100": "#cffafe", "200": "#a5f3fc", "300": "#67e8f9",
42
+ "400": "#22d3ee", "500": "#06b6d4", "600": "#0891b2", "700": "#0e7490",
43
+ "800": "#155e75", "900": "#164e63", "950": "#083344",
44
+ },
45
+ blue: {
46
+ "50": "#eff6ff", "100": "#dbeafe", "200": "#bfdbfe", "300": "#93c5fd",
47
+ "400": "#60a5fa", "500": "#3b82f6", "600": "#2563eb", "700": "#1d4ed8",
48
+ "800": "#1e40af", "900": "#1e3a8a", "950": "#172554",
49
+ },
50
+ indigo: {
51
+ "50": "#eef2ff", "100": "#e0e7ff", "200": "#c7d2fe", "300": "#a5b4fc",
52
+ "400": "#818cf8", "500": "#6366f1", "600": "#4f46e5", "700": "#4338ca",
53
+ "800": "#3730a3", "900": "#312e81", "950": "#1e1b4b",
54
+ },
55
+ violet: {
56
+ "50": "#f5f3ff", "100": "#ede9fe", "200": "#ddd6fe", "300": "#c4b5fd",
57
+ "400": "#a78bfa", "500": "#8b5cf6", "600": "#7c3aed", "700": "#6d28d9",
58
+ "800": "#5b21b6", "900": "#4c1d95", "950": "#2e1065",
59
+ },
60
+ purple: {
61
+ "50": "#faf5ff", "100": "#f3e8ff", "200": "#e9d5ff", "300": "#d8b4fe",
62
+ "400": "#c084fc", "500": "#a855f7", "600": "#9333ea", "700": "#7e22ce",
63
+ "800": "#6b21a8", "900": "#581c87", "950": "#3b0764",
64
+ },
65
+ fuchsia: {
66
+ "50": "#fdf4ff", "100": "#fae8ff", "200": "#f5d0fe", "300": "#f0abfc",
67
+ "400": "#e879f9", "500": "#d946ef", "600": "#c026d3", "700": "#a21caf",
68
+ "800": "#86198f", "900": "#701a75", "950": "#4a044e",
69
+ },
70
+ pink: {
71
+ "50": "#fdf2f8", "100": "#fce7f3", "200": "#fbcfe8", "300": "#f9a8d4",
72
+ "400": "#f472b6", "500": "#ec4899", "600": "#db2777", "700": "#be185d",
73
+ "800": "#9d174d", "900": "#831843", "950": "#500724",
74
+ },
75
+ rose: {
76
+ "50": "#fff1f2", "100": "#ffe4e6", "200": "#fecdd3", "300": "#fda4af",
77
+ "400": "#fb7185", "500": "#f43f5e", "600": "#e11d48", "700": "#be123c",
78
+ "800": "#9f1239", "900": "#881337", "950": "#4c0519",
79
+ },
5
80
  zinc: {
6
81
  "50": "#fafafa", "100": "#f4f4f5", "200": "#e4e4e7", "300": "#d4d4d8",
7
82
  "400": "#a1a1aa", "500": "#71717a", "600": "#52525b", "700": "#3f3f46",
package/src/tw.test.ts CHANGED
@@ -111,3 +111,29 @@ describe("tw resolver", () => {
111
111
  expect(r.style.backgroundColor).toBe("#27272a");
112
112
  });
113
113
  });
114
+
115
+ describe("tw 0.0.3 additions", () => {
116
+ test("full Tailwind palette resolves", () => {
117
+ expect(tw("bg-blue-500").style.backgroundColor).toBe("#3b82f6");
118
+ expect(tw("text-rose-400").style.color).toBe("#fb7185");
119
+ expect(tw("border-slate-700").style.borderColor).toBe("#334155");
120
+ expect(tw("bg-violet-950").style.backgroundColor).toBe("#2e1065");
121
+ expect(tw("bg-teal-500/50").style.backgroundColor).toBe("#14b8a680");
122
+ });
123
+
124
+ test("size-* sets width and height together", () => {
125
+ expect(tw("size-10").style).toEqual({ width: 40, height: 40 });
126
+ expect(tw("size-[13]").style).toEqual({ width: 13, height: 13 });
127
+ expect(tw("size-full").style).toEqual({ width: "100%", height: "100%" });
128
+ });
129
+
130
+ test("inset-x / inset-y", () => {
131
+ expect(tw("inset-x-2").style).toEqual({ left: 8, right: 8 });
132
+ expect(tw("inset-y-0").style).toEqual({ top: 0, bottom: 0 });
133
+ });
134
+
135
+ test("larger text sizes", () => {
136
+ expect(tw("text-5xl").style.fontSize).toBe(48);
137
+ expect(tw("text-6xl").style.fontSize).toBe(60);
138
+ });
139
+ });
package/src/tw.ts CHANGED
@@ -83,6 +83,7 @@ const staticClasses: Record<string, Style> = {
83
83
 
84
84
  const textSizes: Record<string, number> = {
85
85
  xs: 12, sm: 14, base: 16, lg: 18, xl: 20, "2xl": 24, "3xl": 30, "4xl": 36,
86
+ "5xl": 48, "6xl": 60,
86
87
  };
87
88
 
88
89
  const radiusSizes: Record<string, number> = {
@@ -105,6 +106,7 @@ const radiusCorners: Record<string, string[]> = {
105
106
  const lengthKeys: Record<string, string[]> = {
106
107
  w: ["width"],
107
108
  h: ["height"],
109
+ size: ["width", "height"],
108
110
  "min-w": ["minWidth"],
109
111
  "min-h": ["minHeight"],
110
112
  "max-w": ["maxWidth"],
@@ -131,6 +133,8 @@ const lengthKeys: Record<string, string[]> = {
131
133
  bottom: ["bottom"],
132
134
  left: ["left"],
133
135
  inset: ["left", "right", "top", "bottom"],
136
+ "inset-x": ["left", "right"],
137
+ "inset-y": ["top", "bottom"],
134
138
  basis: ["flexBasis"],
135
139
  };
136
140