@glasshome/widget-sdk 0.3.7 → 0.4.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.
Files changed (36) hide show
  1. package/README.md +18 -0
  2. package/dist/framework/backgrounds/WidgetSliderFill.d.ts +24 -13
  3. package/dist/framework/components/WidgetContent.d.ts +2 -1
  4. package/dist/framework/components/WidgetIcon.d.ts +22 -24
  5. package/dist/framework/components/WidgetStatus.d.ts +2 -1
  6. package/dist/framework/components/WidgetTitle.d.ts +2 -1
  7. package/dist/framework/components/WidgetValue.d.ts +2 -1
  8. package/dist/framework/core/Widget.d.ts +30 -31
  9. package/dist/framework/gestures/cursors.d.ts +2 -1
  10. package/dist/framework/hooks/index.d.ts +2 -9
  11. package/dist/framework/hooks/use-widget-context.d.ts +0 -5
  12. package/dist/framework/index.d.ts +4 -16
  13. package/dist/framework/theming/index.d.ts +4 -5
  14. package/dist/framework/theming/tokens.d.ts +24 -0
  15. package/dist/framework/theming/tone.d.ts +10 -0
  16. package/dist/framework/types.d.ts +0 -67
  17. package/dist/framework/utils/entity-state.d.ts +0 -62
  18. package/dist/framework/utils/index.d.ts +5 -5
  19. package/dist/index.d.ts +2 -4
  20. package/dist/index.js +820 -1479
  21. package/dist/theme.d.ts +0 -12
  22. package/package.json +1 -2
  23. package/dist/create-entity.d.ts +0 -22
  24. package/dist/framework/backgrounds/Glow.d.ts +0 -24
  25. package/dist/framework/components/WidgetEmptyState.d.ts +0 -34
  26. package/dist/framework/components/WidgetMetrics.d.ts +0 -47
  27. package/dist/framework/components/WidgetSubtitle.d.ts +0 -28
  28. package/dist/framework/design-system/index.d.ts +0 -8
  29. package/dist/framework/hooks/use-debug-data.d.ts +0 -46
  30. package/dist/framework/hooks/use-widget-config.d.ts +0 -48
  31. package/dist/framework/hooks/use-widget-entity.d.ts +0 -53
  32. package/dist/framework/hooks/use-widget-form.d.ts +0 -79
  33. package/dist/framework/hooks/use-widget-responsive.d.ts +0 -41
  34. package/dist/framework/layout/WidgetStack.d.ts +0 -28
  35. package/dist/framework/theming/adaptive-color.d.ts +0 -28
  36. package/dist/framework/theming/colors.d.ts +0 -59
@@ -8,18 +8,6 @@
8
8
  * (calculateLightGroup, calculateSensorGroup).
9
9
  */
10
10
  import type { EntityView } from "../types";
11
- /**
12
- * Check if entity is available (not unavailable/unknown)
13
- *
14
- * @example
15
- * ```typescript
16
- * const isAvailable = isEntityAvailable(entity);
17
- * if (isAvailable) {
18
- * // Entity is available, can display state
19
- * }
20
- * ```
21
- */
22
- export declare function isEntityAvailable(entity: EntityView | null | undefined): boolean;
23
11
  /**
24
12
  * Check if entity is active (on, open, locked, etc.)
25
13
  * Domain-aware state checking
@@ -31,16 +19,6 @@ export declare function isEntityAvailable(entity: EntityView | null | undefined)
31
19
  * ```
32
20
  */
33
21
  export declare function isEntityActive(entity: EntityView | null | undefined): boolean;
34
- /**
35
- * Get entity state with fallback
36
- *
37
- * @example
38
- * ```typescript
39
- * const state = getEntityState(entity, "unknown");
40
- * return <Widget.Status>{state}</Widget.Status>;
41
- * ```
42
- */
43
- export declare function getEntityState(entity: EntityView | null | undefined, fallback?: string): string;
44
22
  /**
45
23
  * Get entity attribute with type safety
46
24
  *
@@ -51,26 +29,6 @@ export declare function getEntityState(entity: EntityView | null | undefined, fa
51
29
  * ```
52
30
  */
