@keemakr/ui-sdk 1.5.0-dev-20261023090149 → 1.5.0-dev-20261023132057

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/conform.js CHANGED
@@ -10,6 +10,8 @@
10
10
  // - `tone: 'info' | 'accent'` (badge cells, tags, board columns, calendar entries, progress
11
11
  // bars; after 1.4.0) -> 'default', or the first tone that parse lists
12
12
  // - a string `min`/`max` on a date or datetime field (after 1.4.0) -> dropped
13
+ // - an image's or video's portrait `aspect: '3:4' | '9:16'` (after 1.4.0)
14
+ // -> 'auto', so the picture keeps its own shape
13
15
  // - a chart with more points than the parse takes (120 after 1.4.0, 50 before)
14
16
  // -> thinned to that many evenly spaced points,
15
17
  // first and last kept (chart.ts)
@@ -211,6 +213,18 @@ export function conformTree(tree, parser, options) {
211
213
  fallbacks.push({ path: pathText(path), type: 'chartType', reason: 'parse', as: 'folded' });
212
214
  return true;
213
215
  }
216
+ if (key === 'aspect' &&
217
+ issue.code === 'invalid_value' &&
218
+ isObject(holder) &&
219
+ (holder.type === 'image' || holder.type === 'video') &&
220
+ holder.aspect !== 'auto' &&
221
+ (issue.values ?? []).includes('auto')) {
222
+ // A portrait photograph cropped to a landscape box loses what it shows; `auto` draws it at
223
+ // its own shape, which for a portrait picture is the shape the module asked for.
224
+ holder.aspect = 'auto';
225
+ fallbacks.push({ path: pathText(path), type: 'aspect', reason: 'parse', as: 'folded' });
226
+ return true;
227
+ }
214
228
  if ((key === 'min' || key === 'max') && isObject(holder) && key in holder) {
215
229
  delete holder[key];
216
230
  fallbacks.push({ path: pathText(path), type: String(key), reason: 'parse', as: 'folded' });
package/dist/index.d.ts CHANGED
@@ -25,8 +25,8 @@ export { stackedBarParts, stackedBarValue } from './stacked-bar.js';
25
25
  export type { StackedBarLike, StackedBarParts, StackedBarSegmentPart } from './stacked-bar.js';
26
26
  export { statTrend } from './stat.js';
27
27
  export type { StatTrend, StatTrendFeel, StatTrendLike } from './stat.js';
28
- export { createSectionMemory, sectionCollapsible, sectionColumnWeights, sectionGridTemplate, } from './section.js';
29
- export type { SectionLike, SectionMemory } from './section.js';
28
+ export { createSectionMemory, sectionBadge, sectionCollapsible, sectionColumnWeights, sectionGridTemplate, sectionScrollHeight, } from './section.js';
29
+ export type { SectionBadge, SectionLike, SectionMemory, SectionScrollHeight } from './section.js';
30
30
  export { TIMELINE_ICONS, timelineIconWord } from './timeline.js';
31
31
  export type { TimelineIcon } from './timeline.js';
32
32
  export { composerPress, composerShortcut } from './composer.js';
package/dist/index.js CHANGED
@@ -23,7 +23,7 @@ export { heatmapCellText, heatmapIntensity, heatmapMixPercent, heatmapRange, hea
23
23
  export { formPress, formSubmits, initialDraft, isoToLocalInput, localInputToIso, postedValue, } from './form.js';
24
24
  export { stackedBarParts, stackedBarValue } from './stacked-bar.js';
25
25
  export { statTrend } from './stat.js';
26
- export { createSectionMemory, sectionCollapsible, sectionColumnWeights, sectionGridTemplate, } from './section.js';
26
+ export { createSectionMemory, sectionBadge, sectionCollapsible, sectionColumnWeights, sectionGridTemplate, sectionScrollHeight, } from './section.js';
27
27
  export { TIMELINE_ICONS, timelineIconWord } from './timeline.js';
28
28
  export { composerPress, composerShortcut } from './composer.js';
29
29
  export { addDays, calendarDays, dayStartMs, entriesOnDay, intlTimeZone, isTimeZone, placeEntries, shiftCalendarDate, slotIsFree, slotTimes, todayIn, } from './calendar.js';
package/dist/schema.d.ts CHANGED
@@ -1403,6 +1403,8 @@ declare const leafNodeSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
1403
1403
  "1:1": "1:1";
1404
1404
  "4:3": "4:3";
1405
1405
  "16:9": "16:9";
1406
+ "3:4": "3:4";
1407
+ "9:16": "9:16";
1406
1408
  }>>;
1407
1409
  fit: z.ZodDefault<z.ZodEnum<{
1408
1410
  cover: "cover";
@@ -1442,6 +1444,8 @@ declare const leafNodeSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
1442
1444
  "1:1": "1:1";
1443
1445
  "4:3": "4:3";
1444
1446
  "16:9": "16:9";
1447
+ "3:4": "3:4";
1448
+ "9:16": "9:16";
1445
1449
  }>>;
1446
1450
  }, z.core.$strip>, z.ZodObject<{
1447
1451
  type: z.ZodLiteral<"dataset">;
@@ -1495,6 +1499,9 @@ export type ScreenNode = LeafScreenNode | {
1495
1499
  weights?: number[];
1496
1500
  collapsible?: boolean;
1497
1501
  collapsed?: boolean;
1502
+ scrollHeight?: 'short' | 'medium' | 'tall';
1503
+ badge?: string;
1504
+ badgeTone?: 'default' | 'success' | 'warning' | 'destructive' | 'info' | 'accent';
1498
1505
  children: ScreenNode[];
1499
1506
  };
1500
1507
  type ScreenNodeInput = LeafScreenNodeInput | {
@@ -1511,6 +1518,9 @@ type ScreenNodeInput = LeafScreenNodeInput | {
1511
1518
  weights?: number[];
1512
1519
  collapsible?: boolean;
1513
1520
  collapsed?: boolean;
1521
+ scrollHeight?: 'short' | 'medium' | 'tall';
1522
+ badge?: string;
1523
+ badgeTone?: 'default' | 'success' | 'warning' | 'destructive' | 'info' | 'accent';
1514
1524
  children: ScreenNodeInput[];
1515
1525
  };
1516
1526
  /**
package/dist/schema.js CHANGED
@@ -1205,7 +1205,12 @@ export const mediaPathSchema = z
1205
1205
  .string()
1206
1206
  .max(256)
1207
1207
  .regex(/^[A-Za-z0-9][A-Za-z0-9._-]*(\/[A-Za-z0-9][A-Za-z0-9._-]*)*$/, 'a relative path of letters, digits, ".", "_" and "-", never a URL');
1208
- const aspect = z.enum(['auto', '1:1', '4:3', '16:9']);
1208
+ /**
1209
+ * The shape an `image` or `video` is drawn at. `3:4` and `9:16` are portrait:
1210
+ * a clinical photograph, a phone-shot video. A client whose parse predates them
1211
+ * gets `auto` instead (conform.ts), so the picture keeps its own shape.
1212
+ */
1213
+ const aspect = z.enum(['auto', '1:1', '4:3', '16:9', '3:4', '9:16']);
1209
1214
  /**
1210
1215
  * A picture from the module's runtime: a document scan, a creative to
1211
1216
  * approve, a product photo. PNG, JPEG, WebP, GIF or AVIF, up to 10 MB; never
@@ -1898,6 +1903,14 @@ const sectionShape = (children) => z.object({
1898
1903
  * above its reply box.
1899
1904
  */
1900
1905
  scroll: z.boolean().default(false),
1906
+ /**
1907
+ * How tall a `scroll` section may grow before it scrolls: `short` (a few
1908
+ * lines: recent messages beside a brief), `medium` (the default, as a
1909
+ * `scroll` section has always been) or `tall` (most of the screen). The
1910
+ * renderer turns each into a height that fits its screen; a module never
1911
+ * names pixels. Needs `scroll: true`.
1912
+ */
1913
+ scrollHeight: z.enum(['short', 'medium', 'tall']).optional(),
1901
1914
  /**
1902
1915
  * `card` draws the section as a bordered card; `plain` (the default) does
1903
1916
  * not. Core's own renderer has always framed sections lightly and keeps
@@ -1931,6 +1944,13 @@ const sectionShape = (children) => z.object({
1931
1944
  * `collapsible`. Default false.
1932
1945
  */
1933
1946
  collapsed: z.boolean().optional(),
1947
+ /**
1948
+ * A short count beside the title, as a tab carries one: "4 to confirm",
1949
+ * "12". It says what it counts in words, so it reads alone. Needs a `title`.
1950
+ */
1951
+ badge: z.string().min(1).max(24).optional(),
1952
+ /** Colours the `badge`: an amber queue, a red overdue count. Needs `badge`. Default `default`. */
1953
+ badgeTone: tone.optional(),
1934
1954
  children: z.array(children).max(100),
1935
1955
  });
