canvasengine 2.0.0-beta.3 → 2.0.0-beta.31
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/DebugRenderer-DrlzuIVv.js +172 -0
- package/dist/DebugRenderer-DrlzuIVv.js.map +1 -0
- package/dist/components/Button.d.ts +136 -0
- package/dist/components/Button.d.ts.map +1 -0
- package/dist/components/Canvas.d.ts +18 -0
- package/dist/components/Canvas.d.ts.map +1 -0
- package/dist/components/Container.d.ts +80 -0
- package/dist/components/Container.d.ts.map +1 -0
- package/dist/components/DOMContainer.d.ts +77 -0
- package/dist/components/DOMContainer.d.ts.map +1 -0
- package/dist/components/DOMElement.d.ts +44 -0
- package/dist/components/DOMElement.d.ts.map +1 -0
- package/dist/components/DisplayObject.d.ts +82 -0
- package/dist/components/DisplayObject.d.ts.map +1 -0
- package/dist/components/Graphic.d.ts +65 -0
- package/dist/components/Graphic.d.ts.map +1 -0
- package/dist/components/Mesh.d.ts +202 -0
- package/dist/components/Mesh.d.ts.map +1 -0
- package/dist/components/NineSliceSprite.d.ts +17 -0
- package/dist/components/NineSliceSprite.d.ts.map +1 -0
- package/dist/components/ParticleEmitter.d.ts +5 -0
- package/dist/components/ParticleEmitter.d.ts.map +1 -0
- package/dist/components/Scene.d.ts +2 -0
- package/dist/components/Scene.d.ts.map +1 -0
- package/dist/components/Sprite.d.ts +174 -0
- package/dist/components/Sprite.d.ts.map +1 -0
- package/dist/components/Text.d.ts +21 -0
- package/dist/components/Text.d.ts.map +1 -0
- package/dist/components/TilingSprite.d.ts +18 -0
- package/dist/components/TilingSprite.d.ts.map +1 -0
- package/dist/components/Video.d.ts +15 -0
- package/dist/components/Video.d.ts.map +1 -0
- package/dist/components/Viewport.d.ts +106 -0
- package/dist/components/Viewport.d.ts.map +1 -0
- package/dist/components/index.d.ts +17 -0
- package/dist/components/index.d.ts.map +1 -0
- package/dist/components/types/DisplayObject.d.ts +106 -0
- package/dist/components/types/DisplayObject.d.ts.map +1 -0
- package/dist/components/types/MouseEvent.d.ts +4 -0
- package/dist/components/types/MouseEvent.d.ts.map +1 -0
- package/dist/components/types/Spritesheet.d.ts +366 -0
- package/dist/components/types/Spritesheet.d.ts.map +1 -0
- package/dist/components/types/index.d.ts +5 -0
- package/dist/components/types/index.d.ts.map +1 -0
- package/dist/directives/Drag.d.ts +70 -0
- package/dist/directives/Drag.d.ts.map +1 -0
- package/dist/directives/KeyboardControls.d.ts +530 -0
- package/dist/directives/KeyboardControls.d.ts.map +1 -0
- package/dist/directives/Scheduler.d.ts +36 -0
- package/dist/directives/Scheduler.d.ts.map +1 -0
- package/dist/directives/Sound.d.ts +26 -0
- package/dist/directives/Sound.d.ts.map +1 -0
- package/dist/directives/Transition.d.ts +11 -0
- package/dist/directives/Transition.d.ts.map +1 -0
- package/dist/directives/ViewportCull.d.ts +12 -0
- package/dist/directives/ViewportCull.d.ts.map +1 -0
- package/dist/directives/ViewportFollow.d.ts +19 -0
- package/dist/directives/ViewportFollow.d.ts.map +1 -0
- package/dist/directives/index.d.ts +2 -0
- package/dist/directives/index.d.ts.map +1 -0
- package/dist/engine/animation.d.ts +59 -0
- package/dist/engine/animation.d.ts.map +1 -0
- package/dist/engine/bootstrap.d.ts +16 -0
- package/dist/engine/bootstrap.d.ts.map +1 -0
- package/dist/engine/directive.d.ts +14 -0
- package/dist/engine/directive.d.ts.map +1 -0
- package/dist/engine/reactive.d.ts +95 -0
- package/dist/engine/reactive.d.ts.map +1 -0
- package/dist/engine/signal.d.ts +72 -0
- package/dist/engine/signal.d.ts.map +1 -0
- package/dist/engine/trigger.d.ts +51 -0
- package/dist/engine/trigger.d.ts.map +1 -0
- package/dist/engine/utils.d.ts +90 -0
- package/dist/engine/utils.d.ts.map +1 -0
- package/dist/hooks/addContext.d.ts +2 -0
- package/dist/hooks/addContext.d.ts.map +1 -0
- package/dist/hooks/useProps.d.ts +42 -0
- package/dist/hooks/useProps.d.ts.map +1 -0
- package/dist/hooks/useRef.d.ts +5 -0
- package/dist/hooks/useRef.d.ts.map +1 -0
- package/dist/index-DNDNQN-q.js +11088 -0
- package/dist/index-DNDNQN-q.js.map +1 -0
- package/dist/index.d.ts +15 -919
- package/dist/index.d.ts.map +1 -0
- package/dist/index.global.js +29 -0
- package/dist/index.global.js.map +1 -0
- package/dist/index.js +63 -2950
- package/dist/index.js.map +1 -1
- package/dist/utils/Ease.d.ts +17 -0
- package/dist/utils/Ease.d.ts.map +1 -0
- package/dist/utils/RadialGradient.d.ts +58 -0
- package/dist/utils/RadialGradient.d.ts.map +1 -0
- package/dist/utils/functions.d.ts +2 -0
- package/dist/utils/functions.d.ts.map +1 -0
- package/index.d.ts +4 -0
- package/package.json +12 -7
- package/src/components/Button.ts +269 -0
- package/src/components/Canvas.ts +53 -45
- package/src/components/Container.ts +2 -2
- package/src/components/DOMContainer.ts +123 -0
- package/src/components/DOMElement.ts +421 -0
- package/src/components/DisplayObject.ts +283 -190
- package/src/components/Graphic.ts +200 -34
- package/src/components/Mesh.ts +222 -0
- package/src/components/NineSliceSprite.ts +4 -1
- package/src/components/ParticleEmitter.ts +12 -8
- package/src/components/Sprite.ts +92 -22
- package/src/components/Text.ts +34 -14
- package/src/components/Video.ts +110 -0
- package/src/components/Viewport.ts +59 -43
- package/src/components/index.ts +7 -2
- package/src/components/types/DisplayObject.ts +30 -0
- package/src/directives/Drag.ts +357 -52
- package/src/directives/KeyboardControls.ts +3 -1
- package/src/directives/Sound.ts +94 -31
- package/src/directives/ViewportFollow.ts +35 -7
- package/src/engine/animation.ts +41 -5
- package/src/engine/bootstrap.ts +23 -3
- package/src/engine/directive.ts +2 -2
- package/src/engine/reactive.ts +542 -170
- package/src/engine/signal.ts +22 -2
- package/src/engine/trigger.ts +65 -9
- package/src/engine/utils.ts +97 -9
- package/src/hooks/useProps.ts +1 -1
- package/src/index.ts +4 -1
- package/src/utils/RadialGradient.ts +29 -0
- package/src/utils/functions.ts +7 -0
- package/testing/index.ts +12 -0
- package/tsconfig.json +17 -0
- package/vite.config.ts +39 -0
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
import { Bounds as F, Rectangle as C, Container as M, Graphics as x, BigPool as b } from "pixi.js";
|
|
2
|
+
import { F as _, E as p } from "./index-DNDNQN-q.js";
|
|
3
|
+
var l = /* @__PURE__ */ ((e) => (e.Margin = "margin", e.Padding = "padding", e.Border = "border", e.Flex = "flex", e.Content = "content", e))(l || {});
|
|
4
|
+
function w(e, t) {
|
|
5
|
+
const r = `getComputed${t.charAt(0).toUpperCase() + t.slice(1)}`;
|
|
6
|
+
return {
|
|
7
|
+
top: e.yoga[r](p.Top),
|
|
8
|
+
right: e.yoga[r](p.Right),
|
|
9
|
+
bottom: e.yoga[r](p.Bottom),
|
|
10
|
+
left: e.yoga[r](p.Left)
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
function B(e, t) {
|
|
14
|
+
const { width: r, height: h } = e.computedLayout, a = w(e, "margin"), i = w(e, "border"), c = w(e, "padding"), n = t.get(
|
|
15
|
+
"margin"
|
|
16
|
+
/* Margin */
|
|
17
|
+
);
|
|
18
|
+
n.outer.x = -a.left, n.outer.y = -a.top, n.outer.width = r + a.left + a.right, n.outer.height = h + a.top + a.bottom, n.inner.x = 0, n.inner.y = 0, n.inner.width = r, n.inner.height = h;
|
|
19
|
+
const o = t.get(
|
|
20
|
+
"border"
|
|
21
|
+
/* Border */
|
|
22
|
+
);
|
|
23
|
+
o.outer.x = 0, o.outer.y = 0, o.outer.width = r, o.outer.height = h, o.inner.x = i.left, o.inner.y = i.top, o.inner.width = r - i.left - i.right, o.inner.height = h - i.top - i.bottom;
|
|
24
|
+
const s = t.get(
|
|
25
|
+
"padding"
|
|
26
|
+
/* Padding */
|
|
27
|
+
);
|
|
28
|
+
s.outer.copyFrom(o.inner), s.inner.x = c.left + i.left, s.inner.y = c.top + i.top, s.inner.width = r - c.left - c.right - i.left - i.right, s.inner.height = h - c.top - c.bottom - i.top - i.bottom, E(e, t);
|
|
29
|
+
}
|
|
30
|
+
function E(e, t) {
|
|
31
|
+
var r;
|
|
32
|
+
const h = t.get(
|
|
33
|
+
"flex"
|
|
34
|
+
/* Flex */
|
|
35
|
+
), a = t.get(
|
|
36
|
+
"padding"
|
|
37
|
+
/* Padding */
|
|
38
|
+
);
|
|
39
|
+
h.outer.copyFrom(a.inner);
|
|
40
|
+
const i = new F(), c = e.yoga.getChildCount();
|
|
41
|
+
for (let o = 0; o < c; o++) {
|
|
42
|
+
const d = e.yoga.getChild(o).getComputedLayout();
|
|
43
|
+
i.addRect(
|
|
44
|
+
new C(d.left, d.top, d.width, d.height)
|
|
45
|
+
);
|
|
46
|
+
}
|
|
47
|
+
const n = e.yoga.getFlexDirection();
|
|
48
|
+
n === _.Column || n === _.ColumnReverse ? (i.width = h.outer.width, i.x = h.outer.x) : (i.height = h.outer.height, i.y = h.outer.y), (r = h.inner) == null || r.copyFrom(i.rectangle), t.get(
|
|
49
|
+
"content"
|
|
50
|
+
/* Content */
|
|
51
|
+
).outer.copyFrom(i.rectangle);
|
|
52
|
+
}
|
|
53
|
+
var O = Object.defineProperty, A = (e, t, r) => t in e ? O(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r, v = (e, t, r) => A(e, typeof t != "symbol" ? t + "" : t, r);
|
|
54
|
+
function P(e, t, r) {
|
|
55
|
+
const h = Math.round(e[0] + (t[0] - e[0]) * r), a = Math.round(e[1] + (t[1] - e[1]) * r), i = Math.round(e[2] + (t[2] - e[2]) * r);
|
|
56
|
+
return `rgb(${h},${a},${i})`;
|
|
57
|
+
}
|
|
58
|
+
class G extends M {
|
|
59
|
+
constructor() {
|
|
60
|
+
super(), v(this, "graphics"), v(this, "heatGraphics"), this.graphics = /* @__PURE__ */ new Map(), Object.values(l).forEach((t) => {
|
|
61
|
+
const r = new x();
|
|
62
|
+
this.graphics.set(t, r), this.addChild(r);
|
|
63
|
+
}), this.heatGraphics = new x(), this.addChild(this.heatGraphics);
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Initialize the debug object with region data
|
|
67
|
+
*/
|
|
68
|
+
init(t) {
|
|
69
|
+
const { target: r, alpha: h, heat: a } = t;
|
|
70
|
+
t.heatOnly || Object.entries(t).forEach(([n, o]) => {
|
|
71
|
+
if (n === "target" || n === "alpha" || n === "heat" || n === "heatOnly") return;
|
|
72
|
+
o = o;
|
|
73
|
+
const s = this.graphics.get(n);
|
|
74
|
+
if (!(!s || !o.draw))
|
|
75
|
+
if (o.inner)
|
|
76
|
+
this.drawCutBox(s, o.outer, o.inner, o.color, h);
|
|
77
|
+
else {
|
|
78
|
+
const { x: d, y: u, width: g, height: m } = o.outer;
|
|
79
|
+
s.rect(d, u, g, Math.max(m, 1)), s.fill({ color: o.color, alpha: h });
|
|
80
|
+
}
|
|
81
|
+
});
|
|
82
|
+
const { invalidationCount: i, draw: c } = a;
|
|
83
|
+
if (i > 0 && c) {
|
|
84
|
+
const o = Math.min(i / 20, 1), s = t[l.Margin], g = P([255, 255, 0], [255, 0, 0], o);
|
|
85
|
+
this.heatGraphics.rect(
|
|
86
|
+
s.outer.x,
|
|
87
|
+
s.outer.y,
|
|
88
|
+
s.outer.width,
|
|
89
|
+
s.outer.height
|
|
90
|
+
), this.heatGraphics.fill({ color: g, alpha: Math.min(0.3, o) }), this.heatGraphics.stroke({ color: g, alpha: Math.max(0.3, o), pixelLine: !0 });
|
|
91
|
+
}
|
|
92
|
+
this.position.set(r.x, r.y);
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Reset the debug object's state
|
|
96
|
+
*/
|
|
97
|
+
reset() {
|
|
98
|
+
this.graphics.forEach((t) => t.clear()), this.heatGraphics.clear(), this.removeFromParent();
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Draw a box with a cut-out center
|
|
102
|
+
*/
|
|
103
|
+
drawCutBox(t, r, h, a, i) {
|
|
104
|
+
const { x: c, y: n, width: o, height: s } = r, { x: d, y: u, width: g, height: m } = h;
|
|
105
|
+
t.rect(c, n, o, s), t.fill({ color: a, alpha: i }), t.rect(d, u, g, m), t.cut();
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
var R = Object.defineProperty, $ = (e, t, r) => t in e ? R(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r, f = (e, t, r) => $(e, typeof t != "symbol" ? t + "" : t, r);
|
|
109
|
+
class y {
|
|
110
|
+
constructor() {
|
|
111
|
+
f(this, "holder", new M()), f(this, "regions", /* @__PURE__ */ new Map()), f(this, "colors", {
|
|
112
|
+
[l.Margin]: "#B68655",
|
|
113
|
+
[l.Padding]: "#BAC57F",
|
|
114
|
+
[l.Border]: "#E7C583",
|
|
115
|
+
[l.Content]: "#89B1BE",
|
|
116
|
+
[l.Flex]: "#6E28D9"
|
|
117
|
+
}), f(this, "alpha", 0.75), Object.values(l).forEach((t) => {
|
|
118
|
+
this.regions.set(t, {
|
|
119
|
+
outer: new C(),
|
|
120
|
+
inner: new C()
|
|
121
|
+
});
|
|
122
|
+
}), this.holder.__devtoolIgnore = !0, this.holder.__devtoolIgnoreChildren = !0, this.holder.eventMode = "none", this.holder.interactiveChildren = !1;
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* Clean up previous render state
|
|
126
|
+
*/
|
|
127
|
+
reset() {
|
|
128
|
+
for (let t = this.holder.children.length - 1; t >= 0; t--) {
|
|
129
|
+
const r = this.holder.children[t];
|
|
130
|
+
b.return(r);
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* Render debug visuals for the given layout
|
|
135
|
+
*/
|
|
136
|
+
render(t) {
|
|
137
|
+
B(t, this.regions);
|
|
138
|
+
const r = Object.values(l).reduce(
|
|
139
|
+
(n, o) => {
|
|
140
|
+
const s = this.regions.get(o);
|
|
141
|
+
if (!s) return n;
|
|
142
|
+
const d = `debugDraw${o.charAt(0).toUpperCase()}${o.slice(1)}`;
|
|
143
|
+
return n[o] = {
|
|
144
|
+
...s,
|
|
145
|
+
color: this.colors[o],
|
|
146
|
+
draw: t._styles.custom[d] ?? !0
|
|
147
|
+
}, n;
|
|
148
|
+
},
|
|
149
|
+
{}
|
|
150
|
+
), { left: h, top: a } = t.computedLayout, i = t.target.getGlobalPosition(), c = b.get(G, {
|
|
151
|
+
...r,
|
|
152
|
+
target: { x: i.x + h, y: i.y + a },
|
|
153
|
+
alpha: this.alpha,
|
|
154
|
+
heat: {
|
|
155
|
+
invalidationCount: t._modificationCount,
|
|
156
|
+
draw: t._styles.custom.debugHeat !== !1
|
|
157
|
+
},
|
|
158
|
+
heatOnly: !t._styles.custom.debug
|
|
159
|
+
});
|
|
160
|
+
this.holder.addChildAt(c, 0);
|
|
161
|
+
}
|
|
162
|
+
/**
|
|
163
|
+
* Clean up the debug renderer
|
|
164
|
+
*/
|
|
165
|
+
destroy() {
|
|
166
|
+
this.reset(), this.holder.destroy(), this.regions.clear();
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
export {
|
|
170
|
+
y as DebugRenderer
|
|
171
|
+
};
|
|
172
|
+
//# sourceMappingURL=DebugRenderer-DrlzuIVv.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DebugRenderer-DrlzuIVv.js","sources":["../../../node_modules/.pnpm/@pixi+layout@3.0.2_@types+react@19.1.3_pixi.js@8.9.2_react@19.1.0_yoga-layout@3.2.1/node_modules/@pixi/layout/dist/core/debug/calculateDebugRegions.mjs","../../../node_modules/.pnpm/@pixi+layout@3.0.2_@types+react@19.1.3_pixi.js@8.9.2_react@19.1.0_yoga-layout@3.2.1/node_modules/@pixi/layout/dist/core/debug/DebugNode.mjs","../../../node_modules/.pnpm/@pixi+layout@3.0.2_@types+react@19.1.3_pixi.js@8.9.2_react@19.1.0_yoga-layout@3.2.1/node_modules/@pixi/layout/dist/core/debug/DebugRenderer.mjs"],"sourcesContent":["import { Bounds, Rectangle } from \"pixi.js\";\nimport { Edge, FlexDirection } from \"yoga-layout/load\";\nvar DebugRegionType = /* @__PURE__ */ ((DebugRegionType2) => {\n DebugRegionType2[\"Margin\"] = \"margin\";\n DebugRegionType2[\"Padding\"] = \"padding\";\n DebugRegionType2[\"Border\"] = \"border\";\n DebugRegionType2[\"Flex\"] = \"flex\";\n DebugRegionType2[\"Content\"] = \"content\";\n return DebugRegionType2;\n})(DebugRegionType || {});\nfunction getEdgeValues(layout, type) {\n const method = `getComputed${type.charAt(0).toUpperCase() + type.slice(1)}`;\n return {\n top: layout.yoga[method](Edge.Top),\n right: layout.yoga[method](Edge.Right),\n bottom: layout.yoga[method](Edge.Bottom),\n left: layout.yoga[method](Edge.Left)\n };\n}\nfunction calculateRegions(layout, regions) {\n const { width, height } = layout.computedLayout;\n const margin = getEdgeValues(layout, \"margin\");\n const border = getEdgeValues(layout, \"border\");\n const padding = getEdgeValues(layout, \"padding\");\n const marginRegion = regions.get(\n \"margin\"\n /* Margin */\n );\n marginRegion.outer.x = -margin.left;\n marginRegion.outer.y = -margin.top;\n marginRegion.outer.width = width + margin.left + margin.right;\n marginRegion.outer.height = height + margin.top + margin.bottom;\n marginRegion.inner.x = 0;\n marginRegion.inner.y = 0;\n marginRegion.inner.width = width;\n marginRegion.inner.height = height;\n const borderRegion = regions.get(\n \"border\"\n /* Border */\n );\n borderRegion.outer.x = 0;\n borderRegion.outer.y = 0;\n borderRegion.outer.width = width;\n borderRegion.outer.height = height;\n borderRegion.inner.x = border.left;\n borderRegion.inner.y = border.top;\n borderRegion.inner.width = width - border.left - border.right;\n borderRegion.inner.height = height - border.top - border.bottom;\n const paddingRegion = regions.get(\n \"padding\"\n /* Padding */\n );\n paddingRegion.outer.copyFrom(borderRegion.inner);\n paddingRegion.inner.x = padding.left + border.left;\n paddingRegion.inner.y = padding.top + border.top;\n paddingRegion.inner.width = width - padding.left - padding.right - border.left - border.right;\n paddingRegion.inner.height = height - padding.top - padding.bottom - border.top - border.bottom;\n calculateFlexRegion(layout, regions);\n}\nfunction calculateFlexRegion(layout, regions) {\n var _a;\n const flexRegion = regions.get(\n \"flex\"\n /* Flex */\n );\n const paddingRegion = regions.get(\n \"padding\"\n /* Padding */\n );\n flexRegion.outer.copyFrom(paddingRegion.inner);\n const bounds = new Bounds();\n const children = layout.yoga.getChildCount();\n for (let i = 0; i < children; i++) {\n const child = layout.yoga.getChild(i);\n const computedBounds = child.getComputedLayout();\n bounds.addRect(\n new Rectangle(computedBounds.left, computedBounds.top, computedBounds.width, computedBounds.height)\n );\n }\n const flexDir = layout.yoga.getFlexDirection();\n if (flexDir === FlexDirection.Column || flexDir === FlexDirection.ColumnReverse) {\n bounds.width = flexRegion.outer.width;\n bounds.x = flexRegion.outer.x;\n } else {\n bounds.height = flexRegion.outer.height;\n bounds.y = flexRegion.outer.y;\n }\n (_a = flexRegion.inner) == null ? void 0 : _a.copyFrom(bounds.rectangle);\n regions.get(\n \"content\"\n /* Content */\n ).outer.copyFrom(bounds.rectangle);\n}\nexport {\n DebugRegionType,\n calculateRegions\n};\n//# sourceMappingURL=calculateDebugRegions.mjs.map\n","var __defProp = Object.defineProperty;\nvar __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;\nvar __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== \"symbol\" ? key + \"\" : key, value);\nimport { Container, Graphics as Graphics$1 } from \"pixi.js\";\nimport { DebugRegionType } from \"./calculateDebugRegions.mjs\";\nfunction lerpColor(start, end, t) {\n const r = Math.round(start[0] + (end[0] - start[0]) * t);\n const g = Math.round(start[1] + (end[1] - start[1]) * t);\n const b = Math.round(start[2] + (end[2] - start[2]) * t);\n return `rgb(${r},${g},${b})`;\n}\nclass DebugNode extends Container {\n constructor() {\n super();\n /** Graphics objects for each region type */\n __publicField(this, \"graphics\");\n __publicField(this, \"heatGraphics\");\n this.graphics = /* @__PURE__ */ new Map();\n Object.values(DebugRegionType).forEach((type) => {\n const graphics = new Graphics$1();\n this.graphics.set(type, graphics);\n this.addChild(graphics);\n });\n this.heatGraphics = new Graphics$1();\n this.addChild(this.heatGraphics);\n }\n /**\n * Initialize the debug object with region data\n */\n init(regions) {\n const { target, alpha, heat } = regions;\n if (!regions.heatOnly) {\n Object.entries(regions).forEach(([type, region]) => {\n if (type === \"target\" || type === \"alpha\" || type === \"heat\" || type === \"heatOnly\") return;\n region = region;\n const graphics = this.graphics.get(type);\n if (!graphics || !region.draw) return;\n if (region.inner) {\n this.drawCutBox(graphics, region.outer, region.inner, region.color, alpha);\n } else {\n const { x, y, width, height } = region.outer;\n graphics.rect(x, y, width, Math.max(height, 1));\n graphics.fill({ color: region.color, alpha });\n }\n });\n }\n const { invalidationCount, draw } = heat;\n if (invalidationCount > 0 && draw) {\n const MAX_INVALIDATE_COUNT = 20;\n const normalizedAlpha = Math.min(invalidationCount / MAX_INVALIDATE_COUNT, 1);\n const marginRegion = regions[DebugRegionType.Margin];\n const startColor = [255, 255, 0];\n const endColor = [255, 0, 0];\n const color = lerpColor(startColor, endColor, normalizedAlpha);\n this.heatGraphics.rect(\n marginRegion.outer.x,\n marginRegion.outer.y,\n marginRegion.outer.width,\n marginRegion.outer.height\n );\n this.heatGraphics.fill({ color, alpha: Math.min(0.3, normalizedAlpha) });\n this.heatGraphics.stroke({ color, alpha: Math.max(0.3, normalizedAlpha), pixelLine: true });\n }\n this.position.set(target.x, target.y);\n }\n /**\n * Reset the debug object's state\n */\n reset() {\n this.graphics.forEach((graphics) => graphics.clear());\n this.heatGraphics.clear();\n this.removeFromParent();\n }\n /**\n * Draw a box with a cut-out center\n */\n drawCutBox(graphics, outer, inner, color, alpha) {\n const { x, y, width, height } = outer;\n const { x: innerX, y: innerY, width: innerWidth, height: innerHeight } = inner;\n graphics.rect(x, y, width, height);\n graphics.fill({ color, alpha });\n graphics.rect(innerX, innerY, innerWidth, innerHeight);\n graphics.cut();\n }\n}\nexport {\n DebugNode\n};\n//# sourceMappingURL=DebugNode.mjs.map\n","var __defProp = Object.defineProperty;\nvar __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;\nvar __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== \"symbol\" ? key + \"\" : key, value);\nimport { Container, Rectangle, BigPool } from \"pixi.js\";\nimport { DebugRegionType, calculateRegions } from \"./calculateDebugRegions.mjs\";\nimport { DebugNode } from \"./DebugNode.mjs\";\nclass DebugRenderer {\n constructor() {\n /** Container for all debug visuals */\n __publicField(this, \"holder\", new Container());\n /** Region data for each debug type */\n __publicField(this, \"regions\", /* @__PURE__ */ new Map());\n /** Color configuration for each region type */\n __publicField(this, \"colors\", {\n [DebugRegionType.Margin]: \"#B68655\",\n [DebugRegionType.Padding]: \"#BAC57F\",\n [DebugRegionType.Border]: \"#E7C583\",\n [DebugRegionType.Content]: \"#89B1BE\",\n [DebugRegionType.Flex]: \"#6E28D9\"\n });\n /** Global alpha value for all regions */\n __publicField(this, \"alpha\", 0.75);\n Object.values(DebugRegionType).forEach((type) => {\n this.regions.set(type, {\n outer: new Rectangle(),\n inner: new Rectangle()\n });\n });\n this.holder.__devtoolIgnore = true;\n this.holder.__devtoolIgnoreChildren = true;\n this.holder.eventMode = \"none\";\n this.holder.interactiveChildren = false;\n }\n /**\n * Clean up previous render state\n */\n reset() {\n for (let i = this.holder.children.length - 1; i >= 0; i--) {\n const child = this.holder.children[i];\n BigPool.return(child);\n }\n }\n /**\n * Render debug visuals for the given layout\n */\n render(layout) {\n calculateRegions(layout, this.regions);\n const regionData = Object.values(DebugRegionType).reduce(\n (acc, type) => {\n const region = this.regions.get(type);\n if (!region) return acc;\n const drawString = `debugDraw${type.charAt(0).toUpperCase()}${type.slice(1)}`;\n acc[type] = {\n ...region,\n color: this.colors[type],\n draw: layout._styles.custom[drawString] ?? true\n };\n return acc;\n },\n {}\n );\n const { left, top } = layout.computedLayout;\n const pos = layout.target.getGlobalPosition();\n const debugObject = BigPool.get(DebugNode, {\n ...regionData,\n target: { x: pos.x + left, y: pos.y + top },\n alpha: this.alpha,\n heat: {\n invalidationCount: layout._modificationCount,\n draw: layout._styles.custom.debugHeat !== false\n },\n heatOnly: !layout._styles.custom.debug\n });\n this.holder.addChildAt(debugObject, 0);\n }\n /**\n * Clean up the debug renderer\n */\n destroy() {\n this.reset();\n this.holder.destroy();\n this.regions.clear();\n }\n}\nexport {\n DebugRenderer\n};\n//# sourceMappingURL=DebugRenderer.mjs.map\n"],"names":["DebugRegionType","DebugRegionType2","getEdgeValues","layout","type","method","Edge","calculateRegions","regions","width","height","margin","border","padding","marginRegion","borderRegion","paddingRegion","calculateFlexRegion","_a","flexRegion","bounds","Bounds","children","i","computedBounds","Rectangle","flexDir","FlexDirection","__defProp","__defNormalProp","obj","key","value","__publicField","lerpColor","start","end","t","r","g","b","DebugNode","Container","graphics","Graphics$1","target","alpha","heat","region","x","y","invalidationCount","draw","normalizedAlpha","color","outer","inner","innerX","innerY","innerWidth","innerHeight","DebugRenderer","child","BigPool","regionData","acc","drawString","left","top","pos","debugObject"],"mappings":";;AAEA,IAAIA,IAAmC,kBAACC,OACtCA,EAAiB,SAAY,UAC7BA,EAAiB,UAAa,WAC9BA,EAAiB,SAAY,UAC7BA,EAAiB,OAAU,QAC3BA,EAAiB,UAAa,WACvBA,IACND,KAAmB,CAAA,CAAE;AACxB,SAASE,EAAcC,GAAQC,GAAM;AACnC,QAAMC,IAAS,cAAcD,EAAK,OAAO,CAAC,EAAE,YAAa,IAAGA,EAAK,MAAM,CAAC,CAAC;AACzE,SAAO;AAAA,IACL,KAAKD,EAAO,KAAKE,CAAM,EAAEC,EAAK,GAAG;AAAA,IACjC,OAAOH,EAAO,KAAKE,CAAM,EAAEC,EAAK,KAAK;AAAA,IACrC,QAAQH,EAAO,KAAKE,CAAM,EAAEC,EAAK,MAAM;AAAA,IACvC,MAAMH,EAAO,KAAKE,CAAM,EAAEC,EAAK,IAAI;AAAA,EACpC;AACH;AACA,SAASC,EAAiBJ,GAAQK,GAAS;AACzC,QAAM,EAAE,OA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OAAO,QAAS,GACrB,KAAK,QAAQ,MAAO;AAAA,EACxB;AACA;","x_google_ignoreList":[0,1,2]}
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
import { FederatedPointerEvent } from 'pixi.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Button states for visual feedback
|
|
5
|
+
*/
|
|
6
|
+
export declare enum ButtonState {
|
|
7
|
+
Normal = "normal",
|
|
8
|
+
Hover = "hover",
|
|
9
|
+
Pressed = "pressed",
|
|
10
|
+
Disabled = "disabled"
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Button style configuration for different visual approaches
|
|
14
|
+
*/
|
|
15
|
+
export interface ButtonStyle {
|
|
16
|
+
/** Background color for each state */
|
|
17
|
+
backgroundColor?: {
|
|
18
|
+
[ButtonState.Normal]?: string;
|
|
19
|
+
[ButtonState.Hover]?: string;
|
|
20
|
+
[ButtonState.Pressed]?: string;
|
|
21
|
+
[ButtonState.Disabled]?: string;
|
|
22
|
+
};
|
|
23
|
+
/** Border configuration */
|
|
24
|
+
border?: {
|
|
25
|
+
color?: string;
|
|
26
|
+
width?: number;
|
|
27
|
+
radius?: number;
|
|
28
|
+
};
|
|
29
|
+
/** Text styling */
|
|
30
|
+
text?: {
|
|
31
|
+
color?: string;
|
|
32
|
+
fontSize?: number;
|
|
33
|
+
fontFamily?: string;
|
|
34
|
+
};
|
|
35
|
+
/** Sprite textures for each state (alternative to backgroundColor) */
|
|
36
|
+
textures?: {
|
|
37
|
+
[ButtonState.Normal]?: string;
|
|
38
|
+
[ButtonState.Hover]?: string;
|
|
39
|
+
[ButtonState.Pressed]?: string;
|
|
40
|
+
[ButtonState.Disabled]?: string;
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Properties for the Button component
|
|
45
|
+
*/
|
|
46
|
+
export interface ButtonProps {
|
|
47
|
+
/** Button text content */
|
|
48
|
+
text?: string;
|
|
49
|
+
/** Button disabled state */
|
|
50
|
+
disabled?: boolean;
|
|
51
|
+
/** Click event handler */
|
|
52
|
+
click?: (event: FederatedPointerEvent) => void;
|
|
53
|
+
/** Hover enter event handler */
|
|
54
|
+
hoverEnter?: (event: FederatedPointerEvent) => void;
|
|
55
|
+
/** Hover leave event handler */
|
|
56
|
+
hoverLeave?: (event: FederatedPointerEvent) => void;
|
|
57
|
+
/** Press down event handler */
|
|
58
|
+
pressDown?: (event: FederatedPointerEvent) => void;
|
|
59
|
+
/** Press up event handler */
|
|
60
|
+
pressUp?: (event: FederatedPointerEvent) => void;
|
|
61
|
+
/** Visual style configuration */
|
|
62
|
+
style?: ButtonStyle;
|
|
63
|
+
/** Button width */
|
|
64
|
+
width?: number;
|
|
65
|
+
/** Button height */
|
|
66
|
+
height?: number;
|
|
67
|
+
/** Button position X */
|
|
68
|
+
x?: number;
|
|
69
|
+
/** Button position Y */
|
|
70
|
+
y?: number;
|
|
71
|
+
/** Button alpha/opacity */
|
|
72
|
+
alpha?: number;
|
|
73
|
+
/** Button visibility */
|
|
74
|
+
visible?: boolean;
|
|
75
|
+
/** Button cursor */
|
|
76
|
+
cursor?: string;
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Creates a Button component with interactive states and customizable styling.
|
|
80
|
+
*
|
|
81
|
+
* This component provides a fully interactive button with visual feedback
|
|
82
|
+
* for different states (normal, hover, pressed, disabled). It supports both
|
|
83
|
+
* sprite-based and graphics-based rendering approaches.
|
|
84
|
+
*
|
|
85
|
+
* The button is built using a Container with background and text elements,
|
|
86
|
+
* providing reactive state management and event handling.
|
|
87
|
+
*
|
|
88
|
+
* @param props - Button configuration including text, styling, and event handlers
|
|
89
|
+
* @returns A reactive Button component
|
|
90
|
+
* @example
|
|
91
|
+
* ```typescript
|
|
92
|
+
* // Simple button with text and click handler
|
|
93
|
+
* const simpleButton = Button({
|
|
94
|
+
* text: "Click Me",
|
|
95
|
+
* onClick: () => console.log("Button clicked!"),
|
|
96
|
+
* width: 150,
|
|
97
|
+
* height: 50
|
|
98
|
+
* });
|
|
99
|
+
*
|
|
100
|
+
* // Styled button with custom colors
|
|
101
|
+
* const styledButton = Button({
|
|
102
|
+
* text: "Styled Button",
|
|
103
|
+
* style: {
|
|
104
|
+
* backgroundColor: {
|
|
105
|
+
* normal: "#28a745",
|
|
106
|
+
* hover: "#218838",
|
|
107
|
+
* pressed: "#1e7e34",
|
|
108
|
+
* disabled: "#6c757d"
|
|
109
|
+
* },
|
|
110
|
+
* border: {
|
|
111
|
+
* radius: 8,
|
|
112
|
+
* width: 2,
|
|
113
|
+
* color: "#ffffff"
|
|
114
|
+
* },
|
|
115
|
+
* text: {
|
|
116
|
+
* fontSize: 18,
|
|
117
|
+
* color: "#ffffff"
|
|
118
|
+
* }
|
|
119
|
+
* }
|
|
120
|
+
* });
|
|
121
|
+
*
|
|
122
|
+
* // Sprite-based button
|
|
123
|
+
* const spriteButton = Button({
|
|
124
|
+
* text: "Play Game",
|
|
125
|
+
* style: {
|
|
126
|
+
* textures: {
|
|
127
|
+
* normal: "/assets/button-normal.png",
|
|
128
|
+
* hover: "/assets/button-hover.png",
|
|
129
|
+
* pressed: "/assets/button-pressed.png"
|
|
130
|
+
* }
|
|
131
|
+
* }
|
|
132
|
+
* });
|
|
133
|
+
* ```
|
|
134
|
+
*/
|
|
135
|
+
export declare function Button(props: ButtonProps): import('..').Element<import('./DisplayObject').ComponentInstance> | Promise<import('..').Element<import('./DisplayObject').ComponentInstance>>;
|
|
136
|
+
//# sourceMappingURL=Button.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Button.d.ts","sourceRoot":"","sources":["../../src/components/Button.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAC;AAOhD;;GAEG;AACH,oBAAY,WAAW;IACrB,MAAM,WAAW;IACjB,KAAK,UAAU;IACf,OAAO,YAAY;IACnB,QAAQ,aAAa;CACtB;AAED;;GAEG;AACH,MAAM,WAAW,W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gC;IAChC,UAAU,CAAC,EAAE,CAAC,KAAK,EAAE,qBAAqB,KAAK,IAAI,CAAC;IACpD,+BAA+B;IAC/B,SAAS,CAAC,EAAE,CAAC,KAAK,EAAE,qBAAqB,KAAK,IAAI,CAAC;IACnD,6BAA6B;IAC7B,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,qBAAqB,KAAK,IAAI,CAAC;IACjD,iCAAiC;IACjC,KAAK,CAAC,EAAE,WAAW,CAAC;IACpB,mBAAmB;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,oBAAoB;IACpB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,wBAAwB;IACxB,CAAC,CAAC,EAAE,MAAM,CAAC;IACX,wBAAwB;IACxB,CAAC,CAAC,EAAE,MAAM,CAAC;IACX,2BAA2B;IAC3B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,wBAAwB;IACxB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,oBAAoB;IACpB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwDG;AACH,wBAAgB,MAAM,CAAC,KAAK,EAAE,WAAW,kJA6HxC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Props } from '../engine/reactive';
|
|
2
|
+
import { ComponentFunction } from '../engine/signal';
|
|
3
|
+
import { SignalOrPrimitive } from './types';
|
|
4
|
+
import { Size } from './types/DisplayObject';
|
|
5
|
+
|
|
6
|
+
export interface CanvasProps extends Props {
|
|
7
|
+
cursorStyles?: () => any;
|
|
8
|
+
width?: SignalOrPrimitive<Size>;
|
|
9
|
+
height?: SignalOrPrimitive<Size>;
|
|
10
|
+
canvasEl?: HTMLElement;
|
|
11
|
+
selector?: string;
|
|
12
|
+
isRoot?: boolean;
|
|
13
|
+
tick?: any;
|
|
14
|
+
class?: SignalOrPrimitive<string>;
|
|
15
|
+
background?: string;
|
|
16
|
+
}
|
|
17
|
+
export declare const Canvas: ComponentFunction<CanvasProps>;
|
|
18
|
+
//# sourceMappingURL=Canvas.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Canvas.d.ts","sourceRoot":"","sources":["../../src/components/Canvas.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,KAAK,EAIN,MAAM,oBAAoB,CAAC;AAG5B,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAC5C,OAAO,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAC;AAe7C,MAAM,WAAW,WAAY,SAAQ,KAAK;IACxC,YAAY,CAAC,EAAE,MAAM,GAAG,CAAC;IACzB,KAAK,CAAC,EAAE,iBAAiB,CAAC,IAAI,CAAC,CAAC;IAChC,MAAM,CAAC,EAAE,iBAAiB,CAAC,IAAI,CAAC,CAAC;IACjC,QAAQ,CAAC,EAAE,WAAW,CAAC;IACvB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,IAAI,CAAC,EAAE,GAAG,CAAC;IACX,KAAK,CAAC,EAAE,iBAAiB,CAAC,MAAM,CAAC,CAAC;IAClC,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,eAAO,MAAM,MAAM,EAAE,iBAAiB,CAAC,WAAW,CAsGjD,CAAC"}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { ComponentFunction } from '../engine/signal';
|
|
2
|
+
import { DisplayObjectProps } from './types/DisplayObject';
|
|
3
|
+
|
|
4
|
+
interface ContainerProps extends DisplayObjectProps {
|
|
5
|
+
sortableChildren?: boolean;
|
|
6
|
+
}
|
|
7
|
+
declare const CanvasContainer_base: {
|
|
8
|
+
new (): {
|
|
9
|
+
[x: string]: any;
|
|
10
|
+
"__#1@#canvasContext": {
|
|
11
|
+
[key: string]: any;
|
|
12
|
+
} | null;
|
|
13
|
+
isFlex: boolean;
|
|
14
|
+
fullProps: import('..').Props;
|
|
15
|
+
isMounted: boolean;
|
|
16
|
+
_anchorPoints: import('pixi.js').ObservablePoint;
|
|
17
|
+
isCustomAnchor: boolean;
|
|
18
|
+
displayWidth: import('@signe/reactive').WritableSignal<number>;
|
|
19
|
+
displayHeight: import('@signe/reactive').WritableSignal<number>;
|
|
20
|
+
overrideProps: string[];
|
|
21
|
+
layout: any;
|
|
22
|
+
onBeforeDestroy: import('./DisplayObject').OnHook | null;
|
|
23
|
+
onAfterMount: import('./DisplayObject').OnHook | null;
|
|
24
|
+
subjectInit: import('rxjs').BehaviorSubject<any>;
|
|
25
|
+
disableLayout: boolean;
|
|
26
|
+
"__#1@#registeredEvents": Map<string, Function>;
|
|
27
|
+
readonly deltaRatio: any;
|
|
28
|
+
readonly parentIsFlex: any;
|
|
29
|
+
onInit(props: import('..').Props): void;
|
|
30
|
+
onMount({ parent, props }: import('..').Element</*elided*/ any>, index?: number): Promise<void>;
|
|
31
|
+
onUpdate(props: import('..').Props): void;
|
|
32
|
+
onDestroy(parent: import('..').Element, afterDestroy?: () => void): Promise<void>;
|
|
33
|
+
setFlexDirection(direction: import('./types/DisplayObject').FlexDirection): void;
|
|
34
|
+
setFlexWrap(wrap: "wrap" | "nowrap" | "wrap-reverse"): void;
|
|
35
|
+
setAlignContent(align: import('./types/DisplayObject').AlignContent): void;
|
|
36
|
+
setAlignSelf(align: import('./types/DisplayObject').AlignContent): void;
|
|
37
|
+
setAlignItems(align: import('./types/DisplayObject').AlignContent): void;
|
|
38
|
+
setJustifyContent(justifyContent: "flex-start" | "flex-end" | "center" | "space-between" | "space-around"): void;
|
|
39
|
+
setPosition(position: import('./types/DisplayObject').EdgeSize): void;
|
|
40
|
+
setX(x: number): void;
|
|
41
|
+
setY(y: number): void;
|
|
42
|
+
setPadding(padding: import('./types/DisplayObject').EdgeSize): void;
|
|
43
|
+
setMargin(margin: import('./types/DisplayObject').EdgeSize): void;
|
|
44
|
+
setGap(gap: import('./types/DisplayObject').EdgeSize): void;
|
|
45
|
+
setBorder(border: import('./types/DisplayObject').EdgeSize): void;
|
|
46
|
+
setPositionType(positionType: "relative" | "absolute"): void;
|
|
47
|
+
setWidth(width: number): void;
|
|
48
|
+
setHeight(height: number): void;
|
|
49
|
+
getWidth(): number;
|
|
50
|
+
getHeight(): number;
|
|
51
|
+
setMinWidth(minWidth: number | string): void;
|
|
52
|
+
setMinHeight(minHeight: number | string): void;
|
|
53
|
+
setMaxWidth(maxWidth: number | string): void;
|
|
54
|
+
setMaxHeight(maxHeight: number | string): void;
|
|
55
|
+
setAspectRatio(aspectRatio: number): void;
|
|
56
|
+
setFlexGrow(flexGrow: number): void;
|
|
57
|
+
setFlexShrink(flexShrink: number): void;
|
|
58
|
+
setFlexBasis(flexBasis: number | string): void;
|
|
59
|
+
setRowGap(rowGap: number): void;
|
|
60
|
+
setColumnGap(columnGap: number): void;
|
|
61
|
+
setTop(top: number | string): void;
|
|
62
|
+
setLeft(left: number | string): void;
|
|
63
|
+
setRight(right: number | string): void;
|
|
64
|
+
setBottom(bottom: number | string): void;
|
|
65
|
+
setObjectFit(objectFit: import('./types/DisplayObject').ObjectFit): void;
|
|
66
|
+
setObjectPosition(objectPosition: import('./types/DisplayObject').ObjectPosition): void;
|
|
67
|
+
setTransformOrigin(transformOrigin: import('./types/DisplayObject').TransformOrigin): void;
|
|
68
|
+
};
|
|
69
|
+
[x: string]: any;
|
|
70
|
+
};
|
|
71
|
+
export declare class CanvasContainer extends CanvasContainer_base {
|
|
72
|
+
isCustomAnchor: boolean;
|
|
73
|
+
onUpdate(props: any): void;
|
|
74
|
+
onMount(args: any): Promise<void>;
|
|
75
|
+
}
|
|
76
|
+
export interface CanvasContainer extends DisplayObjectProps {
|
|
77
|
+
}
|
|
78
|
+
export declare const Container: ComponentFunction<ContainerProps>;
|
|
79
|
+
export {};
|
|
80
|
+
//# sourceMappingURL=Container.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Container.d.ts","sourceRoot":"","sources":["../../src/components/Container.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAG3D,UAAU,cAAe,SAAQ,kBAAkB;IACjD,gBAAgB,CAAC,EAAE,OAAO,CAAC;CAC5B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAED,qBAAa,eAAgB,SAAQ,oBAA4B;IAC/D,cAAc,UAAQ;IAEtB,QAAQ,CAAC,KAAK,KAAA;IAaR,OAAO,CAAC,IAAI,KAAA;CAUnB;AAED,MAAM,WAAW,eAAgB,SAAQ,kBAAkB;CAAG;AAI9D,eAAO,MAAM,SAAS,EAAE,iBAAiB,CAAC,cAAc,CAEvD,CAAC"}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { Element } from '../engine/reactive';
|
|
2
|
+
import { ComponentFunction } from '../engine/signal';
|
|
3
|
+
import { DisplayObjectProps } from './types/DisplayObject';
|
|
4
|
+
|
|
5
|
+
declare const CanvasDOMContainer_base: {
|
|
6
|
+
new (): {
|
|
7
|
+
[x: string]: any;
|
|
8
|
+
"__#1@#canvasContext": {
|
|
9
|
+
[key: string]: any;
|
|
10
|
+
} | null;
|
|
11
|
+
isFlex: boolean;
|
|
12
|
+
fullProps: import('..').Props;
|
|
13
|
+
isMounted: boolean;
|
|
14
|
+
_anchorPoints: import('pixi.js').ObservablePoint;
|
|
15
|
+
isCustomAnchor: boolean;
|
|
16
|
+
displayWidth: import('@signe/reactive').WritableSignal<number>;
|
|
17
|
+
displayHeight: import('@signe/reactive').WritableSignal<number>;
|
|
18
|
+
overrideProps: string[];
|
|
19
|
+
layout: any;
|
|
20
|
+
onBeforeDestroy: import('./DisplayObject').OnHook | null;
|
|
21
|
+
onAfterMount: import('./DisplayObject').OnHook | null;
|
|
22
|
+
subjectInit: import('rxjs').BehaviorSubject<any>;
|
|
23
|
+
disableLayout: boolean;
|
|
24
|
+
"__#1@#registeredEvents": Map<string, Function>;
|
|
25
|
+
readonly deltaRatio: any;
|
|
26
|
+
readonly parentIsFlex: any;
|
|
27
|
+
onInit(props: import('..').Props): void;
|
|
28
|
+
onMount({ parent, props }: Element</*elided*/ any>, index?: number): Promise<void>;
|
|
29
|
+
onUpdate(props: import('..').Props): void;
|
|
30
|
+
onDestroy(parent: Element, afterDestroy?: () => void): Promise<void>;
|
|
31
|
+
setFlexDirection(direction: import('./types/DisplayObject').FlexDirection): void;
|
|
32
|
+
setFlexWrap(wrap: "wrap" | "nowrap" | "wrap-reverse"): void;
|
|
33
|
+
setAlignContent(align: import('./types/DisplayObject').AlignContent): void;
|
|
34
|
+
setAlignSelf(align: import('./types/DisplayObject').AlignContent): void;
|
|
35
|
+
setAlignItems(align: import('./types/DisplayObject').AlignContent): void;
|
|
36
|
+
setJustifyContent(justifyContent: "flex-start" | "flex-end" | "center" | "space-between" | "space-around"): void;
|
|
37
|
+
setPosition(position: import('./types/DisplayObject').EdgeSize): void;
|
|
38
|
+
setX(x: number): void;
|
|
39
|
+
setY(y: number): void;
|
|
40
|
+
setPadding(padding: import('./types/DisplayObject').EdgeSize): void;
|
|
41
|
+
setMargin(margin: import('./types/DisplayObject').EdgeSize): void;
|
|
42
|
+
setGap(gap: import('./types/DisplayObject').EdgeSize): void;
|
|
43
|
+
setBorder(border: import('./types/DisplayObject').EdgeSize): void;
|
|
44
|
+
setPositionType(positionType: "relative" | "absolute"): void;
|
|
45
|
+
setWidth(width: number): void;
|
|
46
|
+
setHeight(height: number): void;
|
|
47
|
+
getWidth(): number;
|
|
48
|
+
getHeight(): number;
|
|
49
|
+
setMinWidth(minWidth: number | string): void;
|
|
50
|
+
setMinHeight(minHeight: number | string): void;
|
|
51
|
+
setMaxWidth(maxWidth: number | string): void;
|
|
52
|
+
setMaxHeight(maxHeight: number | string): void;
|
|
53
|
+
setAspectRatio(aspectRatio: number): void;
|
|
54
|
+
setFlexGrow(flexGrow: number): void;
|
|
55
|
+
setFlexShrink(flexShrink: number): void;
|
|
56
|
+
setFlexBasis(flexBasis: number | string): void;
|
|
57
|
+
setRowGap(rowGap: number): void;
|
|
58
|
+
setColumnGap(columnGap: number): void;
|
|
59
|
+
setTop(top: number | string): void;
|
|
60
|
+
setLeft(left: number | string): void;
|
|
61
|
+
setRight(right: number | string): void;
|
|
62
|
+
setBottom(bottom: number | string): void;
|
|
63
|
+
setObjectFit(objectFit: import('./types/DisplayObject').ObjectFit): void;
|
|
64
|
+
setObjectPosition(objectPosition: import('./types/DisplayObject').ObjectPosition): void;
|
|
65
|
+
setTransformOrigin(transformOrigin: import('./types/DisplayObject').TransformOrigin): void;
|
|
66
|
+
};
|
|
67
|
+
[x: string]: any;
|
|
68
|
+
};
|
|
69
|
+
export declare class CanvasDOMContainer extends CanvasDOMContainer_base {
|
|
70
|
+
disableLayout: boolean;
|
|
71
|
+
onInit(props: any): void;
|
|
72
|
+
}
|
|
73
|
+
export interface CanvasDOMContainer extends DisplayObjectProps {
|
|
74
|
+
}
|
|
75
|
+
export declare const DOMContainer: ComponentFunction<any>;
|
|
76
|
+
export {};
|
|
77
|
+
//# sourceMappingURL=DOMContainer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DOMContainer.d.ts","sourceRoot":"","sources":["../../src/components/DOMContainer.ts"],"names":[],"mappings":"AACA,OAAO,EAEL,OAAO,EAER,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EAAE,iBAAiB,EAAK,MAAM,kBAAkB,CAAC;AACxD,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmG3D,qBAAa,kBAAmB,SAAQ,uBAA+B;IACrE,aAAa,UAAQ;IAErB,MAAM,CAAC,KAAK,EAAE,GAAG;CAIlB;AAED,MAAM,WAAW,kBAAmB,SAAQ,kBAAkB;CAAG;AAIjE,eAAO,MAAM,YAAY,EAAE,iBAAiB,CAAC,GAAG,CAE/C,CAAC"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { Element } from '../engine/reactive';
|
|
2
|
+
import { OnHook } from './DisplayObject';
|
|
3
|
+
import { ComponentFunction } from '../engine/signal';
|
|
4
|
+
import { DisplayObjectProps } from './types/DisplayObject';
|
|
5
|
+
|
|
6
|
+
interface DOMContainerProps extends DisplayObjectProps {
|
|
7
|
+
element: string | {
|
|
8
|
+
value: HTMLElement;
|
|
9
|
+
};
|
|
10
|
+
textContent?: string;
|
|
11
|
+
attrs?: Record<string, any> & {
|
|
12
|
+
class?: string | string[] | Record<string, boolean> | {
|
|
13
|
+
items?: string[];
|
|
14
|
+
} | {
|
|
15
|
+
value?: string | string[] | Record<string, boolean>;
|
|
16
|
+
};
|
|
17
|
+
style?: string | Record<string, string | number> | {
|
|
18
|
+
value?: string | Record<string, string | number>;
|
|
19
|
+
};
|
|
20
|
+
};
|
|
21
|
+
onBeforeDestroy?: OnHook;
|
|
22
|
+
}
|
|
23
|
+
export declare class CanvasDOMElement {
|
|
24
|
+
element: HTMLElement;
|
|
25
|
+
private eventListeners;
|
|
26
|
+
private onBeforeDestroy;
|
|
27
|
+
private valueSignal;
|
|
28
|
+
private isFormElementType;
|
|
29
|
+
/**
|
|
30
|
+
* Checks if the element is a form element that supports the value attribute
|
|
31
|
+
* @param elementType - The element type string from props
|
|
32
|
+
* @returns true if the element is a form element with value support
|
|
33
|
+
*/
|
|
34
|
+
private isFormElement;
|
|
35
|
+
onInit(props: DOMContainerProps): void;
|
|
36
|
+
onMount(context: Element<CanvasDOMElement>): void;
|
|
37
|
+
onUpdate(props: DOMContainerProps): void;
|
|
38
|
+
onDestroy(parent: Element<CanvasDOMElement>, afterDestroy: () => void): Promise<void>;
|
|
39
|
+
}
|
|
40
|
+
export interface CanvasDOMElement extends DisplayObjectProps {
|
|
41
|
+
}
|
|
42
|
+
export declare const DOMElement: ComponentFunction<DOMContainerProps>;
|
|
43
|
+
export {};
|
|
44
|
+
//# sourceMappingURL=DOMElement.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DOMElement.d.ts","sourceRoot":"","sources":["../../src/components/DOMElement.ts"],"names":[],"mappings":"AACA,OAAO,EAEL,OAAO,EAER,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAoC,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAC3E,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAI3D,UAAU,iBAAkB,SAAQ,kBAAkB;IACpD,OAAO,EACH,MAAM,GACN;QACE,KAAK,EAAE,WAAW,CAAC;KACpB,CAAC;IACN,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG;QAC5B,KAAK,CAAC,EACF,MAAM,GACN,MAAM,EAAE,GACR,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GACvB;YAAE,KAAK,CAAC,EAAE,MAAM,EAAE,CAAA;SAAE,GACpB;YAAE,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;SAAE,CAAC;QAC5D,KAAK,CAAC,EACF,MAAM,GACN,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,GAC/B;YAAE,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,CAAA;SAAE,CAAC;KAC1D,CAAC;IACF,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B;AAwKD,qBAAa,gBAAgB;IACpB,OAAO,EAAE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