umwd-components 0.1.296 → 0.1.297
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/node_modules/@strapi/blocks-react-renderer/dist/Block.js +6 -0
- package/dist/node_modules/@strapi/blocks-react-renderer/dist/BlocksRenderer.js +7 -0
- package/dist/node_modules/@strapi/blocks-react-renderer/dist/Text.js +6 -0
- package/dist/src/components/BlockRendererClient.js +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +4 -5
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* UMWD-Components
|
|
3
|
+
* @copyright Jelle Paulus
|
|
4
|
+
* @license MIT
|
|
5
|
+
*/
|
|
6
|
+
import{jsx as t}from"react/jsx-runtime";import{createElement as e}from"react";import{useComponentsContext as r}from"./BlocksRenderer.js";import{Text as n}from"./Text.js";const c=["image"],o=i=>{let{content:p}=i;const{children:l,type:s,...u}=p,{blocks:a,missingBlockTypes:m}=r(),d=a[s];if(!d)return m.includes(s)||(console.warn('[@strapi/block-react-renderer] No component found for block type "'.concat(s,'"')),m.push(s)),null;if(c.includes(s))return t(d,{...u});if("paragraph"===s&&1===l.length&&"text"===l[0].type&&""===l[0].text)return t("br",{});const f=(t=>{const{children:e,type:r,...n}=t;if("code"===r){const e=t=>t.reduce(((t,r)=>"text"===r.type?t.concat(r.text):"link"===r.type?t.concat(e(r.children)):t),"");return{...n,plainText:e(t.children)}}return n})(p);return t(d,{...f,children:l.map(((r,c)=>{if("text"===r.type){const{type:t,...o}=r;return e(n,{...o,key:c})}return t(o,{content:r},c)}))})};export{o as Block};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
/*
|
|
3
|
+
* UMWD-Components
|
|
4
|
+
* @copyright Jelle Paulus
|
|
5
|
+
* @license MIT
|
|
6
|
+
*/
|
|
7
|
+
import{jsx as e}from"react/jsx-runtime";import*as r from"react";import{Block as i}from"./Block.js";const n={blocks:{paragraph:r=>e("p",{children:r.children}),quote:r=>e("blockquote",{children:r.children}),code:r=>e("pre",{children:e("code",{children:r.plainText})}),heading:r=>{let{level:i,children:n}=r;switch(i){case 1:return e("h1",{children:n});case 2:return e("h2",{children:n});case 3:return e("h3",{children:n});case 4:return e("h4",{children:n});case 5:return e("h5",{children:n});case 6:return e("h6",{children:n})}},link:r=>e("a",{href:r.url,children:r.children}),list:r=>"ordered"===r.format?e("ol",{children:r.children}):e("ul",{children:r.children}),"list-item":r=>e("li",{children:r.children}),image:r=>e("img",{src:r.image.url,alt:r.image.alternativeText||void 0})},modifiers:{bold:r=>e("strong",{children:r.children}),italic:r=>e("em",{children:r.children}),underline:r=>e("u",{children:r.children}),strikethrough:r=>e("del",{children:r.children}),code:r=>e("code",{children:r.children})},missingBlockTypes:[],missingModifierTypes:[]},c=r.createContext(n),l=i=>{let{children:l,value:d=n}=i;const t=r.useMemo((()=>d),[d]);return e(c.Provider,{value:t,children:l})};function d(){return r.useContext(c)}const t=c=>{const d={...n.blocks,...c.blocks},t={...n.modifiers,...c.modifiers},h=r.useRef([]),o=r.useRef([]);return e(l,{value:{blocks:d,modifiers:t,missingBlockTypes:h.current,missingModifierTypes:o.current},children:c.content.map(((r,n)=>e(i,{content:r},n)))})};export{t as BlocksRenderer,l as ComponentsProvider,d as useComponentsContext};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* UMWD-Components
|
|
3
|
+
* @copyright Jelle Paulus
|
|
4
|
+
* @license MIT
|
|
5
|
+
*/
|
|
6
|
+
import{jsx as e,Fragment as r}from"react/jsx-runtime";import{useComponentsContext as o}from"./BlocksRenderer.js";const n=n=>{let{text:t,...c}=n;const{modifiers:i,missingModifierTypes:s}=o();return Object.keys(c).reduce(((r,o)=>{if(!c[o])return r;const n=i[o];return n?e(n,{children:r}):(s.includes(o)||(console.warn('[@strapi/block-react-renderer] No component found for modifier "'.concat(o,'"')),s.push(o)),r)}),e(r,{children:t}))};export{n as Text};
|
|
@@ -4,4 +4,4 @@
|
|
|
4
4
|
* @copyright Jelle Paulus
|
|
5
5
|
* @license MIT
|
|
6
6
|
*/
|
|
7
|
-
import e from"react";import{BlocksRenderer as r}from"
|
|
7
|
+
import e from"react";import{BlocksRenderer as r}from"../../node_modules/@strapi/blocks-react-renderer/dist/BlocksRenderer.js";import t from"@mui/material/Typography";function n(n){var a=n.content;return a?e.createElement(r,{content:a,blocks:{paragraph:function(r){var n=r.children;return e.createElement(t,{variant:"body1",sx:{mb:2}},n)},heading:function(r){var n=r.children;switch(r.level){case 1:default:return e.createElement(t,{variant:"h1"},n);case 2:return e.createElement(t,{variant:"h2"},n);case 3:return e.createElement(t,{variant:"h3"},n);case 4:return e.createElement(t,{variant:"h4"},n);case 5:return e.createElement(t,{variant:"h5"},n);case 6:return e.createElement(t,{variant:"h6"},n)}}},modifiers:{bold:function(r){var t=r.children;return e.createElement("strong",null,t)},italic:function(r){var t=r.children;return e.createElement("span",{className:"italic"},t)}}}):null}export{n as BlockRendererClient};
|