@opengeoweb/time-slider 19.6.1 → 20.0.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.
@@ -0,0 +1,10 @@
1
+ import React from 'react';
2
+ export interface AnchorTimeFieldProps {
3
+ value: string;
4
+ label: string;
5
+ onChange: (anchorTime: string) => void;
6
+ disabled?: boolean;
7
+ }
8
+ export declare const anchorTimeToPickerDate: (anchorTime: string) => Date | null;
9
+ export declare const pickerDateToAnchorTime: (pickerDate: Date) => string;
10
+ export declare const AnchorTimeField: React.FC<AnchorTimeFieldProps>;
@@ -0,0 +1,15 @@
1
+ import React from 'react';
2
+ import type { AnimationLengthSetting } from './animationLengthUtils';
3
+ export interface AnimationLengthMenuProps {
4
+ setting: AnimationLengthSetting;
5
+ onChange: (setting: AnimationLengthSetting, isStep?: boolean) => void;
6
+ onInputChange?: () => void;
7
+ animationStartTime?: string;
8
+ animationEndTime?: string;
9
+ autoTimeStepLayerName?: string;
10
+ timeStep?: number;
11
+ isAutoDisabled?: boolean;
12
+ disabled?: boolean;
13
+ referenceTimeFromLayer?: string;
14
+ }
15
+ export declare const AnimationLengthMenu: React.FC<AnimationLengthMenuProps>;
@@ -0,0 +1,16 @@
1
+ import React from 'react';
2
+ import type { AnimationLengthSetting } from './animationLengthUtils';
3
+ export interface AnimationLengthPanelProps {
4
+ setting: AnimationLengthSetting;
5
+ onChange: (setting: AnimationLengthSetting, isStep?: boolean) => void;
6
+ onInputChange?: () => void;
7
+ animationStartTime?: string;
8
+ animationEndTime?: string;
9
+ autoTimeStepLayerName?: string;
10
+ timeStep?: number;
11
+ isAutoDisabled?: boolean;
12
+ disabled?: boolean;
13
+ referenceTimeFromLayer?: string;
14
+ }
15
+ export declare const asDisplayTime: (time?: string) => string;
16
+ export declare const AnimationLengthPanel: React.FC<AnimationLengthPanelProps>;
@@ -0,0 +1,114 @@
1
+ export declare enum AnimationLengthMode {
2
+ Auto = "auto",
3
+ Now = "now",
4
+ RecurringPeriod = "recurringPeriod",
5
+ ReferenceTime = "referenceTime",
6
+ Exact = "exact"
7
+ }
8
+ export type TimeUnit = 'years' | 'months' | 'weeks' | 'days' | 'hours' | 'minutes';
9
+ export declare const timeUnits: TimeUnit[];
10
+ export interface RelativeTimeOffset {
11
+ value: number;
12
+ unit: TimeUnit;
13
+ }
14
+ export interface OffsetSelections {
15
+ startOffset: RelativeTimeOffset;
16
+ endOffset: RelativeTimeOffset;
17
+ }
18
+ export interface RecurringPeriodSelections extends OffsetSelections {
19
+ /** Time of day in UTC as HH:mm. */
20
+ anchorTime: string;
21
+ }
22
+ /** Exact names its instants outright rather than counting offsets from an anchor. */
23
+ export interface ExactSelections {
24
+ animationStartTime: string;
25
+ animationEndTime: string;
26
+ }
27
+ /**
28
+ * Each mode keeps its own selections under a key named after it, so switching modes
29
+ * cannot overwrite another mode's setup. The selected mode's own slice is required.
30
+ */
31
+ export type AnimationLengthSetting = {
32
+ mode: AnimationLengthMode.Auto;
33
+ now?: OffsetSelections;
34
+ recurringPeriod?: RecurringPeriodSelections;
35
+ referenceTime?: OffsetSelections;
36
+ exact?: ExactSelections;
37
+ } | {
38
+ mode: AnimationLengthMode.Now;
39
+ now: OffsetSelections;
40
+ recurringPeriod?: RecurringPeriodSelections;
41
+ referenceTime?: OffsetSelections;
42
+ exact?: ExactSelections;
43
+ } | {
44
+ mode: AnimationLengthMode.RecurringPeriod;
45
+ now?: OffsetSelections;
46
+ recurringPeriod: RecurringPeriodSelections;
47
+ referenceTime?: OffsetSelections;
48
+ exact?: ExactSelections;
49
+ } | {
50
+ mode: AnimationLengthMode.ReferenceTime;
51
+ now?: OffsetSelections;
52
+ recurringPeriod?: RecurringPeriodSelections;
53
+ referenceTime: OffsetSelections;
54
+ exact?: ExactSelections;
55
+ } | {
56
+ mode: AnimationLengthMode.Exact;
57
+ now?: OffsetSelections;
58
+ recurringPeriod?: RecurringPeriodSelections;
59
+ referenceTime?: OffsetSelections;
60
+ exact: ExactSelections;
61
+ };
62
+ export interface AnimationRange {
63
+ animationStartTime: string;
64
+ animationEndTime: string;
65
+ }
66
+ export declare const defaultStartOffset: RelativeTimeOffset;
67
+ export declare const defaultEndOffset: RelativeTimeOffset;
68
+ export declare const defaultOffsetSelections: OffsetSelections;
69
+ export declare const unitTranslationKey: Record<TimeUnit, string>;
70
+ export declare const shortUnitTranslationKey: Record<TimeUnit, string>;
71
+ export declare const modeTranslationKey: Record<AnimationLengthMode, string>;
72
+ export declare const ANCHOR_MINUTE_STEP = 5;
73
+ /**
74
+ * Reads the UTC fields directly: `dateUtils.dateToString` formats a local twin of the
75
+ * date, which a DST gap shifts by an hour.
76
+ */
77
+ export declare const toAnchorTime: (date: Date) => string;
78
+ export declare const isAnchoredMode: (mode?: AnimationLengthMode) => boolean;
79
+ /** Narrows the mode so the compiler can require an anchor time alongside it. */
80
+ export declare const isRecurringPeriodMode: (mode: AnimationLengthMode) => mode is AnimationLengthMode.RecurringPeriod;
81
+ export declare const isValidAnchorTime: (anchorTime?: string) => boolean;
82
+ /** The offsets of whichever mode is selected; the modes without offsets use the defaults. */
83
+ export declare const activeOffsets: (setting: AnimationLengthSetting) => OffsetSelections;
84
+ export declare const defaultRecurringPeriodSelections: (now?: Date) => RecurringPeriodSelections;
85
+ /** Presets carry settings the compiler cannot vouch for, so the selected mode is given the slice it needs. */
86
+ export declare const withModeSelections: (setting: AnimationLengthSetting, now?: Date) => AnimationLengthSetting;
87
+ /**
88
+ * A recurring period anchors on its time of day within the current UTC date, so the
89
+ * window it resolves rolls onto the next day once the clock passes midnight.
90
+ */
91
+ export declare const resolveAnchorInstant: (setting: AnimationLengthSetting, now?: Date) => Date;
92
+ /**
93
+ * Offsets are signed: negative lands before the anchor, positive after. They are
94
+ * applied as calendar durations, so "+ 1 month" lands on the same day of the next
95
+ * month rather than a fixed number of days later.
96
+ */
97
+ export declare const resolveAnimationRange: (setting: AnimationLengthSetting, now?: Date) => AnimationRange;
98
+ /** Offsets can use different units, so validity is decided on the resolved instants. */
99
+ /** Exact names its range outright; every other mode resolves one from its offsets. */
100
+ export declare const settingRange: (setting: AnimationLengthSetting, now?: Date) => AnimationRange;
101
+ export declare const isValidAnimationLength: (setting: AnimationLengthSetting, now?: Date) => boolean;
102
+ /** Frames the animation may hold; the range is expanded one entry per time step. */
103
+ export declare const MAX_ANIMATION_STEPS = 10000;
104
+ /**
105
+ * The cost of an animation is its span divided by the time step, so a wide range
106
+ * is affordable with a coarse step and unaffordable with a fine one.
107
+ */
108
+ export declare const isWithinAnimationStepLimit: (setting: AnimationLengthSetting, timeStepInMinutes: number | undefined, now?: Date) => boolean;
109
+ export declare const toExactAnimationTime: (date: Date) => string;
110
+ /** A day either side of now, so an exact window opens on something usable. */
111
+ export declare const defaultExactSelections: (now?: Date) => ExactSelections;
112
+ /** Starts Exact from whatever range is already on screen, falling back to the defaults. */
113
+ export declare const exactAnimationLengthFrom: ({ animationStartTime, animationEndTime }: Partial<AnimationRange>, now?: Date) => AnimationLengthSetting;
114
+ export declare const getAnimationLengthFromRange: (mode: AnimationLengthMode, { animationStartTime, animationEndTime }: AnimationRange, now?: Date) => AnimationLengthSetting;
@@ -0,0 +1,4 @@
1
+ export * from './AnchorTimeField';
2
+ export * from './animationLengthUtils';
3
+ export * from './AnimationLengthMenu';
4
+ export * from './AnimationLengthPanel';
@@ -1,4 +1,5 @@
1
1
  export * from './AnimationLengthButton/AnimationLengthButton';
