recipe-planner-ui 1.0.0 → 1.1.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.
@@ -6,7 +6,7 @@ var appGlobals = require('./app-globals-V2Kpy_OQ.js');
6
6
  const defineCustomElements = async (win, options) => {
7
7
  if (typeof window === 'undefined') return undefined;
8
8
  await appGlobals.globalScripts();
9
- return index.bootstrapLazy([["rp-filter-chips_5.cjs",[[514,"rp-filter-chips",{"options":[16],"selected":[1],"label":[1]}],[774,"rp-ingredient-list",{"items":[16]}],[774,"rp-modal",{"open":[516],"heading":[1],"focusFirstField":[64]},null,{"open":[{"onOpenChange":0}]}],[774,"rp-recipe-card",{"recipeId":[1,"recipe-id"],"recipeTitle":[1,"recipe-title"],"image":[1],"category":[1],"favorite":[516]}],[514,"rp-search-bar",{"value":[1],"placeholder":[1],"label":[1],"draft":[32]},null,{"value":[{"onValueChange":0}]}]]],["rp-day-slot.cjs",[[774,"rp-day-slot",{"day":[1],"dayLabel":[1,"day-label"],"meals":[16],"days":[16],"normalized":[32]}]]]], options);
9
+ return index.bootstrapLazy([["rp-filter-chips_5.cjs",[[514,"rp-filter-chips",{"options":[16],"selected":[1],"label":[1]}],[774,"rp-ingredient-list",{"items":[16]}],[774,"rp-modal",{"open":[516],"heading":[1],"focusFirstField":[64]},null,{"open":[{"onOpenChange":0}]}],[774,"rp-recipe-card",{"recipeId":[1,"recipe-id"],"recipeTitle":[1,"recipe-title"],"image":[1],"category":[1],"favorite":[516]}],[514,"rp-search-bar",{"value":[1],"placeholder":[1],"label":[1],"draft":[32]},null,{"value":[{"onValueChange":0}]}]]],["rp-day-slot.cjs",[[774,"rp-day-slot",{"day":[1],"dayLabel":[1,"day-label"],"meals":[16],"days":[16],"dayLabels":[16],"normalized":[32]}]]]], options);
10
10
  };
11
11
 
12
12
  exports.setNonce = index.setNonce;
