sprae 6.1.2 → 7.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "sprae",
3
3
  "description": "DOM microhydration.",
4
- "version": "6.1.2",
4
+ "version": "7.0.0",
5
5
  "main": "src/index.js",
6
6
  "module": "src/index.js",
7
7
  "type": "module",
@@ -13,6 +13,7 @@
13
13
  "src"
14
14
  ],
15
15
  "dependencies": {
16
+ "@preact/signals-core": "^1.5.0",
16
17
  "swapdom": "^1.1.1"
17
18
  },
18
19
  "devDependencies": {
package/readme.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  > DOM tree hydration with reactivity.
4
4
 
5
- _Sprae_ is progressive enhancement framework, a tiny essential alternative to [alpine](https://github.com/alpinejs/alpine), [petite-vue](https://github.com/vuejs/petite-vue) or [template-parts](https://github.com/github/template-parts) with improved ergonomics[*](#justification--alternatives). It enables simple markup logic without external scripts. Perfect for small websites, prototypes or UI logic.
5
+ _Sprae_ is progressive enhancement framework, a tiny essential alternative to [alpine](https://github.com/alpinejs/alpine), [petite-vue](https://github.com/vuejs/petite-vue) or [template-parts](https://github.com/github/template-parts) with enhanced ergonomics[*](#justification--alternatives). It enables simple markup logic without external scripts. Perfect for small websites, prototypes or UI logic.
6
6
 
7
7
  ## Use
8
8
 
@@ -12,7 +12,7 @@ To autoinit document, include [`sprae.auto.js`](./sprae.auto.js):
12
12
 
13
13
  ```html
14
14
  <!-- <script src="https://cdn.jsdelivr.net/npm/sprae/sprae.auto.js" defer></script> -->
15
- <script src="./path/to/sprae.auto.js" defer></script>
15
+ <script defer src="./path/to/sprae.auto.js"></script>
16
16
 
17
17
  <ul>
18
18
  <li :each="item in ['apple', 'bananas', 'citrus']"">
@@ -40,8 +40,8 @@ To init manually as module, import [`sprae.js`](./sprae.js):
40
40
  ```
41
41
 
42
42
  Sprae evaluates `:`-attributes and evaporates them.<br/>
43
- Reactive `state` reflects current values, can be updated directly.<br/>
44
- It batches multiple updates internally for efficiency.
43
+ Sprae creates reactive state representing current values in rendered DOM.<br/>
44
+ It is based on [preact signals](https://github.com/preactjs/signals) and can take them as inputs.
45
45
 
46
46
  ## Attributes
47
47
 
@@ -252,13 +252,45 @@ To avoid _flash of unstyled content_, you can hide sprae attribute or add a cust
252
252
  <style>[:each],[:hidden] {visibility: hidden}</style>
253
253
  ```
254
254
 
255
+ ## Benchmark
256
+
257
+ Done via [js-framework-benchmark](https://github.com/krausest/js-framework-benchmark).
258
+
259
+ ```sh
260
+ # prerequisite
261
+ npm ci
262
+ npm run install-server
263
+ npm start
264
+
265
+ # build
266
+ cd frameworks/keyed/sprae
267
+ npm ci
268
+ npm run build-prod
269
+
270
+ # bench
271
+ cd ../../..
272
+ cd webdriver-ts
273
+ npm ci
274
+ npm run compile
275
+ npm run bench keyed/sprae
276
+
277
+ # show results
278
+ cd ..
279
+ cd webdriver-ts-results
280
+ npm ci
281
+ cd ..
282
+ cd webdriver-ts
283
+ npm run results
284
+ ```
285
+
255
286
  ## Examples
256
287
 
257
288
  * TODO MVC: [demo](https://dy.github.io/sprae/examples/todomvc), [code](https://github.com/dy/sprae/blob/main/examples/todomvc.html)
258
289
  * Wavearea: [demo](https://dy.github.io/wavearea?src=//cdn.freesound.org/previews/586/586281_2332564-lq.mp3), [code](https://github.com/dy/wavearea)
259
290
  * Prostogreen [demo](http://web-being.org/prostogreen/), [code](https://github.com/web-being/prostogreen/)
260
291
 
261
- ## Justification & alternatives
292
+
293
+ ## Justification
262
294
 
263
295
  * [Template-parts](https://github.com/dy/template-parts) / [templize](https://github.com/dy/templize) is progressive, but is stuck with native HTML quirks ([parsing table](https://github.com/github/template-parts/issues/24), [SVG attributes](https://github.com/github/template-parts/issues/25), [liquid syntax](https://shopify.github.io/liquid/tags/template/#raw) conflict etc). Also ergonomics of `attr="{{}}"` is inferior to `:attr=""` since it creates flash of uninitialized values. Also it's just nice to keep `{{}}` generic, regardless of markup, and attributes as part of markup.
264
296
  * [Alpine](https://github.com/alpinejs/alpine) / [vue](https://github.com/vuejs/petite-vue) / [lit](https://github.com/lit/lit/tree/main/packages/lit-html) escape native HTML quirks, but the syntax space (`:attr`, `v-*`,`x-*`, `l-*` `@evt`, `{{}}`) is too broad, as well as functionality. Perfection is when there's nothing to take away, not add (c). Also they tend to [self-encapsulate](https://github.com/alpinejs/alpine/discussions/3223) making interop hard, invent own tooling or complex reactivity.
@@ -281,5 +313,6 @@ It is reminiscent of [XSLT](https://www.w3schools.com/xml/xsl_intro.asp), consid
281
313
  * [Alpine](https://github.com/alpinejs/alpine)
282
314
  * ~~[Lucia](https://github.com/aidenybai/lucia)~~ deprecated
283
315
  * [Petite-vue](https://github.com/vuejs/petite-vue)
316
+ * [nuejs](https://github.com/nuejs/nuejs)
284
317
 
285
318
  <p align="center"><a href="https://github.com/krsnzd/license/">🕉</a></p>