@weasel-js/hud 1.13.0-rc.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 +22 -5
- 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
|
@@ -1 +1 @@
|
|
|
1
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,CAAC;QAAC,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IACvC;;0BAEsB;IACtB,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,OAAO,CAAC,IAAI,EAAE,SAAS,GAAG,IAAI,CAAC;IAC/B,SAAS,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IAChC;oEACgE;IAChE,KAAK,CAAC,CAAC,EAAE;QAAE,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAC;IACzC;;;;0BAIsB;IACtB,IAAI,CAAC,CAAC,CAAC,EAAE;QAAE,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,MAAM,GAAG,IAAI,CAAC;IAClD;sEACkE;IAClE,OAAO,IAAI,IAAI,CAAC;IAChB,OAAO,IAAI,IAAI,CAAC;CACjB;AAED;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,YAAY,GAAG,WAAW,CAoO3D"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { type MenuController } from '@weasel-js/menu';
|
|
1
|
+
import { type MenuController, type MenuEntry } from '@weasel-js/menu';
|
|
2
2
|
import type { HudAccessibleNode } from '../widget';
|
|
3
3
|
/** An open menu as the accessibility tree a DOM menu's panels show: rows with their roles and states, and the
|
|
4
|
-
* highlighted row of the innermost open level active. */
|
|
5
|
-
export declare function accessibleMenu(c: MenuController): HudAccessibleNode;
|
|
4
|
+
* highlighted row of the innermost open level active. `swatchOf` names the color a picker holds. */
|
|
5
|
+
export declare function accessibleMenu(c: MenuController, swatchOf?: (e: MenuEntry) => string | undefined): HudAccessibleNode;
|
|
6
6
|
//# sourceMappingURL=accessibleMenu.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"accessibleMenu.d.ts","sourceRoot":"","sources":["../../src/menu/accessibleMenu.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkB,KAAK,cAAc,EAAqB,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"accessibleMenu.d.ts","sourceRoot":"","sources":["../../src/menu/accessibleMenu.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkB,KAAK,cAAc,EAAE,KAAK,SAAS,EAAqB,MAAM,iBAAiB,CAAC;AACzG,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAgCnD;qGACqG;AACrG,wBAAgB,cAAc,CAAC,CAAC,EAAE,cAAc,EAAE,QAAQ,CAAC,EAAE,CAAC,CAAC,EAAE,SAAS,KAAK,MAAM,GAAG,SAAS,GAAG,iBAAiB,CAEpH"}
|
|
@@ -2,7 +2,7 @@ import type { MenuHost } from '@weasel-js/core';
|
|
|
2
2
|
import type { Hud } from '../hud';
|
|
3
3
|
import { type MenuWidgetOptions } from './menuWidget';
|
|
4
4
|
/** What {@link attachMenuHost} needs beyond the hud and host. */
|
|
5
|
-
export type AttachMenuHostOptions = Pick<MenuWidgetOptions, 'toCanvas' | 'canvasSize' | 'measure' | 'metrics' | 'icons'>;
|
|
5
|
+
export type AttachMenuHostOptions = Pick<MenuWidgetOptions, 'toCanvas' | 'canvasSize' | 'measure' | 'metrics' | 'icons' | 'palette' | 'repeat'>;
|
|
6
6
|
/** Draw `host`'s open menu as a widget on `hud`, focused while open. A press
|
|
7
7
|
* anywhere else takes focus from it, which closes the menu, as do a wheel
|
|
8
8
|
* outside it, the window losing focus and a resize. Closing any other way
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"attachMenuHost.d.ts","sourceRoot":"","sources":["../../src/menu/attachMenuHost.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"attachMenuHost.d.ts","sourceRoot":"","sources":["../../src/menu/attachMenuHost.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAEhD,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,QAAQ,CAAC;AAElC,OAAO,EAAoB,KAAK,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAExE,iEAAiE;AACjE,MAAM,MAAM,qBAAqB,GAC/B,IAAI,CAAC,iBAAiB,EAAE,UAAU,GAAG,YAAY,GAAG,SAAS,GAAG,SAAS,GAAG,OAAO,GAAG,SAAS,GAAG,QAAQ,CAAC,CAAC;AAE9G;;;0FAG0F;AAC1F,wBAAgB,cAAc,CAAC,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,qBAAqB,GAAG,MAAM,IAAI,CA2DhG"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { type StepRepeatOptions } from '@weasel-js/headless';
|
|
2
|
+
import { type MenuController, type MenuNumberEntry, type Rect } from '@weasel-js/menu';
|
|
3
|
+
import { type MenuMetrics } from './drawPanel';
|
|
4
|
+
/** A number row's step chip: the row, and which way it steps. */
|
|
5
|
+
export interface MenuChip {
|
|
6
|
+
entry: MenuNumberEntry;
|
|
7
|
+
dir: 1 | -1;
|
|
8
|
+
}
|
|
9
|
+
/** The topmost of `panels` under (x, y), or -1. */
|
|
10
|
+
export declare function levelAt(panels: readonly Rect[], x: number, y: number): number;
|
|
11
|
+
/** The step chip under (x, y) of a number row that takes input, or null. */
|
|
12
|
+
export declare function chipUnder(c: Pick<MenuController, 'entriesAt'>, panels: readonly Rect[], m: MenuMetrics, x: number, y: number): MenuChip | null;
|
|
13
|
+
/** A press on a number row's chips: {@link ChipHold.press}, then {@link ChipHold.follow} for each move and the release. */
|
|
14
|
+
export interface ChipHold {
|
|
15
|
+
/** Step the chip under (x, y), if any, once now and then repeatedly while it is held. */
|
|
16
|
+
press(x: number, y: number): void;
|
|
17
|
+
/** The pointer is at (x, y), or released at null: the hold ends unless it is still on the held chip. */
|
|
18
|
+
follow(at: {
|
|
19
|
+
x: number;
|
|
20
|
+
y: number;
|
|
21
|
+
} | null): void;
|
|
22
|
+
stop(): void;
|
|
23
|
+
}
|
|
24
|
+
/** Hold-to-repeat on number rows' step chips, timed as a `@weasel-js/ui` number field's steppers are by default.
|
|
25
|
+
* `under` finds the chip at a point. */
|
|
26
|
+
export declare function createChipHold(c: Pick<MenuController, 'spin' | 'numberValue'>, under: (x: number, y: number) => MenuChip | null, opts?: StepRepeatOptions): ChipHold;
|
|
27
|
+
//# sourceMappingURL=chipRepeat.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chipRepeat.d.ts","sourceRoot":"","sources":["../../src/menu/chipRepeat.ts"],"names":[],"mappings":"AAAA,OAAO,EAAoB,KAAK,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAC/E,OAAO,EAAqB,KAAK,cAAc,EAAE,KAAK,eAAe,EAAE,KAAK,IAAI,EAAE,MAAM,iBAAiB,CAAC;AAC1G,OAAO,EAAS,KAAK,WAAW,EAAE,MAAM,aAAa,CAAC;AAGtD,iEAAiE;AACjE,MAAM,WAAW,QAAQ;IAAG,KAAK,EAAE,eAAe,CAAC;IAAC,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC,CAAA;CAAE;AAEjE,mDAAmD;AACnD,wBAAgB,OAAO,CAAC,MAAM,EAAE,SAAS,IAAI,EAAE,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAM7E;AAED,4EAA4E;AAC5E,wBAAgB,SAAS,CACvB,CAAC,EAAE,IAAI,CAAC,cAAc,EAAE,WAAW,CAAC,EAAE,MAAM,EAAE,SAAS,IAAI,EAAE,EAAE,CAAC,EAAE,WAAW,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAClG,QAAQ,GAAG,IAAI,CASjB;AAED,2HAA2H;AAC3H,MAAM,WAAW,QAAQ;IACvB,yFAAyF;IACzF,KAAK,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAClC,wGAAwG;IACxG,MAAM,CAAC,EAAE,EAAE;QAAE,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,GAAG,IAAI,CAAC;IAClD,IAAI,IAAI,IAAI,CAAC;CACd;AAED;yCACyC;AACzC,wBAAgB,cAAc,CAC5B,CAAC,EAAE,IAAI,CAAC,cAAc,EAAE,MAAM,GAAG,aAAa,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,KAAK,QAAQ,GAAG,IAAI,EACjG,IAAI,CAAC,EAAE,iBAAiB,GACvB,QAAQ,CAoBV"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { MenuController, MenuEntry } from '@weasel-js/menu';
|
|
2
|
+
/** The swatches a HUD menu's color row offers when given no palette. */
|
|
3
|
+
export declare const DEFAULT_MENU_PALETTE: readonly string[];
|
|
4
|
+
/** Entries with each color row a HUD menu can write turned into a picker, and the color each row shows. */
|
|
5
|
+
export interface HudColorPickers {
|
|
6
|
+
entries: MenuEntry[];
|
|
7
|
+
/** The color drawn in `e`'s icon column: a picker's current color, or a swatch's own. */
|
|
8
|
+
swatchOf(e: MenuEntry): string | undefined;
|
|
9
|
+
}
|
|
10
|
+
/** `text` as the `#rrggbb` (or with `alpha`, `#rrggbbaa`) a color row writes, or undefined when it is no hex color.
|
|
11
|
+
* Without `alpha`, an alpha typed is dropped; with it, a color typed without one takes `keep`'s, else opaque. */
|
|
12
|
+
export declare function hexColor(text: string, alpha: boolean, keep?: string): string | undefined;
|
|
13
|
+
/**
|
|
14
|
+
* `entries` with every color row that has a `set` and is not disabled made a submenu: one row per `palette` color,
|
|
15
|
+
* drawn as its swatch, which writes that color, then a text row holding the hex, which writes what is typed into
|
|
16
|
+
* it. Both leave the menu open. `c` is the controller the entries go to, read only once a row
|
|
17
|
+
* is drawn or chosen.
|
|
18
|
+
*/
|
|
19
|
+
export declare function withColorPickers(entries: readonly MenuEntry[], palette: readonly string[], c: () => Pick<MenuController, 'colorValue' | 'setColor'>): HudColorPickers;
|
|
20
|
+
//# sourceMappingURL=colorPicker.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"colorPicker.d.ts","sourceRoot":"","sources":["../../src/menu/colorPicker.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAkB,cAAc,EAAE,SAAS,EAAiB,MAAM,iBAAiB,CAAC;AAEhG,wEAAwE;AACxE,eAAO,MAAM,oBAAoB,EAAE,SAAS,MAAM,EAIjD,CAAC;AAEF,2GAA2G;AAC3G,MAAM,WAAW,eAAe;IAC9B,OAAO,EAAE,SAAS,EAAE,CAAC;IACrB,yFAAyF;IACzF,QAAQ,CAAC,CAAC,EAAE,SAAS,GAAG,MAAM,GAAG,SAAS,CAAC;CAC5C;AAED;kHACkH;AAClH,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAMxF;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAC9B,OAAO,EAAE,SAAS,SAAS,EAAE,EAAE,OAAO,EAAE,SAAS,MAAM,EAAE,EAAE,CAAC,EAAE,MAAM,IAAI,CAAC,cAAc,EAAE,YAAY,GAAG,UAAU,CAAC,GAClH,eAAe,CAsCjB"}
|
package/dist/menu/drawPanel.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import type { DrawCommand } from '@weasel-js/core/renderer';
|
|
2
|
-
import type { MenuEntry, MenuNumberEntry } from '@weasel-js/menu';
|
|
2
|
+
import type { MenuEntry, MenuNumberEntry, MenuTextEntry } from '@weasel-js/menu';
|
|
3
3
|
import { type IconRegistry } from '@weasel-js/icons';
|
|
4
4
|
import type { HudDrawCtx, WidgetBounds } from '../widget';
|
|
5
|
+
import type { HudTextEdit } from './textEdit';
|
|
5
6
|
/** Sizes of a HUD menu panel, in CSS pixels. */
|
|
6
7
|
export interface MenuMetrics {
|
|
7
8
|
rowHeight: number;
|
|
@@ -26,10 +27,22 @@ export declare function panelSize(entries: readonly MenuEntry[], m: MenuMetrics,
|
|
|
26
27
|
};
|
|
27
28
|
/** Where a menu finds the glyph a row's `icon` names: an icon registry, or anything answering as one. */
|
|
28
29
|
export type MenuIcons = Pick<IconRegistry, 'get' | 'getVersion'>;
|
|
30
|
+
/** What a panel's value rows hold now, and the text row being typed into. */
|
|
31
|
+
export interface MenuDrawValues {
|
|
32
|
+
number(e: MenuNumberEntry): number | undefined;
|
|
33
|
+
text(e: MenuTextEntry): string | undefined;
|
|
34
|
+
editing?: HudTextEdit | null;
|
|
35
|
+
/** The color a row draws as a swatch in its icon column, in place of its icon or check. */
|
|
36
|
+
swatch?(e: MenuEntry): string | undefined;
|
|
37
|
+
/** Width of a label, which places the caret in typed text. Defaults to {@link measureLabel}. */
|
|
38
|
+
measure?(text: string, fontSize: number, fontFamily: string): number;
|
|
39
|
+
}
|
|
40
|
+
/** Each value row as it opened, with nothing being typed. */
|
|
41
|
+
export declare const OPENED_VALUES: MenuDrawValues;
|
|
29
42
|
/** One panel's commands: its rounded face and the DOM panel's box shadow, a highlight behind row
|
|
30
|
-
* `highlight`, and every row, with the glyph `icons` holds for each row's icon. A
|
|
31
|
-
* `
|
|
32
|
-
export declare function drawPanel(ctx: HudDrawCtx, b: WidgetBounds, entries: readonly MenuEntry[], highlight: number | null, m: MenuMetrics, icons?: MenuIcons,
|
|
43
|
+
* `highlight`, and every row, with the glyph `icons` holds for each row's icon. A value row shows what
|
|
44
|
+
* `values` says it holds, by default what it opened with. */
|
|
45
|
+
export declare function drawPanel(ctx: HudDrawCtx, b: WidgetBounds, entries: readonly MenuEntry[], highlight: number | null, m: MenuMetrics, icons?: MenuIcons, values?: MenuDrawValues): DrawCommand[];
|
|
33
46
|
/** Index of the entry under panel-local `y`, or null. */
|
|
34
47
|
export declare function rowAt(entries: readonly MenuEntry[], m: MenuMetrics, y: number): number | null;
|
|
35
48
|
//# sourceMappingURL=drawPanel.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"drawPanel.d.ts","sourceRoot":"","sources":["../../src/menu/drawPanel.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAI5D,OAAO,KAAK,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"drawPanel.d.ts","sourceRoot":"","sources":["../../src/menu/drawPanel.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAI5D,OAAO,KAAK,EAAE,SAAS,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAEjF,OAAO,EAAa,KAAK,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAGhE,OAAO,KAAK,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAG1D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAE9C,gDAAgD;AAChD,MAAM,WAAW,WAAW;IAC1B,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,eAAe,EAAE,MAAM,CAAC;IACxB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,+EAA+E;AAC/E,eAAO,MAAM,oBAAoB,EAAE,WAElC,CAAC;AAEF,uDAAuD;AACvD,wBAAgB,SAAS,CAAC,OAAO,EAAE,SAAS,SAAS,EAAE,EAAE,CAAC,EAAE,WAAW,GAAG;IAAE,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAA;CAAE,EAAE,CAQnG;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AAM,GAAG,MAAM,GAAG,IAAI,CAG7F"}
|
|
@@ -2,6 +2,7 @@ import type { OpenMenu } from '@weasel-js/core';
|
|
|
2
2
|
import { type Widget } from '../widget';
|
|
3
3
|
import { type MenuIcons, type MenuMetrics } from './drawPanel';
|
|
4
4
|
import type { Point } from '@weasel-js/geom';
|
|
5
|
+
import type { StepRepeatOptions } from '@weasel-js/headless';
|
|
5
6
|
/** What {@link createMenuWidget} needs: the open menu, how to close it, and the canvas it draws on. */
|
|
6
7
|
export interface MenuWidgetOptions {
|
|
7
8
|
open: OpenMenu;
|
|
@@ -19,6 +20,11 @@ export interface MenuWidgetOptions {
|
|
|
19
20
|
metrics?: MenuMetrics;
|
|
20
21
|
/** Where a row's icon is looked up; without it no row draws one. */
|
|
21
22
|
icons?: MenuIcons;
|
|
23
|
+
/** The swatches a color row's picker offers, as `#rrggbb`. Default {@link DEFAULT_MENU_PALETTE}. */
|
|
24
|
+
palette?: readonly string[];
|
|
25
|
+
/** The timing of a held number chip. Defaults to `REPEAT_DELAY_MS` and `REPEAT_EVERY_MS` from `@weasel-js/headless`,
|
|
26
|
+
* the defaults a `@weasel-js/ui` number field's steppers hold with. */
|
|
27
|
+
repeat?: StepRepeatOptions;
|
|
22
28
|
onChange(): void;
|
|
23
29
|
}
|
|
24
30
|
/** A widget that draws `open` as one panel per open level, driven by a menu controller it owns. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"menuWidget.d.ts","sourceRoot":"","sources":["../../src/menu/menuWidget.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAoB,QAAQ,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"menuWidget.d.ts","sourceRoot":"","sources":["../../src/menu/menuWidget.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAoB,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAElE,OAAO,EAAqG,KAAK,MAAM,EAAqB,MAAM,WAAW,CAAC;AAE9J,OAAO,EAAqD,KAAK,SAAS,EAAE,KAAK,WAAW,EAAE,MAAM,aAAa,CAAC;AAMlH,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAK7D,uGAAuG;AACvG,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,QAAQ,CAAC;IACf,iEAAiE;IACjE,KAAK,IAAI,IAAI,CAAC;IACd,+EAA+E;IAC/E,QAAQ,CAAC,MAAM,EAAE,KAAK,GAAG,KAAK,CAAC;IAC/B,UAAU,IAAI;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC;IAChD;mFAC+E;IAC/E,OAAO,CAAC,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,MAAM,CAAC;IACrE,OAAO,CAAC,EAAE,WAAW,CAAC;IACtB,oEAAoE;IACpE,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,oGAAoG;IACpG,OAAO,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAC5B;4EACwE;IACxE,MAAM,CAAC,EAAE,iBAAiB,CAAC;IAC3B,QAAQ,IAAI,IAAI,CAAC;CAClB;AAuCD,mGAAmG;AACnG,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,iBAAiB,GAAG,MAAM,CAiHhE"}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import type { MenuController, MenuEntry, MenuTextEntry } from '@weasel-js/menu';
|
|
2
|
+
/** A text row being typed into in a HUD menu: which row, what has been typed so far, and the caret and the other
|
|
3
|
+
* end of the selection, as code-point offsets into `draft`. `anchor` equals `caret` when nothing is selected.
|
|
4
|
+
* `preedit` is an input method's text still being composed, shown in place of the selection; absent with none. */
|
|
5
|
+
export interface HudTextEdit {
|
|
6
|
+
entry: MenuTextEntry;
|
|
7
|
+
draft: string;
|
|
8
|
+
caret: number;
|
|
9
|
+
anchor: number;
|
|
10
|
+
preedit?: string;
|
|
11
|
+
}
|
|
12
|
+
/** What the modifiers a key arrives with ask for: `shift` extends the selection, `mod` (Ctrl or Cmd) selects all on
|
|
13
|
+
* `a` and holds any other character, `line` takes an arrow, Backspace or Delete to the end of the line, and `word`
|
|
14
|
+
* takes them by a word. */
|
|
15
|
+
export interface EditMods {
|
|
16
|
+
shift?: boolean;
|
|
17
|
+
mod?: boolean;
|
|
18
|
+
line?: boolean;
|
|
19
|
+
word?: boolean;
|
|
20
|
+
}
|
|
21
|
+
/** The modifiers held for a key, read as the platform's text fields read them: on Apple, Cmd works by the line and
|
|
22
|
+
* Option by the word; elsewhere Ctrl works by the word, and Ctrl with Alt is AltGr, typing a character. */
|
|
23
|
+
export declare function editMods(evt: {
|
|
24
|
+
shiftKey: boolean;
|
|
25
|
+
ctrlKey: boolean;
|
|
26
|
+
metaKey: boolean;
|
|
27
|
+
altKey: boolean;
|
|
28
|
+
}, apple?: boolean): EditMods;
|
|
29
|
+
/** The start of the word before `from` (dir -1) or the end of the word after it (dir 1), skipping what lies between. */
|
|
30
|
+
export declare function wordStop(chars: readonly string[], from: number, dir: -1 | 1): number;
|
|
31
|
+
/** An edit of `entry` holding `draft`, with the caret at its end. */
|
|
32
|
+
export declare function startEdit(entry: MenuTextEntry, draft: string): HudTextEdit;
|
|
33
|
+
/** The selection's two ends, in order. */
|
|
34
|
+
export declare function selectionOf(edit: HudTextEdit): [number, number];
|
|
35
|
+
/** `edit` composing `text`, or with no composition when `text` is empty. */
|
|
36
|
+
export declare function composeEdit(edit: HudTextEdit, text: string): HudTextEdit;
|
|
37
|
+
/** `edit` with `text` in place of the selection and any composition, as a finished composition enters it. */
|
|
38
|
+
export declare function insertText(edit: HudTextEdit, text: string): HudTextEdit;
|
|
39
|
+
/** What `edit` shows: its preedit, if any, typed in place of the selection, and the span the preedit covers. */
|
|
40
|
+
export declare function shownEdit(edit: HudTextEdit): {
|
|
41
|
+
edit: HudTextEdit;
|
|
42
|
+
preedit?: [number, number];
|
|
43
|
+
};
|
|
44
|
+
/** What one key does to an edit: the edit it leaves, null once Enter or Escape ends it, and on Enter the text to
|
|
45
|
+
* write. A character replaces the selection, Backspace and Delete take it or the character (or the word, or the
|
|
46
|
+
* rest of the line) either side of the caret, and the arrows, Home and End move the caret; any other key is held
|
|
47
|
+
* and ignored. */
|
|
48
|
+
export declare function editKey(edit: HudTextEdit, key: string, mods?: EditMods): {
|
|
49
|
+
edit: HudTextEdit | null;
|
|
50
|
+
commit?: string;
|
|
51
|
+
};
|
|
52
|
+
/** The text row a HUD menu is typing into, kept by the widget since it has no field: what is typed, written through
|
|
53
|
+
* `c` on Enter. `changed` hears every change to what is drawn. */
|
|
54
|
+
export declare function createTextEditor(c: Pick<MenuController, 'textValue' | 'setText'>, changed: () => void): {
|
|
55
|
+
current: () => HudTextEdit | null;
|
|
56
|
+
/** Start typing into `e` when it is a text row that is not disabled, and not the row already typed into. */
|
|
57
|
+
start(e: MenuEntry | undefined): void;
|
|
58
|
+
/** When `e` is the row being typed into, put the caret at the offset `at` finds in what is typed; `at` gives
|
|
59
|
+
* undefined to leave the caret be. */
|
|
60
|
+
place(e: MenuEntry | undefined, at: (draft: string) => number | undefined): void;
|
|
61
|
+
/** End the edit keeping what was typed, as a blur does, unless it is `e`'s. */
|
|
62
|
+
leave(e?: MenuEntry): void;
|
|
63
|
+
/** Show `text` as an input method's composition in progress; '' clears it. */
|
|
64
|
+
compose(text: string): void;
|
|
65
|
+
/** Enter `text` without a key, as a finished composition does. */
|
|
66
|
+
insert(text: string): void;
|
|
67
|
+
/** Feed a key to the edit; false when nothing is being typed. */
|
|
68
|
+
key(key: string, mods?: EditMods): boolean;
|
|
69
|
+
};
|
|
70
|
+
//# sourceMappingURL=textEdit.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"textEdit.d.ts","sourceRoot":"","sources":["../../src/menu/textEdit.ts"],"names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E,IAAI,EAAE,MAAM,GAAG,WAAW,CAGvE;AAED,gHAAgH;AAChH,wBAAgB,SAAS,CAAC,IAAI,EAAE,WAAW,GAAG;IAAE,IAAI,EAAE,WAAW,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CAAE,CAK9F;AA0BD;;;mBAGmB;AACnB,wBAAgB,OAAO,CAAC,IAAI,EAAE,WAAW,EAAE,GAAG,EAAE,MAAM,EAAE,IAAI,GAAE,QAAa,GAAG;IAAE,IAAI,EAAE,WAAW,GAAG,IAAI,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAA;CAAE,CAkB1H;AAED;mEACmE;AACnE,wBAAgB,gBAAgB,CAAC,CAAC,EAAE,IAAI,CAAC,cAAc,EAAE,WAAW,GAAG,SAAS,CAAC,EAAE,OAAO,EAAE,MAAM,IAAI;;IAUlG,4GAA4G;aACnG,SAAS,GAAG,SAAS;IAK9B;2CACuC;aAC9B,SAAS,GAAG,SAAS,MAAM,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,GAAG,SAAS;IAMzE,+EAA+E;cACrE,SAAS;IACnB,8EAA8E;kBAChE,MAAM;IAKpB,kEAAkE;iBACrD,MAAM;IAKnB,iEAAiE;aACxD,MAAM,SAAQ,QAAQ,GAAQ,OAAO;EAOjD"}
|
package/dist/menu/valueRows.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ import type { DrawCommand } from '@weasel-js/core/renderer';
|
|
|
2
2
|
import { type MenuColorEntry, type MenuEntry, type MenuNumberEntry } from '@weasel-js/menu';
|
|
3
3
|
import type { WidgetBounds } from '../widget';
|
|
4
4
|
import type { MenuMetrics } from './drawPanel';
|
|
5
|
+
import { type HudTextEdit } from './textEdit';
|
|
5
6
|
/** A span across a panel, from its left edge. */
|
|
6
7
|
export interface Span {
|
|
7
8
|
x: number;
|
|
@@ -36,11 +37,28 @@ export declare function numberCommands(b: WidgetBounds, r: {
|
|
|
36
37
|
y: number;
|
|
37
38
|
h: number;
|
|
38
39
|
}, e: MenuNumberEntry, value: number | undefined, m: MenuMetrics, ink: ValueInk): DrawCommand[];
|
|
39
|
-
/** A text row's value at the row's end, muted
|
|
40
|
+
/** A text row's value at the row's end, muted while disabled. */
|
|
40
41
|
export declare function textCommands(b: WidgetBounds, r: {
|
|
41
42
|
y: number;
|
|
42
43
|
h: number;
|
|
43
|
-
}, value: string | undefined, m: MenuMetrics, ink: ValueInk): DrawCommand[];
|
|
44
|
+
}, value: string | undefined, m: MenuMetrics, ink: ValueInk, mode?: 'off' | 'live'): DrawCommand[];
|
|
45
|
+
/** The code-point offset in `draft`, typed into a row of panel width `w`, nearest panel-local `x`, or undefined when
|
|
46
|
+
* `x` is left of the text, over the row's label. `measure` gives the width of a run of the row's text. */
|
|
47
|
+
export declare function caretAt(draft: string, w: number, m: MenuMetrics, x: number, measure: (text: string) => number): number | undefined;
|
|
48
|
+
/** Panel-local x of the caret `edit` draws, after any composition in progress. */
|
|
49
|
+
export declare function caretX(edit: HudTextEdit, w: number, m: MenuMetrics, measure: (text: string) => number): number;
|
|
50
|
+
/** A text row being typed into: what is typed at the row's end, the selection behind it in `selection`, an input
|
|
51
|
+
* method's composition underlined in place of the selection, and a caret where `edit` has it. `measure` gives the
|
|
52
|
+
* width of a run of the row's text. */
|
|
53
|
+
export declare function typingCommands(b: WidgetBounds, r: {
|
|
54
|
+
y: number;
|
|
55
|
+
h: number;
|
|
56
|
+
}, edit: HudTextEdit, m: MenuMetrics, ink: ValueInk, selection: string, measure: (text: string) => number): DrawCommand[];
|
|
57
|
+
/** A swatch of `color` in a row's icon column, outlined in `edge`; `width` 2 marks the color a picker holds. */
|
|
58
|
+
export declare function swatchCommand(b: WidgetBounds, r: {
|
|
59
|
+
y: number;
|
|
60
|
+
h: number;
|
|
61
|
+
}, color: string, m: MenuMetrics, edge: string, width?: number): DrawCommand;
|
|
44
62
|
/** The swatch a color row draws in its icon column, and its hex at the row's end. */
|
|
45
63
|
export declare function colorCommands(b: WidgetBounds, r: {
|
|
46
64
|
y: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"valueRows.d.ts","sourceRoot":"","sources":["../../src/menu/valueRows.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAE5D,OAAO,EAAqC,KAAK,cAAc,EAAE,KAAK,SAAS,EAAE,KAAK,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAC/H,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAC9C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"valueRows.d.ts","sourceRoot":"","sources":["../../src/menu/valueRows.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAE5D,OAAO,EAAqC,KAAK,cAAc,EAAE,KAAK,SAAS,EAAE,KAAK,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAC/H,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAC9C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,EAA0B,KAAK,WAAW,EAAE,MAAM,YAAY,CAAC;AAEtE,iDAAiD;AACjD,MAAM,WAAW,IAAI;IAAG,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAA;CAAE;AAE9C;;;GAGG;AACH,wBAAgB,WAAW,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,EAAE,WAAW,GAAG;IAAE,KAAK,EAAE,IAAI,CAAC;IAAC,KAAK,EAAE,IAAI,CAAC;IAAC,IAAI,EAAE,IAAI,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAInH;AAED,4FAA4F;AAC5F,wBAAgB,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,EAAE,WAAW,EAAE,CAA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,MAAM,GAAG,MAAM,GAAG,SAAS,CAOlI;AASD,kFAAkF;AAClF,wBAAgB,MAAM,CAAC,IAAI,EAAE,WAAW,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,WAAW,EAAE,OAAO,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,GAAG,MAAM,CAG9G;AAED;;wCAEwC;AACxC,wBAAgB,cAAc,CAC5B,CAAC,EAAE,YAAY,EAAE,CAAC,EAAE;IAAE,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAA;CAAE,EAAE,IAAI,EAAE,WAAW,EAAE,CAAC,EAAE,WAAW,EAAE,GAAG,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,EACjH,OAAO,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,GAChC,WAAW,EAAE,CAwBf;AAED,gHAAgH;AAChH,wBAAgB,aAAa,CAC3B,CAAC,EAAE,YAAY,EAAE,CAAC,EAAE;IAAE,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAA;CAAE,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC,EAAE,WAAW,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,SAAI,GACnG,WAAW,CAQb;AAED,qFAAqF;AACrF,wBAAgB,aAAa,CAC3B,CAAC,EAAE,YAAY,EAAE,CAAC,EAAE;IAAE,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAA;CAAE,EAAE,CAAC,EAAE,cAAc,EAAE,CAAC,EAAE,WAAW,EAAE,GAAG,EAAE,QAAQ,GAC7F,WAAW,EAAE,CAOf"}
|
package/dist/react/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as e, o as t, r as n } from "../tool-
|
|
1
|
+
import { n as e, o as t, r as n } from "../tool-DELNnWid.js";
|
|
2
2
|
import { resolveTheme as r, weaselTheme as i } from "@weasel-js/theme";
|
|
3
3
|
import { useEffect as a, useMemo as o, useState as s } from "react";
|
|
4
4
|
import { useThemeOptional as c } from "@weasel-js/theme/react";
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { Hud } from './hud';
|
|
2
|
+
/** What the hidden input hands back to the canvas's own focus wiring. */
|
|
3
|
+
export interface TextInputHandlers {
|
|
4
|
+
keydown(e: KeyboardEvent): void;
|
|
5
|
+
keyup(e: KeyboardEvent): void;
|
|
6
|
+
/** DOM focus left both the input and the canvas. */
|
|
7
|
+
blur(): void;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* A hidden `<input>` that holds DOM focus in place of `element`, the canvas, while the focused widget's
|
|
11
|
+
* {@link HudTextInput} has an edit running, so an input method composes into it. It sits over the edit's caret,
|
|
12
|
+
* where the platform puts its candidate window. Keys on it go to `on`'s handlers, as the canvas's would; composition
|
|
13
|
+
* goes to the widget. Returns the input and a detach.
|
|
14
|
+
*/
|
|
15
|
+
export declare function wireTextInput(element: HTMLElement, hud: Hud, on: TextInputHandlers): {
|
|
16
|
+
input: HTMLInputElement;
|
|
17
|
+
detach(): void;
|
|
18
|
+
};
|
|
19
|
+
//# sourceMappingURL=textInputHost.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"textInputHost.d.ts","sourceRoot":"","sources":["../src/textInputHost.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAGjC,yEAAyE;AACzE,MAAM,WAAW,iBAAiB;IAChC,OAAO,CAAC,CAAC,EAAE,aAAa,GAAG,IAAI,CAAC;IAChC,KAAK,CAAC,CAAC,EAAE,aAAa,GAAG,IAAI,CAAC;IAC9B,oDAAoD;IACpD,IAAI,IAAI,IAAI,CAAC;CACd;AAED;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,OAAO,EAAE,WAAW,EAAE,GAAG,EAAE,GAAG,EAAE,EAAE,EAAE,iBAAiB,GAAG;IAAE,KAAK,EAAE,gBAAgB,CAAC;IAAC,MAAM,IAAI,IAAI,CAAA;CAAE,CA4FhI"}
|