@glasshome/widget-sdk 1.26.0 → 1.27.1
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 +11 -0
- package/dist/deprecations.js +7 -0
- package/dist/export-history.json +288 -0
- package/dist/framework/hooks/use-reduced-motion.d.ts +2 -1
- package/dist/index.js +324 -305
- package/dist/theme.d.ts +4 -6
- package/dist/types.d.ts +4 -0
- package/guide/widgets.md +4 -3
- package/package.json +2 -2
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.
|
package/dist/deprecations.js
CHANGED
|
@@ -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) {
|
package/dist/export-history.json
CHANGED
|
@@ -5422,5 +5422,293 @@
|
|
|
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"
|
|
5569
|
+
],
|
|
5570
|
+
"1.27.1": [
|
|
5571
|
+
"Badge",
|
|
5572
|
+
"Button",
|
|
5573
|
+
"ButtonGroup",
|
|
5574
|
+
"Carousel",
|
|
5575
|
+
"CarouselContent",
|
|
5576
|
+
"CarouselDots",
|
|
5577
|
+
"CarouselItem",
|
|
5578
|
+
"CarouselNext",
|
|
5579
|
+
"CarouselPrevious",
|
|
5580
|
+
"ColorDisc",
|
|
5581
|
+
"ColorSlider",
|
|
5582
|
+
"ColorWheel",
|
|
5583
|
+
"CountPill",
|
|
5584
|
+
"Icon",
|
|
5585
|
+
"Input",
|
|
5586
|
+
"Label",
|
|
5587
|
+
"PanelEntityRow",
|
|
5588
|
+
"PanelFacts",
|
|
5589
|
+
"PanelRow",
|
|
5590
|
+
"PanelRows",
|
|
5591
|
+
"PanelSection",
|
|
5592
|
+
"Progress",
|
|
5593
|
+
"ResponsiveDialog",
|
|
5594
|
+
"ResponsiveDialogBody",
|
|
5595
|
+
"ResponsiveDialogClose",
|
|
5596
|
+
"ResponsiveDialogContent",
|
|
5597
|
+
"ResponsiveDialogDescription",
|
|
5598
|
+
"ResponsiveDialogFooter",
|
|
5599
|
+
"ResponsiveDialogHeader",
|
|
5600
|
+
"ResponsiveDialogTitle",
|
|
5601
|
+
"SDK_VERSION",
|
|
5602
|
+
"SchemaForm",
|
|
5603
|
+
"SectionIcon",
|
|
5604
|
+
"SectionTitle",
|
|
5605
|
+
"Select",
|
|
5606
|
+
"SelectContent",
|
|
5607
|
+
"SelectItem",
|
|
5608
|
+
"SelectTrigger",
|
|
5609
|
+
"SelectValue",
|
|
5610
|
+
"Slider",
|
|
5611
|
+
"SwatchPicker",
|
|
5612
|
+
"Switch",
|
|
5613
|
+
"Tabs",
|
|
5614
|
+
"TabsContent",
|
|
5615
|
+
"TabsList",
|
|
5616
|
+
"TabsTrigger",
|
|
5617
|
+
"TemperatureBar",
|
|
5618
|
+
"Toggle",
|
|
5619
|
+
"ToggleGroup",
|
|
5620
|
+
"ToggleGroupItem",
|
|
5621
|
+
"ToneSchema",
|
|
5622
|
+
"Widget",
|
|
5623
|
+
"WidgetAction",
|
|
5624
|
+
"WidgetBackdrop",
|
|
5625
|
+
"WidgetChip",
|
|
5626
|
+
"WidgetChoice",
|
|
5627
|
+
"WidgetContent",
|
|
5628
|
+
"WidgetControls",
|
|
5629
|
+
"WidgetCtx",
|
|
5630
|
+
"WidgetDebugTab",
|
|
5631
|
+
"WidgetDebugView",
|
|
5632
|
+
"WidgetDialog",
|
|
5633
|
+
"WidgetGlyph",
|
|
5634
|
+
"WidgetHead",
|
|
5635
|
+
"WidgetHero",
|
|
5636
|
+
"WidgetIcon",
|
|
5637
|
+
"WidgetLayer",
|
|
5638
|
+
"WidgetManifestSchema",
|
|
5639
|
+
"WidgetSizeCtx",
|
|
5640
|
+
"WidgetSliderFill",
|
|
5641
|
+
"WidgetStatus",
|
|
5642
|
+
"WidgetStepper",
|
|
5643
|
+
"WidgetTitle",
|
|
5644
|
+
"WidgetValue",
|
|
5645
|
+
"buildDebugData",
|
|
5646
|
+
"byDomain",
|
|
5647
|
+
"calculateLightGroup",
|
|
5648
|
+
"calculateSensorGroup",
|
|
5649
|
+
"copyText",
|
|
5650
|
+
"countActiveEntities",
|
|
5651
|
+
"defineConfig",
|
|
5652
|
+
"defineWidget",
|
|
5653
|
+
"deprecations",
|
|
5654
|
+
"field",
|
|
5655
|
+
"formatDeprecation",
|
|
5656
|
+
"formatSchemaError",
|
|
5657
|
+
"getEntityAttribute",
|
|
5658
|
+
"getForecasts",
|
|
5659
|
+
"getStream",
|
|
5660
|
+
"getWebRtcClientConfig",
|
|
5661
|
+
"hassMediaUrl",
|
|
5662
|
+
"imagePreset",
|
|
5663
|
+
"imageSrc",
|
|
5664
|
+
"imageUrl",
|
|
5665
|
+
"injectTokens",
|
|
5666
|
+
"isDark",
|
|
5667
|
+
"isEntityActive",
|
|
5668
|
+
"isPanelControllable",
|
|
5669
|
+
"mediaUrl",
|
|
5670
|
+
"monotoneCubicPath",
|
|
5671
|
+
"parseColor",
|
|
5672
|
+
"presetValue",
|
|
5673
|
+
"sendWebRtcCandidate",
|
|
5674
|
+
"startWebRtcSession",
|
|
5675
|
+
"state",
|
|
5676
|
+
"svgColors",
|
|
5677
|
+
"trackEntityHistory",
|
|
5678
|
+
"untrackEntityHistory",
|
|
5679
|
+
"useArea",
|
|
5680
|
+
"useCalendarEvents",
|
|
5681
|
+
"useCamera",
|
|
5682
|
+
"useConfirm",
|
|
5683
|
+
"useConnection",
|
|
5684
|
+
"useCopyText",
|
|
5685
|
+
"useCurrency",
|
|
5686
|
+
"useDaylight",
|
|
5687
|
+
"useEntities",
|
|
5688
|
+
"useEntity",
|
|
5689
|
+
"useEntityHistory",
|
|
5690
|
+
"useEntityStatistics",
|
|
5691
|
+
"useForecast",
|
|
5692
|
+
"useHassConfig",
|
|
5693
|
+
"useIntersectionPause",
|
|
5694
|
+
"useLocale",
|
|
5695
|
+
"useMaterial",
|
|
5696
|
+
"useReducedMotion",
|
|
5697
|
+
"useService",
|
|
5698
|
+
"useStore",
|
|
5699
|
+
"useTemperatureUnit",
|
|
5700
|
+
"useToggle",
|
|
5701
|
+
"useTurnOff",
|
|
5702
|
+
"useTurnOn",
|
|
5703
|
+
"useUnitSystem",
|
|
5704
|
+
"useWidgetContext",
|
|
5705
|
+
"useWidgetDashboard",
|
|
5706
|
+
"useWidgetDialog",
|
|
5707
|
+
"useWidgetDimensions",
|
|
5708
|
+
"useWidgetEntityGroup",
|
|
5709
|
+
"useWidgetGestures",
|
|
5710
|
+
"useWidgetViewer",
|
|
5711
|
+
"widgetFields",
|
|
5712
|
+
"z"
|
|
5425
5713
|
]
|
|
5426
5714
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { type Accessor } from "solid-js";
|
|
2
2
|
/**
|
|
3
|
-
* Reactive
|
|
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
|
*/
|