brumate 0.5.2 → 0.6.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.
Files changed (73) hide show
  1. package/dist/{boot-Difa0qdg.d.ts → boot-DkbcqdUz.d.ts} +2 -2
  2. package/dist/cli.js +2 -2
  3. package/dist/{client-De-7aGlO.js → client-C3vRNuLi.js} +353 -103
  4. package/dist/client-C3vRNuLi.js.map +1 -0
  5. package/dist/{client-DvsU9qxG.d.ts → client-CqGDbWd_.d.ts} +45 -8
  6. package/dist/{defer-DlFYiAuK.js → defer-M18UKyfG.js} +2 -2
  7. package/dist/{defer-DlFYiAuK.js.map → defer-M18UKyfG.js.map} +1 -1
  8. package/dist/{devtools-Di_dI9tS.js → devtools-YnvrZ6D8.js} +4 -4
  9. package/dist/{devtools-Di_dI9tS.js.map → devtools-YnvrZ6D8.js.map} +1 -1
  10. package/dist/{devtools-panel-BvIKX1LY.js → devtools-panel-DRcKclEG.js} +2 -2
  11. package/dist/{devtools-panel-BvIKX1LY.js.map → devtools-panel-DRcKclEG.js.map} +1 -1
  12. package/dist/{features-D5kLyihb.js → features-CbgII-o7.js} +4 -2
  13. package/dist/features-CbgII-o7.js.map +1 -0
  14. package/dist/{files-s4wmjcZV.js → files-HzPDUyTY.js} +2 -2
  15. package/dist/{files-s4wmjcZV.js.map → files-HzPDUyTY.js.map} +1 -1
  16. package/dist/index.d.ts +8 -4
  17. package/dist/index.js +2 -7
  18. package/dist/index.js.map +1 -1
  19. package/dist/{inspect-BLPt-dZZ.js → inspect-Q5W0A66e.js} +476 -122
  20. package/dist/inspect-Q5W0A66e.js.map +1 -0
  21. package/dist/{loader-krRrJuIv.js → loader-C-S3yzep.js} +13 -5
  22. package/dist/loader-C-S3yzep.js.map +1 -0
  23. package/dist/{navigate-BcV1qkkx.js → navigate-r23FFR6e.js} +5 -2
  24. package/dist/{navigate-BcV1qkkx.js.map → navigate-r23FFR6e.js.map} +1 -1
  25. package/dist/routes-D21FQyGF.js +51 -0
  26. package/dist/routes-D21FQyGF.js.map +1 -0
  27. package/dist/{rpc-BYYAj1vV.js → rpc-C_znDZ_w.js} +3 -3
  28. package/dist/{rpc-BYYAj1vV.js.map → rpc-C_znDZ_w.js.map} +1 -1
  29. package/dist/runtime/bundles.d.ts +1 -1
  30. package/dist/runtime/client.d.ts +2 -2
  31. package/dist/runtime/client.js +3 -3
  32. package/dist/runtime/devtools.d.ts +1 -1
  33. package/dist/runtime/devtools.js +1 -1
  34. package/dist/runtime/hot.d.ts +1 -1
  35. package/dist/runtime/loader.d.ts +2 -2
  36. package/dist/runtime/loader.js +2 -2
  37. package/dist/runtime/routes.js +1 -51
  38. package/dist/runtime/server.d.ts +2 -2
  39. package/dist/runtime/server.js +3 -3
  40. package/dist/runtime/signals.d.ts +2 -140
  41. package/dist/runtime/signals.js +4 -1
  42. package/dist/runtime/signals.js.map +1 -1
  43. package/dist/runtime/static-loader.d.ts +2 -2
  44. package/dist/runtime/static-loader.js +1 -1
  45. package/dist/runtime/testing.d.ts +24 -4
  46. package/dist/runtime/testing.js +66 -2
  47. package/dist/runtime/testing.js.map +1 -1
  48. package/dist/{produce-Cq6KKi7b.js → search-params-CM1RWR2P.js} +25 -3
  49. package/dist/search-params-CM1RWR2P.js.map +1 -0
  50. package/dist/{server-Doy5HR7r.js → server-BcT9icQ4.js} +107 -40
  51. package/dist/server-BcT9icQ4.js.map +1 -0
  52. package/dist/{server-CAwIqrXl.d.ts → server-dP_ucRiJ.d.ts} +42 -3
  53. package/dist/signals-BwD4u22K.d.ts +165 -0
  54. package/dist/{static-loader-DoHWsf9t.js → static-loader-Bt2WDkY1.js} +3 -3
  55. package/dist/{static-loader-DoHWsf9t.js.map → static-loader-Bt2WDkY1.js.map} +1 -1
  56. package/dist/{static-loader-9Nc1GvF0.d.ts → static-loader-DysAET-w.d.ts} +2 -2
  57. package/dist/{stream-BdhzvPQO.js → stream-DRjx0keF.js} +2 -2
  58. package/dist/{stream-BdhzvPQO.js.map → stream-DRjx0keF.js.map} +1 -1
  59. package/dist/vite.d.ts +1 -1
  60. package/dist/vite.js +18 -13
  61. package/dist/vite.js.map +1 -1
  62. package/elements.d.ts +239 -37
  63. package/package.json +6 -1
  64. package/skills/brumate/references/errors.md +46 -12
  65. package/skills/brumate/references/signals.md +27 -25
  66. package/skills/brumate/references/syntax.md +1 -1
  67. package/dist/client-De-7aGlO.js.map +0 -1
  68. package/dist/features-D5kLyihb.js.map +0 -1
  69. package/dist/inspect-BLPt-dZZ.js.map +0 -1
  70. package/dist/loader-krRrJuIv.js.map +0 -1
  71. package/dist/produce-Cq6KKi7b.js.map +0 -1
  72. package/dist/runtime/routes.js.map +0 -1
  73. package/dist/server-Doy5HR7r.js.map +0 -1
package/elements.d.ts CHANGED
@@ -253,50 +253,252 @@ type EventWord<K extends string> = K extends keyof ElementEventNames
253
253
  ? ElementEventNames[K]
254
254
  : Capitalize<K>;
255
255
 
256
- /** The handlers of an element: `onClick` for `click`, and `onKeyDown` for `keydown`. */
256
+ /**
257
+ * The handlers of an element: `onClick` for `click`, and `onKeyDown` for `keydown`. The `webkit*`
258
+ * names are left out: the browser fires them as `webkitAnimationEnd` and the like, and the
259
+ * compiler lower-cases a handler name. Use `onAnimationEnd` and `onTransitionEnd`.
260
+ */
257
261
  export type Handlers<E> = {
258
- [K in keyof ElementEvents & string as `on${EventWord<K>}`]?: Handler<ElementEvents[K], E>;
262
+ [
263
+ K in keyof ElementEvents & string as K extends `webkit${string}` ? never : `on${EventWord<K>}`
264
+ ]?: Handler<ElementEvents[K], E>;
259
265
  };
260
266
 
267
+ /** A value of an ARIA attribute that is `true` or `false`. The runtime writes both as words. */
268
+ type AriaBool = boolean | 'true' | 'false';
269
+
270
+ /** The tokens of `aria-relevant`: `all`, or one to three of the others in any order. */
271
+ type AriaRelevantToken = 'additions' | 'removals' | 'text';
272
+ type AriaRelevant =
273
+ | 'all'
274
+ | AriaRelevantToken
275
+ | `${AriaRelevantToken} ${AriaRelevantToken}`
276
+ | `${AriaRelevantToken} ${AriaRelevantToken} ${AriaRelevantToken}`;
277
+
278
+ /** The roles of WAI-ARIA 1.2 and of the Digital Publishing module (`doc-*`). */
279
+ export type AriaRole =
280
+ | 'alert'
281
+ | 'alertdialog'
282
+ | 'application'
283
+ | 'article'
284
+ | 'banner'
285
+ | 'blockquote'
286
+ | 'button'
287
+ | 'caption'
288
+ | 'cell'
289
+ | 'checkbox'
290
+ | 'code'
291
+ | 'columnheader'
292
+ | 'combobox'
293
+ | 'complementary'
294
+ | 'contentinfo'
295
+ | 'definition'
296
+ | 'deletion'
297
+ | 'dialog'
298
+ | 'directory'
299
+ | 'document'
300
+ | 'emphasis'
301
+ | 'feed'
302
+ | 'figure'
303
+ | 'form'
304
+ | 'generic'
305
+ | 'grid'
306
+ | 'gridcell'
307
+ | 'group'
308
+ | 'heading'
309
+ | 'img'
310
+ | 'insertion'
311
+ | 'link'
312
+ | 'list'
313
+ | 'listbox'
314
+ | 'listitem'
315
+ | 'log'
316
+ | 'main'
317
+ | 'mark'
318
+ | 'marquee'
319
+ | 'math'
320
+ | 'menu'
321
+ | 'menubar'
322
+ | 'menuitem'
323
+ | 'menuitemcheckbox'
324
+ | 'menuitemradio'
325
+ | 'meter'
326
+ | 'navigation'
327
+ | 'none'
328
+ | 'note'
329
+ | 'option'
330
+ | 'paragraph'
331
+ | 'presentation'
332
+ | 'progressbar'
333
+ | 'radio'
334
+ | 'radiogroup'
335
+ | 'region'
336
+ | 'row'
337
+ | 'rowgroup'
338
+ | 'rowheader'
339
+ | 'scrollbar'
340
+ | 'search'
341
+ | 'searchbox'
342
+ | 'separator'
343
+ | 'slider'
344
+ | 'spinbutton'
345
+ | 'status'
346
+ | 'strong'
347
+ | 'subscript'
348
+ | 'superscript'
349
+ | 'switch'
350
+ | 'tab'
351
+ | 'table'
352
+ | 'tablist'
353
+ | 'tabpanel'
354
+ | 'term'
355
+ | 'textbox'
356
+ | 'time'
357
+ | 'timer'
358
+ | 'toolbar'
359
+ | 'tooltip'
360
+ | 'tree'
361
+ | 'treegrid'
362
+ | 'treeitem'
363
+ | 'doc-abstract'
364
+ | 'doc-acknowledgments'
365
+ | 'doc-afterword'
366
+ | 'doc-appendix'
367
+ | 'doc-backlink'
368
+ | 'doc-biblioentry'
369
+ | 'doc-bibliography'
370
+ | 'doc-biblioref'
371
+ | 'doc-chapter'
372
+ | 'doc-colophon'
373
+ | 'doc-conclusion'
374
+ | 'doc-cover'
375
+ | 'doc-credit'
376
+ | 'doc-credits'
377
+ | 'doc-dedication'
378
+ | 'doc-endnote'
379
+ | 'doc-endnotes'
380
+ | 'doc-epigraph'
381
+ | 'doc-epilogue'
382
+ | 'doc-errata'
383
+ | 'doc-example'
384
+ | 'doc-footnote'
385
+ | 'doc-foreword'
386
+ | 'doc-glossary'
387
+ | 'doc-glossref'
388
+ | 'doc-index'
389
+ | 'doc-introduction'
390
+ | 'doc-noteref'
391
+ | 'doc-notice'
392
+ | 'doc-pagebreak'
393
+ | 'doc-pagefooter'
394
+ | 'doc-pageheader'
395
+ | 'doc-pagelist'
396
+ | 'doc-part'
397
+ | 'doc-preface'
398
+ | 'doc-prologue'
399
+ | 'doc-pullquote'
400
+ | 'doc-qna'
401
+ | 'doc-subtitle'
402
+ | 'doc-tip'
403
+ | 'doc-toc';
404
+
405
+ /** The ARIA attributes of WAI-ARIA 1.2 and the value of each. */
406
+ export interface AriaAttributes {
407
+ 'aria-activedescendant'?: Attr<string>;
408
+ 'aria-atomic'?: Attr<AriaBool>;
409
+ 'aria-autocomplete'?: Attr<'none' | 'inline' | 'list' | 'both'>;
410
+ 'aria-braillelabel'?: Attr<string>;
411
+ 'aria-brailleroledescription'?: Attr<string>;
412
+ 'aria-busy'?: Attr<AriaBool>;
413
+ 'aria-checked'?: Attr<AriaBool | 'mixed'>;
414
+ 'aria-colcount'?: Attr<Num>;
415
+ 'aria-colindex'?: Attr<Num>;
416
+ 'aria-colindextext'?: Attr<string>;
417
+ 'aria-colspan'?: Attr<Num>;
418
+ /** A list of IDs, separated by spaces. */
419
+ 'aria-controls'?: Attr<string>;
420
+ 'aria-current'?: Attr<AriaBool | 'page' | 'step' | 'location' | 'date' | 'time'>;
421
+ 'aria-describedby'?: Attr<string>;
422
+ 'aria-description'?: Attr<string>;
423
+ 'aria-details'?: Attr<string>;
424
+ 'aria-disabled'?: Attr<AriaBool>;
425
+ 'aria-errormessage'?: Attr<string>;
426
+ 'aria-expanded'?: Attr<AriaBool>;
427
+ 'aria-flowto'?: Attr<string>;
428
+ 'aria-haspopup'?: Attr<AriaBool | 'menu' | 'listbox' | 'tree' | 'grid' | 'dialog'>;
429
+ 'aria-hidden'?: Attr<AriaBool>;
430
+ 'aria-invalid'?: Attr<AriaBool | 'grammar' | 'spelling'>;
431
+ 'aria-keyshortcuts'?: Attr<string>;
432
+ 'aria-label'?: Attr<string>;
433
+ 'aria-labelledby'?: Attr<string>;
434
+ 'aria-level'?: Attr<Num>;
435
+ 'aria-live'?: Attr<'off' | 'assertive' | 'polite'>;
436
+ 'aria-modal'?: Attr<AriaBool>;
437
+ 'aria-multiline'?: Attr<AriaBool>;
438
+ 'aria-multiselectable'?: Attr<AriaBool>;
439
+ 'aria-orientation'?: Attr<'horizontal' | 'vertical'>;
440
+ 'aria-owns'?: Attr<string>;
441
+ 'aria-placeholder'?: Attr<string>;
442
+ 'aria-posinset'?: Attr<Num>;
443
+ 'aria-pressed'?: Attr<AriaBool | 'mixed'>;
444
+ 'aria-readonly'?: Attr<AriaBool>;
445
+ 'aria-relevant'?: Attr<AriaRelevant>;
446
+ 'aria-required'?: Attr<AriaBool>;
447
+ 'aria-roledescription'?: Attr<string>;
448
+ 'aria-rowcount'?: Attr<Num>;
449
+ 'aria-rowindex'?: Attr<Num>;
450
+ 'aria-rowindextext'?: Attr<string>;
451
+ 'aria-rowspan'?: Attr<Num>;
452
+ 'aria-selected'?: Attr<AriaBool>;
453
+ 'aria-setsize'?: Attr<Num>;
454
+ 'aria-sort'?: Attr<'none' | 'ascending' | 'descending' | 'other'>;
455
+ 'aria-valuemax'?: Attr<Num>;
456
+ 'aria-valuemin'?: Attr<Num>;
457
+ 'aria-valuenow'?: Attr<Num>;
458
+ 'aria-valuetext'?: Attr<string>;
459
+ }
460
+
261
461
  /**
262
462
  * The attributes that every element takes: `class`, `style`, the handlers, `ref`, `data-*` and
263
463
  * `aria-*`. `E` is the element, for the handlers and `ref`.
264
464
  */
