@pandacss/node 0.0.0-dev-20230106105402 → 0.0.0-dev-20230106183338
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 +51 -9
- package/dist/index.js +260 -206
- package/dist/index.mjs +249 -195
- package/package.json +11 -11
package/dist/index.js
CHANGED
|
@@ -168,6 +168,7 @@ function generateConditions(ctx) {
|
|
|
168
168
|
`,
|
|
169
169
|
dts: import_outdent.default`
|
|
170
170
|
export type Condition = ${(0, import_shared.unionType)(keys)}
|
|
171
|
+
|
|
171
172
|
export type Conditions = Record<Condition, string>
|
|
172
173
|
`
|
|
173
174
|
};
|
|
@@ -329,20 +330,21 @@ function generateisValidProp(ctx) {
|
|
|
329
330
|
}
|
|
330
331
|
|
|
331
332
|
// src/generators/jsx/preact-jsx.ts
|
|
332
|
-
var import_shared2 = require("@pandacss/shared");
|
|
333
333
|
var import_outdent6 = require("outdent");
|
|
334
334
|
function generatePreactJsxFactory(ctx) {
|
|
335
|
-
const name = ctx.
|
|
336
|
-
const upperName = (0, import_shared2.capitalize)(name);
|
|
335
|
+
const { name, componentName } = ctx.jsxFactoryDetails;
|
|
337
336
|
return {
|
|
338
337
|
js: import_outdent6.outdent`
|
|
339
338
|
import { h } from 'preact'
|
|
340
339
|
import { forwardRef } from 'preact/compat'
|
|
340
|
+
import { useMemo } from 'preact/hooks'
|
|
341
341
|
import { isCssProperty } from './is-valid-prop'
|
|
342
|
-
import { css } from '../css'
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
342
|
+
import { css, cx } from '../css'
|
|
343
|
+
|
|
344
|
+
const htmlProps = ['htmlSize', 'htmlTranslate', 'htmlWidth', 'htmlHeight']
|
|
345
|
+
|
|
346
|
+
function normalizeHtmlProp(key) {
|
|
347
|
+
return htmlProps.includes(key) ? key.replace('html', '').toLowerCase() : key
|
|
346
348
|
}
|
|
347
349
|
|
|
348
350
|
function splitProps(props) {
|
|
@@ -353,7 +355,7 @@ function generatePreactJsxFactory(ctx) {
|
|
|
353
355
|
if (isCssProperty(key)) {
|
|
354
356
|
styleProps[key] = value
|
|
355
357
|
} else {
|
|
356
|
-
elementProps[key] = value
|
|
358
|
+
elementProps[normalizeHtmlProp(key)] = value
|
|
357
359
|
}
|
|
358
360
|
}
|
|
359
361
|
|
|
@@ -361,12 +363,12 @@ function generatePreactJsxFactory(ctx) {
|
|
|
361
363
|
}
|
|
362
364
|
|
|
363
365
|
function styled(Dynamic) {
|
|
364
|
-
const ${
|
|
366
|
+
const ${componentName} = forwardRef(function ${componentName}(props, ref) {
|
|
365
367
|
const { as: Element = Dynamic, ...restProps } = props
|
|
366
368
|
|
|
367
|
-
const [styleProps, elementProps] = splitProps(restProps)
|
|
369
|
+
const [styleProps, elementProps] = useMemo(() => splitProps(restProps), [restProps])
|
|
368
370
|
|
|
369
|
-
|
|
371
|
+
function classes(){
|
|
370
372
|
const { css: cssStyles, ...otherStyles } = styleProps
|
|
371
373
|
const atomicClass = css({ ...otherStyles, ...cssStyles })
|
|
372
374
|
return cx(atomicClass, elementProps.className)
|
|
@@ -375,14 +377,17 @@ function generatePreactJsxFactory(ctx) {
|
|
|
375
377
|
return h(Element, { ...elementProps, ref, className: classes() })
|
|
376
378
|
})
|
|
377
379
|
|
|
378
|
-
${
|
|
379
|
-
return ${
|
|
380
|
+
${componentName}.displayName = \`${name}.\${Dynamic}\`
|
|
381
|
+
return ${componentName}
|
|
380
382
|
}
|
|
381
383
|
|
|
382
|
-
function
|
|
384
|
+
function createJsxFactory() {
|
|
383
385
|
const cache = new Map()
|
|
384
386
|
|
|
385
387
|
return new Proxy(Object.create(null), {
|
|
388
|
+
apply(_, __, args) {
|
|
389
|
+
return styled(...args)
|
|
390
|
+
},
|
|
386
391
|
get(_, el) {
|
|
387
392
|
if (!cache.has(el)) {
|
|
388
393
|
cache.set(el, styled(el))
|
|
@@ -392,7 +397,7 @@ function generatePreactJsxFactory(ctx) {
|
|
|
392
397
|
})
|
|
393
398
|
}
|
|
394
399
|
|
|
395
|
-
export const ${name} =
|
|
400
|
+
export const ${name} = createJsxFactory()
|
|
396
401
|
`
|
|
397
402
|
};
|
|
398
403
|
}
|
|
@@ -451,108 +456,112 @@ function generatePreactLayoutGrid() {
|
|
|
451
456
|
}
|
|
452
457
|
|
|
453
458
|
// src/generators/jsx/preact-pattern.ts
|
|
454
|
-
var import_shared3 = require("@pandacss/shared");
|
|
455
459
|
var import_outdent8 = require("outdent");
|
|
456
460
|
var import_ts_pattern = require("ts-pattern");
|
|
457
|
-
function generate(name, pattern
|
|
458
|
-
const upperName
|
|
459
|
-
const
|
|
460
|
-
const jsxName = pattern.jsx ?? upperName;
|
|
461
|
-
const keys = Object.keys(pattern.properties ?? {});
|
|
461
|
+
function generate(ctx, name, pattern) {
|
|
462
|
+
const { upperName, styleFn, dashName, jsxName, props } = ctx.getPatternDetails(name, pattern);
|
|
463
|
+
const { componentName } = ctx.jsxFactoryDetails;
|
|
462
464
|
return {
|
|
463
|
-
name:
|
|
465
|
+
name: dashName,
|
|
464
466
|
js: import_outdent8.outdent`
|
|
465
467
|
import { forwardRef } from 'preact/compat'
|
|
466
|
-
import { ${jsxFactory} } from './factory'
|
|
467
|
-
import { ${
|
|
468
|
+
import { ${ctx.jsxFactory} } from './factory'
|
|
469
|
+
import { ${styleFn} } from '../patterns/${dashName}'
|
|
468
470
|
|
|
469
471
|
export const ${jsxName} = forwardRef(function ${jsxName}(props, ref) {
|
|
470
|
-
${(0, import_ts_pattern.match)(
|
|
472
|
+
${(0, import_ts_pattern.match)(props.length).with(
|
|
471
473
|
0,
|
|
472
474
|
() => import_outdent8.outdent`
|
|
473
|
-
return <${jsxFactory}.div ref={ref} {...props} />
|
|
475
|
+
return <${ctx.jsxFactory}.div ref={ref} {...props} />
|
|
474
476
|
`
|
|
475
477
|
).otherwise(
|
|
476
478
|
() => import_outdent8.outdent`
|
|
477
|
-
const { ${
|
|
478
|
-
const styleProps = ${
|
|
479
|
-
return <${jsxFactory}.div ref={ref} {...styleProps} {...restProps} />
|
|
479
|
+
const { ${props.join(", ")}, ...restProps } = props
|
|
480
|
+
const styleProps = ${styleFn}({${props.join(", ")}})
|
|
481
|
+
return <${ctx.jsxFactory}.div ref={ref} {...styleProps} {...restProps} />
|
|
480
482
|
`
|
|
481
483
|
)}
|
|
482
484
|
})
|
|
483
485
|
`,
|
|
484
486
|
dts: import_outdent8.outdent`
|
|
485
|
-
import { ${upperName}Properties } from '../patterns/${
|
|
486
|
-
import {
|
|
487
|
+
import { ${upperName}Properties } from '../patterns/${dashName}'
|
|
488
|
+
import { ${componentName} } from '../types/jsx'
|
|
487
489
|
|
|
488
490
|
${pattern.description ? `/** ${pattern.description} */` : ""}
|
|
489
|
-
export declare const ${jsxName}:
|
|
491
|
+
export declare const ${jsxName}: ${componentName}<"div", ${upperName}Properties>
|
|
490
492
|
`
|
|
491
493
|
};
|
|
492
494
|
}
|
|
493
495
|
function generatePreactJsxPattern(ctx) {
|
|
494
|
-
return Object.entries(ctx.patterns).map(([name, pattern]) => generate(name, pattern
|
|
496
|
+
return Object.entries(ctx.patterns).map(([name, pattern]) => generate(ctx, name, pattern));
|
|
495
497
|
}
|
|
496
498
|
|
|
497
499
|
// src/generators/jsx/preact-types.ts
|
|
498
|
-
var import_shared4 = require("@pandacss/shared");
|
|
499
500
|
var import_outdent9 = require("outdent");
|
|
500
501
|
function generatePreactJsxTypes(ctx) {
|
|
501
|
-
const name = ctx.
|
|
502
|
-
const upperName = (0, import_shared4.capitalize)(name);
|
|
502
|
+
const { name, componentName, upperName, typeName } = ctx.jsxFactoryDetails;
|
|
503
503
|
return {
|
|
504
504
|
jsxFactory: import_outdent9.outdent`
|
|
505
|
-
import {
|
|
506
|
-
export declare const ${name}:
|
|
505
|
+
import { ${upperName} } from '../types/jsx'
|
|
506
|
+
export declare const ${name}: ${upperName}
|
|
507
507
|
`,
|
|
508
508
|
jsxType: import_outdent9.outdent`
|
|
509
|
-
import type { JSX,
|
|
509
|
+
import type { JSX, ElementType, ComponentProps } from 'preact'
|
|
510
510
|
import type { JsxStyleProps, Assign } from '.'
|
|
511
511
|
|
|
512
|
-
type
|
|
513
|
-
|
|
514
|
-
type
|
|
512
|
+
type Dict = Record<string, unknown>
|
|
513
|
+
|
|
514
|
+
type AdditionalHtmlProps = {
|
|
515
|
+
htmlSize?: string | number
|
|
516
|
+
htmlWidth?: string | number
|
|
517
|
+
htmlHeight?: string | number
|
|
518
|
+
htmlTranslate?: 'yes' | 'no' | undefined
|
|
519
|
+
}
|
|
515
520
|
|
|
516
|
-
type
|
|
521
|
+
type Polyfill<ComponentProps> = Omit<
|
|
522
|
+
ComponentProps,
|
|
523
|
+
'color' | 'translate' | 'transition' | 'width' | 'height' | 'size'
|
|
524
|
+
> &
|
|
525
|
+
AdditionalHtmlProps
|
|
517
526
|
|
|
518
|
-
type
|
|
519
|
-
ComponentProps
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
AsComponent extends As = As,
|
|
523
|
-
> = Assign<Clean<ComponentProps>, AdditionalProps> &
|
|
524
|
-
Assign<Clean<AsProps>, AdditionalProps> & {
|
|
525
|
-
as?: AsComponent
|
|
526
|
-
}
|
|
527
|
+
type Props<ComponentProps extends Dict, AdditionalProps extends Dict = {}> = Assign<
|
|
528
|
+
Polyfill<ComponentProps>,
|
|
529
|
+
AdditionalProps
|
|
530
|
+
>
|
|
527
531
|
|
|
528
|
-
export type
|
|
529
|
-
|
|
532
|
+
export type ${componentName}<ComponentType extends ElementType, AdditionalProps extends Dict = {}> = {
|
|
533
|
+
(
|
|
534
|
+
props: Props<ComponentProps<ComponentType>, AdditionalProps> & JsxStyleProps<AdditionalProps>,
|
|
535
|
+
): JSX.Element
|
|
530
536
|
displayName?: string
|
|
531
537
|
}
|
|
532
538
|
|
|
533
|
-
export type
|
|
534
|
-
|
|
535
|
-
|
|
539
|
+
export type ${upperName} = {
|
|
540
|
+
<Component extends ElementType, AdditionalProps extends Dict = {}>(component: Component): ${componentName}<
|
|
541
|
+
Component,
|
|
542
|
+
AdditionalProps
|
|
543
|
+
>
|
|
544
|
+
} & { [K in keyof JSX.IntrinsicElements]: ${componentName}<K, {}> }
|
|
536
545
|
|
|
537
|
-
export type
|
|
546
|
+
export type ${typeName}<ComponentType extends ElementType> = Polyfill<ComponentProps<ComponentType>> & JsxStyleProps
|
|
538
547
|
`
|
|
539
548
|
};
|
|
540
549
|
}
|
|
541
550
|
|
|
542
551
|
// src/generators/jsx/react-jsx.ts
|
|
543
|
-
var import_shared5 = require("@pandacss/shared");
|
|
544
552
|
var import_outdent10 = require("outdent");
|
|
545
553
|
function generateReactJsxFactory(ctx) {
|
|
546
|
-
const name = ctx.
|
|
547
|
-
const upperName = (0, import_shared5.capitalize)(name);
|
|
554
|
+
const { name, componentName } = ctx.jsxFactoryDetails;
|
|
548
555
|
return {
|
|
549
556
|
js: import_outdent10.outdent`
|
|
550
|
-
import { forwardRef } from 'react'
|
|
557
|
+
import { forwardRef, useMemo } from 'react'
|
|
551
558
|
import { isCssProperty } from './is-valid-prop'
|
|
552
|
-
import { css } from '../css'
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
559
|
+
import { css, cx } from '../css'
|
|
560
|
+
|
|
561
|
+
const htmlProps = ['htmlSize', 'htmlTranslate', 'htmlWidth', 'htmlHeight']
|
|
562
|
+
|
|
563
|
+
function normalizeHtmlProp(key) {
|
|
564
|
+
return htmlProps.includes(key) ? key.replace('html', '').toLowerCase() : key
|
|
556
565
|
}
|
|
557
566
|
|
|
558
567
|
function splitProps(props) {
|
|
@@ -563,7 +572,7 @@ function generateReactJsxFactory(ctx) {
|
|
|
563
572
|
if (isCssProperty(key)) {
|
|
564
573
|
styleProps[key] = value
|
|
565
574
|
} else {
|
|
566
|
-
elementProps[key] = value
|
|
575
|
+
elementProps[normalizeHtmlProp(key)] = value
|
|
567
576
|
}
|
|
568
577
|
}
|
|
569
578
|
|
|
@@ -571,12 +580,12 @@ function generateReactJsxFactory(ctx) {
|
|
|
571
580
|
}
|
|
572
581
|
|
|
573
582
|
function styled(Dynamic) {
|
|
574
|
-
const ${
|
|
583
|
+
const ${componentName} = forwardRef(function ${componentName}(props, ref) {
|
|
575
584
|
const { as: Element = Dynamic, ...restProps } = props
|
|
576
585
|
|
|
577
|
-
const [styleProps, elementProps] = splitProps(restProps)
|
|
586
|
+
const [styleProps, elementProps] = useMemo(() => splitProps(restProps), [restProps])
|
|
578
587
|
|
|
579
|
-
|
|
588
|
+
function classes(){
|
|
580
589
|
const { css: cssStyles, ...otherStyles } = styleProps
|
|
581
590
|
const atomicClass = css({ ...otherStyles, ...cssStyles })
|
|
582
591
|
return cx(atomicClass, elementProps.className)
|
|
@@ -585,14 +594,17 @@ function generateReactJsxFactory(ctx) {
|
|
|
585
594
|
return <Element ref={ref} {...elementProps} className={classes()} />
|
|
586
595
|
})
|
|
587
596
|
|
|
588
|
-
${
|
|
589
|
-
return ${
|
|
597
|
+
${componentName}.displayName = \`${name}.\${Dynamic}\`
|
|
598
|
+
return ${componentName}
|
|
590
599
|
}
|
|
591
600
|
|
|
592
|
-
function
|
|
601
|
+
function createJsxFactory() {
|
|
593
602
|
const cache = new Map()
|
|
594
603
|
|
|
595
604
|
return new Proxy(Object.create(null), {
|
|
605
|
+
apply(_, __, args) {
|
|
606
|
+
return styled(...args)
|
|
607
|
+
},
|
|
596
608
|
get(_, el) {
|
|
597
609
|
if (!cache.has(el)) {
|
|
598
610
|
cache.set(el, styled(el))
|
|
@@ -602,7 +614,8 @@ function generateReactJsxFactory(ctx) {
|
|
|
602
614
|
})
|
|
603
615
|
}
|
|
604
616
|
|
|
605
|
-
export const ${name} =
|
|
617
|
+
export const ${name} = createJsxFactory()
|
|
618
|
+
|
|
606
619
|
`
|
|
607
620
|
};
|
|
608
621
|
}
|
|
@@ -661,113 +674,132 @@ function generateReactLayoutGrid() {
|
|
|
661
674
|
}
|
|
662
675
|
|
|
663
676
|
// src/generators/jsx/react-pattern.ts
|
|
664
|
-
var import_shared6 = require("@pandacss/shared");
|
|
665
677
|
var import_outdent12 = require("outdent");
|
|
666
678
|
var import_ts_pattern2 = require("ts-pattern");
|
|
667
|
-
function generate2(name, pattern
|
|
668
|
-
const upperName
|
|
669
|
-
const
|
|
670
|
-
const jsxName = pattern.jsx ?? upperName;
|
|
671
|
-
const keys = Object.keys(pattern.properties ?? {});
|
|
679
|
+
function generate2(ctx, name, pattern) {
|
|
680
|
+
const { upperName, styleFn, dashName, jsxName, props } = ctx.getPatternDetails(name, pattern);
|
|
681
|
+
const { componentName } = ctx.jsxFactoryDetails;
|
|
672
682
|
return {
|
|
673
|
-
name:
|
|
683
|
+
name: dashName,
|
|
674
684
|
js: import_outdent12.outdent`
|
|
675
685
|
import { forwardRef } from 'react'
|
|
676
|
-
import { ${jsxFactory} } from './factory'
|
|
677
|
-
import { ${
|
|
686
|
+
import { ${ctx.jsxFactory} } from './factory'
|
|
687
|
+
import { ${styleFn} } from '../patterns/${dashName}'
|
|
678
688
|
|
|
679
689
|
export const ${jsxName} = forwardRef(function ${jsxName}(props, ref) {
|
|
680
|
-
${(0, import_ts_pattern2.match)(
|
|
690
|
+
${(0, import_ts_pattern2.match)(props.length).with(
|
|
681
691
|
0,
|
|
682
692
|
() => import_outdent12.outdent`
|
|
683
|
-
return <${jsxFactory}.div ref={ref} {...props} />
|
|
693
|
+
return <${ctx.jsxFactory}.div ref={ref} {...props} />
|
|
684
694
|
`
|
|
685
695
|
).otherwise(
|
|
686
696
|
() => import_outdent12.outdent`
|
|
687
|
-
const { ${
|
|
688
|
-
const styleProps = ${
|
|
689
|
-
return <${jsxFactory}.div ref={ref} {...styleProps} {...restProps} />
|
|
697
|
+
const { ${props.join(", ")}, ...restProps } = props
|
|
698
|
+
const styleProps = ${styleFn}({${props.join(", ")}})
|
|
699
|
+
return <${ctx.jsxFactory}.div ref={ref} {...styleProps} {...restProps} />
|
|
690
700
|
`
|
|
691
701
|
)}
|
|
692
702
|
|
|
693
703
|
})
|
|
694
704
|
`,
|
|
695
705
|
dts: import_outdent12.outdent`
|
|
696
|
-
import { ${upperName}Properties } from '../patterns/${
|
|
697
|
-
import {
|
|
706
|
+
import { ${upperName}Properties } from '../patterns/${dashName}'
|
|
707
|
+
import { ${componentName} } from '../types/jsx'
|
|
698
708
|
|
|
699
709
|
${pattern.description ? `/** ${pattern.description} */` : ""}
|
|
700
|
-
export declare const ${jsxName}:
|
|
710
|
+
export declare const ${jsxName}: ${componentName}<'div', ${upperName}Properties>
|
|
701
711
|
`
|
|
702
712
|
};
|
|
703
713
|
}
|
|
704
714
|
function generateReactJsxPattern(ctx) {
|
|
705
|
-
return Object.entries(ctx.patterns).map(([name, pattern]) => generate2(name, pattern
|
|
715
|
+
return Object.entries(ctx.patterns).map(([name, pattern]) => generate2(ctx, name, pattern));
|
|
706
716
|
}
|
|
707
717
|
|
|
708
718
|
// src/generators/jsx/react-types.ts
|
|
709
|
-
var import_shared7 = require("@pandacss/shared");
|
|
710
719
|
var import_outdent13 = require("outdent");
|
|
711
720
|
function generateReactJsxTypes(ctx) {
|
|
712
|
-
const name = ctx.
|
|
713
|
-
const upperName = (0, import_shared7.capitalize)(name);
|
|
721
|
+
const { name, componentName, upperName, typeName } = ctx.jsxFactoryDetails;
|
|
714
722
|
return {
|
|
715
723
|
jsxFactory: import_outdent13.outdent`
|
|
716
|
-
import {
|
|
717
|
-
export declare const ${name}:
|
|
724
|
+
import { ${upperName} } from '../types/jsx'
|
|
725
|
+
export declare const ${name}: ${upperName}
|
|
718
726
|
`,
|
|
719
727
|
jsxType: import_outdent13.outdent`
|
|
720
728
|
import type { ElementType, ComponentProps } from 'react'
|
|
721
729
|
import type { JsxStyleProps, Assign } from '.'
|
|
722
730
|
|
|
723
|
-
type
|
|
724
|
-
|
|
731
|
+
type Dict = Record<string, unknown>
|
|
732
|
+
|
|
733
|
+
type AdditionalHtmlProps = {
|
|
734
|
+
htmlSize?: string | number
|
|
735
|
+
htmlWidth?: string | number
|
|
736
|
+
htmlHeight?: string | number
|
|
737
|
+
htmlTranslate?: 'yes' | 'no' | undefined
|
|
738
|
+
}
|
|
725
739
|
|
|
726
|
-
type
|
|
740
|
+
type Polyfill<ComponentProps> = Omit<
|
|
741
|
+
ComponentProps,
|
|
742
|
+
'color' | 'translate' | 'transition' | 'width' | 'height' | 'size'
|
|
743
|
+
> &
|
|
744
|
+
AdditionalHtmlProps
|
|
727
745
|
|
|
728
|
-
type
|
|
729
|
-
ComponentProps
|
|
730
|
-
AdditionalProps
|
|
731
|
-
>
|
|
746
|
+
type Props<ComponentProps extends Dict, AdditionalProps extends Dict = {}> = Assign<
|
|
747
|
+
Polyfill<ComponentProps>,
|
|
748
|
+
AdditionalProps
|
|
749
|
+
>
|
|
732
750
|
|
|
733
|
-
export type
|
|
734
|
-
(
|
|
751
|
+
export type ${componentName}<ComponentType extends ElementType, AdditionalProps extends Dict = {}> = {
|
|
752
|
+
(
|
|
753
|
+
props: Props<ComponentProps<ComponentType>, AdditionalProps> & JsxStyleProps<AdditionalProps>,
|
|
754
|
+
): JSX.Element
|
|
735
755
|
displayName?: string
|
|
736
756
|
}
|
|
737
757
|
|
|
738
|
-
export type
|
|
739
|
-
|
|
740
|
-
|
|
758
|
+
export type ${upperName} = {
|
|
759
|
+
<Component extends ElementType, AdditionalProps extends Dict = {}>(component: Component): ${componentName}<
|
|
760
|
+
Component,
|
|
761
|
+
AdditionalProps
|
|
762
|
+
>
|
|
763
|
+
} & { [K in keyof JSX.IntrinsicElements]: ${componentName}<K, {}> }
|
|
741
764
|
|
|
742
|
-
export type
|
|
765
|
+
export type ${typeName}<ComponentType extends ElementType> = Polyfill<ComponentProps<ComponentType>> & JsxStyleProps
|
|
743
766
|
`
|
|
744
767
|
};
|
|
745
768
|
}
|
|
746
769
|
|
|
747
770
|
// src/generators/jsx/solid-jsx.ts
|
|
748
|
-
var import_shared8 = require("@pandacss/shared");
|
|
749
771
|
var import_outdent14 = require("outdent");
|
|
750
772
|
function generateSolidJsxFactory(ctx) {
|
|
751
|
-
const name = ctx.
|
|
752
|
-
const upperName = (0, import_shared8.capitalize)(name);
|
|
773
|
+
const { componentName, name } = ctx.jsxFactoryDetails;
|
|
753
774
|
return {
|
|
754
775
|
js: import_outdent14.outdent`
|
|
755
776
|
import { Dynamic } from 'solid-js/web'
|
|
756
777
|
import { mergeProps, splitProps } from 'solid-js'
|
|
757
778
|
import { allCssProperties } from './is-valid-prop'
|
|
758
|
-
import { css } from '../css'
|
|
779
|
+
import { css, cx } from '../css'
|
|
759
780
|
|
|
760
|
-
|
|
761
|
-
|
|
781
|
+
const htmlProps = ['htmlSize', 'htmlTranslate', 'htmlWidth', 'htmlHeight']
|
|
782
|
+
|
|
783
|
+
function normalizeHtmlProp(key) {
|
|
784
|
+
return htmlProps.includes(key) ? key.replace('html', '').toLowerCase() : key
|
|
785
|
+
}
|
|
786
|
+
|
|
787
|
+
function normalizeHtmlProps(props) {
|
|
788
|
+
const result = {}
|
|
789
|
+
for (const [key, value] of Object.entries(props)) {
|
|
790
|
+
result[normalizeHtmlProp(key)] = value
|
|
791
|
+
}
|
|
792
|
+
return result
|
|
762
793
|
}
|
|
763
794
|
|
|
764
795
|
function styled(element) {
|
|
765
|
-
return function ${
|
|
796
|
+
return function ${componentName}(props) {
|
|
766
797
|
const mergedProps = mergeProps({ as: element }, props)
|
|
767
798
|
|
|
768
|
-
const [localProps, styleProps, elementProps] = splitProps(
|
|
799
|
+
const [localProps, localHtmlProps, styleProps, elementProps] = splitProps(
|
|
769
800
|
mergedProps,
|
|
770
801
|
['as', 'class', 'className'],
|
|
802
|
+
htmlProps,
|
|
771
803
|
allCssProperties
|
|
772
804
|
)
|
|
773
805
|
|
|
@@ -777,14 +809,17 @@ function generateSolidJsxFactory(ctx) {
|
|
|
777
809
|
return cx(atomicClass, localProps.class, localProps.className)
|
|
778
810
|
}
|
|
779
811
|
|
|
780
|
-
return <Dynamic component={localProps.as} {...elementProps} class={classes()} />
|
|
812
|
+
return <Dynamic component={localProps.as} {...normalizeHtmlProps(localHtmlProps)} {...elementProps} class={classes()} />
|
|
781
813
|
}
|
|
782
814
|
}
|
|
783
815
|
|
|
784
|
-
function
|
|
816
|
+
function createJsxFactory() {
|
|
785
817
|
const cache = new Map()
|
|
786
818
|
|
|
787
819
|
return new Proxy(Object.create(null), {
|
|
820
|
+
apply(_, __, args) {
|
|
821
|
+
return styled(...args)
|
|
822
|
+
},
|
|
788
823
|
get(_, el) {
|
|
789
824
|
if (!cache.has(el)) {
|
|
790
825
|
cache.set(el, styled(el))
|
|
@@ -794,7 +829,7 @@ function generateSolidJsxFactory(ctx) {
|
|
|
794
829
|
})
|
|
795
830
|
}
|
|
796
831
|
|
|
797
|
-
export const ${name} =
|
|
832
|
+
export const ${name} = createJsxFactory()
|
|
798
833
|
`
|
|
799
834
|
};
|
|
800
835
|
}
|
|
@@ -804,6 +839,8 @@ var import_outdent15 = require("outdent");
|
|
|
804
839
|
function generateSolidLayoutGrid() {
|
|
805
840
|
return {
|
|
806
841
|
dts: import_outdent15.outdent`
|
|
842
|
+
import { ParentProps } from 'solid-js'
|
|
843
|
+
|
|
807
844
|
export type LayoutGridProps = {
|
|
808
845
|
count?: number
|
|
809
846
|
gutter?: string
|
|
@@ -811,7 +848,7 @@ function generateSolidLayoutGrid() {
|
|
|
811
848
|
margin?: string
|
|
812
849
|
}
|
|
813
850
|
|
|
814
|
-
export declare const LayoutGrid:
|
|
851
|
+
export declare const LayoutGrid: ParentProps<LayoutGridProps>
|
|
815
852
|
`,
|
|
816
853
|
js: import_outdent15.outdent`
|
|
817
854
|
export function LayoutGrid(props) {
|
|
@@ -851,90 +888,97 @@ function generateSolidLayoutGrid() {
|
|
|
851
888
|
}
|
|
852
889
|
|
|
853
890
|
// src/generators/jsx/solid-pattern.ts
|
|
854
|
-
var import_shared9 = require("@pandacss/shared");
|
|
855
891
|
var import_outdent16 = require("outdent");
|
|
856
892
|
var import_ts_pattern3 = require("ts-pattern");
|
|
857
|
-
function generate3(name, pattern
|
|
858
|
-
const upperName
|
|
859
|
-
const
|
|
860
|
-
const jsxName = pattern.jsx ?? upperName;
|
|
861
|
-
const keys = Object.keys(pattern.properties ?? {});
|
|
893
|
+
function generate3(ctx, name, pattern) {
|
|
894
|
+
const { upperName, styleFn, dashName, jsxName, props } = ctx.getPatternDetails(name, pattern);
|
|
895
|
+
const { componentName } = ctx.jsxFactoryDetails;
|
|
862
896
|
return {
|
|
863
|
-
name:
|
|
897
|
+
name: dashName,
|
|
864
898
|
js: import_outdent16.outdent`
|
|
865
899
|
import { splitProps } from 'solid-js'
|
|
866
|
-
import { ${jsxFactory} } from './factory'
|
|
867
|
-
import { ${
|
|
900
|
+
import { ${ctx.jsxFactory} } from './factory'
|
|
901
|
+
import { ${styleFn} } from '../patterns/${dashName}'
|
|
868
902
|
|
|
869
903
|
export function ${jsxName}(props) {
|
|
870
|
-
${(0, import_ts_pattern3.match)(
|
|
904
|
+
${(0, import_ts_pattern3.match)(props.length).with(
|
|
871
905
|
0,
|
|
872
906
|
() => import_outdent16.outdent`
|
|
873
|
-
return <${jsxFactory}.div {...props} />
|
|
907
|
+
return <${ctx.jsxFactory}.div {...props} />
|
|
874
908
|
`
|
|
875
909
|
).otherwise(
|
|
876
910
|
() => import_outdent16.outdent`
|
|
877
|
-
const [patternProps, restProps] = splitProps(props, [${
|
|
878
|
-
const styleProps = ${
|
|
879
|
-
return <${jsxFactory}.div {...styleProps} {...restProps} />
|
|
911
|
+
const [patternProps, restProps] = splitProps(props, [${props.map((v) => JSON.stringify(v)).join(", ")}]);
|
|
912
|
+
const styleProps = ${styleFn}(patternProps)
|
|
913
|
+
return <${ctx.jsxFactory}.div {...styleProps} {...restProps} />
|
|
880
914
|
`
|
|
881
915
|
)}
|
|
882
916
|
}
|
|
883
917
|
`,
|
|
884
918
|
dts: import_outdent16.outdent`
|
|
885
|
-
import { ${upperName}Properties } from '../patterns/${
|
|
886
|
-
import {
|
|
919
|
+
import { ${upperName}Properties } from '../patterns/${dashName}'
|
|
920
|
+
import { ${componentName} } from '../types/jsx'
|
|
887
921
|
|
|
888
922
|
${pattern.description ? `/** ${pattern.description} */` : ""}
|
|
889
|
-
export declare const ${jsxName}:
|
|
923
|
+
export declare const ${jsxName}: ${componentName}<"div", ${upperName}Properties>
|
|
890
924
|
`
|
|
891
925
|
};
|
|
892
926
|
}
|
|
893
927
|
function generateSolidJsxPattern(ctx) {
|
|
894
|
-
return Object.entries(ctx.patterns).map(([name, pattern]) => generate3(name, pattern
|
|
928
|
+
return Object.entries(ctx.patterns).map(([name, pattern]) => generate3(ctx, name, pattern));
|
|
895
929
|
}
|
|
896
930
|
|
|
897
931
|
// src/generators/jsx/solid-types.ts
|
|
898
|
-
var import_shared10 = require("@pandacss/shared");
|
|
899
932
|
var import_outdent17 = require("outdent");
|
|
900
933
|
function generateSolidJsxTypes(ctx) {
|
|
901
|
-
const name = ctx.
|
|
902
|
-
const upperName = (0, import_shared10.capitalize)(name);
|
|
934
|
+
const { name, componentName, upperName, typeName } = ctx.jsxFactoryDetails;
|
|
903
935
|
return {
|
|
904
936
|
jsxFactory: import_outdent17.outdent`
|
|
905
|
-
import {
|
|
906
|
-
export declare const ${name}:
|
|
937
|
+
import { ${upperName} } from '../types/jsx'
|
|
938
|
+
export declare const ${name}: ${upperName}
|
|
907
939
|
`,
|
|
908
940
|
jsxType: import_outdent17.outdent`
|
|
909
941
|
import type { JSX, ComponentProps, Component } from 'solid-js'
|
|
910
942
|
import type { JsxStyleProps, Assign } from '.'
|
|
911
943
|
|
|
912
|
-
type
|
|
913
|
-
type As<P = any> = Element | Component<P>;
|
|
914
|
-
type Dict<T = unknown> = Record<string, T>
|
|
944
|
+
type Dict = Record<string, unknown>
|
|
915
945
|
|
|
916
|
-
type
|
|
946
|
+
type ElementType<P = any> = keyof JSX.IntrinsicElements | Component<P>;
|
|
917
947
|
|
|
918
|
-
type
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
948
|
+
type AdditionalHtmlProps = {
|
|
949
|
+
htmlSize?: string | number
|
|
950
|
+
htmlWidth?: string | number
|
|
951
|
+
htmlHeight?: string | number
|
|
952
|
+
htmlTranslate?: 'yes' | 'no' | undefined
|
|
953
|
+
}
|
|
954
|
+
|
|
955
|
+
type Polyfill<ComponentProps> = Omit<
|
|
956
|
+
ComponentProps,
|
|
957
|
+
'color' | 'translate' | 'transition' | 'width' | 'height' | 'size'
|
|
958
|
+
> &
|
|
959
|
+
AdditionalHtmlProps
|
|
927
960
|
|
|
928
|
-
|
|
929
|
-
<
|
|
961
|
+
type Props<ComponentProps extends Dict, AdditionalProps extends Dict = {}> = Assign<
|
|
962
|
+
Polyfill<ComponentProps>,
|
|
963
|
+
AdditionalProps
|
|
964
|
+
>
|
|
965
|
+
|
|
966
|
+
export type ${componentName}<ComponentType extends ElementType, AdditionalProps extends Dict = {}> = {
|
|
967
|
+
(
|
|
968
|
+
props: Props<ComponentProps<ComponentType>, AdditionalProps> & JsxStyleProps<AdditionalProps>,
|
|
969
|
+
): JSX.Element
|
|
930
970
|
displayName?: string
|
|
931
971
|
}
|
|
932
972
|
|
|
933
|
-
export type PolymorphicComponents = {
|
|
934
|
-
[K in Element]: PolymorphicComponent<K, {}>
|
|
935
|
-
}
|
|
936
973
|
|
|
937
|
-
export type
|
|
974
|
+
export type ${upperName} = {
|
|
975
|
+
<Component extends ElementType, AdditionalProps extends Dict = {}>(component: Component): ${componentName}<
|
|
976
|
+
Component,
|
|
977
|
+
AdditionalProps
|
|
978
|
+
>
|
|
979
|
+
} & { [K in keyof JSX.IntrinsicElements]: ${componentName}<K, {}> }
|
|
980
|
+
|
|
981
|
+
export type ${typeName}<ComponentType extends ElementType> = Polyfill<ComponentProps<ComponentType>> & JsxStyleProps
|
|
938
982
|
`
|
|
939
983
|
};
|
|
940
984
|
}
|
|
@@ -978,22 +1022,22 @@ function generateLayoutGrid(ctx) {
|
|
|
978
1022
|
}
|
|
979
1023
|
|
|
980
1024
|
// src/generators/pattern.ts
|
|
981
|
-
var
|
|
1025
|
+
var import_shared2 = require("@pandacss/shared");
|
|
982
1026
|
var import_outdent18 = require("outdent");
|
|
983
1027
|
var import_telejson = require("telejson");
|
|
984
1028
|
var import_ts_pattern4 = require("ts-pattern");
|
|
985
1029
|
function generate4(name, pattern) {
|
|
986
1030
|
const { properties, transform, strict, description } = pattern;
|
|
987
|
-
const upperName = (0,
|
|
1031
|
+
const upperName = (0, import_shared2.capitalize)(name);
|
|
988
1032
|
const upperFn = `get${upperName}Style`;
|
|
989
1033
|
return {
|
|
990
|
-
name: (0,
|
|
1034
|
+
name: (0, import_shared2.dashCase)(name),
|
|
991
1035
|
dts: import_outdent18.outdent`
|
|
992
1036
|
import { SystemStyleObject, ConditionalValue } from "../types"
|
|
993
1037
|
import { Properties } from "../types/csstype"
|
|
994
1038
|
import { Tokens } from "../types/token"
|
|
995
1039
|
|
|
996
|
-
export type ${(0,
|
|
1040
|
+
export type ${(0, import_shared2.capitalize)(name)}Properties = {
|
|
997
1041
|
${Object.keys(properties ?? {}).map((key) => {
|
|
998
1042
|
const value = properties[key];
|
|
999
1043
|
return (0, import_ts_pattern4.match)(value).with({ type: "property" }, (value2) => {
|
|
@@ -1004,7 +1048,7 @@ function generate4(name, pattern) {
|
|
|
1004
1048
|
}
|
|
1005
1049
|
return `${key}?: ConditionalValue<Tokens["${value2.value}"]>`;
|
|
1006
1050
|
}).with({ type: "enum" }, (value2) => {
|
|
1007
|
-
return `${key}?: ConditionalValue<${(0,
|
|
1051
|
+
return `${key}?: ConditionalValue<${(0, import_shared2.unionType)(value2.value)}>`;
|
|
1008
1052
|
}).otherwise(() => {
|
|
1009
1053
|
return `${key}?: ConditionalValue<${value.type}>`;
|
|
1010
1054
|
});
|
|
@@ -1068,7 +1112,7 @@ function generatePropTypes(utility) {
|
|
|
1068
1112
|
}
|
|
1069
1113
|
|
|
1070
1114
|
// src/generators/recipe.ts
|
|
1071
|
-
var
|
|
1115
|
+
var import_shared3 = require("@pandacss/shared");
|
|
1072
1116
|
var import_outdent20 = require("outdent");
|
|
1073
1117
|
function generateRecipes(ctx) {
|
|
1074
1118
|
const { recipes = {}, hash, hasRecipes, utility } = ctx;
|
|
@@ -1117,16 +1161,16 @@ function generateRecipes(ctx) {
|
|
|
1117
1161
|
dts.push(import_outdent20.outdent`
|
|
1118
1162
|
import { ConditionalValue } from "../types"
|
|
1119
1163
|
|
|
1120
|
-
export type ${(0,
|
|
1164
|
+
export type ${(0, import_shared3.capitalize)(name)}Variants = {
|
|
1121
1165
|
${Object.keys(variants ?? {}).map((key) => {
|
|
1122
1166
|
const value = variants[key];
|
|
1123
1167
|
const keys = Object.keys(value);
|
|
1124
|
-
return `${key}?: ConditionalValue<${(0,
|
|
1168
|
+
return `${key}?: ConditionalValue<${(0, import_shared3.unionType)(keys)}>`;
|
|
1125
1169
|
}).join("\n")}
|
|
1126
1170
|
}
|
|
1127
1171
|
|
|
1128
1172
|
${description ? `/** ${description} */` : ""}
|
|
1129
|
-
export declare function ${name}(value?: ${(0,
|
|
1173
|
+
export declare function ${name}(value?: ${(0, import_shared3.capitalize)(name)}Variants): string
|
|
1130
1174
|
`);
|
|
1131
1175
|
});
|
|
1132
1176
|
return {
|
|
@@ -1309,20 +1353,20 @@ function cleanupSelectors(css2, varSelector) {
|
|
|
1309
1353
|
}
|
|
1310
1354
|
|
|
1311
1355
|
// src/generators/token-dts.ts
|
|
1312
|
-
var
|
|
1356
|
+
var import_shared4 = require("@pandacss/shared");
|
|
1313
1357
|
var import_outdent21 = require("outdent");
|
|
1314
1358
|
var import_pluralize = __toESM(require("pluralize"));
|
|
1315
1359
|
function generateTokenDts(dict) {
|
|
1316
1360
|
const set = /* @__PURE__ */ new Set();
|
|
1317
|
-
set.add(`export type Token = ${dict.isEmpty ? "string" : (0,
|
|
1361
|
+
set.add(`export type Token = ${dict.isEmpty ? "string" : (0, import_shared4.unionType)(dict.allNames)}`);
|
|
1318
1362
|
const result = /* @__PURE__ */ new Set(["export type Tokens = {"]);
|
|
1319
1363
|
if (dict.isEmpty) {
|
|
1320
1364
|
result.add("[token: string]: string");
|
|
1321
1365
|
} else {
|
|
1322
1366
|
for (const [key, value] of dict.categoryMap.entries()) {
|
|
1323
|
-
const typeName = (0,
|
|
1324
|
-
set.add(`export type ${typeName} = ${(0,
|
|
1325
|
-
set.add(`export type ColorPalette = ${(0,
|
|
1367
|
+
const typeName = (0, import_shared4.capitalize)(import_pluralize.default.singular(key));
|
|
1368
|
+
set.add(`export type ${typeName} = ${(0, import_shared4.unionType)(value.keys())}`);
|
|
1369
|
+
set.add(`export type ColorPalette = ${(0, import_shared4.unionType)(Object.keys(dict.colorPalettes))}`);
|
|
1326
1370
|
result.add(` ${key}: ${typeName}`);
|
|
1327
1371
|
}
|
|
1328
1372
|
}
|
|
@@ -1527,7 +1571,6 @@ function setupJsx(ctx) {
|
|
|
1527
1571
|
export * from './factory'
|
|
1528
1572
|
export * from './layout-grid'
|
|
1529
1573
|
${import_outdent24.default.string(patterns.map((file) => `export * from './${file.name}'`).join("\n"))}
|
|
1530
|
-
export type { HTML${ctx.jsxFactoryName}Props } from '../types/jsx'
|
|
1531
1574
|
`;
|
|
1532
1575
|
return {
|
|
1533
1576
|
dir: ctx.paths.jsx,
|
|
@@ -1539,7 +1582,13 @@ function setupJsx(ctx) {
|
|
|
1539
1582
|
{ file: "is-valid-prop.mjs", code: isValidProp.js },
|
|
1540
1583
|
{ file: "factory.d.ts", code: types.jsxFactory },
|
|
1541
1584
|
{ file: "factory.jsx", code: factory.js },
|
|
1542
|
-
{
|
|
1585
|
+
{
|
|
1586
|
+
file: "index.d.ts",
|
|
1587
|
+
code: import_outdent24.default`
|
|
1588
|
+
${indexCode}
|
|
1589
|
+
export type { ${ctx.jsxFactoryDetails.typeName} } from '../types/jsx'
|
|
1590
|
+
`
|
|
1591
|
+
},
|
|
1543
1592
|
{ file: "index.jsx", code: indexCode }
|
|
1544
1593
|
]
|
|
1545
1594
|
};
|
|
@@ -1685,7 +1734,7 @@ function getBaseCss(ctx) {
|
|
|
1685
1734
|
var import_core4 = require("@pandacss/core");
|
|
1686
1735
|
var import_error = require("@pandacss/error");
|
|
1687
1736
|
var import_logger5 = require("@pandacss/logger");
|
|
1688
|
-
var
|
|
1737
|
+
var import_shared6 = require("@pandacss/shared");
|
|
1689
1738
|
var import_fs4 = require("fs");
|
|
1690
1739
|
var import_fs_extra3 = require("fs-extra");
|
|
1691
1740
|
var import_path4 = require("path");
|
|
@@ -1699,7 +1748,7 @@ var import_core3 = require("@pandacss/core");
|
|
|
1699
1748
|
var import_is_valid_prop2 = require("@pandacss/is-valid-prop");
|
|
1700
1749
|
var import_logger4 = require("@pandacss/logger");
|
|
1701
1750
|
var import_parser = require("@pandacss/parser");
|
|
1702
|
-
var
|
|
1751
|
+
var import_shared5 = require("@pandacss/shared");
|
|
1703
1752
|
var import_token_dictionary = require("@pandacss/token-dictionary");
|
|
1704
1753
|
var import_fast_glob = __toESM(require("fast-glob"));
|
|
1705
1754
|
var import_fs3 = require("fs");
|
|
@@ -1710,7 +1759,7 @@ var import_postcss2 = __toESM(require("postcss"));
|
|
|
1710
1759
|
var import_ts_morph = require("ts-morph");
|
|
1711
1760
|
var import_ts_pattern5 = require("ts-pattern");
|
|
1712
1761
|
var helpers = {
|
|
1713
|
-
map:
|
|
1762
|
+
map: import_shared5.mapObject
|
|
1714
1763
|
};
|
|
1715
1764
|
var fileSystem = {
|
|
1716
1765
|
read: (path) => {
|
|
@@ -1723,18 +1772,6 @@ var fileSystem = {
|
|
|
1723
1772
|
return (0, import_promises.unlink)(path);
|
|
1724
1773
|
}
|
|
1725
1774
|
};
|
|
1726
|
-
function splitProps(obj, keys) {
|
|
1727
|
-
const omitted = {};
|
|
1728
|
-
const picked = {};
|
|
1729
|
-
for (const [key, value] of Object.entries(obj)) {
|
|
1730
|
-
if (keys.includes(key)) {
|
|
1731
|
-
picked[key] = value;
|
|
1732
|
-
} else {
|
|
1733
|
-
omitted[key] = value;
|
|
1734
|
-
}
|
|
1735
|
-
}
|
|
1736
|
-
return [picked, omitted];
|
|
1737
|
-
}
|
|
1738
1775
|
function createContext(conf, io = fileSystem) {
|
|
1739
1776
|
const { config } = conf;
|
|
1740
1777
|
const {
|
|
@@ -1762,7 +1799,13 @@ function createContext(conf, io = fileSystem) {
|
|
|
1762
1799
|
textStyles,
|
|
1763
1800
|
layerStyles
|
|
1764
1801
|
} = theme;
|
|
1765
|
-
const
|
|
1802
|
+
const jsxFactoryDetails = {
|
|
1803
|
+
name: jsxFactory,
|
|
1804
|
+
upperName: (0, import_shared5.capitalize)(jsxFactory),
|
|
1805
|
+
typeName: `HTML${(0, import_shared5.capitalize)(jsxFactory)}Props`,
|
|
1806
|
+
componentName: `${(0, import_shared5.capitalize)(jsxFactory)}Component`,
|
|
1807
|
+
framework: jsxFramework
|
|
1808
|
+
};
|
|
1766
1809
|
const cwd = (0, import_path2.resolve)(cwdProp);
|
|
1767
1810
|
const exclude = [".git", "node_modules", "test-results"].concat(excludeProp);
|
|
1768
1811
|
const tokens = new import_token_dictionary.TokenDictionary({
|
|
@@ -1784,7 +1827,7 @@ function createContext(conf, io = fileSystem) {
|
|
|
1784
1827
|
import_logger4.logger.debug({ type: "ctx:conditions", msg: conditions });
|
|
1785
1828
|
(0, import_core3.assignCompositions)(
|
|
1786
1829
|
{ conditions, utility },
|
|
1787
|
-
(0,
|
|
1830
|
+
(0, import_shared5.compact)({
|
|
1788
1831
|
textStyle: textStyles,
|
|
1789
1832
|
layerStyle: layerStyles
|
|
1790
1833
|
})
|
|
@@ -1803,14 +1846,25 @@ function createContext(conf, io = fileSystem) {
|
|
|
1803
1846
|
const pattern = getPattern(name);
|
|
1804
1847
|
return pattern?.transform?.(data, helpers) ?? {};
|
|
1805
1848
|
}
|
|
1849
|
+
function getPatternDetails(name, pattern) {
|
|
1850
|
+
const upperName = (0, import_shared5.capitalize)(name);
|
|
1851
|
+
return {
|
|
1852
|
+
name,
|
|
1853
|
+
props: Object.keys(pattern?.properties ?? {}),
|
|
1854
|
+
dashName: (0, import_shared5.dashCase)(name),
|
|
1855
|
+
upperName,
|
|
1856
|
+
styleFn: `get${upperName}Style`,
|
|
1857
|
+
jsxName: pattern?.jsx ?? upperName
|
|
1858
|
+
};
|
|
1859
|
+
}
|
|
1806
1860
|
const patternNodes = Object.entries(patterns).map(([name, pattern]) => ({
|
|
1807
1861
|
type: "pattern",
|
|
1808
|
-
name: pattern.jsx ?? (0,
|
|
1862
|
+
name: pattern.jsx ?? (0, import_shared5.capitalize)(name),
|
|
1809
1863
|
props: Object.keys(pattern.properties),
|
|
1810
1864
|
baseName: name
|
|
1811
1865
|
}));
|
|
1812
1866
|
function getPatternFnName(jsx) {
|
|
1813
|
-
return patternNodes.find((node) => node.name === jsx)?.baseName ?? (0,
|
|
1867
|
+
return patternNodes.find((node) => node.name === jsx)?.baseName ?? (0, import_shared5.uncapitalize)(jsx);
|
|
1814
1868
|
}
|
|
1815
1869
|
const hasPatterns = Object.keys(patterns).length > 0;
|
|
1816
1870
|
function getRecipe(name) {
|
|
@@ -1818,18 +1872,18 @@ function createContext(conf, io = fileSystem) {
|
|
|
1818
1872
|
}
|
|
1819
1873
|
const recipeNodes = Object.entries(recipes).map(([name, recipe]) => ({
|
|
1820
1874
|
type: "recipe",
|
|
1821
|
-
name: recipe.jsx ?? (0,
|
|
1875
|
+
name: recipe.jsx ?? (0, import_shared5.capitalize)(name),
|
|
1822
1876
|
props: Object.keys(recipe.variants ?? {}),
|
|
1823
1877
|
baseName: name
|
|
1824
1878
|
}));
|
|
1825
1879
|
function getRecipeFnName(jsx) {
|
|
1826
|
-
return recipeNodes.find((node) => node.name === jsx)?.baseName ?? (0,
|
|
1880
|
+
return recipeNodes.find((node) => node.name === jsx)?.baseName ?? (0, import_shared5.uncapitalize)(jsx);
|
|
1827
1881
|
}
|
|
1828
1882
|
function splitRecipeProps(name, props) {
|
|
1829
1883
|
const recipe = recipeNodes.find((node) => node.name === name);
|
|
1830
1884
|
if (!recipe)
|
|
1831
1885
|
return [{}, props];
|
|
1832
|
-
return
|
|
1886
|
+
return (0, import_shared5.splitObject)(props, (key) => recipe.props.includes(key));
|
|
1833
1887
|
}
|
|
1834
1888
|
function getRecipeDetails() {
|
|
1835
1889
|
return Object.entries(recipes).map(([name, recipe]) => ({
|
|
@@ -2086,6 +2140,7 @@ function createContext(conf, io = fileSystem) {
|
|
|
2086
2140
|
write,
|
|
2087
2141
|
writeOutput,
|
|
2088
2142
|
cleanOutdir,
|
|
2143
|
+
cssVarRoot,
|
|
2089
2144
|
tokens,
|
|
2090
2145
|
hasTokens,
|
|
2091
2146
|
utility,
|
|
@@ -2098,14 +2153,13 @@ function createContext(conf, io = fileSystem) {
|
|
|
2098
2153
|
execPattern,
|
|
2099
2154
|
patternNodes,
|
|
2100
2155
|
getPatternFnName,
|
|
2156
|
+
getPatternDetails,
|
|
2101
2157
|
recipes,
|
|
2102
2158
|
getRecipe,
|
|
2103
2159
|
hasRecipes,
|
|
2104
2160
|
getRecipeDetails,
|
|
2105
|
-
jsxFramework,
|
|
2106
|
-
jsxFactoryName,
|
|
2107
2161
|
jsxFactory,
|
|
2108
|
-
|
|
2162
|
+
jsxFactoryDetails,
|
|
2109
2163
|
properties,
|
|
2110
2164
|
extract
|
|
2111
2165
|
};
|
|
@@ -2176,7 +2230,7 @@ function getConfigHash() {
|
|
|
2176
2230
|
if (!file) {
|
|
2177
2231
|
throw new import_error.ConfigNotFoundError();
|
|
2178
2232
|
}
|
|
2179
|
-
return (0,
|
|
2233
|
+
return (0, import_shared6.toHash)((0, import_fs4.readFileSync)(file, "utf-8"));
|
|
2180
2234
|
}
|
|
2181
2235
|
var setupCount = 0;
|
|
2182
2236
|
var Builder = class {
|