@gurpinderjitsingh/recipe-ui 0.9.0 → 0.11.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/dist/cjs/app-modal_7.cjs.entry.js +3 -3
- package/dist/collection/components/meal-plan-day/meal-plan-day.js +1 -1
- package/dist/collection/components/recipe-card/recipe-card.css +4 -4
- package/dist/collection/components/recipe-form/recipe-form.css +1 -1
- package/dist/components/index.js +1 -1
- package/dist/components/meal-plan-day.js +1 -1
- package/dist/components/p-B37vIJ1j.js +1 -0
- package/dist/components/{p-DNgBG3W3.js → p-BDov60lH.js} +1 -1
- package/dist/components/{p-CDsXcD4i.js → p-DsZoQlCx.js} +1 -1
- package/dist/components/recipe-card.js +1 -1
- package/dist/components/recipe-form.js +1 -1
- package/dist/esm/app-modal_7.entry.js +3 -3
- package/dist/recipe-ui/p-32969b40.entry.js +1 -0
- package/dist/recipe-ui/recipe-ui.esm.js +1 -1
- package/dist/types/components/meal-plan-day/meal-plan-day.d.ts +1 -1
- package/package.json +1 -1
- package/dist/components/p-S4266va_.js +0 -1
- package/dist/recipe-ui/p-130cae8b.entry.js +0 -1
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
var index = require('./index-CRcwY0Fb.js');
|
|
4
4
|
|
|
5
|
-
const recipeCardCss = () => `:host{display:
|
|
5
|
+
const recipeCardCss = () => `:host{display:grid;font-family:system-ui, sans-serif}.card{border:1px solid #e5e5e5;border-radius:12px;overflow:hidden;cursor:pointer;background:#fff;transition:box-shadow 0.15s ease, transform 0.15s ease}.card:hover{box-shadow:0 4px 16px rgba(0, 0, 0, 0.08);transform:translateY(-2px)}.image-wrap{position:relative;aspect-ratio:4 / 3;background:#f2f2f2}.image-wrap img{width:100%;height:100%;object-fit:cover;display:block}.placeholder{width:100%;height:100%;background:linear-gradient(135deg, #eee, #ddd)}.fav-btn{position:absolute;top:8px;right:8px;border:none;background:rgba(255, 255, 255, 0.9);border-radius:50%;width:32px;height:32px;font-size:16px;cursor:pointer;color:#f5a623}.fav-btn.active{color:rgb(186, 76, 37)}.body{padding:12px 14px}h3{margin:0 0 4px;font-size:15px;line-height:1.3}.types{margin:15px 0;display:flex;gap:9px}.category,.cuisine{font-size:12px;color:#777;text-transform:uppercase;letter-spacing:0.03em;border:1px solid;border-color:rgb(186, 76, 37);color:rgb(186, 76, 37);font-weight:500;border-radius:15px;padding:3px 8px}.actions{margin-top:8px}`;
|
|
6
6
|
|
|
7
7
|
const RecipeCard = class {
|
|
8
8
|
constructor(hostRef) {
|
|
@@ -105,7 +105,7 @@ const RecipeRating = class {
|
|
|
105
105
|
};
|
|
106
106
|
RecipeRating.style = recipeRatingCss();
|
|
107
107
|
|
|
108
|
-
const recipeFormCss = () => `:host{display:block;font-family:system-ui, sans-serif}form{display:flex;flex-direction:column;gap:14px}label{display:flex;flex-direction:column;gap:4px;font-size:13px;color:#333;font-weight:600}input,textarea,select{font-weight:400;padding:8px 10px;border:1px solid #ddd;border-radius:6px;font-size:14px;font-family:inherit;background:#fff;transition:border-color 0.15s ease, box-shadow 0.15s ease}input:focus,textarea:focus,select:focus{outline:none;border-color:rgb(
|
|
108
|
+
const recipeFormCss = () => `:host{display:block;font-family:system-ui, sans-serif}form{display:flex;flex-direction:column;gap:14px}label{display:flex;flex-direction:column;gap:4px;font-size:13px;color:#333;font-weight:600}input,textarea,select{font-weight:400;padding:8px 10px;border:1px solid #ddd;border-radius:6px;font-size:14px;font-family:inherit;background:#fff;transition:border-color 0.15s ease, box-shadow 0.15s ease}input:focus,textarea:focus,select:focus{outline:none;border-color:rgb(186, 76, 37);box-shadow:0 0 0 3px rgba(255, 107, 53, 0.14)}select{appearance:none;-webkit-appearance:none;-moz-appearance:none;padding-right:34px;cursor:pointer;color:#1f2937;background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");background-repeat:no-repeat;background-position:right 10px center;background-size:14px}select:hover{border-color:#bbb}select:invalid,select option[value=""]{color:#9ca3af}.row{display:grid;grid-template-columns:1fr 1fr;gap:14px}@media (max-width: 480px){.row{grid-template-columns:1fr}}.field{display:flex;flex-direction:column;gap:6px;font-size:13px;font-weight:600}.ingredient-row{display:flex;gap:6px}.ingredient-row input{flex:1}.ingredient-row button{border:none;background:#f4f4f4;border-radius:6px;cursor:pointer;width:30px}.add-btn{align-self:flex-start;border:1px dashed #bbb;background:none;border-radius:6px;padding:6px 10px;cursor:pointer;font-size:13px;color:#555}.error{color:#e74c3c;font-size:12px;font-weight:400}.footer{display:flex;justify-content:flex-end;gap:10px;margin-top:6px}.cancel-btn{border:1px solid #ddd;background:#fff;border-radius:8px;padding:8px 16px;cursor:pointer}.save-btn{border:none;background:#ff6b35;color:#fff;border-radius:8px;padding:8px 18px;cursor:pointer;font-weight:600}`;
|
|
109
109
|
|
|
110
110
|
const DEFAULT_CATEGORIES = [
|
|
111
111
|
'Beef', 'Breakfast', 'Chicken', 'Dessert', 'Goat', 'Lamb',
|
|
@@ -311,7 +311,7 @@ const MealPlanDay = class {
|
|
|
311
311
|
}
|
|
312
312
|
render() {
|
|
313
313
|
const meals = Array.isArray(this.meals) ? this.meals : [];
|
|
314
|
-
return (index.h("div", { key: '
|
|
314
|
+
return (index.h("div", { key: 'd73bf6bb744e10acdc69ea05c2982f870a03d0b6', class: "day-col" }, index.h("div", { key: 'dfe679f947c3ebdd8b0404a7ea4c782050039211', class: "col-header" }, this.icon && index.h("span", { key: '4fa3946393b5335cb45831ff8ef90da4779cb19c', class: "icon" }, this.icon), index.h("h3", { key: '12d82635fd098decdc880ce7a184e7b85ff74e1c' }, this.day), meals.length > 0 && index.h("span", { key: '94ac9aef02aef1e43b102dc2a88e394922bf277f', class: "count-badge" }, meals.length)), index.h("div", { key: '24ae5c9389a417f09c5def233a26f00498594bbd', class: "meals" }, meals.map((m) => (index.h("div", { class: "meal-chip" }, index.h("div", { class: "thumb" }, m.image && index.h("img", { src: m.image, alt: m.title })), index.h("span", { class: "title" }, m.title), index.h("button", { class: "remove-btn", onClick: () => this.removeMeal.emit({ day: this.day, mealId: m.recipeId }), "aria-label": `Remove ${m.title}` }, "\u2715")))), meals.length === 0 && index.h("p", { key: 'e856b918afa96cbe9c29d38e3cd7f1e970ecea3c', class: "empty" }, "No meal planned")), index.h("button", { key: 'eae050457a66b13cbf5975a0935843f0a5613412', class: "add-btn", onClick: () => this.assignMeal.emit({ day: this.day }) }, index.h("span", { key: 'f26338efd668c8dbc3a7cedbeb0e3b513baad4ee', class: "plus" }, "+"), " Add meal")));
|
|
315
315
|
}
|
|
316
316
|
};
|
|
317
317
|
MealPlanDay.style = mealPlanDayCss();
|
|
@@ -8,7 +8,7 @@ export class MealPlanDay {
|
|
|
8
8
|
}
|
|
9
9
|
render() {
|
|
10
10
|
const meals = Array.isArray(this.meals) ? this.meals : [];
|
|
11
|
-
return (h("div", { key: '
|
|
11
|
+
return (h("div", { key: 'd73bf6bb744e10acdc69ea05c2982f870a03d0b6', class: "day-col" }, h("div", { key: 'dfe679f947c3ebdd8b0404a7ea4c782050039211', class: "col-header" }, this.icon && h("span", { key: '4fa3946393b5335cb45831ff8ef90da4779cb19c', class: "icon" }, this.icon), h("h3", { key: '12d82635fd098decdc880ce7a184e7b85ff74e1c' }, this.day), meals.length > 0 && h("span", { key: '94ac9aef02aef1e43b102dc2a88e394922bf277f', class: "count-badge" }, meals.length)), h("div", { key: '24ae5c9389a417f09c5def233a26f00498594bbd', class: "meals" }, meals.map((m) => (h("div", { class: "meal-chip" }, h("div", { class: "thumb" }, m.image && h("img", { src: m.image, alt: m.title })), h("span", { class: "title" }, m.title), h("button", { class: "remove-btn", onClick: () => this.removeMeal.emit({ day: this.day, mealId: m.recipeId }), "aria-label": `Remove ${m.title}` }, "\u2715")))), meals.length === 0 && h("p", { key: 'e856b918afa96cbe9c29d38e3cd7f1e970ecea3c', class: "empty" }, "No meal planned")), h("button", { key: 'eae050457a66b13cbf5975a0935843f0a5613412', class: "add-btn", onClick: () => this.assignMeal.emit({ day: this.day }) }, h("span", { key: 'f26338efd668c8dbc3a7cedbeb0e3b513baad4ee', class: "plus" }, "+"), " Add meal")));
|
|
12
12
|
}
|
|
13
13
|
static get is() { return "meal-plan-day"; }
|
|
14
14
|
static get encapsulation() { return "shadow"; }
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
:host {
|
|
2
|
-
display:
|
|
2
|
+
display: grid;
|
|
3
3
|
font-family: system-ui, sans-serif;
|
|
4
4
|
}
|
|
5
5
|
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
}
|
|
52
52
|
|
|
53
53
|
.fav-btn.active {
|
|
54
|
-
color: rgb(
|
|
54
|
+
color: rgb(186, 76, 37);
|
|
55
55
|
}
|
|
56
56
|
|
|
57
57
|
.body {
|
|
@@ -77,8 +77,8 @@ h3 {
|
|
|
77
77
|
text-transform: uppercase;
|
|
78
78
|
letter-spacing: 0.03em;
|
|
79
79
|
border: 1px solid;
|
|
80
|
-
border-color: rgb(
|
|
81
|
-
color: rgb(
|
|
80
|
+
border-color: rgb(186, 76, 37);
|
|
81
|
+
color: rgb(186, 76, 37);
|
|
82
82
|
font-weight: 500;
|
|
83
83
|
border-radius: 15px;
|
|
84
84
|
padding: 3px 8px;
|
package/dist/components/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export{g as getAssetPath,r as render,s as setAssetPath,a as setNonce,b as setPlatformOptions}from"./p-BJU3HdRm.js";export{R as RecipeCard}from"./p-
|
|
1
|
+
export{g as getAssetPath,r as render,s as setAssetPath,a as setNonce,b as setPlatformOptions}from"./p-BJU3HdRm.js";export{R as RecipeCard}from"./p-BDov60lH.js";export{R as RecipeSearchBar}from"./p-DElrp5qn.js";export{R as RecipeFilterBar}from"./p-8ogxleRP.js";export{R as RecipeRating}from"./p-B_OSW9IJ.js";export{R as RecipeForm}from"./p-DsZoQlCx.js";export{M as MealPlanDay}from"./p-B37vIJ1j.js";export{A as AppModal}from"./p-Dp1sKtrN.js";export{A as AppToast}from"./p-BBMv9wjr.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{M as o,d as s}from"./p-
|
|
1
|
+
import{M as o,d as s}from"./p-B37vIJ1j.js";const p=o,r=s;export{p as MealPlanDay,r as defineCustomElement}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t as e,p as a,H as o,c as s,h as t}from"./p-BJU3HdRm.js";const d=a(class extends o{constructor(e){super(),!1!==e&&this.__registerHost(),this.__attachShadow(),this.assignMeal=s(this,"assignMeal"),this.removeMeal=s(this,"removeMeal"),this.day="",this.meals=[],this.icon=""}render(){const e=Array.isArray(this.meals)?this.meals:[];return t("div",{key:"d73bf6bb744e10acdc69ea05c2982f870a03d0b6",class:"day-col"},t("div",{key:"dfe679f947c3ebdd8b0404a7ea4c782050039211",class:"col-header"},this.icon&&t("span",{key:"4fa3946393b5335cb45831ff8ef90da4779cb19c",class:"icon"},this.icon),t("h3",{key:"12d82635fd098decdc880ce7a184e7b85ff74e1c"},this.day),e.length>0&&t("span",{key:"94ac9aef02aef1e43b102dc2a88e394922bf277f",class:"count-badge"},e.length)),t("div",{key:"24ae5c9389a417f09c5def233a26f00498594bbd",class:"meals"},e.map((e=>t("div",{class:"meal-chip"},t("div",{class:"thumb"},e.image&&t("img",{src:e.image,alt:e.title})),t("span",{class:"title"},e.title),t("button",{class:"remove-btn",onClick:()=>this.removeMeal.emit({day:this.day,mealId:e.recipeId}),"aria-label":`Remove ${e.title}`},"✕")))),0===e.length&&t("p",{key:"e856b918afa96cbe9c29d38e3cd7f1e970ecea3c",class:"empty"},"No meal planned")),t("button",{key:"eae050457a66b13cbf5975a0935843f0a5613412",class:"add-btn",onClick:()=>this.assignMeal.emit({day:this.day})},t("span",{key:"f26338efd668c8dbc3a7cedbeb0e3b513baad4ee",class:"plus"},"+")," Add meal"))}static get style(){return":host{display:block;font-family:-apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif}.day-col{background:#ffffff;border:1px solid #e8eaed;border-radius:12px;padding:14px;min-width:160px;display:flex;flex-direction:column;gap:10px;box-shadow:0 1px 2px rgba(16, 24, 40, 0.04);transition:box-shadow 0.15s ease, border-color 0.15s ease}.day-col:hover{box-shadow:0 4px 12px rgba(16, 24, 40, 0.08);border-color:#d8dce1}.col-header{display:flex;align-items:center;gap:6px;padding-bottom:8px;border-bottom:1px solid #f0f1f3}.col-header .icon{font-size:15px;line-height:1}.col-header h3{margin:0;font-size:12.5px;font-weight:700;text-transform:uppercase;letter-spacing:0.05em;color:#4b5563;flex:1}.count-badge{background:#eef2ff;color:#4338ca;font-size:10.5px;font-weight:700;padding:1px 7px;border-radius:999px;line-height:1.5}.meals{display:flex;flex-direction:column;gap:6px;min-height:44px}.meal-chip{display:flex;align-items:center;gap:8px;background:#f9fafb;border:1px solid #eef0f2;border-radius:9px;padding:6px 8px;font-size:12.5px;transition:background 0.12s ease}.meal-chip:hover{background:#f3f4f6}.thumb{width:28px;height:28px;border-radius:6px;overflow:hidden;flex-shrink:0;background:#e5e7eb}.thumb img{width:100%;height:100%;object-fit:cover;display:block}.meal-chip .title{flex:1;color:#1f2937;font-weight:500;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.remove-btn{border:none;background:none;cursor:pointer;color:#9ca3af;font-size:11px;line-height:1;padding:3px;border-radius:5px;transition:color 0.12s ease, background 0.12s ease}.remove-btn:hover{color:#dc2626;background:#fef2f2}.empty{font-size:12px;color:#9ca3af;margin:6px 0;text-align:center;font-style:italic}.add-btn{display:flex;align-items:center;justify-content:center;gap:4px;border:1.5px dashed #d1d5db;background:none;border-radius:9px;padding:7px;font-size:12px;font-weight:600;cursor:pointer;color:#6b7280;transition:border-color 0.12s ease, color 0.12s ease, background 0.12s ease}.add-btn:hover{border-color:#6366f1;color:#4f46e5;background:#f5f5ff}.plus{font-size:14px;line-height:1}"}},[1,"meal-plan-day",{day:[1],meals:[16],icon:[1]}]);function i(){"undefined"!=typeof customElements&&["meal-plan-day"].forEach((a=>{"meal-plan-day"===a&&(customElements.get(e(a))||customElements.define(e(a),d))}))}i();export{d as M,i as d}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e,p as a,H as s,c as i,h as t}from"./p-BJU3HdRm.js";const r=a(class extends s{constructor(e){super(),!1!==e&&this.__registerHost(),this.__attachShadow(),this.favoriteToggle=i(this,"favoriteToggle"),this.cardClick=i(this,"cardClick"),this.category="",this.cuisine="",this.favorite=!1,this.onFavoriteClick=e=>{e.stopPropagation(),this.favoriteToggle.emit({favorite:!this.favorite})}}render(){return t("div",{key:"64d7f6fb92a01c650f3972c4c0f0164f1904d959",class:"card",onClick:()=>this.cardClick.emit()},t("div",{key:"b9d014e3fc77346eaa76e6feb15369e9fb622624",class:"image-wrap"},this.image?t("img",{src:this.image,alt:this.recipeTitle}):t("div",{class:"placeholder"}),t("button",{key:"1690299a371310ad5e6b0e0cc238853fb3e9f439",class:{"fav-btn":!0,active:this.favorite},onClick:this.onFavoriteClick,"aria-label":"Toggle favorite"},this.favorite?"★":"☆")),t("div",{key:"52e02f3b16c2ab51209c6812aa94b4642504836a",class:"body"},t("h3",{key:"6df2f0f3146dd8ef5f91cce8e29f0dca00ffbd0a"},this.recipeTitle),t("span",{key:"072d88d380bf578e5a7a967c55d257aa604de23a",class:"types"},this.category&&t("span",{key:"636f5c1a350c93c6111415ac8a25b05301a60899",class:"category"},this.category),this.cuisine&&t("span",{key:"149cc29a60528ecd2734650b52857a00a685cfd6",class:"cuisine"},this.cuisine)),t("div",{key:"2a75de4cbb0eb4a4e37e35a29c48131c3e88080c",class:"actions"},t("slot",{key:"3c249490cef1005c546c6ee139bb70acabc41535",name:"actions"}))))}static get style(){return":host{display:
|
|
1
|
+
import{t as e,p as a,H as s,c as i,h as t}from"./p-BJU3HdRm.js";const r=a(class extends s{constructor(e){super(),!1!==e&&this.__registerHost(),this.__attachShadow(),this.favoriteToggle=i(this,"favoriteToggle"),this.cardClick=i(this,"cardClick"),this.category="",this.cuisine="",this.favorite=!1,this.onFavoriteClick=e=>{e.stopPropagation(),this.favoriteToggle.emit({favorite:!this.favorite})}}render(){return t("div",{key:"64d7f6fb92a01c650f3972c4c0f0164f1904d959",class:"card",onClick:()=>this.cardClick.emit()},t("div",{key:"b9d014e3fc77346eaa76e6feb15369e9fb622624",class:"image-wrap"},this.image?t("img",{src:this.image,alt:this.recipeTitle}):t("div",{class:"placeholder"}),t("button",{key:"1690299a371310ad5e6b0e0cc238853fb3e9f439",class:{"fav-btn":!0,active:this.favorite},onClick:this.onFavoriteClick,"aria-label":"Toggle favorite"},this.favorite?"★":"☆")),t("div",{key:"52e02f3b16c2ab51209c6812aa94b4642504836a",class:"body"},t("h3",{key:"6df2f0f3146dd8ef5f91cce8e29f0dca00ffbd0a"},this.recipeTitle),t("span",{key:"072d88d380bf578e5a7a967c55d257aa604de23a",class:"types"},this.category&&t("span",{key:"636f5c1a350c93c6111415ac8a25b05301a60899",class:"category"},this.category),this.cuisine&&t("span",{key:"149cc29a60528ecd2734650b52857a00a685cfd6",class:"cuisine"},this.cuisine)),t("div",{key:"2a75de4cbb0eb4a4e37e35a29c48131c3e88080c",class:"actions"},t("slot",{key:"3c249490cef1005c546c6ee139bb70acabc41535",name:"actions"}))))}static get style(){return":host{display:grid;font-family:system-ui, sans-serif}.card{border:1px solid #e5e5e5;border-radius:12px;overflow:hidden;cursor:pointer;background:#fff;transition:box-shadow 0.15s ease, transform 0.15s ease}.card:hover{box-shadow:0 4px 16px rgba(0, 0, 0, 0.08);transform:translateY(-2px)}.image-wrap{position:relative;aspect-ratio:4 / 3;background:#f2f2f2}.image-wrap img{width:100%;height:100%;object-fit:cover;display:block}.placeholder{width:100%;height:100%;background:linear-gradient(135deg, #eee, #ddd)}.fav-btn{position:absolute;top:8px;right:8px;border:none;background:rgba(255, 255, 255, 0.9);border-radius:50%;width:32px;height:32px;font-size:16px;cursor:pointer;color:#f5a623}.fav-btn.active{color:rgb(186, 76, 37)}.body{padding:12px 14px}h3{margin:0 0 4px;font-size:15px;line-height:1.3}.types{margin:15px 0;display:flex;gap:9px}.category,.cuisine{font-size:12px;color:#777;text-transform:uppercase;letter-spacing:0.03em;border:1px solid;border-color:rgb(186, 76, 37);color:rgb(186, 76, 37);font-weight:500;border-radius:15px;padding:3px 8px}.actions{margin-top:8px}"}},[257,"recipe-card",{recipeTitle:[1,"recipe-title"],image:[1],category:[1],cuisine:[1],favorite:[4]}]);function c(){"undefined"!=typeof customElements&&["recipe-card"].forEach((a=>{"recipe-card"===a&&(customElements.get(e(a))||customElements.define(e(a),r))}))}c();export{r as R,c as d}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e,p as t,H as i,c as s,h as a}from"./p-BJU3HdRm.js";const r=["Beef","Breakfast","Chicken","Dessert","Goat","Lamb","Miscellaneous","Pasta","Pork","Seafood","Side","Starter","Vegan","Vegetarian","Other"],n=["American","British","Chinese","Croatian","Dutch","Egyptian","Filipino","French","Greek","Indian","Irish","Italian","Jamaican","Japanese","Kenyan","Malaysian","Mexican","Moroccan","Polish","Portuguese","Russian","Spanish","Thai","Tunisian","Turkish","Vietnamese","Other"],o=t(class extends i{constructor(e){super(),!1!==e&&this.__registerHost(),this.__attachShadow(),this.save=s(this,"save"),this.cancel=s(this,"cancel"),this.categories=r,this.extraCategories=[],this.areas=n,this.extraAreas=[],this.title="",this.image="",this.category="",this.customCategory="",this.area="",this.customArea="",this.ingredients=[""],this.instructions="",this.errors={},this.onSubmit=e=>{if(e.preventDefault(),!this.validate())return;const t="Other"===this.category?this.customCategory.trim():this.category,i="Other"===this.area?this.customArea.trim():this.area,s={id:this.initialData?.id,title:this.title.trim(),image:this.image.trim(),category:t,cuisine:i,ingredients:this.ingredients.map((e=>e.trim())).filter(Boolean),instructions:this.instructions.trim()};this.save.emit(s)},this.addIngredient=()=>{this.ingredients=[...this.ingredients,""]},this.removeIngredient=e=>{this.ingredients=this.ingredients.filter(((t,i)=>i!==e));const t=this.ingredients.filter(((t,i)=>i!==e));this.ingredients=t,this.clearErrorIf("ingredients",t.some((e=>e.trim())))}}componentWillLoad(){this.loadInitialData()}onInitialDataChange(){this.loadInitialData()}mergeList(e,t){const i=[...e.filter((e=>"Other"!==e))];for(const e of t)e&&!i.includes(e)&&i.push(e);return i.push("Other"),i}get fullCategoryList(){return this.mergeList(this.categories,this.extraCategories)}get fullAreaList(){return this.mergeList(this.areas,this.extraAreas)}clearErrorIf(e,t){if(t&&this.errors[e]){const t={...this.errors};delete t[e],this.errors=t}}loadInitialData(){let e;if("string"==typeof this.initialData&&this.initialData)try{e=JSON.parse(this.initialData)}catch{e=void 0}else this.initialData&&"object"==typeof this.initialData&&(e=this.initialData);if(e){this.title=e.title??"",this.image=e.image??"",this.ingredients=e.ingredients?.length?[...e.ingredients]:[""],this.instructions=e.instructions??"";const t=this.fullCategoryList.filter((e=>"Other"!==e));e.category&&!t.includes(e.category)?(this.category="Other",this.customCategory=e.category):(this.category=e.category??"",this.customCategory="");const i=this.fullAreaList.filter((e=>"Other"!==e));e.cuisine&&!i.includes(e.cuisine)?(this.area="Other",this.customArea=e.cuisine):(this.area=e.cuisine??"",this.customArea="")}}validate(){const e={};return this.title.trim()||(e.title="Title is required."),0===this.ingredients.map((e=>e.trim())).filter(Boolean).length&&(e.ingredients="Add at least one ingredient."),this.instructions.trim()||(e.instructions="Instructions are required."),this.category.trim()?"Other"!==this.category||this.customCategory.trim()||(e.customCategory="Enter a category name."):e.category="Category is required.",this.area.trim()?"Other"!==this.area||this.customArea.trim()||(e.customArea="Enter a cuisine name."):e.area="Cuisine / Area is required.",this.errors=e,0===Object.keys(e).length}updateIngredient(e,t){const i=[...this.ingredients];i[e]=t,this.ingredients=i,this.clearErrorIf("ingredients",i.some((e=>e.trim())))}render(){return a("form",{key:"c29ab62af9db4a95e11b75f25a2dd4c23e699dad",onSubmit:this.onSubmit},a("slot",{key:"ece02ab46a1075eaef912e8953e70faa11bc8d8d",name:"header"}),a("label",{key:"9e17e9ba311350d9235f5ec01c32743dfbf55b0e"},"Title",a("input",{key:"2b8d632bc22eb5cde52198287ea2b19d87567dba",type:"text",value:this.title,onInput:e=>{this.title=e.target.value,this.clearErrorIf("title",!!this.title.trim())}}),this.errors.title&&a("span",{key:"3a34d1f5e1f43ef190983dd0883f16eb6775f07c",class:"error"},this.errors.title)),a("label",{key:"6acda6ccaff2e0315cc1964ae30c18647fe97bd1"},"Image URL",a("input",{key:"6bdc06a2bebd6b5ae984865aefe292426fbe38cb",type:"text",value:this.image,onInput:e=>this.image=e.target.value})),a("div",{key:"f6ef49aaace211659296e93b4b5b47b29db73ac6",class:"row"},a("label",{key:"9610c81a85ebddc2da4bdadcdee68ddea78e28d4"},"Category",a("select",{key:"46542ff9e2c0f15d60be6744e063f3c860475772",onInput:e=>{this.category=e.target.value,this.clearErrorIf("category",!!this.category),"Other"!==this.category&&this.clearErrorIf("customCategory",!0)}},a("option",{key:"2741b90edd32cb12903e877cbfa2db3b5ff04071",value:"",selected:""===this.category},"Select a category…"),this.fullCategoryList.map((e=>a("option",{value:e,selected:e===this.category},e)))),this.errors.category&&a("span",{key:"dc8e7ab5a6decdece1b4559af856997251335abf",class:"error"},this.errors.category)),a("label",{key:"792cb1c4fd6052f9d88c52649c6eb4dc064f0071"},"Cuisine / Area",a("select",{key:"06a917ac951a4c6d3e8390534690545a1967581a",onInput:e=>{this.area=e.target.value,this.clearErrorIf("area",!!this.area),"Other"!==this.area&&this.clearErrorIf("customArea",!0)}},a("option",{key:"264c39814065b3f07626975b96eca6b7e1c9bb83",value:"",selected:""===this.area},"Select a cuisine…"),this.fullAreaList.map((e=>a("option",{value:e,selected:e===this.area},e)))),this.errors.area&&a("span",{key:"f1a562402420fb7a813dd4184b439c03c71d93d9",class:"error"},this.errors.area))),("Other"===this.category||"Other"===this.area)&&a("div",{key:"3c20e6b5b678027d711c7976c60e3be92d02fae3",class:"row"},"Other"===this.category&&a("label",{key:"4cd14baeff186c7db8fabe57b21b241567528437",class:"custom-area-field"},"Enter category name",a("input",{key:"b1880e7aaadb3ade3c980c7f44d6b0a8d4fc3923",type:"text",placeholder:"e.g. Brunch",value:this.customCategory,onInput:e=>{this.customCategory=e.target.value,this.customCategory=e.target.value,this.clearErrorIf("customCategory",!!this.customCategory.trim())}}),this.errors.customCategory&&a("span",{key:"abd5094a23a182458ff2b76a58b55d65a9540c83",class:"error"},this.errors.customCategory)),"Other"===this.area&&a("label",{key:"696c0cc6af2cf16df8559da441e38635d8e0012c",class:"custom-area-field"},"Enter cuisine name",a("input",{key:"663fee3941527c736d953cc993b886746dabab23",type:"text",placeholder:"e.g. Ethiopian",value:this.customArea,onInput:e=>{this.customArea=e.target.value,this.clearErrorIf("customArea",!!this.customArea.trim())}}),this.errors.customArea&&a("span",{key:"6e1b7ebfac7166fb1120b0d8f914bb076f5e40ee",class:"error"},this.errors.customArea))),a("div",{key:"fe85b73291a5ee955d069f20ddf33835d09b95bd",class:"field"},a("span",{key:"fd010d7b12306bd4306caf03ebd972feb1e0ebb9"},"Ingredients"),this.ingredients.map(((e,t)=>a("div",{class:"ingredient-row"},a("input",{type:"text",value:e,onInput:e=>this.updateIngredient(t,e.target.value)}),a("button",{type:"button",onClick:()=>this.removeIngredient(t),"aria-label":"Remove"},"✕")))),a("button",{key:"8168f7e7f4bef8be1e74d1adf377b5471701c0ff",type:"button",class:"add-btn",onClick:this.addIngredient},"+ Add ingredient"),this.errors.ingredients&&a("span",{key:"3e35a8fe02833b27a333fa157548b88b3f5e3842",class:"error"},this.errors.ingredients)),a("label",{key:"c5c583cba5363ce35e6d41f95917bc49e3cca02d"},"Instructions",a("textarea",{key:"514c219989a01cf1ad77739bd6c0df066362c689",rows:5,onInput:e=>{this.instructions=e.target.value,this.clearErrorIf("instructions",!!this.instructions.trim())}},this.instructions),this.errors.instructions&&a("span",{key:"89881e3b0d4f864f7ccc835d86b094f367b54b2e",class:"error"},this.errors.instructions)),a("div",{key:"b9a812287af44062e1c68034881ba62321b0e660",class:"footer"},a("slot",{key:"a8307179d95cfd713d8f5fbe6e996fefb1d54907",name:"footer"}),a("button",{key:"aa75decaf67c74a183af182864a37a6cd37b56ff",type:"button",class:"cancel-btn",onClick:()=>this.cancel.emit()},"Cancel"),a("button",{key:"13ea35b114f1a7721347f986c6c4e64968583025",type:"submit",class:"save-btn"},"Save Recipe")))}static get watchers(){return{initialData:[{onInitialDataChange:0}]}}static get style(){return":host{display:block;font-family:system-ui, sans-serif}form{display:flex;flex-direction:column;gap:14px}label{display:flex;flex-direction:column;gap:4px;font-size:13px;color:#333;font-weight:600}input,textarea,select{font-weight:400;padding:8px 10px;border:1px solid #ddd;border-radius:6px;font-size:14px;font-family:inherit;background:#fff;transition:border-color 0.15s ease, box-shadow 0.15s ease}input:focus,textarea:focus,select:focus{outline:none;border-color:rgb(255, 107, 53);box-shadow:0 0 0 3px rgba(255, 107, 53, 0.14)}select{appearance:none;-webkit-appearance:none;-moz-appearance:none;padding-right:34px;cursor:pointer;color:#1f2937;background-image:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E\");background-repeat:no-repeat;background-position:right 10px center;background-size:14px}select:hover{border-color:#bbb}select:invalid,select option[value=\"\"]{color:#9ca3af}.row{display:grid;grid-template-columns:1fr 1fr;gap:14px}@media (max-width: 480px){.row{grid-template-columns:1fr}}.field{display:flex;flex-direction:column;gap:6px;font-size:13px;font-weight:600}.ingredient-row{display:flex;gap:6px}.ingredient-row input{flex:1}.ingredient-row button{border:none;background:#f4f4f4;border-radius:6px;cursor:pointer;width:30px}.add-btn{align-self:flex-start;border:1px dashed #bbb;background:none;border-radius:6px;padding:6px 10px;cursor:pointer;font-size:13px;color:#555}.error{color:#e74c3c;font-size:12px;font-weight:400}.footer{display:flex;justify-content:flex-end;gap:10px;margin-top:6px}.cancel-btn{border:1px solid #ddd;background:#fff;border-radius:8px;padding:8px 16px;cursor:pointer}.save-btn{border:none;background:#ff6b35;color:#fff;border-radius:8px;padding:8px 18px;cursor:pointer;font-weight:600}"}},[257,"recipe-form",{initialData:[1,"initial-data"],categories:[16],extraCategories:[16],areas:[16],extraAreas:[16],title:[32],image:[32],category:[32],customCategory:[32],area:[32],customArea:[32],ingredients:[32],instructions:[32],errors:[32]},void 0,{initialData:[{onInitialDataChange:0}]}]);function c(){"undefined"!=typeof customElements&&["recipe-form"].forEach((t=>{"recipe-form"===t&&(customElements.get(e(t))||customElements.define(e(t),o))}))}c();export{o as R,c as d}
|
|
1
|
+
import{t as e,p as t,H as i,c as s,h as a}from"./p-BJU3HdRm.js";const r=["Beef","Breakfast","Chicken","Dessert","Goat","Lamb","Miscellaneous","Pasta","Pork","Seafood","Side","Starter","Vegan","Vegetarian","Other"],n=["American","British","Chinese","Croatian","Dutch","Egyptian","Filipino","French","Greek","Indian","Irish","Italian","Jamaican","Japanese","Kenyan","Malaysian","Mexican","Moroccan","Polish","Portuguese","Russian","Spanish","Thai","Tunisian","Turkish","Vietnamese","Other"],o=t(class extends i{constructor(e){super(),!1!==e&&this.__registerHost(),this.__attachShadow(),this.save=s(this,"save"),this.cancel=s(this,"cancel"),this.categories=r,this.extraCategories=[],this.areas=n,this.extraAreas=[],this.title="",this.image="",this.category="",this.customCategory="",this.area="",this.customArea="",this.ingredients=[""],this.instructions="",this.errors={},this.onSubmit=e=>{if(e.preventDefault(),!this.validate())return;const t="Other"===this.category?this.customCategory.trim():this.category,i="Other"===this.area?this.customArea.trim():this.area,s={id:this.initialData?.id,title:this.title.trim(),image:this.image.trim(),category:t,cuisine:i,ingredients:this.ingredients.map((e=>e.trim())).filter(Boolean),instructions:this.instructions.trim()};this.save.emit(s)},this.addIngredient=()=>{this.ingredients=[...this.ingredients,""]},this.removeIngredient=e=>{this.ingredients=this.ingredients.filter(((t,i)=>i!==e));const t=this.ingredients.filter(((t,i)=>i!==e));this.ingredients=t,this.clearErrorIf("ingredients",t.some((e=>e.trim())))}}componentWillLoad(){this.loadInitialData()}onInitialDataChange(){this.loadInitialData()}mergeList(e,t){const i=[...e.filter((e=>"Other"!==e))];for(const e of t)e&&!i.includes(e)&&i.push(e);return i.push("Other"),i}get fullCategoryList(){return this.mergeList(this.categories,this.extraCategories)}get fullAreaList(){return this.mergeList(this.areas,this.extraAreas)}clearErrorIf(e,t){if(t&&this.errors[e]){const t={...this.errors};delete t[e],this.errors=t}}loadInitialData(){let e;if("string"==typeof this.initialData&&this.initialData)try{e=JSON.parse(this.initialData)}catch{e=void 0}else this.initialData&&"object"==typeof this.initialData&&(e=this.initialData);if(e){this.title=e.title??"",this.image=e.image??"",this.ingredients=e.ingredients?.length?[...e.ingredients]:[""],this.instructions=e.instructions??"";const t=this.fullCategoryList.filter((e=>"Other"!==e));e.category&&!t.includes(e.category)?(this.category="Other",this.customCategory=e.category):(this.category=e.category??"",this.customCategory="");const i=this.fullAreaList.filter((e=>"Other"!==e));e.cuisine&&!i.includes(e.cuisine)?(this.area="Other",this.customArea=e.cuisine):(this.area=e.cuisine??"",this.customArea="")}}validate(){const e={};return this.title.trim()||(e.title="Title is required."),0===this.ingredients.map((e=>e.trim())).filter(Boolean).length&&(e.ingredients="Add at least one ingredient."),this.instructions.trim()||(e.instructions="Instructions are required."),this.category.trim()?"Other"!==this.category||this.customCategory.trim()||(e.customCategory="Enter a category name."):e.category="Category is required.",this.area.trim()?"Other"!==this.area||this.customArea.trim()||(e.customArea="Enter a cuisine name."):e.area="Cuisine / Area is required.",this.errors=e,0===Object.keys(e).length}updateIngredient(e,t){const i=[...this.ingredients];i[e]=t,this.ingredients=i,this.clearErrorIf("ingredients",i.some((e=>e.trim())))}render(){return a("form",{key:"c29ab62af9db4a95e11b75f25a2dd4c23e699dad",onSubmit:this.onSubmit},a("slot",{key:"ece02ab46a1075eaef912e8953e70faa11bc8d8d",name:"header"}),a("label",{key:"9e17e9ba311350d9235f5ec01c32743dfbf55b0e"},"Title",a("input",{key:"2b8d632bc22eb5cde52198287ea2b19d87567dba",type:"text",value:this.title,onInput:e=>{this.title=e.target.value,this.clearErrorIf("title",!!this.title.trim())}}),this.errors.title&&a("span",{key:"3a34d1f5e1f43ef190983dd0883f16eb6775f07c",class:"error"},this.errors.title)),a("label",{key:"6acda6ccaff2e0315cc1964ae30c18647fe97bd1"},"Image URL",a("input",{key:"6bdc06a2bebd6b5ae984865aefe292426fbe38cb",type:"text",value:this.image,onInput:e=>this.image=e.target.value})),a("div",{key:"f6ef49aaace211659296e93b4b5b47b29db73ac6",class:"row"},a("label",{key:"9610c81a85ebddc2da4bdadcdee68ddea78e28d4"},"Category",a("select",{key:"46542ff9e2c0f15d60be6744e063f3c860475772",onInput:e=>{this.category=e.target.value,this.clearErrorIf("category",!!this.category),"Other"!==this.category&&this.clearErrorIf("customCategory",!0)}},a("option",{key:"2741b90edd32cb12903e877cbfa2db3b5ff04071",value:"",selected:""===this.category},"Select a category…"),this.fullCategoryList.map((e=>a("option",{value:e,selected:e===this.category},e)))),this.errors.category&&a("span",{key:"dc8e7ab5a6decdece1b4559af856997251335abf",class:"error"},this.errors.category)),a("label",{key:"792cb1c4fd6052f9d88c52649c6eb4dc064f0071"},"Cuisine / Area",a("select",{key:"06a917ac951a4c6d3e8390534690545a1967581a",onInput:e=>{this.area=e.target.value,this.clearErrorIf("area",!!this.area),"Other"!==this.area&&this.clearErrorIf("customArea",!0)}},a("option",{key:"264c39814065b3f07626975b96eca6b7e1c9bb83",value:"",selected:""===this.area},"Select a cuisine…"),this.fullAreaList.map((e=>a("option",{value:e,selected:e===this.area},e)))),this.errors.area&&a("span",{key:"f1a562402420fb7a813dd4184b439c03c71d93d9",class:"error"},this.errors.area))),("Other"===this.category||"Other"===this.area)&&a("div",{key:"3c20e6b5b678027d711c7976c60e3be92d02fae3",class:"row"},"Other"===this.category&&a("label",{key:"4cd14baeff186c7db8fabe57b21b241567528437",class:"custom-area-field"},"Enter category name",a("input",{key:"b1880e7aaadb3ade3c980c7f44d6b0a8d4fc3923",type:"text",placeholder:"e.g. Brunch",value:this.customCategory,onInput:e=>{this.customCategory=e.target.value,this.customCategory=e.target.value,this.clearErrorIf("customCategory",!!this.customCategory.trim())}}),this.errors.customCategory&&a("span",{key:"abd5094a23a182458ff2b76a58b55d65a9540c83",class:"error"},this.errors.customCategory)),"Other"===this.area&&a("label",{key:"696c0cc6af2cf16df8559da441e38635d8e0012c",class:"custom-area-field"},"Enter cuisine name",a("input",{key:"663fee3941527c736d953cc993b886746dabab23",type:"text",placeholder:"e.g. Ethiopian",value:this.customArea,onInput:e=>{this.customArea=e.target.value,this.clearErrorIf("customArea",!!this.customArea.trim())}}),this.errors.customArea&&a("span",{key:"6e1b7ebfac7166fb1120b0d8f914bb076f5e40ee",class:"error"},this.errors.customArea))),a("div",{key:"fe85b73291a5ee955d069f20ddf33835d09b95bd",class:"field"},a("span",{key:"fd010d7b12306bd4306caf03ebd972feb1e0ebb9"},"Ingredients"),this.ingredients.map(((e,t)=>a("div",{class:"ingredient-row"},a("input",{type:"text",value:e,onInput:e=>this.updateIngredient(t,e.target.value)}),a("button",{type:"button",onClick:()=>this.removeIngredient(t),"aria-label":"Remove"},"✕")))),a("button",{key:"8168f7e7f4bef8be1e74d1adf377b5471701c0ff",type:"button",class:"add-btn",onClick:this.addIngredient},"+ Add ingredient"),this.errors.ingredients&&a("span",{key:"3e35a8fe02833b27a333fa157548b88b3f5e3842",class:"error"},this.errors.ingredients)),a("label",{key:"c5c583cba5363ce35e6d41f95917bc49e3cca02d"},"Instructions",a("textarea",{key:"514c219989a01cf1ad77739bd6c0df066362c689",rows:5,onInput:e=>{this.instructions=e.target.value,this.clearErrorIf("instructions",!!this.instructions.trim())}},this.instructions),this.errors.instructions&&a("span",{key:"89881e3b0d4f864f7ccc835d86b094f367b54b2e",class:"error"},this.errors.instructions)),a("div",{key:"b9a812287af44062e1c68034881ba62321b0e660",class:"footer"},a("slot",{key:"a8307179d95cfd713d8f5fbe6e996fefb1d54907",name:"footer"}),a("button",{key:"aa75decaf67c74a183af182864a37a6cd37b56ff",type:"button",class:"cancel-btn",onClick:()=>this.cancel.emit()},"Cancel"),a("button",{key:"13ea35b114f1a7721347f986c6c4e64968583025",type:"submit",class:"save-btn"},"Save Recipe")))}static get watchers(){return{initialData:[{onInitialDataChange:0}]}}static get style(){return":host{display:block;font-family:system-ui, sans-serif}form{display:flex;flex-direction:column;gap:14px}label{display:flex;flex-direction:column;gap:4px;font-size:13px;color:#333;font-weight:600}input,textarea,select{font-weight:400;padding:8px 10px;border:1px solid #ddd;border-radius:6px;font-size:14px;font-family:inherit;background:#fff;transition:border-color 0.15s ease, box-shadow 0.15s ease}input:focus,textarea:focus,select:focus{outline:none;border-color:rgb(186, 76, 37);box-shadow:0 0 0 3px rgba(255, 107, 53, 0.14)}select{appearance:none;-webkit-appearance:none;-moz-appearance:none;padding-right:34px;cursor:pointer;color:#1f2937;background-image:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E\");background-repeat:no-repeat;background-position:right 10px center;background-size:14px}select:hover{border-color:#bbb}select:invalid,select option[value=\"\"]{color:#9ca3af}.row{display:grid;grid-template-columns:1fr 1fr;gap:14px}@media (max-width: 480px){.row{grid-template-columns:1fr}}.field{display:flex;flex-direction:column;gap:6px;font-size:13px;font-weight:600}.ingredient-row{display:flex;gap:6px}.ingredient-row input{flex:1}.ingredient-row button{border:none;background:#f4f4f4;border-radius:6px;cursor:pointer;width:30px}.add-btn{align-self:flex-start;border:1px dashed #bbb;background:none;border-radius:6px;padding:6px 10px;cursor:pointer;font-size:13px;color:#555}.error{color:#e74c3c;font-size:12px;font-weight:400}.footer{display:flex;justify-content:flex-end;gap:10px;margin-top:6px}.cancel-btn{border:1px solid #ddd;background:#fff;border-radius:8px;padding:8px 16px;cursor:pointer}.save-btn{border:none;background:#ff6b35;color:#fff;border-radius:8px;padding:8px 18px;cursor:pointer;font-weight:600}"}},[257,"recipe-form",{initialData:[1,"initial-data"],categories:[16],extraCategories:[16],areas:[16],extraAreas:[16],title:[32],image:[32],category:[32],customCategory:[32],area:[32],customArea:[32],ingredients:[32],instructions:[32],errors:[32]},void 0,{initialData:[{onInitialDataChange:0}]}]);function c(){"undefined"!=typeof customElements&&["recipe-form"].forEach((t=>{"recipe-form"===t&&(customElements.get(e(t))||customElements.define(e(t),o))}))}c();export{o as R,c as d}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{R as o,d as s}from"./p-
|
|
1
|
+
import{R as o,d as s}from"./p-BDov60lH.js";const p=o,r=s;export{p as RecipeCard,r as defineCustomElement}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{R as
|
|
1
|
+
import{R as o,d as s}from"./p-DsZoQlCx.js";const p=o,r=s;export{p as RecipeForm,r as defineCustomElement}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { r as registerInstance, c as createEvent, h } from './index-CrZUP9M-.js';
|
|
2
2
|
|
|
3
|
-
const recipeCardCss = () => `:host{display:
|
|
3
|
+
const recipeCardCss = () => `:host{display:grid;font-family:system-ui, sans-serif}.card{border:1px solid #e5e5e5;border-radius:12px;overflow:hidden;cursor:pointer;background:#fff;transition:box-shadow 0.15s ease, transform 0.15s ease}.card:hover{box-shadow:0 4px 16px rgba(0, 0, 0, 0.08);transform:translateY(-2px)}.image-wrap{position:relative;aspect-ratio:4 / 3;background:#f2f2f2}.image-wrap img{width:100%;height:100%;object-fit:cover;display:block}.placeholder{width:100%;height:100%;background:linear-gradient(135deg, #eee, #ddd)}.fav-btn{position:absolute;top:8px;right:8px;border:none;background:rgba(255, 255, 255, 0.9);border-radius:50%;width:32px;height:32px;font-size:16px;cursor:pointer;color:#f5a623}.fav-btn.active{color:rgb(186, 76, 37)}.body{padding:12px 14px}h3{margin:0 0 4px;font-size:15px;line-height:1.3}.types{margin:15px 0;display:flex;gap:9px}.category,.cuisine{font-size:12px;color:#777;text-transform:uppercase;letter-spacing:0.03em;border:1px solid;border-color:rgb(186, 76, 37);color:rgb(186, 76, 37);font-weight:500;border-radius:15px;padding:3px 8px}.actions{margin-top:8px}`;
|
|
4
4
|
|
|
5
5
|
const RecipeCard = class {
|
|
6
6
|
constructor(hostRef) {
|
|
@@ -103,7 +103,7 @@ const RecipeRating = class {
|
|
|
103
103
|
};
|
|
104
104
|
RecipeRating.style = recipeRatingCss();
|
|
105
105
|
|
|
106
|
-
const recipeFormCss = () => `:host{display:block;font-family:system-ui, sans-serif}form{display:flex;flex-direction:column;gap:14px}label{display:flex;flex-direction:column;gap:4px;font-size:13px;color:#333;font-weight:600}input,textarea,select{font-weight:400;padding:8px 10px;border:1px solid #ddd;border-radius:6px;font-size:14px;font-family:inherit;background:#fff;transition:border-color 0.15s ease, box-shadow 0.15s ease}input:focus,textarea:focus,select:focus{outline:none;border-color:rgb(
|
|
106
|
+
const recipeFormCss = () => `:host{display:block;font-family:system-ui, sans-serif}form{display:flex;flex-direction:column;gap:14px}label{display:flex;flex-direction:column;gap:4px;font-size:13px;color:#333;font-weight:600}input,textarea,select{font-weight:400;padding:8px 10px;border:1px solid #ddd;border-radius:6px;font-size:14px;font-family:inherit;background:#fff;transition:border-color 0.15s ease, box-shadow 0.15s ease}input:focus,textarea:focus,select:focus{outline:none;border-color:rgb(186, 76, 37);box-shadow:0 0 0 3px rgba(255, 107, 53, 0.14)}select{appearance:none;-webkit-appearance:none;-moz-appearance:none;padding-right:34px;cursor:pointer;color:#1f2937;background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");background-repeat:no-repeat;background-position:right 10px center;background-size:14px}select:hover{border-color:#bbb}select:invalid,select option[value=""]{color:#9ca3af}.row{display:grid;grid-template-columns:1fr 1fr;gap:14px}@media (max-width: 480px){.row{grid-template-columns:1fr}}.field{display:flex;flex-direction:column;gap:6px;font-size:13px;font-weight:600}.ingredient-row{display:flex;gap:6px}.ingredient-row input{flex:1}.ingredient-row button{border:none;background:#f4f4f4;border-radius:6px;cursor:pointer;width:30px}.add-btn{align-self:flex-start;border:1px dashed #bbb;background:none;border-radius:6px;padding:6px 10px;cursor:pointer;font-size:13px;color:#555}.error{color:#e74c3c;font-size:12px;font-weight:400}.footer{display:flex;justify-content:flex-end;gap:10px;margin-top:6px}.cancel-btn{border:1px solid #ddd;background:#fff;border-radius:8px;padding:8px 16px;cursor:pointer}.save-btn{border:none;background:#ff6b35;color:#fff;border-radius:8px;padding:8px 18px;cursor:pointer;font-weight:600}`;
|
|
107
107
|
|
|
108
108
|
const DEFAULT_CATEGORIES = [
|
|
109
109
|
'Beef', 'Breakfast', 'Chicken', 'Dessert', 'Goat', 'Lamb',
|
|
@@ -309,7 +309,7 @@ const MealPlanDay = class {
|
|
|
309
309
|
}
|
|
310
310
|
render() {
|
|
311
311
|
const meals = Array.isArray(this.meals) ? this.meals : [];
|
|
312
|
-
return (h("div", { key: '
|
|
312
|
+
return (h("div", { key: 'd73bf6bb744e10acdc69ea05c2982f870a03d0b6', class: "day-col" }, h("div", { key: 'dfe679f947c3ebdd8b0404a7ea4c782050039211', class: "col-header" }, this.icon && h("span", { key: '4fa3946393b5335cb45831ff8ef90da4779cb19c', class: "icon" }, this.icon), h("h3", { key: '12d82635fd098decdc880ce7a184e7b85ff74e1c' }, this.day), meals.length > 0 && h("span", { key: '94ac9aef02aef1e43b102dc2a88e394922bf277f', class: "count-badge" }, meals.length)), h("div", { key: '24ae5c9389a417f09c5def233a26f00498594bbd', class: "meals" }, meals.map((m) => (h("div", { class: "meal-chip" }, h("div", { class: "thumb" }, m.image && h("img", { src: m.image, alt: m.title })), h("span", { class: "title" }, m.title), h("button", { class: "remove-btn", onClick: () => this.removeMeal.emit({ day: this.day, mealId: m.recipeId }), "aria-label": `Remove ${m.title}` }, "\u2715")))), meals.length === 0 && h("p", { key: 'e856b918afa96cbe9c29d38e3cd7f1e970ecea3c', class: "empty" }, "No meal planned")), h("button", { key: 'eae050457a66b13cbf5975a0935843f0a5613412', class: "add-btn", onClick: () => this.assignMeal.emit({ day: this.day }) }, h("span", { key: 'f26338efd668c8dbc3a7cedbeb0e3b513baad4ee', class: "plus" }, "+"), " Add meal")));
|
|
313
313
|
}
|
|
314
314
|
};
|
|
315
315
|
MealPlanDay.style = mealPlanDayCss();
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e,c as t,h as i}from"./p-CrZUP9M-.js";const s=class{constructor(i){e(this,i),this.favoriteToggle=t(this,"favoriteToggle"),this.cardClick=t(this,"cardClick"),this.category="",this.cuisine="",this.favorite=!1,this.onFavoriteClick=e=>{e.stopPropagation(),this.favoriteToggle.emit({favorite:!this.favorite})}}render(){return i("div",{key:"64d7f6fb92a01c650f3972c4c0f0164f1904d959",class:"card",onClick:()=>this.cardClick.emit()},i("div",{key:"b9d014e3fc77346eaa76e6feb15369e9fb622624",class:"image-wrap"},this.image?i("img",{src:this.image,alt:this.recipeTitle}):i("div",{class:"placeholder"}),i("button",{key:"1690299a371310ad5e6b0e0cc238853fb3e9f439",class:{"fav-btn":!0,active:this.favorite},onClick:this.onFavoriteClick,"aria-label":"Toggle favorite"},this.favorite?"★":"☆")),i("div",{key:"52e02f3b16c2ab51209c6812aa94b4642504836a",class:"body"},i("h3",{key:"6df2f0f3146dd8ef5f91cce8e29f0dca00ffbd0a"},this.recipeTitle),i("span",{key:"072d88d380bf578e5a7a967c55d257aa604de23a",class:"types"},this.category&&i("span",{key:"636f5c1a350c93c6111415ac8a25b05301a60899",class:"category"},this.category),this.cuisine&&i("span",{key:"149cc29a60528ecd2734650b52857a00a685cfd6",class:"cuisine"},this.cuisine)),i("div",{key:"2a75de4cbb0eb4a4e37e35a29c48131c3e88080c",class:"actions"},i("slot",{key:"3c249490cef1005c546c6ee139bb70acabc41535",name:"actions"}))))}};s.style=":host{display:grid;font-family:system-ui, sans-serif}.card{border:1px solid #e5e5e5;border-radius:12px;overflow:hidden;cursor:pointer;background:#fff;transition:box-shadow 0.15s ease, transform 0.15s ease}.card:hover{box-shadow:0 4px 16px rgba(0, 0, 0, 0.08);transform:translateY(-2px)}.image-wrap{position:relative;aspect-ratio:4 / 3;background:#f2f2f2}.image-wrap img{width:100%;height:100%;object-fit:cover;display:block}.placeholder{width:100%;height:100%;background:linear-gradient(135deg, #eee, #ddd)}.fav-btn{position:absolute;top:8px;right:8px;border:none;background:rgba(255, 255, 255, 0.9);border-radius:50%;width:32px;height:32px;font-size:16px;cursor:pointer;color:#f5a623}.fav-btn.active{color:rgb(186, 76, 37)}.body{padding:12px 14px}h3{margin:0 0 4px;font-size:15px;line-height:1.3}.types{margin:15px 0;display:flex;gap:9px}.category,.cuisine{font-size:12px;color:#777;text-transform:uppercase;letter-spacing:0.03em;border:1px solid;border-color:rgb(186, 76, 37);color:rgb(186, 76, 37);font-weight:500;border-radius:15px;padding:3px 8px}.actions{margin-top:8px}";const a=class{constructor(i){e(this,i),this.search=t(this,"search"),this.placeholder="Search recipes...",this.value="",this.debounceMs=350,this.showSearchButton=!0,this.internalValue="",this.onInput=e=>{this.internalValue=e.target.value,clearTimeout(this.timer),this.timer=setTimeout((()=>{this.search.emit({value:this.internalValue})}),this.debounceMs)},this.onKeyDown=e=>{"Enter"===e.key&&(clearTimeout(this.timer),this.search.emit({value:this.internalValue}))}}componentWillLoad(){this.internalValue=this.value}onValuePropChange(e){this.internalValue=e}render(){return i("div",{key:"d984cb3aeccf96cdedb62c741956b3d12615d884",class:"wrap"},i("input",{key:"c250c60908a8bb0c7d92da5eafe6ae6a61679067",type:"search",placeholder:this.placeholder,value:this.internalValue,onInput:this.onInput,onKeyDown:this.onKeyDown}),this.showSearchButton&&i("button",{key:"6e1dfe1e6b764d9166dbcdad615f177bcd7d8d8b",onClick:()=>this.search.emit({value:this.internalValue}),"aria-label":"Search"},"🔍"))}static get watchers(){return{value:[{onValuePropChange:0}]}}};a.style=":host{display:block;font-family:system-ui, sans-serif}.wrap{display:flex;gap:6px}input{flex:1;padding:10px 14px;border-radius:8px;border:1px solid #ddd;font-size:14px;outline:none}input:focus{border-color:#ff6b35}button{border:none;background:#ff6b35;color:#fff;border-radius:8px;padding:0 16px;cursor:pointer;font-size:15px}";const r=class{constructor(i){e(this,i),this.filterChange=t(this,"filterChange"),this.categories=[],this.active=""}select(e){this.filterChange.emit({value:e})}render(){const e=Array.isArray(this.categories)?this.categories:[];return i("div",{key:"cc9c90176c682cf8b956a7b5e19096aac0891cb8",class:"wrap"},i("button",{key:"7cc54529744166d2bcf5d45873aeaec0b3a37364",class:{chip:!0,active:""===this.active},onClick:()=>this.select("")},"All"),e.map((e=>i("button",{class:{chip:!0,active:this.active===e},onClick:()=>this.select(e)},e))))}};r.style=":host{display:block;font-family:system-ui, sans-serif}.wrap{display:flex;flex-wrap:wrap;gap:8px}.chip{border:1px solid #ddd;background:#fff;border-radius:999px;padding:6px 14px;font-size:13px;cursor:pointer;color:#444}.chip.active{background:#ff6b35;border-color:#ff6b35;color:#fff}";const o=class{constructor(i){e(this,i),this.ratingChange=t(this,"ratingChange"),this.value=0,this.readonly=!1,this.max=5}render(){const e=Array.from({length:this.max},((e,t)=>t+1));return i("div",{key:"901887f72d31a470b1264d427806ea6a6184db12",class:"wrap",role:this.readonly?void 0:"radiogroup"},e.map((e=>i("span",{class:{star:!0,filled:e<=this.value,clickable:!this.readonly},onClick:()=>!this.readonly&&this.ratingChange.emit({value:e})},"★"))))}};o.style=":host{display:inline-block;font-family:system-ui, sans-serif}.wrap{display:flex;gap:2px}.star{font-size:18px;color:#ddd}.star.filled{color:#f5a623}.star.clickable{cursor:pointer}";const c=["Beef","Breakfast","Chicken","Dessert","Goat","Lamb","Miscellaneous","Pasta","Pork","Seafood","Side","Starter","Vegan","Vegetarian","Other"],n=["American","British","Chinese","Croatian","Dutch","Egyptian","Filipino","French","Greek","Indian","Irish","Italian","Jamaican","Japanese","Kenyan","Malaysian","Mexican","Moroccan","Polish","Portuguese","Russian","Spanish","Thai","Tunisian","Turkish","Vietnamese","Other"],d=class{constructor(i){e(this,i),this.save=t(this,"save"),this.cancel=t(this,"cancel"),this.categories=c,this.extraCategories=[],this.areas=n,this.extraAreas=[],this.title="",this.image="",this.category="",this.customCategory="",this.area="",this.customArea="",this.ingredients=[""],this.instructions="",this.errors={},this.onSubmit=e=>{if(e.preventDefault(),!this.validate())return;const t="Other"===this.category?this.customCategory.trim():this.category,i="Other"===this.area?this.customArea.trim():this.area,s={id:this.initialData?.id,title:this.title.trim(),image:this.image.trim(),category:t,cuisine:i,ingredients:this.ingredients.map((e=>e.trim())).filter(Boolean),instructions:this.instructions.trim()};this.save.emit(s)},this.addIngredient=()=>{this.ingredients=[...this.ingredients,""]},this.removeIngredient=e=>{this.ingredients=this.ingredients.filter(((t,i)=>i!==e));const t=this.ingredients.filter(((t,i)=>i!==e));this.ingredients=t,this.clearErrorIf("ingredients",t.some((e=>e.trim())))}}componentWillLoad(){this.loadInitialData()}onInitialDataChange(){this.loadInitialData()}mergeList(e,t){const i=[...e.filter((e=>"Other"!==e))];for(const e of t)e&&!i.includes(e)&&i.push(e);return i.push("Other"),i}get fullCategoryList(){return this.mergeList(this.categories,this.extraCategories)}get fullAreaList(){return this.mergeList(this.areas,this.extraAreas)}clearErrorIf(e,t){if(t&&this.errors[e]){const t={...this.errors};delete t[e],this.errors=t}}loadInitialData(){let e;if("string"==typeof this.initialData&&this.initialData)try{e=JSON.parse(this.initialData)}catch{e=void 0}else this.initialData&&"object"==typeof this.initialData&&(e=this.initialData);if(e){this.title=e.title??"",this.image=e.image??"",this.ingredients=e.ingredients?.length?[...e.ingredients]:[""],this.instructions=e.instructions??"";const t=this.fullCategoryList.filter((e=>"Other"!==e));e.category&&!t.includes(e.category)?(this.category="Other",this.customCategory=e.category):(this.category=e.category??"",this.customCategory="");const i=this.fullAreaList.filter((e=>"Other"!==e));e.cuisine&&!i.includes(e.cuisine)?(this.area="Other",this.customArea=e.cuisine):(this.area=e.cuisine??"",this.customArea="")}}validate(){const e={};return this.title.trim()||(e.title="Title is required."),0===this.ingredients.map((e=>e.trim())).filter(Boolean).length&&(e.ingredients="Add at least one ingredient."),this.instructions.trim()||(e.instructions="Instructions are required."),this.category.trim()?"Other"!==this.category||this.customCategory.trim()||(e.customCategory="Enter a category name."):e.category="Category is required.",this.area.trim()?"Other"!==this.area||this.customArea.trim()||(e.customArea="Enter a cuisine name."):e.area="Cuisine / Area is required.",this.errors=e,0===Object.keys(e).length}updateIngredient(e,t){const i=[...this.ingredients];i[e]=t,this.ingredients=i,this.clearErrorIf("ingredients",i.some((e=>e.trim())))}render(){return i("form",{key:"c29ab62af9db4a95e11b75f25a2dd4c23e699dad",onSubmit:this.onSubmit},i("slot",{key:"ece02ab46a1075eaef912e8953e70faa11bc8d8d",name:"header"}),i("label",{key:"9e17e9ba311350d9235f5ec01c32743dfbf55b0e"},"Title",i("input",{key:"2b8d632bc22eb5cde52198287ea2b19d87567dba",type:"text",value:this.title,onInput:e=>{this.title=e.target.value,this.clearErrorIf("title",!!this.title.trim())}}),this.errors.title&&i("span",{key:"3a34d1f5e1f43ef190983dd0883f16eb6775f07c",class:"error"},this.errors.title)),i("label",{key:"6acda6ccaff2e0315cc1964ae30c18647fe97bd1"},"Image URL",i("input",{key:"6bdc06a2bebd6b5ae984865aefe292426fbe38cb",type:"text",value:this.image,onInput:e=>this.image=e.target.value})),i("div",{key:"f6ef49aaace211659296e93b4b5b47b29db73ac6",class:"row"},i("label",{key:"9610c81a85ebddc2da4bdadcdee68ddea78e28d4"},"Category",i("select",{key:"46542ff9e2c0f15d60be6744e063f3c860475772",onInput:e=>{this.category=e.target.value,this.clearErrorIf("category",!!this.category),"Other"!==this.category&&this.clearErrorIf("customCategory",!0)}},i("option",{key:"2741b90edd32cb12903e877cbfa2db3b5ff04071",value:"",selected:""===this.category},"Select a category…"),this.fullCategoryList.map((e=>i("option",{value:e,selected:e===this.category},e)))),this.errors.category&&i("span",{key:"dc8e7ab5a6decdece1b4559af856997251335abf",class:"error"},this.errors.category)),i("label",{key:"792cb1c4fd6052f9d88c52649c6eb4dc064f0071"},"Cuisine / Area",i("select",{key:"06a917ac951a4c6d3e8390534690545a1967581a",onInput:e=>{this.area=e.target.value,this.clearErrorIf("area",!!this.area),"Other"!==this.area&&this.clearErrorIf("customArea",!0)}},i("option",{key:"264c39814065b3f07626975b96eca6b7e1c9bb83",value:"",selected:""===this.area},"Select a cuisine…"),this.fullAreaList.map((e=>i("option",{value:e,selected:e===this.area},e)))),this.errors.area&&i("span",{key:"f1a562402420fb7a813dd4184b439c03c71d93d9",class:"error"},this.errors.area))),("Other"===this.category||"Other"===this.area)&&i("div",{key:"3c20e6b5b678027d711c7976c60e3be92d02fae3",class:"row"},"Other"===this.category&&i("label",{key:"4cd14baeff186c7db8fabe57b21b241567528437",class:"custom-area-field"},"Enter category name",i("input",{key:"b1880e7aaadb3ade3c980c7f44d6b0a8d4fc3923",type:"text",placeholder:"e.g. Brunch",value:this.customCategory,onInput:e=>{this.customCategory=e.target.value,this.customCategory=e.target.value,this.clearErrorIf("customCategory",!!this.customCategory.trim())}}),this.errors.customCategory&&i("span",{key:"abd5094a23a182458ff2b76a58b55d65a9540c83",class:"error"},this.errors.customCategory)),"Other"===this.area&&i("label",{key:"696c0cc6af2cf16df8559da441e38635d8e0012c",class:"custom-area-field"},"Enter cuisine name",i("input",{key:"663fee3941527c736d953cc993b886746dabab23",type:"text",placeholder:"e.g. Ethiopian",value:this.customArea,onInput:e=>{this.customArea=e.target.value,this.clearErrorIf("customArea",!!this.customArea.trim())}}),this.errors.customArea&&i("span",{key:"6e1b7ebfac7166fb1120b0d8f914bb076f5e40ee",class:"error"},this.errors.customArea))),i("div",{key:"fe85b73291a5ee955d069f20ddf33835d09b95bd",class:"field"},i("span",{key:"fd010d7b12306bd4306caf03ebd972feb1e0ebb9"},"Ingredients"),this.ingredients.map(((e,t)=>i("div",{class:"ingredient-row"},i("input",{type:"text",value:e,onInput:e=>this.updateIngredient(t,e.target.value)}),i("button",{type:"button",onClick:()=>this.removeIngredient(t),"aria-label":"Remove"},"✕")))),i("button",{key:"8168f7e7f4bef8be1e74d1adf377b5471701c0ff",type:"button",class:"add-btn",onClick:this.addIngredient},"+ Add ingredient"),this.errors.ingredients&&i("span",{key:"3e35a8fe02833b27a333fa157548b88b3f5e3842",class:"error"},this.errors.ingredients)),i("label",{key:"c5c583cba5363ce35e6d41f95917bc49e3cca02d"},"Instructions",i("textarea",{key:"514c219989a01cf1ad77739bd6c0df066362c689",rows:5,onInput:e=>{this.instructions=e.target.value,this.clearErrorIf("instructions",!!this.instructions.trim())}},this.instructions),this.errors.instructions&&i("span",{key:"89881e3b0d4f864f7ccc835d86b094f367b54b2e",class:"error"},this.errors.instructions)),i("div",{key:"b9a812287af44062e1c68034881ba62321b0e660",class:"footer"},i("slot",{key:"a8307179d95cfd713d8f5fbe6e996fefb1d54907",name:"footer"}),i("button",{key:"aa75decaf67c74a183af182864a37a6cd37b56ff",type:"button",class:"cancel-btn",onClick:()=>this.cancel.emit()},"Cancel"),i("button",{key:"13ea35b114f1a7721347f986c6c4e64968583025",type:"submit",class:"save-btn"},"Save Recipe")))}static get watchers(){return{initialData:[{onInitialDataChange:0}]}}};d.style=":host{display:block;font-family:system-ui, sans-serif}form{display:flex;flex-direction:column;gap:14px}label{display:flex;flex-direction:column;gap:4px;font-size:13px;color:#333;font-weight:600}input,textarea,select{font-weight:400;padding:8px 10px;border:1px solid #ddd;border-radius:6px;font-size:14px;font-family:inherit;background:#fff;transition:border-color 0.15s ease, box-shadow 0.15s ease}input:focus,textarea:focus,select:focus{outline:none;border-color:rgb(186, 76, 37);box-shadow:0 0 0 3px rgba(255, 107, 53, 0.14)}select{appearance:none;-webkit-appearance:none;-moz-appearance:none;padding-right:34px;cursor:pointer;color:#1f2937;background-image:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E\");background-repeat:no-repeat;background-position:right 10px center;background-size:14px}select:hover{border-color:#bbb}select:invalid,select option[value=\"\"]{color:#9ca3af}.row{display:grid;grid-template-columns:1fr 1fr;gap:14px}@media (max-width: 480px){.row{grid-template-columns:1fr}}.field{display:flex;flex-direction:column;gap:6px;font-size:13px;font-weight:600}.ingredient-row{display:flex;gap:6px}.ingredient-row input{flex:1}.ingredient-row button{border:none;background:#f4f4f4;border-radius:6px;cursor:pointer;width:30px}.add-btn{align-self:flex-start;border:1px dashed #bbb;background:none;border-radius:6px;padding:6px 10px;cursor:pointer;font-size:13px;color:#555}.error{color:#e74c3c;font-size:12px;font-weight:400}.footer{display:flex;justify-content:flex-end;gap:10px;margin-top:6px}.cancel-btn{border:1px solid #ddd;background:#fff;border-radius:8px;padding:8px 16px;cursor:pointer}.save-btn{border:none;background:#ff6b35;color:#fff;border-radius:8px;padding:8px 18px;cursor:pointer;font-weight:600}";const l=class{constructor(i){e(this,i),this.assignMeal=t(this,"assignMeal"),this.removeMeal=t(this,"removeMeal"),this.day="",this.meals=[],this.icon=""}render(){const e=Array.isArray(this.meals)?this.meals:[];return i("div",{key:"d73bf6bb744e10acdc69ea05c2982f870a03d0b6",class:"day-col"},i("div",{key:"dfe679f947c3ebdd8b0404a7ea4c782050039211",class:"col-header"},this.icon&&i("span",{key:"4fa3946393b5335cb45831ff8ef90da4779cb19c",class:"icon"},this.icon),i("h3",{key:"12d82635fd098decdc880ce7a184e7b85ff74e1c"},this.day),e.length>0&&i("span",{key:"94ac9aef02aef1e43b102dc2a88e394922bf277f",class:"count-badge"},e.length)),i("div",{key:"24ae5c9389a417f09c5def233a26f00498594bbd",class:"meals"},e.map((e=>i("div",{class:"meal-chip"},i("div",{class:"thumb"},e.image&&i("img",{src:e.image,alt:e.title})),i("span",{class:"title"},e.title),i("button",{class:"remove-btn",onClick:()=>this.removeMeal.emit({day:this.day,mealId:e.recipeId}),"aria-label":`Remove ${e.title}`},"✕")))),0===e.length&&i("p",{key:"e856b918afa96cbe9c29d38e3cd7f1e970ecea3c",class:"empty"},"No meal planned")),i("button",{key:"eae050457a66b13cbf5975a0935843f0a5613412",class:"add-btn",onClick:()=>this.assignMeal.emit({day:this.day})},i("span",{key:"f26338efd668c8dbc3a7cedbeb0e3b513baad4ee",class:"plus"},"+")," Add meal"))}};l.style=":host{display:block;font-family:-apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif}.day-col{background:#ffffff;border:1px solid #e8eaed;border-radius:12px;padding:14px;min-width:160px;display:flex;flex-direction:column;gap:10px;box-shadow:0 1px 2px rgba(16, 24, 40, 0.04);transition:box-shadow 0.15s ease, border-color 0.15s ease}.day-col:hover{box-shadow:0 4px 12px rgba(16, 24, 40, 0.08);border-color:#d8dce1}.col-header{display:flex;align-items:center;gap:6px;padding-bottom:8px;border-bottom:1px solid #f0f1f3}.col-header .icon{font-size:15px;line-height:1}.col-header h3{margin:0;font-size:12.5px;font-weight:700;text-transform:uppercase;letter-spacing:0.05em;color:#4b5563;flex:1}.count-badge{background:#eef2ff;color:#4338ca;font-size:10.5px;font-weight:700;padding:1px 7px;border-radius:999px;line-height:1.5}.meals{display:flex;flex-direction:column;gap:6px;min-height:44px}.meal-chip{display:flex;align-items:center;gap:8px;background:#f9fafb;border:1px solid #eef0f2;border-radius:9px;padding:6px 8px;font-size:12.5px;transition:background 0.12s ease}.meal-chip:hover{background:#f3f4f6}.thumb{width:28px;height:28px;border-radius:6px;overflow:hidden;flex-shrink:0;background:#e5e7eb}.thumb img{width:100%;height:100%;object-fit:cover;display:block}.meal-chip .title{flex:1;color:#1f2937;font-weight:500;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.remove-btn{border:none;background:none;cursor:pointer;color:#9ca3af;font-size:11px;line-height:1;padding:3px;border-radius:5px;transition:color 0.12s ease, background 0.12s ease}.remove-btn:hover{color:#dc2626;background:#fef2f2}.empty{font-size:12px;color:#9ca3af;margin:6px 0;text-align:center;font-style:italic}.add-btn{display:flex;align-items:center;justify-content:center;gap:4px;border:1.5px dashed #d1d5db;background:none;border-radius:9px;padding:7px;font-size:12px;font-weight:600;cursor:pointer;color:#6b7280;transition:border-color 0.12s ease, color 0.12s ease, background 0.12s ease}.add-btn:hover{border-color:#6366f1;color:#4f46e5;background:#f5f5ff}.plus{font-size:14px;line-height:1}";const h=class{constructor(i){e(this,i),this.close=t(this,"close"),this.open=!1,this.modalTitle=""}render(){return this.open?i("div",{class:"overlay",onClick:()=>this.close.emit()},i("div",{class:"dialog",onClick:e=>e.stopPropagation()},i("div",{class:"header"},i("h2",null,this.modalTitle),i("button",{class:"close-btn",onClick:()=>this.close.emit(),"aria-label":"Close"},"✕")),i("div",{class:"body"},i("slot",null)))):null}};h.style=":host{font-family:system-ui, sans-serif}.overlay{position:fixed;inset:0;background:rgba(0, 0, 0, 0.45);display:flex;align-items:center;justify-content:center;z-index:1000}.dialog{background:#fff;border-radius:12px;min-width:320px;max-width:90vw;max-height:85vh;overflow-y:auto;padding:20px;box-shadow:0 10px 40px rgba(0,0,0,0.2)}.header{display:flex;justify-content:space-between;align-items:center;margin-bottom:12px}.header h2{margin:0;font-size:18px}.close-btn{border:none;background:none;font-size:16px;cursor:pointer;color:#666}";export{h as app_modal,l as meal_plan_day,s as recipe_card,r as recipe_filter_bar,d as recipe_form,o as recipe_rating,a as recipe_search_bar}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{p as e,b as a}from"./p-CrZUP9M-.js";export{s as setNonce}from"./p-CrZUP9M-.js";import{g as t}from"./p-DQuL1Twl.js";(()=>{const a=import.meta.url,t={};return""!==a&&(t.resourcesUrl=new URL(".",a).href),e(t)})().then((async e=>(await t(),a([["p-
|
|
1
|
+
import{p as e,b as a}from"./p-CrZUP9M-.js";export{s as setNonce}from"./p-CrZUP9M-.js";import{g as t}from"./p-DQuL1Twl.js";(()=>{const a=import.meta.url,t={};return""!==a&&(t.resourcesUrl=new URL(".",a).href),e(t)})().then((async e=>(await t(),a([["p-32969b40",[[257,"app-modal",{open:[4],modalTitle:[1,"modal-title"]}],[1,"meal-plan-day",{day:[1],meals:[16],icon:[1]}],[257,"recipe-card",{recipeTitle:[1,"recipe-title"],image:[1],category:[1],cuisine:[1],favorite:[4]}],[1,"recipe-filter-bar",{categories:[16],active:[1]}],[257,"recipe-form",{initialData:[1,"initial-data"],categories:[16],extraCategories:[16],areas:[16],extraAreas:[16],title:[32],image:[32],category:[32],customCategory:[32],area:[32],customArea:[32],ingredients:[32],instructions:[32],errors:[32]},null,{initialData:[{onInitialDataChange:0}]}],[1,"recipe-rating",{value:[2],readonly:[4],max:[2]}],[1,"recipe-search-bar",{placeholder:[1],value:[1],debounceMs:[2,"debounce-ms"],showSearchButton:[4,"show-search-button"],internalValue:[32]},null,{value:[{onValuePropChange:0}]}]]],["p-9c0be643",[[1,"app-toast",{message:[1],type:[1],duration:[2]}]]]],e))));
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{t as e,p as a,H as o,c as s,h as t}from"./p-BJU3HdRm.js";const i=a(class extends o{constructor(e){super(),!1!==e&&this.__registerHost(),this.__attachShadow(),this.assignMeal=s(this,"assignMeal"),this.removeMeal=s(this,"removeMeal"),this.day="",this.meals=[],this.icon=""}render(){const e=Array.isArray(this.meals)?this.meals:[];return t("div",{key:"cd4f194f1eeb5f53a029f380c40aa0b4ec2f32f4",class:"day-col"},t("div",{key:"d88966142d5101fc522d5de89b6d4cab72cbbbf3",class:"col-header"},this.icon&&t("span",{key:"5a9a27a3a1909bcf7295ec7eeccf309e5e2d1ae0",class:"icon"},this.icon),t("h3",{key:"fd1fa2f1274cc1f6bd8917959015722cb69002ba"},this.day),e.length>0&&t("span",{key:"feff3bc91b52203dba19f7a87c56d3813fc95cdd",class:"count-badge"},e.length)),t("div",{key:"4afee9ce77bf1447bf9e32efc7e2f9b9571873e7",class:"meals"},e.map((e=>t("div",{class:"meal-chip"},t("div",{class:"thumb"},e.image&&t("img",{src:e.image,alt:e.title})),t("span",{class:"title"},e.title),t("button",{class:"remove-btn",onClick:()=>this.removeMeal.emit({day:this.day,mealId:e.id}),"aria-label":`Remove ${e.title}`},"✕")))),0===e.length&&t("p",{key:"9a4002b1b4516fc5ff6ef8f9a2e0a7f5e8465cbd",class:"empty"},"No meal planned")),t("button",{key:"2cef3c5f7d0e89303cb8989f78eefb95c426683f",class:"add-btn",onClick:()=>this.assignMeal.emit({day:this.day})},t("span",{key:"ae54b56f8f0b01f45029e36919764ae31f3a38b9",class:"plus"},"+")," Add meal"))}static get style(){return":host{display:block;font-family:-apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif}.day-col{background:#ffffff;border:1px solid #e8eaed;border-radius:12px;padding:14px;min-width:160px;display:flex;flex-direction:column;gap:10px;box-shadow:0 1px 2px rgba(16, 24, 40, 0.04);transition:box-shadow 0.15s ease, border-color 0.15s ease}.day-col:hover{box-shadow:0 4px 12px rgba(16, 24, 40, 0.08);border-color:#d8dce1}.col-header{display:flex;align-items:center;gap:6px;padding-bottom:8px;border-bottom:1px solid #f0f1f3}.col-header .icon{font-size:15px;line-height:1}.col-header h3{margin:0;font-size:12.5px;font-weight:700;text-transform:uppercase;letter-spacing:0.05em;color:#4b5563;flex:1}.count-badge{background:#eef2ff;color:#4338ca;font-size:10.5px;font-weight:700;padding:1px 7px;border-radius:999px;line-height:1.5}.meals{display:flex;flex-direction:column;gap:6px;min-height:44px}.meal-chip{display:flex;align-items:center;gap:8px;background:#f9fafb;border:1px solid #eef0f2;border-radius:9px;padding:6px 8px;font-size:12.5px;transition:background 0.12s ease}.meal-chip:hover{background:#f3f4f6}.thumb{width:28px;height:28px;border-radius:6px;overflow:hidden;flex-shrink:0;background:#e5e7eb}.thumb img{width:100%;height:100%;object-fit:cover;display:block}.meal-chip .title{flex:1;color:#1f2937;font-weight:500;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.remove-btn{border:none;background:none;cursor:pointer;color:#9ca3af;font-size:11px;line-height:1;padding:3px;border-radius:5px;transition:color 0.12s ease, background 0.12s ease}.remove-btn:hover{color:#dc2626;background:#fef2f2}.empty{font-size:12px;color:#9ca3af;margin:6px 0;text-align:center;font-style:italic}.add-btn{display:flex;align-items:center;justify-content:center;gap:4px;border:1.5px dashed #d1d5db;background:none;border-radius:9px;padding:7px;font-size:12px;font-weight:600;cursor:pointer;color:#6b7280;transition:border-color 0.12s ease, color 0.12s ease, background 0.12s ease}.add-btn:hover{border-color:#6366f1;color:#4f46e5;background:#f5f5ff}.plus{font-size:14px;line-height:1}"}},[1,"meal-plan-day",{day:[1],meals:[16],icon:[1]}]);function d(){"undefined"!=typeof customElements&&["meal-plan-day"].forEach((a=>{"meal-plan-day"===a&&(customElements.get(e(a))||customElements.define(e(a),i))}))}d();export{i as M,d}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as e,c as t,h as i}from"./p-CrZUP9M-.js";const s=class{constructor(i){e(this,i),this.favoriteToggle=t(this,"favoriteToggle"),this.cardClick=t(this,"cardClick"),this.category="",this.cuisine="",this.favorite=!1,this.onFavoriteClick=e=>{e.stopPropagation(),this.favoriteToggle.emit({favorite:!this.favorite})}}render(){return i("div",{key:"64d7f6fb92a01c650f3972c4c0f0164f1904d959",class:"card",onClick:()=>this.cardClick.emit()},i("div",{key:"b9d014e3fc77346eaa76e6feb15369e9fb622624",class:"image-wrap"},this.image?i("img",{src:this.image,alt:this.recipeTitle}):i("div",{class:"placeholder"}),i("button",{key:"1690299a371310ad5e6b0e0cc238853fb3e9f439",class:{"fav-btn":!0,active:this.favorite},onClick:this.onFavoriteClick,"aria-label":"Toggle favorite"},this.favorite?"★":"☆")),i("div",{key:"52e02f3b16c2ab51209c6812aa94b4642504836a",class:"body"},i("h3",{key:"6df2f0f3146dd8ef5f91cce8e29f0dca00ffbd0a"},this.recipeTitle),i("span",{key:"072d88d380bf578e5a7a967c55d257aa604de23a",class:"types"},this.category&&i("span",{key:"636f5c1a350c93c6111415ac8a25b05301a60899",class:"category"},this.category),this.cuisine&&i("span",{key:"149cc29a60528ecd2734650b52857a00a685cfd6",class:"cuisine"},this.cuisine)),i("div",{key:"2a75de4cbb0eb4a4e37e35a29c48131c3e88080c",class:"actions"},i("slot",{key:"3c249490cef1005c546c6ee139bb70acabc41535",name:"actions"}))))}};s.style=":host{display:block;font-family:system-ui, sans-serif}.card{border:1px solid #e5e5e5;border-radius:12px;overflow:hidden;cursor:pointer;background:#fff;transition:box-shadow 0.15s ease, transform 0.15s ease}.card:hover{box-shadow:0 4px 16px rgba(0, 0, 0, 0.08);transform:translateY(-2px)}.image-wrap{position:relative;aspect-ratio:4 / 3;background:#f2f2f2}.image-wrap img{width:100%;height:100%;object-fit:cover;display:block}.placeholder{width:100%;height:100%;background:linear-gradient(135deg, #eee, #ddd)}.fav-btn{position:absolute;top:8px;right:8px;border:none;background:rgba(255, 255, 255, 0.9);border-radius:50%;width:32px;height:32px;font-size:16px;cursor:pointer;color:#f5a623}.fav-btn.active{color:rgb(255, 107, 53)}.body{padding:12px 14px}h3{margin:0 0 4px;font-size:15px;line-height:1.3}.types{margin:15px 0;display:flex;gap:9px}.category,.cuisine{font-size:12px;color:#777;text-transform:uppercase;letter-spacing:0.03em;border:1px solid;border-color:rgb(255, 107, 53);color:rgb(255, 107, 53);font-weight:500;border-radius:15px;padding:3px 8px}.actions{margin-top:8px}";const a=class{constructor(i){e(this,i),this.search=t(this,"search"),this.placeholder="Search recipes...",this.value="",this.debounceMs=350,this.showSearchButton=!0,this.internalValue="",this.onInput=e=>{this.internalValue=e.target.value,clearTimeout(this.timer),this.timer=setTimeout((()=>{this.search.emit({value:this.internalValue})}),this.debounceMs)},this.onKeyDown=e=>{"Enter"===e.key&&(clearTimeout(this.timer),this.search.emit({value:this.internalValue}))}}componentWillLoad(){this.internalValue=this.value}onValuePropChange(e){this.internalValue=e}render(){return i("div",{key:"d984cb3aeccf96cdedb62c741956b3d12615d884",class:"wrap"},i("input",{key:"c250c60908a8bb0c7d92da5eafe6ae6a61679067",type:"search",placeholder:this.placeholder,value:this.internalValue,onInput:this.onInput,onKeyDown:this.onKeyDown}),this.showSearchButton&&i("button",{key:"6e1dfe1e6b764d9166dbcdad615f177bcd7d8d8b",onClick:()=>this.search.emit({value:this.internalValue}),"aria-label":"Search"},"🔍"))}static get watchers(){return{value:[{onValuePropChange:0}]}}};a.style=":host{display:block;font-family:system-ui, sans-serif}.wrap{display:flex;gap:6px}input{flex:1;padding:10px 14px;border-radius:8px;border:1px solid #ddd;font-size:14px;outline:none}input:focus{border-color:#ff6b35}button{border:none;background:#ff6b35;color:#fff;border-radius:8px;padding:0 16px;cursor:pointer;font-size:15px}";const r=class{constructor(i){e(this,i),this.filterChange=t(this,"filterChange"),this.categories=[],this.active=""}select(e){this.filterChange.emit({value:e})}render(){const e=Array.isArray(this.categories)?this.categories:[];return i("div",{key:"cc9c90176c682cf8b956a7b5e19096aac0891cb8",class:"wrap"},i("button",{key:"7cc54529744166d2bcf5d45873aeaec0b3a37364",class:{chip:!0,active:""===this.active},onClick:()=>this.select("")},"All"),e.map((e=>i("button",{class:{chip:!0,active:this.active===e},onClick:()=>this.select(e)},e))))}};r.style=":host{display:block;font-family:system-ui, sans-serif}.wrap{display:flex;flex-wrap:wrap;gap:8px}.chip{border:1px solid #ddd;background:#fff;border-radius:999px;padding:6px 14px;font-size:13px;cursor:pointer;color:#444}.chip.active{background:#ff6b35;border-color:#ff6b35;color:#fff}";const o=class{constructor(i){e(this,i),this.ratingChange=t(this,"ratingChange"),this.value=0,this.readonly=!1,this.max=5}render(){const e=Array.from({length:this.max},((e,t)=>t+1));return i("div",{key:"901887f72d31a470b1264d427806ea6a6184db12",class:"wrap",role:this.readonly?void 0:"radiogroup"},e.map((e=>i("span",{class:{star:!0,filled:e<=this.value,clickable:!this.readonly},onClick:()=>!this.readonly&&this.ratingChange.emit({value:e})},"★"))))}};o.style=":host{display:inline-block;font-family:system-ui, sans-serif}.wrap{display:flex;gap:2px}.star{font-size:18px;color:#ddd}.star.filled{color:#f5a623}.star.clickable{cursor:pointer}";const c=["Beef","Breakfast","Chicken","Dessert","Goat","Lamb","Miscellaneous","Pasta","Pork","Seafood","Side","Starter","Vegan","Vegetarian","Other"],n=["American","British","Chinese","Croatian","Dutch","Egyptian","Filipino","French","Greek","Indian","Irish","Italian","Jamaican","Japanese","Kenyan","Malaysian","Mexican","Moroccan","Polish","Portuguese","Russian","Spanish","Thai","Tunisian","Turkish","Vietnamese","Other"],d=class{constructor(i){e(this,i),this.save=t(this,"save"),this.cancel=t(this,"cancel"),this.categories=c,this.extraCategories=[],this.areas=n,this.extraAreas=[],this.title="",this.image="",this.category="",this.customCategory="",this.area="",this.customArea="",this.ingredients=[""],this.instructions="",this.errors={},this.onSubmit=e=>{if(e.preventDefault(),!this.validate())return;const t="Other"===this.category?this.customCategory.trim():this.category,i="Other"===this.area?this.customArea.trim():this.area,s={id:this.initialData?.id,title:this.title.trim(),image:this.image.trim(),category:t,cuisine:i,ingredients:this.ingredients.map((e=>e.trim())).filter(Boolean),instructions:this.instructions.trim()};this.save.emit(s)},this.addIngredient=()=>{this.ingredients=[...this.ingredients,""]},this.removeIngredient=e=>{this.ingredients=this.ingredients.filter(((t,i)=>i!==e));const t=this.ingredients.filter(((t,i)=>i!==e));this.ingredients=t,this.clearErrorIf("ingredients",t.some((e=>e.trim())))}}componentWillLoad(){this.loadInitialData()}onInitialDataChange(){this.loadInitialData()}mergeList(e,t){const i=[...e.filter((e=>"Other"!==e))];for(const e of t)e&&!i.includes(e)&&i.push(e);return i.push("Other"),i}get fullCategoryList(){return this.mergeList(this.categories,this.extraCategories)}get fullAreaList(){return this.mergeList(this.areas,this.extraAreas)}clearErrorIf(e,t){if(t&&this.errors[e]){const t={...this.errors};delete t[e],this.errors=t}}loadInitialData(){let e;if("string"==typeof this.initialData&&this.initialData)try{e=JSON.parse(this.initialData)}catch{e=void 0}else this.initialData&&"object"==typeof this.initialData&&(e=this.initialData);if(e){this.title=e.title??"",this.image=e.image??"",this.ingredients=e.ingredients?.length?[...e.ingredients]:[""],this.instructions=e.instructions??"";const t=this.fullCategoryList.filter((e=>"Other"!==e));e.category&&!t.includes(e.category)?(this.category="Other",this.customCategory=e.category):(this.category=e.category??"",this.customCategory="");const i=this.fullAreaList.filter((e=>"Other"!==e));e.cuisine&&!i.includes(e.cuisine)?(this.area="Other",this.customArea=e.cuisine):(this.area=e.cuisine??"",this.customArea="")}}validate(){const e={};return this.title.trim()||(e.title="Title is required."),0===this.ingredients.map((e=>e.trim())).filter(Boolean).length&&(e.ingredients="Add at least one ingredient."),this.instructions.trim()||(e.instructions="Instructions are required."),this.category.trim()?"Other"!==this.category||this.customCategory.trim()||(e.customCategory="Enter a category name."):e.category="Category is required.",this.area.trim()?"Other"!==this.area||this.customArea.trim()||(e.customArea="Enter a cuisine name."):e.area="Cuisine / Area is required.",this.errors=e,0===Object.keys(e).length}updateIngredient(e,t){const i=[...this.ingredients];i[e]=t,this.ingredients=i,this.clearErrorIf("ingredients",i.some((e=>e.trim())))}render(){return i("form",{key:"c29ab62af9db4a95e11b75f25a2dd4c23e699dad",onSubmit:this.onSubmit},i("slot",{key:"ece02ab46a1075eaef912e8953e70faa11bc8d8d",name:"header"}),i("label",{key:"9e17e9ba311350d9235f5ec01c32743dfbf55b0e"},"Title",i("input",{key:"2b8d632bc22eb5cde52198287ea2b19d87567dba",type:"text",value:this.title,onInput:e=>{this.title=e.target.value,this.clearErrorIf("title",!!this.title.trim())}}),this.errors.title&&i("span",{key:"3a34d1f5e1f43ef190983dd0883f16eb6775f07c",class:"error"},this.errors.title)),i("label",{key:"6acda6ccaff2e0315cc1964ae30c18647fe97bd1"},"Image URL",i("input",{key:"6bdc06a2bebd6b5ae984865aefe292426fbe38cb",type:"text",value:this.image,onInput:e=>this.image=e.target.value})),i("div",{key:"f6ef49aaace211659296e93b4b5b47b29db73ac6",class:"row"},i("label",{key:"9610c81a85ebddc2da4bdadcdee68ddea78e28d4"},"Category",i("select",{key:"46542ff9e2c0f15d60be6744e063f3c860475772",onInput:e=>{this.category=e.target.value,this.clearErrorIf("category",!!this.category),"Other"!==this.category&&this.clearErrorIf("customCategory",!0)}},i("option",{key:"2741b90edd32cb12903e877cbfa2db3b5ff04071",value:"",selected:""===this.category},"Select a category…"),this.fullCategoryList.map((e=>i("option",{value:e,selected:e===this.category},e)))),this.errors.category&&i("span",{key:"dc8e7ab5a6decdece1b4559af856997251335abf",class:"error"},this.errors.category)),i("label",{key:"792cb1c4fd6052f9d88c52649c6eb4dc064f0071"},"Cuisine / Area",i("select",{key:"06a917ac951a4c6d3e8390534690545a1967581a",onInput:e=>{this.area=e.target.value,this.clearErrorIf("area",!!this.area),"Other"!==this.area&&this.clearErrorIf("customArea",!0)}},i("option",{key:"264c39814065b3f07626975b96eca6b7e1c9bb83",value:"",selected:""===this.area},"Select a cuisine…"),this.fullAreaList.map((e=>i("option",{value:e,selected:e===this.area},e)))),this.errors.area&&i("span",{key:"f1a562402420fb7a813dd4184b439c03c71d93d9",class:"error"},this.errors.area))),("Other"===this.category||"Other"===this.area)&&i("div",{key:"3c20e6b5b678027d711c7976c60e3be92d02fae3",class:"row"},"Other"===this.category&&i("label",{key:"4cd14baeff186c7db8fabe57b21b241567528437",class:"custom-area-field"},"Enter category name",i("input",{key:"b1880e7aaadb3ade3c980c7f44d6b0a8d4fc3923",type:"text",placeholder:"e.g. Brunch",value:this.customCategory,onInput:e=>{this.customCategory=e.target.value,this.customCategory=e.target.value,this.clearErrorIf("customCategory",!!this.customCategory.trim())}}),this.errors.customCategory&&i("span",{key:"abd5094a23a182458ff2b76a58b55d65a9540c83",class:"error"},this.errors.customCategory)),"Other"===this.area&&i("label",{key:"696c0cc6af2cf16df8559da441e38635d8e0012c",class:"custom-area-field"},"Enter cuisine name",i("input",{key:"663fee3941527c736d953cc993b886746dabab23",type:"text",placeholder:"e.g. Ethiopian",value:this.customArea,onInput:e=>{this.customArea=e.target.value,this.clearErrorIf("customArea",!!this.customArea.trim())}}),this.errors.customArea&&i("span",{key:"6e1b7ebfac7166fb1120b0d8f914bb076f5e40ee",class:"error"},this.errors.customArea))),i("div",{key:"fe85b73291a5ee955d069f20ddf33835d09b95bd",class:"field"},i("span",{key:"fd010d7b12306bd4306caf03ebd972feb1e0ebb9"},"Ingredients"),this.ingredients.map(((e,t)=>i("div",{class:"ingredient-row"},i("input",{type:"text",value:e,onInput:e=>this.updateIngredient(t,e.target.value)}),i("button",{type:"button",onClick:()=>this.removeIngredient(t),"aria-label":"Remove"},"✕")))),i("button",{key:"8168f7e7f4bef8be1e74d1adf377b5471701c0ff",type:"button",class:"add-btn",onClick:this.addIngredient},"+ Add ingredient"),this.errors.ingredients&&i("span",{key:"3e35a8fe02833b27a333fa157548b88b3f5e3842",class:"error"},this.errors.ingredients)),i("label",{key:"c5c583cba5363ce35e6d41f95917bc49e3cca02d"},"Instructions",i("textarea",{key:"514c219989a01cf1ad77739bd6c0df066362c689",rows:5,onInput:e=>{this.instructions=e.target.value,this.clearErrorIf("instructions",!!this.instructions.trim())}},this.instructions),this.errors.instructions&&i("span",{key:"89881e3b0d4f864f7ccc835d86b094f367b54b2e",class:"error"},this.errors.instructions)),i("div",{key:"b9a812287af44062e1c68034881ba62321b0e660",class:"footer"},i("slot",{key:"a8307179d95cfd713d8f5fbe6e996fefb1d54907",name:"footer"}),i("button",{key:"aa75decaf67c74a183af182864a37a6cd37b56ff",type:"button",class:"cancel-btn",onClick:()=>this.cancel.emit()},"Cancel"),i("button",{key:"13ea35b114f1a7721347f986c6c4e64968583025",type:"submit",class:"save-btn"},"Save Recipe")))}static get watchers(){return{initialData:[{onInitialDataChange:0}]}}};d.style=":host{display:block;font-family:system-ui, sans-serif}form{display:flex;flex-direction:column;gap:14px}label{display:flex;flex-direction:column;gap:4px;font-size:13px;color:#333;font-weight:600}input,textarea,select{font-weight:400;padding:8px 10px;border:1px solid #ddd;border-radius:6px;font-size:14px;font-family:inherit;background:#fff;transition:border-color 0.15s ease, box-shadow 0.15s ease}input:focus,textarea:focus,select:focus{outline:none;border-color:rgb(255, 107, 53);box-shadow:0 0 0 3px rgba(255, 107, 53, 0.14)}select{appearance:none;-webkit-appearance:none;-moz-appearance:none;padding-right:34px;cursor:pointer;color:#1f2937;background-image:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E\");background-repeat:no-repeat;background-position:right 10px center;background-size:14px}select:hover{border-color:#bbb}select:invalid,select option[value=\"\"]{color:#9ca3af}.row{display:grid;grid-template-columns:1fr 1fr;gap:14px}@media (max-width: 480px){.row{grid-template-columns:1fr}}.field{display:flex;flex-direction:column;gap:6px;font-size:13px;font-weight:600}.ingredient-row{display:flex;gap:6px}.ingredient-row input{flex:1}.ingredient-row button{border:none;background:#f4f4f4;border-radius:6px;cursor:pointer;width:30px}.add-btn{align-self:flex-start;border:1px dashed #bbb;background:none;border-radius:6px;padding:6px 10px;cursor:pointer;font-size:13px;color:#555}.error{color:#e74c3c;font-size:12px;font-weight:400}.footer{display:flex;justify-content:flex-end;gap:10px;margin-top:6px}.cancel-btn{border:1px solid #ddd;background:#fff;border-radius:8px;padding:8px 16px;cursor:pointer}.save-btn{border:none;background:#ff6b35;color:#fff;border-radius:8px;padding:8px 18px;cursor:pointer;font-weight:600}";const l=class{constructor(i){e(this,i),this.assignMeal=t(this,"assignMeal"),this.removeMeal=t(this,"removeMeal"),this.day="",this.meals=[],this.icon=""}render(){const e=Array.isArray(this.meals)?this.meals:[];return i("div",{key:"cd4f194f1eeb5f53a029f380c40aa0b4ec2f32f4",class:"day-col"},i("div",{key:"d88966142d5101fc522d5de89b6d4cab72cbbbf3",class:"col-header"},this.icon&&i("span",{key:"5a9a27a3a1909bcf7295ec7eeccf309e5e2d1ae0",class:"icon"},this.icon),i("h3",{key:"fd1fa2f1274cc1f6bd8917959015722cb69002ba"},this.day),e.length>0&&i("span",{key:"feff3bc91b52203dba19f7a87c56d3813fc95cdd",class:"count-badge"},e.length)),i("div",{key:"4afee9ce77bf1447bf9e32efc7e2f9b9571873e7",class:"meals"},e.map((e=>i("div",{class:"meal-chip"},i("div",{class:"thumb"},e.image&&i("img",{src:e.image,alt:e.title})),i("span",{class:"title"},e.title),i("button",{class:"remove-btn",onClick:()=>this.removeMeal.emit({day:this.day,mealId:e.id}),"aria-label":`Remove ${e.title}`},"✕")))),0===e.length&&i("p",{key:"9a4002b1b4516fc5ff6ef8f9a2e0a7f5e8465cbd",class:"empty"},"No meal planned")),i("button",{key:"2cef3c5f7d0e89303cb8989f78eefb95c426683f",class:"add-btn",onClick:()=>this.assignMeal.emit({day:this.day})},i("span",{key:"ae54b56f8f0b01f45029e36919764ae31f3a38b9",class:"plus"},"+")," Add meal"))}};l.style=":host{display:block;font-family:-apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif}.day-col{background:#ffffff;border:1px solid #e8eaed;border-radius:12px;padding:14px;min-width:160px;display:flex;flex-direction:column;gap:10px;box-shadow:0 1px 2px rgba(16, 24, 40, 0.04);transition:box-shadow 0.15s ease, border-color 0.15s ease}.day-col:hover{box-shadow:0 4px 12px rgba(16, 24, 40, 0.08);border-color:#d8dce1}.col-header{display:flex;align-items:center;gap:6px;padding-bottom:8px;border-bottom:1px solid #f0f1f3}.col-header .icon{font-size:15px;line-height:1}.col-header h3{margin:0;font-size:12.5px;font-weight:700;text-transform:uppercase;letter-spacing:0.05em;color:#4b5563;flex:1}.count-badge{background:#eef2ff;color:#4338ca;font-size:10.5px;font-weight:700;padding:1px 7px;border-radius:999px;line-height:1.5}.meals{display:flex;flex-direction:column;gap:6px;min-height:44px}.meal-chip{display:flex;align-items:center;gap:8px;background:#f9fafb;border:1px solid #eef0f2;border-radius:9px;padding:6px 8px;font-size:12.5px;transition:background 0.12s ease}.meal-chip:hover{background:#f3f4f6}.thumb{width:28px;height:28px;border-radius:6px;overflow:hidden;flex-shrink:0;background:#e5e7eb}.thumb img{width:100%;height:100%;object-fit:cover;display:block}.meal-chip .title{flex:1;color:#1f2937;font-weight:500;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.remove-btn{border:none;background:none;cursor:pointer;color:#9ca3af;font-size:11px;line-height:1;padding:3px;border-radius:5px;transition:color 0.12s ease, background 0.12s ease}.remove-btn:hover{color:#dc2626;background:#fef2f2}.empty{font-size:12px;color:#9ca3af;margin:6px 0;text-align:center;font-style:italic}.add-btn{display:flex;align-items:center;justify-content:center;gap:4px;border:1.5px dashed #d1d5db;background:none;border-radius:9px;padding:7px;font-size:12px;font-weight:600;cursor:pointer;color:#6b7280;transition:border-color 0.12s ease, color 0.12s ease, background 0.12s ease}.add-btn:hover{border-color:#6366f1;color:#4f46e5;background:#f5f5ff}.plus{font-size:14px;line-height:1}";const h=class{constructor(i){e(this,i),this.close=t(this,"close"),this.open=!1,this.modalTitle=""}render(){return this.open?i("div",{class:"overlay",onClick:()=>this.close.emit()},i("div",{class:"dialog",onClick:e=>e.stopPropagation()},i("div",{class:"header"},i("h2",null,this.modalTitle),i("button",{class:"close-btn",onClick:()=>this.close.emit(),"aria-label":"Close"},"✕")),i("div",{class:"body"},i("slot",null)))):null}};h.style=":host{font-family:system-ui, sans-serif}.overlay{position:fixed;inset:0;background:rgba(0, 0, 0, 0.45);display:flex;align-items:center;justify-content:center;z-index:1000}.dialog{background:#fff;border-radius:12px;min-width:320px;max-width:90vw;max-height:85vh;overflow-y:auto;padding:20px;box-shadow:0 10px 40px rgba(0,0,0,0.2)}.header{display:flex;justify-content:space-between;align-items:center;margin-bottom:12px}.header h2{margin:0;font-size:18px}.close-btn{border:none;background:none;font-size:16px;cursor:pointer;color:#666}";export{h as app_modal,l as meal_plan_day,s as recipe_card,r as recipe_filter_bar,d as recipe_form,o as recipe_rating,a as recipe_search_bar}
|