@fire-cms/plugin
Advanced tools
+10
-4
@@ -12,9 +12,15 @@ 'use strict'; | ||
| const isNotUndefined = (value) => typeof value !== 'undefined'; | ||
| const PluginRoot = ({ children, plugins, }) => (jsxRuntime.jsx(FireCmsPluginProvider, Object.assign({ plugins: plugins }, { children: plugins | ||
| .map((plugin) => plugin.root) | ||
| const getRoot = (type) => `${type}Root`; | ||
| const FireCmsPluginRoot = ({ type, children, }) => { | ||
| const plugins = useFireCmsPlugin(); | ||
| return plugins | ||
| .map((plugin) => plugin[getRoot(type)]) | ||
| .filter(isNotUndefined) | ||
| .reduceRight((prev, Root) => (jsxRuntime.jsx(Root, { children: prev }, void 0)), children) }), void 0)); | ||
| .reduceRight((prev, Root) => jsxRuntime.jsx(Root, { children: prev }, void 0), jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [" ", children] }, void 0)); | ||
| }; | ||
| const FireCmsCommonPluginRoot = ({ plugins, children, }) => (jsxRuntime.jsx(FireCmsPluginProvider, Object.assign({ plugins: plugins }, { children: jsxRuntime.jsx(FireCmsPluginRoot, Object.assign({ type: "common" }, { children: children }), void 0) }), void 0)); | ||
| exports.PluginRoot = PluginRoot; | ||
| exports.FireCmsCommonPluginRoot = FireCmsCommonPluginRoot; | ||
| exports.FireCmsPluginRoot = FireCmsPluginRoot; | ||
| exports.useFireCmsPlugin = useFireCmsPlugin; | ||
| //# sourceMappingURL=index.js.map |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"index.js","sources":["../../src/context.tsx","../../src/utils.tsx"],"sourcesContent":[null,null],"names":["createReadonly","_jsx"],"mappings":";;;;;;;MAIM,EAAE,QAAQ,EAAE,4BAA4B,EAAE,QAAQ,EAAE,gBAAgB,EAAE,GAC1EA,yBAAc,CAAkB,EAAE,EAAC;AAO9B,MAAM,qBAAqB,GAAG,CAAC,EACpC,QAAQ,EACR,OAAO,GACoB,MAC3BC,eAAC,4BAA4B,kBAAC,KAAK,EAAE,OAAO,gBACzC,QAAQ,YACoB,CAChC;;AChBD,MAAM,cAAc,GAAG,CAAK,KAAQ,KAClC,OAAO,KAAK,KAAK,WAAW,CAAA;MAOjB,UAAU,GAAG,CAAC,EACzB,QAAQ,EACR,OAAO,GACS,MAChBA,eAAC,qBAAqB,kBAAC,OAAO,EAAE,OAAO,gBACpC,OAAO;SACL,GAAG,CAAC,CAAC,MAAM,KAAK,MAAM,CAAC,IAAI,CAAC;SAC5B,MAAM,CAAC,cAAc,CAAC;SACtB,WAAW,CACV,CAAC,IAAI,EAAE,IAAI,MACTA,eAAC,IAAI,cAAE,IAAI,WAAQ,CACpB,EACD,QAAQ,CACT,YACmB;;;;;"} | ||
| {"version":3,"file":"index.js","sources":["../../src/context.tsx","../../src/utils.tsx"],"sourcesContent":[null,null],"names":["createReadonly","_jsx","_jsxs"],"mappings":";;;;;;;MAIM,EAAE,QAAQ,EAAE,4BAA4B,EAAE,QAAQ,EAAE,gBAAgB,EAAE,GAC1EA,yBAAc,CAAkB,EAAE,EAAC;AAO9B,MAAM,qBAAqB,GAAG,CAAC,EACpC,QAAQ,EACR,OAAO,GACoB,MAC3BC,eAAC,4BAA4B,kBAAC,KAAK,EAAE,OAAO,gBACzC,QAAQ,YACoB,CAChC;;ACfD,MAAM,cAAc,GAAG,CAAK,KAAQ,KAClC,OAAO,KAAK,KAAK,WAAW,CAAA;AAI9B,MAAM,OAAO,GAAG,CAAC,IAAoB,KAA8B,GAAG,IAAI,MAAM,CAAA;MAMnE,iBAAiB,GAA+B,CAAC,EAC5D,IAAI,EACJ,QAAQ,GACT;IACC,MAAM,OAAO,GAAG,gBAAgB,EAAE,CAAA;IAElC,OAAO,OAAO;SACX,GAAG,CAAC,CAAC,MAAM,KAAK,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC;SACtC,MAAM,CAAC,cAAc,CAAC;SACtB,WAAW,CACV,CAAC,IAAI,EAAE,IAAI,KAAKA,eAAC,IAAI,cAAE,IAAI,WAAQ,EACnCC,uDAAI,QAAQ,YAAI,CACjB,CAAA;AACL,EAAC;MAMY,uBAAuB,GAAqC,CAAC,EACxE,OAAO,EACP,QAAQ,GACT,MACCD,eAAC,qBAAqB,kBAAC,OAAO,EAAE,OAAO,gBACrCA,eAAC,iBAAiB,kBAAC,IAAI,EAAC,QAAQ,gBAAE,QAAQ,YAAqB,YACzC;;;;;;"} |
+10
-5
@@ -1,2 +0,2 @@ | ||
| import { jsx } from 'react/jsx-runtime'; | ||
| import { jsx, jsxs, Fragment } from 'react/jsx-runtime'; | ||
| import { createReadonly } from '@fire-cms/react-utils'; | ||
@@ -8,8 +8,13 @@ | ||
| const isNotUndefined = (value) => typeof value !== 'undefined'; | ||
| const PluginRoot = ({ children, plugins, }) => (jsx(FireCmsPluginProvider, Object.assign({ plugins: plugins }, { children: plugins | ||
| .map((plugin) => plugin.root) | ||
| const getRoot = (type) => `${type}Root`; | ||
| const FireCmsPluginRoot = ({ type, children, }) => { | ||
| const plugins = useFireCmsPlugin(); | ||
| return plugins | ||
| .map((plugin) => plugin[getRoot(type)]) | ||
| .filter(isNotUndefined) | ||
| .reduceRight((prev, Root) => (jsx(Root, { children: prev }, void 0)), children) }), void 0)); | ||
| .reduceRight((prev, Root) => jsx(Root, { children: prev }, void 0), jsxs(Fragment, { children: [" ", children] }, void 0)); | ||
| }; | ||
| const FireCmsCommonPluginRoot = ({ plugins, children, }) => (jsx(FireCmsPluginProvider, Object.assign({ plugins: plugins }, { children: jsx(FireCmsPluginRoot, Object.assign({ type: "common" }, { children: children }), void 0) }), void 0)); | ||
| export { PluginRoot, useFireCmsPlugin }; | ||
| export { FireCmsCommonPluginRoot, FireCmsPluginRoot, useFireCmsPlugin }; | ||
| //# sourceMappingURL=index.js.map |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"index.js","sources":["../../src/context.tsx","../../src/utils.tsx"],"sourcesContent":[null,null],"names":["_jsx"],"mappings":";;;MAIM,EAAE,QAAQ,EAAE,4BAA4B,EAAE,QAAQ,EAAE,gBAAgB,EAAE,GAC1E,cAAc,CAAkB,EAAE,EAAC;AAO9B,MAAM,qBAAqB,GAAG,CAAC,EACpC,QAAQ,EACR,OAAO,GACoB,MAC3BA,IAAC,4BAA4B,kBAAC,KAAK,EAAE,OAAO,gBACzC,QAAQ,YACoB,CAChC;;AChBD,MAAM,cAAc,GAAG,CAAK,KAAQ,KAClC,OAAO,KAAK,KAAK,WAAW,CAAA;MAOjB,UAAU,GAAG,CAAC,EACzB,QAAQ,EACR,OAAO,GACS,MAChBA,IAAC,qBAAqB,kBAAC,OAAO,EAAE,OAAO,gBACpC,OAAO;SACL,GAAG,CAAC,CAAC,MAAM,KAAK,MAAM,CAAC,IAAI,CAAC;SAC5B,MAAM,CAAC,cAAc,CAAC;SACtB,WAAW,CACV,CAAC,IAAI,EAAE,IAAI,MACTA,IAAC,IAAI,cAAE,IAAI,WAAQ,CACpB,EACD,QAAQ,CACT,YACmB;;;;"} | ||
| {"version":3,"file":"index.js","sources":["../../src/context.tsx","../../src/utils.tsx"],"sourcesContent":[null,null],"names":["_jsx","_jsxs"],"mappings":";;;MAIM,EAAE,QAAQ,EAAE,4BAA4B,EAAE,QAAQ,EAAE,gBAAgB,EAAE,GAC1E,cAAc,CAAkB,EAAE,EAAC;AAO9B,MAAM,qBAAqB,GAAG,CAAC,EACpC,QAAQ,EACR,OAAO,GACoB,MAC3BA,IAAC,4BAA4B,kBAAC,KAAK,EAAE,OAAO,gBACzC,QAAQ,YACoB,CAChC;;ACfD,MAAM,cAAc,GAAG,CAAK,KAAQ,KAClC,OAAO,KAAK,KAAK,WAAW,CAAA;AAI9B,MAAM,OAAO,GAAG,CAAC,IAAoB,KAA8B,GAAG,IAAI,MAAM,CAAA;MAMnE,iBAAiB,GAA+B,CAAC,EAC5D,IAAI,EACJ,QAAQ,GACT;IACC,MAAM,OAAO,GAAG,gBAAgB,EAAE,CAAA;IAElC,OAAO,OAAO;SACX,GAAG,CAAC,CAAC,MAAM,KAAK,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC;SACtC,MAAM,CAAC,cAAc,CAAC;SACtB,WAAW,CACV,CAAC,IAAI,EAAE,IAAI,KAAKA,IAAC,IAAI,cAAE,IAAI,WAAQ,EACnCC,iCAAI,QAAQ,YAAI,CACjB,CAAA;AACL,EAAC;MAMY,uBAAuB,GAAqC,CAAC,EACxE,OAAO,EACP,QAAQ,GACT,MACCD,IAAC,qBAAqB,kBAAC,OAAO,EAAE,OAAO,gBACrCA,IAAC,iBAAiB,kBAAC,IAAI,EAAC,QAAQ,gBAAE,QAAQ,YAAqB,YACzC;;;;"} |
| export { useFireCmsPlugin } from './context'; | ||
| export { FireCmsMenu, FireCmsPlugin } from './interface'; | ||
| export { PluginRoot, PluginRootProps } from './utils'; | ||
| export * from './utils'; |
@@ -1,2 +0,2 @@ | ||
| import type { ReactNode, SVGProps } from 'react'; | ||
| import type { FC, SVGProps, VFC } from 'react'; | ||
| export interface FireCmsMenu { | ||
@@ -7,10 +7,11 @@ name: string; | ||
| } | ||
| export interface FireCmsPage { | ||
| Page: VFC; | ||
| } | ||
| export interface FireCmsPlugin { | ||
| root?: (props: { | ||
| children: ReactNode; | ||
| }) => JSX.Element; | ||
| getPage?: (slug: string[]) => { | ||
| Page: () => JSX.Element; | ||
| } | undefined; | ||
| commonRoot?: FC; | ||
| cmsRoot?: FC; | ||
| clientRoot?: FC; | ||
| getPage?: (slug: string[]) => FireCmsPage | undefined; | ||
| menus?: FireCmsMenu[]; | ||
| } |
@@ -1,7 +0,12 @@ | ||
| /// <reference types="react" /> | ||
| import type { FC } from 'react'; | ||
| import type { FireCmsPlugin } from './interface'; | ||
| export interface PluginRootProps { | ||
| declare type PluginRootType = 'client' | 'cms' | 'common'; | ||
| export interface FireCmsPluginRootProps { | ||
| type: PluginRootType; | ||
| } | ||
| export declare const FireCmsPluginRoot: FC<FireCmsPluginRootProps>; | ||
| export interface FireCmsCommonPluginRootProps { | ||
| plugins: FireCmsPlugin[]; | ||
| children: JSX.Element; | ||
| } | ||
| export declare const PluginRoot: ({ children, plugins, }: PluginRootProps) => JSX.Element; | ||
| export declare const FireCmsCommonPluginRoot: FC<FireCmsCommonPluginRootProps>; | ||
| export {}; |
+3
-3
| { | ||
| "name": "@fire-cms/plugin", | ||
| "version": "0.0.1", | ||
| "version": "0.0.2", | ||
| "description": "> TODO: description", | ||
@@ -30,3 +30,3 @@ "author": "YutaUra <yuuta3594@outlook.jp>", | ||
| "dependencies": { | ||
| "@fire-cms/react-utils": "^0.0.1" | ||
| "@fire-cms/react-utils": "^0.0.2" | ||
| }, | ||
@@ -40,3 +40,3 @@ "peerDependencies": { | ||
| }, | ||
| "gitHead": "c2701a1c005adaf74dfefc11e458027f45419c25" | ||
| "gitHead": "57735dad2a5b96ea7076d16d675e0b33be7bdd1e" | ||
| } |
6913
26.29%76
28.81%+ Added
- Removed
Updated