@glasshome/ui 1.1.2 → 1.3.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.
@@ -0,0 +1,38 @@
1
+ /**
2
+ * Where a row dragged by dy lands: cross into a neighbor once the pointer
3
+ * passes half that neighbor's height, using live measured heights so rows of
4
+ * different sizes (e.g. one expanded) count at their real size.
5
+ */
6
+ export declare function dragTargetIndex(heights: number[], from: number, dy: number): number;
7
+ export interface ListReorderOptions {
8
+ /** Live row count; row elements beyond it are ignored. */
9
+ count: () => number;
10
+ /** Commit a completed drag (or keyboard move). Indices are pre-move. */
11
+ onReorder: (from: number, to: number) => void;
12
+ /** Fires when a drag actually activates (e.g. collapse the dragged row). */
13
+ onDragStart?: (index: number) => void;
14
+ /** Vertical gap between rows in px; neighbors shift by height + gap. */
15
+ gapPx?: number;
16
+ }
17
+ export interface ListReorder {
18
+ /** Attach as each row's ref so heights can be measured live. */
19
+ setRowEl: (index: number, el: HTMLElement) => void;
20
+ /**
21
+ * Wire to pointerdown. immediate: a dedicated handle, drags at once, any
22
+ * pointer type. Non-immediate: a whole clickable row, mouse/pen only
23
+ * (touch must keep scrolling) and only past a movement threshold so plain
24
+ * clicks keep their meaning.
25
+ */
26
+ startDrag: (index: number, e: PointerEvent, immediate: boolean) => void;
27
+ /** Inline style for a row: the dragged row follows the pointer, rows
28
+ * between origin and target shift one slot. Undefined when idle. */
29
+ rowStyle: (index: number) => Record<string, string | number> | undefined;
30
+ /** Index being dragged, undefined when idle. */
31
+ draggingIndex: () => number | undefined;
32
+ /** True from drag activation until the click that follows pointerup has
33
+ * passed; row click/toggle handlers must ignore that click. */
34
+ isToggleSuppressed: () => boolean;
35
+ }
36
+ /** Pointer-driven vertical list reorder. Rendering-agnostic: the consumer owns
37
+ * the rows and applies rowStyle; this owns pointer tracking and drop math. */
38
+ export declare function createListReorder(opts: ListReorderOptions): ListReorder;
@@ -1,5 +1,40 @@
1
1
  import type { JSONSchema7 } from "json-schema";
2
2
  import { type IconPickerProps } from "./icon-picker.js";
3
+ export interface ExtendedJSONSchema extends JSONSchema7 {
4
+ /** Explicit control choice from the SDK's field.* helpers. */
5
+ formType?: string;
6
+ domain?: string;
7
+ singleSelect?: boolean;
8
+ deviceClass?: string;
9
+ /** formType "variants": the property that selects the active branch. */
10
+ discriminator?: string;
11
+ /** formType "variants": kind → display name for the discriminator Select. */
12
+ labels?: Record<string, string>;
13
+ /** formType "list": add-button caption. */
14
+ addLabel?: string;
15
+ /** formType "list": item field whose value captions the collapsed row. */
16
+ labelField?: string;
17
+ }
18
+ /**
19
+ * formType values with a dedicated renderer branch. Any other formType renders
20
+ * a read-only "needs a newer dashboard" notice instead of a broken control
21
+ * (widgets auto-update independently of the host, so an old host WILL meet
22
+ * schemas with formTypes it predates). Kept in lockstep with the SDK's field
23
+ * helpers by dash's formType parity test.
24
+ */
25
+ export declare const SCHEMA_FORM_FORM_TYPES: readonly ["icon-picker", "area-picker", "list", "variants"];
26
+ /**
27
+ * New-item defaults from the wire schema: the serialized `default` when the
28
+ * SDK provided one (field.variants always does), else property defaults; for
29
+ * a variants item without a default, the first branch seeded by its
30
+ * discriminator const.
31
+ */
32
+ export declare function extractItemDefaults(schema: ExtendedJSONSchema): Record<string, unknown>;
33
+ /**
34
+ * Switching kind keeps current values for keys the new branch also declares
35
+ * (matched by name) and drops the rest; missing keys take the branch defaults.
36
+ */
37
+ export declare function switchVariantValue(branch: ExtendedJSONSchema, discriminator: string, kind: string, current: Record<string, unknown>): Record<string, unknown>;
3
38
  interface SchemaFormProps {
4
39
  schema: JSONSchema7;
5
40
  data: Record<string, unknown>;
@@ -7,6 +42,7 @@ interface SchemaFormProps {
7
42
  errors?: string[];
8
43
  /** Passed through to IconPicker for formType: "icon-picker" fields. */
9
44
  searchIcons?: IconPickerProps["searchIcons"];
45
+ class?: string;
10
46
  }
11
47
  export declare function SchemaForm(props: SchemaFormProps): import("solid-js").JSX.Element;
12
48
  export {};
@@ -12,6 +12,7 @@ type SectionCardProps = {
12
12
  action?: JSX.Element;
13
13
  toolbar?: JSX.Element;
14
14
  headerClass?: string;
15
+ subtitleClass?: string;
15
16
  class?: string;
16
17
  glass?: GlassSurface;
17
18
  children: JSX.Element;
@@ -11,6 +11,17 @@ interface SliderProps {
11
11
  class?: string;
12
12
  trackClass?: string;
13
13
  thumbClass?: string;
14
+ /** Per-thumb background color, index-matched to value[]. Color only; the thumb keeps its material. */
15
+ thumbColors?: string[];
16
+ /**
17
+ * Fill tint. A single color swaps --glass-tone; a pair runs a horizontal
18
+ * two-tone wash via the glass tone-2 knobs. The fill stays the one glass
19
+ * material either way.
20
+ */
21
+ fillTone?: string | [string, string];
22
+ /** Value-positioned tick annotations on the track (e.g. a current-temperature reading). */
23
+ markers?: number[];
24
+ minStepsBetweenThumbs?: number;
14
25
  "aria-label"?: string;
15
26
  "aria-labelledby"?: string;
16
27
  }
@@ -33,7 +33,7 @@ function s(e, t) {
33
33
  mutedForeground: t === "light" ? "oklch(0.44 0 0)" : "oklch(0.71 0 0)",
34
34
  input: t === "light" ? a(e.border, .01) : a(e.border, .04),
35
35
  ring: e.accent,
36
- destructive: t === "light" ? "oklch(0.629 0.1902 23.0704)" : "oklch(0.7106 0.1661 22.2162)"
36
+ destructive: t === "light" ? "oklch(0.54 0.19 23.0704)" : "oklch(0.7106 0.1661 22.2162)"
37
37
  };
38
38
  }
39
39
  function c(e) {
@@ -141,8 +141,8 @@ var x = [
141
141
  muted: "oklch(0.9702 0.008 250)",
142
142
  mutedForeground: "oklch(0.34 0 0)",
143
143
  input: "oklch(0.9 0.012 250)",
144
- ring: "oklch(0.6 0.2 195)",
145
- destructive: "oklch(0.629 0.1902 23.0704)"
144
+ ring: "oklch(0.53 0.18 195)",
145
+ destructive: "oklch(0.54 0.19 23.0704)"
146
146
  },
147
147
  dark: {
148
148
  primary: "oklch(0.48 0.2 215.221)",