@glasshome/widget-sdk 1.20.0 → 1.21.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.
@@ -88,6 +88,14 @@ var e = "https://glasshome.app/docs/widget-sdk/config", t = [
88
88
  docsUrl: "https://glasshome.app/docs/widget-sdk/widget",
89
89
  sourcePattern: "<WidgetSliderFill[^>]*\\scolor="
90
90
  },
91
+ {
92
+ id: "internal-material-vars",
93
+ since: "1.21.0",
94
+ removeIn: "2.0.0",
95
+ replacement: "the --material-* variables on the materials page, or useMaterial()",
96
+ docsUrl: "https://glasshome.app/docs/widgets/widget-sdk/materials",
97
+ sourcePattern: "var\\(\\s*--(?:glass-[a-z0-9-]+|_[a-z0-9-]+|material-(?:depth|hue|reach|ink|ink-level|ink-lift|edge-width|edge-ink|edge-accent)(?![a-z0-9-]))"
98
+ },
91
99
  {
92
100
  id: "WidgetVariantConfig.layout",
93
101
  since: "1.18.0",
@@ -24,7 +24,8 @@ export declare function WidgetHero(props: {
24
24
  art?: JSX.Element;
25
25
  class?: string;
26
26
  }): JSX.Element;
27
- /** The tile's control row: beside the value on a wide tile, under it on a narrow one, hidden on a short one. */
27
+ /** The tile's control row: beside the value on a wide tile, under it on a narrow one, hidden on a short one.
28
+ A press here belongs to the row's controls; the widget only takes a hold from it. */
28
29
  export declare function WidgetControls(props: {
29
30
  children: JSX.Element;
30
31
  }): JSX.Element;
@@ -31,7 +31,7 @@ export interface WidgetDialogProps {
31
31
  controlsContent?: JSX.Element;
32
32
  /** What holding the tile opens: only what the tile cannot show (a group's members, colours, modes),
33
33
  as `PanelSection`s. It opens beside the tile, or from the bottom on a phone. A widget with nothing
34
- the tile lacks passes none, and holding it opens nothing. */
34
+ the tile lacks passes none, and holding it says there is nothing more. */
35
35
  sheet?: () => JSX.Element;
36
36
  /** The tile's look, worn by its sheet so the tile reads as growing open: its icon in the head,
37
37
  its tone in the glass, its picture (a room, an album cover) as a band behind the head. */
@@ -7,6 +7,8 @@
7
7
  */
8
8
  import type { GestureConfig } from "../types";
9
9
  type GestureOrientation = "horizontal" | "vertical" | "square";
10
+ /** A press that starts on a control inside a widget belongs to that control. */
11
+ export declare const INTERACTIVE = "button, a, input, select, textarea, [role=\"slider\"], [role=\"radio\"], [role=\"switch\"]";
10
12
  export interface GestureHandlers {
11
13
  onPointerDown: (e: PointerEvent) => void;
12
14
  onPointerMove: (e: PointerEvent) => void;
@@ -26,7 +28,7 @@ export interface GestureHandlers {
26
28
  dispose: () => void;
27
29
  /** Where a hold is filling from, relative to the element; `fired` once it opened. */
28
30
  hold?: () => HoldFlood | null;
29
- /** True while a hold does something. */
31
+ /** True while a hold opens something; the "nothing more here" answer does not count. */
30
32
  holds?: () => boolean;
31
33
  /** Keyboard door: Enter or Space taps, the context-menu key or Shift+F10 holds. */
32
34
  onKeyDown?: (e: KeyboardEvent) => void;
@@ -3,9 +3,10 @@
3
3
  *
4
4
  * Hooks for widget development: context, dialog, entity group.
5
5
  */
6
- export { type ReactiveWidgetContext, type ServiceCallFn, useWidgetContext, WidgetCtx, type WidgetDashboard, type WidgetViewer, type WidgetDimensions, } from "./use-widget-context";
6
+ export { type ReactiveWidgetContext, type ServiceCallFn, useWidgetContext, WidgetCtx, type WidgetDashboard, type WidgetMaterial, type WidgetViewer, type WidgetDimensions, } from "./use-widget-context";
7
7
  export { useWidgetDashboard } from "./use-widget-dashboard";
8
8
  export { useWidgetViewer } from "./use-widget-viewer";
9
+ export { useMaterial } from "./use-material";
9
10
  export { useWidgetDimensions, type WidgetDimensionsAccessor, WidgetSizeCtx, } from "./use-widget-dimensions";
10
11
  export { useIntersectionPause } from "./use-intersection-pause";
11
12
  export { type Daylight, type DaylightPhase, useDaylight } from "./use-daylight";
@@ -0,0 +1,4 @@
1
+ import { type WidgetMaterial } from "./use-widget-context";
2
+ /** The material the home is wearing, by id with its terms. Style from the
3
+ * public --material-* variables; read this to decide, never to paint. */
4
+ export declare function useMaterial(): () => WidgetMaterial;
@@ -1,3 +1,4 @@
1
+ import type { MaterialTerms } from "@glasshome/ui/tokens";
1
2
  /**
2
3
  * Reactive widget context.
3
4
  *
@@ -28,6 +29,11 @@ export interface WidgetViewer {
28
29
  /** The signed-in person's name, or null for a paired screen. */
29
30
  name: string | null;
30
31
  }
32
+ export interface WidgetMaterial {
33
+ /** The preset today; a shared material's id once materials can be shared. */
34
+ id: string;
35
+ terms: MaterialTerms;
36
+ }
31
37
  export interface ReactiveWidgetContext {
32
38
  updateConfig: (config: Record<string, unknown>) => void;
33
39
  /**
@@ -46,6 +52,8 @@ export interface ReactiveWidgetContext {
46
52
  dashboard?: () => WidgetDashboard;
47
53
  /** Who is looking. Absent on hosts that predate this field. */
48
54
  viewer?: () => WidgetViewer;
55
+ /** The material the home wears. Absent on hosts that predate this field. */
56
+ material?: () => WidgetMaterial;
49
57
  /** True when the household turned on Developer Mode; widget dialogs show Debug only then. */
50
58
  developer?: () => boolean;
51
59
  /** The tile's box on the page, so a held tile's sheet opens beside it. Absent: it opens centred. */
@@ -1,5 +1,5 @@
1
1
  import { type Accessor, type Setter } from "solid-js";
2
- /** What a widget's parts tell each other: whether its dialog has a sheet, and the look the sheet wears. */
2
+ /** What a widget's parts tell each other: whether its dialog has a sheet, the look the sheet wears, and a hold that found none. */
3
3
  export interface WidgetRegistry {
4
4
  hasSheet: Accessor<boolean>;
5
5
  setHasSheet: Setter<boolean>;
@@ -12,6 +12,9 @@ export interface WidgetRegistry {
12
12
  /** The head's icon. */
13
13
  icon: Accessor<string | undefined>;
14
14
  setIcon: Setter<string | undefined>;
15
+ /** A hold found no sheet: the shell says the widget has nothing more to show. */
16
+ nothingMore: Accessor<boolean>;
17
+ setNothingMore: Setter<boolean>;
15
18
  }
16
19
  /** `<Widget>` hands its parts a copy of the host context; this points the copy back at the original. */
17
20
  export declare const REGISTRY_KEY: unique symbol;
@@ -36,7 +36,7 @@ export { WidgetSliderFill } from "./backgrounds/WidgetSliderFill";
36
36
  export { type PanelFact, PanelFacts, PanelRow, type PanelRowProps, PanelRows, PanelSection, type PanelSlide, } from "./panel/panel";
37
37
  export { isPanelControllable, PanelEntityRow } from "./panel/panel-entity";
38
38
  export { buildDebugData, WidgetDebugTab, type WidgetDebugData, type WidgetDebugEntity, WidgetDebugView, WidgetDialog, type SheetTile, type WidgetDialogProps, type WidgetDialogTab, } from "./dialogs";
39
- export { type AggregationPreset, type ReactiveWidgetContext, type ServiceCallFn, type UseWidgetEntityGroupOptions, type UseWidgetEntityGroupResult, type Daylight, type DaylightPhase, useDaylight, useIntersectionPause, useReducedMotion, useWidgetContext, useWidgetDashboard, useWidgetViewer, useWidgetDialog, useWidgetDimensions, useWidgetEntityGroup, WidgetCtx, type WidgetDashboard, type WidgetViewer, type WidgetDialogReturn, type WidgetDimensions, type WidgetDimensionsAccessor, WidgetSizeCtx, } from "./hooks";
39
+ export { type AggregationPreset, type ReactiveWidgetContext, type ServiceCallFn, type UseWidgetEntityGroupOptions, type UseWidgetEntityGroupResult, type Daylight, type DaylightPhase, useDaylight, useIntersectionPause, useReducedMotion, useWidgetContext, useWidgetDashboard, useMaterial, useWidgetViewer, useWidgetDialog, useWidgetDimensions, useWidgetEntityGroup, WidgetCtx, type WidgetDashboard, type WidgetMaterial, type WidgetViewer, type WidgetDialogReturn, type WidgetDimensions, type WidgetDimensionsAccessor, WidgetSizeCtx, } from "./hooks";
40
40
  export { type GestureHandlers, useWidgetGestures } from "./gestures/use-widget-gestures";
41
41
  export { injectTokens, type SvgColorKey, svgColors, type Tone, ToneSchema } from "./theming";
42
42
  export { widgetFields } from "./fields";