@ramme-io/shared 3.5.0 → 3.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +141 -4
- package/dist/index.d.cts +7442 -4556
- package/dist/index.d.ts +7442 -4556
- package/dist/index.js +134 -4
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -503,6 +503,8 @@ var AppTextSchema = z6.object({
|
|
|
503
503
|
size: AppTextSizeSchema.default("base"),
|
|
504
504
|
align: AppAlignSchema.default("start"),
|
|
505
505
|
/** Printed after the value, e.g. a degree symbol. Never itself bound. */
|
|
506
|
+
/** Drawn before the value, as `suffix` is after: "H " for "H 68°". */
|
|
507
|
+
prefix: z6.string().max(8).optional(),
|
|
506
508
|
suffix: z6.string().max(8).optional(),
|
|
507
509
|
...leafBase
|
|
508
510
|
});
|
|
@@ -589,6 +591,17 @@ var AppImageSchema = z6.object({
|
|
|
589
591
|
/** Drawn only when this is false, or absent. */
|
|
590
592
|
hideWhen: AppConditionSchema.optional()
|
|
591
593
|
});
|
|
594
|
+
var ICON_SIZE_PX = { sm: 24, md: 48, lg: 72, xl: 96 };
|
|
595
|
+
var AppIconSchema = z6.object({
|
|
596
|
+
type: z6.literal("icon"),
|
|
597
|
+
value: AppBindingSchema,
|
|
598
|
+
size: z6.enum(["sm", "md", "lg", "xl"]).default("md"),
|
|
599
|
+
align: AppAlignSchema.default("start"),
|
|
600
|
+
color: AppColorSchema.default("foreground"),
|
|
601
|
+
rules: z6.array(AppStyleRuleSchema).max(4).optional(),
|
|
602
|
+
/** Drawn only when this is false, or absent. */
|
|
603
|
+
hideWhen: AppConditionSchema.optional()
|
|
604
|
+
});
|
|
592
605
|
var AppLeafSchema = z6.discriminatedUnion("type", [
|
|
593
606
|
AppTextSchema,
|
|
594
607
|
AppDialSchema,
|
|
@@ -596,13 +609,25 @@ var AppLeafSchema = z6.discriminatedUnion("type", [
|
|
|
596
609
|
AppBarSchema,
|
|
597
610
|
AppStatusSchema,
|
|
598
611
|
AppSpriteSchema,
|
|
599
|
-
AppImageSchema
|
|
612
|
+
AppImageSchema,
|
|
613
|
+
AppIconSchema
|
|
600
614
|
]);
|
|
601
615
|
var AppGroupSchema = z6.object({
|
|
602
616
|
type: z6.literal("group"),
|
|
603
617
|
direction: z6.enum(["row", "stack"]),
|
|
604
618
|
gap: z6.number().int().min(0).max(64).default(4),
|
|
605
619
|
align: AppAlignSchema.default("start"),
|
|
620
|
+
/**
|
|
621
|
+
* A row whose children take their own width, `gap` apart, placed together
|
|
622
|
+
* at the row's `align` — "68°" with its icon right beside it, "H 68° L 56°"
|
|
623
|
+
* as one line. Without it a row splits into equal cells, which put a short
|
|
624
|
+
* temperature and its icon half a screen apart. Text is as wide as the
|
|
625
|
+
* board draws it (six pixels in eight, per character); bars, dials,
|
|
626
|
+
* sparklines and status lights have no width of their own and share what is
|
|
627
|
+
* left. Ignored by a stack, and by firmware older than 2026-10-17, which
|
|
628
|
+
* falls back to equal cells.
|
|
629
|
+
*/
|
|
630
|
+
pack: z6.boolean().optional(),
|
|
606
631
|
children: z6.array(AppLeafSchema).min(1).max(8)
|
|
607
632
|
});
|
|
608
633
|
var AppBlockSchema = z6.union([AppLeafSchema, AppGroupSchema]);
|
|
@@ -619,6 +644,23 @@ var AppDocumentSchema = z6.object({
|
|
|
619
644
|
author: z6.string().max(32).optional(),
|
|
620
645
|
screen: AppScreenSizeSchema.default("320x240"),
|
|
621
646
|
background: AppColorSchema.default("background"),
|
|
647
|
+
/**
|
|
648
|
+
* Where the blocks sit on the screen as a whole: from the top, or in the
|
|
649
|
+
* middle with the space shared above and below. A document taller than the
|
|
650
|
+
* screen starts at the top either way, so centring never pushes the first
|
|
651
|
+
* block off the glass. Older firmware draws from the top.
|
|
652
|
+
*/
|
|
653
|
+
valign: z6.enum(["start", "center"]).optional(),
|
|
654
|
+
/**
|
|
655
|
+
* Where the blocks sit across the screen as a whole. `center` makes a column
|
|
656
|
+
* as wide as the widest block and centres that column, so left-aligned lines
|
|
657
|
+
* stay aligned with each other and the group sits in the middle — rather
|
|
658
|
+
* than every line hugging the left edge with the right half empty. Widths
|
|
659
|
+
* are the board's (see `pack`); a block with no width of its own, like an
|
|
660
|
+
* equal-celled row or a bar, fills the screen and leaves nothing to centre.
|
|
661
|
+
* Older firmware draws from the left.
|
|
662
|
+
*/
|
|
663
|
+
halign: z6.enum(["start", "center"]).optional(),
|
|
622
664
|
/** Named so bindings can refer to them. */
|
|
623
665
|
sources: z6.record(AppSourceSchema).default({}),
|
|
624
666
|
blocks: z6.array(AppBlockSchema).min(1).max(12)
|
|
@@ -978,6 +1020,73 @@ var DEVICE_TIMEZONES = [
|
|
|
978
1020
|
];
|
|
979
1021
|
var DEVICE_TIMEZONE_FALLBACK = "UTC0";
|
|
980
1022
|
|
|
1023
|
+
// src/apps/weather.ts
|
|
1024
|
+
var WEATHER_ICON_NAMES = ["sun", "partly", "cloud", "fog", "rain", "snow", "storm"];
|
|
1025
|
+
var WEATHER_CODES = [
|
|
1026
|
+
{ upTo: 0, word: "Clear", icon: "sun" },
|
|
1027
|
+
{ upTo: 1, word: "Mostly clear", icon: "sun" },
|
|
1028
|
+
{ upTo: 2, word: "Partly cloudy", icon: "partly" },
|
|
1029
|
+
{ upTo: 3, word: "Cloudy", icon: "cloud" },
|
|
1030
|
+
{ upTo: 48, word: "Fog", icon: "fog" },
|
|
1031
|
+
{ upTo: 57, word: "Drizzle", icon: "rain" },
|
|
1032
|
+
{ upTo: 67, word: "Rain", icon: "rain" },
|
|
1033
|
+
{ upTo: 77, word: "Snow", icon: "snow" },
|
|
1034
|
+
{ upTo: 82, word: "Showers", icon: "rain" },
|
|
1035
|
+
{ upTo: 86, word: "Snow showers", icon: "snow" },
|
|
1036
|
+
{ upTo: 99, word: "Storm", icon: "storm" }
|
|
1037
|
+
];
|
|
1038
|
+
var ICON_GRID = 48;
|
|
1039
|
+
var ICON_STROKE = 3;
|
|
1040
|
+
var WEATHER_ICONS = {
|
|
1041
|
+
sun: [
|
|
1042
|
+
[32, 24, 32, 26, 30, 29, 29, 30, 26, 32, 22, 32, 19, 30, 18, 29, 16, 26, 16, 22, 18, 19, 19, 18, 22, 16, 26, 16, 29, 18, 30, 19, 32, 22, 32, 24],
|
|
1043
|
+
[37, 24, 43, 24],
|
|
1044
|
+
[33, 33, 37, 37],
|
|
1045
|
+
[24, 37, 24, 43],
|
|
1046
|
+
[15, 33, 11, 37],
|
|
1047
|
+
[11, 24, 5, 24],
|
|
1048
|
+
[15, 15, 11, 11],
|
|
1049
|
+
[24, 11, 24, 5],
|
|
1050
|
+
[33, 15, 37, 11]
|
|
1051
|
+
],
|
|
1052
|
+
partly: [
|
|
1053
|
+
[17, 23, 15, 23, 13, 22, 11, 20, 10, 18, 10, 14, 11, 12, 13, 10, 15, 9, 19, 9, 21, 10, 23, 12, 24, 14, 24, 16],
|
|
1054
|
+
[28, 16, 32, 16],
|
|
1055
|
+
[9, 24, 6, 27],
|
|
1056
|
+
[6, 16, 2, 16],
|
|
1057
|
+
[9, 8, 6, 5],
|
|
1058
|
+
[17, 5, 17, 1],
|
|
1059
|
+
[25, 8, 28, 5],
|
|
1060
|
+
[41, 33, 40, 35, 38, 37, 36, 38, 15, 38, 13, 37, 11, 33, 13, 29, 15, 27, 17, 27, 17, 24, 19, 20, 21, 18, 23, 17, 28, 17, 30, 18, 34, 22, 34, 24, 37, 25, 39, 26, 41, 28, 42, 30, 41, 33]
|
|
1061
|
+
],
|
|
1062
|
+
cloud: [
|
|
1063
|
+
[42, 32, 40, 35, 38, 37, 35, 38, 12, 38, 10, 37, 9, 34, 8, 32, 9, 30, 10, 27, 14, 25, 14, 22, 15, 20, 21, 14, 27, 14, 33, 20, 34, 22, 37, 23, 39, 24, 41, 26, 42, 29, 42, 32]
|
|
1064
|
+
],
|
|
1065
|
+
fog: [
|
|
1066
|
+
[8, 16, 40, 16],
|
|
1067
|
+
[12, 24, 36, 24],
|
|
1068
|
+
[8, 32, 40, 32]
|
|
1069
|
+
],
|
|
1070
|
+
rain: [
|
|
1071
|
+
[41, 25, 37, 29, 35, 30, 13, 30, 10, 29, 9, 27, 9, 22, 10, 20, 14, 18, 15, 15, 15, 13, 19, 9, 21, 8, 26, 8, 29, 9, 31, 11, 33, 15, 36, 16, 38, 17, 40, 19, 41, 22, 41, 24],
|
|
1072
|
+
[15, 36, 12, 43],
|
|
1073
|
+
[24, 36, 21, 43],
|
|
1074
|
+
[33, 36, 30, 43]
|
|
1075
|
+
],
|
|
1076
|
+
snow: [
|
|
1077
|
+
[41, 25, 37, 29, 35, 30, 13, 30, 10, 29, 9, 27, 9, 22, 10, 20, 14, 18, 15, 15, 15, 13, 19, 9, 21, 8, 26, 8, 29, 9, 31, 11, 33, 15, 36, 16, 38, 17, 40, 19, 41, 22, 41, 24],
|
|
1078
|
+
[14, 39, 14, 39],
|
|
1079
|
+
[24, 42, 24, 42],
|
|
1080
|
+
[34, 39, 34, 39],
|
|
1081
|
+
[19, 45, 19, 45],
|
|
1082
|
+
[29, 45, 29, 45]
|
|
1083
|
+
],
|
|
1084
|
+
storm: [
|
|
1085
|
+
[41, 25, 37, 29, 35, 30, 13, 30, 10, 29, 9, 27, 9, 22, 10, 20, 14, 18, 15, 15, 15, 13, 19, 9, 21, 8, 26, 8, 29, 9, 31, 11, 33, 15, 36, 16, 38, 17, 40, 19, 41, 22, 41, 24],
|
|
1086
|
+
[26, 33, 20, 41, 27, 41, 22, 47]
|
|
1087
|
+
]
|
|
1088
|
+
};
|
|
1089
|
+
|
|
981
1090
|
// src/ai/tools.ts
|
|
982
1091
|
import { z as z10 } from "zod";
|
|
983
1092
|
var telemetryGraphParameters = z10.object({
|
|
@@ -1261,7 +1370,8 @@ THE SHAPE
|
|
|
1261
1370
|
|
|
1262
1371
|
BLOCKS \u2014 up to 12, drawn top to bottom. Each is one of:
|
|
1263
1372
|
|
|
1264
|
-
{ "type": "text", "value": V, "size": S, "align": A, "color": C, "suffix": "\xB0" }
|
|
1373
|
+
{ "type": "text", "value": V, "size": S, "align": A, "color": C, "prefix": "H ", "suffix": "\xB0" }
|
|
1374
|
+
{ "type": "icon", "value": V, "size": "sm"|"md"|"lg"|"xl", "align": A, "color": C }
|
|
1265
1375
|
{ "type": "dial", "value": V, "min": 0, "max": 100, "label": "CPU", "color": C }
|
|
1266
1376
|
{ "type": "bar", "value": V, "min": 0, "max": 100, "color": C }
|
|
1267
1377
|
{ "type": "sparkline", "series": V, "color": C }
|
|
@@ -1270,7 +1380,20 @@ BLOCKS \u2014 up to 12, drawn top to bottom. Each is one of:
|
|
|
1270
1380
|
0110
|
|
1271
1381
|
1100
|
|
1272
1382
|
0011", "align": A }
|
|
1273
|
-
{ "type": "group", "direction": "row"|"stack", "gap": 8, "align": A, "children": [ ...leaves... ] }
|
|
1383
|
+
{ "type": "group", "direction": "row"|"stack", "gap": 8, "align": A, "pack": true, "children": [ ...leaves... ] }
|
|
1384
|
+
|
|
1385
|
+
A row splits the width into equal cells. Add "pack": true and each child takes
|
|
1386
|
+
only its own width, "gap" apart \u2014 a number with its icon right beside it, or
|
|
1387
|
+
"H 68\xB0 L 56\xB0" as one line. Put "valign": "center" at the top level of the
|
|
1388
|
+
document to centre the blocks on the screen rather than start at the top, and
|
|
1389
|
+
"halign": "center" to centre them across it \u2014 the lines keep their own
|
|
1390
|
+
alignment inside a column as wide as the widest, and the column is centred.
|
|
1391
|
+
|
|
1392
|
+
AN ICON is the sky drawn in outline: "sun", "partly", "cloud", "fog", "rain",
|
|
1393
|
+
"snow" or "storm". Bind its value to a weather source's "icon" field so it
|
|
1394
|
+
follows the weather \u2014 { "source": "forecast", "field": "icon" } \u2014 or write one
|
|
1395
|
+
of those names as a literal. Sizes are 24, 48, 72 and 96 pixels square. Prefer
|
|
1396
|
+
it to drawing a weather sprite: it costs nothing and the board draws it crisply.
|
|
1274
1397
|
|
|
1275
1398
|
DRAWING A SPRITE \u2014 you may, and here is the only form that works.
|
|
1276
1399
|
|
|
@@ -1352,7 +1475,7 @@ SOURCES \u2014 declare what the app reads, then bind to it by name:
|
|
|
1352
1475
|
|
|
1353
1476
|
"forecast": { "kind": "weather", "latitude": 39.95, "longitude": -75.17,
|
|
1354
1477
|
"units": "imperial", "refreshSeconds": 600 }
|
|
1355
|
-
fields: temperature, condition, high, low
|
|
1478
|
+
fields: temperature, condition, icon, high, low
|
|
1356
1479
|
"now": { "kind": "clock", "timezone": "America/New_York", "twentyFourHour": false }
|
|
1357
1480
|
fields: time, date, weekday, hour (hour is 0-23, for rules about time of day)
|
|
1358
1481
|
"until": { "kind": "countdown", "target": "2026-12-25", "label": "Christmas" }
|
|
@@ -1772,6 +1895,7 @@ export {
|
|
|
1772
1895
|
AppDialSchema,
|
|
1773
1896
|
AppDocumentSchema,
|
|
1774
1897
|
AppGroupSchema,
|
|
1898
|
+
AppIconSchema,
|
|
1775
1899
|
AppImageSchema,
|
|
1776
1900
|
AppLeafSchema,
|
|
1777
1901
|
AppOperandSchema,
|
|
@@ -1849,6 +1973,9 @@ export {
|
|
|
1849
1973
|
FloraTelemetrySchema,
|
|
1850
1974
|
GENESIS_LIBRARY_CONTEXT,
|
|
1851
1975
|
GENESIS_VALID_COMPONENTS,
|
|
1976
|
+
ICON_GRID,
|
|
1977
|
+
ICON_SIZE_PX,
|
|
1978
|
+
ICON_STROKE,
|
|
1852
1979
|
IMAGE_MAX_DRAWN,
|
|
1853
1980
|
IMAGE_MAX_SCALE,
|
|
1854
1981
|
IMPACT_FLAG_THRESHOLD,
|
|
@@ -1910,6 +2037,9 @@ export {
|
|
|
1910
2037
|
TriggerSchema,
|
|
1911
2038
|
UserSchema,
|
|
1912
2039
|
VitalSourceSchema,
|
|
2040
|
+
WEATHER_CODES,
|
|
2041
|
+
WEATHER_ICONS,
|
|
2042
|
+
WEATHER_ICON_NAMES,
|
|
1913
2043
|
WeatherAppConfigSchema,
|
|
1914
2044
|
WorkflowSchema,
|
|
1915
2045
|
architectureReferenceParameters,
|