@pandacss/generator 0.30.1 → 0.30.2
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.js +145 -74
- package/dist/index.mjs +145 -74
- package/package.json +7 -7
package/dist/index.js
CHANGED
|
@@ -1903,63 +1903,88 @@ function generateSolidJsxFactory(ctx) {
|
|
|
1903
1903
|
const { componentName, factoryName } = ctx.jsx;
|
|
1904
1904
|
return {
|
|
1905
1905
|
js: import_outdent29.outdent`
|
|
1906
|
-
import { Dynamic } from 'solid-js/web'
|
|
1907
1906
|
import { createMemo, mergeProps, splitProps } from 'solid-js'
|
|
1908
|
-
import { createComponent } from 'solid-js/web'
|
|
1907
|
+
import { Dynamic, createComponent } from 'solid-js/web'
|
|
1908
|
+
${ctx.file.import("css, cx, cva", "../css/index")}
|
|
1909
|
+
${ctx.file.import("normalizeHTMLProps", "../helpers")}
|
|
1909
1910
|
${ctx.file.import(
|
|
1910
|
-
"
|
|
1911
|
+
"composeCvaFn, composeShouldForwardProps, defaultShouldForwardProp, getDisplayName",
|
|
1911
1912
|
"./factory-helper"
|
|
1912
1913
|
)}
|
|
1913
1914
|
${ctx.file.import("isCssProperty", "./is-valid-prop")}
|
|
1914
|
-
${ctx.file.import("css, cx, cva", "../css/index")}
|
|
1915
|
-
${ctx.file.import("normalizeHTMLProps", "../helpers")}
|
|
1916
1915
|
|
|
1917
1916
|
function styledFn(element, configOrCva = {}, options = {}) {
|
|
1918
|
-
const cvaFn =
|
|
1917
|
+
const cvaFn =
|
|
1918
|
+
configOrCva.__cva__ || configOrCva.__recipe__
|
|
1919
|
+
? configOrCva
|
|
1920
|
+
: cva(configOrCva)
|
|
1919
1921
|
|
|
1920
1922
|
const forwardFn = options.shouldForwardProp || defaultShouldForwardProp
|
|
1921
1923
|
const shouldForwardProp = (prop) => forwardFn(prop, cvaFn.variantKeys)
|
|
1922
1924
|
|
|
1923
1925
|
const defaultProps = Object.assign(
|
|
1924
|
-
options.dataAttr && configOrCva.__name__
|
|
1925
|
-
|
|
1926
|
+
options.dataAttr && configOrCva.__name__
|
|
1927
|
+
? { 'data-recipe': configOrCva.__name__ }
|
|
1928
|
+
: {},
|
|
1929
|
+
options.defaultProps
|
|
1926
1930
|
)
|
|
1927
1931
|
|
|
1928
1932
|
const ${componentName} = (props) => {
|
|
1929
|
-
const mergedProps = mergeProps(
|
|
1930
|
-
|
|
1931
|
-
|
|
1932
|
-
|
|
1933
|
-
|
|
1934
|
-
const forwardedKeys = createMemo(() =>
|
|
1935
|
-
Object.keys(props).filter((prop) => !normalizeHTMLProps.keys.includes(prop) && shouldForwardProp(prop)),
|
|
1933
|
+
const mergedProps = mergeProps(
|
|
1934
|
+
{ as: element.__base__ || element },
|
|
1935
|
+
defaultProps,
|
|
1936
|
+
props
|
|
1936
1937
|
)
|
|
1937
1938
|
|
|
1938
|
-
const
|
|
1939
|
-
|
|
1940
|
-
|
|
1941
|
-
|
|
1942
|
-
|
|
1939
|
+
const __cvaFn__ = composeCvaFn(element.__cva__, cvaFn)
|
|
1940
|
+
|
|
1941
|
+
const __shouldForwardProps__ = composeShouldForwardProps(
|
|
1942
|
+
element,
|
|
1943
|
+
shouldForwardProp
|
|
1943
1944
|
)
|
|
1944
1945
|
|
|
1945
|
-
const
|
|
1946
|
+
const [localProps, restProps] = splitProps(mergedProps, [
|
|
1947
|
+
'as',
|
|
1948
|
+
'class',
|
|
1949
|
+
'className',
|
|
1950
|
+
])
|
|
1946
1951
|
|
|
1947
|
-
const [
|
|
1948
|
-
|
|
1949
|
-
|
|
1950
|
-
|
|
1951
|
-
|
|
1952
|
+
const [htmlProps, aProps] = splitProps(restProps, normalizeHTMLProps.keys)
|
|
1953
|
+
|
|
1954
|
+
const forwardedKeys = createMemo(() => {
|
|
1955
|
+
const keys = Object.keys(aProps)
|
|
1956
|
+
return keys.filter((prop) => __shouldForwardProps__(prop))
|
|
1957
|
+
})
|
|
1958
|
+
|
|
1959
|
+
const [forwardedProps, variantProps, bProps] = splitProps(aProps, forwardedKeys(), __cvaFn__.variantKeys)
|
|
1960
|
+
|
|
1961
|
+
const cssPropKeys = createMemo(() => {
|
|
1962
|
+
const keys = Object.keys(bProps)
|
|
1963
|
+
return keys.filter((prop) => isCssProperty(prop))
|
|
1964
|
+
})
|
|
1965
|
+
|
|
1966
|
+
const [styleProps, elementProps] = splitProps(bProps, cssPropKeys())
|
|
1952
1967
|
|
|
1953
1968
|
function recipeClass() {
|
|
1954
1969
|
const { css: cssStyles, ...propStyles } = styleProps
|
|
1955
|
-
const compoundVariantStyles =
|
|
1956
|
-
|
|
1970
|
+
const compoundVariantStyles =
|
|
1971
|
+
__cvaFn__.__getCompoundVariantCss__?.(variantProps)
|
|
1972
|
+
return cx(
|
|
1973
|
+
__cvaFn__(variantProps, false),
|
|
1974
|
+
css(compoundVariantStyles, propStyles, cssStyles),
|
|
1975
|
+
localProps.class,
|
|
1976
|
+
localProps.className
|
|
1977
|
+
)
|
|
1957
1978
|
}
|
|
1958
|
-
|
|
1979
|
+
|
|
1959
1980
|
function cvaClass() {
|
|
1960
1981
|
const { css: cssStyles, ...propStyles } = styleProps
|
|
1961
1982
|
const cvaStyles = __cvaFn__.raw(variantProps)
|
|
1962
|
-
return cx(
|
|
1983
|
+
return cx(
|
|
1984
|
+
css(cvaStyles, propStyles, cssStyles),
|
|
1985
|
+
localProps.class,
|
|
1986
|
+
localProps.className
|
|
1987
|
+
)
|
|
1963
1988
|
}
|
|
1964
1989
|
|
|
1965
1990
|
const classes = configOrCva.__recipe__ ? recipeClass : cvaClass
|
|
@@ -1970,19 +1995,14 @@ function generateSolidJsxFactory(ctx) {
|
|
|
1970
1995
|
|
|
1971
1996
|
return createComponent(
|
|
1972
1997
|
Dynamic,
|
|
1973
|
-
mergeProps(
|
|
1974
|
-
|
|
1975
|
-
|
|
1976
|
-
normalizeHTMLProps(htmlProps),
|
|
1977
|
-
{
|
|
1978
|
-
get component() {
|
|
1979
|
-
return localProps.as
|
|
1980
|
-
},
|
|
1981
|
-
get class() {
|
|
1982
|
-
return classes()
|
|
1983
|
-
}
|
|
1998
|
+
mergeProps(forwardedProps, elementProps, normalizeHTMLProps(htmlProps), {
|
|
1999
|
+
get component() {
|
|
2000
|
+
return localProps.as
|
|
1984
2001
|
},
|
|
1985
|
-
|
|
2002
|
+
get class() {
|
|
2003
|
+
return classes()
|
|
2004
|
+
},
|
|
2005
|
+
})
|
|
1986
2006
|
)
|
|
1987
2007
|
}
|
|
1988
2008
|
|
|
@@ -2288,8 +2308,11 @@ function generateVueJsxFactory(ctx) {
|
|
|
2288
2308
|
const ${componentName} = defineComponent({
|
|
2289
2309
|
name: \`${factoryName}.\${name}\`,
|
|
2290
2310
|
inheritAttrs: false,
|
|
2291
|
-
props: {
|
|
2292
|
-
|
|
2311
|
+
props: {
|
|
2312
|
+
modelValue: null,
|
|
2313
|
+
as: { type: [String, Object], default: Dynamic.__base__ || Dynamic }
|
|
2314
|
+
},
|
|
2315
|
+
setup(props, { slots, attrs, emit }) {
|
|
2293
2316
|
const __cvaFn__ = composeCvaFn(Dynamic.__cva__, cvaFn)
|
|
2294
2317
|
const __shouldForwardProps__ = composeShouldForwardProps(Dynamic, shouldForwardProp)
|
|
2295
2318
|
|
|
@@ -2315,17 +2338,48 @@ function generateVueJsxFactory(ctx) {
|
|
|
2315
2338
|
|
|
2316
2339
|
const classes = configOrCva.__recipe__ ? recipeClass : cvaClass
|
|
2317
2340
|
|
|
2341
|
+
const vModelProps = computed(() => {
|
|
2342
|
+
const result = {};
|
|
2343
|
+
|
|
2344
|
+
if (
|
|
2345
|
+
props.as === 'input' &&
|
|
2346
|
+
(props.type === 'checkbox' || props.type === 'radio')
|
|
2347
|
+
) {
|
|
2348
|
+
result.checked = props.modelValue;
|
|
2349
|
+
result.onChange = (event) => {
|
|
2350
|
+
const checked = !event.currentTarget.checked;
|
|
2351
|
+
emit('change', checked, event);
|
|
2352
|
+
emit('update:modelValue', checked, event);
|
|
2353
|
+
};
|
|
2354
|
+
} else if (
|
|
2355
|
+
props.as === 'input' ||
|
|
2356
|
+
props.as === 'textarea' ||
|
|
2357
|
+
props.as === 'select'
|
|
2358
|
+
) {
|
|
2359
|
+
result.value = props.modelValue;
|
|
2360
|
+
result.onInput = (event) => {
|
|
2361
|
+
const value = event.currentTarget.value;
|
|
2362
|
+
emit('input', value, event);
|
|
2363
|
+
emit('update:modelValue', value, event);
|
|
2364
|
+
};
|
|
2365
|
+
}
|
|
2366
|
+
|
|
2367
|
+
return result;
|
|
2368
|
+
});
|
|
2369
|
+
|
|
2318
2370
|
return () => {
|
|
2319
2371
|
const [htmlProps, forwardedProps, _variantProps, _styleProps, elementProps] = splittedProps.value
|
|
2372
|
+
|
|
2320
2373
|
return h(
|
|
2321
2374
|
props.as,
|
|
2322
2375
|
{
|
|
2323
2376
|
...forwardedProps,
|
|
2324
2377
|
...elementProps,
|
|
2325
2378
|
...normalizeHTMLProps(htmlProps),
|
|
2379
|
+
...vModelProps.value,
|
|
2326
2380
|
class: classes.value,
|
|
2327
2381
|
},
|
|
2328
|
-
slots
|
|
2382
|
+
slots,
|
|
2329
2383
|
)
|
|
2330
2384
|
}
|
|
2331
2385
|
},
|
|
@@ -2339,19 +2393,13 @@ function generateVueJsxFactory(ctx) {
|
|
|
2339
2393
|
return ${componentName}
|
|
2340
2394
|
}
|
|
2341
2395
|
|
|
2342
|
-
|
|
2343
|
-
return new Proxy(styledFn, {
|
|
2344
|
-
apply(_, __, args) {
|
|
2345
|
-
return styledFn(...args)
|
|
2346
|
-
},
|
|
2347
|
-
get(_, el) {
|
|
2348
|
-
return styledFn(el)
|
|
2349
|
-
},
|
|
2350
|
-
})
|
|
2351
|
-
}
|
|
2396
|
+
const tags = 'a, abbr, address, area, article, aside, audio, b, base, bdi, bdo, big, blockquote, body, br, button, canvas, caption, cite, code, col, colgroup, data, datalist, dd, del, details, dfn, dialog, div, dl, dt, em, embed, fieldset, figcaption, figure, footer, form, h1, h2, h3, h4, h5, h6, head, header, hgroup, hr, html, i, iframe, img, input, ins, kbd, keygen, label, legend, li, link, main, map, mark, marquee, menu, menuitem, meta, meter, nav, noscript, object, ol, optgroup, option, output, p, param, picture, pre, progress, q, rp, rt, ruby, s, samp, script, section, select, small, source, span, strong, style, sub, summary, sup, table, tbody, td, textarea, tfoot, th, thead, time, title, tr, track, u, ul, var, video, wbr, circle, clipPath, defs, ellipse, foreignObject, g, image, line, linearGradient, mask, path, pattern, polygon, polyline, radialGradient, rect, stop, svg, text, tspan';
|
|
2352
2397
|
|
|
2353
|
-
export const ${factoryName} = /* @__PURE__ */
|
|
2398
|
+
export const ${factoryName} = /* @__PURE__ */ styledFn.bind();
|
|
2354
2399
|
|
|
2400
|
+
tags.split(', ').forEach((tag) => {
|
|
2401
|
+
styled[tag] = styled(tag);
|
|
2402
|
+
});
|
|
2355
2403
|
`
|
|
2356
2404
|
};
|
|
2357
2405
|
}
|
|
@@ -2375,11 +2423,43 @@ function generateVueJsxStringLiteralFactory(ctx) {
|
|
|
2375
2423
|
const ${componentName} = defineComponent({
|
|
2376
2424
|
name: \`${factoryName}.\${name}\`,
|
|
2377
2425
|
inheritAttrs: false,
|
|
2378
|
-
props: {
|
|
2379
|
-
|
|
2426
|
+
props: {
|
|
2427
|
+
modelValue: null,
|
|
2428
|
+
as: { type: [String, Object], default: Dynamic }
|
|
2429
|
+
},
|
|
2430
|
+
setup(props, { slots, attrs, emit }) {
|
|
2380
2431
|
const classes = computed(() => {
|
|
2381
2432
|
return cx(css(Dynamic.__styles__, styles), elementProps.className)
|
|
2382
2433
|
})
|
|
2434
|
+
|
|
2435
|
+
const vModelProps = computed(() => {
|
|
2436
|
+
const result = {};
|
|
2437
|
+
|
|
2438
|
+
if (
|
|
2439
|
+
props.as === 'input' &&
|
|
2440
|
+
(props.type === 'checkbox' || props.type === 'radio')
|
|
2441
|
+
) {
|
|
2442
|
+
result.checked = props.modelValue;
|
|
2443
|
+
result.onChange = (event) => {
|
|
2444
|
+
const checked = !event.currentTarget.checked;
|
|
2445
|
+
emit('change', checked, event);
|
|
2446
|
+
emit('update:modelValue', checked, event);
|
|
2447
|
+
};
|
|
2448
|
+
} else if (
|
|
2449
|
+
props.as === 'input' ||
|
|
2450
|
+
props.as === 'textarea' ||
|
|
2451
|
+
props.as === 'select'
|
|
2452
|
+
) {
|
|
2453
|
+
result.value = props.modelValue;
|
|
2454
|
+
result.onInput = (event) => {
|
|
2455
|
+
const value = event.currentTarget.value;
|
|
2456
|
+
emit('input', value, event);
|
|
2457
|
+
emit('update:modelValue', value, event);
|
|
2458
|
+
};
|
|
2459
|
+
}
|
|
2460
|
+
|
|
2461
|
+
return result;
|
|
2462
|
+
});
|
|
2383
2463
|
|
|
2384
2464
|
return () => {
|
|
2385
2465
|
return h(
|
|
@@ -2387,8 +2467,9 @@ function generateVueJsxStringLiteralFactory(ctx) {
|
|
|
2387
2467
|
{
|
|
2388
2468
|
class: classes.value,
|
|
2389
2469
|
...elementProps,
|
|
2470
|
+
...vModelProps.value,
|
|
2390
2471
|
},
|
|
2391
|
-
|
|
2472
|
+
slots
|
|
2392
2473
|
)
|
|
2393
2474
|
}
|
|
2394
2475
|
},
|
|
@@ -2401,23 +2482,13 @@ function generateVueJsxStringLiteralFactory(ctx) {
|
|
|
2401
2482
|
}
|
|
2402
2483
|
}
|
|
2403
2484
|
|
|
2404
|
-
|
|
2405
|
-
const cache = new Map()
|
|
2485
|
+
const tags = 'a, abbr, address, area, article, aside, audio, b, base, bdi, bdo, big, blockquote, body, br, button, canvas, caption, cite, code, col, colgroup, data, datalist, dd, del, details, dfn, dialog, div, dl, dt, em, embed, fieldset, figcaption, figure, footer, form, h1, h2, h3, h4, h5, h6, head, header, hgroup, hr, html, i, iframe, img, input, ins, kbd, keygen, label, legend, li, link, main, map, mark, marquee, menu, menuitem, meta, meter, nav, noscript, object, ol, optgroup, option, output, p, param, picture, pre, progress, q, rp, rt, ruby, s, samp, script, section, select, small, source, span, strong, style, sub, summary, sup, table, tbody, td, textarea, tfoot, th, thead, time, title, tr, track, u, ul, var, video, wbr, circle, clipPath, defs, ellipse, foreignObject, g, image, line, linearGradient, mask, path, pattern, polygon, polyline, radialGradient, rect, stop, svg, text, tspan';
|
|
2406
2486
|
|
|
2407
|
-
|
|
2408
|
-
apply(_, __, args) {
|
|
2409
|
-
return createStyled(...args)
|
|
2410
|
-
},
|
|
2411
|
-
get(_, el) {
|
|
2412
|
-
if (!cache.has(el)) {
|
|
2413
|
-
cache.set(el, createStyled(el))
|
|
2414
|
-
}
|
|
2415
|
-
return cache.get(el)
|
|
2416
|
-
},
|
|
2417
|
-
})
|
|
2418
|
-
}
|
|
2487
|
+
export const ${factoryName} = /* @__PURE__ */ styledFn.bind();
|
|
2419
2488
|
|
|
2420
|
-
|
|
2489
|
+
tags.split(', ').forEach((tag) => {
|
|
2490
|
+
styled[tag] = styled(tag);
|
|
2491
|
+
});
|
|
2421
2492
|
`
|
|
2422
2493
|
};
|
|
2423
2494
|
}
|
package/dist/index.mjs
CHANGED
|
@@ -1867,63 +1867,88 @@ function generateSolidJsxFactory(ctx) {
|
|
|
1867
1867
|
const { componentName, factoryName } = ctx.jsx;
|
|
1868
1868
|
return {
|
|
1869
1869
|
js: outdent29`
|
|
1870
|
-
import { Dynamic } from 'solid-js/web'
|
|
1871
1870
|
import { createMemo, mergeProps, splitProps } from 'solid-js'
|
|
1872
|
-
import { createComponent } from 'solid-js/web'
|
|
1871
|
+
import { Dynamic, createComponent } from 'solid-js/web'
|
|
1872
|
+
${ctx.file.import("css, cx, cva", "../css/index")}
|
|
1873
|
+
${ctx.file.import("normalizeHTMLProps", "../helpers")}
|
|
1873
1874
|
${ctx.file.import(
|
|
1874
|
-
"
|
|
1875
|
+
"composeCvaFn, composeShouldForwardProps, defaultShouldForwardProp, getDisplayName",
|
|
1875
1876
|
"./factory-helper"
|
|
1876
1877
|
)}
|
|
1877
1878
|
${ctx.file.import("isCssProperty", "./is-valid-prop")}
|
|
1878
|
-
${ctx.file.import("css, cx, cva", "../css/index")}
|
|
1879
|
-
${ctx.file.import("normalizeHTMLProps", "../helpers")}
|
|
1880
1879
|
|
|
1881
1880
|
function styledFn(element, configOrCva = {}, options = {}) {
|
|
1882
|
-
const cvaFn =
|
|
1881
|
+
const cvaFn =
|
|
1882
|
+
configOrCva.__cva__ || configOrCva.__recipe__
|
|
1883
|
+
? configOrCva
|
|
1884
|
+
: cva(configOrCva)
|
|
1883
1885
|
|
|
1884
1886
|
const forwardFn = options.shouldForwardProp || defaultShouldForwardProp
|
|
1885
1887
|
const shouldForwardProp = (prop) => forwardFn(prop, cvaFn.variantKeys)
|
|
1886
1888
|
|
|
1887
1889
|
const defaultProps = Object.assign(
|
|
1888
|
-
options.dataAttr && configOrCva.__name__
|
|
1889
|
-
|
|
1890
|
+
options.dataAttr && configOrCva.__name__
|
|
1891
|
+
? { 'data-recipe': configOrCva.__name__ }
|
|
1892
|
+
: {},
|
|
1893
|
+
options.defaultProps
|
|
1890
1894
|
)
|
|
1891
1895
|
|
|
1892
1896
|
const ${componentName} = (props) => {
|
|
1893
|
-
const mergedProps = mergeProps(
|
|
1894
|
-
|
|
1895
|
-
|
|
1896
|
-
|
|
1897
|
-
|
|
1898
|
-
const forwardedKeys = createMemo(() =>
|
|
1899
|
-
Object.keys(props).filter((prop) => !normalizeHTMLProps.keys.includes(prop) && shouldForwardProp(prop)),
|
|
1897
|
+
const mergedProps = mergeProps(
|
|
1898
|
+
{ as: element.__base__ || element },
|
|
1899
|
+
defaultProps,
|
|
1900
|
+
props
|
|
1900
1901
|
)
|
|
1901
1902
|
|
|
1902
|
-
const
|
|
1903
|
-
|
|
1904
|
-
|
|
1905
|
-
|
|
1906
|
-
|
|
1903
|
+
const __cvaFn__ = composeCvaFn(element.__cva__, cvaFn)
|
|
1904
|
+
|
|
1905
|
+
const __shouldForwardProps__ = composeShouldForwardProps(
|
|
1906
|
+
element,
|
|
1907
|
+
shouldForwardProp
|
|
1907
1908
|
)
|
|
1908
1909
|
|
|
1909
|
-
const
|
|
1910
|
+
const [localProps, restProps] = splitProps(mergedProps, [
|
|
1911
|
+
'as',
|
|
1912
|
+
'class',
|
|
1913
|
+
'className',
|
|
1914
|
+
])
|
|
1910
1915
|
|
|
1911
|
-
const [
|
|
1912
|
-
|
|
1913
|
-
|
|
1914
|
-
|
|
1915
|
-
|
|
1916
|
+
const [htmlProps, aProps] = splitProps(restProps, normalizeHTMLProps.keys)
|
|
1917
|
+
|
|
1918
|
+
const forwardedKeys = createMemo(() => {
|
|
1919
|
+
const keys = Object.keys(aProps)
|
|
1920
|
+
return keys.filter((prop) => __shouldForwardProps__(prop))
|
|
1921
|
+
})
|
|
1922
|
+
|
|
1923
|
+
const [forwardedProps, variantProps, bProps] = splitProps(aProps, forwardedKeys(), __cvaFn__.variantKeys)
|
|
1924
|
+
|
|
1925
|
+
const cssPropKeys = createMemo(() => {
|
|
1926
|
+
const keys = Object.keys(bProps)
|
|
1927
|
+
return keys.filter((prop) => isCssProperty(prop))
|
|
1928
|
+
})
|
|
1929
|
+
|
|
1930
|
+
const [styleProps, elementProps] = splitProps(bProps, cssPropKeys())
|
|
1916
1931
|
|
|
1917
1932
|
function recipeClass() {
|
|
1918
1933
|
const { css: cssStyles, ...propStyles } = styleProps
|
|
1919
|
-
const compoundVariantStyles =
|
|
1920
|
-
|
|
1934
|
+
const compoundVariantStyles =
|
|
1935
|
+
__cvaFn__.__getCompoundVariantCss__?.(variantProps)
|
|
1936
|
+
return cx(
|
|
1937
|
+
__cvaFn__(variantProps, false),
|
|
1938
|
+
css(compoundVariantStyles, propStyles, cssStyles),
|
|
1939
|
+
localProps.class,
|
|
1940
|
+
localProps.className
|
|
1941
|
+
)
|
|
1921
1942
|
}
|
|
1922
|
-
|
|
1943
|
+
|
|
1923
1944
|
function cvaClass() {
|
|
1924
1945
|
const { css: cssStyles, ...propStyles } = styleProps
|
|
1925
1946
|
const cvaStyles = __cvaFn__.raw(variantProps)
|
|
1926
|
-
return cx(
|
|
1947
|
+
return cx(
|
|
1948
|
+
css(cvaStyles, propStyles, cssStyles),
|
|
1949
|
+
localProps.class,
|
|
1950
|
+
localProps.className
|
|
1951
|
+
)
|
|
1927
1952
|
}
|
|
1928
1953
|
|
|
1929
1954
|
const classes = configOrCva.__recipe__ ? recipeClass : cvaClass
|
|
@@ -1934,19 +1959,14 @@ function generateSolidJsxFactory(ctx) {
|
|
|
1934
1959
|
|
|
1935
1960
|
return createComponent(
|
|
1936
1961
|
Dynamic,
|
|
1937
|
-
mergeProps(
|
|
1938
|
-
|
|
1939
|
-
|
|
1940
|
-
normalizeHTMLProps(htmlProps),
|
|
1941
|
-
{
|
|
1942
|
-
get component() {
|
|
1943
|
-
return localProps.as
|
|
1944
|
-
},
|
|
1945
|
-
get class() {
|
|
1946
|
-
return classes()
|
|
1947
|
-
}
|
|
1962
|
+
mergeProps(forwardedProps, elementProps, normalizeHTMLProps(htmlProps), {
|
|
1963
|
+
get component() {
|
|
1964
|
+
return localProps.as
|
|
1948
1965
|
},
|
|
1949
|
-
|
|
1966
|
+
get class() {
|
|
1967
|
+
return classes()
|
|
1968
|
+
},
|
|
1969
|
+
})
|
|
1950
1970
|
)
|
|
1951
1971
|
}
|
|
1952
1972
|
|
|
@@ -2252,8 +2272,11 @@ function generateVueJsxFactory(ctx) {
|
|
|
2252
2272
|
const ${componentName} = defineComponent({
|
|
2253
2273
|
name: \`${factoryName}.\${name}\`,
|
|
2254
2274
|
inheritAttrs: false,
|
|
2255
|
-
props: {
|
|
2256
|
-
|
|
2275
|
+
props: {
|
|
2276
|
+
modelValue: null,
|
|
2277
|
+
as: { type: [String, Object], default: Dynamic.__base__ || Dynamic }
|
|
2278
|
+
},
|
|
2279
|
+
setup(props, { slots, attrs, emit }) {
|
|
2257
2280
|
const __cvaFn__ = composeCvaFn(Dynamic.__cva__, cvaFn)
|
|
2258
2281
|
const __shouldForwardProps__ = composeShouldForwardProps(Dynamic, shouldForwardProp)
|
|
2259
2282
|
|
|
@@ -2279,17 +2302,48 @@ function generateVueJsxFactory(ctx) {
|
|
|
2279
2302
|
|
|
2280
2303
|
const classes = configOrCva.__recipe__ ? recipeClass : cvaClass
|
|
2281
2304
|
|
|
2305
|
+
const vModelProps = computed(() => {
|
|
2306
|
+
const result = {};
|
|
2307
|
+
|
|
2308
|
+
if (
|
|
2309
|
+
props.as === 'input' &&
|
|
2310
|
+
(props.type === 'checkbox' || props.type === 'radio')
|
|
2311
|
+
) {
|
|
2312
|
+
result.checked = props.modelValue;
|
|
2313
|
+
result.onChange = (event) => {
|
|
2314
|
+
const checked = !event.currentTarget.checked;
|
|
2315
|
+
emit('change', checked, event);
|
|
2316
|
+
emit('update:modelValue', checked, event);
|
|
2317
|
+
};
|
|
2318
|
+
} else if (
|
|
2319
|
+
props.as === 'input' ||
|
|
2320
|
+
props.as === 'textarea' ||
|
|
2321
|
+
props.as === 'select'
|
|
2322
|
+
) {
|
|
2323
|
+
result.value = props.modelValue;
|
|
2324
|
+
result.onInput = (event) => {
|
|
2325
|
+
const value = event.currentTarget.value;
|
|
2326
|
+
emit('input', value, event);
|
|
2327
|
+
emit('update:modelValue', value, event);
|
|
2328
|
+
};
|
|
2329
|
+
}
|
|
2330
|
+
|
|
2331
|
+
return result;
|
|
2332
|
+
});
|
|
2333
|
+
|
|
2282
2334
|
return () => {
|
|
2283
2335
|
const [htmlProps, forwardedProps, _variantProps, _styleProps, elementProps] = splittedProps.value
|
|
2336
|
+
|
|
2284
2337
|
return h(
|
|
2285
2338
|
props.as,
|
|
2286
2339
|
{
|
|
2287
2340
|
...forwardedProps,
|
|
2288
2341
|
...elementProps,
|
|
2289
2342
|
...normalizeHTMLProps(htmlProps),
|
|
2343
|
+
...vModelProps.value,
|
|
2290
2344
|
class: classes.value,
|
|
2291
2345
|
},
|
|
2292
|
-
slots
|
|
2346
|
+
slots,
|
|
2293
2347
|
)
|
|
2294
2348
|
}
|
|
2295
2349
|
},
|
|
@@ -2303,19 +2357,13 @@ function generateVueJsxFactory(ctx) {
|
|
|
2303
2357
|
return ${componentName}
|
|
2304
2358
|
}
|
|
2305
2359
|
|
|
2306
|
-
|
|
2307
|
-
return new Proxy(styledFn, {
|
|
2308
|
-
apply(_, __, args) {
|
|
2309
|
-
return styledFn(...args)
|
|
2310
|
-
},
|
|
2311
|
-
get(_, el) {
|
|
2312
|
-
return styledFn(el)
|
|
2313
|
-
},
|
|
2314
|
-
})
|
|
2315
|
-
}
|
|
2360
|
+
const tags = 'a, abbr, address, area, article, aside, audio, b, base, bdi, bdo, big, blockquote, body, br, button, canvas, caption, cite, code, col, colgroup, data, datalist, dd, del, details, dfn, dialog, div, dl, dt, em, embed, fieldset, figcaption, figure, footer, form, h1, h2, h3, h4, h5, h6, head, header, hgroup, hr, html, i, iframe, img, input, ins, kbd, keygen, label, legend, li, link, main, map, mark, marquee, menu, menuitem, meta, meter, nav, noscript, object, ol, optgroup, option, output, p, param, picture, pre, progress, q, rp, rt, ruby, s, samp, script, section, select, small, source, span, strong, style, sub, summary, sup, table, tbody, td, textarea, tfoot, th, thead, time, title, tr, track, u, ul, var, video, wbr, circle, clipPath, defs, ellipse, foreignObject, g, image, line, linearGradient, mask, path, pattern, polygon, polyline, radialGradient, rect, stop, svg, text, tspan';
|
|
2316
2361
|
|
|
2317
|
-
export const ${factoryName} = /* @__PURE__ */
|
|
2362
|
+
export const ${factoryName} = /* @__PURE__ */ styledFn.bind();
|
|
2318
2363
|
|
|
2364
|
+
tags.split(', ').forEach((tag) => {
|
|
2365
|
+
styled[tag] = styled(tag);
|
|
2366
|
+
});
|
|
2319
2367
|
`
|
|
2320
2368
|
};
|
|
2321
2369
|
}
|
|
@@ -2339,11 +2387,43 @@ function generateVueJsxStringLiteralFactory(ctx) {
|
|
|
2339
2387
|
const ${componentName} = defineComponent({
|
|
2340
2388
|
name: \`${factoryName}.\${name}\`,
|
|
2341
2389
|
inheritAttrs: false,
|
|
2342
|
-
props: {
|
|
2343
|
-
|
|
2390
|
+
props: {
|
|
2391
|
+
modelValue: null,
|
|
2392
|
+
as: { type: [String, Object], default: Dynamic }
|
|
2393
|
+
},
|
|
2394
|
+
setup(props, { slots, attrs, emit }) {
|
|
2344
2395
|
const classes = computed(() => {
|
|
2345
2396
|
return cx(css(Dynamic.__styles__, styles), elementProps.className)
|
|
2346
2397
|
})
|
|
2398
|
+
|
|
2399
|
+
const vModelProps = computed(() => {
|
|
2400
|
+
const result = {};
|
|
2401
|
+
|
|
2402
|
+
if (
|
|
2403
|
+
props.as === 'input' &&
|
|
2404
|
+
(props.type === 'checkbox' || props.type === 'radio')
|
|
2405
|
+
) {
|
|
2406
|
+
result.checked = props.modelValue;
|
|
2407
|
+
result.onChange = (event) => {
|
|
2408
|
+
const checked = !event.currentTarget.checked;
|
|
2409
|
+
emit('change', checked, event);
|
|
2410
|
+
emit('update:modelValue', checked, event);
|
|
2411
|
+
};
|
|
2412
|
+
} else if (
|
|
2413
|
+
props.as === 'input' ||
|
|
2414
|
+
props.as === 'textarea' ||
|
|
2415
|
+
props.as === 'select'
|
|
2416
|
+
) {
|
|
2417
|
+
result.value = props.modelValue;
|
|
2418
|
+
result.onInput = (event) => {
|
|
2419
|
+
const value = event.currentTarget.value;
|
|
2420
|
+
emit('input', value, event);
|
|
2421
|
+
emit('update:modelValue', value, event);
|
|
2422
|
+
};
|
|
2423
|
+
}
|
|
2424
|
+
|
|
2425
|
+
return result;
|
|
2426
|
+
});
|
|
2347
2427
|
|
|
2348
2428
|
return () => {
|
|
2349
2429
|
return h(
|
|
@@ -2351,8 +2431,9 @@ function generateVueJsxStringLiteralFactory(ctx) {
|
|
|
2351
2431
|
{
|
|
2352
2432
|
class: classes.value,
|
|
2353
2433
|
...elementProps,
|
|
2434
|
+
...vModelProps.value,
|
|
2354
2435
|
},
|
|
2355
|
-
|
|
2436
|
+
slots
|
|
2356
2437
|
)
|
|
2357
2438
|
}
|
|
2358
2439
|
},
|
|
@@ -2365,23 +2446,13 @@ function generateVueJsxStringLiteralFactory(ctx) {
|
|
|
2365
2446
|
}
|
|
2366
2447
|
}
|
|
2367
2448
|
|
|
2368
|
-
|
|
2369
|
-
const cache = new Map()
|
|
2449
|
+
const tags = 'a, abbr, address, area, article, aside, audio, b, base, bdi, bdo, big, blockquote, body, br, button, canvas, caption, cite, code, col, colgroup, data, datalist, dd, del, details, dfn, dialog, div, dl, dt, em, embed, fieldset, figcaption, figure, footer, form, h1, h2, h3, h4, h5, h6, head, header, hgroup, hr, html, i, iframe, img, input, ins, kbd, keygen, label, legend, li, link, main, map, mark, marquee, menu, menuitem, meta, meter, nav, noscript, object, ol, optgroup, option, output, p, param, picture, pre, progress, q, rp, rt, ruby, s, samp, script, section, select, small, source, span, strong, style, sub, summary, sup, table, tbody, td, textarea, tfoot, th, thead, time, title, tr, track, u, ul, var, video, wbr, circle, clipPath, defs, ellipse, foreignObject, g, image, line, linearGradient, mask, path, pattern, polygon, polyline, radialGradient, rect, stop, svg, text, tspan';
|
|
2370
2450
|
|
|
2371
|
-
|
|
2372
|
-
apply(_, __, args) {
|
|
2373
|
-
return createStyled(...args)
|
|
2374
|
-
},
|
|
2375
|
-
get(_, el) {
|
|
2376
|
-
if (!cache.has(el)) {
|
|
2377
|
-
cache.set(el, createStyled(el))
|
|
2378
|
-
}
|
|
2379
|
-
return cache.get(el)
|
|
2380
|
-
},
|
|
2381
|
-
})
|
|
2382
|
-
}
|
|
2451
|
+
export const ${factoryName} = /* @__PURE__ */ styledFn.bind();
|
|
2383
2452
|
|
|
2384
|
-
|
|
2453
|
+
tags.split(', ').forEach((tag) => {
|
|
2454
|
+
styled[tag] = styled(tag);
|
|
2455
|
+
});
|
|
2385
2456
|
`
|
|
2386
2457
|
};
|
|
2387
2458
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pandacss/generator",
|
|
3
|
-
"version": "0.30.
|
|
3
|
+
"version": "0.30.2",
|
|
4
4
|
"description": "The css generator for css panda",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -37,12 +37,12 @@
|
|
|
37
37
|
"pluralize": "8.0.0",
|
|
38
38
|
"postcss": "^8.4.31",
|
|
39
39
|
"ts-pattern": "5.0.5",
|
|
40
|
-
"@pandacss/core": "0.30.
|
|
41
|
-
"@pandacss/is-valid-prop": "^0.30.
|
|
42
|
-
"@pandacss/logger": "0.30.
|
|
43
|
-
"@pandacss/shared": "0.30.
|
|
44
|
-
"@pandacss/token-dictionary": "0.30.
|
|
45
|
-
"@pandacss/types": "0.30.
|
|
40
|
+
"@pandacss/core": "0.30.2",
|
|
41
|
+
"@pandacss/is-valid-prop": "^0.30.2",
|
|
42
|
+
"@pandacss/logger": "0.30.2",
|
|
43
|
+
"@pandacss/shared": "0.30.2",
|
|
44
|
+
"@pandacss/token-dictionary": "0.30.2",
|
|
45
|
+
"@pandacss/types": "0.30.2"
|
|
46
46
|
},
|
|
47
47
|
"devDependencies": {
|
|
48
48
|
"@types/pluralize": "0.0.33"
|