@dcloudio/uni-shared
Advanced tools
Comparing version 3.0.0-alpha-3000020210809001 to 3.0.0-alpha-3000020210813001
@@ -7,2 +7,115 @@ 'use strict'; | ||
const BUILT_IN_TAGS = [ | ||
'ad', | ||
'audio', | ||
'button', | ||
'camera', | ||
'canvas', | ||
'checkbox', | ||
'checkbox-group', | ||
'cover-image', | ||
'cover-view', | ||
'editor', | ||
'form', | ||
'functional-page-navigator', | ||
'icon', | ||
'image', | ||
'input', | ||
'label', | ||
'live-player', | ||
'live-pusher', | ||
'map', | ||
'movable-area', | ||
'movable-view', | ||
'navigator', | ||
'official-account', | ||
'open-data', | ||
'picker', | ||
'picker-view', | ||
'picker-view-column', | ||
'progress', | ||
'radio', | ||
'radio-group', | ||
'rich-text', | ||
'scroll-view', | ||
'slider', | ||
'swiper', | ||
'swiper-item', | ||
'switch', | ||
'text', | ||
'textarea', | ||
'video', | ||
'view', | ||
'web-view', | ||
].map((tag) => 'uni-' + tag); | ||
const TAGS = [ | ||
'app', | ||
'layout', | ||
'content', | ||
'main', | ||
'top-window', | ||
'left-window', | ||
'right-window', | ||
'tabbar', | ||
'page', | ||
'page-head', | ||
'page-wrapper', | ||
'page-body', | ||
'page-refresh', | ||
'actionsheet', | ||
'modal', | ||
'toast', | ||
'resize-sensor', | ||
'shadow-root', | ||
].map((tag) => 'uni-' + tag); | ||
function isBuiltInComponent(tag) { | ||
return BUILT_IN_TAGS.indexOf('uni-' + tag) !== -1; | ||
} | ||
function isCustomElement(tag) { | ||
return TAGS.indexOf(tag) !== -1 || BUILT_IN_TAGS.indexOf(tag) !== -1; | ||
} | ||
function isNativeTag(tag) { | ||
return (shared.isHTMLTag(tag) || shared.isSVGTag(tag)) && !isBuiltInComponent(tag); | ||
} | ||
function isServiceNativeTag(tag) { | ||
return shared.isHTMLTag(tag) || shared.isSVGTag(tag) || isBuiltInComponent(tag); | ||
} | ||
function isServiceCustomElement(_tag) { | ||
return false; | ||
} | ||
const COMPONENT_SELECTOR_PREFIX = 'uni-'; | ||
const COMPONENT_PREFIX = 'v-' + COMPONENT_SELECTOR_PREFIX; | ||
function resolveOwnerVm(vm) { | ||
if (!vm) { | ||
return; | ||
} | ||
let componentName = vm.type.name; | ||
while (componentName && isBuiltInComponent(shared.hyphenate(componentName))) { | ||
// ownerInstance 内置组件需要使用父 vm | ||
vm = vm.parent; | ||
componentName = vm.type.name; | ||
} | ||
return vm.proxy; | ||
} | ||
function isElement(el) { | ||
// Element | ||
return el.nodeType === 1; | ||
} | ||
function resolveOwnerEl(instance) { | ||
const { vnode } = instance; | ||
if (isElement(vnode.el)) { | ||
return vnode.el; | ||
} | ||
const { subTree } = instance; | ||
// ShapeFlags.ARRAY_CHILDREN = 1<<4 | ||
if (subTree.shapeFlag & 16) { | ||
const elemVNode = subTree.children.find((vnode) => isElement(vnode.el)); | ||
if (elemVNode) { | ||
return elemVNode.el; | ||
} | ||
} | ||
return vnode.el; | ||
} | ||
let lastLogTime = 0; | ||
@@ -245,83 +358,2 @@ function formatLog(module, ...args) { | ||
const BUILT_IN_TAGS = [ | ||
'ad', | ||
'audio', | ||
'button', | ||
'camera', | ||
'canvas', | ||
'checkbox', | ||
'checkbox-group', | ||
'cover-image', | ||
'cover-view', | ||
'editor', | ||
'form', | ||
'functional-page-navigator', | ||
'icon', | ||
'image', | ||
'input', | ||
'label', | ||
'live-player', | ||
'live-pusher', | ||
'map', | ||
'movable-area', | ||
'movable-view', | ||
'navigator', | ||
'official-account', | ||
'open-data', | ||
'picker', | ||
'picker-view', | ||
'picker-view-column', | ||
'progress', | ||
'radio', | ||
'radio-group', | ||
'rich-text', | ||
'scroll-view', | ||
'slider', | ||
'swiper', | ||
'swiper-item', | ||
'switch', | ||
'text', | ||
'textarea', | ||
'video', | ||
'view', | ||
'web-view', | ||
].map((tag) => 'uni-' + tag); | ||
const TAGS = [ | ||
'app', | ||
'layout', | ||
'content', | ||
'main', | ||
'top-window', | ||
'left-window', | ||
'right-window', | ||
'tabbar', | ||
'page', | ||
'page-head', | ||
'page-wrapper', | ||
'page-body', | ||
'page-refresh', | ||
'actionsheet', | ||
'modal', | ||
'toast', | ||
'resize-sensor', | ||
'shadow-root', | ||
].map((tag) => 'uni-' + tag); | ||
function isBuiltInComponent(tag) { | ||
return BUILT_IN_TAGS.indexOf('uni-' + tag) !== -1; | ||
} | ||
function isCustomElement(tag) { | ||
return TAGS.indexOf(tag) !== -1 || BUILT_IN_TAGS.indexOf(tag) !== -1; | ||
} | ||
function isNativeTag(tag) { | ||
return (shared.isHTMLTag(tag) || shared.isSVGTag(tag)) && !isBuiltInComponent(tag); | ||
} | ||
function isServiceNativeTag(tag) { | ||
return shared.isHTMLTag(tag) || shared.isSVGTag(tag) || isBuiltInComponent(tag); | ||
} | ||
function isServiceCustomElement(_tag) { | ||
return false; | ||
} | ||
const COMPONENT_SELECTOR_PREFIX = 'uni-'; | ||
const COMPONENT_PREFIX = 'v-' + COMPONENT_SELECTOR_PREFIX; | ||
class DOMException extends Error { | ||
@@ -580,2 +612,5 @@ constructor(message) { | ||
const ATTR_V_SHOW = '.vShow'; | ||
const ATTR_V_OWNER_ID = '.vOwnerId'; | ||
const ATTR_V_RENDERJS = '.vRenderjs'; | ||
const ATTR_CHANGE_PREFIX = 'change:'; | ||
class UniBaseNode extends UniNode { | ||
@@ -604,3 +639,8 @@ constructor(nodeType, nodeName, container) { | ||
if (this.pageNode && !this.pageNode.isUnmounted) { | ||
this.pageNode.onAddEvent(this, normalizeEventType(type, options), encodeModifier(listener.modifiers || [])); | ||
if (listener.wxsEvent) { | ||
this.pageNode.onAddWxsEvent(this, normalizeEventType(type, options), listener.wxsEvent, encodeModifier(listener.modifiers || [])); | ||
} | ||
else { | ||
this.pageNode.onAddEvent(this, normalizeEventType(type, options), encodeModifier(listener.modifiers || [])); | ||
} | ||
} | ||
@@ -650,2 +690,3 @@ } | ||
if (events.length) { | ||
let w = undefined; | ||
const e = {}; | ||
@@ -656,6 +697,19 @@ events.forEach((name) => { | ||
// 可能存在多个 handler 且不同 modifiers 吗? | ||
e[name] = encodeModifier(handlers[0].modifiers || []); | ||
const { wxsEvent, modifiers } = handlers[0]; | ||
const modifier = encodeModifier(modifiers || []); | ||
if (!wxsEvent) { | ||
e[name] = modifier; | ||
} | ||
else { | ||
if (!w) { | ||
w = {}; | ||
} | ||
w[name] = [normalize ? normalize(wxsEvent) : wxsEvent, modifier]; | ||
} | ||
} | ||
}); | ||
res.e = normalize ? normalize(e, false) : e; | ||
if (w) { | ||
res.w = normalize ? normalize(w, false) : w; | ||
} | ||
} | ||
@@ -679,3 +733,3 @@ if (style !== null) { | ||
super(NODE_TYPE_COMMENT, '#comment', container); | ||
this._text = text; | ||
this._text = (process.env.NODE_ENV !== 'production') ? text : ''; | ||
} | ||
@@ -741,2 +795,3 @@ toJSON(opts = {}) { | ||
const ACTION_TYPE_SET_TEXT = 10; | ||
const ACTION_TYPE_ADD_WXS_EVENT = 12; | ||
const ACTION_TYPE_PAGE_SCROLL = 15; | ||
@@ -818,2 +873,13 @@ const ACTION_TYPE_EVENT = 20; | ||
} | ||
function getValueByDataPath(obj, path) { | ||
const parts = path.split('.'); | ||
let key = parts[0]; | ||
if (!obj) { | ||
obj = {}; | ||
} | ||
if (parts.length === 1) { | ||
return obj[key]; | ||
} | ||
return getValueByDataPath(obj[key], parts.slice(1).join('.')); | ||
} | ||
@@ -849,3 +915,6 @@ function debounce(fn, delay) { | ||
const WEB_INVOKE_APPSERVICE = 'WEB_INVOKE_APPSERVICE'; | ||
const WXS_PROTOCOL = 'wxs://'; | ||
const JSON_PROTOCOL = 'json://'; | ||
const WXS_MODULES = 'wxsModules'; | ||
const RENDERJS_MODULES = 'renderjsModules'; | ||
// lifecycle | ||
@@ -885,2 +954,3 @@ // App and Page | ||
const ON_WEB_INVOKE_APP_SERVICE = 'onWebInvokeAppService'; | ||
const ON_WXS_INVOKE_CALL_METHOD = 'onWxsInvokeCallMethod'; | ||
@@ -968,2 +1038,3 @@ class EventChannel { | ||
exports.ACTION_TYPE_ADD_EVENT = ACTION_TYPE_ADD_EVENT; | ||
exports.ACTION_TYPE_ADD_WXS_EVENT = ACTION_TYPE_ADD_WXS_EVENT; | ||
exports.ACTION_TYPE_CREATE = ACTION_TYPE_CREATE; | ||
@@ -980,2 +1051,3 @@ exports.ACTION_TYPE_EVENT = ACTION_TYPE_EVENT; | ||
exports.ACTION_TYPE_SET_TEXT = ACTION_TYPE_SET_TEXT; | ||
exports.ATTR_CHANGE_PREFIX = ATTR_CHANGE_PREFIX; | ||
exports.ATTR_CLASS = ATTR_CLASS; | ||
@@ -985,2 +1057,4 @@ exports.ATTR_INNER_HTML = ATTR_INNER_HTML; | ||
exports.ATTR_TEXT_CONTENT = ATTR_TEXT_CONTENT; | ||
exports.ATTR_V_OWNER_ID = ATTR_V_OWNER_ID; | ||
exports.ATTR_V_RENDERJS = ATTR_V_RENDERJS; | ||
exports.ATTR_V_SHOW = ATTR_V_SHOW; | ||
@@ -1030,4 +1104,6 @@ exports.BACKGROUND_COLOR = BACKGROUND_COLOR; | ||
exports.ON_WEB_INVOKE_APP_SERVICE = ON_WEB_INVOKE_APP_SERVICE; | ||
exports.ON_WXS_INVOKE_CALL_METHOD = ON_WXS_INVOKE_CALL_METHOD; | ||
exports.PLUS_RE = PLUS_RE; | ||
exports.PRIMARY_COLOR = PRIMARY_COLOR; | ||
exports.RENDERJS_MODULES = RENDERJS_MODULES; | ||
exports.RESPONSIVE_MIN_WIDTH = RESPONSIVE_MIN_WIDTH; | ||
@@ -1052,2 +1128,4 @@ exports.SCHEME_RE = SCHEME_RE; | ||
exports.WEB_INVOKE_APPSERVICE = WEB_INVOKE_APPSERVICE; | ||
exports.WXS_MODULES = WXS_MODULES; | ||
exports.WXS_PROTOCOL = WXS_PROTOCOL; | ||
exports.addFont = addFont; | ||
@@ -1068,2 +1146,3 @@ exports.cache = cache; | ||
exports.getLen = getLen; | ||
exports.getValueByDataPath = getValueByDataPath; | ||
exports.initCustomDataset = initCustomDataset; | ||
@@ -1087,2 +1166,4 @@ exports.invokeArrayFns = invokeArrayFns; | ||
exports.removeLeadingSlash = removeLeadingSlash; | ||
exports.resolveOwnerEl = resolveOwnerEl; | ||
exports.resolveOwnerVm = resolveOwnerVm; | ||
exports.sanitise = sanitise; | ||
@@ -1089,0 +1170,0 @@ exports.scrollTo = scrollTo; |
@@ -0,5 +1,11 @@ | ||
import { ComponentInternalInstance } from 'vue'; | ||
import { ComponentOptionsBase } from 'vue'; | ||
import { ComponentPublicInstance } from 'vue'; | ||
import { FontFaceDescriptors } from 'css-font-loading-module'; | ||
import { RendererNode } from 'vue'; | ||
export declare const ACTION_TYPE_ADD_EVENT = 8; | ||
export declare const ACTION_TYPE_ADD_WXS_EVENT = 12; | ||
export declare const ACTION_TYPE_CREATE = 3; | ||
@@ -41,2 +47,18 @@ | ||
/** | ||
* nodeId | ||
* event | ||
* wxsEvent | ||
* flag | ||
*/ | ||
export declare type AddWxsEventAction = [ | ||
typeof ACTION_TYPE_ADD_WXS_EVENT, | ||
number, | ||
string | number, | ||
string | number, | ||
number | ||
]; | ||
export declare const ATTR_CHANGE_PREFIX = "change:"; | ||
export declare const ATTR_CLASS = "class"; | ||
@@ -50,2 +72,6 @@ | ||
export declare const ATTR_V_OWNER_ID = ".vOwnerId"; | ||
export declare const ATTR_V_RENDERJS = ".vRenderjs"; | ||
export declare const ATTR_V_SHOW = ".vShow"; | ||
@@ -157,2 +183,4 @@ | ||
export declare function getValueByDataPath(obj: any, path: string): unknown; | ||
declare interface HTMLElementWithDataset extends HTMLElement { | ||
@@ -195,2 +223,3 @@ __uniDataset?: Record<string, any>; | ||
onAddEvent: (thisNode: UniNode, name: string, flag: number) => void; | ||
onAddWxsEvent: (thisNode: UniNode, name: string, wxsEvent: string, flag: number) => void; | ||
onRemoveEvent: (thisNode: UniNode, name: string) => void; | ||
@@ -286,2 +315,4 @@ onSetAttribute: (thisNode: UniNode, qualifiedName: string, value: unknown) => void; | ||
export declare const ON_WXS_INVOKE_CALL_METHOD = "onWxsInvokeCallMethod"; | ||
export declare function once<T extends (...args: any[]) => any>(fn: T, ctx?: unknown): T; | ||
@@ -326,3 +357,3 @@ | ||
export declare type PageUpdateAction = CreateAction | InsertAction | RemoveAction | AddEventAction | RemoveEventAction | SetAttributeAction | RemoveAttributeAction | SetTextAction; | ||
export declare type PageUpdateAction = CreateAction | InsertAction | RemoveAction | AddEventAction | AddWxsEventAction | RemoveEventAction | SetAttributeAction | RemoveAttributeAction | SetTextAction; | ||
@@ -382,2 +413,8 @@ export declare function parseEventName(name: string): [string, EventListenerOptions | undefined]; | ||
export declare const RENDERJS_MODULES = "renderjsModules"; | ||
export declare function resolveOwnerEl(instance: ComponentInternalInstance): RendererNode | null; | ||
export declare function resolveOwnerVm(vm: ComponentInternalInstance): ComponentPublicInstance< {}, {}, {}, {}, {}, {}, {}, {}, false, ComponentOptionsBase<any, any, any, any, any, any, any, any, any, {}>> | undefined; | ||
export declare const RESPONSIVE_MIN_WIDTH = 768; | ||
@@ -492,2 +529,3 @@ | ||
modifiers?: string[]; | ||
wxsEvent?: string; | ||
} | ||
@@ -519,2 +557,3 @@ | ||
parentNode: UniNode | null; | ||
__vueParentComponent?: ComponentInternalInstance; | ||
protected _text: string | null; | ||
@@ -555,2 +594,6 @@ constructor(nodeType: UniNodeType, nodeName: string, container: UniElement | IUniPageNode); | ||
/** | ||
* wxs listeners | ||
*/ | ||
w: Record<string, [string, number]>; | ||
/** | ||
* style | ||
@@ -583,2 +626,6 @@ */ | ||
/** | ||
* wxs listeners | ||
*/ | ||
w: [number, [number, number]][]; | ||
/** | ||
* style | ||
@@ -608,2 +655,6 @@ */ | ||
export declare const WXS_MODULES = "wxsModules"; | ||
export declare const WXS_PROTOCOL = "wxs://"; | ||
export { } |
@@ -1,3 +0,116 @@ | ||
import { camelize, extend, isString, isPlainObject, isArray, isHTMLTag, isSVGTag, capitalize, hyphenate } from '@vue/shared'; | ||
import { isHTMLTag, isSVGTag, hyphenate, camelize, extend, isString, isPlainObject, isArray, capitalize } from '@vue/shared'; | ||
const BUILT_IN_TAGS = [ | ||
'ad', | ||
'audio', | ||
'button', | ||
'camera', | ||
'canvas', | ||
'checkbox', | ||
'checkbox-group', | ||
'cover-image', | ||
'cover-view', | ||
'editor', | ||
'form', | ||
'functional-page-navigator', | ||
'icon', | ||
'image', | ||
'input', | ||
'label', | ||
'live-player', | ||
'live-pusher', | ||
'map', | ||
'movable-area', | ||
'movable-view', | ||
'navigator', | ||
'official-account', | ||
'open-data', | ||
'picker', | ||
'picker-view', | ||
'picker-view-column', | ||
'progress', | ||
'radio', | ||
'radio-group', | ||
'rich-text', | ||
'scroll-view', | ||
'slider', | ||
'swiper', | ||
'swiper-item', | ||
'switch', | ||
'text', | ||
'textarea', | ||
'video', | ||
'view', | ||
'web-view', | ||
].map((tag) => 'uni-' + tag); | ||
const TAGS = [ | ||
'app', | ||
'layout', | ||
'content', | ||
'main', | ||
'top-window', | ||
'left-window', | ||
'right-window', | ||
'tabbar', | ||
'page', | ||
'page-head', | ||
'page-wrapper', | ||
'page-body', | ||
'page-refresh', | ||
'actionsheet', | ||
'modal', | ||
'toast', | ||
'resize-sensor', | ||
'shadow-root', | ||
].map((tag) => 'uni-' + tag); | ||
function isBuiltInComponent(tag) { | ||
return BUILT_IN_TAGS.indexOf('uni-' + tag) !== -1; | ||
} | ||
function isCustomElement(tag) { | ||
return TAGS.indexOf(tag) !== -1 || BUILT_IN_TAGS.indexOf(tag) !== -1; | ||
} | ||
function isNativeTag(tag) { | ||
return (isHTMLTag(tag) || isSVGTag(tag)) && !isBuiltInComponent(tag); | ||
} | ||
function isServiceNativeTag(tag) { | ||
return isHTMLTag(tag) || isSVGTag(tag) || isBuiltInComponent(tag); | ||
} | ||
function isServiceCustomElement(_tag) { | ||
return false; | ||
} | ||
const COMPONENT_SELECTOR_PREFIX = 'uni-'; | ||
const COMPONENT_PREFIX = 'v-' + COMPONENT_SELECTOR_PREFIX; | ||
function resolveOwnerVm(vm) { | ||
if (!vm) { | ||
return; | ||
} | ||
let componentName = vm.type.name; | ||
while (componentName && isBuiltInComponent(hyphenate(componentName))) { | ||
// ownerInstance 内置组件需要使用父 vm | ||
vm = vm.parent; | ||
componentName = vm.type.name; | ||
} | ||
return vm.proxy; | ||
} | ||
function isElement(el) { | ||
// Element | ||
return el.nodeType === 1; | ||
} | ||
function resolveOwnerEl(instance) { | ||
const { vnode } = instance; | ||
if (isElement(vnode.el)) { | ||
return vnode.el; | ||
} | ||
const { subTree } = instance; | ||
// ShapeFlags.ARRAY_CHILDREN = 1<<4 | ||
if (subTree.shapeFlag & 16) { | ||
const elemVNode = subTree.children.find((vnode) => isElement(vnode.el)); | ||
if (elemVNode) { | ||
return elemVNode.el; | ||
} | ||
} | ||
return vnode.el; | ||
} | ||
let lastLogTime = 0; | ||
@@ -240,83 +353,2 @@ function formatLog(module, ...args) { | ||
const BUILT_IN_TAGS = [ | ||
'ad', | ||
'audio', | ||
'button', | ||
'camera', | ||
'canvas', | ||
'checkbox', | ||
'checkbox-group', | ||
'cover-image', | ||
'cover-view', | ||
'editor', | ||
'form', | ||
'functional-page-navigator', | ||
'icon', | ||
'image', | ||
'input', | ||
'label', | ||
'live-player', | ||
'live-pusher', | ||
'map', | ||
'movable-area', | ||
'movable-view', | ||
'navigator', | ||
'official-account', | ||
'open-data', | ||
'picker', | ||
'picker-view', | ||
'picker-view-column', | ||
'progress', | ||
'radio', | ||
'radio-group', | ||
'rich-text', | ||
'scroll-view', | ||
'slider', | ||
'swiper', | ||
'swiper-item', | ||
'switch', | ||
'text', | ||
'textarea', | ||
'video', | ||
'view', | ||
'web-view', | ||
].map((tag) => 'uni-' + tag); | ||
const TAGS = [ | ||
'app', | ||
'layout', | ||
'content', | ||
'main', | ||
'top-window', | ||
'left-window', | ||
'right-window', | ||
'tabbar', | ||
'page', | ||
'page-head', | ||
'page-wrapper', | ||
'page-body', | ||
'page-refresh', | ||
'actionsheet', | ||
'modal', | ||
'toast', | ||
'resize-sensor', | ||
'shadow-root', | ||
].map((tag) => 'uni-' + tag); | ||
function isBuiltInComponent(tag) { | ||
return BUILT_IN_TAGS.indexOf('uni-' + tag) !== -1; | ||
} | ||
function isCustomElement(tag) { | ||
return TAGS.indexOf(tag) !== -1 || BUILT_IN_TAGS.indexOf(tag) !== -1; | ||
} | ||
function isNativeTag(tag) { | ||
return (isHTMLTag(tag) || isSVGTag(tag)) && !isBuiltInComponent(tag); | ||
} | ||
function isServiceNativeTag(tag) { | ||
return isHTMLTag(tag) || isSVGTag(tag) || isBuiltInComponent(tag); | ||
} | ||
function isServiceCustomElement(_tag) { | ||
return false; | ||
} | ||
const COMPONENT_SELECTOR_PREFIX = 'uni-'; | ||
const COMPONENT_PREFIX = 'v-' + COMPONENT_SELECTOR_PREFIX; | ||
class DOMException extends Error { | ||
@@ -575,2 +607,5 @@ constructor(message) { | ||
const ATTR_V_SHOW = '.vShow'; | ||
const ATTR_V_OWNER_ID = '.vOwnerId'; | ||
const ATTR_V_RENDERJS = '.vRenderjs'; | ||
const ATTR_CHANGE_PREFIX = 'change:'; | ||
class UniBaseNode extends UniNode { | ||
@@ -599,3 +634,8 @@ constructor(nodeType, nodeName, container) { | ||
if (this.pageNode && !this.pageNode.isUnmounted) { | ||
this.pageNode.onAddEvent(this, normalizeEventType(type, options), encodeModifier(listener.modifiers || [])); | ||
if (listener.wxsEvent) { | ||
this.pageNode.onAddWxsEvent(this, normalizeEventType(type, options), listener.wxsEvent, encodeModifier(listener.modifiers || [])); | ||
} | ||
else { | ||
this.pageNode.onAddEvent(this, normalizeEventType(type, options), encodeModifier(listener.modifiers || [])); | ||
} | ||
} | ||
@@ -645,2 +685,3 @@ } | ||
if (events.length) { | ||
let w = undefined; | ||
const e = {}; | ||
@@ -651,6 +692,19 @@ events.forEach((name) => { | ||
// 可能存在多个 handler 且不同 modifiers 吗? | ||
e[name] = encodeModifier(handlers[0].modifiers || []); | ||
const { wxsEvent, modifiers } = handlers[0]; | ||
const modifier = encodeModifier(modifiers || []); | ||
if (!wxsEvent) { | ||
e[name] = modifier; | ||
} | ||
else { | ||
if (!w) { | ||
w = {}; | ||
} | ||
w[name] = [normalize ? normalize(wxsEvent) : wxsEvent, modifier]; | ||
} | ||
} | ||
}); | ||
res.e = normalize ? normalize(e, false) : e; | ||
if (w) { | ||
res.w = normalize ? normalize(w, false) : w; | ||
} | ||
} | ||
@@ -674,3 +728,3 @@ if (style !== null) { | ||
super(NODE_TYPE_COMMENT, '#comment', container); | ||
this._text = text; | ||
this._text = (process.env.NODE_ENV !== 'production') ? text : ''; | ||
} | ||
@@ -736,2 +790,3 @@ toJSON(opts = {}) { | ||
const ACTION_TYPE_SET_TEXT = 10; | ||
const ACTION_TYPE_ADD_WXS_EVENT = 12; | ||
const ACTION_TYPE_PAGE_SCROLL = 15; | ||
@@ -813,2 +868,13 @@ const ACTION_TYPE_EVENT = 20; | ||
} | ||
function getValueByDataPath(obj, path) { | ||
const parts = path.split('.'); | ||
let key = parts[0]; | ||
if (!obj) { | ||
obj = {}; | ||
} | ||
if (parts.length === 1) { | ||
return obj[key]; | ||
} | ||
return getValueByDataPath(obj[key], parts.slice(1).join('.')); | ||
} | ||
@@ -844,3 +910,6 @@ function debounce(fn, delay) { | ||
const WEB_INVOKE_APPSERVICE = 'WEB_INVOKE_APPSERVICE'; | ||
const WXS_PROTOCOL = 'wxs://'; | ||
const JSON_PROTOCOL = 'json://'; | ||
const WXS_MODULES = 'wxsModules'; | ||
const RENDERJS_MODULES = 'renderjsModules'; | ||
// lifecycle | ||
@@ -880,2 +949,3 @@ // App and Page | ||
const ON_WEB_INVOKE_APP_SERVICE = 'onWebInvokeAppService'; | ||
const ON_WXS_INVOKE_CALL_METHOD = 'onWxsInvokeCallMethod'; | ||
@@ -962,2 +1032,2 @@ class EventChannel { | ||
export { ACTION_TYPE_ADD_EVENT, ACTION_TYPE_CREATE, ACTION_TYPE_EVENT, ACTION_TYPE_INSERT, ACTION_TYPE_PAGE_CREATE, ACTION_TYPE_PAGE_CREATED, ACTION_TYPE_PAGE_SCROLL, ACTION_TYPE_REMOVE, ACTION_TYPE_REMOVE_ATTRIBUTE, ACTION_TYPE_REMOVE_EVENT, ACTION_TYPE_SET_ATTRIBUTE, ACTION_TYPE_SET_TEXT, ATTR_CLASS, ATTR_INNER_HTML, ATTR_STYLE, ATTR_TEXT_CONTENT, ATTR_V_SHOW, BACKGROUND_COLOR, BUILT_IN_TAGS, COMPONENT_NAME_PREFIX, COMPONENT_PREFIX, COMPONENT_SELECTOR_PREFIX, DATA_RE, EventChannel, EventModifierFlags, JSON_PROTOCOL, NAVBAR_HEIGHT, NODE_TYPE_COMMENT, NODE_TYPE_ELEMENT, NODE_TYPE_PAGE, NODE_TYPE_TEXT, ON_ADD_TO_FAVORITES, ON_APP_ENTER_BACKGROUND, ON_APP_ENTER_FOREGROUND, ON_BACK_PRESS, ON_ERROR, ON_HIDE, ON_KEYBOARD_HEIGHT_CHANGE, ON_LAUNCH, ON_LOAD, ON_NAVIGATION_BAR_BUTTON_TAP, ON_NAVIGATION_BAR_SEARCH_INPUT_CHANGED, ON_NAVIGATION_BAR_SEARCH_INPUT_CLICKED, ON_NAVIGATION_BAR_SEARCH_INPUT_CONFIRMED, ON_NAVIGATION_BAR_SEARCH_INPUT_FOCUS_CHANGED, ON_PAGE_NOT_FOUND, ON_PAGE_SCROLL, ON_PULL_DOWN_REFRESH, ON_REACH_BOTTOM, ON_REACH_BOTTOM_DISTANCE, ON_READY, ON_RESIZE, ON_SHARE_APP_MESSAGE, ON_SHARE_TIMELINE, ON_SHOW, ON_TAB_ITEM_TAP, ON_THEME_CHANGE, ON_UNHANDLE_REJECTION, ON_UNLOAD, ON_WEB_INVOKE_APP_SERVICE, PLUS_RE, PRIMARY_COLOR, RESPONSIVE_MIN_WIDTH, SCHEME_RE, SELECTED_COLOR, TABBAR_HEIGHT, TAGS, UNI_SSR, UNI_SSR_DATA, UNI_SSR_GLOBAL_DATA, UNI_SSR_STORE, UNI_SSR_TITLE, UniBaseNode, UniCommentNode, UniElement, UniEvent, UniInputElement, UniNode, UniTextAreaElement, UniTextNode, WEB_INVOKE_APPSERVICE, addFont, cache, cacheStringFunction, callOptions, createRpx2Unit, createUniEvent, debounce, decode, decodedQuery, defaultRpx2Unit, formatDateTime, formatLog, getCustomDataset, getEnvLocale, getLen, initCustomDataset, invokeArrayFns, isBuiltInComponent, isCustomElement, isNativeTag, isRootHook, isServiceCustomElement, isServiceNativeTag, normalizeDataset, normalizeEventType, normalizeTarget, once, parseEventName, parseQuery, parseUrl, passive, plusReady, removeLeadingSlash, sanitise, scrollTo, stringifyQuery, updateElementStyle }; | ||
export { ACTION_TYPE_ADD_EVENT, ACTION_TYPE_ADD_WXS_EVENT, ACTION_TYPE_CREATE, ACTION_TYPE_EVENT, ACTION_TYPE_INSERT, ACTION_TYPE_PAGE_CREATE, ACTION_TYPE_PAGE_CREATED, ACTION_TYPE_PAGE_SCROLL, ACTION_TYPE_REMOVE, ACTION_TYPE_REMOVE_ATTRIBUTE, ACTION_TYPE_REMOVE_EVENT, ACTION_TYPE_SET_ATTRIBUTE, ACTION_TYPE_SET_TEXT, ATTR_CHANGE_PREFIX, ATTR_CLASS, ATTR_INNER_HTML, ATTR_STYLE, ATTR_TEXT_CONTENT, ATTR_V_OWNER_ID, ATTR_V_RENDERJS, ATTR_V_SHOW, BACKGROUND_COLOR, BUILT_IN_TAGS, COMPONENT_NAME_PREFIX, COMPONENT_PREFIX, COMPONENT_SELECTOR_PREFIX, DATA_RE, EventChannel, EventModifierFlags, JSON_PROTOCOL, NAVBAR_HEIGHT, NODE_TYPE_COMMENT, NODE_TYPE_ELEMENT, NODE_TYPE_PAGE, NODE_TYPE_TEXT, ON_ADD_TO_FAVORITES, ON_APP_ENTER_BACKGROUND, ON_APP_ENTER_FOREGROUND, ON_BACK_PRESS, ON_ERROR, ON_HIDE, ON_KEYBOARD_HEIGHT_CHANGE, ON_LAUNCH, ON_LOAD, ON_NAVIGATION_BAR_BUTTON_TAP, ON_NAVIGATION_BAR_SEARCH_INPUT_CHANGED, ON_NAVIGATION_BAR_SEARCH_INPUT_CLICKED, ON_NAVIGATION_BAR_SEARCH_INPUT_CONFIRMED, ON_NAVIGATION_BAR_SEARCH_INPUT_FOCUS_CHANGED, ON_PAGE_NOT_FOUND, ON_PAGE_SCROLL, ON_PULL_DOWN_REFRESH, ON_REACH_BOTTOM, ON_REACH_BOTTOM_DISTANCE, ON_READY, ON_RESIZE, ON_SHARE_APP_MESSAGE, ON_SHARE_TIMELINE, ON_SHOW, ON_TAB_ITEM_TAP, ON_THEME_CHANGE, ON_UNHANDLE_REJECTION, ON_UNLOAD, ON_WEB_INVOKE_APP_SERVICE, ON_WXS_INVOKE_CALL_METHOD, PLUS_RE, PRIMARY_COLOR, RENDERJS_MODULES, RESPONSIVE_MIN_WIDTH, SCHEME_RE, SELECTED_COLOR, TABBAR_HEIGHT, TAGS, UNI_SSR, UNI_SSR_DATA, UNI_SSR_GLOBAL_DATA, UNI_SSR_STORE, UNI_SSR_TITLE, UniBaseNode, UniCommentNode, UniElement, UniEvent, UniInputElement, UniNode, UniTextAreaElement, UniTextNode, WEB_INVOKE_APPSERVICE, WXS_MODULES, WXS_PROTOCOL, addFont, cache, cacheStringFunction, callOptions, createRpx2Unit, createUniEvent, debounce, decode, decodedQuery, defaultRpx2Unit, formatDateTime, formatLog, getCustomDataset, getEnvLocale, getLen, getValueByDataPath, initCustomDataset, invokeArrayFns, isBuiltInComponent, isCustomElement, isNativeTag, isRootHook, isServiceCustomElement, isServiceNativeTag, normalizeDataset, normalizeEventType, normalizeTarget, once, parseEventName, parseQuery, parseUrl, passive, plusReady, removeLeadingSlash, resolveOwnerEl, resolveOwnerVm, sanitise, scrollTo, stringifyQuery, updateElementStyle }; |
{ | ||
"name": "@dcloudio/uni-shared", | ||
"version": "3.0.0-alpha-3000020210809001", | ||
"version": "3.0.0-alpha-3000020210813001", | ||
"description": "@dcloudio/uni-shared", | ||
@@ -21,3 +21,3 @@ "main": "./dist/uni-shared.cjs.js", | ||
}, | ||
"gitHead": "6d3c519da737a01b69b7e002ab7aece7ab4ba94b" | ||
"gitHead": "d5896d19315a106039411c16bbf8b804a865450d" | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
100631
2621
4