Skip to content

v0.2.0

Choose a tag to compare

@0xdhrv 0xdhrv released this 10 Oct 17:22
· 54 commits to main since this release
v0.2.0
8674b33

Oneko now works beyond React, cats can keep each other company, and they pay attention to the page.

No React? Still a cat

One script tag brings a cat to any site: Astro, Hugo, WordPress, or plain HTML. Options are data- attributes named after the props.

<script type="module" src="https://oneko.dhrv.pw/oneko.js" data-skin="calico" data-meow></script>

You can also use a <oneko-cat> element, which fires a statechange event and works in Angular and Lit, or the createOneko() API.

Svelte, Vue, and Solid

Download one component and use the same props as the React component:

curl -o src/lib/Oneko.svelte https://oneko.dhrv.pw/frameworks/Oneko.svelte
curl -o src/components/Oneko.vue https://oneko.dhrv.pw/frameworks/Oneko.vue
curl -o src/components/Oneko.tsx https://oneko.dhrv.pw/frameworks/Oneko.solid.tsx

They load the hosted engine in the browser, so SvelteKit, Nuxt, and SolidStart can render them during SSR.

A parade of cats

Mount several cats and set chase="cat": each one follows the cat mounted before it. A cat resting beside a napping friend dozes off too.

Page reactions

All off by default:

  • napWhileTyping: dozes off while visitors type, and wakes when the pointer moves.
  • followFocus: walks to whatever keyboard focus lands on.
  • perchOnHover: sits on a link or button the pointer rests on. Add data-oneko-perch to make anything a perch.

Visitor controls and reduced motion

  • setCatsHidden() and useCatsHidden() hide every cat on the site, and the choice is remembered. With the hosted script, <button data-oneko-toggle> does the same with no JavaScript.
  • pettable makes the cat a keyboard-reachable "Pet the cat" button.
  • reducedMotion="rest" shows a still, sleeping cat to visitors who prefer reduced motion, instead of hiding it.

Lighter installs and hosted coats

  • Named skins load the first time one is used, so the full install drops from about 578 KB to about 31 KB gzipped up front.
  • The studio accepts an https link to a 256 × 128 sprite sheet. Share it with /studio?sprite=https://… or a share link.

Site

  • The home page and docs describe every way to add a cat, not only React.
  • The docs sidebar fits without scrolling.
  • The landing page staggers in with Motion springs.
  • A new social preview image.

Notes

  • Every cat element now has data-oneko-cat. Only the first keeps id="oneko-react".
  • getSkinSource returns undefined until a named skin has loaded; use loadSkinSource or useSkinSource to wait for it.
  • Studio configuration files and share links from earlier versions still load.

Full Changelog: v0.1.0...v0.2.0