brumate 0.6.1 → 0.7.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/check.d.ts +3 -3
- package/dist/{boot-DkbcqdUz.d.ts → boot-Cs_P8cDu.d.ts} +2 -2
- package/dist/cli.js +77 -6
- package/dist/cli.js.map +1 -1
- package/dist/{client-CqGDbWd_.d.ts → client-BDPsTd4q.d.ts} +40 -14
- package/dist/{client-C3vRNuLi.js → client-DYIZ7BYK.js} +271 -112
- package/dist/client-DYIZ7BYK.js.map +1 -0
- package/dist/{client-routes-BtGpYCef.js → client-routes-BmPvNr4s.js} +10 -1
- package/dist/client-routes-BmPvNr4s.js.map +1 -0
- package/dist/{context-btHuB01Z.d.ts → context-BNgBXVUQ.d.ts} +7 -5
- package/dist/{context-CTiSzQRc.js → context-CU4Fpn5a.js} +10 -13
- package/dist/context-CU4Fpn5a.js.map +1 -0
- package/dist/{defer-M18UKyfG.js → defer-7JDhFxQq.js} +2 -2
- package/dist/{defer-M18UKyfG.js.map → defer-7JDhFxQq.js.map} +1 -1
- package/dist/{devtools-YnvrZ6D8.js → devtools-CzSp1GGq.js} +34 -24
- package/dist/devtools-CzSp1GGq.js.map +1 -0
- package/dist/{devtools-panel-DRcKclEG.js → devtools-panel-DugGrz7L.js} +32 -9
- package/dist/devtools-panel-DugGrz7L.js.map +1 -0
- package/dist/{features-CbgII-o7.js → features-DwMYKBIC.js} +6 -2
- package/dist/features-DwMYKBIC.js.map +1 -0
- package/dist/{files-HzPDUyTY.js → files-XX5yW3KL.js} +94 -3
- package/dist/files-XX5yW3KL.js.map +1 -0
- package/dist/index.d.ts +49 -0
- package/dist/index.js +3 -3
- package/dist/index.js.map +1 -1
- package/dist/{inspect-Q5W0A66e.js → inspect-B9cRF6AM.js} +2767 -2077
- package/dist/inspect-B9cRF6AM.js.map +1 -0
- package/dist/{loader-C-S3yzep.js → loader-BGSXt_Eb.js} +5 -5
- package/dist/{loader-C-S3yzep.js.map → loader-BGSXt_Eb.js.map} +1 -1
- package/dist/{rpc-C_znDZ_w.js → rpc-B9EkaPdU.js} +3 -3
- package/dist/{rpc-C_znDZ_w.js.map → rpc-B9EkaPdU.js.map} +1 -1
- package/dist/runtime/bundles.d.ts +1 -1
- package/dist/runtime/bundles.js +2 -0
- package/dist/runtime/bundles.js.map +1 -1
- package/dist/runtime/client.d.ts +4 -4
- package/dist/runtime/client.js +4 -4
- package/dist/runtime/context.d.ts +2 -2
- package/dist/runtime/context.js +1 -1
- package/dist/runtime/devtools.d.ts +15 -2
- package/dist/runtime/devtools.js +2 -2
- package/dist/runtime/hot.d.ts +1 -1
- package/dist/runtime/html.d.ts +1 -1
- package/dist/runtime/loader.d.ts +2 -2
- package/dist/runtime/loader.js +2 -2
- package/dist/runtime/server.d.ts +4 -4
- package/dist/runtime/server.js +4 -4
- package/dist/runtime/signals.d.ts +2 -2
- package/dist/runtime/signals.js +43 -5
- package/dist/runtime/signals.js.map +1 -1
- package/dist/runtime/static-loader.d.ts +2 -2
- package/dist/runtime/static-loader.js +1 -1
- package/dist/runtime/store.d.ts +2 -0
- package/dist/runtime/store.js +1 -0
- package/dist/runtime/testing.d.ts +2 -2
- package/dist/runtime/testing.js +2 -2
- package/dist/{search-params-CM1RWR2P.js → search-params-Cy3uRphR.js} +33 -8
- package/dist/search-params-Cy3uRphR.js.map +1 -0
- package/dist/{server-BcT9icQ4.js → server-C1OTFH4r.js} +127 -14
- package/dist/server-C1OTFH4r.js.map +1 -0
- package/dist/{server-dP_ucRiJ.d.ts → server-CavhuoFI.d.ts} +32 -8
- package/dist/{shared-CzbnWkVA.d.ts → shared-CRduzyi3.d.ts} +15 -2
- package/dist/{signals-BwD4u22K.d.ts → signals-DBnq9QRW.d.ts} +46 -6
- package/dist/{static-loader-DysAET-w.d.ts → static-loader-D5hvLQK7.d.ts} +2 -2
- package/dist/{static-loader-Bt2WDkY1.js → static-loader-XGXMzfJR.js} +3 -3
- package/dist/{static-loader-Bt2WDkY1.js.map → static-loader-XGXMzfJR.js.map} +1 -1
- package/dist/store-BIBAYZo-.js +293 -0
- package/dist/store-BIBAYZo-.js.map +1 -0
- package/dist/store-xlTzAM_r.d.ts +171 -0
- package/dist/{stream-DRjx0keF.js → stream-BBnArf_5.js} +89 -3
- package/dist/stream-BBnArf_5.js.map +1 -0
- package/dist/vite.d.ts +1 -1
- package/dist/vite.js +128 -13
- package/dist/vite.js.map +1 -1
- package/elements.d.ts +268 -21
- package/package.json +5 -1
- package/skills/brumate/SKILL.md +1 -1
- package/skills/brumate/references/errors.md +127 -9
- package/skills/brumate/references/signals.md +37 -30
- package/skills/brumate/references/state.md +3 -2
- package/dist/client-C3vRNuLi.js.map +0 -1
- package/dist/client-routes-BtGpYCef.js.map +0 -1
- package/dist/context-CTiSzQRc.js.map +0 -1
- package/dist/devtools-YnvrZ6D8.js.map +0 -1
- package/dist/devtools-panel-DRcKclEG.js.map +0 -1
- package/dist/features-CbgII-o7.js.map +0 -1
- package/dist/files-HzPDUyTY.js.map +0 -1
- package/dist/inspect-Q5W0A66e.js.map +0 -1
- package/dist/search-params-CM1RWR2P.js.map +0 -1
- package/dist/server-BcT9icQ4.js.map +0 -1
- package/dist/stream-DRjx0keF.js.map +0 -1
package/elements.d.ts
CHANGED
|
@@ -51,7 +51,8 @@ type Num = number | `${number}`;
|
|
|
51
51
|
|
|
52
52
|
/**
|
|
53
53
|
* A handler of the event `Ev` on the element `E`, which is `event.currentTarget`. Use it to type
|
|
54
|
-
* a function that a handler prop takes: `EventHandler<HTMLButtonElement, MouseEvent>`.
|
|
54
|
+
* a function that a handler prop takes: `EventHandler<HTMLButtonElement, MouseEvent>`. Its
|
|
55
|
+
* `target` stays `EventTarget`; for the typed target of a form control, use `ElementEvent`.
|
|
55
56
|
*/
|
|
56
57
|
export type EventHandler<E, Ev = Event> = (event: Ev & { currentTarget: E }) => unknown;
|
|
57
58
|
|
|
@@ -145,7 +146,28 @@ type BoundValue = BindableMark<unknown> & WritableMark<string>;
|
|
|
145
146
|
/** What `checked=$bind(name)` takes: a binding that can hold the boolean the field writes. */
|
|
146
147
|
type BoundChecked = BindableMark<unknown> & WritableMark<boolean>;
|
|
147
148
|
|
|
148
|
-
|
|
149
|
+
/** The events that a form control fires at itself, as Solid types them: `target` is the control. */
|
|
150
|
+
type ControlEventName =
|
|
151
|
+
| 'input'
|
|
152
|
+
| 'change'
|
|
153
|
+
| 'beforeinput'
|
|
154
|
+
| 'focus'
|
|
155
|
+
| 'blur'
|
|
156
|
+
| 'focusin'
|
|
157
|
+
| 'focusout';
|
|
158
|
+
|
|
159
|
+
type ControlElement = HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement;
|
|
160
|
+
|
|
161
|
+
/**
|
|
162
|
+
* The event `K` on the element `E`. `currentTarget` is `E`. `target` is `E` for the events of
|
|
163
|
+
* `ControlEventName` on an `input`, a `select` or a `textarea`, and `Element` for the others.
|
|
164
|
+
*/
|
|
165
|
+
export type ElementEvent<K extends keyof ElementEvents, E> = ElementEvents[K] & {
|
|
166
|
+
currentTarget: E;
|
|
167
|
+
target: [E] extends [ControlElement] ? (K extends ControlEventName ? E : Element) : Element;
|
|
168
|
+
};
|
|
169
|
+
|
|
170
|
+
type Handler<K extends keyof ElementEvents, E> = (event: ElementEvent<K, E>) => unknown;
|
|
149
171
|
|
|
150
172
|
/**
|
|
151
173
|
* The camel-case name of each event whose name has more than one word, by the name of the event:
|
|
@@ -261,7 +283,7 @@ type EventWord<K extends string> = K extends keyof ElementEventNames
|
|
|
261
283
|
export type Handlers<E> = {
|
|
262
284
|
[
|
|
263
285
|
K in keyof ElementEvents & string as K extends `webkit${string}` ? never : `on${EventWord<K>}`
|
|
264
|
-
]?: Handler<
|
|
286
|
+
]?: Handler<K, E>;
|
|
265
287
|
};
|
|
266
288
|
|
|
267
289
|
/** A value of an ARIA attribute that is `true` or `false`. The runtime writes both as words. */
|
|
@@ -496,6 +518,12 @@ export type GlobalAttributes<E> = Handlers<E> &
|
|
|
496
518
|
translate?: Attr<'yes' | 'no'>;
|
|
497
519
|
writingsuggestions?: Attr<boolean | 'true' | 'false'>;
|
|
498
520
|
autocorrect?: Attr<boolean | 'on' | 'off'>;
|
|
521
|
+
exportparts?: Attr<string>;
|
|
522
|
+
itemid?: Attr<string>;
|
|
523
|
+
itemprop?: Attr<string>;
|
|
524
|
+
itemref?: Attr<string>;
|
|
525
|
+
itemscope?: Attr<boolean>;
|
|
526
|
+
itemtype?: Attr<string>;
|
|
499
527
|
[attribute: `data-${string}`]: unknown;
|
|
500
528
|
[attribute: `aria-${string}`]: Attr<string | number | boolean>;
|
|
501
529
|
};
|
|
@@ -512,6 +540,112 @@ type Referrer =
|
|
|
512
540
|
type CrossOrigin = boolean | 'anonymous' | 'use-credentials';
|
|
513
541
|
type Size = number | string;
|
|
514
542
|
|
|
543
|
+
// A value of a list of tokens: one token or more, with other text after it.
|
|
544
|
+
type Tokens<T extends string> = T | `${T} ${string}`;
|
|
545
|
+
|
|
546
|
+
// The tokens of `autocomplete` that fill a field (HTML, "autofill field names"). A value can start
|
|
547
|
+
// with `section-*`, `shipping` or `billing`, and end with `webauthn`, so a string stays valid.
|
|
548
|
+
type AutofillField =
|
|
549
|
+
| 'name'
|
|
550
|
+
| 'honorific-prefix'
|
|
551
|
+
| 'given-name'
|
|
552
|
+
| 'additional-name'
|
|
553
|
+
| 'family-name'
|
|
554
|
+
| 'honorific-suffix'
|
|
555
|
+
| 'nickname'
|
|
556
|
+
| 'username'
|
|
557
|
+
| 'new-password'
|
|
558
|
+
| 'current-password'
|
|
559
|
+
| 'one-time-code'
|
|
560
|
+
| 'organization-title'
|
|
561
|
+
| 'organization'
|
|
562
|
+
| 'street-address'
|
|
563
|
+
| 'address-line1'
|
|
564
|
+
| 'address-line2'
|
|
565
|
+
| 'address-line3'
|
|
566
|
+
| 'address-level4'
|
|
567
|
+
| 'address-level3'
|
|
568
|
+
| 'address-level2'
|
|
569
|
+
| 'address-level1'
|
|
570
|
+
| 'country'
|
|
571
|
+
| 'country-name'
|
|
572
|
+
| 'postal-code'
|
|
573
|
+
| 'cc-name'
|
|
574
|
+
| 'cc-given-name'
|
|
575
|
+
| 'cc-additional-name'
|
|
576
|
+
| 'cc-family-name'
|
|
577
|
+
| 'cc-number'
|
|
578
|
+
| 'cc-exp'
|
|
579
|
+
| 'cc-exp-month'
|
|
580
|
+
| 'cc-exp-year'
|
|
581
|
+
| 'cc-csc'
|
|
582
|
+
| 'cc-type'
|
|
583
|
+
| 'transaction-currency'
|
|
584
|
+
| 'transaction-amount'
|
|
585
|
+
| 'language'
|
|
586
|
+
| 'bday'
|
|
587
|
+
| 'bday-day'
|
|
588
|
+
| 'bday-month'
|
|
589
|
+
| 'bday-year'
|
|
590
|
+
| 'sex'
|
|
591
|
+
| 'url'
|
|
592
|
+
| 'photo'
|
|
593
|
+
| 'tel'
|
|
594
|
+
| 'tel-country-code'
|
|
595
|
+
| 'tel-national'
|
|
596
|
+
| 'tel-area-code'
|
|
597
|
+
| 'tel-local'
|
|
598
|
+
| 'tel-local-prefix'
|
|
599
|
+
| 'tel-local-suffix'
|
|
600
|
+
| 'tel-extension'
|
|
601
|
+
| 'email'
|
|
602
|
+
| 'impp';
|
|
603
|
+
type Autocomplete = boolean | 'on' | 'off' | AutofillField | (string & {});
|
|
604
|
+
|
|
605
|
+
// The tokens of `sandbox` (HTML, "sandboxing flag set").
|
|
606
|
+
type SandboxToken =
|
|
607
|
+
| 'allow-downloads'
|
|
608
|
+
| 'allow-forms'
|
|
609
|
+
| 'allow-modals'
|
|
610
|
+
| 'allow-orientation-lock'
|
|
611
|
+
| 'allow-pointer-lock'
|
|
612
|
+
| 'allow-popups'
|
|
613
|
+
| 'allow-popups-to-escape-sandbox'
|
|
614
|
+
| 'allow-storage-access-by-user-activation'
|
|
615
|
+
| 'allow-presentation'
|
|
616
|
+
| 'allow-same-origin'
|
|
617
|
+
| 'allow-scripts'
|
|
618
|
+
| 'allow-top-navigation'
|
|
619
|
+
| 'allow-top-navigation-by-user-activation'
|
|
620
|
+
| 'allow-top-navigation-to-custom-protocols';
|
|
621
|
+
|
|
622
|
+
// The destinations that `link as` takes for `rel=preload` and `rel=modulepreload` (the fetch
|
|
623
|
+
// destinations that HTML lists).
|
|
624
|
+
type LinkDestination =
|
|
625
|
+
| 'audio'
|
|
626
|
+
| 'document'
|
|
627
|
+
| 'embed'
|
|
628
|
+
| 'fetch'
|
|
629
|
+
| 'font'
|
|
630
|
+
| 'image'
|
|
631
|
+
| 'object'
|
|
632
|
+
| 'script'
|
|
633
|
+
| 'style'
|
|
634
|
+
| 'track'
|
|
635
|
+
| 'video'
|
|
636
|
+
| 'worker'
|
|
637
|
+
| 'audioworklet'
|
|
638
|
+
| 'paintworklet'
|
|
639
|
+
| 'serviceworker'
|
|
640
|
+
| 'sharedworker'
|
|
641
|
+
| 'json'
|
|
642
|
+
| 'manifest'
|
|
643
|
+
| 'frame'
|
|
644
|
+
| 'iframe'
|
|
645
|
+
| 'report'
|
|
646
|
+
| 'xslt'
|
|
647
|
+
| (string & {});
|
|
648
|
+
|
|
515
649
|
/** An HTML element `E` with the attributes of its own. */
|
|
516
650
|
type Html<E extends keyof HTMLElementTagNameMap, Own = {}> = GlobalAttributes<
|
|
517
651
|
HTMLElementTagNameMap[E]
|
|
@@ -559,7 +693,16 @@ interface ButtonOwn extends FormControlOwn {
|
|
|
559
693
|
formtarget?: Attr<string>;
|
|
560
694
|
popovertarget?: Attr<string>;
|
|
561
695
|
popovertargetaction?: Attr<'show' | 'hide' | 'toggle'>;
|
|
562
|
-
command?: Attr<
|
|
696
|
+
command?: Attr<
|
|
697
|
+
| 'show-modal'
|
|
698
|
+
| 'close'
|
|
699
|
+
| 'request-close'
|
|
700
|
+
| 'show-popover'
|
|
701
|
+
| 'hide-popover'
|
|
702
|
+
| 'toggle-popover'
|
|
703
|
+
| `--${string}`
|
|
704
|
+
| (string & {})
|
|
705
|
+
>;
|
|
563
706
|
commandfor?: Attr<string>;
|
|
564
707
|
}
|
|
565
708
|
|
|
@@ -592,7 +735,7 @@ interface InputOwn extends FormControlOwn {
|
|
|
592
735
|
checked?: Attr<boolean | BoundChecked>;
|
|
593
736
|
accept?: Attr<string>;
|
|
594
737
|
alt?: Attr<string>;
|
|
595
|
-
autocomplete?: Attr<
|
|
738
|
+
autocomplete?: Attr<Autocomplete>;
|
|
596
739
|
capture?: Attr<boolean | 'user' | 'environment'>;
|
|
597
740
|
dirname?: Attr<string>;
|
|
598
741
|
webkitdirectory?: Attr<boolean>;
|
|
@@ -621,7 +764,7 @@ interface InputOwn extends FormControlOwn {
|
|
|
621
764
|
}
|
|
622
765
|
|
|
623
766
|
interface TextareaOwn extends FormControlOwn {
|
|
624
|
-
autocomplete?: Attr<
|
|
767
|
+
autocomplete?: Attr<Autocomplete>;
|
|
625
768
|
cols?: Attr<Num>;
|
|
626
769
|
dirname?: Attr<string>;
|
|
627
770
|
maxlength?: Attr<Num>;
|
|
@@ -789,14 +932,54 @@ type SvgAttributeNames =
|
|
|
789
932
|
| 'accumulate'
|
|
790
933
|
| 'restart'
|
|
791
934
|
| 'crossorigin';
|
|
792
|
-
type SvgPresentation = { [K in SvgAttributeNames]?: SvgValue }
|
|
935
|
+
type SvgPresentation = { [K in SvgAttributeNames]?: SvgValue } & {
|
|
936
|
+
'xlink:href'?: SvgValue;
|
|
937
|
+
'xml:lang'?: SvgValue;
|
|
938
|
+
};
|
|
793
939
|
type Svg<E extends keyof SVGElementTagNameMap> = GlobalAttributes<SVGElementTagNameMap[E]> &
|
|
794
940
|
SvgPresentation;
|
|
795
941
|
|
|
942
|
+
// The attributes of MathML Core. The global ones apply to every MathML element.
|
|
943
|
+
type MathLength = Attr<string | number>;
|
|
944
|
+
interface MathGlobal {
|
|
945
|
+
displaystyle?: Attr<boolean>;
|
|
946
|
+
scriptlevel?: Attr<number | `${number}` | `+${number}` | `-${number}`>;
|
|
947
|
+
mathbackground?: Attr<string>;
|
|
948
|
+
mathcolor?: Attr<string>;
|
|
949
|
+
mathsize?: MathLength;
|
|
950
|
+
mathvariant?: Attr<'normal'>;
|
|
951
|
+
// A legacy attribute of MathML Core, which browsers still follow on any MathML element.
|
|
952
|
+
href?: Attr<string>;
|
|
953
|
+
}
|
|
954
|
+
/** A MathML element `E` with the global MathML attributes and the attributes of its own. */
|
|
955
|
+
type MathAttrs<E extends keyof MathMLElementTagNameMap, Own = {}> = GlobalAttributes<
|
|
956
|
+
MathMLElementTagNameMap[E]
|
|
957
|
+
> &
|
|
958
|
+
MathGlobal &
|
|
959
|
+
Own;
|
|
960
|
+
interface MathOperatorOwn {
|
|
961
|
+
fence?: Attr<boolean>;
|
|
962
|
+
form?: Attr<'prefix' | 'infix' | 'postfix'>;
|
|
963
|
+
largeop?: Attr<boolean>;
|
|
964
|
+
lspace?: MathLength;
|
|
965
|
+
rspace?: MathLength;
|
|
966
|
+
maxsize?: MathLength;
|
|
967
|
+
minsize?: MathLength;
|
|
968
|
+
movablelimits?: Attr<boolean>;
|
|
969
|
+
separator?: Attr<boolean>;
|
|
970
|
+
stretchy?: Attr<boolean>;
|
|
971
|
+
symmetric?: Attr<boolean>;
|
|
972
|
+
}
|
|
973
|
+
interface MathSizeOwn {
|
|
974
|
+
width?: MathLength;
|
|
975
|
+
height?: MathLength;
|
|
976
|
+
depth?: MathLength;
|
|
977
|
+
}
|
|
978
|
+
|
|
796
979
|
/**
|
|
797
|
-
* The attributes of each element, by tag. HTML elements have the attributes of HTML,
|
|
798
|
-
* elements the shared attributes of SVG
|
|
799
|
-
* this interface.
|
|
980
|
+
* The attributes of each element, by tag. HTML elements have the attributes of HTML, SVG
|
|
981
|
+
* elements the shared attributes of SVG, and MathML elements those of MathML Core. An app
|
|
982
|
+
* adds the tag of a custom element by merging into this interface.
|
|
800
983
|
*/
|
|
801
984
|
export interface Elements {
|
|
802
985
|
a: Html<'a', AnchorOwn>;
|
|
@@ -833,7 +1016,10 @@ export interface Elements {
|
|
|
833
1016
|
del: Html<'del', { cite?: Attr<string>; datetime?: Attr<string> }>;
|
|
834
1017
|
details: Html<'details', { open?: Attr<boolean>; name?: Attr<string> }>;
|
|
835
1018
|
dfn: Html<'dfn'>;
|
|
836
|
-
dialog: Html<
|
|
1019
|
+
dialog: Html<
|
|
1020
|
+
'dialog',
|
|
1021
|
+
{ open?: Attr<boolean>; closedby?: Attr<'any' | 'closerequest' | 'none'> }
|
|
1022
|
+
>;
|
|
837
1023
|
div: Html<'div'>;
|
|
838
1024
|
dl: Html<'dl'>;
|
|
839
1025
|
dt: Html<'dt'>;
|
|
@@ -884,7 +1070,7 @@ export interface Elements {
|
|
|
884
1070
|
allowfullscreen?: Attr<boolean>;
|
|
885
1071
|
loading?: Attr<'eager' | 'lazy'>;
|
|
886
1072
|
referrerpolicy?: Attr<Referrer>;
|
|
887
|
-
sandbox?: Attr<string>;
|
|
1073
|
+
sandbox?: Attr<'' | Tokens<SandboxToken> | (string & {})>;
|
|
888
1074
|
}
|
|
889
1075
|
>;
|
|
890
1076
|
img: Html<
|
|
@@ -916,7 +1102,7 @@ export interface Elements {
|
|
|
916
1102
|
{
|
|
917
1103
|
href?: Attr<string>;
|
|
918
1104
|
rel?: Attr<string>;
|
|
919
|
-
as?: Attr<
|
|
1105
|
+
as?: Attr<LinkDestination>;
|
|
920
1106
|
type?: Attr<string>;
|
|
921
1107
|
media?: Attr<string>;
|
|
922
1108
|
crossorigin?: Attr<CrossOrigin>;
|
|
@@ -928,7 +1114,7 @@ export interface Elements {
|
|
|
928
1114
|
referrerpolicy?: Attr<Referrer>;
|
|
929
1115
|
fetchpriority?: Attr<'high' | 'low' | 'auto'>;
|
|
930
1116
|
disabled?: Attr<boolean>;
|
|
931
|
-
blocking?: Attr<string>;
|
|
1117
|
+
blocking?: Attr<'render' | (string & {})>;
|
|
932
1118
|
}
|
|
933
1119
|
>;
|
|
934
1120
|
main: Html<'main'>;
|
|
@@ -943,7 +1129,14 @@ export interface Elements {
|
|
|
943
1129
|
charset?: Attr<string>;
|
|
944
1130
|
property?: Attr<string>;
|
|
945
1131
|
media?: Attr<string>;
|
|
946
|
-
'http-equiv'?: Attr<
|
|
1132
|
+
'http-equiv'?: Attr<
|
|
1133
|
+
| 'content-security-policy'
|
|
1134
|
+
| 'content-type'
|
|
1135
|
+
| 'default-style'
|
|
1136
|
+
| 'refresh'
|
|
1137
|
+
| 'x-ua-compatible'
|
|
1138
|
+
| (string & {})
|
|
1139
|
+
>;
|
|
947
1140
|
}
|
|
948
1141
|
>;
|
|
949
1142
|
meter: Html<
|
|
@@ -955,6 +1148,7 @@ export interface Elements {
|
|
|
955
1148
|
low?: Attr<Num>;
|
|
956
1149
|
high?: Attr<Num>;
|
|
957
1150
|
optimum?: Attr<Num>;
|
|
1151
|
+
form?: Attr<string>;
|
|
958
1152
|
}
|
|
959
1153
|
>;
|
|
960
1154
|
nav: Html<'nav'>;
|
|
@@ -999,7 +1193,7 @@ export interface Elements {
|
|
|
999
1193
|
'script',
|
|
1000
1194
|
{
|
|
1001
1195
|
src?: Attr<string>;
|
|
1002
|
-
type?: Attr<string>;
|
|
1196
|
+
type?: Attr<'importmap' | 'module' | 'speculationrules' | (string & {})>;
|
|
1003
1197
|
async?: Attr<boolean>;
|
|
1004
1198
|
defer?: Attr<boolean>;
|
|
1005
1199
|
nomodule?: Attr<boolean>;
|
|
@@ -1007,7 +1201,7 @@ export interface Elements {
|
|
|
1007
1201
|
integrity?: Attr<string>;
|
|
1008
1202
|
referrerpolicy?: Attr<Referrer>;
|
|
1009
1203
|
fetchpriority?: Attr<'high' | 'low' | 'auto'>;
|
|
1010
|
-
blocking?: Attr<string>;
|
|
1204
|
+
blocking?: Attr<'render' | (string & {})>;
|
|
1011
1205
|
}
|
|
1012
1206
|
>;
|
|
1013
1207
|
search: Html<'search'>;
|
|
@@ -1015,7 +1209,7 @@ export interface Elements {
|
|
|
1015
1209
|
select: Html<
|
|
1016
1210
|
'select',
|
|
1017
1211
|
FormControlOwn & {
|
|
1018
|
-
autocomplete?: Attr<
|
|
1212
|
+
autocomplete?: Attr<Autocomplete>;
|
|
1019
1213
|
multiple?: Attr<boolean>;
|
|
1020
1214
|
required?: Attr<boolean>;
|
|
1021
1215
|
size?: Attr<Num>;
|
|
@@ -1038,14 +1232,30 @@ export interface Elements {
|
|
|
1038
1232
|
>;
|
|
1039
1233
|
span: Html<'span'>;
|
|
1040
1234
|
strong: Html<'strong'>;
|
|
1041
|
-
style: Html<
|
|
1235
|
+
style: Html<
|
|
1236
|
+
'style',
|
|
1237
|
+
{
|
|
1238
|
+
type?: Attr<'text/css' | (string & {})>;
|
|
1239
|
+
media?: Attr<string>;
|
|
1240
|
+
blocking?: Attr<'render' | (string & {})>;
|
|
1241
|
+
}
|
|
1242
|
+
>;
|
|
1042
1243
|
sub: Html<'sub'>;
|
|
1043
1244
|
summary: Html<'summary'>;
|
|
1044
1245
|
sup: Html<'sup'>;
|
|
1045
1246
|
table: Html<'table'>;
|
|
1046
1247
|
tbody: Html<'tbody'>;
|
|
1047
1248
|
td: Html<'td', TableCellOwn>;
|
|
1048
|
-
template: Html<
|
|
1249
|
+
template: Html<
|
|
1250
|
+
'template',
|
|
1251
|
+
{
|
|
1252
|
+
shadowrootmode?: Attr<'open' | 'closed'>;
|
|
1253
|
+
shadowrootclonable?: Attr<boolean>;
|
|
1254
|
+
shadowrootdelegatesfocus?: Attr<boolean>;
|
|
1255
|
+
shadowrootserializable?: Attr<boolean>;
|
|
1256
|
+
shadowrootcustomelementregistry?: Attr<boolean>;
|
|
1257
|
+
}
|
|
1258
|
+
>;
|
|
1049
1259
|
textarea: Html<'textarea', TextareaOwn>;
|
|
1050
1260
|
tfoot: Html<'tfoot'>;
|
|
1051
1261
|
th: Html<
|
|
@@ -1140,6 +1350,41 @@ export interface Elements {
|
|
|
1140
1350
|
tspan: Svg<'tspan'>;
|
|
1141
1351
|
use: Svg<'use'>;
|
|
1142
1352
|
view: Svg<'view'>;
|
|
1353
|
+
|
|
1354
|
+
// MathML elements. `a` is the HTML one, which MathML shares.
|
|
1355
|
+
annotation: MathAttrs<'annotation', { encoding?: Attr<string> }>;
|
|
1356
|
+
'annotation-xml': MathAttrs<'annotation-xml', { encoding?: Attr<string> }>;
|
|
1357
|
+
maction: MathAttrs<
|
|
1358
|
+
'maction',
|
|
1359
|
+
{ actiontype?: Attr<string>; selection?: Attr<number | `${number}`> }
|
|
1360
|
+
>;
|
|
1361
|
+
math: MathAttrs<'math', { display?: Attr<'block' | 'inline'>; xmlns?: Attr<string> }>;
|
|
1362
|
+
merror: MathAttrs<'merror'>;
|
|
1363
|
+
mfrac: MathAttrs<'mfrac', { linethickness?: MathLength }>;
|
|
1364
|
+
mi: MathAttrs<'mi'>;
|
|
1365
|
+
mmultiscripts: MathAttrs<'mmultiscripts'>;
|
|
1366
|
+
mn: MathAttrs<'mn'>;
|
|
1367
|
+
mo: MathAttrs<'mo', MathOperatorOwn>;
|
|
1368
|
+
mover: MathAttrs<'mover', { accent?: Attr<boolean> }>;
|
|
1369
|
+
mpadded: MathAttrs<'mpadded', MathSizeOwn & { lspace?: MathLength; voffset?: MathLength }>;
|
|
1370
|
+
mphantom: MathAttrs<'mphantom'>;
|
|
1371
|
+
mprescripts: MathAttrs<'mprescripts'>;
|
|
1372
|
+
mroot: MathAttrs<'mroot'>;
|
|
1373
|
+
mrow: MathAttrs<'mrow'>;
|
|
1374
|
+
ms: MathAttrs<'ms'>;
|
|
1375
|
+
mspace: MathAttrs<'mspace', MathSizeOwn>;
|
|
1376
|
+
msqrt: MathAttrs<'msqrt'>;
|
|
1377
|
+
mstyle: MathAttrs<'mstyle'>;
|
|
1378
|
+
msub: MathAttrs<'msub'>;
|
|
1379
|
+
msubsup: MathAttrs<'msubsup'>;
|
|
1380
|
+
msup: MathAttrs<'msup'>;
|
|
1381
|
+
mtable: MathAttrs<'mtable'>;
|
|
1382
|
+
mtd: MathAttrs<'mtd', { columnspan?: Attr<Num>; rowspan?: Attr<Num> }>;
|
|
1383
|
+
mtext: MathAttrs<'mtext'>;
|
|
1384
|
+
mtr: MathAttrs<'mtr'>;
|
|
1385
|
+
munder: MathAttrs<'munder', { accentunder?: Attr<boolean> }>;
|
|
1386
|
+
munderover: MathAttrs<'munderover', { accent?: Attr<boolean>; accentunder?: Attr<boolean> }>;
|
|
1387
|
+
semantics: MathAttrs<'semantics'>;
|
|
1143
1388
|
}
|
|
1144
1389
|
|
|
1145
1390
|
/** The attributes of an element by its tag. */
|
|
@@ -1150,4 +1395,6 @@ export type ElementOf<T extends keyof Elements> = T extends keyof HTMLElementTag
|
|
|
1150
1395
|
? HTMLElementTagNameMap[T]
|
|
1151
1396
|
: T extends keyof SVGElementTagNameMap
|
|
1152
1397
|
? SVGElementTagNameMap[T]
|
|
1153
|
-
:
|
|
1398
|
+
: T extends keyof MathMLElementTagNameMap
|
|
1399
|
+
? MathMLElementTagNameMap[T]
|
|
1400
|
+
: HTMLElement;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "brumate",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.0",
|
|
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",
|
|
@@ -63,6 +63,10 @@
|
|
|
63
63
|
"types": "./dist/runtime/signals.d.ts",
|
|
64
64
|
"default": "./dist/runtime/signals.js"
|
|
65
65
|
},
|
|
66
|
+
"./store": {
|
|
67
|
+
"types": "./dist/runtime/store.d.ts",
|
|
68
|
+
"default": "./dist/runtime/store.js"
|
|
69
|
+
},
|
|
66
70
|
"./routes": {
|
|
67
71
|
"types": "./dist/runtime/routes.d.ts",
|
|
68
72
|
"default": "./dist/runtime/routes.js"
|
package/skills/brumate/SKILL.md
CHANGED
|
@@ -38,7 +38,7 @@ A `.brm` file is a component: scripts for its state, an optional `<style>`, and
|
|
|
38
38
|
- Markup is never a value in code or in an attribute. Use `#template name(parameters) { … }` and call it as `{name(arguments)}`.
|
|
39
39
|
- Browser wrappers of a handler come from `brumate/events`: `prevent`, `stop`, `once`, `capture`, `transition`. Write them in the attribute, with keys as string literals. `prevent(handler, 'Enter')` prevents only Enter with Ctrl, Meta and Alt up. `'Mod+ArrowDown'` names Ctrl or Meta. Calling `event.preventDefault()` in a handler is too late.
|
|
40
40
|
- A server function is an `async` function with `'use server'` on its first line. It reads no variable of the instance script. Pass values as arguments.
|
|
41
|
-
- Do not use `$ref`, `$watch`, `$settled`, `$cleanup`, `$
|
|
41
|
+
- Do not use `$ref`, `$watch`, `$settled`, `$cleanup`, `$get`, `$set`, or modifiers such as `onSubmit:prevent`.
|
|
42
42
|
|
|
43
43
|
## References
|
|
44
44
|
|
|
@@ -1051,14 +1051,15 @@ https://brumate-docs.vercel.app/docs/errors#brm079
|
|
|
1051
1051
|
const theme = $getContext(ThemeContext);
|
|
1052
1052
|
```
|
|
1053
1053
|
|
|
1054
|
-
## BRM080: $getContext takes
|
|
1054
|
+
## BRM080: $getContext takes the context, and a fallback for a read without a provider
|
|
1055
1055
|
|
|
1056
|
-
`$getContext` has no argument or more than
|
|
1056
|
+
`$getContext` has no argument or more than two.
|
|
1057
1057
|
|
|
1058
1058
|
https://brumate-docs.vercel.app/docs/errors#brm080
|
|
1059
1059
|
|
|
1060
1060
|
```brm fragment
|
|
1061
1061
|
const theme = $getContext(ThemeContext);
|
|
1062
|
+
const locale = $getContext(LocaleContext, undefined);
|
|
1062
1063
|
```
|
|
1063
1064
|
|
|
1064
1065
|
## BRM081: $setContext takes two arguments, the context and the value
|
|
@@ -1349,9 +1350,9 @@ let { open } = $props<{ open?: Bindable<boolean> }>();
|
|
|
1349
1350
|
const bound = () => $isBound(open);
|
|
1350
1351
|
```
|
|
1351
1352
|
|
|
1352
|
-
## BRM108: $isPending needs
|
|
1353
|
+
## BRM108: $isPending needs async $memos as its arguments
|
|
1353
1354
|
|
|
1354
|
-
|
|
1355
|
+
An argument of `$isPending` is not a memo that holds a promise, or the call has none.
|
|
1355
1356
|
|
|
1356
1357
|
https://brumate-docs.vercel.app/docs/errors#brm108
|
|
1357
1358
|
|
|
@@ -1430,7 +1431,7 @@ let { ref } = $props<{ ref?: Bindable<HTMLButtonElement> }>();
|
|
|
1430
1431
|
|
|
1431
1432
|
## BRM115: "{name}" is the props object, so read one key at a time, destructure it, or spread it in markup
|
|
1432
1433
|
|
|
1433
|
-
The props object or the rest of `$props()` is used as a whole outside a markup spread: spread in code, passed to a function, `$memo`, `$setContext`, a signal or a variable, or given as a value in markup, such as `title=rest` or `<Badge {rest} />`. The copy loses the `ref` and the live props.
|
|
1434
|
+
The props object or the rest of `$props()` is used as a whole outside a markup spread: spread in code, passed to a function, `$memo`, `$setContext`, a signal or a variable, or given as a value in markup, such as `title=rest` or `<Badge {rest} />`. The copy loses the `ref` and the live props. A spread may hold the rest as a branch of `?:`, `&&`, `||` or `??` next to an object literal, `undefined`, `null` or `false`, such as `{...(open ? rest : {})}`.
|
|
1434
1435
|
|
|
1435
1436
|
https://brumate-docs.vercel.app/docs/errors#brm115
|
|
1436
1437
|
|
|
@@ -1615,6 +1616,36 @@ https://brumate-docs.vercel.app/docs/errors#brm132
|
|
|
1615
1616
|
const double = $memo(count * 2);
|
|
1616
1617
|
```
|
|
1617
1618
|
|
|
1619
|
+
## BRM202: $gate takes a value and a function, as in $gate(value, (prev, next) => next > prev)
|
|
1620
|
+
|
|
1621
|
+
`$gate` does not have a value and a guard function as its two arguments. The guard is an arrow function or a function expression.
|
|
1622
|
+
|
|
1623
|
+
https://brumate-docs.vercel.app/docs/errors#brm202
|
|
1624
|
+
|
|
1625
|
+
```brm fragment
|
|
1626
|
+
const query = $gate(input, (_, next) => next.length >= 2);
|
|
1627
|
+
```
|
|
1628
|
+
|
|
1629
|
+
## BRM203: $gate takes a value that is ready. Use $memo for a promise or a server function
|
|
1630
|
+
|
|
1631
|
+
The value of `$gate` awaits or calls a server function. The compiler catches these two; any other promise or stream, such as a call of a local async function, throws when the value is computed. A gate holds a value that the guard can compare, so it does not wait for one.
|
|
1632
|
+
|
|
1633
|
+
https://brumate-docs.vercel.app/docs/errors#brm203
|
|
1634
|
+
|
|
1635
|
+
```brm fragment
|
|
1636
|
+
const query = $gate(input, (_, next) => next.length >= 2);
|
|
1637
|
+
```
|
|
1638
|
+
|
|
1639
|
+
## BRM204: Declare a gated value with "const name = $gate(value, (prev, next) => boolean)" at the top level of a script
|
|
1640
|
+
|
|
1641
|
+
`$gate` is inside a function or a block of code.
|
|
1642
|
+
|
|
1643
|
+
https://brumate-docs.vercel.app/docs/errors#brm204
|
|
1644
|
+
|
|
1645
|
+
```brm fragment
|
|
1646
|
+
const query = $gate(input, (_, next) => next.length >= 2);
|
|
1647
|
+
```
|
|
1648
|
+
|
|
1618
1649
|
## BRM133: Declare a debounced value with "const name = $debounced(value, ms)" at the top level of a script
|
|
1619
1650
|
|
|
1620
1651
|
`$debounced` is inside a function or a block of code.
|
|
@@ -1727,14 +1758,101 @@ $effect(() => {
|
|
|
1727
1758
|
});
|
|
1728
1759
|
```
|
|
1729
1760
|
|
|
1730
|
-
##
|
|
1761
|
+
## BRM191: Read a store with "const name = $store(source)" or "let name = $store(source)" at the top level of a script
|
|
1762
|
+
|
|
1763
|
+
`$store` is not the whole value of a `const` or `let` at the top level of a script.
|
|
1764
|
+
|
|
1765
|
+
https://brumate-docs.vercel.app/docs/errors#brm191
|
|
1766
|
+
|
|
1767
|
+
```brm fragment
|
|
1768
|
+
import { theme } from './theme';
|
|
1769
|
+
const value = $store(theme);
|
|
1770
|
+
```
|
|
1771
|
+
|
|
1772
|
+
## BRM192: $store takes one argument, a store
|
|
1773
|
+
|
|
1774
|
+
`$store` has no argument, or more than one.
|
|
1775
|
+
|
|
1776
|
+
https://brumate-docs.vercel.app/docs/errors#brm192
|
|
1777
|
+
|
|
1778
|
+
```brm fragment
|
|
1779
|
+
const field = $getContext(Field);
|
|
1780
|
+
const state = $store(field.state);
|
|
1781
|
+
```
|
|
1782
|
+
|
|
1783
|
+
## BRM193: $toStore takes one argument, a memo, a signal or a prop, as a value of $setContext
|
|
1784
|
+
|
|
1785
|
+
`$toStore` has no argument or more than one, or it is not a value of `$setContext`, alone or as a key of an object or an item of a list.
|
|
1786
|
+
|
|
1787
|
+
https://brumate-docs.vercel.app/docs/errors#brm193
|
|
1788
|
+
|
|
1789
|
+
```brm fragment
|
|
1790
|
+
$setContext(Field, { state: $toStore(state), pick });
|
|
1791
|
+
```
|
|
1792
|
+
|
|
1793
|
+
## BRM195: $store gives one name, not a pattern such as { a }
|
|
1794
|
+
|
|
1795
|
+
`$store` initializes a pattern.
|
|
1796
|
+
|
|
1797
|
+
https://brumate-docs.vercel.app/docs/errors#brm195
|
|
1798
|
+
|
|
1799
|
+
```brm fragment
|
|
1800
|
+
const value = $store(source);
|
|
1801
|
+
```
|
|
1802
|
+
|
|
1803
|
+
## BRM196: The context value reads "{name}", which changes, but a context value is read once. Put it in a store with $toStore, or read it inside a function
|
|
1804
|
+
|
|
1805
|
+
The value of `$setContext` reads a signal, a memo, a prop or a `$bind` value that changes in the browser, and a context is read once, so readers would keep the first value. A call or an immediately invoked function in the value that reads such a name is not reported, and freezes the same way.
|
|
1806
|
+
|
|
1807
|
+
https://brumate-docs.vercel.app/docs/errors#brm196
|
|
1808
|
+
|
|
1809
|
+
```brm fragment
|
|
1810
|
+
$setContext(Field, { state: $toStore(state), pick: () => value });
|
|
1811
|
+
```
|
|
1812
|
+
|
|
1813
|
+
## BRM197: Read a context that may have no provider with "const name = $getContext(Context, undefined)", and a store in it with "const state = name ? $store(name.key) : undefined", with const and no other test
|
|
1814
|
+
|
|
1815
|
+
A read of a context that may have no provider has another shape: `$hasContext`, which is removed, `$store(name?.key)`, a `let` or another test in the guard, an `else` that is not `undefined`, a guard on a name that is not the optional value of `$getContext(Context, undefined)`, or a key of that value read without the guard.
|
|
1816
|
+
|
|
1817
|
+
https://brumate-docs.vercel.app/docs/errors#brm197
|
|
1818
|
+
|
|
1819
|
+
```brm fragment
|
|
1820
|
+
const field = $getContext(Field, undefined);
|
|
1821
|
+
const state = field ? $store(field.state) : undefined;
|
|
1822
|
+
```
|
|
1823
|
+
|
|
1824
|
+
## BRM198: The source of $store gives its store at once, so it cannot await or call a server function
|
|
1825
|
+
|
|
1826
|
+
The source of `$store` awaits, or calls a server function. The browser runs the source again when the page resumes, and links the store in the same pass, so the source must give the store, not a promise of it.
|
|
1827
|
+
|
|
1828
|
+
https://brumate-docs.vercel.app/docs/errors#brm198
|
|
1829
|
+
|
|
1830
|
+
```brm fragment
|
|
1831
|
+
import { theme } from './theme';
|
|
1832
|
+
const value = $store(theme);
|
|
1833
|
+
```
|
|
1834
|
+
|
|
1835
|
+
## BRM199: $store takes a store. Read the store of a context with "$store($getContext(Context))", or give a store as the fallback, "$store($getContext(Context, store(value)))"
|
|
1836
|
+
|
|
1837
|
+
`$store` reads a context that the file names in `$getContext` or `$setContext`, `undefined`, `null`, or `$getContext` with a literal fallback, which is no store. A context that the file only imports is found when the page renders, as a `TypeError`.
|
|
1838
|
+
|
|
1839
|
+
https://brumate-docs.vercel.app/docs/errors#brm199
|
|
1840
|
+
|
|
1841
|
+
```brm fragment
|
|
1842
|
+
const level = $store($getContext(LevelContext));
|
|
1843
|
+
const locale = $store($getContext(LocaleContext, store('en-US')));
|
|
1844
|
+
```
|
|
1845
|
+
|
|
1846
|
+
## BRM200: The value of bridge() must be a module-level export of a script file or of <script module>, as "export const name = bridge({ … })"
|
|
1731
1847
|
|
|
1732
|
-
|
|
1848
|
+
A call of `bridge` from `brumate/store` is in the script of a component, or in a function, or is not the value of an exported `const`. The page state names a bridge by its module and its export, so the browser can load it.
|
|
1733
1849
|
|
|
1734
|
-
https://brumate-docs.vercel.app/docs/errors#
|
|
1850
|
+
https://brumate-docs.vercel.app/docs/errors#brm200
|
|
1735
1851
|
|
|
1736
1852
|
```brm fragment
|
|
1737
|
-
|
|
1853
|
+
// bears.ts, or the <script module> of a component
|
|
1854
|
+
import { bridge } from 'brumate/store';
|
|
1855
|
+
export const bearStore = bridge({ create, get, subscribe });
|
|
1738
1856
|
```
|
|
1739
1857
|
|
|
1740
1858
|
## BRM144: $get is not supported. Signals cannot leave the file
|