@tarojs/runtime 3.3.13 → 3.3.17

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.
@@ -27,7 +27,8 @@ export declare class TaroElement extends TaroNode {
27
27
  set textContent(text: string);
28
28
  hasAttribute(qualifiedName: string): boolean;
29
29
  hasAttributes(): boolean;
30
- focus(): void;
30
+ get focus(): () => void;
31
+ set focus(value: () => void);
31
32
  blur(): void;
32
33
  setAttribute(qualifiedName: string, value: any): void;
33
34
  removeAttribute(qualifiedName: string): void;
@@ -1234,7 +1234,6 @@ const TIME_STAMP = 'timeStamp';
1234
1234
  const KEY_CODE = 'keyCode';
1235
1235
  const TOUCHMOVE = 'touchmove';
1236
1236
  const DATE = 'Date';
1237
- const SET_TIMEOUT = 'setTimeout';
1238
1237
  const CATCHMOVE = 'catchMove';
1239
1238
  const CATCH_VIEW = 'catch-view';
1240
1239
  const COMMENT = 'comment';
@@ -2103,8 +2102,14 @@ let TaroElement = class TaroElement extends TaroNode {
2103
2102
  hasAttributes() {
2104
2103
  return this.attributes.length > 0;
2105
2104
  }
2106
- focus() {
2107
- this.setAttribute(FOCUS, true);
2105
+ get focus() {
2106
+ return function () {
2107
+ this.setAttribute(FOCUS, true);
2108
+ };
2109
+ }
2110
+ // 兼容 Vue3,详情请见:https://github.com/NervJS/taro/issues/10579
2111
+ set focus(value) {
2112
+ this.setAttribute(FOCUS, value);
2108
2113
  }
2109
2114
  blur() {
2110
2115
  this.setAttribute(FOCUS, false);
@@ -2136,7 +2141,7 @@ let TaroElement = class TaroElement extends TaroNode {
2136
2141
  qualifiedName = shortcutAttr(qualifiedName);
2137
2142
  const payload = {
2138
2143
  path: `${this._path}.${toCamelCase(qualifiedName)}`,
2139
- value
2144
+ value: isFunction$1(value) ? () => value : value
2140
2145
  };
2141
2146
  (_b = (_a = this.hooks).modifySetAttrPayload) === null || _b === void 0 ? void 0 : _b.call(_a, this, qualifiedName, payload);
2142
2147
  this.enqueueUpdate(payload);
@@ -3966,8 +3971,12 @@ class StyleTagParser {
3966
3971
  // console.log('res this.styles: ', this.styles)
3967
3972
  }
3968
3973
  parseSelector(src) {
3969
- // todo: 属性选择器里可以带空格:[a = "b"],这里的 split(' ') 需要作兼容
3970
- const list = src.trim().replace(/ *([>~+]) */g, ' $1').replace(/ +/g, ' ').split(' ');
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(' ');
3971
3980
  const selectors = list.map(item => {
3972
3981
  const firstChar = item.charAt(0);
3973
3982
  const selector = {
@@ -5013,9 +5022,12 @@ if (process.env.TARO_ENV && process.env.TARO_ENV !== 'h5') {
5013
5022
  if (!(DATE in window$1)) {
5014
5023
  window$1.Date = Date;
5015
5024
  }
5016
- if (!(SET_TIMEOUT in window$1)) {
5017
- window$1.setTimeout = setTimeout;
5018
- }
5025
+ window$1.setTimeout = function (cb, delay) {
5026
+ setTimeout(cb, delay);
5027
+ };
5028
+ window$1.clearTimeout = function (seed) {
5029
+ clearTimeout(seed);
5030
+ };
5019
5031
  }
5020
5032
 
5021
5033
  const Current = {
@@ -5181,7 +5193,7 @@ function createPageConfig(component, pageName, data, pageConfig) {
5181
5193
  let loadResolver;
5182
5194
  let hasLoaded;
5183
5195
  const config = {
5184
- onLoad(options, cb) {
5196
+ onLoad(options = {}, cb) {
5185
5197
  hasLoaded = new Promise(resolve => { loadResolver = resolve; });
5186
5198
  perf.start(PAGE_INIT);
5187
5199
  Current.page = this;
@@ -5968,10 +5980,6 @@ function createVue3Page(h, id) {
5968
5980
  },
5969
5981
  created() {
5970
5982
  injectPageInstance(this, id);
5971
- // vue3 组件 created 时机比小程序页面 onShow 慢,因此在 created 后再手动触发一次 onShow。
5972
- this.$nextTick(() => {
5973
- safeExecute(id, 'onShow');
5974
- });
5975
5983
  }
5976
5984
  };
5977
5985
  if (isArray$1(component.mixins)) {