mancha 0.22.7 → 0.23.1
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/dist/browser.d.ts +1 -1
- package/dist/browser.js +1 -1
- package/dist/css_custom.js +7 -2
- package/dist/css_custom.js.map +1 -1
- package/dist/css_gen_utils.d.ts +27 -0
- package/dist/css_gen_utils.js +9 -0
- package/dist/css_gen_utils.js.map +1 -1
- package/dist/{interfaces-CwmyH9Jf.d.ts → interfaces-DhL-_vL-.d.ts} +6 -5
- package/dist/mancha.js +15 -15
- package/dist/{renderer-esvAhqDy.js → renderer-1jqgJa7K.js} +11 -11
- package/dist/safe_browser.d.ts +1 -1
- package/dist/safe_browser.js +1 -1
- package/dist/store.d.ts +11 -6
- package/dist/store.js +50 -19
- package/dist/store.js.map +1 -1
- package/docs/03_reactivity.md +25 -0
- package/docs/05_css.md +23 -2
- package/package.json +1 -1
- package/scripts/generate-css-docs.ts +22 -2
package/docs/03_reactivity.md
CHANGED
|
@@ -179,6 +179,31 @@ $.items = [];
|
|
|
179
179
|
$.items.length = 0;
|
|
180
180
|
```
|
|
181
181
|
|
|
182
|
+
## Notification Scheduling
|
|
183
|
+
|
|
184
|
+
Observers do not run on the same tick as the write. Writing a key schedules its
|
|
185
|
+
observers to run once, about 10ms later; any further writes in that window join
|
|
186
|
+
the run already scheduled instead of postponing it:
|
|
187
|
+
|
|
188
|
+
```js
|
|
189
|
+
$.view = buildView(); // Schedules the run...
|
|
190
|
+
$.view = buildView(); // ...joins it. Observers run once, with the latest value.
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
Two things follow from that. Observers see only the final value of a burst, so
|
|
194
|
+
they never run against an intermediate state. And a key written continuously
|
|
195
|
+
still notifies every ~10ms rather than being held back indefinitely, so a value
|
|
196
|
+
updated on every pointer move keeps its observers running throughout the drag.
|
|
197
|
+
|
|
198
|
+
Timing depends only on when a key is first written, not on how often, and is the
|
|
199
|
+
same in the browser, on the server, and in workers.
|
|
200
|
+
|
|
201
|
+
> **Note:** An observer must not write the key it observes after an `await`.
|
|
202
|
+
> Writes made by an observer's synchronous body are ignored, so the common case
|
|
203
|
+
> of incidental self-writes is safe, but a write from an observer's asynchronous
|
|
204
|
+
> tail is indistinguishable from an outside write and will re-trigger that
|
|
205
|
+
> observer in a loop.
|
|
206
|
+
|
|
182
207
|
## Computed Values
|
|
183
208
|
|
|
184
209
|
Computed values are derived values that automatically update when their dependencies change. Use `$computed` to create a named reactive value that recalculates whenever the values it depends on are modified.
|
package/docs/05_css.md
CHANGED
|
@@ -33,7 +33,7 @@ The utility CSS rules are inspired by Tailwind CSS. You can inject them using `i
|
|
|
33
33
|
This automatically includes:
|
|
34
34
|
- **CSS Reset** (Tailwind Preflight): box-sizing, typography, form resets, media defaults
|
|
35
35
|
- **Base utility classes**: spacing, sizing, colors, layout, typography, and more
|
|
36
|
-
- **On-demand scanning**: responsive variants, pseudo-state variants, color opacity, custom bracket values, and dark mode are generated on-the-fly for only the classes actually used in your markup
|
|
36
|
+
- **On-demand scanning**: responsive variants, orientation variants, pseudo-state variants, color opacity, custom bracket values, and dark mode are generated on-the-fly for only the classes actually used in your markup
|
|
37
37
|
|
|
38
38
|
### Media Breakpoints
|
|
39
39
|
|
|
@@ -44,6 +44,18 @@ This automatically includes:
|
|
|
44
44
|
| `lg:` | `1024px` |
|
|
45
45
|
| `xl:` | `1280px` |
|
|
46
46
|
|
|
47
|
+
### Orientation
|
|
48
|
+
|
|
49
|
+
Use the `landscape:` and `portrait:` prefixes to apply styles based on screen orientation (`@media (orientation: …)`) rather than width, so layouts respond to device rotation without picking an arbitrary breakpoint:
|
|
50
|
+
|
|
51
|
+
```html
|
|
52
|
+
<!-- Stack vertically in portrait, side-by-side in landscape. -->
|
|
53
|
+
<div class="flex flex-col landscape:flex-row">
|
|
54
|
+
<div class="board">...</div>
|
|
55
|
+
<div class="moves-panel portrait:hidden">...</div>
|
|
56
|
+
</div>
|
|
57
|
+
```
|
|
58
|
+
|
|
47
59
|
### Pseudo States
|
|
48
60
|
|
|
49
61
|
The following pseudo states are supported for all utilities:
|
|
@@ -67,7 +79,7 @@ The `dark:` prefix can be used with any utility class, including colors, spacing
|
|
|
67
79
|
<div class="bg-[#fff] dark:bg-[#1a1a1a] p-4 dark:border-gray-700">
|
|
68
80
|
```
|
|
69
81
|
|
|
70
|
-
> **Note:** Responsive variants (`sm:`, `md:`, etc.), pseudo-state variants (`hover:`, `focus:`, `disabled:`), color opacity (`/N`), dark mode (`dark:`), and custom bracket values are all generated on-demand. Only the classes actually present in your markup are injected, keeping the CSS bundle small.
|
|
82
|
+
> **Note:** Responsive variants (`sm:`, `md:`, etc.), orientation variants (`landscape:`, `portrait:`), pseudo-state variants (`hover:`, `focus:`, `disabled:`), color opacity (`/N`), dark mode (`dark:`), and custom bracket values are all generated on-demand. Only the classes actually present in your markup are injected, keeping the CSS bundle small.
|
|
71
83
|
|
|
72
84
|
### Spacing (Margin & Padding)
|
|
73
85
|
|
|
@@ -479,6 +491,15 @@ You can also control the opacity of any color utility by appending `/{opacity}`
|
|
|
479
491
|
| `bg-auto` | `{"background-size":"auto"}` |
|
|
480
492
|
| `bg-cover` | `{"background-size":"cover"}` |
|
|
481
493
|
| `bg-contain` | `{"background-size":"contain"}` |
|
|
494
|
+
| `bg-center` | `{"background-position":"center"}` |
|
|
495
|
+
| `bg-top` | `{"background-position":"top"}` |
|
|
496
|
+
| `bg-bottom` | `{"background-position":"bottom"}` |
|
|
497
|
+
| `bg-left` | `{"background-position":"left"}` |
|
|
498
|
+
| `bg-right` | `{"background-position":"right"}` |
|
|
499
|
+
| `bg-left-top` | `{"background-position":"left top"}` |
|
|
500
|
+
| `bg-left-bottom` | `{"background-position":"left bottom"}` |
|
|
501
|
+
| `bg-right-top` | `{"background-position":"right top"}` |
|
|
502
|
+
| `bg-right-bottom` | `{"background-position":"right bottom"}` |
|
|
482
503
|
| `bg-no-repeat` | `{"background-repeat":"no-repeat"}` |
|
|
483
504
|
| `bg-fixed` | `{"background-attachment":"fixed"}` |
|
|
484
505
|
| `bg-local` | `{"background-attachment":"local"}` |
|
package/package.json
CHANGED
|
@@ -55,7 +55,7 @@ function generateMarkdown() {
|
|
|
55
55
|
"- **CSS Reset** (Tailwind Preflight): box-sizing, typography, form resets, media defaults\n";
|
|
56
56
|
md += "- **Base utility classes**: spacing, sizing, colors, layout, typography, and more\n";
|
|
57
57
|
md +=
|
|
58
|
-
"- **On-demand scanning**: responsive variants, pseudo-state variants, color opacity, custom bracket values, and dark mode are generated on-the-fly for only the classes actually used in your markup\n\n";
|
|
58
|
+
"- **On-demand scanning**: responsive variants, orientation variants, pseudo-state variants, color opacity, custom bracket values, and dark mode are generated on-the-fly for only the classes actually used in your markup\n\n";
|
|
59
59
|
|
|
60
60
|
md += "### Media Breakpoints\n\n";
|
|
61
61
|
md += "| Prefix | Min Width |\n";
|
|
@@ -65,6 +65,17 @@ function generateMarkdown() {
|
|
|
65
65
|
}
|
|
66
66
|
md += "\n";
|
|
67
67
|
|
|
68
|
+
md += "### Orientation\n\n";
|
|
69
|
+
md +=
|
|
70
|
+
"Use the `landscape:` and `portrait:` prefixes to apply styles based on screen orientation (`@media (orientation: …)`) rather than width, so layouts respond to device rotation without picking an arbitrary breakpoint:\n\n";
|
|
71
|
+
md += "```html\n";
|
|
72
|
+
md += "<!-- Stack vertically in portrait, side-by-side in landscape. -->\n";
|
|
73
|
+
md += '<div class="flex flex-col landscape:flex-row">\n';
|
|
74
|
+
md += ' <div class="board">...</div>\n';
|
|
75
|
+
md += ' <div class="moves-panel portrait:hidden">...</div>\n';
|
|
76
|
+
md += "</div>\n";
|
|
77
|
+
md += "```\n\n";
|
|
78
|
+
|
|
68
79
|
md += "### Pseudo States\n\n";
|
|
69
80
|
md += "The following pseudo states are supported for all utilities:\n";
|
|
70
81
|
md += "- `hover:`\n";
|
|
@@ -82,7 +93,7 @@ function generateMarkdown() {
|
|
|
82
93
|
md += "```html\n";
|
|
83
94
|
md += '<div class="bg-[#fff] dark:bg-[#1a1a1a] p-4 dark:border-gray-700">\n';
|
|
84
95
|
md += "```\n\n";
|
|
85
|
-
md += `> **Note:** Responsive variants (\`sm:\`, \`md:\`, etc.), pseudo-state variants (\`hover:\`, \`focus:\`, \`disabled:\`), color opacity (\`/N\`), dark mode (\`dark:\`), and custom bracket values are all generated on-demand. Only the classes actually present in your markup are injected, keeping the CSS bundle small.\n\n`;
|
|
96
|
+
md += `> **Note:** Responsive variants (\`sm:\`, \`md:\`, etc.), orientation variants (\`landscape:\`, \`portrait:\`), pseudo-state variants (\`hover:\`, \`focus:\`, \`disabled:\`), color opacity (\`/N\`), dark mode (\`dark:\`), and custom bracket values are all generated on-demand. Only the classes actually present in your markup are injected, keeping the CSS bundle small.\n\n`;
|
|
86
97
|
|
|
87
98
|
md += "### Spacing (Margin & Padding)\n\n";
|
|
88
99
|
md += "Spacing utilities use a 0.25rem (4px) unit by default.\n\n";
|
|
@@ -373,6 +384,15 @@ function generateMarkdown() {
|
|
|
373
384
|
"bg-auto",
|
|
374
385
|
"bg-cover",
|
|
375
386
|
"bg-contain",
|
|
387
|
+
"bg-center",
|
|
388
|
+
"bg-top",
|
|
389
|
+
"bg-bottom",
|
|
390
|
+
"bg-left",
|
|
391
|
+
"bg-right",
|
|
392
|
+
"bg-left-top",
|
|
393
|
+
"bg-left-bottom",
|
|
394
|
+
"bg-right-top",
|
|
395
|
+
"bg-right-bottom",
|
|
376
396
|
"bg-no-repeat",
|
|
377
397
|
"bg-fixed",
|
|
378
398
|
"bg-local",
|