@tamagui/static 1.0.0-alpha.45 → 1.0.0-alpha.49

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.
Files changed (128) hide show
  1. package/dist/cjs/constants.js +0 -0
  2. package/dist/cjs/constants.js.map +0 -0
  3. package/dist/cjs/extractor/accessSafe.js +0 -0
  4. package/dist/cjs/extractor/accessSafe.js.map +0 -0
  5. package/dist/cjs/extractor/babelParse.js +0 -0
  6. package/dist/cjs/extractor/babelParse.js.map +0 -0
  7. package/dist/cjs/extractor/buildClassName.js +0 -0
  8. package/dist/cjs/extractor/buildClassName.js.map +0 -0
  9. package/dist/cjs/extractor/createEvaluator.js +0 -0
  10. package/dist/cjs/extractor/createEvaluator.js.map +0 -0
  11. package/dist/cjs/extractor/createExtractor.js +4 -3
  12. package/dist/cjs/extractor/createExtractor.js.map +2 -2
  13. package/dist/cjs/extractor/ensureImportingConcat.js +0 -0
  14. package/dist/cjs/extractor/ensureImportingConcat.js.map +0 -0
  15. package/dist/cjs/extractor/evaluateAstNode.js +0 -0
  16. package/dist/cjs/extractor/evaluateAstNode.js.map +0 -0
  17. package/dist/cjs/extractor/extractHelpers.js +0 -0
  18. package/dist/cjs/extractor/extractHelpers.js.map +0 -0
  19. package/dist/cjs/extractor/extractMediaStyle.js +0 -0
  20. package/dist/cjs/extractor/extractMediaStyle.js.map +0 -0
  21. package/dist/cjs/extractor/extractToClassNames.js +11 -6
  22. package/dist/cjs/extractor/extractToClassNames.js.map +2 -2
  23. package/dist/cjs/extractor/findTopmostFunction.js +0 -0
  24. package/dist/cjs/extractor/findTopmostFunction.js.map +0 -0
  25. package/dist/cjs/extractor/generatedUid.js +0 -0
  26. package/dist/cjs/extractor/generatedUid.js.map +0 -0
  27. package/dist/cjs/extractor/getPropValueFromAttributes.js +0 -0
  28. package/dist/cjs/extractor/getPropValueFromAttributes.js.map +0 -0
  29. package/dist/cjs/extractor/getSourceModule.js +0 -0
  30. package/dist/cjs/extractor/getSourceModule.js.map +0 -0
  31. package/dist/cjs/extractor/getStaticBindingsForScope.js +0 -0
  32. package/dist/cjs/extractor/getStaticBindingsForScope.js.map +0 -0
  33. package/dist/cjs/extractor/hoistClassNames.js +0 -0
  34. package/dist/cjs/extractor/hoistClassNames.js.map +0 -0
  35. package/dist/cjs/extractor/literalToAst.js +0 -0
  36. package/dist/cjs/extractor/literalToAst.js.map +0 -0
  37. package/dist/cjs/extractor/loadTamagui.js +1 -1
  38. package/dist/cjs/extractor/loadTamagui.js.map +1 -1
  39. package/dist/cjs/extractor/logLines.js +0 -0
  40. package/dist/cjs/extractor/logLines.js.map +0 -0
  41. package/dist/cjs/extractor/normalizeTernaries.js +0 -0
  42. package/dist/cjs/extractor/normalizeTernaries.js.map +0 -0
  43. package/dist/cjs/extractor/removeUnusedHooks.js +0 -0
  44. package/dist/cjs/extractor/removeUnusedHooks.js.map +0 -0
  45. package/dist/cjs/index.js +0 -0
  46. package/dist/cjs/index.js.map +0 -0
  47. package/dist/cjs/patchReactNativeWeb.js +2 -2
  48. package/dist/cjs/patchReactNativeWeb.js.map +2 -2
  49. package/dist/cjs/types.js +0 -0
  50. package/dist/cjs/types.js.map +0 -0
  51. package/dist/esm/constants.js +0 -0
  52. package/dist/esm/constants.js.map +0 -0
  53. package/dist/esm/extractor/accessSafe.js +0 -0
  54. package/dist/esm/extractor/accessSafe.js.map +0 -0
  55. package/dist/esm/extractor/babelParse.js +0 -0
  56. package/dist/esm/extractor/babelParse.js.map +0 -0
  57. package/dist/esm/extractor/buildClassName.js +0 -0
  58. package/dist/esm/extractor/buildClassName.js.map +0 -0
  59. package/dist/esm/extractor/createEvaluator.js +0 -0
  60. package/dist/esm/extractor/createEvaluator.js.map +0 -0
  61. package/dist/esm/extractor/createExtractor.js +4 -3
  62. package/dist/esm/extractor/createExtractor.js.map +2 -2
  63. package/dist/esm/extractor/ensureImportingConcat.js +0 -0
  64. package/dist/esm/extractor/ensureImportingConcat.js.map +0 -0
  65. package/dist/esm/extractor/evaluateAstNode.js +0 -0
  66. package/dist/esm/extractor/evaluateAstNode.js.map +0 -0
  67. package/dist/esm/extractor/extractHelpers.js +0 -0
  68. package/dist/esm/extractor/extractHelpers.js.map +0 -0
  69. package/dist/esm/extractor/extractMediaStyle.js +0 -0
  70. package/dist/esm/extractor/extractMediaStyle.js.map +0 -0
  71. package/dist/esm/extractor/extractToClassNames.js +11 -6
  72. package/dist/esm/extractor/extractToClassNames.js.map +2 -2
  73. package/dist/esm/extractor/findTopmostFunction.js +0 -0
  74. package/dist/esm/extractor/findTopmostFunction.js.map +0 -0
  75. package/dist/esm/extractor/generatedUid.js +0 -0
  76. package/dist/esm/extractor/generatedUid.js.map +0 -0
  77. package/dist/esm/extractor/getPropValueFromAttributes.js +0 -0
  78. package/dist/esm/extractor/getPropValueFromAttributes.js.map +0 -0
  79. package/dist/esm/extractor/getSourceModule.js +0 -0
  80. package/dist/esm/extractor/getSourceModule.js.map +0 -0
  81. package/dist/esm/extractor/getStaticBindingsForScope.js +0 -0
  82. package/dist/esm/extractor/getStaticBindingsForScope.js.map +0 -0
  83. package/dist/esm/extractor/hoistClassNames.js +0 -0
  84. package/dist/esm/extractor/hoistClassNames.js.map +0 -0
  85. package/dist/esm/extractor/literalToAst.js +0 -0
  86. package/dist/esm/extractor/literalToAst.js.map +0 -0
  87. package/dist/esm/extractor/loadTamagui.js +1 -1
  88. package/dist/esm/extractor/loadTamagui.js.map +1 -1
  89. package/dist/esm/extractor/logLines.js +0 -0
  90. package/dist/esm/extractor/logLines.js.map +0 -0
  91. package/dist/esm/extractor/normalizeTernaries.js +0 -0
  92. package/dist/esm/extractor/normalizeTernaries.js.map +0 -0
  93. package/dist/esm/extractor/removeUnusedHooks.js +0 -0
  94. package/dist/esm/extractor/removeUnusedHooks.js.map +0 -0
  95. package/dist/esm/index.js +0 -0
  96. package/dist/esm/index.js.map +0 -0
  97. package/dist/esm/patchReactNativeWeb.js +2 -2
  98. package/dist/esm/patchReactNativeWeb.js.map +2 -2
  99. package/dist/esm/types.js +0 -0
  100. package/dist/esm/types.js.map +0 -0
  101. package/dist/jsx/constants.js +0 -0
  102. package/dist/jsx/extractor/accessSafe.js +0 -0
  103. package/dist/jsx/extractor/babelParse.js +0 -0
  104. package/dist/jsx/extractor/buildClassName.js +0 -0
  105. package/dist/jsx/extractor/createEvaluator.js +0 -0
  106. package/dist/jsx/extractor/createExtractor.js +4 -3
  107. package/dist/jsx/extractor/ensureImportingConcat.js +0 -0
  108. package/dist/jsx/extractor/evaluateAstNode.js +0 -0
  109. package/dist/jsx/extractor/extractHelpers.js +0 -0
  110. package/dist/jsx/extractor/extractMediaStyle.js +0 -0
  111. package/dist/jsx/extractor/extractToClassNames.js +11 -6
  112. package/dist/jsx/extractor/findTopmostFunction.js +0 -0
  113. package/dist/jsx/extractor/generatedUid.js +0 -0
  114. package/dist/jsx/extractor/getPropValueFromAttributes.js +0 -0
  115. package/dist/jsx/extractor/getSourceModule.js +0 -0
  116. package/dist/jsx/extractor/getStaticBindingsForScope.js +0 -0
  117. package/dist/jsx/extractor/hoistClassNames.js +0 -0
  118. package/dist/jsx/extractor/literalToAst.js +0 -0
  119. package/dist/jsx/extractor/loadTamagui.js +1 -1
  120. package/dist/jsx/extractor/logLines.js +0 -0
  121. package/dist/jsx/extractor/normalizeTernaries.js +0 -0
  122. package/dist/jsx/extractor/removeUnusedHooks.js +0 -0
  123. package/dist/jsx/index.js +0 -0
  124. package/dist/jsx/patchReactNativeWeb.js +2 -2
  125. package/dist/jsx/types.js +0 -0
  126. package/package.json +10 -6
  127. package/types/extractor/createExtractor.d.ts.map +1 -1
  128. package/types/extractor/extractToClassNames.d.ts.map +1 -1
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/extractor/loadTamagui.ts"],
4
- "sourcesContent": ["import { join } from 'path'\n\nimport type { StaticComponent, TamaguiInternalConfig } from '@tamagui/core'\nimport { createTamagui } from '@tamagui/core-node'\n\nlet loadedTamagui: any = null\n\nexport function loadTamagui(props: { components: string[]; config: string }): {\n components: Record<string, StaticComponent>\n tamaguiConfig: TamaguiInternalConfig\n} {\n if (loadedTamagui) {\n return loadedTamagui\n }\n\n // lets shim require and avoid importing react-native + react-native-web\n // we just need to read the config around them\n process.env.IS_STATIC = 'is_static'\n const proxyWorm = require('@tamagui/fake-react-native')\n const Mod = require('module')\n const og = Mod.prototype.require\n Mod.prototype.require = function (path: string) {\n if (\n path.startsWith('react-native') &&\n // allow our rnw.tsx imports through\n !path.startsWith('react-native-web/dist/cjs/exports')\n ) {\n return proxyWorm\n }\n return og.apply(this, arguments)\n }\n\n // import config\n const configPath = join(process.cwd(), props.config)\n const tamaguiConfigExport = require(configPath)\n const tamaguiConfig = (tamaguiConfigExport['default'] ||\n tamaguiConfigExport) as TamaguiInternalConfig\n\n // import components\n const components = {}\n for (const module of props.components) {\n const exported = require(module)\n Object.assign(components, exported)\n }\n\n // undo shims\n process.env.IS_STATIC = undefined\n Mod.prototype.require = og\n\n // set up core-node\n createTamagui(tamaguiConfig)\n\n loadedTamagui = {\n components,\n tamaguiConfig,\n }\n\n return loadedTamagui\n}\n"],
4
+ "sourcesContent": ["import { join } from 'path'\n\nimport type { StaticComponent, TamaguiInternalConfig } from '@tamagui/core'\nimport { createTamagui } from '@tamagui/core-node'\n\nlet loadedTamagui: any = null\n\nexport function loadTamagui(props: { components: string[]; config: string }): {\n components: Record<string, StaticComponent>\n tamaguiConfig: TamaguiInternalConfig\n} {\n if (loadedTamagui) {\n return loadedTamagui\n }\n\n // lets shim require and avoid importing react-native + react-native-web\n // we just need to read the config around them\n process.env.IS_STATIC = 'is_static'\n const proxyWorm = require('react-native-web')\n const Mod = require('module')\n const og = Mod.prototype.require\n Mod.prototype.require = function (path: string) {\n if (\n path.startsWith('react-native') &&\n // allow our rnw.tsx imports through\n !path.startsWith('react-native-web/dist/cjs/exports')\n ) {\n return proxyWorm\n }\n return og.apply(this, arguments)\n }\n\n // import config\n const configPath = join(process.cwd(), props.config)\n const tamaguiConfigExport = require(configPath)\n const tamaguiConfig = (tamaguiConfigExport['default'] ||\n tamaguiConfigExport) as TamaguiInternalConfig\n\n // import components\n const components = {}\n for (const module of props.components) {\n const exported = require(module)\n Object.assign(components, exported)\n }\n\n // undo shims\n process.env.IS_STATIC = undefined\n Mod.prototype.require = og\n\n // set up core-node\n createTamagui(tamaguiConfig)\n\n loadedTamagui = {\n components,\n tamaguiConfig,\n }\n\n return loadedTamagui\n}\n"],
5
5
  "mappings": ";;AAAA;AAGA;AAEA,IAAI,gBAAqB;AAElB,qBAAqB,OAG1B;AACA,MAAI,eAAe;AACjB,WAAO;AAAA;AAKT,UAAQ,IAAI,YAAY;AACxB,QAAM,YAAY,QAAQ;AAC1B,QAAM,MAAM,QAAQ;AACpB,QAAM,KAAK,IAAI,UAAU;AACzB,MAAI,UAAU,UAAU,SAAU,MAAc;AAC9C,QACE,KAAK,WAAW,mBAEhB,CAAC,KAAK,WAAW,sCACjB;AACA,aAAO;AAAA;AAET,WAAO,GAAG,MAAM,MAAM;AAAA;AAIxB,QAAM,aAAa,KAAK,QAAQ,OAAO,MAAM;AAC7C,QAAM,sBAAsB,QAAQ;AACpC,QAAM,gBAAiB,oBAAoB,cACzC;AAGF,QAAM,aAAa;AACnB,aAAW,UAAU,MAAM,YAAY;AACrC,UAAM,WAAW,QAAQ;AACzB,WAAO,OAAO,YAAY;AAAA;AAI5B,UAAQ,IAAI,YAAY;AACxB,MAAI,UAAU,UAAU;AAGxB,gBAAc;AAEd,kBAAgB;AAAA,IACd;AAAA,IACA;AAAA;AAGF,SAAO;AAAA;AAlDO;",
