Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

excalibur-ui

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

excalibur-ui - npm Package Compare versions

Comparing version 0.0.0-3 to 0.0.0-4

dist/animation/index.d.ts

2

dist/elements/raster.d.ts
import { GraphicElement, GraphicProps } from './graphic';
export interface RasterProps<T extends RasterElement = RasterElement> extends GraphicProps<T> {
color?: ex.Raster['color'];
color?: ex.Raster['color'] | string;
strokeColor?: ex.Raster['strokeColor'];

@@ -5,0 +5,0 @@ lineCap?: ex.Raster['lineCap'];

import { BoundingBox, Entity, EntityEvents, EventEmitter, KillEvent, PointerComponent, PointerEvent, PostDebugDrawEvent, PostDrawEvent, PostKillEvent, PostTransformDrawEvent, PostUpdateEvent, PreDebugDrawEvent, PreDrawEvent, PreKillEvent, PreTransformDrawEvent, PreUpdateEvent, TransformComponent, Vector } from 'excalibur';
import { UIContainer } from '../ui-container';
import { JSXElement } from 'solid-js';
declare const _default: import(".").ElementDefinition<ViewElement, Record<string, any>>;

@@ -11,2 +12,3 @@ export default _default;

z?: number;
children?: JSXElement;
width?: number;

@@ -81,2 +83,3 @@ height?: number;

get pos(): Vector;
get globalPos(): Vector;
set pos(value: Vector);

@@ -83,0 +86,0 @@ get x(): number;

var wt = Object.defineProperty;
var yt = (t, e, i) => e in t ? wt(t, e, { enumerable: !0, configurable: !0, writable: !0, value: i }) : t[e] = i;
var w = (t, e, i) => (yt(t, typeof e != "symbol" ? e + "" : e, i), i);
import { Entity as Y, TransformComponent as ht, GraphicsComponent as lt, Vector as ft, BoundingBox as z, PointerComponent as Et, Text as xt, Color as G, Font as nt, SpriteFont as bt, Rectangle as Ct, Scene as Pt, Engine as _t } from "excalibur";
import { $PROXY as $, $TRACK as st, getListener as Z, batch as Rt, createSignal as J, mergeProps as ct, createRoot as At, createRenderEffect as R, createMemo as St, createComponent as $t, untrack as Ot, onCleanup as K } from "solid-js";
import { ErrorBoundary as me, For as we, Index as ye, Match as Ee, Show as xe, Suspense as be, SuspenseList as Ce, Switch as Pe } from "solid-js";
class M extends Y {
import { Entity as v, TransformComponent as lt, GraphicsComponent as ft, Vector as ct, BoundingBox as D, PointerComponent as Et, Text as bt, Color as J, Font as st, SpriteFont as xt, Rectangle as Ct, Scene as Pt, Engine as _t, EasingFunctions as Rt } from "excalibur";
import { $PROXY as W, $TRACK as rt, getListener as Q, batch as At, createSignal as R, mergeProps as at, createRoot as St, createRenderEffect as $, createMemo as $t, createComponent as Ot, untrack as kt, onCleanup as Z } from "solid-js";
import { ErrorBoundary as Ee, For as be, Index as xe, Match as Ce, Show as Pe, Suspense as _e, SuspenseList as Re, Switch as Ae } from "solid-js";
class X extends v {
constructor({
tag: i = "div",
id: s,
parent: o = document.body,
parent: r = document.body,
resolution: l = "scaled"

@@ -25,7 +25,7 @@ } = {}) {

if (this.htmlElement && ((i = this.engine) != null && i.canvas)) {
const { width: s, height: o, left: l, top: c, bottom: d, right: m } = this.engine.canvas.getBoundingClientRect(), y = s / this.engine.drawWidth, _ = o / this.engine.drawHeight;
this.htmlElement.style.top = `${c}px`, this.htmlElement.style.left = `${l}px`, this.htmlElement.style.bottom = `${d}px`, this.htmlElement.style.right = `${m}px`, this.htmlElement.style.overflow = "hidden", this.resolution === "scaled" ? (this.htmlElement.style.width = `${this.engine.drawWidth}px`, this.htmlElement.style.height = `${this.engine.drawHeight}px`, this.htmlElement.style.transform = `scale(${y}, ${_})`, this.htmlElement.style.transformOrigin = "0 0", this.htmlElement.style.setProperty("--px", "1px")) : (this.htmlElement.style.width = `${s}px`, this.htmlElement.style.height = `${o}px`, this.htmlElement.style.fontSize = `${y > _ ? y : _}px`, this.htmlElement.style.setProperty("--px", `${y}px`));
const { width: s, height: r, left: l, top: f, bottom: d, right: p } = this.engine.canvas.getBoundingClientRect(), y = s / this.engine.drawWidth, b = r / this.engine.drawHeight;
this.htmlElement.style.top = `${f}px`, this.htmlElement.style.left = `${l}px`, this.htmlElement.style.bottom = `${d}px`, this.htmlElement.style.right = `${p}px`, this.htmlElement.style.overflow = "hidden", this.resolution === "scaled" ? (this.htmlElement.style.width = `${this.engine.drawWidth}px`, this.htmlElement.style.height = `${this.engine.drawHeight}px`, this.htmlElement.style.transform = `scale(${y}, ${b})`, this.htmlElement.style.transformOrigin = "0 0", this.htmlElement.style.setProperty("--px", "1px")) : (this.htmlElement.style.width = `${s}px`, this.htmlElement.style.height = `${r}px`, this.htmlElement.style.fontSize = `${y > b ? y : b}px`, this.htmlElement.style.setProperty("--px", `${y}px`));
}
});
this.resolution = l, this.htmlElement = document.createElement(i), this.htmlElement.style.position = "absolute", this.htmlElement.style.pointerEvents = "none", s && (this.htmlElement.id = s), this.parentElement = o, this.parentElement.appendChild(this.htmlElement), this.transform = new ht(), this.graphics = new lt(), this.graphics.anchor = ft.Zero, this.addComponent(this.transform), this.addComponent(this.graphics), this.resizeObserver = new ResizeObserver(() => {
this.resolution = l, this.htmlElement = document.createElement(i), this.htmlElement.style.position = "absolute", this.htmlElement.style.pointerEvents = "none", s && (this.htmlElement.id = s), this.parentElement = r, this.transform = new lt(), this.graphics = new ft(), this.graphics.anchor = ct.Zero, this.addComponent(this.transform), this.addComponent(this.graphics), this.resizeObserver = new ResizeObserver(() => {
this.resizeToCanvas();

@@ -36,27 +36,22 @@ }), this.resizeObserver.observe(document.body), this.onPreUpdate = () => {

}
kill() {
var i;
this.parentElement.removeChild(this.htmlElement), this.htmlElement.remove(), (i = this.resizeObserver) == null || i.disconnect(), super.kill();
}
onInitialize(i) {
this.engine = i, this.resizeToCanvas(), this.engine.currentScene.on("activate", () => {
this.htmlElement.parentElement || this.parentElement.appendChild(this.htmlElement);
}), this.engine.currentScene.on("deactivate", () => {
var s;
(s = this.htmlElement.parentElement) == null || s.removeChild(this.htmlElement);
});
this.engine = i, this.parentElement.appendChild(this.htmlElement), this.resizeToCanvas();
}
onPreKill() {
var i;
this.htmlElement.remove(), (i = this.resizeObserver) == null || i.disconnect();
}
}
const X = Symbol("store-raw"), W = Symbol("store-node"), P = Symbol("store-has"), at = Symbol("store-self");
function gt(t) {
let e = t[$];
if (!e && (Object.defineProperty(t, $, {
value: e = new Proxy(t, kt)
const N = Symbol("store-raw"), z = Symbol("store-node"), A = Symbol("store-has"), gt = Symbol("store-self");
function ut(t) {
let e = t[W];
if (!e && (Object.defineProperty(t, W, {
value: e = new Proxy(t, Tt)
}), !Array.isArray(t))) {
const i = Object.keys(t), s = Object.getOwnPropertyDescriptors(t);
for (let o = 0, l = i.length; o < l; o++) {
const c = i[o];
s[c].get && Object.defineProperty(t, c, {
enumerable: s[c].enumerable,
get: s[c].get.bind(e)
for (let r = 0, l = i.length; r < l; r++) {
const f = i[r];
s[f].get && Object.defineProperty(t, f, {
enumerable: s[f].enumerable,
get: s[f].get.bind(e)
});

@@ -67,25 +62,25 @@ }

}
function D(t) {
function V(t) {
let e;
return t != null && typeof t == "object" && (t[$] || !(e = Object.getPrototypeOf(t)) || e === Object.prototype || Array.isArray(t));
return t != null && typeof t == "object" && (t[W] || !(e = Object.getPrototypeOf(t)) || e === Object.prototype || Array.isArray(t));
}
function T(t, e = /* @__PURE__ */ new Set()) {
let i, s, o, l;
if (i = t != null && t[X])
function U(t, e = /* @__PURE__ */ new Set()) {
let i, s, r, l;
if (i = t != null && t[N])
return i;
if (!D(t) || e.has(t))
if (!V(t) || e.has(t))
return t;
if (Array.isArray(t)) {
Object.isFrozen(t) ? t = t.slice(0) : e.add(t);
for (let c = 0, d = t.length; c < d; c++)
o = t[c], (s = T(o, e)) !== o && (t[c] = s);
for (let f = 0, d = t.length; f < d; f++)
r = t[f], (s = U(r, e)) !== r && (t[f] = s);
} else {
Object.isFrozen(t) ? t = Object.assign({}, t) : e.add(t);
const c = Object.keys(t), d = Object.getOwnPropertyDescriptors(t);
for (let m = 0, y = c.length; m < y; m++)
l = c[m], !d[l].get && (o = t[l], (s = T(o, e)) !== o && (t[l] = s));
const f = Object.keys(t), d = Object.getOwnPropertyDescriptors(t);
for (let p = 0, y = f.length; p < y; p++)
l = f[p], !d[l].get && (r = t[l], (s = U(r, e)) !== r && (t[l] = s));
}
return t;
}
function U(t, e) {
function q(t, e) {
let i = t[e];

@@ -96,41 +91,41 @@ return i || Object.defineProperty(t, e, {

}
function L(t, e, i) {
function I(t, e, i) {
if (t[e])
return t[e];
const [s, o] = J(i, {
const [s, r] = R(i, {
equals: !1,
internal: !0
});
return s.$ = o, t[e] = s;
return s.$ = r, t[e] = s;
}
function Bt(t, e) {
const i = Reflect.getOwnPropertyDescriptor(t, e);
return !i || i.get || !i.configurable || e === $ || e === W || (delete i.value, delete i.writable, i.get = () => t[$][e]), i;
return !i || i.get || !i.configurable || e === W || e === z || (delete i.value, delete i.writable, i.get = () => t[W][e]), i;
}
function ut(t) {
Z() && L(U(t, W), at)();
function dt(t) {
Q() && I(q(t, z), gt)();
}
function Wt(t) {
return ut(t), Reflect.ownKeys(t);
return dt(t), Reflect.ownKeys(t);
}
const kt = {
const Tt = {
get(t, e, i) {
if (e === X)
if (e === N)
return t;
if (e === $)
if (e === W)
return i;
if (e === st)
return ut(t), i;
const s = U(t, W), o = s[e];
let l = o ? o() : t[e];
if (e === W || e === P || e === "__proto__")
if (e === rt)
return dt(t), i;
const s = q(t, z), r = s[e];
let l = r ? r() : t[e];
if (e === z || e === A || e === "__proto__")
return l;
if (!o) {
const c = Object.getOwnPropertyDescriptor(t, e);
Z() && (typeof l != "function" || t.hasOwnProperty(e)) && !(c && c.get) && (l = L(s, e, l)());
if (!r) {
const f = Object.getOwnPropertyDescriptor(t, e);
Q() && (typeof l != "function" || t.hasOwnProperty(e)) && !(f && f.get) && (l = I(s, e, l)());
}
return D(l) ? gt(l) : l;
return V(l) ? ut(l) : l;
},
has(t, e) {
return e === X || e === $ || e === st || e === W || e === P || e === "__proto__" ? !0 : (Z() && L(U(t, P), e)(), e in t);
return e === N || e === W || e === rt || e === z || e === A || e === "__proto__" ? !0 : (Q() && I(q(t, A), e)(), e in t);
},

@@ -146,14 +141,14 @@ set() {

};
function I(t, e, i, s = !1) {
function G(t, e, i, s = !1) {
if (!s && t[e] === i)
return;
const o = t[e], l = t.length;
i === void 0 ? (delete t[e], t[P] && t[P][e] && o !== void 0 && t[P][e].$()) : (t[e] = i, t[P] && t[P][e] && o === void 0 && t[P][e].$());
let c = U(t, W), d;
if ((d = L(c, e, o)) && d.$(() => i), Array.isArray(t) && t.length !== l) {
for (let m = t.length; m < l; m++)
(d = c[m]) && d.$();
(d = L(c, "length", l)) && d.$(t.length);
const r = t[e], l = t.length;
i === void 0 ? (delete t[e], t[A] && t[A][e] && r !== void 0 && t[A][e].$()) : (t[e] = i, t[A] && t[A][e] && r === void 0 && t[A][e].$());
let f = q(t, z), d;
if ((d = I(f, e, r)) && d.$(() => i), Array.isArray(t) && t.length !== l) {
for (let p = t.length; p < l; p++)
(d = f[p]) && d.$();
(d = I(f, "length", l)) && d.$(t.length);
}
(d = c[at]) && d.$();
(d = f[gt]) && d.$();
}

@@ -163,8 +158,8 @@ function pt(t, e) {

for (let s = 0; s < i.length; s += 1) {
const o = i[s];
I(t, o, e[o]);
const r = i[s];
G(t, r, e[r]);
}
}
function zt(t, e) {
if (typeof e == "function" && (e = e(t)), e = T(e), Array.isArray(e)) {
if (typeof e == "function" && (e = e(t)), e = U(e), Array.isArray(e)) {
if (t === e)

@@ -174,48 +169,48 @@ return;

for (; i < s; i++) {
const o = e[i];
t[i] !== o && I(t, i, o);
const r = e[i];
t[i] !== r && G(t, i, r);
}
I(t, "length", s);
G(t, "length", s);
} else
pt(t, e);
}
function k(t, e, i = []) {
let s, o = t;
function H(t, e, i = []) {
let s, r = t;
if (e.length > 1) {
s = e.shift();
const c = typeof s, d = Array.isArray(t);
const f = typeof s, d = Array.isArray(t);
if (Array.isArray(s)) {
for (let m = 0; m < s.length; m++)
k(t, [s[m]].concat(e), i);
for (let p = 0; p < s.length; p++)
H(t, [s[p]].concat(e), i);
return;
} else if (d && c === "function") {
for (let m = 0; m < t.length; m++)
s(t[m], m) && k(t, [m].concat(e), i);
} else if (d && f === "function") {
for (let p = 0; p < t.length; p++)
s(t[p], p) && H(t, [p].concat(e), i);
return;
} else if (d && c === "object") {
const { from: m = 0, to: y = t.length - 1, by: _ = 1 } = s;
for (let b = m; b <= y; b += _)
k(t, [b].concat(e), i);
} else if (d && f === "object") {
const { from: p = 0, to: y = t.length - 1, by: b = 1 } = s;
for (let E = p; E <= y; E += b)
H(t, [E].concat(e), i);
return;
} else if (e.length > 1) {
k(t[s], e, [s].concat(i));
H(t[s], e, [s].concat(i));
return;
}
o = t[s], i = [s].concat(i);
r = t[s], i = [s].concat(i);
}
let l = e[0];
typeof l == "function" && (l = l(o, i), l === o) || s === void 0 && l == null || (l = T(l), s === void 0 || D(o) && D(l) && !Array.isArray(l) ? pt(o, l) : I(t, s, l));
typeof l == "function" && (l = l(r, i), l === r) || s === void 0 && l == null || (l = U(l), s === void 0 || V(r) && V(l) && !Array.isArray(l) ? pt(r, l) : G(t, s, l));
}
function Tt(...[t, e]) {
const i = T(t || {}), s = Array.isArray(i), o = gt(i);
function l(...c) {
Rt(() => {
s && c.length === 1 ? zt(i, c[0]) : k(i, c);
function Lt(...[t, e]) {
const i = U(t || {}), s = Array.isArray(i), r = ut(i);
function l(...f) {
At(() => {
s && f.length === 1 ? zt(i, f[0]) : H(i, f);
});
}
return [o, l];
return [r, l];
}
const Lt = {
const jt = {
init() {
return new Q();
return new tt();
},

@@ -229,3 +224,3 @@ applyProp(t, e, i) {

};
class Q extends Y {
class tt extends v {
constructor() {

@@ -235,3 +230,3 @@ super();

w(this, "_pointer");
w(this, "_localBounds", new z(0, 0, 0, 0));
w(this, "_localBounds", new D(0, 0, 0, 0));
w(this, "_uiContainer");

@@ -241,4 +236,4 @@ w(this, "_htmlElement", null);

w(this, "_setHtmlProps");
this._transform = new ht(), this._pointer = new Et(), this.addComponent(this._transform), this.addComponent(this._pointer);
const [i, s] = Tt({
this._transform = new lt(), this._pointer = new Et(), this.addComponent(this._transform), this.addComponent(this._pointer);
const [i, s] = Lt({
style: {

@@ -255,9 +250,9 @@ position: "absolute",

}), this.on("initialize", () => {
let o = this.parent;
for (; o; ) {
if (o instanceof M) {
this.uiContainer = o;
let r = this.parent;
for (; r; ) {
if (r instanceof X) {
this.uiContainer = r;
break;
}
o = o.parent;
r = r.parent;
}

@@ -268,3 +263,6 @@ });

var i, s;
this.events.emit("prekill"), (i = this.onPreKill) == null || i.call(this), super.kill(), this.events.emit("postkill"), (s = this.onPostKill) == null || s.call(this);
this.events.emit("prekill"), (i = this.onPreKill) == null || i.call(this), this._htmlElement && this._htmlElement.remove();
for (const r of [...this.children])
r.kill();
super.kill(), this.events.emit("postkill"), (s = this.onPostKill) == null || s.call(this);
}

@@ -292,3 +290,3 @@ onPreKill() {

const s = this.localBounds.height;
this.localBounds = new z(0, 0, i, s);
this.localBounds = new D(0, 0, i, s);
}

@@ -300,3 +298,3 @@ get height() {

const s = this.localBounds.width;
this.localBounds = new z(0, 0, s, i);
this.localBounds = new D(0, 0, s, i);
}

@@ -306,2 +304,5 @@ get pos() {

}
get globalPos() {
return this.transform.globalPos;
}
set pos(i) {

@@ -357,3 +358,3 @@ this.transform.pos = i;

return {};
const i = this.scene.engine.worldToScreenCoordinates(this.pos);
const i = this.scene.engine.worldToScreenCoordinates(this.globalPos);
return {

@@ -370,5 +371,5 @@ style: {

}
const jt = {
const Ht = {
init() {
return new N();
return new et();
},

@@ -382,3 +383,3 @@ applyProp(t, e, i) {

};
class N extends Q {
class et extends tt {
constructor() {

@@ -389,3 +390,3 @@ super();

w(this, "_height");
this._graphics = new lt(), this.graphics.anchor = ft.Zero, this.addComponent(this._graphics);
this._graphics = new ft(), this.graphics.anchor = ct.Zero, this.addComponent(this._graphics);
}

@@ -405,3 +406,3 @@ get anchor() {

set graphic(i) {
this.graphics.current && this.graphics.remove("default"), i ? (this.graphics.add("default", i), typeof this._width == "number" && (i.width = this._width), typeof this._height == "number" && (i.height = this._height), this.localBounds = new z(0, 0, i.width, i.height)) : this.localBounds = new z(0, 0, 0, 0);
this.graphics.current && this.graphics.remove("default"), i ? (this.graphics.add("default", i), typeof this._width == "number" && (i.width = this._width), typeof this._height == "number" && (i.height = this._height), this.localBounds = new D(0, 0, i.width, i.height)) : this.localBounds = new D(0, 0, 0, 0);
}

@@ -436,3 +437,3 @@ get height() {

return {};
const i = this.scene.engine.worldToScreenCoordinates(this.pos), s = super.htmlProps;
const i = this.scene.engine.worldToScreenCoordinates(this.globalPos), s = super.htmlProps;
return {

@@ -452,5 +453,5 @@ ...s,

}
const Ht = {
const Dt = {
init() {
return new Dt();
return new Ut();
},

@@ -464,5 +465,5 @@ applyProp(t, e, i) {

};
class Dt extends N {
class Ut extends et {
constructor() {
super(), this.graphic = new xt({
super(), this.graphic = new bt({
text: ""

@@ -482,3 +483,3 @@ });

set color(e) {
e && (this.graphic.color = typeof e == "string" ? G.fromHex(e) : e);
e && (this.graphic.color = typeof e == "string" ? J.fromHex(e) : e);
}

@@ -495,3 +496,3 @@ get text() {

set font(e) {
e instanceof nt || e instanceof bt ? this.graphic.font = e : e && (this.graphic.font = new nt(e), "color" in e && (this.color = e.color));
e instanceof st || e instanceof xt ? this.graphic.font = e : e && (this.graphic.font = new st(e), "color" in e && (this.color = e.color));
}

@@ -505,3 +506,3 @@ get maxWidth() {

}
class Ut extends N {
class It extends et {
get graphic() {

@@ -517,3 +518,3 @@ return this.graphics.current;

set color(e) {
e && (this.graphic.color = typeof e == "string" ? G.fromHex(e) : e);
e && (this.graphic.color = typeof e == "string" ? J.fromHex(e) : e);
}

@@ -524,3 +525,3 @@ get strokeColor() {

set strokeColor(e) {
e && (this.graphic.strokeColor = typeof e == "string" ? G.fromHex(e) : e);
e && (this.graphic.strokeColor = typeof e == "string" ? J.fromHex(e) : e);
}

@@ -552,5 +553,5 @@ get lineCap() {

}
const It = {
const Kt = {
init() {
return new Kt();
return new Ft();
},

@@ -564,3 +565,3 @@ applyProp(t, e, i) {

};
class Kt extends Ut {
class Ft extends It {
constructor() {

@@ -601,7 +602,7 @@ super(), this.graphic = new Mt({

execute(i) {
var o, l, c, d;
var r, l, f, d;
const s = [
((o = this.borderRadius) == null ? void 0 : o.topLeft) ?? 0,
((r = this.borderRadius) == null ? void 0 : r.topLeft) ?? 0,
((l = this.borderRadius) == null ? void 0 : l.topRight) ?? 0,
((c = this.borderRadius) == null ? void 0 : c.bottomRight) ?? 0,
((f = this.borderRadius) == null ? void 0 : f.bottomRight) ?? 0,
((d = this.borderRadius) == null ? void 0 : d.bottomLeft) ?? 0

@@ -618,15 +619,15 @@ ];

}
const H = {
"ex-text": Ht,
"ex-rectangle": It,
"ex-view": Lt,
"ex-graphic": jt
const M = {
"ex-text": Dt,
"ex-rectangle": Kt,
"ex-view": jt,
"ex-graphic": Ht
};
function Qt(t) {
function te(t) {
return t;
}
function Nt(t, e) {
H[t] = e;
function ee(t, e) {
M[t] = e;
}
function Ft({
function Vt({
createElement: t,

@@ -636,57 +637,57 @@ createTextNode: e,

replaceText: s,
insertNode: o,
insertNode: r,
removeNode: l,
setProperty: c,
setProperty: f,
getParentNode: d,
getFirstChild: m,
getFirstChild: p,
getNextSibling: y
}) {
function _(h, r, n, g) {
if (n !== void 0 && !g && (g = []), typeof r != "function")
return b(h, r, g, n);
R((u) => b(h, r(), u, n), g);
function b(h, o, n, g) {
if (n !== void 0 && !g && (g = []), typeof o != "function")
return E(h, o, g, n);
$((u) => E(h, o(), u, n), g);
}
function b(h, r, n, g, u) {
function E(h, o, n, g, u) {
for (; typeof n == "function"; )
n = n();
if (r === n)
if (o === n)
return n;
const p = typeof r, a = g !== void 0;
if (p === "string" || p === "number")
if (p === "number" && (r = r.toString()), a) {
let f = n[0];
f && i(f) ? s(f, r) : f = e(r), n = O(h, n, g, f);
const m = typeof o, a = g !== void 0;
if (m === "string" || m === "number")
if (m === "number" && (o = o.toString()), a) {
let c = n[0];
c && i(c) ? s(c, o) : c = e(o), n = P(h, n, g, c);
} else
n !== "" && typeof n == "string" ? s(m(h), n = r) : (O(h, n, g, e(r)), n = r);
else if (r == null || p === "boolean")
n = O(h, n, g);
n !== "" && typeof n == "string" ? s(p(h), n = o) : (P(h, n, g, e(o)), n = o);
else if (o == null || m === "boolean")
n = P(h, n, g);
else {
if (p === "function")
return R(() => {
let f = r();
for (; typeof f == "function"; )
f = f();
n = b(h, f, n, g);
if (m === "function")
return $(() => {
let c = o();
for (; typeof c == "function"; )
c = c();
n = E(h, c, n, g);
}), () => n;
if (Array.isArray(r)) {
const f = [];
if (F(f, r, u))
return R(
() => n = b(h, f, n, g, !0)
if (Array.isArray(o)) {
const c = [];
if (S(c, o, u))
return $(
() => n = E(h, c, n, g, !0)
), () => n;
if (f.length === 0) {
const B = O(h, n, g);
if (c.length === 0) {
const T = P(h, n, g);
if (a)
return n = B;
return n = T;
} else
Array.isArray(n) ? n.length === 0 ? tt(h, f, g) : v(h, n, f) : n == null || n === "" ? tt(h, f) : v(h, a && n || [m(h)], f);
n = f;
Array.isArray(n) ? n.length === 0 ? L(h, c, g) : K(h, n, c) : n == null || n === "" ? L(h, c) : K(h, a && n || [p(h)], c);
n = c;
} else {
if (Array.isArray(n)) {
if (a)
return n = O(h, n, g, r);
O(h, n, null, r);
return n = P(h, n, g, o);
P(h, n, null, o);
} else
n == null || n === "" || !m(h) ? o(h, r) : V(h, r, m(h));
n = r;
n == null || n === "" || !p(h) ? r(h, o) : j(h, o, p(h));
n = o;
}

@@ -696,16 +697,16 @@ }

}
function F(h, r, n) {
function S(h, o, n) {
let g = !1;
for (let u = 0, p = r.length; u < p; u++) {
let a = r[u], f;
for (let u = 0, m = o.length; u < m; u++) {
let a = o[u], c;
if (!(a == null || a === !0 || a === !1))
if (Array.isArray(a))
g = F(h, a) || g;
else if ((f = typeof a) == "string" || f === "number")
g = S(h, a) || g;
else if ((c = typeof a) == "string" || c === "number")
h.push(e(a));
else if (f === "function")
else if (c === "function")
if (n) {
for (; typeof a == "function"; )
a = a();
g = F(h, Array.isArray(a) ? a : [a]) || g;
g = S(h, Array.isArray(a) ? a : [a]) || g;
} else

@@ -718,85 +719,85 @@ h.push(a), g = !0;

}
function v(h, r, n) {
let g = n.length, u = r.length, p = g, a = 0, f = 0, B = y(r[u - 1]), A = null;
for (; a < u || f < p; ) {
if (r[a] === n[f]) {
a++, f++;
function K(h, o, n) {
let g = n.length, u = o.length, m = g, a = 0, c = 0, T = y(o[u - 1]), k = null;
for (; a < u || c < m; ) {
if (o[a] === n[c]) {
a++, c++;
continue;
}
for (; r[u - 1] === n[p - 1]; )
u--, p--;
for (; o[u - 1] === n[m - 1]; )
u--, m--;
if (u === a) {
const E = p < g ? f ? y(n[f - 1]) : n[p - f] : B;
for (; f < p; )
o(h, n[f++], E);
} else if (p === f)
const x = m < g ? c ? y(n[c - 1]) : n[m - c] : T;
for (; c < m; )
r(h, n[c++], x);
} else if (m === c)
for (; a < u; )
(!A || !A.has(r[a])) && l(h, r[a]), a++;
else if (r[a] === n[p - 1] && n[f] === r[u - 1]) {
const E = y(r[--u]);
o(h, n[f++], y(r[a++])), o(h, n[--p], E), r[u] = n[p];
(!k || !k.has(o[a])) && l(h, o[a]), a++;
else if (o[a] === n[m - 1] && n[c] === o[u - 1]) {
const x = y(o[--u]);
r(h, n[c++], y(o[a++])), r(h, n[--m], x), o[u] = n[m];
} else {
if (!A) {
A = /* @__PURE__ */ new Map();
let S = f;
for (; S < p; )
A.set(n[S], S++);
if (!k) {
k = /* @__PURE__ */ new Map();
let B = c;
for (; B < m; )
k.set(n[B], B++);
}
const E = A.get(r[a]);
if (E != null)
if (f < E && E < p) {
let S = a, q = 1, it;
for (; ++S < u && S < p && !((it = A.get(r[S])) == null || it !== E + q); )
q++;
if (q > E - f) {
const mt = r[a];
for (; f < E; )
o(h, n[f++], mt);
const x = k.get(o[a]);
if (x != null)
if (c < x && x < m) {
let B = a, Y = 1, nt;
for (; ++B < u && B < m && !((nt = k.get(o[B])) == null || nt !== x + Y); )
Y++;
if (Y > x - c) {
const mt = o[a];
for (; c < x; )
r(h, n[c++], mt);
} else
V(h, n[f++], r[a++]);
j(h, n[c++], o[a++]);
} else
a++;
else
l(h, r[a++]);
l(h, o[a++]);
}
}
}
function O(h, r, n, g) {
function P(h, o, n, g) {
if (n === void 0) {
let p;
for (; p = m(h); )
l(h, p);
return g && o(h, g), "";
let m;
for (; m = p(h); )
l(h, m);
return g && r(h, g), "";
}
const u = g || e("");
if (r.length) {
let p = !1;
for (let a = r.length - 1; a >= 0; a--) {
const f = r[a];
if (u !== f) {
const B = d(f) === h;
!p && !a ? B ? V(h, u, f) : o(h, u, n) : B && l(h, f);
if (o.length) {
let m = !1;
for (let a = o.length - 1; a >= 0; a--) {
const c = o[a];
if (u !== c) {
const T = d(c) === h;
!m && !a ? T ? j(h, u, c) : r(h, u, n) : T && l(h, c);
} else
p = !0;
m = !0;
}
} else
o(h, u, n);
r(h, u, n);
return [u];
}
function tt(h, r, n) {
for (let g = 0, u = r.length; g < u; g++)
o(h, r[g], n);
function L(h, o, n) {
for (let g = 0, u = o.length; g < u; g++)
r(h, o[g], n);
}
function V(h, r, n) {
o(h, r, n), l(h, n);
function j(h, o, n) {
r(h, o, n), l(h, n);
}
function et(h, r, n = {}, g) {
return r || (r = {}), g || R(
() => n.children = b(h, r.children, n.children)
), R(() => r.ref && r.ref(h)), R(() => {
for (const u in r) {
function O(h, o, n = {}, g) {
return o || (o = {}), g || $(
() => n.children = E(h, o.children, n.children)
), $(() => o.ref && o.ref(h)), $(() => {
for (const u in o) {
if (u === "children" || u === "ref")
continue;
const p = r[u];
p !== n[u] && (c(h, u, p, n[u]), n[u] = p);
const m = o[u];
m !== n[u] && (f(h, u, m, n[u]), n[u] = m);
}

@@ -806,49 +807,49 @@ }), n;

return {
render(h, r) {
render(h, o) {
let n;
return At((g) => {
n = g, _(r, h());
return St((g) => {
n = g, b(o, h());
}), n;
},
insert: _,
spread(h, r, n) {
typeof r == "function" ? R((g) => et(h, r(), g, n)) : et(h, r, void 0, n);
insert: b,
spread(h, o, n) {
typeof o == "function" ? $((g) => O(h, o(), g, n)) : O(h, o, void 0, n);
},
createElement: t,
createTextNode: e,
insertNode: o,
setProp(h, r, n, g) {
return c(h, r, n, g), n;
insertNode: r,
setProp(h, o, n, g) {
return f(h, o, n, g), n;
},
mergeProps: ct,
effect: R,
memo: St,
createComponent: $t,
use(h, r, n) {
return Ot(() => h(r, n));
mergeProps: at,
effect: $,
memo: $t,
createComponent: Ot,
use(h, o, n) {
return kt(() => h(o, n));
}
};
}
function Vt(t) {
const e = Ft(t);
return e.mergeProps = ct, e;
function qt(t) {
const e = Vt(t);
return e.mergeProps = at, e;
}
const qt = /* @__PURE__ */ new Set(["className", "textContent"]), {
render: Gt,
effect: vt,
memo: te,
createComponent: ee,
createElement: ie,
createTextNode: ne,
insertNode: se,
insert: re,
spread: oe,
setProp: he,
mergeProps: le,
use: fe
} = Vt({
const Gt = /* @__PURE__ */ new Set(["className", "textContent"]), {
render: Zt,
effect: ie,
memo: ne,
createComponent: se,
createElement: re,
createTextNode: oe,
insertNode: he,
insert: le,
spread: fe,
setProp: ce,
mergeProps: ae,
use: ge
} = qt({
createElement(t) {
if (t.startsWith("ex-"))
if (H[t]) {
const i = H[t].init();
if (M[t]) {
const i = M[t].init();
return i.__exui = { type: t }, i;

@@ -865,14 +866,14 @@ } else

replaceText(t, e) {
if (j(t))
if (F(t))
t.data = e;
else
throw x(t) ? new Error("Excalibur elements may not have text content") : new Error("Cannot replace text on non-text node");
throw C(t) ? new Error("Excalibur elements may not have text content") : new Error("Cannot replace text on non-text node");
},
setProperty(t, e, i) {
if (x(t)) {
const s = t.__exui && H[t.__exui.type];
if (C(t)) {
const s = t.__exui && M[t.__exui.type];
if (e.startsWith("on")) {
const o = e.slice(2).toLowerCase(), l = i;
"on" in t && (t.on(o, l), K(() => {
t.off(o, l);
const r = e.slice(2).toLowerCase(), l = i;
"on" in t && (t.on(r, l), Z(() => {
t.off(r, l);
}));

@@ -885,37 +886,39 @@ }

}
C(t) && (e === "style" ? Object.assign(t.style, i) : e.startsWith("on") ? t[e.toLowerCase()] = i : qt.has(e) ? t[e] = i : t.setAttribute(e, i));
_(t) && (e === "style" ? Object.assign(t.style, i) : e.startsWith("on") ? t[e.toLowerCase()] = i : Gt.has(e) ? t[e] = i : t.setAttribute(e, i));
},
insertNode(t, e, i) {
if (C(e) || j(e))
if (ot(t))
if (_(e) || F(e))
if (ht(t))
t.htmlElement.insertBefore(e, i);
else if (C(t))
else if (_(t))
t.insertBefore(e, i);
else
throw x(t) ? new Error("Cannot insert html element into excalibur element") : new Error("Unknown parent type");
else if (x(e))
if (x(t))
throw C(t) ? new Error("Cannot insert html element into excalibur element") : new Error("Unknown parent type");
else if (C(e))
if (C(t))
t.addChild(e);
else
throw C(t) ? new Error("Cannot insert excalibur element into html element") : new Error("Unknown parent type");
throw _(t) ? new Error("Cannot insert excalibur element into html element") : new Error("Unknown parent type");
},
isTextNode(t) {
return j(t);
return F(t);
},
removeNode(t, e) {
if (C(e) || j(e))
if (C(t))
if (_(e) || F(e))
if (_(t))
t.removeChild(e);
else if (ot(t))
else if (ht(t))
t.htmlElement.removeChild(e);
else
throw new Error("Unknown parent type");
else if (x(e))
if (x(t))
e.kill(), t.removeChild(e);
else if (C(e))
if (e.kill(), C(t))
t.removeChild(e);
else
throw new Error("Unknown parent type");
else
throw new Error("Unknown node type");
},
getParentNode(t) {
if (x(t)) {
if (C(t)) {
if (!t.parent)

@@ -925,3 +928,3 @@ throw new Error("No parent for node " + t);

}
if (C(t)) {
if (_(t)) {
if (!t.parentNode)

@@ -934,5 +937,5 @@ throw new Error("No parent for node " + t);

getFirstChild(t) {
if (_(t))
return t.firstChild;
if (C(t))
return t.firstChild;
if (x(t))
return t.children[0];

@@ -942,5 +945,5 @@ throw new Error("Unknown node type");

getNextSibling(t) {
if (C(t))
if (_(t))
return t.nextSibling;
if (x(t)) {
if (C(t)) {
const e = t.parent;

@@ -955,91 +958,115 @@ if (!e)

});
function ce(t, e, i) {
function ue(t, e, i) {
let s;
const [o, l] = J(!1), c = rt(t) ? t : t.scene;
c.on("predraw", () => {
o() || s && (l(!0), Gt(e, s));
const [r, l] = R(!1), f = ot(t) ? t : t.scene;
f.on("predraw", () => {
r() || s && (l(!0), Zt(e, s));
}), f.on("activate", () => {
d();
}), f.on("deactivate", () => {
s && s.kill(), l(!1);
});
const d = () => {
s = new M(i == null ? void 0 : i.html), c.add(s);
s = new X(i == null ? void 0 : i.html), f.add(s);
};
rt(t) ? (t === t.engine.currentScene && c.isInitialized ? d() : c.on("activate", () => {
d();
}), c.on("deactivate", () => {
ot(t) ? t === t.engine.currentScene && f.isInitialized && d() : Xt(t) && (t.isInitialized && d(), t.on("kill", () => {
s && s.kill(), l(!1);
})) : Zt(t) && (t.isInitialized ? d() : t.on("initialize", () => {
d();
}), t.on("kill", () => {
s && s.kill(), l(!1);
}));
}
function Zt(t) {
return t instanceof Y;
function Xt(t) {
return t instanceof v;
}
function rt(t) {
function ot(t) {
return t instanceof Pt;
}
function x(t) {
return t instanceof Q || t instanceof M;
function C(t) {
return t instanceof tt || t instanceof X;
}
function C(t) {
function _(t) {
return t instanceof HTMLElement;
}
function j(t) {
function F(t) {
return t instanceof Text;
}
function ot(t) {
return t instanceof M;
function ht(t) {
return t instanceof X;
}
function ae(t, e = {}) {
const { timing: i = "postupdate", ...s } = e, o = dt(), [l, c] = J(t(), s), d = () => c(() => t());
return o().on(i, d), K(() => {
o().off(i, d);
function de(t, e = {}) {
const { timing: i = "postupdate", ...s } = e, r = it(), [l, f] = R(t(), s), d = () => f(() => t());
return r().on(i, d), Z(() => {
r().off(i, d);
}), l;
}
function dt() {
function it() {
return () => _t.useEngine();
}
function ge(t, e) {
const i = dt();
i().on(t, e), K(() => {
function pe(t, e) {
const i = it();
i().on(t, e), Z(() => {
i().off(t, e);
});
}
function ue(t, e, i) {
t.on(e, i), K(() => {
t.off(e, i);
function Yt() {
const t = it();
return () => t().currentScene;
}
function Jt(t, e, i) {
i ?? (i = Yt()()), i.on(t, e), Z(() => {
i.off(t, e);
});
}
function me(t, e = {}) {
const [i, s] = R(e.duration ?? 300), [r, l] = R(
e.easing ?? Rt.Linear
), f = e.onStart, d = e.onComplete, [p, y] = R(t), [b, E] = R(t), [S, K] = R(t), [P, L] = R(0);
function j(O, h = {}) {
h.duration && s(h.duration), h.easing && l(() => h.easing), O !== S() && (E(p()), K(O), L(0), f == null || f());
}
return Jt("postupdate", ({ delta: O }) => {
if (p() !== S()) {
L((n) => n + O);
const o = r()(
Math.min(P(), i()),
b(),
S(),
i()
);
P() >= i() ? (y(S()), d == null || d()) : y(o);
}
}), [p, j];
}
export {
me as ErrorBoundary,
we as For,
N as GraphicElement,
ye as Index,
Ee as Match,
Kt as RectangleElement,
xe as Show,
be as Suspense,
Ce as SuspenseList,
Pe as Switch,
Dt as TextElement,
Q as ViewElement,
ee as createComponent,
ie as createElement,
Qt as createExElement,
ne as createTextNode,
vt as effect,
H as elements,
re as insert,
se as insertNode,
te as memo,
le as mergeProps,
Nt as registerExElement,
ce as renderUI,
he as setProp,
oe as spread,
fe as use,
dt as useEngine,
ge as useEngineEvent,
ue as useSceneEvent,
ae as useValue
Ee as ErrorBoundary,
be as For,
et as GraphicElement,
xe as Index,
Ce as Match,
Ft as RectangleElement,
Pe as Show,
_e as Suspense,
Re as SuspenseList,
Ae as Switch,
Ut as TextElement,
tt as ViewElement,
se as createComponent,
re as createElement,
te as createExElement,
oe as createTextNode,
ie as effect,
M as elements,
le as insert,
he as insertNode,
ne as memo,
ae as mergeProps,
ee as registerExElement,
ue as renderUI,
ce as setProp,
fe as spread,
ge as use,
Yt as useCurrentScene,
it as useEngine,
pe as useEngineEvent,
Jt as useSceneEvent,
me as useTweenedValue,
de as useValue
};

@@ -0,3 +1,3 @@

import { Engine, EngineEvents, EventKey, Handler, Scene, SceneEvents } from 'excalibur';
import { SignalOptions } from 'solid-js';
import { Engine, EngineEvents, EventKey, Handler, Scene, SceneEvents } from 'excalibur';
/**

@@ -9,4 +9,18 @@ * Returns a signal that updates every engine update

}): import("solid-js").Accessor<T>;
/**
* Returns a signal to get the current engine
*/
export declare function useEngine(): () => Engine<any>;
/**
* Listen to an engine event
*/
export declare function useEngineEvent<TEventName extends EventKey<EngineEvents>>(event: TEventName, listener: Handler<EngineEvents[TEventName]>): void;
export declare function useSceneEvent<TEventName extends EventKey<SceneEvents>>(scene: Scene, event: TEventName, listener: Handler<SceneEvents[TEventName]>): void;
/**
* Returns a signal to get the current scene
*/
export declare function useCurrentScene(): () => Scene<unknown>;
/**
* Listen to a scene event. Defaults to the current scene, but
* can be overridden
*/
export declare function useSceneEvent<TEventName extends EventKey<SceneEvents>>(event: TEventName, listener: Handler<SceneEvents[TEventName]>, scene?: Scene): void;
export * from './elements';
export * from './runtime';
export * from './hooks';
export * from './animation';

@@ -26,5 +26,5 @@ import { Entity, Engine, TransformComponent, GraphicsComponent } from 'excalibur';

});
kill(): void;
onInitialize(engine: Engine): void;
resizeToCanvas: () => void;
onPreKill(): void;
}
{
"name": "excalibur-ui",
"version": "0.0.0-3",
"version": "0.0.0-4",
"type": "module",

@@ -5,0 +5,0 @@ "author": "mattjennings",

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc