@fieldia/core 0.15.0 → 0.16.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -382,6 +382,71 @@ export interface FormNode {
382
382
  /** Every field inside is read-only while this holds. */
383
383
  readonly?: Modifier;
384
384
  }
385
+ /** A line along the roads between a map's layers: from one place to another, or through a layer's lines in their order. */
386
+ export interface MapRoute {
387
+ /** The layer it starts at: a place, or the reader's own. */
388
+ from: string;
389
+ /** The layer it ends at. */
390
+ to?: string;
391
+ /** A layer of lines it goes through, in their order: a delivery round's stops. */
392
+ through?: string;
393
+ /** How it is travelled: by car unless said. */
394
+ mode?: 'car' | 'bike' | 'foot';
395
+ /** The part already travelled fades as `from` moves along it, and the time and distance left are kept up to date. */
396
+ progress?: boolean;
397
+ /** Fields of the record its numbers go into: the seconds and metres left, and its line as GeoJSON. */
398
+ write?: {
399
+ seconds?: string;
400
+ metres?: string;
401
+ line?: string;
402
+ };
403
+ }
404
+ /**
405
+ * One layer of a form's map: the record's own place (`point`, or `latitude`
406
+ * and `longitude`), a place for each of its lines (`lines`, the place in the
407
+ * line's fields), a route between layers, or the reader's own place.
408
+ */
409
+ export interface MapLayer {
410
+ id: string;
411
+ /** What it is, in words: its pins are named by it ("Courier, 4 min"). */
412
+ label?: string;
413
+ point?: string;
414
+ latitude?: string;
415
+ longitude?: string;
416
+ /** A field of lines (one2many): a pin for each line. */
417
+ lines?: string;
418
+ pin?: Pin;
419
+ card?: MapCard;
420
+ /**
421
+ * A place that moves as its fields change: its pin glides there. Without
422
+ * news for `staleAfter` seconds it says when it was last seen; `follow`
423
+ * keeps it in view until the person moves the map.
424
+ */
425
+ live?: {
426
+ staleAfter?: number;
427
+ follow?: boolean;
428
+ };
429
+ route?: MapRoute;
430
+ /** The reader's own place, from the browser once they allow it. */
431
+ myLocation?: boolean;
432
+ invisible?: Modifier;
433
+ }
434
+ /** A map on a form: the record's places, its lines' places, the routes between them, and the reader's own place, as layers. */
435
+ export interface MapNode {
436
+ type: 'map';
437
+ id: string;
438
+ /** Its name, over it and for a screen reader. */
439
+ label?: string;
440
+ layers: MapLayer[];
441
+ /** Height in pixels: 360 unless said. */
442
+ height?: number;
443
+ /** Grid columns it spans inside a section. */
444
+ colspan?: number;
445
+ invisible?: Modifier;
446
+ roles?: Roles;
447
+ /** Hidden at these widths of the form, such as a phone's: `["narrow"]`. */
448
+ hideOn?: ScreenWidth[];
449
+ }
385
450
  /** A named place the app fills with its own content, such as an activity feed. */
386
451
  export interface SlotNode {
387
452
  type: 'slot';
@@ -782,7 +847,7 @@ export interface ListMap {
782
847
  limit?: number;
783
848
  }
784
849
  /** Anything that can sit inside a section, tab, step or sheet. */
785
- export type LayoutNode = FieldNode | ButtonNode | TextNode | SlotNode | SectionNode | TabsNode | DividerNode | SpacerNode | ImageNode | FormNode;
850
+ export type LayoutNode = FieldNode | ButtonNode | TextNode | SlotNode | SectionNode | TabsNode | DividerNode | SpacerNode | ImageNode | FormNode | MapNode;
786
851
  /** What a page's `layout` can be: the four page layouts. */
787
852
  export type RootLayout = SheetNode | SectionsNode | TabsNode | WizardNode | ListNode;
788
853
  export declare const ModifierSchema: z.ZodUnion<readonly [z.ZodBoolean, z.ZodString]>;
@@ -1220,6 +1285,198 @@ export declare const ImageNodeSchema: z.ZodObject<{
1220
1285
  wide: "wide";
1221
1286
  }>>>;
1222
1287
  }, z.core.$strict>;