6
6
  "names": []
7
7
  }
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
package/dist/esm/index.js CHANGED
File without changes
File without changes
@@ -22,7 +22,7 @@ function patchReactNativeWeb() {
22
22
  fs.writeFileSync(modulePath, moduleExports);
23
23
  fs.writeFileSync(cjsPath, cjsExports);
24
24
  }
25
- const classNamePatch = `if (props.className) { domProps.className = className ? className + ' ' + props.className : props.className }`;
25
+ const classNamePatch = `if (props.dataSet && props.dataSet['__className']) { domProps.className = className ? className + ' ' + props.dataSet['__className'] : props.dataSet['__className']; delete props.dataSet['__className'] }`;
26
26
  const domPropsPath = ["modules", "createDOMProps", "index.js"];
27
27
  const domPropsModulePath = path.join(rootDir, "dist", ...domPropsPath);
28
28
  const domPropsCjsPath = path.join(rootDir, "dist", "cjs", ...domPropsPath);
@@ -37,7 +37,7 @@ function patchReactNativeWeb() {
37
37
  const before = contents.slice(0, patchLocation);
38
38
  const after = contents.slice(patchLocation);
39
39
  const patched = before + "\n" + classNamePatch + "\n" + after;
40
- console.log("Tamagui patch - adding className support to react-native-web", file);
40
+ console.log(" > adding className support to react-native-web", file);
41
41
  fs.writeFileSync(file, patched);
42
42
  }
