@jasonshimmy/custom-elements-runtime 1.2.1 → 1.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/custom-elements-runtime.cjs.js +34 -27
- package/dist/custom-elements-runtime.cjs.js.map +1 -1
- package/dist/custom-elements-runtime.es.js +2327 -1942
- package/dist/custom-elements-runtime.es.js.map +1 -1
- package/dist/custom-elements-runtime.umd.js +35 -28
- package/dist/custom-elements-runtime.umd.js.map +1 -1
- package/dist/router.d.ts +7 -18
- package/dist/runtime/helpers.d.ts +15 -0
- package/dist/runtime/node-metadata.d.ts +0 -9
- package/dist/store.d.ts +5 -1
- package/package.json +2 -1
package/dist/router.d.ts
CHANGED
|
@@ -1,13 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
* - Functional API, zero dependencies, SSR/static site compatible
|
|
4
|
-
* - Integrates with createStore and lib/index.ts
|
|
5
|
-
*/
|
|
6
|
-
import { type Store } from './store';
|
|
7
|
-
export interface RouteComponent {
|
|
1
|
+
import { type Store } from "./store";
|
|
2
|
+
export type RouteComponent = {
|
|
8
3
|
new (...args: any[]): any;
|
|
9
|
-
|
|
10
|
-
}
|
|
4
|
+
} | ((...args: any[]) => any);
|
|
11
5
|
export interface RouteState {
|
|
12
6
|
path: string;
|
|
13
7
|
params: Record<string, string>;
|
|
@@ -50,8 +44,8 @@ export interface RouterLinkProps {
|
|
|
50
44
|
ariaCurrentValue: string;
|
|
51
45
|
disabled: boolean;
|
|
52
46
|
external: boolean;
|
|
53
|
-
|
|
54
|
-
|
|
47
|
+
linkClass?: string;
|
|
48
|
+
linkStyle?: string;
|
|
55
49
|
}
|
|
56
50
|
export interface RouterLinkComputed {
|
|
57
51
|
current: RouteState;
|
|
@@ -68,11 +62,6 @@ export interface RouterConfig {
|
|
|
68
62
|
base?: string;
|
|
69
63
|
initialUrl?: string;
|
|
70
64
|
}
|
|
71
|
-
export interface RouteState {
|
|
72
|
-
path: string;
|
|
73
|
-
params: Record<string, string>;
|
|
74
|
-
query: Record<string, string>;
|
|
75
|
-
}
|
|
76
65
|
export declare const parseQuery: (search: string) => Record<string, string>;
|
|
77
66
|
export declare const matchRoute: (routes: Route[], path: string) => {
|
|
78
67
|
route: Route | null;
|
|
@@ -89,7 +78,7 @@ export declare function useRouter(config: RouterConfig): {
|
|
|
89
78
|
push: (path: string) => Promise<void>;
|
|
90
79
|
replace: (path: string) => Promise<void>;
|
|
91
80
|
back: () => void;
|
|
92
|
-
subscribe: (listener: (state: RouteState) => void) => void;
|
|
81
|
+
subscribe: (listener: (state: RouteState) => void) => () => void;
|
|
93
82
|
matchRoute: (path: string) => {
|
|
94
83
|
route: Route | null;
|
|
95
84
|
params: Record<string, string>;
|
|
@@ -112,7 +101,7 @@ export declare function initRouter(config: RouterConfig): {
|
|
|
112
101
|
push: (path: string) => Promise<void>;
|
|
113
102
|
replace: (path: string) => Promise<void>;
|
|
114
103
|
back: () => void;
|
|
115
|
-
subscribe: (listener: (state: RouteState) => void) => void;
|
|
104
|
+
subscribe: (listener: (state: RouteState) => void) => () => void;
|
|
116
105
|
matchRoute: (path: string) => {
|
|
117
106
|
route: Route | null;
|
|
118
107
|
params: Record<string, string>;
|
|
@@ -76,3 +76,18 @@ export declare function getNestedValue(obj: any, path: string): any;
|
|
|
76
76
|
* Set nested property value in object using dot notation
|
|
77
77
|
*/
|
|
78
78
|
export declare function setNestedValue(obj: any, path: string, value: any): void;
|
|
79
|
+
/**
|
|
80
|
+
* Safely unwrap reactive-like wrappers to their inner primitive when safe.
|
|
81
|
+
* Returns the original value when it's not safe to coerce to a primitive.
|
|
82
|
+
*/
|
|
83
|
+
export declare function unwrapIfPrimitive(v: any): any;
|
|
84
|
+
/**
|
|
85
|
+
* Return a serialized string for an attribute value when safe to write to DOM.
|
|
86
|
+
* Returns `null` when the value should not be written as an attribute.
|
|
87
|
+
*/
|
|
88
|
+
export declare function safeSerializeAttr(val: any): string | null;
|
|
89
|
+
/**
|
|
90
|
+
* Determine if an attribute name is class-like and should be preserved on hosts.
|
|
91
|
+
* Class-like: exactly 'class', camelCase ending with 'Class', or kebab-case ending with '-class'.
|
|
92
|
+
*/
|
|
93
|
+
export declare function isClassLikeAttr(name: string): boolean;
|
|
@@ -8,15 +8,6 @@
|
|
|
8
8
|
* @internal
|
|
9
9
|
*/
|
|
10
10
|
export declare function getNodeKey(node: Node | null | undefined): string | undefined;
|
|
11
|
-
/**
|
|
12
|
-
* Store a node key on a Node.
|
|
13
|
-
*
|
|
14
|
-
* This sets a WeakMap entry and also writes defensive DOM fallbacks for
|
|
15
|
-
* compatibility with older consumers/tests. Errors are swallowed to avoid
|
|
16
|
-
* disrupting host environments that forbid property writes.
|
|
17
|
-
*
|
|
18
|
-
* @internal
|
|
19
|
-
*/
|
|
20
11
|
export declare function setNodeKey(node: Node, key: string): void;
|
|
21
12
|
/**
|
|
22
13
|
* Retrieve transition-group metadata attached to an element.
|
package/dist/store.d.ts
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
type Listener<T> = (state: T) => void;
|
|
2
2
|
export interface Store<T extends object> {
|
|
3
|
-
|
|
3
|
+
/**
|
|
4
|
+
* Subscribe to store updates.
|
|
5
|
+
* Returns an unsubscribe function to remove the listener.
|
|
6
|
+
*/
|
|
7
|
+
subscribe(listener: Listener<T>): () => void;
|
|
4
8
|
getState(): T;
|
|
5
9
|
setState(partial: Partial<T> | ((prev: T) => Partial<T>)): void;
|
|
6
10
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jasonshimmy/custom-elements-runtime",
|
|
3
3
|
"description": "A powerful, modern, and lightweight runtime for creating reactive web components with TypeScript",
|
|
4
|
-
"version": "1.2.
|
|
4
|
+
"version": "1.2.3",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"web-components",
|
|
@@ -30,6 +30,7 @@
|
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
32
|
"@testing-library/jest-dom": "^6.8.0",
|
|
33
|
+
"@types/jsdom": "^27.0.0",
|
|
33
34
|
"@vitest/coverage-v8": "^3.2.4",
|
|
34
35
|
"cypress": "^15.0.0",
|
|
35
36
|
"jsdom": "^26.1.0",
|