@ramme-io/shared 3.5.0 → 3.6.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 +129 -4
- package/dist/index.d.cts +7429 -4557
- package/dist/index.d.ts +7429 -4557
- package/dist/index.js +122 -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,13 @@ 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(),
|
|
622
654
|
/** Named so bindings can refer to them. */
|
|
623
655
|
sources: z6.record(AppSourceSchema).default({}),
|
|
624
656
|
blocks: z6.array(AppBlockSchema).min(1).max(12)
|
|
@@ -978,6 +1010,73 @@ var DEVICE_TIMEZONES = [
|
|
|
978
1010
|
];
|
|
979
1011
|
var DEVICE_TIMEZONE_FALLBACK = "UTC0";
|
|
980
1012
|
|
|
1013
|
+
// src/apps/weather.ts
|
|
1014
|
+
var WEATHER_ICON_NAMES = ["sun", "partly", "cloud", "fog", "rain", "snow", "storm"];
|
|
1015
|
+
var WEATHER_CODES = [
|
|
1016
|
+
{ upTo: 0, word: "Clear", icon: "sun" },
|
|
1017
|
+
{ upTo: 1, word: "Mostly clear", icon: "sun" },
|
|
1018
|
+
{ upTo: 2, word: "Partly cloudy", icon: "partly" },
|
|
1019
|
+
{ upTo: 3, word: "Cloudy", icon: "cloud" },
|
|
1020
|
+
{ upTo: 48, word: "Fog", icon: "fog" },
|
|
1021
|
+
{ upTo: 57, word: "Drizzle", icon: "rain" },
|
|
1022
|
+
{ upTo: 67, word: "Rain", icon: "rain" },
|
|
1023
|
+
{ upTo: 77, word: "Snow", icon: "snow" },
|
|
1024
|
+
{ upTo: 82, word: "Showers", icon: "rain" },
|
|
1025
|
+
{ upTo: 86, word: "Snow showers", icon: "snow" },
|
|
1026
|
+
{ upTo: 99, word: "Storm", icon: "storm" }
|
|
1027
|
+
];
|
|
1028
|
+
var ICON_GRID = 48;
|
|
1029
|
+
var ICON_STROKE = 3;
|
|
1030
|
+
var WEATHER_ICONS = {
|
|
1031
|
+
sun: [
|
|
1032
|
+
[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],
|
|
1033
|
+
[37, 24, 43, 24],
|
|
1034
|
+
[33, 33, 37, 37],
|
|
1035
|
+
[24, 37, 24, 43],
|
|
1036
|
+
[15, 33, 11, 37],
|
|
1037
|
+
[11, 24, 5, 24],
|
|
1038
|
+
[15, 15, 11, 11],
|
|
1039
|
+
[24, 11, 24, 5],
|
|
1040
|
+
[33, 15, 37, 11]
|
|
1041
|
+
],
|
|
1042
|
+
partly: [
|
|
1043
|
+
[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],
|
|
1044
|
+
[28, 16, 32, 16],
|
|
1045
|
+
[9, 24, 6, 27],
|
|
1046
|
+
[6, 16, 2, 16],
|
|
1047
|
+
[9, 8, 6, 5],
|
|
1048
|
+
[17, 5, 17, 1],
|
|
1049
|
+
[25, 8, 28, 5],
|
|
1050
|
+
[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]
|
|
1051
|
+
],
|
|
1052
|
+
cloud: [
|
|
1053
|
+
[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]
|
|
1054
|
+
],
|
|
1055
|
+
fog: [
|
|
1056
|
+
[8, 16, 40, 16],
|
|
1057
|
+
[12, 24, 36, 24],
|
|
1058
|
+
[8, 32, 40, 32]
|
|
1059
|
+
],
|
|
1060
|
+
rain: [
|
|
1061
|
+
[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],
|
|
1062
|
+
[15, 36, 12, 43],
|
|
1063
|
+
[24, 36, 21, 43],
|
|
1064
|
+
[33, 36, 30, 43]
|
|
1065
|
+
],
|
|
1066
|
+
snow: [
|
|
1067
|
+
[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],
|
|
1068
|
+
[14, 39, 14, 39],
|
|
1069
|
+
[24, 42, 24, 42],
|
|
1070
|
+
[34, 39, 34, 39],
|
|
1071
|
+
[19, 45, 19, 45],
|
|
1072
|
+
[29, 45, 29, 45]
|
|
1073
|
+
],
|
|
1074
|
+
storm: [
|
|
1075
|
+
[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],
|
|
1076
|
+
[26, 33, 20, 41, 27, 41, 22, 47]
|
|
1077
|
+
]
|
|
1078
|
+
};
|
|
1079
|
+
|
|
981
1080
|
// src/ai/tools.ts
|
|
982
1081
|
import { z as z10 } from "zod";
|
|
983
1082
|
var telemetryGraphParameters = z10.object({
|
|
@@ -1261,7 +1360,8 @@ THE SHAPE
|
|
|
1261
1360
|
|
|
1262
1361
|
BLOCKS \u2014 up to 12, drawn top to bottom. Each is one of:
|
|
1263
1362
|
|
|
1264
|
-
{ "type": "text", "value": V, "size": S, "align": A, "color": C, "suffix": "\xB0" }
|
|
1363
|
+
{ "type": "text", "value": V, "size": S, "align": A, "color": C, "prefix": "H ", "suffix": "\xB0" }
|
|
1364
|
+
{ "type": "icon", "value": V, "size": "sm"|"md"|"lg"|"xl", "align": A, "color": C }
|
|
1265
1365
|
{ "type": "dial", "value": V, "min": 0, "max": 100, "label": "CPU", "color": C }
|
|
1266
1366
|
{ "type": "bar", "value": V, "min": 0, "max": 100, "color": C }
|
|
1267
1367
|
{ "type": "sparkline", "series": V, "color": C }
|
|
@@ -1270,7 +1370,18 @@ BLOCKS \u2014 up to 12, drawn top to bottom. Each is one of:
|
|
|
1270
1370
|
0110
|
|
1271
1371
|
1100
|
|
1272
1372
|
0011", "align": A }
|
|
1273
|
-
{ "type": "group", "direction": "row"|"stack", "gap": 8, "align": A, "children": [ ...leaves... ] }
|
|
1373
|
+
{ "type": "group", "direction": "row"|"stack", "gap": 8, "align": A, "pack": true, "children": [ ...leaves... ] }
|
|
1374
|
+
|
|
1375
|
+
A row splits the width into equal cells. Add "pack": true and each child takes
|
|
1376
|
+
only its own width, "gap" apart \u2014 a number with its icon right beside it, or
|
|
1377
|
+
"H 68\xB0 L 56\xB0" as one line. Put "valign": "center" at the top level of the
|
|
1378
|
+
document to centre the blocks on the screen rather than start at the top.
|
|
1379
|
+
|
|
1380
|
+
AN ICON is the sky drawn in outline: "sun", "partly", "cloud", "fog", "rain",
|
|
1381
|
+
"snow" or "storm". Bind its value to a weather source's "icon" field so it
|
|
1382
|
+
follows the weather \u2014 { "source": "forecast", "field": "icon" } \u2014 or write one
|
|
1383
|
+
of those names as a literal. Sizes are 24, 48, 72 and 96 pixels square. Prefer
|
|
1384
|
+
it to drawing a weather sprite: it costs nothing and the board draws it crisply.
|
|
1274
1385
|
|
|
1275
1386
|
DRAWING A SPRITE \u2014 you may, and here is the only form that works.
|
|
1276
1387
|
|
|
@@ -1352,7 +1463,7 @@ SOURCES \u2014 declare what the app reads, then bind to it by name:
|
|
|
1352
1463
|
|
|
1353
1464
|
"forecast": { "kind": "weather", "latitude": 39.95, "longitude": -75.17,
|
|
1354
1465
|
"units": "imperial", "refreshSeconds": 600 }
|
|
1355
|
-
fields: temperature, condition, high, low
|
|
1466
|
+
fields: temperature, condition, icon, high, low
|
|
1356
1467
|
"now": { "kind": "clock", "timezone": "America/New_York", "twentyFourHour": false }
|
|
1357
1468
|
fields: time, date, weekday, hour (hour is 0-23, for rules about time of day)
|
|
1358
1469
|
"until": { "kind": "countdown", "target": "2026-12-25", "label": "Christmas" }
|
|
@@ -1772,6 +1883,7 @@ export {
|
|
|
1772
1883
|
AppDialSchema,
|
|
1773
1884
|
AppDocumentSchema,
|
|
1774
1885
|
AppGroupSchema,
|
|
1886
|
+
AppIconSchema,
|
|
1775
1887
|
AppImageSchema,
|
|
1776
1888
|
AppLeafSchema,
|
|
1777
1889
|
AppOperandSchema,
|
|
@@ -1849,6 +1961,9 @@ export {
|
|
|
1849
1961
|
FloraTelemetrySchema,
|
|
1850
1962
|
GENESIS_LIBRARY_CONTEXT,
|
|
1851
1963
|
GENESIS_VALID_COMPONENTS,
|
|
1964
|
+
ICON_GRID,
|
|
1965
|
+
ICON_SIZE_PX,
|
|
1966
|
+
ICON_STROKE,
|
|
1852
1967
|
IMAGE_MAX_DRAWN,
|
|
1853
1968
|
IMAGE_MAX_SCALE,
|
|
1854
1969
|
IMPACT_FLAG_THRESHOLD,
|
|
@@ -1910,6 +2025,9 @@ export {
|
|
|
1910
2025
|
TriggerSchema,
|
|
1911
2026
|
UserSchema,
|
|
1912
2027
|
VitalSourceSchema,
|
|
2028
|
+
WEATHER_CODES,
|
|
2029
|
+
WEATHER_ICONS,
|
|
2030
|
+
WEATHER_ICON_NAMES,
|
|
1913
2031
|
WeatherAppConfigSchema,
|
|
1914
2032
|
WorkflowSchema,
|
|
1915
2033
|
architectureReferenceParameters,
|