@glasshome/widget-sdk 1.25.2 → 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 +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/framework/hooks/use-widget-context.d.ts +5 -0
- package/dist/index.js +320 -284
- package/dist/theme.d.ts +4 -6
- package/dist/types.d.ts +4 -0
- package/guide/widgets.md +4 -3
- package/package.json +1 -1
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
|
@@ -5278,5 +5278,293 @@
|
|
|
5278
5278
|
"useWidgetViewer",
|
|
5279
5279
|
"widgetFields",
|
|
5280
5280
|
"z"
|
|
5281
|
+
],
|
|
5282
|
+
"1.26.0": [
|
|
5283
|
+
"Badge",
|
|
5284
|
+
"Button",
|
|
5285
|
+
"ButtonGroup",
|
|
5286
|
+
"Carousel",
|
|
5287
|
+
"CarouselContent",
|
|
5288
|
+
"CarouselDots",
|
|
5289
|
+
"CarouselItem",
|
|
5290
|
+
"CarouselNext",
|
|
5291
|
+
"CarouselPrevious",
|
|
5292
|
+
"ColorDisc",
|
|
5293
|
+
"ColorSlider",
|
|
5294
|
+
"ColorWheel",
|
|
5295
|
+
"CountPill",
|
|
5296
|
+
"Icon",
|
|
5297
|
+
"Input",
|
|
5298
|
+
"Label",
|
|
5299
|
+
"PanelEntityRow",
|
|
5300
|
+
"PanelFacts",
|
|
5301
|
+
"PanelRow",
|
|
5302
|
+
"PanelRows",
|
|
5303
|
+
"PanelSection",
|
|
5304
|
+
"Progress",
|
|
5305
|
+
"ResponsiveDialog",
|
|
5306
|
+
"ResponsiveDialogBody",
|
|
5307
|
+
"ResponsiveDialogClose",
|
|
5308
|
+
"ResponsiveDialogContent",
|
|
5309
|
+
"ResponsiveDialogDescription",
|
|
5310
|
+
"ResponsiveDialogFooter",
|
|
5311
|
+
"ResponsiveDialogHeader",
|
|
5312
|
+
"ResponsiveDialogTitle",
|
|
5313
|
+
"SDK_VERSION",
|
|
5314
|
+
"SchemaForm",
|
|
5315
|
+
"SectionIcon",
|
|
5316
|
+
"SectionTitle",
|
|
5317
|
+
"Select",
|
|
5318
|
+
"SelectContent",
|
|
5319
|
+
"SelectItem",
|
|
5320
|
+
"SelectTrigger",
|
|
5321
|
+
"SelectValue",
|
|
5322
|
+
"Slider",
|
|
5323
|
+
"SwatchPicker",
|
|
5324
|
+
"Switch",
|
|
5325
|
+
"Tabs",
|
|
5326
|
+
"TabsContent",
|
|
5327
|
+
"TabsList",
|
|
5328
|
+
"TabsTrigger",
|
|
5329
|
+
"TemperatureBar",
|
|
5330
|
+
"Toggle",
|
|
5331
|
+
"ToggleGroup",
|
|
5332
|
+
"ToggleGroupItem",
|
|
5333
|
+
"ToneSchema",
|
|
5334
|
+
"Widget",
|
|
5335
|
+
"WidgetAction",
|
|
5336
|
+
"WidgetBackdrop",
|
|
5337
|
+
"WidgetChip",
|
|
5338
|
+
"WidgetChoice",
|
|
5339
|
+
"WidgetContent",
|
|
5340
|
+
"WidgetControls",
|
|
5341
|
+
"WidgetCtx",
|
|
5342
|
+
"WidgetDebugTab",
|
|
5343
|
+
"WidgetDebugView",
|
|
5344
|
+
"WidgetDialog",
|
|
5345
|
+
"WidgetGlyph",
|
|
5346
|
+
"WidgetHead",
|
|
5347
|
+
"WidgetHero",
|
|
5348
|
+
"WidgetIcon",
|
|
5349
|
+
"WidgetLayer",
|
|
5350
|
+
"WidgetManifestSchema",
|
|
5351
|
+
"WidgetSizeCtx",
|
|
5352
|
+
"WidgetSliderFill",
|
|
5353
|
+
"WidgetStatus",
|
|
5354
|
+
"WidgetStepper",
|
|
5355
|
+
"WidgetTitle",
|
|
5356
|
+
"WidgetValue",
|
|
5357
|
+
"buildDebugData",
|
|
5358
|
+
"byDomain",
|
|
5359
|
+
"calculateLightGroup",
|
|
5360
|
+
"calculateSensorGroup",
|
|
5361
|
+
"copyText",
|
|
5362
|
+
"countActiveEntities",
|
|
5363
|
+
"defineConfig",
|
|
5364
|
+
"defineWidget",
|
|
5365
|
+
"deprecations",
|
|
5366
|
+
"field",
|
|
5367
|
+
"formatDeprecation",
|
|
5368
|
+
"formatSchemaError",
|
|
5369
|
+
"getEntityAttribute",
|
|
5370
|
+
"getForecasts",
|
|
5371
|
+
"getStream",
|
|
5372
|
+
"getWebRtcClientConfig",
|
|
5373
|
+
"hassMediaUrl",
|
|
5374
|
+
"imagePreset",
|
|
5375
|
+
"imageSrc",
|
|
5376
|
+
"imageUrl",
|
|
5377
|
+
"injectTokens",
|
|
5378
|
+
"isDark",
|
|
5379
|
+
"isEntityActive",
|
|
5380
|
+
"isPanelControllable",
|
|
5381
|
+
"mediaUrl",
|
|
5382
|
+
"monotoneCubicPath",
|
|
5383
|
+
"parseColor",
|
|
5384
|
+
"presetValue",
|
|
5385
|
+
"sendWebRtcCandidate",
|
|
5386
|
+
"startWebRtcSession",
|
|
5387
|
+
"state",
|
|
5388
|
+
"svgColors",
|
|
5389
|
+
"trackEntityHistory",
|
|
5390
|
+
"untrackEntityHistory",
|
|
5391
|
+
"useArea",
|
|
5392
|
+
"useCalendarEvents",
|
|
5393
|
+
"useCamera",
|
|
5394
|
+
"useConfirm",
|
|
5395
|
+
"useConnection",
|
|
5396
|
+
"useCopyText",
|
|
5397
|
+
"useCurrency",
|
|
5398
|
+
"useDaylight",
|
|
5399
|
+
"useEntities",
|
|
5400
|
+
"useEntity",
|
|
5401
|
+
"useEntityHistory",
|
|
5402
|
+
"useEntityStatistics",
|
|
5403
|
+
"useForecast",
|
|
5404
|
+
"useHassConfig",
|
|
5405
|
+
"useIntersectionPause",
|
|
5406
|
+
"useLocale",
|
|
5407
|
+
"useMaterial",
|
|
5408
|
+
"useReducedMotion",
|
|
5409
|
+
"useService",
|
|
5410
|
+
"useStore",
|
|
5411
|
+
"useTemperatureUnit",
|
|
5412
|
+
"useToggle",
|
|
5413
|
+
"useTurnOff",
|
|
5414
|
+
"useTurnOn",
|
|
5415
|
+
"useUnitSystem",
|
|
5416
|
+
"useWidgetContext",
|
|
5417
|
+
"useWidgetDashboard",
|
|
5418
|
+
"useWidgetDialog",
|
|
5419
|
+
"useWidgetDimensions",
|
|
5420
|
+
"useWidgetEntityGroup",
|
|
5421
|
+
"useWidgetGestures",
|
|
5422
|
+
"useWidgetViewer",
|
|
5423
|
+
"widgetFields",
|
|
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"
|
|
5281
5569
|
]
|
|
5282
5570
|
}
|
|
@@ -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
|
*/
|
|
@@ -62,6 +62,11 @@ export interface ReactiveWidgetContext {
|
|
|
62
62
|
onHoldable?: (holds: boolean) => void;
|
|
63
63
|
/** Host hook: a hold on this widget fired. Absent on hosts that predate this field. */
|
|
64
64
|
onHeld?: () => void;
|
|
65
|
+
/** Host hook: the widget's shell, its tone and its lift (null for the defaults); null when the shell goes. A host that sets it draws the shell's outer glow and shadow, and the widget draws none of its own. Absent on hosts that predate this field. */
|
|
66
|
+
onShell?: (shell: {
|
|
67
|
+
tone: string | null;
|
|
68
|
+
lift: number | null;
|
|
69
|
+
} | null) => void;
|
|
65
70
|
}
|
|
66
71
|
export declare const WidgetCtx: import("solid-js").Context<ReactiveWidgetContext | undefined>;
|
|
67
72
|
export declare function useWidgetContext(): ReactiveWidgetContext;
|