@weasel-js/hud 1.13.0 → 1.14.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/attach.d.ts.map +1 -1
- package/dist/hud.d.ts +6 -16
- package/dist/hud.d.ts.map +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +665 -332
- package/dist/index.js.map +1 -1
- package/dist/layerDeps.d.ts +14 -0
- package/dist/layerDeps.d.ts.map +1 -0
- package/dist/loupe/createLoupe.d.ts +4 -2
- package/dist/loupe/createLoupe.d.ts.map +1 -1
- package/dist/menu/accessibleMenu.d.ts +3 -3
- package/dist/menu/accessibleMenu.d.ts.map +1 -1
- package/dist/menu/attachMenuHost.d.ts +1 -1
- package/dist/menu/attachMenuHost.d.ts.map +1 -1
- package/dist/menu/chipRepeat.d.ts +27 -0
- package/dist/menu/chipRepeat.d.ts.map +1 -0
- package/dist/menu/colorPicker.d.ts +20 -0
- package/dist/menu/colorPicker.d.ts.map +1 -0
- package/dist/menu/drawPanel.d.ts +17 -4
- package/dist/menu/drawPanel.d.ts.map +1 -1
- package/dist/menu/menuWidget.d.ts +6 -0
- package/dist/menu/menuWidget.d.ts.map +1 -1
- package/dist/menu/textEdit.d.ts +70 -0
- package/dist/menu/textEdit.d.ts.map +1 -0
- package/dist/menu/valueRows.d.ts +20 -2
- package/dist/menu/valueRows.d.ts.map +1 -1
- package/dist/react/index.js +1 -1
- package/dist/textInputHost.d.ts +19 -0
- package/dist/textInputHost.d.ts.map +1 -0
- package/dist/{tool-8LVUdM5S.js → tool-DELNnWid.js} +460 -351
- package/dist/tool-DELNnWid.js.map +1 -0
- package/dist/tool.d.ts.map +1 -1
- package/dist/widget.d.ts +20 -0
- package/dist/widget.d.ts.map +1 -1
- package/dist/widgets/text.d.ts.map +1 -1
- package/package.json +12 -11
- package/dist/tool-8LVUdM5S.js.map +0 -1
package/dist/attach.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"attach.d.ts","sourceRoot":"","sources":["../src/attach.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AACjC,OAAO,KAAK,EAAE,kBAAkB,EAA+B,MAAM,iBAAiB,CAAC;AAIvF,OAAO,EAGL,KAAK,aAAa,EACnB,MAAM,6BAA6B,CAAC;AAMrC,OAAO,EAA6B,KAAK,kBAAkB,EAAE,KAAK,aAAa,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"attach.d.ts","sourceRoot":"","sources":["../src/attach.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AACjC,OAAO,KAAK,EAAE,kBAAkB,EAA+B,MAAM,iBAAiB,CAAC;AAIvF,OAAO,EAGL,KAAK,aAAa,EACnB,MAAM,6BAA6B,CAAC;AAMrC,OAAO,EAA6B,KAAK,kBAAkB,EAAE,KAAK,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAM1G,+BAA+B;AAC/B,MAAM,WAAW,gBAAgB;IAC/B;2EACuE;IACvE,QAAQ,CAAC,KAAK,CAAC,EAAE,aAAa,CAAC;IAC/B;;iFAE6E;IAC7E,QAAQ,CAAC,KAAK,CAAC,EAAE,kBAAkB,CAAC;IACpC;;;;;;;;;OASG;IACH,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,GAAG,aAAa,CAAC;CACxC;AAED;;;;;;;GAOG;AACH,wBAAgB,SAAS,CACvB,GAAG,EAAE,kBAAkB,EACvB,GAAG,EAAE,GAAG,EACR,OAAO,GAAE,gBAAqB,GAC7B,MAAM,IAAI,CA+IZ"}
|
package/dist/hud.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type FocusScope, type FocusScopeOptions } from '@weasel-js/headless';
|
|
1
2
|
import { type Widget } from './widget';
|
|
2
3
|
import type { HudHost } from './host';
|
|
3
4
|
import { type RectOptions, type RectWidget } from './widgets/rect';
|
|
@@ -6,13 +7,8 @@ import { type ImageOptions, type ImageWidget } from './widgets/image';
|
|
|
6
7
|
import { type LabelOptions, type LabelWidget } from './widgets/label';
|
|
7
8
|
import { type ButtonOptions, type ButtonWidget } from './widgets/button';
|
|
8
9
|
import { type WindowOptions, type WindowWidget } from './widgets/window/window';
|
|
9
|
-
/** How a focus change came about. */
|
|
10
|
-
export
|
|
11
|
-
/** Whether the focused widget should show a focus ring — the HUD's
|
|
12
|
-
* `:focus-visible`. Keyboard moves show one; a press does not. Default
|
|
13
|
-
* `false` for {@link Hud.focus}, `true` for {@link Hud.moveFocus}. */
|
|
14
|
-
readonly visible?: boolean;
|
|
15
|
-
}
|
|
10
|
+
/** How a focus change came about: whether the focused widget shows its ring. */
|
|
11
|
+
export type HudFocusOptions = FocusScopeOptions;
|
|
16
12
|
/**
|
|
17
13
|
* A HUD: an ordered set of widgets drawn in screen space over the canvas, and
|
|
18
14
|
* the factories that create them. The factory methods (`rect`, `text`, …) also
|
|
@@ -21,8 +17,10 @@ export interface HudFocusOptions {
|
|
|
21
17
|
*
|
|
22
18
|
* A HUD holds no GL state of its own. It becomes visible by binding to a host
|
|
23
19
|
* — normally through `attachHud`.
|
|
20
|
+
*
|
|
21
|
+
* Its keyboard focus is a headless `FocusScope` over its widgets, the contract a DOM subtree's focus answers too.
|
|
24
22
|
*/
|
|
25
|
-
export interface Hud {
|
|
23
|
+
export interface Hud extends FocusScope<Widget> {
|
|
26
24
|
add(widget: Widget): void;
|
|
27
25
|
remove(widget: Widget): void;
|
|
28
26
|
widgets(): readonly Widget[];
|
|
@@ -37,21 +35,13 @@ export interface Hud {
|
|
|
37
35
|
readonly attached: boolean;
|
|
38
36
|
/** The widget holding keyboard focus, or null. One per HUD. */
|
|
39
37
|
readonly focused: Widget | null;
|
|
40
|
-
/** Whether the focused widget shows its focus ring. */
|
|
41
|
-
readonly focusVisible: boolean;
|
|
42
38
|
/** Focus `widget`, or blur with `null`. Returns whether `widget` now holds
|
|
43
39
|
* focus — false when it is not in this HUD or cannot take focus
|
|
44
40
|
* (see `isFocusable`), in which case focus is unchanged. */
|
|
45
41
|
focus(widget: Widget | null, options?: HudFocusOptions): boolean;
|
|
46
|
-
/** Move focus one step through {@link tabOrder}. From nothing, `'next'`
|
|
47
|
-
* lands on the first widget and `'prev'` on the last; stepping past either
|
|
48
|
-
* end blurs and returns null, which is where focus leaves the HUD. */
|
|
49
|
-
moveFocus(direction: 'next' | 'prev', options?: HudFocusOptions): Widget | null;
|
|
50
42
|
/** The widgets Tab visits, in order: those declaring `tabOrder` first,
|
|
51
43
|
* ascending, then the rest in the order they were added. */
|
|
52
44
|
tabOrder(): Widget[];
|
|
53
|
-
/** Run `fn` whenever the focused widget changes. Returns an unsubscribe. */
|
|
54
|
-
subscribeFocus(fn: (focused: Widget | null) => void): () => void;
|
|
55
45
|
/** Create a rect widget, add it to the HUD, and wire onChange → markDirty. */
|
|
56
46
|
rect(opts: RectOptions): RectWidget;
|
|
57
47
|
/** Create a text widget, add it to the HUD, and wire onChange → markDirty. */
|
package/dist/hud.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hud.d.ts","sourceRoot":"","sources":["../src/hud.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"hud.d.ts","sourceRoot":"","sources":["../src/hud.ts"],"names":[],"mappings":"AAAA,OAAO,EAAoB,KAAK,UAAU,EAAE,KAAK,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAEhG,OAAO,EAAe,KAAK,MAAM,EAAE,MAAM,UAAU,CAAC;AACpD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAC;AACtC,OAAO,EAAc,KAAK,WAAW,EAAE,KAAK,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAC/E,OAAO,EAAc,KAAK,WAAW,EAAE,KAAK,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAC/E,OA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AgF;IAChF,KAAK,CAAC,IAAI,EAAE,YAAY,GAAG,WAAW,CAAC;IACvC,+EAA+E;IAC/E,KAAK,CAAC,IAAI,EAAE,YAAY,GAAG,WAAW,CAAC;IACvC,gFAAgF;IAChF,MAAM,CAAC,IAAI,EAAE,aAAa,GAAG,YAAY,CAAC;IAC1C,gFAAgF;IAChF,MAAM,CAAC,IAAI,EAAE,aAAa,GAAG,YAAY,CAAC;CAC3C;AAED,oCAAoC;AACpC,wBAAgB,SAAS,IAAI,GAAG,CAoK/B"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export { createHud, type Hud, type HudFocusOptions } from './hud';
|
|
2
2
|
export { attachHud, type AttachHudOptions } from './attach';
|
|
3
3
|
export { createHudContribution, HUD_AFFORDANCE_KIND, type HudHitPayload } from './tool';
|
|
4
|
-
export type { Widget, WidgetBounds, HudDrawCtx, HudPointerEvent, HudKeyEvent, HudAccessibleNode, HudAccessibleTree, } from './widget';
|
|
4
|
+
export type { Widget, WidgetBounds, HudDrawCtx, HudPointerEvent, HudKeyEvent, HudAccessibleNode, HudAccessibleTree, HudTextInput, } from './widget';
|
|
5
5
|
export { DEFAULT_WIDGET_CLAIMS, claimsOf, isFocusable } from './widget';
|
|
6
6
|
export type { HudHost } from './host';
|
|
7
7
|
export { DEFAULT_FONT_FAMILY, registerDefaultFont } from './fonts/registerDefaultFont';
|
|
@@ -18,6 +18,7 @@ export { attachMenuHost, type AttachMenuHostOptions } from './menu/attachMenuHos
|
|
|
18
18
|
export { measureLabel } from './menu/measureLabel';
|
|
19
19
|
export { createMenuWidget, type MenuWidgetOptions } from './menu/menuWidget';
|
|
20
20
|
export { DEFAULT_MENU_METRICS, type MenuIcons, type MenuMetrics } from './menu/drawPanel';
|
|
21
|
+
export { DEFAULT_MENU_PALETTE } from './menu/colorPicker';
|
|
21
22
|
export { glyphCommands, type GlyphPlacement } from './glyph';
|
|
22
23
|
export { boxShadowCommands } from './boxShadow';
|
|
23
24
|
export { createLoupe, type LoupeOptions, type LoupeBaseOptions, type LoupeHandle, type LoupeMode } from './loupe/createLoupe';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,KAAK,GAAG,EAAE,KAAK,eAAe,EAAE,MAAM,OAAO,CAAC;AAClE,OAAO,EAAE,SAAS,EAAE,KAAK,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAC5D,OAAO,EAAE,qBAAqB,EAAE,mBAAmB,EAAE,KAAK,aAAa,EAAE,MAAM,QAAQ,CAAC;AACxF,YAAY,EACV,MAAM,EACN,YAAY,EACZ,UAAU,EACV,eAAe,EACf,WAAW,EACX,iBAAiB,EACjB,iBAAiB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,KAAK,GAAG,EAAE,KAAK,eAAe,EAAE,MAAM,OAAO,CAAC;AAClE,OAAO,EAAE,SAAS,EAAE,KAAK,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAC5D,OAAO,EAAE,qBAAqB,EAAE,mBAAmB,EAAE,KAAK,aAAa,EAAE,MAAM,QAAQ,CAAC;AACxF,YAAY,EACV,MAAM,EACN,YAAY,EACZ,UAAU,EACV,eAAe,EACf,WAAW,EACX,iBAAiB,EACjB,iBAAiB,EACjB,YAAY,GACb,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,qBAAqB,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AACxE,YAAY,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAC;AACtC,OAAO,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AACvF,YAAY,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AACjE,YAAY,E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