@jasonshimmy/custom-elements-runtime 0.2.3 → 0.2.4

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
@@ -9,6 +9,7 @@ export * from "./directives";
9
9
  export * from "./event-bus";
10
10
  export * from "./store";
11
11
  export * from "./router";
12
+ export { renderToString } from "./runtime/vdom";
12
13
  export { component } from "./runtime/component";
13
14
  export { css } from "./runtime/style";
14
15
  export { html } from "./runtime/template-compiler";
@@ -1,4 +1,12 @@
1
1
  import type { ComponentConfig, ComponentContext } from "./types";
2
+ /**
3
+ * @internal
4
+ * Runtime registry of component configs.
5
+ * NOTE: This is an internal implementation detail. Do not import from the
6
+ * published package in consumer code — it is intended for runtime/HMR and
7
+ * internal tests only. Consumers should use the public `component` API.
8
+ */
9
+ export declare const registry: Map<string, ComponentConfig<any, any, any>>;
2
10
  export declare function component<S extends object = {}, C extends object = {}, P extends object = {}, T extends object = any>(tag: string, renderOrConfig: ((context: ComponentContext<S, C, P, T>) => any) | ComponentConfig<S, C, P, T>, config?: Partial<ComponentConfig<S, C, P, T>>): void;
3
11
  export declare function createElementClass<S extends object, C extends object, P extends object, T extends object = any>(tag: string, config: ComponentConfig<S, C, P, T>): CustomElementConstructor | {
4
12
  new (): object;
@@ -1,2 +1,10 @@
1
1
  export declare function toKebab(str: string): string;
2
2
  export declare function escapeHTML(str: string | number | boolean): string | number | boolean;
3
+ /**
4
+ * Get nested property value from object using dot notation
5
+ */
6
+ export declare function getNestedValue(obj: any, path: string): any;
7
+ /**
8
+ * Set nested property value in object using dot notation
9
+ */
10
+ export declare function setNestedValue(obj: any, path: string, value: any): void;
@@ -9,6 +9,7 @@ export declare function parseProps(str: string, values?: unknown[], context?: Re
9
9
  directives: Record<string, {
10
10
  value: string;
11
11
  modifiers: string[];
12
+ arg?: string;
12
13
  }>;
13
14
  };
14
15
  /**
@@ -11,8 +11,11 @@ export interface VNode {
11
11
  directives?: Record<string, {
12
12
  value: string;
13
13
  modifiers: string[];
14
+ arg?: string;
14
15
  }>;
15
16
  ref?: string;
17
+ /** Compiler-provided hint: whether this VNode represents a custom element (contains a dash) */
18
+ isCustomElement?: boolean;
16
19
  };
17
20
  children?: VNode[] | string;
18
21
  }
@@ -32,15 +35,15 @@ export interface WatchOptions {
32
35
  immediate?: boolean;
33
36
  deep?: boolean;
34
37
  }
35
- export type WatchCallback<T = any, S = any> = (newValue: T, oldValue: T, context?: S) => void;
38
+ export type WatchCallback<T = any, S = any> = (newValue: T, oldValue: T, context: S) => void;
36
39
  export interface WatcherState {
37
- callback: WatchCallback;
40
+ callback: WatchCallback<any, any>;
38
41
  options: WatchOptions;
39
42
  oldValue: any;
40
43
  }
41
44
  export type WatchConfig<S> = {
42
- [K in keyof S]?: WatchCallback<S[K]> | [WatchCallback<S[K]>, WatchOptions?];
43
- } | Record<string, WatchCallback | [WatchCallback, WatchOptions?]>;
45
+ [K in keyof S]?: WatchCallback<S[K], S> | [WatchCallback<S[K], S>, WatchOptions?];
46
+ } | Record<string, WatchCallback<any, S> | [WatchCallback<any, S>, WatchOptions?]>;
44
47
  type DropLast<T extends any[]> = T extends [...infer Rest, any] ? Rest : T;
45
48
  type WrapMethod<F> = F extends (...args: infer A) => infer R ? (...args: DropLast<A>) => R : never;
46
49
  export type InferMethods<T> = {
@@ -11,21 +11,6 @@ import type { VNode, VDomRefs } from "./types";
11
11
  * @returns
12
12
  */
13
13
  export declare function cleanupRefs(node: Node, refs?: VDomRefs): void;
14
- /**
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.
19
- */
20
- export declare function getNestedValue(obj: any, path: string): any;
21
- /**
22
- * Set nested property value in object using dot notation
23
- * @param obj
24
- * @param path
25
- * @param value
26
- * @returns
27
- */
28
- export declare function setNestedValue(obj: any, path: string, value: any): void;
29
14
  /**
30
15
  * Process :model directive for two-way data binding
31
16
  * @param value
@@ -37,7 +22,7 @@ export declare function setNestedValue(obj: any, path: string, value: any): void
37
22
  * @param el
38
23
  * @returns
39
24
  */
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;
25
+ export declare function processModelDirective(value: string, modifiers: string[], props: Record<string, any>, attrs: Record<string, any>, listeners: Record<string, EventListener>, context?: any, el?: HTMLElement, arg?: string): void;
41
26
  /**
42
27
  * Process :bind directive for attribute/property binding
43
28
  * @param value
@@ -82,6 +67,7 @@ export declare function processStyleDirective(value: any, attrs: Record<string,
82
67
  export declare function processDirectives(directives: Record<string, {
83
68
  value: any;
84
69
  modifiers: string[];
70
+ arg?: string;
85
71
  }>, context?: any, el?: HTMLElement, vnodeAttrs?: Record<string, any>): {
86
72
  props: Record<string, any>;
87
73
  attrs: Record<string, any>;
@@ -3,10 +3,6 @@ import type { ComponentContext, WatchCallback, WatchOptions, WatcherState } from
3
3
  * Initializes watchers for a component.
4
4
  */
5
5
  export declare function initWatchers(context: ComponentContext<any, any, any, any>, watchers: Map<string, WatcherState>, watchConfig: Record<string, WatchCallback | [WatchCallback, WatchOptions]>): void;
6
- /**
7
- * Gets a nested value from context by path.
8
- */
9
- export declare function getNestedValue(context: any, path: string): any;
10
6
  /**
11
7
  * Triggers watchers when state changes.
12
8
  */
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.2.3",
4
+ "version": "0.2.4",
5
5
  "type": "module",
6
6
  "keywords": [
7
7
  "web-components",