1936
1956
  /** The rules between a section's fields, which a field's own schema cannot state. */
@@ -1972,6 +1992,27 @@ function checkSection(node, ctx) {
1972
1992
  message: 'collapsed needs collapsible',
1973
1993
  });
1974
1994
  }
1995
+ if (node.scrollHeight !== undefined && !node.scroll) {
1996
+ ctx.addIssue({
1997
+ code: 'custom',
1998
+ path: ['scrollHeight'],
1999
+ message: 'scrollHeight needs scroll: true',
2000
+ });
2001
+ }
2002
+ if (node.badge !== undefined && !node.title) {
2003
+ ctx.addIssue({
2004
+ code: 'custom',
2005
+ path: ['badge'],
2006
+ message: 'a section badge sits beside its title, so it needs a title',
2007
+ });
2008
+ }
2009
+ if (node.badgeTone !== undefined && node.badge === undefined) {
2010
+ ctx.addIssue({
2011
+ code: 'custom',
2012
+ path: ['badgeTone'],
2013
+ message: 'badgeTone needs badge',
2014
+ });
2015
+ }
1975
2016
  }
1976
2017
  const sectionBranch = (children) => sectionShape(children).superRefine(checkSection);
1977
2018
  /**
package/dist/section.d.ts CHANGED
@@ -10,6 +10,10 @@ export interface SectionLike {
10
10
  weights?: readonly number[];
11
11
  collapsible?: boolean;
12
12
  collapsed?: boolean;
13
+ scroll?: boolean;
14
+ scrollHeight?: string;
15
+ badge?: string;
16
+ badgeTone?: string;
13
17
  }
14
18
  /**
15
19
  * One relative width per column of a `grid` section: its `weights` when they
@@ -41,3 +45,21 @@ export interface SectionMemory {
41
45
  setOpen(section: SectionLike, open: boolean): void;
42
46
  }
43
47
  export declare function createSectionMemory(): SectionMemory;
48
+ /** How tall a scrolling section may grow: the renderer turns each into its own height. */
49
+ export type SectionScrollHeight = 'short' | 'medium' | 'tall';
50
+ /**
51
+ * How tall a `scroll` section may grow before it scrolls, or undefined for a section that does
52
+ * not scroll. A scroll section without `scrollHeight`, or with a value this rule does not know,
53
+ * is `medium`: the height a scroll section has always had.
54
+ */
55
+ export declare function sectionScrollHeight(section: SectionLike): SectionScrollHeight | undefined;
56
+ /** The badge beside a section's title: its words and its tone. */
57
+ export interface SectionBadge {
58
+ label: string;
59
+ tone: 'default' | 'success' | 'warning' | 'destructive' | 'info' | 'accent';
60
+ }
61
+ /**
62
+ * The badge beside a section's title ("4 to confirm"), or undefined when it has none or no title
63
+ * to sit beside. A tone this rule does not know is `default`, so the words still show.
64
+ */
65
+ export declare function sectionBadge(section: SectionLike): SectionBadge | undefined;
package/dist/section.js CHANGED
@@ -1,5 +1,5 @@
1
- // Renderer-side helpers for a `section`'s column weights and its open/closed
2
- // state. They live in the SDK because core and every client draw sections:
1
+ // Renderer-side helpers for a `section`'s column weights, its open/closed
2
+ // state, its scroll height and the badge beside its title. They live in the SDK because core and every client draw sections:
3
3
  // how wide a weighted column is, and when a collapsible section starts closed,
