New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@event-calendar/interaction

Package Overview
Dependencies
Maintainers
1
Versions
94
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@event-calendar/interaction - npm Package Compare versions

Comparing version 0.12.0 to 0.13.0

257

index.js

@@ -1,2 +0,2 @@

import { SvelteComponent, init, safe_not_equal, noop, listen, is_function, run_all, component_subscribe, globals, set_store_value, subscribe, create_component, space, empty, mount_component, insert, transition_in, group_outros, transition_out, check_outros, destroy_component, detach, binding_callbacks, element, attr, bubble } from 'svelte/internal';
import { SvelteComponent, init, safe_not_equal, noop, listen, is_function, run_all, component_subscribe, globals, set_store_value, bubble, subscribe, create_component, space, empty, mount_component, insert, transition_in, group_outros, transition_out, check_outros, destroy_component, detach, binding_callbacks, element, attr } from 'svelte/internal';
import { getContext } from 'svelte';

@@ -78,13 +78,21 @@ import { ancestor, addDuration, cloneDate, addDay, rect, createDuration, toEventWithLocalDates, toISOString, toViewWithLocalDates, cloneEvent, assign } from '@event-calendar/common';

dispose = [
listen(window_1, "pointermove", /*handlePointerMove*/ ctx[26]),
listen(window_1, "pointerup", /*handlePointerUp*/ ctx[27]),
listen(window_1, "selectstart", /*handleSelectStart*/ ctx[29]),
listen(window_1, "pointermove", /*handlePointerMove*/ ctx[31]),
listen(window_1, "pointerup", /*handlePointerUp*/ ctx[32]),
listen(window_1, "pointercancel", /*handlePointerUp*/ ctx[32]),
listen(window_1, "scroll", /*handleScroll*/ ctx[0]),
listen(window_1, "click", function () {
if (is_function(/*$unselectAuto*/ ctx[2]
? /*handleClick*/ ctx[28]
: undefined)) (/*$unselectAuto*/ ctx[2]
? /*handleClick*/ ctx[28]
if (is_function(/*$unselectAuto*/ ctx[4]
? /*handleClick*/ ctx[33]
: undefined)) (/*$unselectAuto*/ ctx[4]
? /*handleClick*/ ctx[33]
: undefined).apply(this, arguments);
})
}),
listen(window_1, "selectstart", function () {
if (is_function(createPreventDefaultHandler(/*selectstart_handler*/ ctx[41]))) createPreventDefaultHandler(/*selectstart_handler*/ ctx[41]).apply(this, arguments);
}),
listen(window_1, "contextmenu", function () {
if (is_function(createPreventDefaultHandler(/*contextmenu_handler*/ ctx[42]))) createPreventDefaultHandler(/*contextmenu_handler*/ ctx[42]).apply(this, arguments);
}),
listen(window_1, "touchstart", /*handleTouchStart*/ ctx[34]),
listen(window_1, "touchmove", /*touchmove_handler*/ ctx[40], { passive: false })
];

@@ -113,6 +121,14 @@

