nodoku-core 0.3.6 → 0.3.13

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.
@@ -1,165 +1,165 @@
1
- {
2
- "description": "Nodoku visual page schema",
3
- "$schema": "http://json-schema.org/draft-07/schema#",
4
- "definitions": {
5
- "VisualRow": {
6
- "type": "object",
7
- "properties": {
8
- "row": {
9
- "type": "object",
10
- "properties": {
11
- "theme": {
12
- "$ref": "../node_modules/nodoku-core/schemas/skin-common-schema.json#/definitions/RowThemeStyle",
13
- "additionalProperties": false
14
- },
15
- "maxCols": {
16
- "type": "number"
17
- },
18
- "components": {
19
- "type": "array",
20
- "items": {
21
- "$ref": "#/definitions/RowComponent"
22
- }
23
- }
24
- },
25
- "additionalProperties": false
26
- }
27
- },
28
- "additionalProperties": false
29
- },
30
-
31
- "RowComponent": {
32
- "type": "object",
33
- "properties": {
34
- {{#components}}
35
-
36
- "{{{name}}}": {
37
- "type": "object",
38
- "properties": {
39
- "selector": {
40
- "$ref": "../node_modules/nodoku-core/schemas/skin-common-schema.json#/definitions/Selector"
41
- },
42
- {{#options}}
43
- "options": {
44
- "$ref": "{{{options}}}",
45
- "additionalProperties": false
46
- }{{#schema}},{{/schema}}
47
- {{/options}}
48
- {{#schema}}
49
- "theme": {
50
- "$ref": "{{{schema}}}",
51
- "additionalProperties": false
52
- },
53
- "themes": {
54
- "type": "array",
55
- "items": {
56
- "$ref": "{{{schema}}}",
57
- "additionalProperties": false
58
- },
59
- "additionalItems": false
60
- }
61
- {{/schema}}
62
- },
63
- "required": [
64
- "selector"
65
- ],
66
- "additionalItems": false,
67
- "additionalProperties": false
68
- }{{^isLast}},{{/isLast}}
69
- {{/components}}
70
- },
71
- "additionalProperties": false
72
- },
73
- "additionalProperties": false
74
- },
75
- "type": "object",
76
- "properties": {
77
- "global": {
78
- "type": "object",
79
- "properties": {
80
- "defaultTheme": {
81
- "type": "string",
82
- "enum": [
83
- "light",
84
- "dark"
85
- ]
86
- },
87
- "renderingPage": {
88
- "$ref": "../node_modules/nodoku-core/schemas/skin-common-schema.json#/definitions/ThemeStyle",
89
- "additionalProperties": false
90
- },
91
- "theme": {
92
- "allOf": [
93
- {{#components}}
94
- {
95
- "$ref": "{{{schema}}}",
96
- "additionalProperties": false
97
- }{{^isLast}},{{/isLast}}
98
- {{/components}}
99
- ],
100
- "additionalProperties": false
101
- },
102
- "themes": {
103
- "type": "array",
104
- "items": {
105
- "allOf": [
106
- {{#components}}
107
- {
108
- "$ref": "{{{schema}}}",
109
- "additionalProperties": false
110
- }{{^isLast}},{{/isLast}}
111
- {{/components}}
112
- ],
113
- "additionalProperties": false
114
- }
115
- },
116
- "components": {
117
- "type": "object",
118
- "properties": {
119
- {{#components}}
120
-
121
- "{{{name}}}": {
122
- "type": "object",
123
- "properties": {
124
- {{#options}}
125
- "options": {
126
- "$ref": "{{{options}}}",
127
- "additionalProperties": false
128
- }{{#schema}},{{/schema}}
129
- {{/options}}
130
- {{#schema}}
131
- "theme": {
132
- "$ref": "{{{schema}}}",
133
- "additionalProperties": false
134
- },
135
- "themes": {
136
- "type": "array",
137
- "items": {
138
- "$ref": "{{{schema}}}",
139
- "additionalProperties": false
140
- },
141
- "additionalItems": false
142
- }
143
- {{/schema}}
144
- },
145
- "additionalItems": false,
146
- "additionalProperties": false
147
- }{{^isLast}},{{/isLast}}
148
- {{/components}}
149
- },
150
- "additionalProperties": false
151
- }
152
- },
153
- "additionalProperties": false
154
- },
155
- "rows": {
156
- "type": "array",
157
- "items": {
158
- "$ref": "#/definitions/VisualRow"
159
- },
160
- "additionalItems": false
161
- }
162
- },
163
- "additionalItems": false,
164
- "additionalProperties": false
1
+ {
2
+ "description": "Nodoku visual page schema",
3
+ "$schema": "http://json-schema.org/draft-07/schema#",
4
+ "definitions": {
5
+ "VisualRow": {
6
+ "type": "object",
7
+ "properties": {
8
+ "row": {
9
+ "type": "object",
10
+ "properties": {
11
+ "theme": {
12
+ "$ref": "../node_modules/nodoku-core/schemas/skin-common-schema.json#/definitions/RowThemeStyle",
13
+ "additionalProperties": false
14
+ },
15
+ "maxCols": {
16
+ "type": "number"
17
+ },
18
+ "components": {
19
+ "type": "array",
20
+ "items": {
21
+ "$ref": "#/definitions/RowComponent"
22
+ }
23
+ }
24
+ },
25
+ "additionalProperties": false
26
+ }
27
+ },
28
+ "additionalProperties": false
29
+ },
30
+
31
+ "RowComponent": {
32
+ "type": "object",
33
+ "properties": {
34
+ {{#components}}
35
+
36
+ "{{{name}}}": {
37
+ "type": "object",
38
+ "properties": {
39
+ "selector": {
40
+ "$ref": "../node_modules/nodoku-core/schemas/skin-common-schema.json#/definitions/Selector"
41
+ },
42
+ {{#options}}
43
+ "options": {
44
+ "$ref": "{{{options}}}",
45
+ "additionalProperties": false
46
+ }{{#schema}},{{/schema}}
47
+ {{/options}}
48
+ {{#schema}}
49
+ "theme": {
50
+ "$ref": "{{{schema}}}",
51
+ "additionalProperties": false
52
+ },
53
+ "themes": {
54
+ "type": "array",
55
+ "items": {
56
+ "$ref": "{{{schema}}}",
57
+ "additionalProperties": false
58
+ },
59
+ "additionalItems": false
60
+ }
61
+ {{/schema}}
62
+ },
63
+ "required": [
64
+ "selector"
65
+ ],
66
+ "additionalItems": false,
67
+ "additionalProperties": false
68
+ }{{^isLast}},{{/isLast}}
69
+ {{/components}}
70
+ },
71
+ "additionalProperties": false
72
+ },
73
+ "additionalProperties": false
74
+ },
75
+ "type": "object",
76
+ "properties": {
77
+ "global": {
78
+ "type": "object",
79
+ "properties": {
80
+ "defaultTheme": {
81
+ "type": "string",
82
+ "enum": [
83
+ "light",
84
+ "dark"
85
+ ]
86
+ },
87
+ "renderingPage": {
88
+ "$ref": "../node_modules/nodoku-core/schemas/skin-common-schema.json#/definitions/ThemeStyle",
89
+ "additionalProperties": false
90
+ },
91
+ "theme": {
92
+ "allOf": [
93
+ {{#components}}
94
+ {
95
+ "$ref": "{{{schema}}}",
96
+ "additionalProperties": false
97
+ }{{^isLast}},{{/isLast}}
98
+ {{/components}}
99
+ ],
100
+ "additionalProperties": false
101
+ },
102
+ "themes": {
103
+ "type": "array",
104
+ "items": {
105
+ "allOf": [
106
+ {{#components}}
107
+ {
108
+ "$ref": "{{{schema}}}",
109
+ "additionalProperties": false
110
+ }{{^isLast}},{{/isLast}}
111
+ {{/components}}
112
+ ],
113
+ "additionalProperties": false
114
+ }
115
+ },
116
+ "components": {
117
+ "type": "object",
118
+ "properties": {
119
+ {{#components}}
120
+
121
+ "{{{name}}}": {
122
+ "type": "object",
123
+ "properties": {
124
+ {{#options}}
125
+ "options": {
126
+ "$ref": "{{{options}}}",
127
+ "additionalProperties": false
128
+ }{{#schema}},{{/schema}}
129
+ {{/options}}
130
+ {{#schema}}
131
+ "theme": {
132
+ "$ref": "{{{schema}}}",
133
+ "additionalProperties": false
134
+ },
135
+ "themes": {
136
+ "type": "array",
137
+ "items": {
138
+ "$ref": "{{{schema}}}",
139
+ "additionalProperties": false
140
+ },
141
+ "additionalItems": false
142
+ }
143
+ {{/schema}}
144
+ },
145
+ "additionalItems": false,
146
+ "additionalProperties": false
147
+ }{{^isLast}},{{/isLast}}
148
+ {{/components}}
149
+ },
150
+ "additionalProperties": false
151
+ }
152
+ },
153
+ "additionalProperties": false
154
+ },
155
+ "rows": {
156
+ "type": "array",
157
+ "items": {
158
+ "$ref": "#/definitions/VisualRow"
159
+ },
160
+ "additionalItems": false
161
+ }
162
+ },
163
+ "additionalItems": false,
164
+ "additionalProperties": false
165
165
  }
@@ -7,72 +7,72 @@ export async function DummyComp(props) {
7
7
  }
8
8
  async function render(rowIndex, componentIndex, block, t) {
9
9
  console.log("this is my block", block.callToActions.map(cta => `${cta.ctaUrl.key}`));
10
- return (<div className={"w-full w-full flex flex-col items-left justify-left border border-4 border-red-200 relative pb-10"}>
11
- <div className={"top-0 bottom-0 left-0 right-0 absolute bg-white "} style={{ zIndex: -5, opacity: 0.7 }}></div>
12
- <div className={"p-5 w-full bg-red-400 text-center"}>
13
- dummy component<h3><b>{`ns-${block.namespace}-row-${rowIndex}-i-${componentIndex}`}</b></h3>
14
- </div>
15
-
16
-
17
- <div className="p-5">
18
- {block.title && <a href="#">
19
- {block.title && block.title.key}
20
- <h5 className={"mb-2 text-2xl font-bold tracking-tight text-gray-900 dark:text-white"}>
21
- {block.title && t(block.title).__html}
22
- </h5>
23
- </a>}
24
- {block.subTitle && block.subTitle.key}
25
- {block.subTitle && <h6 className={"mb-2 text-xl tracking-tight text-gray-900 dark:text-white"}>
26
- {block.subTitle && t(block.subTitle).__html}
27
- </h6>}
28
-
29
- paragraphs:
30
- {await Promise.all(block.paragraphs.map(async (p, ip) => renderParagraph(p, ip)))}
31
- images:
10
+ return (<div className={"w-full w-full flex flex-col items-left justify-left border border-4 border-red-200 relative pb-10"}>
11
+ <div className={"top-0 bottom-0 left-0 right-0 absolute bg-white "} style={{ zIndex: -5, opacity: 0.7 }}></div>
12
+ <div className={"p-5 w-full bg-red-400 text-center"}>
13
+ dummy component<h3><b>{`ns-${block.namespace}-row-${rowIndex}-i-${componentIndex}`}</b></h3>
14
+ </div>
15
+
16
+
17
+ <div className="p-5">
18
+ {block.title && <a href="#">
19
+ {block.title && block.title.key}
20
+ <h5 className={"mb-2 text-2xl font-bold tracking-tight text-gray-900 dark:text-white"}>
21
+ {block.title && t(block.title).__html}
22
+ </h5>
23
+ </a>}
24
+ {block.subTitle && block.subTitle.key}
25
+ {block.subTitle && <h6 className={"mb-2 text-xl tracking-tight text-gray-900 dark:text-white"}>
26
+ {block.subTitle && t(block.subTitle).__html}
27
+ </h6>}
28
+
29
+ paragraphs:
30
+ {await Promise.all(block.paragraphs.map(async (p, ip) => renderParagraph(p, ip)))}
31
+ images:
32
32
  {block.images.map((img, ii) => {
33
- return (<div>
34
- <p key={"url" + ii} className={"mb-3 font-normal text-gray-700 dark:text-gray-400"}>
35
- url: {img && img.url && t(img.url).__html}
33
+ return (<div>
34
+ <p key={"url" + ii} className={"mb-3 font-normal text-gray-700 dark:text-gray-400"}>
35
+ url: {img && img.url && t(img.url).__html}
36
36
  {img.url && <span className={"bg-cover bg-no-repeat"} style={{
37
37
  display: "block",
38
38
  width: "200px",
39
39
  height: "200px",
40
40
  backgroundImage: `url(${t(img.url)})`
41
- }}></span>}
42
- </p>
43
- <p key={"alt" + ii} className={"mb-3 font-normal text-gray-700 dark:text-gray-400"}>
44
- alt: {img && img.alt && t(img.alt).__html}
45
- </p>
46
- <p key={"title" + ii} className={"mb-3 font-normal text-gray-700 dark:text-gray-400"}>
47
- title: {img && img.title && t(img.title).__html}
48
- </p>
41
+ }}></span>}
42
+ </p>
43
+ <p key={"alt" + ii} className={"mb-3 font-normal text-gray-700 dark:text-gray-400"}>
44
+ alt: {img && img.alt && t(img.alt).__html}
45
+ </p>
46
+ <p key={"title" + ii} className={"mb-3 font-normal text-gray-700 dark:text-gray-400"}>
47
+ title: {img && img.title && t(img.title).__html}
48
+ </p>
49
49
  </div>);
50
- })}
51
- </div>
52
-
53
- <div className={"absolute bottom-0 p-5"}>
50
+ })}
51
+ </div>
52
+
53
+ <div className={"absolute bottom-0 p-5"}>
54
54
  {block.callToActions.map((cta) => {
55
55
  return <p><b>{`${t(cta.ctaTitle || cta.ctaUrl)}: ${t(cta.ctaUrl)}`}</b>{`${cta.ctaUrl.key}: ${t(cta.ctaUrl)}`}</p>;
56
- })}
57
-
58
- </div>
59
-
56
+ })}
57
+
58
+ </div>
59
+
60
60
  </div>);
61
61
  function renderParagraph(p, ip) {
62
62
  if (p instanceof NdTranslatableText) {
63
- return (<div>
64
- {p && p.key}
65
- <p key={ip} className={"mb-3 font-normal text-gray-700 dark:text-gray-400"}>
66
- {p && t(p).__html}
67
- </p>
63
+ return (<div>
64
+ {p && p.key}
65
+ <p key={ip} className={"mb-3 font-normal text-gray-700 dark:text-gray-400"}>
66
+ {p && t(p).__html}
67
+ </p>
68
68
  </div>);
69
69
  }
70
70
  else if (p instanceof NdCode) {
71
71
  const code = p;
72
- return (<div className={"border border-gray-200 p-4"}>
73
- <pre className={"text-pretty"}>
74
- <code lang={code.lang} className={"hljs"} dangerouslySetInnerHTML={{ __html: code.code }}/>
75
- </pre>
72
+ return (<div className={"border border-gray-200 p-4"}>
73
+ <pre className={"text-pretty"}>
74
+ <code lang={code.lang} className={"hljs"} dangerouslySetInnerHTML={{ __html: code.code }}/>
75
+ </pre>
76
76
  </div>);
77
77
  } /*else if (p instanceof NdLink) {
78
78
  const link: NdLink = p as NdLink
@@ -91,19 +91,19 @@ async function render(rowIndex, componentIndex, block, t) {
91
91
  else {
92
92
  const list = p;
93
93
  if (list.ordered) {
94
- return (<ol className={"list-disc list-outside"}>
95
- {list.items.map(i => <li className={"ml-4"}>
96
- {showListItem(i)}
97
- {i.subList && renderParagraph(i.subList, ip)}
98
- </li>)}
94
+ return (<ol className={"list-disc list-outside"}>
95
+ {list.items.map(i => <li className={"ml-4"}>
96
+ {showListItem(i)}
97
+ {i.subList && renderParagraph(i.subList, ip)}
98
+ </li>)}
99
99
  </ol>);
100
100
  }
101
101
  else {
102
- return (<ul className={"list-disc list-outside"}>
103
- {list.items.map(i => <li className={"ml-4"}>
104
- {showListItem(i)}
105
- {i.subList && renderParagraph(i.subList, ip)}
106
- </li>)}
102
+ return (<ul className={"list-disc list-outside"}>
103
+ {list.items.map(i => <li className={"ml-4"}>
104
+ {showListItem(i)}
105
+ {i.subList && renderParagraph(i.subList, ip)}
106
+ </li>)}
107
107
  </ul>);
108
108
  }
109
109
  }
@@ -138,10 +138,10 @@ async function createRow(row, iRow, blocks, lng, imageProvider, i18nProvider, i1
138
138
  if (rowEffectiveTheme.rowDisplay == "flex") {
139
139
  rowDisplay = "flex flex-row justify-center flex-wrap flex-1";
140
140
  }
141
- return (<div key={`row-${iRow}`} className={`row-${iRow} ${rowDisplay} ${rowEffectiveTheme?.base} ${rowEffectiveTheme?.decoration} class-row-${iRow}`}>
142
- {rowComponents.map((c, i) => <div key={`row-${iRow}-component-${i}`} className={`row-${iRow}-component-${i} nd-component-holder ${flexBasis} ${ts(rowEffectiveTheme, "componentHolder")}`}>
143
- {c}
144
- </div>)}
141
+ return (<div key={`row-${iRow}`} className={`row-${iRow} ${rowDisplay} ${rowEffectiveTheme?.base} ${rowEffectiveTheme?.decoration} class-row-${iRow}`}>
142
+ {rowComponents.map((c, i) => <div key={`row-${iRow}-component-${i}`} className={`row-${iRow}-component-${i} nd-component-holder ${flexBasis} ${ts(rowEffectiveTheme, "componentHolder")}`}>
143
+ {c}
144
+ </div>)}
145
145
  </div>);
146
146
  }
147
147
  async function createRowComponents(rowIndex, blockIndex, skinComponent, pageContent, lng, imageProvider, i18nProvider, i18nextPostProcessor, componentResolver, htmlSanitizer, clientSideComponentProvider) {
package/package.json CHANGED
@@ -1,52 +1,51 @@
1
- {
2
- "name": "nodoku-core",
3
- "version": "0.3.6",
4
- "description": "basic foundation for nodoku static site generator",
5
- "license": "MIT for the use not related to website builders, commercial otherwise, contact for details",
6
- "exports": {
7
- ".": {
8
- "types": "./types/index.d.ts",
9
- "import": "./esm/index.js"
10
- },
11
- "./tailwind": {
12
- "types": "./types/tailwind/index.d.ts",
13
- "require": "./esm/tailwind/index.js"
14
- },
15
- "./package.json": "./package.json"
16
- },
17
- "module": "esm/index.js",
18
- "types": "types/index.d.ts",
19
- "type": "module",
20
- "bin": {
21
- "nodoku-gen-component-resolver": "./esm/bin/generate-component-resolver.js",
22
- "nodoku-gen-content-schema": "./esm/bin/generate-content-schema.js",
23
- "nodoku-gen-skin-schema": "./esm/bin/generate-skin-schema.js",
24
- "nodoku-gen-component-default-theme": "./esm/bin/generate-component-default-theme.js"
25
- },
26
- "dependencies": {
27
- },
28
- "peerDependencies": {
29
- "@ts-stack/markdown": "^1.5.0",
30
- "js-yaml": "^4.1.0",
31
- "mustache": "^4.2.0",
32
- "node-html-parser": "^6.1.13",
33
- "react": "^18.3.1",
34
- "react-dom": "^18.3.1"
35
- },
36
- "devDependencies": {
37
- "@ts-stack/markdown": "^1.5.0",
38
- "js-yaml": "^4.1.0",
39
- "mustache": "^4.2.0",
40
- "node-html-parser": "^6.1.13",
41
- "@types/js-yaml": "^4.0.9",
42
- "@types/mustache": "^4.2.5",
43
- "@types/node": "^20.12.11",
44
- "@types/react": "^18.3.3",
45
- "@types/react-dom": "^18.3.0",
46
- "eslint": "^8.56.0",
47
- "react": "^18.3.1",
48
- "react-dom": "^18.3.1",
49
- "typescript": "^5.5.3",
50
- "shx": "^0.3.4"
51
- }
52
- }
1
+ {
2
+ "name": "nodoku-core",
3
+ "version": "0.3.13",
4
+ "description": "basic foundation for nodoku static site generator",
5
+ "license": "MIT for the use not related to website builders, commercial otherwise, contact for details",
6
+ "exports": {
7
+ ".": {
8
+ "types": "./types/index.d.ts",
9
+ "import": "./esm/index.js"
10
+ },
11
+ "./tailwind": {
12
+ "types": "./types/tailwind/index.d.ts",
13
+ "require": "./esm/tailwind/index.js"
14
+ },
15
+ "./package.json": "./package.json"
16
+ },
17
+ "module": "esm/index.js",
18
+ "types": "types/index.d.ts",
19
+ "type": "module",
20
+ "bin": {
21
+ "nodoku-gen-component-resolver": "./esm/bin/generate-component-resolver.js",
22
+ "nodoku-gen-content-schema": "./esm/bin/generate-content-schema.js",
23
+ "nodoku-gen-skin-schema": "./esm/bin/generate-skin-schema.js",
24
+ "nodoku-gen-component-default-theme": "./esm/bin/generate-component-default-theme.js"
25
+ },
26
+ "dependencies": {},
27
+ "peerDependencies": {
28
+ "@ts-stack/markdown": "^1.5.0",
29
+ "js-yaml": "^4.1.0",
30
+ "mustache": "^4.2.0",
31
+ "node-html-parser": "^6.1.13",
32
+ "react": "^18.3.1",
33
+ "react-dom": "^18.3.1"
34
+ },
35
+ "devDependencies": {
36
+ "@ts-stack/markdown": "^1.5.0",
37
+ "js-yaml": "^4.1.0",
38
+ "mustache": "^4.2.0",
39
+ "node-html-parser": "^6.1.13",
40
+ "@types/js-yaml": "^4.0.9",
41
+ "@types/mustache": "^4.2.5",
42
+ "@types/node": "^20.12.11",
43
+ "@types/react": "^18.3.3",
44
+ "@types/react-dom": "^18.3.0",
45
+ "eslint": "^8.56.0",
46
+ "react": "^18.3.1",
47
+ "react-dom": "^18.3.1",
48
+ "typescript": "^5.5.3",
49
+ "shx": "^0.3.4"
50
+ }
51
+ }