@dcloudio/uni-shared
Advanced tools
Comparing version 3.0.0-alpha-3021120211020001 to 3.0.0-alpha-3021220211102002
@@ -75,14 +75,17 @@ 'use strict'; | ||
} | ||
function isCustomElement(tag) { | ||
function isH5CustomElement(tag) { | ||
return TAGS.indexOf(tag) !== -1 || BUILT_IN_TAGS.indexOf(tag) !== -1; | ||
} | ||
function isNativeTag(tag) { | ||
function isH5NativeTag(tag) { | ||
return (shared.isHTMLTag(tag) || shared.isSVGTag(tag)) && !isBuiltInComponent(tag); | ||
} | ||
function isServiceNativeTag(tag) { | ||
function isNativeTag(tag) { | ||
return shared.isHTMLTag(tag) || shared.isSVGTag(tag) || isBuiltInComponent(tag); | ||
} | ||
function isServiceCustomElement(_tag) { | ||
function isCustomElement(_tag) { | ||
return false; | ||
} | ||
function isComponentTag(tag) { | ||
return tag[0].toLowerCase() + tag.slice(1) === 'component'; | ||
} | ||
const COMPONENT_SELECTOR_PREFIX = 'uni-'; | ||
@@ -172,2 +175,7 @@ const COMPONENT_PREFIX = 'v-' + COMPONENT_SELECTOR_PREFIX; | ||
}; | ||
const defaultMiniProgramRpx2Unit = { | ||
unit: 'rpx', | ||
unitRatio: 1, | ||
unitPrecision: 1, | ||
}; | ||
function createRpx2Unit(unit, unitRatio, unitPrecision) { | ||
@@ -179,2 +187,5 @@ // ignore: rpxCalcIncludeWidth | ||
} | ||
if (unitRatio === 1) { | ||
return `${$1}${unit}`; | ||
} | ||
const value = toFixed(parseFloat($1) * unitRatio, unitPrecision); | ||
@@ -408,2 +419,14 @@ return value === 0 ? '0' : `${value}${unit}`; | ||
function getDataByPath(obj, path) { | ||
const parts = path.split('.'); | ||
const key = parts[0]; | ||
if (!obj) { | ||
obj = {}; | ||
} | ||
if (parts.length === 1) { | ||
return obj[key]; | ||
} | ||
return getDataByPath(obj[key], parts.slice(1).join('.')); | ||
} | ||
function plusReady(callback) { | ||
@@ -952,2 +975,3 @@ if (typeof callback !== 'function') { | ||
const LINEFEED = '\n'; | ||
const NAVBAR_HEIGHT = 44; | ||
@@ -1149,2 +1173,3 @@ const TABBAR_HEIGHT = 50; | ||
exports.JSON_PROTOCOL = JSON_PROTOCOL; | ||
exports.LINEFEED = LINEFEED; | ||
exports.NAVBAR_HEIGHT = NAVBAR_HEIGHT; | ||
@@ -1219,2 +1244,3 @@ exports.NODE_TYPE_COMMENT = NODE_TYPE_COMMENT; | ||
exports.decodedQuery = decodedQuery; | ||
exports.defaultMiniProgramRpx2Unit = defaultMiniProgramRpx2Unit; | ||
exports.defaultRpx2Unit = defaultRpx2Unit; | ||
@@ -1225,2 +1251,3 @@ exports.formatAppLog = formatAppLog; | ||
exports.getCustomDataset = getCustomDataset; | ||
exports.getDataByPath = getDataByPath; | ||
exports.getEnvLocale = getEnvLocale; | ||
@@ -1232,7 +1259,8 @@ exports.getLen = getLen; | ||
exports.isBuiltInComponent = isBuiltInComponent; | ||
exports.isComponentTag = isComponentTag; | ||
exports.isCustomElement = isCustomElement; | ||
exports.isH5CustomElement = isH5CustomElement; | ||
exports.isH5NativeTag = isH5NativeTag; | ||
exports.isNativeTag = isNativeTag; | ||
exports.isRootHook = isRootHook; | ||
exports.isServiceCustomElement = isServiceCustomElement; | ||
exports.isServiceNativeTag = isServiceNativeTag; | ||
exports.normalizeDataset = normalizeDataset; | ||
@@ -1239,0 +1267,0 @@ exports.normalizeEventType = normalizeEventType; |
@@ -135,2 +135,8 @@ import { ComponentInternalInstance } from 'vue'; | ||
export declare const defaultMiniProgramRpx2Unit: { | ||
unit: string; | ||
unitRatio: number; | ||
unitPrecision: number; | ||
}; | ||
export declare const defaultRpx2Unit: { | ||
@@ -179,2 +185,4 @@ unit: string; | ||
export declare function getDataByPath(obj: Record<string | number, any>, path: string): unknown; | ||
export declare function getEnvLocale(): string; | ||
@@ -205,4 +213,10 @@ | ||
export declare function isCustomElement(tag: string): boolean; | ||
export declare function isComponentTag(tag: string): boolean; | ||
export declare function isCustomElement(_tag: string): boolean; | ||
export declare function isH5CustomElement(tag: string): boolean; | ||
export declare function isH5NativeTag(tag: string): boolean; | ||
export declare function isNativeTag(tag: string): boolean; | ||
@@ -212,6 +226,2 @@ | ||
export declare function isServiceCustomElement(_tag: string): boolean; | ||
export declare function isServiceNativeTag(tag: string): boolean; | ||
export declare interface IUniPageNode { | ||
@@ -237,2 +247,4 @@ pageId: number; | ||
export declare const LINEFEED = "\n"; | ||
export declare const NAVBAR_HEIGHT = 44; | ||
@@ -239,0 +251,0 @@ |
@@ -71,14 +71,17 @@ import { isHTMLTag, isSVGTag, hyphenate, camelize, extend, isString, isPlainObject, isArray, toTypeString, toRawType, capitalize } from '@vue/shared'; | ||
} | ||
function isCustomElement(tag) { | ||
function isH5CustomElement(tag) { | ||
return TAGS.indexOf(tag) !== -1 || BUILT_IN_TAGS.indexOf(tag) !== -1; | ||
} | ||
function isNativeTag(tag) { | ||
function isH5NativeTag(tag) { | ||
return (isHTMLTag(tag) || isSVGTag(tag)) && !isBuiltInComponent(tag); | ||
} | ||
function isServiceNativeTag(tag) { | ||
function isNativeTag(tag) { | ||
return isHTMLTag(tag) || isSVGTag(tag) || isBuiltInComponent(tag); | ||
} | ||
function isServiceCustomElement(_tag) { | ||
function isCustomElement(_tag) { | ||
return false; | ||
} | ||
function isComponentTag(tag) { | ||
return tag[0].toLowerCase() + tag.slice(1) === 'component'; | ||
} | ||
const COMPONENT_SELECTOR_PREFIX = 'uni-'; | ||
@@ -168,2 +171,7 @@ const COMPONENT_PREFIX = 'v-' + COMPONENT_SELECTOR_PREFIX; | ||
}; | ||
const defaultMiniProgramRpx2Unit = { | ||
unit: 'rpx', | ||
unitRatio: 1, | ||
unitPrecision: 1, | ||
}; | ||
function createRpx2Unit(unit, unitRatio, unitPrecision) { | ||
@@ -175,2 +183,5 @@ // ignore: rpxCalcIncludeWidth | ||
} | ||
if (unitRatio === 1) { | ||
return `${$1}${unit}`; | ||
} | ||
const value = toFixed(parseFloat($1) * unitRatio, unitPrecision); | ||
@@ -404,2 +415,14 @@ return value === 0 ? '0' : `${value}${unit}`; | ||
function getDataByPath(obj, path) { | ||
const parts = path.split('.'); | ||
const key = parts[0]; | ||
if (!obj) { | ||
obj = {}; | ||
} | ||
if (parts.length === 1) { | ||
return obj[key]; | ||
} | ||
return getDataByPath(obj[key], parts.slice(1).join('.')); | ||
} | ||
function plusReady(callback) { | ||
@@ -948,2 +971,3 @@ if (typeof callback !== 'function') { | ||
const LINEFEED = '\n'; | ||
const NAVBAR_HEIGHT = 44; | ||
@@ -1114,2 +1138,2 @@ const TABBAR_HEIGHT = 50; | ||
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, I18N_JSON_DELIMITERS, 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, UniLifecycleHooks, UniNode, UniTextAreaElement, UniTextNode, WEB_INVOKE_APPSERVICE, WXS_MODULES, WXS_PROTOCOL, addFont, cache, cacheStringFunction, callOptions, createRpx2Unit, createUniEvent, debounce, decode, decodedQuery, defaultRpx2Unit, formatAppLog, 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 }; | ||
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, I18N_JSON_DELIMITERS, JSON_PROTOCOL, LINEFEED, 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, UniLifecycleHooks, UniNode, UniTextAreaElement, UniTextNode, WEB_INVOKE_APPSERVICE, WXS_MODULES, WXS_PROTOCOL, addFont, cache, cacheStringFunction, callOptions, createRpx2Unit, createUniEvent, debounce, decode, decodedQuery, defaultMiniProgramRpx2Unit, defaultRpx2Unit, formatAppLog, formatDateTime, formatLog, getCustomDataset, getDataByPath, getEnvLocale, getLen, getValueByDataPath, initCustomDataset, invokeArrayFns, isBuiltInComponent, isComponentTag, isCustomElement, isH5CustomElement, isH5NativeTag, isNativeTag, isRootHook, 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-3021120211020001", | ||
"version": "3.0.0-alpha-3021220211102002", | ||
"description": "@dcloudio/uni-shared", | ||
@@ -21,3 +21,3 @@ "main": "./dist/uni-shared.cjs.js", | ||
}, | ||
"gitHead": "df3822d2529c1449e0b7508f6360414e4d04436f" | ||
"gitHead": "370c4aaa417d694ecff57064e2427c18790e85cd" | ||
} |
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
108198
2857