@tarojs/runtime 4.0.0-alpha.37 → 4.0.0-alpha.39

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/bom/raf.js CHANGED
@@ -17,12 +17,12 @@ let now;
17
17
  let lastTime = 0;
18
18
  // https://gist.github.com/paulirish/1579671
19
19
  // https://gist.github.com/jalbam/5fe05443270fa6d8136238ec72accbc0
20
- const _raf = typeof requestAnimationFrame !== 'undefined' && requestAnimationFrame !== null ? requestAnimationFrame : function (callback) {
20
+ const _raf = process.env.TARO_PLATFORM === 'web' ? requestAnimationFrame : function (callback) {
21
21
  const _now = now();
22
22
  const nextTime = Math.max(lastTime + 16, _now); // First time will execute it immediately but barely noticeable and performance is gained.
23
23
  return setTimeout(function () { callback(lastTime = nextTime); }, nextTime - _now);
24
24
  };
25
- const _caf = typeof cancelAnimationFrame !== 'undefined' && cancelAnimationFrame !== null
25
+ const _caf = process.env.TARO_PLATFORM === 'web'
26
26
  ? cancelAnimationFrame
27
27
  : function (seed) {
28
28
  // fix https://github.com/NervJS/taro/issues/7749
@@ -1 +1 @@
1
- {"version":3,"file":"raf.js","sources":["../../src/bom/raf.ts"],"sourcesContent":["// https://github.com/myrne/performance-now\nexport let now: () => number\n\n(function () {\n let loadTime\n if ((typeof performance !== 'undefined' && performance !== null) && performance.now) {\n now = () => performance.now()\n } else if (Date.now) {\n loadTime = Date.now()\n now = () => Date.now() - loadTime\n } else {\n loadTime = new Date().getTime()\n now = () => new Date().getTime() - loadTime\n }\n})()\n\nlet lastTime = 0\n\n// https://gist.github.com/paulirish/1579671\n// https://gist.github.com/jalbam/5fe05443270fa6d8136238ec72accbc0\nconst _raf = typeof requestAnimationFrame !== 'undefined' && requestAnimationFrame !== null ? requestAnimationFrame : function (callback) {\n const _now = now()\n const nextTime = Math.max(lastTime + 16, _now) // First time will execute it immediately but barely noticeable and performance is gained.\n return setTimeout(function () { callback(lastTime = nextTime) }, nextTime - _now)\n}\n\nconst _caf = typeof cancelAnimationFrame !== 'undefined' && cancelAnimationFrame !== null\n ? cancelAnimationFrame\n : function (seed) {\n // fix https://github.com/NervJS/taro/issues/7749\n clearTimeout(seed)\n }\n\nexport {\n _caf as caf,\n _raf as raf\n}\n"],"names":[],"mappings":"AAAA;AACW,IAAA,IAAiB;AAE5B,CAAC,YAAA;AACC,IAAA,IAAI,QAAQ,CAAA;AACZ,IAAA,IAAI,CAAC,OAAO,WAAW,KAAK,WAAW,IAAI,WAAW,KAAK,IAAI,KAAK,WAAW,CAAC,GAAG,EAAE;QACnF,GAAG,GAAG,MAAM,WAAW,CAAC,GAAG,EAAE,CAAA;KAC9B;AAAM,SAAA,IAAI,IAAI,CAAC,GAAG,EAAE;AACnB,QAAA,QAAQ,GAAG,IAAI,CAAC,GAAG,EAAE,CAAA;QACrB,GAAG,GAAG,MAAM,IAAI,CAAC,GAAG,EAAE,GAAG,QAAQ,CAAA;KAClC;SAAM;AACL,QAAA,QAAQ,GAAG,IAAI,IAAI,EAAE,CAAC,OAAO,EAAE,CAAA;AAC/B,QAAA,GAAG,GAAG,MAAM,IAAI,IAAI,EAAE,CAAC,OAAO,EAAE,GAAG,QAAQ,CAAA;KAC5C;AACH,CAAC,GAAG,CAAA;AAEJ,IAAI,QAAQ,GAAG,CAAC,CAAA;AAEhB;AACA;AACA,MAAM,IAAI,GAAG,OAAO,qBAAqB,KAAK,WAAW,IAAI,qBAAqB,KAAK,IAAI,GAAG,qBAAqB,GAAG,UAAU,QAAQ,EAAA;AACtI,IAAA,MAAM,IAAI,GAAG,GAAG,EAAE,CAAA;AAClB,IAAA,MAAM,QAAQ,GAAG,IAAI,CAAC,GAAG,CAAC,QAAQ,GAAG,EAAE,EAAE,IAAI,CAAC,CAAA;AAC9C,IAAA,OAAO,UAAU,CAAC,YAAA,EAAc,QAAQ,CAAC,QAAQ,GAAG,QAAQ,CAAC,CAAA,EAAE,EAAE,QAAQ,GAAG,IAAI,CAAC,CAAA;AACnF,EAAC;AAEK,MAAA,IAAI,GAAG,OAAO,oBAAoB,KAAK,WAAW,IAAI,oBAAoB,KAAK,IAAI;AACvF,MAAE,oBAAoB;MACpB,UAAU,IAAI,EAAA;;QAEd,YAAY,CAAC,IAAI,CAAC,CAAA;AACpB;;;;"}
1
+ {"version":3,"file":"raf.js","sources":["../../src/bom/raf.ts"],"sourcesContent":["// https://github.com/myrne/performance-now\nexport let now: () => number\n\n(function () {\n let loadTime\n if ((typeof performance !== 'undefined' && performance !== null) && performance.now) {\n now = () => performance.now()\n } else if (Date.now) {\n loadTime = Date.now()\n now = () => Date.now() - loadTime\n } else {\n loadTime = new Date().getTime()\n now = () => new Date().getTime() - loadTime\n }\n})()\n\nlet lastTime = 0\n\n// https://gist.github.com/paulirish/1579671\n// https://gist.github.com/jalbam/5fe05443270fa6d8136238ec72accbc0\nconst _raf = process.env.TARO_PLATFORM === 'web' ? requestAnimationFrame : function (callback) {\n const _now = now()\n const nextTime = Math.max(lastTime + 16, _now) // First time will execute it immediately but barely noticeable and performance is gained.\n return setTimeout(function () { callback(lastTime = nextTime) }, nextTime - _now)\n}\n\nconst _caf = process.env.TARO_PLATFORM === 'web'\n ? cancelAnimationFrame\n : function (seed) {\n // fix https://github.com/NervJS/taro/issues/7749\n clearTimeout(seed)\n }\n\nexport {\n _caf as caf,\n _raf as raf\n}\n"],"names":[],"mappings":"AAAA;AACW,IAAA,IAAiB;AAE5B,CAAC,YAAA;AACC,IAAA,IAAI,QAAQ,CAAA;AACZ,IAAA,IAAI,CAAC,OAAO,WAAW,KAAK,WAAW,IAAI,WAAW,KAAK,IAAI,KAAK,WAAW,CAAC,GAAG,EAAE;QACnF,GAAG,GAAG,MAAM,WAAW,CAAC,GAAG,EAAE,CAAA;KAC9B;AAAM,SAAA,IAAI,IAAI,CAAC,GAAG,EAAE;AACnB,QAAA,QAAQ,GAAG,IAAI,CAAC,GAAG,EAAE,CAAA;QACrB,GAAG,GAAG,MAAM,IAAI,CAAC,GAAG,EAAE,GAAG,QAAQ,CAAA;KAClC;SAAM;AACL,QAAA,QAAQ,GAAG,IAAI,IAAI,EAAE,CAAC,OAAO,EAAE,CAAA;AAC/B,QAAA,GAAG,GAAG,MAAM,IAAI,IAAI,EAAE,CAAC,OAAO,EAAE,GAAG,QAAQ,CAAA;KAC5C;AACH,CAAC,GAAG,CAAA;AAEJ,IAAI,QAAQ,GAAG,CAAC,CAAA;AAEhB;AACA;AACA,MAAM,IAAI,GAAG,OAAO,CAAC,GAAG,CAAC,aAAa,KAAK,KAAK,GAAG,qBAAqB,GAAG,UAAU,QAAQ,EAAA;AAC3F,IAAA,MAAM,IAAI,GAAG,GAAG,EAAE,CAAA;AAClB,IAAA,MAAM,QAAQ,GAAG,IAAI,CAAC,GAAG,CAAC,QAAQ,GAAG,EAAE,EAAE,IAAI,CAAC,CAAA;AAC9C,IAAA,OAAO,UAAU,CAAC,YAAA,EAAc,QAAQ,CAAC,QAAQ,GAAG,QAAQ,CAAC,CAAA,EAAE,EAAE,QAAQ,GAAG,IAAI,CAAC,CAAA;AACnF,EAAC;AAEK,MAAA,IAAI,GAAG,OAAO,CAAC,GAAG,CAAC,aAAa,KAAK,KAAK;AAC9C,MAAE,oBAAoB;MACpB,UAAU,IAAI,EAAA;;QAEd,YAAY,CAAC,IAAI,CAAC,CAAA;AACpB;;;;"}
@@ -4,9 +4,7 @@ import { setInnerHTML } from './inner-html/html.js';
4
4
  import { getBoundingClientRectImpl, getTemplateContent } from './element.js';
5
5
  import { insertAdjacentHTML, cloneNode, contains } from './node.js';
6
6
 
7
- const isWeb = process.env.TARO_PLATFORM === 'web';
8
- const isHarmony = process.env.TARO_PLATFORM === 'harmony' || process.env.TARO_ENV === 'harmony';
9
- if (!isWeb && !isHarmony) {
7
+ if (process.env.TARO_PLATFORM !== 'web' && !(process.env.TARO_PLATFORM === 'harmony' || process.env.TARO_ENV === 'harmony')) {
10
8
  if (ENABLE_INNER_HTML) {
11
9
  TaroNode.extend('innerHTML', {
12
10
  set(html) {
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../src/dom-external/index.ts"],"sourcesContent":["import { TaroElement } from '../dom/element'\nimport { TaroNode } from '../dom/node'\nimport { setInnerHTML } from '../dom-external/inner-html/html'\nimport { getBoundingClientRectImpl, getTemplateContent } from './element'\nimport { cloneNode, contains, insertAdjacentHTML } from './node'\n\ndeclare const ENABLE_INNER_HTML: boolean\ndeclare const ENABLE_ADJACENT_HTML: boolean\ndeclare const ENABLE_CLONE_NODE: boolean\ndeclare const ENABLE_CONTAINS: boolean\n\ndeclare const ENABLE_SIZE_APIS: boolean\ndeclare const ENABLE_TEMPLATE_CONTENT: boolean\n\nconst isWeb = process.env.TARO_PLATFORM === 'web'\nconst isHarmony = process.env.TARO_PLATFORM === 'harmony' || process.env.TARO_ENV === 'harmony'\nif (!isWeb && !isHarmony) {\n if (ENABLE_INNER_HTML) {\n TaroNode.extend('innerHTML', {\n set (html: string) {\n setInnerHTML.call(this, this, html)\n },\n get (): string {\n return ''\n }\n })\n\n if (ENABLE_ADJACENT_HTML) {\n TaroNode.extend('insertAdjacentHTML', insertAdjacentHTML)\n }\n }\n\n if (ENABLE_CLONE_NODE) {\n TaroNode.extend('cloneNode', cloneNode)\n }\n\n if (ENABLE_CONTAINS) {\n TaroNode.extend('contains', contains)\n }\n\n if (ENABLE_SIZE_APIS) {\n TaroElement.extend('getBoundingClientRect', getBoundingClientRectImpl)\n }\n\n if (ENABLE_TEMPLATE_CONTENT) {\n TaroElement.extend('content', {\n get () {\n return getTemplateContent(this)\n }\n })\n }\n}\n"],"names":[],"mappings":";;;;;;AAcA,MAAM,KAAK,GAAG,OAAO,CAAC,GAAG,CAAC,aAAa,KAAK,KAAK,CAAA;AACjD,MAAM,SAAS,GAAG,OAAO,CAAC,GAAG,CAAC,aAAa,KAAK,SAAS,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,SAAS,CAAA;AAC/F,IAAI,CAAC,KAAK,IAAI,CAAC,SAAS,EAAE;IACxB,IAAI,iBAAiB,EAAE;AACrB,QAAA,QAAQ,CAAC,MAAM,CAAC,WAAW,EAAE;AAC3B,YAAA,GAAG,CAAE,IAAY,EAAA;gBACf,YAAY,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,CAAA;aACpC;YACD,GAAG,GAAA;AACD,gBAAA,OAAO,EAAE,CAAA;aACV;AACF,SAAA,CAAC,CAAA;QAEF,IAAI,oBAAoB,EAAE;AACxB,YAAA,QAAQ,CAAC,MAAM,CAAC,oBAAoB,EAAE,kBAAkB,CAAC,CAAA;SAC1D;KACF;IAED,IAAI,iBAAiB,EAAE;AACrB,QAAA,QAAQ,CAAC,MAAM,CAAC,WAAW,EAAE,SAAS,CAAC,CAAA;KACxC;IAED,IAAI,eAAe,EAAE;AACnB,QAAA,QAAQ,CAAC,MAAM,CAAC,UAAU,EAAE,QAAQ,CAAC,CAAA;KACtC;IAED,IAAI,gBAAgB,EAAE;AACpB,QAAA,WAAW,CAAC,MAAM,CAAC,uBAAuB,EAAE,yBAAyB,CAAC,CAAA;KACvE;IAED,IAAI,uBAAuB,EAAE;AAC3B,QAAA,WAAW,CAAC,MAAM,CAAC,SAAS,EAAE;YAC5B,GAAG,GAAA;AACD,gBAAA,OAAO,kBAAkB,CAAC,IAAI,CAAC,CAAA;aAChC;AACF,SAAA,CAAC,CAAA;KACH;AACH"}
1
+ {"version":3,"file":"index.js","sources":["../../src/dom-external/index.ts"],"sourcesContent":["import { TaroElement } from '../dom/element'\nimport { TaroNode } from '../dom/node'\nimport { setInnerHTML } from '../dom-external/inner-html/html'\nimport { getBoundingClientRectImpl, getTemplateContent } from './element'\nimport { cloneNode, contains, insertAdjacentHTML } from './node'\n\ndeclare const ENABLE_INNER_HTML: boolean\ndeclare const ENABLE_ADJACENT_HTML: boolean\ndeclare const ENABLE_CLONE_NODE: boolean\ndeclare const ENABLE_CONTAINS: boolean\n\ndeclare const ENABLE_SIZE_APIS: boolean\ndeclare const ENABLE_TEMPLATE_CONTENT: boolean\n\nif (process.env.TARO_PLATFORM !== 'web' && !(process.env.TARO_PLATFORM === 'harmony' || process.env.TARO_ENV === 'harmony')) {\n if (ENABLE_INNER_HTML) {\n TaroNode.extend('innerHTML', {\n set (html: string) {\n setInnerHTML.call(this, this, html)\n },\n get (): string {\n return ''\n }\n })\n\n if (ENABLE_ADJACENT_HTML) {\n TaroNode.extend('insertAdjacentHTML', insertAdjacentHTML)\n }\n }\n\n if (ENABLE_CLONE_NODE) {\n TaroNode.extend('cloneNode', cloneNode)\n }\n\n if (ENABLE_CONTAINS) {\n TaroNode.extend('contains', contains)\n }\n\n if (ENABLE_SIZE_APIS) {\n TaroElement.extend('getBoundingClientRect', getBoundingClientRectImpl)\n }\n\n if (ENABLE_TEMPLATE_CONTENT) {\n TaroElement.extend('content', {\n get () {\n return getTemplateContent(this)\n }\n })\n }\n}\n"],"names":[],"mappings":";;;;;;AAcA,IAAI,OAAO,CAAC,GAAG,CAAC,aAAa,KAAK,KAAK,IAAI,EAAE,OAAO,CAAC,GAAG,CAAC,aAAa,KAAK,SAAS,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,SAAS,CAAC,EAAE;IAC3H,IAAI,iBAAiB,EAAE;AACrB,QAAA,QAAQ,CAAC,MAAM,CAAC,WAAW,EAAE;AAC3B,YAAA,GAAG,CAAE,IAAY,EAAA;gBACf,YAAY,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,CAAA;aACpC;YACD,GAAG,GAAA;AACD,gBAAA,OAAO,EAAE,CAAA;aACV;AACF,SAAA,CAAC,CAAA;QAEF,IAAI,oBAAoB,EAAE;AACxB,YAAA,QAAQ,CAAC,MAAM,CAAC,oBAAoB,EAAE,kBAAkB,CAAC,CAAA;SAC1D;KACF;IAED,IAAI,iBAAiB,EAAE;AACrB,QAAA,QAAQ,CAAC,MAAM,CAAC,WAAW,EAAE,SAAS,CAAC,CAAA;KACxC;IAED,IAAI,eAAe,EAAE;AACnB,QAAA,QAAQ,CAAC,MAAM,CAAC,UAAU,EAAE,QAAQ,CAAC,CAAA;KACtC;IAED,IAAI,gBAAgB,EAAE;AACpB,QAAA,WAAW,CAAC,MAAM,CAAC,uBAAuB,EAAE,yBAAyB,CAAC,CAAA;KACvE;IAED,IAAI,uBAAuB,EAAE;AAC3B,QAAA,WAAW,CAAC,MAAM,CAAC,SAAS,EAAE;YAC5B,GAAG,GAAA;AACD,gBAAA,OAAO,kBAAkB,CAAC,IAAI,CAAC,CAAA;aAChC;AACF,SAAA,CAAC,CAAA;KACH;AACH"}
package/dist/index.cjs.js CHANGED
@@ -992,12 +992,12 @@ exports.now = void 0;
992
992
  let lastTime = 0;
993
993
  // https://gist.github.com/paulirish/1579671
994
994
  // https://gist.github.com/jalbam/5fe05443270fa6d8136238ec72accbc0
995
- const _raf = typeof requestAnimationFrame !== 'undefined' && requestAnimationFrame !== null ? requestAnimationFrame : function (callback) {
995
+ const _raf = process.env.TARO_PLATFORM === 'web' ? requestAnimationFrame : function (callback) {
996
996
  const _now = exports.now();
997
997
  const nextTime = Math.max(lastTime + 16, _now); // First time will execute it immediately but barely noticeable and performance is gained.
998
998
  return setTimeout(function () { callback(lastTime = nextTime); }, nextTime - _now);
999
999
  };
1000
- const _caf = typeof cancelAnimationFrame !== 'undefined' && cancelAnimationFrame !== null
1000
+ const _caf = process.env.TARO_PLATFORM === 'web'
1001
1001
  ? cancelAnimationFrame
1002
1002
  : function (seed) {
1003
1003
  // fix https://github.com/NervJS/taro/issues/7749
@@ -3318,9 +3318,7 @@ function contains(node) {
3318
3318
  return isContains;
3319
3319
  }
3320
3320
 
3321
- const isWeb = process.env.TARO_PLATFORM === 'web';
3322
- const isHarmony = process.env.TARO_PLATFORM === 'harmony' || process.env.TARO_ENV === 'harmony';
3323
- if (!isWeb && !isHarmony) {
3321
+ if (process.env.TARO_PLATFORM !== 'web' && !(process.env.TARO_PLATFORM === 'harmony' || process.env.TARO_ENV === 'harmony')) {
3324
3322
  if (ENABLE_INNER_HTML) {
3325
3323
  TaroNode.extend('innerHTML', {
3326
3324
  set(html) {