@widgetic/ui-sdk 0.1.3 → 0.1.6
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 +161 -10
- package/dist/{index.js → index.cjs} +17 -24
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +52 -0
- package/dist/index.esm.js +16 -23
- package/dist/index.esm.js.map +1 -1
- package/dist/sdk/core/component.d.cts +46 -0
- package/dist/sdk/core/component.d.ts +1 -1
- package/dist/sdk/core/component.d.ts.map +1 -1
- package/dist/sdk/core/events.d.cts +25 -0
- package/dist/sdk/core/events.d.ts +1 -1
- package/dist/sdk/core/events.d.ts.map +1 -1
- package/dist/sdk/core/index.d.cts +32 -0
- package/dist/sdk/core/index.d.ts +6 -6
- package/dist/sdk/core/index.d.ts.map +1 -1
- package/dist/sdk/core/lifecycle.d.cts +96 -0
- package/dist/sdk/core/lifecycle.d.ts +3 -3
- package/dist/sdk/core/lifecycle.d.ts.map +1 -1
- package/dist/sdk/core/local-events.d.cts +24 -0
- package/dist/sdk/core/local-events.d.ts +1 -1
- package/dist/sdk/core/local-events.d.ts.map +1 -1
- package/dist/sdk/core/messaging.d.cts +57 -0
- package/dist/sdk/core/messaging.d.ts +2 -2
- package/dist/sdk/core/messaging.d.ts.map +1 -1
- package/dist/sdk/core/state.d.cts +64 -0
- package/dist/sdk/core/state.d.ts +10 -3
- package/dist/sdk/core/state.d.ts.map +1 -1
- package/dist/sdk/core/theme-mode.d.cts +43 -0
- package/dist/sdk/core/theme-mode.d.ts +1 -1
- package/dist/sdk/core/theme-mode.d.ts.map +1 -1
- package/dist/sdk/core/theme.d.cts +57 -0
- package/dist/sdk/core/theme.d.ts +2 -2
- package/dist/sdk/core/theme.d.ts.map +1 -1
- package/dist/sdk/index.d.cts +3 -0
- package/dist/sdk/index.d.ts +1 -1
- package/dist/sdk/index.d.ts.map +1 -1
- package/dist/sdk/integration/host.d.cts +53 -0
- package/dist/sdk/integration/host.d.ts +2 -2
- package/dist/sdk/integration/host.d.ts.map +1 -1
- package/dist/sdk/integration/index.d.cts +18 -0
- package/dist/sdk/integration/index.d.ts +1 -1
- package/dist/sdk/integration/index.d.ts.map +1 -1
- package/dist/sdk/layers/index.d.cts +35 -0
- package/dist/sdk/loader/ui.d.cts +207 -0
- package/dist/sdk/loader/ui.d.ts +49 -6
- package/dist/sdk/loader/ui.d.ts.map +1 -1
- package/dist/sdk/modules/index.d.cts +8 -0
- package/dist/sdk/modules/index.d.ts +1 -1
- package/dist/sdk/modules/index.d.ts.map +1 -1
- package/dist/sdk/modules/loader.d.cts +83 -0
- package/dist/sdk/modules/loader.d.ts +1 -1
- package/dist/sdk/modules/loader.d.ts.map +1 -1
- package/dist/sdk/types/component.d.cts +214 -0
- package/dist/sdk/types/component.d.ts +49 -11
- package/dist/sdk/types/component.d.ts.map +1 -1
- package/dist/sdk/types/events.d.cts +111 -0
- package/dist/sdk/types/events.d.ts.map +1 -1
- package/dist/sdk/types/index.d.cts +43 -0
- package/dist/sdk/types/index.d.ts +8 -6
- package/dist/sdk/types/index.d.ts.map +1 -1
- package/dist/sdk/types/messaging.d.cts +40 -0
- package/dist/sdk/types/module-events.d.cts +212 -0
- package/dist/sdk/types/module-events.d.ts +213 -0
- package/dist/sdk/types/module-events.d.ts.map +1 -0
- package/dist/sdk/types/module-language.d.cts +46 -0
- package/dist/sdk/types/module-media-library.d.cts +143 -0
- package/dist/sdk/types/module-media-library.d.ts +144 -0
- package/dist/sdk/types/module-media-library.d.ts.map +1 -0
- package/dist/sdk/types/module-theme.d.cts +96 -0
- package/dist/sdk/types/module-theme.d.ts +1 -1
- package/dist/sdk/types/module-theme.d.ts.map +1 -1
- package/dist/sdk/types/state.d.cts +37 -0
- package/dist/sdk/types/state.d.ts.map +1 -1
- package/dist/sdk/types/theme.d.cts +75 -0
- package/dist/sdk/utils/config.d.cts +69 -0
- package/dist/sdk/utils/config.d.ts.map +1 -1
- package/dist/sdk/utils/errors.d.cts +55 -0
- package/dist/sdk/utils/errors.d.ts +1 -1
- package/dist/sdk/utils/errors.d.ts.map +1 -1
- package/dist/sdk/utils/http.d.cts +20 -0
- package/dist/sdk/utils/security.d.cts +94 -0
- package/dist/sdk/utils/validation.d.cts +63 -0
- package/dist/sdk/utils/validation.d.ts +1 -1
- package/dist/sdk/utils/validation.d.ts.map +1 -1
- package/dist/sdk/version.d.cts +10 -0
- package/dist/sdk/version.d.ts +5 -2
- package/dist/sdk/version.d.ts.map +1 -1
- package/dist/services/dataService.d.cts +9 -0
- package/dist/services/dataService.d.ts +4 -4
- package/dist/services/dataService.d.ts.map +1 -1
- package/dist/umd/ui-sdk.js +1 -1
- package/dist/umd/ui-sdk.js.map +1 -1
- package/dist/utils/caseConversion.d.cts +2 -0
- package/dist/utils/caseConversion.d.ts +2 -2
- package/dist/utils/caseConversion.d.ts.map +1 -1
- package/modules/README.md +79 -43
- package/package.json +24 -10
- package/dist/index.js.map +0 -1
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* High-Level UI API for UI SDK
|
|
3
|
+
*
|
|
4
|
+
* The shortest way to put a Widgetic module on a page: configure once, then mount by name.
|
|
5
|
+
* Perfect for: Quick integration, HTML-first approaches, minimal JavaScript.
|
|
6
|
+
*
|
|
7
|
+
* For anything more (several instances, events, different tokens per module) use `WidgeticUI` or `mountModule`
|
|
8
|
+
* directly. The mid-level and low-level APIs that used to sit beside this one handed out the SDK's internals,
|
|
9
|
+
* including an HTTP client that sent an API key from the browser; they were removed.
|
|
10
|
+
*/
|
|
11
|
+
import { WidgeticUI, type WidgeticUIOptions } from '../loader/ui.cjs';
|
|
12
|
+
import type { ModuleName, MountConfig } from '../types/index.cjs';
|
|
13
|
+
/**
|
|
14
|
+
* High-Level UI API - Declarative & Auto-magical
|
|
15
|
+
*
|
|
16
|
+
* Characteristics: one-call initialization, convention over configuration.
|
|
17
|
+
*/
|
|
18
|
+
export declare const HighLevelUIAPI: {
|
|
19
|
+
readonly WidgeticUI: typeof WidgeticUI;
|
|
20
|
+
/**
|
|
21
|
+
* Configure the shared SDK instance. Calling it again replaces the instance and unmounts what the old one mounted.
|
|
22
|
+
*/
|
|
23
|
+
readonly initialize: (options: WidgeticUIOptions) => Promise<WidgeticUI>;
|
|
24
|
+
/**
|
|
25
|
+
* Mount a module into a container, given as an element or a CSS selector.
|
|
26
|
+
* @returns The instance ID to hand to `unmountComponent`
|
|
27
|
+
*/
|
|
28
|
+
readonly mountComponent: (type: ModuleName, container: HTMLElement | string, options?: Omit<MountConfig, "container">) => Promise<string>;
|
|
29
|
+
/**
|
|
30
|
+
* Take a mounted module down.
|
|
31
|
+
* @param instanceId - What `mountComponent` returned
|
|
32
|
+
*/
|
|
33
|
+
readonly unmountComponent: (instanceId: string) => Promise<void>;
|
|
34
|
+
};
|
|
35
|
+
export type HighLevelUIAPIType = typeof HighLevelUIAPI;
|
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Widgetic UI SDK Main Class
|
|
3
|
+
* Central entry point for the SDK that:
|
|
4
|
+
* - Loads Widgetic UI modules (File Browser, editors ...) from the CDN and mounts them into the partner's page
|
|
5
|
+
* - Manages their lifecycle
|
|
6
|
+
* - Passes them the partner's `getToken` so they can talk to the Widgetic API
|
|
7
|
+
* - Controls their look: light/dark, a built-in theme, the partner's own colours, corner radius and font
|
|
8
|
+
*
|
|
9
|
+
* The SDK holds no credentials. The partner's server mints a short-lived editor session token
|
|
10
|
+
* (`POST /v1/managed-users/{id}/editor-sessions`, authenticated with the partner's API key, which never leaves
|
|
11
|
+
* that server) and the partner's `getToken` function returns it:
|
|
12
|
+
*
|
|
13
|
+
* const ui = new WidgeticUI({ getToken: async () => (await fetch('/my-server/widgetic-session')).json() });
|
|
14
|
+
* const fileBrowser = await ui.mount('file-browser', { container: '#files', on: { select: ({ files }) => use(files) } });
|
|
15
|
+
* ...
|
|
16
|
+
* await fileBrowser.unmount();
|
|
17
|
+
*/
|
|
18
|
+
import type { EventHandler, GetToken, ModuleName, MountConfig, MountedModule, SDKEvent, SDKEventType, ThemeMode, UIModule } from '../types/index.cjs';
|
|
19
|
+
import { type ThemeOption, type ThemeSettings } from '../core/theme-mode.cjs';
|
|
20
|
+
import { ModuleLoader } from '../modules/loader.cjs';
|
|
21
|
+
export interface WidgeticUIOptions {
|
|
22
|
+
/**
|
|
23
|
+
* Asks your server for an editor session token. Called when a module starts and again before the token
|
|
24
|
+
* expires. Resolve with the token, or with `{ token, expiresAt }` so the module renews it in time.
|
|
25
|
+
*
|
|
26
|
+
* Needed by every module that shows the visitor's Widgetic data. A module that is given its data by the page
|
|
27
|
+
* (the File Browser with a `mediaLibrary` of your own) never asks for it. A module that needs a token and has
|
|
28
|
+
* none refuses to start, and says so.
|
|
29
|
+
*/
|
|
30
|
+
getToken?: GetToken;
|
|
31
|
+
/** The Widgetic API origin. Default `https://api.widgetic.com`. */
|
|
32
|
+
apiUrl?: string;
|
|
33
|
+
/** Where modules are served from. Default `https://cdn.widgetic.com/modules`. Change it to self-host or to test. */
|
|
34
|
+
moduleBaseUrl?: string;
|
|
35
|
+
/**
|
|
36
|
+
* The look of every module: `'light'`, `'dark'`, `'system'` (follow the visitor's operating system), and/or a built-in
|
|
37
|
+
* `preset`, your `colors`, a `radius` and a `font`. Default: light, the Widgetic look. Can be changed later with
|
|
38
|
+
* `updateTheme`. A mount call can bring a theme of its own, so the modules on one page can look different.
|
|
39
|
+
*/
|
|
40
|
+
theme?: ThemeOption;
|
|
41
|
+
/**
|
|
42
|
+
* A BCP 47 language tag like `en` or `de`, handed to every module. A module that has words to translate (every module
|
|
43
|
+
* today: the File Browser, the composition editor and the widget creator) uses it for plural rules and for how
|
|
44
|
+
* numbers, dates and file sizes are written; the words themselves come from the module's `messages` option, and
|
|
45
|
+
* `mounted.setLanguage(...)` changes both while it is on screen.
|
|
46
|
+
*/
|
|
47
|
+
locale?: string;
|
|
48
|
+
/**
|
|
49
|
+
* Advanced: the loader to use, for control over retries or the fetch used. Without one, every `WidgeticUI` on the
|
|
50
|
+
* page that uses the same `moduleBaseUrl` shares one loader, so a module is downloaded once and every instance
|
|
51
|
+
* runs the same version of it. When given, `moduleBaseUrl` is ignored (the loader already knows where modules are).
|
|
52
|
+
*/
|
|
53
|
+
moduleLoader?: ModuleLoader;
|
|
54
|
+
}
|
|
55
|
+
export declare class WidgeticUI {
|
|
56
|
+
private readonly events;
|
|
57
|
+
private readonly lifecycleManager;
|
|
58
|
+
private readonly loader;
|
|
59
|
+
private themeMode;
|
|
60
|
+
/** What the page-wide theme sets besides the mode (preset, colours, radius, font). */
|
|
61
|
+
private themeSettings;
|
|
62
|
+
private stopWatchingSystemTheme;
|
|
63
|
+
/**
|
|
64
|
+
* Initialize the SDK. Nothing is downloaded and nothing on the page is touched until a module is mounted.
|
|
65
|
+
* @param options - How modules reach the partner's token and the Widgetic API
|
|
66
|
+
*/
|
|
67
|
+
constructor(options?: WidgeticUIOptions);
|
|
68
|
+
/**
|
|
69
|
+
* Mount a module into a container.
|
|
70
|
+
*
|
|
71
|
+
* For `file-browser`, `composition-editor` and `widget-creator` the event names and payloads of `on` (and of `.on` on
|
|
72
|
+
* the result) are typed from the name you pass. `Module` is the type of the module instance (`mounted.module`): give
|
|
73
|
+
* it as the one type argument, `mount<MyModule>('file-browser', …)`, and the events stay checked. For any other module
|
|
74
|
+
* (`embed-editor` too), or a name that is not a literal, give both: `mount<MyModule, 'acme-chart'>('acme-chart', …)`.
|
|
75
|
+
*
|
|
76
|
+
* There is one signature for each module whose events are typed, because TypeScript cannot infer the name when only
|
|
77
|
+
* `Module` is given. They have to stay in step with `ModuleEventMap` (`tests/unit/typedEvents.test.ts` fails when one
|
|
78
|
+
* is missing). The signature with both type arguments comes last, so that a wrong event name is reported from it. Keep
|
|
79
|
+
* the others to three: with four or more, TypeScript explains a failed call with one type argument only from the last
|
|
80
|
+
* signature, which blames the wrong module.
|
|
81
|
+
* @param type - Which module, like `file-browser`
|
|
82
|
+
* @param config - The container, SDK options (`version`, `theme`, `on` ...) and the module's own options
|
|
83
|
+
* @returns The mounted module: subscribe with `.on`, take it down with `.unmount()`
|
|
84
|
+
*/
|
|
85
|
+
mount<Module extends UIModule = UIModule>(type: 'file-browser', config: MountConfig<'file-browser'>): Promise<MountedModule<Module, 'file-browser'>>;
|
|
86
|
+
/** Mount the composition editor. `on` and `.on` know its events (see the first signature of `mount`). */
|
|
87
|
+
mount<Module extends UIModule = UIModule>(type: 'composition-editor', config: MountConfig<'composition-editor'>): Promise<MountedModule<Module, 'composition-editor'>>;
|
|
88
|
+
/** Mount the widget creator. `on` and `.on` know its events (see the first signature of `mount`). */
|
|
89
|
+
mount<Module extends UIModule = UIModule>(type: 'widget-creator', config: MountConfig<'widget-creator'>): Promise<MountedModule<Module, 'widget-creator'>>;
|
|
90
|
+
/**
|
|
91
|
+
* Mount a module by a name that is not one literal of the above (`embed-editor`, a module this SDK has no types for, a
|
|
92
|
+
* union, a `string`), or with both type arguments. Events are checked when the name is a literal of a typed module, or
|
|
93
|
+
* a union of them.
|
|
94
|
+
*/
|
|
95
|
+
mount<Module extends UIModule, Name extends ModuleName>(type: Name, config: MountConfig<Name>): Promise<MountedModule<Module, Name>>;
|
|
96
|
+
/**
|
|
97
|
+
* Mount a module and get its instance ID back. `mount` is usually more convenient because it returns the
|
|
98
|
+
* module itself.
|
|
99
|
+
* @param type - Type of component to mount
|
|
100
|
+
* @param config - Component configuration
|
|
101
|
+
* @returns Promise resolving to instance ID
|
|
102
|
+
*/
|
|
103
|
+
mountComponent<Name extends ModuleName = ModuleName>(type: Name, config: MountConfig<Name>): Promise<string>;
|
|
104
|
+
/**
|
|
105
|
+
* Unmount a component instance
|
|
106
|
+
* @param instanceId - ID of instance to unmount
|
|
107
|
+
*/
|
|
108
|
+
unmountComponent(instanceId: string): Promise<void>;
|
|
109
|
+
/**
|
|
110
|
+
* A module that is currently mounted
|
|
111
|
+
* @param instanceId - ID returned by `mountComponent`, or `id` of a mounted module
|
|
112
|
+
*/
|
|
113
|
+
getComponent(instanceId: string): MountedModule | undefined;
|
|
114
|
+
/**
|
|
115
|
+
* Download a module ahead of time, so mounting it later is instant. Mounting does this by itself;
|
|
116
|
+
* call it when the page knows the visitor is likely to open the module soon.
|
|
117
|
+
* @param type - Which module
|
|
118
|
+
* @param options.version - Pin an exact version
|
|
119
|
+
*/
|
|
120
|
+
preload(type: ModuleName, options?: {
|
|
121
|
+
version?: string;
|
|
122
|
+
}): Promise<void>;
|
|
123
|
+
/**
|
|
124
|
+
* Change the look of every mounted module (and every module mounted later).
|
|
125
|
+
*
|
|
126
|
+
* ui.updateTheme('dark'); // the mode only: every module keeps its colours, radius, font
|
|
127
|
+
* ui.updateTheme({ preset: 'ocean' }); // a new look for the modules that have no theme of their own
|
|
128
|
+
* ui.updateTheme({ mode: 'dark', colors: { primary: '#e0541b' } });
|
|
129
|
+
*
|
|
130
|
+
* A bare mode (or `{ mode }`) changes the mode of every module and keeps the rest of its theme. Settings replace the
|
|
131
|
+
* page-wide theme, which is what every module without settings of its own has; a module whose mount call (or its own
|
|
132
|
+
* `setTheme`) brought settings keeps them, and follows the mode when the call sets one.
|
|
133
|
+
*
|
|
134
|
+
* @param theme - `'light'`, `'dark'`, `'system'`, or an object with some of `mode`, `preset`, `colors`, `radius`, `font`
|
|
135
|
+
* @throws `INVALID_THEME` for anything else. A module that refuses the settings reports it in the console and keeps its look.
|
|
136
|
+
*/
|
|
137
|
+
updateTheme(theme: ThemeOption): void;
|
|
138
|
+
/**
|
|
139
|
+
* Get the current page-wide theme
|
|
140
|
+
* @returns The mode the SDK was asked for (`system` stays `system`), and the preset, colours, radius and font if it was given any
|
|
141
|
+
*/
|
|
142
|
+
getTheme(): {
|
|
143
|
+
mode: ThemeMode;
|
|
144
|
+
} & ThemeSettings;
|
|
145
|
+
/**
|
|
146
|
+
* Subscribe to SDK events
|
|
147
|
+
* @param event - Event type to subscribe to
|
|
148
|
+
* @param handler - Event handler function
|
|
149
|
+
* @returns Unsubscribe function
|
|
150
|
+
*/
|
|
151
|
+
on(event: SDKEventType, handler: EventHandler): () => void;
|
|
152
|
+
/**
|
|
153
|
+
* Unsubscribe from SDK events
|
|
154
|
+
* @param event - Event type to unsubscribe from
|
|
155
|
+
* @param handler - Event handler to remove
|
|
156
|
+
*/
|
|
157
|
+
off(event: SDKEventType, handler: EventHandler): void;
|
|
158
|
+
/**
|
|
159
|
+
* Emit SDK events with type-safe payload
|
|
160
|
+
* @param type - Event type to emit
|
|
161
|
+
* @param data - Event data
|
|
162
|
+
*/
|
|
163
|
+
emit<T extends SDKEvent['type']>(type: T, data: Omit<Extract<SDKEvent, {
|
|
164
|
+
type: T;
|
|
165
|
+
}>, 'type'>): void;
|
|
166
|
+
/**
|
|
167
|
+
* Cleanup and destroy SDK instance
|
|
168
|
+
* Unmounts every module this instance mounted and stops listening for anything.
|
|
169
|
+
*/
|
|
170
|
+
destroy(): Promise<void>;
|
|
171
|
+
/** While the theme is `system`, mounted modules follow the visitor's system; otherwise there is nothing to follow. */
|
|
172
|
+
private followSystemThemeWhenAsked;
|
|
173
|
+
}
|
|
174
|
+
/**
|
|
175
|
+
* Mount one module with a single call: the SDK is created, the module is mounted, and `unmount()` on the result
|
|
176
|
+
* takes both down. Use `new WidgeticUI(...)` when a page mounts several modules.
|
|
177
|
+
*
|
|
178
|
+
* const fileBrowser = await mountModule('file-browser', {
|
|
179
|
+
* container: document.getElementById('files'),
|
|
180
|
+
* getToken: async () => (await fetch('/my-server/widgetic-session')).json(),
|
|
181
|
+
* on: { select: ({ files }) => useFiles(files) },
|
|
182
|
+
* });
|
|
183
|
+
*
|
|
184
|
+
* For `file-browser`, `composition-editor` and `widget-creator` the event names and payloads of `on` (and of `.on` on the
|
|
185
|
+
* result) are typed from the name you pass: `select` above gets `{ files: PickedFile[] }`, and an event the module does
|
|
186
|
+
* not have does not compile. `Module` is the type of the module instance (`mounted.module`): give it as the one type
|
|
187
|
+
* argument, `mountModule<MyModule>('file-browser', …)`, and the events stay checked. For any other module (`embed-editor`
|
|
188
|
+
* too), or a name that is not a literal, give both: `mountModule<MyModule, 'acme-chart'>('acme-chart', …)`.
|
|
189
|
+
*
|
|
190
|
+
* There is one signature for each module whose events are typed, because TypeScript cannot infer the name when only
|
|
191
|
+
* `Module` is given. They have to stay in step with `ModuleEventMap` (`tests/unit/typedEvents.test.ts` fails when one is
|
|
192
|
+
* missing). The signature with both type arguments comes last, so that a wrong event name is reported from it. Keep the
|
|
193
|
+
* others to three: with four or more, TypeScript explains a failed call with one type argument only from the last
|
|
194
|
+
* signature, which blames the wrong module.
|
|
195
|
+
*/
|
|
196
|
+
export declare function mountModule<Module extends UIModule = UIModule>(type: 'file-browser', options: WidgeticUIOptions & MountConfig<'file-browser'>): Promise<MountedModule<Module, 'file-browser'>>;
|
|
197
|
+
/** Mount the composition editor. `on` and `.on` know its events (see the first signature of `mountModule`). */
|
|
198
|
+
export declare function mountModule<Module extends UIModule = UIModule>(type: 'composition-editor', options: WidgeticUIOptions & MountConfig<'composition-editor'>): Promise<MountedModule<Module, 'composition-editor'>>;
|
|
199
|
+
/** Mount the widget creator. `on` and `.on` know its events (see the first signature of `mountModule`). */
|
|
200
|
+
export declare function mountModule<Module extends UIModule = UIModule>(type: 'widget-creator', options: WidgeticUIOptions & MountConfig<'widget-creator'>): Promise<MountedModule<Module, 'widget-creator'>>;
|
|
201
|
+
/**
|
|
202
|
+
* Mount a module by a name that is not one literal of the above (`embed-editor`, a module this SDK has no types for, a
|
|
203
|
+
* union, a `string`), or with both type arguments. Events are checked when the name is a literal of a typed module, or a
|
|
204
|
+
* union of them.
|
|
205
|
+
*/
|
|
206
|
+
export declare function mountModule<Module extends UIModule, Name extends ModuleName>(type: Name, options: WidgeticUIOptions & MountConfig<Name>): Promise<MountedModule<Module, Name>>;
|
|
207
|
+
export default WidgeticUI;
|
package/dist/sdk/loader/ui.d.ts
CHANGED
|
@@ -15,9 +15,9 @@
|
|
|
15
15
|
* ...
|
|
16
16
|
* await fileBrowser.unmount();
|
|
17
17
|
*/
|
|
18
|
-
import type { EventHandler, GetToken, ModuleName, MountConfig, MountedModule, SDKEvent, SDKEventType, ThemeMode, UIModule } from '../types';
|
|
19
|
-
import { type ThemeOption, type ThemeSettings } from '../core/theme-mode';
|
|
20
|
-
import { ModuleLoader } from '../modules/loader';
|
|
18
|
+
import type { EventHandler, GetToken, ModuleName, MountConfig, MountedModule, SDKEvent, SDKEventType, ThemeMode, UIModule } from '../types/index.js';
|
|
19
|
+
import { type ThemeOption, type ThemeSettings } from '../core/theme-mode.js';
|
|
20
|
+
import { ModuleLoader } from '../modules/loader.js';
|
|
21
21
|
export interface WidgeticUIOptions {
|
|
22
22
|
/**
|
|
23
23
|
* Asks your server for an editor session token. Called when a module starts and again before the token
|
|
@@ -67,11 +67,32 @@ export declare class WidgeticUI {
|
|
|
67
67
|
constructor(options?: WidgeticUIOptions);
|
|
68
68
|
/**
|
|
69
69
|
* Mount a module into a container.
|
|
70
|
+
*
|
|
71
|
+
* For `file-browser`, `composition-editor` and `widget-creator` the event names and payloads of `on` (and of `.on` on
|
|
72
|
+
* the result) are typed from the name you pass. `Module` is the type of the module instance (`mounted.module`): give
|
|
73
|
+
* it as the one type argument, `mount<MyModule>('file-browser', …)`, and the events stay checked. For any other module
|
|
74
|
+
* (`embed-editor` too), or a name that is not a literal, give both: `mount<MyModule, 'acme-chart'>('acme-chart', …)`.
|
|
75
|
+
*
|
|
76
|
+
* There is one signature for each module whose events are typed, because TypeScript cannot infer the name when only
|
|
77
|
+
* `Module` is given. They have to stay in step with `ModuleEventMap` (`tests/unit/typedEvents.test.ts` fails when one
|
|
78
|
+
* is missing). The signature with both type arguments comes last, so that a wrong event name is reported from it. Keep
|
|
79
|
+
* the others to three: with four or more, TypeScript explains a failed call with one type argument only from the last
|
|
80
|
+
* signature, which blames the wrong module.
|
|
70
81
|
* @param type - Which module, like `file-browser`
|
|
71
82
|
* @param config - The container, SDK options (`version`, `theme`, `on` ...) and the module's own options
|
|
72
83
|
* @returns The mounted module: subscribe with `.on`, take it down with `.unmount()`
|
|
73
84
|
*/
|
|
74
|
-
mount<Module extends UIModule = UIModule>(type:
|
|
85
|
+
mount<Module extends UIModule = UIModule>(type: 'file-browser', config: MountConfig<'file-browser'>): Promise<MountedModule<Module, 'file-browser'>>;
|
|
86
|
+
/** Mount the composition editor. `on` and `.on` know its events (see the first signature of `mount`). */
|
|
87
|
+
mount<Module extends UIModule = UIModule>(type: 'composition-editor', config: MountConfig<'composition-editor'>): Promise<MountedModule<Module, 'composition-editor'>>;
|
|
88
|
+
/** Mount the widget creator. `on` and `.on` know its events (see the first signature of `mount`). */
|
|
89
|
+
mount<Module extends UIModule = UIModule>(type: 'widget-creator', config: MountConfig<'widget-creator'>): Promise<MountedModule<Module, 'widget-creator'>>;
|
|
90
|
+
/**
|
|
91
|
+
* Mount a module by a name that is not one literal of the above (`embed-editor`, a module this SDK has no types for, a
|
|
92
|
+
* union, a `string`), or with both type arguments. Events are checked when the name is a literal of a typed module, or
|
|
93
|
+
* a union of them.
|
|
94
|
+
*/
|
|
95
|
+
mount<Module extends UIModule, Name extends ModuleName>(type: Name, config: MountConfig<Name>): Promise<MountedModule<Module, Name>>;
|
|
75
96
|
/**
|
|
76
97
|
* Mount a module and get its instance ID back. `mount` is usually more convenient because it returns the
|
|
77
98
|
* module itself.
|
|
@@ -79,7 +100,7 @@ export declare class WidgeticUI {
|
|
|
79
100
|
* @param config - Component configuration
|
|
80
101
|
* @returns Promise resolving to instance ID
|
|
81
102
|
*/
|
|
82
|
-
mountComponent(type:
|
|
103
|
+
mountComponent<Name extends ModuleName = ModuleName>(type: Name, config: MountConfig<Name>): Promise<string>;
|
|
83
104
|
/**
|
|
84
105
|
* Unmount a component instance
|
|
85
106
|
* @param instanceId - ID of instance to unmount
|
|
@@ -159,7 +180,29 @@ export declare class WidgeticUI {
|
|
|
159
180
|
* getToken: async () => (await fetch('/my-server/widgetic-session')).json(),
|
|
160
181
|
* on: { select: ({ files }) => useFiles(files) },
|
|
161
182
|
* });
|
|
183
|
+
*
|
|
184
|
+
* For `file-browser`, `composition-editor` and `widget-creator` the event names and payloads of `on` (and of `.on` on the
|
|
185
|
+
* result) are typed from the name you pass: `select` above gets `{ files: PickedFile[] }`, and an event the module does
|
|
186
|
+
* not have does not compile. `Module` is the type of the module instance (`mounted.module`): give it as the one type
|
|
187
|
+
* argument, `mountModule<MyModule>('file-browser', …)`, and the events stay checked. For any other module (`embed-editor`
|
|
188
|
+
* too), or a name that is not a literal, give both: `mountModule<MyModule, 'acme-chart'>('acme-chart', …)`.
|
|
189
|
+
*
|
|
190
|
+
* There is one signature for each module whose events are typed, because TypeScript cannot infer the name when only
|
|
191
|
+
* `Module` is given. They have to stay in step with `ModuleEventMap` (`tests/unit/typedEvents.test.ts` fails when one is
|
|
192
|
+
* missing). The signature with both type arguments comes last, so that a wrong event name is reported from it. Keep the
|
|
193
|
+
* others to three: with four or more, TypeScript explains a failed call with one type argument only from the last
|
|
194
|
+
* signature, which blames the wrong module.
|
|
195
|
+
*/
|
|
196
|
+
export declare function mountModule<Module extends UIModule = UIModule>(type: 'file-browser', options: WidgeticUIOptions & MountConfig<'file-browser'>): Promise<MountedModule<Module, 'file-browser'>>;
|
|
197
|
+
/** Mount the composition editor. `on` and `.on` know its events (see the first signature of `mountModule`). */
|
|
198
|
+
export declare function mountModule<Module extends UIModule = UIModule>(type: 'composition-editor', options: WidgeticUIOptions & MountConfig<'composition-editor'>): Promise<MountedModule<Module, 'composition-editor'>>;
|
|
199
|
+
/** Mount the widget creator. `on` and `.on` know its events (see the first signature of `mountModule`). */
|
|
200
|
+
export declare function mountModule<Module extends UIModule = UIModule>(type: 'widget-creator', options: WidgeticUIOptions & MountConfig<'widget-creator'>): Promise<MountedModule<Module, 'widget-creator'>>;
|
|
201
|
+
/**
|
|
202
|
+
* Mount a module by a name that is not one literal of the above (`embed-editor`, a module this SDK has no types for, a
|
|
203
|
+
* union, a `string`), or with both type arguments. Events are checked when the name is a literal of a typed module, or a
|
|
204
|
+
* union of them.
|
|
162
205
|
*/
|
|
163
|
-
export declare function mountModule<Module extends UIModule
|
|
206
|
+
export declare function mountModule<Module extends UIModule, Name extends ModuleName>(type: Name, options: WidgeticUIOptions & MountConfig<Name>): Promise<MountedModule<Module, Name>>;
|
|
164
207
|
export default WidgeticUI;
|
|
165
208
|
//# sourceMappingURL=ui.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ui.d.ts","sourceRoot":"","sources":["../../../src/sdk/loader/ui.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AACH,OAAO,KAAK,EACR,YAAY,EACZ,QAAQ,EACR,UAAU,EACV,WAAW,EACX,aAAa,EACb,QAAQ,EACR,YAAY,EACZ,SAAS,EACT,QAAQ,EACX,MAAM,
|
|
1
|
+
{"version":3,"file":"ui.d.ts","sourceRoot":"","sources":["../../../src/sdk/loader/ui.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AACH,OAAO,KAAK,EACR,YAAY,EACZ,QAAQ,EACR,UAAU,EACV,WAAW,EACX,aAAa,EACb,QAAQ,EACR,YAAY,EACZ,SAAS,EACT,QAAQ,EACX,MAAM,mBAAmB,CAAC;AAG3B,OAAO,EAA0F,KAAK,WAAW,EAAE,KAAK,aAAa,EAAE,MAAM,uBAAuB,CAAC;AACrK,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAKpD,MAAM,WAAW,iBAAiB;IAC9B;;;;;;;OAOG;IACH,QAAQ,CAAC,EAAE,QAAQ,CAAC;IACpB,mEAAmE;IACnE,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,oHAAoH;IACpH,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB;;;;OAIG;IACH,KAAK,CAAC,EAAE,WAAW,CAAC;IACpB;;;;;OAKG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;;;OAIG;IACH,YAAY,CAAC,EAAE,YAAY,CAAC;CAC/B;AA0BD,q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c,CAAC,CAAC,CAAC;AAChM,+GAA+G;AAC/G,wBAAgB,WAAW,CAAC,MAAM,SAAS,QAAQ,GAAG,QAAQ,EAAE,IAAI,EAAE,oBAAoB,EAAE,OAAO,EAAE,iBAAiB,GAAG,WAAW,CAAC,oBAAoB,CAAC,GAAG,OAAO,CAAC,aAAa,CAAC,MAAM,EAAE,oBAAoB,CAAC,CAAC,CAAC;AAClN,2GAA2G;AAC3G,wBAAgB,WAAW,CAAC,MAAM,SAAS,QAAQ,GAAG,QAAQ,EAAE,IAAI,EAAE,gBAAgB,EAAE,OAAO,EAAE,iBAAiB,GAAG,WAAW,CAAC,gBAAgB,CAAC,GAAG,OAAO,CAAC,aAAa,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAAC,CAAC;AACtM;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,MAAM,SAAS,QAAQ,EAAE,IAAI,SAAS,UAAU,EAAE,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,iBAAiB,GAAG,WAAW,CAAC,IAAI,CAAC,GAAG,OAAO,CAAC,aAAa,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC,CAAC;AA2ChL,eAAe,UAAU,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Modules
|
|
3
|
+
* How the SDK finds and loads Widgetic UI modules (File Browser, editors ...).
|
|
4
|
+
*
|
|
5
|
+
* The module classes themselves are not in the SDK: each one is built separately, published to the CDN and
|
|
6
|
+
* imported on demand by the `ModuleLoader`, so the SDK stays small and a module can be updated without a new SDK.
|
|
7
|
+
*/
|
|
8
|
+
export { ModuleLoader, ModuleLoadError, type LoadedModule, type ModuleConstructor, type ModuleLoaderOptions, type ModuleLoadErrorCode, } from './loader.cjs';
|
|
@@ -5,5 +5,5 @@
|
|
|
5
5
|
* The module classes themselves are not in the SDK: each one is built separately, published to the CDN and
|
|
6
6
|
* imported on demand by the `ModuleLoader`, so the SDK stays small and a module can be updated without a new SDK.
|
|
7
7
|
*/
|
|
8
|
-
export { ModuleLoader, ModuleLoadError, type LoadedModule, type ModuleConstructor, type ModuleLoaderOptions, type ModuleLoadErrorCode, } from './loader';
|
|
8
|
+
export { ModuleLoader, ModuleLoadError, type LoadedModule, type ModuleConstructor, type ModuleLoaderOptions, type ModuleLoadErrorCode, } from './loader.js';
|
|
9
9
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/sdk/modules/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EACH,YAAY,EACZ,eAAe,EACf,KAAK,YAAY,EACjB,KAAK,iBAAiB,EACtB,KAAK,mBAAmB,EACxB,KAAK,mBAAmB,GAC3B,MAAM,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/sdk/modules/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EACH,YAAY,EACZ,eAAe,EACf,KAAK,YAAY,EACjB,KAAK,iBAAiB,EACtB,KAAK,mBAAmB,EACxB,KAAK,mBAAmB,GAC3B,MAAM,aAAa,CAAC"}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Module Loader
|
|
3
|
+
*
|
|
4
|
+
* Finds a Widgetic UI module on the CDN and imports it. This is the one and only way the SDK loads a module.
|
|
5
|
+
*
|
|
6
|
+
* Every module is published as one JavaScript file at an address that never changes:
|
|
7
|
+
*
|
|
8
|
+
* <moduleBaseUrl>/<name>/<version>/index.js e.g. https://cdn.widgetic.com/modules/file-browser/1.2.0/index.js
|
|
9
|
+
*
|
|
10
|
+
* and a small JSON "manifest" next to it names the newest version:
|
|
11
|
+
*
|
|
12
|
+
* <moduleBaseUrl>/<name>/manifest.json { "name": "file-browser", "version": "1.2.0", "entry": "1.2.0/index.js" }
|
|
13
|
+
*
|
|
14
|
+
* - Without a pinned version the loader reads the manifest and imports the version it names.
|
|
15
|
+
* - With a pinned version it goes straight to the immutable address (no manifest, nothing that can change under
|
|
16
|
+
* the partner's feet). Production pages should pin.
|
|
17
|
+
*
|
|
18
|
+
* The loader needs no API key and no network call to the Widgetic API: modules and manifests are static files.
|
|
19
|
+
*/
|
|
20
|
+
import type { ModuleName, UIModule } from '../types/index.cjs';
|
|
21
|
+
/** Everything that can go wrong while finding or importing a module, as a code a page can react to. */
|
|
22
|
+
export type ModuleLoadErrorCode = 'INVALID_MODULE_NAME' | 'INVALID_VERSION' | 'INVALID_MODULE_BASE_URL' | 'MODULE_NOT_FOUND' | 'MANIFEST_UNAVAILABLE' | 'MANIFEST_INVALID' | 'MODULE_LOAD_FAILED' | 'MODULE_INVALID';
|
|
23
|
+
export declare class ModuleLoadError extends Error {
|
|
24
|
+
readonly code: ModuleLoadErrorCode;
|
|
25
|
+
readonly moduleName: string;
|
|
26
|
+
readonly url?: string;
|
|
27
|
+
readonly cause?: unknown;
|
|
28
|
+
constructor(code: ModuleLoadErrorCode, message: string, details: {
|
|
29
|
+
moduleName: string;
|
|
30
|
+
url?: string;
|
|
31
|
+
cause?: unknown;
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
/** A module class: `new Module(container, config)`, then `mount()`. */
|
|
35
|
+
export type ModuleConstructor = new (container: HTMLElement, config: Record<string, unknown>) => UIModule;
|
|
36
|
+
/** A module that was found and imported. */
|
|
37
|
+
export interface LoadedModule {
|
|
38
|
+
Module: ModuleConstructor;
|
|
39
|
+
name: string;
|
|
40
|
+
/** The version that was imported (the pinned one, or the one the manifest named). */
|
|
41
|
+
version: string;
|
|
42
|
+
/** The address the module file was imported from. */
|
|
43
|
+
url: string;
|
|
44
|
+
}
|
|
45
|
+
export interface ModuleLoaderOptions {
|
|
46
|
+
/** Where modules are served from. Default `https://cdn.widgetic.com/modules`. May be relative to the page. */
|
|
47
|
+
moduleBaseUrl?: string;
|
|
48
|
+
/** `fetch`, replaceable for tests. */
|
|
49
|
+
fetchImpl?: typeof fetch;
|
|
50
|
+
/** Dynamic `import()`, replaceable for tests. */
|
|
51
|
+
importImpl?: (specifier: string) => Promise<unknown>;
|
|
52
|
+
/** Pauses between attempts in milliseconds. One entry per retry; default `[300, 900]` = three attempts. */
|
|
53
|
+
retryDelaysMs?: number[];
|
|
54
|
+
}
|
|
55
|
+
export declare class ModuleLoader {
|
|
56
|
+
private readonly baseUrl;
|
|
57
|
+
private readonly fetchImpl;
|
|
58
|
+
private readonly importImpl;
|
|
59
|
+
private readonly retryDelaysMs;
|
|
60
|
+
private readonly loads;
|
|
61
|
+
constructor(options?: ModuleLoaderOptions);
|
|
62
|
+
/**
|
|
63
|
+
* Finds and imports a module.
|
|
64
|
+
* @param name - The module, like `file-browser`.
|
|
65
|
+
* @param options.version - Pin an exact version like `1.2.0`. Default: the newest one the manifest names.
|
|
66
|
+
*/
|
|
67
|
+
load(name: ModuleName, options?: {
|
|
68
|
+
version?: string;
|
|
69
|
+
}): Promise<LoadedModule>;
|
|
70
|
+
private loadUncached;
|
|
71
|
+
/** Reads `<base>/<name>/manifest.json`. Network failures and server errors are retried; a missing module is not. */
|
|
72
|
+
private fetchManifest;
|
|
73
|
+
private validateManifest;
|
|
74
|
+
/** The module file the manifest points at, which must be a script inside the module's own folder. */
|
|
75
|
+
private resolveEntryUrl;
|
|
76
|
+
/** Imports the module file and checks it exports a class. */
|
|
77
|
+
private importModuleFile;
|
|
78
|
+
/**
|
|
79
|
+
* Runs an operation, trying again after a pause when it throws. A `ModuleLoadError` means "this will not get
|
|
80
|
+
* better by asking again" and is thrown straight away.
|
|
81
|
+
*/
|
|
82
|
+
private withRetries;
|
|
83
|
+
}
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
*
|
|
18
18
|
* The loader needs no API key and no network call to the Widgetic API: modules and manifests are static files.
|
|
19
19
|
*/
|
|
20
|
-
import type { ModuleName, UIModule } from '../types';
|
|
20
|
+
import type { ModuleName, UIModule } from '../types/index.js';
|
|
21
21
|
/** Everything that can go wrong while finding or importing a module, as a code a page can react to. */
|
|
22
22
|
export type ModuleLoadErrorCode = 'INVALID_MODULE_NAME' | 'INVALID_VERSION' | 'INVALID_MODULE_BASE_URL' | 'MODULE_NOT_FOUND' | 'MANIFEST_UNAVAILABLE' | 'MANIFEST_INVALID' | 'MODULE_LOAD_FAILED' | 'MODULE_INVALID';
|
|
23
23
|
export declare class ModuleLoadError extends Error {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"loader.d.ts","sourceRoot":"","sources":["../../../src/sdk/modules/loader.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AACH,OAAO,KAAK,EAAkB,UAAU,EAAE,QAAQ,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"loader.d.ts","sourceRoot":"","sources":["../../../src/sdk/modules/loader.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AACH,OAAO,KAAK,EAAkB,UAAU,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAG9E,uGAAuG;AACvG,MAAM,MAAM,mBAAmB,GACzB,qBAAqB,GACrB,iBAAiB,GACjB,yBAAyB,GACzB,kBAAkB,GAClB,sBAAsB,GACtB,kBAAkB,GAClB,oBAAoB,GACpB,gBAAgB,CAAC;AAEvB,qBAAa,eAAgB,SAAQ,KAAK;IACtC,QAAQ,CAAC,IAAI,EAAE,mBAAmB,CAAC;IACnC,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,KAAK,CAAC,EAAE,OAAO,CAAC;gBAEb,IAAI,EAAE,mBAAmB,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE;QAAE,UAAU,EAAE,MAAM,CAAC;QAAC,GAAG,CAAC,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,OAAO,CAAA;KAAE;CAUzH;AAED,uEAAuE;AACvE,MAA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