@glasshome/widget-sdk 0.5.2 → 1.0.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/dist/data.d.ts +10 -0
- package/dist/framework/theming/tokens.d.ts +9 -4
- package/dist/index.d.ts +1 -0
- package/dist/index.js +366 -324
- package/dist/schemas.d.ts +6 -106
- package/dist/schemas.js +13 -77
- package/dist/types.d.ts +3 -0
- package/dist/vite/index.d.ts +1 -1
- package/dist/vite/index.js +206 -122
- package/package.json +6 -2
package/dist/data.d.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Home Assistant data and service hooks, re-exported from
|
|
3
|
+
* @glasshome/sync-layer. Widgets must import these from the SDK instead of
|
|
4
|
+
* sync-layer directly: the single store instance lives in the host (via the
|
|
5
|
+
* import map), and a direct import would bundle a second, disconnected
|
|
6
|
+
* store. Phase 4 routes these through capability checks.
|
|
7
|
+
*/
|
|
8
|
+
export { getForecasts, getStream, getWebRtcClientConfig, sendWebRtcCandidate, startWebRtcSession, state, trackEntityHistory, untrackEntityHistory, } from "@glasshome/sync-layer";
|
|
9
|
+
export type { AreaView } from "@glasshome/sync-layer";
|
|
10
|
+
export { byDomain, useArea, useCamera, useConnection, useCurrency, useEntities, useEntity, useEntityHistory, useEntityStatistics, useForecast, useHassConfig, useLocale, useService, useStore, useTemperatureUnit, useToggle, useTurnOn, useUnitSystem, } from "@glasshome/sync-layer/solid";
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Minimal document-shape needed for token injection. Allows tests to pass
|
|
3
3
|
* a stub without a full DOM implementation.
|
|
4
4
|
*/
|
|
5
|
-
interface InjectTokensRoot {
|
|
5
|
+
export interface InjectTokensRoot {
|
|
6
6
|
head: {
|
|
7
7
|
appendChild: (node: unknown) => void;
|
|
8
8
|
querySelector?: (sel: string) => unknown;
|
|
@@ -13,12 +13,17 @@ interface InjectTokensRoot {
|
|
|
13
13
|
};
|
|
14
14
|
}
|
|
15
15
|
/**
|
|
16
|
-
* Inject the SDK tokens stylesheet into
|
|
16
|
+
* Inject the SDK tokens stylesheet into the widget's root.
|
|
17
|
+
*
|
|
18
|
+
* ShadowRoot: adopts a shared constructed CSSStyleSheet (one instance for
|
|
19
|
+
* all widget shadow roots), idempotent per root via WeakSet.
|
|
20
|
+
*
|
|
21
|
+
* Document (or no argument, legacy): appends a <style> to <head>.
|
|
22
|
+
* Idempotent across:
|
|
17
23
|
* - Repeated calls within the same module instance (boolean sentinel).
|
|
18
24
|
* - Multiple SDK module instances (DOM sentinel data-glasshome-tokens).
|
|
19
25
|
* - SSR / non-browser environments (no-op when document is undefined).
|
|
20
26
|
*/
|
|
21
|
-
export declare function injectTokens(
|
|
27
|
+
export declare function injectTokens(root?: Document | ShadowRoot): void;
|
|
22
28
|
/** Test-only: reset the module-level sentinel. Not exported from the package root. */
|
|
23
29
|
export declare function __resetInjectedForTests(): void;
|
|
24
|
-
export {};
|