@gurpinderjitsingh/recipe-ui 0.4.0 → 0.6.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 +85 -19
- package/dist/cjs/app-toast.cjs.entry.js +1 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/recipe-ui.cjs.js +1 -1
- package/dist/collection/components/app-toast/app-toast.js +1 -1
- package/dist/collection/components/recipe-card/recipe-card.js +1 -1
- package/dist/collection/components/recipe-filter-bar/recipe-filter-bar.js +1 -1
- package/dist/collection/components/recipe-form/recipe-form.js +120 -17
- 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-K-btCLSj.js → p-8_BMsNX-.js} +1 -1
- package/dist/components/{p-BzvqJQ_R.js → p-BUODh8vy.js} +1 -1
- package/dist/components/{p-mY_lBX8M.js → p-CeTpiLnn.js} +1 -1
- package/dist/components/{p-Cn_qfIvv.js → p-DnzGtyGi.js} +1 -1
- package/dist/components/p-DzfkrPp9.js +1 -0
- package/dist/components/{p-B92NkO3p.js → p-Ux-pnuEm.js} +1 -1
- 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 +85 -19
- 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-287982b1.entry.js +1 -0
- package/dist/recipe-ui/{p-e66a8ded.entry.js → p-8ed4bce8.entry.js} +1 -1
- package/dist/recipe-ui/recipe-ui.esm.js +1 -1
- package/dist/types/components/recipe-form/recipe-form.d.ts +9 -3
- package/dist/types/components.d.ts +16 -4
- package/package.json +1 -1
- package/dist/components/p-u-o4onHp.js +0 -1
- package/dist/recipe-ui/p-1f2f28cf.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: 'd84f83b5082a49a5a05b93678538bfcfecd92e47', class: "card", onClick: () => this.cardClick.emit() }, index.h("div", { key: 'a0e4f5fae6b7c14c750263f8de9bef9fbd8180a0', class: "image-wrap" }, this.image ? index.h("img", { src: this.image, alt: this.recipeTitle }) : index.h("div", { class: "placeholder" }), index.h("button", { key: '9266af379f6ebeb2624131e5c3f287d64cf4b3a5', class: { 'fav-btn': true, active: this.favorite }, onClick: this.onFavoriteClick, "aria-label": "Toggle favorite" }, this.favorite ? '★' : '☆')), index.h("div", { key: 'd0b5fa56b17c14763ecc6301864ef797565c6313', class: "body" }, index.h("h3", { key: '0c67db81d80a820cce2e6bfedd2df2611358d1e8' }, this.recipeTitle), this.category && index.h("span", { key: '30f89cf328a098be1c109d3e71b8f9f15827c6f1', class: "category" }, this.category), index.h("div", { key: '353b2663855e7ac53817d17acaf7b83908c17d85', class: "actions" }, index.h("slot", { key: '0a04fc5024751df45d744814f579100913dcd1fc', 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: '00fa553cd92086a5cac70ca6b13792dfa41fc1dd', class: "wrap" }, index.h("input", { key: 'a116c51839c228d4daff54347e6b2d56c9dc2579', type: "search", placeholder: this.placeholder, value: this.internalValue, onInput: this.onInput, onKeyDown: this.onKeyDown }), index.h("button", { key: 'e16a909061abd80889ad7b7646219a7428e4db4d', 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: '3088a84e81d49c06a12f93e491d4ae3e7022635f', class: "wrap" }, index.h("button", { key: '0e8b7455b1364eb76721d4f6c227a0803750c466', 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,13 +96,18 @@ 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: '09bd2482d310e73993faea601d5ab86f20fc6fb7', 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,select{font-weight:400;padding:8px 10px;border:1px solid #ddd;border-radius:6px;font-size:14px;font-family:inherit;background:#fff;transition:border-color 0.15s ease, box-shadow 0.15s ease}input:focus,textarea:focus,select:focus{outline:none;border-color:#ff6b35;box-shadow:0 0 0 3px rgba(255, 107, 53, 0.14)}select{appearance:none;-webkit-appearance:none;-moz-appearance:none;padding-right:34px;cursor:pointer;color:#1f2937;background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");background-repeat:no-repeat;background-position:right 10px center;background-size:14px}select:hover{border-color:#bbb}select:invalid,select option[value=""]{color:#9ca3af}.row{display:grid;grid-template-columns:1fr 1fr;gap:14px}@media (max-width: 480px){.row{grid-template-columns:1fr}}.field{display:flex;flex-direction:column;gap:6px;font-size:13px;font-weight:600}.ingredient-row{display:flex;gap:6px}.ingredient-row input{flex:1}.ingredient-row button{border:none;background:#f4f4f4;border-radius:6px;cursor:pointer;width:30px}.add-btn{align-self:flex-start;border:1px dashed #bbb;background:none;border-radius:6px;padding:6px 10px;cursor:pointer;font-size:13px;color:#555}.error{color:#e74c3c;font-size:12px;font-weight:400}.footer{display:flex;justify-content:flex-end;gap:10px;margin-top:6px}.cancel-btn{border:1px solid #ddd;background:#fff;border-radius:8px;padding:8px 16px;cursor:pointer}.save-btn{border:none;background:#ff6b35;color:#fff;border-radius:8px;padding:8px 18px;cursor:pointer;font-weight:600}`;
|
|
105
105
|
|
|
106
|
+
const DEFAULT_CATEGORIES = [
|
|
107
|
+
'Beef', 'Breakfast', 'Chicken', 'Dessert', 'Goat', 'Lamb',
|
|
108
|
+
'Miscellaneous', 'Pasta', 'Pork', 'Seafood', 'Side', 'Starter',
|
|
109
|
+
'Vegan', 'Vegetarian', 'Other',
|
|
110
|
+
];
|
|
106
111
|
const DEFAULT_AREAS = [
|
|
107
112
|
'American', 'British', 'Chinese', 'Croatian', 'Dutch', 'Egyptian',
|
|
108
113
|
'Filipino', 'French', 'Greek', 'Indian', 'Irish', 'Italian', 'Jamaican',
|
|
@@ -115,13 +120,14 @@ const RecipeForm = class {
|
|
|
115
120
|
index.registerInstance(this, hostRef);
|
|
116
121
|
this.save = index.createEvent(this, "save");
|
|
117
122
|
this.cancel = index.createEvent(this, "cancel");
|
|
118
|
-
|
|
123
|
+
this.categories = DEFAULT_CATEGORIES;
|
|
124
|
+
this.extraCategories = [];
|
|
119
125
|
this.areas = DEFAULT_AREAS;
|
|
120
|
-
/** Additional cuisine options merged in before "Other" */
|
|
121
126
|
this.extraAreas = [];
|
|
122
127
|
this.title = '';
|
|
123
128
|
this.image = '';
|
|
124
129
|
this.category = '';
|
|
130
|
+
this.customCategory = '';
|
|
125
131
|
this.area = '';
|
|
126
132
|
this.customArea = '';
|
|
127
133
|
this.ingredients = [''];
|
|
@@ -131,13 +137,14 @@ const RecipeForm = class {
|
|
|
131
137
|
e.preventDefault();
|
|
132
138
|
if (!this.validate())
|
|
133
139
|
return;
|
|
140
|
+
const resolvedCategory = this.category === 'Other' ? this.customCategory.trim() : this.category;
|
|
134
141
|
const resolvedArea = this.area === 'Other' ? this.customArea.trim() : this.area;
|
|
135
142
|
const data = {
|
|
136
143
|
id: this.initialData?.id,
|
|
137
144
|
title: this.title.trim(),
|
|
138
145
|
image: this.image.trim(),
|
|
139
|
-
category:
|
|
140
|
-
|
|
146
|
+
category: resolvedCategory,
|
|
147
|
+
cuisine: resolvedArea,
|
|
141
148
|
ingredients: this.ingredients.map((i) => i.trim()).filter(Boolean),
|
|
142
149
|
instructions: this.instructions.trim(),
|
|
143
150
|
};
|
|
@@ -148,6 +155,9 @@ const RecipeForm = class {
|
|
|
148
155
|
};
|
|
149
156
|
this.removeIngredient = (index) => {
|
|
150
157
|
this.ingredients = this.ingredients.filter((_, i) => i !== index);
|
|
158
|
+
const next = this.ingredients.filter((_, i) => i !== index);
|
|
159
|
+
this.ingredients = next;
|
|
160
|
+
this.clearErrorIf('ingredients', next.some((i) => i.trim()));
|
|
151
161
|
};
|
|
152
162
|
}
|
|
153
163
|
componentWillLoad() {
|
|
@@ -156,16 +166,31 @@ const RecipeForm = class {
|
|
|
156
166
|
onInitialDataChange() {
|
|
157
167
|
this.loadInitialData();
|
|
158
168
|
}
|
|
159
|
-
|
|
160
|
-
const withoutOther =
|
|
169
|
+
mergeList(base, extra) {
|
|
170
|
+
const withoutOther = base.filter((a) => a !== 'Other');
|
|
161
171
|
const merged = [...withoutOther];
|
|
162
|
-
for (const
|
|
163
|
-
if (
|
|
164
|
-
merged.push(
|
|
172
|
+
for (const e of extra) {
|
|
173
|
+
if (e && !merged.includes(e))
|
|
174
|
+
merged.push(e);
|
|
165
175
|
}
|
|
166
176
|
merged.push('Other');
|
|
167
177
|
return merged;
|
|
168
178
|
}
|
|
179
|
+
get fullCategoryList() {
|
|
180
|
+
return this.mergeList(this.categories, this.extraCategories);
|
|
181
|
+
}
|
|
182
|
+
get fullAreaList() {
|
|
183
|
+
return this.mergeList(this.areas, this.extraAreas);
|
|
184
|
+
}
|
|
185
|
+
/** Removes a field's error as soon as it becomes valid, without waiting
|
|
186
|
+
* for the next full submit — called from each field's input handler. */
|
|
187
|
+
clearErrorIf(key, isNowValid) {
|
|
188
|
+
if (isNowValid && this.errors[key]) {
|
|
189
|
+
const next = { ...this.errors };
|
|
190
|
+
delete next[key];
|
|
191
|
+
this.errors = next;
|
|
192
|
+
}
|
|
193
|
+
}
|
|
169
194
|
loadInitialData() {
|
|
170
195
|
let data;
|
|
171
196
|
if (typeof this.initialData === 'string' && this.initialData) {
|
|
@@ -182,16 +207,24 @@ const RecipeForm = class {
|
|
|
182
207
|
if (data) {
|
|
183
208
|
this.title = data.title ?? '';
|
|
184
209
|
this.image = data.image ?? '';
|
|
185
|
-
this.category = data.category ?? '';
|
|
186
210
|
this.ingredients = data.ingredients?.length ? [...data.ingredients] : [''];
|
|
187
211
|
this.instructions = data.instructions ?? '';
|
|
212
|
+
const knownCategories = this.fullCategoryList.filter((a) => a !== 'Other');
|
|
213
|
+
if (data.category && !knownCategories.includes(data.category)) {
|
|
214
|
+
this.category = 'Other';
|
|
215
|
+
this.customCategory = data.category;
|
|
216
|
+
}
|
|
217
|
+
else {
|
|
218
|
+
this.category = data.category ?? '';
|
|
219
|
+
this.customCategory = '';
|
|
220
|
+
}
|
|
188
221
|
const knownAreas = this.fullAreaList.filter((a) => a !== 'Other');
|
|
189
|
-
if (data.
|
|
222
|
+
if (data.cuisine && !knownAreas.includes(data.cuisine)) {
|
|
190
223
|
this.area = 'Other';
|
|
191
|
-
this.customArea = data.
|
|
224
|
+
this.customArea = data.cuisine;
|
|
192
225
|
}
|
|
193
226
|
else {
|
|
194
|
-
this.area = data.
|
|
227
|
+
this.area = data.cuisine ?? '';
|
|
195
228
|
this.customArea = '';
|
|
196
229
|
}
|
|
197
230
|
}
|
|
@@ -205,7 +238,16 @@ const RecipeForm = class {
|
|
|
205
238
|
errors.ingredients = 'Add at least one ingredient.';
|
|
206
239
|
if (!this.instructions.trim())
|
|
207
240
|
errors.instructions = 'Instructions are required.';
|
|
208
|
-
if (
|
|
241
|
+
if (!this.category.trim()) {
|
|
242
|
+
errors.category = 'Category is required.';
|
|
243
|
+
}
|
|
244
|
+
else if (this.category === 'Other' && !this.customCategory.trim()) {
|
|
245
|
+
errors.customCategory = 'Enter a category name.';
|
|
246
|
+
}
|
|
247
|
+
if (!this.area.trim()) {
|
|
248
|
+
errors.area = 'Cuisine / Area is required.';
|
|
249
|
+
}
|
|
250
|
+
else if (this.area === 'Other' && !this.customArea.trim()) {
|
|
209
251
|
errors.customArea = 'Enter a cuisine name.';
|
|
210
252
|
}
|
|
211
253
|
this.errors = errors;
|
|
@@ -215,9 +257,33 @@ const RecipeForm = class {
|
|
|
215
257
|
const next = [...this.ingredients];
|
|
216
258
|
next[index] = value;
|
|
217
259
|
this.ingredients = next;
|
|
260
|
+
this.clearErrorIf('ingredients', next.some((i) => i.trim()));
|
|
218
261
|
}
|
|
219
262
|
render() {
|
|
220
|
-
return (index.h("form", { key: '
|
|
263
|
+
return (index.h("form", { key: 'c29ab62af9db4a95e11b75f25a2dd4c23e699dad', onSubmit: this.onSubmit }, index.h("slot", { key: 'ece02ab46a1075eaef912e8953e70faa11bc8d8d', name: "header" }), index.h("label", { key: '9e17e9ba311350d9235f5ec01c32743dfbf55b0e' }, "Title", index.h("input", { key: '2b8d632bc22eb5cde52198287ea2b19d87567dba', type: "text", value: this.title, onInput: (e) => {
|
|
264
|
+
(this.title = e.target.value);
|
|
265
|
+
this.clearErrorIf('title', !!this.title.trim());
|
|
266
|
+
} }), this.errors.title && index.h("span", { key: '3a34d1f5e1f43ef190983dd0883f16eb6775f07c', class: "error" }, this.errors.title)), index.h("label", { key: '6acda6ccaff2e0315cc1964ae30c18647fe97bd1' }, "Image URL", index.h("input", { key: '6bdc06a2bebd6b5ae984865aefe292426fbe38cb', type: "text", value: this.image, onInput: (e) => (this.image = e.target.value) })), index.h("div", { key: 'f6ef49aaace211659296e93b4b5b47b29db73ac6', class: "row" }, index.h("label", { key: '9610c81a85ebddc2da4bdadcdee68ddea78e28d4' }, "Category", index.h("select", { key: '46542ff9e2c0f15d60be6744e063f3c860475772', onInput: (e) => {
|
|
267
|
+
(this.category = e.target.value);
|
|
268
|
+
this.clearErrorIf('category', !!this.category);
|
|
269
|
+
if (this.category !== 'Other')
|
|
270
|
+
this.clearErrorIf('customCategory', true);
|
|
271
|
+
} }, index.h("option", { key: '2741b90edd32cb12903e877cbfa2db3b5ff04071', value: "", selected: this.category === '' }, "Select a category\u2026"), this.fullCategoryList.map((c) => (index.h("option", { value: c, selected: c === this.category }, c)))), this.errors.category && index.h("span", { key: 'dc8e7ab5a6decdece1b4559af856997251335abf', class: "error" }, this.errors.category)), index.h("label", { key: '792cb1c4fd6052f9d88c52649c6eb4dc064f0071' }, "Cuisine / Area", index.h("select", { key: '06a917ac951a4c6d3e8390534690545a1967581a', onInput: (e) => {
|
|
272
|
+
(this.area = e.target.value);
|
|
273
|
+
this.clearErrorIf('area', !!this.area);
|
|
274
|
+
if (this.area !== 'Other')
|
|
275
|
+
this.clearErrorIf('customArea', true);
|
|
276
|
+
} }, index.h("option", { key: '264c39814065b3f07626975b96eca6b7e1c9bb83', value: "", selected: this.area === '' }, "Select a cuisine\u2026"), this.fullAreaList.map((a) => (index.h("option", { value: a, selected: a === this.area }, a)))), this.errors.area && index.h("span", { key: 'f1a562402420fb7a813dd4184b439c03c71d93d9', class: "error" }, this.errors.area))), (this.category === 'Other' || this.area === 'Other') && (index.h("div", { key: '3c20e6b5b678027d711c7976c60e3be92d02fae3', class: "row" }, this.category === 'Other' && (index.h("label", { key: '4cd14baeff186c7db8fabe57b21b241567528437', class: "custom-area-field" }, "Enter category name", index.h("input", { key: 'b1880e7aaadb3ade3c980c7f44d6b0a8d4fc3923', type: "text", placeholder: "e.g. Brunch", value: this.customCategory, onInput: (e) => {
|
|
277
|
+
(this.customCategory = e.target.value);
|
|
278
|
+
this.customCategory = e.target.value;
|
|
279
|
+
this.clearErrorIf('customCategory', !!this.customCategory.trim());
|
|
280
|
+
} }), this.errors.customCategory && index.h("span", { key: 'abd5094a23a182458ff2b76a58b55d65a9540c83', class: "error" }, this.errors.customCategory))), this.area === 'Other' && (index.h("label", { key: '696c0cc6af2cf16df8559da441e38635d8e0012c', class: "custom-area-field" }, "Enter cuisine name", index.h("input", { key: '663fee3941527c736d953cc993b886746dabab23', type: "text", placeholder: "e.g. Ethiopian", value: this.customArea, onInput: (e) => {
|
|
281
|
+
this.customArea = e.target.value;
|
|
282
|
+
this.clearErrorIf('customArea', !!this.customArea.trim());
|
|
283
|
+
} }), this.errors.customArea && index.h("span", { key: '6e1b7ebfac7166fb1120b0d8f914bb076f5e40ee', class: "error" }, this.errors.customArea))))), index.h("div", { key: 'fe85b73291a5ee955d069f20ddf33835d09b95bd', class: "field" }, index.h("span", { key: 'fd010d7b12306bd4306caf03ebd972feb1e0ebb9' }, "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: '8168f7e7f4bef8be1e74d1adf377b5471701c0ff', type: "button", class: "add-btn", onClick: this.addIngredient }, "+ Add ingredient"), this.errors.ingredients && index.h("span", { key: '3e35a8fe02833b27a333fa157548b88b3f5e3842', class: "error" }, this.errors.ingredients)), index.h("label", { key: 'c5c583cba5363ce35e6d41f95917bc49e3cca02d' }, "Instructions", index.h("textarea", { key: '514c219989a01cf1ad77739bd6c0df066362c689', rows: 5, onInput: (e) => {
|
|
284
|
+
this.instructions = e.target.value;
|
|
285
|
+
this.clearErrorIf('instructions', !!this.instructions.trim());
|
|
286
|
+
} }, this.instructions), this.errors.instructions && index.h("span", { key: '89881e3b0d4f864f7ccc835d86b094f367b54b2e', class: "error" }, this.errors.instructions)), index.h("div", { key: 'b9a812287af44062e1c68034881ba62321b0e660', class: "footer" }, index.h("slot", { key: 'a8307179d95cfd713d8f5fbe6e996fefb1d54907', name: "footer" }), index.h("button", { key: 'aa75decaf67c74a183af182864a37a6cd37b56ff', type: "button", class: "cancel-btn", onClick: () => this.cancel.emit() }, "Cancel"), index.h("button", { key: '13ea35b114f1a7721347f986c6c4e64968583025', type: "submit", class: "save-btn" }, "Save Recipe"))));
|
|
221
287
|
}
|
|
222
288
|
static get watchers() { return {
|
|
223
289
|
"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: '8b34f0098a8d17af8b9384ddf8838c8ad6eaf7f2', class: `toast ${this.type}` }, index.h("span", { key: '652ce04dad64022f77dbd0236ebfc1a0075ba121' }, this.message), index.h("button", { key: '760c2e84e1bf01c3b7a8c43addf983711453be3b', 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"],"areas":[16],"extraAreas":[16],"title":[32],"image":[32],"category":[32],"area":[32],"customArea":[32],"ingredients":[32],"instructions":[32],"errors":[32]},null,{"initialData":[{"onInitialDataChange":0}]}],[1,"recipe-rating",{"value":[2],"readonly":[4],"max":[2]}],[1,"recipe-search-bar",{"placeholder":[1],"value":[1],"debounceMs":[2,"debounce-ms"],"internalValue":[32]},null,{"value":[{"onValuePropChange":0}]}]]],["app-toast.cjs",[[1,"app-toast",{"message":[1],"type":[1],"duration":[2]}]]]], options);
|
|
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"],"categories":[16],"extraCategories":[16],"areas":[16],"extraAreas":[16],"title":[32],"image":[32],"category":[32],"customCategory":[32],"area":[32],"customArea":[32],"ingredients":[32],"instructions":[32],"errors":[32]},null,{"initialData":[{"onInitialDataChange":0}]}],[1,"recipe-rating",{"value":[2],"readonly":[4],"max":[2]}],[1,"recipe-search-bar",{"placeholder":[1],"value":[1],"debounceMs":[2,"debounce-ms"],"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"],"areas":[16],"extraAreas":[16],"title":[32],"image":[32],"category":[32],"area":[32],"customArea":[32],"ingredients":[32],"instructions":[32],"errors":[32]},null,{"initialData":[{"onInitialDataChange":0}]}],[1,"recipe-rating",{"value":[2],"readonly":[4],"max":[2]}],[1,"recipe-search-bar",{"placeholder":[1],"value":[1],"debounceMs":[2,"debounce-ms"],"internalValue":[32]},null,{"value":[{"onValuePropChange":0}]}]]],["app-toast.cjs",[[1,"app-toast",{"message":[1],"type":[1],"duration":[2]}]]]], options);
|
|
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"],"categories":[16],"extraCategories":[16],"areas":[16],"extraAreas":[16],"title":[32],"image":[32],"category":[32],"customCategory":[32],"area":[32],"customArea":[32],"ingredients":[32],"instructions":[32],"errors":[32]},null,{"initialData":[{"onInitialDataChange":0}]}],[1,"recipe-rating",{"value":[2],"readonly":[4],"max":[2]}],[1,"recipe-search-bar",{"placeholder":[1],"value":[1],"debounceMs":[2,"debounce-ms"],"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: '8b34f0098a8d17af8b9384ddf8838c8ad6eaf7f2', class: `toast ${this.type}` }, h("span", { key: '652ce04dad64022f77dbd0236ebfc1a0075ba121' }, this.message), h("button", { key: '760c2e84e1bf01c3b7a8c43addf983711453be3b', onClick: () => this.dismiss.emit(), "aria-label": "Dismiss" }, "\u2715")));
|
|
16
16
|
}
|
|
17
17
|
static get is() { return "app-toast"; }
|
|
18
18
|
static get encapsulation() { return "shadow"; }
|
|
@@ -17,7 +17,7 @@ export class RecipeCard {
|
|
|
17
17
|
};
|
|
18
18
|
}
|
|
19
19
|
render() {
|
|
20
|
-
return (h("div", { key: '
|
|
20
|
+
return (h("div", { key: 'd84f83b5082a49a5a05b93678538bfcfecd92e47', class: "card", onClick: () => this.cardClick.emit() }, h("div", { key: 'a0e4f5fae6b7c14c750263f8de9bef9fbd8180a0', class: "image-wrap" }, this.image ? h("img", { src: this.image, alt: this.recipeTitle }) : h("div", { class: "placeholder" }), h("button", { key: '9266af379f6ebeb2624131e5c3f287d64cf4b3a5', class: { 'fav-btn': true, active: this.favorite }, onClick: this.onFavoriteClick, "aria-label": "Toggle favorite" }, this.favorite ? '★' : '☆')), h("div", { key: 'd0b5fa56b17c14763ecc6301864ef797565c6313', class: "body" }, h("h3", { key: '0c67db81d80a820cce2e6bfedd2df2611358d1e8' }, this.recipeTitle), this.category && h("span", { key: '30f89cf328a098be1c109d3e71b8f9f15827c6f1', class: "category" }, this.category), h("div", { key: '353b2663855e7ac53817d17acaf7b83908c17d85', class: "actions" }, h("slot", { key: '0a04fc5024751df45d744814f579100913dcd1fc', 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: '3088a84e81d49c06a12f93e491d4ae3e7022635f', class: "wrap" }, h("button", { key: '0e8b7455b1364eb76721d4f6c227a0803750c466', 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,4 +1,9 @@
|
|
|
1
1
|
import { h } from "@stencil/core";
|
|
2
|
+
const DEFAULT_CATEGORIES = [
|
|
3
|
+
'Beef', 'Breakfast', 'Chicken', 'Dessert', 'Goat', 'Lamb',
|
|
4
|
+
'Miscellaneous', 'Pasta', 'Pork', 'Seafood', 'Side', 'Starter',
|
|
5
|
+
'Vegan', 'Vegetarian', 'Other',
|
|
6
|
+
];
|
|
2
7
|
const DEFAULT_AREAS = [
|
|
3
8
|
'American', 'British', 'Chinese', 'Croatian', 'Dutch', 'Egyptian',
|
|
4
9
|
'Filipino', 'French', 'Greek', 'Indian', 'Irish', 'Italian', 'Jamaican',
|
|
@@ -8,13 +13,14 @@ const DEFAULT_AREAS = [
|
|
|
8
13
|
];
|
|
9
14
|
export class RecipeForm {
|
|
10
15
|
constructor() {
|
|
11
|
-
|
|
16
|
+
this.categories = DEFAULT_CATEGORIES;
|
|
17
|
+
this.extraCategories = [];
|
|
12
18
|
this.areas = DEFAULT_AREAS;
|
|
13
|
-
/** Additional cuisine options merged in before "Other" */
|
|
14
19
|
this.extraAreas = [];
|
|
15
20
|
this.title = '';
|
|
16
21
|
this.image = '';
|
|
17
22
|
this.category = '';
|
|
23
|
+
this.customCategory = '';
|
|
18
24
|
this.area = '';
|
|
19
25
|
this.customArea = '';
|
|
20
26
|
this.ingredients = [''];
|
|
@@ -24,13 +30,14 @@ export class RecipeForm {
|
|
|
24
30
|
e.preventDefault();
|
|
25
31
|
if (!this.validate())
|
|
26
32
|
return;
|
|
33
|
+
const resolvedCategory = this.category === 'Other' ? this.customCategory.trim() : this.category;
|
|
27
34
|
const resolvedArea = this.area === 'Other' ? this.customArea.trim() : this.area;
|
|
28
35
|
const data = {
|
|
29
36
|
id: this.initialData?.id,
|
|
30
37
|
title: this.title.trim(),
|
|
31
38
|
image: this.image.trim(),
|
|
32
|
-
category:
|
|
33
|
-
|
|
39
|
+
category: resolvedCategory,
|
|
40
|
+
cuisine: resolvedArea,
|
|
34
41
|
ingredients: this.ingredients.map((i) => i.trim()).filter(Boolean),
|
|
35
42
|
instructions: this.instructions.trim(),
|
|
36
43
|
};
|
|
@@ -41,6 +48,9 @@ export class RecipeForm {
|
|
|
41
48
|
};
|
|
42
49
|
this.removeIngredient = (index) => {
|
|
43
50
|
this.ingredients = this.ingredients.filter((_, i) => i !== index);
|
|
51
|
+
const next = this.ingredients.filter((_, i) => i !== index);
|
|
52
|
+
this.ingredients = next;
|
|
53
|
+
this.clearErrorIf('ingredients', next.some((i) => i.trim()));
|
|
44
54
|
};
|
|
45
55
|
}
|
|
46
56
|
componentWillLoad() {
|
|
@@ -49,16 +59,31 @@ export class RecipeForm {
|
|
|
49
59
|
onInitialDataChange() {
|
|
50
60
|
this.loadInitialData();
|
|
51
61
|
}
|
|
52
|
-
|
|
53
|
-
const withoutOther =
|
|
62
|
+
mergeList(base, extra) {
|
|
63
|
+
const withoutOther = base.filter((a) => a !== 'Other');
|
|
54
64
|
const merged = [...withoutOther];
|
|
55
|
-
for (const
|
|
56
|
-
if (
|
|
57
|
-
merged.push(
|
|
65
|
+
for (const e of extra) {
|
|
66
|
+
if (e && !merged.includes(e))
|
|
67
|
+
merged.push(e);
|
|
58
68
|
}
|
|
59
69
|
merged.push('Other');
|
|
60
70
|
return merged;
|
|
61
71
|
}
|
|
72
|
+
get fullCategoryList() {
|
|
73
|
+
return this.mergeList(this.categories, this.extraCategories);
|
|
74
|
+
}
|
|
75
|
+
get fullAreaList() {
|
|
76
|
+
return this.mergeList(this.areas, this.extraAreas);
|
|
77
|
+
}
|
|
78
|
+
/** Removes a field's error as soon as it becomes valid, without waiting
|
|
79
|
+
* for the next full submit — called from each field's input handler. */
|
|
80
|
+
clearErrorIf(key, isNowValid) {
|
|
81
|
+
if (isNowValid && this.errors[key]) {
|
|
82
|
+
const next = { ...this.errors };
|
|
83
|
+
delete next[key];
|
|
84
|
+
this.errors = next;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
62
87
|
loadInitialData() {
|
|
63
88
|
let data;
|
|
64
89
|
if (typeof this.initialData === 'string' && this.initialData) {
|
|
@@ -75,16 +100,24 @@ export class RecipeForm {
|
|
|
75
100
|
if (data) {
|
|
76
101
|
this.title = data.title ?? '';
|
|
77
102
|
this.image = data.image ?? '';
|
|
78
|
-
this.category = data.category ?? '';
|
|
79
103
|
this.ingredients = data.ingredients?.length ? [...data.ingredients] : [''];
|
|
80
104
|
this.instructions = data.instructions ?? '';
|
|
105
|
+
const knownCategories = this.fullCategoryList.filter((a) => a !== 'Other');
|
|
106
|
+
if (data.category && !knownCategories.includes(data.category)) {
|
|
107
|
+
this.category = 'Other';
|
|
108
|
+
this.customCategory = data.category;
|
|
109
|
+
}
|
|
110
|
+
else {
|
|
111
|
+
this.category = data.category ?? '';
|
|
112
|
+
this.customCategory = '';
|
|
113
|
+
}
|
|
81
114
|
const knownAreas = this.fullAreaList.filter((a) => a !== 'Other');
|
|
82
|
-
if (data.
|
|
115
|
+
if (data.cuisine && !knownAreas.includes(data.cuisine)) {
|
|
83
116
|
this.area = 'Other';
|
|
84
|
-
this.customArea = data.
|
|
117
|
+
this.customArea = data.cuisine;
|
|
85
118
|
}
|
|
86
119
|
else {
|
|
87
|
-
this.area = data.
|
|
120
|
+
this.area = data.cuisine ?? '';
|
|
88
121
|
this.customArea = '';
|
|
89
122
|
}
|
|
90
123
|
}
|
|
@@ -98,7 +131,16 @@ export class RecipeForm {
|
|
|
98
131
|
errors.ingredients = 'Add at least one ingredient.';
|
|
99
132
|
if (!this.instructions.trim())
|
|
100
133
|
errors.instructions = 'Instructions are required.';
|
|
101
|
-
if (
|
|
134
|
+
if (!this.category.trim()) {
|
|
135
|
+
errors.category = 'Category is required.';
|
|
136
|
+
}
|
|
137
|
+
else if (this.category === 'Other' && !this.customCategory.trim()) {
|
|
138
|
+
errors.customCategory = 'Enter a category name.';
|
|
139
|
+
}
|
|
140
|
+
if (!this.area.trim()) {
|
|
141
|
+
errors.area = 'Cuisine / Area is required.';
|
|
142
|
+
}
|
|
143
|
+
else if (this.area === 'Other' && !this.customArea.trim()) {
|
|
102
144
|
errors.customArea = 'Enter a cuisine name.';
|
|
103
145
|
}
|
|
104
146
|
this.errors = errors;
|
|
@@ -108,9 +150,33 @@ export class RecipeForm {
|
|
|
108
150
|
const next = [...this.ingredients];
|
|
109
151
|
next[index] = value;
|
|
110
152
|
this.ingredients = next;
|
|
153
|
+
this.clearErrorIf('ingredients', next.some((i) => i.trim()));
|
|
111
154
|
}
|
|
112
155
|
render() {
|
|
113
|
-
return (h("form", { key: '
|
|
156
|
+
return (h("form", { key: 'c29ab62af9db4a95e11b75f25a2dd4c23e699dad', onSubmit: this.onSubmit }, h("slot", { key: 'ece02ab46a1075eaef912e8953e70faa11bc8d8d', name: "header" }), h("label", { key: '9e17e9ba311350d9235f5ec01c32743dfbf55b0e' }, "Title", h("input", { key: '2b8d632bc22eb5cde52198287ea2b19d87567dba', type: "text", value: this.title, onInput: (e) => {
|
|
157
|
+
(this.title = e.target.value);
|
|
158
|
+
this.clearErrorIf('title', !!this.title.trim());
|
|
159
|
+
} }), this.errors.title && h("span", { key: '3a34d1f5e1f43ef190983dd0883f16eb6775f07c', class: "error" }, this.errors.title)), h("label", { key: '6acda6ccaff2e0315cc1964ae30c18647fe97bd1' }, "Image URL", h("input", { key: '6bdc06a2bebd6b5ae984865aefe292426fbe38cb', type: "text", value: this.image, onInput: (e) => (this.image = e.target.value) })), h("div", { key: 'f6ef49aaace211659296e93b4b5b47b29db73ac6', class: "row" }, h("label", { key: '9610c81a85ebddc2da4bdadcdee68ddea78e28d4' }, "Category", h("select", { key: '46542ff9e2c0f15d60be6744e063f3c860475772', onInput: (e) => {
|
|
160
|
+
(this.category = e.target.value);
|
|
161
|
+
this.clearErrorIf('category', !!this.category);
|
|
162
|
+
if (this.category !== 'Other')
|
|
163
|
+
this.clearErrorIf('customCategory', true);
|
|
164
|
+
} }, h("option", { key: '2741b90edd32cb12903e877cbfa2db3b5ff04071', value: "", selected: this.category === '' }, "Select a category\u2026"), this.fullCategoryList.map((c) => (h("option", { value: c, selected: c === this.category }, c)))), this.errors.category && h("span", { key: 'dc8e7ab5a6decdece1b4559af856997251335abf', class: "error" }, this.errors.category)), h("label", { key: '792cb1c4fd6052f9d88c52649c6eb4dc064f0071' }, "Cuisine / Area", h("select", { key: '06a917ac951a4c6d3e8390534690545a1967581a', onInput: (e) => {
|
|
165
|
+
(this.area = e.target.value);
|
|
166
|
+
this.clearErrorIf('area', !!this.area);
|
|
167
|
+
if (this.area !== 'Other')
|
|
168
|
+
this.clearErrorIf('customArea', true);
|
|
169
|
+
} }, h("option", { key: '264c39814065b3f07626975b96eca6b7e1c9bb83', value: "", selected: this.area === '' }, "Select a cuisine\u2026"), this.fullAreaList.map((a) => (h("option", { value: a, selected: a === this.area }, a)))), this.errors.area && h("span", { key: 'f1a562402420fb7a813dd4184b439c03c71d93d9', class: "error" }, this.errors.area))), (this.category === 'Other' || this.area === 'Other') && (h("div", { key: '3c20e6b5b678027d711c7976c60e3be92d02fae3', class: "row" }, this.category === 'Other' && (h("label", { key: '4cd14baeff186c7db8fabe57b21b241567528437', class: "custom-area-field" }, "Enter category name", h("input", { key: 'b1880e7aaadb3ade3c980c7f44d6b0a8d4fc3923', type: "text", placeholder: "e.g. Brunch", value: this.customCategory, onInput: (e) => {
|
|
170
|
+
(this.customCategory = e.target.value);
|
|
171
|
+
this.customCategory = e.target.value;
|
|
172
|
+
this.clearErrorIf('customCategory', !!this.customCategory.trim());
|
|
173
|
+
} }), this.errors.customCategory && h("span", { key: 'abd5094a23a182458ff2b76a58b55d65a9540c83', class: "error" }, this.errors.customCategory))), this.area === 'Other' && (h("label", { key: '696c0cc6af2cf16df8559da441e38635d8e0012c', class: "custom-area-field" }, "Enter cuisine name", h("input", { key: '663fee3941527c736d953cc993b886746dabab23', type: "text", placeholder: "e.g. Ethiopian", value: this.customArea, onInput: (e) => {
|
|
174
|
+
this.customArea = e.target.value;
|
|
175
|
+
this.clearErrorIf('customArea', !!this.customArea.trim());
|
|
176
|
+
} }), this.errors.customArea && h("span", { key: '6e1b7ebfac7166fb1120b0d8f914bb076f5e40ee', class: "error" }, this.errors.customArea))))), h("div", { key: 'fe85b73291a5ee955d069f20ddf33835d09b95bd', class: "field" }, h("span", { key: 'fd010d7b12306bd4306caf03ebd972feb1e0ebb9' }, "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: '8168f7e7f4bef8be1e74d1adf377b5471701c0ff', type: "button", class: "add-btn", onClick: this.addIngredient }, "+ Add ingredient"), this.errors.ingredients && h("span", { key: '3e35a8fe02833b27a333fa157548b88b3f5e3842', class: "error" }, this.errors.ingredients)), h("label", { key: 'c5c583cba5363ce35e6d41f95917bc49e3cca02d' }, "Instructions", h("textarea", { key: '514c219989a01cf1ad77739bd6c0df066362c689', rows: 5, onInput: (e) => {
|
|
177
|
+
this.instructions = e.target.value;
|
|
178
|
+
this.clearErrorIf('instructions', !!this.instructions.trim());
|
|
179
|
+
} }, this.instructions), this.errors.instructions && h("span", { key: '89881e3b0d4f864f7ccc835d86b094f367b54b2e', class: "error" }, this.errors.instructions)), h("div", { key: 'b9a812287af44062e1c68034881ba62321b0e660', class: "footer" }, h("slot", { key: 'a8307179d95cfd713d8f5fbe6e996fefb1d54907', name: "footer" }), h("button", { key: 'aa75decaf67c74a183af182864a37a6cd37b56ff', type: "button", class: "cancel-btn", onClick: () => this.cancel.emit() }, "Cancel"), h("button", { key: '13ea35b114f1a7721347f986c6c4e64968583025', type: "submit", class: "save-btn" }, "Save Recipe"))));
|
|
114
180
|
}
|
|
115
181
|
static get is() { return "recipe-form"; }
|
|
116
182
|
static get encapsulation() { return "shadow"; }
|
|
@@ -151,6 +217,42 @@ export class RecipeForm {
|
|
|
151
217
|
"reflect": false,
|
|
152
218
|
"attribute": "initial-data"
|
|
153
219
|
},
|
|
220
|
+
"categories": {
|
|
221
|
+
"type": "unknown",
|
|
222
|
+
"mutable": false,
|
|
223
|
+
"complexType": {
|
|
224
|
+
"original": "string[]",
|
|
225
|
+
"resolved": "string[]",
|
|
226
|
+
"references": {}
|
|
227
|
+
},
|
|
228
|
+
"required": false,
|
|
229
|
+
"optional": false,
|
|
230
|
+
"docs": {
|
|
231
|
+
"tags": [],
|
|
232
|
+
"text": ""
|
|
233
|
+
},
|
|
234
|
+
"getter": false,
|
|
235
|
+
"setter": false,
|
|
236
|
+
"defaultValue": "[\n 'Beef', 'Breakfast', 'Chicken', 'Dessert', 'Goat', 'Lamb',\n 'Miscellaneous', 'Pasta', 'Pork', 'Seafood', 'Side', 'Starter',\n 'Vegan', 'Vegetarian', 'Other',\n]"
|
|
237
|
+
},
|
|
238
|
+
"extraCategories": {
|
|
239
|
+
"type": "unknown",
|
|
240
|
+
"mutable": false,
|
|
241
|
+
"complexType": {
|
|
242
|
+
"original": "string[]",
|
|
243
|
+
"resolved": "string[]",
|
|
244
|
+
"references": {}
|
|
245
|
+
},
|
|
246
|
+
"required": false,
|
|
247
|
+
"optional": false,
|
|
248
|
+
"docs": {
|
|
249
|
+
"tags": [],
|
|
250
|
+
"text": ""
|
|
251
|
+
},
|
|
252
|
+
"getter": false,
|
|
253
|
+
"setter": false,
|
|
254
|
+
"defaultValue": "[]"
|
|
255
|
+
},
|
|
154
256
|
"areas": {
|
|
155
257
|
"type": "unknown",
|
|
156
258
|
"mutable": false,
|
|
@@ -163,7 +265,7 @@ export class RecipeForm {
|
|
|
163
265
|
"optional": false,
|
|
164
266
|
"docs": {
|
|
165
267
|
"tags": [],
|
|
166
|
-
"text": "
|
|
268
|
+
"text": ""
|
|
167
269
|
},
|
|
168
270
|
"getter": false,
|
|
169
271
|
"setter": false,
|
|
@@ -181,7 +283,7 @@ export class RecipeForm {
|
|
|
181
283
|
"optional": false,
|
|
182
284
|
"docs": {
|
|
183
285
|
"tags": [],
|
|
184
|
-
"text": "
|
|
286
|
+
"text": ""
|
|
185
287
|
},
|
|
186
288
|
"getter": false,
|
|
187
289
|
"setter": false,
|
|
@@ -194,6 +296,7 @@ export class RecipeForm {
|
|
|
194
296
|
"title": {},
|
|
195
297
|
"image": {},
|
|
196
298
|
"category": {},
|
|
299
|
+
"customCategory": {},
|
|
197
300
|
"area": {},
|
|
198
301
|
"customArea": {},
|
|
199
302
|
"ingredients": {},
|
|
@@ -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: '09bd2482d310e73993faea601d5ab86f20fc6fb7', 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: '00fa553cd92086a5cac70ca6b13792dfa41fc1dd', class: "wrap" }, h("input", { key: 'a116c51839c228d4daff54347e6b2d56c9dc2579', type: "search", placeholder: this.placeholder, value: this.internalValue, onInput: this.onInput, onKeyDown: this.onKeyDown }), h("button", { key: 'e16a909061abd80889ad7b7646219a7428e4db4d', 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-BUODh8vy.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-DnzGtyGi.js";export{R as RecipeSearchBar}from"./p-8_BMsNX-.js";export{R as RecipeFilterBar}from"./p-Ux-pnuEm.js";export{R as RecipeRating}from"./p-CeTpiLnn.js";export{R as RecipeForm}from"./p-DzfkrPp9.js";export{M as MealPlanDay}from"./p-S4266va_.js";export{A as AppModal}from"./p-Dp1sKtrN.js";export{A as AppToast}from"./p-BUODh8vy.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e,p as t,H as s,c as a,h as i}from"./p-BJU3HdRm.js";const r=t(class extends s{constructor(e){super(),!1!==e&&this.__registerHost(),this.__attachShadow(),this.search=a(this,"search"),this.placeholder="Search recipes...",this.value="",this.debounceMs=350,this.internalValue="",this.onInput=e=>{this.internalValue=e.target.value,clearTimeout(this.timer),this.timer=setTimeout((()=>{this.search.emit({value:this.internalValue})}),this.debounceMs)},this.onKeyDown=e=>{"Enter"===e.key&&(clearTimeout(this.timer),this.search.emit({value:this.internalValue}))}}componentWillLoad(){this.internalValue=this.value}onValuePropChange(e){this.internalValue=e}render(){return i("div",{key:"
|
|
1
|
+
import{t as e,p as t,H as s,c as a,h as i}from"./p-BJU3HdRm.js";const r=t(class extends s{constructor(e){super(),!1!==e&&this.__registerHost(),this.__attachShadow(),this.search=a(this,"search"),this.placeholder="Search recipes...",this.value="",this.debounceMs=350,this.internalValue="",this.onInput=e=>{this.internalValue=e.target.value,clearTimeout(this.timer),this.timer=setTimeout((()=>{this.search.emit({value:this.internalValue})}),this.debounceMs)},this.onKeyDown=e=>{"Enter"===e.key&&(clearTimeout(this.timer),this.search.emit({value:this.internalValue}))}}componentWillLoad(){this.internalValue=this.value}onValuePropChange(e){this.internalValue=e}render(){return i("div",{key:"00fa553cd92086a5cac70ca6b13792dfa41fc1dd",class:"wrap"},i("input",{key:"a116c51839c228d4daff54347e6b2d56c9dc2579",type:"search",placeholder:this.placeholder,value:this.internalValue,onInput:this.onInput,onKeyDown:this.onKeyDown}),i("button",{key:"e16a909061abd80889ad7b7646219a7428e4db4d",onClick:()=>this.search.emit({value:this.internalValue}),"aria-label":"Search"},"🔍"))}static get watchers(){return{value:[{onValuePropChange:0}]}}static get style(){return":host{display:block;font-family:system-ui, sans-serif}.wrap{display:flex;gap:6px}input{flex:1;padding:10px 14px;border-radius:8px;border:1px solid #ddd;font-size:14px;outline:none}input:focus{border-color:#ff6b35}button{border:none;background:#ff6b35;color:#fff;border-radius:8px;padding:0 16px;cursor:pointer;font-size:15px}"}},[1,"recipe-search-bar",{placeholder:[1],value:[1],debounceMs:[2,"debounce-ms"],internalValue:[32]},void 0,{value:[{onValuePropChange:0}]}]);function o(){"undefined"!=typeof customElements&&["recipe-search-bar"].forEach((t=>{"recipe-search-bar"===t&&(customElements.get(e(t))||customElements.define(e(t),r))}))}o();export{r as R,o as d}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as s,p as t,H as
|
|
1
|
+
import{t as s,p as t,H as e,c as a,h as o}from"./p-BJU3HdRm.js";const i=t(class extends e{constructor(s){super(),!1!==s&&this.__registerHost(),this.__attachShadow(),this.dismiss=a(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:"8b34f0098a8d17af8b9384ddf8838c8ad6eaf7f2",class:`toast ${this.type}`},o("span",{key:"652ce04dad64022f77dbd0236ebfc1a0075ba121"},this.message),o("button",{key:"760c2e84e1bf01c3b7a8c43addf983711453be3b",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}
|