@pandacss/node 0.0.0-dev-20230122144203 → 0.0.0-dev-20230124104736
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/index.d.ts +27 -16
- package/dist/index.js +294 -209
- package/dist/index.mjs +293 -209
- package/package.json +11 -11
package/dist/index.js
CHANGED
|
@@ -32,6 +32,7 @@ __export(src_exports, {
|
|
|
32
32
|
emitAndExtract: () => emitAndExtract,
|
|
33
33
|
emitArtifacts: () => emitArtifacts,
|
|
34
34
|
execCommand: () => execCommand,
|
|
35
|
+
extractCss: () => extractCss,
|
|
35
36
|
generate: () => generate5,
|
|
36
37
|
loadConfigAndCreateContext: () => loadConfigAndCreateContext,
|
|
37
38
|
setupConfig: () => setupConfig,
|
|
@@ -115,7 +116,7 @@ async function extractChunks(ctx) {
|
|
|
115
116
|
}
|
|
116
117
|
async function bundleChunks(ctx) {
|
|
117
118
|
const css2 = await extractChunks(ctx);
|
|
118
|
-
await ctx.write(ctx.
|
|
119
|
+
await ctx.write(ctx.paths.root, [{ file: "styles.css", code: css2 }]);
|
|
119
120
|
}
|
|
120
121
|
async function writeFileChunk(ctx, file) {
|
|
121
122
|
import_logger2.logger.info(`File changed: ${file}`);
|
|
@@ -135,7 +136,8 @@ function generateConditions(ctx) {
|
|
|
135
136
|
const keys = Object.keys(ctx.conditions.values).concat("base");
|
|
136
137
|
return {
|
|
137
138
|
js: import_outdent.default`
|
|
138
|
-
|
|
139
|
+
${ctx.getImport("withoutSpace", "../helpers")}
|
|
140
|
+
|
|
139
141
|
const conditions = new Set([${keys.map((key) => JSON.stringify(key))}])
|
|
140
142
|
|
|
141
143
|
export function isCondition(value){
|
|
@@ -203,12 +205,12 @@ function generateCssFn(ctx) {
|
|
|
203
205
|
const { separator } = utility;
|
|
204
206
|
return {
|
|
205
207
|
dts: import_outdent2.outdent`
|
|
206
|
-
import { SystemStyleObject } from '../types'
|
|
208
|
+
import type { SystemStyleObject } from '../types'
|
|
207
209
|
export declare function css(styles: SystemStyleObject): string
|
|
208
210
|
`,
|
|
209
211
|
js: import_outdent2.outdent`
|
|
210
|
-
|
|
211
|
-
|
|
212
|
+
${ctx.getImport("createCss, createMergeCss, withoutSpace", "../helpers")}
|
|
213
|
+
${ctx.getImport("sortConditions, finalizeConditions", "./conditions")}
|
|
212
214
|
|
|
213
215
|
const classNameMap = ${stringify(utility.entries())}
|
|
214
216
|
|
|
@@ -250,11 +252,11 @@ function generateCssFn(ctx) {
|
|
|
250
252
|
|
|
251
253
|
// src/generators/cva.ts
|
|
252
254
|
var import_outdent3 = require("outdent");
|
|
253
|
-
function generateCvaFn() {
|
|
255
|
+
function generateCvaFn(ctx) {
|
|
254
256
|
return {
|
|
255
257
|
js: import_outdent3.outdent`
|
|
256
|
-
|
|
257
|
-
|
|
258
|
+
${ctx.getImport("compact", "../helpers")}
|
|
259
|
+
${ctx.getImport("css, mergeCss", "./css")}
|
|
258
260
|
|
|
259
261
|
export function cva(config) {
|
|
260
262
|
const { base = {}, variants = {}, defaultVariants = {} } = config
|
|
@@ -283,7 +285,7 @@ function generateCvaFn() {
|
|
|
283
285
|
}
|
|
284
286
|
`,
|
|
285
287
|
dts: import_outdent3.outdent`
|
|
286
|
-
import { RecipeCreatorFn } from '../types/recipe'
|
|
288
|
+
import type { RecipeCreatorFn } from '../types/recipe'
|
|
287
289
|
|
|
288
290
|
export declare const cva: RecipeCreatorFn
|
|
289
291
|
|
|
@@ -362,9 +364,9 @@ function generatePreactJsxFactory(ctx) {
|
|
|
362
364
|
import { h } from 'preact'
|
|
363
365
|
import { forwardRef } from 'preact/compat'
|
|
364
366
|
import { useMemo } from 'preact/hooks'
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
367
|
+
${ctx.getImport("css, cx, assignCss", "../css/index")}
|
|
368
|
+
${ctx.getImport("splitProps, normalizeHTMLProps", "../helpers")}
|
|
369
|
+
${ctx.getImport("isCssProperty", "./is-valid-prop")}
|
|
368
370
|
|
|
369
371
|
function styled(Dynamic, configOrCva = {}) {
|
|
370
372
|
const cvaFn = configOrCva.__cva__ ? configOrCva : cva(configOrCva)
|
|
@@ -376,7 +378,7 @@ function generatePreactJsxFactory(ctx) {
|
|
|
376
378
|
return splitProps(restProps, isCssProperty, cvaFn.variants, normalizeHTMLProps.keys)
|
|
377
379
|
}, [restProps])
|
|
378
380
|
|
|
379
|
-
function classes(){
|
|
381
|
+
function classes() {
|
|
380
382
|
const { css: cssStyles, ...propStyles } = styleProps
|
|
381
383
|
const cvaStyles = cvaFn.resolve(variantProps)
|
|
382
384
|
const styles = assignCss(cvaStyles, propStyles, cssStyles)
|
|
@@ -478,29 +480,30 @@ function generate(ctx, name, pattern) {
|
|
|
478
480
|
return {
|
|
479
481
|
name: dashName,
|
|
480
482
|
js: import_outdent7.outdent`
|
|
483
|
+
import { h } from 'preact'
|
|
481
484
|
import { forwardRef } from 'preact/compat'
|
|
482
|
-
|
|
483
|
-
|
|
485
|
+
${ctx.getImport(ctx.jsxFactory, "./factory")}
|
|
486
|
+
${ctx.getImport(styleFn, `../patterns/${dashName}`)}
|
|
484
487
|
|
|
485
488
|
export const ${jsxName} = forwardRef(function ${jsxName}(props, ref) {
|
|
486
489
|
${(0, import_ts_pattern.match)(props.length).with(
|
|
487
490
|
0,
|
|
488
491
|
() => import_outdent7.outdent`
|
|
489
|
-
return
|
|
492
|
+
return h(${ctx.jsxFactory}.div, { ref, ...props })
|
|
490
493
|
`
|
|
491
494
|
).otherwise(
|
|
492
495
|
() => import_outdent7.outdent`
|
|
493
496
|
const { ${props.join(", ")}, ...restProps } = props
|
|
494
497
|
const styleProps = ${styleFn}({${props.join(", ")}})
|
|
495
|
-
return
|
|
498
|
+
return h(${ctx.jsxFactory}.div, { ref, ...styleProps, ...restProps })
|
|
496
499
|
`
|
|
497
500
|
)}
|
|
498
501
|
})
|
|
499
502
|
`,
|
|
500
503
|
dts: import_outdent7.outdent`
|
|
501
|
-
import { FunctionComponent } from 'preact'
|
|
502
|
-
import { ${upperName}Properties } from '../patterns/${dashName}'
|
|
503
|
-
import { ${typeName} } from '../types/jsx'
|
|
504
|
+
import type { FunctionComponent } from 'preact'
|
|
505
|
+
import type { ${upperName}Properties } from '../patterns/${dashName}'
|
|
506
|
+
import type { ${typeName} } from '../types/jsx'
|
|
504
507
|
|
|
505
508
|
export type ${upperName}Props = ${upperName}Properties & Omit<${typeName}<'div'>, keyof ${upperName}Properties ${blocklistType}>
|
|
506
509
|
|
|
@@ -519,25 +522,25 @@ function generatePreactJsxTypes(ctx) {
|
|
|
519
522
|
const { name, componentName, upperName, typeName } = ctx.jsxFactoryDetails;
|
|
520
523
|
return {
|
|
521
524
|
jsxFactory: import_outdent8.outdent`
|
|
522
|
-
import { ${upperName} } from '../types/jsx'
|
|
525
|
+
import type { ${upperName} } from '../types/jsx'
|
|
523
526
|
export declare const ${name}: ${upperName}
|
|
524
527
|
`,
|
|
525
528
|
jsxType: import_outdent8.outdent`
|
|
526
|
-
import { JSX, ComponentProps } from 'preact'
|
|
527
|
-
import { JsxStyleProps, Assign } from '.'
|
|
528
|
-
import { RecipeDefinition, RecipeSelection, RecipeVariantRecord } from './recipe'
|
|
529
|
+
import type { JSX, ComponentProps } from 'preact'
|
|
530
|
+
import type { JsxStyleProps, Assign } from '.'
|
|
531
|
+
import type { RecipeDefinition, RecipeSelection, RecipeVariantRecord } from './recipe'
|
|
529
532
|
|
|
530
533
|
type Dict = Record<string, unknown>
|
|
531
534
|
type ElementType = keyof JSX.IntrinsicElements
|
|
532
535
|
|
|
533
|
-
type
|
|
536
|
+
type HTMLProps = {
|
|
534
537
|
htmlSize?: string | number
|
|
535
538
|
htmlWidth?: string | number
|
|
536
539
|
htmlHeight?: string | number
|
|
537
540
|
htmlTranslate?: 'yes' | 'no' | undefined
|
|
538
541
|
}
|
|
539
542
|
|
|
540
|
-
type Polyfill<T> = Omit<T, 'color' | 'translate' | 'transition' | 'width' | 'height' | 'size'> &
|
|
543
|
+
type Polyfill<T> = Omit<T, 'color' | 'translate' | 'transition' | 'width' | 'height' | 'size'> & HTMLProps
|
|
541
544
|
|
|
542
545
|
type Props<T extends Dict, P extends Dict = {}> = Assign<Polyfill<T>, P>
|
|
543
546
|
|
|
@@ -561,10 +564,10 @@ function generateReactJsxFactory(ctx) {
|
|
|
561
564
|
const { name, componentName } = ctx.jsxFactoryDetails;
|
|
562
565
|
return {
|
|
563
566
|
js: import_outdent9.outdent`
|
|
564
|
-
import { forwardRef, useMemo } from 'react'
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
567
|
+
import { createElement, forwardRef, useMemo } from 'react'
|
|
568
|
+
${ctx.getImport("css, cx, cva, assignCss", "../css/index")}
|
|
569
|
+
${ctx.getImport("splitProps, normalizeHTMLProps", "../helpers")}
|
|
570
|
+
${ctx.getImport("isCssProperty", "./is-valid-prop")}
|
|
568
571
|
|
|
569
572
|
function styled(Dynamic, configOrCva = {}) {
|
|
570
573
|
const cvaFn = configOrCva.__cva__ ? configOrCva : cva(configOrCva)
|
|
@@ -576,21 +579,19 @@ function generateReactJsxFactory(ctx) {
|
|
|
576
579
|
return splitProps(restProps, isCssProperty, cvaFn.variants, normalizeHTMLProps.keys)
|
|
577
580
|
}, [restProps])
|
|
578
581
|
|
|
579
|
-
function classes(){
|
|
582
|
+
function classes() {
|
|
580
583
|
const { css: cssStyles, ...propStyles } = styleProps
|
|
581
584
|
const cvaStyles = cvaFn.resolve(variantProps)
|
|
582
585
|
const styles = assignCss(cvaStyles, propStyles, cssStyles)
|
|
583
586
|
return cx(css(styles), elementProps.className)
|
|
584
587
|
}
|
|
585
588
|
|
|
586
|
-
return(
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
/>
|
|
593
|
-
)
|
|
589
|
+
return createElement(Element, {
|
|
590
|
+
ref,
|
|
591
|
+
...elementProps,
|
|
592
|
+
...normalizeHTMLProps(htmlProps),
|
|
593
|
+
className: classes(),
|
|
594
|
+
})
|
|
594
595
|
})
|
|
595
596
|
|
|
596
597
|
${componentName}.displayName = \`${name}.\${Dynamic}\`
|
|
@@ -636,38 +637,37 @@ function generateReactLayoutGrid() {
|
|
|
636
637
|
export declare const LayoutGrid: FunctionComponent<LayoutGridProps>
|
|
637
638
|
`,
|
|
638
639
|
js: import_outdent10.outdent`
|
|
640
|
+
import { createElement } from 'react'
|
|
641
|
+
|
|
639
642
|
export function LayoutGrid(props) {
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
643
|
+
const { count = 12, margin, gutter = '24px', maxWidth } = props
|
|
644
|
+
const hasMaxWidth = maxWidth != null
|
|
645
|
+
return createElement('div', {
|
|
646
|
+
style: {
|
|
647
|
+
display: 'grid',
|
|
648
|
+
gap: gutter,
|
|
649
|
+
gridTemplateColumns: \`repeat(\${count}, 1fr)\`,
|
|
650
|
+
height: '100%',
|
|
651
|
+
width: '100%',
|
|
652
|
+
position: 'absolute',
|
|
653
|
+
inset: '0',
|
|
654
|
+
pointerEvents: 'none',
|
|
655
|
+
maxWidth: hasMaxWidth ? maxWidth : 'initial',
|
|
656
|
+
marginInline: hasMaxWidth ? 'auto' : undefined,
|
|
657
|
+
paddingInline: !hasMaxWidth ? margin : undefined,
|
|
658
|
+
},
|
|
659
|
+
children: Array.from({ length: count }).map((_, i) =>
|
|
660
|
+
createElement('span', {
|
|
661
|
+
key: i,
|
|
662
|
+
style: {
|
|
663
|
+
display: 'flex',
|
|
664
|
+
background: 'rgba(255, 0, 0, 0.1)',
|
|
648
665
|
height: '100%',
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
marginInline: hasMaxWidth ? 'auto' : undefined,
|
|
655
|
-
paddingInline: !hasMaxWidth ? margin : undefined,
|
|
656
|
-
}}
|
|
657
|
-
>
|
|
658
|
-
{Array.from({ length: count }).map((_, i) => (
|
|
659
|
-
<span
|
|
660
|
-
key={i}
|
|
661
|
-
style={{
|
|
662
|
-
display: 'flex',
|
|
663
|
-
background: 'rgba(255, 0, 0, 0.1)',
|
|
664
|
-
height: '100%',
|
|
665
|
-
}}
|
|
666
|
-
/>
|
|
667
|
-
))}
|
|
668
|
-
</div>
|
|
669
|
-
);
|
|
670
|
-
}
|
|
666
|
+
},
|
|
667
|
+
}),
|
|
668
|
+
),
|
|
669
|
+
})
|
|
670
|
+
}
|
|
671
671
|
`
|
|
672
672
|
};
|
|
673
673
|
}
|
|
@@ -681,30 +681,29 @@ function generate2(ctx, name, pattern) {
|
|
|
681
681
|
return {
|
|
682
682
|
name: dashName,
|
|
683
683
|
js: import_outdent11.outdent`
|
|
684
|
-
import { forwardRef } from 'react'
|
|
685
|
-
|
|
686
|
-
|
|
684
|
+
import { createElement, forwardRef } from 'react'
|
|
685
|
+
${ctx.getImport(ctx.jsxFactory, "./factory")}
|
|
686
|
+
${ctx.getImport(styleFn, `../patterns/${dashName}`)}
|
|
687
687
|
|
|
688
688
|
export const ${jsxName} = forwardRef(function ${jsxName}(props, ref) {
|
|
689
689
|
${(0, import_ts_pattern2.match)(props.length).with(
|
|
690
690
|
0,
|
|
691
691
|
() => import_outdent11.outdent`
|
|
692
|
-
|
|
692
|
+
return createElement(${ctx.jsxFactory}.div, { ref, ...props })
|
|
693
693
|
`
|
|
694
694
|
).otherwise(
|
|
695
695
|
() => import_outdent11.outdent`
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
696
|
+
const { ${props.join(", ")}, ...restProps } = props
|
|
697
|
+
const styleProps = ${styleFn}({${props.join(", ")}})
|
|
698
|
+
return createElement(${ctx.jsxFactory}.div, { ref, ...styleProps, ...restProps })
|
|
699
699
|
`
|
|
700
700
|
)}
|
|
701
|
-
|
|
702
701
|
})
|
|
703
702
|
`,
|
|
704
703
|
dts: import_outdent11.outdent`
|
|
705
|
-
import { FunctionComponent } from 'react'
|
|
706
|
-
import { ${upperName}Properties } from '../patterns/${dashName}'
|
|
707
|
-
import { ${typeName} } from '../types/jsx'
|
|
704
|
+
import type { FunctionComponent } from 'react'
|
|
705
|
+
import type { ${upperName}Properties } from '../patterns/${dashName}'
|
|
706
|
+
import type { ${typeName} } from '../types/jsx'
|
|
708
707
|
|
|
709
708
|
export type ${upperName}Props = ${upperName}Properties & Omit<${typeName}<'div'>, keyof ${upperName}Properties ${blocklistType}>
|
|
710
709
|
|
|
@@ -727,20 +726,20 @@ import { ${upperName} } from '../types/jsx'
|
|
|
727
726
|
export declare const ${name}: ${upperName}
|
|
728
727
|
`,
|
|
729
728
|
jsxType: import_outdent12.outdent`
|
|
730
|
-
import { ElementType, ComponentProps } from 'react'
|
|
731
|
-
import { JsxStyleProps, Assign } from '.'
|
|
732
|
-
import { RecipeDefinition, RecipeSelection, RecipeVariantRecord, RecipeRuntimeFn } from './recipe'
|
|
729
|
+
import type { ElementType, ComponentProps } from 'react'
|
|
730
|
+
import type { JsxStyleProps, Assign } from '.'
|
|
731
|
+
import type { RecipeDefinition, RecipeSelection, RecipeVariantRecord, RecipeRuntimeFn } from './recipe'
|
|
733
732
|
|
|
734
733
|
type Dict = Record<string, unknown>
|
|
735
734
|
|
|
736
|
-
type
|
|
735
|
+
type HTMLProps = {
|
|
737
736
|
htmlSize?: string | number
|
|
738
737
|
htmlWidth?: string | number
|
|
739
738
|
htmlHeight?: string | number
|
|
740
739
|
htmlTranslate?: 'yes' | 'no' | undefined
|
|
741
740
|
}
|
|
742
741
|
|
|
743
|
-
type Polyfill<T> = Omit<T, 'color' | 'translate' | 'transition' | 'width' | 'height' | 'size'> &
|
|
742
|
+
type Polyfill<T> = Omit<T, 'color' | 'translate' | 'transition' | 'width' | 'height' | 'size'> & HTMLProps
|
|
744
743
|
|
|
745
744
|
type Props<T extends Dict, P extends Dict = {}> = Assign<Polyfill<T>, P>
|
|
746
745
|
|
|
@@ -766,9 +765,10 @@ function generateSolidJsxFactory(ctx) {
|
|
|
766
765
|
js: import_outdent13.outdent`
|
|
767
766
|
import { Dynamic } from 'solid-js/web'
|
|
768
767
|
import { mergeProps, splitProps } from 'solid-js'
|
|
769
|
-
import {
|
|
770
|
-
|
|
771
|
-
|
|
768
|
+
import { createComponent } from 'solid-js/web'
|
|
769
|
+
${ctx.getImport("css, cx, cva, assignCss", "../css/index")}
|
|
770
|
+
${ctx.getImport("normalizeHTMLProps", "../helpers")}
|
|
771
|
+
${ctx.getImport("allCssProperties", "./is-valid-prop")}
|
|
772
772
|
|
|
773
773
|
function styled(element, configOrCva = {}) {
|
|
774
774
|
const cvaFn = configOrCva.__cva__ ? configOrCva : cva(configOrCva)
|
|
@@ -776,10 +776,11 @@ function generateSolidJsxFactory(ctx) {
|
|
|
776
776
|
return function ${componentName}(props) {
|
|
777
777
|
const mergedProps = mergeProps({ as: element }, props)
|
|
778
778
|
|
|
779
|
-
const [localProps, styleProps, htmlProps, elementProps] = splitProps(
|
|
779
|
+
const [localProps, styleProps, variantProps, htmlProps, elementProps] = splitProps(
|
|
780
780
|
mergedProps,
|
|
781
781
|
['as', 'class'],
|
|
782
782
|
allCssProperties,
|
|
783
|
+
cvaFn.variants,
|
|
783
784
|
normalizeHTMLProps.keys
|
|
784
785
|
)
|
|
785
786
|
|
|
@@ -790,13 +791,20 @@ function generateSolidJsxFactory(ctx) {
|
|
|
790
791
|
return cx(css(styles), localProps.class)
|
|
791
792
|
}
|
|
792
793
|
|
|
793
|
-
return (
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
{
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
794
|
+
return createComponent(
|
|
795
|
+
Dynamic,
|
|
796
|
+
mergeProps(
|
|
797
|
+
{
|
|
798
|
+
get component() {
|
|
799
|
+
return localProps.as
|
|
800
|
+
},
|
|
801
|
+
get class() {
|
|
802
|
+
return classes()
|
|
803
|
+
}
|
|
804
|
+
},
|
|
805
|
+
elementProps,
|
|
806
|
+
normalizeHTMLProps(htmlProps)
|
|
807
|
+
)
|
|
800
808
|
)
|
|
801
809
|
}
|
|
802
810
|
}
|
|
@@ -827,7 +835,7 @@ var import_outdent14 = require("outdent");
|
|
|
827
835
|
function generateSolidLayoutGrid() {
|
|
828
836
|
return {
|
|
829
837
|
dts: import_outdent14.outdent`
|
|
830
|
-
import { ParentProps } from 'solid-js'
|
|
838
|
+
import type { ParentProps } from 'solid-js'
|
|
831
839
|
|
|
832
840
|
export type LayoutGridProps = {
|
|
833
841
|
count?: number
|
|
@@ -839,38 +847,43 @@ function generateSolidLayoutGrid() {
|
|
|
839
847
|
export declare const LayoutGrid: ParentProps<LayoutGridProps>
|
|
840
848
|
`,
|
|
841
849
|
js: import_outdent14.outdent`
|
|
850
|
+
import { createComponent, For } from 'solid-js/web'
|
|
851
|
+
|
|
842
852
|
export function LayoutGrid(props) {
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
853
|
+
const { count = 12, margin, gutter = '24px', maxWidth } = props
|
|
854
|
+
const hasMaxWidth = maxWidth != null
|
|
855
|
+
return createComponent('div', {
|
|
856
|
+
style: {
|
|
857
|
+
display: 'grid',
|
|
858
|
+
gap: gutter,
|
|
859
|
+
'grid-template-columns': \`repeat(\${count}, 1fr)\`,
|
|
860
|
+
height: '100%',
|
|
861
|
+
width: '100%',
|
|
862
|
+
position: 'absolute',
|
|
863
|
+
inset: '0',
|
|
864
|
+
'pointer-events': 'none',
|
|
865
|
+
'max-width': hasMaxWidth ? maxWidth : 'initial',
|
|
866
|
+
'margin-inline': hasMaxWidth ? 'auto' : undefined,
|
|
867
|
+
'padding-inline': !hasMaxWidth ? margin : undefined,
|
|
868
|
+
},
|
|
869
|
+
get children() {
|
|
870
|
+
return createComponent(For, {
|
|
871
|
+
get each() {
|
|
872
|
+
return Array.from({ length: count })
|
|
873
|
+
},
|
|
874
|
+
children: () =>
|
|
875
|
+
createComponent('span', {
|
|
876
|
+
style: {
|
|
865
877
|
display: 'flex',
|
|
866
878
|
background: 'rgba(255, 0, 0, 0.1)',
|
|
867
879
|
height: '100%',
|
|
868
|
-
}
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
880
|
+
},
|
|
881
|
+
}),
|
|
882
|
+
})
|
|
883
|
+
},
|
|
884
|
+
})
|
|
885
|
+
}
|
|
886
|
+
|
|
874
887
|
`
|
|
875
888
|
};
|
|
876
889
|
}
|
|
@@ -884,21 +897,22 @@ function generate3(ctx, name, pattern) {
|
|
|
884
897
|
return {
|
|
885
898
|
name: dashName,
|
|
886
899
|
js: import_outdent15.outdent`
|
|
887
|
-
import { splitProps } from 'solid-js'
|
|
888
|
-
import {
|
|
889
|
-
|
|
900
|
+
import { splitProps, mergeProps } from 'solid-js'
|
|
901
|
+
import { createComponent } from 'solid-js/web'
|
|
902
|
+
${ctx.getImport(ctx.jsxFactory, "./factory")}
|
|
903
|
+
${ctx.getImport(styleFn, `../patterns/${dashName}`)}
|
|
890
904
|
|
|
891
905
|
export function ${jsxName}(props) {
|
|
892
906
|
${(0, import_ts_pattern3.match)(props.length).with(
|
|
893
907
|
0,
|
|
894
908
|
() => import_outdent15.outdent`
|
|
895
|
-
return
|
|
909
|
+
return createComponent(${ctx.jsxFactory}.div, props)
|
|
896
910
|
`
|
|
897
911
|
).otherwise(
|
|
898
912
|
() => import_outdent15.outdent`
|
|
899
913
|
const [patternProps, restProps] = splitProps(props, [${props.map((v) => JSON.stringify(v)).join(", ")}]);
|
|
900
914
|
const styleProps = ${styleFn}(patternProps)
|
|
901
|
-
return
|
|
915
|
+
return createComponent(${ctx.jsxFactory}.div, mergeProps(styleProps, restProps))
|
|
902
916
|
`
|
|
903
917
|
)}
|
|
904
918
|
}
|
|
@@ -925,26 +939,26 @@ function generateSolidJsxTypes(ctx) {
|
|
|
925
939
|
const { name, componentName, upperName, typeName } = ctx.jsxFactoryDetails;
|
|
926
940
|
return {
|
|
927
941
|
jsxFactory: import_outdent16.outdent`
|
|
928
|
-
import { ${upperName} } from '../types/jsx'
|
|
942
|
+
import type { ${upperName} } from '../types/jsx'
|
|
929
943
|
export declare const ${name}: ${upperName}
|
|
930
944
|
`,
|
|
931
945
|
jsxType: import_outdent16.outdent`
|
|
932
|
-
import { JSX, ComponentProps, Component } from 'solid-js'
|
|
933
|
-
import { JsxStyleProps, Assign } from '.'
|
|
934
|
-
import { RecipeDefinition, RecipeSelection, RecipeVariantRecord } from './recipe'
|
|
946
|
+
import type { JSX, ComponentProps, Component } from 'solid-js'
|
|
947
|
+
import type { JsxStyleProps, Assign } from '.'
|
|
948
|
+
import type { RecipeDefinition, RecipeSelection, RecipeVariantRecord } from './recipe'
|
|
935
949
|
|
|
936
950
|
type Dict = Record<string, unknown>
|
|
937
951
|
|
|
938
952
|
type ElementType<P = any> = keyof JSX.IntrinsicElements | Component<P>
|
|
939
953
|
|
|
940
|
-
type
|
|
954
|
+
type HTMLProps = {
|
|
941
955
|
htmlSize?: string | number
|
|
942
956
|
htmlWidth?: string | number
|
|
943
957
|
htmlHeight?: string | number
|
|
944
958
|
htmlTranslate?: 'yes' | 'no' | undefined
|
|
945
959
|
}
|
|
946
960
|
|
|
947
|
-
type Polyfill<T> = Omit<T, 'color' | 'translate' | 'transition' | 'width' | 'height' | 'size'> &
|
|
961
|
+
type Polyfill<T> = Omit<T, 'color' | 'translate' | 'transition' | 'width' | 'height' | 'size'> & HTMLProps
|
|
948
962
|
|
|
949
963
|
type Props<T extends Dict, P extends Dict = {}> = Assign<Polyfill<T>, P>
|
|
950
964
|
|
|
@@ -1011,10 +1025,10 @@ function generate4(ctx, name, pattern) {
|
|
|
1011
1025
|
return {
|
|
1012
1026
|
name: (0, import_shared.dashCase)(name),
|
|
1013
1027
|
dts: import_outdent17.outdent`
|
|
1014
|
-
import { SystemStyleObject, ConditionalValue } from '../types'
|
|
1015
|
-
import { PropertyValue } from '../types/prop-type'
|
|
1016
|
-
import { Properties } from '../types/csstype'
|
|
1017
|
-
import { Tokens } from '../types/token'
|
|
1028
|
+
import type { SystemStyleObject, ConditionalValue } from '../types'
|
|
1029
|
+
import type { PropertyValue } from '../types/prop-type'
|
|
1030
|
+
import type { Properties } from '../types/csstype'
|
|
1031
|
+
import type { Tokens } from '../types/token'
|
|
1018
1032
|
|
|
1019
1033
|
export type ${(0, import_shared.capitalize)(name)}Properties = {
|
|
1020
1034
|
${Object.keys(properties ?? {}).map((key) => {
|
|
@@ -1044,8 +1058,8 @@ function generate4(ctx, name, pattern) {
|
|
|
1044
1058
|
|
|
1045
1059
|
`,
|
|
1046
1060
|
js: import_outdent17.outdent`
|
|
1047
|
-
|
|
1048
|
-
|
|
1061
|
+
${ctx.getImport("mapObject", "../helpers")}
|
|
1062
|
+
${ctx.getImport("css", "../css/index")}
|
|
1049
1063
|
|
|
1050
1064
|
const config = ${(0, import_javascript_stringify.stringify)({ transform })}
|
|
1051
1065
|
|
|
@@ -1061,15 +1075,35 @@ function generatePattern(ctx) {
|
|
|
1061
1075
|
return Object.entries(ctx.patterns).map(([name, pattern]) => generate4(ctx, name, pattern));
|
|
1062
1076
|
}
|
|
1063
1077
|
|
|
1078
|
+
// src/generators/pkg-json.ts
|
|
1079
|
+
function generatePackageJSON(ctx) {
|
|
1080
|
+
const pkg = {
|
|
1081
|
+
name: ctx.outdir,
|
|
1082
|
+
description: "This package is auto-generated by CSS Panda",
|
|
1083
|
+
version: `0.0.0-${performance.now()}`,
|
|
1084
|
+
type: "module",
|
|
1085
|
+
exports: {
|
|
1086
|
+
"./css": { types: "./css/index.d.ts", import: "./css/index.mjs" },
|
|
1087
|
+
"./jsx": { types: "./jsx/index.d.ts", import: "./jsx/index.mjs" },
|
|
1088
|
+
"./patterns": { types: "./patterns/index.d.ts", import: "./patterns/index.mjs" },
|
|
1089
|
+
"./recipes": { types: "./recipes/index.d.ts", import: "./recipes/index.mjs" },
|
|
1090
|
+
"./tokens": { types: "./tokens/index.d.ts", import: "./tokens/index.mjs" },
|
|
1091
|
+
"./types": { types: "./types/index.d.ts" },
|
|
1092
|
+
"./styles.css": "./styles.css"
|
|
1093
|
+
}
|
|
1094
|
+
};
|
|
1095
|
+
return JSON.stringify(pkg, null, 2);
|
|
1096
|
+
}
|
|
1097
|
+
|
|
1064
1098
|
// src/generators/prop-types.ts
|
|
1065
1099
|
var import_outdent18 = require("outdent");
|
|
1066
1100
|
function generatePropTypes(utility, strict) {
|
|
1067
1101
|
const strictText = `${strict ? "" : " | NativeValue<T>"}`;
|
|
1068
1102
|
const result = [
|
|
1069
1103
|
import_outdent18.outdent`
|
|
1070
|
-
import { ConditionalValue } from './conditions';
|
|
1071
|
-
import { Properties as CSSProperties } from './csstype'
|
|
1072
|
-
import { Tokens } from './token'
|
|
1104
|
+
import type { ConditionalValue } from './conditions';
|
|
1105
|
+
import type { Properties as CSSProperties } from './csstype'
|
|
1106
|
+
import type { Tokens } from './token'
|
|
1073
1107
|
|
|
1074
1108
|
type PropertyValueTypes = {`
|
|
1075
1109
|
];
|
|
@@ -1110,7 +1144,7 @@ function generateRecipes(ctx) {
|
|
|
1110
1144
|
return;
|
|
1111
1145
|
const js = [
|
|
1112
1146
|
import_outdent19.outdent`
|
|
1113
|
-
|
|
1147
|
+
${ctx.getImport("createCss, withoutSpace, compact", "../helpers")}
|
|
1114
1148
|
|
|
1115
1149
|
const createRecipe = (name, defaultVariants) => {
|
|
1116
1150
|
return (variants) => {
|
|
@@ -1143,7 +1177,7 @@ function generateRecipes(ctx) {
|
|
|
1143
1177
|
];
|
|
1144
1178
|
const dts = [
|
|
1145
1179
|
import_outdent19.outdent`
|
|
1146
|
-
import { ConditionalValue } from '../types'
|
|
1180
|
+
import type { ConditionalValue } from '../types'
|
|
1147
1181
|
`
|
|
1148
1182
|
];
|
|
1149
1183
|
Object.values(recipes).forEach((recipe) => {
|
|
@@ -1381,20 +1415,21 @@ function generateTokenJs(dict) {
|
|
|
1381
1415
|
js: import_outdent21.default`
|
|
1382
1416
|
const tokens = ${JSON.stringify(obj, null, 2)}
|
|
1383
1417
|
|
|
1384
|
-
export function
|
|
1418
|
+
export function token(path) {
|
|
1385
1419
|
const { value } = tokens[path] || {}
|
|
1386
1420
|
return value
|
|
1387
1421
|
}
|
|
1388
1422
|
|
|
1389
|
-
|
|
1423
|
+
function tokenVar(path) {
|
|
1390
1424
|
const { variable } = tokens[path] || {}
|
|
1391
1425
|
return variable
|
|
1392
1426
|
}
|
|
1427
|
+
|
|
1428
|
+
token.var = tokenVar
|
|
1393
1429
|
`,
|
|
1394
1430
|
dts: import_outdent21.default`
|
|
1395
|
-
import { Token } from
|
|
1396
|
-
export declare function
|
|
1397
|
-
export declare function getTokenVar(path: Token): string
|
|
1431
|
+
import type { Token } from '../types/token'
|
|
1432
|
+
export declare function token(path: Token): string & { var: (path: Token) => string }
|
|
1398
1433
|
`
|
|
1399
1434
|
};
|
|
1400
1435
|
}
|
|
@@ -1414,7 +1449,21 @@ function generateCssType(ctx) {
|
|
|
1414
1449
|
system: getType("system-types.d.ts"),
|
|
1415
1450
|
selectors: getType("selectors.d.ts"),
|
|
1416
1451
|
recipe: getType("recipe.d.ts"),
|
|
1452
|
+
composition: getType("composition.d.ts"),
|
|
1453
|
+
global: import_outdent22.default`
|
|
1454
|
+
import { RecipeVariantRecord, RecipeConfig } from './recipe'
|
|
1455
|
+
import { GlobalStyleObject } from './system-types'
|
|
1456
|
+
import { CompositionStyles } from './composition'
|
|
1457
|
+
|
|
1458
|
+
declare module 'css-panda' {
|
|
1459
|
+
export function defineRecipe<V extends RecipeVariantRecord>(config: RecipeConfig<V>): RecipeConfig<V>
|
|
1460
|
+
export function defineGlobalStyles(definition: GlobalStyleObject): GlobalStyleObject
|
|
1461
|
+
export function defineTextStyles(definition: CompositionStyles['textStyles']): CompositionStyles['textStyles']
|
|
1462
|
+
export function defineLayerStyles(definition: CompositionStyles['layerStyles']): CompositionStyles['layerStyles']
|
|
1463
|
+
}
|
|
1464
|
+
`,
|
|
1417
1465
|
exported: import_outdent22.default`
|
|
1466
|
+
import './global'
|
|
1418
1467
|
export { ConditionalValue } from './conditions'
|
|
1419
1468
|
export { GlobalStyleObject, JsxStyleProps, SystemStyleObject } from './system-types'
|
|
1420
1469
|
|
|
@@ -1440,8 +1489,7 @@ function setupHelpers(ctx) {
|
|
|
1440
1489
|
const sharedMjs = getEntrypoint("@pandacss/shared", { dev: "shared.mjs" });
|
|
1441
1490
|
const code = (0, import_fs2.readFileSync)(sharedMjs, "utf-8");
|
|
1442
1491
|
return {
|
|
1443
|
-
|
|
1444
|
-
files: [{ file: ctx.getJsFile("helpers"), code }]
|
|
1492
|
+
files: [{ file: ctx.getExt("helpers"), code }]
|
|
1445
1493
|
};
|
|
1446
1494
|
}
|
|
1447
1495
|
function setupKeyframes(ctx) {
|
|
@@ -1452,9 +1500,8 @@ function setupKeyframes(ctx) {
|
|
|
1452
1500
|
};
|
|
1453
1501
|
}
|
|
1454
1502
|
function setupDesignTokens(ctx) {
|
|
1455
|
-
if (ctx.tokens.isEmpty)
|
|
1456
|
-
return
|
|
1457
|
-
}
|
|
1503
|
+
if (ctx.tokens.isEmpty)
|
|
1504
|
+
return;
|
|
1458
1505
|
const code = generateTokenJs(ctx.tokens);
|
|
1459
1506
|
const css2 = generateTokenCss(ctx);
|
|
1460
1507
|
return {
|
|
@@ -1462,7 +1509,7 @@ function setupDesignTokens(ctx) {
|
|
|
1462
1509
|
files: [
|
|
1463
1510
|
{ file: "index.css", code: css2 },
|
|
1464
1511
|
{ file: "index.d.ts", code: code.dts },
|
|
1465
|
-
{ file: ctx.
|
|
1512
|
+
{ file: ctx.getExt("index"), code: code.js }
|
|
1466
1513
|
]
|
|
1467
1514
|
};
|
|
1468
1515
|
}
|
|
@@ -1477,6 +1524,8 @@ function setupTypes(ctx) {
|
|
|
1477
1524
|
{ file: "csstype.d.ts", code: types.css },
|
|
1478
1525
|
{ file: "system-types.d.ts", code: types.system },
|
|
1479
1526
|
{ file: "selectors.d.ts", code: types.selectors },
|
|
1527
|
+
{ file: "composition.d.ts", code: types.composition },
|
|
1528
|
+
{ file: "global.d.ts", code: types.global },
|
|
1480
1529
|
{ file: "recipe.d.ts", code: types.recipe },
|
|
1481
1530
|
{ file: "index.d.ts", code: types.exported },
|
|
1482
1531
|
{ file: "token.d.ts", code: generateTokenDts(ctx.tokens) },
|
|
@@ -1492,18 +1541,18 @@ function setupCss(ctx) {
|
|
|
1492
1541
|
return {
|
|
1493
1542
|
dir: ctx.paths.css,
|
|
1494
1543
|
files: [
|
|
1495
|
-
{ file: ctx.
|
|
1496
|
-
{ file: ctx.
|
|
1544
|
+
{ file: ctx.getExt("conditions"), code: conditions.js },
|
|
1545
|
+
{ file: ctx.getExt("css"), code: code.js },
|
|
1497
1546
|
{ file: "css.d.ts", code: code.dts }
|
|
1498
1547
|
]
|
|
1499
1548
|
};
|
|
1500
1549
|
}
|
|
1501
1550
|
function setupCva(ctx) {
|
|
1502
|
-
const code = generateCvaFn();
|
|
1551
|
+
const code = generateCvaFn(ctx);
|
|
1503
1552
|
return {
|
|
1504
1553
|
dir: ctx.paths.css,
|
|
1505
1554
|
files: [
|
|
1506
|
-
{ file: ctx.
|
|
1555
|
+
{ file: ctx.getExt("cva"), code: code.js },
|
|
1507
1556
|
{ file: "cva.d.ts", code: code.dts }
|
|
1508
1557
|
]
|
|
1509
1558
|
};
|
|
@@ -1513,94 +1562,111 @@ function setupCx(ctx) {
|
|
|
1513
1562
|
return {
|
|
1514
1563
|
dir: ctx.paths.css,
|
|
1515
1564
|
files: [
|
|
1516
|
-
{ file: ctx.
|
|
1565
|
+
{ file: ctx.getExt("cx"), code: code.js },
|
|
1517
1566
|
{ file: "cx.d.ts", code: code.dts }
|
|
1518
1567
|
]
|
|
1519
1568
|
};
|
|
1520
1569
|
}
|
|
1521
1570
|
function setupRecipes(ctx) {
|
|
1522
1571
|
const code = generateRecipes(ctx);
|
|
1523
|
-
if (!code)
|
|
1524
|
-
return
|
|
1525
|
-
}
|
|
1572
|
+
if (!code)
|
|
1573
|
+
return;
|
|
1526
1574
|
return {
|
|
1527
1575
|
dir: ctx.paths.recipe,
|
|
1528
1576
|
files: [
|
|
1529
|
-
{ file: ctx.
|
|
1577
|
+
{ file: ctx.getExt("index"), code: code.js },
|
|
1530
1578
|
{ file: "index.d.ts", code: code.dts }
|
|
1531
1579
|
]
|
|
1532
1580
|
};
|
|
1533
1581
|
}
|
|
1534
1582
|
function setupPatterns(ctx) {
|
|
1535
1583
|
const files = generatePattern(ctx);
|
|
1536
|
-
if (!files)
|
|
1537
|
-
return
|
|
1538
|
-
|
|
1539
|
-
|
|
1584
|
+
if (!files)
|
|
1585
|
+
return;
|
|
1586
|
+
const index = {
|
|
1587
|
+
js: import_outdent23.default.string(files.map((file) => ctx.getExport(`./${file.name}`)).join("\n")),
|
|
1588
|
+
dts: import_outdent23.default.string(files.map((file) => `export { ${file.name} } from './${file.name}'`).join("\n"))
|
|
1589
|
+
};
|
|
1540
1590
|
return {
|
|
1541
1591
|
dir: ctx.paths.pattern,
|
|
1542
1592
|
files: [
|
|
1543
|
-
...files.map((file) => ({ file: ctx.
|
|
1593
|
+
...files.map((file) => ({ file: ctx.getExt(file.name), code: file.js })),
|
|
1544
1594
|
...files.map((file) => ({ file: `${file.name}.d.ts`, code: file.dts })),
|
|
1545
|
-
{ file: ctx.
|
|
1546
|
-
{ file: "index.d.ts", code:
|
|
1595
|
+
{ file: ctx.getExt("index"), code: index.js },
|
|
1596
|
+
{ file: "index.d.ts", code: index.dts }
|
|
1547
1597
|
]
|
|
1548
1598
|
};
|
|
1549
1599
|
}
|
|
1550
1600
|
function setupJsx(ctx) {
|
|
1551
1601
|
if (!ctx.jsxFramework)
|
|
1552
|
-
return
|
|
1602
|
+
return;
|
|
1553
1603
|
const isValidProp = generateisValidProp(ctx);
|
|
1554
1604
|
const types = generateJsxTypes(ctx);
|
|
1555
1605
|
const factory = generateJsxFactory(ctx);
|
|
1556
1606
|
const patterns = generateJsxPatterns(ctx);
|
|
1557
1607
|
const layoutGrid = generateLayoutGrid(ctx);
|
|
1558
|
-
const
|
|
1608
|
+
const index = {
|
|
1609
|
+
js: import_outdent23.default`
|
|
1610
|
+
${ctx.getExport("./factory")}
|
|
1611
|
+
${ctx.getExport("./layout-grid")}
|
|
1612
|
+
${import_outdent23.default.string(patterns.map((file) => ctx.getExport(`./${file.name}`)).join("\n"))}
|
|
1613
|
+
`,
|
|
1614
|
+
dts: import_outdent23.default`
|
|
1559
1615
|
export * from './factory'
|
|
1560
1616
|
export * from './layout-grid'
|
|
1561
1617
|
${import_outdent23.default.string(patterns.map((file) => `export * from './${file.name}'`).join("\n"))}
|
|
1562
|
-
|
|
1618
|
+
export type { ${ctx.jsxFactoryDetails.typeName} } from '../types/jsx'
|
|
1619
|
+
`
|
|
1620
|
+
};
|
|
1563
1621
|
return {
|
|
1564
1622
|
dir: ctx.paths.jsx,
|
|
1565
1623
|
files: [
|
|
1566
|
-
...patterns.map((file) => ({ file: `${file.name}.
|
|
1624
|
+
...patterns.map((file) => ({ file: `${file.name}.mjs`, code: file.js })),
|
|
1567
1625
|
...patterns.map((file) => ({ file: `${file.name}.d.ts`, code: file.dts })),
|
|
1568
|
-
{ file: "layout-grid.
|
|
1626
|
+
{ file: "layout-grid.mjs", code: layoutGrid.js },
|
|
1569
1627
|
{ file: "layout-grid.d.ts", code: layoutGrid.dts },
|
|
1570
|
-
{ file: ctx.
|
|
1628
|
+
{ file: ctx.getExt("is-valid-prop"), code: isValidProp.js },
|
|
1571
1629
|
{ file: "factory.d.ts", code: types.jsxFactory },
|
|
1572
|
-
{ file: "factory.
|
|
1573
|
-
{
|
|
1574
|
-
|
|
1575
|
-
code: import_outdent23.default`
|
|
1576
|
-
${indexCode}
|
|
1577
|
-
export type { ${ctx.jsxFactoryDetails.typeName} } from '../types/jsx'
|
|
1578
|
-
`
|
|
1579
|
-
},
|
|
1580
|
-
{ file: "index.jsx", code: indexCode }
|
|
1630
|
+
{ file: "factory.mjs", code: factory.js },
|
|
1631
|
+
{ file: "index.d.ts", code: index.dts },
|
|
1632
|
+
{ file: "index.mjs", code: index.js }
|
|
1581
1633
|
]
|
|
1582
1634
|
};
|
|
1583
1635
|
}
|
|
1584
1636
|
function setupCssIndex(ctx) {
|
|
1585
|
-
const
|
|
1637
|
+
const index = {
|
|
1638
|
+
js: import_outdent23.default`
|
|
1639
|
+
${ctx.getExport("./css")}
|
|
1640
|
+
${ctx.getExport("./cx")}
|
|
1641
|
+
${ctx.getExport("./cva")}
|
|
1642
|
+
`,
|
|
1643
|
+
dts: import_outdent23.default`
|
|
1586
1644
|
export * from './css'
|
|
1587
1645
|
export * from './cx'
|
|
1588
1646
|
export * from './cva'
|
|
1589
|
-
|
|
1647
|
+
`
|
|
1648
|
+
};
|
|
1590
1649
|
return {
|
|
1591
1650
|
dir: ctx.paths.css,
|
|
1592
1651
|
files: [
|
|
1593
|
-
{ file: ctx.
|
|
1594
|
-
{ file: "index.d.ts", code }
|
|
1652
|
+
{ file: ctx.getExt("index"), code: index.js },
|
|
1653
|
+
{ file: "index.d.ts", code: index.dts }
|
|
1595
1654
|
]
|
|
1596
1655
|
};
|
|
1597
1656
|
}
|
|
1598
1657
|
function setupReset(ctx) {
|
|
1599
1658
|
if (!ctx.preflight)
|
|
1600
|
-
return
|
|
1659
|
+
return;
|
|
1601
1660
|
const code = generateReset();
|
|
1602
1661
|
return { files: [{ file: "reset.css", code }] };
|
|
1603
1662
|
}
|
|
1663
|
+
function setupPackageJson(ctx) {
|
|
1664
|
+
if (!ctx.emitPackage)
|
|
1665
|
+
return;
|
|
1666
|
+
return {
|
|
1667
|
+
files: [{ file: "package.json", code: generatePackageJSON(ctx) }]
|
|
1668
|
+
};
|
|
1669
|
+
}
|
|
1604
1670
|
function generateSystem(ctx) {
|
|
1605
1671
|
return [
|
|
1606
1672
|
setupHelpers(ctx),
|
|
@@ -1614,8 +1680,9 @@ function generateSystem(ctx) {
|
|
|
1614
1680
|
setupPatterns(ctx),
|
|
1615
1681
|
setupCssIndex(ctx),
|
|
1616
1682
|
setupJsx(ctx),
|
|
1617
|
-
setupReset(ctx)
|
|
1618
|
-
|
|
1683
|
+
setupReset(ctx),
|
|
1684
|
+
setupPackageJson(ctx)
|
|
1685
|
+
].filter(Boolean);
|
|
1619
1686
|
}
|
|
1620
1687
|
|
|
1621
1688
|
// src/messages.ts
|
|
@@ -1700,10 +1767,14 @@ async function emitArtifacts(ctx) {
|
|
|
1700
1767
|
}
|
|
1701
1768
|
async function emitAndExtract(ctx) {
|
|
1702
1769
|
await emitArtifacts(ctx);
|
|
1770
|
+
return extractCss(ctx);
|
|
1771
|
+
}
|
|
1772
|
+
async function extractCss(ctx) {
|
|
1703
1773
|
await extractGlobalCss(ctx);
|
|
1704
1774
|
await extractStaticCss(ctx);
|
|
1705
1775
|
await extractFiles(ctx);
|
|
1706
1776
|
await bundleChunks(ctx);
|
|
1777
|
+
return buildCompleteMessage(ctx);
|
|
1707
1778
|
}
|
|
1708
1779
|
function getBaseCss(ctx) {
|
|
1709
1780
|
const css2 = [
|
|
@@ -1776,7 +1847,8 @@ function createContext(conf, io = fileSystem) {
|
|
|
1776
1847
|
globalCss,
|
|
1777
1848
|
separator,
|
|
1778
1849
|
static: staticCss,
|
|
1779
|
-
outExtension = "mjs"
|
|
1850
|
+
outExtension = "mjs",
|
|
1851
|
+
emitPackage
|
|
1780
1852
|
} = config;
|
|
1781
1853
|
const {
|
|
1782
1854
|
breakpoints = {},
|
|
@@ -1794,9 +1866,10 @@ function createContext(conf, io = fileSystem) {
|
|
|
1794
1866
|
framework: jsxFramework
|
|
1795
1867
|
};
|
|
1796
1868
|
const cwd = (0, import_path2.resolve)(cwdProp);
|
|
1797
|
-
const exclude = [".git", "node_modules", "test-results"].concat(excludeProp);
|
|
1869
|
+
const exclude = [".git", ".yarn", "node_modules", "test-results"].concat(excludeProp);
|
|
1798
1870
|
const tokens = new import_token_dictionary.TokenDictionary({
|
|
1799
1871
|
tokens: tokensProp,
|
|
1872
|
+
breakpoints,
|
|
1800
1873
|
semanticTokens,
|
|
1801
1874
|
prefix: cssVarPrefix
|
|
1802
1875
|
});
|
|
@@ -1889,14 +1962,24 @@ function createContext(conf, io = fileSystem) {
|
|
|
1889
1962
|
function isStyleProp(prop) {
|
|
1890
1963
|
return (0, import_is_valid_prop3.isCssProperty)(prop) || isCustomCssProperty(prop);
|
|
1891
1964
|
}
|
|
1892
|
-
function getPath(
|
|
1893
|
-
|
|
1965
|
+
function getPath(pathLike) {
|
|
1966
|
+
const paths2 = [cwd, emitPackage ? "node_modules" : void 0, outdir, pathLike].filter(Boolean);
|
|
1967
|
+
return (0, import_path2.join)(...paths2);
|
|
1894
1968
|
}
|
|
1895
1969
|
function absPath(str) {
|
|
1896
1970
|
return (0, import_path2.isAbsolute)(str) ? str : (0, import_path2.join)(cwd, str);
|
|
1897
1971
|
}
|
|
1972
|
+
function getExt(file) {
|
|
1973
|
+
return `${file}.${outExtension}`;
|
|
1974
|
+
}
|
|
1975
|
+
function getImport(items, mod) {
|
|
1976
|
+
return `import { ${items} } from '${getExt(mod)}';`;
|
|
1977
|
+
}
|
|
1978
|
+
function getExport(mod) {
|
|
1979
|
+
return `export * from '${getExt(mod)}';`;
|
|
1980
|
+
}
|
|
1898
1981
|
const paths = {
|
|
1899
|
-
|
|
1982
|
+
root: getPath(),
|
|
1900
1983
|
css: getPath("css"),
|
|
1901
1984
|
token: getPath("tokens"),
|
|
1902
1985
|
types: getPath("types"),
|
|
@@ -1918,15 +2001,14 @@ function createContext(conf, io = fileSystem) {
|
|
|
1918
2001
|
);
|
|
1919
2002
|
}
|
|
1920
2003
|
function cleanOutdir() {
|
|
1921
|
-
return (0, import_fs_extra2.emptyDir)(
|
|
2004
|
+
return (0, import_fs_extra2.emptyDir)(paths.root);
|
|
1922
2005
|
}
|
|
1923
2006
|
function writeOutput(output) {
|
|
1924
|
-
|
|
2007
|
+
if (!output)
|
|
2008
|
+
return;
|
|
2009
|
+
const { dir = paths.root, files: files2 } = output;
|
|
1925
2010
|
return write(dir, files2);
|
|
1926
2011
|
}
|
|
1927
|
-
function getJsFile(file) {
|
|
1928
|
-
return `${file}.${outExtension}`;
|
|
1929
|
-
}
|
|
1930
2012
|
const chunks = {
|
|
1931
2013
|
dir: paths.chunk,
|
|
1932
2014
|
readFile(file) {
|
|
@@ -2131,7 +2213,9 @@ function createContext(conf, io = fileSystem) {
|
|
|
2131
2213
|
write,
|
|
2132
2214
|
writeOutput,
|
|
2133
2215
|
cleanOutdir,
|
|
2134
|
-
|
|
2216
|
+
getExt,
|
|
2217
|
+
getImport,
|
|
2218
|
+
getExport,
|
|
2135
2219
|
cssVarRoot,
|
|
2136
2220
|
tokens,
|
|
2137
2221
|
hasTokens,
|
|
@@ -2417,8 +2501,8 @@ process.on("uncaughtException", (err) => {
|
|
|
2417
2501
|
// src/generate.ts
|
|
2418
2502
|
async function build(config, configPath) {
|
|
2419
2503
|
const ctx = await loadConfigAndCreateContext({ config, configPath });
|
|
2420
|
-
await emitAndExtract(ctx);
|
|
2421
|
-
import_logger8.logger.info(
|
|
2504
|
+
const msg = await emitAndExtract(ctx);
|
|
2505
|
+
import_logger8.logger.info(msg);
|
|
2422
2506
|
return ctx;
|
|
2423
2507
|
}
|
|
2424
2508
|
async function generate5(config, configPath) {
|
|
@@ -2519,6 +2603,7 @@ async function setupPostcss(cwd) {
|
|
|
2519
2603
|
emitAndExtract,
|
|
2520
2604
|
emitArtifacts,
|
|
2521
2605
|
execCommand,
|
|
2606
|
+
extractCss,
|
|
2522
2607
|
generate,
|
|
2523
2608
|
loadConfigAndCreateContext,
|
|
2524
2609
|
setupConfig,
|