Skip to content

Commit

Permalink
Merge pull request #22 from BlizzBolts/dev
Browse files Browse the repository at this point in the history
Releasing v0.8.3
  • Loading branch information
null51_ authored May 10, 2022
2 parents 7ca805f + 83477f2 commit 9c8dd62
Show file tree
Hide file tree
Showing 11 changed files with 42 additions and 328 deletions.
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,17 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- `Security` in case of vulnerabilities.


## Unreleased


### Added
- add LOG_LEVEL=VERBOSE to node env will print more info
### Changed
- extract `SharedConfig` to share type between `UserConfig` `UserFileConfig` `ResolvedUserConfig`

### Fixes
- fix iframe tools cannot be click through issue

## [0.8.2] - 2022-04-21

### Added
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"build-client": "tsc -p src/client",
"build-node": "tsc -p src/node",
"docs": "run-p dev docs-dev",
"docs-dev": "node ./bin/docit start",
"docs-dev": "LOG_LEVEL=VERBOSE node ./bin/docit start",
"docs-build": "node ./bin/docit build docs",
"test": "vitest",
"release": "yarn build && yarn publish && node scripts/gh.js"
Expand Down
2 changes: 1 addition & 1 deletion src/client/components/IFrameTools/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const IFrameTools: React.FC<IFrameToolsProps> = (props) => {
}, [url]);

return (
<StyledIFrameTools className="bottom-tools">
<StyledIFrameTools className="iframe-tools">
{qrCodeSrc && (
<StyledQrCode src={qrCodeSrc}>
<div className="qrcode-wrapper">
Expand Down
3 changes: 3 additions & 0 deletions src/client/components/IFrameTools/styled.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,13 @@ export const StyledIFrameTools = styled.div`
align-items: center;
width: 100%;
padding: 12px;
pointer-events: none;
`;

export const StyledQrCode = styled.div<{ src: string }>`
position: relative;
margin-right: 12px;
pointer-events: all;
.qrcode-wrapper {
position: relative;
display: flex;
Expand All @@ -36,4 +38,5 @@ export const StyledIconWrapper = styled.div`
display: flex;
align-items: center;
margin-right: 12px;
pointer-events: all;
`;
7 changes: 3 additions & 4 deletions src/client/components/SandBox/styled.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@

import styled from 'styled-components'
import styled from "styled-components";

export const StyledSandBox = styled.div`
:hover .bottom-tools {
:hover .iframe-tools {
visibility: visible;
}
`
`;
55 changes: 3 additions & 52 deletions src/node/plugins/mdx/debug.ts
Original file line number Diff line number Diff line change
@@ -1,55 +1,6 @@
import { visit } from 'unist-util-visit';
import { Plugin } from 'unified';
import { Link, Text } from 'mdast';
import { ResolvedUserConfig, ResolvedComponentProps } from '../../types.js';
import { tableMaker, parseApi, logger } from '../../utils/index.js';
import { select } from 'unist-util-select';
import path from 'path';
import { isEmpty } from 'lodash-es';

const { t, r, c } = tableMaker;
import { Plugin } from "unified";
import { ResolvedUserConfig } from "../../types.js";

export const debug = (config: ResolvedUserConfig): Plugin => {
return (ast) => {
const heading = r([
c('属性'),
c('类型'),
c('默认值'),
c('必填'),
c('描述'),
]);
visit(ast, 'link', (link: Link, index, parent) => {
const text = select('text', link) as Text;

if (!link || !text) {
return;
}

if (text.value.toLowerCase() === 'props' && link.url) {
const componentPath = path.resolve(config.docs, link.url);
const start = performance.now();
const parsedProps: ResolvedComponentProps[] = parseApi(
componentPath
).filter((o) => !isEmpty(o.props));
const tables = parsedProps.map((o) => {
return t([
heading,
...o.props?.map((p) => {
return r([
c(p.name || '-'),
c(p.type || '-'),
c(p.defaultValue || '-'),
c(p.isRequired ? '是' : '否'),
c(p.description || '-'),
]);
}),
]);
});
const end = performance.now();

logger.info(`Parsing ${link.url} used ${end - start}ms`);
parent.children = tables;
}
});
};
return (ast) => {};
};
78 changes: 0 additions & 78 deletions src/node/plugins/mdx/editable.ts

This file was deleted.

34 changes: 14 additions & 20 deletions src/node/types.ts
Original file line number Diff line number Diff line change
@@ -1,39 +1,33 @@
import { UserConfigExport } from "vite";
export interface UserFileConfig {

interface SharedConfig {
title?: string;
favicon?: string;
sidebars?: SidebarNode[];
publicPath?: string;
socials?: {
Twitter?: string;
Github?: string;
};
vite?: Partial<UserConfigExport>;
providerPath?: string;
}

export interface UserConfig {
/**
* Types for config file - docit.config.js
*/
export interface UserFileConfig extends SharedConfig {}

/**
* types for node api
*/
export interface UserConfig extends SharedConfig {
root: string;
title?: string;
sidebars?: SidebarNode[];
providerPath?: string;
publicPath?: string;
socials?: {
Twitter?: string;
Github?: string;
};
vite?: Partial<UserConfigExport>;
}

export interface ResolvedUserConfig {
export interface ResolvedUserConfig extends SharedConfig {
base: string;
docs: string;
title?: string;
sidebars?: SidebarNode[];
providerPath?: string;
publicPath?: string;
socials?: {
Twitter?: string;
Github?: string;
};
vite?: Partial<UserConfigExport>;
}

Expand Down
Loading

0 comments on commit 9c8dd62

Please sign in to comment.