canvasengine 2.0.0-beta.29 → 2.0.0-beta.30

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.js CHANGED
@@ -1,5 +1,5 @@
1
- import { h as a } from "./index-DQHrtntP.js";
2
- import { A as r, B as n, w as o, C as c, m as l, l as p, D as S, v as m, a5 as u, a4 as g, a2 as b, n as d, G as C, c as j, M as T, N as E, O, P as f, a3 as v, R as w, o as h, p as D, S as P, q as k, r as x, T as y, b as A, V as H, t as M, a1 as V, a0 as B, _ as G, d as N, J as R, H as q, K as U, e as z, W as I, $ as J, f as K, g as L, x as Q, j as W, i as X, y as Y, k as Z, X as _, I as $, Q as F, L as aa, Z as sa, z as ea, s as ta, U as ia, Y as ra, a as na, u as oa } from "./index-DQHrtntP.js";
1
+ import { h as a } from "./index-C-iY-lCt.js";
2
+ import { A as r, B as n, w as o, C as c, m as l, l as p, D as S, v as m, a5 as u, a4 as g, a2 as b, n as d, G as C, c as j, M as T, N as E, O, P as f, a3 as v, R as w, o as h, p as D, S as P, q as k, r as x, T as y, b as A, V as H, t as M, a1 as V, a0 as B, _ as G, d as N, J as R, H as q, K as U, e as z, W as I, $ as J, f as K, g as L, x as Q, j as W, i as X, y as Y, k as Z, X as _, I as $, Q as F, L as aa, Z as sa, z as ea, s as ta, U as ia, Y as ra, a as na, u as oa } from "./index-C-iY-lCt.js";
3
3
  const e = a.Howler;
4
4
  export {
5
5
  r as ArraySubject,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "canvasengine",
3
- "version": "2.0.0-beta.29",
3
+ "version": "2.0.0-beta.30",
4
4
  "type": "module",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -3,6 +3,7 @@ import {
3
3
  } from "rxjs";
4
4
  import type { Element } from "./reactive";
5
5
  import { Tick } from "../directives/Scheduler";
6
+ import { Container } from "../components";
6
7
 
7
8
  type MountFunction = (fn: (element: Element) => void) => void;
8
9
 
@@ -91,7 +92,7 @@ export function tick(fn: (tickValue: Tick, element: Element) => void) {
91
92
  * ```
92
93
  */
93
94
  export function h<C extends ComponentFunction<any>>(
94
- componentFunction: C,
95
+ componentFunction: C | Element,
95
96
  props: Parameters<C>[0] = {} as Parameters<C>[0],
96
97
  ...children: any[]
97
98
  ): ReturnType<C> {
@@ -110,7 +111,22 @@ export function h<C extends ComponentFunction<any>>(
110
111
  children = children[0]
111
112
  }
112
113
 
113
- let component = componentFunction({ ...props, children }) as Element;
114
+ let component: Element
115
+
116
+ if (Array.isArray(componentFunction)) {
117
+ if (componentFunction.length === 1) {
118
+ component = componentFunction[0]
119
+ }
120
+ else {
121
+ component = h(Container, {}, ...componentFunction) as Element
122
+ }
123
+ }
124
+ else if ('tag' in componentFunction) {
125
+ component = componentFunction
126
+ }
127
+ else {
128
+ component = componentFunction({ ...props, children }) as Element;
129
+ }
114
130
 
115
131
  if (!component) {
116
132
  component = {} as any