@glasshome/widget-sdk 1.17.1 → 1.18.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/dist/deprecations.js +7 -0
- package/dist/framework/components/anatomy.d.ts +1 -1
- package/dist/framework/design-system/z-index.d.ts +0 -1
- package/dist/framework/gestures/use-widget-gestures.d.ts +1 -1
- package/dist/framework/hooks/use-confirm.d.ts +1 -1
- package/dist/framework/index.d.ts +2 -2
- package/dist/framework/types.d.ts +47 -89
- package/dist/framework/utils/empty-state.d.ts +0 -43
- package/dist/framework/utils/index.d.ts +1 -2
- package/dist/framework/variants/built-in-variants.d.ts +2 -39
- package/dist/index.js +156 -202
- package/package.json +35 -30
- package/preview/host.tsx +4 -2
- package/preview/preview.html +8 -3
- package/dist/framework/variants/index.d.ts +0 -7
- package/dist/framework/variants/variant-utils.d.ts +0 -105
package/package.json
CHANGED
|
@@ -1,16 +1,31 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@glasshome/widget-sdk",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.18.1",
|
|
4
4
|
"description": "SDK for building GlassHome dashboard widgets with SolidJS",
|
|
5
5
|
"keywords": [
|
|
6
|
+
"dashboard",
|
|
6
7
|
"glasshome",
|
|
7
|
-
"
|
|
8
|
+
"home-assistant",
|
|
8
9
|
"sdk",
|
|
10
|
+
"smart-home",
|
|
9
11
|
"solidjs",
|
|
10
12
|
"vite",
|
|
11
|
-
"
|
|
12
|
-
|
|
13
|
-
|
|
13
|
+
"widget"
|
|
14
|
+
],
|
|
15
|
+
"homepage": "https://github.com/glasshome/widget-sdk#readme",
|
|
16
|
+
"bugs": {
|
|
17
|
+
"url": "https://github.com/glasshome/widget-sdk/issues"
|
|
18
|
+
},
|
|
19
|
+
"license": "MIT",
|
|
20
|
+
"author": "GlassHome Labs",
|
|
21
|
+
"repository": {
|
|
22
|
+
"type": "git",
|
|
23
|
+
"url": "https://github.com/glasshome/widget-sdk.git"
|
|
24
|
+
},
|
|
25
|
+
"files": [
|
|
26
|
+
"dist",
|
|
27
|
+
"preview",
|
|
28
|
+
"tailwind-sources.css"
|
|
14
29
|
],
|
|
15
30
|
"type": "module",
|
|
16
31
|
"sideEffects": false,
|
|
@@ -45,27 +60,21 @@
|
|
|
45
60
|
"./tailwind-sources": "./tailwind-sources.css",
|
|
46
61
|
"./package.json": "./package.json"
|
|
47
62
|
},
|
|
48
|
-
"
|
|
49
|
-
"
|
|
50
|
-
|
|
51
|
-
"tailwind-sources.css"
|
|
52
|
-
],
|
|
63
|
+
"publishConfig": {
|
|
64
|
+
"access": "public"
|
|
65
|
+
},
|
|
53
66
|
"scripts": {
|
|
54
67
|
"build": "vite build && tsc && bun scripts/check-host-singleton.ts",
|
|
55
68
|
"dev": "vite build --watch",
|
|
56
69
|
"test": "bun test src && vitest run",
|
|
57
70
|
"test:dom": "vitest run",
|
|
58
71
|
"test:dom:watch": "vitest",
|
|
59
|
-
"typecheck:test": "tsc --noEmit -p tsconfig.test.json"
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
"@glasshome/sync-layer": "0.9.0",
|
|
63
|
-
"@glasshome/ui": "1.20.0",
|
|
64
|
-
"solid-js": "^1.9.11"
|
|
72
|
+
"typecheck:test": "tsc --noEmit -p tsconfig.test.json",
|
|
73
|
+
"check:dead": "fallow dead-code --fail-on-issues",
|
|
74
|
+
"lint": "oxlint --type-aware . && oxfmt --check ."
|
|
65
75
|
},
|
|
66
76
|
"dependencies": {
|
|
67
77
|
"@glasshome/widget-contract": "0.3.0",
|
|
68
|
-
"@modular-forms/solid": "^0.25.1",
|
|
69
78
|
"@tailwindcss/vite": "^4.1.13",
|
|
70
79
|
"clsx": "^2.1.1",
|
|
71
80
|
"happy-dom": "^20.0.0",
|
|
@@ -75,27 +84,23 @@
|
|
|
75
84
|
"zod": "^4.1.13"
|
|
76
85
|
},
|
|
77
86
|
"devDependencies": {
|
|
78
|
-
"@glasshome/ui": "1.
|
|
87
|
+
"@glasshome/ui": "1.21.1",
|
|
79
88
|
"@solidjs/testing-library": "^0.8.10",
|
|
80
89
|
"@types/bun": "^1.4.0",
|
|
81
90
|
"@types/node": "^25.2.2",
|
|
91
|
+
"fallow": "3.17.0",
|
|
92
|
+
"oxfmt": "0.65.0",
|
|
93
|
+
"oxlint": "1.81.0",
|
|
94
|
+
"oxlint-tsgolint": "7.0.2001",
|
|
82
95
|
"typescript": "^7.0.2",
|
|
83
96
|
"vite": "^8.1.0",
|
|
84
97
|
"vite-plugin-solid": "^2.11.12",
|
|
85
98
|
"vitest": "^4.1.10"
|
|
86
99
|
},
|
|
87
|
-
"
|
|
88
|
-
"
|
|
89
|
-
"
|
|
90
|
-
|
|
91
|
-
"homepage": "https://github.com/glasshome/widget-sdk#readme",
|
|
92
|
-
"bugs": {
|
|
93
|
-
"url": "https://github.com/glasshome/widget-sdk/issues"
|
|
94
|
-
},
|
|
95
|
-
"author": "GlassHome Labs",
|
|
96
|
-
"license": "MIT",
|
|
97
|
-
"publishConfig": {
|
|
98
|
-
"access": "public"
|
|
100
|
+
"peerDependencies": {
|
|
101
|
+
"@glasshome/sync-layer": "0.9.1",
|
|
102
|
+
"@glasshome/ui": "1.21.1",
|
|
103
|
+
"solid-js": "^1.9.11"
|
|
99
104
|
},
|
|
100
105
|
"engines": {
|
|
101
106
|
"node": ">=18"
|
package/preview/host.tsx
CHANGED
|
@@ -4,7 +4,7 @@ import { render } from "solid-js/web";
|
|
|
4
4
|
|
|
5
5
|
function PreviewHost() {
|
|
6
6
|
const [isDark, setIsDark] = createSignal(false);
|
|
7
|
-
const [config
|
|
7
|
+
const [config] = createSignal(widget.manifest.defaultConfig || {});
|
|
8
8
|
|
|
9
9
|
const toggleDark = () => {
|
|
10
10
|
const next = !isDark();
|
|
@@ -86,4 +86,6 @@ function PreviewHost() {
|
|
|
86
86
|
);
|
|
87
87
|
}
|
|
88
88
|
|
|
89
|
-
|
|
89
|
+
const root = document.getElementById("root");
|
|
90
|
+
if (!root) throw new Error("preview: #root is missing");
|
|
91
|
+
render(() => <PreviewHost />, root);
|
package/preview/preview.html
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
<!
|
|
1
|
+
<!doctype html>
|
|
2
2
|
<html lang="en">
|
|
3
3
|
<head>
|
|
4
4
|
<meta charset="UTF-8" />
|
|
@@ -34,11 +34,16 @@
|
|
|
34
34
|
}
|
|
35
35
|
|
|
36
36
|
body {
|
|
37
|
-
font-family:
|
|
37
|
+
font-family:
|
|
38
|
+
system-ui,
|
|
39
|
+
-apple-system,
|
|
40
|
+
sans-serif;
|
|
38
41
|
background: var(--color-background);
|
|
39
42
|
color: var(--color-foreground);
|
|
40
43
|
min-height: 100vh;
|
|
41
|
-
transition:
|
|
44
|
+
transition:
|
|
45
|
+
background 0.2s,
|
|
46
|
+
color 0.2s;
|
|
42
47
|
}
|
|
43
48
|
</style>
|
|
44
49
|
</head>
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Variant System - Barrel Export
|
|
3
|
-
*
|
|
4
|
-
* Built-in variant presets and composition utilities.
|
|
5
|
-
*/
|
|
6
|
-
export { builtInVariants, classicGlass, compactHorizontal, getBuiltInVariant, getBuiltInVariantIds, isBuiltInVariant, minimal, } from "./built-in-variants";
|
|
7
|
-
export { applyCssVars, applyLayout, composeVariants, createFlexLayout, extendVariant, mergeVariants, } from "./variant-utils";
|
|
@@ -1,105 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Variant Composition Utilities
|
|
3
|
-
*
|
|
4
|
-
* Utilities for creating, merging, extending, and composing widget variants.
|
|
5
|
-
* Enables flexible variant system with type safety and composability.
|
|
6
|
-
*/
|
|
7
|
-
import type { FlexLayoutStrategy, LayoutStrategy, WidgetVariantConfig } from "../types";
|
|
8
|
-
/**
|
|
9
|
-
* Merge two complete variant configurations
|
|
10
|
-
*
|
|
11
|
-
* Deep merges all properties, with `override` taking precedence.
|
|
12
|
-
* Layout strategies are replaced, not merged (since they have different shapes).
|
|
13
|
-
*
|
|
14
|
-
* @example
|
|
15
|
-
* ```tsx
|
|
16
|
-
* const customVariant = mergeVariants(classicGlass, {
|
|
17
|
-
* styles: {
|
|
18
|
-
* cssVars: {
|
|
19
|
-
* "--glass-base": "oklch(0.2 0 0 / 0.5)"
|
|
20
|
-
* }
|
|
21
|
-
* }
|
|
22
|
-
* });
|
|
23
|
-
* ```
|
|
24
|
-
*/
|
|
25
|
-
export declare function mergeVariants(base: WidgetVariantConfig, override: Partial<WidgetVariantConfig>): WidgetVariantConfig;
|
|
26
|
-
/**
|
|
27
|
-
* Extend a base variant with partial overrides
|
|
28
|
-
*
|
|
29
|
-
* Similar to mergeVariants but returns a new variant that references the base
|
|
30
|
-
* via the `extends` property. Useful for variant inheritance chains.
|
|
31
|
-
*
|
|
32
|
-
* @example
|
|
33
|
-
* ```tsx
|
|
34
|
-
* const darkGlass = extendVariant("classic-glass", {
|
|
35
|
-
* id: "dark-glass",
|
|
36
|
-
* name: "Dark Glass",
|
|
37
|
-
* styles: {
|
|
38
|
-
* cssVars: {
|
|
39
|
-
* "--glass-base": "oklch(0.2 0 0 / 0.5)"
|
|
40
|
-
* }
|
|
41
|
-
* }
|
|
42
|
-
* });
|
|
43
|
-
* ```
|
|
44
|
-
*/
|
|
45
|
-
export declare function extendVariant(baseId: string, override: Partial<WidgetVariantConfig> & {
|
|
46
|
-
id: string;
|
|
47
|
-
name: string;
|
|
48
|
-
}): WidgetVariantConfig;
|
|
49
|
-
/**
|
|
50
|
-
* Compose multiple variants together (left to right precedence)
|
|
51
|
-
*
|
|
52
|
-
* Merges multiple variants in sequence, with later variants taking precedence.
|
|
53
|
-
* Useful for combining layout + styling + interaction variants.
|
|
54
|
-
*
|
|
55
|
-
* @example
|
|
56
|
-
* ```tsx
|
|
57
|
-
* const custom = composeVariants(
|
|
58
|
-
* minimal, // Base: minimal styling
|
|
59
|
-
* centeredLayout, // Add: centered layout
|
|
60
|
-
* largeIcons // Add: large icon sizing
|
|
61
|
-
* );
|
|
62
|
-
* ```
|
|
63
|
-
*/
|
|
64
|
-
export declare function composeVariants(...variants: WidgetVariantConfig[]): WidgetVariantConfig;
|
|
65
|
-
/**
|
|
66
|
-
* Apply a layout strategy override to a variant
|
|
67
|
-
*
|
|
68
|
-
* Convenience function for changing just the layout of a variant.
|
|
69
|
-
*
|
|
70
|
-
* @example
|
|
71
|
-
* ```tsx
|
|
72
|
-
* const centered = applyLayout(minimal, {
|
|
73
|
-
* type: "flex",
|
|
74
|
-
* direction: "column",
|
|
75
|
-
* align: "center",
|
|
76
|
-
* justify: "center"
|
|
77
|
-
* });
|
|
78
|
-
* ```
|
|
79
|
-
*/
|
|
80
|
-
export declare function applyLayout(variant: WidgetVariantConfig, layout: LayoutStrategy): WidgetVariantConfig;
|
|
81
|
-
/**
|
|
82
|
-
* Apply CSS variable overrides to a variant
|
|
83
|
-
*
|
|
84
|
-
* Convenience function for changing just the CSS variables of a variant.
|
|
85
|
-
*
|
|
86
|
-
* @example
|
|
87
|
-
* ```tsx
|
|
88
|
-
* const blueTinted = applyCssVars(classicGlass, {
|
|
89
|
-
* "--glass-tone": "oklch(0.62 0.2 260)",
|
|
90
|
-
* "--glass-wash": "30%"
|
|
91
|
-
* });
|
|
92
|
-
* ```
|
|
93
|
-
*/
|
|
94
|
-
export declare function applyCssVars(variant: WidgetVariantConfig, cssVars: Record<`--widget-${string}` | `--glass-${string}`, string | number>): WidgetVariantConfig;
|
|
95
|
-
/**
|
|
96
|
-
* Create a flex layout strategy
|
|
97
|
-
*
|
|
98
|
-
* Convenience function for creating common flex layouts.
|
|
99
|
-
*
|
|
100
|
-
* @example
|
|
101
|
-
* ```tsx
|
|
102
|
-
* const layout = createFlexLayout("column", "center", "center");
|
|
103
|
-
* ```
|
|
104
|
-
*/
|
|
105
|
-
export declare function createFlexLayout(direction?: FlexLayoutStrategy["direction"], align?: FlexLayoutStrategy["align"], justify?: FlexLayoutStrategy["justify"], options?: Partial<FlexLayoutStrategy>): FlexLayoutStrategy;
|