@ssejal8/recipe-ui-kit 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +108 -277
- package/dist/cjs/index-BEr8BsSA.js +1712 -0
- package/dist/cjs/index-BEr8BsSA.js.map +1 -0
- package/dist/cjs/index.cjs.js +5 -0
- package/dist/cjs/index.cjs.js.map +1 -0
- package/dist/cjs/loader.cjs.js +15 -0
- package/dist/cjs/loader.cjs.js.map +1 -0
- package/dist/cjs/recipe-kit.cjs.js +27 -0
- package/dist/cjs/recipe-kit.cjs.js.map +1 -0
- package/dist/cjs/rk-badge_10.cjs.entry.js +638 -0
- package/dist/cjs/rk-badge_10.cjs.entry.js.map +1 -0
- package/dist/collection/collection-manifest.json +22 -0
- package/dist/collection/components/rk-badge/rk-badge.js +97 -0
- package/dist/collection/components/rk-badge/rk-badge.js.map +1 -0
- package/dist/collection/components/rk-chip/rk-chip.js +245 -0
- package/dist/collection/components/rk-chip/rk-chip.js.map +1 -0
- package/dist/collection/components/rk-empty-state/rk-empty-state.js +138 -0
- package/dist/collection/components/rk-empty-state/rk-empty-state.js.map +1 -0
- package/dist/collection/components/rk-meal-slot/rk-meal-slot.js +312 -0
- package/dist/collection/components/rk-meal-slot/rk-meal-slot.js.map +1 -0
- package/dist/collection/components/rk-modal/rk-modal.js +256 -0
- package/dist/collection/components/rk-modal/rk-modal.js.map +1 -0
- package/dist/collection/components/rk-rating/rk-rating.js +228 -0
- package/dist/collection/components/rk-rating/rk-rating.js.map +1 -0
- package/dist/collection/components/rk-recipe-card/rk-recipe-card.js +366 -0
- package/dist/collection/components/rk-recipe-card/rk-recipe-card.js.map +1 -0
- package/dist/collection/components/rk-search-bar/rk-search-bar.js +291 -0
- package/dist/collection/components/rk-search-bar/rk-search-bar.js.map +1 -0
- package/dist/collection/components/rk-segmented-control/rk-segmented-control.js +196 -0
- package/dist/collection/components/rk-segmented-control/rk-segmented-control.js.map +1 -0
- package/dist/collection/components/rk-tag-input/rk-tag-input.js +264 -0
- package/dist/collection/components/rk-tag-input/rk-tag-input.js.map +1 -0
- package/dist/collection/index.js +2 -0
- package/dist/collection/index.js.map +1 -0
- package/dist/components/index.d.ts +35 -0
- package/dist/components/index.js +2 -0
- package/dist/components/index.js.map +1 -0
- package/dist/components/rk-badge.d.ts +11 -0
- package/dist/components/rk-badge.js +2 -0
- package/dist/components/rk-badge.js.map +1 -0
- package/dist/components/rk-chip.d.ts +11 -0
- package/dist/components/rk-chip.js +2 -0
- package/dist/components/rk-chip.js.map +1 -0
- package/dist/components/rk-empty-state.d.ts +11 -0
- package/dist/components/rk-empty-state.js +2 -0
- package/dist/components/rk-empty-state.js.map +1 -0
- package/dist/components/rk-meal-slot.d.ts +11 -0
- package/dist/components/rk-meal-slot.js +2 -0
- package/dist/components/rk-meal-slot.js.map +1 -0
- package/dist/components/rk-modal.d.ts +11 -0
- package/dist/components/rk-modal.js +2 -0
- package/dist/components/rk-modal.js.map +1 -0
- package/dist/components/rk-rating.d.ts +11 -0
- package/dist/components/rk-rating.js +2 -0
- package/dist/components/rk-rating.js.map +1 -0
- package/dist/components/rk-recipe-card.d.ts +11 -0
- package/dist/components/rk-recipe-card.js +2 -0
- package/dist/components/rk-recipe-card.js.map +1 -0
- package/dist/components/rk-search-bar.d.ts +11 -0
- package/dist/components/rk-search-bar.js +2 -0
- package/dist/components/rk-search-bar.js.map +1 -0
- package/dist/components/rk-segmented-control.d.ts +11 -0
- package/dist/components/rk-segmented-control.js +2 -0
- package/dist/components/rk-segmented-control.js.map +1 -0
- package/dist/components/rk-tag-input.d.ts +11 -0
- package/dist/components/rk-tag-input.js +2 -0
- package/dist/components/rk-tag-input.js.map +1 -0
- package/dist/esm/index-Bxo0C8lB.js +1684 -0
- package/dist/esm/index-Bxo0C8lB.js.map +1 -0
- package/dist/esm/index.js +4 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/loader.js +13 -0
- package/dist/esm/loader.js.map +1 -0
- package/dist/esm/recipe-kit.js +23 -0
- package/dist/esm/recipe-kit.js.map +1 -0
- package/dist/esm/rk-badge_10.entry.js +627 -0
- package/dist/esm/rk-badge_10.entry.js.map +1 -0
- package/dist/index.cjs.js +1 -0
- package/dist/index.js +1 -0
- package/dist/recipe-kit/index.esm.js +2 -0
- package/dist/recipe-kit/index.esm.js.map +1 -0
- package/dist/recipe-kit/p-Bxo0C8lB.js +3 -0
- package/dist/recipe-kit/p-Bxo0C8lB.js.map +1 -0
- package/dist/recipe-kit/p-fcb955c7.entry.js +2 -0
- package/dist/recipe-kit/p-fcb955c7.entry.js.map +1 -0
- package/dist/recipe-kit/recipe-kit.css +1 -0
- package/dist/recipe-kit/recipe-kit.esm.js +2 -0
- package/dist/recipe-kit/recipe-kit.esm.js.map +1 -0
- package/dist/recipe-kit/rk-global.css +104 -0
- package/dist/types/components/rk-badge/rk-badge.d.ts +15 -0
- package/dist/types/components/rk-chip/rk-chip.d.ts +37 -0
- package/dist/types/components/rk-empty-state/rk-empty-state.d.ts +19 -0
- package/dist/types/components/rk-meal-slot/rk-meal-slot.d.ts +53 -0
- package/dist/types/components/rk-modal/rk-modal.d.ts +41 -0
- package/dist/types/components/rk-rating/rk-rating.d.ts +26 -0
- package/dist/types/components/rk-recipe-card/rk-recipe-card.d.ts +67 -0
- package/dist/types/components/rk-search-bar/rk-search-bar.d.ts +39 -0
- package/dist/types/components/rk-segmented-control/rk-segmented-control.d.ts +37 -0
- package/dist/types/components/rk-tag-input/rk-tag-input.d.ts +35 -0
- package/{packages/recipe-kit-stencil/src → dist/types}/components.d.ts +1 -1
- package/{packages/recipe-kit-stencil/src/index.ts → dist/types/index.d.ts} +0 -2
- package/dist/types/stencil-public-runtime.d.ts +1873 -0
- package/loader/cdn.js +1 -0
- package/loader/index.cjs.js +1 -0
- package/loader/index.d.ts +24 -0
- package/loader/index.es2017.js +1 -0
- package/loader/index.js +2 -0
- package/package.json +84 -22
- package/.claude/settings.local.json +0 -10
- package/.npmr +0 -1
- package/apps/recipe-web/package.json +0 -31
- package/apps/recipe-web/src/app.css +0 -418
- package/apps/recipe-web/src/app.d.ts +0 -32
- package/apps/recipe-web/src/app.html +0 -25
- package/apps/recipe-web/src/lib/api/mealdb.ts +0 -240
- package/apps/recipe-web/src/lib/components/AppHeader.svelte +0 -290
- package/apps/recipe-web/src/lib/components/ConfirmDialog.svelte +0 -46
- package/apps/recipe-web/src/lib/components/Modal.svelte +0 -33
- package/apps/recipe-web/src/lib/components/RecipeCard.svelte +0 -100
- package/apps/recipe-web/src/lib/components/RecipeForm.svelte +0 -560
- package/apps/recipe-web/src/lib/components/RecipeGrid.svelte +0 -77
- package/apps/recipe-web/src/lib/components/RecipePickerDialog.svelte +0 -185
- package/apps/recipe-web/src/lib/components/Toaster.svelte +0 -111
- package/apps/recipe-web/src/lib/domain/recipe.ts +0 -130
- package/apps/recipe-web/src/lib/domain/validation.ts +0 -189
- package/apps/recipe-web/src/lib/stencil/WebComponent.svelte +0 -145
- package/apps/recipe-web/src/lib/stencil/register.ts +0 -28
- package/apps/recipe-web/src/lib/stores/favorites.svelte.ts +0 -81
- package/apps/recipe-web/src/lib/stores/myRecipes.svelte.ts +0 -98
- package/apps/recipe-web/src/lib/stores/persisted.svelte.ts +0 -73
- package/apps/recipe-web/src/lib/stores/planner.svelte.ts +0 -275
- package/apps/recipe-web/src/lib/stores/theme.svelte.ts +0 -67
- package/apps/recipe-web/src/lib/stores/toast.svelte.ts +0 -66
- package/apps/recipe-web/src/routes/+error.svelte +0 -36
- package/apps/recipe-web/src/routes/+layout.svelte +0 -62
- package/apps/recipe-web/src/routes/+page.svelte +0 -352
- package/apps/recipe-web/src/routes/+page.ts +0 -107
- package/apps/recipe-web/src/routes/favorites/+page.svelte +0 -170
- package/apps/recipe-web/src/routes/my-recipes/+layout.ts +0 -55
- package/apps/recipe-web/src/routes/my-recipes/+page.svelte +0 -180
- package/apps/recipe-web/src/routes/my-recipes/[id]/edit/+page.svelte +0 -104
- package/apps/recipe-web/src/routes/my-recipes/new/+page.svelte +0 -67
- package/apps/recipe-web/src/routes/planner/+page.svelte +0 -422
- package/apps/recipe-web/src/routes/recipes/[id]/+page.svelte +0 -538
- package/apps/recipe-web/src/routes/recipes/[id]/+page.ts +0 -24
- package/apps/recipe-web/static/favicon.svg +0 -8
- package/apps/recipe-web/static/robots.txt +0 -2
- package/apps/recipe-web/svelte.config.js +0 -35
- package/apps/recipe-web/tsconfig.json +0 -14
- package/apps/recipe-web/vite.config.ts +0 -23
- package/packages/recipe-kit-stencil/README.md +0 -185
- package/packages/recipe-kit-stencil/package-lock.json +0 -4772
- package/packages/recipe-kit-stencil/package.json +0 -91
- package/packages/recipe-kit-stencil/src/components/rk-badge/readme.md +0 -38
- package/packages/recipe-kit-stencil/src/components/rk-badge/rk-badge.tsx +0 -31
- package/packages/recipe-kit-stencil/src/components/rk-chip/readme.md +0 -52
- package/packages/recipe-kit-stencil/src/components/rk-chip/rk-chip.tsx +0 -105
- package/packages/recipe-kit-stencil/src/components/rk-empty-state/readme.md +0 -44
- package/packages/recipe-kit-stencil/src/components/rk-empty-state/rk-empty-state.tsx +0 -50
- package/packages/recipe-kit-stencil/src/components/rk-meal-slot/readme.md +0 -58
- package/packages/recipe-kit-stencil/src/components/rk-meal-slot/rk-meal-slot.tsx +0 -182
- package/packages/recipe-kit-stencil/src/components/rk-modal/readme.md +0 -57
- package/packages/recipe-kit-stencil/src/components/rk-modal/rk-modal.tsx +0 -176
- package/packages/recipe-kit-stencil/src/components/rk-rating/readme.md +0 -42
- package/packages/recipe-kit-stencil/src/components/rk-rating/rk-rating.tsx +0 -114
- package/packages/recipe-kit-stencil/src/components/rk-recipe-card/readme.md +0 -66
- package/packages/recipe-kit-stencil/src/components/rk-recipe-card/rk-recipe-card.tsx +0 -179
- package/packages/recipe-kit-stencil/src/components/rk-recipe-card/test/rk-recipe-card.spec.tsx +0 -70
- package/packages/recipe-kit-stencil/src/components/rk-search-bar/readme.md +0 -67
- package/packages/recipe-kit-stencil/src/components/rk-search-bar/rk-search-bar.tsx +0 -152
- package/packages/recipe-kit-stencil/src/components/rk-search-bar/test/rk-search-bar.spec.tsx +0 -93
- package/packages/recipe-kit-stencil/src/components/rk-segmented-control/readme.md +0 -41
- package/packages/recipe-kit-stencil/src/components/rk-segmented-control/rk-segmented-control.tsx +0 -115
- package/packages/recipe-kit-stencil/src/components/rk-tag-input/readme.md +0 -47
- package/packages/recipe-kit-stencil/src/components/rk-tag-input/rk-tag-input.tsx +0 -181
- package/packages/recipe-kit-stencil/src/components/rk-tag-input/test/rk-tag-input.spec.tsx +0 -76
- package/packages/recipe-kit-stencil/src/index.html +0 -259
- package/packages/recipe-kit-stencil/stencil.config.ts +0 -41
- package/packages/recipe-kit-stencil/tsconfig.json +0 -24
- /package/{packages/recipe-kit-stencil/LICENSE → LICENSE} +0 -0
- /package/{packages/recipe-kit-stencil/src → dist/collection}/components/rk-badge/rk-badge.css +0 -0
- /package/{packages/recipe-kit-stencil/src → dist/collection}/components/rk-chip/rk-chip.css +0 -0
- /package/{packages/recipe-kit-stencil/src → dist/collection}/components/rk-empty-state/rk-empty-state.css +0 -0
- /package/{packages/recipe-kit-stencil/src → dist/collection}/components/rk-meal-slot/rk-meal-slot.css +0 -0
- /package/{packages/recipe-kit-stencil/src → dist/collection}/components/rk-modal/rk-modal.css +0 -0
- /package/{packages/recipe-kit-stencil/src → dist/collection}/components/rk-rating/rk-rating.css +0 -0
- /package/{packages/recipe-kit-stencil/src → dist/collection}/components/rk-recipe-card/rk-recipe-card.css +0 -0
- /package/{packages/recipe-kit-stencil/src → dist/collection}/components/rk-search-bar/rk-search-bar.css +0 -0
- /package/{packages/recipe-kit-stencil/src → dist/collection}/components/rk-segmented-control/rk-segmented-control.css +0 -0
- /package/{packages/recipe-kit-stencil/src → dist/collection}/components/rk-tag-input/rk-tag-input.css +0 -0
- /package/{packages/recipe-kit-stencil/src/global → dist/collection}/rk-global.css +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|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AQ,EAAE,OAAO,EAAE,IAAI,CAAC,WAAW,IACtI,IAAI,CACE,CACV,CAAC;IACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, Event, EventEmitter, h, Prop } from '@stencil/core';\n\n/**\n * A selectable / dismissible filter chip.\n *\n * @slot - Optional leading content (icon, emoji, avatar) rendered before the label.\n */\n@Component({\n tag: 'rk-chip',\n styleUrl: 'rk-chip.css',\n shadow: true,\n})\nexport class RkChip {\n /** Visible text. */\n @Prop() label = '';\n\n /** Value reported back to the host application in event payloads. */\n @Prop() value?: string;\n\n /** Whether the chip is currently active. */\n @Prop() selected = false;\n\n /** Optional trailing count badge (e.g. number of matching recipes). */\n @Prop() count?: number;\n\n /** Renders an \"x\" button that emits `rkChipDismiss` instead of toggling. */\n @Prop() dismissible = false;\n\n /** Disables interaction. */\n @Prop() disabled = false;\n\n /** Visual treatment. */\n @Prop() tone: 'neutral' | 'primary' | 'accent' = 'neutral';\n\n /** Emitted when the chip is toggled. */\n @Event({ eventName: 'rkChipToggle' }) rkChipToggle!: EventEmitter<{ value: string; label: string; selected: boolean }>;\n\n /** Emitted when a dismissible chip's remove button is pressed. */\n @Event({ eventName: 'rkChipDismiss' }) rkChipDismiss!: EventEmitter<{ value: string; label: string }>;\n\n private get resolvedValue() {\n return this.value ?? this.label;\n }\n\n private handleClick = () => {\n if (this.disabled) return;\n this.rkChipToggle.emit({\n value: this.resolvedValue,\n label: this.label,\n selected: !this.selected,\n });\n };\n\n private handleDismiss = (event: MouseEvent) => {\n event.stopPropagation();\n if (this.disabled) return;\n this.rkChipDismiss.emit({ value: this.resolvedValue, label: this.label });\n };\n\n render() {\n const body = [\n <span class=\"lead\">\n <slot />\n </span>,\n <span class=\"label\" part=\"label\">\n {this.label}\n </span>,\n typeof this.count === 'number' && (\n <span class=\"count\" part=\"count\">\n {this.count}\n </span>\n ),\n ];\n\n const classes = {\n chip: true,\n 'is-selected': this.selected,\n 'is-dismissible': this.dismissible,\n [`tone-${this.tone}`]: true,\n };\n\n // A dismissible chip needs two independent controls, so the shell becomes a\n // plain element to avoid nesting buttons inside a button.\n if (this.dismissible) {\n return (\n <span class={classes} part=\"chip\">\n <button class=\"body\" type=\"button\" disabled={this.disabled} onClick={this.handleClick}>\n {body}\n </button>\n <button class=\"dismiss\" part=\"dismiss\" type=\"button\" disabled={this.disabled} aria-label={`Remove ${this.label}`} onClick={this.handleDismiss}>\n <svg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2.4\" stroke-linecap=\"round\" aria-hidden=\"true\">\n <path d=\"M6 6l12 12M18 6 6 18\" />\n </svg>\n </button>\n </span>\n );\n }\n\n return (\n <button class={classes} part=\"chip\" type=\"button\" aria-pressed={String(this.selected)} disabled={this.disabled} onClick={this.handleClick}>\n {body}\n </button>\n );\n }\n}\n"]}
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
import { h } from "@stencil/core";
|
|
2
|
+
/**
|
|
3
|
+
* Placeholder shown when a list has no items, a search returns nothing, or a
|
|
4
|
+
* request fails.
|
|
5
|
+
*
|
|
6
|
+
* @slot - Call-to-action content rendered under the message (buttons, links).
|
|
7
|
+
*/
|
|
8
|
+
export class RkEmptyState {
|
|
9
|
+
constructor() {
|
|
10
|
+
/** Emoji or short glyph shown above the heading. */
|
|
11
|
+
this.icon = '🍳';
|
|
12
|
+
/** Bold headline. */
|
|
13
|
+
this.heading = 'Nothing here yet';
|
|
14
|
+
/** `error` swaps to a warning treatment. */
|
|
15
|
+
this.tone = 'neutral';
|
|
16
|
+
/** Removes the dashed border and reduces padding, for inline use. */
|
|
17
|
+
this.bare = false;
|
|
18
|
+
}
|
|
19
|
+
render() {
|
|
20
|
+
return (h("div", { key: 'd770d00625d0f8933704195e975ff96e2599a8a9', class: { empty: true, [`tone-${this.tone}`]: true, 'is-bare': this.bare }, part: "container", role: this.tone === 'error' ? 'alert' : null }, h("span", { key: '566dc86da2eaaa9765c3112f381aa409bdcf5198', class: "icon", part: "icon", "aria-hidden": "true" }, this.icon), h("h3", { key: '9d8e62cc4724b970b6c16dd51797e6c480bf38d2', class: "heading", part: "heading" }, this.heading), this.message && (h("p", { key: 'b200ce21253e8cd7f9aa73b513030656db956a5e', class: "message", part: "message" }, this.message)), h("div", { key: '1d04761bf9fa953362826e13be1fc95eebc9067a', class: "actions", part: "actions" }, h("slot", { key: 'f1302bd354850c09e6fb4b136a32759040b30ecd' }))));
|
|
21
|
+
}
|
|
22
|
+
static get is() { return "rk-empty-state"; }
|
|
23
|
+
static get encapsulation() { return "shadow"; }
|
|
24
|
+
static get originalStyleUrls() {
|
|
25
|
+
return {
|
|
26
|
+
"$": ["rk-empty-state.css"]
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
static get styleUrls() {
|
|
30
|
+
return {
|
|
31
|
+
"$": ["rk-empty-state.css"]
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
static get properties() {
|
|
35
|
+
return {
|
|
36
|
+
"icon": {
|
|
37
|
+
"type": "string",
|
|
38
|
+
"mutable": false,
|
|
39
|
+
"complexType": {
|
|
40
|
+
"original": "string",
|
|
41
|
+
"resolved": "string",
|
|
42
|
+
"references": {}
|
|
43
|
+
},
|
|
44
|
+
"required": false,
|
|
45
|
+
"optional": false,
|
|
46
|
+
"docs": {
|
|
47
|
+
"tags": [],
|
|
48
|
+
"text": "Emoji or short glyph shown above the heading."
|
|
49
|
+
},
|
|
50
|
+
"getter": false,
|
|
51
|
+
"setter": false,
|
|
52
|
+
"reflect": false,
|
|
53
|
+
"attribute": "icon",
|
|
54
|
+
"defaultValue": "'\uD83C\uDF73'"
|
|
55
|
+
},
|
|
56
|
+
"heading": {
|
|
57
|
+
"type": "string",
|
|
58
|
+
"mutable": false,
|
|
59
|
+
"complexType": {
|
|
60
|
+
"original": "string",
|
|
61
|
+
"resolved": "string",
|
|
62
|
+
"references": {}
|
|
63
|
+
},
|
|
64
|
+
"required": false,
|
|
65
|
+
"optional": false,
|
|
66
|
+
"docs": {
|
|
67
|
+
"tags": [],
|
|
68
|
+
"text": "Bold headline."
|
|
69
|
+
},
|
|
70
|
+
"getter": false,
|
|
71
|
+
"setter": false,
|
|
72
|
+
"reflect": false,
|
|
73
|
+
"attribute": "heading",
|
|
74
|
+
"defaultValue": "'Nothing here yet'"
|
|
75
|
+
},
|
|
76
|
+
"message": {
|
|
77
|
+
"type": "string",
|
|
78
|
+
"mutable": false,
|
|
79
|
+
"complexType": {
|
|
80
|
+
"original": "string",
|
|
81
|
+
"resolved": "string",
|
|
82
|
+
"references": {}
|
|
83
|
+
},
|
|
84
|
+
"required": false,
|
|
85
|
+
"optional": true,
|
|
86
|
+
"docs": {
|
|
87
|
+
"tags": [],
|
|
88
|
+
"text": "Supporting sentence."
|
|
89
|
+
},
|
|
90
|
+
"getter": false,
|
|
91
|
+
"setter": false,
|
|
92
|
+
"reflect": false,
|
|
93
|
+
"attribute": "message"
|
|
94
|
+
},
|
|
95
|
+
"tone": {
|
|
96
|
+
"type": "string",
|
|
97
|
+
"mutable": false,
|
|
98
|
+
"complexType": {
|
|
99
|
+
"original": "'neutral' | 'error'",
|
|
100
|
+
"resolved": "\"error\" | \"neutral\"",
|
|
101
|
+
"references": {}
|
|
102
|
+
},
|
|
103
|
+
"required": false,
|
|
104
|
+
"optional": false,
|
|
105
|
+
"docs": {
|
|
106
|
+
"tags": [],
|
|
107
|
+
"text": "`error` swaps to a warning treatment."
|
|
108
|
+
},
|
|
109
|
+
"getter": false,
|
|
110
|
+
"setter": false,
|
|
111
|
+
"reflect": false,
|
|
112
|
+
"attribute": "tone",
|
|
113
|
+
"defaultValue": "'neutral'"
|
|
114
|
+
},
|
|
115
|
+
"bare": {
|
|
116
|
+
"type": "boolean",
|
|
117
|
+
"mutable": false,
|
|
118
|
+
"complexType": {
|
|
119
|
+
"original": "boolean",
|
|
120
|
+
"resolved": "boolean",
|
|
121
|
+
"references": {}
|
|
122
|
+
},
|
|
123
|
+
"required": false,
|
|
124
|
+
"optional": false,
|
|
125
|
+
"docs": {
|
|
126
|
+
"tags": [],
|
|
127
|
+
"text": "Removes the dashed border and reduces padding, for inline use."
|
|
128
|
+
},
|
|
129
|
+
"getter": false,
|
|
130
|
+
"setter": false,
|
|
131
|
+
"reflect": false,
|
|
132
|
+
"attribute": "bare",
|
|
133
|
+
"defaultValue": "false"
|
|
134
|
+
}
|
|
135
|
+
};
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
//# sourceMappingURL=rk-empty-state.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rk-empty-state.js","sourceRoot":"","sources":["../../../src/components/rk-empty-state/rk-empty-state.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AAEnD;;;;;GAKG;AAMH,MAAM,OAAO,YAAY;IALzB;QAME,oDAAoD;QAC5C,SAAI,GAAG,IAAI,CAAC;QAEpB,qBAAqB;QACb,YAAO,GAAG,kBAAkB,CAAC;QAKrC,4CAA4C;QACpC,SAAI,GAAwB,SAAS,CAAC;QAE9C,qEAAqE;QAC7D,SAAI,GAAG,KAAK,CAAC;KAsBtB;IApBC,MAAM;QACJ,OAAO,CACL,4DAAK,KAAK,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,QAAQ,IAAI,CAAC,IAAI,EAAE,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,CAAC,IAAI,EAAE,EAAE,IAAI,EAAC,WAAW,EAAC,IAAI,EAAE,IAAI,CAAC,IAAI,KAAK,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI;YAC3I,6DAAM,KAAK,EAAC,MAAM,EAAC,IAAI,EAAC,MAAM,iBAAa,MAAM,IAC9C,IAAI,CAAC,IAAI,CACL;YACP,2DAAI,KAAK,EAAC,SAAS,EAAC,IAAI,EAAC,SAAS,IAC/B,IAAI,CAAC,OAAO,CACV;YACJ,IAAI,CAAC,OAAO,IAAI,CACf,0DAAG,KAAK,EAAC,SAAS,EAAC,IAAI,EAAC,SAAS,IAC9B,IAAI,CAAC,OAAO,CACX,CACL;YACD,4DAAK,KAAK,EAAC,SAAS,EAAC,IAAI,EAAC,SAAS;gBACjC,8DAAQ,CACJ,CACF,CACP,CAAC;IACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, h, Prop } from '@stencil/core';\n\n/**\n * Placeholder shown when a list has no items, a search returns nothing, or a\n * request fails.\n *\n * @slot - Call-to-action content rendered under the message (buttons, links).\n */\n@Component({\n tag: 'rk-empty-state',\n styleUrl: 'rk-empty-state.css',\n shadow: true,\n})\nexport class RkEmptyState {\n /** Emoji or short glyph shown above the heading. */\n @Prop() icon = '🍳';\n\n /** Bold headline. */\n @Prop() heading = 'Nothing here yet';\n\n /** Supporting sentence. */\n @Prop() message?: string;\n\n /** `error` swaps to a warning treatment. */\n @Prop() tone: 'neutral' | 'error' = 'neutral';\n\n /** Removes the dashed border and reduces padding, for inline use. */\n @Prop() bare = false;\n\n render() {\n return (\n <div class={{ empty: true, [`tone-${this.tone}`]: true, 'is-bare': this.bare }} part=\"container\" role={this.tone === 'error' ? 'alert' : null}>\n <span class=\"icon\" part=\"icon\" aria-hidden=\"true\">\n {this.icon}\n </span>\n <h3 class=\"heading\" part=\"heading\">\n {this.heading}\n </h3>\n {this.message && (\n <p class=\"message\" part=\"message\">\n {this.message}\n </p>\n )}\n <div class=\"actions\" part=\"actions\">\n <slot />\n </div>\n </div>\n );\n }\n}\n"]}
|
|
@@ -0,0 +1,312 @@
|
|
|
1
|
+
import { h } from "@stencil/core";
|
|
2
|
+
/**
|
|
3
|
+
* One cell of the weekly planner grid: either an empty "add" target or a filled
|
|
4
|
+
* slot showing the planned recipe. Doubles as a drop zone for drag-and-drop
|
|
5
|
+
* planning.
|
|
6
|
+
*
|
|
7
|
+
* @slot - Extra content rendered under the recipe name (e.g. serving notes).
|
|
8
|
+
*/
|
|
9
|
+
export class RkMealSlot {
|
|
10
|
+
constructor() {
|
|
11
|
+
/** Disables interaction. */
|
|
12
|
+
this.disabled = false;
|
|
13
|
+
this.dragOver = false;
|
|
14
|
+
this.handleDragOver = (event) => {
|
|
15
|
+
if (this.disabled)
|
|
16
|
+
return;
|
|
17
|
+
// Preventing default is what marks this element as a valid drop target.
|
|
18
|
+
event.preventDefault();
|
|
19
|
+
if (event.dataTransfer)
|
|
20
|
+
event.dataTransfer.dropEffect = 'copy';
|
|
21
|
+
this.dragOver = true;
|
|
22
|
+
};
|
|
23
|
+
this.handleDrop = (event) => {
|
|
24
|
+
event.preventDefault();
|
|
25
|
+
this.dragOver = false;
|
|
26
|
+
if (this.disabled)
|
|
27
|
+
return;
|
|
28
|
+
const payload = event.dataTransfer?.getData('text/plain') ?? '';
|
|
29
|
+
if (payload)
|
|
30
|
+
this.rkMealDrop.emit({ ...this.slotDetail, payload });
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
get filled() {
|
|
34
|
+
return !!this.recipeId;
|
|
35
|
+
}
|
|
36
|
+
get slotDetail() {
|
|
37
|
+
return { day: this.day, mealType: this.mealType };
|
|
38
|
+
}
|
|
39
|
+
get recipeDetail() {
|
|
40
|
+
return { ...this.slotDetail, recipeId: this.recipeId ?? '', recipeName: this.recipeName ?? '' };
|
|
41
|
+
}
|
|
42
|
+
render() {
|
|
43
|
+
if (!this.filled) {
|
|
44
|
+
return (h("button", { class: { slot: true, 'is-empty': true, 'is-drag-over': this.dragOver }, part: "slot", type: "button", disabled: this.disabled, "aria-label": `Add a recipe for ${this.mealLabel ?? this.mealType} on ${this.day}`, onClick: () => this.rkMealAdd.emit(this.slotDetail), onDragOver: this.handleDragOver, onDragLeave: () => (this.dragOver = false), onDrop: this.handleDrop }, h("span", { class: "plus", "aria-hidden": "true" }, "+"), h("span", { class: "empty-label" }, this.mealLabel ?? this.mealType)));
|
|
45
|
+
}
|
|
46
|
+
return (h("div", { class: { slot: true, 'is-filled': true, 'is-drag-over': this.dragOver }, part: "slot", onDragOver: this.handleDragOver, onDragLeave: () => (this.dragOver = false), onDrop: this.handleDrop }, this.mealLabel && (h("span", { class: "caption", part: "caption" }, this.mealLabel)), h("button", { class: "main", part: "main", type: "button", disabled: this.disabled, title: this.recipeName, onClick: () => this.rkMealOpen.emit(this.recipeDetail) }, this.recipeImage ? (h("img", { class: "thumb", src: this.recipeImage, alt: "", loading: "lazy", decoding: "async" })) : (h("span", { class: "thumb thumb-fallback", "aria-hidden": "true" }, "\uD83C\uDF7D\uFE0F")), h("span", { class: "name", part: "name" }, this.recipeName)), h("div", { class: "extra" }, h("slot", null)), h("div", { class: "controls", part: "controls" }, h("button", { class: "ctrl", type: "button", disabled: this.disabled, "aria-label": `Replace ${this.recipeName}`, title: "Replace", onClick: () => this.rkMealSwap.emit(this.recipeDetail) }, h("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", "stroke-width": "2", "stroke-linecap": "round", "stroke-linejoin": "round", "aria-hidden": "true" }, h("path", { d: "M3 12a9 9 0 0 1 15.3-6.4L21 8" }), h("path", { d: "M21 3v5h-5" }), h("path", { d: "M21 12a9 9 0 0 1-15.3 6.4L3 16" }), h("path", { d: "M3 21v-5h5" }))), h("button", { class: "ctrl is-danger", type: "button", disabled: this.disabled, "aria-label": `Remove ${this.recipeName} from ${this.mealLabel ?? this.mealType}`, title: "Remove", onClick: () => this.rkMealRemove.emit(this.recipeDetail) }, h("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", "stroke-width": "2", "stroke-linecap": "round", "aria-hidden": "true" }, h("path", { d: "M6 6l12 12M18 6 6 18" }))))));
|
|
47
|
+
}
|
|
48
|
+
static get is() { return "rk-meal-slot"; }
|
|
49
|
+
static get encapsulation() { return "shadow"; }
|
|
50
|
+
static get originalStyleUrls() {
|
|
51
|
+
return {
|
|
52
|
+
"$": ["rk-meal-slot.css"]
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
static get styleUrls() {
|
|
56
|
+
return {
|
|
57
|
+
"$": ["rk-meal-slot.css"]
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
static get properties() {
|
|
61
|
+
return {
|
|
62
|
+
"day": {
|
|
63
|
+
"type": "string",
|
|
64
|
+
"mutable": false,
|
|
65
|
+
"complexType": {
|
|
66
|
+
"original": "string",
|
|
67
|
+
"resolved": "string",
|
|
68
|
+
"references": {}
|
|
69
|
+
},
|
|
70
|
+
"required": true,
|
|
71
|
+
"optional": false,
|
|
72
|
+
"docs": {
|
|
73
|
+
"tags": [],
|
|
74
|
+
"text": "Day key this slot belongs to, e.g. `monday`. Echoed in event payloads."
|
|
75
|
+
},
|
|
76
|
+
"getter": false,
|
|
77
|
+
"setter": false,
|
|
78
|
+
"reflect": false,
|
|
79
|
+
"attribute": "day"
|
|
80
|
+
},
|
|
81
|
+
"mealType": {
|
|
82
|
+
"type": "string",
|
|
83
|
+
"mutable": false,
|
|
84
|
+
"complexType": {
|
|
85
|
+
"original": "string",
|
|
86
|
+
"resolved": "string",
|
|
87
|
+
"references": {}
|
|
88
|
+
},
|
|
89
|
+
"required": true,
|
|
90
|
+
"optional": false,
|
|
91
|
+
"docs": {
|
|
92
|
+
"tags": [],
|
|
93
|
+
"text": "Meal type key, e.g. `breakfast`. Echoed in event payloads."
|
|
94
|
+
},
|
|
95
|
+
"getter": false,
|
|
96
|
+
"setter": false,
|
|
97
|
+
"reflect": false,
|
|
98
|
+
"attribute": "meal-type"
|
|
99
|
+
},
|
|
100
|
+
"mealLabel": {
|
|
101
|
+
"type": "string",
|
|
102
|
+
"mutable": false,
|
|
103
|
+
"complexType": {
|
|
104
|
+
"original": "string",
|
|
105
|
+
"resolved": "string",
|
|
106
|
+
"references": {}
|
|
107
|
+
},
|
|
108
|
+
"required": false,
|
|
109
|
+
"optional": true,
|
|
110
|
+
"docs": {
|
|
111
|
+
"tags": [],
|
|
112
|
+
"text": "Human-readable meal label shown as the slot caption."
|
|
113
|
+
},
|
|
114
|
+
"getter": false,
|
|
115
|
+
"setter": false,
|
|
116
|
+
"reflect": false,
|
|
117
|
+
"attribute": "meal-label"
|
|
118
|
+
},
|
|
119
|
+
"recipeId": {
|
|
120
|
+
"type": "string",
|
|
121
|
+
"mutable": false,
|
|
122
|
+
"complexType": {
|
|
123
|
+
"original": "string",
|
|
124
|
+
"resolved": "string",
|
|
125
|
+
"references": {}
|
|
126
|
+
},
|
|
127
|
+
"required": false,
|
|
128
|
+
"optional": true,
|
|
129
|
+
"docs": {
|
|
130
|
+
"tags": [],
|
|
131
|
+
"text": "Id of the planned recipe. Empty means the slot is free."
|
|
132
|
+
},
|
|
133
|
+
"getter": false,
|
|
134
|
+
"setter": false,
|
|
135
|
+
"reflect": false,
|
|
136
|
+
"attribute": "recipe-id"
|
|
137
|
+
},
|
|
138
|
+
"recipeName": {
|
|
139
|
+
"type": "string",
|
|
140
|
+
"mutable": false,
|
|
141
|
+
"complexType": {
|
|
142
|
+
"original": "string",
|
|
143
|
+
"resolved": "string",
|
|
144
|
+
"references": {}
|
|
145
|
+
},
|
|
146
|
+
"required": false,
|
|
147
|
+
"optional": true,
|
|
148
|
+
"docs": {
|
|
149
|
+
"tags": [],
|
|
150
|
+
"text": "Title of the planned recipe."
|
|
151
|
+
},
|
|
152
|
+
"getter": false,
|
|
153
|
+
"setter": false,
|
|
154
|
+
"reflect": false,
|
|
155
|
+
"attribute": "recipe-name"
|
|
156
|
+
},
|
|
157
|
+
"recipeImage": {
|
|
158
|
+
"type": "string",
|
|
159
|
+
"mutable": false,
|
|
160
|
+
"complexType": {
|
|
161
|
+
"original": "string",
|
|
162
|
+
"resolved": "string",
|
|
163
|
+
"references": {}
|
|
164
|
+
},
|
|
165
|
+
"required": false,
|
|
166
|
+
"optional": true,
|
|
167
|
+
"docs": {
|
|
168
|
+
"tags": [],
|
|
169
|
+
"text": "Thumbnail of the planned recipe."
|
|
170
|
+
},
|
|
171
|
+
"getter": false,
|
|
172
|
+
"setter": false,
|
|
173
|
+
"reflect": false,
|
|
174
|
+
"attribute": "recipe-image"
|
|
175
|
+
},
|
|
176
|
+
"disabled": {
|
|
177
|
+
"type": "boolean",
|
|
178
|
+
"mutable": false,
|
|
179
|
+
"complexType": {
|
|
180
|
+
"original": "boolean",
|
|
181
|
+
"resolved": "boolean",
|
|
182
|
+
"references": {}
|
|
183
|
+
},
|
|
184
|
+
"required": false,
|
|
185
|
+
"optional": false,
|
|
186
|
+
"docs": {
|
|
187
|
+
"tags": [],
|
|
188
|
+
"text": "Disables interaction."
|
|
189
|
+
},
|
|
190
|
+
"getter": false,
|
|
191
|
+
"setter": false,
|
|
192
|
+
"reflect": false,
|
|
193
|
+
"attribute": "disabled",
|
|
194
|
+
"defaultValue": "false"
|
|
195
|
+
}
|
|
196
|
+
};
|
|
197
|
+
}
|
|
198
|
+
static get states() {
|
|
199
|
+
return {
|
|
200
|
+
"dragOver": {}
|
|
201
|
+
};
|
|
202
|
+
}
|
|
203
|
+
static get events() {
|
|
204
|
+
return [{
|
|
205
|
+
"method": "rkMealAdd",
|
|
206
|
+
"name": "rkMealAdd",
|
|
207
|
+
"bubbles": true,
|
|
208
|
+
"cancelable": true,
|
|
209
|
+
"composed": true,
|
|
210
|
+
"docs": {
|
|
211
|
+
"tags": [],
|
|
212
|
+
"text": "Emitted when an empty slot is activated \u2014 the host opens a recipe picker."
|
|
213
|
+
},
|
|
214
|
+
"complexType": {
|
|
215
|
+
"original": "RkMealSlotDetail",
|
|
216
|
+
"resolved": "RkMealSlotDetail",
|
|
217
|
+
"references": {
|
|
218
|
+
"RkMealSlotDetail": {
|
|
219
|
+
"location": "local",
|
|
220
|
+
"path": "/Users/sejal.sharma/NAGP/recipe-ui/packages/recipe-ui-kit/src/components/rk-meal-slot/rk-meal-slot.tsx",
|
|
221
|
+
"id": "src/components/rk-meal-slot/rk-meal-slot.tsx::RkMealSlotDetail"
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
}, {
|
|
226
|
+
"method": "rkMealSwap",
|
|
227
|
+
"name": "rkMealSwap",
|
|
228
|
+
"bubbles": true,
|
|
229
|
+
"cancelable": true,
|
|
230
|
+
"composed": true,
|
|
231
|
+
"docs": {
|
|
232
|
+
"tags": [],
|
|
233
|
+
"text": "Emitted when the planned recipe should be replaced."
|
|
234
|
+
},
|
|
235
|
+
"complexType": {
|
|
236
|
+
"original": "RkMealRecipeDetail",
|
|
237
|
+
"resolved": "RkMealRecipeDetail",
|
|
238
|
+
"references": {
|
|
239
|
+
"RkMealRecipeDetail": {
|
|
240
|
+
"location": "local",
|
|
241
|
+
"path": "/Users/sejal.sharma/NAGP/recipe-ui/packages/recipe-ui-kit/src/components/rk-meal-slot/rk-meal-slot.tsx",
|
|
242
|
+
"id": "src/components/rk-meal-slot/rk-meal-slot.tsx::RkMealRecipeDetail"
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
}, {
|
|
247
|
+
"method": "rkMealRemove",
|
|
248
|
+
"name": "rkMealRemove",
|
|
249
|
+
"bubbles": true,
|
|
250
|
+
"cancelable": true,
|
|
251
|
+
"composed": true,
|
|
252
|
+
"docs": {
|
|
253
|
+
"tags": [],
|
|
254
|
+
"text": "Emitted when the planned recipe should be cleared."
|
|
255
|
+
},
|
|
256
|
+
"complexType": {
|
|
257
|
+
"original": "RkMealRecipeDetail",
|
|
258
|
+
"resolved": "RkMealRecipeDetail",
|
|
259
|
+
"references": {
|
|
260
|
+
"RkMealRecipeDetail": {
|
|
261
|
+
"location": "local",
|
|
262
|
+
"path": "/Users/sejal.sharma/NAGP/recipe-ui/packages/recipe-ui-kit/src/components/rk-meal-slot/rk-meal-slot.tsx",
|
|
263
|
+
"id": "src/components/rk-meal-slot/rk-meal-slot.tsx::RkMealRecipeDetail"
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
}, {
|
|
268
|
+
"method": "rkMealOpen",
|
|
269
|
+
"name": "rkMealOpen",
|
|
270
|
+
"bubbles": true,
|
|
271
|
+
"cancelable": true,
|
|
272
|
+
"composed": true,
|
|
273
|
+
"docs": {
|
|
274
|
+
"tags": [],
|
|
275
|
+
"text": "Emitted when the planned recipe is activated \u2014 the host navigates."
|
|
276
|
+
},
|
|
277
|
+
"complexType": {
|
|
278
|
+
"original": "RkMealRecipeDetail",
|
|
279
|
+
"resolved": "RkMealRecipeDetail",
|
|
280
|
+
"references": {
|
|
281
|
+
"RkMealRecipeDetail": {
|
|
282
|
+
"location": "local",
|
|
283
|
+
"path": "/Users/sejal.sharma/NAGP/recipe-ui/packages/recipe-ui-kit/src/components/rk-meal-slot/rk-meal-slot.tsx",
|
|
284
|
+
"id": "src/components/rk-meal-slot/rk-meal-slot.tsx::RkMealRecipeDetail"
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
}, {
|
|
289
|
+
"method": "rkMealDrop",
|
|
290
|
+
"name": "rkMealDrop",
|
|
291
|
+
"bubbles": true,
|
|
292
|
+
"cancelable": true,
|
|
293
|
+
"composed": true,
|
|
294
|
+
"docs": {
|
|
295
|
+
"tags": [],
|
|
296
|
+
"text": "Emitted when a recipe is dropped onto this slot."
|
|
297
|
+
},
|
|
298
|
+
"complexType": {
|
|
299
|
+
"original": "RkMealDropDetail",
|
|
300
|
+
"resolved": "RkMealDropDetail",
|
|
301
|
+
"references": {
|
|
302
|
+
"RkMealDropDetail": {
|
|
303
|
+
"location": "local",
|
|
304
|
+
"path": "/Users/sejal.sharma/NAGP/recipe-ui/packages/recipe-ui-kit/src/components/rk-meal-slot/rk-meal-slot.tsx",
|
|
305
|
+
"id": "src/components/rk-meal-slot/rk-meal-slot.tsx::RkMealDropDetail"
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
}];
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
//# sourceMappingURL=rk-meal-slot.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rk-meal-slot.js","sourceRoot":"","sources":["../../../src/components/rk-meal-slot/rk-meal-slot.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,KAAK,EAAgB,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAiB/E;;;;;;GAMG;AAMH,MAAM,OAAO,UAAU;IALvB;QAwBE,4BAA4B;QACpB,aAAQ,GAAG,KAAK,CAAC;QAiBR,aAAQ,GAAG,KAAK,CAAC;QAc1B,mBAAc,GAAG,CAAC,KAAgB,EAAE,EAAE;YAC5C,IAAI,IAAI,CAAC,QAAQ;gBAAE,OAAO;YAC1B,wEAAwE;YACxE,KAAK,CAAC,cAAc,EAAE,CAAC;YACvB,IAAI,KAAK,CAAC,YAAY;gBAAE,KAAK,CAAC,YAAY,CAAC,UAAU,GAAG,MAAM,CAAC;YAC/D,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC;QACvB,CAAC,CAAC;QAEM,eAAU,GAAG,CAAC,KAAgB,EAAE,EAAE;YACxC,KAAK,CAAC,cAAc,EAAE,CAAC;YACvB,IAAI,CAAC,QAAQ,GAAG,KAAK,CAAC;YACtB,IAAI,IAAI,CAAC,QAAQ;gBAAE,OAAO;YAC1B,MAAM,OAAO,GAAG,KAAK,CAAC,YAAY,EAAE,OAAO,CAAC,YAAY,CAAC,IAAI,EAAE,CAAC;YAChE,IAAI,OAAO;gBAAE,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE,GAAG,IAAI,CA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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, Event, EventEmitter, h, Prop, State } from '@stencil/core';\n\nexport interface RkMealSlotDetail {\n day: string;\n mealType: string;\n}\n\nexport interface RkMealRecipeDetail extends RkMealSlotDetail {\n recipeId: string;\n recipeName: string;\n}\n\nexport interface RkMealDropDetail extends RkMealSlotDetail {\n /** Raw `text/plain` payload from the drag operation. */\n payload: string;\n}\n\n/**\n * One cell of the weekly planner grid: either an empty \"add\" target or a filled\n * slot showing the planned recipe. Doubles as a drop zone for drag-and-drop\n * planning.\n *\n * @slot - Extra content rendered under the recipe name (e.g. serving notes).\n */\n@Component({\n tag: 'rk-meal-slot',\n styleUrl: 'rk-meal-slot.css',\n shadow: true,\n})\nexport class RkMealSlot {\n /** Day key this slot belongs to, e.g. `monday`. Echoed in event payloads. */\n @Prop() day!: string;\n\n /** Meal type key, e.g. `breakfast`. Echoed in event payloads. */\n @Prop() mealType!: string;\n\n /** Human-readable meal label shown as the slot caption. */\n @Prop() mealLabel?: string;\n\n /** Id of the planned recipe. Empty means the slot is free. */\n @Prop() recipeId?: string;\n\n /** Title of the planned recipe. */\n @Prop() recipeName?: string;\n\n /** Thumbnail of the planned recipe. */\n @Prop() recipeImage?: string;\n\n /** Disables interaction. */\n @Prop() disabled = false;\n\n /** Emitted when an empty slot is activated — the host opens a recipe picker. */\n @Event({ eventName: 'rkMealAdd' }) rkMealAdd!: EventEmitter<RkMealSlotDetail>;\n\n /** Emitted when the planned recipe should be replaced. */\n @Event({ eventName: 'rkMealSwap' }) rkMealSwap!: EventEmitter<RkMealRecipeDetail>;\n\n /** Emitted when the planned recipe should be cleared. */\n @Event({ eventName: 'rkMealRemove' }) rkMealRemove!: EventEmitter<RkMealRecipeDetail>;\n\n /** Emitted when the planned recipe is activated — the host navigates. */\n @Event({ eventName: 'rkMealOpen' }) rkMealOpen!: EventEmitter<RkMealRecipeDetail>;\n\n /** Emitted when a recipe is dropped onto this slot. */\n @Event({ eventName: 'rkMealDrop' }) rkMealDrop!: EventEmitter<RkMealDropDetail>;\n\n @State() private dragOver = false;\n\n private get filled() {\n return !!this.recipeId;\n }\n\n private get slotDetail(): RkMealSlotDetail {\n return { day: this.day, mealType: this.mealType };\n }\n\n private get recipeDetail(): RkMealRecipeDetail {\n return { ...this.slotDetail, recipeId: this.recipeId ?? '', recipeName: this.recipeName ?? '' };\n }\n\n private handleDragOver = (event: DragEvent) => {\n if (this.disabled) return;\n // Preventing default is what marks this element as a valid drop target.\n event.preventDefault();\n if (event.dataTransfer) event.dataTransfer.dropEffect = 'copy';\n this.dragOver = true;\n };\n\n private handleDrop = (event: DragEvent) => {\n event.preventDefault();\n this.dragOver = false;\n if (this.disabled) return;\n const payload = event.dataTransfer?.getData('text/plain') ?? '';\n if (payload) this.rkMealDrop.emit({ ...this.slotDetail, payload });\n };\n\n render() {\n if (!this.filled) {\n return (\n <button\n class={{ slot: true, 'is-empty': true, 'is-drag-over': this.dragOver }}\n part=\"slot\"\n type=\"button\"\n disabled={this.disabled}\n aria-label={`Add a recipe for ${this.mealLabel ?? this.mealType} on ${this.day}`}\n onClick={() => this.rkMealAdd.emit(this.slotDetail)}\n onDragOver={this.handleDragOver}\n onDragLeave={() => (this.dragOver = false)}\n onDrop={this.handleDrop}\n >\n <span class=\"plus\" aria-hidden=\"true\">\n +\n </span>\n <span class=\"empty-label\">{this.mealLabel ?? this.mealType}</span>\n </button>\n );\n }\n\n return (\n <div\n class={{ slot: true, 'is-filled': true, 'is-drag-over': this.dragOver }}\n part=\"slot\"\n onDragOver={this.handleDragOver}\n onDragLeave={() => (this.dragOver = false)}\n onDrop={this.handleDrop}\n >\n {this.mealLabel && (\n <span class=\"caption\" part=\"caption\">\n {this.mealLabel}\n </span>\n )}\n\n <button\n class=\"main\"\n part=\"main\"\n type=\"button\"\n disabled={this.disabled}\n title={this.recipeName}\n onClick={() => this.rkMealOpen.emit(this.recipeDetail)}\n >\n {this.recipeImage ? (\n <img class=\"thumb\" src={this.recipeImage} alt=\"\" loading=\"lazy\" decoding=\"async\" />\n ) : (\n <span class=\"thumb thumb-fallback\" aria-hidden=\"true\">\n 🍽️\n </span>\n )}\n <span class=\"name\" part=\"name\">\n {this.recipeName}\n </span>\n </button>\n\n <div class=\"extra\">\n <slot />\n </div>\n\n <div class=\"controls\" part=\"controls\">\n <button class=\"ctrl\" type=\"button\" disabled={this.disabled} aria-label={`Replace ${this.recipeName}`} title=\"Replace\" onClick={() => this.rkMealSwap.emit(this.recipeDetail)}>\n <svg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\">\n <path d=\"M3 12a9 9 0 0 1 15.3-6.4L21 8\" />\n <path d=\"M21 3v5h-5\" />\n <path d=\"M21 12a9 9 0 0 1-15.3 6.4L3 16\" />\n <path d=\"M3 21v-5h5\" />\n </svg>\n </button>\n <button\n class=\"ctrl is-danger\"\n type=\"button\"\n disabled={this.disabled}\n aria-label={`Remove ${this.recipeName} from ${this.mealLabel ?? this.mealType}`}\n title=\"Remove\"\n onClick={() => this.rkMealRemove.emit(this.recipeDetail)}\n >\n <svg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" aria-hidden=\"true\">\n <path d=\"M6 6l12 12M18 6 6 18\" />\n </svg>\n </button>\n </div>\n </div>\n );\n }\n}\n"]}
|