@event-calendar/core 1.1.0 → 1.2.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,23 @@
1
+ export function assign(...args) {
2
+ return Object.assign(...args);
3
+ }
4
+
5
+ export function floor(value) {
6
+ return Math.floor(value);
7
+ }
8
+
9
+ export function min(...args) {
10
+ return Math.min(...args);
11
+ }
12
+
13
+ export function max(...args) {
14
+ return Math.max(...args);
15
+ }
16
+
17
+ export function isObject(test) {
18
+ return typeof test === 'object' && test !== null;
19
+ }
20
+
21
+ export function symbol() {
22
+ return Symbol('ec');
23
+ }
@@ -0,0 +1,24 @@
1
+ import {assign} from './utils';
2
+ import {toLocalDate} from './date';
3
+
4
+ export function createView(view, _viewTitle, _currentRange, _activeRange) {
5
+ return {
6
+ type: view,
7
+ title: _viewTitle,
8
+ currentStart: _currentRange.start,
9
+ currentEnd: _currentRange.end,
10
+ activeStart: _activeRange.start,
11
+ activeEnd: _activeRange.end,
12
+ calendar: undefined
13
+ };
14
+ }
15
+
16
+ export function toViewWithLocalDates(view) {
17
+ view = assign({}, view);
18
+ view.currentStart = toLocalDate(view.currentStart);
19
+ view.currentEnd = toLocalDate(view.currentEnd);
20
+ view.activeStart = toLocalDate(view.activeStart);
21
+ view.activeEnd = toLocalDate(view.activeEnd);
22
+
23
+ return view;
24
+ }
package/src/lib.js ADDED
@@ -0,0 +1,8 @@
1
+ export * from './lib/actions';
2
+ export * from './lib/date';
3
+ export * from './lib/debounce';
4
+ export * from './lib/dom';
5
+ export * from './lib/events';
6
+ export * from './lib/stores';
7
+ export * from './lib/utils';
8
+ export * from './lib/view';
@@ -1,5 +1,4 @@
1
- import {assign, createDate, createDuration, setMidnight} from '@event-calendar/common';
2
- import {createEvents, createEventSources} from '@event-calendar/common';
1
+ import {assign, createDate, createDuration, setMidnight, createEvents, createEventSources} from '../lib.js';
3
2
  import {is_function} from 'svelte/internal';
4
3
 
5
4
  export function createOptions(plugins) {
@@ -12,8 +12,7 @@ import {
12
12
  viewTitle,
13
13
  view as view2 // hack to avoid a runtime error in SvelteKit dev mode (ReferenceError: view is not defined)
14
14
  } from './stores';
15
- import {writable2, intl, intlRange} from '@event-calendar/common';
16
- import {assign} from '@event-calendar/common';
15
+ import {assign, writable2, intl, intlRange} from '../lib.js';
17
16
 
18
17
  export default class {
19
18
  constructor(plugins, input) {
@@ -2,10 +2,14 @@ import {derived, writable, readable} from 'svelte/store';
2
2
  import {is_function} from 'svelte/internal';
3
3
  import {
4
4
  DAY_IN_SECONDS,
5
+ assign,
5
6
  cloneDate,
6
7
  createDate,
8
+ createEvents,
9
+ createView,
7
10
  addDuration,
8
11
  addDay,
12
+ derived2,
9
13
  subtractDay,
10
14
  toISOString,
11
15
  nextClosestDay,
@@ -13,11 +17,7 @@ import {
13
17
  setMidnight,
14
18
  toLocalDate,
15
19
  debounce
16
- } from '@event-calendar/common';
17
- import {derived2} from '@event-calendar/common';
18
- import {createEvents} from '@event-calendar/common';
19
- import {createView} from '@event-calendar/common';
20
- import {assign} from '@event-calendar/common';
20
+ } from '../lib.js';
21
21
 
22
22
  export function monthMode(state) {
23
23
  return derived(state._viewClass, $_viewClass => $_viewClass === 'month');