@tarojs/runtime 4.1.3-alpha.1 → 4.1.3
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/URL.d.ts +3 -4
- package/dist/bom/URL.js.map +1 -1
- package/dist/bom/URLSearchParams.d.ts +1 -0
- package/dist/bom/URLSearchParams.js.map +1 -1
- package/dist/bom/document.d.ts +3 -1
- package/dist/bom/document.js.map +1 -1
- package/dist/bom/getComputedStyle.d.ts +6 -3
- package/dist/bom/getComputedStyle.js.map +1 -1
- package/dist/bom/history.d.ts +8 -6
- package/dist/bom/history.js.map +1 -1
- package/dist/bom/location.d.ts +6 -5
- package/dist/bom/location.js.map +1 -1
- package/dist/bom/navigator.d.ts +1 -0
- package/dist/bom/navigator.js.map +1 -1
- package/dist/bom/raf.d.ts +2 -2
- package/dist/bom/raf.js.map +1 -1
- package/dist/bom/window.d.ts +11 -8
- package/dist/bom/window.js.map +1 -1
- package/dist/constants/index.d.ts +2 -1
- package/dist/constants/index.js.map +1 -1
- package/dist/current.d.ts +5 -2
- package/dist/current.js.map +1 -1
- package/dist/dom/anchor-element.js.map +1 -1
- package/dist/dom/class-list.d.ts +3 -1
- package/dist/dom/class-list.js.map +1 -1
- package/dist/dom/document.d.ts +7 -8
- package/dist/dom/document.js.map +1 -1
- package/dist/dom/element.d.ts +8 -5
- package/dist/dom/element.js.map +1 -1
- package/dist/dom/event-source.d.ts +3 -1
- package/dist/dom/event-source.js.map +1 -1
- package/dist/dom/event-target.d.ts +3 -1
- package/dist/dom/event-target.js.map +1 -1
- package/dist/dom/event.d.ts +4 -2
- package/dist/dom/event.js.map +1 -1
- package/dist/dom/form.d.ts +4 -2
- package/dist/dom/form.js.map +1 -1
- package/dist/dom/node.d.ts +9 -37
- package/dist/dom/node.js.map +1 -1
- package/dist/{node_types-9ac5b4dd.d.ts → dom/node_types.d.ts} +1 -0
- package/dist/dom/root.d.ts +6 -2
- package/dist/dom/root.js.map +1 -1
- package/dist/dom/style.d.ts +3 -1
- package/dist/dom/style.js.map +1 -1
- package/dist/dom/style_properties.js.map +1 -1
- package/dist/dom/svg.d.ts +3 -1
- package/dist/dom/svg.js.map +1 -1
- package/dist/dom/text.d.ts +4 -2
- package/dist/dom/text.js.map +1 -1
- package/dist/dom/transfer.js.map +1 -1
- package/dist/dom/tree.js.map +1 -1
- package/dist/dom-external/element.js.map +1 -1
- package/dist/dom-external/index.js.map +1 -1
- package/dist/dom-external/inner-html/html.js.map +1 -1
- package/dist/dom-external/inner-html/parser.d.ts +2 -7
- package/dist/dom-external/inner-html/parser.js.map +1 -1
- package/dist/dom-external/inner-html/scaner.js.map +1 -1
- package/dist/dom-external/inner-html/style.js.map +1 -1
- package/dist/dom-external/inner-html/tags.js.map +1 -1
- package/dist/dom-external/inner-html/utils.js.map +1 -1
- package/dist/dom-external/mutation-observer/implements.d.ts +6 -22
- package/dist/dom-external/mutation-observer/implements.js.map +1 -1
- package/dist/dom-external/mutation-observer/index.d.ts +7 -4
- package/dist/dom-external/mutation-observer/index.js.map +1 -1
- package/dist/{record-32b054d8.d.ts → dom-external/mutation-observer/record.d.ts} +5 -2
- package/dist/dom-external/node.js.map +1 -1
- package/dist/dsl/common.d.ts +5 -4
- package/dist/dsl/common.js.map +1 -1
- package/dist/{instance-530729bd.d.ts → dsl/instance.d.ts} +13 -11
- package/dist/emitter/emitter.d.ts +5 -1
- package/dist/emitter/emitter.js.map +1 -1
- package/dist/env.d.ts +3 -1
- package/dist/env.js.map +1 -1
- package/dist/hydrate.d.ts +5 -3
- package/dist/hydrate.js.map +1 -1
- package/dist/index.cjs.d.ts +87 -70
- package/dist/index.cjs.js +4 -4
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +41 -34
- package/dist/interface/element.d.ts +6 -0
- package/dist/interface/event-target.d.ts +13 -0
- package/dist/interface/event.d.ts +16 -0
- package/dist/interface/hydrate.d.ts +32 -0
- package/dist/interface/node.d.ts +10 -0
- package/dist/{options-530729bd.d.ts → interface/options.d.ts} +6 -4
- package/dist/interface/utils.d.ts +4 -0
- package/dist/next-tick.d.ts +3 -1
- package/dist/next-tick.js.map +1 -1
- package/dist/options.d.ts +3 -1
- package/dist/options.js.map +1 -1
- package/dist/perf.d.ts +1 -0
- package/dist/perf.js.map +1 -1
- package/dist/polyfill/array.js.map +1 -1
- package/dist/polyfill/index.d.ts +1 -0
- package/dist/polyfill/index.js.map +1 -1
- package/dist/polyfill/intersection-observer.js.map +1 -1
- package/dist/polyfill/object.js.map +1 -1
- package/dist/runtime.esm.d.ts +87 -70
- package/dist/runtime.esm.js.map +1 -1
- package/dist/utils/cache.d.ts +1 -0
- package/dist/utils/cache.js.map +1 -1
- package/dist/utils/index.d.ts +7 -7
- package/dist/utils/index.js.map +1 -1
- package/dist/utils/lodash.d.ts +2 -1
- package/dist/utils/lodash.js.map +1 -1
- package/dist/utils/router.d.ts +2 -1
- package/dist/utils/router.js.map +1 -1
- package/package.json +4 -6
- package/dist/dom/anchor-element.d.ts +0 -14
- package/dist/dom/style_properties.d.ts +0 -3
- package/dist/dom/transfer.d.ts +0 -8
- package/dist/dom/tree.d.ts +0 -4
- package/dist/dom-external/element.d.ts +0 -4
- package/dist/dom-external/index.d.ts +0 -1
- package/dist/dom-external/inner-html/html.d.ts +0 -3
- package/dist/dom-external/inner-html/scaner.d.ts +0 -30
- package/dist/dom-external/inner-html/style.d.ts +0 -27
- package/dist/dom-external/inner-html/tags.d.ts +0 -9
- package/dist/dom-external/inner-html/utils.d.ts +0 -2
- package/dist/dom-external/node.d.ts +0 -12
- package/dist/index-26658829.d.ts +0 -23
- package/dist/polyfill/array.d.ts +0 -3
- package/dist/polyfill/intersection-observer.d.ts +0 -2
- package/dist/polyfill/object.d.ts +0 -4
package/dist/utils/cache.d.ts
CHANGED
package/dist/utils/cache.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cache.js","sources":["
|
|
1
|
+
{"version":3,"file":"cache.js","sources":["../../../src/utils/cache.ts"],"sourcesContent":["/**\n * 一个小型缓存池,用于在切换页面时,存储一些上下文信息\n */\n\nexport class RuntimeCache<T> {\n name: string\n cache = new Map<string, T>()\n\n constructor (name: string) {\n this.name = name\n }\n\n has (identifier: string) {\n return this.cache.has(identifier)\n }\n\n set (identifier: string, ctx: T) {\n if (identifier && ctx) {\n this.cache.set(identifier, ctx)\n }\n }\n\n get (identifier: string): T | undefined {\n if (this.has(identifier)) return this.cache.get(identifier)\n }\n\n delete (identifier: string) {\n this.cache.delete(identifier)\n }\n}\n"],"names":[],"mappings":"AAAA;;AAEG;MAEU,YAAY,CAAA;AAIvB,IAAA,WAAA,CAAa,IAAY,EAAA;AAFzB,QAAA,IAAA,CAAA,KAAK,GAAG,IAAI,GAAG,EAAa;AAG1B,QAAA,IAAI,CAAC,IAAI,GAAG,IAAI;;AAGlB,IAAA,GAAG,CAAE,UAAkB,EAAA;QACrB,OAAO,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,UAAU,CAAC;;IAGnC,GAAG,CAAE,UAAkB,EAAE,GAAM,EAAA;AAC7B,QAAA,IAAI,UAAU,IAAI,GAAG,EAAE;YACrB,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,UAAU,EAAE,GAAG,CAAC;;;AAInC,IAAA,GAAG,CAAE,UAAkB,EAAA;AACrB,QAAA,IAAI,IAAI,CAAC,GAAG,CAAC,UAAU,CAAC;YAAE,OAAO,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,UAAU,CAAC;;AAG7D,IAAA,MAAM,CAAE,UAAkB,EAAA;AACxB,QAAA,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,UAAU,CAAC;;AAEhC;;;;"}
|
package/dist/utils/index.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { TaroElement } from
|
|
2
|
-
import { TaroNode } from
|
|
3
|
-
import { TaroText } from
|
|
4
|
-
import { TFunc } from
|
|
1
|
+
import { TaroElement } from '../dom/element.js';
|
|
2
|
+
import { TaroNode } from '../dom/node.js';
|
|
3
|
+
import { TaroText } from '../dom/text.js';
|
|
4
|
+
import { TFunc } from '../interface/utils.js';
|
|
5
|
+
|
|
5
6
|
declare const incrementId: () => () => string;
|
|
6
7
|
declare function isElement(node: TaroNode): node is TaroElement;
|
|
7
8
|
declare function isText(node: TaroNode): node is TaroText;
|
|
@@ -21,6 +22,5 @@ interface Ctor {
|
|
|
21
22
|
declare function extend(ctor: Ctor, methodName: string, options: TFunc | Record<string, any>): void;
|
|
22
23
|
declare function getComponentsAlias(): any;
|
|
23
24
|
declare function convertNumber2PX(value: number): string;
|
|
24
|
-
|
|
25
|
-
export
|
|
26
|
-
export * from "./router.js";
|
|
25
|
+
|
|
26
|
+
export { convertNumber2PX, customWrapperCache, extend, getComponentsAlias, incrementId, isComment, isElement, isHasExtractProp, isParentBinded, isText, shortcutAttr };
|
package/dist/utils/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../src/utils/index.ts"],"sourcesContent":["import {\n getComponentsAlias as _getComponentsAlias,\n internalComponents,\n isFunction,\n Shortcuts\n} from '@tarojs/shared'\n\nimport {\n CLASS,\n COMMENT,\n ID,\n ROOT_STR,\n STYLE,\n UID\n} from '../constants'\nimport { NodeType } from '../dom/node_types'\n\nimport type { TaroElement } from '../dom/element'\nimport type { TaroNode } from '../dom/node'\nimport type { TaroText } from '../dom/text'\nimport type { TFunc } from '../interface'\n\nexport const incrementId = () => {\n const chatCodes: number[] = []\n // A-Z\n for (let i = 65; i <= 90; i++) {\n chatCodes.push(i)\n }\n // a-z\n for (let i = 97; i <= 122; i++) {\n chatCodes.push(i)\n }\n const chatCodesLen = chatCodes.length - 1\n const list = [0, 0]\n return () => {\n const target = list.map(item => chatCodes[item])\n const res = String.fromCharCode(...target)\n\n let tailIdx = list.length - 1\n\n list[tailIdx]++\n\n while (list[tailIdx] > chatCodesLen) {\n list[tailIdx] = 0\n tailIdx = tailIdx - 1\n if (tailIdx < 0) {\n list.push(0)\n break\n }\n list[tailIdx]++\n }\n\n return res\n }\n}\n\nexport function isElement (node: TaroNode): node is TaroElement {\n return node.nodeType === NodeType.ELEMENT_NODE\n}\n\nexport function isText (node: TaroNode): node is TaroText {\n return node.nodeType === NodeType.TEXT_NODE\n}\n\nexport function isComment (node: TaroNode): boolean {\n return node.nodeName === COMMENT\n}\n\nexport function isHasExtractProp (el: TaroElement): boolean {\n const res = Object.keys(el.props).find(prop => {\n return !(/^(class|style|id)$/.test(prop) || prop.startsWith('data-'))\n })\n return Boolean(res)\n}\n\n/**\n * 往上寻找组件树直到 root,寻找是否有祖先组件绑定了同类型的事件\n * @param node 当前组件\n * @param type 事件类型\n */\nexport function isParentBinded (node: TaroElement | null, type: string): boolean {\n while ((node = node?.parentElement || null)) {\n if (!node || node.nodeName === ROOT_STR || node.nodeName === 'root-portal') {\n return false\n } else if (node.__handlers[type]?.length) {\n return true\n }\n }\n\n return false\n}\n\nexport function shortcutAttr (key: string): string {\n switch (key) {\n case STYLE:\n return Shortcuts.Style\n case ID:\n return UID\n case CLASS:\n return Shortcuts.Class\n default:\n return key\n }\n}\n\nexport const customWrapperCache = new Map<string, Record<string, any>>()\n\ninterface Ctor {\n new (...args: any[]): any\n}\n\nexport function extend (ctor: Ctor, methodName: string, options: TFunc | Record<string, any>) {\n if (isFunction(options)) {\n options = {\n value: options\n }\n }\n Object.defineProperty(ctor.prototype, methodName, {\n configurable: true,\n enumerable: true,\n ...options\n })\n}\n\nlet componentsAlias\nexport function getComponentsAlias () {\n if (!componentsAlias) {\n componentsAlias = _getComponentsAlias(internalComponents)\n }\n return componentsAlias\n}\n\nexport function convertNumber2PX (value: number) {\n return value + 'px'\n}\n\nexport * from './lodash'\nexport * from './router'\n"],"names":["_getComponentsAlias"],"mappings":";;;;AAsBO,MAAM,WAAW,GAAG,MAAK;IAC9B,MAAM,SAAS,GAAa,EAAE;;AAE9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AAkB,EAAE,OAAoC,EAAA;AAC1F,IAAA,IAAI,UAAU,CAAC,OAAO,CAAC,EAAE;AACvB,QAAA,OAAO,GAAG;AACR,YAAA,KAAK,EAAE;SACR;;AAEH,IAAA,MAAM,CAAC,cAAc,CAAC,IAAI,CAAC,SAAS,EAAE,UAAU,EAAA,MAAA,CAAA,MAAA,CAAA,EAC9C,YAAY,EAAE,IAAI,EAClB,UAAU,EAAE,IAAI,EACb,EAAA,OAAO,EACV;AACJ;AAEA,IAAI,eAAe;SACH,kBAAkB,GAAA;IAChC,IAAI,CAAC,eAAe,EAAE;AACpB,QAAA,eAAe,GAAGA,oBAAmB,CAAC,kBAAkB,CAAC;;AAE3D,IAAA,OAAO,eAAe;AACxB;AAEM,SAAU,gBAAgB,CAAE,KAAa,EAAA;IAC7C,OAAO,KAAK,GAAG,IAAI;AACrB;;;;"}
|
package/dist/utils/lodash.d.ts
CHANGED
package/dist/utils/lodash.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lodash.js","sources":["
|
|
1
|
+
{"version":3,"file":"lodash.js","sources":["../../../src/utils/lodash.ts"],"sourcesContent":["export function throttle (fn, threshold = 250, scope?) {\n let lastTime = 0\n let deferTimer: ReturnType<typeof setTimeout>\n return function (...args) {\n const context = scope || this\n const now = Date.now()\n if (now - lastTime > threshold) {\n fn.apply(this, args)\n lastTime = now\n } else {\n clearTimeout(deferTimer)\n deferTimer = setTimeout(() => {\n lastTime = now\n fn.apply(context, args)\n }, threshold)\n }\n }\n}\n\nexport function debounce (fn, ms = 250, scope?) {\n let timer: ReturnType<typeof setTimeout>\n\n return function (...args) {\n const context = scope || this\n clearTimeout(timer)\n timer = setTimeout(function () {\n fn.apply(context, args)\n }, ms)\n }\n}\n"],"names":[],"mappings":"AAAM,SAAU,QAAQ,CAAE,EAAE,EAAE,SAAS,GAAG,GAAG,EAAE,KAAM,EAAA;IACnD,IAAI,QAAQ,GAAG,CAAC;AAChB,IAAA,IAAI,UAAyC;IAC7C,OAAO,UAAU,GAAG,IAAI,EAAA;AACtB,QAAA,MAAM,OAAO,GAAG,KAAK,IAAI,IAAI;AAC7B,QAAA,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,EAAE;AACtB,QAAA,IAAI,GAAG,GAAG,QAAQ,GAAG,SAAS,EAAE;AAC9B,YAAA,EAAE,CAAC,KAAK,CAAC,IAAI,EAAE,IAAI,CAAC;YACpB,QAAQ,GAAG,GAAG;;aACT;YACL,YAAY,CAAC,UAAU,CAAC;AACxB,YAAA,UAAU,GAAG,UAAU,CAAC,MAAK;gBAC3B,QAAQ,GAAG,GAAG;AACd,gBAAA,EAAE,CAAC,KAAK,CAAC,OAAO,EAAE,IAAI,CAAC;aACxB,EAAE,SAAS,CAAC;;AAEjB,KAAC;AACH;AAEM,SAAU,QAAQ,CAAE,EAAE,EAAE,EAAE,GAAG,GAAG,EAAE,KAAM,EAAA;AAC5C,IAAA,IAAI,KAAoC;IAExC,OAAO,UAAU,GAAG,IAAI,EAAA;AACtB,QAAA,MAAM,OAAO,GAAG,KAAK,IAAI,IAAI;QAC7B,YAAY,CAAC,KAAK,CAAC;QACnB,KAAK,GAAG,UAAU,CAAC,YAAA;AACjB,YAAA,EAAE,CAAC,KAAK,CAAC,OAAO,EAAE,IAAI,CAAC;SACxB,EAAE,EAAE,CAAC;AACR,KAAC;AACH;;;;"}
|
package/dist/utils/router.d.ts
CHANGED
|
@@ -5,4 +5,5 @@ declare const stripTrailing: (str?: string) => string;
|
|
|
5
5
|
declare const stripSuffix: (path?: string, suffix?: string) => string;
|
|
6
6
|
declare const getHomePage: (path?: string, basename?: string, customRoutes?: Record<string, string | string[]>, entryPagePath?: string) => string;
|
|
7
7
|
declare const getCurrentPage: (routerMode?: string, basename?: string) => string;
|
|
8
|
-
|
|
8
|
+
|
|
9
|
+
export { addLeadingSlash, getCurrentPage, getHomePage, hasBasename, stripBasename, stripSuffix, stripTrailing };
|
package/dist/utils/router.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"router.js","sources":["
|
|
1
|
+
{"version":3,"file":"router.js","sources":["../../../src/utils/router.ts"],"sourcesContent":["import { taroLocationProvider as location } from '../bom/window'\n\n// export const removeLeadingSlash = (str = '') => str.replace(/^\\.?\\//, '')\n// export const removeTrailingSearch = (str = '') => str.replace(/\\?[\\s\\S]*$/, '')\nexport const addLeadingSlash = (url = '') => (url.charAt(0) === '/' ? url : '/' + url)\n\nexport const hasBasename = (path = '', prefix = '') =>\n new RegExp('^' + prefix + '(\\\\/|\\\\?|#|$)', 'i').test(path) || path === prefix\n\nexport const stripBasename = (path = '', prefix = '') =>\n hasBasename(path, prefix) ? path.substring(prefix.length) : path\n\nexport const stripTrailing = (str = '') => str.replace(/[?#][\\s\\S]*$/, '')\n\nexport const stripSuffix = (path = '', suffix = '') =>\n path.includes(suffix) ? path.substring(0, path.length - suffix.length) : path\n\nexport const getHomePage = (path = '', basename = '', customRoutes: Record<string, string | string[]> = {}, entryPagePath = '') => {\n const routePath = addLeadingSlash(stripBasename(path, basename))\n const alias = Object.entries(customRoutes).find(\n ([key]) => key === routePath\n )?.[1] || routePath\n return entryPagePath || (typeof alias === 'string' ? alias : alias[0]) || basename\n}\n\nexport const getCurrentPage = (routerMode = 'hash', basename = '/') => {\n const pagePath = routerMode === 'hash'\n ? location.hash.slice(1).split('?')[0]\n : location.pathname\n return addLeadingSlash(stripBasename(pagePath, basename))\n}\n"],"names":["location"],"mappings":";;AAEA;AACA;AACO,MAAM,eAAe,GAAG,CAAC,GAAG,GAAG,EAAE,MAAM,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,KAAK,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG;AAE9E,MAAM,WAAW,GAAG,CAAC,IAAI,GAAG,EAAE,EAAE,MAAM,GAAG,EAAE,KAChD,IAAI,MAAM,CAAC,GAAG,GAAG,MAAM,GAAG,eAAe,EAAE,GAAG,CAAC,CAAC,IAAI,CAAC,IA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AC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC;AACrC,UAAEA,oBAAQ,CAAC,QAAQ;IACrB,OAAO,eAAe,CAAC,aAAa,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;AAC3D;;;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tarojs/runtime",
|
|
3
|
-
"version": "4.1.3
|
|
3
|
+
"version": "4.1.3",
|
|
4
4
|
"description": "taro runtime for mini apps.",
|
|
5
5
|
"author": "O2Team",
|
|
6
6
|
"license": "MIT",
|
|
@@ -20,20 +20,18 @@
|
|
|
20
20
|
"url": "https://github.com/NervJS/taro/tree/master/packages/taro-runtime"
|
|
21
21
|
},
|
|
22
22
|
"engines": {
|
|
23
|
-
"node": "
|
|
23
|
+
"node": "^20 || ^22"
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
26
|
"tslib": "^2.6.2",
|
|
27
|
-
"@tarojs/shared": "4.1.3
|
|
27
|
+
"@tarojs/shared": "4.1.3"
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
30
30
|
"@rollup/plugin-typescript": "^12.1.2",
|
|
31
|
-
"@types/react": "^18.2.79",
|
|
32
31
|
"@vue/runtime-core": "^3.4.23",
|
|
33
32
|
"lodash": "^4.17.21",
|
|
34
|
-
"react": "^18.2.0",
|
|
35
33
|
"rollup": "^4.37.0",
|
|
36
|
-
"rollup-plugin-
|
|
34
|
+
"rollup-plugin-dts": "^6.2.1"
|
|
37
35
|
},
|
|
38
36
|
"scripts": {
|
|
39
37
|
"prod": "pnpm run build",
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { TaroElement } from "./element.js";
|
|
2
|
-
declare class AnchorElement extends TaroElement {
|
|
3
|
-
get href(): string;
|
|
4
|
-
set href(val: string);
|
|
5
|
-
get protocol(): any;
|
|
6
|
-
get host(): any;
|
|
7
|
-
get search(): any;
|
|
8
|
-
get hash(): any;
|
|
9
|
-
get hostname(): any;
|
|
10
|
-
get port(): any;
|
|
11
|
-
get pathname(): any;
|
|
12
|
-
setAttribute(qualifiedName: string, value: any): void;
|
|
13
|
-
}
|
|
14
|
-
export { AnchorElement };
|
package/dist/dom/transfer.d.ts
DELETED
package/dist/dom/tree.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
interface Position {
|
|
2
|
-
index: number;
|
|
3
|
-
column: number;
|
|
4
|
-
line: number;
|
|
5
|
-
}
|
|
6
|
-
interface Token {
|
|
7
|
-
type: string;
|
|
8
|
-
content?: string;
|
|
9
|
-
position?: {
|
|
10
|
-
start?: Position;
|
|
11
|
-
end?: Position;
|
|
12
|
-
};
|
|
13
|
-
close?: boolean;
|
|
14
|
-
}
|
|
15
|
-
declare class Scaner {
|
|
16
|
-
private tokens;
|
|
17
|
-
private position;
|
|
18
|
-
private html;
|
|
19
|
-
constructor(html: string);
|
|
20
|
-
scan(): Token[];
|
|
21
|
-
private scanText;
|
|
22
|
-
private scanComment;
|
|
23
|
-
private scanTag;
|
|
24
|
-
private scanTagStart;
|
|
25
|
-
private scanTagEnd;
|
|
26
|
-
private scanTagName;
|
|
27
|
-
private scanAttrs;
|
|
28
|
-
private scanSkipTag;
|
|
29
|
-
}
|
|
30
|
-
export { Token, Scaner };
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { ParsedTaroElement } from "./parser.js";
|
|
2
|
-
interface ISelector {
|
|
3
|
-
isChild: boolean;
|
|
4
|
-
isGeneralSibling: boolean;
|
|
5
|
-
isAdjacentSibling: boolean;
|
|
6
|
-
tag: string | null;
|
|
7
|
-
id: string | null;
|
|
8
|
-
class: string[];
|
|
9
|
-
attrs: {
|
|
10
|
-
all: boolean;
|
|
11
|
-
key: string;
|
|
12
|
-
value?: string | null;
|
|
13
|
-
}[];
|
|
14
|
-
}
|
|
15
|
-
interface IStyle {
|
|
16
|
-
content: string;
|
|
17
|
-
selectorList: ISelector[];
|
|
18
|
-
}
|
|
19
|
-
declare class StyleTagParser {
|
|
20
|
-
styles: IStyle[];
|
|
21
|
-
extractStyle(src: string): string;
|
|
22
|
-
stringToSelector(style: string): void;
|
|
23
|
-
parseSelector(src: string): ISelector[];
|
|
24
|
-
matchStyle(tagName: string, el: ParsedTaroElement, list: number[]): string;
|
|
25
|
-
matchCurrent(tagName: string, el: ParsedTaroElement, selector: ISelector): boolean;
|
|
26
|
-
}
|
|
27
|
-
export { StyleTagParser as default };
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
declare function makeMap(str: string, expectsLowerCase?: boolean): (key: string) => boolean;
|
|
2
|
-
declare const specialMiniElements: {
|
|
3
|
-
img: string;
|
|
4
|
-
iframe: string;
|
|
5
|
-
};
|
|
6
|
-
declare const isMiniElements: (key: string) => boolean;
|
|
7
|
-
declare const isInlineElements: (key: string) => boolean;
|
|
8
|
-
declare const isBlockElements: (key: string) => boolean;
|
|
9
|
-
export { makeMap, specialMiniElements, isMiniElements, isInlineElements, isBlockElements };
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { TaroNode } from "../dom/node.js";
|
|
2
|
-
type IPosition = 'beforebegin' | 'afterbegin' | 'beforeend' | 'afterend';
|
|
3
|
-
/**
|
|
4
|
-
* An implementation of `Element.insertAdjacentHTML()`
|
|
5
|
-
* to support Vue 3 with a version of or greater than `vue@3.1.2`
|
|
6
|
-
*/
|
|
7
|
-
declare function insertAdjacentHTML(this: TaroNode, position: IPosition, html: string): void;
|
|
8
|
-
declare function cloneNode(this: TaroNode, isDeep?: boolean): any;
|
|
9
|
-
declare function contains(this: TaroNode, node: TaroNode & {
|
|
10
|
-
id?: string;
|
|
11
|
-
}): boolean;
|
|
12
|
-
export { IPosition, insertAdjacentHTML, cloneNode, contains };
|
package/dist/index-26658829.d.ts
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { Shortcuts } from "@tarojs/shared";
|
|
2
|
-
interface MiniElementData {
|
|
3
|
-
[Shortcuts.Childnodes]?: MiniData[];
|
|
4
|
-
[Shortcuts.NodeName]: string;
|
|
5
|
-
[Shortcuts.Class]?: string;
|
|
6
|
-
[Shortcuts.Style]?: string;
|
|
7
|
-
uid?: string;
|
|
8
|
-
sid: string;
|
|
9
|
-
[key: string]: unknown;
|
|
10
|
-
}
|
|
11
|
-
interface MiniTextData {
|
|
12
|
-
[Shortcuts.Text]: string;
|
|
13
|
-
[Shortcuts.NodeName]: string;
|
|
14
|
-
}
|
|
15
|
-
type MiniData = MiniElementData | MiniTextData;
|
|
16
|
-
type HydratedData = () => MiniData | MiniData[];
|
|
17
|
-
type UpdatePayloadValue = string | boolean | HydratedData;
|
|
18
|
-
type DataTree = Record<string, UpdatePayloadValue | ReturnType<HydratedData>>;
|
|
19
|
-
interface UpdatePayload {
|
|
20
|
-
path: string;
|
|
21
|
-
value: UpdatePayloadValue;
|
|
22
|
-
}
|
|
23
|
-
export { UpdatePayloadValue, DataTree, UpdatePayload };
|
package/dist/polyfill/array.d.ts
DELETED
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
declare function handleObjectAssignPolyfill(): void;
|
|
2
|
-
declare function handleObjectEntriesPolyfill(): void;
|
|
3
|
-
declare function handleObjectDefinePropertyPolyfill(): void;
|
|
4
|
-
export { handleObjectAssignPolyfill, handleObjectEntriesPolyfill, handleObjectDefinePropertyPolyfill };
|