@flighthq/clock 0.5.1-next.815.cc08b93 → 0.5.1-next.903.f434bc2
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/README.md +2 -2
- package/dist/clock.d.ts +2 -1
- package/dist/clock.d.ts.map +1 -1
- package/dist/clock.js +15 -12
- package/dist/clock.js.map +1 -1
- package/dist/contract.d.ts +1 -0
- package/dist/contract.d.ts.map +1 -1
- package/dist/contract.js +1 -0
- package/dist/contract.js.map +1 -1
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -13,5 +13,5 @@ Import the supported application-facing API from `@flighthq/clock`. The `@flight
|
|
|
13
13
|
This package is part of the locked-version Flight SDK graph. Applications may instead install and import `@flighthq/sdk` when package-level tree shaking is sufficient.
|
|
14
14
|
|
|
15
15
|
- [Flight project](https://github.com/flighthq/flight)
|
|
16
|
-
- [Source for @flighthq/clock@0.5.1-next.
|
|
17
|
-
- [License](https://github.com/flighthq/flight/blob/
|
|
16
|
+
- [Source for @flighthq/clock@0.5.1-next.903.f434bc2](https://github.com/flighthq/flight/tree/f434bc233778d75aeea61995df3a8cfaec459a85/packages/clock)
|
|
17
|
+
- [License](https://github.com/flighthq/flight/blob/f434bc233778d75aeea61995df3a8cfaec459a85/LICENSE.md)
|
package/dist/clock.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Clock, ClockOptions } from '@flighthq/types/contract';
|
|
1
|
+
import type { Clock, ClockOptions, EntityConstruction } from '@flighthq/types/contract';
|
|
2
2
|
export declare function addClockChild(parent: Clock, child: Clock): void;
|
|
3
3
|
export declare function advanceClock(clock: Clock, deltaSeconds: number): void;
|
|
4
4
|
export declare function createChildClock(parent: Clock, options?: Readonly<ClockOptions>): Clock;
|
|
@@ -6,6 +6,7 @@ export declare function createClock(options?: Readonly<ClockOptions>): Clock;
|
|
|
6
6
|
export declare function disposeClock(clock: Clock): void;
|
|
7
7
|
export declare function getClockEffectiveScale(clock: Readonly<Clock>): number;
|
|
8
8
|
export declare function getClockParent(clock: Readonly<Clock>): Clock | null;
|
|
9
|
+
export declare function initializeClock(out: EntityConstruction<Clock>, options?: Readonly<ClockOptions>): void;
|
|
9
10
|
export declare function isClockEffectivelyPaused(clock: Readonly<Clock>): boolean;
|
|
10
11
|
export declare function pauseClock(clock: Clock): void;
|
|
11
12
|
export declare function removeClockChild(parent: Clock, child: Clock): void;
|
package/dist/clock.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"clock.d.ts","sourceRoot":"","sources":["../src/clock.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,KAAK,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;
|
|
1
|
+
{"version":3,"file":"clock.d.ts","sourceRoot":"","sources":["../src/clock.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,KAAK,EAAE,YAAY,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAIxF,wBAAgB,aAAa,CAAC,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,GAAG,IAAI,CAK/D;AAQD,wBAAgB,YAAY,CAAC,KAAK,EAAE,KAAK,EAAE,YAAY,EAAE,MAAM,GAAG,IAAI,CASrE;AAID,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,KAAK,EAAE,OAAO,CAAC,EAAE,QAAQ,CAAC,YAAY,CAAC,GAAG,KAAK,CAIvF;AAED,wBAAgB,WAAW,CAAC,OAAO,CAAC,EAAE,QAAQ,CAAC,YAAY,CAAC,GAAG,KAAK,CAInE;AAMD,wBAAgB,YAAY,CAAC,KAAK,EAAE,KAAK,GAAG,IAAI,CAQ/C;AAKD,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,QAAQ,CAAC,KAAK,CAAC,GAAG,MAAM,CAQrE;AAID,wBAAgB,cAAc,CAAC,KAAK,EAAE,QAAQ,CAAC,KAAK,CAAC,GAAG,KAAK,GAAG,IAAI,CAEnE;AAID,wBAAgB,eAAe,CAAC,GAAG,EAAE,kBAAkB,CAAC,KAAK,CAAC,EAAE,OAAO,CAAC,EAAE,QAAQ,CAAC,YAAY,CAAC,GAAG,IAAI,CAQtG;AAID,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,QAAQ,CAAC,KAAK,CAAC,GAAG,OAAO,CAOxE;AAID,wBAAgB,UAAU,CAAC,KAAK,EAAE,KAAK,GAAG,IAAI,CAE7C;AAID,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,GAAG,IAAI,CAKlE;AAID,wBAAgB,UAAU,CAAC,KAAK,EAAE,KAAK,GAAG,IAAI,CAG7C;AAID,wBAAgB,WAAW,CAAC,KAAK,EAAE,KAAK,GAAG,IAAI,CAE9C;AAID,wBAAgB,aAAa,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,CAE/D"}
|
package/dist/clock.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { allocateEntity, finishEntity } from '@flighthq/entity/contract';
|
|
2
2
|
import { clearSignal, emitSignal } from '@flighthq/signals/contract';
|
|
3
3
|
// Attaches `child` under `parent`, detaching it from any previous parent first (reparent-safe). After
|
|
4
4
|
// this, advancing `parent` cascades into `child`. A no-op if `child` is already parented here.
|
|
@@ -34,18 +34,10 @@ export function createChildClock(parent, options) {
|
|
|
34
34
|
addClockChild(parent, child);
|
|
35
35
|
return child;
|
|
36
36
|
}
|
|
37
|
-
// Allocates a root clock (no parent). Defaults to realtime and running; pass options to start scaled or
|
|
38
|
-
// paused. Drive it each frame with advanceClock(clock, dtSeconds).
|
|
39
37
|
export function createClock(options) {
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
deltaTime: 0,
|
|
44
|
-
elapsed: 0,
|
|
45
|
-
parent: null,
|
|
46
|
-
children: [],
|
|
47
|
-
onTick: null,
|
|
48
|
-
});
|
|
38
|
+
const out = allocateEntity();
|
|
39
|
+
initializeClock(out, options);
|
|
40
|
+
return finishEntity(out);
|
|
49
41
|
}
|
|
50
42
|
// Detaches a clock from its parent, releases its children, and drops any onTick listeners so nothing
|
|
51
43
|
// keeps the subtree — or the clock's subscribers — reachable through it: the parent no longer references
|
|
@@ -79,6 +71,17 @@ export function getClockEffectiveScale(clock) {
|
|
|
79
71
|
export function getClockParent(clock) {
|
|
80
72
|
return clock.parent;
|
|
81
73
|
}
|
|
74
|
+
// Allocates a root clock (no parent). Defaults to realtime and running; pass options to start scaled or
|
|
75
|
+
// paused. Drive it each frame with advanceClock(clock, dtSeconds).
|
|
76
|
+
export function initializeClock(out, options) {
|
|
77
|
+
out.scale = options?.scale ?? 1;
|
|
78
|
+
out.paused = options?.paused ?? false;
|
|
79
|
+
out.deltaTime = 0;
|
|
80
|
+
out.elapsed = 0;
|
|
81
|
+
out.parent = null;
|
|
82
|
+
out.children = [];
|
|
83
|
+
out.onTick = null;
|
|
84
|
+
}
|
|
82
85
|
// Whether this clock receives a zero delta on the next advance: true if the clock itself or any ancestor
|
|
83
86
|
// is paused. A clock can be locally running yet effectively paused because a parent is paused.
|
|
84
87
|
export function isClockEffectivelyPaused(clock) {
|
package/dist/clock.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"clock.js","sourceRoot":"","sources":["../src/clock.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;
|
|
1
|
+
{"version":3,"file":"clock.js","sourceRoot":"","sources":["../src/clock.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzE,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AAGrE,sGAAsG;AACtG,+FAA+F;AAC/F,MAAM,UAAU,aAAa,CAAC,MAAa,EAAE,KAAY;IACvD,IAAI,KAAK,CAAC,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GAAG,CAAC,CAAC;AACtB,CAAC;AAED,mGAAmG;AACnG,yCAAyC;AACzC,MAAM,UAAU,WAAW,CAAC,KAAY;IACtC,KAAK,CAAC,MAAM,GAAG,KAAK,CAAC;AACvB,CAAC;AAED,wGAAwG;AACxG,0FAA0F;AAC1F,MAAM,UAAU,aAAa,CAAC,KAAY,EAAE,KAAa;IACvD,KAAK,CAAC,KAAK,GAAG,KAAK,CAAC;AACtB,CAAC"}
|
package/dist/contract.d.ts
CHANGED
package/dist/contract.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contract.d.ts","sourceRoot":"","sources":["../src/contract.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,gBAAgB,CAAC"}
|
|
1
|
+
{"version":3,"file":"contract.d.ts","sourceRoot":"","sources":["../src/contract.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,gBAAgB,CAAC;AAC/B,OAAO,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC"}
|
package/dist/contract.js
CHANGED
package/dist/contract.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contract.js","sourceRoot":"","sources":["../src/contract.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,gBAAgB,CAAC"}
|
|
1
|
+
{"version":3,"file":"contract.js","sourceRoot":"","sources":["../src/contract.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,gBAAgB,CAAC;AAC/B,OAAO,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@flighthq/clock",
|
|
3
|
-
"version": "0.5.1-next.
|
|
3
|
+
"version": "0.5.1-next.903.f434bc2",
|
|
4
4
|
"author": "Joshua Granick and other contributors",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -38,9 +38,9 @@
|
|
|
38
38
|
"clean:dist": "tsx ../../scripts/clean-package-dist.ts"
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
|
-
"@flighthq/entity": "0.5.1-next.
|
|
42
|
-
"@flighthq/signals": "0.5.1-next.
|
|
43
|
-
"@flighthq/types": "0.5.1-next.
|
|
41
|
+
"@flighthq/entity": "0.5.1-next.903.f434bc2",
|
|
42
|
+
"@flighthq/signals": "0.5.1-next.903.f434bc2",
|
|
43
|
+
"@flighthq/types": "0.5.1-next.903.f434bc2"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
46
|
"typescript": "^5.3.0"
|