recipe-planner-ui 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (68) hide show
  1. package/LICENSE +21 -0
  2. package/dist/cjs/app-globals-V2Kpy_OQ.js +5 -0
  3. package/dist/cjs/index-B6uIqnrk.js +2043 -0
  4. package/dist/cjs/index.cjs.js +2 -0
  5. package/dist/cjs/loader.cjs.js +13 -0
  6. package/dist/cjs/recipe-planner-ui.cjs.js +25 -0
  7. package/dist/cjs/rp-day-slot.cjs.entry.js +57 -0
  8. package/dist/cjs/rp-filter-chips_5.cjs.entry.js +240 -0
  9. package/dist/collection/collection-manifest.json +18 -0
  10. package/dist/collection/components/rp-day-slot/rp-day-slot.css +131 -0
  11. package/dist/collection/components/rp-day-slot/rp-day-slot.js +201 -0
  12. package/dist/collection/components/rp-filter-chips/rp-filter-chips.css +36 -0
  13. package/dist/collection/components/rp-filter-chips/rp-filter-chips.js +123 -0
  14. package/dist/collection/components/rp-ingredient-list/rp-ingredient-list.css +53 -0
  15. package/dist/collection/components/rp-ingredient-list/rp-ingredient-list.js +57 -0
  16. package/dist/collection/components/rp-modal/rp-modal.css +94 -0
  17. package/dist/collection/components/rp-modal/rp-modal.js +196 -0
  18. package/dist/collection/components/rp-recipe-card/rp-recipe-card.css +106 -0
  19. package/dist/collection/components/rp-recipe-card/rp-recipe-card.js +170 -0
  20. package/dist/collection/components/rp-search-bar/rp-search-bar.css +65 -0
  21. package/dist/collection/components/rp-search-bar/rp-search-bar.js +166 -0
  22. package/dist/collection/index.js +1 -0
  23. package/dist/components/index.d.ts +35 -0
  24. package/dist/components/index.js +1 -0
  25. package/dist/components/rp-day-slot.d.ts +11 -0
  26. package/dist/components/rp-day-slot.js +1 -0
  27. package/dist/components/rp-filter-chips.d.ts +11 -0
  28. package/dist/components/rp-filter-chips.js +1 -0
  29. package/dist/components/rp-ingredient-list.d.ts +11 -0
  30. package/dist/components/rp-ingredient-list.js +1 -0
  31. package/dist/components/rp-modal.d.ts +11 -0
  32. package/dist/components/rp-modal.js +1 -0
  33. package/dist/components/rp-recipe-card.d.ts +11 -0
  34. package/dist/components/rp-recipe-card.js +1 -0
  35. package/dist/components/rp-search-bar.d.ts +11 -0
  36. package/dist/components/rp-search-bar.js +1 -0
  37. package/dist/esm/app-globals-DQuL1Twl.js +3 -0
  38. package/dist/esm/index-B4wAFfci.js +2034 -0
  39. package/dist/esm/index.js +1 -0
  40. package/dist/esm/loader.js +11 -0
  41. package/dist/esm/recipe-planner-ui.js +21 -0
  42. package/dist/esm/rp-day-slot.entry.js +55 -0
  43. package/dist/esm/rp-filter-chips_5.entry.js +234 -0
  44. package/dist/index.cjs.js +1 -0
  45. package/dist/index.js +1 -0
  46. package/dist/recipe-planner-ui/index.esm.js +0 -0
  47. package/dist/recipe-planner-ui/p-66ba2983.entry.js +1 -0
  48. package/dist/recipe-planner-ui/p-B4wAFfci.js +3 -0
  49. package/dist/recipe-planner-ui/p-DQuL1Twl.js +1 -0
  50. package/dist/recipe-planner-ui/p-d54dbd37.entry.js +1 -0
  51. package/dist/recipe-planner-ui/recipe-planner-ui.css +1 -0
  52. package/dist/recipe-planner-ui/recipe-planner-ui.esm.js +1 -0
  53. package/dist/types/components/rp-day-slot/rp-day-slot.d.ts +41 -0
  54. package/dist/types/components/rp-filter-chips/rp-filter-chips.d.ts +24 -0
  55. package/dist/types/components/rp-ingredient-list/rp-ingredient-list.d.ts +14 -0
  56. package/dist/types/components/rp-modal/rp-modal.d.ts +34 -0
  57. package/dist/types/components/rp-recipe-card/rp-recipe-card.d.ts +36 -0
  58. package/dist/types/components/rp-search-bar/rp-search-bar.d.ts +31 -0
  59. package/dist/types/components.d.ts +536 -0
  60. package/dist/types/index.d.ts +7 -0
  61. package/dist/types/stencil-public-runtime.d.ts +1873 -0
  62. package/loader/cdn.js +1 -0
  63. package/loader/index.cjs.js +1 -0
  64. package/loader/index.d.ts +24 -0
  65. package/loader/index.es2017.js +1 -0
  66. package/loader/index.js +2 -0
  67. package/package.json +72 -0
  68. package/readme.md +131 -0