265
- export type GlobalAttributes<E> = Handlers<E> & {
266
- /**
267
- * Binds the element to a name: `ref=$bind(name)`. The signal can hold the element, a supertype
268
- * of it such as `HTMLElement | undefined`, or `null`. A signal of another element is an error.
269
- */
270
- ref?: BindableMark<unknown> & WritableMark<E>;
271
- class?: Attr<ClassValue>;
272
- style?: Attr<string | StyleObject>;
273
- id?: Attr<string>;
274
- slot?: Attr<string>;
275
- part?: Attr<string>;
276
- is?: Attr<string>;
277
- role?: Attr<string>;
278
- title?: Attr<string>;
279
- lang?: Attr<string>;
280
- dir?: Attr<'ltr' | 'rtl' | 'auto'>;
281
- nonce?: Attr<string>;
282
- accesskey?: Attr<string>;
283
- autocapitalize?: Attr<'off' | 'none' | 'on' | 'sentences' | 'words' | 'characters'>;
284
- autofocus?: Attr<boolean>;
285
- contenteditable?: Attr<boolean | 'true' | 'false' | 'plaintext-only'>;
286
- draggable?: Attr<boolean | 'true' | 'false'>;
287
- enterkeyhint?: Attr<'enter' | 'done' | 'go' | 'next' | 'previous' | 'search' | 'send'>;
288
- hidden?: Attr<boolean | 'hidden' | 'until-found'>;
289
- inert?: Attr<boolean>;
290
- inputmode?: Attr<'none' | 'text' | 'tel' | 'url' | 'email' | 'numeric' | 'decimal' | 'search'>;
291
- popover?: Attr<boolean | 'auto' | 'manual' | 'hint'>;
292
- spellcheck?: Attr<boolean | 'true' | 'false'>;
293
- tabindex?: Attr<Num>;
294
- translate?: Attr<'yes' | 'no'>;
295
- writingsuggestions?: Attr<boolean | 'true' | 'false'>;
296
- autocorrect?: Attr<boolean | 'on' | 'off'>;
297
- [attribute: `data-${string}`]: unknown;
298
- [attribute: `aria-${string}`]: Attr<string | number | boolean>;
299
- };
465
+ export type GlobalAttributes<E> = Handlers<E> &
466
+ AriaAttributes & {
467
+ /**
468
+ * Binds the element to a name: `ref=$bind(name)`. The signal can hold the element, a supertype
469
+ * of it such as `HTMLElement | undefined`, or `null`. A signal of another element is an error.
470
+ */
471
+ ref?: BindableMark<unknown> & WritableMark<E>;
472
+ class?: Attr<ClassValue>;
473
+ style?: Attr<string | StyleObject>;
474
+ id?: Attr<string>;
475
+ slot?: Attr<string>;
476
+ part?: Attr<string>;
477
+ is?: Attr<string>;
478
+ /** A role, or a list of fallback roles: `doc-footnote listitem`. */
479
+ role?: Attr<AriaRole | `${AriaRole} ${string}`>;
480
+ title?: Attr<string>;
481
+ lang?: Attr<string>;
482
+ dir?: Attr<'ltr' | 'rtl' | 'auto'>;
483
+ nonce?: Attr<string>;
484
+ accesskey?: Attr<string>;
485
+ autocapitalize?: Attr<'off' | 'none' | 'on' | 'sentences' | 'words' | 'characters'>;
486
+ autofocus?: Attr<boolean>;
487
+ contenteditable?: Attr<boolean | 'true' | 'false' | 'plaintext-only'>;
488
+ draggable?: Attr<boolean | 'true' | 'false'>;
489
+ enterkeyhint?: Attr<'enter' | 'done' | 'go' | 'next' | 'previous' | 'search' | 'send'>;
490
+ hidden?: Attr<boolean | 'hidden' | 'until-found'>;
491
+ inert?: Attr<boolean>;
492
+ inputmode?: Attr<'none' | 'text' | 'tel' | 'url' | 'email' | 'numeric' | 'decimal' | 'search'>;
493
+ popover?: Attr<boolean | 'auto' | 'manual' | 'hint'>;
494
+ spellcheck?: Attr<boolean | 'true' | 'false'>;
495
+ tabindex?: Attr<Num>;
496
+ translate?: Attr<'yes' | 'no'>;
497
+ writingsuggestions?: Attr<boolean | 'true' | 'false'>;
498
+ autocorrect?: Attr<boolean | 'on' | 'off'>;
499
+ [attribute: `data-${string}`]: unknown;
500
+ [attribute: `aria-${string}`]: Attr<string | number | boolean>;
501
+ };
300
502
 
