@glasshome/widget-sdk 0.1.0 → 0.2.3
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/framework/dialogs/WidgetDialog.d.ts +7 -23
- package/dist/framework/hooks/index.d.ts +1 -1
- package/dist/framework/hooks/use-widget-context.d.ts +28 -0
- package/dist/framework/index.d.ts +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +440 -415
- package/dist/schemas.d.ts +92 -0
- package/dist/schemas.js +63 -0
- package/dist/types.d.ts +5 -1
- package/dist/vite/index.js +113 -83
- package/package.json +6 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type
|
|
1
|
+
import { type Component, type JSX } from "solid-js";
|
|
2
2
|
export interface WidgetDialogTab {
|
|
3
3
|
id: string;
|
|
4
4
|
label: string;
|
|
@@ -21,27 +21,11 @@ export interface WidgetDialogProps {
|
|
|
21
21
|
maxWidth?: "sm" | "md" | "lg" | "xl" | "2xl" | "3xl" | "4xl";
|
|
22
22
|
defaultTab?: string;
|
|
23
23
|
headerActions?: JSX.Element;
|
|
24
|
-
ResponsiveDialog:
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
}>;
|
|
31
|
-
ResponsiveDialogHeader: ParentComponent<{
|
|
32
|
-
class?: string;
|
|
33
|
-
}>;
|
|
34
|
-
ResponsiveDialogTitle: ParentComponent<{
|
|
35
|
-
class?: string;
|
|
36
|
-
}>;
|
|
37
|
-
ResponsiveDialogDescription: ParentComponent<{
|
|
38
|
-
class?: string;
|
|
39
|
-
}>;
|
|
40
|
-
Button: ParentComponent<{
|
|
41
|
-
size?: string;
|
|
42
|
-
variant?: string;
|
|
43
|
-
onClick?: () => void;
|
|
44
|
-
class?: string;
|
|
45
|
-
}>;
|
|
24
|
+
ResponsiveDialog: Component<any>;
|
|
25
|
+
ResponsiveDialogContent: Component<any>;
|
|
26
|
+
ResponsiveDialogHeader: Component<any>;
|
|
27
|
+
ResponsiveDialogTitle: Component<any>;
|
|
28
|
+
ResponsiveDialogDescription: Component<any>;
|
|
29
|
+
Button: Component<any>;
|
|
46
30
|
}
|
|
47
31
|
export declare function WidgetDialog(props: WidgetDialogProps): JSX.Element;
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
export { type GestureHandlers, useWidgetGestures } from "../gestures/use-widget-gestures";
|
|
8
8
|
export { type UseDebugDataOptions, useDebugData } from "./use-debug-data";
|
|
9
9
|
export { type UseWidgetConfigOptions, type UseWidgetConfigReturn, useWidgetConfig, } from "./use-widget-config";
|
|
10
|
-
export { type ReactiveWidgetContext, useWidgetContext, WidgetCtx } from "./use-widget-context";
|
|
10
|
+
export { type BridgeableWidgetContext, type BridgeFns, type ReactiveWidgetContext, useWidgetContext, warnIfStub, WidgetCtx, } from "./use-widget-context";
|
|
11
11
|
export { useWidgetDialog, type WidgetDialogReturn } from "./use-widget-dialog";
|
|
12
12
|
export { type UseWidgetEntityOptions, type UseWidgetEntityResult, useWidgetEntity, } from "./use-widget-entity";
|
|
13
13
|
export { type AggregationPreset, type UseWidgetEntityGroupOptions, type UseWidgetEntityGroupResult, useWidgetEntityGroup, } from "./use-widget-entity-group";
|
|
@@ -34,6 +34,34 @@ export interface ReactiveWidgetContext {
|
|
|
34
34
|
/** Update widget config (persists to host) */
|
|
35
35
|
updateConfig: (config: Record<string, unknown>) => void;
|
|
36
36
|
}
|
|
37
|
+
/**
|
|
38
|
+
* Setter functions used by Widget.tsx to write real measured values into
|
|
39
|
+
* the stub context created by WidgetSlot before Widget mounts and measures.
|
|
40
|
+
*/
|
|
41
|
+
export interface BridgeFns {
|
|
42
|
+
setSize: (v: WidgetSize) => void;
|
|
43
|
+
setOrientation: (v: WidgetOrientation) => void;
|
|
44
|
+
setContentLayout: (v: WidgetOrientation) => void;
|
|
45
|
+
setDimensions: (v: WidgetDimensions) => void;
|
|
46
|
+
setIsStub: (v: boolean) => void;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Bridgeable widget context — extends ReactiveWidgetContext with internal
|
|
50
|
+
* fields used by the host (WidgetSlot + Widget.tsx) to make stub accessors
|
|
51
|
+
* reactive. Widget authors never see or use these fields; useWidgetContext()
|
|
52
|
+
* still returns ReactiveWidgetContext.
|
|
53
|
+
*/
|
|
54
|
+
export interface BridgeableWidgetContext extends ReactiveWidgetContext {
|
|
55
|
+
/** True while Widget has not yet measured and updated the stub values */
|
|
56
|
+
_isStub: () => boolean;
|
|
57
|
+
/** Setter functions called by Widget.tsx createEffect to push real values */
|
|
58
|
+
_bridge: BridgeFns;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Emit a one-time dev-mode console.warn when stub context values are read
|
|
62
|
+
* before Widget has mounted and bridged real measured values.
|
|
63
|
+
*/
|
|
64
|
+
export declare function warnIfStub(isStub: () => boolean): void;
|
|
37
65
|
/**
|
|
38
66
|
* Widget context
|
|
39
67
|
* Uses reactive accessor pattern for SolidJS
|
|
@@ -44,7 +44,7 @@ export { Glow } from "./backgrounds/Glow";
|
|
|
44
44
|
export { WidgetSliderFill } from "./backgrounds/WidgetSliderFill";
|
|
45
45
|
export { WidgetStack } from "./layout/WidgetStack";
|
|
46
46
|
export { WidgetDialog, type WidgetDialogProps, type WidgetDialogTab } from "./dialogs";
|
|
47
|
-
export { type AggregationPreset, type ReactiveWidgetContext, type UseDebugDataOptions, type UseWidgetConfigOptions, type UseWidgetConfigReturn, type UseWidgetEntityGroupOptions, type UseWidgetEntityGroupResult, type UseWidgetEntityOptions, type UseWidgetEntityResult, type UseWidgetFormOptions, type UseWidgetFormReturn, useDebugData, useWidgetConfig, useWidgetContext, useWidgetDialog, useWidgetEntity, useWidgetEntityGroup, useWidgetForm, useWidgetResponsive, WidgetCtx, type WidgetDialogReturn, type WidgetResponsiveUtils, } from "./hooks";
|
|
47
|
+
export { type AggregationPreset, type BridgeableWidgetContext, type BridgeFns, type ReactiveWidgetContext, type UseDebugDataOptions, type UseWidgetConfigOptions, type UseWidgetConfigReturn, type UseWidgetEntityGroupOptions, type UseWidgetEntityGroupResult, type UseWidgetEntityOptions, type UseWidgetEntityResult, type UseWidgetFormOptions, type UseWidgetFormReturn, useDebugData, useWidgetConfig, useWidgetContext, useWidgetDialog, useWidgetEntity, useWidgetEntityGroup, useWidgetForm, useWidgetResponsive, warnIfStub, WidgetCtx, type WidgetDialogReturn, type WidgetResponsiveUtils, } from "./hooks";
|
|
48
48
|
export { type GestureHandlers, useWidgetGestures } from "./gestures/use-widget-gestures";
|
|
49
49
|
export { getSpacingClass, spacing } from "./design-system/spacing";
|
|
50
50
|
export { typography } from "./design-system/typography";
|
package/dist/index.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ export type { Entity } from "./create-entity";
|
|
|
2
2
|
export { createEntity } from "./create-entity";
|
|
3
3
|
export { defineWidget } from "./define-widget";
|
|
4
4
|
export * from "./framework";
|
|
5
|
+
export { formatSchemaError, GridSizeSchema, PublishBodySchema, PublishConfirmSchema, PublishRequestSchema, parseGridSize, serializeGridSize, WidgetManifestSchema, } from "./schemas";
|
|
5
6
|
export { getThemeToken, isDark } from "./theme";
|
|
6
7
|
export type { GridSize, WidgetContext, WidgetDefinition, WidgetManifest, } from "./types";
|
|
7
8
|
export { SDK_VERSION } from "./version";
|