@ssj4kyuubi/recipe-ui-lib 0.1.4
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 +128 -0
- package/dist/cjs/index-CJNMpFY7.js +1609 -0
- package/dist/cjs/index.cjs.js +2 -0
- package/dist/cjs/loader.cjs.js +12 -0
- package/dist/cjs/rui-button.cjs.entry.js +31 -0
- package/dist/cjs/rui-filter-chips.cjs.entry.js +30 -0
- package/dist/cjs/rui-meal-planner.cjs.entry.js +52 -0
- package/dist/cjs/rui-modal.cjs.entry.js +52 -0
- package/dist/cjs/rui-recipe-card.cjs.entry.js +29 -0
- package/dist/cjs/rui-recipe-detail.cjs.entry.js +34 -0
- package/dist/cjs/rui-recipe-list.cjs.entry.js +44 -0
- package/dist/cjs/rui-search-bar.cjs.entry.js +39 -0
- package/dist/cjs/rui.cjs.js +24 -0
- package/dist/collection/collection-manifest.json +20 -0
- package/dist/collection/components/index.js +8 -0
- package/dist/collection/components/rui-button/rui-button.css +72 -0
- package/dist/collection/components/rui-button/rui-button.js +140 -0
- package/dist/collection/components/rui-filter-chips/rui-filter-chips.css +30 -0
- package/dist/collection/components/rui-filter-chips/rui-filter-chips.js +96 -0
- package/dist/collection/components/rui-meal-planner/rui-meal-planner.css +130 -0
- package/dist/collection/components/rui-meal-planner/rui-meal-planner.js +174 -0
- package/dist/collection/components/rui-modal/rui-modal.css +79 -0
- package/dist/collection/components/rui-modal/rui-modal.js +137 -0
- package/dist/collection/components/rui-recipe-card/rui-recipe-card.css +100 -0
- package/dist/collection/components/rui-recipe-card/rui-recipe-card.js +122 -0
- package/dist/collection/components/rui-recipe-detail/rui-recipe-detail.css +197 -0
- package/dist/collection/components/rui-recipe-detail/rui-recipe-detail.js +127 -0
- package/dist/collection/components/rui-recipe-list/rui-recipe-list.css +16 -0
- package/dist/collection/components/rui-recipe-list/rui-recipe-list.js +160 -0
- package/dist/collection/components/rui-search-bar/rui-search-bar.css +45 -0
- package/dist/collection/components/rui-search-bar/rui-search-bar.js +137 -0
- package/dist/collection/index.js +1 -0
- package/dist/components/index.d.ts +35 -0
- package/dist/components/index.js +1 -0
- package/dist/components/rui-button.d.ts +11 -0
- package/dist/components/rui-button.js +1 -0
- package/dist/components/rui-filter-chips.d.ts +11 -0
- package/dist/components/rui-filter-chips.js +1 -0
- package/dist/components/rui-meal-planner.d.ts +11 -0
- package/dist/components/rui-meal-planner.js +1 -0
- package/dist/components/rui-modal.d.ts +11 -0
- package/dist/components/rui-modal.js +1 -0
- package/dist/components/rui-recipe-card.d.ts +11 -0
- package/dist/components/rui-recipe-card.js +1 -0
- package/dist/components/rui-recipe-card2.js +1 -0
- package/dist/components/rui-recipe-detail.d.ts +11 -0
- package/dist/components/rui-recipe-detail.js +1 -0
- package/dist/components/rui-recipe-list.d.ts +11 -0
- package/dist/components/rui-recipe-list.js +1 -0
- package/dist/components/rui-search-bar.d.ts +11 -0
- package/dist/components/rui-search-bar.js +1 -0
- package/dist/esm/index-Cye74XUb.js +1599 -0
- package/dist/esm/index.js +1 -0
- package/dist/esm/loader.js +10 -0
- package/dist/esm/polyfills/core-js.js +11 -0
- package/dist/esm/polyfills/dom.js +79 -0
- package/dist/esm/polyfills/es5-html-element.js +1 -0
- package/dist/esm/polyfills/index.js +34 -0
- package/dist/esm/polyfills/system.js +6 -0
- package/dist/esm/rui-button.entry.js +29 -0
- package/dist/esm/rui-filter-chips.entry.js +28 -0
- package/dist/esm/rui-meal-planner.entry.js +50 -0
- package/dist/esm/rui-modal.entry.js +50 -0
- package/dist/esm/rui-recipe-card.entry.js +27 -0
- package/dist/esm/rui-recipe-detail.entry.js +32 -0
- package/dist/esm/rui-recipe-list.entry.js +42 -0
- package/dist/esm/rui-search-bar.entry.js +37 -0
- package/dist/esm/rui.js +20 -0
- package/dist/esm-es5/index-Cye74XUb.js +64 -0
- package/dist/esm-es5/index.js +0 -0
- package/dist/esm-es5/loader.js +1 -0
- package/dist/esm-es5/rui-button.entry.js +1 -0
- package/dist/esm-es5/rui-filter-chips.entry.js +1 -0
- package/dist/esm-es5/rui-meal-planner.entry.js +1 -0
- package/dist/esm-es5/rui-modal.entry.js +1 -0
- package/dist/esm-es5/rui-recipe-card.entry.js +1 -0
- package/dist/esm-es5/rui-recipe-detail.entry.js +1 -0
- package/dist/esm-es5/rui-recipe-list.entry.js +1 -0
- package/dist/esm-es5/rui-search-bar.entry.js +1 -0
- package/dist/esm-es5/rui.js +4 -0
- package/dist/index.cjs.js +1 -0
- package/dist/index.js +1 -0
- package/dist/rui/index.esm.js +0 -0
- package/dist/rui/p-044c45e5.entry.js +1 -0
- package/dist/rui/p-0eda7928.system.entry.js +1 -0
- package/dist/rui/p-1a89ad3e.system.entry.js +1 -0
- package/dist/rui/p-1b310317.system.entry.js +1 -0
- package/dist/rui/p-2fc25e59.system.entry.js +1 -0
- package/dist/rui/p-40bf8db2.entry.js +1 -0
- package/dist/rui/p-72d787e7.system.entry.js +1 -0
- package/dist/rui/p-89d06840.system.entry.js +1 -0
- package/dist/rui/p-9e0ffa92.entry.js +1 -0
- package/dist/rui/p-Chuy7yuu.system.js +5 -0
- package/dist/rui/p-Cye74XUb.js +3 -0
- package/dist/rui/p-DMa34l4T.system.js +64 -0
- package/dist/rui/p-YWpyar7R.system.js +1 -0
- package/dist/rui/p-a25c8161.entry.js +1 -0
- package/dist/rui/p-ad0253ac.entry.js +1 -0
- package/dist/rui/p-b5196c19.system.entry.js +1 -0
- package/dist/rui/p-b5d6b297.system.entry.js +1 -0
- package/dist/rui/p-d04fa46b.entry.js +1 -0
- package/dist/rui/p-d34e0888.entry.js +1 -0
- package/dist/rui/p-eac80bd7.entry.js +1 -0
- package/dist/rui/rui.css +1 -0
- package/dist/rui/rui.esm.js +1 -0
- package/dist/rui/rui.js +127 -0
- package/dist/types/components/index.d.ts +8 -0
- package/dist/types/components/rui-button/rui-button.d.ts +11 -0
- package/dist/types/components/rui-filter-chips/rui-filter-chips.d.ts +12 -0
- package/dist/types/components/rui-meal-planner/rui-meal-planner.d.ts +29 -0
- package/dist/types/components/rui-modal/rui-modal.d.ts +13 -0
- package/dist/types/components/rui-recipe-card/rui-recipe-card.d.ts +20 -0
- package/dist/types/components/rui-recipe-detail/rui-recipe-detail.d.ts +28 -0
- package/dist/types/components/rui-recipe-list/rui-recipe-list.d.ts +16 -0
- package/dist/types/components/rui-search-bar/rui-search-bar.d.ts +14 -0
- package/dist/types/components.d.ts +654 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/stencil-public-runtime.d.ts +1873 -0
- package/loader/cdn.js +2 -0
- package/loader/index.cjs.js +2 -0
- package/loader/index.d.ts +24 -0
- package/loader/index.es2017.js +2 -0
- package/loader/index.js +3 -0
- package/package.json +58 -0
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
:host {
|
|
2
|
+
display: block;
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
.rui-card {
|
|
6
|
+
background: var(--rui-color-bg);
|
|
7
|
+
border: 1px solid var(--rui-color-border);
|
|
8
|
+
border-radius: var(--rui-radius);
|
|
9
|
+
overflow: hidden;
|
|
10
|
+
box-shadow: var(--rui-shadow-sm);
|
|
11
|
+
cursor: pointer;
|
|
12
|
+
transition: transform 0.15s ease, box-shadow 0.15s ease;
|
|
13
|
+
display: flex;
|
|
14
|
+
flex-direction: column;
|
|
15
|
+
height: 100%;
|
|
16
|
+
}
|
|
17
|
+
.rui-card:hover {
|
|
18
|
+
transform: translateY(-2px);
|
|
19
|
+
box-shadow: var(--rui-shadow-md);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.rui-card__media {
|
|
23
|
+
position: relative;
|
|
24
|
+
aspect-ratio: 16 / 10;
|
|
25
|
+
background: var(--rui-color-bg-alt);
|
|
26
|
+
overflow: hidden;
|
|
27
|
+
}
|
|
28
|
+
.rui-card__media img {
|
|
29
|
+
width: 100%;
|
|
30
|
+
height: 100%;
|
|
31
|
+
object-fit: cover;
|
|
32
|
+
display: block;
|
|
33
|
+
}
|
|
34
|
+
.rui-card__placeholder {
|
|
35
|
+
width: 100%;
|
|
36
|
+
height: 100%;
|
|
37
|
+
display: flex;
|
|
38
|
+
align-items: center;
|
|
39
|
+
justify-content: center;
|
|
40
|
+
color: var(--rui-color-muted);
|
|
41
|
+
font-size: 0.85rem;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
.rui-card__fav {
|
|
45
|
+
position: absolute;
|
|
46
|
+
top: 0.5rem;
|
|
47
|
+
right: 0.5rem;
|
|
48
|
+
width: 2rem;
|
|
49
|
+
height: 2rem;
|
|
50
|
+
border-radius: 50%;
|
|
51
|
+
border: none;
|
|
52
|
+
background: rgba(255, 255, 255, 0.9);
|
|
53
|
+
color: var(--rui-color-danger);
|
|
54
|
+
font-size: 1.1rem;
|
|
55
|
+
line-height: 1;
|
|
56
|
+
cursor: pointer;
|
|
57
|
+
display: flex;
|
|
58
|
+
align-items: center;
|
|
59
|
+
justify-content: center;
|
|
60
|
+
transition: background-color 0.15s ease, transform 0.1s ease;
|
|
61
|
+
}
|
|
62
|
+
.rui-card__fav:hover {
|
|
63
|
+
background: #fff;
|
|
64
|
+
transform: scale(1.08);
|
|
65
|
+
}
|
|
66
|
+
.rui-card__fav.is-fav {
|
|
67
|
+
color: var(--rui-color-danger);
|
|
68
|
+
background: #fff;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
.rui-card__body {
|
|
72
|
+
padding: 0.85rem 1rem;
|
|
73
|
+
flex: 1;
|
|
74
|
+
}
|
|
75
|
+
.rui-card__title {
|
|
76
|
+
margin: 0 0 0.25rem;
|
|
77
|
+
font-size: 1rem;
|
|
78
|
+
font-weight: 600;
|
|
79
|
+
line-height: 1.3;
|
|
80
|
+
/* clamp to 2 lines */
|
|
81
|
+
display: -webkit-box;
|
|
82
|
+
-webkit-line-clamp: 2;
|
|
83
|
+
-webkit-box-orient: vertical;
|
|
84
|
+
overflow: hidden;
|
|
85
|
+
}
|
|
86
|
+
.rui-card__meta {
|
|
87
|
+
margin: 0;
|
|
88
|
+
font-size: 0.8rem;
|
|
89
|
+
color: var(--rui-color-muted);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
.rui-card__footer {
|
|
93
|
+
padding: 0 1rem 0.85rem;
|
|
94
|
+
display: flex;
|
|
95
|
+
gap: 0.5rem;
|
|
96
|
+
flex-wrap: wrap;
|
|
97
|
+
}
|
|
98
|
+
.rui-card__footer:empty {
|
|
99
|
+
display: none;
|
|
100
|
+
}
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import { h, Host } from "@stencil/core";
|
|
2
|
+
export class RuiRecipeCard {
|
|
3
|
+
constructor() {
|
|
4
|
+
this.isFavorite = false;
|
|
5
|
+
this.onCardClick = () => {
|
|
6
|
+
this.ruiCardClick.emit(this.recipe);
|
|
7
|
+
};
|
|
8
|
+
this.onFavClick = (e) => {
|
|
9
|
+
e.stopPropagation();
|
|
10
|
+
this.isFavorite = !this.isFavorite;
|
|
11
|
+
this.ruiFavoriteToggle.emit({ recipe: this.recipe, isFavorite: this.isFavorite });
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
render() {
|
|
15
|
+
const r = this.recipe;
|
|
16
|
+
return (h(Host, { key: '8ba2647d2fed8b0539287633a5591892109596fb' }, h("article", { key: '8a58a35d34d08d0897bc7c68b82773bd361e2dcf', class: "rui-card", onClick: this.onCardClick }, h("div", { key: '04b5aa4b9563847aa116bbf477fabd806092f90a', class: "rui-card__media" }, r.image ? (h("img", { src: r.image, alt: r.name, loading: "lazy" })) : (h("div", { class: "rui-card__placeholder", "aria-hidden": "true" }, h("span", null, "No image"))), h("button", { key: 'ea6b5fe33ab2587f28491b75db84e87e3b1d193f', type: "button", class: `rui-card__fav ${this.isFavorite ? 'is-fav' : ''}`, "aria-pressed": this.isFavorite ? 'true' : 'false', "aria-label": this.isFavorite ? 'Remove from favorites' : 'Add to favorites', onClick: this.onFavClick }, this.isFavorite ? '\u2665' : '\u2661')), h("div", { key: '2bd65d44934ee52a98cc2be459b770a8fe18dd0f', class: "rui-card__body" }, h("h3", { key: '55bd4f5faf4ed06696c6ed22f828d811afa605a5', class: "rui-card__title" }, r.name), (r.category || r.area) && (h("p", { key: '5184ee876bdfb90cdef9bc7f529be504ed18bf45', class: "rui-card__meta" }, [r.category, r.area].filter(Boolean).join(' \u00b7 ')))), h("div", { key: '5e3fc6c1cc4559bd6260ebf99039908f2e9c82e2', class: "rui-card__footer" }, h("slot", { key: '2567811b6ca78e06df4e2c51714dc1210fa65f00' })))));
|
|
17
|
+
}
|
|
18
|
+
static get is() { return "rui-recipe-card"; }
|
|
19
|
+
static get encapsulation() { return "shadow"; }
|
|
20
|
+
static get originalStyleUrls() {
|
|
21
|
+
return {
|
|
22
|
+
"$": ["rui-recipe-card.css"]
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
static get styleUrls() {
|
|
26
|
+
return {
|
|
27
|
+
"$": ["rui-recipe-card.css"]
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
static get properties() {
|
|
31
|
+
return {
|
|
32
|
+
"recipe": {
|
|
33
|
+
"type": "unknown",
|
|
34
|
+
"mutable": false,
|
|
35
|
+
"complexType": {
|
|
36
|
+
"original": "RecipeSummary",
|
|
37
|
+
"resolved": "RecipeSummary",
|
|
38
|
+
"references": {
|
|
39
|
+
"RecipeSummary": {
|
|
40
|
+
"location": "local",
|
|
41
|
+
"path": "F:/Projects/RecipeFinder/recipe-ui-lib/src/components/rui-recipe-card/rui-recipe-card.tsx",
|
|
42
|
+
"id": "src/components/rui-recipe-card/rui-recipe-card.tsx::RecipeSummary"
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
"required": true,
|
|
47
|
+
"optional": false,
|
|
48
|
+
"docs": {
|
|
49
|
+
"tags": [],
|
|
50
|
+
"text": "Recipe summary object."
|
|
51
|
+
},
|
|
52
|
+
"getter": false,
|
|
53
|
+
"setter": false
|
|
54
|
+
},
|
|
55
|
+
"isFavorite": {
|
|
56
|
+
"type": "boolean",
|
|
57
|
+
"mutable": false,
|
|
58
|
+
"complexType": {
|
|
59
|
+
"original": "boolean",
|
|
60
|
+
"resolved": "boolean",
|
|
61
|
+
"references": {}
|
|
62
|
+
},
|
|
63
|
+
"required": false,
|
|
64
|
+
"optional": false,
|
|
65
|
+
"docs": {
|
|
66
|
+
"tags": [],
|
|
67
|
+
"text": "Whether this recipe is favorited."
|
|
68
|
+
},
|
|
69
|
+
"getter": false,
|
|
70
|
+
"setter": false,
|
|
71
|
+
"reflect": true,
|
|
72
|
+
"attribute": "is-favorite",
|
|
73
|
+
"defaultValue": "false"
|
|
74
|
+
}
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
static get events() {
|
|
78
|
+
return [{
|
|
79
|
+
"method": "ruiCardClick",
|
|
80
|
+
"name": "ruiCardClick",
|
|
81
|
+
"bubbles": true,
|
|
82
|
+
"cancelable": true,
|
|
83
|
+
"composed": true,
|
|
84
|
+
"docs": {
|
|
85
|
+
"tags": [],
|
|
86
|
+
"text": "Emitted when the card body is clicked. detail: RecipeSummary."
|
|
87
|
+
},
|
|
88
|
+
"complexType": {
|
|
89
|
+
"original": "RecipeSummary",
|
|
90
|
+
"resolved": "RecipeSummary",
|
|
91
|
+
"references": {
|
|
92
|
+
"RecipeSummary": {
|
|
93
|
+
"location": "local",
|
|
94
|
+
"path": "F:/Projects/RecipeFinder/recipe-ui-lib/src/components/rui-recipe-card/rui-recipe-card.tsx",
|
|
95
|
+
"id": "src/components/rui-recipe-card/rui-recipe-card.tsx::RecipeSummary"
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
}, {
|
|
100
|
+
"method": "ruiFavoriteToggle",
|
|
101
|
+
"name": "ruiFavoriteToggle",
|
|
102
|
+
"bubbles": true,
|
|
103
|
+
"cancelable": true,
|
|
104
|
+
"composed": true,
|
|
105
|
+
"docs": {
|
|
106
|
+
"tags": [],
|
|
107
|
+
"text": "Emitted when the favorite heart is toggled. detail: { recipe, isFavorite }."
|
|
108
|
+
},
|
|
109
|
+
"complexType": {
|
|
110
|
+
"original": "{ recipe: RecipeSummary; isFavorite: boolean }",
|
|
111
|
+
"resolved": "{ recipe: RecipeSummary; isFavorite: boolean; }",
|
|
112
|
+
"references": {
|
|
113
|
+
"RecipeSummary": {
|
|
114
|
+
"location": "local",
|
|
115
|
+
"path": "F:/Projects/RecipeFinder/recipe-ui-lib/src/components/rui-recipe-card/rui-recipe-card.tsx",
|
|
116
|
+
"id": "src/components/rui-recipe-card/rui-recipe-card.tsx::RecipeSummary"
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
}];
|
|
121
|
+
}
|
|
122
|
+
}
|
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
:host {
|
|
2
|
+
display: block;
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
.rui-detail {
|
|
6
|
+
background: var(--rui-color-bg);
|
|
7
|
+
border-radius: var(--rui-radius);
|
|
8
|
+
box-shadow: var(--rui-shadow-sm);
|
|
9
|
+
overflow: hidden;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
.rui-detail__header {
|
|
13
|
+
display: grid;
|
|
14
|
+
grid-template-columns: 320px 1fr;
|
|
15
|
+
gap: 1.5rem;
|
|
16
|
+
padding: 1.5rem;
|
|
17
|
+
}
|
|
18
|
+
@media (max-width: 640px) {
|
|
19
|
+
.rui-detail__header {
|
|
20
|
+
grid-template-columns: 1fr;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
.rui-detail__media {
|
|
25
|
+
aspect-ratio: 4 / 3;
|
|
26
|
+
background: var(--rui-color-bg-alt);
|
|
27
|
+
border-radius: var(--rui-radius);
|
|
28
|
+
overflow: hidden;
|
|
29
|
+
}
|
|
30
|
+
.rui-detail__media img {
|
|
31
|
+
width: 100%;
|
|
32
|
+
height: 100%;
|
|
33
|
+
object-fit: cover;
|
|
34
|
+
display: block;
|
|
35
|
+
}
|
|
36
|
+
.rui-detail__placeholder {
|
|
37
|
+
width: 100%;
|
|
38
|
+
height: 100%;
|
|
39
|
+
display: flex;
|
|
40
|
+
align-items: center;
|
|
41
|
+
justify-content: center;
|
|
42
|
+
color: var(--rui-color-muted);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
.rui-detail__title {
|
|
46
|
+
margin: 0 0 0.35rem;
|
|
47
|
+
font-size: 1.6rem;
|
|
48
|
+
font-weight: 700;
|
|
49
|
+
}
|
|
50
|
+
.rui-detail__meta {
|
|
51
|
+
margin: 0 0 1rem;
|
|
52
|
+
color: var(--rui-color-muted);
|
|
53
|
+
font-size: 0.95rem;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
.rui-detail__actions {
|
|
57
|
+
display: flex;
|
|
58
|
+
flex-wrap: wrap;
|
|
59
|
+
gap: 0.6rem;
|
|
60
|
+
align-items: center;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
.rui-detail__fav,
|
|
64
|
+
.rui-detail__plan {
|
|
65
|
+
font-family: var(--rui-font);
|
|
66
|
+
font-size: 0.9rem;
|
|
67
|
+
font-weight: 600;
|
|
68
|
+
padding: 0.5rem 0.9rem;
|
|
69
|
+
border-radius: var(--rui-radius);
|
|
70
|
+
border: 1px solid var(--rui-color-border);
|
|
71
|
+
background: var(--rui-color-bg);
|
|
72
|
+
cursor: pointer;
|
|
73
|
+
transition: background-color 0.15s ease, border-color 0.15s ease;
|
|
74
|
+
}
|
|
75
|
+
.rui-detail__fav:hover,
|
|
76
|
+
.rui-detail__plan:hover {
|
|
77
|
+
border-color: var(--rui-color-primary);
|
|
78
|
+
background: var(--rui-color-primary-soft);
|
|
79
|
+
}
|
|
80
|
+
.rui-detail__fav.is-fav {
|
|
81
|
+
color: var(--rui-color-danger);
|
|
82
|
+
border-color: var(--rui-color-danger);
|
|
83
|
+
background: #fff5f5;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
.rui-detail__section {
|
|
87
|
+
padding: 0 1.5rem 1.5rem;
|
|
88
|
+
}
|
|
89
|
+
.rui-detail__section h3 {
|
|
90
|
+
margin: 0 0 0.75rem;
|
|
91
|
+
font-size: 1.15rem;
|
|
92
|
+
font-weight: 700;
|
|
93
|
+
border-bottom: 2px solid var(--rui-color-primary-soft);
|
|
94
|
+
padding-bottom: 0.35rem;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
.rui-detail__tables {
|
|
98
|
+
display: grid;
|
|
99
|
+
grid-template-columns: 1fr 1fr;
|
|
100
|
+
gap: 1rem;
|
|
101
|
+
align-items: start;
|
|
102
|
+
}
|
|
103
|
+
@media (max-width: 700px) {
|
|
104
|
+
.rui-detail__tables {
|
|
105
|
+
grid-template-columns: 1fr;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
.rui-detail__table {
|
|
110
|
+
width: 100%;
|
|
111
|
+
border-collapse: collapse;
|
|
112
|
+
font-size: 0.9rem;
|
|
113
|
+
background: var(--rui-color-bg, #ffffff);
|
|
114
|
+
border: 1px solid var(--rui-color-border, #dee2e6);
|
|
115
|
+
border-radius: var(--rui-radius, 8px);
|
|
116
|
+
overflow: hidden;
|
|
117
|
+
}
|
|
118
|
+
.rui-detail__table thead {
|
|
119
|
+
background: var(--rui-color-bg-alt, #f8f9fa);
|
|
120
|
+
}
|
|
121
|
+
.rui-detail__table th {
|
|
122
|
+
text-align: left;
|
|
123
|
+
padding: 0.6rem 0.75rem;
|
|
124
|
+
font-weight: 700;
|
|
125
|
+
font-size: 0.82rem;
|
|
126
|
+
text-transform: uppercase;
|
|
127
|
+
letter-spacing: 0.03em;
|
|
128
|
+
color: var(--rui-color-muted, #868e96);
|
|
129
|
+
border-bottom: 2px solid var(--rui-color-border, #dee2e6);
|
|
130
|
+
}
|
|
131
|
+
.rui-detail__table td {
|
|
132
|
+
padding: 0.55rem 0.75rem;
|
|
133
|
+
border-bottom: 1px solid var(--rui-color-border, #dee2e6);
|
|
134
|
+
vertical-align: middle;
|
|
135
|
+
}
|
|
136
|
+
.rui-detail__table tbody tr:last-child td {
|
|
137
|
+
border-bottom: none;
|
|
138
|
+
}
|
|
139
|
+
.rui-detail__table tbody tr:hover {
|
|
140
|
+
background: var(--rui-color-primary-soft, #dcfce7);
|
|
141
|
+
}
|
|
142
|
+
.rui-detail__td--index {
|
|
143
|
+
width: 36px;
|
|
144
|
+
text-align: center;
|
|
145
|
+
color: var(--rui-color-muted, #868e96);
|
|
146
|
+
font-weight: 600;
|
|
147
|
+
}
|
|
148
|
+
.rui-detail__ing-measure {
|
|
149
|
+
color: var(--rui-color-muted, #868e96);
|
|
150
|
+
white-space: nowrap;
|
|
151
|
+
}
|
|
152
|
+
.rui-detail__ing-name {
|
|
153
|
+
font-weight: 500;
|
|
154
|
+
color: var(--rui-color-text, #212529);
|
|
155
|
+
}
|
|
156
|
+
.rui-detail__empty {
|
|
157
|
+
color: var(--rui-color-muted, #868e96);
|
|
158
|
+
font-size: 0.9rem;
|
|
159
|
+
margin: 0.5rem 0 0;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
/* keep old list styles for fallback if needed */
|
|
163
|
+
.rui-detail__ingredients {
|
|
164
|
+
list-style: none;
|
|
165
|
+
margin: 0;
|
|
166
|
+
padding: 0;
|
|
167
|
+
display: grid;
|
|
168
|
+
grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
|
|
169
|
+
gap: 0.4rem 1rem;
|
|
170
|
+
}
|
|
171
|
+
.rui-detail__ingredients li {
|
|
172
|
+
display: flex;
|
|
173
|
+
gap: 0.5rem;
|
|
174
|
+
font-size: 0.9rem;
|
|
175
|
+
padding: 0.3rem 0;
|
|
176
|
+
border-bottom: 1px dashed var(--rui-color-border, #dee2e6);
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
.rui-detail__instructions {
|
|
180
|
+
white-space: pre-line;
|
|
181
|
+
line-height: 1.6;
|
|
182
|
+
font-size: 0.95rem;
|
|
183
|
+
margin: 0;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
.rui-detail__links {
|
|
187
|
+
display: flex;
|
|
188
|
+
gap: 1rem;
|
|
189
|
+
}
|
|
190
|
+
.rui-detail__links a {
|
|
191
|
+
color: var(--rui-color-secondary);
|
|
192
|
+
text-decoration: none;
|
|
193
|
+
font-weight: 500;
|
|
194
|
+
}
|
|
195
|
+
.rui-detail__links a:hover {
|
|
196
|
+
text-decoration: underline;
|
|
197
|
+
}
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import { h, Host } from "@stencil/core";
|
|
2
|
+
export class RuiRecipeDetail {
|
|
3
|
+
constructor() {
|
|
4
|
+
this.isFavorite = false;
|
|
5
|
+
this.onAddToPlan = () => {
|
|
6
|
+
this.ruiAddToPlan.emit(this.recipe);
|
|
7
|
+
};
|
|
8
|
+
this.onFavToggle = () => {
|
|
9
|
+
this.isFavorite = !this.isFavorite;
|
|
10
|
+
this.ruiFavoriteToggle.emit({ recipe: this.recipe, isFavorite: this.isFavorite });
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
render() {
|
|
14
|
+
const r = this.recipe;
|
|
15
|
+
return (h(Host, { key: '3cbe3361e6d88381fbec4fd8d282963933878de4' }, h("article", { key: 'ef3860f9752829fae37d374684f5b6e5045299e5', class: "rui-detail" }, h("header", { key: 'a14c496c15e23458956538926449bcecb742fd4c', class: "rui-detail__header" }, h("div", { key: 'e6766cf5e4d766fcd2b47a946122b0b108de6a73', class: "rui-detail__media" }, r.image ? (h("img", { src: r.image, alt: r.name })) : (h("div", { class: "rui-detail__placeholder" }, "No image"))), h("div", { key: '3c0ccb26f0379d9ddd9cd29a05d237a9d377d516', class: "rui-detail__intro" }, h("h2", { key: '108020c974704efc52907eb1f945ee3a7584436f', class: "rui-detail__title" }, r.name), (r.category || r.area) && (h("p", { key: 'fc381751090c3c067076967347db95907e048898', class: "rui-detail__meta" }, [r.category, r.area].filter(Boolean).join(' \u00b7 '))), h("div", { key: 'a0084338478d82d0e7c4f738ff7650646805efe9', class: "rui-detail__actions" }, h("slot", { key: 'ba5ac7fba83204b9c7512837313238771d68a59c', name: "actions" }), h("button", { key: '1b2a17d3d7571e5d484a9a26bb13b69a9ec8d56a', type: "button", class: `rui-detail__fav ${this.isFavorite ? 'is-fav' : ''}`, "aria-pressed": this.isFavorite ? 'true' : 'false', onClick: this.onFavToggle }, this.isFavorite ? '\u2665 Favorited' : '\u2661 Add to favorites'), h("button", { key: '1f9e6eec95cf99ef6bad7197d488e4623d9c0381', type: "button", class: "rui-detail__plan", onClick: this.onAddToPlan }, "+ Add to meal plan")))), h("section", { key: '8fa48000e6baaf8f22431b413d964c79ce2f9441', class: "rui-detail__section" }, h("h3", { key: '44e655db0ee49e4a1f9f2e31a82a23c3c549060a' }, "Ingredients"), r.ingredients && r.ingredients.length > 0 ? ((() => {
|
|
16
|
+
const mid = Math.ceil(r.ingredients.length / 2);
|
|
17
|
+
const left = r.ingredients.slice(0, mid);
|
|
18
|
+
const right = r.ingredients.slice(mid);
|
|
19
|
+
const renderTable = (rows, offset) => (h("table", { class: "rui-detail__table" }, h("thead", null, h("tr", null, h("th", null, "#"), h("th", null, "Ingredient"), h("th", null, "Measure"))), h("tbody", null, rows.map((ing, idx) => (h("tr", null, h("td", { class: "rui-detail__td--index" }, offset + idx + 1), h("td", { class: "rui-detail__ing-name" }, ing.name), h("td", { class: "rui-detail__ing-measure" }, ing.measure || '—')))))));
|
|
20
|
+
return (h("div", { class: "rui-detail__tables" }, renderTable(left, 0), right.length > 0 && renderTable(right, mid)));
|
|
21
|
+
})()) : (h("p", { class: "rui-detail__empty" }, "No ingredients listed.")), h("slot", { key: '58d20bb01497af2651f492d9e6520a587d3e21ce', name: "ingredients-extra" })), r.instructions && (h("section", { key: '54176a29fab9b1142b30994d0ae74acd2e881e69', class: "rui-detail__section" }, h("h3", { key: '0f0900c1f6abb29cf8601d5d3e6fc44abc344105' }, "Instructions"), h("p", { key: 'e4f4e185a193ac818bc21e3974c957716a1b8fd6', class: "rui-detail__instructions" }, r.instructions))), (r.youtube || r.source) && (h("section", { key: 'f8db0b0a526a6e774e83d700325471dbc032170e', class: "rui-detail__section rui-detail__links" }, r.youtube && (h("a", { key: 'add83e9353e6294219dfb9304c98a49833913200', href: r.youtube, target: "_blank", rel: "noopener noreferrer" }, "Watch on YouTube")), r.source && (h("a", { key: 'b719435a049b54a4b5ec1500ea9a19da9c10f98d', href: r.source, target: "_blank", rel: "noopener noreferrer" }, "Original source")))))));
|
|
22
|
+
}
|
|
23
|
+
static get is() { return "rui-recipe-detail"; }
|
|
24
|
+
static get encapsulation() { return "shadow"; }
|
|
25
|
+
static get originalStyleUrls() {
|
|
26
|
+
return {
|
|
27
|
+
"$": ["rui-recipe-detail.css"]
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
static get styleUrls() {
|
|
31
|
+
return {
|
|
32
|
+
"$": ["rui-recipe-detail.css"]
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
static get properties() {
|
|
36
|
+
return {
|
|
37
|
+
"recipe": {
|
|
38
|
+
"type": "unknown",
|
|
39
|
+
"mutable": false,
|
|
40
|
+
"complexType": {
|
|
41
|
+
"original": "RecipeFull",
|
|
42
|
+
"resolved": "RecipeFull",
|
|
43
|
+
"references": {
|
|
44
|
+
"RecipeFull": {
|
|
45
|
+
"location": "local",
|
|
46
|
+
"path": "F:/Projects/RecipeFinder/recipe-ui-lib/src/components/rui-recipe-detail/rui-recipe-detail.tsx",
|
|
47
|
+
"id": "src/components/rui-recipe-detail/rui-recipe-detail.tsx::RecipeFull"
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
},
|
|
51
|
+
"required": true,
|
|
52
|
+
"optional": false,
|
|
53
|
+
"docs": {
|
|
54
|
+
"tags": [],
|
|
55
|
+
"text": "Full recipe object."
|
|
56
|
+
},
|
|
57
|
+
"getter": false,
|
|
58
|
+
"setter": false
|
|
59
|
+
},
|
|
60
|
+
"isFavorite": {
|
|
61
|
+
"type": "boolean",
|
|
62
|
+
"mutable": false,
|
|
63
|
+
"complexType": {
|
|
64
|
+
"original": "boolean",
|
|
65
|
+
"resolved": "boolean",
|
|
66
|
+
"references": {}
|
|
67
|
+
},
|
|
68
|
+
"required": false,
|
|
69
|
+
"optional": false,
|
|
70
|
+
"docs": {
|
|
71
|
+
"tags": [],
|
|
72
|
+
"text": "Whether the recipe is favorited."
|
|
73
|
+
},
|
|
74
|
+
"getter": false,
|
|
75
|
+
"setter": false,
|
|
76
|
+
"reflect": true,
|
|
77
|
+
"attribute": "is-favorite",
|
|
78
|
+
"defaultValue": "false"
|
|
79
|
+
}
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
static get events() {
|
|
83
|
+
return [{
|
|
84
|
+
"method": "ruiAddToPlan",
|
|
85
|
+
"name": "ruiAddToPlan",
|
|
86
|
+
"bubbles": true,
|
|
87
|
+
"cancelable": true,
|
|
88
|
+
"composed": true,
|
|
89
|
+
"docs": {
|
|
90
|
+
"tags": [],
|
|
91
|
+
"text": "Emitted when \"Add to plan\" is clicked. detail: RecipeFull."
|
|
92
|
+
},
|
|
93
|
+
"complexType": {
|
|
94
|
+
"original": "RecipeFull",
|
|
95
|
+
"resolved": "RecipeFull",
|
|
96
|
+
"references": {
|
|
97
|
+
"RecipeFull": {
|
|
98
|
+
"location": "local",
|
|
99
|
+
"path": "F:/Projects/RecipeFinder/recipe-ui-lib/src/components/rui-recipe-detail/rui-recipe-detail.tsx",
|
|
100
|
+
"id": "src/components/rui-recipe-detail/rui-recipe-detail.tsx::RecipeFull"
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
}, {
|
|
105
|
+
"method": "ruiFavoriteToggle",
|
|
106
|
+
"name": "ruiFavoriteToggle",
|
|
107
|
+
"bubbles": true,
|
|
108
|
+
"cancelable": true,
|
|
109
|
+
"composed": true,
|
|
110
|
+
"docs": {
|
|
111
|
+
"tags": [],
|
|
112
|
+
"text": "Emitted when the favorite toggle is clicked. detail: { recipe, isFavorite }."
|
|
113
|
+
},
|
|
114
|
+
"complexType": {
|
|
115
|
+
"original": "{ recipe: RecipeFull; isFavorite: boolean }",
|
|
116
|
+
"resolved": "{ recipe: RecipeFull; isFavorite: boolean; }",
|
|
117
|
+
"references": {
|
|
118
|
+
"RecipeFull": {
|
|
119
|
+
"location": "local",
|
|
120
|
+
"path": "F:/Projects/RecipeFinder/recipe-ui-lib/src/components/rui-recipe-detail/rui-recipe-detail.tsx",
|
|
121
|
+
"id": "src/components/rui-recipe-detail/rui-recipe-detail.tsx::RecipeFull"
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
}];
|
|
126
|
+
}
|
|
127
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
:host {
|
|
2
|
+
display: block;
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
.rui-list {
|
|
6
|
+
display: grid;
|
|
7
|
+
grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
|
|
8
|
+
gap: 1.25rem;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
.rui-list__empty {
|
|
12
|
+
margin: 2rem 0;
|
|
13
|
+
text-align: center;
|
|
14
|
+
color: var(--rui-color-muted);
|
|
15
|
+
font-size: 1rem;
|
|
16
|
+
}
|