301
503
  type Referrer =
302
504
  | 'no-referrer'
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "brumate",
3
- "version": "0.5.2",
3
+ "version": "0.6.1",
4
4
  "description": "A component language and compiler for resumable web apps",
5
5
  "homepage": "https://github.com/lxsmnsyc/brumate",
6
6
  "bugs": "https://github.com/lxsmnsyc/brumate/issues",
@@ -140,6 +140,7 @@
140
140
  "devDependencies": {
141
141
  "@oxc-project/types": "^0.154.0",
142
142
  "@types/node": "^24.0.0",
143
+ "axe-core": "^4.14.0",
143
144
  "happy-dom": "^20.14.6",
144
145
  "less": "^4.9.1",
145
146
  "sass": "^1.105.2",
@@ -150,11 +151,15 @@
150
151
  "vitest": "^5.0.4"
151
152
  },
152
153
  "peerDependencies": {
154
+ "axe-core": ">=4.8",
153
155
  "less": ">=4",
154
156
  "sass": ">=1.70",
155
157
  "vite": "^8.0.0"
156
158
  },
157
159
  "peerDependenciesMeta": {
160
+ "axe-core": {
161
+ "optional": true
162
+ },
158
163
  "vite": {
159
164
  "optional": true
160
165
  },
@@ -237,13 +237,15 @@ https://brumate-docs.vercel.app/docs/errors#brm021
237
237
  <input disabled>
238
238
  ```
239
239
 
240
- ## BRM022: Unknown event modifier ":{modifier}"
240
+ ## BRM022: Event modifiers in the attribute name were removed. Write {fix}
241
241
 
242
- The modifier after an event name is not one of the known ones.
242
+ A modifier follows the event name, as in `onSubmit:prevent=send`. Wrappers of `brumate/events` write modifiers now, and `:passive` is the default, since listeners are passive unless a handler prevents.
243
243
 
244
244
  https://brumate-docs.vercel.app/docs/errors#brm022
245
245
 
246
246
  ```brm fragment
247
+ import { prevent } from 'brumate/events';
248
+
247
249
  <form onSubmit=(prevent(send))></form>
248
250
  ```
249
251
 
@@ -257,6 +259,20 @@ https://brumate-docs.vercel.app/docs/errors#brm180
257
259
  <input onKeyDown=(handle) onFocusOut=(handle) />
258
260
  ```
259
261
 
262
+ ## BRM201: "{name}" cannot be a handler. {fix}
263
+
264
+ The event has capitals in its name, or the browser fires another name for it, and a handler name is lower-cased to the event. `onDOMContentLoaded` would listen to `domcontentloaded`, which the browser never fires, and page code loads after the HTML, mostly after `DOMContentLoaded`. Use the event that the message names, or `$client(fn, 'load')` to run code at load.
265
+
266
+ https://brumate-docs.vercel.app/docs/errors#brm201
267
+
268
+ ```brm fragment
269
+ <script>
270
+ $client(() => {
271
+ start();
272
+ }, 'load');
273
+ </script>
274
+ ```
275
+
260
276
  ## BRM186: "{name}" in the #loading header is not a memo that markup in the body reads. Name a $memo of the component or of a block script around the block
261
277
 
262
278
  The header of `#loading (…)` names something other than a memo, or a memo that no markup in the body reads, so its loads would not show the fallback for that body.
@@ -358,16 +374,6 @@ https://brumate-docs.vercel.app/docs/errors#brm188
358
374
  }
