@tarojs/runtime 3.3.15 → 3.3.19
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/dsl/react.d.ts +1 -1
- package/dist/runtime.esm.js +16 -16
- package/dist/runtime.esm.js.map +1 -1
- package/package.json +4 -4
package/dist/dsl/react.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ import type { AppInstance, ReactPageComponent, PageProps } from './instance';
|
|
|
5
5
|
export declare let R: typeof React;
|
|
6
6
|
export declare let PageContext: React.Context<string>;
|
|
7
7
|
export declare function connectReactPage(R: typeof React, id: string): (component: ReactPageComponent) => React.ComponentClass<PageProps>;
|
|
8
|
-
export declare function createReactApp(App: React.ComponentClass, react: typeof React,
|
|
8
|
+
export declare function createReactApp(App: React.ComponentClass, react: typeof React, dom: any, config: AppConfig): AppInstance;
|
|
9
9
|
export declare function createNativeComponentConfig(Component: any, react: typeof React, reactdom: any, componentConfig: any): {
|
|
10
10
|
properties: {
|
|
11
11
|
props: {
|
package/dist/runtime.esm.js
CHANGED
|
@@ -2141,7 +2141,7 @@ let TaroElement = class TaroElement extends TaroNode {
|
|
|
2141
2141
|
qualifiedName = shortcutAttr(qualifiedName);
|
|
2142
2142
|
const payload = {
|
|
2143
2143
|
path: `${this._path}.${toCamelCase(qualifiedName)}`,
|
|
2144
|
-
value
|
|
2144
|
+
value: isFunction$1(value) ? () => value : value
|
|
2145
2145
|
};
|
|
2146
2146
|
(_b = (_a = this.hooks).modifySetAttrPayload) === null || _b === void 0 ? void 0 : _b.call(_a, this, qualifiedName, payload);
|
|
2147
2147
|
this.enqueueUpdate(payload);
|
|
@@ -3971,8 +3971,12 @@ class StyleTagParser {
|
|
|
3971
3971
|
// console.log('res this.styles: ', this.styles)
|
|
3972
3972
|
}
|
|
3973
3973
|
parseSelector(src) {
|
|
3974
|
-
|
|
3975
|
-
|
|
3974
|
+
const list = src
|
|
3975
|
+
.trim()
|
|
3976
|
+
.replace(/ *([>~+]) */g, ' $1')
|
|
3977
|
+
.replace(/ +/g, ' ')
|
|
3978
|
+
.replace(/\[\s*([^[\]=\s]+)\s*=\s*([^[\]=\s]+)\s*\]/g, '[$1=$2]')
|
|
3979
|
+
.split(' ');
|
|
3976
3980
|
const selectors = list.map(item => {
|
|
3977
3981
|
const firstChar = item.charAt(0);
|
|
3978
3982
|
const selector = {
|
|
@@ -5189,7 +5193,7 @@ function createPageConfig(component, pageName, data, pageConfig) {
|
|
|
5189
5193
|
let loadResolver;
|
|
5190
5194
|
let hasLoaded;
|
|
5191
5195
|
const config = {
|
|
5192
|
-
onLoad(options, cb) {
|
|
5196
|
+
onLoad(options = {}, cb) {
|
|
5193
5197
|
hasLoaded = new Promise(resolve => { loadResolver = resolve; });
|
|
5194
5198
|
perf.start(PAGE_INIT);
|
|
5195
5199
|
Current.page = this;
|
|
@@ -5507,9 +5511,10 @@ function setReconciler() {
|
|
|
5507
5511
|
}
|
|
5508
5512
|
}
|
|
5509
5513
|
const pageKeyId = incrementId();
|
|
5510
|
-
function createReactApp(App, react,
|
|
5514
|
+
function createReactApp(App, react, dom, config) {
|
|
5515
|
+
var _a;
|
|
5511
5516
|
R = react;
|
|
5512
|
-
ReactDOM =
|
|
5517
|
+
ReactDOM = dom;
|
|
5513
5518
|
ensure(!!ReactDOM, '构建 React/Nerv 项目请把 process.env.FRAMEWORK 设置为 \'react\'/\'nerv\' ');
|
|
5514
5519
|
const ref = R.createRef();
|
|
5515
5520
|
const isReactComponent = isClassComponent(R, App);
|
|
@@ -5551,8 +5556,7 @@ function createReactApp(App, react, reactdom, config) {
|
|
|
5551
5556
|
}
|
|
5552
5557
|
let wrapper;
|
|
5553
5558
|
if (!isBrowser) {
|
|
5554
|
-
|
|
5555
|
-
wrapper = ReactDOM.render(R.createElement(AppWrapper), document$2.getElementById('app'));
|
|
5559
|
+
wrapper = (_a = ReactDOM.render) === null || _a === void 0 ? void 0 : _a.call(ReactDOM, R.createElement(AppWrapper), document$2.getElementById('app'));
|
|
5556
5560
|
}
|
|
5557
5561
|
const app = Object.create({
|
|
5558
5562
|
render(cb) {
|
|
@@ -5576,11 +5580,11 @@ function createReactApp(App, react, reactdom, config) {
|
|
|
5576
5580
|
enumerable: true,
|
|
5577
5581
|
writable: true,
|
|
5578
5582
|
value(options) {
|
|
5583
|
+
var _a;
|
|
5579
5584
|
Current.router = Object.assign({ params: options === null || options === void 0 ? void 0 : options.query }, options);
|
|
5580
5585
|
if (isBrowser) {
|
|
5581
5586
|
// 由于 H5 路由初始化的时候会清除 app 下的 dom 元素,所以需要在路由初始化后执行 render
|
|
5582
|
-
|
|
5583
|
-
wrapper = ReactDOM.render(R.createElement(AppWrapper), document$2.getElementById('app'));
|
|
5587
|
+
wrapper = (_a = ReactDOM.render) === null || _a === void 0 ? void 0 : _a.call(ReactDOM, R.createElement(AppWrapper), document$2.getElementById((config === null || config === void 0 ? void 0 : config.appId) || 'app'));
|
|
5584
5588
|
}
|
|
5585
5589
|
const app = ref.current;
|
|
5586
5590
|
// For taroize
|
|
@@ -5935,7 +5939,7 @@ function createVueApp(App, vue, config) {
|
|
|
5935
5939
|
Current.router = Object.assign({ params: options === null || options === void 0 ? void 0 : options.query }, options);
|
|
5936
5940
|
if (isBrowser) {
|
|
5937
5941
|
// 由于 H5 路由初始化的时候会清除 app 下的 dom 元素,所以需要在路由初始化后再执行 render
|
|
5938
|
-
wrapper.$mount(document$2.getElementById('app'));
|
|
5942
|
+
wrapper.$mount(document$2.getElementById((config === null || config === void 0 ? void 0 : config.appId) || 'app'));
|
|
5939
5943
|
}
|
|
5940
5944
|
appInstance = wrapper.$refs.app;
|
|
5941
5945
|
if (appInstance != null && isFunction$1(appInstance.$options.onLaunch)) {
|
|
@@ -5976,10 +5980,6 @@ function createVue3Page(h, id) {
|
|
|
5976
5980
|
},
|
|
5977
5981
|
created() {
|
|
5978
5982
|
injectPageInstance(this, id);
|
|
5979
|
-
// vue3 组件 created 时机比小程序页面 onShow 慢,因此在 created 后再手动触发一次 onShow。
|
|
5980
|
-
this.$nextTick(() => {
|
|
5981
|
-
safeExecute(id, 'onShow');
|
|
5982
|
-
});
|
|
5983
5983
|
}
|
|
5984
5984
|
};
|
|
5985
5985
|
if (isArray$1(component.mixins)) {
|
|
@@ -6083,7 +6083,7 @@ function createVue3App(app, h, config) {
|
|
|
6083
6083
|
var _a;
|
|
6084
6084
|
Current.router = Object.assign({ params: options === null || options === void 0 ? void 0 : options.query }, options);
|
|
6085
6085
|
if (isBrowser) {
|
|
6086
|
-
appInstance = app.mount('
|
|
6086
|
+
appInstance = app.mount(`#${config.appId || 'app'}`);
|
|
6087
6087
|
}
|
|
6088
6088
|
// 把 App Class 上挂载的额外属性同步到全局 app 对象中
|
|
6089
6089
|
// eslint-disable-next-line dot-notation
|