@blocklet/pages-kit 0.2.195

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.
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ var __importDefault = (this && this.__importDefault) || function (mod) {
12
+ return (mod && mod.__esModule) ? mod : { "default": mod };
13
+ };
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ exports.getComponents = void 0;
16
+ const axios_1 = __importDefault(require("axios"));
17
+ const ufo_1 = require("ufo");
18
+ const PAGES_KIT_DID = 'z8iZiDFg3vkkrPwsiba1TLXy3H9XHzFERsP8o';
19
+ function getComponents({ mode, name } = {}) {
20
+ var _a, _b;
21
+ return __awaiter(this, void 0, void 0, function* () {
22
+ const prefix = ((_b = (_a = window.blocklet) === null || _a === void 0 ? void 0 : _a.componentMountPoints.find((i) => i.did === PAGES_KIT_DID)) === null || _b === void 0 ? void 0 : _b.mountPoint) || '/';
23
+ return axios_1.default.get((0, ufo_1.joinURL)(prefix, '/api/components'), { params: { name, mode } }).then((res) => res.data);
24
+ });
25
+ }
26
+ exports.getComponents = getComponents;
@@ -0,0 +1,164 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
26
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
27
+ return new (P || (P = Promise))(function (resolve, reject) {
28
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
29
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
30
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
31
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
32
+ });
33
+ };
34
+ var __importDefault = (this && this.__importDefault) || function (mod) {
35
+ return (mod && mod.__esModule) ? mod : { "default": mod };
36
+ };
37
+ Object.defineProperty(exports, "__esModule", { value: true });
38
+ const jsx_runtime_1 = require("react/jsx-runtime");
39
+ const cache_1 = __importDefault(require("@emotion/cache"));
40
+ const react_1 = require("@emotion/react");
41
+ const material_1 = require("@mui/material");
42
+ const react_2 = require("react");
43
+ const client_1 = __importDefault(require("react-dom/client"));
44
+ const react_error_boundary_1 = require("react-error-boundary");
45
+ const react_frame_component_1 = require("react-frame-component");
46
+ const zustand_1 = require("zustand");
47
+ const immer_1 = require("zustand/middleware/immer");
48
+ const CUSTOM_COMPONENT_RENDERER = 'custom-component-renderer';
49
+ const defineCustomElements = (win) => {
50
+ if (!win.customElements.get(CUSTOM_COMPONENT_RENDERER)) {
51
+ win.customElements.define(CUSTOM_COMPONENT_RENDERER, class CustomComponentRenderer extends win.HTMLElement {
52
+ constructor() {
53
+ super();
54
+ this.root = this.attachShadow({ mode: 'open' });
55
+ this.reactRoot = client_1.default.createRoot(this.root);
56
+ }
57
+ static get observedAttributes() {
58
+ return ['component-id'];
59
+ }
60
+ get componentId() {
61
+ return this.getAttribute('component-id');
62
+ }
63
+ connectedCallback() {
64
+ this.setup();
65
+ }
66
+ attributeChangedCallback() {
67
+ this.setup();
68
+ }
69
+ setup() {
70
+ const { subscribe } = customComponentState(this.componentId);
71
+ subscribe(() => this.render());
72
+ this.render();
73
+ }
74
+ get state() {
75
+ return Object.assign(Object.assign({}, customComponentState(this.componentId).getState()), { properties: customComponentProperties(this.id).getState().properties });
76
+ }
77
+ render() {
78
+ var _a, _b, _c, _d, _e;
79
+ return __awaiter(this, void 0, void 0, function* () {
80
+ try {
81
+ const { component, properties: parameters } = this.state;
82
+ if (!component)
83
+ throw new Error('missing required component config');
84
+ let script;
85
+ let current = component;
86
+ const properties = Object.fromEntries(Object.entries(parameters !== null && parameters !== void 0 ? parameters : {}).map(([id, { value }]) => { var _a, _b; return [(_b = (_a = component.properties) === null || _a === void 0 ? void 0 : _a[id]) === null || _b === void 0 ? void 0 : _b.data.name, value]; }));
87
+ while (current) {
88
+ mergeProperties(properties, Object.fromEntries(Object.values((_a = current.properties) !== null && _a !== void 0 ? _a : {}).map(({ data }) => [data.name, data.defaultValue])));
89
+ if (((_b = current.renderer) === null || _b === void 0 ? void 0 : _b.type) === 'web-component') {
90
+ script = (_c = current.renderer) === null || _c === void 0 ? void 0 : _c.script;
91
+ break;
92
+ }
93
+ if (((_d = current.renderer) === null || _d === void 0 ? void 0 : _d.type) === 'custom-component' && current.renderer.componentId) {
94
+ const c = customComponentState(current.renderer.componentId).getState()
95
+ .component;
96
+ mergeProperties(properties, Object.fromEntries(Object.entries((_e = current.renderer.properties) !== null && _e !== void 0 ? _e : {}).map(([id, { value }]) => {
97
+ var _a, _b;
98
+ return [
99
+ (_b = (_a = c === null || c === void 0 ? void 0 : c.properties) === null || _a === void 0 ? void 0 : _a[id]) === null || _b === void 0 ? void 0 : _b.data.name,
100
+ value,
101
+ ];
102
+ })));
103
+ current = c;
104
+ }
105
+ else {
106
+ current = undefined;
107
+ }
108
+ }
109
+ if (!script)
110
+ throw new Error('Missing required script');
111
+ const cache = (0, cache_1.default)({
112
+ key: 'css',
113
+ prepend: true,
114
+ container: this.root,
115
+ });
116
+ const url = URL.createObjectURL(new Blob([script], { type: 'application/javascript' }));
117
+ const { default: C } = yield Promise.resolve(`${url}`).then(s => __importStar(require(s)));
118
+ this.reactRoot.render((0, jsx_runtime_1.jsx)(react_1.CacheProvider, { value: cache, children: (0, jsx_runtime_1.jsx)(C, Object.assign({}, properties)) }));
119
+ }
120
+ catch (error) {
121
+ this.reactRoot.render((0, jsx_runtime_1.jsx)("div", {}));
122
+ }
123
+ });
124
+ }
125
+ });
126
+ }
127
+ };
128
+ const CUSTOM_COMPONENT_STATE_MAP = {};
129
+ const customComponentState = (id, initial) => {
130
+ var _a;
131
+ (_a = CUSTOM_COMPONENT_STATE_MAP[id]) !== null && _a !== void 0 ? _a : (CUSTOM_COMPONENT_STATE_MAP[id] = (0, zustand_1.create)()((0, immer_1.immer)(() => (Object.assign({}, initial)))));
132
+ return CUSTOM_COMPONENT_STATE_MAP[id];
133
+ };
134
+ const CUSTOM_COMPONENT_PROPERTIES_MAP = {};
135
+ const customComponentProperties = (id, initial) => {
136
+ var _a;
137
+ (_a = CUSTOM_COMPONENT_PROPERTIES_MAP[id]) !== null && _a !== void 0 ? _a : (CUSTOM_COMPONENT_PROPERTIES_MAP[id] = (0, zustand_1.create)()((0, immer_1.immer)(() => (Object.assign({}, initial)))));
138
+ return CUSTOM_COMPONENT_PROPERTIES_MAP[id];
139
+ };
140
+ function CustomComponentRenderer({ id, componentId, components, properties, }) {
141
+ const frame = (0, react_frame_component_1.useFrame)();
142
+ components === null || components === void 0 ? void 0 : components.map((component) => customComponentState(component.id, { component }));
143
+ customComponentProperties(id, { properties });
144
+ (0, react_2.useEffect)(() => {
145
+ components === null || components === void 0 ? void 0 : components.map((component) => customComponentState(component.id).setState({ component }));
146
+ customComponentProperties(id, { properties }).setState({ properties });
147
+ });
148
+ (0, react_2.useEffect)(() => {
149
+ defineCustomElements(frame.window || window);
150
+ }, [frame]);
151
+ return ((0, jsx_runtime_1.jsx)(react_error_boundary_1.ErrorBoundary, { fallbackRender: E, children: (0, jsx_runtime_1.jsx)("custom-component-renderer", { "component-id": componentId, id: id }) }));
152
+ }
153
+ exports.default = CustomComponentRenderer;
154
+ function E({ error }) {
155
+ return ((0, jsx_runtime_1.jsx)(material_1.Box, { children: (0, jsx_runtime_1.jsx)(material_1.Alert, { severity: "error", children: error.message }) }));
156
+ }
157
+ function mergeProperties(properties, newProperties) {
158
+ for (const [key, val] of Object.entries(newProperties)) {
159
+ if (properties[key] === undefined || properties[key] === null || properties[key] === '') {
160
+ properties[key] = val;
161
+ }
162
+ }
163
+ return properties;
164
+ }
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.CustomComponentRenderer = void 0;
7
+ var CustomComponentRenderer_1 = require("./CustomComponentRenderer");
8
+ Object.defineProperty(exports, "CustomComponentRenderer", { enumerable: true, get: function () { return __importDefault(CustomComponentRenderer_1).default; } });
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,19 @@
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
9
+ };
10
+ import axios from 'axios';
11
+ import { joinURL } from 'ufo';
12
+ const PAGES_KIT_DID = 'z8iZiDFg3vkkrPwsiba1TLXy3H9XHzFERsP8o';
13
+ export function getComponents({ mode, name } = {}) {
14
+ var _a, _b;
15
+ return __awaiter(this, void 0, void 0, function* () {
16
+ const prefix = ((_b = (_a = window.blocklet) === null || _a === void 0 ? void 0 : _a.componentMountPoints.find((i) => i.did === PAGES_KIT_DID)) === null || _b === void 0 ? void 0 : _b.mountPoint) || '/';
17
+ return axios.get(joinURL(prefix, '/api/components'), { params: { name, mode } }).then((res) => res.data);
18
+ });
19
+ }
@@ -0,0 +1,135 @@
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
9
+ };
10
+ import { jsx as _jsx } from "react/jsx-runtime";
11
+ import createCache from '@emotion/cache';
12
+ import { CacheProvider } from '@emotion/react';
13
+ import { Alert, Box } from '@mui/material';
14
+ import { useEffect } from 'react';
15
+ import ReactDOM from 'react-dom/client';
16
+ import { ErrorBoundary } from 'react-error-boundary';
17
+ import { useFrame } from 'react-frame-component';
18
+ import { create } from 'zustand';
19
+ import { immer } from 'zustand/middleware/immer';
20
+ const CUSTOM_COMPONENT_RENDERER = 'custom-component-renderer';
21
+ const defineCustomElements = (win) => {
22
+ if (!win.customElements.get(CUSTOM_COMPONENT_RENDERER)) {
23
+ win.customElements.define(CUSTOM_COMPONENT_RENDERER, class CustomComponentRenderer extends win.HTMLElement {
24
+ constructor() {
25
+ super();
26
+ this.root = this.attachShadow({ mode: 'open' });
27
+ this.reactRoot = ReactDOM.createRoot(this.root);
28
+ }
29
+ static get observedAttributes() {
30
+ return ['component-id'];
31
+ }
32
+ get componentId() {
33
+ return this.getAttribute('component-id');
34
+ }
35
+ connectedCallback() {
36
+ this.setup();
37
+ }
38
+ attributeChangedCallback() {
39
+ this.setup();
40
+ }
41
+ setup() {
42
+ const { subscribe } = customComponentState(this.componentId);
43
+ subscribe(() => this.render());
44
+ this.render();
45
+ }
46
+ get state() {
47
+ return Object.assign(Object.assign({}, customComponentState(this.componentId).getState()), { properties: customComponentProperties(this.id).getState().properties });
48
+ }
49
+ render() {
50
+ var _a, _b, _c, _d, _e;
51
+ return __awaiter(this, void 0, void 0, function* () {
52
+ try {
53
+ const { component, properties: parameters } = this.state;
54
+ if (!component)
55
+ throw new Error('missing required component config');
56
+ let script;
57
+ let current = component;
58
+ const properties = Object.fromEntries(Object.entries(parameters !== null && parameters !== void 0 ? parameters : {}).map(([id, { value }]) => { var _a, _b; return [(_b = (_a = component.properties) === null || _a === void 0 ? void 0 : _a[id]) === null || _b === void 0 ? void 0 : _b.data.name, value]; }));
59
+ while (current) {
60
+ mergeProperties(properties, Object.fromEntries(Object.values((_a = current.properties) !== null && _a !== void 0 ? _a : {}).map(({ data }) => [data.name, data.defaultValue])));
61
+ if (((_b = current.renderer) === null || _b === void 0 ? void 0 : _b.type) === 'web-component') {
62
+ script = (_c = current.renderer) === null || _c === void 0 ? void 0 : _c.script;
63
+ break;
64
+ }
65
+ if (((_d = current.renderer) === null || _d === void 0 ? void 0 : _d.type) === 'custom-component' && current.renderer.componentId) {
66
+ const c = customComponentState(current.renderer.componentId).getState()
67
+ .component;
68
+ mergeProperties(properties, Object.fromEntries(Object.entries((_e = current.renderer.properties) !== null && _e !== void 0 ? _e : {}).map(([id, { value }]) => {
69
+ var _a, _b;
70
+ return [
71
+ (_b = (_a = c === null || c === void 0 ? void 0 : c.properties) === null || _a === void 0 ? void 0 : _a[id]) === null || _b === void 0 ? void 0 : _b.data.name,
72
+ value,
73
+ ];
74
+ })));
75
+ current = c;
76
+ }
77
+ else {
78
+ current = undefined;
79
+ }
80
+ }
81
+ if (!script)
82
+ throw new Error('Missing required script');
83
+ const cache = createCache({
84
+ key: 'css',
85
+ prepend: true,
86
+ container: this.root,
87
+ });
88
+ const url = URL.createObjectURL(new Blob([script], { type: 'application/javascript' }));
89
+ const { default: C } = yield import(/* @vite-ignore */ url);
90
+ this.reactRoot.render(_jsx(CacheProvider, { value: cache, children: _jsx(C, Object.assign({}, properties)) }));
91
+ }
92
+ catch (error) {
93
+ this.reactRoot.render(_jsx("div", {}));
94
+ }
95
+ });
96
+ }
97
+ });
98
+ }
99
+ };
100
+ const CUSTOM_COMPONENT_STATE_MAP = {};
101
+ const customComponentState = (id, initial) => {
102
+ var _a;
103
+ (_a = CUSTOM_COMPONENT_STATE_MAP[id]) !== null && _a !== void 0 ? _a : (CUSTOM_COMPONENT_STATE_MAP[id] = create()(immer(() => (Object.assign({}, initial)))));
104
+ return CUSTOM_COMPONENT_STATE_MAP[id];
105
+ };
106
+ const CUSTOM_COMPONENT_PROPERTIES_MAP = {};
107
+ const customComponentProperties = (id, initial) => {
108
+ var _a;
109
+ (_a = CUSTOM_COMPONENT_PROPERTIES_MAP[id]) !== null && _a !== void 0 ? _a : (CUSTOM_COMPONENT_PROPERTIES_MAP[id] = create()(immer(() => (Object.assign({}, initial)))));
110
+ return CUSTOM_COMPONENT_PROPERTIES_MAP[id];
111
+ };
112
+ export default function CustomComponentRenderer({ id, componentId, components, properties, }) {
113
+ const frame = useFrame();
114
+ components === null || components === void 0 ? void 0 : components.map((component) => customComponentState(component.id, { component }));
115
+ customComponentProperties(id, { properties });
116
+ useEffect(() => {
117
+ components === null || components === void 0 ? void 0 : components.map((component) => customComponentState(component.id).setState({ component }));
118
+ customComponentProperties(id, { properties }).setState({ properties });
119
+ });
120
+ useEffect(() => {
121
+ defineCustomElements(frame.window || window);
122
+ }, [frame]);
123
+ return (_jsx(ErrorBoundary, { fallbackRender: E, children: _jsx("custom-component-renderer", { "component-id": componentId, id: id }) }));
124
+ }
125
+ function E({ error }) {
126
+ return (_jsx(Box, { children: _jsx(Alert, { severity: "error", children: error.message }) }));
127
+ }
128
+ function mergeProperties(properties, newProperties) {
129
+ for (const [key, val] of Object.entries(newProperties)) {
130
+ if (properties[key] === undefined || properties[key] === null || properties[key] === '') {
131
+ properties[key] = val;
132
+ }
133
+ }
134
+ return properties;
135
+ }
@@ -0,0 +1 @@
1
+ export { default as CustomComponentRenderer } from './CustomComponentRenderer';
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,8 @@
1
+ import { CustomComponentType } from '../types';
2
+ export type Mode = 'draft' | 'staging' | 'production';
3
+ export declare function getComponents({ mode, name }?: {
4
+ mode?: Mode;
5
+ name?: string;
6
+ }): Promise<{
7
+ components: CustomComponentType;
8
+ }>;
@@ -0,0 +1,11 @@
1
+ import { CustomComponentType } from '../../types';
2
+ export default function CustomComponentRenderer({ id, componentId, components, properties, }: {
3
+ id: string;
4
+ componentId: string;
5
+ components?: CustomComponentType[];
6
+ properties?: {
7
+ [key: string]: {
8
+ value: any;
9
+ };
10
+ };
11
+ }): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1 @@
1
+ export { default as CustomComponentRenderer } from './CustomComponentRenderer';
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,32 @@
1
+ export type CustomComponentType = {
2
+ id: string;
3
+ createdAt: string;
4
+ updatedAt: string;
5
+ name?: string;
6
+ renderer?: {
7
+ type: 'web-component';
8
+ script?: string;
9
+ source?: {
10
+ script?: string;
11
+ };
12
+ } | {
13
+ type: 'custom-component';
14
+ componentId?: string;
15
+ properties?: {
16
+ [key: string]: {
17
+ value?: any;
18
+ };
19
+ };
20
+ };
21
+ properties?: {
22
+ [key: string]: {
23
+ index: number;
24
+ data: {
25
+ id: string;
26
+ name?: string;
27
+ type?: 'string' | 'number' | 'boolean' | 'custom-component';
28
+ defaultValue?: any;
29
+ };
30
+ };
31
+ };
32
+ };
package/package.json ADDED
@@ -0,0 +1,124 @@
1
+ {
2
+ "name": "@blocklet/pages-kit",
3
+ "version": "0.2.195",
4
+ "description": "Pages Kit components and utils",
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
+ "./api": {
20
+ "import": "./lib/esm/api/index.js",
21
+ "require": "./lib/cjs/api/index.js"
22
+ },
23
+ "./api/*": {
24
+ "import": "./lib/esm/api/*.js",
25
+ "require": "./lib/cjs/api/*.js"
26
+ },
27
+ "./components": {
28
+ "import": "./lib/esm/components/index.js",
29
+ "require": "./lib/cjs/components/index.js"
30
+ },
31
+ "./types": {
32
+ "import": "./lib/esm/types/index.js",
33
+ "require": "./lib/cjs/types/index.js"
34
+ }
35
+ },
36
+ "typesVersions": {
37
+ "*": {
38
+ "*": [
39
+ "./lib/types/index.d.ts"
40
+ ],
41
+ "api": [
42
+ "./lib/types/api/index.d.ts"
43
+ ],
44
+ "api/*": [
45
+ "./lib/types/api/*.d.ts",
46
+ "./lib/types/api/*/index.d.ts"
47
+ ],
48
+ "components": [
49
+ "./lib/types/components/index.d.ts"
50
+ ],
51
+ "types": [
52
+ "./lib/types/types/index.d.ts"
53
+ ]
54
+ }
55
+ },
56
+ "files": [
57
+ "lib",
58
+ "LICENSE",
59
+ "package.json",
60
+ "README.md",
61
+ "tsconfig.json"
62
+ ],
63
+ "repository": {
64
+ "type": "git",
65
+ "url": "git+https://github.com/blocklet/pages-kit.git"
66
+ },
67
+ "scripts": {
68
+ "lint": "eslint src --ext .mjs,.js,.jsx,.ts,.tsx",
69
+ "build": "run-p build:*",
70
+ "build:cjs": "tsc --module commonjs --outDir lib/cjs",
71
+ "build:esm": "tsc --module es2022 --outDir lib/esm",
72
+ "build:types": "tsc --declaration --emitDeclarationOnly --outDir lib/types",
73
+ "dev": "run-p 'build:* -- -w'",
74
+ "clean": "rimraf lib",
75
+ "prepublishOnly": "npm run build",
76
+ "prepare": "npm run build"
77
+ },
78
+ "dependencies": {
79
+ "@blocklet/sdk": "^1.16.22",
80
+ "axios": "^1.6.5",
81
+ "lodash": "^4.17.21",
82
+ "nanoid": "^3.3.7",
83
+ "ufo": "^1.3.2"
84
+ },
85
+ "peerDependencies": {
86
+ "@arcblock/ux": "^2.8.17",
87
+ "@emotion/cache": "^11.11.0",
88
+ "@emotion/css": "^11.11.2",
89
+ "@emotion/react": "^11.11.1",
90
+ "@mui/icons-material": "^5.14.11",
91
+ "@mui/lab": "^5.0.0-alpha.146",
92
+ "@mui/material": "^5.14.11",
93
+ "axios": "^1.6.5",
94
+ "react": "^18.2.0",
95
+ "react-dom": "^18.2.0",
96
+ "react-error-boundary": "^4.0.12",
97
+ "react-frame-component": "^5.2.6",
98
+ "react-router-dom": "^6.16.0",
99
+ "zustand": "^4.4.7"
100
+ },
101
+ "devDependencies": {
102
+ "@arcblock/ux": "^2.9.13",
103
+ "@emotion/cache": "^11.11.0",
104
+ "@emotion/css": "^11.11.2",
105
+ "@emotion/react": "^11.11.3",
106
+ "@mui/icons-material": "^5.15.4",
107
+ "@mui/lab": "^5.0.0-alpha.160",
108
+ "@mui/material": "^5.15.4",
109
+ "@types/lodash": "^4.14.202",
110
+ "@types/mustache": "^4.2.5",
111
+ "@types/node-fetch": "^2.6.10",
112
+ "@types/react": "^18.2.48",
113
+ "axios": "^1.6.5",
114
+ "npm-run-all": "^4.1.5",
115
+ "react": "^18.2.0",
116
+ "react-dom": "^18.2.0",
117
+ "react-error-boundary": "^4.0.12",
118
+ "react-frame-component": "^5.2.6",
119
+ "react-router-dom": "^6.21.2",
120
+ "rimraf": "^5.0.5",
121
+ "typescript": "^5.3.3",
122
+ "zustand": "^4.4.7"
123
+ }
124
+ }
package/tsconfig.json ADDED
@@ -0,0 +1,8 @@
1
+ {
2
+ "extends": "../../tsconfig",
3
+ "compilerOptions": {
4
+ "noEmit": false,
5
+ "outDir": "lib",
6
+ "lib": ["DOM"]
7
+ }
8
+ }