💡
A zero-build html component library for the artisanal web.
Blackberry is a small frontend library providing reactivity, composability, scoped styles, and a simple API to make webdev fun again.
Blackberry.js is inspired by Strawberry.js, and is designed to be used as a lightweight html-first alternative to frameworks like Vue and Svelte without requiring build tooling or a complex dependency tree.
Blackberry has a very simple API. Components are defined using
the
Include the Blackberry.js script in your html file.
Calling
Optionally, you can put a
Blackberry components can define a top level
Code inside of the
Attributes are values that can be passed into a component.
They can be defined on a component's template tag using a comma seperated
The effect function is available inside of the script tag via the
Templates can use directives to bind data to elements, listen for events, and conditionally render elements. Directives are javascript expressions that are evaluated in the context of the component.
The
The
The
The
The
The
The
The
Slots are used to pass content into a component. They are defined in the component's template using the
Styles can be defined in the
Because Blackberry components use the shadow-dom, they do not have access to global stylesheets by default.
If you want your component to inherit styles from the outside document,
you can set the
I wanted a way to write reusable components while authoring HTML without needing to set up a build pipeline or pull in dependencies and additional JS. I wanted something I could use to "sketch" in HTML without the cognitive overhead of switching to JS.
Blackberry uses the shadow-dom to encapsulate styles and isolate components. When compiling a template, it extracts the script and style tag contents and builds a vdom structure of the template. It then uses the vdom, style, and script content to create a custom ivysaur component and registers it with the browser.
Anyone who wants to :) I wouldn't use this if I was building a very large or complex web application (I would use ivysaur), but for smaller websites that are written either in plain HTML or in a non-javascript templating language, blackberry can be a good choice. It's small size means it's reasonable to include in a project even for just a handful of components or uses.
It’s probably the JavaScript frameworks. They have gotten so big and so weird. People seem to love them. I don’t understand why. The browsers have actually gotten pretty good. The web standards thing have finally worked, and the web API is stable pretty much. Some of it’s still pretty stupid, but it works and it’s reliable.Read the transcript on Corecursive