Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@dcloudio/uni-shared

Package Overview
Dependencies
Maintainers
0
Versions
577
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@dcloudio/uni-shared - npm Package Compare versions

Comparing version 3.0.0-4020920240930001 to 3.0.0-4030620241128001

330

dist/uni-shared.cjs.js

@@ -117,3 +117,6 @@ 'use strict';

const UVUE_BUILT_IN_TAGS = [
'object',
'ad',
'ad-content-page',
'ad-draw',
'native-view',
'loading-indicator',

@@ -134,2 +137,4 @@ 'list-view',

'nested-scroll-body',
'grid-view',
'grid-item',
];

@@ -214,2 +219,12 @@ const UVUE_WEB_BUILT_IN_TAGS = [

];
// 内置的easycom组件
const UVUE_BUILT_IN_EASY_COMPONENTS = ['map'];
function isAppUVueBuiltInEasyComponent(tag) {
return UVUE_BUILT_IN_EASY_COMPONENTS.includes(tag);
}
// 主要是指前端实现的组件列表
const UVUE_CUSTOM_COMPONENTS = [
...NVUE_CUSTOM_COMPONENTS,
...UVUE_BUILT_IN_EASY_COMPONENTS,
];
function isAppUVueNativeTag(tag) {

@@ -223,3 +238,3 @@ // 前端实现的内置组件都会注册一个根组件

}
if (NVUE_CUSTOM_COMPONENTS.includes(tag)) {
if (UVUE_CUSTOM_COMPONENTS.includes(tag)) {
return false;

@@ -271,2 +286,9 @@ }

}
function isMiniProgramUVueNativeTag(tag) {
// 小程序平台内置的自定义元素,会被转换为 view
if (tag.startsWith('uni-') && tag.endsWith('-element')) {
return true;
}
return isBuiltInComponent(tag);
}
function createIsCustomElement(tags = []) {

@@ -317,2 +339,4 @@ return function isCustomElement(tag) {

const OFF_THEME_CHANGE = 'offThemeChange';
const ON_HOST_THEME_CHANGE = 'onHostThemeChange';
const OFF_HOST_THEME_CHANGE = 'offHostThemeChange';
const ON_KEYBOARD_HEIGHT_CHANGE = 'onKeyboardHeightChange';

@@ -337,2 +361,3 @@ const ON_PAGE_NOT_FOUND = 'onPageNotFound';

const ON_SHARE_TIMELINE = 'onShareTimeline';
const ON_SHARE_CHAT = 'onShareChat'; // xhs-share
const ON_ADD_TO_FAVORITES = 'onAddToFavorites';

@@ -353,2 +378,143 @@ const ON_SHARE_APP_MESSAGE = 'onShareAppMessage';

function cache(fn) {
const cache = Object.create(null);
return (str) => {
const hit = cache[str];
return hit || (cache[str] = fn(str));
};
}
function cacheStringFunction(fn) {
return cache(fn);
}
function getLen(str = '') {
return ('' + str).replace(/[^\x00-\xff]/g, '**').length;
}
function hasLeadingSlash(str) {
return str.indexOf('/') === 0;
}
function addLeadingSlash(str) {
return hasLeadingSlash(str) ? str : '/' + str;
}
function removeLeadingSlash(str) {
return hasLeadingSlash(str) ? str.slice(1) : str;
}
const invokeArrayFns = (fns, arg) => {
let ret;
for (let i = 0; i < fns.length; i++) {
ret = fns[i](arg);
}
return ret;
};
function updateElementStyle(element, styles) {
for (const attrName in styles) {
element.style[attrName] = styles[attrName];
}
}
function once(fn, ctx = null) {
let res;
return ((...args) => {
if (fn) {
res = fn.apply(ctx, args);
fn = null;
}
return res;
});
}
const sanitise = (val) => (val && JSON.parse(JSON.stringify(val))) || val;
const _completeValue = (value) => (value > 9 ? value : '0' + value);
function formatDateTime({ date = new Date(), mode = 'date' }) {
if (mode === 'time') {
return (_completeValue(date.getHours()) + ':' + _completeValue(date.getMinutes()));
}
else {
return (date.getFullYear() +
'-' +
_completeValue(date.getMonth() + 1) +
'-' +
_completeValue(date.getDate()));
}
}
function callOptions(options, data) {
options = options || {};
if (shared.isString(data)) {
data = {
errMsg: data,
};
}
if (/:ok$/.test(data.errMsg)) {
if (shared.isFunction(options.success)) {
options.success(data);
}
}
else {
if (shared.isFunction(options.fail)) {
options.fail(data);
}
}
if (shared.isFunction(options.complete)) {
options.complete(data);
}
}
function getValueByDataPath(obj, path) {
if (!shared.isString(path)) {
return;
}
path = path.replace(/\[(\d+)\]/g, '.$1');
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('.'));
}
function sortObject(obj) {
let sortObj = {};
if (shared.isPlainObject(obj)) {
Object.keys(obj)
.sort()
.forEach((key) => {
const _key = key;
sortObj[_key] = obj[_key];
});
}
return !Object.keys(sortObj) ? obj : sortObj;
}
function getGlobalOnce() {
if (typeof globalThis !== 'undefined') {
return globalThis;
}
// worker
if (typeof self !== 'undefined') {
return self;
}
// browser
if (typeof window !== 'undefined') {
return window;
}
// nodejs
// if (typeof global !== 'undefined') {
// return global
// }
function g() {
return this;
}
if (typeof g() !== 'undefined') {
return g();
}
return (function () {
return new Function('return this')();
})();
}
let g = undefined;
function getGlobal() {
if (g) {
return g;
}
g = getGlobalOnce();
return g;
}
function isComponentInternalInstance(vm) {

@@ -403,4 +569,12 @@ return !!vm.appContext;

function normalizeStyle(value) {
if (value instanceof Map) {
const g = getGlobal();
if (g && g.UTSJSONObject && value instanceof g.UTSJSONObject) {
const styleObject = {};
g.UTSJSONObject.keys(value).forEach((key) => {
styleObject[key] = value[key];
});
return shared.normalizeStyle(styleObject);
}
else if (value instanceof Map) {
const styleObject = {};
value.forEach((value, key) => {

@@ -435,3 +609,11 @@ styleObject[key] = value;

let res = '';
if (value instanceof Map) {
const g = getGlobal();
if (g && g.UTSJSONObject && value instanceof g.UTSJSONObject) {
g.UTSJSONObject.keys(value).forEach((key) => {
if (value[key]) {
res += key + ' ';
}
});
}
else if (value instanceof Map) {
value.forEach((value, key) => {

@@ -479,109 +661,2 @@ if (value) {

function cache(fn) {
const cache = Object.create(null);
return (str) => {
const hit = cache[str];
return hit || (cache[str] = fn(str));
};
}
function cacheStringFunction(fn) {
return cache(fn);
}
function getLen(str = '') {
return ('' + str).replace(/[^\x00-\xff]/g, '**').length;
}
function hasLeadingSlash(str) {
return str.indexOf('/') === 0;
}
function addLeadingSlash(str) {
return hasLeadingSlash(str) ? str : '/' + str;
}
function removeLeadingSlash(str) {
return hasLeadingSlash(str) ? str.slice(1) : str;
}
const invokeArrayFns = (fns, arg) => {
let ret;
for (let i = 0; i < fns.length; i++) {
ret = fns[i](arg);
}
return ret;
};
function updateElementStyle(element, styles) {
for (const attrName in styles) {
element.style[attrName] = styles[attrName];
}
}
function once(fn, ctx = null) {
let res;
return ((...args) => {
if (fn) {
res = fn.apply(ctx, args);
fn = null;
}
return res;
});
}
const sanitise = (val) => (val && JSON.parse(JSON.stringify(val))) || val;
const _completeValue = (value) => (value > 9 ? value : '0' + value);
function formatDateTime({ date = new Date(), mode = 'date' }) {
if (mode === 'time') {
return (_completeValue(date.getHours()) + ':' + _completeValue(date.getMinutes()));
}
else {
return (date.getFullYear() +
'-' +
_completeValue(date.getMonth() + 1) +
'-' +
_completeValue(date.getDate()));
}
}
function callOptions(options, data) {
options = options || {};
if (shared.isString(data)) {
data = {
errMsg: data,
};
}
if (/:ok$/.test(data.errMsg)) {
if (shared.isFunction(options.success)) {
options.success(data);
}
}
else {
if (shared.isFunction(options.fail)) {
options.fail(data);
}
}
if (shared.isFunction(options.complete)) {
options.complete(data);
}
}
function getValueByDataPath(obj, path) {
if (!shared.isString(path)) {
return;
}
path = path.replace(/\[(\d+)\]/g, '.$1');
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('.'));
}
function sortObject(obj) {
let sortObj = {};
if (shared.isPlainObject(obj)) {
Object.keys(obj)
.sort()
.forEach((key) => {
const _key = key;
sortObj[_key] = obj[_key];
});
}
return !Object.keys(sortObj) ? obj : sortObj;
}
function formatKey(key) {

@@ -1422,2 +1497,3 @@ return shared.camelize(key.substring(5));

ON_SHARE_APP_MESSAGE,
ON_SHARE_CHAT,
ON_ADD_TO_FAVORITES,

@@ -1461,2 +1537,3 @@ ON_SAVE_EXIT_STATE,

ON_SHARE_APP_MESSAGE,
ON_SHARE_CHAT,
ON_SAVE_EXIT_STATE,

@@ -1519,2 +1596,3 @@ ON_NAVIGATION_BAR_BUTTON_TAP,

E.prototype = {
_id: 1,
on: function (name, callback, ctx) {

@@ -1525,4 +1603,5 @@ var e = this.e || (this.e = {});

ctx: ctx,
_id: this._id,
});
return this;
return this._id++;
},

@@ -1548,9 +1627,11 @@ once: function (name, callback, ctx) {

},
off: function (name, callback) {
off: function (name, event) {
var e = this.e || (this.e = {});
var evts = e[name];
var liveEvents = [];
if (evts && callback) {
if (evts && event) {
for (var i = evts.length - 1; i >= 0; i--) {
if (evts[i].fn === callback || evts[i].fn._ === callback) {
if (evts[i].fn === event ||
evts[i].fn._ === event ||
evts[i]._id === event) {
evts.splice(i, 1);

@@ -1629,2 +1710,11 @@ break;

const SYSTEM_DIALOG_PAGE_PATH_STARTER = 'uni:';
const SYSTEM_DIALOG_ACTION_SHEET_PAGE_PATH = 'uni:actionSheet';
function isSystemDialogPage(page) {
return page.route.startsWith(SYSTEM_DIALOG_PAGE_PATH_STARTER);
}
function isSystemActionSheetDialogPage(page) {
return page.route.startsWith(SYSTEM_DIALOG_ACTION_SHEET_PAGE_PATH);
}
exports.ACTION_TYPE_ADD_EVENT = ACTION_TYPE_ADD_EVENT;

@@ -1672,2 +1762,3 @@ exports.ACTION_TYPE_ADD_WXS_EVENT = ACTION_TYPE_ADD_WXS_EVENT;

exports.NVUE_U_BUILT_IN_TAGS = NVUE_U_BUILT_IN_TAGS;
exports.OFF_HOST_THEME_CHANGE = OFF_HOST_THEME_CHANGE;
exports.OFF_THEME_CHANGE = OFF_THEME_CHANGE;

@@ -1681,2 +1772,3 @@ exports.ON_ADD_TO_FAVORITES = ON_ADD_TO_FAVORITES;

exports.ON_HIDE = ON_HIDE;
exports.ON_HOST_THEME_CHANGE = ON_HOST_THEME_CHANGE;
exports.ON_INIT = ON_INIT;

@@ -1701,2 +1793,3 @@ exports.ON_KEYBOARD_HEIGHT_CHANGE = ON_KEYBOARD_HEIGHT_CHANGE;

exports.ON_SHARE_APP_MESSAGE = ON_SHARE_APP_MESSAGE;
exports.ON_SHARE_CHAT = ON_SHARE_CHAT;
exports.ON_SHARE_TIMELINE = ON_SHARE_TIMELINE;

@@ -1717,2 +1810,4 @@ exports.ON_SHOW = ON_SHOW;

exports.SLOT_DEFAULT_NAME = SLOT_DEFAULT_NAME;
exports.SYSTEM_DIALOG_ACTION_SHEET_PAGE_PATH = SYSTEM_DIALOG_ACTION_SHEET_PAGE_PATH;
exports.SYSTEM_DIALOG_PAGE_PATH_STARTER = SYSTEM_DIALOG_PAGE_PATH_STARTER;
exports.TABBAR_HEIGHT = TABBAR_HEIGHT;

@@ -1764,2 +1859,3 @@ exports.TAGS = TAGS;

exports.getEnvLocale = getEnvLocale;
exports.getGlobal = getGlobal;
exports.getLen = getLen;

@@ -1774,2 +1870,3 @@ exports.getValueByDataPath = getValueByDataPath;

exports.isAppNativeTag = isAppNativeTag;
exports.isAppUVueBuiltInEasyComponent = isAppUVueBuiltInEasyComponent;
exports.isAppUVueNativeTag = isAppUVueNativeTag;

@@ -1782,4 +1879,7 @@ exports.isBuiltInComponent = isBuiltInComponent;

exports.isMiniProgramNativeTag = isMiniProgramNativeTag;
exports.isMiniProgramUVueNativeTag = isMiniProgramUVueNativeTag;
exports.isRootHook = isRootHook;
exports.isRootImmediateHook = isRootImmediateHook;
exports.isSystemActionSheetDialogPage = isSystemActionSheetDialogPage;
exports.isSystemDialogPage = isSystemDialogPage;
exports.isUniLifecycleHook = isUniLifecycleHook;

@@ -1786,0 +1886,0 @@ exports.isUniXElement = isUniXElement;

@@ -8,2 +8,3 @@ import type { App } from 'vue';

import type { RendererNode } from 'vue';
import type { UniDialogPage } from '@dcloudio/uni-app-x/types/page';

@@ -181,6 +182,7 @@ export declare const ACTION_TYPE_ADD_EVENT = 8;

e: Record<string, unknown>;
on: (name: EventName, callback: EventCallback, ctx?: any) => this;
once: (name: EventName, callback: EventCallback, ctx?: any) => this;
_id: number;
on: (name: EventName, callback: EventCallback, ctx?: any) => number;
once: (name: EventName, callback: EventCallback, ctx?: any) => number;
emit: (name: EventName, ...args: any[]) => this;
off: (name: EventName, callback?: EventCallback) => this;
off: (name: EventName, callback?: EventCallback | null) => this;
}

@@ -233,2 +235,4 @@

export declare function getGlobal(): any;
export declare function getLen(str?: string): number;

@@ -272,2 +276,4 @@

export declare function isAppUVueBuiltInEasyComponent(tag: string): boolean;
export declare function isAppUVueNativeTag(tag: string): boolean;

@@ -287,2 +293,4 @@

export declare function isMiniProgramUVueNativeTag(tag: string): boolean;
export declare function isRootHook(name: string): boolean;

@@ -292,2 +300,6 @@

export declare function isSystemActionSheetDialogPage(page: UniDialogPage): boolean;
export declare function isSystemDialogPage(page: UniDialogPage): boolean;
export declare function isUniLifecycleHook(name: string, value: unknown, checkType?: boolean): boolean;

@@ -464,2 +476,4 @@

export declare const OFF_HOST_THEME_CHANGE = "offHostThemeChange";
export declare const OFF_THEME_CHANGE = "offThemeChange";

@@ -481,2 +495,4 @@

export declare const ON_HOST_THEME_CHANGE = "onHostThemeChange";
export declare const ON_INIT = "onInit";

@@ -520,2 +536,4 @@

export declare const ON_SHARE_CHAT = "onShareChat";
export declare const ON_SHARE_TIMELINE = "onShareTimeline";

@@ -684,2 +702,7 @@

export declare const enum SetUniElementIdTagType {
BuiltInComponent = 1,// 如:unicloud-db
BuiltInRootElement = 2
}
export declare const SLOT_DEFAULT_NAME = "d";

@@ -691,2 +714,6 @@

export declare const SYSTEM_DIALOG_ACTION_SHEET_PAGE_PATH = "uni:actionSheet";
export declare const SYSTEM_DIALOG_PAGE_PATH_STARTER = "uni:";
export declare const TABBAR_HEIGHT = 50;

@@ -793,3 +820,3 @@

export declare const UniLifecycleHooks: readonly ["onShow", "onHide", "onLaunch", "onError", "onThemeChange", "onPageNotFound", "onUnhandledRejection", "onExit", "onInit", "onLoad", "onReady", "onUnload", "onResize", "onBackPress", "onPageScroll", "onTabItemTap", "onReachBottom", "onPullDownRefresh", "onShareTimeline", "onAddToFavorites", "onShareAppMessage", "onSaveExitState", "onNavigationBarButtonTap", "onNavigationBarSearchInputClicked", "onNavigationBarSearchInputChanged", "onNavigationBarSearchInputConfirmed", "onNavigationBarSearchInputFocusChanged"];
export declare const UniLifecycleHooks: readonly ["onShow", "onHide", "onLaunch", "onError", "onThemeChange", "onPageNotFound", "onUnhandledRejection", "onExit", "onInit", "onLoad", "onReady", "onUnload", "onResize", "onBackPress", "onPageScroll", "onTabItemTap", "onReachBottom", "onPullDownRefresh", "onShareTimeline", "onAddToFavorites", "onShareAppMessage", "onShareChat", "onSaveExitState", "onNavigationBarButtonTap", "onNavigationBarSearchInputClicked", "onNavigationBarSearchInputChanged", "onNavigationBarSearchInputConfirmed", "onNavigationBarSearchInputFocusChanged"];

@@ -796,0 +823,0 @@ export declare class UniNode extends UniEventTarget {

@@ -1,2 +0,2 @@

import { isHTMLTag, isSVGTag, hyphenate, camelize, normalizeStyle as normalizeStyle$1, isString, parseStringStyle, isArray, normalizeClass as normalizeClass$1, isFunction, isPlainObject, extend, capitalize } from '@vue/shared';
import { isHTMLTag, isSVGTag, isString, isFunction, isPlainObject, hyphenate, camelize, normalizeStyle as normalizeStyle$1, parseStringStyle, isArray, normalizeClass as normalizeClass$1, extend, capitalize } from '@vue/shared';

@@ -115,3 +115,6 @@ const BUILT_IN_TAG_NAMES = [

const UVUE_BUILT_IN_TAGS = [
'object',
'ad',
'ad-content-page',
'ad-draw',
'native-view',
'loading-indicator',

@@ -132,2 +135,4 @@ 'list-view',

'nested-scroll-body',
'grid-view',
'grid-item',
];

@@ -212,2 +217,12 @@ const UVUE_WEB_BUILT_IN_TAGS = [

];
// 内置的easycom组件
const UVUE_BUILT_IN_EASY_COMPONENTS = ['map'];
function isAppUVueBuiltInEasyComponent(tag) {
return UVUE_BUILT_IN_EASY_COMPONENTS.includes(tag);
}
// 主要是指前端实现的组件列表
const UVUE_CUSTOM_COMPONENTS = [
...NVUE_CUSTOM_COMPONENTS,
...UVUE_BUILT_IN_EASY_COMPONENTS,
];
function isAppUVueNativeTag(tag) {

@@ -221,3 +236,3 @@ // 前端实现的内置组件都会注册一个根组件

}
if (NVUE_CUSTOM_COMPONENTS.includes(tag)) {
if (UVUE_CUSTOM_COMPONENTS.includes(tag)) {
return false;

@@ -269,2 +284,9 @@ }

}
function isMiniProgramUVueNativeTag(tag) {
// 小程序平台内置的自定义元素,会被转换为 view
if (tag.startsWith('uni-') && tag.endsWith('-element')) {
return true;
}
return isBuiltInComponent(tag);
}
function createIsCustomElement(tags = []) {

@@ -315,2 +337,4 @@ return function isCustomElement(tag) {

const OFF_THEME_CHANGE = 'offThemeChange';
const ON_HOST_THEME_CHANGE = 'onHostThemeChange';
const OFF_HOST_THEME_CHANGE = 'offHostThemeChange';
const ON_KEYBOARD_HEIGHT_CHANGE = 'onKeyboardHeightChange';

@@ -335,2 +359,3 @@ const ON_PAGE_NOT_FOUND = 'onPageNotFound';

const ON_SHARE_TIMELINE = 'onShareTimeline';
const ON_SHARE_CHAT = 'onShareChat'; // xhs-share
const ON_ADD_TO_FAVORITES = 'onAddToFavorites';

@@ -351,2 +376,143 @@ const ON_SHARE_APP_MESSAGE = 'onShareAppMessage';

function cache(fn) {
const cache = Object.create(null);
return (str) => {
const hit = cache[str];
return hit || (cache[str] = fn(str));
};
}
function cacheStringFunction(fn) {
return cache(fn);
}
function getLen(str = '') {
return ('' + str).replace(/[^\x00-\xff]/g, '**').length;
}
function hasLeadingSlash(str) {
return str.indexOf('/') === 0;
}
function addLeadingSlash(str) {
return hasLeadingSlash(str) ? str : '/' + str;
}
function removeLeadingSlash(str) {
return hasLeadingSlash(str) ? str.slice(1) : str;
}
const invokeArrayFns = (fns, arg) => {
let ret;
for (let i = 0; i < fns.length; i++) {
ret = fns[i](arg);
}
return ret;
};
function updateElementStyle(element, styles) {
for (const attrName in styles) {
element.style[attrName] = styles[attrName];
}
}
function once(fn, ctx = null) {
let res;
return ((...args) => {
if (fn) {
res = fn.apply(ctx, args);
fn = null;
}
return res;
});
}
const sanitise = (val) => (val && JSON.parse(JSON.stringify(val))) || val;
const _completeValue = (value) => (value > 9 ? value : '0' + value);
function formatDateTime({ date = new Date(), mode = 'date' }) {
if (mode === 'time') {
return (_completeValue(date.getHours()) + ':' + _completeValue(date.getMinutes()));
}
else {
return (date.getFullYear() +
'-' +
_completeValue(date.getMonth() + 1) +
'-' +
_completeValue(date.getDate()));
}
}
function callOptions(options, data) {
options = options || {};
if (isString(data)) {
data = {
errMsg: data,
};
}
if (/:ok$/.test(data.errMsg)) {
if (isFunction(options.success)) {
options.success(data);
}
}
else {
if (isFunction(options.fail)) {
options.fail(data);
}
}
if (isFunction(options.complete)) {
options.complete(data);
}
}
function getValueByDataPath(obj, path) {
if (!isString(path)) {
return;
}
path = path.replace(/\[(\d+)\]/g, '.$1');
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('.'));
}
function sortObject(obj) {
let sortObj = {};
if (isPlainObject(obj)) {
Object.keys(obj)
.sort()
.forEach((key) => {
const _key = key;
sortObj[_key] = obj[_key];
});
}
return !Object.keys(sortObj) ? obj : sortObj;
}
function getGlobalOnce() {
if (typeof globalThis !== 'undefined') {
return globalThis;
}
// worker
if (typeof self !== 'undefined') {
return self;
}
// browser
if (typeof window !== 'undefined') {
return window;
}
// nodejs
// if (typeof global !== 'undefined') {
// return global
// }
function g() {
return this;
}
if (typeof g() !== 'undefined') {
return g();
}
return (function () {
return new Function('return this')();
})();
}
let g = undefined;
function getGlobal() {
if (g) {
return g;
}
g = getGlobalOnce();
return g;
}
function isComponentInternalInstance(vm) {

@@ -401,4 +567,12 @@ return !!vm.appContext;

function normalizeStyle(value) {
if (value instanceof Map) {
const g = getGlobal();
if (g && g.UTSJSONObject && value instanceof g.UTSJSONObject) {
const styleObject = {};
g.UTSJSONObject.keys(value).forEach((key) => {
styleObject[key] = value[key];
});
return normalizeStyle$1(styleObject);
}
else if (value instanceof Map) {
const styleObject = {};
value.forEach((value, key) => {

@@ -433,3 +607,11 @@ styleObject[key] = value;

let res = '';
if (value instanceof Map) {
const g = getGlobal();
if (g && g.UTSJSONObject && value instanceof g.UTSJSONObject) {
g.UTSJSONObject.keys(value).forEach((key) => {
if (value[key]) {
res += key + ' ';
}
});
}
else if (value instanceof Map) {
value.forEach((value, key) => {

@@ -477,109 +659,2 @@ if (value) {

function cache(fn) {
const cache = Object.create(null);
return (str) => {
const hit = cache[str];
return hit || (cache[str] = fn(str));
};
}
function cacheStringFunction(fn) {
return cache(fn);
}
function getLen(str = '') {
return ('' + str).replace(/[^\x00-\xff]/g, '**').length;
}
function hasLeadingSlash(str) {
return str.indexOf('/') === 0;
}
function addLeadingSlash(str) {
return hasLeadingSlash(str) ? str : '/' + str;
}
function removeLeadingSlash(str) {
return hasLeadingSlash(str) ? str.slice(1) : str;
}
const invokeArrayFns = (fns, arg) => {
let ret;
for (let i = 0; i < fns.length; i++) {
ret = fns[i](arg);
}
return ret;
};
function updateElementStyle(element, styles) {
for (const attrName in styles) {
element.style[attrName] = styles[attrName];
}
}
function once(fn, ctx = null) {
let res;
return ((...args) => {
if (fn) {
res = fn.apply(ctx, args);
fn = null;
}
return res;
});
}
const sanitise = (val) => (val && JSON.parse(JSON.stringify(val))) || val;
const _completeValue = (value) => (value > 9 ? value : '0' + value);
function formatDateTime({ date = new Date(), mode = 'date' }) {
if (mode === 'time') {
return (_completeValue(date.getHours()) + ':' + _completeValue(date.getMinutes()));
}
else {
return (date.getFullYear() +
'-' +
_completeValue(date.getMonth() + 1) +
'-' +
_completeValue(date.getDate()));
}
}
function callOptions(options, data) {
options = options || {};
if (isString(data)) {
data = {
errMsg: data,
};
}
if (/:ok$/.test(data.errMsg)) {
if (isFunction(options.success)) {
options.success(data);
}
}
else {
if (isFunction(options.fail)) {
options.fail(data);
}
}
if (isFunction(options.complete)) {
options.complete(data);
}
}
function getValueByDataPath(obj, path) {
if (!isString(path)) {
return;
}
path = path.replace(/\[(\d+)\]/g, '.$1');
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('.'));
}
function sortObject(obj) {
let sortObj = {};
if (isPlainObject(obj)) {
Object.keys(obj)
.sort()
.forEach((key) => {
const _key = key;
sortObj[_key] = obj[_key];
});
}
return !Object.keys(sortObj) ? obj : sortObj;
}
function formatKey(key) {

@@ -1420,2 +1495,3 @@ return camelize(key.substring(5));

ON_SHARE_APP_MESSAGE,
ON_SHARE_CHAT,
ON_ADD_TO_FAVORITES,

@@ -1459,2 +1535,3 @@ ON_SAVE_EXIT_STATE,

ON_SHARE_APP_MESSAGE,
ON_SHARE_CHAT,
ON_SAVE_EXIT_STATE,

@@ -1517,2 +1594,3 @@ ON_NAVIGATION_BAR_BUTTON_TAP,

E.prototype = {
_id: 1,
on: function (name, callback, ctx) {

@@ -1523,4 +1601,5 @@ var e = this.e || (this.e = {});

ctx: ctx,
_id: this._id,
});
return this;
return this._id++;
},

@@ -1546,9 +1625,11 @@ once: function (name, callback, ctx) {

},
off: function (name, callback) {
off: function (name, event) {
var e = this.e || (this.e = {});
var evts = e[name];
var liveEvents = [];
if (evts && callback) {
if (evts && event) {
for (var i = evts.length - 1; i >= 0; i--) {
if (evts[i].fn === callback || evts[i].fn._ === callback) {
if (evts[i].fn === event ||
evts[i].fn._ === event ||
evts[i]._id === event) {
evts.splice(i, 1);

@@ -1627,2 +1708,11 @@ break;

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 };
const SYSTEM_DIALOG_PAGE_PATH_STARTER = 'uni:';
const SYSTEM_DIALOG_ACTION_SHEET_PAGE_PATH = 'uni:actionSheet';
function isSystemDialogPage(page) {
return page.route.startsWith(SYSTEM_DIALOG_PAGE_PATH_STARTER);
}
function isSystemActionSheetDialogPage(page) {
return page.route.startsWith(SYSTEM_DIALOG_ACTION_SHEET_PAGE_PATH);
}
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_HOST_THEME_CHANGE, 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_HOST_THEME_CHANGE, 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_CHAT, 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, SYSTEM_DIALOG_ACTION_SHEET_PAGE_PATH, SYSTEM_DIALOG_PAGE_PATH_STARTER, 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, getGlobal, getLen, getValueByDataPath, initCustomDatasetOnce, invokeArrayFns, invokeCreateErrorHandler, invokeCreateVueAppHook, isAppIOSUVueNativeTag, isAppNVueNativeTag, isAppNativeTag, isAppUVueBuiltInEasyComponent, isAppUVueNativeTag, isBuiltInComponent, isComponentInternalInstance, isComponentTag, isH5CustomElement, isH5NativeTag, isMiniProgramNativeTag, isMiniProgramUVueNativeTag, isRootHook, isRootImmediateHook, isSystemActionSheetDialogPage, isSystemDialogPage, 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 };

@@ -1,1 +0,1 @@

[https://uniapp.dcloud.net.cn/license.html ](https://uniapp.dcloud.net.cn/license.html )
[https://dcloud.io/license/uni-app.html](https://dcloud.io/license/uni-app.html)
{
"name": "@dcloudio/uni-shared",
"version": "3.0.0-4020920240930001",
"version": "3.0.0-4030620241128001",
"description": "@dcloudio/uni-shared",

@@ -5,0 +5,0 @@ "main": "./dist/uni-shared.cjs.js",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc