@thepassle/app-tools 0.9.0 → 0.9.1

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.
Files changed (39) hide show
  1. package/package.json +36 -15
  2. package/router/index.js +2 -2
  3. package/types/api/index.d.ts +57 -0
  4. package/types/api/plugins/abort.d.ts +5 -0
  5. package/types/api/plugins/cache.d.ts +8 -0
  6. package/types/api/plugins/debounce.d.ts +10 -0
  7. package/types/api/plugins/delay.d.ts +2 -0
  8. package/types/api/plugins/jsonPrefix.d.ts +6 -0
  9. package/types/api/plugins/logger.d.ts +10 -0
  10. package/types/api/plugins/mock.d.ts +5 -0
  11. package/types/api/plugins/xsrf.d.ts +12 -0
  12. package/types/dialog/events.d.ts +8 -0
  13. package/types/dialog/index.d.ts +43 -0
  14. package/types/dialog/utils.d.ts +1 -0
  15. package/types/env/dev.d.ts +2 -0
  16. package/types/env/prod.d.ts +2 -0
  17. package/types/pwa/capabilities.d.ts +7 -0
  18. package/types/pwa/events.d.ts +25 -0
  19. package/types/pwa/index.d.ts +40 -0
  20. package/types/router/index.d.ts +50 -0
  21. package/types/router/plugins/appName.d.ts +5 -0
  22. package/types/router/plugins/checkServiceWorkerUpdate.d.ts +4 -0
  23. package/types/router/plugins/data.d.ts +5 -0
  24. package/types/router/plugins/lazy.d.ts +6 -0
  25. package/types/router/plugins/offline.d.ts +7 -0
  26. package/types/router/plugins/redirect.d.ts +5 -0
  27. package/types/router/plugins/resetFocus.d.ts +4 -0
  28. package/types/router/plugins/scrollToTop.d.ts +4 -0
  29. package/types/state/index.d.ts +15 -0
  30. package/types/utils/CONSTANTS.d.ts +2 -0
  31. package/types/utils/Service.d.ts +23 -0
  32. package/types/utils/async.d.ts +29 -0
  33. package/types/utils/index.d.ts +9 -0
  34. package/types/utils/keycodes.d.ts +13 -0
  35. package/types/utils/log.d.ts +18 -0
  36. package/types/utils/media.d.ts +37 -0
  37. package/api/types.d.ts +0 -41
  38. package/dialog/types.d.ts +0 -21
  39. package/router/types.d.ts +0 -35
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thepassle/app-tools",
3
- "version": "0.9.0",
3
+ "version": "0.9.1",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "scripts": {
@@ -10,25 +10,46 @@
10
10
  "lint:types:watch": "tsc --watch"
11
11
  },
