@gamedevland/cyber-ui-sdk 0.0.0-stage → 0.1.0

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Gamedev Land
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,126 @@
1
- # Temporary Holding Version
1
+ # @gamedevland/cyber-ui-sdk
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ GameDevLand SDK lifecycle adapter for Cyber UI Toolkit. Uses the host SDK's public APIs,
4
+ Graphics, input routing, tweens and render loop.
5
+
6
+ ```sh
7
+ npm install @gamedevland/cyber-ui @gamedevland/cyber-ui-sdk @gamedevland/engine@0.0.11 pixi.js
8
+ ```
9
+
10
+ ## A panel component
11
+
12
+ ```ts
13
+ import { CyberPreset, TerminalGlass } from '@gamedevland/cyber-ui';
14
+ import { ToolkitComponent } from '@gamedevland/cyber-ui-sdk';
15
+ import { SchemaDecoder as S } from '@gamedevland/engine/validation';
16
+ import type { Graphics } from '@gamedevland/engine/layouts';
17
+ import type { InferDecoded } from '@gamedevland/engine/validation';
18
+
19
+ const configDecoder = S.object({
20
+ width: S.number({ min: 48 }),
21
+ height: S.number({ min: 28 }),
22
+ cut: S.number({ min: 0 }),
23
+ });
24
+
25
+ export class CyberPanel extends ToolkitComponent<InferDecoded<typeof configDecoder>, Graphics> {
26
+ protected readonly configDecoder = configDecoder;
27
+
28
+ protected override onReady(): void {
29
+ const { width, height, cut } = this.config;
30
+ const palette = CyberPreset.palette;
31
+ TerminalGlass.draw(
32
+ this.node.view.clear(),
33
+ 0,
34
+ 0,
35
+ width,
36
+ height,
37
+ cut,
38
+ palette.panel,
39
+ palette.panelEdge,
40
+ palette.accent,
41
+ palette.text,
42
+ );
43
+ }
44
+ }
45
+ ```
46
+
47
+ Register the component in your `GlobalDiDefinition.registerComponents()`:
48
+
49
+ ```ts
50
+ group.add('CyberPanel', CyberPanel);
51
+ ```
52
+
53
+ The `Graphics` element factory must also be registered. Add the component to a Graphics
54
+ node in your SDK layout:
55
+
56
+ ```json
57
+ {
58
+ "type": "Graphics",
59
+ "components": {
60
+ "surface": {
61
+ "type": "CyberPanel",
62
+ "data": { "width": 320, "height": 180, "cut": 12 }
63
+ }
64
+ }
65
+ }
66
+ ```
67
+
68
+ The parent layout owns positioning. Add Text nodes for content and use `node.input` for
69
+ interaction. Changing a component's appearance does not execute application commands.
70
+
71
+ ## Animated components
72
+
73
+ In `onReady()`, register effects with `this.ownEffect(new TriangleLoader(options))`.
74
+ Base `onUpdate(deltaSeconds)` advances owned effects. Render them into child Graphics after
75
+ calling `super.onUpdate(deltaSeconds)` exactly once. Enable/disable pauses them; detach
76
+ disposes them before SDK views are removed. Call `setUiReducedMotion(reduced)` when the host
77
+ preference changes; later-owned effects inherit the preference too.
78
+
79
+ Overrides of lifecycle hooks preserve the base hooks. In an overridden `onDetach()`, return
80
+ `super.onDetach()` after releasing your own resources. Do not dispose effects registered
81
+ with `ownEffect()` separately. `uiViewport` returns logical width/height, CSS width/height,
82
+ and scale; local bounds remain the application's responsibility.
83
+
84
+ ## PanelReveal action
85
+
86
+ Register in `GlobalDiDefinition.registerServices()`:
87
+
88
+ ```ts
89
+ import { DiTokens } from '@gamedevland/engine/di';
90
+ import { PanelReveal } from '@gamedevland/cyber-ui-sdk';
91
+
92
+ registrar.transientClass(DiTokens.action('PanelReveal'), PanelReveal);
93
+ ```
94
+
95
+ Attach to a dedicated Container wrapper in the layout:
96
+
97
+ ```json
98
+ {
99
+ "type": "Container",
100
+ "actions": { "reveal": { "type": "PanelReveal" } }
101
+ }
102
+ ```
103
+
104
+ Invoke through the SDK node action facade:
105
+
106
+ ```ts
107
+ void node.runAction('reveal', {
108
+ duration: 240,
109
+ delay: 0,
110
+ offset: 8,
111
+ axis: 'down',
112
+ });
113
+ ```
114
+
115
+ `duration`: 1–2000 ms; `delay`: 0–1000 ms; `offset`: 0–16 local units.
116
+ `axis` is optional (`down`, `right`, `zoom`); `pivotX`, `pivotY`, and `closing` are optional.
117
+ The action captures the wrapper transform at attachment. Opening returns to that transform;
118
+ closing moves/scales/fades away; cancellation restores it. Keep layout and other animations
119
+ on a parent or child so they do not compete for the wrapper's transform. Use a static state
120
+ instead when reduced motion is enabled. The action schedules SDK-owned tweens; invocation
121
+ does not wait for their completion.
122
+
123
+ [Full guide](https://github.com/gamedevland/cyber-ui-toolkit#readme)
124
+ · [Typechecked component](https://github.com/gamedevland/cyber-ui-toolkit/blob/main/examples/sdk/src/CyberPanel.ts)
125
+
126
+ MIT License. Core `^0.1.0`, SDK `0.0.11`, PixiJS `>=8.16.0 <9`.
@@ -0,0 +1,31 @@
1
+ import { BaseTypedAction } from '@gamedevland/engine/layouts';
2
+ import type { InferDecoded } from '@gamedevland/engine/validation';
3
+ declare const configDecoder: import("@gamedevland/engine/layouts").Decoder<import("@gamedevland/engine/layouts").InferObject<{}>>;
4
+ declare const inputDecoder: import("@gamedevland/engine/layouts").Decoder<import("@gamedevland/engine/layouts").InferObject<{
5
+ duration: import("@gamedevland/engine/layouts").Decoder<number>;
6
+ delay: import("@gamedevland/engine/layouts").Decoder<number>;
7
+ offset: import("@gamedevland/engine/layouts").Decoder<number>;
8
+ axis: import("@gamedevland/engine/layouts").Decoder<"down" | "right" | "zoom" | undefined>;
9
+ pivotX: import("@gamedevland/engine/layouts").Decoder<number | undefined>;
10
+ pivotY: import("@gamedevland/engine/layouts").Decoder<number | undefined>;
11
+ closing: import("@gamedevland/engine/layouts").Decoder<boolean | undefined>;
12
+ }>>;
13
+ /** Reveals a dedicated animation wrapper relative to its attached layout transform. */
14
+ export declare class PanelReveal extends BaseTypedAction<InferDecoded<typeof configDecoder>, InferDecoded<typeof inputDecoder>> {
15
+ protected readonly configDecoder: import("@gamedevland/engine/layouts").Decoder<import("@gamedevland/engine/layouts").InferObject<{}>>;
16
+ protected readonly inputDecoder: import("@gamedevland/engine/layouts").Decoder<import("@gamedevland/engine/layouts").InferObject<{
17
+ duration: import("@gamedevland/engine/layouts").Decoder<number>;
18
+ delay: import("@gamedevland/engine/layouts").Decoder<number>;
19
+ offset: import("@gamedevland/engine/layouts").Decoder<number>;
20
+ axis: import("@gamedevland/engine/layouts").Decoder<"down" | "right" | "zoom" | undefined>;
21
+ pivotX: import("@gamedevland/engine/layouts").Decoder<number | undefined>;
22
+ pivotY: import("@gamedevland/engine/layouts").Decoder<number | undefined>;
23
+ closing: import("@gamedevland/engine/layouts").Decoder<boolean | undefined>;
24
+ }>>;
25
+ private origin?;
26
+ protected onInit(): void;
27
+ protected execute(input: InferDecoded<typeof inputDecoder>): void;
28
+ protected onCancel(): void;
29
+ private getOrigin;
30
+ }
31
+ export {};
@@ -0,0 +1,61 @@
1
+ import { PanelTransition } from '@gamedevland/cyber-ui';
2
+ import { BaseTypedAction } from '@gamedevland/engine/layouts';
3
+ import { SchemaDecoder as S } from '@gamedevland/engine/validation';
4
+ const configDecoder = S.object({});
5
+ const inputDecoder = S.object({
6
+ duration: S.number({ min: 1, max: 2000 }),
7
+ delay: S.number({ min: 0, max: 1000 }),
8
+ offset: S.number({ min: 0, max: 16 }),
9
+ axis: S.optional(S.enumOf(['down', 'right', 'zoom'])),
10
+ pivotX: S.optional(S.number()),
11
+ pivotY: S.optional(S.number()),
12
+ closing: S.optional(S.boolean()),
13
+ });
14
+ /** Reveals a dedicated animation wrapper relative to its attached layout transform. */
15
+ export class PanelReveal extends BaseTypedAction {
16
+ configDecoder = configDecoder;
17
+ inputDecoder = inputDecoder;
18
+ origin;
19
+ onInit() {
20
+ const { x, y, alpha, scale } = this.node.view;
21
+ this.origin = { x, y, alpha, scaleX: scale.x, scaleY: scale.y };
22
+ }
23
+ execute(input) {
24
+ this.killOwnedTweens();
25
+ const origin = this.getOrigin();
26
+ const shifted = PanelTransition.origin(input);
27
+ const x = origin.x + shifted.x * origin.scaleX;
28
+ const y = origin.y + shifted.y * origin.scaleY;
29
+ const scaleX = origin.scaleX * shifted.scaleX;
30
+ const scaleY = origin.scaleY * shifted.scaleY;
31
+ const alpha = origin.alpha * shifted.alpha;
32
+ const options = {
33
+ duration: input.duration / 1000,
34
+ delay: input.delay / 1000,
35
+ ease: input.closing ? 'power2.in' : 'power3.out',
36
+ };
37
+ if (input.closing) {
38
+ this.ownTween(this.node.tweens.to({ x, y, alpha }, options));
39
+ this.ownTween(this.node.tweens.scaleXY(scaleX, scaleY, options));
40
+ return;
41
+ }
42
+ this.node.setAlpha(alpha).setScale(scaleX, scaleY).setPosition(x, y);
43
+ this.ownTween(this.node.tweens.to({ alpha: origin.alpha, x: origin.x, y: origin.y }, options));
44
+ if (input.axis) {
45
+ this.ownTween(this.node.tweens.scaleXY(origin.scaleX, origin.scaleY, options));
46
+ }
47
+ }
48
+ onCancel() {
49
+ const origin = this.getOrigin();
50
+ this.node
51
+ .setAlpha(origin.alpha)
52
+ .setPosition(origin.x, origin.y)
53
+ .setScale(origin.scaleX, origin.scaleY);
54
+ }
55
+ getOrigin() {
56
+ if (!this.origin)
57
+ throw new Error('PanelReveal must be initialized before use');
58
+ return this.origin;
59
+ }
60
+ }
61
+ //# sourceMappingURL=PanelReveal.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PanelReveal.js","sourceRoot":"","sources":["../src/PanelReveal.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAC9D,OAAO,EAAE,aAAa,IAAI,CAAC,EAAE,MAAM,gCAAgC,CAAC;AAYpE,MAAM,aAAa,GAAG,CAAC,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;AACnC,MAAM,YAAY,GAAG,CAAC,CAAC,MAAM,CAAC;IAC5B,QAAQ,EAAE,CAAC,CAAC,MAAM,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,IAAI,EAAE,CAAC;IACzC,KAAK,EAAE,CAAC,CAAC,MAAM,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,IAAI,EAAE,CAAC;IACtC,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,EAAE,EAAE,CAAC;IACrC,IAAI,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,MAAM,EAAE,OAAO,EAAE,MAAM,CAAU,CAAC,CAAC;IAC9D,MAAM,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;IAC9B,MAAM,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;IAC9B,OAAO,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC;CACjC,CAAC,CAAC;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f,IAAI,CAAC,IAAI,CAAC,MAAM;YAAE,MAAM,IAAI,KAAK,CAAC,4CAA4C,CAAC,CAAC;QAChF,OAAO,IAAI,CAAC,MAAM,CAAC;IACrB,CAAC;CACF","sourcesContent":["import { PanelTransition } from '@gamedevland/cyber-ui';\nimport { BaseTypedAction } from '@gamedevland/engine/layouts';\nimport { SchemaDecoder as S } from '@gamedevland/engine/validation';\n\nimport type { InferDecoded } from '@gamedevland/engine/validation';\n\ntype Transform = {\n readonly x: number;\n readonly y: number;\n readonly scaleX: number;\n readonly scaleY: number;\n readonly alpha: number;\n};\n\nconst configDecoder = S.object({});\nconst inputDecoder = S.object({\n duration: S.number({ min: 1, max: 2000 }),\n delay: S.number({ min: 0, max: 1000 }),\n offset: S.number({ min: 0, max: 16 }),\n axis: S.optional(S.enumOf(['down', 'right', 'zoom'] as const)),\n pivotX: S.optional(S.number()),\n pivotY: S.optional(S.number()),\n closing: S.optional(S.boolean()),\n});\n\n/** Reveals a dedicated animation wrapper relative to its attached layout transform. */\nexport class PanelReveal extends BaseTypedAction<\n InferDecoded<typeof configDecoder>,\n InferDecoded<typeof inputDecoder>\n> {\n protected readonly configDecoder = configDecoder;\n protected readonly inputDecoder = inputDecoder;\n private origin?: Transform;\n\n protected override onInit(): void {\n const { x, y, alpha, scale } = this.node.view;\n this.origin = { x, y, alpha, scaleX: scale.x, scaleY: scale.y };\n }\n\n protected execute(input: InferDecoded<typeof inputDecoder>): void {\n this.killOwnedTweens();\n const origin = this.getOrigin();\n const shifted = PanelTransition.origin(input);\n const x = origin.x + shifted.x * origin.scaleX;\n const y = origin.y + shifted.y * origin.scaleY;\n const scaleX = origin.scaleX * shifted.scaleX;\n const scaleY = origin.scaleY * shifted.scaleY;\n const alpha = origin.alpha * shifted.alpha;\n const options = {\n duration: input.duration / 1000,\n delay: input.delay / 1000,\n ease: input.closing ? 'power2.in' : 'power3.out',\n };\n if (input.closing) {\n this.ownTween(this.node.tweens.to({ x, y, alpha }, options));\n this.ownTween(this.node.tweens.scaleXY(scaleX, scaleY, options));\n return;\n }\n this.node.setAlpha(alpha).setScale(scaleX, scaleY).setPosition(x, y);\n this.ownTween(this.node.tweens.to({ alpha: origin.alpha, x: origin.x, y: origin.y }, options));\n if (input.axis) {\n this.ownTween(this.node.tweens.scaleXY(origin.scaleX, origin.scaleY, options));\n }\n }\n\n protected override onCancel(): void {\n const origin = this.getOrigin();\n this.node\n .setAlpha(origin.alpha)\n .setPosition(origin.x, origin.y)\n .setScale(origin.scaleX, origin.scaleY);\n }\n\n private getOrigin(): Transform {\n if (!this.origin) throw new Error('PanelReveal must be initialized before use');\n return this.origin;\n }\n}\n"]}
@@ -0,0 +1,22 @@
1
+ import { BaseTypedComponent } from '@gamedevland/engine/layouts';
2
+ import type { UiEffect } from '@gamedevland/cyber-ui';
3
+ import type { NodeBase } from '@gamedevland/engine/layouts';
4
+ export type UiViewport = {
5
+ readonly width: number;
6
+ readonly height: number;
7
+ readonly cssWidth: number;
8
+ readonly cssHeight: number;
9
+ readonly scale: number;
10
+ };
11
+ /** SDK owns scheduling and input; toolkit effects receive only their public host contracts. */
12
+ export declare abstract class ToolkitComponent<TConfig, TNode extends NodeBase = NodeBase> extends BaseTypedComponent<TConfig, TNode> {
13
+ private readonly effects;
14
+ private reducedMotion;
15
+ protected get uiViewport(): UiViewport;
16
+ protected ownEffect<TEffect extends UiEffect>(effect: TEffect): TEffect;
17
+ protected setUiReducedMotion(reduced: boolean): void;
18
+ protected onUpdate(deltaSeconds: number): void;
19
+ protected onEnable(): void;
20
+ protected onDisable(): void;
21
+ onDetach(): void | Promise<void>;
22
+ }
@@ -0,0 +1,46 @@
1
+ import { BaseTypedComponent } from '@gamedevland/engine/layouts';
2
+ /** SDK owns scheduling and input; toolkit effects receive only their public host contracts. */
3
+ export class ToolkitComponent extends BaseTypedComponent {
4
+ effects = new Set();
5
+ reducedMotion = false;
6
+ get uiViewport() {
7
+ const virtual = this.node.screen.getVirtualSize();
8
+ const css = this.node.screen.getViewportSize();
9
+ return {
10
+ ...virtual,
11
+ cssWidth: css.width,
12
+ cssHeight: css.height,
13
+ scale: this.node.screen.getScale(),
14
+ };
15
+ }
16
+ ownEffect(effect) {
17
+ effect.setActive(this.enabled);
18
+ effect.setReducedMotion(this.reducedMotion);
19
+ this.effects.add(effect);
20
+ return effect;
21
+ }
22
+ setUiReducedMotion(reduced) {
23
+ this.reducedMotion = reduced;
24
+ for (const effect of this.effects)
25
+ effect.setReducedMotion(reduced);
26
+ }
27
+ onUpdate(deltaSeconds) {
28
+ for (const effect of this.effects)
29
+ effect.update(deltaSeconds);
30
+ }
31
+ onEnable() {
32
+ for (const effect of this.effects)
33
+ effect.setActive(true);
34
+ }
35
+ onDisable() {
36
+ for (const effect of this.effects)
37
+ effect.setActive(false);
38
+ }
39
+ onDetach() {
40
+ for (const effect of this.effects)
41
+ effect.dispose();
42
+ this.effects.clear();
43
+ return super.onDetach();
44
+ }
45
+ }
46
+ //# sourceMappingURL=ToolkitComponent.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ToolkitComponent.js","sourceRoot":"","sources":["../src/ToolkitComponent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAC;AAajE,+FAA+F;AAC/F,MAAM,OAAgB,gBAGpB,SAAQ,kBAAkC;IACzB,OAAO,GAAG,IAAI,GAAG,EAAY,CAAC;IACvC,aAAa,GAAG,KAAK,CAAC;IAE9B,IAAc,UAAU;QACtB,MAAM,OAAO,GAAG,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,cAAc,EAAE,CAAC;QAClD,MAAM,GAAG,GAAG,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,eAAe,EAAE,CAAC;QAC/C,OAAO;YACL,GAAG,OAAO;YACV,QAAQ,EAAE,GAAG,CAAC,KAAK;YACnB,SAAS,EAAE,GAAG,CAAC,MAAM;YACrB,KAAK,EAAE,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,QAAQ,EAAE;SACnC,CAAC;IACJ,CAAC;IAES,SAAS,CAA2B,MAAe;QAC3D,MAAM,CAAC,SAAS,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QAC/B,MAAM,CAAC,gBAAgB,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;QAC5C,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;QACzB,OAAO,MAAM,CAAC;IAChB,CAAC;IAES,kBAAkB,CAAC,OAAgB;QAC3C,IAAI,CAAC,aAAa,GAAG,OAAO,CAAC;QAC7B,KAAK,MAAM,MAAM,IAAI,IAAI,CAAC,OAAO;YAAE,MAAM,CAAC,gBAAgB,CAAC,OAAO,CAAC,CAAC;IACtE,CAAC;IAEkB,QAAQ,CAAC,YAAoB;QAC9C,KAAK,MAAM,MAAM,IAAI,IAAI,CAAC,OAAO;YAAE,MAAM,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC;IACjE,CAAC;IAEkB,QAAQ;QACzB,KAAK,MAAM,MAAM,IAAI,IAAI,CAAC,OAAO;YAAE,MAAM,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;IAC5D,CAAC;IAEkB,SAAS;QAC1B,KAAK,MAAM,MAAM,IAAI,IAAI,CAAC,OAAO;YAAE,MAAM,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;IAC7D,CAAC;IAEQ,QAAQ;QACf,KAAK,MAAM,MAAM,IAAI,IAAI,CAAC,OAAO;YAAE,MAAM,CAAC,OAAO,EAAE,CAAC;QACpD,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,CAAC;QACrB,OAAO,KAAK,CAAC,QAAQ,EAAE,CAAC;IAC1B,CAAC;CACF","sourcesContent":["import { BaseTypedComponent } from '@gamedevland/engine/layouts';\n\nimport type { UiEffect } from '@gamedevland/cyber-ui';\nimport type { NodeBase } from '@gamedevland/engine/layouts';\n\nexport type UiViewport = {\n readonly width: number;\n readonly height: number;\n readonly cssWidth: number;\n readonly cssHeight: number;\n readonly scale: number;\n};\n\n/** SDK owns scheduling and input; toolkit effects receive only their public host contracts. */\nexport abstract class ToolkitComponent<\n TConfig,\n TNode extends NodeBase = NodeBase,\n> extends BaseTypedComponent<TConfig, TNode> {\n private readonly effects = new Set<UiEffect>();\n private reducedMotion = false;\n\n protected get uiViewport(): UiViewport {\n const virtual = this.node.screen.getVirtualSize();\n const css = this.node.screen.getViewportSize();\n return {\n ...virtual,\n cssWidth: css.width,\n cssHeight: css.height,\n scale: this.node.screen.getScale(),\n };\n }\n\n protected ownEffect<TEffect extends UiEffect>(effect: TEffect): TEffect {\n effect.setActive(this.enabled);\n effect.setReducedMotion(this.reducedMotion);\n this.effects.add(effect);\n return effect;\n }\n\n protected setUiReducedMotion(reduced: boolean): void {\n this.reducedMotion = reduced;\n for (const effect of this.effects) effect.setReducedMotion(reduced);\n }\n\n protected override onUpdate(deltaSeconds: number): void {\n for (const effect of this.effects) effect.update(deltaSeconds);\n }\n\n protected override onEnable(): void {\n for (const effect of this.effects) effect.setActive(true);\n }\n\n protected override onDisable(): void {\n for (const effect of this.effects) effect.setActive(false);\n }\n\n override onDetach(): void | Promise<void> {\n for (const effect of this.effects) effect.dispose();\n this.effects.clear();\n return super.onDetach();\n }\n}\n"]}
@@ -0,0 +1,3 @@
1
+ export { ToolkitComponent } from './ToolkitComponent.js';
2
+ export type { UiViewport } from './ToolkitComponent.js';
3
+ export { PanelReveal } from './PanelReveal.js';
package/dist/index.js ADDED
@@ -0,0 +1,3 @@
1
+ export { ToolkitComponent } from './ToolkitComponent.js';
2
+ export { PanelReveal } from './PanelReveal.js';
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAEzD,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC","sourcesContent":["export { ToolkitComponent } from './ToolkitComponent.js';\nexport type { UiViewport } from './ToolkitComponent.js';\nexport { PanelReveal } from './PanelReveal.js';\n"]}
package/package.json CHANGED
@@ -1,6 +1,52 @@
1
1
  {
2
2
  "name": "@gamedevland/cyber-ui-sdk",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.1.0",
4
+ "description": "GameDevLand SDK lifecycle and layout adapter for Cyber UI",
5
+ "type": "module",
6
+ "license": "MIT",
7
+ "sideEffects": false,
8
+ "files": [
9
+ "dist",
10
+ "README.md",
11
+ "LICENSE"
12
+ ],
13
+ "exports": {
14
+ ".": {
15
+ "types": "./dist/index.d.ts",
16
+ "import": "./dist/index.js"
17
+ }
18
+ },
19
+ "scripts": {
20
+ "build": "tsc -p tsconfig.json",
21
+ "prepublishOnly": "npm run build"
22
+ },
23
+ "peerDependencies": {
24
+ "@gamedevland/cyber-ui": "^0.1.0",
25
+ "@gamedevland/engine": "0.0.11",
26
+ "pixi.js": ">=8.16.0 <9"
27
+ },
28
+ "author": "Gamedev Land",
29
+ "repository": {
30
+ "type": "git",
31
+ "url": "git+https://github.com/gamedevland/cyber-ui-toolkit.git",
32
+ "directory": "packages/sdk"
33
+ },
34
+ "homepage": "https://github.com/gamedevland/cyber-ui-toolkit#readme",
35
+ "bugs": {
36
+ "url": "https://github.com/gamedevland/cyber-ui-toolkit/issues"
37
+ },
38
+ "keywords": [
39
+ "pixijs",
40
+ "cyberpunk",
41
+ "ui",
42
+ "gamedev",
43
+ "typescript"
44
+ ],
45
+ "types": "./dist/index.d.ts",
46
+ "publishConfig": {
47
+ "access": "public"
48
+ },
49
+ "engines": {
50
+ "node": ">=22.12.0"
51
+ }
52
+ }