@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.cjs
CHANGED
|
@@ -50,6 +50,7 @@ __export(index_exports, {
|
|
|
50
50
|
AppDialSchema: () => AppDialSchema,
|
|
51
51
|
AppDocumentSchema: () => AppDocumentSchema,
|
|
52
52
|
AppGroupSchema: () => AppGroupSchema,
|
|
53
|
+
AppIconSchema: () => AppIconSchema,
|
|
53
54
|
AppImageSchema: () => AppImageSchema,
|
|
54
55
|
AppLeafSchema: () => AppLeafSchema,
|
|
55
56
|
AppOperandSchema: () => AppOperandSchema,
|
|
@@ -127,6 +128,9 @@ __export(index_exports, {
|
|
|
127
128
|
FloraTelemetrySchema: () => FloraTelemetrySchema,
|
|
128
129
|
GENESIS_LIBRARY_CONTEXT: () => GENESIS_LIBRARY_CONTEXT,
|
|
129
130
|
GENESIS_VALID_COMPONENTS: () => GENESIS_VALID_COMPONENTS,
|
|
131
|
+
ICON_GRID: () => ICON_GRID,
|
|
132
|
+
ICON_SIZE_PX: () => ICON_SIZE_PX,
|
|
133
|
+
ICON_STROKE: () => ICON_STROKE,
|
|
130
134
|
IMAGE_MAX_DRAWN: () => IMAGE_MAX_DRAWN,
|
|
131
135
|
IMAGE_MAX_SCALE: () => IMAGE_MAX_SCALE,
|
|
132
136
|
IMPACT_FLAG_THRESHOLD: () => IMPACT_FLAG_THRESHOLD,
|
|
@@ -188,6 +192,9 @@ __export(index_exports, {
|
|
|
188
192
|
TriggerSchema: () => TriggerSchema,
|
|
189
193
|
UserSchema: () => UserSchema,
|
|
190
194
|
VitalSourceSchema: () => VitalSourceSchema,
|
|
195
|
+
WEATHER_CODES: () => WEATHER_CODES,
|
|
196
|
+
WEATHER_ICONS: () => WEATHER_ICONS,
|
|
197
|
+
WEATHER_ICON_NAMES: () => WEATHER_ICON_NAMES,
|
|
191
198
|
WeatherAppConfigSchema: () => WeatherAppConfigSchema,
|
|
192
199
|
WorkflowSchema: () => WorkflowSchema,
|
|
193
200
|
architectureReferenceParameters: () => architectureReferenceParameters,
|
|
@@ -700,6 +707,8 @@ var AppTextSchema = import_zod6.z.object({
|
|
|
700
707
|
size: AppTextSizeSchema.default("base"),
|
|
701
708
|
align: AppAlignSchema.default("start"),
|
|
702
709
|
/** Printed after the value, e.g. a degree symbol. Never itself bound. */
|
|
710
|
+
/** Drawn before the value, as `suffix` is after: "H " for "H 68°". */
|
|
711
|
+
prefix: import_zod6.z.string().max(8).optional(),
|
|
703
712
|
suffix: import_zod6.z.string().max(8).optional(),
|
|
704
713
|
...leafBase
|
|
705
714
|
});
|
|
@@ -786,6 +795,17 @@ var AppImageSchema = import_zod6.z.object({
|
|
|
786
795
|
/** Drawn only when this is false, or absent. */
|
|
787
796
|
hideWhen: AppConditionSchema.optional()
|
|
788
797
|
});
|
|
798
|
+
var ICON_SIZE_PX = { sm: 24, md: 48, lg: 72, xl: 96 };
|
|
799
|
+
var AppIconSchema = import_zod6.z.object({
|
|
800
|
+
type: import_zod6.z.literal("icon"),
|
|
801
|
+
value: AppBindingSchema,
|
|
802
|
+
size: import_zod6.z.enum(["sm", "md", "lg", "xl"]).default("md"),
|
|
803
|
+
align: AppAlignSchema.default("start"),
|
|
804
|
+
color: AppColorSchema.default("foreground"),
|
|
805
|
+
rules: import_zod6.z.array(AppStyleRuleSchema).max(4).optional(),
|
|
806
|
+
/** Drawn only when this is false, or absent. */
|
|
807
|
+
hideWhen: AppConditionSchema.optional()
|
|
808
|
+
});
|
|
789
809
|
var AppLeafSchema = import_zod6.z.discriminatedUnion("type", [
|
|
790
810
|
AppTextSchema,
|
|
791
811
|
AppDialSchema,
|
|
@@ -793,13 +813,25 @@ var AppLeafSchema = import_zod6.z.discriminatedUnion("type", [
|
|
|
793
813
|
AppBarSchema,
|
|
794
814
|
AppStatusSchema,
|
|
795
815
|
AppSpriteSchema,
|
|
796
|
-
AppImageSchema
|
|
816
|
+
AppImageSchema,
|
|
817
|
+
AppIconSchema
|
|
797
818
|
]);
|
|
798
819
|
var AppGroupSchema = import_zod6.z.object({
|
|
799
820
|
type: import_zod6.z.literal("group"),
|
|
800
821
|
direction: import_zod6.z.enum(["row", "stack"]),
|
|
801
822
|
gap: import_zod6.z.number().int().min(0).max(64).default(4),
|
|
802
823
|
align: AppAlignSchema.default("start"),
|
|
824
|
+
/**
|
|
825
|
+
* A row whose children take their own width, `gap` apart, placed together
|
|
826
|
+
* at the row's `align` — "68°" with its icon right beside it, "H 68° L 56°"
|
|
827
|
+
* as one line. Without it a row splits into equal cells, which put a short
|
|
828
|
+
* temperature and its icon half a screen apart. Text is as wide as the
|
|
829
|
+
* board draws it (six pixels in eight, per character); bars, dials,
|
|
830
|
+
* sparklines and status lights have no width of their own and share what is
|
|
831
|
+
* left. Ignored by a stack, and by firmware older than 2026-10-17, which
|
|
832
|
+
* falls back to equal cells.
|
|
833
|
+
*/
|
|
834
|
+
pack: import_zod6.z.boolean().optional(),
|
|
803
835
|
children: import_zod6.z.array(AppLeafSchema).min(1).max(8)
|
|
804
836
|
});
|
|
805
837
|
var AppBlockSchema = import_zod6.z.union([AppLeafSchema, AppGroupSchema]);
|
|
@@ -816,6 +848,13 @@ var AppDocumentSchema = import_zod6.z.object({
|
|
|
816
848
|
author: import_zod6.z.string().max(32).optional(),
|
|
817
849
|
screen: AppScreenSizeSchema.default("320x240"),
|
|
818
850
|
background: AppColorSchema.default("background"),
|
|
851
|
+
/**
|
|
852
|
+
* Where the blocks sit on the screen as a whole: from the top, or in the
|
|
853
|
+
* middle with the space shared above and below. A document taller than the
|
|
854
|
+
* screen starts at the top either way, so centring never pushes the first
|
|
855
|
+
* block off the glass. Older firmware draws from the top.
|
|
856
|
+
*/
|
|
857
|
+
valign: import_zod6.z.enum(["start", "center"]).optional(),
|
|
819
858
|
/** Named so bindings can refer to them. */
|
|
820
859
|
sources: import_zod6.z.record(AppSourceSchema).default({}),
|
|
821
860
|
blocks: import_zod6.z.array(AppBlockSchema).min(1).max(12)
|
|
@@ -1175,6 +1214,73 @@ var DEVICE_TIMEZONES = [
|
|
|
1175
1214
|
];
|
|
1176
1215
|
var DEVICE_TIMEZONE_FALLBACK = "UTC0";
|
|
1177
1216
|
|
|
1217
|
+
// src/apps/weather.ts
|
|
1218
|
+
var WEATHER_ICON_NAMES = ["sun", "partly", "cloud", "fog", "rain", "snow", "storm"];
|
|
1219
|
+
var WEATHER_CODES = [
|
|
1220
|
+
{ upTo: 0, word: "Clear", icon: "sun" },
|
|
1221
|
+
{ upTo: 1, word: "Mostly clear", icon: "sun" },
|
|
1222
|
+
{ upTo: 2, word: "Partly cloudy", icon: "partly" },
|
|
1223
|
+
{ upTo: 3, word: "Cloudy", icon: "cloud" },
|
|
1224
|
+
{ upTo: 48, word: "Fog", icon: "fog" },
|
|
1225
|
+
{ upTo: 57, word: "Drizzle", icon: "rain" },
|
|
1226
|
+
{ upTo: 67, word: "Rain", icon: "rain" },
|
|
1227
|
+
{ upTo: 77, word: "Snow", icon: "snow" },
|
|
1228
|
+
{ upTo: 82, word: "Showers", icon: "rain" },
|
|
1229
|
+
{ upTo: 86, word: "Snow showers", icon: "snow" },
|
|
1230
|
+
{ upTo: 99, word: "Storm", icon: "storm" }
|
|
1231
|
+
];
|
|
1232
|
+
var ICON_GRID = 48;
|
|
1233
|
+
var ICON_STROKE = 3;
|
|
1234
|
+
var WEATHER_ICONS = {
|
|
1235
|
+
sun: [
|
|
1236
|
+
[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],
|
|
1237
|
+
[37, 24, 43, 24],
|
|
1238
|
+
[33, 33, 37, 37],
|
|
1239
|
+
[24, 37, 24, 43],
|
|
1240
|
+
[15, 33, 11, 37],
|
|
1241
|
+
[11, 24, 5, 24],
|
|
1242
|
+
[15, 15, 11, 11],
|
|
1243
|
+
[24, 11, 24, 5],
|
|
1244
|
+
[33, 15, 37, 11]
|
|
1245
|
+
],
|
|
1246
|
+
partly: [
|
|
1247
|
+
[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],
|
|
1248
|
+
[28, 16, 32, 16],
|
|
1249
|
+
[9, 24, 6, 27],
|
|
1250
|
+
[6, 16, 2, 16],
|
|
1251
|
+
[9, 8, 6, 5],
|
|
1252
|
+
[17, 5, 17, 1],
|
|
1253
|
+
[25, 8, 28, 5],
|
|
1254
|
+
[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]
|
|
1255
|
+
],
|
|
1256
|
+
cloud: [
|
|
1257
|
+
[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]
|
|
1258
|
+
],
|
|
1259
|
+
fog: [
|
|
1260
|
+
[8, 16, 40, 16],
|
|
1261
|
+
[12, 24, 36, 24],
|
|
1262
|
+
[8, 32, 40, 32]
|
|
1263
|
+
],
|
|
1264
|
+
rain: [
|
|
1265
|
+
[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],
|
|
1266
|
+
[15, 36, 12, 43],
|
|
1267
|
+
[24, 36, 21, 43],
|
|
1268
|
+
[33, 36, 30, 43]
|
|
1269
|
+
],
|
|
1270
|
+
snow: [
|
|
1271
|
+
[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],
|
|
1272
|
+
[14, 39, 14, 39],
|
|
1273
|
+
[24, 42, 24, 42],
|
|
1274
|
+
[34, 39, 34, 39],
|
|
1275
|
+
[19, 45, 19, 45],
|
|
1276
|
+
[29, 45, 29, 45]
|
|
1277
|
+
],
|
|
1278
|
+
storm: [
|
|
1279
|
+
[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],
|
|
1280
|
+
[26, 33, 20, 41, 27, 41, 22, 47]
|
|
1281
|
+
]
|
|
1282
|
+
};
|
|
1283
|
+
|
|
1178
1284
|
// src/ai/tools.ts
|
|
1179
1285
|
var import_zod10 = require("zod");
|
|
1180
1286
|
var telemetryGraphParameters = import_zod10.z.object({
|
|
@@ -1458,7 +1564,8 @@ THE SHAPE
|
|
|
1458
1564
|
|
|
1459
1565
|
BLOCKS \u2014 up to 12, drawn top to bottom. Each is one of:
|
|
1460
1566
|
|
|
1461
|
-
{ "type": "text", "value": V, "size": S, "align": A, "color": C, "suffix": "\xB0" }
|
|
1567
|
+
{ "type": "text", "value": V, "size": S, "align": A, "color": C, "prefix": "H ", "suffix": "\xB0" }
|
|
1568
|
+
{ "type": "icon", "value": V, "size": "sm"|"md"|"lg"|"xl", "align": A, "color": C }
|
|
1462
1569
|
{ "type": "dial", "value": V, "min": 0, "max": 100, "label": "CPU", "color": C }
|
|
1463
1570
|
{ "type": "bar", "value": V, "min": 0, "max": 100, "color": C }
|
|
1464
1571
|
{ "type": "sparkline", "series": V, "color": C }
|
|
@@ -1467,7 +1574,18 @@ BLOCKS \u2014 up to 12, drawn top to bottom. Each is one of:
|
|
|
1467
1574
|
0110
|
|
1468
1575
|
1100
|
|
1469
1576
|
0011", "align": A }
|
|
1470
|
-
{ "type": "group", "direction": "row"|"stack", "gap": 8, "align": A, "children": [ ...leaves... ] }
|
|
1577
|
+
{ "type": "group", "direction": "row"|"stack", "gap": 8, "align": A, "pack": true, "children": [ ...leaves... ] }
|
|
1578
|
+
|
|
1579
|
+
A row splits the width into equal cells. Add "pack": true and each child takes
|
|
1580
|
+
only its own width, "gap" apart \u2014 a number with its icon right beside it, or
|
|
1581
|
+
"H 68\xB0 L 56\xB0" as one line. Put "valign": "center" at the top level of the
|
|
1582
|
+
document to centre the blocks on the screen rather than start at the top.
|
|
1583
|
+
|
|
1584
|
+
AN ICON is the sky drawn in outline: "sun", "partly", "cloud", "fog", "rain",
|
|
1585
|
+
"snow" or "storm". Bind its value to a weather source's "icon" field so it
|
|
1586
|
+
follows the weather \u2014 { "source": "forecast", "field": "icon" } \u2014 or write one
|
|
1587
|
+
of those names as a literal. Sizes are 24, 48, 72 and 96 pixels square. Prefer
|
|
1588
|
+
it to drawing a weather sprite: it costs nothing and the board draws it crisply.
|
|
1471
1589
|
|
|
1472
1590
|
DRAWING A SPRITE \u2014 you may, and here is the only form that works.
|
|
1473
1591
|
|
|
@@ -1549,7 +1667,7 @@ SOURCES \u2014 declare what the app reads, then bind to it by name:
|
|
|
1549
1667
|
|
|
1550
1668
|
"forecast": { "kind": "weather", "latitude": 39.95, "longitude": -75.17,
|
|
1551
1669
|
"units": "imperial", "refreshSeconds": 600 }
|
|
1552
|
-
fields: temperature, condition, high, low
|
|
1670
|
+
fields: temperature, condition, icon, high, low
|
|
1553
1671
|
"now": { "kind": "clock", "timezone": "America/New_York", "twentyFourHour": false }
|
|
1554
1672
|
fields: time, date, weekday, hour (hour is 0-23, for rules about time of day)
|
|
1555
1673
|
"until": { "kind": "countdown", "target": "2026-12-25", "label": "Christmas" }
|
|
@@ -1970,6 +2088,7 @@ var EXCLUDED_SOURCES = {
|
|
|
1970
2088
|
AppDialSchema,
|
|
1971
2089
|
AppDocumentSchema,
|
|
1972
2090
|
AppGroupSchema,
|
|
2091
|
+
AppIconSchema,
|
|
1973
2092
|
AppImageSchema,
|
|
1974
2093
|
AppLeafSchema,
|
|
1975
2094
|
AppOperandSchema,
|
|
@@ -2047,6 +2166,9 @@ var EXCLUDED_SOURCES = {
|
|
|
2047
2166
|
FloraTelemetrySchema,
|
|
2048
2167
|
GENESIS_LIBRARY_CONTEXT,
|
|
2049
2168
|
GENESIS_VALID_COMPONENTS,
|
|
2169
|
+
ICON_GRID,
|
|
2170
|
+
ICON_SIZE_PX,
|
|
2171
|
+
ICON_STROKE,
|
|
2050
2172
|
IMAGE_MAX_DRAWN,
|
|
2051
2173
|
IMAGE_MAX_SCALE,
|
|
2052
2174
|
IMPACT_FLAG_THRESHOLD,
|
|
@@ -2108,6 +2230,9 @@ var EXCLUDED_SOURCES = {
|
|
|
2108
2230
|
TriggerSchema,
|
|
2109
2231
|
UserSchema,
|
|
2110
2232
|
VitalSourceSchema,
|
|
2233
|
+
WEATHER_CODES,
|
|
2234
|
+
WEATHER_ICONS,
|
|
2235
|
+
WEATHER_ICON_NAMES,
|
|
2111
2236
|
WeatherAppConfigSchema,
|
|
2112
2237
|
WorkflowSchema,
|
|
2113
2238
|
architectureReferenceParameters,
|