@tamagui/static 1.0.1-beta.70 → 1.0.1-beta.73
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/accessSafe.js +0 -2
- package/dist/cjs/extractor/accessSafe.js.map +1 -1
- package/dist/cjs/extractor/babelParse.js +0 -2
- package/dist/cjs/extractor/babelParse.js.map +1 -1
- package/dist/cjs/extractor/buildClassName.js +0 -2
- package/dist/cjs/extractor/buildClassName.js.map +1 -1
- package/dist/cjs/extractor/createEvaluator.js +2 -5
- package/dist/cjs/extractor/createEvaluator.js.map +1 -1
- package/dist/cjs/extractor/createExtractor.js +10 -21
- package/dist/cjs/extractor/createExtractor.js.map +1 -1
- package/dist/cjs/extractor/ensureImportingConcat.js +0 -2
- package/dist/cjs/extractor/ensureImportingConcat.js.map +1 -1
- package/dist/cjs/extractor/evaluateAstNode.js +0 -2
- package/dist/cjs/extractor/evaluateAstNode.js.map +1 -1
- package/dist/cjs/extractor/extractHelpers.js +11 -16
- package/dist/cjs/extractor/extractHelpers.js.map +1 -1
- package/dist/cjs/extractor/extractMediaStyle.js +2 -7
- package/dist/cjs/extractor/extractMediaStyle.js.map +1 -1
- package/dist/cjs/extractor/extractToClassNames.js +5 -18
- package/dist/cjs/extractor/extractToClassNames.js.map +2 -2
- package/dist/cjs/extractor/findTopmostFunction.js +1 -3
- package/dist/cjs/extractor/findTopmostFunction.js.map +1 -1
- package/dist/cjs/extractor/generatedUid.js +0 -2
- package/dist/cjs/extractor/generatedUid.js.map +1 -1
- package/dist/cjs/extractor/getPrefixLogs.js +0 -2
- package/dist/cjs/extractor/getPrefixLogs.js.map +1 -1
- package/dist/cjs/extractor/getPropValueFromAttributes.js +0 -2
- package/dist/cjs/extractor/getPropValueFromAttributes.js.map +1 -1
- package/dist/cjs/extractor/getSourceModule.js +0 -2
- package/dist/cjs/extractor/getSourceModule.js.map +1 -1
- package/dist/cjs/extractor/getStaticBindingsForScope.js +1 -5
- package/dist/cjs/extractor/getStaticBindingsForScope.js.map +1 -1
- package/dist/cjs/extractor/hoistClassNames.js +0 -3
- package/dist/cjs/extractor/hoistClassNames.js.map +1 -1
- package/dist/cjs/extractor/literalToAst.js +0 -4
- package/dist/cjs/extractor/literalToAst.js.map +1 -1
- package/dist/cjs/extractor/loadTamagui.js +0 -2
- package/dist/cjs/extractor/loadTamagui.js.map +1 -1
- package/dist/cjs/extractor/logLines.js +2 -3
- package/dist/cjs/extractor/logLines.js.map +1 -1
- package/dist/cjs/extractor/normalizeTernaries.js +0 -2
- package/dist/cjs/extractor/normalizeTernaries.js.map +1 -1
- package/dist/cjs/extractor/removeUnusedHooks.js +2 -4
- package/dist/cjs/extractor/removeUnusedHooks.js.map +1 -1
- package/dist/cjs/extractor/timer.js +2 -3
- package/dist/cjs/extractor/timer.js.map +1 -1
- package/dist/cjs/index.js +1 -1
- package/dist/cjs/index.js.map +2 -2
- package/dist/esm/extractor/accessSafe.js +0 -3
- package/dist/esm/extractor/accessSafe.js.map +1 -1
- package/dist/esm/extractor/babelParse.js +0 -3
- package/dist/esm/extractor/babelParse.js.map +1 -1
- package/dist/esm/extractor/buildClassName.js +0 -3
- package/dist/esm/extractor/buildClassName.js.map +1 -1
- package/dist/esm/extractor/createEvaluator.js +2 -6
- package/dist/esm/extractor/createEvaluator.js.map +1 -1
- package/dist/esm/extractor/createExtractor.js +10 -22
- package/dist/esm/extractor/createExtractor.js.map +1 -1
- package/dist/esm/extractor/ensureImportingConcat.js +0 -3
- package/dist/esm/extractor/ensureImportingConcat.js.map +1 -1
- package/dist/esm/extractor/evaluateAstNode.js +0 -3
- package/dist/esm/extractor/evaluateAstNode.js.map +1 -1
- package/dist/esm/extractor/extractHelpers.js +11 -17
- package/dist/esm/extractor/extractHelpers.js.map +1 -1
- package/dist/esm/extractor/extractMediaStyle.js +2 -8
- package/dist/esm/extractor/extractMediaStyle.js.map +1 -1
- package/dist/esm/extractor/extractToClassNames.js +5 -19
- package/dist/esm/extractor/extractToClassNames.js.map +2 -2
- package/dist/esm/extractor/findTopmostFunction.js +1 -4
- package/dist/esm/extractor/findTopmostFunction.js.map +1 -1
- package/dist/esm/extractor/generatedUid.js +0 -3
- package/dist/esm/extractor/generatedUid.js.map +1 -1
- package/dist/esm/extractor/getPrefixLogs.js +0 -3
- package/dist/esm/extractor/getPrefixLogs.js.map +1 -1
- package/dist/esm/extractor/getPropValueFromAttributes.js +0 -3
- package/dist/esm/extractor/getPropValueFromAttributes.js.map +1 -1
- package/dist/esm/extractor/getSourceModule.js +0 -3
- package/dist/esm/extractor/getSourceModule.js.map +1 -1
- package/dist/esm/extractor/getStaticBindingsForScope.js +1 -6
- package/dist/esm/extractor/getStaticBindingsForScope.js.map +1 -1
- package/dist/esm/extractor/hoistClassNames.js +0 -4
- package/dist/esm/extractor/hoistClassNames.js.map +1 -1
- package/dist/esm/extractor/literalToAst.js +0 -5
- package/dist/esm/extractor/literalToAst.js.map +1 -1
- package/dist/esm/extractor/loadTamagui.js +0 -3
- package/dist/esm/extractor/loadTamagui.js.map +1 -1
- package/dist/esm/extractor/logLines.js +2 -4
- package/dist/esm/extractor/logLines.js.map +1 -1
- package/dist/esm/extractor/normalizeTernaries.js +0 -3
- package/dist/esm/extractor/normalizeTernaries.js.map +1 -1
- package/dist/esm/extractor/removeUnusedHooks.js +2 -5
- package/dist/esm/extractor/removeUnusedHooks.js.map +1 -1
- package/dist/esm/extractor/timer.js +2 -4
- package/dist/esm/extractor/timer.js.map +1 -1
- package/dist/esm/index.js +1 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/jsx/extractor/accessSafe.js +0 -3
- package/dist/jsx/extractor/babelParse.js +0 -3
- package/dist/jsx/extractor/buildClassName.js +0 -3
- package/dist/jsx/extractor/createEvaluator.js +2 -6
- package/dist/jsx/extractor/createExtractor.js +10 -22
- package/dist/jsx/extractor/ensureImportingConcat.js +0 -3
- package/dist/jsx/extractor/evaluateAstNode.js +0 -3
- package/dist/jsx/extractor/extractHelpers.js +11 -17
- package/dist/jsx/extractor/extractMediaStyle.js +2 -8
- package/dist/jsx/extractor/extractToClassNames.js +5 -19
- package/dist/jsx/extractor/findTopmostFunction.js +1 -4
- package/dist/jsx/extractor/generatedUid.js +0 -3
- package/dist/jsx/extractor/getPrefixLogs.js +0 -3
- package/dist/jsx/extractor/getPropValueFromAttributes.js +0 -3
- package/dist/jsx/extractor/getSourceModule.js +0 -3
- package/dist/jsx/extractor/getStaticBindingsForScope.js +1 -6
- package/dist/jsx/extractor/hoistClassNames.js +0 -4
- package/dist/jsx/extractor/literalToAst.js +0 -5
- package/dist/jsx/extractor/loadTamagui.js +0 -3
- package/dist/jsx/extractor/logLines.js +2 -4
- package/dist/jsx/extractor/normalizeTernaries.js +0 -3
- package/dist/jsx/extractor/removeUnusedHooks.js +2 -5
- package/dist/jsx/extractor/timer.js +2 -4
- package/dist/jsx/index.js +1 -1
- package/package.json +10 -9
- package/src/extractor/extractToClassNames.ts +0 -19
- package/src/index.ts +1 -1
- package/types/constants.d.ts +0 -0
- package/types/constants.d.ts.map +0 -0
- package/types/extractor/accessSafe.d.ts +0 -0
- package/types/extractor/accessSafe.d.ts.map +0 -0
- package/types/extractor/babelParse.d.ts +0 -0
- package/types/extractor/babelParse.d.ts.map +0 -0
- package/types/extractor/buildClassName.d.ts +0 -0
- package/types/extractor/buildClassName.d.ts.map +0 -0
- package/types/extractor/createEvaluator.d.ts +0 -0
- package/types/extractor/createEvaluator.d.ts.map +0 -0
- package/types/extractor/createExtractor.d.ts +0 -0
- package/types/extractor/createExtractor.d.ts.map +0 -0
- package/types/extractor/ensureImportingConcat.d.ts +0 -0
- package/types/extractor/ensureImportingConcat.d.ts.map +0 -0
- package/types/extractor/evaluateAstNode.d.ts +0 -0
- package/types/extractor/evaluateAstNode.d.ts.map +0 -0
- package/types/extractor/extractHelpers.d.ts +0 -0
- package/types/extractor/extractHelpers.d.ts.map +0 -0
- package/types/extractor/extractMediaStyle.d.ts +0 -0
- package/types/extractor/extractMediaStyle.d.ts.map +0 -0
- package/types/extractor/extractToClassNames.d.ts +1 -6
- package/types/extractor/extractToClassNames.d.ts.map +1 -1
- package/types/extractor/findTopmostFunction.d.ts +0 -0
- package/types/extractor/findTopmostFunction.d.ts.map +0 -0
- package/types/extractor/generatedUid.d.ts +0 -0
- package/types/extractor/generatedUid.d.ts.map +0 -0
- package/types/extractor/getPrefixLogs.d.ts +0 -0
- package/types/extractor/getPrefixLogs.d.ts.map +0 -0
- package/types/extractor/getPropValueFromAttributes.d.ts +0 -0
- package/types/extractor/getPropValueFromAttributes.d.ts.map +0 -0
- package/types/extractor/getSourceModule.d.ts +0 -0
- package/types/extractor/getSourceModule.d.ts.map +0 -0
- package/types/extractor/getStaticBindingsForScope.d.ts +0 -0
- package/types/extractor/getStaticBindingsForScope.d.ts.map +0 -0
- package/types/extractor/hoistClassNames.d.ts +0 -0
- package/types/extractor/hoistClassNames.d.ts.map +0 -0
- package/types/extractor/literalToAst.d.ts +0 -0
- package/types/extractor/literalToAst.d.ts.map +0 -0
- package/types/extractor/loadTamagui.d.ts +0 -0
- package/types/extractor/loadTamagui.d.ts.map +0 -0
- package/types/extractor/logLines.d.ts +0 -0
- package/types/extractor/logLines.d.ts.map +0 -0
- package/types/extractor/normalizeTernaries.d.ts +0 -0
- package/types/extractor/normalizeTernaries.d.ts.map +0 -0
- package/types/extractor/removeUnusedHooks.d.ts +0 -0
- package/types/extractor/removeUnusedHooks.d.ts.map +0 -0
- package/types/extractor/timer.d.ts +0 -0
- package/types/extractor/timer.d.ts.map +0 -0
- package/types/extractor/validHTMLAttributes.d.ts +0 -0
- package/types/extractor/validHTMLAttributes.d.ts.map +0 -0
- package/types/index.d.ts +1 -1
- package/types/index.d.ts.map +1 -1
- package/types/types.d.ts +0 -0
- package/types/types.d.ts.map +0 -0
- package/dist/cjs/patchReactNativeWeb.js +0 -107
- package/dist/cjs/patchReactNativeWeb.js.map +0 -7
- package/dist/esm/patchReactNativeWeb.js +0 -82
- package/dist/esm/patchReactNativeWeb.js.map +0 -7
- package/dist/jsx/patchReactNativeWeb.js +0 -81
- package/patches/18/createDOMProps.cjs.js +0 -385
- package/patches/18/createDOMProps.js +0 -379
- package/src/patchReactNativeWeb.ts +0 -116
- package/types/patchReactNativeWeb.d.ts +0 -2
- package/types/patchReactNativeWeb.d.ts.map +0 -1
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/patchReactNativeWeb.ts"],
|
|
4
|
-
"sourcesContent": ["import path from 'path'\n\nimport * as fs from 'fs-extra'\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\nconst PATCH_PREFIX = 'tamagui-patch-'\nconst PATCH_VERSION = `${PATCH_PREFIX}-v5`\nconst PATCH_COMMENT = `// ${PATCH_VERSION}`\nconst PATCH_END_COMMENT = `// tamagui-patch-end`\n\n// keep it sync\nexport function patchReactNativeWeb(dir: string = require.resolve('react-native-web')) {\n const rootDir = dir.replace(/[\\/\\\\]dist.*/, '')\n\n const pkgJSON = fs.readJSONSync(path.join(rootDir, 'package.json'))\n if (pkgJSON.version.split('.')[1] !== '18') {\n console.error(\n `\u26D4\uFE0F Error! Tamagui as of beta 69 only works with react-native-web version 0.18.x`,\n pkgJSON.version\n )\n process.exit(1)\n }\n\n // patch exports for tamagui\n const modulePath = path.join(rootDir, 'dist', 'tamagui-exports.js')\n const cjsPath = path.join(rootDir, 'dist', 'cjs', 'tamagui-exports.js')\n const alreadyPatchedImports =\n fs.existsSync(modulePath) &&\n fs.readFileSync(modulePath, 'utf-8') === moduleExports &&\n fs.existsSync(cjsPath) &&\n fs.readFileSync(cjsPath, 'utf-8') === cjsExports\n\n if (!alreadyPatchedImports) {\n console.log(' | patch ' + path.relative(rootDir, modulePath))\n fs.writeFileSync(modulePath, moduleExports)\n console.log(' | patch ' + path.relative(rootDir, cjsPath))\n fs.writeFileSync(cjsPath, cjsExports)\n }\n\n // patch createDOMProps\n const dpFile = path.join(rootDir, 'dist', 'modules', 'createDOMProps', 'index.js')\n const dpPatched = fs.readFileSync(\n path.join(__dirname, '..', '..', 'patches', '18', 'createDOMProps.js'),\n 'utf-8'\n )\n const dpFileCJS = path.join(rootDir, 'dist', 'cjs', 'modules', 'createDOMProps', 'index.js')\n const dpCJSPatched = fs.readFileSync(\n path.join(__dirname, '..', '..', 'patches', '18', 'createDOMProps.cjs.js'),\n 'utf-8'\n )\n const alreadyPatchedDOMProps =\n fs.readFileSync(dpFile, 'utf-8') === dpPatched &&\n fs.readFileSync(dpFileCJS, 'utf-8') === dpCJSPatched\n\n if (!alreadyPatchedDOMProps) {\n console.log(' | patch ' + path.relative(rootDir, dpFile))\n fs.writeFileSync(dpFile, dpPatched)\n console.log(' | patch ' + path.relative(rootDir, dpFileCJS))\n fs.writeFileSync(dpFileCJS, dpCJSPatched)\n }\n\n // export tamagui exports from root\n const moduleEntry = path.join(rootDir, 'dist', 'index.js')\n const moduleEntrySrc = fs.readFileSync(moduleEntry, 'utf-8')\n if (!moduleEntrySrc.includes(PATCH_COMMENT)) {\n fs.writeFileSync(\n moduleEntry,\n `${removePatch(moduleEntrySrc)}\n\n${PATCH_COMMENT}\nimport * as TExports from './tamagui-exports'\nexport const TamaguiExports = TExports\n${PATCH_END_COMMENT}\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(PATCH_COMMENT)) {\n fs.writeFileSync(\n cjsEntry,\n `${removePatch(cjsEntrySrc)}\n\n${PATCH_COMMENT}\nexports.TamaguiExports = require(\"./tamagui-exports\");\n${PATCH_END_COMMENT}\n`\n )\n }\n}\n\nfunction removePatch(source: string) {\n return source.replace(/\\/\\/ tamagui-patch([.\\s\\S]*)/g, '')\n}\n\nconst moduleExports = `\nexport { default as createDOMProps } from './modules/createDOMProps'\nexport { default as TextAncestorContext } from './exports/Text/TextAncestorContext'\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'\n`\n\nconst cjsExports = `\nexports.createDOMProps = require('./modules/createDOMProps')\nexports.TextAncestorContext = require('./exports/Text/TextAncestorContext')\nexports.useElementLayout = require('./modules/useElementLayout')\nexports.useMergeRefs = require('./modules/useMergeRefs')\nexports.usePlatformMethods = require('./modules/usePlatformMethods')\nexports.useResponderEvents = require('./modules/useResponderEvents')\n`\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAiB;AAEjB,SAAoB;AAOpB,MAAM,eAAe;AACrB,MAAM,gBAAgB,GAAG;AACzB,MAAM,gBAAgB,MAAM;AAC5B,MAAM,oBAAoB;AAGnB,6BAA6B,MAA8B,qCAAqB;AACrF,QAAM,UAAU,IAAI,QAAQ,gBAAgB,EAAE;AAE9C,QAAM,UAAU,GAAG,aAAa,oBAAK,KAAK,SAAS,cAAc,CAAC;AAClE,MAAI,QAAQ,QAAQ,MAAM,GAAG,EAAE,OAAO,MAAM;AAC1C,YAAQ,MACN,6FACA,QAAQ,OACV;AACA,YAAQ,KAAK,CAAC;AAAA,EAChB;AAGA,QAAM,aAAa,oBAAK,KAAK,SAAS,QAAQ,oBAAoB;AAClE,QAAM,UAAU,oBAAK,KAAK,SAAS,QAAQ,OAAO,oBAAoB;AACtE,QAAM,wBACJ,GAAG,WAAW,UAAU,KACxB,GAAG,aAAa,YAAY,OAAO,MAAM,iBACzC,GAAG,WAAW,OAAO,KACrB,GAAG,aAAa,SAAS,OAAO,MAAM;AAExC,MAAI,CAAC,uBAAuB;AAC1B,YAAQ,IAAI,mBAAmB,oBAAK,SAAS,SAAS,UAAU,CAAC;AACjE,OAAG,cAAc,YAAY,aAAa;AAC1C,YAAQ,IAAI,mBAAmB,oBAAK,SAAS,SAAS,OAAO,CAAC;AAC9D,OAAG,cAAc,SAAS,UAAU;AAAA,EACtC;AAGA,QAAM,SAAS,oBAAK,KAAK,SAAS,QAAQ,WAAW,kBAAkB,UAAU;AACjF,QAAM,YAAY,GAAG,aACnB,oBAAK,KAAK,WAAW,MAAM,MAAM,WAAW,MAAM,mBAAmB,GACrE,OACF;AACA,QAAM,YAAY,oBAAK,KAAK,SAAS,QAAQ,OAAO,WAAW,kBAAkB,UAAU;AAC3F,QAAM,eAAe,GAAG,aACtB,oBAAK,KAAK,WAAW,MAAM,MAAM,WAAW,MAAM,uBAAuB,GACzE,OACF;AACA,QAAM,yBACJ,GAAG,aAAa,QAAQ,OAAO,MAAM,aACrC,GAAG,aAAa,WAAW,OAAO,MAAM;AAE1C,MAAI,CAAC,wBAAwB;AAC3B,YAAQ,IAAI,mBAAmB,oBAAK,SAAS,SAAS,MAAM,CAAC;AAC7D,OAAG,cAAc,QAAQ,SAAS;AAClC,YAAQ,IAAI,mBAAmB,oBAAK,SAAS,SAAS,SAAS,CAAC;AAChE,OAAG,cAAc,WAAW,YAAY;AAAA,EAC1C;AAGA,QAAM,cAAc,oBAAK,KAAK,SAAS,QAAQ,UAAU;AACzD,QAAM,iBAAiB,GAAG,aAAa,aAAa,OAAO;AAC3D,MAAI,CAAC,eAAe,SAAS,aAAa,GAAG;AAC3C,OAAG,cACD,aACA,GAAG,YAAY,cAAc;AAAA;AAAA,EAEjC;AAAA;AAAA;AAAA,EAGA;AAAA,CAEE;AAAA,EACF;AACA,QAAM,WAAW,oBAAK,KAAK,SAAS,QAAQ,OAAO,UAAU;AAC7D,QAAM,cAAc,GAAG,aAAa,UAAU,OAAO;AACrD,MAAI,CAAC,YAAY,SAAS,aAAa,GAAG;AACxC,OAAG,cACD,UACA,GAAG,YAAY,WAAW;AAAA;AAAA,EAE9B;AAAA;AAAA,EAEA;AAAA,CAEE;AAAA,EACF;AACF;AA9EgB;AAgFhB,qBAAqB,QAAgB;AACnC,SAAO,OAAO,QAAQ,iCAAiC,EAAE;AAC3D;AAFS;AAIT,MAAM,gBAAgB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAStB,MAAM,aAAa;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
|
-
import path from "path";
|
|
4
|
-
import * as fs from "fs-extra";
|
|
5
|
-
const PATCH_PREFIX = "tamagui-patch-";
|
|
6
|
-
const PATCH_VERSION = `${PATCH_PREFIX}-v5`;
|
|
7
|
-
const PATCH_COMMENT = `// ${PATCH_VERSION}`;
|
|
8
|
-
const PATCH_END_COMMENT = `// tamagui-patch-end`;
|
|
9
|
-
function patchReactNativeWeb(dir = require.resolve("react-native-web")) {
|
|
10
|
-
const rootDir = dir.replace(/[\/\\]dist.*/, "");
|
|
11
|
-
const pkgJSON = fs.readJSONSync(path.join(rootDir, "package.json"));
|
|
12
|
-
if (pkgJSON.version.split(".")[1] !== "18") {
|
|
13
|
-
console.error(`\u26D4\uFE0F Error! Tamagui as of beta 69 only works with react-native-web version 0.18.x`, pkgJSON.version);
|
|
14
|
-
process.exit(1);
|
|
15
|
-
}
|
|
16
|
-
const modulePath = path.join(rootDir, "dist", "tamagui-exports.js");
|
|
17
|
-
const cjsPath = path.join(rootDir, "dist", "cjs", "tamagui-exports.js");
|
|
18
|
-
const alreadyPatchedImports = fs.existsSync(modulePath) && fs.readFileSync(modulePath, "utf-8") === moduleExports && fs.existsSync(cjsPath) && fs.readFileSync(cjsPath, "utf-8") === cjsExports;
|
|
19
|
-
if (!alreadyPatchedImports) {
|
|
20
|
-
console.log(" | patch " + path.relative(rootDir, modulePath));
|
|
21
|
-
fs.writeFileSync(modulePath, moduleExports);
|
|
22
|
-
console.log(" | patch " + path.relative(rootDir, cjsPath));
|
|
23
|
-
fs.writeFileSync(cjsPath, cjsExports);
|
|
24
|
-
}
|
|
25
|
-
const dpFile = path.join(rootDir, "dist", "modules", "createDOMProps", "index.js");
|
|
26
|
-
const dpPatched = fs.readFileSync(path.join(__dirname, "..", "..", "patches", "18", "createDOMProps.js"), "utf-8");
|
|
27
|
-
const dpFileCJS = path.join(rootDir, "dist", "cjs", "modules", "createDOMProps", "index.js");
|
|
28
|
-
const dpCJSPatched = fs.readFileSync(path.join(__dirname, "..", "..", "patches", "18", "createDOMProps.cjs.js"), "utf-8");
|
|
29
|
-
const alreadyPatchedDOMProps = fs.readFileSync(dpFile, "utf-8") === dpPatched && fs.readFileSync(dpFileCJS, "utf-8") === dpCJSPatched;
|
|
30
|
-
if (!alreadyPatchedDOMProps) {
|
|
31
|
-
console.log(" | patch " + path.relative(rootDir, dpFile));
|
|
32
|
-
fs.writeFileSync(dpFile, dpPatched);
|
|
33
|
-
console.log(" | patch " + path.relative(rootDir, dpFileCJS));
|
|
34
|
-
fs.writeFileSync(dpFileCJS, dpCJSPatched);
|
|
35
|
-
}
|
|
36
|
-
const moduleEntry = path.join(rootDir, "dist", "index.js");
|
|
37
|
-
const moduleEntrySrc = fs.readFileSync(moduleEntry, "utf-8");
|
|
38
|
-
if (!moduleEntrySrc.includes(PATCH_COMMENT)) {
|
|
39
|
-
fs.writeFileSync(moduleEntry, `${removePatch(moduleEntrySrc)}
|
|
40
|
-
|
|
41
|
-
${PATCH_COMMENT}
|
|
42
|
-
import * as TExports from './tamagui-exports'
|
|
43
|
-
export const TamaguiExports = TExports
|
|
44
|
-
${PATCH_END_COMMENT}
|
|
45
|
-
`);
|
|
46
|
-
}
|
|
47
|
-
const cjsEntry = path.join(rootDir, "dist", "cjs", "index.js");
|
|
48
|
-
const cjsEntrySrc = fs.readFileSync(cjsEntry, "utf-8");
|
|
49
|
-
if (!cjsEntrySrc.includes(PATCH_COMMENT)) {
|
|
50
|
-
fs.writeFileSync(cjsEntry, `${removePatch(cjsEntrySrc)}
|
|
51
|
-
|
|
52
|
-
${PATCH_COMMENT}
|
|
53
|
-
exports.TamaguiExports = require("./tamagui-exports");
|
|
54
|
-
${PATCH_END_COMMENT}
|
|
55
|
-
`);
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
__name(patchReactNativeWeb, "patchReactNativeWeb");
|
|
59
|
-
function removePatch(source) {
|
|
60
|
-
return source.replace(/\/\/ tamagui-patch([.\s\S]*)/g, "");
|
|
61
|
-
}
|
|
62
|
-
__name(removePatch, "removePatch");
|
|
63
|
-
const moduleExports = `
|
|
64
|
-
export { default as createDOMProps } from './modules/createDOMProps'
|
|
65
|
-
export { default as TextAncestorContext } from './exports/Text/TextAncestorContext'
|
|
66
|
-
export { default as useElementLayout } from './modules/useElementLayout'
|
|
67
|
-
export { default as useMergeRefs } from './modules/useMergeRefs'
|
|
68
|
-
export { default as usePlatformMethods } from './modules/usePlatformMethods'
|
|
69
|
-
export { default as useResponderEvents } from './modules/useResponderEvents'
|
|
70
|
-
`;
|
|
71
|
-
const cjsExports = `
|
|
72
|
-
exports.createDOMProps = require('./modules/createDOMProps')
|
|
73
|
-
exports.TextAncestorContext = require('./exports/Text/TextAncestorContext')
|
|
74
|
-
exports.useElementLayout = require('./modules/useElementLayout')
|
|
75
|
-
exports.useMergeRefs = require('./modules/useMergeRefs')
|
|
76
|
-
exports.usePlatformMethods = require('./modules/usePlatformMethods')
|
|
77
|
-
exports.useResponderEvents = require('./modules/useResponderEvents')
|
|
78
|
-
`;
|
|
79
|
-
export {
|
|
80
|
-
patchReactNativeWeb
|
|
81
|
-
};
|
|
82
|
-
//# sourceMappingURL=patchReactNativeWeb.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/patchReactNativeWeb.ts"],
|
|
4
|
-
"sourcesContent": ["import path from 'path'\n\nimport * as fs from 'fs-extra'\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\nconst PATCH_PREFIX = 'tamagui-patch-'\nconst PATCH_VERSION = `${PATCH_PREFIX}-v5`\nconst PATCH_COMMENT = `// ${PATCH_VERSION}`\nconst PATCH_END_COMMENT = `// tamagui-patch-end`\n\n// keep it sync\nexport function patchReactNativeWeb(dir: string = require.resolve('react-native-web')) {\n const rootDir = dir.replace(/[\\/\\\\]dist.*/, '')\n\n const pkgJSON = fs.readJSONSync(path.join(rootDir, 'package.json'))\n if (pkgJSON.version.split('.')[1] !== '18') {\n console.error(\n `\u26D4\uFE0F Error! Tamagui as of beta 69 only works with react-native-web version 0.18.x`,\n pkgJSON.version\n )\n process.exit(1)\n }\n\n // patch exports for tamagui\n const modulePath = path.join(rootDir, 'dist', 'tamagui-exports.js')\n const cjsPath = path.join(rootDir, 'dist', 'cjs', 'tamagui-exports.js')\n const alreadyPatchedImports =\n fs.existsSync(modulePath) &&\n fs.readFileSync(modulePath, 'utf-8') === moduleExports &&\n fs.existsSync(cjsPath) &&\n fs.readFileSync(cjsPath, 'utf-8') === cjsExports\n\n if (!alreadyPatchedImports) {\n console.log(' | patch ' + path.relative(rootDir, modulePath))\n fs.writeFileSync(modulePath, moduleExports)\n console.log(' | patch ' + path.relative(rootDir, cjsPath))\n fs.writeFileSync(cjsPath, cjsExports)\n }\n\n // patch createDOMProps\n const dpFile = path.join(rootDir, 'dist', 'modules', 'createDOMProps', 'index.js')\n const dpPatched = fs.readFileSync(\n path.join(__dirname, '..', '..', 'patches', '18', 'createDOMProps.js'),\n 'utf-8'\n )\n const dpFileCJS = path.join(rootDir, 'dist', 'cjs', 'modules', 'createDOMProps', 'index.js')\n const dpCJSPatched = fs.readFileSync(\n path.join(__dirname, '..', '..', 'patches', '18', 'createDOMProps.cjs.js'),\n 'utf-8'\n )\n const alreadyPatchedDOMProps =\n fs.readFileSync(dpFile, 'utf-8') === dpPatched &&\n fs.readFileSync(dpFileCJS, 'utf-8') === dpCJSPatched\n\n if (!alreadyPatchedDOMProps) {\n console.log(' | patch ' + path.relative(rootDir, dpFile))\n fs.writeFileSync(dpFile, dpPatched)\n console.log(' | patch ' + path.relative(rootDir, dpFileCJS))\n fs.writeFileSync(dpFileCJS, dpCJSPatched)\n }\n\n // export tamagui exports from root\n const moduleEntry = path.join(rootDir, 'dist', 'index.js')\n const moduleEntrySrc = fs.readFileSync(moduleEntry, 'utf-8')\n if (!moduleEntrySrc.includes(PATCH_COMMENT)) {\n fs.writeFileSync(\n moduleEntry,\n `${removePatch(moduleEntrySrc)}\n\n${PATCH_COMMENT}\nimport * as TExports from './tamagui-exports'\nexport const TamaguiExports = TExports\n${PATCH_END_COMMENT}\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(PATCH_COMMENT)) {\n fs.writeFileSync(\n cjsEntry,\n `${removePatch(cjsEntrySrc)}\n\n${PATCH_COMMENT}\nexports.TamaguiExports = require(\"./tamagui-exports\");\n${PATCH_END_COMMENT}\n`\n )\n }\n}\n\nfunction removePatch(source: string) {\n return source.replace(/\\/\\/ tamagui-patch([.\\s\\S]*)/g, '')\n}\n\nconst moduleExports = `\nexport { default as createDOMProps } from './modules/createDOMProps'\nexport { default as TextAncestorContext } from './exports/Text/TextAncestorContext'\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'\n`\n\nconst cjsExports = `\nexports.createDOMProps = require('./modules/createDOMProps')\nexports.TextAncestorContext = require('./exports/Text/TextAncestorContext')\nexports.useElementLayout = require('./modules/useElementLayout')\nexports.useMergeRefs = require('./modules/useMergeRefs')\nexports.usePlatformMethods = require('./modules/usePlatformMethods')\nexports.useResponderEvents = require('./modules/useResponderEvents')\n`\n"],
|
|
5
|
-
"mappings": ";;AAAA;AAEA;AAOA,MAAM,eAAe;AACrB,MAAM,gBAAgB,GAAG;AACzB,MAAM,gBAAgB,MAAM;AAC5B,MAAM,oBAAoB;AAGnB,6BAA6B,MAA8B,qCAAqB;AACrF,QAAM,UAAU,IAAI,QAAQ,gBAAgB,EAAE;AAE9C,QAAM,UAAU,GAAG,aAAa,KAAK,KAAK,SAAS,cAAc,CAAC;AAClE,MAAI,QAAQ,QAAQ,MAAM,GAAG,EAAE,OAAO,MAAM;AAC1C,YAAQ,MACN,6FACA,QAAQ,OACV;AACA,YAAQ,KAAK,CAAC;AAAA,EAChB;AAGA,QAAM,aAAa,KAAK,KAAK,SAAS,QAAQ,oBAAoB;AAClE,QAAM,UAAU,KAAK,KAAK,SAAS,QAAQ,OAAO,oBAAoB;AACtE,QAAM,wBACJ,GAAG,WAAW,UAAU,KACxB,GAAG,aAAa,YAAY,OAAO,MAAM,iBACzC,GAAG,WAAW,OAAO,KACrB,GAAG,aAAa,SAAS,OAAO,MAAM;AAExC,MAAI,CAAC,uBAAuB;AAC1B,YAAQ,IAAI,mBAAmB,KAAK,SAAS,SAAS,UAAU,CAAC;AACjE,OAAG,cAAc,YAAY,aAAa;AAC1C,YAAQ,IAAI,mBAAmB,KAAK,SAAS,SAAS,OAAO,CAAC;AAC9D,OAAG,cAAc,SAAS,UAAU;AAAA,EACtC;AAGA,QAAM,SAAS,KAAK,KAAK,SAAS,QAAQ,WAAW,kBAAkB,UAAU;AACjF,QAAM,YAAY,GAAG,aACnB,KAAK,KAAK,WAAW,MAAM,MAAM,WAAW,MAAM,mBAAmB,GACrE,OACF;AACA,QAAM,YAAY,KAAK,KAAK,SAAS,QAAQ,OAAO,WAAW,kBAAkB,UAAU;AAC3F,QAAM,eAAe,GAAG,aACtB,KAAK,KAAK,WAAW,MAAM,MAAM,WAAW,MAAM,uBAAuB,GACzE,OACF;AACA,QAAM,yBACJ,GAAG,aAAa,QAAQ,OAAO,MAAM,aACrC,GAAG,aAAa,WAAW,OAAO,MAAM;AAE1C,MAAI,CAAC,wBAAwB;AAC3B,YAAQ,IAAI,mBAAmB,KAAK,SAAS,SAAS,MAAM,CAAC;AAC7D,OAAG,cAAc,QAAQ,SAAS;AAClC,YAAQ,IAAI,mBAAmB,KAAK,SAAS,SAAS,SAAS,CAAC;AAChE,OAAG,cAAc,WAAW,YAAY;AAAA,EAC1C;AAGA,QAAM,cAAc,KAAK,KAAK,SAAS,QAAQ,UAAU;AACzD,QAAM,iBAAiB,GAAG,aAAa,aAAa,OAAO;AAC3D,MAAI,CAAC,eAAe,SAAS,aAAa,GAAG;AAC3C,OAAG,cACD,aACA,GAAG,YAAY,cAAc;AAAA;AAAA,EAEjC;AAAA;AAAA;AAAA,EAGA;AAAA,CAEE;AAAA,EACF;AACA,QAAM,WAAW,KAAK,KAAK,SAAS,QAAQ,OAAO,UAAU;AAC7D,QAAM,cAAc,GAAG,aAAa,UAAU,OAAO;AACrD,MAAI,CAAC,YAAY,SAAS,aAAa,GAAG;AACxC,OAAG,cACD,UACA,GAAG,YAAY,WAAW;AAAA;AAAA,EAE9B;AAAA;AAAA,EAEA;AAAA,CAEE;AAAA,EACF;AACF;AA9EgB;AAgFhB,qBAAqB,QAAgB;AACnC,SAAO,OAAO,QAAQ,iCAAiC,EAAE;AAC3D;AAFS;AAIT,MAAM,gBAAgB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAStB,MAAM,aAAa;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
|
-
import path from "path";
|
|
4
|
-
import * as fs from "fs-extra";
|
|
5
|
-
const PATCH_PREFIX = "tamagui-patch-";
|
|
6
|
-
const PATCH_VERSION = `${PATCH_PREFIX}-v5`;
|
|
7
|
-
const PATCH_COMMENT = `// ${PATCH_VERSION}`;
|
|
8
|
-
const PATCH_END_COMMENT = `// tamagui-patch-end`;
|
|
9
|
-
function patchReactNativeWeb(dir = require.resolve("react-native-web")) {
|
|
10
|
-
const rootDir = dir.replace(/[\/\\]dist.*/, "");
|
|
11
|
-
const pkgJSON = fs.readJSONSync(path.join(rootDir, "package.json"));
|
|
12
|
-
if (pkgJSON.version.split(".")[1] !== "18") {
|
|
13
|
-
console.error(`\u26D4\uFE0F Error! Tamagui as of beta 69 only works with react-native-web version 0.18.x`, pkgJSON.version);
|
|
14
|
-
process.exit(1);
|
|
15
|
-
}
|
|
16
|
-
const modulePath = path.join(rootDir, "dist", "tamagui-exports.js");
|
|
17
|
-
const cjsPath = path.join(rootDir, "dist", "cjs", "tamagui-exports.js");
|
|
18
|
-
const alreadyPatchedImports = fs.existsSync(modulePath) && fs.readFileSync(modulePath, "utf-8") === moduleExports && fs.existsSync(cjsPath) && fs.readFileSync(cjsPath, "utf-8") === cjsExports;
|
|
19
|
-
if (!alreadyPatchedImports) {
|
|
20
|
-
console.log(" | patch " + path.relative(rootDir, modulePath));
|
|
21
|
-
fs.writeFileSync(modulePath, moduleExports);
|
|
22
|
-
console.log(" | patch " + path.relative(rootDir, cjsPath));
|
|
23
|
-
fs.writeFileSync(cjsPath, cjsExports);
|
|
24
|
-
}
|
|
25
|
-
const dpFile = path.join(rootDir, "dist", "modules", "createDOMProps", "index.js");
|
|
26
|
-
const dpPatched = fs.readFileSync(path.join(__dirname, "..", "..", "patches", "18", "createDOMProps.js"), "utf-8");
|
|
27
|
-
const dpFileCJS = path.join(rootDir, "dist", "cjs", "modules", "createDOMProps", "index.js");
|
|
28
|
-
const dpCJSPatched = fs.readFileSync(path.join(__dirname, "..", "..", "patches", "18", "createDOMProps.cjs.js"), "utf-8");
|
|
29
|
-
const alreadyPatchedDOMProps = fs.readFileSync(dpFile, "utf-8") === dpPatched && fs.readFileSync(dpFileCJS, "utf-8") === dpCJSPatched;
|
|
30
|
-
if (!alreadyPatchedDOMProps) {
|
|
31
|
-
console.log(" | patch " + path.relative(rootDir, dpFile));
|
|
32
|
-
fs.writeFileSync(dpFile, dpPatched);
|
|
33
|
-
console.log(" | patch " + path.relative(rootDir, dpFileCJS));
|
|
34
|
-
fs.writeFileSync(dpFileCJS, dpCJSPatched);
|
|
35
|
-
}
|
|
36
|
-
const moduleEntry = path.join(rootDir, "dist", "index.js");
|
|
37
|
-
const moduleEntrySrc = fs.readFileSync(moduleEntry, "utf-8");
|
|
38
|
-
if (!moduleEntrySrc.includes(PATCH_COMMENT)) {
|
|
39
|
-
fs.writeFileSync(moduleEntry, `${removePatch(moduleEntrySrc)}
|
|
40
|
-
|
|
41
|
-
${PATCH_COMMENT}
|
|
42
|
-
import * as TExports from './tamagui-exports'
|
|
43
|
-
export const TamaguiExports = TExports
|
|
44
|
-
${PATCH_END_COMMENT}
|
|
45
|
-
`);
|
|
46
|
-
}
|
|
47
|
-
const cjsEntry = path.join(rootDir, "dist", "cjs", "index.js");
|
|
48
|
-
const cjsEntrySrc = fs.readFileSync(cjsEntry, "utf-8");
|
|
49
|
-
if (!cjsEntrySrc.includes(PATCH_COMMENT)) {
|
|
50
|
-
fs.writeFileSync(cjsEntry, `${removePatch(cjsEntrySrc)}
|
|
51
|
-
|
|
52
|
-
${PATCH_COMMENT}
|
|
53
|
-
exports.TamaguiExports = require("./tamagui-exports");
|
|
54
|
-
${PATCH_END_COMMENT}
|
|
55
|
-
`);
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
__name(patchReactNativeWeb, "patchReactNativeWeb");
|
|
59
|
-
function removePatch(source) {
|
|
60
|
-
return source.replace(/\/\/ tamagui-patch([.\s\S]*)/g, "");
|
|
61
|
-
}
|
|
62
|
-
__name(removePatch, "removePatch");
|
|
63
|
-
const moduleExports = `
|
|
64
|
-
export { default as createDOMProps } from './modules/createDOMProps'
|
|
65
|
-
export { default as TextAncestorContext } from './exports/Text/TextAncestorContext'
|
|
66
|
-
export { default as useElementLayout } from './modules/useElementLayout'
|
|
67
|
-
export { default as useMergeRefs } from './modules/useMergeRefs'
|
|
68
|
-
export { default as usePlatformMethods } from './modules/usePlatformMethods'
|
|
69
|
-
export { default as useResponderEvents } from './modules/useResponderEvents'
|
|
70
|
-
`;
|
|
71
|
-
const cjsExports = `
|
|
72
|
-
exports.createDOMProps = require('./modules/createDOMProps')
|
|
73
|
-
exports.TextAncestorContext = require('./exports/Text/TextAncestorContext')
|
|
74
|
-
exports.useElementLayout = require('./modules/useElementLayout')
|
|
75
|
-
exports.useMergeRefs = require('./modules/useMergeRefs')
|
|
76
|
-
exports.usePlatformMethods = require('./modules/usePlatformMethods')
|
|
77
|
-
exports.useResponderEvents = require('./modules/useResponderEvents')
|
|
78
|
-
`;
|
|
79
|
-
export {
|
|
80
|
-
patchReactNativeWeb
|
|
81
|
-
};
|
|
@@ -1,385 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
exports.__esModule = true;
|
|
4
|
-
exports.default = void 0;
|
|
5
|
-
|
|
6
|
-
var _AccessibilityUtil = _interopRequireDefault(require("../AccessibilityUtil"));
|
|
7
|
-
|
|
8
|
-
var _StyleSheet2 = _interopRequireDefault(require("../../exports/StyleSheet"));
|
|
9
|
-
|
|
10
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
|
-
|
|
12
|
-
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
13
|
-
|
|
14
|
-
var emptyObject = {};
|
|
15
|
-
var hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
16
|
-
var isArray = Array.isArray;
|
|
17
|
-
var uppercasePattern = /[A-Z]/g;
|
|
18
|
-
|
|
19
|
-
function toHyphenLower(match) {
|
|
20
|
-
return '-' + match.toLowerCase();
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
function hyphenateString(str) {
|
|
24
|
-
return str.replace(uppercasePattern, toHyphenLower);
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
function processIDRefList(idRefList) {
|
|
28
|
-
return isArray(idRefList) ? idRefList.join(' ') : idRefList;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
var pointerEventsStyles = _StyleSheet2.default.create({
|
|
32
|
-
auto: {
|
|
33
|
-
pointerEvents: 'auto'
|
|
34
|
-
},
|
|
35
|
-
'box-none': {
|
|
36
|
-
pointerEvents: 'box-none'
|
|
37
|
-
},
|
|
38
|
-
'box-only': {
|
|
39
|
-
pointerEvents: 'box-only'
|
|
40
|
-
},
|
|
41
|
-
none: {
|
|
42
|
-
pointerEvents: 'none'
|
|
43
|
-
}
|
|
44
|
-
});
|
|
45
|
-
|
|
46
|
-
var createDOMProps = function createDOMProps(elementType, props, options) {
|
|
47
|
-
if (!props) {
|
|
48
|
-
props = emptyObject;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
var _props = props,
|
|
52
|
-
accessibilityActiveDescendant = _props.accessibilityActiveDescendant,
|
|
53
|
-
accessibilityAtomic = _props.accessibilityAtomic,
|
|
54
|
-
accessibilityAutoComplete = _props.accessibilityAutoComplete,
|
|
55
|
-
accessibilityBusy = _props.accessibilityBusy,
|
|
56
|
-
accessibilityChecked = _props.accessibilityChecked,
|
|
57
|
-
accessibilityColumnCount = _props.accessibilityColumnCount,
|
|
58
|
-
accessibilityColumnIndex = _props.accessibilityColumnIndex,
|
|
59
|
-
accessibilityColumnSpan = _props.accessibilityColumnSpan,
|
|
60
|
-
accessibilityControls = _props.accessibilityControls,
|
|
61
|
-
accessibilityCurrent = _props.accessibilityCurrent,
|
|
62
|
-
accessibilityDescribedBy = _props.accessibilityDescribedBy,
|
|
63
|
-
accessibilityDetails = _props.accessibilityDetails,
|
|
64
|
-
accessibilityDisabled = _props.accessibilityDisabled,
|
|
65
|
-
accessibilityErrorMessage = _props.accessibilityErrorMessage,
|
|
66
|
-
accessibilityExpanded = _props.accessibilityExpanded,
|
|
67
|
-
accessibilityFlowTo = _props.accessibilityFlowTo,
|
|
68
|
-
accessibilityHasPopup = _props.accessibilityHasPopup,
|
|
69
|
-
accessibilityHidden = _props.accessibilityHidden,
|
|
70
|
-
accessibilityInvalid = _props.accessibilityInvalid,
|
|
71
|
-
accessibilityKeyShortcuts = _props.accessibilityKeyShortcuts,
|
|
72
|
-
accessibilityLabel = _props.accessibilityLabel,
|
|
73
|
-
accessibilityLabelledBy = _props.accessibilityLabelledBy,
|
|
74
|
-
accessibilityLevel = _props.accessibilityLevel,
|
|
75
|
-
accessibilityLiveRegion = _props.accessibilityLiveRegion,
|
|
76
|
-
accessibilityModal = _props.accessibilityModal,
|
|
77
|
-
accessibilityMultiline = _props.accessibilityMultiline,
|
|
78
|
-
accessibilityMultiSelectable = _props.accessibilityMultiSelectable,
|
|
79
|
-
accessibilityOrientation = _props.accessibilityOrientation,
|
|
80
|
-
accessibilityOwns = _props.accessibilityOwns,
|
|
81
|
-
accessibilityPlaceholder = _props.accessibilityPlaceholder,
|
|
82
|
-
accessibilityPosInSet = _props.accessibilityPosInSet,
|
|
83
|
-
accessibilityPressed = _props.accessibilityPressed,
|
|
84
|
-
accessibilityReadOnly = _props.accessibilityReadOnly,
|
|
85
|
-
accessibilityRequired = _props.accessibilityRequired,
|
|
86
|
-
accessibilityRole = _props.accessibilityRole,
|
|
87
|
-
accessibilityRoleDescription = _props.accessibilityRoleDescription,
|
|
88
|
-
accessibilityRowCount = _props.accessibilityRowCount,
|
|
89
|
-
accessibilityRowIndex = _props.accessibilityRowIndex,
|
|
90
|
-
accessibilityRowSpan = _props.accessibilityRowSpan,
|
|
91
|
-
accessibilitySelected = _props.accessibilitySelected,
|
|
92
|
-
accessibilitySetSize = _props.accessibilitySetSize,
|
|
93
|
-
accessibilitySort = _props.accessibilitySort,
|
|
94
|
-
accessibilityValueMax = _props.accessibilityValueMax,
|
|
95
|
-
accessibilityValueMin = _props.accessibilityValueMin,
|
|
96
|
-
accessibilityValueNow = _props.accessibilityValueNow,
|
|
97
|
-
accessibilityValueText = _props.accessibilityValueText,
|
|
98
|
-
dataSet = _props.dataSet,
|
|
99
|
-
focusable = _props.focusable,
|
|
100
|
-
nativeID = _props.nativeID,
|
|
101
|
-
pointerEvents = _props.pointerEvents,
|
|
102
|
-
style = _props.style,
|
|
103
|
-
testID = _props.testID,
|
|
104
|
-
domProps = _objectWithoutPropertiesLoose(_props, ["accessibilityActiveDescendant", "accessibilityAtomic", "accessibilityAutoComplete", "accessibilityBusy", "accessibilityChecked", "accessibilityColumnCount", "accessibilityColumnIndex", "accessibilityColumnSpan", "accessibilityControls", "accessibilityCurrent", "accessibilityDescribedBy", "accessibilityDetails", "accessibilityDisabled", "accessibilityErrorMessage", "accessibilityExpanded", "accessibilityFlowTo", "accessibilityHasPopup", "accessibilityHidden", "accessibilityInvalid", "accessibilityKeyShortcuts", "accessibilityLabel", "accessibilityLabelledBy", "accessibilityLevel", "accessibilityLiveRegion", "accessibilityModal", "accessibilityMultiline", "accessibilityMultiSelectable", "accessibilityOrientation", "accessibilityOwns", "accessibilityPlaceholder", "accessibilityPosInSet", "accessibilityPressed", "accessibilityReadOnly", "accessibilityRequired", "accessibilityRole", "accessibilityRoleDescription", "accessibilityRowCount", "accessibilityRowIndex", "accessibilityRowSpan", "accessibilitySelected", "accessibilitySetSize", "accessibilitySort", "accessibilityValueMax", "accessibilityValueMin", "accessibilityValueNow", "accessibilityValueText", "dataSet", "focusable", "nativeID", "pointerEvents", "style", "testID"]);
|
|
105
|
-
|
|
106
|
-
var disabled = accessibilityDisabled;
|
|
107
|
-
|
|
108
|
-
var role = _AccessibilityUtil.default.propsToAriaRole(props); // ACCESSIBILITY
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
if (accessibilityActiveDescendant != null) {
|
|
112
|
-
domProps['aria-activedescendant'] = accessibilityActiveDescendant;
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
if (accessibilityAtomic != null) {
|
|
116
|
-
domProps['aria-atomic'] = accessibilityAtomic;
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
if (accessibilityAutoComplete != null) {
|
|
120
|
-
domProps['aria-autocomplete'] = accessibilityAutoComplete;
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
if (accessibilityBusy != null) {
|
|
124
|
-
domProps['aria-busy'] = accessibilityBusy;
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
if (accessibilityChecked != null) {
|
|
128
|
-
domProps['aria-checked'] = accessibilityChecked;
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
if (accessibilityColumnCount != null) {
|
|
132
|
-
domProps['aria-colcount'] = accessibilityColumnCount;
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
if (accessibilityColumnIndex != null) {
|
|
136
|
-
domProps['aria-colindex'] = accessibilityColumnIndex;
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
if (accessibilityColumnSpan != null) {
|
|
140
|
-
domProps['aria-colspan'] = accessibilityColumnSpan;
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
if (accessibilityControls != null) {
|
|
144
|
-
domProps['aria-controls'] = processIDRefList(accessibilityControls);
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
if (accessibilityCurrent != null) {
|
|
148
|
-
domProps['aria-current'] = accessibilityCurrent;
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
if (accessibilityDescribedBy != null) {
|
|
152
|
-
domProps['aria-describedby'] = processIDRefList(accessibilityDescribedBy);
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
if (accessibilityDetails != null) {
|
|
156
|
-
domProps['aria-details'] = accessibilityDetails;
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
if (disabled === true) {
|
|
160
|
-
domProps['aria-disabled'] = true; // Enhance with native semantics
|
|
161
|
-
|
|
162
|
-
if (elementType === 'button' || elementType === 'form' || elementType === 'input' || elementType === 'select' || elementType === 'textarea') {
|
|
163
|
-
domProps.disabled = true;
|
|
164
|
-
}
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
if (accessibilityErrorMessage != null) {
|
|
168
|
-
domProps['aria-errormessage'] = accessibilityErrorMessage;
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
if (accessibilityExpanded != null) {
|
|
172
|
-
domProps['aria-expanded'] = accessibilityExpanded;
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
if (accessibilityFlowTo != null) {
|
|
176
|
-
domProps['aria-flowto'] = processIDRefList(accessibilityFlowTo);
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
if (accessibilityHasPopup != null) {
|
|
180
|
-
domProps['aria-haspopup'] = accessibilityHasPopup;
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
if (accessibilityHidden === true) {
|
|
184
|
-
domProps['aria-hidden'] = accessibilityHidden;
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
if (accessibilityInvalid != null) {
|
|
188
|
-
domProps['aria-invalid'] = accessibilityInvalid;
|
|
189
|
-
}
|
|
190
|
-
|
|
191
|
-
if (accessibilityKeyShortcuts != null && Array.isArray(accessibilityKeyShortcuts)) {
|
|
192
|
-
domProps['aria-keyshortcuts'] = accessibilityKeyShortcuts.join(' ');
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
if (accessibilityLabel != null) {
|
|
196
|
-
domProps['aria-label'] = accessibilityLabel;
|
|
197
|
-
}
|
|
198
|
-
|
|
199
|
-
if (accessibilityLabelledBy != null) {
|
|
200
|
-
domProps['aria-labelledby'] = processIDRefList(accessibilityLabelledBy);
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
if (accessibilityLevel != null) {
|
|
204
|
-
domProps['aria-level'] = accessibilityLevel;
|
|
205
|
-
}
|
|
206
|
-
|
|
207
|
-
if (accessibilityLiveRegion != null) {
|
|
208
|
-
domProps['aria-live'] = accessibilityLiveRegion === 'none' ? 'off' : accessibilityLiveRegion;
|
|
209
|
-
}
|
|
210
|
-
|
|
211
|
-
if (accessibilityModal != null) {
|
|
212
|
-
domProps['aria-modal'] = accessibilityModal;
|
|
213
|
-
}
|
|
214
|
-
|
|
215
|
-
if (accessibilityMultiline != null) {
|
|
216
|
-
domProps['aria-multiline'] = accessibilityMultiline;
|
|
217
|
-
}
|
|
218
|
-
|
|
219
|
-
if (accessibilityMultiSelectable != null) {
|
|
220
|
-
domProps['aria-multiselectable'] = accessibilityMultiSelectable;
|
|
221
|
-
}
|
|
222
|
-
|
|
223
|
-
if (accessibilityOrientation != null) {
|
|
224
|
-
domProps['aria-orientation'] = accessibilityOrientation;
|
|
225
|
-
}
|
|
226
|
-
|
|
227
|
-
if (accessibilityOwns != null) {
|
|
228
|
-
domProps['aria-owns'] = processIDRefList(accessibilityOwns);
|
|
229
|
-
}
|
|
230
|
-
|
|
231
|
-
if (accessibilityPlaceholder != null) {
|
|
232
|
-
domProps['aria-placeholder'] = accessibilityPlaceholder;
|
|
233
|
-
}
|
|
234
|
-
|
|
235
|
-
if (accessibilityPosInSet != null) {
|
|
236
|
-
domProps['aria-posinset'] = accessibilityPosInSet;
|
|
237
|
-
}
|
|
238
|
-
|
|
239
|
-
if (accessibilityPressed != null) {
|
|
240
|
-
domProps['aria-pressed'] = accessibilityPressed;
|
|
241
|
-
}
|
|
242
|
-
|
|
243
|
-
if (accessibilityReadOnly != null) {
|
|
244
|
-
domProps['aria-readonly'] = accessibilityReadOnly; // Enhance with native semantics
|
|
245
|
-
|
|
246
|
-
if (elementType === 'input' || elementType === 'select' || elementType === 'textarea') {
|
|
247
|
-
domProps.readOnly = true;
|
|
248
|
-
}
|
|
249
|
-
}
|
|
250
|
-
|
|
251
|
-
if (accessibilityRequired != null) {
|
|
252
|
-
domProps['aria-required'] = accessibilityRequired; // Enhance with native semantics
|
|
253
|
-
|
|
254
|
-
if (elementType === 'input' || elementType === 'select' || elementType === 'textarea') {
|
|
255
|
-
domProps.required = true;
|
|
256
|
-
}
|
|
257
|
-
}
|
|
258
|
-
|
|
259
|
-
if (role != null) {
|
|
260
|
-
// 'presentation' synonym has wider browser support
|
|
261
|
-
domProps['role'] = role === 'none' ? 'presentation' : role;
|
|
262
|
-
}
|
|
263
|
-
|
|
264
|
-
if (accessibilityRoleDescription != null) {
|
|
265
|
-
domProps['aria-roledescription'] = accessibilityRoleDescription;
|
|
266
|
-
}
|
|
267
|
-
|
|
268
|
-
if (accessibilityRowCount != null) {
|
|
269
|
-
domProps['aria-rowcount'] = accessibilityRowCount;
|
|
270
|
-
}
|
|
271
|
-
|
|
272
|
-
if (accessibilityRowIndex != null) {
|
|
273
|
-
domProps['aria-rowindex'] = accessibilityRowIndex;
|
|
274
|
-
}
|
|
275
|
-
|
|
276
|
-
if (accessibilityRowSpan != null) {
|
|
277
|
-
domProps['aria-rowspan'] = accessibilityRowSpan;
|
|
278
|
-
}
|
|
279
|
-
|
|
280
|
-
if (accessibilitySelected != null) {
|
|
281
|
-
domProps['aria-selected'] = accessibilitySelected;
|
|
282
|
-
}
|
|
283
|
-
|
|
284
|
-
if (accessibilitySetSize != null) {
|
|
285
|
-
domProps['aria-setsize'] = accessibilitySetSize;
|
|
286
|
-
}
|
|
287
|
-
|
|
288
|
-
if (accessibilitySort != null) {
|
|
289
|
-
domProps['aria-sort'] = accessibilitySort;
|
|
290
|
-
}
|
|
291
|
-
|
|
292
|
-
if (accessibilityValueMax != null) {
|
|
293
|
-
domProps['aria-valuemax'] = accessibilityValueMax;
|
|
294
|
-
}
|
|
295
|
-
|
|
296
|
-
if (accessibilityValueMin != null) {
|
|
297
|
-
domProps['aria-valuemin'] = accessibilityValueMin;
|
|
298
|
-
}
|
|
299
|
-
|
|
300
|
-
if (accessibilityValueNow != null) {
|
|
301
|
-
domProps['aria-valuenow'] = accessibilityValueNow;
|
|
302
|
-
}
|
|
303
|
-
|
|
304
|
-
if (accessibilityValueText != null) {
|
|
305
|
-
domProps['aria-valuetext'] = accessibilityValueText;
|
|
306
|
-
} // "dataSet" replaced with "data-*"
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
const tmgCN = dataSet ? dataSet.className : undefined
|
|
310
|
-
const tmgID = dataSet ? dataSet.id : undefined
|
|
311
|
-
if (dataSet != null) {
|
|
312
|
-
for (var dataProp in dataSet) {
|
|
313
|
-
if (dataProp === 'className' || dataProp === 'id') continue
|
|
314
|
-
if (hasOwnProperty.call(dataSet, dataProp)) {
|
|
315
|
-
var dataName = hyphenateString(dataProp);
|
|
316
|
-
var dataValue = dataSet[dataProp];
|
|
317
|
-
|
|
318
|
-
if (dataValue != null) {
|
|
319
|
-
domProps["data-" + dataName] = dataValue;
|
|
320
|
-
}
|
|
321
|
-
}
|
|
322
|
-
}
|
|
323
|
-
} // FOCUS
|
|
324
|
-
// "focusable" indicates that an element may be a keyboard tab-stop.
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
if (focusable === false) {
|
|
328
|
-
domProps.tabIndex = '-1';
|
|
329
|
-
}
|
|
330
|
-
|
|
331
|
-
if ( // These native elements are keyboard focusable by default
|
|
332
|
-
elementType === 'a' || elementType === 'button' || elementType === 'input' || elementType === 'select' || elementType === 'textarea') {
|
|
333
|
-
if (focusable === false || accessibilityDisabled === true) {
|
|
334
|
-
domProps.tabIndex = '-1';
|
|
335
|
-
}
|
|
336
|
-
} else if ( // These roles are made keyboard focusable by default
|
|
337
|
-
role === 'button' || role === 'checkbox' || role === 'link' || role === 'radio' || role === 'textbox' || role === 'switch') {
|
|
338
|
-
if (focusable !== false) {
|
|
339
|
-
domProps.tabIndex = '0';
|
|
340
|
-
}
|
|
341
|
-
} else {
|
|
342
|
-
// Everything else must explicitly set the prop
|
|
343
|
-
if (focusable === true) {
|
|
344
|
-
domProps.tabIndex = '0';
|
|
345
|
-
}
|
|
346
|
-
} // Resolve styles
|
|
347
|
-
|
|
348
|
-
var _StyleSheet = (0, _StyleSheet2.default)([style, pointerEvents && pointerEventsStyles[pointerEvents]], {
|
|
349
|
-
writingDirection: options ? options.writingDirection : 'ltr'
|
|
350
|
-
}),
|
|
351
|
-
className = _StyleSheet[0],
|
|
352
|
-
inlineStyle = _StyleSheet[1];
|
|
353
|
-
|
|
354
|
-
// elementType = null on setNativeProps and overrides our classname
|
|
355
|
-
if (elementType != null && className) {
|
|
356
|
-
domProps.className = className;
|
|
357
|
-
}
|
|
358
|
-
|
|
359
|
-
if (inlineStyle) {
|
|
360
|
-
domProps.style = inlineStyle;
|
|
361
|
-
}
|
|
362
|
-
|
|
363
|
-
if (tmgCN) {
|
|
364
|
-
domProps.className = tmgCN
|
|
365
|
-
}
|
|
366
|
-
|
|
367
|
-
// Native element ID
|
|
368
|
-
|
|
369
|
-
if (tmgID) {
|
|
370
|
-
domProps.id = tmgID
|
|
371
|
-
} else if (nativeID != null) {
|
|
372
|
-
domProps.id = nativeID;
|
|
373
|
-
} // Automated test IDs
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
if (testID != null) {
|
|
377
|
-
domProps['data-testid'] = testID;
|
|
378
|
-
}
|
|
379
|
-
|
|
380
|
-
return domProps;
|
|
381
|
-
};
|
|
382
|
-
|
|
383
|
-
var _default = createDOMProps;
|
|
384
|
-
exports.default = _default;
|
|
385
|
-
module.exports = exports.default;
|