
Security News
Deno 2.2 Improves Dependency Management and Expands Node.js Compatibility
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
@benev/slate
Advanced tools
@benev/slate
🚧 prerelease wip under constructon subject to change
GoldElement
is a replacement for LitElementSilverElement
is just like GoldElement but for the light domShaleView
is a sophisticated view classFlat
is a state management systemPipe
is cool syntax for.. pipingOp
is a system for showing loading spinnersprepare_frontend
connects your components and views with app-level context and state managementnpm i @benev/slate
import {css} from "lit"
import {BaseContext} from "@benev/slate"
export class Context extends BaseContext {
// state management system
flat = new Flat()
// applied to components and views
theme = css`
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
`
}
export const {component, components, view, views} = prepare_frontend<Context>()
import {register_to_dom} from `@benev/slate`
const context = new Context()
register_to_dom(components(context, {
MyElement,
AnotherElement,
WhateverElement,
}))
import {html, css} from "lit"
import {GoldElement} from "@benev/slate"
export const MyElement = component(context => class extends GoldElement {
static styles = css``
#state = context.flat.state({
count: 0,
})
// component auto rerenders on state changes
#increment => () => {
this.#state.count++
}
// access to attributes, rerenders on changes
#attrs = Attributes.setup(this as GoldElement, {
"example-string": String,
"example-number": Number,
"example-boolean": Boolean,
})
// declare which views this component uses
#views = views(context, {
MyView,
})
render() {
return html`
<p>count: ${this.#state.count}</p>
<button @click=${this.#increment}>increment</button>
${this.#views.MyView({props: [this.#state.count]})}
`
}
})
GoldElement
, except it's light dom (no shadow dom), and thus it cannot have its own stylesheet (relies on styling from above).export const MyView = view(context => class extends ShaleView {
static name = "my-view"
static styles = css``
#state = context.flat.state({
count: 0,
})
#increment => () => {
this.#state.count++
}
#attrs = Attributes.setup(this as ShaleView, {
"example-string": String,
})
#views = views(context, {
SomeOtherView,
})
render(x: number) {
return html`<p>${x}</p>`
}
})
#state
, #attrs
, #views
patterns as your componentsauto_exportparts
part
, and it will use that part as the prefix to any sub-partsv0.0.0-dev.28
.cleanup
helpersFAQs
frontend web stuff
The npm package @benev/slate receives a total of 123 weekly downloads. As such, @benev/slate popularity was classified as not popular.
We found that @benev/slate demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
Security News
React's CRA deprecation announcement sparked community criticism over framework recommendations, leading to quick updates acknowledging build tools like Vite as valid alternatives.
Security News
Ransomware payment rates hit an all-time low in 2024 as law enforcement crackdowns, stronger defenses, and shifting policies make attacks riskier and less profitable.