Skip to content

Commit f717644

Browse files
NewByVectorz0gSh1u
andauthored
feat: add secretnote-lite package (#54)
* feat: init secretnote-lite * feat: init lite * feat: node curd * feat: add markdown cell module * feat: judge baseurl before fetch notebook api * feat: get notebook file from server * feat: add terminated status * feat: optimizen nodes operatiion * feat: optimize request * feat: optimize style * feat: 联调Go版contents API * fix: deny cache * feat: change request * feat: remove export file feature * feat: support start or stop node * feat: 允许下载ipynb * fix: optimize stop server * fix: optimize stop server * chore: release 0.07 * fix: update backend url * feat: change base url --------- Co-authored-by: z0gSh1u <[email protected]>
1 parent 4d4c744 commit f717644

File tree

116 files changed

+32952
-19618
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

116 files changed

+32952
-19618
lines changed

.eslintrc.cjs

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ module.exports = {
1212
],
1313
plugins: ['import'],
1414

15-
ignorePatterns: ['dist', '.eslintrc.*'],
15+
ignorePatterns: ['dist', '.eslintrc.*', 'tsup.config.js'],
1616

1717
rules: {
1818
// common pitfalls
+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
module.exports = {
2+
root: true,
3+
extends: [require.resolve('../../.eslintrc.cjs')],
4+
};

packages/secretnote-lite/package.json

+86
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
{
2+
"name": "@alipay/secretnote-lite",
3+
"version": "0.0.10",
4+
"license": "Apache-2.0",
5+
"author": "[email protected]",
6+
"repository": "https://github.com/secretflow/secretnote/tree/main/packages/secretnote",
7+
"bugs": "https://github.com/secretflow/secretnote/issues",
8+
"files": [
9+
"dist",
10+
"src"
11+
],
12+
"main": "dist/index.cjs.js",
13+
"module": "dist/index.esm.js",
14+
"types": "dist/typing/index.d.ts",
15+
"scripts": {
16+
"setup": "tsup src/index.tsx",
17+
"build": "tsup src/index.tsx",
18+
"dev": "tsup src/index.tsx --watch",
19+
"lint:eslint": "eslint src",
20+
"lint:stylelint": "stylelint 'src/**/*.{css,less}'",
21+
"pb": "pnpm publish --no-git-checks --filter @secretflow/secretnote-lite"
22+
},
23+
"dependencies": {
24+
"@antv/s2": "^1.52.0",
25+
"@difizen/libro-jupyter": "^0.1.22",
26+
"@difizen/mana-app": "^0.1.10",
27+
"@difizen/mana-common": "^0.1.10",
28+
"@difizen/mana-l10n": "^0.1.10",
29+
"@difizen/mana-react": "^0.1.10",
30+
"@kanaries/web-data-loader": "^0.1.7",
31+
"@lumino/polling": "^1.11.4",
32+
"@tiptap/core": "^2.1.11",
33+
"@tiptap/extension-color": "^2.1.11",
34+
"@tiptap/extension-highlight": "^2.1.11",
35+
"@tiptap/extension-horizontal-rule": "^2.1.11",
36+
"@tiptap/extension-link": "^2.1.11",
37+
"@tiptap/extension-placeholder": "^2.1.11",
38+
"@tiptap/extension-task-item": "^2.1.11",
39+
"@tiptap/extension-task-list": "^2.1.11",
40+
"@tiptap/extension-text-style": "^2.1.11",
41+
"@tiptap/extension-underline": "^2.1.11",
42+
"@tiptap/pm": "^2.1.11",
43+
"@tiptap/react": "^2.1.11",
44+
"@tiptap/starter-kit": "^2.1.11",
45+
"@tiptap/suggestion": "^2.1.11",
46+
"ahooks": "^3.7.8",
47+
"antd-schema-form": "^5.0.1",
48+
"canvas-confetti": "^1.9.0",
49+
"classnames": "^2.3.2",
50+
"d3-dsv": "^3.0.1",
51+
"endent": "^2.1.0",
52+
"highlight.js": "^11.9.0",
53+
"lodash-es": "^4.17.21",
54+
"lucide-react": "^0.284.0",
55+
"monaco-editor": "^0.45.0",
56+
"monaco-editor-webpack-plugin": "^7.1.0",
57+
"smoothie": "^1.36.1",
58+
"sql-formatter": "^15.0.2",
59+
"styled-components": "^6.1.0",
60+
"syntax-parser": "^1.0.18",
61+
"tippy.js": "^6.3.7",
62+
"tiptap-markdown": "^0.8.2",
63+
"xterm": "^5.3.0",
64+
"xterm-addon-canvas": "^0.5.0",
65+
"xterm-addon-fit": "^0.8.0",
66+
"xterm-addon-search": "^0.13.0",
67+
"xterm-addon-web-links": "^0.9.0"
68+
},
69+
"peerDependencies": {
70+
"antd": "^5.10.1",
71+
"react": "^18.3.1",
72+
"react-dom": "^18.1.0"
73+
},
74+
"devDependencies": {
75+
"@types/canvas-confetti": "^1.6.1",
76+
"@types/d3-dsv": "^3.0.4",
77+
"@types/lodash-es": "^4.17.12",
78+
"@types/react": "^18.2.28",
79+
"@types/react-dom": "^18.2.13",
80+
"colorette": "^2.0.19",
81+
"esbuild-plugin-svgr": "^1.1.0"
82+
},
83+
"publishConfig": {
84+
"registry": "https://registry.antgroup-inc.cn"
85+
}
86+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export * from './logo';
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
import type { CSSProperties } from 'react';
2+
import React from 'react';
3+
4+
export const Logo = ({ style }: { style: CSSProperties }) => {
5+
return (
6+
<svg
7+
style={style}
8+
width="64px"
9+
height="64px"
10+
viewBox="0 0 24.00 24.00"
11+
fill="none"
12+
xmlns="http://www.w3.org/2000/svg"
13+
stroke="#592626"
14+
strokeWidth="0.00024000000000000003"
15+
transform="matrix(1, 0, 0, 1, 0, 0)rotate(0)"
16+
>
17+
<g id="SVGRepo_bgCarrier" strokeWidth="0" />
18+
19+
<g
20+
id="SVGRepo_tracerCarrier"
21+
strokeLinecap="round"
22+
strokeLinejoin="round"
23+
stroke="#CCCCCC"
24+
strokeWidth="0.192"
25+
/>
26+
27+
<g id="SVGRepo_iconCarrier">
28+
{' '}
29+
<path
30+
opacity="0.5"
31+
d="M3 10C3 6.22876 3 4.34315 4.17157 3.17157C5.34315 2 7.22876 2 11 2H13C16.7712 2 18.6569 2 19.8284 3.17157C21 4.34315 21 6.22876 21 10V14C21 17.7712 21 19.6569 19.8284 20.8284C18.6569 22 16.7712 22 13 22H11C7.22876 22 5.34315 22 4.17157 20.8284C3 19.6569 3 17.7712 3 14V10Z"
32+
fill="#0040ff"
33+
/>{' '}
34+
<path
35+
fillRule="evenodd"
36+
clipRule="evenodd"
37+
d="M12 5.25C12.4142 5.25 12.75 5.58579 12.75 6V7.25H14C14.4142 7.25 14.75 7.58579 14.75 8C14.75 8.41421 14.4142 8.75 14 8.75L12.75 8.75L12.75 10C12.75 10.4142 12.4142 10.75 12 10.75C11.5858 10.75 11.25 10.4142 11.25 10L11.25 8.75H9.99997C9.58575 8.75 9.24997 8.41421 9.24997 8C9.24997 7.58579 9.58575 7.25 9.99997 7.25H11.25L11.25 6C11.25 5.58579 11.5858 5.25 12 5.25ZM7.25 14C7.25 13.5858 7.58579 13.25 8 13.25H16C16.4142 13.25 16.75 13.5858 16.75 14C16.75 14.4142 16.4142 14.75 16 14.75H8C7.58579 14.75 7.25 14.4142 7.25 14ZM8.25 18C8.25 17.5858 8.58579 17.25 9 17.25H15C15.4142 17.25 15.75 17.5858 15.75 18C15.75 18.4142 15.4142 18.75 15 18.75H9C8.58579 18.75 8.25 18.4142 8.25 18Z"
38+
fill="#0040ff"
39+
/>{' '}
40+
</g>
41+
</svg>
42+
);
43+
};
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
.secretnote-dropdown-menu {
2+
width: 224px;
3+
4+
.ant-dropdown-menu {
5+
padding: 4px 0;
6+
border: 1px solid var(--mana-secretnote-li-hover-background);
7+
border-radius: 4px;
8+
box-shadow: rgb(0 0 0 / 5%) 0 1px 2px 0;
9+
10+
.ant-dropdown-menu-item {
11+
padding: 4px 8px;
12+
border-radius: 0;
13+
font-size: 12px;
14+
font-weight: 400;
15+
16+
.ant-dropdown-menu-item-icon {
17+
margin-top: -2px;
18+
margin-right: 6px;
19+
}
20+
}
21+
22+
.ant-dropdown-menu-item:not(.ant-dropdown-menu-item-danger) {
23+
.ant-dropdown-menu-title-content {
24+
color: var(--mana-secretnote-text-color);
25+
}
26+
27+
.ant-dropdown-menu-item-icon {
28+
color: var(--mana-secretnote-icon-color);
29+
}
30+
}
31+
}
32+
33+
.ant-upload {
34+
padding-left: 30px;
35+
margin-left: -30px;
36+
color: var(--mana-secretnote-text-color);
37+
font-size: 12px;
38+
}
39+
}
40+
41+
.ant-dropdown-trigger {
42+
display: flex;
43+
align-items: center;
44+
color: var(--mana-secretnote-icon-color);
45+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
import type { MenuProps } from 'antd';
2+
import { Dropdown } from 'antd';
3+
import { MoreHorizontal } from 'lucide-react';
4+
import React from 'react';
5+
import './index.less';
6+
7+
export type Menu = Required<MenuProps>['items'][number];
8+
9+
interface IProps {
10+
items: Menu[];
11+
onClick?: (key: string) => void;
12+
trigger?: ('click' | 'hover' | 'contextMenu')[];
13+
icon?: React.ReactNode;
14+
}
15+
16+
function DropdownMenu(props: IProps) {
17+
const { items, onClick, icon, trigger } = props;
18+
19+
if (items.length === 0) {
20+
return null;
21+
}
22+
23+
return (
24+
<Dropdown
25+
placement="bottomLeft"
26+
menu={{
27+
items: items,
28+
onClick: ({ key, domEvent }) => {
29+
domEvent.stopPropagation();
30+
if (onClick) {
31+
onClick(key);
32+
}
33+
},
34+
}}
35+
overlayClassName="secretnote-dropdown-menu"
36+
trigger={trigger || ['click']}
37+
>
38+
<span onClick={(e) => e.stopPropagation()}>
39+
{icon ? icon : <MoreHorizontal size={14} />}
40+
</span>
41+
</Dropdown>
42+
);
43+
}
44+
45+
export { DropdownMenu };

0 commit comments

Comments
 (0)