canvasengine 2.0.0-beta.5 → 2.0.0-beta.50

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.
Files changed (172) hide show
  1. package/dist/components/Button.d.ts +185 -0
  2. package/dist/components/Button.d.ts.map +1 -0
  3. package/dist/components/Canvas.d.ts +17 -0
  4. package/dist/components/Canvas.d.ts.map +1 -0
  5. package/dist/components/Container.d.ts +86 -0
  6. package/dist/components/Container.d.ts.map +1 -0
  7. package/dist/components/DOMContainer.d.ts +98 -0
  8. package/dist/components/DOMContainer.d.ts.map +1 -0
  9. package/dist/components/DOMElement.d.ts +54 -0
  10. package/dist/components/DOMElement.d.ts.map +1 -0
  11. package/dist/components/DOMSprite.d.ts +127 -0
  12. package/dist/components/DOMSprite.d.ts.map +1 -0
  13. package/dist/components/DisplayObject.d.ts +94 -0
  14. package/dist/components/DisplayObject.d.ts.map +1 -0
  15. package/dist/components/FocusContainer.d.ts +129 -0
  16. package/dist/components/FocusContainer.d.ts.map +1 -0
  17. package/dist/components/Graphic.d.ts +64 -0
  18. package/dist/components/Graphic.d.ts.map +1 -0
  19. package/dist/components/Joystick.d.ts +36 -0
  20. package/dist/components/Joystick.d.ts.map +1 -0
  21. package/dist/components/Mesh.d.ts +208 -0
  22. package/dist/components/Mesh.d.ts.map +1 -0
  23. package/dist/components/NineSliceSprite.d.ts +16 -0
  24. package/dist/components/NineSliceSprite.d.ts.map +1 -0
  25. package/dist/components/ParticleEmitter.d.ts +4 -0
  26. package/dist/components/ParticleEmitter.d.ts.map +1 -0
  27. package/dist/components/Scene.d.ts +2 -0
  28. package/dist/components/Scene.d.ts.map +1 -0
  29. package/dist/components/Sprite.d.ts +242 -0
  30. package/dist/components/Sprite.d.ts.map +1 -0
  31. package/dist/components/Text.d.ts +25 -0
  32. package/dist/components/Text.d.ts.map +1 -0
  33. package/dist/components/TilingSprite.d.ts +17 -0
  34. package/dist/components/TilingSprite.d.ts.map +1 -0
  35. package/dist/components/Video.d.ts +14 -0
  36. package/dist/components/Video.d.ts.map +1 -0
  37. package/dist/components/Viewport.d.ts +121 -0
  38. package/dist/components/Viewport.d.ts.map +1 -0
  39. package/dist/components/index.d.ts +20 -0
  40. package/dist/components/index.d.ts.map +1 -0
  41. package/dist/components/types/DisplayObject.d.ts +106 -0
  42. package/dist/components/types/DisplayObject.d.ts.map +1 -0
  43. package/dist/components/types/MouseEvent.d.ts +4 -0
  44. package/dist/components/types/MouseEvent.d.ts.map +1 -0
  45. package/dist/components/types/Spritesheet.d.ts +248 -0
  46. package/dist/components/types/Spritesheet.d.ts.map +1 -0
  47. package/dist/components/types/index.d.ts +4 -0
  48. package/dist/components/types/index.d.ts.map +1 -0
  49. package/dist/directives/Controls.d.ts +112 -0
  50. package/dist/directives/Controls.d.ts.map +1 -0
  51. package/dist/directives/ControlsBase.d.ts +199 -0
  52. package/dist/directives/ControlsBase.d.ts.map +1 -0
  53. package/dist/directives/Drag.d.ts +69 -0
  54. package/dist/directives/Drag.d.ts.map +1 -0
  55. package/dist/directives/Flash.d.ts +116 -0
  56. package/dist/directives/Flash.d.ts.map +1 -0
  57. package/dist/directives/FocusNavigation.d.ts +52 -0
  58. package/dist/directives/FocusNavigation.d.ts.map +1 -0
  59. package/dist/directives/GamepadControls.d.ts +224 -0
  60. package/dist/directives/GamepadControls.d.ts.map +1 -0
  61. package/dist/directives/JoystickControls.d.ts +171 -0
  62. package/dist/directives/JoystickControls.d.ts.map +1 -0
  63. package/dist/directives/KeyboardControls.d.ts +219 -0
  64. package/dist/directives/KeyboardControls.d.ts.map +1 -0
  65. package/dist/directives/Scheduler.d.ts +35 -0
  66. package/dist/directives/Scheduler.d.ts.map +1 -0
  67. package/dist/directives/Shake.d.ts +98 -0
  68. package/dist/directives/Shake.d.ts.map +1 -0
  69. package/dist/directives/Sound.d.ts +25 -0
  70. package/dist/directives/Sound.d.ts.map +1 -0
  71. package/dist/directives/Transition.d.ts +10 -0
  72. package/dist/directives/Transition.d.ts.map +1 -0
  73. package/dist/directives/ViewportCull.d.ts +11 -0
  74. package/dist/directives/ViewportCull.d.ts.map +1 -0
  75. package/dist/directives/ViewportFollow.d.ts +18 -0
  76. package/dist/directives/ViewportFollow.d.ts.map +1 -0
  77. package/dist/directives/index.d.ts +13 -0
  78. package/dist/directives/index.d.ts.map +1 -0
  79. package/dist/engine/FocusManager.d.ts +174 -0
  80. package/dist/engine/FocusManager.d.ts.map +1 -0
  81. package/dist/engine/animation.d.ts +72 -0
  82. package/dist/engine/animation.d.ts.map +1 -0
  83. package/dist/engine/bootstrap.d.ts +48 -0
  84. package/dist/engine/bootstrap.d.ts.map +1 -0
  85. package/dist/engine/directive.d.ts +13 -0
  86. package/dist/engine/directive.d.ts.map +1 -0
  87. package/dist/engine/reactive.d.ts +134 -0
  88. package/dist/engine/reactive.d.ts.map +1 -0
  89. package/dist/engine/signal.d.ts +71 -0
  90. package/dist/engine/signal.d.ts.map +1 -0
  91. package/dist/engine/trigger.d.ts +54 -0
  92. package/dist/engine/trigger.d.ts.map +1 -0
  93. package/dist/engine/utils.d.ts +89 -0
  94. package/dist/engine/utils.d.ts.map +1 -0
  95. package/dist/hooks/addContext.d.ts +2 -0
  96. package/dist/hooks/addContext.d.ts.map +1 -0
  97. package/dist/hooks/useFocus.d.ts +60 -0
  98. package/dist/hooks/useFocus.d.ts.map +1 -0
  99. package/dist/hooks/useProps.d.ts +42 -0
  100. package/dist/hooks/useProps.d.ts.map +1 -0
  101. package/dist/hooks/useRef.d.ts +4 -0
  102. package/dist/hooks/useRef.d.ts.map +1 -0
  103. package/dist/index-DaGekQUW.js +2218 -0
  104. package/dist/index-DaGekQUW.js.map +1 -0
  105. package/dist/index.d.ts +19 -1099
  106. package/dist/index.d.ts.map +1 -0
  107. package/dist/index.global.js +5 -0
  108. package/dist/index.global.js.map +1 -0
  109. package/dist/index.js +11749 -2901
  110. package/dist/index.js.map +1 -1
  111. package/dist/utils/Ease.d.ts +17 -0
  112. package/dist/utils/Ease.d.ts.map +1 -0
  113. package/dist/utils/GlobalAssetLoader.d.ts +141 -0
  114. package/dist/utils/GlobalAssetLoader.d.ts.map +1 -0
  115. package/dist/utils/RadialGradient.d.ts +57 -0
  116. package/dist/utils/RadialGradient.d.ts.map +1 -0
  117. package/dist/utils/functions.d.ts +2 -0
  118. package/dist/utils/functions.d.ts.map +1 -0
  119. package/dist/utils/tabindex.d.ts +16 -0
  120. package/dist/utils/tabindex.d.ts.map +1 -0
  121. package/package.json +13 -7
  122. package/src/components/Button.ts +399 -0
  123. package/src/components/Canvas.ts +62 -46
  124. package/src/components/Container.ts +21 -2
  125. package/src/components/DOMContainer.ts +379 -0
  126. package/src/components/DOMElement.ts +556 -0
  127. package/src/components/DOMSprite.ts +1040 -0
  128. package/src/components/DisplayObject.ts +392 -201
  129. package/src/components/FocusContainer.ts +368 -0
  130. package/src/components/Graphic.ts +227 -66
  131. package/src/components/Joystick.ts +363 -0
  132. package/src/components/Mesh.ts +222 -0
  133. package/src/components/NineSliceSprite.ts +4 -1
  134. package/src/components/ParticleEmitter.ts +12 -8
  135. package/src/components/Sprite.ts +297 -31
  136. package/src/components/Text.ts +125 -18
  137. package/src/components/Video.ts +2 -2
  138. package/src/components/Viewport.ts +118 -63
  139. package/src/components/index.ts +9 -2
  140. package/src/components/types/DisplayObject.ts +41 -4
  141. package/src/components/types/Spritesheet.ts +0 -118
  142. package/src/directives/Controls.ts +254 -0
  143. package/src/directives/ControlsBase.ts +267 -0
  144. package/src/directives/Drag.ts +357 -52
  145. package/src/directives/Flash.ts +419 -0
  146. package/src/directives/FocusNavigation.ts +113 -0
  147. package/src/directives/GamepadControls.ts +537 -0
  148. package/src/directives/JoystickControls.ts +396 -0
  149. package/src/directives/KeyboardControls.ts +85 -430
  150. package/src/directives/Scheduler.ts +12 -4
  151. package/src/directives/Shake.ts +298 -0
  152. package/src/directives/Sound.ts +94 -31
  153. package/src/directives/ViewportFollow.ts +40 -9
  154. package/src/directives/index.ts +12 -6
  155. package/src/engine/FocusManager.ts +510 -0
  156. package/src/engine/animation.ts +175 -21
  157. package/src/engine/bootstrap.ts +93 -3
  158. package/src/engine/directive.ts +4 -4
  159. package/src/engine/reactive.ts +901 -161
  160. package/src/engine/signal.ts +113 -25
  161. package/src/engine/trigger.ts +34 -7
  162. package/src/engine/utils.ts +19 -3
  163. package/src/hooks/useFocus.ts +91 -0
  164. package/src/hooks/useProps.ts +1 -1
  165. package/src/index.ts +8 -2
  166. package/src/types/pixi-cull.d.ts +7 -0
  167. package/src/utils/GlobalAssetLoader.ts +257 -0
  168. package/src/utils/functions.ts +7 -0
  169. package/src/utils/tabindex.ts +70 -0
  170. package/testing/index.ts +35 -4
  171. package/tsconfig.json +18 -0
  172. package/vite.config.ts +39 -0
