@gurpinderjitsingh/recipe-ui 0.3.0 → 0.4.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 +36 -11
- package/dist/cjs/app-toast.cjs.entry.js +1 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/recipe-ui.cjs.js +1 -1
- package/dist/collection/components/app-toast/app-toast.js +1 -1
- package/dist/collection/components/recipe-card/recipe-card.js +1 -1
- package/dist/collection/components/recipe-filter-bar/recipe-filter-bar.js +1 -1
- package/dist/collection/components/recipe-form/recipe-form.css +139 -17
- package/dist/collection/components/recipe-form/recipe-form.js +53 -9
- package/dist/collection/components/recipe-rating/recipe-rating.js +1 -1
- package/dist/collection/components/recipe-search-bar/recipe-search-bar.js +1 -1
- package/dist/components/app-toast.js +1 -1
- package/dist/components/index.js +1 -1
- package/dist/components/{p-BIz6x-m7.js → p-B92NkO3p.js} +1 -1
- package/dist/components/{p-CWQoij-1.js → p-BzvqJQ_R.js} +1 -1
- package/dist/components/{p-CoCM6o6z.js → p-Cn_qfIvv.js} +1 -1
- package/dist/components/{p-vGdzhVB7.js → p-K-btCLSj.js} +1 -1
- package/dist/components/{p-Ckp6dPOc.js → p-mY_lBX8M.js} +1 -1
- package/dist/components/p-u-o4onHp.js +1 -0
- package/dist/components/recipe-card.js +1 -1
- package/dist/components/recipe-filter-bar.js +1 -1
- package/dist/components/recipe-form.js +1 -1
- package/dist/components/recipe-rating.js +1 -1
- package/dist/components/recipe-search-bar.js +1 -1
- package/dist/esm/app-modal_7.entry.js +36 -11
- package/dist/esm/app-toast.entry.js +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/esm/recipe-ui.js +1 -1
- package/dist/recipe-ui/p-1f2f28cf.entry.js +1 -0
- package/dist/recipe-ui/{p-74151c7f.entry.js → p-e66a8ded.entry.js} +1 -1
- package/dist/recipe-ui/recipe-ui.esm.js +1 -1
- package/dist/types/components/recipe-form/recipe-form.d.ts +8 -4
- package/dist/types/components.d.ts +14 -4
- package/package.json +1 -1
- package/dist/components/p-xcFZ4dcw.js +0 -1
- package/dist/recipe-ui/p-e912fdc5.entry.js +0 -1
|
@@ -19,7 +19,7 @@ const RecipeCard = class {
|
|
|
19
19
|
};
|
|
20
20
|
}
|
|
21
21
|
render() {
|
|
22
|
-
return (index.h("div", { key: '
|
|
22
|
+
return (index.h("div", { key: '72e604b38c4156bfe101f0609fac315cd317c981', class: "card", onClick: () => this.cardClick.emit() }, index.h("div", { key: 'bb707d57e573970201644e029eb6257e100e2276', class: "image-wrap" }, this.image ? index.h("img", { src: this.image, alt: this.recipeTitle }) : index.h("div", { class: "placeholder" }), index.h("button", { key: 'bb052a897f227e8b8ca938704a083d8502036037', class: { 'fav-btn': true, active: this.favorite }, onClick: this.onFavoriteClick, "aria-label": "Toggle favorite" }, this.favorite ? '★' : '☆')), index.h("div", { key: 'e4c139b9bdbdac25e92def0705d8506d89a0ce65', class: "body" }, index.h("h3", { key: 'aea91bd0827cdbe2608d91b428489a11eb7de0fa' }, this.recipeTitle), this.category && index.h("span", { key: '96219817064ee274999487452db6c70dee93d82f', class: "category" }, this.category), index.h("div", { key: 'c2593b0d879744a24c4be179af1d9359e3e904fa', class: "actions" }, index.h("slot", { key: '19e921048e6d469a33531c2bb949067a7925c7ac', name: "actions" })))));
|
|
23
23
|
}
|
|
24
24
|
};
|
|
25
25
|
RecipeCard.style = recipeCardCss();
|
|
@@ -55,7 +55,7 @@ const RecipeSearchBar = class {
|
|
|
55
55
|
this.internalValue = newVal;
|
|
56
56
|
}
|
|
57
57
|
render() {
|
|
58
|
-
return (index.h("div", { key: '
|
|
58
|
+
return (index.h("div", { key: '7fa4a3ce06ef9b7e68b968a0bf29cce896cc7db0', class: "wrap" }, index.h("input", { key: 'ae2e528fafd1f342de8a88c14f0651857bc0486d', type: "search", placeholder: this.placeholder, value: this.internalValue, onInput: this.onInput, onKeyDown: this.onKeyDown }), index.h("button", { key: 'c9a369dca794014f17cd64cfaa4b7b9f0e06d171', onClick: () => this.search.emit({ value: this.internalValue }), "aria-label": "Search" }, "\uD83D\uDD0D")));
|
|
59
59
|
}
|
|
60
60
|
static get watchers() { return {
|
|
61
61
|
"value": [{
|
|
@@ -79,7 +79,7 @@ const RecipeFilterBar = class {
|
|
|
79
79
|
}
|
|
80
80
|
render() {
|
|
81
81
|
const cats = Array.isArray(this.categories) ? this.categories : [];
|
|
82
|
-
return (index.h("div", { key: '
|
|
82
|
+
return (index.h("div", { key: '336e3431325ab3338cda5be917414c6be4be1cf9', class: "wrap" }, index.h("button", { key: 'f1a5c228cf9ef1dd2017b26be55afdd07e27c837', class: { chip: true, active: this.active === '' }, onClick: () => this.select('') }, "All"), cats.map((c) => (index.h("button", { class: { chip: true, active: this.active === c }, onClick: () => this.select(c) }, c)))));
|
|
83
83
|
}
|
|
84
84
|
};
|
|
85
85
|
RecipeFilterBar.style = recipeFilterBarCss();
|
|
@@ -96,12 +96,12 @@ const RecipeRating = class {
|
|
|
96
96
|
}
|
|
97
97
|
render() {
|
|
98
98
|
const stars = Array.from({ length: this.max }, (_, i) => i + 1);
|
|
99
|
-
return (index.h("div", { key: '
|
|
99
|
+
return (index.h("div", { key: '9e67a7c471e6b20bbc2bc0164a5346c8cd5f10dc', class: "wrap", role: this.readonly ? undefined : 'radiogroup' }, stars.map((s) => (index.h("span", { class: { star: true, filled: s <= this.value, clickable: !this.readonly }, onClick: () => !this.readonly && this.ratingChange.emit({ value: s }) }, "\u2605")))));
|
|
100
100
|
}
|
|
101
101
|
};
|
|
102
102
|
RecipeRating.style = recipeRatingCss();
|
|
103
103
|
|
|
104
|
-
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{font-weight:400;padding:8px 10px;border:1px solid #ddd;border-radius:6px;font-size:14px;font-family:inherit}.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}`;
|
|
104
|
+
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:#ff6b35;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}`;
|
|
105
105
|
|
|
106
106
|
const DEFAULT_AREAS = [
|
|
107
107
|
'American', 'British', 'Chinese', 'Croatian', 'Dutch', 'Egyptian',
|
|
@@ -115,12 +115,15 @@ const RecipeForm = class {
|
|
|
115
115
|
index.registerInstance(this, hostRef);
|
|
116
116
|
this.save = index.createEvent(this, "save");
|
|
117
117
|
this.cancel = index.createEvent(this, "cancel");
|
|
118
|
-
/**
|
|
119
|
-
this.
|
|
118
|
+
/** Full override of the cuisine dropdown options */
|
|
119
|
+
this.areas = DEFAULT_AREAS;
|
|
120
|
+
/** Additional cuisine options merged in before "Other" */
|
|
121
|
+
this.extraAreas = [];
|
|
120
122
|
this.title = '';
|
|
121
123
|
this.image = '';
|
|
122
124
|
this.category = '';
|
|
123
|
-
this.
|
|
125
|
+
this.area = '';
|
|
126
|
+
this.customArea = '';
|
|
124
127
|
this.ingredients = [''];
|
|
125
128
|
this.instructions = '';
|
|
126
129
|
this.errors = {};
|
|
@@ -128,12 +131,13 @@ const RecipeForm = class {
|
|
|
128
131
|
e.preventDefault();
|
|
129
132
|
if (!this.validate())
|
|
130
133
|
return;
|
|
134
|
+
const resolvedArea = this.area === 'Other' ? this.customArea.trim() : this.area;
|
|
131
135
|
const data = {
|
|
132
136
|
id: this.initialData?.id,
|
|
133
137
|
title: this.title.trim(),
|
|
134
138
|
image: this.image.trim(),
|
|
135
139
|
category: this.category.trim(),
|
|
136
|
-
|
|
140
|
+
area: resolvedArea,
|
|
137
141
|
ingredients: this.ingredients.map((i) => i.trim()).filter(Boolean),
|
|
138
142
|
instructions: this.instructions.trim(),
|
|
139
143
|
};
|
|
@@ -152,6 +156,16 @@ const RecipeForm = class {
|
|
|
152
156
|
onInitialDataChange() {
|
|
153
157
|
this.loadInitialData();
|
|
154
158
|
}
|
|
159
|
+
get fullAreaList() {
|
|
160
|
+
const withoutOther = this.areas.filter((a) => a !== 'Other');
|
|
161
|
+
const merged = [...withoutOther];
|
|
162
|
+
for (const extra of this.extraAreas) {
|
|
163
|
+
if (extra && !merged.includes(extra))
|
|
164
|
+
merged.push(extra);
|
|
165
|
+
}
|
|
166
|
+
merged.push('Other');
|
|
167
|
+
return merged;
|
|
168
|
+
}
|
|
155
169
|
loadInitialData() {
|
|
156
170
|
let data;
|
|
157
171
|
if (typeof this.initialData === 'string' && this.initialData) {
|
|
@@ -169,9 +183,17 @@ const RecipeForm = class {
|
|
|
169
183
|
this.title = data.title ?? '';
|
|
170
184
|
this.image = data.image ?? '';
|
|
171
185
|
this.category = data.category ?? '';
|
|
172
|
-
this.cuisine = data.cuisine ?? '';
|
|
173
186
|
this.ingredients = data.ingredients?.length ? [...data.ingredients] : [''];
|
|
174
187
|
this.instructions = data.instructions ?? '';
|
|
188
|
+
const knownAreas = this.fullAreaList.filter((a) => a !== 'Other');
|
|
189
|
+
if (data.area && !knownAreas.includes(data.area)) {
|
|
190
|
+
this.area = 'Other';
|
|
191
|
+
this.customArea = data.area;
|
|
192
|
+
}
|
|
193
|
+
else {
|
|
194
|
+
this.area = data.area ?? '';
|
|
195
|
+
this.customArea = '';
|
|
196
|
+
}
|
|
175
197
|
}
|
|
176
198
|
}
|
|
177
199
|
validate() {
|
|
@@ -183,6 +205,9 @@ const RecipeForm = class {
|
|
|
183
205
|
errors.ingredients = 'Add at least one ingredient.';
|
|
184
206
|
if (!this.instructions.trim())
|
|
185
207
|
errors.instructions = 'Instructions are required.';
|
|
208
|
+
if (this.area === 'Other' && !this.customArea.trim()) {
|
|
209
|
+
errors.customArea = 'Enter a cuisine name.';
|
|
210
|
+
}
|
|
186
211
|
this.errors = errors;
|
|
187
212
|
return Object.keys(errors).length === 0;
|
|
188
213
|
}
|
|
@@ -192,7 +217,7 @@ const RecipeForm = class {
|
|
|
192
217
|
this.ingredients = next;
|
|
193
218
|
}
|
|
194
219
|
render() {
|
|
195
|
-
return (index.h("form", { key: '
|
|
220
|
+
return (index.h("form", { key: 'b9e50e96b20b8f3bb28ecb516b102c87088daddd', onSubmit: this.onSubmit }, index.h("slot", { key: '648424eb3444acdacb69e541799571ffa6572004', name: "header" }), index.h("label", { key: '77ec1e8acd2ba845262909f672fadf06907702f2' }, "Title", index.h("input", { key: '2f5dd98ab985831eb07ac43afed983908f2646d1', type: "text", value: this.title, onInput: (e) => (this.title = e.target.value) }), this.errors.title && index.h("span", { key: '244560b4dc4cb47cbb514d0f8fe41be267299885', class: "error" }, this.errors.title)), index.h("label", { key: '8bb49420325a7629186a5801162b9a2e4321e4f7' }, "Image URL", index.h("input", { key: 'fe121c2389308b5bc0e6f7b977f15fec91f9baae', type: "text", value: this.image, onInput: (e) => (this.image = e.target.value) })), index.h("div", { key: '2ede3939f5230f805841945a29fc37fc4d2f3627', class: "row" }, index.h("label", { key: 'b736ee46a12a1070cb52c76fc41d31e0f8d1169b' }, "Category", index.h("input", { key: '6952f8378b13313c1c63d2cb1b1cd9c2593d1806', type: "text", value: this.category, onInput: (e) => (this.category = e.target.value) })), index.h("label", { key: 'a6e477f0bfdfbab6a75831a62334b665272a98db' }, "Cuisine / Area", index.h("select", { key: '1434d68a1782d19f92cd2d5ef638f440a8adc7dd', onInput: (e) => (this.area = e.target.value) }, index.h("option", { key: 'a40b1cacf4deb98590689325f23e572522069268', value: "", selected: this.area === '' }, "Select a cuisine\u2026"), this.fullAreaList.map((a) => (index.h("option", { value: a, selected: a === this.area }, a)))))), this.area === 'Other' && (index.h("label", { key: '77ab0849f544aacc7c2a207dc222c916dfb7a41b', class: "custom-area-field" }, "Enter cuisine name", index.h("input", { key: 'fd7c97a89c0e2b8f23cc28fbc502563eb759fdb4', type: "text", placeholder: "e.g. Ethiopian", value: this.customArea, onInput: (e) => (this.customArea = e.target.value) }), this.errors.customArea && index.h("span", { key: '2b2425b63b0d5ee311fe16040d012a43919c8ca6', class: "error" }, this.errors.customArea))), index.h("div", { key: 'fafa1824f121c9c2c96069772d2011a13ce0683f', class: "field" }, index.h("span", { key: 'bea9e5877093e412b1fffb12f0aad4c79604cc16' }, "Ingredients"), this.ingredients.map((ing, i) => (index.h("div", { class: "ingredient-row" }, index.h("input", { type: "text", value: ing, onInput: (e) => this.updateIngredient(i, e.target.value) }), index.h("button", { type: "button", onClick: () => this.removeIngredient(i), "aria-label": "Remove" }, "\u2715")))), index.h("button", { key: 'fc7a817c01706f4f99594ff09a72fa8b046f4820', type: "button", class: "add-btn", onClick: this.addIngredient }, "+ Add ingredient"), this.errors.ingredients && index.h("span", { key: 'd4b4bee30e1369f951f0aabe7f54b0b1ae393a83', class: "error" }, this.errors.ingredients)), index.h("label", { key: '5028ae3ead65e280a2196f93d5f31580a5f8c95a' }, "Instructions", index.h("textarea", { key: '08461bc98ab47d1f2240dfa23e1ec1264de12002', rows: 5, onInput: (e) => (this.instructions = e.target.value) }, this.instructions), this.errors.instructions && index.h("span", { key: '932de400651f180d7e5b14e4ff118ccdcd24d2b3', class: "error" }, this.errors.instructions)), index.h("div", { key: '7da02b77a1390447a738882d0104292b28f675b0', class: "footer" }, index.h("slot", { key: '74ed118f385e1e6e1318dd405aa0008e195ef9c0', name: "footer" }), index.h("button", { key: 'e2548efd3826d3a984c11cd6d7bd486e226c8ca9', type: "button", class: "cancel-btn", onClick: () => this.cancel.emit() }, "Cancel"), index.h("button", { key: '8011e51d4579a0e6ddd88cd8c83708524551d801', type: "submit", class: "save-btn" }, "Save Recipe"))));
|
|
196
221
|
}
|
|
197
222
|
static get watchers() { return {
|
|
198
223
|
"initialData": [{
|
|
@@ -18,7 +18,7 @@ const AppToast = class {
|
|
|
18
18
|
}
|
|
19
19
|
}
|
|
20
20
|
render() {
|
|
21
|
-
return (index.h("div", { key: '
|
|
21
|
+
return (index.h("div", { key: '40cf0d0171712b45dd8786bd69aa2f94a1fc7335', class: `toast ${this.type}` }, index.h("span", { key: '5256c39505158066715c94420ff65a479a7ab382' }, this.message), index.h("button", { key: '523f0f7617a902910d13179147ca75fa57499433', onClick: () => this.dismiss.emit(), "aria-label": "Dismiss" }, "\u2715")));
|
|
22
22
|
}
|
|
23
23
|
};
|
|
24
24
|
AppToast.style = appToastCss();
|
package/dist/cjs/loader.cjs.js
CHANGED
|
@@ -6,7 +6,7 @@ var appGlobals = require('./app-globals-V2Kpy_OQ.js');
|
|
|
6
6
|
const defineCustomElements = async (win, options) => {
|
|
7
7
|
if (typeof window === 'undefined') return undefined;
|
|
8
8
|
await appGlobals.globalScripts();
|
|
9
|
-
return index.bootstrapLazy([["app-modal_7.cjs",[[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],"favorite":[4]}],[1,"recipe-filter-bar",{"categories":[16],"active":[1]}],[257,"recipe-form",{"initialData":[1,"initial-data"],"
|
|
9
|
+
return index.bootstrapLazy([["app-modal_7.cjs",[[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],"favorite":[4]}],[1,"recipe-filter-bar",{"categories":[16],"active":[1]}],[257,"recipe-form",{"initialData":[1,"initial-data"],"areas":[16],"extraAreas":[16],"title":[32],"image":[32],"category":[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"],"internalValue":[32]},null,{"value":[{"onValuePropChange":0}]}]]],["app-toast.cjs",[[1,"app-toast",{"message":[1],"type":[1],"duration":[2]}]]]], options);
|
|
10
10
|
};
|
|
11
11
|
|
|
12
12
|
exports.setNonce = index.setNonce;
|
|
@@ -19,7 +19,7 @@ var patchBrowser = () => {
|
|
|
19
19
|
|
|
20
20
|
patchBrowser().then(async (options) => {
|
|
21
21
|
await appGlobals.globalScripts();
|
|
22
|
-
return index.bootstrapLazy([["app-modal_7.cjs",[[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],"favorite":[4]}],[1,"recipe-filter-bar",{"categories":[16],"active":[1]}],[257,"recipe-form",{"initialData":[1,"initial-data"],"
|
|
22
|
+
return index.bootstrapLazy([["app-modal_7.cjs",[[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],"favorite":[4]}],[1,"recipe-filter-bar",{"categories":[16],"active":[1]}],[257,"recipe-form",{"initialData":[1,"initial-data"],"areas":[16],"extraAreas":[16],"title":[32],"image":[32],"category":[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"],"internalValue":[32]},null,{"value":[{"onValuePropChange":0}]}]]],["app-toast.cjs",[[1,"app-toast",{"message":[1],"type":[1],"duration":[2]}]]]], options);
|
|
23
23
|
});
|
|
24
24
|
|
|
25
25
|
exports.setNonce = index.setNonce;
|
|
@@ -12,7 +12,7 @@ export class AppToast {
|
|
|
12
12
|
}
|
|
13
13
|
}
|
|
14
14
|
render() {
|
|
15
|
-
return (h("div", { key: '
|
|
15
|
+
return (h("div", { key: '40cf0d0171712b45dd8786bd69aa2f94a1fc7335', class: `toast ${this.type}` }, h("span", { key: '5256c39505158066715c94420ff65a479a7ab382' }, this.message), h("button", { key: '523f0f7617a902910d13179147ca75fa57499433', onClick: () => this.dismiss.emit(), "aria-label": "Dismiss" }, "\u2715")));
|
|
16
16
|
}
|
|
17
17
|
static get is() { return "app-toast"; }
|
|
18
18
|
static get encapsulation() { return "shadow"; }
|
|
@@ -17,7 +17,7 @@ export class RecipeCard {
|
|
|
17
17
|
};
|
|
18
18
|
}
|
|
19
19
|
render() {
|
|
20
|
-
return (h("div", { key: '
|
|
20
|
+
return (h("div", { key: '72e604b38c4156bfe101f0609fac315cd317c981', class: "card", onClick: () => this.cardClick.emit() }, h("div", { key: 'bb707d57e573970201644e029eb6257e100e2276', class: "image-wrap" }, this.image ? h("img", { src: this.image, alt: this.recipeTitle }) : h("div", { class: "placeholder" }), h("button", { key: 'bb052a897f227e8b8ca938704a083d8502036037', class: { 'fav-btn': true, active: this.favorite }, onClick: this.onFavoriteClick, "aria-label": "Toggle favorite" }, this.favorite ? '★' : '☆')), h("div", { key: 'e4c139b9bdbdac25e92def0705d8506d89a0ce65', class: "body" }, h("h3", { key: 'aea91bd0827cdbe2608d91b428489a11eb7de0fa' }, this.recipeTitle), this.category && h("span", { key: '96219817064ee274999487452db6c70dee93d82f', class: "category" }, this.category), h("div", { key: 'c2593b0d879744a24c4be179af1d9359e3e904fa', class: "actions" }, h("slot", { key: '19e921048e6d469a33531c2bb949067a7925c7ac', name: "actions" })))));
|
|
21
21
|
}
|
|
22
22
|
static get is() { return "recipe-card"; }
|
|
23
23
|
static get encapsulation() { return "shadow"; }
|
|
@@ -15,7 +15,7 @@ export class RecipeFilterBar {
|
|
|
15
15
|
}
|
|
16
16
|
render() {
|
|
17
17
|
const cats = Array.isArray(this.categories) ? this.categories : [];
|
|
18
|
-
return (h("div", { key: '
|
|
18
|
+
return (h("div", { key: '336e3431325ab3338cda5be917414c6be4be1cf9', class: "wrap" }, h("button", { key: 'f1a5c228cf9ef1dd2017b26be55afdd07e27c837', class: { chip: true, active: this.active === '' }, onClick: () => this.select('') }, "All"), cats.map((c) => (h("button", { class: { chip: true, active: this.active === c }, onClick: () => this.select(c) }, c)))));
|
|
19
19
|
}
|
|
20
20
|
static get is() { return "recipe-filter-bar"; }
|
|
21
21
|
static get encapsulation() { return "shadow"; }
|
|
@@ -1,19 +1,141 @@
|
|
|
1
|
-
:host {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
1
|
+
:host {
|
|
2
|
+
display: block;
|
|
3
|
+
font-family: system-ui, sans-serif;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
form {
|
|
7
|
+
display: flex;
|
|
8
|
+
flex-direction: column;
|
|
9
|
+
gap: 14px;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
label {
|
|
13
|
+
display: flex;
|
|
14
|
+
flex-direction: column;
|
|
15
|
+
gap: 4px;
|
|
16
|
+
font-size: 13px;
|
|
17
|
+
color: #333;
|
|
18
|
+
font-weight: 600;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
input,
|
|
22
|
+
textarea,
|
|
23
|
+
select {
|
|
24
|
+
font-weight: 400;
|
|
25
|
+
padding: 8px 10px;
|
|
26
|
+
border: 1px solid #ddd;
|
|
27
|
+
border-radius: 6px;
|
|
28
|
+
font-size: 14px;
|
|
29
|
+
font-family: inherit;
|
|
30
|
+
background: #fff;
|
|
31
|
+
transition: border-color 0.15s ease, box-shadow 0.15s ease;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
input:focus,
|
|
35
|
+
textarea:focus,
|
|
36
|
+
select:focus {
|
|
37
|
+
outline: none;
|
|
38
|
+
border-color: #ff6b35;
|
|
39
|
+
box-shadow: 0 0 0 3px rgba(255, 107, 53, 0.14);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
select {
|
|
43
|
+
appearance: none;
|
|
44
|
+
-webkit-appearance: none;
|
|
45
|
+
-moz-appearance: none;
|
|
46
|
+
padding-right: 34px;
|
|
47
|
+
cursor: pointer;
|
|
48
|
+
color: #1f2937;
|
|
49
|
+
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");
|
|
50
|
+
background-repeat: no-repeat;
|
|
51
|
+
background-position: right 10px center;
|
|
52
|
+
background-size: 14px;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
select:hover {
|
|
56
|
+
border-color: #bbb;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
select:invalid,
|
|
60
|
+
select option[value=""] {
|
|
61
|
+
color: #9ca3af;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
.row {
|
|
65
|
+
display: grid;
|
|
66
|
+
grid-template-columns: 1fr 1fr;
|
|
67
|
+
gap: 14px;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
@media (max-width: 480px) {
|
|
71
|
+
.row {
|
|
72
|
+
grid-template-columns: 1fr;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
.field {
|
|
77
|
+
display: flex;
|
|
78
|
+
flex-direction: column;
|
|
79
|
+
gap: 6px;
|
|
80
|
+
font-size: 13px;
|
|
81
|
+
font-weight: 600;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
.ingredient-row {
|
|
85
|
+
display: flex;
|
|
86
|
+
gap: 6px;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
.ingredient-row input {
|
|
90
|
+
flex: 1;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
.ingredient-row button {
|
|
94
|
+
border: none;
|
|
95
|
+
background: #f4f4f4;
|
|
96
|
+
border-radius: 6px;
|
|
97
|
+
cursor: pointer;
|
|
98
|
+
width: 30px;
|
|
99
|
+
}
|
|
100
|
+
|
|
12
101
|
.add-btn {
|
|
13
|
-
align-self: flex-start;
|
|
14
|
-
|
|
102
|
+
align-self: flex-start;
|
|
103
|
+
border: 1px dashed #bbb;
|
|
104
|
+
background: none;
|
|
105
|
+
border-radius: 6px;
|
|
106
|
+
padding: 6px 10px;
|
|
107
|
+
cursor: pointer;
|
|
108
|
+
font-size: 13px;
|
|
109
|
+
color: #555;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
.error {
|
|
113
|
+
color: #e74c3c;
|
|
114
|
+
font-size: 12px;
|
|
115
|
+
font-weight: 400;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
.footer {
|
|
119
|
+
display: flex;
|
|
120
|
+
justify-content: flex-end;
|
|
121
|
+
gap: 10px;
|
|
122
|
+
margin-top: 6px;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
.cancel-btn {
|
|
126
|
+
border: 1px solid #ddd;
|
|
127
|
+
background: #fff;
|
|
128
|
+
border-radius: 8px;
|
|
129
|
+
padding: 8px 16px;
|
|
130
|
+
cursor: pointer;
|
|
15
131
|
}
|
|
16
|
-
|
|
17
|
-
.
|
|
18
|
-
|
|
19
|
-
|
|
132
|
+
|
|
133
|
+
.save-btn {
|
|
134
|
+
border: none;
|
|
135
|
+
background: #ff6b35;
|
|
136
|
+
color: #fff;
|
|
137
|
+
border-radius: 8px;
|
|
138
|
+
padding: 8px 18px;
|
|
139
|
+
cursor: pointer;
|
|
140
|
+
font-weight: 600;
|
|
141
|
+
}
|
|
@@ -8,12 +8,15 @@ const DEFAULT_AREAS = [
|
|
|
8
8
|
];
|
|
9
9
|
export class RecipeForm {
|
|
10
10
|
constructor() {
|
|
11
|
-
/**
|
|
12
|
-
this.
|
|
11
|
+
/** Full override of the cuisine dropdown options */
|
|
12
|
+
this.areas = DEFAULT_AREAS;
|
|
13
|
+
/** Additional cuisine options merged in before "Other" */
|
|
14
|
+
this.extraAreas = [];
|
|
13
15
|
this.title = '';
|
|
14
16
|
this.image = '';
|
|
15
17
|
this.category = '';
|
|
16
|
-
this.
|
|
18
|
+
this.area = '';
|
|
19
|
+
this.customArea = '';
|
|
17
20
|
this.ingredients = [''];
|
|
18
21
|
this.instructions = '';
|
|
19
22
|
this.errors = {};
|
|
@@ -21,12 +24,13 @@ export class RecipeForm {
|
|
|
21
24
|
e.preventDefault();
|
|
22
25
|
if (!this.validate())
|
|
23
26
|
return;
|
|
27
|
+
const resolvedArea = this.area === 'Other' ? this.customArea.trim() : this.area;
|
|
24
28
|
const data = {
|
|
25
29
|
id: this.initialData?.id,
|
|
26
30
|
title: this.title.trim(),
|
|
27
31
|
image: this.image.trim(),
|
|
28
32
|
category: this.category.trim(),
|
|
29
|
-
|
|
33
|
+
area: resolvedArea,
|
|
30
34
|
ingredients: this.ingredients.map((i) => i.trim()).filter(Boolean),
|
|
31
35
|
instructions: this.instructions.trim(),
|
|
32
36
|
};
|
|
@@ -45,6 +49,16 @@ export class RecipeForm {
|
|
|
45
49
|
onInitialDataChange() {
|
|
46
50
|
this.loadInitialData();
|
|
47
51
|
}
|
|
52
|
+
get fullAreaList() {
|
|
53
|
+
const withoutOther = this.areas.filter((a) => a !== 'Other');
|
|
54
|
+
const merged = [...withoutOther];
|
|
55
|
+
for (const extra of this.extraAreas) {
|
|
56
|
+
if (extra && !merged.includes(extra))
|
|
57
|
+
merged.push(extra);
|
|
58
|
+
}
|
|
59
|
+
merged.push('Other');
|
|
60
|
+
return merged;
|
|
61
|
+
}
|
|
48
62
|
loadInitialData() {
|
|
49
63
|
let data;
|
|
50
64
|
if (typeof this.initialData === 'string' && this.initialData) {
|
|
@@ -62,9 +76,17 @@ export class RecipeForm {
|
|
|
62
76
|
this.title = data.title ?? '';
|
|
63
77
|
this.image = data.image ?? '';
|
|
64
78
|
this.category = data.category ?? '';
|
|
65
|
-
this.cuisine = data.cuisine ?? '';
|
|
66
79
|
this.ingredients = data.ingredients?.length ? [...data.ingredients] : [''];
|
|
67
80
|
this.instructions = data.instructions ?? '';
|
|
81
|
+
const knownAreas = this.fullAreaList.filter((a) => a !== 'Other');
|
|
82
|
+
if (data.area && !knownAreas.includes(data.area)) {
|
|
83
|
+
this.area = 'Other';
|
|
84
|
+
this.customArea = data.area;
|
|
85
|
+
}
|
|
86
|
+
else {
|
|
87
|
+
this.area = data.area ?? '';
|
|
88
|
+
this.customArea = '';
|
|
89
|
+
}
|
|
68
90
|
}
|
|
69
91
|
}
|
|
70
92
|
validate() {
|
|
@@ -76,6 +98,9 @@ export class RecipeForm {
|
|
|
76
98
|
errors.ingredients = 'Add at least one ingredient.';
|
|
77
99
|
if (!this.instructions.trim())
|
|
78
100
|
errors.instructions = 'Instructions are required.';
|
|
101
|
+
if (this.area === 'Other' && !this.customArea.trim()) {
|
|
102
|
+
errors.customArea = 'Enter a cuisine name.';
|
|
103
|
+
}
|
|
79
104
|
this.errors = errors;
|
|
80
105
|
return Object.keys(errors).length === 0;
|
|
81
106
|
}
|
|
@@ -85,7 +110,7 @@ export class RecipeForm {
|
|
|
85
110
|
this.ingredients = next;
|
|
86
111
|
}
|
|
87
112
|
render() {
|
|
88
|
-
return (h("form", { key: '
|
|
113
|
+
return (h("form", { key: 'b9e50e96b20b8f3bb28ecb516b102c87088daddd', onSubmit: this.onSubmit }, h("slot", { key: '648424eb3444acdacb69e541799571ffa6572004', name: "header" }), h("label", { key: '77ec1e8acd2ba845262909f672fadf06907702f2' }, "Title", h("input", { key: '2f5dd98ab985831eb07ac43afed983908f2646d1', type: "text", value: this.title, onInput: (e) => (this.title = e.target.value) }), this.errors.title && h("span", { key: '244560b4dc4cb47cbb514d0f8fe41be267299885', class: "error" }, this.errors.title)), h("label", { key: '8bb49420325a7629186a5801162b9a2e4321e4f7' }, "Image URL", h("input", { key: 'fe121c2389308b5bc0e6f7b977f15fec91f9baae', type: "text", value: this.image, onInput: (e) => (this.image = e.target.value) })), h("div", { key: '2ede3939f5230f805841945a29fc37fc4d2f3627', class: "row" }, h("label", { key: 'b736ee46a12a1070cb52c76fc41d31e0f8d1169b' }, "Category", h("input", { key: '6952f8378b13313c1c63d2cb1b1cd9c2593d1806', type: "text", value: this.category, onInput: (e) => (this.category = e.target.value) })), h("label", { key: 'a6e477f0bfdfbab6a75831a62334b665272a98db' }, "Cuisine / Area", h("select", { key: '1434d68a1782d19f92cd2d5ef638f440a8adc7dd', onInput: (e) => (this.area = e.target.value) }, h("option", { key: 'a40b1cacf4deb98590689325f23e572522069268', value: "", selected: this.area === '' }, "Select a cuisine\u2026"), this.fullAreaList.map((a) => (h("option", { value: a, selected: a === this.area }, a)))))), this.area === 'Other' && (h("label", { key: '77ab0849f544aacc7c2a207dc222c916dfb7a41b', class: "custom-area-field" }, "Enter cuisine name", h("input", { key: 'fd7c97a89c0e2b8f23cc28fbc502563eb759fdb4', type: "text", placeholder: "e.g. Ethiopian", value: this.customArea, onInput: (e) => (this.customArea = e.target.value) }), this.errors.customArea && h("span", { key: '2b2425b63b0d5ee311fe16040d012a43919c8ca6', class: "error" }, this.errors.customArea))), h("div", { key: 'fafa1824f121c9c2c96069772d2011a13ce0683f', class: "field" }, h("span", { key: 'bea9e5877093e412b1fffb12f0aad4c79604cc16' }, "Ingredients"), this.ingredients.map((ing, i) => (h("div", { class: "ingredient-row" }, h("input", { type: "text", value: ing, onInput: (e) => this.updateIngredient(i, e.target.value) }), h("button", { type: "button", onClick: () => this.removeIngredient(i), "aria-label": "Remove" }, "\u2715")))), h("button", { key: 'fc7a817c01706f4f99594ff09a72fa8b046f4820', type: "button", class: "add-btn", onClick: this.addIngredient }, "+ Add ingredient"), this.errors.ingredients && h("span", { key: 'd4b4bee30e1369f951f0aabe7f54b0b1ae393a83', class: "error" }, this.errors.ingredients)), h("label", { key: '5028ae3ead65e280a2196f93d5f31580a5f8c95a' }, "Instructions", h("textarea", { key: '08461bc98ab47d1f2240dfa23e1ec1264de12002', rows: 5, onInput: (e) => (this.instructions = e.target.value) }, this.instructions), this.errors.instructions && h("span", { key: '932de400651f180d7e5b14e4ff118ccdcd24d2b3', class: "error" }, this.errors.instructions)), h("div", { key: '7da02b77a1390447a738882d0104292b28f675b0', class: "footer" }, h("slot", { key: '74ed118f385e1e6e1318dd405aa0008e195ef9c0', name: "footer" }), h("button", { key: 'e2548efd3826d3a984c11cd6d7bd486e226c8ca9', type: "button", class: "cancel-btn", onClick: () => this.cancel.emit() }, "Cancel"), h("button", { key: '8011e51d4579a0e6ddd88cd8c83708524551d801', type: "submit", class: "save-btn" }, "Save Recipe"))));
|
|
89
114
|
}
|
|
90
115
|
static get is() { return "recipe-form"; }
|
|
91
116
|
static get encapsulation() { return "shadow"; }
|
|
@@ -126,7 +151,7 @@ export class RecipeForm {
|
|
|
126
151
|
"reflect": false,
|
|
127
152
|
"attribute": "initial-data"
|
|
128
153
|
},
|
|
129
|
-
"
|
|
154
|
+
"areas": {
|
|
130
155
|
"type": "unknown",
|
|
131
156
|
"mutable": false,
|
|
132
157
|
"complexType": {
|
|
@@ -138,11 +163,29 @@ export class RecipeForm {
|
|
|
138
163
|
"optional": false,
|
|
139
164
|
"docs": {
|
|
140
165
|
"tags": [],
|
|
141
|
-
"text": "
|
|
166
|
+
"text": "Full override of the cuisine dropdown options"
|
|
142
167
|
},
|
|
143
168
|
"getter": false,
|
|
144
169
|
"setter": false,
|
|
145
170
|
"defaultValue": "[\n 'American', 'British', 'Chinese', 'Croatian', 'Dutch', 'Egyptian',\n 'Filipino', 'French', 'Greek', 'Indian', 'Irish', 'Italian', 'Jamaican',\n 'Japanese', 'Kenyan', 'Malaysian', 'Mexican', 'Moroccan', 'Polish',\n 'Portuguese', 'Russian', 'Spanish', 'Thai', 'Tunisian', 'Turkish',\n 'Vietnamese', 'Other',\n]"
|
|
171
|
+
},
|
|
172
|
+
"extraAreas": {
|
|
173
|
+
"type": "unknown",
|
|
174
|
+
"mutable": false,
|
|
175
|
+
"complexType": {
|
|
176
|
+
"original": "string[]",
|
|
177
|
+
"resolved": "string[]",
|
|
178
|
+
"references": {}
|
|
179
|
+
},
|
|
180
|
+
"required": false,
|
|
181
|
+
"optional": false,
|
|
182
|
+
"docs": {
|
|
183
|
+
"tags": [],
|
|
184
|
+
"text": "Additional cuisine options merged in before \"Other\""
|
|
185
|
+
},
|
|
186
|
+
"getter": false,
|
|
187
|
+
"setter": false,
|
|
188
|
+
"defaultValue": "[]"
|
|
146
189
|
}
|
|
147
190
|
};
|
|
148
191
|
}
|
|
@@ -151,7 +194,8 @@ export class RecipeForm {
|
|
|
151
194
|
"title": {},
|
|
152
195
|
"image": {},
|
|
153
196
|
"category": {},
|
|
154
|
-
"
|
|
197
|
+
"area": {},
|
|
198
|
+
"customArea": {},
|
|
155
199
|
"ingredients": {},
|
|
156
200
|
"instructions": {},
|
|
157
201
|
"errors": {}
|
|
@@ -8,7 +8,7 @@ export class RecipeRating {
|
|
|
8
8
|
}
|
|
9
9
|
render() {
|
|
10
10
|
const stars = Array.from({ length: this.max }, (_, i) => i + 1);
|
|
11
|
-
return (h("div", { key: '
|
|
11
|
+
return (h("div", { key: '9e67a7c471e6b20bbc2bc0164a5346c8cd5f10dc', class: "wrap", role: this.readonly ? undefined : 'radiogroup' }, stars.map((s) => (h("span", { class: { star: true, filled: s <= this.value, clickable: !this.readonly }, onClick: () => !this.readonly && this.ratingChange.emit({ value: s }) }, "\u2605")))));
|
|
12
12
|
}
|
|
13
13
|
static get is() { return "recipe-rating"; }
|
|
14
14
|
static get encapsulation() { return "shadow"; }
|
|
@@ -30,7 +30,7 @@ export class RecipeSearchBar {
|
|
|
30
30
|
this.internalValue = newVal;
|
|
31
31
|
}
|
|
32
32
|
render() {
|
|
33
|
-
return (h("div", { key: '
|
|
33
|
+
return (h("div", { key: '7fa4a3ce06ef9b7e68b968a0bf29cce896cc7db0', class: "wrap" }, h("input", { key: 'ae2e528fafd1f342de8a88c14f0651857bc0486d', type: "search", placeholder: this.placeholder, value: this.internalValue, onInput: this.onInput, onKeyDown: this.onKeyDown }), h("button", { key: 'c9a369dca794014f17cd64cfaa4b7b9f0e06d171', onClick: () => this.search.emit({ value: this.internalValue }), "aria-label": "Search" }, "\uD83D\uDD0D")));
|
|
34
34
|
}
|
|
35
35
|
static get is() { return "recipe-search-bar"; }
|
|
36
36
|
static get encapsulation() { return "shadow"; }
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{A as o,d as s}from"./p-
|
|
1
|
+
import{A as o,d as s}from"./p-BzvqJQ_R.js";const p=o,r=s;export{p as AppToast,r as defineCustomElement}
|
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-Cn_qfIvv.js";export{R as RecipeSearchBar}from"./p-K-btCLSj.js";export{R as RecipeFilterBar}from"./p-B92NkO3p.js";export{R as RecipeRating}from"./p-mY_lBX8M.js";export{R as RecipeForm}from"./p-u-o4onHp.js";export{M as MealPlanDay}from"./p-S4266va_.js";export{A as AppModal}from"./p-Dp1sKtrN.js";export{A as AppToast}from"./p-BzvqJQ_R.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e,p as s,H as t,c as i,h as r}from"./p-BJU3HdRm.js";const c=s(class extends t{constructor(e){super(),!1!==e&&this.__registerHost(),this.__attachShadow(),this.filterChange=i(this,"filterChange"),this.categories=[],this.active=""}select(e){this.filterChange.emit({value:e})}render(){const e=Array.isArray(this.categories)?this.categories:[];return r("div",{key:"
|
|
1
|
+
import{t as e,p as s,H as t,c as i,h as r}from"./p-BJU3HdRm.js";const c=s(class extends t{constructor(e){super(),!1!==e&&this.__registerHost(),this.__attachShadow(),this.filterChange=i(this,"filterChange"),this.categories=[],this.active=""}select(e){this.filterChange.emit({value:e})}render(){const e=Array.isArray(this.categories)?this.categories:[];return r("div",{key:"336e3431325ab3338cda5be917414c6be4be1cf9",class:"wrap"},r("button",{key:"f1a5c228cf9ef1dd2017b26be55afdd07e27c837",class:{chip:!0,active:""===this.active},onClick:()=>this.select("")},"All"),e.map((e=>r("button",{class:{chip:!0,active:this.active===e},onClick:()=>this.select(e)},e))))}static get style(){return":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}"}},[1,"recipe-filter-bar",{categories:[16],active:[1]}]);function a(){"undefined"!=typeof customElements&&["recipe-filter-bar"].forEach((s=>{"recipe-filter-bar"===s&&(customElements.get(e(s))||customElements.define(e(s),c))}))}a();export{c as R,a as d}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as s,p as t,H as
|
|
1
|
+
import{t as s,p as t,H as a,c as o,h as e}from"./p-BJU3HdRm.js";const i=t(class extends a{constructor(s){super(),!1!==s&&this.__registerHost(),this.__attachShadow(),this.dismiss=o(this,"dismiss"),this.message="",this.type="info",this.duration=3e3}componentDidLoad(){this.duration>0&&setTimeout((()=>this.dismiss.emit()),this.duration)}render(){return e("div",{key:"40cf0d0171712b45dd8786bd69aa2f94a1fc7335",class:`toast ${this.type}`},e("span",{key:"5256c39505158066715c94420ff65a479a7ab382"},this.message),e("button",{key:"523f0f7617a902910d13179147ca75fa57499433",onClick:()=>this.dismiss.emit(),"aria-label":"Dismiss"},"✕"))}static get style(){return":host{font-family:system-ui, sans-serif;display:block}.toast{display:flex;align-items:center;gap:10px;padding:10px 16px;border-radius:8px;color:#fff;font-size:14px;box-shadow:0 4px 12px rgba(0,0,0,0.15)}.toast.success{background:#2ecc71}.toast.error{background:#e74c3c}.toast.info{background:#3498db}button{border:none;background:none;color:inherit;cursor:pointer;margin-left:auto}"}},[1,"app-toast",{message:[1],type:[1],duration:[2]}]);function n(){"undefined"!=typeof customElements&&["app-toast"].forEach((t=>{"app-toast"===t&&(customElements.get(s(t))||customElements.define(s(t),i))}))}n();export{i as A,n as d}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e,p as
|
|
1
|
+
import{t as e,p as t,H as a,c as i,h as s}from"./p-BJU3HdRm.js";const r=t(class extends a{constructor(e){super(),!1!==e&&this.__registerHost(),this.__attachShadow(),this.favoriteToggle=i(this,"favoriteToggle"),this.cardClick=i(this,"cardClick"),this.category="",this.favorite=!1,this.onFavoriteClick=e=>{e.stopPropagation(),this.favoriteToggle.emit({favorite:!this.favorite})}}render(){return s("div",{key:"72e604b38c4156bfe101f0609fac315cd317c981",class:"card",onClick:()=>this.cardClick.emit()},s("div",{key:"bb707d57e573970201644e029eb6257e100e2276",class:"image-wrap"},this.image?s("img",{src:this.image,alt:this.recipeTitle}):s("div",{class:"placeholder"}),s("button",{key:"bb052a897f227e8b8ca938704a083d8502036037",class:{"fav-btn":!0,active:this.favorite},onClick:this.onFavoriteClick,"aria-label":"Toggle favorite"},this.favorite?"★":"☆")),s("div",{key:"e4c139b9bdbdac25e92def0705d8506d89a0ce65",class:"body"},s("h3",{key:"aea91bd0827cdbe2608d91b428489a11eb7de0fa"},this.recipeTitle),this.category&&s("span",{key:"96219817064ee274999487452db6c70dee93d82f",class:"category"},this.category),s("div",{key:"c2593b0d879744a24c4be179af1d9359e3e904fa",class:"actions"},s("slot",{key:"19e921048e6d469a33531c2bb949067a7925c7ac",name:"actions"}))))}static get style(){return":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:#ff6b35}.body{padding:12px 14px}h3{margin:0 0 4px;font-size:15px;line-height:1.3}.category{font-size:12px;color:#777;text-transform:uppercase;letter-spacing:0.03em}.actions{margin-top:8px}"}},[257,"recipe-card",{recipeTitle:[1,"recipe-title"],image:[1],category:[1],favorite:[4]}]);function o(){"undefined"!=typeof customElements&&["recipe-card"].forEach((t=>{"recipe-card"===t&&(customElements.get(e(t))||customElements.define(e(t),r))}))}o();export{r as R,o as d}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e,p as t,H as s,c as
|
|
1
|
+
import{t as e,p as t,H as s,c as a,h as i}from"./p-BJU3HdRm.js";const r=t(class extends s{constructor(e){super(),!1!==e&&this.__registerHost(),this.__attachShadow(),this.search=a(this,"search"),this.placeholder="Search recipes...",this.value="",this.debounceMs=350,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:"7fa4a3ce06ef9b7e68b968a0bf29cce896cc7db0",class:"wrap"},i("input",{key:"ae2e528fafd1f342de8a88c14f0651857bc0486d",type:"search",placeholder:this.placeholder,value:this.internalValue,onInput:this.onInput,onKeyDown:this.onKeyDown}),i("button",{key:"c9a369dca794014f17cd64cfaa4b7b9f0e06d171",onClick:()=>this.search.emit({value:this.internalValue}),"aria-label":"Search"},"🔍"))}static get watchers(){return{value:[{onValuePropChange:0}]}}static get style(){return":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}"}},[1,"recipe-search-bar",{placeholder:[1],value:[1],debounceMs:[2,"debounce-ms"],internalValue:[32]},void 0,{value:[{onValuePropChange:0}]}]);function o(){"undefined"!=typeof customElements&&["recipe-search-bar"].forEach((t=>{"recipe-search-bar"===t&&(customElements.get(e(t))||customElements.define(e(t),r))}))}o();export{r as R,o as d}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as s,p as t,H as e,c as i,h as a}from"./p-BJU3HdRm.js";const r=t(class extends e{constructor(s){super(),!1!==s&&this.__registerHost(),this.__attachShadow(),this.ratingChange=i(this,"ratingChange"),this.value=0,this.readonly=!1,this.max=5}render(){const s=Array.from({length:this.max},((s,t)=>t+1));return a("div",{key:"
|
|
1
|
+
import{t as s,p as t,H as e,c as i,h as a}from"./p-BJU3HdRm.js";const r=t(class extends e{constructor(s){super(),!1!==s&&this.__registerHost(),this.__attachShadow(),this.ratingChange=i(this,"ratingChange"),this.value=0,this.readonly=!1,this.max=5}render(){const s=Array.from({length:this.max},((s,t)=>t+1));return a("div",{key:"9e67a7c471e6b20bbc2bc0164a5346c8cd5f10dc",class:"wrap",role:this.readonly?void 0:"radiogroup"},s.map((s=>a("span",{class:{star:!0,filled:s<=this.value,clickable:!this.readonly},onClick:()=>!this.readonly&&this.ratingChange.emit({value:s})},"★"))))}static get style(){return":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}"}},[1,"recipe-rating",{value:[2],readonly:[4],max:[2]}]);function c(){"undefined"!=typeof customElements&&["recipe-rating"].forEach((t=>{"recipe-rating"===t&&(customElements.get(s(t))||customElements.define(s(t),r))}))}c();export{r as R,c as d}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t as e,p as t,H as i,c as a,h as s}from"./p-BJU3HdRm.js";const 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=a(this,"save"),this.cancel=a(this,"cancel"),this.areas=n,this.extraAreas=[],this.title="",this.image="",this.category="",this.area="",this.customArea="",this.ingredients=[""],this.instructions="",this.errors={},this.onSubmit=e=>{if(e.preventDefault(),!this.validate())return;const t="Other"===this.area?this.customArea.trim():this.area,i={id:this.initialData?.id,title:this.title.trim(),image:this.image.trim(),category:this.category.trim(),area:t,ingredients:this.ingredients.map((e=>e.trim())).filter(Boolean),instructions:this.instructions.trim()};this.save.emit(i)},this.addIngredient=()=>{this.ingredients=[...this.ingredients,""]},this.removeIngredient=e=>{this.ingredients=this.ingredients.filter(((t,i)=>i!==e))}}componentWillLoad(){this.loadInitialData()}onInitialDataChange(){this.loadInitialData()}get fullAreaList(){const e=[...this.areas.filter((e=>"Other"!==e))];for(const t of this.extraAreas)t&&!e.includes(t)&&e.push(t);return e.push("Other"),e}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.category=e.category??"",this.ingredients=e.ingredients?.length?[...e.ingredients]:[""],this.instructions=e.instructions??"";const t=this.fullAreaList.filter((e=>"Other"!==e));e.area&&!t.includes(e.area)?(this.area="Other",this.customArea=e.area):(this.area=e.area??"",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."),"Other"!==this.area||this.customArea.trim()||(e.customArea="Enter a cuisine name."),this.errors=e,0===Object.keys(e).length}updateIngredient(e,t){const i=[...this.ingredients];i[e]=t,this.ingredients=i}render(){return s("form",{key:"b9e50e96b20b8f3bb28ecb516b102c87088daddd",onSubmit:this.onSubmit},s("slot",{key:"648424eb3444acdacb69e541799571ffa6572004",name:"header"}),s("label",{key:"77ec1e8acd2ba845262909f672fadf06907702f2"},"Title",s("input",{key:"2f5dd98ab985831eb07ac43afed983908f2646d1",type:"text",value:this.title,onInput:e=>this.title=e.target.value}),this.errors.title&&s("span",{key:"244560b4dc4cb47cbb514d0f8fe41be267299885",class:"error"},this.errors.title)),s("label",{key:"8bb49420325a7629186a5801162b9a2e4321e4f7"},"Image URL",s("input",{key:"fe121c2389308b5bc0e6f7b977f15fec91f9baae",type:"text",value:this.image,onInput:e=>this.image=e.target.value})),s("div",{key:"2ede3939f5230f805841945a29fc37fc4d2f3627",class:"row"},s("label",{key:"b736ee46a12a1070cb52c76fc41d31e0f8d1169b"},"Category",s("input",{key:"6952f8378b13313c1c63d2cb1b1cd9c2593d1806",type:"text",value:this.category,onInput:e=>this.category=e.target.value})),s("label",{key:"a6e477f0bfdfbab6a75831a62334b665272a98db"},"Cuisine / Area",s("select",{key:"1434d68a1782d19f92cd2d5ef638f440a8adc7dd",onInput:e=>this.area=e.target.value},s("option",{key:"a40b1cacf4deb98590689325f23e572522069268",value:"",selected:""===this.area},"Select a cuisine…"),this.fullAreaList.map((e=>s("option",{value:e,selected:e===this.area},e)))))),"Other"===this.area&&s("label",{key:"77ab0849f544aacc7c2a207dc222c916dfb7a41b",class:"custom-area-field"},"Enter cuisine name",s("input",{key:"fd7c97a89c0e2b8f23cc28fbc502563eb759fdb4",type:"text",placeholder:"e.g. Ethiopian",value:this.customArea,onInput:e=>this.customArea=e.target.value}),this.errors.customArea&&s("span",{key:"2b2425b63b0d5ee311fe16040d012a43919c8ca6",class:"error"},this.errors.customArea)),s("div",{key:"fafa1824f121c9c2c96069772d2011a13ce0683f",class:"field"},s("span",{key:"bea9e5877093e412b1fffb12f0aad4c79604cc16"},"Ingredients"),this.ingredients.map(((e,t)=>s("div",{class:"ingredient-row"},s("input",{type:"text",value:e,onInput:e=>this.updateIngredient(t,e.target.value)}),s("button",{type:"button",onClick:()=>this.removeIngredient(t),"aria-label":"Remove"},"✕")))),s("button",{key:"fc7a817c01706f4f99594ff09a72fa8b046f4820",type:"button",class:"add-btn",onClick:this.addIngredient},"+ Add ingredient"),this.errors.ingredients&&s("span",{key:"d4b4bee30e1369f951f0aabe7f54b0b1ae393a83",class:"error"},this.errors.ingredients)),s("label",{key:"5028ae3ead65e280a2196f93d5f31580a5f8c95a"},"Instructions",s("textarea",{key:"08461bc98ab47d1f2240dfa23e1ec1264de12002",rows:5,onInput:e=>this.instructions=e.target.value},this.instructions),this.errors.instructions&&s("span",{key:"932de400651f180d7e5b14e4ff118ccdcd24d2b3",class:"error"},this.errors.instructions)),s("div",{key:"7da02b77a1390447a738882d0104292b28f675b0",class:"footer"},s("slot",{key:"74ed118f385e1e6e1318dd405aa0008e195ef9c0",name:"footer"}),s("button",{key:"e2548efd3826d3a984c11cd6d7bd486e226c8ca9",type:"button",class:"cancel-btn",onClick:()=>this.cancel.emit()},"Cancel"),s("button",{key:"8011e51d4579a0e6ddd88cd8c83708524551d801",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:#ff6b35;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"],areas:[16],extraAreas:[16],title:[32],image:[32],category:[32],area:[32],customArea:[32],ingredients:[32],instructions:[32],errors:[32]},void 0,{initialData:[{onInitialDataChange:0}]}]);function r(){"undefined"!=typeof customElements&&["recipe-form"].forEach((t=>{"recipe-form"===t&&(customElements.get(e(t))||customElements.define(e(t),o))}))}r();export{o as R,r as d}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{R as o,d as s}from"./p-
|
|
1
|
+
import{R as o,d as s}from"./p-Cn_qfIvv.js";const p=o,r=s;export{p as RecipeCard,r as defineCustomElement}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{R as o,d as
|
|
1
|
+
import{R as o,d as p}from"./p-B92NkO3p.js";const s=o,r=p;export{s as RecipeFilterBar,r as defineCustomElement}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{R as o,d as
|
|
1
|
+
import{R as o,d as p}from"./p-u-o4onHp.js";const s=o,r=p;export{s as RecipeForm,r as defineCustomElement}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{R as o,d as
|
|
1
|
+
import{R as o,d as s}from"./p-mY_lBX8M.js";const m=o,p=s;export{m as RecipeRating,p as defineCustomElement}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{R as o,d as s}from"./p-
|
|
1
|
+
import{R as o,d as s}from"./p-K-btCLSj.js";const t=o,p=s;export{t as RecipeSearchBar,p as defineCustomElement}
|
|
@@ -17,7 +17,7 @@ const RecipeCard = class {
|
|
|
17
17
|
};
|
|
18
18
|
}
|
|
19
19
|
render() {
|
|
20
|
-
return (h("div", { key: '
|
|
20
|
+
return (h("div", { key: '72e604b38c4156bfe101f0609fac315cd317c981', class: "card", onClick: () => this.cardClick.emit() }, h("div", { key: 'bb707d57e573970201644e029eb6257e100e2276', class: "image-wrap" }, this.image ? h("img", { src: this.image, alt: this.recipeTitle }) : h("div", { class: "placeholder" }), h("button", { key: 'bb052a897f227e8b8ca938704a083d8502036037', class: { 'fav-btn': true, active: this.favorite }, onClick: this.onFavoriteClick, "aria-label": "Toggle favorite" }, this.favorite ? '★' : '☆')), h("div", { key: 'e4c139b9bdbdac25e92def0705d8506d89a0ce65', class: "body" }, h("h3", { key: 'aea91bd0827cdbe2608d91b428489a11eb7de0fa' }, this.recipeTitle), this.category && h("span", { key: '96219817064ee274999487452db6c70dee93d82f', class: "category" }, this.category), h("div", { key: 'c2593b0d879744a24c4be179af1d9359e3e904fa', class: "actions" }, h("slot", { key: '19e921048e6d469a33531c2bb949067a7925c7ac', name: "actions" })))));
|
|
21
21
|
}
|
|
22
22
|
};
|
|
23
23
|
RecipeCard.style = recipeCardCss();
|
|
@@ -53,7 +53,7 @@ const RecipeSearchBar = class {
|
|
|
53
53
|
this.internalValue = newVal;
|
|
54
54
|
}
|
|
55
55
|
render() {
|
|
56
|
-
return (h("div", { key: '
|
|
56
|
+
return (h("div", { key: '7fa4a3ce06ef9b7e68b968a0bf29cce896cc7db0', class: "wrap" }, h("input", { key: 'ae2e528fafd1f342de8a88c14f0651857bc0486d', type: "search", placeholder: this.placeholder, value: this.internalValue, onInput: this.onInput, onKeyDown: this.onKeyDown }), h("button", { key: 'c9a369dca794014f17cd64cfaa4b7b9f0e06d171', onClick: () => this.search.emit({ value: this.internalValue }), "aria-label": "Search" }, "\uD83D\uDD0D")));
|
|
57
57
|
}
|
|
58
58
|
static get watchers() { return {
|
|
59
59
|
"value": [{
|
|
@@ -77,7 +77,7 @@ const RecipeFilterBar = class {
|
|
|
77
77
|
}
|
|
78
78
|
render() {
|
|
79
79
|
const cats = Array.isArray(this.categories) ? this.categories : [];
|
|
80
|
-
return (h("div", { key: '
|
|
80
|
+
return (h("div", { key: '336e3431325ab3338cda5be917414c6be4be1cf9', class: "wrap" }, h("button", { key: 'f1a5c228cf9ef1dd2017b26be55afdd07e27c837', class: { chip: true, active: this.active === '' }, onClick: () => this.select('') }, "All"), cats.map((c) => (h("button", { class: { chip: true, active: this.active === c }, onClick: () => this.select(c) }, c)))));
|
|
81
81
|
}
|
|
82
82
|
};
|
|
83
83
|
RecipeFilterBar.style = recipeFilterBarCss();
|
|
@@ -94,12 +94,12 @@ const RecipeRating = class {
|
|
|
94
94
|
}
|
|
95
95
|
render() {
|
|
96
96
|
const stars = Array.from({ length: this.max }, (_, i) => i + 1);
|
|
97
|
-
return (h("div", { key: '
|
|
97
|
+
return (h("div", { key: '9e67a7c471e6b20bbc2bc0164a5346c8cd5f10dc', class: "wrap", role: this.readonly ? undefined : 'radiogroup' }, stars.map((s) => (h("span", { class: { star: true, filled: s <= this.value, clickable: !this.readonly }, onClick: () => !this.readonly && this.ratingChange.emit({ value: s }) }, "\u2605")))));
|
|
98
98
|
}
|
|
99
99
|
};
|
|
100
100
|
RecipeRating.style = recipeRatingCss();
|
|
101
101
|
|
|
102
|
-
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{font-weight:400;padding:8px 10px;border:1px solid #ddd;border-radius:6px;font-size:14px;font-family:inherit}.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}`;
|
|
102
|
+
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:#ff6b35;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}`;
|
|
103
103
|
|
|
104
104
|
const DEFAULT_AREAS = [
|
|
105
105
|
'American', 'British', 'Chinese', 'Croatian', 'Dutch', 'Egyptian',
|
|
@@ -113,12 +113,15 @@ const RecipeForm = class {
|
|
|
113
113
|
registerInstance(this, hostRef);
|
|
114
114
|
this.save = createEvent(this, "save");
|
|
115
115
|
this.cancel = createEvent(this, "cancel");
|
|
116
|
-
/**
|
|
117
|
-
this.
|
|
116
|
+
/** Full override of the cuisine dropdown options */
|
|
117
|
+
this.areas = DEFAULT_AREAS;
|
|
118
|
+
/** Additional cuisine options merged in before "Other" */
|
|
119
|
+
this.extraAreas = [];
|
|
118
120
|
this.title = '';
|
|
119
121
|
this.image = '';
|
|
120
122
|
this.category = '';
|
|
121
|
-
this.
|
|
123
|
+
this.area = '';
|
|
124
|
+
this.customArea = '';
|
|
122
125
|
this.ingredients = [''];
|
|
123
126
|
this.instructions = '';
|
|
124
127
|
this.errors = {};
|
|
@@ -126,12 +129,13 @@ const RecipeForm = class {
|
|
|
126
129
|
e.preventDefault();
|
|
127
130
|
if (!this.validate())
|
|
128
131
|
return;
|
|
132
|
+
const resolvedArea = this.area === 'Other' ? this.customArea.trim() : this.area;
|
|
129
133
|
const data = {
|
|
130
134
|
id: this.initialData?.id,
|
|
131
135
|
title: this.title.trim(),
|
|
132
136
|
image: this.image.trim(),
|
|
133
137
|
category: this.category.trim(),
|
|
134
|
-
|
|
138
|
+
area: resolvedArea,
|
|
135
139
|
ingredients: this.ingredients.map((i) => i.trim()).filter(Boolean),
|
|
136
140
|
instructions: this.instructions.trim(),
|
|
137
141
|
};
|
|
@@ -150,6 +154,16 @@ const RecipeForm = class {
|
|
|
150
154
|
onInitialDataChange() {
|
|
151
155
|
this.loadInitialData();
|
|
152
156
|
}
|
|
157
|
+
get fullAreaList() {
|
|
158
|
+
const withoutOther = this.areas.filter((a) => a !== 'Other');
|
|
159
|
+
const merged = [...withoutOther];
|
|
160
|
+
for (const extra of this.extraAreas) {
|
|
161
|
+
if (extra && !merged.includes(extra))
|
|
162
|
+
merged.push(extra);
|
|
163
|
+
}
|
|
164
|
+
merged.push('Other');
|
|
165
|
+
return merged;
|
|
166
|
+
}
|
|
153
167
|
loadInitialData() {
|
|
154
168
|
let data;
|
|
155
169
|
if (typeof this.initialData === 'string' && this.initialData) {
|
|
@@ -167,9 +181,17 @@ const RecipeForm = class {
|
|
|
167
181
|
this.title = data.title ?? '';
|
|
168
182
|
this.image = data.image ?? '';
|
|
169
183
|
this.category = data.category ?? '';
|
|
170
|
-
this.cuisine = data.cuisine ?? '';
|
|
171
184
|
this.ingredients = data.ingredients?.length ? [...data.ingredients] : [''];
|
|
172
185
|
this.instructions = data.instructions ?? '';
|
|
186
|
+
const knownAreas = this.fullAreaList.filter((a) => a !== 'Other');
|
|
187
|
+
if (data.area && !knownAreas.includes(data.area)) {
|
|
188
|
+
this.area = 'Other';
|
|
189
|
+
this.customArea = data.area;
|
|
190
|
+
}
|
|
191
|
+
else {
|
|
192
|
+
this.area = data.area ?? '';
|
|
193
|
+
this.customArea = '';
|
|
194
|
+
}
|
|
173
195
|
}
|
|
174
196
|
}
|
|
175
197
|
validate() {
|
|
@@ -181,6 +203,9 @@ const RecipeForm = class {
|
|
|
181
203
|
errors.ingredients = 'Add at least one ingredient.';
|
|
182
204
|
if (!this.instructions.trim())
|
|
183
205
|
errors.instructions = 'Instructions are required.';
|
|
206
|
+
if (this.area === 'Other' && !this.customArea.trim()) {
|
|
207
|
+
errors.customArea = 'Enter a cuisine name.';
|
|
208
|
+
}
|
|
184
209
|
this.errors = errors;
|
|
185
210
|
return Object.keys(errors).length === 0;
|
|
186
211
|
}
|
|
@@ -190,7 +215,7 @@ const RecipeForm = class {
|
|
|
190
215
|
this.ingredients = next;
|
|
191
216
|
}
|
|
192
217
|
render() {
|
|
193
|
-
return (h("form", { key: '
|
|
218
|
+
return (h("form", { key: 'b9e50e96b20b8f3bb28ecb516b102c87088daddd', onSubmit: this.onSubmit }, h("slot", { key: '648424eb3444acdacb69e541799571ffa6572004', name: "header" }), h("label", { key: '77ec1e8acd2ba845262909f672fadf06907702f2' }, "Title", h("input", { key: '2f5dd98ab985831eb07ac43afed983908f2646d1', type: "text", value: this.title, onInput: (e) => (this.title = e.target.value) }), this.errors.title && h("span", { key: '244560b4dc4cb47cbb514d0f8fe41be267299885', class: "error" }, this.errors.title)), h("label", { key: '8bb49420325a7629186a5801162b9a2e4321e4f7' }, "Image URL", h("input", { key: 'fe121c2389308b5bc0e6f7b977f15fec91f9baae', type: "text", value: this.image, onInput: (e) => (this.image = e.target.value) })), h("div", { key: '2ede3939f5230f805841945a29fc37fc4d2f3627', class: "row" }, h("label", { key: 'b736ee46a12a1070cb52c76fc41d31e0f8d1169b' }, "Category", h("input", { key: '6952f8378b13313c1c63d2cb1b1cd9c2593d1806', type: "text", value: this.category, onInput: (e) => (this.category = e.target.value) })), h("label", { key: 'a6e477f0bfdfbab6a75831a62334b665272a98db' }, "Cuisine / Area", h("select", { key: '1434d68a1782d19f92cd2d5ef638f440a8adc7dd', onInput: (e) => (this.area = e.target.value) }, h("option", { key: 'a40b1cacf4deb98590689325f23e572522069268', value: "", selected: this.area === '' }, "Select a cuisine\u2026"), this.fullAreaList.map((a) => (h("option", { value: a, selected: a === this.area }, a)))))), this.area === 'Other' && (h("label", { key: '77ab0849f544aacc7c2a207dc222c916dfb7a41b', class: "custom-area-field" }, "Enter cuisine name", h("input", { key: 'fd7c97a89c0e2b8f23cc28fbc502563eb759fdb4', type: "text", placeholder: "e.g. Ethiopian", value: this.customArea, onInput: (e) => (this.customArea = e.target.value) }), this.errors.customArea && h("span", { key: '2b2425b63b0d5ee311fe16040d012a43919c8ca6', class: "error" }, this.errors.customArea))), h("div", { key: 'fafa1824f121c9c2c96069772d2011a13ce0683f', class: "field" }, h("span", { key: 'bea9e5877093e412b1fffb12f0aad4c79604cc16' }, "Ingredients"), this.ingredients.map((ing, i) => (h("div", { class: "ingredient-row" }, h("input", { type: "text", value: ing, onInput: (e) => this.updateIngredient(i, e.target.value) }), h("button", { type: "button", onClick: () => this.removeIngredient(i), "aria-label": "Remove" }, "\u2715")))), h("button", { key: 'fc7a817c01706f4f99594ff09a72fa8b046f4820', type: "button", class: "add-btn", onClick: this.addIngredient }, "+ Add ingredient"), this.errors.ingredients && h("span", { key: 'd4b4bee30e1369f951f0aabe7f54b0b1ae393a83', class: "error" }, this.errors.ingredients)), h("label", { key: '5028ae3ead65e280a2196f93d5f31580a5f8c95a' }, "Instructions", h("textarea", { key: '08461bc98ab47d1f2240dfa23e1ec1264de12002', rows: 5, onInput: (e) => (this.instructions = e.target.value) }, this.instructions), this.errors.instructions && h("span", { key: '932de400651f180d7e5b14e4ff118ccdcd24d2b3', class: "error" }, this.errors.instructions)), h("div", { key: '7da02b77a1390447a738882d0104292b28f675b0', class: "footer" }, h("slot", { key: '74ed118f385e1e6e1318dd405aa0008e195ef9c0', name: "footer" }), h("button", { key: 'e2548efd3826d3a984c11cd6d7bd486e226c8ca9', type: "button", class: "cancel-btn", onClick: () => this.cancel.emit() }, "Cancel"), h("button", { key: '8011e51d4579a0e6ddd88cd8c83708524551d801', type: "submit", class: "save-btn" }, "Save Recipe"))));
|
|
194
219
|
}
|
|
195
220
|
static get watchers() { return {
|
|
196
221
|
"initialData": [{
|
|
@@ -16,7 +16,7 @@ const AppToast = class {
|
|
|
16
16
|
}
|
|
17
17
|
}
|
|
18
18
|
render() {
|
|
19
|
-
return (h("div", { key: '
|
|
19
|
+
return (h("div", { key: '40cf0d0171712b45dd8786bd69aa2f94a1fc7335', class: `toast ${this.type}` }, h("span", { key: '5256c39505158066715c94420ff65a479a7ab382' }, this.message), h("button", { key: '523f0f7617a902910d13179147ca75fa57499433', onClick: () => this.dismiss.emit(), "aria-label": "Dismiss" }, "\u2715")));
|
|
20
20
|
}
|
|
21
21
|
};
|
|
22
22
|
AppToast.style = appToastCss();
|
package/dist/esm/loader.js
CHANGED
|
@@ -5,7 +5,7 @@ import { g as globalScripts } from './app-globals-DQuL1Twl.js';
|
|
|
5
5
|
const defineCustomElements = async (win, options) => {
|
|
6
6
|
if (typeof window === 'undefined') return undefined;
|
|
7
7
|
await globalScripts();
|
|
8
|
-
return bootstrapLazy([["app-modal_7",[[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],"favorite":[4]}],[1,"recipe-filter-bar",{"categories":[16],"active":[1]}],[257,"recipe-form",{"initialData":[1,"initial-data"],"
|
|
8
|
+
return bootstrapLazy([["app-modal_7",[[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],"favorite":[4]}],[1,"recipe-filter-bar",{"categories":[16],"active":[1]}],[257,"recipe-form",{"initialData":[1,"initial-data"],"areas":[16],"extraAreas":[16],"title":[32],"image":[32],"category":[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"],"internalValue":[32]},null,{"value":[{"onValuePropChange":0}]}]]],["app-toast",[[1,"app-toast",{"message":[1],"type":[1],"duration":[2]}]]]], options);
|
|
9
9
|
};
|
|
10
10
|
|
|
11
11
|
export { defineCustomElements };
|
package/dist/esm/recipe-ui.js
CHANGED
|
@@ -17,5 +17,5 @@ var patchBrowser = () => {
|
|
|
17
17
|
|
|
18
18
|
patchBrowser().then(async (options) => {
|
|
19
19
|
await globalScripts();
|
|
20
|
-
return bootstrapLazy([["app-modal_7",[[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],"favorite":[4]}],[1,"recipe-filter-bar",{"categories":[16],"active":[1]}],[257,"recipe-form",{"initialData":[1,"initial-data"],"
|
|
20
|
+
return bootstrapLazy([["app-modal_7",[[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],"favorite":[4]}],[1,"recipe-filter-bar",{"categories":[16],"active":[1]}],[257,"recipe-form",{"initialData":[1,"initial-data"],"areas":[16],"extraAreas":[16],"title":[32],"image":[32],"category":[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"],"internalValue":[32]},null,{"value":[{"onValuePropChange":0}]}]]],["app-toast",[[1,"app-toast",{"message":[1],"type":[1],"duration":[2]}]]]], options);
|
|
21
21
|
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e,c as t,h as i}from"./p-CrZUP9M-.js";const a=class{constructor(i){e(this,i),this.favoriteToggle=t(this,"favoriteToggle"),this.cardClick=t(this,"cardClick"),this.category="",this.favorite=!1,this.onFavoriteClick=e=>{e.stopPropagation(),this.favoriteToggle.emit({favorite:!this.favorite})}}render(){return i("div",{key:"72e604b38c4156bfe101f0609fac315cd317c981",class:"card",onClick:()=>this.cardClick.emit()},i("div",{key:"bb707d57e573970201644e029eb6257e100e2276",class:"image-wrap"},this.image?i("img",{src:this.image,alt:this.recipeTitle}):i("div",{class:"placeholder"}),i("button",{key:"bb052a897f227e8b8ca938704a083d8502036037",class:{"fav-btn":!0,active:this.favorite},onClick:this.onFavoriteClick,"aria-label":"Toggle favorite"},this.favorite?"★":"☆")),i("div",{key:"e4c139b9bdbdac25e92def0705d8506d89a0ce65",class:"body"},i("h3",{key:"aea91bd0827cdbe2608d91b428489a11eb7de0fa"},this.recipeTitle),this.category&&i("span",{key:"96219817064ee274999487452db6c70dee93d82f",class:"category"},this.category),i("div",{key:"c2593b0d879744a24c4be179af1d9359e3e904fa",class:"actions"},i("slot",{key:"19e921048e6d469a33531c2bb949067a7925c7ac",name:"actions"}))))}};a.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:#ff6b35}.body{padding:12px 14px}h3{margin:0 0 4px;font-size:15px;line-height:1.3}.category{font-size:12px;color:#777;text-transform:uppercase;letter-spacing:0.03em}.actions{margin-top:8px}";const s=class{constructor(i){e(this,i),this.search=t(this,"search"),this.placeholder="Search recipes...",this.value="",this.debounceMs=350,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:"7fa4a3ce06ef9b7e68b968a0bf29cce896cc7db0",class:"wrap"},i("input",{key:"ae2e528fafd1f342de8a88c14f0651857bc0486d",type:"search",placeholder:this.placeholder,value:this.internalValue,onInput:this.onInput,onKeyDown:this.onKeyDown}),i("button",{key:"c9a369dca794014f17cd64cfaa4b7b9f0e06d171",onClick:()=>this.search.emit({value:this.internalValue}),"aria-label":"Search"},"🔍"))}static get watchers(){return{value:[{onValuePropChange:0}]}}};s.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 o=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:"336e3431325ab3338cda5be917414c6be4be1cf9",class:"wrap"},i("button",{key:"f1a5c228cf9ef1dd2017b26be55afdd07e27c837",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))))}};o.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 r=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:"9e67a7c471e6b20bbc2bc0164a5346c8cd5f10dc",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})},"★"))))}};r.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 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"],c=class{constructor(i){e(this,i),this.save=t(this,"save"),this.cancel=t(this,"cancel"),this.areas=n,this.extraAreas=[],this.title="",this.image="",this.category="",this.area="",this.customArea="",this.ingredients=[""],this.instructions="",this.errors={},this.onSubmit=e=>{if(e.preventDefault(),!this.validate())return;const t="Other"===this.area?this.customArea.trim():this.area,i={id:this.initialData?.id,title:this.title.trim(),image:this.image.trim(),category:this.category.trim(),area:t,ingredients:this.ingredients.map((e=>e.trim())).filter(Boolean),instructions:this.instructions.trim()};this.save.emit(i)},this.addIngredient=()=>{this.ingredients=[...this.ingredients,""]},this.removeIngredient=e=>{this.ingredients=this.ingredients.filter(((t,i)=>i!==e))}}componentWillLoad(){this.loadInitialData()}onInitialDataChange(){this.loadInitialData()}get fullAreaList(){const e=[...this.areas.filter((e=>"Other"!==e))];for(const t of this.extraAreas)t&&!e.includes(t)&&e.push(t);return e.push("Other"),e}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.category=e.category??"",this.ingredients=e.ingredients?.length?[...e.ingredients]:[""],this.instructions=e.instructions??"";const t=this.fullAreaList.filter((e=>"Other"!==e));e.area&&!t.includes(e.area)?(this.area="Other",this.customArea=e.area):(this.area=e.area??"",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."),"Other"!==this.area||this.customArea.trim()||(e.customArea="Enter a cuisine name."),this.errors=e,0===Object.keys(e).length}updateIngredient(e,t){const i=[...this.ingredients];i[e]=t,this.ingredients=i}render(){return i("form",{key:"b9e50e96b20b8f3bb28ecb516b102c87088daddd",onSubmit:this.onSubmit},i("slot",{key:"648424eb3444acdacb69e541799571ffa6572004",name:"header"}),i("label",{key:"77ec1e8acd2ba845262909f672fadf06907702f2"},"Title",i("input",{key:"2f5dd98ab985831eb07ac43afed983908f2646d1",type:"text",value:this.title,onInput:e=>this.title=e.target.value}),this.errors.title&&i("span",{key:"244560b4dc4cb47cbb514d0f8fe41be267299885",class:"error"},this.errors.title)),i("label",{key:"8bb49420325a7629186a5801162b9a2e4321e4f7"},"Image URL",i("input",{key:"fe121c2389308b5bc0e6f7b977f15fec91f9baae",type:"text",value:this.image,onInput:e=>this.image=e.target.value})),i("div",{key:"2ede3939f5230f805841945a29fc37fc4d2f3627",class:"row"},i("label",{key:"b736ee46a12a1070cb52c76fc41d31e0f8d1169b"},"Category",i("input",{key:"6952f8378b13313c1c63d2cb1b1cd9c2593d1806",type:"text",value:this.category,onInput:e=>this.category=e.target.value})),i("label",{key:"a6e477f0bfdfbab6a75831a62334b665272a98db"},"Cuisine / Area",i("select",{key:"1434d68a1782d19f92cd2d5ef638f440a8adc7dd",onInput:e=>this.area=e.target.value},i("option",{key:"a40b1cacf4deb98590689325f23e572522069268",value:"",selected:""===this.area},"Select a cuisine…"),this.fullAreaList.map((e=>i("option",{value:e,selected:e===this.area},e)))))),"Other"===this.area&&i("label",{key:"77ab0849f544aacc7c2a207dc222c916dfb7a41b",class:"custom-area-field"},"Enter cuisine name",i("input",{key:"fd7c97a89c0e2b8f23cc28fbc502563eb759fdb4",type:"text",placeholder:"e.g. Ethiopian",value:this.customArea,onInput:e=>this.customArea=e.target.value}),this.errors.customArea&&i("span",{key:"2b2425b63b0d5ee311fe16040d012a43919c8ca6",class:"error"},this.errors.customArea)),i("div",{key:"fafa1824f121c9c2c96069772d2011a13ce0683f",class:"field"},i("span",{key:"bea9e5877093e412b1fffb12f0aad4c79604cc16"},"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:"fc7a817c01706f4f99594ff09a72fa8b046f4820",type:"button",class:"add-btn",onClick:this.addIngredient},"+ Add ingredient"),this.errors.ingredients&&i("span",{key:"d4b4bee30e1369f951f0aabe7f54b0b1ae393a83",class:"error"},this.errors.ingredients)),i("label",{key:"5028ae3ead65e280a2196f93d5f31580a5f8c95a"},"Instructions",i("textarea",{key:"08461bc98ab47d1f2240dfa23e1ec1264de12002",rows:5,onInput:e=>this.instructions=e.target.value},this.instructions),this.errors.instructions&&i("span",{key:"932de400651f180d7e5b14e4ff118ccdcd24d2b3",class:"error"},this.errors.instructions)),i("div",{key:"7da02b77a1390447a738882d0104292b28f675b0",class:"footer"},i("slot",{key:"74ed118f385e1e6e1318dd405aa0008e195ef9c0",name:"footer"}),i("button",{key:"e2548efd3826d3a984c11cd6d7bd486e226c8ca9",type:"button",class:"cancel-btn",onClick:()=>this.cancel.emit()},"Cancel"),i("button",{key:"8011e51d4579a0e6ddd88cd8c83708524551d801",type:"submit",class:"save-btn"},"Save Recipe")))}static get watchers(){return{initialData:[{onInitialDataChange:0}]}}};c.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:#ff6b35;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 d=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"))}};d.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 l=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}};l.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{l as app_modal,d as meal_plan_day,a as recipe_card,o as recipe_filter_bar,c as recipe_form,r as recipe_rating,s as recipe_search_bar}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as s,c as t,h as o}from"./p-CrZUP9M-.js";const a=class{constructor(o){s(this,o),this.dismiss=t(this,"dismiss"),this.message="",this.type="info",this.duration=3e3}componentDidLoad(){this.duration>0&&setTimeout((()=>this.dismiss.emit()),this.duration)}render(){return o("div",{key:"
|
|
1
|
+
import{r as s,c as t,h as o}from"./p-CrZUP9M-.js";const a=class{constructor(o){s(this,o),this.dismiss=t(this,"dismiss"),this.message="",this.type="info",this.duration=3e3}componentDidLoad(){this.duration>0&&setTimeout((()=>this.dismiss.emit()),this.duration)}render(){return o("div",{key:"40cf0d0171712b45dd8786bd69aa2f94a1fc7335",class:`toast ${this.type}`},o("span",{key:"5256c39505158066715c94420ff65a479a7ab382"},this.message),o("button",{key:"523f0f7617a902910d13179147ca75fa57499433",onClick:()=>this.dismiss.emit(),"aria-label":"Dismiss"},"✕"))}};a.style=":host{font-family:system-ui, sans-serif;display:block}.toast{display:flex;align-items:center;gap:10px;padding:10px 16px;border-radius:8px;color:#fff;font-size:14px;box-shadow:0 4px 12px rgba(0,0,0,0.15)}.toast.success{background:#2ecc71}.toast.error{background:#e74c3c}.toast.info{background:#3498db}button{border:none;background:none;color:inherit;cursor:pointer;margin-left:auto}";export{a as app_toast}
|
|
@@ -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
|
|
1
|
+
import{p as e,b as a}from"./p-CrZUP9M-.js";export{s as setNonce}from"./p-CrZUP9M-.js";import{g as r}from"./p-DQuL1Twl.js";(()=>{const a=import.meta.url,r={};return""!==a&&(r.resourcesUrl=new URL(".",a).href),e(r)})().then((async e=>(await r(),a([["p-1f2f28cf",[[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],favorite:[4]}],[1,"recipe-filter-bar",{categories:[16],active:[1]}],[257,"recipe-form",{initialData:[1,"initial-data"],areas:[16],extraAreas:[16],title:[32],image:[32],category:[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"],internalValue:[32]},null,{value:[{onValuePropChange:0}]}]]],["p-e66a8ded",[[1,"app-toast",{message:[1],type:[1],duration:[2]}]]]],e))));
|
|
@@ -4,18 +4,21 @@ export interface RecipeFormData {
|
|
|
4
4
|
title: string;
|
|
5
5
|
image: string;
|
|
6
6
|
category: string;
|
|
7
|
-
|
|
7
|
+
area?: string;
|
|
8
8
|
ingredients: string[];
|
|
9
9
|
instructions: string;
|
|
10
10
|
}
|
|
11
11
|
export declare class RecipeForm {
|
|
12
12
|
initialData: RecipeFormData | string;
|
|
13
|
-
/**
|
|
14
|
-
|
|
13
|
+
/** Full override of the cuisine dropdown options */
|
|
14
|
+
areas: string[];
|
|
15
|
+
/** Additional cuisine options merged in before "Other" */
|
|
16
|
+
extraAreas: string[];
|
|
15
17
|
title: string;
|
|
16
18
|
image: string;
|
|
17
19
|
category: string;
|
|
18
|
-
|
|
20
|
+
area: string;
|
|
21
|
+
customArea: string;
|
|
19
22
|
ingredients: string[];
|
|
20
23
|
instructions: string;
|
|
21
24
|
errors: Record<string, string>;
|
|
@@ -23,6 +26,7 @@ export declare class RecipeForm {
|
|
|
23
26
|
cancel: EventEmitter<void>;
|
|
24
27
|
componentWillLoad(): void;
|
|
25
28
|
onInitialDataChange(): void;
|
|
29
|
+
private get fullAreaList();
|
|
26
30
|
private loadInitialData;
|
|
27
31
|
private validate;
|
|
28
32
|
private onSubmit;
|
|
@@ -99,10 +99,15 @@ export namespace Components {
|
|
|
99
99
|
}
|
|
100
100
|
interface RecipeForm {
|
|
101
101
|
/**
|
|
102
|
-
*
|
|
102
|
+
* Full override of the cuisine dropdown options
|
|
103
103
|
* @default [ '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', ]
|
|
104
104
|
*/
|
|
105
|
-
"
|
|
105
|
+
"areas": string[];
|
|
106
|
+
/**
|
|
107
|
+
* Additional cuisine options merged in before "Other"
|
|
108
|
+
* @default []
|
|
109
|
+
*/
|
|
110
|
+
"extraAreas": string[];
|
|
106
111
|
"initialData": RecipeFormData | string;
|
|
107
112
|
}
|
|
108
113
|
/**
|
|
@@ -452,10 +457,15 @@ declare namespace LocalJSX {
|
|
|
452
457
|
}
|
|
453
458
|
interface RecipeForm {
|
|
454
459
|
/**
|
|
455
|
-
*
|
|
460
|
+
* Full override of the cuisine dropdown options
|
|
456
461
|
* @default [ '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', ]
|
|
457
462
|
*/
|
|
458
|
-
"
|
|
463
|
+
"areas"?: string[];
|
|
464
|
+
/**
|
|
465
|
+
* Additional cuisine options merged in before "Other"
|
|
466
|
+
* @default []
|
|
467
|
+
*/
|
|
468
|
+
"extraAreas"?: string[];
|
|
459
469
|
"initialData"?: RecipeFormData | string;
|
|
460
470
|
"onCancel"?: (event: RecipeFormCustomEvent<void>) => void;
|
|
461
471
|
"onSave"?: (event: RecipeFormCustomEvent<RecipeFormData>) => void;
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{t as e,p as t,H as i,c as a,h as s}from"./p-BJU3HdRm.js";const 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"],c=t(class extends i{constructor(e){super(),!1!==e&&this.__registerHost(),this.__attachShadow(),this.save=a(this,"save"),this.cancel=a(this,"cancel"),this.cuisines=n,this.title="",this.image="",this.category="",this.cuisine="",this.ingredients=[""],this.instructions="",this.errors={},this.onSubmit=e=>{if(e.preventDefault(),!this.validate())return;const t={id:this.initialData?.id,title:this.title.trim(),image:this.image.trim(),category:this.category.trim(),cuisine:this.cuisine.trim(),ingredients:this.ingredients.map((e=>e.trim())).filter(Boolean),instructions:this.instructions.trim()};this.save.emit(t)},this.addIngredient=()=>{this.ingredients=[...this.ingredients,""]},this.removeIngredient=e=>{this.ingredients=this.ingredients.filter(((t,i)=>i!==e))}}componentWillLoad(){this.loadInitialData()}onInitialDataChange(){this.loadInitialData()}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);e&&(this.title=e.title??"",this.image=e.image??"",this.category=e.category??"",this.cuisine=e.cuisine??"",this.ingredients=e.ingredients?.length?[...e.ingredients]:[""],this.instructions=e.instructions??"")}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.errors=e,0===Object.keys(e).length}updateIngredient(e,t){const i=[...this.ingredients];i[e]=t,this.ingredients=i}render(){return s("form",{key:"7268362cd88d1d924f4bf5e4061b136454935f7b",onSubmit:this.onSubmit},s("slot",{key:"913490a0ba22ca884bcc1cac49c07573f2e8c214",name:"header"}),s("label",{key:"cdc71ed3a3d297e7f111f7ec67c111818fe0fdf8"},"Title",s("input",{key:"c17da6820f298ee9fc786fa206ef3bc97e361735",type:"text",value:this.title,onInput:e=>this.title=e.target.value}),this.errors.title&&s("span",{key:"2c61cc6f37f87536e72fe281b50a3c6a2bdfd9f2",class:"error"},this.errors.title)),s("label",{key:"28aca3cb1ffeae0f471477d3e564598fe0459cc7"},"Image URL",s("input",{key:"d523a018b35b7160061db9dc8059ee5ce3f58433",type:"text",value:this.image,onInput:e=>this.image=e.target.value})),s("div",{key:"c01339651af391405999f3081ee98ad2be33d6da",class:"row"},s("label",{key:"656b72f2ccb9488d22900f1b26f0907ece8190af"},"Category",s("input",{key:"1b973a0c12b3c66e3c585e92930b4bdbb7240b0e",type:"text",value:this.category,onInput:e=>this.category=e.target.value})),s("label",{key:"9e25bad33d00c3285fd948f3e7535e5c9d8d45f9"},"Cuisine / Area",s("select",{key:"52365ebccaa5fa2e2361ab8102b1151eb60cb5d6",onInput:e=>this.cuisine=e.target.value},s("option",{key:"ad40fd1dde5cae8e241fced55455dbadfede6734",value:"",selected:""===this.cuisine},"Select a cuisine…"),this.cuisines.map((e=>s("option",{value:e,selected:e===this.cuisine},e)))))),s("div",{key:"53173a3fbea53dad5625e28a67aebbbe9880c490",class:"field"},s("span",{key:"e5699c07f862027afa73ce59c1f450df48504f37"},"Ingredients"),this.ingredients.map(((e,t)=>s("div",{class:"ingredient-row"},s("input",{type:"text",value:e,onInput:e=>this.updateIngredient(t,e.target.value)}),s("button",{type:"button",onClick:()=>this.removeIngredient(t),"aria-label":"Remove"},"✕")))),s("button",{key:"c37385b611c3b05eeb32a4f1a6de110b8a3b6be4",type:"button",class:"add-btn",onClick:this.addIngredient},"+ Add ingredient"),this.errors.ingredients&&s("span",{key:"1e7c662423b1915bbfc7d2aeea9cea3cfef9d002",class:"error"},this.errors.ingredients)),s("label",{key:"267e09ca2bb1a91ef552dc3522105d079570499d"},"Instructions",s("textarea",{key:"99f4aa91fba6c3d499c4efa904794a6de75e62cd",rows:5,onInput:e=>this.instructions=e.target.value},this.instructions),this.errors.instructions&&s("span",{key:"cde019552bf691ee8e5a737c8a8d3c493961b0f9",class:"error"},this.errors.instructions)),s("div",{key:"b4f40cb9ab323bcc27088e7d6c7609f26b6fd9cb",class:"footer"},s("slot",{key:"150b900bcadc7f51cfdfd7fe9667c22c55a745fb",name:"footer"}),s("button",{key:"94e6ca7f8c291051f59b8fa4794c59833884d433",type:"button",class:"cancel-btn",onClick:()=>this.cancel.emit()},"Cancel"),s("button",{key:"462f42ddfdd000af25066a1d4dbfc07be95abdd6",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{font-weight:400;padding:8px 10px;border:1px solid #ddd;border-radius:6px;font-size:14px;font-family:inherit}.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"],cuisines:[16],title:[32],image:[32],category:[32],cuisine:[32],ingredients:[32],instructions:[32],errors:[32]},void 0,{initialData:[{onInitialDataChange:0}]}]);function d(){"undefined"!=typeof customElements&&["recipe-form"].forEach((t=>{"recipe-form"===t&&(customElements.get(e(t))||customElements.define(e(t),c))}))}d();export{c as R,d}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as e,c as t,h as i}from"./p-CrZUP9M-.js";const a=class{constructor(i){e(this,i),this.favoriteToggle=t(this,"favoriteToggle"),this.cardClick=t(this,"cardClick"),this.category="",this.favorite=!1,this.onFavoriteClick=e=>{e.stopPropagation(),this.favoriteToggle.emit({favorite:!this.favorite})}}render(){return i("div",{key:"1602604f99f17895a29343bf269cf5aa64db2ee1",class:"card",onClick:()=>this.cardClick.emit()},i("div",{key:"b57ab7677ba357e3897f7dff5a2d8bb50a6af417",class:"image-wrap"},this.image?i("img",{src:this.image,alt:this.recipeTitle}):i("div",{class:"placeholder"}),i("button",{key:"6720508f3723573e4fe4eef2504cffc442d3ffe1",class:{"fav-btn":!0,active:this.favorite},onClick:this.onFavoriteClick,"aria-label":"Toggle favorite"},this.favorite?"★":"☆")),i("div",{key:"e30557f6fa8ca3117d7f239c1f14e07e009500a2",class:"body"},i("h3",{key:"11c63ca021b1204c78783b53d9defb1eddbe15fa"},this.recipeTitle),this.category&&i("span",{key:"b3d2b2ebd8997d662ade303736b4ddd494a0e273",class:"category"},this.category),i("div",{key:"80cc820f78f3fd4cb64f802e69ba03cfb441ce6c",class:"actions"},i("slot",{key:"318cfb3954ad5392d56af94ba8a0e3cb3c220fa7",name:"actions"}))))}};a.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:#ff6b35}.body{padding:12px 14px}h3{margin:0 0 4px;font-size:15px;line-height:1.3}.category{font-size:12px;color:#777;text-transform:uppercase;letter-spacing:0.03em}.actions{margin-top:8px}";const s=class{constructor(i){e(this,i),this.search=t(this,"search"),this.placeholder="Search recipes...",this.value="",this.debounceMs=350,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:"65403c53fbbe3a809f1de94bb02b04a57e5b8cd1",class:"wrap"},i("input",{key:"43fb8c2a103e9e700b62ad86de1a559fc3b71d5b",type:"search",placeholder:this.placeholder,value:this.internalValue,onInput:this.onInput,onKeyDown:this.onKeyDown}),i("button",{key:"2399fce8ff18e60c83bf575454eeff0e74596c6b",onClick:()=>this.search.emit({value:this.internalValue}),"aria-label":"Search"},"🔍"))}static get watchers(){return{value:[{onValuePropChange:0}]}}};s.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 o=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:"5d0c846f0a8df8aa178915d4ee6b6fa0009cba07",class:"wrap"},i("button",{key:"49f9fa32d23122cdcee7f51869f3c158d0ce86c0",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))))}};o.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 r=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:"37923bd59ca23e07af39ebaca47a3e613809c12b",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})},"★"))))}};r.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=["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"],n=class{constructor(i){e(this,i),this.save=t(this,"save"),this.cancel=t(this,"cancel"),this.cuisines=c,this.title="",this.image="",this.category="",this.cuisine="",this.ingredients=[""],this.instructions="",this.errors={},this.onSubmit=e=>{if(e.preventDefault(),!this.validate())return;const t={id:this.initialData?.id,title:this.title.trim(),image:this.image.trim(),category:this.category.trim(),cuisine:this.cuisine.trim(),ingredients:this.ingredients.map((e=>e.trim())).filter(Boolean),instructions:this.instructions.trim()};this.save.emit(t)},this.addIngredient=()=>{this.ingredients=[...this.ingredients,""]},this.removeIngredient=e=>{this.ingredients=this.ingredients.filter(((t,i)=>i!==e))}}componentWillLoad(){this.loadInitialData()}onInitialDataChange(){this.loadInitialData()}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);e&&(this.title=e.title??"",this.image=e.image??"",this.category=e.category??"",this.cuisine=e.cuisine??"",this.ingredients=e.ingredients?.length?[...e.ingredients]:[""],this.instructions=e.instructions??"")}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.errors=e,0===Object.keys(e).length}updateIngredient(e,t){const i=[...this.ingredients];i[e]=t,this.ingredients=i}render(){return i("form",{key:"7268362cd88d1d924f4bf5e4061b136454935f7b",onSubmit:this.onSubmit},i("slot",{key:"913490a0ba22ca884bcc1cac49c07573f2e8c214",name:"header"}),i("label",{key:"cdc71ed3a3d297e7f111f7ec67c111818fe0fdf8"},"Title",i("input",{key:"c17da6820f298ee9fc786fa206ef3bc97e361735",type:"text",value:this.title,onInput:e=>this.title=e.target.value}),this.errors.title&&i("span",{key:"2c61cc6f37f87536e72fe281b50a3c6a2bdfd9f2",class:"error"},this.errors.title)),i("label",{key:"28aca3cb1ffeae0f471477d3e564598fe0459cc7"},"Image URL",i("input",{key:"d523a018b35b7160061db9dc8059ee5ce3f58433",type:"text",value:this.image,onInput:e=>this.image=e.target.value})),i("div",{key:"c01339651af391405999f3081ee98ad2be33d6da",class:"row"},i("label",{key:"656b72f2ccb9488d22900f1b26f0907ece8190af"},"Category",i("input",{key:"1b973a0c12b3c66e3c585e92930b4bdbb7240b0e",type:"text",value:this.category,onInput:e=>this.category=e.target.value})),i("label",{key:"9e25bad33d00c3285fd948f3e7535e5c9d8d45f9"},"Cuisine / Area",i("select",{key:"52365ebccaa5fa2e2361ab8102b1151eb60cb5d6",onInput:e=>this.cuisine=e.target.value},i("option",{key:"ad40fd1dde5cae8e241fced55455dbadfede6734",value:"",selected:""===this.cuisine},"Select a cuisine…"),this.cuisines.map((e=>i("option",{value:e,selected:e===this.cuisine},e)))))),i("div",{key:"53173a3fbea53dad5625e28a67aebbbe9880c490",class:"field"},i("span",{key:"e5699c07f862027afa73ce59c1f450df48504f37"},"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:"c37385b611c3b05eeb32a4f1a6de110b8a3b6be4",type:"button",class:"add-btn",onClick:this.addIngredient},"+ Add ingredient"),this.errors.ingredients&&i("span",{key:"1e7c662423b1915bbfc7d2aeea9cea3cfef9d002",class:"error"},this.errors.ingredients)),i("label",{key:"267e09ca2bb1a91ef552dc3522105d079570499d"},"Instructions",i("textarea",{key:"99f4aa91fba6c3d499c4efa904794a6de75e62cd",rows:5,onInput:e=>this.instructions=e.target.value},this.instructions),this.errors.instructions&&i("span",{key:"cde019552bf691ee8e5a737c8a8d3c493961b0f9",class:"error"},this.errors.instructions)),i("div",{key:"b4f40cb9ab323bcc27088e7d6c7609f26b6fd9cb",class:"footer"},i("slot",{key:"150b900bcadc7f51cfdfd7fe9667c22c55a745fb",name:"footer"}),i("button",{key:"94e6ca7f8c291051f59b8fa4794c59833884d433",type:"button",class:"cancel-btn",onClick:()=>this.cancel.emit()},"Cancel"),i("button",{key:"462f42ddfdd000af25066a1d4dbfc07be95abdd6",type:"submit",class:"save-btn"},"Save Recipe")))}static get watchers(){return{initialData:[{onInitialDataChange:0}]}}};n.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{font-weight:400;padding:8px 10px;border:1px solid #ddd;border-radius:6px;font-size:14px;font-family:inherit}.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 d=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"))}};d.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 f=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}};f.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{f as app_modal,d as meal_plan_day,a as recipe_card,o as recipe_filter_bar,n as recipe_form,r as recipe_rating,s as recipe_search_bar}
|