@wix/editor 1.287.0
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/README.md +34 -0
- package/dist/cjs/index.js +508 -0
- package/dist/cjs/index.js.map +1 -0
- package/dist/esm/index.js +500 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/statics/index.js +508 -0
- package/dist/statics/index.js.map +1 -0
- package/dist/types/index.d.ts +224 -0
- package/package.json +63 -0
|
@@ -0,0 +1,224 @@
|
|
|
1
|
+
import * as _wix_sdk_types from '@wix/sdk-types';
|
|
2
|
+
import * as _wix_editor_platform_transport from '@wix/editor-platform-transport';
|
|
3
|
+
import { WithPromiseFunctions } from '@wix/editor-platform-transport';
|
|
4
|
+
import { PlatformAppEventEmitter, IPlatformAppEvent } from '@wix/public-editor-platform-events';
|
|
5
|
+
import { ComponentRef } from '@wix/public-editor-platform-interfaces';
|
|
6
|
+
|
|
7
|
+
declare const _default$5: {
|
|
8
|
+
__type: "host";
|
|
9
|
+
create: () => {
|
|
10
|
+
getPrivateAPI: <TApplicationPrivateAPI = any>() => Promise<TApplicationPrivateAPI>;
|
|
11
|
+
getPublicAPI: <TApplicationPrivateAPI_1 = any>(appDefinitionId: string) => Promise<TApplicationPrivateAPI_1>;
|
|
12
|
+
getAppInstance: () => Promise<any>;
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
type PrivateAPIFixMe = any;
|
|
17
|
+
interface Component<TComponentType extends string> {
|
|
18
|
+
compRef: ComponentRef;
|
|
19
|
+
type: TComponentType;
|
|
20
|
+
}
|
|
21
|
+
interface TextComponent extends Component<'text'> {
|
|
22
|
+
text(): Promise<string>;
|
|
23
|
+
text(content: string): Promise<void>;
|
|
24
|
+
}
|
|
25
|
+
interface ImageComponent extends Component<'image'> {
|
|
26
|
+
src(src?: string): Promise<void>;
|
|
27
|
+
}
|
|
28
|
+
interface UnknownComponent extends Component<'unknown'> {
|
|
29
|
+
}
|
|
30
|
+
type IComponent = TextComponent | ImageComponent | UnknownComponent;
|
|
31
|
+
type EventsToAutocomplete = 'componentSelectionChanged';
|
|
32
|
+
type AllowedEvents = Omit<string, EventsToAutocomplete> | EventsToAutocomplete;
|
|
33
|
+
type AppEventPayload<EventType extends AllowedEvents> = EventType extends 'componentSelectionChanged' ? {
|
|
34
|
+
type: EventType;
|
|
35
|
+
components: IComponent[];
|
|
36
|
+
} : Record<string, string>;
|
|
37
|
+
|
|
38
|
+
type OmitEventMeta<T> = T extends {
|
|
39
|
+
meta: any;
|
|
40
|
+
} ? Omit<T, 'meta'> : T;
|
|
41
|
+
declare class ApplicationBoundEvents {
|
|
42
|
+
private appDefinitionId;
|
|
43
|
+
private privateAPI;
|
|
44
|
+
private events;
|
|
45
|
+
subscribe: (callback: (event: IPlatformAppEvent) => void) => () => void;
|
|
46
|
+
commit: () => void;
|
|
47
|
+
startTransaction: () => void;
|
|
48
|
+
silent: (isSilent?: boolean | undefined) => void;
|
|
49
|
+
constructor(appDefinitionId: string, events: PlatformAppEventEmitter, privateAPI: PrivateAPIFixMe);
|
|
50
|
+
notify(event: OmitEventMeta<IPlatformAppEvent>): void;
|
|
51
|
+
notifyCustomEvent(type: string, payload: Record<string, string>): void;
|
|
52
|
+
/**
|
|
53
|
+
* TODO: we should use same interface for all events
|
|
54
|
+
* (subscribe vs addEventListener)
|
|
55
|
+
*/
|
|
56
|
+
addEventListener<EventType extends AllowedEvents>(eventType: EventType, fn: (payload: AppEventPayload<EventType>) => void): () => void;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
type IPrivateAPIFixMe = any;
|
|
60
|
+
declare global {
|
|
61
|
+
var __ENVIRONMENT_CONTEXT_KEY: EnvironmentContext;
|
|
62
|
+
}
|
|
63
|
+
declare enum PlatformEnvironment {
|
|
64
|
+
Worker = "Worker",
|
|
65
|
+
Frame = "Frame"
|
|
66
|
+
}
|
|
67
|
+
interface IEnvironmentContext {
|
|
68
|
+
environment: PlatformEnvironment;
|
|
69
|
+
privateApi: WithPromiseFunctions<IPrivateAPIFixMe>;
|
|
70
|
+
events: PlatformAppEventEmitter;
|
|
71
|
+
/**
|
|
72
|
+
* Probably, we need to rename this prop
|
|
73
|
+
*/
|
|
74
|
+
applicationAPIs?: Record<string, any>;
|
|
75
|
+
}
|
|
76
|
+
declare class EnvironmentContext {
|
|
77
|
+
private environmentContext;
|
|
78
|
+
private static status;
|
|
79
|
+
static inject(context: IEnvironmentContext): Promise<void>;
|
|
80
|
+
static getInstance(): Promise<EnvironmentContext>;
|
|
81
|
+
constructor(environmentContext: IEnvironmentContext);
|
|
82
|
+
getPrivateAPI(): WithPromiseFunctions<any>;
|
|
83
|
+
getEvents(): PlatformAppEventEmitter;
|
|
84
|
+
getApplicationAPIs(): Record<string, any>;
|
|
85
|
+
getEnvironment(): PlatformEnvironment;
|
|
86
|
+
}
|
|
87
|
+
declare global {
|
|
88
|
+
var __APPLICATION_CONTEXT_KEY: ApplicationContext<IApplicationContext>;
|
|
89
|
+
}
|
|
90
|
+
type IEditorApplicationContext = {
|
|
91
|
+
appDefinitionId: string;
|
|
92
|
+
};
|
|
93
|
+
type IAddonContext = {
|
|
94
|
+
appDefinitionId: string;
|
|
95
|
+
appDefinitionName: string;
|
|
96
|
+
data: {
|
|
97
|
+
toolPanelConfig: {
|
|
98
|
+
url: string;
|
|
99
|
+
width: string;
|
|
100
|
+
height: string;
|
|
101
|
+
initialPosition: {
|
|
102
|
+
x: string;
|
|
103
|
+
y: string;
|
|
104
|
+
};
|
|
105
|
+
};
|
|
106
|
+
};
|
|
107
|
+
};
|
|
108
|
+
type IApplicationContext = IEditorApplicationContext | IAddonContext;
|
|
109
|
+
declare class ApplicationContext<TContext extends IApplicationContext> {
|
|
110
|
+
private applicationContext;
|
|
111
|
+
private environment;
|
|
112
|
+
private static status;
|
|
113
|
+
/**
|
|
114
|
+
* TODO: use generics for context type
|
|
115
|
+
* - application
|
|
116
|
+
* - editor
|
|
117
|
+
*/
|
|
118
|
+
static inject<TContext extends IApplicationContext>(context: TContext): Promise<void>;
|
|
119
|
+
static getInstance<TContext extends IApplicationContext>(): Promise<ApplicationContext<TContext>>;
|
|
120
|
+
private events;
|
|
121
|
+
constructor(applicationContext: TContext, environment: EnvironmentContext);
|
|
122
|
+
getAppDefinitionId(): string;
|
|
123
|
+
getBindings(): TContext;
|
|
124
|
+
getEvents(): ApplicationBoundEvents;
|
|
125
|
+
getPrivateAPI(): _wix_editor_platform_transport.WithPromiseFunctions<any>;
|
|
126
|
+
getPrivateApplicationAPI(): any;
|
|
127
|
+
}
|
|
128
|
+
//# sourceMappingURL=index.d.ts.map
|
|
129
|
+
|
|
130
|
+
declare const _default$4: {
|
|
131
|
+
__type: "host";
|
|
132
|
+
create: () => {
|
|
133
|
+
getSelectedComponents(): Promise<IComponent[]>;
|
|
134
|
+
};
|
|
135
|
+
};
|
|
136
|
+
|
|
137
|
+
declare const _default$3: {
|
|
138
|
+
__type: "host";
|
|
139
|
+
create: () => {
|
|
140
|
+
addEventListener: (name: any, cb: (payload: AppEventPayload<AllowedEvents>) => void) => Promise<() => void>;
|
|
141
|
+
};
|
|
142
|
+
};
|
|
143
|
+
|
|
144
|
+
declare const _default$2: {
|
|
145
|
+
__type: "host";
|
|
146
|
+
create: () => {
|
|
147
|
+
getViewMode(): Promise<any>;
|
|
148
|
+
getLanguageCode(): Promise<any>;
|
|
149
|
+
};
|
|
150
|
+
};
|
|
151
|
+
|
|
152
|
+
declare const _default$1: {
|
|
153
|
+
__type: "host";
|
|
154
|
+
create: () => {
|
|
155
|
+
getProp(propName: string): Promise<string>;
|
|
156
|
+
setProp(propName: string, value: string): Promise<void>;
|
|
157
|
+
};
|
|
158
|
+
};
|
|
159
|
+
|
|
160
|
+
declare const _default: {
|
|
161
|
+
__type: "host";
|
|
162
|
+
create: () => {
|
|
163
|
+
selectMedia(options: {
|
|
164
|
+
mediaType: "IMAGE" | "VIDEO" | "DOCUMENT";
|
|
165
|
+
isMultiSelect?: boolean | undefined;
|
|
166
|
+
}): Promise<any>;
|
|
167
|
+
selectLink<TResponse = object>(options: {
|
|
168
|
+
value?: object | undefined;
|
|
169
|
+
showLinkTargetSection?: boolean | undefined;
|
|
170
|
+
}): Promise<TResponse>;
|
|
171
|
+
selectColor(options: {
|
|
172
|
+
color?: string | undefined;
|
|
173
|
+
position?: {
|
|
174
|
+
x: number;
|
|
175
|
+
y: number;
|
|
176
|
+
} | undefined;
|
|
177
|
+
}, onColorChange: (value: {
|
|
178
|
+
color: string;
|
|
179
|
+
theme: string;
|
|
180
|
+
isHover: boolean;
|
|
181
|
+
}) => void): Promise<void>;
|
|
182
|
+
selectFont(options: {
|
|
183
|
+
position?: {
|
|
184
|
+
x: number;
|
|
185
|
+
y: number;
|
|
186
|
+
} | undefined;
|
|
187
|
+
title?: string | undefined;
|
|
188
|
+
panelSectionsDefinition?: Partial<{
|
|
189
|
+
theme: "hidden" | "enabled";
|
|
190
|
+
font: "hidden" | "enabled";
|
|
191
|
+
size: "hidden" | "enabled";
|
|
192
|
+
style: "hidden" | "enabled";
|
|
193
|
+
htmlTag: "hidden" | "enabled";
|
|
194
|
+
}> | undefined;
|
|
195
|
+
fontMaxSize?: number | undefined;
|
|
196
|
+
fontMinSize?: number | undefined;
|
|
197
|
+
componentStyle?: {
|
|
198
|
+
family: string;
|
|
199
|
+
style: {
|
|
200
|
+
bold: boolean;
|
|
201
|
+
italic: boolean;
|
|
202
|
+
underline: boolean;
|
|
203
|
+
};
|
|
204
|
+
size: number;
|
|
205
|
+
preset: string;
|
|
206
|
+
editorKey: string;
|
|
207
|
+
htmlTag?: string | undefined;
|
|
208
|
+
} | undefined;
|
|
209
|
+
}, onFontChange: (value: [string, string | number | boolean, string] | [string, string]) => void): Promise<void>;
|
|
210
|
+
};
|
|
211
|
+
};
|
|
212
|
+
|
|
213
|
+
declare const editor: {
|
|
214
|
+
host: () => _wix_sdk_types.Host;
|
|
215
|
+
auth: () => {
|
|
216
|
+
getAuthHeaders: () => Promise<{
|
|
217
|
+
headers: {
|
|
218
|
+
Authorization: any;
|
|
219
|
+
};
|
|
220
|
+
}>;
|
|
221
|
+
};
|
|
222
|
+
};
|
|
223
|
+
|
|
224
|
+
export { _default$5 as application, _default$4 as components, editor, _default$3 as events, _default$2 as info, _default as inputs, _default$1 as widget };
|
package/package.json
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@wix/editor",
|
|
3
|
+
"version": "1.287.0",
|
|
4
|
+
"license": "UNLICENSED",
|
|
5
|
+
"author": {
|
|
6
|
+
"name": "Editor Platform <editor-platform-dev@wix.com>",
|
|
7
|
+
"email": "editor-platform-dev@wix.com"
|
|
8
|
+
},
|
|
9
|
+
"main": "dist/cjs/index.js",
|
|
10
|
+
"module": "dist/esm/index.js",
|
|
11
|
+
"sideEffects": false,
|
|
12
|
+
"types": "dist/types/index.d.ts",
|
|
13
|
+
"files": [
|
|
14
|
+
"dist"
|
|
15
|
+
],
|
|
16
|
+
"publishConfig": {
|
|
17
|
+
"registry": "https://registry.npmjs.org/",
|
|
18
|
+
"access": "public"
|
|
19
|
+
},
|
|
20
|
+
"unpkg": true,
|
|
21
|
+
"publishScoped": true,
|
|
22
|
+
"scripts": {
|
|
23
|
+
"start": "exit 0",
|
|
24
|
+
"build": "yarn typecheck && rollup -c",
|
|
25
|
+
"test": "exit 0",
|
|
26
|
+
"lint": "prettier --check ./src",
|
|
27
|
+
"lint:fix": "prettier --write ./src",
|
|
28
|
+
"typecheck": "tsc --noEmit"
|
|
29
|
+
},
|
|
30
|
+
"lint-staged": {
|
|
31
|
+
"*.{js,ts}": "yarn lint"
|
|
32
|
+
},
|
|
33
|
+
"dependencies": {
|
|
34
|
+
"@wix/editor-application": "1.308.0",
|
|
35
|
+
"@wix/editor-application-context": "1.231.0",
|
|
36
|
+
"@wix/editor-platform-transport": "1.5.0",
|
|
37
|
+
"@wix/public-editor-platform-errors": "1.5.0",
|
|
38
|
+
"@wix/public-editor-platform-interfaces": "1.0.0"
|
|
39
|
+
},
|
|
40
|
+
"devDependencies": {
|
|
41
|
+
"@rollup/plugin-node-resolve": "^15.2.3",
|
|
42
|
+
"esbuild": "^0.19.5",
|
|
43
|
+
"eslint": "^8.54.0",
|
|
44
|
+
"lint-staged": "^13.3.0",
|
|
45
|
+
"prettier": "^3.1.0",
|
|
46
|
+
"rollup": "^3.29.4",
|
|
47
|
+
"rollup-plugin-dts": "^6.1.0",
|
|
48
|
+
"rollup-plugin-esbuild": "^5.0.0",
|
|
49
|
+
"typescript": "~5.2.2"
|
|
50
|
+
},
|
|
51
|
+
"wix": {
|
|
52
|
+
"artifact": {
|
|
53
|
+
"groupId": "com.wixpress",
|
|
54
|
+
"artifactId": "editor-platform-sdk"
|
|
55
|
+
},
|
|
56
|
+
"validations": {
|
|
57
|
+
"postDependenciesBuild": [
|
|
58
|
+
"lint"
|
|
59
|
+
]
|
|
60
|
+
}
|
|
61
|
+
},
|
|
62
|
+
"falconPackageHash": "d18cc23a51f40fbab2185dac80a95a394bb1903d2277bde31776132b"
|
|
63
|
+
}
|