@gurpinderjitsingh/recipe-ui 0.2.1 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (38) hide show
  1. package/dist/cjs/app-modal_7.cjs.entry.js +43 -8
  2. package/dist/cjs/app-toast.cjs.entry.js +1 -1
  3. package/dist/cjs/loader.cjs.js +1 -1
  4. package/dist/cjs/recipe-ui.cjs.js +1 -1
  5. package/dist/collection/components/app-toast/app-toast.js +1 -1
  6. package/dist/collection/components/meal-plan-day/meal-plan-day.js +1 -1
  7. package/dist/collection/components/recipe-card/recipe-card.js +1 -1
  8. package/dist/collection/components/recipe-filter-bar/recipe-filter-bar.js +1 -1
  9. package/dist/collection/components/recipe-form/recipe-form.css +139 -17
  10. package/dist/collection/components/recipe-form/recipe-form.js +79 -11
  11. package/dist/collection/components/recipe-rating/recipe-rating.js +1 -1
  12. package/dist/collection/components/recipe-search-bar/recipe-search-bar.js +1 -1
  13. package/dist/components/app-toast.js +1 -1
  14. package/dist/components/index.js +1 -1
  15. package/dist/components/{p-gWE9Vqi0.js → p-B92NkO3p.js} +1 -1
  16. package/dist/components/{p-Q8V4JgYC.js → p-BzvqJQ_R.js} +1 -1
  17. package/dist/components/{p-snMSuFkY.js → p-Cn_qfIvv.js} +1 -1
  18. package/dist/components/{p-fNGqqs-I.js → p-K-btCLSj.js} +1 -1
  19. package/dist/components/{p-DrDPFXTB.js → p-mY_lBX8M.js} +1 -1
  20. package/dist/components/p-u-o4onHp.js +1 -0
  21. package/dist/components/recipe-card.js +1 -1
  22. package/dist/components/recipe-filter-bar.js +1 -1
  23. package/dist/components/recipe-form.js +1 -1
  24. package/dist/components/recipe-rating.js +1 -1
  25. package/dist/components/recipe-search-bar.js +1 -1
  26. package/dist/esm/app-modal_7.entry.js +43 -8
  27. package/dist/esm/app-toast.entry.js +1 -1
  28. package/dist/esm/loader.js +1 -1
  29. package/dist/esm/recipe-ui.js +1 -1
  30. package/dist/recipe-ui/p-1f2f28cf.entry.js +1 -0
  31. package/dist/recipe-ui/p-e66a8ded.entry.js +1 -0
  32. package/dist/recipe-ui/recipe-ui.esm.js +1 -1
  33. package/dist/types/components/recipe-form/recipe-form.d.ts +8 -6
  34. package/dist/types/components.d.ts +16 -22
  35. package/package.json +1 -1
  36. package/dist/components/p-CN2vLHNY.js +0 -1
  37. package/dist/recipe-ui/p-268be6b1.entry.js +0 -1
  38. package/dist/recipe-ui/p-97e73b62.entry.js +0 -1
