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

@event-calendar/common

Package Overview
Dependencies
Maintainers
1
Versions
63
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@event-calendar/common - npm Package Compare versions

Comparing version 0.0.1-alpha.2 to 0.0.1-alpha.3

98

index.js
import { is_function } from 'svelte/internal';
import { writable, derived, get } from 'svelte/store';

@@ -120,7 +121,11 @@ const DAY_IN_SECONDS = 86400;

function nextClosestDay(date, day) {
return _closestDay(date, day, addDay);
let diff = day - date.getDay();
date.setDate(date.getDate() + (diff >= 0 ? diff : diff + 7));
return date;
}
function prevClosestDay(date, day) {
return _closestDay(date, day, subtractDay);
let diff = day - date.getDay();
date.setDate(date.getDate() + (diff <= 0 ? diff : diff - 7));
return date;
}

@@ -155,12 +160,2 @@

function _closestDay(date, day, fn) {
let max = 7;
while (date.getDay() !== day && max) {
fn(date);
--max;
}
return date;
}
function _pad(num) {

@@ -258,3 +253,3 @@ let norm = Math.floor(Math.abs(num));

function createEventContent(chunk, displayEventEnd, eventContent, theme, _intlEventTime, _view) {
function createEventContent(chunk, displayEventEnd, eventContent, theme, _intlEventTime, _view, withDot, dotColor) {
let timeText = _intlEventTime.format(chunk.start), content;

@@ -282,6 +277,6 @@ if (displayEventEnd) {

content = {
html: `<div class="${theme.eventContent}">` +
`<div class="${theme.eventTime}">${timeText}</div>` +
`<div class="${theme.eventTitle}">${chunk.event.title}</div>` +
`</div>`
html: `<div class="${theme.eventTime}">${timeText}</div>` +
// ie11 needs nested div
(withDot ? `<div><div class="${theme.eventDot}"${dotColor ? ` style="border-color:${dotColor}"` : ''}></div></div>` : '') +
`<div class="${theme.eventTitle}">${chunk.event.title}</div>`
};

@@ -294,2 +289,49 @@ }

function writable2(value, mutator, start) {
return {
...writable(mutator ? mutator(value) : value, start),
mutate: mutator
};
}
function derived2(stores, fn, initValue) {
let storeValue = initValue;
let hasSubscribers = false;
let auto = fn.length < 2;
let fn2 = (_, set) => {
hasSubscribers = true;
if (auto) {
storeValue = fn(_, set);
set(storeValue);
} else {
fn(_, value => {storeValue = value; set(value);});
}
return () => {hasSubscribers = false;};
};
let store = derived(stores, fn2, storeValue);
return {
...store,
get: () => hasSubscribers ? storeValue : get(store)
};
}
function intl(locale, format) {
return derived([locale, format], ([$locale, $format]) => is_function($format)
? {format: $format}
: new Intl.DateTimeFormat($locale, $format)
);
}
function intlRange(locale, format) {
return derived([locale, format], ([$locale, $format]) => {
if (is_function($format)) {
return {format: $format};
}
let intl = new Intl.DateTimeFormat($locale, $format);
return {
format: (start, end) => formatRange(start, end, intl)
};
});
}
function assign(...args) {

@@ -304,2 +346,22 @@ return Object.assign(...args);

function action(node, content) {
let actions = {
update(content) {
while (node.firstChild) {
node.removeChild(node.lastChild);
}
if (content.domNodes) {
for (let child of content.domNodes) {
node.appendChild(child);
}
} else if (content.html) {
node.innerHTML = content.html;
}
}
};
actions.update(content);
return actions;
}
function createView(view, _viewTitle, _currentRange, _activeRange) {

@@ -317,2 +379,2 @@ return {

export { DAY_IN_SECONDS, addDay, addDuration, assign, cloneDate, createDate, createDuration, createEventChunk, createEventContent, createEventSources, createEvents, createView, datesEqual, formatRange, hasYScroll, nextClosestDay, prevClosestDay, setMidnight, sortEventChunks, subtractDay, subtractDuration, toISOString };
export { DAY_IN_SECONDS, action, addDay, addDuration, assign, cloneDate, createDate, createDuration, createEventChunk, createEventContent, createEventSources, createEvents, createView, datesEqual, derived2, formatRange, hasYScroll, intl, intlRange, nextClosestDay, prevClosestDay, setMidnight, sortEventChunks, subtractDay, subtractDuration, toISOString, writable2 };

4

package.json
{
"name": "@event-calendar/common",
"version": "0.0.1-alpha.2",
"version": "0.0.1-alpha.3",
"type": "module",

@@ -10,4 +10,4 @@ "exports": {

"dependencies": {
"svelte": "^3.24.1"
"svelte": "^3.25.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