@jasonshimmy/custom-elements-runtime 1.2.0 → 1.2.2
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 +31 -27
- package/dist/custom-elements-runtime.cjs.js.map +1 -1
- package/dist/custom-elements-runtime.es.js +2228 -1856
- package/dist/custom-elements-runtime.es.js.map +1 -1
- package/dist/custom-elements-runtime.umd.js +32 -28
- package/dist/custom-elements-runtime.umd.js.map +1 -1
- package/dist/directives.d.ts +2 -1
- package/dist/router.d.ts +3 -9
- package/dist/runtime/helpers.d.ts +15 -0
- package/dist/runtime/node-metadata.d.ts +0 -9
- package/package.json +1 -1
package/dist/directives.d.ts
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import type { VNode } from "./runtime/types";
|
|
2
2
|
export declare function when(cond: boolean, children: VNode | VNode[]): VNode;
|
|
3
|
+
export declare function when(cond: boolean, factory: () => VNode | VNode[]): VNode;
|
|
3
4
|
export declare function each<T extends string | number | boolean | {
|
|
4
5
|
id?: string | number;
|
|
5
6
|
key?: string;
|
|
6
7
|
}>(list: T[], render: (item: T, index: number) => VNode | VNode[]): VNode[];
|
|
7
8
|
export declare function match(): {
|
|
8
|
-
when(cond: any, content: VNode | VNode[]): /*elided*/ any;
|
|
9
|
+
when(cond: any, content: VNode | VNode[] | (() => VNode | VNode[])): /*elided*/ any;
|
|
9
10
|
otherwise(content: VNode | VNode[]): /*elided*/ any;
|
|
10
11
|
done(): VNode[];
|
|
11
12
|
};
|
package/dist/router.d.ts
CHANGED
|
@@ -3,11 +3,10 @@
|
|
|
3
3
|
* - Functional API, zero dependencies, SSR/static site compatible
|
|
4
4
|
* - Integrates with createStore and lib/index.ts
|
|
5
5
|
*/
|
|
6
|
-
import { type Store } from
|
|
7
|
-
export
|
|
6
|
+
import { type Store } from "./store";
|
|
7
|
+
export type RouteComponent = {
|
|
8
8
|
new (...args: any[]): any;
|
|
9
|
-
|
|
10
|
-
}
|
|
9
|
+
} | ((...args: any[]) => any);
|
|
11
10
|
export interface RouteState {
|
|
12
11
|
path: string;
|
|
13
12
|
params: Record<string, string>;
|
|
@@ -68,11 +67,6 @@ export interface RouterConfig {
|
|
|
68
67
|
base?: string;
|
|
69
68
|
initialUrl?: string;
|
|
70
69
|
}
|
|
71
|
-
export interface RouteState {
|
|
72
|
-
path: string;
|
|
73
|
-
params: Record<string, string>;
|
|
74
|
-
query: Record<string, string>;
|
|
75
|
-
}
|
|
76
70
|
export declare const parseQuery: (search: string) => Record<string, string>;
|
|
77
71
|
export declare const matchRoute: (routes: Route[], path: string) => {
|
|
78
72
|
route: Route | null;
|
|
@@ -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/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.2",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"web-components",
|