@okam/directus-flexible-content 1.2.23 → 1.2.25
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/CHANGELOG.md +58 -0
- package/index.js +1 -1
- package/index.mjs +202 -196
- package/lib/components/FlexibleEditorContent/extensions.d.ts +1 -1
- package/lib/components/FlexibleEditorContent/index.d.ts +5 -4
- package/lib/components/RenderNodes/index.d.ts +6 -5
- package/lib/components/nodes/index.d.ts +2 -1
- package/lib/components/nodes/types.d.ts +4 -2
- package/lib/functions/injectDataIntoContent.d.ts +3 -2
- package/lib/functions/mergeSerializers.d.ts +2 -1
- package/lib/functions/renderView.d.ts +3 -2
- package/lib/functions/types.d.ts +4 -3
- package/lib/types.d.ts +2 -1
- package/package.json +10 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,61 @@
|
|
|
1
|
+
## 1.2.25 (2026-01-14)
|
|
2
|
+
|
|
3
|
+
### 🚀 Features
|
|
4
|
+
|
|
5
|
+
- ⚠️ React 19 + Next.js 15 upgrade for all @okam/* packages ([#369](https://github.com/OKAMca/stack/pull/369))
|
|
6
|
+
- bump ([ab924b9](https://github.com/OKAMca/stack/commit/ab924b9))
|
|
7
|
+
|
|
8
|
+
### 🩹 Fixes
|
|
9
|
+
|
|
10
|
+
- **directus-flexible-content:** core-lib in external deps ([e44cb2b](https://github.com/OKAMca/stack/commit/e44cb2b))
|
|
11
|
+
- update vite-plugin-dts to version 3 ([5d33c77](https://github.com/OKAMca/stack/commit/5d33c77))
|
|
12
|
+
- package deps error ([b665a45](https://github.com/OKAMca/stack/commit/b665a45))
|
|
13
|
+
- search field type export ([5ab6070](https://github.com/OKAMca/stack/commit/5ab6070))
|
|
14
|
+
- search field icon ([0850fde](https://github.com/OKAMca/stack/commit/0850fde))
|
|
15
|
+
- select controlled ([#280](https://github.com/OKAMca/stack/pull/280))
|
|
16
|
+
|
|
17
|
+
### ⚠️ Breaking Changes
|
|
18
|
+
|
|
19
|
+
- Consumers must now have react and react-dom in their own
|
|
20
|
+
|
|
21
|
+
### 🧱 Updated Dependencies
|
|
22
|
+
|
|
23
|
+
- Updated stack-ui to 1.44.0
|
|
24
|
+
- Updated directus-block to 1.6.3
|
|
25
|
+
|
|
26
|
+
### ❤️ Thank You
|
|
27
|
+
|
|
28
|
+
- Marie-Maxime Tanguay @marie-maxime
|
|
29
|
+
- Pierre-Olivier Clerson @poclerson
|
|
30
|
+
- poclerson
|
|
31
|
+
|
|
32
|
+
## 1.2.24 (2026-01-13)
|
|
33
|
+
|
|
34
|
+
### 🚀 Features
|
|
35
|
+
|
|
36
|
+
- React 19 + Next.js 15 support ([#369](https://github.com/OKAMca/stack/pull/369))
|
|
37
|
+
- bump ([ab924b9](https://github.com/OKAMca/stack/commit/ab924b9))
|
|
38
|
+
|
|
39
|
+
### 🩹 Fixes
|
|
40
|
+
|
|
41
|
+
- **directus-flexible-content:** core-lib in external deps ([e44cb2b](https://github.com/OKAMca/stack/commit/e44cb2b))
|
|
42
|
+
- update vite-plugin-dts to version 3 ([5d33c77](https://github.com/OKAMca/stack/commit/5d33c77))
|
|
43
|
+
- package deps error ([b665a45](https://github.com/OKAMca/stack/commit/b665a45))
|
|
44
|
+
- search field type export ([5ab6070](https://github.com/OKAMca/stack/commit/5ab6070))
|
|
45
|
+
- search field icon ([0850fde](https://github.com/OKAMca/stack/commit/0850fde))
|
|
46
|
+
- select controlled ([#280](https://github.com/OKAMca/stack/pull/280))
|
|
47
|
+
|
|
48
|
+
### 🧱 Updated Dependencies
|
|
49
|
+
|
|
50
|
+
- Updated stack-ui to 1.43.0
|
|
51
|
+
- Updated directus-block to 1.6.2
|
|
52
|
+
|
|
53
|
+
### ❤️ Thank You
|
|
54
|
+
|
|
55
|
+
- Marie-Maxime Tanguay @marie-maxime
|
|
56
|
+
- Pierre-Olivier Clerson @poclerson
|
|
57
|
+
- poclerson
|
|
58
|
+
|
|
1
59
|
## 1.2.23 (2025-11-27)
|
|
2
60
|
|
|
3
61
|
### 🚀 Features
|
package/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const g=require("react/jsx-runtime"),H=require("@tanstack/react-query"),v=require("radashi"),R=require("graphql-request"),A=require("@okam/stack-ui"),K=require("react"),B=require("@tiptap/core"),V=require("@tiptap/extension-blockquote"),X=require("@tiptap/extension-bold"),J=require("@tiptap/extension-bullet-list"),W=require("@tiptap/extension-code"),$=require("@tiptap/extension-code-block"),Y=require("@tiptap/extension-document"),Z=require("@tiptap/extension-hard-break"),ee=require("@tiptap/extension-heading"),te=require("@tiptap/extension-horizontal-rule"),ne=require("@tiptap/extension-italic"),re=require("@tiptap/extension-link"),oe=require("@tiptap/extension-list-item"),ie=require("@tiptap/extension-ordered-list"),se=require("@tiptap/extension-paragraph"),ce=require("@tiptap/extension-strike"),ae=require("@tiptap/extension-subscript"),le=require("@tiptap/extension-superscript"),ue=require("@tiptap/extension-table"),de=require("@tiptap/extension-table-cell"),me=require("@tiptap/extension-table-header"),fe=require("@tiptap/extension-table-row"),pe=require("@tiptap/extension-text"),ge=require("@tiptap/extension-text-align");function M(e,n){return n}class q{constructor(n,r,t){this.nameSpace="[STACK]",this.suppressConsole=!1,this.env=process.env.NODE_ENV,this.nameSpace=n??this.nameSpace,this.suppressConsole=t??this.suppressConsole,this.logger=r??this.internalLogger}internalLogger(n,r,t){this.env!=="production"&&console[r||"log"](`${this.nameSpace} ${n}`.trimStart(),t??"")}setLogger(n){this.logger=(r,t,i)=>{this.suppressConsole&&this.internalLogger(r,t,i),n(r,t,i)}}static getInstance(){return q.instance||(q.instance=new q),q.instance}log(n,r,t){this.logger(n,r,t)}}q.getInstance();const ke=(e,n,r=!1)=>{const t=new q(e,n,r);return t.log("Logger initialized","info"),t},ye=ke("[DirectusQuery]"),be=process.env.NEXT_PUBLIC_GRAPHQL_URL,Ne=process.env.NEXT_SERVER_GRAPHQL_URL,qe=process.env.NEXT_GRAPHQL_URL_ADMIN,Te=process.env.NEXT_PUBLIC_API_TOKEN??"",he=process.env.NEXT_PUBLIC_API_TOKEN,_=new R.GraphQLClient(Ne||be,{credentials:"include",mode:"cors",fetch,headers:{Authorization:`Bearer ${Te}`}});new R.GraphQLClient(qe,{credentials:"include",mode:"cors",fetch,headers:{Authorization:`Bearer ${he}`}});new H.QueryClient({queryCache:new H.QueryCache({onError:e=>{ye.log("QueryClient Error","error",{error:e})}}),defaultOptions:{queries:{staleTime:5*1e3}}});function Q(e,n,r=_){return r.request(e,{...n})}process.env.NEXT_PUBLIC_GRAPHQL_URL;process.env.NEXT_PUBLIC_API_TOKEN;const z={kind:"Document",definitions:[{kind:"FragmentDefinition",name:{kind:"Name",value:"BlockSettings"},typeCondition:{kind:"NamedType",name:{kind:"Name",value:"block_settings"}},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"tokens"}},{kind:"Field",name:{kind:"Name",value:"variant"}}]}}]};function I(e){return!!e}function Be(e){const{id:n,settings:r,...t}=e??{};return v.isEmpty(t)}async function Se(e,n=_){const{document:r,blockKey:t,variables:i}=e;if(!r||!I(i))return null;const o=await Q(r,i,n);return!o||typeof o!="object"||!t?null:o[t]}async function ve(e,n=_){const{document:r,item:t,blockKey:i,variables:o}=e;if(t){if(!Be(t))return t;const a={id:t.id,...o};return I(a)?Se({...e,variables:a}):null}if(!r||!I(o))return null;const c=await Q(r,o,n);return!c||typeof c!="object"||!i?null:c[i]}function _e(e){return e instanceof R.GraphQLClient}async function Le(e,n,r=_){const t=v.get(e,"item"),i=_e(r),o=v.get(e,"document"),c=v.get(e,"variables"),s=await ve({item:t,blockKey:n,document:o??(i?void 0:r),variables:c},i?r:void 0),{tokens:a}=M(z,s==null?void 0:s.settings)??{};return{...s,cmsTokens:a}}function xe(e,...n){return n.reduce((t,i)=>i?{components:{...t.components,...i.components}}:t,e)}const Ee=e=>{var N,m,h;const{item:n,collection:r,config:t,variables:i,defaultVariant:o,...c}=e;if(!r||!t)return null;const s=(N=t==null?void 0:t.components)==null?void 0:N[r];if(!s)return null;const{settings:a}=n??{},u=(n==null?void 0:n.id)??(i==null?void 0:i.id);if(!u)return null;const{variant:p}=M(z,a)??{},f=((m=s.getVariant)==null?void 0:m.call(s,e))??p??o,{default:k,document:d}=s,b=((h=s.variants)==null?void 0:h[f??""])??k;return b?g.jsx(b,{document:d,config:t,collection:r,item:n,...u?{variables:{...i,id:u}}:{variables:i},...c},u):null},Ae=async e=>{const n="block_wysiwygs_by_id",{themeName:r="wysiwyg",tokens:t}=e,{content:i,title:o,level:c,cmsTokens:s}=await Le(e,n);return!i&&!(o&&c)?null:g.jsxs(g.Fragment,{children:[o&&c&&g.jsx(A.Box,{as:"span",themeName:r,tokens:{...t,...s},children:K.createElement(c,{},o)}),i&&g.jsx(A.WysiwygBlock,{themeName:r,tokens:{...t,...s},content:i})]})},Ie={block_wysiwygs:{default:e=>g.jsx(Ae,{...e})}},Re={components:{...Ie}},O=e=>{const{children:n,config:r,...t}=e,i=xe(Re,r),o=s=>n?n({...t,...s,config:i}):g.jsx(Ee,{...t,...s,config:i});if("blocks"in e){const{blocks:s}=e;return s.map(o)}const{block:c}=e;return o(c)},we=(e,n,r="id",t="item")=>{const i=o=>{var c,s,a,u,p,f;if(!e&&o)return o;if(!o||!e)return null;if(o.type==="relation-mark"&&((c=o.attrs)!=null&&c.id)||o.type==="relation-block"&&((s=o.attrs)!=null&&s.id)||o.type==="relation-inline-block"&&((a=o.attrs)!=null&&a.id)){const k=(u=e.find(d=>{var y;return(d==null?void 0:d[r])===((y=o.attrs)==null?void 0:y.id)}))==null?void 0:u[t];o.attrs.data=k}return(p=o.content)==null||p.map(i),(f=o.marks)==null||f.map(i),o};return i(n)},Pe=(e,n)=>{const r=n.map(o=>(o.type==="mark"?B.Mark:B.Node).create({name:o.name,renderHTML({HTMLAttributes:s}){return o.render?[...o.render(s),0]:[o.component??(o.type==="mark"?"span":"div"),s,0]}})),t=r.map(({name:o})=>o);return[...e.filter(o=>t.indexOf(o.name)<0),...r]},D=(e,n,r)=>{const t=r.find(i=>i.type===n&&i.name===e);if(t)return{...t.config,options:t.options}},Ce=(e,n)=>{var t;const r=(t=n.addAttributes)==null?void 0:t.call(n);return!r||!e?e:Object.fromEntries(Object.entries(e).filter(([i])=>{var o;return((o=r[i])==null?void 0:o.rendered)!==!1}))},L=(e,n,r="node")=>{const t=D(e.type,r,n);if(!(t!=null&&t.renderHTML))return[];const i=Ce(e.attrs,t);return t.render?t.render(e):t.renderHTML({node:e,HTMLAttributes:i})},F=(e,n,r)=>{if(e!=null&&e.content&&(e.content=e.content.map(c=>F(c,n,r))),e.type==="text"){if(e.marks){let c;return e.marks.reverse().forEach(s=>{var u;const a=L({...s,attrs:{...s.attrs,data:{...(u=s==null?void 0:s.attrs)==null?void 0:u.data,markText:e.text}}},n,"mark");if(Array.isArray(a)){const[p="span",f=s.attrs]=a,k={...f,data:void 0};c=r(p,k,c||e.text)}else c={...a,text:e.text}}),c}return e.text??""}const t=D(e.type,"node",n);if(t!=null&&t.render)return L(e,n);const[i="div",o=e.attrs]=L(e,n);return r(i,o,e.content)},He=(e,n,r)=>F(e,n,r),x={colspan:"colSpan",rowspan:"rowSpan",textAlign:"textalign"},Oe=(e,n)=>({...Object.fromEntries(Object.entries(n).map(([r,t])=>[(e==null?void 0:e[r])??(x==null?void 0:x[r])??r,t]))}),E={},U=e=>{const{content:n,serializers:r=[],componentSerializers:t=[],renderingNodes:i,remappedAttributes:o,themeName:c,tokens:s,customTheme:a}=e,u=JSON.parse(JSON.stringify(n)),p=Pe(r,t);return He(u,p,(f,k,d)=>{const y={...k,style:void 0},b=Oe(o,y),N=f,m=(i==null?void 0:i[N])??(E==null?void 0:E[N]);return m?m({children:d,attrs:b,themeName:c,tokens:s,customTheme:a}):g.jsx(A.Box,{as:f,...b,themeName:c,tokens:s,customTheme:a,children:d},JSON.stringify(d))})},Me=[Y,pe,se,Z,ee,$,J,ie,oe,V,te,re,X,ne,ce,W,ue.Table,me.TableHeader,fe.TableRow,de.TableCell,ge,ae,le],Qe=e=>{const{jsonContent:n,editorNodes:r,serializers:t,nodes:i,config:o,relationMarksConfig:c,themeName:s,tokens:a,customTheme:u,remappedAttributes:p}=e,f=we(r,n),k=t??[...Me]??[],d=(m,h)=>{var w,P,C;const{attrs:l}=m,G=`${(w=l==null?void 0:l.collection)==null?void 0:w.replace("related_","")}_id`;if(l!=null&&l.data){if(!((P=l==null?void 0:l.data)!=null&&P.blocks)){const T={collection:l.collection,item:{...l==null?void 0:l.data}};return g.jsx(O,{block:T,config:h},JSON.stringify(T))}const S=(C=l==null?void 0:l.data)==null?void 0:C.blocks,j=S==null?void 0:S.map(T=>({item:T==null?void 0:T[G],collection:l==null?void 0:l.collection}));return g.jsx(O,{blocks:j,config:h},JSON.stringify(S))}return null},y=B.Node.create({name:"relation-block",renderHTML:()=>["relation-block"],render:m=>d(m,o)}),b=B.Node.create({name:"relation-inline-block",renderHTML:()=>["relation-inline-block"],render:m=>d(m,o)}),N=B.Mark.create({name:"relation-mark",type:"relation-mark",renderHTML:()=>["relation-mark"],render:m=>d(m,c)});return k.push(y,b,N),f?g.jsx(U,{content:f,serializers:k,renderingNodes:i,themeName:s,tokens:a,customTheme:u,remappedAttributes:p}):null};exports.FlexibleEditorContent=Qe;exports.RenderNodes=U;
|
package/index.mjs
CHANGED
|
@@ -1,79 +1,79 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { QueryClient as
|
|
3
|
-
import { isEmpty as
|
|
4
|
-
import { GraphQLClient as
|
|
5
|
-
import { Box as
|
|
6
|
-
import
|
|
7
|
-
import { Mark as
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import
|
|
1
|
+
import { jsx as k, jsxs as G, Fragment as V } from "react/jsx-runtime";
|
|
2
|
+
import { QueryClient as X, QueryCache as J } from "@tanstack/react-query";
|
|
3
|
+
import { isEmpty as W, get as v } from "radashi";
|
|
4
|
+
import { GraphQLClient as P } from "graphql-request";
|
|
5
|
+
import { Box as x, WysiwygBlock as $ } from "@okam/stack-ui";
|
|
6
|
+
import j from "react";
|
|
7
|
+
import { Mark as q, Node as I } from "@tiptap/core";
|
|
8
|
+
import Y from "@tiptap/extension-blockquote";
|
|
9
|
+
import Z from "@tiptap/extension-bold";
|
|
10
|
+
import ee from "@tiptap/extension-bullet-list";
|
|
11
|
+
import te from "@tiptap/extension-code";
|
|
12
|
+
import ne from "@tiptap/extension-code-block";
|
|
13
13
|
import re from "@tiptap/extension-document";
|
|
14
|
-
import
|
|
15
|
-
import
|
|
16
|
-
import
|
|
17
|
-
import
|
|
18
|
-
import
|
|
19
|
-
import
|
|
20
|
-
import
|
|
21
|
-
import
|
|
22
|
-
import
|
|
23
|
-
import
|
|
14
|
+
import oe from "@tiptap/extension-hard-break";
|
|
15
|
+
import ie from "@tiptap/extension-heading";
|
|
16
|
+
import se from "@tiptap/extension-horizontal-rule";
|
|
17
|
+
import ce from "@tiptap/extension-italic";
|
|
18
|
+
import ae from "@tiptap/extension-link";
|
|
19
|
+
import le from "@tiptap/extension-list-item";
|
|
20
|
+
import me from "@tiptap/extension-ordered-list";
|
|
21
|
+
import ue from "@tiptap/extension-paragraph";
|
|
22
|
+
import fe from "@tiptap/extension-strike";
|
|
23
|
+
import pe from "@tiptap/extension-subscript";
|
|
24
24
|
import de from "@tiptap/extension-superscript";
|
|
25
|
-
import { Table as
|
|
25
|
+
import { Table as ge } from "@tiptap/extension-table";
|
|
26
26
|
import { TableCell as ke } from "@tiptap/extension-table-cell";
|
|
27
|
-
import { TableHeader as
|
|
28
|
-
import { TableRow as
|
|
29
|
-
import
|
|
30
|
-
import
|
|
31
|
-
function
|
|
32
|
-
return
|
|
27
|
+
import { TableHeader as ye } from "@tiptap/extension-table-header";
|
|
28
|
+
import { TableRow as Ne } from "@tiptap/extension-table-row";
|
|
29
|
+
import be from "@tiptap/extension-text";
|
|
30
|
+
import Te from "@tiptap/extension-text-align";
|
|
31
|
+
function z(e, n) {
|
|
32
|
+
return n;
|
|
33
33
|
}
|
|
34
34
|
class T {
|
|
35
|
-
constructor(
|
|
36
|
-
this.nameSpace = "[STACK]", this.suppressConsole = !1, this.env = process.env.NODE_ENV, this.nameSpace =
|
|
35
|
+
constructor(n, r, t) {
|
|
36
|
+
this.nameSpace = "[STACK]", this.suppressConsole = !1, this.env = process.env.NODE_ENV, this.nameSpace = n ?? this.nameSpace, this.suppressConsole = t ?? this.suppressConsole, this.logger = r ?? this.internalLogger;
|
|
37
37
|
}
|
|
38
|
-
internalLogger(
|
|
39
|
-
this.env !== "production" && console[
|
|
38
|
+
internalLogger(n, r, t) {
|
|
39
|
+
this.env !== "production" && console[r || "log"](`${this.nameSpace} ${n}`.trimStart(), t ?? "");
|
|
40
40
|
}
|
|
41
|
-
setLogger(
|
|
42
|
-
this.logger = (
|
|
43
|
-
this.suppressConsole && this.internalLogger(
|
|
41
|
+
setLogger(n) {
|
|
42
|
+
this.logger = (r, t, i) => {
|
|
43
|
+
this.suppressConsole && this.internalLogger(r, t, i), n(r, t, i);
|
|
44
44
|
};
|
|
45
45
|
}
|
|
46
46
|
static getInstance() {
|
|
47
47
|
return T.instance || (T.instance = new T()), T.instance;
|
|
48
48
|
}
|
|
49
|
-
log(
|
|
50
|
-
this.logger(
|
|
49
|
+
log(n, r, t) {
|
|
50
|
+
this.logger(n, r, t);
|
|
51
51
|
}
|
|
52
52
|
}
|
|
53
53
|
T.getInstance();
|
|
54
|
-
const
|
|
55
|
-
const t = new T(e,
|
|
54
|
+
const he = (e, n, r = !1) => {
|
|
55
|
+
const t = new T(e, n, r);
|
|
56
56
|
return t.log("Logger initialized", "info"), t;
|
|
57
|
-
},
|
|
57
|
+
}, Be = he("[DirectusQuery]"), Se = process.env.NEXT_PUBLIC_GRAPHQL_URL, _e = process.env.NEXT_SERVER_GRAPHQL_URL, ve = process.env.NEXT_GRAPHQL_URL_ADMIN, Le = process.env.NEXT_PUBLIC_API_TOKEN ?? "", Ee = process.env.NEXT_PUBLIC_API_TOKEN, _ = new P(_e || Se, {
|
|
58
58
|
credentials: "include",
|
|
59
59
|
mode: "cors",
|
|
60
60
|
fetch,
|
|
61
61
|
headers: {
|
|
62
|
-
Authorization: `Bearer ${
|
|
62
|
+
Authorization: `Bearer ${Le}`
|
|
63
63
|
}
|
|
64
64
|
});
|
|
65
|
-
new
|
|
65
|
+
new P(ve, {
|
|
66
66
|
credentials: "include",
|
|
67
67
|
mode: "cors",
|
|
68
68
|
fetch,
|
|
69
69
|
headers: {
|
|
70
|
-
Authorization: `Bearer ${
|
|
70
|
+
Authorization: `Bearer ${Ee}`
|
|
71
71
|
}
|
|
72
72
|
});
|
|
73
|
-
new
|
|
74
|
-
queryCache: new
|
|
73
|
+
new X({
|
|
74
|
+
queryCache: new J({
|
|
75
75
|
onError: (e) => {
|
|
76
|
-
|
|
76
|
+
Be.log("QueryClient Error", "error", { error: e });
|
|
77
77
|
}
|
|
78
78
|
}),
|
|
79
79
|
defaultOptions: {
|
|
@@ -82,286 +82,292 @@ new V({
|
|
|
82
82
|
}
|
|
83
83
|
}
|
|
84
84
|
});
|
|
85
|
-
function
|
|
86
|
-
return
|
|
87
|
-
...
|
|
85
|
+
function D(e, n, r = _) {
|
|
86
|
+
return r.request(e, {
|
|
87
|
+
...n
|
|
88
88
|
});
|
|
89
89
|
}
|
|
90
90
|
process.env.NEXT_PUBLIC_GRAPHQL_URL;
|
|
91
91
|
process.env.NEXT_PUBLIC_API_TOKEN;
|
|
92
|
-
|
|
92
|
+
const F = { kind: "Document", definitions: [{ kind: "FragmentDefinition", name: { kind: "Name", value: "BlockSettings" }, typeCondition: { kind: "NamedType", name: { kind: "Name", value: "block_settings" } }, selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "tokens" } }, { kind: "Field", name: { kind: "Name", value: "variant" } }] } }] };
|
|
93
|
+
function w(e) {
|
|
93
94
|
return !!e;
|
|
94
95
|
}
|
|
95
96
|
function Ae(e) {
|
|
96
|
-
const { id:
|
|
97
|
-
return
|
|
97
|
+
const { id: n, settings: r, ...t } = e ?? {};
|
|
98
|
+
return W(t);
|
|
98
99
|
}
|
|
99
|
-
async function Ie(e) {
|
|
100
|
-
const { document: r, blockKey:
|
|
101
|
-
if (!r || !
|
|
102
|
-
const
|
|
103
|
-
return !
|
|
100
|
+
async function Ie(e, n = _) {
|
|
101
|
+
const { document: r, blockKey: t, variables: i } = e;
|
|
102
|
+
if (!r || !w(i)) return null;
|
|
103
|
+
const o = await D(r, i, n);
|
|
104
|
+
return !o || typeof o != "object" || !t ? null : o[t];
|
|
104
105
|
}
|
|
105
|
-
async function we(e) {
|
|
106
|
-
const { document: r, item:
|
|
107
|
-
if (
|
|
108
|
-
if (!Ae(
|
|
109
|
-
return
|
|
110
|
-
const
|
|
111
|
-
return
|
|
106
|
+
async function we(e, n = _) {
|
|
107
|
+
const { document: r, item: t, blockKey: i, variables: o } = e;
|
|
108
|
+
if (t) {
|
|
109
|
+
if (!Ae(t))
|
|
110
|
+
return t;
|
|
111
|
+
const a = { id: t.id, ...o };
|
|
112
|
+
return w(a) ? Ie({
|
|
112
113
|
...e,
|
|
113
|
-
variables:
|
|
114
|
+
variables: a
|
|
114
115
|
}) : null;
|
|
115
116
|
}
|
|
116
|
-
if (!r || !
|
|
117
|
-
const
|
|
118
|
-
return !
|
|
117
|
+
if (!r || !w(o)) return null;
|
|
118
|
+
const c = await D(r, o, n);
|
|
119
|
+
return !c || typeof c != "object" || !i ? null : c[i];
|
|
120
|
+
}
|
|
121
|
+
function Pe(e) {
|
|
122
|
+
return e instanceof P;
|
|
119
123
|
}
|
|
120
|
-
function
|
|
121
|
-
|
|
124
|
+
async function Re(e, n, r = _) {
|
|
125
|
+
const t = v(e, "item"), i = Pe(r), o = v(e, "document"), c = v(e, "variables"), s = await we(
|
|
126
|
+
{
|
|
127
|
+
item: t,
|
|
128
|
+
blockKey: n,
|
|
129
|
+
document: o ?? (i ? void 0 : r),
|
|
130
|
+
variables: c
|
|
131
|
+
},
|
|
132
|
+
i ? r : void 0
|
|
133
|
+
), { tokens: a } = z(F, s == null ? void 0 : s.settings) ?? {};
|
|
134
|
+
return { ...s, cmsTokens: a };
|
|
135
|
+
}
|
|
136
|
+
function He(e, ...n) {
|
|
137
|
+
return n.reduce((t, i) => i ? { components: { ...t.components, ...i.components } } : t, e);
|
|
122
138
|
}
|
|
123
|
-
const
|
|
124
|
-
var b,
|
|
125
|
-
const { item:
|
|
126
|
-
if (!
|
|
127
|
-
const s = (b = t == null ? void 0 : t.components) == null ? void 0 : b[
|
|
139
|
+
const Oe = (e) => {
|
|
140
|
+
var b, f, B;
|
|
141
|
+
const { item: n, collection: r, config: t, variables: i, defaultVariant: o, ...c } = e;
|
|
142
|
+
if (!r || !t) return null;
|
|
143
|
+
const s = (b = t == null ? void 0 : t.components) == null ? void 0 : b[r];
|
|
128
144
|
if (!s) return null;
|
|
129
|
-
const { settings:
|
|
145
|
+
const { settings: a } = n ?? {}, m = (n == null ? void 0 : n.id) ?? (i == null ? void 0 : i.id);
|
|
130
146
|
if (!m) return null;
|
|
131
|
-
const { variant: d } =
|
|
132
|
-
return N ? /* @__PURE__ */
|
|
147
|
+
const { variant: d } = z(F, a) ?? {}, p = ((f = s.getVariant) == null ? void 0 : f.call(s, e)) ?? d ?? o, { default: g, document: u } = s, N = ((B = s.variants) == null ? void 0 : B[p ?? ""]) ?? g;
|
|
148
|
+
return N ? /* @__PURE__ */ k(
|
|
133
149
|
N,
|
|
134
150
|
{
|
|
135
|
-
document:
|
|
151
|
+
document: u,
|
|
136
152
|
config: t,
|
|
137
|
-
collection:
|
|
138
|
-
item:
|
|
153
|
+
collection: r,
|
|
154
|
+
item: n,
|
|
139
155
|
...m ? { variables: { ...i, id: m } } : { variables: i },
|
|
140
156
|
...c
|
|
141
157
|
},
|
|
142
158
|
m
|
|
143
159
|
) : null;
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
document: i,
|
|
150
|
-
variables: o
|
|
151
|
-
}), { tokens: s } = q(D, c == null ? void 0 : c.settings) ?? {};
|
|
152
|
-
return { ...c, cmsTokens: s };
|
|
153
|
-
}
|
|
154
|
-
const He = async (e) => {
|
|
155
|
-
const r = "block_wysiwyg_by_id", { themeName: n = "wysiwyg", tokens: t } = e, { content: i, title: o, level: c, cmsTokens: s } = await Re(e, r);
|
|
156
|
-
return !i && !(o && c) ? null : /* @__PURE__ */ G(K, { children: [
|
|
157
|
-
o && c && /* @__PURE__ */ g(C, { as: "span", themeName: n, tokens: { ...t, ...s }, children: $.createElement(c, {}, o) }),
|
|
158
|
-
i && /* @__PURE__ */ g(W, { themeName: n, tokens: { ...t, ...s }, content: i })
|
|
160
|
+
}, Ce = async (e) => {
|
|
161
|
+
const n = "block_wysiwygs_by_id", { themeName: r = "wysiwyg", tokens: t } = e, { content: i, title: o, level: c, cmsTokens: s } = await Re(e, n);
|
|
162
|
+
return !i && !(o && c) ? null : /* @__PURE__ */ G(V, { children: [
|
|
163
|
+
o && c && /* @__PURE__ */ k(x, { as: "span", themeName: r, tokens: { ...t, ...s }, children: j.createElement(c, {}, o) }),
|
|
164
|
+
i && /* @__PURE__ */ k($, { themeName: r, tokens: { ...t, ...s }, content: i })
|
|
159
165
|
] });
|
|
160
|
-
}, Ce = {
|
|
161
|
-
block_wysiwyg: {
|
|
162
|
-
default: (e) => /* @__PURE__ */ g(He, { ...e })
|
|
163
|
-
}
|
|
164
166
|
}, xe = {
|
|
167
|
+
block_wysiwygs: {
|
|
168
|
+
default: (e) => /* @__PURE__ */ k(Ce, { ...e })
|
|
169
|
+
}
|
|
170
|
+
}, qe = {
|
|
165
171
|
components: {
|
|
166
|
-
...
|
|
172
|
+
...xe
|
|
167
173
|
}
|
|
168
|
-
},
|
|
169
|
-
const { children:
|
|
174
|
+
}, C = (e) => {
|
|
175
|
+
const { children: n, config: r, ...t } = e, i = He(qe, r), o = (s) => n ? n({ ...t, ...s, config: i }) : /* @__PURE__ */ k(Oe, { ...t, ...s, config: i });
|
|
170
176
|
if ("blocks" in e) {
|
|
171
177
|
const { blocks: s } = e;
|
|
172
178
|
return s.map(o);
|
|
173
179
|
}
|
|
174
180
|
const { block: c } = e;
|
|
175
181
|
return o(c);
|
|
176
|
-
},
|
|
182
|
+
}, ze = (e, n, r = "id", t = "item") => {
|
|
177
183
|
const i = (o) => {
|
|
178
|
-
var c, s,
|
|
184
|
+
var c, s, a, m, d, p;
|
|
179
185
|
if (!e && o) return o;
|
|
180
186
|
if (!o || !e) return null;
|
|
181
|
-
if (o.type === "relation-mark" && ((c = o.attrs) != null && c.id) || o.type === "relation-block" && ((s = o.attrs) != null && s.id) || o.type === "relation-inline-block" && ((
|
|
182
|
-
const
|
|
187
|
+
if (o.type === "relation-mark" && ((c = o.attrs) != null && c.id) || o.type === "relation-block" && ((s = o.attrs) != null && s.id) || o.type === "relation-inline-block" && ((a = o.attrs) != null && a.id)) {
|
|
188
|
+
const g = (m = e.find((u) => {
|
|
183
189
|
var y;
|
|
184
|
-
return (
|
|
190
|
+
return (u == null ? void 0 : u[r]) === ((y = o.attrs) == null ? void 0 : y.id);
|
|
185
191
|
})) == null ? void 0 : m[t];
|
|
186
|
-
o.attrs.data =
|
|
192
|
+
o.attrs.data = g;
|
|
187
193
|
}
|
|
188
|
-
return (d = o.content) == null || d.map(i), (
|
|
194
|
+
return (d = o.content) == null || d.map(i), (p = o.marks) == null || p.map(i), o;
|
|
189
195
|
};
|
|
190
|
-
return i(
|
|
191
|
-
},
|
|
192
|
-
const
|
|
196
|
+
return i(n);
|
|
197
|
+
}, De = (e, n) => {
|
|
198
|
+
const r = n.map((o) => (o.type === "mark" ? q : I).create({
|
|
193
199
|
name: o.name,
|
|
194
200
|
// eslint-disable-next-line
|
|
195
201
|
renderHTML({ HTMLAttributes: s }) {
|
|
196
202
|
return o.render ? [...o.render(s), 0] : [o.component ?? (o.type === "mark" ? "span" : "div"), s, 0];
|
|
197
203
|
}
|
|
198
|
-
})), t =
|
|
199
|
-
return [...e.filter((o) => t.indexOf(o.name) < 0), ...
|
|
200
|
-
},
|
|
201
|
-
const t =
|
|
204
|
+
})), t = r.map(({ name: o }) => o);
|
|
205
|
+
return [...e.filter((o) => t.indexOf(o.name) < 0), ...r];
|
|
206
|
+
}, M = (e, n, r) => {
|
|
207
|
+
const t = r.find((i) => i.type === n && i.name === e);
|
|
202
208
|
if (t)
|
|
203
209
|
return {
|
|
204
210
|
...t.config,
|
|
205
211
|
options: t.options
|
|
206
212
|
};
|
|
207
|
-
},
|
|
213
|
+
}, Fe = (e, n) => {
|
|
208
214
|
var t;
|
|
209
|
-
const
|
|
210
|
-
return !
|
|
215
|
+
const r = (t = n.addAttributes) == null ? void 0 : t.call(n);
|
|
216
|
+
return !r || !e ? e : Object.fromEntries(Object.entries(e).filter(([i]) => {
|
|
211
217
|
var o;
|
|
212
|
-
return ((o =
|
|
218
|
+
return ((o = r[i]) == null ? void 0 : o.rendered) !== !1;
|
|
213
219
|
}));
|
|
214
|
-
},
|
|
215
|
-
const t =
|
|
220
|
+
}, L = (e, n, r = "node") => {
|
|
221
|
+
const t = M(e.type, r, n);
|
|
216
222
|
if (!(t != null && t.renderHTML)) return [];
|
|
217
|
-
const i =
|
|
223
|
+
const i = Fe(e.attrs, t);
|
|
218
224
|
return t.render ? t.render(e) : t.renderHTML({
|
|
219
225
|
node: e,
|
|
220
226
|
HTMLAttributes: i
|
|
221
227
|
});
|
|
222
|
-
},
|
|
223
|
-
if (e != null && e.content && (e.content = e.content.map((c) =>
|
|
228
|
+
}, Q = (e, n, r) => {
|
|
229
|
+
if (e != null && e.content && (e.content = e.content.map((c) => Q(c, n, r))), e.type === "text") {
|
|
224
230
|
if (e.marks) {
|
|
225
231
|
let c;
|
|
226
232
|
return e.marks.reverse().forEach((s) => {
|
|
227
233
|
var m;
|
|
228
|
-
const
|
|
234
|
+
const a = L(
|
|
229
235
|
{ ...s, attrs: { ...s.attrs, data: { ...(m = s == null ? void 0 : s.attrs) == null ? void 0 : m.data, markText: e.text } } },
|
|
230
|
-
|
|
236
|
+
n,
|
|
231
237
|
"mark"
|
|
232
238
|
);
|
|
233
|
-
if (Array.isArray(
|
|
234
|
-
const [d = "span",
|
|
235
|
-
c =
|
|
239
|
+
if (Array.isArray(a)) {
|
|
240
|
+
const [d = "span", p = s.attrs] = a, g = { ...p, data: void 0 };
|
|
241
|
+
c = r(d, g, c || e.text);
|
|
236
242
|
} else
|
|
237
|
-
c = { ...
|
|
243
|
+
c = { ...a, text: e.text };
|
|
238
244
|
}), c;
|
|
239
245
|
}
|
|
240
246
|
return e.text ?? "";
|
|
241
247
|
}
|
|
242
|
-
const t =
|
|
248
|
+
const t = M(e.type, "node", n);
|
|
243
249
|
if (t != null && t.render)
|
|
244
|
-
return
|
|
245
|
-
const [i = "div", o = e.attrs] =
|
|
246
|
-
return
|
|
247
|
-
},
|
|
250
|
+
return L(e, n);
|
|
251
|
+
const [i = "div", o = e.attrs] = L(e, n);
|
|
252
|
+
return r(i, o, e.content);
|
|
253
|
+
}, Me = (e, n, r) => Q(e, n, r), E = {
|
|
248
254
|
colspan: "colSpan",
|
|
249
255
|
rowspan: "rowSpan",
|
|
250
256
|
textAlign: "textalign"
|
|
251
|
-
},
|
|
257
|
+
}, Qe = (e, n) => ({
|
|
252
258
|
...Object.fromEntries(
|
|
253
|
-
Object.entries(
|
|
259
|
+
Object.entries(n).map(([r, t]) => [(e == null ? void 0 : e[r]) ?? (E == null ? void 0 : E[r]) ?? r, t])
|
|
254
260
|
)
|
|
255
|
-
}),
|
|
261
|
+
}), A = {}, Ue = (e) => {
|
|
256
262
|
const {
|
|
257
|
-
content:
|
|
258
|
-
serializers:
|
|
263
|
+
content: n,
|
|
264
|
+
serializers: r = [],
|
|
259
265
|
componentSerializers: t = [],
|
|
260
266
|
renderingNodes: i,
|
|
261
267
|
remappedAttributes: o,
|
|
262
268
|
themeName: c,
|
|
263
269
|
tokens: s,
|
|
264
|
-
customTheme:
|
|
265
|
-
} = e, m = JSON.parse(JSON.stringify(
|
|
266
|
-
return
|
|
270
|
+
customTheme: a
|
|
271
|
+
} = e, m = JSON.parse(JSON.stringify(n)), d = De(r, t);
|
|
272
|
+
return Me(
|
|
267
273
|
m,
|
|
268
274
|
d,
|
|
269
275
|
// @ts-expect-error Expects ReactNode
|
|
270
|
-
(
|
|
276
|
+
(p, g, u) => {
|
|
271
277
|
const y = {
|
|
272
|
-
...
|
|
278
|
+
...g,
|
|
273
279
|
style: void 0
|
|
274
|
-
}, N =
|
|
275
|
-
return
|
|
276
|
-
|
|
280
|
+
}, N = Qe(o, y), b = p, f = (i == null ? void 0 : i[b]) ?? (A == null ? void 0 : A[b]);
|
|
281
|
+
return f ? f({ children: u, attrs: N, themeName: c, tokens: s, customTheme: a }) : /* @__PURE__ */ k(
|
|
282
|
+
x,
|
|
277
283
|
{
|
|
278
|
-
as:
|
|
284
|
+
as: p,
|
|
279
285
|
...N,
|
|
280
286
|
themeName: c,
|
|
281
287
|
tokens: s,
|
|
282
|
-
customTheme:
|
|
283
|
-
children:
|
|
288
|
+
customTheme: a,
|
|
289
|
+
children: u
|
|
284
290
|
},
|
|
285
|
-
JSON.stringify(
|
|
291
|
+
JSON.stringify(u)
|
|
286
292
|
);
|
|
287
293
|
}
|
|
288
294
|
);
|
|
289
|
-
},
|
|
295
|
+
}, Ke = [
|
|
290
296
|
re,
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
ne,
|
|
297
|
+
be,
|
|
298
|
+
ue,
|
|
294
299
|
oe,
|
|
295
|
-
te,
|
|
296
|
-
Z,
|
|
297
|
-
le,
|
|
298
|
-
ae,
|
|
299
|
-
j,
|
|
300
300
|
ie,
|
|
301
|
-
|
|
301
|
+
ne,
|
|
302
|
+
ee,
|
|
303
|
+
me,
|
|
304
|
+
le,
|
|
302
305
|
Y,
|
|
303
306
|
se,
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
+
ae,
|
|
308
|
+
Z,
|
|
309
|
+
ce,
|
|
310
|
+
fe,
|
|
311
|
+
te,
|
|
307
312
|
ge,
|
|
308
313
|
ye,
|
|
314
|
+
Ne,
|
|
309
315
|
ke,
|
|
310
|
-
|
|
311
|
-
|
|
316
|
+
Te,
|
|
317
|
+
pe,
|
|
312
318
|
de
|
|
313
|
-
],
|
|
319
|
+
], Bt = (e) => {
|
|
314
320
|
const {
|
|
315
|
-
jsonContent:
|
|
316
|
-
editorNodes:
|
|
321
|
+
jsonContent: n,
|
|
322
|
+
editorNodes: r,
|
|
317
323
|
serializers: t,
|
|
318
324
|
nodes: i,
|
|
319
325
|
config: o,
|
|
320
326
|
relationMarksConfig: c,
|
|
321
327
|
themeName: s,
|
|
322
|
-
tokens:
|
|
328
|
+
tokens: a,
|
|
323
329
|
customTheme: m,
|
|
324
330
|
remappedAttributes: d
|
|
325
|
-
} = e,
|
|
326
|
-
var
|
|
327
|
-
const { attrs:
|
|
328
|
-
if (
|
|
329
|
-
if (!((
|
|
330
|
-
const h = { collection:
|
|
331
|
-
return /* @__PURE__ */
|
|
331
|
+
} = e, p = ze(r, n), g = t ?? [...Ke] ?? [], u = (f, B) => {
|
|
332
|
+
var R, H, O;
|
|
333
|
+
const { attrs: l } = f, U = `${(R = l == null ? void 0 : l.collection) == null ? void 0 : R.replace("related_", "")}_id`;
|
|
334
|
+
if (l != null && l.data) {
|
|
335
|
+
if (!((H = l == null ? void 0 : l.data) != null && H.blocks)) {
|
|
336
|
+
const h = { collection: l.collection, item: { ...l == null ? void 0 : l.data } };
|
|
337
|
+
return /* @__PURE__ */ k(C, { block: h, config: B }, JSON.stringify(h));
|
|
332
338
|
}
|
|
333
|
-
const S = (
|
|
334
|
-
return /* @__PURE__ */
|
|
339
|
+
const S = (O = l == null ? void 0 : l.data) == null ? void 0 : O.blocks, K = S == null ? void 0 : S.map((h) => ({ item: h == null ? void 0 : h[U], collection: l == null ? void 0 : l.collection }));
|
|
340
|
+
return /* @__PURE__ */ k(C, { blocks: K, config: B }, JSON.stringify(S));
|
|
335
341
|
}
|
|
336
342
|
return null;
|
|
337
|
-
}, y =
|
|
343
|
+
}, y = I.create({
|
|
338
344
|
name: "relation-block",
|
|
339
345
|
renderHTML: () => ["relation-block"],
|
|
340
|
-
render: (
|
|
341
|
-
}), N =
|
|
346
|
+
render: (f) => u(f, o)
|
|
347
|
+
}), N = I.create({
|
|
342
348
|
name: "relation-inline-block",
|
|
343
349
|
renderHTML: () => ["relation-inline-block"],
|
|
344
|
-
render: (
|
|
345
|
-
}), b =
|
|
350
|
+
render: (f) => u(f, o)
|
|
351
|
+
}), b = q.create({
|
|
346
352
|
name: "relation-mark",
|
|
347
353
|
type: "relation-mark",
|
|
348
354
|
renderHTML: () => ["relation-mark"],
|
|
349
|
-
render: (
|
|
355
|
+
render: (f) => u(f, c)
|
|
350
356
|
});
|
|
351
|
-
return
|
|
352
|
-
|
|
357
|
+
return g.push(y, N, b), p ? /* @__PURE__ */ k(
|
|
358
|
+
Ue,
|
|
353
359
|
{
|
|
354
|
-
content:
|
|
355
|
-
serializers:
|
|
360
|
+
content: p,
|
|
361
|
+
serializers: g,
|
|
356
362
|
renderingNodes: i,
|
|
357
363
|
themeName: s,
|
|
358
|
-
tokens:
|
|
364
|
+
tokens: a,
|
|
359
365
|
customTheme: m,
|
|
360
366
|
remappedAttributes: d
|
|
361
367
|
}
|
|
362
368
|
) : null;
|
|
363
369
|
};
|
|
364
370
|
export {
|
|
365
|
-
|
|
366
|
-
|
|
371
|
+
Bt as FlexibleEditorContent,
|
|
372
|
+
Ue as RenderNodes
|
|
367
373
|
};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const _default: (import(
|
|
1
|
+
declare const _default: (import('@tiptap/core').Node<any, any> | import('@tiptap/core').Extension<import('@tiptap/extension-text-align').TextAlignOptions, any> | import('@tiptap/core').Mark<import('@tiptap/extension-subscript').SubscriptExtensionOptions, any>)[];
|
|
2
2
|
export default _default;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
1
|
+
import { TBlockSerializerConfig } from '../../../../../directus-block/src/index.ts';
|
|
2
|
+
import { TDefaultComponent } from '../../../../../../stack/stack-ui/src/index.ts';
|
|
3
|
+
import { JSONContent, Extensions, EditorNodes } from '../../functions/types';
|
|
4
|
+
import { TRenderingNodes } from '../nodes/types';
|
|
5
|
+
|
|
5
6
|
interface FlexibleEditorContentProps extends TDefaultComponent {
|
|
6
7
|
jsonContent: JSONContent;
|
|
7
8
|
editorNodes?: EditorNodes[] | undefined | null;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
1
|
+
import { TDefaultComponent } from '../../../../../../stack/stack-ui/src/index.ts';
|
|
2
|
+
import { ReactNode } from 'react';
|
|
3
|
+
import { JSONContent, Extensions, ReactComponentSerializers } from '../../functions/types';
|
|
4
|
+
import { TRenderingNodes } from '../nodes/types';
|
|
5
|
+
|
|
5
6
|
interface RenderNodesProps extends TDefaultComponent {
|
|
6
7
|
content: JSONContent;
|
|
7
8
|
serializers?: Extensions;
|
|
@@ -9,5 +10,5 @@ interface RenderNodesProps extends TDefaultComponent {
|
|
|
9
10
|
renderingNodes?: TRenderingNodes;
|
|
10
11
|
remappedAttributes?: Record<string, string>;
|
|
11
12
|
}
|
|
12
|
-
declare const RenderNodes:
|
|
13
|
+
declare const RenderNodes: (props: RenderNodesProps) => ReactNode;
|
|
13
14
|
export default RenderNodes;
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { TDefaultComponent } from '../../../../../../stack/stack-ui/src/index.ts';
|
|
2
|
+
import { default as React } from 'react';
|
|
3
|
+
|
|
2
4
|
export interface TBaseRenderingNode extends TDefaultComponent {
|
|
3
5
|
children: React.ReactNode;
|
|
4
6
|
attrs?: Record<string, number | string | boolean | undefined>;
|
|
5
7
|
}
|
|
6
8
|
export type TRenderingNodes = {
|
|
7
|
-
[key in keyof JSX.IntrinsicElements]?: (props: TBaseRenderingNode) => JSX.Element;
|
|
9
|
+
[key in keyof React.JSX.IntrinsicElements]?: (props: TBaseRenderingNode) => React.JSX.Element;
|
|
8
10
|
};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
1
|
+
import { JSONContent } from '@tiptap/core';
|
|
2
|
+
import { EditorNodes } from './types';
|
|
3
|
+
|
|
3
4
|
declare const injectDataIntoContent: (data: EditorNodes[] | undefined | null, content: JSONContent, primaryKeyField?: string, itemField?: string) => JSONContent | null;
|
|
4
5
|
export default injectDataIntoContent;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { Extensions, ComponentSerializers } from './types';
|
|
2
|
+
|
|
2
3
|
declare const mergeSerializers: <T>(serializers: Extensions, componentSerializers: ComponentSerializers<T>) => Extensions;
|
|
3
4
|
export default mergeSerializers;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { JSONContent, Extensions, RenderedNode, RenderCallback } from './types';
|
|
3
|
+
|
|
3
4
|
declare const renderView: <T>(node: JSONContent, serializers: Extensions, renderCallback: RenderCallback<ReactNode | JSONContent[]>) => RenderedNode<T>;
|
|
4
5
|
export default renderView;
|
package/lib/functions/types.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import { TBlock } from '../../../../directus-block/src/index.ts';
|
|
2
|
+
import { JSONContent, Extensions, AnyExtension } from '@tiptap/core';
|
|
3
|
+
import { ElementType, FunctionComponent, ReactNode } from 'react';
|
|
4
|
+
|
|
4
5
|
export type { JSONContent, Extensions };
|
|
5
6
|
export type RenderedNode<T> = T | string | (T | string)[];
|
|
6
7
|
export type Tag = ElementType;
|
package/lib/types.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@okam/directus-flexible-content",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.25",
|
|
4
4
|
"main": "./index.js",
|
|
5
5
|
"types": "./index.d.ts",
|
|
6
6
|
"exports": {
|
|
@@ -23,8 +23,8 @@
|
|
|
23
23
|
},
|
|
24
24
|
"dependencies": {
|
|
25
25
|
"@nx/vite": "20.2.2",
|
|
26
|
-
"@okam/directus-block": "1.6.
|
|
27
|
-
"@okam/stack-ui": "1.
|
|
26
|
+
"@okam/directus-block": "1.6.3",
|
|
27
|
+
"@okam/stack-ui": "1.44.0",
|
|
28
28
|
"@vitejs/plugin-react": "4.3.4",
|
|
29
29
|
"vite": "^5.0.13",
|
|
30
30
|
"vite-plugin-dts": "~2.3.0",
|
|
@@ -51,7 +51,12 @@
|
|
|
51
51
|
"@tiptap/extension-table-row": "^2.10.3",
|
|
52
52
|
"@tiptap/extension-text": "^2.10.3",
|
|
53
53
|
"@tiptap/extension-text-align": "^2.10.3",
|
|
54
|
-
"@tiptap/core": "^2.10.3"
|
|
55
|
-
|
|
54
|
+
"@tiptap/core": "^2.10.3"
|
|
55
|
+
},
|
|
56
|
+
"peerDependencies": {
|
|
57
|
+
"react": "^18.0.0 || ^19.0.0"
|
|
58
|
+
},
|
|
59
|
+
"devDependencies": {
|
|
60
|
+
"react": "^19.0.0"
|
|
56
61
|
}
|
|
57
62
|
}
|