@easy-editor/core 1.0.1 → 1.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +9 -9
- package/README.md +36 -36
- package/dist/designer/setting/setting-manager.d.ts +3 -3
- package/dist/designer/setting/setting-top-entry.d.ts +1 -0
- package/dist/document/node/node.d.ts +18 -3
- package/dist/index.cjs +1194 -412
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1178 -412
- package/dist/materials/component-meta.d.ts +15 -1
- package/dist/materials/index.d.ts +1 -0
- package/dist/materials/materials.d.ts +57 -7
- package/dist/materials/registry/index.d.ts +6 -0
- package/dist/materials/registry/material-registry.d.ts +59 -0
- package/dist/materials/registry/types.d.ts +168 -0
- package/dist/remote/core/errors.d.ts +60 -0
- package/dist/remote/core/index.d.ts +7 -0
- package/dist/remote/core/types.d.ts +60 -0
- package/dist/remote/index.d.ts +6 -0
- package/dist/remote/state/index.d.ts +6 -0
- package/dist/remote/state/loading-state.d.ts +108 -0
- package/dist/remote/state/resource-registry.d.ts +80 -0
- package/dist/simulator/index.d.ts +1 -0
- package/dist/simulator/resource-consumer.d.ts +17 -0
- package/dist/simulator/simulator.d.ts +3 -2
- package/dist/types/assets.d.ts +32 -0
- package/dist/types/component.d.ts +2 -5
- package/dist/types/index.d.ts +2 -0
- package/dist/types/meta.d.ts +5 -0
- package/dist/types/npm-info.d.ts +37 -0
- package/dist/types/schema.d.ts +6 -1
- package/dist/utils/is.d.ts +4 -1
- package/package.json +1 -1
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { Simulator } from './simulator';
|
|
2
|
+
import { type SimulatorRenderer } from './simulator-renderer';
|
|
3
|
+
export type MasterProvider = (master: Simulator) => any;
|
|
4
|
+
export type RendererConsumer<T> = (renderer: SimulatorRenderer, data: T) => Promise<any>;
|
|
5
|
+
export default class ResourceConsumer<T = any> {
|
|
6
|
+
private consumer?;
|
|
7
|
+
private emitter;
|
|
8
|
+
private accessor _data;
|
|
9
|
+
private _providing?;
|
|
10
|
+
private _consuming?;
|
|
11
|
+
private _firstConsumed;
|
|
12
|
+
private resolveFirst?;
|
|
13
|
+
constructor(provider: () => T, consumer?: RendererConsumer<T> | undefined);
|
|
14
|
+
consume(consumerOrRenderer: SimulatorRenderer | ((data: T) => any)): void;
|
|
15
|
+
dispose(): void;
|
|
16
|
+
waitFirstConsume(): Promise<any>;
|
|
17
|
+
}
|
|
@@ -4,6 +4,7 @@ import type { Scroller } from '../designer/scroller';
|
|
|
4
4
|
import { type Node } from '../document';
|
|
5
5
|
import type { Project } from '../project';
|
|
6
6
|
import type { ComponentInstance, DataSourceEngine, Snippet } from '../types';
|
|
7
|
+
import type { Asset } from '../types/assets';
|
|
7
8
|
import type { SimulatorRenderer } from './simulator-renderer';
|
|
8
9
|
import { Viewport } from './viewport';
|
|
9
10
|
export interface DropContainer {
|
|
@@ -16,7 +17,6 @@ export interface SimulatorProps {
|
|
|
16
17
|
designMode?: DesignMode;
|
|
17
18
|
device?: Device;
|
|
18
19
|
deviceClassName?: string;
|
|
19
|
-
dataSourceEngine?: DataSourceEngine;
|
|
20
20
|
[key: string]: any;
|
|
21
21
|
}
|
|
22
22
|
export interface DeviceStyleProps {
|
|
@@ -44,6 +44,7 @@ export declare class Simulator {
|
|
|
44
44
|
get excuteLifeCycleInDesignMode(): any;
|
|
45
45
|
get notFoundComponent(): any;
|
|
46
46
|
get faultComponent(): any;
|
|
47
|
+
get componentsAsset(): Asset | undefined;
|
|
47
48
|
get deviceStyle(): DeviceStyleProps | undefined;
|
|
48
49
|
get componentsMap(): {
|
|
49
50
|
[key: string]: any;
|
|
@@ -73,7 +74,7 @@ export declare class Simulator {
|
|
|
73
74
|
* force to rerender the viewport
|
|
74
75
|
*/
|
|
75
76
|
rerender(): void;
|
|
76
|
-
mountContentFrame(iframe: HTMLIFrameElement | HTMLElement | null): void
|
|
77
|
+
mountContentFrame(iframe: HTMLIFrameElement | HTMLElement | null): Promise<void>;
|
|
77
78
|
postEvent(eventName: string, ...data: any[]): void;
|
|
78
79
|
linkSnippet(ref: HTMLElement, snippet: Snippet): () => void;
|
|
79
80
|
setSuspense(suspended: boolean): boolean;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
export declare enum AssetLevel {
|
|
2
|
+
Environment = 1,
|
|
3
|
+
Library = 2,
|
|
4
|
+
Theme = 3,
|
|
5
|
+
Runtime = 4,
|
|
6
|
+
Components = 5,
|
|
7
|
+
App = 6
|
|
8
|
+
}
|
|
9
|
+
export declare const AssetLevels: AssetLevel[];
|
|
10
|
+
export type URL = string;
|
|
11
|
+
export declare enum AssetType {
|
|
12
|
+
JSUrl = "jsUrl",
|
|
13
|
+
CSSUrl = "cssUrl",
|
|
14
|
+
CSSText = "cssText",
|
|
15
|
+
JSText = "jsText",
|
|
16
|
+
Bundle = "bundle"
|
|
17
|
+
}
|
|
18
|
+
export interface AssetItem {
|
|
19
|
+
type: AssetType;
|
|
20
|
+
content?: string | null;
|
|
21
|
+
device?: string;
|
|
22
|
+
level?: AssetLevel;
|
|
23
|
+
id?: string;
|
|
24
|
+
scriptType?: string;
|
|
25
|
+
}
|
|
26
|
+
export type AssetList = Array<Asset | undefined | null>;
|
|
27
|
+
export type Asset = AssetList | AssetBundle | AssetItem | URL;
|
|
28
|
+
export interface AssetBundle {
|
|
29
|
+
type: AssetType.Bundle;
|
|
30
|
+
level?: AssetLevel;
|
|
31
|
+
assets?: Asset | AssetList | null;
|
|
32
|
+
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { NpmInfo } from './npm-info';
|
|
1
2
|
export type ComponentInstance = any;
|
|
2
3
|
export type ComponentType<T = any> = any;
|
|
3
4
|
/**
|
|
@@ -14,15 +15,11 @@ export interface LowCodeComponent {
|
|
|
14
15
|
*/
|
|
15
16
|
componentName: string;
|
|
16
17
|
}
|
|
17
|
-
export interface ProCodeComponent {
|
|
18
|
+
export interface ProCodeComponent extends NpmInfo {
|
|
18
19
|
/**
|
|
19
20
|
* 研发模式
|
|
20
21
|
*/
|
|
21
22
|
devMode: 'proCode';
|
|
22
|
-
/**
|
|
23
|
-
* 组件名称
|
|
24
|
-
*/
|
|
25
|
-
componentName: string;
|
|
26
23
|
}
|
|
27
24
|
export type ComponentMap = ProCodeComponent | LowCodeComponent;
|
|
28
25
|
export type ComponentsMap = ComponentMap[];
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
|
+
export * from './assets';
|
|
1
2
|
export * from './common';
|
|
2
3
|
export * from './component';
|
|
3
4
|
export * from './data-source';
|
|
4
5
|
export * from './editor';
|
|
5
6
|
export * from './event';
|
|
6
7
|
export * from './meta';
|
|
8
|
+
export * from './npm-info';
|
|
7
9
|
export * from './schema';
|
|
8
10
|
export * from './setter';
|
package/dist/types/meta.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { SettingField } from '../designer';
|
|
2
2
|
import type { Node, PropKey } from '../document';
|
|
3
3
|
import type { ComponentType } from './component';
|
|
4
|
+
import type { NpmInfo } from './npm-info';
|
|
4
5
|
import type { NodeSchema } from './schema';
|
|
5
6
|
import type { DynamicSetter, SetterType } from './setter';
|
|
6
7
|
export interface ComponentMetadata {
|
|
@@ -17,6 +18,10 @@ export interface ComponentMetadata {
|
|
|
17
18
|
* component dev mode
|
|
18
19
|
*/
|
|
19
20
|
devMode?: 'proCode' | 'lowCode';
|
|
21
|
+
/**
|
|
22
|
+
* npm 源引入完整描述对象
|
|
23
|
+
*/
|
|
24
|
+
npm?: NpmInfo;
|
|
20
25
|
/**
|
|
21
26
|
* component configure, for right panel to use setter to config component
|
|
22
27
|
*/
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* npm 源引入完整描述对象
|
|
3
|
+
*/
|
|
4
|
+
export interface NpmInfo {
|
|
5
|
+
/**
|
|
6
|
+
* 源码组件名称
|
|
7
|
+
*/
|
|
8
|
+
componentName?: string;
|
|
9
|
+
/**
|
|
10
|
+
* 源码组件库名
|
|
11
|
+
*/
|
|
12
|
+
package: string;
|
|
13
|
+
/**
|
|
14
|
+
* 源码组件版本号
|
|
15
|
+
*/
|
|
16
|
+
version?: string;
|
|
17
|
+
/**
|
|
18
|
+
* 是否解构
|
|
19
|
+
*/
|
|
20
|
+
destructuring?: boolean;
|
|
21
|
+
/**
|
|
22
|
+
* 源码组件名称(导出名)
|
|
23
|
+
*/
|
|
24
|
+
exportName?: string;
|
|
25
|
+
/**
|
|
26
|
+
* 子组件名
|
|
27
|
+
*/
|
|
28
|
+
subName?: string;
|
|
29
|
+
/**
|
|
30
|
+
* 组件路径
|
|
31
|
+
*/
|
|
32
|
+
main?: string;
|
|
33
|
+
/**
|
|
34
|
+
* UMD 全局变量名(扩展字段)
|
|
35
|
+
*/
|
|
36
|
+
globalName?: string;
|
|
37
|
+
}
|
package/dist/types/schema.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { CompositeValue, JSExpression, JSFunction, JSONObject, PropsMap } from '../document';
|
|
2
|
+
import type { ComponentsMap } from './component';
|
|
2
3
|
import type { DataSource } from './data-source';
|
|
3
4
|
export interface ProjectSchema<T = RootSchema> {
|
|
4
5
|
id?: string;
|
|
@@ -9,7 +10,7 @@ export interface ProjectSchema<T = RootSchema> {
|
|
|
9
10
|
/**
|
|
10
11
|
* 组件映射关系
|
|
11
12
|
*/
|
|
12
|
-
componentsMap?:
|
|
13
|
+
componentsMap?: ComponentsMap;
|
|
13
14
|
/**
|
|
14
15
|
* 组件树
|
|
15
16
|
*/
|
|
@@ -69,6 +70,10 @@ export interface RootSchema extends NodeSchema {
|
|
|
69
70
|
* 样式文件
|
|
70
71
|
*/
|
|
71
72
|
css?: string;
|
|
73
|
+
/**
|
|
74
|
+
* 异步数据源配置
|
|
75
|
+
*/
|
|
76
|
+
dataSource?: DataSource;
|
|
72
77
|
}
|
|
73
78
|
export interface NodeSchema {
|
|
74
79
|
id?: string;
|
package/dist/utils/is.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Viewport } from '../simulator/viewport';
|
|
2
|
-
import type { ComponentMap, LowCodeComponent, ProCodeComponent, SetterConfig } from '../types';
|
|
2
|
+
import type { ComponentMap, LowCodeComponent, NodeSchema, NpmInfo, ProCodeComponent, SetterConfig } from '../types';
|
|
3
3
|
export declare const isObject: (value: any) => value is Record<string, unknown>;
|
|
4
4
|
export declare const isPlainObject: (value: any) => value is any;
|
|
5
5
|
export declare const isTextNode: (node: any) => node is Text;
|
|
@@ -16,3 +16,6 @@ export declare const isProCodeComponentType: (desc: ComponentMap) => desc is Pro
|
|
|
16
16
|
export declare const isLowCodeComponentType: (desc: ComponentMap) => desc is LowCodeComponent;
|
|
17
17
|
export declare const isSetterConfig: (obj: any) => obj is SetterConfig;
|
|
18
18
|
export declare const isPluginEventName: (eventName: string) => boolean;
|
|
19
|
+
export declare const isRemoteComponent: (schema: NodeSchema | {
|
|
20
|
+
npm: NpmInfo;
|
|
21
|
+
}) => boolean;
|