react-native-roster 0.4.7 → 0.4.8
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 +4 -0
- package/dist/src/components/roster/roster.types.d.ts +3 -1
- package/dist/src/components/roster/roster.types.d.ts.map +1 -1
- package/dist/src/components/roster/use-roster-press.d.ts +2 -2
- package/dist/src/components/roster/use-roster-press.d.ts.map +1 -1
- package/dist/src/components/roster/use-roster-press.js +4 -4
- package/dist/src/components/roster/use-roster-press.js.map +1 -1
- package/dist/src/components/roster/use-roster.d.ts.map +1 -1
- package/dist/src/components/roster/use-roster.js +8 -6
- package/dist/src/components/roster/use-roster.js.map +1 -1
- package/llms.txt +6 -1
- package/package.json +1 -1
- package/src/components/roster/README.md +6 -0
- package/src/components/roster/roster.types.ts +3 -0
- package/src/components/roster/use-roster-press.ts +10 -4
- package/src/components/roster/use-roster.ts +19 -5
package/README.md
CHANGED
|
@@ -262,6 +262,10 @@ datasets then cannot collide when they reuse lane IDs and versions. Omitting the
|
|
|
262
262
|
core-owned default, while deliberately reusing one identity shares target-warm coverage across
|
|
263
263
|
projections.
|
|
264
264
|
|
|
265
|
+
`Roster` and `useRoster` each own an isolated identity by default. Pass a stable `cacheIdentity`
|
|
266
|
+
prop when multiple Roster surfaces show the same dataset and should deliberately share target-warm
|
|
267
|
+
geometry and coverage.
|
|
268
|
+
|
|
265
269
|
Minified, with peers external: `/core` is 13.6 kB and the root entry is 51.2 kB.
|
|
266
270
|
`/rrule` adds 12.9 kB of its own code plus its two dependencies, `rrule-temporal`
|
|
267
271
|
and `@js-temporal/polyfill`, which install with the package. Web runs in CI on
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { ComponentType, ReactNode, RefObject } from 'react';
|
|
2
2
|
import type { LayoutChangeEvent, NativeScrollEvent, NativeSyntheticEvent, ScrollView, StyleProp, ViewStyle } from 'react-native';
|
|
3
3
|
import type { SharedValue } from 'react-native-reanimated';
|
|
4
|
-
import type { Coverage, Lane, LaneComparator, LaneFlag, LaneGeometry, Projection, Rect, Source, Window, WindowSpec } from '../../core';
|
|
4
|
+
import type { Coverage, Lane, LaneComparator, LaneFlag, LaneGeometry, Projection, Rect, ScopedCacheIdentity, Source, Window, WindowSpec } from '../../core';
|
|
5
5
|
import type { GapInput, IntervalInput } from '../layers/layers.types';
|
|
6
6
|
import type { SelectionLayoutProps } from './selection/selection-layout.types';
|
|
7
7
|
/** A selected interval: the rect input plus its absolute bounds and the view zone for formatting. */
|
|
@@ -32,6 +32,8 @@ export type RosterScroll = {
|
|
|
32
32
|
export type RosterInput = {
|
|
33
33
|
/** Retain interval selection on press, default false. Lives on RosterInput for hook consumers. */
|
|
34
34
|
selectable?: boolean;
|
|
35
|
+
/** Stable dataset cache identity; omitted gives this Roster or useRoster instance isolated ownership. */
|
|
36
|
+
cacheIdentity?: ScopedCacheIdentity;
|
|
35
37
|
lanes: Lane[];
|
|
36
38
|
windowSpec: WindowSpec;
|
|
37
39
|
minuteStep?: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"roster.types.d.ts","sourceRoot":"","sources":["../../../../src/components/roster/roster.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACjE,OAAO,KAAK,EACV,iBAAiB,EACjB,iBAAiB,EACjB,oBAAoB,EACpB,UAAU,EACV,SAAS,EACT,SAAS,EACV,MAAM,cAAc,CAAC;AACtB,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,KAAK,EACV,QAAQ,EACR,IAAI,EACJ,cAAc,EACd,QAAQ,EACR,YAAY,EACZ,UAAU,EACV,IAAI,EACJ,MAAM,EACN,MAAM,EACN,UAAU,EACX,MAAM,YAAY,CAAC;AACpB,OAAO,KAAK,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACtE,OAAO,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BAAuB,CAAC,EAAE,aAAa,CAAC,mBAAmB,CAAC,CAAC;IAC7D;;;OAGG;IACH,eAAe,CAAC,EAAE,aAAa,CAAC,oBAAoB,CAAC,CAAC;IACtD;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,2EAA2E;IAC3E,kBAAkB,CAAC,EAAE,aAAa,CAAC,cAAc,CAAC,CAAC;IACnD,oDAAoD;IACpD,mBAAmB,CAAC,EAAE,aAAa,CAAC,eAAe,CAAC,CAAC;IACrD,mIAAmI;IACnI,iBAAiB,CAAC,EAAE,aAAa,CAAC,aAAa,CAAC,CAAC;IACjD,sEAAsE;IACtE,YAAY,CAAC,EAAE,aAAa,CAAC,QAAQ,CAAC,CAAC;IACvC,2EAA2E;IAC3E,aAAa,CAAC,EAAE,aAAa,CAAC,SAAS,CAAC,CAAC;IACzC,8DAA8D;IAC9D,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB,yEAAyE;IACzE,UAAU,CAAC,EAAE,SAAS,CAAC;IACvB,4EAA4E;IAC5E,eAAe,CAAC,EAAE,aAAa,CAAC,WAAW,CAAC,CAAC;IAC7C,qFAAqF;IACrF,wBAAwB,CAAC,EAAE,aAAa,CAAC,gBAAgB,CAAC,CAAC;IAC3D,kGAAkG;IAClG,aAAa,CAAC,EAAE,aAAa,CAAC,SAAS,CAAC,CAAC;CAC1C,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Dispatch, SetStateAction } from 'react';
|
|
2
|
-
import type { Lane, Window } from '../../core';
|
|
2
|
+
import type { Lane, ScopedCacheIdentity, Window } from '../../core';
|
|
3
3
|
import type { RosterInput, RosterModel, RosterProjection } from './roster.types';
|
|
4
4
|
export type SelectedInterval = NonNullable<RosterModel['selection']>;
|
|
5
|
-
export declare function useRosterPress(input: RosterInput, window: Window, projection: RosterProjection, width: number, selection: RosterModel['selection'], setSelected: Dispatch<SetStateAction<SelectedInterval | null>>): (lane: Lane, pointX: number, pointY: number) => void;
|
|
5
|
+
export declare function useRosterPress(input: RosterInput, window: Window, projection: RosterProjection, cacheIdentity: ScopedCacheIdentity, width: number, selection: RosterModel['selection'], setSelected: Dispatch<SetStateAction<SelectedInterval | null>>): (lane: Lane, pointX: number, pointY: number) => void;
|
|
6
6
|
//# sourceMappingURL=use-roster-press.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-roster-press.d.ts","sourceRoot":"","sources":["../../../../src/components/roster/use-roster-press.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAEtD,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"use-roster-press.d.ts","sourceRoot":"","sources":["../../../../src/components/roster/use-roster-press.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAEtD,OAAO,KAAK,EAAE,IAAI,EAAE,mBAAmB,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AAGpE,OAAO,KAAK,EAAE,WAAW,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAEjF,MAAM,MAAM,gBAAgB,GAAG,WAAW,CAAC,WAAW,CAAC,WAAW,CAAC,CAAC,CAAC;AAGrE,wBAAgB,cAAc,CAC5B,KAAK,EAAE,WAAW,EAClB,MAAM,EAAE,MAAM,EACd,UAAU,EAAE,gBAAgB,EAC5B,aAAa,EAAE,mBAAmB,EAClC,KAAK,EAAE,MAAM,EACb,SAAS,EAAE,WAAW,CAAC,WAAW,CAAC,EACnC,WAAW,EAAE,QAAQ,CAAC,cAAc,CAAC,gBAAgB,GAAG,IAAI,CAAC,CAAC,UAMhC,IAAI,UAAU,MAAM,UAAU,MAAM,KAAG,IAAI,CAwD1E"}
|
|
@@ -5,13 +5,13 @@ const react_1 = require("react");
|
|
|
5
5
|
const core_1 = require("../../core");
|
|
6
6
|
const hit_test_1 = require("../../core/hit-test");
|
|
7
7
|
// Isolate the stable press ref so it does not prevent compilation of derived roster values.
|
|
8
|
-
function useRosterPress(input, window, projection, width, selection, setSelected) {
|
|
9
|
-
const currentPress = { input, window, projection, width, selection };
|
|
8
|
+
function useRosterPress(input, window, projection, cacheIdentity, width, selection, setSelected) {
|
|
9
|
+
const currentPress = { input, window, projection, cacheIdentity, width, selection };
|
|
10
10
|
const pressInput = (0, react_1.useRef)(currentPress);
|
|
11
11
|
pressInput.current = currentPress;
|
|
12
12
|
const [press] = (0, react_1.useState)(() => {
|
|
13
13
|
return function press(lane, pointX, pointY) {
|
|
14
|
-
const { input, window, projection, width, selection } = pressInput.current;
|
|
14
|
+
const { input, window, projection, cacheIdentity, width, selection } = pressInput.current;
|
|
15
15
|
const { minuteStep = 60, onIntervalPress, onGapPress, onCellPress } = input;
|
|
16
16
|
const { rowHeight, viewTimezone } = projection;
|
|
17
17
|
if (!Number.isFinite(pointX) ||
|
|
@@ -21,7 +21,7 @@ function useRosterPress(input, window, projection, width, selection, setSelected
|
|
|
21
21
|
pointY < 0 ||
|
|
22
22
|
pointY >= rowHeight)
|
|
23
23
|
return;
|
|
24
|
-
const hit = (0, hit_test_1.hitTest)(lane, (0, core_1.layoutLane)(lane, window, projection), pointX, pointY);
|
|
24
|
+
const hit = (0, hit_test_1.hitTest)(lane, (0, core_1.layoutLane)(lane, window, projection, cacheIdentity), pointX, pointY);
|
|
25
25
|
if (hit?.kind === 'interval') {
|
|
26
26
|
if (input.selectable) {
|
|
27
27
|
const layer = lane.layers.find((layer) => layer.id === hit.rect.layerId);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-roster-press.js","sourceRoot":"","sources":["../../../../src/components/roster/use-roster-press.ts"],"names":[],"mappings":";;;AACA,iCAAy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,CAAC;gBACD,eAAe,EAAE,CAAC,GAAG,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;gBAClC,OAAO;YACT,CAAC;YACD,IAAI,SAAS;gBAAE,WAAW,CAAC,IAAI,CAAC,CAAC;YACjC,IAAI,GAAG,EAAE,IAAI,KAAK,KAAK,EAAE,CAAC;gBACxB,UAAU,EAAE,CAAC,GAAG,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;gBAC7B,OAAO;YACT,CAAC;YACD,MAAM,IAAI,GAAG,IAAI,CAAC,GAAG,CACnB,MAAM,CAAC,KAAK,EACZ,IAAA,iBAAU,EAAC,IAAA,cAAO,EAAC,UAAU,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,UAAU,EAAE,YAAY,CAAC,CAC1E,CAAC;YACF,IAAI,IAAI,GAAG,MAAM,CAAC,GAAG;gBAAE,WAAW,EAAE,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;QACnD,CAAC,CAAC;IACJ,CAAC,CAAC,CAAC;IACH,OAAO,KAAK,CAAC;AACf,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-roster.d.ts","sourceRoot":"","sources":["../../../../src/components/roster/use-roster.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,WAAW,EAAE,WAAW,EAAoB,MAAM,gBAAgB,CAAC;AAIjF,wBAAgB,SAAS,CAAC,KAAK,EAAE,WAAW,GAAG,WAAW,
|
|
1
|
+
{"version":3,"file":"use-roster.d.ts","sourceRoot":"","sources":["../../../../src/components/roster/use-roster.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,WAAW,EAAE,WAAW,EAAoB,MAAM,gBAAgB,CAAC;AAIjF,wBAAgB,SAAS,CAAC,KAAK,EAAE,WAAW,GAAG,WAAW,CAwHzD"}
|
|
@@ -8,6 +8,8 @@ const use_roster_press_1 = require("./use-roster-press");
|
|
|
8
8
|
const ticks_1 = require("./utils/ticks");
|
|
9
9
|
function useRoster(input) {
|
|
10
10
|
const { lanes, windowSpec, now = null, minuteStep = 60, sortLanes = core_1.byLabel, rowHeight = 48, pxPerMinute = 0.5, onNavigate, } = input;
|
|
11
|
+
const [ownedCacheIdentity] = (0, react_1.useState)(() => ({}));
|
|
12
|
+
const cacheIdentity = input.cacheIdentity ?? ownedCacheIdentity;
|
|
11
13
|
const [selected, setSelected] = (0, react_1.useState)(null);
|
|
12
14
|
function dismissSelection() {
|
|
13
15
|
setSelected(null);
|
|
@@ -39,20 +41,20 @@ function useRoster(input) {
|
|
|
39
41
|
? { x: (0, core_1.xAtTime)(projection, window, now), now }
|
|
40
42
|
: null;
|
|
41
43
|
const contentWidth = duration * projection.pxPerMinute;
|
|
42
|
-
const coverage = new Map(lanes.map((lane) => [lane.id, (0, core_1.coverageFor)(lane, window)]));
|
|
44
|
+
const coverage = new Map(lanes.map((lane) => [lane.id, (0, core_1.coverageFor)(lane, window, cacheIdentity)]));
|
|
43
45
|
const orderedLanes = [...lanes].sort((a, b) => sortLanes(a, b, coverage));
|
|
44
46
|
const laneState = new Map(lanes.map((lane) => [
|
|
45
47
|
lane.id,
|
|
46
48
|
{ flag: (0, core_1.flagFor)(lane, window), complete: lane.complete ?? true },
|
|
47
49
|
]));
|
|
48
50
|
function geometryFor(lane) {
|
|
49
|
-
return (0, core_1.layoutLane)(lane, window, projection);
|
|
51
|
+
return (0, core_1.layoutLane)(lane, window, projection, cacheIdentity);
|
|
50
52
|
}
|
|
51
|
-
const selection = reconcileSelection(selected, lanes, window, projection, input.selectable ?? false);
|
|
53
|
+
const selection = reconcileSelection(selected, lanes, window, projection, cacheIdentity, input.selectable ?? false);
|
|
52
54
|
// Discard invalid selection during reconciliation, before rendering any stale detail.
|
|
53
55
|
if (selected && !selection)
|
|
54
56
|
setSelected(null);
|
|
55
|
-
const press = (0, use_roster_press_1.useRosterPress)(input, window, projection, contentWidth, selection, setSelected);
|
|
57
|
+
const press = (0, use_roster_press_1.useRosterPress)(input, window, projection, cacheIdentity, contentWidth, selection, setSelected);
|
|
56
58
|
return {
|
|
57
59
|
selection,
|
|
58
60
|
dismissSelection,
|
|
@@ -93,7 +95,7 @@ function useRoster(input) {
|
|
|
93
95
|
};
|
|
94
96
|
}
|
|
95
97
|
// Match provenance and nearest bounds while preserving the stored display values.
|
|
96
|
-
function reconcileSelection(selected, lanes, window, projection, enabled) {
|
|
98
|
+
function reconcileSelection(selected, lanes, window, projection, cacheIdentity, enabled) {
|
|
97
99
|
if (selected && enabled) {
|
|
98
100
|
const lane = lanes.find((lane) => lane.id === selected.lane.id);
|
|
99
101
|
const layer = lane?.layers.find((layer) => layer.id === selected.layer.id);
|
|
@@ -101,7 +103,7 @@ function reconcileSelection(selected, lanes, window, projection, enabled) {
|
|
|
101
103
|
const sources = new Set(selected.rect.sources.map((source) => JSON.stringify([source.kind, source.id])));
|
|
102
104
|
let rect;
|
|
103
105
|
let nearest = 1;
|
|
104
|
-
for (const candidate of (0, core_1.layoutLane)(lane, window, projection).rects) {
|
|
106
|
+
for (const candidate of (0, core_1.layoutLane)(lane, window, projection, cacheIdentity).rects) {
|
|
105
107
|
if (candidate.layerId !== layer.id)
|
|
106
108
|
continue;
|
|
107
109
|
const identities = new Set(candidate.sources.map((source) => JSON.stringify([source.kind, source.id])));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-roster.js","sourceRoot":"","sources":["../../../../src/components/roster/use-roster.ts"],"names":[],"mappings":";;;AAAA,iCAAyC;AAEzC,qEAAwE;AAExE,qCAAoG;AAEpG,yDAA2E;AAC3E,yCAAyC;AAEzC,mBAA0B,KAAkB;IAC1C,MAAM,EACJ,KAAK,EACL,UAAU,EACV,GAAG,GAAG,IAAI,EACV,UAAU,GAAG,EAAE,EACf,SAAS,GAAG,cAAO,EACnB,SAAS,GAAG,EAAE,EACd,WAAW,GAAG,GAAG,EACjB,UAAU,GACX,GAAG,KAAK,CAAC;IACV,MAAM,CAAC,QAAQ,EAAE,WAAW,CAAC,GAAG,IAA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C,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC;oBACnE,IAAI,CAAC,GAAG,CAAC,IAAA,cAAO,EAAC,UAAU,EAAE,MAAM,EAAE,SAAS,CAAC,CAAC,GAAG,SAAS,CAAC,KAAK,CAAC,GAAG,QAAQ,CAAC,GAAG,CAAC,CAAC;gBACtF,IAAI,UAAU,IAAI,OAAO,IAAI,CAAC,CAAC,IAAI,IAAI,UAAU,GAAG,OAAO,CAAC,EAAE,CAAC;oBAC7D,OAAO,GAAG,UAAU,CAAC;oBACrB,IAAI,GAAG,SAAS,CAAC;gBACnB,CAAC;YACH,CAAC;YACD,IAAI,IAAI;gBAAE,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,QAAQ,CAAC,KAAK,EAAE,GAAG,EAAE,QAAQ,CAAC,GAAG,EAAE,CAAC;QACnF,CAAC;IACH,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC"}
|
package/llms.txt
CHANGED
|
@@ -189,7 +189,8 @@ Component props are ComponentType<Input>.
|
|
|
189
189
|
Roster required props: lanes: Lane[], windowSpec: WindowSpec.
|
|
190
190
|
Optional: now (epoch ms or null, default null), minuteStep (60), rowHeight (48),
|
|
191
191
|
pxPerMinute (default 0.5, positive finite, grows to fit viewport),
|
|
192
|
-
|
|
192
|
+
cacheIdentity (stable ScopedCacheIdentity for deliberate dataset sharing), sortLanes (byLabel),
|
|
193
|
+
highlightSource, onNavigate, onIntervalPress, onGapPress,
|
|
193
194
|
onCellPress, onIntervalHover (web only), style, headerStyle, laneLabelColumnStyle,
|
|
194
195
|
bodyStyle, laneLabelWidth (180), neverSetLabel, incompleteLabel, and zones below.
|
|
195
196
|
Each style prop has a className twin (className, headerClassName,
|
|
@@ -208,6 +209,8 @@ geometryFor(lane), scroll, press(lane,x,y), ticks, contentWidth, viewport,
|
|
|
208
209
|
now, nowLine, onLayout, navigate, selection, dismissSelection, and status ('empty' or 'ready'). There is no visibleRange
|
|
209
210
|
field in the shipped public model. Custom layouts must wire onLayout. Custom
|
|
210
211
|
bodies compute geometry only for mounted lanes, preserving virtualization.
|
|
212
|
+
Each Roster or useRoster instance owns an isolated cache identity when cacheIdentity is omitted.
|
|
213
|
+
Pass the same stable identity to surfaces that deliberately share one dataset.
|
|
211
214
|
now retains the raw instant. nowLine is { x, now }, using xAtTime with the fitted
|
|
212
215
|
projection.pxPerMinute scale; it is null when now is null or outside the
|
|
213
216
|
end-exclusive window. The caller owns clock updates.
|
|
@@ -412,6 +415,8 @@ projection-independent. ScopedCacheIdentity is a stable empty object whose refer
|
|
|
412
415
|
identifies one dataset. Omitted identities use the core-owned default; pass the same
|
|
413
416
|
explicit identity to share one dataset across calls and projections, and use distinct
|
|
414
417
|
identities for independent datasets whose lane IDs and versions can collide.
|
|
418
|
+
Roster resolves one instance-owned identity by default, or its cacheIdentity input when supplied,
|
|
419
|
+
and uses it for coverage, visible lane geometry, press hit-testing, and selection reconciliation.
|
|
415
420
|
flagFor(lane,window) is cheap and uncached. Geometry assembly reads fresh flag and
|
|
416
421
|
coverage outside cached rects. Repeated complete inputs retain references; treat
|
|
417
422
|
all results as read-only.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-roster",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.8",
|
|
4
4
|
"description": "Resource timeline and schedule components for React Native and web, with layered intervals, coverage, provenance, and explicit daylight-saving handling.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react-native",
|
|
@@ -43,6 +43,12 @@ with a noninteractive 2 px red line; `nowLineComponent` accepts the exported
|
|
|
43
43
|
content. Now values and component identity never enter the lane list or body
|
|
44
44
|
content key. The caller owns clock updates.
|
|
45
45
|
|
|
46
|
+
Each `Roster` or `useRoster` instance owns a stable `ScopedCacheIdentity` by default, isolating
|
|
47
|
+
datasets whose lane IDs and versions collide. The optional `cacheIdentity` input replaces that
|
|
48
|
+
owned identity so multiple surfaces can deliberately share one dataset's target-warm entries. The
|
|
49
|
+
resolved identity is used consistently for coverage, `geometryFor`, press hit-testing, and
|
|
50
|
+
selection reconciliation.
|
|
51
|
+
|
|
46
52
|
`selection/` holds the runtime-swappable presentation strategies (native popover, web popover) for one `SelectionLayoutProps` contract.
|
|
47
53
|
|
|
48
54
|
- `selection/selection-layout.types.ts`: exported `SelectionLayoutProps`, with body
|
|
@@ -16,6 +16,7 @@ import type {
|
|
|
16
16
|
LaneGeometry,
|
|
17
17
|
Projection,
|
|
18
18
|
Rect,
|
|
19
|
+
ScopedCacheIdentity,
|
|
19
20
|
Source,
|
|
20
21
|
Window,
|
|
21
22
|
WindowSpec,
|
|
@@ -45,6 +46,8 @@ export type RosterScroll = {
|
|
|
45
46
|
export type RosterInput = {
|
|
46
47
|
/** Retain interval selection on press, default false. Lives on RosterInput for hook consumers. */
|
|
47
48
|
selectable?: boolean;
|
|
49
|
+
/** Stable dataset cache identity; omitted gives this Roster or useRoster instance isolated ownership. */
|
|
50
|
+
cacheIdentity?: ScopedCacheIdentity;
|
|
48
51
|
lanes: Lane[];
|
|
49
52
|
windowSpec: WindowSpec;
|
|
50
53
|
minuteStep?: number;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Dispatch, SetStateAction } from 'react';
|
|
2
2
|
import { useRef, useState } from 'react';
|
|
3
|
-
import type { Lane, Window } from '../../core';
|
|
3
|
+
import type { Lane, ScopedCacheIdentity, Window } from '../../core';
|
|
4
4
|
import { layoutLane, snapToStep, timeAtX } from '../../core';
|
|
5
5
|
import { hitTest } from '../../core/hit-test';
|
|
6
6
|
import type { RosterInput, RosterModel, RosterProjection } from './roster.types';
|
|
@@ -12,16 +12,17 @@ export function useRosterPress(
|
|
|
12
12
|
input: RosterInput,
|
|
13
13
|
window: Window,
|
|
14
14
|
projection: RosterProjection,
|
|
15
|
+
cacheIdentity: ScopedCacheIdentity,
|
|
15
16
|
width: number,
|
|
16
17
|
selection: RosterModel['selection'],
|
|
17
18
|
setSelected: Dispatch<SetStateAction<SelectedInterval | null>>,
|
|
18
19
|
) {
|
|
19
|
-
const currentPress = { input, window, projection, width, selection };
|
|
20
|
+
const currentPress = { input, window, projection, cacheIdentity, width, selection };
|
|
20
21
|
const pressInput = useRef(currentPress);
|
|
21
22
|
pressInput.current = currentPress;
|
|
22
23
|
const [press] = useState(() => {
|
|
23
24
|
return function press(lane: Lane, pointX: number, pointY: number): void {
|
|
24
|
-
const { input, window, projection, width, selection } = pressInput.current;
|
|
25
|
+
const { input, window, projection, cacheIdentity, width, selection } = pressInput.current;
|
|
25
26
|
const { minuteStep = 60, onIntervalPress, onGapPress, onCellPress } = input;
|
|
26
27
|
const { rowHeight, viewTimezone } = projection;
|
|
27
28
|
if (
|
|
@@ -33,7 +34,12 @@ export function useRosterPress(
|
|
|
33
34
|
pointY >= rowHeight
|
|
34
35
|
)
|
|
35
36
|
return;
|
|
36
|
-
const hit = hitTest(
|
|
37
|
+
const hit = hitTest(
|
|
38
|
+
lane,
|
|
39
|
+
layoutLane(lane, window, projection, cacheIdentity),
|
|
40
|
+
pointX,
|
|
41
|
+
pointY,
|
|
42
|
+
);
|
|
37
43
|
if (hit?.kind === 'interval') {
|
|
38
44
|
if (input.selectable) {
|
|
39
45
|
const layer = lane.layers.find((layer) => layer.id === hit.rect.layerId);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { useRef, useState } from 'react';
|
|
2
2
|
import type { ScrollView } from 'react-native';
|
|
3
3
|
import { makeMutable, useAnimatedStyle } from 'react-native-reanimated';
|
|
4
|
-
import type { Lane, LaneGeometry, Rect, Window } from '../../core';
|
|
4
|
+
import type { Lane, LaneGeometry, Rect, ScopedCacheIdentity, Window } from '../../core';
|
|
5
5
|
import { byLabel, coverageFor, flagFor, layoutLane, timeAtX, windowFor, xAtTime } from '../../core';
|
|
6
6
|
import type { RosterInput, RosterModel, RosterProjection } from './roster.types';
|
|
7
7
|
import { type SelectedInterval, useRosterPress } from './use-roster-press';
|
|
@@ -18,6 +18,8 @@ export function useRoster(input: RosterInput): RosterModel {
|
|
|
18
18
|
pxPerMinute = 0.5,
|
|
19
19
|
onNavigate,
|
|
20
20
|
} = input;
|
|
21
|
+
const [ownedCacheIdentity] = useState<ScopedCacheIdentity>(() => ({}));
|
|
22
|
+
const cacheIdentity = input.cacheIdentity ?? ownedCacheIdentity;
|
|
21
23
|
const [selected, setSelected] = useState<SelectedInterval | null>(null);
|
|
22
24
|
function dismissSelection() {
|
|
23
25
|
setSelected(null);
|
|
@@ -52,7 +54,9 @@ export function useRoster(input: RosterInput): RosterModel {
|
|
|
52
54
|
? { x: xAtTime(projection, window, now), now }
|
|
53
55
|
: null;
|
|
54
56
|
const contentWidth = duration * projection.pxPerMinute;
|
|
55
|
-
const coverage = new Map(
|
|
57
|
+
const coverage = new Map(
|
|
58
|
+
lanes.map((lane) => [lane.id, coverageFor(lane, window, cacheIdentity)]),
|
|
59
|
+
);
|
|
56
60
|
const orderedLanes = [...lanes].sort((a, b) => sortLanes(a, b, coverage));
|
|
57
61
|
const laneState = new Map(
|
|
58
62
|
lanes.map((lane) => [
|
|
@@ -61,18 +65,27 @@ export function useRoster(input: RosterInput): RosterModel {
|
|
|
61
65
|
]),
|
|
62
66
|
);
|
|
63
67
|
function geometryFor(lane: Lane): LaneGeometry {
|
|
64
|
-
return layoutLane(lane, window, projection);
|
|
68
|
+
return layoutLane(lane, window, projection, cacheIdentity);
|
|
65
69
|
}
|
|
66
70
|
const selection = reconcileSelection(
|
|
67
71
|
selected,
|
|
68
72
|
lanes,
|
|
69
73
|
window,
|
|
70
74
|
projection,
|
|
75
|
+
cacheIdentity,
|
|
71
76
|
input.selectable ?? false,
|
|
72
77
|
);
|
|
73
78
|
// Discard invalid selection during reconciliation, before rendering any stale detail.
|
|
74
79
|
if (selected && !selection) setSelected(null);
|
|
75
|
-
const press = useRosterPress(
|
|
80
|
+
const press = useRosterPress(
|
|
81
|
+
input,
|
|
82
|
+
window,
|
|
83
|
+
projection,
|
|
84
|
+
cacheIdentity,
|
|
85
|
+
contentWidth,
|
|
86
|
+
selection,
|
|
87
|
+
setSelected,
|
|
88
|
+
);
|
|
76
89
|
return {
|
|
77
90
|
selection,
|
|
78
91
|
dismissSelection,
|
|
@@ -122,6 +135,7 @@ function reconcileSelection(
|
|
|
122
135
|
lanes: Lane[],
|
|
123
136
|
window: Window,
|
|
124
137
|
projection: RosterProjection,
|
|
138
|
+
cacheIdentity: ScopedCacheIdentity,
|
|
125
139
|
enabled: boolean,
|
|
126
140
|
): RosterModel['selection'] {
|
|
127
141
|
if (selected && enabled) {
|
|
@@ -133,7 +147,7 @@ function reconcileSelection(
|
|
|
133
147
|
);
|
|
134
148
|
let rect: Rect | undefined;
|
|
135
149
|
let nearest = 1;
|
|
136
|
-
for (const candidate of layoutLane(lane, window, projection).rects) {
|
|
150
|
+
for (const candidate of layoutLane(lane, window, projection, cacheIdentity).rects) {
|
|
137
151
|
if (candidate.layerId !== layer.id) continue;
|
|
138
152
|
const identities = new Set(
|
|
139
153
|
candidate.sources.map((source) => JSON.stringify([source.kind, source.id])),
|