@@ -19,7 +19,7 @@ var patchBrowser = () => {
19
19
 
20
20
  patchBrowser().then(async (options) => {
21
21
  await appGlobals.globalScripts();
22
- return index.bootstrapLazy([["rp-filter-chips_5.cjs",[[514,"rp-filter-chips",{"options":[16],"selected":[1],"label":[1]}],[774,"rp-ingredient-list",{"items":[16]}],[774,"rp-modal",{"open":[516],"heading":[1],"focusFirstField":[64]},null,{"open":[{"onOpenChange":0}]}],[774,"rp-recipe-card",{"recipeId":[1,"recipe-id"],"recipeTitle":[1,"recipe-title"],"image":[1],"category":[1],"favorite":[516]}],[514,"rp-search-bar",{"value":[1],"placeholder":[1],"label":[1],"draft":[32]},null,{"value":[{"onValueChange":0}]}]]],["rp-day-slot.cjs",[[774,"rp-day-slot",{"day":[1],"dayLabel":[1,"day-label"],"meals":[16],"days":[16],"normalized":[32]}]]]], options);
22
+ return index.bootstrapLazy([["rp-filter-chips_5.cjs",[[514,"rp-filter-chips",{"options":[16],"selected":[1],"label":[1]}],[774,"rp-ingredient-list",{"items":[16]}],[774,"rp-modal",{"open":[516],"heading":[1],"focusFirstField":[64]},null,{"open":[{"onOpenChange":0}]}],[774,"rp-recipe-card",{"recipeId":[1,"recipe-id"],"recipeTitle":[1,"recipe-title"],"image":[1],"category":[1],"favorite":[516]}],[514,"rp-search-bar",{"value":[1],"placeholder":[1],"label":[1],"draft":[32]},null,{"value":[{"onValueChange":0}]}]]],["rp-day-slot.cjs",[[774,"rp-day-slot",{"day":[1],"dayLabel":[1,"day-label"],"meals":[16],"days":[16],"dayLabels":[16],"normalized":[32]}]]]], options);
23
23
  });
24
24
 
25
25
  exports.setNonce = index.setNonce;
@@ -19,6 +19,13 @@ const DaySlot = class {
19
19
  meals = [];
20
20
  /** All day keys, used to populate each meal's move target list. */
21
21
  days = [];
22
+ /**
23
+ * Display names for the keys in `days`, as a key-to-label map.
24
+ *
25
+ * Without this the move control would offer raw keys like "mon". Optional, so a
26
+ * consumer whose keys are already human-readable can leave it unset.
27
+ */
28
+ dayLabels = {};
22
29
  normalized = [];
23
30
  /** Fired when the user asks to add a meal to this day. */
24
31
  rpAddMeal;
@@ -46,10 +53,11 @@ const DaySlot = class {
46
53
  };
47
54
  render() {
48
55
  const days = Array.isArray(this.days) ? this.days : [];
56
+ const labels = this.dayLabels ?? {};
49
57
  const meals = this.normalized;
50
- return (index.h(index.Host, { key: '689cfc71ca7fc7106e29278d027ce1c36b3830c0' }, index.h("section", { key: 'd15ed9ae6f800be9962c4c1258397ff1043fef76', class: "slot" }, index.h("header", { key: '7f3ce1dcd4e94af5699b378ab1e461a34792acd8', class: "head" }, index.h("h3", { key: 'b62fe42a27f0072370e59a101452f77de8527ae0', class: "day" }, this.dayLabel || this.day), index.h("button", { key: '658191328f041bc2dd7534a3f5614746f26c0f28', type: "button", class: "add", onClick: () => this.rpAddMeal.emit(this.day), "aria-label": `Add a meal to ${this.dayLabel || this.day}` }, "+")), meals.length === 0 ? (index.h("div", { class: "empty" }, index.h("slot", null, index.h("p", { class: "empty-text" }, "No meals planned")))) : (index.h("ul", { class: "meals" }, meals.map((meal) => (index.h("li", { class: "meal", key: meal.id }, index.h("span", { class: "meal-title" }, meal.title), index.h("div", { class: "meal-actions" }, index.h("label", { class: "move" }, index.h("span", { class: "sr-only" }, `Move ${meal.title} to another day`), index.h("select", { class: "move-select", onChange: (event) => this.onMove(event, meal) }, index.h("option", { value: "" }, "Move\u2026"), days
58
+ return (index.h(index.Host, { key: '978933e713e714278d4913516ec1c1aca1593513' }, index.h("section", { key: '7f035218a49d75e8d96f675259d33de09a504334', class: "slot" }, index.h("header", { key: 'c7d620e25558ca4758f6d67ac3eaf74f1f1f756c', class: "head" }, index.h("h3", { key: 'b17841e7792ffc8c7179a395d7dc2219781179b5', class: "day" }, this.dayLabel || this.day), index.h("button", { key: 'f336aac8ff55e5d596c4d99a954218613b6686a2', type: "button", class: "add", onClick: () => this.rpAddMeal.emit(this.day), "aria-label": `Add a meal to ${this.dayLabel || this.day}` }, "+")), meals.length === 0 ? (index.h("div", { class: "empty" }, index.h("slot", null, index.h("p", { class: "empty-text" }, "No meals planned")))) : (index.h("ul", { class: "meals" }, meals.map((meal) => (index.h("li", { class: "meal", key: meal.id }, index.h("span", { class: "meal-title" }, meal.title), index.h("div", { class: "meal-actions" }, index.h("label", { class: "move" }, index.h("span", { class: "sr-only" }, `Move ${meal.title} to another day`), index.h("select", { class: "move-select", onChange: (event) => this.onMove(event, meal) }, index.h("option", { value: "" }, "Move\u2026"), days
51
59
  .filter((day) => day !== this.day)
52
- .map((day) => (index.h("option", { key: day, value: day }, day))))), index.h("button", { type: "button", class: "remove", onClick: () => this.rpRemoveMeal.emit({ id: meal.id, day: this.day }), "aria-label": `Remove ${meal.title}` }, "\u00D7"))))))))));
60
+ .map((day) => (index.h("option", { key: day, value: day }, labels[day] ?? day))))), index.h("button", { type: "button", class: "remove", onClick: () => this.rpRemoveMeal.emit({ id: meal.id, day: this.day }), "aria-label": `Remove ${meal.title}` }, "\u00D7"))))))))));
53
61
  }
54
62
  };
55
63
  DaySlot.style = rpDaySlotCss();
@@ -16,6 +16,13 @@ export class DaySlot {
16
16
  meals = [];
17
17
  /** All day keys, used to populate each meal's move target list. */
18
18
  days = [];
19
+ /**
20
+ * Display names for the keys in `days`, as a key-to-label map.
21
+ *
22
+ * Without this the move control would offer raw keys like "mon". Optional, so a
23
+ * consumer whose keys are already human-readable can leave it unset.
24
+ */
25
+ dayLabels = {};
19
26
  normalized = [];
20
27
  /** Fired when the user asks to add a meal to this day. */
21
28
  rpAddMeal;
@@ -43,10 +50,11 @@ export class DaySlot {
43
50
  };
44
51
  render() {
45
52
  const days = Array.isArray(this.days) ? this.days : [];
53
+ const labels = this.dayLabels ?? {};
46
54
  const meals = this.normalized;
47
- return (h(Host, { key: '689cfc71ca7fc7106e29278d027ce1c36b3830c0' }, h("section", { key: 'd15ed9ae6f800be9962c4c1258397ff1043fef76', class: "slot" }, h("header", { key: '7f3ce1dcd4e94af5699b378ab1e461a34792acd8', class: "head" }, h("h3", { key: 'b62fe42a27f0072370e59a101452f77de8527ae0', class: "day" }, this.dayLabel || this.day), h("button", { key: '658191328f041bc2dd7534a3f5614746f26c0f28', type: "button", class: "add", onClick: () => this.rpAddMeal.emit(this.day), "aria-label": `Add a meal to ${this.dayLabel || this.day}` }, "+")), meals.length === 0 ? (h("div", { class: "empty" }, h("slot", null, h("p", { class: "empty-text" }, "No meals planned")))) : (h("ul", { class: "meals" }, meals.map((meal) => (h("li", { class: "meal", key: meal.id }, h("span", { class: "meal-title" }, meal.title), h("div", { class: "meal-actions" }, h("label", { class: "move" }, h("span", { class: "sr-only" }, `Move ${meal.title} to another day`), h("select", { class: "move-select", onChange: (event) => this.onMove(event, meal) }, h("option", { value: "" }, "Move\u2026"), days
55
+ return (h(Host, { key: '978933e713e714278d4913516ec1c1aca1593513' }, h("section", { key: '7f035218a49d75e8d96f675259d33de09a504334', class: "slot" }, h("header", { key: 'c7d620e25558ca4758f6d67ac3eaf74f1f1f756c', class: "head" }, h("h3", { key: 'b17841e7792ffc8c7179a395d7dc2219781179b5', class: "day" }, this.dayLabel || this.day), h("button", { key: 'f336aac8ff55e5d596c4d99a954218613b6686a2', type: "button", class: "add", onClick: () => this.rpAddMeal.emit(this.day), "aria-label": `Add a meal to ${this.dayLabel || this.day}` }, "+")), meals.length === 0 ? (h("div", { class: "empty" }, h("slot", null, h("p", { class: "empty-text" }, "No meals planned")))) : (h("ul", { class: "meals" }, meals.map((meal) => (h("li", { class: "meal", key: meal.id }, h("span", { class: "meal-title" }, meal.title), h("div", { class: "meal-actions" }, h("label", { class: "move" }, h("span", { class: "sr-only" }, `Move ${meal.title} to another day`), h("select", { class: "move-select", onChange: (event) => this.onMove(event, meal) }, h("option", { value: "" }, "Move\u2026"), days
48
56
  .filter((day) => day !== this.day)
49
- .map((day) => (h("option", { key: day, value: day }, day))))), h("button", { type: "button", class: "remove", onClick: () => this.rpRemoveMeal.emit({ id: meal.id, day: this.day }), "aria-label": `Remove ${meal.title}` }, "\u00D7"))))))))));
57
+ .map((day) => (h("option", { key: day, value: day }, labels[day] ?? day))))), h("button", { type: "button", class: "remove", onClick: () => this.rpRemoveMeal.emit({ id: meal.id, day: this.day }), "aria-label": `Remove ${meal.title}` }, "\u00D7"))))))))));
50
58
  }
51
59
  static get is() { return "rp-day-slot"; }
52
60
  static get encapsulation() { return "scoped"; }
@@ -142,6 +150,29 @@ export class DaySlot {
142
150
  "getter": false,
143
151
  "setter": false,
144
152
  "defaultValue": "[]"
153
+ },
154
+ "dayLabels": {
155
+ "type": "unknown",
156
+ "mutable": false,
157
+ "complexType": {
158
+ "original": "Record<string, string>",
159
+ "resolved": "string",
160
+ "references": {
161
+ "Record": {
162
+ "location": "global",
163
+ "id": "global::Record"
164
+ }
165
+ }
166
+ },
167
+ "required": false,
168
+ "optional": false,
169
+ "docs": {
170
+ "tags": [],
171
+ "text": "Display names for the keys in `days`, as a key-to-label map.\n\nWithout this the move control would offer raw keys like \"mon\". Optional, so a\nconsumer whose keys are already human-readable can leave it unset."
172
+ },
173
+ "getter": false,
174
+ "setter": false,
175
+ "defaultValue": "{}"
145
176
  }
146
177
  };
147
178
  }