359
375
  ```
360
376
 
361
- ## BRM023: Modifiers apply to elements. Put ":{modifier}" on the element that the component renders
362
-
363
- An event modifier is on a component, which only passes the handler on.
364
-
365
- https://brumate-docs.vercel.app/docs/errors#brm023
366
-
367
- ```brm fragment
368
- <form onSubmit=(prevent(send))></form>
369
- ```
370
-
371
377
  ## BRM024: Expected an event handler
372
378
 
373
379
  An event attribute has no `=` and no value.
@@ -538,6 +544,34 @@ https://brumate-docs.vercel.app/docs/errors#brm038
538
544
  </style>
539
545
  ```
540
546
 
547
+ ## BRM189: Unknown <style> attribute "{name}"
548
+
549
+ A `<style>` has an attribute other than `lang` and `global`.
550
+
551
+ https://brumate-docs.vercel.app/docs/errors#brm189
552
+
553
+ ```brm fragment
554
+ <style scoped>
555
+ p {
556
+ color: red;
557
+ }
558
+ </style>
559
+ ```
560
+
561
+ ## BRM190: global takes no value, as in <style global>
562
+
563
+ A `<style global>` gives `global` a value.
564
+
565
+ https://brumate-docs.vercel.app/docs/errors#brm190
566
+
567
+ ```brm fragment
568
+ <style global="true">
569
+ p {
570
+ color: red;
571
+ }
572
+ </style>
573
+ ```
574
+
541
575
  ## BRM039: #reveal takes an order, 'sequential', 'backwards', 'together' or 'natural', and collapsed, such as #reveal ('sequential', collapsed)
