@monimesl/dot-core 0.1.0-alpha.15 → 0.1.0-alpha.18
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/index.d.ts +181 -11
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +148 -7
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -13,8 +13,14 @@ interface PropTypes {
|
|
|
13
13
|
boolean: boolean;
|
|
14
14
|
any: unknown;
|
|
15
15
|
}
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
interface WordsOr {
|
|
17
|
+
readonly words: readonly string[];
|
|
18
|
+
readonly or: 'number' | 'themeColor';
|
|
19
|
+
}
|
|
20
|
+
type PropType = keyof PropTypes | readonly string[] | WordsOr;
|
|
21
|
+
type PropValue<T extends PropType> = T extends readonly string[] ? T[number] : T extends WordsOr ? T['words'][number] | (T['or'] extends 'number' ? number : string) : T extends keyof PropTypes ? PropTypes[T] : never;
|
|
22
|
+
export declare function isWordsOr(type: PropType): type is WordsOr;
|
|
23
|
+
export declare function otherThanWords(type: WordsOr): string;
|
|
18
24
|
type ChildrenType = 'none' | 'text' | 'elements';
|
|
19
25
|
interface ComponentManifest<Name extends string = string, Props extends Record<string, PropType> = Record<string, PropType>, Events extends string = string, Children extends ChildrenType = ChildrenType> {
|
|
20
26
|
readonly name: Name;
|
|
@@ -51,16 +57,15 @@ export declare function componentRegistry(manifests: Iterable<ComponentManifest>
|
|
|
51
57
|
interface Theme {
|
|
52
58
|
scheme?: ColorScheme | 'system' | undefined;
|
|
53
59
|
colors?: ThemeColors | undefined;
|
|
54
|
-
density?: ThemeDensity | undefined;
|
|
55
60
|
shape?: ThemeShape | undefined;
|
|
56
61
|
}
|
|
57
|
-
type ThemeDensity = 'dense' | 'compact' | 'comfortable';
|
|
58
62
|
type ThemeShape = 'square' | 'subtle' | 'soft' | 'rounded';
|
|
59
63
|
interface ThemeColors {
|
|
60
64
|
primary?: SchemeColor | undefined;
|
|
61
65
|
background?: SchemeColor | undefined;
|
|
62
66
|
surface?: SchemeColor | undefined;
|
|
63
67
|
text?: SchemeColor | undefined;
|
|
68
|
+
custom?: Readonly<Record<string, SchemeColor>> | undefined;
|
|
64
69
|
}
|
|
65
70
|
interface SchemeColor {
|
|
66
71
|
light?: HexColor | undefined;
|
|
@@ -119,7 +124,7 @@ export declare function checkConfigs(configs: PageConfigs): void;
|
|
|
119
124
|
export declare function mergeConfigs(...configs: (PageConfigs | undefined)[]): PageBars;
|
|
120
125
|
//#endregion
|
|
121
126
|
//#region src/page/navigation.d.ts
|
|
122
|
-
export declare const MAX_STACK_DEPTH =
|
|
127
|
+
export declare const MAX_STACK_DEPTH = 16;
|
|
123
128
|
export declare function isPageId(value: string): boolean;
|
|
124
129
|
type PageLaunchOptions = Readonly<Record<string, string>>;
|
|
125
130
|
type Navigation = {
|
|
@@ -385,6 +390,37 @@ export declare const Image: ComponentManifest<"Image", {
|
|
|
385
390
|
readonly aspect: readonly ["1:1", "4:3", "3:2", "16:9", "3:4", "2:3", "9:16"];
|
|
386
391
|
}, "error" | "load", "none">;
|
|
387
392
|
//#endregion
|
|
393
|
+
//#region src/view/components/slider.d.ts
|
|
394
|
+
export declare const Slider: ComponentManifest<"Slider", {
|
|
395
|
+
readonly value: "number";
|
|
396
|
+
readonly min: "number";
|
|
397
|
+
readonly max: "number";
|
|
398
|
+
readonly step: "number";
|
|
399
|
+
readonly showValue: "boolean";
|
|
400
|
+
readonly label: "string";
|
|
401
|
+
readonly hint: "string";
|
|
402
|
+
readonly disabled: "boolean";
|
|
403
|
+
}, "change", "none">;
|
|
404
|
+
//#endregion
|
|
405
|
+
//#region src/view/components/prose.d.ts
|
|
406
|
+
export declare const Prose: ComponentManifest<"Prose", {
|
|
407
|
+
readonly padding: readonly ["none", "small", "medium", "large"];
|
|
408
|
+
readonly paddingTop: readonly ["none", "small", "medium", "large"];
|
|
409
|
+
readonly paddingStart: readonly ["none", "small", "medium", "large"];
|
|
410
|
+
readonly paddingEnd: readonly ["none", "small", "medium", "large"];
|
|
411
|
+
readonly paddingBottom: readonly ["none", "small", "medium", "large"];
|
|
412
|
+
}, never, "elements">;
|
|
413
|
+
export declare const Quote: ComponentManifest<"Quote", {
|
|
414
|
+
readonly cite: "string";
|
|
415
|
+
}, never, "elements">;
|
|
416
|
+
export declare const BulletList: ComponentManifest<"BulletList", {
|
|
417
|
+
readonly ordered: "boolean";
|
|
418
|
+
}, never, "elements">;
|
|
419
|
+
export declare const Bullet: ComponentManifest<"Bullet", Record<never, PropType>, never, "elements">;
|
|
420
|
+
export declare const RichText: ComponentManifest<"RichText", {
|
|
421
|
+
readonly markdown: "string";
|
|
422
|
+
}, never, "none">;
|
|
423
|
+
//#endregion
|
|
388
424
|
//#region src/view/components/input.d.ts
|
|
389
425
|
export declare const Input: ComponentManifest<"Input", {
|
|
390
426
|
readonly value: "string";
|
|
@@ -507,11 +543,19 @@ export declare const Text: ComponentManifest<"Text", {
|
|
|
507
543
|
readonly paddingStart: readonly ["none", "small", "medium", "large"];
|
|
508
544
|
readonly paddingEnd: readonly ["none", "small", "medium", "large"];
|
|
509
545
|
readonly paddingBottom: readonly ["none", "small", "medium", "large"];
|
|
510
|
-
readonly variant: readonly ["title", "body", "caption"];
|
|
511
|
-
readonly tone:
|
|
546
|
+
readonly variant: readonly ["display", "title", "subtitle", "lead", "body", "caption"];
|
|
547
|
+
readonly tone: {
|
|
548
|
+
readonly words: readonly ["default", "muted", "info", "success", "warning", "danger", "onPrimary"];
|
|
549
|
+
readonly or: "themeColor";
|
|
550
|
+
};
|
|
512
551
|
readonly weight: readonly ["regular", "medium", "bold"];
|
|
513
552
|
readonly align: readonly ["start", "center", "end"];
|
|
514
553
|
readonly maxLines: "number";
|
|
554
|
+
readonly decoration: readonly ["none", "underline", "strikethrough"];
|
|
555
|
+
readonly numeric: "boolean";
|
|
556
|
+
readonly leading: readonly ["tight", "normal", "relaxed"];
|
|
557
|
+
readonly italic: "boolean";
|
|
558
|
+
readonly selectable: "boolean";
|
|
515
559
|
}, never, "text">;
|
|
516
560
|
//#endregion
|
|
517
561
|
//#region src/view/components/text-area.d.ts
|
|
@@ -550,6 +594,23 @@ export declare const Radio: ComponentManifest<"Radio", {
|
|
|
550
594
|
//#endregion
|
|
551
595
|
//#region src/view/components/view.d.ts
|
|
552
596
|
export declare const View: ComponentManifest<"View", {
|
|
597
|
+
readonly background: {
|
|
598
|
+
readonly words: readonly ["background", "surface", "primary", "muted", "info", "success", "warning", "danger"];
|
|
599
|
+
readonly or: "themeColor";
|
|
600
|
+
};
|
|
601
|
+
readonly border: readonly ["none", "subtle", "strong"];
|
|
602
|
+
readonly radius: readonly ["none", "small", "medium", "large", "full"];
|
|
603
|
+
readonly width: {
|
|
604
|
+
readonly words: readonly ["fill"];
|
|
605
|
+
readonly or: "number";
|
|
606
|
+
};
|
|
607
|
+
readonly height: {
|
|
608
|
+
readonly words: readonly ["fill"];
|
|
609
|
+
readonly or: "number";
|
|
610
|
+
};
|
|
611
|
+
readonly minHeight: "number";
|
|
612
|
+
readonly maxWidth: "number";
|
|
613
|
+
readonly aspect: readonly ["1:1", "4:3", "3:2", "16:9", "3:4", "2:3", "9:16"];
|
|
553
614
|
readonly variant: readonly ["plain", "card"];
|
|
554
615
|
readonly padding: readonly ["none", "small", "medium", "large"];
|
|
555
616
|
readonly paddingTop: readonly ["none", "small", "medium", "large"];
|
|
@@ -563,6 +624,18 @@ export declare const View: ComponentManifest<"View", {
|
|
|
563
624
|
readonly wrap: "boolean";
|
|
564
625
|
readonly grow: "boolean";
|
|
565
626
|
}, "tap", "elements">;
|
|
627
|
+
export declare const Stack: ComponentManifest<"Stack", {
|
|
628
|
+
readonly radius: readonly ["none", "small", "medium", "large", "full"];
|
|
629
|
+
readonly width: {
|
|
630
|
+
readonly words: readonly ["fill"];
|
|
631
|
+
readonly or: "number";
|
|
632
|
+
};
|
|
633
|
+
readonly height: {
|
|
634
|
+
readonly words: readonly ["fill"];
|
|
635
|
+
readonly or: "number";
|
|
636
|
+
};
|
|
637
|
+
readonly aspect: readonly ["1:1", "4:3", "3:2", "16:9", "3:4", "2:3", "9:16"];
|
|
638
|
+
}, never, "elements">;
|
|
566
639
|
//#endregion
|
|
567
640
|
//#region src/view/components/options.d.ts
|
|
568
641
|
export declare const SIZES: readonly ["small", "medium", "large"];
|
|
@@ -576,6 +649,39 @@ export declare const PADDING_PROPS: {
|
|
|
576
649
|
};
|
|
577
650
|
export declare const ASPECTS: readonly ["1:1", "4:3", "3:2", "16:9", "3:4", "2:3", "9:16"];
|
|
578
651
|
export declare const TONES: readonly ["default", "muted", "info", "success", "warning", "danger"];
|
|
652
|
+
export declare const TEXT_TONES: {
|
|
653
|
+
readonly words: readonly ["default", "muted", "info", "success", "warning", "danger", "onPrimary"];
|
|
654
|
+
readonly or: "themeColor";
|
|
655
|
+
};
|
|
656
|
+
export declare const BACKGROUNDS: {
|
|
657
|
+
readonly words: readonly ["background", "surface", "primary", "muted", "info", "success", "warning", "danger"];
|
|
658
|
+
readonly or: "themeColor";
|
|
659
|
+
};
|
|
660
|
+
export declare const BORDERS: readonly ["none", "subtle", "strong"];
|
|
661
|
+
export declare const RADII: readonly ["none", "small", "medium", "large", "full"];
|
|
662
|
+
export declare const LENGTH: {
|
|
663
|
+
readonly words: readonly ["fill"];
|
|
664
|
+
readonly or: "number";
|
|
665
|
+
};
|
|
666
|
+
export declare const BOX_PROPS: {
|
|
667
|
+
readonly background: {
|
|
668
|
+
readonly words: readonly ["background", "surface", "primary", "muted", "info", "success", "warning", "danger"];
|
|
669
|
+
readonly or: "themeColor";
|
|
670
|
+
};
|
|
671
|
+
readonly border: readonly ["none", "subtle", "strong"];
|
|
672
|
+
readonly radius: readonly ["none", "small", "medium", "large", "full"];
|
|
673
|
+
readonly width: {
|
|
674
|
+
readonly words: readonly ["fill"];
|
|
675
|
+
readonly or: "number";
|
|
676
|
+
};
|
|
677
|
+
readonly height: {
|
|
678
|
+
readonly words: readonly ["fill"];
|
|
679
|
+
readonly or: "number";
|
|
680
|
+
};
|
|
681
|
+
readonly minHeight: "number";
|
|
682
|
+
readonly maxWidth: "number";
|
|
683
|
+
readonly aspect: readonly ["1:1", "4:3", "3:2", "16:9", "3:4", "2:3", "9:16"];
|
|
684
|
+
};
|
|
579
685
|
export declare const STATUS_TONES: readonly ["default", "info", "success", "warning", "danger"];
|
|
580
686
|
export declare const ICON_NAMES: readonly ["arrow-down", "arrow-left", "arrow-right", "arrow-up", "bank", "bell", "bolt", "calendar", "card", "cart", "cash", "check", "chevron-down", "chevron-left", "chevron-right", "chevron-up", "clock", "close", "copy", "download", "edit", "error", "external-link", "eye", "eye-off", "file", "gift", "globe", "grid", "headphones", "heart", "help", "history", "home", "image", "info", "link", "list", "location", "lock", "logout", "mail", "microphone", "minus", "mobile", "more", "music", "phone", "playlist", "plus", "qr-code", "receipt", "refresh", "search", "send", "settings", "share", "star", "success", "ticket", "trash", "upload", "user", "users", "video", "wallet", "warning", "water", "wifi"];
|
|
581
687
|
type IconName = (typeof ICON_NAMES)[number];
|
|
@@ -596,6 +702,10 @@ export declare const builtinComponents: {
|
|
|
596
702
|
readonly Badge: ComponentManifest<"Badge", {
|
|
597
703
|
readonly tone: readonly ["default", "info", "success", "warning", "danger"];
|
|
598
704
|
}, never, "text">;
|
|
705
|
+
readonly Bullet: ComponentManifest<"Bullet", Record<never, PropType>, never, "elements">;
|
|
706
|
+
readonly BulletList: ComponentManifest<"BulletList", {
|
|
707
|
+
readonly ordered: "boolean";
|
|
708
|
+
}, never, "elements">;
|
|
599
709
|
readonly Button: ComponentManifest<"Button", {
|
|
600
710
|
readonly variant: readonly ["primary", "secondary"];
|
|
601
711
|
readonly disabled: "boolean";
|
|
@@ -745,11 +855,21 @@ export declare const builtinComponents: {
|
|
|
745
855
|
readonly ProgressBar: ComponentManifest<"ProgressBar", {
|
|
746
856
|
readonly value: "number";
|
|
747
857
|
}, never, "none">;
|
|
858
|
+
readonly Prose: ComponentManifest<"Prose", {
|
|
859
|
+
readonly padding: readonly ["none", "small", "medium", "large"];
|
|
860
|
+
readonly paddingTop: readonly ["none", "small", "medium", "large"];
|
|
861
|
+
readonly paddingStart: readonly ["none", "small", "medium", "large"];
|
|
862
|
+
readonly paddingEnd: readonly ["none", "small", "medium", "large"];
|
|
863
|
+
readonly paddingBottom: readonly ["none", "small", "medium", "large"];
|
|
864
|
+
}, never, "elements">;
|
|
748
865
|
readonly QRCode: ComponentManifest<"QRCode", {
|
|
749
866
|
readonly value: "string";
|
|
750
867
|
readonly size: "number";
|
|
751
868
|
readonly label: "string";
|
|
752
869
|
}, never, "none">;
|
|
870
|
+
readonly Quote: ComponentManifest<"Quote", {
|
|
871
|
+
readonly cite: "string";
|
|
872
|
+
}, never, "elements">;
|
|
753
873
|
readonly Radio: ComponentManifest<"Radio", {
|
|
754
874
|
readonly value: "string";
|
|
755
875
|
readonly label: "string";
|
|
@@ -760,6 +880,9 @@ export declare const builtinComponents: {
|
|
|
760
880
|
readonly label: "string";
|
|
761
881
|
readonly disabled: "boolean";
|
|
762
882
|
}, "change", "elements">;
|
|
883
|
+
readonly RichText: ComponentManifest<"RichText", {
|
|
884
|
+
readonly markdown: "string";
|
|
885
|
+
}, never, "none">;
|
|
763
886
|
readonly Scroll: ComponentManifest<"Scroll", {
|
|
764
887
|
readonly padding: readonly ["none", "small", "medium", "large"];
|
|
765
888
|
readonly paddingTop: readonly ["none", "small", "medium", "large"];
|
|
@@ -793,9 +916,31 @@ export declare const builtinComponents: {
|
|
|
793
916
|
readonly lines: "number";
|
|
794
917
|
readonly height: "number";
|
|
795
918
|
}, never, "none">;
|
|
919
|
+
readonly Slider: ComponentManifest<"Slider", {
|
|
920
|
+
readonly value: "number";
|
|
921
|
+
readonly min: "number";
|
|
922
|
+
readonly max: "number";
|
|
923
|
+
readonly step: "number";
|
|
924
|
+
readonly showValue: "boolean";
|
|
925
|
+
readonly label: "string";
|
|
926
|
+
readonly hint: "string";
|
|
927
|
+
readonly disabled: "boolean";
|
|
928
|
+
}, "change", "none">;
|
|
796
929
|
readonly Spinner: ComponentManifest<"Spinner", {
|
|
797
930
|
readonly size: readonly ["small", "medium", "large"];
|
|
798
931
|
}, never, "none">;
|
|
932
|
+
readonly Stack: ComponentManifest<"Stack", {
|
|
933
|
+
readonly radius: readonly ["none", "small", "medium", "large", "full"];
|
|
934
|
+
readonly width: {
|
|
935
|
+
readonly words: readonly ["fill"];
|
|
936
|
+
readonly or: "number";
|
|
937
|
+
};
|
|
938
|
+
readonly height: {
|
|
939
|
+
readonly words: readonly ["fill"];
|
|
940
|
+
readonly or: "number";
|
|
941
|
+
};
|
|
942
|
+
readonly aspect: readonly ["1:1", "4:3", "3:2", "16:9", "3:4", "2:3", "9:16"];
|
|
943
|
+
}, never, "elements">;
|
|
799
944
|
readonly Switch: ComponentManifest<"Switch", {
|
|
800
945
|
readonly checked: "boolean";
|
|
801
946
|
readonly label: "string";
|
|
@@ -821,11 +966,19 @@ export declare const builtinComponents: {
|
|
|
821
966
|
readonly paddingStart: readonly ["none", "small", "medium", "large"];
|
|
822
967
|
readonly paddingEnd: readonly ["none", "small", "medium", "large"];
|
|
823
968
|
readonly paddingBottom: readonly ["none", "small", "medium", "large"];
|
|
824
|
-
readonly variant: readonly ["title", "body", "caption"];
|
|
825
|
-
readonly tone:
|
|
969
|
+
readonly variant: readonly ["display", "title", "subtitle", "lead", "body", "caption"];
|
|
970
|
+
readonly tone: {
|
|
971
|
+
readonly words: readonly ["default", "muted", "info", "success", "warning", "danger", "onPrimary"];
|
|
972
|
+
readonly or: "themeColor";
|
|
973
|
+
};
|
|
826
974
|
readonly weight: readonly ["regular", "medium", "bold"];
|
|
827
975
|
readonly align: readonly ["start", "center", "end"];
|
|
828
976
|
readonly maxLines: "number";
|
|
977
|
+
readonly decoration: readonly ["none", "underline", "strikethrough"];
|
|
978
|
+
readonly numeric: "boolean";
|
|
979
|
+
readonly leading: readonly ["tight", "normal", "relaxed"];
|
|
980
|
+
readonly italic: "boolean";
|
|
981
|
+
readonly selectable: "boolean";
|
|
829
982
|
}, never, "text">;
|
|
830
983
|
readonly TextArea: ComponentManifest<"TextArea", {
|
|
831
984
|
readonly value: "string";
|
|
@@ -843,6 +996,23 @@ export declare const builtinComponents: {
|
|
|
843
996
|
readonly duration: "number";
|
|
844
997
|
}, "hide", "none">;
|
|
845
998
|
readonly View: ComponentManifest<"View", {
|
|
999
|
+
readonly background: {
|
|
1000
|
+
readonly words: readonly ["background", "surface", "primary", "muted", "info", "success", "warning", "danger"];
|
|
1001
|
+
readonly or: "themeColor";
|
|
1002
|
+
};
|
|
1003
|
+
readonly border: readonly ["none", "subtle", "strong"];
|
|
1004
|
+
readonly radius: readonly ["none", "small", "medium", "large", "full"];
|
|
1005
|
+
readonly width: {
|
|
1006
|
+
readonly words: readonly ["fill"];
|
|
1007
|
+
readonly or: "number";
|
|
1008
|
+
};
|
|
1009
|
+
readonly height: {
|
|
1010
|
+
readonly words: readonly ["fill"];
|
|
1011
|
+
readonly or: "number";
|
|
1012
|
+
};
|
|
1013
|
+
readonly minHeight: "number";
|
|
1014
|
+
readonly maxWidth: "number";
|
|
1015
|
+
readonly aspect: readonly ["1:1", "4:3", "3:2", "16:9", "3:4", "2:3", "9:16"];
|
|
846
1016
|
readonly variant: readonly ["plain", "card"];
|
|
847
1017
|
readonly padding: readonly ["none", "small", "medium", "large"];
|
|
848
1018
|
readonly paddingTop: readonly ["none", "small", "medium", "large"];
|
|
@@ -910,7 +1080,7 @@ declare global {
|
|
|
910
1080
|
export declare function hostTransport(): Transport;
|
|
911
1081
|
//#endregion
|
|
912
1082
|
//#region src/host/permissions.d.ts
|
|
913
|
-
export declare const PERMISSIONS: readonly ["account"];
|
|
1083
|
+
export declare const PERMISSIONS: readonly ["account", "camera", "photoLibrary", "files"];
|
|
914
1084
|
type DotPermission = (typeof PERMISSIONS)[number];
|
|
915
1085
|
export declare function isPermission(value: string): value is DotPermission;
|
|
916
1086
|
//#endregion
|
|
@@ -972,5 +1142,5 @@ export declare class MessageChannel<Outgoing extends MessageMap, Incoming extend
|
|
|
972
1142
|
listen(onError: (error: unknown, message: Envelope) => void): () => void;
|
|
973
1143
|
}
|
|
974
1144
|
//#endregion
|
|
975
|
-
export type { AppState, ChildrenType, ColorScheme, ComponentManifest, ComponentRegistry, DotEvent, DotHooks, DotPermission, Envelope, EventProp, HexColor, HostCallOptions, HostCaller, HostErrorCode, HostLayerMessages, HostRequest, HostResult, IconName, LogicLayerMessages, MessageHandler, MessageMap, MessageType, Navigation, NavigationBarOptions, PageBars, PageConfigs, PageHooks, PageLaunchOptions, PageState, PropOverride, PropType, PropTypes, PropValue, PropsOf, RenderContext, SchemeColor, SourceLocation, StackEntry, SystemContext, TabBarOptions, Theme, ThemeColors,
|
|
1145
|
+
export type { AppState, ChildrenType, ColorScheme, ComponentManifest, ComponentRegistry, DotEvent, DotHooks, DotPermission, Envelope, EventProp, HexColor, HostCallOptions, HostCaller, HostErrorCode, HostLayerMessages, HostRequest, HostResult, IconName, LogicLayerMessages, MessageHandler, MessageMap, MessageType, Navigation, NavigationBarOptions, PageBars, PageConfigs, PageHooks, PageLaunchOptions, PageState, PropOverride, PropType, PropTypes, PropValue, PropsOf, RenderContext, SchemeColor, SourceLocation, StackEntry, SystemContext, TabBarOptions, Theme, ThemeColors, ThemeShape, Transport, TransportAdapter, UILayerMessages, ViewRender, WordsOr };
|
|
976
1146
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","names":[],"sources":["../src/event/core.ts","../src/view/component.ts","../src/theme/theme.ts","../src/host/context.ts","../src/host/calls.ts","../src/page/bars.ts","../src/page/navigation.ts","../src/protocol/core.ts","../src/view/renderer.ts","../src/view/values.ts","../src/view/components/amount-input.ts","../src/view/components/button.ts","../src/view/components/carousel.ts","../src/view/components/chip.ts","../src/view/components/code-input.ts","../src/view/components/detail-row.ts","../src/view/components/divider.ts","../src/view/components/empty-state.ts","../src/view/components/feedback.ts","../src/view/components/footer.ts","../src/view/components/grid.ts","../src/view/components/icon.ts","../src/view/components/image.ts","../src/view/components/input.ts","../src/view/components/link.ts","../src/view/components/list.ts","../src/view/components/overlays.ts","../src/view/components/qr-code.ts","../src/view/components/select.ts","../src/view/components/scroll.ts","../src/view/components/skeleton.ts","../src/view/components/tabs.ts","../src/view/components/text.ts","../src/view/components/text-area.ts","../src/view/components/toggles.ts","../src/view/components/view.ts","../src/view/components/options.ts","../src/view/components/index.ts","../src/source/location.ts","../src/source/error.ts","../src/event/emitter.ts","../src/protocol/transport.ts","../src/host/host.ts","../src/host/permissions.ts","../src/host/files.ts","../src/host/network.ts","../src/host/react.ts","../src/page/lifecycle.ts","../src/page/state.ts","../src/version/semantic-version.ts","../src/messageChannel.ts"],"mappings":";UAEiB,SAAS,kBAAkB,OAAO,SAAS;WACjD;WACA,QAAQ;WACR,MAAM;;wBAGD,YAAY,SAAS,uBACnC,cACA,SAAQ,QACR,OAAM,SAAS,2BACd,SAAS;;;UCVK;EACf;EACA;EACA;EACA;;
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":[],"sources":["../src/event/core.ts","../src/view/component.ts","../src/theme/theme.ts","../src/host/context.ts","../src/host/calls.ts","../src/page/bars.ts","../src/page/navigation.ts","../src/protocol/core.ts","../src/view/renderer.ts","../src/view/values.ts","../src/view/components/amount-input.ts","../src/view/components/button.ts","../src/view/components/carousel.ts","../src/view/components/chip.ts","../src/view/components/code-input.ts","../src/view/components/detail-row.ts","../src/view/components/divider.ts","../src/view/components/empty-state.ts","../src/view/components/feedback.ts","../src/view/components/footer.ts","../src/view/components/grid.ts","../src/view/components/icon.ts","../src/view/components/image.ts","../src/view/components/slider.ts","../src/view/components/prose.ts","../src/view/components/input.ts","../src/view/components/link.ts","../src/view/components/list.ts","../src/view/components/overlays.ts","../src/view/components/qr-code.ts","../src/view/components/select.ts","../src/view/components/scroll.ts","../src/view/components/skeleton.ts","../src/view/components/tabs.ts","../src/view/components/text.ts","../src/view/components/text-area.ts","../src/view/components/toggles.ts","../src/view/components/view.ts","../src/view/components/options.ts","../src/view/components/index.ts","../src/source/location.ts","../src/source/error.ts","../src/event/emitter.ts","../src/protocol/transport.ts","../src/host/host.ts","../src/host/permissions.ts","../src/host/files.ts","../src/host/network.ts","../src/host/react.ts","../src/page/lifecycle.ts","../src/page/state.ts","../src/version/semantic-version.ts","../src/messageChannel.ts"],"mappings":";UAEiB,SAAS,kBAAkB,OAAO,SAAS;WACjD;WACA,QAAQ;WACR,MAAM;;wBAGD,YAAY,SAAS,uBACnC,cACA,SAAQ,QACR,OAAM,SAAS,2BACd,SAAS;;;UCVK;EACf;EACA;EACA;EACA;;UAKe;WACN;WACA;;KAGC,iBAAiB,gCAAgC;KAEjD,UAAU,UAAU,YAAY,8BACxC,YACA,UAAU,UACR,sBAAsB,8CACtB,gBAAgB,YACd,UAAU;wBAGF,UAAU,MAAM,WAAW,QAAQ;wBAKnC,eAAe,MAAM;KAMzB;UAIK,kBACf,8BACA,cAAc,eAAe,YAAY,eAAe,WACxD,gCACA,iBAAiB,eAAe;WAEvB,MAAM;WACN,OAAO;WAEP,iBAAiB;WACjB,UAAU;WACV;WAEA,qBAAqB;;UAGf;EACf;EACA;EACA;;wBAGc,sBACR,2BACA,cAAc,eAAe,YAAY,cAAc,iBACvD,qCACA,iBAAiB,eAAe,cACtC;EACA,MAAM;EACN,QAAQ;EACR,kBAAkB;EAClB,UAAU;EACV;EACA,qBAAqB;IACnB,kBAAkB,MAAM,OAAO,QAAQ;KAI/B,UAAU,6BAA6B,WAAW;wBAE9C,UAAU,sBAAsB,OAAO,QAAQ,UAAU;wBAKzD,YAAY;wBAMZ,UAAU;KAOd,QAAQ,UAAU,mBAAmB,uBAC9C,WAAW,cAAc,UAAU,WAAW,wBAE9C,KAAK,uBAAuB,UAAU,QAAQ,OAAO,qCACnD;EAA2C,WAAW;;KAE/C,oBAAoB,SAAS,eAAe;wBAExC,kBAAkB,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r(type) {
|
|
3
|
+
return typeof type === "object" && !Array.isArray(type);
|
|
4
|
+
}
|
|
5
|
+
function otherThanWords(type) {
|
|
6
|
+
return type.or === "number" ? "a number" : "a colour from the theme's custom colours";
|
|
7
|
+
}
|
|
2
8
|
function defineComponent(manifest) {
|
|
3
9
|
return {
|
|
4
10
|
props: {},
|
|
@@ -109,6 +115,49 @@ const TONES = [
|
|
|
109
115
|
"warning",
|
|
110
116
|
"danger"
|
|
111
117
|
];
|
|
118
|
+
const TEXT_TONES = {
|
|
119
|
+
words: [...TONES, "onPrimary"],
|
|
120
|
+
or: "themeColor"
|
|
121
|
+
};
|
|
122
|
+
const BACKGROUNDS = {
|
|
123
|
+
words: [
|
|
124
|
+
"background",
|
|
125
|
+
"surface",
|
|
126
|
+
"primary",
|
|
127
|
+
"muted",
|
|
128
|
+
"info",
|
|
129
|
+
"success",
|
|
130
|
+
"warning",
|
|
131
|
+
"danger"
|
|
132
|
+
],
|
|
133
|
+
or: "themeColor"
|
|
134
|
+
};
|
|
135
|
+
const BORDERS = [
|
|
136
|
+
"none",
|
|
137
|
+
"subtle",
|
|
138
|
+
"strong"
|
|
139
|
+
];
|
|
140
|
+
const RADII = [
|
|
141
|
+
"none",
|
|
142
|
+
"small",
|
|
143
|
+
"medium",
|
|
144
|
+
"large",
|
|
145
|
+
"full"
|
|
146
|
+
];
|
|
147
|
+
const LENGTH = {
|
|
148
|
+
words: ["fill"],
|
|
149
|
+
or: "number"
|
|
150
|
+
};
|
|
151
|
+
const BOX_PROPS = {
|
|
152
|
+
background: BACKGROUNDS,
|
|
153
|
+
border: BORDERS,
|
|
154
|
+
radius: RADII,
|
|
155
|
+
width: LENGTH,
|
|
156
|
+
height: LENGTH,
|
|
157
|
+
minHeight: "number",
|
|
158
|
+
maxWidth: "number",
|
|
159
|
+
aspect: ASPECTS
|
|
160
|
+
};
|
|
112
161
|
const STATUS_TONES = [
|
|
113
162
|
"default",
|
|
114
163
|
"info",
|
|
@@ -361,6 +410,49 @@ const Image = defineComponent({
|
|
|
361
410
|
}]
|
|
362
411
|
});
|
|
363
412
|
//#endregion
|
|
413
|
+
//#region src/view/components/slider.ts
|
|
414
|
+
const Slider = defineComponent({
|
|
415
|
+
name: "Slider",
|
|
416
|
+
props: {
|
|
417
|
+
value: "number",
|
|
418
|
+
min: "number",
|
|
419
|
+
max: "number",
|
|
420
|
+
step: "number",
|
|
421
|
+
showValue: "boolean",
|
|
422
|
+
label: "string",
|
|
423
|
+
hint: "string",
|
|
424
|
+
disabled: "boolean"
|
|
425
|
+
},
|
|
426
|
+
events: ["change"],
|
|
427
|
+
children: "none"
|
|
428
|
+
});
|
|
429
|
+
//#endregion
|
|
430
|
+
//#region src/view/components/prose.ts
|
|
431
|
+
const Prose = defineComponent({
|
|
432
|
+
name: "Prose",
|
|
433
|
+
props: { ...PADDING_PROPS },
|
|
434
|
+
children: "elements"
|
|
435
|
+
});
|
|
436
|
+
const Quote = defineComponent({
|
|
437
|
+
name: "Quote",
|
|
438
|
+
props: { cite: "string" },
|
|
439
|
+
children: "elements"
|
|
440
|
+
});
|
|
441
|
+
const BulletList = defineComponent({
|
|
442
|
+
name: "BulletList",
|
|
443
|
+
props: { ordered: "boolean" },
|
|
444
|
+
children: "elements"
|
|
445
|
+
});
|
|
446
|
+
const Bullet = defineComponent({
|
|
447
|
+
name: "Bullet",
|
|
448
|
+
children: "elements"
|
|
449
|
+
});
|
|
450
|
+
const RichText = defineComponent({
|
|
451
|
+
name: "RichText",
|
|
452
|
+
props: { markdown: "string" },
|
|
453
|
+
children: "none"
|
|
454
|
+
});
|
|
455
|
+
//#endregion
|
|
364
456
|
//#region src/view/components/input.ts
|
|
365
457
|
const Input = defineComponent({
|
|
366
458
|
name: "Input",
|
|
@@ -537,11 +629,14 @@ const Text = defineComponent({
|
|
|
537
629
|
name: "Text",
|
|
538
630
|
props: {
|
|
539
631
|
variant: [
|
|
632
|
+
"display",
|
|
540
633
|
"title",
|
|
634
|
+
"subtitle",
|
|
635
|
+
"lead",
|
|
541
636
|
"body",
|
|
542
637
|
"caption"
|
|
543
638
|
],
|
|
544
|
-
tone:
|
|
639
|
+
tone: TEXT_TONES,
|
|
545
640
|
weight: [
|
|
546
641
|
"regular",
|
|
547
642
|
"medium",
|
|
@@ -553,6 +648,19 @@ const Text = defineComponent({
|
|
|
553
648
|
"end"
|
|
554
649
|
],
|
|
555
650
|
maxLines: "number",
|
|
651
|
+
decoration: [
|
|
652
|
+
"none",
|
|
653
|
+
"underline",
|
|
654
|
+
"strikethrough"
|
|
655
|
+
],
|
|
656
|
+
numeric: "boolean",
|
|
657
|
+
leading: [
|
|
658
|
+
"tight",
|
|
659
|
+
"normal",
|
|
660
|
+
"relaxed"
|
|
661
|
+
],
|
|
662
|
+
italic: "boolean",
|
|
663
|
+
selectable: "boolean",
|
|
556
664
|
...PADDING_PROPS
|
|
557
665
|
},
|
|
558
666
|
children: "text",
|
|
@@ -638,16 +746,39 @@ const View = defineComponent({
|
|
|
638
746
|
wrap: "boolean",
|
|
639
747
|
grow: "boolean",
|
|
640
748
|
...PADDING_PROPS,
|
|
641
|
-
variant: ["plain", "card"]
|
|
749
|
+
variant: ["plain", "card"],
|
|
750
|
+
...BOX_PROPS
|
|
642
751
|
},
|
|
643
752
|
events: ["tap"],
|
|
644
|
-
children: "elements"
|
|
753
|
+
children: "elements",
|
|
754
|
+
overrides: [{
|
|
755
|
+
prop: "aspect",
|
|
756
|
+
ignores: "height",
|
|
757
|
+
because: "the aspect sets the height"
|
|
758
|
+
}]
|
|
759
|
+
});
|
|
760
|
+
const Stack = defineComponent({
|
|
761
|
+
name: "Stack",
|
|
762
|
+
props: {
|
|
763
|
+
radius: BOX_PROPS.radius,
|
|
764
|
+
width: BOX_PROPS.width,
|
|
765
|
+
height: BOX_PROPS.height,
|
|
766
|
+
aspect: BOX_PROPS.aspect
|
|
767
|
+
},
|
|
768
|
+
children: "elements",
|
|
769
|
+
overrides: [{
|
|
770
|
+
prop: "aspect",
|
|
771
|
+
ignores: "height",
|
|
772
|
+
because: "the aspect sets the height"
|
|
773
|
+
}]
|
|
645
774
|
});
|
|
646
775
|
//#endregion
|
|
647
776
|
//#region src/view/components/index.ts
|
|
648
777
|
const builtinComponents = {
|
|
649
778
|
AmountInput,
|
|
650
779
|
Badge,
|
|
780
|
+
Bullet,
|
|
781
|
+
BulletList,
|
|
651
782
|
Button,
|
|
652
783
|
Carousel,
|
|
653
784
|
Checkbox,
|
|
@@ -668,14 +799,19 @@ const builtinComponents = {
|
|
|
668
799
|
Notice,
|
|
669
800
|
Option,
|
|
670
801
|
ProgressBar,
|
|
802
|
+
Prose,
|
|
671
803
|
QRCode,
|
|
804
|
+
Quote,
|
|
672
805
|
Radio,
|
|
673
806
|
RadioGroup,
|
|
807
|
+
RichText,
|
|
674
808
|
Scroll,
|
|
675
809
|
Select,
|
|
676
810
|
Sheet,
|
|
677
811
|
Skeleton,
|
|
812
|
+
Slider,
|
|
678
813
|
Spinner,
|
|
814
|
+
Stack,
|
|
679
815
|
Switch,
|
|
680
816
|
Tab,
|
|
681
817
|
Tabs,
|
|
@@ -793,7 +929,12 @@ function createHostRequest(promise, cancel = () => {}) {
|
|
|
793
929
|
}
|
|
794
930
|
//#endregion
|
|
795
931
|
//#region src/host/permissions.ts
|
|
796
|
-
const PERMISSIONS = [
|
|
932
|
+
const PERMISSIONS = [
|
|
933
|
+
"account",
|
|
934
|
+
"camera",
|
|
935
|
+
"photoLibrary",
|
|
936
|
+
"files"
|
|
937
|
+
];
|
|
797
938
|
function isPermission(value) {
|
|
798
939
|
return PERMISSIONS.includes(value);
|
|
799
940
|
}
|
|
@@ -933,7 +1074,7 @@ const PAGE_HOOKS = Object.keys({
|
|
|
933
1074
|
});
|
|
934
1075
|
//#endregion
|
|
935
1076
|
//#region src/page/navigation.ts
|
|
936
|
-
const MAX_STACK_DEPTH =
|
|
1077
|
+
const MAX_STACK_DEPTH = 16;
|
|
937
1078
|
const PAGE_ID = /^[A-Za-z0-9_-]+(?:\/[A-Za-z0-9_-]+)*$/;
|
|
938
1079
|
function isPageId(value) {
|
|
939
1080
|
return PAGE_ID.test(value);
|
|
@@ -942,7 +1083,7 @@ var NavigationStack = class {
|
|
|
942
1083
|
limit;
|
|
943
1084
|
#pages = [];
|
|
944
1085
|
#nextInstanceId = 1;
|
|
945
|
-
constructor(limit =
|
|
1086
|
+
constructor(limit = 16) {
|
|
946
1087
|
this.limit = limit;
|
|
947
1088
|
}
|
|
948
1089
|
get pages() {
|
|
@@ -1057,6 +1198,6 @@ var MessageChannel = class {
|
|
|
1057
1198
|
}
|
|
1058
1199
|
};
|
|
1059
1200
|
//#endregion
|
|
1060
|
-
export { ASPECTS, AmountInput, Badge, Button, Carousel, Checkbox, Chip, CodeInput, DEFAULT_SYSTEM_CONTEXT, DOT_FILE_PATH_MAX_LENGTH, DetailRow, Divider, EmptyState, EventEmitter, Footer, Grid, GridItem, HostError, ICON_NAMES, Icon, Image, Input, Link, List, ListItem, MAX_STACK_DEPTH, MessageChannel, NETWORK_HOST_MAX_LENGTH, NETWORK_HOST_PATTERN, NavigationStack, Notice, Option, PADDING_PROPS, PAGE_HOOKS, PERMISSIONS, ProgressBar, QRCode, REACT_HOST_MODULES, REACT_HOST_PATH, Radio, RadioGroup, SEMVER_PATTERN, SIZES, SPACES, STATUS_TONES, Scroll, Select, Sheet, Skeleton, SourceError, Spinner, Switch, TONES, Tab, Tabs, Text, TextArea, Toast, View, allowsHost, applyChanges, builtinComponents, builtinRegistry, callHost, checkConfigs, checkNavigationBar, checkTabBar, compareVersions, componentRegistry, connectHost, createAdaptorTransport, createEvent, createHostRequest, createLocator, createTransportPair, defineComponent, dotFilePathProblem, eventName, eventProp, hostTransport, isEventProp, isNetworkHost, isNewerMajor, isPageId, isPermission, isReactCompatible, isSemanticVersion, isVersionAtLeast, locatedMessage, locationAt, majorVersion, mergeConfigs, newestReactOfMajor, reactHostUrl, toList, toText };
|
|
1201
|
+
export { ASPECTS, AmountInput, BACKGROUNDS, BORDERS, BOX_PROPS, Badge, Bullet, BulletList, Button, Carousel, Checkbox, Chip, CodeInput, DEFAULT_SYSTEM_CONTEXT, DOT_FILE_PATH_MAX_LENGTH, DetailRow, Divider, EmptyState, EventEmitter, Footer, Grid, GridItem, HostError, ICON_NAMES, Icon, Image, Input, LENGTH, Link, List, ListItem, MAX_STACK_DEPTH, MessageChannel, NETWORK_HOST_MAX_LENGTH, NETWORK_HOST_PATTERN, NavigationStack, Notice, Option, PADDING_PROPS, PAGE_HOOKS, PERMISSIONS, ProgressBar, Prose, QRCode, Quote, RADII, REACT_HOST_MODULES, REACT_HOST_PATH, Radio, RadioGroup, RichText, SEMVER_PATTERN, SIZES, SPACES, STATUS_TONES, Scroll, Select, Sheet, Skeleton, Slider, SourceError, Spinner, Stack, Switch, TEXT_TONES, TONES, Tab, Tabs, Text, TextArea, Toast, View, allowsHost, applyChanges, builtinComponents, builtinRegistry, callHost, checkConfigs, checkNavigationBar, checkTabBar, compareVersions, componentRegistry, connectHost, createAdaptorTransport, createEvent, createHostRequest, createLocator, createTransportPair, defineComponent, dotFilePathProblem, eventName, eventProp, hostTransport, isEventProp, isNetworkHost, isNewerMajor, isPageId, isPermission, isReactCompatible, isSemanticVersion, isVersionAtLeast, isWordsOr, locatedMessage, locationAt, majorVersion, mergeConfigs, newestReactOfMajor, otherThanWords, reactHostUrl, toList, toText };
|
|
1061
1202
|
|
|
1062
1203
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../src/view/component.ts","../src/view/values.ts","../src/view/components/amount-input.ts","../src/view/components/button.ts","../src/view/components/options.ts","../src/view/components/carousel.ts","../src/view/components/chip.ts","../src/view/components/code-input.ts","../src/view/components/detail-row.ts","../src/view/components/divider.ts","../src/view/components/empty-state.ts","../src/view/components/feedback.ts","../src/view/components/footer.ts","../src/view/components/grid.ts","../src/view/components/icon.ts","../src/view/components/image.ts","../src/view/components/input.ts","../src/view/components/link.ts","../src/view/components/list.ts","../src/view/components/overlays.ts","../src/view/components/qr-code.ts","../src/view/components/select.ts","../src/view/components/scroll.ts","../src/view/components/skeleton.ts","../src/view/components/tabs.ts","../src/view/components/text.ts","../src/view/components/text-area.ts","../src/view/components/toggles.ts","../src/view/components/view.ts","../src/view/components/index.ts","../src/source/location.ts","../src/source/error.ts","../src/event/emitter.ts","../src/event/core.ts","../src/host/host.ts","../src/host/context.ts","../src/host/calls.ts","../src/host/permissions.ts","../src/host/files.ts","../src/host/network.ts","../src/version/semantic-version.ts","../src/host/react.ts","../src/protocol/transport.ts","../src/page/lifecycle.ts","../src/page/navigation.ts","../src/page/state.ts","../src/page/bars.ts","../src/messageChannel.ts"],"sourcesContent":["import type { DotEvent } from '../event/core';\n\nexport interface PropTypes {\n string: string;\n number: number;\n boolean: boolean;\n any: unknown;\n}\n\nexport type PropType = keyof PropTypes | readonly string[];\n\nexport type PropValue<T extends PropType> = T extends readonly string[]\n ? T[number]\n : T extends keyof PropTypes\n ? PropTypes[T]\n : never;\n\n// `text` holds text and inline components such as `Text`. `elements` holds components, and any\n// loose text in it is wrapped in an inline one.\nexport type ChildrenType = 'none' | 'text' | 'elements';\n\n// A component apart from any renderer. The compiler checks markup against it, and each renderer\n// maps it to its own elements.\nexport interface ComponentManifest<\n Name extends string = string,\n Props extends Record<string, PropType> = Record<string, PropType>,\n Events extends string = string,\n Children extends ChildrenType = ChildrenType,\n> {\n readonly name: Name;\n readonly props: Props;\n // Event names. `click` is written `onClick` in markup and arrives as the `onClick` prop.\n readonly events: readonly Events[];\n readonly children: Children;\n readonly inline?: boolean;\n // Props that make another prop pointless. The compiler warns when markup sets both.\n readonly overrides?: readonly PropOverride[];\n}\n\nexport interface PropOverride {\n prop: string;\n ignores: string;\n because: string;\n}\n\nexport function defineComponent<\n const Name extends string,\n const Props extends Record<string, PropType> = Record<never, PropType>,\n const Events extends string = never,\n const Children extends ChildrenType = ChildrenType,\n>(manifest: {\n name: Name;\n props?: Props;\n events?: readonly Events[];\n children: Children;\n inline?: boolean;\n overrides?: readonly PropOverride[];\n}): ComponentManifest<Name, Props, Events, Children> {\n return { props: {} as Props, events: [], ...manifest };\n}\n\nexport type EventProp<Event extends string> = `on${Capitalize<Event>}`;\n\nexport function eventProp<Event extends string>(event: Event): EventProp<Event> {\n return `on${event.charAt(0).toUpperCase()}${event.slice(1)}` as EventProp<Event>;\n}\n\n// Event props are `on` followed by a capital letter, like `onClick`.\nexport function isEventProp(name: string): boolean {\n const letterAfterOn = name.charAt('on'.length);\n return name.startsWith('on') && letterAfterOn >= 'A' && letterAfterOn <= 'Z';\n}\n\n// The reverse of eventProp: `onClick` -> `click`.\nexport function eventName(prop: string): string {\n const name = prop.slice('on'.length);\n return name.charAt(0).toLowerCase() + name.slice(1);\n}\n\n// The props a renderer's version of `M` receives. Any prop may be undefined, since markup can leave\n// it out and a binding can give undefined.\nexport type PropsOf<M extends ComponentManifest, Children = never> = {\n [K in keyof M['props']]?: PropValue<M['props'][K]> | undefined;\n} & {\n [E in M['events'][number] as EventProp<E>]?: ((event: DotEvent) => void) | undefined;\n} & (M['children'] extends 'none' ? unknown : { children?: Children | undefined });\n\nexport type ComponentRegistry = Readonly<Record<string, ComponentManifest>>;\n\nexport function componentRegistry(manifests: Iterable<ComponentManifest>): ComponentRegistry {\n const registry: Record<string, ComponentManifest> = {};\n for (const manifest of manifests) {\n if (manifest.name in registry) {\n throw new Error(`Component <${manifest.name}> is defined twice`);\n }\n registry[manifest.name] = manifest;\n }\n return registry;\n}\n","export function toText(value: unknown): string {\n switch (typeof value) {\n case 'string':\n return value;\n case 'number':\n case 'boolean':\n case 'bigint':\n return String(value);\n case 'object':\n return value === null ? '' : JSON.stringify(value);\n default:\n return '';\n }\n}\n\nexport function toList(value: unknown): readonly unknown[] {\n if (Array.isArray(value)) {\n return value;\n }\n if (typeof value === 'object' && value !== null && Symbol.iterator in value) {\n return Array.from(value as Iterable<unknown>);\n }\n return [];\n}\n","import { defineComponent } from '../component';\n\n// A sum of money in large type, with thousands separators. Once typed, it shows the minor units, so\n// 1 reads 1.00. `value` and the value `change` carries are in `unit`. `change` carries null when\n// the field is empty.\nexport const AmountInput = defineComponent({\n name: 'AmountInput',\n props: {\n value: 'number',\n // The ISO 4217 code shown before the amount. Defaults to SLE.\n currency: 'string',\n // Digits after the decimal point. Defaults to the currency's own, such as 2 for SLE cents.\n minorUnits: 'number',\n // `minor` (the default) counts minor units, so 150 is SLE 1.50. `major` is the amount itself,\n // so 1 is SLE 1.00.\n unit: ['minor', 'major'],\n label: 'string',\n placeholder: 'string',\n hint: 'string',\n error: 'string',\n disabled: 'boolean',\n },\n events: ['change'],\n children: 'none',\n});\n","import { defineComponent } from '../component';\n\nexport const Button = defineComponent({\n name: 'Button',\n props: {\n variant: ['primary', 'secondary'],\n disabled: 'boolean',\n // Shows a spinner and ignores taps, such as while a payment is sent.\n loading: 'boolean',\n },\n events: ['click'],\n children: 'text',\n});\n","export const SIZES = ['small', 'medium', 'large'] as const;\n\n// Space between or around components.\nexport const SPACES = ['none', 'small', 'medium', 'large'] as const;\n\n// Space inside a component's edges, for all sides or one at a time, in place of the component's\n// own. `start` and `end` follow the reading direction, so they swap in right-to-left languages.\nexport const PADDING_PROPS = {\n padding: SPACES,\n paddingTop: SPACES,\n paddingStart: SPACES,\n paddingEnd: SPACES,\n paddingBottom: SPACES,\n} as const;\n\n// The shape of a picture's or a video's box.\nexport const ASPECTS = ['1:1', '4:3', '3:2', '16:9', '3:4', '2:3', '9:16'] as const;\n\nexport const TONES = ['default', 'muted', 'info', 'success', 'warning', 'danger'] as const;\n\nexport const STATUS_TONES = ['default', 'info', 'success', 'warning', 'danger'] as const;\n\nexport const ICON_NAMES = [\n 'arrow-down',\n 'arrow-left',\n 'arrow-right',\n 'arrow-up',\n 'bank',\n 'bell',\n 'bolt',\n 'calendar',\n 'card',\n 'cart',\n 'cash',\n 'check',\n 'chevron-down',\n 'chevron-left',\n 'chevron-right',\n 'chevron-up',\n 'clock',\n 'close',\n 'copy',\n 'download',\n 'edit',\n 'error',\n 'external-link',\n 'eye',\n 'eye-off',\n 'file',\n 'gift',\n 'globe',\n 'grid',\n 'headphones',\n 'heart',\n 'help',\n 'history',\n 'home',\n 'image',\n 'info',\n 'link',\n 'list',\n 'location',\n 'lock',\n 'logout',\n 'mail',\n 'microphone',\n 'minus',\n 'mobile',\n 'more',\n 'music',\n 'phone',\n 'playlist',\n 'plus',\n 'qr-code',\n 'receipt',\n 'refresh',\n 'search',\n 'send',\n 'settings',\n 'share',\n 'star',\n 'success',\n 'ticket',\n 'trash',\n 'upload',\n 'user',\n 'users',\n 'video',\n 'wallet',\n 'warning',\n 'water',\n 'wifi',\n] as const;\n\nexport type IconName = (typeof ICON_NAMES)[number];\n","import { defineComponent } from '../component';\nimport { PADDING_PROPS, SPACES } from './options';\n\n// Shows its children one at a time, as slides to swipe between. `change` carries the `index` of\n// the slide it moved to.\nexport const Carousel = defineComponent({\n name: 'Carousel',\n props: {\n // Moves to the next slide every `interval` milliseconds, pausing while touched.\n autoplay: 'boolean',\n interval: 'number',\n // After the last slide comes the first again.\n loop: 'boolean',\n indicator: ['dots', 'none'],\n // Space between slides, seen while one slides in.\n gap: SPACES,\n // `scale` shrinks a slide as it leaves the middle and grows the one coming in, as you swipe.\n effect: ['slide', 'scale'],\n // The slide to show. Changing it moves the carousel there.\n index: 'number',\n ...PADDING_PROPS,\n },\n events: ['change'],\n children: 'elements',\n});\n","import { defineComponent } from '../component';\nimport { ICON_NAMES } from './options';\n\n// A small rounded choice, such as a filter. `selected` fills it in.\nexport const Chip = defineComponent({\n name: 'Chip',\n props: { label: 'string', icon: ICON_NAMES, selected: 'boolean', disabled: 'boolean' },\n events: ['tap'],\n children: 'none',\n});\n","import { defineComponent } from '../component';\n\n// A one-time code or PIN, one box per digit. `complete` comes after the `change` that fills the\n// last box.\nexport const CodeInput = defineComponent({\n name: 'CodeInput',\n props: {\n value: 'string',\n // Number of digits. Defaults to 6.\n length: 'number',\n label: 'string',\n hint: 'string',\n error: 'string',\n // Shows dots in place of the digits, as for a PIN.\n secure: 'boolean',\n disabled: 'boolean',\n },\n events: ['change', 'complete'],\n children: 'none',\n});\n","import { defineComponent } from '../component';\nimport { PADDING_PROPS, TONES } from './options';\n\n// A label and its value on one line, such as a line of a receipt. A long value wraps onto more\n// lines and stays at the end.\nexport const DetailRow = defineComponent({\n name: 'DetailRow',\n props: {\n label: 'string',\n value: 'string',\n // The value's tone and weight. The label is always muted.\n tone: TONES,\n weight: ['regular', 'medium', 'bold'],\n ...PADDING_PROPS,\n },\n children: 'none',\n});\n","import { defineComponent } from '../component';\n\nexport const Divider = defineComponent({\n name: 'Divider',\n children: 'none',\n});\n","import { defineComponent } from '../component';\nimport { ICON_NAMES, PADDING_PROPS } from './options';\n\n// Shown where there's nothing yet, such as an empty list. Its children, such as a button, show\n// under its text.\nexport const EmptyState = defineComponent({\n name: 'EmptyState',\n props: { icon: ICON_NAMES, title: 'string', text: 'string', ...PADDING_PROPS },\n children: 'elements',\n});\n","import { defineComponent } from '../component';\nimport { PADDING_PROPS, SIZES, STATUS_TONES } from './options';\n\nexport const Spinner = defineComponent({\n name: 'Spinner',\n props: { size: SIZES },\n children: 'none',\n});\n\nexport const ProgressBar = defineComponent({\n name: 'ProgressBar',\n // From 0 to 100.\n props: { value: 'number' },\n children: 'none',\n});\n\n// A message in the flow of the page, such as a failed payment's reason.\nexport const Notice = defineComponent({\n name: 'Notice',\n props: { tone: STATUS_TONES, title: 'string', ...PADDING_PROPS },\n children: 'text',\n});\n\nexport const Badge = defineComponent({\n name: 'Badge',\n props: { tone: STATUS_TONES },\n children: 'text',\n});\n","import { defineComponent } from '../component';\nimport { PADDING_PROPS } from './options';\n\n// Holds the page's main action and stays at the bottom while the page scrolls. Put it last in the\n// page's root View.\nexport const Footer = defineComponent({\n name: 'Footer',\n props: PADDING_PROPS,\n children: 'elements',\n});\n","import { defineComponent } from '../component';\nimport { ICON_NAMES, PADDING_PROPS, SPACES } from './options';\n\n// Lays out its children in equal columns. `columns` defaults to 4.\nexport const Grid = defineComponent({\n name: 'Grid',\n props: { columns: 'number', gap: SPACES, ...PADDING_PROPS },\n children: 'elements',\n});\n\n// An icon or picture over a short label, such as a service on a home screen.\nexport const GridItem = defineComponent({\n name: 'GridItem',\n props: {\n label: 'string',\n icon: ICON_NAMES,\n image: 'string',\n // A short note on the item's corner, such as \"New\" or a count.\n badge: 'string',\n },\n events: ['tap'],\n children: 'none',\n});\n","import { defineComponent } from '../component';\nimport { ICON_NAMES, SIZES, TONES } from './options';\n\nexport const Icon = defineComponent({\n name: 'Icon',\n props: { name: ICON_NAMES, size: SIZES, tone: TONES },\n children: 'none',\n inline: true,\n});\n","import { defineComponent } from '../component';\nimport { ASPECTS } from './options';\n\nexport const Image = defineComponent({\n name: 'Image',\n props: {\n src: 'string',\n alt: 'string',\n width: 'number',\n height: 'number',\n // `cover` fills the box and crops. `contain` shows the whole picture.\n fit: ['cover', 'contain'],\n shape: ['rounded', 'square', 'circle'],\n // The box's shape. Without a width, the picture fills the width it's given, such as the\n // screen's, and its height follows.\n aspect: ASPECTS,\n },\n events: ['load', 'error'],\n children: 'none',\n overrides: [{ prop: 'aspect', ignores: 'height', because: 'the aspect sets the height' }],\n});\n","import { defineComponent } from '../component';\n\nexport const Input = defineComponent({\n name: 'Input',\n props: {\n value: 'string',\n placeholder: 'string',\n label: 'string',\n // Help shown under the field, which `error` replaces.\n hint: 'string',\n error: 'string',\n // Text shown inside the field, before and after what the person types, such as \"Le\".\n prefix: 'string',\n suffix: 'string',\n type: ['text', 'number', 'email', 'phone', 'password'],\n maxLength: 'number',\n disabled: 'boolean',\n },\n events: ['change', 'submit'],\n children: 'none',\n});\n","import { defineComponent } from '../component';\nimport { TONES } from './options';\n\n// Text to tap, inside a Text or on its own. With an https `href`, Dash opens it in the device's\n// browser. Without one, it raises `tap` for the page.\nexport const Link = defineComponent({\n name: 'Link',\n props: {\n href: 'string',\n // The primary color unless a tone sets another.\n tone: TONES,\n },\n events: ['tap'],\n children: 'text',\n inline: true,\n});\n","import { defineComponent } from '../component';\nimport { ICON_NAMES, PADDING_PROPS } from './options';\n\n// `endReached` comes when the last row scrolls into view, such as to load more rows. It comes again\n// once a new last row does.\nexport const List = defineComponent({\n name: 'List',\n props: { size: ['sm', 'md'], ...PADDING_PROPS },\n events: ['endReached'],\n children: 'elements',\n});\n\n// Its children show at its end, in place of `value`. A row with `onTap` shows a chevron.\nexport const ListItem = defineComponent({\n name: 'ListItem',\n props: {\n title: 'string',\n subtitle: 'string',\n value: 'string',\n icon: ICON_NAMES,\n image: 'string',\n ...PADDING_PROPS,\n },\n events: ['tap'],\n children: 'elements',\n});\n","import { defineComponent } from '../component';\nimport { PADDING_PROPS, STATUS_TONES } from './options';\n\n// A panel that slides up over the page while `open` is true, such as an action sheet of buttons.\n// Tapping outside it raises `close`. The page closes it by setting `open` back to false.\nexport const Sheet = defineComponent({\n name: 'Sheet',\n props: { open: 'boolean', title: 'string', showCloseIcon: 'boolean', ...PADDING_PROPS },\n events: ['close'],\n children: 'elements',\n});\n\n// Shows `message` briefly over the page, then raises `hide`. Clear the message there so the same\n// one can show again.\nexport const Toast = defineComponent({\n name: 'Toast',\n props: {\n message: 'string',\n tone: STATUS_TONES,\n // In milliseconds.\n duration: 'number',\n },\n events: ['hide'],\n children: 'none',\n});\n","import { defineComponent } from '../component';\n\n// Shows `value` as a QR code. It's dark on light in every theme, so any camera can read it.\nexport const QRCode = defineComponent({\n name: 'QRCode',\n props: {\n value: 'string',\n // In pixels. Defaults to 200.\n size: 'number',\n // What screen readers say in place of the code.\n label: 'string',\n },\n children: 'none',\n});\n","import { defineComponent } from '../component';\n\n// A field that opens a sheet of its `Option`s. `value` is the chosen option's value.\nexport const Select = defineComponent({\n name: 'Select',\n props: {\n value: 'string',\n label: 'string',\n placeholder: 'string',\n hint: 'string',\n error: 'string',\n disabled: 'boolean',\n },\n events: ['change'],\n children: 'elements',\n});\n\nexport const Option = defineComponent({\n name: 'Option',\n props: { value: 'string', label: 'string' },\n children: 'none',\n});\n","import { defineComponent } from '../component';\nimport { PADDING_PROPS, SPACES } from './options';\n\n// A row of children that scrolls sideways, such as a shelf of albums. Each child keeps its own\n// width. A View child is as wide as its widest fixed-width child, such as an Image with a width.\n// Once a scroll stops, `change` carries the `index` of the child at the start.\nexport const Scroll = defineComponent({\n name: 'Scroll',\n props: {\n gap: SPACES,\n // Where children come to rest after a swipe.\n snap: ['none', 'start', 'center'],\n // The child to scroll to. Changing it scrolls there.\n index: 'number',\n // paddingStart and paddingEnd are the space before the first child and after the last.\n ...PADDING_PROPS,\n },\n events: ['change'],\n children: 'elements',\n});\n","import { defineComponent } from '../component';\n\nexport const Skeleton = defineComponent({\n name: 'Skeleton',\n props: {\n shape: ['text', 'circle', 'box'],\n // Lines of text, for `text`.\n lines: 'number',\n // In pixels, for `circle` and `box`.\n height: 'number',\n },\n children: 'none',\n});\n","import { defineComponent } from '../component';\nimport { PADDING_PROPS } from './options';\n\n// A row of `Tab`s with one chosen. `value` is the chosen tab's value. The page shows the content\n// for it, such as with an <If> for each tab.\nexport const Tabs = defineComponent({\n name: 'Tabs',\n props: {\n value: 'string',\n // `underline` marks the chosen tab with a line. `segmented` fills it in, in a rounded track.\n variant: ['underline', 'segmented'],\n ...PADDING_PROPS,\n },\n events: ['change'],\n children: 'elements',\n});\n\nexport const Tab = defineComponent({\n name: 'Tab',\n props: {\n value: 'string',\n label: 'string',\n // A count shown next to the label, such as unread items.\n badge: 'number',\n },\n children: 'none',\n});\n","import { defineComponent } from '../component';\nimport { PADDING_PROPS, TONES } from './options';\n\nexport const Text = defineComponent({\n name: 'Text',\n props: {\n variant: ['title', 'body', 'caption'],\n tone: TONES,\n weight: ['regular', 'medium', 'bold'],\n align: ['start', 'center', 'end'],\n // Cuts the text off with an ellipsis after this many lines.\n maxLines: 'number',\n ...PADDING_PROPS,\n },\n children: 'text',\n inline: true,\n});\n","import { defineComponent } from '../component';\n\nexport const TextArea = defineComponent({\n name: 'TextArea',\n props: {\n value: 'string',\n placeholder: 'string',\n label: 'string',\n hint: 'string',\n error: 'string',\n // The lines of text it shows before scrolling.\n rows: 'number',\n maxLength: 'number',\n disabled: 'boolean',\n },\n events: ['change'],\n children: 'none',\n});\n","import { defineComponent } from '../component';\n\nexport const Switch = defineComponent({\n name: 'Switch',\n props: { checked: 'boolean', label: 'string', disabled: 'boolean' },\n events: ['change'],\n children: 'none',\n});\n\nexport const Checkbox = defineComponent({\n name: 'Checkbox',\n props: { checked: 'boolean', label: 'string', disabled: 'boolean' },\n events: ['change'],\n children: 'none',\n});\n\n// A choice of one of its `Radio`s. `value` is the chosen radio's value.\nexport const RadioGroup = defineComponent({\n name: 'RadioGroup',\n props: { value: 'string', label: 'string', disabled: 'boolean' },\n events: ['change'],\n children: 'elements',\n});\n\nexport const Radio = defineComponent({\n name: 'Radio',\n props: { value: 'string', label: 'string', disabled: 'boolean' },\n children: 'none',\n});\n","import { defineComponent } from '../component';\nimport { PADDING_PROPS, SPACES } from './options';\n\nexport const View = defineComponent({\n name: 'View',\n props: {\n gap: SPACES,\n direction: ['column', 'row'],\n // Across `direction`.\n align: ['stretch', 'start', 'center', 'end'],\n // Along `direction`. `between` puts the first and last child at the ends.\n justify: ['start', 'center', 'end', 'between'],\n // Lets children that don't fit flow onto another line.\n wrap: 'boolean',\n // Fills the space the parent has left, along the parent's direction.\n grow: 'boolean',\n ...PADDING_PROPS,\n variant: ['plain', 'card'],\n },\n events: ['tap'],\n children: 'elements',\n});\n","import { componentRegistry } from '../component';\nimport { AmountInput } from './amount-input';\nimport { Button } from './button';\nimport { Carousel } from './carousel';\nimport { Chip } from './chip';\nimport { CodeInput } from './code-input';\nimport { DetailRow } from './detail-row';\nimport { Divider } from './divider';\nimport { EmptyState } from './empty-state';\nimport { Badge, Notice, ProgressBar, Spinner } from './feedback';\nimport { Footer } from './footer';\nimport { Grid, GridItem } from './grid';\nimport { Icon } from './icon';\nimport { Image } from './image';\nimport { Input } from './input';\nimport { Link } from './link';\nimport { List, ListItem } from './list';\nimport { Sheet, Toast } from './overlays';\nimport { QRCode } from './qr-code';\nimport { Option, Select } from './select';\nimport { Scroll } from './scroll';\nimport { Skeleton } from './skeleton';\nimport { Tab, Tabs } from './tabs';\nimport { Text } from './text';\nimport { TextArea } from './text-area';\nimport { Checkbox, Radio, RadioGroup, Switch } from './toggles';\nimport { View } from './view';\n\nexport {\n AmountInput,\n Badge,\n Button,\n Carousel,\n Checkbox,\n Chip,\n CodeInput,\n DetailRow,\n Divider,\n EmptyState,\n Footer,\n Grid,\n GridItem,\n Icon,\n Image,\n Input,\n Link,\n List,\n ListItem,\n Notice,\n Option,\n ProgressBar,\n QRCode,\n Radio,\n RadioGroup,\n Scroll,\n Select,\n Sheet,\n Skeleton,\n Spinner,\n Switch,\n Tab,\n Tabs,\n Text,\n TextArea,\n Toast,\n View,\n};\nexport { ASPECTS, ICON_NAMES, PADDING_PROPS, SIZES, SPACES, STATUS_TONES, TONES } from './options';\nexport type { IconName } from './options';\n\nexport const builtinComponents = {\n AmountInput,\n Badge,\n Button,\n Carousel,\n Checkbox,\n Chip,\n CodeInput,\n DetailRow,\n Divider,\n EmptyState,\n Footer,\n Grid,\n GridItem,\n Icon,\n Image,\n Input,\n Link,\n List,\n ListItem,\n Notice,\n Option,\n ProgressBar,\n QRCode,\n Radio,\n RadioGroup,\n Scroll,\n Select,\n Sheet,\n Skeleton,\n Spinner,\n Switch,\n Tab,\n Tabs,\n Text,\n TextArea,\n Toast,\n View,\n} as const;\n\nexport type BuiltinComponents = typeof builtinComponents;\n\nexport const builtinRegistry = componentRegistry(Object.values(builtinComponents));\n","export interface SourceLocation {\n readonly line: number;\n readonly column: number;\n readonly offset: number;\n}\n\n// Finds lines by binary search over their start offsets, computed once per source.\nexport function createLocator(source: string): (offset: number) => SourceLocation {\n const lineStarts = [0];\n for (let index = 0; index < source.length; index++) {\n if (source[index] === '\\n') {\n lineStarts.push(index + 1);\n }\n }\n return (offset) => {\n let low = 0;\n let high = lineStarts.length - 1;\n while (low < high) {\n const middle = Math.floor((low + high + 1) / 2);\n if (lineStarts[middle]! <= offset) {\n low = middle;\n } else {\n high = middle - 1;\n }\n }\n return { line: low + 1, column: offset - lineStarts[low]! + 1, offset };\n };\n}\n\nexport function locationAt(source: string, offset: number): SourceLocation {\n return createLocator(source)(offset);\n}\n\nexport function locatedMessage(message: string, file?: string, location?: SourceLocation): string {\n const where = [file, location?.line, location?.column]\n .filter((part) => part !== undefined)\n .join(':');\n return where ? `${where}: ${message}` : message;\n}\n","import type { SourceLocation } from './location';\nimport { locatedMessage } from './location';\n\n// A problem at a place in a source file. The message starts with `file:line:column:`\nexport class SourceError extends Error {\n readonly reason: string;\n readonly file: string | undefined;\n readonly loc: SourceLocation | undefined;\n\n constructor(reason: string, file?: string, location?: SourceLocation) {\n super(locatedMessage(reason, file, location));\n this.reason = reason;\n this.file = file;\n this.loc = location;\n }\n}\n","type Listener = (...args: never[]) => void;\n\nexport class EventEmitter<Events extends { [K in keyof Events]: Listener }> {\n readonly #listeners = new Map<keyof Events, Set<Listener>>();\n\n on<K extends keyof Events>(name: K, listener: Events[K]): () => void {\n const listeners = this.#listeners.get(name) ?? new Set();\n this.#listeners.set(name, listeners);\n listeners.add(listener);\n return () => listeners.delete(listener);\n }\n\n emit<K extends keyof Events>(name: K, ...args: Parameters<Events[K]>): void {\n const listeners = this.#listeners.get(name) as Set<Events[K]> | undefined;\n listeners?.forEach((listener) => listener(...args));\n }\n}\n","// `data` holds the `data-*` attributes of the component that raised the event: `data-account-id`\n// arrives as `data.accountId`.\nexport interface DotEvent<Detail = unknown, Data = Readonly<Record<string, unknown>>> {\n readonly type: string;\n readonly detail: Detail;\n readonly data: Data;\n}\n\nexport function createEvent<Detail = Record<string, never>>(\n type: string,\n detail: Detail = {} as Detail,\n data: Readonly<Record<string, unknown>> = {},\n): DotEvent<Detail> {\n return { type, detail, data };\n}\n","import type { Transport } from '../protocol/transport';\n\ndeclare global {\n // Installed by the host (the iOS or Android app, or the browser simulator) before Dot starts.\n // noinspection ES6ConvertVarToLetConst\n var __hostTransport: Transport | undefined;\n}\n\n// The transport the host installed. Messages crossing it must be JSON-serializable.\nexport function hostTransport(): Transport {\n const transport = globalThis.__hostTransport;\n if (!transport) {\n throw new Error(\n 'No Dot host found: `globalThis.__hostTransport` is not set. ' +\n 'Run the dot in the Dash app, or in the simulator with `dotctl dev`.',\n );\n }\n return transport;\n}\n","import type { ColorScheme } from '../theme/theme';\n\n// `background` while the person is away from Dash, such as in another app or with the phone locked.\nexport type AppState = 'active' | 'background';\n\nexport interface SystemContext {\n readonly scheme: ColorScheme;\n readonly appState: AppState;\n}\n\nexport const DEFAULT_SYSTEM_CONTEXT: SystemContext = {\n scheme: 'light',\n appState: 'active',\n};\n","export type HostErrorCode =\n 'unsupported' | 'denied' | 'cancelled' | 'timeout' | 'invalid' | 'failed';\n\nexport class HostError extends Error {\n override readonly name = 'HostError';\n readonly code: HostErrorCode;\n\n constructor(code: HostErrorCode, message: string) {\n super(message);\n this.code = code;\n }\n}\n\nexport interface HostCallOptions {\n timeout?: number | undefined;\n}\n\nexport interface HostRequest<T> extends Promise<T> {\n // Stops waiting. The promise rejects with `cancelled` and the host stops the work.\n cancel(): void;\n}\n\nexport type HostCaller = (\n method: string,\n params: unknown,\n options: HostCallOptions,\n) => HostRequest<unknown>;\n\nlet connectedCaller: HostCaller | null = null;\n\n// The service connects itself when it starts\nexport function connectHost(caller: HostCaller | null): void {\n connectedCaller = caller;\n}\n\nexport function callHost<Result>(\n method: string,\n params: unknown,\n options: HostCallOptions = {},\n): HostRequest<Result> {\n if (!connectedCaller) {\n const error = new HostError(\n 'unsupported',\n `Can't run \"${method}\" here: call Dash from the dot's logic`,\n );\n return createHostRequest(Promise.reject(error));\n }\n return connectedCaller(method, params, options) as HostRequest<Result>;\n}\n\nexport function createHostRequest<Result>(\n promise: Promise<Result>,\n cancel: () => void = () => {},\n): HostRequest<Result> {\n const request = promise as HostRequest<Result>;\n request.cancel = cancel;\n return request;\n}\n","// Declared in dot.json with a reason Dash shows the person. A host method that needs one runs only\n// once it's allowed. `account` gives the person's Dash username (email or phone) and full name.\nexport const PERMISSIONS = ['account'] as const;\n\nexport type DotPermission = (typeof PERMISSIONS)[number];\n\nexport function isPermission(value: string): value is DotPermission {\n return (PERMISSIONS as readonly string[]).includes(value);\n}\n","export const DOT_FILE_PATH_MAX_LENGTH = 512;\nconst MAX_NAME_LENGTH = 255;\n\n// What's wrong with `path` as a path inside a dot's storage, or null if nothing is.\nexport function dotFilePathProblem(path: string, { allowRoot = false } = {}): string | null {\n if (path === '') {\n return allowRoot ? null : 'A path is needed, such as \"receipts/42.pdf\"';\n }\n if (path.length > DOT_FILE_PATH_MAX_LENGTH) {\n return `\"${path.slice(0, 40)}…\" is longer than ${DOT_FILE_PATH_MAX_LENGTH} characters`;\n }\n if (path.startsWith('/')) {\n return `\"${path}\" starts with \"/\". Start paths without it, such as \"receipts/42.pdf\"`;\n }\n if ([...path].some((char) => char === '\\\\' || char.charCodeAt(0) < 0x20)) {\n return `\"${path}\" has a backslash or another character paths can't use`;\n }\n for (const name of path.split('/')) {\n if (name === '' || name === '.' || name === '..') {\n return `\"${path}\" has an empty, \".\" or \"..\" part. Name each folder, such as \"receipts/42.pdf\"`;\n }\n if (name.length > MAX_NAME_LENGTH) {\n return `\"${path}\" has a name longer than ${MAX_NAME_LENGTH} characters`;\n }\n }\n return null;\n}\n","// An exact host name, or \"*.example.com\" for any subdomain of example.com, but not example.com.\nconst LABEL = '[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?';\nexport const NETWORK_HOST_PATTERN = new RegExp(\n `^(?:\\\\*\\\\.${LABEL}(?:\\\\.${LABEL})+|${LABEL}(?:\\\\.${LABEL})*)$`,\n);\nexport const NETWORK_HOST_MAX_LENGTH = 253;\n\nexport function isNetworkHost(value: string): boolean {\n return value.length <= NETWORK_HOST_MAX_LENGTH && NETWORK_HOST_PATTERN.test(value);\n}\n\nexport function allowsHost(hosts: readonly string[], host: string): boolean {\n const name = host.toLowerCase().replace(/\\.$/, '');\n return hosts.some((pattern) =>\n pattern.startsWith('*.') ? name.endsWith(pattern.slice(1)) : name === pattern,\n );\n}\n","// A semantic version, as https://semver.org defines it: `1.4.0`, `2.0.0-beta.1`, `1.0.0+build.7`.\nexport const SEMVER_PATTERN =\n /^(0|[1-9]\\d*)\\.(0|[1-9]\\d*)\\.(0|[1-9]\\d*)(?:-((?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\\.(?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\\+([0-9a-zA-Z-]+(?:\\.[0-9a-zA-Z-]+)*))?$/;\n\ninterface SemanticVersion {\n readonly major: number;\n readonly minor: number;\n readonly patch: number;\n // `[\"beta\", \"1\"]` for `1.0.0-beta.1`; empty for a release.\n readonly prerelease: readonly string[];\n}\n\nexport function isSemanticVersion(value: unknown): value is string {\n return typeof value === 'string' && SEMVER_PATTERN.test(value);\n}\n\nexport function majorVersion(version: string): number {\n return parseVersion(version).major;\n}\n\nexport function isVersionAtLeast(version: string, minimum: string): boolean {\n return compareVersions(version, minimum) >= 0;\n}\n\n// Whether `version` is a newer major release than `current`. A newer minor or patch doesn't count.\nexport function isNewerMajor(version: string, current: string): boolean {\n return parseVersion(version).major > parseVersion(current).major;\n}\n\n// Negative when `left` comes before `right`, positive when after, and 0 for the same release.\n// Build metadata, the part after `+`, does not count.\nexport function compareVersions(left: string, right: string): number {\n const leftVersion = parseVersion(left);\n const rightVersion = parseVersion(right);\n const differences = [\n leftVersion.major - rightVersion.major,\n leftVersion.minor - rightVersion.minor,\n leftVersion.patch - rightVersion.patch,\n ];\n for (const difference of differences) {\n if (difference !== 0) {\n return difference;\n }\n }\n return comparePrereleases(leftVersion.prerelease, rightVersion.prerelease);\n}\n\nfunction parseVersion(version: string): SemanticVersion {\n const match = SEMVER_PATTERN.exec(version);\n if (!match) {\n throw new Error(`\"${version}\" is not a semantic version`);\n }\n const [, major, minor, patch, prerelease] = match;\n return {\n major: Number(major),\n minor: Number(minor),\n patch: Number(patch),\n prerelease: prerelease === undefined ? [] : prerelease.split('.'),\n };\n}\n\n// A release comes after its pre-releases (`1.0.0-beta` < `1.0.0`). Between pre-releases, the first\n// identifier that differs decides; if all match, the one with fewer identifiers comes first.\nfunction comparePrereleases(left: readonly string[], right: readonly string[]): number {\n if (left.length === 0 || right.length === 0) {\n return right.length - left.length;\n }\n const shared = Math.min(left.length, right.length);\n for (let index = 0; index < shared; index++) {\n const order = compareIdentifiers(left[index]!, right[index]!);\n if (order !== 0) {\n return order;\n }\n }\n return left.length - right.length;\n}\n\n// Numbers compare as numbers and come before words, which compare as text.\nfunction compareIdentifiers(left: string, right: string): number {\n const leftIsNumber = /^\\d+$/.test(left);\n const rightIsNumber = /^\\d+$/.test(right);\n if (leftIsNumber && rightIsNumber) {\n return Number(left) - Number(right);\n }\n if (leftIsNumber) {\n return -1;\n }\n if (rightIsNumber) {\n return 1;\n }\n if (left < right) {\n return -1;\n }\n if (left > right) {\n return 1;\n }\n return 0;\n}\n","import { compareVersions, isVersionAtLeast, majorVersion } from '../version/semantic-version';\n\n// The host ships React, not each dot. An import map in the dot's index.html points React's names at\n// the host's copies under `/__dot/react/<major>/`.\nexport const REACT_HOST_PATH = '/__dot/react/';\n\n// Each name a dot imports React by, and the host's file for it.\nexport const REACT_HOST_MODULES = {\n react: 'react.js',\n 'react/jsx-runtime': 'react-jsx-runtime.js',\n 'react-dom': 'react-dom.js',\n 'react-dom/client': 'react-dom-client.js',\n} as const;\n\n// By major version only. The host serves its newest React of that major, so it can update React\n// without dots being rebuilt.\nexport function reactHostUrl(dotReactVersion: string, file: string): string {\n return `${REACT_HOST_PATH}${majorVersion(dotReactVersion)}/${file}`;\n}\n\n// Releases within a major only add to React, so a dot runs on its own major at or above the version\n// it was built with. Another major may change or remove what the dot relies on.\nexport function isReactCompatible(hostVersion: string, dotVersion: string): boolean {\n return (\n majorVersion(hostVersion) === majorVersion(dotVersion) &&\n isVersionAtLeast(hostVersion, dotVersion)\n );\n}\n\nexport function newestReactOfMajor(versions: readonly string[], major: number): string | undefined {\n const matching = versions.filter((version) => majorVersion(version) === major);\n return matching.sort(compareVersions).at(-1);\n}\n","// Carries messages across a worker, a message port or a native app boundary.\nexport interface Transport {\n post(message: unknown): void;\n // Returns a function that removes the listener.\n listen(listener: (message: unknown) => void): () => void;\n}\n\n// Anything that acts like a MessagePort or a Worker.\nexport interface TransportAdapter {\n postMessage(message: unknown): void;\n addEventListener(type: 'message', listener: (event: { data: unknown }) => void): void;\n removeEventListener(type: 'message', listener: (event: { data: unknown }) => void): void;\n}\n\nexport function createAdaptorTransport(adapter: TransportAdapter): Transport {\n return {\n post: (message) => adapter.postMessage(message),\n listen(listener) {\n const onMessage = (event: { data: unknown }) => listener(event.data);\n adapter.addEventListener('message', onMessage);\n return () => adapter.removeEventListener('message', onMessage);\n },\n };\n}\n\n// Two transports connected to each other in the same thread, for tests and single-thread setups.\nexport function createTransportPair(): [Transport, Transport] {\n type Listeners = Set<(message: unknown) => void>;\n const firstListeners: Listeners = new Set();\n const secondListeners: Listeners = new Set();\n const createSide = (ownListeners: Listeners, otherListeners: Listeners): Transport => ({\n post: (message) => {\n // Copy the message, as crossing to another thread would\n const copy: unknown = JSON.parse(JSON.stringify(message));\n otherListeners.forEach((listener) => listener(copy));\n },\n listen(listener) {\n ownListeners.add(listener);\n return () => ownListeners.delete(listener);\n },\n });\n return [createSide(firstListeners, secondListeners), createSide(secondListeners, firstListeners)];\n}\n","import type { PageLaunchOptions } from './navigation';\n\nexport interface PageHooks {\n onLoad(options: PageLaunchOptions): void | Promise<void>;\n onShow(): void | Promise<void>;\n onHide(): void | Promise<void>;\n onUnload(): void | Promise<void>;\n}\n\nexport interface DotHooks {\n onLaunch(): void | Promise<void>;\n onError(error: Error): void;\n}\n\n// A record rather than a list, so adding a hook to PageHooks without listing it is a type error.\nconst pageHooks: Record<keyof PageHooks, true> = {\n onLoad: true,\n onShow: true,\n onHide: true,\n onUnload: true,\n};\n\nexport const PAGE_HOOKS = Object.keys(pageHooks) as readonly (keyof PageHooks)[];\n","export const MAX_STACK_DEPTH = 8;\n\nconst PAGE_ID = /^[A-Za-z0-9_-]+(?:\\/[A-Za-z0-9_-]+)*$/;\n\nexport function isPageId(value: string): boolean {\n return PAGE_ID.test(value);\n}\n\nexport type PageLaunchOptions = Readonly<Record<string, string>>;\n\nexport type Navigation =\n | {\n readonly action: 'push' | 'replace' | 'reset';\n readonly page: string;\n readonly options: PageLaunchOptions;\n }\n | { readonly action: 'back'; readonly delta: number };\n\nexport interface StackEntry {\n readonly instanceId: number;\n readonly page: string;\n readonly options: PageLaunchOptions;\n}\n\nexport class NavigationStack {\n readonly limit: number;\n #pages: StackEntry[] = [];\n #nextInstanceId = 1;\n\n constructor(limit = MAX_STACK_DEPTH) {\n this.limit = limit;\n }\n\n get pages(): readonly StackEntry[] {\n return this.#pages;\n }\n\n get top(): StackEntry | undefined {\n return this.#pages.at(-1);\n }\n\n // False for a push onto a full stack, or for going back from the first page, which the host\n // handles.\n apply(navigation: Navigation): boolean {\n switch (navigation.action) {\n case 'push':\n if (this.#pages.length >= this.limit) {\n return false;\n }\n break;\n case 'replace':\n this.#pages.pop();\n break;\n case 'reset':\n this.#pages = [];\n break;\n case 'back': {\n const count = Math.min(navigation.delta, this.#pages.length - 1);\n if (count < 1) {\n return false;\n }\n this.#pages = this.#pages.slice(0, -count);\n return true;\n }\n }\n const { page, options } = navigation;\n this.#pages = [...this.#pages, { instanceId: this.#nextInstanceId++, page, options }];\n return true;\n }\n}\n","export function applyChanges<T>(state: T, changes: Partial<T>): T {\n const next = { ...state } as Record<string, unknown>;\n for (const [key, value] of Object.entries(changes)) {\n if (value !== undefined) {\n next[key] = value;\n }\n }\n return next as T;\n}\n","// Set in defineDot, definePage or while a page runs. Dash restores its own bars when the page\n// closes, and its own value for any option set to undefined.\nexport interface NavigationBarOptions {\n // Shown in place of the dot's name.\n title?: string | undefined;\n hidden?: boolean | undefined;\n // As #RRGGBB.\n backgroundColor?: string | undefined;\n textColor?: string | undefined;\n}\n\nexport interface TabBarOptions {\n // Hides Dash's own tabs at the bottom of the screen.\n hidden?: boolean | undefined;\n}\n\n// The `configs` of defineDot and definePage.\nexport interface PageConfigs {\n navigationBar?: NavigationBarOptions | undefined;\n tabBar?: TabBarOptions | undefined;\n}\n\nexport interface PageBars {\n navigationBar: NavigationBarOptions;\n tabBar: TabBarOptions;\n}\n\nconst HEX_COLOR = /^#[0-9a-fA-F]{6}$/;\n\n// Throws when an option has the wrong type, or a color isn't #RRGGBB.\nexport function checkNavigationBar(options: NavigationBarOptions): void {\n const { title, hidden, backgroundColor, textColor } = options;\n if (title !== undefined && typeof title !== 'string') {\n throw new TypeError(\"The navigation bar's title must be text\");\n }\n if (hidden !== undefined && typeof hidden !== 'boolean') {\n throw new TypeError(\"The navigation bar's `hidden` must be true or false\");\n }\n for (const [name, color] of Object.entries({ backgroundColor, textColor })) {\n if (color !== undefined && (typeof color !== 'string' || !HEX_COLOR.test(color))) {\n throw new TypeError(`The navigation bar's ${name} must be a color such as \"#1A73E8\"`);\n }\n }\n}\n\nexport function checkTabBar(options: TabBarOptions): void {\n if (options.hidden !== undefined && typeof options.hidden !== 'boolean') {\n throw new TypeError(\"The tab bar's `hidden` must be true or false\");\n }\n}\n\nexport function checkConfigs(configs: PageConfigs): void {\n checkNavigationBar(configs.navigationBar ?? {});\n checkTabBar(configs.tabBar ?? {});\n}\n\n// Later configs override earlier ones, option by option.\nexport function mergeConfigs(...configs: (PageConfigs | undefined)[]): PageBars {\n const bars: PageBars = { navigationBar: {}, tabBar: {} };\n for (const config of configs) {\n bars.navigationBar = { ...bars.navigationBar, ...config?.navigationBar };\n bars.tabBar = { ...bars.tabBar, ...config?.tabBar };\n }\n return bars;\n}\n","import type { Transport } from './protocol/transport';\nimport type { Envelope, MessageMap, MessageType } from './protocol/core';\n\nexport type MessageHandler<Payload> = (payload: Payload) => void;\n\nexport class MessageChannel<Outgoing extends MessageMap, Incoming extends MessageMap> {\n readonly #transport: Transport;\n readonly #handlers = new Map<string, MessageHandler<never>>();\n\n constructor(transport: Transport) {\n this.#transport = transport;\n }\n\n send<T extends MessageType<Outgoing>>(type: T, payload: Outgoing[T]): void {\n this.#transport.post({ type, payload } satisfies Envelope);\n }\n\n handle<T extends MessageType<Incoming>>(\n type: T,\n handler: MessageHandler<Incoming[T]>,\n ): MessageHandler<Incoming[T]> | undefined {\n const previous = this.#handlers.get(type) as MessageHandler<Incoming[T]> | undefined;\n this.#handlers.set(type, handler);\n return previous;\n }\n\n listen(onError: (error: unknown, message: Envelope) => void): () => void {\n return this.#transport.listen((rawMessage) => {\n const message = rawMessage as Envelope;\n const handler = this.#handlers.get(message.type) as MessageHandler<unknown> | undefined;\n if (!handler) {\n onError(new Error(`No handler for message \"${message.type}\"`), message);\n return;\n }\n try {\n handler(message.payload);\n } catch (error) {\n onError(error, message);\n }\n });\n }\n}\n"],"mappings":";AA6CA,SAAgB,gBAKd,UAOmD;CACnD,OAAO;EAAE,OAAO,CAAC;EAAY,QAAQ,CAAC;EAAG,GAAG;CAAS;AACvD;AAIA,SAAgB,UAAgC,OAAgC;CAC9E,OAAO,KAAK,MAAM,OAAO,CAAC,CAAC,CAAC,YAAY,IAAI,MAAM,MAAM,CAAC;AAC3D;AAGA,SAAgB,YAAY,MAAuB;CACjD,MAAM,gBAAgB,KAAK,OAAO,CAAW;CAC7C,OAAO,KAAK,WAAW,IAAI,KAAK,iBAAiB,OAAO,iBAAiB;AAC3E;AAGA,SAAgB,UAAU,MAAsB;CAC9C,MAAM,OAAO,KAAK,MAAM,CAAW;CACnC,OAAO,KAAK,OAAO,CAAC,CAAC,CAAC,YAAY,IAAI,KAAK,MAAM,CAAC;AACpD;AAYA,SAAgB,kBAAkB,WAA2D;CAC3F,MAAM,WAA8C,CAAC;CACrD,KAAK,MAAM,YAAY,WAAW;EAChC,IAAI,SAAS,QAAQ,UAC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.ts","../src/view/components/amount-input.ts","../src/view/components/button.ts","../src/view/components/options.ts","../src/view/components/carousel.ts","../src/view/components/chip.ts","../src/view/components/code-input.ts","../src/view/components/detail-row.ts","../src/view/components/divider.ts","../src/view/components/empty-state.ts","../src/view/components/feedback.ts","../src/view/components/footer.ts","../src/view/components/grid.ts","../src/view/components/icon.ts","../src/view/components/image.ts","../src/view/components/slider.ts","../src/view/components/prose.ts","../src/view/components/input.ts","../src/view/components/link.ts","../src/view/components/list.ts","../src/view/components/overlays.ts","../src/view/components/qr-code.ts","../src/view/components/select.ts","../src/view/components/scroll.ts","../src/view/components/skeleton.ts","../src/view/components/tabs.ts","../src/view/components/text.ts","../src/view/components/text-area.ts","../src/view/components/toggles.ts","../src/view/components/view.ts","../src/view/components/index.ts","../src/source/location.ts","../src/source/error.ts","../src/event/emitter.ts","../src/event/core.ts","../src/host/host.ts","../src/host/context.ts","../src/host/calls.ts","../src/host/permissions.ts","../src/host/files.ts","../src/host/network.ts","../src/version/semantic-version.ts","../src/host/react.ts","../src/protocol/transport.ts","../src/page/lifecycle.ts","../src/page/navigation.ts","../src/page/state.ts","../src/page/bars.ts","../src/messageChannel.ts"],"sourcesContent":["import type { DotEvent } from '../event/core';\n\nexport interface PropTypes {\n string: string;\n number: number;\n boolean: boolean;\n any: unknown;\n}\n\n// One of `words`, or else a number, such as a width of 120 or \"fill\", or a colour the dot named in\n// its theme, such as \"surface\" or \"gold\".\nexport interface WordsOr {\n readonly words: readonly string[];\n readonly or: 'number' | 'themeColor';\n}\n\nexport type PropType = keyof PropTypes | readonly string[] | WordsOr;\n\nexport type PropValue<T extends PropType> = T extends readonly string[]\n ? T[number]\n : T extends WordsOr\n ? T['words'][number] | (T['or'] extends 'number' ? number : string)\n : T extends keyof PropTypes\n ? PropTypes[T]\n : never;\n\nexport function isWordsOr(type: PropType): type is WordsOr {\n return typeof type === 'object' && !Array.isArray(type);\n}\n\n// What `type` takes besides its words, for messages about it.\nexport function otherThanWords(type: WordsOr): string {\n return type.or === 'number' ? 'a number' : \"a colour from the theme's custom colours\";\n}\n\n// `text` holds text and inline components such as `Text`. `elements` holds components, and any\n// loose text in it is wrapped in an inline one.\nexport type ChildrenType = 'none' | 'text' | 'elements';\n\n// A component apart from any renderer. The compiler checks markup against it, and each renderer\n// maps it to its own elements.\nexport interface ComponentManifest<\n Name extends string = string,\n Props extends Record<string, PropType> = Record<string, PropType>,\n Events extends string = string,\n Children extends ChildrenType = ChildrenType,\n> {\n readonly name: Name;\n readonly props: Props;\n // Event names. `click` is written `onClick` in markup and arrives as the `onClick` prop.\n readonly events: readonly Events[];\n readonly children: Children;\n readonly inline?: boolean;\n // Props that make another prop pointless. The compiler warns when markup sets both.\n readonly overrides?: readonly PropOverride[];\n}\n\nexport interface PropOverride {\n prop: string;\n ignores: string;\n because: string;\n}\n\nexport function defineComponent<\n const Name extends string,\n const Props extends Record<string, PropType> = Record<never, PropType>,\n const Events extends string = never,\n const Children extends ChildrenType = ChildrenType,\n>(manifest: {\n name: Name;\n props?: Props;\n events?: readonly Events[];\n children: Children;\n inline?: boolean;\n overrides?: readonly PropOverride[];\n}): ComponentManifest<Name, Props, Events, Children> {\n return { props: {} as Props, events: [], ...manifest };\n}\n\nexport type EventProp<Event extends string> = `on${Capitalize<Event>}`;\n\nexport function eventProp<Event extends string>(event: Event): EventProp<Event> {\n return `on${event.charAt(0).toUpperCase()}${event.slice(1)}` as EventProp<Event>;\n}\n\n// Event props are `on` followed by a capital letter, like `onClick`.\nexport function isEventProp(name: string): boolean {\n const letterAfterOn = name.charAt('on'.length);\n return name.startsWith('on') && letterAfterOn >= 'A' && letterAfterOn <= 'Z';\n}\n\n// The reverse of eventProp: `onClick` -> `click`.\nexport function eventName(prop: string): string {\n const name = prop.slice('on'.length);\n return name.charAt(0).toLowerCase() + name.slice(1);\n}\n\n// The props a renderer's version of `M` receives. Any prop may be undefined, since markup can leave\n// it out and a binding can give undefined.\nexport type PropsOf<M extends ComponentManifest, Children = never> = {\n [K in keyof M['props']]?: PropValue<M['props'][K]> | undefined;\n} & {\n [E in M['events'][number] as EventProp<E>]?: ((event: DotEvent) => void) | undefined;\n} & (M['children'] extends 'none' ? unknown : { children?: Children | undefined });\n\nexport type ComponentRegistry = Readonly<Record<string, ComponentManifest>>;\n\nexport function componentRegistry(manifests: Iterable<ComponentManifest>): ComponentRegistry {\n const registry: Record<string, ComponentManifest> = {};\n for (const manifest of manifests) {\n if (manifest.name in registry) {\n throw new Error(`Component <${manifest.name}> is defined twice`);\n }\n registry[manifest.name] = manifest;\n }\n return registry;\n}\n","export function toText(value: unknown): string {\n switch (typeof value) {\n case 'string':\n return value;\n case 'number':\n case 'boolean':\n case 'bigint':\n return String(value);\n case 'object':\n return value === null ? '' : JSON.stringify(value);\n default:\n return '';\n }\n}\n\nexport function toList(value: unknown): readonly unknown[] {\n if (Array.isArray(value)) {\n return value;\n }\n if (typeof value === 'object' && value !== null && Symbol.iterator in value) {\n return Array.from(value as Iterable<unknown>);\n }\n return [];\n}\n","import { defineComponent } from '../component';\n\n// A sum of money in large type, with thousands separators. Once typed, it shows the minor units, so\n// 1 reads 1.00. `value` and the value `change` carries are in `unit`. `change` carries null when\n// the field is empty.\nexport const AmountInput = defineComponent({\n name: 'AmountInput',\n props: {\n value: 'number',\n // The ISO 4217 code shown before the amount. Defaults to SLE.\n currency: 'string',\n // Digits after the decimal point. Defaults to the currency's own, such as 2 for SLE cents.\n minorUnits: 'number',\n // `minor` (the default) counts minor units, so 150 is SLE 1.50. `major` is the amount itself,\n // so 1 is SLE 1.00.\n unit: ['minor', 'major'],\n label: 'string',\n placeholder: 'string',\n hint: 'string',\n error: 'string',\n disabled: 'boolean',\n },\n events: ['change'],\n children: 'none',\n});\n","import { defineComponent } from '../component';\n\nexport const Button = defineComponent({\n name: 'Button',\n props: {\n variant: ['primary', 'secondary'],\n disabled: 'boolean',\n // Shows a spinner and ignores taps, such as while a payment is sent.\n loading: 'boolean',\n },\n events: ['click'],\n children: 'text',\n});\n","export const SIZES = ['small', 'medium', 'large'] as const;\n\n// Space between or around components.\nexport const SPACES = ['none', 'small', 'medium', 'large'] as const;\n\n// Space inside a component's edges, for all sides or one at a time, in place of the component's\n// own. `start` and `end` follow the reading direction, so they swap in right-to-left languages.\nexport const PADDING_PROPS = {\n padding: SPACES,\n paddingTop: SPACES,\n paddingStart: SPACES,\n paddingEnd: SPACES,\n paddingBottom: SPACES,\n} as const;\n\n// The shape of a picture's or a video's box.\nexport const ASPECTS = ['1:1', '4:3', '3:2', '16:9', '3:4', '2:3', '9:16'] as const;\n\nexport const TONES = ['default', 'muted', 'info', 'success', 'warning', 'danger'] as const;\n\n// A text's colour. `onPrimary` reads on a `primary` background. A dot's own colours come from its theme.\nexport const TEXT_TONES = { words: [...TONES, 'onPrimary'], or: 'themeColor' } as const;\n\n// A box's fill: a colour of the theme, a tone as a soft tint, or one of the dot's own colours.\nexport const BACKGROUNDS = {\n words: ['background', 'surface', 'primary', 'muted', 'info', 'success', 'warning', 'danger'],\n or: 'themeColor',\n} as const;\n\n// A box's outline. `subtle` is the hairline cards have.\nexport const BORDERS = ['none', 'subtle', 'strong'] as const;\n\n// A box's corners, scaled by the theme's shape. `full` makes pills and circles.\nexport const RADII = ['none', 'small', 'medium', 'large', 'full'] as const;\n\n// A box's width or height in points, or `fill` for all the parent gives it.\nexport const LENGTH = { words: ['fill'], or: 'number' } as const;\n\n// How a box looks and how much room it takes: on View, and in part on Stack.\nexport const BOX_PROPS = {\n background: BACKGROUNDS,\n border: BORDERS,\n radius: RADII,\n width: LENGTH,\n height: LENGTH,\n minHeight: 'number',\n maxWidth: 'number',\n // The box's shape, which sets its height from its width.\n aspect: ASPECTS,\n} as const;\n\nexport const STATUS_TONES = ['default', 'info', 'success', 'warning', 'danger'] as const;\n\nexport const ICON_NAMES = [\n 'arrow-down',\n 'arrow-left',\n 'arrow-right',\n 'arrow-up',\n 'bank',\n 'bell',\n 'bolt',\n 'calendar',\n 'card',\n 'cart',\n 'cash',\n 'check',\n 'chevron-down',\n 'chevron-left',\n 'chevron-right',\n 'chevron-up',\n 'clock',\n 'close',\n 'copy',\n 'download',\n 'edit',\n 'error',\n 'external-link',\n 'eye',\n 'eye-off',\n 'file',\n 'gift',\n 'globe',\n 'grid',\n 'headphones',\n 'heart',\n 'help',\n 'history',\n 'home',\n 'image',\n 'info',\n 'link',\n 'list',\n 'location',\n 'lock',\n 'logout',\n 'mail',\n 'microphone',\n 'minus',\n 'mobile',\n 'more',\n 'music',\n 'phone',\n 'playlist',\n 'plus',\n 'qr-code',\n 'receipt',\n 'refresh',\n 'search',\n 'send',\n 'settings',\n 'share',\n 'star',\n 'success',\n 'ticket',\n 'trash',\n 'upload',\n 'user',\n 'users',\n 'video',\n 'wallet',\n 'warning',\n 'water',\n 'wifi',\n] as const;\n\nexport type IconName = (typeof ICON_NAMES)[number];\n","import { defineComponent } from '../component';\nimport { PADDING_PROPS, SPACES } from './options';\n\n// Shows its children one at a time, as slides to swipe between. `change` carries the `index` of\n// the slide it moved to.\nexport const Carousel = defineComponent({\n name: 'Carousel',\n props: {\n // Moves to the next slide every `interval` milliseconds, pausing while touched.\n autoplay: 'boolean',\n interval: 'number',\n // After the last slide comes the first again.\n loop: 'boolean',\n indicator: ['dots', 'none'],\n // Space between slides, seen while one slides in.\n gap: SPACES,\n // `scale` shrinks a slide as it leaves the middle and grows the one coming in, as you swipe.\n effect: ['slide', 'scale'],\n // The slide to show. Changing it moves the carousel there.\n index: 'number',\n ...PADDING_PROPS,\n },\n events: ['change'],\n children: 'elements',\n});\n","import { defineComponent } from '../component';\nimport { ICON_NAMES } from './options';\n\n// A small rounded choice, such as a filter. `selected` fills it in.\nexport const Chip = defineComponent({\n name: 'Chip',\n props: { label: 'string', icon: ICON_NAMES, selected: 'boolean', disabled: 'boolean' },\n events: ['tap'],\n children: 'none',\n});\n","import { defineComponent } from '../component';\n\n// A one-time code or PIN, one box per digit. `complete` comes after the `change` that fills the\n// last box.\nexport const CodeInput = defineComponent({\n name: 'CodeInput',\n props: {\n value: 'string',\n // Number of digits. Defaults to 6.\n length: 'number',\n label: 'string',\n hint: 'string',\n error: 'string',\n // Shows dots in place of the digits, as for a PIN.\n secure: 'boolean',\n disabled: 'boolean',\n },\n events: ['change', 'complete'],\n children: 'none',\n});\n","import { defineComponent } from '../component';\nimport { PADDING_PROPS, TONES } from './options';\n\n// A label and its value on one line, such as a line of a receipt. A long value wraps onto more\n// lines and stays at the end.\nexport const DetailRow = defineComponent({\n name: 'DetailRow',\n props: {\n label: 'string',\n value: 'string',\n // The value's tone and weight. The label is always muted.\n tone: TONES,\n weight: ['regular', 'medium', 'bold'],\n ...PADDING_PROPS,\n },\n children: 'none',\n});\n","import { defineComponent } from '../component';\n\nexport const Divider = defineComponent({\n name: 'Divider',\n children: 'none',\n});\n","import { defineComponent } from '../component';\nimport { ICON_NAMES, PADDING_PROPS } from './options';\n\n// Shown where there's nothing yet, such as an empty list. Its children, such as a button, show\n// under its text.\nexport const EmptyState = defineComponent({\n name: 'EmptyState',\n props: { icon: ICON_NAMES, title: 'string', text: 'string', ...PADDING_PROPS },\n children: 'elements',\n});\n","import { defineComponent } from '../component';\nimport { PADDING_PROPS, SIZES, STATUS_TONES } from './options';\n\nexport const Spinner = defineComponent({\n name: 'Spinner',\n props: { size: SIZES },\n children: 'none',\n});\n\nexport const ProgressBar = defineComponent({\n name: 'ProgressBar',\n // From 0 to 100.\n props: { value: 'number' },\n children: 'none',\n});\n\n// A message in the flow of the page, such as a failed payment's reason.\nexport const Notice = defineComponent({\n name: 'Notice',\n props: { tone: STATUS_TONES, title: 'string', ...PADDING_PROPS },\n children: 'text',\n});\n\nexport const Badge = defineComponent({\n name: 'Badge',\n props: { tone: STATUS_TONES },\n children: 'text',\n});\n","import { defineComponent } from '../component';\nimport { PADDING_PROPS } from './options';\n\n// Holds the page's main action and stays at the bottom while the page scrolls. Put it last in the\n// page's root View.\nexport const Footer = defineComponent({\n name: 'Footer',\n props: PADDING_PROPS,\n children: 'elements',\n});\n","import { defineComponent } from '../component';\nimport { ICON_NAMES, PADDING_PROPS, SPACES } from './options';\n\n// Lays out its children in equal columns. `columns` defaults to 4.\nexport const Grid = defineComponent({\n name: 'Grid',\n props: { columns: 'number', gap: SPACES, ...PADDING_PROPS },\n children: 'elements',\n});\n\n// An icon or picture over a short label, such as a service on a home screen.\nexport const GridItem = defineComponent({\n name: 'GridItem',\n props: {\n label: 'string',\n icon: ICON_NAMES,\n image: 'string',\n // A short note on the item's corner, such as \"New\" or a count.\n badge: 'string',\n },\n events: ['tap'],\n children: 'none',\n});\n","import { defineComponent } from '../component';\nimport { ICON_NAMES, SIZES, TONES } from './options';\n\nexport const Icon = defineComponent({\n name: 'Icon',\n props: { name: ICON_NAMES, size: SIZES, tone: TONES },\n children: 'none',\n inline: true,\n});\n","import { defineComponent } from '../component';\nimport { ASPECTS } from './options';\n\nexport const Image = defineComponent({\n name: 'Image',\n props: {\n src: 'string',\n alt: 'string',\n width: 'number',\n height: 'number',\n // `cover` fills the box and crops. `contain` shows the whole picture.\n fit: ['cover', 'contain'],\n shape: ['rounded', 'square', 'circle'],\n // The box's shape. Without a width, the picture fills the width it's given, such as the\n // screen's, and its height follows.\n aspect: ASPECTS,\n },\n events: ['load', 'error'],\n children: 'none',\n overrides: [{ prop: 'aspect', ignores: 'height', because: 'the aspect sets the height' }],\n});\n","import { defineComponent } from '../component';\n\n// A number chosen by dragging, from `min` to `max` (0 and 100 unless set) in steps of `step` (1).\n// `showValue` shows the number next to the label.\nexport const Slider = defineComponent({\n name: 'Slider',\n props: {\n value: 'number',\n min: 'number',\n max: 'number',\n step: 'number',\n showValue: 'boolean',\n label: 'string',\n hint: 'string',\n disabled: 'boolean',\n },\n events: ['change'],\n children: 'none',\n});\n","import { defineComponent } from '../component';\nimport { PADDING_PROPS } from './options';\n\n// Lays out long text to read, such as a news article: paragraphs a little apart, more room above\n// headings, the lines of its body text further apart, and no wider than reads comfortably.\nexport const Prose = defineComponent({\n name: 'Prose',\n props: { ...PADDING_PROPS },\n children: 'elements',\n});\n\n// Someone's words, set apart with a line at their side. `cite` says who said them.\nexport const Quote = defineComponent({\n name: 'Quote',\n props: { cite: 'string' },\n children: 'elements',\n});\n\n// A list of points, with a dot before each, or numbered when `ordered`. Each point is a Bullet.\nexport const BulletList = defineComponent({\n name: 'BulletList',\n props: { ordered: 'boolean' },\n children: 'elements',\n});\n\nexport const Bullet = defineComponent({\n name: 'Bullet',\n children: 'elements',\n});\n\n// Markdown from a server, such as an article's body, drawn as Prose: headings, paragraphs, bold,\n// italic, links, lists, quotes, pictures and lines between parts. Raw HTML in it shows as text.\nexport const RichText = defineComponent({\n name: 'RichText',\n props: { markdown: 'string' },\n children: 'none',\n});\n","import { defineComponent } from '../component';\n\nexport const Input = defineComponent({\n name: 'Input',\n props: {\n value: 'string',\n placeholder: 'string',\n label: 'string',\n // Help shown under the field, which `error` replaces.\n hint: 'string',\n error: 'string',\n // Text shown inside the field, before and after what the person types, such as \"Le\".\n prefix: 'string',\n suffix: 'string',\n type: ['text', 'number', 'email', 'phone', 'password'],\n maxLength: 'number',\n disabled: 'boolean',\n },\n events: ['change', 'submit'],\n children: 'none',\n});\n","import { defineComponent } from '../component';\nimport { TONES } from './options';\n\n// Text to tap, inside a Text or on its own. With an https `href`, Dash opens it in the device's\n// browser. Without one, it raises `tap` for the page.\nexport const Link = defineComponent({\n name: 'Link',\n props: {\n href: 'string',\n // The primary color unless a tone sets another.\n tone: TONES,\n },\n events: ['tap'],\n children: 'text',\n inline: true,\n});\n","import { defineComponent } from '../component';\nimport { ICON_NAMES, PADDING_PROPS } from './options';\n\n// `endReached` comes when the last row scrolls into view, such as to load more rows. It comes again\n// once a new last row does.\nexport const List = defineComponent({\n name: 'List',\n props: { size: ['sm', 'md'], ...PADDING_PROPS },\n events: ['endReached'],\n children: 'elements',\n});\n\n// Its children show at its end, in place of `value`. A row with `onTap` shows a chevron.\nexport const ListItem = defineComponent({\n name: 'ListItem',\n props: {\n title: 'string',\n subtitle: 'string',\n value: 'string',\n icon: ICON_NAMES,\n image: 'string',\n ...PADDING_PROPS,\n },\n events: ['tap'],\n children: 'elements',\n});\n","import { defineComponent } from '../component';\nimport { PADDING_PROPS, STATUS_TONES } from './options';\n\n// A panel that slides up over the page while `open` is true, such as an action sheet of buttons.\n// Tapping outside it raises `close`. The page closes it by setting `open` back to false.\nexport const Sheet = defineComponent({\n name: 'Sheet',\n props: { open: 'boolean', title: 'string', showCloseIcon: 'boolean', ...PADDING_PROPS },\n events: ['close'],\n children: 'elements',\n});\n\n// Shows `message` briefly over the page, then raises `hide`. Clear the message there so the same\n// one can show again.\nexport const Toast = defineComponent({\n name: 'Toast',\n props: {\n message: 'string',\n tone: STATUS_TONES,\n // In milliseconds.\n duration: 'number',\n },\n events: ['hide'],\n children: 'none',\n});\n","import { defineComponent } from '../component';\n\n// Shows `value` as a QR code. It's dark on light in every theme, so any camera can read it.\nexport const QRCode = defineComponent({\n name: 'QRCode',\n props: {\n value: 'string',\n // In pixels. Defaults to 200.\n size: 'number',\n // What screen readers say in place of the code.\n label: 'string',\n },\n children: 'none',\n});\n","import { defineComponent } from '../component';\n\n// A field that opens a sheet of its `Option`s. `value` is the chosen option's value.\nexport const Select = defineComponent({\n name: 'Select',\n props: {\n value: 'string',\n label: 'string',\n placeholder: 'string',\n hint: 'string',\n error: 'string',\n disabled: 'boolean',\n },\n events: ['change'],\n children: 'elements',\n});\n\nexport const Option = defineComponent({\n name: 'Option',\n props: { value: 'string', label: 'string' },\n children: 'none',\n});\n","import { defineComponent } from '../component';\nimport { PADDING_PROPS, SPACES } from './options';\n\n// A row of children that scrolls sideways, such as a shelf of albums. Each child keeps its own\n// width. A View child is as wide as its widest fixed-width child, such as an Image with a width.\n// Once a scroll stops, `change` carries the `index` of the child at the start.\nexport const Scroll = defineComponent({\n name: 'Scroll',\n props: {\n gap: SPACES,\n // Where children come to rest after a swipe.\n snap: ['none', 'start', 'center'],\n // The child to scroll to. Changing it scrolls there.\n index: 'number',\n // paddingStart and paddingEnd are the space before the first child and after the last.\n ...PADDING_PROPS,\n },\n events: ['change'],\n children: 'elements',\n});\n","import { defineComponent } from '../component';\n\nexport const Skeleton = defineComponent({\n name: 'Skeleton',\n props: {\n shape: ['text', 'circle', 'box'],\n // Lines of text, for `text`.\n lines: 'number',\n // In pixels, for `circle` and `box`.\n height: 'number',\n },\n children: 'none',\n});\n","import { defineComponent } from '../component';\nimport { PADDING_PROPS } from './options';\n\n// A row of `Tab`s with one chosen. `value` is the chosen tab's value. The page shows the content\n// for it, such as with an <If> for each tab.\nexport const Tabs = defineComponent({\n name: 'Tabs',\n props: {\n value: 'string',\n // `underline` marks the chosen tab with a line. `segmented` fills it in, in a rounded track.\n variant: ['underline', 'segmented'],\n ...PADDING_PROPS,\n },\n events: ['change'],\n children: 'elements',\n});\n\nexport const Tab = defineComponent({\n name: 'Tab',\n props: {\n value: 'string',\n label: 'string',\n // A count shown next to the label, such as unread items.\n badge: 'number',\n },\n children: 'none',\n});\n","import { defineComponent } from '../component';\nimport { PADDING_PROPS, TEXT_TONES } from './options';\n\nexport const Text = defineComponent({\n name: 'Text',\n props: {\n // `display` is for large amounts, such as a balance. `lead` is an article's opening paragraph.\n variant: ['display', 'title', 'subtitle', 'lead', 'body', 'caption'],\n tone: TEXT_TONES,\n weight: ['regular', 'medium', 'bold'],\n align: ['start', 'center', 'end'],\n // Cuts the text off with an ellipsis after this many lines.\n maxLines: 'number',\n // `strikethrough` shows a price that no longer applies.\n decoration: ['none', 'underline', 'strikethrough'],\n // Gives every digit the same width, so amounts line up in a list.\n numeric: 'boolean',\n // The space between lines, closer or wider than the variant's own.\n leading: ['tight', 'normal', 'relaxed'],\n italic: 'boolean',\n // Lets the person select the text and copy it, such as a passage of an article.\n selectable: 'boolean',\n ...PADDING_PROPS,\n },\n children: 'text',\n inline: true,\n});\n","import { defineComponent } from '../component';\n\nexport const TextArea = defineComponent({\n name: 'TextArea',\n props: {\n value: 'string',\n placeholder: 'string',\n label: 'string',\n hint: 'string',\n error: 'string',\n // The lines of text it shows before scrolling.\n rows: 'number',\n maxLength: 'number',\n disabled: 'boolean',\n },\n events: ['change'],\n children: 'none',\n});\n","import { defineComponent } from '../component';\n\nexport const Switch = defineComponent({\n name: 'Switch',\n props: { checked: 'boolean', label: 'string', disabled: 'boolean' },\n events: ['change'],\n children: 'none',\n});\n\nexport const Checkbox = defineComponent({\n name: 'Checkbox',\n props: { checked: 'boolean', label: 'string', disabled: 'boolean' },\n events: ['change'],\n children: 'none',\n});\n\n// A choice of one of its `Radio`s. `value` is the chosen radio's value.\nexport const RadioGroup = defineComponent({\n name: 'RadioGroup',\n props: { value: 'string', label: 'string', disabled: 'boolean' },\n events: ['change'],\n children: 'elements',\n});\n\nexport const Radio = defineComponent({\n name: 'Radio',\n props: { value: 'string', label: 'string', disabled: 'boolean' },\n children: 'none',\n});\n","import { defineComponent } from '../component';\nimport { BOX_PROPS, PADDING_PROPS, SPACES } from './options';\n\nexport const View = defineComponent({\n name: 'View',\n props: {\n gap: SPACES,\n direction: ['column', 'row'],\n // Across `direction`.\n align: ['stretch', 'start', 'center', 'end'],\n // Along `direction`. `between` puts the first and last child at the ends.\n justify: ['start', 'center', 'end', 'between'],\n // Lets children that don't fit flow onto another line.\n wrap: 'boolean',\n // Fills the space the parent has left, along the parent's direction.\n grow: 'boolean',\n ...PADDING_PROPS,\n // `card` is a surface with a hairline and rounded corners. The box props change any of those.\n variant: ['plain', 'card'],\n ...BOX_PROPS,\n },\n events: ['tap'],\n children: 'elements',\n overrides: [{ prop: 'aspect', ignores: 'height', because: 'the aspect sets the height' }],\n});\n\n// Lays its children on top of each other, the first at the bottom, such as text over a picture or a\n// badge on a corner. Each child fills the stack, and places its own content, such as with `justify`.\nexport const Stack = defineComponent({\n name: 'Stack',\n props: {\n radius: BOX_PROPS.radius,\n width: BOX_PROPS.width,\n height: BOX_PROPS.height,\n aspect: BOX_PROPS.aspect,\n },\n children: 'elements',\n overrides: [{ prop: 'aspect', ignores: 'height', because: 'the aspect sets the height' }],\n});\n","import { componentRegistry } from '../component';\nimport { AmountInput } from './amount-input';\nimport { Button } from './button';\nimport { Carousel } from './carousel';\nimport { Chip } from './chip';\nimport { CodeInput } from './code-input';\nimport { DetailRow } from './detail-row';\nimport { Divider } from './divider';\nimport { EmptyState } from './empty-state';\nimport { Badge, Notice, ProgressBar, Spinner } from './feedback';\nimport { Footer } from './footer';\nimport { Grid, GridItem } from './grid';\nimport { Icon } from './icon';\nimport { Image } from './image';\nimport { Slider } from './slider';\nimport { Bullet, BulletList, Prose, Quote, RichText } from './prose';\nimport { Input } from './input';\nimport { Link } from './link';\nimport { List, ListItem } from './list';\nimport { Sheet, Toast } from './overlays';\nimport { QRCode } from './qr-code';\nimport { Option, Select } from './select';\nimport { Scroll } from './scroll';\nimport { Skeleton } from './skeleton';\nimport { Tab, Tabs } from './tabs';\nimport { Text } from './text';\nimport { TextArea } from './text-area';\nimport { Checkbox, Radio, RadioGroup, Switch } from './toggles';\nimport { Stack, View } from './view';\n\nexport {\n AmountInput,\n Badge,\n Bullet,\n BulletList,\n Button,\n Carousel,\n Checkbox,\n Chip,\n CodeInput,\n DetailRow,\n Divider,\n EmptyState,\n Footer,\n Grid,\n GridItem,\n Icon,\n Image,\n Input,\n Link,\n List,\n ListItem,\n Notice,\n Option,\n ProgressBar,\n Prose,\n QRCode,\n Quote,\n Radio,\n RadioGroup,\n RichText,\n Scroll,\n Select,\n Sheet,\n Skeleton,\n Slider,\n Spinner,\n Stack,\n Switch,\n Tab,\n Tabs,\n Text,\n TextArea,\n Toast,\n View,\n};\nexport {\n ASPECTS,\n BACKGROUNDS,\n BORDERS,\n BOX_PROPS,\n ICON_NAMES,\n LENGTH,\n PADDING_PROPS,\n RADII,\n SIZES,\n SPACES,\n STATUS_TONES,\n TEXT_TONES,\n TONES,\n} from './options';\nexport type { IconName } from './options';\n\nexport const builtinComponents = {\n AmountInput,\n Badge,\n Bullet,\n BulletList,\n Button,\n Carousel,\n Checkbox,\n Chip,\n CodeInput,\n DetailRow,\n Divider,\n EmptyState,\n Footer,\n Grid,\n GridItem,\n Icon,\n Image,\n Input,\n Link,\n List,\n ListItem,\n Notice,\n Option,\n ProgressBar,\n Prose,\n QRCode,\n Quote,\n Radio,\n RadioGroup,\n RichText,\n Scroll,\n Select,\n Sheet,\n Skeleton,\n Slider,\n Spinner,\n Stack,\n Switch,\n Tab,\n Tabs,\n Text,\n TextArea,\n Toast,\n View,\n} as const;\n\nexport type BuiltinComponents = typeof builtinComponents;\n\nexport const builtinRegistry = componentRegistry(Object.values(builtinComponents));\n","export interface SourceLocation {\n readonly line: number;\n readonly column: number;\n readonly offset: number;\n}\n\n// Finds lines by binary search over their start offsets, computed once per source.\nexport function createLocator(source: string): (offset: number) => SourceLocation {\n const lineStarts = [0];\n for (let index = 0; index < source.length; index++) {\n if (source[index] === '\\n') {\n lineStarts.push(index + 1);\n }\n }\n return (offset) => {\n let low = 0;\n let high = lineStarts.length - 1;\n while (low < high) {\n const middle = Math.floor((low + high + 1) / 2);\n if (lineStarts[middle]! <= offset) {\n low = middle;\n } else {\n high = middle - 1;\n }\n }\n return { line: low + 1, column: offset - lineStarts[low]! + 1, offset };\n };\n}\n\nexport function locationAt(source: string, offset: number): SourceLocation {\n return createLocator(source)(offset);\n}\n\nexport function locatedMessage(message: string, file?: string, location?: SourceLocation): string {\n const where = [file, location?.line, location?.column]\n .filter((part) => part !== undefined)\n .join(':');\n return where ? `${where}: ${message}` : message;\n}\n","import type { SourceLocation } from './location';\nimport { locatedMessage } from './location';\n\n// A problem at a place in a source file. The message starts with `file:line:column:`\nexport class SourceError extends Error {\n readonly reason: string;\n readonly file: string | undefined;\n readonly loc: SourceLocation | undefined;\n\n constructor(reason: string, file?: string, location?: SourceLocation) {\n super(locatedMessage(reason, file, location));\n this.reason = reason;\n this.file = file;\n this.loc = location;\n }\n}\n","type Listener = (...args: never[]) => void;\n\nexport class EventEmitter<Events extends { [K in keyof Events]: Listener }> {\n readonly #listeners = new Map<keyof Events, Set<Listener>>();\n\n on<K extends keyof Events>(name: K, listener: Events[K]): () => void {\n const listeners = this.#listeners.get(name) ?? new Set();\n this.#listeners.set(name, listeners);\n listeners.add(listener);\n return () => listeners.delete(listener);\n }\n\n emit<K extends keyof Events>(name: K, ...args: Parameters<Events[K]>): void {\n const listeners = this.#listeners.get(name) as Set<Events[K]> | undefined;\n listeners?.forEach((listener) => listener(...args));\n }\n}\n","// `data` holds the `data-*` attributes of the component that raised the event: `data-account-id`\n// arrives as `data.accountId`.\nexport interface DotEvent<Detail = unknown, Data = Readonly<Record<string, unknown>>> {\n readonly type: string;\n readonly detail: Detail;\n readonly data: Data;\n}\n\nexport function createEvent<Detail = Record<string, never>>(\n type: string,\n detail: Detail = {} as Detail,\n data: Readonly<Record<string, unknown>> = {},\n): DotEvent<Detail> {\n return { type, detail, data };\n}\n","import type { Transport } from '../protocol/transport';\n\ndeclare global {\n // Installed by the host (the iOS or Android app, or the browser simulator) before Dot starts.\n // noinspection ES6ConvertVarToLetConst\n var __hostTransport: Transport | undefined;\n}\n\n// The transport the host installed. Messages crossing it must be JSON-serializable.\nexport function hostTransport(): Transport {\n const transport = globalThis.__hostTransport;\n if (!transport) {\n throw new Error(\n 'No Dot host found: `globalThis.__hostTransport` is not set. ' +\n 'Run the dot in the Dash app, or in the simulator with `dotctl dev`.',\n );\n }\n return transport;\n}\n","import type { ColorScheme } from '../theme/theme';\n\n// `background` while the person is away from Dash, such as in another app or with the phone locked.\nexport type AppState = 'active' | 'background';\n\nexport interface SystemContext {\n readonly scheme: ColorScheme;\n readonly appState: AppState;\n}\n\nexport const DEFAULT_SYSTEM_CONTEXT: SystemContext = {\n scheme: 'light',\n appState: 'active',\n};\n","export type HostErrorCode =\n 'unsupported' | 'denied' | 'cancelled' | 'timeout' | 'invalid' | 'failed';\n\nexport class HostError extends Error {\n override readonly name = 'HostError';\n readonly code: HostErrorCode;\n\n constructor(code: HostErrorCode, message: string) {\n super(message);\n this.code = code;\n }\n}\n\nexport interface HostCallOptions {\n timeout?: number | undefined;\n}\n\nexport interface HostRequest<T> extends Promise<T> {\n // Stops waiting. The promise rejects with `cancelled` and the host stops the work.\n cancel(): void;\n}\n\nexport type HostCaller = (\n method: string,\n params: unknown,\n options: HostCallOptions,\n) => HostRequest<unknown>;\n\nlet connectedCaller: HostCaller | null = null;\n\n// The service connects itself when it starts\nexport function connectHost(caller: HostCaller | null): void {\n connectedCaller = caller;\n}\n\nexport function callHost<Result>(\n method: string,\n params: unknown,\n options: HostCallOptions = {},\n): HostRequest<Result> {\n if (!connectedCaller) {\n const error = new HostError(\n 'unsupported',\n `Can't run \"${method}\" here: call Dash from the dot's logic`,\n );\n return createHostRequest(Promise.reject(error));\n }\n return connectedCaller(method, params, options) as HostRequest<Result>;\n}\n\nexport function createHostRequest<Result>(\n promise: Promise<Result>,\n cancel: () => void = () => {},\n): HostRequest<Result> {\n const request = promise as HostRequest<Result>;\n request.cancel = cancel;\n return request;\n}\n","// Declared in dot.json with a reason Dash shows the person. A host method that needs one runs only\n// once it's allowed. `account` gives the person's Dash username (email or phone) and full name.\n// `camera` lets the person take a photo or scan a code for the dot, `photoLibrary` choose one of\n// their photos, and `files` choose one of their files.\nexport const PERMISSIONS = ['account', 'camera', 'photoLibrary', 'files'] as const;\n\nexport type DotPermission = (typeof PERMISSIONS)[number];\n\nexport function isPermission(value: string): value is DotPermission {\n return (PERMISSIONS as readonly string[]).includes(value);\n}\n","export const DOT_FILE_PATH_MAX_LENGTH = 512;\nconst MAX_NAME_LENGTH = 255;\n\n// What's wrong with `path` as a path inside a dot's storage, or null if nothing is.\nexport function dotFilePathProblem(path: string, { allowRoot = false } = {}): string | null {\n if (path === '') {\n return allowRoot ? null : 'A path is needed, such as \"receipts/42.pdf\"';\n }\n if (path.length > DOT_FILE_PATH_MAX_LENGTH) {\n return `\"${path.slice(0, 40)}…\" is longer than ${DOT_FILE_PATH_MAX_LENGTH} characters`;\n }\n if (path.startsWith('/')) {\n return `\"${path}\" starts with \"/\". Start paths without it, such as \"receipts/42.pdf\"`;\n }\n if ([...path].some((char) => char === '\\\\' || char.charCodeAt(0) < 0x20)) {\n return `\"${path}\" has a backslash or another character paths can't use`;\n }\n for (const name of path.split('/')) {\n if (name === '' || name === '.' || name === '..') {\n return `\"${path}\" has an empty, \".\" or \"..\" part. Name each folder, such as \"receipts/42.pdf\"`;\n }\n if (name.length > MAX_NAME_LENGTH) {\n return `\"${path}\" has a name longer than ${MAX_NAME_LENGTH} characters`;\n }\n }\n return null;\n}\n","// An exact host name, or \"*.example.com\" for any subdomain of example.com, but not example.com.\nconst LABEL = '[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?';\nexport const NETWORK_HOST_PATTERN = new RegExp(\n `^(?:\\\\*\\\\.${LABEL}(?:\\\\.${LABEL})+|${LABEL}(?:\\\\.${LABEL})*)$`,\n);\nexport const NETWORK_HOST_MAX_LENGTH = 253;\n\nexport function isNetworkHost(value: string): boolean {\n return value.length <= NETWORK_HOST_MAX_LENGTH && NETWORK_HOST_PATTERN.test(value);\n}\n\nexport function allowsHost(hosts: readonly string[], host: string): boolean {\n const name = host.toLowerCase().replace(/\\.$/, '');\n return hosts.some((pattern) =>\n pattern.startsWith('*.') ? name.endsWith(pattern.slice(1)) : name === pattern,\n );\n}\n","// A semantic version, as https://semver.org defines it: `1.4.0`, `2.0.0-beta.1`, `1.0.0+build.7`.\nexport const SEMVER_PATTERN =\n /^(0|[1-9]\\d*)\\.(0|[1-9]\\d*)\\.(0|[1-9]\\d*)(?:-((?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\\.(?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\\+([0-9a-zA-Z-]+(?:\\.[0-9a-zA-Z-]+)*))?$/;\n\ninterface SemanticVersion {\n readonly major: number;\n readonly minor: number;\n readonly patch: number;\n // `[\"beta\", \"1\"]` for `1.0.0-beta.1`; empty for a release.\n readonly prerelease: readonly string[];\n}\n\nexport function isSemanticVersion(value: unknown): value is string {\n return typeof value === 'string' && SEMVER_PATTERN.test(value);\n}\n\nexport function majorVersion(version: string): number {\n return parseVersion(version).major;\n}\n\nexport function isVersionAtLeast(version: string, minimum: string): boolean {\n return compareVersions(version, minimum) >= 0;\n}\n\n// Whether `version` is a newer major release than `current`. A newer minor or patch doesn't count.\nexport function isNewerMajor(version: string, current: string): boolean {\n return parseVersion(version).major > parseVersion(current).major;\n}\n\n// Negative when `left` comes before `right`, positive when after, and 0 for the same release.\n// Build metadata, the part after `+`, does not count.\nexport function compareVersions(left: string, right: string): number {\n const leftVersion = parseVersion(left);\n const rightVersion = parseVersion(right);\n const differences = [\n leftVersion.major - rightVersion.major,\n leftVersion.minor - rightVersion.minor,\n leftVersion.patch - rightVersion.patch,\n ];\n for (const difference of differences) {\n if (difference !== 0) {\n return difference;\n }\n }\n return comparePrereleases(leftVersion.prerelease, rightVersion.prerelease);\n}\n\nfunction parseVersion(version: string): SemanticVersion {\n const match = SEMVER_PATTERN.exec(version);\n if (!match) {\n throw new Error(`\"${version}\" is not a semantic version`);\n }\n const [, major, minor, patch, prerelease] = match;\n return {\n major: Number(major),\n minor: Number(minor),\n patch: Number(patch),\n prerelease: prerelease === undefined ? [] : prerelease.split('.'),\n };\n}\n\n// A release comes after its pre-releases (`1.0.0-beta` < `1.0.0`). Between pre-releases, the first\n// identifier that differs decides; if all match, the one with fewer identifiers comes first.\nfunction comparePrereleases(left: readonly string[], right: readonly string[]): number {\n if (left.length === 0 || right.length === 0) {\n return right.length - left.length;\n }\n const shared = Math.min(left.length, right.length);\n for (let index = 0; index < shared; index++) {\n const order = compareIdentifiers(left[index]!, right[index]!);\n if (order !== 0) {\n return order;\n }\n }\n return left.length - right.length;\n}\n\n// Numbers compare as numbers and come before words, which compare as text.\nfunction compareIdentifiers(left: string, right: string): number {\n const leftIsNumber = /^\\d+$/.test(left);\n const rightIsNumber = /^\\d+$/.test(right);\n if (leftIsNumber && rightIsNumber) {\n return Number(left) - Number(right);\n }\n if (leftIsNumber) {\n return -1;\n }\n if (rightIsNumber) {\n return 1;\n }\n if (left < right) {\n return -1;\n }\n if (left > right) {\n return 1;\n }\n return 0;\n}\n","import { compareVersions, isVersionAtLeast, majorVersion } from '../version/semantic-version';\n\n// The host ships React, not each dot. An import map in the dot's index.html points React's names at\n// the host's copies under `/__dot/react/<major>/`.\nexport const REACT_HOST_PATH = '/__dot/react/';\n\n// Each name a dot imports React by, and the host's file for it.\nexport const REACT_HOST_MODULES = {\n react: 'react.js',\n 'react/jsx-runtime': 'react-jsx-runtime.js',\n 'react-dom': 'react-dom.js',\n 'react-dom/client': 'react-dom-client.js',\n} as const;\n\n// By major version only. The host serves its newest React of that major, so it can update React\n// without dots being rebuilt.\nexport function reactHostUrl(dotReactVersion: string, file: string): string {\n return `${REACT_HOST_PATH}${majorVersion(dotReactVersion)}/${file}`;\n}\n\n// Releases within a major only add to React, so a dot runs on its own major at or above the version\n// it was built with. Another major may change or remove what the dot relies on.\nexport function isReactCompatible(hostVersion: string, dotVersion: string): boolean {\n return (\n majorVersion(hostVersion) === majorVersion(dotVersion) &&\n isVersionAtLeast(hostVersion, dotVersion)\n );\n}\n\nexport function newestReactOfMajor(versions: readonly string[], major: number): string | undefined {\n const matching = versions.filter((version) => majorVersion(version) === major);\n return matching.sort(compareVersions).at(-1);\n}\n","// Carries messages across a worker, a message port or a native app boundary.\nexport interface Transport {\n post(message: unknown): void;\n // Returns a function that removes the listener.\n listen(listener: (message: unknown) => void): () => void;\n}\n\n// Anything that acts like a MessagePort or a Worker.\nexport interface TransportAdapter {\n postMessage(message: unknown): void;\n addEventListener(type: 'message', listener: (event: { data: unknown }) => void): void;\n removeEventListener(type: 'message', listener: (event: { data: unknown }) => void): void;\n}\n\nexport function createAdaptorTransport(adapter: TransportAdapter): Transport {\n return {\n post: (message) => adapter.postMessage(message),\n listen(listener) {\n const onMessage = (event: { data: unknown }) => listener(event.data);\n adapter.addEventListener('message', onMessage);\n return () => adapter.removeEventListener('message', onMessage);\n },\n };\n}\n\n// Two transports connected to each other in the same thread, for tests and single-thread setups.\nexport function createTransportPair(): [Transport, Transport] {\n type Listeners = Set<(message: unknown) => void>;\n const firstListeners: Listeners = new Set();\n const secondListeners: Listeners = new Set();\n const createSide = (ownListeners: Listeners, otherListeners: Listeners): Transport => ({\n post: (message) => {\n // Copy the message, as crossing to another thread would\n const copy: unknown = JSON.parse(JSON.stringify(message));\n otherListeners.forEach((listener) => listener(copy));\n },\n listen(listener) {\n ownListeners.add(listener);\n return () => ownListeners.delete(listener);\n },\n });\n return [createSide(firstListeners, secondListeners), createSide(secondListeners, firstListeners)];\n}\n","import type { PageLaunchOptions } from './navigation';\n\nexport interface PageHooks {\n onLoad(options: PageLaunchOptions): void | Promise<void>;\n onShow(): void | Promise<void>;\n onHide(): void | Promise<void>;\n onUnload(): void | Promise<void>;\n}\n\nexport interface DotHooks {\n onLaunch(): void | Promise<void>;\n onError(error: Error): void;\n}\n\n// A record rather than a list, so adding a hook to PageHooks without listing it is a type error.\nconst pageHooks: Record<keyof PageHooks, true> = {\n onLoad: true,\n onShow: true,\n onHide: true,\n onUnload: true,\n};\n\nexport const PAGE_HOOKS = Object.keys(pageHooks) as readonly (keyof PageHooks)[];\n","export const MAX_STACK_DEPTH = 16;\n\nconst PAGE_ID = /^[A-Za-z0-9_-]+(?:\\/[A-Za-z0-9_-]+)*$/;\n\nexport function isPageId(value: string): boolean {\n return PAGE_ID.test(value);\n}\n\nexport type PageLaunchOptions = Readonly<Record<string, string>>;\n\nexport type Navigation =\n | {\n readonly action: 'push' | 'replace' | 'reset';\n readonly page: string;\n readonly options: PageLaunchOptions;\n }\n | { readonly action: 'back'; readonly delta: number };\n\nexport interface StackEntry {\n readonly instanceId: number;\n readonly page: string;\n readonly options: PageLaunchOptions;\n}\n\nexport class NavigationStack {\n readonly limit: number;\n #pages: StackEntry[] = [];\n #nextInstanceId = 1;\n\n constructor(limit = MAX_STACK_DEPTH) {\n this.limit = limit;\n }\n\n get pages(): readonly StackEntry[] {\n return this.#pages;\n }\n\n get top(): StackEntry | undefined {\n return this.#pages.at(-1);\n }\n\n // False for a push onto a full stack, or for going back from the first page, which the host\n // handles.\n apply(navigation: Navigation): boolean {\n switch (navigation.action) {\n case 'push':\n if (this.#pages.length >= this.limit) {\n return false;\n }\n break;\n case 'replace':\n this.#pages.pop();\n break;\n case 'reset':\n this.#pages = [];\n break;\n case 'back': {\n const count = Math.min(navigation.delta, this.#pages.length - 1);\n if (count < 1) {\n return false;\n }\n this.#pages = this.#pages.slice(0, -count);\n return true;\n }\n }\n const { page, options } = navigation;\n this.#pages = [...this.#pages, { instanceId: this.#nextInstanceId++, page, options }];\n return true;\n }\n}\n","export function applyChanges<T>(state: T, changes: Partial<T>): T {\n const next = { ...state } as Record<string, unknown>;\n for (const [key, value] of Object.entries(changes)) {\n if (value !== undefined) {\n next[key] = value;\n }\n }\n return next as T;\n}\n","// Set in defineDot, definePage or while a page runs. Dash restores its own bars when the page\n// closes, and its own value for any option set to undefined.\nexport interface NavigationBarOptions {\n // Shown in place of the dot's name.\n title?: string | undefined;\n hidden?: boolean | undefined;\n // As #RRGGBB.\n backgroundColor?: string | undefined;\n textColor?: string | undefined;\n}\n\nexport interface TabBarOptions {\n // Hides Dash's own tabs at the bottom of the screen.\n hidden?: boolean | undefined;\n}\n\n// The `configs` of defineDot and definePage.\nexport interface PageConfigs {\n navigationBar?: NavigationBarOptions | undefined;\n tabBar?: TabBarOptions | undefined;\n}\n\nexport interface PageBars {\n navigationBar: NavigationBarOptions;\n tabBar: TabBarOptions;\n}\n\nconst HEX_COLOR = /^#[0-9a-fA-F]{6}$/;\n\n// Throws when an option has the wrong type, or a color isn't #RRGGBB.\nexport function checkNavigationBar(options: NavigationBarOptions): void {\n const { title, hidden, backgroundColor, textColor } = options;\n if (title !== undefined && typeof title !== 'string') {\n throw new TypeError(\"The navigation bar's title must be text\");\n }\n if (hidden !== undefined && typeof hidden !== 'boolean') {\n throw new TypeError(\"The navigation bar's `hidden` must be true or false\");\n }\n for (const [name, color] of Object.entries({ backgroundColor, textColor })) {\n if (color !== undefined && (typeof color !== 'string' || !HEX_COLOR.test(color))) {\n throw new TypeError(`The navigation bar's ${name} must be a color such as \"#1A73E8\"`);\n }\n }\n}\n\nexport function checkTabBar(options: TabBarOptions): void {\n if (options.hidden !== undefined && typeof options.hidden !== 'boolean') {\n throw new TypeError(\"The tab bar's `hidden` must be true or false\");\n }\n}\n\nexport function checkConfigs(configs: PageConfigs): void {\n checkNavigationBar(configs.navigationBar ?? {});\n checkTabBar(configs.tabBar ?? {});\n}\n\n// Later configs override earlier ones, option by option.\nexport function mergeConfigs(...configs: (PageConfigs | undefined)[]): PageBars {\n const bars: PageBars = { navigationBar: {}, tabBar: {} };\n for (const config of configs) {\n bars.navigationBar = { ...bars.navigationBar, ...config?.navigationBar };\n bars.tabBar = { ...bars.tabBar, ...config?.tabBar };\n }\n return bars;\n}\n","import type { Transport } from './protocol/transport';\nimport type { Envelope, MessageMap, MessageType } from './protocol/core';\n\nexport type MessageHandler<Payload> = (payload: Payload) => void;\n\nexport class MessageChannel<Outgoing extends MessageMap, Incoming extends MessageMap> {\n readonly #transport: Transport;\n readonly #handlers = new Map<string, MessageHandler<never>>();\n\n constructor(transport: Transport) {\n this.#transport = transport;\n }\n\n send<T extends MessageType<Outgoing>>(type: T, payload: Outgoing[T]): void {\n this.#transport.post({ type, payload } satisfies Envelope);\n }\n\n handle<T extends MessageType<Incoming>>(\n type: T,\n handler: MessageHandler<Incoming[T]>,\n ): MessageHandler<Incoming[T]> | undefined {\n const previous = this.#handlers.get(type) as MessageHandler<Incoming[T]> | undefined;\n this.#handlers.set(type, handler);\n return previous;\n }\n\n listen(onError: (error: unknown, message: Envelope) => void): () => void {\n return this.#transport.listen((rawMessage) => {\n const message = rawMessage as Envelope;\n const handler = this.#handlers.get(message.type) as MessageHandler<unknown> | undefined;\n if (!handler) {\n onError(new Error(`No handler for message \"${message.type}\"`), message);\n return;\n }\n try {\n handler(message.payload);\n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