Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
de8eab9022 | ||
|
|
3e695d6699 | ||
|
|
bc81e8403d |
+25
-10
@@ -4,7 +4,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.MMM-NextcloudCookbook .ncc-active {
|
.MMM-NextcloudCookbook .ncc-active {
|
||||||
--ncc-type-scale: 1;
|
--ncc-content-scale: 1;
|
||||||
|
|
||||||
position: fixed;
|
position: fixed;
|
||||||
inset: 0;
|
inset: 0;
|
||||||
@@ -54,19 +54,26 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.MMM-NextcloudCookbook .ncc-recipe h1 {
|
.MMM-NextcloudCookbook .ncc-recipe h1 {
|
||||||
margin: 0 0 calc(26px * var(--ncc-type-scale));
|
margin: 0 0 26px;
|
||||||
color: #fff6d8;
|
color: #fff6d8;
|
||||||
font-size: calc(82px * var(--ncc-type-scale));
|
font-size: 82px;
|
||||||
line-height: 1.08;
|
line-height: 1.08;
|
||||||
}
|
}
|
||||||
|
|
||||||
.MMM-NextcloudCookbook .ncc-meta {
|
.MMM-NextcloudCookbook .ncc-meta {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-wrap: wrap;
|
flex-wrap: wrap;
|
||||||
gap: 10px 22px;
|
gap: 10px 24px;
|
||||||
align-items: baseline;
|
align-items: baseline;
|
||||||
margin: 0 0 calc(36px * var(--ncc-type-scale));
|
margin: 0 0 36px;
|
||||||
font-size: calc(36px * var(--ncc-type-scale));
|
font-size: 36px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.MMM-NextcloudCookbook .ncc-meta-item {
|
||||||
|
display: inline-flex;
|
||||||
|
gap: 8px;
|
||||||
|
align-items: baseline;
|
||||||
|
white-space: nowrap;
|
||||||
}
|
}
|
||||||
|
|
||||||
.MMM-NextcloudCookbook .ncc-meta dt {
|
.MMM-NextcloudCookbook .ncc-meta dt {
|
||||||
@@ -79,27 +86,35 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.MMM-NextcloudCookbook .ncc-columns {
|
.MMM-NextcloudCookbook .ncc-columns {
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
|
||||||
|
.MMM-NextcloudCookbook .ncc-layout-stacked section:first-child {
|
||||||
|
margin-bottom: calc(42px * var(--ncc-content-scale));
|
||||||
|
}
|
||||||
|
|
||||||
|
.MMM-NextcloudCookbook .ncc-layout-side-by-side {
|
||||||
display: grid;
|
display: grid;
|
||||||
grid-template-columns: minmax(260px, 0.8fr) minmax(400px, 1.4fr);
|
grid-template-columns: minmax(260px, 0.8fr) minmax(400px, 1.4fr);
|
||||||
gap: 42px;
|
gap: 42px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.MMM-NextcloudCookbook .ncc-columns h2 {
|
.MMM-NextcloudCookbook .ncc-columns h2 {
|
||||||
margin: 0 0 calc(18px * var(--ncc-type-scale));
|
margin: 0 0 calc(18px * var(--ncc-content-scale));
|
||||||
color: #d6b96b;
|
color: #d6b96b;
|
||||||
font-size: calc(56px * var(--ncc-type-scale));
|
font-size: calc(56px * var(--ncc-content-scale));
|
||||||
}
|
}
|
||||||
|
|
||||||
.MMM-NextcloudCookbook .ncc-columns ul,
|
.MMM-NextcloudCookbook .ncc-columns ul,
|
||||||
.MMM-NextcloudCookbook .ncc-columns ol {
|
.MMM-NextcloudCookbook .ncc-columns ol {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
padding-left: 1.25em;
|
padding-left: 1.25em;
|
||||||
font-size: calc(50px * var(--ncc-type-scale));
|
font-size: calc(50px * var(--ncc-content-scale));
|
||||||
line-height: 1.36;
|
line-height: 1.36;
|
||||||
}
|
}
|
||||||
|
|
||||||
.MMM-NextcloudCookbook .ncc-columns li {
|
.MMM-NextcloudCookbook .ncc-columns li {
|
||||||
margin-bottom: calc(18px * var(--ncc-type-scale));
|
margin-bottom: calc(18px * var(--ncc-content-scale));
|
||||||
}
|
}
|
||||||
|
|
||||||
.MMM-NextcloudCookbook .ncc-error {
|
.MMM-NextcloudCookbook .ncc-error {
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ Module.register("MMM-NextcloudCookbook", {
|
|||||||
controlPath: "/MMM-NextcloudCookbook/control",
|
controlPath: "/MMM-NextcloudCookbook/control",
|
||||||
controlUrl: "",
|
controlUrl: "",
|
||||||
animationSpeed: 400,
|
animationSpeed: 400,
|
||||||
|
layout: "stacked",
|
||||||
shareUrl: "",
|
shareUrl: "",
|
||||||
sharePassword: ""
|
sharePassword: ""
|
||||||
},
|
},
|
||||||
@@ -57,7 +58,7 @@ Module.register("MMM-NextcloudCookbook", {
|
|||||||
|
|
||||||
for (let attempt = 0; attempt < 12; attempt++) {
|
for (let attempt = 0; attempt < 12; attempt++) {
|
||||||
const scale = (minimum + maximum) / 2;
|
const scale = (minimum + maximum) / 2;
|
||||||
root.style.setProperty("--ncc-type-scale", scale);
|
root.style.setProperty("--ncc-content-scale", scale);
|
||||||
const fits = recipe.scrollHeight <= availableHeight
|
const fits = recipe.scrollHeight <= availableHeight
|
||||||
&& recipe.scrollWidth <= availableWidth;
|
&& recipe.scrollWidth <= availableWidth;
|
||||||
if (fits) {
|
if (fits) {
|
||||||
@@ -67,7 +68,7 @@ Module.register("MMM-NextcloudCookbook", {
|
|||||||
maximum = scale;
|
maximum = scale;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
root.style.setProperty("--ncc-type-scale", best.toFixed(3));
|
root.style.setProperty("--ncc-content-scale", best.toFixed(3));
|
||||||
},
|
},
|
||||||
|
|
||||||
setRecipeMode(active) {
|
setRecipeMode(active) {
|
||||||
@@ -145,18 +146,22 @@ Module.register("MMM-NextcloudCookbook", {
|
|||||||
const list = document.createElement("dl");
|
const list = document.createElement("dl");
|
||||||
list.className = "ncc-meta";
|
list.className = "ncc-meta";
|
||||||
metadata.forEach(([label, value]) => {
|
metadata.forEach(([label, value]) => {
|
||||||
|
const pair = document.createElement("div");
|
||||||
|
pair.className = "ncc-meta-item";
|
||||||
const term = document.createElement("dt");
|
const term = document.createElement("dt");
|
||||||
term.textContent = label;
|
term.textContent = label;
|
||||||
const detail = document.createElement("dd");
|
const detail = document.createElement("dd");
|
||||||
detail.textContent = value;
|
detail.textContent = value;
|
||||||
list.append(term, detail);
|
pair.append(term, detail);
|
||||||
|
list.appendChild(pair);
|
||||||
});
|
});
|
||||||
header.appendChild(list);
|
header.appendChild(list);
|
||||||
}
|
}
|
||||||
article.appendChild(header);
|
article.appendChild(header);
|
||||||
|
|
||||||
const columns = document.createElement("div");
|
const columns = document.createElement("div");
|
||||||
columns.className = "ncc-columns";
|
const layout = this.config.layout === "side-by-side" ? "side-by-side" : "stacked";
|
||||||
|
columns.className = `ncc-columns ncc-layout-${layout}`;
|
||||||
|
|
||||||
const ingredients = document.createElement("section");
|
const ingredients = document.createElement("section");
|
||||||
const ingredientsTitle = document.createElement("h2");
|
const ingredientsTitle = document.createElement("h2");
|
||||||
|
|||||||
@@ -16,11 +16,20 @@ link; it should look like `https://cloud.example.test/s/SHARE_TOKEN`.
|
|||||||
position: "bottom_right",
|
position: "bottom_right",
|
||||||
config: {
|
config: {
|
||||||
shareUrl: "https://cloud.example.test/s/SHARE_TOKEN",
|
shareUrl: "https://cloud.example.test/s/SHARE_TOKEN",
|
||||||
controlUrl: "http://mirror.example.test:8080/MMM-NextcloudCookbook/control"
|
controlUrl: "http://mirror.example.test:8080/MMM-NextcloudCookbook/control",
|
||||||
|
layout: "stacked"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
`layout` controls the full-screen recipe arrangement. Its default value,
|
||||||
|
`"stacked"`, displays the ingredients above the instructions. Set it to
|
||||||
|
`"side-by-side"` to display ingredients and instructions in two columns. Both
|
||||||
|
layouts automatically scale the ingredient and instruction sections to make
|
||||||
|
the best use of the available screen while keeping all recipe content visible.
|
||||||
|
The recipe title, timing metadata, yield, and QR controller remain at fixed
|
||||||
|
sizes.
|
||||||
|
|
||||||
The configured `position` controls where the QR controller appears during the
|
The configured `position` controls where the QR controller appears during the
|
||||||
normal MagicMirror layout. When a recipe is activated, the module displays a
|
normal MagicMirror layout. When a recipe is activated, the module displays a
|
||||||
fixed full-screen overlay regardless of that region. Exiting recipe mode
|
fixed full-screen overlay regardless of that region. Exiting recipe mode
|
||||||
|
|||||||
Generated
+2
-2
@@ -1,12 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "mmm-nextcloud-cookbook",
|
"name": "mmm-nextcloud-cookbook",
|
||||||
"version": "0.1.2",
|
"version": "0.2.2",
|
||||||
"lockfileVersion": 3,
|
"lockfileVersion": 3,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "mmm-nextcloud-cookbook",
|
"name": "mmm-nextcloud-cookbook",
|
||||||
"version": "0.1.2",
|
"version": "0.2.2",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"fast-xml-parser": "5.10.1",
|
"fast-xml-parser": "5.10.1",
|
||||||
"qrcode": "1.5.4"
|
"qrcode": "1.5.4"
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "mmm-nextcloud-cookbook",
|
"name": "mmm-nextcloud-cookbook",
|
||||||
"version": "0.1.2",
|
"version": "0.2.2",
|
||||||
"private": true,
|
"private": true,
|
||||||
"description": "Display recipes from a Nextcloud Cookbook share on MagicMirror",
|
"description": "Display recipes from a Nextcloud Cookbook share on MagicMirror",
|
||||||
"main": "node_helper.js",
|
"main": "node_helper.js",
|
||||||
|
|||||||
Reference in New Issue
Block a user