@nomideusz/svelte-calendar 1.6.0 → 1.7.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.
- package/README.md +2 -0
- package/package.json +1 -1
- package/widget/widget.js +25 -1
package/README.md
CHANGED
|
@@ -1064,6 +1064,8 @@ The widget renders inside shadow DOM: host-page CSS cannot affect the calendar a
|
|
|
1064
1064
|
| `compact` | `false` | `"true"` for compact agenda rows |
|
|
1065
1065
|
| `timezone` | viewer's zone | IANA zone, e.g. `Europe/Warsaw` (read when the element mounts) |
|
|
1066
1066
|
| `mincolumnwidth` | `110` | Minimum day-column width in px for the week grid; a container narrower than the days need scrolls sideways |
|
|
1067
|
+
| `hours` | `0-24` | Visible hours of the time grids, `"start-end"` in whole hours (e.g. `"6-22"`) |
|
|
1068
|
+
| `labels` | — | UI words as a JSON object over the English defaults, e.g. `'{"today":"Dziś","week":"Tydzień"}'` (keys: `CalendarLabels`) |
|
|
1067
1069
|
|
|
1068
1070
|
Each event in `api` responses and `events` needs `start` and `end` as date strings (ISO 8601) and may carry `id`, `title`, `color`, `allDay`, `subtitle` and `location`; other fields are ignored, as are events with an invalid or empty range. Changing an attribute updates the calendar in place.
|
|
1069
1071
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nomideusz/svelte-calendar",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.7.0",
|
|
4
4
|
"description": "A themeable Svelte 5 calendar: day, week, scrolling-week and month views, agenda lists, touch-first mobile layouts, drag-and-drop, timezones, a headless API and an embeddable web component.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": [
|
package/widget/widget.js
CHANGED
|
@@ -20754,6 +20754,8 @@ createHTML: (html) => {
|
|
|
20754
20754
|
/** Compact agenda rendering: "true" */
|
|
20755
20755
|
/** IANA timezone, e.g. "Europe/Warsaw" */
|
|
20756
20756
|
/** Minimum day-column width in px for the week grid (default: 110) — a narrower container scrolls sideways */
|
|
20757
|
+
/** Visible hours of the time grids, "start-end" in whole hours (e.g. "6-22") */
|
|
20758
|
+
/** UI words as a JSON object over the English defaults, e.g. '{"today":"Dziś"}' */
|
|
20757
20759
|
let theme = prop($$props, "theme", 3, "auto"), view = prop($$props, "view", 3, "week-planner"), height = prop($$props, "height", 3, "600"), mondaystart = prop($$props, "mondaystart", 3, "true");
|
|
20758
20760
|
const heightValue = /* @__PURE__ */ user_derived(() => {
|
|
20759
20761
|
const trimmed = height().trim();
|
|
@@ -20776,6 +20778,20 @@ createHTML: (html) => {
|
|
|
20776
20778
|
const n = parseInt($$props.mincolumnwidth, 10);
|
|
20777
20779
|
return Number.isNaN(n) || n < 0 ? void 0 : n;
|
|
20778
20780
|
});
|
|
20781
|
+
const hoursValue = /* @__PURE__ */ user_derived(() => {
|
|
20782
|
+
const m = $$props.hours?.trim().match(/^(\d{1,2})\s*-\s*(\d{1,2})$/);
|
|
20783
|
+
if (!m) return void 0;
|
|
20784
|
+
const [from, to] = [Number(m[1]), Number(m[2])];
|
|
20785
|
+
return from < to && to <= 24 ? [from, to] : void 0;
|
|
20786
|
+
});
|
|
20787
|
+
const labelsValue = /* @__PURE__ */ user_derived(() => {
|
|
20788
|
+
if (!$$props.labels) return void 0;
|
|
20789
|
+
try {
|
|
20790
|
+
const parsed = JSON.parse($$props.labels);
|
|
20791
|
+
if (parsed && typeof parsed === "object" && !Array.isArray(parsed)) return parsed;
|
|
20792
|
+
} catch {}
|
|
20793
|
+
console.warn("[day-calendar] Failed to parse labels JSON:", $$props.labels);
|
|
20794
|
+
});
|
|
20779
20795
|
function parseHeaders(json) {
|
|
20780
20796
|
if (!json) return void 0;
|
|
20781
20797
|
try {
|
|
@@ -20892,6 +20908,12 @@ createHTML: (html) => {
|
|
|
20892
20908
|
},
|
|
20893
20909
|
get minColumnWidth() {
|
|
20894
20910
|
return get(minColumnWidthValue);
|
|
20911
|
+
},
|
|
20912
|
+
get visibleHours() {
|
|
20913
|
+
return get(hoursValue);
|
|
20914
|
+
},
|
|
20915
|
+
get labels() {
|
|
20916
|
+
return get(labelsValue);
|
|
20895
20917
|
}
|
|
20896
20918
|
});
|
|
20897
20919
|
}
|
|
@@ -20954,7 +20976,9 @@ createHTML: (html) => {
|
|
|
20954
20976
|
"days",
|
|
20955
20977
|
"compact",
|
|
20956
20978
|
"timezone",
|
|
20957
|
-
"mincolumnwidth"
|
|
20979
|
+
"mincolumnwidth",
|
|
20980
|
+
"hours",
|
|
20981
|
+
"labels"
|
|
20958
20982
|
];
|
|
20959
20983
|
/**
|
|
20960
20984
|
* Attribute values as reactive props for `mount()`. A plain .ts module has
|