@glasshome/widget-sdk 1.19.0 → 1.20.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/framework/components/anatomy.d.ts +2 -1
- package/dist/framework/dialogs/WidgetDialog.d.ts +1 -1
- package/dist/framework/gestures/use-widget-gestures.d.ts +4 -0
- package/dist/framework/hooks/use-widget-context.d.ts +4 -0
- package/dist/framework/hooks/widget-registry.d.ts +4 -1
- package/dist/index.js +584 -555
- package/package.json +3 -3
|
@@ -24,7 +24,8 @@ export declare function WidgetHero(props: {
|
|
|
24
24
|
art?: JSX.Element;
|
|
25
25
|
class?: string;
|
|
26
26
|
}): JSX.Element;
|
|
27
|
-
/** The tile's control row: beside the value on a wide tile, under it on a narrow one, hidden on a short one.
|
|
27
|
+
/** The tile's control row: beside the value on a wide tile, under it on a narrow one, hidden on a short one.
|
|
28
|
+
A press here belongs to the row's controls; the widget only takes a hold from it. */
|
|
28
29
|
export declare function WidgetControls(props: {
|
|
29
30
|
children: JSX.Element;
|
|
30
31
|
}): JSX.Element;
|
|
@@ -31,7 +31,7 @@ export interface WidgetDialogProps {
|
|
|
31
31
|
controlsContent?: JSX.Element;
|
|
32
32
|
/** What holding the tile opens: only what the tile cannot show (a group's members, colours, modes),
|
|
33
33
|
as `PanelSection`s. It opens beside the tile, or from the bottom on a phone. A widget with nothing
|
|
34
|
-
the tile lacks passes none, and holding it
|
|
34
|
+
the tile lacks passes none, and holding it says there is nothing more. */
|
|
35
35
|
sheet?: () => JSX.Element;
|
|
36
36
|
/** The tile's look, worn by its sheet so the tile reads as growing open: its icon in the head,
|
|
37
37
|
its tone in the glass, its picture (a room, an album cover) as a band behind the head. */
|
|
@@ -7,6 +7,8 @@
|
|
|
7
7
|
*/
|
|
8
8
|
import type { GestureConfig } from "../types";
|
|
9
9
|
type GestureOrientation = "horizontal" | "vertical" | "square";
|
|
10
|
+
/** A press that starts on a control inside a widget belongs to that control. */
|
|
11
|
+
export declare const INTERACTIVE = "button, a, input, select, textarea, [role=\"slider\"], [role=\"radio\"], [role=\"switch\"]";
|
|
10
12
|
export interface GestureHandlers {
|
|
11
13
|
onPointerDown: (e: PointerEvent) => void;
|
|
12
14
|
onPointerMove: (e: PointerEvent) => void;
|
|
@@ -26,6 +28,8 @@ export interface GestureHandlers {
|
|
|
26
28
|
dispose: () => void;
|
|
27
29
|
/** Where a hold is filling from, relative to the element; `fired` once it opened. */
|
|
28
30
|
hold?: () => HoldFlood | null;
|
|
31
|
+
/** True while a hold opens something; the "nothing more here" answer does not count. */
|
|
32
|
+
holds?: () => boolean;
|
|
29
33
|
/** Keyboard door: Enter or Space taps, the context-menu key or Shift+F10 holds. */
|
|
30
34
|
onKeyDown?: (e: KeyboardEvent) => void;
|
|
31
35
|
}
|
|
@@ -50,6 +50,10 @@ export interface ReactiveWidgetContext {
|
|
|
50
50
|
developer?: () => boolean;
|
|
51
51
|
/** The tile's box on the page, so a held tile's sheet opens beside it. Absent: it opens centred. */
|
|
52
52
|
anchor?: () => HTMLElement | undefined;
|
|
53
|
+
/** Host hook: whether holding this widget opens anything. Absent on hosts that predate this field. */
|
|
54
|
+
onHoldable?: (holds: boolean) => void;
|
|
55
|
+
/** Host hook: a hold on this widget fired. Absent on hosts that predate this field. */
|
|
56
|
+
onHeld?: () => void;
|
|
53
57
|
}
|
|
54
58
|
export declare const WidgetCtx: import("solid-js").Context<ReactiveWidgetContext | undefined>;
|
|
55
59
|
export declare function useWidgetContext(): ReactiveWidgetContext;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type Accessor, type Setter } from "solid-js";
|
|
2
|
-
/** What a widget's parts tell each other: whether its dialog has a sheet,
|
|
2
|
+
/** What a widget's parts tell each other: whether its dialog has a sheet, the look the sheet wears, and a hold that found none. */
|
|
3
3
|
export interface WidgetRegistry {
|
|
4
4
|
hasSheet: Accessor<boolean>;
|
|
5
5
|
setHasSheet: Setter<boolean>;
|
|
@@ -12,6 +12,9 @@ export interface WidgetRegistry {
|
|
|
12
12
|
/** The head's icon. */
|
|
13
13
|
icon: Accessor<string | undefined>;
|
|
14
14
|
setIcon: Setter<string | undefined>;
|
|
15
|
+
/** A hold found no sheet: the shell says the widget has nothing more to show. */
|
|
16
|
+
nothingMore: Accessor<boolean>;
|
|
17
|
+
setNothingMore: Setter<boolean>;
|
|
15
18
|
}
|
|
16
19
|
/** `<Widget>` hands its parts a copy of the host context; this points the copy back at the original. */
|
|
17
20
|
export declare const REGISTRY_KEY: unique symbol;
|