2
+ export * from './AnimationLengthPanel';
2
3
  export * from './AutoUpdateButton/AutoUpdateButton';
3
4
  export * from './BackwardForwardStepButton/BackwardForwardStepButton';
4
5
  export * from './ControlButtons/ControlButtons';
package/package.json CHANGED
@@ -1,46 +1,46 @@
1
1
  {
2
- "name": "@opengeoweb/time-slider",
3
- "version": "19.6.1",
4
- "description": "GeoWeb time-slider library for the opengeoweb project",
5
- "license": "Apache-2.0",
6
- "repository": {
7
- "type": "git",
8
- "url": "git@gitlab.com:opengeoweb/opengeoweb.git"
9
- },
10
- "main": "./dist/index.esm.js",
11
- "module": "./dist/index.esm.js",
12
- "types": "./dist/index.d.ts",
13
- "exports": {
14
- "./package.json": "./package.json",
15
- ".": {
16
- "@opengeoweb/source": "./src/index.ts",
17
- "types": "./dist/index.d.ts",
18
- "import": "./dist/index.esm.js",
19
- "default": "./dist/index.esm.js"
20
- }
21
- },
22
- "dependencies": {
23
- "@opengeoweb/shared": "*",
24
- "lodash": "^4.18.1",
25
- "@opengeoweb/theme": "*",
26
- "@mui/x-date-pickers": "^9.3.0",
27
- "@mui/system": "^9.0.1",
28
- "i18next": "^25.0.1",
29
- "@mui/material": "^9.0.1",
30
- "react-i18next": "^15.1.1"
31
- },
32
- "peerDependencies": {
33
- "react": "19",
34
- "@emotion/react": "*",
35
- "@emotion/styled": "*"
36
- },
37
- "devDependencies": {
38
- "eslint-plugin-storybook": "10.3.3"
39
- },
40
- "files": [
41
- "dist",
42
- "!dist/package.json",
43
- "README.md",
44
- "package.json"
45
- ]
46
- }
2
+ "name": "@opengeoweb/time-slider",
3
+ "version": "20.0.0",
4
+ "description": "GeoWeb time-slider library for the opengeoweb project",
5
+ "license": "Apache-2.0",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "git@gitlab.com:opengeoweb/opengeoweb.git"
9
+ },
10
+ "main": "./dist/index.esm.js",
11
+ "module": "./dist/index.esm.js",
12
+ "types": "./dist/index.d.ts",
13
+ "exports": {
14
+ "./package.json": "./package.json",
15
+ ".": {
16
+ "@opengeoweb/source": "./src/index.ts",
17
+ "types": "./dist/index.d.ts",
18
+ "import": "./dist/index.esm.js",
19
+ "default": "./dist/index.esm.js"
20
+ }
21
+ },
22
+ "dependencies": {
23
+ "@opengeoweb/shared": "20.0.0",
24
+ "lodash": "^4.18.1",
25
+ "@opengeoweb/theme": "20.0.0",
26
+ "@mui/x-date-pickers": "^9.3.0",
27
+ "@mui/system": "^9.0.1",
28
+ "i18next": "^25.0.1",
29
+ "@mui/material": "^9.0.1",
30
+ "react-i18next": "^15.1.1"
31
+ },
32
+ "peerDependencies": {
33
+ "react": "19",
34
+ "@emotion/react": "*",
35
+ "@emotion/styled": "*"
36
+ },
37
+ "devDependencies": {
38
+ "eslint-plugin-storybook": "10.3.3"
39
+ },
40
+ "files": [
41
+ "dist",
42
+ "!dist/package.json",
43
+ "README.md",
44
+ "package.json"
45
+ ]
46
+ }