53
31
  export declare function getEntityAttribute<T = unknown>(entity: EntityView | null | undefined, attributeName: string, fallback?: T): T | undefined;
54
- /**
55
- * Count entities by state
56
- *
57
- * @example
58
- * ```typescript
59
- * const onCount = countEntitiesByState(entities, "on");
60
- * return <Widget.Status>{onCount} lights on</Widget.Status>;
61
- * ```
62
- */
63
- export declare function countEntitiesByState(entities: EntityView[], state: string): number;
64
- /**
65
- * Count available entities (excludes unavailable/unknown)
66
- *
67
- * @example
68
- * ```typescript
69
- * const availableCount = countAvailableEntities(entities);
70
- * const unavailableCount = entities.length - availableCount;
71
- * ```
72
- */
73
- export declare function countAvailableEntities(entities: EntityView[]): number;
74
32
  /**
75
33
  * Count active entities (on, open, etc.)
76
34
  *
@@ -81,23 +39,3 @@ export declare function countAvailableEntities(entities: EntityView[]): number;
81
39
  * ```
82
40
  */
83
41
  export declare function countActiveEntities(entities: EntityView[]): number;
84
- /**
85
- * Check if all entities match state
86
- *
87
- * @example
88
- * ```typescript
89
- * const allOn = allEntitiesInState(entities, "on");
90
- * const statusText = allOn ? "All on" : "Mixed";
91
- * ```
92
- */
93
- export declare function allEntitiesInState(entities: EntityView[], state: string): boolean;
94
- /**
95
- * Check if any entity matches state
96
- *
97
- * @example
98
- * ```typescript
99
- * const anyOpen = anyEntityInState(entities, "open");
100
- * const iconColor = anyOpen ? "red" : "green";
101
- * ```
102
- */
103
- export declare function anyEntityInState(entities: EntityView[], state: string): boolean;
@@ -1,12 +1,12 @@
1
1
  /**
2
- * Framework Utilities - Barrel Export
2
+ * Framework Utilities - Barrel Export (internal)
3
3
  *
4
- * Helper functions for value formatting, entity state management,
5
- * and class name composition.
4
+ * Public exports are routed through src/framework/index.ts. Files that remain
5
+ * in this directory are still consumed internally even when not part of the
6
+ * public re-export surface.
6
7
  */
7
8
  export { cn } from "./cn";
8
- export { createEmptyStateConfig, type EmptyStateConfigOptions, type WidgetEmptyStateConfig, } from "./empty-state";
9
9
  export { calculateLightGroup, calculateSensorGroup, type LightGroupResult, type SensorGroupResult, type SensorGroupType, } from "./entity-aggregation";
10
- export { allEntitiesInState, anyEntityInState, countActiveEntities, countAvailableEntities, countEntitiesByState, getEntityAttribute, getEntityState, isEntityActive, isEntityAvailable, } from "./entity-state";
10
+ export { countActiveEntities, getEntityAttribute, isEntityActive, } from "./entity-state";
11
11
  export { formatValue } from "./format-value";
12
12
  export { interpretValue } from "./interpret-value";
package/dist/index.d.ts CHANGED
@@ -1,8 +1,6 @@
1
- export type { Entity } from "./create-entity";
2
- export { createEntity } from "./create-entity";
3
1
  export { defineWidget } from "./define-widget";
4
2
  export * from "./framework";
5
- export { formatSchemaError, GridSizeSchema, PublishBodySchema, PublishConfirmSchema, PublishRequestSchema, parseGridSize, serializeGridSize, WidgetManifestSchema, } from "./schemas";
6
- export { getThemeToken, isDark } from "./theme";
3
+ export { formatSchemaError, WidgetManifestSchema } from "./schemas";
4
+ export { isDark } from "./theme";
7
5
  export type { GridSize, WidgetContext, WidgetDefinition, WidgetManifest, } from "./types";
8
6
  export { SDK_VERSION } from "./version";