Skip to content

Commit aeea6a4

Browse files
committed
refactor: move core to @mizu/render, and normalize docs
1 parent 5973ca2 commit aeea6a4

File tree

165 files changed

+1191
-1092
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

165 files changed

+1191
-1092
lines changed

.github/labeler.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@ meta:
1111
- vercel.json
1212

1313
# Mizu core engine and end-user API
14-
core:
14+
engine:
1515
- changed-files:
16-
- any-glob-to-any-file: "@mizu/mizu/core/**"
16+
- any-glob-to-any-file: "@mizu/render/engine/**"
1717
api:
1818
- changed-files:
1919
- any-glob-to-any-file: "@mizu/render/**"

.github/tools/mod_html_to_readme_md.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// Imports
2-
import { Window } from "@mizu/mizu/core/vdom"
2+
import { Window } from "@mizu/render/engine/vdom"
33
import { dirname, join } from "@std/path"
44
import { expandGlob } from "@std/fs"
55
import { Logger } from "@libs/logger"
@@ -39,7 +39,7 @@ export async function htmlToMd(html: string) {
3939
}
4040
content.push(table.join("\n"))
4141
content.push(toMarkdown(Array.from(directive.querySelectorAll("[\\#description]"))))
42-
directive.querySelectorAll("[\\#example]").forEach((example) => content.push(`\`\`\`html\n${unindent(example.innerHTML).trim()}\n\`\`\``))
42+
directive.querySelectorAll("[\\#example]").forEach((example) => content.push(`\`\`\`html\n${unindent(example.innerHTML.replace(/=""/g, "")).trim()}\n\`\`\``))
4343