1288
+ /**
1289
+ * What a pin on a map shows, from its record's fields: a pin, an icon (a
1290
+ * fixed one or one a field names), a round photo, words alone, or a dot; its
1291
+ * words; its colour by condition; its turn, for a car facing its way; or the
1292
+ * app's own widget, which draws it from the record.
1293
+ */
1294
+ export declare const PinSchema: z.ZodObject<{
1295
+ look: z.ZodOptional<z.ZodEnum<{
1296
+ label: "label";
1297
+ pin: "pin";
1298
+ icon: "icon";
1299
+ photo: "photo";
1300
+ dot: "dot";
1301
+ }>>;
1302
+ icon: z.ZodOptional<z.ZodString>;
1303
+ iconField: z.ZodOptional<z.ZodString>;
1304
+ image: z.ZodOptional<z.ZodString>;
1305
+ label: z.ZodOptional<z.ZodString>;
1306
+ tones: z.ZodOptional<z.ZodArray<z.ZodObject<{
1307
+ tone: z.ZodEnum<{
1308
+ success: "success";
1309
+ info: "info";
1310
+ warning: "warning";
1311
+ danger: "danger";
1312
+ muted: "muted";
1313
+ }>;
1314
+ when: z.ZodUnion<readonly [z.ZodBoolean, z.ZodString]>;
1315
+ }, z.core.$strict>>>;
1316
+ turn: z.ZodOptional<z.ZodString>;
1317
+ widget: z.ZodOptional<z.ZodString>;
1318
+ }, z.core.$strict>;
1319
+ /** The card a pin opens: its record's title, a picture, a few of its fields, and a way to open it. */
1320
+ export declare const MapCardSchema: z.ZodObject<{
1321
+ title: z.ZodOptional<z.ZodString>;
1322
+ image: z.ZodOptional<z.ZodString>;
1323
+ fields: z.ZodOptional<z.ZodArray<z.ZodString>>;
1324
+ open: z.ZodOptional<z.ZodBoolean>;
1325
+ }, z.core.$strict>;
1326
+ /** A line along the roads between a map's layers: from one place to another, through a layer's lines in their order. */
1327
+ export declare const MapRouteSchema: z.ZodObject<{
1328
+ from: z.ZodString;
1329
+ to: z.ZodOptional<z.ZodString>;
1330
+ through: z.ZodOptional<z.ZodString>;
1331
+ mode: z.ZodOptional<z.ZodEnum<{
1332
+ car: "car";
1333
+ bike: "bike";
1334
+ foot: "foot";
1335
+ }>>;
1336
+ progress: z.ZodOptional<z.ZodBoolean>;
1337
+ write: z.ZodOptional<z.ZodObject<{
1338
+ seconds: z.ZodOptional<z.ZodString>;
1339
+ metres: z.ZodOptional<z.ZodString>;
1340
+ line: z.ZodOptional<z.ZodString>;
1341
+ }, z.core.$strict>>;
1342
+ }, z.core.$strict>;
1343
+ /** One layer of a form's map: the record's own place, a place for each of its lines, a route, or the reader's own place. */
1344
+ export declare const MapLayerSchema: z.ZodObject<{
1345
+ id: z.ZodString;
1346
+ label: z.ZodOptional<z.ZodString>;
1347
+ point: z.ZodOptional<z.ZodString>;
1348
+ latitude: z.ZodOptional<z.ZodString>;
1349
+ longitude: z.ZodOptional<z.ZodString>;
1350
+ lines: z.ZodOptional<z.ZodString>;
1351
+ pin: z.ZodOptional<z.ZodObject<{
1352
+ look: z.ZodOptional<z.ZodEnum<{
1353
+ label: "label";
1354
+ pin: "pin";
1355
+ icon: "icon";
1356
+ photo: "photo";
1357
+ dot: "dot";
1358
+ }>>;
1359
+ icon: z.ZodOptional<z.ZodString>;
1360
+ iconField: z.ZodOptional<z.ZodString>;
1361
+ image: z.ZodOptional<z.ZodString>;
1362
+ label: z.ZodOptional<z.ZodString>;
1363
+ tones: z.ZodOptional<z.ZodArray<z.ZodObject<{
1364
+ tone: z.ZodEnum<{
1365
+ success: "success";
1366
+ info: "info";
1367
+ warning: "warning";
1368
+ danger: "danger";
1369
+ muted: "muted";
1370
+ }>;
1371
+ when: z.ZodUnion<readonly [z.ZodBoolean, z.ZodString]>;
1372
+ }, z.core.$strict>>>;
1373
+ turn: z.ZodOptional<z.ZodString>;
1374
+ widget: z.ZodOptional<z.ZodString>;
1375
+ }, z.core.$strict>>;
1376
+ card: z.ZodOptional<z.ZodObject<{
1377
+ title: z.ZodOptional<z.ZodString>;
1378
+ image: z.ZodOptional<z.ZodString>;
1379
+ fields: z.ZodOptional<z.ZodArray<z.ZodString>>;
1380
+ open: z.ZodOptional<z.ZodBoolean>;
1381
+ }, z.core.$strict>>;
1382
+ live: z.ZodOptional<z.ZodObject<{
1383
+ staleAfter: z.ZodOptional<z.ZodInt>;
1384
+ follow: z.ZodOptional<z.ZodBoolean>;
1385
+ }, z.core.$strict>>;
1386
+ route: z.ZodOptional<z.ZodObject<{
1387
+ from: z.ZodString;
1388
+ to: z.ZodOptional<z.ZodString>;
1389
+ through: z.ZodOptional<z.ZodString>;
1390
+ mode: z.ZodOptional<z.ZodEnum<{
1391
+ car: "car";
1392
+ bike: "bike";
1393
+ foot: "foot";
1394
+ }>>;
1395
+ progress: z.ZodOptional<z.ZodBoolean>;
1396
+ write: z.ZodOptional<z.ZodObject<{
1397
+ seconds: z.ZodOptional<z.ZodString>;
1398
+ metres: z.ZodOptional<z.ZodString>;
1399
+ line: z.ZodOptional<z.ZodString>;
1400
+ }, z.core.$strict>>;
1401
+ }, z.core.$strict>>;
1402
+ myLocation: z.ZodOptional<z.ZodBoolean>;
1403
+ invisible: z.ZodOptional<z.ZodUnion<readonly [z.ZodBoolean, z.ZodString]>>;
1404
+ }, z.core.$strict>;
1405
+ export declare const MapNodeSchema: z.ZodObject<{
1406
+ type: z.ZodLiteral<"map">;
1407
+ id: z.ZodString;
1408
+ label: z.ZodOptional<z.ZodString>;
1409
+ layers: z.ZodArray<z.ZodObject<{
1410
+ id: z.ZodString;
1411
+ label: z.ZodOptional<z.ZodString>;
1412
+ point: z.ZodOptional<z.ZodString>;
1413
+ latitude: z.ZodOptional<z.ZodString>;
1414
+ longitude: z.ZodOptional<z.ZodString>;
1415
+ lines: z.ZodOptional<z.ZodString>;
1416
+ pin: z.ZodOptional<z.ZodObject<{
1417
+ look: z.ZodOptional<z.ZodEnum<{
1418
+ label: "label";
1419
+ pin: "pin";
1420
+ icon: "icon";
1421
+ photo: "photo";
1422
+ dot: "dot";
1423
+ }>>;
1424
+ icon: z.ZodOptional<z.ZodString>;
1425
+ iconField: z.ZodOptional<z.ZodString>;
1426
+ image: z.ZodOptional<z.ZodString>;
1427
+ label: z.ZodOptional<z.ZodString>;
1428
+ tones: z.ZodOptional<z.ZodArray<z.ZodObject<{
1429
+ tone: z.ZodEnum<{
1430
+ success: "success";
1431
+ info: "info";
1432
+ warning: "warning";
1433
+ danger: "danger";
1434
+ muted: "muted";
1435
+ }>;
1436
+ when: z.ZodUnion<readonly [z.ZodBoolean, z.ZodString]>;
1437
+ }, z.core.$strict>>>;
1438
+ turn: z.ZodOptional<z.ZodString>;
1439
+ widget: z.ZodOptional<z.ZodString>;
1440
+ }, z.core.$strict>>;
1441
+ card: z.ZodOptional<z.ZodObject<{
1442
+ title: z.ZodOptional<z.ZodString>;
1443
+ image: z.ZodOptional<z.ZodString>;
1444
+ fields: z.ZodOptional<z.ZodArray<z.ZodString>>;
1445
+ open: z.ZodOptional<z.ZodBoolean>;
1446
+ }, z.core.$strict>>;
1447
+ live: z.ZodOptional<z.ZodObject<{
1448
+ staleAfter: z.ZodOptional<z.ZodInt>;
1449
+ follow: z.ZodOptional<z.ZodBoolean>;
1450
+ }, z.core.$strict>>;
1451
+ route: z.ZodOptional<z.ZodObject<{
1452
+ from: z.ZodString;
1453
+ to: z.ZodOptional<z.ZodString>;
1454
+ through: z.ZodOptional<z.ZodString>;
1455
+ mode: z.ZodOptional<z.ZodEnum<{
1456
+ car: "car";
1457
+ bike: "bike";
1458
+ foot: "foot";
1459
+ }>>;
1460
+ progress: z.ZodOptional<z.ZodBoolean>;
1461
+ write: z.ZodOptional<z.ZodObject<{
1462
+ seconds: z.ZodOptional<z.ZodString>;
1463
+ metres: z.ZodOptional<z.ZodString>;
1464
+ line: z.ZodOptional<z.ZodString>;
1465
+ }, z.core.$strict>>;
1466
+ }, z.core.$strict>>;
1467
+ myLocation: z.ZodOptional<z.ZodBoolean>;
1468
+ invisible: z.ZodOptional<z.ZodUnion<readonly [z.ZodBoolean, z.ZodString]>>;
1469
+ }, z.core.$strict>>;
1470
+ height: z.ZodOptional<z.ZodInt>;
1471
+ colspan: z.ZodOptional<z.ZodInt>;
1472
+ invisible: z.ZodOptional<z.ZodUnion<readonly [z.ZodBoolean, z.ZodString]>>;
1473
+ roles: z.ZodOptional<z.ZodArray<z.ZodString>>;
1474
+ hideOn: z.ZodOptional<z.ZodArray<z.ZodEnum<{
1475
+ narrow: "narrow";
1476
+ medium: "medium";
1477
+ wide: "wide";
1478
+ }>>>;
1479
+ }, z.core.$strict>;
1223
1480
  export declare const SlotNodeSchema: z.ZodObject<{
1224
1481
  type: z.ZodLiteral<"slot">;
1225
1482
  id: z.ZodString;
@@ -1770,6 +2027,80 @@ export declare const LayoutNodeSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
1770
2027
  wide: "wide";
1771
2028
  }>>>;
