@schemavaults/theme 0.22.14
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/README.md +106 -0
- package/dist/DefaultOrgScope.d.ts +2 -0
- package/dist/DefaultOrgScope.js +3 -0
- package/dist/DefaultOrgScope.js.map +1 -0
- package/dist/ScreenBreakpoints.d.ts +6 -0
- package/dist/ScreenBreakpoints.js +37 -0
- package/dist/ScreenBreakpoints.js.map +1 -0
- package/dist/TailwindConfigFactory.d.ts +50 -0
- package/dist/TailwindConfigFactory.js +228 -0
- package/dist/TailwindConfigFactory.js.map +1 -0
- package/dist/TailwindTheme.d.ts +2 -0
- package/dist/TailwindTheme.js +2 -0
- package/dist/TailwindTheme.js.map +1 -0
- package/dist/brand_colors.d.ts +5 -0
- package/dist/brand_colors.js +12 -0
- package/dist/brand_colors.js.map +1 -0
- package/dist/component_colors.d.ts +6 -0
- package/dist/component_colors.js +40 -0
- package/dist/component_colors.js.map +1 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -0
- package/dist/plugins/tailwindcss-animate.d.ts +2 -0
- package/dist/plugins/tailwindcss-animate.js +3 -0
- package/dist/plugins/tailwindcss-animate.js.map +1 -0
- package/globals.css +120 -0
- package/package.json +85 -0
package/README.md
ADDED
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
# @schemavaults/theme
|
|
2
|
+
|
|
3
|
+
## About
|
|
4
|
+
|
|
5
|
+
Package containing code for building TailwindCSS themes that contain SchemaVaults branding colors and shared styles.
|
|
6
|
+
|
|
7
|
+
## Usage
|
|
8
|
+
|
|
9
|
+
### Ensure that globals.css is imported
|
|
10
|
+
|
|
11
|
+
The generated TailwindCSS config sets colors based on CSS variables. It's important that `globals.css` is imported, so that these colors can be resolved. E.g. `var(--foreground)` and `var(--card)` become functional after this CSS import.
|
|
12
|
+
|
|
13
|
+
```javascript
|
|
14
|
+
import "@schemavaults/theme/globals.css"
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
### Import and run the TailwindCSS Config Factory from your `tailwind.config.mjs` or `tailwind.config.ts`
|
|
18
|
+
|
|
19
|
+
#### Simple Example
|
|
20
|
+
```typescript
|
|
21
|
+
import { SchemaVaultsTailwindConfigFactory } from "@schemavaults/theme";
|
|
22
|
+
const config = new SchemaVaultsTailwindConfigFactory().createConfig({
|
|
23
|
+
content: [
|
|
24
|
+
"./src/**/*.tsx|jsx|js|ts",
|
|
25
|
+
"@schemavaults/ui", // resolved and converted to an absolute path to the schemavaults package in the node_modules folder
|
|
26
|
+
],
|
|
27
|
+
});
|
|
28
|
+
export default config;
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
#### More complex example
|
|
32
|
+
```typescript
|
|
33
|
+
// Import the config factory
|
|
34
|
+
import { SchemaVaultsTailwindConfigFactory } from "@schemavaults/theme";
|
|
35
|
+
import { join } from "path";
|
|
36
|
+
import { lstatSync, exists, type Stats } from "fs";
|
|
37
|
+
|
|
38
|
+
function node_modules(): string {
|
|
39
|
+
const currentDirectory: string = import.meta.dirname;
|
|
40
|
+
|
|
41
|
+
let node_modules_path: string;
|
|
42
|
+
if (currentDirectory.endsWith("/src") || currentDirectory.endsWith("/dist")) {
|
|
43
|
+
node_modules_path = join(currentDirectory, "..", "node_modules");
|
|
44
|
+
} else {
|
|
45
|
+
node_modules_path = join(currentDirectory, "node_modules");
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
return node_modules_path;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
function isdir(path: string): boolean {
|
|
52
|
+
if (!existsSync(path)) return false;
|
|
53
|
+
|
|
54
|
+
let lstatResult: Stats;
|
|
55
|
+
try {
|
|
56
|
+
lstatResult = lstatSync(path);
|
|
57
|
+
} catch (e: unknown) {
|
|
58
|
+
throw new Error(
|
|
59
|
+
"Error running lstatSync for tailwind.config.ts isdir() function!",
|
|
60
|
+
);
|
|
61
|
+
}
|
|
62
|
+
return lstatResult.isDirectory();
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
if (!isdir(node_modules())) {
|
|
66
|
+
throw new Error("Failed to resolve node_modules/ directory for test!");
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
// Initialize the config factory
|
|
70
|
+
const configFactory = new SchemaVaultsTailwindConfigFactory({
|
|
71
|
+
node_modules,
|
|
72
|
+
isdir,
|
|
73
|
+
join,
|
|
74
|
+
scope: 'schemavaults'
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
// Generate and export the config
|
|
78
|
+
const config = configFactory.createConfig({
|
|
79
|
+
content: [
|
|
80
|
+
"./src/**/*.tsx|jsx|js|ts",
|
|
81
|
+
"./app/**/*.tsx|jsx|js|ts",
|
|
82
|
+
"@schemavaults/ui", // resolved and converted to an absolute path to the schemavaults package in the node_modules folder
|
|
83
|
+
"@schemavaults/schema-ui",
|
|
84
|
+
],
|
|
85
|
+
});
|
|
86
|
+
export default config;
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
You may wish to also dig deeper on the options passed to the factory / `createConfig` in order to customize the final Tailwind configuration generated. Notably, the `content` parameter to `createConfig`, if the code for styles to be generated from is not found within `./src/**/*.ts|tsx|js|jsx`!
|
|
90
|
+
|
|
91
|
+
```javascript
|
|
92
|
+
// ... initialize the factory somewhere
|
|
93
|
+
|
|
94
|
+
// An example demonstrating customization of where Tailwind searches for classnames
|
|
95
|
+
const config = configFactory.createConfig({
|
|
96
|
+
content: ["./src/**/*.ts|tsx|js|jsx", "@schemavaults/ui", "@schemavaults/schema-ui"]
|
|
97
|
+
});
|
|
98
|
+
export default config;
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
In the above example, local `.js`/`.ts`/`.jsx`/`.tsx` paths will be resolved in the app that `@schemavaults/theme` config factory is running in. Also, `@schemavaults/*` scoped packages will be resolved from `node_modules`.
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
### CommonJS
|
|
105
|
+
|
|
106
|
+
Note that currently CommonJS is not supported. I believe that I was struggling to get `tailwindcss-animate` working from CJS, then decided not to support it. Change your `tailwind.config.cjs` files to `tailwind.config.ts` or `tailwind.config.mjs` to use TypeScript or ES modules instead.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DefaultOrgScope.js","sourceRoot":"","sources":["../src/DefaultOrgScope.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,eAAe,GAAG,cAAwC,CAAC;AAExE,eAAe,eAAe,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
declare const screenBreakpointIds: readonly ["xs", "sm", "md", "lg", "xl", "2xl"];
|
|
2
|
+
export type ScreenBreakpointID = (typeof screenBreakpointIds)[number];
|
|
3
|
+
export declare function isValidScreenBreakpoint(maybeBreakpoint: string): maybeBreakpoint is ScreenBreakpointID;
|
|
4
|
+
export declare function getScreenBreakpoint(breakpoint: ScreenBreakpointID): number;
|
|
5
|
+
export declare function listScreenBreakpoints(): readonly ScreenBreakpointID[];
|
|
6
|
+
export {};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
const screenBreakpointIds = [
|
|
2
|
+
"xs",
|
|
3
|
+
"sm",
|
|
4
|
+
"md",
|
|
5
|
+
"lg",
|
|
6
|
+
"xl",
|
|
7
|
+
"2xl",
|
|
8
|
+
];
|
|
9
|
+
const validScreenBreakpointIds = new Set(screenBreakpointIds);
|
|
10
|
+
const screenBreakpointPixelWidths = {
|
|
11
|
+
xs: 480,
|
|
12
|
+
sm: 640,
|
|
13
|
+
md: 768,
|
|
14
|
+
lg: 1024,
|
|
15
|
+
xl: 1280,
|
|
16
|
+
"2xl": 1536,
|
|
17
|
+
};
|
|
18
|
+
export function isValidScreenBreakpoint(maybeBreakpoint) {
|
|
19
|
+
if (typeof maybeBreakpoint === "string") {
|
|
20
|
+
const validBreakpoints = validScreenBreakpointIds;
|
|
21
|
+
if (validBreakpoints.has(maybeBreakpoint)) {
|
|
22
|
+
return true;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
return false;
|
|
26
|
+
}
|
|
27
|
+
export function getScreenBreakpoint(breakpoint) {
|
|
28
|
+
if (!isValidScreenBreakpoint(breakpoint)) {
|
|
29
|
+
throw new Error(`Invalid screen breakpoint to return minimum width for! Valid screen breakpoints: ${screenBreakpointIds.map((id) => `'${id}'`).join(", ")}`);
|
|
30
|
+
}
|
|
31
|
+
const screenWidth = screenBreakpointPixelWidths[breakpoint];
|
|
32
|
+
return screenWidth;
|
|
33
|
+
}
|
|
34
|
+
export function listScreenBreakpoints() {
|
|
35
|
+
return screenBreakpointIds;
|
|
36
|
+
}
|
|
37
|
+
//# sourceMappingURL=ScreenBreakpoints.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ScreenBreakpoints.js","sourceRoot":"","sources":["../src/ScreenBreakpoints.ts"],"names":[],"mappings":"AAAA,MAAM,mBAAmB,GAAG;IAC1B,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,KAAK;CAC+B,CAAC;AAIvC,MAAM,wBAAwB,GAA4B,IAAI,GAAG,CAC/D,mBAAmB,CACpB,CAAC;AAEF,MAAM,2BAA2B,GAAuC;IACtE,EAAE,EAAE,GAAG;IACP,EAAE,EAAE,GAAG;IACP,EAAE,EAAE,GAAG;IACP,EAAE,EAAE,IAAI;IACR,EAAE,EAAE,IAAI;IACR,KAAK,EAAE,IAAI;CACZ,CAAC;AAEF,MAAM,UAAU,uBAAuB,CACrC,eAAuB;IAEvB,IAAI,OAAO,eAAe,KAAK,QAAQ,EAAE,CAAC;QACxC,MAAM,gBAAgB,GAAgB,wBAAwB,CAAC;QAC/D,IAAI,gBAAgB,CAAC,GAAG,CAAC,eAAgC,CAAC,EAAE,CAAC;YAC3D,OAAO,IAAI,CAAC;QACd,CAAC;IACH,CAAC;IAED,OAAO,KAAK,CAAC;AACf,CAAC;AAED,MAAM,UAAU,mBAAmB,CAAC,UAA8B;IAChE,IAAI,CAAC,uBAAuB,CAAC,UAAU,CAAC,EAAE,CAAC;QACzC,MAAM,IAAI,KAAK,CACb,oFAAoF,mBAAmB,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAC5I,CAAC;IACJ,CAAC;IACD,MAAM,WAAW,GAAW,2BAA2B,CAAC,UAAU,CAAC,CAAC;IACpE,OAAO,WAAW,CAAC;AACrB,CAAC;AAED,MAAM,UAAU,qBAAqB;IACnC,OAAO,mBAAmB,CAAC;AAC7B,CAAC"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import type { Config as TailwindConfig } from "tailwindcss";
|
|
2
|
+
import { type ScreenBreakpointID } from "./ScreenBreakpoints";
|
|
3
|
+
import type { TailwindTheme } from "./TailwindTheme";
|
|
4
|
+
type OsJoinFn = (path_segment: string, ...remaining_path_segments: string[]) => string;
|
|
5
|
+
export interface ISchemaVaultsTailwindConfigFactoryInitOptions {
|
|
6
|
+
debug?: boolean;
|
|
7
|
+
join?: OsJoinFn;
|
|
8
|
+
node_modules?: string | (() => string);
|
|
9
|
+
isdir?: (path: string) => boolean;
|
|
10
|
+
scope?: string;
|
|
11
|
+
fileExtensions?: readonly string[];
|
|
12
|
+
}
|
|
13
|
+
export interface ISchemaVaultsTailwindConfigCreationOptions {
|
|
14
|
+
content: readonly string[];
|
|
15
|
+
}
|
|
16
|
+
export interface ISchemaVaultsTailwindConfigFactory {
|
|
17
|
+
createConfig: (opts: ISchemaVaultsTailwindConfigCreationOptions) => TailwindConfig;
|
|
18
|
+
}
|
|
19
|
+
type TailwindConfigTheme = TailwindTheme;
|
|
20
|
+
type ThemeExtension = NonNullable<TailwindConfigTheme["extend"]>;
|
|
21
|
+
type ThemeValue = ThemeExtension[string];
|
|
22
|
+
export declare class SchemaVaultsTailwindConfigFactory implements ISchemaVaultsTailwindConfigFactory {
|
|
23
|
+
protected readonly debug: boolean;
|
|
24
|
+
protected readonly join: OsJoinFn;
|
|
25
|
+
protected readonly node_modules_path: string | undefined;
|
|
26
|
+
protected readonly isdir: (path: string) => boolean;
|
|
27
|
+
protected readonly scope: string;
|
|
28
|
+
protected static readonly defaultFileExtensionsToSearch: readonly ["js", "jsx", "ts", "tsx"];
|
|
29
|
+
protected readonly fileExtensionsToIncludeInTailwindClassNamesSearch: readonly string[];
|
|
30
|
+
private static defaultJoinImplementation;
|
|
31
|
+
private static defaultIsDirImplementation;
|
|
32
|
+
private static getDefaultResolveNodeModulesDirectoryPathImplementation;
|
|
33
|
+
constructor(opts?: ISchemaVaultsTailwindConfigFactoryInitOptions);
|
|
34
|
+
/**
|
|
35
|
+
* @description Load TailwindCSS plugins to use in theme configuration
|
|
36
|
+
* @returns Array of TailwindCSS plugins
|
|
37
|
+
* @see /plugins directory
|
|
38
|
+
*/
|
|
39
|
+
protected get plugins(): TailwindConfig["plugins"];
|
|
40
|
+
protected get shadcnColors(): ThemeValue;
|
|
41
|
+
protected get brandColors(): ThemeValue;
|
|
42
|
+
protected get screenSizes(): Record<ScreenBreakpointID, `${number}px`>;
|
|
43
|
+
protected get themeExtension(): ThemeExtension;
|
|
44
|
+
protected resolveNodeModulesDirectoryPath(): string;
|
|
45
|
+
get node_modules(): string;
|
|
46
|
+
protected resolveSchemaVaultsPackagePath(pkg_blob_string: string): string;
|
|
47
|
+
private static possibleBuildDirectories;
|
|
48
|
+
createConfig(opts?: ISchemaVaultsTailwindConfigCreationOptions): TailwindConfig;
|
|
49
|
+
}
|
|
50
|
+
export default SchemaVaultsTailwindConfigFactory;
|
|
@@ -0,0 +1,228 @@
|
|
|
1
|
+
import { componentColors } from "./component_colors";
|
|
2
|
+
import { brandColors } from "./brand_colors";
|
|
3
|
+
import DefaultOrgScope from "./DefaultOrgScope"; // @schemavaults organization is default
|
|
4
|
+
import { getScreenBreakpoint, listScreenBreakpoints, } from "./ScreenBreakpoints";
|
|
5
|
+
import { existsSync, lstatSync } from "fs";
|
|
6
|
+
// TailwindCSS Plugins:
|
|
7
|
+
import tailwindAnimatePlugin from "./plugins/tailwindcss-animate";
|
|
8
|
+
export class SchemaVaultsTailwindConfigFactory {
|
|
9
|
+
debug;
|
|
10
|
+
join;
|
|
11
|
+
node_modules_path;
|
|
12
|
+
isdir;
|
|
13
|
+
scope;
|
|
14
|
+
static defaultFileExtensionsToSearch = [
|
|
15
|
+
"js",
|
|
16
|
+
"jsx",
|
|
17
|
+
"ts",
|
|
18
|
+
"tsx",
|
|
19
|
+
];
|
|
20
|
+
fileExtensionsToIncludeInTailwindClassNamesSearch;
|
|
21
|
+
static defaultJoinImplementation(path_segment, ...remaining_path_segments) {
|
|
22
|
+
const path_segments = [
|
|
23
|
+
path_segment,
|
|
24
|
+
...remaining_path_segments,
|
|
25
|
+
];
|
|
26
|
+
return path_segments.join("/");
|
|
27
|
+
}
|
|
28
|
+
static defaultIsDirImplementation(maybeDirPath) {
|
|
29
|
+
if (!existsSync(maybeDirPath)) {
|
|
30
|
+
return false;
|
|
31
|
+
}
|
|
32
|
+
return lstatSync(maybeDirPath).isDirectory();
|
|
33
|
+
}
|
|
34
|
+
static getDefaultResolveNodeModulesDirectoryPathImplementation(join, isdir) {
|
|
35
|
+
const cwd = process.cwd();
|
|
36
|
+
if (isdir(join(cwd, "node_modules"))) {
|
|
37
|
+
return () => join(cwd, "node_modules");
|
|
38
|
+
}
|
|
39
|
+
else if (isdir(join(cwd, "..", "node_modules"))) {
|
|
40
|
+
return () => join(cwd, "..", "node_modules");
|
|
41
|
+
}
|
|
42
|
+
else if (isdir(join(cwd, "..", "..", "node_modules"))) {
|
|
43
|
+
return () => join(cwd, "..", "..", "node_modules");
|
|
44
|
+
}
|
|
45
|
+
else {
|
|
46
|
+
console.error("Failed to resolve path to 'node_modules' directory from SchemaVaultsTailwindConfigFactory!");
|
|
47
|
+
console.error("You can pass a custom resolver function to the config factory constructor to fix this!");
|
|
48
|
+
process.exit(1);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
constructor(opts) {
|
|
52
|
+
this.debug = opts?.debug ?? false;
|
|
53
|
+
if (this.debug) {
|
|
54
|
+
console.log("[SchemaVaultsTailwindConfigFactory] constructor()");
|
|
55
|
+
}
|
|
56
|
+
this.join =
|
|
57
|
+
typeof opts?.join === "function"
|
|
58
|
+
? opts.join
|
|
59
|
+
: SchemaVaultsTailwindConfigFactory.defaultJoinImplementation;
|
|
60
|
+
this.isdir =
|
|
61
|
+
typeof opts?.isdir === "function"
|
|
62
|
+
? opts.isdir
|
|
63
|
+
: SchemaVaultsTailwindConfigFactory.defaultIsDirImplementation;
|
|
64
|
+
this.node_modules_path =
|
|
65
|
+
typeof opts?.node_modules === "string"
|
|
66
|
+
? opts.node_modules
|
|
67
|
+
: typeof opts?.node_modules === "function"
|
|
68
|
+
? opts.node_modules()
|
|
69
|
+
: SchemaVaultsTailwindConfigFactory.getDefaultResolveNodeModulesDirectoryPathImplementation(this.join, this.isdir)();
|
|
70
|
+
this.scope = opts?.scope ?? DefaultOrgScope;
|
|
71
|
+
if (this.scope.startsWith("@")) {
|
|
72
|
+
throw new Error("Don't pass the @ in the scope, we'll handle adding passing that!");
|
|
73
|
+
}
|
|
74
|
+
this.fileExtensionsToIncludeInTailwindClassNamesSearch = Array.isArray(opts?.fileExtensions)
|
|
75
|
+
? opts.fileExtensions
|
|
76
|
+
: SchemaVaultsTailwindConfigFactory.defaultFileExtensionsToSearch;
|
|
77
|
+
if (this.debug) {
|
|
78
|
+
console.log(`[SchemaVaultsTailwindConfigFactory] Initialized '@${this.scope}' config factory`);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* @description Load TailwindCSS plugins to use in theme configuration
|
|
83
|
+
* @returns Array of TailwindCSS plugins
|
|
84
|
+
* @see /plugins directory
|
|
85
|
+
*/
|
|
86
|
+
get plugins() {
|
|
87
|
+
return [tailwindAnimatePlugin];
|
|
88
|
+
}
|
|
89
|
+
get shadcnColors() {
|
|
90
|
+
return componentColors;
|
|
91
|
+
}
|
|
92
|
+
get brandColors() {
|
|
93
|
+
return brandColors;
|
|
94
|
+
}
|
|
95
|
+
get screenSizes() {
|
|
96
|
+
const breakpointIds = listScreenBreakpoints();
|
|
97
|
+
const screenSizes = new Map();
|
|
98
|
+
for (const breakpoint of breakpointIds) {
|
|
99
|
+
const screenSize = getScreenBreakpoint(breakpoint);
|
|
100
|
+
screenSizes.set(breakpoint, `${screenSize}px`);
|
|
101
|
+
}
|
|
102
|
+
const output = Object.fromEntries(screenSizes.entries());
|
|
103
|
+
return output;
|
|
104
|
+
}
|
|
105
|
+
get themeExtension() {
|
|
106
|
+
const screens = this.screenSizes;
|
|
107
|
+
const extend = {
|
|
108
|
+
colors: {
|
|
109
|
+
...this.shadcnColors,
|
|
110
|
+
...this.brandColors,
|
|
111
|
+
},
|
|
112
|
+
borderRadius: {
|
|
113
|
+
lg: "var(--radius)",
|
|
114
|
+
md: "calc(var(--radius) - 2px)",
|
|
115
|
+
sm: "calc(var(--radius) - 4px)",
|
|
116
|
+
},
|
|
117
|
+
screens,
|
|
118
|
+
};
|
|
119
|
+
return extend;
|
|
120
|
+
}
|
|
121
|
+
resolveNodeModulesDirectoryPath() {
|
|
122
|
+
if (typeof this.node_modules_path === "string") {
|
|
123
|
+
return this.node_modules_path;
|
|
124
|
+
}
|
|
125
|
+
throw new Error("Failed to resolve path to node_modules/ directory!");
|
|
126
|
+
}
|
|
127
|
+
// Get the path to the node_modules/ directory
|
|
128
|
+
get node_modules() {
|
|
129
|
+
const path = this.resolveNodeModulesDirectoryPath();
|
|
130
|
+
if (!this.isdir(path)) {
|
|
131
|
+
throw new Error("Expected result of node_modules getter to be the path to a directory!");
|
|
132
|
+
}
|
|
133
|
+
return path;
|
|
134
|
+
}
|
|
135
|
+
resolveSchemaVaultsPackagePath(pkg_blob_string) {
|
|
136
|
+
const scope = this.scope;
|
|
137
|
+
if (!pkg_blob_string.startsWith(`@${scope}/`)) {
|
|
138
|
+
throw new Error(`This method should only be called if content path starts with @${scope}/...`);
|
|
139
|
+
}
|
|
140
|
+
const pkg_blob_parts = pkg_blob_string.split("/");
|
|
141
|
+
if (pkg_blob_parts.length < 2 ||
|
|
142
|
+
!pkg_blob_parts[1] ||
|
|
143
|
+
typeof pkg_blob_parts[1] !== "string") {
|
|
144
|
+
throw new TypeError("Failed to resolve package name from package blob string");
|
|
145
|
+
}
|
|
146
|
+
const package_name = pkg_blob_parts[1];
|
|
147
|
+
const join = this.join;
|
|
148
|
+
const node_modules_dir = this.resolveNodeModulesDirectoryPath();
|
|
149
|
+
const packagePath = join(node_modules_dir, `@${scope}`, package_name);
|
|
150
|
+
if (!this.isdir(packagePath)) {
|
|
151
|
+
throw new Error(`Failed to resolve path to package: '@${scope}/${package_name}'!`);
|
|
152
|
+
}
|
|
153
|
+
return packagePath;
|
|
154
|
+
}
|
|
155
|
+
static possibleBuildDirectories = [
|
|
156
|
+
"dist",
|
|
157
|
+
"src",
|
|
158
|
+
"build",
|
|
159
|
+
"out",
|
|
160
|
+
"export",
|
|
161
|
+
];
|
|
162
|
+
createConfig(opts) {
|
|
163
|
+
if (this.debug) {
|
|
164
|
+
console.log("[SchemaVaultsTailwindConfigFactory] createConfig()");
|
|
165
|
+
}
|
|
166
|
+
const scope = this.scope;
|
|
167
|
+
const defaultContentSearchPath = `./src/**/*.{${this.fileExtensionsToIncludeInTailwindClassNamesSearch.join(",")}}`;
|
|
168
|
+
const content_input = Array.isArray(opts?.content)
|
|
169
|
+
? opts.content
|
|
170
|
+
: [defaultContentSearchPath];
|
|
171
|
+
if (content_input.length < 1) {
|
|
172
|
+
throw new Error("Expected at least one content path to resolve TailwindCSS classnames at!");
|
|
173
|
+
}
|
|
174
|
+
const content = [];
|
|
175
|
+
content_input.forEach((content_path_input) => {
|
|
176
|
+
const content_length_at_start = content.length;
|
|
177
|
+
if (content_path_input.startsWith(`@${scope}/`)) {
|
|
178
|
+
const package_path = this.resolveSchemaVaultsPackagePath(content_path_input);
|
|
179
|
+
SchemaVaultsTailwindConfigFactory.possibleBuildDirectories.forEach((possible_build_dir) => {
|
|
180
|
+
const buildSubdirPath = this.join(package_path, possible_build_dir);
|
|
181
|
+
let hasBuildSubdirectory;
|
|
182
|
+
try {
|
|
183
|
+
hasBuildSubdirectory = this.isdir(buildSubdirPath);
|
|
184
|
+
}
|
|
185
|
+
catch (e) {
|
|
186
|
+
console.error("There was an error thrown by the isdir() function supplied to the SchemaVaultsTailwindConfigFactory instance:", e);
|
|
187
|
+
console.error("The error occurred while checking if directory exists at path: ", buildSubdirPath);
|
|
188
|
+
throw new Error("Error using isdir() to check if there is a directory at path");
|
|
189
|
+
}
|
|
190
|
+
if (hasBuildSubdirectory) {
|
|
191
|
+
content.push(`${package_path}/${possible_build_dir}/**/*.{${this.fileExtensionsToIncludeInTailwindClassNamesSearch.join(",")}}`);
|
|
192
|
+
}
|
|
193
|
+
});
|
|
194
|
+
}
|
|
195
|
+
else {
|
|
196
|
+
// does not start with @${scope}/* (probably @schemavaults/*, if opts.scope was not passed to config factory constructor)
|
|
197
|
+
content.push(content_path_input);
|
|
198
|
+
}
|
|
199
|
+
const content_length_at_end = content.length;
|
|
200
|
+
const content_added_this_iteration = content_length_at_end - content_length_at_start;
|
|
201
|
+
if (content_added_this_iteration < 1 &&
|
|
202
|
+
content_path_input.startsWith(`@${scope}/`)) {
|
|
203
|
+
console.warn(`Did not find any known build directories (${SchemaVaultsTailwindConfigFactory.possibleBuildDirectories
|
|
204
|
+
.map((d) => `"${d}"`)
|
|
205
|
+
.join(", ")})!`);
|
|
206
|
+
}
|
|
207
|
+
});
|
|
208
|
+
if (content.length === 0) {
|
|
209
|
+
throw new Error("Did not receive any search blobs for files to initialize Tailwind classes from!");
|
|
210
|
+
}
|
|
211
|
+
const plugins = this.plugins;
|
|
212
|
+
const extend = this.themeExtension;
|
|
213
|
+
const config = {
|
|
214
|
+
content: [...content],
|
|
215
|
+
theme: { extend },
|
|
216
|
+
plugins,
|
|
217
|
+
darkMode: "class",
|
|
218
|
+
};
|
|
219
|
+
console.assert(config.content.length >= 1, "Failed to load any 'content' search blobs to generate TailwindCSS classes for!");
|
|
220
|
+
console.assert(config.content.every((blob) => typeof blob === "string"), "Received a non-string search blob for the 'content' field of the Tailwind configuration!");
|
|
221
|
+
if (this.debug) {
|
|
222
|
+
console.log("[SchemaVaultsTailwindConfigFactory] Generated TailwindCSS config:\n", config);
|
|
223
|
+
}
|
|
224
|
+
return config;
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
export default SchemaVaultsTailwindConfigFactory;
|
|
228
|
+
//# sourceMappingURL=TailwindConfigFactory.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TailwindConfigFactory.js","sourceRoot":"","sources":["../src/TailwindConfigFactory.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,eAAe,MAAM,mBAAmB,CAAC,CAAC,wCAAwC;AACzF,OAAO,EACL,mBAAmB,EACnB,qBAAqB,GAEtB,MAAM,qBAAqB,CAAC;AAM7B,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,IAAI,CAAC;AAE3C,uBAAuB;AACvB,OAAO,qBAAqB,MAAM,+BAA+B,CAAC;AA8BlE,MAAM,OAAO,iCAAiC;IAGzB,KAAK,CAAU;IAEf,IAAI,CAAW;IAEf,iBAAiB,CAAqB;IAEtC,KAAK,CAA4B;IAEjC,KAAK,CAAS;IAEvB,MAAM,CAAU,6BAA6B,GAAG;QACxD,IAAI;QACJ,KAAK;QACL,IAAI;QACJ,KAAK;KAC+B,CAAC;IAEpB,iDAAiD,CAAoB;IAEhF,MAAM,CAAC,yBAAyB,CACtC,YAAoB,EACpB,GAAG,uBAAiC;QAEpC,MAAM,aAAa,GAAsB;YACvC,YAAY;YACZ,GAAG,uBAAuB;SAC3B,CAAC;QACF,OAAO,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AAC,MAAM,CACZ,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,OAAO,IAAI,KAAK,QAAQ,CAAC,EACxD,0FAA0F,CAC3F,CAAC;QAEF,IAAI,IAAI,CAAC,KAAK,EAAE,CAAC;YACf,OAAO,CAAC,GAAG,CACT,qEAAqE,EACrE,MAAM,CACP,CAAC;QACJ,CAAC;QAED,OAAO,MAAM,CAAC;IAChB,CAAC;;AAGH,eAAe,iCAAiC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TailwindTheme.js","sourceRoot":"","sources":["../src/TailwindTheme.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
declare const SCHEMAVAULTS_COLOR_KEYS: readonly ["schemavaults-brand-blue", "schemavaults-brand-red"];
|
|
2
|
+
export type SchemaVaultsBrandColor = (typeof SCHEMAVAULTS_COLOR_KEYS)[number];
|
|
3
|
+
export declare const brandColors: Record<SchemaVaultsBrandColor, string>;
|
|
4
|
+
export declare function getSchemaVaultsBrandColor(colorName: SchemaVaultsBrandColor): string;
|
|
5
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
const SCHEMAVAULTS_COLOR_KEYS = [
|
|
2
|
+
"schemavaults-brand-blue",
|
|
3
|
+
"schemavaults-brand-red",
|
|
4
|
+
];
|
|
5
|
+
export const brandColors = {
|
|
6
|
+
"schemavaults-brand-blue": "var(--schemavaults-brand-blue)",
|
|
7
|
+
"schemavaults-brand-red": "var(--schemavaults-brand-red)",
|
|
8
|
+
};
|
|
9
|
+
export function getSchemaVaultsBrandColor(colorName) {
|
|
10
|
+
return brandColors[colorName];
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=brand_colors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"brand_colors.js","sourceRoot":"","sources":["../src/brand_colors.ts"],"names":[],"mappings":"AAAA,MAAM,uBAAuB,GAAG;IAC9B,yBAAyB;IACzB,wBAAwB;CACY,CAAC;AAIvC,MAAM,CAAC,MAAM,WAAW,GAA2C;IACjE,yBAAyB,EAAE,gCAAgC;IAC3D,wBAAwB,EAAE,+BAA+B;CAC1D,CAAC;AAEF,MAAM,UAAU,yBAAyB,CACvC,SAAiC;IAEjC,OAAO,WAAW,CAAC,SAAS,CAAC,CAAC;AAChC,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { Config as TailwindConfig } from "tailwindcss";
|
|
2
|
+
type TailwindConfigTheme = NonNullable<TailwindConfig["theme"]>;
|
|
3
|
+
type ThemeExtension = NonNullable<TailwindConfigTheme["extend"]>;
|
|
4
|
+
type ThemeValue = ThemeExtension[string];
|
|
5
|
+
export declare const componentColors: ThemeValue;
|
|
6
|
+
export {};
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
export const componentColors = {
|
|
2
|
+
border: "hsl(var(--border))",
|
|
3
|
+
input: "hsl(var(--input))",
|
|
4
|
+
ring: "hsl(var(--ring))",
|
|
5
|
+
background: "hsl(var(--background))",
|
|
6
|
+
foreground: "hsl(var(--foreground))",
|
|
7
|
+
primary: {
|
|
8
|
+
DEFAULT: "hsl(var(--primary))",
|
|
9
|
+
foreground: "hsl(var(--primary-foreground))",
|
|
10
|
+
},
|
|
11
|
+
secondary: {
|
|
12
|
+
DEFAULT: "hsl(var(--secondary))",
|
|
13
|
+
foreground: "hsl(var(--secondary-foreground))",
|
|
14
|
+
},
|
|
15
|
+
destructive: {
|
|
16
|
+
DEFAULT: "hsl(var(--destructive))",
|
|
17
|
+
foreground: "hsl(var(--destructive-foreground))",
|
|
18
|
+
},
|
|
19
|
+
warning: {
|
|
20
|
+
DEFAULT: "var(--warning)",
|
|
21
|
+
foreground: "var(--destructive-foreground)",
|
|
22
|
+
},
|
|
23
|
+
muted: {
|
|
24
|
+
DEFAULT: "hsl(var(--muted))",
|
|
25
|
+
foreground: "hsl(var(--muted-foreground))",
|
|
26
|
+
},
|
|
27
|
+
accent: {
|
|
28
|
+
DEFAULT: "hsl(var(--accent))",
|
|
29
|
+
foreground: "hsl(var(--accent-foreground))",
|
|
30
|
+
},
|
|
31
|
+
popover: {
|
|
32
|
+
DEFAULT: "hsl(var(--popover))",
|
|
33
|
+
foreground: "hsl(var(--popover-foreground))",
|
|
34
|
+
},
|
|
35
|
+
card: {
|
|
36
|
+
DEFAULT: "hsl(var(--card))",
|
|
37
|
+
foreground: "hsl(var(--card-foreground))",
|
|
38
|
+
},
|
|
39
|
+
};
|
|
40
|
+
//# sourceMappingURL=component_colors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"component_colors.js","sourceRoot":"","sources":["../src/component_colors.ts"],"names":[],"mappings":"AAKA,MAAM,CAAC,MAAM,eAAe,GAAe;IACzC,MAAM,EAAE,oBAAoB;IAC5B,KAAK,EAAE,mBAAmB;IAC1B,IAAI,EAAE,kBAAkB;IACxB,UAAU,EAAE,wBAAwB;IACpC,UAAU,EAAE,wBAAwB;IACpC,OAAO,EAAE;QACP,OAAO,EAAE,qBAAqB;QAC9B,UAAU,EAAE,gCAAgC;KAC7C;IACD,SAAS,EAAE;QACT,OAAO,EAAE,uBAAuB;QAChC,UAAU,EAAE,kCAAkC;KAC/C;IACD,WAAW,EAAE;QACX,OAAO,EAAE,yBAAyB;QAClC,UAAU,EAAE,oCAAoC;KACjD;IACD,OAAO,EAAE;QACP,OAAO,EAAE,gBAAgB;QACzB,UAAU,EAAE,+BAA+B;KAC5C;IACD,KAAK,EAAE;QACL,OAAO,EAAE,mBAAmB;QAC5B,UAAU,EAAE,8BAA8B;KAC3C;IACD,MAAM,EAAE;QACN,OAAO,EAAE,oBAAoB;QAC7B,UAAU,EAAE,+BAA+B;KAC5C;IACD,OAAO,EAAE;QACP,OAAO,EAAE,qBAAqB;QAC9B,UAAU,EAAE,gCAAgC;KAC7C;IACD,IAAI,EAAE;QACJ,OAAO,EAAE,kBAAkB;QAC3B,UAAU,EAAE,6BAA6B;KAC1C;CACF,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { SchemaVaultsTailwindConfigFactory, SchemaVaultsTailwindConfigFactory as default, } from "./TailwindConfigFactory";
|
|
2
|
+
export type { SchemaVaultsBrandColor } from "./brand_colors";
|
|
3
|
+
export { getSchemaVaultsBrandColor, brandColors } from "./brand_colors";
|
|
4
|
+
export { getScreenBreakpoint, listScreenBreakpoints, isValidScreenBreakpoint, } from "./ScreenBreakpoints";
|
|
5
|
+
export type { ScreenBreakpointID } from "./ScreenBreakpoints";
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { SchemaVaultsTailwindConfigFactory, SchemaVaultsTailwindConfigFactory as default, } from "./TailwindConfigFactory";
|
|
2
|
+
export { getSchemaVaultsBrandColor, brandColors } from "./brand_colors";
|
|
3
|
+
export { getScreenBreakpoint, listScreenBreakpoints, isValidScreenBreakpoint, } from "./ScreenBreakpoints";
|
|
4
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,iCAAiC,EACjC,iCAAiC,IAAI,OAAO,GAC7C,MAAM,yBAAyB,CAAC;AAGjC,OAAO,EAAE,yBAAyB,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAExE,OAAO,EACL,mBAAmB,EACnB,qBAAqB,EACrB,uBAAuB,GACxB,MAAM,qBAAqB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tailwindcss-animate.js","sourceRoot":"","sources":["../../src/plugins/tailwindcss-animate.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,qBAAqB,MAAM,qBAAqB,CAAC;AAC7D,eAAe,qBAAqB,CAAC"}
|
package/globals.css
ADDED
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
@tailwind base;
|
|
2
|
+
@tailwind components;
|
|
3
|
+
@tailwind utilities;
|
|
4
|
+
|
|
5
|
+
@layer base {
|
|
6
|
+
:root {
|
|
7
|
+
--schemavaults-brand-blue: #60a5fa;
|
|
8
|
+
--schemavaults-brand-red: #dc2626;
|
|
9
|
+
|
|
10
|
+
--background: 0 0% 100%;
|
|
11
|
+
--foreground: 222.2 84% 4.9%;
|
|
12
|
+
|
|
13
|
+
--card: 0 0% 100%;
|
|
14
|
+
--card-foreground: 222.2 84% 4.9%;
|
|
15
|
+
|
|
16
|
+
--popover: 0 0% 100%;
|
|
17
|
+
--popover-foreground: 222.2 84% 4.9%;
|
|
18
|
+
|
|
19
|
+
--primary: 222.2 47.4% 11.2%;
|
|
20
|
+
--primary-foreground: 210 40% 98%;
|
|
21
|
+
|
|
22
|
+
--secondary: 210 40% 96.1%;
|
|
23
|
+
--secondary-foreground: 222.2 47.4% 11.2%;
|
|
24
|
+
|
|
25
|
+
--muted: 210 40% 96.1%;
|
|
26
|
+
--muted-foreground: 215.4 16.3% 46.9%;
|
|
27
|
+
|
|
28
|
+
--accent: 210 40% 96.1%;
|
|
29
|
+
--accent-foreground: 222.2 47.4% 11.2%;
|
|
30
|
+
|
|
31
|
+
--destructive: 0 84.2% 60.2%;
|
|
32
|
+
--destructive-foreground: 210 40% 98%;
|
|
33
|
+
|
|
34
|
+
--warning: oklch(82% 0.189 84.429);
|
|
35
|
+
--warning-foreground: oklch(41% 0.112 45.904);
|
|
36
|
+
|
|
37
|
+
--border: 214.3 31.8% 91.4%;
|
|
38
|
+
--input: 214.3 31.8% 91.4%;
|
|
39
|
+
--ring: 222.2 84% 4.9%;
|
|
40
|
+
|
|
41
|
+
--radius: 0.5rem;
|
|
42
|
+
|
|
43
|
+
--sidebar: oklch(0.985 0 0);
|
|
44
|
+
--sidebar-foreground: oklch(0.145 0 0);
|
|
45
|
+
--sidebar-primary: oklch(0.205 0 0);
|
|
46
|
+
--sidebar-primary-foreground: oklch(0.985 0 0);
|
|
47
|
+
--sidebar-accent: oklch(0.97 0 0);
|
|
48
|
+
--sidebar-accent-foreground: oklch(0.205 0 0);
|
|
49
|
+
--sidebar-border: oklch(0.922 0 0);
|
|
50
|
+
--sidebar-ring: oklch(0.708 0 0);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.dark {
|
|
54
|
+
--schemavaults-brand-blue: #60a5fa;
|
|
55
|
+
--schemavaults-brand-red: #dc2626;
|
|
56
|
+
|
|
57
|
+
--background: 222.2 84% 4.9%;
|
|
58
|
+
--foreground: 210 40% 98%;
|
|
59
|
+
|
|
60
|
+
--card: 222.2 84% 4.9%;
|
|
61
|
+
--card-foreground: 210 40% 98%;
|
|
62
|
+
|
|
63
|
+
--popover: 222.2 84% 4.9%;
|
|
64
|
+
--popover-foreground: 210 40% 98%;
|
|
65
|
+
|
|
66
|
+
--primary: 210 40% 98%;
|
|
67
|
+
--primary-foreground: 222.2 47.4% 11.2%;
|
|
68
|
+
|
|
69
|
+
--secondary: 217.2 32.6% 17.5%;
|
|
70
|
+
--secondary-foreground: 210 40% 98%;
|
|
71
|
+
|
|
72
|
+
--muted: 217.2 32.6% 17.5%;
|
|
73
|
+
--muted-foreground: 215 20.2% 65.1%;
|
|
74
|
+
|
|
75
|
+
--accent: 217.2 32.6% 17.5%;
|
|
76
|
+
--accent-foreground: 210 40% 98%;
|
|
77
|
+
|
|
78
|
+
--destructive: 0 62.8% 30.6%;
|
|
79
|
+
--destructive-foreground: 210 40% 98%;
|
|
80
|
+
|
|
81
|
+
--warning: oklch(82% 0.189 84.429);
|
|
82
|
+
--warning-foreground: oklch(41% 0.112 45.904);
|
|
83
|
+
|
|
84
|
+
--border: 217.2 32.6% 17.5%;
|
|
85
|
+
--input: 217.2 32.6% 17.5%;
|
|
86
|
+
--ring: 212.7 26.8% 83.9%;
|
|
87
|
+
|
|
88
|
+
--sidebar: oklch(0.205 0 0);
|
|
89
|
+
--sidebar-foreground: oklch(0.985 0 0);
|
|
90
|
+
--sidebar-primary: oklch(0.488 0.243 264.376);
|
|
91
|
+
--sidebar-primary-foreground: oklch(0.985 0 0);
|
|
92
|
+
--sidebar-accent: oklch(0.269 0 0);
|
|
93
|
+
--sidebar-accent-foreground: oklch(0.985 0 0);
|
|
94
|
+
--sidebar-border: oklch(1 0 0 / 10%);
|
|
95
|
+
--sidebar-ring: oklch(0.439 0 0);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
@layer base {
|
|
100
|
+
* {
|
|
101
|
+
@apply border-border;
|
|
102
|
+
}
|
|
103
|
+
body {
|
|
104
|
+
@apply bg-background text-foreground;
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
/* Adds a no-scrollbar class */
|
|
109
|
+
@layer utilities {
|
|
110
|
+
/* Hide scrollbar for Chrome, Safari and Opera */
|
|
111
|
+
.no-scrollbar::-webkit-scrollbar {
|
|
112
|
+
display: none;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
/* Hide scrollbar for IE, Edge and Firefox */
|
|
116
|
+
.no-scrollbar {
|
|
117
|
+
-ms-overflow-style: none; /* IE and Edge */
|
|
118
|
+
scrollbar-width: none; /* Firefox */
|
|
119
|
+
}
|
|
120
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@schemavaults/theme",
|
|
3
|
+
"description": "TailwindCSS theme shared by different SchemaVaults applications",
|
|
4
|
+
"version": "0.22.14",
|
|
5
|
+
"private": false,
|
|
6
|
+
"license": "UNLICENSED",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "https://github.com/schemavaults/theme.git"
|
|
10
|
+
},
|
|
11
|
+
"peerDependencies": {
|
|
12
|
+
"react-dom": "19.0.0",
|
|
13
|
+
"react": "19.0.0"
|
|
14
|
+
},
|
|
15
|
+
"dependencies": {
|
|
16
|
+
"tailwindcss-animate": "1.0.7"
|
|
17
|
+
},
|
|
18
|
+
"devDependencies": {
|
|
19
|
+
"@types/react": "19.0.0",
|
|
20
|
+
"@types/react-dom": "19.0.0",
|
|
21
|
+
"tsc-alias": "1.8.16",
|
|
22
|
+
"bun-types": "1.2.22",
|
|
23
|
+
"typescript": "5.9.3",
|
|
24
|
+
"ignore-loader": "0.1.2",
|
|
25
|
+
"tailwindcss": "3.4.17"
|
|
26
|
+
},
|
|
27
|
+
"scripts": {
|
|
28
|
+
"build:js": "tsc --project tsconfig.json && tsc-alias --project tsconfig.json",
|
|
29
|
+
"build:clean_test_map_files": "find ./dist -name \"*.test.js.map\" -type f -delete",
|
|
30
|
+
"build:clean_test_js_files": "find ./dist -name \"*.test.js\" -type f -delete",
|
|
31
|
+
"build:clean_test_declarations_files": "find ./dist -name \"*.test.d.ts\" -type f -delete",
|
|
32
|
+
"build:cleanup": "bun run build:clean_test_map_files && bun run build:clean_test_js_files && bun run build:clean_test_declarations_files",
|
|
33
|
+
"prebuild": "bun run clean",
|
|
34
|
+
"build": "bun run build:js",
|
|
35
|
+
"postbuild": "bun run build:cleanup",
|
|
36
|
+
"clean": "rm -rf ./dist",
|
|
37
|
+
"test": "NODE_ENV=test bun test"
|
|
38
|
+
},
|
|
39
|
+
"exports": {
|
|
40
|
+
"./globals.css": {
|
|
41
|
+
"import": "./globals.css",
|
|
42
|
+
"require": "./globals.css",
|
|
43
|
+
"node": "./globals.css",
|
|
44
|
+
"default": "./globals.css"
|
|
45
|
+
},
|
|
46
|
+
"./dist/globals.css": {
|
|
47
|
+
"import": "./globals.css",
|
|
48
|
+
"require": "./globals.css",
|
|
49
|
+
"node": "./globals.css",
|
|
50
|
+
"default": "./globals.css"
|
|
51
|
+
},
|
|
52
|
+
"./ScreenBreakpoints": {
|
|
53
|
+
"types": "./dist/ScreenBreakpoints.d.ts",
|
|
54
|
+
"require": "./dist/ScreenBreakpoints.js",
|
|
55
|
+
"node": "./dist/ScreenBreakpoints.js",
|
|
56
|
+
"import": "./dist/ScreenBreakpoints.js"
|
|
57
|
+
},
|
|
58
|
+
".": {
|
|
59
|
+
"types": "./dist/index.d.ts",
|
|
60
|
+
"require": "./dist/index.js",
|
|
61
|
+
"node": "./dist/index.js",
|
|
62
|
+
"import": "./dist/index.js"
|
|
63
|
+
},
|
|
64
|
+
"./*": {
|
|
65
|
+
"types": "./dist/*",
|
|
66
|
+
"require": "./dist/*",
|
|
67
|
+
"import": "./dist/*",
|
|
68
|
+
"default": "./dist/*"
|
|
69
|
+
},
|
|
70
|
+
"./dist/*": {
|
|
71
|
+
"types": "./dist/*",
|
|
72
|
+
"require": "./dist/*",
|
|
73
|
+
"import": "./dist/*",
|
|
74
|
+
"default": "./dist/*"
|
|
75
|
+
}
|
|
76
|
+
},
|
|
77
|
+
"main": "./dist/index.js",
|
|
78
|
+
"module": "./dist/index.js",
|
|
79
|
+
"types": "./dist/index.d.ts",
|
|
80
|
+
"type": "module",
|
|
81
|
+
"publishConfig": {
|
|
82
|
+
"access": "public"
|
|
83
|
+
},
|
|
84
|
+
"packageManager": "bun@1.2.22"
|
|
85
|
+
}
|