tailwind-styled-v4 5.0.11 → 5.0.13
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 +100 -4
- package/dist/{analyzeWorkspace-DDOQdzzI.d.ts → analyzeWorkspace-CopJNGmi.d.ts} +2 -0
- package/dist/{analyzeWorkspace-BS5O4rhC.d.mts → analyzeWorkspace-DpVPccjz.d.mts} +2 -0
- package/dist/analyzer.d.mts +4 -4
- package/dist/analyzer.d.ts +4 -4
- package/dist/analyzer.js +34 -69
- package/dist/analyzer.js.map +1 -1
- package/dist/analyzer.mjs +33 -68
- package/dist/analyzer.mjs.map +1 -1
- package/dist/animate.d.mts +4 -0
- package/dist/animate.d.ts +4 -0
- package/dist/animate.js +33 -11
- package/dist/animate.js.map +1 -1
- package/dist/animate.mjs +33 -11
- package/dist/animate.mjs.map +1 -1
- package/dist/atomic.js +57 -6
- package/dist/atomic.js.map +1 -1
- package/dist/atomic.mjs +57 -6
- package/dist/atomic.mjs.map +1 -1
- package/dist/cli.js +404 -190
- package/dist/cli.js.map +1 -1
- package/dist/cli.mjs +401 -187
- package/dist/cli.mjs.map +1 -1
- package/dist/compiler.d.mts +2700 -212
- package/dist/compiler.d.ts +2700 -212
- package/dist/compiler.js +1996 -503
- package/dist/compiler.js.map +1 -1
- package/dist/compiler.mjs +1847 -448
- package/dist/compiler.mjs.map +1 -1
- package/dist/devtools.js +17 -4
- package/dist/devtools.js.map +1 -1
- package/dist/devtools.mjs +17 -4
- package/dist/devtools.mjs.map +1 -1
- package/dist/engine.d.mts +11 -470
- package/dist/engine.d.ts +11 -470
- package/dist/engine.js +2777 -455
- package/dist/engine.js.map +1 -1
- package/dist/engine.mjs +2776 -454
- package/dist/engine.mjs.map +1 -1
- package/dist/index-BDQw13kn.d.ts +464 -0
- package/dist/index-DJv28Uzq.d.mts +464 -0
- package/dist/index.browser.mjs +143 -255
- package/dist/index.browser.mjs.map +1 -1
- package/dist/index.d.mts +23 -39
- package/dist/index.d.ts +23 -39
- package/dist/index.js +7234 -1400
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +7234 -1400
- package/dist/index.mjs.map +1 -1
- package/dist/next.d.mts +44 -1
- package/dist/next.d.ts +44 -1
- package/dist/next.js +3224 -1065
- package/dist/next.js.map +1 -1
- package/dist/next.mjs +3223 -1066
- package/dist/next.mjs.map +1 -1
- package/dist/rspack.d.mts +9 -0
- package/dist/rspack.d.ts +9 -0
- package/dist/rspack.js +99 -61
- package/dist/rspack.js.map +1 -1
- package/dist/rspack.mjs +99 -61
- package/dist/rspack.mjs.map +1 -1
- package/dist/runtime-css.d.mts +8 -0
- package/dist/runtime-css.d.ts +8 -0
- package/dist/runtime-css.js +23 -7
- package/dist/runtime-css.js.map +1 -1
- package/dist/runtime-css.mjs +23 -7
- package/dist/runtime-css.mjs.map +1 -1
- package/dist/scanner.js +16 -37
- package/dist/scanner.js.map +1 -1
- package/dist/scanner.mjs +15 -36
- package/dist/scanner.mjs.map +1 -1
- package/dist/shared.d.mts +107 -1
- package/dist/shared.d.ts +107 -1
- package/dist/shared.js +3014 -466
- package/dist/shared.js.map +1 -1
- package/dist/shared.mjs +3008 -445
- package/dist/shared.mjs.map +1 -1
- package/dist/svelte.js +39 -35
- package/dist/svelte.js.map +1 -1
- package/dist/svelte.mjs +38 -34
- package/dist/svelte.mjs.map +1 -1
- package/dist/theme.js +85 -76
- package/dist/theme.js.map +1 -1
- package/dist/theme.mjs +83 -74
- package/dist/theme.mjs.map +1 -1
- package/dist/turbopackLoader.js +2351 -187
- package/dist/turbopackLoader.js.map +1 -1
- package/dist/turbopackLoader.mjs +2351 -187
- package/dist/turbopackLoader.mjs.map +1 -1
- package/dist/tw.js +404 -190
- package/dist/tw.js.map +1 -1
- package/dist/tw.mjs +401 -187
- package/dist/tw.mjs.map +1 -1
- package/dist/vite.js +2657 -320
- package/dist/vite.js.map +1 -1
- package/dist/vite.mjs +2657 -320
- package/dist/vite.mjs.map +1 -1
- package/dist/vue.js +39 -35
- package/dist/vue.js.map +1 -1
- package/dist/vue.mjs +38 -34
- package/dist/vue.mjs.map +1 -1
- package/dist/webpackLoader.js +190 -33
- package/dist/webpackLoader.js.map +1 -1
- package/dist/webpackLoader.mjs +190 -33
- package/dist/webpackLoader.mjs.map +1 -1
- package/native/index.node +0 -0
- package/native/tailwind-styled-native.node +0 -0
- package/native/tailwind-styled-native.win32-x64-msvc.node +0 -0
- package/package.json +9 -4
- package/CHANGELOG.md +0 -285
package/dist/shared.d.mts
CHANGED
|
@@ -642,4 +642,110 @@ declare function createObservabilityClient(opts?: {
|
|
|
642
642
|
timeoutMs?: number;
|
|
643
643
|
}): ObservabilityClient;
|
|
644
644
|
|
|
645
|
-
|
|
645
|
+
/**
|
|
646
|
+
* staticStateExtractor.ts — Build-time State CSS Pre-generator
|
|
647
|
+
*
|
|
648
|
+
* Mengkoordinasi pipeline untuk mengeliminasi runtime CSS injection untuk `states` config.
|
|
649
|
+
*
|
|
650
|
+
* Flow:
|
|
651
|
+
* 1. Walk semua source files (.ts/.tsx/.js/.jsx)
|
|
652
|
+
* 2. Per file: panggil `extractTwStateConfigs()` (Rust NAPI)
|
|
653
|
+
* → temukan semua `tw.tag({ states: {...} })` calls
|
|
654
|
+
* 3. Kumpulkan semua configs, panggil `generateStaticStateCss()` (Rust NAPI)
|
|
655
|
+
* → compute hash identik dengan runtime stateEngine.ts
|
|
656
|
+
* → generate CSS rules dengan selector `.tw-s-[hash][data-stateName="true"]`
|
|
657
|
+
* 4. Append hasilnya ke safelist CSS file
|
|
658
|
+
*
|
|
659
|
+
* Hasilnya: browser load state CSS dari static file — ZERO runtime injection,
|
|
660
|
+
* ZERO flicker saat component dengan states di-render.
|
|
661
|
+
*
|
|
662
|
+
* Dipanggil dari withTailwindStyled.ts setelah initial Tailwind CSS scan.
|
|
663
|
+
*
|
|
664
|
+
* @module staticStateExtractor
|
|
665
|
+
*/
|
|
666
|
+
interface TwStateConfigEntry {
|
|
667
|
+
tag: string;
|
|
668
|
+
componentName: string;
|
|
669
|
+
statesJson: string;
|
|
670
|
+
sourceFile: string;
|
|
671
|
+
}
|
|
672
|
+
interface StaticStateCssInput {
|
|
673
|
+
tag: string;
|
|
674
|
+
componentName: string;
|
|
675
|
+
statesJson: string;
|
|
676
|
+
}
|
|
677
|
+
interface GeneratedStateRule {
|
|
678
|
+
selector: string;
|
|
679
|
+
declarations: string;
|
|
680
|
+
cssRule: string;
|
|
681
|
+
componentName: string;
|
|
682
|
+
stateName: string;
|
|
683
|
+
}
|
|
684
|
+
interface StaticStateExtractionResult {
|
|
685
|
+
/** Total source files di-scan */
|
|
686
|
+
filesScanned: number;
|
|
687
|
+
/** Files yang punya tw() state configs */
|
|
688
|
+
filesWithStates: number;
|
|
689
|
+
/** Total komponen dengan states ditemukan */
|
|
690
|
+
componentsFound: number;
|
|
691
|
+
/** Total CSS rules yang di-generate */
|
|
692
|
+
rulesGenerated: number;
|
|
693
|
+
/** Rules yang tidak bisa di-resolve (butuh Tailwind full pipeline) */
|
|
694
|
+
rulesSkipped: number;
|
|
695
|
+
/** CSS yang siap di-append ke safelist file */
|
|
696
|
+
generatedCss: string;
|
|
697
|
+
/** Debug: semua rules yang di-generate */
|
|
698
|
+
rules: GeneratedStateRule[];
|
|
699
|
+
}
|
|
700
|
+
/**
|
|
701
|
+
* Scan semua source files di `srcDir`, extract tw() state configs,
|
|
702
|
+
* generate static CSS, dan return hasilnya.
|
|
703
|
+
*
|
|
704
|
+
* @param srcDir Root directory untuk scan (biasanya `process.cwd()/src`)
|
|
705
|
+
* @param options Optional configuration
|
|
706
|
+
*/
|
|
707
|
+
declare function extractStaticStateCss(srcDir: string, options?: {
|
|
708
|
+
/** Emit debug logging */
|
|
709
|
+
verbose?: boolean;
|
|
710
|
+
/** Max files untuk di-scan (default: unlimited) */
|
|
711
|
+
maxFiles?: number;
|
|
712
|
+
/**
|
|
713
|
+
* CSS output dari Tailwind pipeline (isi `_initial-scan.css`).
|
|
714
|
+
*
|
|
715
|
+
* Kalau di-provide, dipakai untuk resolve class names via `parseTailwindCssToClassMap`
|
|
716
|
+
* → semua Tailwind class (termasuk `w-full`, `ring-2`, dll) bisa di-resolve dengan benar.
|
|
717
|
+
*
|
|
718
|
+
* Kalau tidak di-provide, fallback ke Rust resolver (hanya class sederhana yang ter-resolve).
|
|
719
|
+
*/
|
|
720
|
+
resolvedCss?: string;
|
|
721
|
+
}): StaticStateExtractionResult;
|
|
722
|
+
/** Nama file output untuk static state CSS — di-import langsung dari globals.css */
|
|
723
|
+
declare const TW_STATE_STATIC_FILENAME = "_tw-state-static.css";
|
|
724
|
+
/**
|
|
725
|
+
* Extract static state CSS dan tulis ke file terpisah `_tw-state-static.css`
|
|
726
|
+
* di `.next/tw-classes/_tw-state-static.css` — grouped bersama `_initial-scan.css`.
|
|
727
|
+
*
|
|
728
|
+
* File ini harus di-`@import` langsung dari globals.css karena berisi raw CSS
|
|
729
|
+
* (bukan Tailwind class names), sehingga tidak bisa di-pickup oleh `@source`.
|
|
730
|
+
*
|
|
731
|
+
* Dipanggil dari `withTailwindStyled.ts` setelah initial Tailwind scan.
|
|
732
|
+
*
|
|
733
|
+
* @param srcDir Source directory untuk scan
|
|
734
|
+
* @param safelistPath Path ke safelist CSS file — dipakai untuk derive direktori output
|
|
735
|
+
* @param options Optional config
|
|
736
|
+
* @returns Summary string untuk logging
|
|
737
|
+
*/
|
|
738
|
+
declare function appendStaticStateCssToSafelist(srcDir: string, safelistPath: string, options?: {
|
|
739
|
+
verbose?: boolean;
|
|
740
|
+
/**
|
|
741
|
+
* CSS output dari Tailwind pipeline — isi dari `_initial-scan.css`.
|
|
742
|
+
*
|
|
743
|
+
* Wajib di-provide untuk resolve semua Tailwind class dengan benar.
|
|
744
|
+
* Kalau tidak di-provide, fallback ke Rust resolver (class sederhana saja).
|
|
745
|
+
*/
|
|
746
|
+
resolvedCss?: string;
|
|
747
|
+
}): string;
|
|
748
|
+
|
|
749
|
+
declare function setGlobalLogFile(filePath: string): void;
|
|
750
|
+
|
|
751
|
+
export { type BuildPhaseTrace, type BuildPhases, type BuildTelemetry, type BuildTrace, type ClassInspection, type ClassProperty, type ClassUsageLocation, type ComponentCodegenOptions, type DashboardMetrics, type DashboardSummary, ERROR_CODES, type ErrorCode, type GeneratedStateRule, NativeAnalyzerReportSchema, NativeCacheEntrySchema, NativeCacheReadResultSchema, NativeCssCompileResultSchema, type NativeResolutionResult, NativeScanFileSchema, NativeScanResultSchema, NativeTransformResultSchema, NativeWatchResultSchema, type ObservabilityClient, type PackageJson, PackageJsonSchema, type RegistryFile, RegistryFileSchema, type RegistryPluginEntry, RegistryPluginEntrySchema, type ScanCache, type ScanCacheClassEntry, ScanCacheClassEntrySchema, ScanCacheSchema, type StaticStateCssInput, type StaticStateExtractionResult, TW_STATE_STATIC_FILENAME, type TailwindConfig, TailwindConfigSchema, type TailwindInfo, TelemetryCollector, type TelemetrySummary, type TwStateConfigEntry, type WorkerPathOptions, type WorkerPathResult, appendStaticStateCssToSafelist, assertTailwindV4, createBuildTimer, createEsmRequire, createObservabilityClient, detectTailwind, extractStaticStateCss, formatErrorCode, formatNativeNotFoundError, generateBarrelFile, generateClassRenameCodemod, generateComponentCode, generateStorybookStory, getDirname, getFilename, getGlobalTelemetry, getSuggestion, getTailwindVersion, isTailwindV4, parseJsonFileWithSchema, parseJsonWithSchema, parseNative, resetGlobalTelemetry, resolveFromRoot, resolveLoaderPath, resolveNativeBinary, resolveNativeNodePath, resolveWorkerPath, safeParseNative, setGlobalLogFile, tryRequire };
|
package/dist/shared.d.ts
CHANGED
|
@@ -642,4 +642,110 @@ declare function createObservabilityClient(opts?: {
|
|
|
642
642
|
timeoutMs?: number;
|
|
643
643
|
}): ObservabilityClient;
|
|
644
644
|
|
|
645
|
-
|
|
645
|
+
/**
|
|
646
|
+
* staticStateExtractor.ts — Build-time State CSS Pre-generator
|
|
647
|
+
*
|
|
648
|
+
* Mengkoordinasi pipeline untuk mengeliminasi runtime CSS injection untuk `states` config.
|
|
649
|
+
*
|
|
650
|
+
* Flow:
|
|
651
|
+
* 1. Walk semua source files (.ts/.tsx/.js/.jsx)
|
|
652
|
+
* 2. Per file: panggil `extractTwStateConfigs()` (Rust NAPI)
|
|
653
|
+
* → temukan semua `tw.tag({ states: {...} })` calls
|
|
654
|
+
* 3. Kumpulkan semua configs, panggil `generateStaticStateCss()` (Rust NAPI)
|
|
655
|
+
* → compute hash identik dengan runtime stateEngine.ts
|
|
656
|
+
* → generate CSS rules dengan selector `.tw-s-[hash][data-stateName="true"]`
|
|
657
|
+
* 4. Append hasilnya ke safelist CSS file
|
|
658
|
+
*
|
|
659
|
+
* Hasilnya: browser load state CSS dari static file — ZERO runtime injection,
|
|
660
|
+
* ZERO flicker saat component dengan states di-render.
|
|
661
|
+
*
|
|
662
|
+
* Dipanggil dari withTailwindStyled.ts setelah initial Tailwind CSS scan.
|
|
663
|
+
*
|
|
664
|
+
* @module staticStateExtractor
|
|
665
|
+
*/
|
|
666
|
+
interface TwStateConfigEntry {
|
|
667
|
+
tag: string;
|
|
668
|
+
componentName: string;
|
|
669
|
+
statesJson: string;
|
|
670
|
+
sourceFile: string;
|
|
671
|
+
}
|
|
672
|
+
interface StaticStateCssInput {
|
|
673
|
+
tag: string;
|
|
674
|
+
componentName: string;
|
|
675
|
+
statesJson: string;
|
|
676
|
+
}
|
|
677
|
+
interface GeneratedStateRule {
|
|
678
|
+
selector: string;
|
|
679
|
+
declarations: string;
|
|
680
|
+
cssRule: string;
|
|
681
|
+
componentName: string;
|
|
682
|
+
stateName: string;
|
|
683
|
+
}
|
|
684
|
+
interface StaticStateExtractionResult {
|
|
685
|
+
/** Total source files di-scan */
|
|
686
|
+
filesScanned: number;
|
|
687
|
+
/** Files yang punya tw() state configs */
|
|
688
|
+
filesWithStates: number;
|
|
689
|
+
/** Total komponen dengan states ditemukan */
|
|
690
|
+
componentsFound: number;
|
|
691
|
+
/** Total CSS rules yang di-generate */
|
|
692
|
+
rulesGenerated: number;
|
|
693
|
+
/** Rules yang tidak bisa di-resolve (butuh Tailwind full pipeline) */
|
|
694
|
+
rulesSkipped: number;
|
|
695
|
+
/** CSS yang siap di-append ke safelist file */
|
|
696
|
+
generatedCss: string;
|
|
697
|
+
/** Debug: semua rules yang di-generate */
|
|
698
|
+
rules: GeneratedStateRule[];
|
|
699
|
+
}
|
|
700
|
+
/**
|
|
701
|
+
* Scan semua source files di `srcDir`, extract tw() state configs,
|
|
702
|
+
* generate static CSS, dan return hasilnya.
|
|
703
|
+
*
|
|
704
|
+
* @param srcDir Root directory untuk scan (biasanya `process.cwd()/src`)
|
|
705
|
+
* @param options Optional configuration
|
|
706
|
+
*/
|
|
707
|
+
declare function extractStaticStateCss(srcDir: string, options?: {
|
|
708
|
+
/** Emit debug logging */
|
|
709
|
+
verbose?: boolean;
|
|
710
|
+
/** Max files untuk di-scan (default: unlimited) */
|
|
711
|
+
maxFiles?: number;
|
|
712
|
+
/**
|
|
713
|
+
* CSS output dari Tailwind pipeline (isi `_initial-scan.css`).
|
|
714
|
+
*
|
|
715
|
+
* Kalau di-provide, dipakai untuk resolve class names via `parseTailwindCssToClassMap`
|
|
716
|
+
* → semua Tailwind class (termasuk `w-full`, `ring-2`, dll) bisa di-resolve dengan benar.
|
|
717
|
+
*
|
|
718
|
+
* Kalau tidak di-provide, fallback ke Rust resolver (hanya class sederhana yang ter-resolve).
|
|
719
|
+
*/
|
|
720
|
+
resolvedCss?: string;
|
|
721
|
+
}): StaticStateExtractionResult;
|
|
722
|
+
/** Nama file output untuk static state CSS — di-import langsung dari globals.css */
|
|
723
|
+
declare const TW_STATE_STATIC_FILENAME = "_tw-state-static.css";
|
|
724
|
+
/**
|
|
725
|
+
* Extract static state CSS dan tulis ke file terpisah `_tw-state-static.css`
|
|
726
|
+
* di `.next/tw-classes/_tw-state-static.css` — grouped bersama `_initial-scan.css`.
|
|
727
|
+
*
|
|
728
|
+
* File ini harus di-`@import` langsung dari globals.css karena berisi raw CSS
|
|
729
|
+
* (bukan Tailwind class names), sehingga tidak bisa di-pickup oleh `@source`.
|
|
730
|
+
*
|
|
731
|
+
* Dipanggil dari `withTailwindStyled.ts` setelah initial Tailwind scan.
|
|
732
|
+
*
|
|
733
|
+
* @param srcDir Source directory untuk scan
|
|
734
|
+
* @param safelistPath Path ke safelist CSS file — dipakai untuk derive direktori output
|
|
735
|
+
* @param options Optional config
|
|
736
|
+
* @returns Summary string untuk logging
|
|
737
|
+
*/
|
|
738
|
+
declare function appendStaticStateCssToSafelist(srcDir: string, safelistPath: string, options?: {
|
|
739
|
+
verbose?: boolean;
|
|
740
|
+
/**
|
|
741
|
+
* CSS output dari Tailwind pipeline — isi dari `_initial-scan.css`.
|
|
742
|
+
*
|
|
743
|
+
* Wajib di-provide untuk resolve semua Tailwind class dengan benar.
|
|
744
|
+
* Kalau tidak di-provide, fallback ke Rust resolver (class sederhana saja).
|
|
745
|
+
*/
|
|
746
|
+
resolvedCss?: string;
|
|
747
|
+
}): string;
|
|
748
|
+
|
|
749
|
+
declare function setGlobalLogFile(filePath: string): void;
|
|
750
|
+
|
|
751
|
+
export { type BuildPhaseTrace, type BuildPhases, type BuildTelemetry, type BuildTrace, type ClassInspection, type ClassProperty, type ClassUsageLocation, type ComponentCodegenOptions, type DashboardMetrics, type DashboardSummary, ERROR_CODES, type ErrorCode, type GeneratedStateRule, NativeAnalyzerReportSchema, NativeCacheEntrySchema, NativeCacheReadResultSchema, NativeCssCompileResultSchema, type NativeResolutionResult, NativeScanFileSchema, NativeScanResultSchema, NativeTransformResultSchema, NativeWatchResultSchema, type ObservabilityClient, type PackageJson, PackageJsonSchema, type RegistryFile, RegistryFileSchema, type RegistryPluginEntry, RegistryPluginEntrySchema, type ScanCache, type ScanCacheClassEntry, ScanCacheClassEntrySchema, ScanCacheSchema, type StaticStateCssInput, type StaticStateExtractionResult, TW_STATE_STATIC_FILENAME, type TailwindConfig, TailwindConfigSchema, type TailwindInfo, TelemetryCollector, type TelemetrySummary, type TwStateConfigEntry, type WorkerPathOptions, type WorkerPathResult, appendStaticStateCssToSafelist, assertTailwindV4, createBuildTimer, createEsmRequire, createObservabilityClient, detectTailwind, extractStaticStateCss, formatErrorCode, formatNativeNotFoundError, generateBarrelFile, generateClassRenameCodemod, generateComponentCode, generateStorybookStory, getDirname, getFilename, getGlobalTelemetry, getSuggestion, getTailwindVersion, isTailwindV4, parseJsonFileWithSchema, parseJsonWithSchema, parseNative, resetGlobalTelemetry, resolveFromRoot, resolveLoaderPath, resolveNativeBinary, resolveNativeNodePath, resolveWorkerPath, safeParseNative, setGlobalLogFile, tryRequire };
|