canvasengine 2.0.0-beta.6 → 2.0.0-beta.61

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 (164) hide show
  1. package/dist/DebugRenderer-DkjTAc48.js +1384 -0
  2. package/dist/DebugRenderer-DkjTAc48.js.map +1 -0
  3. package/dist/components/Button.d.ts +185 -0
  4. package/dist/components/Button.d.ts.map +1 -0
  5. package/dist/components/Canvas.d.ts +17 -0
  6. package/dist/components/Canvas.d.ts.map +1 -0
  7. package/dist/components/DOMElement.d.ts +54 -0
  8. package/dist/components/DOMElement.d.ts.map +1 -0
  9. package/dist/components/DOMSprite.d.ts +127 -0
  10. package/dist/components/DOMSprite.d.ts.map +1 -0
  11. package/dist/components/FocusContainer.d.ts +129 -0
  12. package/dist/components/FocusContainer.d.ts.map +1 -0
  13. package/dist/components/Graphic.d.ts +64 -0
  14. package/dist/components/Graphic.d.ts.map +1 -0
  15. package/dist/components/Joystick.d.ts +36 -0
  16. package/dist/components/Joystick.d.ts.map +1 -0
  17. package/dist/components/NineSliceSprite.d.ts +16 -0
  18. package/dist/components/NineSliceSprite.d.ts.map +1 -0
  19. package/dist/components/ParticleEmitter.d.ts +4 -0
  20. package/dist/components/ParticleEmitter.d.ts.map +1 -0
  21. package/dist/components/Scene.d.ts +2 -0
  22. package/dist/components/Scene.d.ts.map +1 -0
  23. package/dist/components/Text.d.ts +24 -0
  24. package/dist/components/Text.d.ts.map +1 -0
  25. package/dist/components/TilingSprite.d.ts +17 -0
  26. package/dist/components/TilingSprite.d.ts.map +1 -0
  27. package/dist/components/Video.d.ts +14 -0
  28. package/dist/components/Video.d.ts.map +1 -0
  29. package/dist/components/index.d.ts +20 -0
  30. package/dist/components/index.d.ts.map +1 -0
  31. package/dist/components/types/DisplayObject.d.ts +118 -0
  32. package/dist/components/types/DisplayObject.d.ts.map +1 -0
  33. package/dist/components/types/MouseEvent.d.ts +4 -0
  34. package/dist/components/types/MouseEvent.d.ts.map +1 -0
  35. package/dist/components/types/Spritesheet.d.ts +248 -0
  36. package/dist/components/types/Spritesheet.d.ts.map +1 -0
  37. package/dist/components/types/index.d.ts +4 -0
  38. package/dist/components/types/index.d.ts.map +1 -0
  39. package/dist/directives/Controls.d.ts +112 -0
  40. package/dist/directives/Controls.d.ts.map +1 -0
  41. package/dist/directives/ControlsBase.d.ts +199 -0
  42. package/dist/directives/ControlsBase.d.ts.map +1 -0
  43. package/dist/directives/Drag.d.ts +69 -0
  44. package/dist/directives/Drag.d.ts.map +1 -0
  45. package/dist/directives/Flash.d.ts +116 -0
  46. package/dist/directives/Flash.d.ts.map +1 -0
  47. package/dist/directives/FocusNavigation.d.ts +52 -0
  48. package/dist/directives/FocusNavigation.d.ts.map +1 -0
  49. package/dist/directives/FogVisibility.d.ts +47 -0
  50. package/dist/directives/FogVisibility.d.ts.map +1 -0
  51. package/dist/directives/GamepadControls.d.ts +224 -0
  52. package/dist/directives/GamepadControls.d.ts.map +1 -0
  53. package/dist/directives/JoystickControls.d.ts +171 -0
  54. package/dist/directives/JoystickControls.d.ts.map +1 -0
  55. package/dist/directives/KeyboardControls.d.ts +219 -0
  56. package/dist/directives/KeyboardControls.d.ts.map +1 -0
  57. package/dist/directives/Scheduler.d.ts +36 -0
  58. package/dist/directives/Scheduler.d.ts.map +1 -0
  59. package/dist/directives/Shake.d.ts +98 -0
  60. package/dist/directives/Shake.d.ts.map +1 -0
  61. package/dist/directives/Sound.d.ts +25 -0
  62. package/dist/directives/Sound.d.ts.map +1 -0
  63. package/dist/directives/Transition.d.ts +10 -0
  64. package/dist/directives/Transition.d.ts.map +1 -0
  65. package/dist/directives/ViewportCull.d.ts +11 -0
  66. package/dist/directives/ViewportCull.d.ts.map +1 -0
  67. package/dist/directives/ViewportFollow.d.ts +18 -0
  68. package/dist/directives/ViewportFollow.d.ts.map +1 -0
  69. package/dist/directives/index.d.ts +14 -0
  70. package/dist/directives/index.d.ts.map +1 -0
  71. package/dist/dist-BOOc43Qm.js +778 -0
  72. package/dist/dist-BOOc43Qm.js.map +1 -0
  73. package/dist/engine/FocusManager.d.ts +174 -0
  74. package/dist/engine/FocusManager.d.ts.map +1 -0
  75. package/dist/engine/animation.d.ts +72 -0
  76. package/dist/engine/animation.d.ts.map +1 -0
  77. package/dist/engine/bootstrap.d.ts +52 -0
  78. package/dist/engine/bootstrap.d.ts.map +1 -0
  79. package/dist/engine/directive.d.ts +13 -0
  80. package/dist/engine/directive.d.ts.map +1 -0
  81. package/dist/engine/reactive.d.ts +135 -0
  82. package/dist/engine/reactive.d.ts.map +1 -0
  83. package/dist/engine/signal.d.ts +73 -0
  84. package/dist/engine/signal.d.ts.map +1 -0
  85. package/dist/engine/trigger.d.ts +54 -0
  86. package/dist/engine/trigger.d.ts.map +1 -0
  87. package/dist/engine/utils.d.ts +89 -0
  88. package/dist/engine/utils.d.ts.map +1 -0
  89. package/dist/hooks/addContext.d.ts +2 -0
  90. package/dist/hooks/addContext.d.ts.map +1 -0
  91. package/dist/hooks/useFocus.d.ts +60 -0
  92. package/dist/hooks/useFocus.d.ts.map +1 -0
  93. package/dist/hooks/useProps.d.ts +42 -0
  94. package/dist/hooks/useProps.d.ts.map +1 -0
  95. package/dist/hooks/useRef.d.ts +4 -0
  96. package/dist/hooks/useRef.d.ts.map +1 -0
  97. package/dist/index.d.ts +19 -1107
  98. package/dist/index.d.ts.map +1 -0
  99. package/dist/index.global.js +8 -0
  100. package/dist/index.global.js.map +1 -0
  101. package/dist/index.js +14708 -3135
  102. package/dist/index.js.map +1 -1
  103. package/dist/utils/Ease.d.ts +17 -0
  104. package/dist/utils/Ease.d.ts.map +1 -0
  105. package/dist/utils/GlobalAssetLoader.d.ts +141 -0
  106. package/dist/utils/GlobalAssetLoader.d.ts.map +1 -0
  107. package/dist/utils/RadialGradient.d.ts +57 -0
  108. package/dist/utils/RadialGradient.d.ts.map +1 -0
  109. package/dist/utils/functions.d.ts +2 -0
  110. package/dist/utils/functions.d.ts.map +1 -0
  111. package/dist/utils/tabindex.d.ts +16 -0
  112. package/dist/utils/tabindex.d.ts.map +1 -0
  113. package/package.json +16 -9
  114. package/src/components/Button.ts +399 -0
  115. package/src/components/Canvas.ts +82 -51
  116. package/src/components/Container.ts +21 -2
  117. package/src/components/DOMContainer.ts +379 -0
  118. package/src/components/DOMElement.ts +556 -0
  119. package/src/components/DOMSprite.ts +1040 -0
  120. package/src/components/DisplayObject.ts +422 -201
  121. package/src/components/FocusContainer.ts +368 -0
  122. package/src/components/Graphic.ts +239 -73
  123. package/src/components/Joystick.ts +363 -0
  124. package/src/components/Mesh.ts +222 -0
  125. package/src/components/NineSliceSprite.ts +4 -1
  126. package/src/components/ParticleEmitter.ts +12 -8
  127. package/src/components/Sprite.ts +418 -52
  128. package/src/components/Text.ts +270 -26
  129. package/src/components/Viewport.ts +122 -63
  130. package/src/components/index.ts +9 -2
  131. package/src/components/types/DisplayObject.ts +53 -5
  132. package/src/components/types/Spritesheet.ts +0 -118
  133. package/src/directives/Controls.ts +254 -0
  134. package/src/directives/ControlsBase.ts +267 -0
  135. package/src/directives/Drag.ts +357 -52
  136. package/src/directives/Flash.ts +419 -0
  137. package/src/directives/FocusNavigation.ts +113 -0
  138. package/src/directives/FogVisibility.ts +273 -0
  139. package/src/directives/GamepadControls.ts +537 -0
  140. package/src/directives/JoystickControls.ts +396 -0
  141. package/src/directives/KeyboardControls.ts +85 -430
  142. package/src/directives/Scheduler.ts +21 -5
  143. package/src/directives/Shake.ts +298 -0
  144. package/src/directives/Sound.ts +94 -31
  145. package/src/directives/ViewportFollow.ts +40 -9
  146. package/src/directives/index.ts +13 -6
  147. package/src/engine/FocusManager.ts +510 -0
  148. package/src/engine/animation.ts +175 -21
  149. package/src/engine/bootstrap.ts +140 -6
  150. package/src/engine/directive.ts +4 -4
  151. package/src/engine/reactive.ts +980 -177
  152. package/src/engine/signal.ts +241 -47
  153. package/src/engine/trigger.ts +34 -7
  154. package/src/engine/utils.ts +19 -3
  155. package/src/hooks/useFocus.ts +91 -0
  156. package/src/hooks/useProps.ts +1 -1
  157. package/src/index.ts +8 -2
  158. package/src/types/pixi-cull.d.ts +7 -0
  159. package/src/utils/GlobalAssetLoader.ts +257 -0
  160. package/src/utils/functions.ts +7 -0
  161. package/src/utils/tabindex.ts +70 -0
  162. package/testing/index.ts +35 -4
  163. package/tsconfig.json +18 -0
  164. 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
