update
This commit is contained in:
45
.obsidian/plugins/heatmap-calendar/main.js
vendored
45
.obsidian/plugins/heatmap-calendar/main.js
vendored
@@ -179,10 +179,26 @@ var HeatmapCalendarSettingsTab = class extends import_obsidian.PluginSettingTab
|
||||
return false;
|
||||
}
|
||||
}
|
||||
displayWeekStartDaySettings() {
|
||||
const { containerEl } = this;
|
||||
new import_obsidian.Setting(containerEl).setName("Week Start Day").setDesc("Select the day on which your week starts.").addDropdown((dropdown) => dropdown.addOptions({
|
||||
0: "Sunday",
|
||||
1: "Monday",
|
||||
2: "Tuesday",
|
||||
3: "Wednesday",
|
||||
4: "Thursday",
|
||||
5: "Friday",
|
||||
6: "Saturday"
|
||||
}).setValue(this.plugin.settings.weekStartDay.toString()).onChange((value) => __async(this, null, function* () {
|
||||
this.plugin.settings.weekStartDay = +value;
|
||||
yield this.plugin.saveSettings();
|
||||
})));
|
||||
}
|
||||
display() {
|
||||
const { containerEl } = this;
|
||||
containerEl.empty();
|
||||
containerEl.createEl("h2", { text: "Heatmap Calendar Settings" });
|
||||
this.displayWeekStartDaySettings();
|
||||
this.displayColorSettings();
|
||||
console.log("settings", this.plugin.settings);
|
||||
}
|
||||
@@ -198,7 +214,8 @@ var DEFAULT_SETTINGS = {
|
||||
showCurrentDayBorder: true,
|
||||
defaultEntryIntensity: 4,
|
||||
intensityScaleStart: 1,
|
||||
intensityScaleEnd: 5
|
||||
intensityScaleEnd: 5,
|
||||
weekStartDay: 1
|
||||
};
|
||||
var HeatmapCalendar = class extends import_obsidian2.Plugin {
|
||||
getHowManyDaysIntoYear(date) {
|
||||
@@ -219,12 +236,15 @@ var HeatmapCalendar = class extends import_obsidian2.Plugin {
|
||||
const mapped = (current - inMin) * (outMax - outMin) / (inMax - inMin) + outMin;
|
||||
return this.clamp(mapped, outMin, outMax);
|
||||
}
|
||||
getWeekdayShort(dayNumber) {
|
||||
return new Date(1970, 0, dayNumber + this.settings.weekStartDay + 4).toLocaleDateString("en-US", { weekday: "short" });
|
||||
}
|
||||
onload() {
|
||||
return __async(this, null, function* () {
|
||||
yield this.loadSettings();
|
||||
this.addSettingTab(new HeatmapCalendarSettingsTab(this.app, this));
|
||||
window.renderHeatmapCalendar = (el, calendarData) => {
|
||||
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
||||
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k;
|
||||
const year = (_a = calendarData.year) != null ? _a : this.settings.year;
|
||||
const colors = typeof calendarData.colors === "string" ? this.settings.colors[calendarData.colors] ? { [calendarData.colors]: this.settings.colors[calendarData.colors] } : this.settings.colors : (_b = calendarData.colors) != null ? _b : this.settings.colors;
|
||||
this.removeHtmlElementsNotInYear(calendarData.entries, year);
|
||||
@@ -251,7 +271,7 @@ var HeatmapCalendar = class extends import_obsidian2.Plugin {
|
||||
mappedEntries[this.getHowManyDaysIntoYear(new Date(e.date))] = newEntry;
|
||||
});
|
||||
const firstDayOfYear = new Date(Date.UTC(year, 0, 1));
|
||||
let numberOfEmptyDaysBeforeYearBegins = (firstDayOfYear.getUTCDay() + 6) % 7;
|
||||
let numberOfEmptyDaysBeforeYearBegins = (firstDayOfYear.getUTCDay() + 7 - this.settings.weekStartDay) % 7;
|
||||
const boxes = [];
|
||||
while (numberOfEmptyDaysBeforeYearBegins) {
|
||||
boxes.push({ backgroundColor: "transparent" });
|
||||
@@ -264,10 +284,13 @@ var HeatmapCalendar = class extends import_obsidian2.Plugin {
|
||||
const box = {
|
||||
classNames: []
|
||||
};
|
||||
const currentDate = new Date(year, 0, day);
|
||||
const month = currentDate.toLocaleString("en-us", { month: "short" });
|
||||
(_h = box.classNames) == null ? void 0 : _h.push(`month-${month.toLowerCase()}`);
|
||||
if (day === todaysDayNumberLocal && showCurrentDayBorder)
|
||||
(_h = box.classNames) == null ? void 0 : _h.push("today");
|
||||
(_i = box.classNames) == null ? void 0 : _i.push("today");
|
||||
if (mappedEntries[day]) {
|
||||
(_i = box.classNames) == null ? void 0 : _i.push("hasData");
|
||||
(_j = box.classNames) == null ? void 0 : _j.push("hasData");
|
||||
const entry = mappedEntries[day];
|
||||
box.date = entry.date;
|
||||
if (entry.content)
|
||||
@@ -275,7 +298,7 @@ var HeatmapCalendar = class extends import_obsidian2.Plugin {
|
||||
const currentDayColors = entry.color ? colors[entry.color] : colors[Object.keys(colors)[0]];
|
||||
box.backgroundColor = currentDayColors[entry.intensity - 1];
|
||||
} else
|
||||
(_j = box.classNames) == null ? void 0 : _j.push("isEmpty");
|
||||
(_k = box.classNames) == null ? void 0 : _k.push("isEmpty");
|
||||
boxes.push(box);
|
||||
}
|
||||
const heatmapCalendarGraphDiv = createDiv({
|
||||
@@ -307,13 +330,9 @@ var HeatmapCalendar = class extends import_obsidian2.Plugin {
|
||||
cls: "heatmap-calendar-days",
|
||||
parent: heatmapCalendarGraphDiv
|
||||
});
|
||||
createEl("li", { text: "Mon", parent: heatmapCalendarDaysUl });
|
||||
createEl("li", { text: "Tue", parent: heatmapCalendarDaysUl });
|
||||
createEl("li", { text: "Wed", parent: heatmapCalendarDaysUl });
|
||||
createEl("li", { text: "Thu", parent: heatmapCalendarDaysUl });
|
||||
createEl("li", { text: "Fri", parent: heatmapCalendarDaysUl });
|
||||
createEl("li", { text: "Sat", parent: heatmapCalendarDaysUl });
|
||||
createEl("li", { text: "Sun", parent: heatmapCalendarDaysUl });
|
||||
for (let i = 0; i < 7; i++) {
|
||||
createEl("li", { text: this.getWeekdayShort(i), parent: heatmapCalendarDaysUl });
|
||||
}
|
||||
const heatmapCalendarBoxesUl = createEl("ul", {
|
||||
cls: "heatmap-calendar-boxes",
|
||||
parent: heatmapCalendarGraphDiv
|
||||
|
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"id": "heatmap-calendar",
|
||||
"name": "Heatmap Calendar",
|
||||
"version": "0.6.0",
|
||||
"version": "0.7.0",
|
||||
"minAppVersion": "0.12.0",
|
||||
"description": "Activity Year Overview for DataviewJS, Github style – Track Goals, Progress, Habits, Tasks, Exercise, Finances, \"Dont Break the Chain\" etc.",
|
||||
"author": "Richard Slettevoll",
|
||||
|
303
.obsidian/plugins/heatmap-calendar/styles.css
vendored
303
.obsidian/plugins/heatmap-calendar/styles.css
vendored
@@ -1,132 +1,171 @@
|
||||
/* Obsidian/DataviewJS Github inspired calendar by Richard Slettevoll - https://richard.sl/ */
|
||||
|
||||
.heatmap-calendar-graph>* {
|
||||
padding: 0px;
|
||||
margin: 0px;
|
||||
list-style: none;
|
||||
}
|
||||
|
||||
.heatmap-calendar-graph {
|
||||
font-size: 0.65em;
|
||||
display: grid;
|
||||
grid-template-columns: auto 1fr;
|
||||
grid-template-areas:
|
||||
'year months'
|
||||
'days boxes';
|
||||
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica,
|
||||
Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji',
|
||||
'Segoe UI Symbol';
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.heatmap-calendar-months {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(12, minmax(0, 1fr));
|
||||
grid-area: months;
|
||||
margin-top: 0.1em;
|
||||
margin-bottom: 0.3em;
|
||||
grid-gap: 0.3em;
|
||||
}
|
||||
|
||||
.heatmap-calendar-days {
|
||||
grid-area: days;
|
||||
margin-left: 0.1em;
|
||||
margin-right: 0.3em;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.heatmap-calendar-boxes {
|
||||
grid-auto-flow: column;
|
||||
grid-template-columns: repeat(53, minmax(0, 1fr));
|
||||
grid-area: boxes;
|
||||
}
|
||||
|
||||
.heatmap-calendar-days,
|
||||
.heatmap-calendar-boxes {
|
||||
display: grid;
|
||||
grid-gap: 0.3em;
|
||||
grid-template-rows: repeat(7, minmax(0, 1fr));
|
||||
}
|
||||
|
||||
.heatmap-calendar-year {
|
||||
grid-area: year;
|
||||
font-weight: bold;
|
||||
font-size: 1.2em;
|
||||
}
|
||||
|
||||
/* only label three days of the week */
|
||||
.heatmap-calendar-days li:nth-child(odd) {
|
||||
visibility: hidden;
|
||||
}
|
||||
|
||||
.heatmap-calendar-boxes li {
|
||||
position: relative;
|
||||
font-size: 0.75em;
|
||||
background-color: #ebedf0;
|
||||
}
|
||||
|
||||
.theme-dark .heatmap-calendar-boxes .isEmpty {
|
||||
background: #333;
|
||||
}
|
||||
|
||||
.heatmap-calendar-boxes li:not(.task-list-item)::before {
|
||||
content: unset;
|
||||
}
|
||||
|
||||
.heatmap-calendar-boxes .internal-link {
|
||||
text-decoration: none;
|
||||
position: absolute;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.heatmap-calendar-boxes .today {
|
||||
border: solid 1px rgb(61, 61, 61);
|
||||
}
|
||||
|
||||
/* Settings */
|
||||
|
||||
.heatmap-calendar-settings-colors__color-box {
|
||||
width: 10px;
|
||||
height: 10px;
|
||||
display: inline-block;
|
||||
margin: 0 5px;
|
||||
}
|
||||
|
||||
.heatmap-calendar-settings-colors__color-box:first-child {
|
||||
margin-left: 0;
|
||||
}
|
||||
|
||||
.heatmap-calendar-settings-colors__color-name {
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
.heatmap-calendar-settings-colors__container {
|
||||
align-items: center;
|
||||
border-top: 1px solid var(--background-modifier-border);
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
padding: 0.5em 0;
|
||||
}
|
||||
|
||||
.heatmap-calendar-settings-colors__container h4 {
|
||||
margin: 0.5em 0;
|
||||
}
|
||||
|
||||
.heatmap-calendar-settings-colors__new-color-input-container {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
.heatmap-calendar-settings-colors__new-color-input-container input {
|
||||
margin-right: 1em;
|
||||
}
|
||||
|
||||
.heatmap-calendar-settings-colors__new-color-input-container input {
|
||||
margin-right: 1em;
|
||||
}
|
||||
|
||||
.heatmap-calendar-settings-colors__new-color-input-value {
|
||||
flex-grow: 1;
|
||||
}
|
||||
/* Obsidian/DataviewJS Github inspired calendar by Richard Slettevoll - https://richard.sl/ */
|
||||
|
||||
.heatmap-calendar-graph>* {
|
||||
padding: 0px;
|
||||
margin: 0px;
|
||||
list-style: none;
|
||||
}
|
||||
|
||||
.heatmap-calendar-graph {
|
||||
font-size: 0.65em;
|
||||
display: grid;
|
||||
grid-template-columns: auto 1fr;
|
||||
grid-template-areas:
|
||||
'year months'
|
||||
'days boxes';
|
||||
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica,
|
||||
Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji',
|
||||
'Segoe UI Symbol';
|
||||
width: 100%;
|
||||
padding: 5px; /* 0px caused overflow and scrollbars */
|
||||
}
|
||||
|
||||
.heatmap-calendar-graph ul {
|
||||
padding-inline-start: 0;
|
||||
margin-block-start: 0;
|
||||
margin-block-end: 0;
|
||||
}
|
||||
|
||||
.heatmap-calendar-months {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(12, minmax(0, 1fr));
|
||||
grid-area: months;
|
||||
margin-top: 0.1em;
|
||||
margin-bottom: 0.3em;
|
||||
grid-gap: 0.3em;
|
||||
}
|
||||
|
||||
.heatmap-calendar-days {
|
||||
grid-area: days;
|
||||
margin-left: 0.1em;
|
||||
margin-right: 0.3em;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.heatmap-calendar-boxes {
|
||||
grid-auto-flow: column;
|
||||
grid-template-columns: repeat(53, minmax(0, 1fr));
|
||||
grid-area: boxes;
|
||||
}
|
||||
|
||||
.heatmap-calendar-days,
|
||||
.heatmap-calendar-boxes {
|
||||
display: grid;
|
||||
grid-gap: 0.3em;
|
||||
grid-template-rows: repeat(7, minmax(0, 1fr));
|
||||
}
|
||||
|
||||
.heatmap-calendar-year {
|
||||
grid-area: year;
|
||||
font-weight: bold;
|
||||
font-size: 1.2em;
|
||||
}
|
||||
|
||||
/* only label three days of the week */
|
||||
.heatmap-calendar-days li:nth-child(odd) {
|
||||
visibility: hidden;
|
||||
}
|
||||
|
||||
.heatmap-calendar-boxes li {
|
||||
position: relative;
|
||||
font-size: 0.75em;
|
||||
background-color: #ebedf0;
|
||||
}
|
||||
|
||||
.theme-dark .heatmap-calendar-boxes .isEmpty {
|
||||
background: #333;
|
||||
}
|
||||
|
||||
.heatmap-calendar-boxes li:not(.task-list-item)::before {
|
||||
content: unset;
|
||||
}
|
||||
|
||||
.heatmap-calendar-boxes .internal-link {
|
||||
text-decoration: none;
|
||||
position: absolute;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.heatmap-calendar-boxes .today {
|
||||
border: solid 1px rgb(61, 61, 61);
|
||||
}
|
||||
|
||||
/* Settings */
|
||||
|
||||
.heatmap-calendar-settings-colors__color-box {
|
||||
width: 10px;
|
||||
height: 10px;
|
||||
display: inline-block;
|
||||
margin: 0 5px;
|
||||
}
|
||||
|
||||
.heatmap-calendar-settings-colors__color-box:first-child {
|
||||
margin-left: 0;
|
||||
}
|
||||
|
||||
.heatmap-calendar-settings-colors__color-name {
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
.heatmap-calendar-settings-colors__container {
|
||||
align-items: center;
|
||||
border-top: 1px solid var(--background-modifier-border);
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
padding: 0.5em 0;
|
||||
}
|
||||
|
||||
.heatmap-calendar-settings-colors__container h4 {
|
||||
margin: 0.5em 0;
|
||||
}
|
||||
|
||||
.heatmap-calendar-settings-colors__new-color-input-container {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
.heatmap-calendar-settings-colors__new-color-input-container input {
|
||||
margin-right: 1em;
|
||||
}
|
||||
|
||||
.heatmap-calendar-settings-colors__new-color-input-container input {
|
||||
margin-right: 1em;
|
||||
}
|
||||
|
||||
.heatmap-calendar-settings-colors__new-color-input-value {
|
||||
flex-grow: 1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/* ----
|
||||
/* ---- DEV Only ---- */
|
||||
/* ----
|
||||
|
||||
/* for putting the settings window off to the side whilst taking screenshots */
|
||||
/*
|
||||
.modal-container {
|
||||
justify-content: left !important;
|
||||
padding-left: 20px !important;
|
||||
}
|
||||
.modal-bg {
|
||||
opacity: 0% !important;
|
||||
}
|
||||
.modal-container.mod-dim .modal {
|
||||
box-shadow: var(--shadow-s) !important;
|
||||
}
|
||||
.modal.mod-sidebar-layout {
|
||||
width: 700px !important;
|
||||
}
|
||||
.vertical-tab-content::-webkit-scrollbar {
|
||||
display: none;
|
||||
}
|
||||
*/
|
||||
|
||||
/* ----
|
||||
/* ---- DEV Only /END ---- */
|
||||
/* ----
|
Reference in New Issue
Block a user