@tarojs/runtime 4.0.0-beta.1 → 4.0.0-beta.2
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 +14 -0
- package/dist/bom/URL.d.ts +54 -0
- package/dist/bom/URL.js +221 -0
- package/dist/bom/URL.js.map +1 -0
- package/dist/bom/URLSearchParams.d.ts +2 -0
- package/dist/bom/URLSearchParams.js +123 -0
- package/dist/bom/URLSearchParams.js.map +1 -0
- package/dist/bom/document.d.ts +3 -0
- package/dist/bom/document.js +39 -0
- package/dist/bom/document.js.map +1 -0
- package/dist/bom/getComputedStyle.d.ts +5 -0
- package/dist/bom/getComputedStyle.js +8 -0
- package/dist/bom/getComputedStyle.js.map +1 -0
- package/dist/bom/history.d.ts +32 -0
- package/dist/bom/history.js +121 -0
- package/dist/bom/history.js.map +1 -0
- package/dist/bom/location.d.ts +39 -0
- package/dist/bom/location.js +240 -0
- package/dist/bom/location.js.map +1 -0
- package/dist/bom/navigator.d.ts +2 -0
- package/dist/bom/navigator.js +24 -0
- package/dist/bom/navigator.js.map +1 -0
- package/dist/bom/raf.d.ts +4 -0
- package/dist/bom/raf.js +33 -0
- package/dist/bom/raf.js.map +1 -0
- package/dist/bom/window.d.ts +25 -0
- package/dist/bom/window.js +92 -0
- package/dist/bom/window.js.map +1 -0
- package/dist/constants/index.d.ts +60 -0
- package/dist/constants/index.js +63 -0
- package/dist/constants/index.js.map +1 -0
- package/dist/current.d.ts +19 -0
- package/dist/current.js +9 -0
- package/dist/current.js.map +1 -0
- package/dist/dom/anchor-element.d.ts +14 -0
- package/dist/dom/anchor-element.js +54 -0
- package/dist/dom/anchor-element.js.map +1 -0
- package/dist/dom/class-list.d.ts +17 -0
- package/dist/dom/class-list.js +92 -0
- package/dist/dom/class-list.js.map +1 -0
- package/dist/dom/document.d.ts +25 -0
- package/dist/dom/document.js +80 -0
- package/dist/dom/document.js.map +1 -0
- package/dist/dom/element.d.ts +40 -0
- package/dist/dom/element.js +315 -0
- package/dist/dom/element.js.map +1 -0
- package/dist/dom/event-source.d.ts +7 -0
- package/dist/dom/event-source.js +17 -0
- package/dist/dom/event-source.js.map +1 -0
- package/dist/dom/event-target.d.ts +8 -0
- package/dist/dom/event-target.js +78 -0
- package/dist/dom/event-target.js.map +1 -0
- package/dist/dom/event.d.ts +24 -0
- package/dist/dom/event.js +151 -0
- package/dist/dom/event.js.map +1 -0
- package/dist/dom/form.d.ts +10 -0
- package/dist/dom/form.js +38 -0
- package/dist/dom/form.js.map +1 -0
- package/dist/dom/node.d.ts +107 -0
- package/dist/dom/node.js +292 -0
- package/dist/dom/node.js.map +1 -0
- package/dist/dom/root.d.ts +16 -0
- package/dist/dom/root.js +169 -0
- package/dist/dom/root.js.map +1 -0
- package/dist/dom/style.d.ts +15 -0
- package/dist/dom/style.js +168 -0
- package/dist/dom/style.js.map +1 -0
- package/dist/dom/style_properties.d.ts +3 -0
- package/dist/dom/style_properties.js +186 -0
- package/dist/dom/style_properties.js.map +1 -0
- package/dist/dom/svg.d.ts +4 -0
- package/dist/dom/svg.js +8 -0
- package/dist/dom/svg.js.map +1 -0
- package/dist/dom/text.d.ts +15 -0
- package/dist/dom/text.js +41 -0
- package/dist/dom/text.js.map +1 -0
- package/dist/dom/transfer.d.ts +8 -0
- package/dist/dom/transfer.js +15 -0
- package/dist/dom/transfer.js.map +1 -0
- package/dist/dom/tree.d.ts +4 -0
- package/dist/dom/tree.js +38 -0
- package/dist/dom/tree.js.map +1 -0
- package/dist/dom-external/element.d.ts +4 -0
- package/dist/dom-external/element.js +29 -0
- package/dist/dom-external/element.js.map +1 -0
- package/dist/dom-external/index.d.ts +1 -0
- package/dist/dom-external/index.js +40 -0
- package/dist/dom-external/index.js.map +1 -0
- package/dist/dom-external/inner-html/html.d.ts +3 -0
- package/dist/dom-external/inner-html/html.js +28 -0
- package/dist/dom-external/inner-html/html.js.map +1 -0
- package/dist/dom-external/inner-html/parser.d.ts +25 -0
- package/dist/dom-external/inner-html/parser.js +216 -0
- package/dist/dom-external/inner-html/parser.js.map +1 -0
- package/dist/dom-external/inner-html/scaner.d.ts +30 -0
- package/dist/dom-external/inner-html/scaner.js +304 -0
- package/dist/dom-external/inner-html/scaner.js.map +1 -0
- package/dist/dom-external/inner-html/style.d.ts +27 -0
- package/dist/dom-external/inner-html/style.js +235 -0
- package/dist/dom-external/inner-html/style.js.map +1 -0
- package/dist/dom-external/inner-html/tags.d.ts +9 -0
- package/dist/dom-external/inner-html/tags.js +26 -0
- package/dist/dom-external/inner-html/tags.js.map +1 -0
- package/dist/dom-external/inner-html/utils.d.ts +2 -0
- package/dist/dom-external/inner-html/utils.js +12 -0
- package/dist/dom-external/inner-html/utils.js.map +1 -0
- package/dist/dom-external/mutation-observer/implements.d.ts +71 -0
- package/dist/dom-external/mutation-observer/implements.js +108 -0
- package/dist/dom-external/mutation-observer/implements.js.map +1 -0
- package/dist/dom-external/mutation-observer/index.d.ts +12 -0
- package/dist/dom-external/mutation-observer/index.js +35 -0
- package/dist/dom-external/mutation-observer/index.js.map +1 -0
- package/dist/dom-external/node.d.ts +12 -0
- package/dist/dom-external/node.js +74 -0
- package/dist/dom-external/node.js.map +1 -0
- package/dist/dsl/common.d.ts +15 -0
- package/dist/dsl/common.js +332 -0
- package/dist/dsl/common.js.map +1 -0
- package/dist/emitter/emitter.d.ts +4 -0
- package/dist/emitter/emitter.js +7 -0
- package/dist/emitter/emitter.js.map +1 -0
- package/dist/env.d.ts +7 -0
- package/dist/env.js +9 -0
- package/dist/env.js.map +1 -0
- package/dist/hydrate.d.ts +11 -0
- package/dist/hydrate.js +84 -0
- package/dist/hydrate.js.map +1 -0
- package/dist/index-26658829.d.ts +23 -0
- package/dist/{runtime.cjs.d.ts → index.cjs.d.ts} +92 -89
- package/dist/{runtime.h5.js → index.cjs.js} +4251 -2493
- package/dist/index.cjs.js.map +1 -0
- package/dist/index.d.ts +33 -0
- package/dist/index.js +34 -0
- package/dist/index.js.map +1 -0
- package/dist/instance-4c64b022.d.ts +92 -0
- package/dist/next-tick.d.ts +3 -0
- package/dist/next-tick.js +47 -0
- package/dist/next-tick.js.map +1 -0
- package/dist/node_types-9ac5b4dd.d.ts +11 -0
- package/dist/options-4c64b022.d.ts +17 -0
- package/dist/options.d.ts +3 -0
- package/dist/options.js +7 -0
- package/dist/options.js.map +1 -0
- package/dist/perf.d.ts +7 -0
- package/dist/perf.js +28 -0
- package/dist/perf.js.map +1 -0
- package/dist/polyfill/array.d.ts +3 -0
- package/dist/polyfill/array.js +56 -0
- package/dist/polyfill/array.js.map +1 -0
- package/dist/polyfill/index.d.ts +2 -0
- package/dist/polyfill/index.js +34 -0
- package/dist/polyfill/index.js.map +1 -0
- package/dist/polyfill/intersection-observer.d.ts +2 -0
- package/dist/polyfill/intersection-observer.js +599 -0
- package/dist/polyfill/intersection-observer.js.map +1 -0
- package/dist/polyfill/object.d.ts +4 -0
- package/dist/polyfill/object.js +102 -0
- package/dist/polyfill/object.js.map +1 -0
- package/dist/record-32b054d8.d.ts +25 -0
- package/dist/runtime.esm.d.ts +92 -89
- package/dist/runtime.esm.js +4077 -3317
- package/dist/runtime.esm.js.map +1 -1
- package/dist/utils/cache.d.ts +13 -0
- package/dist/utils/cache.js +27 -0
- package/dist/utils/cache.js.map +1 -0
- package/dist/utils/index.d.ts +26 -0
- package/dist/utils/index.js +99 -0
- package/dist/utils/index.js.map +1 -0
- package/dist/utils/lodash.d.ts +2 -0
- package/dist/utils/lodash.js +22 -0
- package/dist/utils/lodash.js.map +1 -0
- package/dist/utils/router.d.ts +8 -0
- package/dist/utils/router.js +24 -0
- package/dist/utils/router.js.map +1 -0
- package/package.json +16 -11
- package/dist/runtime.cjs.js +0 -4628
- package/dist/runtime.h5.d.ts +0 -800
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"intersection-observer.js","sources":["../../src/polyfill/intersection-observer.ts"],"sourcesContent":["/* eslint-disable eqeqeq */\nimport { isFunction, isNumber } from '@tarojs/shared'\n\nimport { throttle } from '../utils'\n\nexport function handleIntersectionObserverPolyfill () {\n // Exit early if all IntersectionObserver and IntersectionObserverEntry\n // features are natively supported.\n if (\n 'IntersectionObserver' in window &&\n 'IntersectionObserverEntry' in window &&\n 'intersectionRatio' in window.IntersectionObserverEntry.prototype\n ) {\n if (!('isIntersecting' in window.IntersectionObserverEntry.prototype)) {\n // Minimal polyfill for Edge 15's lack of `isIntersecting`\n // See: https://github.com/w3c/IntersectionObserver/issues/211\n Object.defineProperty(window.IntersectionObserverEntry.prototype, 'isIntersecting', {\n get: function () {\n return this.intersectionRatio > 0\n }\n })\n }\n } else {\n handleIntersectionObserverObjectPolyfill()\n }\n}\n\nfunction handleIntersectionObserverObjectPolyfill () {\n const document = window.document\n\n /**\n * An IntersectionObserver registry. This registry exists to hold a strong\n * reference to IntersectionObserver instances currently observing a target\n * element. Without this registry, instances without another reference may be\n * garbage collected.\n */\n const registry: number[] = []\n\n /**\n * Creates the global IntersectionObserverEntry constructor.\n * https://w3c.github.io/IntersectionObserver/#intersection-observer-entry\n * @param {Object} entry A dictionary of instance properties.\n * @constructor\n */\n function IntersectionObserverEntry (entry: IntersectionObserverEntryInit) {\n this.time = entry.time\n this.target = entry.target\n this.rootBounds = entry.rootBounds\n this.boundingClientRect = entry.boundingClientRect\n this.intersectionRect = entry.intersectionRect || getEmptyRect()\n this.isIntersecting = !!entry.intersectionRect\n\n // Calculates the intersection ratio.\n const targetRect = this.boundingClientRect\n const targetArea = targetRect.width * targetRect.height\n const intersectionRect = this.intersectionRect\n const intersectionArea = intersectionRect.width * intersectionRect.height\n\n // Sets intersection ratio.\n if (targetArea) {\n // Round the intersection ratio to avoid floating point math issues:\n // https://github.com/w3c/IntersectionObserver/issues/324\n this.intersectionRatio = Number((intersectionArea / targetArea).toFixed(4))\n } else {\n // If area is zero and is intersecting, sets to 1, otherwise to 0\n this.intersectionRatio = this.isIntersecting ? 1 : 0\n }\n }\n\n /**\n * Creates the global IntersectionObserver constructor.\n * https://w3c.github.io/IntersectionObserver/#intersection-observer-interface\n * @param {Function} callback The function to be invoked after intersection\n * changes have queued. The function is not invoked if the queue has\n * been emptied by calling the `takeRecords` method.\n * @param {Object=} opt_options Optional configuration options.\n * @constructor\n */\n function IntersectionObserver (callback: IntersectionObserverCallback, options: IntersectionObserverInit = {}) {\n if (!isFunction(callback)) {\n throw new Error('callback must be a function')\n }\n\n if (options.root && options.root.nodeType != 1) {\n throw new Error('root must be an Element')\n }\n\n // Binds and throttles `this._checkForIntersections`.\n this._checkForIntersections = throttle(\n this._checkForIntersections.bind(this), this.THROTTLE_TIMEOUT)\n\n // Private properties.\n this._callback = callback\n this._observationTargets = []\n this._queuedEntries = []\n this._rootMarginValues = this._parseRootMargin(options.rootMargin)\n\n // Public properties.\n this.thresholds = this._initThresholds(options.threshold)\n this.root = options.root || null\n this.rootMargin = this._rootMarginValues.map(function (margin) {\n return margin.value + margin.unit\n }).join(' ')\n }\n\n /**\n * The minimum interval within which the document will be checked for\n * intersection changes.\n */\n IntersectionObserver.prototype.THROTTLE_TIMEOUT = 100\n\n /**\n * The frequency in which the polyfill polls for intersection changes.\n * this can be updated on a per instance basis and must be set prior to\n * calling `observe` on the first target.\n */\n IntersectionObserver.prototype.POLL_INTERVAL = null\n\n /**\n * Use a mutation observer on the root element\n * to detect intersection changes.\n */\n IntersectionObserver.prototype.USE_MUTATION_OBSERVER = true\n\n /**\n * Starts observing a target element for intersection changes based on\n * the thresholds values.\n * @param {Element} target The DOM element to observe.\n */\n IntersectionObserver.prototype.observe = function (target) {\n const isTargetAlreadyObserved = this._observationTargets.some(function (item) {\n return item.element == target\n })\n\n if (isTargetAlreadyObserved) return\n\n if (!(target && target.nodeType == 1)) {\n throw new Error('target must be an Element')\n }\n\n this._registerInstance()\n this._observationTargets.push({ element: target, entry: null })\n this._monitorIntersections()\n this._checkForIntersections()\n }\n\n /**\n * Stops observing a target element for intersection changes.\n * @param {Element} target The DOM element to observe.\n */\n IntersectionObserver.prototype.unobserve = function (target) {\n this._observationTargets =\n this._observationTargets.filter(function (item) {\n return item.element != target\n })\n if (!this._observationTargets.length) {\n this._unmonitorIntersections()\n this._unregisterInstance()\n }\n }\n\n /**\n * Stops observing all target elements for intersection changes.\n */\n IntersectionObserver.prototype.disconnect = function () {\n this._observationTargets = []\n this._unmonitorIntersections()\n this._unregisterInstance()\n }\n\n /**\n * Returns any queue entries that have not yet been reported to the\n * callback and clears the queue. This can be used in conjunction with the\n * callback to obtain the absolute most up-to-date intersection information.\n * @return {Array} The currently queued entries.\n */\n IntersectionObserver.prototype.takeRecords = function () {\n const records = this._queuedEntries.slice()\n this._queuedEntries = []\n return records\n }\n\n /**\n * Accepts the threshold value from the user configuration object and\n * returns a sorted array of unique threshold values. If a value is not\n * between 0 and 1 and error is thrown.\n * @private\n * @param {Array|number=} opt_threshold An optional threshold value or\n * a list of threshold values, defaulting to [0].\n * @return {Array} A sorted list of unique and valid threshold values.\n */\n IntersectionObserver.prototype._initThresholds = function (opt_threshold) {\n let threshold = opt_threshold || [0]\n if (!Array.isArray(threshold)) threshold = [threshold]\n\n return threshold.sort().filter(function (t, i, a) {\n if (!isNumber(t) || isNaN(t) || t < 0 || t > 1) {\n throw new Error('threshold must be a number between 0 and 1 inclusively')\n }\n return t !== a[i - 1]\n })\n }\n\n /**\n * Accepts the rootMargin value from the user configuration object\n * and returns an array of the four margin values as an object containing\n * the value and unit properties. If any of the values are not properly\n * formatted or use a unit other than px or %, and error is thrown.\n * @private\n * @param {string=} opt_rootMargin An optional rootMargin value,\n * defaulting to '0px'.\n * @return {Array<Object>} An array of margin objects with the keys\n * value and unit.\n */\n IntersectionObserver.prototype._parseRootMargin = function (opt_rootMargin) {\n const marginString = opt_rootMargin || '0px'\n const margins = marginString.split(/\\s+/).map(function (margin) {\n const parts = /^(-?\\d*\\.?\\d+)(px|%)$/.exec(margin)\n if (!parts) {\n throw new Error('rootMargin must be specified in pixels or percent')\n }\n return { value: parseFloat(parts[1]), unit: parts[2] }\n })\n\n // Handles shorthand.\n margins[1] = margins[1] || margins[0]\n margins[2] = margins[2] || margins[0]\n margins[3] = margins[3] || margins[1]\n\n return margins\n }\n\n /**\n * Starts polling for intersection changes if the polling is not already\n * happening, and if the page's visibility state is visible.\n * @private\n */\n IntersectionObserver.prototype._monitorIntersections = function () {\n if (!this._monitoringIntersections) {\n this._monitoringIntersections = true\n\n // If a poll interval is set, use polling instead of listening to\n // resize and scroll events or DOM mutations.\n if (this.POLL_INTERVAL) {\n this._monitoringInterval = setInterval(this._checkForIntersections, this.POLL_INTERVAL)\n } else {\n addEvent(window, 'resize', this._checkForIntersections, true)\n addEvent(document, 'scroll', this._checkForIntersections, true)\n\n if (this.USE_MUTATION_OBSERVER && 'MutationObserver' in window) {\n this._domObserver = new MutationObserver(this._checkForIntersections)\n this._domObserver.observe(document, {\n attributes: true,\n childList: true,\n characterData: true,\n subtree: true\n })\n }\n }\n }\n }\n\n /**\n * Stops polling for intersection changes.\n * @private\n */\n IntersectionObserver.prototype._unmonitorIntersections = function () {\n if (this._monitoringIntersections) {\n this._monitoringIntersections = false\n\n clearInterval(this._monitoringInterval)\n this._monitoringInterval = null\n\n removeEvent(window, 'resize', this._checkForIntersections, true)\n removeEvent(document, 'scroll', this._checkForIntersections, true)\n\n if (this._domObserver) {\n this._domObserver.disconnect()\n this._domObserver = null\n }\n }\n }\n\n /**\n * Scans each observation target for intersection changes and adds them\n * to the internal entries queue. If new entries are found, it\n * schedules the callback to be invoked.\n * @private\n */\n IntersectionObserver.prototype._checkForIntersections = function () {\n const rootIsInDom = this._rootIsInDom()\n const rootRect = rootIsInDom ? this._getRootRect() : getEmptyRect()\n\n this._observationTargets.forEach(function (item) {\n const target = item.element\n const targetRect = getBoundingClientRect(target)\n const rootContainsTarget = this._rootContainsTarget(target)\n const oldEntry = item.entry\n const intersectionRect = rootIsInDom && rootContainsTarget &&\n this._computeTargetAndRootIntersection(target, rootRect)\n\n const newEntry = item.entry = new IntersectionObserverEntry({\n time: now(),\n target: target,\n boundingClientRect: targetRect,\n rootBounds: rootRect,\n intersectionRect: intersectionRect,\n intersectionRatio: -1,\n isIntersecting: false,\n })\n\n if (!oldEntry) {\n this._queuedEntries.push(newEntry)\n } else if (rootIsInDom && rootContainsTarget) {\n // If the new entry intersection ratio has crossed any of the\n // thresholds, add a new entry.\n if (this._hasCrossedThreshold(oldEntry, newEntry)) {\n this._queuedEntries.push(newEntry)\n }\n } else {\n // If the root is not in the DOM or target is not contained within\n // root but the previous entry for this target had an intersection,\n // add a new record indicating removal.\n if (oldEntry && oldEntry.isIntersecting) {\n this._queuedEntries.push(newEntry)\n }\n }\n }, this)\n\n if (this._queuedEntries.length) {\n this._callback(this.takeRecords(), this)\n }\n }\n\n /**\n * Accepts a target and root rect computes the intersection between then\n * following the algorithm in the spec.\n * TODO(philipwalton): at this time clip-path is not considered.\n * https://w3c.github.io/IntersectionObserver/#calculate-intersection-rect-algo\n * @param {Element} target The target DOM element\n * @param {Object} rootRect The bounding rect of the root after being\n * expanded by the rootMargin value.\n * @return {?Object} The final intersection rect object or undefined if no\n * intersection is found.\n * @private\n */\n IntersectionObserver.prototype._computeTargetAndRootIntersection = function (target, rootRect) {\n // If the element isn't displayed, an intersection can't happen.\n if (window.getComputedStyle(target).display === 'none') return\n\n const targetRect = getBoundingClientRect(target)\n let intersectionRect = targetRect\n let parent = getParentNode(target)\n let atRoot = false\n\n while (!atRoot) {\n let parentRect = null\n const parentComputedStyle: Partial<CSSStyleDeclaration> = parent.nodeType == 1 ?\n window.getComputedStyle(parent) : {}\n\n // If the parent isn't displayed, an intersection can't happen.\n if (parentComputedStyle.display === 'none') return\n\n if (parent == this.root || parent == document) {\n atRoot = true\n parentRect = rootRect\n } else {\n // If the element has a non-visible overflow, and it's not the <body>\n // or <html> element, update the intersection rect.\n // Note: <body> and <html> cannot be clipped to a rect that's not also\n // the document rect, so no need to compute a new intersection.\n if (parent != document.body &&\n parent != document.documentElement &&\n parentComputedStyle.overflow != 'visible') {\n parentRect = getBoundingClientRect(parent)\n }\n }\n\n // If either of the above conditionals set a new parentRect,\n // calculate new intersection data.\n if (parentRect) {\n intersectionRect = computeRectIntersection(parentRect, intersectionRect)\n\n if (!intersectionRect) break\n }\n parent = getParentNode(parent)\n }\n return intersectionRect\n }\n\n\n /**\n * Returns the root rect after being expanded by the rootMargin value.\n * @return {Object} The expanded root rect.\n * @private\n */\n IntersectionObserver.prototype._getRootRect = function () {\n let rootRect\n if (this.root) {\n rootRect = getBoundingClientRect(this.root)\n } else {\n // Use <html>/<body> instead of window since scroll bars affect size.\n const html = document.documentElement\n const body = document.body\n rootRect = {\n top: 0,\n left: 0,\n right: html.clientWidth || body.clientWidth,\n width: html.clientWidth || body.clientWidth,\n bottom: html.clientHeight || body.clientHeight,\n height: html.clientHeight || body.clientHeight\n }\n }\n return this._expandRectByRootMargin(rootRect)\n }\n\n /**\n * Accepts a rect and expands it by the rootMargin value.\n * @param {Object} rect The rect object to expand.\n * @return {Object} The expanded rect.\n * @private\n */\n IntersectionObserver.prototype._expandRectByRootMargin = function (rect) {\n const margins = this._rootMarginValues.map(function (margin, i) {\n return margin.unit === 'px' ? margin.value :\n margin.value * (i % 2 ? rect.width : rect.height) / 100\n })\n const newRect: Record<string, number> = {\n top: rect.top - margins[0],\n right: rect.right + margins[1],\n bottom: rect.bottom + margins[2],\n left: rect.left - margins[3]\n }\n newRect.width = newRect.right - newRect.left\n newRect.height = newRect.bottom - newRect.top\n\n return newRect\n }\n\n /**\n * Accepts an old and new entry and returns true if at least one of the\n * threshold values has been crossed.\n * @param {?IntersectionObserverEntry} oldEntry The previous entry for a\n * particular target element or null if no previous entry exists.\n * @param {IntersectionObserverEntry} newEntry The current entry for a\n * particular target element.\n * @return {boolean} Returns true if a any threshold has been crossed.\n * @private\n */\n IntersectionObserver.prototype._hasCrossedThreshold =\n function (oldEntry, newEntry) {\n // To make comparing easier, an entry that has a ratio of 0\n // but does not actually intersect is given a value of -1\n const oldRatio = oldEntry && oldEntry.isIntersecting ? oldEntry.intersectionRatio || 0 : -1\n const newRatio = newEntry.isIntersecting ? newEntry.intersectionRatio || 0 : -1\n\n // Ignore unchanged ratios\n if (oldRatio === newRatio) return\n\n for (let i = 0; i < this.thresholds.length; i++) {\n const threshold = this.thresholds[i]\n\n // Return true if an entry matches a threshold or if the new ratio\n // and the old ratio are on the opposite sides of a threshold.\n if (threshold == oldRatio || threshold == newRatio ||\n threshold < oldRatio !== threshold < newRatio) {\n return true\n }\n }\n }\n\n /**\n * Returns whether or not the root element is an element and is in the DOM.\n * @return {boolean} True if the root element is an element and is in the DOM.\n * @private\n */\n IntersectionObserver.prototype._rootIsInDom = function () {\n return !this.root || containsDeep(document, this.root)\n }\n\n /**\n * Returns whether or not the target element is a child of root.\n * @param {Element} target The target element to check.\n * @return {boolean} True if the target element is a child of root.\n * @private\n */\n IntersectionObserver.prototype._rootContainsTarget = function (target) {\n return containsDeep(this.root || document, target)\n }\n\n /**\n * Adds the instance to the global IntersectionObserver registry if it isn't\n * already present.\n * @private\n */\n IntersectionObserver.prototype._registerInstance = function () {\n if (registry.indexOf(this) < 0) {\n registry.push(this)\n }\n }\n\n /**\n * Removes the instance from the global IntersectionObserver registry.\n * @private\n */\n IntersectionObserver.prototype._unregisterInstance = function () {\n const index = registry.indexOf(this)\n if (index != -1) registry.splice(index, 1)\n }\n\n /**\n * Returns the result of the performance.now() method or null in browsers\n * that don't support the API.\n * @return {number} The elapsed time since the page was requested.\n */\n function now () {\n return window.performance && performance.now && performance.now()\n }\n\n /**\n * Adds an event handler to a DOM node ensuring cross-browser compatibility.\n * @param {Node} node The DOM node to add the event handler to.\n * @param {string} event The event name.\n * @param {Function} fn The event handler to add.\n * @param {boolean} opt_useCapture Optionally adds the even to the capture\n * phase. Note: this only works in modern browsers.\n */\n function addEvent (node, event, fn, opt_useCapture) {\n if (isFunction(node.addEventListener)) {\n node.addEventListener(event, fn, opt_useCapture || false)\n } else if (isFunction(node.attachEvent)) {\n node.attachEvent('on' + event, fn)\n }\n }\n\n /**\n * Removes a previously added event handler from a DOM node.\n * @param {Node} node The DOM node to remove the event handler from.\n * @param {string} event The event name.\n * @param {Function} fn The event handler to remove.\n * @param {boolean} opt_useCapture If the event handler was added with this\n * flag set to true, it should be set to true here in order to remove it.\n */\n function removeEvent (node, event, fn, opt_useCapture) {\n if (isFunction(node.removeEventListener)) {\n node.removeEventListener(event, fn, opt_useCapture || false)\n }\n else if (isFunction(node.detatchEvent)) {\n node.detatchEvent('on' + event, fn)\n }\n }\n\n /**\n * Returns the intersection between two rect objects.\n * @param {Object} rect1 The first rect.\n * @param {Object} rect2 The second rect.\n * @return {?Object} The intersection rect or undefined if no intersection\n * is found.\n */\n function computeRectIntersection (rect1, rect2) {\n const top = Math.max(rect1.top, rect2.top)\n const bottom = Math.min(rect1.bottom, rect2.bottom)\n const left = Math.max(rect1.left, rect2.left)\n const right = Math.min(rect1.right, rect2.right)\n const width = right - left\n const height = bottom - top\n\n return (width >= 0 && height >= 0) && {\n top: top,\n bottom: bottom,\n left: left,\n right: right,\n width: width,\n height: height\n }\n }\n\n /**\n * Shims the native getBoundingClientRect for compatibility with older IE.\n * @param {Element} el The element whose bounding rect to get.\n * @return {Object} The (possibly shimmed) rect of the element.\n */\n function getBoundingClientRect (el) {\n let rect\n\n try {\n rect = el.getBoundingClientRect()\n } catch (err) {\n // Ignore Windows 7 IE11 \"Unspecified error\"\n // https://github.com/w3c/IntersectionObserver/pull/205\n }\n\n if (!rect) return getEmptyRect()\n\n // Older IE\n if (!(rect.width && rect.height)) {\n rect = {\n top: rect.top,\n right: rect.right,\n bottom: rect.bottom,\n left: rect.left,\n width: rect.right - rect.left,\n height: rect.bottom - rect.top\n }\n }\n return rect\n }\n\n /**\n * Returns an empty rect object. An empty rect is returned when an element\n * is not in the DOM.\n * @return {Object} The empty rect.\n */\n function getEmptyRect () {\n return {\n top: 0,\n bottom: 0,\n left: 0,\n right: 0,\n width: 0,\n height: 0\n }\n }\n\n /**\n * Checks to see if a parent element contains a child element (including inside\n * shadow DOM).\n * @param {Node} parent The parent element.\n * @param {Node} child The child element.\n * @return {boolean} True if the parent node contains the child node.\n */\n function containsDeep (parent, child) {\n let node = child\n while (node) {\n if (node == parent) return true\n\n node = getParentNode(node)\n }\n return false\n }\n\n /**\n * Gets the parent node of an element or its host element if the parent node\n * is a shadow root.\n * @param {Node} node The node whose parent to get.\n * @return {Node|null} The parent node or null if no parent exists.\n */\n function getParentNode (node) {\n const parent = node.parentNode\n\n if (parent && parent.nodeType == 11 && parent.host) {\n // If the parent is a shadow root, return the host element.\n return parent.host\n }\n\n if (parent && parent.assignedSlot) {\n // If the parent is distributed in a <slot>, return the parent of a slot.\n return parent.assignedSlot.parentNode\n }\n\n return parent\n }\n\n // Exposes the constructors globally.\n window.IntersectionObserver = IntersectionObserver as unknown as typeof window.IntersectionObserver\n window.IntersectionObserverEntry = IntersectionObserverEntry as unknown as typeof window.IntersectionObserverEntry\n}\n"],"names":[],"mappings":";;;;AAAA;SAKgB,kCAAkC,GAAA;;;IAGhD,IACE,sBAAsB,IAAI,MAAM;AAChC,QAAA,2BAA2B,IAAI,MAAM;AACrC,QAAA,mBAAmB,IAAI,MAAM,CAAC,yBAAyB,CAAC,SAAS,EACjE;QACA,IAAI,EAAE,gBAAgB,IAAI,MAAM,CAAC,yBAAyB,CAAC,SAAS,CAAC,EAAE;;;YAGrE,MAAM,CAAC,cAAc,CAAC,MAAM,CAAC,yBAAyB,CAAC,SAAS,EAAE,gBAAgB,EAAE;AAClF,gBAAA,GAAG,EAAE,YAAA;AACH,oBAAA,OAAO,IAAI,CAAC,iBAAiB,GAAG,CAAC,CAAA;iBAClC;AACF,aAAA,CAAC,CAAA;AACH,SAAA;AACF,KAAA;AAAM,SAAA;AACL,QAAA,wCAAwC,EAAE,CAAA;AAC3C,KAAA;AACH,CAAC;AAED,SAAS,wCAAwC,GAAA;AAC/C,IAAA,MAAM,QAAQ,GAAG,MAAM,CAAC,QAAQ,CAAA;AAUhC;;;;;AAKG;IACH,SAAS,yBAAy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X,IAAI,IAAI,IAAI,MAAM;AAAE,gBAAA,OAAO,IAAI,CAAA;AAE/B,YAAA,IAAI,GAAG,aAAa,CAAC,IAAI,CAAC,CAAA;AAC3B,SAAA;AACD,QAAA,OAAO,KAAK,CAAA;KACb;AAED;;;;;AAKG;IACH,SAAS,aAAa,CAAE,IAAI,EAAA;AAC1B,QAAA,MAAM,MAAM,GAAG,IAAI,CAAC,UAAU,CAAA;QAE9B,IAAI,MAAM,IAAI,MAAM,CAAC,QAAQ,IAAI,EAAE,IAAI,MAAM,CAAC,IAAI,EAAE;;YAElD,OAAO,MAAM,CAAC,IAAI,CAAA;AACnB,SAAA;AAED,QAAA,IAAI,MAAM,IAAI,MAAM,CAAC,YAAY,EAAE;;AAEjC,YAAA,OAAO,MAAM,CAAC,YAAY,CAAC,UAAU,CAAA;AACtC,SAAA;AAED,QAAA,OAAO,MAAM,CAAA;KACd;;AAGD,IAAA,MAAM,CAAC,oBAAoB,GAAG,oBAAqE,CAAA;AACnG,IAAA,MAAM,CAAC,yBAAyB,GAAG,yBAA+E,CAAA;AACpH;;;;"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
declare function handleObjectAssignPolyfill(): void;
|
|
2
|
+
declare function handleObjectEntriesPolyfill(): void;
|
|
3
|
+
declare function handleObjectDefinePropertyPolyfill(): void;
|
|
4
|
+
export { handleObjectAssignPolyfill, handleObjectEntriesPolyfill, handleObjectDefinePropertyPolyfill };
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import { isFunction, isObject, isUndefined } from '@tarojs/shared';
|
|
2
|
+
|
|
3
|
+
function handleObjectAssignPolyfill() {
|
|
4
|
+
if (!isFunction(Object.assign)) {
|
|
5
|
+
// Must be writable: true, enumerable: false, configurable: true
|
|
6
|
+
Object.assign = function (target) {
|
|
7
|
+
if (target == null) { // TypeError if undefined or null
|
|
8
|
+
throw new TypeError('Cannot convert undefined or null to object');
|
|
9
|
+
}
|
|
10
|
+
const to = Object(target);
|
|
11
|
+
for (let index = 1; index < arguments.length; index++) {
|
|
12
|
+
const nextSource = arguments[index];
|
|
13
|
+
if (nextSource != null) { // Skip over if undefined or null
|
|
14
|
+
for (const nextKey in nextSource) {
|
|
15
|
+
// Avoid bugs when hasOwnProperty is shadowed
|
|
16
|
+
if (Object.prototype.hasOwnProperty.call(nextSource, nextKey)) {
|
|
17
|
+
to[nextKey] = nextSource[nextKey];
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
return to;
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
function handleObjectEntriesPolyfill() {
|
|
27
|
+
if (!isFunction(Object.entries)) {
|
|
28
|
+
// Must be writable: true, enumerable: false, configurable: true
|
|
29
|
+
Object.entries = function (obj) {
|
|
30
|
+
if (obj == null) { // TypeError if undefined or null
|
|
31
|
+
throw new TypeError('Cannot convert undefined or null to object');
|
|
32
|
+
}
|
|
33
|
+
const to = [];
|
|
34
|
+
if (obj != null) { // Skip over if undefined or null
|
|
35
|
+
for (const key in obj) {
|
|
36
|
+
// Avoid bugs when hasOwnProperty is shadowed
|
|
37
|
+
if (Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
38
|
+
to.push([key, obj[key]]);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
return to;
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
function handleObjectDefinePropertyPolyfill() {
|
|
47
|
+
if (!isFunction(Object.defineProperties)) {
|
|
48
|
+
Object.defineProperties = function (obj, properties) {
|
|
49
|
+
function convertToDescriptor(desc) {
|
|
50
|
+
function hasProperty(obj, prop) {
|
|
51
|
+
return Object.prototype.hasOwnProperty.call(obj, prop);
|
|
52
|
+
}
|
|
53
|
+
if (!isObject(desc)) {
|
|
54
|
+
throw new TypeError('bad desc');
|
|
55
|
+
}
|
|
56
|
+
const d = {};
|
|
57
|
+
if (hasProperty(desc, 'enumerable'))
|
|
58
|
+
d.enumerable = !!desc.enumerable;
|
|
59
|
+
if (hasProperty(desc, 'configurable')) {
|
|
60
|
+
d.configurable = !!desc.configurable;
|
|
61
|
+
}
|
|
62
|
+
if (hasProperty(desc, 'value'))
|
|
63
|
+
d.value = desc.value;
|
|
64
|
+
if (hasProperty(desc, 'writable'))
|
|
65
|
+
d.writable = !!desc.writable;
|
|
66
|
+
if (hasProperty(desc, 'get')) {
|
|
67
|
+
const g = desc.get;
|
|
68
|
+
if (!isFunction(g) && !isUndefined(g)) {
|
|
69
|
+
throw new TypeError('bad get');
|
|
70
|
+
}
|
|
71
|
+
d.get = g;
|
|
72
|
+
}
|
|
73
|
+
if (hasProperty(desc, 'set')) {
|
|
74
|
+
const s = desc.set;
|
|
75
|
+
if (!isFunction(s) && !isUndefined(s)) {
|
|
76
|
+
throw new TypeError('bad set');
|
|
77
|
+
}
|
|
78
|
+
d.set = s;
|
|
79
|
+
}
|
|
80
|
+
if (('get' in d || 'set' in d) && ('value' in d || 'writable' in d)) {
|
|
81
|
+
throw new TypeError('identity-confused descriptor');
|
|
82
|
+
}
|
|
83
|
+
return d;
|
|
84
|
+
}
|
|
85
|
+
if (!isObject(obj))
|
|
86
|
+
throw new TypeError('bad obj');
|
|
87
|
+
properties = Object(properties);
|
|
88
|
+
const keys = Object.keys(properties);
|
|
89
|
+
const descs = [];
|
|
90
|
+
for (let i = 0; i < keys.length; i++) {
|
|
91
|
+
descs.push([keys[i], convertToDescriptor(properties[keys[i]])]);
|
|
92
|
+
}
|
|
93
|
+
for (let i = 0; i < descs.length; i++) {
|
|
94
|
+
Object.defineProperty(obj, descs[i][0], descs[i][1]);
|
|
95
|
+
}
|
|
96
|
+
return obj;
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
export { handleObjectAssignPolyfill, handleObjectDefinePropertyPolyfill, handleObjectEntriesPolyfill };
|
|
102
|
+
//# sourceMappingURL=object.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"object.js","sources":["../../src/polyfill/object.ts"],"sourcesContent":["import { isFunction, isObject, isUndefined } from '@tarojs/shared'\n\nexport function handleObjectAssignPolyfill () {\n if (!isFunction(Object.assign)) {\n // Must be writable: true, enumerable: false, configurable: true\n Object.assign = function (target) { // .length of function is 2\n if (target == null) { // TypeError if undefined or null\n throw new TypeError('Cannot convert undefined or null to object')\n }\n\n const to = Object(target)\n\n for (let index = 1; index < arguments.length; index++) {\n const nextSource = arguments[index]\n\n if (nextSource != null) { // Skip over if undefined or null\n for (const nextKey in nextSource) {\n // Avoid bugs when hasOwnProperty is shadowed\n if (Object.prototype.hasOwnProperty.call(nextSource, nextKey)) {\n to[nextKey] = nextSource[nextKey]\n }\n }\n }\n }\n return to\n }\n }\n}\n\nexport function handleObjectEntriesPolyfill () {\n if (!isFunction(Object.entries)) {\n // Must be writable: true, enumerable: false, configurable: true\n Object.entries = function (obj) { // .length of function is 2\n if (obj == null) { // TypeError if undefined or null\n throw new TypeError('Cannot convert undefined or null to object')\n }\n\n const to: [string, unknown][] = []\n\n if (obj != null) { // Skip over if undefined or null\n for (const key in obj) {\n // Avoid bugs when hasOwnProperty is shadowed\n if (Object.prototype.hasOwnProperty.call(obj, key)) {\n to.push([key, obj[key]])\n }\n }\n }\n return to\n }\n }\n}\n\nexport function handleObjectDefinePropertyPolyfill () {\n if (!isFunction(Object.defineProperties)) {\n Object.defineProperties = function (obj, properties: Record<PropertyKey, Record<PropertyKey, unknown>>) {\n function convertToDescriptor (desc: Record<string, unknown>) {\n function hasProperty (obj, prop) {\n return Object.prototype.hasOwnProperty.call(obj, prop)\n }\n\n if (!isObject(desc)) { throw new TypeError('bad desc') }\n\n const d: Record<PropertyKey, unknown> = {}\n\n if (hasProperty(desc, 'enumerable')) d.enumerable = !!desc.enumerable\n if (hasProperty(desc, 'configurable')) { d.configurable = !!desc.configurable }\n if (hasProperty(desc, 'value')) d.value = desc.value\n if (hasProperty(desc, 'writable')) d.writable = !!desc.writable\n if (hasProperty(desc, 'get')) {\n const g = desc.get\n\n if (!isFunction(g) && !isUndefined(g)) { throw new TypeError('bad get') }\n d.get = g\n }\n if (hasProperty(desc, 'set')) {\n const s = desc.set\n if (!isFunction(s) && !isUndefined(s)) { throw new TypeError('bad set') }\n d.set = s\n }\n\n if (('get' in d || 'set' in d) && ('value' in d || 'writable' in d)) { throw new TypeError('identity-confused descriptor') }\n\n return d\n }\n\n if (!isObject(obj)) throw new TypeError('bad obj')\n\n properties = Object(properties)\n\n const keys = Object.keys(properties)\n const descs: [PropertyKey, Record<PropertyKey, unknown>][] = []\n\n for (let i = 0; i < keys.length; i++) {\n descs.push([keys[i], convertToDescriptor(properties[keys[i]])])\n }\n\n for (let i = 0; i < descs.length; i++) {\n Object.defineProperty(obj, descs[i][0], descs[i][1])\n }\n\n return obj\n }\n }\n}\n"],"names":[],"mappings":";;SAEgB,0BAA0B,GAAA;AACxC,IAAA,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE;;AAE9B,QAAA,MAAM,CAAC,MAAM,GAAG,UAAU,MAAM,EAAA;AAC9B,YAAA,IAAI,MAAM,IAAI,IAAI,EAAE;AAClB,gBAAA,MAAM,IAAI,SAAS,CAAC,4CAA4C,CAAC,CAAA;AAClE,aAAA;AAED,YAAA,MAAM,EAAE,GAAG,MAAM,CAAC,MAAM,CAAC,CAAA;AAEzB,YAAA,KAAK,IAAI,KAAK,GAAG,CAAC,EAAE,KAAK,GAAG,SAAS,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE;AACrD,gBAAA,MAAM,UAAU,GAAG,SAAS,CAAC,KAAK,CAAC,CAAA;AAEnC,gBAAA,IAAI,UAAU,IAAI,IAAI,EAAE;AACtB,oBAAA,KAAK,MAAM,OAAO,IAAI,UAAU,EAAE;;AAEhC,wBAAA,IAAI,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC,IAAI,CAAC,UAAU,EAAE,OAAO,CAAC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
import { TaroNode } from "./dom/node.js";
|
|
2
|
+
/**
|
|
3
|
+
* A MutationRecord represents an individual DOM mutation.
|
|
4
|
+
* It is the object that is passed to MutationObserver's callback.
|
|
5
|
+
* @see https://dom.spec.whatwg.org/#interface-mutationrecord
|
|
6
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/MutationRecord
|
|
7
|
+
*/
|
|
8
|
+
interface MutationRecord {
|
|
9
|
+
readonly target: TaroNode;
|
|
10
|
+
readonly addedNodes?: TaroNode[];
|
|
11
|
+
readonly removedNodes?: TaroNode[];
|
|
12
|
+
readonly previousSibling?: TaroNode | null;
|
|
13
|
+
readonly nextSibling?: TaroNode | null;
|
|
14
|
+
readonly attributeName?: string | null;
|
|
15
|
+
readonly attributeNamespace?: string | null;
|
|
16
|
+
oldValue?: string | null;
|
|
17
|
+
readonly type: MutationRecordType;
|
|
18
|
+
readonly value?: string | null;
|
|
19
|
+
}
|
|
20
|
+
declare const enum MutationRecordType {
|
|
21
|
+
ATTRIBUTES = "attributes",
|
|
22
|
+
CHARACTER_DATA = "characterData",
|
|
23
|
+
CHILD_LIST = "childList"
|
|
24
|
+
}
|
|
25
|
+
export { MutationRecord, MutationRecordType };
|
package/dist/runtime.esm.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { Shortcuts, Events } from "@tarojs/shared";
|
|
2
|
-
import { PageConfig } from "@tarojs/taro";
|
|
3
2
|
import VueCtor from "vue";
|
|
4
3
|
import { ComponentOptions, VNode } from "vue";
|
|
5
4
|
import { Component as Vue3Component } from "@vue/runtime-core";
|
|
@@ -49,6 +48,9 @@ interface EventHandler<T = any, R = void> {
|
|
|
49
48
|
(...args: T[]): R;
|
|
50
49
|
_stop?: boolean;
|
|
51
50
|
}
|
|
51
|
+
// Note: @tarojs/runtime 不依赖 @tarojs/taro, 所以不能改为从 @tarojs/taro 引入 (可能导致循环依赖)
|
|
52
|
+
type TFunc = (...args: any[]) => any;
|
|
53
|
+
type PageConfig = Record<string, any>;
|
|
52
54
|
interface MpInstance {
|
|
53
55
|
config: PageConfig;
|
|
54
56
|
setData: (data: unknown, cb: () => void) => void;
|
|
@@ -135,8 +137,6 @@ interface Options {
|
|
|
135
137
|
};
|
|
136
138
|
miniGlobal?: any;
|
|
137
139
|
}
|
|
138
|
-
type Func = (...args: any[]) => any;
|
|
139
|
-
type Ctx = Record<string, any>;
|
|
140
140
|
declare class TaroEventTarget {
|
|
141
141
|
__handlers: Record<string, EventHandler[]>;
|
|
142
142
|
addEventListener(type: string, handler: EventHandler, options?: boolean | AddEventListenerOptions): void;
|
|
@@ -152,8 +152,8 @@ declare class TaroRootElement extends TaroElement {
|
|
|
152
152
|
get _path(): string;
|
|
153
153
|
get _root(): TaroRootElement;
|
|
154
154
|
enqueueUpdate(payload: UpdatePayload): void;
|
|
155
|
-
performUpdate(initRender?: boolean, prerender?:
|
|
156
|
-
enqueueUpdateCallback(cb:
|
|
155
|
+
performUpdate(initRender?: boolean, prerender?: TFunc): void;
|
|
156
|
+
enqueueUpdateCallback(cb: TFunc, ctx?: Record<string, any>): void;
|
|
157
157
|
flushUpdateCallback(): void;
|
|
158
158
|
}
|
|
159
159
|
interface RemoveChildOptions {
|
|
@@ -224,7 +224,7 @@ declare class TaroNode extends TaroEventTarget {
|
|
|
224
224
|
hasChildNodes(): boolean;
|
|
225
225
|
enqueueUpdate(payload: UpdatePayload): void;
|
|
226
226
|
get ownerDocument(): TaroDocument;
|
|
227
|
-
static extend(methodName: string, options:
|
|
227
|
+
static extend(methodName: string, options: TFunc | Record<string, any>): void;
|
|
228
228
|
}
|
|
229
229
|
declare class Style {
|
|
230
230
|
_pending: boolean;
|
|
@@ -298,7 +298,7 @@ declare class TaroElement extends TaroNode {
|
|
|
298
298
|
dispatchEvent(event: TaroEvent): boolean;
|
|
299
299
|
addEventListener(type: any, handler: any, options: any): void;
|
|
300
300
|
removeEventListener(type: any, handler: any, sideEffect?: boolean): void;
|
|
301
|
-
static extend(methodName: string, options:
|
|
301
|
+
static extend(methodName: string, options: TFunc | Record<string, any>): void;
|
|
302
302
|
}
|
|
303
303
|
declare class FormElement extends TaroElement {
|
|
304
304
|
get type(): string;
|
|
@@ -312,6 +312,7 @@ declare class TaroDocument extends TaroElement {
|
|
|
312
312
|
head: TaroElement;
|
|
313
313
|
body: TaroElement;
|
|
314
314
|
createEvent: typeof createEvent;
|
|
315
|
+
cookie?: string;
|
|
315
316
|
constructor();
|
|
316
317
|
createElement(type: string): TaroElement | TaroRootElement | FormElement;
|
|
317
318
|
// an ugly fake createElementNS to deal with @vue/runtime-dom's
|
|
@@ -330,8 +331,9 @@ interface Env {
|
|
|
330
331
|
document: TaroDocument;
|
|
331
332
|
}
|
|
332
333
|
declare const env: Env;
|
|
333
|
-
declare
|
|
334
|
-
|
|
334
|
+
declare const document: TaroDocument;
|
|
335
|
+
type TGetComputedStyle = typeof window.getComputedStyle | ((el: TaroElement) => Style);
|
|
336
|
+
declare const getComputedStyle: TGetComputedStyle;
|
|
335
337
|
declare const eventCenter: Events;
|
|
336
338
|
type EventsType = typeof Events;
|
|
337
339
|
/**
|
|
@@ -346,75 +348,60 @@ declare class RuntimeCache<T> {
|
|
|
346
348
|
get(identifier: string): T | undefined;
|
|
347
349
|
delete(identifier: string): void;
|
|
348
350
|
}
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
set search(val: string);
|
|
386
|
-
get hash(): string;
|
|
387
|
-
// 小程序的navigateTo存在截断hash字符串的问题
|
|
388
|
-
set hash(val: string);
|
|
389
|
-
get href(): string;
|
|
390
|
-
set href(val: string);
|
|
391
|
-
get origin(): string;
|
|
392
|
-
set origin(val: string);
|
|
393
|
-
/* public method */
|
|
394
|
-
assign(): void;
|
|
395
|
-
reload(): void;
|
|
396
|
-
replace(url: string): void;
|
|
397
|
-
toString(): string;
|
|
398
|
-
// For debug
|
|
399
|
-
get cache(): RuntimeCache<LocationContext>;
|
|
400
|
-
}
|
|
351
|
+
type Options$0 = {
|
|
352
|
+
window: any;
|
|
353
|
+
};
|
|
354
|
+
type LocationContext = {
|
|
355
|
+
lastHref: string;
|
|
356
|
+
};
|
|
357
|
+
declare class TaroLocation extends Events {
|
|
358
|
+
#private;
|
|
359
|
+
constructor(options: Options$0);
|
|
360
|
+
/* public property */
|
|
361
|
+
get protocol(): string;
|
|
362
|
+
set protocol(val: string);
|
|
363
|
+
get host(): string;
|
|
364
|
+
set host(val: string);
|
|
365
|
+
get hostname(): string;
|
|
366
|
+
set hostname(val: string);
|
|
367
|
+
get port(): string;
|
|
368
|
+
set port(val: string);
|
|
369
|
+
get pathname(): string;
|
|
370
|
+
set pathname(val: string);
|
|
371
|
+
get search(): string;
|
|
372
|
+
set search(val: string);
|
|
373
|
+
get hash(): string;
|
|
374
|
+
// 小程序的navigateTo存在截断hash字符串的问题
|
|
375
|
+
set hash(val: string);
|
|
376
|
+
get href(): string;
|
|
377
|
+
set href(val: string);
|
|
378
|
+
get origin(): string;
|
|
379
|
+
set origin(val: string);
|
|
380
|
+
/* public method */
|
|
381
|
+
assign(): void;
|
|
382
|
+
reload(): void;
|
|
383
|
+
replace(url: string): void;
|
|
384
|
+
toString(): string;
|
|
385
|
+
// For debug
|
|
386
|
+
get cache(): RuntimeCache<LocationContext>;
|
|
401
387
|
}
|
|
388
|
+
declare const Location: typeof TaroLocation;
|
|
402
389
|
interface HistoryState {
|
|
403
390
|
state: Record<string, any> | null;
|
|
404
391
|
title: string;
|
|
405
392
|
url: string;
|
|
406
393
|
}
|
|
407
|
-
type Options$
|
|
394
|
+
type Options$1 = {
|
|
408
395
|
window: any;
|
|
409
396
|
};
|
|
410
397
|
type HistoryContext = {
|
|
411
|
-
location:
|
|
398
|
+
location: TaroLocation;
|
|
412
399
|
stack: HistoryState[];
|
|
413
400
|
cur: number;
|
|
414
401
|
};
|
|
415
|
-
declare class
|
|
402
|
+
declare class TaroHistory extends Events {
|
|
416
403
|
#private;
|
|
417
|
-
constructor(location:
|
|
404
|
+
constructor(location: TaroLocation, options: Options$1);
|
|
418
405
|
/* public property */
|
|
419
406
|
get length(): number;
|
|
420
407
|
get state(): Record<string, any> | null;
|
|
@@ -427,28 +414,15 @@ declare class History extends Events {
|
|
|
427
414
|
// For debug
|
|
428
415
|
get cache(): RuntimeCache<HistoryContext>;
|
|
429
416
|
}
|
|
430
|
-
declare const
|
|
417
|
+
declare const History: typeof TaroHistory;
|
|
418
|
+
declare const nav: typeof window.navigator;
|
|
431
419
|
// https://github.com/myrne/performance-now
|
|
432
420
|
declare let now: () => number;
|
|
433
421
|
// https://gist.github.com/paulirish/1579671
|
|
434
422
|
// https://gist.github.com/jalbam/5fe05443270fa6d8136238ec72accbc0
|
|
435
423
|
declare const _raf: typeof requestAnimationFrame | ((callback: any) => NodeJS.Timeout);
|
|
436
424
|
declare const _caf: typeof cancelAnimationFrame;
|
|
437
|
-
declare class
|
|
438
|
-
#private;
|
|
439
|
-
constructor(query: any);
|
|
440
|
-
append(name: string, value: string): void;
|
|
441
|
-
delete(name: string): void;
|
|
442
|
-
get(name: string): any;
|
|
443
|
-
getAll(name: string): any;
|
|
444
|
-
has(name: string): boolean;
|
|
445
|
-
keys(): string[];
|
|
446
|
-
set(name: string, value: string): void;
|
|
447
|
-
forEach(callback: any, thisArg: any): void;
|
|
448
|
-
toJSON(): {};
|
|
449
|
-
toString(): string;
|
|
450
|
-
}
|
|
451
|
-
declare class URL {
|
|
425
|
+
declare class TaroURL {
|
|
452
426
|
#private;
|
|
453
427
|
static createObjectURL(): void;
|
|
454
428
|
static revokeObjectURL(): void;
|
|
@@ -489,6 +463,7 @@ declare class URL {
|
|
|
489
463
|
href: string;
|
|
490
464
|
};
|
|
491
465
|
}
|
|
466
|
+
declare const URL: typeof TaroURL;
|
|
492
467
|
declare function parseUrl(url?: string): {
|
|
493
468
|
href: string;
|
|
494
469
|
origin: string;
|
|
@@ -500,9 +475,27 @@ declare function parseUrl(url?: string): {
|
|
|
500
475
|
search: string;
|
|
501
476
|
hash: string;
|
|
502
477
|
};
|
|
503
|
-
declare
|
|
504
|
-
declare
|
|
505
|
-
|
|
478
|
+
declare const URLSearchParams: any;
|
|
479
|
+
declare class TaroWindow extends Events {
|
|
480
|
+
navigator: Navigator;
|
|
481
|
+
requestAnimationFrame: typeof requestAnimationFrame | ((callback: any) => NodeJS.Timeout);
|
|
482
|
+
cancelAnimationFrame: typeof cancelAnimationFrame;
|
|
483
|
+
getComputedStyle: TGetComputedStyle;
|
|
484
|
+
Date: DateConstructor;
|
|
485
|
+
location: TaroLocation;
|
|
486
|
+
history: TaroHistory;
|
|
487
|
+
XMLHttpRequest?: Partial<XMLHttpRequest>;
|
|
488
|
+
constructor();
|
|
489
|
+
initEvent(): void;
|
|
490
|
+
get document(): TaroDocument;
|
|
491
|
+
addEventListener(event: string, callback: (arg: any) => void): void;
|
|
492
|
+
removeEventListener(event: string, callback: (arg: any) => void): void;
|
|
493
|
+
setTimeout(...args: Parameters<typeof setTimeout>): NodeJS.Timeout;
|
|
494
|
+
clearTimeout(...args: Parameters<typeof clearTimeout>): void;
|
|
495
|
+
}
|
|
496
|
+
declare const window: TaroWindow;
|
|
497
|
+
declare const location: TaroLocation;
|
|
498
|
+
declare const history: TaroHistory;
|
|
506
499
|
// for Vue3
|
|
507
500
|
declare class SVGElement extends TaroElement {
|
|
508
501
|
}
|
|
@@ -678,7 +671,7 @@ interface ReactAppInstance<T = AppInstance> extends Component<T>, AppInstance {
|
|
|
678
671
|
interface PageLifeCycle extends Show {
|
|
679
672
|
eh?(event: MpEvent): void;
|
|
680
673
|
onAddToFavorites?(): void;
|
|
681
|
-
onLoad?(options: Record<string, unknown>, cb?:
|
|
674
|
+
onLoad?(options: Record<string, unknown>, cb?: TFunc): void;
|
|
682
675
|
onOptionMenuClick?(): void;
|
|
683
676
|
onPageScroll?(obj: {
|
|
684
677
|
scrollTop: number;
|
|
@@ -758,7 +751,6 @@ declare const eventSource: IEventSource;
|
|
|
758
751
|
declare function injectPageInstance(inst: Instance<PageProps>, id: string): void;
|
|
759
752
|
declare function getPageInstance(id: string): Instance | undefined;
|
|
760
753
|
declare function removePageInstance(id: string): void;
|
|
761
|
-
declare function addLeadingSlash(path?: string): string;
|
|
762
754
|
declare function safeExecute(path: string, lifecycle: string, ...args: unknown[]): any;
|
|
763
755
|
declare function stringify(obj?: Record<string, unknown>): string;
|
|
764
756
|
declare function getPath(id: string, options?: Record<string, unknown>): string;
|
|
@@ -775,7 +767,7 @@ declare function createRecursiveComponentConfig(componentName?: string): any;
|
|
|
775
767
|
* it's a vnode traverser and modifier: that's exactly what Taro's doing in here.
|
|
776
768
|
*/
|
|
777
769
|
declare function hydrate(node: TaroElement | TaroText): MiniData;
|
|
778
|
-
declare const nextTick: (cb:
|
|
770
|
+
declare const nextTick: (cb: TFunc, ctx?: Record<string, any>) => void;
|
|
779
771
|
declare const options: Options;
|
|
780
772
|
declare const incrementId: () => () => string;
|
|
781
773
|
declare function isElement(node: TaroNode): node is TaroElement;
|
|
@@ -793,8 +785,19 @@ declare const customWrapperCache: Map<string, Record<string, any>>;
|
|
|
793
785
|
interface Ctor {
|
|
794
786
|
new (...args: any[]): any;
|
|
795
787
|
}
|
|
796
|
-
declare function extend(ctor: Ctor, methodName: string, options:
|
|
788
|
+
declare function extend(ctor: Ctor, methodName: string, options: TFunc | Record<string, any>): void;
|
|
797
789
|
declare function getComponentsAlias(): any;
|
|
798
790
|
declare function convertNumber2PX(value: number): string;
|
|
791
|
+
declare function throttle(fn: any, threshold?: number, scope?: any): (...args: any[]) => void;
|
|
792
|
+
// export const removeLeadingSlash = (str = '') => str.replace(/^\.?\//, '')
|
|
793
|
+
// export const removeTrailingSearch = (str = '') => str.replace(/\?[\s\S]*$/, '')
|
|
794
|
+
declare const addLeadingSlash: (url?: string) => string;
|
|
795
|
+
declare const hasBasename: (path?: string, prefix?: string) => boolean;
|
|
796
|
+
declare const stripBasename: (path?: string, prefix?: string) => string;
|
|
797
|
+
declare const stripTrailing: (str?: string) => string;
|
|
798
|
+
declare const stripSuffix: (path?: string, suffix?: string) => string;
|
|
799
|
+
declare const getHomePage: (path?: string, basename?: string, customRoutes?: Record<string, string | string[]>, entryPagePath?: string) => string;
|
|
800
|
+
declare const getCurrentPage: (routerMode?: string, basename?: string) => string;
|
|
801
|
+
declare function handlePolyfill(): void;
|
|
799
802
|
export { hooks } from '@tarojs/shared';
|
|
800
|
-
export { document, getComputedStyle, History, Location, nav as navigator, _caf as cancelAnimationFrame, now, _raf as requestAnimationFrame, parseUrl, URL, URLSearchParams, history, location, window, TaroElement, createEvent, eventHandler, TaroEvent, FormElement, TaroNode, TaroRootElement, Style, SVGElement, TaroText, MutationObserver, env, PROPERTY_THRESHOLD, TARO_RUNTIME, HOOKS_APP_ID, SET_DATA, PAGE_INIT, ROOT_STR, HTML, HEAD, BODY, APP, CONTAINER, DOCUMENT_ELEMENT_NAME, DOCUMENT_FRAGMENT, ID, UID, CLASS, STYLE, FOCUS, VIEW, STATIC_VIEW, PURE_VIEW, PROPS, DATASET, OBJECT, VALUE, INPUT, CHANGE, CUSTOM_WRAPPER, TARGET, CURRENT_TARGET, TYPE, CONFIRM, TIME_STAMP, KEY_CODE, TOUCHMOVE, DATE, SET_TIMEOUT, COMPILE_MODE, CATCHMOVE, CATCH_VIEW, COMMENT, ON_LOAD, ON_READY, ON_SHOW, ON_HIDE, OPTIONS, EXTERNAL_CLASSES, EVENT_CALLBACK_RESULT, BEHAVIORS, A, CONTEXT_ACTIONS, Current, getCurrentInstance, eventSource,
|
|
803
|
+
export { document, getComputedStyle, History, Location, nav as navigator, _caf as cancelAnimationFrame, now, _raf as requestAnimationFrame, parseUrl, URL, URLSearchParams, history, location, window, TaroElement, createEvent, eventHandler, TaroEvent, FormElement, TaroNode, TaroRootElement, Style, SVGElement, TaroText, MutationObserver, env, PROPERTY_THRESHOLD, TARO_RUNTIME, HOOKS_APP_ID, SET_DATA, PAGE_INIT, ROOT_STR, HTML, HEAD, BODY, APP, CONTAINER, DOCUMENT_ELEMENT_NAME, DOCUMENT_FRAGMENT, ID, UID, CLASS, STYLE, FOCUS, VIEW, STATIC_VIEW, PURE_VIEW, PROPS, DATASET, OBJECT, VALUE, INPUT, CHANGE, CUSTOM_WRAPPER, TARGET, CURRENT_TARGET, TYPE, CONFIRM, TIME_STAMP, KEY_CODE, TOUCHMOVE, DATE, SET_TIMEOUT, COMPILE_MODE, CATCHMOVE, CATCH_VIEW, COMMENT, ON_LOAD, ON_READY, ON_SHOW, ON_HIDE, OPTIONS, EXTERNAL_CLASSES, EVENT_CALLBACK_RESULT, BEHAVIORS, A, CONTEXT_ACTIONS, Current, getCurrentInstance, eventSource, createComponentConfig, createPageConfig, createRecursiveComponentConfig, getOnHideEventKey, getOnReadyEventKey, getOnShowEventKey, getPageInstance, getPath, injectPageInstance, removePageInstance, safeExecute, stringify, EventsType, eventCenter, Events, hydrate, nextTick, options, incrementId, isElement, isText, isComment, isHasExtractProp, isParentBinded, shortcutAttr, customWrapperCache, extend, getComponentsAlias, convertNumber2PX, throttle, addLeadingSlash, hasBasename, stripBasename, stripTrailing, stripSuffix, getHomePage, getCurrentPage, Instance, VueAppInstance, VueInstance, PageProps, ReactPageComponent, ReactPageInstance, ReactAppInstance, PageLifeCycle, PageInstance, AppInstance, Attributes, EventOptions, MpEvent, EventListenerOptions, AddEventListenerOptions, EventHandler, MpInstance, MiniElementData, MiniTextData, MiniData, HydratedData, UpdatePayloadValue, DataTree, UpdatePayload, Options$1 as Options, TFunc, PageConfig, handlePolyfill };
|