@appsemble/sdk 0.20.9 → 0.20.12

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.
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -1,8 +1,12 @@
1
+ import type { Action, BaseMessage, BulmaColor, BulmaSize, Theme } from '@appsemble/types';
1
2
  import type { IconName } from '@fortawesome/fontawesome-common-types';
2
3
  import { Promisable } from 'type-fest';
3
- import { Action, BulmaColor, Message, Remapper, Theme } from './types';
4
- export * from './types';
5
4
  export { IconName };
5
+ export { Action, BulmaColor, BulmaSize, Theme };
6
+ /**
7
+ * A user defined remapper function.
8
+ */
9
+ export declare type Remapper = object[] | boolean | number | object | string;
6
10
  /**
7
11
  * Actions defined on a block.
8
12
  *
@@ -115,6 +119,12 @@ export interface MenuItem {
115
119
  */
116
120
  active?: boolean;
117
121
  }
122
+ export interface Message extends BaseMessage {
123
+ /**
124
+ * The content of the message to display.
125
+ */
126
+ body: string;
127
+ }
118
128
  /**
119
129
  * A set of utility functions provided by the Appsemble SDK.
120
130
  */
@@ -128,9 +138,9 @@ export interface Utils {
128
138
  /**
129
139
  * Remap data based in a user defined remapper function.
130
140
  *
131
- * @param remapper - The user defined remapper function.
132
- * @param data - The data to remap.
133
- * @param context - The context to retrieve contextual data from.
141
+ * @param remapper The user defined remapper function.
142
+ * @param data The data to remap.
143
+ * @param context The context to retrieve contextual data from.
134
144
  * @returns The result of the remapped data.
135
145
  */
136
146
  remap: (remapper: Remapper, data: unknown, context?: Record<string, unknown>) => unknown;
@@ -145,20 +155,20 @@ export interface Utils {
145
155
  /**
146
156
  * Get a URL serving an asset for the given asset id.
147
157
  *
148
- * @param assetId - The id of the asset whose URL to get.
158
+ * @param assetId The id of the asset whose URL to get.
149
159
  * @returns The URL that matches the given asset id.
150
160
  */
151
161
  asset: (assetId: string) => string;
152
162
  /**
153
163
  * Convert a FontAwesome icon name into a valid FontAwesome CSS class.
154
164
  *
155
- * @param icon - The FontAwesome icon.
165
+ * @param icon The FontAwesome icon.
156
166
  * @returns String containing the FontAwesome classes for the icon.
157
167
  */
158
168
  fa: (icon: IconName) => string;
159
169
  /**
160
- * @param items - The list of menu items to display.
161
- * @param header - A header that can be used to separate from other block menus.
170
+ * @param items The list of menu items to display.
171
+ * @param header A header that can be used to separate from other block menus.
162
172
  */
163
173
  menu: (items: MenuItem[], header?: string) => void;
164
174
  }
@@ -166,8 +176,8 @@ export interface Events {
166
176
  /**
167
177
  * Emit an Appsemble event.
168
178
  *
169
- * @param type - The type of event to emit.
170
- * @param data - Data to emit with the event.
179
+ * @param type The type of event to emit.
180
+ * @param data Data to emit with the event.
171
181
  * @returns Boolean indicating whether an emitter is implemented or not.
172
182
  */
173
183
  emit: {
@@ -176,8 +186,8 @@ export interface Events {
176
186
  /**
177
187
  * Remove an event listener for an Appsemble event.
178
188
  *
179
- * @param type - The type of event to listen remove the listener from.
180
- * @param callback - The callback to remove.
189
+ * @param type The type of event to listen remove the listener from.
190
+ * @param callback The callback to remove.
181
191
  * @returns Boolean indicating whether a listener is implemented or not.
182
192
  */
183
193
  off: {
@@ -186,8 +196,8 @@ export interface Events {
186
196
  /**
187
197
  * Add an event listener for an Appsemble event.
188
198
  *
189
- * @param type - The type of event to listen on.
190
- * @param callback - A callback to register for the event.
199
+ * @param type The type of event to listen on.
200
+ * @param callback A callback to register for the event.
191
201
  * @returns Boolean indicating whether a listener is implemented or not.
192
202
  */
193
203
  on: {
@@ -256,7 +266,7 @@ export interface AppsembleBootstrapEvent extends CustomEvent {
256
266
  /**
257
267
  * Register a boostrap function.
258
268
  *
259
- * @param fn - The bootstrap function to register
269
+ * @param fn The bootstrap function to register
260
270
  *
261
271
  * If the function returns an element, it’s appended to the shadow root.
262
272
  */
@@ -1,8 +1,7 @@
1
- export * from './types';
2
1
  /**
3
2
  * Register a boostrap function.
4
3
  *
5
- * @param fn - The bootstrap function to register
4
+ * @param fn The bootstrap function to register
6
5
  *
7
6
  * If the function returns an element, it’s appended to the shadow root.
8
7
  */
package/index.js.map ADDED
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAiTA;;;;;;GAMG;AACH,MAAM,UAAU,SAAS,CAAC,EAAqB;IAC7C,MAAM,KAAK,GAA4B,IAAI,WAAW,CAAC,oBAAoB,EAAE;QAC3E,MAAM,EAAE;YACN,EAAE;YACF,QAAQ;SACT;KACF,CAAC,CAAC;IACH,IAAI,QAAQ,CAAC,aAAa,EAAE;QAC1B,QAAQ,CAAC,aAAa,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;KAC7C;AACH,CAAC"}
@@ -0,0 +1 @@
1
+ export {};
package/index.test.js ADDED
@@ -0,0 +1,31 @@
1
+ import { bootstrap } from '.';
2
+ let event;
3
+ let originalCurrentScript;
4
+ beforeEach(() => {
5
+ originalCurrentScript = document.currentScript;
6
+ Object.defineProperty(document, 'currentScript', {
7
+ value: {
8
+ dispatchEvent: jest.fn((e) => {
9
+ event = e;
10
+ }),
11
+ },
12
+ writable: true,
13
+ });
14
+ });
15
+ afterEach(() => {
16
+ Object.defineProperty(document, 'currentScript', {
17
+ value: originalCurrentScript,
18
+ writable: true,
19
+ });
20
+ originalCurrentScript = undefined;
21
+ });
22
+ describe('bootstrap', () => {
23
+ it('should dispatch the AppsembleBoostrap event', () => {
24
+ const fn = jest.fn();
25
+ bootstrap(fn);
26
+ expect(document.currentScript.dispatchEvent).toHaveBeenCalledWith(new CustomEvent(''));
27
+ expect(event.type).toBe('AppsembleBootstrap');
28
+ expect(event.detail).toStrictEqual({ fn, document });
29
+ });
30
+ });
31
+ //# sourceMappingURL=index.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.test.js","sourceRoot":"","sources":["index.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,GAAG,CAAC;AAE9B,IAAI,KAAkB,CAAC;AACvB,IAAI,qBAA6C,CAAC;AAElD,UAAU,CAAC,GAAG,EAAE;IACd,qBAAqB,GAAG,QAAQ,CAAC,aAAa,CAAC;IAC/C,MAAM,CAAC,cAAc,CAAC,QAAQ,EAAE,eAAe,EAAE;QAC/C,KAAK,EAAE;YACL,aAAa,EAAE,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE;gBAC3B,KAAK,GAAG,CAAC,CAAC;YACZ,CAAC,CAAC;SACH;QACD,QAAQ,EAAE,IAAI;KACf,CAAC,CAAC;AACL,CAAC,CAAC,CAAC;AAEH,SAAS,CAAC,GAAG,EAAE;IACb,MAAM,CAAC,cAAc,CAAC,QAAQ,EAAE,eAAe,EAAE;QAC/C,KAAK,EAAE,qBAAqB;QAC5B,QAAQ,EAAE,IAAI;KACf,CAAC,CAAC;IACH,qBAAqB,GAAG,SAAS,CAAC;AACpC,CAAC,CAAC,CAAC;AAEH,QAAQ,CAAC,WAAW,EAAE,GAAG,EAAE;IACzB,EAAE,CAAC,6CAA6C,EAAE,GAAG,EAAE;QACrD,MAAM,EAAE,GAAG,IAAI,CAAC,EAAE,EAAE,CAAC;QACrB,SAAS,CAAC,EAAE,CAAC,CAAC;QACd,MAAM,CAAC,QAAQ,CAAC,aAAa,CAAC,aAAa,CAAC,CAAC,oBAAoB,CAAC,IAAI,WAAW,CAAC,EAAE,CAAC,CAAC,CAAC;QACvF,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,oBAAoB,CAAC,CAAC;QAC9C,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,aAAa,CAAC,EAAE,EAAE,EAAE,QAAQ,EAAE,CAAC,CAAC;IACvD,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
package/index.test.ts ADDED
@@ -0,0 +1,34 @@
1
+ import { bootstrap } from '.';
2
+
3
+ let event: CustomEvent;
4
+ let originalCurrentScript: HTMLOrSVGScriptElement;
5
+
6
+ beforeEach(() => {
7
+ originalCurrentScript = document.currentScript;
8
+ Object.defineProperty(document, 'currentScript', {
9
+ value: {
10
+ dispatchEvent: jest.fn((e) => {
11
+ event = e;
12
+ }),
13
+ },
14
+ writable: true,
15
+ });
16
+ });
17
+
18
+ afterEach(() => {
19
+ Object.defineProperty(document, 'currentScript', {
20
+ value: originalCurrentScript,
21
+ writable: true,
22
+ });
23
+ originalCurrentScript = undefined;
24
+ });
25
+
26
+ describe('bootstrap', () => {
27
+ it('should dispatch the AppsembleBoostrap event', () => {
28
+ const fn = jest.fn();
29
+ bootstrap(fn);
30
+ expect(document.currentScript.dispatchEvent).toHaveBeenCalledWith(new CustomEvent(''));
31
+ expect(event.type).toBe('AppsembleBootstrap');
32
+ expect(event.detail).toStrictEqual({ fn, document });
33
+ });
34
+ });
package/index.ts ADDED
@@ -0,0 +1,323 @@
1
+ // eslint-disable-next-line @typescript-eslint/consistent-type-imports
2
+ import type { Action, BaseMessage, BulmaColor, BulmaSize, Theme } from '@appsemble/types';
3
+ // eslint-disable-next-line @typescript-eslint/consistent-type-imports
4
+ import type { IconName } from '@fortawesome/fontawesome-common-types';
5
+ import { Promisable } from 'type-fest';
6
+
7
+ export { IconName };
8
+ export { Action, BulmaColor, BulmaSize, Theme };
9
+
10
+ /**
11
+ * A user defined remapper function.
12
+ */
13
+ export type Remapper = object[] | boolean | number | object | string;
14
+
15
+ /**
16
+ * Actions defined on a block.
17
+ *
18
+ * If a block uses actions, extend this interface using module augmentation. The keys are the names
19
+ * of the events the block supports.
20
+ *
21
+ * @example
22
+ * declare module '<at>appsemble/sdk' {
23
+ * interface Actions {
24
+ * onClick: {}
25
+ * }
26
+ * }
27
+ */
28
+ // eslint-disable-next-line @typescript-eslint/no-empty-interface
29
+ export interface Actions {}
30
+
31
+ /**
32
+ * Messages defined on a block.
33
+ *
34
+ * If a block uses messages, extend this interface using module augmentation.
35
+ * The keys are the names of the messages.
36
+ * The types are either `never` if the message doesn’t support parameters
37
+ * or an object containing the keys of values and the type of the value.
38
+ *
39
+ * @example
40
+ * declare module '<at>appsemble/sdk' {
41
+ * interface Messages {
42
+ * exampleMessage: never;
43
+ * hello: { person: string };
44
+ * }
45
+ * }
46
+ */
47
+ // eslint-disable-next-line @typescript-eslint/no-empty-interface
48
+ export interface Messages {}
49
+
50
+ /**
51
+ * Event emitters defined on a block.
52
+ *
53
+ * If a block emits events, extend this interface using module augmentation. The keys are the names
54
+ * of the events the block can emit.
55
+ *
56
+ * @example
57
+ * declare module '<at>appsemble/sdk' {
58
+ * interface EventEmitters {
59
+ * data: {}
60
+ * }
61
+ * }
62
+ */
63
+ // eslint-disable-next-line @typescript-eslint/no-empty-interface
64
+ export interface EventEmitters {}
65
+
66
+ /**
67
+ * Event listeners defined on a block.
68
+ *
69
+ * If a block listens on events, extend this interface using module augmentation. The keys are the
70
+ * names of the events the block can emit.
71
+ *
72
+ * @example
73
+ * declare module '<at>appsemble/sdk' {
74
+ * interface EventListeners {
75
+ * data: {}
76
+ * }
77
+ * }
78
+ */
79
+ // eslint-disable-next-line @typescript-eslint/no-empty-interface
80
+ export interface EventListeners {}
81
+
82
+ /**
83
+ * Custom free form parameters defined on a block.
84
+ *
85
+ * If a block listens on events, extend this interface using module augmentation. The keys are the
86
+ * names of the events the block can emit.
87
+ *
88
+ * @example
89
+ * declare module '<at>appsemble/sdk' {
90
+ * interface Parameters {
91
+ * param1: string;
92
+ * param2: number;
93
+ * param3: {
94
+ * nested: boolean;
95
+ * }
96
+ * }
97
+ * }
98
+ */
99
+ // eslint-disable-next-line @typescript-eslint/no-empty-interface
100
+ export interface Parameters {}
101
+
102
+ export type PageParameters = Record<string, string>;
103
+
104
+ /**
105
+ * A menu item that can be displayed in addition to the normal app menu.
106
+ */
107
+ export interface MenuItem {
108
+ /**
109
+ * The title of the menu item.
110
+ */
111
+ title: string;
112
+
113
+ /**
114
+ * The icon to display next to the title.
115
+ */
116
+ icon?: IconName;
117
+
118
+ /**
119
+ * The color to use for the icon.
120
+ */
121
+ iconColor?: BulmaColor;
122
+
123
+ /**
124
+ * The click handler for when the menu item is clicked.
125
+ */
126
+ onClick: () => void;
127
+
128
+ /**
129
+ * The submenu items associated with this menu item.
130
+ */
131
+ submenu?: Omit<MenuItem, 'submenu'>[];
132
+
133
+ /**
134
+ * Whether the item is considered active.
135
+ */
136
+ active?: boolean;
137
+ }
138
+
139
+ export interface Message extends BaseMessage {
140
+ /**
141
+ * The content of the message to display.
142
+ */
143
+ body: string;
144
+ }
145
+
146
+ /**
147
+ * A set of utility functions provided by the Appsemble SDK.
148
+ */
149
+ export interface Utils {
150
+ /**
151
+ * Register a function that should be called when the block is being removed.
152
+ *
153
+ * Use this to clean up resouces that would otherwise stay in memory, e.g. object URLs.
154
+ */
155
+ addCleanup: (fn: () => void) => void;
156
+
157
+ /**
158
+ * Remap data based in a user defined remapper function.
159
+ *
160
+ * @param remapper The user defined remapper function.
161
+ * @param data The data to remap.
162
+ * @param context The context to retrieve contextual data from.
163
+ * @returns The result of the remapped data.
164
+ */
165
+ remap: (remapper: Remapper, data: unknown, context?: Record<string, unknown>) => unknown;
166
+
167
+ /**
168
+ * Show a bulma style message.
169
+ */
170
+ showMessage: (message: Message | string) => void;
171
+
172
+ /**
173
+ * Formats a message using ICU syntax.
174
+ */
175
+ formatMessage: <T extends keyof Messages>(
176
+ message: T,
177
+ ...args: Messages[T] extends never ? [] : [Messages[T]]
178
+ ) => string;
179
+
180
+ /**
181
+ * Get a URL serving an asset for the given asset id.
182
+ *
183
+ * @param assetId The id of the asset whose URL to get.
184
+ * @returns The URL that matches the given asset id.
185
+ */
186
+ asset: (assetId: string) => string;
187
+
188
+ /**
189
+ * Convert a FontAwesome icon name into a valid FontAwesome CSS class.
190
+ *
191
+ * @param icon The FontAwesome icon.
192
+ * @returns String containing the FontAwesome classes for the icon.
193
+ */
194
+ fa: (icon: IconName) => string;
195
+
196
+ /**
197
+ * @param items The list of menu items to display.
198
+ * @param header A header that can be used to separate from other block menus.
199
+ */
200
+ menu: (items: MenuItem[], header?: string) => void;
201
+ }
202
+
203
+ export interface Events {
204
+ /**
205
+ * Emit an Appsemble event.
206
+ *
207
+ * @param type The type of event to emit.
208
+ * @param data Data to emit with the event.
209
+ * @returns Boolean indicating whether an emitter is implemented or not.
210
+ */
211
+ emit: { [K in keyof EventEmitters]: (data: unknown, error?: string) => Promise<boolean> };
212
+
213
+ /**
214
+ * Remove an event listener for an Appsemble event.
215
+ *
216
+ * @param type The type of event to listen remove the listener from.
217
+ * @param callback The callback to remove.
218
+ * @returns Boolean indicating whether a listener is implemented or not.
219
+ */
220
+ off: {
221
+ [K in keyof EventListeners]: <T>(callback: (data: T, error?: string) => void) => boolean;
222
+ };
223
+
224
+ /**
225
+ * Add an event listener for an Appsemble event.
226
+ *
227
+ * @param type The type of event to listen on.
228
+ * @param callback A callback to register for the event.
229
+ * @returns Boolean indicating whether a listener is implemented or not.
230
+ */
231
+ on: {
232
+ [K in keyof EventListeners]: <T>(callback: (data: T, error?: string) => void) => boolean;
233
+ };
234
+ }
235
+
236
+ /**
237
+ * The parameters that get passed to the bootstrap function.
238
+ */
239
+ export interface BootstrapParams {
240
+ /**
241
+ * The actions that may be dispatched by the block.
242
+ */
243
+ actions: { [K in keyof Actions]: Action };
244
+
245
+ /**
246
+ * The parameters as they are defined in the app definition.
247
+ */
248
+ parameters: Parameters;
249
+
250
+ /**
251
+ * Any kind of data that has been passed in by some context.
252
+ */
253
+ data: unknown;
254
+
255
+ /**
256
+ * Event related functions and constants.
257
+ */
258
+ events: Events;
259
+
260
+ /**
261
+ * URL parameters of the current route.
262
+ *
263
+ * If the page on which the block is rendered, has parameters specified on a page level, the
264
+ * parameter keys and values of the page will be extracted and set as this object.
265
+ */
266
+ pageParameters?: PageParameters;
267
+
268
+ /**
269
+ * The path of the block as it is being rendered on the page using the page’s normalized name.
270
+ */
271
+ path: string;
272
+
273
+ /**
274
+ * The path of the block as it is being rendered on the page using the page’s index.
275
+ */
276
+ pathIndex: string;
277
+
278
+ /**
279
+ * The theme of the block given the context.
280
+ *
281
+ * This is based on a combination of the base theme, app theme, page theme and block theme.
282
+ */
283
+ theme: Theme;
284
+
285
+ /**
286
+ * The shadow root to which DOM elements may be appended.
287
+ */
288
+ shadowRoot: ShadowRoot;
289
+
290
+ /**
291
+ * Some utility functions provided by the Appsemble app framework.
292
+ */
293
+ utils: Utils;
294
+ }
295
+
296
+ // eslint-disable-next-line @typescript-eslint/no-invalid-void-type
297
+ export type BootstrapFunction = (params: BootstrapParams) => Promisable<Element | void>;
298
+
299
+ export interface AppsembleBootstrapEvent extends CustomEvent {
300
+ detail: {
301
+ fn: BootstrapFunction;
302
+ document: Document;
303
+ };
304
+ }
305
+
306
+ /**
307
+ * Register a boostrap function.
308
+ *
309
+ * @param fn The bootstrap function to register
310
+ *
311
+ * If the function returns an element, it’s appended to the shadow root.
312
+ */
313
+ export function bootstrap(fn: BootstrapFunction): void {
314
+ const event: AppsembleBootstrapEvent = new CustomEvent('AppsembleBootstrap', {
315
+ detail: {
316
+ fn,
317
+ document,
318
+ },
319
+ });
320
+ if (document.currentScript) {
321
+ document.currentScript.dispatchEvent(event);
322
+ }
323
+ }
package/jest.config.js ADDED
@@ -0,0 +1 @@
1
+ module.exports = require('../../config/jest/config')(__dirname);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@appsemble/sdk",
3
- "version": "0.20.9",
3
+ "version": "0.20.12",
4
4
  "description": "Build your own blocks",
5
5
  "keywords": [
6
6
  "app",
@@ -23,16 +23,17 @@
23
23
  "license": "LGPL-3.0-only",
24
24
  "author": "Appsemble <info@appsemble.com> (https://appsemble.com)",
25
25
  "sideEffects": false,
26
- "main": "dist",
27
26
  "files": [
28
- "dist"
27
+ "**/*.d.ts",
28
+ "**/*.js",
29
+ "!*.config.js"
29
30
  ],
30
31
  "scripts": {
31
- "prepack": "tsc -p tsconfig.build.json",
32
+ "prepack": "tsc --noEmit false",
32
33
  "test": "jest"
33
34
  },
34
35
  "dependencies": {
35
- "@appsemble/types": "0.20.9",
36
+ "@appsemble/types": "0.20.12",
36
37
  "@fortawesome/fontawesome-common-types": "^6.0.0",
37
38
  "type-fest": "^2.0.0"
38
39
  }
package/tsconfig.json ADDED
@@ -0,0 +1,6 @@
1
+ {
2
+ "extends": "../../tsconfig",
3
+ "compilerOptions": {
4
+ "lib": ["dom", "dom.iterable", "esnext"]
5
+ }
6
+ }
package/dist/index.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAMA,cAAc,SAAS,CAAC;AA+RxB;;;;;;GAMG;AACH,MAAM,UAAU,SAAS,CAAC,EAAqB;IAC7C,MAAM,KAAK,GAA4B,IAAI,WAAW,CAAC,oBAAoB,EAAE;QAC3E,MAAM,EAAE;YACN,EAAE;YACF,QAAQ;SACT;KACF,CAAC,CAAC;IACH,IAAI,QAAQ,CAAC,aAAa,EAAE;QAC1B,QAAQ,CAAC,aAAa,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;KAC7C;AACH,CAAC"}
package/dist/types.d.ts DELETED
@@ -1,142 +0,0 @@
1
- /**
2
- * These types are extracted into this package, so they can be imported in {@link @appsemble/types}
3
- * without causing type errors. Don’t import from this module directly. Instead, import from
4
- * {@link @appsemble/sdk}.
5
- */
6
- /**
7
- * A user defined remapper function.
8
- */
9
- export declare type Remapper = object[] | boolean | number | object | string;
10
- /**
11
- * Common HTTP methods, but either all upper case or all lower case.
12
- */
13
- export declare type HTTPMethods = 'DELETE' | 'delete' | 'GET' | 'get' | 'PATCH' | 'patch' | 'POST' | 'post' | 'PUT' | 'put';
14
- export interface BaseAction<T extends string> {
15
- /**
16
- * A function which can be called to dispatch the action.
17
- */
18
- <R>(data?: any, context?: Record<string, any>): Promise<R>;
19
- /**
20
- * The type of the action.
21
- */
22
- type: T;
23
- }
24
- export interface LinkAction extends BaseAction<'link'> {
25
- /**
26
- * Get the link that the action would link to if the given data was passed.
27
- */
28
- href: (data?: unknown) => string;
29
- }
30
- export interface LogAction extends BaseAction<'log'> {
31
- /**
32
- * The logging level.
33
- */
34
- level: 'error' | 'info' | 'warn';
35
- }
36
- interface RequestLikeAction<T extends Action['type']> extends BaseAction<T> {
37
- /**
38
- * The HTTP method used to make the request.
39
- */
40
- method: HTTPMethods;
41
- /**
42
- * The URL to which the request will be made.
43
- */
44
- url: Remapper;
45
- }
46
- export declare type RequestAction = RequestLikeAction<'request'>;
47
- export declare type ResourceCreateAction = RequestLikeAction<'resource.create'>;
48
- export declare type ResourceDeleteAction = RequestLikeAction<'resource.delete'>;
49
- export declare type ResourceGetAction = RequestLikeAction<'resource.get'>;
50
- export declare type ResourceQueryAction = RequestLikeAction<'resource.query'>;
51
- export declare type ResourceCountAction = RequestLikeAction<'resource.count'>;
52
- export declare type ResourceUpdateAction = RequestLikeAction<'resource.update'>;
53
- /**
54
- * An action that can be called from within a block.
55
- */
56
- export declare type Action = BaseAction<'analytics'> | BaseAction<'condition'> | BaseAction<'dialog.error'> | BaseAction<'dialog.ok'> | BaseAction<'dialog'> | BaseAction<'download'> | BaseAction<'email'> | BaseAction<'event'> | BaseAction<'flow.back'> | BaseAction<'flow.cancel'> | BaseAction<'flow.finish'> | BaseAction<'flow.next'> | BaseAction<'flow.to'> | BaseAction<'link.back'> | BaseAction<'link.next'> | BaseAction<'message'> | BaseAction<'noop'> | BaseAction<'resource.subscription.status'> | BaseAction<'resource.subscription.subscribe'> | BaseAction<'resource.subscription.toggle'> | BaseAction<'resource.subscription.unsubscribe'> | BaseAction<'share'> | BaseAction<'static'> | BaseAction<'storage.read'> | BaseAction<'storage.write'> | BaseAction<'team.invite'> | BaseAction<'team.join'> | BaseAction<'team.list'> | BaseAction<'throw'> | BaseAction<'user.login'> | BaseAction<'user.register'> | BaseAction<'user.update'> | LinkAction | LogAction | RequestAction | ResourceCountAction | ResourceCreateAction | ResourceDeleteAction | ResourceGetAction | ResourceQueryAction | ResourceUpdateAction;
57
- /**
58
- * A color known to Bulma.
59
- */
60
- export declare type BulmaColor = 'danger' | 'dark' | 'info' | 'link' | 'primary' | 'success' | 'warning' | 'white';
61
- export declare type BulmaSize = 'large' | 'medium' | 'normal' | 'small';
62
- export interface BaseMessage {
63
- /**
64
- * The color to use for the message.
65
- *
66
- * @default 'info'
67
- */
68
- color?: BulmaColor;
69
- /**
70
- * The timeout period for this message (in milliseconds).
71
- *
72
- * @default 5000
73
- */
74
- timeout?: number;
75
- /**
76
- * Whether or not to show the dismiss button.
77
- *
78
- * @default false
79
- */
80
- dismissable?: boolean;
81
- }
82
- export interface Message extends BaseMessage {
83
- /**
84
- * The content of the message to display.
85
- */
86
- body: string;
87
- }
88
- export interface FontDefinition {
89
- /**
90
- * Where to load a font from.
91
- */
92
- source?: 'custom' | 'google';
93
- /**
94
- * The name of the font family.
95
- *
96
- * This will be referenced in the Bulma CSS.
97
- */
98
- family: string;
99
- }
100
- export interface Theme {
101
- /**
102
- * The color primarily featured in the color scheme.
103
- */
104
- primaryColor: string;
105
- /**
106
- * The color used for links.
107
- */
108
- linkColor: string;
109
- /**
110
- * The color used to feature succesful or positive actions.
111
- */
112
- successColor: string;
113
- /**
114
- * The color used to indicate information.
115
- */
116
- infoColor: string;
117
- /**
118
- * The color used for elements that require extra attention.
119
- */
120
- warningColor: string;
121
- /**
122
- * The color used for elements that demand caution for destructive actions.
123
- */
124
- dangerColor: string;
125
- /**
126
- * The color used in the foreground of the splash screen.
127
- */
128
- themeColor: string;
129
- /**
130
- * The color used in the background of the splash screen.
131
- */
132
- splashColor: string;
133
- /**
134
- * The link to the tile layer used for Leaflet maps.
135
- */
136
- tileLayer: string;
137
- /**
138
- * The name of a font available on Google fonts.
139
- */
140
- font: FontDefinition;
141
- }
142
- export {};
package/dist/types.js DELETED
@@ -1,7 +0,0 @@
1
- /**
2
- * These types are extracted into this package, so they can be imported in {@link @appsemble/types}
3
- * without causing type errors. Don’t import from this module directly. Instead, import from
4
- * {@link @appsemble/sdk}.
5
- */
6
- export {};
7
- //# sourceMappingURL=types.js.map
package/dist/types.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;GAIG"}