1772
2029
  readonly: z.ZodOptional<z.ZodUnion<readonly [z.ZodBoolean, z.ZodString]>>;
2030
+ }, z.core.$strict>, z.ZodObject<{
2031
+ type: z.ZodLiteral<"map">;
2032
+ id: z.ZodString;
2033
+ label: z.ZodOptional<z.ZodString>;
2034
+ layers: z.ZodArray<z.ZodObject<{
2035
+ id: z.ZodString;
2036
+ label: z.ZodOptional<z.ZodString>;
2037
+ point: z.ZodOptional<z.ZodString>;
2038
+ latitude: z.ZodOptional<z.ZodString>;
2039
+ longitude: z.ZodOptional<z.ZodString>;
2040
+ lines: z.ZodOptional<z.ZodString>;
2041
+ pin: z.ZodOptional<z.ZodObject<{
2042
+ look: z.ZodOptional<z.ZodEnum<{
2043
+ label: "label";
2044
+ pin: "pin";
2045
+ icon: "icon";
2046
+ photo: "photo";
2047
+ dot: "dot";
2048
+ }>>;
2049
+ icon: z.ZodOptional<z.ZodString>;
2050
+ iconField: z.ZodOptional<z.ZodString>;
2051
+ image: z.ZodOptional<z.ZodString>;
2052
+ label: z.ZodOptional<z.ZodString>;
2053
+ tones: z.ZodOptional<z.ZodArray<z.ZodObject<{
2054
+ tone: z.ZodEnum<{
2055
+ success: "success";
2056
+ info: "info";
2057
+ warning: "warning";
2058
+ danger: "danger";
2059
+ muted: "muted";
2060
+ }>;
2061
+ when: z.ZodUnion<readonly [z.ZodBoolean, z.ZodString]>;
2062
+ }, z.core.$strict>>>;
2063
+ turn: z.ZodOptional<z.ZodString>;
2064
+ widget: z.ZodOptional<z.ZodString>;
2065
+ }, z.core.$strict>>;
2066
+ card: z.ZodOptional<z.ZodObject<{
2067
+ title: z.ZodOptional<z.ZodString>;
2068
+ image: z.ZodOptional<z.ZodString>;
2069
+ fields: z.ZodOptional<z.ZodArray<z.ZodString>>;
2070
+ open: z.ZodOptional<z.ZodBoolean>;
2071
+ }, z.core.$strict>>;
2072
+ live: z.ZodOptional<z.ZodObject<{
2073
+ staleAfter: z.ZodOptional<z.ZodInt>;
2074
+ follow: z.ZodOptional<z.ZodBoolean>;
2075
+ }, z.core.$strict>>;
2076
+ route: z.ZodOptional<z.ZodObject<{
2077
+ from: z.ZodString;
2078
+ to: z.ZodOptional<z.ZodString>;
2079
+ through: z.ZodOptional<z.ZodString>;
2080
+ mode: z.ZodOptional<z.ZodEnum<{
2081
+ car: "car";
2082
+ bike: "bike";
2083
+ foot: "foot";
2084
+ }>>;
2085
+ progress: z.ZodOptional<z.ZodBoolean>;
2086
+ write: z.ZodOptional<z.ZodObject<{
2087
+ seconds: z.ZodOptional<z.ZodString>;
2088
+ metres: z.ZodOptional<z.ZodString>;
2089
+ line: z.ZodOptional<z.ZodString>;
2090
+ }, z.core.$strict>>;
2091
+ }, z.core.$strict>>;
2092
+ myLocation: z.ZodOptional<z.ZodBoolean>;
2093
+ invisible: z.ZodOptional<z.ZodUnion<readonly [z.ZodBoolean, z.ZodString]>>;
2094
+ }, z.core.$strict>>;
2095
+ height: z.ZodOptional<z.ZodInt>;
2096
+ colspan: z.ZodOptional<z.ZodInt>;
2097
+ invisible: z.ZodOptional<z.ZodUnion<readonly [z.ZodBoolean, z.ZodString]>>;
2098
+ roles: z.ZodOptional<z.ZodArray<z.ZodString>>;
2099
+ hideOn: z.ZodOptional<z.ZodArray<z.ZodEnum<{
2100
+ narrow: "narrow";
2101
+ medium: "medium";
2102
+ wide: "wide";
2103
+ }>>>;
1773
2104
  }, z.core.$strict>], "type">;
