react-native-roster 0.1.0 → 0.3.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/README.md +148 -3
- package/dist/src/components/primitives/portal.d.ts +12 -0
- package/dist/src/components/primitives/portal.d.ts.map +1 -0
- package/dist/src/components/primitives/portal.js +41 -0
- package/dist/src/components/primitives/portal.js.map +1 -0
- package/dist/src/components/roster/body-layout.d.ts +1 -1
- package/dist/src/components/roster/body-layout.d.ts.map +1 -1
- package/dist/src/components/roster/body-layout.js +7 -1
- package/dist/src/components/roster/body-layout.js.map +1 -1
- package/dist/src/components/roster/index.d.ts +2 -1
- package/dist/src/components/roster/index.d.ts.map +1 -1
- package/dist/src/components/roster/index.js +26 -3
- package/dist/src/components/roster/index.js.map +1 -1
- package/dist/src/components/roster/lanes/lane.d.ts.map +1 -1
- package/dist/src/components/roster/lanes/lane.js +2 -1
- package/dist/src/components/roster/lanes/lane.js.map +1 -1
- package/dist/src/components/roster/parts/lane-list.d.ts.map +1 -1
- package/dist/src/components/roster/parts/lane-list.js +2 -1
- package/dist/src/components/roster/parts/lane-list.js.map +1 -1
- package/dist/src/components/roster/roster.types.d.ts +29 -1
- package/dist/src/components/roster/roster.types.d.ts.map +1 -1
- package/dist/src/components/roster/selection/selection-layout.d.ts +4 -0
- package/dist/src/components/roster/selection/selection-layout.d.ts.map +1 -0
- package/dist/src/components/roster/selection/selection-layout.js +82 -0
- package/dist/src/components/roster/selection/selection-layout.js.map +1 -0
- package/dist/src/components/roster/selection/selection-layout.types.d.ts +25 -0
- package/dist/src/components/roster/selection/selection-layout.types.d.ts.map +1 -0
- package/dist/src/components/roster/selection/selection-layout.types.js +3 -0
- package/dist/src/components/roster/selection/selection-layout.types.js.map +1 -0
- package/dist/src/components/roster/selection/selection-layout.web.d.ts +4 -0
- package/dist/src/components/roster/selection/selection-layout.web.d.ts.map +1 -0
- package/dist/src/components/roster/selection/selection-layout.web.js +52 -0
- package/dist/src/components/roster/selection/selection-layout.web.js.map +1 -0
- package/dist/src/components/roster/use-roster-press.d.ts +6 -0
- package/dist/src/components/roster/use-roster-press.d.ts.map +1 -0
- package/dist/src/components/roster/use-roster-press.js +61 -0
- package/dist/src/components/roster/use-roster-press.js.map +1 -0
- package/dist/src/components/roster/use-roster.d.ts.map +1 -1
- package/dist/src/components/roster/use-roster.js +40 -30
- package/dist/src/components/roster/use-roster.js.map +1 -1
- package/dist/src/components/schedule/days/parts/column.d.ts.map +1 -1
- package/dist/src/components/schedule/days/parts/column.js +2 -1
- package/dist/src/components/schedule/days/parts/column.js.map +1 -1
- package/dist/src/core/index.d.ts +2 -0
- package/dist/src/core/index.d.ts.map +1 -1
- package/dist/src/core/index.js +7 -1
- package/dist/src/core/index.js.map +1 -1
- package/dist/src/core/source.d.ts +4 -0
- package/dist/src/core/source.d.ts.map +1 -0
- package/dist/src/core/source.js +9 -0
- package/dist/src/core/source.js.map +1 -0
- package/dist/src/core/spans.d.ts +19 -0
- package/dist/src/core/spans.d.ts.map +1 -1
- package/dist/src/core/spans.js +64 -0
- package/dist/src/core/spans.js.map +1 -1
- package/dist/src/index.d.ts +4 -1
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +6 -1
- package/dist/src/index.js.map +1 -1
- package/dist/src/nativewind/index.d.ts +4 -1
- package/dist/src/nativewind/index.d.ts.map +1 -1
- package/llms.txt +85 -3
- package/package.json +10 -4
- package/src/components/primitives/README.md +13 -2
- package/src/components/primitives/portal.tsx +48 -0
- package/src/components/roster/README.md +48 -2
- package/src/components/roster/body-layout.tsx +7 -1
- package/src/components/roster/index.tsx +62 -17
- package/src/components/roster/lanes/lane.tsx +2 -4
- package/src/components/roster/parts/lane-list.tsx +3 -1
- package/src/components/roster/roster.types.ts +30 -1
- package/src/components/roster/selection/selection-layout.tsx +90 -0
- package/src/components/roster/selection/selection-layout.types.ts +20 -0
- package/src/components/roster/selection/selection-layout.web.tsx +88 -0
- package/src/components/roster/use-roster-press.ts +74 -0
- package/src/components/roster/use-roster.ts +57 -44
- package/src/components/schedule/days/parts/column.tsx +2 -4
- package/src/core/README.md +18 -1
- package/src/core/index.ts +2 -0
- package/src/core/source.ts +9 -0
- package/src/core/spans.ts +66 -2
- package/src/index.ts +4 -0
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.RosterSelectionPopover = RosterSelectionPopover;
|
|
37
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
38
|
+
const react_1 = require("react");
|
|
39
|
+
const react_native_1 = require("react-native");
|
|
40
|
+
const react_native_reanimated_1 = __importStar(require("react-native-reanimated"));
|
|
41
|
+
const portal_1 = require("../../primitives/portal");
|
|
42
|
+
const overlay = { position: 'absolute', top: 0, left: 0, right: 0, bottom: 0 };
|
|
43
|
+
/** Native selection presentation with a local portal destination and shared scroll translation. */
|
|
44
|
+
function RosterSelectionPopover({ anchorZone, contentZone, targetBounds, open, onDismiss, portalHost, scroll, }) {
|
|
45
|
+
const name = (0, react_1.useId)();
|
|
46
|
+
const [viewport, setViewport] = (0, react_1.useState)({ width: 0, height: 0 });
|
|
47
|
+
const [content, setContent] = (0, react_1.useState)({ width: 0, height: 0 });
|
|
48
|
+
const maxWidth = Math.max(0, viewport.width - 8);
|
|
49
|
+
const maxHeight = Math.max(0, viewport.height - 8);
|
|
50
|
+
const size = { maxWidth, maxHeight, flexShrink: 1 };
|
|
51
|
+
const { x, y } = scroll;
|
|
52
|
+
const position = (0, react_native_reanimated_1.useAnimatedStyle)(() => {
|
|
53
|
+
const below = targetBounds ? targetBounds.y + targetBounds.height + 4 - y.get() : 0;
|
|
54
|
+
const above = targetBounds ? targetBounds.y - content.height - 4 - y.get() : 0;
|
|
55
|
+
const maxTop = Math.max(0, viewport.height - content.height);
|
|
56
|
+
return {
|
|
57
|
+
left: Math.max(0, Math.min((targetBounds?.x ?? 0) - x.get(), viewport.width - content.width)),
|
|
58
|
+
top: below >= 0 && below <= maxTop ? below : above >= 0 && above <= maxTop ? above : 0,
|
|
59
|
+
};
|
|
60
|
+
});
|
|
61
|
+
(0, react_1.useEffect)(() => {
|
|
62
|
+
if (!open)
|
|
63
|
+
return;
|
|
64
|
+
const subscription = react_native_1.BackHandler.addEventListener('hardwareBackPress', () => {
|
|
65
|
+
onDismiss();
|
|
66
|
+
return true;
|
|
67
|
+
});
|
|
68
|
+
return () => subscription.remove();
|
|
69
|
+
}, [open, onDismiss]);
|
|
70
|
+
let detailZone = null;
|
|
71
|
+
if (open && targetBounds && maxWidth > 0 && maxHeight > 0) {
|
|
72
|
+
detailZone = ((0, jsx_runtime_1.jsx)(portal_1.Portal, { hostName: portalHost, name: name, children: (0, jsx_runtime_1.jsx)(react_native_reanimated_1.default.View, { style: [{ position: 'absolute', maxWidth, maxHeight }, position], children: (0, jsx_runtime_1.jsx)(react_native_1.View, { accessibilityRole: "summary", onStartShouldSetResponder: () => true, style: size, onLayout: ({ nativeEvent }) => setContent({
|
|
73
|
+
width: nativeEvent.layout.width,
|
|
74
|
+
height: nativeEvent.layout.height,
|
|
75
|
+
}), children: (0, jsx_runtime_1.jsx)(react_native_1.ScrollView, { style: size, nestedScrollEnabled: true, children: (0, jsx_runtime_1.jsx)(react_native_1.ScrollView, { horizontal: true, style: { maxWidth, flexGrow: 0, flexShrink: 0 }, nestedScrollEnabled: true, children: contentZone }) }) }) }) }));
|
|
76
|
+
}
|
|
77
|
+
return ((0, jsx_runtime_1.jsxs)(react_native_1.View, { style: { flex: 1, minHeight: 0 }, onLayout: ({ nativeEvent }) => setViewport({
|
|
78
|
+
width: nativeEvent.layout.width,
|
|
79
|
+
height: nativeEvent.layout.height,
|
|
80
|
+
}), children: [anchorZone, (0, jsx_runtime_1.jsx)(react_native_1.View, { pointerEvents: "box-none", style: overlay, children: (0, jsx_runtime_1.jsx)(portal_1.PortalHost, { name: portalHost }) }), detailZone] }));
|
|
81
|
+
}
|
|
82
|
+
//# sourceMappingURL=selection-layout.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"selection-layout.js","sourceRoot":"","sources":["../../../../../src/components/roster/selection/selection-layout.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;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@@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
import type { RosterScroll } from '../roster.types';
|
|
3
|
+
/** Presentation-only contract shared by native, web, and consumer strategies. */
|
|
4
|
+
export type SelectionLayoutProps = {
|
|
5
|
+
/** Mounted body node, rendered once beneath or beside the details. */
|
|
6
|
+
anchorZone: ReactNode;
|
|
7
|
+
/** Mounted detail node, or null when closed. */
|
|
8
|
+
contentZone: ReactNode;
|
|
9
|
+
/** Interval bounds in body-content coordinates, before scroll translation. */
|
|
10
|
+
targetBounds: {
|
|
11
|
+
x: number;
|
|
12
|
+
y: number;
|
|
13
|
+
width: number;
|
|
14
|
+
height: number;
|
|
15
|
+
} | null;
|
|
16
|
+
/** Whether the detail presentation is open. */
|
|
17
|
+
open: boolean;
|
|
18
|
+
/** Report outside press, hardware back, Escape, or a presentation close action. */
|
|
19
|
+
onDismiss: () => void;
|
|
20
|
+
/** Unique native destination name owned by this selection layout. */
|
|
21
|
+
portalHost: string;
|
|
22
|
+
/** Shared offsets follow body scrolling without updating React state. */
|
|
23
|
+
scroll: Pick<RosterScroll, 'x' | 'y' | 'headerStyle' | 'labelStyle'>;
|
|
24
|
+
};
|
|
25
|
+
//# sourceMappingURL=selection-layout.types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"selection-layout.types.d.ts","sourceRoot":"","sources":["../../../../../src/components/roster/selection/selection-layout.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAEpD,iFAAiF;AACjF,MAAM,MAAM,oBAAoB,GAAG;IACjC,sEAAsE;IACtE,UAAU,EAAE,SAAS,CAAC;IACtB,gDAAgD;IAChD,WAAW,EAAE,SAAS,CAAC;IACvB,8EAA8E;IAC9E,YAAY,EAAE;QAAE,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAC;IAC7E,+CAA+C;IAC/C,IAAI,EAAE,OAAO,CAAC;IACd,mFAAmF;IACnF,SAAS,EAAE,MAAM,IAAI,CAAC;IACtB,qEAAqE;IACrE,UAAU,EAAE,MAAM,CAAC;IACnB,yEAAyE;IACzE,MAAM,EAAE,IAAI,CAAC,YAAY,EAAE,GAAG,GAAG,GAAG,GAAG,aAAa,GAAG,YAAY,CAAC,CAAC;CACtE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"selection-layout.types.js","sourceRoot":"","sources":["../../../../../src/components/roster/selection/selection-layout.types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { SelectionLayoutProps } from './selection-layout.types';
|
|
2
|
+
/** Web selection presentation; Radix owns outside press, Escape, and collisions. */
|
|
3
|
+
export declare function RosterSelectionPopover({ anchorZone, contentZone, targetBounds, open, onDismiss, scroll, }: SelectionLayoutProps): import("react/jsx-runtime").JSX.Element;
|
|
4
|
+
//# sourceMappingURL=selection-layout.web.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"selection-layout.web.d.ts","sourceRoot":"","sources":["../../../../../src/components/roster/selection/selection-layout.web.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAErE,oFAAoF;AACpF,wBAAgB,sBAAsB,CAAC,EACrC,UAAU,EACV,WAAW,EACX,YAAY,EACZ,IAAI,EACJ,SAAS,EACT,MAAM,GACP,EAAE,oBAAoB,2CA0EtB"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.RosterSelectionPopover = RosterSelectionPopover;
|
|
7
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
8
|
+
const react_popover_1 = require("@radix-ui/react-popover");
|
|
9
|
+
const react_1 = require("react");
|
|
10
|
+
const react_native_reanimated_1 = __importDefault(require("react-native-reanimated"));
|
|
11
|
+
/** Web selection presentation; Radix owns outside press, Escape, and collisions. */
|
|
12
|
+
function RosterSelectionPopover({ anchorZone, contentZone, targetBounds, open, onDismiss, scroll, }) {
|
|
13
|
+
const bodyRef = (0, react_1.useRef)(null);
|
|
14
|
+
const returnFocusRef = (0, react_1.useRef)(null);
|
|
15
|
+
const keyboardDismissRef = (0, react_1.useRef)(false);
|
|
16
|
+
(0, react_1.useEffect)(() => {
|
|
17
|
+
if (open && targetBounds && bodyRef.current?.contains(document.activeElement)) {
|
|
18
|
+
returnFocusRef.current = document.activeElement;
|
|
19
|
+
}
|
|
20
|
+
}, [open, targetBounds]);
|
|
21
|
+
return ((0, jsx_runtime_1.jsxs)(react_popover_1.Root, { open: open, onOpenChange: (next) => {
|
|
22
|
+
if (!next)
|
|
23
|
+
onDismiss();
|
|
24
|
+
}, children: [(0, jsx_runtime_1.jsxs)("div", { ref: bodyRef, style: {
|
|
25
|
+
position: 'relative',
|
|
26
|
+
display: 'flex',
|
|
27
|
+
flexDirection: 'column',
|
|
28
|
+
flex: 1,
|
|
29
|
+
minHeight: 0,
|
|
30
|
+
}, children: [anchorZone, (0, jsx_runtime_1.jsx)(react_native_reanimated_1.default.View, { style: [{ position: 'absolute', top: 0, left: 0 }, scroll.headerStyle], children: (0, jsx_runtime_1.jsx)(react_native_reanimated_1.default.View, { style: scroll.labelStyle, children: (0, jsx_runtime_1.jsx)(react_popover_1.Anchor, { asChild: true, children: (0, jsx_runtime_1.jsx)("div", { "data-testid": "roster-selection-target", style: {
|
|
31
|
+
position: 'absolute',
|
|
32
|
+
left: targetBounds?.x ?? 0,
|
|
33
|
+
top: targetBounds ? targetBounds.y + targetBounds.height : 0,
|
|
34
|
+
width: 0,
|
|
35
|
+
height: 0,
|
|
36
|
+
pointerEvents: 'none',
|
|
37
|
+
} }) }) }) })] }), (0, jsx_runtime_1.jsx)(react_popover_1.Portal, { children: (0, jsx_runtime_1.jsx)(react_popover_1.Content, { onOpenAutoFocus: () => {
|
|
38
|
+
returnFocusRef.current = document.activeElement;
|
|
39
|
+
keyboardDismissRef.current = false;
|
|
40
|
+
}, onEscapeKeyDown: () => {
|
|
41
|
+
keyboardDismissRef.current = true;
|
|
42
|
+
}, onCloseAutoFocus: (event) => {
|
|
43
|
+
event.preventDefault();
|
|
44
|
+
if (keyboardDismissRef.current && returnFocusRef.current instanceof HTMLElement) {
|
|
45
|
+
returnFocusRef.current.focus({ preventScroll: true });
|
|
46
|
+
}
|
|
47
|
+
}, onInteractOutside: (event) => {
|
|
48
|
+
if (bodyRef.current?.contains(event.target))
|
|
49
|
+
event.preventDefault();
|
|
50
|
+
}, sideOffset: 4, align: "start", updatePositionStrategy: "always", "aria-label": "Interval details", style: { zIndex: 1000 }, children: contentZone }) })] }));
|
|
51
|
+
}
|
|
52
|
+
//# sourceMappingURL=selection-layout.web.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"selection-layout.web.js","sourceRoot":"","sources":["../../../../../src/components/roster/selection/selection-layout.web.tsx"],"names":[],"mappings":";;;;;;;AAAA,2DAAwE;AACxE,iCAA0C;AAC1C,sFAA+C;AAG/C,oFAAoF;AACpF,gCAAuC,EACrC,UAAU,EACV,WAAW,EACX,YAAY,EACZ,IAAI,EACJ,SAAS,EACT,MAAM,GACe;IACrB,MAAM,OAAO,GAAG,IAAA,cAAM,EAAiB,IAAI,CAAC,CAAC;IAC7C,MAAM,cAAc,GAAG,IAAA,cAAM,EAAiB,IAAI,CAAC,CAAC;IACpD,MAAM,kBAAkB,GAAG,IAAA,cAAM,EAAC,KAAK,CAAC,CAAC;IACzC,IA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ACL,uBAAC,uBAAO,IACN,eAAe,EAAE,GAAG,EAAE;wBACpB,cAAc,CAAC,OAAO,GAAG,QAAQ,CAAC,aAAa,CAAC;wBAChD,kBAAkB,CAAC,OAAO,GAAG,KAAK,CAAC;oBACrC,CAAC,EACD,eAAe,EAAE,GAAG,EAAE;wBACpB,kBAAkB,CAAC,OAAO,GAAG,IAAI,CAAC;oBACpC,CAAC,EACD,gBAAgB,EAAE,CAAC,KAAK,EAAE,EAAE;wBAC1B,KAAK,CAAC,cAAc,EAAE,CAAC;wBACvB,IAAI,kBAAkB,CAAC,OAAO,IAAI,cAAc,CAAC,OAAO,YAAY,WAAW,EAAE,CAAC;4BAChF,cAAc,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,aAAa,EAAE,IAAI,EAAE,CAAC,CAAC;wBACxD,CAAC;oBACH,CAAC,EACD,iBAAiB,EAAE,CAAC,KAAK,EAAE,EAAE;wBAC3B,IAAI,OAAO,CAAC,OAAO,EAAE,QAAQ,CAAC,KAAK,CAAC,MAAc,CAAC;4BAAE,KAAK,CAAC,cAAc,EAAE,CAAC;oBAC9E,CAAC,EACD,UAAU,EAAE,CAAC,EACb,KAAK,EAAC,OAAO,EACb,sBAAsB,EAAC,QAAQ,gBACpB,kBAAkB,EAC7B,KAAK,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,YAEtB,WAAW,GACJ,GACH,IACJ,CACR,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { Dispatch, SetStateAction } from 'react';
|
|
2
|
+
import type { Lane, Window } from '../../core';
|
|
3
|
+
import type { RosterInput, RosterModel, RosterProjection } from './roster.types';
|
|
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;
|
|
6
|
+
//# sourceMappingURL=use-roster-press.d.ts.map
|
|
@@ -0,0 +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;AAG/C,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,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,CAmD1E"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useRosterPress = useRosterPress;
|
|
4
|
+
const react_1 = require("react");
|
|
5
|
+
const core_1 = require("../../core");
|
|
6
|
+
const hit_test_1 = require("../../core/hit-test");
|
|
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 };
|
|
10
|
+
const pressInput = (0, react_1.useRef)(currentPress);
|
|
11
|
+
pressInput.current = currentPress;
|
|
12
|
+
const [press] = (0, react_1.useState)(() => {
|
|
13
|
+
return function press(lane, pointX, pointY) {
|
|
14
|
+
const { input, window, projection, width, selection } = pressInput.current;
|
|
15
|
+
const { minuteStep = 60, onIntervalPress, onGapPress, onCellPress } = input;
|
|
16
|
+
const { rowHeight, viewTimezone } = projection;
|
|
17
|
+
if (!Number.isFinite(pointX) ||
|
|
18
|
+
!Number.isFinite(pointY) ||
|
|
19
|
+
pointX < 0 ||
|
|
20
|
+
pointX >= width ||
|
|
21
|
+
pointY < 0 ||
|
|
22
|
+
pointY >= rowHeight)
|
|
23
|
+
return;
|
|
24
|
+
const hit = (0, hit_test_1.hitTest)(lane, (0, core_1.layoutLane)(lane, window, projection), pointX, pointY);
|
|
25
|
+
if (hit?.kind === 'interval') {
|
|
26
|
+
if (input.selectable) {
|
|
27
|
+
const layer = lane.layers.find((layer) => layer.id === hit.rect.layerId);
|
|
28
|
+
// layoutLane supplied the hit rect's layerId, so this should succeed; guard future refactors.
|
|
29
|
+
if (layer === undefined)
|
|
30
|
+
return;
|
|
31
|
+
// Compare reconciled geometry so resizing and cache eviction preserve toggle identity.
|
|
32
|
+
setSelected(selection?.lane.id === lane.id &&
|
|
33
|
+
selection.rect.layerId === hit.rect.layerId &&
|
|
34
|
+
selection.rect.x === hit.rect.x &&
|
|
35
|
+
selection.rect.width === hit.rect.width
|
|
36
|
+
? null
|
|
37
|
+
: {
|
|
38
|
+
rect: hit.rect,
|
|
39
|
+
layer,
|
|
40
|
+
lane,
|
|
41
|
+
start: (0, core_1.timeAtX)(projection, window, hit.rect.x),
|
|
42
|
+
end: (0, core_1.timeAtX)(projection, window, hit.rect.x + hit.rect.width),
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
onIntervalPress?.(hit.rect, lane);
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
if (selection)
|
|
49
|
+
setSelected(null);
|
|
50
|
+
if (hit?.kind === 'gap') {
|
|
51
|
+
onGapPress?.(hit.rect, lane);
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
const time = Math.max(window.start, (0, core_1.snapToStep)((0, core_1.timeAtX)(projection, window, pointX), minuteStep, viewTimezone));
|
|
55
|
+
if (time < window.end)
|
|
56
|
+
onCellPress?.(lane, time);
|
|
57
|
+
};
|
|
58
|
+
});
|
|
59
|
+
return press;
|
|
60
|
+
}
|
|
61
|
+
//# sourceMappingURL=use-roster-press.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-roster-press.js","sourceRoot":"","sources":["../../../../src/components/roster/use-roster-press.ts"],"names":[],"mappings":";;;AACA,iCAAyC;AAEzC,qCAA6D;AAC7D,kDAA8C;AAK9C,4FAA4F;AAC5F,wBACE,KAAkB,EAClB,MAAc,EACd,UAA4B,EAC5B,KAAa,EACb,SAAmC,EACnC,WAA8D;IAE9D,MAAM,YAAY,GAAG,EAAE,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC;IACrE,MAAM,UAAU,GAAG,IAAA,cAAM,EAAC,YAAY,CAAC,CAAC;IACxC,UAAU,CAAC,OAAO,GAAG,YAAY,CAAC;IAClC,MAAM,CAAC,KAAK,CAAC,GAAG,IAAA,gBAAQ,EAAC,GAAG,EAAE;QAC5B,OAAO,SAAS,KAAK,CAAC,IAAU,EAAE,MAAc,EAAE,MAAc;YAC9D,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,KAAK,EAAE,SAAS,EAAE,GAAG,UAAU,CAAC,OAAO,CAAC;YAC3E,MAAM,EAAE,UAAU,GAAG,EAAE,EAAE,eAAe,EAAE,UAAU,EAAE,WAAW,EAAE,GAAG,KAAK,CAAC;YAC5E,MAAM,EAAE,SAAS,EAAE,YAAY,EAAE,GAAG,UAAU,CAAC;YAC/C,IACE,CAAC,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC;gBACxB,CAAC,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC;gBACxB,MAAM,GAAG,CAAC;gBACV,MAAM,IAAI,KAAK;gBACf,MAAM,GAAG,CAAC;gB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,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":"
|
|
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,CAkGzD"}
|
|
@@ -4,10 +4,14 @@ exports.useRoster = useRoster;
|
|
|
4
4
|
const react_1 = require("react");
|
|
5
5
|
const react_native_reanimated_1 = require("react-native-reanimated");
|
|
6
6
|
const core_1 = require("../../core");
|
|
7
|
-
const
|
|
7
|
+
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, minuteStep = 60, sortLanes = core_1.byLabel, rowHeight = 48, pxPerMinute = 0.5, onNavigate, } = input;
|
|
11
|
+
const [selected, setSelected] = (0, react_1.useState)(null);
|
|
12
|
+
function dismissSelection() {
|
|
13
|
+
setSelected(null);
|
|
14
|
+
}
|
|
11
15
|
const [viewport, setViewport] = (0, react_1.useState)({ width: 0, height: 0 });
|
|
12
16
|
// The pinned compiler lint cannot resolve useSharedValue's built-in type.
|
|
13
17
|
// These shared values only track offsets, so no animation needs cancellation.
|
|
@@ -39,36 +43,14 @@ function useRoster(input) {
|
|
|
39
43
|
function geometryFor(lane) {
|
|
40
44
|
return (0, core_1.layoutLane)(lane, window, projection);
|
|
41
45
|
}
|
|
42
|
-
const
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
const { input, window, projection, width } = pressInput.current;
|
|
48
|
-
const { minuteStep = 60, onIntervalPress, onGapPress, onCellPress } = input;
|
|
49
|
-
const { rowHeight, viewTimezone } = projection;
|
|
50
|
-
if (!Number.isFinite(pointX) ||
|
|
51
|
-
!Number.isFinite(pointY) ||
|
|
52
|
-
pointX < 0 ||
|
|
53
|
-
pointX >= width ||
|
|
54
|
-
pointY < 0 ||
|
|
55
|
-
pointY >= rowHeight)
|
|
56
|
-
return;
|
|
57
|
-
const hit = (0, hit_test_1.hitTest)(lane, (0, core_1.layoutLane)(lane, window, projection), pointX, pointY);
|
|
58
|
-
if (hit?.kind === 'interval') {
|
|
59
|
-
onIntervalPress?.(hit.rect, lane);
|
|
60
|
-
return;
|
|
61
|
-
}
|
|
62
|
-
if (hit?.kind === 'gap') {
|
|
63
|
-
onGapPress?.(hit.rect, lane);
|
|
64
|
-
return;
|
|
65
|
-
}
|
|
66
|
-
const time = Math.max(window.start, (0, core_1.snapToStep)((0, core_1.timeAtX)(projection, window, pointX), minuteStep, viewTimezone));
|
|
67
|
-
if (time < window.end)
|
|
68
|
-
onCellPress?.(lane, time);
|
|
69
|
-
};
|
|
70
|
-
});
|
|
46
|
+
const selection = reconcileSelection(selected, lanes, window, projection, input.selectable ?? false);
|
|
47
|
+
// Discard invalid selection during reconciliation, before rendering any stale detail.
|
|
48
|
+
if (selected && !selection)
|
|
49
|
+
setSelected(null);
|
|
50
|
+
const press = (0, use_roster_press_1.useRosterPress)(input, window, projection, contentWidth, selection, setSelected);
|
|
71
51
|
return {
|
|
52
|
+
selection,
|
|
53
|
+
dismissSelection,
|
|
72
54
|
window,
|
|
73
55
|
projection,
|
|
74
56
|
orderedLanes,
|
|
@@ -103,4 +85,32 @@ function useRoster(input) {
|
|
|
103
85
|
},
|
|
104
86
|
};
|
|
105
87
|
}
|
|
88
|
+
// Match provenance and nearest bounds while preserving the stored display values.
|
|
89
|
+
function reconcileSelection(selected, lanes, window, projection, enabled) {
|
|
90
|
+
if (selected && enabled) {
|
|
91
|
+
const lane = lanes.find((lane) => lane.id === selected.lane.id);
|
|
92
|
+
const layer = lane?.layers.find((layer) => layer.id === selected.layer.id);
|
|
93
|
+
if (lane && layer) {
|
|
94
|
+
const sources = new Set(selected.rect.sources.map((source) => JSON.stringify([source.kind, source.id])));
|
|
95
|
+
let rect;
|
|
96
|
+
let nearest = 1;
|
|
97
|
+
for (const candidate of (0, core_1.layoutLane)(lane, window, projection).rects) {
|
|
98
|
+
if (candidate.layerId !== layer.id)
|
|
99
|
+
continue;
|
|
100
|
+
const identities = new Set(candidate.sources.map((source) => JSON.stringify([source.kind, source.id])));
|
|
101
|
+
if (identities.size !== sources.size || ![...identities].every((id) => sources.has(id)))
|
|
102
|
+
continue;
|
|
103
|
+
const difference = Math.abs((0, core_1.timeAtX)(projection, window, candidate.x) - selected.start) +
|
|
104
|
+
Math.abs((0, core_1.timeAtX)(projection, window, candidate.x + candidate.width) - selected.end);
|
|
105
|
+
if (difference <= nearest && (!rect || difference < nearest)) {
|
|
106
|
+
nearest = difference;
|
|
107
|
+
rect = candidate;
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
if (rect)
|
|
111
|
+
return { rect, layer, lane, start: selected.start, end: selected.end };
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
return null;
|
|
115
|
+
}
|
|
106
116
|
//# sourceMappingURL=use-roster.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-roster.js","sourceRoot":"","sources":["../../../../src/components/roster/use-roster.ts"],"names":[],"mappings":";;;AAAA,iCAAyC;AAEzC,qEAAwE;AAExE,
|
|
1
|
+
{"version":3,"file":"use-roster.js","sourceRoot":"","sources":["../../../../src/components/roster/use-roster.ts"],"names":[],"mappings":";;;AAAA,iCAAyC;AAEzC,qEAAwE;AAExE,qCAA2F;AAE3F,yDAA2E;AAC3E,yCAAyC;AAEzC,mBAA0B,KAAkB;IAC1C,MAAM,EACJ,KAAK,EACL,UAAU,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,IAAA,gBAAQ,EAA0B,IAAI,CAAC,CAAC;IACxE,SAAS,gBAAgB;QACvB,WAAW,CAAC,IAAI,CAAC,CAAC;IACpB,CAAC;IACD,MAAM,CAAC,QAAQ,EAAE,WAAW,CAAC,GAAG,IAAA,gBAAQ,EAAC,EAAE,KAAK,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,CAAC,CAAC;IAClE,0EAA0E;IAC1E,8EAA8E;IAC9E,MAAM,CAAC,CAAC,CAAC,GAAG,IAAA,gBAAQ,EAAC,GAAG,EAAE,CAAC,IAAA,qCAAW,EAAC,CAAC,CAAC,CAAC,CAAC;IAC3C,MAAM,CAAC,CAAC,CAAC,GAAG,IAAA,gBAAQ,EAAC,GAAG,EAAE,CAAC,IAAA,qCAAW,EAAC,CAAC,CAAC,CAAC,CAAC;IAC3C,MAAM,OAAO,GAAG,IAAA,cAAM,EAAa,IAAI,CAAC,C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ACX,MAAM,UAAU,GACd,IAAI,CAAC,GAAG,CAAC,IAAA,cAAO,EAAC,UAAU,EAAE,MAAM,EAAE,SAAS,CAAC,CAAC,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"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"column.d.ts","sourceRoot":"","sources":["../../../../../../src/components/schedule/days/parts/column.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"column.d.ts","sourceRoot":"","sources":["../../../../../../src/components/schedule/days/parts/column.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAEhE,wBAAgB,cAAc,CAAC,EAC7B,IAAI,EACJ,KAAK,EACL,QAAQ,EACR,KAAK,EACL,iBAAiB,EAAE,iBAAiB,EACpC,YAAY,EAAE,YAAY,EAC1B,eAAe,GAChB,EAAE,mBAAmB,6CA0CrB"}
|
|
@@ -4,13 +4,14 @@ exports.ScheduleColumn = ScheduleColumn;
|
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
5
|
const react_1 = require("react");
|
|
6
6
|
const react_native_1 = require("react-native");
|
|
7
|
+
const core_1 = require("../../../../core");
|
|
7
8
|
const press_point_1 = require("../../../primitives/press-point");
|
|
8
9
|
function ScheduleColumn({ lane, rects, gapRects, press, intervalComponent: IntervalComponent, gapComponent: GapComponent, highlightSource, }) {
|
|
9
10
|
return [...lane.layers]
|
|
10
11
|
.sort((a, b) => a.z - b.z)
|
|
11
12
|
.map((layer) => ((0, jsx_runtime_1.jsxs)(react_1.Fragment, { children: [rects
|
|
12
13
|
.filter((rect) => rect.layerId === layer.id)
|
|
13
|
-
.map((rect) => ((0, jsx_runtime_1.jsx)(react_1.Fragment, { children: (0, jsx_runtime_1.jsx)(IntervalComponent, { rect: rect, layer: layer, lane: lane, highlighted:
|
|
14
|
+
.map((rect) => ((0, jsx_runtime_1.jsx)(react_1.Fragment, { children: (0, jsx_runtime_1.jsx)(IntervalComponent, { rect: rect, layer: layer, lane: lane, highlighted: (0, core_1.hasSource)(rect.sources, highlightSource) }) }, `interval-${rect.y}:${rect.height}`))), gapRects
|
|
14
15
|
.filter((rect) => rect.layerId === layer.id)
|
|
15
16
|
.map((rect) => ((0, jsx_runtime_1.jsx)(react_native_1.Pressable, { accessibilityLabel: `${lane.label}: removed time`, onPress: (input) => {
|
|
16
17
|
input.stopPropagation();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"column.js","sourceRoot":"","sources":["../../../../../../src/components/schedule/days/parts/column.tsx"],"names":[],"mappings":";;;;AAAA,iCAAiC;AACjC,+CAAyC;AACzC,iEAA6D;AAG7D,wBAA+B,EAC7B,IAAI,EACJ,KAAK,EACL,QAAQ,EACR,KAAK,EACL,iBAAiB,EAAE,iBAAiB,EACpC,YAAY,EAAE,YAAY,EAC1B,eAAe,GACK;IACpB,OAAO,CAAC,GAAG,IAAI,CAAC,MAAM,CAAC;SACpB,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;SACzB,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CACd,wBAAC,gBAAQ,eACN,KAAK;iBACH,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,OAAO,KAAK,KAAK,CAAC,EAAE,CAAC;iBAC3C,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CACb,uBAAC,gBAAQ,cACP,uBAAC,iBAAiB,IAChB,IAAI,EAAE,IAAI,EACV,KAAK,EAAE,KAAK,EACZ,IAAI,EAAE,IAAI,EACV,WAAW,EAAE,
|
|
1
|
+
{"version":3,"file":"column.js","sourceRoot":"","sources":["../../../../../../src/components/schedule/days/parts/column.tsx"],"names":[],"mappings":";;;;AAAA,iCAAiC;AACjC,+CAAyC;AACzC,2CAA6C;AAC7C,iEAA6D;AAG7D,wBAA+B,EAC7B,IAAI,EACJ,KAAK,EACL,QAAQ,EACR,KAAK,EACL,iBAAiB,EAAE,iBAAiB,EACpC,YAAY,EAAE,YAAY,EAC1B,eAAe,GACK;IACpB,OAAO,CAAC,GAAG,IAAI,CAAC,MAAM,CAAC;SACpB,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;SACzB,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CACd,wBAAC,gBAAQ,eACN,KAAK;iBACH,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,OAAO,KAAK,KAAK,CAAC,EAAE,CAAC;iBAC3C,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CACb,uBAAC,gBAAQ,cACP,uBAAC,iBAAiB,IAChB,IAAI,EAAE,IAAI,EACV,KAAK,EAAE,KAAK,EACZ,IAAI,EAAE,IAAI,EACV,WAAW,EAAE,IAAA,gBAAS,EAAC,IAAI,CAAC,OAAO,EAAE,eAAe,CAAC,GACrD,IANW,YAAY,IAAI,CAAC,CAAC,IAAI,IAAI,CAAC,MAAM,EAAE,CAOvC,CACZ,CAAC,EACH,QAAQ;iBACN,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,OAAO,KAAK,KAAK,CAAC,EAAE,CAAC;iBAC3C,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CACb,uBAAC,wBAAS,IAER,kBAAkB,EAAE,GAAG,IAAI,CAAC,KAAK,gBAAgB,EACjD,OAAO,EAAE,CAAC,KAAK,EAAE,EAAE;oBACjB,KAAK,CAAC,eAAe,EAAE,CAAC;oBACxB,MAAM,KAAK,GAAG,IAAA,wBAAU,EAAC,KAAK,CAAC,CAAC;oBAChC,KAAK,CAAC,IAAI,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;gBAC5C,CAAC,EACD,KAAK,EAAE;oBACL,QAAQ,EAAE,UAAU;oBACpB,IAAI,EAAE,IAAI,CAAC,CAAC;oBACZ,GAAG,EAAE,IAAI,CAAC,CAAC;oBACX,KAAK,EAAE,IAAI,CAAC,KAAK;oBACjB,MAAM,EAAE,IAAI,CAAC,MAAM;oBACnB,MAAM,EAAE,IAAI,CAAC,CAAC;iBACf,YAED,uBAAC,YAAY,IAAC,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,GAAI,IAhBjD,OAAO,IAAI,CAAC,CAAC,IAAI,IAAI,CAAC,MAAM,EAAE,CAiBzB,CACb,CAAC,KAnCS,KAAK,CAAC,EAAE,CAoCZ,CACZ,CAAC,CAAC;AACP,CAAC"}
|
package/dist/src/core/index.d.ts
CHANGED
|
@@ -8,5 +8,7 @@ export { layoutLane } from './layout';
|
|
|
8
8
|
export type { LaneComparator } from './order';
|
|
9
9
|
export { byCoverage, byLabel } from './order';
|
|
10
10
|
export { snapToStep, timeAtX, timeAtY } from './snap';
|
|
11
|
+
export { hasSource } from './source';
|
|
12
|
+
export { extentOf, intersectionOf, unionOf } from './spans';
|
|
11
13
|
export type { Coverage, DayColumn, Gap, Interval, Lane, LaneFlag, LaneGeometry, Layer, LayerRole, LayerStyle, Projection, Rect, Source, Transition, Weekday, Window, } from './types';
|
|
12
14
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/core/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AAC/C,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AACtD,OAAO,EACL,kBAAkB,EAClB,gBAAgB,EAChB,aAAa,EACb,WAAW,EACX,UAAU,GACX,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AACzC,OAAO,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAC;AACjC,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AACtC,YAAY,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAC;AACtD,YAAY,EACV,QAAQ,EACR,SAAS,EACT,GAAG,EACH,QAAQ,EACR,IAAI,EACJ,QAAQ,EACR,YAAY,EACZ,KAAK,EACL,SAAS,EACT,UAAU,EACV,UAAU,EACV,IAAI,EACJ,MAAM,EACN,UAAU,EACV,OAAO,EACP,MAAM,GACP,MAAM,SAAS,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/core/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AAC/C,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AACtD,OAAO,EACL,kBAAkB,EAClB,gBAAgB,EAChB,aAAa,EACb,WAAW,EACX,UAAU,GACX,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AACzC,OAAO,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAC;AACjC,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AACtC,YAAY,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAC;AACtD,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AACrC,OAAO,EAAE,QAAQ,EAAE,cAAc,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAC5D,YAAY,EACV,QAAQ,EACR,SAAS,EACT,GAAG,EACH,QAAQ,EACR,IAAI,EACJ,QAAQ,EACR,YAAY,EACZ,KAAK,EACL,SAAS,EACT,UAAU,EACV,UAAU,EACV,IAAI,EACJ,MAAM,EACN,UAAU,EACV,OAAO,EACP,MAAM,GACP,MAAM,SAAS,CAAC"}
|
package/dist/src/core/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.timeAtY = exports.timeAtX = exports.snapToStep = exports.byLabel = exports.byCoverage = exports.layoutLane = exports.flagFor = exports.coverageFor = exports.dayColumnsFor = exports.resetStats = exports.layoutStats = exports.coverageStats = exports.clearLayoutCache = exports.clearCoverageCache = exports.windowFor = exports.today = exports.prev = exports.next = void 0;
|
|
3
|
+
exports.unionOf = exports.intersectionOf = exports.extentOf = exports.hasSource = exports.timeAtY = exports.timeAtX = exports.snapToStep = exports.byLabel = exports.byCoverage = exports.layoutLane = exports.flagFor = exports.coverageFor = exports.dayColumnsFor = exports.resetStats = exports.layoutStats = exports.coverageStats = exports.clearLayoutCache = exports.clearCoverageCache = exports.windowFor = exports.today = exports.prev = exports.next = void 0;
|
|
4
4
|
var axis_1 = require("./axis");
|
|
5
5
|
Object.defineProperty(exports, "next", { enumerable: true, get: function () { return axis_1.next; } });
|
|
6
6
|
Object.defineProperty(exports, "prev", { enumerable: true, get: function () { return axis_1.prev; } });
|
|
@@ -27,4 +27,10 @@ var snap_1 = require("./snap");
|
|
|
27
27
|
Object.defineProperty(exports, "snapToStep", { enumerable: true, get: function () { return snap_1.snapToStep; } });
|
|
28
28
|
Object.defineProperty(exports, "timeAtX", { enumerable: true, get: function () { return snap_1.timeAtX; } });
|
|
29
29
|
Object.defineProperty(exports, "timeAtY", { enumerable: true, get: function () { return snap_1.timeAtY; } });
|
|
30
|
+
var source_1 = require("./source");
|
|
31
|
+
Object.defineProperty(exports, "hasSource", { enumerable: true, get: function () { return source_1.hasSource; } });
|
|
32
|
+
var spans_1 = require("./spans");
|
|
33
|
+
Object.defineProperty(exports, "extentOf", { enumerable: true, get: function () { return spans_1.extentOf; } });
|
|
34
|
+
Object.defineProperty(exports, "intersectionOf", { enumerable: true, get: function () { return spans_1.intersectionOf; } });
|
|
35
|
+
Object.defineProperty(exports, "unionOf", { enumerable: true, get: function () { return spans_1.unionOf; } });
|
|
30
36
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/core/index.ts"],"names":[],"mappings":";;;AACA,+BAAsD;AAA7C,4FAAA,IAAI,OAAA;AAAE,4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A;AAClB,iCAA4D;AAAnD,iGAAA,QAAQ,OAAA;AAAE,uGAAA,cAAc,OAAA;AAAE,gGAAA,OAAO,OAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"source.d.ts","sourceRoot":"","sources":["../../../src/core/source.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAEtC,uEAAuE;AACvE,wBAAgB,SAAS,CAAC,OAAO,EAAE,SAAS,MAAM,EAAE,EAAE,MAAM,EAAE,MAAM,GAAG,SAAS,GAAG,OAAO,CAKzF"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.hasSource = hasSource;
|
|
4
|
+
/** Match source identity by kind and id, ignoring display metadata. */
|
|
5
|
+
function hasSource(sources, source) {
|
|
6
|
+
return (source !== undefined &&
|
|
7
|
+
sources.some((item) => item.kind === source.kind && item.id === source.id));
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=source.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"source.js","sourceRoot":"","sources":["../../../src/core/source.ts"],"names":[],"mappings":";;;AAEA,uEAAuE;AACvE,mBAA0B,OAA0B,EAAE,MAA0B;IAC9E,OAAO,CACL,MAAM,KAAK,SAAS;QACpB,OAAO,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,KAAK,MAAM,CAAC,IAAI,IAAI,IAAI,CAAC,EAAE,KAAK,MAAM,CAAC,EAAE,CAAC,CAC3E,CAAC;AACJ,CAAC"}
|
package/dist/src/core/spans.d.ts
CHANGED
|
@@ -1,3 +1,22 @@
|
|
|
1
1
|
import type { Interval, Window } from './types';
|
|
2
2
|
export declare function sourceSpans(intervals: Interval[], window: Window): Interval[];
|
|
3
|
+
/**
|
|
4
|
+
* Earliest start through latest end in epoch milliseconds, end-exclusive; empty input returns null.
|
|
5
|
+
* Throws RangeError for non-finite bounds or end <= start.
|
|
6
|
+
* Inputs may be unsorted, overlapping, nested, or duplicated; inputs are not mutated.
|
|
7
|
+
*/
|
|
8
|
+
export declare function extentOf(segments: readonly Window[]): Window | null;
|
|
9
|
+
/**
|
|
10
|
+
* Shared epoch milliseconds, end-exclusive; empty input or an empty intersection returns null.
|
|
11
|
+
* Throws RangeError for non-finite bounds or end <= start.
|
|
12
|
+
* Inputs may be unsorted, overlapping, nested, or duplicated; inputs are not mutated.
|
|
13
|
+
*/
|
|
14
|
+
export declare function intersectionOf(spans: readonly Window[]): Window | null;
|
|
15
|
+
/**
|
|
16
|
+
* Merged end-exclusive epoch windows sorted by start; empty input returns an empty array.
|
|
17
|
+
* Overlapping or touching spans merge; disjoint spans remain separate.
|
|
18
|
+
* Throws RangeError for non-finite bounds or end <= start.
|
|
19
|
+
* Returns new objects without mutating inputs.
|
|
20
|
+
*/
|
|
21
|
+
export declare function unionOf(spans: readonly Window[]): Window[];
|
|
3
22
|
//# sourceMappingURL=spans.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"spans.d.ts","sourceRoot":"","sources":["../../../src/core/spans.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"spans.d.ts","sourceRoot":"","sources":["../../../src/core/spans.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,QAAQ,EAAU,MAAM,EAAE,MAAM,SAAS,CAAC;AAIxD,wBAAgB,WAAW,CAAC,SAAS,EAAE,QAAQ,EAAE,EAAE,MAAM,EAAE,MAAM,GAAG,QAAQ,EAAE,CAmD7E;AAED;;;;GAIG;AACH,wBAAgB,QAAQ,CAAC,QAAQ,EAAE,SAAS,MAAM,EAAE,GAAG,MAAM,GAAG,IAAI,CASnE;AAED;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,SAAS,MAAM,EAAE,GAAG,MAAM,GAAG,IAAI,CAUtE;AAED;;;;;GAKG;AACH,wBAAgB,OAAO,CAAC,KAAK,EAAE,SAAS,MAAM,EAAE,GAAG,MAAM,EAAE,CAgB1D"}
|