@pandacss/generator 0.0.0-dev-20230530140607 → 0.0.0-dev-20230530153916
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 +2 -2
- package/dist/index.js +222 -58
- package/dist/index.mjs +222 -58
- package/package.json +8 -8
package/dist/index.d.ts
CHANGED
|
@@ -40,7 +40,7 @@ declare const getEngine: (conf: LoadConfigResult) => {
|
|
|
40
40
|
upperName: string;
|
|
41
41
|
typeName: string;
|
|
42
42
|
componentName: string;
|
|
43
|
-
framework: "solid" | "react" | "preact" | "vue" | undefined;
|
|
43
|
+
framework: "solid" | "react" | "preact" | "vue" | "qwik" | undefined;
|
|
44
44
|
};
|
|
45
45
|
paths: {
|
|
46
46
|
get: (file?: string | undefined) => string[];
|
|
@@ -122,7 +122,7 @@ declare const createGenerator: (conf: LoadConfigResult) => {
|
|
|
122
122
|
upperName: string;
|
|
123
123
|
typeName: string;
|
|
124
124
|
componentName: string;
|
|
125
|
-
framework: "solid" | "react" | "preact" | "vue" | undefined;
|
|
125
|
+
framework: "solid" | "react" | "preact" | "vue" | "qwik" | undefined;
|
|
126
126
|
};
|
|
127
127
|
recipes: _pandacss_core.Recipes;
|
|
128
128
|
configDependencies: string[];
|
package/dist/index.js
CHANGED
|
@@ -128,7 +128,7 @@ var import_lil_fp3 = require("lil-fp");
|
|
|
128
128
|
|
|
129
129
|
// src/artifacts/index.ts
|
|
130
130
|
var import_shared4 = require("@pandacss/shared");
|
|
131
|
-
var
|
|
131
|
+
var import_outdent28 = __toESM(require("outdent"));
|
|
132
132
|
|
|
133
133
|
// src/artifacts/css/global-css.ts
|
|
134
134
|
var generateGlobalCss = (ctx) => {
|
|
@@ -1126,12 +1126,173 @@ export type ${typeName}<T extends ElementType> = JsxHTMLProps<ComponentProps<T>,
|
|
|
1126
1126
|
};
|
|
1127
1127
|
}
|
|
1128
1128
|
|
|
1129
|
-
// src/artifacts/
|
|
1129
|
+
// src/artifacts/qwik-jsx/jsx.ts
|
|
1130
1130
|
var import_outdent13 = require("outdent");
|
|
1131
|
-
function
|
|
1131
|
+
function generateQwikJsxFactory(ctx) {
|
|
1132
1132
|
const { factoryName, componentName } = ctx.jsx;
|
|
1133
1133
|
return {
|
|
1134
1134
|
js: import_outdent13.outdent`
|
|
1135
|
+
import { h } from '@builder.io/qwik'
|
|
1136
|
+
${ctx.file.import("css, cx, cva, assignCss", "../css/index")}
|
|
1137
|
+
${ctx.file.import("splitProps, normalizeHTMLProps", "../helpers")}
|
|
1138
|
+
${ctx.file.import("isCssProperty", "./is-valid-prop")}
|
|
1139
|
+
|
|
1140
|
+
function styledFn(Dynamic, configOrCva = {}) {
|
|
1141
|
+
const cvaFn = configOrCva.__cva__ ? configOrCva : cva(configOrCva)
|
|
1142
|
+
|
|
1143
|
+
const ${componentName} = function ${componentName}(props) {
|
|
1144
|
+
const { as: Element = Dynamic, ...restProps } = props
|
|
1145
|
+
|
|
1146
|
+
const [variantProps, styleProps, htmlProps, elementProps] =
|
|
1147
|
+
splitProps(restProps, cvaFn.variantKeys, isCssProperty, normalizeHTMLProps.keys)
|
|
1148
|
+
|
|
1149
|
+
|
|
1150
|
+
function classes() {
|
|
1151
|
+
const { css: cssStyles, ...propStyles } = styleProps
|
|
1152
|
+
const cvaStyles = cvaFn.resolve(variantProps)
|
|
1153
|
+
const styles = assignCss(cvaStyles, propStyles, cssStyles)
|
|
1154
|
+
return cx(css(styles), elementProps.className)
|
|
1155
|
+
}
|
|
1156
|
+
|
|
1157
|
+
return h(Element, {
|
|
1158
|
+
...elementProps,
|
|
1159
|
+
...normalizeHTMLProps(htmlProps),
|
|
1160
|
+
className: classes(),
|
|
1161
|
+
})
|
|
1162
|
+
}
|
|
1163
|
+
|
|
1164
|
+
${componentName}.displayName = \`${factoryName}.\${Dynamic}\`
|
|
1165
|
+
return ${componentName}
|
|
1166
|
+
}
|
|
1167
|
+
|
|
1168
|
+
function createJsxFactory() {
|
|
1169
|
+
const cache = new Map()
|
|
1170
|
+
|
|
1171
|
+
return new Proxy(styledFn, {
|
|
1172
|
+
apply(_, __, args) {
|
|
1173
|
+
return styledFn(...args)
|
|
1174
|
+
},
|
|
1175
|
+
get(_, el) {
|
|
1176
|
+
if (!cache.has(el)) {
|
|
1177
|
+
cache.set(el, styledFn(el))
|
|
1178
|
+
}
|
|
1179
|
+
return cache.get(el)
|
|
1180
|
+
},
|
|
1181
|
+
})
|
|
1182
|
+
}
|
|
1183
|
+
|
|
1184
|
+
export const ${factoryName} = createJsxFactory()
|
|
1185
|
+
|
|
1186
|
+
`
|
|
1187
|
+
};
|
|
1188
|
+
}
|
|
1189
|
+
|
|
1190
|
+
// src/artifacts/qwik-jsx/pattern.ts
|
|
1191
|
+
var import_outdent14 = require("outdent");
|
|
1192
|
+
var import_ts_pattern3 = require("ts-pattern");
|
|
1193
|
+
function generateQwikJsxPattern(ctx) {
|
|
1194
|
+
const { typeName, factoryName } = ctx.jsx;
|
|
1195
|
+
return ctx.patterns.details.map((pattern) => {
|
|
1196
|
+
const { upperName, styleFnName, dashName, jsxName, props, blocklistType } = pattern;
|
|
1197
|
+
const { description, jsxElement = "div" } = pattern.config;
|
|
1198
|
+
return {
|
|
1199
|
+
name: dashName,
|
|
1200
|
+
js: import_outdent14.outdent`
|
|
1201
|
+
import { h } from '@builder.io/qwik'
|
|
1202
|
+
${ctx.file.import(factoryName, "./factory")}
|
|
1203
|
+
${ctx.file.import(styleFnName, `../patterns/${dashName}`)}
|
|
1204
|
+
|
|
1205
|
+
export const ${jsxName} = function ${jsxName}(props) {
|
|
1206
|
+
${(0, import_ts_pattern3.match)(props.length).with(
|
|
1207
|
+
0,
|
|
1208
|
+
() => import_outdent14.outdent`
|
|
1209
|
+
const styleProps = ${styleFnName}()
|
|
1210
|
+
return h(${factoryName}.${jsxElement}, { ...styleProps, ...props })
|
|
1211
|
+
`
|
|
1212
|
+
).otherwise(
|
|
1213
|
+
() => import_outdent14.outdent`
|
|
1214
|
+
const { ${props.join(", ")}, ...restProps } = props
|
|
1215
|
+
const styleProps = ${styleFnName}({${props.join(", ")}})
|
|
1216
|
+
return h(${factoryName}.${jsxElement}, { ...styleProps, ...restProps })
|
|
1217
|
+
`
|
|
1218
|
+
)}
|
|
1219
|
+
}
|
|
1220
|
+
`,
|
|
1221
|
+
dts: import_outdent14.outdent`
|
|
1222
|
+
import type { FunctionComponent } from '@builder.io/qwik'
|
|
1223
|
+
import type { ${upperName}Properties } from '../patterns/${dashName}'
|
|
1224
|
+
import type { ${typeName} } from '../types/jsx'
|
|
1225
|
+
|
|
1226
|
+
type Assign<T, U> = {
|
|
1227
|
+
[K in keyof T]?: K extends keyof T ? (K extends keyof U ? T[K] & U[K] : T[K]) : never
|
|
1228
|
+
} & U
|
|
1229
|
+
|
|
1230
|
+
export type ${upperName}Props = Assign<${typeName}<'${jsxElement}'>, Omit<${upperName}Properties, ${blocklistType || '""'}>>
|
|
1231
|
+
|
|
1232
|
+
${description ? `/** ${description} */` : ""}
|
|
1233
|
+
export declare const ${jsxName}: FunctionComponent<${upperName}Props>
|
|
1234
|
+
`
|
|
1235
|
+
};
|
|
1236
|
+
});
|
|
1237
|
+
}
|
|
1238
|
+
|
|
1239
|
+
// src/artifacts/qwik-jsx/types.ts
|
|
1240
|
+
var import_outdent15 = require("outdent");
|
|
1241
|
+
function generateQwikJsxTypes(ctx) {
|
|
1242
|
+
const { factoryName, componentName, upperName, typeName } = ctx.jsx;
|
|
1243
|
+
return {
|
|
1244
|
+
jsxFactory: import_outdent15.outdent`
|
|
1245
|
+
import { ${upperName} } from '../types/jsx'
|
|
1246
|
+
export declare const ${factoryName}: ${upperName}
|
|
1247
|
+
`,
|
|
1248
|
+
jsxType: import_outdent15.outdent`
|
|
1249
|
+
import type { FunctionComponent, QwikIntrinsicElements } from '@builder.io/qwik'
|
|
1250
|
+
import type { JsxStyleProps, Assign as _Assign, PatchedHTMLProps } from './system-types'
|
|
1251
|
+
import type { RecipeDefinition, RecipeRuntimeFn, RecipeSelection, RecipeVariantRecord } from './recipe'
|
|
1252
|
+
|
|
1253
|
+
type ElementType = keyof QwikIntrinsicElements | FunctionComponent<any>
|
|
1254
|
+
|
|
1255
|
+
type ComponentProps<T extends ElementType> = T extends keyof QwikIntrinsicElements
|
|
1256
|
+
? QwikIntrinsicElements[T]
|
|
1257
|
+
: T extends FunctionComponent<infer P>
|
|
1258
|
+
? P
|
|
1259
|
+
: never
|
|
1260
|
+
|
|
1261
|
+
type Dict = Record<string, unknown>
|
|
1262
|
+
|
|
1263
|
+
type Omitted = 'color' | 'translate' | 'transition' | 'width' | 'height' | 'size' | 'content'
|
|
1264
|
+
|
|
1265
|
+
// Patch due to Omit<T, K> not working with Qwik JSX Types
|
|
1266
|
+
|
|
1267
|
+
type Assign<T, U> = {
|
|
1268
|
+
[K in keyof T]?: K extends Omitted
|
|
1269
|
+
? K extends keyof U
|
|
1270
|
+
? U[K]
|
|
1271
|
+
: never
|
|
1272
|
+
: K extends keyof T
|
|
1273
|
+
? K extends keyof U
|
|
1274
|
+
? T[K] & U[K]
|
|
1275
|
+
: T[K]
|
|
1276
|
+
: never
|
|
1277
|
+
} & U & PatchedHTMLProps
|
|
1278
|
+
|
|
1279
|
+
export type ${componentName}<T extends ElementType, P extends Dict = {}> = FunctionComponent<Assign<ComponentProps<T>, _Assign<JsxStyleProps, P>>>
|
|
1280
|
+
|
|
1281
|
+
export type ${upperName} = {
|
|
1282
|
+
<T extends ElementType, P extends RecipeVariantRecord = {}>(component: T, recipe?: RecipeDefinition<P> | RecipeRuntimeFn<P>): ${componentName}<T, RecipeSelection<P>>
|
|
1283
|
+
} & { [K in keyof QwikIntrinsicElements]: ${componentName}<K, {}> }
|
|
1284
|
+
|
|
1285
|
+
export type ${typeName}<T extends ElementType> = Assign<ComponentProps<T>, JsxStyleProps>
|
|
1286
|
+
`
|
|
1287
|
+
};
|
|
1288
|
+
}
|
|
1289
|
+
|
|
1290
|
+
// src/artifacts/react-jsx/jsx.ts
|
|
1291
|
+
var import_outdent16 = require("outdent");
|
|
1292
|
+
function generateReactJsxFactory(ctx) {
|
|
1293
|
+
const { factoryName, componentName } = ctx.jsx;
|
|
1294
|
+
return {
|
|
1295
|
+
js: import_outdent16.outdent`
|
|
1135
1296
|
import { createElement, forwardRef, useMemo } from 'react'
|
|
1136
1297
|
${ctx.file.import("css, cx, cva, assignCss", "../css/index")}
|
|
1137
1298
|
${ctx.file.import("splitProps, normalizeHTMLProps", "../helpers")}
|
|
@@ -1189,8 +1350,8 @@ function generateReactJsxFactory(ctx) {
|
|
|
1189
1350
|
}
|
|
1190
1351
|
|
|
1191
1352
|
// src/artifacts/react-jsx/pattern.ts
|
|
1192
|
-
var
|
|
1193
|
-
var
|
|
1353
|
+
var import_outdent17 = require("outdent");
|
|
1354
|
+
var import_ts_pattern4 = require("ts-pattern");
|
|
1194
1355
|
function generateReactJsxPattern(ctx) {
|
|
1195
1356
|
const { typeName, factoryName } = ctx.jsx;
|
|
1196
1357
|
return ctx.patterns.details.map((pattern) => {
|
|
@@ -1198,20 +1359,20 @@ function generateReactJsxPattern(ctx) {
|
|
|
1198
1359
|
const { description, jsxElement = "div" } = pattern.config;
|
|
1199
1360
|
return {
|
|
1200
1361
|
name: dashName,
|
|
1201
|
-
js:
|
|
1362
|
+
js: import_outdent17.outdent`
|
|
1202
1363
|
import { createElement, forwardRef } from 'react'
|
|
1203
1364
|
${ctx.file.import(factoryName, "./factory")}
|
|
1204
1365
|
${ctx.file.import(styleFnName, `../patterns/${dashName}`)}
|
|
1205
1366
|
|
|
1206
1367
|
export const ${jsxName} = forwardRef(function ${jsxName}(props, ref) {
|
|
1207
|
-
${(0,
|
|
1368
|
+
${(0, import_ts_pattern4.match)(props.length).with(
|
|
1208
1369
|
0,
|
|
1209
|
-
() =>
|
|
1370
|
+
() => import_outdent17.outdent`
|
|
1210
1371
|
const styleProps = ${styleFnName}()
|
|
1211
1372
|
return createElement(${factoryName}.${jsxElement}, { ref, ...styleProps, ...props })
|
|
1212
1373
|
`
|
|
1213
1374
|
).otherwise(
|
|
1214
|
-
() =>
|
|
1375
|
+
() => import_outdent17.outdent`
|
|
1215
1376
|
const { ${props.join(", ")}, ...restProps } = props
|
|
1216
1377
|
const styleProps = ${styleFnName}({${props.join(", ")}})
|
|
1217
1378
|
return createElement(${factoryName}.${jsxElement}, { ref, ...styleProps, ...restProps })
|
|
@@ -1219,7 +1380,7 @@ function generateReactJsxPattern(ctx) {
|
|
|
1219
1380
|
)}
|
|
1220
1381
|
})
|
|
1221
1382
|
`,
|
|
1222
|
-
dts:
|
|
1383
|
+
dts: import_outdent17.outdent`
|
|
1223
1384
|
import type { FunctionComponent } from 'react'
|
|
1224
1385
|
import type { ${upperName}Properties } from '../patterns/${dashName}'
|
|
1225
1386
|
import type { ${typeName} } from '../types/jsx'
|
|
@@ -1234,15 +1395,15 @@ function generateReactJsxPattern(ctx) {
|
|
|
1234
1395
|
}
|
|
1235
1396
|
|
|
1236
1397
|
// src/artifacts/react-jsx/types.ts
|
|
1237
|
-
var
|
|
1398
|
+
var import_outdent18 = require("outdent");
|
|
1238
1399
|
function generateReactJsxTypes(ctx) {
|
|
1239
1400
|
const { factoryName, componentName, upperName, typeName } = ctx.jsx;
|
|
1240
1401
|
return {
|
|
1241
|
-
jsxFactory:
|
|
1402
|
+
jsxFactory: import_outdent18.outdent`
|
|
1242
1403
|
import { ${upperName} } from '../types/jsx'
|
|
1243
1404
|
export declare const ${factoryName}: ${upperName}
|
|
1244
1405
|
`,
|
|
1245
|
-
jsxType:
|
|
1406
|
+
jsxType: import_outdent18.outdent`
|
|
1246
1407
|
import type { ElementType, ComponentProps } from 'react'
|
|
1247
1408
|
import type { JsxStyleProps, JsxHTMLProps, Assign } from './system-types'
|
|
1248
1409
|
import type { RecipeDefinition, RecipeRuntimeFn, RecipeSelection, RecipeVariantRecord } from './recipe'
|
|
@@ -1264,11 +1425,11 @@ export type ${typeName}<T extends ElementType> = JsxHTMLProps<ComponentProps<T>,
|
|
|
1264
1425
|
}
|
|
1265
1426
|
|
|
1266
1427
|
// src/artifacts/solid-jsx/jsx.ts
|
|
1267
|
-
var
|
|
1428
|
+
var import_outdent19 = require("outdent");
|
|
1268
1429
|
function generateSolidJsxFactory(ctx) {
|
|
1269
1430
|
const { componentName, factoryName } = ctx.jsx;
|
|
1270
1431
|
return {
|
|
1271
|
-
js:
|
|
1432
|
+
js: import_outdent19.outdent`
|
|
1272
1433
|
import { Dynamic } from 'solid-js/web'
|
|
1273
1434
|
import { mergeProps, splitProps } from 'solid-js'
|
|
1274
1435
|
import { createComponent } from 'solid-js/web'
|
|
@@ -1337,8 +1498,8 @@ function generateSolidJsxFactory(ctx) {
|
|
|
1337
1498
|
}
|
|
1338
1499
|
|
|
1339
1500
|
// src/artifacts/solid-jsx/pattern.ts
|
|
1340
|
-
var
|
|
1341
|
-
var
|
|
1501
|
+
var import_outdent20 = require("outdent");
|
|
1502
|
+
var import_ts_pattern5 = require("ts-pattern");
|
|
1342
1503
|
function generateSolidJsxPattern(ctx) {
|
|
1343
1504
|
const { typeName, factoryName } = ctx.jsx;
|
|
1344
1505
|
return ctx.patterns.details.map((pattern) => {
|
|
@@ -1346,21 +1507,21 @@ function generateSolidJsxPattern(ctx) {
|
|
|
1346
1507
|
const { description, jsxElement = "div" } = pattern.config;
|
|
1347
1508
|
return {
|
|
1348
1509
|
name: dashName,
|
|
1349
|
-
js:
|
|
1510
|
+
js: import_outdent20.outdent`
|
|
1350
1511
|
import { splitProps, mergeProps } from 'solid-js'
|
|
1351
1512
|
import { createComponent } from 'solid-js/web'
|
|
1352
1513
|
${ctx.file.import(factoryName, "./factory")}
|
|
1353
1514
|
${ctx.file.import(styleFnName, `../patterns/${dashName}`)}
|
|
1354
1515
|
|
|
1355
1516
|
export function ${jsxName}(props) {
|
|
1356
|
-
${(0,
|
|
1517
|
+
${(0, import_ts_pattern5.match)(props.length).with(
|
|
1357
1518
|
0,
|
|
1358
|
-
() =>
|
|
1519
|
+
() => import_outdent20.outdent`
|
|
1359
1520
|
const styleProps = ${styleFnName}()
|
|
1360
1521
|
return createComponent(${factoryName}.${jsxElement}, mergeProps(styleProps, props))
|
|
1361
1522
|
`
|
|
1362
1523
|
).otherwise(
|
|
1363
|
-
() =>
|
|
1524
|
+
() => import_outdent20.outdent`
|
|
1364
1525
|
const [patternProps, restProps] = splitProps(props, [${props.map((v) => JSON.stringify(v)).join(", ")}]);
|
|
1365
1526
|
const styleProps = ${styleFnName}(patternProps)
|
|
1366
1527
|
return createComponent(${factoryName}.${jsxElement}, mergeProps(styleProps, restProps))
|
|
@@ -1368,7 +1529,7 @@ function generateSolidJsxPattern(ctx) {
|
|
|
1368
1529
|
)}
|
|
1369
1530
|
}
|
|
1370
1531
|
`,
|
|
1371
|
-
dts:
|
|
1532
|
+
dts: import_outdent20.outdent`
|
|
1372
1533
|
import { Component } from 'solid-js'
|
|
1373
1534
|
import { ${upperName}Properties } from '../patterns/${dashName}'
|
|
1374
1535
|
import { ${typeName} } from '../types/jsx'
|
|
@@ -1383,15 +1544,15 @@ function generateSolidJsxPattern(ctx) {
|
|
|
1383
1544
|
}
|
|
1384
1545
|
|
|
1385
1546
|
// src/artifacts/solid-jsx/types.ts
|
|
1386
|
-
var
|
|
1547
|
+
var import_outdent21 = require("outdent");
|
|
1387
1548
|
function generateSolidJsxTypes(ctx) {
|
|
1388
1549
|
const { factoryName, componentName, upperName, typeName } = ctx.jsx;
|
|
1389
1550
|
return {
|
|
1390
|
-
jsxFactory:
|
|
1551
|
+
jsxFactory: import_outdent21.outdent`
|
|
1391
1552
|
import type { ${upperName} } from '../types/jsx'
|
|
1392
1553
|
export declare const ${factoryName}: ${upperName}
|
|
1393
1554
|
`,
|
|
1394
|
-
jsxType:
|
|
1555
|
+
jsxType: import_outdent21.outdent`
|
|
1395
1556
|
import type { JSX, ComponentProps, Component } from 'solid-js'
|
|
1396
1557
|
import type { JsxStyleProps, JsxHTMLProps } from './system-types'
|
|
1397
1558
|
import type { RecipeDefinition, RecipeRuntimeFn, RecipeSelection, RecipeVariantRecord } from './recipe'
|
|
@@ -1415,11 +1576,11 @@ export type ${typeName}<T extends ElementType> = JsxHTMLProps<ComponentProps<T>,
|
|
|
1415
1576
|
}
|
|
1416
1577
|
|
|
1417
1578
|
// src/artifacts/vue-jsx/jsx.ts
|
|
1418
|
-
var
|
|
1579
|
+
var import_outdent22 = require("outdent");
|
|
1419
1580
|
function generateVueJsxFactory(ctx) {
|
|
1420
1581
|
const { factoryName } = ctx.jsx;
|
|
1421
1582
|
return {
|
|
1422
|
-
js:
|
|
1583
|
+
js: import_outdent22.outdent`
|
|
1423
1584
|
import { defineComponent, h, computed } from 'vue'
|
|
1424
1585
|
${ctx.file.import("css, cx, cva, assignCss", "../css/index")}
|
|
1425
1586
|
${ctx.file.import("splitProps, normalizeHTMLProps", "../helpers")}
|
|
@@ -1484,15 +1645,15 @@ function generateVueJsxFactory(ctx) {
|
|
|
1484
1645
|
}
|
|
1485
1646
|
|
|
1486
1647
|
// src/artifacts/vue-jsx/types.ts
|
|
1487
|
-
var
|
|
1648
|
+
var import_outdent23 = require("outdent");
|
|
1488
1649
|
function generateVueJsxTypes(ctx) {
|
|
1489
1650
|
const { factoryName, componentName, upperName, typeName } = ctx.jsx;
|
|
1490
1651
|
return {
|
|
1491
|
-
jsxFactory:
|
|
1652
|
+
jsxFactory: import_outdent23.outdent`
|
|
1492
1653
|
import { ${upperName} } from '../types/jsx'
|
|
1493
1654
|
export declare const ${factoryName}: ${upperName}
|
|
1494
1655
|
`,
|
|
1495
|
-
jsxType:
|
|
1656
|
+
jsxType: import_outdent23.outdent`
|
|
1496
1657
|
import type { Component, FunctionalComponent } from 'vue'
|
|
1497
1658
|
import type { JsxStyleProps, JsxHTMLProps } from './system-types'
|
|
1498
1659
|
import type { RecipeDefinition, RecipeRuntimeFn, RecipeSelection, RecipeVariantRecord } from './recipe'
|
|
@@ -1642,7 +1803,8 @@ var typesMap = {
|
|
|
1642
1803
|
react: generateReactJsxTypes,
|
|
1643
1804
|
preact: generatePreactJsxTypes,
|
|
1644
1805
|
solid: generateSolidJsxTypes,
|
|
1645
|
-
vue: generateVueJsxTypes
|
|
1806
|
+
vue: generateVueJsxTypes,
|
|
1807
|
+
qwik: generateQwikJsxTypes
|
|
1646
1808
|
};
|
|
1647
1809
|
function generateJsxTypes(ctx) {
|
|
1648
1810
|
if (!ctx.jsx.framework)
|
|
@@ -1653,7 +1815,8 @@ var factoryMap = {
|
|
|
1653
1815
|
react: generateReactJsxFactory,
|
|
1654
1816
|
solid: generateSolidJsxFactory,
|
|
1655
1817
|
preact: generatePreactJsxFactory,
|
|
1656
|
-
vue: generateVueJsxFactory
|
|
1818
|
+
vue: generateVueJsxFactory,
|
|
1819
|
+
qwik: generateQwikJsxFactory
|
|
1657
1820
|
};
|
|
1658
1821
|
function generateJsxFactory(ctx) {
|
|
1659
1822
|
if (!ctx.jsx.framework)
|
|
@@ -1664,7 +1827,8 @@ var patternMap = {
|
|
|
1664
1827
|
react: generateReactJsxPattern,
|
|
1665
1828
|
solid: generateSolidJsxPattern,
|
|
1666
1829
|
preact: generatePreactJsxPattern,
|
|
1667
|
-
vue: () => []
|
|
1830
|
+
vue: () => [],
|
|
1831
|
+
qwik: generateQwikJsxPattern
|
|
1668
1832
|
};
|
|
1669
1833
|
function generateJsxPatterns(ctx) {
|
|
1670
1834
|
if (ctx.patterns.isEmpty() && !ctx.jsx.framework)
|
|
@@ -1719,7 +1883,7 @@ var csstype_d_ts_default = {
|
|
|
1719
1883
|
|
|
1720
1884
|
// src/artifacts/generated/system-types.d.ts.json
|
|
1721
1885
|
var system_types_d_ts_default = {
|
|
1722
|
-
content: "import type { ConditionalValue, Conditions, Nested } from './conditions'\nimport type { PropertiesFallback } from './csstype'\nimport type { SystemProperties, CssVarProperties } from './style-props'\n\ntype String = string & {}\ntype Number = number & {}\n\n/* -----------------------------------------------------------------------------\n * Native css properties\n * -----------------------------------------------------------------------------*/\n\nexport type CssProperty = keyof PropertiesFallback\n\nexport type CssProperties = PropertiesFallback<String | Number> & CssVarProperties\n\nexport type CssKeyframes = {\n [name: string]: {\n [time: string]: CssProperties\n }\n}\n\n/* -----------------------------------------------------------------------------\n * Conditional css properties\n * -----------------------------------------------------------------------------*/\n\ntype MinimalNested<P> = {\n [K in keyof Conditions]?: Nested<P>\n}\n\ntype GenericProperties = {\n [key: string]: ConditionalValue<String | Number | boolean>\n}\n\n/* -----------------------------------------------------------------------------\n * Native css props\n * -----------------------------------------------------------------------------*/\n\nexport type NestedCssProperties = Nested<CssProperties>\n\nexport type SystemStyleObject = Nested<SystemProperties & CssVarProperties>\n\nexport type GlobalStyleObject = {\n [selector: string]: SystemStyleObject\n}\n\nexport type CompositionStyleObject<Property extends string> = Nested<{\n [K in Property]?: K extends keyof SystemStyleObject ? SystemStyleObject[K] : unknown\n}>\n\n/* -----------------------------------------------------------------------------\n * Jsx style props\n * -----------------------------------------------------------------------------*/\n\nexport type JsxStyleProps = SystemProperties &\n MinimalNested<SystemStyleObject> & {\n css?: SystemStyleObject\n }\n\ntype Assign<T, U> = Omit<T, keyof U> & U\n\
|
|
1886
|
+
content: "import type { ConditionalValue, Conditions, Nested } from './conditions'\nimport type { PropertiesFallback } from './csstype'\nimport type { SystemProperties, CssVarProperties } from './style-props'\n\ntype String = string & {}\ntype Number = number & {}\n\n/* -----------------------------------------------------------------------------\n * Native css properties\n * -----------------------------------------------------------------------------*/\n\nexport type CssProperty = keyof PropertiesFallback\n\nexport type CssProperties = PropertiesFallback<String | Number> & CssVarProperties\n\nexport type CssKeyframes = {\n [name: string]: {\n [time: string]: CssProperties\n }\n}\n\n/* -----------------------------------------------------------------------------\n * Conditional css properties\n * -----------------------------------------------------------------------------*/\n\ntype MinimalNested<P> = {\n [K in keyof Conditions]?: Nested<P>\n}\n\ntype GenericProperties = {\n [key: string]: ConditionalValue<String | Number | boolean>\n}\n\n/* -----------------------------------------------------------------------------\n * Native css props\n * -----------------------------------------------------------------------------*/\n\nexport type NestedCssProperties = Nested<CssProperties>\n\nexport type SystemStyleObject = Nested<SystemProperties & CssVarProperties>\n\nexport type GlobalStyleObject = {\n [selector: string]: SystemStyleObject\n}\n\nexport type CompositionStyleObject<Property extends string> = Nested<{\n [K in Property]?: K extends keyof SystemStyleObject ? SystemStyleObject[K] : unknown\n}>\n\n/* -----------------------------------------------------------------------------\n * Jsx style props\n * -----------------------------------------------------------------------------*/\n\nexport type JsxStyleProps = SystemProperties &\n MinimalNested<SystemStyleObject> & {\n css?: SystemStyleObject\n }\n\ntype Assign<T, U> = Omit<T, keyof U> & U\n\nexport type PatchedHTMLProps = {\n htmlSize?: string | number\n htmlWidth?: string | number\n htmlHeight?: string | number\n htmlTranslate?: 'yes' | 'no' | undefined\n htmlContent?: string\n}\n\nexport type OmittedHTMLProps = 'color' | 'translate' | 'transition' | 'width' | 'height' | 'size' | 'content'\n\ntype WithHTMLProps<T> = Omit<T, OmittedHTMLProps> & PatchedHTMLProps\n\nexport type JsxHTMLProps<T extends Record<string, any>, P extends Record<string, any> = {}> = Assign<\n WithHTMLProps<T>,\n P\n>\n"
|
|
1723
1887
|
};
|
|
1724
1888
|
|
|
1725
1889
|
// src/artifacts/generated/composition.d.ts.json
|
|
@@ -1761,9 +1925,9 @@ function getGeneratedTypes() {
|
|
|
1761
1925
|
}
|
|
1762
1926
|
|
|
1763
1927
|
// src/artifacts/types/main.ts
|
|
1764
|
-
var
|
|
1928
|
+
var import_outdent24 = require("outdent");
|
|
1765
1929
|
var generateTypesEntry = () => ({
|
|
1766
|
-
global:
|
|
1930
|
+
global: import_outdent24.outdent`
|
|
1767
1931
|
import { AnyRecipeConfig, RecipeVariantRecord, RecipeConfig } from './recipe'
|
|
1768
1932
|
import { Parts } from './parts'
|
|
1769
1933
|
import { AnyPatternConfig, PatternConfig } from './pattern'
|
|
@@ -1780,19 +1944,19 @@ var generateTypesEntry = () => ({
|
|
|
1780
1944
|
export function defineParts<T extends Parts>(parts: T): (config: Partial<Record<keyof T, SystemStyleObject>>) => Partial<Record<keyof T, SystemStyleObject>>;
|
|
1781
1945
|
}
|
|
1782
1946
|
`,
|
|
1783
|
-
index:
|
|
1947
|
+
index: import_outdent24.outdent`
|
|
1784
1948
|
import './global'
|
|
1785
1949
|
export { ConditionalValue } from './conditions'
|
|
1786
1950
|
export { GlobalStyleObject, JsxStyleProps, SystemStyleObject } from './system-types'
|
|
1787
1951
|
|
|
1788
1952
|
`,
|
|
1789
|
-
helpers:
|
|
1953
|
+
helpers: import_outdent24.outdent`
|
|
1790
1954
|
export type Pretty<T> = T extends infer U ? { [K in keyof U]: U[K] } : never
|
|
1791
1955
|
`
|
|
1792
1956
|
});
|
|
1793
1957
|
|
|
1794
1958
|
// src/artifacts/types/prop-types.ts
|
|
1795
|
-
var
|
|
1959
|
+
var import_outdent25 = require("outdent");
|
|
1796
1960
|
function generatePropTypes(ctx) {
|
|
1797
1961
|
const {
|
|
1798
1962
|
config: { strictTokens },
|
|
@@ -1800,7 +1964,7 @@ function generatePropTypes(ctx) {
|
|
|
1800
1964
|
} = ctx;
|
|
1801
1965
|
const strictText = `${strictTokens ? "" : " | CssValue<T>"}`;
|
|
1802
1966
|
const result = [
|
|
1803
|
-
|
|
1967
|
+
import_outdent25.outdent`
|
|
1804
1968
|
import type { ConditionalValue } from './conditions';
|
|
1805
1969
|
import type { CssProperties } from './system-types'
|
|
1806
1970
|
import type { Tokens } from '../tokens'
|
|
@@ -1823,7 +1987,7 @@ function generatePropTypes(ctx) {
|
|
|
1823
1987
|
result.push(` ${key}: Shorthand<${JSON.stringify(value)}>;`);
|
|
1824
1988
|
});
|
|
1825
1989
|
result.push("}");
|
|
1826
|
-
return
|
|
1990
|
+
return import_outdent25.outdent`
|
|
1827
1991
|
${result.join("\n")}
|
|
1828
1992
|
|
|
1829
1993
|
export type PropertyValue<T extends string> = T extends keyof PropertyTypes
|
|
@@ -1836,10 +2000,10 @@ function generatePropTypes(ctx) {
|
|
|
1836
2000
|
|
|
1837
2001
|
// src/artifacts/types/style-props.ts
|
|
1838
2002
|
var import_is_valid_prop = require("@pandacss/is-valid-prop");
|
|
1839
|
-
var
|
|
2003
|
+
var import_outdent26 = __toESM(require("outdent"));
|
|
1840
2004
|
function generateStyleProps(ctx) {
|
|
1841
2005
|
const props = new Set(import_is_valid_prop.allCssProperties.concat(ctx.utility.keys()));
|
|
1842
|
-
return
|
|
2006
|
+
return import_outdent26.default`
|
|
1843
2007
|
import { ConditionalValue } from './conditions'
|
|
1844
2008
|
import { PropertyValue } from './prop-type'
|
|
1845
2009
|
import { Token } from '../tokens'
|
|
@@ -1856,7 +2020,7 @@ function generateStyleProps(ctx) {
|
|
|
1856
2020
|
|
|
1857
2021
|
// src/artifacts/types/token-types.ts
|
|
1858
2022
|
var import_shared3 = require("@pandacss/shared");
|
|
1859
|
-
var
|
|
2023
|
+
var import_outdent27 = require("outdent");
|
|
1860
2024
|
var import_pluralize = __toESM(require("pluralize"));
|
|
1861
2025
|
var categories = [
|
|
1862
2026
|
"zIndex",
|
|
@@ -1898,7 +2062,7 @@ function generateTokenTypes(ctx) {
|
|
|
1898
2062
|
result.add("} & { [token: string]: never }");
|
|
1899
2063
|
set.add(Array.from(result).join("\n"));
|
|
1900
2064
|
set.add(`export type TokenCategory = ${(0, import_shared3.unionType)(categories)}`);
|
|
1901
|
-
return
|
|
2065
|
+
return import_outdent27.outdent.string(Array.from(set).join("\n\n"));
|
|
1902
2066
|
}
|
|
1903
2067
|
|
|
1904
2068
|
// src/artifacts/index.ts
|
|
@@ -1993,8 +2157,8 @@ function setupRecipes(ctx) {
|
|
|
1993
2157
|
return;
|
|
1994
2158
|
const indexFiles = files.filter((file) => !file.name.includes("create-recipe"));
|
|
1995
2159
|
const index = {
|
|
1996
|
-
js:
|
|
1997
|
-
dts:
|
|
2160
|
+
js: import_outdent28.default.string(indexFiles.map((file) => ctx.file.export(`./${file.name}`)).join("\n")),
|
|
2161
|
+
dts: import_outdent28.default.string(indexFiles.map((file) => `export * from './${file.name}'`).join("\n"))
|
|
1998
2162
|
};
|
|
1999
2163
|
return {
|
|
2000
2164
|
dir: ctx.paths.recipe,
|
|
@@ -2011,8 +2175,8 @@ function setupPatterns(ctx) {
|
|
|
2011
2175
|
if (!files)
|
|
2012
2176
|
return;
|
|
2013
2177
|
const index = {
|
|
2014
|
-
js:
|
|
2015
|
-
dts:
|
|
2178
|
+
js: import_outdent28.default.string(files.map((file) => ctx.file.export(`./${file.name}`)).join("\n")),
|
|
2179
|
+
dts: import_outdent28.default.string(files.map((file) => `export * from './${file.name}'`).join("\n"))
|
|
2016
2180
|
};
|
|
2017
2181
|
return {
|
|
2018
2182
|
dir: ctx.paths.pattern,
|
|
@@ -2032,13 +2196,13 @@ function setupJsx(ctx) {
|
|
|
2032
2196
|
const factory = generateJsxFactory(ctx);
|
|
2033
2197
|
const patterns = generateJsxPatterns(ctx);
|
|
2034
2198
|
const index = {
|
|
2035
|
-
js:
|
|
2199
|
+
js: import_outdent28.default`
|
|
2036
2200
|
${ctx.file.export("./factory")}
|
|
2037
|
-
${
|
|
2201
|
+
${import_outdent28.default.string(patterns.map((file) => ctx.file.export(`./${file.name}`)).join("\n"))}
|
|
2038
2202
|
`,
|
|
2039
|
-
dts:
|
|
2203
|
+
dts: import_outdent28.default`
|
|
2040
2204
|
export * from './factory'
|
|
2041
|
-
${
|
|
2205
|
+
${import_outdent28.default.string(patterns.map((file) => `export * from './${file.name}'`).join("\n"))}
|
|
2042
2206
|
export type { ${ctx.jsx.typeName} } from '../types/jsx'
|
|
2043
2207
|
`
|
|
2044
2208
|
};
|
|
@@ -2057,12 +2221,12 @@ function setupJsx(ctx) {
|
|
|
2057
2221
|
}
|
|
2058
2222
|
function setupCssIndex(ctx) {
|
|
2059
2223
|
const index = {
|
|
2060
|
-
js:
|
|
2224
|
+
js: import_outdent28.default`
|
|
2061
2225
|
${ctx.file.export("./css")}
|
|
2062
2226
|
${ctx.file.export("./cx")}
|
|
2063
2227
|
${ctx.file.export("./cva")}
|
|
2064
2228
|
`,
|
|
2065
|
-
dts:
|
|
2229
|
+
dts: import_outdent28.default`
|
|
2066
2230
|
export * from './css'
|
|
2067
2231
|
export * from './cx'
|
|
2068
2232
|
export * from './cva'
|
|
@@ -2150,7 +2314,7 @@ var generateFlattenedCss = (ctx) => (options) => {
|
|
|
2150
2314
|
// src/artifacts/css/parser-css.ts
|
|
2151
2315
|
var import_logger2 = require("@pandacss/logger");
|
|
2152
2316
|
var import_func = require("lil-fp/func");
|
|
2153
|
-
var
|
|
2317
|
+
var import_ts_pattern6 = require("ts-pattern");
|
|
2154
2318
|
var flattenStyles = (data) => Object.assign({}, data, { css: void 0 }, data.css ?? {});
|
|
2155
2319
|
var generateParserCss = (ctx) => (result) => (0, import_func.pipe)(
|
|
2156
2320
|
{ ...ctx, sheet: ctx.createSheet(), result },
|
|
@@ -2176,7 +2340,7 @@ var generateParserCss = (ctx) => (result) => (0, import_func.pipe)(
|
|
|
2176
2340
|
const recipeConfig = recipes.getConfig(name);
|
|
2177
2341
|
if (!recipeConfig)
|
|
2178
2342
|
continue;
|
|
2179
|
-
(0,
|
|
2343
|
+
(0, import_ts_pattern6.match)(recipe).with({ type: "jsx-recipe", name: import_ts_pattern6.P.string }, ({ name: name2 }) => {
|
|
2180
2344
|
recipe.data.forEach((data) => {
|
|
2181
2345
|
const [recipeProps, styleProps] = recipes.splitProps(name2, flattenStyles(data));
|
|
2182
2346
|
sheet.processAtomic(styleProps);
|
|
@@ -2195,7 +2359,7 @@ var generateParserCss = (ctx) => (result) => (0, import_func.pipe)(
|
|
|
2195
2359
|
result2.pattern.forEach((patternSet, name) => {
|
|
2196
2360
|
try {
|
|
2197
2361
|
for (const pattern of patternSet) {
|
|
2198
|
-
(0,
|
|
2362
|
+
(0, import_ts_pattern6.match)(pattern).with({ type: "jsx-pattern", name: import_ts_pattern6.P.string }, ({ name: name2 }) => {
|
|
2199
2363
|
pattern.data.forEach((data) => {
|
|
2200
2364
|
const fnName = patterns.getFnName(name2);
|
|
2201
2365
|
const styleProps = patterns.transform(fnName, flattenStyles(data));
|
package/dist/index.mjs
CHANGED
|
@@ -97,7 +97,7 @@ import { Obj as Obj3, pipe as pipe4 } from "lil-fp";
|
|
|
97
97
|
|
|
98
98
|
// src/artifacts/index.ts
|
|
99
99
|
import { isObject } from "@pandacss/shared";
|
|
100
|
-
import
|
|
100
|
+
import outdent28 from "outdent";
|
|
101
101
|
|
|
102
102
|
// src/artifacts/css/global-css.ts
|
|
103
103
|
var generateGlobalCss = (ctx) => {
|
|
@@ -1095,12 +1095,173 @@ export type ${typeName}<T extends ElementType> = JsxHTMLProps<ComponentProps<T>,
|
|
|
1095
1095
|
};
|
|
1096
1096
|
}
|
|
1097
1097
|
|
|
1098
|
-
// src/artifacts/
|
|
1098
|
+
// src/artifacts/qwik-jsx/jsx.ts
|
|
1099
1099
|
import { outdent as outdent13 } from "outdent";
|
|
1100
|
-
function
|
|
1100
|
+
function generateQwikJsxFactory(ctx) {
|
|
1101
1101
|
const { factoryName, componentName } = ctx.jsx;
|
|
1102
1102
|
return {
|
|
1103
1103
|
js: outdent13`
|
|
1104
|
+
import { h } from '@builder.io/qwik'
|
|
1105
|
+
${ctx.file.import("css, cx, cva, assignCss", "../css/index")}
|
|
1106
|
+
${ctx.file.import("splitProps, normalizeHTMLProps", "../helpers")}
|
|
1107
|
+
${ctx.file.import("isCssProperty", "./is-valid-prop")}
|
|
1108
|
+
|
|
1109
|
+
function styledFn(Dynamic, configOrCva = {}) {
|
|
1110
|
+
const cvaFn = configOrCva.__cva__ ? configOrCva : cva(configOrCva)
|
|
1111
|
+
|
|
1112
|
+
const ${componentName} = function ${componentName}(props) {
|
|
1113
|
+
const { as: Element = Dynamic, ...restProps } = props
|
|
1114
|
+
|
|
1115
|
+
const [variantProps, styleProps, htmlProps, elementProps] =
|
|
1116
|
+
splitProps(restProps, cvaFn.variantKeys, isCssProperty, normalizeHTMLProps.keys)
|
|
1117
|
+
|
|
1118
|
+
|
|
1119
|
+
function classes() {
|
|
1120
|
+
const { css: cssStyles, ...propStyles } = styleProps
|
|
1121
|
+
const cvaStyles = cvaFn.resolve(variantProps)
|
|
1122
|
+
const styles = assignCss(cvaStyles, propStyles, cssStyles)
|
|
1123
|
+
return cx(css(styles), elementProps.className)
|
|
1124
|
+
}
|
|
1125
|
+
|
|
1126
|
+
return h(Element, {
|
|
1127
|
+
...elementProps,
|
|
1128
|
+
...normalizeHTMLProps(htmlProps),
|
|
1129
|
+
className: classes(),
|
|
1130
|
+
})
|
|
1131
|
+
}
|
|
1132
|
+
|
|
1133
|
+
${componentName}.displayName = \`${factoryName}.\${Dynamic}\`
|
|
1134
|
+
return ${componentName}
|
|
1135
|
+
}
|
|
1136
|
+
|
|
1137
|
+
function createJsxFactory() {
|
|
1138
|
+
const cache = new Map()
|
|
1139
|
+
|
|
1140
|
+
return new Proxy(styledFn, {
|
|
1141
|
+
apply(_, __, args) {
|
|
1142
|
+
return styledFn(...args)
|
|
1143
|
+
},
|
|
1144
|
+
get(_, el) {
|
|
1145
|
+
if (!cache.has(el)) {
|
|
1146
|
+
cache.set(el, styledFn(el))
|
|
1147
|
+
}
|
|
1148
|
+
return cache.get(el)
|
|
1149
|
+
},
|
|
1150
|
+
})
|
|
1151
|
+
}
|
|
1152
|
+
|
|
1153
|
+
export const ${factoryName} = createJsxFactory()
|
|
1154
|
+
|
|
1155
|
+
`
|
|
1156
|
+
};
|
|
1157
|
+
}
|
|
1158
|
+
|
|
1159
|
+
// src/artifacts/qwik-jsx/pattern.ts
|
|
1160
|
+
import { outdent as outdent14 } from "outdent";
|
|
1161
|
+
import { match as match3 } from "ts-pattern";
|
|
1162
|
+
function generateQwikJsxPattern(ctx) {
|
|
1163
|
+
const { typeName, factoryName } = ctx.jsx;
|
|
1164
|
+
return ctx.patterns.details.map((pattern) => {
|
|
1165
|
+
const { upperName, styleFnName, dashName, jsxName, props, blocklistType } = pattern;
|
|
1166
|
+
const { description, jsxElement = "div" } = pattern.config;
|
|
1167
|
+
return {
|
|
1168
|
+
name: dashName,
|
|
1169
|
+
js: outdent14`
|
|
1170
|
+
import { h } from '@builder.io/qwik'
|
|
1171
|
+
${ctx.file.import(factoryName, "./factory")}
|
|
1172
|
+
${ctx.file.import(styleFnName, `../patterns/${dashName}`)}
|
|
1173
|
+
|
|
1174
|
+
export const ${jsxName} = function ${jsxName}(props) {
|
|
1175
|
+
${match3(props.length).with(
|
|
1176
|
+
0,
|
|
1177
|
+
() => outdent14`
|
|
1178
|
+
const styleProps = ${styleFnName}()
|
|
1179
|
+
return h(${factoryName}.${jsxElement}, { ...styleProps, ...props })
|
|
1180
|
+
`
|
|
1181
|
+
).otherwise(
|
|
1182
|
+
() => outdent14`
|
|
1183
|
+
const { ${props.join(", ")}, ...restProps } = props
|
|
1184
|
+
const styleProps = ${styleFnName}({${props.join(", ")}})
|
|
1185
|
+
return h(${factoryName}.${jsxElement}, { ...styleProps, ...restProps })
|
|
1186
|
+
`
|
|
1187
|
+
)}
|
|
1188
|
+
}
|
|
1189
|
+
`,
|
|
1190
|
+
dts: outdent14`
|
|
1191
|
+
import type { FunctionComponent } from '@builder.io/qwik'
|
|
1192
|
+
import type { ${upperName}Properties } from '../patterns/${dashName}'
|
|
1193
|
+
import type { ${typeName} } from '../types/jsx'
|
|
1194
|
+
|
|
1195
|
+
type Assign<T, U> = {
|
|
1196
|
+
[K in keyof T]?: K extends keyof T ? (K extends keyof U ? T[K] & U[K] : T[K]) : never
|
|
1197
|
+
} & U
|
|
1198
|
+
|
|
1199
|
+
export type ${upperName}Props = Assign<${typeName}<'${jsxElement}'>, Omit<${upperName}Properties, ${blocklistType || '""'}>>
|
|
1200
|
+
|
|
1201
|
+
${description ? `/** ${description} */` : ""}
|
|
1202
|
+
export declare const ${jsxName}: FunctionComponent<${upperName}Props>
|
|
1203
|
+
`
|
|
1204
|
+
};
|
|
1205
|
+
});
|
|
1206
|
+
}
|
|
1207
|
+
|
|
1208
|
+
// src/artifacts/qwik-jsx/types.ts
|
|
1209
|
+
import { outdent as outdent15 } from "outdent";
|
|
1210
|
+
function generateQwikJsxTypes(ctx) {
|
|
1211
|
+
const { factoryName, componentName, upperName, typeName } = ctx.jsx;
|
|
1212
|
+
return {
|
|
1213
|
+
jsxFactory: outdent15`
|
|
1214
|
+
import { ${upperName} } from '../types/jsx'
|
|
1215
|
+
export declare const ${factoryName}: ${upperName}
|
|
1216
|
+
`,
|
|
1217
|
+
jsxType: outdent15`
|
|
1218
|
+
import type { FunctionComponent, QwikIntrinsicElements } from '@builder.io/qwik'
|
|
1219
|
+
import type { JsxStyleProps, Assign as _Assign, PatchedHTMLProps } from './system-types'
|
|
1220
|
+
import type { RecipeDefinition, RecipeRuntimeFn, RecipeSelection, RecipeVariantRecord } from './recipe'
|
|
1221
|
+
|
|
1222
|
+
type ElementType = keyof QwikIntrinsicElements | FunctionComponent<any>
|
|
1223
|
+
|
|
1224
|
+
type ComponentProps<T extends ElementType> = T extends keyof QwikIntrinsicElements
|
|
1225
|
+
? QwikIntrinsicElements[T]
|
|
1226
|
+
: T extends FunctionComponent<infer P>
|
|
1227
|
+
? P
|
|
1228
|
+
: never
|
|
1229
|
+
|
|
1230
|
+
type Dict = Record<string, unknown>
|
|
1231
|
+
|
|
1232
|
+
type Omitted = 'color' | 'translate' | 'transition' | 'width' | 'height' | 'size' | 'content'
|
|
1233
|
+
|
|
1234
|
+
// Patch due to Omit<T, K> not working with Qwik JSX Types
|
|
1235
|
+
|
|
1236
|
+
type Assign<T, U> = {
|
|
1237
|
+
[K in keyof T]?: K extends Omitted
|
|
1238
|
+
? K extends keyof U
|
|
1239
|
+
? U[K]
|
|
1240
|
+
: never
|
|
1241
|
+
: K extends keyof T
|
|
1242
|
+
? K extends keyof U
|
|
1243
|
+
? T[K] & U[K]
|
|
1244
|
+
: T[K]
|
|
1245
|
+
: never
|
|
1246
|
+
} & U & PatchedHTMLProps
|
|
1247
|
+
|
|
1248
|
+
export type ${componentName}<T extends ElementType, P extends Dict = {}> = FunctionComponent<Assign<ComponentProps<T>, _Assign<JsxStyleProps, P>>>
|
|
1249
|
+
|
|
1250
|
+
export type ${upperName} = {
|
|
1251
|
+
<T extends ElementType, P extends RecipeVariantRecord = {}>(component: T, recipe?: RecipeDefinition<P> | RecipeRuntimeFn<P>): ${componentName}<T, RecipeSelection<P>>
|
|
1252
|
+
} & { [K in keyof QwikIntrinsicElements]: ${componentName}<K, {}> }
|
|
1253
|
+
|
|
1254
|
+
export type ${typeName}<T extends ElementType> = Assign<ComponentProps<T>, JsxStyleProps>
|
|
1255
|
+
`
|
|
1256
|
+
};
|
|
1257
|
+
}
|
|
1258
|
+
|
|
1259
|
+
// src/artifacts/react-jsx/jsx.ts
|
|
1260
|
+
import { outdent as outdent16 } from "outdent";
|
|
1261
|
+
function generateReactJsxFactory(ctx) {
|
|
1262
|
+
const { factoryName, componentName } = ctx.jsx;
|
|
1263
|
+
return {
|
|
1264
|
+
js: outdent16`
|
|
1104
1265
|
import { createElement, forwardRef, useMemo } from 'react'
|
|
1105
1266
|
${ctx.file.import("css, cx, cva, assignCss", "../css/index")}
|
|
1106
1267
|
${ctx.file.import("splitProps, normalizeHTMLProps", "../helpers")}
|
|
@@ -1158,8 +1319,8 @@ function generateReactJsxFactory(ctx) {
|
|
|
1158
1319
|
}
|
|
1159
1320
|
|
|
1160
1321
|
// src/artifacts/react-jsx/pattern.ts
|
|
1161
|
-
import { outdent as
|
|
1162
|
-
import { match as
|
|
1322
|
+
import { outdent as outdent17 } from "outdent";
|
|
1323
|
+
import { match as match4 } from "ts-pattern";
|
|
1163
1324
|
function generateReactJsxPattern(ctx) {
|
|
1164
1325
|
const { typeName, factoryName } = ctx.jsx;
|
|
1165
1326
|
return ctx.patterns.details.map((pattern) => {
|
|
@@ -1167,20 +1328,20 @@ function generateReactJsxPattern(ctx) {
|
|
|
1167
1328
|
const { description, jsxElement = "div" } = pattern.config;
|
|
1168
1329
|
return {
|
|
1169
1330
|
name: dashName,
|
|
1170
|
-
js:
|
|
1331
|
+
js: outdent17`
|
|
1171
1332
|
import { createElement, forwardRef } from 'react'
|
|
1172
1333
|
${ctx.file.import(factoryName, "./factory")}
|
|
1173
1334
|
${ctx.file.import(styleFnName, `../patterns/${dashName}`)}
|
|
1174
1335
|
|
|
1175
1336
|
export const ${jsxName} = forwardRef(function ${jsxName}(props, ref) {
|
|
1176
|
-
${
|
|
1337
|
+
${match4(props.length).with(
|
|
1177
1338
|
0,
|
|
1178
|
-
() =>
|
|
1339
|
+
() => outdent17`
|
|
1179
1340
|
const styleProps = ${styleFnName}()
|
|
1180
1341
|
return createElement(${factoryName}.${jsxElement}, { ref, ...styleProps, ...props })
|
|
1181
1342
|
`
|
|
1182
1343
|
).otherwise(
|
|
1183
|
-
() =>
|
|
1344
|
+
() => outdent17`
|
|
1184
1345
|
const { ${props.join(", ")}, ...restProps } = props
|
|
1185
1346
|
const styleProps = ${styleFnName}({${props.join(", ")}})
|
|
1186
1347
|
return createElement(${factoryName}.${jsxElement}, { ref, ...styleProps, ...restProps })
|
|
@@ -1188,7 +1349,7 @@ function generateReactJsxPattern(ctx) {
|
|
|
1188
1349
|
)}
|
|
1189
1350
|
})
|
|
1190
1351
|
`,
|
|
1191
|
-
dts:
|
|
1352
|
+
dts: outdent17`
|
|
1192
1353
|
import type { FunctionComponent } from 'react'
|
|
1193
1354
|
import type { ${upperName}Properties } from '../patterns/${dashName}'
|
|
1194
1355
|
import type { ${typeName} } from '../types/jsx'
|
|
@@ -1203,15 +1364,15 @@ function generateReactJsxPattern(ctx) {
|
|
|
1203
1364
|
}
|
|
1204
1365
|
|
|
1205
1366
|
// src/artifacts/react-jsx/types.ts
|
|
1206
|
-
import { outdent as
|
|
1367
|
+
import { outdent as outdent18 } from "outdent";
|
|
1207
1368
|
function generateReactJsxTypes(ctx) {
|
|
1208
1369
|
const { factoryName, componentName, upperName, typeName } = ctx.jsx;
|
|
1209
1370
|
return {
|
|
1210
|
-
jsxFactory:
|
|
1371
|
+
jsxFactory: outdent18`
|
|
1211
1372
|
import { ${upperName} } from '../types/jsx'
|
|
1212
1373
|
export declare const ${factoryName}: ${upperName}
|
|
1213
1374
|
`,
|
|
1214
|
-
jsxType:
|
|
1375
|
+
jsxType: outdent18`
|
|
1215
1376
|
import type { ElementType, ComponentProps } from 'react'
|
|
1216
1377
|
import type { JsxStyleProps, JsxHTMLProps, Assign } from './system-types'
|
|
1217
1378
|
import type { RecipeDefinition, RecipeRuntimeFn, RecipeSelection, RecipeVariantRecord } from './recipe'
|
|
@@ -1233,11 +1394,11 @@ export type ${typeName}<T extends ElementType> = JsxHTMLProps<ComponentProps<T>,
|
|
|
1233
1394
|
}
|
|
1234
1395
|
|
|
1235
1396
|
// src/artifacts/solid-jsx/jsx.ts
|
|
1236
|
-
import { outdent as
|
|
1397
|
+
import { outdent as outdent19 } from "outdent";
|
|
1237
1398
|
function generateSolidJsxFactory(ctx) {
|
|
1238
1399
|
const { componentName, factoryName } = ctx.jsx;
|
|
1239
1400
|
return {
|
|
1240
|
-
js:
|
|
1401
|
+
js: outdent19`
|
|
1241
1402
|
import { Dynamic } from 'solid-js/web'
|
|
1242
1403
|
import { mergeProps, splitProps } from 'solid-js'
|
|
1243
1404
|
import { createComponent } from 'solid-js/web'
|
|
@@ -1306,8 +1467,8 @@ function generateSolidJsxFactory(ctx) {
|
|
|
1306
1467
|
}
|
|
1307
1468
|
|
|
1308
1469
|
// src/artifacts/solid-jsx/pattern.ts
|
|
1309
|
-
import { outdent as
|
|
1310
|
-
import { match as
|
|
1470
|
+
import { outdent as outdent20 } from "outdent";
|
|
1471
|
+
import { match as match5 } from "ts-pattern";
|
|
1311
1472
|
function generateSolidJsxPattern(ctx) {
|
|
1312
1473
|
const { typeName, factoryName } = ctx.jsx;
|
|
1313
1474
|
return ctx.patterns.details.map((pattern) => {
|
|
@@ -1315,21 +1476,21 @@ function generateSolidJsxPattern(ctx) {
|
|
|
1315
1476
|
const { description, jsxElement = "div" } = pattern.config;
|
|
1316
1477
|
return {
|
|
1317
1478
|
name: dashName,
|
|
1318
|
-
js:
|
|
1479
|
+
js: outdent20`
|
|
1319
1480
|
import { splitProps, mergeProps } from 'solid-js'
|
|
1320
1481
|
import { createComponent } from 'solid-js/web'
|
|
1321
1482
|
${ctx.file.import(factoryName, "./factory")}
|
|
1322
1483
|
${ctx.file.import(styleFnName, `../patterns/${dashName}`)}
|
|
1323
1484
|
|
|
1324
1485
|
export function ${jsxName}(props) {
|
|
1325
|
-
${
|
|
1486
|
+
${match5(props.length).with(
|
|
1326
1487
|
0,
|
|
1327
|
-
() =>
|
|
1488
|
+
() => outdent20`
|
|
1328
1489
|
const styleProps = ${styleFnName}()
|
|
1329
1490
|
return createComponent(${factoryName}.${jsxElement}, mergeProps(styleProps, props))
|
|
1330
1491
|
`
|
|
1331
1492
|
).otherwise(
|
|
1332
|
-
() =>
|
|
1493
|
+
() => outdent20`
|
|
1333
1494
|
const [patternProps, restProps] = splitProps(props, [${props.map((v) => JSON.stringify(v)).join(", ")}]);
|
|
1334
1495
|
const styleProps = ${styleFnName}(patternProps)
|
|
1335
1496
|
return createComponent(${factoryName}.${jsxElement}, mergeProps(styleProps, restProps))
|
|
@@ -1337,7 +1498,7 @@ function generateSolidJsxPattern(ctx) {
|
|
|
1337
1498
|
)}
|
|
1338
1499
|
}
|
|
1339
1500
|
`,
|
|
1340
|
-
dts:
|
|
1501
|
+
dts: outdent20`
|
|
1341
1502
|
import { Component } from 'solid-js'
|
|
1342
1503
|
import { ${upperName}Properties } from '../patterns/${dashName}'
|
|
1343
1504
|
import { ${typeName} } from '../types/jsx'
|
|
@@ -1352,15 +1513,15 @@ function generateSolidJsxPattern(ctx) {
|
|
|
1352
1513
|
}
|
|
1353
1514
|
|
|
1354
1515
|
// src/artifacts/solid-jsx/types.ts
|
|
1355
|
-
import { outdent as
|
|
1516
|
+
import { outdent as outdent21 } from "outdent";
|
|
1356
1517
|
function generateSolidJsxTypes(ctx) {
|
|
1357
1518
|
const { factoryName, componentName, upperName, typeName } = ctx.jsx;
|
|
1358
1519
|
return {
|
|
1359
|
-
jsxFactory:
|
|
1520
|
+
jsxFactory: outdent21`
|
|
1360
1521
|
import type { ${upperName} } from '../types/jsx'
|
|
1361
1522
|
export declare const ${factoryName}: ${upperName}
|
|
1362
1523
|
`,
|
|
1363
|
-
jsxType:
|
|
1524
|
+
jsxType: outdent21`
|
|
1364
1525
|
import type { JSX, ComponentProps, Component } from 'solid-js'
|
|
1365
1526
|
import type { JsxStyleProps, JsxHTMLProps } from './system-types'
|
|
1366
1527
|
import type { RecipeDefinition, RecipeRuntimeFn, RecipeSelection, RecipeVariantRecord } from './recipe'
|
|
@@ -1384,11 +1545,11 @@ export type ${typeName}<T extends ElementType> = JsxHTMLProps<ComponentProps<T>,
|
|
|
1384
1545
|
}
|
|
1385
1546
|
|
|
1386
1547
|
// src/artifacts/vue-jsx/jsx.ts
|
|
1387
|
-
import { outdent as
|
|
1548
|
+
import { outdent as outdent22 } from "outdent";
|
|
1388
1549
|
function generateVueJsxFactory(ctx) {
|
|
1389
1550
|
const { factoryName } = ctx.jsx;
|
|
1390
1551
|
return {
|
|
1391
|
-
js:
|
|
1552
|
+
js: outdent22`
|
|
1392
1553
|
import { defineComponent, h, computed } from 'vue'
|
|
1393
1554
|
${ctx.file.import("css, cx, cva, assignCss", "../css/index")}
|
|
1394
1555
|
${ctx.file.import("splitProps, normalizeHTMLProps", "../helpers")}
|
|
@@ -1453,15 +1614,15 @@ function generateVueJsxFactory(ctx) {
|
|
|
1453
1614
|
}
|
|
1454
1615
|
|
|
1455
1616
|
// src/artifacts/vue-jsx/types.ts
|
|
1456
|
-
import { outdent as
|
|
1617
|
+
import { outdent as outdent23 } from "outdent";
|
|
1457
1618
|
function generateVueJsxTypes(ctx) {
|
|
1458
1619
|
const { factoryName, componentName, upperName, typeName } = ctx.jsx;
|
|
1459
1620
|
return {
|
|
1460
|
-
jsxFactory:
|
|
1621
|
+
jsxFactory: outdent23`
|
|
1461
1622
|
import { ${upperName} } from '../types/jsx'
|
|
1462
1623
|
export declare const ${factoryName}: ${upperName}
|
|
1463
1624
|
`,
|
|
1464
|
-
jsxType:
|
|
1625
|
+
jsxType: outdent23`
|
|
1465
1626
|
import type { Component, FunctionalComponent } from 'vue'
|
|
1466
1627
|
import type { JsxStyleProps, JsxHTMLProps } from './system-types'
|
|
1467
1628
|
import type { RecipeDefinition, RecipeRuntimeFn, RecipeSelection, RecipeVariantRecord } from './recipe'
|
|
@@ -1611,7 +1772,8 @@ var typesMap = {
|
|
|
1611
1772
|
react: generateReactJsxTypes,
|
|
1612
1773
|
preact: generatePreactJsxTypes,
|
|
1613
1774
|
solid: generateSolidJsxTypes,
|
|
1614
|
-
vue: generateVueJsxTypes
|
|
1775
|
+
vue: generateVueJsxTypes,
|
|
1776
|
+
qwik: generateQwikJsxTypes
|
|
1615
1777
|
};
|
|
1616
1778
|
function generateJsxTypes(ctx) {
|
|
1617
1779
|
if (!ctx.jsx.framework)
|
|
@@ -1622,7 +1784,8 @@ var factoryMap = {
|
|
|
1622
1784
|
react: generateReactJsxFactory,
|
|
1623
1785
|
solid: generateSolidJsxFactory,
|
|
1624
1786
|
preact: generatePreactJsxFactory,
|
|
1625
|
-
vue: generateVueJsxFactory
|
|
1787
|
+
vue: generateVueJsxFactory,
|
|
1788
|
+
qwik: generateQwikJsxFactory
|
|
1626
1789
|
};
|
|
1627
1790
|
function generateJsxFactory(ctx) {
|
|
1628
1791
|
if (!ctx.jsx.framework)
|
|
@@ -1633,7 +1796,8 @@ var patternMap = {
|
|
|
1633
1796
|
react: generateReactJsxPattern,
|
|
1634
1797
|
solid: generateSolidJsxPattern,
|
|
1635
1798
|
preact: generatePreactJsxPattern,
|
|
1636
|
-
vue: () => []
|
|
1799
|
+
vue: () => [],
|
|
1800
|
+
qwik: generateQwikJsxPattern
|
|
1637
1801
|
};
|
|
1638
1802
|
function generateJsxPatterns(ctx) {
|
|
1639
1803
|
if (ctx.patterns.isEmpty() && !ctx.jsx.framework)
|
|
@@ -1688,7 +1852,7 @@ var csstype_d_ts_default = {
|
|
|
1688
1852
|
|
|
1689
1853
|
// src/artifacts/generated/system-types.d.ts.json
|
|
1690
1854
|
var system_types_d_ts_default = {
|
|
1691
|
-
content: "import type { ConditionalValue, Conditions, Nested } from './conditions'\nimport type { PropertiesFallback } from './csstype'\nimport type { SystemProperties, CssVarProperties } from './style-props'\n\ntype String = string & {}\ntype Number = number & {}\n\n/* -----------------------------------------------------------------------------\n * Native css properties\n * -----------------------------------------------------------------------------*/\n\nexport type CssProperty = keyof PropertiesFallback\n\nexport type CssProperties = PropertiesFallback<String | Number> & CssVarProperties\n\nexport type CssKeyframes = {\n [name: string]: {\n [time: string]: CssProperties\n }\n}\n\n/* -----------------------------------------------------------------------------\n * Conditional css properties\n * -----------------------------------------------------------------------------*/\n\ntype MinimalNested<P> = {\n [K in keyof Conditions]?: Nested<P>\n}\n\ntype GenericProperties = {\n [key: string]: ConditionalValue<String | Number | boolean>\n}\n\n/* -----------------------------------------------------------------------------\n * Native css props\n * -----------------------------------------------------------------------------*/\n\nexport type NestedCssProperties = Nested<CssProperties>\n\nexport type SystemStyleObject = Nested<SystemProperties & CssVarProperties>\n\nexport type GlobalStyleObject = {\n [selector: string]: SystemStyleObject\n}\n\nexport type CompositionStyleObject<Property extends string> = Nested<{\n [K in Property]?: K extends keyof SystemStyleObject ? SystemStyleObject[K] : unknown\n}>\n\n/* -----------------------------------------------------------------------------\n * Jsx style props\n * -----------------------------------------------------------------------------*/\n\nexport type JsxStyleProps = SystemProperties &\n MinimalNested<SystemStyleObject> & {\n css?: SystemStyleObject\n }\n\ntype Assign<T, U> = Omit<T, keyof U> & U\n\
|
|
1855
|
+
content: "import type { ConditionalValue, Conditions, Nested } from './conditions'\nimport type { PropertiesFallback } from './csstype'\nimport type { SystemProperties, CssVarProperties } from './style-props'\n\ntype String = string & {}\ntype Number = number & {}\n\n/* -----------------------------------------------------------------------------\n * Native css properties\n * -----------------------------------------------------------------------------*/\n\nexport type CssProperty = keyof PropertiesFallback\n\nexport type CssProperties = PropertiesFallback<String | Number> & CssVarProperties\n\nexport type CssKeyframes = {\n [name: string]: {\n [time: string]: CssProperties\n }\n}\n\n/* -----------------------------------------------------------------------------\n * Conditional css properties\n * -----------------------------------------------------------------------------*/\n\ntype MinimalNested<P> = {\n [K in keyof Conditions]?: Nested<P>\n}\n\ntype GenericProperties = {\n [key: string]: ConditionalValue<String | Number | boolean>\n}\n\n/* -----------------------------------------------------------------------------\n * Native css props\n * -----------------------------------------------------------------------------*/\n\nexport type NestedCssProperties = Nested<CssProperties>\n\nexport type SystemStyleObject = Nested<SystemProperties & CssVarProperties>\n\nexport type GlobalStyleObject = {\n [selector: string]: SystemStyleObject\n}\n\nexport type CompositionStyleObject<Property extends string> = Nested<{\n [K in Property]?: K extends keyof SystemStyleObject ? SystemStyleObject[K] : unknown\n}>\n\n/* -----------------------------------------------------------------------------\n * Jsx style props\n * -----------------------------------------------------------------------------*/\n\nexport type JsxStyleProps = SystemProperties &\n MinimalNested<SystemStyleObject> & {\n css?: SystemStyleObject\n }\n\ntype Assign<T, U> = Omit<T, keyof U> & U\n\nexport type PatchedHTMLProps = {\n htmlSize?: string | number\n htmlWidth?: string | number\n htmlHeight?: string | number\n htmlTranslate?: 'yes' | 'no' | undefined\n htmlContent?: string\n}\n\nexport type OmittedHTMLProps = 'color' | 'translate' | 'transition' | 'width' | 'height' | 'size' | 'content'\n\ntype WithHTMLProps<T> = Omit<T, OmittedHTMLProps> & PatchedHTMLProps\n\nexport type JsxHTMLProps<T extends Record<string, any>, P extends Record<string, any> = {}> = Assign<\n WithHTMLProps<T>,\n P\n>\n"
|
|
1692
1856
|
};
|
|
1693
1857
|
|
|
1694
1858
|
// src/artifacts/generated/composition.d.ts.json
|
|
@@ -1730,9 +1894,9 @@ function getGeneratedTypes() {
|
|
|
1730
1894
|
}
|
|
1731
1895
|
|
|
1732
1896
|
// src/artifacts/types/main.ts
|
|
1733
|
-
import { outdent as
|
|
1897
|
+
import { outdent as outdent24 } from "outdent";
|
|
1734
1898
|
var generateTypesEntry = () => ({
|
|
1735
|
-
global:
|
|
1899
|
+
global: outdent24`
|
|
1736
1900
|
import { AnyRecipeConfig, RecipeVariantRecord, RecipeConfig } from './recipe'
|
|
1737
1901
|
import { Parts } from './parts'
|
|
1738
1902
|
import { AnyPatternConfig, PatternConfig } from './pattern'
|
|
@@ -1749,19 +1913,19 @@ var generateTypesEntry = () => ({
|
|
|
1749
1913
|
export function defineParts<T extends Parts>(parts: T): (config: Partial<Record<keyof T, SystemStyleObject>>) => Partial<Record<keyof T, SystemStyleObject>>;
|
|
1750
1914
|
}
|
|
1751
1915
|
`,
|
|
1752
|
-
index:
|
|
1916
|
+
index: outdent24`
|
|
1753
1917
|
import './global'
|
|
1754
1918
|
export { ConditionalValue } from './conditions'
|
|
1755
1919
|
export { GlobalStyleObject, JsxStyleProps, SystemStyleObject } from './system-types'
|
|
1756
1920
|
|
|
1757
1921
|
`,
|
|
1758
|
-
helpers:
|
|
1922
|
+
helpers: outdent24`
|
|
1759
1923
|
export type Pretty<T> = T extends infer U ? { [K in keyof U]: U[K] } : never
|
|
1760
1924
|
`
|
|
1761
1925
|
});
|
|
1762
1926
|
|
|
1763
1927
|
// src/artifacts/types/prop-types.ts
|
|
1764
|
-
import { outdent as
|
|
1928
|
+
import { outdent as outdent25 } from "outdent";
|
|
1765
1929
|
function generatePropTypes(ctx) {
|
|
1766
1930
|
const {
|
|
1767
1931
|
config: { strictTokens },
|
|
@@ -1769,7 +1933,7 @@ function generatePropTypes(ctx) {
|
|
|
1769
1933
|
} = ctx;
|
|
1770
1934
|
const strictText = `${strictTokens ? "" : " | CssValue<T>"}`;
|
|
1771
1935
|
const result = [
|
|
1772
|
-
|
|
1936
|
+
outdent25`
|
|
1773
1937
|
import type { ConditionalValue } from './conditions';
|
|
1774
1938
|
import type { CssProperties } from './system-types'
|
|
1775
1939
|
import type { Tokens } from '../tokens'
|
|
@@ -1792,7 +1956,7 @@ function generatePropTypes(ctx) {
|
|
|
1792
1956
|
result.push(` ${key}: Shorthand<${JSON.stringify(value)}>;`);
|
|
1793
1957
|
});
|
|
1794
1958
|
result.push("}");
|
|
1795
|
-
return
|
|
1959
|
+
return outdent25`
|
|
1796
1960
|
${result.join("\n")}
|
|
1797
1961
|
|
|
1798
1962
|
export type PropertyValue<T extends string> = T extends keyof PropertyTypes
|
|
@@ -1805,10 +1969,10 @@ function generatePropTypes(ctx) {
|
|
|
1805
1969
|
|
|
1806
1970
|
// src/artifacts/types/style-props.ts
|
|
1807
1971
|
import { allCssProperties } from "@pandacss/is-valid-prop";
|
|
1808
|
-
import
|
|
1972
|
+
import outdent26 from "outdent";
|
|
1809
1973
|
function generateStyleProps(ctx) {
|
|
1810
1974
|
const props = new Set(allCssProperties.concat(ctx.utility.keys()));
|
|
1811
|
-
return
|
|
1975
|
+
return outdent26`
|
|
1812
1976
|
import { ConditionalValue } from './conditions'
|
|
1813
1977
|
import { PropertyValue } from './prop-type'
|
|
1814
1978
|
import { Token } from '../tokens'
|
|
@@ -1825,7 +1989,7 @@ function generateStyleProps(ctx) {
|
|
|
1825
1989
|
|
|
1826
1990
|
// src/artifacts/types/token-types.ts
|
|
1827
1991
|
import { capitalize, unionType as unionType3 } from "@pandacss/shared";
|
|
1828
|
-
import { outdent as
|
|
1992
|
+
import { outdent as outdent27 } from "outdent";
|
|
1829
1993
|
import pluralize from "pluralize";
|
|
1830
1994
|
var categories = [
|
|
1831
1995
|
"zIndex",
|
|
@@ -1867,7 +2031,7 @@ function generateTokenTypes(ctx) {
|
|
|
1867
2031
|
result.add("} & { [token: string]: never }");
|
|
1868
2032
|
set.add(Array.from(result).join("\n"));
|
|
1869
2033
|
set.add(`export type TokenCategory = ${unionType3(categories)}`);
|
|
1870
|
-
return
|
|
2034
|
+
return outdent27.string(Array.from(set).join("\n\n"));
|
|
1871
2035
|
}
|
|
1872
2036
|
|
|
1873
2037
|
// src/artifacts/index.ts
|
|
@@ -1962,8 +2126,8 @@ function setupRecipes(ctx) {
|
|
|
1962
2126
|
return;
|
|
1963
2127
|
const indexFiles = files.filter((file) => !file.name.includes("create-recipe"));
|
|
1964
2128
|
const index = {
|
|
1965
|
-
js:
|
|
1966
|
-
dts:
|
|
2129
|
+
js: outdent28.string(indexFiles.map((file) => ctx.file.export(`./${file.name}`)).join("\n")),
|
|
2130
|
+
dts: outdent28.string(indexFiles.map((file) => `export * from './${file.name}'`).join("\n"))
|
|
1967
2131
|
};
|
|
1968
2132
|
return {
|
|
1969
2133
|
dir: ctx.paths.recipe,
|
|
@@ -1980,8 +2144,8 @@ function setupPatterns(ctx) {
|
|
|
1980
2144
|
if (!files)
|
|
1981
2145
|
return;
|
|
1982
2146
|
const index = {
|
|
1983
|
-
js:
|
|
1984
|
-
dts:
|
|
2147
|
+
js: outdent28.string(files.map((file) => ctx.file.export(`./${file.name}`)).join("\n")),
|
|
2148
|
+
dts: outdent28.string(files.map((file) => `export * from './${file.name}'`).join("\n"))
|
|
1985
2149
|
};
|
|
1986
2150
|
return {
|
|
1987
2151
|
dir: ctx.paths.pattern,
|
|
@@ -2001,13 +2165,13 @@ function setupJsx(ctx) {
|
|
|
2001
2165
|
const factory = generateJsxFactory(ctx);
|
|
2002
2166
|
const patterns = generateJsxPatterns(ctx);
|
|
2003
2167
|
const index = {
|
|
2004
|
-
js:
|
|
2168
|
+
js: outdent28`
|
|
2005
2169
|
${ctx.file.export("./factory")}
|
|
2006
|
-
${
|
|
2170
|
+
${outdent28.string(patterns.map((file) => ctx.file.export(`./${file.name}`)).join("\n"))}
|
|
2007
2171
|
`,
|
|
2008
|
-
dts:
|
|
2172
|
+
dts: outdent28`
|
|
2009
2173
|
export * from './factory'
|
|
2010
|
-
${
|
|
2174
|
+
${outdent28.string(patterns.map((file) => `export * from './${file.name}'`).join("\n"))}
|
|
2011
2175
|
export type { ${ctx.jsx.typeName} } from '../types/jsx'
|
|
2012
2176
|
`
|
|
2013
2177
|
};
|
|
@@ -2026,12 +2190,12 @@ function setupJsx(ctx) {
|
|
|
2026
2190
|
}
|
|
2027
2191
|
function setupCssIndex(ctx) {
|
|
2028
2192
|
const index = {
|
|
2029
|
-
js:
|
|
2193
|
+
js: outdent28`
|
|
2030
2194
|
${ctx.file.export("./css")}
|
|
2031
2195
|
${ctx.file.export("./cx")}
|
|
2032
2196
|
${ctx.file.export("./cva")}
|
|
2033
2197
|
`,
|
|
2034
|
-
dts:
|
|
2198
|
+
dts: outdent28`
|
|
2035
2199
|
export * from './css'
|
|
2036
2200
|
export * from './cx'
|
|
2037
2201
|
export * from './cva'
|
|
@@ -2119,7 +2283,7 @@ var generateFlattenedCss = (ctx) => (options) => {
|
|
|
2119
2283
|
// src/artifacts/css/parser-css.ts
|
|
2120
2284
|
import { logger } from "@pandacss/logger";
|
|
2121
2285
|
import { pipe, tap, tryCatch } from "lil-fp/func";
|
|
2122
|
-
import { match as
|
|
2286
|
+
import { match as match6, P } from "ts-pattern";
|
|
2123
2287
|
var flattenStyles = (data) => Object.assign({}, data, { css: void 0 }, data.css ?? {});
|
|
2124
2288
|
var generateParserCss = (ctx) => (result) => pipe(
|
|
2125
2289
|
{ ...ctx, sheet: ctx.createSheet(), result },
|
|
@@ -2145,7 +2309,7 @@ var generateParserCss = (ctx) => (result) => pipe(
|
|
|
2145
2309
|
const recipeConfig = recipes.getConfig(name);
|
|
2146
2310
|
if (!recipeConfig)
|
|
2147
2311
|
continue;
|
|
2148
|
-
|
|
2312
|
+
match6(recipe).with({ type: "jsx-recipe", name: P.string }, ({ name: name2 }) => {
|
|
2149
2313
|
recipe.data.forEach((data) => {
|
|
2150
2314
|
const [recipeProps, styleProps] = recipes.splitProps(name2, flattenStyles(data));
|
|
2151
2315
|
sheet.processAtomic(styleProps);
|
|
@@ -2164,7 +2328,7 @@ var generateParserCss = (ctx) => (result) => pipe(
|
|
|
2164
2328
|
result2.pattern.forEach((patternSet, name) => {
|
|
2165
2329
|
try {
|
|
2166
2330
|
for (const pattern of patternSet) {
|
|
2167
|
-
|
|
2331
|
+
match6(pattern).with({ type: "jsx-pattern", name: P.string }, ({ name: name2 }) => {
|
|
2168
2332
|
pattern.data.forEach((data) => {
|
|
2169
2333
|
const fnName = patterns.getFnName(name2);
|
|
2170
2334
|
const styleProps = patterns.transform(fnName, flattenStyles(data));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pandacss/generator",
|
|
3
|
-
"version": "0.0.0-dev-
|
|
3
|
+
"version": "0.0.0-dev-20230530153916",
|
|
4
4
|
"description": "The css generator for css panda",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -20,16 +20,16 @@
|
|
|
20
20
|
"pluralize": "8.0.0",
|
|
21
21
|
"postcss": "8.4.24",
|
|
22
22
|
"ts-pattern": "4.3.0",
|
|
23
|
-
"@pandacss/core": "0.0.0-dev-
|
|
24
|
-
"@pandacss/logger": "0.0.0-dev-
|
|
25
|
-
"@pandacss/is-valid-prop": "0.0.0-dev-
|
|
26
|
-
"@pandacss/shared": "0.0.0-dev-
|
|
27
|
-
"@pandacss/types": "0.0.0-dev-
|
|
28
|
-
"@pandacss/token-dictionary": "0.0.0-dev-
|
|
23
|
+
"@pandacss/core": "0.0.0-dev-20230530153916",
|
|
24
|
+
"@pandacss/logger": "0.0.0-dev-20230530153916",
|
|
25
|
+
"@pandacss/is-valid-prop": "0.0.0-dev-20230530153916",
|
|
26
|
+
"@pandacss/shared": "0.0.0-dev-20230530153916",
|
|
27
|
+
"@pandacss/types": "0.0.0-dev-20230530153916",
|
|
28
|
+
"@pandacss/token-dictionary": "0.0.0-dev-20230530153916"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
31
|
"@types/pluralize": "0.0.29",
|
|
32
|
-
"@pandacss/fixture": "0.0.0-dev-
|
|
32
|
+
"@pandacss/fixture": "0.0.0-dev-20230530153916"
|
|
33
33
|
},
|
|
34
34
|
"scripts": {
|
|
35
35
|
"prebuild": "tsx scripts/prebuild.ts",
|