@@ -1,54 +1,173 @@
1
- import { effect, Signal } from "@signe/reactive";
2
- import { Graphics as PixiGraphics } from "pixi.js";
3
- import { createComponent, registerComponent } from "../engine/reactive";
4
- import { DisplayObject } from "./DisplayObject";
1
+ import { Effect, effect, isSignal, signal, Signal, WritableSignal } from "@signe/reactive";
2
+ import { Assets, ObservablePoint, Graphics as PixiGraphics } from "pixi.js";
3
+ import { createComponent, Element, registerComponent } from "../engine/reactive";
4
+ import { ComponentInstance, DisplayObject } from "./DisplayObject";
5
5
  import { DisplayObjectProps } from "./types/DisplayObject";
6
6
  import { useProps } from "../hooks/useProps";
7
+ import { SignalOrPrimitive } from "./types";
8
+ import { isPercent } from "../utils/functions";
9
+ import { setObservablePoint } from "../engine/utils";
7
10
 
8
11
  interface GraphicsProps extends DisplayObjectProps {
9
- draw?: (graphics: PixiGraphics) => void;
12
+ draw?: (graphics: PixiGraphics, width: number, height: number, anchor?: [number, number]) => void;
10
13
  }
11
14
 
12
15
  interface RectProps extends DisplayObjectProps {
13
- width: number;
14
- height: number;
15
- color: string;
16
+ color: SignalOrPrimitive<string>;
16
17
  }