+ });
132
+ }
133
+
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
+ }
48
151
  }
49
- }
50
152
 
51
- interface CanvasGraphics extends PixiGraphics {}
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,92 +175,139 @@ 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
+
187
+ const propValue = (value: any) => isSignal(value) ? value() : value;
188
+
59
189
  export function Rect(props: RectProps) {
60
- const { width, height, color, borderRadius, border } = useProps(props, {
190
+ const { color, borderRadius, border } = useProps(props, {
61
191
  borderRadius: null,
62
192
  border: null
63
193
  })
194
+
64
195
  return Graphics({
65
- draw: (g) => {
196
+ draw: (g, width, height, anchor) => {
197
+ const { x, y } = graphicsAnchor(anchor, width, height);
66
198
  if (borderRadius()) {
67
- g.roundRect(0, 0, width(), height(), borderRadius());
199
+ g.roundRect(x, y, width, height, borderRadius());
68
200
  } else {
69
- g.rect(0, 0, width(), height());
201
+ g.rect(x, y, width, height);
70
202
  }
71
- if (border) {
72
- g.stroke(border);
203
+ const borderValue = propValue(border);
204
+ if (borderValue) {
205
+ g.stroke(borderValue);
73
206
  }
74
- g.fill(color());
207
+ g.fill(propValue(color));
75
208
  },
76
209
  ...props
77
210
  })
78
211
  }
79
212
 
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
213
  export function Circle(props: CircleProps) {
103
- const { radius, color, border } = useProps(props, {
104
- border: null
214
+ const { color, border, radius } = useProps(props, {
215
+ border: null,
216
+ radius: null
105
217
  })
106
218
  return Graphics({
107
- draw: (g) => drawShape(g, 'circle', { radius, color, border }),
219
+ draw: (g, width, height, anchor) => {
220
+ const { x, y } = graphicsAnchor(anchor, width, height);
221
+ if (width == height || height == 0) {
222
+ g.circle(x, y, propValue(radius) || width);
223
+ } else {
224
+ g.ellipse(x, y, width, height);
225
+ }
226
+ const borderValue = propValue(border);
227
+ if (borderValue) {
228
+ g.stroke(borderValue);
229
+ }
230
+ g.fill(propValue(color));
231
+ },
108
232
  ...props
109
233
  })
110
234
  }
111
235
 
112
236
  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
- })
237
+ return Circle(props as CircleProps);
120
238
  }
121
239
 
122
240
  export function Triangle(props: TriangleProps) {
123
- const { width, height, color, border } = useProps(props, {
241
+ const { color, border } = useProps(props, {
124
242
  border: null,
125
243
  color: '#000'
126
244
  })
127
245
  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());
133
- g.fill(color());
134
- if (border) {
135
- g.stroke(border);
246
+ draw: (g, gWidth, gHeight, anchor) => {
247
+ const { x, y } = graphicsAnchor(anchor, gWidth, gHeight);
248
+ g.moveTo(x, y + gHeight);
249
+ g.lineTo(x + gWidth / 2, y);
250
+ g.lineTo(x + gWidth, y + gHeight);
251
+ g.lineTo(x, y + gHeight);
252
+ g.fill(propValue(color));
253
+ const borderValue = propValue(border);
254
+ if (borderValue) {
255
+ g.stroke(borderValue);
136
256
  }
137
257
  },
138
258
  ...props
139
259
  })
140
260
  }
141
261
 
262
+ /**
263
+ * Creates an SVG component that can render SVG graphics from URL, content, or legacy svg prop.
264
+ *
265
+ * This component provides three ways to display SVG graphics:
266
+ * - **src**: Load SVG from a URL using Assets.load with parseAsGraphicsContext option
267
+ * - **content**: Render SVG directly from string content using Graphics.svg() method
268
+ * - **svg**: Legacy prop for SVG content (for backward compatibility)
269
+ *
270
+ * @param props - Component properties including src, content, or svg
271
+ * @returns A reactive SVG component
272
+ * @example
273
+ * ```typescript
274
+ * // Load from URL
275
+ * const svgFromUrl = Svg({ src: "/assets/logo.svg" });
276
+ *
277
+ * // Direct content
278
+ * const svgFromContent = Svg({
279
+ * content: `<svg viewBox="0 0 100 100">
280
+ * <circle cx="50" cy="50" r="40" fill="blue"/>
281
+ * </svg>`
282
+ * });
283
+ *
284
+ * // Legacy usage
285
+ * const svgLegacy = Svg({ svg: "<svg>...</svg>" });
286
+ * ```
287
+ */
142
288
  export function Svg(props: SvgProps) {
143
289
  return Graphics({
144
- draw: (g) => g.svg(props.svg),
290
+ draw: async (g) => {
291
+ if (props.src) {
292
+ // Load SVG from source URL with graphics context parsing
293
+ const svgData = await Assets.load({
294
+ src: props.src,
295
+ data: {
296
+ parseAsGraphicsContext: true,
297
+ },
298
+ });
299
+
300
+ // Apply the loaded graphics context
301
+ const graphics = new PixiGraphics(svgData);
302
+ g.context = graphics.context;
303
+ } else if (props.content) {
304
+ // Render SVG directly from content string
305
+ g.svg(props.content);
306
+ } else if (props.svg) {
307
+ // Legacy prop support
308
+ g.svg(props.svg);
309
+ }
310
+ },
145
311
  ...props
146
312
  })
147
- }
313
+ }