tailwind-styled-v4 5.0.36 → 5.0.37
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/analyzer.d.mts +152 -5
- package/dist/analyzer.d.ts +152 -5
- package/dist/animate.d.mts +30 -3
- package/dist/animate.d.ts +30 -3
- package/dist/compiler.d.mts +5 -0
- package/dist/compiler.d.ts +5 -0
- package/dist/compiler.js.map +1 -1
- package/dist/compiler.mjs.map +1 -1
- package/dist/devtools.d.mts +88 -2
- package/dist/devtools.d.ts +88 -2
- package/dist/engine.d.mts +557 -6
- package/dist/engine.d.ts +557 -6
- package/dist/engine.js.map +1 -1
- package/dist/engine.mjs.map +1 -1
- package/dist/index.d.mts +236 -9
- package/dist/index.d.ts +236 -9
- package/dist/index.js.map +1 -1
- package/dist/index.mjs.map +1 -1
- package/dist/next.js.map +1 -1
- package/dist/next.mjs.map +1 -1
- package/dist/plugin-api.d.mts +4 -2
- package/dist/plugin-api.d.ts +4 -2
- package/dist/plugin-registry.js +39 -25
- package/dist/plugin-registry.js.map +1 -1
- package/dist/plugin-registry.mjs +39 -25
- package/dist/plugin-registry.mjs.map +1 -1
- package/dist/plugin.d.mts +165 -5
- package/dist/plugin.d.ts +165 -5
- package/dist/plugin.js +17 -0
- package/dist/plugin.js.map +1 -1
- package/dist/plugin.mjs +15 -1
- package/dist/plugin.mjs.map +1 -1
- package/dist/runtime.d.mts +38 -3
- package/dist/runtime.d.ts +38 -3
- package/dist/scanner.d.mts +58 -4
- package/dist/scanner.d.ts +58 -4
- package/dist/shared.d.mts +185 -3
- package/dist/shared.d.ts +185 -3
- package/dist/shared.js.map +1 -1
- package/dist/shared.mjs.map +1 -1
- package/dist/storybook-addon.d.mts +2 -2
- package/dist/storybook-addon.d.ts +2 -2
- package/dist/svelte.d.mts +2 -1
- package/dist/svelte.d.ts +2 -1
- package/dist/theme.d.mts +38 -3
- package/dist/theme.d.ts +38 -3
- package/dist/turbopackLoader.js.map +1 -1
- package/dist/turbopackLoader.mjs.map +1 -1
- package/dist/vite.js.map +1 -1
- package/dist/vite.mjs.map +1 -1
- package/dist/vue.d.mts +4 -1
- package/dist/vue.d.ts +4 -1
- package/native/tailwind-styled-native.linux-x64-gnu.node +0 -0
- package/native/tailwind-styled-native.node +0 -0
- package/package.json +1 -1
- package/dist/analyzeWorkspace-B1_XRfdl.d.ts +0 -134
- package/dist/analyzeWorkspace-hYfu4Hg3.d.mts +0 -134
- package/dist/index-DQI6O24n.d.mts +0 -464
- package/dist/index-NDINUhLN.d.mts +0 -90
- package/dist/index-NDINUhLN.d.ts +0 -90
- package/dist/index-UkYbyBkR.d.ts +0 -464
- package/dist/liveTokenEngine-CN9ian1R.d.ts +0 -38
- package/dist/liveTokenEngine-DKoWRtqH.d.mts +0 -38
- package/dist/schemas-DR-SLxZZ.d.mts +0 -59
- package/dist/schemas-DR-SLxZZ.d.ts +0 -59
- package/dist/trace-Dz4vmZdy.d.mts +0 -96
- package/dist/trace-Dz4vmZdy.d.ts +0 -96
- package/dist/types-DXr2PmGP.d.mts +0 -31
- package/dist/types-DXr2PmGP.d.ts +0 -31
package/dist/index.d.mts
CHANGED
|
@@ -1,12 +1,27 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
|
|
4
|
+
type CSSFillMode = "none" | "forwards" | "backwards" | "both";
|
|
5
|
+
type CSSDirection = "normal" | "reverse" | "alternate" | "alternate-reverse";
|
|
6
|
+
type CSSIterationCount = number | "infinite";
|
|
7
|
+
type PresetEasing = "linear" | "ease" | "ease-in" | "ease-out" | "ease-in-out" | "step-start" | "step-end";
|
|
8
|
+
type CubicBezierEasing = `cubic-bezier(${string})`;
|
|
9
|
+
type StepsEasing = `steps(${string})`;
|
|
10
|
+
type CSSEasing = PresetEasing | CubicBezierEasing | StepsEasing;
|
|
11
|
+
interface AnimateOptions {
|
|
12
|
+
from: string;
|
|
13
|
+
to: string;
|
|
14
|
+
duration?: number;
|
|
15
|
+
easing?: CSSEasing;
|
|
16
|
+
delay?: number;
|
|
17
|
+
fill?: CSSFillMode;
|
|
18
|
+
iterations?: CSSIterationCount;
|
|
19
|
+
direction?: CSSDirection;
|
|
20
|
+
name?: string;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
type TokenMap = Record<string, string>;
|
|
24
|
+
type HtmlTagName = keyof HTMLElementTagNameMap;
|
|
10
25
|
|
|
11
26
|
/**
|
|
12
27
|
* tailwind-styled-v4 — Core Types
|
|
@@ -301,6 +316,40 @@ declare function cx(...inputs: (ClassValue | ClassValue[])[]): string;
|
|
|
301
316
|
/** @deprecated Use cx() instead. */
|
|
302
317
|
declare const cxm: typeof cx;
|
|
303
318
|
|
|
319
|
+
type TokenSubscriber = (tokens: TokenMap) => void;
|
|
320
|
+
interface LiveTokenSet {
|
|
321
|
+
vars: Record<string, string>;
|
|
322
|
+
get(name: string): string | undefined;
|
|
323
|
+
set(name: string, value: string): void;
|
|
324
|
+
setAll(tokens: TokenMap): void;
|
|
325
|
+
snapshot(): TokenMap;
|
|
326
|
+
}
|
|
327
|
+
interface LiveTokenEngineBridge {
|
|
328
|
+
getToken(name: string): string | undefined;
|
|
329
|
+
getTokens(): TokenMap;
|
|
330
|
+
setToken(name: string, value: string): void;
|
|
331
|
+
setTokens(tokens: TokenMap): void;
|
|
332
|
+
applyTokenSet(tokens: TokenMap): void;
|
|
333
|
+
subscribeTokens(fn: TokenSubscriber): () => void;
|
|
334
|
+
subscribe?(fn: TokenSubscriber): () => void;
|
|
335
|
+
}
|
|
336
|
+
declare function tokenVar(name: string): string;
|
|
337
|
+
declare function tokenRef(name: string): string;
|
|
338
|
+
declare function liveToken(tokens: TokenMap): LiveTokenSet;
|
|
339
|
+
declare function setToken(name: string, value: string): void;
|
|
340
|
+
declare function setTokens(tokens: TokenMap): void;
|
|
341
|
+
declare function applyTokenSet(tokens: TokenMap): void;
|
|
342
|
+
declare function getToken(name: string): string | undefined;
|
|
343
|
+
declare function getTokens(): TokenMap;
|
|
344
|
+
declare function subscribeTokens(fn: TokenSubscriber): () => void;
|
|
345
|
+
declare function generateTokenCssString(): string;
|
|
346
|
+
declare function createUseTokens(): () => TokenMap;
|
|
347
|
+
declare global {
|
|
348
|
+
interface Window {
|
|
349
|
+
__TW_TOKEN_ENGINE__?: LiveTokenEngineBridge;
|
|
350
|
+
}
|
|
351
|
+
}
|
|
352
|
+
|
|
304
353
|
interface ThemeConfig$1 {
|
|
305
354
|
colors: Record<string, string>;
|
|
306
355
|
spacing: Record<string, string>;
|
|
@@ -675,4 +724,182 @@ declare const v4Tokens: {
|
|
|
675
724
|
readonly fontMono: string;
|
|
676
725
|
};
|
|
677
726
|
|
|
678
|
-
|
|
727
|
+
declare const ScanWorkspaceOptionsSchema: z.ZodObject<{
|
|
728
|
+
includeExtensions: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
729
|
+
ignoreDirectories: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
730
|
+
useCache: z.ZodOptional<z.ZodBoolean>;
|
|
731
|
+
cacheDir: z.ZodOptional<z.ZodString>;
|
|
732
|
+
smartInvalidation: z.ZodOptional<z.ZodBoolean>;
|
|
733
|
+
}, z.core.$strip>;
|
|
734
|
+
type ScanWorkspaceOptions = z.infer<typeof ScanWorkspaceOptionsSchema>;
|
|
735
|
+
declare const ScanWorkspaceResultSchema: z.ZodObject<{
|
|
736
|
+
files: z.ZodArray<z.ZodObject<{
|
|
737
|
+
file: z.ZodString;
|
|
738
|
+
classes: z.ZodArray<z.ZodString>;
|
|
739
|
+
hash: z.ZodOptional<z.ZodString>;
|
|
740
|
+
}, z.core.$strip>>;
|
|
741
|
+
totalFiles: z.ZodNumber;
|
|
742
|
+
uniqueClasses: z.ZodArray<z.ZodString>;
|
|
743
|
+
}, z.core.$strip>;
|
|
744
|
+
type ScanWorkspaceResult = z.infer<typeof ScanWorkspaceResultSchema>;
|
|
745
|
+
|
|
746
|
+
/**
|
|
747
|
+
* Public type contracts for @tailwind-styled/analyzer.
|
|
748
|
+
* Keep this file aligned with the runtime report shape exposed by src/index.ts.
|
|
749
|
+
*/
|
|
750
|
+
|
|
751
|
+
interface ClassUsage {
|
|
752
|
+
readonly name: string;
|
|
753
|
+
readonly count: number;
|
|
754
|
+
readonly isUnused?: boolean;
|
|
755
|
+
readonly isConflict?: boolean;
|
|
756
|
+
}
|
|
757
|
+
interface ClassConflict {
|
|
758
|
+
readonly className: string;
|
|
759
|
+
readonly variants: readonly string[];
|
|
760
|
+
readonly classes: readonly string[];
|
|
761
|
+
readonly message: string;
|
|
762
|
+
}
|
|
763
|
+
interface AnalyzerClassStats {
|
|
764
|
+
readonly all: readonly ClassUsage[];
|
|
765
|
+
readonly top: readonly ClassUsage[];
|
|
766
|
+
readonly frequent: readonly ClassUsage[];
|
|
767
|
+
readonly unique: readonly ClassUsage[];
|
|
768
|
+
readonly distribution: Readonly<Record<string, number>>;
|
|
769
|
+
}
|
|
770
|
+
interface TailwindConfigSummary {
|
|
771
|
+
readonly path: string;
|
|
772
|
+
readonly loaded: boolean;
|
|
773
|
+
readonly safelistCount: number;
|
|
774
|
+
readonly customUtilityCount: number;
|
|
775
|
+
readonly warning?: string;
|
|
776
|
+
}
|
|
777
|
+
interface AnalyzerSemanticReport {
|
|
778
|
+
readonly unusedClasses: readonly ClassUsage[];
|
|
779
|
+
readonly unknownClasses: readonly ClassUsage[];
|
|
780
|
+
readonly conflicts: readonly ClassConflict[];
|
|
781
|
+
readonly tailwindConfig?: TailwindConfigSummary;
|
|
782
|
+
}
|
|
783
|
+
interface AnalyzerReport {
|
|
784
|
+
readonly root: string;
|
|
785
|
+
readonly totalFiles: number;
|
|
786
|
+
readonly uniqueClassCount: number;
|
|
787
|
+
readonly totalClassOccurrences: number;
|
|
788
|
+
readonly classStats: AnalyzerClassStats;
|
|
789
|
+
/** Alias for classStats.top — backward compat & test contract */
|
|
790
|
+
readonly topClasses: readonly ClassUsage[];
|
|
791
|
+
readonly safelist: readonly string[];
|
|
792
|
+
readonly semantic?: AnalyzerSemanticReport;
|
|
793
|
+
}
|
|
794
|
+
interface AnalyzerOptions {
|
|
795
|
+
readonly scanner?: ScanWorkspaceOptions;
|
|
796
|
+
readonly classStats?: {
|
|
797
|
+
readonly top?: number;
|
|
798
|
+
readonly frequentThreshold?: number;
|
|
799
|
+
};
|
|
800
|
+
readonly includeClass?: (className: string) => boolean;
|
|
801
|
+
readonly semantic?: boolean | {
|
|
802
|
+
readonly tailwindConfigPath?: string;
|
|
803
|
+
};
|
|
804
|
+
}
|
|
805
|
+
|
|
806
|
+
/**
|
|
807
|
+
* Analyze Tailwind class usage in a workspace and return usage statistics.
|
|
808
|
+
* Set `semantic.tailwindConfigPath` to override Tailwind config lookup.
|
|
809
|
+
* @example
|
|
810
|
+
* const report = await analyzeWorkspace("./src", {
|
|
811
|
+
* classStats: { top: 20, frequentThreshold: 2 },
|
|
812
|
+
* semantic: { tailwindConfigPath: "tailwind.config.js" },
|
|
813
|
+
* })
|
|
814
|
+
*/
|
|
815
|
+
declare function analyzeWorkspace(root: string, options?: AnalyzerOptions): Promise<AnalyzerReport>;
|
|
816
|
+
|
|
817
|
+
interface EngineMetricsSnapshot {
|
|
818
|
+
eventsReceived: number;
|
|
819
|
+
eventsProcessed: number;
|
|
820
|
+
batchesProcessed: number;
|
|
821
|
+
incrementalUpdates: number;
|
|
822
|
+
fullRescans: number;
|
|
823
|
+
skippedLargeFiles: number;
|
|
824
|
+
queueMaxSize: number;
|
|
825
|
+
lastBuildMs: number;
|
|
826
|
+
avgBuildMs: number;
|
|
827
|
+
}
|
|
828
|
+
|
|
829
|
+
interface EnginePluginContext {
|
|
830
|
+
root: string;
|
|
831
|
+
timestamp: number;
|
|
832
|
+
}
|
|
833
|
+
interface EngineWatchContext {
|
|
834
|
+
root: string;
|
|
835
|
+
timestamp: number;
|
|
836
|
+
}
|
|
837
|
+
interface EnginePlugin {
|
|
838
|
+
name: string;
|
|
839
|
+
beforeScan?(context: EnginePluginContext): void | Promise<void>;
|
|
840
|
+
afterScan?(scan: ScanWorkspaceResult, context: EnginePluginContext): ScanWorkspaceResult | undefined | Promise<ScanWorkspaceResult | undefined>;
|
|
841
|
+
transformClasses?(classes: string[], context: EnginePluginContext): string[] | undefined | Promise<string[] | undefined>;
|
|
842
|
+
beforeBuild?(scan: ScanWorkspaceResult, context: EnginePluginContext): void | Promise<void>;
|
|
843
|
+
afterBuild?(result: BuildResult, context: EnginePluginContext): BuildResult | undefined | Promise<BuildResult | undefined>;
|
|
844
|
+
onError?(error: Error, context: EnginePluginContext): void | Promise<void>;
|
|
845
|
+
beforeWatch?(context: EngineWatchContext): void | Promise<void>;
|
|
846
|
+
afterWatch?(context: EngineWatchContext): void | Promise<void>;
|
|
847
|
+
}
|
|
848
|
+
|
|
849
|
+
interface EngineOptions {
|
|
850
|
+
root?: string;
|
|
851
|
+
scanner?: ScanWorkspaceOptions;
|
|
852
|
+
compileCss?: boolean;
|
|
853
|
+
tailwindConfigPath?: string;
|
|
854
|
+
plugins?: EnginePlugin[];
|
|
855
|
+
/** Enable analyzer integration - provides semantic report (unused classes, conflicts). Default: false */
|
|
856
|
+
analyze?: boolean;
|
|
857
|
+
}
|
|
858
|
+
interface EngineWatchOptions {
|
|
859
|
+
debounceMs?: number;
|
|
860
|
+
maxEventsPerFlush?: number;
|
|
861
|
+
largeFileThreshold?: number;
|
|
862
|
+
}
|
|
863
|
+
interface BuildResult {
|
|
864
|
+
scan: ScanWorkspaceResult;
|
|
865
|
+
mergedClassList: string;
|
|
866
|
+
css: string;
|
|
867
|
+
/** Analyzer semantic report - present when analyze: true in options */
|
|
868
|
+
analysis?: {
|
|
869
|
+
unusedClasses: string[];
|
|
870
|
+
classConflicts: Array<{
|
|
871
|
+
className: string;
|
|
872
|
+
files: string[];
|
|
873
|
+
classes?: string[];
|
|
874
|
+
message?: string;
|
|
875
|
+
}>;
|
|
876
|
+
classUsage: Record<string, number>;
|
|
877
|
+
semantic?: AnalyzerSemanticReport;
|
|
878
|
+
report: AnalyzerReport;
|
|
879
|
+
};
|
|
880
|
+
}
|
|
881
|
+
type EngineBuildWatchEventType = "initial" | "change" | "unlink" | "full-rescan";
|
|
882
|
+
type EngineWatchEvent = {
|
|
883
|
+
type: EngineBuildWatchEventType;
|
|
884
|
+
filePath?: string;
|
|
885
|
+
result: BuildResult;
|
|
886
|
+
metrics?: EngineMetricsSnapshot;
|
|
887
|
+
} | {
|
|
888
|
+
type: "error";
|
|
889
|
+
filePath?: string;
|
|
890
|
+
error: string;
|
|
891
|
+
metrics?: EngineMetricsSnapshot;
|
|
892
|
+
};
|
|
893
|
+
interface TailwindStyledEngine {
|
|
894
|
+
scan(): Promise<ScanWorkspaceResult>;
|
|
895
|
+
scanWorkspace(): Promise<ScanWorkspaceResult>;
|
|
896
|
+
analyzeWorkspace(): Promise<Awaited<ReturnType<typeof analyzeWorkspace>>>;
|
|
897
|
+
generateSafelist(): Promise<string[]>;
|
|
898
|
+
build(): Promise<BuildResult>;
|
|
899
|
+
watch(onEvent: (event: EngineWatchEvent) => void, options?: EngineWatchOptions): Promise<{
|
|
900
|
+
close(): void;
|
|
901
|
+
}>;
|
|
902
|
+
}
|
|
903
|
+
declare function createEngine(rawOptions?: EngineOptions): Promise<TailwindStyledEngine>;
|
|
904
|
+
|
|
905
|
+
export { type ComponentConfig, type ContainerConfig, type ContainerEntry, type CvFn, type HtmlTagName, type InferVariantProps, type LiveTokenSet, type MergeOptions, type ParsedClass, type ParsedClassModifier, type ResolvedThemeTokens, type StateComponentEntry, type StateConfig, type StyledComponentProps, type StyledOptions, type StyledProps, type StyledSystemConfig, type StyledSystemInstance, type SubComponentEntry, type SubComponentMap, type SubComponentProps, type SystemComponentConfig, type SystemComponentFactory, type SystemTokenMap, type ThemeConfig, type ThemeTokenMap, type TokenMap, type TokenSubscriber, type TwComponentFactory, type TwObject, type TwStyledComponent, type TwSubComponent, type TwTagFactory, type TwTagFactoryAny, type VariantLiterals, applyTokenSet, cn, tokenRef as containerRef, createComponent, createEngine, createStyledSystem, createTheme, createTwMerge, createUseTokens, cssVar, cv, cx, cxm, generateContainerCss, generateStateCss, generateTokenCssString, getAllSubComponents, getContainerRegistry, getStateRegistry, getSubComponent, getToken, getTokens, liveToken, mergeWithRules, processContainer, processState, registerSubComponent, resolveStyledClassName, server, setToken, setTokens, styled, subscribeTokens, t, tokenRef, tokenVar, tw, twMerge, twVar, v4Tokens, withSubComponents };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,12 +1,27 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
|
|
4
|
+
type CSSFillMode = "none" | "forwards" | "backwards" | "both";
|
|
5
|
+
type CSSDirection = "normal" | "reverse" | "alternate" | "alternate-reverse";
|
|
6
|
+
type CSSIterationCount = number | "infinite";
|
|
7
|
+
type PresetEasing = "linear" | "ease" | "ease-in" | "ease-out" | "ease-in-out" | "step-start" | "step-end";
|
|
8
|
+
type CubicBezierEasing = `cubic-bezier(${string})`;
|
|
9
|
+
type StepsEasing = `steps(${string})`;
|
|
10
|
+
type CSSEasing = PresetEasing | CubicBezierEasing | StepsEasing;
|
|
11
|
+
interface AnimateOptions {
|
|
12
|
+
from: string;
|
|
13
|
+
to: string;
|
|
14
|
+
duration?: number;
|
|
15
|
+
easing?: CSSEasing;
|
|
16
|
+
delay?: number;
|
|
17
|
+
fill?: CSSFillMode;
|
|
18
|
+
iterations?: CSSIterationCount;
|
|
19
|
+
direction?: CSSDirection;
|
|
20
|
+
name?: string;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
type TokenMap = Record<string, string>;
|
|
24
|
+
type HtmlTagName = keyof HTMLElementTagNameMap;
|
|
10
25
|
|
|
11
26
|
/**
|
|
12
27
|
* tailwind-styled-v4 — Core Types
|
|
@@ -301,6 +316,40 @@ declare function cx(...inputs: (ClassValue | ClassValue[])[]): string;
|
|
|
301
316
|
/** @deprecated Use cx() instead. */
|
|
302
317
|
declare const cxm: typeof cx;
|
|
303
318
|
|
|
319
|
+
type TokenSubscriber = (tokens: TokenMap) => void;
|
|
320
|
+
interface LiveTokenSet {
|
|
321
|
+
vars: Record<string, string>;
|
|
322
|
+
get(name: string): string | undefined;
|
|
323
|
+
set(name: string, value: string): void;
|
|
324
|
+
setAll(tokens: TokenMap): void;
|
|
325
|
+
snapshot(): TokenMap;
|
|
326
|
+
}
|
|
327
|
+
interface LiveTokenEngineBridge {
|
|
328
|
+
getToken(name: string): string | undefined;
|
|
329
|
+
getTokens(): TokenMap;
|
|
330
|
+
setToken(name: string, value: string): void;
|
|
331
|
+
setTokens(tokens: TokenMap): void;
|
|
332
|
+
applyTokenSet(tokens: TokenMap): void;
|
|
333
|
+
subscribeTokens(fn: TokenSubscriber): () => void;
|
|
334
|
+
subscribe?(fn: TokenSubscriber): () => void;
|
|
335
|
+
}
|
|
336
|
+
declare function tokenVar(name: string): string;
|
|
337
|
+
declare function tokenRef(name: string): string;
|
|
338
|
+
declare function liveToken(tokens: TokenMap): LiveTokenSet;
|
|
339
|
+
declare function setToken(name: string, value: string): void;
|
|
340
|
+
declare function setTokens(tokens: TokenMap): void;
|
|
341
|
+
declare function applyTokenSet(tokens: TokenMap): void;
|
|
342
|
+
declare function getToken(name: string): string | undefined;
|
|
343
|
+
declare function getTokens(): TokenMap;
|
|
344
|
+
declare function subscribeTokens(fn: TokenSubscriber): () => void;
|
|
345
|
+
declare function generateTokenCssString(): string;
|
|
346
|
+
declare function createUseTokens(): () => TokenMap;
|
|
347
|
+
declare global {
|
|
348
|
+
interface Window {
|
|
349
|
+
__TW_TOKEN_ENGINE__?: LiveTokenEngineBridge;
|
|
350
|
+
}
|
|
351
|
+
}
|
|
352
|
+
|
|
304
353
|
interface ThemeConfig$1 {
|
|
305
354
|
colors: Record<string, string>;
|
|
306
355
|
spacing: Record<string, string>;
|
|
@@ -675,4 +724,182 @@ declare const v4Tokens: {
|
|
|
675
724
|
readonly fontMono: string;
|
|
676
725
|
};
|
|
677
726
|
|
|
678
|
-
|
|
727
|
+
declare const ScanWorkspaceOptionsSchema: z.ZodObject<{
|
|
728
|
+
includeExtensions: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
729
|
+
ignoreDirectories: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
730
|
+
useCache: z.ZodOptional<z.ZodBoolean>;
|
|
731
|
+
cacheDir: z.ZodOptional<z.ZodString>;
|
|
732
|
+
smartInvalidation: z.ZodOptional<z.ZodBoolean>;
|
|
733
|
+
}, z.core.$strip>;
|
|
734
|
+
type ScanWorkspaceOptions = z.infer<typeof ScanWorkspaceOptionsSchema>;
|
|
735
|
+
declare const ScanWorkspaceResultSchema: z.ZodObject<{
|
|
736
|
+
files: z.ZodArray<z.ZodObject<{
|
|
737
|
+
file: z.ZodString;
|
|
738
|
+
classes: z.ZodArray<z.ZodString>;
|
|
739
|
+
hash: z.ZodOptional<z.ZodString>;
|
|
740
|
+
}, z.core.$strip>>;
|
|
741
|
+
totalFiles: z.ZodNumber;
|
|
742
|
+
uniqueClasses: z.ZodArray<z.ZodString>;
|
|
743
|
+
}, z.core.$strip>;
|
|
744
|
+
type ScanWorkspaceResult = z.infer<typeof ScanWorkspaceResultSchema>;
|
|
745
|
+
|
|
746
|
+
/**
|
|
747
|
+
* Public type contracts for @tailwind-styled/analyzer.
|
|
748
|
+
* Keep this file aligned with the runtime report shape exposed by src/index.ts.
|
|
749
|
+
*/
|
|
750
|
+
|
|
751
|
+
interface ClassUsage {
|
|
752
|
+
readonly name: string;
|
|
753
|
+
readonly count: number;
|
|
754
|
+
readonly isUnused?: boolean;
|
|
755
|
+
readonly isConflict?: boolean;
|
|
756
|
+
}
|
|
757
|
+
interface ClassConflict {
|
|
758
|
+
readonly className: string;
|
|
759
|
+
readonly variants: readonly string[];
|
|
760
|
+
readonly classes: readonly string[];
|
|
761
|
+
readonly message: string;
|
|
762
|
+
}
|
|
763
|
+
interface AnalyzerClassStats {
|
|
764
|
+
readonly all: readonly ClassUsage[];
|
|
765
|
+
readonly top: readonly ClassUsage[];
|
|
766
|
+
readonly frequent: readonly ClassUsage[];
|
|
767
|
+
readonly unique: readonly ClassUsage[];
|
|
768
|
+
readonly distribution: Readonly<Record<string, number>>;
|
|
769
|
+
}
|
|
770
|
+
interface TailwindConfigSummary {
|
|
771
|
+
readonly path: string;
|
|
772
|
+
readonly loaded: boolean;
|
|
773
|
+
readonly safelistCount: number;
|
|
774
|
+
readonly customUtilityCount: number;
|
|
775
|
+
readonly warning?: string;
|
|
776
|
+
}
|
|
777
|
+
interface AnalyzerSemanticReport {
|
|
778
|
+
readonly unusedClasses: readonly ClassUsage[];
|
|
779
|
+
readonly unknownClasses: readonly ClassUsage[];
|
|
780
|
+
readonly conflicts: readonly ClassConflict[];
|
|
781
|
+
readonly tailwindConfig?: TailwindConfigSummary;
|
|
782
|
+
}
|
|
783
|
+
interface AnalyzerReport {
|
|
784
|
+
readonly root: string;
|
|
785
|
+
readonly totalFiles: number;
|
|
786
|
+
readonly uniqueClassCount: number;
|
|
787
|
+
readonly totalClassOccurrences: number;
|
|
788
|
+
readonly classStats: AnalyzerClassStats;
|
|
789
|
+
/** Alias for classStats.top — backward compat & test contract */
|
|
790
|
+
readonly topClasses: readonly ClassUsage[];
|
|
791
|
+
readonly safelist: readonly string[];
|
|
792
|
+
readonly semantic?: AnalyzerSemanticReport;
|
|
793
|
+
}
|
|
794
|
+
interface AnalyzerOptions {
|
|
795
|
+
readonly scanner?: ScanWorkspaceOptions;
|
|
796
|
+
readonly classStats?: {
|
|
797
|
+
readonly top?: number;
|
|
798
|
+
readonly frequentThreshold?: number;
|
|
799
|
+
};
|
|
800
|
+
readonly includeClass?: (className: string) => boolean;
|
|
801
|
+
readonly semantic?: boolean | {
|
|
802
|
+
readonly tailwindConfigPath?: string;
|
|
803
|
+
};
|
|
804
|
+
}
|
|
805
|
+
|
|
806
|
+
/**
|
|
807
|
+
* Analyze Tailwind class usage in a workspace and return usage statistics.
|
|
808
|
+
* Set `semantic.tailwindConfigPath` to override Tailwind config lookup.
|
|
809
|
+
* @example
|
|
810
|
+
* const report = await analyzeWorkspace("./src", {
|
|
811
|
+
* classStats: { top: 20, frequentThreshold: 2 },
|
|
812
|
+
* semantic: { tailwindConfigPath: "tailwind.config.js" },
|
|
813
|
+
* })
|
|
814
|
+
*/
|
|
815
|
+
declare function analyzeWorkspace(root: string, options?: AnalyzerOptions): Promise<AnalyzerReport>;
|
|
816
|
+
|
|
817
|
+
interface EngineMetricsSnapshot {
|
|
818
|
+
eventsReceived: number;
|
|
819
|
+
eventsProcessed: number;
|
|
820
|
+
batchesProcessed: number;
|
|
821
|
+
incrementalUpdates: number;
|
|
822
|
+
fullRescans: number;
|
|
823
|
+
skippedLargeFiles: number;
|
|
824
|
+
queueMaxSize: number;
|
|
825
|
+
lastBuildMs: number;
|
|
826
|
+
avgBuildMs: number;
|
|
827
|
+
}
|
|
828
|
+
|
|
829
|
+
interface EnginePluginContext {
|
|
830
|
+
root: string;
|
|
831
|
+
timestamp: number;
|
|
832
|
+
}
|
|
833
|
+
interface EngineWatchContext {
|
|
834
|
+
root: string;
|
|
835
|
+
timestamp: number;
|
|
836
|
+
}
|
|
837
|
+
interface EnginePlugin {
|
|
838
|
+
name: string;
|
|
839
|
+
beforeScan?(context: EnginePluginContext): void | Promise<void>;
|
|
840
|
+
afterScan?(scan: ScanWorkspaceResult, context: EnginePluginContext): ScanWorkspaceResult | undefined | Promise<ScanWorkspaceResult | undefined>;
|
|
841
|
+
transformClasses?(classes: string[], context: EnginePluginContext): string[] | undefined | Promise<string[] | undefined>;
|
|
842
|
+
beforeBuild?(scan: ScanWorkspaceResult, context: EnginePluginContext): void | Promise<void>;
|
|
843
|
+
afterBuild?(result: BuildResult, context: EnginePluginContext): BuildResult | undefined | Promise<BuildResult | undefined>;
|
|
844
|
+
onError?(error: Error, context: EnginePluginContext): void | Promise<void>;
|
|
845
|
+
beforeWatch?(context: EngineWatchContext): void | Promise<void>;
|
|
846
|
+
afterWatch?(context: EngineWatchContext): void | Promise<void>;
|
|
847
|
+
}
|
|
848
|
+
|
|
849
|
+
interface EngineOptions {
|
|
850
|
+
root?: string;
|
|
851
|
+
scanner?: ScanWorkspaceOptions;
|
|
852
|
+
compileCss?: boolean;
|
|
853
|
+
tailwindConfigPath?: string;
|
|
854
|
+
plugins?: EnginePlugin[];
|
|
855
|
+
/** Enable analyzer integration - provides semantic report (unused classes, conflicts). Default: false */
|
|
856
|
+
analyze?: boolean;
|
|
857
|
+
}
|
|
858
|
+
interface EngineWatchOptions {
|
|
859
|
+
debounceMs?: number;
|
|
860
|
+
maxEventsPerFlush?: number;
|
|
861
|
+
largeFileThreshold?: number;
|
|
862
|
+
}
|
|
863
|
+
interface BuildResult {
|
|
864
|
+
scan: ScanWorkspaceResult;
|
|
865
|
+
mergedClassList: string;
|
|
866
|
+
css: string;
|
|
867
|
+
/** Analyzer semantic report - present when analyze: true in options */
|
|
868
|
+
analysis?: {
|
|
869
|
+
unusedClasses: string[];
|
|
870
|
+
classConflicts: Array<{
|
|
871
|
+
className: string;
|
|
872
|
+
files: string[];
|
|
873
|
+
classes?: string[];
|
|
874
|
+
message?: string;
|
|
875
|
+
}>;
|
|
876
|
+
classUsage: Record<string, number>;
|
|
877
|
+
semantic?: AnalyzerSemanticReport;
|
|
878
|
+
report: AnalyzerReport;
|
|
879
|
+
};
|
|
880
|
+
}
|
|
881
|
+
type EngineBuildWatchEventType = "initial" | "change" | "unlink" | "full-rescan";
|
|
882
|
+
type EngineWatchEvent = {
|
|
883
|
+
type: EngineBuildWatchEventType;
|
|
884
|
+
filePath?: string;
|
|
885
|
+
result: BuildResult;
|
|
886
|
+
metrics?: EngineMetricsSnapshot;
|
|
887
|
+
} | {
|
|
888
|
+
type: "error";
|
|
889
|
+
filePath?: string;
|
|
890
|
+
error: string;
|
|
891
|
+
metrics?: EngineMetricsSnapshot;
|
|
892
|
+
};
|
|
893
|
+
interface TailwindStyledEngine {
|
|
894
|
+
scan(): Promise<ScanWorkspaceResult>;
|
|
895
|
+
scanWorkspace(): Promise<ScanWorkspaceResult>;
|
|
896
|
+
analyzeWorkspace(): Promise<Awaited<ReturnType<typeof analyzeWorkspace>>>;
|
|
897
|
+
generateSafelist(): Promise<string[]>;
|
|
898
|
+
build(): Promise<BuildResult>;
|
|
899
|
+
watch(onEvent: (event: EngineWatchEvent) => void, options?: EngineWatchOptions): Promise<{
|
|
900
|
+
close(): void;
|
|
901
|
+
}>;
|
|
902
|
+
}
|
|
903
|
+
declare function createEngine(rawOptions?: EngineOptions): Promise<TailwindStyledEngine>;
|
|
904
|
+
|
|
905
|
+
export { type ComponentConfig, type ContainerConfig, type ContainerEntry, type CvFn, type HtmlTagName, type InferVariantProps, type LiveTokenSet, type MergeOptions, type ParsedClass, type ParsedClassModifier, type ResolvedThemeTokens, type StateComponentEntry, type StateConfig, type StyledComponentProps, type StyledOptions, type StyledProps, type StyledSystemConfig, type StyledSystemInstance, type SubComponentEntry, type SubComponentMap, type SubComponentProps, type SystemComponentConfig, type SystemComponentFactory, type SystemTokenMap, type ThemeConfig, type ThemeTokenMap, type TokenMap, type TokenSubscriber, type TwComponentFactory, type TwObject, type TwStyledComponent, type TwSubComponent, type TwTagFactory, type TwTagFactoryAny, type VariantLiterals, applyTokenSet, cn, tokenRef as containerRef, createComponent, createEngine, createStyledSystem, createTheme, createTwMerge, createUseTokens, cssVar, cv, cx, cxm, generateContainerCss, generateStateCss, generateTokenCssString, getAllSubComponents, getContainerRegistry, getStateRegistry, getSubComponent, getToken, getTokens, liveToken, mergeWithRules, processContainer, processState, registerSubComponent, resolveStyledClassName, server, setToken, setTokens, styled, subscribeTokens, t, tokenRef, tokenVar, tw, twMerge, twVar, v4Tokens, withSubComponents };
|