@monimesl/dot-core 0.1.0-alpha.2 → 0.1.0-alpha.3

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 CHANGED
@@ -1,9 +1,10 @@
1
1
  //#region src/event/core.d.ts
2
- interface DotEvent<Detail = unknown> {
2
+ interface DotEvent<Detail = unknown, Data = Readonly<Record<string, unknown>>> {
3
3
  readonly type: string;
4
4
  readonly detail: Detail;
5
+ readonly data: Data;
5
6
  }
6
- export declare function createEvent<Detail = Record<string, never>>(type: string, detail?: Detail): DotEvent<Detail>;
7
+ export declare function createEvent<Detail = Record<string, never>>(type: string, detail?: Detail, data?: Readonly<Record<string, unknown>>): DotEvent<Detail>;
7
8
  //#endregion
8
9
  //#region src/view/component.d.ts
9
10
  interface PropTypes {
@@ -57,66 +58,299 @@ export declare function componentRegistry(manifests: Iterable<ComponentManifest>
57
58
  export declare const Button: ComponentManifest<"Button", {
58
59
  readonly variant: readonly ["primary", "secondary"];
59
60
  readonly disabled: "boolean";
61
+ readonly loading: "boolean";
60
62
  }, "click", "text">;
61
63
  //#endregion
64
+ //#region src/view/components/divider.d.ts
65
+ export declare const Divider: ComponentManifest<"Divider", Record<never, PropType>, never, "none">;
66
+ //#endregion
67
+ //#region src/view/components/feedback.d.ts
68
+ export declare const Spinner: ComponentManifest<"Spinner", {
69
+ readonly size: readonly ["small", "medium", "large"];
70
+ }, never, "none">;
71
+ export declare const ProgressBar: ComponentManifest<"ProgressBar", {
72
+ readonly value: "number";
73
+ }, never, "none">;
74
+ export declare const Notice: ComponentManifest<"Notice", {
75
+ readonly tone: readonly ["default", "info", "success", "warning", "danger"];
76
+ readonly title: "string";
77
+ }, never, "text">;
78
+ export declare const Badge: ComponentManifest<"Badge", {
79
+ readonly tone: readonly ["default", "info", "success", "warning", "danger"];
80
+ }, never, "text">;
81
+ //#endregion
82
+ //#region src/view/components/footer.d.ts
83
+ export declare const Footer: ComponentManifest<"Footer", Record<never, PropType>, never, "elements">;
84
+ //#endregion
85
+ //#region src/view/components/icon.d.ts
86
+ export declare const Icon: ComponentManifest<"Icon", {
87
+ readonly name: 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", "eye", "eye-off", "file", "gift", "grid", "heart", "help", "history", "home", "image", "info", "list", "location", "lock", "logout", "mail", "minus", "mobile", "more", "phone", "plus", "qr-code", "receipt", "refresh", "search", "send", "settings", "share", "star", "success", "trash", "upload", "user", "users", "wallet", "warning", "water", "wifi"];
88
+ readonly size: readonly ["small", "medium", "large"];
89
+ readonly tone: readonly ["default", "muted", "info", "success", "warning", "danger"];
90
+ }, never, "none">;
91
+ //#endregion
62
92
  //#region src/view/components/image.d.ts
63
93
  export declare const Image: ComponentManifest<"Image", {
64
94
  readonly src: "string";
65
95
  readonly alt: "string";
66
96
  readonly width: "number";
67
97
  readonly height: "number";
68
- }, "load" | "error", "none">;
98
+ readonly fit: readonly ["cover", "contain"];
99
+ readonly shape: readonly ["rounded", "square", "circle"];
100
+ }, "error" | "load", "none">;
69
101
  //#endregion
70
102
  //#region src/view/components/input.d.ts
71
103
  export declare const Input: ComponentManifest<"Input", {
72
104
  readonly value: "string";
73
105
  readonly placeholder: "string";
74
106
  readonly label: "string";
107
+ readonly hint: "string";
108
+ readonly error: "string";
109
+ readonly prefix: "string";
110
+ readonly suffix: "string";
75
111
  readonly type: readonly ["text", "number", "email", "phone", "password"];
76
112
  readonly maxLength: "number";
77
113
  readonly disabled: "boolean";
78
114
  }, "change" | "submit", "none">;
79
115
  //#endregion
116
+ //#region src/view/components/list.d.ts
117
+ export declare const List: ComponentManifest<"List", Record<never, PropType>, never, "elements">;
118
+ export declare const ListItem: ComponentManifest<"ListItem", {
119
+ readonly title: "string";
120
+ readonly subtitle: "string";
121
+ readonly value: "string";
122
+ readonly icon: 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", "eye", "eye-off", "file", "gift", "grid", "heart", "help", "history", "home", "image", "info", "list", "location", "lock", "logout", "mail", "minus", "mobile", "more", "phone", "plus", "qr-code", "receipt", "refresh", "search", "send", "settings", "share", "star", "success", "trash", "upload", "user", "users", "wallet", "warning", "water", "wifi"];
123
+ readonly image: "string";
124
+ }, "tap", "elements">;
125
+ //#endregion
126
+ //#region src/view/components/overlays.d.ts
127
+ export declare const Sheet: ComponentManifest<"Sheet", {
128
+ readonly open: "boolean";
129
+ readonly title: "string";
130
+ }, "close", "elements">;
131
+ export declare const Toast: ComponentManifest<"Toast", {
132
+ readonly message: "string";
133
+ readonly tone: readonly ["default", "info", "success", "warning", "danger"];
134
+ readonly duration: "number";
135
+ }, "hide", "none">;
136
+ //#endregion
137
+ //#region src/view/components/select.d.ts
138
+ export declare const Select: ComponentManifest<"Select", {
139
+ readonly value: "string";
140
+ readonly label: "string";
141
+ readonly placeholder: "string";
142
+ readonly hint: "string";
143
+ readonly error: "string";
144
+ readonly disabled: "boolean";
145
+ }, "change", "elements">;
146
+ export declare const Option: ComponentManifest<"Option", {
147
+ readonly value: "string";
148
+ readonly label: "string";
149
+ }, never, "none">;
150
+ //#endregion
151
+ //#region src/view/components/skeleton.d.ts
152
+ export declare const Skeleton: ComponentManifest<"Skeleton", {
153
+ readonly shape: readonly ["text", "circle", "box"];
154
+ readonly lines: "number";
155
+ readonly height: "number";
156
+ }, never, "none">;
157
+ //#endregion
80
158
  //#region src/view/components/text.d.ts
81
159
  export declare const Text: ComponentManifest<"Text", {
82
160
  readonly variant: readonly ["title", "body", "caption"];
161
+ readonly tone: readonly ["default", "muted", "info", "success", "warning", "danger"];
162
+ readonly weight: readonly ["regular", "medium", "bold"];
163
+ readonly align: readonly ["start", "center", "end"];
164
+ readonly maxLines: "number";
83
165
  }, never, "text">;
84
166
  //#endregion
167
+ //#region src/view/components/text-area.d.ts
168
+ export declare const TextArea: ComponentManifest<"TextArea", {
169
+ readonly value: "string";
170
+ readonly placeholder: "string";
171
+ readonly label: "string";
172
+ readonly hint: "string";
173
+ readonly error: "string";
174
+ readonly rows: "number";
175
+ readonly maxLength: "number";
176
+ readonly disabled: "boolean";
177
+ }, "change", "none">;
178
+ //#endregion
179
+ //#region src/view/components/toggles.d.ts
180
+ export declare const Switch: ComponentManifest<"Switch", {
181
+ readonly checked: "boolean";
182
+ readonly label: "string";
183
+ readonly disabled: "boolean";
184
+ }, "change", "none">;
185
+ export declare const Checkbox: ComponentManifest<"Checkbox", {
186
+ readonly checked: "boolean";
187
+ readonly label: "string";
188
+ readonly disabled: "boolean";
189
+ }, "change", "none">;
190
+ export declare const RadioGroup: ComponentManifest<"RadioGroup", {
191
+ readonly value: "string";
192
+ readonly label: "string";
193
+ readonly disabled: "boolean";
194
+ }, "change", "elements">;
195
+ export declare const Radio: ComponentManifest<"Radio", {
196
+ readonly value: "string";
197
+ readonly label: "string";
198
+ readonly disabled: "boolean";
199
+ }, never, "none">;
200
+ //#endregion
85
201
  //#region src/view/components/view.d.ts
86
202
  export declare const View: ComponentManifest<"View", {
87
- readonly direction: readonly ["column", "row"];
88
203
  readonly gap: readonly ["none", "small", "medium", "large"];
204
+ readonly direction: readonly ["column", "row"];
89
205
  readonly align: readonly ["stretch", "start", "center", "end"];
206
+ readonly justify: readonly ["start", "center", "end", "between"];
207
+ readonly wrap: "boolean";
208
+ readonly grow: "boolean";
209
+ readonly padding: readonly ["none", "small", "medium", "large"];
210
+ readonly paddingTop: readonly ["none", "small", "medium", "large"];
211
+ readonly paddingStart: readonly ["none", "small", "medium", "large"];
212
+ readonly paddingEnd: readonly ["none", "small", "medium", "large"];
213
+ readonly paddingBottom: readonly ["none", "small", "medium", "large"];
90
214
  readonly variant: readonly ["plain", "card"];
91
215
  }, "tap", "elements">;
92
216
  //#endregion
217
+ //#region src/view/components/options.d.ts
218
+ export declare const SIZES: readonly ["small", "medium", "large"];
219
+ export declare const TONES: readonly ["default", "muted", "info", "success", "warning", "danger"];
220
+ export declare const STATUS_TONES: readonly ["default", "info", "success", "warning", "danger"];
221
+ 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", "eye", "eye-off", "file", "gift", "grid", "heart", "help", "history", "home", "image", "info", "list", "location", "lock", "logout", "mail", "minus", "mobile", "more", "phone", "plus", "qr-code", "receipt", "refresh", "search", "send", "settings", "share", "star", "success", "trash", "upload", "user", "users", "wallet", "warning", "water", "wifi"];
222
+ type IconName = (typeof ICON_NAMES)[number];
223
+ //#endregion
93
224
  //#region src/view/components/index.d.ts
94
225
  export declare const builtinComponents: {
226
+ readonly Badge: ComponentManifest<"Badge", {
227
+ readonly tone: readonly ["default", "info", "success", "warning", "danger"];
228
+ }, never, "text">;
95
229
  readonly Button: ComponentManifest<"Button", {
96
230
  readonly variant: readonly ["primary", "secondary"];
97
231
  readonly disabled: "boolean";
232
+ readonly loading: "boolean";
98
233
  }, "click", "text">;
234
+ readonly Checkbox: ComponentManifest<"Checkbox", {
235
+ readonly checked: "boolean";
236
+ readonly label: "string";
237
+ readonly disabled: "boolean";
238
+ }, "change", "none">;
239
+ readonly Divider: ComponentManifest<"Divider", Record<never, PropType>, never, "none">;
240
+ readonly Footer: ComponentManifest<"Footer", Record<never, PropType>, never, "elements">;
241
+ readonly Icon: ComponentManifest<"Icon", {
242
+ readonly name: 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", "eye", "eye-off", "file", "gift", "grid", "heart", "help", "history", "home", "image", "info", "list", "location", "lock", "logout", "mail", "minus", "mobile", "more", "phone", "plus", "qr-code", "receipt", "refresh", "search", "send", "settings", "share", "star", "success", "trash", "upload", "user", "users", "wallet", "warning", "water", "wifi"];
243
+ readonly size: readonly ["small", "medium", "large"];
244
+ readonly tone: readonly ["default", "muted", "info", "success", "warning", "danger"];
245
+ }, never, "none">;
99
246
  readonly Image: ComponentManifest<"Image", {
100
247
  readonly src: "string";
101
248
  readonly alt: "string";
102
249
  readonly width: "number";
103
250
  readonly height: "number";
104
- }, "load" | "error", "none">;
251
+ readonly fit: readonly ["cover", "contain"];
252
+ readonly shape: readonly ["rounded", "square", "circle"];
253
+ }, "error" | "load", "none">;
105
254
  readonly Input: ComponentManifest<"Input", {
106
255
  readonly value: "string";
107
256
  readonly placeholder: "string";
108
257
  readonly label: "string";
258
+ readonly hint: "string";
259
+ readonly error: "string";
260
+ readonly prefix: "string";
261
+ readonly suffix: "string";
109
262
  readonly type: readonly ["text", "number", "email", "phone", "password"];
110
263
  readonly maxLength: "number";
111
264
  readonly disabled: "boolean";
112
265
  }, "change" | "submit", "none">;
266
+ readonly List: ComponentManifest<"List", Record<never, PropType>, never, "elements">;
267
+ readonly ListItem: ComponentManifest<"ListItem", {
268
+ readonly title: "string";
269
+ readonly subtitle: "string";
270
+ readonly value: "string";
271
+ readonly icon: 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", "eye", "eye-off", "file", "gift", "grid", "heart", "help", "history", "home", "image", "info", "list", "location", "lock", "logout", "mail", "minus", "mobile", "more", "phone", "plus", "qr-code", "receipt", "refresh", "search", "send", "settings", "share", "star", "success", "trash", "upload", "user", "users", "wallet", "warning", "water", "wifi"];
272
+ readonly image: "string";
273
+ }, "tap", "elements">;
274
+ readonly Notice: ComponentManifest<"Notice", {
275
+ readonly tone: readonly ["default", "info", "success", "warning", "danger"];
276
+ readonly title: "string";
277
+ }, never, "text">;
278
+ readonly Option: ComponentManifest<"Option", {
279
+ readonly value: "string";
280
+ readonly label: "string";
281
+ }, never, "none">;
282
+ readonly ProgressBar: ComponentManifest<"ProgressBar", {
283
+ readonly value: "number";
284
+ }, never, "none">;
285
+ readonly Radio: ComponentManifest<"Radio", {
286
+ readonly value: "string";
287
+ readonly label: "string";
288
+ readonly disabled: "boolean";
289
+ }, never, "none">;
290
+ readonly RadioGroup: ComponentManifest<"RadioGroup", {
291
+ readonly value: "string";
292
+ readonly label: "string";
293
+ readonly disabled: "boolean";
294
+ }, "change", "elements">;
295
+ readonly Select: ComponentManifest<"Select", {
296
+ readonly value: "string";
297
+ readonly label: "string";
298
+ readonly placeholder: "string";
299
+ readonly hint: "string";
300
+ readonly error: "string";
301
+ readonly disabled: "boolean";
302
+ }, "change", "elements">;
303
+ readonly Sheet: ComponentManifest<"Sheet", {
304
+ readonly open: "boolean";
305
+ readonly title: "string";
306
+ }, "close", "elements">;
307
+ readonly Skeleton: ComponentManifest<"Skeleton", {
308
+ readonly shape: readonly ["text", "circle", "box"];
309
+ readonly lines: "number";
310
+ readonly height: "number";
311
+ }, never, "none">;
312
+ readonly Spinner: ComponentManifest<"Spinner", {
313
+ readonly size: readonly ["small", "medium", "large"];
314
+ }, never, "none">;
315
+ readonly Switch: ComponentManifest<"Switch", {
316
+ readonly checked: "boolean";
317
+ readonly label: "string";
318
+ readonly disabled: "boolean";
319
+ }, "change", "none">;
113
320
  readonly Text: ComponentManifest<"Text", {
114
321
  readonly variant: readonly ["title", "body", "caption"];
322
+ readonly tone: readonly ["default", "muted", "info", "success", "warning", "danger"];
323
+ readonly weight: readonly ["regular", "medium", "bold"];
324
+ readonly align: readonly ["start", "center", "end"];
325
+ readonly maxLines: "number";
115
326
  }, never, "text">;
327
+ readonly TextArea: ComponentManifest<"TextArea", {
328
+ readonly value: "string";
329
+ readonly placeholder: "string";
330
+ readonly label: "string";
331
+ readonly hint: "string";
332
+ readonly error: "string";
333
+ readonly rows: "number";
334
+ readonly maxLength: "number";
335
+ readonly disabled: "boolean";
336
+ }, "change", "none">;
337
+ readonly Toast: ComponentManifest<"Toast", {
338
+ readonly message: "string";
339
+ readonly tone: readonly ["default", "info", "success", "warning", "danger"];
340
+ readonly duration: "number";
341
+ }, "hide", "none">;
116
342
  readonly View: ComponentManifest<"View", {
117
- readonly direction: readonly ["column", "row"];
118
343
  readonly gap: readonly ["none", "small", "medium", "large"];
344
+ readonly direction: readonly ["column", "row"];
119
345
  readonly align: readonly ["stretch", "start", "center", "end"];
346
+ readonly justify: readonly ["start", "center", "end", "between"];
347
+ readonly wrap: "boolean";
348
+ readonly grow: "boolean";
349
+ readonly padding: readonly ["none", "small", "medium", "large"];
350
+ readonly paddingTop: readonly ["none", "small", "medium", "large"];
351
+ readonly paddingStart: readonly ["none", "small", "medium", "large"];
352
+ readonly paddingEnd: readonly ["none", "small", "medium", "large"];
353
+ readonly paddingBottom: readonly ["none", "small", "medium", "large"];
120
354
  readonly variant: readonly ["plain", "card"];
121
355
  }, "tap", "elements">;
122
356
  };
@@ -291,10 +525,11 @@ interface RenderContext<Node> {
291
525
  */
292
526
  readonly h: (type: string, props: Record<string, unknown> | null, ...children: (Node | string)[]) => Node;
293
527
  /**
294
- * Returns a stable event callback that forwards UI events
295
- * to the named handler defined in `controller.ts`.
528
+ * Returns an event callback that forwards UI events to the named handler defined in
529
+ * `controller.ts`, with `data` from the component's `data-*` attributes. Without data, the
530
+ * callback is the same object on every render.
296
531
  */
297
- readonly on: (handler: string) => (event: DotEvent) => void;
532
+ readonly on: (handler: string, data?: Readonly<Record<string, unknown>>) => (event: DotEvent) => void;
298
533
  /**
299
534
  * Converts a bound value to the text to display.
300
535
  */
@@ -308,9 +543,9 @@ interface RenderContext<Node> {
308
543
  }
309
544
  /**
310
545
  * The export of a compiled view file: a pure function of the page state that imports no renderer
311
- * code, so any renderer can run it.
546
+ * code, so any renderer can run it. It returns the page's root element, which is always a `<View>`.
312
547
  */
313
- type ViewRender = <Node>(state: PageState, context: RenderContext<Node>) => Node[];
548
+ type ViewRender = <Node>(state: PageState, context: RenderContext<Node>) => Node;
314
549
  //#endregion
315
550
  //#region src/view/values.d.ts
316
551
  export declare function toText(value: unknown): string;
@@ -379,6 +614,18 @@ export declare const PERMISSIONS: readonly ["account"];
379
614
  type DotPermission = (typeof PERMISSIONS)[number];
380
615
  export declare function isPermission(value: string): value is DotPermission;
381
616
  //#endregion
617
+ //#region src/host/files.d.ts
618
+ export declare const DOT_FILE_PATH_MAX_LENGTH = 512;
619
+ export declare function dotFilePathProblem(path: string, { allowRoot }?: {
620
+ allowRoot?: boolean | undefined;
621
+ }): string | null;
622
+ //#endregion
623
+ //#region src/host/network.d.ts
624
+ export declare const NETWORK_HOST_PATTERN: RegExp;
625
+ export declare const NETWORK_HOST_MAX_LENGTH = 253;
626
+ export declare function isNetworkHost(value: string): boolean;
627
+ export declare function allowsHost(hosts: readonly string[], host: string): boolean;
628
+ //#endregion
382
629
  //#region src/host/react.d.ts
383
630
  export declare const REACT_HOST_PATH = "/__dot/react/";
384
631
  export declare const REACT_HOST_MODULES: {
@@ -423,5 +670,5 @@ export declare class MessageChannel<Outgoing extends MessageMap, Incoming extend
423
670
  listen(onError: (error: unknown, message: Envelope) => void): () => void;
424
671
  }
425
672
  //#endregion
426
- export type { AppState, BuiltinComponents, ChildrenType, ColorScheme, ComponentManifest, ComponentRegistry, DotEvent, DotHooks, DotPermission, Envelope, EventProp, HostCallOptions, HostCaller, HostErrorCode, HostLayerMessages, HostRequest, HostResult, LogicLayerMessages, MessageHandler, MessageMap, MessageType, Navigation, PageHooks, PageLaunchOptions, PageState, PropType, PropTypes, PropValue, PropsOf, RenderContext, SchemeColor, SourceLocation, StackEntry, SystemContext, Theme, ThemeColors, Transport, TransportAdapter, UILayerMessages, ViewRender };
673
+ export type { AppState, BuiltinComponents, ChildrenType, ColorScheme, ComponentManifest, ComponentRegistry, DotEvent, DotHooks, DotPermission, Envelope, EventProp, HostCallOptions, HostCaller, HostErrorCode, HostLayerMessages, HostRequest, HostResult, IconName, LogicLayerMessages, MessageHandler, MessageMap, MessageType, Navigation, PageHooks, PageLaunchOptions, PageState, PropType, PropTypes, PropValue, PropsOf, RenderContext, SchemeColor, SourceLocation, StackEntry, SystemContext, Theme, ThemeColors, Transport, TransportAdapter, UILayerMessages, ViewRender };
427
674
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","names":[],"sources":["../src/event/core.ts","../src/view/component.ts","../src/view/components/button.ts","../src/view/components/image.ts","../src/view/components/input.ts","../src/view/components/text.ts","../src/view/components/view.ts","../src/view/components/index.ts","../src/theme/theme.ts","../src/host/context.ts","../src/host/calls.ts","../src/page/navigation.ts","../src/protocol/core.ts","../src/view/renderer.ts","../src/view/values.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/react.ts","../src/page/lifecycle.ts","../src/page/state.ts","../src/version/semantic-version.ts","../src/messageChannel.ts"],"mappings":";UAAiB,SAAS;WACf;WACA,QAAQ;;wBAGH,YAAY,SAAS,uBACnC,cACA,SAAQ,SACP,SAAS;;;UCNK;EACf;EACA;EACA;EACA;;KAGU,iBAAiB;KAEjB,UAAU,UAAU,YAAY,8BACxC,YACA,gBAAgB,YACd,UAAU;;;;;;KAQJ;;;;;UAMK,kBACf,8BACA,cAAc,eAAe,YAAY,eAAe,WACxD,gCACA,iBAAiB,eAAe;WAEvB,MAAM;WACN,OAAO;WAEP,iBAAiB;WACjB,UAAU;WACV;;wBAGK,sBACR,2BACA,cAAc,eAAe,YAAY,cAAc,iBACvD,qCACA,iBAAiB,eAAe,cACtC;EACA,MAAM;EACN,QAAQ;EACR,kBAAkB;EAClB,UAAU;EACV;IACE,kBAAkB,MAAM,OAAO,QAAQ;KAI/B,UAAU,6BAA6B,WAAW;wBAE9C,UAAU,sBAAsB,OAAO,QAAQ,UAAU;wBAKz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B;KAED,wBAAwB;wBAEpB,aAAa,gBAAgB,SAAS;;;qBCJzC;qBAGA;;;;;wBAQG,aAAa,yBAAyB;wBAMtC,kBAAkB,qBAAqB;wBAQvC,mBAAmB,6BAA6B;;;UC3B/C;EACf,OAAO,SAAS,2BAA2B;EAC3C,iBAAiB;EACjB,iBAAiB;EACjB,mBAAmB;;UAGJ;EACf,mBAAmB;EACnB,QAAQ,OAAO;;qBAWJ,4BAAuD;;;wBCtBpD,aAAa,GAAG,OAAO,GAAG,SAAS,QAAQ,KAAK;;;qBCCnD,gBAAc;wBAWX,kBAAkB,iBAAiB;wBAInC,aAAa;wBAKb,iBAAiB,iBAAiB;wBAMlC,gBAAgB,cAAc;;;KCxBlC,eAAe,YAAY,SAAS;qBAEnC,eAAe,iBAAiB,YAAY,iBAAiB;;EAI5D,YAAA,WAAW;EAIvB,KAAK,UAAU,YAAY,WAAW,MAAM,GAAG,SAAS,SAAS;EAIjE,OAAO,UAAU,YAAY,WAC3B,MAAM,GACN,SAAS,eAAe,SAAS,MAChC,eAAe,SAAS;EAM3B,OAAO,UAAU,gBAAgB,SAAS"}
1
+ {"version":3,"file":"index.d.ts","names":[],"sources":["../src/event/core.ts","../src/view/component.ts","../src/view/components/button.ts","../src/view/components/divider.ts","../src/view/components/feedback.ts","../src/view/components/footer.ts","../src/view/components/icon.ts","../src/view/components/image.ts","../src/view/components/input.ts","../src/view/components/list.ts","../src/view/components/overlays.ts","../src/view/components/select.ts","../src/view/components/skeleton.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/theme/theme.ts","../src/host/context.ts","../src/host/calls.ts","../src/page/navigation.ts","../src/protocol/core.ts","../src/view/renderer.ts","../src/view/values.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/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wBAAwB,WAAW;;;QC/B3C;MAGF,iBAAiB;;wBAIP,iBAAiB;;;qBCLpB;KAED,wBAAwB;wBAEpB,aAAa,gBAAgB,SAAS;;;qBCRzC;wBAIG,mBAAmB,gBAAgB;;;;;qBCFtC,sBAAoB;qBAGpB;wBAEG,cAAc;wBAId,WAAW,0BAA0B;;;qBCPxC;qBAGA;;;;;wBAQG,aAAa,yBAAyB;wBAMtC,kBAAkB,qBAAqB;wBAQvC,mBAAmB,6BAA6B;;;UC3B/C;EACf,OAAO,SAAS,2BAA2B;EAC3C,iBAAiB;EACjB,iBAAiB;EACjB,mBAAmB;;UAGJ;EACf,mBAAmB;EACnB,QAAQ,OAAO;;qBAWJ,4BAAuD;;;wBCtBpD,aAAa,GAAG,OAAO,GAAG,SAAS,QAAQ,KAAK;;;qBCCnD,gBAAc;wBAWX,kBAAkB,iBAAiB;wBAInC,aAAa;wBAKb,iBAAiB,iBAAiB;wBAMlC,gBAAgB,cAAc;;;KCxBlC,eAAe,YAAY,SAAS;qBAEnC,eAAe,iBAAiB,YAAY,iBAAiB;;EAI5D,YAAA,WAAW;EAIvB,KAAK,UAAU,YAAY,WAAW,MAAM,GAAG,SAAS,SAAS;EAIjE,OAAO,UAAU,YAAY,WAC3B,MAAM,GACN,SAAS,eAAe,SAAS,MAChC,eAAe,SAAS;EAM3B,OAAO,UAAU,gBAAgB,SAAS"}
package/dist/index.js CHANGED
@@ -92,12 +92,146 @@ const Button = defineComponent({
92
92
  name: "Button",
93
93
  props: {
94
94
  variant: ["primary", "secondary"],
95
- disabled: "boolean"
95
+ disabled: "boolean",
96
+ loading: "boolean"
96
97
  },
97
98
  events: ["click"],
98
99
  children: "text"
99
100
  });
100
101
  //#endregion
102
+ //#region src/view/components/divider.ts
103
+ const Divider = defineComponent({
104
+ name: "Divider",
105
+ children: "none"
106
+ });
107
+ //#endregion
108
+ //#region src/view/components/options.ts
109
+ const SIZES = [
110
+ "small",
111
+ "medium",
112
+ "large"
113
+ ];
114
+ const TONES = [
115
+ "default",
116
+ "muted",
117
+ "info",
118
+ "success",
119
+ "warning",
120
+ "danger"
121
+ ];
122
+ const STATUS_TONES = [
123
+ "default",
124
+ "info",
125
+ "success",
126
+ "warning",
127
+ "danger"
128
+ ];
129
+ const ICON_NAMES = [
130
+ "arrow-down",
131
+ "arrow-left",
132
+ "arrow-right",
133
+ "arrow-up",
134
+ "bank",
135
+ "bell",
136
+ "bolt",
137
+ "calendar",
138
+ "card",
139
+ "cart",
140
+ "cash",
141
+ "check",
142
+ "chevron-down",
143
+ "chevron-left",
144
+ "chevron-right",
145
+ "chevron-up",
146
+ "clock",
147
+ "close",
148
+ "copy",
149
+ "download",
150
+ "edit",
151
+ "error",
152
+ "eye",
153
+ "eye-off",
154
+ "file",
155
+ "gift",
156
+ "grid",
157
+ "heart",
158
+ "help",
159
+ "history",
160
+ "home",
161
+ "image",
162
+ "info",
163
+ "list",
164
+ "location",
165
+ "lock",
166
+ "logout",
167
+ "mail",
168
+ "minus",
169
+ "mobile",
170
+ "more",
171
+ "phone",
172
+ "plus",
173
+ "qr-code",
174
+ "receipt",
175
+ "refresh",
176
+ "search",
177
+ "send",
178
+ "settings",
179
+ "share",
180
+ "star",
181
+ "success",
182
+ "trash",
183
+ "upload",
184
+ "user",
185
+ "users",
186
+ "wallet",
187
+ "warning",
188
+ "water",
189
+ "wifi"
190
+ ];
191
+ //#endregion
192
+ //#region src/view/components/feedback.ts
193
+ const Spinner = defineComponent({
194
+ name: "Spinner",
195
+ props: { size: SIZES },
196
+ children: "none"
197
+ });
198
+ const ProgressBar = defineComponent({
199
+ name: "ProgressBar",
200
+ props: { value: "number" },
201
+ children: "none"
202
+ });
203
+ const Notice = defineComponent({
204
+ name: "Notice",
205
+ props: {
206
+ tone: STATUS_TONES,
207
+ title: "string"
208
+ },
209
+ children: "text"
210
+ });
211
+ const Badge = defineComponent({
212
+ name: "Badge",
213
+ props: { tone: STATUS_TONES },
214
+ children: "text"
215
+ });
216
+ //#endregion
217
+ //#region src/view/components/footer.ts
218
+ const Footer = defineComponent({
219
+ name: "Footer",
220
+ children: "elements"
221
+ });
222
+ //#endregion
223
+ //#region src/view/components/icon.ts
224
+ const Icon = defineComponent({
225
+ name: "Icon",
226
+ props: {
227
+ name: ICON_NAMES,
228
+ size: SIZES,
229
+ tone: TONES
230
+ },
231
+ children: "none",
232
+ inline: true
233
+ });
234
+ //#endregion
101
235
  //#region src/view/components/image.ts
102
236
  const Image = defineComponent({
103
237
  name: "Image",
@@ -105,7 +239,13 @@ const Image = defineComponent({
105
239
  src: "string",
106
240
  alt: "string",
107
241
  width: "number",
108
- height: "number"
242
+ height: "number",
243
+ fit: ["cover", "contain"],
244
+ shape: [
245
+ "rounded",
246
+ "square",
247
+ "circle"
248
+ ]
109
249
  },
110
250
  events: ["load", "error"],
111
251
  children: "none"
@@ -118,6 +258,10 @@ const Input = defineComponent({
118
258
  value: "string",
119
259
  placeholder: "string",
120
260
  label: "string",
261
+ hint: "string",
262
+ error: "string",
263
+ prefix: "string",
264
+ suffix: "string",
121
265
  type: [
122
266
  "text",
123
267
  "number",
@@ -132,35 +276,198 @@ const Input = defineComponent({
132
276
  children: "none"
133
277
  });
134
278
  //#endregion
279
+ //#region src/view/components/list.ts
280
+ const List = defineComponent({
281
+ name: "List",
282
+ children: "elements"
283
+ });
284
+ const ListItem = defineComponent({
285
+ name: "ListItem",
286
+ props: {
287
+ title: "string",
288
+ subtitle: "string",
289
+ value: "string",
290
+ icon: ICON_NAMES,
291
+ image: "string"
292
+ },
293
+ events: ["tap"],
294
+ children: "elements"
295
+ });
296
+ //#endregion
297
+ //#region src/view/components/overlays.ts
298
+ const Sheet = defineComponent({
299
+ name: "Sheet",
300
+ props: {
301
+ open: "boolean",
302
+ title: "string"
303
+ },
304
+ events: ["close"],
305
+ children: "elements"
306
+ });
307
+ const Toast = defineComponent({
308
+ name: "Toast",
309
+ props: {
310
+ message: "string",
311
+ tone: STATUS_TONES,
312
+ duration: "number"
313
+ },
314
+ events: ["hide"],
315
+ children: "none"
316
+ });
317
+ //#endregion
318
+ //#region src/view/components/select.ts
319
+ const Select = defineComponent({
320
+ name: "Select",
321
+ props: {
322
+ value: "string",
323
+ label: "string",
324
+ placeholder: "string",
325
+ hint: "string",
326
+ error: "string",
327
+ disabled: "boolean"
328
+ },
329
+ events: ["change"],
330
+ children: "elements"
331
+ });
332
+ const Option = defineComponent({
333
+ name: "Option",
334
+ props: {
335
+ value: "string",
336
+ label: "string"
337
+ },
338
+ children: "none"
339
+ });
340
+ //#endregion
341
+ //#region src/view/components/skeleton.ts
342
+ const Skeleton = defineComponent({
343
+ name: "Skeleton",
344
+ props: {
345
+ shape: [
346
+ "text",
347
+ "circle",
348
+ "box"
349
+ ],
350
+ lines: "number",
351
+ height: "number"
352
+ },
353
+ children: "none"
354
+ });
355
+ //#endregion
135
356
  //#region src/view/components/text.ts
136
357
  const Text = defineComponent({
137
358
  name: "Text",
138
- props: { variant: [
139
- "title",
140
- "body",
141
- "caption"
142
- ] },
359
+ props: {
360
+ variant: [
361
+ "title",
362
+ "body",
363
+ "caption"
364
+ ],
365
+ tone: TONES,
366
+ weight: [
367
+ "regular",
368
+ "medium",
369
+ "bold"
370
+ ],
371
+ align: [
372
+ "start",
373
+ "center",
374
+ "end"
375
+ ],
376
+ maxLines: "number"
377
+ },
143
378
  children: "text",
144
379
  inline: true
145
380
  });
146
381
  //#endregion
382
+ //#region src/view/components/text-area.ts
383
+ const TextArea = defineComponent({
384
+ name: "TextArea",
385
+ props: {
386
+ value: "string",
387
+ placeholder: "string",
388
+ label: "string",
389
+ hint: "string",
390
+ error: "string",
391
+ rows: "number",
392
+ maxLength: "number",
393
+ disabled: "boolean"
394
+ },
395
+ events: ["change"],
396
+ children: "none"
397
+ });
398
+ //#endregion
399
+ //#region src/view/components/toggles.ts
400
+ const Switch = defineComponent({
401
+ name: "Switch",
402
+ props: {
403
+ checked: "boolean",
404
+ label: "string",
405
+ disabled: "boolean"
406
+ },
407
+ events: ["change"],
408
+ children: "none"
409
+ });
410
+ const Checkbox = defineComponent({
411
+ name: "Checkbox",
412
+ props: {
413
+ checked: "boolean",
414
+ label: "string",
415
+ disabled: "boolean"
416
+ },
417
+ events: ["change"],
418
+ children: "none"
419
+ });
420
+ const RadioGroup = defineComponent({
421
+ name: "RadioGroup",
422
+ props: {
423
+ value: "string",
424
+ label: "string",
425
+ disabled: "boolean"
426
+ },
427
+ events: ["change"],
428
+ children: "elements"
429
+ });
430
+ const Radio = defineComponent({
431
+ name: "Radio",
432
+ props: {
433
+ value: "string",
434
+ label: "string",
435
+ disabled: "boolean"
436
+ },
437
+ children: "none"
438
+ });
439
+ //#endregion
147
440
  //#region src/view/components/view.ts
441
+ const SPACE = [
442
+ "none",
443
+ "small",
444
+ "medium",
445
+ "large"
446
+ ];
148
447
  const View = defineComponent({
149
448
  name: "View",
150
449
  props: {
450
+ gap: SPACE,
151
451
  direction: ["column", "row"],
152
- gap: [
153
- "none",
154
- "small",
155
- "medium",
156
- "large"
157
- ],
158
452
  align: [
159
453
  "stretch",
160
454
  "start",
161
455
  "center",
162
456
  "end"
163
457
  ],
458
+ justify: [
459
+ "start",
460
+ "center",
461
+ "end",
462
+ "between"
463
+ ],
464
+ wrap: "boolean",
465
+ grow: "boolean",
466
+ padding: SPACE,
467
+ paddingTop: SPACE,
468
+ paddingStart: SPACE,
469
+ paddingEnd: SPACE,
470
+ paddingBottom: SPACE,
164
471
  variant: ["plain", "card"]
165
472
  },
166
473
  events: ["tap"],
@@ -169,10 +476,29 @@ const View = defineComponent({
169
476
  //#endregion
170
477
  //#region src/view/components/index.ts
171
478
  const builtinComponents = {
479
+ Badge,
172
480
  Button,
481
+ Checkbox,
482
+ Divider,
483
+ Footer,
484
+ Icon,
173
485
  Image,
174
486
  Input,
487
+ List,
488
+ ListItem,
489
+ Notice,
490
+ Option,
491
+ ProgressBar,
492
+ Radio,
493
+ RadioGroup,
494
+ Select,
495
+ Sheet,
496
+ Skeleton,
497
+ Spinner,
498
+ Switch,
175
499
  Text,
500
+ TextArea,
501
+ Toast,
176
502
  View
177
503
  };
178
504
  const builtinRegistry = componentRegistry(Object.values(builtinComponents));
@@ -192,10 +518,11 @@ var EventEmitter = class {
192
518
  };
193
519
  //#endregion
194
520
  //#region src/event/core.ts
195
- function createEvent(type, detail = {}) {
521
+ function createEvent(type, detail = {}, data = {}) {
196
522
  return {
197
523
  type,
198
- detail
524
+ detail,
525
+ data
199
526
  };
200
527
  }
201
528
  //#endregion
@@ -244,6 +571,33 @@ function isPermission(value) {
244
571
  return PERMISSIONS.includes(value);
245
572
  }
246
573
  //#endregion
574
+ //#region src/host/files.ts
575
+ const DOT_FILE_PATH_MAX_LENGTH = 512;
576
+ const MAX_NAME_LENGTH = 255;
577
+ function dotFilePathProblem(path, { allowRoot = false } = {}) {
578
+ if (path === "") return allowRoot ? null : "A path is needed, such as \"receipts/42.pdf\"";
579
+ if (path.length > 512) return `"${path.slice(0, 40)}…" is longer than 512 characters`;
580
+ if (path.startsWith("/")) return `"${path}" starts with "/": paths are relative to the dot's storage, such as "receipts/42.pdf"`;
581
+ if ([...path].some((char) => char === "\\" || char.charCodeAt(0) < 32)) return `"${path}" has a backslash or a control character`;
582
+ for (const name of path.split("/")) {
583
+ if (name === "" || name === "." || name === "..") return `"${path}" has an empty, "." or ".." part: write each folder once, such as "receipts/42.pdf"`;
584
+ if (name.length > MAX_NAME_LENGTH) return `"${path}" has a name longer than ${MAX_NAME_LENGTH} characters`;
585
+ }
586
+ return null;
587
+ }
588
+ //#endregion
589
+ //#region src/host/network.ts
590
+ const LABEL = "[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?";
591
+ const NETWORK_HOST_PATTERN = new RegExp(`^(?:\\*\\.${LABEL}(?:\\.${LABEL})+|${LABEL}(?:\\.${LABEL})*)$`);
592
+ const NETWORK_HOST_MAX_LENGTH = 253;
593
+ function isNetworkHost(value) {
594
+ return value.length <= 253 && NETWORK_HOST_PATTERN.test(value);
595
+ }
596
+ function allowsHost(hosts, host) {
597
+ const name = host.toLowerCase().replace(/\.$/, "");
598
+ return hosts.some((pattern) => pattern.startsWith("*.") ? name.endsWith(pattern.slice(1)) : name === pattern);
599
+ }
600
+ //#endregion
247
601
  //#region src/version/semantic-version.ts
248
602
  const SEMVER_PATTERN = /^(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-]+)*))?$/;
249
603
  function isSemanticVersion(value) {
@@ -440,6 +794,6 @@ var MessageChannel = class {
440
794
  }
441
795
  };
442
796
  //#endregion
443
- export { Button, DEFAULT_SYSTEM_CONTEXT, EventEmitter, HostError, Image, Input, MAX_STACK_DEPTH, MessageChannel, NavigationStack, PAGE_HOOKS, PERMISSIONS, REACT_HOST_MODULES, REACT_HOST_PATH, SEMVER_PATTERN, SourceError, Text, View, applyChanges, builtinComponents, builtinRegistry, callHost, compareVersions, componentRegistry, connectHost, createAdaptorTransport, createEvent, createHostRequest, createLocator, createTransportPair, defineComponent, eventName, eventProp, hostTransport, isEventProp, isPageId, isPermission, isReactCompatible, isSemanticVersion, isVersionAtLeast, locatedMessage, locationAt, majorVersion, newestReactOfMajor, reactHostUrl, toList, toText };
797
+ export { Badge, Button, Checkbox, DEFAULT_SYSTEM_CONTEXT, DOT_FILE_PATH_MAX_LENGTH, Divider, EventEmitter, Footer, HostError, ICON_NAMES, Icon, Image, Input, List, ListItem, MAX_STACK_DEPTH, MessageChannel, NETWORK_HOST_MAX_LENGTH, NETWORK_HOST_PATTERN, NavigationStack, Notice, Option, PAGE_HOOKS, PERMISSIONS, ProgressBar, REACT_HOST_MODULES, REACT_HOST_PATH, Radio, RadioGroup, SEMVER_PATTERN, SIZES, STATUS_TONES, Select, Sheet, Skeleton, SourceError, Spinner, Switch, TONES, Text, TextArea, Toast, View, allowsHost, applyChanges, builtinComponents, builtinRegistry, callHost, compareVersions, componentRegistry, connectHost, createAdaptorTransport, createEvent, createHostRequest, createLocator, createTransportPair, defineComponent, dotFilePathProblem, eventName, eventProp, hostTransport, isEventProp, isNetworkHost, isPageId, isPermission, isReactCompatible, isSemanticVersion, isVersionAtLeast, locatedMessage, locationAt, majorVersion, newestReactOfMajor, reactHostUrl, toList, toText };
444
798
 
445
799
  //# 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/source/location.ts","../src/source/error.ts","../src/view/components/button.ts","../src/view/components/image.ts","../src/view/components/input.ts","../src/view/components/text.ts","../src/view/components/view.ts","../src/view/components/index.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/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/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/**\n * - `none`: no children\n * - `text`: text and inline components (such as `Text`).\n * - `elements`: any components, but raw text must be wrapped in an inline component.\n */\nexport type ChildrenType = 'none' | 'text' | 'elements';\n\n/**\n * Describes a UI component independently of any renderer. The compiler checks `.dml` markup\n * against it, and each renderer maps it to its own elements.\n */\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 // Supported event names; `click` is written `onClick` in markup and received as the `onClick` prop.\n readonly events: readonly Events[];\n readonly children: Children;\n readonly inline?: boolean;\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}): 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/**\n * The props a renderer's implementation of `M` receives, with `Children` as its node type. Every\n * prop is optional and may be `undefined`: markup can omit it, and a binding can evaluate to\n * `undefined` at runtime.\n */\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","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","import { defineComponent } from '../component';\n\nexport const Button = defineComponent({\n name: 'Button',\n props: { variant: ['primary', 'secondary'], disabled: 'boolean' },\n events: ['click'],\n children: 'text',\n});\n","import { defineComponent } from '../component';\n\nexport const Image = defineComponent({\n name: 'Image',\n props: { src: 'string', alt: 'string', width: 'number', height: 'number' },\n events: ['load', 'error'],\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 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';\n\nexport const Text = defineComponent({\n name: 'Text',\n props: {\n variant: ['title', 'body', 'caption'],\n },\n children: 'text',\n inline: true,\n});\n","import { defineComponent } from '../component';\n\nexport const View = defineComponent({\n name: 'View',\n props: {\n direction: ['column', 'row'],\n gap: ['none', 'small', 'medium', 'large'],\n align: ['stretch', 'start', 'center', 'end'],\n variant: ['plain', 'card'],\n },\n events: ['tap'],\n children: 'elements',\n});\n","import { componentRegistry } from '../component';\nimport { Button } from './button';\nimport { Image } from './image';\nimport { Input } from './input';\nimport { Text } from './text';\nimport { View } from './view';\n\nexport { Button, Image, Input, Text, View };\n\nexport const builtinComponents = { Button, Image, Input, Text, View } as const;\n\nexport type BuiltinComponents = typeof builtinComponents;\n\nexport const builtinRegistry = componentRegistry(Object.values(builtinComponents));\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","export interface DotEvent<Detail = unknown> {\n readonly type: string;\n readonly detail: Detail;\n}\n\nexport function createEvent<Detail = Record<string, never>>(\n type: string,\n detail: Detail = {} as Detail,\n): DotEvent<Detail> {\n return { type, detail };\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: expected `globalThis.__hostTransport` to be available at runtime. ' +\n 'Dots run inside the Dash App, or a simulator via `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: in another app, on the home screen, or with the\n// 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 = { scheme: 'light', appState: 'active' };\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 `No host to run \"${method}\": host calls run in the service`,\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","// What a dot may ask the person for. A dot declares each one it uses in dot.json, with the reason\n// Dash shows the person; a host method that needs one runs only once the person allows it.\n// - `account`: the Dash account the person is logged into: their username (email or phone) and\n// 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","// 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\n// Whether `version` is `minimum` or a later one.\nexport function isVersionAtLeast(version: string, minimum: string): boolean {\n return compareVersions(version, minimum) >= 0;\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: every dot's webview imports these names, and an import map in\n// its index.html points them at the host's copies under `/__dot/react/<major>/`.\nexport const REACT_HOST_PATH = '/__dot/react/';\n\n// Each name a dot's webview 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/client': 'react-dom-client.js',\n} as const;\n\n// By major version only: the host serves the newest React it has with that major, so it can update\n// React within a major without dots being rebuilt.\nexport function reactHostUrl(dotReactVersion: string, file: string): string {\n return `${REACT_HOST_PATH}${majorVersion(dotReactVersion)}/${file}`;\n}\n\n// A React release only adds to its major version, so a dot runs on the same major at or above the\n// version it was built with. A different major can 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\n// The newest of `versions` with `major`, or undefined when there is none.\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","/**\n * A universal bridge for sending and receiving messages,\n * whether across web workers, message ports, or native app boundaries.\n */\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/**\n * Adapter interface for anything that acts like\n * 1. a MessagePort (https://developer.mozilla.org/en-US/docs/Web/API/MessagePort) or\n * 2. a Web Worker (https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API)\n */\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 // Simulate cross-thread memory isolation by cloning the payload\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 /**\n * Applies a navigation, or refuses it and returns false: a push onto a full stack, or going back\n * from the first page (which the host handles itself, e.g. by closing the dot).\n */\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","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 registered 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":";AA0CA,SAAgB,gBAKd,UAMmD;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,MA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KAAK,QAAQ;GAAE,YAAY,KAAK;GAAmB;GAAM;EAAQ,CAAC;EACpF,OAAO;CACT;AACF;;;ACvEA,SAAgB,aAAgB,OAAU,SAAwB;CAChE,MAAM,OAAO,EAAE,GAAG,MAAM;CACxB,KAAK,MAAM,CAAC,KAAK,UAAU,OAAO,QAAQ,OAAO,GAC/C,IAAI,UAAU,KAAA,GACZ,KAAK,OAAO;CAGhB,OAAO;AACT;;;ACHA,IAAa,iBAAb,MAAsF;CACpF;CACA,4BAAqB,IAAI,IAAmC;CAE5D,YAAY,WAAsB;EAChC,KAAK,aAAa;CACpB;CAEA,KAAsC,MAAS,SAA4B;EACzE,KAAK,WAAW,KAAK;GAAE;GAAM;EAAQ,CAAoB;CAC3D;CAEA,OACE,MACA,SACyC;EACzC,MAAM,WAAW,KAAK,UAAU,IAAI,IAAI;EACxC,KAAK,UAAU,IAAI,MAAM,OAAO;EAChC,OAAO;CACT;CAEA,OAAO,SAAkE;EACvE,OAAO,KAAK,WAAW,QAAQ,eAAe;GAC5C,MAAM,UAAU;GAChB,MAAM,UAAU,KAAK,UAAU,IAAI,QAAQ,IAAI;GAC/C,IAAI,CAAC,SAAS;IACZ,wBAAQ,IAAI,MAAM,sCAAsC,QAAQ,KAAK,EAAE,GAAG,OAAO;IACjF;GACF;GACA,IAAI;IACF,QAAQ,QAAQ,OAAO;GACzB,SAAS,OAAO;IACd,QAAQ,OAAO,OAAO;GACxB;EACF,CAAC;CACH;AACF"}
1
+ {"version":3,"file":"index.js","names":[],"sources":["../src/view/component.ts","../src/view/values.ts","../src/source/location.ts","../src/source/error.ts","../src/view/components/button.ts","../src/view/components/divider.ts","../src/view/components/options.ts","../src/view/components/feedback.ts","../src/view/components/footer.ts","../src/view/components/icon.ts","../src/view/components/image.ts","../src/view/components/input.ts","../src/view/components/list.ts","../src/view/components/overlays.ts","../src/view/components/select.ts","../src/view/components/skeleton.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/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/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/**\n * - `none`: no children\n * - `text`: text and inline components (such as `Text`).\n * - `elements`: any components, but raw text must be wrapped in an inline component.\n */\nexport type ChildrenType = 'none' | 'text' | 'elements';\n\n/**\n * Describes a UI component independently of any renderer. The compiler checks `.dml` markup\n * against it, and each renderer maps it to its own elements.\n */\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 // Supported event names; `click` is written `onClick` in markup and received as the `onClick` prop.\n readonly events: readonly Events[];\n readonly children: Children;\n readonly inline?: boolean;\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}): 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/**\n * The props a renderer's implementation of `M` receives, with `Children` as its node type. Every\n * prop is optional and may be `undefined`: markup can omit it, and a binding can evaluate to\n * `undefined` at runtime.\n */\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","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","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","import { defineComponent } from '../component';\n\nexport const Divider = defineComponent({\n name: 'Divider',\n children: 'none',\n});\n","export const SIZES = ['small', 'medium', 'large'] 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 'eye',\n 'eye-off',\n 'file',\n 'gift',\n 'grid',\n 'heart',\n 'help',\n 'history',\n 'home',\n 'image',\n 'info',\n 'list',\n 'location',\n 'lock',\n 'logout',\n 'mail',\n 'minus',\n 'mobile',\n 'more',\n 'phone',\n 'plus',\n 'qr-code',\n 'receipt',\n 'refresh',\n 'search',\n 'send',\n 'settings',\n 'share',\n 'star',\n 'success',\n 'trash',\n 'upload',\n 'user',\n 'users',\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 { 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' },\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';\n\n// Stays at the bottom of the screen while the page scrolls, for its main action. Put it last in\n// the page's root View.\nexport const Footer = defineComponent({\n name: 'Footer',\n children: 'elements',\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';\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 },\n events: ['load', 'error'],\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 { ICON_NAMES } from './options';\n\nexport const List = defineComponent({\n name: 'List',\n children: 'elements',\n});\n\n// What it holds shows 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 },\n events: ['tap'],\n children: 'elements',\n});\n","import { defineComponent } from '../component';\nimport { 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' },\n events: ['close'],\n children: 'elements',\n});\n\n// Shows `message` briefly over the page, then raises `hide`, where the page clears the message\n// so the same 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// A field that opens a sheet of the `Option`s it holds; `value` is the chosen one's.\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';\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 { 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 },\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 `Radio` among those it holds; `value` is the chosen one's.\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';\n\nconst SPACE = ['none', 'small', 'medium', 'large'] as const;\n\nexport const View = defineComponent({\n name: 'View',\n props: {\n gap: SPACE,\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 // Takes the space its parent has left along the parent's direction.\n grow: 'boolean',\n // Space inside the view's edges. `start` and `end` follow the reading direction, so they\n padding: SPACE,\n paddingTop: SPACE,\n paddingStart: SPACE,\n paddingEnd: SPACE,\n paddingBottom: SPACE,\n variant: ['plain', 'card'],\n },\n events: ['tap'],\n children: 'elements',\n});\n","import { componentRegistry } from '../component';\nimport { Button } from './button';\nimport { Divider } from './divider';\nimport { Badge, Notice, ProgressBar, Spinner } from './feedback';\nimport { Footer } from './footer';\nimport { Icon } from './icon';\nimport { Image } from './image';\nimport { Input } from './input';\nimport { List, ListItem } from './list';\nimport { Sheet, Toast } from './overlays';\nimport { Option, Select } from './select';\nimport { Skeleton } from './skeleton';\nimport { Text } from './text';\nimport { TextArea } from './text-area';\nimport { Checkbox, Radio, RadioGroup, Switch } from './toggles';\nimport { View } from './view';\n\nexport {\n Badge,\n Button,\n Checkbox,\n Divider,\n Footer,\n Icon,\n Image,\n Input,\n List,\n ListItem,\n Notice,\n Option,\n ProgressBar,\n Radio,\n RadioGroup,\n Select,\n Sheet,\n Skeleton,\n Spinner,\n Switch,\n Text,\n TextArea,\n Toast,\n View,\n};\nexport { ICON_NAMES, SIZES, STATUS_TONES, TONES } from './options';\nexport type { IconName } from './options';\n\nexport const builtinComponents = {\n Badge,\n Button,\n Checkbox,\n Divider,\n Footer,\n Icon,\n Image,\n Input,\n List,\n ListItem,\n Notice,\n Option,\n ProgressBar,\n Radio,\n RadioGroup,\n Select,\n Sheet,\n Skeleton,\n Spinner,\n Switch,\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","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: expected `globalThis.__hostTransport` to be available at runtime. ' +\n 'Dots run inside the Dash App, or a simulator via `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: in another app, on the home screen, or with the\n// 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 = { scheme: 'light', appState: 'active' };\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 `No host to run \"${method}\": host calls run in the service`,\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","// What a dot may ask the person for. A dot declares each one it uses in dot.json, with the reason\n// Dash shows the person; a host method that needs one runs only once the person allows it.\n// - `account`: the Dash account the person is logged into: their username (email or phone) and\n// 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// Why `path` isn't a relative path inside a dot's storage, or null when it 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 \"/\": paths are relative to the dot's storage, such as \"receipts/42.pdf\"`;\n }\n if ([...path].some((char) => char === '\\\\' || char.charCodeAt(0) < 0x20)) {\n return `\"${path}\" has a backslash or a control character`;\n }\n for (const name of path.split('/')) {\n if (name === '' || name === '.' || name === '..') {\n return `\"${path}\" has an empty, \".\" or \"..\" part: write each folder once, 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\n// Whether `version` is `minimum` or a later one.\nexport function isVersionAtLeast(version: string, minimum: string): boolean {\n return compareVersions(version, minimum) >= 0;\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: every dot's webview imports these names, and an import map in\n// its index.html points them at the host's copies under `/__dot/react/<major>/`.\nexport const REACT_HOST_PATH = '/__dot/react/';\n\n// Each name a dot's webview 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/client': 'react-dom-client.js',\n} as const;\n\n// By major version only: the host serves the newest React it has with that major, so it can update\n// React within a major without dots being rebuilt.\nexport function reactHostUrl(dotReactVersion: string, file: string): string {\n return `${REACT_HOST_PATH}${majorVersion(dotReactVersion)}/${file}`;\n}\n\n// A React release only adds to its major version, so a dot runs on the same major at or above the\n// version it was built with. A different major can 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\n// The newest of `versions` with `major`, or undefined when there is none.\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","/**\n * A universal bridge for sending and receiving messages,\n * whether across web workers, message ports, or native app boundaries.\n */\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/**\n * Adapter interface for anything that acts like\n * 1. a MessagePort (https://developer.mozilla.org/en-US/docs/Web/API/MessagePort) or\n * 2. a Web Worker (https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API)\n */\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 // Simulate cross-thread memory isolation by cloning the payload\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 /**\n * Applies a navigation, or refuses it and returns false: a push onto a full stack, or going back\n * from the first page (which the host handles itself, e.g. by closing the dot).\n */\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","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 registered 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":";AA0CA,SAAgB,gBAKd,UAMmD;CACnD,OAAO;EAAE,OAAO,CAAC;EAAY,QAAQ,CAAC;EAAG,GAAG;CAAS;AACvD;AAIA,SAAgB,UAAgC,OAAgC;CAC9E,OAAO,KAAK,MAAM,OAAO,CAAC,CAAC,CAAC,Y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B;CAC3D;CAEA,OACE,MACA,SACyC;EACzC,MAAM,WAAW,KAAK,UAAU,IAAI,IAAI;EACxC,KAAK,UAAU,IAAI,MAAM,OAAO;EAChC,OAAO;CACT;CAEA,OAAO,SAAkE;EACvE,OAAO,KAAK,WAAW,QAAQ,eAAe;GAC5C,MAAM,UAAU;GAChB,MAAM,UAAU,KAAK,UAAU,IAAI,QAAQ,IAAI;GAC/C,IAAI,CAAC,SAAS;IACZ,wBAAQ,IAAI,MAAM,sCAAsC,QAAQ,KAAK,EAAE,GAAG,OAAO;IACjF;GACF;GACA,IAAI;IACF,QAAQ,QAAQ,OAAO;GACzB,SAAS,OAAO;IACd,QAAQ,OAAO,OAAO;GACxB;EACF,CAAC;CACH;AACF"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@monimesl/dot-core",
3
- "version": "0.1.0-alpha.2",
3
+ "version": "0.1.0-alpha.3",
4
4
  "description": "Dot contracts shared by every layer: protocol, transports, component manifests, view renderer",
5
5
  "type": "module",
6
6
  "repository": {