@nuasite/cms-marker 0.0.64 → 0.0.65
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/dist/types/manifest-writer.d.ts +11 -2
- package/dist/types/manifest-writer.d.ts.map +1 -1
- package/dist/types/tailwind-colors.d.ts +6 -30
- package/dist/types/tailwind-colors.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/dist/types/types.d.ts +25 -5
- package/dist/types/types.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/manifest-writer.ts +27 -6
- package/src/tailwind-colors.ts +308 -118
- package/src/types.ts +27 -5
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { AvailableColors, CmsManifest, CollectionEntry, ComponentDefinition, ComponentInstance, ManifestEntry } from './types';
|
|
1
|
+
import type { AvailableColors, AvailableTextStyles, CmsManifest, CollectionEntry, ComponentDefinition, ComponentInstance, ManifestEntry } from './types';
|
|
2
2
|
/**
|
|
3
3
|
* Manages streaming manifest writes during build.
|
|
4
4
|
* Accumulates entries and writes per-page manifests as pages are processed.
|
|
@@ -10,6 +10,7 @@ export declare class ManifestWriter {
|
|
|
10
10
|
private manifestFile;
|
|
11
11
|
private componentDefinitions;
|
|
12
12
|
private availableColors;
|
|
13
|
+
private availableTextStyles;
|
|
13
14
|
private writeQueue;
|
|
14
15
|
constructor(manifestFile: string, componentDefinitions?: Record<string, ComponentDefinition>);
|
|
15
16
|
/**
|
|
@@ -21,13 +22,17 @@ export declare class ManifestWriter {
|
|
|
21
22
|
*/
|
|
22
23
|
setComponentDefinitions(definitions: Record<string, ComponentDefinition>): void;
|
|
23
24
|
/**
|
|
24
|
-
* Load available Tailwind colors from the project's CSS config
|
|
25
|
+
* Load available Tailwind colors and text styles from the project's CSS config
|
|
25
26
|
*/
|
|
26
27
|
loadAvailableColors(projectRoot?: string): Promise<void>;
|
|
27
28
|
/**
|
|
28
29
|
* Set available colors directly (for testing or custom colors)
|
|
29
30
|
*/
|
|
30
31
|
setAvailableColors(colors: AvailableColors): void;
|
|
32
|
+
/**
|
|
33
|
+
* Set available text styles directly (for testing or custom styles)
|
|
34
|
+
*/
|
|
35
|
+
setAvailableTextStyles(textStyles: AvailableTextStyles): void;
|
|
31
36
|
/**
|
|
32
37
|
* Get the manifest path for a given page
|
|
33
38
|
* Places manifest next to the page: /about -> /about.json, / -> /index.json
|
|
@@ -71,5 +76,9 @@ export declare class ManifestWriter {
|
|
|
71
76
|
* Get available colors (for use in dev middleware)
|
|
72
77
|
*/
|
|
73
78
|
getAvailableColors(): AvailableColors | undefined;
|
|
79
|
+
/**
|
|
80
|
+
* Get available text styles (for use in dev middleware)
|
|
81
|
+
*/
|
|
82
|
+
getAvailableTextStyles(): AvailableTextStyles | undefined;
|
|
74
83
|
}
|
|
75
84
|
//# sourceMappingURL=manifest-writer.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"manifest-writer.d.ts","sourceRoot":"","sources":["../../src/manifest-writer.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,eAAe,EAAE,WAAW,EAAE,eAAe,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,aAAa,EAAoB,MAAM,SAAS,CAAA;
|
|
1
|
+
{"version":3,"file":"manifest-writer.d.ts","sourceRoot":"","sources":["../../src/manifest-writer.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,eAAe,EAAE,mBAAmB,EAAE,WAAW,EAAE,eAAe,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,aAAa,EAAoB,MAAM,SAAS,CAAA;AAM1K;;;GAGG;AACH,qBAAa,cAAc;IAC1B,OAAO,CAAC,cAAc,CAAa;IACnC,OAAO,CAAC,aAAa,CAIP;IACd,OAAO,CAAC,MAAM,CAAa;IAC3B,OAAO,CAAC,YAAY,CAAQ;IAC5B,OAAO,CAAC,oBAAoB,CAAqC;IACjE,OAAO,CAAC,eAAe,CAA6B;IACpD,OAAO,CAAC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AI,IAAI;IAab;;OAEG;IACH,kBAAkB,IAAI,eAAe,GAAG,SAAS;IAIjD;;OAEG;IACH,sBAAsB,IAAI,mBAAmB,GAAG,SAAS;CAGzD"}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import type { AvailableColors, ColorClasses } from './types';
|
|
1
|
+
import type { AvailableColors, AvailableTextStyles, ColorClasses } from './types';
|
|
2
2
|
/**
|
|
3
3
|
* Default Tailwind CSS v4 color names.
|
|
4
|
-
* These are available by default in Tailwind v4.
|
|
5
4
|
*/
|
|
6
5
|
export declare const DEFAULT_TAILWIND_COLORS: readonly ["slate", "gray", "zinc", "neutral", "stone", "red", "orange", "amber", "yellow", "lime", "green", "emerald", "teal", "cyan", "sky", "blue", "indigo", "violet", "purple", "fuchsia", "pink", "rose"];
|
|
7
6
|
/**
|
|
@@ -13,19 +12,13 @@ export declare const STANDARD_SHADES: readonly ["50", "100", "200", "300", "400"
|
|
|
13
12
|
*/
|
|
14
13
|
export declare const SPECIAL_COLORS: readonly ["transparent", "current", "inherit", "white", "black"];
|
|
15
14
|
/**
|
|
16
|
-
* Parse Tailwind v4 CSS config to extract available colors.
|
|
17
|
-
* Tailwind v4 uses CSS-based configuration with @theme directive.
|
|
18
|
-
*
|
|
19
|
-
* Example CSS:
|
|
20
|
-
* ```css
|
|
21
|
-
* @theme {
|
|
22
|
-
* --color-primary-50: #eff6ff;
|
|
23
|
-
* --color-primary-500: #3b82f6;
|
|
24
|
-
* --color-accent: #f59e0b;
|
|
25
|
-
* }
|
|
26
|
-
* ```
|
|
15
|
+
* Parse Tailwind v4 CSS config to extract available colors with their values.
|
|
27
16
|
*/
|
|
28
17
|
export declare function parseTailwindConfig(projectRoot?: string): Promise<AvailableColors>;
|
|
18
|
+
/**
|
|
19
|
+
* Parse Tailwind v4 CSS config to extract available text styles.
|
|
20
|
+
*/
|
|
21
|
+
export declare function parseTextStyles(projectRoot?: string): Promise<AvailableTextStyles>;
|
|
29
22
|
/**
|
|
30
23
|
* Extract color classes from an element's class attribute.
|
|
31
24
|
*/
|
|
@@ -36,22 +29,14 @@ export declare function extractColorClasses(classAttr: string | null | undefined
|
|
|
36
29
|
export declare function isColorClass(className: string): boolean;
|
|
37
30
|
/**
|
|
38
31
|
* Generate a new class string with a color class replaced.
|
|
39
|
-
* @param currentClasses - Current class attribute value
|
|
40
|
-
* @param oldColorClass - The color class to replace (e.g., 'bg-blue-500')
|
|
41
|
-
* @param newColorClass - The new color class (e.g., 'bg-red-500')
|
|
42
|
-
* @returns New class string with the replacement
|
|
43
32
|
*/
|
|
44
33
|
export declare function replaceColorClass(currentClasses: string, oldColorClass: string, newColorClass: string): string;
|
|
45
34
|
/**
|
|
46
35
|
* Get the color type from a color class.
|
|
47
|
-
* @param colorClass - e.g., 'bg-blue-500', 'text-white', 'hover:bg-red-600'
|
|
48
|
-
* @returns The type: 'bg', 'text', 'border', 'hoverBg', 'hoverText', or undefined
|
|
49
36
|
*/
|
|
50
37
|
export declare function getColorType(colorClass: string): keyof ColorClasses | undefined;
|
|
51
38
|
/**
|
|
52
39
|
* Parse a color class into its components.
|
|
53
|
-
* @param colorClass - e.g., 'bg-blue-500', 'text-white', 'hover:bg-red-600'
|
|
54
|
-
* @returns Object with prefix, colorName, and shade (if any)
|
|
55
40
|
*/
|
|
56
41
|
export declare function parseColorClass(colorClass: string): {
|
|
57
42
|
prefix: string;
|
|
@@ -63,13 +48,4 @@ export declare function parseColorClass(colorClass: string): {
|
|
|
63
48
|
* Build a color class from components.
|
|
64
49
|
*/
|
|
65
50
|
export declare function buildColorClass(prefix: string, colorName: string, shade?: string): string;
|
|
66
|
-
/**
|
|
67
|
-
* Generate a hidden HTML string containing all color classes for Tailwind safelist.
|
|
68
|
-
* This ensures Tailwind includes all color utility classes during build,
|
|
69
|
-
* even if they're only used dynamically via the CMS color editor.
|
|
70
|
-
*
|
|
71
|
-
* @param availableColors - The available colors from Tailwind config
|
|
72
|
-
* @returns HTML string with a hidden div containing all color classes
|
|
73
|
-
*/
|
|
74
|
-
export declare function generateColorSafelistHtml(availableColors: AvailableColors): string;
|
|
75
51
|
//# sourceMappingURL=tailwind-colors.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tailwind-colors.d.ts","sourceRoot":"","sources":["../../src/tailwind-colors.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,eAAe,EAAE,YAAY,
|
|
1
|
+
{"version":3,"file":"tailwind-colors.d.ts","sourceRoot":"","sources":["../../src/tailwind-colors.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,eAAe,EAAE,mBAAmB,EAAE,YAAY,EAAiC,MAAM,SAAS,CAAA;AAEhH;;GAEG;AACH,eAAO,MAAM,uBAAuB,gNAuB1B,CAAA;AAEV;;GAEG;AACH,eAAO,MAAM,eAAe,uFAAwF,CAAA;AAEpH;;GAEG;AACH,eAAO,MAAM,cAAc,kEAAmE,CAAA;AAkL9F;;GAEG;AACH,wBAAsB,mBAAmB,CAAC,WAAW,GAAE,MAAsB,GAAG,OAAO,CAAC,eAAe,CAAC,CA+CvG;AAuDD;;GAEG;AACH,wBAAsB,eAAe,CAAC,WAAW,GAAE,MAAsB,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAoCvG;AAgGD;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,YAAY,GAAG,SAAS,CA0BlG;AAED;;GAEG;AACH,wBAAgB,YAAY,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAEvD;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAChC,cAAc,EAAE,MAAM,EACtB,aAAa,EAAE,MAAM,EACrB,aAAa,EAAE,MAAM,GACnB,MAAM,CAIR;AAED;;GAEG;AACH,wBAAgB,YAAY,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,YAAY,GAAG,SAAS,CAO/E;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,UAAU,EAAE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