chore: import upstream snapshot with attribution

This commit is contained in:
wehub-resource-sync
2026-07-13 12:23:31 +08:00
commit ffcb68f1df
840 changed files with 89972 additions and 0 deletions
+1
View File
@@ -0,0 +1 @@
NODE_ENV=library
+11
View File
@@ -0,0 +1,11 @@
src/assets
*/.DS_Store
node_modules
public
*.json
*.md
.eslintrc.js
.prettierignore
.prettierrc
package-lock.json
package.json
+5
View File
@@ -0,0 +1,5 @@
semi: false
singleQuote: true
printWidth: 80
trailingComma: 'none'
arrowParens: 'avoid'
+5
View File
@@ -0,0 +1,5 @@
module.exports = {
presets: [
'@vue/cli-plugin-babel/preset'
]
}
+32635
View File
File diff suppressed because it is too large Load Diff
+70
View File
@@ -0,0 +1,70 @@
{
"name": "thoughts",
"version": "0.1.0",
"private": true,
"scripts": {
"serve": "vue-cli-service serve",
"build": "vue-cli-service build && node ../copy.js",
"lint": "vue-cli-service lint",
"buildLibrary": "node ./scripts/updateVersion.js && vue-cli-service build --mode library --target lib --name simpleMindMap ../simple-mind-map/full.js --dest ../simple-mind-map/dist && esbuild ../simple-mind-map/full.js --bundle --external:buffer --format=esm --outfile=../simple-mind-map/dist/simpleMindMap.esm.js && esbuild ../simple-mind-map/full.js --bundle --minify --external:buffer --format=esm --outfile=../simple-mind-map/dist/simpleMindMap.esm.min.js",
"format": "prettier --write src/* src/*/* src/*/*/* src/*/*/*/*",
"createNodeImageList": "node ./scripts/createNodeImageList.js",
"ai:serve": "node ./scripts/ai.js"
},
"dependencies": {
"@toast-ui/editor": "^3.1.5",
"axios": "^1.7.9",
"codemirror": "^5.65.16",
"core-js": "^3.6.5",
"element-ui": "^2.15.1",
"highlight.js": "^10.7.3",
"katex": "^0.16.9",
"simple-mind-map": "^0.14.0-fix.3",
"simple-mind-map-plugin-themes": "^1.0.0",
"v-viewer": "^1.6.4",
"vue": "^2.6.11",
"vue-i18n": "^8.27.2",
"vue-router": "^3.5.1",
"vuex": "^3.6.2",
"xlsx": "^0.18.5"
},
"devDependencies": {
"@vue/cli-plugin-babel": "^4.5.0",
"@vue/cli-plugin-eslint": "^4.5.0",
"@vue/cli-service": "^4.5.0",
"babel-eslint": "^10.1.0",
"chokidar": "^3.5.3",
"esbuild": "^0.17.15",
"eslint": "^6.7.2",
"eslint-plugin-vue": "^6.2.2",
"express": "^4.21.2",
"less": "^3.12.2",
"less-loader": "^7.1.0",
"markdown-it": "^13.0.1",
"markdown-it-checkbox": "^1.1.0",
"prettier": "^1.19.1",
"vconsole": "^3.15.1",
"vue-template-compiler": "^2.6.11",
"webpack": "^4.44.2",
"webpack-dynamic-public-path": "^1.0.8"
},
"eslintConfig": {
"root": true,
"env": {
"node": true
},
"extends": [
"plugin:vue/essential",
"eslint:recommended"
],
"parserOptions": {
"parser": "babel-eslint"
},
"rules": {}
},
"browserslist": [
"> 1%",
"last 2 versions",
"not dead"
]
}
+123
View File
@@ -0,0 +1,123 @@
<!DOCTYPE html>
<html lang="">
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta
name="viewport"
content="width=device-width,user-scalable=no,initial-scale=1.0,maximum-scale=1.0,minimum-scale=1.0"
/>
<link rel="icon" href="dist/logo.ico" />
<title>思绪思维导图</title>
<script>
// 自定义静态资源的路径
window.externalPublicPath = './dist/'
// 接管应用
window.takeOverApp = false
</script>
<script
charset="UTF-8"
id="LA_COLLECT"
src="//sdk.51.la/js-sdk-pro.min.js"
></script>
<script>
try {
LA.init({
id: 'KRO0WxK8GT66tYCQ',
ck: 'KRO0WxK8GT66tYCQ',
autoTrack: false
})
} catch (error) {
console.log(error)
}
</script>
</head>
<body>
<noscript>
<strong
>We're sorry but <%= htmlWebpackPlugin.options.title %> doesn't work
properly without JavaScript enabled. Please enable it to
continue.</strong
>
</noscript>
<div id="app"></div>
<!-- built files will be auto injected -->
<script>
const getDataFromBackend = () => {
return new Promise((resolve, reject) => {
setTimeout(() => {
resolve({
mindMapData: {
root: {
data: {
text: '根节点'
},
children: []
},
theme: {
template: 'avocado',
config: {}
},
layout: 'logicalStructure',
config: {},
view: null
},
mindMapConfig: {},
lang: 'zh',
localConfig: null
})
}, 200)
})
}
const setTakeOverAppMethods = data => {
window.takeOverAppMethods = {}
// 获取思维导图数据的函数
window.takeOverAppMethods.getMindMapData = () => {
return data.mindMapData
}
// 保存思维导图数据的函数
window.takeOverAppMethods.saveMindMapData = data => {
console.log(data)
}
// 获取思维导图配置,也就是实例化时会传入的选项
window.takeOverAppMethods.getMindMapConfig = () => {
return data.mindMapConfig
}
// 保存思维导图配置
window.takeOverAppMethods.saveMindMapConfig = config => {
console.log(config)
}
// 获取语言的函数
window.takeOverAppMethods.getLanguage = () => {
return data.lang
}
// 保存语言的函数
window.takeOverAppMethods.saveLanguage = lang => {
console.log(lang)
}
// 获取本地配置的函数
window.takeOverAppMethods.getLocalConfig = () => {
return data.localConfig
}
// 保存本地配置的函数
window.takeOverAppMethods.saveLocalConfig = config => {
console.log(config)
}
}
window.onload = async () => {
if (!window.takeOverApp) return
// 请求数据
const data = await getDataFromBackend()
// 设置全局的方法
setTakeOverAppMethods(data)
// 思维导图实例创建完成事件
window.$bus.$on('app_inited', mindMap => {
console.log(mindMap)
})
// 可以通过window.$bus.$on()来监听应用的一些事件
// 实例化页面
window.initApp()
}
</script>
</body>
</html>
Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

