snice 2.2.2 → 2.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +163 -129
- package/dist/index.cjs.map +1 -1
- package/dist/index.esm.js +163 -129
- package/dist/index.esm.js.map +1 -1
- package/dist/index.iife.js +163 -129
- package/dist/index.iife.js.map +1 -1
- package/dist/symbols.cjs.map +1 -1
- package/dist/symbols.esm.js +1 -1
- package/dist/symbols.esm.js.map +1 -1
- package/dist/transitions.cjs.map +1 -1
- package/dist/transitions.esm.js +1 -1
- package/dist/transitions.esm.js.map +1 -1
- package/dist/types/controller.d.ts +1 -7
- package/dist/types/element.d.ts +3 -44
- package/dist/types/events.d.ts +2 -26
- package/dist/types/global.d.ts +1 -5
- package/dist/types/index.d.ts +2 -8
- package/dist/types/observe.d.ts +1 -16
- package/dist/types/request-response.d.ts +2 -28
- package/dist/types/router.d.ts +2 -81
- package/dist/types/transitions.d.ts +2 -30
- package/dist/types/types/DispatchOptions.d.ts +10 -0
- package/dist/types/types/IController.d.ts +8 -0
- package/dist/types/types/ObserveOptions.d.ts +16 -0
- package/dist/types/types/OnOptions.d.ts +16 -0
- package/dist/types/types/PageOptions.d.ts +30 -0
- package/dist/types/types/PartOptions.d.ts +4 -0
- package/dist/types/types/PropertyConverter.d.ts +4 -0
- package/dist/types/types/PropertyOptions.d.ts +9 -0
- package/dist/types/types/QueryOptions.d.ts +4 -0
- package/dist/types/types/RequestOptions.d.ts +18 -0
- package/dist/types/types/RespondOptions.d.ts +10 -0
- package/dist/types/types/RouterInstance.d.ts +10 -0
- package/dist/types/types/RouterOptions.d.ts +32 -0
- package/dist/types/types/SimpleArray.d.ts +17 -0
- package/dist/types/types/SniceElement.d.ts +8 -0
- package/dist/types/types/SniceGlobal.d.ts +5 -0
- package/dist/types/types/Transition.d.ts +33 -0
- package/dist/types/types/index.d.ts +17 -0
- package/dist/types/utils.d.ts +16 -0
- package/package.json +2 -3
package/dist/transitions.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transitions.cjs","sources":["../src/transitions.ts"],"sourcesContent":[null],"names":[],"mappings":";;;;;;;;AAAA;;AAEG;
|
|
1
|
+
{"version":3,"file":"transitions.cjs","sources":["../src/transitions.ts"],"sourcesContent":[null],"names":[],"mappings":";;;;;;;;AAAA;;AAEG;AAQH;;AAEG;AACH,SAAS,WAAW,CAAC,WAAmB,EAAA;IACtC,MAAM,MAAM,GAA2B,EAAE;IACzC,WAAW,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,IAAI,IAAG;QACpC,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,CAAC;AACxD,QAAA,IAAI,IAAI,IAAI,KAAK,EAAE;AACjB,YAAA,MAAM,CAAC,IAAI,CAAC,GAAG,KAAK;QACtB;AACF,IAAA,CAAC,CAAC;AACF,IAAA,OAAO,MAAM;AACf;AAEA;;AAEG;AACI,eAAe,iBAAiB,CACrC,SAAkB,EAClB,UAAuB,EACvB,UAAuB,EACvB,UAAA,GAAyB,EAAE,EAAA;AAE3B,IAAA,MAAM,WAAW,GAAG,UAAU,CAAC,WAAW,IAAI,GAAG;AACjD,IAAA,MAAM,UAAU,GAAG,UAAU,CAAC,UAAU,IAAI,GAAG;AAC/C,IAAA,MAAM,IAAI,GAAG,UAAU,CAAC,IAAI,IAAI,YAAY;;IAG5C,MAAM,SAAS,GAAG,UAAU,CAAC,GAAG,GAAG,WAAW,CAAC,UAAU,CAAC,GAAG,CAAC,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE;IACjF,MAAM,aAAa,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC;IACvC,MAAM,WAAW,GAAG,UAAU,CAAC,EAAE,GAAG,WAAW,CAAC,UAAU,CAAC,EAAE,CA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M,cAAc,GAAe;AACxC,IAAA,IAAI,EAAE,MAAM;AACZ,IAAA,WAAW,EAAE,GAAG;AAChB,IAAA,UAAU,EAAE,GAAG;AACf,IAAA,GAAG,EAAE,iCAAiC;AACtC,IAAA,EAAE,EAAE,iCAAiC;AACrC,IAAA,IAAI,EAAE;;AAGR;AACO,MAAM,cAAc,GAAe;AACxC,IAAA,IAAI,EAAE,MAAM;AACZ,IAAA,WAAW,EAAE,CAAC;AACd,IAAA,UAAU,EAAE,CAAC;AACb,IAAA,GAAG,EAAE,EAAE;AACP,IAAA,EAAE,EAAE,EAAE;AACN,IAAA,IAAI,EAAE;;;;;;;;;;;;;;;"}
|
package/dist/transitions.esm.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transitions.esm.js","sources":["../src/transitions.ts"],"sourcesContent":[null],"names":[],"mappings":";;;;;;AAAA;;AAEG;
|
|
1
|
+
{"version":3,"file":"transitions.esm.js","sources":["../src/transitions.ts"],"sourcesContent":[null],"names":[],"mappings":";;;;;;AAAA;;AAEG;AAQH;;AAEG;AACH,SAAS,WAAW,CAAC,WAAmB,EAAA;IACtC,MAAM,MAAM,GAA2B,EAAE;IACzC,WAAW,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,IAAI,IAAG;QACpC,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,CAAC;AACxD,QAAA,IAAI,IAAI,IAAI,KAAK,EAAE;AACjB,YAAA,MAAM,CAAC,IAAI,CAAC,GAAG,KAAK;QACtB;AACF,IAAA,CAAC,CAAC;AACF,IAAA,OAAO,MAAM;AACf;AAEA;;AAEG;AACI,eAAe,iBAAiB,CACrC,SAAkB,EAClB,UAAuB,EACvB,UAAuB,EACvB,UAAA,GAAyB,EAAE,EAAA;AAE3B,IAAA,MAAM,WAAW,GA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BAAgB,GAAe;AAC1C,IAAA,IAAI,EAAE,QAAQ;AACd,IAAA,WAAW,EAAE,GAAG;AAChB,IAAA,UAAU,EAAE,GAAG;AACf,IAAA,GAAG,EAAE,kDAAkD;AACvD,IAAA,EAAE,EAAE,2CAA2C;AAC/C,IAAA,IAAI,EAAE;;AAGR;AACO,MAAM,cAAc,GAAe;AACxC,IAAA,IAAI,EAAE,MAAM;AACZ,IAAA,WAAW,EAAE,GAAG;AAChB,IAAA,UAAU,EAAE,GAAG;AACf,IAAA,GAAG,EAAE,wCAAwC;AAC7C,IAAA,EAAE,EAAE,mCAAmC;AACvC,IAAA,IAAI,EAAE;;AAGR;AACO,MAAM,cAAc,GAAe;AACxC,IAAA,IAAI,EAAE,MAAM;AACZ,IAAA,WAAW,EAAE,GAAG;AAChB,IAAA,UAAU,EAAE,GAAG;AACf,IAAA,GAAG,EAAE,iCAAiC;AACtC,IAAA,EAAE,EAAE,iCAAiC;AACrC,IAAA,IAAI,EAAE;;AAGR;AACO,MAAM,cAAc,GAAe;AACxC,IAAA,IAAI,EAAE,MAAM;AACZ,IAAA,WAAW,EAAE,CAAC;AACd,IAAA,UAAU,EAAE,CAAC;AACb,IAAA,GAAG,EAAE,EAAE;AACP,IAAA,EAAE,EAAE,EAAE;AACN,IAAA,IAAI,EAAE;;;;;"}
|
|
@@ -1,10 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
export interface IController<T extends HTMLElement = HTMLElement> {
|
|
3
|
-
element: Maybe<T>;
|
|
4
|
-
attach(element: T): void | Promise<void>;
|
|
5
|
-
detach(element: T): void | Promise<void>;
|
|
6
|
-
}
|
|
7
|
-
export type ControllerClass<T extends HTMLElement = HTMLElement> = new () => IController<T>;
|
|
1
|
+
import { IController, ControllerClass } from './types/IController';
|
|
8
2
|
declare class ControllerScope {
|
|
9
3
|
private cleanupFns;
|
|
10
4
|
private pendingOperations;
|
package/dist/types/element.d.ts
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import { QueryOptions } from './types/QueryOptions';
|
|
2
|
+
import { PropertyOptions } from './types/PropertyOptions';
|
|
3
|
+
import { PartOptions } from './types/PartOptions';
|
|
1
4
|
/**
|
|
2
5
|
* Applies core element functionality to a constructor
|
|
3
6
|
* This is shared between @element and @page decorators
|
|
@@ -6,52 +9,8 @@ export declare function applyElementFunctionality(constructor: any): void;
|
|
|
6
9
|
export declare function element(tagName: string): (constructor: any, context: ClassDecoratorContext) => any;
|
|
7
10
|
export declare function layout(tagName: string): (constructor: any, context: ClassDecoratorContext) => any;
|
|
8
11
|
export declare function property(options?: PropertyOptions): (_value: any, context: ClassFieldDecoratorContext) => (this: any, initialValue: any) => any;
|
|
9
|
-
export interface QueryOptions {
|
|
10
|
-
light?: boolean;
|
|
11
|
-
shadow?: boolean;
|
|
12
|
-
}
|
|
13
12
|
export declare function query(selector: string, options?: QueryOptions): (_value: any, context: ClassFieldDecoratorContext) => (this: any, initialValue: any) => any;
|
|
14
13
|
export declare function queryAll(selector: string, options?: QueryOptions): (_value: any, context: ClassFieldDecoratorContext) => (this: any, initialValue: any) => any;
|
|
15
|
-
/**
|
|
16
|
-
* SimpleArray type for arrays that can be safely reflected to attributes
|
|
17
|
-
* Supports arrays of: string, number, boolean
|
|
18
|
-
* Uses full-width comma (,) as separator to avoid conflicts
|
|
19
|
-
* Strings cannot contain the full-width comma character
|
|
20
|
-
*/
|
|
21
|
-
export declare class SimpleArray {
|
|
22
|
-
static readonly SEPARATOR = "\uFF0C";
|
|
23
|
-
/**
|
|
24
|
-
* Serialize array to string for attribute storage
|
|
25
|
-
*/
|
|
26
|
-
static serialize(arr: (string | number | boolean)[]): string;
|
|
27
|
-
/**
|
|
28
|
-
* Parse string from attribute back to array
|
|
29
|
-
*/
|
|
30
|
-
static parse(str: string | null): (string | number | boolean)[];
|
|
31
|
-
}
|
|
32
|
-
export interface PropertyOptions {
|
|
33
|
-
type?: StringConstructor | NumberConstructor | BooleanConstructor | ArrayConstructor | ObjectConstructor | DateConstructor | BigIntConstructor | typeof SimpleArray;
|
|
34
|
-
reflect?: boolean;
|
|
35
|
-
attribute?: string | boolean;
|
|
36
|
-
converter?: PropertyConverter;
|
|
37
|
-
hasChanged?: (value: any, oldValue: any) => boolean;
|
|
38
|
-
}
|
|
39
|
-
export interface PropertyConverter {
|
|
40
|
-
fromAttribute?(value: string | null, type?: any): any;
|
|
41
|
-
toAttribute?(value: any, type?: any): string | null;
|
|
42
|
-
}
|
|
43
|
-
/**
|
|
44
|
-
* Interface for Snice elements with all the framework-provided properties and methods
|
|
45
|
-
*/
|
|
46
|
-
export interface SniceElement extends HTMLElement {
|
|
47
|
-
ready: Promise<void>;
|
|
48
|
-
html?(): string | Promise<string>;
|
|
49
|
-
css?(): string | string[] | Promise<string | string[]>;
|
|
50
|
-
}
|
|
51
|
-
export interface PartOptions {
|
|
52
|
-
throttle?: number;
|
|
53
|
-
debounce?: number;
|
|
54
|
-
}
|
|
55
14
|
export declare function watch(...propertyNames: string[]): (target: any, context: ClassMethodDecoratorContext) => void;
|
|
56
15
|
/**
|
|
57
16
|
* Decorator that injects router context into a property
|
package/dist/types/events.d.ts
CHANGED
|
@@ -1,32 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
capture?: boolean;
|
|
4
|
-
/** Remove listener after first trigger */
|
|
5
|
-
once?: boolean;
|
|
6
|
-
/** Passive listener (can't preventDefault) */
|
|
7
|
-
passive?: boolean;
|
|
8
|
-
/** Automatically call preventDefault on the event */
|
|
9
|
-
preventDefault?: boolean;
|
|
10
|
-
/** Automatically call stopPropagation on the event */
|
|
11
|
-
stopPropagation?: boolean;
|
|
12
|
-
/** Debounce the handler by specified milliseconds */
|
|
13
|
-
debounce?: number;
|
|
14
|
-
/** Throttle the handler by specified milliseconds */
|
|
15
|
-
throttle?: number;
|
|
16
|
-
}
|
|
1
|
+
import { OnOptions } from './types/OnOptions';
|
|
2
|
+
import { DispatchOptions } from './types/DispatchOptions';
|
|
17
3
|
export declare function on(eventName: string | string[], selectorOrOptions?: string | OnOptions, options?: OnOptions): (target: any, context: ClassMethodDecoratorContext) => void;
|
|
18
4
|
export declare function setupEventHandlers(instance: any, element: HTMLElement): void;
|
|
19
5
|
export declare function cleanupEventHandlers(instance: any): void;
|
|
20
|
-
export interface DispatchOptions extends EventInit {
|
|
21
|
-
/**
|
|
22
|
-
* Whether to dispatch even if the method returns undefined (default: true)
|
|
23
|
-
*/
|
|
24
|
-
dispatchOnUndefined?: boolean;
|
|
25
|
-
/** Debounce the dispatch by specified milliseconds */
|
|
26
|
-
debounce?: number;
|
|
27
|
-
/** Throttle the dispatch by specified milliseconds */
|
|
28
|
-
throttle?: number;
|
|
29
|
-
}
|
|
30
6
|
/**
|
|
31
7
|
* Decorator that automatically dispatches a custom event after a method is called.
|
|
32
8
|
* The return value of the method becomes the event detail.
|
package/dist/types/global.d.ts
CHANGED
|
@@ -1,7 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
controllerRegistry: Map<string, any>;
|
|
3
|
-
controllerIdCounter: number;
|
|
4
|
-
symbols: Map<string, symbol>;
|
|
5
|
-
}
|
|
1
|
+
import { SniceGlobal } from './types/SniceGlobal';
|
|
6
2
|
export declare const snice: SniceGlobal;
|
|
7
3
|
export declare function getSymbol(name: string): symbol;
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,14 +1,8 @@
|
|
|
1
|
-
export { element, layout, property, query, queryAll, watch, context, applyElementFunctionality, ready, dispose, part
|
|
1
|
+
export { element, layout, property, query, queryAll, watch, context, applyElementFunctionality, ready, dispose, part } from './element';
|
|
2
2
|
export { Router } from './router';
|
|
3
3
|
export { controller, attachController, detachController, getController, useNativeElementControllers, cleanupNativeElementControllers } from './controller';
|
|
4
4
|
export { on, dispatch } from './events';
|
|
5
5
|
export { observe } from './observe';
|
|
6
6
|
export { request, respond } from './request-response';
|
|
7
7
|
export { IS_CONTROLLER_INSTANCE, getSymbol } from './symbols';
|
|
8
|
-
export
|
|
9
|
-
export type { PropertyOptions, PropertyConverter, QueryOptions, SniceElement, PartOptions } from './element';
|
|
10
|
-
export type { RouterOptions, PageOptions, Guard, RouteParams, RouterInstance } from './router';
|
|
11
|
-
export type { IController, ControllerClass } from './controller';
|
|
12
|
-
export type { DispatchOptions } from './events';
|
|
13
|
-
export type { ObserveOptions } from './observe';
|
|
14
|
-
export type { RequestOptions } from './request-response';
|
|
8
|
+
export * from './types';
|
package/dist/types/observe.d.ts
CHANGED
|
@@ -1,19 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
/** For IntersectionObserver: threshold of visibility */
|
|
3
|
-
threshold?: number | number[];
|
|
4
|
-
/** For IntersectionObserver: margin around root */
|
|
5
|
-
rootMargin?: string;
|
|
6
|
-
/** For IntersectionObserver: root element (defaults to viewport) */
|
|
7
|
-
root?: Element | null;
|
|
8
|
-
/** For ResizeObserver: which box model to observe */
|
|
9
|
-
box?: 'content-box' | 'border-box';
|
|
10
|
-
/** Throttle the callback by specified milliseconds */
|
|
11
|
-
throttle?: number;
|
|
12
|
-
/** For MutationObserver: observe subtree (use with caution) */
|
|
13
|
-
subtree?: boolean;
|
|
14
|
-
/** Maximum depth for subtree observation (safety limit) */
|
|
15
|
-
maxDepth?: number;
|
|
16
|
-
}
|
|
1
|
+
import { ObserveOptions } from './types/ObserveOptions';
|
|
17
2
|
/**
|
|
18
3
|
* Decorator for observing external changes like viewport intersection, resize, media queries, and DOM mutations
|
|
19
4
|
*
|
|
@@ -1,21 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
* Timeout for waiting for responses (in ms) - defaults to 5000ms
|
|
4
|
-
*/
|
|
5
|
-
timeout?: number;
|
|
6
|
-
/**
|
|
7
|
-
* Timeout for finding a handler (in ms) - defaults to 50ms
|
|
8
|
-
*/
|
|
9
|
-
discoveryTimeout?: number;
|
|
10
|
-
/**
|
|
11
|
-
* Debounce the request by specified milliseconds
|
|
12
|
-
*/
|
|
13
|
-
debounce?: number;
|
|
14
|
-
/**
|
|
15
|
-
* Throttle the request by specified milliseconds
|
|
16
|
-
*/
|
|
17
|
-
throttle?: number;
|
|
18
|
-
}
|
|
1
|
+
import { RequestOptions } from './types/RequestOptions';
|
|
2
|
+
import { RespondOptions } from './types/RespondOptions';
|
|
19
3
|
/**
|
|
20
4
|
* Decorator for making requests from elements or controllers.
|
|
21
5
|
* Uses async generator pattern for bidirectional communication.
|
|
@@ -24,16 +8,6 @@ export interface RequestOptions extends EventInit {
|
|
|
24
8
|
* @param options Optional configuration
|
|
25
9
|
*/
|
|
26
10
|
export declare function request<T = any>(requestName: string, options?: RequestOptions): (originalMethod: any, _context: ClassMethodDecoratorContext) => (...args: any[]) => Promise<T>;
|
|
27
|
-
export interface RespondOptions {
|
|
28
|
-
/**
|
|
29
|
-
* Debounce the response by specified milliseconds
|
|
30
|
-
*/
|
|
31
|
-
debounce?: number;
|
|
32
|
-
/**
|
|
33
|
-
* Throttle the response by specified milliseconds
|
|
34
|
-
*/
|
|
35
|
-
throttle?: number;
|
|
36
|
-
}
|
|
37
11
|
/**
|
|
38
12
|
* Decorator for responding to requests in elements or controllers.
|
|
39
13
|
*
|
package/dist/types/router.d.ts
CHANGED
|
@@ -1,84 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
* Route parameters extracted from the URL
|
|
4
|
-
*/
|
|
5
|
-
export type RouteParams = Record<string, string>;
|
|
6
|
-
/**
|
|
7
|
-
* Guard function that determines if navigation is allowed
|
|
8
|
-
* @param context The application context
|
|
9
|
-
* @param params The URL parameters from the route
|
|
10
|
-
*/
|
|
11
|
-
export type Guard<T = any> = (context: T, params: RouteParams) => boolean | Promise<boolean>;
|
|
12
|
-
export interface RouterOptions {
|
|
13
|
-
/**
|
|
14
|
-
* The target element selector where the page element will be instantiated.
|
|
15
|
-
* The router will use this selector to find the target element, clear it, and append the page element to it.
|
|
16
|
-
*/
|
|
17
|
-
target: string;
|
|
18
|
-
/**
|
|
19
|
-
* Whether to use hash routing or push state routing.
|
|
20
|
-
*/
|
|
21
|
-
type: 'hash' | 'pushstate';
|
|
22
|
-
/**
|
|
23
|
-
* Override for the window object to use for routing, defaults to global.
|
|
24
|
-
*/
|
|
25
|
-
window?: Window;
|
|
26
|
-
/**
|
|
27
|
-
* Override for the document object to use for routing, defaults to global.
|
|
28
|
-
*/
|
|
29
|
-
document?: Document;
|
|
30
|
-
/**
|
|
31
|
-
* Global transition configuration for all pages
|
|
32
|
-
*/
|
|
33
|
-
transition?: Transition;
|
|
34
|
-
/**
|
|
35
|
-
* Optional context object passed to guard functions
|
|
36
|
-
*/
|
|
37
|
-
context?: any;
|
|
38
|
-
/**
|
|
39
|
-
* Default layout element tag name for all pages
|
|
40
|
-
*/
|
|
41
|
-
layout?: string;
|
|
42
|
-
}
|
|
43
|
-
export interface PageOptions {
|
|
44
|
-
/**
|
|
45
|
-
* The tag name of the custom element.
|
|
46
|
-
* @example { tag: 'login-page' }
|
|
47
|
-
* // for <login-page></login-page>
|
|
48
|
-
*/
|
|
49
|
-
tag: string;
|
|
50
|
-
/**
|
|
51
|
-
* The routes that will trigger the page element.
|
|
52
|
-
* @example { routes: ['/login', '/login/:id'] }
|
|
53
|
-
*/
|
|
54
|
-
routes: string[];
|
|
55
|
-
/**
|
|
56
|
-
* Optional per-page transition override
|
|
57
|
-
*/
|
|
58
|
-
transition?: Transition;
|
|
59
|
-
/**
|
|
60
|
-
* Guard functions that must pass for navigation to proceed.
|
|
61
|
-
* Can be a single guard or an array of guards (all must pass).
|
|
62
|
-
*/
|
|
63
|
-
guards?: Guard<any> | Guard<any>[];
|
|
64
|
-
/**
|
|
65
|
-
* Layout element tag name for this page.
|
|
66
|
-
* Use false to explicitly disable layout for this page.
|
|
67
|
-
*/
|
|
68
|
-
layout?: string | false;
|
|
69
|
-
}
|
|
70
|
-
/**
|
|
71
|
-
* Router return type
|
|
72
|
-
*/
|
|
73
|
-
export interface RouterInstance {
|
|
74
|
-
page: (pageOptions: PageOptions) => <C extends {
|
|
75
|
-
new (...args: any[]): HTMLElement;
|
|
76
|
-
}>(constructor: C, context: ClassDecoratorContext) => C;
|
|
77
|
-
initialize: () => void;
|
|
78
|
-
navigate: (path: string) => Promise<void>;
|
|
79
|
-
register: (route: string, tag: string, transition?: Transition, guards?: Guard<any> | Guard<any>[]) => void;
|
|
80
|
-
context: any;
|
|
81
|
-
}
|
|
1
|
+
import { RouterOptions } from './types/RouterOptions';
|
|
2
|
+
import { RouterInstance } from './types/RouterInstance';
|
|
82
3
|
/**
|
|
83
4
|
* Creates a new router instance.
|
|
84
5
|
* @param {RouterOptions} options - The router configuration options.
|
|
@@ -1,36 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Generic transition system for animating between elements
|
|
3
3
|
*/
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
* Name of the transition (for identification)
|
|
7
|
-
*/
|
|
8
|
-
name?: string;
|
|
9
|
-
/**
|
|
10
|
-
* Duration of the out transition in ms
|
|
11
|
-
*/
|
|
12
|
-
outDuration?: number;
|
|
13
|
-
/**
|
|
14
|
-
* Duration of the in transition in ms
|
|
15
|
-
*/
|
|
16
|
-
inDuration?: number;
|
|
17
|
-
/**
|
|
18
|
-
* CSS properties for the out transition (as string)
|
|
19
|
-
* Example: 'opacity: 0; transform: scale(0.9)'
|
|
20
|
-
*/
|
|
21
|
-
out?: string;
|
|
22
|
-
/**
|
|
23
|
-
* CSS properties for the in transition (as string)
|
|
24
|
-
* Example: 'opacity: 1; transform: scale(1)'
|
|
25
|
-
*/
|
|
26
|
-
in?: string;
|
|
27
|
-
/**
|
|
28
|
-
* Transition mode:
|
|
29
|
-
* - 'sequential': out transition completes before in transition starts
|
|
30
|
-
* - 'simultaneous': both transitions happen at the same time
|
|
31
|
-
*/
|
|
32
|
-
mode?: 'sequential' | 'simultaneous';
|
|
33
|
-
}
|
|
4
|
+
import { Transition } from './types/Transition';
|
|
5
|
+
export type { Transition };
|
|
34
6
|
/**
|
|
35
7
|
* Perform a transition between two elements
|
|
36
8
|
*/
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export interface DispatchOptions extends EventInit {
|
|
2
|
+
/**
|
|
3
|
+
* Whether to dispatch even if the method returns undefined (default: true)
|
|
4
|
+
*/
|
|
5
|
+
dispatchOnUndefined?: boolean;
|
|
6
|
+
/** Debounce the dispatch by specified milliseconds */
|
|
7
|
+
debounce?: number;
|
|
8
|
+
/** Throttle the dispatch by specified milliseconds */
|
|
9
|
+
throttle?: number;
|
|
10
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
type Maybe<T> = T | null | undefined;
|
|
2
|
+
export interface IController<T extends HTMLElement = HTMLElement> {
|
|
3
|
+
element: Maybe<T>;
|
|
4
|
+
attach(element: T): void | Promise<void>;
|
|
5
|
+
detach(element: T): void | Promise<void>;
|
|
6
|
+
}
|
|
7
|
+
export type ControllerClass<T extends HTMLElement = HTMLElement> = new () => IController<T>;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export interface ObserveOptions {
|
|
2
|
+
/** For IntersectionObserver: threshold of visibility */
|
|
3
|
+
threshold?: number | number[];
|
|
4
|
+
/** For IntersectionObserver: margin around root */
|
|
5
|
+
rootMargin?: string;
|
|
6
|
+
/** For IntersectionObserver: root element (defaults to viewport) */
|
|
7
|
+
root?: Element | null;
|
|
8
|
+
/** For ResizeObserver: which box model to observe */
|
|
9
|
+
box?: 'content-box' | 'border-box';
|
|
10
|
+
/** Throttle the callback by specified milliseconds */
|
|
11
|
+
throttle?: number;
|
|
12
|
+
/** For MutationObserver: observe subtree (use with caution) */
|
|
13
|
+
subtree?: boolean;
|
|
14
|
+
/** Maximum depth for subtree observation (safety limit) */
|
|
15
|
+
maxDepth?: number;
|
|
16
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export interface OnOptions {
|
|
2
|
+
/** Use capture phase instead of bubble phase */
|
|
3
|
+
capture?: boolean;
|
|
4
|
+
/** Remove listener after first trigger */
|
|
5
|
+
once?: boolean;
|
|
6
|
+
/** Passive listener (can't preventDefault) */
|
|
7
|
+
passive?: boolean;
|
|
8
|
+
/** Automatically call preventDefault on the event */
|
|
9
|
+
preventDefault?: boolean;
|
|
10
|
+
/** Automatically call stopPropagation on the event */
|
|
11
|
+
stopPropagation?: boolean;
|
|
12
|
+
/** Debounce the handler by specified milliseconds */
|
|
13
|
+
debounce?: number;
|
|
14
|
+
/** Throttle the handler by specified milliseconds */
|
|
15
|
+
throttle?: number;
|
|
16
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { Transition } from './Transition';
|
|
2
|
+
export type RouteParams = Record<string, string>;
|
|
3
|
+
export type Guard<T = any> = (context: T, params: RouteParams) => boolean | Promise<boolean>;
|
|
4
|
+
export interface PageOptions {
|
|
5
|
+
/**
|
|
6
|
+
* The tag name of the custom element.
|
|
7
|
+
* @example { tag: 'login-page' }
|
|
8
|
+
* // for <login-page></login-page>
|
|
9
|
+
*/
|
|
10
|
+
tag: string;
|
|
11
|
+
/**
|
|
12
|
+
* The routes that will trigger the page element.
|
|
13
|
+
* @example { routes: ['/login', '/login/:id'] }
|
|
14
|
+
*/
|
|
15
|
+
routes: string[];
|
|
16
|
+
/**
|
|
17
|
+
* Optional per-page transition override
|
|
18
|
+
*/
|
|
19
|
+
transition?: Transition;
|
|
20
|
+
/**
|
|
21
|
+
* Guard functions that must pass for navigation to proceed.
|
|
22
|
+
* Can be a single guard or an array of guards (all must pass).
|
|
23
|
+
*/
|
|
24
|
+
guards?: Guard<any> | Guard<any>[];
|
|
25
|
+
/**
|
|
26
|
+
* Layout element tag name for this page.
|
|
27
|
+
* Use false to explicitly disable layout for this page.
|
|
28
|
+
*/
|
|
29
|
+
layout?: string | false;
|
|
30
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { SimpleArray } from './SimpleArray';
|
|
2
|
+
import { PropertyConverter } from './PropertyConverter';
|
|
3
|
+
export interface PropertyOptions {
|
|
4
|
+
type?: StringConstructor | NumberConstructor | BooleanConstructor | ArrayConstructor | ObjectConstructor | DateConstructor | BigIntConstructor | typeof SimpleArray;
|
|
5
|
+
reflect?: boolean;
|
|
6
|
+
attribute?: string | boolean;
|
|
7
|
+
converter?: PropertyConverter;
|
|
8
|
+
hasChanged?: (value: any, oldValue: any) => boolean;
|
|
9
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export interface RequestOptions extends EventInit {
|
|
2
|
+
/**
|
|
3
|
+
* Timeout for waiting for responses (in ms) - defaults to 5000ms
|
|
4
|
+
*/
|
|
5
|
+
timeout?: number;
|
|
6
|
+
/**
|
|
7
|
+
* Timeout for finding a handler (in ms) - defaults to 50ms
|
|
8
|
+
*/
|
|
9
|
+
discoveryTimeout?: number;
|
|
10
|
+
/**
|
|
11
|
+
* Debounce the request by specified milliseconds
|
|
12
|
+
*/
|
|
13
|
+
debounce?: number;
|
|
14
|
+
/**
|
|
15
|
+
* Throttle the request by specified milliseconds
|
|
16
|
+
*/
|
|
17
|
+
throttle?: number;
|
|
18
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { PageOptions, Guard } from './PageOptions';
|
|
2
|
+
import { Transition } from './Transition';
|
|
3
|
+
export interface RouterInstance {
|
|
4
|
+
page: (pageOptions: PageOptions) => <C extends {
|
|
5
|
+
new (...args: any[]): HTMLElement;
|
|
6
|
+
}>(constructor: C, context: ClassDecoratorContext) => C;
|
|
7
|
+
initialize: () => void;
|
|
8
|
+
navigate: (path: string) => Promise<void>;
|
|
9
|
+
register: (route: string, tag: string, transition?: Transition, guards?: Guard<any> | Guard<any>[]) => void;
|
|
10
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { Transition } from './Transition';
|
|
2
|
+
export interface RouterOptions {
|
|
3
|
+
/**
|
|
4
|
+
* The target element selector where the page element will be instantiated.
|
|
5
|
+
* The router will use this selector to find the target element, clear it, and append the page element to it.
|
|
6
|
+
*/
|
|
7
|
+
target: string;
|
|
8
|
+
/**
|
|
9
|
+
* Whether to use hash routing or push state routing.
|
|
10
|
+
*/
|
|
11
|
+
type: 'hash' | 'pushstate';
|
|
12
|
+
/**
|
|
13
|
+
* Override for the window object to use for routing, defaults to global.
|
|
14
|
+
*/
|
|
15
|
+
window?: Window;
|
|
16
|
+
/**
|
|
17
|
+
* Override for the document object to use for routing, defaults to global.
|
|
18
|
+
*/
|
|
19
|
+
document?: Document;
|
|
20
|
+
/**
|
|
21
|
+
* Global transition configuration for all pages
|
|
22
|
+
*/
|
|
23
|
+
transition?: Transition;
|
|
24
|
+
/**
|
|
25
|
+
* Optional context object passed to guard functions
|
|
26
|
+
*/
|
|
27
|
+
context?: any;
|
|
28
|
+
/**
|
|
29
|
+
* Default layout element tag name for all pages
|
|
30
|
+
*/
|
|
31
|
+
layout?: string;
|
|
32
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SimpleArray type for arrays that can be safely reflected to attributes
|
|
3
|
+
* Supports arrays of: string, number, boolean
|
|
4
|
+
* Uses full-width comma (,) as separator to avoid conflicts
|
|
5
|
+
* Strings cannot contain the full-width comma character
|
|
6
|
+
*/
|
|
7
|
+
export declare class SimpleArray {
|
|
8
|
+
static readonly SEPARATOR = "\uFF0C";
|
|
9
|
+
/**
|
|
10
|
+
* Serialize array to string for attribute storage
|
|
11
|
+
*/
|
|
12
|
+
static serialize(arr: (string | number | boolean)[]): string;
|
|
13
|
+
/**
|
|
14
|
+
* Parse string from attribute back to array
|
|
15
|
+
*/
|
|
16
|
+
static parse(str: string | null): (string | number | boolean)[];
|
|
17
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Interface for Snice elements with all the framework-provided properties and methods
|
|
3
|
+
*/
|
|
4
|
+
export interface SniceElement extends HTMLElement {
|
|
5
|
+
ready: Promise<void>;
|
|
6
|
+
html?(): string | Promise<string>;
|
|
7
|
+
css?(): string | string[] | Promise<string | string[]>;
|
|
8
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generic transition system for animating between elements
|
|
3
|
+
*/
|
|
4
|
+
export interface Transition {
|
|
5
|
+
/**
|
|
6
|
+
* Name of the transition (for identification)
|
|
7
|
+
*/
|
|
8
|
+
name?: string;
|
|
9
|
+
/**
|
|
10
|
+
* Duration of the out transition in ms
|
|
11
|
+
*/
|
|
12
|
+
outDuration?: number;
|
|
13
|
+
/**
|
|
14
|
+
* Duration of the in transition in ms
|
|
15
|
+
*/
|
|
16
|
+
inDuration?: number;
|
|
17
|
+
/**
|
|
18
|
+
* CSS properties for the out transition (as string)
|
|
19
|
+
* Example: 'opacity: 0; transform: scale(0.9)'
|
|
20
|
+
*/
|
|
21
|
+
out?: string;
|
|
22
|
+
/**
|
|
23
|
+
* CSS properties for the in transition (as string)
|
|
24
|
+
* Example: 'opacity: 1; transform: scale(1)'
|
|
25
|
+
*/
|
|
26
|
+
in?: string;
|
|
27
|
+
/**
|
|
28
|
+
* Transition mode:
|
|
29
|
+
* - 'sequential': out transition completes before in transition starts
|
|
30
|
+
* - 'simultaneous': both transitions happen at the same time
|
|
31
|
+
*/
|
|
32
|
+
mode?: 'sequential' | 'simultaneous';
|
|
33
|
+
}
|