@tarojs/runtime-rn 3.6.0-canary.9 → 3.6.1-alpha.0

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/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2018
3
+ Copyright (c) 2018 O2Team
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
@@ -19,3 +19,121 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
19
  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
20
  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
21
  SOFTWARE.
22
+
23
+ ========================================================================
24
+
25
+ MIT (react-devtools):
26
+ The following files embed [react-devtools](https://github.com/facebook/react) MIT:
27
+ `/packages/taro-plugin-react-devtools/src/backend/index.js`
28
+ See `/LICENSE` for details of the license.
29
+
30
+ ==================
31
+
32
+ MIT (vue-devtools):
33
+ The following files embed [vue-devtools](https://github.com/vuejs/devtools) MIT:
34
+ `/packages/taro-plugin-vue-devtools/src/backend/*`
35
+ See `/LICENSE` for details of the license.
36
+
37
+ ==================
38
+
39
+ MIT (vite):
40
+ The following files embed [vite](https://github.com/vitejs/vite) MIT:
41
+ `/packages/taro-webpack5-prebundle/src/prebundle/scanImport.ts`,
42
+ `/packages/taro-webpack5-prebundle/src/prebundle/bundle.ts`,
43
+ `/packages/taro-webpack5-prebundle/src/h5.ts`,
44
+ `/packages/taro-webpack5-prebundle/src/min.ts`
45
+ See `/LICENSE` for details of the license.
46
+
47
+ ==================
48
+
49
+ MIT (webpack):
50
+ The following files embed [webpack](https://github.com/webpack/webpack) MIT:
51
+ `/packages/taro-webpack5-prebundle/src/webpack/TaroContainerEntryModule.ts`,
52
+ `/packages/taro-webpack5-prebundle/src/webpack/TaroContainerPlugin.ts`,
53
+ `/packages/taro-webpack5-prebundle/src/webpack/TaroContainerReferencePlugin.ts`,
54
+ `/packages/taro-webpack5-prebundle/src/webpack/TaroModuleFederationPlugin.ts`
55
+ See `/LICENSE` for details of the license.
56
+
57
+ ==================
58
+
59
+ MIT (sizzle):
60
+ The following files embed [sizzle](https://github.com/jquery/sizzle) MIT:
61
+ `/packages/taro-extends/src/jquery/sizzle.js`
62
+ See `/LICENSE.txt` for details of the license.
63
+
64
+ ==================
65
+
66
+ MIT (zepto):
67
+ The following files embed [zepto](https://github.com/madrobby/zepto) MIT:
68
+ `/packages/taro-extends/src/jquery/zepto.js`,
69
+ `/packages/taro-extends/src/jquery/event.js`
70
+ See `/MIT-LICENSE` for details of the license.
71
+
72
+ ==================
73
+
74
+ MIT (css-to-react-native):
75
+ The following files embed [css-to-react-native](https://github.com/styled-components/css-to-react-native) MIT:
76
+ `/packages/css-to-react-native/src/css-to-react-native/*`
77
+ See `/LICENSE.md` for details of the license.
78
+
79
+ ==================
80
+
81
+ MIT (reactify-wc):
82
+ The following files embed [reactify-wc](https://github.com/BBKolton/reactify-wc) MIT:
83
+ `/packages/taro-components-library-react/src/component-lib/reactify-wc.ts`
84
+ See `/LICENSE` for details of the license.
85
+
86
+ ==================
87
+
88
+ MIT (ant-design-mobile-rn):
89
+ The following files embed [ant-design-mobile-rn](https://github.com/ant-design/ant-design-mobile-rn) MIT:
90
+ `/packages/taro-components-rn/src/components/Swiper/carousel.tsx`
91
+ See `/LICENSE` for details of the license.
92
+
93
+ ==================
94
+
95
+ MIT (react-wx-images-viewer):
96
+ The following files embed [react-wx-images-viewer](https://github.com/react-ld/react-wx-images-viewer) MIT:
97
+ `/packages/taro-h5/src/api/media/image/previewImage.ts`
98
+ See `/LICENSE` for details of the license.
99
+
100
+ ==================
101
+
102
+ MIT (webpack-contrib/css-loader):
103
+ The following files embed [webpack-contrib/css-loader](https://github.com/webpack-contrib/css-loader) MIT:
104
+ `/packages/taro-rn-style-transformer/src/utils/index.ts`
105
+ See `/LICENSE` for details of the license.
106
+
107
+ ==================
108
+
109
+ MIT (react-native):
110
+ The following files embed [react-native](https://github.com/facebook/react-native) MIT:
111
+ `/packages/taro-rn-style-transformer/src/transforms/StyleSheet/*`
112
+ See `/LICENSE` for details of the license.
113
+
114
+ ==================
115
+
116
+ MIT (myrne/performance-now):
117
+ The following files embed [myrne/performance-now](https://github.com/myrne/performance-now) MIT:
118
+ `/packages/taro-runtime/src/bom/raf.ts`
119
+ See `/LICENSE` for details of the license.
120
+
121
+ ==================
122
+
123
+ Apache (chameleon-api):
124
+ The following files embed [chameleon-api](https://github.com/chameleon-team/chameleon-api) Apache:
125
+ `/packages/taro-h5/src/api/device/clipboard.ts`
126
+
127
+ ==================
128
+
129
+ MIT (uni-app):
130
+ The following files embed [uni-app](https://github.com/dcloudio/uni-app) MIT:
131
+ `/packages/taro-components-rn/src/components/Video/index.tsx`
132
+ See `/LICENSE` for details of the license.
133
+
134
+ ==================
135
+
136
+ MIT (miniprogram-render):
137
+ The following files embed [miniprogram-render](https://github.com/Tencent/kbone) MIT:
138
+ `/packages/taro-plugin-http/src/runtime/Cookie.ts`
139
+ See `/LICENSE` for details of the license.
package/dist/compute.js CHANGED
@@ -1,4 +1,5 @@
1
1
  import { Dimensions } from 'react-native';
2
+ import { isFunction } from './utils';
2
3
  const globalAny = global;
3
4
  const defaultWidth = 750;
4
5
  const defaultRadio = {
@@ -11,7 +12,10 @@ export function pxTransform(size) {
11
12
  const deviceWidthDp = Dimensions.get('window').width;
12
13
  const uiWidthPx = 375;
13
14
  const config = ((_a = globalAny.__taroAppConfig) === null || _a === void 0 ? void 0 : _a.appConfig) || {};
14
- const { designWidth = defaultWidth, deviceRatio = defaultRadio } = config;
15
+ const deviceRatio = config.deviceRatio || defaultRadio;
16
+ const designWidth = (((input = 0) => isFunction(config.designWidth)
17
+ ? config.designWidth(input)
18
+ : config.designWidth || defaultWidth))(size);
15
19
  if (!(designWidth in deviceRatio)) {
16
20
  throw new Error(`deviceRatio 配置中不存在 ${designWidth} 的设置!`);
17
21
  }
@@ -1 +1 @@
1
- {"version":3,"file":"compute.js","sourceRoot":"","sources":["../src/compute.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AAIzC,MAAM,SAAS,GAAQ,MAAM,CAAA;AAC7B,MAAM,YAAY,GAAG,GAAG,CAAA;AACxB,MAAM,YAAY,GAAG;IACnB,GAAG,EAAE,IAAI,GAAG,CAAC;IACb,GAAG,EAAE,CAAC;IACN,GAAG,EAAE,IAAI,GAAG,CAAC;CACd,CAAA;AAED,MAAM,UAAU,WAAW,CAAE,IAAY;;IACvC,MAAM,aAAa,GAAG,UAAU,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC,KAAK,CAAA;IACpD,MAAM,SAAS,GAAG,GAAG,CAAA;IACrB,MAAM,MAAM,GAAc,CAAA,MAAA,SAAS,CAAC,eAAe,0CAAE,SAAS,KAAI,EAAE,CAAA;IACpE,MAAM,EAAE,WAAW,GAAG,YAAY,EAAE,WAAW,GAAG,YAAY,EAAE,GAAG,MAAM,CAAA;IACzE,IAAI,CAAC,CAAC,WAAW,IAAI,WAAW,CAAC,EAAE;QACjC,MAAM,IAAI,KAAK,CAAC,sBAAsB,WAAW,OAAO,CAAC,CAAA;KAC1D;IACD,MAAM,UAAU,GAAG,CAAC,CAAC,IAAI,CAAA;IACzB,MAAM,QAAQ,GAAG,UAAU,GAAG,WAAW,CAAC,WAAW,CAAC,CAAA;IACtD,OAAO,QAAQ,GAAG,aAAa,GAAG,CAAC,SAAS,GAAG,CAAC,CAAC,CAAA;AACnD,CAAC"}
1
+ {"version":3,"file":"compute.js","sourceRoot":"","sources":["../src/compute.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AAEzC,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAA;AAIpC,MAAM,SAAS,GAAQ,MAAM,CAAA;AAC7B,MAAM,YAAY,GAAG,GAAG,CAAA;AACxB,MAAM,YAAY,GAAG;IACnB,GAAG,EAAE,IAAI,GAAG,CAAC;IACb,GAAG,EAAE,CAAC;IACN,GAAG,EAAE,IAAI,GAAG,CAAC;CACd,CAAA;AAED,MAAM,UAAU,WAAW,CAAE,IAAY;;IACvC,MAAM,aAAa,GAAG,UAAU,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC,KAAK,CAAA;IACpD,MAAM,SAAS,GAAG,GAAG,CAAA;IACrB,MAAM,MAAM,GAAc,CAAA,MAAA,SAAS,CAAC,eAAe,0CAAE,SAAS,KAAI,EAAE,CAAA;IACpE,MAAM,WAAW,GAAG,MAAM,CAAC,WAAW,IAAI,YAAY,CAAA;IACtD,MAAM,WAAW,GAAG,CAAC,CAAC,CAAC,KAAK,GAAG,CAAC,EAAE,EAAE,CAAC,UAAU,CAAC,MAAM,CAAC,WAAW,CAAC;QACjE,CAAC,CAAC,MAAM,CAAC,WAAW,CAAC,KAAK,CAAC;QAC3B,CAAC,CAAC,MAAM,CAAC,WAAW,IAAI,YAAY,CAAC,CAAC,CAAC,IAAI,CAAC,CAAA;IAC9C,IAAI,CAAC,CAAC,WAAW,IAAI,WAAW,CAAC,EAAE;QACjC,MAAM,IAAI,KAAK,CAAC,sBAAsB,WAAW,OAAO,CAAC,CAAA;KAC1D;IACD,MAAM,UAAU,GAAG,CAAC,CAAC,IAAI,CAAA;IACzB,MAAM,QAAQ,GAAG,UAAU,GAAG,WAAW,CAAC,WAAW,CAAC,CAAA;IACtD,OAAO,QAAQ,GAAG,aAAa,GAAG,CAAC,SAAS,GAAG,CAAC,CAAC,CAAA;AACnD,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tarojs/runtime-rn",
3
- "version": "3.6.0-canary.9",
3
+ "version": "3.6.1-alpha.0",
4
4
  "description": "taro-runtime-rn",
5
5
  "main": "dist/index.js",
6
6
  "types": "./src/index.ts",
@@ -21,8 +21,8 @@
21
21
  },
22
22
  "dependencies": {
23
23
  "react-native-root-siblings": "^4.1.1",
24
- "@tarojs/components-rn": "3.6.0-canary.9",
25
- "@tarojs/router-rn": "3.6.0-canary.9"
24
+ "@tarojs/components-rn": "3.6.1-alpha.0",
25
+ "@tarojs/router-rn": "3.6.1-alpha.0"
26
26
  },
27
27
  "devDependencies": {
28
28
  "@types/react-native": "^0.69.8"
package/src/compute.ts CHANGED
@@ -1,6 +1,8 @@
1
1
  import { Dimensions } from 'react-native'
2
2
 
3
- import { AppConfig } from './types/index'
3
+ import { isFunction } from './utils'
4
+
5
+ import type { AppConfig } from './types/index'
4
6
 
5
7
  const globalAny: any = global
6
8
  const defaultWidth = 750
@@ -14,7 +16,10 @@ export function pxTransform (size: number): number {
14
16
  const deviceWidthDp = Dimensions.get('window').width
15
17
  const uiWidthPx = 375
16
18
  const config: AppConfig = globalAny.__taroAppConfig?.appConfig || {}
17
- const { designWidth = defaultWidth, deviceRatio = defaultRadio } = config
19
+ const deviceRatio = config.deviceRatio || defaultRadio
20
+ const designWidth = (((input = 0) => isFunction(config.designWidth)
21
+ ? config.designWidth(input)
22
+ : config.designWidth || defaultWidth))(size)
18
23
  if (!(designWidth in deviceRatio)) {
19
24
  throw new Error(`deviceRatio 配置中不存在 ${designWidth} 的设置!`)
20
25
  }
@@ -154,16 +154,16 @@ export interface WindowConfig extends CommonConfig {
154
154
  allowsBounceVertical?: 'YES' | 'NO'
155
155
  }
156
156
  export interface AppConfig {
157
- pages: string[],
158
- window?: WindowConfig,
159
- tabBar?: TabBar,
157
+ pages: string[]
158
+ window?: WindowConfig
159
+ tabBar?: TabBar
160
160
  subPackages?: SubPackage[]
161
- subpackages?: SubPackage[],
162
- designWidth: number,
163
- deviceRatio: Record<number, number>,
164
- linkPrefix: string[],
165
- rn?: any,
166
- entryPagePath?: string,
161
+ subpackages?: SubPackage[]
162
+ designWidth: number | ((size: number) => number)
163
+ deviceRatio: Record<string, number>
164
+ linkPrefix: string[]
165
+ rn?: any
166
+ entryPagePath?: string
167
167
  }
168
168
 
169
169
  export interface RNAppConfig {
package/src/utils.ts CHANGED
@@ -35,7 +35,7 @@ export const incrementId = () => {
35
35
  }
36
36
 
37
37
 
38
- export function isFunction (o: unknown): boolean {
38
+ export function isFunction (o: unknown): o is (...args: any[]) => any {
39
39
  return typeof o === 'function'
40
40
  }
41
41