542
576
 
543
577
  `#reveal` has an option that it does not know.
@@ -4,31 +4,32 @@ The compiler replaces each call and removes the import, so none of them ship. Im
4
4
 
5
5
  "Top level of a script" means a statement of the component's `<script>`, or of a `<script>` at the start of a block body. It is not inside a function or another statement.
6
6
 
7
- | Function | Returns | Where |
8
- | ----------------------------- | -------------------------- | ----------------------------------------------------- |
9
- | `$props<T>()` | `T` | `const` or `let` in the component script |
10
- | `$signal<T>(value?)` | `T` | `let` at the top level of a script |
11
- | `$memo<T>(value)` | the value, never a promise | `const` at the top level of a script |
12
- | `$debounced(value, ms)` | the value, as a memo | `const` at the top level of a script |
13
- | `$throttled(value, ms)` | the value, as a memo | `const` at the top level of a script |
14
- | `$isPending(memo)` | `boolean` | Any expression |
15
- | `$resolve(memo, options?)` | `Promise<T>` | A handler, an effect or a `$client` callback |
16
- | `$isPassed(prop)` | `boolean` | `const` in the component script |
17
- | `$isBound(prop)` | `boolean` | Any expression |
18
- | `$effect(callback)` | `void` | Statement at the top level of a script |
19
- | `$client(callback, trigger?)` | `void` | Statement at the top level of a script |
20
- | `$untrack(value)` | the value | Any expression |
21
- | `$produce(signal, recipe)` | `void` | Where a signal can be written |
22
- | `$setContext(context, value)` | `void` | Statement at the top level of a script |
23
- | `$getContext(context)` | the value | `const` at the top level of a script |
24
- | `$route(path?)` | `{ url, search, params }` | `const` at the top level of a script |
25
- | `$navigation()` | `{ pending, from, to }` | `const` at the top level of a script |
26
- | `$id()` | `string` | `const` at the top level of a script |
27
- | `$title(value)` | `void` | Statement at the top level of a script |
28
- | `$action(fn)` | the result, or `undefined` | `const` at the top level of a script |
29
- | `$optimistic(source)` | the value of `source` | `let` at the top level of a script |
30
- | `$handler(fn, ...args)` | a handler | Any expression of a script or a module function |
31
- | `$bind(value, set?)` | a binding | The whole value of a prop, or of `value` or `checked` |
7
+ | Function | Returns | Where |
8
+ | ------------------------------ | -------------------------- | ----------------------------------------------------- |
9
+ | `$props<T>()` | `T` | `const` or `let` in the component script |
10
+ | `$signal<T>(value?)` | `T` | `let` at the top level of a script |
11
+ | `$memo<T>(value)` | the value, never a promise | `const` at the top level of a script |
12
+ | `$debounced(value, ms)` | the value, as a memo | `const` at the top level of a script |
13
+ | `$throttled(value, ms)` | the value, as a memo | `const` at the top level of a script |
14
+ | `$isPending(memo)` | `boolean` | Any expression |
15
+ | `$resolve(memo, options?)` | `Promise<T>` | A handler, an effect or a `$client` callback |
16
+ | `$isPassed(prop)` | `boolean` | `const` in the component script |
17
+ | `$isBound(prop)` | `boolean` | Any expression |
18
+ | `$effect(callback)` | `void` | Statement at the top level of a script |
19
+ | `$client(callback, trigger?)` | `void` | Statement at the top level of a script |
20
+ | `$untrack(value)` | the value | Any expression |
21
+ | `$produce(signal, recipe)` | `void` | Where a signal can be written |
22
+ | `$setContext(context, value)` | `void` | Statement at the top level of a script |
23
+ | `$getContext(context)` | the value | `const` at the top level of a script |
24
+ | `$route(path?)` | `{ url, search, params }` | `const` at the top level of a script |
25
+ | `$searchParam(name, options?)` | the value of the parameter | `let` at the top level of a script |
26
+ | `$navigation()` | `{ pending, from, to }` | `const` at the top level of a script |
27
+ | `$id()` | `string` | `const` at the top level of a script |
28
+ | `$title(value)` | `void` | Statement at the top level of a script |
29
+ | `$action(fn)` | the result, or `undefined` | `const` at the top level of a script |
30
+ | `$optimistic(source)` | the value of `source` | `let` at the top level of a script |
31
+ | `$handler(fn, ...args)` | a handler | Any expression of a script or a module function |
32
+ | `$bind(value, set?)` | a binding | The whole value of a prop, or of `value` or `checked` |
32
33
 
