🥳 New Kitten Release

• Fix: Events on `KittenComponent` hierarchies are now bubbled in reverse (from children down to parents). This provides for predictable event firing in cases where parents might emit events (e.g., a page emitting an event from its `onConnect()` handler). Your existing code should work as before with certain edge cases that might have broken before no longer breaking.

Enjoy!

💕

#Kitten #KittenReleases #SmallWeb #SmallTech #web #dev #events #serverSide #eventBased #components #hypermedia #streamingHTML

🥳 New Kitten Release

• `KittenComponent` (and thereby `KittenPage`) gains an `emit()` method.

Use this to bubble events from your page to all child components or from any component to all of its child components.

This is useful, for example, for setting the state of a page or a component where each child component knows how to present itself for that state.

(That, in turn, is useful if you want to be able to restore state based on URLs.)

The naming convention-based mapping of event names to event handler names is the same as for the events you receive from the client. So an event called `myEvent` will result in `onMyEvent` handlers on child components being called.

(Also update @small-web/kitten to version 7.1.0 to get language intelligence for the new method.)

Enjoy!

💕

#Kitten #KittenReleases #SmallWeb #SmallTech #web #dev #events #serverSide #eventBased #components #hypermedia #streamingHTML

🥳 New Kitten release

⁃ Bug fix: Kitten no longer awaits events bubbled from the client to the server.

Kitten’s Streaming HTML workflow¹ transparently bubbles events from the client to the server so you can keep all your code on one tier and stream HTML updates to the page. Anyway, so I was awaiting events while bubbling them instead of just firing them off in parallel which meant that if you had delays, etc., in some of your event handlers, the timing of other event handlers would be affected. This is now fixed so your event handlers should fire independently of each other. (Your async event handlers will continue to work as intended so you can script animations, etc., by awaiting delays within them.)

Enjoy!

https://kitten.small-web.org

💕

¹ https://kitten.small-web.org/tutorials/streaming-html/

#Kitten #KittenReleases #SmallWeb #SmallTech #bugFix #events #StreamingHTML

Kitten: Home

I love how simple Kitten’s Streaming HTML workflow makes building features like this, especially when using class-based Kitten pages and components :)

https://kitten.small-web.org

💕

#Kitten #SmallWeb #StreamingHTML #EventBasedProgramming #ObjectOrientedProgramming #JavaScript #NodeJS #web #dev #GazaVerified

…And there are more interesting tid-bits in there too:

• See how I’m pushing Kitten’s Streaming HTML to its logical conclusion and streaming JavaScript from the server to the client to keep all logic on the server while implementing a client-side feature (copy to clipboard): https://codeberg.org/small-web/look-over-there/src/branch/main/CopyButton.component.js

• Following on from that, note how the Toast component that’s triggered when something is copied looks (under the hood, Streaming HTML is htmx + WebSockets + some Kitten-specific magic and glues it all together and adds syntactic sugar): https://codeberg.org/small-web/look-over-there/src/branch/main/Toast.fragment.js

• Finally, check out how layout components and slots work: https://codeberg.org/small-web/look-over-there/src/branch/main/Site.layout.js

I think that’s all the intersting stuff I can spot at the moment.

Have fun!

💕

#Kitten #SmallWeb #SmallTech #SmallTechnologyFoundation #LookOverThere #code #StreamingHTML #htmx #websockets #nodeJS #web #dev

Making sure you're not a bot!

Right, the Kitten icon explorer is now fully functional.

• Type to filter results (searches component names, categories, and tags).
• Press the component button to copy the component code to your clipboard.

https://kitten.small-web.org/reference/#finding-icons

I quickly whipped this up using the new generic script in Markdown frontmatter feature I added to Kitten. And I’d imagine this is about the most amount of functionality you’d add using it before refactoring to something more maintainable. (Hey, just because I’m the author of Kitten doesn’t mean I’m not also learning how to use it as build it.) :)

Source: https://codeberg.org/kitten/site/raw/branch/main/reference/index.page.md

Enjoy!

💕

#Kitten #SmallWeb #web #dev #icons #iconExplorer #PhosphorIcons #StreamingHTML #markdown #components #events

I just whipped up a simple icon search for Kitten Icons (based on Phosphor Icons). It’s not complete yet – I have a few other things to do before I can get back to it today – but you can play with it here:

https://kitten.small-web.org/reference/#finding-icons

And see the code for it here:

https://codeberg.org/kitten/site/src/branch/main/reference/IconExplorer.fragment.js

I popped the event handler into the Markdown page itself. Not the cleanest but works in a pinch:

https://codeberg.org/kitten/site/raw/branch/main/reference/index.page.md

#Kitten #icons #PhosphorIcons #iconExplorer #web #dev #markdown #components #StreamingHTML #SmallWeb #SmallTech #reference

New Kitten release 🎉

https://kitten.small-web.org

• New: Lovely new icons¹ and new callouts in Kitten Settings²

• New: Markdown now supports attributes and bracketed spans³

• New: client-side `kitten` global with `trigger` function for triggering events on the server from the client. (Useful when streaming client-side JavaScript when using Kitten’s Streaming HTML⁴ workflow. e.g., when you have to use a client-only web API like the Clipboard API but you want to keep all your logic on your server-side page.⁵)

• Fixed: The bound render function returned by `KittenComponent` class’s `component` getter now correctly awaits asynchronous templates. (In Kitten, you don’t have to care whether your templates contain promises. Kitten handles all that for you.)

Enjoy! 💕

¹ https://kitten.small-web.org/reference/#icons

² https://mastodon.ar.al/@aral/114381983893061099

³ https://kitten.small-web.org/reference/#markdown-support (also see https://mastodon.ar.al/@aral/114381462302862256)

https://kitten.small-web.org/tutorials/streaming-html/

⁵ e.g., See how I use this to implement a copy to clipboard button in the database page of Kitten’s Settings: https://codeberg.org/kitten/app/src/branch/main/web/%F0%9F%90%B1/settings%F0%9F%94%92/db/index.page.js#L33 Of course, you don’t have to use this and you can just write client-side JavaScript or use the built-in Alpine.js integration. e.g., how I do it on the (older) settings/identity page: https://codeberg.org/kitten/app/src/branch/main/web/%F0%9F%90%B1/settings%F0%9F%94%92/identity/index.page.js#L7

#Kitten #SmallWeb #web #dev #markdown #icons #PhosphorIcons #HTML #CSS #JavaScript #StreamingHTML #htmx #WebSocket #NodeJS

New Kitten release

• Fix: messages that are promises are properly awaited before being sent.

https://kitten.small-web.org

Kitten automatically and transparently handles asynchronous content in your templates for you so you don’t have to worry about it. One place where this wasn’t working properly is if you addressed `this.component` to stream a custom update of your component manually instead of calling the `this.update()` method of Kitten component instances.

e.g.,

```js
export default class AdminPage extends kitten.Page {
// …
onSelectedPost (data) {
this.send(kitten.html`<${this.component} postId='${data.selectedPost.postId}' />`)
}
}
```

💕

#Kitten #SmallWeb #SmallTech #news #updates #promises #StreamingHTML #web #dev #HTML #CSS #JavaScript

👆 Sorry, life got in the way; just deployed this but I haven’t had a chance to document it properly yet. I’ll make a proper announcement when I do.

Also, you can now use the `delete` attribute on a DOM node/Kitten component you’re streaming back from the server to have it removed from the DOM on the client. It’s syntactic sugar for hx-swap-oob='delete' in htmx.

https://kitten.small-web.org

#Kitten #SmallWeb #icons #components #StreamingHTML