commits
* add examples/uibench
* scaffold bench
* custom uibench
* add bencher.dev
by moving from rollup/plugin-terser to a tiny handrolled variant,
because the official plugin runs terser in multiple isolated workers.
this fixes an issue where the entry and client/server modules would
have different names for the html properties, so nothing would work.
just renames and conversions of arrow functions
to regular functions for a few bytes saved.
also converts the template cache back to a weakmap (oops)
also consolidates part update/detach
This is the 4th test runner I've used now, but it's way faster than node:test and I can always revert (note the use of node:assert and not bun:tests expect)
this means the dts bundle won't have duplicates, which is important
for the unique symbol.
* noImplicitAny
* typescript
* split into many files
* change case to snake_case
* switch build to rolldown
* drop assert statements from prod build
* generate dist package json
* generate isolated bundled declarations
* share the index code between client/server
* class Root -> function createRoot
* class BoundTemplateInstance -> function html
* inline TemplateInstance
* class WhateverPart -> function createWhateverPart
* remove create from Part, make it a createPart param
* uncurry createPart
* unify part creation/update
* class Span -> function createSpan, standalone methods
* some assert magic
* jsdoc param -> jsdoc type on arg
* move childpart update into the return
+ add failing test
in html`${a}|${b}`,
a's slot's childIndex is 0
b's slot's childIndex is 2
however, where ${a} results in 2+ nodes:
by the time ${b} is created, it's no longer at the same
index in the parent.
by reversing the order in which the parts are created,
the slots are always in the expected position.
* remove special attribute syntax
the rules are simpler now:
if it's static: it's an attribute
if it's dynamic: it's a property
I suspect there are going to be some issues
with className and htmlFor that need to be special-cased,
but otherwise this feels nicer
* add attr() helper
just use the custom part mechanism,
very tree shakable
* simplify custom part interface
now it's just an update function that returns a cleanup function
* rename custom part -> directive
* remove directive values
you can just closure it
* conditionally use attributes instead of properties
for `class`, `for`, and data attributes.
otherwise, attempt to find the correct casing
otherwise ${...}1 would come out as dyn-$01, breaking
the index matching in /dyn-\$(\d+)/
and skip over interpolations in comments, just to acknowledge they're
there, so you can comment out code and not face the warning.
just to trim a few bytes.
also one other driveby byte shave.
it never worked properly anyway.
instead, just throw when we find one.
makes span start/end a node rather than an index.
start/end are inclusive but non-nullable, because an
empty span is represented by a empty text node marker.
* typed controller
* add getParentNode
* assert controller exists
* class Root -> function createRoot
* class BoundTemplateInstance -> function html
* inline TemplateInstance
* class WhateverPart -> function createWhateverPart
* remove create from Part, make it a createPart param
* uncurry createPart
* unify part creation/update
* class Span -> function createSpan, standalone methods
* some assert magic
* jsdoc param -> jsdoc type on arg
* move childpart update into the return
+ add failing test
in html`${a}|${b}`,
a's slot's childIndex is 0
b's slot's childIndex is 2
however, where ${a} results in 2+ nodes:
by the time ${b} is created, it's no longer at the same
index in the parent.
by reversing the order in which the parts are created,
the slots are always in the expected position.
* remove special attribute syntax
the rules are simpler now:
if it's static: it's an attribute
if it's dynamic: it's a property
I suspect there are going to be some issues
with className and htmlFor that need to be special-cased,
but otherwise this feels nicer
* add attr() helper
just use the custom part mechanism,
very tree shakable
* simplify custom part interface
now it's just an update function that returns a cleanup function
* rename custom part -> directive
* remove directive values
you can just closure it
* conditionally use attributes instead of properties
for `class`, `for`, and data attributes.
otherwise, attempt to find the correct casing