|
1 | 1 | import type { Config as TailwindConfig } from "tailwindcss"; |
2 | | -import * as tailwindAnimatePlugin from "tailwindcss-animate"; |
3 | 2 | import { componentColors } from "./component_colors"; |
4 | 3 | import { brandColors } from "./brand_colors"; |
5 | 4 | import DefaultOrgScope from "./DefaultOrgScope"; // @schemavaults organization is default |
6 | 5 | import { |
7 | 6 | getScreenBreakpoint, |
8 | 7 | listScreenBreakpoints, |
9 | | - ScreenBreakpointID, |
| 8 | + type ScreenBreakpointID, |
10 | 9 | } from "./ScreenBreakpoints"; |
11 | 10 | import type { TailwindTheme } from "./TailwindTheme"; |
12 | 11 | type OsJoinFn = ( |
13 | 12 | path_segment: string, |
14 | 13 | ...remaining_path_segments: string[] |
15 | 14 | ) => string; |
16 | 15 |
|
| 16 | +// TailwindCSS Plugins: |
| 17 | +import tailwindAnimatePlugin from "@/plugins/tailwindcss-animate"; |
| 18 | + |
17 | 19 | export interface ISchemaVaultsTailwindConfigFactoryInitOptions { |
18 | 20 | debug?: boolean; |
19 | 21 | join: OsJoinFn; |
@@ -95,6 +97,11 @@ export class SchemaVaultsTailwindConfigFactory |
95 | 97 | } |
96 | 98 | } |
97 | 99 |
|
| 100 | + /** |
| 101 | + * @description Load TailwindCSS plugins to use in theme configuration |
| 102 | + * @returns Array of TailwindCSS plugins |
| 103 | + * @see /plugins directory |
| 104 | + */ |
98 | 105 | protected get plugins(): TailwindConfig["plugins"] { |
99 | 106 | return [tailwindAnimatePlugin]; |
100 | 107 | } |
@@ -167,6 +174,15 @@ export class SchemaVaultsTailwindConfigFactory |
167 | 174 |
|
168 | 175 | const pkg_blob_parts = pkg_blob_string.split("/"); |
169 | 176 |
|
| 177 | + if ( |
| 178 | + pkg_blob_parts.length < 2 || |
| 179 | + !pkg_blob_parts[1] || |
| 180 | + typeof pkg_blob_parts[1] !== "string" |
| 181 | + ) { |
| 182 | + throw new TypeError( |
| 183 | + "Failed to resolve package name from package blob string", |
| 184 | + ); |
| 185 | + } |
170 | 186 | const package_name: string = pkg_blob_parts[1]; |
171 | 187 |
|
172 | 188 | const join: OsJoinFn = this.join; |
|
0 commit comments