@glasshome/widget-sdk 1.26.0 → 1.27.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/README.md CHANGED
@@ -68,6 +68,17 @@ Provides a `@source` directive for Tailwind v4 so the compiler scans widget SDK
68
68
  @source "@glasshome/widget-sdk/tailwind-sources";
69
69
  ```
70
70
 
71
+ ## Dark mode
72
+
73
+ Style with Tailwind's `dark:` variant and the theme variables (`var(--foreground)`, `var(--card)`): they follow the home's mode in every engine and every SDK version. For logic, call `isDark()`; inside a memo or effect it runs again when the home switches mode. `matchMedia("(prefers-color-scheme: dark)")` answers the device's setting, which differs from the home's mode when the home follows a schedule or the sun.
74
+
75
+ ```tsx
76
+ import { isDark } from "@glasshome/widget-sdk";
77
+ import { createMemo } from "solid-js";
78
+
79
+ const palette = createMemo(() => (isDark() ? DARK_COLORS : LIGHT_COLORS));
80
+ ```
81
+
71
82
  ## Escape patterns, when widgets own their visual surface
72
83
 
73
84
  Most widgets route through the channel API: `<Widget tone>` / `<Widget color colorTo>` / `<Widget.Icon color>`. A small number of widgets intentionally own their entire visual surface and bypass the channel. These are supported escape patterns, not anti-patterns.
@@ -102,6 +102,13 @@ var e = "https://glasshome.app/docs/widget-sdk/config", t = [
102
102
  removeIn: "2.0.0",
103
103
  replacement: "WidgetVariantConfig.styles (container, class, cssVars)",
104
104
  docsUrl: "https://glasshome.app/docs/widgets/widget-sdk#variants"
105
+ },
106
+ {
107
+ id: "WidgetContext.theme",
108
+ since: "1.26.0",
109
+ removeIn: "2.0.0",
110
+ replacement: "isDark()",
111
+ docsUrl: "https://glasshome.app/docs/widgets/widget-api-reference"
105
112
  }
106
113
  ];
107
114
  function n(e) {
@@ -5422,5 +5422,149 @@
5422
5422
  "useWidgetViewer",
5423
5423
  "widgetFields",
5424
5424
  "z"
5425
+ ],
5426
+ "1.27.0": [
5427
+ "Badge",
5428
+ "Button",
5429
+ "ButtonGroup",
5430
+ "Carousel",
5431
+ "CarouselContent",
5432
+ "CarouselDots",
5433
+ "CarouselItem",
5434
+ "CarouselNext",
5435
+ "CarouselPrevious",
5436
+ "ColorDisc",
5437
+ "ColorSlider",
5438
+ "ColorWheel",
5439
+ "CountPill",
5440
+ "Icon",
5441
+ "Input",
5442
+ "Label",
5443
+ "PanelEntityRow",
5444
+ "PanelFacts",
5445
+ "PanelRow",
5446
+ "PanelRows",
5447
+ "PanelSection",
5448
+ "Progress",
5449
+ "ResponsiveDialog",
5450
+ "ResponsiveDialogBody",
5451
+ "ResponsiveDialogClose",
5452
+ "ResponsiveDialogContent",
5453
+ "ResponsiveDialogDescription",
5454
+ "ResponsiveDialogFooter",
5455
+ "ResponsiveDialogHeader",
5456
+ "ResponsiveDialogTitle",
5457
+ "SDK_VERSION",
5458
+ "SchemaForm",
5459
+ "SectionIcon",
5460
+ "SectionTitle",
5461
+ "Select",
5462
+ "SelectContent",
5463
+ "SelectItem",
5464
+ "SelectTrigger",
5465
+ "SelectValue",
5466
+ "Slider",
5467
+ "SwatchPicker",
5468
+ "Switch",
5469
+ "Tabs",
5470
+ "TabsContent",
5471
+ "TabsList",
5472
+ "TabsTrigger",
5473
+ "TemperatureBar",
5474
+ "Toggle",
5475
+ "ToggleGroup",
5476
+ "ToggleGroupItem",
5477
+ "ToneSchema",
5478
+ "Widget",
5479
+ "WidgetAction",
5480
+ "WidgetBackdrop",
5481
+ "WidgetChip",
5482
+ "WidgetChoice",
5483
+ "WidgetContent",
5484
+ "WidgetControls",
5485
+ "WidgetCtx",
5486
+ "WidgetDebugTab",
5487
+ "WidgetDebugView",
5488
+ "WidgetDialog",
5489
+ "WidgetGlyph",
5490
+ "WidgetHead",
5491
+ "WidgetHero",
5492
+ "WidgetIcon",
5493
+ "WidgetLayer",
5494
+ "WidgetManifestSchema",
5495
+ "WidgetSizeCtx",
5496
+ "WidgetSliderFill",
5497
+ "WidgetStatus",
5498
+ "WidgetStepper",
5499
+ "WidgetTitle",
5500
+ "WidgetValue",
5501
+ "buildDebugData",
5502
+ "byDomain",
5503
+ "calculateLightGroup",
5504
+ "calculateSensorGroup",
5505
+ "copyText",
5506
+ "countActiveEntities",
5507
+ "defineConfig",
5508
+ "defineWidget",
5509
+ "deprecations",
5510
+ "field",
5511
+ "formatDeprecation",
5512
+ "formatSchemaError",
5513
+ "getEntityAttribute",
5514
+ "getForecasts",
5515
+ "getStream",
5516
+ "getWebRtcClientConfig",
5517
+ "hassMediaUrl",
5518
+ "imagePreset",
5519
+ "imageSrc",
5520
+ "imageUrl",
5521
+ "injectTokens",
5522
+ "isDark",
5523
+ "isEntityActive",
5524
+ "isPanelControllable",
5525
+ "mediaUrl",
5526
+ "monotoneCubicPath",
5527
+ "parseColor",
5528
+ "presetValue",
5529
+ "sendWebRtcCandidate",
5530
+ "startWebRtcSession",
5531
+ "state",
5532
+ "svgColors",
5533
+ "trackEntityHistory",
5534
+ "untrackEntityHistory",
5535
+ "useArea",
5536
+ "useCalendarEvents",
5537
+ "useCamera",
5538
+ "useConfirm",
5539
+ "useConnection",
5540
+ "useCopyText",
5541
+ "useCurrency",
5542
+ "useDaylight",
5543
+ "useEntities",
5544
+ "useEntity",
5545
+ "useEntityHistory",
5546
+ "useEntityStatistics",
5547
+ "useForecast",
5548
+ "useHassConfig",
5549
+ "useIntersectionPause",
5550
+ "useLocale",
5551
+ "useMaterial",
5552
+ "useReducedMotion",
5553
+ "useService",
5554
+ "useStore",
5555
+ "useTemperatureUnit",
5556
+ "useToggle",
5557
+ "useTurnOff",
5558
+ "useTurnOn",
5559
+ "useUnitSystem",
5560
+ "useWidgetContext",
5561
+ "useWidgetDashboard",
5562
+ "useWidgetDialog",
5563
+ "useWidgetDimensions",
5564
+ "useWidgetEntityGroup",
5565
+ "useWidgetGestures",
5566
+ "useWidgetViewer",
5567
+ "widgetFields",
5568
+ "z"
5425
5569
  ]
5426
5570
  }
@@ -1,6 +1,7 @@
1
1
  import { type Accessor } from "solid-js";
2
2
  /**
3
- * Reactive `prefers-reduced-motion` accessor.
3
+ * Reactive reduced-motion accessor: true when the device asks for reduced motion or the home's
4
+ * Reduce motion setting is on (the `reduce-motion` class on <html>).
4
5
  *
5
6
  * SSR-safe: returns a constant `false` when `window`/`matchMedia` are absent.
6
7
  */