diff --git a/.changeset/rude-pears-sneeze.md b/.changeset/rude-pears-sneeze.md
new file mode 100644
index 0000000..21be9fb
--- /dev/null
+++ b/.changeset/rude-pears-sneeze.md
@@ -0,0 +1,5 @@
+---
+"solive-docusaurus-theme-code": patch
+---
+
+fix match props error
diff --git a/.eslintrc.js b/.eslintrc.js
index e188436..61b29cd 100644
--- a/.eslintrc.js
+++ b/.eslintrc.js
@@ -53,7 +53,7 @@ module.exports = {
'class-methods-use-this': 'off',
radix: 'off',
'guard-for-in': 'off',
- 'max-len': ['error', { code: 150 }],
+ 'max-len': ['error', { code: 250 }],
// TypeScript 相关
'@typescript-eslint/explicit-function-return-type': 'off',
diff --git a/.github/workflows/relesae.yaml b/.github/workflows/relesae.yaml
index 80ca4a6..d83dc4e 100644
--- a/.github/workflows/relesae.yaml
+++ b/.github/workflows/relesae.yaml
@@ -4,6 +4,8 @@ on:
push:
branches:
- main
+ paths-ignore:
+ - 'apps/**'
concurrency: ${{ github.workflow }}-${{ github.ref }}
diff --git a/apps/demo/package.json b/apps/demo/package.json
index 1a96245..31b8c20 100644
--- a/apps/demo/package.json
+++ b/apps/demo/package.json
@@ -56,6 +56,7 @@
"tailwindcss": "npm:@tailwindcss/postcss7-compat@^2.2.17",
"tty-browserify": "^0.0.1",
"url": "^0.11.0",
- "util": "^0.12.5"
+ "util": "^0.12.5",
+ "webpack-node-externals": "^3.0.0"
}
}
diff --git a/apps/doc/docs/expansion/docusaurus-plugins.mdx b/apps/doc/docs/expansion/docusaurus-plugins/guide.mdx
similarity index 85%
rename from apps/doc/docs/expansion/docusaurus-plugins.mdx
rename to apps/doc/docs/expansion/docusaurus-plugins/guide.mdx
index bb441fa..732c64d 100644
--- a/apps/doc/docs/expansion/docusaurus-plugins.mdx
+++ b/apps/doc/docs/expansion/docusaurus-plugins/guide.mdx
@@ -1,11 +1,13 @@
---
-title: Docusaurus 插件
+title: 引导
hide_title: true
+slug: /docusaurus-plugins
---
+
## Docusaurus 插件
-> 你可以使用 `solive-docusaurus-theme-code` 插件快速集成一个轻量级Solidity Editor嵌入你的文档.
+> 你可以使用 `solive-docusaurus-theme-code` 插件快速集成一个轻量级Solidity Editor嵌入你的文档. (完善中)
### 安装
@@ -27,22 +29,22 @@ module.exports = {
### 快速使用
1. 你需要注意在代码块标记solive,和配置solive的属性:
-```md
- ```solidity solive height=300px
+````md
+ ```solidity solive height=500px
// your code
- ```\
-```
+ ```
+````
-2. 你可以在代码块中配置solive相关属性 `height`(具体参考[属性表](/docs/solive-props)):
-```md
+2. 你可以在代码块中配置solive相关属性 `height`(具体参考[属性表](/docs/docusaurus-plugins/props)):
+````md
```solidity solive height=300px
// your code
- ```\
-```
+ ```
+````
3. 配置代码块文件名(可多文件):
-```md
- ```solidity solive height=300px
+````md
+ ```solidity solive height=500px
/**
* @filename Storage.sol
*/
@@ -54,12 +56,12 @@ module.exports = {
*/
// your code
- ```\
-```
+ ```
+````
3. 完整的代码块示例:
````md
-```solidity solive height=300px
+```solidity solive height=500px
/**
* @filename Storage.sol
*/
@@ -94,12 +96,12 @@ contract Storage {
return number;
}
}
-```\
+```
````
### 展示结果:
-```solidity solive height=300px
+```solidity solive height=500px
/**
* @filename Storage.sol
*/
diff --git a/apps/doc/docs/expansion/docusaurus-plugins/props.mdx b/apps/doc/docs/expansion/docusaurus-plugins/props.mdx
new file mode 100644
index 0000000..d8e7ada
--- /dev/null
+++ b/apps/doc/docs/expansion/docusaurus-plugins/props.mdx
@@ -0,0 +1,21 @@
+---
+title: 属性
+slug: /docusaurus-plugins/props
+hide_title: true
+---
+
+## 属性
+
+> 注意:考虑对参数匹配的准确性和文档UI适应性,部分Solive的属性默认值有所变动,并增加和变动一些新的属性
+
+| 属性 | 类型 | 默认值 | 说明 |
+| --- | --- | --- | --- |
+| width | string | 90% | 容器宽度 |
+| height | string | 500px | 容器高度 |
+| consoleOpen | boolean | true | 是否显示控制台 |
+| consoleTriggerControl | boolean | false | 是否显示控制台触发按钮 |
+| consoleDefaultVisible | boolean | false | 控制台默认是否可见 |
+| deployOpen | boolean | true | 是否显示部署 |
+| deployDefaultVisible | boolean | false | 部署默认是否可见 |
+| fileNavOpen | boolean | true | 是否显示文件导航栏 |
+| fileNavDefaultVisible | boolean | false | 文件导航栏默认是否可见 |
diff --git a/apps/doc/docs/expansion/index.mdx b/apps/doc/docs/expansion/index.mdx
index 10571b6..5c446a8 100644
--- a/apps/doc/docs/expansion/index.mdx
+++ b/apps/doc/docs/expansion/index.mdx
@@ -3,3 +3,10 @@ title: 扩展
sidebar_position: 3
hide_title: true
---
+
+## 扩展
+
+import DocCardList from '@theme/DocCardList';
+
+
+
diff --git a/apps/doc/docs/get-started.mdx b/apps/doc/docs/get-started.mdx
index a47d28e..cdd4b1f 100644
--- a/apps/doc/docs/get-started.mdx
+++ b/apps/doc/docs/get-started.mdx
@@ -15,21 +15,21 @@ import TabItem from '@theme/TabItem';
```sh
-npm install solive
+npm install solive-core
```
```sh
-yarn add solive
+yarn add solive-core
```
```sh
-pnpm install solive
+pnpm install solive-core
```
diff --git a/apps/next_demo/src/pages/index.tsx b/apps/next_demo/src/pages/index.tsx
index e0ff1b4..e78608d 100644
--- a/apps/next_demo/src/pages/index.tsx
+++ b/apps/next_demo/src/pages/index.tsx
@@ -1,26 +1,29 @@
-import dynamic from "next/dynamic";
+import dynamic from 'next/dynamic';
-import "solive-core/dist/index.css";
+import 'solive-core/dist/index.css';
const Editor = dynamic(
- () => {
- return import("solive-core");
- },
- { ssr: false }
+ () => import('solive-core'),
+ { ssr: false },
);
export default function Home() {
return (
- =0.7.0 <0.9.0;\n\n/**\n * @title Storage\n * @dev Store & retrieve value in a variable\n * @custom:dev-run-script ./scripts/deploy_with_ethers.ts\n */\ncontract Storage {\n\n uint256 number;\n\n /**\n * @dev Store value in variable\n * @param num value to store\n */\n function store(uint256 num) public {\n number = num;\n }\n\n /**\n * @dev Return value \n * @return value of 'number'\n */\n function retrieve() public view returns (uint256){\n return number;\n }\n}",
- language: "solidity" as any,
- }
+ language: 'solidity' as any,
+ },
]
- } height="500px" />
+ }
+ height="500px"
+ />
- )
+ );
}
diff --git a/packages/docusaurus-plugin/src/theme/utils/match-props.ts b/packages/docusaurus-plugin/src/theme/utils/match-props.ts
index 856655b..ed10e0c 100644
--- a/packages/docusaurus-plugin/src/theme/utils/match-props.ts
+++ b/packages/docusaurus-plugin/src/theme/utils/match-props.ts
@@ -29,15 +29,18 @@ export const coerceValue = (value: string, type: TPropType) => {
};
export const matchProps = (metaString: string, propsInfo: TPropsInfo): TResultProps => {
- const dynamicRex = /(?[^=]+)="(?[^"]*)"/g;
- const props: any = {};
+ const dynamicRex = /(?[^=\s]+)=(?:"(?[^"]*)"|'(?[^']*)'|(?[^\s]*))/g;
+ const props: TResultProps = {};
let match;
// eslint-disable-next-line no-cond-assign
while ((match = dynamicRex.exec(metaString)) !== null) {
- const { key, value } = match.groups as any;
- const keyName = key.trim();
- if (propsInfo[keyName]) {
- props[keyName] = coerceValue(value, propsInfo[keyName].type);
+ const { groups } = match;
+ if (groups) {
+ const key = groups.key.trim();
+ const value = groups.value1 || groups.value2 || groups.value3;
+ if (propsInfo[key]) {
+ props[key] = value;
+ }
}
}
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index e40f12c..db16739 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -122,6 +122,7 @@ importers:
url: ^0.11.0
util: ^0.12.5
web-vitals: ^2.1.4
+ webpack-node-externals: ^3.0.0
dependencies:
'@craco/craco': 7.1.0_uaemxlzga3znd5u3dmtbp5hl4i
'@testing-library/jest-dom': 5.16.5
@@ -157,6 +158,7 @@ importers:
tty-browserify: r2.cnpmjs.org/tty-browserify/0.0.1
url: r2.cnpmjs.org/url/0.11.0
util: 0.12.5
+ webpack-node-externals: r2.cnpmjs.org/webpack-node-externals/3.0.0
apps/doc:
specifiers:
@@ -218,6 +220,7 @@ importers:
solive-core: workspace:*
tailwindcss: 3.3.1
typescript: 5.0.4
+ webpack-node-externals: ^3.0.0
dependencies:
'@headlessui/react': 1.7.13_biqbaboplfbrettd7655fr4n2y
'@heroicons/react': 2.0.17_react@18.2.0
@@ -234,6 +237,8 @@ importers:
solive-core: link:../../packages/core
tailwindcss: 3.3.1_postcss@8.4.21
typescript: 5.0.4
+ devDependencies:
+ webpack-node-externals: r2.cnpmjs.org/webpack-node-externals/3.0.0
packages/compiler-utils:
specifiers:
@@ -21491,6 +21496,13 @@ packages:
clone-deep: r2.cnpmjs.org/clone-deep/4.0.1
wildcard: r2.cnpmjs.org/wildcard/2.0.0
+ r2.cnpmjs.org/webpack-node-externals/3.0.0:
+ resolution: {integrity: sha512-LnL6Z3GGDPht/AigwRh2dvL9PQPFQ8skEpVrWZXLWBYmqcaojHNN0onvHzie6rq7EWKrrBfPYqNEzTJgiwEQDQ==, registry: https://r.cnpmjs.org/, tarball: https://r2.cnpmjs.org/webpack-node-externals/-/webpack-node-externals-3.0.0.tgz}
+ name: webpack-node-externals
+ version: 3.0.0
+ engines: {node: '>=6'}
+ dev: true
+
r2.cnpmjs.org/webpack-sources/1.4.3:
resolution: {integrity: sha512-lgTS3Xhv1lCOKo7SA5TjKXMjpSM4sBjNV5+q2bqesbSPs5FjGmU6jjtBSkX9b4qW87vDIsCIlUPOEhbZrMdjeQ==, registry: https://r.cnpmjs.org/, tarball: https://r2.cnpmjs.org/webpack-sources/-/webpack-sources-1.4.3.tgz}
name: webpack-sources