oneko 0.0.0-stage → 0.3.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 +21 -0
- package/README.md +97 -2
- package/SKIN-CREDITS.md +61 -0
- package/dist/adapter.d.ts +1 -0
- package/dist/adapter.js +11 -0
- package/dist/cat-sounds/Cat_baby_ambient1.ogg +0 -0
- package/dist/cat-sounds/Cat_baby_ambient2.ogg +0 -0
- package/dist/cat-sounds/Cat_baby_ambient3.ogg +0 -0
- package/dist/cat-sounds/Cat_baby_ambient4.ogg +0 -0
- package/dist/cat-sounds/Cat_baby_ambient5.ogg +0 -0
- package/dist/cat-sounds/Cat_baby_ambient6.ogg +0 -0
- package/dist/cat-sounds/Cat_baby_ambient7.ogg +0 -0
- package/dist/cat-sounds/Cat_baby_death.ogg +0 -0
- package/dist/cat-sounds/Cat_baby_hurt1.ogg +0 -0
- package/dist/cat-sounds/Cat_baby_hurt2.ogg +0 -0
- package/dist/cat-sounds/Cat_baby_hurt3.ogg +0 -0
- package/dist/cat-sounds/Cat_beg1.ogg +0 -0
- package/dist/cat-sounds/Cat_beg2.ogg +0 -0
- package/dist/cat-sounds/Cat_beg3.ogg +0 -0
- package/dist/cat-sounds/Cat_eat1.ogg +0 -0
- package/dist/cat-sounds/Cat_eat2.ogg +0 -0
- package/dist/cat-sounds/Cat_hiss1.ogg +0 -0
- package/dist/cat-sounds/Cat_hiss2.ogg +0 -0
- package/dist/cat-sounds/Cat_hiss3.ogg +0 -0
- package/dist/cat-sounds/Cat_hurt1.ogg +0 -0
- package/dist/cat-sounds/Cat_hurt2.ogg +0 -0
- package/dist/cat-sounds/Cat_hurt3.ogg +0 -0
- package/dist/cat-sounds/Cat_idle1.ogg +0 -0
- package/dist/cat-sounds/Cat_idle2.ogg +0 -0
- package/dist/cat-sounds/Cat_idle3.ogg +0 -0
- package/dist/cat-sounds/Cat_idle4.ogg +0 -0
- package/dist/cat-sounds/Cat_purr1.ogg +0 -0
- package/dist/cat-sounds/Cat_purr2.ogg +0 -0
- package/dist/cat-sounds/Cat_purr3.ogg +0 -0
- package/dist/cat-sounds/Cat_purreow1.ogg +0 -0
- package/dist/cat-sounds/Cat_purreow2.ogg +0 -0
- package/dist/cat-sounds/Cat_royal_ambient1.ogg +0 -0
- package/dist/cat-sounds/Cat_royal_ambient2.ogg +0 -0
- package/dist/cat-sounds/Cat_royal_ambient3.ogg +0 -0
- package/dist/cat-sounds/Cat_royal_ambient4.ogg +0 -0
- package/dist/cat-sounds/Cat_royal_ambient5.ogg +1 -0
- package/dist/cat-sounds/Cat_royal_ambient6.ogg +1 -0
- package/dist/cat-sounds/Cat_royal_death.ogg +1 -0
- package/dist/cat-sounds/Cat_royal_hurt1.ogg +1 -0
- package/dist/cat-sounds/Cat_royal_hurt2.ogg +1 -0
- package/dist/cat-sounds/Cat_royal_hurt3.ogg +1 -0
- package/dist/cat-sounds/Stray_cat_idle1.ogg +1 -0
- package/dist/cat-sounds/Stray_cat_idle2.ogg +1 -0
- package/dist/cat-sounds/Stray_cat_idle3.ogg +1 -0
- package/dist/cat-sounds/Stray_cat_idle4.ogg +1 -0
- package/dist/chunks/skin-sheets-CG0yKeZb.js +71 -0
- package/dist/chunks/vanilla-CUrawvWx.js +2993 -0
- package/dist/index.js +286 -0
- package/dist/solid.js +17 -0
- package/dist/svelte/Oneko.svelte +17 -0
- package/dist/svelte/Oneko.svelte.d.ts +4 -0
- package/dist/types/components/laser-cursor.d.ts +3 -0
- package/dist/types/components/oneko.d.ts +11 -0
- package/dist/types/hooks/use-cat-animation.d.ts +23 -0
- package/dist/types/hooks/use-motion-allowed.d.ts +3 -0
- package/dist/types/hooks/use-oneko-props-sync.d.ts +14 -0
- package/dist/types/hooks/use-skin-source.d.ts +3 -0
- package/dist/types/hooks/use-sprite-appearance.d.ts +6 -0
- package/dist/types/lib/oneko/animation/activity.d.ts +5 -0
- package/dist/types/lib/oneko/animation/attention.d.ts +13 -0
- package/dist/types/lib/oneko/animation/bubbles.d.ts +5 -0
- package/dist/types/lib/oneko/animation/debug-render.d.ts +5 -0
- package/dist/types/lib/oneko/animation/deps.d.ts +21 -0
- package/dist/types/lib/oneko/animation/frame/interrupt-idle.d.ts +2 -0
- package/dist/types/lib/oneko/animation/frame/tick-laser.d.ts +2 -0
- package/dist/types/lib/oneko/animation/frame/tick-live-state.d.ts +3 -0
- package/dist/types/lib/oneko/animation/frame/tick-movement.d.ts +2 -0
- package/dist/types/lib/oneko/animation/frame/tick-prelude.d.ts +2 -0
- package/dist/types/lib/oneko/animation/frame/tick-sounds.d.ts +3 -0
- package/dist/types/lib/oneko/animation/frame.d.ts +2 -0
- package/dist/types/lib/oneko/animation/grid.d.ts +3 -0
- package/dist/types/lib/oneko/animation/idle.d.ts +4 -0
- package/dist/types/lib/oneko/animation/mouse.d.ts +2 -0
- package/dist/types/lib/oneko/animation/movement.d.ts +3 -0
- package/dist/types/lib/oneko/animation/sprites.d.ts +5 -0
- package/dist/types/lib/oneko/animation-loop.d.ts +5 -0
- package/dist/types/lib/oneko/constants.d.ts +118 -0
- package/dist/types/lib/oneko/debug-controls/bubble.d.ts +4 -0
- package/dist/types/lib/oneko/debug-controls/force-state.d.ts +4 -0
- package/dist/types/lib/oneko/debug-controls/index.d.ts +14 -0
- package/dist/types/lib/oneko/debug-controls/playback.d.ts +4 -0
- package/dist/types/lib/oneko/debug-controls/position.d.ts +4 -0
- package/dist/types/lib/oneko/debug-controls/speed.d.ts +4 -0
- package/dist/types/lib/oneko/debug-controls/ui.d.ts +5 -0
- package/dist/types/lib/oneko/defaults.d.ts +39 -0
- package/dist/types/lib/oneko/dom.d.ts +10 -0
- package/dist/types/lib/oneko/initial-state.d.ts +9 -0
- package/dist/types/lib/oneko/konami.d.ts +4 -0
- package/dist/types/lib/oneko/laser-cursor-dom.d.ts +1 -0
- package/dist/types/lib/oneko/obstacle-filters.d.ts +12 -0
- package/dist/types/lib/oneko/pack.d.ts +12 -0
- package/dist/types/lib/oneko/pathfinding.d.ts +6 -0
- package/dist/types/lib/oneko/persistence.d.ts +18 -0
- package/dist/types/lib/oneko/runtime-config.d.ts +28 -0
- package/dist/types/lib/oneko/skin-catalog.d.ts +98 -0
- package/dist/types/lib/oneko/skin-classic.json.d.ts +4 -0
- package/dist/types/lib/oneko/skin-sheets.json.d.ts +27 -0
- package/dist/types/lib/oneko/skins.d.ts +14 -0
- package/dist/types/lib/oneko/start-cat-animation.d.ts +24 -0
- package/dist/types/lib/oneko/teardown.d.ts +17 -0
- package/dist/types/lib/oneko/types.d.ts +183 -0
- package/dist/types/lib/oneko/vanilla.d.ts +13 -0
- package/dist/types/lib/oneko/zone-runtime.d.ts +20 -0
- package/dist/types/lib/oneko/zones.d.ts +26 -0
- package/dist/types/packages/oneko/src/adapter.d.ts +3 -0
- package/dist/types/packages/oneko/src/index.d.ts +3 -0
- package/dist/types/packages/oneko/src/solid.d.ts +3 -0
- package/dist/types/packages/oneko/src/vanilla.d.ts +7 -0
- package/dist/types/packages/oneko/src/vue.d.ts +173 -0
- package/dist/vanilla.d.ts +1 -0
- package/dist/vanilla.js +9 -0
- package/dist/vue.js +71 -0
- package/package.json +82 -4
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 0xdhrv
|
|
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,98 @@
|
|
|
1
|
-
#
|
|
1
|
+
# oneko
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
A tiny pixel cat that follows the pointer, naps when things are quiet, and shares cat-themed
|
|
4
|
+
thoughts. The engine and all 24 coats ship in the package, so nothing loads from a CDN.
|
|
5
|
+
|
|
6
|
+
[Playground](https://oneko.dhrv.pw) · [Studio](https://oneko.dhrv.pw/studio) ·
|
|
7
|
+
[Documentation](https://oneko.dhrv.pw/docs)
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm install oneko
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
Every entry mounts one cat on `document.body` and takes the same options. See the
|
|
14
|
+
[prop reference](https://oneko.dhrv.pw/docs#props).
|
|
15
|
+
|
|
16
|
+
## React
|
|
17
|
+
|
|
18
|
+
```tsx
|
|
19
|
+
import Oneko from "oneko";
|
|
20
|
+
|
|
21
|
+
export function CatLayer() {
|
|
22
|
+
return <Oneko skin="calico" bubbleText="treat inspection in progress" />;
|
|
23
|
+
}
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
The entry is marked `"use client"`, so Next.js App Router can import it from a server component.
|
|
27
|
+
|
|
28
|
+
## Vue
|
|
29
|
+
|
|
30
|
+
```vue
|
|
31
|
+
<script setup>
|
|
32
|
+
import Oneko from "oneko/vue";
|
|
33
|
+
</script>
|
|
34
|
+
|
|
35
|
+
<template>
|
|
36
|
+
<Oneko skin="calico" :speed="12" @state-change="console.log" />
|
|
37
|
+
</template>
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## Svelte 5
|
|
41
|
+
|
|
42
|
+
```svelte
|
|
43
|
+
<script>
|
|
44
|
+
import Oneko from "oneko/svelte";
|
|
45
|
+
</script>
|
|
46
|
+
|
|
47
|
+
<Oneko skin="calico" />
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
## Solid
|
|
51
|
+
|
|
52
|
+
```tsx
|
|
53
|
+
import Oneko from "oneko/solid";
|
|
54
|
+
|
|
55
|
+
export default function App() {
|
|
56
|
+
return <Oneko skin="calico" />;
|
|
57
|
+
}
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
## Without a framework
|
|
61
|
+
|
|
62
|
+
```ts
|
|
63
|
+
import { createOneko } from "oneko/vanilla";
|
|
64
|
+
|
|
65
|
+
const cat = createOneko({ skin: "tuxedo" });
|
|
66
|
+
cat.update({ scale: 2 });
|
|
67
|
+
cat.destroy();
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
Importing any entry during SSR has no DOM side effects. The cat mounts in the browser.
|
|
71
|
+
|
|
72
|
+
## Skins
|
|
73
|
+
|
|
74
|
+
`ONEKO_SKINS` lists the 24 coats with names and descriptions. The classic coat is inline; the
|
|
75
|
+
others load in one chunk the first time a non-classic coat is used. Pass `spriteSrc` for your own
|
|
76
|
+
256 × 128 sprite sheet.
|
|
77
|
+
|
|
78
|
+
## Sounds
|
|
79
|
+
|
|
80
|
+
Meows are off by default. The sound files ship in `oneko/cat-sounds/`. Copy them to a folder your
|
|
81
|
+
site serves and point `soundBasePath` at it:
|
|
82
|
+
|
|
83
|
+
```bash
|
|
84
|
+
cp -r node_modules/oneko/dist/cat-sounds public/cat-sounds
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
```tsx
|
|
88
|
+
<Oneko meow soundBasePath="/cat-sounds" />
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
## Hide toggle
|
|
92
|
+
|
|
93
|
+
`setCatsHidden(true)` hides every cat and remembers the choice. `areCatsHidden()` and
|
|
94
|
+
`onCatsHiddenChange()` let you build your own toggle.
|
|
95
|
+
|
|
96
|
+
## License
|
|
97
|
+
|
|
98
|
+
MIT. The sprite artwork belongs to its original creators; see `SKIN-CREDITS.md`.
|
package/SKIN-CREDITS.md
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
# Pixel-art skins
|
|
2
|
+
|
|
3
|
+
Oneko includes 24 sprite sheets: 12 original sheets and 12 generated variants. Each is a 256 × 128 PNG with an 8 × 4 grid of
|
|
4
|
+
32-pixel frames, using the animation layout of [adryd325/oneko.js](https://github.com/adryd325/oneko.js).
|
|
5
|
+
|
|
6
|
+
The 12 original sheets were sourced from [oneko-swift](https://github.com/oneko-swift/oneko-swift/tree/8cc42f0689c009ec53561d5022597fccd7469337/Resources)
|
|
7
|
+
at revision `8cc42f0689c009ec53561d5022597fccd7469337`. Artwork belongs to its original creators;
|
|
8
|
+
this project's MIT code license does not relicense the sprite art.
|
|
9
|
+
|
|
10
|
+
| Skin ID | Credit / original source |
|
|
11
|
+
| ------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------- |
|
|
12
|
+
| `classic` | Masayuki Koba's original X11 oneko, via [adryd325/oneko.js](https://github.com/adryd325/oneko.js) |
|
|
13
|
+
| `tora` | Original X11 bitmaps from [tie/oneko](https://github.com/tie/oneko), assembled with cat transparency masks by oneko-swift |
|
|
14
|
+
| `catppuccin` | [k01e-01/catppuccineko](https://github.com/k01e-01/catppuccineko), MIT, using Catppuccin colors |
|
|
15
|
+
| `maia`, `vaporwave` | [kyrie25/spicetify-oneko](https://github.com/kyrie25/spicetify-oneko) |
|
|
16
|
+
| `black`, `gray`, `calico`, `ghost`, `silver`, `spirit`, `valentine` | Community art from the [Oneko Source Database](https://github.com/tallypaws/oneko_db), as credited by oneko-swift |
|
|
17
|
+
|
|
18
|
+
See the upstream [credits](https://github.com/oneko-swift/oneko-swift#credits) for provenance.
|
|
19
|
+
|
|
20
|
+
## Use a skin
|
|
21
|
+
|
|
22
|
+
```tsx
|
|
23
|
+
<Oneko skin="calico" meow={false} />
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
Changing `skin` swaps the coat in place without resetting the cat's position or activity. Unknown
|
|
27
|
+
skin IDs fall back to `classic`. `hueRotate` remains available for tinting; selecting a coat in the
|
|
28
|
+
playground clears the tint to show the original art.
|
|
29
|
+
|
|
30
|
+
`lib/oneko/skins.ts` is the typed catalog. `lib/oneko/skin-sheets.json` contains the bundled PNG bytes
|
|
31
|
+
as data URLs, so the component and its previews work without third-party image requests. Sites with
|
|
32
|
+
a Content Security Policy should allow `data:` in `img-src`. The 12 original sheets remain unmodified.
|
|
33
|
+
|
|
34
|
+
To add a coat, preserve the original file and attribution, add its data URL and catalog entry, then
|
|
35
|
+
run `pnpm test` and `pnpm run registry:build`. The skin tests decode every sheet and check that every
|
|
36
|
+
animation frame contains visible pixels.
|
|
37
|
+
|
|
38
|
+
## Your own sprite sheet
|
|
39
|
+
|
|
40
|
+
Open **Appearance → Use your own sprite** in the studio (`/studio`) to download the classic sheet as a template and
|
|
41
|
+
upload a PNG up to 256 KB. Use 256 × 128 pixels: 8 columns and 4 rows of 32 × 32 frames.
|
|
42
|
+
Keep the template’s frame positions so walking, grooming, wall scratching, and naps match the
|
|
43
|
+
animation. Transparent backgrounds work best. Preserve the original artwork credits when adapting it.
|
|
44
|
+
|
|
45
|
+
Uploads stay in your browser and persist with your preferences. Selecting a built-in coat or
|
|
46
|
+
resetting the cat removes the upload. The generated React example embeds the uploaded sheet;
|
|
47
|
+
for a hosted asset, use `<Oneko spriteSrc="/my-sprite.png" />`. `spriteSrc` overrides `skin`
|
|
48
|
+
and updates without resetting position. Omit it to return to the selected built-in coat.
|
|
49
|
+
|
|
50
|
+
## Generated coat variants
|
|
51
|
+
|
|
52
|
+
`ginger`, `sage`, `siamese`, `strawberry-milk`, `blue-frost`, `lavender`, `tuxedo`, `peach`, `honey`, `mocha`, `mint`, and `midnight-blue` were generated with
|
|
53
|
+
the built-in image generation tool using Classic as a reference. Original artwork
|
|
54
|
+
credits still apply. These variants reinterpret some pose details rather than
|
|
55
|
+
preserving the original pixels exactly.
|
|
56
|
+
|
|
57
|
+
Source artwork and prompts live in `output/skins/`. Run
|
|
58
|
+
`node scripts/prepare-generated-skins.mjs` to prepare 256 × 128 PNGs with nearest-neighbor
|
|
59
|
+
sampling and binary transparency and embed them in the catalog. Then run
|
|
60
|
+
`pnpm run registry:build`. Every variant is available in the studio and exported
|
|
61
|
+
React examples through its skin ID.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./types/packages/oneko/src/adapter";
|
package/dist/adapter.js
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
function createPropsUpdater(cat) {
|
|
2
|
+
let previous = {};
|
|
3
|
+
return (next) => {
|
|
4
|
+
const reset = Object.fromEntries(Object.keys(previous).map((key) => [key, void 0]));
|
|
5
|
+
cat.update({ ...reset, ...next });
|
|
6
|
+
previous = next;
|
|
7
|
+
};
|
|
8
|
+
}
|
|
9
|
+
export {
|
|
10
|
+
createPropsUpdater
|
|
11
|
+
};
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Forbidden. Calls to this URL via the terminal are not allowed. To save the url contents to the container, open the url in the computer tool, right click anywhere, and click "Save As...".
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Forbidden. Calls to this URL via the terminal are not allowed. To save the url contents to the container, open the url in the computer tool, right click anywhere, and click "Save As...".
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Forbidden. Calls to this URL via the terminal are not allowed. To save the url contents to the container, open the url in the computer tool, right click anywhere, and click "Save As...".
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Forbidden. Calls to this URL via the terminal are not allowed. To save the url contents to the container, open the url in the computer tool, right click anywhere, and click "Save As...".
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Forbidden. Calls to this URL via the terminal are not allowed. To save the url contents to the container, open the url in the computer tool, right click anywhere, and click "Save As...".
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Forbidden. Calls to this URL via the terminal are not allowed. To save the url contents to the container, open the url in the computer tool, right click anywhere, and click "Save As...".
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Forbidden. Calls to this URL via the terminal are not allowed. To save the url contents to the container, open the url in the computer tool, right click anywhere, and click "Save As...".
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Forbidden. Calls to this URL via the terminal are not allowed. To save the url contents to the container, open the url in the computer tool, right click anywhere, and click "Save As...".
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Forbidden. Calls to this URL via the terminal are not allowed. To save the url contents to the container, open the url in the computer tool, right click anywhere, and click "Save As...".
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Forbidden. Calls to this URL via the terminal are not allowed. To save the url contents to the container, open the url in the computer tool, right click anywhere, and click "Save As...".
|