vanilla-jui 1.5.5 → 1.5.6

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.
@@ -1,6 +1,7 @@
1
1
  import { createRoot, createSignal, insert, jsx } from 'vanilla-signal';
2
2
 
3
3
  import {
4
+ asRenderable,
4
5
  type DOMReference,
5
6
  type RenderableContent,
6
7
  resolveElement,
@@ -245,7 +246,7 @@ export function createDrop(
245
246
  'aria-live': () =>
246
247
  typeof props.content === 'function' ? 'polite' : null,
247
248
  'aria-busy': () => String(loading()),
248
- children: renderContent,
249
+ children: () => asRenderable(renderContent()),
249
250
  });
250
251
  return {
251
252
  root: jsx('div', {
@@ -1,6 +1,6 @@
1
- import { jsx } from 'vanilla-signal';
1
+ import { type ElementProps, jsx } from 'vanilla-signal';
2
2
 
3
- import { type RenderableContent } from '../utilities/dom.ts';
3
+ import { asRenderable, type RenderableContent } from '../utilities/dom.ts';
4
4
  import { type ResolveSchema, resolveProps } from '../utilities/types.ts';
5
5
 
6
6
  export interface PopupProps extends Record<string, unknown> {
@@ -45,10 +45,10 @@ function normalizeProps(input: PopupProps): ResolvedPopupProps {
45
45
  export function createPopup(props: PopupProps = {}): HTMLElement {
46
46
  const { className, position, component, labelledby, content } =
47
47
  normalizeProps(props);
48
- const attrs: Record<string, unknown> = {
48
+ const attrs: ElementProps<HTMLDivElement> = {
49
49
  className: `${className} is-${position}`,
50
50
  role: 'dialog',
51
- children: content,
51
+ children: asRenderable(content),
52
52
  };
53
53
 
54
54
  if (component) {
@@ -1,3 +1,4 @@
1
+ import { type Renderable } from 'vanilla-signal';
1
2
  import {
2
3
  isDomElementValue,
3
4
  isDomNodeValue,
@@ -32,6 +33,12 @@ export type RenderableContent<TContext = unknown> =
32
33
  | readonly RenderableContent<TContext>[]
33
34
  | ((context: TContext) => RenderableContent<TContext>);
34
35
 
36
+ export function asRenderable<TContext>(
37
+ value: RenderableContent<TContext>
38
+ ): Renderable {
39
+ return value as Renderable;
40
+ }
41
+
35
42
  export interface LazyRenderOptions {
36
43
  threshold?: number | number[];
37
44
  rootMargin?: string;