@@ -1 +1 @@
1
- import{p as e,t as a,H as s,c as r,h as t,a as o}from"./index.js";const l=e(class extends s{constructor(e){super(),!1!==e&&this.__registerHost(),this.rpAddMeal=r(this,"rpAddMeal"),this.rpRemoveMeal=r(this,"rpRemoveMeal"),this.rpMoveMeal=r(this,"rpMoveMeal")}day;dayLabel="";meals=[];days=[];normalized=[];rpAddMeal;rpRemoveMeal;rpMoveMeal;componentWillLoad(){this.normalized=Array.isArray(this.meals)?this.meals:[]}componentWillUpdate(){this.normalized=Array.isArray(this.meals)?this.meals:[]}onMove=(e,a)=>{const s=e.target,r=s.value;r&&r!==this.day&&(this.rpMoveMeal.emit({id:a.id,from:this.day,to:r}),s.value="")};render(){const e=Array.isArray(this.days)?this.days:[],a=this.normalized;return t(o,{key:"689cfc71ca7fc7106e29278d027ce1c36b3830c0"},t("section",{key:"d15ed9ae6f800be9962c4c1258397ff1043fef76",class:"slot"},t("header",{key:"7f3ce1dcd4e94af5699b378ab1e461a34792acd8",class:"head"},t("h3",{key:"b62fe42a27f0072370e59a101452f77de8527ae0",class:"day"},this.dayLabel||this.day),t("button",{key:"658191328f041bc2dd7534a3f5614746f26c0f28",type:"button",class:"add",onClick:()=>this.rpAddMeal.emit(this.day),"aria-label":"Add a meal to "+(this.dayLabel||this.day)},"+")),0===a.length?t("div",{class:"empty"},t("slot",null,t("p",{class:"empty-text"},"No meals planned"))):t("ul",{class:"meals"},a.map((a=>t("li",{class:"meal",key:a.id},t("span",{class:"meal-title"},a.title),t("div",{class:"meal-actions"},t("label",{class:"move"},t("span",{class:"sr-only"},`Move ${a.title} to another day`),t("select",{class:"move-select",onChange:e=>this.onMove(e,a)},t("option",{value:""},"Move…"),e.filter((e=>e!==this.day)).map((e=>t("option",{key:e,value:e},e))))),t("button",{type:"button",class:"remove",onClick:()=>this.rpRemoveMeal.emit({id:a.id,day:this.day}),"aria-label":"Remove "+a.title},"×"))))))))}static get style(){return".sc-rp-day-slot-h{display:block;font-family:var(--rp-font-sans);color:var(--rp-color-text)}.slot.sc-rp-day-slot{display:flex;flex-direction:column;height:100%;min-height:160px;background:var(--rp-color-surface);border:1px solid var(--rp-color-border);border-radius:var(--rp-radius-md)}.head.sc-rp-day-slot{display:flex;gap:var(--rp-space-2);align-items:center;justify-content:space-between;padding:var(--rp-space-2) var(--rp-space-3);border-bottom:1px solid var(--rp-color-border)}.day.sc-rp-day-slot{margin:0;font-size:var(--rp-font-size-md);text-transform:capitalize}.add.sc-rp-day-slot{display:grid;place-items:center;width:28px;height:28px;padding:0;font-size:1.125rem;line-height:1;color:var(--rp-color-accent-contrast);cursor:pointer;background:var(--rp-color-accent);border:none;border-radius:50%}.meals.sc-rp-day-slot{flex:1;margin:0;padding:var(--rp-space-2);list-style:none;display:flex;flex-direction:column;gap:var(--rp-space-2)}.meal.sc-rp-day-slot{padding:var(--rp-space-2);background:var(--rp-color-surface-sunken);border-radius:var(--rp-radius-sm)}.meal-title.sc-rp-day-slot{display:block;font-size:var(--rp-font-size-sm);line-height:1.35}.meal-actions.sc-rp-day-slot{display:flex;gap:var(--rp-space-1);align-items:center;justify-content:space-between;margin-top:var(--rp-space-2)}.move-select.sc-rp-day-slot{max-width:100%;padding:2px var(--rp-space-1);font:inherit;font-size:var(--rp-font-size-sm);color:var(--rp-color-text-muted);background:var(--rp-color-surface);border:1px solid var(--rp-color-border);border-radius:var(--rp-radius-sm);text-transform:capitalize}.remove.sc-rp-day-slot{display:grid;place-items:center;width:24px;height:24px;padding:0;font-size:1.125rem;line-height:1;color:var(--rp-color-danger);cursor:pointer;background:none;border:none;border-radius:var(--rp-radius-sm)}.empty.sc-rp-day-slot{display:grid;flex:1;place-items:center;padding:var(--rp-space-3)}.empty-text.sc-rp-day-slot{margin:0;font-size:var(--rp-font-size-sm);color:var(--rp-color-text-muted)}.add.sc-rp-day-slot:focus-visible,.remove.sc-rp-day-slot:focus-visible,.move-select.sc-rp-day-slot:focus-visible{outline:var(--rp-focus-ring);outline-offset:var(--rp-focus-offset)}.sr-only.sc-rp-day-slot{position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap}"}},[774,"rp-day-slot",{day:[1],dayLabel:[1,"day-label"],meals:[16],days:[16],normalized:[32]}]);function i(){"undefined"!=typeof customElements&&["rp-day-slot"].forEach((e=>{"rp-day-slot"===e&&(customElements.get(a(e))||customElements.define(a(e),l))}))}i();const c=l,d=i;export{c as RpDaySlot,d as defineCustomElement}
1
+ import{p as e,t as a,H as s,c as r,h as t,a as o}from"./index.js";const l=e(class extends s{constructor(e){super(),!1!==e&&this.__registerHost(),this.rpAddMeal=r(this,"rpAddMeal"),this.rpRemoveMeal=r(this,"rpRemoveMeal"),this.rpMoveMeal=r(this,"rpMoveMeal")}day;dayLabel="";meals=[];days=[];dayLabels={};normalized=[];rpAddMeal;rpRemoveMeal;rpMoveMeal;componentWillLoad(){this.normalized=Array.isArray(this.meals)?this.meals:[]}componentWillUpdate(){this.normalized=Array.isArray(this.meals)?this.meals:[]}onMove=(e,a)=>{const s=e.target,r=s.value;r&&r!==this.day&&(this.rpMoveMeal.emit({id:a.id,from:this.day,to:r}),s.value="")};render(){const e=Array.isArray(this.days)?this.days:[],a=this.dayLabels??{},s=this.normalized;return t(o,{key:"978933e713e714278d4913516ec1c1aca1593513"},t("section",{key:"7f035218a49d75e8d96f675259d33de09a504334",class:"slot"},t("header",{key:"c7d620e25558ca4758f6d67ac3eaf74f1f1f756c",class:"head"},t("h3",{key:"b17841e7792ffc8c7179a395d7dc2219781179b5",class:"day"},this.dayLabel||this.day),t("button",{key:"f336aac8ff55e5d596c4d99a954218613b6686a2",type:"button",class:"add",onClick:()=>this.rpAddMeal.emit(this.day),"aria-label":"Add a meal to "+(this.dayLabel||this.day)},"+")),0===s.length?t("div",{class:"empty"},t("slot",null,t("p",{class:"empty-text"},"No meals planned"))):t("ul",{class:"meals"},s.map((s=>t("li",{class:"meal",key:s.id},t("span",{class:"meal-title"},s.title),t("div",{class:"meal-actions"},t("label",{class:"move"},t("span",{class:"sr-only"},`Move ${s.title} to another day`),t("select",{class:"move-select",onChange:e=>this.onMove(e,s)},t("option",{value:""},"Move…"),e.filter((e=>e!==this.day)).map((e=>t("option",{key:e,value:e},a[e]??e))))),t("button",{type:"button",class:"remove",onClick:()=>this.rpRemoveMeal.emit({id:s.id,day:this.day}),"aria-label":"Remove "+s.title},"×"))))))))}static get style(){return".sc-rp-day-slot-h{display:block;font-family:var(--rp-font-sans);color:var(--rp-color-text)}.slot.sc-rp-day-slot{display:flex;flex-direction:column;height:100%;min-height:160px;background:var(--rp-color-surface);border:1px solid var(--rp-color-border);border-radius:var(--rp-radius-md)}.head.sc-rp-day-slot{display:flex;gap:var(--rp-space-2);align-items:center;justify-content:space-between;padding:var(--rp-space-2) var(--rp-space-3);border-bottom:1px solid var(--rp-color-border)}.day.sc-rp-day-slot{margin:0;font-size:var(--rp-font-size-md);text-transform:capitalize}.add.sc-rp-day-slot{display:grid;place-items:center;width:28px;height:28px;padding:0;font-size:1.125rem;line-height:1;color:var(--rp-color-accent-contrast);cursor:pointer;background:var(--rp-color-accent);border:none;border-radius:50%}.meals.sc-rp-day-slot{flex:1;margin:0;padding:var(--rp-space-2);list-style:none;display:flex;flex-direction:column;gap:var(--rp-space-2)}.meal.sc-rp-day-slot{padding:var(--rp-space-2);background:var(--rp-color-surface-sunken);border-radius:var(--rp-radius-sm)}.meal-title.sc-rp-day-slot{display:block;font-size:var(--rp-font-size-sm);line-height:1.35}.meal-actions.sc-rp-day-slot{display:flex;gap:var(--rp-space-1);align-items:center;justify-content:space-between;margin-top:var(--rp-space-2)}.move-select.sc-rp-day-slot{max-width:100%;padding:2px var(--rp-space-1);font:inherit;font-size:var(--rp-font-size-sm);color:var(--rp-color-text-muted);background:var(--rp-color-surface);border:1px solid var(--rp-color-border);border-radius:var(--rp-radius-sm);text-transform:capitalize}.remove.sc-rp-day-slot{display:grid;place-items:center;width:24px;height:24px;padding:0;font-size:1.125rem;line-height:1;color:var(--rp-color-danger);cursor:pointer;background:none;border:none;border-radius:var(--rp-radius-sm)}.empty.sc-rp-day-slot{display:grid;flex:1;place-items:center;padding:var(--rp-space-3)}.empty-text.sc-rp-day-slot{margin:0;font-size:var(--rp-font-size-sm);color:var(--rp-color-text-muted)}.add.sc-rp-day-slot:focus-visible,.remove.sc-rp-day-slot:focus-visible,.move-select.sc-rp-day-slot:focus-visible{outline:var(--rp-focus-ring);outline-offset:var(--rp-focus-offset)}.sr-only.sc-rp-day-slot{position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap}"}},[774,"rp-day-slot",{day:[1],dayLabel:[1,"day-label"],meals:[16],days:[16],dayLabels:[16],normalized:[32]}]);function i(){"undefined"!=typeof customElements&&["rp-day-slot"].forEach((e=>{"rp-day-slot"===e&&(customElements.get(a(e))||customElements.define(a(e),l))}))}i();const d=l,c=i;export{d as RpDaySlot,c as defineCustomElement}
@@ -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([["rp-filter-chips_5",[[514,"rp-filter-chips",{"options":[16],"selected":[1],"label":[1]}],[774,"rp-ingredient-list",{"items":[16]}],[774,"rp-modal",{"open":[516],"heading":[1],"focusFirstField":[64]},null,{"open":[{"onOpenChange":0}]}],[774,"rp-recipe-card",{"recipeId":[1,"recipe-id"],"recipeTitle":[1,"recipe-title"],"image":[1],"category":[1],"favorite":[516]}],[514,"rp-search-bar",{"value":[1],"placeholder":[1],"label":[1],"draft":[32]},null,{"value":[{"onValueChange":0}]}]]],["rp-day-slot",[[774,"rp-day-slot",{"day":[1],"dayLabel":[1,"day-label"],"meals":[16],"days":[16],"normalized":[32]}]]]], options);
8
+ return bootstrapLazy([["rp-filter-chips_5",[[514,"rp-filter-chips",{"options":[16],"selected":[1],"label":[1]}],[774,"rp-ingredient-list",{"items":[16]}],[774,"rp-modal",{"open":[516],"heading":[1],"focusFirstField":[64]},null,{"open":[{"onOpenChange":0}]}],[774,"rp-recipe-card",{"recipeId":[1,"recipe-id"],"recipeTitle":[1,"recipe-title"],"image":[1],"category":[1],"favorite":[516]}],[514,"rp-search-bar",{"value":[1],"placeholder":[1],"label":[1],"draft":[32]},null,{"value":[{"onValueChange":0}]}]]],["rp-day-slot",[[774,"rp-day-slot",{"day":[1],"dayLabel":[1,"day-label"],"meals":[16],"days":[16],"dayLabels":[16],"normalized":[32]}]]]], 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([["rp-filter-chips_5",[[514,"rp-filter-chips",{"options":[16],"selected":[1],"label":[1]}],[774,"rp-ingredient-list",{"items":[16]}],[774,"rp-modal",{"open":[516],"heading":[1],"focusFirstField":[64]},null,{"open":[{"onOpenChange":0}]}],[774,"rp-recipe-card",{"recipeId":[1,"recipe-id"],"recipeTitle":[1,"recipe-title"],"image":[1],"category":[1],"favorite":[516]}],[514,"rp-search-bar",{"value":[1],"placeholder":[1],"label":[1],"draft":[32]},null,{"value":[{"onValueChange":0}]}]]],["rp-day-slot",[[774,"rp-day-slot",{"day":[1],"dayLabel":[1,"day-label"],"meals":[16],"days":[16],"normalized":[32]}]]]], options);
20
+ return bootstrapLazy([["rp-filter-chips_5",[[514,"rp-filter-chips",{"options":[16],"selected":[1],"label":[1]}],[774,"rp-ingredient-list",{"items":[16]}],[774,"rp-modal",{"open":[516],"heading":[1],"focusFirstField":[64]},null,{"open":[{"onOpenChange":0}]}],[774,"rp-recipe-card",{"recipeId":[1,"recipe-id"],"recipeTitle":[1,"recipe-title"],"image":[1],"category":[1],"favorite":[516]}],[514,"rp-search-bar",{"value":[1],"placeholder":[1],"label":[1],"draft":[32]},null,{"value":[{"onValueChange":0}]}]]],["rp-day-slot",[[774,"rp-day-slot",{"day":[1],"dayLabel":[1,"day-label"],"meals":[16],"days":[16],"dayLabels":[16],"normalized":[32]}]]]], options);
21
21
  });
