@recipe-book/react 0.0.1 → 0.0.2
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/dist/chunk-2S2Z4HLL.mjs +46 -0
- package/dist/chunk-2VMRVR3X.mjs +1 -0
- package/dist/chunk-36H6LM2B.mjs +14 -0
- package/dist/{chunk-JTZVD7JV.mjs → chunk-4IWVZEXX.mjs} +4 -4
- package/dist/chunk-4XBZKTOL.mjs +1 -0
- package/dist/chunk-6AGILC25.mjs +20 -0
- package/dist/chunk-6AXGEB5P.mjs +14 -0
- package/dist/chunk-6JEDN4VR.mjs +20 -0
- package/dist/chunk-6KLLMLNF.mjs +33 -0
- package/dist/chunk-6LTLY5K7.mjs +20 -0
- package/dist/chunk-6RA4EVIO.mjs +46 -0
- package/dist/chunk-75DF3E6L.mjs +50 -0
- package/dist/chunk-7BWMULSB.mjs +55 -0
- package/dist/chunk-7PPB3PM6.mjs +40 -0
- package/dist/chunk-7SBP7DC5.mjs +42 -0
- package/dist/chunk-7XJBP24U.mjs +20 -0
- package/dist/chunk-A5JAKCMG.mjs +44 -0
- package/dist/chunk-ATOAYKI3.mjs +26 -0
- package/dist/chunk-B5IXKKFC.mjs +38 -0
- package/dist/chunk-BEMMFA52.mjs +49 -0
- package/dist/chunk-BOG5DA6M.mjs +38 -0
- package/dist/chunk-BW4DYFBO.mjs +36 -0
- package/dist/chunk-CDQFOSWR.mjs +34 -0
- package/dist/chunk-CRQVP6PW.mjs +20 -0
- package/dist/chunk-CY27OHOG.mjs +1 -0
- package/dist/chunk-DACFJWGN.mjs +14 -0
- package/dist/chunk-DE5GUZKO.mjs +46 -0
- package/dist/chunk-DNZAFS5G.mjs +48 -0
- package/dist/chunk-DS3O5PAR.mjs +20 -0
- package/dist/chunk-ENGJXHYU.mjs +42 -0
- package/dist/chunk-FIFGRJKD.mjs +26 -0
- package/dist/chunk-FWOMIZEF.mjs +46 -0
- package/dist/{chunk-T6BBQT4K.mjs → chunk-G7XD4VBW.mjs} +5 -5
- package/dist/chunk-GBU6MVZL.mjs +14 -0
- package/dist/chunk-GM5F7IUT.mjs +2 -0
- package/dist/chunk-GSGRXRJP.mjs +38 -0
- package/dist/chunk-GZRNU24M.mjs +46 -0
- package/dist/{chunk-J5PZAYLW.mjs → chunk-HNDXCSZY.mjs} +5 -6
- package/dist/chunk-HXTUDCO2.mjs +49 -0
- package/dist/chunk-I5TR6PEA.mjs +0 -0
- package/dist/chunk-IXRYSEMS.mjs +30 -0
- package/dist/chunk-J5Q2Z2JG.mjs +38 -0
- package/dist/chunk-JBAAWEV6.mjs +1 -0
- package/dist/chunk-JCPPNN26.mjs +44 -0
- package/dist/chunk-JR3OTSZB.mjs +32 -0
- package/dist/chunk-JWS5RTU3.mjs +46 -0
- package/dist/chunk-K6EZ773Q.mjs +26 -0
- package/dist/chunk-KNXMYQVO.mjs +36 -0
- package/dist/chunk-KRUZ7OA7.mjs +44 -0
- package/dist/chunk-KXCIJBR6.mjs +14 -0
- package/dist/chunk-MASAOP7L.mjs +55 -0
- package/dist/chunk-MGBEDCLT.mjs +34 -0
- package/dist/chunk-MKBCBPVR.mjs +53 -0
- package/dist/chunk-N53TONLF.mjs +39 -0
- package/dist/chunk-NYDGFRPM.mjs +46 -0
- package/dist/chunk-OPOABKD6.mjs +23 -0
- package/dist/chunk-OX6ITS5C.mjs +20 -0
- package/dist/chunk-PAAVW47I.mjs +50 -0
- package/dist/chunk-PAF5HSSV.mjs +53 -0
- package/dist/chunk-PBENQR7Y.mjs +1 -0
- package/dist/chunk-PH3LQIHZ.mjs +26 -0
- package/dist/{chunk-FPLGEKN7.mjs → chunk-PIB3RAOO.mjs} +4 -4
- package/dist/chunk-PIXLJD7Y.mjs +37 -0
- package/dist/chunk-PTS3BZHK.mjs +1 -0
- package/dist/chunk-Q6I5J3IJ.mjs +1 -0
- package/dist/chunk-QOZCSS3B.mjs +44 -0
- package/dist/chunk-QSFPUODQ.mjs +34 -0
- package/dist/chunk-RY7QUBJI.mjs +34 -0
- package/dist/chunk-RZJRUG2I.mjs +55 -0
- package/dist/chunk-S3GGSQB5.mjs +1 -0
- package/dist/chunk-S3HRT5Z5.mjs +14 -0
- package/dist/chunk-SB7HBCCZ.mjs +49 -0
- package/dist/chunk-SEXTT3NJ.mjs +25 -0
- package/dist/chunk-SKEQCOPX.mjs +43 -0
- package/dist/chunk-TLBRVWD2.mjs +1 -0
- package/dist/chunk-TOOCHDUY.mjs +36 -0
- package/dist/chunk-TSKANLT4.mjs +37 -0
- package/dist/chunk-UAMZEZUI.mjs +36 -0
- package/dist/chunk-UQJ4XNWN.mjs +26 -0
- package/dist/chunk-VDSUUXCH.mjs +34 -0
- package/dist/chunk-VO7RY2ZK.mjs +44 -0
- package/dist/chunk-WJKDFBJ2.mjs +34 -0
- package/dist/chunk-WTC7PY7U.mjs +54 -0
- package/dist/chunk-WXDV7CMB.mjs +14 -0
- package/dist/chunk-X5FG3X6T.mjs +1 -0
- package/dist/chunk-X66DY4AZ.mjs +1 -0
- package/dist/chunk-XXSJXKWQ.mjs +44 -0
- package/dist/chunk-YZMVAQQG.mjs +1 -0
- package/dist/chunk-ZCXPZU7W.mjs +20 -0
- package/dist/chunk-ZJ4PNVYO.mjs +52 -0
- package/dist/chunk-ZU4QJLEY.mjs +53 -0
- package/dist/components/ingredients/ingredients-list.d.mts +4 -1
- package/dist/components/ingredients/ingredients-list.d.ts +4 -1
- package/dist/components/ingredients/ingredients-list.js +2 -1
- package/dist/components/ingredients/ingredients-list.mjs +1 -1
- package/dist/components/instructions/instruction-list.d.mts +4 -1
- package/dist/components/instructions/instruction-list.d.ts +4 -1
- package/dist/components/instructions/instruction-list.js +1 -1
- package/dist/components/instructions/instruction-list.mjs +1 -1
- package/dist/components/layouts/layout-default.d.mts +1 -1
- package/dist/components/layouts/layout-default.d.ts +1 -1
- package/dist/components/layouts/layout-types.d.mts +2 -2
- package/dist/components/layouts/layout-types.d.ts +2 -2
- package/dist/components/layouts/layout-types.js +1 -1
- package/dist/components/measurement-select.d.mts +13 -0
- package/dist/components/measurement-select.d.ts +13 -0
- package/dist/components/measurement-select.js +1 -0
- package/dist/components/measurement-select.mjs +1 -0
- package/dist/components/root.d.mts +2 -1
- package/dist/components/root.d.ts +2 -1
- package/dist/components/root.js +1 -1
- package/dist/components/root.mjs +1 -1
- package/dist/components/servings-select.d.mts +11 -0
- package/dist/components/servings-select.d.ts +11 -0
- package/dist/components/servings-select.js +1 -0
- package/dist/components/servings-select.mjs +1 -0
- package/dist/components/thumbnail.js +1 -1
- package/dist/components/thumbnail.mjs +1 -1
- package/dist/global-context.d.mts +17 -4
- package/dist/global-context.d.ts +17 -4
- package/dist/global-context.js +1 -1
- package/dist/global-context.mjs +1 -1
- package/dist/hooks/use-controllable.d.mts +15 -0
- package/dist/hooks/use-controllable.d.ts +15 -0
- package/dist/hooks/use-controllable.js +1 -0
- package/dist/hooks/use-controllable.mjs +1 -0
- package/dist/index.d.mts +3 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.js +2 -1
- package/dist/index.mjs +1 -1
- package/dist/recipe-context.d.mts +22 -7
- package/dist/recipe-context.d.ts +22 -7
- package/dist/recipe-context.js +1 -1
- package/dist/recipe-context.mjs +1 -1
- package/dist/types-from-core.d.mts +1 -0
- package/dist/types-from-core.d.ts +1 -0
- package/dist/types-from-core.js +1 -0
- package/dist/types-from-core.mjs +1 -0
- package/package.json +9 -8
- package/dist/chunk-32VQC2BE.mjs +0 -1
- package/dist/chunk-6MAELCYD.mjs +0 -1
- package/dist/chunk-CB36WMX5.mjs +0 -24
- package/dist/chunk-GPTC24DR.mjs +0 -1
- package/dist/chunk-KYWBOSOP.mjs +0 -14
- package/dist/chunk-MBR257HS.mjs +0 -48
- package/dist/chunk-PLID2R4K.mjs +0 -48
- package/dist/chunk-PYOGNEQ3.mjs +0 -48
- package/dist/chunk-RZGBB6SL.mjs +0 -1
- package/dist/chunk-U7TL6PST.mjs +0 -1
package/dist/index.js
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
var
|
|
1
|
+
var C=Object.defineProperty;var E=Object.getOwnPropertyDescriptor;var W=Object.getOwnPropertyNames;var D=Object.prototype.hasOwnProperty;var F=(e,t)=>{for(var n in t)C(e,n,{get:t[n],enumerable:!0})},V=(e,t,n,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of W(t))!D.call(e,r)&&r!==n&&C(e,r,{get:()=>t[r],enumerable:!(o=E(t,r))||o.enumerable});return e};var _=e=>V(C({},"__esModule",{value:!0}),e);var B={};F(B,{IngredientList:()=>A,InstructionList:()=>L,MeasurementSelect:()=>U,Provider:()=>h,RecipeIngredientList:()=>A,RecipeInstructionList:()=>L,RecipeMeasurementSelect:()=>U,RecipeRoot:()=>I,RecipeServingsSelect:()=>K,RecipeThumbnail:()=>k,Root:()=>I,ServingsSelect:()=>K,Thumbnail:()=>k,useRecipe:()=>s});module.exports=_(B);var N=require("@recipe-book/core"),l=require("react");var a=require("react"),x=require("react/jsx-runtime"),b=(0,a.createContext)({});function s(){let e=(0,a.useContext)(b);if(!e)throw new Error("Missing recipe context. Are you using <Recipe.Root />?");return e}function d({children:e,recipe:t,servings:n,setServings:o}){let[r,i]=(0,a.useState)(t.measurements),m=(0,a.useMemo)(()=>({...t,activeConversionKey:r,setConversionKey:c=>{i(c)},servings:n,setServings:o}),[t,r,i,n,o]);return(0,x.jsx)(b.Provider,{value:m,children:e})}var u=require("react"),S=require("react/jsx-runtime"),P=(0,u.createContext)({});function y(){let e=(0,u.useContext)(P);return e||{config:{}}}function h({children:e,config:t}){return(0,S.jsx)(P.Provider,{value:{config:t},children:e})}var G=require("react/jsx-runtime");function I(e){let[t,n]=(0,l.useState)(1),{config:o}=y(),r=(0,l.useMemo)(()=>{let i={...o,...e.recipe},m=N.RecipeUtils.create(i);return{...m,ingredients:m.ingredients.map(c=>({...c,amount:{...c.amount,value:c.amount.value*t},conversion:typeof c.conversion=="object"?{...c.conversion,[i.measurements]:c.amount.value*t}:c.conversion}))}},[o,e.recipe,t]);return(0,G.jsx)(d,{recipe:r,servings:t,setServings:n,children:e.children})}var T=require("@recipe-book/core");var w=require("react"),v=require("react/jsx-runtime");function $(e,t){var o;if(!t)return e.amount;let n=(o=e.conversion)==null?void 0:o[t];if(!n){console.warn(`No conversion found for ingredient "${e.name}" with key "${t}"
|
|
2
|
+
Attempting conversion table lookup...`);let r=T.IngredientUtils.convert(e,t);return r?r.amount:e.amount}return n}function A(e){let{ingredients:t,activeConversionKey:n,measurements:o}=s(),r=(0,w.useMemo)(()=>n===o?t:t.map(i=>({...i,amount:$(i,n)})),[t,n,o]);return(0,v.jsx)("ul",{"recipe-ingredient-list":"",className:e.className,children:r.map((i,m)=>(0,v.jsxs)("li",{"recipe-ingredient":"",children:[i.name," \u2014 ",i.amount.value," ",i.amount.unit]},m))})}var g=require("react/jsx-runtime");function L(e){let{instructions:t}=s();return(0,g.jsx)("ol",{"recipe-instruction-list":"",className:e.className,children:t.map((n,o)=>(0,g.jsx)("li",{"recipe-instruction":o+1,children:n},o))})}var M=require("@radix-ui/react-aspect-ratio");var R=require("react/jsx-runtime");function k(e){var r,i;let{thumbnail:t,name:n}=s();if(!t)throw new Error("Missing thumbnail image. Did you forget to set one?");let o=(r=e.style)!=null?r:{};return(0,R.jsx)(M.AspectRatio,{"recipe-thumbnail":"",className:e.className,style:{width:"100%",...o},ratio:e.aspectRatio||1,children:(0,R.jsx)("img",{"recipe-thumbnail-image":"",style:{objectFit:"cover",width:"100%",height:"100%"},src:t,alt:(i=e.alt)!=null?i:n})})}var f=require("react/jsx-runtime"),q=[.5,1,2,3];function K(e){let{servings:t,setServings:n}=s();return(0,f.jsx)("select",{className:e.className,"recipe-servings-select":"",value:t,onChange:o=>{n(Number(o.target.value))},children:q.map(o=>(0,f.jsxs)("option",{value:o,children:[o," serving",o!==1?"s":""]},o))})}var p=require("react/jsx-runtime");function U(e){let{activeConversionKey:t,setConversionKey:n,measurements:o}=s();if(o===void 0)throw new Error("Cannot select measurement without base measurement");return(0,p.jsxs)("div",{"recipe-measurement-select":"",className:e.className,children:[(0,p.jsx)("button",{"recipe-measurement-option":"","data-active":t==="us-customary",onClick:()=>n("us-customary"),children:"US"}),(0,p.jsx)("button",{"recipe-measurement-option":"","data-active":t==="metric",onClick:()=>n("metric"),children:"Metric"})]})}0&&(module.exports={IngredientList,InstructionList,MeasurementSelect,Provider,RecipeIngredientList,RecipeInstructionList,RecipeMeasurementSelect,RecipeRoot,RecipeServingsSelect,RecipeThumbnail,Root,ServingsSelect,Thumbnail,useRecipe});
|
package/dist/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as
|
|
1
|
+
import{a as i}from"./chunk-GM5F7IUT.mjs";import{a as o}from"./chunk-2VMRVR3X.mjs";import"./chunk-I5TR6PEA.mjs";import{a as p}from"./chunk-TLBRVWD2.mjs";import{a as r}from"./chunk-PTS3BZHK.mjs";import{c as e}from"./chunk-Q6I5J3IJ.mjs";import{a as s}from"./chunk-X66DY4AZ.mjs";import{a as m}from"./chunk-4XBZKTOL.mjs";import{a as t}from"./chunk-PBENQR7Y.mjs";export{i as IngredientList,o as InstructionList,p as MeasurementSelect,e as Provider,i as RecipeIngredientList,o as RecipeInstructionList,p as RecipeMeasurementSelect,r as RecipeRoot,s as RecipeServingsSelect,m as RecipeThumbnail,r as Root,s as ServingsSelect,m as Thumbnail,t as useRecipe};
|
|
@@ -1,14 +1,29 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
|
-
import { RecipeConfig } from 'recipe-core';
|
|
2
|
+
import { RecipeConfig, ConversionTables, Recipe } from '@recipe-book/core';
|
|
3
3
|
|
|
4
|
-
type RecipeContext
|
|
5
|
-
|
|
4
|
+
type RecipeContext = RecipeConfig & {
|
|
5
|
+
activeConversionKey: ConversionTables;
|
|
6
|
+
setConversionKey: (key: ConversionTables) => void;
|
|
7
|
+
servings: number;
|
|
8
|
+
setServings: (value: number) => void;
|
|
6
9
|
};
|
|
7
|
-
|
|
8
|
-
|
|
10
|
+
/**
|
|
11
|
+
* Hook to access the recipe context.
|
|
12
|
+
*/
|
|
13
|
+
declare function useRecipeContext(): RecipeContext;
|
|
14
|
+
interface RecipeContextProviderProps {
|
|
9
15
|
children: ReactNode;
|
|
10
|
-
|
|
16
|
+
recipe: Recipe;
|
|
17
|
+
servings: number;
|
|
18
|
+
setServings: (value: number) => void;
|
|
11
19
|
}
|
|
12
|
-
|
|
20
|
+
/**
|
|
21
|
+
* Provider for the recipe context. This provider is used to create
|
|
22
|
+
* a recipe-specific configuration that is inherited by all components
|
|
23
|
+
* within the recipe.
|
|
24
|
+
*
|
|
25
|
+
* @param {RecipeContextProviderProps} The recipe configuration to be used by all components
|
|
26
|
+
*/
|
|
27
|
+
declare function RecipeContextProvider({ children, recipe, servings, setServings, }: RecipeContextProviderProps): JSX.Element;
|
|
13
28
|
|
|
14
29
|
export { type RecipeContext, RecipeContextProvider, useRecipeContext };
|
package/dist/recipe-context.d.ts
CHANGED
|
@@ -1,14 +1,29 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
|
-
import { RecipeConfig } from 'recipe-core';
|
|
2
|
+
import { RecipeConfig, ConversionTables, Recipe } from '@recipe-book/core';
|
|
3
3
|
|
|
4
|
-
type RecipeContext
|
|
5
|
-
|
|
4
|
+
type RecipeContext = RecipeConfig & {
|
|
5
|
+
activeConversionKey: ConversionTables;
|
|
6
|
+
setConversionKey: (key: ConversionTables) => void;
|
|
7
|
+
servings: number;
|
|
8
|
+
setServings: (value: number) => void;
|
|
6
9
|
};
|
|
7
|
-
|
|
8
|
-
|
|
10
|
+
/**
|
|
11
|
+
* Hook to access the recipe context.
|
|
12
|
+
*/
|
|
13
|
+
declare function useRecipeContext(): RecipeContext;
|
|
14
|
+
interface RecipeContextProviderProps {
|
|
9
15
|
children: ReactNode;
|
|
10
|
-
|
|
16
|
+
recipe: Recipe;
|
|
17
|
+
servings: number;
|
|
18
|
+
setServings: (value: number) => void;
|
|
11
19
|
}
|
|
12
|
-
|
|
20
|
+
/**
|
|
21
|
+
* Provider for the recipe context. This provider is used to create
|
|
22
|
+
* a recipe-specific configuration that is inherited by all components
|
|
23
|
+
* within the recipe.
|
|
24
|
+
*
|
|
25
|
+
* @param {RecipeContextProviderProps} The recipe configuration to be used by all components
|
|
26
|
+
*/
|
|
27
|
+
declare function RecipeContextProvider({ children, recipe, servings, setServings, }: RecipeContextProviderProps): JSX.Element;
|
|
13
28
|
|
|
14
29
|
export { type RecipeContext, RecipeContextProvider, useRecipeContext };
|
package/dist/recipe-context.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var
|
|
1
|
+
var s=Object.defineProperty;var a=Object.getOwnPropertyDescriptor;var x=Object.getOwnPropertyNames;var R=Object.prototype.hasOwnProperty;var d=(o,e)=>{for(var r in e)s(o,r,{get:e[r],enumerable:!0})},l=(o,e,r,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of x(e))!R.call(o,n)&&n!==r&&s(o,n,{get:()=>e[n],enumerable:!(i=a(e,n))||i.enumerable});return o};var m=o=>l(s({},"__esModule",{value:!0}),o);var y={};d(y,{RecipeContextProvider:()=>f,useRecipeContext:()=>b});module.exports=m(y);var t=require("react"),C=require("react/jsx-runtime"),v=(0,t.createContext)({});function b(){let o=(0,t.useContext)(v);if(!o)throw new Error("Missing recipe context. Are you using <Recipe.Root />?");return o}function f({children:o,recipe:e,servings:r,setServings:i}){let[n,c]=(0,t.useState)(e.measurements),p=(0,t.useMemo)(()=>({...e,activeConversionKey:n,setConversionKey:u=>{c(u)},servings:r,setServings:i}),[e,n,c,r,i]);return(0,C.jsx)(v.Provider,{value:p,children:o})}0&&(module.exports={RecipeContextProvider,useRecipeContext});
|
package/dist/recipe-context.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a,b}from"./chunk-
|
|
1
|
+
import{a,b}from"./chunk-PBENQR7Y.mjs";export{b as RecipeContextProvider,a as useRecipeContext};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { GlobalRecipeConfig, Ingredient, IngredientAmount, Recipe, RecipeConfig, Unit, UnitAbbreviation, UnitKey, UnitName } from '@recipe-book/core';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { GlobalRecipeConfig, Ingredient, IngredientAmount, Recipe, RecipeConfig, Unit, UnitAbbreviation, UnitKey, UnitName } from '@recipe-book/core';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var t=Object.defineProperty;var p=Object.getOwnPropertyDescriptor;var c=Object.getOwnPropertyNames;var b=Object.prototype.hasOwnProperty;var g=(i,e,r,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of c(e))!b.call(i,n)&&n!==r&&t(i,n,{get:()=>e[n],enumerable:!(o=p(e,n))||o.enumerable});return i};var U=i=>g(t({},"__esModule",{value:!0}),i);var a={};module.exports=U(a);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import"./chunk-I5TR6PEA.mjs";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@recipe-book/react",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.2",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.mjs",
|
|
@@ -8,6 +8,11 @@
|
|
|
8
8
|
"files": [
|
|
9
9
|
"dist"
|
|
10
10
|
],
|
|
11
|
+
"scripts": {
|
|
12
|
+
"prepublishOnly": "pnpm build",
|
|
13
|
+
"build": "tsup src",
|
|
14
|
+
"dev": "tsup src --watch"
|
|
15
|
+
},
|
|
11
16
|
"peerDependencies": {
|
|
12
17
|
"react": "^18.0.0",
|
|
13
18
|
"react-dom": "^18.0.0"
|
|
@@ -16,14 +21,10 @@
|
|
|
16
21
|
"@radix-ui/react-aspect-ratio": "1.0.3",
|
|
17
22
|
"@radix-ui/react-avatar": "1.0.3",
|
|
18
23
|
"@radix-ui/react-accessible-icon": "1.0.3",
|
|
19
|
-
"recipe-core": "
|
|
24
|
+
"@recipe-book/core": "workspace:*"
|
|
20
25
|
},
|
|
21
26
|
"devDependencies": {
|
|
22
27
|
"@types/react": "18.0.15"
|
|
23
28
|
},
|
|
24
|
-
"sideEffects": false
|
|
25
|
-
|
|
26
|
-
"build": "tsup src",
|
|
27
|
-
"dev": "tsup src --watch"
|
|
28
|
-
}
|
|
29
|
-
}
|
|
29
|
+
"sideEffects": false
|
|
30
|
+
}
|
package/dist/chunk-32VQC2BE.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{createContext as n,useContext as i}from"react";import{jsx as r}from"react/jsx-runtime";var t=n({});function x(){let e=i(t);if(!e)throw new Error("Missing recipe context. Are you using <Recipe.Root />?");return e}function R({children:e,config:o}){return r(t.Provider,{value:{config:o},children:e})}export{x as a,R as b};
|
package/dist/chunk-6MAELCYD.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{b as n}from"./chunk-QOCKR2HO.mjs";import{b as t}from"./chunk-32VQC2BE.mjs";import{useMemo as e}from"react";import{jsx as f}from"react/jsx-runtime";function C(o){let{config:i}=n(),r=e(()=>({...i,...o.config}),[i,o.config]);return f(t,{config:r,children:o.children})}export{C as a};
|
package/dist/chunk-CB36WMX5.mjs
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
// src/recipe-context.tsx
|
|
2
|
-
import { createContext, useContext } from "react";
|
|
3
|
-
import { jsx } from "react/jsx-runtime";
|
|
4
|
-
var RecipeContext = createContext(
|
|
5
|
-
{}
|
|
6
|
-
);
|
|
7
|
-
function useRecipeContext() {
|
|
8
|
-
const ctx = useContext(RecipeContext);
|
|
9
|
-
if (!ctx) {
|
|
10
|
-
throw new Error("Missing recipe context. Are you using <Recipe.Root />?");
|
|
11
|
-
}
|
|
12
|
-
return ctx;
|
|
13
|
-
}
|
|
14
|
-
function RecipeContextProvider({
|
|
15
|
-
children,
|
|
16
|
-
config
|
|
17
|
-
}) {
|
|
18
|
-
return /* @__PURE__ */ jsx(RecipeContext.Provider, { value: { config }, children });
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
export {
|
|
22
|
-
useRecipeContext,
|
|
23
|
-
RecipeContextProvider
|
|
24
|
-
};
|
package/dist/chunk-GPTC24DR.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as t}from"./chunk-32VQC2BE.mjs";import{jsx as n}from"react/jsx-runtime";function r(){let{config:o}=t();return n("ul",{"recipe-instruction-list":"",children:o.instructions.map((c,i)=>n("li",{"recipe-instruction":i+1,children:c},i))})}export{r as a};
|
package/dist/chunk-KYWBOSOP.mjs
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
useRecipeContext
|
|
3
|
-
} from "./chunk-CB36WMX5.mjs";
|
|
4
|
-
|
|
5
|
-
// src/components/instructions/instruction-list.tsx
|
|
6
|
-
import { jsx } from "react/jsx-runtime";
|
|
7
|
-
function InstructionList() {
|
|
8
|
-
const { config } = useRecipeContext();
|
|
9
|
-
return /* @__PURE__ */ jsx("ul", { "recipe-instruction-list": "", children: config.instructions.map((instruction, i) => /* @__PURE__ */ jsx("li", { "recipe-instruction": i + 1, children: instruction }, i)) });
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
export {
|
|
13
|
-
InstructionList
|
|
14
|
-
};
|
package/dist/chunk-MBR257HS.mjs
DELETED
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
useRecipeContext
|
|
3
|
-
} from "./chunk-CB36WMX5.mjs";
|
|
4
|
-
|
|
5
|
-
// src/components/thumbnail.tsx
|
|
6
|
-
import { AspectRatio } from "@radix-ui/react-aspect-ratio";
|
|
7
|
-
import { forwardRef } from "react";
|
|
8
|
-
import { jsx } from "react/jsx-runtime";
|
|
9
|
-
var Thumbnail = forwardRef(
|
|
10
|
-
(props, ref) => {
|
|
11
|
-
var _a, _b;
|
|
12
|
-
const { config } = useRecipeContext();
|
|
13
|
-
if (!config.thumbnail) {
|
|
14
|
-
throw new Error("Missing thumbnail image. Did you forget to set one?");
|
|
15
|
-
}
|
|
16
|
-
const propStyle = (_a = props.style) != null ? _a : {};
|
|
17
|
-
return /* @__PURE__ */ jsx(
|
|
18
|
-
AspectRatio,
|
|
19
|
-
{
|
|
20
|
-
"recipe-thumbnail": true,
|
|
21
|
-
ref,
|
|
22
|
-
className: props.className,
|
|
23
|
-
style: {
|
|
24
|
-
width: "100%",
|
|
25
|
-
...propStyle
|
|
26
|
-
},
|
|
27
|
-
ratio: props.aspectRatio || 1,
|
|
28
|
-
children: /* @__PURE__ */ jsx(
|
|
29
|
-
"img",
|
|
30
|
-
{
|
|
31
|
-
"recipe-thumbnail-image": true,
|
|
32
|
-
style: {
|
|
33
|
-
objectFit: "cover",
|
|
34
|
-
width: "100%",
|
|
35
|
-
height: "100%"
|
|
36
|
-
},
|
|
37
|
-
src: config.thumbnail,
|
|
38
|
-
alt: (_b = props.alt) != null ? _b : config.name
|
|
39
|
-
}
|
|
40
|
-
)
|
|
41
|
-
}
|
|
42
|
-
);
|
|
43
|
-
}
|
|
44
|
-
);
|
|
45
|
-
|
|
46
|
-
export {
|
|
47
|
-
Thumbnail
|
|
48
|
-
};
|
package/dist/chunk-PLID2R4K.mjs
DELETED
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
useRecipeContext
|
|
3
|
-
} from "./chunk-CB36WMX5.mjs";
|
|
4
|
-
|
|
5
|
-
// src/components/thumbnail.tsx
|
|
6
|
-
import { AspectRatio } from "@radix-ui/react-aspect-ratio";
|
|
7
|
-
import { forwardRef } from "react";
|
|
8
|
-
import { jsx } from "react/jsx-runtime";
|
|
9
|
-
var Thumbnail = forwardRef(
|
|
10
|
-
(props, ref) => {
|
|
11
|
-
var _a, _b;
|
|
12
|
-
const { config } = useRecipeContext();
|
|
13
|
-
if (!config.thumbnail) {
|
|
14
|
-
throw new Error("Missing thumbnail image. Did you forget to set one?");
|
|
15
|
-
}
|
|
16
|
-
const propStyle = (_a = props.style) != null ? _a : {};
|
|
17
|
-
return /* @__PURE__ */ jsx(
|
|
18
|
-
AspectRatio,
|
|
19
|
-
{
|
|
20
|
-
"recipe-thumbnail": "",
|
|
21
|
-
ref,
|
|
22
|
-
className: props.className,
|
|
23
|
-
style: {
|
|
24
|
-
width: "100%",
|
|
25
|
-
...propStyle
|
|
26
|
-
},
|
|
27
|
-
ratio: props.aspectRatio || 1,
|
|
28
|
-
children: /* @__PURE__ */ jsx(
|
|
29
|
-
"img",
|
|
30
|
-
{
|
|
31
|
-
"recipe-thumbnail-image": true,
|
|
32
|
-
style: {
|
|
33
|
-
objectFit: "cover",
|
|
34
|
-
width: "100%",
|
|
35
|
-
height: "100%"
|
|
36
|
-
},
|
|
37
|
-
src: config.thumbnail,
|
|
38
|
-
alt: (_b = props.alt) != null ? _b : config.name
|
|
39
|
-
}
|
|
40
|
-
)
|
|
41
|
-
}
|
|
42
|
-
);
|
|
43
|
-
}
|
|
44
|
-
);
|
|
45
|
-
|
|
46
|
-
export {
|
|
47
|
-
Thumbnail
|
|
48
|
-
};
|
package/dist/chunk-PYOGNEQ3.mjs
DELETED
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
useRecipeContext
|
|
3
|
-
} from "./chunk-CB36WMX5.mjs";
|
|
4
|
-
|
|
5
|
-
// src/components/thumbnail.tsx
|
|
6
|
-
import { AspectRatio } from "@radix-ui/react-aspect-ratio";
|
|
7
|
-
import { forwardRef } from "react";
|
|
8
|
-
import { jsx } from "react/jsx-runtime";
|
|
9
|
-
var Thumbnail = forwardRef(
|
|
10
|
-
(props, ref) => {
|
|
11
|
-
var _a, _b;
|
|
12
|
-
const { config } = useRecipeContext();
|
|
13
|
-
if (!config.thumbnail) {
|
|
14
|
-
throw new Error("Missing thumbnail image. Did you forget to set one?");
|
|
15
|
-
}
|
|
16
|
-
const propStyle = (_a = props.style) != null ? _a : {};
|
|
17
|
-
return /* @__PURE__ */ jsx(
|
|
18
|
-
AspectRatio,
|
|
19
|
-
{
|
|
20
|
-
"recipe-thumbnail": "",
|
|
21
|
-
ref,
|
|
22
|
-
className: props.className,
|
|
23
|
-
style: {
|
|
24
|
-
width: "100%",
|
|
25
|
-
...propStyle
|
|
26
|
-
},
|
|
27
|
-
ratio: props.aspectRatio || 1,
|
|
28
|
-
children: /* @__PURE__ */ jsx(
|
|
29
|
-
"img",
|
|
30
|
-
{
|
|
31
|
-
"recipe-thumbnail-image": "",
|
|
32
|
-
style: {
|
|
33
|
-
objectFit: "cover",
|
|
34
|
-
width: "100%",
|
|
35
|
-
height: "100%"
|
|
36
|
-
},
|
|
37
|
-
src: config.thumbnail,
|
|
38
|
-
alt: (_b = props.alt) != null ? _b : config.name
|
|
39
|
-
}
|
|
40
|
-
)
|
|
41
|
-
}
|
|
42
|
-
);
|
|
43
|
-
}
|
|
44
|
-
);
|
|
45
|
-
|
|
46
|
-
export {
|
|
47
|
-
Thumbnail
|
|
48
|
-
};
|
package/dist/chunk-RZGBB6SL.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as o}from"./chunk-32VQC2BE.mjs";import{AspectRatio as m}from"@radix-ui/react-aspect-ratio";import{jsx as r}from"react/jsx-runtime";function c(t){var i,a;let{config:e}=o();if(!e.thumbnail)throw new Error("Missing thumbnail image. Did you forget to set one?");let s=(i=t.style)!=null?i:{};return r(m,{"recipe-thumbnail":"",className:t.className,style:{width:"100%",...s},ratio:t.aspectRatio||1,children:r("img",{"recipe-thumbnail-image":"",style:{objectFit:"cover",width:"100%",height:"100%"},src:e.thumbnail,alt:(a=t.alt)!=null?a:e.name})})}export{c as a};
|
package/dist/chunk-U7TL6PST.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as i}from"./chunk-32VQC2BE.mjs";import{jsx as u,jsxs as o}from"react/jsx-runtime";function l(){let{config:n}=i();return u("ul",{"recipe-ingredient-list":"",children:n.ingredients.map((e,t)=>o("li",{"recipe-ingredient":"",children:[e.name," \u2014 ",e.amount.value," ",e.amount.unit]},t))})}export{l as a};
|