1774
2105
  export declare const StepNodeSchema: z.ZodObject<{
1775
2106
  type: z.ZodLiteral<"step">;
@@ -3896,44 +4227,6 @@ export declare const SheetNodeSchema: z.ZodObject<{
3896
4227
  }>>>;
3897
4228
  }, z.core.$strict>>>;
3898
4229
  }, z.core.$strict>;
3899
- /**
3900
- * What a pin on a map shows, from its record's fields: a pin, an icon (a
3901
- * fixed one or one a field names), a round photo, words alone, or a dot; its
3902
- * words; its colour by condition; its turn, for a car facing its way; or the
3903
- * app's own widget, which draws it from the record.
3904
- */
3905
- export declare const PinSchema: z.ZodObject<{
3906
- look: z.ZodOptional<z.ZodEnum<{
3907
- label: "label";
3908
- pin: "pin";
3909
- icon: "icon";
3910
- photo: "photo";
3911
- dot: "dot";
3912
- }>>;
3913
- icon: z.ZodOptional<z.ZodString>;
3914
- iconField: z.ZodOptional<z.ZodString>;
3915
- image: z.ZodOptional<z.ZodString>;
3916
- label: z.ZodOptional<z.ZodString>;
3917
- tones: z.ZodOptional<z.ZodArray<z.ZodObject<{
3918
- tone: z.ZodEnum<{
3919
- success: "success";
3920
- info: "info";
3921
- warning: "warning";
3922
- danger: "danger";
3923
- muted: "muted";
3924
- }>;
3925
- when: z.ZodUnion<readonly [z.ZodBoolean, z.ZodString]>;
3926
- }, z.core.$strict>>>;
3927
- turn: z.ZodOptional<z.ZodString>;
3928
- widget: z.ZodOptional<z.ZodString>;
3929
- }, z.core.$strict>;
3930
- /** The card a pin opens: its record's title, a picture, a few of its fields, and a way to open it. */
3931
- export declare const MapCardSchema: z.ZodObject<{
3932
- title: z.ZodOptional<z.ZodString>;
3933
- image: z.ZodOptional<z.ZodString>;
3934
- fields: z.ZodOptional<z.ZodArray<z.ZodString>>;
3935
- open: z.ZodOptional<z.ZodBoolean>;
3936
- }, z.core.$strict>;
3937
4230
  /** A list's records on a map, beside it or instead of it: where each is (a point, or a latitude and a longitude), its pin, its card. */
3938
4231
  export declare const ListMapSchema: z.ZodObject<{
3939
4232
  point: z.ZodOptional<z.ZodString>;