@@ -17,6 +17,13 @@ const DaySlot = class {
17
17
  meals = [];
18
18
  /** All day keys, used to populate each meal's move target list. */
19
19
  days = [];
20
+ /**
21
+ * Display names for the keys in `days`, as a key-to-label map.
22
+ *
23
+ * Without this the move control would offer raw keys like "mon". Optional, so a
24
+ * consumer whose keys are already human-readable can leave it unset.
25
+ */
26
+ dayLabels = {};
20
27
  normalized = [];
21
28
  /** Fired when the user asks to add a meal to this day. */
22
29
  rpAddMeal;
@@ -44,10 +51,11 @@ const DaySlot = class {
44
51
  };
45
52
  render() {
46
53
  const days = Array.isArray(this.days) ? this.days : [];
54
+ const labels = this.dayLabels ?? {};
47
55
  const meals = this.normalized;
48
- return (h(Host, { key: '689cfc71ca7fc7106e29278d027ce1c36b3830c0' }, h("section", { key: 'd15ed9ae6f800be9962c4c1258397ff1043fef76', class: "slot" }, h("header", { key: '7f3ce1dcd4e94af5699b378ab1e461a34792acd8', class: "head" }, h("h3", { key: 'b62fe42a27f0072370e59a101452f77de8527ae0', class: "day" }, this.dayLabel || this.day), h("button", { key: '658191328f041bc2dd7534a3f5614746f26c0f28', type: "button", class: "add", onClick: () => this.rpAddMeal.emit(this.day), "aria-label": `Add a meal to ${this.dayLabel || this.day}` }, "+")), meals.length === 0 ? (h("div", { class: "empty" }, h("slot", null, h("p", { class: "empty-text" }, "No meals planned")))) : (h("ul", { class: "meals" }, meals.map((meal) => (h("li", { class: "meal", key: meal.id }, h("span", { class: "meal-title" }, meal.title), h("div", { class: "meal-actions" }, h("label", { class: "move" }, h("span", { class: "sr-only" }, `Move ${meal.title} to another day`), h("select", { class: "move-select", onChange: (event) => this.onMove(event, meal) }, h("option", { value: "" }, "Move\u2026"), days
56
+ return (h(Host, { key: '978933e713e714278d4913516ec1c1aca1593513' }, h("section", { key: '7f035218a49d75e8d96f675259d33de09a504334', class: "slot" }, h("header", { key: 'c7d620e25558ca4758f6d67ac3eaf74f1f1f756c', class: "head" }, h("h3", { key: 'b17841e7792ffc8c7179a395d7dc2219781179b5', class: "day" }, this.dayLabel || this.day), h("button", { key: 'f336aac8ff55e5d596c4d99a954218613b6686a2', type: "button", class: "add", onClick: () => this.rpAddMeal.emit(this.day), "aria-label": `Add a meal to ${this.dayLabel || this.day}` }, "+")), meals.length === 0 ? (h("div", { class: "empty" }, h("slot", null, h("p", { class: "empty-text" }, "No meals planned")))) : (h("ul", { class: "meals" }, meals.map((meal) => (h("li", { class: "meal", key: meal.id }, h("span", { class: "meal-title" }, meal.title), h("div", { class: "meal-actions" }, h("label", { class: "move" }, h("span", { class: "sr-only" }, `Move ${meal.title} to another day`), h("select", { class: "move-select", onChange: (event) => this.onMove(event, meal) }, h("option", { value: "" }, "Move\u2026"), days
49
57
  .filter((day) => day !== this.day)
50
- .map((day) => (h("option", { key: day, value: day }, day))))), h("button", { type: "button", class: "remove", onClick: () => this.rpRemoveMeal.emit({ id: meal.id, day: this.day }), "aria-label": `Remove ${meal.title}` }, "\u00D7"))))))))));
58
+ .map((day) => (h("option", { key: day, value: day }, labels[day] ?? day))))), h("button", { type: "button", class: "remove", onClick: () => this.rpRemoveMeal.emit({ id: meal.id, day: this.day }), "aria-label": `Remove ${meal.title}` }, "\u00D7"))))))))));
51
59
  }
52
60
  };