4444
// Notes
4545
if (directive.querySelector("[\\#note]")) {

@mizu/bind/README.md

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
| ------------------------------------- | ---------------- | -------- |
55
| ![](https://jsr.io/badges/@mizu/bind) | 51 — `ATTRIBUTE` | Yes |
66

7-
Bind an element's `[attribute](https://developer.mozilla.org/docs/Web/HTML/Attributes)` value.
7+
Bind an element's [`attribute`](https://developer.mozilla.org/docs/Web/HTML/Attributes) value.
88

99
```html
1010
<a :href="url">
@@ -20,21 +20,21 @@ Bind an element's `[attribute](https://developer.mozilla.org/docs/Web/HTML/Attri
2020
> [!WARNING] [`:class`](#bind-class) and [`:style`](#bind-style) have specific handling described below.
2121
2222
> [!NOTE]
23-
> Multiple attributes can be bound in a single directive using the empty shorthand `:="object"` _(e.g. `:="{ foo: 'bar', bar: true }"`)_.
23+
> Bind multiple attributes in a single directive using the shorthand `:="object"` _(e.g. `:="{ foo: 'bar', bar: true }"`)_.
2424
2525
> [!NOTE]
26-
> Any [boolean attribute defined by the HTML spec](https://html.spec.whatwg.org/#attributes-3) is handled accordingly (removed from the element when falsy).
26+
> Boolean attributes defined by the [HTML spec](https://html.spec.whatwg.org/#attributes-3) are handled accordingly (removed when falsy).
2727
2828
> [!NOTE]
29-
> Bound attributes with `null` or `undefined` values are removed from the element.
29+
> Attributes with `null` or `undefined` values are removed.
3030
3131
# `:class="value"`
3232

3333
| Version | Phase | Multiple |
3434
| ------------------------------------- | ---------------- | -------- |
3535
| ![](https://jsr.io/badges/@mizu/bind) | 51 — `ATTRIBUTE` | Yes |
3636

37-
Bind an element's `[class](https://developer.mozilla.org/docs/Web/HTML/Global_attributes/class)` attribute.
37+
Bind an element's [`class`](https://developer.mozilla.org/docs/Web/HTML/Global_attributes/class) attribute.
3838

3939
```html
4040
<p :class="{ foo: true, bar: false }">
@@ -45,14 +45,14 @@ Bind an element's `[class](https://developer.mozilla.org/docs/Web/HTML/Global_at
4545
## Notes
4646

4747
> [!NOTE]
48-
> Evaluated expression can be either be:
48+
> The expression can be:
4949
>
50-
> - A `string` of space-separated class names _(e.g. `"foo bar"`)_.
51-
> - A `Record<PropertyKey, boolean>` of class names mapped to their current state _(e.g. `{ foo: true, bar: false }`)_.
52-
> - An `Array` of any of the listed supported types _(e.g. `[ "foo", { bar: false }, [] ]`)_.
50+
> - A `string` of space-separated class names _(e.g., `"foo bar"`)_.
51+
> - A `Record<PropertyKey, boolean>` mapping class names to their state _(e.g., `{ foo: true, bar: false }`)_.
52+
> - An `Array` of the supported types _(e.g., `[ "foo", { bar: false }, [] ]`)_.
5353
5454
> [!NOTE]
55-
> Initial `class` attribute value is preserved.
55+
> The initial `class` attribute value is preserved.
5656
5757
> [!NOTE]
5858
> Class names with at least one [truthy value](https://developer.mozilla.org/en-US/docs/Glossary/Truthy) are treated as active.
@@ -63,7 +63,7 @@ Bind an element's `[class](https://developer.mozilla.org/docs/Web/HTML/Global_at
6363
| ------------------------------------- | ---------------- | -------- |
6464
| ![](https://jsr.io/badges/@mizu/bind) | 51 — `ATTRIBUTE` | Yes |
6565

66-
Bind an element's `[style](https://developer.mozilla.org/docs/Web/HTML/Global_attributes/style)` attribute.
66+
Bind an element's [`style`](https://developer.mozilla.org/docs/Web/HTML/Global_attributes/style) attribute.
6767

6868
```html
6969
<p :style="{ color: 'salmon' }">
@@ -74,16 +74,16 @@ Bind an element's `[style](https://developer.mozilla.org/docs/Web/HTML/Global_at
7474
## Notes
7575

7676
> [!NOTE]
77-
> Evaluated expression can be either be:
77+
> The expression can be:
7878
>
79-
> - A `string` supported by [`HTMLElement.style.cssText`](https://developer.mozilla.org/docs/Web/API/CSSStyleDeclaration/cssText) _(e.g. `"color: blue;"`)_.
80-
> - A `Record<PropertyKey, unknown>` of CSS properties mapped to their current value _(e.g. `{ backgroundColor: "red", "border-color": "green", width: 1 }`)_.
81-
> - [« camelCase »](https://developer.mozilla.org/docs/Glossary/Camel_case) may be used inplace of [« kebab-case »](https://developer.mozilla.org/docs/Glossary/Kebab_case) to avoid escaping CSS properties names.
82-
> - Values of type `number` are implicitely converted to `px` unit whenever applicable _( [`HTMLElement.style.setProperty()`](https://developer.mozilla.org/docs/Web/API/CSSStyleDeclaration/setProperty) will be called again with `"px"` appended)_.
83-
> - An `Array` of any of the listed supported types _(e.g. `[ "color: blue", { backgroundColor: "red" }, [] ]`)_.
79+
> - A `string` supported by [`HTMLElement.style.cssText`](https://developer.mozilla.org/docs/Web/API/CSSStyleDeclaration/cssText) _(e.g., `"color: blue;"`)_.
80+
> - A `Record<PropertyKey, unknown>` mapping CSS properties to their values _(e.g., `{ backgroundColor: "red", "border-color": "green", width: 1 }`)_.
81+
> - Use [« camelCase »](https://developer.mozilla.org/docs/Glossary/Camel_case) instead of [« kebab-case »](https://developer.mozilla.org/docs/Glossary/Kebab_case) to avoid escaping CSS property names.
82+
> - Values of type `number` are implicitly converted to `px` units when applicable _( [`HTMLElement.style.setProperty()`](https://developer.mozilla.org/docs/Web/API/CSSStyleDeclaration/setProperty) will be called with `"px"` appended)_.
83+
> - An `Array` of the supported types _(e.g., `[ "color: blue", { backgroundColor: "red" }, [] ]`)_.
8484
8585
> [!NOTE]
86-
> Initial `style` attribute value is preserved.
86+
> The initial `style` attribute value is preserved.
8787
8888
> [!NOTE]
89-
> Specified CSS properties values are processed in the order they are defined, regardless of whether they were marked as [`!important`](https://developer.mozilla.org/docs/Web/CSS/important).
89+
> CSS properties are processed in the order they are defined, regardless of [`!important`](https://developer.mozilla.org/docs/Web/CSS/important).

@mizu/bind/mod.html

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<mizu-directive id="bind" directory="bind">
22
<code #name><span class="hljs-keyword">:</span><span class="hljs-meta underline-dotted">attribute</span><wbr /><span class="muted">="value"</span></code>
33
<p #description>
4-
Bind an element's <code><a href="https://developer.mozilla.org/docs/Web/HTML/Attributes">attribute</a></code> value.
4+
Bind an element's <a href="https://developer.mozilla.org/docs/Web/HTML/Attributes"><code>attribute</code></a> value.
55
</p>
66
<code #example *skip>
77
<a :href="url">
@@ -15,43 +15,43 @@
1515
<a href="#bind-class"><code class="hljs-keyword">:class</code></a> and <a href="#bind-style"><code class="hljs-keyword">:style</code></a> have specific handling described below.
1616
</mizu-warn>
1717
<mizu-note #note>
18-
Multiple attributes can be bound in a single directive using the empty shorthand <code><span class="hljs-keyword">:</span><span class="muted">="object"</span></code>
19-
<i>(e.g. <code>:="{ foo: 'bar', bar: true }"</code>)</i>.
18+
Bind multiple attributes in a single directive using the shorthand <code><span class="hljs-keyword">:</span><span class="muted">="object"</span></code>
19+
<i>(e.g. <code><span class="hljs-keyword">:</span>="{ foo: 'bar', bar: true }"</code>)</i>.
2020
</mizu-note>
2121
<mizu-note #note>
22-
Any <a href="https://html.spec.whatwg.org/#attributes-3">boolean attribute defined by the HTML spec</a> is handled accordingly (removed from the element when falsy).
22+
Boolean attributes defined by the <a href="https://html.spec.whatwg.org/#attributes-3">HTML spec</a> are handled accordingly (removed when falsy).
2323
</mizu-note>
2424
<mizu-note #note>
25-
Bound attributes with <code>null</code> or <code>undefined</code> values are removed from the element.
25+
Attributes with <code>null</code> or <code>undefined</code> values are removed.
2626
</mizu-note>
2727
</mizu-directive>
2828

2929
<mizu-directive id="bind-class" directory="bind">
3030
<code #name><span class="hljs-keyword">:class</span><wbr /><span class="muted">="value"</span></code>
3131
<p #description>
32-
Bind an element's <code><a href="https://developer.mozilla.org/docs/Web/HTML/Global_attributes/class">class</a></code> attribute.
32+
Bind an element's <a href="https://developer.mozilla.org/docs/Web/HTML/Global_attributes/class"><code>class</code></a> attribute.
3333
</p>
3434
<code #example *skip>
3535
<p :class="{ foo: true, bar: false }">
3636
<!--...-->
3737
</p>
3838
</code>
3939
<mizu-note #note>
40-
Evaluated expression can be either be:
40+
The expression can be:
4141
<ul>
4242
<li>
43-
A <code>string</code> of space-separated class names <i>(e.g. <code>"foo bar"</code>)</i>.
43+
A <code>string</code> of space-separated class names <i>(e.g., <code>"foo bar"</code>)</i>.
4444
</li>
4545
<li>
46-
A <code>Record&lt;PropertyKey, boolean&gt;</code> of class names mapped to their current state <i>(e.g. <code>{ foo: true, bar: false }</code>)</i>.
46+
A <code>Record&lt;PropertyKey, boolean&gt;</code> mapping class names to their state <i>(e.g., <code>{ foo: true, bar: false }</code>)</i>.
4747
</li>
4848
<li>
49-
An <code>Array</code> of any of the listed supported types <i>(e.g. <code>[ "foo", { bar: false }, [] ]</code>)</i>.
49+
An <code>Array</code> of the supported types <i>(e.g., <code>[ "foo", { bar: false }, [] ]</code>)</i>.
5050
</li>
5151
</ul>
5252
</mizu-note>
5353
<mizu-note #note>
54-
Initial <code>class</code> attribute value is preserved.
54+
The initial <code>class</code> attribute value is preserved.
5555
</mizu-note>
5656
<mizu-note #note>
5757
Class names with at least one <a href="https://developer.mozilla.org/en-US/docs/Glossary/Truthy">truthy value</a> are treated as active.
@@ -61,41 +61,41 @@
6161
<mizu-directive id="bind-style" directory="bind">
6262
<code #name><span class="hljs-keyword">:style</span><wbr /><span class="muted">="value"</span></code>
6363
<p #description>
64-
Bind an element's <code><a href="https://developer.mozilla.org/docs/Web/HTML/Global_attributes/style">style</a></code> attribute.
64+
Bind an element's <a href="https://developer.mozilla.org/docs/Web/HTML/Global_attributes/style"><code>style</code></a> attribute.
6565
</p>
6666
<code #example *skip>
6767
<p :style="{ color: 'salmon' }">
6868
<!--...-->
6969
</p>
7070
</code>
7171
<mizu-note #note>
72-
Evaluated expression can be either be:
72+
The expression can be:
7373
<ul>
7474
<li>
7575
A <code>string</code> supported by <a href="https://developer.mozilla.org/docs/Web/API/CSSStyleDeclaration/cssText"><code>HTMLElement.style.cssText</code></a>
76-
<i>(e.g. <code>"color: blue;"</code>)</i>.
76+
<i>(e.g., <code>"color: blue;"</code>)</i>.
7777
</li>
7878
<li>
79-
A <code>Record&lt;PropertyKey, unknown&gt;</code> of CSS properties mapped to their current value <i>(e.g. <code>{ backgroundColor: "red", "border-color": "green", width: 1 }</code>)</i>.
79+
A <code>Record&lt;PropertyKey, unknown&gt;</code> mapping CSS properties to their values <i>(e.g., <code>{ backgroundColor: "red", "border-color": "green", width: 1 }</code>)</i>.
8080
<ul>
8181
<li>
82-
<a href="https://developer.mozilla.org/docs/Glossary/Camel_case"><q>camelCase</q></a> may be used inplace of <a href="https://developer.mozilla.org/docs/Glossary/Kebab_case"><q>kebab-case</q></a> to avoid escaping CSS properties names.
82+
Use <a href="https://developer.mozilla.org/docs/Glossary/Camel_case"><q>camelCase</q></a> instead of <a href="https://developer.mozilla.org/docs/Glossary/Kebab_case"><q>kebab-case</q></a> to avoid escaping CSS property names.
8383
</li>
8484
<li>
85-
Values of type <code>number</code> are implicitely converted to <code>px</code> unit whenever applicable <i>(<a href="https://developer.mozilla.org/docs/Web/API/CSSStyleDeclaration/setProperty"><code>HTMLElement.style.setProperty()</code></a> will be called again with
86-
<code>"px"</code> appended)</i>.
85+
Values of type <code>number</code> are implicitly converted to <code>px</code> units when applicable <i>(<a href="https://developer.mozilla.org/docs/Web/API/CSSStyleDeclaration/setProperty"><code>HTMLElement.style.setProperty()</code></a> will be called with <code
86+
>"px"</code> appended)</i>.
8787
</li>
8888
</ul>
8989
</li>
9090
<li>
91-
An <code>Array</code> of any of the listed supported types <i>(e.g. <code>[ "color: blue", { backgroundColor: "red" }, [] ]</code>)</i>.
91+
An <code>Array</code> of the supported types <i>(e.g., <code>[ "color: blue", { backgroundColor: "red" }, [] ]</code>)</i>.
9292
</li>
9393
</ul>
9494
</mizu-note>
9595
<mizu-note #note>
96-
Initial <code>style</code> attribute value is preserved.
96+
The initial <code>style</code> attribute value is preserved.
9797
</mizu-note>
9898
<mizu-note #note>
99-
Specified CSS properties values are processed in the order they are defined, regardless of whether they were marked as <a href="https://developer.mozilla.org/docs/Web/CSS/important"><code>!important</code></a>.
99+
CSS properties are processed in the order they are defined, regardless of <a href="https://developer.mozilla.org/docs/Web/CSS/important"><code>!important</code></a>.
100100
</mizu-note>
101101
</mizu-directive>

@mizu/bind/mod.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// Imports
2-
import { type Cache, type Directive, Phase } from "@mizu/mizu/core/engine"
2+
import { type Cache, type Directive, Phase } from "@mizu/render/engine"
33
import { boolean } from "./boolean.ts"
4-
export type * from "@mizu/mizu/core/engine"
4+
export type * from "@mizu/render/engine"
55

66
/** `:bind` directive. */
77
export const _bind = {

@mizu/bind/mod_test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
await import("@mizu/mizu/core/testing").then(({ test }) => test(import.meta))
1+
await import("@mizu/render/engine/testing").then(({ test }) => test(import.meta))

@mizu/clean/README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
Clean up the element and its children from specified content.
88

99
```html
10-
<div *clean="">
10+
<div *clean>
1111
<!--...-->
1212
</div>
1313
```
@@ -16,16 +16,16 @@ Clean up the element and its children from specified content.
1616

1717
### `.comments[boolean]`
1818

19-
Clean up all [`Comment`](https://developer.mozilla.org/docs/Web/API/Comment) nodes from subtree.
19+
Remove all [`Comment`](https://developer.mozilla.org/docs/Web/API/Comment) nodes within the subtree.
2020

2121
### `.spaces[boolean]`
2222

23-
Clean up all spaces (except non-breaking spaces [`&nbsp;`](https://developer.mozilla.org/docs/Glossary/Character_reference)) from subtree.
23+
Remove all spaces (except non-breaking spaces [`&nbsp;`](https://developer.mozilla.org/docs/Glossary/Character_reference)) within the subtree.
2424

2525
### `.templates[boolean]`
2626

27-
Clean up all [`<template>`](https://developer.mozilla.org/docs/Web/HTML/Element/template) nodes from subtree **after processing the subtree entirely**.
27+
Clear all [`<template>`](https://developer.mozilla.org/docs/Web/HTML/Element/template) nodes from the subtree **after fully processing it**.
2828

2929
### `.directives[boolean]`
3030

31-
Clean up all known directives from subtree **after processing the subtree entirely**. If `.comments` modifier is also enabled, then comments generated by directives will be cleaned up as well.
31+
Strip all known directives from the subtree **after fully processing it**. If the `.comments` modifier is also enabled, comments generated by directives will be removed as well.

@mizu/clean/mod.html

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,15 @@
99
</div>
1010
</code>
1111
<mizu-modifier #modifier name="comments">
12-
Clean up all <a href="https://developer.mozilla.org/docs/Web/API/Comment"><code>Comment</code></a> nodes from subtree.
12+
Remove all <a href="https://developer.mozilla.org/docs/Web/API/Comment"><code>Comment</code></a> nodes within the subtree.
1313
</mizu-modifier>
1414
<mizu-modifier #modifier name="spaces">
15-
Clean up all spaces (except non-breaking spaces <a href="https://developer.mozilla.org/docs/Glossary/Character_reference"><code>&amp;nbsp;</code></a>) from subtree.
15+
Remove all spaces (except non-breaking spaces <a href="https://developer.mozilla.org/docs/Glossary/Character_reference"><code>&amp;nbsp;</code></a>) within the subtree.
1616
</mizu-modifier>
1717
<mizu-modifier #modifier name="templates">
18-
Clean up all <a href="https://developer.mozilla.org/docs/Web/HTML/Element/template"><code>&lt;template&gt;</code></a> nodes from subtree <strong>after processing the subtree entirely</strong>.
18+
Clear all <a href="https://developer.mozilla.org/docs/Web/HTML/Element/template"><code>&lt;template&gt;</code></a> nodes from the subtree <strong>after fully processing it</strong>.
1919
</mizu-modifier>
2020
<mizu-modifier #modifier name="directives">
21-
Clean up all known directives from subtree <strong>after processing the subtree entirely</strong>. If <code>.comments</code> modifier is also enabled, then comments generated by directives will be cleaned up as well.
21+
Strip all known directives from the subtree <strong>after fully processing it</strong>. If the <code class="hljs-meta">.comments</code> modifier is also enabled, comments generated by directives will be removed as well.
2222
</mizu-modifier>
2323
</mizu-directive>

@mizu/clean/mod.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// Imports
2-
import { type Cache, type Directive, Phase } from "@mizu/mizu/core/engine"
3-
export type * from "@mizu/mizu/core/engine"
2+
import { type Cache, type Directive, Phase } from "@mizu/render/engine"
3+
export type * from "@mizu/render/engine"
44

55
/**
66
* All spacing characters except non-breaking space.

@mizu/clean/mod_test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
await import("@mizu/mizu/core/testing").then(({ test }) => test(import.meta))
1+
await import("@mizu/render/engine/testing").then(({ test }) => test(import.meta))

0 commit comments

Comments
 (0)