@gobrand/calendar-core 0.0.14 → 0.0.16

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/dist/index.cjs CHANGED
@@ -622,7 +622,8 @@ function createCalendar(options) {
622
622
  }));
623
623
  },
624
624
  next(view) {
625
- switch (view) {
625
+ const effectiveView = view ?? store.state.currentView ?? defaultView;
626
+ switch (effectiveView) {
626
627
  case "month":
627
628
  nextMonthImpl();
628
629
  break;
@@ -635,7 +636,8 @@ function createCalendar(options) {
635
636
  }
636
637
  },
637
638
  previous(view) {
638
- switch (view) {
639
+ const effectiveView = view ?? store.state.currentView ?? defaultView;
640
+ switch (effectiveView) {
639
641
  case "month":
640
642
  previousMonthImpl();
641
643
  break;
package/dist/index.d.cts CHANGED
@@ -120,8 +120,8 @@ type BaseCalendarMethods<Options> = {
120
120
  setState(updater: CalendarState | ((old: CalendarState) => Partial<CalendarState>)): void;
121
121
  goToToday(): void;
122
122
  goToDate(date: Temporal.PlainDate): void;
123
- next(view: ValidViews<Options>): void;
124
- previous(view: ValidViews<Options>): void;
123
+ next(view?: ValidViews<Options>): void;
124
+ previous(view?: ValidViews<Options>): void;
125
125
  views: ReadonlyArray<ValidViews<Options>>;
126
126
  currentView: ValidViews<Options>;
127
127
  setCurrentView(view: ValidViews<Options>): void;
package/dist/index.d.ts CHANGED
@@ -120,8 +120,8 @@ type BaseCalendarMethods<Options> = {
120
120
  setState(updater: CalendarState | ((old: CalendarState) => Partial<CalendarState>)): void;
121
121
  goToToday(): void;
122
122
  goToDate(date: Temporal.PlainDate): void;
123
- next(view: ValidViews<Options>): void;
124
- previous(view: ValidViews<Options>): void;
123
+ next(view?: ValidViews<Options>): void;
124
+ previous(view?: ValidViews<Options>): void;
125
125
  views: ReadonlyArray<ValidViews<Options>>;
126
126
  currentView: ValidViews<Options>;
127
127
  setCurrentView(view: ValidViews<Options>): void;
package/dist/index.js CHANGED
@@ -568,7 +568,8 @@ function createCalendar(options) {
568
568
  }));
569
569
  },
570
570
  next(view) {
571
- switch (view) {
571
+ const effectiveView = view ?? store.state.currentView ?? defaultView;
572
+ switch (effectiveView) {
572
573
  case "month":
573
574
  nextMonthImpl();
574
575
  break;
@@ -581,7 +582,8 @@ function createCalendar(options) {
581
582
  }
582
583
  },
583
584
  previous(view) {
584
- switch (view) {
585
+ const effectiveView = view ?? store.state.currentView ?? defaultView;
586
+ switch (effectiveView) {
585
587
  case "month":
586
588
  previousMonthImpl();
587
589
  break;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gobrand/calendar-core",
3
- "version": "0.0.14",
3
+ "version": "0.0.16",
4
4
  "description": "Lightweight utility library for building calendars using the Temporal API",
5
5
  "private": false,
6
6
  "publishConfig": {
@@ -32,11 +32,6 @@
32
32
  "url": "https://github.com/go-brand/calendar/issues"
33
33
  },
34
34
  "homepage": "https://github.com/go-brand/calendar#readme",
35
- "scripts": {
36
- "build": "tsup src/index.ts --format esm,cjs --dts",
37
- "test": "vitest",
38
- "typecheck": "tsc --noEmit"
39
- },
40
35
  "dependencies": {
41
36
  "@js-temporal/polyfill": "^0.5.1",
42
37
  "@tanstack/store": "^0.8.0"
@@ -57,5 +52,10 @@
57
52
  "month",
58
53
  "week",
59
54
  "year"
60
- ]
61
- }
55
+ ],
56
+ "scripts": {
57
+ "build": "tsup src/index.ts --format esm,cjs --dts",
58
+ "test": "vitest",
59
+ "typecheck": "tsc --noEmit"
60
+ }
61
+ }