@upstart.gg/style-system 0.0.23

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,211 @@
1
+ import { defineConfig } from "@twind/core";
2
+ import presetAutoprefix from "@twind/preset-autoprefix";
3
+ import presetTailwind from "@twind/preset-tailwind";
4
+ import presetExt from "@twind/preset-ext";
5
+ import presetLineClamp from "@twind/preset-line-clamp";
6
+ import presetForms from "@twind/preset-tailwind-forms";
7
+ import presetTypo from "@twind/preset-typography";
8
+ import presetContainerQueries from "@twind/preset-container-queries";
9
+ import { modularScale } from "polished";
10
+
11
+ export default defineConfig({
12
+ darkMode: "media",
13
+ presets: [
14
+ presetAutoprefix(),
15
+ presetTailwind({ disablePreflight: false }),
16
+ presetContainerQueries(),
17
+ presetExt(),
18
+ presetLineClamp(),
19
+ presetForms(),
20
+ presetTypo(),
21
+ ],
22
+ variants: [["hasChildMenudHover", "&:has(.container-menu-wrapper:hover)"]],
23
+ rules: [
24
+ [
25
+ "brick-container",
26
+ {
27
+ display: "grid",
28
+ gridTemplateColumns: "subgrid",
29
+ gridTemplateRows: "subgrid",
30
+ gridColumn: "1 / span 12",
31
+ },
32
+ ],
33
+ [
34
+ // specific padding classes for bricks
35
+ "brick-p-",
36
+ ({ $$ }) => ({ padding: `${$$ === "1" ? "1px" : $$ === "0" ? "0" : `${modularScale(+$$, "1rem")}`}` }),
37
+ ],
38
+ // ["family-", ({ $$ }) => ({ fontFamily: `var(--font-${$$})` })],
39
+
40
+ ["bg-neutral-", ({ $$ }) => ({ backgroundColor: `var(--color-neutral-${$$})` })],
41
+ ["bg-accent-", ({ $$ }) => ({ backgroundColor: `var(--color-accent-${$$})` })],
42
+ ["bg-primary-", ({ $$ }) => ({ backgroundColor: `var(--color-primary-${$$})` })],
43
+ ["bg-secondary-", ({ $$ }) => ({ backgroundColor: `var(--color-secondary-${$$})` })],
44
+
45
+ ["border-neutral-", ({ $$ }) => ({ borderColor: `var(--color-neutral-${$$})` })],
46
+ ["border-accent-", ({ $$ }) => ({ borderColor: `var(--color-accent-${$$})` })],
47
+ ["border-primary-", ({ $$ }) => ({ borderColor: `var(--color-primary-${$$})` })],
48
+ ["border-secondary-", ({ $$ }) => ({ borderColor: `var(--color-secondary-${$$})` })],
49
+
50
+ /**
51
+ * Can be used with text-neutral-500, but also text-neutral-500-subtle, text-neutral-500-tonal-subtle, text-neutral-500-strong, etc.
52
+ */
53
+ ["text-neutral-", ({ $$ }) => ({ color: `var(--text-neutral-${$$})` })],
54
+ ["text-accent-", ({ $$ }) => ({ color: `var(--text-accent-${$$})` })],
55
+ ["text-primary-", ({ $$ }) => ({ color: `var(--text-primary-${$$})` })],
56
+ ["text-secondary-", ({ $$ }) => ({ color: `var(--text-secondary-${$$})` })],
57
+
58
+ ["outline-primary-", ({ $$ }) => ({ outlineColor: `var(--color-primary-${$$})` })],
59
+ ["outline-secondary-", ({ $$ }) => ({ outlineColor: `var(--color-secondary-${$$})` })],
60
+ ["outline-accent-", ({ $$ }) => ({ outlineColor: `var(--color-accent-${$$})` })],
61
+ ["outline-neutral-", ({ $$ }) => ({ outlineColor: `var(--color-neutral-${$$})` })],
62
+
63
+ ["color-", ({ $$ }) => ({ color: `var(--color-${$$})` })],
64
+ [
65
+ "neutral-",
66
+ ({ $$ }) => ({ backgroundColor: `var(--color-neutral-${$$})`, color: `var(--text-neutral-${$$})` }),
67
+ ],
68
+ [
69
+ "accent-",
70
+ ({ $$ }) => ({ backgroundColor: `var(--color-accent-${$$})`, color: `var(--text-accent-${$$})` }),
71
+ ],
72
+
73
+ [
74
+ "primary-",
75
+ ({ $$ }) => ({ backgroundColor: `var(--color-primary-${$$})`, color: `var(--text-primary-${$$})` }),
76
+ ],
77
+ [
78
+ "secondary-",
79
+ ({ $$ }) => ({ backgroundColor: `var(--color-secondary-${$$})`, color: `var(--text-secondary-${$$})` }),
80
+ ],
81
+
82
+ ["brick-light-", ({ $$ }) => `bg-${$$}-300 text-${$$}-50`],
83
+ ["brick-normal-", ({ $$ }) => `bg-${$$}-500 text-${$$}-100`],
84
+ ["brick-dark-", ({ $$ }) => `bg-${$$}-800 text-${$$}-200`],
85
+
86
+ ["hero-1", { fontSize: "clamp(1.75rem, 1.5vw + 1.25rem, 2.5rem)", lineHeight: "1.25" }],
87
+ ["hero-2", { fontSize: "clamp(2rem, 1.75vw + 1.375rem, 2.875rem)", lineHeight: "1.25" }],
88
+ ["hero-3", { fontSize: "clamp(2.25rem, 2vw + 1.5rem, 3.25rem)", lineHeight: "1.25" }],
89
+ ["hero-4", { fontSize: "clamp(2.5rem, 2.25vw + 1.625rem, 3.625rem)", lineHeight: "1.25" }],
90
+ ["hero-5", { fontSize: "clamp(2.75rem, 2.5vw + 1.75rem, 4rem)", lineHeight: "1.25" }],
91
+ ["scrollbar-thin", { scrollbarWidth: "thin" }],
92
+ ["scrollbar-color-", ({ $$ }) => ({ scrollbarColor: `var(--${$$}-6) var(--${$$}-surface)` })],
93
+ [
94
+ "button",
95
+ {
96
+ color: "var(--color-button-text)",
97
+ backgroundColor: "var(--color-button-bg)",
98
+ padding: "0.5rem 1rem",
99
+ borderRadius: "0.25rem",
100
+ fontSize: "1rem",
101
+ cursor: "pointer",
102
+ },
103
+ ],
104
+ [
105
+ "button-sm",
106
+ {
107
+ padding: "0.25rem 0.5rem",
108
+ fontSize: "0.875rem",
109
+ },
110
+ ],
111
+ [
112
+ "button-lg",
113
+ {
114
+ padding: "0.75rem 1.5rem",
115
+ fontSize: "1.25rem",
116
+ },
117
+ ],
118
+ [
119
+ "button-xl",
120
+ {
121
+ padding: "1rem 2rem",
122
+ fontSize: "1.5rem",
123
+ },
124
+ ],
125
+ ],
126
+ theme: {
127
+ extend: {
128
+ colors: {
129
+ upstart: {
130
+ 50: "#f2f4fb",
131
+ 100: "#e7ecf8",
132
+ 200: "#d3daf2",
133
+ 300: "#b8c2e9",
134
+ 400: "#9ba3de",
135
+ 500: "#8186d3",
136
+ 600: "#7270c6",
137
+ 700: "#5b57ab",
138
+ 800: "#4b498a",
139
+ 900: "#40406f",
140
+ 950: "#262541",
141
+ },
142
+ dark: {
143
+ 50: "#f6f6f6",
144
+ 100: "#e7e7e7",
145
+ 200: "#d1d1d1",
146
+ 300: "#b0b0b0",
147
+ 400: "#888888",
148
+ 500: "#6d6d6d",
149
+ 600: "#5d5d5d",
150
+ 700: "#4f4f4f",
151
+ 800: "#454545",
152
+ 900: "#333333",
153
+ 950: "#262626",
154
+ },
155
+ primary: {
156
+ 50: "var(--color-primary-50)",
157
+ 100: "var(--color-primary-100)",
158
+ 200: "var(--color-primary-200)",
159
+ 300: "var(--color-primary-300)",
160
+ 400: "var(--color-primary-400)",
161
+ 500: "var(--color-primary-500)",
162
+ 600: "var(--color-primary-600)",
163
+ 700: "var(--color-primary-700)",
164
+ 800: "var(--color-primary-800)",
165
+ 900: "var(--color-primary-900)",
166
+ },
167
+ secondary: {
168
+ 50: "var(--color-secondary-50)",
169
+ 100: "var(--color-secondary-100)",
170
+ 200: "var(--color-secondary-200)",
171
+ 300: "var(--color-secondary-300)",
172
+ 400: "var(--color-secondary-400)",
173
+ 500: "var(--color-secondary-500)",
174
+ 600: "var(--color-secondary-600)",
175
+ 700: "var(--color-secondary-700)",
176
+ 800: "var(--color-secondary-800)",
177
+ 900: "var(--color-secondary-900)",
178
+ },
179
+ accent: {
180
+ 50: "var(--color-accent-50)",
181
+ 100: "var(--color-accent-100)",
182
+ 200: "var(--color-accent-200)",
183
+ 300: "var(--color-accent-300)",
184
+ 400: "var(--color-accent-400)",
185
+ 500: "var(--color-accent-500)",
186
+ 600: "var(--color-accent-600)",
187
+ 700: "var(--color-accent-700)",
188
+ 800: "var(--color-accent-800)",
189
+ 900: "var(--color-accent-900)",
190
+ },
191
+ neutral: {
192
+ 50: "var(--color-neutral-50)",
193
+ 100: "var(--color-neutral-100)",
194
+ 200: "var(--color-neutral-200)",
195
+ 300: "var(--color-neutral-300)",
196
+ 400: "var(--color-neutral-400)",
197
+ 500: "var(--color-neutral-500)",
198
+ 600: "var(--color-neutral-600)",
199
+ 700: "var(--color-neutral-700)",
200
+ 800: "var(--color-neutral-800)",
201
+ 900: "var(--color-neutral-900)",
202
+ },
203
+ },
204
+
205
+ containers: {
206
+ mobile: "1px",
207
+ desktop: "1024px",
208
+ },
209
+ },
210
+ },
211
+ });
package/src/twind.ts ADDED
@@ -0,0 +1,64 @@
1
+ import install from "@twind/with-react";
2
+ import {
3
+ twind,
4
+ virtual,
5
+ cssom,
6
+ tx as tx$,
7
+ css as css$,
8
+ style as style$,
9
+ apply as apply$,
10
+ injectGlobal as injectGlobal$,
11
+ keyframes as keyframes$,
12
+ observe as observe$,
13
+ } from "@twind/core";
14
+ import config from "./twind.config";
15
+
16
+ export { getSheet } from "@twind/core";
17
+ export { default as inline } from "@twind/with-react/inline";
18
+
19
+ export const colors = config.theme.colors as Record<
20
+ string,
21
+ Record<50 | 100 | 200 | 300 | 400 | 500 | 600 | 700 | 800 | 900, string>
22
+ >;
23
+
24
+ function isProd() {
25
+ //@ts-ignore
26
+ if (typeof import.meta.env !== "undefined") {
27
+ //@ts-ignore
28
+ return import.meta.env.PROD ?? false;
29
+ } else if (typeof process !== "undefined" && typeof process.env !== "undefined") {
30
+ return process.env.NODE_ENV === "production";
31
+ }
32
+ return true;
33
+ }
34
+
35
+ // export default install(config, isProd());
36
+
37
+ export const sheet = typeof document === "undefined" ? virtual() : cssom("style[data-library]");
38
+
39
+ // @ts-ignore
40
+ export const tw = /* #__PURE__ */ twind(
41
+ config,
42
+ // support SSR and use a different selector to not get the twind default style sheet
43
+ sheet,
44
+ );
45
+
46
+ export function setupTwindReact(prod = isProd()) {
47
+ install(config, prod);
48
+
49
+ addEventListener("warning", (event) => {
50
+ // @ts-ignore
51
+ const warning = event.detail;
52
+ if (warning.code === "TWIND_INVALID_CLASS") {
53
+ event.preventDefault();
54
+ }
55
+ });
56
+ }
57
+
58
+ export const tx = /* #__PURE__ */ tx$.bind(tw);
59
+ export const css = /* #__PURE__ */ css$.bind(tw);
60
+ export const style = /* #__PURE__ */ style$.bind(tw);
61
+ export const apply = /* #__PURE__ */ apply$.bind(tw);
62
+ export const observe = /* #__PURE__ */ observe$.bind(tw);
63
+ export const injectGlobal = /* #__PURE__ */ injectGlobal$.bind(tw);
64
+ export const keyframes = /* #__PURE__ */ keyframes$.bind(tw);
package/src/ui.css ADDED
@@ -0,0 +1,3 @@
1
+ @tailwind base;
2
+ @tailwind components;
3
+ @tailwind utilities;
package/tsconfig.json ADDED
@@ -0,0 +1,28 @@
1
+ {
2
+ "compilerOptions": {
3
+ "outDir": "dist",
4
+ "types": ["node"],
5
+ "lib": ["dom", "dom.iterable", "esnext"],
6
+ "experimentalDecorators": true,
7
+ "useDefineForClassFields": false,
8
+ "target": "ES2020" /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019', 'ES2020', or 'ESNEXT'. */,
9
+ "module": "ES2020" /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', 'es2020', or 'ESNext'. */,
10
+ "strict": true /* Enable all strict type-checking options. */,
11
+ "allowJs": true,
12
+ "jsx": "react-jsx",
13
+ "baseUrl": ".",
14
+ "declaration": true,
15
+ // "allowImportingTsExtensions": true,
16
+ "isolatedModules": true,
17
+ "moduleDetection": "force",
18
+ "moduleResolution": "Bundler" /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */,
19
+ "esModuleInterop": false /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */,
20
+ "skipLibCheck": true /* Skip type checking of declaration files. */,
21
+ "forceConsistentCasingInFileNames": true /* Disallow inconsistently-cased references to the same file. */,
22
+ "paths": {
23
+ "~/*": ["./src/*"]
24
+ }
25
+ },
26
+ "include": ["src"],
27
+ "exclude": ["node_modules", "**/dist", "**/*.js"]
28
+ }
@@ -0,0 +1,12 @@
1
+ import { defineProject, mergeConfig } from "vitest/config";
2
+ import configShared from "../../vitest.shared";
3
+
4
+ export default mergeConfig(
5
+ // @ts-ignore
6
+ configShared,
7
+ defineProject({
8
+ test: {
9
+ environment: "node",
10
+ },
11
+ }),
12
+ );