package/loader/cdn.js ADDED
@@ -0,0 +1 @@
1
+ module.exports = require('../dist/cjs/loader.cjs.js');
@@ -0,0 +1 @@
1
+ module.exports = require('../dist/cjs/loader.cjs.js');
@@ -0,0 +1,24 @@
1
+ export * from '../dist/types/components';
2
+ export interface CustomElementsDefineOptions {
3
+ exclude?: string[];
4
+ resourcesUrl?: string;
5
+ syncQueue?: boolean;
6
+ jmp?: (c: Function) => any;
7
+ raf?: (c: FrameRequestCallback) => number;
8
+ ael?: (el: EventTarget, eventName: string, listener: EventListenerOrEventListenerObject, options: boolean | AddEventListenerOptions) => void;
9
+ rel?: (el: EventTarget, eventName: string, listener: EventListenerOrEventListenerObject, options: boolean | AddEventListenerOptions) => void;
10
+ }
11
+ export declare function defineCustomElements(win?: Window, opts?: CustomElementsDefineOptions): Promise<void>;
12
+ /**
13
+ * @deprecated
14
+ */
15
+ export declare function applyPolyfills(): Promise<void>;
16
+
17
+ /**
18
+ * Used to specify a nonce value that corresponds with an application's CSP.
19
+ * When set, the nonce will be added to all dynamically created script and style tags at runtime.
20
+ * Alternatively, the nonce value can be set on a meta tag in the DOM head
21
+ * (<meta name="csp-nonce" content="{ nonce value here }" />) which
22
+ * will result in the same behavior.
23
+ */
24
+ export declare function setNonce(nonce: string): void;
@@ -0,0 +1 @@
1
+ export * from '../dist/esm/loader.js';
@@ -0,0 +1,2 @@
1
+ (function(){if("undefined"!==typeof window&&void 0!==window.Reflect&&void 0!==window.customElements){var a=HTMLElement;window.HTMLElement=function(){return Reflect.construct(a,[],this.constructor)};HTMLElement.prototype=a.prototype;HTMLElement.prototype.constructor=HTMLElement;Object.setPrototypeOf(HTMLElement,a)}})();
2
+ export * from '../dist/esm/loader.js';
package/package.json ADDED
@@ -0,0 +1,72 @@
1
+ {
2
+ "name": "recipe-planner-ui",
3
+ "version": "1.0.0",
4
+ "description": "Framework-agnostic web components for recipe discovery and meal planning UIs.",
5
+ "license": "MIT",
6
+ "author": "sahilsoni432",
7
+ "//": "No \"type\": \"module\" here. Stencil emits a dual build whose CommonJS half uses .js files; declaring the package as ESM would make Node parse those as modules and fail.",
8
+ "repository": {
9
+ "type": "git",
10
+ "url": "git+https://github.com/sahilsoni432/Meal-Planner.git",
11
+ "directory": "recipe-ui"
12
+ },
13
+ "homepage": "https://github.com/sahilsoni432/Meal-Planner/tree/main/recipe-ui#readme",
14
+ "bugs": {
15
+ "url": "https://github.com/sahilsoni432/Meal-Planner/issues"
16
+ },
17
+ "main": "dist/index.cjs.js",
18
+ "module": "dist/index.js",
19
+ "types": "dist/types/index.d.ts",
20
+ "collection": "dist/collection/collection-manifest.json",
21
+ "collection:main": "dist/collection/index.js",
22
+ "unpkg": "dist/recipe-planner-ui/recipe-planner-ui.esm.js",
23
+ "exports": {
24
+ ".": {
25
+ "types": "./dist/types/index.d.ts",
26
+ "import": "./dist/index.js",
27
+ "require": "./dist/index.cjs.js"
28
+ },
29
+ "./dist/recipe-planner-ui/recipe-planner-ui.css": "./dist/recipe-planner-ui/recipe-planner-ui.css",
30
+ "./dist/*": "./dist/*",
31
+ "./components/*.js": {
32
+ "types": "./dist/components/*.d.ts",
33
+ "import": "./dist/components/*.js"
34
+ },
35
+ "./components/*": {
36
+ "types": "./dist/components/*.d.ts",
37
+ "import": "./dist/components/*.js"
38
+ },
39
+ "./loader": {
40
+ "types": "./loader/index.d.ts",
41
+ "import": "./loader/index.js",
42
+ "require": "./loader/index.cjs.js"
43
+ }
44
+ },
45
+ "files": [
46
+ "dist/",
47
+ "loader/"
48
+ ],
49
+ "sideEffects": [
50
+ "dist/recipe-planner-ui/**",
51
+ "loader/**"
52
+ ],
53
+ "keywords": [
54
+ "stencil",
55
+ "web-components",
56
+ "custom-elements",
57
+ "recipe",
58
+ "meal-planner",
59
+ "design-system"
60
+ ],
61
+ "scripts": {
62
+ "build": "stencil build",
63
+ "start": "stencil build --dev --watch --serve",
64
+ "generate": "stencil generate"
65
+ },
66
+ "dependencies": {
67
+ "@stencil/core": "^4.27.1"
68
+ },
69
+ "devDependencies": {
70
+ "@types/node": "^22.13.5"
71
+ }
72
+ }
package/readme.md ADDED
@@ -0,0 +1,131 @@
1
+ # recipe-planner-ui
2
+
3
+ Framework-agnostic web components for recipe discovery and meal planning interfaces, built
4
+ with [Stencil](https://stenciljs.com). They are standards-based custom elements, so they work
5
+ in Svelte, React, Vue, Angular, or a plain `.html` file with no framework at all.
6
+
7
+ ```bash
8
+ npm install recipe-planner-ui
9
+ ```
10
+
11
+ ## Registering the components
12
+
13
+ The package ships a lazy loader that registers every tag:
14
+
15
+ ```js
16
+ import { defineCustomElements } from 'recipe-planner-ui/loader';
17
+
18
+ defineCustomElements();
19
+ ```
20
+
21
+ In SvelteKit or any other SSR framework, register in the browser only — custom elements are a
22
+ client-side API:
23
+
24
+ ```ts
25
+ // src/routes/+layout.ts
26
+ import { browser } from '$app/environment';
27
+
28
+ export async function load() {
29
+ if (browser) {
30
+ const { defineCustomElements } = await import('recipe-planner-ui/loader');
31
+ await defineCustomElements();
32
+ }
33
+ }
34
+ ```
35
+
36
+ Alternatively, import individual components for tree-shaking:
37
+
38
+ ```js
39
+ import { defineCustomElement as defineRecipeCard } from 'recipe-planner-ui/components/rp-recipe-card.js';
40
+
41
+ defineRecipeCard();
42
+ ```
43
+
44
+ ## Passing data
45
+
46
+ Primitive props can be set as attributes. **Array and object props have no attribute
47
+ representation and must be assigned as DOM properties** — this is a rule of the custom
48
+ elements standard, not a limitation of this library.
49
+
50
+ ```html
51
+ <rp-recipe-card recipe-id="api:52772" recipe-title="Teriyaki Chicken" favorite></rp-recipe-card>
52
+
53
+ <rp-filter-chips id="chips"></rp-filter-chips>
54
+ <script>
55
+ document.getElementById('chips').options = ['Chicken', 'Seafood', 'Dessert'];
56
+ </script>
57
+ ```
58
+
59
+ Most frameworks, Svelte included, set properties automatically when a property of that name
60
+ exists on the element.
61
+
62
+ ## Components
63
+
64
+ | Tag | Key props | Events | Slots |
65
+ |---|---|---|---|
66
+ | `rp-recipe-card` | `recipeId`, `recipeTitle`, `image`, `category`, `favorite` | `rpFavoriteToggle` | default, `actions` |
67
+ | `rp-search-bar` | `value`, `placeholder`, `label` | `rpSearch`, `rpClear` | — |
68
+ | `rp-filter-chips` | `options[]`, `selected` | `rpFilterChange` | — |
69
+ | `rp-ingredient-list` | `items[]` | — | `heading`, default |
70
+ | `rp-day-slot` | `day`, `dayLabel`, `meals[]`, `days[]` | `rpAddMeal`, `rpRemoveMeal`, `rpMoveMeal` | default |
71
+ | `rp-modal` | `open`, `heading` | `rpClose` | default, `footer` |
72
+
73
+ Per-component API documentation, generated from the source, lives in each component's
74
+ directory under `src/components/`.
75
+
76
+ ### Events
77
+
78
+ All events bubble and are composed, so they can be handled on any ancestor:
79
+
80
+ ```js
81
+ document.addEventListener('rpFavoriteToggle', (event) => {
82
+ const { recipeId, favorite } = event.detail;
83
+ });
84
+ ```
85
+
86
+ `rp-recipe-card` emits the *intended next state* and never writes to its own `favorite` prop.
87
+ The consumer owns the data and decides whether to apply the change.
88
+
89
+ ### `rp-modal`
90
+
91
+ Handles its own focus trap, Escape-to-close, and focus restoration. It exposes one imperative
92
+ method for the case a prop cannot express:
93
+
94
+ ```js
95
+ await document.querySelector('rp-modal').focusFirstField();
96
+ ```
97
+
98
+ ## Styling
99
+
100
+ Components use `scoped` encapsulation rather than shadow DOM, so a consuming application's
101
+ global CSS reaches them. Theming is done by overriding the semantic token tier:
102
+
103
+ ```css
104
+ :root {
105
+ --rp-color-accent: #7048e8;
106
+ --rp-radius-lg: 4px;
107
+ }
108
+ ```
109
+
110
+ Tokens are organised in three tiers — primitive (`--rp-green-600`), semantic
111
+ (`--rp-color-accent`), and component-level. Override the semantic tier to retheme the library;
112
+ the primitive tier is an implementation detail.
113
+
114
+ The package also ships pre-hydration sizing under `:not(:defined)` so pages do not reflow as
115
+ elements upgrade.
116
+
117
+ ## Local development
118
+
119
+ ```bash
120
+ npm install
121
+ npm start # dev server with a demo page at http://localhost:3333
122
+ npm run build # production build
123
+ ```
124
+
125
+ `src/index.html` is a plain HTML page exercising every component and logging every event —
126
+ the quickest way to verify a change, and a demonstration that these components need no
127
+ framework.
128
+
129
+ ## License
130
+
131
+ MIT