@modlock/modlock 0.1.67 → 0.1.68
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/curve.d.ts +18 -9
- package/entities.d.ts +215 -34
- package/entities.js +232 -51
- package/host.gen.d.ts +63 -2
- package/index.js +276 -61
- package/package.json +6 -6
- package/timer.d.ts +2 -1
- package/ui.d.ts +17 -3
package/package.json
CHANGED
|
@@ -7,11 +7,11 @@
|
|
|
7
7
|
"license": "MIT",
|
|
8
8
|
"name": "@modlock/modlock",
|
|
9
9
|
"optionalDependencies": {
|
|
10
|
-
"@modlock/darwin-arm64": "0.1.
|
|
11
|
-
"@modlock/darwin-x64": "0.1.
|
|
12
|
-
"@modlock/linux-arm64": "0.1.
|
|
13
|
-
"@modlock/linux-x64": "0.1.
|
|
14
|
-
"@modlock/win32-x64": "0.1.
|
|
10
|
+
"@modlock/darwin-arm64": "0.1.68",
|
|
11
|
+
"@modlock/darwin-x64": "0.1.68",
|
|
12
|
+
"@modlock/linux-arm64": "0.1.68",
|
|
13
|
+
"@modlock/linux-x64": "0.1.68",
|
|
14
|
+
"@modlock/win32-x64": "0.1.68"
|
|
15
15
|
},
|
|
16
16
|
"repository": {
|
|
17
17
|
"type": "git",
|
|
@@ -20,5 +20,5 @@
|
|
|
20
20
|
"sideEffects": false,
|
|
21
21
|
"type": "module",
|
|
22
22
|
"types": "index.d.ts",
|
|
23
|
-
"version": "0.1.
|
|
23
|
+
"version": "0.1.68"
|
|
24
24
|
}
|
package/timer.d.ts
CHANGED
|
@@ -17,6 +17,7 @@ export declare function every(seconds: number, fn: () => void): Timer;
|
|
|
17
17
|
export declare function sequence(fn: (run: number) => number | void): Timer;
|
|
18
18
|
/**
|
|
19
19
|
* advance moves the clock to a frame and runs the timers that came due. A
|
|
20
|
-
* callback that throws ends only its own timer.
|
|
20
|
+
* callback that throws ends only its own timer. A clock that runs backward,
|
|
21
|
+
* as a new map's does, keeps each timer's remaining delay.
|
|
21
22
|
*/
|
|
22
23
|
export declare function advance(seconds: number): void;
|
package/ui.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Player } from './host.gen.js';
|
|
1
|
+
import type { Player, Wheel } from './host.gen.js';
|
|
2
2
|
/**
|
|
3
3
|
* Length is a size: pixels, a percentage of the parent, 'fit' to size to the
|
|
4
4
|
* children, or 'fill' to share the space left in the parent's flow.
|
|
@@ -177,6 +177,16 @@ export interface UiElement {
|
|
|
177
177
|
readonly props: Props;
|
|
178
178
|
readonly key?: string;
|
|
179
179
|
}
|
|
180
|
+
/**
|
|
181
|
+
* ChangeHandler is the handler of any input: it takes the value the control
|
|
182
|
+
* holds, whose type each element's props narrow. The method form makes the
|
|
183
|
+
* parameter bivariant, so a handler of a text, a number or a flag fits, and
|
|
184
|
+
* the host checks the value against the handler's own type when it calls; a
|
|
185
|
+
* parameter of type never would refuse every value in a scriptc build.
|
|
186
|
+
*/
|
|
187
|
+
type ChangeHandler = {
|
|
188
|
+
bivarianceHack(player: Player, value: unknown): void;
|
|
189
|
+
}['bivarianceHack'];
|
|
180
190
|
/**
|
|
181
191
|
* Props are an element's props: every intrinsic element's, by name, so the
|
|
182
192
|
* encoder reads them as typed fields. A component's props pass through to it.
|
|
@@ -212,7 +222,8 @@ export interface Props {
|
|
|
212
222
|
readonly on?: boolean;
|
|
213
223
|
readonly options?: readonly string[];
|
|
214
224
|
readonly selected?: number;
|
|
215
|
-
readonly onChange?:
|
|
225
|
+
readonly onChange?: ChangeHandler;
|
|
226
|
+
readonly onWheel?: (player: Player, wheel: Wheel) => void;
|
|
216
227
|
}
|
|
217
228
|
/**
|
|
218
229
|
* ElementProps are the props every drawn element takes. hover is the style
|
|
@@ -293,6 +304,8 @@ export interface SliderProps extends InputProps {
|
|
|
293
304
|
max?: number;
|
|
294
305
|
step?: number;
|
|
295
306
|
onChange?: (player: Player, value: number) => void;
|
|
307
|
+
/** onWheel receives one wheel step and its pointer anchor while enabled. */
|
|
308
|
+
onWheel?: (player: Player, wheel: Wheel) => void;
|
|
296
309
|
}
|
|
297
310
|
/** ToggleProps make a box the player checks, labeled by its text children. */
|
|
298
311
|
export interface ToggleProps extends InputProps {
|
|
@@ -433,6 +446,7 @@ export declare function press(player: Player, node: string): void;
|
|
|
433
446
|
* change runs the handler of the input the player changed, with its value as
|
|
434
447
|
* the host checked it.
|
|
435
448
|
*/
|
|
436
|
-
export declare function change(player: Player, node: string, value: string | number | boolean | undefined): void;
|
|
449
|
+
export declare function change(player: Player, node: string, value: string | number | boolean | Wheel | undefined): void;
|
|
437
450
|
/** tick advances the clock to the frame at seconds and fades expiring notices. */
|
|
438
451
|
export declare function tick(seconds: number): void;
|
|
452
|
+
export {};
|