what-core 0.5.0 → 0.5.1
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/index.d.ts +1 -0
- package/package.json +1 -1
- package/render.d.ts +1 -0
- package/src/index.js +1 -1
- package/src/render.js +3 -3
package/index.d.ts
CHANGED
|
@@ -70,6 +70,7 @@ export function mapArray<T>(
|
|
|
70
70
|
options?: { key?: (item: T) => string | number; raw?: boolean },
|
|
71
71
|
): (parent: Node, marker?: Node | null) => Node;
|
|
72
72
|
export function spread(el: Element, props: Record<string, any>): void;
|
|
73
|
+
export function setProp(el: Element, key: string, value: any): void;
|
|
73
74
|
export function delegateEvents(eventNames: string[]): void;
|
|
74
75
|
export function on(el: Element, event: string, handler: (e: Event) => void): () => void;
|
|
75
76
|
export function classList(el: Element, classes: Record<string, boolean | (() => boolean)>): void;
|
package/package.json
CHANGED
package/render.d.ts
CHANGED
package/src/index.js
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
export { signal, computed, effect, memo as signalMemo, batch, untrack, flushSync, createRoot } from './reactive.js';
|
|
6
6
|
|
|
7
7
|
// Fine-grained rendering primitives
|
|
8
|
-
export { template, insert, mapArray, spread, delegateEvents, on, classList } from './render.js';
|
|
8
|
+
export { template, insert, mapArray, spread, setProp, delegateEvents, on, classList } from './render.js';
|
|
9
9
|
|
|
10
10
|
// Virtual DOM
|
|
11
11
|
export { h, Fragment, html } from './h.js';
|
package/src/render.js
CHANGED
|
@@ -693,16 +693,16 @@ export function spread(el, props) {
|
|
|
693
693
|
}
|
|
694
694
|
});
|
|
695
695
|
} else {
|
|
696
|
-
effect(() => {
|
|
696
|
+
effect(() => { setProp(el, key, value()); });
|
|
697
697
|
}
|
|
698
698
|
} else {
|
|
699
699
|
// Static prop
|
|
700
|
-
|
|
700
|
+
setProp(el, key, value);
|
|
701
701
|
}
|
|
702
702
|
}
|
|
703
703
|
}
|
|
704
704
|
|
|
705
|
-
function
|
|
705
|
+
export function setProp(el, key, value) {
|
|
706
706
|
if (key === 'class' || key === 'className') {
|
|
707
707
|
el.className = value || '';
|
|
708
708
|
} else if (key === 'dangerouslySetInnerHTML') {
|