react-native-roster 0.4.8 → 0.4.9
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 +3 -3
- package/dist/src/components/schedule/schedule.types.d.ts +3 -1
- package/dist/src/components/schedule/schedule.types.d.ts.map +1 -1
- package/dist/src/components/schedule/use-schedule.d.ts.map +1 -1
- package/dist/src/components/schedule/use-schedule.js +3 -1
- package/dist/src/components/schedule/use-schedule.js.map +1 -1
- package/dist/src/core/lru.d.ts +3 -0
- package/dist/src/core/lru.d.ts.map +1 -0
- package/dist/src/core/lru.js +18 -0
- package/dist/src/core/lru.js.map +1 -0
- package/llms.txt +3 -1
- package/package.json +1 -1
- package/src/components/schedule/README.md +4 -0
- package/src/components/schedule/schedule.types.ts +3 -0
- package/src/components/schedule/use-schedule.ts +4 -1
- package/src/core/lru.ts +13 -0
package/README.md
CHANGED
|
@@ -262,9 +262,9 @@ 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 `
|
|
266
|
-
|
|
267
|
-
geometry and coverage.
|
|
265
|
+
Every mounted `Roster`, `Schedule`, `useRoster`, and `useSchedule` surface owns an isolated
|
|
266
|
+
identity by default. Pass a stable `cacheIdentity` only when several surfaces render the same
|
|
267
|
+
dataset and should deliberately share target-warm geometry and coverage.
|
|
268
268
|
|
|
269
269
|
Minified, with peers external: `/core` is 13.6 kB and the root entry is 51.2 kB.
|
|
270
270
|
`/rrule` adds 12.9 kB of its own code plus its two dependencies, `rrule-temporal`
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { ComponentType } from 'react';
|
|
2
2
|
import type { StyleProp, ViewStyle } from 'react-native';
|
|
3
|
-
import type { DayColumn, Lane, LaneGeometry, Projection, Rect, Source, Transition, Window, WindowSpec } from '../../core';
|
|
3
|
+
import type { DayColumn, Lane, LaneGeometry, Projection, Rect, ScopedCacheIdentity, Source, Transition, Window, WindowSpec } from '../../core';
|
|
4
4
|
import type { GapInput, IntervalInput } from '../layers/layers.types';
|
|
5
5
|
export type ScheduleWindowSpec = WindowSpec & {
|
|
6
6
|
span: 'day' | 'week';
|
|
@@ -11,6 +11,8 @@ export type ScheduleProjection = Extract<Projection, {
|
|
|
11
11
|
export type ScheduleInput = {
|
|
12
12
|
lane: Lane;
|
|
13
13
|
windowSpec: ScheduleWindowSpec;
|
|
14
|
+
/** Stable cache identity for deliberate reuse across surfaces rendering one dataset. */
|
|
15
|
+
cacheIdentity?: ScopedCacheIdentity;
|
|
14
16
|
minuteStep?: number;
|
|
15
17
|
/** Positive finite pixels per wall-clock hour; defaults to 48. */
|
|
16
18
|
pxPerHour?: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schedule.types.d.ts","sourceRoot":"","sources":["../../../../src/components/schedule/schedule.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAC3C,OAAO,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzD,OAAO,KAAK,EACV,SAAS,EACT,IAAI,EACJ,YAAY,EACZ,UAAU,EACV,IAAI,EACJ,MAAM,EACN,UAAU,EACV,MAAM,EACN,UAAU,EACX,MAAM,YAAY,CAAC;AACpB,OAAO,KAAK,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAEtE,MAAM,MAAM,kBAAkB,GAAG,UAAU,GAAG;IAAE,IAAI,EAAE,KAAK,GAAG,MAAM,CAAA;CAAE,CAAC;AACvE,MAAM,MAAM,kBAAkB,GAAG,OAAO,CAAC,UAAU,EAAE;IAAE,WAAW,EAAE,SAAS,CAAA;CAAE,CAAC,CAAC;AACjF,MAAM,MAAM,aAAa,GAAG;IAC1B,IAAI,EAAE,IAAI,CAAC;IACX,UAAU,EAAE,kBAAkB,CA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Aa,CAAC,kBAAkB,CAAC,CAAC;IAClD,8FAA8F;IAC9F,kBAAkB,CAAC,EAAE,aAAa,CAAC;QAAE,GAAG,EAAE,SAAS,CAAA;KAAE,CAAC,CAAC;IACvD,8FAA8F;IAC9F,oBAAoB,CAAC,EAAE,aAAa,CAAC;QAAE,SAAS,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAC5D,6FAA6F;IAC7F,eAAe,CAAC,EAAE,aAAa,CAAC,mBAAmB,CAAC,CAAC;IACrD,+FAA+F;IAC/F,mBAAmB,CAAC,EAAE,aAAa,CAAC,uBAAuB,CAAC,CAAC;IAC7D,4EAA4E;IAC5E,gBAAgB,CAAC,EAAE,aAAa,CAAC;QAAE,CAAC,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAChE,uGAAuG;IACvG,iBAAiB,CAAC,EAAE,aAAa,CAAC,aAAa,CAAC,CAAC;IACjD,gGAAgG;IAChG,YAAY,CAAC,EAAE,aAAa,CAAC,QAAQ,CAAC,CAAC;IACvC,6GAA6G;IAC7G,mBAAmB,CAAC,EAAE,aAAa,CAAC;QAAE,IAAI,EAAE,IAAI,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CACpE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-schedule.d.ts","sourceRoot":"","sources":["../../../../src/components/schedule/use-schedule.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"use-schedule.d.ts","sourceRoot":"","sources":["../../../../src/components/schedule/use-schedule.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,aAAa,EAAE,aAAa,EAAsB,MAAM,kBAAkB,CAAC;AAGzF,wBAAgB,WAAW,CAAC,KAAK,EAAE,aAAa,GAAG,aAAa,CAsE/D"}
|
|
@@ -8,6 +8,8 @@ const use_schedule_viewport_1 = require("./use-schedule-viewport");
|
|
|
8
8
|
function useSchedule(input) {
|
|
9
9
|
const { lane, windowSpec, minuteStep = 60, pxPerHour = 48 } = input;
|
|
10
10
|
const width = (0, react_1.useContext)(use_schedule_viewport_1.ScheduleWidth);
|
|
11
|
+
const [ownedCacheIdentity] = (0, react_1.useState)(() => ({}));
|
|
12
|
+
const cacheIdentity = input.cacheIdentity ?? ownedCacheIdentity;
|
|
11
13
|
const [clock, setClock] = (0, react_1.useState)(Date.now);
|
|
12
14
|
// The current-time indicator follows the wall clock for the mounted surface's lifetime.
|
|
13
15
|
(0, react_1.useEffect)(() => {
|
|
@@ -27,7 +29,7 @@ function useSchedule(input) {
|
|
|
27
29
|
columnWidth: width / Math.max(1, days.length),
|
|
28
30
|
days,
|
|
29
31
|
};
|
|
30
|
-
const geometry = (0, core_1.layoutLane)(lane, window, projection);
|
|
32
|
+
const geometry = (0, core_1.layoutLane)(lane, window, projection, cacheIdentity);
|
|
31
33
|
const currentPress = { input, window, projection, geometry };
|
|
32
34
|
const pressInput = (0, react_1.useRef)(currentPress);
|
|
33
35
|
pressInput.current = currentPress;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-schedule.js","sourceRoot":"","sources":["../../../../src/components/schedule/use-schedule.ts"],"names":[],"mappings":";;;AAAA,iCAAgE;
|
|
1
|
+
{"version":3,"file":"use-schedule.js","sourceRoot":"","sources":["../../../../src/components/schedule/use-schedule.ts"],"names":[],"mappings":";;;AAAA,iCAAgE;AAEhE,qCAAuF;AACvF,kDAA8C;AAE9C,mEAAwD;AAExD,qBAA4B,KAAoB;IAC9C,MAAM,EAAE,IAAI,EAAE,UAAU,EAAE,UAAU,GAAG,EAAE,EAAE,SAAS,GAAG,EAAE,EAAE,GAAG,KAAK,CAAC;IACpE,MAAM,KAAK,GAAG,IAAA,kBAAU,EAAC,qCAAa,CAAC,CAAC;IACxC,MAAM,CAAC,kBAAkB,CAAC,GAAG,IAAA,gBAAQ,EAAsB,GAAG,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC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(exports, "__esModule", { value: true });
|
|
3
|
+
exports.touch = touch;
|
|
4
|
+
exports.trim = trim;
|
|
5
|
+
function touch(cache, key, value) {
|
|
6
|
+
cache.delete(key);
|
|
7
|
+
cache.set(key, value);
|
|
8
|
+
return value;
|
|
9
|
+
}
|
|
10
|
+
function trim(cache, limit) {
|
|
11
|
+
while (cache.size > limit) {
|
|
12
|
+
const oldest = cache.keys().next();
|
|
13
|
+
if (oldest.done)
|
|
14
|
+
return;
|
|
15
|
+
cache.delete(oldest.value);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=lru.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lru.js","sourceRoot":"","sources":["../../../src/core/lru.ts"],"names":[],"mappings":";;;;AAAA,eAA4B,KAAgB,EAAE,GAAM,EAAE,KAAQ;IAC5D,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;IAClB,KAAK,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;IACtB,OAAO,KAAK,CAAC;AACf,CAAC;AAED,cAA2B,KAAgB,EAAE,KAAa;IACxD,OAAO,KAAK,CAAC,IAAI,GAAG,KAAK,EAAE,CAAC;QAC1B,MAAM,MAAM,GAAG,KAAK,CAAC,IAAI,EAAE,CAAC,IAAI,EAAE,CAAC;QACnC,IAAI,MAAM,CAAC,IAAI;YAAE,OAAO;QACxB,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IAC7B,CAAC;AACH,CAAC"}
|
package/llms.txt
CHANGED
|
@@ -221,7 +221,7 @@ windows use their exact elapsed duration, including sub-minute spans. Cell times
|
|
|
221
221
|
are clamped up to window.start and rejected at or beyond window.end.
|
|
222
222
|
|
|
223
223
|
Schedule required props: lane: Lane, windowSpec: WindowSpec & {span:'day'|'week'}.
|
|
224
|
-
Optional: minuteStep (60), pxPerHour (48, positive finite), highlightSource,
|
|
224
|
+
Optional: cacheIdentity (stable ScopedCacheIdentity), minuteStep (60), pxPerHour (48, positive finite), highlightSource,
|
|
225
225
|
onNavigate, onIntervalPress, onGapPress, onCellPress, style, headerStyle,
|
|
226
226
|
gutterStyle, daysStyle, incompleteLabel, and zones below. Class twins are
|
|
227
227
|
className, headerClassName, gutterClassName, and daysClassName. No month/custom
|
|
@@ -232,6 +232,8 @@ press(columnIndex,x,y), and status:'ready'. The standalone hook uses a 280 px gr
|
|
|
232
232
|
The chassis measures width, reserves a 48 px gutter, and fits all actual day
|
|
233
233
|
columns without horizontal scrolling; the body scrolls vertically. now updates
|
|
234
234
|
every minute and is null outside the selected window.
|
|
235
|
+
Each mounted Schedule or useSchedule surface owns an isolated cache identity by default.
|
|
236
|
+
Reuse one explicit cacheIdentity only across surfaces that render the same dataset.
|
|
235
237
|
|
|
236
238
|
Props ending in Component accept ComponentType<Input>, mounted as React elements.
|
|
237
239
|
Props ending in Zone accept ReactNode; pass null to suppress a singleton default.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-roster",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.9",
|
|
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",
|
|
@@ -21,3 +21,7 @@ The chassis binds default component types once; ScheduleDay mounts components
|
|
|
21
21
|
with day data and passes nodes into ScheduleDayLayout. There is no black-box day
|
|
22
22
|
list to split: days, transitions, and rects already map in their owning parts.
|
|
23
23
|
Schedule has ten input-bearing component slots and no zero-argument singleton slots.
|
|
24
|
+
|
|
25
|
+
Each mounted `Schedule` or `useSchedule` surface owns an isolated `ScopedCacheIdentity` by default.
|
|
26
|
+
Pass one stable `cacheIdentity` to multiple surfaces only when they render the same dataset and
|
|
27
|
+
should share target-warm geometry and coverage.
|
|
@@ -6,6 +6,7 @@ import type {
|
|
|
6
6
|
LaneGeometry,
|
|
7
7
|
Projection,
|
|
8
8
|
Rect,
|
|
9
|
+
ScopedCacheIdentity,
|
|
9
10
|
Source,
|
|
10
11
|
Transition,
|
|
11
12
|
Window,
|
|
@@ -18,6 +19,8 @@ export type ScheduleProjection = Extract<Projection, { orientation: 'columns' }>
|
|
|
18
19
|
export type ScheduleInput = {
|
|
19
20
|
lane: Lane;
|
|
20
21
|
windowSpec: ScheduleWindowSpec;
|
|
22
|
+
/** Stable cache identity for deliberate reuse across surfaces rendering one dataset. */
|
|
23
|
+
cacheIdentity?: ScopedCacheIdentity;
|
|
21
24
|
minuteStep?: number;
|
|
22
25
|
/** Positive finite pixels per wall-clock hour; defaults to 48. */
|
|
23
26
|
pxPerHour?: number;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { useContext, useEffect, useRef, useState } from 'react';
|
|
2
|
+
import type { ScopedCacheIdentity } from '../../core';
|
|
2
3
|
import { dayColumnsFor, layoutLane, snapToStep, timeAtY, windowFor } from '../../core';
|
|
3
4
|
import { hitTest } from '../../core/hit-test';
|
|
4
5
|
import type { ScheduleInput, ScheduleModel, ScheduleProjection } from './schedule.types';
|
|
@@ -7,6 +8,8 @@ import { ScheduleWidth } from './use-schedule-viewport';
|
|
|
7
8
|
export function useSchedule(input: ScheduleInput): ScheduleModel {
|
|
8
9
|
const { lane, windowSpec, minuteStep = 60, pxPerHour = 48 } = input;
|
|
9
10
|
const width = useContext(ScheduleWidth);
|
|
11
|
+
const [ownedCacheIdentity] = useState<ScopedCacheIdentity>(() => ({}));
|
|
12
|
+
const cacheIdentity = input.cacheIdentity ?? ownedCacheIdentity;
|
|
10
13
|
const [clock, setClock] = useState(Date.now);
|
|
11
14
|
// The current-time indicator follows the wall clock for the mounted surface's lifetime.
|
|
12
15
|
useEffect(() => {
|
|
@@ -26,7 +29,7 @@ export function useSchedule(input: ScheduleInput): ScheduleModel {
|
|
|
26
29
|
columnWidth: width / Math.max(1, days.length),
|
|
27
30
|
days,
|
|
28
31
|
};
|
|
29
|
-
const geometry = layoutLane(lane, window, projection);
|
|
32
|
+
const geometry = layoutLane(lane, window, projection, cacheIdentity);
|
|
30
33
|
const currentPress = { input, window, projection, geometry };
|
|
31
34
|
const pressInput = useRef(currentPress);
|
|
32
35
|
pressInput.current = currentPress;
|
package/src/core/lru.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export function touch<K, V>(cache: Map<K, V>, key: K, value: V): V {
|
|
2
|
+
cache.delete(key);
|
|
3
|
+
cache.set(key, value);
|
|
4
|
+
return value;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
export function trim<K, V>(cache: Map<K, V>, limit: number): void {
|
|
8
|
+
while (cache.size > limit) {
|
|
9
|
+
const oldest = cache.keys().next();
|
|
10
|
+
if (oldest.done) return;
|
|
11
|
+
cache.delete(oldest.value);
|
|
12
|
+
}
|
|
13
|
+
}
|