@redneckz/wildless-cms-uni-blocks 0.1.0 → 0.1.3
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/Blocks.d.ts +7 -0
- package/dist/Blocks.js +9 -0
- package/dist/Blocks.js.map +1 -0
- package/dist/ContentPage.d.ts +3 -0
- package/dist/ContentPage.js +18 -0
- package/dist/ContentPage.js.map +1 -0
- package/dist/Placeholder.d.ts +6 -0
- package/dist/Placeholder.js +8 -0
- package/dist/Placeholder.js.map +1 -0
- package/dist/Text.d.ts +8 -0
- package/dist/Text.js +8 -0
- package/dist/Text.js.map +1 -0
- package/dist/common.css +1 -0
- package/dist/gatsby/GatsbyPage.d.ts +8 -0
- package/dist/gatsby/GatsbyPage.js +15 -0
- package/dist/gatsby/GatsbyPage.js.map +1 -0
- package/{src/gatsby/index.ts → dist/gatsby/index.d.ts} +0 -1
- package/dist/gatsby/index.js +5 -0
- package/dist/gatsby/index.js.map +1 -0
- package/{src/index.ts → dist/index.d.ts} +0 -2
- package/dist/index.js +7 -0
- package/dist/index.js.map +1 -0
- package/dist/types.d.ts +16 -0
- package/dist/types.js +25 -0
- package/dist/types.js.map +1 -0
- package/lib/Blocks.d.ts +7 -0
- package/lib/Blocks.js +7 -0
- package/lib/Blocks.js.map +1 -0
- package/lib/ContentPage.d.ts +3 -0
- package/lib/ContentPage.js +16 -0
- package/lib/ContentPage.js.map +1 -0
- package/lib/Placeholder.d.ts +6 -0
- package/lib/Placeholder.js +6 -0
- package/lib/Placeholder.js.map +1 -0
- package/lib/Text.d.ts +8 -0
- package/lib/Text.js +6 -0
- package/lib/Text.js.map +1 -0
- package/lib/gatsby/GatsbyPage.d.ts +8 -0
- package/lib/gatsby/GatsbyPage.js +9 -0
- package/lib/gatsby/GatsbyPage.js.map +1 -0
- package/lib/gatsby/index.d.ts +1 -0
- package/lib/gatsby/index.js +2 -0
- package/lib/gatsby/index.js.map +1 -0
- package/lib/index.d.ts +4 -0
- package/lib/index.js +3 -0
- package/lib/index.js.map +1 -0
- package/lib/types.d.ts +16 -0
- package/{src/types.ts → lib/types.js} +3 -16
- package/lib/types.js.map +1 -0
- package/package.json +23 -4
- package/.editorconfig +0 -25
- package/.gitattributes +0 -15
- package/.prettierignore +0 -3
- package/src/Blocks.ts +0 -11
- package/src/ContentPage.tsx +0 -31
- package/src/Placeholder.tsx +0 -12
- package/src/Text.tsx +0 -20
- package/src/common.css +0 -2
- package/src/gatsby/GatsbyPage.tsx +0 -18
- package/tailwind.config.js +0 -7
- package/tsconfig.json +0 -26
package/dist/Blocks.d.ts
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { PlaceholderContent } from './Placeholder';
|
|
2
|
+
import type { TextContent } from './Text';
|
|
3
|
+
export declare type BlockContent = PlaceholderContent | TextContent;
|
|
4
|
+
export declare const Blocks: {
|
|
5
|
+
Text: (props: import("@redneckz/uni-jsx").PropsWithChildren<import("./Text").TextProps, any>, context?: any) => any;
|
|
6
|
+
Placeholder: (props: import("@redneckz/uni-jsx").PropsWithChildren<import("./Placeholder").PlaceholderProps, any>, context?: any) => any;
|
|
7
|
+
};
|
package/dist/Blocks.js
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2
|
+
exports.Blocks = void 0;
|
|
3
|
+
const Placeholder_1 = require("./Placeholder");
|
|
4
|
+
const Text_1 = require("./Text");
|
|
5
|
+
exports.Blocks = {
|
|
6
|
+
Text: Text_1.Text,
|
|
7
|
+
Placeholder: Placeholder_1.Placeholder
|
|
8
|
+
};
|
|
9
|
+
//# sourceMappingURL=Blocks.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Blocks.js","sourceRoot":"","sources":["../src/Blocks.ts"],"names":[],"mappings":";;AACA,+CAA4C;AAE5C,iCAA8B;AAIjB,QAAA,MAAM,GAAG;IACpB,IAAI,EAAJ,WAAI;IACJ,WAAW,EAAX,yBAAW;CACZ,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2
|
+
exports.ContentPage = void 0;
|
|
3
|
+
const jsx_runtime_1 = require("@redneckz/uni-jsx/jsx-runtime");
|
|
4
|
+
const uni_jsx_1 = require("@redneckz/uni-jsx");
|
|
5
|
+
const Blocks_1 = require("./Blocks");
|
|
6
|
+
exports.ContentPage = (0, uni_jsx_1.JSX)(({ style: pageStyle, blocks }) => ((0, jsx_runtime_1.jsx)("section", { className: `grid grid-cols-12 ${style2className(pageStyle)}`, children: blocks && blocks.map(renderBlock) })));
|
|
7
|
+
function renderBlock({ type, style, content, blocks }, i) {
|
|
8
|
+
if (!(type in Blocks_1.Blocks)) {
|
|
9
|
+
console.warn(`No block with "${type}" is registered`);
|
|
10
|
+
return null;
|
|
11
|
+
}
|
|
12
|
+
const BlockComponent = Blocks_1.Blocks[type];
|
|
13
|
+
return ((0, jsx_runtime_1.jsx)(BlockComponent, { className: `border-dashed border-2 border-sky-500 p-4 ${style2className(style)}`, ...content, children: blocks && blocks.map(renderBlock) }, `${type}-${i}`));
|
|
14
|
+
}
|
|
15
|
+
function style2className(style) {
|
|
16
|
+
return style ? style.join(' ') : '';
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=ContentPage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ContentPage.js","sourceRoot":"","sources":["../src/ContentPage.tsx"],"names":[],"mappings":";;;AAAA,+CAAwC;AACxC,qCAAkC;AAIrB,QAAA,WAAW,GAAG,IAAA,aAAG,EAA+B,CAAC,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC,CAC7F,oCAAS,SAAS,EAAE,qBAAqB,eAAe,CAAC,SAAS,CAAC,EAAE,YAClE,MAAM,IAAI,MAAM,CAAC,GAAG,CAAC,WAAW,CAAC,GAC1B,CACX,CAAC,CAAC;AAEH,SAAS,WAAW,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,EAA0B,EAAE,CAAS;IACtF,IAAI,CAAC,CAAC,IAAI,IAAI,eAAM,CAAC,EAAE;QACrB,OAAO,CAAC,IAAI,CAAC,kBAAkB,IAAI,iBAAiB,CAAC,CAAC;QACtD,OAAO,IAAI,CAAC;KACb;IACD,MAAM,cAAc,GAAG,eAAM,CAAC,IAA2B,CAAC,CAAC;IAC3D,OAAO,CACL,uBAAC,cAAc,IAEb,SAAS,EAAE,6CAA6C,eAAe,CAAC,KAAK,CAAC,EAAE,KAC5E,OAAO,YAEV,MAAM,IAAI,MAAM,CAAC,GAAG,CAAC,WAAW,CAAC,IAJ7B,GAAG,IAAI,IAAI,CAAC,EAAE,CAKJ,CAClB,CAAC;AACJ,CAAC;AAED,SAAS,eAAe,CAAC,KAAkC;IACzD,OAAO,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;AACtC,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2
|
+
exports.Placeholder = void 0;
|
|
3
|
+
const jsx_runtime_1 = require("@redneckz/uni-jsx/jsx-runtime");
|
|
4
|
+
const uni_jsx_1 = require("@redneckz/uni-jsx");
|
|
5
|
+
exports.Placeholder = (0, uni_jsx_1.JSX)(({ className, children }) => {
|
|
6
|
+
return (0, jsx_runtime_1.jsx)("div", { className: className || '', children: children });
|
|
7
|
+
});
|
|
8
|
+
//# sourceMappingURL=Placeholder.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Placeholder.js","sourceRoot":"","sources":["../src/Placeholder.tsx"],"names":[],"mappings":";;;AAAA,+CAAwC;AAS3B,QAAA,WAAW,GAAG,IAAA,aAAG,EAAmB,CAAC,EAAE,SAAS,EAAE,QAAQ,EAAE,EAAE,EAAE;IAC3E,OAAO,gCAAK,SAAS,EAAE,SAAS,IAAI,EAAE,YAAG,QAAQ,GAAO,CAAC;AAC3D,CAAC,CAAC,CAAC"}
|
package/dist/Text.d.ts
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export interface TextContent {
|
|
2
|
+
primary?: string;
|
|
3
|
+
secondary?: string;
|
|
4
|
+
}
|
|
5
|
+
export interface TextProps extends TextContent {
|
|
6
|
+
className?: string;
|
|
7
|
+
}
|
|
8
|
+
export declare const Text: (props: import("@redneckz/uni-jsx").PropsWithChildren<TextProps, any>, context?: any) => any;
|
package/dist/Text.js
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2
|
+
exports.Text = void 0;
|
|
3
|
+
const jsx_runtime_1 = require("@redneckz/uni-jsx/jsx-runtime");
|
|
4
|
+
const uni_jsx_1 = require("@redneckz/uni-jsx");
|
|
5
|
+
exports.Text = (0, uni_jsx_1.JSX)(({ className, primary, secondary, children }) => {
|
|
6
|
+
return ((0, jsx_runtime_1.jsxs)("div", { className: className || '', children: [primary && (0, jsx_runtime_1.jsx)("p", { className: "font-bold text-slate-700 leading-snug", children: primary }), secondary && (0, jsx_runtime_1.jsx)("p", { className: "mt-2 text-sm text-slate-600", children: secondary }), children] }));
|
|
7
|
+
});
|
|
8
|
+
//# sourceMappingURL=Text.js.map
|
package/dist/Text.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Text.js","sourceRoot":"","sources":["../src/Text.tsx"],"names":[],"mappings":";;;AAAA,+CAAwC;AAW3B,QAAA,IAAI,GAAG,IAAA,aAAG,EAAY,CAAC,EAAE,SAAS,EAAE,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,EAAE,EAAE;IACjF,OAAO,CACL,iCAAK,SAAS,EAAE,SAAS,IAAI,EAAE,aAC5B,OAAO,IAAI,8BAAG,SAAS,EAAC,uCAAuC,YAAE,OAAO,GAAK,EAC7E,SAAS,IAAI,8BAAG,SAAS,EAAC,6BAA6B,YAAE,SAAS,GAAK,EACvE,QAAQ,IACL,CACP,CAAC;AACJ,CAAC,CAAC,CAAC"}
|
package/dist/common.css
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.mt-2{margin-top:.5rem}.block{display:block}.grid{display:grid}.grid-cols-12{grid-template-columns:repeat(12,minmax(0,1fr))}.border-2{border-width:2px}.border-dashed{border-style:dashed}.border-sky-500{--tw-border-opacity:1;border-color:rgb(14 165 233/var(--tw-border-opacity))}.p-4{padding:1rem}.text-sm{font-size:.875rem;line-height:1.25rem}.font-bold{font-weight:700}.leading-snug{line-height:1.375}.text-slate-700{--tw-text-opacity:1;color:rgb(51 65 85/var(--tw-text-opacity))}.text-slate-600{--tw-text-opacity:1;color:rgb(71 85 105/var(--tw-text-opacity))}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { PageProps } from 'gatsby';
|
|
3
|
+
import type { BlockContent } from '../Blocks';
|
|
4
|
+
import type { ContentPageDef } from '../types';
|
|
5
|
+
import '@redneckz/wildless-cms-uni-blocks/dist/common.css';
|
|
6
|
+
declare type PageData<D extends string> = Record<D, ContentPageDef<BlockContent>>;
|
|
7
|
+
export declare const GatsbyPage: <D extends string>(discriminator: D) => ({ data }: PageProps<PageData<D>, object, unknown, object>) => JSX.Element;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
2
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
3
|
+
};
|
|
4
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
+
exports.GatsbyPage = void 0;
|
|
6
|
+
const jsx_runtime_1 = require("@redneckz/uni-jsx/jsx-runtime");
|
|
7
|
+
const uni_jsx_1 = require("@redneckz/uni-jsx");
|
|
8
|
+
const jsx_runtime_2 = __importDefault(require("react/jsx-runtime"));
|
|
9
|
+
const ContentPage_1 = require("../ContentPage");
|
|
10
|
+
require("@redneckz/wildless-cms-uni-blocks/dist/common.css");
|
|
11
|
+
const { jsx, jsxs } = jsx_runtime_2.default;
|
|
12
|
+
(0, uni_jsx_1.setup)(jsx, jsxs);
|
|
13
|
+
const GatsbyPage = (discriminator) => ({ data }) => (0, jsx_runtime_1.jsx)(ContentPage_1.ContentPage, { ...data[discriminator] });
|
|
14
|
+
exports.GatsbyPage = GatsbyPage;
|
|
15
|
+
//# sourceMappingURL=GatsbyPage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GatsbyPage.js","sourceRoot":"","sources":["../../src/gatsby/GatsbyPage.tsx"],"names":[],"mappings":";;;;;;AAAA,+CAA0C;AAE1C,oEAAwC;AAExC,gDAA6C;AAG7C,6DAA2D;AAE3D,MAAM,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,qBAAc,CAAC;AACrC,IAAA,eAAK,EAAC,GAAG,EAAE,IAAI,CAAC,CAAC;AAIV,MAAM,UAAU,GACrB,CAAmB,aAAgB,EAAE,EAAE,CACvC,CAAC,EAAE,IAAI,EAA0B,EAAE,EAAE,CACnC,uBAAC,yBAAW,OAAK,IAAI,CAAC,aAAa,CAAC,GAAI,CAAC;AAHhC,QAAA,UAAU,cAGsB"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2
|
+
exports.GatsbyPage = void 0;
|
|
3
|
+
var GatsbyPage_1 = require("./GatsbyPage");
|
|
4
|
+
Object.defineProperty(exports, "GatsbyPage", { enumerable: true, get: function () { return GatsbyPage_1.GatsbyPage; } });
|
|
5
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/gatsby/index.ts"],"names":[],"mappings":";;AAAA,2CAA0C;AAAjC,wGAAA,UAAU,OAAA"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2
|
+
exports.ContentPage = exports.Blocks = void 0;
|
|
3
|
+
var Blocks_1 = require("./Blocks");
|
|
4
|
+
Object.defineProperty(exports, "Blocks", { enumerable: true, get: function () { return Blocks_1.Blocks; } });
|
|
5
|
+
var ContentPage_1 = require("./ContentPage");
|
|
6
|
+
Object.defineProperty(exports, "ContentPage", { enumerable: true, get: function () { return ContentPage_1.ContentPage; } });
|
|
7
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;AAGA,mCAAkC;AAAzB,gGAAA,MAAM,OAAA;AAEf,6CAA4C;AAAnC,0GAAA,WAAW,OAAA"}
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export interface BlockDef<BlockContent> {
|
|
2
|
+
type: string;
|
|
3
|
+
style?: string[];
|
|
4
|
+
content?: BlockContent;
|
|
5
|
+
blocks?: BlockDef<BlockContent>[];
|
|
6
|
+
}
|
|
7
|
+
export interface ContentPageDef<BlockContent> {
|
|
8
|
+
title: string;
|
|
9
|
+
slug: string;
|
|
10
|
+
style?: string[];
|
|
11
|
+
blocks?: BlockDef<BlockContent>[];
|
|
12
|
+
}
|
|
13
|
+
export declare const GraphQL: {
|
|
14
|
+
Block: string;
|
|
15
|
+
Page: string;
|
|
16
|
+
};
|
package/dist/types.js
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2
|
+
exports.GraphQL = void 0;
|
|
3
|
+
exports.GraphQL = {
|
|
4
|
+
Block: `
|
|
5
|
+
type BlockContent {
|
|
6
|
+
primary: String
|
|
7
|
+
secondary: String
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
type Block {
|
|
11
|
+
type: String!
|
|
12
|
+
style: [String!]
|
|
13
|
+
content: BlockContent
|
|
14
|
+
blocks: [Block!]
|
|
15
|
+
}
|
|
16
|
+
`,
|
|
17
|
+
Page: `
|
|
18
|
+
title: String!
|
|
19
|
+
slug: String
|
|
20
|
+
date: Date
|
|
21
|
+
style: [String!]
|
|
22
|
+
blocks: [Block!]
|
|
23
|
+
`
|
|
24
|
+
};
|
|
25
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":";;AAca,QAAA,OAAO,GAAG;IACrB,KAAK,EAAE;;;;;;;;;;;;GAYN;IACD,IAAI,EAAE;;;;;;GAML;CACF,CAAC"}
|
package/lib/Blocks.d.ts
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { PlaceholderContent } from './Placeholder';
|
|
2
|
+
import type { TextContent } from './Text';
|
|
3
|
+
export declare type BlockContent = PlaceholderContent | TextContent;
|
|
4
|
+
export declare const Blocks: {
|
|
5
|
+
Text: (props: import("@redneckz/uni-jsx").PropsWithChildren<import("./Text").TextProps, any>, context?: any) => any;
|
|
6
|
+
Placeholder: (props: import("@redneckz/uni-jsx").PropsWithChildren<import("./Placeholder").PlaceholderProps, any>, context?: any) => any;
|
|
7
|
+
};
|
package/lib/Blocks.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Blocks.js","sourceRoot":"","sources":["../src/Blocks.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAE5C,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAI9B,MAAM,CAAC,MAAM,MAAM,GAAG;IACpB,IAAI;IACJ,WAAW;CACZ,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { jsx as _jsx } from "@redneckz/uni-jsx/jsx-runtime";
|
|
2
|
+
import { JSX } from '@redneckz/uni-jsx';
|
|
3
|
+
import { Blocks } from './Blocks';
|
|
4
|
+
export const ContentPage = JSX(({ style: pageStyle, blocks }) => (_jsx("section", { className: `grid grid-cols-12 ${style2className(pageStyle)}`, children: blocks && blocks.map(renderBlock) })));
|
|
5
|
+
function renderBlock({ type, style, content, blocks }, i) {
|
|
6
|
+
if (!(type in Blocks)) {
|
|
7
|
+
console.warn(`No block with "${type}" is registered`);
|
|
8
|
+
return null;
|
|
9
|
+
}
|
|
10
|
+
const BlockComponent = Blocks[type];
|
|
11
|
+
return (_jsx(BlockComponent, { className: `border-dashed border-2 border-sky-500 p-4 ${style2className(style)}`, ...content, children: blocks && blocks.map(renderBlock) }, `${type}-${i}`));
|
|
12
|
+
}
|
|
13
|
+
function style2className(style) {
|
|
14
|
+
return style ? style.join(' ') : '';
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=ContentPage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ContentPage.js","sourceRoot":"","sources":["../src/ContentPage.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AACxC,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAIlC,MAAM,CAAC,MAAM,WAAW,GAAG,GAAG,CAA+B,CAAC,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC,CAC7F,kBAAS,SAAS,EAAE,qBAAqB,eAAe,CAAC,SAAS,CAAC,EAAE,YAClE,MAAM,IAAI,MAAM,CAAC,GAAG,CAAC,WAAW,CAAC,GAC1B,CACX,CAAC,CAAC;AAEH,SAAS,WAAW,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,EAA0B,EAAE,CAAS;IACtF,IAAI,CAAC,CAAC,IAAI,IAAI,MAAM,CAAC,EAAE;QACrB,OAAO,CAAC,IAAI,CAAC,kBAAkB,IAAI,iBAAiB,CAAC,CAAC;QACtD,OAAO,IAAI,CAAC;KACb;IACD,MAAM,cAAc,GAAG,MAAM,CAAC,IAA2B,CAAC,CAAC;IAC3D,OAAO,CACL,KAAC,cAAc,IAEb,SAAS,EAAE,6CAA6C,eAAe,CAAC,KAAK,CAAC,EAAE,KAC5E,OAAO,YAEV,MAAM,IAAI,MAAM,CAAC,GAAG,CAAC,WAAW,CAAC,IAJ7B,GAAG,IAAI,IAAI,CAAC,EAAE,CAKJ,CAClB,CAAC;AACJ,CAAC;AAED,SAAS,eAAe,CAAC,KAAkC;IACzD,OAAO,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;AACtC,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { jsx as _jsx } from "@redneckz/uni-jsx/jsx-runtime";
|
|
2
|
+
import { JSX } from '@redneckz/uni-jsx';
|
|
3
|
+
export const Placeholder = JSX(({ className, children }) => {
|
|
4
|
+
return _jsx("div", { className: className || '', children: children });
|
|
5
|
+
});
|
|
6
|
+
//# sourceMappingURL=Placeholder.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Placeholder.js","sourceRoot":"","sources":["../src/Placeholder.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AASxC,MAAM,CAAC,MAAM,WAAW,GAAG,GAAG,CAAmB,CAAC,EAAE,SAAS,EAAE,QAAQ,EAAE,EAAE,EAAE;IAC3E,OAAO,cAAK,SAAS,EAAE,SAAS,IAAI,EAAE,YAAG,QAAQ,GAAO,CAAC;AAC3D,CAAC,CAAC,CAAC"}
|
package/lib/Text.d.ts
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export interface TextContent {
|
|
2
|
+
primary?: string;
|
|
3
|
+
secondary?: string;
|
|
4
|
+
}
|
|
5
|
+
export interface TextProps extends TextContent {
|
|
6
|
+
className?: string;
|
|
7
|
+
}
|
|
8
|
+
export declare const Text: (props: import("@redneckz/uni-jsx").PropsWithChildren<TextProps, any>, context?: any) => any;
|
package/lib/Text.js
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "@redneckz/uni-jsx/jsx-runtime";
|
|
2
|
+
import { JSX } from '@redneckz/uni-jsx';
|
|
3
|
+
export const Text = JSX(({ className, primary, secondary, children }) => {
|
|
4
|
+
return (_jsxs("div", { className: className || '', children: [primary && _jsx("p", { className: "font-bold text-slate-700 leading-snug", children: primary }), secondary && _jsx("p", { className: "mt-2 text-sm text-slate-600", children: secondary }), children] }));
|
|
5
|
+
});
|
|
6
|
+
//# sourceMappingURL=Text.js.map
|
package/lib/Text.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Text.js","sourceRoot":"","sources":["../src/Text.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAWxC,MAAM,CAAC,MAAM,IAAI,GAAG,GAAG,CAAY,CAAC,EAAE,SAAS,EAAE,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,EAAE,EAAE;IACjF,OAAO,CACL,eAAK,SAAS,EAAE,SAAS,IAAI,EAAE,aAC5B,OAAO,IAAI,YAAG,SAAS,EAAC,uCAAuC,YAAE,OAAO,GAAK,EAC7E,SAAS,IAAI,YAAG,SAAS,EAAC,6BAA6B,YAAE,SAAS,GAAK,EACvE,QAAQ,IACL,CACP,CAAC;AACJ,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { PageProps } from 'gatsby';
|
|
3
|
+
import type { BlockContent } from '../Blocks';
|
|
4
|
+
import type { ContentPageDef } from '../types';
|
|
5
|
+
import '@redneckz/wildless-cms-uni-blocks/dist/common.css';
|
|
6
|
+
declare type PageData<D extends string> = Record<D, ContentPageDef<BlockContent>>;
|
|
7
|
+
export declare const GatsbyPage: <D extends string>(discriminator: D) => ({ data }: PageProps<PageData<D>, object, unknown, object>) => JSX.Element;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { jsx as _jsx } from "@redneckz/uni-jsx/jsx-runtime";
|
|
2
|
+
import { setup } from '@redneckz/uni-jsx';
|
|
3
|
+
import runtime from 'react/jsx-runtime';
|
|
4
|
+
import { ContentPage } from '../ContentPage';
|
|
5
|
+
import '@redneckz/wildless-cms-uni-blocks/dist/common.css';
|
|
6
|
+
const { jsx, jsxs } = runtime;
|
|
7
|
+
setup(jsx, jsxs);
|
|
8
|
+
export const GatsbyPage = (discriminator) => ({ data }) => _jsx(ContentPage, { ...data[discriminator] });
|
|
9
|
+
//# sourceMappingURL=GatsbyPage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GatsbyPage.js","sourceRoot":"","sources":["../../src/gatsby/GatsbyPage.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAE1C,OAAO,OAAO,MAAM,mBAAmB,CAAC;AAExC,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAG7C,OAAO,mDAAmD,CAAC;AAE3D,MAAM,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,OAAc,CAAC;AACrC,KAAK,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;AAIjB,MAAM,CAAC,MAAM,UAAU,GACrB,CAAmB,aAAgB,EAAE,EAAE,CACvC,CAAC,EAAE,IAAI,EAA0B,EAAE,EAAE,CACnC,KAAC,WAAW,OAAK,IAAI,CAAC,aAAa,CAAC,GAAI,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { GatsbyPage } from './GatsbyPage';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/gatsby/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC"}
|
package/lib/index.d.ts
ADDED
package/lib/index.js
ADDED
package/lib/index.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAElC,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC"}
|
package/lib/types.d.ts
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export interface BlockDef<BlockContent> {
|
|
2
|
+
type: string;
|
|
3
|
+
style?: string[];
|
|
4
|
+
content?: BlockContent;
|
|
5
|
+
blocks?: BlockDef<BlockContent>[];
|
|
6
|
+
}
|
|
7
|
+
export interface ContentPageDef<BlockContent> {
|
|
8
|
+
title: string;
|
|
9
|
+
slug: string;
|
|
10
|
+
style?: string[];
|
|
11
|
+
blocks?: BlockDef<BlockContent>[];
|
|
12
|
+
}
|
|
13
|
+
export declare const GraphQL: {
|
|
14
|
+
Block: string;
|
|
15
|
+
Page: string;
|
|
16
|
+
};
|
|
@@ -1,19 +1,5 @@
|
|
|
1
|
-
export interface BlockDef<BlockContent> {
|
|
2
|
-
type: string;
|
|
3
|
-
style?: string[];
|
|
4
|
-
content?: BlockContent;
|
|
5
|
-
blocks?: BlockDef<BlockContent>[];
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
export interface ContentPageDef<BlockContent> {
|
|
9
|
-
title: string;
|
|
10
|
-
slug: string;
|
|
11
|
-
style?: string[];
|
|
12
|
-
blocks?: BlockDef<BlockContent>[];
|
|
13
|
-
}
|
|
14
|
-
|
|
15
1
|
export const GraphQL = {
|
|
16
|
-
|
|
2
|
+
Block: `
|
|
17
3
|
type BlockContent {
|
|
18
4
|
primary: String
|
|
19
5
|
secondary: String
|
|
@@ -26,7 +12,7 @@ export const GraphQL = {
|
|
|
26
12
|
blocks: [Block!]
|
|
27
13
|
}
|
|
28
14
|
`,
|
|
29
|
-
|
|
15
|
+
Page: `
|
|
30
16
|
title: String!
|
|
31
17
|
slug: String
|
|
32
18
|
date: Date
|
|
@@ -34,3 +20,4 @@ export const GraphQL = {
|
|
|
34
20
|
blocks: [Block!]
|
|
35
21
|
`
|
|
36
22
|
};
|
|
23
|
+
//# sourceMappingURL=types.js.map
|
package/lib/types.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAcA,MAAM,CAAC,MAAM,OAAO,GAAG;IACrB,KAAK,EAAE;;;;;;;;;;;;GAYN;IACD,IAAI,EAAE;;;;;;GAML;CACF,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,11 +1,25 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@redneckz/wildless-cms-uni-blocks",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.3",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"style": "./dist/common.css",
|
|
7
7
|
"module": "./lib/index.js",
|
|
8
8
|
"types": "./lib/index.d.ts",
|
|
9
|
+
"author": {
|
|
10
|
+
"name": "redneckz",
|
|
11
|
+
"email": "vasyaselsky@yandex.ru"
|
|
12
|
+
},
|
|
13
|
+
"files": [
|
|
14
|
+
"lib",
|
|
15
|
+
"dist"
|
|
16
|
+
],
|
|
17
|
+
"repository": {
|
|
18
|
+
"url": "https://github.com/redneckz/wildless-cms-uni-blocks.git"
|
|
19
|
+
},
|
|
20
|
+
"bugs": {
|
|
21
|
+
"url": "https://github.com/redneckz/wildless-cms-uni-blocks/issues"
|
|
22
|
+
},
|
|
9
23
|
"scripts": {
|
|
10
24
|
"build": "rimraf ./lib && tsc --build --verbose && npm run build:commonjs && npm run build:style",
|
|
11
25
|
"build:commonjs": "rimraf ./dist && tsc --module commonjs --noImplicitUseStrict --outDir dist",
|
|
@@ -15,11 +29,16 @@
|
|
|
15
29
|
"@redneckz/uni-jsx": "^0.1.2"
|
|
16
30
|
},
|
|
17
31
|
"peerDependencies": {
|
|
18
|
-
"gatsby": "^4.11.
|
|
32
|
+
"gatsby": "^4.11.3"
|
|
33
|
+
},
|
|
34
|
+
"peerDependenciesMeta": {
|
|
35
|
+
"gatsby": {
|
|
36
|
+
"optional": true
|
|
37
|
+
}
|
|
19
38
|
},
|
|
20
39
|
"devDependencies": {
|
|
21
40
|
"rimraf": "^3.0.2",
|
|
22
|
-
"
|
|
23
|
-
"
|
|
41
|
+
"tailwindcss": "^3.0.23",
|
|
42
|
+
"typescript": "^4.6.3"
|
|
24
43
|
}
|
|
25
44
|
}
|
package/.editorconfig
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
root = true
|
|
2
|
-
|
|
3
|
-
[*]
|
|
4
|
-
charset = utf-8
|
|
5
|
-
end_of_line = lf
|
|
6
|
-
indent_style = space
|
|
7
|
-
indent_size = 2
|
|
8
|
-
insert_final_newline = true
|
|
9
|
-
trim_trailing_whitespace = true
|
|
10
|
-
|
|
11
|
-
[*.ts]
|
|
12
|
-
quote_type = single
|
|
13
|
-
|
|
14
|
-
[*.js]
|
|
15
|
-
quote_type = single
|
|
16
|
-
|
|
17
|
-
[*.md]
|
|
18
|
-
max_line_length = off
|
|
19
|
-
trim_trailing_whitespace = false
|
|
20
|
-
|
|
21
|
-
[*.{json,yml}]
|
|
22
|
-
charset = utf-8
|
|
23
|
-
end_of_line = lf
|
|
24
|
-
indent_style = space
|
|
25
|
-
indent_size = 2
|
package/.gitattributes
DELETED
package/.prettierignore
DELETED
package/src/Blocks.ts
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import type { PlaceholderContent } from './Placeholder';
|
|
2
|
-
import { Placeholder } from './Placeholder';
|
|
3
|
-
import type { TextContent } from './Text';
|
|
4
|
-
import { Text } from './Text';
|
|
5
|
-
|
|
6
|
-
export type BlockContent = PlaceholderContent | TextContent;
|
|
7
|
-
|
|
8
|
-
export const Blocks = {
|
|
9
|
-
Text,
|
|
10
|
-
Placeholder
|
|
11
|
-
};
|
package/src/ContentPage.tsx
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { JSX } from '@redneckz/uni-jsx';
|
|
2
|
-
import { Blocks } from './Blocks';
|
|
3
|
-
import type { BlockContent } from './Blocks';
|
|
4
|
-
import type { BlockDef, ContentPageDef } from './types';
|
|
5
|
-
|
|
6
|
-
export const ContentPage = JSX<ContentPageDef<BlockContent>>(({ style: pageStyle, blocks }) => (
|
|
7
|
-
<section className={`grid grid-cols-12 ${style2className(pageStyle)}`}>
|
|
8
|
-
{blocks && blocks.map(renderBlock)}
|
|
9
|
-
</section>
|
|
10
|
-
));
|
|
11
|
-
|
|
12
|
-
function renderBlock({ type, style, content, blocks }: BlockDef<BlockContent>, i: number) {
|
|
13
|
-
if (!(type in Blocks)) {
|
|
14
|
-
console.warn(`No block with "${type}" is registered`);
|
|
15
|
-
return null;
|
|
16
|
-
}
|
|
17
|
-
const BlockComponent = Blocks[type as keyof typeof Blocks];
|
|
18
|
-
return (
|
|
19
|
-
<BlockComponent
|
|
20
|
-
key={`${type}-${i}`}
|
|
21
|
-
className={`border-dashed border-2 border-sky-500 p-4 ${style2className(style)}`}
|
|
22
|
-
{...content}
|
|
23
|
-
>
|
|
24
|
-
{blocks && blocks.map(renderBlock)}
|
|
25
|
-
</BlockComponent>
|
|
26
|
-
);
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
function style2className(style: string[] | undefined | null): string {
|
|
30
|
-
return style ? style.join(' ') : '';
|
|
31
|
-
}
|
package/src/Placeholder.tsx
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { JSX } from '@redneckz/uni-jsx';
|
|
2
|
-
|
|
3
|
-
export interface PlaceholderContent {
|
|
4
|
-
}
|
|
5
|
-
|
|
6
|
-
export interface PlaceholderProps extends PlaceholderContent {
|
|
7
|
-
className?: string;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
export const Placeholder = JSX<PlaceholderProps>(({ className, children }) => {
|
|
11
|
-
return <div className={className || ''}>{children}</div>;
|
|
12
|
-
});
|
package/src/Text.tsx
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { JSX } from '@redneckz/uni-jsx';
|
|
2
|
-
|
|
3
|
-
export interface TextContent {
|
|
4
|
-
primary?: string;
|
|
5
|
-
secondary?: string;
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
export interface TextProps extends TextContent {
|
|
9
|
-
className?: string;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
export const Text = JSX<TextProps>(({ className, primary, secondary, children }) => {
|
|
13
|
-
return (
|
|
14
|
-
<div className={className || ''}>
|
|
15
|
-
{primary && <p className="font-bold text-slate-700 leading-snug">{primary}</p>}
|
|
16
|
-
{secondary && <p className="mt-2 text-sm text-slate-600">{secondary}</p>}
|
|
17
|
-
{children}
|
|
18
|
-
</div>
|
|
19
|
-
);
|
|
20
|
-
});
|
package/src/common.css
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { setup } from '@redneckz/uni-jsx';
|
|
2
|
-
import type { PageProps } from 'gatsby';
|
|
3
|
-
import runtime from 'react/jsx-runtime';
|
|
4
|
-
import type { BlockContent } from '../Blocks';
|
|
5
|
-
import { ContentPage } from '../ContentPage';
|
|
6
|
-
import type { ContentPageDef } from '../types';
|
|
7
|
-
|
|
8
|
-
import '@demo/ui-kit/dist/common.css';
|
|
9
|
-
|
|
10
|
-
const { jsx, jsxs } = runtime as any;
|
|
11
|
-
setup(jsx, jsxs);
|
|
12
|
-
|
|
13
|
-
type PageData<D extends string> = Record<D, ContentPageDef<BlockContent>>;
|
|
14
|
-
|
|
15
|
-
export const GatsbyPage =
|
|
16
|
-
<D extends string>(discriminator: D) =>
|
|
17
|
-
({ data }: PageProps<PageData<D>>) =>
|
|
18
|
-
<ContentPage {...data[discriminator]} />;
|
package/tailwind.config.js
DELETED
package/tsconfig.json
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
"target": "ESNEXT",
|
|
4
|
-
"module": "ESNext",
|
|
5
|
-
"jsx": "react-jsx",
|
|
6
|
-
"jsxImportSource": "@redneckz/uni-jsx",
|
|
7
|
-
"allowJs": true,
|
|
8
|
-
"lib": ["ESNext", "DOM", "DOM.Iterable"],
|
|
9
|
-
"declaration": true,
|
|
10
|
-
"sourceMap": true,
|
|
11
|
-
"outDir": "./lib",
|
|
12
|
-
|
|
13
|
-
/* Strict Type-Checking Options */
|
|
14
|
-
"strict": true,
|
|
15
|
-
"noImplicitAny": false,
|
|
16
|
-
"alwaysStrict": false,
|
|
17
|
-
|
|
18
|
-
/* Module Resolution Options */
|
|
19
|
-
"rootDir": "src",
|
|
20
|
-
"moduleResolution": "node",
|
|
21
|
-
"esModuleInterop": true,
|
|
22
|
-
/* Advanced Options */
|
|
23
|
-
"skipLibCheck": true
|
|
24
|
-
},
|
|
25
|
-
"include": ["./src/**/*.ts", "./src/**/*.tsx"]
|
|
26
|
-
}
|