@dcloudio/uni-shared
Advanced tools
Comparing version 3.0.0-4010520240507001 to 3.0.0-4020320240708001
@@ -1420,7 +1420,3 @@ 'use strict'; | ||
} | ||
// iOS-X 和安卓一致,on_show 不参与判断,避免引入新的运行时判断,导出两份 | ||
function isRootImmediateHookX(name) { | ||
const PAGE_SYNC_HOOKS = [ON_LOAD]; | ||
return PAGE_SYNC_HOOKS.indexOf(name) > -1; | ||
} | ||
// isRootImmediateHookX deprecated | ||
function isRootHook(name) { | ||
@@ -1570,35 +1566,37 @@ return PAGE_HOOKS.indexOf(name) > -1; | ||
} | ||
function resolveStringStyleItem(modeStyle, styleItem, key) { | ||
if (shared.isString(styleItem) && styleItem.startsWith('@')) { | ||
const _key = styleItem.replace('@', ''); | ||
let _styleItem = modeStyle[_key] || styleItem; | ||
switch (key) { | ||
case 'titleColor': | ||
_styleItem = normalizeTitleColor(_styleItem); | ||
break; | ||
case 'borderStyle': | ||
_styleItem = normalizeTabBarStyles(_styleItem); | ||
break; | ||
} | ||
return _styleItem; | ||
} | ||
return styleItem; | ||
} | ||
function normalizeStyles(pageStyle, themeConfig = {}, mode = 'light') { | ||
const modeStyle = themeConfig[mode]; | ||
const styles = {}; | ||
if (!modeStyle) { | ||
if (typeof modeStyle === 'undefined') | ||
return pageStyle; | ||
} | ||
Object.keys(pageStyle).forEach((key) => { | ||
let styleItem = pageStyle[key] // Object Array String | ||
; | ||
styles[key] = (() => { | ||
if (shared.isPlainObject(styleItem)) { | ||
const styleItem = pageStyle[key]; // Object Array String | ||
const parseStyleItem = () => { | ||
if (shared.isPlainObject(styleItem)) | ||
return normalizeStyles(styleItem, themeConfig, mode); | ||
} | ||
else if (shared.isArray(styleItem)) { | ||
return styleItem.map((item) => shared.isPlainObject(item) | ||
? normalizeStyles(item, themeConfig, mode) | ||
: item); | ||
} | ||
else if (shared.isString(styleItem) && styleItem.startsWith('@')) { | ||
const _key = styleItem.replace('@', ''); | ||
let _styleItem = modeStyle[_key] || styleItem; | ||
switch (key) { | ||
case 'titleColor': | ||
_styleItem = normalizeTitleColor(_styleItem); | ||
break; | ||
case 'borderStyle': | ||
_styleItem = normalizeTabBarStyles(_styleItem); | ||
break; | ||
} | ||
return _styleItem; | ||
} | ||
return styleItem; | ||
})(); | ||
if (shared.isArray(styleItem)) | ||
return styleItem.map((item) => { | ||
if (typeof item === 'object') | ||
return normalizeStyles(item, themeConfig, mode); | ||
return resolveStringStyleItem(modeStyle, item); | ||
}); | ||
return resolveStringStyleItem(modeStyle, styleItem, key); | ||
}; | ||
styles[key] = parseStyleItem(); | ||
}); | ||
@@ -1762,3 +1760,2 @@ return styles; | ||
exports.isRootImmediateHook = isRootImmediateHook; | ||
exports.isRootImmediateHookX = isRootImmediateHookX; | ||
exports.isUniLifecycleHook = isUniLifecycleHook; | ||
@@ -1765,0 +1762,0 @@ exports.isUniXElement = isUniXElement; |
import type { App } from 'vue'; | ||
import type { ComponentInternalInstance } from 'vue'; | ||
import type { ComponentInternalInstance as ComponentInternalInstance_2 } from '@vue/runtime-core'; | ||
import { ComponentOptionsBase } from 'vue'; | ||
@@ -288,4 +287,2 @@ import { ComponentPublicInstance } from 'vue'; | ||
export declare function isRootImmediateHookX(name: string): boolean; | ||
export declare function isUniLifecycleHook(name: string, value: unknown, checkType?: boolean): boolean; | ||
@@ -345,3 +342,3 @@ | ||
export declare function normalizeStyles<T extends Object>(pageStyle: T, themeConfig?: UniApp.ThemeJson, mode?: UniApp.ThemeMode): T; | ||
export declare function normalizeStyles<T extends object>(pageStyle: T, themeConfig?: UniApp.ThemeJson, mode?: UniApp.ThemeMode): T; | ||
@@ -570,2 +567,3 @@ export declare function normalizeTabBarStyles(borderStyle?: string): string | undefined; | ||
windowBottom: number; | ||
nvueFlexDirection?: string; | ||
} | ||
@@ -796,3 +794,3 @@ | ||
parentNode: UniNode | null; | ||
__vueParentComponent?: ComponentInternalInstance_2; | ||
__vueParentComponent?: ComponentInternalInstance; | ||
protected _text: string | null; | ||
@@ -799,0 +797,0 @@ constructor(nodeType: UniNodeType, nodeName: string, container: UniElement | IUniPageNode); |
@@ -1418,7 +1418,3 @@ import { isHTMLTag, isSVGTag, hyphenate, camelize, normalizeStyle as normalizeStyle$1, isString, parseStringStyle, isArray, normalizeClass as normalizeClass$1, isFunction, isPlainObject, extend, capitalize } from '@vue/shared'; | ||
} | ||
// iOS-X 和安卓一致,on_show 不参与判断,避免引入新的运行时判断,导出两份 | ||
function isRootImmediateHookX(name) { | ||
const PAGE_SYNC_HOOKS = [ON_LOAD]; | ||
return PAGE_SYNC_HOOKS.indexOf(name) > -1; | ||
} | ||
// isRootImmediateHookX deprecated | ||
function isRootHook(name) { | ||
@@ -1568,35 +1564,37 @@ return PAGE_HOOKS.indexOf(name) > -1; | ||
} | ||
function resolveStringStyleItem(modeStyle, styleItem, key) { | ||
if (isString(styleItem) && styleItem.startsWith('@')) { | ||
const _key = styleItem.replace('@', ''); | ||
let _styleItem = modeStyle[_key] || styleItem; | ||
switch (key) { | ||
case 'titleColor': | ||
_styleItem = normalizeTitleColor(_styleItem); | ||
break; | ||
case 'borderStyle': | ||
_styleItem = normalizeTabBarStyles(_styleItem); | ||
break; | ||
} | ||
return _styleItem; | ||
} | ||
return styleItem; | ||
} | ||
function normalizeStyles(pageStyle, themeConfig = {}, mode = 'light') { | ||
const modeStyle = themeConfig[mode]; | ||
const styles = {}; | ||
if (!modeStyle) { | ||
if (typeof modeStyle === 'undefined') | ||
return pageStyle; | ||
} | ||
Object.keys(pageStyle).forEach((key) => { | ||
let styleItem = pageStyle[key] // Object Array String | ||
; | ||
styles[key] = (() => { | ||
if (isPlainObject(styleItem)) { | ||
const styleItem = pageStyle[key]; // Object Array String | ||
const parseStyleItem = () => { | ||
if (isPlainObject(styleItem)) | ||
return normalizeStyles(styleItem, themeConfig, mode); | ||
} | ||
else if (isArray(styleItem)) { | ||
return styleItem.map((item) => isPlainObject(item) | ||
? normalizeStyles(item, themeConfig, mode) | ||
: item); | ||
} | ||
else if (isString(styleItem) && styleItem.startsWith('@')) { | ||
const _key = styleItem.replace('@', ''); | ||
let _styleItem = modeStyle[_key] || styleItem; | ||
switch (key) { | ||
case 'titleColor': | ||
_styleItem = normalizeTitleColor(_styleItem); | ||
break; | ||
case 'borderStyle': | ||
_styleItem = normalizeTabBarStyles(_styleItem); | ||
break; | ||
} | ||
return _styleItem; | ||
} | ||
return styleItem; | ||
})(); | ||
if (isArray(styleItem)) | ||
return styleItem.map((item) => { | ||
if (typeof item === 'object') | ||
return normalizeStyles(item, themeConfig, mode); | ||
return resolveStringStyleItem(modeStyle, item); | ||
}); | ||
return resolveStringStyleItem(modeStyle, styleItem, key); | ||
}; | ||
styles[key] = parseStyleItem(); | ||
}); | ||
@@ -1612,2 +1610,2 @@ return styles; | ||
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, BUILT_IN_TAG_NAMES, COMPONENT_NAME_PREFIX, COMPONENT_PREFIX, COMPONENT_SELECTOR_PREFIX, DATA_RE, E$1 as Emitter, EventChannel, EventModifierFlags, I18N_JSON_DELIMITERS, JSON_PROTOCOL, LINEFEED, MINI_PROGRAM_PAGE_RUNTIME_HOOKS, NAVBAR_HEIGHT, NODE_TYPE_COMMENT, NODE_TYPE_ELEMENT, NODE_TYPE_PAGE, NODE_TYPE_TEXT, NVUE_BUILT_IN_TAGS, NVUE_U_BUILT_IN_TAGS, OFF_THEME_CHANGE, ON_ADD_TO_FAVORITES, ON_APP_ENTER_BACKGROUND, ON_APP_ENTER_FOREGROUND, ON_BACK_PRESS, ON_ERROR, ON_EXIT, ON_HIDE, ON_INIT, ON_KEYBOARD_HEIGHT_CHANGE, ON_LAUNCH, ON_LOAD, ON_NAVIGATION_BAR_BUTTON_TAP, ON_NAVIGATION_BAR_CHANGE, 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_SAVE_EXIT_STATE, 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, SLOT_DEFAULT_NAME, TABBAR_HEIGHT, TAGS, UNI_SSR, UNI_SSR_DATA, UNI_SSR_GLOBAL_DATA, UNI_SSR_STORE, UNI_SSR_TITLE, UNI_STORAGE_LOCALE, UNI_UI_CONFLICT_TAGS, UVUE_BUILT_IN_TAGS, UVUE_IOS_BUILT_IN_TAGS, UVUE_WEB_BUILT_IN_TAGS, UniBaseNode, UniCommentNode, UniElement, UniEvent, UniInputElement, UniLifecycleHooks, UniNode, UniTextAreaElement, UniTextNode, WEB_INVOKE_APPSERVICE, WXS_MODULES, WXS_PROTOCOL, addFont, addLeadingSlash, borderStyles, cache, cacheStringFunction, callOptions, createIsCustomElement, createRpx2Unit, createUniEvent, customizeEvent, debounce, decode, decodedQuery, defaultMiniProgramRpx2Unit, defaultNVueRpx2Unit, defaultRpx2Unit, dynamicSlotName, forcePatchProp, formatDateTime, formatLog, getCustomDataset, getEnvLocale, getLen, getValueByDataPath, initCustomDatasetOnce, invokeArrayFns, invokeCreateErrorHandler, invokeCreateVueAppHook, isAppIOSUVueNativeTag, isAppNVueNativeTag, isAppNativeTag, isAppUVueNativeTag, isBuiltInComponent, isComponentInternalInstance, isComponentTag, isH5CustomElement, isH5NativeTag, isMiniProgramNativeTag, isRootHook, isRootImmediateHook, isRootImmediateHookX, isUniLifecycleHook, isUniXElement, normalizeClass, normalizeDataset, normalizeEventType, normalizeProps, normalizeStyle, normalizeStyles, normalizeTabBarStyles, normalizeTarget, normalizeTitleColor, onCreateVueApp, once, parseEventName, parseNVueDataset, parseQuery, parseUrl, passive, plusReady, removeLeadingSlash, resolveComponentInstance, resolveOwnerEl, resolveOwnerVm, sanitise, scrollTo, sortObject, 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, BUILT_IN_TAG_NAMES, COMPONENT_NAME_PREFIX, COMPONENT_PREFIX, COMPONENT_SELECTOR_PREFIX, DATA_RE, E$1 as Emitter, EventChannel, EventModifierFlags, I18N_JSON_DELIMITERS, JSON_PROTOCOL, LINEFEED, MINI_PROGRAM_PAGE_RUNTIME_HOOKS, NAVBAR_HEIGHT, NODE_TYPE_COMMENT, NODE_TYPE_ELEMENT, NODE_TYPE_PAGE, NODE_TYPE_TEXT, NVUE_BUILT_IN_TAGS, NVUE_U_BUILT_IN_TAGS, OFF_THEME_CHANGE, ON_ADD_TO_FAVORITES, ON_APP_ENTER_BACKGROUND, ON_APP_ENTER_FOREGROUND, ON_BACK_PRESS, ON_ERROR, ON_EXIT, ON_HIDE, ON_INIT, ON_KEYBOARD_HEIGHT_CHANGE, ON_LAUNCH, ON_LOAD, ON_NAVIGATION_BAR_BUTTON_TAP, ON_NAVIGATION_BAR_CHANGE, 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_SAVE_EXIT_STATE, 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, SLOT_DEFAULT_NAME, TABBAR_HEIGHT, TAGS, UNI_SSR, UNI_SSR_DATA, UNI_SSR_GLOBAL_DATA, UNI_SSR_STORE, UNI_SSR_TITLE, UNI_STORAGE_LOCALE, UNI_UI_CONFLICT_TAGS, UVUE_BUILT_IN_TAGS, UVUE_IOS_BUILT_IN_TAGS, UVUE_WEB_BUILT_IN_TAGS, UniBaseNode, UniCommentNode, UniElement, UniEvent, UniInputElement, UniLifecycleHooks, UniNode, UniTextAreaElement, UniTextNode, WEB_INVOKE_APPSERVICE, WXS_MODULES, WXS_PROTOCOL, addFont, addLeadingSlash, borderStyles, cache, cacheStringFunction, callOptions, createIsCustomElement, createRpx2Unit, createUniEvent, customizeEvent, debounce, decode, decodedQuery, defaultMiniProgramRpx2Unit, defaultNVueRpx2Unit, defaultRpx2Unit, dynamicSlotName, forcePatchProp, formatDateTime, formatLog, getCustomDataset, getEnvLocale, getLen, getValueByDataPath, initCustomDatasetOnce, invokeArrayFns, invokeCreateErrorHandler, invokeCreateVueAppHook, isAppIOSUVueNativeTag, isAppNVueNativeTag, isAppNativeTag, isAppUVueNativeTag, isBuiltInComponent, isComponentInternalInstance, isComponentTag, isH5CustomElement, isH5NativeTag, isMiniProgramNativeTag, isRootHook, isRootImmediateHook, isUniLifecycleHook, isUniXElement, normalizeClass, normalizeDataset, normalizeEventType, normalizeProps, normalizeStyle, normalizeStyles, normalizeTabBarStyles, normalizeTarget, normalizeTitleColor, onCreateVueApp, once, parseEventName, parseNVueDataset, parseQuery, parseUrl, passive, plusReady, removeLeadingSlash, resolveComponentInstance, resolveOwnerEl, resolveOwnerVm, sanitise, scrollTo, sortObject, stringifyQuery, updateElementStyle }; |
{ | ||
"name": "@dcloudio/uni-shared", | ||
"version": "3.0.0-4010520240507001", | ||
"version": "3.0.0-4020320240708001", | ||
"description": "@dcloudio/uni-shared", | ||
@@ -5,0 +5,0 @@ "main": "./dist/uni-shared.cjs.js", |
142797
4023