@number10/phaserjsx 4.0.0 → 4.2.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/README.md +30 -0
- package/dist/chunk-C2EiDwsr.cjs +35 -0
- package/dist/clip/index.cjs +8 -0
- package/dist/clip/index.d.ts +3 -0
- package/dist/clip/index.d.ts.map +1 -0
- package/dist/clip/index.js +2 -0
- package/dist/clip/stencil-clip-depth.d.ts +10 -0
- package/dist/clip/stencil-clip-depth.d.ts.map +1 -0
- package/dist/clip/stencil-clip-extension.d.ts +18 -0
- package/dist/clip/stencil-clip-extension.d.ts.map +1 -0
- package/dist/clip/stencil-clip-fbo-bridge.d.ts +7 -0
- package/dist/clip/stencil-clip-fbo-bridge.d.ts.map +1 -0
- package/dist/clip/stencil-clip-renderer.d.ts +7 -0
- package/dist/clip/stencil-clip-renderer.d.ts.map +1 -0
- package/dist/clip/stencil-clip-state.d.ts +28 -0
- package/dist/clip/stencil-clip-state.d.ts.map +1 -0
- package/dist/clip/stencil-clip-types.d.ts +67 -0
- package/dist/clip/stencil-clip-types.d.ts.map +1 -0
- package/dist/clip/stencil-clip.d.ts +9 -42
- package/dist/clip/stencil-clip.d.ts.map +1 -1
- package/dist/clip-CHmjztBQ.cjs +705 -0
- package/dist/clip-CHmjztBQ.cjs.map +1 -0
- package/dist/clip-CPufWCSD.js +668 -0
- package/dist/clip-CPufWCSD.js.map +1 -0
- package/dist/components/appliers/applyBackground.d.ts +2 -1
- package/dist/components/appliers/applyBackground.d.ts.map +1 -1
- package/dist/components/appliers/applyTooltip.d.ts.map +1 -1
- package/dist/components/backgroundImage.d.ts +12 -0
- package/dist/components/backgroundImage.d.ts.map +1 -0
- package/dist/components/creators/createBackground.d.ts +2 -1
- package/dist/components/creators/createBackground.d.ts.map +1 -1
- package/dist/components/custom/Accordion.d.ts.map +1 -1
- package/dist/components/custom/DebugPanel.d.ts +30 -0
- package/dist/components/custom/DebugPanel.d.ts.map +1 -0
- package/dist/components/custom/Dropdown.d.ts.map +1 -1
- package/dist/components/custom/Toggle.d.ts.map +1 -1
- package/dist/components/custom/index.cjs +2 -1
- package/dist/components/custom/index.d.ts +1 -0
- package/dist/components/custom/index.d.ts.map +1 -1
- package/dist/components/custom/index.js +2 -2
- package/dist/components/primitives/graphics.d.ts +2 -2
- package/dist/components/primitives/view.d.ts.map +1 -1
- package/dist/{custom-oy3mBnrW.js → custom-BXDJDGOl.js} +439 -485
- package/dist/custom-BXDJDGOl.js.map +1 -0
- package/dist/{custom-BN31OAJq.cjs → custom-DTd4LxDn.cjs} +459 -518
- package/dist/custom-DTd4LxDn.cjs.map +1 -0
- package/dist/gestures/gesture-manager.d.ts +1 -1
- package/dist/hooks.d.ts +9 -8
- package/dist/hooks.d.ts.map +1 -1
- package/dist/index.cjs +105 -106
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +96 -105
- package/dist/index.js.map +1 -1
- package/dist/layout/appliers/background-applier.d.ts.map +1 -1
- package/dist/layout/layout-engine.d.ts.map +1 -1
- package/dist/layout/types.d.ts +2 -1
- package/dist/layout/types.d.ts.map +1 -1
- package/dist/scene-backgrounds.d.ts +51 -1
- package/dist/scene-backgrounds.d.ts.map +1 -1
- package/package.json +8 -2
- package/dist/custom-BN31OAJq.cjs.map +0 -1
- package/dist/custom-oy3mBnrW.js.map +0 -1
|
@@ -97,7 +97,7 @@ export declare class GestureManager {
|
|
|
97
97
|
/**
|
|
98
98
|
* Handle global pointer down event
|
|
99
99
|
* Registers all containers that were hit for move event tracking
|
|
100
|
-
* Only the topmost gets touch/
|
|
100
|
+
* Only the topmost gets touch/long-press callbacks
|
|
101
101
|
*/
|
|
102
102
|
private handlePointerDown;
|
|
103
103
|
/**
|
package/dist/hooks.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { BackgroundImage } from './components/backgroundImage';
|
|
1
2
|
import { Signal } from '@preact/signals-core';
|
|
2
3
|
import { BackgroundProps, LayoutProps, TransformProps } from './core-props';
|
|
3
4
|
import { LayoutSize } from './layout/types';
|
|
@@ -144,23 +145,23 @@ export declare function useLayoutSize(ref: {
|
|
|
144
145
|
*/
|
|
145
146
|
export declare function getLayoutProps(container: Phaser.GameObjects.Container | null | undefined): (LayoutProps & BackgroundProps & TransformProps) | undefined;
|
|
146
147
|
/**
|
|
147
|
-
* Utility function to get background
|
|
148
|
-
* Returns the
|
|
148
|
+
* Utility function to get background object from a container
|
|
149
|
+
* Returns the Image object used for backgroundColor, border, cornerRadius
|
|
149
150
|
* Useful for custom animations or modifications
|
|
150
151
|
* @param container - Phaser container with background
|
|
151
|
-
* @returns
|
|
152
|
+
* @returns Background image or undefined if container has no background
|
|
152
153
|
*/
|
|
153
|
-
export declare function getBackgroundGraphics(container: Phaser.GameObjects.Container | null | undefined):
|
|
154
|
+
export declare function getBackgroundGraphics(container: Phaser.GameObjects.Container | null | undefined): BackgroundImage | undefined;
|
|
154
155
|
/**
|
|
155
|
-
* Hook to get background
|
|
156
|
-
* Returns the
|
|
156
|
+
* Hook to get background image from a ref
|
|
157
|
+
* Returns the Image object used for rendering the background
|
|
157
158
|
* Useful for animating background properties (tint, alpha, etc.)
|
|
158
159
|
* @param ref - Ref to a Phaser container
|
|
159
|
-
* @returns
|
|
160
|
+
* @returns Background image or undefined
|
|
160
161
|
*/
|
|
161
162
|
export declare function useBackgroundGraphics(ref: {
|
|
162
163
|
current: Phaser.GameObjects.Container | null;
|
|
163
|
-
}):
|
|
164
|
+
}): BackgroundImage | undefined;
|
|
164
165
|
/**
|
|
165
166
|
* Utility function to get layout rectangle (position + size) from a container
|
|
166
167
|
* Returns local position (x, y) combined with layout size
|
package/dist/hooks.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hooks.d.ts","sourceRoot":"","sources":["../src/hooks.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,KAAK,KAAK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AK,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,GAAG,SAAS,CAwBrE;AAED;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAAC,GAAG,EAAE;IACtC,OAAO,EAAE,MAAM,CAAC,WAAW,CAAC,SAAS,GAAG,IAAI,CAAA;CAC7C,GAAG;IAAE,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,GAAG,SAAS,CAEtE;AAED;;;;GAIG;AACH,wBAAgB,SAAS,CAAC,EAAE,EAAE,MAAM,OAAO,EAAE,IAAI,CAAC,EAAE,SAAS,OAAO,EAAE,GAAG,SAAS,QAiBjF;AAED;;;;;;GAMG;AACH,wBAAgB,eAAe,CAAC,EAAE,EAAE,MAAM,OAAO,EAAE,IAAI,CAAC,EAAE,SAAS,OAAO,EAAE,GAAG,SAAS,QAuBvF;AAiBD;;;;;;GAMG;AACH,wBAAgB,YAAY,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,OAAO,GAAG,OAAO,CA0B5D;AAED;;;;;;GAMG;AACH,wBAAgB,qBAAqB,CAAC,GAAG,EAAE,GAAG,EAAE,QAAQ,EAAE,OAAO,GAAG,OAAO,CAoB1E;AAED;;;GAGG;AACH,wBAAgB,SAAS,IAAI,MAAM,IAAI,CAKtC;AA6CD,wBAAgB,UAAU,CAAC,CAAC,EAAE,GAAG,QA2BhC"}
|
package/dist/index.cjs
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const
|
|
2
|
+
const require_chunk = require("./chunk-C2EiDwsr.cjs");
|
|
3
|
+
const require_custom = require("./custom-DTd4LxDn.cjs");
|
|
3
4
|
const require_jsx_runtime = require("./jsx-runtime.cjs");
|
|
5
|
+
const require_clip = require("./clip-CHmjztBQ.cjs");
|
|
4
6
|
let phaser = require("phaser");
|
|
5
|
-
phaser =
|
|
7
|
+
phaser = require_chunk.__toESM(phaser, 1);
|
|
6
8
|
let _preact_signals_core = require("@preact/signals-core");
|
|
7
9
|
//#region src/camera/use-camera-fx.ts
|
|
8
10
|
/**
|
|
@@ -734,37 +736,95 @@ function useParticles(ref) {
|
|
|
734
736
|
//#endregion
|
|
735
737
|
//#region src/scene-backgrounds.ts
|
|
736
738
|
var DEFAULT_LOGO_KEY = "phaser-jsx-logo";
|
|
739
|
+
/**
|
|
740
|
+
* Default scene background used when no explicit config is provided.
|
|
741
|
+
*/
|
|
737
742
|
var DEFAULT_BACKGROUND = {
|
|
738
743
|
type: "grid",
|
|
739
744
|
animation: "lemniscate",
|
|
740
745
|
opacity: .15,
|
|
741
746
|
color: 4890367
|
|
742
747
|
};
|
|
748
|
+
var sceneBackgroundTextureId = 0;
|
|
749
|
+
function colorToCss(color) {
|
|
750
|
+
return `#${color.toString(16).padStart(6, "0")}`;
|
|
751
|
+
}
|
|
752
|
+
function createCanvasTexture(scene, width, height, draw) {
|
|
753
|
+
const textureKey = `__phaserjsx_scene_bg_${sceneBackgroundTextureId++}`;
|
|
754
|
+
const textureWidth = Math.max(1, Math.ceil(width));
|
|
755
|
+
const textureHeight = Math.max(1, Math.ceil(height));
|
|
756
|
+
const texture = scene.textures.createCanvas(textureKey, textureWidth, textureHeight);
|
|
757
|
+
if (!texture) throw new Error("Unable to create scene background texture");
|
|
758
|
+
const ctx = texture.getSourceImage().getContext("2d");
|
|
759
|
+
if (!ctx) throw new Error("Unable to create scene background canvas texture");
|
|
760
|
+
ctx.clearRect(0, 0, textureWidth, textureHeight);
|
|
761
|
+
draw(ctx, textureWidth, textureHeight);
|
|
762
|
+
texture.refresh();
|
|
763
|
+
return textureKey;
|
|
764
|
+
}
|
|
765
|
+
function removeTexture(scene, textureKey) {
|
|
766
|
+
if (textureKey && scene.textures.exists(textureKey)) scene.textures.remove(textureKey);
|
|
767
|
+
}
|
|
768
|
+
/**
|
|
769
|
+
* Adds a decorative background object to a Phaser scene.
|
|
770
|
+
*
|
|
771
|
+
* The helper owns all game objects, tweens, resize listeners, and generated textures it creates.
|
|
772
|
+
* It automatically cleans up on scene shutdown or destroy. Call `handle.destroy()` when removing
|
|
773
|
+
* the background earlier.
|
|
774
|
+
*
|
|
775
|
+
* @param scene - Phaser scene that receives the background.
|
|
776
|
+
* @param config - Background type, colors, opacity, animation, and optional logo texture key.
|
|
777
|
+
* @returns A handle for manual resize and cleanup, or `null` when `config.type` is `'none'`.
|
|
778
|
+
*
|
|
779
|
+
* @example
|
|
780
|
+
* ```ts
|
|
781
|
+
* const handle = addSceneBackground(scene, {
|
|
782
|
+
* type: 'grid',
|
|
783
|
+
* animation: 'wave',
|
|
784
|
+
* color: 0x4a9eff,
|
|
785
|
+
* opacity: 0.12,
|
|
786
|
+
* })
|
|
787
|
+
*
|
|
788
|
+
* // Later, if the background should be removed before scene shutdown:
|
|
789
|
+
* handle?.destroy()
|
|
790
|
+
* ```
|
|
791
|
+
*/
|
|
743
792
|
function addSceneBackground(scene, config = DEFAULT_BACKGROUND) {
|
|
744
793
|
const bgConfig = config ?? DEFAULT_BACKGROUND;
|
|
745
794
|
if (bgConfig.type === "none") return null;
|
|
746
795
|
let background;
|
|
747
796
|
let backgroundTween;
|
|
748
797
|
const particleTweens = [];
|
|
798
|
+
const textureKeys = /* @__PURE__ */ new Set();
|
|
749
799
|
let resizeFn;
|
|
750
800
|
let destroyed = false;
|
|
751
801
|
const createGridBackground = () => {
|
|
752
|
-
const graphics = scene.add.graphics();
|
|
753
802
|
const gridSize = 40;
|
|
754
803
|
const color = bgConfig.color ?? 4890367;
|
|
755
804
|
const opacity = bgConfig.opacity ?? .15;
|
|
756
|
-
const
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
805
|
+
const textureKey = createCanvasTexture(scene, gridSize, gridSize, (ctx, width, height) => {
|
|
806
|
+
ctx.globalAlpha = opacity;
|
|
807
|
+
ctx.strokeStyle = colorToCss(color);
|
|
808
|
+
ctx.lineWidth = 1;
|
|
809
|
+
ctx.beginPath();
|
|
810
|
+
ctx.moveTo(.5, 0);
|
|
811
|
+
ctx.lineTo(.5, height);
|
|
812
|
+
ctx.moveTo(0, .5);
|
|
813
|
+
ctx.lineTo(width, .5);
|
|
814
|
+
ctx.stroke();
|
|
815
|
+
});
|
|
816
|
+
textureKeys.add(textureKey);
|
|
817
|
+
const tile = scene.add.tileSprite(0, 0, scene.scale.width, scene.scale.height, textureKey);
|
|
818
|
+
tile.setOrigin(0, 0);
|
|
819
|
+
const moveGrid = (offsetX, offsetY) => {
|
|
820
|
+
tile.tilePositionX = -offsetX;
|
|
821
|
+
tile.tilePositionY = -offsetY;
|
|
822
|
+
};
|
|
823
|
+
tile.__redrawFn = moveGrid;
|
|
824
|
+
background = tile;
|
|
825
|
+
resizeFn = (width, height) => {
|
|
826
|
+
tile.setSize(width, height);
|
|
763
827
|
};
|
|
764
|
-
drawGrid(0, 0);
|
|
765
|
-
graphics.__redrawFn = drawGrid;
|
|
766
|
-
background = graphics;
|
|
767
|
-
resizeFn = () => drawGrid(0, 0);
|
|
768
828
|
};
|
|
769
829
|
const createLogoBackground = () => {
|
|
770
830
|
const container = scene.add.container(scene.scale.width / 2, scene.scale.height / 2);
|
|
@@ -780,18 +840,31 @@ function addSceneBackground(scene, config = DEFAULT_BACKGROUND) {
|
|
|
780
840
|
};
|
|
781
841
|
};
|
|
782
842
|
const createGradientBackground = () => {
|
|
783
|
-
const graphics = scene.add.graphics();
|
|
784
843
|
const color1 = bgConfig.color ?? 4890367;
|
|
785
844
|
const color2 = bgConfig.colorSecondary ?? 7031551;
|
|
786
845
|
const opacity = bgConfig.opacity ?? .2;
|
|
787
|
-
const
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
846
|
+
const createGradientTexture = (width, height) => createCanvasTexture(scene, width, height, (ctx, textureWidth, textureHeight) => {
|
|
847
|
+
const gradient = ctx.createLinearGradient(0, 0, 0, textureHeight);
|
|
848
|
+
gradient.addColorStop(0, colorToCss(color1));
|
|
849
|
+
gradient.addColorStop(1, colorToCss(color2));
|
|
850
|
+
ctx.globalAlpha = opacity;
|
|
851
|
+
ctx.fillStyle = gradient;
|
|
852
|
+
ctx.fillRect(0, 0, textureWidth, textureHeight);
|
|
853
|
+
});
|
|
854
|
+
let textureKey = createGradientTexture(scene.scale.width, scene.scale.height);
|
|
855
|
+
textureKeys.add(textureKey);
|
|
856
|
+
const image = scene.add.image(0, 0, textureKey);
|
|
857
|
+
image.setOrigin(0, 0);
|
|
858
|
+
resizeFn = (width, height) => {
|
|
859
|
+
const previousTextureKey = textureKey;
|
|
860
|
+
textureKey = createGradientTexture(width, height);
|
|
861
|
+
textureKeys.add(textureKey);
|
|
862
|
+
image.setTexture(textureKey);
|
|
863
|
+
image.setDisplaySize(width, height);
|
|
864
|
+
textureKeys.delete(previousTextureKey);
|
|
865
|
+
removeTexture(scene, previousTextureKey);
|
|
791
866
|
};
|
|
792
|
-
|
|
793
|
-
background = graphics;
|
|
794
|
-
resizeFn = drawGradient;
|
|
867
|
+
background = image;
|
|
795
868
|
};
|
|
796
869
|
const createParticlesBackground = () => {
|
|
797
870
|
const container = scene.add.container(0, 0);
|
|
@@ -848,6 +921,8 @@ function addSceneBackground(scene, config = DEFAULT_BACKGROUND) {
|
|
|
848
921
|
for (const tween of particleTweens) tween.stop();
|
|
849
922
|
background?.destroy();
|
|
850
923
|
background = void 0;
|
|
924
|
+
for (const textureKey of textureKeys) removeTexture(scene, textureKey);
|
|
925
|
+
textureKeys.clear();
|
|
851
926
|
scene.scale.off(phaser.Scale.Events.RESIZE, onResize);
|
|
852
927
|
scene.events.off(phaser.Scenes.Events.SHUTDOWN, cleanup);
|
|
853
928
|
scene.events.off(phaser.Scenes.Events.DESTROY, cleanup);
|
|
@@ -1329,89 +1404,6 @@ function getAvailablePresets() {
|
|
|
1329
1404
|
];
|
|
1330
1405
|
}
|
|
1331
1406
|
//#endregion
|
|
1332
|
-
//#region src/design-tokens/use-theme-tokens.ts
|
|
1333
|
-
/**
|
|
1334
|
-
* Hook to access complete design token system
|
|
1335
|
-
* Combines colors with text styles, spacing, sizes, and radius tokens
|
|
1336
|
-
*/
|
|
1337
|
-
/**
|
|
1338
|
-
* Hook to access complete design token system from theme context
|
|
1339
|
-
* Provides colors, text styles, spacing, sizes, and radius tokens
|
|
1340
|
-
* Automatically updates when color mode or preset changes
|
|
1341
|
-
* @returns Current DesignTokens or undefined
|
|
1342
|
-
* @example
|
|
1343
|
-
* ```typescript
|
|
1344
|
-
* function MyComponent() {
|
|
1345
|
-
* const tokens = useThemeTokens()
|
|
1346
|
-
*
|
|
1347
|
-
* if (!tokens) return null
|
|
1348
|
-
*
|
|
1349
|
-
* return (
|
|
1350
|
-
* <View
|
|
1351
|
-
* backgroundColor={tokens.colors.surface.DEFAULT}
|
|
1352
|
-
* padding={tokens.spacing.lg}
|
|
1353
|
-
* cornerRadius={tokens.radius.md}
|
|
1354
|
-
* >
|
|
1355
|
-
* <Text text="Title" style={tokens.textStyles.title} />
|
|
1356
|
-
* <Text text="Body text" style={tokens.textStyles.DEFAULT} />
|
|
1357
|
-
* </View>
|
|
1358
|
-
* )
|
|
1359
|
-
* }
|
|
1360
|
-
* ```
|
|
1361
|
-
*/
|
|
1362
|
-
function useThemeTokens() {
|
|
1363
|
-
const localTheme = require_custom.useTheme();
|
|
1364
|
-
const getInitialTokens = () => {
|
|
1365
|
-
if (localTheme?.__colorPreset) {
|
|
1366
|
-
const preset = require_custom.getPresetWithMode(localTheme.__colorPreset.name, localTheme.__colorPreset.mode ?? "light");
|
|
1367
|
-
return {
|
|
1368
|
-
colors: preset.colors,
|
|
1369
|
-
textStyles: require_custom.createTextStyleTokens(preset.colors.text.DEFAULT.toString()),
|
|
1370
|
-
spacing: require_custom.defaultSpacingTokens,
|
|
1371
|
-
sizes: require_custom.defaultSizeTokens,
|
|
1372
|
-
radius: require_custom.defaultRadiusTokens
|
|
1373
|
-
};
|
|
1374
|
-
}
|
|
1375
|
-
const colors = require_custom.themeRegistry.getColorTokens();
|
|
1376
|
-
if (!colors) return void 0;
|
|
1377
|
-
return {
|
|
1378
|
-
colors,
|
|
1379
|
-
textStyles: require_custom.createTextStyleTokens(colors.text.DEFAULT.toString()),
|
|
1380
|
-
spacing: require_custom.defaultSpacingTokens,
|
|
1381
|
-
sizes: require_custom.defaultSizeTokens,
|
|
1382
|
-
radius: require_custom.defaultRadiusTokens
|
|
1383
|
-
};
|
|
1384
|
-
};
|
|
1385
|
-
const [tokens, setTokens] = require_custom.useState(getInitialTokens());
|
|
1386
|
-
const [, forceUpdate] = require_custom.useState(0);
|
|
1387
|
-
require_custom.useEffect(() => {
|
|
1388
|
-
return require_custom.themeRegistry.subscribe(() => {
|
|
1389
|
-
if (localTheme?.__colorPreset) {
|
|
1390
|
-
const currentMode = require_custom.themeRegistry.getColorMode();
|
|
1391
|
-
const preset = require_custom.getPresetWithMode(localTheme.__colorPreset.name, currentMode);
|
|
1392
|
-
setTokens({
|
|
1393
|
-
colors: preset.colors,
|
|
1394
|
-
textStyles: require_custom.createTextStyleTokens(preset.colors.text.DEFAULT.toString()),
|
|
1395
|
-
spacing: require_custom.defaultSpacingTokens,
|
|
1396
|
-
sizes: require_custom.defaultSizeTokens,
|
|
1397
|
-
radius: require_custom.defaultRadiusTokens
|
|
1398
|
-
});
|
|
1399
|
-
} else {
|
|
1400
|
-
const colors = require_custom.themeRegistry.getColorTokens();
|
|
1401
|
-
if (colors) setTokens({
|
|
1402
|
-
colors,
|
|
1403
|
-
textStyles: require_custom.createTextStyleTokens(colors.text.DEFAULT.toString()),
|
|
1404
|
-
spacing: require_custom.defaultSpacingTokens,
|
|
1405
|
-
sizes: require_custom.defaultSizeTokens,
|
|
1406
|
-
radius: require_custom.defaultRadiusTokens
|
|
1407
|
-
});
|
|
1408
|
-
}
|
|
1409
|
-
forceUpdate((n) => n + 1);
|
|
1410
|
-
});
|
|
1411
|
-
}, [localTheme]);
|
|
1412
|
-
return tokens;
|
|
1413
|
-
}
|
|
1414
|
-
//#endregion
|
|
1415
1407
|
//#region src/index.ts
|
|
1416
1408
|
/**
|
|
1417
1409
|
* PhaserJSX UI Library
|
|
@@ -1432,6 +1424,7 @@ exports.DEFAULT_FX = DEFAULT_FX;
|
|
|
1432
1424
|
exports.DEFAULT_SPRING_CONFIG = require_custom.DEFAULT_SPRING_CONFIG;
|
|
1433
1425
|
exports.DOMInputElement = require_custom.DOMInputElement;
|
|
1434
1426
|
exports.DebugLogger = require_custom.DebugLogger;
|
|
1427
|
+
exports.DebugPanel = require_custom.DebugPanel;
|
|
1435
1428
|
exports.DevConfig = require_custom.DevConfig;
|
|
1436
1429
|
exports.DevPresets = require_custom.DevPresets;
|
|
1437
1430
|
exports.Dialog = require_custom.Dialog;
|
|
@@ -1481,10 +1474,12 @@ exports.applyDarkMode = require_custom.applyDarkMode;
|
|
|
1481
1474
|
exports.applyEffectByName = require_custom.applyEffectByName;
|
|
1482
1475
|
exports.applyFXByName = applyFXByName;
|
|
1483
1476
|
exports.applyLightMode = require_custom.applyLightMode;
|
|
1477
|
+
exports.applyStencilClip = require_clip.applyStencilClip;
|
|
1484
1478
|
exports.buildDeathZonesFromLayout = require_custom.buildDeathZonesFromLayout;
|
|
1485
1479
|
exports.buildEmitZone = require_custom.buildEmitZone;
|
|
1486
1480
|
exports.buildEmitZoneFromLayout = require_custom.buildEmitZoneFromLayout;
|
|
1487
1481
|
exports.calculateSliderSize = require_custom.calculateSliderSize;
|
|
1482
|
+
exports.clearStencilClip = require_clip.clearStencilClip;
|
|
1488
1483
|
exports.colorsToTheme = colorsToTheme;
|
|
1489
1484
|
exports.computed = _preact_signals_core.computed;
|
|
1490
1485
|
exports.createBlurFX = createBlurFX;
|
|
@@ -1551,6 +1546,7 @@ exports.getMountStats = require_custom.getMountStats;
|
|
|
1551
1546
|
exports.getPreset = require_custom.getPreset;
|
|
1552
1547
|
exports.getPresetWithMode = require_custom.getPresetWithMode;
|
|
1553
1548
|
exports.getRenderContext = require_custom.getRenderContext;
|
|
1549
|
+
exports.getStencilClipHandle = require_clip.getStencilClipHandle;
|
|
1554
1550
|
exports.getSurfaceColor = getSurfaceColor;
|
|
1555
1551
|
exports.getTextColor = getTextColor;
|
|
1556
1552
|
exports.getThemedProps = require_custom.getThemedProps;
|
|
@@ -1562,7 +1558,9 @@ exports.hexToNumber = require_custom.hexToNumber;
|
|
|
1562
1558
|
exports.host = require_custom.host;
|
|
1563
1559
|
exports.imageCreator = require_custom.imageCreator;
|
|
1564
1560
|
exports.imagePatcher = require_custom.imagePatcher;
|
|
1561
|
+
exports.installStencilClipExtension = require_clip.installStencilClipExtension;
|
|
1565
1562
|
exports.isAnimatedSignal = require_custom.isAnimatedSignal;
|
|
1563
|
+
exports.isBitmapStencilClipSource = require_clip.isBitmapStencilClipSource;
|
|
1566
1564
|
exports.jsx = require_jsx_runtime.jsx;
|
|
1567
1565
|
exports.jsxs = require_jsx_runtime.jsxs;
|
|
1568
1566
|
exports.lighten = require_custom.lighten;
|
|
@@ -1613,6 +1611,7 @@ exports.textPatcher = require_custom.textPatcher;
|
|
|
1613
1611
|
exports.themeRegistry = require_custom.themeRegistry;
|
|
1614
1612
|
exports.tileSpriteCreator = require_custom.tileSpriteCreator;
|
|
1615
1613
|
exports.tileSpritePatcher = require_custom.tileSpritePatcher;
|
|
1614
|
+
exports.uninstallStencilClipExtension = require_clip.uninstallStencilClipExtension;
|
|
1616
1615
|
exports.unmount = require_custom.unmount;
|
|
1617
1616
|
exports.unmountJSX = require_custom.unmountJSX;
|
|
1618
1617
|
exports.unwrapSignal = require_custom.unwrapSignal;
|
|
@@ -1648,7 +1647,7 @@ exports.useSprings = require_custom.useSprings;
|
|
|
1648
1647
|
exports.useState = require_custom.useState;
|
|
1649
1648
|
exports.useTheme = require_custom.useTheme;
|
|
1650
1649
|
exports.useThemeSubscription = useThemeSubscription;
|
|
1651
|
-
exports.useThemeTokens = useThemeTokens;
|
|
1650
|
+
exports.useThemeTokens = require_custom.useThemeTokens;
|
|
1652
1651
|
exports.useViewportSize = require_custom.useViewportSize;
|
|
1653
1652
|
exports.useWorldLayoutRect = require_custom.useWorldLayoutRect;
|
|
1654
1653
|
exports.viewCreator = require_custom.viewCreator;
|