33
34
  ## What each one does
34
35
 
@@ -48,6 +49,7 @@ The compiler replaces each call and removes the import, so none of them ship. Im
48
49
  - `$setContext(context, value)`: gives a value of a context to the components inside. Create the context with `createContext` from `brumate/context`.
49
50
  - `$getContext(context)`: reads a context from the nearest component above that provides it, or its default.
50
51
  - `$route(path?)`: the current route, as `{ url, search, params }`. The path is the route, such as `'/posts/[id]'`, and takes at most one argument.
52
+ - `$searchParam(name, options?)`: a signal bound to one parameter of the query string. The server reads the URL, and a write in the browser changes it with `replaceState` (`{ history: 'push' }` for `pushState`) and asks the server nothing. Back and forward write the signal. Options: `default` (left out of the URL), `parse`, `serialize`, `history`, `server` (a write navigates). The name is a string literal.
51
53
  - `$navigation()`: the state of a navigation, as `{ pending, from, to }`. It takes no arguments.
52
54
  - `$id()`: an ID that is unique in the page and the same on the server and in the browser. It takes no arguments.
53
55
  - `$title(value)`: sets the title of the page. The compiler warns about it, and it will be removed: use `<title>` in `#head`. It takes one argument.
@@ -23,7 +23,7 @@
23
23
  ```
24
24
 
25
25
  - `<script>` runs once for each instance, on the server. `<script module>` runs once per module, and its exports can be imported.
26
- - `<style>` is scoped to the component. `lang="scss"` and `lang="less"` work.
26
+ - `<style>` is scoped to the component. `<style global>` is not: its rules apply to the whole page, such as `body` or `.toolbar button`, with no `:global(…)` around them. `lang="scss"` and `lang="less"` work in both. Both are top level only.
27
27
  - A file has at most one of each script. Markup can come before or after them.
28
28
  - Markup in a script, an expression or an attribute value is an error. Use a `#template`.
29
29