@cwcss/crosswind 0.1.5 → 0.1.6
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/LICENSE.md +21 -0
- package/README.md +390 -0
- package/dist/build.d.ts +24 -0
- package/dist/config.d.ts +5 -0
- package/dist/generator.d.ts +31 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.js +12798 -0
- package/dist/parser.d.ts +42 -0
- package/dist/plugin.d.ts +22 -0
- package/dist/preflight-forms.d.ts +5 -0
- package/dist/preflight.d.ts +2 -0
- package/dist/rules-advanced.d.ts +27 -0
- package/dist/rules-effects.d.ts +25 -0
- package/dist/rules-forms.d.ts +7 -0
- package/dist/rules-grid.d.ts +13 -0
- package/dist/rules-interactivity.d.ts +41 -0
- package/dist/rules-layout.d.ts +26 -0
- package/dist/rules-transforms.d.ts +33 -0
- package/dist/rules-typography.d.ts +41 -0
- package/dist/rules.d.ts +39 -0
- package/dist/scanner.d.ts +18 -0
- package/dist/transformer-compile-class.d.ts +37 -0
- package/{src/types.ts → dist/types.d.ts} +17 -86
- package/package.json +1 -1
- package/PLUGIN.md +0 -235
- package/benchmark/framework-comparison.bench.ts +0 -850
- package/bin/cli.ts +0 -365
- package/bin/crosswind +0 -0
- package/bin/headwind +0 -0
- package/build.ts +0 -8
- package/crosswind.config.ts +0 -9
- package/example/comprehensive.html +0 -70
- package/example/index.html +0 -21
- package/example/output.css +0 -236
- package/examples/plugin/README.md +0 -112
- package/examples/plugin/build.ts +0 -32
- package/examples/plugin/src/index.html +0 -34
- package/examples/plugin/src/index.ts +0 -7
- package/headwind +0 -2
- package/src/build.ts +0 -101
- package/src/config.ts +0 -529
- package/src/generator.ts +0 -2173
- package/src/index.ts +0 -10
- package/src/parser.ts +0 -1471
- package/src/plugin.ts +0 -118
- package/src/preflight-forms.ts +0 -229
- package/src/preflight.ts +0 -388
- package/src/rules-advanced.ts +0 -477
- package/src/rules-effects.ts +0 -461
- package/src/rules-forms.ts +0 -103
- package/src/rules-grid.ts +0 -241
- package/src/rules-interactivity.ts +0 -525
- package/src/rules-layout.ts +0 -385
- package/src/rules-transforms.ts +0 -412
- package/src/rules-typography.ts +0 -486
- package/src/rules.ts +0 -809
- package/src/scanner.ts +0 -84
- package/src/transformer-compile-class.ts +0 -275
- package/test/advanced-features.test.ts +0 -911
- package/test/arbitrary.test.ts +0 -396
- package/test/attributify.test.ts +0 -592
- package/test/bracket-syntax.test.ts +0 -1133
- package/test/build.test.ts +0 -99
- package/test/colors.test.ts +0 -934
- package/test/flexbox.test.ts +0 -669
- package/test/generator.test.ts +0 -597
- package/test/grid.test.ts +0 -584
- package/test/layout.test.ts +0 -404
- package/test/modifiers.test.ts +0 -417
- package/test/parser.test.ts +0 -564
- package/test/performance-regression.test.ts +0 -376
- package/test/performance.test.ts +0 -568
- package/test/plugin.test.ts +0 -160
- package/test/scanner.test.ts +0 -94
- package/test/sizing.test.ts +0 -481
- package/test/spacing.test.ts +0 -394
- package/test/transformer-compile-class.test.ts +0 -287
- package/test/transforms.test.ts +0 -448
- package/test/typography.test.ts +0 -632
- package/test/variants-form-states.test.ts +0 -225
- package/test/variants-group-peer.test.ts +0 -66
- package/test/variants-media.test.ts +0 -213
- package/test/variants-positional.test.ts +0 -58
- package/test/variants-pseudo-elements.test.ts +0 -47
- package/test/variants-state.test.ts +0 -62
- package/tsconfig.json +0 -18
package/dist/parser.d.ts
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import type { AttributifyConfig, BracketSyntaxConfig, ParsedClass } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Expand bracket/grouped syntax into individual class names
|
|
4
|
+
* e.g., flex[col jc-center ai-center] -> ['flex-col', 'justify-center', 'items-center']
|
|
5
|
+
* e.g., text[white 2rem 700] -> ['text-white', 'text-[2rem]', 'font-bold']
|
|
6
|
+
* e.g., h[min 100vh] -> ['min-h-[100vh]']
|
|
7
|
+
* e.g., hover:flex[col] -> ['hover:flex-col']
|
|
8
|
+
* e.g., flex[md:col lg:row] -> ['md:flex-col', 'lg:flex-row']
|
|
9
|
+
* e.g., -m[4] or m[-4] -> ['-m-4']
|
|
10
|
+
*/
|
|
11
|
+
export declare function expandBracketSyntax(className: string, config?: BracketSyntaxConfig): string[];
|
|
12
|
+
/**
|
|
13
|
+
* Extract classes from attributify syntax
|
|
14
|
+
* e.g., <div hw-flex hw-items-center hw-bg="blue-500" hw-p="4">
|
|
15
|
+
* Returns classes like: flex, items-center, bg-blue-500, p-4
|
|
16
|
+
*
|
|
17
|
+
* Also supports variant attributes:
|
|
18
|
+
* e.g., <div hw-hover:bg="blue-600" hw-dark:text="white">
|
|
19
|
+
* Returns classes like: hover:bg-blue-600, dark:text-white
|
|
20
|
+
*/
|
|
21
|
+
export declare function extractAttributifyClasses(content: string, config?: AttributifyConfig): Set<string>;
|
|
22
|
+
/**
|
|
23
|
+
* Parses a utility class string into its components
|
|
24
|
+
* Examples: "p-4" -> {raw: "p-4", variants: [], utility: "p", value: "4", important: false, arbitrary: false}
|
|
25
|
+
* "hover:bg-blue-500" -> {raw: "hover:bg-blue-500", variants: ["hover"], utility: "bg", value: "blue-500", important: false, arbitrary: false}
|
|
26
|
+
* "!p-4" -> {raw: "!p-4", variants: [], utility: "p", value: "4", important: true, arbitrary: false}
|
|
27
|
+
* "w-[100px]" -> {raw: "w-[100px]", variants: [], utility: "w", value: "100px", important: false, arbitrary: true}
|
|
28
|
+
*/
|
|
29
|
+
export declare function parseClass(className: string): ParsedClass;
|
|
30
|
+
/**
|
|
31
|
+
* Extracts all utility classes from content
|
|
32
|
+
* Matches class patterns in HTML/JSX attributes and template strings
|
|
33
|
+
* Supports bracket syntax (e.g., flex[col jc-center]) and attributify mode
|
|
34
|
+
*/
|
|
35
|
+
export declare function extractClasses(content: string, options?: ExtractClassesOptions): Set<string>;
|
|
36
|
+
/**
|
|
37
|
+
* Options for class extraction
|
|
38
|
+
*/
|
|
39
|
+
export declare interface ExtractClassesOptions {
|
|
40
|
+
attributify?: AttributifyConfig
|
|
41
|
+
bracketSyntax?: BracketSyntaxConfig
|
|
42
|
+
}
|
package/dist/plugin.d.ts
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { BunPlugin } from 'bun';
|
|
2
|
+
import type { CrosswindOptions } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* Crosswind Bun plugin for processing HTML files
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* ```typescript
|
|
8
|
+
* import { plugin } from '@cwcss/crosswind'
|
|
9
|
+
*
|
|
10
|
+
* await Bun.build({
|
|
11
|
+
* entrypoints: ['./src/index.ts'],
|
|
12
|
+
* outdir: './dist',
|
|
13
|
+
* plugins: [plugin()],
|
|
14
|
+
* })
|
|
15
|
+
* ```
|
|
16
|
+
*/
|
|
17
|
+
export declare function plugin(options?: CrosswindPluginOptions): BunPlugin;
|
|
18
|
+
export declare interface CrosswindPluginOptions {
|
|
19
|
+
config?: CrosswindOptions
|
|
20
|
+
includePreflight?: boolean
|
|
21
|
+
}
|
|
22
|
+
export default plugin;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
// Advanced utilities
|
|
2
|
+
// Min/Max sizing
|
|
3
|
+
export declare const minMaxSizingRule: UtilityRule;
|
|
4
|
+
// Ring utilities
|
|
5
|
+
export declare const ringRule: UtilityRule;
|
|
6
|
+
// Border opacity utility
|
|
7
|
+
export declare const borderOpacityRule: UtilityRule;
|
|
8
|
+
// Space utilities (child spacing)
|
|
9
|
+
export declare const spaceRule: UtilityRule;
|
|
10
|
+
// Border style utilities
|
|
11
|
+
export declare const borderStyleRule: UtilityRule;
|
|
12
|
+
// Divide utilities (borders between children)
|
|
13
|
+
export declare const divideRule: UtilityRule;
|
|
14
|
+
// Gradient color stops
|
|
15
|
+
export declare const gradientStopsRule: UtilityRule;
|
|
16
|
+
// Flex order
|
|
17
|
+
export declare const flexOrderRule: UtilityRule;
|
|
18
|
+
// Flex basis
|
|
19
|
+
export declare const flexBasisRule: UtilityRule;
|
|
20
|
+
// Justify/Align self
|
|
21
|
+
export declare const justifySelfRule: UtilityRule;
|
|
22
|
+
export declare const alignSelfRule: UtilityRule;
|
|
23
|
+
// Container utility with responsive max-widths
|
|
24
|
+
export declare const containerRule: UtilityRule;
|
|
25
|
+
// Arbitrary properties
|
|
26
|
+
export declare const arbitraryPropertyRule: UtilityRule;
|
|
27
|
+
export declare const advancedRules: UtilityRule[];
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
// =============================================================================
|
|
2
|
+
// Backgrounds, Borders, Effects utilities
|
|
3
|
+
// =============================================================================
|
|
4
|
+
// Background utilities
|
|
5
|
+
export declare const backgroundAttachmentRule: UtilityRule;
|
|
6
|
+
export declare const backgroundClipRule: UtilityRule;
|
|
7
|
+
export declare const backgroundImageRule: UtilityRule;
|
|
8
|
+
export declare const backgroundOriginRule: UtilityRule;
|
|
9
|
+
export declare const backgroundPositionRule: UtilityRule;
|
|
10
|
+
export declare const backgroundRepeatRule: UtilityRule;
|
|
11
|
+
export declare const backgroundSizeRule: UtilityRule;
|
|
12
|
+
// Border utilities
|
|
13
|
+
export declare const borderStyleRule: UtilityRule;
|
|
14
|
+
export declare const outlineRule: UtilityRule;
|
|
15
|
+
// Effect utilities
|
|
16
|
+
export declare const boxShadowThemeRule: UtilityRule;
|
|
17
|
+
// Shadow color utilities (shadow-{color}, shadow-{color}/{opacity})
|
|
18
|
+
export declare const shadowColorRule: UtilityRule;
|
|
19
|
+
export declare const textShadowRule: UtilityRule;
|
|
20
|
+
export declare const opacityRule: UtilityRule;
|
|
21
|
+
export declare const mixBlendModeRule: UtilityRule;
|
|
22
|
+
export declare const backgroundBlendModeRule: UtilityRule;
|
|
23
|
+
// Mask utilities
|
|
24
|
+
export declare const maskRule: UtilityRule;
|
|
25
|
+
export declare const effectsRules: UtilityRule[];
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export declare const formInputRule: UtilityRule;
|
|
2
|
+
export declare const formTextareaRule: UtilityRule;
|
|
3
|
+
export declare const formSelectRule: UtilityRule;
|
|
4
|
+
export declare const formMultiselectRule: UtilityRule;
|
|
5
|
+
export declare const formCheckboxRule: UtilityRule;
|
|
6
|
+
export declare const formRadioRule: UtilityRule;
|
|
7
|
+
export declare const formsRules: UtilityRule[];
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
// Grid utilities
|
|
2
|
+
export declare const gridTemplateColumnsRule: UtilityRule;
|
|
3
|
+
export declare const gridColumnRule: UtilityRule;
|
|
4
|
+
export declare const gridTemplateRowsRule: UtilityRule;
|
|
5
|
+
export declare const gridRowRule: UtilityRule;
|
|
6
|
+
export declare const gridAutoFlowRule: UtilityRule;
|
|
7
|
+
export declare const gridAutoColumnsRule: UtilityRule;
|
|
8
|
+
export declare const gridAutoRowsRule: UtilityRule;
|
|
9
|
+
export declare const gapRule: UtilityRule;
|
|
10
|
+
export declare const placeContentRule: UtilityRule;
|
|
11
|
+
export declare const placeItemsRule: UtilityRule;
|
|
12
|
+
export declare const placeSelfRule: UtilityRule;
|
|
13
|
+
export declare const gridRules: UtilityRule[];
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
// Filters, Tables, Interactivity, SVG, Accessibility utilities
|
|
2
|
+
// Filter utilities
|
|
3
|
+
export declare const filterRule: UtilityRule;
|
|
4
|
+
export declare const backdropFilterRule: UtilityRule;
|
|
5
|
+
// Table utilities
|
|
6
|
+
export declare const borderCollapseRule: UtilityRule;
|
|
7
|
+
export declare const borderSpacingRule: UtilityRule;
|
|
8
|
+
export declare const tableLayoutRule: UtilityRule;
|
|
9
|
+
export declare const captionSideRule: UtilityRule;
|
|
10
|
+
// Interactivity utilities
|
|
11
|
+
export declare const accentColorRule: UtilityRule;
|
|
12
|
+
export declare const appearanceRule: UtilityRule;
|
|
13
|
+
export declare const caretColorRule: UtilityRule;
|
|
14
|
+
export declare const colorSchemeRule: UtilityRule;
|
|
15
|
+
export declare const fieldSizingRule: UtilityRule;
|
|
16
|
+
export declare const cursorRule: UtilityRule;
|
|
17
|
+
export declare const pointerEventsRule: UtilityRule;
|
|
18
|
+
export declare const resizeRule: UtilityRule;
|
|
19
|
+
export declare const scrollBehaviorRule: UtilityRule;
|
|
20
|
+
export declare const scrollMarginRule: UtilityRule;
|
|
21
|
+
export declare const scrollPaddingRule: UtilityRule;
|
|
22
|
+
export declare const scrollSnapRule: UtilityRule;
|
|
23
|
+
export declare const touchActionRule: UtilityRule;
|
|
24
|
+
export declare const userSelectRule: UtilityRule;
|
|
25
|
+
export declare const willChangeRule: UtilityRule;
|
|
26
|
+
// SVG utilities
|
|
27
|
+
export declare const fillRule: UtilityRule;
|
|
28
|
+
export declare const strokeRule: UtilityRule;
|
|
29
|
+
export declare const strokeWidthRule: UtilityRule;
|
|
30
|
+
// SVG stroke-dasharray
|
|
31
|
+
export declare const strokeDasharrayRule: UtilityRule;
|
|
32
|
+
// SVG stroke-dashoffset
|
|
33
|
+
export declare const strokeDashoffsetRule: UtilityRule;
|
|
34
|
+
// SVG stroke-linecap
|
|
35
|
+
export declare const strokeLinecapRule: UtilityRule;
|
|
36
|
+
// SVG stroke-linejoin
|
|
37
|
+
export declare const strokeLinejoinRule: UtilityRule;
|
|
38
|
+
// Accessibility
|
|
39
|
+
export declare const screenReaderRule: UtilityRule;
|
|
40
|
+
export declare const forcedColorAdjustRule: UtilityRule;
|
|
41
|
+
export declare const interactivityRules: UtilityRule[];
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
// Layout utilities
|
|
2
|
+
export declare const aspectRatioRule: UtilityRule;
|
|
3
|
+
export declare const columnsRule: UtilityRule;
|
|
4
|
+
// Column fill
|
|
5
|
+
export declare const columnFillRule: UtilityRule;
|
|
6
|
+
// Column gap (different from grid gap)
|
|
7
|
+
export declare const columnGapRule: UtilityRule;
|
|
8
|
+
// Column rule (border between columns)
|
|
9
|
+
export declare const columnRuleRule: UtilityRule;
|
|
10
|
+
// Column span
|
|
11
|
+
export declare const columnSpanRule: UtilityRule;
|
|
12
|
+
export declare const breakRule: UtilityRule;
|
|
13
|
+
export declare const boxDecorationRule: UtilityRule;
|
|
14
|
+
export declare const boxSizingRule: UtilityRule;
|
|
15
|
+
export declare const floatRule: UtilityRule;
|
|
16
|
+
export declare const clearRule: UtilityRule;
|
|
17
|
+
export declare const isolationRule: UtilityRule;
|
|
18
|
+
export declare const objectFitRule: UtilityRule;
|
|
19
|
+
export declare const objectPositionRule: UtilityRule;
|
|
20
|
+
export declare const overflowRule: UtilityRule;
|
|
21
|
+
export declare const overscrollRule: UtilityRule;
|
|
22
|
+
export declare const positionRule: UtilityRule;
|
|
23
|
+
export declare const insetRule: UtilityRule;
|
|
24
|
+
export declare const visibilityRule: UtilityRule;
|
|
25
|
+
export declare const zIndexRule: UtilityRule;
|
|
26
|
+
export declare const layoutRules: UtilityRule[];
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
// Transform, Transition, Animation utilities
|
|
2
|
+
export declare const transformRule: UtilityRule;
|
|
3
|
+
export declare const scaleRule: UtilityRule;
|
|
4
|
+
export declare const rotateRule: UtilityRule;
|
|
5
|
+
export declare const translateRule: UtilityRule;
|
|
6
|
+
export declare const skewRule: UtilityRule;
|
|
7
|
+
export declare const transformOriginRule: UtilityRule;
|
|
8
|
+
export declare const perspectiveRule: UtilityRule;
|
|
9
|
+
export declare const perspectiveOriginRule: UtilityRule;
|
|
10
|
+
export declare const backfaceVisibilityRule: UtilityRule;
|
|
11
|
+
export declare const transformStyleRule: UtilityRule;
|
|
12
|
+
// Transition utilities
|
|
13
|
+
export declare const transitionPropertyRule: UtilityRule;
|
|
14
|
+
export declare const transitionDurationRule: UtilityRule;
|
|
15
|
+
export declare const transitionTimingRule: UtilityRule;
|
|
16
|
+
export declare const transitionDelayRule: UtilityRule;
|
|
17
|
+
export declare const transitionBehaviorRule: UtilityRule;
|
|
18
|
+
export declare const animationRule: UtilityRule;
|
|
19
|
+
// Animation play state
|
|
20
|
+
export declare const animationPlayStateRule: UtilityRule;
|
|
21
|
+
// Animation direction
|
|
22
|
+
export declare const animationDirectionRule: UtilityRule;
|
|
23
|
+
// Animation fill mode
|
|
24
|
+
export declare const animationFillModeRule: UtilityRule;
|
|
25
|
+
// Animation iteration count
|
|
26
|
+
export declare const animationIterationRule: UtilityRule;
|
|
27
|
+
// Animation duration
|
|
28
|
+
export declare const animationDurationRule: UtilityRule;
|
|
29
|
+
// Animation delay
|
|
30
|
+
export declare const animationDelayRule: UtilityRule;
|
|
31
|
+
// Animation timing function
|
|
32
|
+
export declare const animationTimingRule: UtilityRule;
|
|
33
|
+
export declare const transformsRules: UtilityRule[];
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
// Typography utilities
|
|
2
|
+
export declare const fontFamilyRule: UtilityRule;
|
|
3
|
+
export declare const fontSmoothingRule: UtilityRule;
|
|
4
|
+
export declare const fontStyleRule: UtilityRule;
|
|
5
|
+
export declare const fontStretchRule: UtilityRule;
|
|
6
|
+
export declare const fontVariantNumericRule: UtilityRule;
|
|
7
|
+
export declare const letterSpacingRule: UtilityRule;
|
|
8
|
+
export declare const lineClampRule: UtilityRule;
|
|
9
|
+
export declare const listStyleImageRule: UtilityRule;
|
|
10
|
+
export declare const listStylePositionRule: UtilityRule;
|
|
11
|
+
export declare const listStyleTypeRule: UtilityRule;
|
|
12
|
+
export declare const textDecorationRule: UtilityRule;
|
|
13
|
+
export declare const underlineOffsetRule: UtilityRule;
|
|
14
|
+
export declare const textTransformRule: UtilityRule;
|
|
15
|
+
export declare const textOverflowRule: UtilityRule;
|
|
16
|
+
export declare const textWrapRule: UtilityRule;
|
|
17
|
+
export declare const textIndentRule: UtilityRule;
|
|
18
|
+
export declare const verticalAlignRule: UtilityRule;
|
|
19
|
+
export declare const whiteSpaceRule: UtilityRule;
|
|
20
|
+
export declare const wordBreakRule: UtilityRule;
|
|
21
|
+
export declare const overflowWrapRule: UtilityRule;
|
|
22
|
+
export declare const hyphensRule: UtilityRule;
|
|
23
|
+
export declare const contentRule: UtilityRule;
|
|
24
|
+
export declare const lineHeightRule: UtilityRule;
|
|
25
|
+
// Writing mode
|
|
26
|
+
export declare const writingModeRule: UtilityRule;
|
|
27
|
+
// Text orientation
|
|
28
|
+
export declare const textOrientationRule: UtilityRule;
|
|
29
|
+
// Direction (ltr/rtl)
|
|
30
|
+
export declare const directionRule: UtilityRule;
|
|
31
|
+
// Text emphasis
|
|
32
|
+
export declare const textEmphasisRule: UtilityRule;
|
|
33
|
+
// Text emphasis color
|
|
34
|
+
export declare const textEmphasisColorRule: UtilityRule;
|
|
35
|
+
// Word spacing
|
|
36
|
+
export declare const wordSpacingRule: UtilityRule;
|
|
37
|
+
// Font variant caps
|
|
38
|
+
export declare const fontVariantCapsRule: UtilityRule;
|
|
39
|
+
// Font variant ligatures
|
|
40
|
+
export declare const fontVariantLigaturesRule: UtilityRule;
|
|
41
|
+
export declare const typographyRules: UtilityRule[];
|
package/dist/rules.d.ts
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type { CrosswindConfig, ParsedClass, UtilityRuleResult } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Built-in utility rules
|
|
4
|
+
* Each rule checks if it matches the parsed class and returns CSS properties
|
|
5
|
+
*/
|
|
6
|
+
// Display utilities
|
|
7
|
+
export declare const displayRule: UtilityRule;
|
|
8
|
+
// Container utilities (for container queries)
|
|
9
|
+
export declare const containerRule: UtilityRule;
|
|
10
|
+
// Flexbox utilities
|
|
11
|
+
export declare const flexDirectionRule: UtilityRule;
|
|
12
|
+
export declare const flexWrapRule: UtilityRule;
|
|
13
|
+
export declare const flexRule: UtilityRule;
|
|
14
|
+
export declare const flexGrowRule: UtilityRule;
|
|
15
|
+
export declare const flexShrinkRule: UtilityRule;
|
|
16
|
+
export declare const justifyContentRule: UtilityRule;
|
|
17
|
+
export declare const alignItemsRule: UtilityRule;
|
|
18
|
+
export declare const justifyItemsRule: UtilityRule;
|
|
19
|
+
export declare const alignContentRule: UtilityRule;
|
|
20
|
+
// Spacing utilities (margin, padding)
|
|
21
|
+
export declare const spacingRule: UtilityRule;
|
|
22
|
+
// Width and height utilities
|
|
23
|
+
export declare const sizingRule: UtilityRule;
|
|
24
|
+
export declare const colorRule: UtilityRule;
|
|
25
|
+
// Placeholder color utilities (placeholder-{color})
|
|
26
|
+
export declare const placeholderColorRule: UtilityRule;
|
|
27
|
+
// Typography utilities
|
|
28
|
+
export declare const fontSizeRule: UtilityRule;
|
|
29
|
+
export declare const fontWeightRule: UtilityRule;
|
|
30
|
+
export declare const leadingRule: UtilityRule;
|
|
31
|
+
export declare const textAlignRule: UtilityRule;
|
|
32
|
+
// Border utilities
|
|
33
|
+
export declare const borderWidthRule: UtilityRule;
|
|
34
|
+
// Border side width utilities (border-t-0, border-r-2, border-x-4, etc.)
|
|
35
|
+
export declare const borderSideWidthRule: UtilityRule;
|
|
36
|
+
export declare const borderRadiusRule: UtilityRule;
|
|
37
|
+
// Export all rules (order matters - more specific rules first)
|
|
38
|
+
export declare const builtInRules: UtilityRule[];
|
|
39
|
+
export type UtilityRule = (parsed: ParsedClass, config: CrosswindConfig) => Record<string, string> | UtilityRuleResult | undefined
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { CompileClassTransformer } from './transformer-compile-class';
|
|
2
|
+
import type { ExtractClassesOptions } from './parser';
|
|
3
|
+
export declare interface ScanResult {
|
|
4
|
+
classes: Set<string>
|
|
5
|
+
transformedFiles: Map<string, string>
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Scans files for utility classes using Bun's fast Glob API
|
|
9
|
+
*/
|
|
10
|
+
export declare class Scanner {
|
|
11
|
+
private patterns: string[];
|
|
12
|
+
private transformer?: CompileClassTransformer | null | undefined;
|
|
13
|
+
private extractOptions?: ExtractClassesOptions | undefined;
|
|
14
|
+
constructor(patterns: string[], transformer?: CompileClassTransformer | null | undefined, extractOptions?: ExtractClassesOptions | undefined);
|
|
15
|
+
scan(): Promise<ScanResult>;
|
|
16
|
+
scanFile(filePath: string): Promise<Set<string>>;
|
|
17
|
+
scanContent(content: string): Set<string>;
|
|
18
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { CrosswindConfig } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Extract compile class markers from content
|
|
4
|
+
*/
|
|
5
|
+
export declare function extractCompileClasses(content: string, options?: CompileClassOptions): Map<string, string[]>;
|
|
6
|
+
/**
|
|
7
|
+
* Transform content by replacing compile markers with generated class names
|
|
8
|
+
*/
|
|
9
|
+
export declare function transformContent(content: string, compiledClassMap: Map<string, string>, options?: CompileClassOptions): string;
|
|
10
|
+
/**
|
|
11
|
+
* Generate class names for compiled classes
|
|
12
|
+
*/
|
|
13
|
+
export declare function generateCompiledClassNames(compiledClasses: Map<string, string[]>, options?: CompileClassOptions): Map<string, string>;
|
|
14
|
+
export declare interface CompileClassOptions {
|
|
15
|
+
trigger?: string
|
|
16
|
+
classPrefix?: string
|
|
17
|
+
hashFn?: (content: string) => string
|
|
18
|
+
layer?: string
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Main transformer class
|
|
22
|
+
*/
|
|
23
|
+
export declare class CompileClassTransformer {
|
|
24
|
+
private compiledClasses: any;
|
|
25
|
+
private classNameMap: any;
|
|
26
|
+
private options: CompileClassOptions;
|
|
27
|
+
constructor(options?: CompileClassOptions);
|
|
28
|
+
processFile(content: string): { content: string, hasChanges: boolean };
|
|
29
|
+
getCompiledClasses(): Map<string, { className: string, utilities: string[] }>;
|
|
30
|
+
generateCSS(config: CrosswindConfig, generator: any): string;
|
|
31
|
+
reset(): void;
|
|
32
|
+
getStats(): {
|
|
33
|
+
totalGroups: number
|
|
34
|
+
totalUtilities: number
|
|
35
|
+
averageUtilitiesPerGroup: number
|
|
36
|
+
};
|
|
37
|
+
}
|
|
@@ -1,68 +1,20 @@
|
|
|
1
|
-
export interface CompileClassConfig {
|
|
2
|
-
/**
|
|
3
|
-
* Enable compile class transformer
|
|
4
|
-
* @default false
|
|
5
|
-
*/
|
|
1
|
+
export declare interface CompileClassConfig {
|
|
6
2
|
enabled?: boolean
|
|
7
|
-
/**
|
|
8
|
-
* Trigger string to mark classes for compilation
|
|
9
|
-
* @default ':hw:'
|
|
10
|
-
*/
|
|
11
3
|
trigger?: string
|
|
12
|
-
/**
|
|
13
|
-
* Prefix for generated class names
|
|
14
|
-
* @default 'hw-'
|
|
15
|
-
*/
|
|
16
4
|
classPrefix?: string
|
|
17
|
-
/**
|
|
18
|
-
* Layer name for compiled classes
|
|
19
|
-
* @default 'shortcuts'
|
|
20
|
-
*/
|
|
21
5
|
layer?: string
|
|
22
6
|
}
|
|
23
|
-
|
|
24
|
-
export interface AttributifyConfig {
|
|
25
|
-
/**
|
|
26
|
-
* Enable attributify mode
|
|
27
|
-
* Allows using HTML attributes instead of class names
|
|
28
|
-
* e.g., <div hw-flex hw-bg="blue-500">
|
|
29
|
-
* @default false
|
|
30
|
-
*/
|
|
7
|
+
export declare interface AttributifyConfig {
|
|
31
8
|
enabled?: boolean
|
|
32
|
-
/**
|
|
33
|
-
* Prefix for attributify attributes (to avoid conflicts with HTML attributes)
|
|
34
|
-
* e.g., with prefix 'hw-': <div hw-flex hw-bg="blue-500">
|
|
35
|
-
* @default 'hw-'
|
|
36
|
-
*/
|
|
37
9
|
prefix?: string
|
|
38
|
-
/**
|
|
39
|
-
* Attributes to ignore (won't be treated as utilities)
|
|
40
|
-
* @default ['class', 'className', 'style', 'id', ...]
|
|
41
|
-
*/
|
|
42
10
|
ignoreAttributes?: string[]
|
|
43
11
|
}
|
|
44
|
-
|
|
45
|
-
export interface BracketSyntaxConfig {
|
|
46
|
-
/**
|
|
47
|
-
* Enable bracket/grouped syntax
|
|
48
|
-
* Allows grouping utilities like: flex[col jc-center ai-center] or text[white 2rem 700]
|
|
49
|
-
* @default false
|
|
50
|
-
*/
|
|
12
|
+
export declare interface BracketSyntaxConfig {
|
|
51
13
|
enabled?: boolean
|
|
52
|
-
/**
|
|
53
|
-
* Enable colon syntax for simple values
|
|
54
|
-
* e.g., bg:black, w:100%, text:white
|
|
55
|
-
* @default false
|
|
56
|
-
*/
|
|
57
14
|
colonSyntax?: boolean
|
|
58
|
-
/**
|
|
59
|
-
* Mapping of shorthand abbreviations to full utility names
|
|
60
|
-
* e.g., { 'jc': 'justify', 'ai': 'items', 'col': 'col' }
|
|
61
|
-
*/
|
|
62
15
|
aliases?: Record<string, string>
|
|
63
16
|
}
|
|
64
|
-
|
|
65
|
-
export interface CrosswindConfig {
|
|
17
|
+
export declare interface CrosswindConfig {
|
|
66
18
|
content: string[]
|
|
67
19
|
output: string
|
|
68
20
|
minify: boolean
|
|
@@ -79,11 +31,9 @@ export interface CrosswindConfig {
|
|
|
79
31
|
compileClass?: CompileClassConfig
|
|
80
32
|
attributify?: AttributifyConfig
|
|
81
33
|
bracketSyntax?: BracketSyntaxConfig
|
|
82
|
-
/** Generate :root CSS variables from theme colors (e.g., --monokai-bg: #2d2a2e) */
|
|
83
34
|
cssVariables?: boolean
|
|
84
35
|
}
|
|
85
|
-
|
|
86
|
-
export interface Theme {
|
|
36
|
+
export declare interface Theme {
|
|
87
37
|
colors: Record<string, string | Record<string, string>>
|
|
88
38
|
spacing: Record<string, string>
|
|
89
39
|
fontSize: Record<string, [string, { lineHeight: string }]>
|
|
@@ -91,25 +41,20 @@ export interface Theme {
|
|
|
91
41
|
screens: Record<string, string>
|
|
92
42
|
borderRadius: Record<string, string>
|
|
93
43
|
boxShadow: Record<string, string>
|
|
94
|
-
/** Extend theme values without replacing defaults */
|
|
95
44
|
extend?: Partial<Omit<Theme, 'extend'>>
|
|
96
45
|
}
|
|
97
|
-
|
|
98
|
-
export interface VariantConfig {
|
|
46
|
+
export declare interface VariantConfig {
|
|
99
47
|
'responsive': boolean
|
|
100
48
|
'hover': boolean
|
|
101
49
|
'focus': boolean
|
|
102
50
|
'active': boolean
|
|
103
51
|
'disabled': boolean
|
|
104
52
|
'dark': boolean
|
|
105
|
-
// Group/Peer
|
|
106
53
|
'group': boolean
|
|
107
54
|
'peer': boolean
|
|
108
|
-
// Pseudo-elements
|
|
109
55
|
'before': boolean
|
|
110
56
|
'after': boolean
|
|
111
57
|
'marker': boolean
|
|
112
|
-
// Pseudo-classes - Basic
|
|
113
58
|
'first': boolean
|
|
114
59
|
'last': boolean
|
|
115
60
|
'odd': boolean
|
|
@@ -120,7 +65,6 @@ export interface VariantConfig {
|
|
|
120
65
|
'checked': boolean
|
|
121
66
|
'focus-within': boolean
|
|
122
67
|
'focus-visible': boolean
|
|
123
|
-
// Pseudo-classes - Form states
|
|
124
68
|
'placeholder': boolean
|
|
125
69
|
'selection': boolean
|
|
126
70
|
'file': boolean
|
|
@@ -129,7 +73,6 @@ export interface VariantConfig {
|
|
|
129
73
|
'invalid': boolean
|
|
130
74
|
'read-only': boolean
|
|
131
75
|
'autofill': boolean
|
|
132
|
-
// Pseudo-classes - Additional states
|
|
133
76
|
'open': boolean
|
|
134
77
|
'closed': boolean
|
|
135
78
|
'empty': boolean
|
|
@@ -139,49 +82,38 @@ export interface VariantConfig {
|
|
|
139
82
|
'indeterminate': boolean
|
|
140
83
|
'default': boolean
|
|
141
84
|
'optional': boolean
|
|
142
|
-
// Media
|
|
143
85
|
'print': boolean
|
|
144
|
-
// Direction
|
|
145
86
|
'rtl': boolean
|
|
146
87
|
'ltr': boolean
|
|
147
|
-
// Motion
|
|
148
88
|
'motion-safe': boolean
|
|
149
89
|
'motion-reduce': boolean
|
|
150
|
-
// Contrast
|
|
151
90
|
'contrast-more': boolean
|
|
152
91
|
'contrast-less': boolean
|
|
153
92
|
}
|
|
154
|
-
|
|
155
|
-
export interface ParsedClass {
|
|
93
|
+
export declare interface ParsedClass {
|
|
156
94
|
raw: string
|
|
157
95
|
variants: string[]
|
|
158
96
|
utility: string
|
|
159
97
|
value?: string
|
|
160
98
|
important: boolean
|
|
161
99
|
arbitrary: boolean
|
|
162
|
-
typeHint?: string
|
|
100
|
+
typeHint?: string
|
|
163
101
|
}
|
|
164
|
-
|
|
165
|
-
export interface CSSRule {
|
|
102
|
+
export declare interface CSSRule {
|
|
166
103
|
selector: string
|
|
167
104
|
properties: Record<string, string>
|
|
168
105
|
mediaQuery?: string
|
|
169
|
-
childSelector?: string
|
|
106
|
+
childSelector?: string
|
|
170
107
|
}
|
|
171
|
-
|
|
172
|
-
export interface UtilityRuleResult {
|
|
108
|
+
export declare interface UtilityRuleResult {
|
|
173
109
|
properties: Record<string, string>
|
|
174
110
|
childSelector?: string
|
|
175
|
-
pseudoElement?: string
|
|
111
|
+
pseudoElement?: string
|
|
176
112
|
}
|
|
177
|
-
|
|
178
|
-
export type CustomRule = [RegExp, (match: RegExpMatchArray) => Record<string, string> | undefined]
|
|
179
|
-
|
|
180
|
-
export interface Preflight {
|
|
113
|
+
export declare interface Preflight {
|
|
181
114
|
getCSS: () => string
|
|
182
115
|
}
|
|
183
|
-
|
|
184
|
-
export interface Preset {
|
|
116
|
+
export declare interface Preset {
|
|
185
117
|
name: string
|
|
186
118
|
theme?: Partial<Theme>
|
|
187
119
|
rules?: CustomRule[]
|
|
@@ -189,9 +121,8 @@ export interface Preset {
|
|
|
189
121
|
variants?: Partial<VariantConfig>
|
|
190
122
|
preflights?: Preflight[]
|
|
191
123
|
}
|
|
192
|
-
|
|
193
|
-
type DeepPartial<T> = {
|
|
124
|
+
export type CustomRule = [RegExp, (match: RegExpMatchArray) => Record<string, string> | undefined]
|
|
125
|
+
declare type DeepPartial<T> = {
|
|
194
126
|
[P in keyof T]?: T[P] extends object ? DeepPartial<T[P]> : T[P]
|
|
195
127
|
}
|
|
196
|
-
|
|
197
|
-
export type CrosswindOptions = DeepPartial<CrosswindConfig>
|
|
128
|
+
export type CrosswindOptions = DeepPartial<CrosswindConfig>
|
package/package.json
CHANGED