+81
View File
@@ -0,0 +1,81 @@
const express = require('express')
const axios = require('axios')
const net = require('net')
const port = 3456
const isPortUsed = port => {
return new Promise(resolve => {
const server = net.createServer()
server.once('error', err => {
if (err.code === 'EADDRINUSE') {
resolve(true) // 端口被占用
} else {
resolve(false) // 其他错误
}
})
server.once('listening', () => {
server.close(() => resolve(false)) // 端口可用
})
server.listen(port) // 尝试监听端口
})
}
const createServe = () => {
// 起个服务
const app = express()
app.use(express.json())
app.use(express.urlencoded({ extended: true }))
// 允许跨域
app.use((req, res, next) => {
res.header('Access-Control-Allow-Origin', '*') // 允许所有来源的跨域请求,或者指定一个域名
res.header('Access-Control-Allow-Methods', '*') // 允许的方法
res.header('Access-Control-Allow-Headers', '*') // 允许的头部信息
next()
})
// 监听对话请求
app.get('/ai/test', (req, res) => {
res
.json({
code: 0,
data: null,
msg: '连接成功'
})
.end()
})
app.post('/ai/chat', async (req, res, next) => {
// 设置SSE响应头
res.setHeader('Content-Type', 'text/event-stream')
res.setHeader('Cache-Control', 'no-cache')
res.setHeader('Connection', 'keep-alive')
const { api, method = 'POST', headers = {}, data } = req.body
try {
const response = await axios({
url: api,
method,
headers,
data,
responseType: 'stream'
})
response.data.pipe(res)
} catch (error) {
next(error)
}
})
app.listen(port, () => {
console.log(`app listening on port ${port}`)
})
}
isPortUsed(port).then(isUsed => {
if (isUsed) {
console.error('端口被占用')
} else {
createServe()
}
})
+54
View File
@@ -0,0 +1,54 @@
const path = require('path')
const fs = require('fs')
const fileDest = path.join(__dirname, '../src/assets/svg')
const targetDest = path.join(__dirname, '../src/config/image.js')
const run = dir => {
let dirs = fs.readdirSync(dir)
dirs.forEach(item => {
let cur = path.join(dir, item)
if (fs.statSync(cur).isDirectory()) {
walkDir(cur, item)
}
})
}
const list = []
const importList = []
const walkDir = (dir, item) => {
let files = fs.readdirSync(dir)
let name = files.find(file => {
return !/\./.test(file)
})
let fileList = files.filter(file => {
return /\.svg$/.test(file)
})
let itemList = []
fileList.forEach(file => {
let fileName =
item + '_' + file.replace(/\.svg$/, '').replace(new RegExp('-', 'g'), '')
importList.push(`import ${fileName} from '../assets/svg/${item}/${file}'`)
itemList.push({
url: fileName,
width: 100,
height: 100
})
})
list.push({
name,
list: itemList
})
const content = `
// 该文件请运行npm run createNodeImageList命令自动生成
${importList.join('\n')}
export default ${JSON.stringify(list, null, 2).replace(
/(url":\s*)"([^"]+)"(,)/g,
'$1$2$3'
)}
`
fs.writeFileSync(targetDest, content)
}
run(fileDest)
console.log('运行成功')
+11
View File
@@ -0,0 +1,11 @@
const path = require('path')
const fs = require('fs')
const pkg = require('../../simple-mind-map/package.json')
const file = path.resolve('../simple-mind-map/full.js')
let content = fs.readFileSync(file, 'utf-8')
content = content.replace(
/(MindMap.version\s*=\s*)[^\n]+(\n)/,
`$1'${pkg.version}'$2`
)
fs.writeFileSync(file, content)
+46
View File
@@ -0,0 +1,46 @@
<template>
<div id="app">
<router-view></router-view>
</div>
</template>
<script>
export default {
name: 'App'
}
</script>
<style lang="less">
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
#app {
font-family: Avenir, Helvetica, Arial, sans-serif;
color: #2c3e50;
}
.customScrollbar {
&::-webkit-scrollbar {
width: 7px;
height: 7px;
}
&::-webkit-scrollbar-thumb {
border-radius: 7px;
background-color: rgba(0, 0, 0, 0.3);
cursor: pointer;
}
&::-webkit-scrollbar-track {
box-shadow: none;
background: transparent;
display: none;
}
}
.el-dialog{
border-radius: 10px;
}
</style>
+136
View File
@@ -0,0 +1,136 @@
import exampleData from 'simple-mind-map/example/exampleData'
import { simpleDeepClone } from 'simple-mind-map/src/utils/index'
import Vue from 'vue'
import vuexStore from '@/store'
const SIMPLE_MIND_MAP_DATA = 'SIMPLE_MIND_MAP_DATA'
const SIMPLE_MIND_MAP_CONFIG = 'SIMPLE_MIND_MAP_CONFIG'
const SIMPLE_MIND_MAP_LANG = 'SIMPLE_MIND_MAP_LANG'
const SIMPLE_MIND_MAP_LOCAL_CONFIG = 'SIMPLE_MIND_MAP_LOCAL_CONFIG'
let mindMapData = null
// 获取缓存的思维导图数据
export const getData = () => {
// 接管模式
if (window.takeOverApp) {
mindMapData = window.takeOverAppMethods.getMindMapData()
return mindMapData
}
// 操作本地文件模式
if (vuexStore.state.isHandleLocalFile) {
return Vue.prototype.getCurrentData()
}
let store = localStorage.getItem(SIMPLE_MIND_MAP_DATA)
if (store === null) {
return simpleDeepClone(exampleData)
} else {
try {
return JSON.parse(store)
} catch (error) {
return simpleDeepClone(exampleData)
}
}
}
// 存储思维导图数据
export const storeData = data => {
try {
let originData = null
if (window.takeOverApp) {
originData = mindMapData
} else {
originData = getData()
}
if (!originData) {
originData = {}
}
originData = {
...originData,
...data
}
if (window.takeOverApp) {
mindMapData = originData
window.takeOverAppMethods.saveMindMapData(originData)
return
}
Vue.prototype.$bus.$emit('write_local_file', originData)
if (vuexStore.state.isHandleLocalFile) {
return
}
localStorage.setItem(SIMPLE_MIND_MAP_DATA, JSON.stringify(originData))
} catch (error) {
console.log(error)
if ('exceeded') {
Vue.prototype.$bus.$emit('localStorageExceeded')
}
}
}
// 获取思维导图配置数据
export const getConfig = () => {
if (window.takeOverApp) {
window.takeOverAppMethods.getMindMapConfig()
return
}
let config = localStorage.getItem(SIMPLE_MIND_MAP_CONFIG)
if (config) {
return JSON.parse(config)
}
return null
}
// 存储思维导图配置数据
export const storeConfig = config => {
try {
if (window.takeOverApp) {
window.takeOverAppMethods.saveMindMapConfig(config)
return
}
localStorage.setItem(SIMPLE_MIND_MAP_CONFIG, JSON.stringify(config))
} catch (error) {
console.log(error)
}
}
// 存储语言
export const storeLang = lang => {
if (window.takeOverApp) {
window.takeOverAppMethods.saveLanguage(lang)
return
}
localStorage.setItem(SIMPLE_MIND_MAP_LANG, lang)
}
// 获取存储的语言
export const getLang = () => {
if (window.takeOverApp) {
return window.takeOverAppMethods.getLanguage() || 'zh'
}
let lang = localStorage.getItem(SIMPLE_MIND_MAP_LANG)
if (lang) {
return lang
}
storeLang('zh')
return 'zh'
}
// 存储本地配置
export const storeLocalConfig = config => {
if (window.takeOverApp) {
return window.takeOverAppMethods.saveLocalConfig(config)
}
localStorage.setItem(SIMPLE_MIND_MAP_LOCAL_CONFIG, JSON.stringify(config))
}
// 获取本地配置
export const getLocalConfig = () => {
if (window.takeOverApp) {
return window.takeOverAppMethods.getLocalConfig()
}
let config = localStorage.getItem(SIMPLE_MIND_MAP_LOCAL_CONFIG)
if (config) {
return JSON.parse(config)
}
return null
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 63 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 36 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 40 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 43 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 35 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 50 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 29 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 146 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 191 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 80 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 42 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 62 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 180 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 39 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 64 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 62 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 75 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 33 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 57 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 33 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 58 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 40 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 46 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 48 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 51 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 123 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 41 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 37 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 36 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 105 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 45 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 148 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 176 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 63 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 54 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 80 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 46 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 55 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 57 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 39 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 347 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 52 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 126 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 43 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 54 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 42 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 68 KiB

Some files were not shown because too many files have changed in this diff Show More