17
18
 
18
19
  interface CircleProps extends DisplayObjectProps {
19
- radius: number;
20
- color: string;
20
+ radius: SignalOrPrimitive<number>;
21
+ color: SignalOrPrimitive<string>;
21
22
  }
22
23
 
23
24
  interface EllipseProps extends DisplayObjectProps {
24
- width: number;
25
- height: number;
26
- color: string;
25
+ color: SignalOrPrimitive<string>;
27
26
  }
28
27
 
29
28
  interface TriangleProps extends DisplayObjectProps {
30
- base: number;
31
- height: number;
32
- color: string;
29
+ base: SignalOrPrimitive<number>;
30
+ color: SignalOrPrimitive<string>;
33
31
  }
34
32
 
35
33
  interface SvgProps extends DisplayObjectProps {
36
- svg: string;
34
+ /** SVG content as string (legacy prop) */
35
+ svg?: string;
36
+ /** URL source of the SVG file to load */
37
+ src?: string;
38
+ /** Direct SVG content as string */
39
+ content?: string;
37
40
  }
38
41
 
39
42
  class CanvasGraphics extends DisplayObject(PixiGraphics) {
40
- onInit(props) {
41
- super.onInit(props);
43
+ clearEffect: Effect;
44
+ _width: WritableSignal<number>;
45
+ _height: WritableSignal<number>;
46
+
47
+ isCustomAnchor = true;
48
+
49
+ /**
50
+ * Initializes the graphics component with reactive width and height handling.
51
+ *
52
+ * This method handles different types of width and height props:
53
+ * - **Numbers**: Direct pixel values
54
+ * - **Strings with %**: Percentage values that trigger flex layout and use layout box dimensions
55
+ * - **Signals**: Reactive values that update automatically
56
+ *
57
+ * When percentage values are detected, the component:
58
+ * 1. Sets `display: 'flex'` to enable layout calculations
59
+ * 2. Listens to layout events to get computed dimensions
60
+ * 3. Updates internal width/height signals with layout box values
61
+ *
62
+ * The draw function receives the reactive width and height signals as parameters.
63
+ *
64
+ * @param props - Component properties including width, height, and draw function
65
+ * @example
66
+ * ```typescript
67
+ * // With pixel values
68
+ * Graphics({ width: 100, height: 50, draw: (g, w, h) => g.rect(0, 0, w(), h()) });
69
+ *
70
+ * // With percentage values (uses layout box)
71
+ * Graphics({ width: "50%", height: "100%", draw: (g, w, h) => g.rect(0, 0, w(), h()) });
72
+ *
73
+ * // With signals
74
+ * const width = signal(100);
75
+ * Graphics({ width, height: 50, draw: (g, w, h) => g.rect(0, 0, w(), h()) });
76
+ * ```
77
+ */
78
+ async onInit(props) {
79
+ await super.onInit(props);
80
+ this.setObjectFit('none');
81
+ }
82
+
83
+ /**
84
+ * Called when the component is mounted to the scene graph.
85
+ * Creates the reactive effect for drawing using the original signals from propObservables.
86
+ * @param {Element<DisplayObject>} element - The element being mounted with props and propObservables.
87
+ * @param {number} [index] - The index of the component among its siblings.
88
+ */
89
+ async onMount(element: Element<any>, index?: number): Promise<void> {
90
+ await super.onMount(element, index);
91
+ const { props, propObservables } = element;
92
+
93
+ // Use original signals from propObservables if available, otherwise create new ones
94
+ const width = (isSignal(propObservables?.width) ? propObservables.width : signal(props.width || 0)) as WritableSignal<number>;
95
+ const height = (isSignal(propObservables?.height) ? propObservables.height : signal(props.height || 0)) as WritableSignal<number>;
96
+ const anchor = (isSignal(propObservables?.anchor) ? propObservables.anchor : signal(props.anchor || [0, 0])) as WritableSignal<[number, number]>;
97
+
98
+ // Store as class properties for access in other methods
99
+ this._width = width;
100
+ this._height = height;
101
+
102
+ // Check if width or height are percentages to set display flex
103
+ const isWidthPercentage = isPercent(width());
104
+ const isHeightPercentage = isPercent(height());
105
+
42
106
  if (props.draw) {
43
- effect(() => {
107
+ this.clearEffect = effect(() => {
108
+ const w = width();
109
+ const h = height();
110
+ const a = anchor();
111
+ if (typeof w == 'string' || typeof h == 'string') {
112
+ return
113
+ }
44
114
  this.clear();
45
- props.draw?.(this);
115
+ props.draw?.(this, w, h, a);
116
+ this.subjectInit.next(this)
46
117
  });
47
118
  }
119
+
120
+ this.on('layout', (event) => {
121
+ const layoutBox = event.computedLayout;
122
+ // Update width if it's a percentage and value has changed
123
+ if (isWidthPercentage && isSignal(width) && width() !== layoutBox.width) {
124
+ width.set(layoutBox.width);
125
+ }
126
+
127
+ // Update height if it's a percentage and value has changed
128
+ if (isHeightPercentage && isSignal(height) && height() !== layoutBox.height) {
129
+ height.set(layoutBox.height);
130
+ }
131
+ });
48
132
  }
49
- }
50
133
 
51
- interface CanvasGraphics extends PixiGraphics {}
134
+ /**
135
+ * Called when component props are updated.
136
+ * Updates the internal width and height signals when props change.
137
+ * @param props - Updated properties
138
+ */
139
+ onUpdate(props: any) {
140
+ super.onUpdate(props);
141
+
142
+ // Update width signal if width prop changed and value is different
143
+ if (props.width !== undefined && this._width && this._width() !== props.width) {
144
+ this._width.set(props.width);
145
+ }
146
+
147
+ // Update height signal if height prop changed and value is different
148
+ if (props.height !== undefined && this._height && this._height() !== props.height) {
149
+ this._height.set(props.height);
150
+ }
151
+ }
152
+
153
+ /**
154
+ * Called when the component is about to be destroyed.
155
+ * This method should be overridden by subclasses to perform any cleanup.
156
+ * It ensures that the clearEffect subscription is unsubscribed before calling the original afterDestroy callback.
157
+ * @param parent The parent element.
158
+ * @param afterDestroy A callback function to be executed after the component's own destruction logic.
159
+ * @example
160
+ * // This method is typically called by the engine internally.
161
+ * // await component.onDestroy(parentElement, () => console.log('Component destroyed'));
162
+ */
163
+ async onDestroy(parent: Element<ComponentInstance>, afterDestroy: () => void): Promise<void> {
164
+ const _afterDestroyCallback = async () => {
165
+ this.clearEffect?.subscription.unsubscribe();
166
+ afterDestroy();
167
+ }
168
+ await super.onDestroy(parent, _afterDestroyCallback);
169
+ }
170
+ }
52
171
 
53
172
  registerComponent("Graphics", CanvasGraphics);
54
173
 
@@ -56,17 +175,28 @@ export function Graphics(props: GraphicsProps) {
56
175
  return createComponent("Graphics", props);
57
176
  }
58
177
 
178
+ const graphicsAnchor = (anchor, width, height) => {
179
+ const observableAnchor = new ObservablePoint({ _onUpdate: () => {} }, 0, 0);
180
+ setObservablePoint(observableAnchor, anchor);
181
+ const ax = observableAnchor.x;
182
+ const ay = observableAnchor.y;
183
+
184
+ return { x: -ax * width, y: -ay * height };
185
+ }
186
+
59
187
  export function Rect(props: RectProps) {
60
- const { width, height, color, borderRadius, border } = useProps(props, {
188
+ const { color, borderRadius, border } = useProps(props, {
61
189
  borderRadius: null,
62
190
  border: null
63
191
  })
192
+
64
193
  return Graphics({
65
- draw: (g) => {
194
+ draw: (g, width, height, anchor) => {
195
+ const { x, y } = graphicsAnchor(anchor, width, height);
66
196
  if (borderRadius()) {
67
- g.roundRect(0, 0, width(), height(), borderRadius());
197
+ g.roundRect(x, y, width, height, borderRadius());
68
198
  } else {
69
- g.rect(0, 0, width(), height());
199
+ g.rect(x, y, width, height);
70
200
  }
71
201
  if (border) {
72
202
  g.stroke(border);
@@ -77,59 +207,44 @@ export function Rect(props: RectProps) {
77
207
  })
78
208
  }
79
209
 
80
- function drawShape(g: PixiGraphics, shape: 'circle' | 'ellipse', props: {
81
- radius: Signal<number>;
82
- color: Signal<string>;
83
- border: Signal<number>;
84
- } | {
85
- width: Signal<number>;
86
- height: Signal<number>;
87
- color: Signal<string>;
88
- border: Signal<number>;
89
- }) {
90
- const { color, border } = props;
91
- if ('radius' in props) {
92
- g.circle(0, 0, props.radius());
93
- } else {
94
- g.ellipse(0, 0, props.width() / 2, props.height() / 2);
95
- }
96
- if (border()) {
97
- g.stroke(border());
98
- }
99
- g.fill(color());
100
- }
101
-
102
210
  export function Circle(props: CircleProps) {
103
- const { radius, color, border } = useProps(props, {
104
- border: null
211
+ const { color, border, radius } = useProps(props, {
212
+ border: null,
213
+ radius: null
105
214
  })
106
215
  return Graphics({
107
- draw: (g) => drawShape(g, 'circle', { radius, color, border }),
216
+ draw: (g, width, height, anchor) => {
217
+ const { x, y } = graphicsAnchor(anchor, width, height);
218
+ if (width == height || height == 0) {
219
+ g.circle(x, y, radius() || width);
220
+ } else {
221
+ g.ellipse(x, y, width, height);
222
+ }
223
+ if (border()) {
224
+ g.stroke(border());
225
+ }
226
+ g.fill(color());
227
+ },
108
228
  ...props
109
229
  })
110
230
  }
111
231
 
112
232
  export function Ellipse(props: EllipseProps) {
113
- const { width, height, color, border } = useProps(props, {
114
- border: null
115
- })
116
- return Graphics({
117
- draw: (g) => drawShape(g, 'ellipse', { width, height, color, border }),
118
- ...props
119
- })
233
+ return Circle(props as CircleProps);
120
234
  }
121
235
 
122
236
  export function Triangle(props: TriangleProps) {
123
- const { width, height, color, border } = useProps(props, {
237
+ const { color, border } = useProps(props, {
124
238
  border: null,
125
239
  color: '#000'
126
240
  })
127
241
  return Graphics({
128
- draw: (g) => {
129
- g.moveTo(0, height());
130
- g.lineTo(width() / 2, 0);
131
- g.lineTo(width(), height());
132
- g.lineTo(0, height());
242
+ draw: (g, gWidth, gHeight, anchor) => {
243
+ const { x, y } = graphicsAnchor(anchor, gWidth, gHeight);
244
+ g.moveTo(x, y + gHeight);
245
+ g.lineTo(x + gWidth / 2, y);
246
+ g.lineTo(x + gWidth, y + gHeight);
247
+ g.lineTo(x, y + gHeight);
133
248
  g.fill(color());
134
249
  if (border) {
135
250
  g.stroke(border);
@@ -139,9 +254,55 @@ export function Triangle(props: TriangleProps) {
139
254
  })
140
255
  }
141
256
 
257
+ /**
258
+ * Creates an SVG component that can render SVG graphics from URL, content, or legacy svg prop.
259
+ *
260
+ * This component provides three ways to display SVG graphics:
261
+ * - **src**: Load SVG from a URL using Assets.load with parseAsGraphicsContext option
262
+ * - **content**: Render SVG directly from string content using Graphics.svg() method
263
+ * - **svg**: Legacy prop for SVG content (for backward compatibility)
264
+ *
265
+ * @param props - Component properties including src, content, or svg
266
+ * @returns A reactive SVG component
267
+ * @example
268
+ * ```typescript
269
+ * // Load from URL
270
+ * const svgFromUrl = Svg({ src: "/assets/logo.svg" });
271
+ *
272
+ * // Direct content
273
+ * const svgFromContent = Svg({
274
+ * content: `<svg viewBox="0 0 100 100">
275
+ * <circle cx="50" cy="50" r="40" fill="blue"/>
276
+ * </svg>`
277
+ * });
278
+ *
279
+ * // Legacy usage
280
+ * const svgLegacy = Svg({ svg: "<svg>...</svg>" });
281
+ * ```
282
+ */
142
283
  export function Svg(props: SvgProps) {
143
284
  return Graphics({
144
- draw: (g) => g.svg(props.svg),
285
+ draw: async (g) => {
286
+ if (props.src) {
287
+ // Load SVG from source URL with graphics context parsing
288
+ const svgData = await Assets.load({
289
+ src: props.src,
290
+ data: {
291
+ parseAsGraphicsContext: true,
292
+ },
293
+ });
294
+
295
+ // Apply the loaded graphics context
296
+ const graphics = new PixiGraphics(svgData);
297
+ g.context = graphics.context;
298
+ } else if (props.content) {
299
+ // Render SVG directly from content string
300
+ g.svg(props.content);
301
+ } else if (props.svg) {
302
+ // Legacy prop support
303
+ g.svg(props.svg);
304
+ }
305
+ },
145
306
  ...props
146
307
  })
147
308
  }