@blocklet/pages-kit-core 0.0.1
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/LICENSE +13 -0
- package/lib/cjs/block.d.ts +11 -0
- package/lib/cjs/block.js +91 -0
- package/lib/cjs/core.d.ts +12 -0
- package/lib/cjs/core.js +43 -0
- package/lib/cjs/dataset.d.ts +8 -0
- package/lib/cjs/dataset.js +34 -0
- package/lib/cjs/index.d.ts +3 -0
- package/lib/cjs/index.js +19 -0
- package/lib/cjs/page.d.ts +11 -0
- package/lib/cjs/page.js +77 -0
- package/lib/cjs/renderable.d.ts +6 -0
- package/lib/cjs/renderable.js +6 -0
- package/lib/cjs/tsconfig.tsbuildinfo +1 -0
- package/lib/cjs/types/block.d.ts +4 -0
- package/lib/cjs/types/block.js +2 -0
- package/lib/cjs/types/core.d.ts +22 -0
- package/lib/cjs/types/core.js +2 -0
- package/lib/cjs/types/dataset.d.ts +16 -0
- package/lib/cjs/types/dataset.js +2 -0
- package/lib/cjs/types/env.d.ts +6 -0
- package/lib/cjs/types/env.js +3 -0
- package/lib/cjs/types/index.d.ts +6 -0
- package/lib/cjs/types/index.js +22 -0
- package/lib/cjs/types/page.d.ts +28 -0
- package/lib/cjs/types/page.js +2 -0
- package/lib/cjs/types/renderable.d.ts +11 -0
- package/lib/cjs/types/renderable.js +2 -0
- package/lib/esm/block.d.ts +11 -0
- package/lib/esm/block.js +64 -0
- package/lib/esm/core.d.ts +12 -0
- package/lib/esm/core.js +39 -0
- package/lib/esm/dataset.d.ts +8 -0
- package/lib/esm/dataset.js +30 -0
- package/lib/esm/index.d.ts +3 -0
- package/lib/esm/index.js +3 -0
- package/lib/esm/page.d.ts +11 -0
- package/lib/esm/page.js +73 -0
- package/lib/esm/renderable.d.ts +6 -0
- package/lib/esm/renderable.js +2 -0
- package/lib/esm/tsconfig.tsbuildinfo +1 -0
- package/lib/esm/types/block.d.ts +4 -0
- package/lib/esm/types/block.js +1 -0
- package/lib/esm/types/core.d.ts +22 -0
- package/lib/esm/types/core.js +1 -0
- package/lib/esm/types/dataset.d.ts +16 -0
- package/lib/esm/types/dataset.js +1 -0
- package/lib/esm/types/env.d.ts +6 -0
- package/lib/esm/types/env.js +2 -0
- package/lib/esm/types/index.d.ts +6 -0
- package/lib/esm/types/index.js +6 -0
- package/lib/esm/types/page.d.ts +28 -0
- package/lib/esm/types/page.js +1 -0
- package/lib/esm/types/renderable.d.ts +11 -0
- package/lib/esm/types/renderable.js +1 -0
- package/lib/types/block.d.ts +11 -0
- package/lib/types/core.d.ts +12 -0
- package/lib/types/dataset.d.ts +8 -0
- package/lib/types/index.d.ts +3 -0
- package/lib/types/page.d.ts +11 -0
- package/lib/types/renderable.d.ts +6 -0
- package/lib/types/tsconfig.tsbuildinfo +1 -0
- package/lib/types/types/block.d.ts +4 -0
- package/lib/types/types/core.d.ts +22 -0
- package/lib/types/types/dataset.d.ts +16 -0
- package/lib/types/types/env.d.ts +6 -0
- package/lib/types/types/index.d.ts +6 -0
- package/lib/types/types/page.d.ts +28 -0
- package/lib/types/types/renderable.d.ts +11 -0
- package/package.json +75 -0
- package/tsconfig.json +16 -0
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export interface PageMetadata {
|
|
2
|
+
id: string;
|
|
3
|
+
title?: string;
|
|
4
|
+
ogImage?: string;
|
|
5
|
+
description?: string;
|
|
6
|
+
slug: string;
|
|
7
|
+
[key: string]: any;
|
|
8
|
+
}
|
|
9
|
+
export interface DatasetStructure {
|
|
10
|
+
[pageId: string]: DatasetStructure;
|
|
11
|
+
}
|
|
12
|
+
export interface IDataset<T = any> {
|
|
13
|
+
get(key: string): Promise<T | null>;
|
|
14
|
+
set(key: string, value: T): Promise<T | null>;
|
|
15
|
+
clear(): Promise<void>;
|
|
16
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { Block } from './block';
|
|
2
|
+
import { Renderable } from './renderable';
|
|
3
|
+
export interface PageBlocks extends Map<string, Block> {
|
|
4
|
+
}
|
|
5
|
+
export interface PageStructure {
|
|
6
|
+
[pageId: string]: PageBlocks;
|
|
7
|
+
}
|
|
8
|
+
export interface Page extends Renderable {
|
|
9
|
+
blocks?: PageBlocks;
|
|
10
|
+
}
|
|
11
|
+
export interface PageSection {
|
|
12
|
+
id: string;
|
|
13
|
+
component: string;
|
|
14
|
+
name?: string;
|
|
15
|
+
config?: Record<string, any>;
|
|
16
|
+
properties?: Record<string, any>;
|
|
17
|
+
code?: string;
|
|
18
|
+
}
|
|
19
|
+
export interface PageMeta {
|
|
20
|
+
backgroundColor?: string;
|
|
21
|
+
}
|
|
22
|
+
export interface PageData {
|
|
23
|
+
id: string;
|
|
24
|
+
createdAt: string;
|
|
25
|
+
updatedAt: string;
|
|
26
|
+
meta: PageMeta;
|
|
27
|
+
sections: PageSection[];
|
|
28
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export interface CacheOptions {
|
|
2
|
+
key: string;
|
|
3
|
+
ttl?: number;
|
|
4
|
+
}
|
|
5
|
+
export interface RenderOptions {
|
|
6
|
+
locale?: string;
|
|
7
|
+
cacheOptions?: CacheOptions;
|
|
8
|
+
}
|
|
9
|
+
export interface Renderable<I = any, O = any> {
|
|
10
|
+
render(input: I, options?: RenderOptions): Promise<O>;
|
|
11
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@blocklet/pages-kit-core",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"description": "Pages Kit core",
|
|
5
|
+
"publishConfig": {
|
|
6
|
+
"access": "public"
|
|
7
|
+
},
|
|
8
|
+
"author": "Arcblock <blocklet@arcblock.io> https://github.com/blocklet",
|
|
9
|
+
"homepage": "https://github.com/blocklet/pages-kit#readme",
|
|
10
|
+
"license": "ISC",
|
|
11
|
+
"main": "./lib/cjs/index.js",
|
|
12
|
+
"module": "./lib/esm/index.js",
|
|
13
|
+
"types": "./lib/types/index.d.js",
|
|
14
|
+
"exports": {
|
|
15
|
+
".": {
|
|
16
|
+
"import": "./lib/esm/index.js",
|
|
17
|
+
"require": "./lib/cjs/index.js"
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
"typesVersions": {
|
|
21
|
+
"*": {
|
|
22
|
+
"*": [
|
|
23
|
+
"./lib/types/index.d.ts"
|
|
24
|
+
]
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
"files": [
|
|
28
|
+
"lib",
|
|
29
|
+
"LICENSE",
|
|
30
|
+
"package.json",
|
|
31
|
+
"README.md",
|
|
32
|
+
"tsconfig.json"
|
|
33
|
+
],
|
|
34
|
+
"repository": {
|
|
35
|
+
"type": "git",
|
|
36
|
+
"url": "git+https://github.com/blocklet/pages-kit.git"
|
|
37
|
+
},
|
|
38
|
+
"dependencies": {
|
|
39
|
+
"js-yaml": "^4.1.0",
|
|
40
|
+
"axios": "^1.7.4",
|
|
41
|
+
"lodash": "^4.17.21",
|
|
42
|
+
"nanoid": "^3.3.7",
|
|
43
|
+
"typescript": "~5.5.4"
|
|
44
|
+
},
|
|
45
|
+
"peerDependencies": {
|
|
46
|
+
"axios": "^1.7.4",
|
|
47
|
+
"react": "^18.2.0",
|
|
48
|
+
"react-dom": "^18.2.0",
|
|
49
|
+
"react-router-dom": "^6.16.0"
|
|
50
|
+
},
|
|
51
|
+
"devDependencies": {
|
|
52
|
+
"@types/js-yaml": "^4.0.9",
|
|
53
|
+
"@types/lodash": "^4.17.7",
|
|
54
|
+
"@types/react": "^18.3.4",
|
|
55
|
+
"@types/react-helmet": "^6.1.11",
|
|
56
|
+
"@types/react-scroll-to-bottom": "^4.2.5",
|
|
57
|
+
"@types/react-syntax-highlighter": "^15.5.13",
|
|
58
|
+
"axios": "^1.7.4",
|
|
59
|
+
"npm-run-all": "^4.1.5",
|
|
60
|
+
"react": "^18.3.1",
|
|
61
|
+
"react-dom": "^18.3.1",
|
|
62
|
+
"react-router-dom": "^6.26.1",
|
|
63
|
+
"rimraf": "^6.0.1"
|
|
64
|
+
},
|
|
65
|
+
"scripts": {
|
|
66
|
+
"lint": "eslint src --ext .mjs,.js,.jsx,.ts,.tsx",
|
|
67
|
+
"lint:fix": "npm run lint -- --fix",
|
|
68
|
+
"build": "run-p build:*",
|
|
69
|
+
"build:cjs": "tsc --module commonjs --outDir lib/cjs",
|
|
70
|
+
"build:esm": "tsc --module es2022 --outDir lib/esm",
|
|
71
|
+
"build:types": "tsc --declaration --emitDeclarationOnly --outDir lib/types",
|
|
72
|
+
"dev": "run-p 'build:* -- -w'",
|
|
73
|
+
"clean": "rimraf lib"
|
|
74
|
+
}
|
|
75
|
+
}
|
package/tsconfig.json
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
{
|
|
2
|
+
"extends": "../../tsconfig",
|
|
3
|
+
"compilerOptions": {
|
|
4
|
+
"noEmit": false,
|
|
5
|
+
"declaration": true,
|
|
6
|
+
"outDir": "lib",
|
|
7
|
+
"lib": ["DOM", "ESNext"],
|
|
8
|
+
"paths": {
|
|
9
|
+
"@types": ["./src/types/index.ts"],
|
|
10
|
+
"@utils": ["./src/utils/index.ts"]
|
|
11
|
+
// FIXME: Just for local dev, comment next line before publish
|
|
12
|
+
// "@blocklet/ai-runtime/*": ["../../../ai-studio/packages/ai-runtime/src/*"]
|
|
13
|
+
// "@blocklet/ai-kit/*": ["../../../ai-kit/packages/ai-kit/src/*"]
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
}
|