Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@event-calendar/time-grid

Package Overview
Dependencies
Maintainers
1
Versions
100
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@event-calendar/time-grid - npm Package Compare versions

Comparing version 0.0.1 to 0.1.0-beta.1

460

index.js

@@ -1,5 +0,5 @@

import { SvelteComponent, init, safe_not_equal, element, text, attr, insert, append, set_data, detach, create_slot, space, update_slot, transition_in, transition_out, destroy_each, component_subscribe, listen, set_store_value, binding_callbacks, action_destroyer, is_function, noop, run_all, create_component, mount_component, destroy_component, group_outros, check_outros, empty } from 'svelte/internal';
import { SvelteComponent, init, safe_not_equal, element, text, attr, insert, append, set_data, detach, create_slot, space, update_slot, transition_in, transition_out, destroy_each, component_subscribe, listen, run_all, set_store_value, binding_callbacks, action_destroyer, is_function, noop, create_component, mount_component, destroy_component, group_outros, check_outros, empty } from 'svelte/internal';
import { getContext, tick, onMount, setContext } from 'svelte';
import { derived } from 'svelte/store';
import { createDuration, DAY_IN_SECONDS, addDuration, cloneDate, createDate, hasYScroll, sortEventChunks, action, toEventWithLocalDates, toViewWithLocalDates, createEventContent, setMidnight, createEventChunk, datesEqual, toLocalDate } from '@event-calendar/common';
import { createDuration, DAY_IN_SECONDS, addDuration, cloneDate, createDate, hasYScroll, sortEventChunks, setContent, toEventWithLocalDates, toViewWithLocalDates, createEventContent, setMidnight, createEventChunk, datesEqual, rect, toLocalDate } from '@event-calendar/common';

@@ -293,3 +293,3 @@ function times(state, localState) {

const child_ctx = ctx.slice();
child_ctx[23] = list[i];
child_ctx[26] = list[i];
return child_ctx;

@@ -300,10 +300,10 @@ }