53
61
  DaySlot.style = rpDaySlotCss();
@@ -0,0 +1 @@
1
+ import{r as e,c as a,h as r,H as s}from"./p-B4wAFfci.js";const t=class{constructor(r){e(this,r),this.rpAddMeal=a(this,"rpAddMeal"),this.rpRemoveMeal=a(this,"rpRemoveMeal"),this.rpMoveMeal=a(this,"rpMoveMeal")}day;dayLabel="";meals=[];days=[];dayLabels={};normalized=[];rpAddMeal;rpRemoveMeal;rpMoveMeal;componentWillLoad(){this.normalized=Array.isArray(this.meals)?this.meals:[]}componentWillUpdate(){this.normalized=Array.isArray(this.meals)?this.meals:[]}onMove=(e,a)=>{const r=e.target,s=r.value;s&&s!==this.day&&(this.rpMoveMeal.emit({id:a.id,from:this.day,to:s}),r.value="")};render(){const e=Array.isArray(this.days)?this.days:[],a=this.dayLabels??{},t=this.normalized;return r(s,{key:"978933e713e714278d4913516ec1c1aca1593513"},r("section",{key:"7f035218a49d75e8d96f675259d33de09a504334",class:"slot"},r("header",{key:"c7d620e25558ca4758f6d67ac3eaf74f1f1f756c",class:"head"},r("h3",{key:"b17841e7792ffc8c7179a395d7dc2219781179b5",class:"day"},this.dayLabel||this.day),r("button",{key:"f336aac8ff55e5d596c4d99a954218613b6686a2",type:"button",class:"add",onClick:()=>this.rpAddMeal.emit(this.day),"aria-label":`Add a meal to ${this.dayLabel||this.day}`},"+")),0===t.length?r("div",{class:"empty"},r("slot",null,r("p",{class:"empty-text"},"No meals planned"))):r("ul",{class:"meals"},t.map((s=>r("li",{class:"meal",key:s.id},r("span",{class:"meal-title"},s.title),r("div",{class:"meal-actions"},r("label",{class:"move"},r("span",{class:"sr-only"},`Move ${s.title} to another day`),r("select",{class:"move-select",onChange:e=>this.onMove(e,s)},r("option",{value:""},"Move…"),e.filter((e=>e!==this.day)).map((e=>r("option",{key:e,value:e},a[e]??e))))),r("button",{type:"button",class:"remove",onClick:()=>this.rpRemoveMeal.emit({id:s.id,day:this.day}),"aria-label":`Remove ${s.title}`},"×"))))))))}};t.style=".sc-rp-day-slot-h{display:block;font-family:var(--rp-font-sans);color:var(--rp-color-text)}.slot.sc-rp-day-slot{display:flex;flex-direction:column;height:100%;min-height:160px;background:var(--rp-color-surface);border:1px solid var(--rp-color-border);border-radius:var(--rp-radius-md)}.head.sc-rp-day-slot{display:flex;gap:var(--rp-space-2);align-items:center;justify-content:space-between;padding:var(--rp-space-2) var(--rp-space-3);border-bottom:1px solid var(--rp-color-border)}.day.sc-rp-day-slot{margin:0;font-size:var(--rp-font-size-md);text-transform:capitalize}.add.sc-rp-day-slot{display:grid;place-items:center;width:28px;height:28px;padding:0;font-size:1.125rem;line-height:1;color:var(--rp-color-accent-contrast);cursor:pointer;background:var(--rp-color-accent);border:none;border-radius:50%}.meals.sc-rp-day-slot{flex:1;margin:0;padding:var(--rp-space-2);list-style:none;display:flex;flex-direction:column;gap:var(--rp-space-2)}.meal.sc-rp-day-slot{padding:var(--rp-space-2);background:var(--rp-color-surface-sunken);border-radius:var(--rp-radius-sm)}.meal-title.sc-rp-day-slot{display:block;font-size:var(--rp-font-size-sm);line-height:1.35}.meal-actions.sc-rp-day-slot{display:flex;gap:var(--rp-space-1);align-items:center;justify-content:space-between;margin-top:var(--rp-space-2)}.move-select.sc-rp-day-slot{max-width:100%;padding:2px var(--rp-space-1);font:inherit;font-size:var(--rp-font-size-sm);color:var(--rp-color-text-muted);background:var(--rp-color-surface);border:1px solid var(--rp-color-border);border-radius:var(--rp-radius-sm);text-transform:capitalize}.remove.sc-rp-day-slot{display:grid;place-items:center;width:24px;height:24px;padding:0;font-size:1.125rem;line-height:1;color:var(--rp-color-danger);cursor:pointer;background:none;border:none;border-radius:var(--rp-radius-sm)}.empty.sc-rp-day-slot{display:grid;flex:1;place-items:center;padding:var(--rp-space-3)}.empty-text.sc-rp-day-slot{margin:0;font-size:var(--rp-font-size-sm);color:var(--rp-color-text-muted)}.add.sc-rp-day-slot:focus-visible,.remove.sc-rp-day-slot:focus-visible,.move-select.sc-rp-day-slot:focus-visible{outline:var(--rp-focus-ring);outline-offset:var(--rp-focus-offset)}.sr-only.sc-rp-day-slot{position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap}";export{t as rp_day_slot}
@@ -1 +1 @@
1
- import{p as e,b as a}from"./p-B4wAFfci.js";export{s as setNonce}from"./p-B4wAFfci.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-d54dbd37",[[514,"rp-filter-chips",{options:[16],selected:[1],label:[1]}],[774,"rp-ingredient-list",{items:[16]}],[774,"rp-modal",{open:[516],heading:[1],focusFirstField:[64]},null,{open:[{onOpenChange:0}]}],[774,"rp-recipe-card",{recipeId:[1,"recipe-id"],recipeTitle:[1,"recipe-title"],image:[1],category:[1],favorite:[516]}],[514,"rp-search-bar",{value:[1],placeholder:[1],label:[1],draft:[32]},null,{value:[{onValueChange:0}]}]]],["p-66ba2983",[[774,"rp-day-slot",{day:[1],dayLabel:[1,"day-label"],meals:[16],days:[16],normalized:[32]}]]]],e))));
1
+ import{p as e,b as a}from"./p-B4wAFfci.js";export{s as setNonce}from"./p-B4wAFfci.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-d54dbd37",[[514,"rp-filter-chips",{options:[16],selected:[1],label:[1]}],[774,"rp-ingredient-list",{items:[16]}],[774,"rp-modal",{open:[516],heading:[1],focusFirstField:[64]},null,{open:[{onOpenChange:0}]}],[774,"rp-recipe-card",{recipeId:[1,"recipe-id"],recipeTitle:[1,"recipe-title"],image:[1],category:[1],favorite:[516]}],[514,"rp-search-bar",{value:[1],placeholder:[1],label:[1],draft:[32]},null,{value:[{onValueChange:0}]}]]],["p-0c8f7438",[[774,"rp-day-slot",{day:[1],dayLabel:[1,"day-label"],meals:[16],days:[16],dayLabels:[16],normalized:[32]}]]]],e))));
@@ -20,6 +20,13 @@ export declare class DaySlot {
20
20
  meals: PlannedMeal[];
21
21
  /** All day keys, used to populate each meal's move target list. */
22
22
  days: string[];
23
+ /**
24
+ * Display names for the keys in `days`, as a key-to-label map.
25
+ *
26
+ * Without this the move control would offer raw keys like "mon". Optional, so a
27
+ * consumer whose keys are already human-readable can leave it unset.
28
+ */
29
+ dayLabels: Record<string, string>;
23
30
  private normalized;
24
31
  /** Fired when the user asks to add a meal to this day. */
25
32
  rpAddMeal: EventEmitter<string>;
@@ -23,6 +23,11 @@ export namespace Components {
23
23
  * @default ''
24
24
  */
25
25
  "dayLabel": string;
26
+ /**
27
+ * Display names for the keys in `days`, as a key-to-label map. Without this the move control would offer raw keys like "mon". Optional, so a consumer whose keys are already human-readable can leave it unset.
28
+ * @default {}
29
+ */
30
+ "dayLabels": Record<string, string>;
26
31
  /**
27
32
  * All day keys, used to populate each meal's move target list.
28
33
  * @default []
@@ -312,6 +317,11 @@ declare namespace LocalJSX {
312
317
  * @default ''
313
318
  */
314
319
  "dayLabel"?: string;
320
+ /**
321
+ * Display names for the keys in `days`, as a key-to-label map. Without this the move control would offer raw keys like "mon". Optional, so a consumer whose keys are already human-readable can leave it unset.
322
+ * @default {}
323
+ */
324
+ "dayLabels"?: Record<string, string>;
315
325
  /**
316
326
  * All day keys, used to populate each meal's move target list.
317
327
  * @default []
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "recipe-planner-ui",
3
- "version": "1.0.0",
3
+ "version": "1.1.0",
4
4
  "description": "Framework-agnostic web components for recipe discovery and meal planning UIs.",
5
5
  "license": "MIT",
6
6
  "author": "sahilsoni432",
@@ -28,13 +28,14 @@
28
28
  },
29
29
  "./dist/recipe-planner-ui/recipe-planner-ui.css": "./dist/recipe-planner-ui/recipe-planner-ui.css",
30
30
  "./dist/*": "./dist/*",
31
+ "./package.json": "./package.json",
31
32
  "./components/*.js": {
32
33
  "types": "./dist/components/*.d.ts",
33
- "import": "./dist/components/*.js"
34
+ "default": "./dist/components/*.js"
34
35
  },
35
36
  "./components/*": {
36
37
  "types": "./dist/components/*.d.ts",
37
- "import": "./dist/components/*.js"
38
+ "default": "./dist/components/*.js"
38
39
  },
39
40
  "./loader": {
40
41
  "types": "./loader/index.d.ts",
package/readme.md CHANGED
@@ -67,7 +67,7 @@ exists on the element.
67
67
  | `rp-search-bar` | `value`, `placeholder`, `label` | `rpSearch`, `rpClear` | — |
68
68
  | `rp-filter-chips` | `options[]`, `selected` | `rpFilterChange` | — |
69
69
  | `rp-ingredient-list` | `items[]` | — | `heading`, default |
70
- | `rp-day-slot` | `day`, `dayLabel`, `meals[]`, `days[]` | `rpAddMeal`, `rpRemoveMeal`, `rpMoveMeal` | default |
70
+ | `rp-day-slot` | `day`, `dayLabel`, `meals[]`, `days[]`, `dayLabels` | `rpAddMeal`, `rpRemoveMeal`, `rpMoveMeal` | default |
71
71
  | `rp-modal` | `open`, `heading` | `rpClose` | default, `footer` |
72
72
 
73
73
  Per-component API documentation, generated from the source, lives in each component's
@@ -1 +0,0 @@
1
- import{r as e,c as r,h as a,H as s}from"./p-B4wAFfci.js";const o=class{constructor(a){e(this,a),this.rpAddMeal=r(this,"rpAddMeal"),this.rpRemoveMeal=r(this,"rpRemoveMeal"),this.rpMoveMeal=r(this,"rpMoveMeal")}day;dayLabel="";meals=[];days=[];normalized=[];rpAddMeal;rpRemoveMeal;rpMoveMeal;componentWillLoad(){this.normalized=Array.isArray(this.meals)?this.meals:[]}componentWillUpdate(){this.normalized=Array.isArray(this.meals)?this.meals:[]}onMove=(e,r)=>{const a=e.target,s=a.value;s&&s!==this.day&&(this.rpMoveMeal.emit({id:r.id,from:this.day,to:s}),a.value="")};render(){const e=Array.isArray(this.days)?this.days:[],r=this.normalized;return a(s,{key:"689cfc71ca7fc7106e29278d027ce1c36b3830c0"},a("section",{key:"d15ed9ae6f800be9962c4c1258397ff1043fef76",class:"slot"},a("header",{key:"7f3ce1dcd4e94af5699b378ab1e461a34792acd8",class:"head"},a("h3",{key:"b62fe42a27f0072370e59a101452f77de8527ae0",class:"day"},this.dayLabel||this.day),a("button",{key:"658191328f041bc2dd7534a3f5614746f26c0f28",type:"button",class:"add",onClick:()=>this.rpAddMeal.emit(this.day),"aria-label":`Add a meal to ${this.dayLabel||this.day}`},"+")),0===r.length?a("div",{class:"empty"},a("slot",null,a("p",{class:"empty-text"},"No meals planned"))):a("ul",{class:"meals"},r.map((r=>a("li",{class:"meal",key:r.id},a("span",{class:"meal-title"},r.title),a("div",{class:"meal-actions"},a("label",{class:"move"},a("span",{class:"sr-only"},`Move ${r.title} to another day`),a("select",{class:"move-select",onChange:e=>this.onMove(e,r)},a("option",{value:""},"Move…"),e.filter((e=>e!==this.day)).map((e=>a("option",{key:e,value:e},e))))),a("button",{type:"button",class:"remove",onClick:()=>this.rpRemoveMeal.emit({id:r.id,day:this.day}),"aria-label":`Remove ${r.title}`},"×"))))))))}};o.style=".sc-rp-day-slot-h{display:block;font-family:var(--rp-font-sans);color:var(--rp-color-text)}.slot.sc-rp-day-slot{display:flex;flex-direction:column;height:100%;min-height:160px;background:var(--rp-color-surface);border:1px solid var(--rp-color-border);border-radius:var(--rp-radius-md)}.head.sc-rp-day-slot{display:flex;gap:var(--rp-space-2);align-items:center;justify-content:space-between;padding:var(--rp-space-2) var(--rp-space-3);border-bottom:1px solid var(--rp-color-border)}.day.sc-rp-day-slot{margin:0;font-size:var(--rp-font-size-md);text-transform:capitalize}.add.sc-rp-day-slot{display:grid;place-items:center;width:28px;height:28px;padding:0;font-size:1.125rem;line-height:1;color:var(--rp-color-accent-contrast);cursor:pointer;background:var(--rp-color-accent);border:none;border-radius:50%}.meals.sc-rp-day-slot{flex:1;margin:0;padding:var(--rp-space-2);list-style:none;display:flex;flex-direction:column;gap:var(--rp-space-2)}.meal.sc-rp-day-slot{padding:var(--rp-space-2);background:var(--rp-color-surface-sunken);border-radius:var(--rp-radius-sm)}.meal-title.sc-rp-day-slot{display:block;font-size:var(--rp-font-size-sm);line-height:1.35}.meal-actions.sc-rp-day-slot{display:flex;gap:var(--rp-space-1);align-items:center;justify-content:space-between;margin-top:var(--rp-space-2)}.move-select.sc-rp-day-slot{max-width:100%;padding:2px var(--rp-space-1);font:inherit;font-size:var(--rp-font-size-sm);color:var(--rp-color-text-muted);background:var(--rp-color-surface);border:1px solid var(--rp-color-border);border-radius:var(--rp-radius-sm);text-transform:capitalize}.remove.sc-rp-day-slot{display:grid;place-items:center;width:24px;height:24px;padding:0;font-size:1.125rem;line-height:1;color:var(--rp-color-danger);cursor:pointer;background:none;border:none;border-radius:var(--rp-radius-sm)}.empty.sc-rp-day-slot{display:grid;flex:1;place-items:center;padding:var(--rp-space-3)}.empty-text.sc-rp-day-slot{margin:0;font-size:var(--rp-font-size-sm);color:var(--rp-color-text-muted)}.add.sc-rp-day-slot:focus-visible,.remove.sc-rp-day-slot:focus-visible,.move-select.sc-rp-day-slot:focus-visible{outline:var(--rp-focus-ring);outline-offset:var(--rp-focus-offset)}.sr-only.sc-rp-day-slot{position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap}";export{o as rp_day_slot}