function createPreventDefaultHandler(condition) {
return jsEvent => {
if (condition()) {
jsEvent.preventDefault();
}
};
}
function instance$3($$self, $$props, $$invalidate) {
let $unselectCancel;
let $_view;
let $unselect;
let $unselectFn;
let $_events;

@@ -125,3 +141,3 @@ let $_iEvents;

$$unsubscribe__viewResources = noop,
$$subscribe__viewResources = () => ($$unsubscribe__viewResources(), $$unsubscribe__viewResources = subscribe(_viewResources, $$value => $$invalidate(65, $_viewResources = $$value)), _viewResources);
$$subscribe__viewResources = () => ($$unsubscribe__viewResources(), $$unsubscribe__viewResources = subscribe(_viewResources, $$value => $$invalidate(73, $_viewResources = $$value)), _viewResources);

@@ -143,31 +159,37 @@ let $eventDrop;

let $selectMinDistance;
let $longPressDelay;
let $eventLongPressDelay;
let $selectLongPressDelay;
let $unselectAuto;
$$self.$$.on_destroy.push(() => $$unsubscribe__viewResources());
let { _iEvents, _iClass, _events, _viewDates, _view, datesAboveResources, dragScroll, editable, eventStartEditable, eventDragMinDistance, eventDragStart, eventDragStop, eventDrop, eventResizeStart, eventResizeStop, eventResize, select, selectBackgroundColor, selectMinDistance, slotDuration, slotHeight, hiddenDays, unselect, unselectAuto, unselectCancel } = getContext('state');
component_subscribe($$self, _iEvents, value => $$invalidate(62, $_iEvents = value));
component_subscribe($$self, _iClass, value => $$invalidate(64, $_iClass = value));
component_subscribe($$self, _events, value => $$invalidate(61, $_events = value));
component_subscribe($$self, _viewDates, value => $$invalidate(74, $_viewDates = value));
component_subscribe($$self, _view, value => $$invalidate(59, $_view = value));
component_subscribe($$self, datesAboveResources, value => $$invalidate(78, $datesAboveResources = value));
component_subscribe($$self, dragScroll, value => $$invalidate(71, $dragScroll = value));
component_subscribe($$self, eventDragMinDistance, value => $$invalidate(79, $eventDragMinDistance = value));
component_subscribe($$self, eventDragStart, value => $$invalidate(72, $eventDragStart = value));
component_subscribe($$self, eventDragStop, value => $$invalidate(68, $eventDragStop = value));
component_subscribe($$self, eventDrop, value => $$invalidate(66, $eventDrop = value));
component_subscribe($$self, eventResizeStart, value => $$invalidate(73, $eventResizeStart = value));
component_subscribe($$self, eventResizeStop, value => $$invalidate(69, $eventResizeStop = value));
component_subscribe($$self, eventResize, value => $$invalidate(67, $eventResize = value));
component_subscribe($$self, select, value => $$invalidate(70, $select = value));
component_subscribe($$self, selectBackgroundColor, value => $$invalidate(63, $selectBackgroundColor = value));
component_subscribe($$self, selectMinDistance, value => $$invalidate(80, $selectMinDistance = value));
component_subscribe($$self, slotDuration, value => $$invalidate(76, $slotDuration = value));
component_subscribe($$self, slotHeight, value => $$invalidate(77, $slotHeight = value));
component_subscribe($$self, hiddenDays, value => $$invalidate(75, $hiddenDays = value));
component_subscribe($$self, unselect, value => $$invalidate(60, $unselect = value));
component_subscribe($$self, unselectAuto, value => $$invalidate(2, $unselectAuto = value));
component_subscribe($$self, unselectCancel, value => $$invalidate(58, $unselectCancel = value));
let { _iEvents, _iClass, _events, _viewDates, _view, datesAboveResources, dragScroll, editable, eventStartEditable, eventDragMinDistance, eventDragStart, eventDragStop, eventDrop, eventLongPressDelay, eventResizeStart, eventResizeStop, eventResize, longPressDelay, select, selectBackgroundColor, selectLongPressDelay, selectMinDistance, slotDuration, slotHeight, hiddenDays, unselect: unselectFn, unselectAuto, unselectCancel } = getContext('state');
component_subscribe($$self, _iEvents, value => $$invalidate(70, $_iEvents = value));
component_subscribe($$self, _iClass, value => $$invalidate(72, $_iClass = value));
component_subscribe($$self, _events, value => $$invalidate(69, $_events = value));
component_subscribe($$self, _viewDates, value => $$invalidate(82, $_viewDates = value));
component_subscribe($$self, _view, value => $$invalidate(67, $_view = value));
component_subscribe($$self, datesAboveResources, value => $$invalidate(86, $datesAboveResources = value));
component_subscribe($$self, dragScroll, value => $$invalidate(79, $dragScroll = value));
component_subscribe($$self, eventDragMinDistance, value => $$invalidate(87, $eventDragMinDistance = value));
component_subscribe($$self, eventDragStart, value => $$invalidate(80, $eventDragStart = value));
component_subscribe($$self, eventDragStop, value => $$invalidate(76, $eventDragStop = value));
component_subscribe($$self, eventDrop, value => $$invalidate(74, $eventDrop = value));
component_subscribe($$self, eventLongPressDelay, value => $$invalidate(90, $eventLongPressDelay = value));
component_subscribe($$self, eventResizeStart, value => $$invalidate(81, $eventResizeStart = value));
component_subscribe($$self, eventResizeStop, value => $$invalidate(77, $eventResizeStop = value));
component_subscribe($$self, eventResize, value => $$invalidate(75, $eventResize = value));
component_subscribe($$self, longPressDelay, value => $$invalidate(89, $longPressDelay = value));
component_subscribe($$self, select, value => $$invalidate(78, $select = value));
component_subscribe($$self, selectBackgroundColor, value => $$invalidate(71, $selectBackgroundColor = value));
component_subscribe($$self, selectLongPressDelay, value => $$invalidate(91, $selectLongPressDelay = value));
component_subscribe($$self, selectMinDistance, value => $$invalidate(88, $selectMinDistance = value));
component_subscribe($$self, slotDuration, value => $$invalidate(84, $slotDuration = value));
component_subscribe($$self, slotHeight, value => $$invalidate(85, $slotHeight = value));
component_subscribe($$self, hiddenDays, value => $$invalidate(83, $hiddenDays = value));
component_subscribe($$self, unselectFn, value => $$invalidate(68, $unselectFn = value));
component_subscribe($$self, unselectAuto, value => $$invalidate(4, $unselectAuto = value));
component_subscribe($$self, unselectCancel, value => $$invalidate(66, $unselectCancel = value));
let action;
let view;
let moving;
let interacting;
let event;

@@ -184,7 +206,15 @@ let col, row;

let isAllDay;
let iClass;
let minEnd; // minimum end time when resizing
let selected; // whether selection has been made
let timer; // timer for long press delays
function dragTimeGrid(eventToDrag, el, jsEvent, resourcesStore, allDay, resize) {
if (!action && jsEvent.isPrimary) {
$$invalidate(1, action = resize ? ACTION_RESIZE : ACTION_DRAG);
view = VIEW_TIME_GRID;
event = eventToDrag;
$$subscribe__viewResources($$invalidate(2, _viewResources = resourcesStore));
isAllDay = allDay;
iClass = resize ? allDay ? 'resizingX' : 'resizingY' : 'dragging';
let dayEl = ancestor(el, 2);

@@ -198,4 +228,3 @@

start(jsEvent);
event = eventToDrag;
common(jsEvent);
offsetY = floor((jsEvent.clientY - colRect.top) / $slotHeight);

@@ -208,13 +237,4 @@ offsetX = 0; // applicable for all-day slot

$$subscribe__viewResources($$invalidate(1, _viewResources = resourcesStore));
view = VIEW_TIME_GRID;
isAllDay = allDay;
if (resize) {
action = ACTION_RESIZE;
minEnd = addDuration(cloneDate(event.start), $slotDuration);
set_store_value(_iClass, $_iClass = 'resizingY', $_iClass);
} else {
action = ACTION_DRAG;
set_store_value(_iClass, $_iClass = 'dragging', $_iClass);
}

@@ -228,6 +248,9 @@

if (!action && jsEvent.isPrimary) {
$$invalidate(1, action = resize ? ACTION_RESIZE : ACTION_DRAG);
view = VIEW_DAY_GRID;
event = eventToDrag;
iClass = resize ? 'resizingX' : 'dragging';
let dayEl = ancestor(el, inPopup ? 3 : 2);
[colEl, bodyEl, col, row, rowEls] = traverseDayGrid(dayEl);
start(jsEvent);
event = eventToDrag;
common(jsEvent);

@@ -238,6 +261,3 @@ offsetX = inPopup

view = VIEW_DAY_GRID;
if (resize) {
action = ACTION_RESIZE;
minEnd = cloneDate(event.start);

@@ -249,7 +269,2 @@ minEnd.setUTCHours(event.end.getUTCHours(), event.end.getUTCMinutes(), event.end.getUTCSeconds());

} // minEnd = addDuration(cloneDate(event.start), $slotDuration); alternative version
set_store_value(_iClass, $_iClass = 'resizingX', $_iClass);
} else {
action = ACTION_DRAG;
set_store_value(_iClass, $_iClass = 'dragging', $_iClass);
}

@@ -263,2 +278,8 @@

if (!action && jsEvent.isPrimary) {
$$invalidate(1, action = ACTION_SELECT);
view = VIEW_TIME_GRID;
$$subscribe__viewResources($$invalidate(2, _viewResources = resourcesStore));
isAllDay = allDay;
iClass = 'selecting';
if (resourcesStore) {

@@ -270,3 +291,3 @@ [colEl, bodyEl, col, resourceCol] = traverseResourceTimeGrid(dayEl, $datesAboveResources);

start(jsEvent);
common(jsEvent);
offsetY = floor((jsEvent.clientY - colRect.top) / $slotHeight);

@@ -279,4 +300,2 @@ offsetX = 0; // applicable for all-day slot

$$subscribe__viewResources($$invalidate(1, _viewResources = resourcesStore));
// Create dummy source event

@@ -298,6 +317,2 @@ let date = cloneDate(colDate);

view = VIEW_TIME_GRID;
isAllDay = allDay;
action = ACTION_SELECT;
set_store_value(_iClass, $_iClass = 'selecting', $_iClass);
move(jsEvent);

@@ -309,4 +324,7 @@ }

if (!action && jsEvent.isPrimary) {
$$invalidate(1, action = ACTION_SELECT);
view = VIEW_DAY_GRID;
iClass = 'selecting';
[colEl, bodyEl, col, row, rowEls] = traverseDayGrid(dayEl);
start(jsEvent);
common(jsEvent);
offsetX = floor((jsEvent.clientX - colRect.left) / colRect.width) - col;

@@ -324,5 +342,2 @@

view = VIEW_DAY_GRID;
action = ACTION_SELECT;
set_store_value(_iClass, $_iClass = 'selecting', $_iClass);
move(jsEvent);

@@ -332,3 +347,3 @@ }

function start(jsEvent) {
function common(jsEvent) {
window.getSelection().removeAllRanges();

@@ -339,2 +354,17 @@ colRect = rect(colEl);

fromY = toY = jsEvent.clientY;
if (jsEvent.pointerType !== 'mouse') {
// For touch devices init long press delay
$$invalidate(3, timer = setTimeout(
() => {
if (action) {
interacting = true;
move(jsEvent);
}
},
(selecting()
? $selectLongPressDelay
: $eventLongPressDelay) ?? $longPressDelay
));
}
}

@@ -346,5 +376,6 @@

if (moving || resizing() || distance() >= (selecting() ? $selectMinDistance : $eventDragMinDistance)) {
clearSelection(jsEvent);
moving = true;
if (interacting || jsEvent && jsEvent.pointerType === 'mouse' && distance() >= (selecting() ? $selectMinDistance : $eventDragMinDistance)) {
interacting = true;
unselect(jsEvent);
set_store_value(_iClass, $_iClass = iClass, $_iClass);
let newCol = floor(rx / colRect.width);

@@ -461,2 +492,7 @@

if (action && jsEvent.isPrimary) {
if (timer) {
clearTimeout(timer);
$$invalidate(3, timer = undefined);
}
toX = jsEvent.clientX;

@@ -470,3 +506,3 @@ toY = jsEvent.clientY;

if (action && jsEvent.isPrimary) {
if (moving) {
if (interacting) {
if (selecting()) {

@@ -488,3 +524,3 @@ if (is_function($select)) {

setTimeout(() => selected = true);
setTimeout(() => selected = true, 5); /*add some delay for touch devices*/
} else {

@@ -537,6 +573,6 @@ event.display = 'auto';

resourceCol = newResourceCol = undefined;
action = view = moving = false;
$$invalidate(1, action = view = interacting = false);
isAllDay = false;
set_store_value(_iClass, $_iClass = undefined, $_iClass);
$$subscribe__viewResources($$invalidate(1, _viewResources = undefined));
$$subscribe__viewResources($$invalidate(2, _viewResources = $$invalidate(3, timer = undefined)));
}

@@ -604,3 +640,3 @@ }

function clearSelection(jsEvent) {
function unselect(jsEvent) {
if (selected) {

@@ -610,4 +646,4 @@ selected = false;

if (is_function($unselect)) {
$unselect({
if (is_function($unselectFn)) {
$unselectFn({
jsEvent,

@@ -621,19 +657,31 @@ view: toViewWithLocalDates($_view)

// Clear selection on view params change
_view.subscribe(clearSelection);
_view.subscribe(unselect);
function handleClick(jsEvent) {
if (selected && !($unselectCancel && jsEvent.target.closest($unselectCancel))) {
clearSelection();
unselect();
}
}
function handleSelectStart(jsEvent) {
if (action) {
jsEvent.preventDefault();
}
function handleTouchStart(jsEvent) {
let target = jsEvent.target;
let stops = [];
let stop = () => run_all(stops);
stops.push(listen(target, 'touchmove', createPreventDefaultHandler(() => interacting)));
stops.push(listen(target, 'touchend', stop));
stops.push(listen(target, 'touchcancel', stop));
}
function touchmove_handler(event) {
bubble.call(this, $$self, event);
}
const selectstart_handler = () => action;
const contextmenu_handler = () => timer;
return [
handleScroll,
action,
_viewResources,
timer,
$unselectAuto,

@@ -651,7 +699,10 @@ _iEvents,

eventDrop,
eventLongPressDelay,
eventResizeStart,
eventResizeStop,
eventResize,
longPressDelay,
select,
selectBackgroundColor,
selectLongPressDelay,
selectMinDistance,

@@ -661,3 +712,3 @@ slotDuration,

hiddenDays,
unselect,
unselectFn,
unselectAuto,

@@ -668,3 +719,3 @@ unselectCancel,

handleClick,
handleSelectStart,
handleTouchStart,
dragTimeGrid,

@@ -674,3 +725,6 @@ dragDayGrid,

selectDayGrid,
clearSelection
unselect,
touchmove_handler,
selectstart_handler,
contextmenu_handler
];

@@ -690,11 +744,11 @@ }

{
dragTimeGrid: 30,
dragDayGrid: 31,
selectTimeGrid: 32,
selectDayGrid: 33,
dragTimeGrid: 35,
dragDayGrid: 36,
selectTimeGrid: 37,
selectDayGrid: 38,
handleScroll: 0,
clearSelection: 34
unselect: 39
},
null,
[-1, -1, -1]
[-1, -1, -1, -1]
);

@@ -704,15 +758,15 @@ }

get dragTimeGrid() {
return this.$$.ctx[30];
return this.$$.ctx[35];
}
get dragDayGrid() {
return this.$$.ctx[31];
return this.$$.ctx[36];
}
get selectTimeGrid() {
return this.$$.ctx[32];
return this.$$.ctx[37];
}
get selectDayGrid() {
return this.$$.ctx[33];
return this.$$.ctx[38];
}

@@ -724,4 +778,4 @@

get clearSelection() {
return this.$$.ctx[34];
get unselect() {
return this.$$.ctx[39];
}

@@ -1241,2 +1295,3 @@ }

options.eventDurationEditable = true;
options.eventLongPressDelay = undefined;
options.eventResizeStart = undefined;

@@ -1246,5 +1301,7 @@ options.eventResizeStop = undefined;

options.dragScroll = true;
options.longPressDelay = 1000;
options.pointer = false;
options.select = undefined;
options.selectBackgroundColor = undefined; // ec option
options.selectLongPressDelay = undefined;
options.selectMinDistance = 0;

@@ -1251,0 +1308,0 @@ options.unselect = undefined;

{
"name": "@event-calendar/interaction",
"version": "0.12.0",
"version": "0.13.0",
"title": "Event Calendar Interaction plugin",

@@ -36,5 +36,5 @@ "description": "Full-sized drag & drop event calendar with resource view",

"dependencies": {
"@event-calendar/common": "~0.12.0",
"@event-calendar/common": "~0.13.0",
"svelte": "^3.51.0"
}
}

@@ -7,3 +7,3 @@ # Event Calendar [![](https://data.jsdelivr.com/v1/package/npm/@event-calendar/build/badge)](https://www.jsdelivr.com/package/npm/@event-calendar/build) [![npm](https://img.shields.io/npm/dm/@event-calendar/core?color=red&label=npm&style=flat-square)](https://www.npmjs.com/package/@event-calendar/core) [![Sponsor](https://img.shields.io/badge/Sponsor-$10-blue.svg?style=flat-square&logo=paypal)](https://www.paypal.me/vkurko/10usd)

* Lightweight (52kb [br](https://en.wikipedia.org/wiki/Brotli) compressed `modern` version)
* Lightweight (54kb [br](https://en.wikipedia.org/wiki/Brotli) compressed `modern` version)
* Zero-dependency (pre-built bundle)

@@ -46,6 +46,7 @@ * Used by [Bookly](https://wordpress.org/plugins/bookly-responsive-appointment-booking-tool/)

- [eventDragStop](#eventdragstop)
- [eventDrop](#eventdrop)
</td><td>
- [eventDrop](#eventdrop)
- [eventDurationEditable](#eventdurationeditable)
- [eventLongPressDelay](#eventlongpressdelay)
- [eventMouseEnter](#eventmouseenter)

@@ -71,2 +72,3 @@ - [eventMouseLeave](#eventmouseleave)

- [locale](#locale)
- [longPressDelay](#longpressdelay)
- [monthMode](#monthmode)

@@ -84,2 +86,3 @@ </td><td>

- [selectBackgroundColor](#selectbackgroundcolor)
- [selectLongPressDelay](#selectlongpressdelay)
- [selectMinDistance](#selectmindistance)

@@ -829,2 +832,10 @@ - [scrollTime](#scrolltime)

### eventLongPressDelay
- Type `integer`
- Default `undefined`
For touch devices, the amount of time (in milliseconds) the user must hold down a tap before the event becomes draggable/resizable.
If not specified, it falls back to [longPressDelay](#longpressdelay).
### eventMouseEnter

@@ -1375,2 +1386,10 @@ - Type `function`

### longPressDelay
- Type `integer`
- Default `1000`
For touch devices, the amount of time (in milliseconds) the user must hold down a tap before the event becomes draggable/resizable or the date becomes selectable.
For a more granular configuration, see [eventLongPressDelay](#eventlongpressdelay) and [selectLongPressDelay](#selectlongpressdelay).
### monthMode

@@ -1571,2 +1590,10 @@ - Type `boolean`

### selectLongPressDelay
- Type `integer`
- Default `undefined`
For touch devices, the amount of time (in milliseconds) the user must hold down a tap before the date becomes selectable.
If not specified, it falls back to [longPressDelay](#longpressdelay).
### selectMinDistance

@@ -1573,0 +1600,0 @@ - Type `integer`

@@ -13,2 +13,3 @@ import Interaction from './Interaction.svelte';

options.eventDurationEditable = true;
options.eventLongPressDelay = undefined;
options.eventResizeStart = undefined;

@@ -18,5 +19,7 @@ options.eventResizeStop = undefined;

options.dragScroll = true;
options.longPressDelay = 1000;
options.pointer = false;
options.select = undefined;
options.selectBackgroundColor = undefined; // ec option
options.selectLongPressDelay = undefined;
options.selectMinDistance = 0;

@@ -23,0 +26,0 @@ options.unselect = undefined;

@@ -61,2 +61,2 @@ import {ancestor} from '@event-calendar/common';

return Math.floor(value);
}
}

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc