@gurpinderjitsingh/recipe-ui 0.2.1 → 0.3.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 +17 -7
- 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/meal-plan-day/meal-plan-day.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.js +35 -11
- 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-gWE9Vqi0.js → p-BIz6x-m7.js} +1 -1
- package/dist/components/{p-Q8V4JgYC.js → p-CWQoij-1.js} +1 -1
- package/dist/components/{p-DrDPFXTB.js → p-Ckp6dPOc.js} +1 -1
- package/dist/components/{p-snMSuFkY.js → p-CoCM6o6z.js} +1 -1
- package/dist/components/{p-fNGqqs-I.js → p-vGdzhVB7.js} +1 -1
- package/dist/components/p-xcFZ4dcw.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 +17 -7
- 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-74151c7f.entry.js +1 -0
- package/dist/recipe-ui/p-e912fdc5.entry.js +1 -0
- package/dist/recipe-ui/recipe-ui.esm.js +1 -1
- package/dist/types/components/recipe-form/recipe-form.d.ts +4 -6
- package/dist/types/components.d.ts +6 -22
- package/package.json +1 -1
- package/dist/components/p-CN2vLHNY.js +0 -1
- package/dist/recipe-ui/p-268be6b1.entry.js +0 -1
- package/dist/recipe-ui/p-97e73b62.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: '1602604f99f17895a29343bf269cf5aa64db2ee1', class: "card", onClick: () => this.cardClick.emit() }, index.h("div", { key: 'b57ab7677ba357e3897f7dff5a2d8bb50a6af417', class: "image-wrap" }, this.image ? index.h("img", { src: this.image, alt: this.recipeTitle }) : index.h("div", { class: "placeholder" }), index.h("button", { key: '6720508f3723573e4fe4eef2504cffc442d3ffe1', class: { 'fav-btn': true, active: this.favorite }, onClick: this.onFavoriteClick, "aria-label": "Toggle favorite" }, this.favorite ? '★' : '☆')), index.h("div", { key: 'e30557f6fa8ca3117d7f239c1f14e07e009500a2', class: "body" }, index.h("h3", { key: '11c63ca021b1204c78783b53d9defb1eddbe15fa' }, this.recipeTitle), this.category && index.h("span", { key: 'b3d2b2ebd8997d662ade303736b4ddd494a0e273', class: "category" }, this.category), index.h("div", { key: '80cc820f78f3fd4cb64f802e69ba03cfb441ce6c', class: "actions" }, index.h("slot", { key: '318cfb3954ad5392d56af94ba8a0e3cb3c220fa7', 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: '65403c53fbbe3a809f1de94bb02b04a57e5b8cd1', class: "wrap" }, index.h("input", { key: '43fb8c2a103e9e700b62ad86de1a559fc3b71d5b', type: "search", placeholder: this.placeholder, value: this.internalValue, onInput: this.onInput, onKeyDown: this.onKeyDown }), index.h("button", { key: '2399fce8ff18e60c83bf575454eeff0e74596c6b', 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: '5d0c846f0a8df8aa178915d4ee6b6fa0009cba07', class: "wrap" }, index.h("button", { key: '49f9fa32d23122cdcee7f51869f3c158d0ce86c0', 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,21 +96,31 @@ 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: '37923bd59ca23e07af39ebaca47a3e613809c12b', 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
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}`;
|
|
105
105
|
|
|
106
|
+
const DEFAULT_AREAS = [
|
|
107
|
+
'American', 'British', 'Chinese', 'Croatian', 'Dutch', 'Egyptian',
|
|
108
|
+
'Filipino', 'French', 'Greek', 'Indian', 'Irish', 'Italian', 'Jamaican',
|
|
109
|
+
'Japanese', 'Kenyan', 'Malaysian', 'Mexican', 'Moroccan', 'Polish',
|
|
110
|
+
'Portuguese', 'Russian', 'Spanish', 'Thai', 'Tunisian', 'Turkish',
|
|
111
|
+
'Vietnamese', 'Other',
|
|
112
|
+
];
|
|
106
113
|
const RecipeForm = class {
|
|
107
114
|
constructor(hostRef) {
|
|
108
115
|
index.registerInstance(this, hostRef);
|
|
109
116
|
this.save = index.createEvent(this, "save");
|
|
110
117
|
this.cancel = index.createEvent(this, "cancel");
|
|
118
|
+
/** Cuisine/cuisine options for the dropdown — override to supply your own list */
|
|
119
|
+
this.cuisines = DEFAULT_AREAS;
|
|
111
120
|
this.title = '';
|
|
112
121
|
this.image = '';
|
|
113
122
|
this.category = '';
|
|
123
|
+
this.cuisine = '';
|
|
114
124
|
this.ingredients = [''];
|
|
115
125
|
this.instructions = '';
|
|
116
126
|
this.errors = {};
|
|
@@ -123,6 +133,7 @@ const RecipeForm = class {
|
|
|
123
133
|
title: this.title.trim(),
|
|
124
134
|
image: this.image.trim(),
|
|
125
135
|
category: this.category.trim(),
|
|
136
|
+
cuisine: this.cuisine.trim(),
|
|
126
137
|
ingredients: this.ingredients.map((i) => i.trim()).filter(Boolean),
|
|
127
138
|
instructions: this.instructions.trim(),
|
|
128
139
|
};
|
|
@@ -158,6 +169,7 @@ const RecipeForm = class {
|
|
|
158
169
|
this.title = data.title ?? '';
|
|
159
170
|
this.image = data.image ?? '';
|
|
160
171
|
this.category = data.category ?? '';
|
|
172
|
+
this.cuisine = data.cuisine ?? '';
|
|
161
173
|
this.ingredients = data.ingredients?.length ? [...data.ingredients] : [''];
|
|
162
174
|
this.instructions = data.instructions ?? '';
|
|
163
175
|
}
|
|
@@ -166,8 +178,6 @@ const RecipeForm = class {
|
|
|
166
178
|
const errors = {};
|
|
167
179
|
if (!this.title.trim())
|
|
168
180
|
errors.title = 'Title is required.';
|
|
169
|
-
if (!this.category.trim())
|
|
170
|
-
errors.category = 'Category is required.';
|
|
171
181
|
const cleanIngredients = this.ingredients.map((i) => i.trim()).filter(Boolean);
|
|
172
182
|
if (cleanIngredients.length === 0)
|
|
173
183
|
errors.ingredients = 'Add at least one ingredient.';
|
|
@@ -182,7 +192,7 @@ const RecipeForm = class {
|
|
|
182
192
|
this.ingredients = next;
|
|
183
193
|
}
|
|
184
194
|
render() {
|
|
185
|
-
return (index.h("form", { key: '
|
|
195
|
+
return (index.h("form", { key: '7268362cd88d1d924f4bf5e4061b136454935f7b', onSubmit: this.onSubmit }, index.h("slot", { key: '913490a0ba22ca884bcc1cac49c07573f2e8c214', name: "header" }), index.h("label", { key: 'cdc71ed3a3d297e7f111f7ec67c111818fe0fdf8' }, "Title", index.h("input", { key: 'c17da6820f298ee9fc786fa206ef3bc97e361735', type: "text", value: this.title, onInput: (e) => (this.title = e.target.value) }), this.errors.title && index.h("span", { key: '2c61cc6f37f87536e72fe281b50a3c6a2bdfd9f2', class: "error" }, this.errors.title)), index.h("label", { key: '28aca3cb1ffeae0f471477d3e564598fe0459cc7' }, "Image URL", index.h("input", { key: 'd523a018b35b7160061db9dc8059ee5ce3f58433', type: "text", value: this.image, onInput: (e) => (this.image = e.target.value) })), index.h("div", { key: 'c01339651af391405999f3081ee98ad2be33d6da', class: "row" }, index.h("label", { key: '656b72f2ccb9488d22900f1b26f0907ece8190af' }, "Category", index.h("input", { key: '1b973a0c12b3c66e3c585e92930b4bdbb7240b0e', type: "text", value: this.category, onInput: (e) => (this.category = e.target.value) })), index.h("label", { key: '9e25bad33d00c3285fd948f3e7535e5c9d8d45f9' }, "Cuisine / Area", index.h("select", { key: '52365ebccaa5fa2e2361ab8102b1151eb60cb5d6', onInput: (e) => (this.cuisine = e.target.value) }, index.h("option", { key: 'ad40fd1dde5cae8e241fced55455dbadfede6734', value: "", selected: this.cuisine === '' }, "Select a cuisine\u2026"), this.cuisines.map((a) => (index.h("option", { value: a, selected: a === this.cuisine }, a)))))), index.h("div", { key: '53173a3fbea53dad5625e28a67aebbbe9880c490', class: "field" }, index.h("span", { key: 'e5699c07f862027afa73ce59c1f450df48504f37' }, "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: 'c37385b611c3b05eeb32a4f1a6de110b8a3b6be4', type: "button", class: "add-btn", onClick: this.addIngredient }, "+ Add ingredient"), this.errors.ingredients && index.h("span", { key: '1e7c662423b1915bbfc7d2aeea9cea3cfef9d002', class: "error" }, this.errors.ingredients)), index.h("label", { key: '267e09ca2bb1a91ef552dc3522105d079570499d' }, "Instructions", index.h("textarea", { key: '99f4aa91fba6c3d499c4efa904794a6de75e62cd', rows: 5, onInput: (e) => (this.instructions = e.target.value) }, this.instructions), this.errors.instructions && index.h("span", { key: 'cde019552bf691ee8e5a737c8a8d3c493961b0f9', class: "error" }, this.errors.instructions)), index.h("div", { key: 'b4f40cb9ab323bcc27088e7d6c7609f26b6fd9cb', class: "footer" }, index.h("slot", { key: '150b900bcadc7f51cfdfd7fe9667c22c55a745fb', name: "footer" }), index.h("button", { key: '94e6ca7f8c291051f59b8fa4794c59833884d433', type: "button", class: "cancel-btn", onClick: () => this.cancel.emit() }, "Cancel"), index.h("button", { key: '462f42ddfdd000af25066a1d4dbfc07be95abdd6', type: "submit", class: "save-btn" }, "Save Recipe"))));
|
|
186
196
|
}
|
|
187
197
|
static get watchers() { return {
|
|
188
198
|
"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: '77c3d328a79659573feaaabe30b8c53c2023fb06', class: `toast ${this.type}` }, index.h("span", { key: '0056d61321beb80bdebd957be4322516282fd07e' }, this.message), index.h("button", { key: 'f9b6161dcd74223f3241311e54ab5e2736dcbd3b', 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"],"title":[32],"image":[32],"category":[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);
|
|
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"],"cuisines":[16],"title":[32],"image":[32],"category":[32],"cuisine":[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"],"title":[32],"image":[32],"category":[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);
|
|
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"],"cuisines":[16],"title":[32],"image":[32],"category":[32],"cuisine":[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: '77c3d328a79659573feaaabe30b8c53c2023fb06', class: `toast ${this.type}` }, h("span", { key: '0056d61321beb80bdebd957be4322516282fd07e' }, this.message), h("button", { key: 'f9b6161dcd74223f3241311e54ab5e2736dcbd3b', 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"; }
|
|
@@ -53,7 +53,7 @@ export class MealPlanDay {
|
|
|
53
53
|
"references": {
|
|
54
54
|
"PlannedMeal": {
|
|
55
55
|
"location": "local",
|
|
56
|
-
"path": "C:/Users/gurpi/
|
|
56
|
+
"path": "C:/Users/gurpi/source/repos/Recipe-Finder/packages/recipe-ui/src/components/meal-plan-day/meal-plan-day.tsx",
|
|
57
57
|
"id": "src/components/meal-plan-day/meal-plan-day.tsx::PlannedMeal"
|
|
58
58
|
}
|
|
59
59
|
}
|
|
@@ -17,7 +17,7 @@ export class RecipeCard {
|
|
|
17
17
|
};
|
|
18
18
|
}
|
|
19
19
|
render() {
|
|
20
|
-
return (h("div", { key: '
|
|
20
|
+
return (h("div", { key: '1602604f99f17895a29343bf269cf5aa64db2ee1', class: "card", onClick: () => this.cardClick.emit() }, h("div", { key: 'b57ab7677ba357e3897f7dff5a2d8bb50a6af417', class: "image-wrap" }, this.image ? h("img", { src: this.image, alt: this.recipeTitle }) : h("div", { class: "placeholder" }), h("button", { key: '6720508f3723573e4fe4eef2504cffc442d3ffe1', class: { 'fav-btn': true, active: this.favorite }, onClick: this.onFavoriteClick, "aria-label": "Toggle favorite" }, this.favorite ? '★' : '☆')), h("div", { key: 'e30557f6fa8ca3117d7f239c1f14e07e009500a2', class: "body" }, h("h3", { key: '11c63ca021b1204c78783b53d9defb1eddbe15fa' }, this.recipeTitle), this.category && h("span", { key: 'b3d2b2ebd8997d662ade303736b4ddd494a0e273', class: "category" }, this.category), h("div", { key: '80cc820f78f3fd4cb64f802e69ba03cfb441ce6c', class: "actions" }, h("slot", { key: '318cfb3954ad5392d56af94ba8a0e3cb3c220fa7', 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: '5d0c846f0a8df8aa178915d4ee6b6fa0009cba07', class: "wrap" }, h("button", { key: '49f9fa32d23122cdcee7f51869f3c158d0ce86c0', 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,14 +1,19 @@
|
|
|
1
1
|
import { h } from "@stencil/core";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
2
|
+
const DEFAULT_AREAS = [
|
|
3
|
+
'American', 'British', 'Chinese', 'Croatian', 'Dutch', 'Egyptian',
|
|
4
|
+
'Filipino', 'French', 'Greek', 'Indian', 'Irish', 'Italian', 'Jamaican',
|
|
5
|
+
'Japanese', 'Kenyan', 'Malaysian', 'Mexican', 'Moroccan', 'Polish',
|
|
6
|
+
'Portuguese', 'Russian', 'Spanish', 'Thai', 'Tunisian', 'Turkish',
|
|
7
|
+
'Vietnamese', 'Other',
|
|
8
|
+
];
|
|
7
9
|
export class RecipeForm {
|
|
8
10
|
constructor() {
|
|
11
|
+
/** Cuisine/cuisine options for the dropdown — override to supply your own list */
|
|
12
|
+
this.cuisines = DEFAULT_AREAS;
|
|
9
13
|
this.title = '';
|
|
10
14
|
this.image = '';
|
|
11
15
|
this.category = '';
|
|
16
|
+
this.cuisine = '';
|
|
12
17
|
this.ingredients = [''];
|
|
13
18
|
this.instructions = '';
|
|
14
19
|
this.errors = {};
|
|
@@ -21,6 +26,7 @@ export class RecipeForm {
|
|
|
21
26
|
title: this.title.trim(),
|
|
22
27
|
image: this.image.trim(),
|
|
23
28
|
category: this.category.trim(),
|
|
29
|
+
cuisine: this.cuisine.trim(),
|
|
24
30
|
ingredients: this.ingredients.map((i) => i.trim()).filter(Boolean),
|
|
25
31
|
instructions: this.instructions.trim(),
|
|
26
32
|
};
|
|
@@ -56,6 +62,7 @@ export class RecipeForm {
|
|
|
56
62
|
this.title = data.title ?? '';
|
|
57
63
|
this.image = data.image ?? '';
|
|
58
64
|
this.category = data.category ?? '';
|
|
65
|
+
this.cuisine = data.cuisine ?? '';
|
|
59
66
|
this.ingredients = data.ingredients?.length ? [...data.ingredients] : [''];
|
|
60
67
|
this.instructions = data.instructions ?? '';
|
|
61
68
|
}
|
|
@@ -64,8 +71,6 @@ export class RecipeForm {
|
|
|
64
71
|
const errors = {};
|
|
65
72
|
if (!this.title.trim())
|
|
66
73
|
errors.title = 'Title is required.';
|
|
67
|
-
if (!this.category.trim())
|
|
68
|
-
errors.category = 'Category is required.';
|
|
69
74
|
const cleanIngredients = this.ingredients.map((i) => i.trim()).filter(Boolean);
|
|
70
75
|
if (cleanIngredients.length === 0)
|
|
71
76
|
errors.ingredients = 'Add at least one ingredient.';
|
|
@@ -80,7 +85,7 @@ export class RecipeForm {
|
|
|
80
85
|
this.ingredients = next;
|
|
81
86
|
}
|
|
82
87
|
render() {
|
|
83
|
-
return (h("form", { key: '
|
|
88
|
+
return (h("form", { key: '7268362cd88d1d924f4bf5e4061b136454935f7b', onSubmit: this.onSubmit }, h("slot", { key: '913490a0ba22ca884bcc1cac49c07573f2e8c214', name: "header" }), h("label", { key: 'cdc71ed3a3d297e7f111f7ec67c111818fe0fdf8' }, "Title", h("input", { key: 'c17da6820f298ee9fc786fa206ef3bc97e361735', type: "text", value: this.title, onInput: (e) => (this.title = e.target.value) }), this.errors.title && h("span", { key: '2c61cc6f37f87536e72fe281b50a3c6a2bdfd9f2', class: "error" }, this.errors.title)), h("label", { key: '28aca3cb1ffeae0f471477d3e564598fe0459cc7' }, "Image URL", h("input", { key: 'd523a018b35b7160061db9dc8059ee5ce3f58433', type: "text", value: this.image, onInput: (e) => (this.image = e.target.value) })), h("div", { key: 'c01339651af391405999f3081ee98ad2be33d6da', class: "row" }, h("label", { key: '656b72f2ccb9488d22900f1b26f0907ece8190af' }, "Category", h("input", { key: '1b973a0c12b3c66e3c585e92930b4bdbb7240b0e', type: "text", value: this.category, onInput: (e) => (this.category = e.target.value) })), h("label", { key: '9e25bad33d00c3285fd948f3e7535e5c9d8d45f9' }, "Cuisine / Area", h("select", { key: '52365ebccaa5fa2e2361ab8102b1151eb60cb5d6', onInput: (e) => (this.cuisine = e.target.value) }, h("option", { key: 'ad40fd1dde5cae8e241fced55455dbadfede6734', value: "", selected: this.cuisine === '' }, "Select a cuisine\u2026"), this.cuisines.map((a) => (h("option", { value: a, selected: a === this.cuisine }, a)))))), h("div", { key: '53173a3fbea53dad5625e28a67aebbbe9880c490', class: "field" }, h("span", { key: 'e5699c07f862027afa73ce59c1f450df48504f37' }, "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: 'c37385b611c3b05eeb32a4f1a6de110b8a3b6be4', type: "button", class: "add-btn", onClick: this.addIngredient }, "+ Add ingredient"), this.errors.ingredients && h("span", { key: '1e7c662423b1915bbfc7d2aeea9cea3cfef9d002', class: "error" }, this.errors.ingredients)), h("label", { key: '267e09ca2bb1a91ef552dc3522105d079570499d' }, "Instructions", h("textarea", { key: '99f4aa91fba6c3d499c4efa904794a6de75e62cd', rows: 5, onInput: (e) => (this.instructions = e.target.value) }, this.instructions), this.errors.instructions && h("span", { key: 'cde019552bf691ee8e5a737c8a8d3c493961b0f9', class: "error" }, this.errors.instructions)), h("div", { key: 'b4f40cb9ab323bcc27088e7d6c7609f26b6fd9cb', class: "footer" }, h("slot", { key: '150b900bcadc7f51cfdfd7fe9667c22c55a745fb', name: "footer" }), h("button", { key: '94e6ca7f8c291051f59b8fa4794c59833884d433', type: "button", class: "cancel-btn", onClick: () => this.cancel.emit() }, "Cancel"), h("button", { key: '462f42ddfdd000af25066a1d4dbfc07be95abdd6', type: "submit", class: "save-btn" }, "Save Recipe"))));
|
|
84
89
|
}
|
|
85
90
|
static get is() { return "recipe-form"; }
|
|
86
91
|
static get encapsulation() { return "shadow"; }
|
|
@@ -105,7 +110,7 @@ export class RecipeForm {
|
|
|
105
110
|
"references": {
|
|
106
111
|
"RecipeFormData": {
|
|
107
112
|
"location": "local",
|
|
108
|
-
"path": "C:/Users/gurpi/
|
|
113
|
+
"path": "C:/Users/gurpi/source/repos/Recipe-Finder/packages/recipe-ui/src/components/recipe-form/recipe-form.tsx",
|
|
109
114
|
"id": "src/components/recipe-form/recipe-form.tsx::RecipeFormData"
|
|
110
115
|
}
|
|
111
116
|
}
|
|
@@ -114,12 +119,30 @@ export class RecipeForm {
|
|
|
114
119
|
"optional": false,
|
|
115
120
|
"docs": {
|
|
116
121
|
"tags": [],
|
|
117
|
-
"text": "
|
|
122
|
+
"text": ""
|
|
118
123
|
},
|
|
119
124
|
"getter": false,
|
|
120
125
|
"setter": false,
|
|
121
126
|
"reflect": false,
|
|
122
127
|
"attribute": "initial-data"
|
|
128
|
+
},
|
|
129
|
+
"cuisines": {
|
|
130
|
+
"type": "unknown",
|
|
131
|
+
"mutable": false,
|
|
132
|
+
"complexType": {
|
|
133
|
+
"original": "string[]",
|
|
134
|
+
"resolved": "string[]",
|
|
135
|
+
"references": {}
|
|
136
|
+
},
|
|
137
|
+
"required": false,
|
|
138
|
+
"optional": false,
|
|
139
|
+
"docs": {
|
|
140
|
+
"tags": [],
|
|
141
|
+
"text": "Cuisine/cuisine options for the dropdown \u2014 override to supply your own list"
|
|
142
|
+
},
|
|
143
|
+
"getter": false,
|
|
144
|
+
"setter": false,
|
|
145
|
+
"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]"
|
|
123
146
|
}
|
|
124
147
|
};
|
|
125
148
|
}
|
|
@@ -128,6 +151,7 @@ export class RecipeForm {
|
|
|
128
151
|
"title": {},
|
|
129
152
|
"image": {},
|
|
130
153
|
"category": {},
|
|
154
|
+
"cuisine": {},
|
|
131
155
|
"ingredients": {},
|
|
132
156
|
"instructions": {},
|
|
133
157
|
"errors": {}
|
|
@@ -150,7 +174,7 @@ export class RecipeForm {
|
|
|
150
174
|
"references": {
|
|
151
175
|
"RecipeFormData": {
|
|
152
176
|
"location": "local",
|
|
153
|
-
"path": "C:/Users/gurpi/
|
|
177
|
+
"path": "C:/Users/gurpi/source/repos/Recipe-Finder/packages/recipe-ui/src/components/recipe-form/recipe-form.tsx",
|
|
154
178
|
"id": "src/components/recipe-form/recipe-form.tsx::RecipeFormData"
|
|
155
179
|
}
|
|
156
180
|
}
|
|
@@ -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: '37923bd59ca23e07af39ebaca47a3e613809c12b', 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: '65403c53fbbe3a809f1de94bb02b04a57e5b8cd1', class: "wrap" }, h("input", { key: '43fb8c2a103e9e700b62ad86de1a559fc3b71d5b', type: "search", placeholder: this.placeholder, value: this.internalValue, onInput: this.onInput, onKeyDown: this.onKeyDown }), h("button", { key: '2399fce8ff18e60c83bf575454eeff0e74596c6b', 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-CWQoij-1.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-CoCM6o6z.js";export{R as RecipeSearchBar}from"./p-vGdzhVB7.js";export{R as RecipeFilterBar}from"./p-BIz6x-m7.js";export{R as RecipeRating}from"./p-Ckp6dPOc.js";export{R as RecipeForm}from"./p-xcFZ4dcw.js";export{M as MealPlanDay}from"./p-S4266va_.js";export{A as AppModal}from"./p-Dp1sKtrN.js";export{A as AppToast}from"./p-CWQoij-1.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:"5d0c846f0a8df8aa178915d4ee6b6fa0009cba07",class:"wrap"},r("button",{key:"49f9fa32d23122cdcee7f51869f3c158d0ce86c0",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 e,c as o,h as a}from"./p-BJU3HdRm.js";const i=t(class extends e{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 a("div",{key:"77c3d328a79659573feaaabe30b8c53c2023fb06",class:`toast ${this.type}`},a("span",{key:"0056d61321beb80bdebd957be4322516282fd07e"},this.message),a("button",{key:"f9b6161dcd74223f3241311e54ab5e2736dcbd3b",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 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:"37923bd59ca23e07af39ebaca47a3e613809c12b",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 l(){"undefined"!=typeof customElements&&["recipe-rating"].forEach((t=>{"recipe-rating"===t&&(customElements.get(s(t))||customElements.define(s(t),r))}))}l();export{r as R,l as d}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e,p as
|
|
1
|
+
import{t as e,p as a,H as t,c as i,h as s}from"./p-BJU3HdRm.js";const r=a(class extends t{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:"1602604f99f17895a29343bf269cf5aa64db2ee1",class:"card",onClick:()=>this.cardClick.emit()},s("div",{key:"b57ab7677ba357e3897f7dff5a2d8bb50a6af417",class:"image-wrap"},this.image?s("img",{src:this.image,alt:this.recipeTitle}):s("div",{class:"placeholder"}),s("button",{key:"6720508f3723573e4fe4eef2504cffc442d3ffe1",class:{"fav-btn":!0,active:this.favorite},onClick:this.onFavoriteClick,"aria-label":"Toggle favorite"},this.favorite?"★":"☆")),s("div",{key:"e30557f6fa8ca3117d7f239c1f14e07e009500a2",class:"body"},s("h3",{key:"11c63ca021b1204c78783b53d9defb1eddbe15fa"},this.recipeTitle),this.category&&s("span",{key:"b3d2b2ebd8997d662ade303736b4ddd494a0e273",class:"category"},this.category),s("div",{key:"80cc820f78f3fd4cb64f802e69ba03cfb441ce6c",class:"actions"},s("slot",{key:"318cfb3954ad5392d56af94ba8a0e3cb3c220fa7",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((a=>{"recipe-card"===a&&(customElements.get(e(a))||customElements.define(e(a),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 i,h as a}from"./p-BJU3HdRm.js";const r=t(class extends s{constructor(e){super(),!1!==e&&this.__registerHost(),this.__attachShadow(),this.search=i(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 a("div",{key:"65403c53fbbe3a809f1de94bb02b04a57e5b8cd1",class:"wrap"},a("input",{key:"43fb8c2a103e9e700b62ad86de1a559fc3b71d5b",type:"search",placeholder:this.placeholder,value:this.internalValue,onInput:this.onInput,onKeyDown:this.onKeyDown}),a("button",{key:"2399fce8ff18e60c83bf575454eeff0e74596c6b",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}
|
|
@@ -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"],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 +1 @@
|
|
|
1
|
-
import{R as
|
|
1
|
+
import{R as o,d as s}from"./p-CoCM6o6z.js";const p=o,r=s;export{p as RecipeCard,r as defineCustomElement}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{R as o,d as s}from"./p-
|
|
1
|
+
import{R as o,d as s}from"./p-BIz6x-m7.js";const m=o,p=s;export{m as RecipeFilterBar,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-xcFZ4dcw.js";const c=o,p=s;export{c as RecipeForm,p as defineCustomElement}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{R as o,d as
|
|
1
|
+
import{R as o,d as p}from"./p-Ckp6dPOc.js";const s=o,r=p;export{s as RecipeRating,r as defineCustomElement}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{R as
|
|
1
|
+
import{R as o,d as s}from"./p-vGdzhVB7.js";const p=o,r=s;export{p as RecipeSearchBar,r 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: '1602604f99f17895a29343bf269cf5aa64db2ee1', class: "card", onClick: () => this.cardClick.emit() }, h("div", { key: 'b57ab7677ba357e3897f7dff5a2d8bb50a6af417', class: "image-wrap" }, this.image ? h("img", { src: this.image, alt: this.recipeTitle }) : h("div", { class: "placeholder" }), h("button", { key: '6720508f3723573e4fe4eef2504cffc442d3ffe1', class: { 'fav-btn': true, active: this.favorite }, onClick: this.onFavoriteClick, "aria-label": "Toggle favorite" }, this.favorite ? '★' : '☆')), h("div", { key: 'e30557f6fa8ca3117d7f239c1f14e07e009500a2', class: "body" }, h("h3", { key: '11c63ca021b1204c78783b53d9defb1eddbe15fa' }, this.recipeTitle), this.category && h("span", { key: 'b3d2b2ebd8997d662ade303736b4ddd494a0e273', class: "category" }, this.category), h("div", { key: '80cc820f78f3fd4cb64f802e69ba03cfb441ce6c', class: "actions" }, h("slot", { key: '318cfb3954ad5392d56af94ba8a0e3cb3c220fa7', 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: '65403c53fbbe3a809f1de94bb02b04a57e5b8cd1', class: "wrap" }, h("input", { key: '43fb8c2a103e9e700b62ad86de1a559fc3b71d5b', type: "search", placeholder: this.placeholder, value: this.internalValue, onInput: this.onInput, onKeyDown: this.onKeyDown }), h("button", { key: '2399fce8ff18e60c83bf575454eeff0e74596c6b', 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: '5d0c846f0a8df8aa178915d4ee6b6fa0009cba07', class: "wrap" }, h("button", { key: '49f9fa32d23122cdcee7f51869f3c158d0ce86c0', 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,21 +94,31 @@ 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: '37923bd59ca23e07af39ebaca47a3e613809c12b', 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
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}`;
|
|
103
103
|
|
|
104
|
+
const DEFAULT_AREAS = [
|
|
105
|
+
'American', 'British', 'Chinese', 'Croatian', 'Dutch', 'Egyptian',
|
|
106
|
+
'Filipino', 'French', 'Greek', 'Indian', 'Irish', 'Italian', 'Jamaican',
|
|
107
|
+
'Japanese', 'Kenyan', 'Malaysian', 'Mexican', 'Moroccan', 'Polish',
|
|
108
|
+
'Portuguese', 'Russian', 'Spanish', 'Thai', 'Tunisian', 'Turkish',
|
|
109
|
+
'Vietnamese', 'Other',
|
|
110
|
+
];
|
|
104
111
|
const RecipeForm = class {
|
|
105
112
|
constructor(hostRef) {
|
|
106
113
|
registerInstance(this, hostRef);
|
|
107
114
|
this.save = createEvent(this, "save");
|
|
108
115
|
this.cancel = createEvent(this, "cancel");
|
|
116
|
+
/** Cuisine/cuisine options for the dropdown — override to supply your own list */
|
|
117
|
+
this.cuisines = DEFAULT_AREAS;
|
|
109
118
|
this.title = '';
|
|
110
119
|
this.image = '';
|
|
111
120
|
this.category = '';
|
|
121
|
+
this.cuisine = '';
|
|
112
122
|
this.ingredients = [''];
|
|
113
123
|
this.instructions = '';
|
|
114
124
|
this.errors = {};
|
|
@@ -121,6 +131,7 @@ const RecipeForm = class {
|
|
|
121
131
|
title: this.title.trim(),
|
|
122
132
|
image: this.image.trim(),
|
|
123
133
|
category: this.category.trim(),
|
|
134
|
+
cuisine: this.cuisine.trim(),
|
|
124
135
|
ingredients: this.ingredients.map((i) => i.trim()).filter(Boolean),
|
|
125
136
|
instructions: this.instructions.trim(),
|
|
126
137
|
};
|
|
@@ -156,6 +167,7 @@ const RecipeForm = class {
|
|
|
156
167
|
this.title = data.title ?? '';
|
|
157
168
|
this.image = data.image ?? '';
|
|
158
169
|
this.category = data.category ?? '';
|
|
170
|
+
this.cuisine = data.cuisine ?? '';
|
|
159
171
|
this.ingredients = data.ingredients?.length ? [...data.ingredients] : [''];
|
|
160
172
|
this.instructions = data.instructions ?? '';
|
|
161
173
|
}
|
|
@@ -164,8 +176,6 @@ const RecipeForm = class {
|
|
|
164
176
|
const errors = {};
|
|
165
177
|
if (!this.title.trim())
|
|
166
178
|
errors.title = 'Title is required.';
|
|
167
|
-
if (!this.category.trim())
|
|
168
|
-
errors.category = 'Category is required.';
|
|
169
179
|
const cleanIngredients = this.ingredients.map((i) => i.trim()).filter(Boolean);
|
|
170
180
|
if (cleanIngredients.length === 0)
|
|
171
181
|
errors.ingredients = 'Add at least one ingredient.';
|
|
@@ -180,7 +190,7 @@ const RecipeForm = class {
|
|
|
180
190
|
this.ingredients = next;
|
|
181
191
|
}
|
|
182
192
|
render() {
|
|
183
|
-
return (h("form", { key: '
|
|
193
|
+
return (h("form", { key: '7268362cd88d1d924f4bf5e4061b136454935f7b', onSubmit: this.onSubmit }, h("slot", { key: '913490a0ba22ca884bcc1cac49c07573f2e8c214', name: "header" }), h("label", { key: 'cdc71ed3a3d297e7f111f7ec67c111818fe0fdf8' }, "Title", h("input", { key: 'c17da6820f298ee9fc786fa206ef3bc97e361735', type: "text", value: this.title, onInput: (e) => (this.title = e.target.value) }), this.errors.title && h("span", { key: '2c61cc6f37f87536e72fe281b50a3c6a2bdfd9f2', class: "error" }, this.errors.title)), h("label", { key: '28aca3cb1ffeae0f471477d3e564598fe0459cc7' }, "Image URL", h("input", { key: 'd523a018b35b7160061db9dc8059ee5ce3f58433', type: "text", value: this.image, onInput: (e) => (this.image = e.target.value) })), h("div", { key: 'c01339651af391405999f3081ee98ad2be33d6da', class: "row" }, h("label", { key: '656b72f2ccb9488d22900f1b26f0907ece8190af' }, "Category", h("input", { key: '1b973a0c12b3c66e3c585e92930b4bdbb7240b0e', type: "text", value: this.category, onInput: (e) => (this.category = e.target.value) })), h("label", { key: '9e25bad33d00c3285fd948f3e7535e5c9d8d45f9' }, "Cuisine / Area", h("select", { key: '52365ebccaa5fa2e2361ab8102b1151eb60cb5d6', onInput: (e) => (this.cuisine = e.target.value) }, h("option", { key: 'ad40fd1dde5cae8e241fced55455dbadfede6734', value: "", selected: this.cuisine === '' }, "Select a cuisine\u2026"), this.cuisines.map((a) => (h("option", { value: a, selected: a === this.cuisine }, a)))))), h("div", { key: '53173a3fbea53dad5625e28a67aebbbe9880c490', class: "field" }, h("span", { key: 'e5699c07f862027afa73ce59c1f450df48504f37' }, "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: 'c37385b611c3b05eeb32a4f1a6de110b8a3b6be4', type: "button", class: "add-btn", onClick: this.addIngredient }, "+ Add ingredient"), this.errors.ingredients && h("span", { key: '1e7c662423b1915bbfc7d2aeea9cea3cfef9d002', class: "error" }, this.errors.ingredients)), h("label", { key: '267e09ca2bb1a91ef552dc3522105d079570499d' }, "Instructions", h("textarea", { key: '99f4aa91fba6c3d499c4efa904794a6de75e62cd', rows: 5, onInput: (e) => (this.instructions = e.target.value) }, this.instructions), this.errors.instructions && h("span", { key: 'cde019552bf691ee8e5a737c8a8d3c493961b0f9', class: "error" }, this.errors.instructions)), h("div", { key: 'b4f40cb9ab323bcc27088e7d6c7609f26b6fd9cb', class: "footer" }, h("slot", { key: '150b900bcadc7f51cfdfd7fe9667c22c55a745fb', name: "footer" }), h("button", { key: '94e6ca7f8c291051f59b8fa4794c59833884d433', type: "button", class: "cancel-btn", onClick: () => this.cancel.emit() }, "Cancel"), h("button", { key: '462f42ddfdd000af25066a1d4dbfc07be95abdd6', type: "submit", class: "save-btn" }, "Save Recipe"))));
|
|
184
194
|
}
|
|
185
195
|
static get watchers() { return {
|
|
186
196
|
"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: '77c3d328a79659573feaaabe30b8c53c2023fb06', class: `toast ${this.type}` }, h("span", { key: '0056d61321beb80bdebd957be4322516282fd07e' }, this.message), h("button", { key: 'f9b6161dcd74223f3241311e54ab5e2736dcbd3b', 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"],"title":[32],"image":[32],"category":[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);
|
|
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"],"cuisines":[16],"title":[32],"image":[32],"category":[32],"cuisine":[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"],"title":[32],"image":[32],"category":[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);
|
|
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"],"cuisines":[16],"title":[32],"image":[32],"category":[32],"cuisine":[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 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:"77c3d328a79659573feaaabe30b8c53c2023fb06",class:`toast ${this.type}`},o("span",{key:"0056d61321beb80bdebd957be4322516282fd07e"},this.message),o("button",{key:"f9b6161dcd74223f3241311e54ab5e2736dcbd3b",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}
|
|
@@ -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:"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}
|
|
@@ -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 i}from"./p-DQuL1Twl.js";(()=>{const a=import.meta.url,i={};return""!==a&&(i.resourcesUrl=new URL(".",a).href),e(i)})().then((async e=>(await i(),a([["p-
|
|
1
|
+
import{p as e,b as a}from"./p-CrZUP9M-.js";export{s as setNonce}from"./p-CrZUP9M-.js";import{g as i}from"./p-DQuL1Twl.js";(()=>{const a=import.meta.url,i={};return""!==a&&(i.resourcesUrl=new URL(".",a).href),e(i)})().then((async e=>(await i(),a([["p-e912fdc5",[[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"],cuisines:[16],title:[32],image:[32],category:[32],cuisine:[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-74151c7f",[[1,"app-toast",{message:[1],type:[1],duration:[2]}]]]],e))));
|
|
@@ -4,20 +4,18 @@ export interface RecipeFormData {
|
|
|
4
4
|
title: string;
|
|
5
5
|
image: string;
|
|
6
6
|
category: string;
|
|
7
|
+
cuisine?: string;
|
|
7
8
|
ingredients: string[];
|
|
8
9
|
instructions: string;
|
|
9
10
|
}
|
|
10
|
-
/**
|
|
11
|
-
* Add/edit form for user-created recipes. Performs client-side validation
|
|
12
|
-
* (title required, at least one non-empty ingredient, instructions required)
|
|
13
|
-
* and only emits `save` once the data is valid.
|
|
14
|
-
*/
|
|
15
11
|
export declare class RecipeForm {
|
|
16
|
-
/** Pass an existing recipe (as a JSON string or object) to edit it */
|
|
17
12
|
initialData: RecipeFormData | string;
|
|
13
|
+
/** Cuisine/cuisine options for the dropdown — override to supply your own list */
|
|
14
|
+
cuisines: string[];
|
|
18
15
|
title: string;
|
|
19
16
|
image: string;
|
|
20
17
|
category: string;
|
|
18
|
+
cuisine: string;
|
|
21
19
|
ingredients: string[];
|
|
22
20
|
instructions: string;
|
|
23
21
|
errors: Record<string, string>;
|
|
@@ -97,15 +97,12 @@ export namespace Components {
|
|
|
97
97
|
*/
|
|
98
98
|
"categories": string[];
|
|
99
99
|
}
|
|
100
|
-
/**
|
|
101
|
-
* Add/edit form for user-created recipes. Performs client-side validation
|
|
102
|
-
* (title required, at least one non-empty ingredient, instructions required)
|
|
103
|
-
* and only emits `save` once the data is valid.
|
|
104
|
-
*/
|
|
105
100
|
interface RecipeForm {
|
|
106
101
|
/**
|
|
107
|
-
*
|
|
102
|
+
* Cuisine/cuisine options for the dropdown — override to supply your own list
|
|
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', ]
|
|
108
104
|
*/
|
|
105
|
+
"cuisines": string[];
|
|
109
106
|
"initialData": RecipeFormData | string;
|
|
110
107
|
}
|
|
111
108
|
/**
|
|
@@ -286,11 +283,6 @@ declare global {
|
|
|
286
283
|
"save": RecipeFormData;
|
|
287
284
|
"cancel": void;
|
|
288
285
|
}
|
|
289
|
-
/**
|
|
290
|
-
* Add/edit form for user-created recipes. Performs client-side validation
|
|
291
|
-
* (title required, at least one non-empty ingredient, instructions required)
|
|
292
|
-
* and only emits `save` once the data is valid.
|
|
293
|
-
*/
|
|
294
286
|
interface HTMLRecipeFormElement extends Components.RecipeForm, HTMLStencilElement {
|
|
295
287
|
addEventListener<K extends keyof HTMLRecipeFormElementEventMap>(type: K, listener: (this: HTMLRecipeFormElement, ev: RecipeFormCustomEvent<HTMLRecipeFormElementEventMap[K]>) => any, options?: boolean | AddEventListenerOptions): void;
|
|
296
288
|
addEventListener<K extends keyof DocumentEventMap>(type: K, listener: (this: Document, ev: DocumentEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
|
|
@@ -458,15 +450,12 @@ declare namespace LocalJSX {
|
|
|
458
450
|
"categories"?: string[];
|
|
459
451
|
"onFilterChange"?: (event: RecipeFilterBarCustomEvent<{ value: string }>) => void;
|
|
460
452
|
}
|
|
461
|
-
/**
|
|
462
|
-
* Add/edit form for user-created recipes. Performs client-side validation
|
|
463
|
-
* (title required, at least one non-empty ingredient, instructions required)
|
|
464
|
-
* and only emits `save` once the data is valid.
|
|
465
|
-
*/
|
|
466
453
|
interface RecipeForm {
|
|
467
454
|
/**
|
|
468
|
-
*
|
|
455
|
+
* Cuisine/cuisine options for the dropdown — override to supply your own list
|
|
456
|
+
* @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', ]
|
|
469
457
|
*/
|
|
458
|
+
"cuisines"?: string[];
|
|
470
459
|
"initialData"?: RecipeFormData | string;
|
|
471
460
|
"onCancel"?: (event: RecipeFormCustomEvent<void>) => void;
|
|
472
461
|
"onSave"?: (event: RecipeFormCustomEvent<RecipeFormData>) => void;
|
|
@@ -583,11 +572,6 @@ declare module "@stencil/core" {
|
|
|
583
572
|
* Emits `filterChange` with the selected value ('' = all).
|
|
584
573
|
*/
|
|
585
574
|
"recipe-filter-bar": LocalJSX.IntrinsicElements["recipe-filter-bar"] & JSXBase.HTMLAttributes<HTMLRecipeFilterBarElement>;
|
|
586
|
-
/**
|
|
587
|
-
* Add/edit form for user-created recipes. Performs client-side validation
|
|
588
|
-
* (title required, at least one non-empty ingredient, instructions required)
|
|
589
|
-
* and only emits `save` once the data is valid.
|
|
590
|
-
*/
|
|
591
575
|
"recipe-form": LocalJSX.IntrinsicElements["recipe-form"] & JSXBase.HTMLAttributes<HTMLRecipeFormElement>;
|
|
592
576
|
/**
|
|
593
577
|
* 5-star rating. Read-only display or interactive input.
|
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=t(class extends i{constructor(e){super(),!1!==e&&this.__registerHost(),this.__attachShadow(),this.save=a(this,"save"),this.cancel=a(this,"cancel"),this.title="",this.image="",this.category="",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(),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.ingredients=e.ingredients?.length?[...e.ingredients]:[""],this.instructions=e.instructions??"")}validate(){const e={};return this.title.trim()||(e.title="Title is required."),this.category.trim()||(e.category="Category 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:"d7bf28b14b5d445221c52595bd827f49eed9306b",onSubmit:this.onSubmit},s("slot",{key:"0ffc3f7fd2e5a15771ae36629365c53b1c44d934",name:"header"}),s("label",{key:"617617d1d4e5b9cbfc506340f3ffcab0364bb402"},"Title",s("input",{key:"9be17e32164005466bf208323380603e33e43f6e",type:"text",value:this.title,onInput:e=>this.title=e.target.value}),this.errors.title&&s("span",{key:"e1ecebe7af1b6b13a392f4ceb99651c6f87aea43",class:"error"},this.errors.title)),s("label",{key:"6ce777cc37e11e9c063e43e301d9c93fa7ddf4b4"},"Image URL",s("input",{key:"37839fabadb556def7f240e8116629315ca1ad73",type:"text",value:this.image,onInput:e=>this.image=e.target.value})),s("label",{key:"c870efae293faecf06e5d9481d302779c77aac39"},"Category",s("input",{key:"1cc8a5a113ac6a215dc0c53b43c1f9167afd69f4",type:"text",value:this.category,onInput:e=>this.category=e.target.value}),this.errors.category&&s("span",{key:"ed78cadd9df6f24e700aebc6f85ce993c3d4746b",class:"error"},this.errors.category)),s("div",{key:"0cbed02ba6b4b021d7cce4ffd9fb3e041452db00",class:"field"},s("span",{key:"6e8023d7fa1c3a345ac8a1ffca9de1b57af25e8c"},"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:"c6fe3f2daad8c3f19daa3570c6e593c6b089aa57",type:"button",class:"add-btn",onClick:this.addIngredient},"+ Add ingredient"),this.errors.ingredients&&s("span",{key:"bfec646ff34633a03d6b3368c5fb095bc3066025",class:"error"},this.errors.ingredients)),s("label",{key:"d3487e03e2c26afe9b3807a9d1f1240dabb30373"},"Instructions",s("textarea",{key:"ade48aaca40198665a1fb1525834c27ec0ad0350",rows:5,onInput:e=>this.instructions=e.target.value},this.instructions),this.errors.instructions&&s("span",{key:"c90068359e0448b350af5e8b15e50cce682a1615",class:"error"},this.errors.instructions)),s("div",{key:"2621aec625328743a60c79e49275384017000ccb",class:"footer"},s("slot",{key:"5d1466af5beba19e66612a7343727ab71e44455f",name:"footer"}),s("button",{key:"5a4883d864051e8081b6a7e1f5c1fb10e7bc5c1a",type:"button",class:"cancel-btn",onClick:()=>this.cancel.emit()},"Cancel"),s("button",{key:"64d4c7e5cad53b1376dce3e73860fc3d4b4d9ff2",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"],title:[32],image:[32],category:[32],ingredients:[32],instructions:[32],errors:[32]},void 0,{initialData:[{onInitialDataChange:0}]}]);function o(){"undefined"!=typeof customElements&&["recipe-form"].forEach((t=>{"recipe-form"===t&&(customElements.get(e(t))||customElements.define(e(t),n))}))}o();export{n as R,o as d}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as s,c as t,h as a}from"./p-CrZUP9M-.js";const o=class{constructor(a){s(this,a),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 a("div",{key:"41fc3560c508b3b36863417af6d8f0aa2ad26004",class:`toast ${this.type}`},a("span",{key:"b29ea7dbe53aa72524039f1ce0fea5c50406d1f0"},this.message),a("button",{key:"3b42fc8485a5d438bb29b5eab2e3ba5ab831731b",onClick:()=>this.dismiss.emit(),"aria-label":"Dismiss"},"✕"))}};o.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{o as app_toast}
|
|
@@ -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:"c9dc0d8c98899cf188fc46c72b5e809831332f24",class:"card",onClick:()=>this.cardClick.emit()},i("div",{key:"12e0512dc7ee78f46843f81483c5f7bf1fbc3616",class:"image-wrap"},this.image?i("img",{src:this.image,alt:this.recipeTitle}):i("div",{class:"placeholder"}),i("button",{key:"95ab4db232ee878d61e272ce7a4814a48790c01d",class:{"fav-btn":!0,active:this.favorite},onClick:this.onFavoriteClick,"aria-label":"Toggle favorite"},this.favorite?"★":"☆")),i("div",{key:"a2906c670d693a473b87042ff6b0ada03627205b",class:"body"},i("h3",{key:"2b0f4afecfdfd9cc996dcec29bd86957687667e3"},this.recipeTitle),this.category&&i("span",{key:"1b9c31d2723d2c87d51021569271366bac550a2f",class:"category"},this.category),i("div",{key:"d79b1cc33dcced145c3551874f69b581b4734297",class:"actions"},i("slot",{key:"9a43cf770ea8fa189564fbe14f4f135a4d8e9551",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:"b55c496d5c2968b4b79c40b9333c62ed4653e76d",class:"wrap"},i("input",{key:"081ae0dfde47acca677c746bc88cda1864eac851",type:"search",placeholder:this.placeholder,value:this.internalValue,onInput:this.onInput,onKeyDown:this.onKeyDown}),i("button",{key:"44cde335aec87330bb4486883c9cf836a6855ad0",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:"90b26633c07d813221b1cc44705c5fe510de994f",class:"wrap"},i("button",{key:"a41696529d8611f283460da1efe9205bd0b36260",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:"2d5251ae7d3a24d613b759e89ba78de1568426d8",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=class{constructor(i){e(this,i),this.save=t(this,"save"),this.cancel=t(this,"cancel"),this.title="",this.image="",this.category="",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(),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.ingredients=e.ingredients?.length?[...e.ingredients]:[""],this.instructions=e.instructions??"")}validate(){const e={};return this.title.trim()||(e.title="Title is required."),this.category.trim()||(e.category="Category 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:"d7bf28b14b5d445221c52595bd827f49eed9306b",onSubmit:this.onSubmit},i("slot",{key:"0ffc3f7fd2e5a15771ae36629365c53b1c44d934",name:"header"}),i("label",{key:"617617d1d4e5b9cbfc506340f3ffcab0364bb402"},"Title",i("input",{key:"9be17e32164005466bf208323380603e33e43f6e",type:"text",value:this.title,onInput:e=>this.title=e.target.value}),this.errors.title&&i("span",{key:"e1ecebe7af1b6b13a392f4ceb99651c6f87aea43",class:"error"},this.errors.title)),i("label",{key:"6ce777cc37e11e9c063e43e301d9c93fa7ddf4b4"},"Image URL",i("input",{key:"37839fabadb556def7f240e8116629315ca1ad73",type:"text",value:this.image,onInput:e=>this.image=e.target.value})),i("label",{key:"c870efae293faecf06e5d9481d302779c77aac39"},"Category",i("input",{key:"1cc8a5a113ac6a215dc0c53b43c1f9167afd69f4",type:"text",value:this.category,onInput:e=>this.category=e.target.value}),this.errors.category&&i("span",{key:"ed78cadd9df6f24e700aebc6f85ce993c3d4746b",class:"error"},this.errors.category)),i("div",{key:"0cbed02ba6b4b021d7cce4ffd9fb3e041452db00",class:"field"},i("span",{key:"6e8023d7fa1c3a345ac8a1ffca9de1b57af25e8c"},"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:"c6fe3f2daad8c3f19daa3570c6e593c6b089aa57",type:"button",class:"add-btn",onClick:this.addIngredient},"+ Add ingredient"),this.errors.ingredients&&i("span",{key:"bfec646ff34633a03d6b3368c5fb095bc3066025",class:"error"},this.errors.ingredients)),i("label",{key:"d3487e03e2c26afe9b3807a9d1f1240dabb30373"},"Instructions",i("textarea",{key:"ade48aaca40198665a1fb1525834c27ec0ad0350",rows:5,onInput:e=>this.instructions=e.target.value},this.instructions),this.errors.instructions&&i("span",{key:"c90068359e0448b350af5e8b15e50cce682a1615",class:"error"},this.errors.instructions)),i("div",{key:"2621aec625328743a60c79e49275384017000ccb",class:"footer"},i("slot",{key:"5d1466af5beba19e66612a7343727ab71e44455f",name:"footer"}),i("button",{key:"5a4883d864051e8081b6a7e1f5c1fb10e7bc5c1a",type:"button",class:"cancel-btn",onClick:()=>this.cancel.emit()},"Cancel"),i("button",{key:"64d4c7e5cad53b1376dce3e73860fc3d4b4d9ff2",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{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 n=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}};n.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{n 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}
|