43
43
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/patchReactNativeWeb.ts"],
4
- "sourcesContent": ["import * as fs from 'fs'\nimport path from 'path'\n\n// were patching react-native-web so we can use some internal methods\n// we do it this way because we need to rely on webpack or bundler config to determine cjs vs esm\n// so we can't just require it all directly\n// would be nice in the future to be able to eject from react-native-web entirely optionally\n\n// keep it sync\nexport function patchReactNativeWeb() {\n const rootDir = require.resolve('react-native-web').replace(/\\/dist.*/, '')\n const modulePath = path.join(rootDir, 'dist', 'tamagui-exports.js')\n const cjsPath = path.join(rootDir, 'dist', 'cjs', 'tamagui-exports.js')\n\n const isEqual = (() => {\n let res = false\n try {\n res =\n fs.readFileSync(modulePath, 'utf-8') === moduleExports &&\n fs.readFileSync(cjsPath, 'utf-8') == cjsExports\n } catch {\n res = false\n }\n return res\n })()\n\n if (!isEqual) {\n console.log('\uD83E\uDD5A Tamagui patching react-native-web to share atomic styling primitives')\n console.log(' > adding', modulePath)\n console.log(' > adding', cjsPath)\n fs.writeFileSync(modulePath, moduleExports)\n fs.writeFileSync(cjsPath, cjsExports)\n }\n\n // patch to allow className prop\n const classNamePatch = `if (props.className) { domProps.className = className ? className + ' ' + props.className : props.className }`\n const domPropsPath = ['modules', 'createDOMProps', 'index.js']\n const domPropsModulePath = path.join(rootDir, 'dist', ...domPropsPath)\n const domPropsCjsPath = path.join(rootDir, 'dist', 'cjs', ...domPropsPath)\n const patchClassName = (file: string) => {\n const contents = fs.readFileSync(file, 'utf-8')\n if (!contents.includes(classNamePatch)) {\n const needle = `domProps.className = className`\n const patchLocation = contents.indexOf(needle) + needle.length + 5\n // its far down the file\n if (patchLocation < 100) {\n console.warn(\n `\u26A0\uFE0F Couldn't apply className patch! Maybe using incompatible react-native-web version.`\n )\n } else {\n const before = contents.slice(0, patchLocation)\n const after = contents.slice(patchLocation)\n const patched = before + '\\n' + classNamePatch + '\\n' + after\n console.log('Tamagui patch - adding className support to react-native-web', file)\n fs.writeFileSync(file, patched)\n }\n }\n }\n patchClassName(domPropsModulePath)\n patchClassName(domPropsCjsPath)\n\n // if (props.className) {\n // domProps.className = className ? className + ' ' + props.className : props.className\n // }\n\n // if entry files not patched, patch them:\n const moduleEntry = path.join(rootDir, 'dist', 'index.js')\n const moduleEntrySrc = fs.readFileSync(moduleEntry, 'utf-8')\n if (!moduleEntrySrc.includes('// tamagui-patch-v4')) {\n fs.writeFileSync(\n moduleEntry,\n `${removePatch(moduleEntrySrc)}\n\n// tamagui-patch-v4\nimport * as TExports from './tamagui-exports'\nexport const TamaguiExports = TExports\n// tamagui-patch-end\n`\n )\n }\n const cjsEntry = path.join(rootDir, 'dist', 'cjs', 'index.js')\n const cjsEntrySrc = fs.readFileSync(cjsEntry, 'utf-8')\n if (!cjsEntrySrc.includes('// tamagui-patch-v4')) {\n fs.writeFileSync(\n cjsEntry,\n `${removePatch(cjsEntrySrc)}\n\n// tamagui-patch-v4\nexports.TamaguiExports = _interopRequireDefault(require(\"./tamagui-exports\"));\n// tamagui-patch-end\n`\n )\n }\n}\n\nfunction removePatch(source: string) {\n return source.replace(/\\/\\/ tamagui-patch([.\\s\\S]*)/g, '')\n}\n\n// view exports/View.ts\nconst forwardedPropsObj = `{\n ...fwdProps.defaultProps,\n ...fwdProps.accessibilityProps,\n ...fwdProps.clickProps,\n ...fwdProps.focusProps,\n ...fwdProps.keyboardProps,\n ...fwdProps.mouseProps,\n ...fwdProps.touchProps,\n ...fwdProps.styleProps,\n href: true,\n lang: true,\n onScroll: true,\n onWheel: true,\n pointerEvents: true\n}\n`\n\nconst moduleExports = `\nexport { atomic } from './exports/StyleSheet/compile'\nexport { default as createCompileableStyle } from './exports/StyleSheet/createCompileableStyle'\nexport { default as createReactDOMStyle } from './exports/StyleSheet/createReactDOMStyle'\nexport { default as i18Style } from './exports/StyleSheet/i18nStyle'\nexport { default as createDOMProps } from './modules/createDOMProps'\nexport { default as AccessibilityUtil } from './modules/AccessibilityUtil'\nexport { default as createElement } from './exports/createElement'\nexport { default as css } from './exports/StyleSheet/css'\nexport { default as TextAncestorContext } from './exports/Text/TextAncestorContext'\nexport { default as pick } from './modules/pick'\nexport { default as useElementLayout } from './modules/useElementLayout'\nexport { default as useMergeRefs } from './modules/useMergeRefs'\nexport { default as usePlatformMethods } from './modules/usePlatformMethods'\nexport { default as useResponderEvents } from './modules/useResponderEvents'\nimport * as fwdProps from './modules/forwardedProps'\nexport const forwardedProps = ${forwardedPropsObj}\n`\n\nconst cjsExports = `\nexports.atomic = require('./exports/StyleSheet/compile').atomic\nexports.createCompileableStyle = require('./exports/StyleSheet/createCompileableStyle')\nexports.createReactDOMStyle = require('./exports/StyleSheet/createReactDOMStyle')\nexports.i18Style = require('./exports/StyleSheet/i18nStyle')\nexports.createDOMProps = require('./modules/createDOMProps')\nexports.AccessibilityUtil = require('./modules/AccessibilityUtil')\nexports.createElement = require('./exports/createElement')\nexports.css = require('./exports/StyleSheet/css')\nexports.TextAncestorContext = require('./exports/Text/TextAncestorContext')\nexports.pick = require('./modules/pick')\nexports.useElementLayout = require('./modules/useElementLayout')\nexports.useMergeRefs = require('./modules/useMergeRefs')\nexports.usePlatformMethods = require('./modules/usePlatformMethods')\nexports.useResponderEvents = require('./modules/useResponderEvents')\nconst fwdProps = require('./modules/forwardedProps')\nexports.forwardedProps = ${forwardedPropsObj}\n`\n"],
5
- "mappings": ";;AAAA;AACA;AAQO,+BAA+B;AACpC,QAAM,UAAU,AAAgB,oCAAoB,QAAQ,YAAY;AACxE,QAAM,aAAa,KAAK,KAAK,SAAS,QAAQ;AAC9C,QAAM,UAAU,KAAK,KAAK,SAAS,QAAQ,OAAO;AAElD,QAAM,UAAW,OAAM;AACrB,QAAI,MAAM;AACV,QAAI;AACF,YACE,GAAG,aAAa,YAAY,aAAa,iBACzC,GAAG,aAAa,SAAS,YAAY;AAAA,YACvC;AACA,YAAM;AAAA;AAER,WAAO;AAAA;AAGT,MAAI,CAAC,SAAS;AACZ,YAAQ,IAAI;AACZ,YAAQ,IAAI,eAAe;AAC3B,YAAQ,IAAI,eAAe;AAC3B,OAAG,cAAc,YAAY;AAC7B,OAAG,cAAc,SAAS;AAAA;AAI5B,QAAM,iBAAiB;AACvB,QAAM,eAAe,CAAC,WAAW,kBAAkB;AACnD,QAAM,qBAAqB,KAAK,KAAK,SAAS,QAAQ,GAAG;AACzD,QAAM,kBAAkB,KAAK,KAAK,SAAS,QAAQ,OAAO,GAAG;AAC7D,QAAM,iBAAiB,wBAAC,SAAiB;AACvC,UAAM,WAAW,GAAG,aAAa,MAAM;AACvC,QAAI,CAAC,SAAS,SAAS,iBAAiB;AACtC,YAAM,SAAS;AACf,YAAM,gBAAgB,SAAS,QAAQ,UAAU,OAAO,SAAS;AAEjE,UAAI,gBAAgB,KAAK;AACvB,gBAAQ,KACN;AAAA,aAEG;AACL,cAAM,SAAS,SAAS,MAAM,GAAG;AACjC,cAAM,QAAQ,SAAS,MAAM;AAC7B,cAAM,UAAU,SAAS,OAAO,iBAAiB,OAAO;AACxD,gBAAQ,IAAI,gEAAgE;AAC5E,WAAG,cAAc,MAAM;AAAA;AAAA;AAAA,KAfN;AAmBvB,iBAAe;AACf,iBAAe;AAOf,QAAM,cAAc,KAAK,KAAK,SAAS,QAAQ;AAC/C,QAAM,iBAAiB,GAAG,aAAa,aAAa;AACpD,MAAI,CAAC,eAAe,SAAS,wBAAwB;AACnD,OAAG,cACD,aACA,GAAG,YAAY;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AASnB,QAAM,WAAW,KAAK,KAAK,SAAS,QAAQ,OAAO;AACnD,QAAM,cAAc,GAAG,aAAa,UAAU;AAC9C,MAAI,CAAC,YAAY,SAAS,wBAAwB;AAChD,OAAG,cACD,UACA,GAAG,YAAY;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AA5EL;AAsFhB,qBAAqB,QAAgB;AACnC,SAAO,OAAO,QAAQ,iCAAiC;AAAA;AADhD;AAKT,MAAM,oBAAoB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAiB1B,MAAM,gBAAgB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,gCAgBU;AAAA;AAGhC,MAAM,aAAa;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,2BAgBQ;AAAA;",
4
+ "sourcesContent": ["import * as fs from 'fs'\nimport path from 'path'\n\n// were patching react-native-web so we can use some internal methods\n// we do it this way because we need to rely on webpack or bundler config to determine cjs vs esm\n// so we can't just require it all directly\n// would be nice in the future to be able to eject from react-native-web entirely optionally\n\n// keep it sync\nexport function patchReactNativeWeb() {\n const rootDir = require.resolve('react-native-web').replace(/\\/dist.*/, '')\n const modulePath = path.join(rootDir, 'dist', 'tamagui-exports.js')\n const cjsPath = path.join(rootDir, 'dist', 'cjs', 'tamagui-exports.js')\n\n const isEqual = (() => {\n let res = false\n try {\n res =\n fs.readFileSync(modulePath, 'utf-8') === moduleExports &&\n fs.readFileSync(cjsPath, 'utf-8') == cjsExports\n } catch {\n res = false\n }\n return res\n })()\n\n if (!isEqual) {\n console.log('\uD83E\uDD5A Tamagui patching react-native-web to share atomic styling primitives')\n console.log(' > adding', modulePath)\n console.log(' > adding', cjsPath)\n fs.writeFileSync(modulePath, moduleExports)\n fs.writeFileSync(cjsPath, cjsExports)\n }\n\n // patch to allow className prop\n const classNamePatch = `if (props.dataSet && props.dataSet['__className']) { domProps.className = className ? className + ' ' + props.dataSet['__className'] : props.dataSet['__className']; delete props.dataSet['__className'] }`\n const domPropsPath = ['modules', 'createDOMProps', 'index.js']\n const domPropsModulePath = path.join(rootDir, 'dist', ...domPropsPath)\n const domPropsCjsPath = path.join(rootDir, 'dist', 'cjs', ...domPropsPath)\n const patchClassName = (file: string) => {\n const contents = fs.readFileSync(file, 'utf-8')\n if (!contents.includes(classNamePatch)) {\n const needle = `domProps.className = className`\n const patchLocation = contents.indexOf(needle) + needle.length + 5\n // its far down the file\n if (patchLocation < 100) {\n console.warn(\n `\u26A0\uFE0F Couldn't apply className patch! Maybe using incompatible react-native-web version.`\n )\n } else {\n const before = contents.slice(0, patchLocation)\n const after = contents.slice(patchLocation)\n const patched = before + '\\n' + classNamePatch + '\\n' + after\n console.log(' > adding className support to react-native-web', file)\n fs.writeFileSync(file, patched)\n }\n }\n }\n patchClassName(domPropsModulePath)\n patchClassName(domPropsCjsPath)\n\n // if (props.className) {\n // domProps.className = className ? className + ' ' + props.className : props.className\n // }\n\n // if entry files not patched, patch them:\n const moduleEntry = path.join(rootDir, 'dist', 'index.js')\n const moduleEntrySrc = fs.readFileSync(moduleEntry, 'utf-8')\n if (!moduleEntrySrc.includes('// tamagui-patch-v4')) {\n fs.writeFileSync(\n moduleEntry,\n `${removePatch(moduleEntrySrc)}\n\n// tamagui-patch-v4\nimport * as TExports from './tamagui-exports'\nexport const TamaguiExports = TExports\n// tamagui-patch-end\n`\n )\n }\n const cjsEntry = path.join(rootDir, 'dist', 'cjs', 'index.js')\n const cjsEntrySrc = fs.readFileSync(cjsEntry, 'utf-8')\n if (!cjsEntrySrc.includes('// tamagui-patch-v4')) {\n fs.writeFileSync(\n cjsEntry,\n `${removePatch(cjsEntrySrc)}\n\n// tamagui-patch-v4\nexports.TamaguiExports = _interopRequireDefault(require(\"./tamagui-exports\"));\n// tamagui-patch-end\n`\n )\n }\n}\n\nfunction removePatch(source: string) {\n return source.replace(/\\/\\/ tamagui-patch([.\\s\\S]*)/g, '')\n}\n\n// view exports/View.ts\nconst forwardedPropsObj = `{\n ...fwdProps.defaultProps,\n ...fwdProps.accessibilityProps,\n ...fwdProps.clickProps,\n ...fwdProps.focusProps,\n ...fwdProps.keyboardProps,\n ...fwdProps.mouseProps,\n ...fwdProps.touchProps,\n ...fwdProps.styleProps,\n href: true,\n lang: true,\n onScroll: true,\n onWheel: true,\n pointerEvents: true\n}\n`\n\nconst moduleExports = `\nexport { atomic } from './exports/StyleSheet/compile'\nexport { default as createCompileableStyle } from './exports/StyleSheet/createCompileableStyle'\nexport { default as createReactDOMStyle } from './exports/StyleSheet/createReactDOMStyle'\nexport { default as i18Style } from './exports/StyleSheet/i18nStyle'\nexport { default as createDOMProps } from './modules/createDOMProps'\nexport { default as AccessibilityUtil } from './modules/AccessibilityUtil'\nexport { default as createElement } from './exports/createElement'\nexport { default as css } from './exports/StyleSheet/css'\nexport { default as TextAncestorContext } from './exports/Text/TextAncestorContext'\nexport { default as pick } from './modules/pick'\nexport { default as useElementLayout } from './modules/useElementLayout'\nexport { default as useMergeRefs } from './modules/useMergeRefs'\nexport { default as usePlatformMethods } from './modules/usePlatformMethods'\nexport { default as useResponderEvents } from './modules/useResponderEvents'\nimport * as fwdProps from './modules/forwardedProps'\nexport const forwardedProps = ${forwardedPropsObj}\n`\n\nconst cjsExports = `\nexports.atomic = require('./exports/StyleSheet/compile').atomic\nexports.createCompileableStyle = require('./exports/StyleSheet/createCompileableStyle')\nexports.createReactDOMStyle = require('./exports/StyleSheet/createReactDOMStyle')\nexports.i18Style = require('./exports/StyleSheet/i18nStyle')\nexports.createDOMProps = require('./modules/createDOMProps')\nexports.AccessibilityUtil = require('./modules/AccessibilityUtil')\nexports.createElement = require('./exports/createElement')\nexports.css = require('./exports/StyleSheet/css')\nexports.TextAncestorContext = require('./exports/Text/TextAncestorContext')\nexports.pick = require('./modules/pick')\nexports.useElementLayout = require('./modules/useElementLayout')\nexports.useMergeRefs = require('./modules/useMergeRefs')\nexports.usePlatformMethods = require('./modules/usePlatformMethods')\nexports.useResponderEvents = require('./modules/useResponderEvents')\nconst fwdProps = require('./modules/forwardedProps')\nexports.forwardedProps = ${forwardedPropsObj}\n`\n"],
5
+ "mappings": ";;AAAA;AACA;AAQO,+BAA+B;AACpC,QAAM,UAAU,AAAgB,oCAAoB,QAAQ,YAAY;AACxE,QAAM,aAAa,KAAK,KAAK,SAAS,QAAQ;AAC9C,QAAM,UAAU,KAAK,KAAK,SAAS,QAAQ,OAAO;AAElD,QAAM,UAAW,OAAM;AACrB,QAAI,MAAM;AACV,QAAI;AACF,YACE,GAAG,aAAa,YAAY,aAAa,iBACzC,GAAG,aAAa,SAAS,YAAY;AAAA,YACvC;AACA,YAAM;AAAA;AAER,WAAO;AAAA;AAGT,MAAI,CAAC,SAAS;AACZ,YAAQ,IAAI;AACZ,YAAQ,IAAI,eAAe;AAC3B,YAAQ,IAAI,eAAe;AAC3B,OAAG,cAAc,YAAY;AAC7B,OAAG,cAAc,SAAS;AAAA;AAI5B,QAAM,iBAAiB;AACvB,QAAM,eAAe,CAAC,WAAW,kBAAkB;AACnD,QAAM,qBAAqB,KAAK,KAAK,SAAS,QAAQ,GAAG;AACzD,QAAM,kBAAkB,KAAK,KAAK,SAAS,QAAQ,OAAO,GAAG;AAC7D,QAAM,iBAAiB,wBAAC,SAAiB;AACvC,UAAM,WAAW,GAAG,aAAa,MAAM;AACvC,QAAI,CAAC,SAAS,SAAS,iBAAiB;AACtC,YAAM,SAAS;AACf,YAAM,gBAAgB,SAAS,QAAQ,UAAU,OAAO,SAAS;AAEjE,UAAI,gBAAgB,KAAK;AACvB,gBAAQ,KACN;AAAA,aAEG;AACL,cAAM,SAAS,SAAS,MAAM,GAAG;AACjC,cAAM,QAAQ,SAAS,MAAM;AAC7B,cAAM,UAAU,SAAS,OAAO,iBAAiB,OAAO;AACxD,gBAAQ,IAAI,qDAAqD;AACjE,WAAG,cAAc,MAAM;AAAA;AAAA;AAAA,KAfN;AAmBvB,iBAAe;AACf,iBAAe;AAOf,QAAM,cAAc,KAAK,KAAK,SAAS,QAAQ;AAC/C,QAAM,iBAAiB,GAAG,aAAa,aAAa;AACpD,MAAI,CAAC,eAAe,SAAS,wBAAwB;AACnD,OAAG,cACD,aACA,GAAG,YAAY;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AASnB,QAAM,WAAW,KAAK,KAAK,SAAS,QAAQ,OAAO;AACnD,QAAM,cAAc,GAAG,aAAa,UAAU;AAC9C,MAAI,CAAC,YAAY,SAAS,wBAAwB;AAChD,OAAG,cACD,UACA,GAAG,YAAY;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AA5EL;AAsFhB,qBAAqB,QAAgB;AACnC,SAAO,OAAO,QAAQ,iCAAiC;AAAA;AADhD;AAKT,MAAM,oBAAoB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAiB1B,MAAM,gBAAgB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,gCAgBU;AAAA;AAGhC,MAAM,aAAa;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,2BAgBQ;AAAA;",
6
6
  "names": []
