@jasonshimmy/custom-elements-runtime 0.1.12 → 0.1.13

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.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Custom Elements Runtime
3
3
  * Lightweight, strongly typed, functional custom element runtime for two-way binding, event, and prop support.
4
- * Supports: state, computed, props, style, render, lifecycle hooks, #model-* and data-on-* attributes.
4
+ * Supports: state, computed, props, style, render, lifecycle hooks, :model and @event attributes.
5
5
  * No external dependencies. Mobile-first, secure, and developer friendly.
6
6
  */
7
7
  export * from "./runtime/types";
@@ -12,7 +12,7 @@ export declare function parseProps(str: string, values?: unknown[], context?: Re
12
12
  }>;
13
13
  };
14
14
  /**
15
- * Internal implementation allowing an optional compile context for #model.
15
+ * Internal implementation allowing an optional compile context for :model.
16
16
  * Fixes:
17
17
  * - Recognize interpolation markers embedded in text ("World{{1}}") and replace them.
18
18
  * - Skip empty arrays from directives so markers don't leak as text.
@@ -6,35 +6,78 @@
6
6
  import type { VNode, VDomRefs } from "./types";
7
7
  /**
8
8
  * Recursively clean up refs for all descendants of a node
9
+ * @param node The node to clean up.
10
+ * @param refs The refs to clean up.
11
+ * @returns
9
12
  */
10
13
  export declare function cleanupRefs(node: Node, refs?: VDomRefs): void;
11
14
  /**
12
15
  * Get nested property value from object using dot notation
16
+ * @param obj The object to search.
17
+ * @param path The dot-separated path to the property.
18
+ * @returns The value of the nested property, or undefined if not found.
13
19
  */
14
20
  export declare function getNestedValue(obj: any, path: string): any;
15
21
  /**
16
22
  * Set nested property value in object using dot notation
23
+ * @param obj
24
+ * @param path
25
+ * @param value
26
+ * @returns
17
27
  */
18
28
  export declare function setNestedValue(obj: any, path: string, value: any): void;
19
29
  /**
20
- * Process #model directive for two-way data binding
30
+ * Process :model directive for two-way data binding
31
+ * @param value
32
+ * @param modifiers
33
+ * @param props
34
+ * @param attrs
35
+ * @param listeners
36
+ * @param context
37
+ * @param el
38
+ * @returns
21
39
  */
22
40
  export declare function processModelDirective(value: string, modifiers: string[], props: Record<string, any>, attrs: Record<string, any>, listeners: Record<string, EventListener>, context?: any, el?: HTMLElement): void;
23
41
  /**
24
- * Process #bind directive for attribute/property binding
42
+ * Process :bind directive for attribute/property binding
43
+ * @param value
44
+ * @param props
45
+ * @param attrs
46
+ * @param context
47
+ * @returns
25
48
  */
26
49
  export declare function processBindDirective(value: string, props: Record<string, any>, attrs: Record<string, any>, context?: any): void;
27
50
  /**
28
- * Process #show directive for conditional display
51
+ * Process :show directive for conditional display
52
+ * @param value
53
+ * @param attrs
54
+ * @param context
55
+ * @returns
29
56
  */
30
57
  export declare function processShowDirective(value: string, attrs: Record<string, any>, context?: any): void;
31
58
  /**
32
- * Process #class directive for conditional CSS classes
59
+ * Process :class directive for conditional CSS classes
60
+ * @param value
61
+ * @param attrs
62
+ * @param context
63
+ * @returns
33
64
  */
34
65
  export declare function processClassDirective(value: string, attrs: Record<string, any>, context?: any): void;
66
+ /**
67
+ * Process :style directive for dynamic inline styles
68
+ * @param value
69
+ * @param attrs
70
+ * @param context
71
+ * @returns
72
+ */
35
73
  export declare function processStyleDirective(value: any, attrs: Record<string, any>, context?: any): void;
36
74
  /**
37
75
  * Process directives and return merged props, attrs, and event listeners
76
+ * @param directives
77
+ * @param context
78
+ * @param el
79
+ * @param vnodeAttrs
80
+ * @returns
38
81
  */
39
82
  export declare function processDirectives(directives: Record<string, {
40
83
  value: any;
@@ -44,24 +87,61 @@ export declare function processDirectives(directives: Record<string, {
44
87
  attrs: Record<string, any>;
45
88
  listeners: Record<string, EventListener>;
46
89
  };
90
+ /**
91
+ * Assign unique keys to VNodes for efficient rendering
92
+ * @param nodeOrNodes
93
+ * @param baseKey
94
+ * @returns
95
+ */
47
96
  export declare function assignKeysDeep(nodeOrNodes: VNode | VNode[], baseKey: string): VNode | VNode[];
48
97
  /**
49
98
  * Patch props on an element.
50
99
  * Only update changed props, remove old, add new.
100
+ * @param el
101
+ * @param oldProps
102
+ * @param newProps
103
+ * @param context
51
104
  */
52
105
  export declare function patchProps(el: HTMLElement, oldProps: Record<string, any>, newProps: Record<string, any>, context?: any): void;
106
+ /**
107
+ * Create a DOM element from a VNode.
108
+ * @param vnode
109
+ * @param context
110
+ * @param refs
111
+ * @returns
112
+ */
53
113
  export declare function createElement(vnode: VNode | string, context?: any, refs?: VDomRefs): Node;
54
114
  /**
55
115
  * Patch children using keys for node matching.
116
+ * @param parent
117
+ * @param oldChildren
118
+ * @param newChildren
119
+ * @param context
120
+ * @param refs
121
+ * @returns
56
122
  */
57
123
  export declare function patchChildren(parent: HTMLElement, oldChildren: VNode[] | string | undefined, newChildren: VNode[] | string | undefined, context?: any, refs?: VDomRefs): void;
58
124
  /**
59
125
  * Patch a node using keys for node matching.
126
+ * @param dom
127
+ * @param oldVNode
128
+ * @param newVNode
129
+ * @param context
130
+ * @param refs
131
+ * @returns
60
132
  */
61
133
  export declare function patch(dom: Node, oldVNode: VNode | string | null, newVNode: VNode | string | null, context?: any, refs?: VDomRefs): Node;
62
134
  /**
63
- * Main renderer: uses patching and keys for node reuse.
64
- * Never uses innerHTML. Only updates what has changed.
135
+ * Virtual DOM renderer.
136
+ * @param root The root element to render into.
137
+ * @param vnodeOrArray The virtual node or array of virtual nodes to render.
138
+ * @param context The context to use for rendering.
139
+ * @param refs The refs to use for rendering.
65
140
  */
66
141
  export declare function vdomRenderer(root: ShadowRoot, vnodeOrArray: VNode | VNode[], context?: any, refs?: VDomRefs): void;
142
+ /**
143
+ * Render a VNode to a string.
144
+ * @param vnode The virtual node to render.
145
+ * @returns The rendered HTML string.
146
+ */
67
147
  export declare function renderToString(vnode: VNode): string;
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": "0.1.12",
4
+ "version": "0.1.13",
5
5
  "type": "module",
6
6
  "keywords": [
7
7
  "web-components",