Skip to content

Commit

Permalink
Collection of SecretNote Improvement (until 0829) (#57)
Browse files Browse the repository at this point in the history
* feat: baseline version

* feat: add about bar

* feat: stable node color for same name

* feat: add metrics panel

* feat: support metrics monitoring of nodes

* feat: add more docs

* feat: support get versions

* feat: misc changes

* feat: add more comments

* fix: clear outputarea when restart kernel

* feat: more node info and supports LSP

* feat: use customized drive to take over contents manager's

* feat: make customized drive simple

* fix: download notebook file

* refactor: format all

* feat: support ws auth in lsp connection

* fix: format all

* fix: encode token

* feat: support file viewing when no kernel is available

* fix: top toolbar run is invalid

* feat: use markdown to render welcome docs

* feat: toolbar run button and show loading when uploading

* fix: the time sequence of defaultServerManager's launch

* chore: misc changes to the toolchain

* feat: correct file path for new drive and add busy status for file list

* fix: stream stderr being missing

* fix: rename welcome

* fix: sanitize code

* chore: sanitize deps

* fix: remove debug settings

* refactor: format all

* chore: optimize packaging
  • Loading branch information
z0gSh1u authored Aug 29, 2024
1 parent f294da7 commit c44cdb0
Show file tree
Hide file tree
Showing 70 changed files with 3,321 additions and 1,190 deletions.
1 change: 1 addition & 0 deletions docker/app/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ RUN npm config set registry https://registry.npmmirror.com
RUN npm install @difizen/libro-analyzer

COPY --from=build /dist /dist
RUN pip config set global.index-url https://mirrors.aliyun.com/pypi/simple/
RUN pip install /dist/pyprojects/secretnote/dist/*.whl

WORKDIR /home/secretnote
Expand Down
2 changes: 2 additions & 0 deletions packages/secretnote-lite/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
node_modules
dist
31 changes: 18 additions & 13 deletions packages/secretnote-lite/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@alipay/secretnote-lite",
"version": "0.0.34",
"version": "0.0.42",
"license": "Apache-2.0",
"author": "[email protected]",
"repository": "https://github.com/secretflow/secretnote/tree/main/packages/secretnote",
Expand All @@ -9,25 +9,27 @@
"dist",
"src"
],
"main": "dist/index.cjs.js",
"module": "dist/index.esm.js",
"types": "dist/typing/index.d.ts",
"main": "dist/index.js",
"module": "dist/index.js",
"types": "dist/index.d.ts",
"scripts": {
"setup": "tsup src/index.tsx",
"build": "tsup src/index.tsx",
"build": "tsup src/index.tsx --inject ./react-shim.js",
"dev": "tsup src/index.tsx --watch",
"lint:eslint": "eslint src",
"lint:stylelint": "stylelint 'src/**/*.{css,less}'",
"pb": "pnpm publish --no-git-checks --filter @secretflow/secretnote-lite"
},
"dependencies": {
"@antv/s2": "^1.52.0",
"@difizen/libro-jupyter": "^0.1.22",
"@difizen/mana-app": "^0.1.10",
"@difizen/mana-common": "^0.1.10",
"@difizen/mana-l10n": "^0.1.10",
"@difizen/mana-react": "^0.1.10",
"@difizen/libro-jupyter": "^0.2.20",
"@difizen/libro-language-client": "^0.2.20",
"@difizen/mana-app": "^0.1.19",
"@difizen/mana-common": "^0.1.19",
"@difizen/mana-l10n": "^0.1.19",
"@difizen/mana-react": "^0.1.19",
"@kanaries/web-data-loader": "^0.1.7",
"@lumino/polling": "^2.1.3",
"@tiptap/core": "^2.1.11",
"@tiptap/extension-color": "^2.1.11",
"@tiptap/extension-highlight": "^2.1.11",
Expand All @@ -43,11 +45,13 @@
"@tiptap/starter-kit": "^2.1.11",
"@tiptap/suggestion": "^2.1.11",
"ahooks": "^3.7.8",
"canvas-confetti": "^1.9.0",
"classnames": "^2.3.2",
"d3-dsv": "^3.0.1",
"highlight.js": "^11.9.0",
"lodash-es": "^4.17.21",
"lucide-react": "^0.284.0",
"markdown-it": "^14.1.0",
"monaco-editor": "^0.45.0",
"monaco-editor-webpack-plugin": "^7.1.0",
"styled-components": "^6.1.0",
Expand All @@ -57,8 +61,7 @@
"xterm-addon-canvas": "^0.5.0",
"xterm-addon-fit": "^0.8.0",
"xterm-addon-search": "^0.13.0",
"xterm-addon-web-links": "^0.9.0",
"canvas-confetti": "^1.9.0"
"xterm-addon-web-links": "^0.9.0"
},
"peerDependencies": {
"antd": "^5.10.1",
Expand All @@ -71,7 +74,9 @@
"@types/react": "^18.2.28",
"@types/react-dom": "^18.2.13",
"colorette": "^2.0.19",
"esbuild-plugin-svgr": "^1.1.0"
"esbuild-plugin-svgr": "^1.1.0",
"tsup": "^8.2.4",
"typescript": "^5.5.4"
},
"publishConfig": {
"registry": "https://registry.antgroup-inc.cn"
Expand Down
2 changes: 2 additions & 0 deletions packages/secretnote-lite/react-shim.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
import React from 'react';
export { React };
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
.ant-dropdown-menu-item {
padding: 4px 8px;
border-radius: 0;
font-size: 12px;
font-size: 13px;
font-weight: 400;

.ant-dropdown-menu-item-icon {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,11 @@ interface IProps {
onClick?: (key: string) => void;
trigger?: ('click' | 'hover' | 'contextMenu')[];
icon?: React.ReactNode;
disabled?: boolean;
}

function DropdownMenu(props: IProps) {
const { items, onClick, icon, trigger } = props;
const { items, onClick, icon, trigger, disabled } = props;

if (items.length === 0) {
return null;
Expand All @@ -34,6 +35,7 @@ function DropdownMenu(props: IProps) {
}}
overlayClassName="secretnote-dropdown-menu"
trigger={trigger || ['click']}
disabled={disabled}
>
<span onClick={(e) => e.stopPropagation()}>
{icon ? icon : <MoreHorizontal size={14} />}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { l10n } from '@difizen/mana-l10n';
import { InputRule } from '@tiptap/core';
import { Color } from '@tiptap/extension-color';
import { Highlight } from '@tiptap/extension-highlight';
Expand All @@ -9,9 +10,7 @@ import { TaskList } from '@tiptap/extension-task-list';
import { TextStyle } from '@tiptap/extension-text-style';
import TiptapUnderline from '@tiptap/extension-underline';
import { StarterKit } from '@tiptap/starter-kit';
import React from 'react';
import { Markdown } from 'tiptap-markdown';

import SlashCommand from './slash-command';

export const defaultExtensions = [
Expand Down Expand Up @@ -88,9 +87,9 @@ export const defaultExtensions = [
Placeholder.configure({
placeholder: ({ node }) => {
if (node.type.name === 'heading') {
return `Heading ${node.attrs.level}`;
return `标题 ${node.attrs.level}`;
}
return "Press '/' for commands";
return l10n.t('键入 / 查看更多命令');
},
includeChildren: true,
}),
Expand Down
2 changes: 1 addition & 1 deletion packages/secretnote-lite/src/components/ribbon/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ function Ribbon(props: RibbonProps) {
const getLabel = (values: string[]) => {
const filterItems = items.filter((item) => values.includes(item.key));
if (filterItems.length === 0) {
return 'Select Nodes';
return l10n.t('选择执行节点...');
}
return filterItems.map((item) => item.label).join(',');
};
Expand Down
10 changes: 9 additions & 1 deletion packages/secretnote-lite/src/index.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import '@/lang';
import { ManaAppPreset, ManaComponents } from '@difizen/mana-app';
import React from 'react';
import { message } from 'antd';

import { EditorModule } from '@/modules/editor';
import { FileModule } from '@/modules/file';
Expand All @@ -12,6 +12,7 @@ import { StorageModule } from '@/modules/storage';
import { ThemeModule } from '@/modules/theme';
import { ToolbarModule } from '@/modules/toolbar';
import { WelcomeModule } from '@/modules/welcome';
import { MetricsModule } from './modules/metrics';
import './override.less';

const App = (): JSX.Element => {
Expand All @@ -25,13 +26,20 @@ const App = (): JSX.Element => {
ThemeModule,
StorageModule,
EditorModule,
MetricsModule,
NodeModule,
NotebookModule,
FileModule,
MarkdownCellModule,
ToolbarModule,
WelcomeModule,
]}
onReady={() => {
// do some initialization
message.config({
maxCount: 1,
});
}}
/>
);
};
Expand Down
4 changes: 2 additions & 2 deletions packages/secretnote-lite/src/lang/bundle.l10n.en-US.json
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@
"运行 Cell": "Run Cell",
"运行上方所有 Cell": "Run all cells above",
"运行当前及下方所有 Cell": "Run the current and all cells below",
"kernel准备中,无法执行": "kernel preparation, unable to execute",
"Kernel 准备中,无法执行": "Kernel preparation, unable to execute",
"运行当前Cell": "Run the current Cell",
"运行全部": "Run all",
"运行之前所有cell": "All cells before running",
Expand Down Expand Up @@ -320,4 +320,4 @@
"类型": "Type",
"请选择节点类型": "Please select a node type",
"通用": "Common"
}
}
4 changes: 2 additions & 2 deletions packages/secretnote-lite/src/lang/bundle.l10n.zh-CN.json
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@
"运行 Cell": "运行 Cell",
"运行上方所有 Cell": "运行上方所有 Cell",
"运行当前及下方所有 Cell": "运行当前及下方所有 Cell",
"kernel准备中,无法执行": "kernel准备中,无法执行",
"Kernel 准备中,无法执行": "Kernel 准备中,无法执行",
"运行当前Cell": "运行当前Cell",
"运行全部": "运行全部",
"运行之前所有cell": "运行之前所有cell",
Expand Down Expand Up @@ -320,4 +320,4 @@
"类型": "类型",
"请选择节点类型": "请选择节点类型",
"通用": "通用"
}
}
17 changes: 8 additions & 9 deletions packages/secretnote-lite/src/lang/index.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
import type { LanguageBundles } from '@difizen/mana-l10n';
import { l10n, L10nLang } from '@difizen/mana-l10n';
// Multilingual support

import lang_en_us from './bundle.l10n.en-US.json';
import lang_zh_cn from './bundle.l10n.zh-CN.json';
import { l10n, L10nLang } from '@difizen/mana-l10n';

export const langBundles: LanguageBundles = {
'zh-CN': lang_zh_cn,
'en-US': lang_en_us,
};
import bundleENUS from './bundle.l10n.en-US.json';
import bundleZHCN from './bundle.l10n.zh-CN.json';

l10n.loadLangBundles(langBundles);
l10n.loadLangBundles({
'zh-CN': bundleZHCN,
'en-US': bundleENUS,
});
l10n.changeLang(L10nLang.zhCN);
Loading

0 comments on commit c44cdb0

Please sign in to comment.