@@ -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:"90b26633c07d813221b1cc44705c5fe510de994f",class:"wrap"},r("button",{key:"a41696529d8611f283460da1efe9205bd0b36260",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
+ import{t as e,p as s,H as t,c as i,h as r}from"./p-BJU3HdRm.js";const c=s(class extends t{constructor(e){super(),!1!==e&&this.__registerHost(),this.__attachShadow(),this.filterChange=i(this,"filterChange"),this.categories=[],this.active=""}select(e){this.filterChange.emit({value:e})}render(){const e=Array.isArray(this.categories)?this.categories:[];return r("div",{key:"336e3431325ab3338cda5be917414c6be4be1cf9",class:"wrap"},r("button",{key:"f1a5c228cf9ef1dd2017b26be55afdd07e27c837",class:{chip:!0,active:""===this.active},onClick:()=>this.select("")},"All"),e.map((e=>r("button",{class:{chip:!0,active:this.active===e},onClick:()=>this.select(e)},e))))}static get style(){return":host{display:block;font-family:system-ui, sans-serif}.wrap{display:flex;flex-wrap:wrap;gap:8px}.chip{border:1px solid #ddd;background:#fff;border-radius:999px;padding:6px 14px;font-size:13px;cursor:pointer;color:#444}.chip.active{background:#ff6b35;border-color:#ff6b35;color:#fff}"}},[1,"recipe-filter-bar",{categories:[16],active:[1]}]);function a(){"undefined"!=typeof customElements&&["recipe-filter-bar"].forEach((s=>{"recipe-filter-bar"===s&&(customElements.get(e(s))||customElements.define(e(s),c))}))}a();export{c as R,a as d}
@@ -1 +1 @@
1
- import{t as s,p as t,H as a,c as e,h as o}from"./p-BJU3HdRm.js";const i=t(class extends a{constructor(s){super(),!1!==s&&this.__registerHost(),this.__attachShadow(),this.dismiss=e(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:"41fc3560c508b3b36863417af6d8f0aa2ad26004",class:`toast ${this.type}`},o("span",{key:"b29ea7dbe53aa72524039f1ce0fea5c50406d1f0"},this.message),o("button",{key:"3b42fc8485a5d438bb29b5eab2e3ba5ab831731b",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
+ import{t as s,p as t,H as a,c as o,h as e}from"./p-BJU3HdRm.js";const i=t(class extends a{constructor(s){super(),!1!==s&&this.__registerHost(),this.__attachShadow(),this.dismiss=o(this,"dismiss"),this.message="",this.type="info",this.duration=3e3}componentDidLoad(){this.duration>0&&setTimeout((()=>this.dismiss.emit()),this.duration)}render(){return e("div",{key:"40cf0d0171712b45dd8786bd69aa2f94a1fc7335",class:`toast ${this.type}`},e("span",{key:"5256c39505158066715c94420ff65a479a7ab382"},this.message),e("button",{key:"523f0f7617a902910d13179147ca75fa57499433",onClick:()=>this.dismiss.emit(),"aria-label":"Dismiss"},"✕"))}static get style(){return":host{font-family:system-ui, sans-serif;display:block}.toast{display:flex;align-items:center;gap:10px;padding:10px 16px;border-radius:8px;color:#fff;font-size:14px;box-shadow:0 4px 12px rgba(0,0,0,0.15)}.toast.success{background:#2ecc71}.toast.error{background:#e74c3c}.toast.info{background:#3498db}button{border:none;background:none;color:inherit;cursor:pointer;margin-left:auto}"}},[1,"app-toast",{message:[1],type:[1],duration:[2]}]);function n(){"undefined"!=typeof customElements&&["app-toast"].forEach((t=>{"app-toast"===t&&(customElements.get(s(t))||customElements.define(s(t),i))}))}n();export{i as A,n as d}
@@ -1 +1 @@
1
- import{t as e,p as t,H as a,c as i,h as s}from"./p-BJU3HdRm.js";const c=t(class extends a{constructor(e){super(),!1!==e&&this.__registerHost(),this.__attachShadow(),this.favoriteToggle=i(this,"favoriteToggle"),this.cardClick=i(this,"cardClick"),this.category="",this.favorite=!1,this.onFavoriteClick=e=>{e.stopPropagation(),this.favoriteToggle.emit({favorite:!this.favorite})}}render(){return s("div",{key:"c9dc0d8c98899cf188fc46c72b5e809831332f24",class:"card",onClick:()=>this.cardClick.emit()},s("div",{key:"12e0512dc7ee78f46843f81483c5f7bf1fbc3616",class:"image-wrap"},this.image?s("img",{src:this.image,alt:this.recipeTitle}):s("div",{class:"placeholder"}),s("button",{key:"95ab4db232ee878d61e272ce7a4814a48790c01d",class:{"fav-btn":!0,active:this.favorite},onClick:this.onFavoriteClick,"aria-label":"Toggle favorite"},this.favorite?"★":"☆")),s("div",{key:"a2906c670d693a473b87042ff6b0ada03627205b",class:"body"},s("h3",{key:"2b0f4afecfdfd9cc996dcec29bd86957687667e3"},this.recipeTitle),this.category&&s("span",{key:"1b9c31d2723d2c87d51021569271366bac550a2f",class:"category"},this.category),s("div",{key:"d79b1cc33dcced145c3551874f69b581b4734297",class:"actions"},s("slot",{key:"9a43cf770ea8fa189564fbe14f4f135a4d8e9551",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 r(){"undefined"!=typeof customElements&&["recipe-card"].forEach((t=>{"recipe-card"===t&&(customElements.get(e(t))||customElements.define(e(t),c))}))}r();export{c as R,r as d}
1
+ import{t as e,p as t,H as a,c as i,h as s}from"./p-BJU3HdRm.js";const r=t(class extends a{constructor(e){super(),!1!==e&&this.__registerHost(),this.__attachShadow(),this.favoriteToggle=i(this,"favoriteToggle"),this.cardClick=i(this,"cardClick"),this.category="",this.favorite=!1,this.onFavoriteClick=e=>{e.stopPropagation(),this.favoriteToggle.emit({favorite:!this.favorite})}}render(){return s("div",{key:"72e604b38c4156bfe101f0609fac315cd317c981",class:"card",onClick:()=>this.cardClick.emit()},s("div",{key:"bb707d57e573970201644e029eb6257e100e2276",class:"image-wrap"},this.image?s("img",{src:this.image,alt:this.recipeTitle}):s("div",{class:"placeholder"}),s("button",{key:"bb052a897f227e8b8ca938704a083d8502036037",class:{"fav-btn":!0,active:this.favorite},onClick:this.onFavoriteClick,"aria-label":"Toggle favorite"},this.favorite?"★":"☆")),s("div",{key:"e4c139b9bdbdac25e92def0705d8506d89a0ce65",class:"body"},s("h3",{key:"aea91bd0827cdbe2608d91b428489a11eb7de0fa"},this.recipeTitle),this.category&&s("span",{key:"96219817064ee274999487452db6c70dee93d82f",class:"category"},this.category),s("div",{key:"c2593b0d879744a24c4be179af1d9359e3e904fa",class:"actions"},s("slot",{key:"19e921048e6d469a33531c2bb949067a7925c7ac",name:"actions"}))))}static get style(){return":host{display:block;font-family:system-ui, sans-serif}.card{border:1px solid #e5e5e5;border-radius:12px;overflow:hidden;cursor:pointer;background:#fff;transition:box-shadow 0.15s ease, transform 0.15s ease}.card:hover{box-shadow:0 4px 16px rgba(0, 0, 0, 0.08);transform:translateY(-2px)}.image-wrap{position:relative;aspect-ratio:4 / 3;background:#f2f2f2}.image-wrap img{width:100%;height:100%;object-fit:cover;display:block}.placeholder{width:100%;height:100%;background:linear-gradient(135deg, #eee, #ddd)}.fav-btn{position:absolute;top:8px;right:8px;border:none;background:rgba(255, 255, 255, 0.9);border-radius:50%;width:32px;height:32px;font-size:16px;cursor:pointer;color:#f5a623}.fav-btn.active{color:#ff6b35}.body{padding:12px 14px}h3{margin:0 0 4px;font-size:15px;line-height:1.3}.category{font-size:12px;color:#777;text-transform:uppercase;letter-spacing:0.03em}.actions{margin-top:8px}"}},[257,"recipe-card",{recipeTitle:[1,"recipe-title"],image:[1],category:[1],favorite:[4]}]);function o(){"undefined"!=typeof customElements&&["recipe-card"].forEach((t=>{"recipe-card"===t&&(customElements.get(e(t))||customElements.define(e(t),r))}))}o();export{r as R,o as d}
@@ -1 +1 @@
1
- import{t as e,p as t,H as s,c as 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:"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}]}}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
+ import{t as e,p as t,H as s,c as a,h as i}from"./p-BJU3HdRm.js";const r=t(class extends s{constructor(e){super(),!1!==e&&this.__registerHost(),this.__attachShadow(),this.search=a(this,"search"),this.placeholder="Search recipes...",this.value="",this.debounceMs=350,this.internalValue="",this.onInput=e=>{this.internalValue=e.target.value,clearTimeout(this.timer),this.timer=setTimeout((()=>{this.search.emit({value:this.internalValue})}),this.debounceMs)},this.onKeyDown=e=>{"Enter"===e.key&&(clearTimeout(this.timer),this.search.emit({value:this.internalValue}))}}componentWillLoad(){this.internalValue=this.value}onValuePropChange(e){this.internalValue=e}render(){return i("div",{key:"7fa4a3ce06ef9b7e68b968a0bf29cce896cc7db0",class:"wrap"},i("input",{key:"ae2e528fafd1f342de8a88c14f0651857bc0486d",type:"search",placeholder:this.placeholder,value:this.internalValue,onInput:this.onInput,onKeyDown:this.onKeyDown}),i("button",{key:"c9a369dca794014f17cd64cfaa4b7b9f0e06d171",onClick:()=>this.search.emit({value:this.internalValue}),"aria-label":"Search"},"🔍"))}static get watchers(){return{value:[{onValuePropChange:0}]}}static get style(){return":host{display:block;font-family:system-ui, sans-serif}.wrap{display:flex;gap:6px}input{flex:1;padding:10px 14px;border-radius:8px;border:1px solid #ddd;font-size:14px;outline:none}input:focus{border-color:#ff6b35}button{border:none;background:#ff6b35;color:#fff;border-radius:8px;padding:0 16px;cursor:pointer;font-size:15px}"}},[1,"recipe-search-bar",{placeholder:[1],value:[1],debounceMs:[2,"debounce-ms"],internalValue:[32]},void 0,{value:[{onValuePropChange:0}]}]);function o(){"undefined"!=typeof customElements&&["recipe-search-bar"].forEach((t=>{"recipe-search-bar"===t&&(customElements.get(e(t))||customElements.define(e(t),r))}))}o();export{r as R,o as d}
@@ -1 +1 @@
1
- import{t as s,p as t,H as e,c as i,h as a}from"./p-BJU3HdRm.js";const r=t(class extends e{constructor(s){super(),!1!==s&&this.__registerHost(),this.__attachShadow(),this.ratingChange=i(this,"ratingChange"),this.value=0,this.readonly=!1,this.max=5}render(){const s=Array.from({length:this.max},((s,t)=>t+1));return a("div",{key:"2d5251ae7d3a24d613b759e89ba78de1568426d8",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
+ import{t as s,p as t,H as e,c as i,h as a}from"./p-BJU3HdRm.js";const r=t(class extends e{constructor(s){super(),!1!==s&&this.__registerHost(),this.__attachShadow(),this.ratingChange=i(this,"ratingChange"),this.value=0,this.readonly=!1,this.max=5}render(){const s=Array.from({length:this.max},((s,t)=>t+1));return a("div",{key:"9e67a7c471e6b20bbc2bc0164a5346c8cd5f10dc",class:"wrap",role:this.readonly?void 0:"radiogroup"},s.map((s=>a("span",{class:{star:!0,filled:s<=this.value,clickable:!this.readonly},onClick:()=>!this.readonly&&this.ratingChange.emit({value:s})},"★"))))}static get style(){return":host{display:inline-block;font-family:system-ui, sans-serif}.wrap{display:flex;gap:2px}.star{font-size:18px;color:#ddd}.star.filled{color:#f5a623}.star.clickable{cursor:pointer}"}},[1,"recipe-rating",{value:[2],readonly:[4],max:[2]}]);function c(){"undefined"!=typeof customElements&&["recipe-rating"].forEach((t=>{"recipe-rating"===t&&(customElements.get(s(t))||customElements.define(s(t),r))}))}c();export{r as R,c as d}
@@ -0,0 +1 @@
1
+ import{t as e,p as t,H as i,c as a,h as s}from"./p-BJU3HdRm.js";const n=["American","British","Chinese","Croatian","Dutch","Egyptian","Filipino","French","Greek","Indian","Irish","Italian","Jamaican","Japanese","Kenyan","Malaysian","Mexican","Moroccan","Polish","Portuguese","Russian","Spanish","Thai","Tunisian","Turkish","Vietnamese","Other"],o=t(class extends i{constructor(e){super(),!1!==e&&this.__registerHost(),this.__attachShadow(),this.save=a(this,"save"),this.cancel=a(this,"cancel"),this.areas=n,this.extraAreas=[],this.title="",this.image="",this.category="",this.area="",this.customArea="",this.ingredients=[""],this.instructions="",this.errors={},this.onSubmit=e=>{if(e.preventDefault(),!this.validate())return;const t="Other"===this.area?this.customArea.trim():this.area,i={id:this.initialData?.id,title:this.title.trim(),image:this.image.trim(),category:this.category.trim(),area:t,ingredients:this.ingredients.map((e=>e.trim())).filter(Boolean),instructions:this.instructions.trim()};this.save.emit(i)},this.addIngredient=()=>{this.ingredients=[...this.ingredients,""]},this.removeIngredient=e=>{this.ingredients=this.ingredients.filter(((t,i)=>i!==e))}}componentWillLoad(){this.loadInitialData()}onInitialDataChange(){this.loadInitialData()}get fullAreaList(){const e=[...this.areas.filter((e=>"Other"!==e))];for(const t of this.extraAreas)t&&!e.includes(t)&&e.push(t);return e.push("Other"),e}loadInitialData(){let e;if("string"==typeof this.initialData&&this.initialData)try{e=JSON.parse(this.initialData)}catch{e=void 0}else this.initialData&&"object"==typeof this.initialData&&(e=this.initialData);if(e){this.title=e.title??"",this.image=e.image??"",this.category=e.category??"",this.ingredients=e.ingredients?.length?[...e.ingredients]:[""],this.instructions=e.instructions??"";const t=this.fullAreaList.filter((e=>"Other"!==e));e.area&&!t.includes(e.area)?(this.area="Other",this.customArea=e.area):(this.area=e.area??"",this.customArea="")}}validate(){const e={};return this.title.trim()||(e.title="Title is required."),0===this.ingredients.map((e=>e.trim())).filter(Boolean).length&&(e.ingredients="Add at least one ingredient."),this.instructions.trim()||(e.instructions="Instructions are required."),"Other"!==this.area||this.customArea.trim()||(e.customArea="Enter a cuisine name."),this.errors=e,0===Object.keys(e).length}updateIngredient(e,t){const i=[...this.ingredients];i[e]=t,this.ingredients=i}render(){return s("form",{key:"b9e50e96b20b8f3bb28ecb516b102c87088daddd",onSubmit:this.onSubmit},s("slot",{key:"648424eb3444acdacb69e541799571ffa6572004",name:"header"}),s("label",{key:"77ec1e8acd2ba845262909f672fadf06907702f2"},"Title",s("input",{key:"2f5dd98ab985831eb07ac43afed983908f2646d1",type:"text",value:this.title,onInput:e=>this.title=e.target.value}),this.errors.title&&s("span",{key:"244560b4dc4cb47cbb514d0f8fe41be267299885",class:"error"},this.errors.title)),s("label",{key:"8bb49420325a7629186a5801162b9a2e4321e4f7"},"Image URL",s("input",{key:"fe121c2389308b5bc0e6f7b977f15fec91f9baae",type:"text",value:this.image,onInput:e=>this.image=e.target.value})),s("div",{key:"2ede3939f5230f805841945a29fc37fc4d2f3627",class:"row"},s("label",{key:"b736ee46a12a1070cb52c76fc41d31e0f8d1169b"},"Category",s("input",{key:"6952f8378b13313c1c63d2cb1b1cd9c2593d1806",type:"text",value:this.category,onInput:e=>this.category=e.target.value})),s("label",{key:"a6e477f0bfdfbab6a75831a62334b665272a98db"},"Cuisine / Area",s("select",{key:"1434d68a1782d19f92cd2d5ef638f440a8adc7dd",onInput:e=>this.area=e.target.value},s("option",{key:"a40b1cacf4deb98590689325f23e572522069268",value:"",selected:""===this.area},"Select a cuisine…"),this.fullAreaList.map((e=>s("option",{value:e,selected:e===this.area},e)))))),"Other"===this.area&&s("label",{key:"77ab0849f544aacc7c2a207dc222c916dfb7a41b",class:"custom-area-field"},"Enter cuisine name",s("input",{key:"fd7c97a89c0e2b8f23cc28fbc502563eb759fdb4",type:"text",placeholder:"e.g. Ethiopian",value:this.customArea,onInput:e=>this.customArea=e.target.value}),this.errors.customArea&&s("span",{key:"2b2425b63b0d5ee311fe16040d012a43919c8ca6",class:"error"},this.errors.customArea)),s("div",{key:"fafa1824f121c9c2c96069772d2011a13ce0683f",class:"field"},s("span",{key:"bea9e5877093e412b1fffb12f0aad4c79604cc16"},"Ingredients"),this.ingredients.map(((e,t)=>s("div",{class:"ingredient-row"},s("input",{type:"text",value:e,onInput:e=>this.updateIngredient(t,e.target.value)}),s("button",{type:"button",onClick:()=>this.removeIngredient(t),"aria-label":"Remove"},"✕")))),s("button",{key:"fc7a817c01706f4f99594ff09a72fa8b046f4820",type:"button",class:"add-btn",onClick:this.addIngredient},"+ Add ingredient"),this.errors.ingredients&&s("span",{key:"d4b4bee30e1369f951f0aabe7f54b0b1ae393a83",class:"error"},this.errors.ingredients)),s("label",{key:"5028ae3ead65e280a2196f93d5f31580a5f8c95a"},"Instructions",s("textarea",{key:"08461bc98ab47d1f2240dfa23e1ec1264de12002",rows:5,onInput:e=>this.instructions=e.target.value},this.instructions),this.errors.instructions&&s("span",{key:"932de400651f180d7e5b14e4ff118ccdcd24d2b3",class:"error"},this.errors.instructions)),s("div",{key:"7da02b77a1390447a738882d0104292b28f675b0",class:"footer"},s("slot",{key:"74ed118f385e1e6e1318dd405aa0008e195ef9c0",name:"footer"}),s("button",{key:"e2548efd3826d3a984c11cd6d7bd486e226c8ca9",type:"button",class:"cancel-btn",onClick:()=>this.cancel.emit()},"Cancel"),s("button",{key:"8011e51d4579a0e6ddd88cd8c83708524551d801",type:"submit",class:"save-btn"},"Save Recipe")))}static get watchers(){return{initialData:[{onInitialDataChange:0}]}}static get style(){return":host{display:block;font-family:system-ui, sans-serif}form{display:flex;flex-direction:column;gap:14px}label{display:flex;flex-direction:column;gap:4px;font-size:13px;color:#333;font-weight:600}input,textarea,select{font-weight:400;padding:8px 10px;border:1px solid #ddd;border-radius:6px;font-size:14px;font-family:inherit;background:#fff;transition:border-color 0.15s ease, box-shadow 0.15s ease}input:focus,textarea:focus,select:focus{outline:none;border-color:#ff6b35;box-shadow:0 0 0 3px rgba(255, 107, 53, 0.14)}select{appearance:none;-webkit-appearance:none;-moz-appearance:none;padding-right:34px;cursor:pointer;color:#1f2937;background-image:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E\");background-repeat:no-repeat;background-position:right 10px center;background-size:14px}select:hover{border-color:#bbb}select:invalid,select option[value=\"\"]{color:#9ca3af}.row{display:grid;grid-template-columns:1fr 1fr;gap:14px}@media (max-width: 480px){.row{grid-template-columns:1fr}}.field{display:flex;flex-direction:column;gap:6px;font-size:13px;font-weight:600}.ingredient-row{display:flex;gap:6px}.ingredient-row input{flex:1}.ingredient-row button{border:none;background:#f4f4f4;border-radius:6px;cursor:pointer;width:30px}.add-btn{align-self:flex-start;border:1px dashed #bbb;background:none;border-radius:6px;padding:6px 10px;cursor:pointer;font-size:13px;color:#555}.error{color:#e74c3c;font-size:12px;font-weight:400}.footer{display:flex;justify-content:flex-end;gap:10px;margin-top:6px}.cancel-btn{border:1px solid #ddd;background:#fff;border-radius:8px;padding:8px 16px;cursor:pointer}.save-btn{border:none;background:#ff6b35;color:#fff;border-radius:8px;padding:8px 18px;cursor:pointer;font-weight:600}"}},[257,"recipe-form",{initialData:[1,"initial-data"],areas:[16],extraAreas:[16],title:[32],image:[32],category:[32],area:[32],customArea:[32],ingredients:[32],instructions:[32],errors:[32]},void 0,{initialData:[{onInitialDataChange:0}]}]);function r(){"undefined"!=typeof customElements&&["recipe-form"].forEach((t=>{"recipe-form"===t&&(customElements.get(e(t))||customElements.define(e(t),o))}))}r();export{o as R,r as d}
@@ -1 +1 @@
1
- import{R as s,d as o}from"./p-snMSuFkY.js";const p=s,r=o;export{p as RecipeCard,r as defineCustomElement}
1
+ import{R as o,d as s}from"./p-Cn_qfIvv.js";const p=o,r=s;export{p as RecipeCard,r as defineCustomElement}
@@ -1 +1 @@
1
- import{R as o,d as s}from"./p-gWE9Vqi0.js";const p=o,r=s;export{p as RecipeFilterBar,r as defineCustomElement}
1
+ import{R as o,d as p}from"./p-B92NkO3p.js";const s=o,r=p;export{s as RecipeFilterBar,r as defineCustomElement}
@@ -1 +1 @@
1
- import{R as o,d as s}from"./p-CN2vLHNY.js";const p=o,r=s;export{p as RecipeForm,r as defineCustomElement}
1
+ import{R as o,d as p}from"./p-u-o4onHp.js";const s=o,r=p;export{s as RecipeForm,r as defineCustomElement}
@@ -1 +1 @@
1
- import{R as o,d as r}from"./p-DrDPFXTB.js";const s=o,p=r;export{s as RecipeRating,p as defineCustomElement}
1
+ import{R as o,d as s}from"./p-mY_lBX8M.js";const m=o,p=s;export{m as RecipeRating,p as defineCustomElement}
@@ -1 +1 @@
1
- import{R as s,d as o}from"./p-fNGqqs-I.js";const p=s,r=o;export{p as RecipeSearchBar,r as defineCustomElement}
1
+ import{R as o,d as s}from"./p-K-btCLSj.js";const t=o,p=s;export{t as RecipeSearchBar,p as defineCustomElement}
@@ -17,7 +17,7 @@ const RecipeCard = class {
17
17
  };
18
18
  }
19
19
  render() {
20
- return (h("div", { key: 'c9dc0d8c98899cf188fc46c72b5e809831332f24', class: "card", onClick: () => this.cardClick.emit() }, h("div", { key: '12e0512dc7ee78f46843f81483c5f7bf1fbc3616', class: "image-wrap" }, this.image ? h("img", { src: this.image, alt: this.recipeTitle }) : h("div", { class: "placeholder" }), h("button", { key: '95ab4db232ee878d61e272ce7a4814a48790c01d', class: { 'fav-btn': true, active: this.favorite }, onClick: this.onFavoriteClick, "aria-label": "Toggle favorite" }, this.favorite ? '★' : '☆')), h("div", { key: 'a2906c670d693a473b87042ff6b0ada03627205b', class: "body" }, h("h3", { key: '2b0f4afecfdfd9cc996dcec29bd86957687667e3' }, this.recipeTitle), this.category && h("span", { key: '1b9c31d2723d2c87d51021569271366bac550a2f', class: "category" }, this.category), h("div", { key: 'd79b1cc33dcced145c3551874f69b581b4734297', class: "actions" }, h("slot", { key: '9a43cf770ea8fa189564fbe14f4f135a4d8e9551', name: "actions" })))));
20
+ return (h("div", { key: '72e604b38c4156bfe101f0609fac315cd317c981', class: "card", onClick: () => this.cardClick.emit() }, h("div", { key: 'bb707d57e573970201644e029eb6257e100e2276', class: "image-wrap" }, this.image ? h("img", { src: this.image, alt: this.recipeTitle }) : h("div", { class: "placeholder" }), h("button", { key: 'bb052a897f227e8b8ca938704a083d8502036037', class: { 'fav-btn': true, active: this.favorite }, onClick: this.onFavoriteClick, "aria-label": "Toggle favorite" }, this.favorite ? '★' : '☆')), h("div", { key: 'e4c139b9bdbdac25e92def0705d8506d89a0ce65', class: "body" }, h("h3", { key: 'aea91bd0827cdbe2608d91b428489a11eb7de0fa' }, this.recipeTitle), this.category && h("span", { key: '96219817064ee274999487452db6c70dee93d82f', class: "category" }, this.category), h("div", { key: 'c2593b0d879744a24c4be179af1d9359e3e904fa', class: "actions" }, h("slot", { key: '19e921048e6d469a33531c2bb949067a7925c7ac', name: "actions" })))));
21
21
  }
22
22
  };
23
23
  RecipeCard.style = recipeCardCss();
@@ -53,7 +53,7 @@ const RecipeSearchBar = class {
53
53
  this.internalValue = newVal;
54
54
  }
55
55
  render() {
56
- return (h("div", { key: 'b55c496d5c2968b4b79c40b9333c62ed4653e76d', class: "wrap" }, h("input", { key: '081ae0dfde47acca677c746bc88cda1864eac851', type: "search", placeholder: this.placeholder, value: this.internalValue, onInput: this.onInput, onKeyDown: this.onKeyDown }), h("button", { key: '44cde335aec87330bb4486883c9cf836a6855ad0', onClick: () => this.search.emit({ value: this.internalValue }), "aria-label": "Search" }, "\uD83D\uDD0D")));
56
+ return (h("div", { key: '7fa4a3ce06ef9b7e68b968a0bf29cce896cc7db0', class: "wrap" }, h("input", { key: 'ae2e528fafd1f342de8a88c14f0651857bc0486d', type: "search", placeholder: this.placeholder, value: this.internalValue, onInput: this.onInput, onKeyDown: this.onKeyDown }), h("button", { key: 'c9a369dca794014f17cd64cfaa4b7b9f0e06d171', onClick: () => this.search.emit({ value: this.internalValue }), "aria-label": "Search" }, "\uD83D\uDD0D")));
57
57
  }
58
58
  static get watchers() { return {
59
59
  "value": [{
@@ -77,7 +77,7 @@ const RecipeFilterBar = class {
77
77
  }
78
78
  render() {
79
79
  const cats = Array.isArray(this.categories) ? this.categories : [];
80
- return (h("div", { key: '90b26633c07d813221b1cc44705c5fe510de994f', class: "wrap" }, h("button", { key: 'a41696529d8611f283460da1efe9205bd0b36260', 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)))));
80
+ return (h("div", { key: '336e3431325ab3338cda5be917414c6be4be1cf9', class: "wrap" }, h("button", { key: 'f1a5c228cf9ef1dd2017b26be55afdd07e27c837', class: { chip: true, active: this.active === '' }, onClick: () => this.select('') }, "All"), cats.map((c) => (h("button", { class: { chip: true, active: this.active === c }, onClick: () => this.select(c) }, c)))));
81
81
  }
82
82
  };
83
83
  RecipeFilterBar.style = recipeFilterBarCss();
@@ -94,21 +94,34 @@ 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: '2d5251ae7d3a24d613b759e89ba78de1568426d8', 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")))));
97
+ return (h("div", { key: '9e67a7c471e6b20bbc2bc0164a5346c8cd5f10dc', class: "wrap", role: this.readonly ? undefined : 'radiogroup' }, stars.map((s) => (h("span", { class: { star: true, filled: s <= this.value, clickable: !this.readonly }, onClick: () => !this.readonly && this.ratingChange.emit({ value: s }) }, "\u2605")))));
98
98
  }
99
99
  };
100
100
  RecipeRating.style = recipeRatingCss();
101
101
 
102
- const recipeFormCss = () => `:host{display:block;font-family:system-ui, sans-serif}form{display:flex;flex-direction:column;gap:14px}label{display:flex;flex-direction:column;gap:4px;font-size:13px;color:#333;font-weight:600}input,textarea{font-weight:400;padding:8px 10px;border:1px solid #ddd;border-radius:6px;font-size:14px;font-family:inherit}.field{display:flex;flex-direction:column;gap:6px;font-size:13px;font-weight:600}.ingredient-row{display:flex;gap:6px}.ingredient-row input{flex:1}.ingredient-row button{border:none;background:#f4f4f4;border-radius:6px;cursor:pointer;width:30px}.add-btn{align-self:flex-start;border:1px dashed #bbb;background:none;border-radius:6px;padding:6px 10px;cursor:pointer;font-size:13px;color:#555}.error{color:#e74c3c;font-size:12px;font-weight:400}.footer{display:flex;justify-content:flex-end;gap:10px;margin-top:6px}.cancel-btn{border:1px solid #ddd;background:#fff;border-radius:8px;padding:8px 16px;cursor:pointer}.save-btn{border:none;background:#ff6b35;color:#fff;border-radius:8px;padding:8px 18px;cursor:pointer;font-weight:600}`;
102
+ const recipeFormCss = () => `:host{display:block;font-family:system-ui, sans-serif}form{display:flex;flex-direction:column;gap:14px}label{display:flex;flex-direction:column;gap:4px;font-size:13px;color:#333;font-weight:600}input,textarea,select{font-weight:400;padding:8px 10px;border:1px solid #ddd;border-radius:6px;font-size:14px;font-family:inherit;background:#fff;transition:border-color 0.15s ease, box-shadow 0.15s ease}input:focus,textarea:focus,select:focus{outline:none;border-color:#ff6b35;box-shadow:0 0 0 3px rgba(255, 107, 53, 0.14)}select{appearance:none;-webkit-appearance:none;-moz-appearance:none;padding-right:34px;cursor:pointer;color:#1f2937;background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");background-repeat:no-repeat;background-position:right 10px center;background-size:14px}select:hover{border-color:#bbb}select:invalid,select option[value=""]{color:#9ca3af}.row{display:grid;grid-template-columns:1fr 1fr;gap:14px}@media (max-width: 480px){.row{grid-template-columns:1fr}}.field{display:flex;flex-direction:column;gap:6px;font-size:13px;font-weight:600}.ingredient-row{display:flex;gap:6px}.ingredient-row input{flex:1}.ingredient-row button{border:none;background:#f4f4f4;border-radius:6px;cursor:pointer;width:30px}.add-btn{align-self:flex-start;border:1px dashed #bbb;background:none;border-radius:6px;padding:6px 10px;cursor:pointer;font-size:13px;color:#555}.error{color:#e74c3c;font-size:12px;font-weight:400}.footer{display:flex;justify-content:flex-end;gap:10px;margin-top:6px}.cancel-btn{border:1px solid #ddd;background:#fff;border-radius:8px;padding:8px 16px;cursor:pointer}.save-btn{border:none;background:#ff6b35;color:#fff;border-radius:8px;padding:8px 18px;cursor:pointer;font-weight:600}`;
103
103
 
104
+ 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
+ /** Full override of the cuisine dropdown options */
117
+ this.areas = DEFAULT_AREAS;
118
+ /** Additional cuisine options merged in before "Other" */
119
+ this.extraAreas = [];
109
120
  this.title = '';
110
121
  this.image = '';
111
122
  this.category = '';
123
+ this.area = '';
124
+ this.customArea = '';
112
125
  this.ingredients = [''];
113
126
  this.instructions = '';
114
127
  this.errors = {};
@@ -116,11 +129,13 @@ const RecipeForm = class {
116
129
  e.preventDefault();
117
130
  if (!this.validate())
118
131
  return;
132
+ const resolvedArea = this.area === 'Other' ? this.customArea.trim() : this.area;
119
133
  const data = {
120
134
  id: this.initialData?.id,
121
135
  title: this.title.trim(),
122
136
  image: this.image.trim(),
123
137
  category: this.category.trim(),
138
+ area: resolvedArea,
124
139
  ingredients: this.ingredients.map((i) => i.trim()).filter(Boolean),
125
140
  instructions: this.instructions.trim(),
126
141
  };
@@ -139,6 +154,16 @@ const RecipeForm = class {
139
154
  onInitialDataChange() {
140
155
  this.loadInitialData();
141
156
  }
157
+ get fullAreaList() {
158
+ const withoutOther = this.areas.filter((a) => a !== 'Other');
159
+ const merged = [...withoutOther];
160
+ for (const extra of this.extraAreas) {
161
+ if (extra && !merged.includes(extra))
162
+ merged.push(extra);
163
+ }
164
+ merged.push('Other');
165
+ return merged;
166
+ }
142
167
  loadInitialData() {
143
168
  let data;
144
169
  if (typeof this.initialData === 'string' && this.initialData) {
@@ -158,19 +183,29 @@ const RecipeForm = class {
158
183
  this.category = data.category ?? '';
159
184
  this.ingredients = data.ingredients?.length ? [...data.ingredients] : [''];
160
185
  this.instructions = data.instructions ?? '';
186
+ const knownAreas = this.fullAreaList.filter((a) => a !== 'Other');
187
+ if (data.area && !knownAreas.includes(data.area)) {
188
+ this.area = 'Other';
189
+ this.customArea = data.area;
190
+ }
191
+ else {
192
+ this.area = data.area ?? '';
193
+ this.customArea = '';
194
+ }
161
195
  }
162
196
  }
163
197
  validate() {
164
198
  const errors = {};
165
199
  if (!this.title.trim())
166
200
  errors.title = 'Title is required.';
167
- if (!this.category.trim())
168
- errors.category = 'Category is required.';
169
201
  const cleanIngredients = this.ingredients.map((i) => i.trim()).filter(Boolean);
170
202
  if (cleanIngredients.length === 0)
171
203
  errors.ingredients = 'Add at least one ingredient.';
172
204
  if (!this.instructions.trim())
173
205
  errors.instructions = 'Instructions are required.';
206
+ if (this.area === 'Other' && !this.customArea.trim()) {
207
+ errors.customArea = 'Enter a cuisine name.';
208
+ }
174
209
  this.errors = errors;
175
210
  return Object.keys(errors).length === 0;
176
211
  }
@@ -180,7 +215,7 @@ const RecipeForm = class {
180
215
  this.ingredients = next;
181
216
  }
182
217
  render() {
183
- return (h("form", { key: 'd7bf28b14b5d445221c52595bd827f49eed9306b', onSubmit: this.onSubmit }, h("slot", { key: '0ffc3f7fd2e5a15771ae36629365c53b1c44d934', name: "header" }), h("label", { key: '617617d1d4e5b9cbfc506340f3ffcab0364bb402' }, "Title", h("input", { key: '9be17e32164005466bf208323380603e33e43f6e', type: "text", value: this.title, onInput: (e) => (this.title = e.target.value) }), this.errors.title && h("span", { key: 'e1ecebe7af1b6b13a392f4ceb99651c6f87aea43', class: "error" }, this.errors.title)), h("label", { key: '6ce777cc37e11e9c063e43e301d9c93fa7ddf4b4' }, "Image URL", h("input", { key: '37839fabadb556def7f240e8116629315ca1ad73', type: "text", value: this.image, onInput: (e) => (this.image = e.target.value) })), h("label", { key: 'c870efae293faecf06e5d9481d302779c77aac39' }, "Category", h("input", { key: '1cc8a5a113ac6a215dc0c53b43c1f9167afd69f4', type: "text", value: this.category, onInput: (e) => (this.category = e.target.value) }), this.errors.category && h("span", { key: 'ed78cadd9df6f24e700aebc6f85ce993c3d4746b', class: "error" }, this.errors.category)), h("div", { key: '0cbed02ba6b4b021d7cce4ffd9fb3e041452db00', class: "field" }, h("span", { key: '6e8023d7fa1c3a345ac8a1ffca9de1b57af25e8c' }, "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: 'c6fe3f2daad8c3f19daa3570c6e593c6b089aa57', type: "button", class: "add-btn", onClick: this.addIngredient }, "+ Add ingredient"), this.errors.ingredients && h("span", { key: 'bfec646ff34633a03d6b3368c5fb095bc3066025', class: "error" }, this.errors.ingredients)), h("label", { key: 'd3487e03e2c26afe9b3807a9d1f1240dabb30373' }, "Instructions", h("textarea", { key: 'ade48aaca40198665a1fb1525834c27ec0ad0350', rows: 5, onInput: (e) => (this.instructions = e.target.value) }, this.instructions), this.errors.instructions && h("span", { key: 'c90068359e0448b350af5e8b15e50cce682a1615', class: "error" }, this.errors.instructions)), h("div", { key: '2621aec625328743a60c79e49275384017000ccb', class: "footer" }, h("slot", { key: '5d1466af5beba19e66612a7343727ab71e44455f', name: "footer" }), h("button", { key: '5a4883d864051e8081b6a7e1f5c1fb10e7bc5c1a', type: "button", class: "cancel-btn", onClick: () => this.cancel.emit() }, "Cancel"), h("button", { key: '64d4c7e5cad53b1376dce3e73860fc3d4b4d9ff2', type: "submit", class: "save-btn" }, "Save Recipe"))));
218
+ return (h("form", { key: 'b9e50e96b20b8f3bb28ecb516b102c87088daddd', onSubmit: this.onSubmit }, h("slot", { key: '648424eb3444acdacb69e541799571ffa6572004', name: "header" }), h("label", { key: '77ec1e8acd2ba845262909f672fadf06907702f2' }, "Title", h("input", { key: '2f5dd98ab985831eb07ac43afed983908f2646d1', type: "text", value: this.title, onInput: (e) => (this.title = e.target.value) }), this.errors.title && h("span", { key: '244560b4dc4cb47cbb514d0f8fe41be267299885', class: "error" }, this.errors.title)), h("label", { key: '8bb49420325a7629186a5801162b9a2e4321e4f7' }, "Image URL", h("input", { key: 'fe121c2389308b5bc0e6f7b977f15fec91f9baae', type: "text", value: this.image, onInput: (e) => (this.image = e.target.value) })), h("div", { key: '2ede3939f5230f805841945a29fc37fc4d2f3627', class: "row" }, h("label", { key: 'b736ee46a12a1070cb52c76fc41d31e0f8d1169b' }, "Category", h("input", { key: '6952f8378b13313c1c63d2cb1b1cd9c2593d1806', type: "text", value: this.category, onInput: (e) => (this.category = e.target.value) })), h("label", { key: 'a6e477f0bfdfbab6a75831a62334b665272a98db' }, "Cuisine / Area", h("select", { key: '1434d68a1782d19f92cd2d5ef638f440a8adc7dd', onInput: (e) => (this.area = e.target.value) }, h("option", { key: 'a40b1cacf4deb98590689325f23e572522069268', value: "", selected: this.area === '' }, "Select a cuisine\u2026"), this.fullAreaList.map((a) => (h("option", { value: a, selected: a === this.area }, a)))))), this.area === 'Other' && (h("label", { key: '77ab0849f544aacc7c2a207dc222c916dfb7a41b', class: "custom-area-field" }, "Enter cuisine name", h("input", { key: 'fd7c97a89c0e2b8f23cc28fbc502563eb759fdb4', type: "text", placeholder: "e.g. Ethiopian", value: this.customArea, onInput: (e) => (this.customArea = e.target.value) }), this.errors.customArea && h("span", { key: '2b2425b63b0d5ee311fe16040d012a43919c8ca6', class: "error" }, this.errors.customArea))), h("div", { key: 'fafa1824f121c9c2c96069772d2011a13ce0683f', class: "field" }, h("span", { key: 'bea9e5877093e412b1fffb12f0aad4c79604cc16' }, "Ingredients"), this.ingredients.map((ing, i) => (h("div", { class: "ingredient-row" }, h("input", { type: "text", value: ing, onInput: (e) => this.updateIngredient(i, e.target.value) }), h("button", { type: "button", onClick: () => this.removeIngredient(i), "aria-label": "Remove" }, "\u2715")))), h("button", { key: 'fc7a817c01706f4f99594ff09a72fa8b046f4820', type: "button", class: "add-btn", onClick: this.addIngredient }, "+ Add ingredient"), this.errors.ingredients && h("span", { key: 'd4b4bee30e1369f951f0aabe7f54b0b1ae393a83', class: "error" }, this.errors.ingredients)), h("label", { key: '5028ae3ead65e280a2196f93d5f31580a5f8c95a' }, "Instructions", h("textarea", { key: '08461bc98ab47d1f2240dfa23e1ec1264de12002', rows: 5, onInput: (e) => (this.instructions = e.target.value) }, this.instructions), this.errors.instructions && h("span", { key: '932de400651f180d7e5b14e4ff118ccdcd24d2b3', class: "error" }, this.errors.instructions)), h("div", { key: '7da02b77a1390447a738882d0104292b28f675b0', class: "footer" }, h("slot", { key: '74ed118f385e1e6e1318dd405aa0008e195ef9c0', name: "footer" }), h("button", { key: 'e2548efd3826d3a984c11cd6d7bd486e226c8ca9', type: "button", class: "cancel-btn", onClick: () => this.cancel.emit() }, "Cancel"), h("button", { key: '8011e51d4579a0e6ddd88cd8c83708524551d801', type: "submit", class: "save-btn" }, "Save Recipe"))));
184
219
  }
185
220
  static get watchers() { return {
186
221
  "initialData": [{
@@ -16,7 +16,7 @@ const AppToast = class {
16
16
  }
17
17
  }
18
18
  render() {
19
- return (h("div", { key: '41fc3560c508b3b36863417af6d8f0aa2ad26004', class: `toast ${this.type}` }, h("span", { key: 'b29ea7dbe53aa72524039f1ce0fea5c50406d1f0' }, this.message), h("button", { key: '3b42fc8485a5d438bb29b5eab2e3ba5ab831731b', onClick: () => this.dismiss.emit(), "aria-label": "Dismiss" }, "\u2715")));
19
+ return (h("div", { key: '40cf0d0171712b45dd8786bd69aa2f94a1fc7335', class: `toast ${this.type}` }, h("span", { key: '5256c39505158066715c94420ff65a479a7ab382' }, this.message), h("button", { key: '523f0f7617a902910d13179147ca75fa57499433', onClick: () => this.dismiss.emit(), "aria-label": "Dismiss" }, "\u2715")));
20
20
  }
21
21
  };
22
22
  AppToast.style = appToastCss();
@@ -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"],"areas":[16],"extraAreas":[16],"title":[32],"image":[32],"category":[32],"area":[32],"customArea":[32],"ingredients":[32],"instructions":[32],"errors":[32]},null,{"initialData":[{"onInitialDataChange":0}]}],[1,"recipe-rating",{"value":[2],"readonly":[4],"max":[2]}],[1,"recipe-search-bar",{"placeholder":[1],"value":[1],"debounceMs":[2,"debounce-ms"],"internalValue":[32]},null,{"value":[{"onValuePropChange":0}]}]]],["app-toast",[[1,"app-toast",{"message":[1],"type":[1],"duration":[2]}]]]], options);
9
9
  };
10
10
 
11
11
  export { defineCustomElements };
@@ -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"],"areas":[16],"extraAreas":[16],"title":[32],"image":[32],"category":[32],"area":[32],"customArea":[32],"ingredients":[32],"instructions":[32],"errors":[32]},null,{"initialData":[{"onInitialDataChange":0}]}],[1,"recipe-rating",{"value":[2],"readonly":[4],"max":[2]}],[1,"recipe-search-bar",{"placeholder":[1],"value":[1],"debounceMs":[2,"debounce-ms"],"internalValue":[32]},null,{"value":[{"onValuePropChange":0}]}]]],["app-toast",[[1,"app-toast",{"message":[1],"type":[1],"duration":[2]}]]]], options);
21
21
  });
@@ -0,0 +1 @@
1
+ import{r as e,c as t,h as i}from"./p-CrZUP9M-.js";const a=class{constructor(i){e(this,i),this.favoriteToggle=t(this,"favoriteToggle"),this.cardClick=t(this,"cardClick"),this.category="",this.favorite=!1,this.onFavoriteClick=e=>{e.stopPropagation(),this.favoriteToggle.emit({favorite:!this.favorite})}}render(){return i("div",{key:"72e604b38c4156bfe101f0609fac315cd317c981",class:"card",onClick:()=>this.cardClick.emit()},i("div",{key:"bb707d57e573970201644e029eb6257e100e2276",class:"image-wrap"},this.image?i("img",{src:this.image,alt:this.recipeTitle}):i("div",{class:"placeholder"}),i("button",{key:"bb052a897f227e8b8ca938704a083d8502036037",class:{"fav-btn":!0,active:this.favorite},onClick:this.onFavoriteClick,"aria-label":"Toggle favorite"},this.favorite?"★":"☆")),i("div",{key:"e4c139b9bdbdac25e92def0705d8506d89a0ce65",class:"body"},i("h3",{key:"aea91bd0827cdbe2608d91b428489a11eb7de0fa"},this.recipeTitle),this.category&&i("span",{key:"96219817064ee274999487452db6c70dee93d82f",class:"category"},this.category),i("div",{key:"c2593b0d879744a24c4be179af1d9359e3e904fa",class:"actions"},i("slot",{key:"19e921048e6d469a33531c2bb949067a7925c7ac",name:"actions"}))))}};a.style=":host{display:block;font-family:system-ui, sans-serif}.card{border:1px solid #e5e5e5;border-radius:12px;overflow:hidden;cursor:pointer;background:#fff;transition:box-shadow 0.15s ease, transform 0.15s ease}.card:hover{box-shadow:0 4px 16px rgba(0, 0, 0, 0.08);transform:translateY(-2px)}.image-wrap{position:relative;aspect-ratio:4 / 3;background:#f2f2f2}.image-wrap img{width:100%;height:100%;object-fit:cover;display:block}.placeholder{width:100%;height:100%;background:linear-gradient(135deg, #eee, #ddd)}.fav-btn{position:absolute;top:8px;right:8px;border:none;background:rgba(255, 255, 255, 0.9);border-radius:50%;width:32px;height:32px;font-size:16px;cursor:pointer;color:#f5a623}.fav-btn.active{color:#ff6b35}.body{padding:12px 14px}h3{margin:0 0 4px;font-size:15px;line-height:1.3}.category{font-size:12px;color:#777;text-transform:uppercase;letter-spacing:0.03em}.actions{margin-top:8px}";const s=class{constructor(i){e(this,i),this.search=t(this,"search"),this.placeholder="Search recipes...",this.value="",this.debounceMs=350,this.internalValue="",this.onInput=e=>{this.internalValue=e.target.value,clearTimeout(this.timer),this.timer=setTimeout((()=>{this.search.emit({value:this.internalValue})}),this.debounceMs)},this.onKeyDown=e=>{"Enter"===e.key&&(clearTimeout(this.timer),this.search.emit({value:this.internalValue}))}}componentWillLoad(){this.internalValue=this.value}onValuePropChange(e){this.internalValue=e}render(){return i("div",{key:"7fa4a3ce06ef9b7e68b968a0bf29cce896cc7db0",class:"wrap"},i("input",{key:"ae2e528fafd1f342de8a88c14f0651857bc0486d",type:"search",placeholder:this.placeholder,value:this.internalValue,onInput:this.onInput,onKeyDown:this.onKeyDown}),i("button",{key:"c9a369dca794014f17cd64cfaa4b7b9f0e06d171",onClick:()=>this.search.emit({value:this.internalValue}),"aria-label":"Search"},"🔍"))}static get watchers(){return{value:[{onValuePropChange:0}]}}};s.style=":host{display:block;font-family:system-ui, sans-serif}.wrap{display:flex;gap:6px}input{flex:1;padding:10px 14px;border-radius:8px;border:1px solid #ddd;font-size:14px;outline:none}input:focus{border-color:#ff6b35}button{border:none;background:#ff6b35;color:#fff;border-radius:8px;padding:0 16px;cursor:pointer;font-size:15px}";const o=class{constructor(i){e(this,i),this.filterChange=t(this,"filterChange"),this.categories=[],this.active=""}select(e){this.filterChange.emit({value:e})}render(){const e=Array.isArray(this.categories)?this.categories:[];return i("div",{key:"336e3431325ab3338cda5be917414c6be4be1cf9",class:"wrap"},i("button",{key:"f1a5c228cf9ef1dd2017b26be55afdd07e27c837",class:{chip:!0,active:""===this.active},onClick:()=>this.select("")},"All"),e.map((e=>i("button",{class:{chip:!0,active:this.active===e},onClick:()=>this.select(e)},e))))}};o.style=":host{display:block;font-family:system-ui, sans-serif}.wrap{display:flex;flex-wrap:wrap;gap:8px}.chip{border:1px solid #ddd;background:#fff;border-radius:999px;padding:6px 14px;font-size:13px;cursor:pointer;color:#444}.chip.active{background:#ff6b35;border-color:#ff6b35;color:#fff}";const r=class{constructor(i){e(this,i),this.ratingChange=t(this,"ratingChange"),this.value=0,this.readonly=!1,this.max=5}render(){const e=Array.from({length:this.max},((e,t)=>t+1));return i("div",{key:"9e67a7c471e6b20bbc2bc0164a5346c8cd5f10dc",class:"wrap",role:this.readonly?void 0:"radiogroup"},e.map((e=>i("span",{class:{star:!0,filled:e<=this.value,clickable:!this.readonly},onClick:()=>!this.readonly&&this.ratingChange.emit({value:e})},"★"))))}};r.style=":host{display:inline-block;font-family:system-ui, sans-serif}.wrap{display:flex;gap:2px}.star{font-size:18px;color:#ddd}.star.filled{color:#f5a623}.star.clickable{cursor:pointer}";const n=["American","British","Chinese","Croatian","Dutch","Egyptian","Filipino","French","Greek","Indian","Irish","Italian","Jamaican","Japanese","Kenyan","Malaysian","Mexican","Moroccan","Polish","Portuguese","Russian","Spanish","Thai","Tunisian","Turkish","Vietnamese","Other"],c=class{constructor(i){e(this,i),this.save=t(this,"save"),this.cancel=t(this,"cancel"),this.areas=n,this.extraAreas=[],this.title="",this.image="",this.category="",this.area="",this.customArea="",this.ingredients=[""],this.instructions="",this.errors={},this.onSubmit=e=>{if(e.preventDefault(),!this.validate())return;const t="Other"===this.area?this.customArea.trim():this.area,i={id:this.initialData?.id,title:this.title.trim(),image:this.image.trim(),category:this.category.trim(),area:t,ingredients:this.ingredients.map((e=>e.trim())).filter(Boolean),instructions:this.instructions.trim()};this.save.emit(i)},this.addIngredient=()=>{this.ingredients=[...this.ingredients,""]},this.removeIngredient=e=>{this.ingredients=this.ingredients.filter(((t,i)=>i!==e))}}componentWillLoad(){this.loadInitialData()}onInitialDataChange(){this.loadInitialData()}get fullAreaList(){const e=[...this.areas.filter((e=>"Other"!==e))];for(const t of this.extraAreas)t&&!e.includes(t)&&e.push(t);return e.push("Other"),e}loadInitialData(){let e;if("string"==typeof this.initialData&&this.initialData)try{e=JSON.parse(this.initialData)}catch{e=void 0}else this.initialData&&"object"==typeof this.initialData&&(e=this.initialData);if(e){this.title=e.title??"",this.image=e.image??"",this.category=e.category??"",this.ingredients=e.ingredients?.length?[...e.ingredients]:[""],this.instructions=e.instructions??"";const t=this.fullAreaList.filter((e=>"Other"!==e));e.area&&!t.includes(e.area)?(this.area="Other",this.customArea=e.area):(this.area=e.area??"",this.customArea="")}}validate(){const e={};return this.title.trim()||(e.title="Title is required."),0===this.ingredients.map((e=>e.trim())).filter(Boolean).length&&(e.ingredients="Add at least one ingredient."),this.instructions.trim()||(e.instructions="Instructions are required."),"Other"!==this.area||this.customArea.trim()||(e.customArea="Enter a cuisine name."),this.errors=e,0===Object.keys(e).length}updateIngredient(e,t){const i=[...this.ingredients];i[e]=t,this.ingredients=i}render(){return i("form",{key:"b9e50e96b20b8f3bb28ecb516b102c87088daddd",onSubmit:this.onSubmit},i("slot",{key:"648424eb3444acdacb69e541799571ffa6572004",name:"header"}),i("label",{key:"77ec1e8acd2ba845262909f672fadf06907702f2"},"Title",i("input",{key:"2f5dd98ab985831eb07ac43afed983908f2646d1",type:"text",value:this.title,onInput:e=>this.title=e.target.value}),this.errors.title&&i("span",{key:"244560b4dc4cb47cbb514d0f8fe41be267299885",class:"error"},this.errors.title)),i("label",{key:"8bb49420325a7629186a5801162b9a2e4321e4f7"},"Image URL",i("input",{key:"fe121c2389308b5bc0e6f7b977f15fec91f9baae",type:"text",value:this.image,onInput:e=>this.image=e.target.value})),i("div",{key:"2ede3939f5230f805841945a29fc37fc4d2f3627",class:"row"},i("label",{key:"b736ee46a12a1070cb52c76fc41d31e0f8d1169b"},"Category",i("input",{key:"6952f8378b13313c1c63d2cb1b1cd9c2593d1806",type:"text",value:this.category,onInput:e=>this.category=e.target.value})),i("label",{key:"a6e477f0bfdfbab6a75831a62334b665272a98db"},"Cuisine / Area",i("select",{key:"1434d68a1782d19f92cd2d5ef638f440a8adc7dd",onInput:e=>this.area=e.target.value},i("option",{key:"a40b1cacf4deb98590689325f23e572522069268",value:"",selected:""===this.area},"Select a cuisine…"),this.fullAreaList.map((e=>i("option",{value:e,selected:e===this.area},e)))))),"Other"===this.area&&i("label",{key:"77ab0849f544aacc7c2a207dc222c916dfb7a41b",class:"custom-area-field"},"Enter cuisine name",i("input",{key:"fd7c97a89c0e2b8f23cc28fbc502563eb759fdb4",type:"text",placeholder:"e.g. Ethiopian",value:this.customArea,onInput:e=>this.customArea=e.target.value}),this.errors.customArea&&i("span",{key:"2b2425b63b0d5ee311fe16040d012a43919c8ca6",class:"error"},this.errors.customArea)),i("div",{key:"fafa1824f121c9c2c96069772d2011a13ce0683f",class:"field"},i("span",{key:"bea9e5877093e412b1fffb12f0aad4c79604cc16"},"Ingredients"),this.ingredients.map(((e,t)=>i("div",{class:"ingredient-row"},i("input",{type:"text",value:e,onInput:e=>this.updateIngredient(t,e.target.value)}),i("button",{type:"button",onClick:()=>this.removeIngredient(t),"aria-label":"Remove"},"✕")))),i("button",{key:"fc7a817c01706f4f99594ff09a72fa8b046f4820",type:"button",class:"add-btn",onClick:this.addIngredient},"+ Add ingredient"),this.errors.ingredients&&i("span",{key:"d4b4bee30e1369f951f0aabe7f54b0b1ae393a83",class:"error"},this.errors.ingredients)),i("label",{key:"5028ae3ead65e280a2196f93d5f31580a5f8c95a"},"Instructions",i("textarea",{key:"08461bc98ab47d1f2240dfa23e1ec1264de12002",rows:5,onInput:e=>this.instructions=e.target.value},this.instructions),this.errors.instructions&&i("span",{key:"932de400651f180d7e5b14e4ff118ccdcd24d2b3",class:"error"},this.errors.instructions)),i("div",{key:"7da02b77a1390447a738882d0104292b28f675b0",class:"footer"},i("slot",{key:"74ed118f385e1e6e1318dd405aa0008e195ef9c0",name:"footer"}),i("button",{key:"e2548efd3826d3a984c11cd6d7bd486e226c8ca9",type:"button",class:"cancel-btn",onClick:()=>this.cancel.emit()},"Cancel"),i("button",{key:"8011e51d4579a0e6ddd88cd8c83708524551d801",type:"submit",class:"save-btn"},"Save Recipe")))}static get watchers(){return{initialData:[{onInitialDataChange:0}]}}};c.style=":host{display:block;font-family:system-ui, sans-serif}form{display:flex;flex-direction:column;gap:14px}label{display:flex;flex-direction:column;gap:4px;font-size:13px;color:#333;font-weight:600}input,textarea,select{font-weight:400;padding:8px 10px;border:1px solid #ddd;border-radius:6px;font-size:14px;font-family:inherit;background:#fff;transition:border-color 0.15s ease, box-shadow 0.15s ease}input:focus,textarea:focus,select:focus{outline:none;border-color:#ff6b35;box-shadow:0 0 0 3px rgba(255, 107, 53, 0.14)}select{appearance:none;-webkit-appearance:none;-moz-appearance:none;padding-right:34px;cursor:pointer;color:#1f2937;background-image:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E\");background-repeat:no-repeat;background-position:right 10px center;background-size:14px}select:hover{border-color:#bbb}select:invalid,select option[value=\"\"]{color:#9ca3af}.row{display:grid;grid-template-columns:1fr 1fr;gap:14px}@media (max-width: 480px){.row{grid-template-columns:1fr}}.field{display:flex;flex-direction:column;gap:6px;font-size:13px;font-weight:600}.ingredient-row{display:flex;gap:6px}.ingredient-row input{flex:1}.ingredient-row button{border:none;background:#f4f4f4;border-radius:6px;cursor:pointer;width:30px}.add-btn{align-self:flex-start;border:1px dashed #bbb;background:none;border-radius:6px;padding:6px 10px;cursor:pointer;font-size:13px;color:#555}.error{color:#e74c3c;font-size:12px;font-weight:400}.footer{display:flex;justify-content:flex-end;gap:10px;margin-top:6px}.cancel-btn{border:1px solid #ddd;background:#fff;border-radius:8px;padding:8px 16px;cursor:pointer}.save-btn{border:none;background:#ff6b35;color:#fff;border-radius:8px;padding:8px 18px;cursor:pointer;font-weight:600}";const d=class{constructor(i){e(this,i),this.assignMeal=t(this,"assignMeal"),this.removeMeal=t(this,"removeMeal"),this.day="",this.meals=[],this.icon=""}render(){const e=Array.isArray(this.meals)?this.meals:[];return i("div",{key:"cd4f194f1eeb5f53a029f380c40aa0b4ec2f32f4",class:"day-col"},i("div",{key:"d88966142d5101fc522d5de89b6d4cab72cbbbf3",class:"col-header"},this.icon&&i("span",{key:"5a9a27a3a1909bcf7295ec7eeccf309e5e2d1ae0",class:"icon"},this.icon),i("h3",{key:"fd1fa2f1274cc1f6bd8917959015722cb69002ba"},this.day),e.length>0&&i("span",{key:"feff3bc91b52203dba19f7a87c56d3813fc95cdd",class:"count-badge"},e.length)),i("div",{key:"4afee9ce77bf1447bf9e32efc7e2f9b9571873e7",class:"meals"},e.map((e=>i("div",{class:"meal-chip"},i("div",{class:"thumb"},e.image&&i("img",{src:e.image,alt:e.title})),i("span",{class:"title"},e.title),i("button",{class:"remove-btn",onClick:()=>this.removeMeal.emit({day:this.day,mealId:e.id}),"aria-label":`Remove ${e.title}`},"✕")))),0===e.length&&i("p",{key:"9a4002b1b4516fc5ff6ef8f9a2e0a7f5e8465cbd",class:"empty"},"No meal planned")),i("button",{key:"2cef3c5f7d0e89303cb8989f78eefb95c426683f",class:"add-btn",onClick:()=>this.assignMeal.emit({day:this.day})},i("span",{key:"ae54b56f8f0b01f45029e36919764ae31f3a38b9",class:"plus"},"+")," Add meal"))}};d.style=":host{display:block;font-family:-apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif}.day-col{background:#ffffff;border:1px solid #e8eaed;border-radius:12px;padding:14px;min-width:160px;display:flex;flex-direction:column;gap:10px;box-shadow:0 1px 2px rgba(16, 24, 40, 0.04);transition:box-shadow 0.15s ease, border-color 0.15s ease}.day-col:hover{box-shadow:0 4px 12px rgba(16, 24, 40, 0.08);border-color:#d8dce1}.col-header{display:flex;align-items:center;gap:6px;padding-bottom:8px;border-bottom:1px solid #f0f1f3}.col-header .icon{font-size:15px;line-height:1}.col-header h3{margin:0;font-size:12.5px;font-weight:700;text-transform:uppercase;letter-spacing:0.05em;color:#4b5563;flex:1}.count-badge{background:#eef2ff;color:#4338ca;font-size:10.5px;font-weight:700;padding:1px 7px;border-radius:999px;line-height:1.5}.meals{display:flex;flex-direction:column;gap:6px;min-height:44px}.meal-chip{display:flex;align-items:center;gap:8px;background:#f9fafb;border:1px solid #eef0f2;border-radius:9px;padding:6px 8px;font-size:12.5px;transition:background 0.12s ease}.meal-chip:hover{background:#f3f4f6}.thumb{width:28px;height:28px;border-radius:6px;overflow:hidden;flex-shrink:0;background:#e5e7eb}.thumb img{width:100%;height:100%;object-fit:cover;display:block}.meal-chip .title{flex:1;color:#1f2937;font-weight:500;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.remove-btn{border:none;background:none;cursor:pointer;color:#9ca3af;font-size:11px;line-height:1;padding:3px;border-radius:5px;transition:color 0.12s ease, background 0.12s ease}.remove-btn:hover{color:#dc2626;background:#fef2f2}.empty{font-size:12px;color:#9ca3af;margin:6px 0;text-align:center;font-style:italic}.add-btn{display:flex;align-items:center;justify-content:center;gap:4px;border:1.5px dashed #d1d5db;background:none;border-radius:9px;padding:7px;font-size:12px;font-weight:600;cursor:pointer;color:#6b7280;transition:border-color 0.12s ease, color 0.12s ease, background 0.12s ease}.add-btn:hover{border-color:#6366f1;color:#4f46e5;background:#f5f5ff}.plus{font-size:14px;line-height:1}";const l=class{constructor(i){e(this,i),this.close=t(this,"close"),this.open=!1,this.modalTitle=""}render(){return this.open?i("div",{class:"overlay",onClick:()=>this.close.emit()},i("div",{class:"dialog",onClick:e=>e.stopPropagation()},i("div",{class:"header"},i("h2",null,this.modalTitle),i("button",{class:"close-btn",onClick:()=>this.close.emit(),"aria-label":"Close"},"✕")),i("div",{class:"body"},i("slot",null)))):null}};l.style=":host{font-family:system-ui, sans-serif}.overlay{position:fixed;inset:0;background:rgba(0, 0, 0, 0.45);display:flex;align-items:center;justify-content:center;z-index:1000}.dialog{background:#fff;border-radius:12px;min-width:320px;max-width:90vw;max-height:85vh;overflow-y:auto;padding:20px;box-shadow:0 10px 40px rgba(0,0,0,0.2)}.header{display:flex;justify-content:space-between;align-items:center;margin-bottom:12px}.header h2{margin:0;font-size:18px}.close-btn{border:none;background:none;font-size:16px;cursor:pointer;color:#666}";export{l as app_modal,d as meal_plan_day,a as recipe_card,o as recipe_filter_bar,c as recipe_form,r as recipe_rating,s as recipe_search_bar}
@@ -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:"40cf0d0171712b45dd8786bd69aa2f94a1fc7335",class:`toast ${this.type}`},o("span",{key:"5256c39505158066715c94420ff65a479a7ab382"},this.message),o("button",{key:"523f0f7617a902910d13179147ca75fa57499433",onClick:()=>this.dismiss.emit(),"aria-label":"Dismiss"},"✕"))}};a.style=":host{font-family:system-ui, sans-serif;display:block}.toast{display:flex;align-items:center;gap:10px;padding:10px 16px;border-radius:8px;color:#fff;font-size:14px;box-shadow:0 4px 12px rgba(0,0,0,0.15)}.toast.success{background:#2ecc71}.toast.error{background:#e74c3c}.toast.info{background:#3498db}button{border:none;background:none;color:inherit;cursor:pointer;margin-left:auto}";export{a as app_toast}
@@ -1 +1 @@
1
- import{p as e,b as a}from"./p-CrZUP9M-.js";export{s as setNonce}from"./p-CrZUP9M-.js";import{g as 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-97e73b62",[[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}]}]]],["p-268be6b1",[[1,"app-toast",{message:[1],type:[1],duration:[2]}]]]],e))));
1
+ import{p as e,b as a}from"./p-CrZUP9M-.js";export{s as setNonce}from"./p-CrZUP9M-.js";import{g as r}from"./p-DQuL1Twl.js";(()=>{const a=import.meta.url,r={};return""!==a&&(r.resourcesUrl=new URL(".",a).href),e(r)})().then((async e=>(await r(),a([["p-1f2f28cf",[[257,"app-modal",{open:[4],modalTitle:[1,"modal-title"]}],[1,"meal-plan-day",{day:[1],meals:[16],icon:[1]}],[257,"recipe-card",{recipeTitle:[1,"recipe-title"],image:[1],category:[1],favorite:[4]}],[1,"recipe-filter-bar",{categories:[16],active:[1]}],[257,"recipe-form",{initialData:[1,"initial-data"],areas:[16],extraAreas:[16],title:[32],image:[32],category:[32],area:[32],customArea:[32],ingredients:[32],instructions:[32],errors:[32]},null,{initialData:[{onInitialDataChange:0}]}],[1,"recipe-rating",{value:[2],readonly:[4],max:[2]}],[1,"recipe-search-bar",{placeholder:[1],value:[1],debounceMs:[2,"debounce-ms"],internalValue:[32]},null,{value:[{onValuePropChange:0}]}]]],["p-e66a8ded",[[1,"app-toast",{message:[1],type:[1],duration:[2]}]]]],e))));
@@ -4,20 +4,21 @@ export interface RecipeFormData {
4
4
  title: string;
5
5
  image: string;
6
6
  category: string;
7
+ area?: 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
+ /** Full override of the cuisine dropdown options */
14
+ areas: string[];
15
+ /** Additional cuisine options merged in before "Other" */
16
+ extraAreas: string[];
18
17
  title: string;
19
18
  image: string;
20
19
  category: string;
20
+ area: string;
21
+ customArea: string;
21
22
  ingredients: string[];
22
23
  instructions: string;
23
24
  errors: Record<string, string>;
@@ -25,6 +26,7 @@ export declare class RecipeForm {
25
26
  cancel: EventEmitter<void>;
26
27
  componentWillLoad(): void;
27
28
  onInitialDataChange(): void;
29
+ private get fullAreaList();
28
30
  private loadInitialData;
29
31
  private validate;
30
32
  private onSubmit;
@@ -97,15 +97,17 @@ 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
- * Pass an existing recipe (as a JSON string or object) to edit it
102
+ * Full override of the cuisine dropdown options
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
+ "areas": string[];
106
+ /**
107
+ * Additional cuisine options merged in before "Other"
108
+ * @default []
109
+ */
110
+ "extraAreas": string[];
109
111
  "initialData": RecipeFormData | string;
110
112
  }
111
113
  /**
@@ -286,11 +288,6 @@ declare global {
286
288
  "save": RecipeFormData;
287
289
  "cancel": void;
288
290
  }
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
291
  interface HTMLRecipeFormElement extends Components.RecipeForm, HTMLStencilElement {
295
292
  addEventListener<K extends keyof HTMLRecipeFormElementEventMap>(type: K, listener: (this: HTMLRecipeFormElement, ev: RecipeFormCustomEvent<HTMLRecipeFormElementEventMap[K]>) => any, options?: boolean | AddEventListenerOptions): void;
296
293
  addEventListener<K extends keyof DocumentEventMap>(type: K, listener: (this: Document, ev: DocumentEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
@@ -458,15 +455,17 @@ declare namespace LocalJSX {
458
455
  "categories"?: string[];
459
456
  "onFilterChange"?: (event: RecipeFilterBarCustomEvent<{ value: string }>) => void;
460
457
  }
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
458
  interface RecipeForm {
467
459
  /**
468
- * Pass an existing recipe (as a JSON string or object) to edit it
460
+ * Full override of the cuisine dropdown options
461
+ * @default [ 'American', 'British', 'Chinese', 'Croatian', 'Dutch', 'Egyptian', 'Filipino', 'French', 'Greek', 'Indian', 'Irish', 'Italian', 'Jamaican', 'Japanese', 'Kenyan', 'Malaysian', 'Mexican', 'Moroccan', 'Polish', 'Portuguese', 'Russian', 'Spanish', 'Thai', 'Tunisian', 'Turkish', 'Vietnamese', 'Other', ]
469
462
  */
463
+ "areas"?: string[];
464
+ /**
465
+ * Additional cuisine options merged in before "Other"
466
+ * @default []
467
+ */
468
+ "extraAreas"?: string[];
470
469
  "initialData"?: RecipeFormData | string;
471
470
  "onCancel"?: (event: RecipeFormCustomEvent<void>) => void;
472
471
  "onSave"?: (event: RecipeFormCustomEvent<RecipeFormData>) => void;
@@ -583,11 +582,6 @@ declare module "@stencil/core" {
583
582
  * Emits `filterChange` with the selected value ('' = all).
584
583
  */
585
584
  "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
585
  "recipe-form": LocalJSX.IntrinsicElements["recipe-form"] & JSXBase.HTMLAttributes<HTMLRecipeFormElement>;
592
586
  /**
593
587
  * 5-star rating. Read-only display or interactive input.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gurpinderjitsingh/recipe-ui",
3
- "version": "0.2.1",
3
+ "version": "0.4.0",
4
4
  "description": "Reusable web component library for the Recipe Finder & Meal Planner app, built with StencilJS.",
5
5
  "main": "dist/index.cjs.js",
6
6
  "module": "dist/index.js",
@@ -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}