12
12
  "exports": {
13
- "./state.js": "./state.js",
14
- "./pwa.js": "./pwa.js",
15
- "./dialog.js": {
16
- "types": "./dialog/types.d.ts",
13
+ "./state.js": {
14
+ "types": "./types/state/index.d.ts",
15
+ "default": "./state.js"
16
+ },
17
+ "./pwa.js": {
18
+ "types": "./types/pwa/index.d.ts",
19
+ "default": "./pwa.js"
20
+ },
21
+ "./dialog.js": {
22
+ "types": "./types/dialog/index.d.ts",
17
23
  "default": "./dialog.js"
18
24
  },
19
- "./pwa/*": "./pwa/*",
20
- "./api.js": {
21
- "types": "./api/types.d.ts",
25
+ "./pwa/*": {
26
+ "types": "./types/pwa/*",
27
+ "default": "./pwa/*"
28
+ },
29
+ "./api.js": {
30
+ "types": "./types/api/index.d.ts",
22
31
  "default": "./api.js"
23
32
  },
24
- "./router.js": {
25
- "types": "./router/types.d.ts",
33
+ "./router.js": {
34
+ "types": "./types/router/index.d.ts",
26
35
  "default": "./router.js"
27
36
  },
28
- "./router/plugins/*": "./router/plugins/*",
29
- "./api/plugins/*": "./api/plugins/*",
30
- "./utils.js": "./utils.js",
31
- "./utils/*": "./utils/*",
37
+ "./router/plugins/*": {
38
+ "types": "./types/router/index/*",
39
+ "default": "./router/plugins/*"
40
+ },
41
+ "./api/plugins/*": {
42
+ "types": "./types/api/plugins/*",
43
+ "default": "./api/plugins/*"
44
+ },
45
+ "./utils.js": {
46
+ "types": "./types/utils/index.d.ts",
47
+ "default": "./utils.js"
48
+ },
49
+ "./utils/*": {
50
+ "types": "./types/utils/*",
51
+ "default": "./utils/*"
52
+ },
32
53
  "./env.js": {
33
54
  "development": "./env/dev.js",
34
55
  "default": "./env/prod.js"
@@ -36,7 +57,7 @@
36
57
  "./package.json": "./package.json"
37
58
  },
38
59
  "files": [
39
- "**/*.d.ts",
60
+ "./types/**/*.d.ts",
40
61
  "./env.js",
41
62
  "./pwa.js",
42
63
  "./dialog.js",
package/router/index.js CHANGED
@@ -143,9 +143,9 @@ export class Router extends EventTarget {
143
143
 
144
144
  /**
145
145
  * @param {string | URL} url The URL to navigate to.
146
- * @param {@param {{
146
+ * @param {{
147
147
  * backNav?: boolean
148
- * }} options} options An options object to configure the navigation. The backNav property specifies whether the navigation is a backward navigation, which doesn't push the navigation into browser nav history.
148
+ * }} options options An options object to configure the navigation. The backNav property specifies whether the navigation is a backward navigation, which doesn't push the navigation into browser nav history.
149
149
  */
150
150
  async navigate(url, options = {}) {
151
151
  if (typeof url === 'string') {
@@ -0,0 +1,57 @@
1
+ /** @typedef {import('./types.js').Config} Config */
2
+ /** @typedef {import('./types.js').Method} Method */
3
+ /** @typedef {import('./types.js').Plugin} Plugin */
4
+ /** @typedef {import('./types.js').CustomRequestOptions} CustomRequestOptions */
5
+ /** @typedef {import('./types.js').RequestOptions} RequestOptions */
6
+ /** @typedef {import('./types.js').MetaParams} MetaParams */
7
+ /**
8
+ * @example
9
+ * const api = new Api({
10
+ * baseURL: 'https://api.foo.com/',
11
+ * responseType: 'text',
12
+ * plugins: [
13
+ * {
14
+ * beforeFetch: ({url, method, opts, data}) => {},
15
+ * afterFetch: (res) => res,
16
+ * }
17
+ * ]
18
+ *});
19
+ */
20
+ export class Api {
21
+ /** @param {Config} config */
22
+ constructor(config?: Config);
23
+ config: {
24
+ plugins: import("./types.js").Plugin[];
25
+ responseType: string;
26
+ baseURL?: string;
27
+ };
28
+ /**
29
+ * @param {string} url
30
+ * @param {Method} method
31
+ * @param {RequestOptions} [opts]
32
+ * @param {object} [data]
33
+ * @returns
34
+ */
35
+ fetch(url: string, method: Method, opts?: RequestOptions, data?: object): Promise<any>;
36
+ /** @type {import('./types.js').BodylessMethod<object>} */
37
+ get: import('./types.js').BodylessMethod<object>;
38
+ /** @type {import('./types.js').BodylessMethod<object>} */
39
+ options: import('./types.js').BodylessMethod<object>;
40
+ /** @type {import('./types.js').BodylessMethod<object>} */
41
+ delete: import('./types.js').BodylessMethod<object>;
42
+ /** @type {import('./types.js').BodylessMethod<object>} */
43
+ head: import('./types.js').BodylessMethod<object>;
44
+ /** @type {import('./types.js').BodyMethod<object>} */
45
+ post: import('./types.js').BodyMethod<object>;
46
+ /** @type {import('./types.js').BodyMethod<object>} */
47
+ put: import('./types.js').BodyMethod<object>;
48
+ /** @type {import('./types.js').BodyMethod<object>} */
49
+ patch: import('./types.js').BodyMethod<object>;
50
+ }
51
+ export const api: Api;
52
+ export type Config = import('./types.js').Config;
53
+ export type Method = import('./types.js').Method;
54
+ export type Plugin = import('./types.js').Plugin;
55
+ export type CustomRequestOptions = import('./types.js').CustomRequestOptions;
56
+ export type RequestOptions = import('./types.js').RequestOptions;
57
+ export type MetaParams = import('./types.js').MetaParams;
@@ -0,0 +1,5 @@
1
+ /**
2
+ * @returns {import('../index').Plugin}
3
+ */
4
+ export function abortPlugin(): import('../index').Plugin;
5
+ export const abort: import("../types").Plugin;
@@ -0,0 +1,8 @@
1
+ /**
2
+ * @param {{maxAge?: number}} options
3
+ * @returns {import('../index').Plugin}
4
+ */
5
+ export function cachePlugin({ maxAge }?: {
6
+ maxAge?: number;
7
+ }): import('../index').Plugin;
8
+ export const cache: import("../types").Plugin;
@@ -0,0 +1,10 @@
1
+ /**
2
+ * @param {{
3
+ * timeout: number
4
+ * }} opts
5
+ * @returns {import('../index.js').Plugin}
6
+ */
7
+ export function debouncePlugin(opts?: {
8
+ timeout: number;
9
+ }): import('../index.js').Plugin;
10
+ export const debounce: import("../types.js").Plugin;
@@ -0,0 +1,2 @@
1
+ export function delayPlugin(ms: number): import('../index').Plugin;
2
+ export const delay: import("../types").Plugin;
@@ -0,0 +1,6 @@
1
+ /**
2
+ * @param {string} jsonPrefix
3
+ * @returns {import('../index').Plugin}
4
+ */
5
+ export function jsonPrefixPlugin(jsonPrefix: string): import('../index').Plugin;
6
+ export const jsonPrefix: import("../types").Plugin;
@@ -0,0 +1,10 @@
1
+ /**
2
+ * @param {{
3
+ * collapsed?: boolean
4
+ * }} options
5
+ * @returns {import('../index').Plugin}
6
+ */
7
+ export function loggerPlugin({ collapsed }?: {
8
+ collapsed?: boolean;
9
+ }): import('../index').Plugin;
10
+ export const logger: import("../types").Plugin;
@@ -0,0 +1,5 @@
1
+ /**
2
+ * @param {Response | (() => Response) | (() => Promise<Response>)} response
3
+ * @returns {import('../index').Plugin}
4
+ */
5
+ export function mock(response: Response | (() => Response) | (() => Promise<Response>)): import('../index').Plugin;
@@ -0,0 +1,12 @@
1
+ /**
2
+ * @param {{
3
+ * xsrfCookieName?: string,
4
+ * xsrfHeaderName?: string,
5
+ * }} options
6
+ * @returns {import('../index').Plugin}
7
+ */
8
+ export function xsrfPlugin({ xsrfCookieName, xsrfHeaderName }?: {
9
+ xsrfCookieName?: string;
10
+ xsrfHeaderName?: string;
11
+ }): import('../index').Plugin;
12
+ export const xsrf: import("../types").Plugin;
@@ -0,0 +1,8 @@
1
+ export class DialogStateEvent extends Event {
2
+ /**
3
+ * @param {'opening' | 'opened' | 'closing' | 'closed'} kind
4
+ * @param {import('./types.js').Context} context
5
+ */
6
+ constructor(kind: 'opening' | 'opened' | 'closing' | 'closed', context: import('./types.js').Context);
7
+ context: import("./types.js").Context;
8
+ }
@@ -0,0 +1,43 @@
1
+ export class Dialog extends EventTarget {
2
+ /**
3
+ *
4
+ * @param {Config} config
5
+ */
6
+ constructor(config: Config);
7
+ isOpen: boolean;
8
+ opened: Promise<any>;
9
+ __resolveOpened: (value: any) => void;
10
+ closed: Promise<any>;
11
+ __resolveClosed: (value: any) => void;
12
+ /** @type {Context} */
13
+ context: Context;
14
+ /**
15
+ * @returns {DialogNode}
16
+ */
17
+ __initDialogNode(): DialogNode;
18
+ __onLightDismiss: ({ target }: {
19
+ target: any;
20
+ }) => void;
21
+ close: (kind?: string) => void;
22
+ __onDialogClose: () => Promise<void>;
23
+ __dialog: import("./types.js").DialogNode;
24
+ /**
25
+ * @param {OpenDialogOptions} options
26
+ * @returns
27
+ */
28
+ open({ id, parameters }: OpenDialogOptions): Promise<void>;
29
+ /**
30
+ * Can be used to modify the dialog
31
+ *
32
+ * @example
33
+ * dialog.modify(node => {node.classList.add('foo')});
34
+ * @param {(dialog: DialogNode | undefined) => void} cb
35
+ */
36
+ modify(cb: (dialog: DialogNode | undefined) => void): void;
37
+ #private;
38
+ }
39
+ export type DialogNode = import('./types.js').DialogNode;
40
+ export type DialogCallbacks = import('./types.js').DialogCallbacks;
41
+ export type Config = import('./types.js').Config;
42
+ export type OpenDialogOptions = import('./types.js').OpenDialogOptions;
43
+ export type Context = import('./types.js').Context;
@@ -0,0 +1 @@
1
+ export function setupGlobalDialogStyles(): void;
@@ -0,0 +1,2 @@
1
+ export const DEV: true;
2
+ export const PROD: false;
@@ -0,0 +1,2 @@
1
+ export const DEV: false;
2
+ export const PROD: true;
@@ -0,0 +1,7 @@
1
+ export namespace capabilities {
2
+ const WAKELOCK: boolean;
3
+ const BADGING: boolean;
4
+ const SHARE: boolean;
5
+ const SERVICEWORKER: boolean;
6
+ const NOTIFICATION: boolean;
7
+ }
@@ -0,0 +1,25 @@
1
+ /**
2
+ * `'installable'` event
3
+ * @example pwa.dispatchEvent(new InstallableEvent());
4
+ */
5
+ export class InstallableEvent extends Event {
6
+ constructor();
7
+ }
8
+ /**
9
+ * `'installed'` event
10
+ * @example pwa.dispatchEvent(new InstalledEvent(installed));
11
+ */
12
+ export class InstalledEvent extends Event {
13
+ /**
14
+ * @param {boolean} installed
15
+ */
16
+ constructor(installed: boolean);
17
+ installed: boolean;
18
+ }
19
+ /**
20
+ * `'update-available'` event
21
+ * @example pwa.dispatchEvent(new UpdateAvailableEvent());
22
+ */
23
+ export class UpdateAvailableEvent extends Event {
24
+ constructor();
25
+ }
@@ -0,0 +1,40 @@
1
+ export type BeforeInstallPromptEvent = Event & {
2
+ prompt(): Promise<void>;
3
+ userChoice: Promise<{
4
+ outcome: 'accepted' | 'dismissed';
5
+ platform: string;
6
+ }>;
7
+ };
8
+ export const pwa: Pwa;
9
+ /**
10
+ * @typedef {Event & {
11
+ * prompt(): Promise<void>,
12
+ * userChoice: Promise<{
13
+ * outcome: 'accepted' | 'dismissed',
14
+ * platform: string
15
+ * }>
16
+ * }} BeforeInstallPromptEvent
17
+ */
18
+ declare class Pwa extends EventTarget {
19
+ /** @type {boolean} */
20
+ updateAvailable: boolean;
21
+ /** @type {boolean} */
22
+ installable: boolean;
23
+ /** @type {BeforeInstallPromptEvent | undefined} */
24
+ installPrompt: BeforeInstallPromptEvent | undefined;
25
+ /** @type {ServiceWorker | undefined} */
26
+ __waitingServiceWorker: ServiceWorker | undefined;
27
+ isInstalled: boolean;
28
+ /** Triggers the install prompt, when it's available. You can call this method when the `'installable'` event has fired. */
29
+ triggerPrompt: () => Promise<void>;
30
+ /** Update */
31
+ update: () => void;
32
+ /**
33
+ * @param {string} swPath
34
+ * @param {RegistrationOptions} [opts]
35
+ * @returns {Promise<ServiceWorkerRegistration> | Promise<void>}
36
+ */
37
+ register(swPath: string, opts?: RegistrationOptions): Promise<ServiceWorkerRegistration> | Promise<void>;
38
+ kill(): Promise<void>;
39
+ }
40
+ export {};
@@ -0,0 +1,50 @@
1
+ /**
2
+ * @typedef {import('./types.js').Plugin} Plugin
3
+ * @typedef {import('./types.js').Context} Context
4
+ * @typedef {import('./types.js').RouteDefinition} RouteDefinition
5
+ * @typedef {import('./types.js').Route} Route
6
+ * @typedef {import('./types.js').Config} Config
7
+ */
8
+ export class Router extends EventTarget {
9
+ /**
10
+ * @param {Config} config
11
+ */
12
+ constructor(config: Config);
13
+ context: {
14
+ params: {};
15
+ query: {};
16
+ title: string;
17
+ url: URL;
18
+ };
19
+ config: import("./types.js").Config;
20
+ /** @type {Route[]} */
21
+ routes: Route[];
22
+ uninstall(): void;
23
+ get url(): URL;
24
+ get fallback(): URL;
25
+ get baseUrl(): URL;
26
+ render(): RenderResult;
27
+ /**
28
+ * @param {URL} url
29
+ * @returns {Route | null}
30
+ */
31
+ _matchRoute(url: URL): Route | null;
32
+ _notifyUrlChanged(): void;
33
+ _onPopState: () => void;
34
+ _onAnchorClick: (e: any) => void;
35
+ /**
36
+ * @param {string | URL} url The URL to navigate to.
37
+ * @param {{
38
+ * backNav?: boolean
39
+ * }} options options An options object to configure the navigation. The backNav property specifies whether the navigation is a backward navigation, which doesn't push the navigation into browser nav history.
40
+ */
41
+ navigate(url: string | URL, options?: {
42
+ backNav?: boolean;
43
+ }): Promise<void>;
44
+ route: import("./types.js").Route;
45
+ }
46
+ export type Plugin = import('./types.js').Plugin;
47
+ export type Context = import('./types.js').Context;
48
+ export type RouteDefinition = import('./types.js').RouteDefinition;
49
+ export type Route = import('./types.js').Route;
50
+ export type Config = import('./types.js').Config;
@@ -0,0 +1,5 @@
1
+ /**
2
+ * @param {string} name
3
+ * @returns {import('../index.js').Plugin}
4
+ */
5
+ export function appName(name: string): import('../index.js').Plugin;
@@ -0,0 +1,4 @@
1
+ /**
2
+ * @type {import('../index.js').Plugin}
3
+ */
4
+ export const checkServiceWorkerUpdate: import('../index.js').Plugin;
@@ -0,0 +1,5 @@
1
+ /**
2
+ * @param {<Data>(context: import('../index.js').Context) => Promise<Data>} promise
3
+ * @returns {import('../index.js').Plugin}
4
+ */
5
+ export function data(promise: <Data>(context: import('../index.js').Context) => Promise<Data>): import('../index.js').Plugin;
@@ -0,0 +1,6 @@
1
+ /**
2
+ * @example lazy(() => import('foo'))
3
+ * @param {any} fn
4
+ * @returns {import('../index.js').Plugin}
5
+ */
6
+ export function lazy(fn: any): import('../index.js').Plugin;
@@ -0,0 +1,7 @@
1
+ /**
2
+ * @example offlinePlugin('/my-offline-page')
3
+ * @param {string} offlineRoute
4
+ * @returns {import('../index.js').Plugin}
5
+ */
6
+ export function offlinePlugin(offlineRoute?: string): import('../index.js').Plugin;
7
+ export const offline: import("../types.js").Plugin;
@@ -0,0 +1,5 @@
1
+ /**
2
+ * @param {string} path
3
+ * @returns {import('../index.js').Plugin}
4
+ */
5
+ export function redirect(path: string): import('../index.js').Plugin;
@@ -0,0 +1,4 @@
1
+ /**
2
+ * @type {import('../index.js').Plugin}
3
+ */
4
+ export const resetFocus: import('../index.js').Plugin;
@@ -0,0 +1,4 @@
1
+ /**
2
+ * @type {import('../index.js').Plugin}
3
+ */
4
+ export const scrollToTop: import('../index.js').Plugin;
@@ -0,0 +1,15 @@
1
+ /**
2
+ * `'state-changed'` event
3
+ * @example this.dispatchEvent(new StateEvent(data));
4
+ */
5
+ export class StateEvent extends Event {
6
+ constructor(state?: {});
7
+ state: {};
8
+ }
9
+ export class State extends EventTarget {
10
+ constructor(initialState: any);
11
+ setState(state: any): void;
12
+ getState(): any;
13
+ #private;
14
+ }
15
+ export const state: State;
@@ -0,0 +1,2 @@
1
+ export const APP_TOOLS: "app-tools";
2
+ export const VERSION: "1.x";
@@ -0,0 +1,23 @@
1
+ export function createService(defaults: any): {
2
+ new (host: any, promise: any): {
3
+ host: any;
4
+ promise: any;
5
+ state: string;
6
+ setPromise(promise: any): void;
7
+ setError(msg: any): void;
8
+ errorMessage: any;
9
+ request(params: any): any;
10
+ data: any;
11
+ /**
12
+ * Use states individually, useful if you may need to render stuff in different locations
13
+ */
14
+ initialized(templateFn: any): any;
15
+ pending(templateFn: any): any;
16
+ success(templateFn: any): any;
17
+ error(templateFn: any): any;
18
+ /**
19
+ * Combined render method, if you want to just render everything in place
20
+ */
21
+ render(templates: any): any;
22
+ };
23
+ };
@@ -0,0 +1,29 @@
1
+ export function debounce(f: any, scheduleTask: any, cancelTask: any): (...args: any[]) => void;
2
+ /**
3
+ * @param {() => void} f
4
+ * @param {number} ms
5
+ * @param {{
6
+ * signal?: AbortSignal
7
+ * }} options
8
+ */
9
+ export function setAbortableTimeout(f: () => void, ms: number, { signal }: {
10
+ signal?: AbortSignal;
11
+ }): void;
12
+ /**
13
+ * @param {() => boolean} predicate
14
+ * @param {{
15
+ * timeout?: number,
16
+ * message?: string,
17
+ * interval?: number
18
+ * }} options
19
+ * @returns {Promise<void>}
20
+ */
21
+ export function waitUntil(predicate: () => boolean, options?: {
22
+ timeout?: number;
23
+ message?: string;
24
+ interval?: number;
25
+ }): Promise<void>;
26
+ export function debounceAtTimeout(f: any, ms: any): (...args: any[]) => void;
27
+ export function debounceAtFrame(f: any): (...args: any[]) => void;
28
+ export function onePaint(): Promise<number>;
29
+ export function animationsComplete(element: HTMLElement): Promise<PromiseSettledResult<Animation>[]>;
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Syntax sugar to conditionally render a template
3
+ *
4
+ * @param {boolean} expression
5
+ * @param {() => any} trueValue
6
+ * @param {() => any} [falseValue]
7
+ * @returns {any | undefined}
8
+ */
9
+ export function when(expression: boolean, trueValue: () => any, falseValue?: () => any): any | undefined;
@@ -0,0 +1,13 @@
1
+ export namespace KEYCODES {
2
+ const TAB: number;
3
+ const ENTER: number;
4
+ const SHIFT: number;
5
+ const ESC: number;
6
+ const SPACE: number;
7
+ const END: number;
8
+ const HOME: number;
9
+ const LEFT: number;
10
+ const UP: number;
11
+ const RIGHT: number;
12
+ const DOWN: number;
13
+ }
@@ -0,0 +1,18 @@
1
+ /**
2
+ * @param {boolean} value
3
+ */
4
+ export function setDebug(value: boolean): void;
5
+ /**
6
+ * @returns {boolean}
7
+ */
8
+ export function getDebug(): boolean;
9
+ /**
10
+ * @param {string} action - describing the action
11
+ * @param {*} [data] - any js value
12
+ */
13
+ export function log(action: string, data?: any): void;
14
+ /**
15
+ * @param {string} title
16
+ * @returns {(action: string, data?: any) => void}
17
+ */
18
+ export function createLogger(title: string): (action: string, data?: any) => void;
@@ -0,0 +1,37 @@
1
+ export namespace media {
2
+ namespace MIN {
3
+ function XXXL(callback: any): boolean | (() => void);
4
+ function XXL(callback: any): boolean | (() => void);
5
+ function XL(callback: any): boolean | (() => void);
6
+ function LG(callback: any): boolean | (() => void);
7
+ function MD(callback: any): boolean | (() => void);
8
+ function SM(callback: any): boolean | (() => void);
9
+ function XS(callback: any): boolean | (() => void);
10
+ function XXS(callback: any): boolean | (() => void);
11
+ function XXXS(callback: any): boolean | (() => void);
12
+ }
13
+ namespace MAX {
14
+ export function XXXL_1(callback: any): boolean | (() => void);
15
+ export { XXXL_1 as XXXL };
16
+ export function XXL_1(callback: any): boolean | (() => void);
17
+ export { XXL_1 as XXL };
18
+ export function XL_1(callback: any): boolean | (() => void);
19
+ export { XL_1 as XL };
20
+ export function LG_1(callback: any): boolean | (() => void);
21
+ export { LG_1 as LG };
22
+ export function MD_1(callback: any): boolean | (() => void);
23
+ export { MD_1 as MD };
24
+ export function SM_1(callback: any): boolean | (() => void);
25
+ export { SM_1 as SM };
26
+ export function XS_1(callback: any): boolean | (() => void);
27
+ export { XS_1 as XS };
28
+ export function XXS_1(callback: any): boolean | (() => void);
29
+ export { XXS_1 as XXS };
30
+ export function XXXS_1(callback: any): boolean | (() => void);
31
+ export { XXXS_1 as XXXS };
32
+ }
33
+ function STANDALONE(callback: any): boolean | (() => void);
34
+ function REDUCED_MOTION(callback: any): boolean | (() => void);
35
+ function DARK_MODE(callback: any): boolean | (() => void);
36
+ function LIGHT_MODE(callback: any): boolean | (() => void);
37
+ }
package/api/types.d.ts DELETED
@@ -1,41 +0,0 @@
1
- export type ResponseType = 'text'|'json'|'stream'|'blob'|'arrayBuffer'|'formData'|'stream';
2
-
3
- export interface Config {
4
- plugins?: Plugin[];
5
- responseType?: ResponseType;
6
- baseURL?: string
7
- }
8
-
9
- export type BodyMethod<R> = (url: string, data?: object, opts?: RequestOptions) => Promise<R>;
10
- export type BodylessMethod<R> = (url: string, opts?: RequestOptions) => Promise<R>;
11
-
12
- export type Method = 'GET'|'DELETE'|'HEAD'|'OPTIONS'|'POST'|'PUT'|'PATCH';
13
-
14
- export interface Plugin {
15
- beforeFetch?: (meta: MetaParams) => MetaParams | Promise<MetaParams> | void;
16
- afterFetch?: (res: Response) => void | Promise<void> | Response | Promise<Response>;
17
- transform?: (data: any) => any;
18
- name: string;
19
- handleError?: (e: Error) => boolean;
20
- }
21
-
22
- export interface CustomRequestOptions {
23
- transform?: (data: object) => object;
24
- responseType?: ResponseType;
25
- params?: Record<string, string>;
26
- plugins?: Plugin[];
27
- baseURL?: string;
28
- }
29
-
30
- export type RequestOptions = RequestInit & CustomRequestOptions;
31
-
32
- export interface MetaParams {
33
- responseType: string;
34
- baseURL: string;
35
- url: string;
36
- method: Method;
37
- headers: Headers;
38
- opts?: RequestOptions;
39
- data?: any;
40
- fetchFn: typeof globalThis.fetch;
41
- }
package/dialog/types.d.ts DELETED
@@ -1,21 +0,0 @@
1
- export type DialogNode = HTMLDialogElement & { form: HTMLFormElement };
2
-
3
- export interface DialogCallbacks {
4
- opening?: <Parameters>(context: Context) => void;
5
- opened?: <Parameters>(context: Context) => void;
6
- closing?: (context: Context) => void;
7
- closed?: (context: Context) => void;
8
- }
9
-
10
- export type Config = Record<string, DialogCallbacks>;
11
-
12
- export interface OpenDialogOptions {
13
- id: string;
14
- parameters?: object;
15
- }
16
-
17
- export interface Context {
18
- dialog: DialogNode | undefined,
19
- id: string,
20
- parameters?: Record<string, any>
21
- }
package/router/types.d.ts DELETED
@@ -1,35 +0,0 @@
1
- export interface Config {
2
- fallback?: string;
3
- plugins?: Plugin[];
4
- routes: RouteDefinition[];
5
- }
6
-
7
- export interface Plugin {
8
- name: string;
9
- shouldNavigate?: (context: Context) => {
10
- redirect: string,
11
- condition: () => boolean | (() => Promise<Boolean>),
12
- };
13
- beforeNavigation?: (context: Context) => void;
14
- afterNavigation?: (context: Context) => void;
15
- }
16
-
17
- export interface Context {
18
- title?: string;
19
- query: Record<string, string>;
20
- params: Record<string, string>;
21
- url: URL;
22
- [key: string]: any;
23
- }
24
-
25
- export type Render<RenderResult> = (context: Context) => RenderResult;
26
-
27
- export interface RouteDefinition {
28
- path: string;
29
- title: string | ((context: Partial<Context>) => string);
30
- render?: Render<RenderResult>;
31
- plugins?: Plugin[];
32
- }
33
-
34
- /** @TODO URLPattern type */
35
- export type Route = RouteDefinition & { urlPattern?: any };