🎩 You're Invited:Meet the Socket team at Black Hat in Las Vegas, August 3-6.RSVP
Sign In

@arvin-shu/microcode-utils

Package Overview
Dependencies
Maintainers
1
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@arvin-shu/microcode-utils - npm Package Compare versions

Comparing version
1.1.3
to
1.1.4
+37
es/asset.d.ts
import { Asset, AssetBundle, AssetItem, AssetLevel, AssetList, AssetType, IPublicTypeAssetsJson } from '@arvin-shu/microcode-types';
export declare function isAssetItem(obj: any): obj is AssetItem;
export declare function isAssetBundle(obj: any): obj is AssetBundle;
/**
* 构建资源包
* @param assets
* @param level
* @returns
*/
export declare function assetBundle(assets?: Asset | AssetList | null, level?: AssetLevel): AssetBundle | null;
/**
* 构建资源项
* @param type
* @param content
* @param level
* @param id
* @returns
*/
export declare function assetItem(type: AssetType, content?: string | null, level?: AssetLevel, id?: string): AssetItem | null;
export declare class StylePoint {
private lastContent;
private lastUrl;
readonly level: number;
readonly id: string;
private placeholder;
constructor(level: number, id?: string);
applyText(content: string): void;
applyUrl(url: string): Promise<any> | undefined;
}
export declare class AssetLoader {
private stylePoints;
load(assets: Asset): Promise<void>;
private loadStyle;
private loadScript;
loadAsyncLibrary(asyncLibraryMap: Record<string, any>): Promise<void>;
}
export declare function mergeAssets(assets: IPublicTypeAssetsJson, incrementalAssets: IPublicTypeAssetsJson): IPublicTypeAssetsJson;
import { AssetType, AssetLevel, AssetLevels } from '@arvin-shu/microcode-types';
import { isCSSUrl } from './is-css-url.js';
import { load, evaluate } from './script.js';
import { createDefer } from './create-defer.js';
"use strict";
function isAssetItem(obj) {
return obj && obj.type;
}
function isAssetBundle(obj) {
return obj && obj.type === AssetType.Bundle;
}
function assetBundle(assets, level) {
if (!assets) {
return null;
}
return {
type: AssetType.Bundle,
assets,
level
};
}
function assetItem(type, content, level, id) {
if (!content) {
return null;
}
return {
type,
content,
level,
id
};
}
function parseAssetList(scripts, styles, assets, level) {
for (const asset of assets) {
parseAsset(scripts, styles, asset, level);
}
}
function parseAsset(scripts, styles, asset, level) {
if (!asset) {
return;
}
if (Array.isArray(asset)) {
return parseAssetList(scripts, styles, asset, level);
}
if (isAssetBundle(asset)) {
if (asset.assets) {
if (Array.isArray(asset.assets)) {
parseAssetList(scripts, styles, asset.assets, asset.level || level);
} else {
parseAsset(scripts, styles, asset.assets, asset.level || level);
}
return;
}
return;
}
if (!isAssetItem(asset)) {
asset = assetItem(
isCSSUrl(asset) ? AssetType.CSSUrl : AssetType.JSUrl,
asset,
level
);
}
let lv = asset.level || level;
if (!lv || AssetLevel[lv] == null) {
lv = AssetLevel.App;
}
asset.level = lv;
if (asset.type === AssetType.CSSUrl || asset.type === AssetType.CSSText) {
styles[lv].push(asset);
} else {
scripts[lv].push(asset);
}
}
class StylePoint {
lastContent;
lastUrl;
level;
id;
placeholder;
constructor(level, id) {
this.level = level;
if (id) {
this.id = id;
}
let placeholder;
if (id) {
placeholder = document.head.querySelector(`style[data-id="${id}"]`);
}
if (!placeholder) {
placeholder = document.createTextNode("");
const meta = document.head.querySelector(`meta[level="${level}"]`);
if (meta) {
document.head.insertBefore(placeholder, meta);
} else {
document.head.appendChild(placeholder);
}
}
this.placeholder = placeholder;
}
applyText(content) {
if (this.lastContent === content) {
return;
}
this.lastContent = content;
this.lastUrl = void 0;
const element = document.createElement("style");
element.setAttribute("type", "text/css");
if (this.id) {
element.setAttribute("data-id", this.id);
}
element.appendChild(document.createTextNode(content));
document.head.insertBefore(
element,
this.placeholder.parentNode === document.head ? this.placeholder.nextSibling : null
);
document.head.removeChild(this.placeholder);
this.placeholder = element;
}
applyUrl(url) {
if (this.lastUrl === url) {
return;
}
this.lastContent = void 0;
this.lastUrl = url;
const element = document.createElement("link");
element.onload = onload;
element.onerror = onload;
const i = createDefer();
function onload(e) {
element.onload = null;
element.onerror = null;
if (e.type === "load") {
i.resolve();
} else {
i.reject();
}
}
element.href = url;
element.rel = "stylesheet";
if (this.id) {
element.setAttribute("data-id", this.id);
}
document.head.insertBefore(
element,
this.placeholder.parentNode === document.head ? this.placeholder.nextSibling : null
);
document.head.removeChild(this.placeholder);
this.placeholder = element;
return i.promise();
}
}
class AssetLoader {
stylePoints = /* @__PURE__ */ new Map();
async load(assets) {
const styles = {};
const scripts = {};
AssetLevels.forEach((level) => {
styles[level] = [];
scripts[level] = [];
});
parseAsset(scripts, styles, assets);
const styleQueue = styles[AssetLevel.Environment].concat(
styles[AssetLevel.Library],
styles[AssetLevel.Theme],
styles[AssetLevel.Runtime],
styles[AssetLevel.App]
);
const scriptQueue = scripts[AssetLevel.Environment].concat(
scripts[AssetLevel.Library],
scripts[AssetLevel.Theme],
scripts[AssetLevel.Runtime],
scripts[AssetLevel.App]
);
await Promise.all(
styleQueue.map(
({ content, level, type, id }) => this.loadStyle(content, level, type === AssetType.CSSUrl, id)
)
);
await Promise.all(
scriptQueue.map(
({ content, type, scriptType }) => this.loadScript(content, type === AssetType.JSUrl, scriptType)
)
);
}
loadStyle(content, level, isUrl, id) {
if (!content) {
return;
}
let point;
if (id) {
point = this.stylePoints.get(id);
if (!point) {
point = new StylePoint(level, id);
this.stylePoints.set(id, point);
}
} else {
point = new StylePoint(level);
}
return isUrl ? point.applyUrl(content) : point.applyText(content);
}
loadScript(content, isUrl, scriptType) {
if (!content) {
return;
}
return isUrl ? load(content, scriptType) : evaluate(content, scriptType);
}
async loadAsyncLibrary(asyncLibraryMap) {
const promiseList = [];
const libraryKeyList = [];
const pkgs = [];
for (const key in asyncLibraryMap) {
if (asyncLibraryMap[key].async) {
promiseList.push(window[asyncLibraryMap[key].library]);
libraryKeyList.push(asyncLibraryMap[key].library);
pkgs.push(asyncLibraryMap[key]);
}
}
await Promise.all(promiseList).then((mods) => {
if (mods.length > 0) {
mods.map((item, index) => {
const { exportMode, exportSourceLibrary, library } = pkgs[index];
window[libraryKeyList[index]] = exportMode === "functionCall" && (exportSourceLibrary == null || exportSourceLibrary === library) ? item() : item;
return item;
});
}
});
}
}
function mergeAssets(assets, incrementalAssets) {
if (incrementalAssets.packages) {
assets.packages = [
...assets.packages || [],
...incrementalAssets.packages
];
}
if (incrementalAssets.components) {
assets.components = [
...assets.components || [],
...incrementalAssets.components
];
}
return assets;
}
export { AssetLoader, StylePoint, assetBundle, assetItem, isAssetBundle, isAssetItem, mergeAssets };
//# sourceMappingURL=asset.js.map
{"version":3,"file":"asset.js","sources":["../../src/asset.ts"],"sourcesContent":["import {\n\tAsset,\n\tAssetBundle,\n\tAssetItem,\n\tAssetLevel,\n\tAssetLevels,\n\tAssetList,\n\tAssetType,\n\tIPublicTypeAssetsJson,\n} from '@arvin-shu/microcode-types';\nimport { isCSSUrl } from './is-css-url';\nimport { evaluate, load } from './script';\nimport { createDefer } from './create-defer';\n\nexport function isAssetItem(obj: any): obj is AssetItem {\n\treturn obj && obj.type;\n}\n\nexport function isAssetBundle(obj: any): obj is AssetBundle {\n\treturn obj && obj.type === AssetType.Bundle;\n}\n\n/**\n * 构建资源包\n * @param assets\n * @param level\n * @returns\n */\nexport function assetBundle(\n\tassets?: Asset | AssetList | null,\n\tlevel?: AssetLevel\n): AssetBundle | null {\n\tif (!assets) {\n\t\treturn null;\n\t}\n\treturn {\n\t\ttype: AssetType.Bundle,\n\t\tassets,\n\t\tlevel,\n\t};\n}\n\n/**\n * 构建资源项\n * @param type\n * @param content\n * @param level\n * @param id\n * @returns\n */\nexport function assetItem(\n\ttype: AssetType,\n\tcontent?: string | null,\n\tlevel?: AssetLevel,\n\tid?: string\n): AssetItem | null {\n\tif (!content) {\n\t\treturn null;\n\t}\n\treturn {\n\t\ttype,\n\t\tcontent,\n\t\tlevel,\n\t\tid,\n\t};\n}\n\nfunction parseAssetList(\n\tscripts: any,\n\tstyles: any,\n\tassets: AssetList,\n\tlevel?: AssetLevel\n) {\n\tfor (const asset of assets) {\n\t\tparseAsset(scripts, styles, asset, level);\n\t}\n}\n\nfunction parseAsset(\n\tscripts: any,\n\tstyles: any,\n\tasset: Asset | undefined | null,\n\tlevel?: AssetLevel\n) {\n\tif (!asset) {\n\t\treturn;\n\t}\n\tif (Array.isArray(asset)) {\n\t\treturn parseAssetList(scripts, styles, asset, level);\n\t}\n\n\tif (isAssetBundle(asset)) {\n\t\tif (asset.assets) {\n\t\t\tif (Array.isArray(asset.assets)) {\n\t\t\t\tparseAssetList(scripts, styles, asset.assets, asset.level || level);\n\t\t\t} else {\n\t\t\t\tparseAsset(scripts, styles, asset.assets, asset.level || level);\n\t\t\t}\n\t\t\treturn;\n\t\t}\n\t\treturn;\n\t}\n\n\tif (!isAssetItem(asset)) {\n\t\tasset = assetItem(\n\t\t\tisCSSUrl(asset) ? AssetType.CSSUrl : AssetType.JSUrl,\n\t\t\tasset,\n\t\t\tlevel\n\t\t)!;\n\t}\n\tlet lv = asset.level || level;\n\n\t// 如果协议中没有明确level则资源全部设置为APP级别的\n\tif (!lv || AssetLevel[lv] == null) {\n\t\tlv = AssetLevel.App;\n\t}\n\tasset.level = lv;\n\tif (asset.type === AssetType.CSSUrl || asset.type === AssetType.CSSText) {\n\t\tstyles[lv].push(asset);\n\t} else {\n\t\tscripts[lv].push(asset);\n\t}\n}\n\nexport class StylePoint {\n\tprivate lastContent: string | undefined;\n\n\tprivate lastUrl: string | undefined;\n\n\treadonly level: number;\n\n\treadonly id: string;\n\n\tprivate placeholder: Element | Text;\n\n\tconstructor(level: number, id?: string) {\n\t\tthis.level = level;\n\t\tif (id) {\n\t\t\tthis.id = id;\n\t\t}\n\t\tlet placeholder: any;\n\t\tif (id) {\n\t\t\tplaceholder = document.head.querySelector(`style[data-id=\"${id}\"]`);\n\t\t}\n\t\tif (!placeholder) {\n\t\t\tplaceholder = document.createTextNode('');\n\t\t\tconst meta = document.head.querySelector(`meta[level=\"${level}\"]`);\n\t\t\tif (meta) {\n\t\t\t\tdocument.head.insertBefore(placeholder, meta);\n\t\t\t} else {\n\t\t\t\tdocument.head.appendChild(placeholder);\n\t\t\t}\n\t\t}\n\t\tthis.placeholder = placeholder;\n\t}\n\n\tapplyText(content: string) {\n\t\tif (this.lastContent === content) {\n\t\t\treturn;\n\t\t}\n\t\tthis.lastContent = content;\n\t\tthis.lastUrl = undefined;\n\t\tconst element = document.createElement('style');\n\t\telement.setAttribute('type', 'text/css');\n\t\tif (this.id) {\n\t\t\telement.setAttribute('data-id', this.id);\n\t\t}\n\t\telement.appendChild(document.createTextNode(content));\n\t\tdocument.head.insertBefore(\n\t\t\telement,\n\t\t\tthis.placeholder.parentNode === document.head\n\t\t\t\t? this.placeholder.nextSibling\n\t\t\t\t: null\n\t\t);\n\t\tdocument.head.removeChild(this.placeholder);\n\t\tthis.placeholder = element;\n\t}\n\n\tapplyUrl(url: string) {\n\t\tif (this.lastUrl === url) {\n\t\t\treturn;\n\t\t}\n\t\tthis.lastContent = undefined;\n\t\tthis.lastUrl = url;\n\t\tconst element = document.createElement('link');\n\t\telement.onload = onload;\n\t\telement.onerror = onload;\n\n\t\tconst i = createDefer();\n\t\tfunction onload(e: any) {\n\t\t\telement.onload = null;\n\t\t\telement.onerror = null;\n\t\t\tif (e.type === 'load') {\n\t\t\t\ti.resolve();\n\t\t\t} else {\n\t\t\t\ti.reject();\n\t\t\t}\n\t\t}\n\n\t\telement.href = url;\n\t\telement.rel = 'stylesheet';\n\t\tif (this.id) {\n\t\t\telement.setAttribute('data-id', this.id);\n\t\t}\n\t\tdocument.head.insertBefore(\n\t\t\telement,\n\t\t\tthis.placeholder.parentNode === document.head\n\t\t\t\t? this.placeholder.nextSibling\n\t\t\t\t: null\n\t\t);\n\t\tdocument.head.removeChild(this.placeholder);\n\t\tthis.placeholder = element;\n\t\treturn i.promise();\n\t}\n}\n\nexport class AssetLoader {\n\tprivate stylePoints = new Map<string, StylePoint>();\n\n\tasync load(assets: Asset) {\n\t\tconst styles: any = {};\n\t\tconst scripts: any = {};\n\t\tAssetLevels.forEach((level) => {\n\t\t\tstyles[level] = [];\n\t\t\tscripts[level] = [];\n\t\t});\n\t\tparseAsset(scripts, styles, assets);\n\t\tconst styleQueue: AssetItem[] = styles[AssetLevel.Environment].concat(\n\t\t\tstyles[AssetLevel.Library],\n\t\t\tstyles[AssetLevel.Theme],\n\t\t\tstyles[AssetLevel.Runtime],\n\t\t\tstyles[AssetLevel.App]\n\t\t);\n\t\tconst scriptQueue: AssetItem[] = scripts[AssetLevel.Environment].concat(\n\t\t\tscripts[AssetLevel.Library],\n\t\t\tscripts[AssetLevel.Theme],\n\t\t\tscripts[AssetLevel.Runtime],\n\t\t\tscripts[AssetLevel.App]\n\t\t);\n\n\t\tawait Promise.all(\n\t\t\tstyleQueue.map(({ content, level, type, id }) =>\n\t\t\t\tthis.loadStyle(content, level!, type === AssetType.CSSUrl, id)\n\t\t\t)\n\t\t);\n\n\t\tawait Promise.all(\n\t\t\tscriptQueue.map(({ content, type, scriptType }) =>\n\t\t\t\tthis.loadScript(content, type === AssetType.JSUrl, scriptType)\n\t\t\t)\n\t\t);\n\t}\n\n\tprivate loadStyle(\n\t\tcontent: string | undefined | null,\n\t\tlevel: AssetLevel,\n\t\tisUrl?: boolean,\n\t\tid?: string\n\t) {\n\t\tif (!content) {\n\t\t\treturn;\n\t\t}\n\t\tlet point: StylePoint | undefined;\n\t\tif (id) {\n\t\t\tpoint = this.stylePoints.get(id);\n\t\t\tif (!point) {\n\t\t\t\tpoint = new StylePoint(level, id);\n\t\t\t\tthis.stylePoints.set(id, point);\n\t\t\t}\n\t\t} else {\n\t\t\tpoint = new StylePoint(level);\n\t\t}\n\t\treturn isUrl ? point.applyUrl(content) : point.applyText(content);\n\t}\n\n\tprivate loadScript(\n\t\tcontent: string | undefined | null,\n\t\tisUrl?: boolean,\n\t\tscriptType?: string\n\t) {\n\t\tif (!content) {\n\t\t\treturn;\n\t\t}\n\t\treturn isUrl ? load(content, scriptType) : evaluate(content, scriptType);\n\t}\n\n\tasync loadAsyncLibrary(asyncLibraryMap: Record<string, any>) {\n\t\tconst promiseList: any[] = [];\n\t\tconst libraryKeyList: any[] = [];\n\t\tconst pkgs: any[] = [];\n\t\tfor (const key in asyncLibraryMap) {\n\t\t\t// 需要异步加载\n\t\t\tif (asyncLibraryMap[key].async) {\n\t\t\t\tpromiseList.push(window[asyncLibraryMap[key].library]);\n\t\t\t\tlibraryKeyList.push(asyncLibraryMap[key].library);\n\t\t\t\tpkgs.push(asyncLibraryMap[key]);\n\t\t\t}\n\t\t}\n\t\tawait Promise.all(promiseList).then((mods) => {\n\t\t\tif (mods.length > 0) {\n\t\t\t\tmods.map((item, index) => {\n\t\t\t\t\tconst { exportMode, exportSourceLibrary, library } = pkgs[index];\n\t\t\t\t\twindow[libraryKeyList[index]] =\n\t\t\t\t\t\texportMode === 'functionCall' &&\n\t\t\t\t\t\t(exportSourceLibrary == null || exportSourceLibrary === library)\n\t\t\t\t\t\t\t? item()\n\t\t\t\t\t\t\t: item;\n\t\t\t\t\treturn item;\n\t\t\t\t});\n\t\t\t}\n\t\t});\n\t}\n}\n\nexport function mergeAssets(\n\tassets: IPublicTypeAssetsJson,\n\tincrementalAssets: IPublicTypeAssetsJson\n): IPublicTypeAssetsJson {\n\tif (incrementalAssets.packages) {\n\t\tassets.packages = [\n\t\t\t...(assets.packages || []),\n\t\t\t...incrementalAssets.packages,\n\t\t];\n\t}\n\n\tif (incrementalAssets.components) {\n\t\tassets.components = [\n\t\t\t...(assets.components || []),\n\t\t\t...incrementalAssets.components,\n\t\t];\n\t}\n\n\treturn assets;\n}\n"],"names":[],"mappings":";;;;;;AAcO,SAAS,YAAY,GAA4B,EAAA;AACvD,EAAA,OAAO,OAAO,GAAI,CAAA,IAAA;AACnB;AAEO,SAAS,cAAc,GAA8B,EAAA;AAC3D,EAAO,OAAA,GAAA,IAAO,GAAI,CAAA,IAAA,KAAS,SAAU,CAAA,MAAA;AACtC;AAQgB,SAAA,WAAA,CACf,QACA,KACqB,EAAA;AACrB,EAAA,IAAI,CAAC,MAAQ,EAAA;AACZ,IAAO,OAAA,IAAA;AAAA;AAER,EAAO,OAAA;AAAA,IACN,MAAM,SAAU,CAAA,MAAA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AAA,IAAA,CAAK,CAAC,IAAS,KAAA;AAC7C,MAAI,IAAA,IAAA,CAAK,SAAS,CAAG,EAAA;AACpB,QAAK,IAAA,CAAA,GAAA,CAAI,CAAC,IAAA,EAAM,KAAU,KAAA;AACzB,UAAA,MAAM,EAAE,UAAY,EAAA,mBAAA,EAAqB,OAAQ,EAAA,GAAI,KAAK,KAAK,CAAA;AAC/D,UAAO,MAAA,CAAA,cAAA,CAAe,KAAK,CAAC,CAC3B,GAAA,UAAA,KAAe,cACd,KAAA,mBAAA,IAAuB,IAAQ,IAAA,mBAAA,KAAwB,OACrD,CAAA,GAAA,IAAA,EACA,GAAA,IAAA;AACJ,UAAO,OAAA,IAAA;AAAA,SACP,CAAA;AAAA;AACF,KACA,CAAA;AAAA;AAEH;AAEgB,SAAA,WAAA,CACf,QACA,iBACwB,EAAA;AACxB,EAAA,IAAI,kBAAkB,QAAU,EAAA;AAC/B,IAAA,MAAA,CAAO,QAAW,GAAA;AAAA,MACjB,GAAI,MAAO,CAAA,QAAA,IAAY,EAAC;AAAA,MACxB,GAAG,iBAAkB,CAAA;AAAA,KACtB;AAAA;AAGD,EAAA,IAAI,kBAAkB,UAAY,EAAA;AACjC,IAAA,MAAA,CAAO,UAAa,GAAA;AAAA,MACnB,GAAI,MAAO,CAAA,UAAA,IAAc,EAAC;AAAA,MAC1B,GAAG,iBAAkB,CAAA;AAAA,KACtB;AAAA;AAGD,EAAO,OAAA,MAAA;AACR;;;;"}
import { IPublicTypeComponentSchema, IPublicTypeNpmInfo } from '@arvin-shu/microcode-types';
export interface UtilsMetadata {
name: string;
npm: {
package: string;
version?: string;
exportName: string;
subName?: string;
destructuring?: boolean;
main?: string;
};
}
export declare function getSubComponent(library: any, paths: string[]): any;
export declare const cached: <R>(fn: (param: string) => R) => ((param: string) => R);
export declare function accessLibrary(library: string | Record<string, unknown>): any;
/**
* 查找组件
* @param libraryMap 库映射
* @param componentName 组件名称
* @param npm 可选的npm信息
* @returns 返回找到的组件或库
*/
export declare function findComponent(libraryMap: Record<string, string>, componentName: string, npm?: IPublicTypeNpmInfo): any;
/**
* 构建组件
* @param libraryMap 库映射
* @param componentsMap 组件映射
* @param createComponent 创建低代码组件函数
*/
export declare function buildComponents(libraryMap: Record<string, string>, componentsMap: Record<string, IPublicTypeNpmInfo | IPublicTypeComponentSchema | unknown>, createComponent?: (schema: IPublicTypeComponentSchema) => any): any;
import { defineComponent, h } from 'vue';
import { isESModule } from './is-es-module.js';
import './check-types/index.js';
import { isComponentSchema } from './check-types/is-component-schema.js';
"use strict";
function getSubComponent(library, paths) {
const l = paths.length;
if (l < 1 || !library) {
return library;
}
let i = 0;
let component;
while (i < l) {
const key = paths[i];
let ex;
try {
component = library[key];
} catch (e) {
ex = e;
component = null;
}
if (i === 0 && component == null && key === "default") {
if (ex) {
return l === 1 ? library : null;
}
component = library;
} else if (component == null) {
return null;
}
library = component;
i++;
}
return component;
}
const cached = (fn) => {
const cacheStore = {};
return function(param) {
return param in cacheStore ? cacheStore[param] : cacheStore[param] = fn.call(this, param);
};
};
const generateHtmlComp = cached((library) => {
if (/^[a-z-]+$/.test(library)) {
return defineComponent(
(_, { attrs, slots }) => () => h(library, attrs, slots)
);
}
});
function accessLibrary(library) {
if (typeof library !== "string") {
return library;
}
return window[library] || generateHtmlComp(library);
}
function findComponent(libraryMap, componentName, npm) {
if (!npm) {
return accessLibrary(componentName);
}
const exportName = npm.exportName || npm.componentName || componentName;
const libraryName = libraryMap[npm.package] || exportName;
const library = accessLibrary(libraryName);
const paths = npm.exportName && npm.subName ? npm.subName.split(".") : [];
if (npm.destructuring) {
paths.unshift(exportName);
} else if (isESModule(library)) {
paths.unshift("default");
}
return getSubComponent(library, paths);
}
function buildComponents(libraryMap, componentsMap, createComponent) {
const components = {};
Object.keys(componentsMap).forEach((componentName) => {
let component = componentsMap[componentName];
if (isComponentSchema(component)) {
if (createComponent) {
components[componentName] = createComponent(
component
);
}
} else if (isVueComponent(component)) {
components[componentName] = component;
} else {
component = findComponent(
libraryMap,
componentName,
component
);
if (component) {
components[componentName] = component;
}
}
});
return components;
}
function isVueComponent(component) {
if (typeof component === "object" && component !== null) {
const options = component;
if (typeof options.render === "function" || typeof options.setup === "function") {
return true;
}
}
if (typeof component === "object" && component !== null && "__vccOpts" in component) {
return true;
}
return false;
}
export { accessLibrary, buildComponents, cached, findComponent, getSubComponent };
//# sourceMappingURL=build-components.js.map
{"version":3,"file":"build-components.js","sources":["../../src/build-components.ts"],"sourcesContent":["import {\n\tIPublicTypeComponentSchema,\n\tIPublicTypeNpmInfo,\n} from '@arvin-shu/microcode-types';\nimport { Component, ComponentOptions, defineComponent, h } from 'vue';\nimport { isESModule } from './is-es-module';\nimport { isComponentSchema } from './check-types';\n\nexport interface UtilsMetadata {\n\tname: string;\n\tnpm: {\n\t\tpackage: string;\n\t\tversion?: string;\n\t\texportName: string;\n\t\tsubName?: string;\n\t\tdestructuring?: boolean;\n\t\tmain?: string;\n\t};\n}\n\nexport function getSubComponent(library: any, paths: string[]) {\n\tconst l = paths.length;\n\tif (l < 1 || !library) {\n\t\treturn library;\n\t}\n\tlet i = 0;\n\tlet component: any;\n\twhile (i < l) {\n\t\tconst key = paths[i]!;\n\t\tlet ex: any;\n\t\ttry {\n\t\t\tcomponent = library[key];\n\t\t} catch (e) {\n\t\t\tex = e;\n\t\t\tcomponent = null;\n\t\t}\n\t\tif (i === 0 && component == null && key === 'default') {\n\t\t\tif (ex) {\n\t\t\t\treturn l === 1 ? library : null;\n\t\t\t}\n\t\t\tcomponent = library;\n\t\t} else if (component == null) {\n\t\t\treturn null;\n\t\t}\n\t\tlibrary = component;\n\t\ti++;\n\t}\n\treturn component;\n}\n\nexport const cached = <R>(fn: (param: string) => R): ((param: string) => R) => {\n\tconst cacheStore: Record<string, any> = {};\n\t// eslint-disable-next-line func-names\n\treturn function (this: unknown, param: string) {\n\t\t// eslint-disable-next-line no-return-assign\n\t\treturn param in cacheStore\n\t\t\t? cacheStore[param]\n\t\t\t: (cacheStore[param] = fn.call(this, param));\n\t};\n};\n\nconst generateHtmlComp = cached((library: string) => {\n\tif (/^[a-z-]+$/.test(library)) {\n\t\treturn defineComponent(\n\t\t\t(_, { attrs, slots }) =>\n\t\t\t\t() =>\n\t\t\t\t\th(library, attrs, slots)\n\t\t);\n\t}\n});\n\nexport function accessLibrary(library: string | Record<string, unknown>) {\n\tif (typeof library !== 'string') {\n\t\treturn library;\n\t}\n\n\treturn (window as any)[library] || generateHtmlComp(library);\n}\n\n/**\n * 查找组件\n * @param libraryMap 库映射\n * @param componentName 组件名称\n * @param npm 可选的npm信息\n * @returns 返回找到的组件或库\n */\nexport function findComponent(\n\tlibraryMap: Record<string, string>,\n\tcomponentName: string,\n\tnpm?: IPublicTypeNpmInfo\n) {\n\t// 如果没有npm信息,直接访问库并返回组件\n\tif (!npm) {\n\t\treturn accessLibrary(componentName);\n\t}\n\t// 获取导出名称,优先使用npm中的exportName或componentName\n\tconst exportName = npm.exportName || npm.componentName || componentName;\n\t// 获取库名称,优先使用库映射中的包名\n\tconst libraryName = libraryMap[npm.package] || exportName;\n\t// 访问库并获取组件\n\tconst library = accessLibrary(libraryName);\n\t// 根据npm信息获取子组件路径\n\tconst paths = npm.exportName && npm.subName ? npm.subName.split('.') : [];\n\t// 如果需要解构,添加导出名称到路径前面\n\tif (npm.destructuring) {\n\t\tpaths.unshift(exportName);\n\t}\n\t// 如果是ES模块,添加'default'到路径前面\n\telse if (isESModule(library)) {\n\t\tpaths.unshift('default');\n\t}\n\t// 返回子组件\n\treturn getSubComponent(library, paths);\n}\n\n/**\n * 构建组件\n * @param libraryMap 库映射\n * @param componentsMap 组件映射\n * @param createComponent 创建低代码组件函数\n */\nexport function buildComponents(\n\tlibraryMap: Record<string, string>,\n\tcomponentsMap: Record<\n\t\tstring,\n\t\tIPublicTypeNpmInfo | IPublicTypeComponentSchema | unknown\n\t>,\n\tcreateComponent?: (schema: IPublicTypeComponentSchema) => any\n) {\n\tconst components: any = {};\n\tObject.keys(componentsMap).forEach((componentName) => {\n\t\tlet component = componentsMap[componentName];\n\t\tif (isComponentSchema(component)) {\n\t\t\tif (createComponent) {\n\t\t\t\tcomponents[componentName] = createComponent(\n\t\t\t\t\tcomponent as IPublicTypeComponentSchema\n\t\t\t\t);\n\t\t\t}\n\t\t} else if (isVueComponent(component)) {\n\t\t\tcomponents[componentName] = component;\n\t\t} else {\n\t\t\t// 从组件库中查询\n\t\t\tcomponent = findComponent(\n\t\t\t\tlibraryMap,\n\t\t\t\tcomponentName,\n\t\t\t\tcomponent as IPublicTypeNpmInfo\n\t\t\t);\n\t\t\tif (component) {\n\t\t\t\tcomponents[componentName] = component;\n\t\t\t}\n\t\t}\n\t});\n\n\treturn components;\n}\n\n/**\n * 判断是否是组件\n *\n * @param component\n * @returns\n */\nfunction isVueComponent(component: any): component is Component {\n\tif (typeof component === 'object' && component !== null) {\n\t\tconst options = component as ComponentOptions;\n\t\tif (\n\t\t\ttypeof options.render === 'function' ||\n\t\t\ttypeof options.setup === 'function'\n\t\t) {\n\t\t\treturn true; // 是 SFC 组件\n\t\t}\n\t}\n\tif (\n\t\ttypeof component === 'object' &&\n\t\tcomponent !== null &&\n\t\t'__vccOpts' in component\n\t) {\n\t\treturn true; // 是 Vue JSX 组件\n\t}\n\n\treturn false; // 不是任何组件\n}\n"],"names":[],"mappings":";;;;;;AAoBgB,SAAA,eAAA,CAAgB,SAAc,KAAiB,EAAA;AAC9D,EAAA,MAAM,IAAI,KAAM,CAAA,MAAA;AAChB,EAAI,IAAA,CAAA,GAAI,CAAK,IAAA,CAAC,OAAS,EAAA;AACtB,IAAO,OAAA,OAAA;AAAA;AAER,EAAA,IAAI,CAAI,GAAA,CAAA;AACR,EAAI,IAAA,SAAA;AACJ,EAAA,OAAO,IAAI,CAAG,EAAA;AACb,IAAM,MAAA,GAAA,GAAM,MAAM,CAAC,CAAA;AACnB,IAAI,IAAA,EAAA;AACJ,IAAI,IAAA;AACH,MAAA,SAAA,GAAY,QAAQ,GAAG,CAAA;AAAA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,UAAA;AAAA,QACA,aAAA;AAAA,QACA;AAAA,OACD;AACA,MAAA,IAAI,SAAW,EAAA;AACd,QAAA,UAAA,CAAW,aAAa,CAAI,GAAA,SAAA;AAAA;AAC7B;AACD,GACA,CAAA;AAED,EAAO,OAAA,UAAA;AACR;AAQA,SAAS,eAAe,SAAwC,EAAA;AAC/D,EAAA,IAAI,OAAO,SAAA,KAAc,QAAY,IAAA,SAAA,KAAc,IAAM,EAAA;AACxD,IAAA,MAAM,OAAU,GAAA,SAAA;AAChB,IAAA,IACC,OAAO,OAAQ,CAAA,MAAA,KAAW,cAC1B,OAAO,OAAA,CAAQ,UAAU,UACxB,EAAA;AACD,MAAO,OAAA,IAAA;AAAA;AACR;AAED,EAAA,IACC,OAAO,SAAc,KAAA,QAAA,IACrB,SAAc,KAAA,IAAA,IACd,eAAe,SACd,EAAA;AACD,IAAO,OAAA,IAAA;AAAA;AAGR,EAAO,OAAA,KAAA;AACR;;;;"}
export * from './is-dom-text';
export * from './is-i18n-data';
export * from './is-jsexpression';
export * from './is-jsslot';
export * from './is-node-schema';
export * from './is-node';
export * from './is-title-config';
export * from './is-location-data';
export * from './is-drag-node-data-object';
export * from './is-drag-node-object';
export * from './is-procode-component-type';
export * from './is-microcode-component-type';
export * from './is-drag-any-object';
export * from './is-location-children-detail';
export * from './is-custom-view';
export * from './is-setting-field';
export * from './is-dynamic-setter';
export * from './is-setter-config';
export * from './is-action-content-object';
export * from './is-isfunction';
export * from './is-basic-prop-type';
export * from './is-component-schema';
export * from './is-node-schema';
export * from './is-project-schema';
export * from './is-required-prop-type';
export { isDomText } from './is-dom-text.js';
export { isI18nData } from './is-i18n-data.js';
export { isJSExpression } from './is-jsexpression.js';
export { isJSSlot } from './is-jsslot.js';
export { isNodeSchema } from './is-node-schema.js';
export { isNode } from './is-node.js';
export { isTitleConfig } from './is-title-config.js';
export { isLocationData } from './is-location-data.js';
export { isDragNodeDataObject } from './is-drag-node-data-object.js';
export { isDragNodeObject } from './is-drag-node-object.js';
export { isProCodeComponentType } from './is-procode-component-type.js';
export { isMicrocodeComponentType } from './is-microcode-component-type.js';
export { isDragAnyObject } from './is-drag-any-object.js';
export { isLocationChildrenDetail } from './is-location-children-detail.js';
export { isCustomView } from './is-custom-view.js';
export { isSettingField } from './is-setting-field.js';
export { isDynamicSetter } from './is-dynamic-setter.js';
export { isSetterConfig } from './is-setter-config.js';
export { isActionContentObject } from './is-action-content-object.js';
export { isInnerJsFunction, isJSFunction } from './is-isfunction.js';
export { isBasicPropType } from './is-basic-prop-type.js';
export { isComponentSchema } from './is-component-schema.js';
export { isProjectSchema } from './is-project-schema.js';
export { isRequiredPropType } from './is-required-prop-type.js';
"use strict";
//# sourceMappingURL=index.js.map
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;"}
import { IPublicTypeActionContentObject } from '@arvin-shu/microcode-types';
export declare function isActionContentObject(obj: any): obj is IPublicTypeActionContentObject;
import { isObject } from '../is-object.js';
"use strict";
function isActionContentObject(obj) {
return isObject(obj);
}
export { isActionContentObject };
//# sourceMappingURL=is-action-content-object.js.map
{"version":3,"file":"is-action-content-object.js","sources":["../../../src/check-types/is-action-content-object.ts"],"sourcesContent":["import { IPublicTypeActionContentObject } from '@arvin-shu/microcode-types';\nimport { isObject } from '../is-object';\n\nexport function isActionContentObject(\n\tobj: any\n): obj is IPublicTypeActionContentObject {\n\treturn isObject(obj);\n}\n"],"names":[],"mappings":";;;AAGO,SAAS,sBACf,GACwC,EAAA;AACxC,EAAA,OAAO,SAAS,GAAG,CAAA;AACpB;;;;"}
import { IPublicTypeBasicType, IPublicTypePropType } from '@arvin-shu/microcode-types';
export declare function isBasicPropType(propType: IPublicTypePropType): propType is IPublicTypeBasicType;
"use strict";
function isBasicPropType(propType) {
if (!propType) {
return false;
}
return typeof propType === "string";
}
export { isBasicPropType };
//# sourceMappingURL=is-basic-prop-type.js.map
{"version":3,"file":"is-basic-prop-type.js","sources":["../../../src/check-types/is-basic-prop-type.ts"],"sourcesContent":["import {\n\tIPublicTypeBasicType,\n\tIPublicTypePropType,\n} from '@arvin-shu/microcode-types';\n\nexport function isBasicPropType(\n\tpropType: IPublicTypePropType\n): propType is IPublicTypeBasicType {\n\tif (!propType) {\n\t\treturn false;\n\t}\n\treturn typeof propType === 'string';\n}\n"],"names":[],"mappings":";AAKO,SAAS,gBACf,QACmC,EAAA;AACnC,EAAA,IAAI,CAAC,QAAU,EAAA;AACd,IAAO,OAAA,KAAA;AAAA;AAER,EAAA,OAAO,OAAO,QAAa,KAAA,QAAA;AAC5B;;;;"}
import { IPublicTypeComponentSchema } from '@arvin-shu/microcode-types';
export declare function isComponentSchema(schema: any): schema is IPublicTypeComponentSchema;
"use strict";
function isComponentSchema(schema) {
if (typeof schema === "object") {
return schema.componentName === "Component";
}
return false;
}
export { isComponentSchema };
//# sourceMappingURL=is-component-schema.js.map
{"version":3,"file":"is-component-schema.js","sources":["../../../src/check-types/is-component-schema.ts"],"sourcesContent":["import { IPublicTypeComponentSchema } from '@arvin-shu/microcode-types';\n\nexport function isComponentSchema(\n\tschema: any\n): schema is IPublicTypeComponentSchema {\n\tif (typeof schema === 'object') {\n\t\treturn schema.componentName === 'Component';\n\t}\n\treturn false;\n}\n"],"names":[],"mappings":";AAEO,SAAS,kBACf,MACuC,EAAA;AACvC,EAAI,IAAA,OAAO,WAAW,QAAU,EAAA;AAC/B,IAAA,OAAO,OAAO,aAAkB,KAAA,WAAA;AAAA;AAEjC,EAAO,OAAA,KAAA;AACR;;;;"}
import { IPublicTypeCustomView } from '@arvin-shu/microcode-types';
export declare function isCustomView(obj: any): obj is IPublicTypeCustomView;
"use strict";
function isCustomView(obj) {
if (!obj) {
return false;
}
if (obj instanceof Object && "_isVNode" in obj) {
return true;
}
if (obj?.$) {
return true;
}
if (typeof obj === "object") {
return !!(obj.render || obj.setup || obj.template || obj.components || obj.__file);
}
return typeof obj === "function";
}
export { isCustomView };
//# sourceMappingURL=is-custom-view.js.map
{"version":3,"file":"is-custom-view.js","sources":["../../../src/check-types/is-custom-view.ts"],"sourcesContent":["import { IPublicTypeCustomView } from '@arvin-shu/microcode-types';\n\nexport function isCustomView(obj: any): obj is IPublicTypeCustomView {\n\tif (!obj) {\n\t\treturn false;\n\t}\n\n\t// instanceof 检查\n\tif (obj instanceof Object && '_isVNode' in obj) {\n\t\treturn true;\n\t}\n\n\t// 组件实例检查\n\tif (obj?.$) {\n\t\treturn true;\n\t}\n\n\t// 组件定义检查\n\tif (typeof obj === 'object') {\n\t\treturn !!(\n\t\t\tobj.render ||\n\t\t\tobj.setup ||\n\t\t\tobj.template ||\n\t\t\tobj.components ||\n\t\t\tobj.__file\n\t\t);\n\t}\n\n\t// 函数式组件检查\n\treturn typeof obj === 'function';\n}\n"],"names":[],"mappings":";AAEO,SAAS,aAAa,GAAwC,EAAA;AACpE,EAAA,IAAI,CAAC,GAAK,EAAA;AACT,IAAO,OAAA,KAAA;AAAA;AAIR,EAAI,IAAA,GAAA,YAAe,MAAU,IAAA,UAAA,IAAc,GAAK,EAAA;AAC/C,IAAO,OAAA,IAAA;AAAA;AAIR,EAAA,IAAI,KAAK,CAAG,EAAA;AACX,IAAO,OAAA,IAAA;AAAA;AAIR,EAAI,IAAA,OAAO,QAAQ,QAAU,EAAA;AAC5B,IAAO,OAAA,CAAC,EACP,GAAA,CAAI,MACJ,IAAA,GAAA,CAAI,SACJ,GAAI,CAAA,QAAA,IACJ,GAAI,CAAA,UAAA,IACJ,GAAI,CAAA,MAAA,CAAA;AAAA;AAKN,EAAA,OAAO,OAAO,GAAQ,KAAA,UAAA;AACvB;;;;"}
export declare function isDomText(data: any): data is string;
"use strict";
function isDomText(data) {
return typeof data === "string";
}
export { isDomText };
//# sourceMappingURL=is-dom-text.js.map
{"version":3,"file":"is-dom-text.js","sources":["../../../src/check-types/is-dom-text.ts"],"sourcesContent":["export function isDomText(data: any): data is string {\n\treturn typeof data === 'string';\n}\n"],"names":[],"mappings":";AAAO,SAAS,UAAU,IAA2B,EAAA;AACpD,EAAA,OAAO,OAAO,IAAS,KAAA,QAAA;AACxB;;;;"}
/**
* 判断拖拽对象是否为任意对象类型
* @param obj 需要判断的对象
* @returns 如果对象不是NodeData或Node类型,则返回true,否则返回false
*/
export declare function isDragAnyObject(obj: any): boolean;
import { IPublicEnumDragObjectType } from '@arvin-shu/microcode-types';
import { isObject } from '../is-object.js';
"use strict";
function isDragAnyObject(obj) {
if (!isObject(obj)) {
return false;
}
return obj.type !== IPublicEnumDragObjectType.NodeData && obj.type !== IPublicEnumDragObjectType.Node;
}
export { isDragAnyObject };
//# sourceMappingURL=is-drag-any-object.js.map
{"version":3,"file":"is-drag-any-object.js","sources":["../../../src/check-types/is-drag-any-object.ts"],"sourcesContent":["import { IPublicEnumDragObjectType } from '@arvin-shu/microcode-types';\nimport { isObject } from '../is-object';\n\n/**\n * 判断拖拽对象是否为任意对象类型\n * @param obj 需要判断的对象\n * @returns 如果对象不是NodeData或Node类型,则返回true,否则返回false\n */\nexport function isDragAnyObject(obj: any): boolean {\n\t// 首先判断是否为对象类型\n\tif (!isObject(obj)) {\n\t\treturn false;\n\t}\n\t// 判断对象类型是否不为NodeData和Node\n\treturn (\n\t\tobj.type !== IPublicEnumDragObjectType.NodeData &&\n\t\tobj.type !== IPublicEnumDragObjectType.Node\n\t);\n}\n"],"names":[],"mappings":";;;;AAQO,SAAS,gBAAgB,GAAmB,EAAA;AAElD,EAAI,IAAA,CAAC,QAAS,CAAA,GAAG,CAAG,EAAA;AACnB,IAAO,OAAA,KAAA;AAAA;AAGR,EAAA,OACC,IAAI,IAAS,KAAA,yBAAA,CAA0B,QACvC,IAAA,GAAA,CAAI,SAAS,yBAA0B,CAAA,IAAA;AAEzC;;;;"}
import { IPublicTypeDragNodeDataObject } from '@arvin-shu/microcode-types';
export declare function isDragNodeDataObject(obj: any): obj is IPublicTypeDragNodeDataObject;
import { IPublicEnumDragObjectType } from '@arvin-shu/microcode-types';
import { isObject } from '../is-object.js';
"use strict";
function isDragNodeDataObject(obj) {
if (!isObject(obj)) {
return false;
}
return obj.type === IPublicEnumDragObjectType.NodeData;
}
export { isDragNodeDataObject };
//# sourceMappingURL=is-drag-node-data-object.js.map
{"version":3,"file":"is-drag-node-data-object.js","sources":["../../../src/check-types/is-drag-node-data-object.ts"],"sourcesContent":["import {\n\tIPublicEnumDragObjectType,\n\tIPublicTypeDragNodeDataObject,\n} from '@arvin-shu/microcode-types';\nimport { isObject } from '../is-object';\n\nexport function isDragNodeDataObject(\n\tobj: any\n): obj is IPublicTypeDragNodeDataObject {\n\tif (!isObject(obj)) {\n\t\treturn false;\n\t}\n\treturn obj.type === IPublicEnumDragObjectType.NodeData;\n}\n"],"names":[],"mappings":";;;;AAMO,SAAS,qBACf,GACuC,EAAA;AACvC,EAAI,IAAA,CAAC,QAAS,CAAA,GAAG,CAAG,EAAA;AACnB,IAAO,OAAA,KAAA;AAAA;AAER,EAAO,OAAA,GAAA,CAAI,SAAS,yBAA0B,CAAA,QAAA;AAC/C;;;;"}
import { IPublicModelNode, IPublicTypeDragNodeObject } from '@arvin-shu/microcode-types';
export declare function isDragNodeObject<Node = IPublicModelNode>(obj: any): obj is IPublicTypeDragNodeObject<Node>;
import { IPublicEnumDragObjectType } from '@arvin-shu/microcode-types';
import { isObject } from '../is-object.js';
"use strict";
function isDragNodeObject(obj) {
if (!isObject(obj)) {
return false;
}
return obj.type === IPublicEnumDragObjectType.Node;
}
export { isDragNodeObject };
//# sourceMappingURL=is-drag-node-object.js.map
{"version":3,"file":"is-drag-node-object.js","sources":["../../../src/check-types/is-drag-node-object.ts"],"sourcesContent":["import {\n\tIPublicEnumDragObjectType,\n\tIPublicModelNode,\n\tIPublicTypeDragNodeObject,\n} from '@arvin-shu/microcode-types';\nimport { isObject } from '../is-object';\n\nexport function isDragNodeObject<Node = IPublicModelNode>(\n\tobj: any\n): obj is IPublicTypeDragNodeObject<Node> {\n\tif (!isObject(obj)) {\n\t\treturn false;\n\t}\n\treturn obj.type === IPublicEnumDragObjectType.Node;\n}\n"],"names":[],"mappings":";;;;AAOO,SAAS,iBACf,GACyC,EAAA;AACzC,EAAI,IAAA,CAAC,QAAS,CAAA,GAAG,CAAG,EAAA;AACnB,IAAO,OAAA,KAAA;AAAA;AAER,EAAO,OAAA,GAAA,CAAI,SAAS,yBAA0B,CAAA,IAAA;AAC/C;;;;"}
import { IPublicTypeDynamicSetter } from '@arvin-shu/microcode-types';
export declare function isDynamicSetter(obj: any): obj is IPublicTypeDynamicSetter;
import { isFunction } from 'lodash-es';
import { isVueComponent } from '../is-vue.js';
"use strict";
function isDynamicSetter(obj) {
if (!isFunction(obj)) {
return false;
}
return !isVueComponent(obj);
}
export { isDynamicSetter };
//# sourceMappingURL=is-dynamic-setter.js.map
{"version":3,"file":"is-dynamic-setter.js","sources":["../../../src/check-types/is-dynamic-setter.ts"],"sourcesContent":["import { isFunction } from 'lodash-es';\nimport { IPublicTypeDynamicSetter } from '@arvin-shu/microcode-types';\nimport { isVueComponent } from '../is-vue';\n\nexport function isDynamicSetter(obj: any): obj is IPublicTypeDynamicSetter {\n\tif (!isFunction(obj)) {\n\t\treturn false;\n\t}\n\treturn !isVueComponent(obj);\n}\n"],"names":[],"mappings":";;;;AAIO,SAAS,gBAAgB,GAA2C,EAAA;AAC1E,EAAI,IAAA,CAAC,UAAW,CAAA,GAAG,CAAG,EAAA;AACrB,IAAO,OAAA,KAAA;AAAA;AAER,EAAO,OAAA,CAAC,eAAe,GAAG,CAAA;AAC3B;;;;"}
export declare function isFunction(obj: any): obj is Function;
"use strict";
function isFunction(obj) {
return obj && typeof obj === "function";
}
export { isFunction };
//# sourceMappingURL=is-function.js.map
{"version":3,"file":"is-function.js","sources":["../../../src/check-types/is-function.ts"],"sourcesContent":["export function isFunction(obj: any): obj is Function {\n\treturn obj && typeof obj === 'function';\n}\n"],"names":[],"mappings":";AAAO,SAAS,WAAW,GAA2B,EAAA;AACrD,EAAO,OAAA,GAAA,IAAO,OAAO,GAAQ,KAAA,UAAA;AAC9B;;;;"}
import { IPublicTypeI18nData } from '@arvin-shu/microcode-types';
export declare function isI18nData(obj: any): obj is IPublicTypeI18nData;
import { isObject } from '../is-object.js';
"use strict";
function isI18nData(obj) {
if (!isObject(obj)) {
return false;
}
return obj.type === "i18n";
}
export { isI18nData };
//# sourceMappingURL=is-i18n-data.js.map
{"version":3,"file":"is-i18n-data.js","sources":["../../../src/check-types/is-i18n-data.ts"],"sourcesContent":["import { IPublicTypeI18nData } from '@arvin-shu/microcode-types';\nimport { isObject } from '../is-object';\n\nexport function isI18nData(obj: any): obj is IPublicTypeI18nData {\n\tif (!isObject(obj)) {\n\t\treturn false;\n\t}\n\treturn obj.type === 'i18n';\n}\n"],"names":[],"mappings":";;;AAGO,SAAS,WAAW,GAAsC,EAAA;AAChE,EAAI,IAAA,CAAC,QAAS,CAAA,GAAG,CAAG,EAAA;AACnB,IAAO,OAAA,KAAA;AAAA;AAER,EAAA,OAAO,IAAI,IAAS,KAAA,MAAA;AACrB;;;;"}
import { IPublicTypeJSFunction } from '@arvin-shu/microcode-types';
interface InnerJsFunction {
type: 'JSExpression';
source: string;
value: string;
extType: 'function';
}
/**
* 内部版本 的 { type: 'JSExpression', source: '', value: '', extType: 'function' } 能力上等同于 JSFunction
*/
export declare function isInnerJsFunction(data: any): data is InnerJsFunction;
export declare function isJSFunction(data: any): data is IPublicTypeJSFunction;
export {};
import { isObject } from '../is-object.js';
"use strict";
function isInnerJsFunction(data) {
if (!isObject(data)) {
return false;
}
return data.type === "JSExpression" && data.extType === "function";
}
function isJSFunction(data) {
if (!isObject(data)) {
return false;
}
return data.type === "JSFunction" || isInnerJsFunction(data);
}
export { isInnerJsFunction, isJSFunction };
//# sourceMappingURL=is-isfunction.js.map
{"version":3,"file":"is-isfunction.js","sources":["../../../src/check-types/is-isfunction.ts"],"sourcesContent":["import { IPublicTypeJSFunction } from '@arvin-shu/microcode-types';\nimport { isObject } from '../is-object';\n\ninterface InnerJsFunction {\n\ttype: 'JSExpression';\n\tsource: string;\n\tvalue: string;\n\textType: 'function';\n}\n\n/**\n * 内部版本 的 { type: 'JSExpression', source: '', value: '', extType: 'function' } 能力上等同于 JSFunction\n */\nexport function isInnerJsFunction(data: any): data is InnerJsFunction {\n\tif (!isObject(data)) {\n\t\treturn false;\n\t}\n\treturn data.type === 'JSExpression' && data.extType === 'function';\n}\n\nexport function isJSFunction(data: any): data is IPublicTypeJSFunction {\n\tif (!isObject(data)) {\n\t\treturn false;\n\t}\n\treturn data.type === 'JSFunction' || isInnerJsFunction(data);\n}\n"],"names":[],"mappings":";;;AAaO,SAAS,kBAAkB,IAAoC,EAAA;AACrE,EAAI,IAAA,CAAC,QAAS,CAAA,IAAI,CAAG,EAAA;AACpB,IAAO,OAAA,KAAA;AAAA;AAER,EAAA,OAAO,IAAK,CAAA,IAAA,KAAS,cAAkB,IAAA,IAAA,CAAK,OAAY,KAAA,UAAA;AACzD;AAEO,SAAS,aAAa,IAA0C,EAAA;AACtE,EAAI,IAAA,CAAC,QAAS,CAAA,IAAI,CAAG,EAAA;AACpB,IAAO,OAAA,KAAA;AAAA;AAER,EAAA,OAAO,IAAK,CAAA,IAAA,KAAS,YAAgB,IAAA,iBAAA,CAAkB,IAAI,CAAA;AAC5D;;;;"}
import { IPublicTypeJSExpression } from '@arvin-shu/microcode-types';
export declare function isJSExpression(data: any): data is IPublicTypeJSExpression;
import { isObject } from '../is-object.js';
"use strict";
function isJSExpression(data) {
if (!isObject(data)) {
return false;
}
return data.type === "JSExpression" && data.extType !== "function";
}
export { isJSExpression };
//# sourceMappingURL=is-jsexpression.js.map
{"version":3,"file":"is-jsexpression.js","sources":["../../../src/check-types/is-jsexpression.ts"],"sourcesContent":["import { IPublicTypeJSExpression } from '@arvin-shu/microcode-types';\nimport { isObject } from '../is-object';\n\nexport function isJSExpression(data: any): data is IPublicTypeJSExpression {\n\tif (!isObject(data)) {\n\t\treturn false;\n\t}\n\treturn data.type === 'JSExpression' && data.extType !== 'function';\n}\n"],"names":[],"mappings":";;;AAGO,SAAS,eAAe,IAA4C,EAAA;AAC1E,EAAI,IAAA,CAAC,QAAS,CAAA,IAAI,CAAG,EAAA;AACpB,IAAO,OAAA,KAAA;AAAA;AAER,EAAA,OAAO,IAAK,CAAA,IAAA,KAAS,cAAkB,IAAA,IAAA,CAAK,OAAY,KAAA,UAAA;AACzD;;;;"}
import { IPublicTypeJSSlot } from '@arvin-shu/microcode-types';
export declare function isJSSlot(data: any): data is IPublicTypeJSSlot;
import { isObject } from '../is-object.js';
"use strict";
function isJSSlot(data) {
if (!isObject(data)) {
return false;
}
return data.type === "JSSlot";
}
export { isJSSlot };
//# sourceMappingURL=is-jsslot.js.map
{"version":3,"file":"is-jsslot.js","sources":["../../../src/check-types/is-jsslot.ts"],"sourcesContent":["import { IPublicTypeJSSlot } from '@arvin-shu/microcode-types';\nimport { isObject } from '../is-object';\n\nexport function isJSSlot(data: any): data is IPublicTypeJSSlot {\n\tif (!isObject(data)) {\n\t\treturn false;\n\t}\n\treturn data.type === 'JSSlot';\n}\n"],"names":[],"mappings":";;;AAGO,SAAS,SAAS,IAAsC,EAAA;AAC9D,EAAI,IAAA,CAAC,QAAS,CAAA,IAAI,CAAG,EAAA;AACpB,IAAO,OAAA,KAAA;AAAA;AAER,EAAA,OAAO,KAAK,IAAS,KAAA,QAAA;AACtB;;;;"}
import { IPublicTypeLocationChildrenDetail } from '@arvin-shu/microcode-types';
export declare function isLocationChildrenDetail(obj: any): obj is IPublicTypeLocationChildrenDetail;
import { IPublicTypeLocationDetailType } from '@arvin-shu/microcode-types';
import { isObject } from '../is-object.js';
"use strict";
function isLocationChildrenDetail(obj) {
if (!isObject(obj)) {
return false;
}
return obj.type === IPublicTypeLocationDetailType.Children;
}
export { isLocationChildrenDetail };
//# sourceMappingURL=is-location-children-detail.js.map
{"version":3,"file":"is-location-children-detail.js","sources":["../../../src/check-types/is-location-children-detail.ts"],"sourcesContent":["import {\n\tIPublicTypeLocationChildrenDetail,\n\tIPublicTypeLocationDetailType,\n} from '@arvin-shu/microcode-types';\nimport { isObject } from '../is-object';\n\nexport function isLocationChildrenDetail(\n\tobj: any\n): obj is IPublicTypeLocationChildrenDetail {\n\tif (!isObject(obj)) {\n\t\treturn false;\n\t}\n\treturn obj.type === IPublicTypeLocationDetailType.Children;\n}\n"],"names":[],"mappings":";;;;AAMO,SAAS,yBACf,GAC2C,EAAA;AAC3C,EAAI,IAAA,CAAC,QAAS,CAAA,GAAG,CAAG,EAAA;AACnB,IAAO,OAAA,KAAA;AAAA;AAER,EAAO,OAAA,GAAA,CAAI,SAAS,6BAA8B,CAAA,QAAA;AACnD;;;;"}
import { IPublicTypeLocationData } from '@arvin-shu/microcode-types';
export declare function isLocationData(obj: any): obj is IPublicTypeLocationData;
import { isObject } from '../is-object.js';
"use strict";
function isLocationData(obj) {
if (!isObject(obj)) {
return false;
}
return "target" in obj && "detail" in obj;
}
export { isLocationData };
//# sourceMappingURL=is-location-data.js.map
{"version":3,"file":"is-location-data.js","sources":["../../../src/check-types/is-location-data.ts"],"sourcesContent":["import { IPublicTypeLocationData } from '@arvin-shu/microcode-types';\nimport { isObject } from '../is-object';\n\nexport function isLocationData(obj: any): obj is IPublicTypeLocationData {\n\tif (!isObject(obj)) {\n\t\treturn false;\n\t}\n\treturn 'target' in obj && 'detail' in obj;\n}\n"],"names":[],"mappings":";;;AAGO,SAAS,eAAe,GAA0C,EAAA;AACxE,EAAI,IAAA,CAAC,QAAS,CAAA,GAAG,CAAG,EAAA;AACnB,IAAO,OAAA,KAAA;AAAA;AAER,EAAO,OAAA,QAAA,IAAY,OAAO,QAAY,IAAA,GAAA;AACvC;;;;"}
import { IPublicTypeComponentMap, IPublicTypeMicrocodeComponent } from '@arvin-shu/microcode-types';
export declare function isMicrocodeComponentType(desc: IPublicTypeComponentMap): desc is IPublicTypeMicrocodeComponent;
import { isProCodeComponentType } from './is-procode-component-type.js';
"use strict";
function isMicrocodeComponentType(desc) {
return !isProCodeComponentType(desc);
}
export { isMicrocodeComponentType };
//# sourceMappingURL=is-microcode-component-type.js.map
{"version":3,"file":"is-microcode-component-type.js","sources":["../../../src/check-types/is-microcode-component-type.ts"],"sourcesContent":["import {\n\tIPublicTypeComponentMap,\n\tIPublicTypeMicrocodeComponent,\n} from '@arvin-shu/microcode-types';\nimport { isProCodeComponentType } from './is-procode-component-type';\n\nexport function isMicrocodeComponentType(\n\tdesc: IPublicTypeComponentMap\n): desc is IPublicTypeMicrocodeComponent {\n\treturn !isProCodeComponentType(desc);\n}\n"],"names":[],"mappings":";;;AAMO,SAAS,yBACf,IACwC,EAAA;AACxC,EAAO,OAAA,CAAC,uBAAuB,IAAI,CAAA;AACpC;;;;"}
import { IPublicTypeNodeSchema } from '@arvin-shu/microcode-types';
export declare function isNodeSchema(data: any): data is IPublicTypeNodeSchema;
import { isObject } from '../is-object.js';
"use strict";
function isNodeSchema(data) {
if (!isObject(data)) {
return false;
}
return "componentName" in data && !data.isNode;
}
export { isNodeSchema };
//# sourceMappingURL=is-node-schema.js.map
{"version":3,"file":"is-node-schema.js","sources":["../../../src/check-types/is-node-schema.ts"],"sourcesContent":["import { IPublicTypeNodeSchema } from '@arvin-shu/microcode-types';\nimport { isObject } from '../is-object';\n\nexport function isNodeSchema(data: any): data is IPublicTypeNodeSchema {\n\tif (!isObject(data)) {\n\t\treturn false;\n\t}\n\treturn 'componentName' in data && !data.isNode;\n}\n"],"names":[],"mappings":";;;AAGO,SAAS,aAAa,IAA0C,EAAA;AACtE,EAAI,IAAA,CAAC,QAAS,CAAA,IAAI,CAAG,EAAA;AACpB,IAAO,OAAA,KAAA;AAAA;AAER,EAAO,OAAA,eAAA,IAAmB,IAAQ,IAAA,CAAC,IAAK,CAAA,MAAA;AACzC;;;;"}
import { IPublicModelNode } from '@arvin-shu/microcode-types';
export declare function isNode<Node = IPublicModelNode>(node: any): node is Node;
import { isObject } from '../is-object.js';
"use strict";
function isNode(node) {
if (!isObject(node)) {
return false;
}
return node.isNode;
}
export { isNode };
//# sourceMappingURL=is-node.js.map
{"version":3,"file":"is-node.js","sources":["../../../src/check-types/is-node.ts"],"sourcesContent":["import { IPublicModelNode } from '@arvin-shu/microcode-types';\nimport { isObject } from '../is-object';\n\nexport function isNode<Node = IPublicModelNode>(node: any): node is Node {\n\tif (!isObject(node)) {\n\t\treturn false;\n\t}\n\treturn node.isNode;\n}\n"],"names":[],"mappings":";;;AAGO,SAAS,OAAgC,IAAyB,EAAA;AACxE,EAAI,IAAA,CAAC,QAAS,CAAA,IAAI,CAAG,EAAA;AACpB,IAAO,OAAA,KAAA;AAAA;AAER,EAAA,OAAO,IAAK,CAAA,MAAA;AACb;;;;"}
import { IPublicTypeComponentMap, IPublicTypeProCodeComponent } from '@arvin-shu/microcode-types';
export declare function isProCodeComponentType(desc: IPublicTypeComponentMap): desc is IPublicTypeProCodeComponent;
import { isObject } from '../is-object.js';
"use strict";
function isProCodeComponentType(desc) {
if (!isObject(desc)) {
return false;
}
return "package" in desc;
}
export { isProCodeComponentType };
//# sourceMappingURL=is-procode-component-type.js.map
{"version":3,"file":"is-procode-component-type.js","sources":["../../../src/check-types/is-procode-component-type.ts"],"sourcesContent":["import {\n\tIPublicTypeComponentMap,\n\tIPublicTypeProCodeComponent,\n} from '@arvin-shu/microcode-types';\nimport { isObject } from '../is-object';\n\nexport function isProCodeComponentType(\n\tdesc: IPublicTypeComponentMap\n): desc is IPublicTypeProCodeComponent {\n\tif (!isObject(desc)) {\n\t\treturn false;\n\t}\n\n\treturn 'package' in desc;\n}\n"],"names":[],"mappings":";;;AAMO,SAAS,uBACf,IACsC,EAAA;AACtC,EAAI,IAAA,CAAC,QAAS,CAAA,IAAI,CAAG,EAAA;AACpB,IAAO,OAAA,KAAA;AAAA;AAGR,EAAA,OAAO,SAAa,IAAA,IAAA;AACrB;;;;"}
import { IPublicTypeProjectSchema } from '@arvin-shu/microcode-types';
export declare function isProjectSchema(data: any): data is IPublicTypeProjectSchema;
import { isObject } from '../is-object.js';
"use strict";
function isProjectSchema(data) {
if (!isObject(data)) {
return false;
}
return "componentsTree" in data;
}
export { isProjectSchema };
//# sourceMappingURL=is-project-schema.js.map
{"version":3,"file":"is-project-schema.js","sources":["../../../src/check-types/is-project-schema.ts"],"sourcesContent":["import { IPublicTypeProjectSchema } from '@arvin-shu/microcode-types';\nimport { isObject } from '../is-object';\n\nexport function isProjectSchema(data: any): data is IPublicTypeProjectSchema {\n\tif (!isObject(data)) {\n\t\treturn false;\n\t}\n\treturn 'componentsTree' in data;\n}\n"],"names":[],"mappings":";;;AAGO,SAAS,gBAAgB,IAA6C,EAAA;AAC5E,EAAI,IAAA,CAAC,QAAS,CAAA,IAAI,CAAG,EAAA;AACpB,IAAO,OAAA,KAAA;AAAA;AAER,EAAA,OAAO,gBAAoB,IAAA,IAAA;AAC5B;;;;"}
import { IPublicTypePropType, IPublicTypeRequiredType } from '@arvin-shu/microcode-types';
export declare function isRequiredPropType(propType: IPublicTypePropType): propType is IPublicTypeRequiredType;
"use strict";
function isRequiredPropType(propType) {
if (!propType) {
return false;
}
return typeof propType === "object" && propType.type && [
"array",
"bool",
"func",
"number",
"object",
"string",
"node",
"element",
"any"
].includes(propType.type);
}
export { isRequiredPropType };
//# sourceMappingURL=is-required-prop-type.js.map
{"version":3,"file":"is-required-prop-type.js","sources":["../../../src/check-types/is-required-prop-type.ts"],"sourcesContent":["import {\n\tIPublicTypePropType,\n\tIPublicTypeRequiredType,\n} from '@arvin-shu/microcode-types';\n\nexport function isRequiredPropType(\n\tpropType: IPublicTypePropType\n): propType is IPublicTypeRequiredType {\n\tif (!propType) {\n\t\treturn false;\n\t}\n\treturn (\n\t\ttypeof propType === 'object' &&\n\t\tpropType.type &&\n\t\t[\n\t\t\t'array',\n\t\t\t'bool',\n\t\t\t'func',\n\t\t\t'number',\n\t\t\t'object',\n\t\t\t'string',\n\t\t\t'node',\n\t\t\t'element',\n\t\t\t'any',\n\t\t].includes(propType.type)\n\t);\n}\n"],"names":[],"mappings":";AAKO,SAAS,mBACf,QACsC,EAAA;AACtC,EAAA,IAAI,CAAC,QAAU,EAAA;AACd,IAAO,OAAA,KAAA;AAAA;AAER,EAAA,OACC,OAAO,QAAA,KAAa,QACpB,IAAA,QAAA,CAAS,IACT,IAAA;AAAA,IACC,OAAA;AAAA,IACA,MAAA;AAAA,IACA,MAAA;AAAA,IACA,QAAA;AAAA,IACA,QAAA;AAAA,IACA,QAAA;AAAA,IACA,MAAA;AAAA,IACA,SAAA;AAAA,IACA;AAAA,GACD,CAAE,QAAS,CAAA,QAAA,CAAS,IAAI,CAAA;AAE1B;;;;"}
import { IPublicTypeSetterConfig } from '@arvin-shu/microcode-types';
export declare function isSetterConfig(obj: any): obj is IPublicTypeSetterConfig;
import { isCustomView } from './is-custom-view.js';
import { isObject } from '../is-object.js';
"use strict";
function isSetterConfig(obj) {
if (!isObject(obj)) {
return false;
}
return "componentName" in obj && !isCustomView(obj);
}
export { isSetterConfig };
//# sourceMappingURL=is-setter-config.js.map
{"version":3,"file":"is-setter-config.js","sources":["../../../src/check-types/is-setter-config.ts"],"sourcesContent":["import { IPublicTypeSetterConfig } from '@arvin-shu/microcode-types';\nimport { isCustomView } from './is-custom-view';\nimport { isObject } from '../is-object';\n\nexport function isSetterConfig(obj: any): obj is IPublicTypeSetterConfig {\n\tif (!isObject(obj)) {\n\t\treturn false;\n\t}\n\treturn 'componentName' in obj && !isCustomView(obj);\n}\n"],"names":[],"mappings":";;;;AAIO,SAAS,eAAe,GAA0C,EAAA;AACxE,EAAI,IAAA,CAAC,QAAS,CAAA,GAAG,CAAG,EAAA;AACnB,IAAO,OAAA,KAAA;AAAA;AAER,EAAA,OAAO,eAAmB,IAAA,GAAA,IAAO,CAAC,YAAA,CAAa,GAAG,CAAA;AACnD;;;;"}
import { IPublicModelSettingField } from '@arvin-shu/microcode-types';
export declare function isSettingField(obj: any): obj is IPublicModelSettingField;
import { isObject } from '../is-object.js';
"use strict";
function isSettingField(obj) {
if (!isObject(obj)) {
return false;
}
return "isSettingField" in obj && obj.isSettingField;
}
export { isSettingField };
//# sourceMappingURL=is-setting-field.js.map
{"version":3,"file":"is-setting-field.js","sources":["../../../src/check-types/is-setting-field.ts"],"sourcesContent":["import { IPublicModelSettingField } from '@arvin-shu/microcode-types';\nimport { isObject } from '../is-object';\n\nexport function isSettingField(obj: any): obj is IPublicModelSettingField {\n\tif (!isObject(obj)) {\n\t\treturn false;\n\t}\n\n\treturn 'isSettingField' in obj && obj.isSettingField;\n}\n"],"names":[],"mappings":";;;AAGO,SAAS,eAAe,GAA2C,EAAA;AACzE,EAAI,IAAA,CAAC,QAAS,CAAA,GAAG,CAAG,EAAA;AACnB,IAAO,OAAA,KAAA;AAAA;AAGR,EAAO,OAAA,gBAAA,IAAoB,OAAO,GAAI,CAAA,cAAA;AACvC;;;;"}
import { IPublicTypeTitleConfig } from '@arvin-shu/microcode-types';
export declare function isTitleConfig(obj: any): obj is IPublicTypeTitleConfig;
import { isI18nData } from './is-i18n-data.js';
import { isPlainObject } from '../is-plain-object.js';
"use strict";
function isTitleConfig(obj) {
return isPlainObject(obj) && !isI18nData(obj);
}
export { isTitleConfig };
//# sourceMappingURL=is-title-config.js.map
{"version":3,"file":"is-title-config.js","sources":["../../../src/check-types/is-title-config.ts"],"sourcesContent":["import { IPublicTypeTitleConfig } from '@arvin-shu/microcode-types';\nimport { isI18nData } from './is-i18n-data';\nimport { isPlainObject } from '../is-plain-object';\n\nexport function isTitleConfig(obj: any): obj is IPublicTypeTitleConfig {\n\treturn isPlainObject(obj) && !isI18nData(obj);\n}\n"],"names":[],"mappings":";;;;AAIO,SAAS,cAAc,GAAyC,EAAA;AACtE,EAAA,OAAO,aAAc,CAAA,GAAG,CAAK,IAAA,CAAC,WAAW,GAAG,CAAA;AAC7C;;;;"}
export declare function cloneDeep(src: any): any;
import { isPlainObject } from './is-plain-object.js';
"use strict";
function cloneDeep(src) {
const type = typeof src;
let data;
if (src === null || src === void 0) {
data = src;
} else if (Array.isArray(src)) {
data = src.map((item) => cloneDeep(item));
} else if (type === "object" && isPlainObject(src)) {
data = {};
for (const key in src) {
if (src.hasOwnProperty(key)) {
data[key] = cloneDeep(src[key]);
}
}
} else {
data = src;
}
return data;
}
export { cloneDeep };
//# sourceMappingURL=clone-deep.js.map
{"version":3,"file":"clone-deep.js","sources":["../../src/clone-deep.ts"],"sourcesContent":["import { isPlainObject } from './is-plain-object';\n\nexport function cloneDeep(src: any): any {\n\tconst type = typeof src;\n\n\tlet data: any;\n\tif (src === null || src === undefined) {\n\t\tdata = src;\n\t} else if (Array.isArray(src)) {\n\t\tdata = src.map((item) => cloneDeep(item));\n\t} else if (type === 'object' && isPlainObject(src)) {\n\t\tdata = {};\n\t\tfor (const key in src) {\n\t\t\t// eslint-disable-next-line no-prototype-builtins\n\t\t\tif (src.hasOwnProperty(key)) {\n\t\t\t\tdata[key] = cloneDeep(src[key]);\n\t\t\t}\n\t\t}\n\t} else {\n\t\tdata = src;\n\t}\n\n\treturn data;\n}\n"],"names":[],"mappings":";;;AAEO,SAAS,UAAU,GAAe,EAAA;AACxC,EAAA,MAAM,OAAO,OAAO,GAAA;AAEpB,EAAI,IAAA,IAAA;AACJ,EAAI,IAAA,GAAA,KAAQ,IAAQ,IAAA,GAAA,KAAQ,KAAW,CAAA,EAAA;AACtC,IAAO,IAAA,GAAA,GAAA;AAAA,GACG,MAAA,IAAA,KAAA,CAAM,OAAQ,CAAA,GAAG,CAAG,EAAA;AAC9B,IAAA,IAAA,GAAO,IAAI,GAAI,CAAA,CAAC,IAAS,KAAA,SAAA,CAAU,IAAI,CAAC,CAAA;AAAA,GAC9B,MAAA,IAAA,IAAA,KAAS,QAAY,IAAA,aAAA,CAAc,GAAG,CAAG,EAAA;AACnD,IAAA,IAAA,GAAO,EAAC;AACR,IAAA,KAAA,MAAW,OAAO,GAAK,EAAA;AAEtB,MAAI,IAAA,GAAA,CAAI,cAAe,CAAA,GAAG,CAAG,EAAA;AAC5B,QAAA,IAAA,CAAK,GAAG,CAAA,GAAI,SAAU,CAAA,GAAA,CAAI,GAAG,CAAC,CAAA;AAAA;AAC/B;AACD,GACM,MAAA;AACN,IAAO,IAAA,GAAA,GAAA;AAAA;AAGR,EAAO,OAAA,IAAA;AACR;;;;"}
import { Component, VNode } from 'vue';
export declare function createContent(content: string | VNode | Component, props?: Record<string, unknown>): VNode;
import { h, isVNode, cloneVNode } from 'vue';
import { isString } from 'lodash-es';
import { isVueComponent } from './is-vue.js';
"use strict";
function createContent(content, props) {
if (isString(content)) {
return h("span", content);
}
if (isVNode(content)) {
return props ? cloneVNode(content, props) : content;
}
if (isVueComponent(content)) {
return h(content, props);
}
return content;
}
export { createContent };
//# sourceMappingURL=create-content.js.map
{"version":3,"file":"create-content.js","sources":["../../src/create-content.ts"],"sourcesContent":["import { cloneVNode, Component, isVNode, VNode, h } from 'vue';\nimport { isString } from 'lodash-es';\nimport { isVueComponent } from './is-vue';\n\nexport function createContent(\n\tcontent: string | VNode | Component,\n\tprops?: Record<string, unknown>\n): VNode {\n\tif (isString(content)) {\n\t\treturn h('span', content);\n\t}\n\tif (isVNode(content)) {\n\t\treturn props ? cloneVNode(content, props) : content;\n\t}\n\tif (isVueComponent(content)) {\n\t\treturn h(content, props);\n\t}\n\treturn content;\n}\n"],"names":[],"mappings":";;;;;AAIgB,SAAA,aAAA,CACf,SACA,KACQ,EAAA;AACR,EAAI,IAAA,QAAA,CAAS,OAAO,CAAG,EAAA;AACtB,IAAO,OAAA,CAAA,CAAE,QAAQ,OAAO,CAAA;AAAA;AAEzB,EAAI,IAAA,OAAA,CAAQ,OAAO,CAAG,EAAA;AACrB,IAAA,OAAO,KAAQ,GAAA,UAAA,CAAW,OAAS,EAAA,KAAK,CAAI,GAAA,OAAA;AAAA;AAE7C,EAAI,IAAA,cAAA,CAAe,OAAO,CAAG,EAAA;AAC5B,IAAO,OAAA,CAAA,CAAE,SAAS,KAAK,CAAA;AAAA;AAExB,EAAO,OAAA,OAAA;AACR;;;;"}
export interface Defer<T = any> {
resolve(value?: T | PromiseLike<T>): void;
reject(reason?: any): void;
promise(): Promise<T>;
}
export declare function createDefer<T = any>(): Defer<T>;
"use strict";
function createDefer() {
const r = {};
const promise = new Promise((resolve, reject) => {
r.resolve = resolve;
r.reject = reject;
});
r.promise = () => promise;
return r;
}
export { createDefer };
//# sourceMappingURL=create-defer.js.map
{"version":3,"file":"create-defer.js","sources":["../../src/create-defer.ts"],"sourcesContent":["export interface Defer<T = any> {\n\tresolve(value?: T | PromiseLike<T>): void;\n\treject(reason?: any): void;\n\tpromise(): Promise<T>;\n}\n\nexport function createDefer<T = any>(): Defer<T> {\n\tconst r: any = {};\n\tconst promise = new Promise<T>((resolve, reject) => {\n\t\tr.resolve = resolve;\n\t\tr.reject = reject;\n\t});\n\n\tr.promise = () => promise;\n\n\treturn r;\n}\n"],"names":[],"mappings":";AAMO,SAAS,WAAiC,GAAA;AAChD,EAAA,MAAM,IAAS,EAAC;AAChB,EAAA,MAAM,OAAU,GAAA,IAAI,OAAW,CAAA,CAAC,SAAS,MAAW,KAAA;AACnD,IAAA,CAAA,CAAE,OAAU,GAAA,OAAA;AACZ,IAAA,CAAA,CAAE,MAAS,GAAA,MAAA;AAAA,GACX,CAAA;AAED,EAAA,CAAA,CAAE,UAAU,MAAM,OAAA;AAElB,EAAO,OAAA,CAAA;AACR;;;;"}
import { IPublicTypeIconType } from '@arvin-shu/microcode-types';
/**
* 创建图标组件
* @param icon - 图标类型或组件
* @param props - 组件属性
* @returns 图标组件
*/
export declare function createIcon(icon?: IPublicTypeIconType | null, props?: Record<string, unknown>): any;
export declare const IconWrapper: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
type: {
type: StringConstructor;
required: true;
};
iconProps: {
type: () => Record<string, unknown>;
default: () => {};
};
}>, () => any, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
type: {
type: StringConstructor;
required: true;
};
iconProps: {
type: () => Record<string, unknown>;
default: () => {};
};
}>> & Readonly<{}>, {
iconProps: Record<string, unknown>;
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
import { createVNode, Fragment, h, defineComponent, mergeProps, isVNode, cloneVNode } from 'vue';
import * as AntIcons from '@ant-design/icons-vue';
import { isESModule } from './is-es-module.js';
import { isVueComponent } from './is-vue.js';
"use strict";
const URL_RE = /^(https?:)\/\//i;
function createIcon(icon, props) {
if (!icon) {
return createVNode(Fragment, null, null);
}
if (isESModule(icon)) {
icon = icon.default;
}
if (typeof icon === "string") {
if (URL_RE.test(icon)) {
return h("img", {
src: icon,
class: props?.className,
...props
});
}
return createVNode(IconWrapper, mergeProps({
"type": icon
}, props), null);
}
if (isVNode(icon)) {
return cloneVNode(icon, {
...props
});
}
if (isVueComponent(icon)) {
return h(icon, {
class: props?.className,
...props
});
}
}
const IconWrapper = /* @__PURE__ */ defineComponent({
name: "IconWrapper",
props: {
type: {
type: String,
required: true
},
iconProps: {
type: Object,
default: () => ({})
}
},
setup(props) {
const IconComponent = AntIcons[props.type];
return () => IconComponent ? createVNode(IconComponent, props.iconProps, null) : createVNode(Fragment, null, null);
}
});
export { IconWrapper, createIcon };
//# sourceMappingURL=create-icon.js.map
{"version":3,"file":"create-icon.js","sources":["../../src/create-icon.tsx"],"sourcesContent":["import { cloneVNode, defineComponent, Fragment, h, isVNode } from 'vue';\nimport { IPublicTypeIconType } from '@arvin-shu/microcode-types';\nimport * as AntIcons from '@ant-design/icons-vue'; // 导入所有图标\nimport { isESModule } from './is-es-module';\nimport { isVueComponent } from './is-vue';\n\nconst URL_RE = /^(https?:)\\/\\//i;\n\n/**\n * 创建图标组件\n * @param icon - 图标类型或组件\n * @param props - 组件属性\n * @returns 图标组件\n */\nexport function createIcon(\n\ticon?: IPublicTypeIconType | null,\n\tprops?: Record<string, unknown>\n) {\n\tif (!icon) {\n\t\treturn <Fragment></Fragment>;\n\t}\n\tif (isESModule(icon)) {\n\t\ticon = icon.default;\n\t}\n\n\tif (typeof icon === 'string') {\n\t\tif (URL_RE.test(icon)) {\n\t\t\treturn h('img', {\n\t\t\t\tsrc: icon,\n\t\t\t\tclass: props?.className,\n\t\t\t\t...props,\n\t\t\t});\n\t\t}\n\t\treturn <IconWrapper type={icon} {...props} />;\n\t}\n\n\tif (isVNode(icon)) {\n\t\treturn cloneVNode(icon, { ...props });\n\t}\n\tif (isVueComponent(icon)) {\n\t\treturn h(icon, {\n\t\t\tclass: props?.className,\n\t\t\t...props,\n\t\t});\n\t}\n}\n\nexport const IconWrapper = defineComponent({\n\tname: 'IconWrapper',\n\tprops: {\n\t\ttype: {\n\t\t\ttype: String,\n\t\t\trequired: true,\n\t\t},\n\t\ticonProps: {\n\t\t\ttype: Object as () => Record<string, unknown>,\n\t\t\tdefault: () => ({}),\n\t\t},\n\t},\n\tsetup(props) {\n\t\tconst IconComponent: any = AntIcons[props.type as keyof typeof AntIcons];\n\t\treturn () =>\n\t\t\tIconComponent ? (\n\t\t\t\t<IconComponent {...props.iconProps}></IconComponent>\n\t\t\t) : (\n\t\t\t\t<Fragment></Fragment>\n\t\t\t);\n\t},\n});\n"],"names":["URL_RE","createIcon","icon","props","_createVNode","_Fragment","isESModule","default","test","h","src","class","className","IconWrapper","_mergeProps","isVNode","cloneVNode","isVueComponent","name","type","String","required","iconProps","Object","setup","IconComponent","AntIcons"],"mappings":";;;;;;AAMA,MAAMA,MAAS,GAAA,iBAAA;AAQCC,SAAAA,UAAAA,CACfC,MACAC,KACC,EAAA;AACD,EAAA,IAAI,CAACD,IAAM,EAAA;AACV,IAAAE,OAAAA,WAAAA,CAAAC,QAAA,EAAA,IAAA,EAAA,IAAA,CAAA;AAAA;AAED,EAAIC,IAAAA,UAAAA,CAAWJ,IAAI,CAAG,EAAA;AACrBA,IAAAA,IAAAA,GAAOA,IAAKK,CAAAA,OAAAA;AAAAA;AAGb,EAAI,IAAA,OAAOL,SAAS,QAAU,EAAA;AAC7B,IAAIF,IAAAA,MAAAA,CAAOQ,IAAKN,CAAAA,IAAI,CAA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export declare class Cursor {
private states;
setDragging(flag: boolean): void;
setXResizing(flag: boolean): void;
setYResizing(flag: boolean): void;
setCopy(flag: boolean): void;
isCopy(): boolean;
release(): void;
addState(state: string): void;
private removeState;
}
export declare const cursor: Cursor;
"use strict";
class Cursor {
states = /* @__PURE__ */ new Set();
setDragging(flag) {
if (flag) {
this.addState("dragging");
} else {
this.removeState("dragging");
}
}
setXResizing(flag) {
if (flag) {
this.addState("x-resizing");
} else {
this.removeState("x-resizing");
}
}
setYResizing(flag) {
if (flag) {
this.addState("y-resizing");
} else {
this.removeState("y-resizing");
}
}
setCopy(flag) {
if (flag) {
this.addState("copy");
} else {
this.removeState("copy");
}
}
isCopy() {
return this.states.has("copy");
}
release() {
for (const state of this.states) {
this.removeState(state);
}
}
addState(state) {
if (!this.states.has(state)) {
this.states.add(state);
document.documentElement.classList.add(`mtc-cursor-${state}`);
}
}
removeState(state) {
if (this.states.has(state)) {
this.states.delete(state);
document.documentElement.classList.remove(`mtc-cursor-${state}`);
}
}
}
const cursor = new Cursor();
export { Cursor, cursor };
//# sourceMappingURL=cursor.js.map
{"version":3,"file":"cursor.js","sources":["../../src/cursor.ts"],"sourcesContent":["export class Cursor {\n\tprivate states = new Set<string>();\n\n\tsetDragging(flag: boolean) {\n\t\tif (flag) {\n\t\t\tthis.addState('dragging');\n\t\t} else {\n\t\t\tthis.removeState('dragging');\n\t\t}\n\t}\n\n\tsetXResizing(flag: boolean) {\n\t\tif (flag) {\n\t\t\tthis.addState('x-resizing');\n\t\t} else {\n\t\t\tthis.removeState('x-resizing');\n\t\t}\n\t}\n\n\tsetYResizing(flag: boolean) {\n\t\tif (flag) {\n\t\t\tthis.addState('y-resizing');\n\t\t} else {\n\t\t\tthis.removeState('y-resizing');\n\t\t}\n\t}\n\n\tsetCopy(flag: boolean) {\n\t\tif (flag) {\n\t\t\tthis.addState('copy');\n\t\t} else {\n\t\t\tthis.removeState('copy');\n\t\t}\n\t}\n\n\tisCopy() {\n\t\treturn this.states.has('copy');\n\t}\n\n\trelease() {\n\t\tfor (const state of this.states) {\n\t\t\tthis.removeState(state);\n\t\t}\n\t}\n\n\taddState(state: string) {\n\t\tif (!this.states.has(state)) {\n\t\t\tthis.states.add(state);\n\t\t\tdocument.documentElement.classList.add(`mtc-cursor-${state}`);\n\t\t}\n\t}\n\n\tprivate removeState(state: string) {\n\t\tif (this.states.has(state)) {\n\t\t\tthis.states.delete(state);\n\t\t\tdocument.documentElement.classList.remove(`mtc-cursor-${state}`);\n\t\t}\n\t}\n}\n\nexport const cursor = new Cursor();\n"],"names":[],"mappings":";AAAO,MAAM,MAAO,CAAA;AAAA,EACX,MAAA,uBAAa,GAAY,EAAA;AAAA,EAEjC,YAAY,IAAe,EAAA;AAC1B,IAAA,IAAI,IAAM,EAAA;AACT,MAAA,IAAA,CAAK,SAAS,UAAU,CAAA;AAAA,KAClB,MAAA;AACN,MAAA,IAAA,CAAK,YAAY,UAAU,CAAA;AAAA;AAC5B;AACD,EAEA,aAAa,IAAe,EAAA;AAC3B,IAAA,IAAI,IAAM,EAAA;AACT,MAAA,IAAA,CAAK,SAAS,YAAY,CAAA;AAAA,KACpB,MAAA;AACN,MAAA,IAAA,CAAK,YAAY,YAAY,CAAA;AAAA;AAC9B;AACD,EAEA,aAAa,IAAe,EAAA;AAC3B,IAAA,IAAI,IAAM,EAAA;AACT,MAAA,IAAA,CAAK,SAAS,YAAY,CAAA;AAAA,KACpB,MAAA;AACN,MAAA,IAAA,CAAK,YAAY,YAAY,CAAA;AAAA;AAC9B;AACD,EAEA,QAAQ,IAAe,EAAA;AACtB,IAAA,IAAI,IAAM,EAAA;AACT,MAAA,IAAA,CAAK,SAAS,MAAM,CAAA;AAAA,KACd,MAAA;AACN,MAAA,IAAA,CAAK,YAAY,MAAM,CAAA;AAAA;AACxB;AACD,EAEA,MAAS,GAAA;AACR,IAAO,OAAA,IAAA,CAAK,MAAO,CAAA,GAAA,CAAI,MAAM,CAAA;AAAA;AAC9B,EAEA,OAAU,GAAA;AACT,IAAW,KAAA,MAAA,KAAA,IAAS,KAAK,MAAQ,EAAA;AAChC,MAAA,IAAA,CAAK,YAAY,KAAK,CAAA;AAAA;AACvB;AACD,EAEA,SAAS,KAAe,EAAA;AACvB,IAAA,IAAI,CAAC,IAAA,CAAK,MAAO,CAAA,GAAA,CAAI,KAAK,CAAG,EAAA;AAC5B,MAAK,IAAA,CAAA,MAAA,CAAO,IAAI,KAAK,CAAA;AACrB,MAAA,QAAA,CAAS,eAAgB,CAAA,SAAA,CAAU,GAAI,CAAA,CAAA,WAAA,EAAc,KAAK,CAAE,CAAA,CAAA;AAAA;AAC7D;AACD,EAEQ,YAAY,KAAe,EAAA;AAClC,IAAA,IAAI,IAAK,CAAA,MAAA,CAAO,GAAI,CAAA,KAAK,CAAG,EAAA;AAC3B,MAAK,IAAA,CAAA,MAAA,CAAO,OAAO,KAAK,CAAA;AACxB,MAAA,QAAA,CAAS,eAAgB,CAAA,SAAA,CAAU,MAAO,CAAA,CAAA,WAAA,EAAc,KAAK,CAAE,CAAA,CAAA;AAAA;AAChE;AAEF;AAEa,MAAA,MAAA,GAAS,IAAI,MAAO;;;;"}
export declare function hasOwnProperty(obj: any, key: string | number | symbol): boolean;
"use strict";
const prototypeHasOwnProperty = Object.prototype.hasOwnProperty;
function hasOwnProperty(obj, key) {
return obj && prototypeHasOwnProperty.call(obj, key);
}
export { hasOwnProperty };
//# sourceMappingURL=has-own-property.js.map
{"version":3,"file":"has-own-property.js","sources":["../../src/has-own-property.ts"],"sourcesContent":["const prototypeHasOwnProperty = Object.prototype.hasOwnProperty;\nexport function hasOwnProperty(\n\tobj: any,\n\tkey: string | number | symbol\n): boolean {\n\treturn obj && prototypeHasOwnProperty.call(obj, key);\n}\n"],"names":[],"mappings":";AAAA,MAAM,uBAAA,GAA0B,OAAO,SAAU,CAAA,cAAA;AACjC,SAAA,cAAA,CACf,KACA,GACU,EAAA;AACV,EAAA,OAAO,GAAO,IAAA,uBAAA,CAAwB,IAAK,CAAA,GAAA,EAAK,GAAG,CAAA;AACpD;;;;"}
export * from './asset';
export * from './create-content';
export * from './create-defer';
export * from './create-icon';
export * from './has-own-property';
export * from './is-css-url';
export * from './is-es-module';
export * from './is-object';
export * from './is-plain-object';
export * from './is-plugin-event-name';
export * from './is-vue';
export * from './logger';
export * from './script';
export * from './shallow-equal';
export * from './svg-icon';
export * from './unique-id';
export * from './check-types';
export * from './is-element';
export * from './node-helper';
export * from './navtive-selection';
export * from './cursor';
export * from './is-form-event';
export * from './clone-deep';
export * from './misc';
export * from './is-px';
export * from './is-shaken';
export * from './build-components';
export * from './transaction-manager';
export { AssetLoader, StylePoint, assetBundle, assetItem, isAssetBundle, isAssetItem, mergeAssets } from './asset.js';
export { createContent } from './create-content.js';
export { createDefer } from './create-defer.js';
export { IconWrapper, createIcon } from './create-icon.js';
export { hasOwnProperty } from './has-own-property.js';
export { isCSSUrl } from './is-css-url.js';
export { isESModule } from './is-es-module.js';
export { isI18NObject, isObject } from './is-object.js';
export { isPlainObject } from './is-plain-object.js';
export { isPluginEventName } from './is-plugin-event-name.js';
export { isVueComponent } from './is-vue.js';
export { Logger, getLogger } from './logger.js';
export { evaluate, load } from './script.js';
export { shallowEqual } from './shallow-equal.js';
export { SVGIcon } from './svg-icon.js';
export { uniqueId } from './unique-id.js';
import './check-types/index.js';
export { isElement } from './is-element.js';
export { canClickNode, getClosestNode } from './node-helper.js';
export { nativeSelectionEnabled, setNativeSelection } from './navtive-selection.js';
export { Cursor, cursor } from './cursor.js';
export { isFormEvent } from './is-form-event.js';
export { cloneDeep } from './clone-deep.js';
export { shouldUseVariableSetter } from './misc.js';
export { isNumber, isPx, toPx } from './is-px.js';
export { isShaken } from './is-shaken.js';
export { accessLibrary, buildComponents, cached, findComponent, getSubComponent } from './build-components.js';
export { transactionManager } from './transaction-manager.js';
export { isDomText } from './check-types/is-dom-text.js';
export { isI18nData } from './check-types/is-i18n-data.js';
export { isJSExpression } from './check-types/is-jsexpression.js';
export { isJSSlot } from './check-types/is-jsslot.js';
export { isNodeSchema } from './check-types/is-node-schema.js';
export { isNode } from './check-types/is-node.js';
export { isTitleConfig } from './check-types/is-title-config.js';
export { isLocationData } from './check-types/is-location-data.js';
export { isDragNodeDataObject } from './check-types/is-drag-node-data-object.js';
export { isDragNodeObject } from './check-types/is-drag-node-object.js';
export { isProCodeComponentType } from './check-types/is-procode-component-type.js';
export { isMicrocodeComponentType } from './check-types/is-microcode-component-type.js';
export { isDragAnyObject } from './check-types/is-drag-any-object.js';
export { isLocationChildrenDetail } from './check-types/is-location-children-detail.js';
export { isCustomView } from './check-types/is-custom-view.js';
export { isSettingField } from './check-types/is-setting-field.js';
export { isDynamicSetter } from './check-types/is-dynamic-setter.js';
export { isSetterConfig } from './check-types/is-setter-config.js';
export { isActionContentObject } from './check-types/is-action-content-object.js';
export { isInnerJsFunction, isJSFunction } from './check-types/is-isfunction.js';
export { isBasicPropType } from './check-types/is-basic-prop-type.js';
export { isComponentSchema } from './check-types/is-component-schema.js';
export { isProjectSchema } from './check-types/is-project-schema.js';
export { isRequiredPropType } from './check-types/is-required-prop-type.js';
"use strict";
//# sourceMappingURL=index.js.map
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
export declare function isCSSUrl(url: string): boolean;
"use strict";
function isCSSUrl(url) {
return /\.css(\?.*)?$/.test(url);
}
export { isCSSUrl };
//# sourceMappingURL=is-css-url.js.map
{"version":3,"file":"is-css-url.js","sources":["../../src/is-css-url.ts"],"sourcesContent":["export function isCSSUrl(url: string): boolean {\n\treturn /\\.css(\\?.*)?$/.test(url);\n}\n"],"names":[],"mappings":";AAAO,SAAS,SAAS,GAAsB,EAAA;AAC9C,EAAO,OAAA,eAAA,CAAgB,KAAK,GAAG,CAAA;AAChC;;;;"}
export declare function isElement(node: any): node is Element;
"use strict";
function isElement(node) {
if (!node) return false;
return node.nodeType === Node.ELEMENT_NODE;
}
export { isElement };
//# sourceMappingURL=is-element.js.map
{"version":3,"file":"is-element.js","sources":["../../src/is-element.ts"],"sourcesContent":["export function isElement(node: any): node is Element {\n\tif (!node) return false;\n\treturn node.nodeType === Node.ELEMENT_NODE;\n}\n"],"names":[],"mappings":";AAAO,SAAS,UAAU,IAA4B,EAAA;AACrD,EAAI,IAAA,CAAC,MAAa,OAAA,KAAA;AAClB,EAAO,OAAA,IAAA,CAAK,aAAa,IAAK,CAAA,YAAA;AAC/B;;;;"}
export type ESModule = {
__esModule: true;
default: any;
};
export declare function isESModule(obj: any): obj is ESModule;
"use strict";
function isESModule(obj) {
return obj && obj.__esModule;
}
export { isESModule };
//# sourceMappingURL=is-es-module.js.map
{"version":3,"file":"is-es-module.js","sources":["../../src/is-es-module.ts"],"sourcesContent":["export type ESModule = {\n\t__esModule: true;\n\tdefault: any;\n};\nexport function isESModule(obj: any): obj is ESModule {\n\treturn obj && obj.__esModule;\n}\n"],"names":[],"mappings":";AAIO,SAAS,WAAW,GAA2B,EAAA;AACrD,EAAA,OAAO,OAAO,GAAI,CAAA,UAAA;AACnB;;;;"}
/**
* 判断事件是否来自表单元素
* @param e 键盘事件或鼠标事件
* @returns 如果事件来自表单元素返回true,否则返回false
*/
export declare function isFormEvent(e: KeyboardEvent | MouseEvent): boolean;
"use strict";
function isFormEvent(e) {
const t = e.target;
if (!t) {
return false;
}
if (t.form || /^(INPUT|SELECT|TEXTAREA)$/.test(t.tagName)) {
return true;
}
if (t instanceof HTMLElement && /write/.test(
window.getComputedStyle(t).getPropertyValue("-webkit-user-modify")
)) {
return true;
}
return false;
}
export { isFormEvent };
//# sourceMappingURL=is-form-event.js.map
{"version":3,"file":"is-form-event.js","sources":["../../src/is-form-event.ts"],"sourcesContent":["/**\n * 判断事件是否来自表单元素\n * @param e 键盘事件或鼠标事件\n * @returns 如果事件来自表单元素返回true,否则返回false\n */\nexport function isFormEvent(e: KeyboardEvent | MouseEvent) {\n\t// 获取事件目标元素并转换为表单元素类型\n\tconst t = e.target as HTMLFormElement;\n\tif (!t) {\n\t\treturn false;\n\t}\n\n\t// 检查是否为表单元素或表单相关的输入元素\n\tif (t.form || /^(INPUT|SELECT|TEXTAREA)$/.test(t.tagName)) {\n\t\treturn true;\n\t}\n\n\t// 检查元素是否可编辑(通过webkit用户修改样式属性)\n\tif (\n\t\tt instanceof HTMLElement &&\n\t\t/write/.test(\n\t\t\twindow.getComputedStyle(t).getPropertyValue('-webkit-user-modify')\n\t\t)\n\t) {\n\t\treturn true;\n\t}\n\treturn false;\n}\n"],"names":[],"mappings":";AAKO,SAAS,YAAY,CAA+B,EAAA;AAE1D,EAAA,MAAM,IAAI,CAAE,CAAA,MAAA;AACZ,EAAA,IAAI,CAAC,CAAG,EAAA;AACP,IAAO,OAAA,KAAA;AAAA;AAIR,EAAA,IAAI,EAAE,IAAQ,IAAA,2BAAA,CAA4B,IAAK,CAAA,CAAA,CAAE,OAAO,CAAG,EAAA;AAC1D,IAAO,OAAA,IAAA;AAAA;AAIR,EACC,IAAA,CAAA,YAAa,eACb,OAAQ,CAAA,IAAA;AAAA,IACP,MAAO,CAAA,gBAAA,CAAiB,CAAC,CAAA,CAAE,iBAAiB,qBAAqB;AAAA,GAEjE,EAAA;AACD,IAAO,OAAA,IAAA;AAAA;AAER,EAAO,OAAA,KAAA;AACR;;;;"}
export declare function isObject(value: any): value is Record<string, any>;
export declare function isI18NObject(value: any): boolean;
"use strict";
function isObject(value) {
return value !== null && typeof value === "object";
}
function isI18NObject(value) {
return isObject(value) && value.type === "i18n";
}
export { isI18NObject, isObject };
//# sourceMappingURL=is-object.js.map
{"version":3,"file":"is-object.js","sources":["../../src/is-object.ts"],"sourcesContent":["export function isObject(value: any): value is Record<string, any> {\n\treturn value !== null && typeof value === 'object';\n}\n\nexport function isI18NObject(value: any): boolean {\n\treturn isObject(value) && value.type === 'i18n';\n}\n"],"names":[],"mappings":";AAAO,SAAS,SAAS,KAA0C,EAAA;AAClE,EAAO,OAAA,KAAA,KAAU,IAAQ,IAAA,OAAO,KAAU,KAAA,QAAA;AAC3C;AAEO,SAAS,aAAa,KAAqB,EAAA;AACjD,EAAA,OAAO,QAAS,CAAA,KAAK,CAAK,IAAA,KAAA,CAAM,IAAS,KAAA,MAAA;AAC1C;;;;"}
/**
* isPlainObject 函数的主要作用是检查一个值是否为纯对象。
* 这在 JavaScript 中很有用,因为不是所有的对象都是通过 {} 或 Object 创建的,
* 有些对象可能是通过构造函数、类或其他方式创建的,具有不同的原型链。
* 这个函数帮助确保对象是标准的、没有定制原型的对象。
*
* @param value
* @returns
*/
export declare function isPlainObject(value: any): value is any;
import { isObject } from './is-object.js';
"use strict";
function isPlainObject(value) {
if (!isObject(value)) {
return false;
}
const proto = Object.getPrototypeOf(value);
return proto === Object.prototype || proto === null || Object.getPrototypeOf(proto) === null;
}
export { isPlainObject };
//# sourceMappingURL=is-plain-object.js.map
{"version":3,"file":"is-plain-object.js","sources":["../../src/is-plain-object.ts"],"sourcesContent":["import { isObject } from './is-object';\n\n/**\n * isPlainObject 函数的主要作用是检查一个值是否为纯对象。\n * 这在 JavaScript 中很有用,因为不是所有的对象都是通过 {} 或 Object 创建的,\n * 有些对象可能是通过构造函数、类或其他方式创建的,具有不同的原型链。\n * 这个函数帮助确保对象是标准的、没有定制原型的对象。\n *\n * @param value\n * @returns\n */\nexport function isPlainObject(value: any): value is any {\n\tif (!isObject(value)) {\n\t\treturn false;\n\t}\n\tconst proto = Object.getPrototypeOf(value);\n\treturn (\n\t\tproto === Object.prototype ||\n\t\tproto === null ||\n\t\tObject.getPrototypeOf(proto) === null\n\t);\n}\n"],"names":[],"mappings":";;;AAWO,SAAS,cAAc,KAA0B,EAAA;AACvD,EAAI,IAAA,CAAC,QAAS,CAAA,KAAK,CAAG,EAAA;AACrB,IAAO,OAAA,KAAA;AAAA;AAER,EAAM,MAAA,KAAA,GAAQ,MAAO,CAAA,cAAA,CAAe,KAAK,CAAA;AACzC,EACC,OAAA,KAAA,KAAU,OAAO,SACjB,IAAA,KAAA,KAAU,QACV,MAAO,CAAA,cAAA,CAAe,KAAK,CAAM,KAAA,IAAA;AAEnC;;;;"}
/**
* 该函数用于判断一个事件名称是否具有插件事件的格式(通过冒号区分的多段命名)
*
* @param eventName
* @returns
*/
export declare function isPluginEventName(eventName: string): boolean;
"use strict";
function isPluginEventName(eventName) {
if (!eventName) {
return false;
}
const eventSegments = eventName.split(":");
return eventSegments.length > 1 && eventSegments[0].length > 0;
}
export { isPluginEventName };
//# sourceMappingURL=is-plugin-event-name.js.map
{"version":3,"file":"is-plugin-event-name.js","sources":["../../src/is-plugin-event-name.ts"],"sourcesContent":["/**\n * 该函数用于判断一个事件名称是否具有插件事件的格式(通过冒号区分的多段命名)\n *\n * @param eventName\n * @returns\n */\nexport function isPluginEventName(eventName: string): boolean {\n\tif (!eventName) {\n\t\treturn false;\n\t}\n\n\tconst eventSegments = eventName.split(':');\n\treturn eventSegments.length > 1 && eventSegments[0].length > 0;\n}\n"],"names":[],"mappings":";AAMO,SAAS,kBAAkB,SAA4B,EAAA;AAC7D,EAAA,IAAI,CAAC,SAAW,EAAA;AACf,IAAO,OAAA,KAAA;AAAA;AAGR,EAAM,MAAA,aAAA,GAAgB,SAAU,CAAA,KAAA,CAAM,GAAG,CAAA;AACzC,EAAA,OAAO,cAAc,MAAS,GAAA,CAAA,IAAK,aAAc,CAAA,CAAC,EAAE,MAAS,GAAA,CAAA;AAC9D;;;;"}
export declare function isPx(value: any): boolean;
export declare function isNumber(value: any): boolean;
export declare function toPx(value: any): any;
import { isNaN } from 'lodash-es';
"use strict";
function isPx(value) {
return typeof value === "string" && /px$/i.test(value);
}
function isNumber(value) {
return typeof value === "number" || !isNaN(Number(value)) && !value.includes("px");
}
function toPx(value) {
if (typeof value === "number") {
return `${value}px`;
}
if (isPx(value)) {
return value;
}
if (typeof value === "string" && !isNaN(Number(value))) {
return `${value}px`;
}
throw new Error("Value must be a number or px string");
}
export { isNumber, isPx, toPx };
//# sourceMappingURL=is-px.js.map
{"version":3,"file":"is-px.js","sources":["../../src/is-px.ts"],"sourcesContent":["import { isNaN } from 'lodash-es';\n\nexport function isPx(value: any) {\n\treturn typeof value === 'string' && /px$/i.test(value);\n}\n\nexport function isNumber(value: any) {\n\treturn (\n\t\ttypeof value === 'number' ||\n\t\t(!isNaN(Number(value)) && !value.includes('px'))\n\t);\n}\n\nexport function toPx(value: any) {\n\tif (typeof value === 'number') {\n\t\treturn `${value}px`;\n\t}\n\tif (isPx(value)) {\n\t\treturn value;\n\t}\n\t// 判断是否为数字字符串\n\tif (typeof value === 'string' && !isNaN(Number(value))) {\n\t\treturn `${value}px`;\n\t}\n\tthrow new Error('Value must be a number or px string');\n}\n"],"names":[],"mappings":";;;AAEO,SAAS,KAAK,KAAY,EAAA;AAChC,EAAA,OAAO,OAAO,KAAA,KAAU,QAAY,IAAA,MAAA,CAAO,KAAK,KAAK,CAAA;AACtD;AAEO,SAAS,SAAS,KAAY,EAAA;AACpC,EAAA,OACC,OAAO,KAAA,KAAU,QAChB,IAAA,CAAC,KAAM,CAAA,MAAA,CAAO,KAAK,CAAC,CAAK,IAAA,CAAC,KAAM,CAAA,QAAA,CAAS,IAAI,CAAA;AAEhD;AAEO,SAAS,KAAK,KAAY,EAAA;AAChC,EAAI,IAAA,OAAO,UAAU,QAAU,EAAA;AAC9B,IAAA,OAAO,GAAG,KAAK,CAAA,EAAA,CAAA;AAAA;AAEhB,EAAI,IAAA,IAAA,CAAK,KAAK,CAAG,EAAA;AAChB,IAAO,OAAA,KAAA;AAAA;AAGR,EAAI,IAAA,OAAO,UAAU,QAAY,IAAA,CAAC,MAAM,MAAO,CAAA,KAAK,CAAC,CAAG,EAAA;AACvD,IAAA,OAAO,GAAG,KAAK,CAAA,EAAA,CAAA;AAAA;AAEhB,EAAM,MAAA,IAAI,MAAM,qCAAqC,CAAA;AACtD;;;;"}
/**
* mouse shake check
*/
export declare function isShaken(e1: MouseEvent | DragEvent, e2: MouseEvent | DragEvent): boolean;
"use strict";
const SHAKE_DISTANCE = 4;
function isShaken(e1, e2) {
if (e1.shaken) {
return true;
}
if (e1.target !== e2.target) {
return true;
}
return (e1.clientY - e2.clientY) ** 2 + (e1.clientX - e2.clientX) ** 2 > SHAKE_DISTANCE;
}
export { isShaken };
//# sourceMappingURL=is-shaken.js.map
{"version":3,"file":"is-shaken.js","sources":["../../src/is-shaken.ts"],"sourcesContent":["const SHAKE_DISTANCE = 4;\n/**\n * mouse shake check\n */\nexport function isShaken(\n\te1: MouseEvent | DragEvent,\n\te2: MouseEvent | DragEvent\n): boolean {\n\tif ((e1 as any).shaken) {\n\t\treturn true;\n\t}\n\tif (e1.target !== e2.target) {\n\t\treturn true;\n\t}\n\treturn (\n\t\t(e1.clientY - e2.clientY) ** 2 + (e1.clientX - e2.clientX) ** 2 >\n\t\tSHAKE_DISTANCE\n\t);\n}\n"],"names":[],"mappings":";AAAA,MAAM,cAAiB,GAAA,CAAA;AAIP,SAAA,QAAA,CACf,IACA,EACU,EAAA;AACV,EAAA,IAAK,GAAW,MAAQ,EAAA;AACvB,IAAO,OAAA,IAAA;AAAA;AAER,EAAI,IAAA,EAAA,CAAG,MAAW,KAAA,EAAA,CAAG,MAAQ,EAAA;AAC5B,IAAO,OAAA,IAAA;AAAA;AAER,EACE,OAAA,CAAA,EAAA,CAAG,UAAU,EAAG,CAAA,OAAA,KAAY,KAAK,EAAG,CAAA,OAAA,GAAU,EAAG,CAAA,OAAA,KAAY,CAC9D,GAAA,cAAA;AAEF;;;;"}
import { Component } from 'vue';
/**
* 判断是否是组件
*
* @param component
* @returns
*/
export declare function isVueComponent(component: any): component is Component;
"use strict";
function isVueComponent(component) {
if (typeof component === "object" && component !== null) {
const options = component;
if (typeof options.render === "function" || typeof options.setup === "function") {
return true;
}
}
if (typeof component === "object" && component !== null && "__vccOpts" in component) {
return true;
}
return false;
}
export { isVueComponent };
//# sourceMappingURL=is-vue.js.map
{"version":3,"file":"is-vue.js","sources":["../../src/is-vue.ts"],"sourcesContent":["import { ComponentOptions, Component } from 'vue';\n\n/**\n * 判断是否是组件\n *\n * @param component\n * @returns\n */\nexport function isVueComponent(component: any): component is Component {\n\tif (typeof component === 'object' && component !== null) {\n\t\tconst options = component as ComponentOptions;\n\t\tif (\n\t\t\ttypeof options.render === 'function' ||\n\t\t\ttypeof options.setup === 'function'\n\t\t) {\n\t\t\treturn true; // 是 SFC 组件\n\t\t}\n\t}\n\tif (\n\t\ttypeof component === 'object' &&\n\t\tcomponent !== null &&\n\t\t'__vccOpts' in component\n\t) {\n\t\treturn true; // 是 Vue JSX 组件\n\t}\n\n\treturn false; // 不是任何组件\n}\n"],"names":[],"mappings":";AAQO,SAAS,eAAe,SAAwC,EAAA;AACtE,EAAA,IAAI,OAAO,SAAA,KAAc,QAAY,IAAA,SAAA,KAAc,IAAM,EAAA;AACxD,IAAA,MAAM,OAAU,GAAA,SAAA;AAChB,IAAA,IACC,OAAO,OAAQ,CAAA,MAAA,KAAW,cAC1B,OAAO,OAAA,CAAQ,UAAU,UACxB,EAAA;AACD,MAAO,OAAA,IAAA;AAAA;AACR;AAED,EAAA,IACC,OAAO,SAAc,KAAA,QAAA,IACrB,SAAc,KAAA,IAAA,IACd,eAAe,SACd,EAAA;AACD,IAAO,OAAA,IAAA;AAAA;AAGR,EAAO,OAAA,KAAA;AACR;;;;"}
export type Level = 'debug' | 'log' | 'info' | 'warn' | 'error';
interface Options {
level: Level;
bizName: string;
}
declare class Logger {
bizName: string;
targetBizName: string;
targetLevel: string;
constructor(options: Options);
debug(...args: any[]): void;
log(...args: any[]): void;
info(...args: any[]): void;
warn(...args: any[]): void;
error(...args: any[]): void;
}
export { Logger };
export declare function getLogger(config: {
level: Level;
bizName: string;
}): Logger;
import { isObject } from './is-object.js';
"use strict";
const levels = {
debug: -1,
log: 0,
info: 0,
warn: 1,
error: 2
};
const bizNameColors = [
"#daa569",
"#00ffff",
"#385e0f",
"#7fffd4",
"#00c957",
"#b0e0e6",
"#4169e1",
"#6a5acd",
"#87ceeb",
"#ffff00",
"#e3cf57",
"#ff9912",
"#eb8e55",
"#ffe384",
"#40e0d0",
"#a39480",
"#d2691e",
"#ff7d40",
"#f0e68c",
"#bc8f8f",
"#c76114",
"#734a12",
"#5e2612",
"#0000ff",
"#3d59ab",
"#1e90ff",
"#03a89e",
"#33a1c9",
"#a020f0",
"#a066d3",
"#da70d6",
"#dda0dd",
"#688e23",
"#2e8b57"
];
const bodyColors = {
debug: "#fadb14",
log: "#8c8c8c",
info: "#52c41a",
warn: "#fa8c16",
error: "#ff4d4f"
};
const levelMarks = {
debug: "debug",
log: "log",
info: "info",
warn: "warn",
error: "error"
};
const outputFunction = {
debug: console.log,
log: console.log,
info: console.log,
warn: console.warn,
error: console.error
};
const bizNameColorConfig = {};
const shouldOutput = (logLevel, targetLevel = "warn", bizName, targetBizName) => {
const isLevelFit = levels[targetLevel] <= levels[logLevel];
const isBizNameFit = targetBizName === "*" || bizName.indexOf(targetBizName) > -1;
return isLevelFit && isBizNameFit;
};
const output = (logLevel, bizName) => (...args) => outputFunction[logLevel]?.apply(
console,
getLogArgs(args, bizName, logLevel)
);
const getColor = (bizName) => {
if (!bizNameColorConfig[bizName]) {
const color = bizNameColors[Object.keys(bizNameColorConfig).length % bizNameColors.length];
bizNameColorConfig[bizName] = color;
}
return bizNameColorConfig[bizName];
};
const getLogArgs = (args, bizName, logLevel) => {
const color = getColor(bizName);
const bodyColor = bodyColors[logLevel];
const argsArray = args[0];
let prefix = `%c[${bizName}]%c[${levelMarks[logLevel]}]:`;
argsArray.forEach((arg) => {
if (isObject(arg)) {
prefix += "%o";
} else {
prefix += "%s";
}
});
let processedArgs = [prefix, `color: ${color}`, `color: ${bodyColor}`];
processedArgs = processedArgs.concat(argsArray);
return processedArgs;
};
const parseLogConf = (logConf, options) => {
if (!logConf) {
return {
level: options.level,
bizName: options.bizName
};
}
if (logConf.indexOf(":") > -1) {
const pair = logConf.split(":");
return {
level: pair[0],
bizName: pair[1] || "*"
};
}
return {
level: logConf,
bizName: "*"
};
};
const defaultOptions = {
level: "warn",
bizName: "*"
};
class Logger {
bizName;
targetBizName;
targetLevel;
constructor(options) {
options = { ...defaultOptions, ...options };
const _location = location || {};
const logConf = (/__(?:logConf|logLevel)__=([^#/&]*)/.exec(
_location.href
) || [])[1];
const targetOptions = parseLogConf(logConf, options);
this.bizName = options.bizName;
this.targetBizName = targetOptions.bizName;
this.targetLevel = targetOptions.level;
}
debug(...args) {
if (!shouldOutput("debug", this.targetLevel, this.bizName, this.targetBizName)) {
return;
}
return output("debug", this.bizName)(args);
}
log(...args) {
if (!shouldOutput("log", this.targetLevel, this.bizName, this.targetBizName)) {
return;
}
return output("log", this.bizName)(args);
}
info(...args) {
if (!shouldOutput("info", this.targetLevel, this.bizName, this.targetBizName)) {
return;
}
return output("info", this.bizName)(args);
}
warn(...args) {
if (!shouldOutput("warn", this.targetLevel, this.bizName, this.targetBizName)) {
return;
}
return output("warn", this.bizName)(args);
}
error(...args) {
if (!shouldOutput("error", this.targetLevel, this.bizName, this.targetBizName)) {
return;
}
return output("error", this.bizName)(args);
}
}
function getLogger(config) {
return new Logger(config);
}
export { Logger, getLogger };
//# sourceMappingURL=logger.js.map
{"version":3,"file":"logger.js","sources":["../../src/logger.ts"],"sourcesContent":["/* eslint-disable no-console */\nimport { isObject } from './is-object';\n\nexport type Level = 'debug' | 'log' | 'info' | 'warn' | 'error';\ninterface Options {\n\tlevel: Level;\n\tbizName: string;\n}\n\nconst levels: Record<string, number> = {\n\tdebug: -1,\n\tlog: 0,\n\tinfo: 0,\n\twarn: 1,\n\terror: 2,\n};\nconst bizNameColors = [\n\t'#daa569',\n\t'#00ffff',\n\t'#385e0f',\n\t'#7fffd4',\n\t'#00c957',\n\t'#b0e0e6',\n\t'#4169e1',\n\t'#6a5acd',\n\t'#87ceeb',\n\t'#ffff00',\n\t'#e3cf57',\n\t'#ff9912',\n\t'#eb8e55',\n\t'#ffe384',\n\t'#40e0d0',\n\t'#a39480',\n\t'#d2691e',\n\t'#ff7d40',\n\t'#f0e68c',\n\t'#bc8f8f',\n\t'#c76114',\n\t'#734a12',\n\t'#5e2612',\n\t'#0000ff',\n\t'#3d59ab',\n\t'#1e90ff',\n\t'#03a89e',\n\t'#33a1c9',\n\t'#a020f0',\n\t'#a066d3',\n\t'#da70d6',\n\t'#dda0dd',\n\t'#688e23',\n\t'#2e8b57',\n];\nconst bodyColors: Record<string, string> = {\n\tdebug: '#fadb14',\n\tlog: '#8c8c8c',\n\tinfo: '#52c41a',\n\twarn: '#fa8c16',\n\terror: '#ff4d4f',\n};\nconst levelMarks: Record<string, string> = {\n\tdebug: 'debug',\n\tlog: 'log',\n\tinfo: 'info',\n\twarn: 'warn',\n\terror: 'error',\n};\nconst outputFunction: Record<string, any> = {\n\tdebug: console.log,\n\tlog: console.log,\n\tinfo: console.log,\n\twarn: console.warn,\n\terror: console.error,\n};\n\nconst bizNameColorConfig: Record<string, string> = {};\n\nconst shouldOutput = (\n\tlogLevel: string,\n\ttargetLevel: string = 'warn',\n\tbizName: string,\n\ttargetBizName: string\n): boolean => {\n\tconst isLevelFit = (levels as any)[targetLevel] <= (levels as any)[logLevel];\n\tconst isBizNameFit =\n\t\ttargetBizName === '*' || bizName.indexOf(targetBizName) > -1;\n\treturn isLevelFit && isBizNameFit;\n};\n\nconst output =\n\t(logLevel: string, bizName: string) =>\n\t(...args: any[]) =>\n\t\toutputFunction[logLevel]?.apply(\n\t\t\tconsole,\n\t\t\tgetLogArgs(args, bizName, logLevel)\n\t\t);\n\nconst getColor = (bizName: string) => {\n\tif (!bizNameColorConfig[bizName]) {\n\t\tconst color =\n\t\t\tbizNameColors[\n\t\t\t\tObject.keys(bizNameColorConfig).length % bizNameColors.length\n\t\t\t];\n\t\tbizNameColorConfig[bizName] = color;\n\t}\n\treturn bizNameColorConfig[bizName];\n};\n\nconst getLogArgs = (args: any, bizName: string, logLevel: string) => {\n\tconst color = getColor(bizName);\n\tconst bodyColor = bodyColors[logLevel];\n\n\tconst argsArray = args[0];\n\tlet prefix = `%c[${bizName}]%c[${levelMarks[logLevel]}]:`;\n\targsArray.forEach((arg: any) => {\n\t\tif (isObject(arg)) {\n\t\t\tprefix += '%o';\n\t\t} else {\n\t\t\tprefix += '%s';\n\t\t}\n\t});\n\tlet processedArgs = [prefix, `color: ${color}`, `color: ${bodyColor}`];\n\tprocessedArgs = processedArgs.concat(argsArray);\n\treturn processedArgs;\n};\nconst parseLogConf = (\n\tlogConf: string,\n\toptions: Options\n): { level: string; bizName: string } => {\n\tif (!logConf) {\n\t\treturn {\n\t\t\tlevel: options.level,\n\t\t\tbizName: options.bizName,\n\t\t};\n\t}\n\tif (logConf.indexOf(':') > -1) {\n\t\tconst pair = logConf.split(':');\n\t\treturn {\n\t\t\tlevel: pair[0],\n\t\t\tbizName: pair[1] || '*',\n\t\t};\n\t}\n\treturn {\n\t\tlevel: logConf,\n\t\tbizName: '*',\n\t};\n};\n\nconst defaultOptions: Options = {\n\tlevel: 'warn',\n\tbizName: '*',\n};\n\nclass Logger {\n\tbizName: string;\n\n\ttargetBizName: string;\n\n\ttargetLevel: string;\n\n\tconstructor(options: Options) {\n\t\toptions = { ...defaultOptions, ...options };\n\t\t// eslint-disable-next-line no-restricted-globals\n\t\tconst _location = location || ({} as any);\n\t\t// __logConf__ 格式为 logLevel[:bizName], bizName is used as: targetBizName like '%bizName%'\n\t\t// 1. __logConf__=log or __logConf__=warn, etc.\n\t\t// 2. __logConf__=log:* or __logConf__=warn:*, etc.\n\t\t// 2. __logConf__=log:bizName or __logConf__=warn:partOfBizName, etc.\n\t\tconst logConf = (/__(?:logConf|logLevel)__=([^#/&]*)/.exec(\n\t\t\t_location.href\n\t\t) || [])[1];\n\t\tconst targetOptions = parseLogConf(logConf, options);\n\t\tthis.bizName = options.bizName;\n\t\tthis.targetBizName = targetOptions.bizName;\n\t\tthis.targetLevel = targetOptions.level;\n\t}\n\n\tdebug(...args: any[]): void {\n\t\tif (\n\t\t\t!shouldOutput('debug', this.targetLevel, this.bizName, this.targetBizName)\n\t\t) {\n\t\t\treturn;\n\t\t}\n\t\treturn output('debug', this.bizName)(args);\n\t}\n\n\tlog(...args: any[]): void {\n\t\tif (\n\t\t\t!shouldOutput('log', this.targetLevel, this.bizName, this.targetBizName)\n\t\t) {\n\t\t\treturn;\n\t\t}\n\t\treturn output('log', this.bizName)(args);\n\t}\n\n\tinfo(...args: any[]): void {\n\t\tif (\n\t\t\t!shouldOutput('info', this.targetLevel, this.bizName, this.targetBizName)\n\t\t) {\n\t\t\treturn;\n\t\t}\n\t\treturn output('info', this.bizName)(args);\n\t}\n\n\twarn(...args: any[]): void {\n\t\tif (\n\t\t\t!shouldOutput('warn', this.targetLevel, this.bizName, this.targetBizName)\n\t\t) {\n\t\t\treturn;\n\t\t}\n\t\treturn output('warn', this.bizName)(args);\n\t}\n\n\terror(...args: any[]): void {\n\t\tif (\n\t\t\t!shouldOutput('error', this.targetLevel, this.bizName, this.targetBizName)\n\t\t) {\n\t\t\treturn;\n\t\t}\n\t\treturn output('error', this.bizName)(args);\n\t}\n}\n\nexport { Logger };\n\nexport function getLogger(config: { level: Level; bizName: string }): Logger {\n\treturn new Logger(config);\n}\n"],"names":[],"mappings":";;;AASA,MAAM,MAAiC,GAAA;AAAA,EACtC,KAAO,EAAA,CAAA,CAAA;AAAA,EACP,GAAK,EAAA,CAAA;AAAA,EACL,IAAM,EAAA,CAAA;AAAA,EACN,IAAM,EAAA,CAAA;AAAA,EACN,KAAO,EAAA;AACR,CAAA;AACA,MAAM,aAAgB,GAAA;AAAA,EACrB,SAAA;AAAA,EACA,SAAA;AAAA,EACA,SAAA;AAAA,EACA,SAAA;AAAA,EACA,SAAA;AAAA,EACA,SAAA;AAAA,EACA,SAAA;AAAA,EACA,SAAA;AAAA,EACA,SAAA;AAAA,EACA,SAAA;AAAA,EACA,SAAA;AAAA,EACA,SAAA;AAAA,EACA,SAAA;AAAA,EACA,SAAA;AAAA,EACA,SAAA;AAAA,EACA,SAAA;AAAA,EACA,SAAA;AAAA,EACA,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AO,OAAA,IAAI,OAAO,MAAM,CAAA;AACzB;;;;"}
/**
* 属性级别的 supportVariable 应该优先于全局的 supportVariable
* @param propSupportVariable 属性级别的 supportVariable
* @param globalSupportVariable 全局的 supportVariable
* @returns 是否应该使用变量设置器
*/
export declare function shouldUseVariableSetter(propSupportVariable: boolean | undefined, globalSupportVariable: boolean): boolean;
"use strict";
function shouldUseVariableSetter(propSupportVariable, globalSupportVariable) {
if (propSupportVariable === false) return false;
return propSupportVariable || globalSupportVariable;
}
export { shouldUseVariableSetter };
//# sourceMappingURL=misc.js.map
{"version":3,"file":"misc.js","sources":["../../src/misc.ts"],"sourcesContent":["/**\n * 属性级别的 supportVariable 应该优先于全局的 supportVariable\n * @param propSupportVariable 属性级别的 supportVariable\n * @param globalSupportVariable 全局的 supportVariable\n * @returns 是否应该使用变量设置器\n */\nexport function shouldUseVariableSetter(\n\tpropSupportVariable: boolean | undefined,\n\tglobalSupportVariable: boolean\n) {\n\tif (propSupportVariable === false) return false;\n\treturn propSupportVariable || globalSupportVariable;\n}\n"],"names":[],"mappings":";AAMgB,SAAA,uBAAA,CACf,qBACA,qBACC,EAAA;AACD,EAAI,IAAA,mBAAA,KAAwB,OAAc,OAAA,KAAA;AAC1C,EAAA,OAAO,mBAAuB,IAAA,qBAAA;AAC/B;;;;"}
/**
* 控制是否允许原生选择的标志
*/
export declare let nativeSelectionEnabled: boolean;
/**
* 设置是否允许原生选择
* @param enableFlag 是否允许选择的标志
*/
export declare function setNativeSelection(enableFlag: boolean): void;
"use strict";
let nativeSelectionEnabled = true;
const preventSelection = (e) => {
if (nativeSelectionEnabled) {
return null;
}
e.preventDefault();
e.stopPropagation();
return false;
};
document.addEventListener("selectstart", preventSelection, true);
document.addEventListener("dragstart", preventSelection, true);
function setNativeSelection(enableFlag) {
nativeSelectionEnabled = enableFlag;
}
export { nativeSelectionEnabled, setNativeSelection };
//# sourceMappingURL=navtive-selection.js.map
{"version":3,"file":"navtive-selection.js","sources":["../../src/navtive-selection.ts"],"sourcesContent":["/**\n * 控制是否允许原生选择的标志\n */\n// eslint-disable-next-line import/no-mutable-exports\nexport let nativeSelectionEnabled = true;\n\n/**\n * 阻止原生选择事件的处理函数\n * @param e 事件对象\n * @returns null 或 false\n */\nconst preventSelection = (e: Event) => {\n\tif (nativeSelectionEnabled) {\n\t\treturn null;\n\t}\n\te.preventDefault();\n\te.stopPropagation();\n\treturn false;\n};\n\n// 监听文本选择事件\ndocument.addEventListener('selectstart', preventSelection, true);\n// 监听拖拽事件\ndocument.addEventListener('dragstart', preventSelection, true);\n\n/**\n * 设置是否允许原生选择\n * @param enableFlag 是否允许选择的标志\n */\nexport function setNativeSelection(enableFlag: boolean) {\n\tnativeSelectionEnabled = enableFlag;\n}\n"],"names":[],"mappings":";AAIO,IAAI,sBAAyB,GAAA;AAOpC,MAAM,gBAAA,GAAmB,CAAC,CAAa,KAAA;AACtC,EAAA,IAAI,sBAAwB,EAAA;AAC3B,IAAO,OAAA,IAAA;AAAA;AAER,EAAA,CAAA,CAAE,cAAe,EAAA;AACjB,EAAA,CAAA,CAAE,eAAgB,EAAA;AAClB,EAAO,OAAA,KAAA;AACR,CAAA;AAGA,QAAS,CAAA,gBAAA,CAAiB,aAAe,EAAA,gBAAA,EAAkB,IAAI,CAAA;AAE/D,QAAS,CAAA,gBAAA,CAAiB,WAAa,EAAA,gBAAA,EAAkB,IAAI,CAAA;AAMtD,SAAS,mBAAmB,UAAqB,EAAA;AACvD,EAAyB,sBAAA,GAAA,UAAA;AAC1B;;;;"}
import { IPublicModelNode } from '@arvin-shu/microcode-types';
/**
* 获取最近的满足条件的父节点
* @param Node 节点类型,继承自IPublicModelNode
* @returns 返回最近的满足条件的父节点,如果没有找到返回undefined
*/
export declare const getClosestNode: <Node extends IPublicModelNode = IPublicModelNode>(node: Node, until: (n: Node) => boolean) => Node | undefined;
/**
* 判断节点是否可被点击
* @param {Node} node 节点
* @param {unknown} e 点击事件
* @returns {boolean} 是否可点击,true表示可点击
*/
export declare function canClickNode<Node extends IPublicModelNode = IPublicModelNode>(node: Node, e: MouseEvent): boolean;
"use strict";
const getClosestNode = (node, until) => {
if (!node) {
return void 0;
}
if (until(node)) {
return node;
}
return getClosestNode(node.parent, until);
};
function canClickNode(node, e) {
const onClickHook = node.componentMeta?.advanced?.callbacks?.onClickHook;
const canClick = typeof onClickHook === "function" ? onClickHook(e, node) : true;
return canClick;
}
export { canClickNode, getClosestNode };
//# sourceMappingURL=node-helper.js.map
{"version":3,"file":"node-helper.js","sources":["../../src/node-helper.ts"],"sourcesContent":["import { IPublicModelNode } from '@arvin-shu/microcode-types';\n\n/**\n * 获取最近的满足条件的父节点\n * @param Node 节点类型,继承自IPublicModelNode\n * @returns 返回最近的满足条件的父节点,如果没有找到返回undefined\n */\nexport const getClosestNode = <\n\tNode extends IPublicModelNode = IPublicModelNode,\n>(\n\tnode: Node,\n\tuntil: (n: Node) => boolean\n): Node | undefined => {\n\tif (!node) {\n\t\treturn undefined;\n\t}\n\tif (until(node)) {\n\t\treturn node;\n\t}\n\t// @ts-ignore\n\treturn getClosestNode(node.parent, until);\n};\n\n/**\n * 判断节点是否可被点击\n * @param {Node} node 节点\n * @param {unknown} e 点击事件\n * @returns {boolean} 是否可点击,true表示可点击\n */\nexport function canClickNode<Node extends IPublicModelNode = IPublicModelNode>(\n\tnode: Node,\n\te: MouseEvent\n): boolean {\n\tconst onClickHook = node.componentMeta?.advanced?.callbacks?.onClickHook;\n\tconst canClick =\n\t\ttypeof onClickHook === 'function' ? onClickHook(e, node) : true;\n\treturn canClick;\n}\n"],"names":[],"mappings":";AAOa,MAAA,cAAA,GAAiB,CAG7B,IAAA,EACA,KACsB,KAAA;AACtB,EAAA,IAAI,CAAC,IAAM,EAAA;AACV,IAAO,OAAA,KAAA,CAAA;AAAA;AAER,EAAI,IAAA,KAAA,CAAM,IAAI,CAAG,EAAA;AAChB,IAAO,OAAA,IAAA;AAAA;AAGR,EAAO,OAAA,cAAA,CAAe,IAAK,CAAA,MAAA,EAAQ,KAAK,CAAA;AACzC;AAQgB,SAAA,YAAA,CACf,MACA,CACU,EAAA;AACV,EAAA,MAAM,WAAc,GAAA,IAAA,CAAK,aAAe,EAAA,QAAA,EAAU,SAAW,EAAA,WAAA;AAC7D,EAAA,MAAM,WACL,OAAO,WAAA,KAAgB,aAAa,WAAY,CAAA,CAAA,EAAG,IAAI,CAAI,GAAA,IAAA;AAC5D,EAAO,OAAA,QAAA;AACR;;;;"}
/**
* 动态的执行一段script脚本
*
* @param script
* @param scriptType
*/
export declare function evaluate(script: string, scriptType?: string): void;
/**
* 动态加载外部 JS 文件,并在加载成功时返回一个 Promise,支持错误处理
*
* @param url
* @param scriptType
* @returns
*/
export declare function load(url: string, scriptType?: string): Promise<any>;
import { createDefer } from './create-defer.js';
"use strict";
function evaluate(script, scriptType) {
const scriptEl = document.createElement("script");
scriptType && (scriptEl.type = scriptType);
scriptEl.text = script;
document.head.appendChild(scriptEl);
document.head.removeChild(scriptEl);
}
function load(url, scriptType) {
const node = document.createElement("script");
node.onload = onload;
node.onerror = onload;
const i = createDefer();
function onload(e) {
node.onload = null;
node.onerror = null;
if (e.type === "load") {
i.resolve();
} else {
i.reject();
}
}
node.src = url;
node.async = false;
scriptType && (node.type = scriptType);
document.head.appendChild(node);
return i.promise();
}
export { evaluate, load };
//# sourceMappingURL=script.js.map
{"version":3,"file":"script.js","sources":["../../src/script.ts"],"sourcesContent":["import { createDefer } from './create-defer';\n\n/**\n * 动态的执行一段script脚本\n *\n * @param script\n * @param scriptType\n */\nexport function evaluate(script: string, scriptType?: string) {\n\t// 创建一个新的 script 元素\n\tconst scriptEl = document.createElement('script');\n\n\t// 如果传递了 scriptType 参数,则设置 script 元素的 type 属性\n\tscriptType && (scriptEl.type = scriptType);\n\n\t// 设置 script 元素的 text 属性为传入的脚本内容\n\tscriptEl.text = script;\n\n\t// 将 script 元素添加到 document.head 中,这会立即执行脚本\n\tdocument.head.appendChild(scriptEl);\n\n\t// 执行完成后,立即从 document.head 中移除该 script 元素\n\tdocument.head.removeChild(scriptEl);\n}\n\n/**\n * 动态加载外部 JS 文件,并在加载成功时返回一个 Promise,支持错误处理\n *\n * @param url\n * @param scriptType\n * @returns\n */\nexport function load(url: string, scriptType?: string) {\n\t// 创建一个新的 script 元素\n\tconst node = document.createElement('script');\n\n\t// 监听加载成功或失败事件\n\tnode.onload = onload;\n\tnode.onerror = onload;\n\n\t// 创建一个 Deferred 对象,用于返回 Promise\n\tconst i = createDefer();\n\n\t// 处理 onload 和 onerror 事件\n\tfunction onload(e: any) {\n\t\tnode.onload = null;\n\t\tnode.onerror = null;\n\t\tif (e.type === 'load') {\n\t\t\ti.resolve(); // 加载成功时,调用 resolve()\n\t\t} else {\n\t\t\ti.reject(); // 加载失败时,调用 reject()\n\t\t}\n\t}\n\n\t// 设置 script 元素的 src 属性为传入的 url\n\tnode.src = url;\n\n\t// 确保脚本按顺序执行,设置 async = false\n\tnode.async = false;\n\n\t// 如果有传递 scriptType 参数,则设置 script 元素的 type 属性\n\tscriptType && (node.type = scriptType);\n\n\t// 将 script 元素添加到 head 中,开始加载脚本\n\tdocument.head.appendChild(node);\n\n\t// 返回一个 Promise 对象,表示加载状态\n\treturn i.promise();\n}\n"],"names":[],"mappings":";;;AAQgB,SAAA,QAAA,CAAS,QAAgB,UAAqB,EAAA;AAE7D,EAAM,MAAA,QAAA,GAAW,QAAS,CAAA,aAAA,CAAc,QAAQ,CAAA;AAGhD,EAAA,UAAA,KAAe,SAAS,IAAO,GAAA,UAAA,CAAA;AAG/B,EAAA,QAAA,CAAS,IAAO,GAAA,MAAA;AAGhB,EAAS,QAAA,CAAA,IAAA,CAAK,YAAY,QAAQ,CAAA;AAGlC,EAAS,QAAA,CAAA,IAAA,CAAK,YAAY,QAAQ,CAAA;AACnC;AASgB,SAAA,IAAA,CAAK,KAAa,UAAqB,EAAA;AAEtD,EAAM,MAAA,IAAA,GAAO,QAAS,CAAA,aAAA,CAAc,QAAQ,CAAA;AAG5C,EAAA,IAAA,CAAK,MAAS,GAAA,MAAA;AACd,EAAA,IAAA,CAAK,OAAU,GAAA,MAAA;AAGf,EAAA,MAAM,IAAI,WAAY,EAAA;AAGtB,EAAA,SAAS,OAAO,CAAQ,EAAA;AACvB,IAAA,IAAA,CAAK,MAAS,GAAA,IAAA;AACd,IAAA,IAAA,CAAK,OAAU,GAAA,IAAA;AACf,IAAI,IAAA,CAAA,CAAE,SAAS,MAAQ,EAAA;AACtB,MAAA,CAAA,CAAE,OAAQ,EAAA;AAAA,KACJ,MAAA;AACN,MAAA,CAAA,CAAE,MAAO,EAAA;AAAA;AACV;AAID,EAAA,IAAA,CAAK,GAAM,GAAA,GAAA;AAGX,EAAA,IAAA,CAAK,KAAQ,GAAA,KAAA;AAGb,EAAA,UAAA,KAAe,KAAK,IAAO,GAAA,UAAA,CAAA;AAG3B,EAAS,QAAA,CAAA,IAAA,CAAK,YAAY,IAAI,CAAA;AAG9B,EAAA,OAAO,EAAE,OAAQ,EAAA;AAClB;;;;"}
export declare function shallowEqual(objA: any, objB: any): boolean;
import { hasOwnProperty } from './has-own-property.js';
"use strict";
function shallowEqual(objA, objB) {
if (objA === objB) {
return true;
}
if (typeof objA !== "object" || objA === null || typeof objB !== "object" || objB === null) {
return false;
}
const keysA = Object.keys(objA);
const keysB = Object.keys(objB);
if (keysA.length !== keysB.length) {
return false;
}
for (let i = 0; i < keysA.length; i++) {
if (!hasOwnProperty(objB, keysA[i]) || objA[keysA[i]] !== objB[keysA[i]]) {
return false;
}
}
return true;
}
export { shallowEqual };
//# sourceMappingURL=shallow-equal.js.map
{"version":3,"file":"shallow-equal.js","sources":["../../src/shallow-equal.ts"],"sourcesContent":["import { hasOwnProperty } from './has-own-property';\n\nexport function shallowEqual(objA: any, objB: any): boolean {\n\tif (objA === objB) {\n\t\treturn true;\n\t}\n\n\tif (\n\t\ttypeof objA !== 'object' ||\n\t\tobjA === null ||\n\t\ttypeof objB !== 'object' ||\n\t\tobjB === null\n\t) {\n\t\treturn false;\n\t}\n\n\tconst keysA = Object.keys(objA);\n\tconst keysB = Object.keys(objB);\n\n\tif (keysA.length !== keysB.length) {\n\t\treturn false;\n\t}\n\n\t// Test for A's keys different from B.\n\tfor (let i = 0; i < keysA.length; i++) {\n\t\tif (!hasOwnProperty(objB, keysA[i]) || objA[keysA[i]] !== objB[keysA[i]]) {\n\t\t\treturn false;\n\t\t}\n\t}\n\n\treturn true;\n}\n"],"names":[],"mappings":";;;AAEgB,SAAA,YAAA,CAAa,MAAW,IAAoB,EAAA;AAC3D,EAAA,IAAI,SAAS,IAAM,EAAA;AAClB,IAAO,OAAA,IAAA;AAAA;AAGR,EACC,IAAA,OAAO,SAAS,QAChB,IAAA,IAAA,KAAS,QACT,OAAO,IAAA,KAAS,QAChB,IAAA,IAAA,KAAS,IACR,EAAA;AACD,IAAO,OAAA,KAAA;AAAA;AAGR,EAAM,MAAA,KAAA,GAAQ,MAAO,CAAA,IAAA,CAAK,IAAI,CAAA;AAC9B,EAAM,MAAA,KAAA,GAAQ,MAAO,CAAA,IAAA,CAAK,IAAI,CAAA;AAE9B,EAAI,IAAA,KAAA,CAAM,MAAW,KAAA,KAAA,CAAM,MAAQ,EAAA;AAClC,IAAO,OAAA,KAAA;AAAA;AAIR,EAAA,KAAA,IAAS,CAAI,GAAA,CAAA,EAAG,CAAI,GAAA,KAAA,CAAM,QAAQ,CAAK,EAAA,EAAA;AACtC,IAAA,IAAI,CAAC,cAAe,CAAA,IAAA,EAAM,KAAM,CAAA,CAAC,CAAC,CAAK,IAAA,IAAA,CAAK,KAAM,CAAA,CAAC,CAAC,CAAM,KAAA,IAAA,CAAK,KAAM,CAAA,CAAC,CAAC,CAAG,EAAA;AACzE,MAAO,OAAA,KAAA;AAAA;AACR;AAGD,EAAO,OAAA,IAAA;AACR;;;;"}
import { PropType } from 'vue';
export interface IconProps {
className?: string;
fill?: string;
size?: 'xsmall' | 'small' | 'medium' | 'large' | 'xlarge' | number;
style?: Record<string, unknown>;
}
export declare const SVGIcon: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
fill: StringConstructor;
size: {
type: PropType<IconProps["size"]>;
default: string;
};
viewBox: {
type: StringConstructor;
};
className: StringConstructor;
style: PropType<Record<string, any>>;
}>, () => VNode, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
fill: StringConstructor;
size: {
type: PropType<IconProps["size"]>;
default: string;
};
viewBox: {
type: StringConstructor;
};
className: StringConstructor;
style: PropType<Record<string, any>>;
}>> & Readonly<{}>, {
size: number | "small" | "xsmall" | "medium" | "large" | "xlarge" | undefined;
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
import { defineComponent, createVNode } from 'vue';
"use strict";
const SizePresets = {
xsmall: 8,
small: 12,
medium: 16,
large: 20,
xlarge: 30
};
const SVGIcon = /* @__PURE__ */ defineComponent({
name: "SVGIcon",
props: {
fill: String,
size: {
type: [String, Number],
default: "medium"
},
viewBox: {
type: String
},
className: String,
style: Object
},
setup(props, {
slots
}) {
const getSize = (size) => SizePresets[size] ?? size;
return () => {
const finalSize = getSize(props.size);
return createVNode("svg", {
"fill": "currentColor",
"preserveAspectRatio": "xMidYMid meet",
"width": finalSize,
"height": finalSize,
"viewBox": props.viewBox,
"class": props.className,
"style": {
color: props.fill,
...props.style || {}
}
}, [slots.default?.()]);
};
}
});
export { SVGIcon };
//# sourceMappingURL=svg-icon.js.map
{"version":3,"file":"svg-icon.js","sources":["../../src/svg-icon.tsx"],"sourcesContent":["import { PropType, defineComponent } from 'vue';\n\nconst SizePresets: any = {\n\txsmall: 8,\n\tsmall: 12,\n\tmedium: 16,\n\tlarge: 20,\n\txlarge: 30,\n};\n\nexport interface IconProps {\n\tclassName?: string;\n\tfill?: string;\n\tsize?: 'xsmall' | 'small' | 'medium' | 'large' | 'xlarge' | number;\n\tstyle?: Record<string, unknown>;\n}\n\nexport const SVGIcon = defineComponent({\n\tname: 'SVGIcon',\n\tprops: {\n\t\tfill: String,\n\t\tsize: {\n\t\t\ttype: [String, Number] as PropType<IconProps['size']>,\n\t\t\tdefault: 'medium',\n\t\t},\n\t\tviewBox: {\n\t\t\ttype: String,\n\t\t},\n\t\tclassName: String,\n\t\tstyle: Object as PropType<Record<string, any>>,\n\t},\n\tsetup(props, { slots }) {\n\t\tconst getSize = (size: IconProps['size']) =>\n\t\t\tSizePresets[size as string] ?? size;\n\n\t\treturn () => {\n\t\t\tconst finalSize = getSize(props.size);\n\n\t\t\treturn (\n\t\t\t\t<svg\n\t\t\t\t\tfill=\"currentColor\"\n\t\t\t\t\tpreserveAspectRatio=\"xMidYMid meet\"\n\t\t\t\t\twidth={finalSize}\n\t\t\t\t\theight={finalSize}\n\t\t\t\t\tviewBox={props.viewBox}\n\t\t\t\t\tclass={props.className}\n\t\t\t\t\tstyle={{\n\t\t\t\t\t\tcolor: props.fill,\n\t\t\t\t\t\t...(props.style || {}),\n\t\t\t\t\t}}\n\t\t\t\t>\n\t\t\t\t\t{slots.default?.()}\n\t\t\t\t</svg>\n\t\t\t);\n\t\t};\n\t},\n});\n"],"names":["SizePresets","xsmall","small","medium","large","xlarge","SVGIcon","name","props","fill","String","size","type","Number","default","viewBox","className","style","Object","setup","slots","getSize","finalSize","_createVNode","color"],"mappings":";;;AAEA,MAAMA,WAAmB,GAAA;AAAA,EACxBC,MAAQ,EAAA,CAAA;AAAA,EACRC,KAAO,EAAA,EAAA;AAAA,EACPC,MAAQ,EAAA,EAAA;AAAA,EACRC,KAAO,EAAA,EAAA;AAAA,EACPC,MAAQ,EAAA;AACT,CAAA;AASO,MAAMC,0BAA0B,eAAA,CAAA;AAAA,EACtCC,IAAM,EAAA,SAAA;AAAA,EACNC,KAAO,EAAA;AAAA,IACNC,IAAMC,EAAAA,MAAAA;AAAAA,IACNC,IAAM,EAAA;AAAA,MACLC,IAAAA,EAAM,CAACF,MAAAA,EAAQG,MAAM,CAAA;AAAA,MACrBC,OAAS,EAAA;AAAA,KACV;AAAA,IACAC,OAAS,EAAA;AAAA,MACRH,IAAMF,EAAAA;AAAAA,KACP;AAAA,IACAM,SAAWN,EAAAA,MAAAA;AAAAA,IACXO,KAAOC,EAAAA;AAAAA,GACR;AAAA,EACAC,MAAMX,KAAO,EAAA;AAAA,IAAEY;AAAAA,GAAS,EAAA;AACvB,IAAA,MAAMC,OAAWV,GAAAA,CAAAA,IAAAA,KAChBX,WAAYW,CAAAA,IAAI,CAAeA,IAAAA,IAAAA;AAEhC,IAAA,OAAO,MAAM;AACZ,MAAMW,MAAAA,SAAAA,GAAYD,OAAQb,CAAAA,KAAAA,CAAMG,IAAI,CAAA;AAEpC,MAAA,OAAAY,YAAA,KAAA,EAAA;AAAA,QAAA,MAAA,EAAA,cAAA;AAAA,QAAA,qBAAA,EAAA,eAAA;AAAA,QAAA,OAISD,EAAAA,SAAAA;AAAAA,QAAS,QACRA,EAAAA,SAAAA;AAAAA,QAAS,WACRd,KAAMO,CAAAA,OAAAA;AAAAA,QAAO,SACfP,KAAMQ,CAAAA,SAAAA;AAAAA,QAAS,OACf,EAAA;AAAA,UACNQ,OAAOhB,KAAMC,CAAAA,IAAAA;AAAAA,UACb,GAAID,KAAMS,CAAAA,KAAAA,IAAS;AAAC;AACrB,OAAC,EAAA,CAEAG,KAAMN,CAAAA,OAAAA,IAAW,CAAA,CAAA;AAAA,KAGrB;AAAA;AAEF,CAAC;;;;"}
declare class TransactionManager {
private emitter;
executeTransaction: (fn: () => void, type: any) => void;
onStartTransaction: (fn: () => void, type: any) => (() => void);
onEndTransaction: (fn: () => void, type: any) => (() => void);
}
export declare const transactionManager: TransactionManager;
export {};
import { EventEmitter2 } from 'eventemitter2';
import { ref, watchEffect } from 'vue';
"use strict";
class TransactionManager {
emitter = new EventEmitter2({
wildcard: true,
delimiter: ".",
maxListeners: 0
});
executeTransaction = (fn, type) => {
this.emitter.emit(`${type}.startTransaction`);
const result = ref(null);
watchEffect(() => {
result.value = fn();
});
this.emitter.emit(`${type}.endTransaction`);
};
onStartTransaction = (fn, type) => {
this.emitter.on(`${type}.startTransaction`, fn);
return () => {
this.emitter.off(`${type}.startTransaction`, fn);
};
};
onEndTransaction = (fn, type) => {
this.emitter.on(`${type}.endTransaction`, fn);
return () => {
this.emitter.off(`${type}.endTransaction`, fn);
};
};
}
const transactionManager = new TransactionManager();
export { transactionManager };
//# sourceMappingURL=transaction-manager.js.map
{"version":3,"file":"transaction-manager.js","sources":["../../src/transaction-manager.ts"],"sourcesContent":["import { EventEmitter2 } from 'eventemitter2';\nimport { ref, watchEffect, type Ref } from 'vue';\n\nclass TransactionManager {\n\tprivate emitter = new EventEmitter2({\n\t\twildcard: true,\n\t\tdelimiter: '.',\n\t\tmaxListeners: 0,\n\t});\n\n\texecuteTransaction = (fn: () => void, type: any): void => {\n\t\tthis.emitter.emit(`${type}.startTransaction`);\n\t\tconst result: Ref<any> = ref(null);\n\t\twatchEffect(() => {\n\t\t\tresult.value = fn();\n\t\t});\n\t\tthis.emitter.emit(`${type}.endTransaction`);\n\t};\n\n\tonStartTransaction = (fn: () => void, type: any): (() => void) => {\n\t\tthis.emitter.on(`${type}.startTransaction`, fn);\n\t\treturn () => {\n\t\t\tthis.emitter.off(`${type}.startTransaction`, fn);\n\t\t};\n\t};\n\n\tonEndTransaction = (fn: () => void, type: any): (() => void) => {\n\t\tthis.emitter.on(`${type}.endTransaction`, fn);\n\t\treturn () => {\n\t\t\tthis.emitter.off(`${type}.endTransaction`, fn);\n\t\t};\n\t};\n}\n\nexport const transactionManager = new TransactionManager();\n"],"names":[],"mappings":";;;;AAGA,MAAM,kBAAmB,CAAA;AAAA,EAChB,OAAA,GAAU,IAAI,aAAc,CAAA;AAAA,IACnC,QAAU,EAAA,IAAA;AAAA,IACV,SAAW,EAAA,GAAA;AAAA,IACX,YAAc,EAAA;AAAA,GACd,CAAA;AAAA,EAED,kBAAA,GAAqB,CAAC,EAAA,EAAgB,IAAoB,KAAA;AACzD,IAAA,IAAA,CAAK,OAAQ,CAAA,IAAA,CAAK,CAAG,EAAA,IAAI,CAAmB,iBAAA,CAAA,CAAA;AAC5C,IAAM,MAAA,MAAA,GAAmB,IAAI,IAAI,CAAA;AACjC,IAAA,WAAA,CAAY,MAAM;AACjB,MAAA,MAAA,CAAO,QAAQ,EAAG,EAAA;AAAA,KAClB,CAAA;AACD,IAAA,IAAA,CAAK,OAAQ,CAAA,IAAA,CAAK,CAAG,EAAA,IAAI,CAAiB,eAAA,CAAA,CAAA;AAAA,GAC3C;AAAA,EAEA,kBAAA,GAAqB,CAAC,EAAA,EAAgB,IAA4B,KAAA;AACjE,IAAA,IAAA,CAAK,OAAQ,CAAA,EAAA,CAAG,CAAG,EAAA,IAAI,qBAAqB,EAAE,CAAA;AAC9C,IAAA,OAAO,MAAM;AACZ,MAAA,IAAA,CAAK,OAAQ,CAAA,GAAA,CAAI,CAAG,EAAA,IAAI,qBAAqB,EAAE,CAAA;AAAA,KAChD;AAAA,GACD;AAAA,EAEA,gBAAA,GAAmB,CAAC,EAAA,EAAgB,IAA4B,KAAA;AAC/D,IAAA,IAAA,CAAK,OAAQ,CAAA,EAAA,CAAG,CAAG,EAAA,IAAI,mBAAmB,EAAE,CAAA;AAC5C,IAAA,OAAO,MAAM;AACZ,MAAA,IAAA,CAAK,OAAQ,CAAA,GAAA,CAAI,CAAG,EAAA,IAAI,mBAAmB,EAAE,CAAA;AAAA,KAC9C;AAAA,GACD;AACD;AAEa,MAAA,kBAAA,GAAqB,IAAI,kBAAmB;;;;"}
export declare function uniqueId(prefix?: string): string;
"use strict";
let guid = Date.now();
function uniqueId(prefix = "") {
return `${prefix}${(guid++).toString(36).toLowerCase()}`;
}
export { uniqueId };
//# sourceMappingURL=unique-id.js.map
{"version":3,"file":"unique-id.js","sources":["../../src/unique-id.ts"],"sourcesContent":["let guid = Date.now();\nexport function uniqueId(prefix = '') {\n\treturn `${prefix}${(guid++).toString(36).toLowerCase()}`;\n}\n"],"names":[],"mappings":";AAAA,IAAI,IAAA,GAAO,KAAK,GAAI,EAAA;AACJ,SAAA,QAAA,CAAS,SAAS,EAAI,EAAA;AACrC,EAAO,OAAA,CAAA,EAAG,MAAM,CAAI,EAAA,CAAA,IAAA,EAAA,EAAQ,SAAS,EAAE,CAAA,CAAE,aAAa,CAAA,CAAA;AACvD;;;;"}
import { Asset, AssetBundle, AssetItem, AssetLevel, AssetList, AssetType, IPublicTypeAssetsJson } from '@arvin-shu/microcode-types';
export declare function isAssetItem(obj: any): obj is AssetItem;
export declare function isAssetBundle(obj: any): obj is AssetBundle;
/**
* 构建资源包
* @param assets
* @param level
* @returns
*/
export declare function assetBundle(assets?: Asset | AssetList | null, level?: AssetLevel): AssetBundle | null;
/**
* 构建资源项
* @param type
* @param content
* @param level
* @param id
* @returns
*/
export declare function assetItem(type: AssetType, content?: string | null, level?: AssetLevel, id?: string): AssetItem | null;
export declare class StylePoint {
private lastContent;
private lastUrl;
readonly level: number;
readonly id: string;
private placeholder;
constructor(level: number, id?: string);
applyText(content: string): void;
applyUrl(url: string): Promise<any> | undefined;
}
export declare class AssetLoader {
private stylePoints;
load(assets: Asset): Promise<void>;
private loadStyle;
private loadScript;
loadAsyncLibrary(asyncLibraryMap: Record<string, any>): Promise<void>;
}
export declare function mergeAssets(assets: IPublicTypeAssetsJson, incrementalAssets: IPublicTypeAssetsJson): IPublicTypeAssetsJson;
'use strict';
var microcodeTypes = require('@arvin-shu/microcode-types');
var isCssUrl = require('./is-css-url.js');
var script = require('./script.js');
var createDefer = require('./create-defer.js');
"use strict";
function isAssetItem(obj) {
return obj && obj.type;
}
function isAssetBundle(obj) {
return obj && obj.type === microcodeTypes.AssetType.Bundle;
}
function assetBundle(assets, level) {
if (!assets) {
return null;
}
return {
type: microcodeTypes.AssetType.Bundle,
assets,
level
};
}
function assetItem(type, content, level, id) {
if (!content) {
return null;
}
return {
type,
content,
level,
id
};
}
function parseAssetList(scripts, styles, assets, level) {
for (const asset of assets) {
parseAsset(scripts, styles, asset, level);
}
}
function parseAsset(scripts, styles, asset, level) {
if (!asset) {
return;
}
if (Array.isArray(asset)) {
return parseAssetList(scripts, styles, asset, level);
}
if (isAssetBundle(asset)) {
if (asset.assets) {
if (Array.isArray(asset.assets)) {
parseAssetList(scripts, styles, asset.assets, asset.level || level);
} else {
parseAsset(scripts, styles, asset.assets, asset.level || level);
}
return;
}
return;
}
if (!isAssetItem(asset)) {
asset = assetItem(
isCssUrl.isCSSUrl(asset) ? microcodeTypes.AssetType.CSSUrl : microcodeTypes.AssetType.JSUrl,
asset,
level
);
}
let lv = asset.level || level;
if (!lv || microcodeTypes.AssetLevel[lv] == null) {
lv = microcodeTypes.AssetLevel.App;
}
asset.level = lv;
if (asset.type === microcodeTypes.AssetType.CSSUrl || asset.type === microcodeTypes.AssetType.CSSText) {
styles[lv].push(asset);
} else {
scripts[lv].push(asset);
}
}
class StylePoint {
lastContent;
lastUrl;
level;
id;
placeholder;
constructor(level, id) {
this.level = level;
if (id) {
this.id = id;
}
let placeholder;
if (id) {
placeholder = document.head.querySelector(`style[data-id="${id}"]`);
}
if (!placeholder) {
placeholder = document.createTextNode("");
const meta = document.head.querySelector(`meta[level="${level}"]`);
if (meta) {
document.head.insertBefore(placeholder, meta);
} else {
document.head.appendChild(placeholder);
}
}
this.placeholder = placeholder;
}
applyText(content) {
if (this.lastContent === content) {
return;
}
this.lastContent = content;
this.lastUrl = void 0;
const element = document.createElement("style");
element.setAttribute("type", "text/css");
if (this.id) {
element.setAttribute("data-id", this.id);
}
element.appendChild(document.createTextNode(content));
document.head.insertBefore(
element,
this.placeholder.parentNode === document.head ? this.placeholder.nextSibling : null
);
document.head.removeChild(this.placeholder);
this.placeholder = element;
}
applyUrl(url) {
if (this.lastUrl === url) {
return;
}
this.lastContent = void 0;
this.lastUrl = url;
const element = document.createElement("link");
element.onload = onload;
element.onerror = onload;
const i = createDefer.createDefer();
function onload(e) {
element.onload = null;
element.onerror = null;
if (e.type === "load") {
i.resolve();
} else {
i.reject();
}
}
element.href = url;
element.rel = "stylesheet";
if (this.id) {
element.setAttribute("data-id", this.id);
}
document.head.insertBefore(
element,
this.placeholder.parentNode === document.head ? this.placeholder.nextSibling : null
);
document.head.removeChild(this.placeholder);
this.placeholder = element;
return i.promise();
}
}
class AssetLoader {
stylePoints = /* @__PURE__ */ new Map();
async load(assets) {
const styles = {};
const scripts = {};
microcodeTypes.AssetLevels.forEach((level) => {
styles[level] = [];
scripts[level] = [];
});
parseAsset(scripts, styles, assets);
const styleQueue = styles[microcodeTypes.AssetLevel.Environment].concat(
styles[microcodeTypes.AssetLevel.Library],
styles[microcodeTypes.AssetLevel.Theme],
styles[microcodeTypes.AssetLevel.Runtime],
styles[microcodeTypes.AssetLevel.App]
);
const scriptQueue = scripts[microcodeTypes.AssetLevel.Environment].concat(
scripts[microcodeTypes.AssetLevel.Library],
scripts[microcodeTypes.AssetLevel.Theme],
scripts[microcodeTypes.AssetLevel.Runtime],
scripts[microcodeTypes.AssetLevel.App]
);
await Promise.all(
styleQueue.map(
({ content, level, type, id }) => this.loadStyle(content, level, type === microcodeTypes.AssetType.CSSUrl, id)
)
);
await Promise.all(
scriptQueue.map(
({ content, type, scriptType }) => this.loadScript(content, type === microcodeTypes.AssetType.JSUrl, scriptType)
)
);
}
loadStyle(content, level, isUrl, id) {
if (!content) {
return;
}
let point;
if (id) {
point = this.stylePoints.get(id);
if (!point) {
point = new StylePoint(level, id);
this.stylePoints.set(id, point);
}
} else {
point = new StylePoint(level);
}
return isUrl ? point.applyUrl(content) : point.applyText(content);
}
loadScript(content, isUrl, scriptType) {
if (!content) {
return;
}
return isUrl ? script.load(content, scriptType) : script.evaluate(content, scriptType);
}
async loadAsyncLibrary(asyncLibraryMap) {
const promiseList = [];
const libraryKeyList = [];
const pkgs = [];
for (const key in asyncLibraryMap) {
if (asyncLibraryMap[key].async) {
promiseList.push(window[asyncLibraryMap[key].library]);
libraryKeyList.push(asyncLibraryMap[key].library);
pkgs.push(asyncLibraryMap[key]);
}
}
await Promise.all(promiseList).then((mods) => {
if (mods.length > 0) {
mods.map((item, index) => {
const { exportMode, exportSourceLibrary, library } = pkgs[index];
window[libraryKeyList[index]] = exportMode === "functionCall" && (exportSourceLibrary == null || exportSourceLibrary === library) ? item() : item;
return item;
});
}
});
}
}
function mergeAssets(assets, incrementalAssets) {
if (incrementalAssets.packages) {
assets.packages = [
...assets.packages || [],
...incrementalAssets.packages
];
}
if (incrementalAssets.components) {
assets.components = [
...assets.components || [],
...incrementalAssets.components
];
}
return assets;
}
exports.AssetLoader = AssetLoader;
exports.StylePoint = StylePoint;
exports.assetBundle = assetBundle;
exports.assetItem = assetItem;
exports.isAssetBundle = isAssetBundle;
exports.isAssetItem = isAssetItem;
exports.mergeAssets = mergeAssets;
//# sourceMappingURL=asset.js.map
{"version":3,"file":"asset.js","sources":["../../src/asset.ts"],"sourcesContent":["import {\n\tAsset,\n\tAssetBundle,\n\tAssetItem,\n\tAssetLevel,\n\tAssetLevels,\n\tAssetList,\n\tAssetType,\n\tIPublicTypeAssetsJson,\n} from '@arvin-shu/microcode-types';\nimport { isCSSUrl } from './is-css-url';\nimport { evaluate, load } from './script';\nimport { createDefer } from './create-defer';\n\nexport function isAssetItem(obj: any): obj is AssetItem {\n\treturn obj && obj.type;\n}\n\nexport function isAssetBundle(obj: any): obj is AssetBundle {\n\treturn obj && obj.type === AssetType.Bundle;\n}\n\n/**\n * 构建资源包\n * @param assets\n * @param level\n * @returns\n */\nexport function assetBundle(\n\tassets?: Asset | AssetList | null,\n\tlevel?: AssetLevel\n): AssetBundle | null {\n\tif (!assets) {\n\t\treturn null;\n\t}\n\treturn {\n\t\ttype: AssetType.Bundle,\n\t\tassets,\n\t\tlevel,\n\t};\n}\n\n/**\n * 构建资源项\n * @param type\n * @param content\n * @param level\n * @param id\n * @returns\n */\nexport function assetItem(\n\ttype: AssetType,\n\tcontent?: string | null,\n\tlevel?: AssetLevel,\n\tid?: string\n): AssetItem | null {\n\tif (!content) {\n\t\treturn null;\n\t}\n\treturn {\n\t\ttype,\n\t\tcontent,\n\t\tlevel,\n\t\tid,\n\t};\n}\n\nfunction parseAssetList(\n\tscripts: any,\n\tstyles: any,\n\tassets: AssetList,\n\tlevel?: AssetLevel\n) {\n\tfor (const asset of assets) {\n\t\tparseAsset(scripts, styles, asset, level);\n\t}\n}\n\nfunction parseAsset(\n\tscripts: any,\n\tstyles: any,\n\tasset: Asset | undefined | null,\n\tlevel?: AssetLevel\n) {\n\tif (!asset) {\n\t\treturn;\n\t}\n\tif (Array.isArray(asset)) {\n\t\treturn parseAssetList(scripts, styles, asset, level);\n\t}\n\n\tif (isAssetBundle(asset)) {\n\t\tif (asset.assets) {\n\t\t\tif (Array.isArray(asset.assets)) {\n\t\t\t\tparseAssetList(scripts, styles, asset.assets, asset.level || level);\n\t\t\t} else {\n\t\t\t\tparseAsset(scripts, styles, asset.assets, asset.level || level);\n\t\t\t}\n\t\t\treturn;\n\t\t}\n\t\treturn;\n\t}\n\n\tif (!isAssetItem(asset)) {\n\t\tasset = assetItem(\n\t\t\tisCSSUrl(asset) ? AssetType.CSSUrl : AssetType.JSUrl,\n\t\t\tasset,\n\t\t\tlevel\n\t\t)!;\n\t}\n\tlet lv = asset.level || level;\n\n\t// 如果协议中没有明确level则资源全部设置为APP级别的\n\tif (!lv || AssetLevel[lv] == null) {\n\t\tlv = AssetLevel.App;\n\t}\n\tasset.level = lv;\n\tif (asset.type === AssetType.CSSUrl || asset.type === AssetType.CSSText) {\n\t\tstyles[lv].push(asset);\n\t} else {\n\t\tscripts[lv].push(asset);\n\t}\n}\n\nexport class StylePoint {\n\tprivate lastContent: string | undefined;\n\n\tprivate lastUrl: string | undefined;\n\n\treadonly level: number;\n\n\treadonly id: string;\n\n\tprivate placeholder: Element | Text;\n\n\tconstructor(level: number, id?: string) {\n\t\tthis.level = level;\n\t\tif (id) {\n\t\t\tthis.id = id;\n\t\t}\n\t\tlet placeholder: any;\n\t\tif (id) {\n\t\t\tplaceholder = document.head.querySelector(`style[data-id=\"${id}\"]`);\n\t\t}\n\t\tif (!placeholder) {\n\t\t\tplaceholder = document.createTextNode('');\n\t\t\tconst meta = document.head.querySelector(`meta[level=\"${level}\"]`);\n\t\t\tif (meta) {\n\t\t\t\tdocument.head.insertBefore(placeholder, meta);\n\t\t\t} else {\n\t\t\t\tdocument.head.appendChild(placeholder);\n\t\t\t}\n\t\t}\n\t\tthis.placeholder = placeholder;\n\t}\n\n\tapplyText(content: string) {\n\t\tif (this.lastContent === content) {\n\t\t\treturn;\n\t\t}\n\t\tthis.lastContent = content;\n\t\tthis.lastUrl = undefined;\n\t\tconst element = document.createElement('style');\n\t\telement.setAttribute('type', 'text/css');\n\t\tif (this.id) {\n\t\t\telement.setAttribute('data-id', this.id);\n\t\t}\n\t\telement.appendChild(document.createTextNode(content));\n\t\tdocument.head.insertBefore(\n\t\t\telement,\n\t\t\tthis.placeholder.parentNode === document.head\n\t\t\t\t? this.placeholder.nextSibling\n\t\t\t\t: null\n\t\t);\n\t\tdocument.head.removeChild(this.placeholder);\n\t\tthis.placeholder = element;\n\t}\n\n\tapplyUrl(url: string) {\n\t\tif (this.lastUrl === url) {\n\t\t\treturn;\n\t\t}\n\t\tthis.lastContent = undefined;\n\t\tthis.lastUrl = url;\n\t\tconst element = document.createElement('link');\n\t\telement.onload = onload;\n\t\telement.onerror = onload;\n\n\t\tconst i = createDefer();\n\t\tfunction onload(e: any) {\n\t\t\telement.onload = null;\n\t\t\telement.onerror = null;\n\t\t\tif (e.type === 'load') {\n\t\t\t\ti.resolve();\n\t\t\t} else {\n\t\t\t\ti.reject();\n\t\t\t}\n\t\t}\n\n\t\telement.href = url;\n\t\telement.rel = 'stylesheet';\n\t\tif (this.id) {\n\t\t\telement.setAttribute('data-id', this.id);\n\t\t}\n\t\tdocument.head.insertBefore(\n\t\t\telement,\n\t\t\tthis.placeholder.parentNode === document.head\n\t\t\t\t? this.placeholder.nextSibling\n\t\t\t\t: null\n\t\t);\n\t\tdocument.head.removeChild(this.placeholder);\n\t\tthis.placeholder = element;\n\t\treturn i.promise();\n\t}\n}\n\nexport class AssetLoader {\n\tprivate stylePoints = new Map<string, StylePoint>();\n\n\tasync load(assets: Asset) {\n\t\tconst styles: any = {};\n\t\tconst scripts: any = {};\n\t\tAssetLevels.forEach((level) => {\n\t\t\tstyles[level] = [];\n\t\t\tscripts[level] = [];\n\t\t});\n\t\tparseAsset(scripts, styles, assets);\n\t\tconst styleQueue: AssetItem[] = styles[AssetLevel.Environment].concat(\n\t\t\tstyles[AssetLevel.Library],\n\t\t\tstyles[AssetLevel.Theme],\n\t\t\tstyles[AssetLevel.Runtime],\n\t\t\tstyles[AssetLevel.App]\n\t\t);\n\t\tconst scriptQueue: AssetItem[] = scripts[AssetLevel.Environment].concat(\n\t\t\tscripts[AssetLevel.Library],\n\t\t\tscripts[AssetLevel.Theme],\n\t\t\tscripts[AssetLevel.Runtime],\n\t\t\tscripts[AssetLevel.App]\n\t\t);\n\n\t\tawait Promise.all(\n\t\t\tstyleQueue.map(({ content, level, type, id }) =>\n\t\t\t\tthis.loadStyle(content, level!, type === AssetType.CSSUrl, id)\n\t\t\t)\n\t\t);\n\n\t\tawait Promise.all(\n\t\t\tscriptQueue.map(({ content, type, scriptType }) =>\n\t\t\t\tthis.loadScript(content, type === AssetType.JSUrl, scriptType)\n\t\t\t)\n\t\t);\n\t}\n\n\tprivate loadStyle(\n\t\tcontent: string | undefined | null,\n\t\tlevel: AssetLevel,\n\t\tisUrl?: boolean,\n\t\tid?: string\n\t) {\n\t\tif (!content) {\n\t\t\treturn;\n\t\t}\n\t\tlet point: StylePoint | undefined;\n\t\tif (id) {\n\t\t\tpoint = this.stylePoints.get(id);\n\t\t\tif (!point) {\n\t\t\t\tpoint = new StylePoint(level, id);\n\t\t\t\tthis.stylePoints.set(id, point);\n\t\t\t}\n\t\t} else {\n\t\t\tpoint = new StylePoint(level);\n\t\t}\n\t\treturn isUrl ? point.applyUrl(content) : point.applyText(content);\n\t}\n\n\tprivate loadScript(\n\t\tcontent: string | undefined | null,\n\t\tisUrl?: boolean,\n\t\tscriptType?: string\n\t) {\n\t\tif (!content) {\n\t\t\treturn;\n\t\t}\n\t\treturn isUrl ? load(content, scriptType) : evaluate(content, scriptType);\n\t}\n\n\tasync loadAsyncLibrary(asyncLibraryMap: Record<string, any>) {\n\t\tconst promiseList: any[] = [];\n\t\tconst libraryKeyList: any[] = [];\n\t\tconst pkgs: any[] = [];\n\t\tfor (const key in asyncLibraryMap) {\n\t\t\t// 需要异步加载\n\t\t\tif (asyncLibraryMap[key].async) {\n\t\t\t\tpromiseList.push(window[asyncLibraryMap[key].library]);\n\t\t\t\tlibraryKeyList.push(asyncLibraryMap[key].library);\n\t\t\t\tpkgs.push(asyncLibraryMap[key]);\n\t\t\t}\n\t\t}\n\t\tawait Promise.all(promiseList).then((mods) => {\n\t\t\tif (mods.length > 0) {\n\t\t\t\tmods.map((item, index) => {\n\t\t\t\t\tconst { exportMode, exportSourceLibrary, library } = pkgs[index];\n\t\t\t\t\twindow[libraryKeyList[index]] =\n\t\t\t\t\t\texportMode === 'functionCall' &&\n\t\t\t\t\t\t(exportSourceLibrary == null || exportSourceLibrary === library)\n\t\t\t\t\t\t\t? item()\n\t\t\t\t\t\t\t: item;\n\t\t\t\t\treturn item;\n\t\t\t\t});\n\t\t\t}\n\t\t});\n\t}\n}\n\nexport function mergeAssets(\n\tassets: IPublicTypeAssetsJson,\n\tincrementalAssets: IPublicTypeAssetsJson\n): IPublicTypeAssetsJson {\n\tif (incrementalAssets.packages) {\n\t\tassets.packages = [\n\t\t\t...(assets.packages || []),\n\t\t\t...incrementalAssets.packages,\n\t\t];\n\t}\n\n\tif (incrementalAssets.components) {\n\t\tassets.components = [\n\t\t\t...(assets.components || []),\n\t\t\t...incrementalAssets.components,\n\t\t];\n\t}\n\n\treturn assets;\n}\n"],"names":["AssetType","isCSSUrl","AssetLevel","createDefer","AssetLevels","load","evaluate"],"mappings":";;;;;;;;AAcO,SAAS,YAAY,GAA4B,EAAA;AACvD,EAAA,OAAO,OAAO,GAAI,C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;;;;;;;;;"}
import { IPublicTypeComponentSchema, IPublicTypeNpmInfo } from '@arvin-shu/microcode-types';
export interface UtilsMetadata {
name: string;
npm: {
package: string;
version?: string;
exportName: string;
subName?: string;
destructuring?: boolean;
main?: string;
};
}
export declare function getSubComponent(library: any, paths: string[]): any;
export declare const cached: <R>(fn: (param: string) => R) => ((param: string) => R);
export declare function accessLibrary(library: string | Record<string, unknown>): any;
/**
* 查找组件
* @param libraryMap 库映射
* @param componentName 组件名称
* @param npm 可选的npm信息
* @returns 返回找到的组件或库
*/
export declare function findComponent(libraryMap: Record<string, string>, componentName: string, npm?: IPublicTypeNpmInfo): any;
/**
* 构建组件
* @param libraryMap 库映射
* @param componentsMap 组件映射
* @param createComponent 创建低代码组件函数
*/
export declare function buildComponents(libraryMap: Record<string, string>, componentsMap: Record<string, IPublicTypeNpmInfo | IPublicTypeComponentSchema | unknown>, createComponent?: (schema: IPublicTypeComponentSchema) => any): any;
'use strict';
var vue = require('vue');
var isEsModule = require('./is-es-module.js');
require('./check-types/index.js');
var isComponentSchema = require('./check-types/is-component-schema.js');
"use strict";
function getSubComponent(library, paths) {
const l = paths.length;
if (l < 1 || !library) {
return library;
}
let i = 0;
let component;
while (i < l) {
const key = paths[i];
let ex;
try {
component = library[key];
} catch (e) {
ex = e;
component = null;
}
if (i === 0 && component == null && key === "default") {
if (ex) {
return l === 1 ? library : null;
}
component = library;
} else if (component == null) {
return null;
}
library = component;
i++;
}
return component;
}
const cached = (fn) => {
const cacheStore = {};
return function(param) {
return param in cacheStore ? cacheStore[param] : cacheStore[param] = fn.call(this, param);
};
};
const generateHtmlComp = cached((library) => {
if (/^[a-z-]+$/.test(library)) {
return vue.defineComponent(
(_, { attrs, slots }) => () => vue.h(library, attrs, slots)
);
}
});
function accessLibrary(library) {
if (typeof library !== "string") {
return library;
}
return window[library] || generateHtmlComp(library);
}
function findComponent(libraryMap, componentName, npm) {
if (!npm) {
return accessLibrary(componentName);
}
const exportName = npm.exportName || npm.componentName || componentName;
const libraryName = libraryMap[npm.package] || exportName;
const library = accessLibrary(libraryName);
const paths = npm.exportName && npm.subName ? npm.subName.split(".") : [];
if (npm.destructuring) {
paths.unshift(exportName);
} else if (isEsModule.isESModule(library)) {
paths.unshift("default");
}
return getSubComponent(library, paths);
}
function buildComponents(libraryMap, componentsMap, createComponent) {
const components = {};
Object.keys(componentsMap).forEach((componentName) => {
let component = componentsMap[componentName];
if (isComponentSchema.isComponentSchema(component)) {
if (createComponent) {
components[componentName] = createComponent(
component
);
}
} else if (isVueComponent(component)) {
components[componentName] = component;
} else {
component = findComponent(
libraryMap,
componentName,
component
);
if (component) {
components[componentName] = component;
}
}
});
return components;
}
function isVueComponent(component) {
if (typeof component === "object" && component !== null) {
const options = component;
if (typeof options.render === "function" || typeof options.setup === "function") {
return true;
}
}
if (typeof component === "object" && component !== null && "__vccOpts" in component) {
return true;
}
return false;
}
exports.accessLibrary = accessLibrary;
exports.buildComponents = buildComponents;
exports.cached = cached;
exports.findComponent = findComponent;
exports.getSubComponent = getSubComponent;
//# sourceMappingURL=build-components.js.map
{"version":3,"file":"build-components.js","sources":["../../src/build-components.ts"],"sourcesContent":["import {\n\tIPublicTypeComponentSchema,\n\tIPublicTypeNpmInfo,\n} from '@arvin-shu/microcode-types';\nimport { Component, ComponentOptions, defineComponent, h } from 'vue';\nimport { isESModule } from './is-es-module';\nimport { isComponentSchema } from './check-types';\n\nexport interface UtilsMetadata {\n\tname: string;\n\tnpm: {\n\t\tpackage: string;\n\t\tversion?: string;\n\t\texportName: string;\n\t\tsubName?: string;\n\t\tdestructuring?: boolean;\n\t\tmain?: string;\n\t};\n}\n\nexport function getSubComponent(library: any, paths: string[]) {\n\tconst l = paths.length;\n\tif (l < 1 || !library) {\n\t\treturn library;\n\t}\n\tlet i = 0;\n\tlet component: any;\n\twhile (i < l) {\n\t\tconst key = paths[i]!;\n\t\tlet ex: any;\n\t\ttry {\n\t\t\tcomponent = library[key];\n\t\t} catch (e) {\n\t\t\tex = e;\n\t\t\tcomponent = null;\n\t\t}\n\t\tif (i === 0 && component == null && key === 'default') {\n\t\t\tif (ex) {\n\t\t\t\treturn l === 1 ? library : null;\n\t\t\t}\n\t\t\tcomponent = library;\n\t\t} else if (component == null) {\n\t\t\treturn null;\n\t\t}\n\t\tlibrary = component;\n\t\ti++;\n\t}\n\treturn component;\n}\n\nexport const cached = <R>(fn: (param: string) => R): ((param: string) => R) => {\n\tconst cacheStore: Record<string, any> = {};\n\t// eslint-disable-next-line func-names\n\treturn function (this: unknown, param: string) {\n\t\t// eslint-disable-next-line no-return-assign\n\t\treturn param in cacheStore\n\t\t\t? cacheStore[param]\n\t\t\t: (cacheStore[param] = fn.call(this, param));\n\t};\n};\n\nconst generateHtmlComp = cached((library: string) => {\n\tif (/^[a-z-]+$/.test(library)) {\n\t\treturn defineComponent(\n\t\t\t(_, { attrs, slots }) =>\n\t\t\t\t() =>\n\t\t\t\t\th(library, attrs, slots)\n\t\t);\n\t}\n});\n\nexport function accessLibrary(library: string | Record<string, unknown>) {\n\tif (typeof library !== 'string') {\n\t\treturn library;\n\t}\n\n\treturn (window as any)[library] || generateHtmlComp(library);\n}\n\n/**\n * 查找组件\n * @param libraryMap 库映射\n * @param componentName 组件名称\n * @param npm 可选的npm信息\n * @returns 返回找到的组件或库\n */\nexport function findComponent(\n\tlibraryMap: Record<string, string>,\n\tcomponentName: string,\n\tnpm?: IPublicTypeNpmInfo\n) {\n\t// 如果没有npm信息,直接访问库并返回组件\n\tif (!npm) {\n\t\treturn accessLibrary(componentName);\n\t}\n\t// 获取导出名称,优先使用npm中的exportName或componentName\n\tconst exportName = npm.exportName || npm.componentName || componentName;\n\t// 获取库名称,优先使用库映射中的包名\n\tconst libraryName = libraryMap[npm.package] || exportName;\n\t// 访问库并获取组件\n\tconst library = accessLibrary(libraryName);\n\t// 根据npm信息获取子组件路径\n\tconst paths = npm.exportName && npm.subName ? npm.subName.split('.') : [];\n\t// 如果需要解构,添加导出名称到路径前面\n\tif (npm.destructuring) {\n\t\tpaths.unshift(exportName);\n\t}\n\t// 如果是ES模块,添加'default'到路径前面\n\telse if (isESModule(library)) {\n\t\tpaths.unshift('default');\n\t}\n\t// 返回子组件\n\treturn getSubComponent(library, paths);\n}\n\n/**\n * 构建组件\n * @param libraryMap 库映射\n * @param componentsMap 组件映射\n * @param createComponent 创建低代码组件函数\n */\nexport function buildComponents(\n\tlibraryMap: Record<string, string>,\n\tcomponentsMap: Record<\n\t\tstring,\n\t\tIPublicTypeNpmInfo | IPublicTypeComponentSchema | unknown\n\t>,\n\tcreateComponent?: (schema: IPublicTypeComponentSchema) => any\n) {\n\tconst components: any = {};\n\tObject.keys(componentsMap).forEach((componentName) => {\n\t\tlet component = componentsMap[componentName];\n\t\tif (isComponentSchema(component)) {\n\t\t\tif (createComponent) {\n\t\t\t\tcomponents[componentName] = createComponent(\n\t\t\t\t\tcomponent as IPublicTypeComponentSchema\n\t\t\t\t);\n\t\t\t}\n\t\t} else if (isVueComponent(component)) {\n\t\t\tcomponents[componentName] = component;\n\t\t} else {\n\t\t\t// 从组件库中查询\n\t\t\tcomponent = findComponent(\n\t\t\t\tlibraryMap,\n\t\t\t\tcomponentName,\n\t\t\t\tcomponent as IPublicTypeNpmInfo\n\t\t\t);\n\t\t\tif (component) {\n\t\t\t\tcomponents[componentName] = component;\n\t\t\t}\n\t\t}\n\t});\n\n\treturn components;\n}\n\n/**\n * 判断是否是组件\n *\n * @param component\n * @returns\n */\nfunction isVueComponent(component: any): component is Component {\n\tif (typeof component === 'object' && component !== null) {\n\t\tconst options = component as ComponentOptions;\n\t\tif (\n\t\t\ttypeof options.render === 'function' ||\n\t\t\ttypeof options.setup === 'function'\n\t\t) {\n\t\t\treturn true; // 是 SFC 组件\n\t\t}\n\t}\n\tif (\n\t\ttypeof component === 'object' &&\n\t\tcomponent !== null &&\n\t\t'__vccOpts' in component\n\t) {\n\t\treturn true; // 是 Vue JSX 组件\n\t}\n\n\treturn false; // 不是任何组件\n}\n"],"names":["defineComponent","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zB,EAAA,MAAA,CAAO,IAAK,CAAA,aAAa,CAAE,CAAA,OAAA,CAAQ,CAAC,aAAkB,KAAA;AACrD,IAAI,IAAA,SAAA,GAAY,cAAc,aAAa,CAAA;AAC3C,IAAI,IAAAC,mCAAA,CAAkB,SAAS,CAAG,EAAA;AACjC,MAAA,IAAI,eAAiB,EAAA;AACpB,QAAA,UAAA,CAAW,aAAa,CAAI,GAAA,eAAA;AAAA,UAC3B;AAAA,SACD;AAAA;AACD,KACD,MAAA,IAAW,cAAe,CAAA,SAAS,CAAG,EAAA;AACrC,MAAA,UAAA,CAAW,aAAa,CAAI,GAAA,SAAA;AAAA,KACtB,MAAA;AAEN,MAAY,SAAA,GAAA,aAAA;AAAA,QACX,UAAA;AAAA,QACA,aAAA;AAAA,QACA;AAAA,OACD;AACA,MAAA,IAAI,SAAW,EAAA;AACd,QAAA,UAAA,CAAW,aAAa,CAAI,GAAA,SAAA;AAAA;AAC7B;AACD,GACA,CAAA;AAED,EAAO,OAAA,UAAA;AACR;AAQA,SAAS,eAAe,SAAwC,EAAA;AAC/D,EAAA,IAAI,OAAO,SAAA,KAAc,QAAY,IAAA,SAAA,KAAc,IAAM,EAAA;AACxD,IAAA,MAAM,OAAU,GAAA,SAAA;AAChB,IAAA,IACC,OAAO,OAAQ,CAAA,MAAA,KAAW,cAC1B,OAAO,OAAA,CAAQ,UAAU,UACxB,EAAA;AACD,MAAO,OAAA,IAAA;AAAA;AACR;AAED,EAAA,IACC,OAAO,SAAc,KAAA,QAAA,IACrB,SAAc,KAAA,IAAA,IACd,eAAe,SACd,EAAA;AACD,IAAO,OAAA,IAAA;AAAA;AAGR,EAAO,OAAA,KAAA;AACR;;;;;;;;"}
export * from './is-dom-text';
export * from './is-i18n-data';
export * from './is-jsexpression';
export * from './is-jsslot';
export * from './is-node-schema';
export * from './is-node';
export * from './is-title-config';
export * from './is-location-data';
export * from './is-drag-node-data-object';
export * from './is-drag-node-object';
export * from './is-procode-component-type';
export * from './is-microcode-component-type';
export * from './is-drag-any-object';
export * from './is-location-children-detail';
export * from './is-custom-view';
export * from './is-setting-field';
export * from './is-dynamic-setter';
export * from './is-setter-config';
export * from './is-action-content-object';
export * from './is-isfunction';
export * from './is-basic-prop-type';
export * from './is-component-schema';
export * from './is-node-schema';
export * from './is-project-schema';
export * from './is-required-prop-type';
'use strict';
var isDomText = require('./is-dom-text.js');
var isI18nData = require('./is-i18n-data.js');
var isJsexpression = require('./is-jsexpression.js');
var isJsslot = require('./is-jsslot.js');
var isNodeSchema = require('./is-node-schema.js');
var isNode = require('./is-node.js');
var isTitleConfig = require('./is-title-config.js');
var isLocationData = require('./is-location-data.js');
var isDragNodeDataObject = require('./is-drag-node-data-object.js');
var isDragNodeObject = require('./is-drag-node-object.js');
var isProcodeComponentType = require('./is-procode-component-type.js');
var isMicrocodeComponentType = require('./is-microcode-component-type.js');
var isDragAnyObject = require('./is-drag-any-object.js');
var isLocationChildrenDetail = require('./is-location-children-detail.js');
var isCustomView = require('./is-custom-view.js');
var isSettingField = require('./is-setting-field.js');
var isDynamicSetter = require('./is-dynamic-setter.js');
var isSetterConfig = require('./is-setter-config.js');
var isActionContentObject = require('./is-action-content-object.js');
var isIsfunction = require('./is-isfunction.js');
var isBasicPropType = require('./is-basic-prop-type.js');
var isComponentSchema = require('./is-component-schema.js');
var isProjectSchema = require('./is-project-schema.js');
var isRequiredPropType = require('./is-required-prop-type.js');
"use strict";
exports.isDomText = isDomText.isDomText;
exports.isI18nData = isI18nData.isI18nData;
exports.isJSExpression = isJsexpression.isJSExpression;
exports.isJSSlot = isJsslot.isJSSlot;
exports.isNodeSchema = isNodeSchema.isNodeSchema;
exports.isNode = isNode.isNode;
exports.isTitleConfig = isTitleConfig.isTitleConfig;
exports.isLocationData = isLocationData.isLocationData;
exports.isDragNodeDataObject = isDragNodeDataObject.isDragNodeDataObject;
exports.isDragNodeObject = isDragNodeObject.isDragNodeObject;
exports.isProCodeComponentType = isProcodeComponentType.isProCodeComponentType;
exports.isMicrocodeComponentType = isMicrocodeComponentType.isMicrocodeComponentType;
exports.isDragAnyObject = isDragAnyObject.isDragAnyObject;
exports.isLocationChildrenDetail = isLocationChildrenDetail.isLocationChildrenDetail;
exports.isCustomView = isCustomView.isCustomView;
exports.isSettingField = isSettingField.isSettingField;
exports.isDynamicSetter = isDynamicSetter.isDynamicSetter;
exports.isSetterConfig = isSetterConfig.isSetterConfig;
exports.isActionContentObject = isActionContentObject.isActionContentObject;
exports.isInnerJsFunction = isIsfunction.isInnerJsFunction;
exports.isJSFunction = isIsfunction.isJSFunction;
exports.isBasicPropType = isBasicPropType.isBasicPropType;
exports.isComponentSchema = isComponentSchema.isComponentSchema;
exports.isProjectSchema = isProjectSchema.isProjectSchema;
exports.isRequiredPropType = isRequiredPropType.isRequiredPropType;
//# sourceMappingURL=index.js.map
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
import { IPublicTypeActionContentObject } from '@arvin-shu/microcode-types';
export declare function isActionContentObject(obj: any): obj is IPublicTypeActionContentObject;
'use strict';
var isObject = require('../is-object.js');
"use strict";
function isActionContentObject(obj) {
return isObject.isObject(obj);
}
exports.isActionContentObject = isActionContentObject;
//# sourceMappingURL=is-action-content-object.js.map
{"version":3,"file":"is-action-content-object.js","sources":["../../../src/check-types/is-action-content-object.ts"],"sourcesContent":["import { IPublicTypeActionContentObject } from '@arvin-shu/microcode-types';\nimport { isObject } from '../is-object';\n\nexport function isActionContentObject(\n\tobj: any\n): obj is IPublicTypeActionContentObject {\n\treturn isObject(obj);\n}\n"],"names":["isObject"],"mappings":";;;;;AAGO,SAAS,sBACf,GACwC,EAAA;AACxC,EAAA,OAAOA,kBAAS,GAAG,CAAA;AACpB;;;;"}
import { IPublicTypeBasicType, IPublicTypePropType } from '@arvin-shu/microcode-types';
export declare function isBasicPropType(propType: IPublicTypePropType): propType is IPublicTypeBasicType;
'use strict';
"use strict";
function isBasicPropType(propType) {
if (!propType) {
return false;
}
return typeof propType === "string";
}
exports.isBasicPropType = isBasicPropType;
//# sourceMappingURL=is-basic-prop-type.js.map
{"version":3,"file":"is-basic-prop-type.js","sources":["../../../src/check-types/is-basic-prop-type.ts"],"sourcesContent":["import {\n\tIPublicTypeBasicType,\n\tIPublicTypePropType,\n} from '@arvin-shu/microcode-types';\n\nexport function isBasicPropType(\n\tpropType: IPublicTypePropType\n): propType is IPublicTypeBasicType {\n\tif (!propType) {\n\t\treturn false;\n\t}\n\treturn typeof propType === 'string';\n}\n"],"names":[],"mappings":";;;AAKO,SAAS,gBACf,QACmC,EAAA;AACnC,EAAA,IAAI,CAAC,QAAU,EAAA;AACd,IAAO,OAAA,KAAA;AAAA;AAER,EAAA,OAAO,OAAO,QAAa,KAAA,QAAA;AAC5B;;;;"}
import { IPublicTypeComponentSchema } from '@arvin-shu/microcode-types';
export declare function isComponentSchema(schema: any): schema is IPublicTypeComponentSchema;
'use strict';
"use strict";
function isComponentSchema(schema) {
if (typeof schema === "object") {
return schema.componentName === "Component";
}
return false;
}
exports.isComponentSchema = isComponentSchema;
//# sourceMappingURL=is-component-schema.js.map
{"version":3,"file":"is-component-schema.js","sources":["../../../src/check-types/is-component-schema.ts"],"sourcesContent":["import { IPublicTypeComponentSchema } from '@arvin-shu/microcode-types';\n\nexport function isComponentSchema(\n\tschema: any\n): schema is IPublicTypeComponentSchema {\n\tif (typeof schema === 'object') {\n\t\treturn schema.componentName === 'Component';\n\t}\n\treturn false;\n}\n"],"names":[],"mappings":";;;AAEO,SAAS,kBACf,MACuC,EAAA;AACvC,EAAI,IAAA,OAAO,WAAW,QAAU,EAAA;AAC/B,IAAA,OAAO,OAAO,aAAkB,KAAA,WAAA;AAAA;AAEjC,EAAO,OAAA,KAAA;AACR;;;;"}
import { IPublicTypeCustomView } from '@arvin-shu/microcode-types';
export declare function isCustomView(obj: any): obj is IPublicTypeCustomView;
'use strict';
"use strict";
function isCustomView(obj) {
if (!obj) {
return false;
}
if (obj instanceof Object && "_isVNode" in obj) {
return true;
}
if (obj?.$) {
return true;
}
if (typeof obj === "object") {
return !!(obj.render || obj.setup || obj.template || obj.components || obj.__file);
}
return typeof obj === "function";
}
exports.isCustomView = isCustomView;
//# sourceMappingURL=is-custom-view.js.map
{"version":3,"file":"is-custom-view.js","sources":["../../../src/check-types/is-custom-view.ts"],"sourcesContent":["import { IPublicTypeCustomView } from '@arvin-shu/microcode-types';\n\nexport function isCustomView(obj: any): obj is IPublicTypeCustomView {\n\tif (!obj) {\n\t\treturn false;\n\t}\n\n\t// instanceof 检查\n\tif (obj instanceof Object && '_isVNode' in obj) {\n\t\treturn true;\n\t}\n\n\t// 组件实例检查\n\tif (obj?.$) {\n\t\treturn true;\n\t}\n\n\t// 组件定义检查\n\tif (typeof obj === 'object') {\n\t\treturn !!(\n\t\t\tobj.render ||\n\t\t\tobj.setup ||\n\t\t\tobj.template ||\n\t\t\tobj.components ||\n\t\t\tobj.__file\n\t\t);\n\t}\n\n\t// 函数式组件检查\n\treturn typeof obj === 'function';\n}\n"],"names":[],"mappings":";;;AAEO,SAAS,aAAa,GAAwC,EAAA;AACpE,EAAA,IAAI,CAAC,GAAK,EAAA;AACT,IAAO,OAAA,KAAA;AAAA;AAIR,EAAI,IAAA,GAAA,YAAe,MAAU,IAAA,UAAA,IAAc,GAAK,EAAA;AAC/C,IAAO,OAAA,IAAA;AAAA;AAIR,EAAA,IAAI,KAAK,CAAG,EAAA;AACX,IAAO,OAAA,IAAA;AAAA;AAIR,EAAI,IAAA,OAAO,QAAQ,QAAU,EAAA;AAC5B,IAAO,OAAA,CAAC,EACP,GAAA,CAAI,MACJ,IAAA,GAAA,CAAI,SACJ,GAAI,CAAA,QAAA,IACJ,GAAI,CAAA,UAAA,IACJ,GAAI,CAAA,MAAA,CAAA;AAAA;AAKN,EAAA,OAAO,OAAO,GAAQ,KAAA,UAAA;AACvB;;;;"}
export declare function isDomText(data: any): data is string;
'use strict';
"use strict";
function isDomText(data) {
return typeof data === "string";
}
exports.isDomText = isDomText;
//# sourceMappingURL=is-dom-text.js.map
{"version":3,"file":"is-dom-text.js","sources":["../../../src/check-types/is-dom-text.ts"],"sourcesContent":["export function isDomText(data: any): data is string {\n\treturn typeof data === 'string';\n}\n"],"names":[],"mappings":";;;AAAO,SAAS,UAAU,IAA2B,EAAA;AACpD,EAAA,OAAO,OAAO,IAAS,KAAA,QAAA;AACxB;;;;"}
/**
* 判断拖拽对象是否为任意对象类型
* @param obj 需要判断的对象
* @returns 如果对象不是NodeData或Node类型,则返回true,否则返回false
*/
export declare function isDragAnyObject(obj: any): boolean;
'use strict';
var microcodeTypes = require('@arvin-shu/microcode-types');
var isObject = require('../is-object.js');
"use strict";
function isDragAnyObject(obj) {
if (!isObject.isObject(obj)) {
return false;
}
return obj.type !== microcodeTypes.IPublicEnumDragObjectType.NodeData && obj.type !== microcodeTypes.IPublicEnumDragObjectType.Node;
}
exports.isDragAnyObject = isDragAnyObject;
//# sourceMappingURL=is-drag-any-object.js.map
{"version":3,"file":"is-drag-any-object.js","sources":["../../../src/check-types/is-drag-any-object.ts"],"sourcesContent":["import { IPublicEnumDragObjectType } from '@arvin-shu/microcode-types';\nimport { isObject } from '../is-object';\n\n/**\n * 判断拖拽对象是否为任意对象类型\n * @param obj 需要判断的对象\n * @returns 如果对象不是NodeData或Node类型,则返回true,否则返回false\n */\nexport function isDragAnyObject(obj: any): boolean {\n\t// 首先判断是否为对象类型\n\tif (!isObject(obj)) {\n\t\treturn false;\n\t}\n\t// 判断对象类型是否不为NodeData和Node\n\treturn (\n\t\tobj.type !== IPublicEnumDragObjectType.NodeData &&\n\t\tobj.type !== IPublicEnumDragObjectType.Node\n\t);\n}\n"],"names":["isObject","IPublicEnumDragObjectType"],"mappings":";;;;;;AAQO,SAAS,gBAAgB,GAAmB,EAAA;AAElD,EAAI,IAAA,CAACA,iBAAS,CAAA,GAAG,CAAG,EAAA;AACnB,IAAO,OAAA,KAAA;AAAA;AAGR,EAAA,OACC,IAAI,IAAS,KAAAC,wCAAA,CAA0B,QACvC,IAAA,GAAA,CAAI,SAASA,wCAA0B,CAAA,IAAA;AAEzC;;;;"}
import { IPublicTypeDragNodeDataObject } from '@arvin-shu/microcode-types';
export declare function isDragNodeDataObject(obj: any): obj is IPublicTypeDragNodeDataObject;
'use strict';
var microcodeTypes = require('@arvin-shu/microcode-types');
var isObject = require('../is-object.js');
"use strict";
function isDragNodeDataObject(obj) {
if (!isObject.isObject(obj)) {
return false;
}
return obj.type === microcodeTypes.IPublicEnumDragObjectType.NodeData;
}
exports.isDragNodeDataObject = isDragNodeDataObject;
//# sourceMappingURL=is-drag-node-data-object.js.map
{"version":3,"file":"is-drag-node-data-object.js","sources":["../../../src/check-types/is-drag-node-data-object.ts"],"sourcesContent":["import {\n\tIPublicEnumDragObjectType,\n\tIPublicTypeDragNodeDataObject,\n} from '@arvin-shu/microcode-types';\nimport { isObject } from '../is-object';\n\nexport function isDragNodeDataObject(\n\tobj: any\n): obj is IPublicTypeDragNodeDataObject {\n\tif (!isObject(obj)) {\n\t\treturn false;\n\t}\n\treturn obj.type === IPublicEnumDragObjectType.NodeData;\n}\n"],"names":["isObject","IPublicEnumDragObjectType"],"mappings":";;;;;;AAMO,SAAS,qBACf,GACuC,EAAA;AACvC,EAAI,IAAA,CAACA,iBAAS,CAAA,GAAG,CAAG,EAAA;AACnB,IAAO,OAAA,KAAA;AAAA;AAER,EAAO,OAAA,GAAA,CAAI,SAASC,wCAA0B,CAAA,QAAA;AAC/C;;;;"}
import { IPublicModelNode, IPublicTypeDragNodeObject } from '@arvin-shu/microcode-types';
export declare function isDragNodeObject<Node = IPublicModelNode>(obj: any): obj is IPublicTypeDragNodeObject<Node>;
'use strict';
var microcodeTypes = require('@arvin-shu/microcode-types');
var isObject = require('../is-object.js');
"use strict";
function isDragNodeObject(obj) {
if (!isObject.isObject(obj)) {
return false;
}
return obj.type === microcodeTypes.IPublicEnumDragObjectType.Node;
}
exports.isDragNodeObject = isDragNodeObject;
//# sourceMappingURL=is-drag-node-object.js.map
{"version":3,"file":"is-drag-node-object.js","sources":["../../../src/check-types/is-drag-node-object.ts"],"sourcesContent":["import {\n\tIPublicEnumDragObjectType,\n\tIPublicModelNode,\n\tIPublicTypeDragNodeObject,\n} from '@arvin-shu/microcode-types';\nimport { isObject } from '../is-object';\n\nexport function isDragNodeObject<Node = IPublicModelNode>(\n\tobj: any\n): obj is IPublicTypeDragNodeObject<Node> {\n\tif (!isObject(obj)) {\n\t\treturn false;\n\t}\n\treturn obj.type === IPublicEnumDragObjectType.Node;\n}\n"],"names":["isObject","IPublicEnumDragObjectType"],"mappings":";;;;;;AAOO,SAAS,iBACf,GACyC,EAAA;AACzC,EAAI,IAAA,CAACA,iBAAS,CAAA,GAAG,CAAG,EAAA;AACnB,IAAO,OAAA,KAAA;AAAA;AAER,EAAO,OAAA,GAAA,CAAI,SAASC,wCAA0B,CAAA,IAAA;AAC/C;;;;"}
import { IPublicTypeDynamicSetter } from '@arvin-shu/microcode-types';
export declare function isDynamicSetter(obj: any): obj is IPublicTypeDynamicSetter;
'use strict';
var lodashEs = require('lodash-es');
var isVue = require('../is-vue.js');
"use strict";
function isDynamicSetter(obj) {
if (!lodashEs.isFunction(obj)) {
return false;
}
return !isVue.isVueComponent(obj);
}
exports.isDynamicSetter = isDynamicSetter;
//# sourceMappingURL=is-dynamic-setter.js.map
{"version":3,"file":"is-dynamic-setter.js","sources":["../../../src/check-types/is-dynamic-setter.ts"],"sourcesContent":["import { isFunction } from 'lodash-es';\nimport { IPublicTypeDynamicSetter } from '@arvin-shu/microcode-types';\nimport { isVueComponent } from '../is-vue';\n\nexport function isDynamicSetter(obj: any): obj is IPublicTypeDynamicSetter {\n\tif (!isFunction(obj)) {\n\t\treturn false;\n\t}\n\treturn !isVueComponent(obj);\n}\n"],"names":["isFunction","isVueComponent"],"mappings":";;;;;;AAIO,SAAS,gBAAgB,GAA2C,EAAA;AAC1E,EAAI,IAAA,CAACA,mBAAW,CAAA,GAAG,CAAG,EAAA;AACrB,IAAO,OAAA,KAAA;AAAA;AAER,EAAO,OAAA,CAACC,qBAAe,GAAG,CAAA;AAC3B;;;;"}
export declare function isFunction(obj: any): obj is Function;
'use strict';
"use strict";
function isFunction(obj) {
return obj && typeof obj === "function";
}
exports.isFunction = isFunction;
//# sourceMappingURL=is-function.js.map
{"version":3,"file":"is-function.js","sources":["../../../src/check-types/is-function.ts"],"sourcesContent":["export function isFunction(obj: any): obj is Function {\n\treturn obj && typeof obj === 'function';\n}\n"],"names":[],"mappings":";;;AAAO,SAAS,WAAW,GAA2B,EAAA;AACrD,EAAO,OAAA,GAAA,IAAO,OAAO,GAAQ,KAAA,UAAA;AAC9B;;;;"}
import { IPublicTypeI18nData } from '@arvin-shu/microcode-types';
export declare function isI18nData(obj: any): obj is IPublicTypeI18nData;
'use strict';
var isObject = require('../is-object.js');
"use strict";
function isI18nData(obj) {
if (!isObject.isObject(obj)) {
return false;
}
return obj.type === "i18n";
}
exports.isI18nData = isI18nData;
//# sourceMappingURL=is-i18n-data.js.map
{"version":3,"file":"is-i18n-data.js","sources":["../../../src/check-types/is-i18n-data.ts"],"sourcesContent":["import { IPublicTypeI18nData } from '@arvin-shu/microcode-types';\nimport { isObject } from '../is-object';\n\nexport function isI18nData(obj: any): obj is IPublicTypeI18nData {\n\tif (!isObject(obj)) {\n\t\treturn false;\n\t}\n\treturn obj.type === 'i18n';\n}\n"],"names":["isObject"],"mappings":";;;;;AAGO,SAAS,WAAW,GAAsC,EAAA;AAChE,EAAI,IAAA,CAACA,iBAAS,CAAA,GAAG,CAAG,EAAA;AACnB,IAAO,OAAA,KAAA;AAAA;AAER,EAAA,OAAO,IAAI,IAAS,KAAA,MAAA;AACrB;;;;"}
import { IPublicTypeJSFunction } from '@arvin-shu/microcode-types';
interface InnerJsFunction {
type: 'JSExpression';
source: string;
value: string;
extType: 'function';
}
/**
* 内部版本 的 { type: 'JSExpression', source: '', value: '', extType: 'function' } 能力上等同于 JSFunction
*/
export declare function isInnerJsFunction(data: any): data is InnerJsFunction;
export declare function isJSFunction(data: any): data is IPublicTypeJSFunction;
export {};
'use strict';
var isObject = require('../is-object.js');
"use strict";
function isInnerJsFunction(data) {
if (!isObject.isObject(data)) {
return false;
}
return data.type === "JSExpression" && data.extType === "function";
}
function isJSFunction(data) {
if (!isObject.isObject(data)) {
return false;
}
return data.type === "JSFunction" || isInnerJsFunction(data);
}
exports.isInnerJsFunction = isInnerJsFunction;
exports.isJSFunction = isJSFunction;
//# sourceMappingURL=is-isfunction.js.map
{"version":3,"file":"is-isfunction.js","sources":["../../../src/check-types/is-isfunction.ts"],"sourcesContent":["import { IPublicTypeJSFunction } from '@arvin-shu/microcode-types';\nimport { isObject } from '../is-object';\n\ninterface InnerJsFunction {\n\ttype: 'JSExpression';\n\tsource: string;\n\tvalue: string;\n\textType: 'function';\n}\n\n/**\n * 内部版本 的 { type: 'JSExpression', source: '', value: '', extType: 'function' } 能力上等同于 JSFunction\n */\nexport function isInnerJsFunction(data: any): data is InnerJsFunction {\n\tif (!isObject(data)) {\n\t\treturn false;\n\t}\n\treturn data.type === 'JSExpression' && data.extType === 'function';\n}\n\nexport function isJSFunction(data: any): data is IPublicTypeJSFunction {\n\tif (!isObject(data)) {\n\t\treturn false;\n\t}\n\treturn data.type === 'JSFunction' || isInnerJsFunction(data);\n}\n"],"names":["isObject"],"mappings":";;;;;AAaO,SAAS,kBAAkB,IAAoC,EAAA;AACrE,EAAI,IAAA,CAACA,iBAAS,CAAA,IAAI,CAAG,EAAA;AACpB,IAAO,OAAA,KAAA;AAAA;AAER,EAAA,OAAO,IAAK,CAAA,IAAA,KAAS,cAAkB,IAAA,IAAA,CAAK,OAAY,KAAA,UAAA;AACzD;AAEO,SAAS,aAAa,IAA0C,EAAA;AACtE,EAAI,IAAA,CAACA,iBAAS,CAAA,IAAI,CAAG,EAAA;AACpB,IAAO,OAAA,KAAA;AAAA;AAER,EAAA,OAAO,IAAK,CAAA,IAAA,KAAS,YAAgB,IAAA,iBAAA,CAAkB,IAAI,CAAA;AAC5D;;;;;"}
import { IPublicTypeJSExpression } from '@arvin-shu/microcode-types';
export declare function isJSExpression(data: any): data is IPublicTypeJSExpression;
'use strict';
var isObject = require('../is-object.js');
"use strict";
function isJSExpression(data) {
if (!isObject.isObject(data)) {
return false;
}
return data.type === "JSExpression" && data.extType !== "function";
}
exports.isJSExpression = isJSExpression;
//# sourceMappingURL=is-jsexpression.js.map
{"version":3,"file":"is-jsexpression.js","sources":["../../../src/check-types/is-jsexpression.ts"],"sourcesContent":["import { IPublicTypeJSExpression } from '@arvin-shu/microcode-types';\nimport { isObject } from '../is-object';\n\nexport function isJSExpression(data: any): data is IPublicTypeJSExpression {\n\tif (!isObject(data)) {\n\t\treturn false;\n\t}\n\treturn data.type === 'JSExpression' && data.extType !== 'function';\n}\n"],"names":["isObject"],"mappings":";;;;;AAGO,SAAS,eAAe,IAA4C,EAAA;AAC1E,EAAI,IAAA,CAACA,iBAAS,CAAA,IAAI,CAAG,EAAA;AACpB,IAAO,OAAA,KAAA;AAAA;AAER,EAAA,OAAO,IAAK,CAAA,IAAA,KAAS,cAAkB,IAAA,IAAA,CAAK,OAAY,KAAA,UAAA;AACzD;;;;"}
import { IPublicTypeJSSlot } from '@arvin-shu/microcode-types';
export declare function isJSSlot(data: any): data is IPublicTypeJSSlot;
'use strict';
var isObject = require('../is-object.js');
"use strict";
function isJSSlot(data) {
if (!isObject.isObject(data)) {
return false;
}
return data.type === "JSSlot";
}
exports.isJSSlot = isJSSlot;
//# sourceMappingURL=is-jsslot.js.map
{"version":3,"file":"is-jsslot.js","sources":["../../../src/check-types/is-jsslot.ts"],"sourcesContent":["import { IPublicTypeJSSlot } from '@arvin-shu/microcode-types';\nimport { isObject } from '../is-object';\n\nexport function isJSSlot(data: any): data is IPublicTypeJSSlot {\n\tif (!isObject(data)) {\n\t\treturn false;\n\t}\n\treturn data.type === 'JSSlot';\n}\n"],"names":["isObject"],"mappings":";;;;;AAGO,SAAS,SAAS,IAAsC,EAAA;AAC9D,EAAI,IAAA,CAACA,iBAAS,CAAA,IAAI,CAAG,EAAA;AACpB,IAAO,OAAA,KAAA;AAAA;AAER,EAAA,OAAO,KAAK,IAAS,KAAA,QAAA;AACtB;;;;"}
import { IPublicTypeLocationChildrenDetail } from '@arvin-shu/microcode-types';
export declare function isLocationChildrenDetail(obj: any): obj is IPublicTypeLocationChildrenDetail;
'use strict';
var microcodeTypes = require('@arvin-shu/microcode-types');
var isObject = require('../is-object.js');
"use strict";
function isLocationChildrenDetail(obj) {
if (!isObject.isObject(obj)) {
return false;
}
return obj.type === microcodeTypes.IPublicTypeLocationDetailType.Children;
}
exports.isLocationChildrenDetail = isLocationChildrenDetail;
//# sourceMappingURL=is-location-children-detail.js.map
{"version":3,"file":"is-location-children-detail.js","sources":["../../../src/check-types/is-location-children-detail.ts"],"sourcesContent":["import {\n\tIPublicTypeLocationChildrenDetail,\n\tIPublicTypeLocationDetailType,\n} from '@arvin-shu/microcode-types';\nimport { isObject } from '../is-object';\n\nexport function isLocationChildrenDetail(\n\tobj: any\n): obj is IPublicTypeLocationChildrenDetail {\n\tif (!isObject(obj)) {\n\t\treturn false;\n\t}\n\treturn obj.type === IPublicTypeLocationDetailType.Children;\n}\n"],"names":["isObject","IPublicTypeLocationDetailType"],"mappings":";;;;;;AAMO,SAAS,yBACf,GAC2C,EAAA;AAC3C,EAAI,IAAA,CAACA,iBAAS,CAAA,GAAG,CAAG,EAAA;AACnB,IAAO,OAAA,KAAA;AAAA;AAER,EAAO,OAAA,GAAA,CAAI,SAASC,4CAA8B,CAAA,QAAA;AACnD;;;;"}
import { IPublicTypeLocationData } from '@arvin-shu/microcode-types';
export declare function isLocationData(obj: any): obj is IPublicTypeLocationData;
'use strict';
var isObject = require('../is-object.js');
"use strict";
function isLocationData(obj) {
if (!isObject.isObject(obj)) {
return false;
}
return "target" in obj && "detail" in obj;
}
exports.isLocationData = isLocationData;
//# sourceMappingURL=is-location-data.js.map
{"version":3,"file":"is-location-data.js","sources":["../../../src/check-types/is-location-data.ts"],"sourcesContent":["import { IPublicTypeLocationData } from '@arvin-shu/microcode-types';\nimport { isObject } from '../is-object';\n\nexport function isLocationData(obj: any): obj is IPublicTypeLocationData {\n\tif (!isObject(obj)) {\n\t\treturn false;\n\t}\n\treturn 'target' in obj && 'detail' in obj;\n}\n"],"names":["isObject"],"mappings":";;;;;AAGO,SAAS,eAAe,GAA0C,EAAA;AACxE,EAAI,IAAA,CAACA,iBAAS,CAAA,GAAG,CAAG,EAAA;AACnB,IAAO,OAAA,KAAA;AAAA;AAER,EAAO,OAAA,QAAA,IAAY,OAAO,QAAY,IAAA,GAAA;AACvC;;;;"}
import { IPublicTypeComponentMap, IPublicTypeMicrocodeComponent } from '@arvin-shu/microcode-types';
export declare function isMicrocodeComponentType(desc: IPublicTypeComponentMap): desc is IPublicTypeMicrocodeComponent;
'use strict';
var isProcodeComponentType = require('./is-procode-component-type.js');
"use strict";
function isMicrocodeComponentType(desc) {
return !isProcodeComponentType.isProCodeComponentType(desc);
}
exports.isMicrocodeComponentType = isMicrocodeComponentType;
//# sourceMappingURL=is-microcode-component-type.js.map
{"version":3,"file":"is-microcode-component-type.js","sources":["../../../src/check-types/is-microcode-component-type.ts"],"sourcesContent":["import {\n\tIPublicTypeComponentMap,\n\tIPublicTypeMicrocodeComponent,\n} from '@arvin-shu/microcode-types';\nimport { isProCodeComponentType } from './is-procode-component-type';\n\nexport function isMicrocodeComponentType(\n\tdesc: IPublicTypeComponentMap\n): desc is IPublicTypeMicrocodeComponent {\n\treturn !isProCodeComponentType(desc);\n}\n"],"names":["isProCodeComponentType"],"mappings":";;;;;AAMO,SAAS,yBACf,IACwC,EAAA;AACxC,EAAO,OAAA,CAACA,8CAAuB,IAAI,CAAA;AACpC;;;;"}
import { IPublicTypeNodeSchema } from '@arvin-shu/microcode-types';
export declare function isNodeSchema(data: any): data is IPublicTypeNodeSchema;
'use strict';
var isObject = require('../is-object.js');
"use strict";
function isNodeSchema(data) {
if (!isObject.isObject(data)) {
return false;
}
return "componentName" in data && !data.isNode;
}
exports.isNodeSchema = isNodeSchema;
//# sourceMappingURL=is-node-schema.js.map
{"version":3,"file":"is-node-schema.js","sources":["../../../src/check-types/is-node-schema.ts"],"sourcesContent":["import { IPublicTypeNodeSchema } from '@arvin-shu/microcode-types';\nimport { isObject } from '../is-object';\n\nexport function isNodeSchema(data: any): data is IPublicTypeNodeSchema {\n\tif (!isObject(data)) {\n\t\treturn false;\n\t}\n\treturn 'componentName' in data && !data.isNode;\n}\n"],"names":["isObject"],"mappings":";;;;;AAGO,SAAS,aAAa,IAA0C,EAAA;AACtE,EAAI,IAAA,CAACA,iBAAS,CAAA,IAAI,CAAG,EAAA;AACpB,IAAO,OAAA,KAAA;AAAA;AAER,EAAO,OAAA,eAAA,IAAmB,IAAQ,IAAA,CAAC,IAAK,CAAA,MAAA;AACzC;;;;"}
import { IPublicModelNode } from '@arvin-shu/microcode-types';
export declare function isNode<Node = IPublicModelNode>(node: any): node is Node;
'use strict';
var isObject = require('../is-object.js');
"use strict";
function isNode(node) {
if (!isObject.isObject(node)) {
return false;
}
return node.isNode;
}
exports.isNode = isNode;
//# sourceMappingURL=is-node.js.map
{"version":3,"file":"is-node.js","sources":["../../../src/check-types/is-node.ts"],"sourcesContent":["import { IPublicModelNode } from '@arvin-shu/microcode-types';\nimport { isObject } from '../is-object';\n\nexport function isNode<Node = IPublicModelNode>(node: any): node is Node {\n\tif (!isObject(node)) {\n\t\treturn false;\n\t}\n\treturn node.isNode;\n}\n"],"names":["isObject"],"mappings":";;;;;AAGO,SAAS,OAAgC,IAAyB,EAAA;AACxE,EAAI,IAAA,CAACA,iBAAS,CAAA,IAAI,CAAG,EAAA;AACpB,IAAO,OAAA,KAAA;AAAA;AAER,EAAA,OAAO,IAAK,CAAA,MAAA;AACb;;;;"}
import { IPublicTypeComponentMap, IPublicTypeProCodeComponent } from '@arvin-shu/microcode-types';
export declare function isProCodeComponentType(desc: IPublicTypeComponentMap): desc is IPublicTypeProCodeComponent;
'use strict';
var isObject = require('../is-object.js');
"use strict";
function isProCodeComponentType(desc) {
if (!isObject.isObject(desc)) {
return false;
}
return "package" in desc;
}
exports.isProCodeComponentType = isProCodeComponentType;
//# sourceMappingURL=is-procode-component-type.js.map
{"version":3,"file":"is-procode-component-type.js","sources":["../../../src/check-types/is-procode-component-type.ts"],"sourcesContent":["import {\n\tIPublicTypeComponentMap,\n\tIPublicTypeProCodeComponent,\n} from '@arvin-shu/microcode-types';\nimport { isObject } from '../is-object';\n\nexport function isProCodeComponentType(\n\tdesc: IPublicTypeComponentMap\n): desc is IPublicTypeProCodeComponent {\n\tif (!isObject(desc)) {\n\t\treturn false;\n\t}\n\n\treturn 'package' in desc;\n}\n"],"names":["isObject"],"mappings":";;;;;AAMO,SAAS,uBACf,IACsC,EAAA;AACtC,EAAI,IAAA,CAACA,iBAAS,CAAA,IAAI,CAAG,EAAA;AACpB,IAAO,OAAA,KAAA;AAAA;AAGR,EAAA,OAAO,SAAa,IAAA,IAAA;AACrB;;;;"}
import { IPublicTypeProjectSchema } from '@arvin-shu/microcode-types';
export declare function isProjectSchema(data: any): data is IPublicTypeProjectSchema;
'use strict';
var isObject = require('../is-object.js');
"use strict";
function isProjectSchema(data) {
if (!isObject.isObject(data)) {
return false;
}
return "componentsTree" in data;
}
exports.isProjectSchema = isProjectSchema;
//# sourceMappingURL=is-project-schema.js.map
{"version":3,"file":"is-project-schema.js","sources":["../../../src/check-types/is-project-schema.ts"],"sourcesContent":["import { IPublicTypeProjectSchema } from '@arvin-shu/microcode-types';\nimport { isObject } from '../is-object';\n\nexport function isProjectSchema(data: any): data is IPublicTypeProjectSchema {\n\tif (!isObject(data)) {\n\t\treturn false;\n\t}\n\treturn 'componentsTree' in data;\n}\n"],"names":["isObject"],"mappings":";;;;;AAGO,SAAS,gBAAgB,IAA6C,EAAA;AAC5E,EAAI,IAAA,CAACA,iBAAS,CAAA,IAAI,CAAG,EAAA;AACpB,IAAO,OAAA,KAAA;AAAA;AAER,EAAA,OAAO,gBAAoB,IAAA,IAAA;AAC5B;;;;"}
import { IPublicTypePropType, IPublicTypeRequiredType } from '@arvin-shu/microcode-types';
export declare function isRequiredPropType(propType: IPublicTypePropType): propType is IPublicTypeRequiredType;
'use strict';
"use strict";
function isRequiredPropType(propType) {
if (!propType) {
return false;
}
return typeof propType === "object" && propType.type && [
"array",
"bool",
"func",
"number",
"object",
"string",
"node",
"element",
"any"
].includes(propType.type);
}
exports.isRequiredPropType = isRequiredPropType;
//# sourceMappingURL=is-required-prop-type.js.map
{"version":3,"file":"is-required-prop-type.js","sources":["../../../src/check-types/is-required-prop-type.ts"],"sourcesContent":["import {\n\tIPublicTypePropType,\n\tIPublicTypeRequiredType,\n} from '@arvin-shu/microcode-types';\n\nexport function isRequiredPropType(\n\tpropType: IPublicTypePropType\n): propType is IPublicTypeRequiredType {\n\tif (!propType) {\n\t\treturn false;\n\t}\n\treturn (\n\t\ttypeof propType === 'object' &&\n\t\tpropType.type &&\n\t\t[\n\t\t\t'array',\n\t\t\t'bool',\n\t\t\t'func',\n\t\t\t'number',\n\t\t\t'object',\n\t\t\t'string',\n\t\t\t'node',\n\t\t\t'element',\n\t\t\t'any',\n\t\t].includes(propType.type)\n\t);\n}\n"],"names":[],"mappings":";;;AAKO,SAAS,mBACf,QACsC,EAAA;AACtC,EAAA,IAAI,CAAC,QAAU,EAAA;AACd,IAAO,OAAA,KAAA;AAAA;AAER,EAAA,OACC,OAAO,QAAA,KAAa,QACpB,IAAA,QAAA,CAAS,IACT,IAAA;AAAA,IACC,OAAA;AAAA,IACA,MAAA;AAAA,IACA,MAAA;AAAA,IACA,QAAA;AAAA,IACA,QAAA;AAAA,IACA,QAAA;AAAA,IACA,MAAA;AAAA,IACA,SAAA;AAAA,IACA;AAAA,GACD,CAAE,QAAS,CAAA,QAAA,CAAS,IAAI,CAAA;AAE1B;;;;"}
import { IPublicTypeSetterConfig } from '@arvin-shu/microcode-types';
export declare function isSetterConfig(obj: any): obj is IPublicTypeSetterConfig;
'use strict';
var isCustomView = require('./is-custom-view.js');
var isObject = require('../is-object.js');
"use strict";
function isSetterConfig(obj) {
if (!isObject.isObject(obj)) {
return false;
}
return "componentName" in obj && !isCustomView.isCustomView(obj);
}
exports.isSetterConfig = isSetterConfig;
//# sourceMappingURL=is-setter-config.js.map
{"version":3,"file":"is-setter-config.js","sources":["../../../src/check-types/is-setter-config.ts"],"sourcesContent":["import { IPublicTypeSetterConfig } from '@arvin-shu/microcode-types';\nimport { isCustomView } from './is-custom-view';\nimport { isObject } from '../is-object';\n\nexport function isSetterConfig(obj: any): obj is IPublicTypeSetterConfig {\n\tif (!isObject(obj)) {\n\t\treturn false;\n\t}\n\treturn 'componentName' in obj && !isCustomView(obj);\n}\n"],"names":["isObject","isCustomView"],"mappings":";;;;;;AAIO,SAAS,eAAe,GAA0C,EAAA;AACxE,EAAI,IAAA,CAACA,iBAAS,CAAA,GAAG,CAAG,EAAA;AACnB,IAAO,OAAA,KAAA;AAAA;AAER,EAAA,OAAO,eAAmB,IAAA,GAAA,IAAO,CAACC,yBAAA,CAAa,GAAG,CAAA;AACnD;;;;"}
import { IPublicModelSettingField } from '@arvin-shu/microcode-types';
export declare function isSettingField(obj: any): obj is IPublicModelSettingField;
'use strict';
var isObject = require('../is-object.js');
"use strict";
function isSettingField(obj) {
if (!isObject.isObject(obj)) {
return false;
}
return "isSettingField" in obj && obj.isSettingField;
}
exports.isSettingField = isSettingField;
//# sourceMappingURL=is-setting-field.js.map
{"version":3,"file":"is-setting-field.js","sources":["../../../src/check-types/is-setting-field.ts"],"sourcesContent":["import { IPublicModelSettingField } from '@arvin-shu/microcode-types';\nimport { isObject } from '../is-object';\n\nexport function isSettingField(obj: any): obj is IPublicModelSettingField {\n\tif (!isObject(obj)) {\n\t\treturn false;\n\t}\n\n\treturn 'isSettingField' in obj && obj.isSettingField;\n}\n"],"names":["isObject"],"mappings":";;;;;AAGO,SAAS,eAAe,GAA2C,EAAA;AACzE,EAAI,IAAA,CAACA,iBAAS,CAAA,GAAG,CAAG,EAAA;AACnB,IAAO,OAAA,KAAA;AAAA;AAGR,EAAO,OAAA,gBAAA,IAAoB,OAAO,GAAI,CAAA,cAAA;AACvC;;;;"}
import { IPublicTypeTitleConfig } from '@arvin-shu/microcode-types';
export declare function isTitleConfig(obj: any): obj is IPublicTypeTitleConfig;
'use strict';
var isI18nData = require('./is-i18n-data.js');
var isPlainObject = require('../is-plain-object.js');
"use strict";
function isTitleConfig(obj) {
return isPlainObject.isPlainObject(obj) && !isI18nData.isI18nData(obj);
}
exports.isTitleConfig = isTitleConfig;
//# sourceMappingURL=is-title-config.js.map
{"version":3,"file":"is-title-config.js","sources":["../../../src/check-types/is-title-config.ts"],"sourcesContent":["import { IPublicTypeTitleConfig } from '@arvin-shu/microcode-types';\nimport { isI18nData } from './is-i18n-data';\nimport { isPlainObject } from '../is-plain-object';\n\nexport function isTitleConfig(obj: any): obj is IPublicTypeTitleConfig {\n\treturn isPlainObject(obj) && !isI18nData(obj);\n}\n"],"names":["isPlainObject","isI18nData"],"mappings":";;;;;;AAIO,SAAS,cAAc,GAAyC,EAAA;AACtE,EAAA,OAAOA,2BAAc,CAAA,GAAG,CAAK,IAAA,CAACC,sBAAW,GAAG,CAAA;AAC7C;;;;"}
export declare function cloneDeep(src: any): any;
'use strict';
var isPlainObject = require('./is-plain-object.js');
"use strict";
function cloneDeep(src) {
const type = typeof src;
let data;
if (src === null || src === void 0) {
data = src;
} else if (Array.isArray(src)) {
data = src.map((item) => cloneDeep(item));
} else if (type === "object" && isPlainObject.isPlainObject(src)) {
data = {};
for (const key in src) {
if (src.hasOwnProperty(key)) {
data[key] = cloneDeep(src[key]);
}
}
} else {
data = src;
}
return data;
}
exports.cloneDeep = cloneDeep;
//# sourceMappingURL=clone-deep.js.map
{"version":3,"file":"clone-deep.js","sources":["../../src/clone-deep.ts"],"sourcesContent":["import { isPlainObject } from './is-plain-object';\n\nexport function cloneDeep(src: any): any {\n\tconst type = typeof src;\n\n\tlet data: any;\n\tif (src === null || src === undefined) {\n\t\tdata = src;\n\t} else if (Array.isArray(src)) {\n\t\tdata = src.map((item) => cloneDeep(item));\n\t} else if (type === 'object' && isPlainObject(src)) {\n\t\tdata = {};\n\t\tfor (const key in src) {\n\t\t\t// eslint-disable-next-line no-prototype-builtins\n\t\t\tif (src.hasOwnProperty(key)) {\n\t\t\t\tdata[key] = cloneDeep(src[key]);\n\t\t\t}\n\t\t}\n\t} else {\n\t\tdata = src;\n\t}\n\n\treturn data;\n}\n"],"names":["isPlainObject"],"mappings":";;;;;AAEO,SAAS,UAAU,GAAe,EAAA;AACxC,EAAA,MAAM,OAAO,OAAO,GAAA;AAEpB,EAAI,IAAA,IAAA;AACJ,EAAI,IAAA,GAAA,KAAQ,IAAQ,IAAA,GAAA,KAAQ,KAAW,CAAA,EAAA;AACtC,IAAO,IAAA,GAAA,GAAA;AAAA,GACG,MAAA,IAAA,KAAA,CAAM,OAAQ,CAAA,GAAG,CAAG,EAAA;AAC9B,IAAA,IAAA,GAAO,IAAI,GAAI,CAAA,CAAC,IAAS,KAAA,SAAA,CAAU,IAAI,CAAC,CAAA;AAAA,GAC9B,MAAA,IAAA,IAAA,KAAS,QAAY,IAAAA,2BAAA,CAAc,GAAG,CAAG,EAAA;AACnD,IAAA,IAAA,GAAO,EAAC;AACR,IAAA,KAAA,MAAW,OAAO,GAAK,EAAA;AAEtB,MAAI,IAAA,GAAA,CAAI,cAAe,CAAA,GAAG,CAAG,EAAA;AAC5B,QAAA,IAAA,CAAK,GAAG,CAAA,GAAI,SAAU,CAAA,GAAA,CAAI,GAAG,CAAC,CAAA;AAAA;AAC/B;AACD,GACM,MAAA;AACN,IAAO,IAAA,GAAA,GAAA;AAAA;AAGR,EAAO,OAAA,IAAA;AACR;;;;"}
import { Component, VNode } from 'vue';
export declare function createContent(content: string | VNode | Component, props?: Record<string, unknown>): VNode;
'use strict';
var vue = require('vue');
var lodashEs = require('lodash-es');
var isVue = require('./is-vue.js');
"use strict";
function createContent(content, props) {
if (lodashEs.isString(content)) {
return vue.h("span", content);
}
if (vue.isVNode(content)) {
return props ? vue.cloneVNode(content, props) : content;
}
if (isVue.isVueComponent(content)) {
return vue.h(content, props);
}
return content;
}
exports.createContent = createContent;
//# sourceMappingURL=create-content.js.map
{"version":3,"file":"create-content.js","sources":["../../src/create-content.ts"],"sourcesContent":["import { cloneVNode, Component, isVNode, VNode, h } from 'vue';\nimport { isString } from 'lodash-es';\nimport { isVueComponent } from './is-vue';\n\nexport function createContent(\n\tcontent: string | VNode | Component,\n\tprops?: Record<string, unknown>\n): VNode {\n\tif (isString(content)) {\n\t\treturn h('span', content);\n\t}\n\tif (isVNode(content)) {\n\t\treturn props ? cloneVNode(content, props) : content;\n\t}\n\tif (isVueComponent(content)) {\n\t\treturn h(content, props);\n\t}\n\treturn content;\n}\n"],"names":["isString","h","isVNode","cloneVNode","isVueComponent"],"mappings":";;;;;;;AAIgB,SAAA,aAAA,CACf,SACA,KACQ,EAAA;AACR,EAAI,IAAAA,iBAAA,CAAS,OAAO,CAAG,EAAA;AACtB,IAAO,OAAAC,KAAA,CAAE,QAAQ,OAAO,CAAA;AAAA;AAEzB,EAAI,IAAAC,WAAA,CAAQ,OAAO,CAAG,EAAA;AACrB,IAAA,OAAO,KAAQ,GAAAC,cAAA,CAAW,OAAS,EAAA,KAAK,CAAI,GAAA,OAAA;AAAA;AAE7C,EAAI,IAAAC,oBAAA,CAAe,OAAO,CAAG,EAAA;AAC5B,IAAO,OAAAH,KAAA,CAAE,SAAS,KAAK,CAAA;AAAA;AAExB,EAAO,OAAA,OAAA;AACR;;;;"}
export interface Defer<T = any> {
resolve(value?: T | PromiseLike<T>): void;
reject(reason?: any): void;
promise(): Promise<T>;
}
export declare function createDefer<T = any>(): Defer<T>;
'use strict';
"use strict";
function createDefer() {
const r = {};
const promise = new Promise((resolve, reject) => {
r.resolve = resolve;
r.reject = reject;
});
r.promise = () => promise;
return r;
}
exports.createDefer = createDefer;
//# sourceMappingURL=create-defer.js.map
{"version":3,"file":"create-defer.js","sources":["../../src/create-defer.ts"],"sourcesContent":["export interface Defer<T = any> {\n\tresolve(value?: T | PromiseLike<T>): void;\n\treject(reason?: any): void;\n\tpromise(): Promise<T>;\n}\n\nexport function createDefer<T = any>(): Defer<T> {\n\tconst r: any = {};\n\tconst promise = new Promise<T>((resolve, reject) => {\n\t\tr.resolve = resolve;\n\t\tr.reject = reject;\n\t});\n\n\tr.promise = () => promise;\n\n\treturn r;\n}\n"],"names":[],"mappings":";;;AAMO,SAAS,WAAiC,GAAA;AAChD,EAAA,MAAM,IAAS,EAAC;AAChB,EAAA,MAAM,OAAU,GAAA,IAAI,OAAW,CAAA,CAAC,SAAS,MAAW,KAAA;AACnD,IAAA,CAAA,CAAE,OAAU,GAAA,OAAA;AACZ,IAAA,CAAA,CAAE,MAAS,GAAA,MAAA;AAAA,GACX,CAAA;AAED,EAAA,CAAA,CAAE,UAAU,MAAM,OAAA;AAElB,EAAO,OAAA,CAAA;AACR;;;;"}
import { IPublicTypeIconType } from '@arvin-shu/microcode-types';
/**
* 创建图标组件
* @param icon - 图标类型或组件
* @param props - 组件属性
* @returns 图标组件
*/
export declare function createIcon(icon?: IPublicTypeIconType | null, props?: Record<string, unknown>): any;
export declare const IconWrapper: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
type: {
type: StringConstructor;
required: true;
};
iconProps: {
type: () => Record<string, unknown>;
default: () => {};
};
}>, () => any, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
type: {
type: StringConstructor;
required: true;
};
iconProps: {
type: () => Record<string, unknown>;
default: () => {};
};
}>> & Readonly<{}>, {
iconProps: Record<string, unknown>;
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
'use strict';
var vue = require('vue');
var AntIcons = require('@ant-design/icons-vue');
var isEsModule = require('./is-es-module.js');
var isVue = require('./is-vue.js');
function _interopNamespaceDefault(e) {
var n = Object.create(null);
if (e) {
Object.keys(e).forEach(function (k) {
if (k !== 'default') {
var d = Object.getOwnPropertyDescriptor(e, k);
Object.defineProperty(n, k, d.get ? d : {
enumerable: true,
get: function () { return e[k]; }
});
}
});
}
n.default = e;
return Object.freeze(n);
}
var AntIcons__namespace = /*#__PURE__*/_interopNamespaceDefault(AntIcons);
"use strict";
const URL_RE = /^(https?:)\/\//i;
function createIcon(icon, props) {
if (!icon) {
return vue.createVNode(vue.Fragment, null, null);
}
if (isEsModule.isESModule(icon)) {
icon = icon.default;
}
if (typeof icon === "string") {
if (URL_RE.test(icon)) {
return vue.h("img", {
src: icon,
class: props?.className,
...props
});
}
return vue.createVNode(IconWrapper, vue.mergeProps({
"type": icon
}, props), null);
}
if (vue.isVNode(icon)) {
return vue.cloneVNode(icon, {
...props
});
}
if (isVue.isVueComponent(icon)) {
return vue.h(icon, {
class: props?.className,
...props
});
}
}
const IconWrapper = /* @__PURE__ */ vue.defineComponent({
name: "IconWrapper",
props: {
type: {
type: String,
required: true
},
iconProps: {
type: Object,
default: () => ({})
}
},
setup(props) {
const IconComponent = AntIcons__namespace[props.type];
return () => IconComponent ? vue.createVNode(IconComponent, props.iconProps, null) : vue.createVNode(vue.Fragment, null, null);
}
});
exports.IconWrapper = IconWrapper;
exports.createIcon = createIcon;
//# sourceMappingURL=create-icon.js.map
{"version":3,"file":"create-icon.js","sources":["../../src/create-icon.tsx"],"sourcesContent":["import { cloneVNode, defineComponent, Fragment, h, isVNode } from 'vue';\nimport { IPublicTypeIconType } from '@arvin-shu/microcode-types';\nimport * as AntIcons from '@ant-design/icons-vue'; // 导入所有图标\nimport { isESModule } from './is-es-module';\nimport { isVueComponent } from './is-vue';\n\nconst URL_RE = /^(https?:)\\/\\//i;\n\n/**\n * 创建图标组件\n * @param icon - 图标类型或组件\n * @param props - 组件属性\n * @returns 图标组件\n */\nexport function createIcon(\n\ticon?: IPublicTypeIconType | null,\n\tprops?: Record<string, unknown>\n) {\n\tif (!icon) {\n\t\treturn <Fragment></Fragment>;\n\t}\n\tif (isESModule(icon)) {\n\t\ticon = icon.default;\n\t}\n\n\tif (typeof icon === 'string') {\n\t\tif (URL_RE.test(icon)) {\n\t\t\treturn h('img', {\n\t\t\t\tsrc: icon,\n\t\t\t\tclass: props?.className,\n\t\t\t\t...props,\n\t\t\t});\n\t\t}\n\t\treturn <IconWrapper type={icon} {...props} />;\n\t}\n\n\tif (isVNode(icon)) {\n\t\treturn cloneVNode(icon, { ...props });\n\t}\n\tif (isVueComponent(icon)) {\n\t\treturn h(icon, {\n\t\t\tclass: props?.className,\n\t\t\t...props,\n\t\t});\n\t}\n}\n\nexport const IconWrapper = defineComponent({\n\tname: 'IconWrapper',\n\tprops: {\n\t\ttype: {\n\t\t\ttype: String,\n\t\t\trequired: true,\n\t\t},\n\t\ticonProps: {\n\t\t\ttype: Object as () => Record<string, unknown>,\n\t\t\tdefault: () => ({}),\n\t\t},\n\t},\n\tsetup(props) {\n\t\tconst IconComponent: any = AntIcons[props.type as keyof typeof AntIcons];\n\t\treturn () =>\n\t\t\tIconComponent ? (\n\t\t\t\t<IconComponent {...props.iconProps}></IconComponent>\n\t\t\t) : (\n\t\t\t\t<Fragment></Fragment>\n\t\t\t);\n\t},\n});\n"],"names":["URL_RE","createIcon","icon","props","_createVNode","_Fragment","isESModule","default","test","h","src","class","className","IconWrapper","_mergeProps","isVNode","cloneVNode","isVueComponent","defineComponent","name","type","String","required","iconProps","Object","setup","IconComponent","AntIcons"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAMA,MAAMA,MAAS,GAAA,iBAAA;AAQCC,SAAAA,UAAAA,CACfC,MACAC,KACC,EAAA;AACD,EAAA,IAAI,CAACD,IAAM,EAAA;AACV,IAAAE,OAAAA,eAAAA,CAAAC,YAAA,EAAA,IAAA,EAAA,IAAA,CAAA;AAAA;AAED,EAAIC,IAAAA,qBAAAA,CAAWJ,IAAI,CAAG,EAAA;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atB,GAAAA,eAAAA,CAAAsB,aACOvB,EAAAA,KAAAA,CAAMoB,SAAS,EAAA,IAAA,CAAAnB,GAAAA,eAAAA,CAAAC,YAGlC,EAAA,IAAA,EAAA,IAAA,CAAA;AAAA;AAEJ,CAAC;;;;;"}
export declare class Cursor {
private states;
setDragging(flag: boolean): void;
setXResizing(flag: boolean): void;
setYResizing(flag: boolean): void;
setCopy(flag: boolean): void;
isCopy(): boolean;
release(): void;
addState(state: string): void;
private removeState;
}
export declare const cursor: Cursor;
'use strict';
"use strict";
class Cursor {
states = /* @__PURE__ */ new Set();
setDragging(flag) {
if (flag) {
this.addState("dragging");
} else {
this.removeState("dragging");
}
}
setXResizing(flag) {
if (flag) {
this.addState("x-resizing");
} else {
this.removeState("x-resizing");
}
}
setYResizing(flag) {
if (flag) {
this.addState("y-resizing");
} else {
this.removeState("y-resizing");
}
}
setCopy(flag) {
if (flag) {
this.addState("copy");
} else {
this.removeState("copy");
}
}
isCopy() {
return this.states.has("copy");
}
release() {
for (const state of this.states) {
this.removeState(state);
}
}
addState(state) {
if (!this.states.has(state)) {
this.states.add(state);
document.documentElement.classList.add(`mtc-cursor-${state}`);
}
}
removeState(state) {
if (this.states.has(state)) {
this.states.delete(state);
document.documentElement.classList.remove(`mtc-cursor-${state}`);
}
}
}
const cursor = new Cursor();
exports.Cursor = Cursor;
exports.cursor = cursor;
//# sourceMappingURL=cursor.js.map
{"version":3,"file":"cursor.js","sources":["../../src/cursor.ts"],"sourcesContent":["export class Cursor {\n\tprivate states = new Set<string>();\n\n\tsetDragging(flag: boolean) {\n\t\tif (flag) {\n\t\t\tthis.addState('dragging');\n\t\t} else {\n\t\t\tthis.removeState('dragging');\n\t\t}\n\t}\n\n\tsetXResizing(flag: boolean) {\n\t\tif (flag) {\n\t\t\tthis.addState('x-resizing');\n\t\t} else {\n\t\t\tthis.removeState('x-resizing');\n\t\t}\n\t}\n\n\tsetYResizing(flag: boolean) {\n\t\tif (flag) {\n\t\t\tthis.addState('y-resizing');\n\t\t} else {\n\t\t\tthis.removeState('y-resizing');\n\t\t}\n\t}\n\n\tsetCopy(flag: boolean) {\n\t\tif (flag) {\n\t\t\tthis.addState('copy');\n\t\t} else {\n\t\t\tthis.removeState('copy');\n\t\t}\n\t}\n\n\tisCopy() {\n\t\treturn this.states.has('copy');\n\t}\n\n\trelease() {\n\t\tfor (const state of this.states) {\n\t\t\tthis.removeState(state);\n\t\t}\n\t}\n\n\taddState(state: string) {\n\t\tif (!this.states.has(state)) {\n\t\t\tthis.states.add(state);\n\t\t\tdocument.documentElement.classList.add(`mtc-cursor-${state}`);\n\t\t}\n\t}\n\n\tprivate removeState(state: string) {\n\t\tif (this.states.has(state)) {\n\t\t\tthis.states.delete(state);\n\t\t\tdocument.documentElement.classList.remove(`mtc-cursor-${state}`);\n\t\t}\n\t}\n}\n\nexport const cursor = new Cursor();\n"],"names":[],"mappings":";;;AAAO,MAAM,MAAO,CAAA;AAAA,EACX,MAAA,uBAAa,GAAY,EAAA;AAAA,EAEjC,YAAY,IAAe,EAAA;AAC1B,IAAA,IAAI,IAAM,EAAA;AACT,MAAA,IAAA,CAAK,SAAS,UAAU,CAAA;AAAA,KAClB,MAAA;AACN,MAAA,IAAA,CAAK,YAAY,UAAU,CAAA;AAAA;AAC5B;AACD,EAEA,aAAa,IAAe,EAAA;AAC3B,IAAA,IAAI,IAAM,EAAA;AACT,MAAA,IAAA,CAAK,SAAS,YAAY,CAAA;AAAA,KACpB,MAAA;AACN,MAAA,IAAA,CAAK,YAAY,YAAY,CAAA;AAAA;AAC9B;AACD,EAEA,aAAa,IAAe,EAAA;AAC3B,IAAA,IAAI,IAAM,EAAA;AACT,MAAA,IAAA,CAAK,SAAS,YAAY,CAAA;AAAA,KACpB,MAAA;AACN,MAAA,IAAA,CAAK,YAAY,YAAY,CAAA;AAAA;AAC9B;AACD,EAEA,QAAQ,IAAe,EAAA;AACtB,IAAA,IAAI,IAAM,EAAA;AACT,MAAA,IAAA,CAAK,SAAS,MAAM,CAAA;AAAA,KACd,MAAA;AACN,MAAA,IAAA,CAAK,YAAY,MAAM,CAAA;AAAA;AACxB;AACD,EAEA,MAAS,GAAA;AACR,IAAO,OAAA,IAAA,CAAK,MAAO,CAAA,GAAA,CAAI,MAAM,CAAA;AAAA;AAC9B,EAEA,OAAU,GAAA;AACT,IAAW,KAAA,MAAA,KAAA,IAAS,KAAK,MAAQ,EAAA;AAChC,MAAA,IAAA,CAAK,YAAY,KAAK,CAAA;AAAA;AACvB;AACD,EAEA,SAAS,KAAe,EAAA;AACvB,IAAA,IAAI,CAAC,IAAA,CAAK,MAAO,CAAA,GAAA,CAAI,KAAK,CAAG,EAAA;AAC5B,MAAK,IAAA,CAAA,MAAA,CAAO,IAAI,KAAK,CAAA;AACrB,MAAA,QAAA,CAAS,eAAgB,CAAA,SAAA,CAAU,GAAI,CAAA,CAAA,WAAA,EAAc,KAAK,CAAE,CAAA,CAAA;AAAA;AAC7D;AACD,EAEQ,YAAY,KAAe,EAAA;AAClC,IAAA,IAAI,IAAK,CAAA,MAAA,CAAO,GAAI,CAAA,KAAK,CAAG,EAAA;AAC3B,MAAK,IAAA,CAAA,MAAA,CAAO,OAAO,KAAK,CAAA;AACxB,MAAA,QAAA,CAAS,eAAgB,CAAA,SAAA,CAAU,MAAO,CAAA,CAAA,WAAA,EAAc,KAAK,CAAE,CAAA,CAAA;AAAA;AAChE;AAEF;AAEa,MAAA,MAAA,GAAS,IAAI,MAAO;;;;;"}
export declare function hasOwnProperty(obj: any, key: string | number | symbol): boolean;
'use strict';
"use strict";
const prototypeHasOwnProperty = Object.prototype.hasOwnProperty;
function hasOwnProperty(obj, key) {
return obj && prototypeHasOwnProperty.call(obj, key);
}
exports.hasOwnProperty = hasOwnProperty;
//# sourceMappingURL=has-own-property.js.map
{"version":3,"file":"has-own-property.js","sources":["../../src/has-own-property.ts"],"sourcesContent":["const prototypeHasOwnProperty = Object.prototype.hasOwnProperty;\nexport function hasOwnProperty(\n\tobj: any,\n\tkey: string | number | symbol\n): boolean {\n\treturn obj && prototypeHasOwnProperty.call(obj, key);\n}\n"],"names":[],"mappings":";;;AAAA,MAAM,uBAAA,GAA0B,OAAO,SAAU,CAAA,cAAA;AACjC,SAAA,cAAA,CACf,KACA,GACU,EAAA;AACV,EAAA,OAAO,GAAO,IAAA,uBAAA,CAAwB,IAAK,CAAA,GAAA,EAAK,GAAG,CAAA;AACpD;;;;"}
export * from './asset';
export * from './create-content';
export * from './create-defer';
export * from './create-icon';
export * from './has-own-property';
export * from './is-css-url';
export * from './is-es-module';
export * from './is-object';
export * from './is-plain-object';
export * from './is-plugin-event-name';
export * from './is-vue';
export * from './logger';
export * from './script';
export * from './shallow-equal';
export * from './svg-icon';
export * from './unique-id';
export * from './check-types';
export * from './is-element';
export * from './node-helper';
export * from './navtive-selection';
export * from './cursor';
export * from './is-form-event';
export * from './clone-deep';
export * from './misc';
export * from './is-px';
export * from './is-shaken';
export * from './build-components';
export * from './transaction-manager';
'use strict';
var asset = require('./asset.js');
var createContent = require('./create-content.js');
var createDefer = require('./create-defer.js');
var createIcon = require('./create-icon.js');
var hasOwnProperty = require('./has-own-property.js');
var isCssUrl = require('./is-css-url.js');
var isEsModule = require('./is-es-module.js');
var isObject = require('./is-object.js');
var isPlainObject = require('./is-plain-object.js');
var isPluginEventName = require('./is-plugin-event-name.js');
var isVue = require('./is-vue.js');
var logger = require('./logger.js');
var script = require('./script.js');
var shallowEqual = require('./shallow-equal.js');
var svgIcon = require('./svg-icon.js');
var uniqueId = require('./unique-id.js');
require('./check-types/index.js');
var isElement = require('./is-element.js');
var nodeHelper = require('./node-helper.js');
var navtiveSelection = require('./navtive-selection.js');
var cursor = require('./cursor.js');
var isFormEvent = require('./is-form-event.js');
var cloneDeep = require('./clone-deep.js');
var misc = require('./misc.js');
var isPx = require('./is-px.js');
var isShaken = require('./is-shaken.js');
var buildComponents = require('./build-components.js');
var transactionManager = require('./transaction-manager.js');
var isDomText = require('./check-types/is-dom-text.js');
var isI18nData = require('./check-types/is-i18n-data.js');
var isJsexpression = require('./check-types/is-jsexpression.js');
var isJsslot = require('./check-types/is-jsslot.js');
var isNodeSchema = require('./check-types/is-node-schema.js');
var isNode = require('./check-types/is-node.js');
var isTitleConfig = require('./check-types/is-title-config.js');
var isLocationData = require('./check-types/is-location-data.js');
var isDragNodeDataObject = require('./check-types/is-drag-node-data-object.js');
var isDragNodeObject = require('./check-types/is-drag-node-object.js');
var isProcodeComponentType = require('./check-types/is-procode-component-type.js');
var isMicrocodeComponentType = require('./check-types/is-microcode-component-type.js');
var isDragAnyObject = require('./check-types/is-drag-any-object.js');
var isLocationChildrenDetail = require('./check-types/is-location-children-detail.js');
var isCustomView = require('./check-types/is-custom-view.js');
var isSettingField = require('./check-types/is-setting-field.js');
var isDynamicSetter = require('./check-types/is-dynamic-setter.js');
var isSetterConfig = require('./check-types/is-setter-config.js');
var isActionContentObject = require('./check-types/is-action-content-object.js');
var isIsfunction = require('./check-types/is-isfunction.js');
var isBasicPropType = require('./check-types/is-basic-prop-type.js');
var isComponentSchema = require('./check-types/is-component-schema.js');
var isProjectSchema = require('./check-types/is-project-schema.js');
var isRequiredPropType = require('./check-types/is-required-prop-type.js');
"use strict";
exports.AssetLoader = asset.AssetLoader;
exports.StylePoint = asset.StylePoint;
exports.assetBundle = asset.assetBundle;
exports.assetItem = asset.assetItem;
exports.isAssetBundle = asset.isAssetBundle;
exports.isAssetItem = asset.isAssetItem;
exports.mergeAssets = asset.mergeAssets;
exports.createContent = createContent.createContent;
exports.createDefer = createDefer.createDefer;
exports.IconWrapper = createIcon.IconWrapper;
exports.createIcon = createIcon.createIcon;
exports.hasOwnProperty = hasOwnProperty.hasOwnProperty;
exports.isCSSUrl = isCssUrl.isCSSUrl;
exports.isESModule = isEsModule.isESModule;
exports.isI18NObject = isObject.isI18NObject;
exports.isObject = isObject.isObject;
exports.isPlainObject = isPlainObject.isPlainObject;
exports.isPluginEventName = isPluginEventName.isPluginEventName;
exports.isVueComponent = isVue.isVueComponent;
exports.Logger = logger.Logger;
exports.getLogger = logger.getLogger;
exports.evaluate = script.evaluate;
exports.load = script.load;
exports.shallowEqual = shallowEqual.shallowEqual;
exports.SVGIcon = svgIcon.SVGIcon;
exports.uniqueId = uniqueId.uniqueId;
exports.isElement = isElement.isElement;
exports.canClickNode = nodeHelper.canClickNode;
exports.getClosestNode = nodeHelper.getClosestNode;
Object.defineProperty(exports, "nativeSelectionEnabled", {
enumerable: true,
get: function () { return navtiveSelection.nativeSelectionEnabled; }
});
exports.setNativeSelection = navtiveSelection.setNativeSelection;
exports.Cursor = cursor.Cursor;
exports.cursor = cursor.cursor;
exports.isFormEvent = isFormEvent.isFormEvent;
exports.cloneDeep = cloneDeep.cloneDeep;
exports.shouldUseVariableSetter = misc.shouldUseVariableSetter;
exports.isNumber = isPx.isNumber;
exports.isPx = isPx.isPx;
exports.toPx = isPx.toPx;
exports.isShaken = isShaken.isShaken;
exports.accessLibrary = buildComponents.accessLibrary;
exports.buildComponents = buildComponents.buildComponents;
exports.cached = buildComponents.cached;
exports.findComponent = buildComponents.findComponent;
exports.getSubComponent = buildComponents.getSubComponent;
exports.transactionManager = transactionManager.transactionManager;
exports.isDomText = isDomText.isDomText;
exports.isI18nData = isI18nData.isI18nData;
exports.isJSExpression = isJsexpression.isJSExpression;
exports.isJSSlot = isJsslot.isJSSlot;
exports.isNodeSchema = isNodeSchema.isNodeSchema;
exports.isNode = isNode.isNode;
exports.isTitleConfig = isTitleConfig.isTitleConfig;
exports.isLocationData = isLocationData.isLocationData;
exports.isDragNodeDataObject = isDragNodeDataObject.isDragNodeDataObject;
exports.isDragNodeObject = isDragNodeObject.isDragNodeObject;
exports.isProCodeComponentType = isProcodeComponentType.isProCodeComponentType;
exports.isMicrocodeComponentType = isMicrocodeComponentType.isMicrocodeComponentType;
exports.isDragAnyObject = isDragAnyObject.isDragAnyObject;
exports.isLocationChildrenDetail = isLocationChildrenDetail.isLocationChildrenDetail;
exports.isCustomView = isCustomView.isCustomView;
exports.isSettingField = isSettingField.isSettingField;
exports.isDynamicSetter = isDynamicSetter.isDynamicSetter;
exports.isSetterConfig = isSetterConfig.isSetterConfig;
exports.isActionContentObject = isActionContentObject.isActionContentObject;
exports.isInnerJsFunction = isIsfunction.isInnerJsFunction;
exports.isJSFunction = isIsfunction.isJSFunction;
exports.isBasicPropType = isBasicPropType.isBasicPropType;
exports.isComponentSchema = isComponentSchema.isComponentSchema;
exports.isProjectSchema = isProjectSchema.isProjectSchema;
exports.isRequiredPropType = isRequiredPropType.isRequiredPropType;
//# sourceMappingURL=index.js.map
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
export declare function isCSSUrl(url: string): boolean;
'use strict';
"use strict";
function isCSSUrl(url) {
return /\.css(\?.*)?$/.test(url);
}
exports.isCSSUrl = isCSSUrl;
//# sourceMappingURL=is-css-url.js.map
{"version":3,"file":"is-css-url.js","sources":["../../src/is-css-url.ts"],"sourcesContent":["export function isCSSUrl(url: string): boolean {\n\treturn /\\.css(\\?.*)?$/.test(url);\n}\n"],"names":[],"mappings":";;;AAAO,SAAS,SAAS,GAAsB,EAAA;AAC9C,EAAO,OAAA,eAAA,CAAgB,KAAK,GAAG,CAAA;AAChC;;;;"}
export declare function isElement(node: any): node is Element;
'use strict';
"use strict";
function isElement(node) {
if (!node) return false;
return node.nodeType === Node.ELEMENT_NODE;
}
exports.isElement = isElement;
//# sourceMappingURL=is-element.js.map
{"version":3,"file":"is-element.js","sources":["../../src/is-element.ts"],"sourcesContent":["export function isElement(node: any): node is Element {\n\tif (!node) return false;\n\treturn node.nodeType === Node.ELEMENT_NODE;\n}\n"],"names":[],"mappings":";;;AAAO,SAAS,UAAU,IAA4B,EAAA;AACrD,EAAI,IAAA,CAAC,MAAa,OAAA,KAAA;AAClB,EAAO,OAAA,IAAA,CAAK,aAAa,IAAK,CAAA,YAAA;AAC/B;;;;"}
export type ESModule = {
__esModule: true;
default: any;
};
export declare function isESModule(obj: any): obj is ESModule;
'use strict';
"use strict";
function isESModule(obj) {
return obj && obj.__esModule;
}
exports.isESModule = isESModule;
//# sourceMappingURL=is-es-module.js.map
{"version":3,"file":"is-es-module.js","sources":["../../src/is-es-module.ts"],"sourcesContent":["export type ESModule = {\n\t__esModule: true;\n\tdefault: any;\n};\nexport function isESModule(obj: any): obj is ESModule {\n\treturn obj && obj.__esModule;\n}\n"],"names":[],"mappings":";;;AAIO,SAAS,WAAW,GAA2B,EAAA;AACrD,EAAA,OAAO,OAAO,GAAI,CAAA,UAAA;AACnB;;;;"}
/**
* 判断事件是否来自表单元素
* @param e 键盘事件或鼠标事件
* @returns 如果事件来自表单元素返回true,否则返回false
*/
export declare function isFormEvent(e: KeyboardEvent | MouseEvent): boolean;
'use strict';
"use strict";
function isFormEvent(e) {
const t = e.target;
if (!t) {
return false;
}
if (t.form || /^(INPUT|SELECT|TEXTAREA)$/.test(t.tagName)) {
return true;
}
if (t instanceof HTMLElement && /write/.test(
window.getComputedStyle(t).getPropertyValue("-webkit-user-modify")
)) {
return true;
}
return false;
}
exports.isFormEvent = isFormEvent;
//# sourceMappingURL=is-form-event.js.map
{"version":3,"file":"is-form-event.js","sources":["../../src/is-form-event.ts"],"sourcesContent":["/**\n * 判断事件是否来自表单元素\n * @param e 键盘事件或鼠标事件\n * @returns 如果事件来自表单元素返回true,否则返回false\n */\nexport function isFormEvent(e: KeyboardEvent | MouseEvent) {\n\t// 获取事件目标元素并转换为表单元素类型\n\tconst t = e.target as HTMLFormElement;\n\tif (!t) {\n\t\treturn false;\n\t}\n\n\t// 检查是否为表单元素或表单相关的输入元素\n\tif (t.form || /^(INPUT|SELECT|TEXTAREA)$/.test(t.tagName)) {\n\t\treturn true;\n\t}\n\n\t// 检查元素是否可编辑(通过webkit用户修改样式属性)\n\tif (\n\t\tt instanceof HTMLElement &&\n\t\t/write/.test(\n\t\t\twindow.getComputedStyle(t).getPropertyValue('-webkit-user-modify')\n\t\t)\n\t) {\n\t\treturn true;\n\t}\n\treturn false;\n}\n"],"names":[],"mappings":";;;AAKO,SAAS,YAAY,CAA+B,EAAA;AAE1D,EAAA,MAAM,IAAI,CAAE,CAAA,MAAA;AACZ,EAAA,IAAI,CAAC,CAAG,EAAA;AACP,IAAO,OAAA,KAAA;AAAA;AAIR,EAAA,IAAI,EAAE,IAAQ,IAAA,2BAAA,CAA4B,IAAK,CAAA,CAAA,CAAE,OAAO,CAAG,EAAA;AAC1D,IAAO,OAAA,IAAA;AAAA;AAIR,EACC,IAAA,CAAA,YAAa,eACb,OAAQ,CAAA,IAAA;AAAA,IACP,MAAO,CAAA,gBAAA,CAAiB,CAAC,CAAA,CAAE,iBAAiB,qBAAqB;AAAA,GAEjE,EAAA;AACD,IAAO,OAAA,IAAA;AAAA;AAER,EAAO,OAAA,KAAA;AACR;;;;"}
export declare function isObject(value: any): value is Record<string, any>;
export declare function isI18NObject(value: any): boolean;
'use strict';
"use strict";
function isObject(value) {
return value !== null && typeof value === "object";
}
function isI18NObject(value) {
return isObject(value) && value.type === "i18n";
}
exports.isI18NObject = isI18NObject;
exports.isObject = isObject;
//# sourceMappingURL=is-object.js.map
{"version":3,"file":"is-object.js","sources":["../../src/is-object.ts"],"sourcesContent":["export function isObject(value: any): value is Record<string, any> {\n\treturn value !== null && typeof value === 'object';\n}\n\nexport function isI18NObject(value: any): boolean {\n\treturn isObject(value) && value.type === 'i18n';\n}\n"],"names":[],"mappings":";;;AAAO,SAAS,SAAS,KAA0C,EAAA;AAClE,EAAO,OAAA,KAAA,KAAU,IAAQ,IAAA,OAAO,KAAU,KAAA,QAAA;AAC3C;AAEO,SAAS,aAAa,KAAqB,EAAA;AACjD,EAAA,OAAO,QAAS,CAAA,KAAK,CAAK,IAAA,KAAA,CAAM,IAAS,KAAA,MAAA;AAC1C;;;;;"}
/**
* isPlainObject 函数的主要作用是检查一个值是否为纯对象。
* 这在 JavaScript 中很有用,因为不是所有的对象都是通过 {} 或 Object 创建的,
* 有些对象可能是通过构造函数、类或其他方式创建的,具有不同的原型链。
* 这个函数帮助确保对象是标准的、没有定制原型的对象。
*
* @param value
* @returns
*/
export declare function isPlainObject(value: any): value is any;
'use strict';
var isObject = require('./is-object.js');
"use strict";
function isPlainObject(value) {
if (!isObject.isObject(value)) {
return false;
}
const proto = Object.getPrototypeOf(value);
return proto === Object.prototype || proto === null || Object.getPrototypeOf(proto) === null;
}
exports.isPlainObject = isPlainObject;
//# sourceMappingURL=is-plain-object.js.map
{"version":3,"file":"is-plain-object.js","sources":["../../src/is-plain-object.ts"],"sourcesContent":["import { isObject } from './is-object';\n\n/**\n * isPlainObject 函数的主要作用是检查一个值是否为纯对象。\n * 这在 JavaScript 中很有用,因为不是所有的对象都是通过 {} 或 Object 创建的,\n * 有些对象可能是通过构造函数、类或其他方式创建的,具有不同的原型链。\n * 这个函数帮助确保对象是标准的、没有定制原型的对象。\n *\n * @param value\n * @returns\n */\nexport function isPlainObject(value: any): value is any {\n\tif (!isObject(value)) {\n\t\treturn false;\n\t}\n\tconst proto = Object.getPrototypeOf(value);\n\treturn (\n\t\tproto === Object.prototype ||\n\t\tproto === null ||\n\t\tObject.getPrototypeOf(proto) === null\n\t);\n}\n"],"names":["isObject"],"mappings":";;;;;AAWO,SAAS,cAAc,KAA0B,EAAA;AACvD,EAAI,IAAA,CAACA,iBAAS,CAAA,KAAK,CAAG,EAAA;AACrB,IAAO,OAAA,KAAA;AAAA;AAER,EAAM,MAAA,KAAA,GAAQ,MAAO,CAAA,cAAA,CAAe,KAAK,CAAA;AACzC,EACC,OAAA,KAAA,KAAU,OAAO,SACjB,IAAA,KAAA,KAAU,QACV,MAAO,CAAA,cAAA,CAAe,KAAK,CAAM,KAAA,IAAA;AAEnC;;;;"}
/**
* 该函数用于判断一个事件名称是否具有插件事件的格式(通过冒号区分的多段命名)
*
* @param eventName
* @returns
*/
export declare function isPluginEventName(eventName: string): boolean;
'use strict';
"use strict";
function isPluginEventName(eventName) {
if (!eventName) {
return false;
}
const eventSegments = eventName.split(":");
return eventSegments.length > 1 && eventSegments[0].length > 0;
}
exports.isPluginEventName = isPluginEventName;
//# sourceMappingURL=is-plugin-event-name.js.map
{"version":3,"file":"is-plugin-event-name.js","sources":["../../src/is-plugin-event-name.ts"],"sourcesContent":["/**\n * 该函数用于判断一个事件名称是否具有插件事件的格式(通过冒号区分的多段命名)\n *\n * @param eventName\n * @returns\n */\nexport function isPluginEventName(eventName: string): boolean {\n\tif (!eventName) {\n\t\treturn false;\n\t}\n\n\tconst eventSegments = eventName.split(':');\n\treturn eventSegments.length > 1 && eventSegments[0].length > 0;\n}\n"],"names":[],"mappings":";;;AAMO,SAAS,kBAAkB,SAA4B,EAAA;AAC7D,EAAA,IAAI,CAAC,SAAW,EAAA;AACf,IAAO,OAAA,KAAA;AAAA;AAGR,EAAM,MAAA,aAAA,GAAgB,SAAU,CAAA,KAAA,CAAM,GAAG,CAAA;AACzC,EAAA,OAAO,cAAc,MAAS,GAAA,CAAA,IAAK,aAAc,CAAA,CAAC,EAAE,MAAS,GAAA,CAAA;AAC9D;;;;"}
export declare function isPx(value: any): boolean;
export declare function isNumber(value: any): boolean;
export declare function toPx(value: any): any;
'use strict';
var lodashEs = require('lodash-es');
"use strict";
function isPx(value) {
return typeof value === "string" && /px$/i.test(value);
}
function isNumber(value) {
return typeof value === "number" || !lodashEs.isNaN(Number(value)) && !value.includes("px");
}
function toPx(value) {
if (typeof value === "number") {
return `${value}px`;
}
if (isPx(value)) {
return value;
}
if (typeof value === "string" && !lodashEs.isNaN(Number(value))) {
return `${value}px`;
}
throw new Error("Value must be a number or px string");
}
exports.isNumber = isNumber;
exports.isPx = isPx;
exports.toPx = toPx;
//# sourceMappingURL=is-px.js.map
{"version":3,"file":"is-px.js","sources":["../../src/is-px.ts"],"sourcesContent":["import { isNaN } from 'lodash-es';\n\nexport function isPx(value: any) {\n\treturn typeof value === 'string' && /px$/i.test(value);\n}\n\nexport function isNumber(value: any) {\n\treturn (\n\t\ttypeof value === 'number' ||\n\t\t(!isNaN(Number(value)) && !value.includes('px'))\n\t);\n}\n\nexport function toPx(value: any) {\n\tif (typeof value === 'number') {\n\t\treturn `${value}px`;\n\t}\n\tif (isPx(value)) {\n\t\treturn value;\n\t}\n\t// 判断是否为数字字符串\n\tif (typeof value === 'string' && !isNaN(Number(value))) {\n\t\treturn `${value}px`;\n\t}\n\tthrow new Error('Value must be a number or px string');\n}\n"],"names":["isNaN"],"mappings":";;;;;AAEO,SAAS,KAAK,KAAY,EAAA;AAChC,EAAA,OAAO,OAAO,KAAA,KAAU,QAAY,IAAA,MAAA,CAAO,KAAK,KAAK,CAAA;AACtD;AAEO,SAAS,SAAS,KAAY,EAAA;AACpC,EAAA,OACC,OAAO,KAAA,KAAU,QAChB,IAAA,CAACA,cAAM,CAAA,MAAA,CAAO,KAAK,CAAC,CAAK,IAAA,CAAC,KAAM,CAAA,QAAA,CAAS,IAAI,CAAA;AAEhD;AAEO,SAAS,KAAK,KAAY,EAAA;AAChC,EAAI,IAAA,OAAO,UAAU,QAAU,EAAA;AAC9B,IAAA,OAAO,GAAG,KAAK,CAAA,EAAA,CAAA;AAAA;AAEhB,EAAI,IAAA,IAAA,CAAK,KAAK,CAAG,EAAA;AAChB,IAAO,OAAA,KAAA;AAAA;AAGR,EAAI,IAAA,OAAO,UAAU,QAAY,IAAA,CAACA,eAAM,MAAO,CAAA,KAAK,CAAC,CAAG,EAAA;AACvD,IAAA,OAAO,GAAG,KAAK,CAAA,EAAA,CAAA;AAAA;AAEhB,EAAM,MAAA,IAAI,MAAM,qCAAqC,CAAA;AACtD;;;;;;"}
/**
* mouse shake check
*/
export declare function isShaken(e1: MouseEvent | DragEvent, e2: MouseEvent | DragEvent): boolean;
'use strict';
"use strict";
const SHAKE_DISTANCE = 4;
function isShaken(e1, e2) {
if (e1.shaken) {
return true;
}
if (e1.target !== e2.target) {
return true;
}
return (e1.clientY - e2.clientY) ** 2 + (e1.clientX - e2.clientX) ** 2 > SHAKE_DISTANCE;
}
exports.isShaken = isShaken;
//# sourceMappingURL=is-shaken.js.map
{"version":3,"file":"is-shaken.js","sources":["../../src/is-shaken.ts"],"sourcesContent":["const SHAKE_DISTANCE = 4;\n/**\n * mouse shake check\n */\nexport function isShaken(\n\te1: MouseEvent | DragEvent,\n\te2: MouseEvent | DragEvent\n): boolean {\n\tif ((e1 as any).shaken) {\n\t\treturn true;\n\t}\n\tif (e1.target !== e2.target) {\n\t\treturn true;\n\t}\n\treturn (\n\t\t(e1.clientY - e2.clientY) ** 2 + (e1.clientX - e2.clientX) ** 2 >\n\t\tSHAKE_DISTANCE\n\t);\n}\n"],"names":[],"mappings":";;;AAAA,MAAM,cAAiB,GAAA,CAAA;AAIP,SAAA,QAAA,CACf,IACA,EACU,EAAA;AACV,EAAA,IAAK,GAAW,MAAQ,EAAA;AACvB,IAAO,OAAA,IAAA;AAAA;AAER,EAAI,IAAA,EAAA,CAAG,MAAW,KAAA,EAAA,CAAG,MAAQ,EAAA;AAC5B,IAAO,OAAA,IAAA;AAAA;AAER,EACE,OAAA,CAAA,EAAA,CAAG,UAAU,EAAG,CAAA,OAAA,KAAY,KAAK,EAAG,CAAA,OAAA,GAAU,EAAG,CAAA,OAAA,KAAY,CAC9D,GAAA,cAAA;AAEF;;;;"}
import { Component } from 'vue';
/**
* 判断是否是组件
*
* @param component
* @returns
*/
export declare function isVueComponent(component: any): component is Component;
'use strict';
"use strict";
function isVueComponent(component) {
if (typeof component === "object" && component !== null) {
const options = component;
if (typeof options.render === "function" || typeof options.setup === "function") {
return true;
}
}
if (typeof component === "object" && component !== null && "__vccOpts" in component) {
return true;
}
return false;
}
exports.isVueComponent = isVueComponent;
//# sourceMappingURL=is-vue.js.map
{"version":3,"file":"is-vue.js","sources":["../../src/is-vue.ts"],"sourcesContent":["import { ComponentOptions, Component } from 'vue';\n\n/**\n * 判断是否是组件\n *\n * @param component\n * @returns\n */\nexport function isVueComponent(component: any): component is Component {\n\tif (typeof component === 'object' && component !== null) {\n\t\tconst options = component as ComponentOptions;\n\t\tif (\n\t\t\ttypeof options.render === 'function' ||\n\t\t\ttypeof options.setup === 'function'\n\t\t) {\n\t\t\treturn true; // 是 SFC 组件\n\t\t}\n\t}\n\tif (\n\t\ttypeof component === 'object' &&\n\t\tcomponent !== null &&\n\t\t'__vccOpts' in component\n\t) {\n\t\treturn true; // 是 Vue JSX 组件\n\t}\n\n\treturn false; // 不是任何组件\n}\n"],"names":[],"mappings":";;;AAQO,SAAS,eAAe,SAAwC,EAAA;AACtE,EAAA,IAAI,OAAO,SAAA,KAAc,QAAY,IAAA,SAAA,KAAc,IAAM,EAAA;AACxD,IAAA,MAAM,OAAU,GAAA,SAAA;AAChB,IAAA,IACC,OAAO,OAAQ,CAAA,MAAA,KAAW,cAC1B,OAAO,OAAA,CAAQ,UAAU,UACxB,EAAA;AACD,MAAO,OAAA,IAAA;AAAA;AACR;AAED,EAAA,IACC,OAAO,SAAc,KAAA,QAAA,IACrB,SAAc,KAAA,IAAA,IACd,eAAe,SACd,EAAA;AACD,IAAO,OAAA,IAAA;AAAA;AAGR,EAAO,OAAA,KAAA;AACR;;;;"}
export type Level = 'debug' | 'log' | 'info' | 'warn' | 'error';
interface Options {
level: Level;
bizName: string;
}
declare class Logger {
bizName: string;
targetBizName: string;
targetLevel: string;
constructor(options: Options);
debug(...args: any[]): void;
log(...args: any[]): void;
info(...args: any[]): void;
warn(...args: any[]): void;
error(...args: any[]): void;
}
export { Logger };
export declare function getLogger(config: {
level: Level;
bizName: string;
}): Logger;
'use strict';
var isObject = require('./is-object.js');
"use strict";
const levels = {
debug: -1,
log: 0,
info: 0,
warn: 1,
error: 2
};
const bizNameColors = [
"#daa569",
"#00ffff",
"#385e0f",
"#7fffd4",
"#00c957",
"#b0e0e6",
"#4169e1",
"#6a5acd",
"#87ceeb",
"#ffff00",
"#e3cf57",
"#ff9912",
"#eb8e55",
"#ffe384",
"#40e0d0",
"#a39480",
"#d2691e",
"#ff7d40",
"#f0e68c",
"#bc8f8f",
"#c76114",
"#734a12",
"#5e2612",
"#0000ff",
"#3d59ab",
"#1e90ff",
"#03a89e",
"#33a1c9",
"#a020f0",
"#a066d3",
"#da70d6",
"#dda0dd",
"#688e23",
"#2e8b57"
];
const bodyColors = {
debug: "#fadb14",
log: "#8c8c8c",
info: "#52c41a",
warn: "#fa8c16",
error: "#ff4d4f"
};
const levelMarks = {
debug: "debug",
log: "log",
info: "info",
warn: "warn",
error: "error"
};
const outputFunction = {
debug: console.log,
log: console.log,
info: console.log,
warn: console.warn,
error: console.error
};
const bizNameColorConfig = {};
const shouldOutput = (logLevel, targetLevel = "warn", bizName, targetBizName) => {
const isLevelFit = levels[targetLevel] <= levels[logLevel];
const isBizNameFit = targetBizName === "*" || bizName.indexOf(targetBizName) > -1;
return isLevelFit && isBizNameFit;
};
const output = (logLevel, bizName) => (...args) => outputFunction[logLevel]?.apply(
console,
getLogArgs(args, bizName, logLevel)
);
const getColor = (bizName) => {
if (!bizNameColorConfig[bizName]) {
const color = bizNameColors[Object.keys(bizNameColorConfig).length % bizNameColors.length];
bizNameColorConfig[bizName] = color;
}
return bizNameColorConfig[bizName];
};
const getLogArgs = (args, bizName, logLevel) => {
const color = getColor(bizName);
const bodyColor = bodyColors[logLevel];
const argsArray = args[0];
let prefix = `%c[${bizName}]%c[${levelMarks[logLevel]}]:`;
argsArray.forEach((arg) => {
if (isObject.isObject(arg)) {
prefix += "%o";
} else {
prefix += "%s";
}
});
let processedArgs = [prefix, `color: ${color}`, `color: ${bodyColor}`];
processedArgs = processedArgs.concat(argsArray);
return processedArgs;
};
const parseLogConf = (logConf, options) => {
if (!logConf) {
return {
level: options.level,
bizName: options.bizName
};
}
if (logConf.indexOf(":") > -1) {
const pair = logConf.split(":");
return {
level: pair[0],
bizName: pair[1] || "*"
};
}
return {
level: logConf,
bizName: "*"
};
};
const defaultOptions = {
level: "warn",
bizName: "*"
};
class Logger {
bizName;
targetBizName;
targetLevel;
constructor(options) {
options = { ...defaultOptions, ...options };
const _location = location || {};
const logConf = (/__(?:logConf|logLevel)__=([^#/&]*)/.exec(
_location.href
) || [])[1];
const targetOptions = parseLogConf(logConf, options);
this.bizName = options.bizName;
this.targetBizName = targetOptions.bizName;
this.targetLevel = targetOptions.level;
}
debug(...args) {
if (!shouldOutput("debug", this.targetLevel, this.bizName, this.targetBizName)) {
return;
}
return output("debug", this.bizName)(args);
}
log(...args) {
if (!shouldOutput("log", this.targetLevel, this.bizName, this.targetBizName)) {
return;
}
return output("log", this.bizName)(args);
}
info(...args) {
if (!shouldOutput("info", this.targetLevel, this.bizName, this.targetBizName)) {
return;
}
return output("info", this.bizName)(args);
}
warn(...args) {
if (!shouldOutput("warn", this.targetLevel, this.bizName, this.targetBizName)) {
return;
}
return output("warn", this.bizName)(args);
}
error(...args) {
if (!shouldOutput("error", this.targetLevel, this.bizName, this.targetBizName)) {
return;
}
return output("error", this.bizName)(args);
}
}
function getLogger(config) {
return new Logger(config);
}
exports.Logger = Logger;
exports.getLogger = getLogger;
//# sourceMappingURL=logger.js.map
{"version":3,"file":"logger.js","sources":["../../src/logger.ts"],"sourcesContent":["/* eslint-disable no-console */\nimport { isObject } from './is-object';\n\nexport type Level = 'debug' | 'log' | 'info' | 'warn' | 'error';\ninterface Options {\n\tlevel: Level;\n\tbizName: string;\n}\n\nconst levels: Record<string, number> = {\n\tdebug: -1,\n\tlog: 0,\n\tinfo: 0,\n\twarn: 1,\n\terror: 2,\n};\nconst bizNameColors = [\n\t'#daa569',\n\t'#00ffff',\n\t'#385e0f',\n\t'#7fffd4',\n\t'#00c957',\n\t'#b0e0e6',\n\t'#4169e1',\n\t'#6a5acd',\n\t'#87ceeb',\n\t'#ffff00',\n\t'#e3cf57',\n\t'#ff9912',\n\t'#eb8e55',\n\t'#ffe384',\n\t'#40e0d0',\n\t'#a39480',\n\t'#d2691e',\n\t'#ff7d40',\n\t'#f0e68c',\n\t'#bc8f8f',\n\t'#c76114',\n\t'#734a12',\n\t'#5e2612',\n\t'#0000ff',\n\t'#3d59ab',\n\t'#1e90ff',\n\t'#03a89e',\n\t'#33a1c9',\n\t'#a020f0',\n\t'#a066d3',\n\t'#da70d6',\n\t'#dda0dd',\n\t'#688e23',\n\t'#2e8b57',\n];\nconst bodyColors: Record<string, string> = {\n\tdebug: '#fadb14',\n\tlog: '#8c8c8c',\n\tinfo: '#52c41a',\n\twarn: '#fa8c16',\n\terror: '#ff4d4f',\n};\nconst levelMarks: Record<string, string> = {\n\tdebug: 'debug',\n\tlog: 'log',\n\tinfo: 'info',\n\twarn: 'warn',\n\terror: 'error',\n};\nconst outputFunction: Record<string, any> = {\n\tdebug: console.log,\n\tlog: console.log,\n\tinfo: console.log,\n\twarn: console.warn,\n\terror: console.error,\n};\n\nconst bizNameColorConfig: Record<string, string> = {};\n\nconst shouldOutput = (\n\tlogLevel: string,\n\ttargetLevel: string = 'warn',\n\tbizName: string,\n\ttargetBizName: string\n): boolean => {\n\tconst isLevelFit = (levels as any)[targetLevel] <= (levels as any)[logLevel];\n\tconst isBizNameFit =\n\t\ttargetBizName === '*' || bizName.indexOf(targetBizName) > -1;\n\treturn isLevelFit && isBizNameFit;\n};\n\nconst output =\n\t(logLevel: string, bizName: string) =>\n\t(...args: any[]) =>\n\t\toutputFunction[logLevel]?.apply(\n\t\t\tconsole,\n\t\t\tgetLogArgs(args, bizName, logLevel)\n\t\t);\n\nconst getColor = (bizName: string) => {\n\tif (!bizNameColorConfig[bizName]) {\n\t\tconst color =\n\t\t\tbizNameColors[\n\t\t\t\tObject.keys(bizNameColorConfig).length % bizNameColors.length\n\t\t\t];\n\t\tbizNameColorConfig[bizName] = color;\n\t}\n\treturn bizNameColorConfig[bizName];\n};\n\nconst getLogArgs = (args: any, bizName: string, logLevel: string) => {\n\tconst color = getColor(bizName);\n\tconst bodyColor = bodyColors[logLevel];\n\n\tconst argsArray = args[0];\n\tlet prefix = `%c[${bizName}]%c[${levelMarks[logLevel]}]:`;\n\targsArray.forEach((arg: any) => {\n\t\tif (isObject(arg)) {\n\t\t\tprefix += '%o';\n\t\t} else {\n\t\t\tprefix += '%s';\n\t\t}\n\t});\n\tlet processedArgs = [prefix, `color: ${color}`, `color: ${bodyColor}`];\n\tprocessedArgs = processedArgs.concat(argsArray);\n\treturn processedArgs;\n};\nconst parseLogConf = (\n\tlogConf: string,\n\toptions: Options\n): { level: string; bizName: string } => {\n\tif (!logConf) {\n\t\treturn {\n\t\t\tlevel: options.level,\n\t\t\tbizName: options.bizName,\n\t\t};\n\t}\n\tif (logConf.indexOf(':') > -1) {\n\t\tconst pair = logConf.split(':');\n\t\treturn {\n\t\t\tlevel: pair[0],\n\t\t\tbizName: pair[1] || '*',\n\t\t};\n\t}\n\treturn {\n\t\tlevel: logConf,\n\t\tbizName: '*',\n\t};\n};\n\nconst defaultOptions: Options = {\n\tlevel: 'warn',\n\tbizName: '*',\n};\n\nclass Logger {\n\tbizName: string;\n\n\ttargetBizName: string;\n\n\ttargetLevel: string;\n\n\tconstructor(options: Options) {\n\t\toptions = { ...defaultOptions, ...options };\n\t\t// eslint-disable-next-line no-restricted-globals\n\t\tconst _location = location || ({} as any);\n\t\t// __logConf__ 格式为 logLevel[:bizName], bizName is used as: targetBizName like '%bizName%'\n\t\t// 1. __logConf__=log or __logConf__=warn, etc.\n\t\t// 2. __logConf__=log:* or __logConf__=warn:*, etc.\n\t\t// 2. __logConf__=log:bizName or __logConf__=warn:partOfBizName, etc.\n\t\tconst logConf = (/__(?:logConf|logLevel)__=([^#/&]*)/.exec(\n\t\t\t_location.href\n\t\t) || [])[1];\n\t\tconst targetOptions = parseLogConf(logConf, options);\n\t\tthis.bizName = options.bizName;\n\t\tthis.targetBizName = targetOptions.bizName;\n\t\tthis.targetLevel = targetOptions.level;\n\t}\n\n\tdebug(...args: any[]): void {\n\t\tif (\n\t\t\t!shouldOutput('debug', this.targetLevel, this.bizName, this.targetBizName)\n\t\t) {\n\t\t\treturn;\n\t\t}\n\t\treturn output('debug', this.bizName)(args);\n\t}\n\n\tlog(...args: any[]): void {\n\t\tif (\n\t\t\t!shouldOutput('log', this.targetLevel, this.bizName, this.targetBizName)\n\t\t) {\n\t\t\treturn;\n\t\t}\n\t\treturn output('log', this.bizName)(args);\n\t}\n\n\tinfo(...args: any[]): void {\n\t\tif (\n\t\t\t!shouldOutput('info', this.targetLevel, this.bizName, this.targetBizName)\n\t\t) {\n\t\t\treturn;\n\t\t}\n\t\treturn output('info', this.bizName)(args);\n\t}\n\n\twarn(...args: any[]): void {\n\t\tif (\n\t\t\t!shouldOutput('warn', this.targetLevel, this.bizName, this.targetBizName)\n\t\t) {\n\t\t\treturn;\n\t\t}\n\t\treturn output('warn', this.bizName)(args);\n\t}\n\n\terror(...args: any[]): void {\n\t\tif (\n\t\t\t!shouldOutput('error', this.targetLevel, this.bizName, this.targetBizName)\n\t\t) {\n\t\t\treturn;\n\t\t}\n\t\treturn output('error', this.bizName)(args);\n\t}\n}\n\nexport { Logger };\n\nexport function getLogger(config: { level: Level; bizName: string }): Logger {\n\treturn new Logger(config);\n}\n"],"names":["isObject"],"mappings":";;;;;AASA,MAAM,MAAiC,GAAA;AAAA,EACtC,KAAO,EAAA,CAAA,CAAA;AAAA,EACP,GAAK,EAAA,CAAA;AAAA,EACL,IAAM,EAAA,CAAA;AAAA,EACN,IAAM,EAAA,CAAA;AAAA,EACN,KAAO,EAAA;AACR,CAAA;AACA,MAAM,aAAgB,GAAA;AAAA,EACrB,SAAA;AAAA,EACA,SAAA;AAAA,EACA,SAAA;AAAA,EACA,SAAA;AAAA,EACA,SAAA;AAAA,EACA,SAAA;AAAA,EACA,SAAA;AAAA,EACA,SAAA;AAAA,EACA,SAAA;AAAA,EACA,SAAA;AAAA,EACA,SAAA;AAAA,EACA,SAAA;AAAA,EACA,SAAA;AAAA,EACA,SAAA;AAAA,EACA,SAAA;AAAA,EACA,SAAA;AAAA,EACA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AmD,EAAA;AAC5E,EAAO,OAAA,IAAI,OAAO,MAAM,CAAA;AACzB;;;;;"}
/**
* 属性级别的 supportVariable 应该优先于全局的 supportVariable
* @param propSupportVariable 属性级别的 supportVariable
* @param globalSupportVariable 全局的 supportVariable
* @returns 是否应该使用变量设置器
*/
export declare function shouldUseVariableSetter(propSupportVariable: boolean | undefined, globalSupportVariable: boolean): boolean;
'use strict';
"use strict";
function shouldUseVariableSetter(propSupportVariable, globalSupportVariable) {
if (propSupportVariable === false) return false;
return propSupportVariable || globalSupportVariable;
}
exports.shouldUseVariableSetter = shouldUseVariableSetter;
//# sourceMappingURL=misc.js.map
{"version":3,"file":"misc.js","sources":["../../src/misc.ts"],"sourcesContent":["/**\n * 属性级别的 supportVariable 应该优先于全局的 supportVariable\n * @param propSupportVariable 属性级别的 supportVariable\n * @param globalSupportVariable 全局的 supportVariable\n * @returns 是否应该使用变量设置器\n */\nexport function shouldUseVariableSetter(\n\tpropSupportVariable: boolean | undefined,\n\tglobalSupportVariable: boolean\n) {\n\tif (propSupportVariable === false) return false;\n\treturn propSupportVariable || globalSupportVariable;\n}\n"],"names":[],"mappings":";;;AAMgB,SAAA,uBAAA,CACf,qBACA,qBACC,EAAA;AACD,EAAI,IAAA,mBAAA,KAAwB,OAAc,OAAA,KAAA;AAC1C,EAAA,OAAO,mBAAuB,IAAA,qBAAA;AAC/B;;;;"}
/**
* 控制是否允许原生选择的标志
*/
export declare let nativeSelectionEnabled: boolean;
/**
* 设置是否允许原生选择
* @param enableFlag 是否允许选择的标志
*/
export declare function setNativeSelection(enableFlag: boolean): void;
'use strict';
"use strict";
exports.nativeSelectionEnabled = true;
const preventSelection = (e) => {
if (exports.nativeSelectionEnabled) {
return null;
}
e.preventDefault();
e.stopPropagation();
return false;
};
document.addEventListener("selectstart", preventSelection, true);
document.addEventListener("dragstart", preventSelection, true);
function setNativeSelection(enableFlag) {
exports.nativeSelectionEnabled = enableFlag;
}
exports.setNativeSelection = setNativeSelection;
//# sourceMappingURL=navtive-selection.js.map
{"version":3,"file":"navtive-selection.js","sources":["../../src/navtive-selection.ts"],"sourcesContent":["/**\n * 控制是否允许原生选择的标志\n */\n// eslint-disable-next-line import/no-mutable-exports\nexport let nativeSelectionEnabled = true;\n\n/**\n * 阻止原生选择事件的处理函数\n * @param e 事件对象\n * @returns null 或 false\n */\nconst preventSelection = (e: Event) => {\n\tif (nativeSelectionEnabled) {\n\t\treturn null;\n\t}\n\te.preventDefault();\n\te.stopPropagation();\n\treturn false;\n};\n\n// 监听文本选择事件\ndocument.addEventListener('selectstart', preventSelection, true);\n// 监听拖拽事件\ndocument.addEventListener('dragstart', preventSelection, true);\n\n/**\n * 设置是否允许原生选择\n * @param enableFlag 是否允许选择的标志\n */\nexport function setNativeSelection(enableFlag: boolean) {\n\tnativeSelectionEnabled = enableFlag;\n}\n"],"names":["nativeSelectionEnabled"],"mappings":";;;AAIWA,8BAAyB,GAAA;AAOpC,MAAM,gBAAA,GAAmB,CAAC,CAAa,KAAA;AACtC,EAAA,IAAIA,8BAAwB,EAAA;AAC3B,IAAO,OAAA,IAAA;AAAA;AAER,EAAA,CAAA,CAAE,cAAe,EAAA;AACjB,EAAA,CAAA,CAAE,eAAgB,EAAA;AAClB,EAAO,OAAA,KAAA;AACR,CAAA;AAGA,QAAS,CAAA,gBAAA,CAAiB,aAAe,EAAA,gBAAA,EAAkB,IAAI,CAAA;AAE/D,QAAS,CAAA,gBAAA,CAAiB,WAAa,EAAA,gBAAA,EAAkB,IAAI,CAAA;AAMtD,SAAS,mBAAmB,UAAqB,EAAA;AACvD,EAAyBA,8BAAA,GAAA,UAAA;AAC1B;;;;"}
import { IPublicModelNode } from '@arvin-shu/microcode-types';
/**
* 获取最近的满足条件的父节点
* @param Node 节点类型,继承自IPublicModelNode
* @returns 返回最近的满足条件的父节点,如果没有找到返回undefined
*/
export declare const getClosestNode: <Node extends IPublicModelNode = IPublicModelNode>(node: Node, until: (n: Node) => boolean) => Node | undefined;
/**
* 判断节点是否可被点击
* @param {Node} node 节点
* @param {unknown} e 点击事件
* @returns {boolean} 是否可点击,true表示可点击
*/
export declare function canClickNode<Node extends IPublicModelNode = IPublicModelNode>(node: Node, e: MouseEvent): boolean;
'use strict';
"use strict";
const getClosestNode = (node, until) => {
if (!node) {
return void 0;
}
if (until(node)) {
return node;
}
return getClosestNode(node.parent, until);
};
function canClickNode(node, e) {
const onClickHook = node.componentMeta?.advanced?.callbacks?.onClickHook;
const canClick = typeof onClickHook === "function" ? onClickHook(e, node) : true;
return canClick;
}
exports.canClickNode = canClickNode;
exports.getClosestNode = getClosestNode;
//# sourceMappingURL=node-helper.js.map
{"version":3,"file":"node-helper.js","sources":["../../src/node-helper.ts"],"sourcesContent":["import { IPublicModelNode } from '@arvin-shu/microcode-types';\n\n/**\n * 获取最近的满足条件的父节点\n * @param Node 节点类型,继承自IPublicModelNode\n * @returns 返回最近的满足条件的父节点,如果没有找到返回undefined\n */\nexport const getClosestNode = <\n\tNode extends IPublicModelNode = IPublicModelNode,\n>(\n\tnode: Node,\n\tuntil: (n: Node) => boolean\n): Node | undefined => {\n\tif (!node) {\n\t\treturn undefined;\n\t}\n\tif (until(node)) {\n\t\treturn node;\n\t}\n\t// @ts-ignore\n\treturn getClosestNode(node.parent, until);\n};\n\n/**\n * 判断节点是否可被点击\n * @param {Node} node 节点\n * @param {unknown} e 点击事件\n * @returns {boolean} 是否可点击,true表示可点击\n */\nexport function canClickNode<Node extends IPublicModelNode = IPublicModelNode>(\n\tnode: Node,\n\te: MouseEvent\n): boolean {\n\tconst onClickHook = node.componentMeta?.advanced?.callbacks?.onClickHook;\n\tconst canClick =\n\t\ttypeof onClickHook === 'function' ? onClickHook(e, node) : true;\n\treturn canClick;\n}\n"],"names":[],"mappings":";;;AAOa,MAAA,cAAA,GAAiB,CAG7B,IAAA,EACA,KACsB,KAAA;AACtB,EAAA,IAAI,CAAC,IAAM,EAAA;AACV,IAAO,OAAA,KAAA,CAAA;AAAA;AAER,EAAI,IAAA,KAAA,CAAM,IAAI,CAAG,EAAA;AAChB,IAAO,OAAA,IAAA;AAAA;AAGR,EAAO,OAAA,cAAA,CAAe,IAAK,CAAA,MAAA,EAAQ,KAAK,CAAA;AACzC;AAQgB,SAAA,YAAA,CACf,MACA,CACU,EAAA;AACV,EAAA,MAAM,WAAc,GAAA,IAAA,CAAK,aAAe,EAAA,QAAA,EAAU,SAAW,EAAA,WAAA;AAC7D,EAAA,MAAM,WACL,OAAO,WAAA,KAAgB,aAAa,WAAY,CAAA,CAAA,EAAG,IAAI,CAAI,GAAA,IAAA;AAC5D,EAAO,OAAA,QAAA;AACR;;;;;"}
/**
* 动态的执行一段script脚本
*
* @param script
* @param scriptType
*/
export declare function evaluate(script: string, scriptType?: string): void;
/**
* 动态加载外部 JS 文件,并在加载成功时返回一个 Promise,支持错误处理
*
* @param url
* @param scriptType
* @returns
*/
export declare function load(url: string, scriptType?: string): Promise<any>;
'use strict';
var createDefer = require('./create-defer.js');
"use strict";
function evaluate(script, scriptType) {
const scriptEl = document.createElement("script");
scriptType && (scriptEl.type = scriptType);
scriptEl.text = script;
document.head.appendChild(scriptEl);
document.head.removeChild(scriptEl);
}
function load(url, scriptType) {
const node = document.createElement("script");
node.onload = onload;
node.onerror = onload;
const i = createDefer.createDefer();
function onload(e) {
node.onload = null;
node.onerror = null;
if (e.type === "load") {
i.resolve();
} else {
i.reject();
}
}
node.src = url;
node.async = false;
scriptType && (node.type = scriptType);
document.head.appendChild(node);
return i.promise();
}
exports.evaluate = evaluate;
exports.load = load;
//# sourceMappingURL=script.js.map
{"version":3,"file":"script.js","sources":["../../src/script.ts"],"sourcesContent":["import { createDefer } from './create-defer';\n\n/**\n * 动态的执行一段script脚本\n *\n * @param script\n * @param scriptType\n */\nexport function evaluate(script: string, scriptType?: string) {\n\t// 创建一个新的 script 元素\n\tconst scriptEl = document.createElement('script');\n\n\t// 如果传递了 scriptType 参数,则设置 script 元素的 type 属性\n\tscriptType && (scriptEl.type = scriptType);\n\n\t// 设置 script 元素的 text 属性为传入的脚本内容\n\tscriptEl.text = script;\n\n\t// 将 script 元素添加到 document.head 中,这会立即执行脚本\n\tdocument.head.appendChild(scriptEl);\n\n\t// 执行完成后,立即从 document.head 中移除该 script 元素\n\tdocument.head.removeChild(scriptEl);\n}\n\n/**\n * 动态加载外部 JS 文件,并在加载成功时返回一个 Promise,支持错误处理\n *\n * @param url\n * @param scriptType\n * @returns\n */\nexport function load(url: string, scriptType?: string) {\n\t// 创建一个新的 script 元素\n\tconst node = document.createElement('script');\n\n\t// 监听加载成功或失败事件\n\tnode.onload = onload;\n\tnode.onerror = onload;\n\n\t// 创建一个 Deferred 对象,用于返回 Promise\n\tconst i = createDefer();\n\n\t// 处理 onload 和 onerror 事件\n\tfunction onload(e: any) {\n\t\tnode.onload = null;\n\t\tnode.onerror = null;\n\t\tif (e.type === 'load') {\n\t\t\ti.resolve(); // 加载成功时,调用 resolve()\n\t\t} else {\n\t\t\ti.reject(); // 加载失败时,调用 reject()\n\t\t}\n\t}\n\n\t// 设置 script 元素的 src 属性为传入的 url\n\tnode.src = url;\n\n\t// 确保脚本按顺序执行,设置 async = false\n\tnode.async = false;\n\n\t// 如果有传递 scriptType 参数,则设置 script 元素的 type 属性\n\tscriptType && (node.type = scriptType);\n\n\t// 将 script 元素添加到 head 中,开始加载脚本\n\tdocument.head.appendChild(node);\n\n\t// 返回一个 Promise 对象,表示加载状态\n\treturn i.promise();\n}\n"],"names":["createDefer"],"mappings":";;;;;AAQgB,SAAA,QAAA,CAAS,QAAgB,UAAqB,EAAA;AAE7D,EAAM,MAAA,QAAA,GAAW,QAAS,CAAA,aAAA,CAAc,QAAQ,CAAA;AAGhD,EAAA,UAAA,KAAe,SAAS,IAAO,GAAA,UAAA,CAAA;AAG/B,EAAA,QAAA,CAAS,IAAO,GAAA,MAAA;AAGhB,EAAS,QAAA,CAAA,IAAA,CAAK,YAAY,QAAQ,CAAA;AAGlC,EAAS,QAAA,CAAA,IAAA,CAAK,YAAY,QAAQ,CAAA;AACnC;AASgB,SAAA,IAAA,CAAK,KAAa,UAAqB,EAAA;AAEtD,EAAM,MAAA,IAAA,GAAO,QAAS,CAAA,aAAA,CAAc,QAAQ,CAAA;AAG5C,EAAA,IAAA,CAAK,MAAS,GAAA,MAAA;AACd,EAAA,IAAA,CAAK,OAAU,GAAA,MAAA;AAGf,EAAA,MAAM,IAAIA,uBAAY,EAAA;AAGtB,EAAA,SAAS,OAAO,CAAQ,EAAA;AACvB,IAAA,IAAA,CAAK,MAAS,GAAA,IAAA;AACd,IAAA,IAAA,CAAK,OAAU,GAAA,IAAA;AACf,IAAI,IAAA,CAAA,CAAE,SAAS,MAAQ,EAAA;AACtB,MAAA,CAAA,CAAE,OAAQ,EAAA;AAAA,KACJ,MAAA;AACN,MAAA,CAAA,CAAE,MAAO,EAAA;AAAA;AACV;AAID,EAAA,IAAA,CAAK,GAAM,GAAA,GAAA;AAGX,EAAA,IAAA,CAAK,KAAQ,GAAA,KAAA;AAGb,EAAA,UAAA,KAAe,KAAK,IAAO,GAAA,UAAA,CAAA;AAG3B,EAAS,QAAA,CAAA,IAAA,CAAK,YAAY,IAAI,CAAA;AAG9B,EAAA,OAAO,EAAE,OAAQ,EAAA;AAClB;;;;;"}
export declare function shallowEqual(objA: any, objB: any): boolean;
'use strict';
var hasOwnProperty = require('./has-own-property.js');
"use strict";
function shallowEqual(objA, objB) {
if (objA === objB) {
return true;
}
if (typeof objA !== "object" || objA === null || typeof objB !== "object" || objB === null) {
return false;
}
const keysA = Object.keys(objA);
const keysB = Object.keys(objB);
if (keysA.length !== keysB.length) {
return false;
}
for (let i = 0; i < keysA.length; i++) {
if (!hasOwnProperty.hasOwnProperty(objB, keysA[i]) || objA[keysA[i]] !== objB[keysA[i]]) {
return false;
}
}
return true;
}
exports.shallowEqual = shallowEqual;
//# sourceMappingURL=shallow-equal.js.map
{"version":3,"file":"shallow-equal.js","sources":["../../src/shallow-equal.ts"],"sourcesContent":["import { hasOwnProperty } from './has-own-property';\n\nexport function shallowEqual(objA: any, objB: any): boolean {\n\tif (objA === objB) {\n\t\treturn true;\n\t}\n\n\tif (\n\t\ttypeof objA !== 'object' ||\n\t\tobjA === null ||\n\t\ttypeof objB !== 'object' ||\n\t\tobjB === null\n\t) {\n\t\treturn false;\n\t}\n\n\tconst keysA = Object.keys(objA);\n\tconst keysB = Object.keys(objB);\n\n\tif (keysA.length !== keysB.length) {\n\t\treturn false;\n\t}\n\n\t// Test for A's keys different from B.\n\tfor (let i = 0; i < keysA.length; i++) {\n\t\tif (!hasOwnProperty(objB, keysA[i]) || objA[keysA[i]] !== objB[keysA[i]]) {\n\t\t\treturn false;\n\t\t}\n\t}\n\n\treturn true;\n}\n"],"names":["hasOwnProperty"],"mappings":";;;;;AAEgB,SAAA,YAAA,CAAa,MAAW,IAAoB,EAAA;AAC3D,EAAA,IAAI,SAAS,IAAM,EAAA;AAClB,IAAO,OAAA,IAAA;AAAA;AAGR,EACC,IAAA,OAAO,SAAS,QAChB,IAAA,IAAA,KAAS,QACT,OAAO,IAAA,KAAS,QAChB,IAAA,IAAA,KAAS,IACR,EAAA;AACD,IAAO,OAAA,KAAA;AAAA;AAGR,EAAM,MAAA,KAAA,GAAQ,MAAO,CAAA,IAAA,CAAK,IAAI,CAAA;AAC9B,EAAM,MAAA,KAAA,GAAQ,MAAO,CAAA,IAAA,CAAK,IAAI,CAAA;AAE9B,EAAI,IAAA,KAAA,CAAM,MAAW,KAAA,KAAA,CAAM,MAAQ,EAAA;AAClC,IAAO,OAAA,KAAA;AAAA;AAIR,EAAA,KAAA,IAAS,CAAI,GAAA,CAAA,EAAG,CAAI,GAAA,KAAA,CAAM,QAAQ,CAAK,EAAA,EAAA;AACtC,IAAA,IAAI,CAACA,6BAAe,CAAA,IAAA,EAAM,KAAM,CAAA,CAAC,CAAC,CAAK,IAAA,IAAA,CAAK,KAAM,CAAA,CAAC,CAAC,CAAM,KAAA,IAAA,CAAK,KAAM,CAAA,CAAC,CAAC,CAAG,EAAA;AACzE,MAAO,OAAA,KAAA;AAAA;AACR;AAGD,EAAO,OAAA,IAAA;AACR;;;;"}
import { PropType } from 'vue';
export interface IconProps {
className?: string;
fill?: string;
size?: 'xsmall' | 'small' | 'medium' | 'large' | 'xlarge' | number;
style?: Record<string, unknown>;
}
export declare const SVGIcon: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
fill: StringConstructor;
size: {
type: PropType<IconProps["size"]>;
default: string;
};
viewBox: {
type: StringConstructor;
};
className: StringConstructor;
style: PropType<Record<string, any>>;
}>, () => VNode, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
fill: StringConstructor;
size: {
type: PropType<IconProps["size"]>;
default: string;
};
viewBox: {
type: StringConstructor;
};
className: StringConstructor;
style: PropType<Record<string, any>>;
}>> & Readonly<{}>, {
size: number | "small" | "xsmall" | "medium" | "large" | "xlarge" | undefined;
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
'use strict';
var vue = require('vue');
"use strict";
const SizePresets = {
xsmall: 8,
small: 12,
medium: 16,
large: 20,
xlarge: 30
};
const SVGIcon = /* @__PURE__ */ vue.defineComponent({
name: "SVGIcon",
props: {
fill: String,
size: {
type: [String, Number],
default: "medium"
},
viewBox: {
type: String
},
className: String,
style: Object
},
setup(props, {
slots
}) {
const getSize = (size) => SizePresets[size] ?? size;
return () => {
const finalSize = getSize(props.size);
return vue.createVNode("svg", {
"fill": "currentColor",
"preserveAspectRatio": "xMidYMid meet",
"width": finalSize,
"height": finalSize,
"viewBox": props.viewBox,
"class": props.className,
"style": {
color: props.fill,
...props.style || {}
}
}, [slots.default?.()]);
};
}
});
exports.SVGIcon = SVGIcon;
//# sourceMappingURL=svg-icon.js.map
{"version":3,"file":"svg-icon.js","sources":["../../src/svg-icon.tsx"],"sourcesContent":["import { PropType, defineComponent } from 'vue';\n\nconst SizePresets: any = {\n\txsmall: 8,\n\tsmall: 12,\n\tmedium: 16,\n\tlarge: 20,\n\txlarge: 30,\n};\n\nexport interface IconProps {\n\tclassName?: string;\n\tfill?: string;\n\tsize?: 'xsmall' | 'small' | 'medium' | 'large' | 'xlarge' | number;\n\tstyle?: Record<string, unknown>;\n}\n\nexport const SVGIcon = defineComponent({\n\tname: 'SVGIcon',\n\tprops: {\n\t\tfill: String,\n\t\tsize: {\n\t\t\ttype: [String, Number] as PropType<IconProps['size']>,\n\t\t\tdefault: 'medium',\n\t\t},\n\t\tviewBox: {\n\t\t\ttype: String,\n\t\t},\n\t\tclassName: String,\n\t\tstyle: Object as PropType<Record<string, any>>,\n\t},\n\tsetup(props, { slots }) {\n\t\tconst getSize = (size: IconProps['size']) =>\n\t\t\tSizePresets[size as string] ?? size;\n\n\t\treturn () => {\n\t\t\tconst finalSize = getSize(props.size);\n\n\t\t\treturn (\n\t\t\t\t<svg\n\t\t\t\t\tfill=\"currentColor\"\n\t\t\t\t\tpreserveAspectRatio=\"xMidYMid meet\"\n\t\t\t\t\twidth={finalSize}\n\t\t\t\t\theight={finalSize}\n\t\t\t\t\tviewBox={props.viewBox}\n\t\t\t\t\tclass={props.className}\n\t\t\t\t\tstyle={{\n\t\t\t\t\t\tcolor: props.fill,\n\t\t\t\t\t\t...(props.style || {}),\n\t\t\t\t\t}}\n\t\t\t\t>\n\t\t\t\t\t{slots.default?.()}\n\t\t\t\t</svg>\n\t\t\t);\n\t\t};\n\t},\n});\n"],"names":["SizePresets","xsmall","small","medium","large","xlarge","SVGIcon","defineComponent","name","props","fill","String","size","type","Number","default","viewBox","className","style","Object","setup","slots","getSize","finalSize","_createVNode","color"],"mappings":";;;;;AAEA,MAAMA,WAAmB,GAAA;AAAA,EACxBC,MAAQ,EAAA,CAAA;AAAA,EACRC,KAAO,EAAA,EAAA;AAAA,EACPC,MAAQ,EAAA,EAAA;AAAA,EACRC,KAAO,EAAA,EAAA;AAAA,EACPC,MAAQ,EAAA;AACT,CAAA;AASO,MAAMC,0BAA0BC,mBAAA,CAAA;AAAA,EACtCC,IAAM,EAAA,SAAA;AAAA,EACNC,KAAO,EAAA;AAAA,IACNC,IAAMC,EAAAA,MAAAA;AAAAA,IACNC,IAAM,EAAA;AAAA,MACLC,IAAAA,EAAM,CAACF,MAAAA,EAAQG,MAAM,CAAA;AAAA,MACrBC,OAAS,EAAA;AAAA,KACV;AAAA,IACAC,OAAS,EAAA;AAAA,MACRH,IAAMF,EAAAA;AAAAA,KACP;AAAA,IACAM,SAAWN,EAAAA,MAAAA;AAAAA,IACXO,KAAOC,EAAAA;AAAAA,GACR;AAAA,EACAC,MAAMX,KAAO,EAAA;AAAA,IAAEY;AAAAA,GAAS,EAAA;AACvB,IAAA,MAAMC,OAAWV,GAAAA,CAAAA,IAAAA,KAChBZ,WAAYY,CAAAA,IAAI,CAAeA,IAAAA,IAAAA;AAEhC,IAAA,OAAO,MAAM;AACZ,MAAMW,MAAAA,SAAAA,GAAYD,OAAQb,CAAAA,KAAAA,CAAMG,IAAI,CAAA;AAEpC,MAAA,OAAAY,gBAAA,KAAA,EAAA;AAAA,QAAA,MAAA,EAAA,cAAA;AAAA,QAAA,qBAAA,EAAA,eAAA;AAAA,QAAA,OAISD,EAAAA,SAAAA;AAAAA,QAAS,QACRA,EAAAA,SAAAA;AAAAA,QAAS,WACRd,KAAMO,CAAAA,OAAAA;AAAAA,QAAO,SACfP,KAAMQ,CAAAA,SAAAA;AAAAA,QAAS,OACf,EAAA;AAAA,UACNQ,OAAOhB,KAAMC,CAAAA,IAAAA;AAAAA,UACb,GAAID,KAAMS,CAAAA,KAAAA,IAAS;AAAC;AACrB,OAAC,EAAA,CAEAG,KAAMN,CAAAA,OAAAA,IAAW,CAAA,CAAA;AAAA,KAGrB;AAAA;AAEF,CAAC;;;;"}
declare class TransactionManager {
private emitter;
executeTransaction: (fn: () => void, type: any) => void;
onStartTransaction: (fn: () => void, type: any) => (() => void);
onEndTransaction: (fn: () => void, type: any) => (() => void);
}
export declare const transactionManager: TransactionManager;
export {};
'use strict';
var eventemitter2 = require('eventemitter2');
var vue = require('vue');
"use strict";
class TransactionManager {
emitter = new eventemitter2.EventEmitter2({
wildcard: true,
delimiter: ".",
maxListeners: 0
});
executeTransaction = (fn, type) => {
this.emitter.emit(`${type}.startTransaction`);
const result = vue.ref(null);
vue.watchEffect(() => {
result.value = fn();
});
this.emitter.emit(`${type}.endTransaction`);
};
onStartTransaction = (fn, type) => {
this.emitter.on(`${type}.startTransaction`, fn);
return () => {
this.emitter.off(`${type}.startTransaction`, fn);
};
};
onEndTransaction = (fn, type) => {
this.emitter.on(`${type}.endTransaction`, fn);
return () => {
this.emitter.off(`${type}.endTransaction`, fn);
};
};
}
const transactionManager = new TransactionManager();
exports.transactionManager = transactionManager;
//# sourceMappingURL=transaction-manager.js.map
{"version":3,"file":"transaction-manager.js","sources":["../../src/transaction-manager.ts"],"sourcesContent":["import { EventEmitter2 } from 'eventemitter2';\nimport { ref, watchEffect, type Ref } from 'vue';\n\nclass TransactionManager {\n\tprivate emitter = new EventEmitter2({\n\t\twildcard: true,\n\t\tdelimiter: '.',\n\t\tmaxListeners: 0,\n\t});\n\n\texecuteTransaction = (fn: () => void, type: any): void => {\n\t\tthis.emitter.emit(`${type}.startTransaction`);\n\t\tconst result: Ref<any> = ref(null);\n\t\twatchEffect(() => {\n\t\t\tresult.value = fn();\n\t\t});\n\t\tthis.emitter.emit(`${type}.endTransaction`);\n\t};\n\n\tonStartTransaction = (fn: () => void, type: any): (() => void) => {\n\t\tthis.emitter.on(`${type}.startTransaction`, fn);\n\t\treturn () => {\n\t\t\tthis.emitter.off(`${type}.startTransaction`, fn);\n\t\t};\n\t};\n\n\tonEndTransaction = (fn: () => void, type: any): (() => void) => {\n\t\tthis.emitter.on(`${type}.endTransaction`, fn);\n\t\treturn () => {\n\t\t\tthis.emitter.off(`${type}.endTransaction`, fn);\n\t\t};\n\t};\n}\n\nexport const transactionManager = new TransactionManager();\n"],"names":["EventEmitter2","ref","watchEffect"],"mappings":";;;;;;AAGA,M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();
function uniqueId(prefix = "") {
return `${prefix}${(guid++).toString(36).toLowerCase()}`;
}
exports.uniqueId = uniqueId;
//# sourceMappingURL=unique-id.js.map
{"version":3,"file":"unique-id.js","sources":["../../src/unique-id.ts"],"sourcesContent":["let guid = Date.now();\nexport function uniqueId(prefix = '') {\n\treturn `${prefix}${(guid++).toString(36).toLowerCase()}`;\n}\n"],"names":[],"mappings":";;;AAAA,IAAI,IAAA,GAAO,KAAK,GAAI,EAAA;AACJ,SAAA,QAAA,CAAS,SAAS,EAAI,EAAA;AACrC,EAAO,OAAA,CAAA,EAAG,MAAM,CAAI,EAAA,CAAA,IAAA,EAAA,EAAQ,SAAS,EAAE,CAAA,CAAE,aAAa,CAAA,CAAA;AACvD;;;;"}
+4
-4
{
"name": "@arvin-shu/microcode-utils",
"version": "1.1.3",
"version": "1.1.4",
"description": "microcode工具库",
"main": "src/index.ts",
"module": "src/index.ts",
"main": "lib/index.js",
"module": "es/index.js",
"files": [

@@ -19,3 +19,3 @@ "lib",

"dependencies": {
"@arvin-shu/microcode-types": "^1.0.6",
"@arvin-shu/microcode-types": "^1.0.7",
"eventemitter2": "^6.4.9",

@@ -22,0 +22,0 @@ "lodash-es": "^4.17.21"

export * from './asset';
export * from './create-content';
export * from './create-defer';
export * from './create-icon';
export * from './has-own-property';
export * from './is-css-url';
export * from './is-es-module';
export * from './is-object';
export * from './is-plain-object';
export * from './is-plugin-event-name';
export * from './is-vue';
export * from './logger';
export * from './script';
export * from './shallow-equal';
export * from './svg-icon';
export * from './unique-id';
export * from './check-types';
export * from './is-element';
export * from './node-helper';
export * from './navtive-selection';
export * from './cursor';
export * from './is-form-event';
export * from './clone-deep';
export * from './misc';
export * from './is-px';
export * from './is-shaken';
export * from './build-components';
export * from './transaction-manager';