@glasshome/widget-sdk 1.20.1 → 1.22.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",
@@ -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. */
@@ -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";