7
7
  }
package/dist/esm/types.js CHANGED
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -155,7 +155,6 @@ function createExtractor() {
155
155
  node.attributes.unshift(t.jsxAttribute(t.jsxIdentifier("data-is"), t.stringLiteral(` ${preName}${node.name.name} ${filePath.replace("./", "")}:${lineNumbers} `)));
156
156
  }
157
157
  if (disableExtraction) {
158
- console.log("disableExtraction", disableExtraction);
159
158
  if (!hasLogged) {
160
159
  console.log("\u{1F95A} Tamagui disableExtraction set: no CSS or optimizations will be run");
161
160
  hasLogged = true;
@@ -283,8 +282,10 @@ function createExtractor() {
283
282
  }
284
283
  return res2;
285
284
  } catch (err) {
286
- console.log("Error extracting attribute", err.message, err.stack);
287
- console.log("node", path.node);
285
+ if (shouldPrintDebug) {
286
+ console.log("Error extracting attribute", err.message, err.stack);
287
+ console.log("node", path.node);
288
+ }
288
289
  return {
289
290
  type: "attr",
290
291
  value: path.node
File without changes
File without changes
File without changes
File without changes
@@ -165,12 +165,17 @@ function extractToClassNames({
165
165
  const nameExpr = names ? hoistClassNames(jsxPath, existingHoists, names) : null;
166
166
  let expr = nameExpr;
167
167
  if (nameExpr && !t.isIdentifier(nameExpr)) {
168
- ensureImportingConcat(programPath);
169
- const simpleSpreads = attrs.filter((x) => t.isJSXSpreadAttribute(x.value) && isSimpleSpread(x.value));
170
- expr = t.callExpression(t.identifier(CONCAT_CLASSNAME_IMPORT), [
171
- expr,
172
- ...simpleSpreads.map((val) => val.value["argument"])
173
- ]);
168
+ if (!(res == null ? void 0 : res.flattened)) {
169
+ console.log("not flat");
170
+ } else {
171
+ console.log("flat");
172
+ ensureImportingConcat(programPath);
173
+ const simpleSpreads = attrs.filter((x) => t.isJSXSpreadAttribute(x.value) && isSimpleSpread(x.value));
174
+ expr = t.callExpression(t.identifier(CONCAT_CLASSNAME_IMPORT), [
175
+ expr,
176
+ ...simpleSpreads.map((val) => val.value["argument"])
177
+ ]);
178
+ }
174
179
  }
175
180
  node.attributes.push(t.jsxAttribute(t.jsxIdentifier("className"), t.jsxExpressionContainer(expr)));
176
181
  }
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -8,7 +8,7 @@ function loadTamagui(props) {
8
8
  return loadedTamagui;
9
9
  }
10
10
  process.env.IS_STATIC = "is_static";
11
- const proxyWorm = require("@tamagui/fake-react-native");
11
+ const proxyWorm = require("react-native-web");
12
12
  const Mod = require("module");
13
13
  const og = Mod.prototype.require;
14
14
  Mod.prototype.require = function(path) {
File without changes
File without changes
File without changes
package/dist/jsx/index.js CHANGED
File without changes
@@ -22,7 +22,7 @@ function patchReactNativeWeb() {
22
22
  fs.writeFileSync(modulePath, moduleExports);
23
23
  fs.writeFileSync(cjsPath, cjsExports);
24
24
  }
25
- const classNamePatch = `if (props.className) { domProps.className = className ? className + ' ' + props.className : props.className }`;
25
+ const classNamePatch = `if (props.dataSet && props.dataSet['__className']) { domProps.className = className ? className + ' ' + props.dataSet['__className'] : props.dataSet['__className']; delete props.dataSet['__className'] }`;
26
26
  const domPropsPath = ["modules", "createDOMProps", "index.js"];
27
27
  const domPropsModulePath = path.join(rootDir, "dist", ...domPropsPath);
28
28
  const domPropsCjsPath = path.join(rootDir, "dist", "cjs", ...domPropsPath);
@@ -37,7 +37,7 @@ function patchReactNativeWeb() {
37
37
  const before = contents.slice(0, patchLocation);
38
38
  const after = contents.slice(patchLocation);
39
39
  const patched = before + "\n" + classNamePatch + "\n" + after;
40
- console.log("Tamagui patch - adding className support to react-native-web", file);
40
+ console.log(" > adding className support to react-native-web", file);
41
41
  fs.writeFileSync(file, patched);
42
42
  }
43
43
  }
package/dist/jsx/types.js CHANGED
File without changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tamagui/static",
3
- "version": "1.0.0-alpha.45",
3
+ "version": "1.0.0-alpha.49",
4
4
  "source": "src/index.ts",
5
5
  "typings": "types",
6
6
  "main": "dist/cjs",
@@ -24,6 +24,10 @@
24
24
  "publishConfig": {
25
25
  "access": "public"
26
26
  },
27
+ "volta": {
28
+ "node": "16.13.2",
29
+ "yarn": "1.22.17"
30
+ },
27
31
  "license": "MIT",
28
32
  "devDependencies": {
29
33
  "@babel/plugin-syntax-typescript": "^7.14.5",
@@ -54,10 +58,10 @@
54
58
  "@dish/babel-preset": "^0.0.6",
55
59
  "@expo/match-media": "^0.1.0",
56
60
  "@tamagui/build": "^1.0.0-alpha.44",
57
- "@tamagui/core": "^1.0.0-alpha.45",
58
- "@tamagui/core-node": "^1.0.0-alpha.44",
61
+ "@tamagui/core": "^1.0.0-alpha.48",
62
+ "@tamagui/core-node": "^1.0.0-alpha.48",
59
63
  "@tamagui/fake-react-native": "^1.0.0-alpha.17",
60
- "@tamagui/helpers": "^1.0.0-alpha.44",
64
+ "@tamagui/helpers": "^1.0.0-alpha.48",
61
65
  "babel-literal-to-ast": "^2.1.0",
62
66
  "esbuild": "^0.13.12",
63
67
  "esbuild-register": "^3.1.2",
@@ -66,10 +70,10 @@
66
70
  "invariant": "^2.2.4",
67
71
  "loader-utils": "^2.0.0",
68
72
  "lodash": "^4.17.21",
69
- "tamagui": "^1.0.0-alpha.45"
73
+ "tamagui": "^1.0.0-alpha.49"
70
74
  },
71
75
  "peerDependencies": {
72
76
  "react-native-web": "*"
73
77
  },
74
- "gitHead": "b04707063cb83e42e438c0a528b830fac5292f3b"
78
+ "gitHead": "78288707c143087395f74c74dc95686e0a2bd938"
75
79
  }
@@ -1 +1 @@
1
- {"version":3,"file":"createExtractor.d.ts","sourceRoot":"","sources":["../../src/extractor/createExtractor.ts"],"names":[],"mappings":"AAAA,OAAiB,EAAE,QAAQ,EAAW,MAAM,iBAAiB,CAAA;AAC7D,OAAO,KAAK,CAAC,MAAM,cAAc,CAAA;AACjC,OAAO,KAAK,EAAsB,qBAAqB,EAAE,MAAM,eAAe,CAAA;AAM9E,OAAO,EAAoC,mBAAmB,EAAW,MAAM,UAAU,CAAA;AAyBzF,oBAAY,SAAS,GAAG,UAAU,CAAC,OAAO,eAAe,CAAC,CAAA;AAI1D,wBAAgB,eAAe;;;;;;;;;;;;;;;;;;;;;wBAsBb,SAAS,EAAE,OAAO,CAAC,GAAG,MAAM,+MAcrC,mBAAmB;;;;;EAwkC3B"}
1
+ {"version":3,"file":"createExtractor.d.ts","sourceRoot":"","sources":["../../src/extractor/createExtractor.ts"],"names":[],"mappings":"AAAA,OAAiB,EAAE,QAAQ,EAAW,MAAM,iBAAiB,CAAA;AAC7D,OAAO,KAAK,CAAC,MAAM,cAAc,CAAA;AACjC,OAAO,KAAK,EAAsB,qBAAqB,EAAE,MAAM,eAAe,CAAA;AAM9E,OAAO,EAAoC,mBAAmB,EAAW,MAAM,UAAU,CAAA;AAyBzF,oBAAY,SAAS,GAAG,UAAU,CAAC,OAAO,eAAe,CAAC,CAAA;AAI1D,wBAAgB,eAAe;;;;;;;;;;;;;;;;;;;;;wBAsBb,SAAS,EAAE,OAAO,CAAC,GAAG,MAAM,+MAcrC,mBAAmB;;;;;EAykC3B"}
@@ -1 +1 @@
1
- {"version":3,"file":"extractToClassNames.d.ts","sourceRoot":"","sources":["../../src/extractor/extractToClassNames.ts"],"names":[],"mappings":";AAKA,OAAO,KAAK,CAAC,MAAM,cAAc,CAAA;AAQjC,OAAO,EAAgC,cAAc,EAAE,MAAM,UAAU,CAAA;AAGvE,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAA;AAc7C,wBAAgB,mBAAmB,CAAC,EAClC,MAAM,EACN,SAAS,EACT,MAAM,EACN,UAAU,EACV,OAAO,EACP,gBAAgB,EAChB,QAAQ,EACR,OAAO,GACR,EAAE;IACD,MAAM,EAAE,GAAG,CAAA;IACX,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,CAAA;IACzB,OAAO,EAAE,MAAM,CAAA;IACf,QAAQ,CAAC,EAAE,OAAO,CAAA;CACnB,GAAG,IAAI,GAAG;IACT,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,CAmRA"}
1
+ {"version":3,"file":"extractToClassNames.d.ts","sourceRoot":"","sources":["../../src/extractor/extractToClassNames.ts"],"names":[],"mappings":";AAKA,OAAO,KAAK,CAAC,MAAM,cAAc,CAAA;AAQjC,OAAO,EAAgC,cAAc,EAAE,MAAM,UAAU,CAAA;AAGvE,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAA;AAc7C,wBAAgB,mBAAmB,CAAC,EAClC,MAAM,EACN,SAAS,EACT,MAAM,EACN,UAAU,EACV,OAAO,EACP,gBAAgB,EAChB,QAAQ,EACR,OAAO,GACR,EAAE;IACD,MAAM,EAAE,GAAG,CAAA;IACX,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,CAAA;IACzB,OAAO,EAAE,MAAM,CAAA;IACf,QAAQ,CAAC,EAAE,OAAO,CAAA;CACnB,GAAG,IAAI,GAAG;IACT,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,CAwRA"}