@tamagui/static 1.0.1-beta.68 → 1.0.1-beta.69
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/cjs/extractor/createEvaluator.js +1 -1
- package/dist/cjs/extractor/createEvaluator.js.map +2 -2
- package/dist/cjs/extractor/createExtractor.js +227 -115
- package/dist/cjs/extractor/createExtractor.js.map +2 -2
- package/dist/cjs/extractor/extractToClassNames.js +16 -20
- package/dist/cjs/extractor/extractToClassNames.js.map +2 -2
- package/dist/cjs/patchReactNativeWeb.js +29 -89
- package/dist/cjs/patchReactNativeWeb.js.map +2 -2
- package/dist/cjs/types.js.map +1 -1
- package/dist/esm/extractor/createEvaluator.js +1 -1
- package/dist/esm/extractor/createEvaluator.js.map +2 -2
- package/dist/esm/extractor/createExtractor.js +232 -119
- package/dist/esm/extractor/createExtractor.js.map +2 -2
- package/dist/esm/extractor/extractToClassNames.js +16 -20
- package/dist/esm/extractor/extractToClassNames.js.map +2 -2
- package/dist/esm/patchReactNativeWeb.js +29 -89
- package/dist/esm/patchReactNativeWeb.js.map +2 -2
- package/dist/jsx/extractor/createEvaluator.js +1 -1
- package/dist/jsx/extractor/createExtractor.js +232 -119
- package/dist/jsx/extractor/extractToClassNames.js +16 -20
- package/dist/jsx/patchReactNativeWeb.js +29 -89
- package/package.json +17 -12
- package/src/extractor/createEvaluator.ts +2 -1
- package/src/extractor/createExtractor.ts +356 -161
- package/src/extractor/extractToClassNames.ts +20 -31
- package/src/patchReactNativeWeb.ts +47 -96
- package/src/types.ts +6 -8
- package/types/extractor/createEvaluator.d.ts +1 -1
- package/types/extractor/createEvaluator.d.ts.map +1 -1
- package/types/extractor/createExtractor.d.ts +2 -1
- package/types/extractor/createExtractor.d.ts.map +1 -1
- package/types/extractor/extractToClassNames.d.ts.map +1 -1
- package/types/patchReactNativeWeb.d.ts.map +1 -1
- package/types/types.d.ts +4 -7
- package/types/types.d.ts.map +1 -1
|
@@ -97,6 +97,10 @@ export function extractToClassNames({
|
|
|
97
97
|
shouldPrintDebug,
|
|
98
98
|
...options,
|
|
99
99
|
target: 'html',
|
|
100
|
+
extractStyledDefinitions: true,
|
|
101
|
+
onStyleRule(identifier, rules) {
|
|
102
|
+
cssMap.set(`.${identifier}`, { css: rules.join(';'), commentTexts: [] })
|
|
103
|
+
},
|
|
100
104
|
getFlattenedNode: ({ tag }) => {
|
|
101
105
|
hasFlattened = true
|
|
102
106
|
return tag
|
|
@@ -112,6 +116,10 @@ export function extractToClassNames({
|
|
|
112
116
|
programPath,
|
|
113
117
|
isFlattened,
|
|
114
118
|
}) => {
|
|
119
|
+
// reset hasFlattened
|
|
120
|
+
const didFlattenThisTag = hasFlattened
|
|
121
|
+
hasFlattened = false
|
|
122
|
+
|
|
115
123
|
let finalClassNames: ClassNameObject[] = []
|
|
116
124
|
let finalAttrs: (t.JSXAttribute | t.JSXSpreadAttribute)[] = []
|
|
117
125
|
let finalStyles: StyleObject[] = []
|
|
@@ -156,37 +164,17 @@ export function extractToClassNames({
|
|
|
156
164
|
switch (attr.type) {
|
|
157
165
|
case 'style':
|
|
158
166
|
if (!isFlattened) {
|
|
159
|
-
// only ever one at a time i believe so we can be lazy with this access
|
|
160
|
-
const { hoverStyle, pressStyle, focusStyle } = attr.value
|
|
161
|
-
const pseudos = [
|
|
162
|
-
['hoverStyle', hoverStyle],
|
|
163
|
-
['pressStyle', pressStyle],
|
|
164
|
-
['focusStyle', focusStyle],
|
|
165
|
-
] as const
|
|
166
|
-
|
|
167
167
|
const styles = getStylesAtomic(attr.value, {
|
|
168
168
|
splitTransforms: true,
|
|
169
169
|
})
|
|
170
|
-
finalStyles = [...finalStyles, ...styles]
|
|
171
170
|
|
|
172
|
-
|
|
173
|
-
if (value && Object.keys(value).length) {
|
|
174
|
-
finalAttrs.push(
|
|
175
|
-
t.jsxAttribute(
|
|
176
|
-
t.jsxIdentifier(key),
|
|
177
|
-
t.jsxExpressionContainer(literalToAst(value))
|
|
178
|
-
)
|
|
179
|
-
)
|
|
180
|
-
}
|
|
181
|
-
}
|
|
171
|
+
finalStyles = [...finalStyles, ...styles]
|
|
182
172
|
|
|
183
173
|
for (const style of styles) {
|
|
184
|
-
if (style.pseudo) {
|
|
185
|
-
continue
|
|
186
|
-
}
|
|
187
174
|
// leave them as attributes
|
|
175
|
+
const prop = style.pseudo ? `${style.property}-${style.pseudo}` : style.property
|
|
188
176
|
finalAttrs.push(
|
|
189
|
-
t.jsxAttribute(t.jsxIdentifier(
|
|
177
|
+
t.jsxAttribute(t.jsxIdentifier(prop), t.stringLiteral(style.identifier))
|
|
190
178
|
)
|
|
191
179
|
}
|
|
192
180
|
} else {
|
|
@@ -305,7 +293,7 @@ export function extractToClassNames({
|
|
|
305
293
|
|
|
306
294
|
// if has some spreads, use concat helper
|
|
307
295
|
if (nameExpr && !t.isIdentifier(nameExpr)) {
|
|
308
|
-
if (!
|
|
296
|
+
if (!didFlattenThisTag) {
|
|
309
297
|
// not flat
|
|
310
298
|
} else {
|
|
311
299
|
ensureImportingConcat(programPath)
|
|
@@ -326,7 +314,8 @@ export function extractToClassNames({
|
|
|
326
314
|
|
|
327
315
|
const comment = util.format('/* %s:%s (%s) */', filePath, lineNumbers, originalNodeName)
|
|
328
316
|
|
|
329
|
-
for (const {
|
|
317
|
+
for (const { identifier, rules } of finalStyles) {
|
|
318
|
+
const className = `.${identifier}`
|
|
330
319
|
if (cssMap.has(className)) {
|
|
331
320
|
if (comment) {
|
|
332
321
|
const val = cssMap.get(className)!
|
|
@@ -347,7 +336,7 @@ export function extractToClassNames({
|
|
|
347
336
|
},
|
|
348
337
|
})
|
|
349
338
|
|
|
350
|
-
if (!res || (!res.modified && !res.optimized && !res.flattened)) {
|
|
339
|
+
if (!res || (!res.modified && !res.optimized && !res.flattened && !res.styled)) {
|
|
351
340
|
if (shouldPrintDebug) {
|
|
352
341
|
console.log('no res or none modified', res)
|
|
353
342
|
}
|
|
@@ -401,6 +390,8 @@ export function extractToClassNames({
|
|
|
401
390
|
.slice(0, 22)
|
|
402
391
|
.trim()
|
|
403
392
|
.padStart(24)
|
|
393
|
+
|
|
394
|
+
const numStyled = `${res.styled}`.padStart(3)
|
|
404
395
|
const numOptimized = `${res.optimized}`.padStart(3)
|
|
405
396
|
const numFound = `${res.found}`.padStart(3)
|
|
406
397
|
const numFlattened = `${res.flattened}`.padStart(3)
|
|
@@ -408,12 +399,10 @@ export function extractToClassNames({
|
|
|
408
399
|
const timing = Date.now() - start
|
|
409
400
|
const timingWarning = timing > 50 ? '⚠️' : timing > 150 ? '☢️' : ''
|
|
410
401
|
const timingStr = `${timing}ms${timingWarning}`.padStart(6)
|
|
402
|
+
const pre = getPrefixLogs(options)
|
|
403
|
+
const memStr = memory ? `(${memory})` : ''
|
|
411
404
|
console.log(
|
|
412
|
-
`${
|
|
413
|
-
options
|
|
414
|
-
)} ${path} ${numFound} · ${numOptimized} · ${numFlattened} ${timingStr} ${
|
|
415
|
-
memory ? `(${memory})` : ''
|
|
416
|
-
}`
|
|
405
|
+
`${pre} ${path} ${numFound} · ${numOptimized} · ${numFlattened} · ${numStyled} ${timingStr} ${memStr}`
|
|
417
406
|
)
|
|
418
407
|
}
|
|
419
408
|
|
|
@@ -7,98 +7,87 @@ import * as fs from 'fs-extra'
|
|
|
7
7
|
// so we can't just require it all directly
|
|
8
8
|
// would be nice in the future to be able to eject from react-native-web entirely optionally
|
|
9
9
|
|
|
10
|
+
const PATCH_PREFIX = 'tamagui-patch-'
|
|
11
|
+
const PATCH_VERSION = `${PATCH_PREFIX}-v5`
|
|
12
|
+
const PATCH_COMMENT = `// ${PATCH_VERSION}`
|
|
13
|
+
const PATCH_END_COMMENT = `// tamagui-patch-end`
|
|
14
|
+
|
|
10
15
|
// keep it sync
|
|
11
16
|
export function patchReactNativeWeb(dir: string = require.resolve('react-native-web')) {
|
|
12
17
|
const rootDir = dir.replace(/[\/\\]dist.*/, '')
|
|
18
|
+
|
|
19
|
+
const pkgJSON = fs.readJSONSync(path.join(rootDir, 'package.json'))
|
|
20
|
+
if (pkgJSON.version.split('.')[1] !== '18') {
|
|
21
|
+
console.error(
|
|
22
|
+
`⛔️ Error! Tamagui as of beta 69 only works with react-native-web version 0.18.x`,
|
|
23
|
+
pkgJSON.version
|
|
24
|
+
)
|
|
25
|
+
process.exit(1)
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
// patch exports for tamagui
|
|
13
29
|
const modulePath = path.join(rootDir, 'dist', 'tamagui-exports.js')
|
|
14
30
|
const cjsPath = path.join(rootDir, 'dist', 'cjs', 'tamagui-exports.js')
|
|
15
|
-
const
|
|
31
|
+
const alreadyPatchedImports =
|
|
16
32
|
fs.existsSync(modulePath) &&
|
|
17
33
|
fs.readFileSync(modulePath, 'utf-8') === moduleExports &&
|
|
18
34
|
fs.existsSync(cjsPath) &&
|
|
19
35
|
fs.readFileSync(cjsPath, 'utf-8') === cjsExports
|
|
20
|
-
|
|
36
|
+
|
|
37
|
+
if (!alreadyPatchedImports) {
|
|
21
38
|
console.log(' | patch ' + path.relative(rootDir, modulePath))
|
|
22
|
-
console.log(' | patch ' + path.relative(rootDir, cjsPath))
|
|
23
39
|
fs.writeFileSync(modulePath, moduleExports)
|
|
40
|
+
console.log(' | patch ' + path.relative(rootDir, cjsPath))
|
|
24
41
|
fs.writeFileSync(cjsPath, cjsExports)
|
|
25
42
|
}
|
|
26
43
|
|
|
27
|
-
// patch
|
|
28
|
-
const
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
}
|
|
42
|
-
if (dataSet != null) {`,
|
|
43
|
-
},
|
|
44
|
-
{
|
|
45
|
-
id: 'forward-props',
|
|
46
|
-
filePath: ['modules', 'forwardedProps', 'index.js'],
|
|
47
|
-
replacee: `dataSet: true,`,
|
|
48
|
-
replacer: `id: true, dataSet: true,`,
|
|
49
|
-
},
|
|
50
|
-
]
|
|
44
|
+
// patch createDOMProps
|
|
45
|
+
const dpFile = path.join(rootDir, 'dist', 'modules', 'createDOMProps', 'index.js')
|
|
46
|
+
const dpPatched = fs.readFileSync(
|
|
47
|
+
path.join(__dirname, '..', '..', 'patches', '18', 'createDOMProps.js'),
|
|
48
|
+
'utf-8'
|
|
49
|
+
)
|
|
50
|
+
const dpFileCJS = path.join(rootDir, 'dist', 'cjs', 'modules', 'createDOMProps', 'index.js')
|
|
51
|
+
const dpCJSPatched = fs.readFileSync(
|
|
52
|
+
path.join(__dirname, '..', '..', 'patches', '18', 'createDOMProps.cjs.js'),
|
|
53
|
+
'utf-8'
|
|
54
|
+
)
|
|
55
|
+
const alreadyPatchedDOMProps =
|
|
56
|
+
fs.readFileSync(dpFile, 'utf-8') === dpPatched &&
|
|
57
|
+
fs.readFileSync(dpFileCJS, 'utf-8') === dpCJSPatched
|
|
51
58
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
path.
|
|
56
|
-
|
|
57
|
-
for (const file of files) {
|
|
58
|
-
const contents = fs.readFileSync(file, 'utf-8')
|
|
59
|
-
if (contents.includes(replacer)) {
|
|
60
|
-
continue
|
|
61
|
-
}
|
|
62
|
-
if (!contents.includes(replacee)) {
|
|
63
|
-
console.warn(
|
|
64
|
-
`⚠️ Error: couldn't apply className patch! Maybe using incompatible react-native-web version.`,
|
|
65
|
-
{
|
|
66
|
-
replacee,
|
|
67
|
-
contents,
|
|
68
|
-
}
|
|
69
|
-
)
|
|
70
|
-
continue
|
|
71
|
-
}
|
|
72
|
-
console.log(' | patch ' + path.relative(rootDir, file))
|
|
73
|
-
fs.writeFileSync(file, contents.replace(replacee, replacer))
|
|
74
|
-
}
|
|
59
|
+
if (!alreadyPatchedDOMProps) {
|
|
60
|
+
console.log(' | patch ' + path.relative(rootDir, dpFile))
|
|
61
|
+
fs.writeFileSync(dpFile, dpPatched)
|
|
62
|
+
console.log(' | patch ' + path.relative(rootDir, dpFileCJS))
|
|
63
|
+
fs.writeFileSync(dpFileCJS, dpCJSPatched)
|
|
75
64
|
}
|
|
76
65
|
|
|
77
|
-
//
|
|
66
|
+
// export tamagui exports from root
|
|
78
67
|
const moduleEntry = path.join(rootDir, 'dist', 'index.js')
|
|
79
68
|
const moduleEntrySrc = fs.readFileSync(moduleEntry, 'utf-8')
|
|
80
|
-
if (!moduleEntrySrc.includes(
|
|
69
|
+
if (!moduleEntrySrc.includes(PATCH_COMMENT)) {
|
|
81
70
|
fs.writeFileSync(
|
|
82
71
|
moduleEntry,
|
|
83
72
|
`${removePatch(moduleEntrySrc)}
|
|
84
73
|
|
|
85
|
-
|
|
74
|
+
${PATCH_COMMENT}
|
|
86
75
|
import * as TExports from './tamagui-exports'
|
|
87
76
|
export const TamaguiExports = TExports
|
|
88
|
-
|
|
77
|
+
${PATCH_END_COMMENT}
|
|
89
78
|
`
|
|
90
79
|
)
|
|
91
80
|
}
|
|
92
81
|
const cjsEntry = path.join(rootDir, 'dist', 'cjs', 'index.js')
|
|
93
82
|
const cjsEntrySrc = fs.readFileSync(cjsEntry, 'utf-8')
|
|
94
|
-
if (!cjsEntrySrc.includes(
|
|
83
|
+
if (!cjsEntrySrc.includes(PATCH_COMMENT)) {
|
|
95
84
|
fs.writeFileSync(
|
|
96
85
|
cjsEntry,
|
|
97
86
|
`${removePatch(cjsEntrySrc)}
|
|
98
87
|
|
|
99
|
-
|
|
100
|
-
exports.TamaguiExports =
|
|
101
|
-
|
|
88
|
+
${PATCH_COMMENT}
|
|
89
|
+
exports.TamaguiExports = require("./tamagui-exports");
|
|
90
|
+
${PATCH_END_COMMENT}
|
|
102
91
|
`
|
|
103
92
|
)
|
|
104
93
|
}
|
|
@@ -108,58 +97,20 @@ function removePatch(source: string) {
|
|
|
108
97
|
return source.replace(/\/\/ tamagui-patch([.\s\S]*)/g, '')
|
|
109
98
|
}
|
|
110
99
|
|
|
111
|
-
// view exports/View.ts
|
|
112
|
-
const forwardedPropsObj = `{
|
|
113
|
-
...fwdProps.defaultProps,
|
|
114
|
-
...fwdProps.accessibilityProps,
|
|
115
|
-
...fwdProps.clickProps,
|
|
116
|
-
...fwdProps.focusProps,
|
|
117
|
-
...fwdProps.keyboardProps,
|
|
118
|
-
...fwdProps.mouseProps,
|
|
119
|
-
...fwdProps.touchProps,
|
|
120
|
-
...fwdProps.styleProps,
|
|
121
|
-
href: true,
|
|
122
|
-
lang: true,
|
|
123
|
-
onScroll: true,
|
|
124
|
-
onWheel: true,
|
|
125
|
-
pointerEvents: true
|
|
126
|
-
}
|
|
127
|
-
`
|
|
128
|
-
|
|
129
100
|
const moduleExports = `
|
|
130
|
-
export { atomic } from './exports/StyleSheet/compile'
|
|
131
|
-
export { default as createCompileableStyle } from './exports/StyleSheet/createCompileableStyle'
|
|
132
|
-
export { default as createReactDOMStyle } from './exports/StyleSheet/createReactDOMStyle'
|
|
133
|
-
export { default as i18Style } from './exports/StyleSheet/i18nStyle'
|
|
134
101
|
export { default as createDOMProps } from './modules/createDOMProps'
|
|
135
|
-
export { default as AccessibilityUtil } from './modules/AccessibilityUtil'
|
|
136
|
-
export { default as createElement } from './exports/createElement'
|
|
137
|
-
export { default as css } from './exports/StyleSheet/css'
|
|
138
102
|
export { default as TextAncestorContext } from './exports/Text/TextAncestorContext'
|
|
139
|
-
export { default as pick } from './modules/pick'
|
|
140
103
|
export { default as useElementLayout } from './modules/useElementLayout'
|
|
141
104
|
export { default as useMergeRefs } from './modules/useMergeRefs'
|
|
142
105
|
export { default as usePlatformMethods } from './modules/usePlatformMethods'
|
|
143
106
|
export { default as useResponderEvents } from './modules/useResponderEvents'
|
|
144
|
-
import * as fwdProps from './modules/forwardedProps'
|
|
145
|
-
export const forwardedProps = ${forwardedPropsObj}
|
|
146
107
|
`
|
|
147
108
|
|
|
148
109
|
const cjsExports = `
|
|
149
|
-
exports.atomic = require('./exports/StyleSheet/compile').atomic
|
|
150
|
-
exports.createCompileableStyle = require('./exports/StyleSheet/createCompileableStyle')
|
|
151
|
-
exports.createReactDOMStyle = require('./exports/StyleSheet/createReactDOMStyle')
|
|
152
|
-
exports.i18Style = require('./exports/StyleSheet/i18nStyle')
|
|
153
110
|
exports.createDOMProps = require('./modules/createDOMProps')
|
|
154
|
-
exports.AccessibilityUtil = require('./modules/AccessibilityUtil')
|
|
155
|
-
exports.createElement = require('./exports/createElement')
|
|
156
|
-
exports.css = require('./exports/StyleSheet/css')
|
|
157
111
|
exports.TextAncestorContext = require('./exports/Text/TextAncestorContext')
|
|
158
|
-
exports.pick = require('./modules/pick')
|
|
159
112
|
exports.useElementLayout = require('./modules/useElementLayout')
|
|
160
113
|
exports.useMergeRefs = require('./modules/useMergeRefs')
|
|
161
114
|
exports.usePlatformMethods = require('./modules/usePlatformMethods')
|
|
162
115
|
exports.useResponderEvents = require('./modules/useResponderEvents')
|
|
163
|
-
const fwdProps = require('./modules/forwardedProps')
|
|
164
|
-
exports.forwardedProps = ${forwardedPropsObj}
|
|
165
116
|
`
|
package/src/types.ts
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
import { NodePath } from '@babel/traverse'
|
|
2
2
|
import * as t from '@babel/types'
|
|
3
3
|
import { PseudoStyles } from '@tamagui/core-node'
|
|
4
|
+
import { StyleObject } from '@tamagui/core-node'
|
|
4
5
|
import { ViewStyle } from 'react-native'
|
|
5
6
|
|
|
7
|
+
export type { StyleObject } from '@tamagui/helpers'
|
|
8
|
+
|
|
6
9
|
export type ClassNameObject = t.StringLiteral | t.Expression
|
|
7
10
|
|
|
8
11
|
export interface CacheObject {
|
|
@@ -69,6 +72,9 @@ export type ExtractorParseProps = TamaguiOptions & {
|
|
|
69
72
|
shouldPrintDebug?: boolean | 'verbose'
|
|
70
73
|
onExtractTag: (props: ExtractTagProps) => void
|
|
71
74
|
getFlattenedNode: (props: { isTextView: boolean; tag: string }) => string
|
|
75
|
+
extractStyledDefinitions?: boolean
|
|
76
|
+
// identifer, rule
|
|
77
|
+
onStyleRule?: (identifier: string, rules: string[]) => void
|
|
72
78
|
}
|
|
73
79
|
|
|
74
80
|
export interface Ternary {
|
|
@@ -80,14 +86,6 @@ export interface Ternary {
|
|
|
80
86
|
alternate: Object | null
|
|
81
87
|
}
|
|
82
88
|
|
|
83
|
-
export type StyleObject = {
|
|
84
|
-
property: string
|
|
85
|
-
value: string
|
|
86
|
-
className: string
|
|
87
|
-
identifier: string
|
|
88
|
-
rules: string[]
|
|
89
|
-
}
|
|
90
|
-
|
|
91
89
|
export type ClassNameToStyleObj = {
|
|
92
90
|
[key: string]: StyleObject
|
|
93
91
|
}
|
|
@@ -5,7 +5,7 @@ export declare function createEvaluator({ tamaguiConfig, staticNamespace, source
|
|
|
5
5
|
tamaguiConfig: TamaguiConfig;
|
|
6
6
|
staticNamespace: Record<string, any>;
|
|
7
7
|
sourcePath: string;
|
|
8
|
-
traversePath
|
|
8
|
+
traversePath?: NodePath<t.JSXElement>;
|
|
9
9
|
shouldPrintDebug: boolean | 'verbose';
|
|
10
10
|
}): (n: t.Node) => any;
|
|
11
11
|
export declare function createSafeEvaluator(attemptEval: (n: t.Node) => any): (n: t.Node) => any;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createEvaluator.d.ts","sourceRoot":"","sources":["../../src/extractor/createEvaluator.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAA;AAC1C,OAAO,KAAK,CAAC,MAAM,cAAc,CAAA;AACjC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAA;AAQlD,wBAAgB,eAAe,CAAC,EAC9B,aAAa,EACb,eAAe,EACf,UAAU,EACV,YAAY,EACZ,gBAAgB,GACjB,EAAE;IACD,aAAa,EAAE,aAAa,CAAA;IAC5B,eAAe,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;IACpC,UAAU,EAAE,MAAM,CAAA;IAClB,YAAY,EAAE,QAAQ,CAAC,CAAC,CAAC,UAAU,CAAC,CAAA;
|
|
1
|
+
{"version":3,"file":"createEvaluator.d.ts","sourceRoot":"","sources":["../../src/extractor/createEvaluator.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAA;AAC1C,OAAO,KAAK,CAAC,MAAM,cAAc,CAAA;AACjC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAA;AAQlD,wBAAgB,eAAe,CAAC,EAC9B,aAAa,EACb,eAAe,EACf,UAAU,EACV,YAAY,EACZ,gBAAgB,GACjB,EAAE;IACD,aAAa,EAAE,aAAa,CAAA;IAC5B,eAAe,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;IACpC,UAAU,EAAE,MAAM,CAAA;IAClB,YAAY,CAAC,EAAE,QAAQ,CAAC,CAAC,CAAC,UAAU,CAAC,CAAA;IACrC,gBAAgB,EAAE,OAAO,GAAG,SAAS,CAAA;CACtC,OAoCY,MAAM,SAGlB;AAED,wBAAgB,mBAAmB,CAAC,WAAW,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,IAAI,KAAK,GAAG,OACtD,MAAM,SAOlB"}
|
|
@@ -17,7 +17,8 @@ export declare function createExtractor(): {
|
|
|
17
17
|
[key: string]: any;
|
|
18
18
|
};
|
|
19
19
|
}, import("@tamagui/core-node").GenericFonts>;
|
|
20
|
-
parse: (fileOrPath: NodePath<t.Program> | t.File, { config, importsWhitelist, evaluateVars, shouldPrintDebug, sourcePath, onExtractTag, getFlattenedNode, disable, disableExtraction, disableExtractInlineMedia, disableExtractVariables, disableDebugAttr, prefixLogs, excludeProps, target, ...props }: ExtractorParseProps) => {
|
|
20
|
+
parse: (fileOrPath: NodePath<t.Program> | t.File, { config, importsWhitelist, evaluateVars, shouldPrintDebug, sourcePath, onExtractTag, onStyleRule, getFlattenedNode, disable, disableExtraction, disableExtractInlineMedia, disableExtractVariables, disableDebugAttr, extractStyledDefinitions, prefixLogs, excludeProps, target, ...props }: ExtractorParseProps) => {
|
|
21
|
+
styled: number;
|
|
21
22
|
flattened: number;
|
|
22
23
|
optimized: number;
|
|
23
24
|
modified: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createExtractor.d.ts","sourceRoot":"","sources":["../../src/extractor/createExtractor.ts"],"names":[],"mappings":"AAEA,OAAiB,EAAE,QAAQ,EAAW,MAAM,iBAAiB,CAAA;AAC7D,OAAO,KAAK,CAAC,MAAM,cAAc,CAAA;AACjC,OAAO,EAGL,qBAAqB,
|
|
1
|
+
{"version":3,"file":"createExtractor.d.ts","sourceRoot":"","sources":["../../src/extractor/createExtractor.ts"],"names":[],"mappings":"AAEA,OAAiB,EAAE,QAAQ,EAAW,MAAM,iBAAiB,CAAA;AAC7D,OAAO,KAAK,CAAC,MAAM,cAAc,CAAA;AACjC,OAAO,EAGL,qBAAqB,EAUtB,MAAM,oBAAoB,CAAA;AAK3B,OAAO,EAIL,mBAAmB,EAEpB,MAAM,UAAU,CAAA;AAqCjB,oBAAY,SAAS,GAAG,UAAU,CAAC,OAAO,eAAe,CAAC,CAAA;AAI1D,wBAAgB,eAAe;;;;;;;;;;;;;;wBAkCb,SAAS,EAAE,OAAO,CAAC,GAAG,MAAM,iSAoBrC,mBAAmB;;;;;;;EAswD3B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"extractToClassNames.d.ts","sourceRoot":"","sources":["../../src/extractor/extractToClassNames.ts"],"names":[],"mappings":";AAKA,OAAO,KAAK,CAAC,MAAM,cAAc,CAAA;AAKjC,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA;AAGvC,OAAO,EAAgC,cAAc,EAAW,MAAM,UAAU,CAAA;AAGhF,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAA;AAiB7C,oBAAY,iBAAiB,GAAG;IAC9B,EAAE,EAAE,MAAM,GAAG,MAAM,CAAA;IACnB,MAAM,EAAE,MAAM,CAAA;IACd,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,GAAG,EAAE,CAAC,CAAC,IAAI,CAAA;IACX,GAAG,EAAE,GAAG,CAAA;CACT,CAAA;AAED,wBAAgB,mBAAmB,CAAC,EAClC,MAAM,EACN,SAAS,EACT,MAAM,EACN,UAAU,EACV,OAAO,EACP,gBAAgB,EAChB,aAAa,EACb,QAAQ,EACR,OAAO,GACR,EAAE;IACD,MAAM,EAAE,aAAa,CAAC,GAAG,CAAC,CAAA;IAC1B,aAAa,EAAE,MAAM,CAAA;IACrB,SAAS,EAAE,SAAS,CAAA;IACpB,MAAM,EAAE,MAAM,GAAG,MAAM,CAAA;IACvB,UAAU,EAAE,MAAM,CAAA;IAClB,OAAO,EAAE,cAAc,CAAA;IACvB,gBAAgB,EAAE,OAAO,GAAG,SAAS,CAAA;IACrC,OAAO,EAAE,MAAM,CAAA;IACf,QAAQ,CAAC,EAAE,OAAO,CAAA;CACnB,GAAG,iBAAiB,GAAG,IAAI,
|
|
1
|
+
{"version":3,"file":"extractToClassNames.d.ts","sourceRoot":"","sources":["../../src/extractor/extractToClassNames.ts"],"names":[],"mappings":";AAKA,OAAO,KAAK,CAAC,MAAM,cAAc,CAAA;AAKjC,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA;AAGvC,OAAO,EAAgC,cAAc,EAAW,MAAM,UAAU,CAAA;AAGhF,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAA;AAiB7C,oBAAY,iBAAiB,GAAG;IAC9B,EAAE,EAAE,MAAM,GAAG,MAAM,CAAA;IACnB,MAAM,EAAE,MAAM,CAAA;IACd,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,GAAG,EAAE,CAAC,CAAC,IAAI,CAAA;IACX,GAAG,EAAE,GAAG,CAAA;CACT,CAAA;AAED,wBAAgB,mBAAmB,CAAC,EAClC,MAAM,EACN,SAAS,EACT,MAAM,EACN,UAAU,EACV,OAAO,EACP,gBAAgB,EAChB,aAAa,EACb,QAAQ,EACR,OAAO,GACR,EAAE;IACD,MAAM,EAAE,aAAa,CAAC,GAAG,CAAC,CAAA;IAC1B,aAAa,EAAE,MAAM,CAAA;IACrB,SAAS,EAAE,SAAS,CAAA;IACpB,MAAM,EAAE,MAAM,GAAG,MAAM,CAAA;IACvB,UAAU,EAAE,MAAM,CAAA;IAClB,OAAO,EAAE,cAAc,CAAA;IACvB,gBAAgB,EAAE,OAAO,GAAG,SAAS,CAAA;IACrC,OAAO,EAAE,MAAM,CAAA;IACf,QAAQ,CAAC,EAAE,OAAO,CAAA;CACnB,GAAG,iBAAiB,GAAG,IAAI,CAiW3B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"patchReactNativeWeb.d.ts","sourceRoot":"","sources":["../src/patchReactNativeWeb.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"patchReactNativeWeb.d.ts","sourceRoot":"","sources":["../src/patchReactNativeWeb.ts"],"names":[],"mappings":"AAeA,wBAAgB,mBAAmB,CAAC,GAAG,GAAE,MAA4C,QA8EpF"}
|
package/types/types.d.ts
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { NodePath } from '@babel/traverse';
|
|
2
2
|
import * as t from '@babel/types';
|
|
3
3
|
import { PseudoStyles } from '@tamagui/core-node';
|
|
4
|
+
import { StyleObject } from '@tamagui/core-node';
|
|
4
5
|
import { ViewStyle } from 'react-native';
|
|
6
|
+
export type { StyleObject } from '@tamagui/helpers';
|
|
5
7
|
export declare type ClassNameObject = t.StringLiteral | t.Expression;
|
|
6
8
|
export interface CacheObject {
|
|
7
9
|
[key: string]: any;
|
|
@@ -60,6 +62,8 @@ export declare type ExtractorParseProps = TamaguiOptions & {
|
|
|
60
62
|
isTextView: boolean;
|
|
61
63
|
tag: string;
|
|
62
64
|
}) => string;
|
|
65
|
+
extractStyledDefinitions?: boolean;
|
|
66
|
+
onStyleRule?: (identifier: string, rules: string[]) => void;
|
|
63
67
|
};
|
|
64
68
|
export interface Ternary {
|
|
65
69
|
test: t.Expression;
|
|
@@ -68,13 +72,6 @@ export interface Ternary {
|
|
|
68
72
|
consequent: Object | null;
|
|
69
73
|
alternate: Object | null;
|
|
70
74
|
}
|
|
71
|
-
export declare type StyleObject = {
|
|
72
|
-
property: string;
|
|
73
|
-
value: string;
|
|
74
|
-
className: string;
|
|
75
|
-
identifier: string;
|
|
76
|
-
rules: string[];
|
|
77
|
-
};
|
|
78
75
|
export declare type ClassNameToStyleObj = {
|
|
79
76
|
[key: string]: StyleObject;
|
|
80
77
|
};
|
package/types/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAA;AAC1C,OAAO,KAAK,CAAC,MAAM,cAAc,CAAA;AACjC,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AACjD,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AAExC,oBAAY,eAAe,GAAG,CAAC,CAAC,aAAa,GAAG,CAAC,CAAC,UAAU,CAAA;AAE5D,MAAM,WAAW,WAAW;IAC1B,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;CACnB;AAED,MAAM,WAAW,cAAc;IAE7B,UAAU,EAAE,MAAM,EAAE,CAAA;IAEpB,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,YAAY,CAAC,EAAE,OAAO,CAAA;IACtB,gBAAgB,CAAC,EAAE,MAAM,EAAE,CAAA;IAC3B,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,iBAAiB,CAAC,EAAE,OAAO,CAAA;IAC3B,gBAAgB,CAAC,EAAE,OAAO,CAAA;IAC1B,yBAAyB,CAAC,EAAE,OAAO,CAAA;IACnC,uBAAuB,CAAC,EAAE,OAAO,CAAA;IACjC,4BAA4B,CAAC,EAAE,MAAM,EAAE,CAAA;IACvC,OAAO,CAAC,EAAE,MA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