4
4
  // must be one rule, or a panel opens on the phone that stays shut on the web.
5
5
  /**
@@ -51,3 +51,31 @@ export function createSectionMemory() {
51
51
  },
52
52
  };
53
53
  }
54
+ const SCROLL_HEIGHTS = ['short', 'medium', 'tall'];
55
+ /**
56
+ * How tall a `scroll` section may grow before it scrolls, or undefined for a section that does
57
+ * not scroll. A scroll section without `scrollHeight`, or with a value this rule does not know,
58
+ * is `medium`: the height a scroll section has always had.
59
+ */
60
+ export function sectionScrollHeight(section) {
61
+ if (section.scroll !== true)
62
+ return undefined;
63
+ const height = section.scrollHeight;
64
+ return typeof height === 'string' && SCROLL_HEIGHTS.includes(height)
65
+ ? height
66
+ : 'medium';
67
+ }
68
+ const TONES = ['default', 'success', 'warning', 'destructive', 'info', 'accent'];
69
+ /**
70
+ * The badge beside a section's title ("4 to confirm"), or undefined when it has none or no title
71
+ * to sit beside. A tone this rule does not know is `default`, so the words still show.
72
+ */
73
+ export function sectionBadge(section) {
74
+ const { badge, badgeTone, title } = section;
75
+ if (typeof badge !== 'string' || badge.trim() === '')
76
+ return undefined;
77
+ if (typeof title !== 'string' || title === '')
78
+ return undefined;
79
+ const tone = typeof badgeTone === 'string' && TONES.includes(badgeTone) ? badgeTone : 'default';
80
+ return { label: badge, tone: tone };
81
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@keemakr/ui-sdk",
3
- "version": "1.5.0-dev-20261023090149",
3
+ "version": "1.5.0-dev-20261023132057",
4
4
  "description": "Product screens for keemakr marketplace modules: a versioned, server-driven UI tree schema plus defineScreen() handlers. Module code never ships to the browser — keemakr-core validates the tree and renders it with platform components.",
5
5
  "license": "MIT",
6
6
  "type": "module",