@pandacss/generator 0.0.0-dev-20240205221215 → 0.0.0-dev-20240206121257

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 CHANGED
@@ -2288,8 +2288,11 @@ function generateVueJsxFactory(ctx) {
2288
2288
  const ${componentName} = defineComponent({
2289
2289
  name: \`${factoryName}.\${name}\`,
2290
2290
  inheritAttrs: false,
2291
- props: { as: { type: [String, Object], default: Dynamic.__base__ || Dynamic } },
2292
- setup(props, { slots, attrs }) {
2291
+ props: {
2292
+ modelValue: null,
2293
+ as: { type: [String, Object], default: Dynamic.__base__ || Dynamic }
2294
+ },
2295
+ setup(props, { slots, attrs, emit }) {
2293
2296
  const __cvaFn__ = composeCvaFn(Dynamic.__cva__, cvaFn)
2294
2297
  const __shouldForwardProps__ = composeShouldForwardProps(Dynamic, shouldForwardProp)
2295
2298
 
@@ -2315,17 +2318,48 @@ function generateVueJsxFactory(ctx) {
2315
2318
 
2316
2319
  const classes = configOrCva.__recipe__ ? recipeClass : cvaClass
2317
2320
 
2321
+ const vModelProps = computed(() => {
2322
+ const result = {};
2323
+
2324
+ if (
2325
+ props.as === 'input' &&
2326
+ (props.type === 'checkbox' || props.type === 'radio')
2327
+ ) {
2328
+ result.checked = props.modelValue;
2329
+ result.onChange = (event) => {
2330
+ const checked = !event.currentTarget.checked;
2331
+ emit('change', checked, event);
2332
+ emit('update:modelValue', checked, event);
2333
+ };
2334
+ } else if (
2335
+ props.as === 'input' ||
2336
+ props.as === 'textarea' ||
2337
+ props.as === 'select'
2338
+ ) {
2339
+ result.value = props.modelValue;
2340
+ result.onInput = (event) => {
2341
+ const value = event.currentTarget.value;
2342
+ emit('input', value, event);
2343
+ emit('update:modelValue', value, event);
2344
+ };
2345
+ }
2346
+
2347
+ return result;
2348
+ });
2349
+
2318
2350
  return () => {
2319
2351
  const [htmlProps, forwardedProps, _variantProps, _styleProps, elementProps] = splittedProps.value
2352
+
2320
2353
  return h(
2321
2354
  props.as,
2322
2355
  {
2323
2356
  ...forwardedProps,
2324
2357
  ...elementProps,
2325
2358
  ...normalizeHTMLProps(htmlProps),
2359
+ ...vModelProps.value,
2326
2360
  class: classes.value,
2327
2361
  },
2328
- slots.default && slots.default(),
2362
+ slots,
2329
2363
  )
2330
2364
  }
2331
2365
  },
@@ -2339,19 +2373,13 @@ function generateVueJsxFactory(ctx) {
2339
2373
  return ${componentName}
2340
2374
  }
2341
2375
 
2342
- function createJsxFactory() {
2343
- return new Proxy(styledFn, {
2344
- apply(_, __, args) {
2345
- return styledFn(...args)
2346
- },
2347
- get(_, el) {
2348
- return styledFn(el)
2349
- },
2350
- })
2351
- }
2376
+ 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
2377
 
2353
- export const ${factoryName} = /* @__PURE__ */ createJsxFactory()
2378
+ export const ${factoryName} = /* @__PURE__ */ styledFn.bind();
2354
2379
 
2380
+ tags.split(', ').forEach((tag) => {
2381
+ styled[tag] = styled(tag);
2382
+ });
2355
2383
  `
2356
2384
  };
2357
2385
  }
@@ -2375,11 +2403,43 @@ function generateVueJsxStringLiteralFactory(ctx) {
2375
2403
  const ${componentName} = defineComponent({
2376
2404
  name: \`${factoryName}.\${name}\`,
2377
2405
  inheritAttrs: false,
2378
- props: { as: { type: [String, Object], default: Dynamic } },
2379
- setup(props, { slots, attrs }) {
2406
+ props: {
2407
+ modelValue: null,
2408
+ as: { type: [String, Object], default: Dynamic }
2409
+ },
2410
+ setup(props, { slots, attrs, emit }) {
2380
2411
  const classes = computed(() => {
2381
2412
  return cx(css(Dynamic.__styles__, styles), elementProps.className)
2382
2413
  })
2414
+
2415
+ const vModelProps = computed(() => {
2416
+ const result = {};
2417
+
2418
+ if (
2419
+ props.as === 'input' &&
2420
+ (props.type === 'checkbox' || props.type === 'radio')
2421
+ ) {
2422
+ result.checked = props.modelValue;
2423
+ result.onChange = (event) => {
2424
+ const checked = !event.currentTarget.checked;
2425
+ emit('change', checked, event);
2426
+ emit('update:modelValue', checked, event);
2427
+ };
2428
+ } else if (
2429
+ props.as === 'input' ||
2430
+ props.as === 'textarea' ||
2431
+ props.as === 'select'
2432
+ ) {
2433
+ result.value = props.modelValue;
2434
+ result.onInput = (event) => {
2435
+ const value = event.currentTarget.value;
2436
+ emit('input', value, event);
2437
+ emit('update:modelValue', value, event);
2438
+ };
2439
+ }
2440
+
2441
+ return result;
2442
+ });
2383
2443
 
2384
2444
  return () => {
2385
2445
  return h(
@@ -2387,8 +2447,9 @@ function generateVueJsxStringLiteralFactory(ctx) {
2387
2447
  {
2388
2448
  class: classes.value,
2389
2449
  ...elementProps,
2450
+ ...vModelProps.value,
2390
2451
  },
2391
- slots.default && slots.default(),
2452
+ slots
2392
2453
  )
2393
2454
  }
2394
2455
  },
@@ -2401,23 +2462,13 @@ function generateVueJsxStringLiteralFactory(ctx) {
2401
2462
  }
2402
2463
  }
2403
2464
 
2404
- function createJsxFactory() {
2405
- const cache = new Map()
2465
+ 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
2466
 
2407
- return new Proxy(createStyled, {
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
- }
2467
+ export const ${factoryName} = /* @__PURE__ */ styledFn.bind();
2419
2468
 
2420
- export const ${factoryName} = /* @__PURE__ */ createJsxFactory()
2469
+ tags.split(', ').forEach((tag) => {
2470
+ styled[tag] = styled(tag);
2471
+ });
2421
2472
  `
2422
2473
  };
2423
2474
  }
package/dist/index.mjs CHANGED
@@ -2252,8 +2252,11 @@ function generateVueJsxFactory(ctx) {
2252
2252
  const ${componentName} = defineComponent({
2253
2253
  name: \`${factoryName}.\${name}\`,
2254
2254
  inheritAttrs: false,
2255
- props: { as: { type: [String, Object], default: Dynamic.__base__ || Dynamic } },
2256
- setup(props, { slots, attrs }) {
2255
+ props: {
2256
+ modelValue: null,
2257
+ as: { type: [String, Object], default: Dynamic.__base__ || Dynamic }
2258
+ },
2259
+ setup(props, { slots, attrs, emit }) {
2257
2260
  const __cvaFn__ = composeCvaFn(Dynamic.__cva__, cvaFn)
2258
2261
  const __shouldForwardProps__ = composeShouldForwardProps(Dynamic, shouldForwardProp)
2259
2262
 
@@ -2279,17 +2282,48 @@ function generateVueJsxFactory(ctx) {
2279
2282
 
2280
2283
  const classes = configOrCva.__recipe__ ? recipeClass : cvaClass
2281
2284
 
2285
+ const vModelProps = computed(() => {
2286
+ const result = {};
2287
+
2288
+ if (
2289
+ props.as === 'input' &&
2290
+ (props.type === 'checkbox' || props.type === 'radio')
2291
+ ) {
2292
+ result.checked = props.modelValue;
2293
+ result.onChange = (event) => {
2294
+ const checked = !event.currentTarget.checked;
2295
+ emit('change', checked, event);
2296
+ emit('update:modelValue', checked, event);
2297
+ };
2298
+ } else if (
2299
+ props.as === 'input' ||
2300
+ props.as === 'textarea' ||
2301
+ props.as === 'select'
2302
+ ) {
2303
+ result.value = props.modelValue;
2304
+ result.onInput = (event) => {
2305
+ const value = event.currentTarget.value;
2306
+ emit('input', value, event);
2307
+ emit('update:modelValue', value, event);
2308
+ };
2309
+ }
2310
+
2311
+ return result;
2312
+ });
2313
+
2282
2314
  return () => {
2283
2315
  const [htmlProps, forwardedProps, _variantProps, _styleProps, elementProps] = splittedProps.value
2316
+
2284
2317
  return h(
2285
2318
  props.as,
2286
2319
  {
2287
2320
  ...forwardedProps,
2288
2321
  ...elementProps,
2289
2322
  ...normalizeHTMLProps(htmlProps),
2323
+ ...vModelProps.value,
2290
2324
  class: classes.value,
2291
2325
  },
2292
- slots.default && slots.default(),
2326
+ slots,
2293
2327
  )
2294
2328
  }
2295
2329
  },
@@ -2303,19 +2337,13 @@ function generateVueJsxFactory(ctx) {
2303
2337
  return ${componentName}
2304
2338
  }
2305
2339
 
2306
- function createJsxFactory() {
2307
- return new Proxy(styledFn, {
2308
- apply(_, __, args) {
2309
- return styledFn(...args)
2310
- },
2311
- get(_, el) {
2312
- return styledFn(el)
2313
- },
2314
- })
2315
- }
2340
+ 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
2341
 
2317
- export const ${factoryName} = /* @__PURE__ */ createJsxFactory()
2342
+ export const ${factoryName} = /* @__PURE__ */ styledFn.bind();
2318
2343
 
2344
+ tags.split(', ').forEach((tag) => {
2345
+ styled[tag] = styled(tag);
2346
+ });
2319
2347
  `
2320
2348
  };
2321
2349
  }
@@ -2339,11 +2367,43 @@ function generateVueJsxStringLiteralFactory(ctx) {
2339
2367
  const ${componentName} = defineComponent({
2340
2368
  name: \`${factoryName}.\${name}\`,
2341
2369
  inheritAttrs: false,
2342
- props: { as: { type: [String, Object], default: Dynamic } },
2343
- setup(props, { slots, attrs }) {
2370
+ props: {
2371
+ modelValue: null,
2372
+ as: { type: [String, Object], default: Dynamic }
2373
+ },
2374
+ setup(props, { slots, attrs, emit }) {
2344
2375
  const classes = computed(() => {
2345
2376
  return cx(css(Dynamic.__styles__, styles), elementProps.className)
2346
2377
  })
2378
+
2379
+ const vModelProps = computed(() => {
2380
+ const result = {};
2381
+
2382
+ if (
2383
+ props.as === 'input' &&
2384
+ (props.type === 'checkbox' || props.type === 'radio')
2385
+ ) {
2386
+ result.checked = props.modelValue;
2387
+ result.onChange = (event) => {
2388
+ const checked = !event.currentTarget.checked;
2389
+ emit('change', checked, event);
2390
+ emit('update:modelValue', checked, event);
2391
+ };
2392
+ } else if (
2393
+ props.as === 'input' ||
2394
+ props.as === 'textarea' ||
2395
+ props.as === 'select'
2396
+ ) {
2397
+ result.value = props.modelValue;
2398
+ result.onInput = (event) => {
2399
+ const value = event.currentTarget.value;
2400
+ emit('input', value, event);
2401
+ emit('update:modelValue', value, event);
2402
+ };
2403
+ }
2404
+
2405
+ return result;
2406
+ });
2347
2407
 
2348
2408
  return () => {
2349
2409
  return h(
@@ -2351,8 +2411,9 @@ function generateVueJsxStringLiteralFactory(ctx) {
2351
2411
  {
2352
2412
  class: classes.value,
2353
2413
  ...elementProps,
2414
+ ...vModelProps.value,
2354
2415
  },
2355
- slots.default && slots.default(),
2416
+ slots
2356
2417
  )
2357
2418
  }
2358
2419
  },
@@ -2365,23 +2426,13 @@ function generateVueJsxStringLiteralFactory(ctx) {
2365
2426
  }
2366
2427
  }
2367
2428
 
2368
- function createJsxFactory() {
2369
- const cache = new Map()
2429
+ 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
2430
 
2371
- return new Proxy(createStyled, {
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
- }
2431
+ export const ${factoryName} = /* @__PURE__ */ styledFn.bind();
2383
2432
 
2384
- export const ${factoryName} = /* @__PURE__ */ createJsxFactory()
2433
+ tags.split(', ').forEach((tag) => {
2434
+ styled[tag] = styled(tag);
2435
+ });
2385
2436
  `
2386
2437
  };
2387
2438
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pandacss/generator",
3
- "version": "0.0.0-dev-20240205221215",
3
+ "version": "0.0.0-dev-20240206121257",
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.0.0-dev-20240205221215",
41
- "@pandacss/is-valid-prop": "^0.0.0-dev-20240205221215",
42
- "@pandacss/logger": "0.0.0-dev-20240205221215",
43
- "@pandacss/shared": "0.0.0-dev-20240205221215",
44
- "@pandacss/token-dictionary": "0.0.0-dev-20240205221215",
45
- "@pandacss/types": "0.0.0-dev-20240205221215"
40
+ "@pandacss/core": "0.0.0-dev-20240206121257",
41
+ "@pandacss/is-valid-prop": "^0.0.0-dev-20240206121257",
42
+ "@pandacss/logger": "0.0.0-dev-20240206121257",
43
+ "@pandacss/shared": "0.0.0-dev-20240206121257",
44
+ "@pandacss/token-dictionary": "0.0.0-dev-20240206121257",
45
+ "@pandacss/types": "0.0.0-dev-20240206121257"
46
46
  },
47
47
  "devDependencies": {
48
48
  "@types/pluralize": "0.0.33"