const child_ctx = ctx.slice();
child_ctx[26] = list[i];
child_ctx[29] = list[i];
return child_ctx;
}
// (36:3) {#each $_times as time}
// (42:3) {#each $_times as time}
function create_each_block_1$2(ctx) {
let div;
let t_value = /*time*/ ctx[26] + "";
let t_value = /*time*/ ctx[29] + "";
let t;

@@ -323,5 +323,5 @@ let div_class_value;

p(ctx, dirty) {
if (dirty & /*$_times*/ 2 && t_value !== (t_value = /*time*/ ctx[26] + "")) set_data(t, t_value);
if (dirty[0] & /*$_times*/ 2 && t_value !== (t_value = /*time*/ ctx[29] + "")) set_data(t, t_value);
if (dirty & /*$theme*/ 16 && div_class_value !== (div_class_value = /*$theme*/ ctx[4].time)) {
if (dirty[0] & /*$theme*/ 16 && div_class_value !== (div_class_value = /*$theme*/ ctx[4].time)) {
attr(div, "class", div_class_value);

@@ -336,3 +336,3 @@ }

// (42:4) {#each lines as line}
// (48:4) {#each lines as line}
function create_each_block$2(ctx) {

@@ -351,3 +351,3 @@ let div;

p(ctx, dirty) {
if (dirty & /*$theme*/ 16 && div_class_value !== (div_class_value = /*$theme*/ ctx[4].line)) {
if (dirty[0] & /*$theme*/ 16 && div_class_value !== (div_class_value = /*$theme*/ ctx[4].line)) {
attr(div, "class", div_class_value);

@@ -392,4 +392,4 @@ }

const default_slot_template = /*#slots*/ ctx[19].default;
const default_slot = create_slot(default_slot_template, ctx, /*$$scope*/ ctx[18], null);
const default_slot_template = /*#slots*/ ctx[21].default;
const default_slot = create_slot(default_slot_template, ctx, /*$$scope*/ ctx[20], null);

@@ -448,12 +448,16 @@ return {

/*div4_binding*/ ctx[20](div4);
/*div4_binding*/ ctx[22](div4);
current = true;
if (!mounted) {
dispose = listen(window, "resize", /*recheckScrollable*/ ctx[12]);
dispose = [
listen(window, "resize", /*recheckScrollable*/ ctx[13]),
listen(div4, "scroll", /*handleScroll*/ ctx[14])
];
mounted = true;
}
},
p(ctx, [dirty]) {
if (dirty & /*$theme, $_times*/ 18) {
p(ctx, dirty) {
if (dirty[0] & /*$theme, $_times*/ 18) {
each_value_1 = /*$_times*/ ctx[1];

@@ -481,7 +485,7 @@ let i;

if (!current || dirty & /*$theme*/ 16 && div0_class_value !== (div0_class_value = /*$theme*/ ctx[4].sidebar)) {
if (!current || dirty[0] & /*$theme*/ 16 && div0_class_value !== (div0_class_value = /*$theme*/ ctx[4].sidebar)) {
attr(div0, "class", div0_class_value);
}
if (dirty & /*$theme, lines*/ 24) {
if (dirty[0] & /*$theme, lines*/ 24) {
each_value = /*lines*/ ctx[3];

@@ -509,3 +513,3 @@ let i;

if (!current || dirty & /*$theme*/ 16 && div1_class_value !== (div1_class_value = /*$theme*/ ctx[4].lines)) {
if (!current || dirty[0] & /*$theme*/ 16 && div1_class_value !== (div1_class_value = /*$theme*/ ctx[4].lines)) {
attr(div1, "class", div1_class_value);

@@ -515,16 +519,16 @@ }

if (default_slot) {
if (default_slot.p && dirty & /*$$scope*/ 262144) {
update_slot(default_slot, default_slot_template, ctx, /*$$scope*/ ctx[18], dirty, null, null);
if (default_slot.p && dirty[0] & /*$$scope*/ 1048576) {
update_slot(default_slot, default_slot_template, ctx, /*$$scope*/ ctx[20], dirty, null, null);
}
}
if (!current || dirty & /*$theme*/ 16 && div2_class_value !== (div2_class_value = /*$theme*/ ctx[4].days)) {
if (!current || dirty[0] & /*$theme*/ 16 && div2_class_value !== (div2_class_value = /*$theme*/ ctx[4].days)) {
attr(div2, "class", div2_class_value);
}
if (!current || dirty & /*$theme*/ 16 && div3_class_value !== (div3_class_value = /*$theme*/ ctx[4].content)) {
if (!current || dirty[0] & /*$theme*/ 16 && div3_class_value !== (div3_class_value = /*$theme*/ ctx[4].content)) {
attr(div3, "class", div3_class_value);
}
if (!current || dirty & /*$theme, compact*/ 20 && div4_class_value !== (div4_class_value = "" + (/*$theme*/ ctx[4].body + " " + /*$theme*/ ctx[4].week + (/*compact*/ ctx[2]
if (!current || dirty[0] & /*$theme, compact*/ 20 && div4_class_value !== (div4_class_value = "" + (/*$theme*/ ctx[4].body + " " + /*$theme*/ ctx[4].week + (/*compact*/ ctx[2]
? " " + /*$theme*/ ctx[4].compact

@@ -549,5 +553,5 @@ : "")))) {

if (default_slot) default_slot.d(detaching);
/*div4_binding*/ ctx[20](null);
/*div4_binding*/ ctx[22](null);
mounted = false;
dispose();
run_all(dispose);
}

@@ -564,12 +568,14 @@ };

let $_scrollable;
let $_interaction;
let $theme;
let { $$slots: slots = {}, $$scope } = $$props;
let { slotDuration, _intlSlotLabel, _viewDates, scrollTime, _scrollable, theme } = getContext("state");
component_subscribe($$self, slotDuration, value => $$invalidate(14, $slotDuration = value));
component_subscribe($$self, _viewDates, value => $$invalidate(16, $_viewDates = value));
component_subscribe($$self, scrollTime, value => $$invalidate(17, $scrollTime = value));
component_subscribe($$self, _scrollable, value => $$invalidate(21, $_scrollable = value));
let { slotDuration, _intlSlotLabel, _viewDates, scrollTime, _scrollable, theme, _interaction } = getContext("state");
component_subscribe($$self, slotDuration, value => $$invalidate(16, $slotDuration = value));
component_subscribe($$self, _viewDates, value => $$invalidate(18, $_viewDates = value));
component_subscribe($$self, scrollTime, value => $$invalidate(19, $scrollTime = value));
component_subscribe($$self, _scrollable, value => $$invalidate(23, $_scrollable = value));
component_subscribe($$self, theme, value => $$invalidate(4, $theme = value));
component_subscribe($$self, _interaction, value => $$invalidate(24, $_interaction = value));
let { _slotTimeLimits, _times } = getContext("view-state");
component_subscribe($$self, _slotTimeLimits, value => $$invalidate(15, $_slotTimeLimits = value));
component_subscribe($$self, _slotTimeLimits, value => $$invalidate(17, $_slotTimeLimits = value));
component_subscribe($$self, _times, value => $$invalidate(1, $_times = value));

@@ -585,6 +591,12 @@ let el;

function handleScroll() {
if ($_interaction.drag) {
$_interaction.drag.handleScroll();
}
}
function div4_binding($$value) {
binding_callbacks[$$value ? "unshift" : "push"](() => {
el = $$value;
(((((($$invalidate(0, el), $$invalidate(16, $_viewDates)), $$invalidate(17, $scrollTime)), $$invalidate(13, timeLimitMin)), $$invalidate(14, $slotDuration)), $$invalidate(1, $_times)), $$invalidate(15, $_slotTimeLimits));
(((((($$invalidate(0, el), $$invalidate(18, $_viewDates)), $$invalidate(19, $scrollTime)), $$invalidate(15, timeLimitMin)), $$invalidate(16, $slotDuration)), $$invalidate(1, $_times)), $$invalidate(17, $_slotTimeLimits));
});

@@ -594,7 +606,7 @@ }

$$self.$$set = $$props => {
if ("$$scope" in $$props) $$invalidate(18, $$scope = $$props.$$scope);
if ("$$scope" in $$props) $$invalidate(20, $$scope = $$props.$$scope);
};
$$self.$$.update = () => {
if ($$self.$$.dirty & /*$slotDuration, $_times, $_slotTimeLimits*/ 49154) {
if ($$self.$$.dirty[0] & /*$slotDuration, $_times, $_slotTimeLimits*/ 196610) {
{

@@ -605,7 +617,7 @@ $$invalidate(2, compact = $slotDuration.seconds >= 3600);

// Use intermediate variable so that changes in _slotTimeLimits do not trigger setting the el.scrollTop
$$invalidate(13, timeLimitMin = $_slotTimeLimits.min.seconds);
$$invalidate(15, timeLimitMin = $_slotTimeLimits.min.seconds);
}
}
if ($$self.$$.dirty & /*el, $_viewDates, $scrollTime, timeLimitMin, $slotDuration*/ 221185) {
if ($$self.$$.dirty[0] & /*el, $_viewDates, $scrollTime, timeLimitMin, $slotDuration*/ 884737) {
if (el && $_viewDates) {

@@ -616,3 +628,3 @@ $$invalidate(0, el.scrollTop = ($scrollTime.seconds - timeLimitMin) / $slotDuration.seconds * 24 - 12, el);

if ($$self.$$.dirty & /*el, $_times, $slotDuration*/ 16387) {
if ($$self.$$.dirty[0] & /*el, $_times, $slotDuration*/ 65539) {
if (el && $_times && $slotDuration) {

@@ -635,5 +647,7 @@ tick().then(recheckScrollable);

theme,
_interaction,
_slotTimeLimits,
_times,
recheckScrollable,
handleScroll,
timeLimitMin,

@@ -653,3 +667,3 @@ $slotDuration,

super();
init(this, options, instance$3, create_fragment$3, safe_not_equal, {});
init(this, options, instance$3, create_fragment$3, safe_not_equal, {}, [-1, -1]);
}

@@ -702,3 +716,3 @@ }

let div;
let action_action;
let setContent_action;
let mounted;

@@ -710,20 +724,23 @@ let dispose;

div = element("div");
attr(div, "class", /*className*/ ctx[1]);
attr(div, "style", /*style*/ ctx[2]);
attr(div, "class", /*classes*/ ctx[3]);
attr(div, "style", /*style*/ ctx[4]);
},
m(target, anchor) {
insert(target, div, anchor);
/*div_binding*/ ctx[32](div);
/*div_binding*/ ctx[36](div);
if (!mounted) {
dispose = [
action_destroyer(action_action = action.call(null, div, /*content*/ ctx[3])),
action_destroyer(setContent_action = setContent.call(null, div, /*content*/ ctx[5])),
listen(div, "click", function () {
if (is_function(/*createHandler*/ ctx[20](/*$eventClick*/ ctx[4]))) /*createHandler*/ ctx[20](/*$eventClick*/ ctx[4]).apply(this, arguments);
if (is_function(/*createHandler*/ ctx[23](/*$eventClick*/ ctx[6], /*display*/ ctx[0]))) /*createHandler*/ ctx[23](/*$eventClick*/ ctx[6], /*display*/ ctx[0]).apply(this, arguments);
}),
listen(div, "mouseenter", function () {
if (is_function(/*createHandler*/ ctx[20](/*$eventMouseEnter*/ ctx[5]))) /*createHandler*/ ctx[20](/*$eventMouseEnter*/ ctx[5]).apply(this, arguments);
if (is_function(/*createHandler*/ ctx[23](/*$eventMouseEnter*/ ctx[7], /*display*/ ctx[0]))) /*createHandler*/ ctx[23](/*$eventMouseEnter*/ ctx[7], /*display*/ ctx[0]).apply(this, arguments);
}),
listen(div, "mouseleave", function () {
if (is_function(/*createHandler*/ ctx[20](/*$eventMouseLeave*/ ctx[6]))) /*createHandler*/ ctx[20](/*$eventMouseLeave*/ ctx[6]).apply(this, arguments);
if (is_function(/*createHandler*/ ctx[23](/*$eventMouseLeave*/ ctx[8], /*display*/ ctx[0]))) /*createHandler*/ ctx[23](/*$eventMouseLeave*/ ctx[8], /*display*/ ctx[0]).apply(this, arguments);
}),
listen(div, "mousedown", function () {
if (is_function(/*createMouseDownHandler*/ ctx[24](/*$_interaction*/ ctx[1], /*display*/ ctx[0]))) /*createMouseDownHandler*/ ctx[24](/*$_interaction*/ ctx[1], /*display*/ ctx[0]).apply(this, arguments);
})

@@ -738,11 +755,11 @@ ];

if (dirty[0] & /*className*/ 2) {
attr(div, "class", /*className*/ ctx[1]);
if (dirty[0] & /*classes*/ 8) {
attr(div, "class", /*classes*/ ctx[3]);
}
if (dirty[0] & /*style*/ 4) {
attr(div, "style", /*style*/ ctx[2]);
if (dirty[0] & /*style*/ 16) {
attr(div, "style", /*style*/ ctx[4]);
}
if (action_action && is_function(action_action.update) && dirty[0] & /*content*/ 8) action_action.update.call(null, /*content*/ ctx[3]);
if (setContent_action && is_function(setContent_action.update) && dirty[0] & /*content*/ 32) setContent_action.update.call(null, /*content*/ ctx[5]);
},

@@ -753,3 +770,3 @@ i: noop,

if (detaching) detach(div);
/*div_binding*/ ctx[32](null);
/*div_binding*/ ctx[36](null);
mounted = false;

@@ -767,2 +784,3 @@ run_all(dispose);

let $theme;
let $_interaction;
let $displayEventEnd;

@@ -778,19 +796,21 @@ let $eventContent;

let { chunk } = $$props;
let { displayEventEnd, eventBackgroundColor, eventColor, eventContent, eventClick, eventDidMount, eventMouseEnter, eventMouseLeave, slotDuration, theme, _view, _intlEventTime } = getContext("state");
component_subscribe($$self, displayEventEnd, value => $$invalidate(28, $displayEventEnd = value));
component_subscribe($$self, eventBackgroundColor, value => $$invalidate(25, $eventBackgroundColor = value));
component_subscribe($$self, eventColor, value => $$invalidate(26, $eventColor = value));
component_subscribe($$self, eventContent, value => $$invalidate(29, $eventContent = value));
component_subscribe($$self, eventClick, value => $$invalidate(4, $eventClick = value));
component_subscribe($$self, eventDidMount, value => $$invalidate(34, $eventDidMount = value));
component_subscribe($$self, eventMouseEnter, value => $$invalidate(5, $eventMouseEnter = value));
component_subscribe($$self, eventMouseLeave, value => $$invalidate(6, $eventMouseLeave = value));
component_subscribe($$self, slotDuration, value => $$invalidate(23, $slotDuration = value));
component_subscribe($$self, theme, value => $$invalidate(27, $theme = value));
component_subscribe($$self, _view, value => $$invalidate(31, $_view = value));
component_subscribe($$self, _intlEventTime, value => $$invalidate(30, $_intlEventTime = value));
let { _slotTimeLimits } = getContext("view-state");
component_subscribe($$self, _slotTimeLimits, value => $$invalidate(24, $_slotTimeLimits = value));
let { displayEventEnd, eventBackgroundColor, eventColor, eventContent, eventClick, eventDidMount, eventMouseEnter, eventMouseLeave, slotDuration, theme, _view, _intlEventTime, _interaction } = getContext("state");
component_subscribe($$self, displayEventEnd, value => $$invalidate(32, $displayEventEnd = value));
component_subscribe($$self, eventBackgroundColor, value => $$invalidate(29, $eventBackgroundColor = value));
component_subscribe($$self, eventColor, value => $$invalidate(30, $eventColor = value));
component_subscribe($$self, eventContent, value => $$invalidate(33, $eventContent = value));
component_subscribe($$self, eventClick, value => $$invalidate(6, $eventClick = value));
component_subscribe($$self, eventDidMount, value => $$invalidate(38, $eventDidMount = value));
component_subscribe($$self, eventMouseEnter, value => $$invalidate(7, $eventMouseEnter = value));
component_subscribe($$self, eventMouseLeave, value => $$invalidate(8, $eventMouseLeave = value));
component_subscribe($$self, slotDuration, value => $$invalidate(27, $slotDuration = value));
component_subscribe($$self, theme, value => $$invalidate(31, $theme = value));
component_subscribe($$self, _view, value => $$invalidate(35, $_view = value));
component_subscribe($$self, _intlEventTime, value => $$invalidate(34, $_intlEventTime = value));
component_subscribe($$self, _interaction, value => $$invalidate(1, $_interaction = value));
let { _slotTimeLimits, _viewResources } = getContext("view-state");
component_subscribe($$self, _slotTimeLimits, value => $$invalidate(28, $_slotTimeLimits = value));
let el;
let className;
let display;
let classes;
let style;

@@ -811,19 +831,23 @@ let content;

function createHandler(fn) {
return jsEvent => {
if (is_function(fn)) {
fn({
event: toEventWithLocalDates(chunk.event),
el,
jsEvent,
view: toViewWithLocalDates($_view)
});
}
};
function createHandler(fn, display) {
return display !== "preview" && is_function(fn)
? jsEvent => fn({
event: toEventWithLocalDates(chunk.event),
el,
jsEvent,
view: toViewWithLocalDates($_view)
})
: undefined;
}
function createMouseDownHandler(interaction, display) {
return display === "auto" && interaction.drag
? jsEvent => interaction.drag.startTimeGrid(chunk.event, el, jsEvent, _viewResources)
: undefined;
}
function div_binding($$value) {
binding_callbacks[$$value ? "unshift" : "push"](() => {
el = $$value;
$$invalidate(0, el);
$$invalidate(2, el);
});

@@ -833,10 +857,12 @@ }

$$self.$$set = $$props => {
if ("date" in $$props) $$invalidate(21, date = $$props.date);
if ("chunk" in $$props) $$invalidate(22, chunk = $$props.chunk);
if ("date" in $$props) $$invalidate(25, date = $$props.date);
if ("chunk" in $$props) $$invalidate(26, chunk = $$props.chunk);
};
$$self.$$.update = () => {
if ($$self.$$.dirty[0] & /*$slotDuration, $_slotTimeLimits, chunk, date, $eventBackgroundColor, $eventColor, style, $theme, $displayEventEnd, $eventContent, $_intlEventTime*/ 2145386500 | $$self.$$.dirty[1] & /*$_view*/ 1) {
if ($$self.$$.dirty[0] & /*chunk, $slotDuration, $_slotTimeLimits, date, $eventBackgroundColor, $eventColor, style, display, $_interaction*/ 2113929235 | $$self.$$.dirty[1] & /*$theme*/ 1) {
{
// Class & Style
$$invalidate(0, display = chunk.event.display);
// Style
let step = $slotDuration.seconds / 60;

@@ -851,26 +877,32 @@

let bgColor = chunk.event.backgroundColor || $eventBackgroundColor || $eventColor;
$$invalidate(2, style = `top:${top}px;` + `min-height:${height}px;` + `height:${height}px;` + `max-height:${maxHeight}px;`);
$$invalidate(4, style = `top:${top}px;` + `min-height:${height}px;` + `height:${height}px;` + `max-height:${maxHeight}px;`);
if (bgColor) {
$$invalidate(2, style += `background-color:${bgColor};`);
$$invalidate(4, style += `background-color:${bgColor};`);
}
switch (chunk.event.display) {
case "background":
$$invalidate(1, className = $theme.bgEvent);
break;
default:
$$invalidate(1, className = $theme.event);
$$invalidate(2, style += `z-index:${chunk.column + 1};` + `left:${100 / chunk.group.columns.length * chunk.column}%;` + `width:${100 / chunk.group.columns.length * 0.5 * (1 + chunk.group.columns.length - chunk.column)}%;`);
if (display === "auto" || display === "ghost") {
$$invalidate(4, style += `z-index:${chunk.column + 1};` + `left:${100 / chunk.group.columns.length * chunk.column}%;` + `width:${100 / chunk.group.columns.length * 0.5 * (1 + chunk.group.columns.length - chunk.column)}%;`);
}
// Content
$$invalidate(3, [timeText, content] = createEventContent(chunk, $displayEventEnd, $eventContent, $theme, $_intlEventTime, $_view), content);
// Class
let className = display === "background" ? $theme.bgEvent : $theme.event;
$$invalidate(3, classes = $_interaction.drag
? $_interaction.drag.classes(display, className)
: className);
}
}
if ($$self.$$.dirty[0] & /*chunk*/ 67108864 | $$self.$$.dirty[1] & /*$displayEventEnd, $eventContent, $theme, $_intlEventTime, $_view*/ 31) {
// Content
$$invalidate(5, [timeText, content] = createEventContent(chunk, $displayEventEnd, $eventContent, $theme, $_intlEventTime, $_view), content);
}
};
return [
display,
$_interaction,
el,
className,
classes,
style,

@@ -893,4 +925,6 @@ content,

_intlEventTime,
_interaction,
_slotTimeLimits,
createHandler,
createMouseDownHandler,
date,

@@ -914,3 +948,3 @@ chunk,

super();
init(this, options, instance$2, create_fragment$2, safe_not_equal, { date: 21, chunk: 22 }, [-1, -1]);
init(this, options, instance$2, create_fragment$2, safe_not_equal, { date: 25, chunk: 26 }, [-1, -1]);
}

@@ -923,3 +957,3 @@ }

const child_ctx = ctx.slice();
child_ctx[22] = list[i];
child_ctx[28] = list[i];
return child_ctx;

@@ -930,7 +964,7 @@ }

const child_ctx = ctx.slice();
child_ctx[22] = list[i];
child_ctx[28] = list[i];
return child_ctx;
}
// (60:2) {#each bgChunks as chunk}
// (82:2) {#each bgChunks as chunk}
function create_each_block_1$1(ctx) {

@@ -943,3 +977,3 @@ let event;

date: /*date*/ ctx[0],
chunk: /*chunk*/ ctx[22]
chunk: /*chunk*/ ctx[28]
}

@@ -958,4 +992,4 @@ });

const event_changes = {};
if (dirty & /*date*/ 1) event_changes.date = /*date*/ ctx[0];
if (dirty & /*bgChunks*/ 4) event_changes.chunk = /*chunk*/ ctx[22];
if (dirty[0] & /*date*/ 1) event_changes.date = /*date*/ ctx[0];
if (dirty[0] & /*bgChunks*/ 4) event_changes.chunk = /*chunk*/ ctx[28];
event.$set(event_changes);

@@ -978,3 +1012,3 @@ },

// (65:2) {#each chunks as chunk}
// (87:2) {#each chunks as chunk}
function create_each_block$1(ctx) {

@@ -987,3 +1021,3 @@ let event;

date: /*date*/ ctx[0],
chunk: /*chunk*/ ctx[22]
chunk: /*chunk*/ ctx[28]
}

@@ -1002,4 +1036,4 @@ });

const event_changes = {};
if (dirty & /*date*/ 1) event_changes.date = /*date*/ ctx[0];
if (dirty & /*chunks*/ 2) event_changes.chunk = /*chunk*/ ctx[22];
if (dirty[0] & /*date*/ 1) event_changes.date = /*date*/ ctx[0];
if (dirty[0] & /*chunks*/ 2) event_changes.chunk = /*chunk*/ ctx[28];
event.$set(event_changes);

@@ -1022,2 +1056,43 @@ },

// (90:2) {#if dragChunk}
function create_if_block(ctx) {
let event;
let current;
event = new Event({
props: {
date: /*date*/ ctx[0],
chunk: /*dragChunk*/ ctx[3]
}
});
return {
c() {
create_component(event.$$.fragment);
},
m(target, anchor) {
mount_component(event, target, anchor);
current = true;
},
p(ctx, dirty) {
const event_changes = {};
if (dirty[0] & /*date*/ 1) event_changes.date = /*date*/ ctx[0];
if (dirty[0] & /*dragChunk*/ 8) event_changes.chunk = /*dragChunk*/ ctx[3];
event.$set(event_changes);
},
i(local) {
if (current) return;
transition_in(event.$$.fragment, local);
current = true;
},
o(local) {
transition_out(event.$$.fragment, local);
current = false;
},
d(detaching) {
destroy_component(event, detaching);
}
};
}
function create_fragment$1(ctx) {

@@ -1027,4 +1102,5 @@ let div2;

let div0_class_value;
let t;
let t0;
let div1;
let t1;
let div1_class_value;

@@ -1057,2 +1133,4 @@ let div2_class_value;

let if_block = /*dragChunk*/ ctx[3] && create_if_block(ctx);
return {

@@ -1067,3 +1145,3 @@ c() {

t = space();
t0 = space();
div1 = element("div");

@@ -1075,7 +1153,9 @@

attr(div0, "class", div0_class_value = /*$theme*/ ctx[5].bgEvents);
attr(div1, "class", div1_class_value = /*$theme*/ ctx[5].events);
t1 = space();
if (if_block) if_block.c();
attr(div0, "class", div0_class_value = /*$theme*/ ctx[6].bgEvents);
attr(div1, "class", div1_class_value = /*$theme*/ ctx[6].events);
attr(div2, "class", div2_class_value = "" + (/*$theme*/ ctx[5].day + (/*isToday*/ ctx[3] ? " " + /*$theme*/ ctx[5].today : "") + (/*highlight*/ ctx[4]
? " " + /*$theme*/ ctx[5].highlight
attr(div2, "class", div2_class_value = "" + (/*$theme*/ ctx[6].day + (/*isToday*/ ctx[4] ? " " + /*$theme*/ ctx[6].today : "") + (/*highlight*/ ctx[5]
? " " + /*$theme*/ ctx[6].highlight
: "")));

@@ -1091,3 +1171,3 @@ },

append(div2, t);
append(div2, t0);
append(div2, div1);

@@ -1099,11 +1179,18 @@

append(div1, t1);
if (if_block) if_block.m(div1, null);
current = true;
if (!mounted) {
dispose = listen(div2, "click", /*handleClick*/ ctx[13]);
dispose = listen(div2, "click", function () {
if (is_function(/*createClickHandler*/ ctx[16](/*$dateClick*/ ctx[7]))) /*createClickHandler*/ ctx[16](/*$dateClick*/ ctx[7]).apply(this, arguments);
});
mounted = true;
}
},
p(ctx, [dirty]) {
if (dirty & /*date, bgChunks*/ 5) {
p(new_ctx, dirty) {
ctx = new_ctx;
if (dirty[0] & /*date, bgChunks*/ 5) {
each_value_1 = /*bgChunks*/ ctx[2];

@@ -1135,7 +1222,7 @@ let i;

if (!current || dirty & /*$theme*/ 32 && div0_class_value !== (div0_class_value = /*$theme*/ ctx[5].bgEvents)) {
if (!current || dirty[0] & /*$theme*/ 64 && div0_class_value !== (div0_class_value = /*$theme*/ ctx[6].bgEvents)) {
attr(div0, "class", div0_class_value);
}
if (dirty & /*date, chunks*/ 3) {
if (dirty[0] & /*date, chunks*/ 3) {
each_value = /*chunks*/ ctx[1];

@@ -1154,3 +1241,3 @@ let i;

transition_in(each_blocks[i], 1);
each_blocks[i].m(div1, null);
each_blocks[i].m(div1, t1);
}

@@ -1168,8 +1255,31 @@ }

if (!current || dirty & /*$theme*/ 32 && div1_class_value !== (div1_class_value = /*$theme*/ ctx[5].events)) {
if (/*dragChunk*/ ctx[3]) {
if (if_block) {
if_block.p(ctx, dirty);
if (dirty[0] & /*dragChunk*/ 8) {
transition_in(if_block, 1);
}
} else {
if_block = create_if_block(ctx);
if_block.c();
transition_in(if_block, 1);
if_block.m(div1, null);
}
} else if (if_block) {
group_outros();
transition_out(if_block, 1, 1, () => {
if_block = null;
});
check_outros();
}
if (!current || dirty[0] & /*$theme*/ 64 && div1_class_value !== (div1_class_value = /*$theme*/ ctx[6].events)) {
attr(div1, "class", div1_class_value);
}
if (!current || dirty & /*$theme, isToday, highlight*/ 56 && div2_class_value !== (div2_class_value = "" + (/*$theme*/ ctx[5].day + (/*isToday*/ ctx[3] ? " " + /*$theme*/ ctx[5].today : "") + (/*highlight*/ ctx[4]
? " " + /*$theme*/ ctx[5].highlight
if (!current || dirty[0] & /*$theme, isToday, highlight*/ 112 && div2_class_value !== (div2_class_value = "" + (/*$theme*/ ctx[6].day + (/*isToday*/ ctx[4] ? " " + /*$theme*/ ctx[6].today : "") + (/*highlight*/ ctx[5]
? " " + /*$theme*/ ctx[6].highlight
: "")))) {

@@ -1190,2 +1300,3 @@ attr(div2, "class", div2_class_value);

transition_in(if_block);
current = true;

@@ -1206,2 +1317,3 @@ },

transition_out(if_block);
current = false;

@@ -1213,2 +1325,3 @@ },

destroy_each(each_blocks, detaching);
if (if_block) if_block.d();
mounted = false;

@@ -1223,51 +1336,65 @@ dispose();

let $_events;
let $_dragEvent;
let $highlightedDates;
let $dateClick;
let $slotDuration;
let $_view;
let $theme;
let $dateClick;
let { date } = $$props;
let { resource = undefined } = $$props;
let { _events, dateClick, highlightedDates, slotDuration, _view, theme } = getContext("state");
component_subscribe($$self, _events, value => $$invalidate(16, $_events = value));
component_subscribe($$self, dateClick, value => $$invalidate(18, $dateClick = value));
component_subscribe($$self, highlightedDates, value => $$invalidate(17, $highlightedDates = value));
component_subscribe($$self, slotDuration, value => $$invalidate(19, $slotDuration = value));
component_subscribe($$self, _view, value => $$invalidate(20, $_view = value));
component_subscribe($$self, theme, value => $$invalidate(5, $theme = value));
let { _events, _dragEvent, dateClick, highlightedDates, slotDuration, _view, theme } = getContext("state");
component_subscribe($$self, _events, value => $$invalidate(21, $_events = value));
component_subscribe($$self, _dragEvent, value => $$invalidate(22, $_dragEvent = value));
component_subscribe($$self, dateClick, value => $$invalidate(7, $dateClick = value));
component_subscribe($$self, highlightedDates, value => $$invalidate(23, $highlightedDates = value));
component_subscribe($$self, slotDuration, value => $$invalidate(24, $slotDuration = value));
component_subscribe($$self, _view, value => $$invalidate(25, $_view = value));
component_subscribe($$self, theme, value => $$invalidate(6, $theme = value));
let { _slotTimeLimits } = getContext("view-state");
component_subscribe($$self, _slotTimeLimits, value => $$invalidate(15, $_slotTimeLimits = value));
let chunks, bgChunks;
component_subscribe($$self, _slotTimeLimits, value => $$invalidate(20, $_slotTimeLimits = value));
let chunks, bgChunks, dragChunk;
let today = setMidnight(createDate()), isToday, highlight;
let start, end;
function handleClick(jsEvent) {
if (is_function($dateClick)) {
let rect = jsEvent.currentTarget.getBoundingClientRect();
let y = jsEvent.clientY - rect.top;
let d = addDuration(cloneDate(date), $slotDuration, Math.floor(y / 24 + $_slotTimeLimits.min.seconds / $slotDuration.seconds));
function createClickHandler(fn) {
return is_function(fn)
? jsEvent => {
let r = rect(jsEvent.currentTarget);
let y = jsEvent.clientY - r.top;
let d = addDuration(cloneDate(date), $slotDuration, Math.floor(y / 24 + $_slotTimeLimits.min.seconds / $slotDuration.seconds));
$dateClick({
date: toLocalDate(d),
jsEvent,
view: toViewWithLocalDates($_view),
resource
});
}
fn({
date: toLocalDate(d),
jsEvent,
view: toViewWithLocalDates($_view),
resource
});
}
: undefined;
}
function intersects(event) {
return event.start < end && event.end > start && (resource === undefined || event.resourceIds.includes(resource.id));
}
$$self.$$set = $$props => {
if ("date" in $$props) $$invalidate(0, date = $$props.date);
if ("resource" in $$props) $$invalidate(14, resource = $$props.resource);
if ("resource" in $$props) $$invalidate(17, resource = $$props.resource);
};
$$self.$$.update = () => {
if ($$self.$$.dirty & /*date, $_slotTimeLimits, $_events, resource, bgChunks, chunks*/ 114695) {
if ($$self.$$.dirty[0] & /*date, $_slotTimeLimits*/ 1048577) {
{
$$invalidate(18, start = addDuration(cloneDate(date), $_slotTimeLimits.min));
$$invalidate(19, end = addDuration(cloneDate(date), $_slotTimeLimits.max));
}
}
if ($$self.$$.dirty[0] & /*$_events, start, end, bgChunks, chunks*/ 2883590) {
{
$$invalidate(1, chunks = []);
$$invalidate(2, bgChunks = []);
let start = addDuration(cloneDate(date), $_slotTimeLimits.min);
let end = addDuration(cloneDate(date), $_slotTimeLimits.max);
for (let event of $_events) {
if (event.start < end && event.end > start && (resource === undefined || event.resourceIds.includes(resource.id))) {
if (intersects(event)) {
let chunk = createEventChunk(event, start, end);

@@ -1289,6 +1416,15 @@

if ($$self.$$.dirty & /*date, $highlightedDates*/ 131073) {
if ($$self.$$.dirty[0] & /*$_dragEvent, start, end*/ 4980736) {
// Drag & drop
if ($_dragEvent && intersects($_dragEvent)) {
$$invalidate(3, dragChunk = createEventChunk($_dragEvent, start, end));
} else {
$$invalidate(3, dragChunk = null);
}
}
if ($$self.$$.dirty[0] & /*date, $highlightedDates*/ 8388609) {
{
$$invalidate(3, isToday = datesEqual(date, today));
$$invalidate(4, highlight = $highlightedDates.some(d => datesEqual(d, date)));
$$invalidate(4, isToday = datesEqual(date, today));
$$invalidate(5, highlight = $highlightedDates.some(d => datesEqual(d, date)));
}

@@ -1302,6 +1438,9 @@ }

bgChunks,
dragChunk,
isToday,
highlight,
$theme,
$dateClick,
_events,
_dragEvent,
dateClick,

@@ -1313,6 +1452,9 @@ highlightedDates,

_slotTimeLimits,
handleClick,
createClickHandler,
resource,
start,
end,
$_slotTimeLimits,
$_events,
$_dragEvent,
$highlightedDates

@@ -1325,3 +1467,3 @@ ];

super();
init(this, options, instance$1, create_fragment$1, safe_not_equal, { date: 0, resource: 14 });
init(this, options, instance$1, create_fragment$1, safe_not_equal, { date: 0, resource: 17 }, [-1, -1]);
}

@@ -1619,8 +1761,8 @@ }

let $_intlDayHeader;
let { _viewDates, _intlDayHeader, theme } = getContext("state");
let state = getContext("state");
let { _viewDates, _intlDayHeader, theme } = state;
component_subscribe($$self, _viewDates, value => $$invalidate(0, $_viewDates = value));
component_subscribe($$self, _intlDayHeader, value => $$invalidate(2, $_intlDayHeader = value));
component_subscribe($$self, theme, value => $$invalidate(1, $theme = value));
let state = new State(getContext("state"));
setContext("view-state", state);
setContext("view-state", new State(state));
return [$_viewDates, $theme, $_intlDayHeader, _viewDates, _intlDayHeader, theme];

@@ -1627,0 +1769,0 @@ }

{
"name": "@event-calendar/time-grid",
"version": "0.0.1",
"title": "EventCalendar TimeGrid Plugin",
"version": "0.1.0-beta.1",
"title": "Event Calendar TimeGrid plugin",
"description": "Full-sized event calendar with resource view",

@@ -20,5 +20,5 @@ "keywords": ["calendar", "event", "resource", "full-sized"],

"dependencies": {
"@event-calendar/common": "~0.0.1",
"@event-calendar/common": "~0.1.0-beta.1",
"svelte": "^3.35.0"
}
}
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