@tarojs/runtime 4.0.10-beta.0 → 4.1.0-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.
@@ -6,6 +6,13 @@ function getBoundingClientRectImpl() {
6
6
  return Promise.resolve(null);
7
7
  return new Promise(resolve => {
8
8
  const query = options.miniGlobal.createSelectorQuery();
9
+ // ref: https://opendocs.alipay.com/mini/api/na4yun
10
+ if (process.env.TARO_ENV === 'alipay') {
11
+ query.select(`#${this.uid}`).boundingClientRect().exec(res => {
12
+ resolve(res);
13
+ });
14
+ return;
15
+ }
9
16
  query.select(`#${this.uid}`).boundingClientRect(res => {
10
17
  resolve(res);
11
18
  }).exec();
@@ -1 +1 @@
1
- {"version":3,"file":"element.js","sources":["../../src/dom-external/element.ts"],"sourcesContent":["import { DOCUMENT_FRAGMENT } from '../constants'\nimport { options } from '../options'\n\nimport type { TaroElement } from '../dom/element'\n\nexport function getBoundingClientRectImpl (this: TaroElement): Promise<null> {\n if (!options.miniGlobal) return Promise.resolve(null)\n return new Promise(resolve => {\n const query = options.miniGlobal.createSelectorQuery()\n query.select(`#${this.uid}`).boundingClientRect(res => {\n resolve(res)\n }).exec()\n })\n}\n\nexport function getTemplateContent (ctx: TaroElement): TaroElement | undefined {\n if (ctx.nodeName === 'template') {\n const document = ctx.ownerDocument\n const content: TaroElement = document.createElement(DOCUMENT_FRAGMENT)\n content.childNodes = ctx.childNodes\n ctx.childNodes = [content]\n content.parentNode = ctx\n content.childNodes.forEach(nodes => {\n nodes.parentNode = content\n })\n return content\n }\n}\n"],"names":[],"mappings":";;;SAKgB,yBAAyB,GAAA;IACvC,IAAI,CAAC,OAAO,CAAC,UAAU;AAAE,QAAA,OAAO,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAA;AACrD,IAAA,OAAO,IAAI,OAAO,CAAC,OAAO,IAAG;QAC3B,MAAM,KAAK,GAAG,OAAO,CAAC,UAAU,CAAC,mBAAmB,EAAE,CAAA;AACtD,QAAA,KAAK,CAAC,MAAM,CAAC,CAAA,CAAA,EAAI,IAAI,CAAC,GAAG,CAAE,CAAA,CAAC,CAAC,kBAAkB,CAAC,GAAG,IAAG;YACpD,OAAO,CAAC,GAAG,CAAC,CAAA;AACd,SAAC,CAAC,CAAC,IAAI,EAAE,CAAA;AACX,KAAC,CAAC,CAAA;AACJ,CAAC;AAEK,SAAU,kBAAkB,CAAE,GAAgB,EAAA;AAClD,IAAA,IAAI,GAAG,CAAC,QAAQ,KAAK,UAAU,EAAE;AAC/B,QAAA,MAAM,QAAQ,GAAG,GAAG,CAAC,aAAa,CAAA;QAClC,MAAM,OAAO,GAAgB,QAAQ,CAAC,aAAa,CAAC,iBAAiB,CAAC,CAAA;AACtE,QAAA,OAAO,CAAC,UAAU,GAAG,GAAG,CAAC,UAAU,CAAA;AACnC,QAAA,GAAG,CAAC,UAAU,GAAG,CAAC,OAAO,CAAC,CAAA;AAC1B,QAAA,OAAO,CAAC,UAAU,GAAG,GAAG,CAAA;AACxB,QAAA,OAAO,CAAC,UAAU,CAAC,OAAO,CAAC,KAAK,IAAG;AACjC,YAAA,KAAK,CAAC,UAAU,GAAG,OAAO,CAAA;AAC5B,SAAC,CAAC,CAAA;AACF,QAAA,OAAO,OAAO,CAAA;KACf;AACH;;;;"}
1
+ {"version":3,"file":"element.js","sources":["../../src/dom-external/element.ts"],"sourcesContent":["import { DOCUMENT_FRAGMENT } from '../constants'\nimport { options } from '../options'\n\nimport type { TaroElement } from '../dom/element'\n\nexport function getBoundingClientRectImpl (this: TaroElement): Promise<null> {\n if (!options.miniGlobal) return Promise.resolve(null)\n return new Promise(resolve => {\n const query = options.miniGlobal.createSelectorQuery()\n // ref: https://opendocs.alipay.com/mini/api/na4yun\n if (process.env.TARO_ENV === 'alipay') {\n query.select(`#${this.uid}`).boundingClientRect().exec(res => {\n resolve(res)\n })\n return\n }\n\n query.select(`#${this.uid}`).boundingClientRect(res => {\n resolve(res)\n }).exec()\n })\n}\n\nexport function getTemplateContent (ctx: TaroElement): TaroElement | undefined {\n if (ctx.nodeName === 'template') {\n const document = ctx.ownerDocument\n const content: TaroElement = document.createElement(DOCUMENT_FRAGMENT)\n content.childNodes = ctx.childNodes\n ctx.childNodes = [content]\n content.parentNode = ctx\n content.childNodes.forEach(nodes => {\n nodes.parentNode = content\n })\n return content\n }\n}\n"],"names":[],"mappings":";;;SAKgB,yBAAyB,GAAA;IACvC,IAAI,CAAC,OAAO,CAAC,UAAU;AAAE,QAAA,OAAO,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAA;AACrD,IAAA,OAAO,IAAI,OAAO,CAAC,OAAO,IAAG;QAC3B,MAAM,KAAK,GAAG,OAAO,CAAC,UAAU,CAAC,mBAAmB,EAAE,CAAA;;QAEtD,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,QAAQ,EAAE;AACrC,YAAA,KAAK,CAAC,MAAM,CAAC,CAAI,CAAA,EAAA,IAAI,CAAC,GAAG,CAAA,CAAE,CAAC,CAAC,kBAAkB,EAAE,CAAC,IAAI,CAAC,GAAG,IAAG;gBAC3D,OAAO,CAAC,GAAG,CAAC,CAAA;AACd,aAAC,CAAC,CAAA;YACF,OAAM;SACP;AAED,QAAA,KAAK,CAAC,MAAM,CAAC,CAAA,CAAA,EAAI,IAAI,CAAC,GAAG,CAAE,CAAA,CAAC,CAAC,kBAAkB,CAAC,GAAG,IAAG;YACpD,OAAO,CAAC,GAAG,CAAC,CAAA;AACd,SAAC,CAAC,CAAC,IAAI,EAAE,CAAA;AACX,KAAC,CAAC,CAAA;AACJ,CAAC;AAEK,SAAU,kBAAkB,CAAE,GAAgB,EAAA;AAClD,IAAA,IAAI,GAAG,CAAC,QAAQ,KAAK,UAAU,EAAE;AAC/B,QAAA,MAAM,QAAQ,GAAG,GAAG,CAAC,aAAa,CAAA;QAClC,MAAM,OAAO,GAAgB,QAAQ,CAAC,aAAa,CAAC,iBAAiB,CAAC,CAAA;AACtE,QAAA,OAAO,CAAC,UAAU,GAAG,GAAG,CAAC,UAAU,CAAA;AACnC,QAAA,GAAG,CAAC,UAAU,GAAG,CAAC,OAAO,CAAC,CAAA;AAC1B,QAAA,OAAO,CAAC,UAAU,GAAG,GAAG,CAAA;AACxB,QAAA,OAAO,CAAC,UAAU,CAAC,OAAO,CAAC,KAAK,IAAG;AACjC,YAAA,KAAK,CAAC,UAAU,GAAG,OAAO,CAAA;AAC5B,SAAC,CAAC,CAAA;AACF,QAAA,OAAO,OAAO,CAAA;KACf;AACH;;;;"}
package/dist/index.cjs.js CHANGED
@@ -3245,6 +3245,13 @@ function getBoundingClientRectImpl() {
3245
3245
  return Promise.resolve(null);
3246
3246
  return new Promise(resolve => {
3247
3247
  const query = options.miniGlobal.createSelectorQuery();
3248
+ // ref: https://opendocs.alipay.com/mini/api/na4yun
3249
+ if (process.env.TARO_ENV === 'alipay') {
3250
+ query.select(`#${this.uid}`).boundingClientRect().exec(res => {
3251
+ resolve(res);
3252
+ });
3253
+ return;
3254
+ }
3248
3255
  query.select(`#${this.uid}`).boundingClientRect(res => {
3249
3256
  resolve(res);
3250
3257
  }).exec();