@caperjs/solid 0.7.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 +191 -0
- package/jsx.d.ts +39 -0
- package/lib/AnimatedShow.d.ts +25 -0
- package/lib/AnimatedShow.d.ts.map +1 -0
- package/lib/AnimatedShow.test.d.ts +2 -0
- package/lib/AnimatedShow.test.d.ts.map +1 -0
- package/lib/Composable.d.ts +39 -0
- package/lib/Composable.d.ts.map +1 -0
- package/lib/Composable.test.d.ts +2 -0
- package/lib/Composable.test.d.ts.map +1 -0
- package/lib/animated.d.ts +16 -0
- package/lib/animated.d.ts.map +1 -0
- package/lib/animated.test.d.ts +2 -0
- package/lib/animated.test.d.ts.map +1 -0
- package/lib/asComponent.d.ts +19 -0
- package/lib/asComponent.d.ts.map +1 -0
- package/lib/asComponent.test.d.ts +2 -0
- package/lib/asComponent.test.d.ts.map +1 -0
- package/lib/caper-plugin-solid.mjs +337 -0
- package/lib/caper-plugin-solid.mjs.map +1 -0
- package/lib/catalog.d.ts +17 -0
- package/lib/catalog.d.ts.map +1 -0
- package/lib/index.d.ts +9 -0
- package/lib/index.d.ts.map +1 -0
- package/lib/renderer.d.ts +4 -0
- package/lib/renderer.d.ts.map +1 -0
- package/lib/renderer.test.d.ts +2 -0
- package/lib/renderer.test.d.ts.map +1 -0
- package/lib/useTick.d.ts +4 -0
- package/lib/useTick.d.ts.map +1 -0
- package/lib/useTick.test.d.ts +2 -0
- package/lib/useTick.test.d.ts.map +1 -0
- package/lib/version.d.ts +2 -0
- package/lib/version.d.ts.map +1 -0
- package/package.json +66 -0
- package/src/AnimatedShow.test.tsx +146 -0
- package/src/AnimatedShow.tsx +87 -0
- package/src/Composable.test.ts +214 -0
- package/src/Composable.ts +84 -0
- package/src/animated.test.ts +94 -0
- package/src/animated.ts +39 -0
- package/src/asComponent.test.ts +168 -0
- package/src/asComponent.ts +37 -0
- package/src/catalog.ts +28 -0
- package/src/index.ts +11 -0
- package/src/renderer.test.ts +272 -0
- package/src/renderer.ts +155 -0
- package/src/useTick.test.ts +28 -0
- package/src/useTick.ts +10 -0
- package/src/version.ts +1 -0
- package/vite.d.mts +10 -0
- package/vite.mjs +25 -0
package/src/useTick.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Application } from '@caperjs/core';
|
|
2
|
+
import type { Ticker } from 'pixi.js';
|
|
3
|
+
import { onCleanup } from 'solid-js';
|
|
4
|
+
|
|
5
|
+
/** Run `fn` every frame for the lifetime of the owning component. */
|
|
6
|
+
export function useTick(fn: (ticker: Ticker) => void) {
|
|
7
|
+
const app = Application.getInstance();
|
|
8
|
+
app.ticker.add(fn);
|
|
9
|
+
onCleanup(() => app.ticker.remove(fn));
|
|
10
|
+
}
|
package/src/version.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const version = '0.7.0';
|
package/vite.d.mts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { PluginOption } from 'vite';
|
|
2
|
+
|
|
3
|
+
export interface CaperSolidOptions {
|
|
4
|
+
/** Which files are compiled as JSX. Default `['**\/*.tsx']`. */
|
|
5
|
+
include?: string[];
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
/** `vite-plugin-solid`, configured for Caper's universal (Pixi) renderer. */
|
|
9
|
+
export declare function caperSolid(options?: CaperSolidOptions): PluginOption;
|
|
10
|
+
export default caperSolid;
|
package/vite.mjs
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
// `@caperjs/solid/vite` — the build-time half of the package.
|
|
2
|
+
//
|
|
3
|
+
// Apps never import this directly: `caper({ solid: true })` in `@caperjs/core`'s
|
|
4
|
+
// Vite preset resolves it from the app's own `node_modules`. Shipping it here
|
|
5
|
+
// keeps the dependency arrow pointing one way — core knows the specifier, not
|
|
6
|
+
// the package.
|
|
7
|
+
|
|
8
|
+
import solid from 'vite-plugin-solid';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* `vite-plugin-solid`, configured for Caper's universal (Pixi) renderer.
|
|
12
|
+
*
|
|
13
|
+
* @param {{ include?: string[] }} [options] `include` overrides which files are
|
|
14
|
+
* compiled as JSX (default `['**\/*.tsx']`).
|
|
15
|
+
* @returns {import('vite').PluginOption}
|
|
16
|
+
*/
|
|
17
|
+
export function caperSolid(options = {}) {
|
|
18
|
+
return solid({
|
|
19
|
+
include: options.include ?? ['**/*.tsx'],
|
|
20
|
+
hot: false,
|
|
21
|
+
solid: { generate: 'universal', moduleName: '@caperjs/solid' },
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export default caperSolid;
|