You've already forked obsidian-visualiser
Compare commits
8 Commits
character
...
9ca546f490
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9ca546f490 | ||
|
|
2c80cb2456 | ||
|
|
6100fd9411 | ||
| 1d41514b26 | |||
| 227d7224e5 | |||
| f49fdaac79 | |||
| 41c19b4bfb | |||
|
|
c0e625a8cb |
139
app.vue
139
app.vue
@@ -1,7 +1,6 @@
|
||||
<template>
|
||||
<div class="text-light-100 dark:text-dark-100 flex bg-light-0 dark:bg-dark-0 h-screen overflow-hidden">
|
||||
<NuxtRouteAnnouncer/>
|
||||
<NuxtLoadingIndicator />
|
||||
<TooltipProvider>
|
||||
<NuxtLayout>
|
||||
<div class="xl:px-12 xl:py-8 lg:px-8 lg:py-6 px-6 py-3 flex flex-1 justify-center overflow-auto max-h-full relative">
|
||||
@@ -14,14 +13,33 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { Content } from './shared/content.util';
|
||||
import * as Floating from '#shared/floating.util';
|
||||
|
||||
provideToaster();
|
||||
|
||||
onBeforeMount(() => {
|
||||
Content.init();
|
||||
Floating.init();
|
||||
|
||||
const unmount = useRouter().afterEach((to, from, failure) => {
|
||||
if(failure) return;
|
||||
|
||||
document.querySelectorAll(`a[href="${from.path}"][data-active]`).forEach(e => e.classList.remove(e.getAttribute('data-active') ?? ''));
|
||||
document.querySelectorAll(`a[href="${to.path}"][data-active]`).forEach(e => e.classList.add(e.getAttribute('data-active') ?? ''));
|
||||
});
|
||||
|
||||
onUnmounted(() => {
|
||||
unmount();
|
||||
})
|
||||
});
|
||||
|
||||
const { list } = useToast();
|
||||
</script>
|
||||
|
||||
<style>
|
||||
::-webkit-scrollbar {
|
||||
width: 12px;
|
||||
width: 12px;
|
||||
height: 12px;
|
||||
}
|
||||
|
||||
@@ -39,4 +57,121 @@ const { list } = useToast();
|
||||
@apply bg-light-50;
|
||||
@apply dark:bg-dark-50;
|
||||
}
|
||||
.callout[data-type="abstract"],
|
||||
.callout[data-type="summary"],
|
||||
.callout[data-type="tldr"]
|
||||
{
|
||||
@apply bg-light-cyan;
|
||||
@apply dark:bg-dark-cyan;
|
||||
@apply text-light-cyan;
|
||||
@apply dark:text-dark-cyan;
|
||||
}
|
||||
.callout[data-type="info"]
|
||||
{
|
||||
@apply bg-light-blue;
|
||||
@apply dark:bg-dark-blue;
|
||||
@apply text-light-blue;
|
||||
@apply dark:text-dark-blue;
|
||||
}
|
||||
.callout[data-type="todo"]
|
||||
{
|
||||
@apply bg-light-blue;
|
||||
@apply dark:bg-dark-blue;
|
||||
@apply text-light-blue;
|
||||
@apply dark:text-dark-blue;
|
||||
}
|
||||
.callout[data-type="important"]
|
||||
{
|
||||
@apply bg-light-cyan;
|
||||
@apply dark:bg-dark-cyan;
|
||||
@apply text-light-cyan;
|
||||
@apply dark:text-dark-cyan;
|
||||
}
|
||||
.callout[data-type="tip"],
|
||||
.callout[data-type="hint"]
|
||||
{
|
||||
@apply bg-light-cyan;
|
||||
@apply dark:bg-dark-cyan;
|
||||
@apply text-light-cyan;
|
||||
@apply dark:text-dark-cyan;
|
||||
}
|
||||
.callout[data-type="success"],
|
||||
.callout[data-type="check"],
|
||||
.callout[data-type="done"]
|
||||
{
|
||||
@apply bg-light-green;
|
||||
@apply dark:bg-dark-green;
|
||||
@apply text-light-green;
|
||||
@apply dark:text-dark-green;
|
||||
}
|
||||
.callout[data-type="question"],
|
||||
.callout[data-type="help"],
|
||||
.callout[data-type="faq"]
|
||||
{
|
||||
@apply bg-light-orange;
|
||||
@apply dark:bg-dark-orange;
|
||||
@apply text-light-orange;
|
||||
@apply dark:text-dark-orange;
|
||||
}
|
||||
.callout[data-type="warning"],
|
||||
.callout[data-type="caution"],
|
||||
.callout[data-type="attention"]
|
||||
{
|
||||
@apply bg-light-orange;
|
||||
@apply dark:bg-dark-orange;
|
||||
@apply text-light-orange;
|
||||
@apply dark:text-dark-orange;
|
||||
}
|
||||
.callout[data-type="failure"],
|
||||
.callout[data-type="fail"],
|
||||
.callout[data-type="missing"]
|
||||
{
|
||||
@apply bg-light-red;
|
||||
@apply dark:bg-dark-red;
|
||||
@apply text-light-red;
|
||||
@apply dark:text-dark-red;
|
||||
}
|
||||
.callout[data-type="danger"],
|
||||
.callout[data-type="error"]
|
||||
{
|
||||
@apply bg-light-red;
|
||||
@apply dark:bg-dark-red;
|
||||
@apply text-light-red;
|
||||
@apply dark:text-dark-red;
|
||||
}
|
||||
.callout[data-type="bug"]
|
||||
{
|
||||
@apply bg-light-red;
|
||||
@apply dark:bg-dark-red;
|
||||
@apply text-light-red;
|
||||
@apply dark:text-dark-red;
|
||||
}
|
||||
.callout[data-type="example"]
|
||||
{
|
||||
@apply bg-light-purple;
|
||||
@apply dark:bg-dark-purple;
|
||||
@apply text-light-purple;
|
||||
@apply dark:text-dark-purple;
|
||||
}
|
||||
.variant-cap
|
||||
{
|
||||
font-variant: small-caps;
|
||||
}
|
||||
.cm-editor
|
||||
{
|
||||
@apply bg-transparent;
|
||||
@apply flex-1 h-full;
|
||||
@apply font-sans;
|
||||
|
||||
@apply text-light-100 dark:text-dark-100;
|
||||
}
|
||||
.cm-editor .cm-content
|
||||
{
|
||||
@apply caret-light-100 dark:caret-dark-100;
|
||||
}
|
||||
.cm-line
|
||||
{
|
||||
@apply text-base;
|
||||
@apply font-sans;
|
||||
}
|
||||
</style>
|
||||
399
bun.lock
399
bun.lock
@@ -5,7 +5,10 @@
|
||||
"name": "d-any",
|
||||
"dependencies": {
|
||||
"@atlaskit/pragmatic-drag-and-drop": "^1.5.0",
|
||||
"@atlaskit/pragmatic-drag-and-drop-auto-scroll": "^2.1.0",
|
||||
"@atlaskit/pragmatic-drag-and-drop-hitbox": "^1.0.3",
|
||||
"@codemirror/lang-markdown": "^6.3.2",
|
||||
"@floating-ui/dom": "^1.6.13",
|
||||
"@iconify/vue": "^4.3.0",
|
||||
"@lezer/highlight": "^1.2.1",
|
||||
"@markdoc/markdoc": "^0.5.1",
|
||||
@@ -16,12 +19,12 @@
|
||||
"@vueuse/gesture": "^2.0.0",
|
||||
"@vueuse/math": "^12.7.0",
|
||||
"@vueuse/nuxt": "^12.7.0",
|
||||
"codemirror": "5.65.18",
|
||||
"codemirror": "6.0.1",
|
||||
"drizzle-orm": "^0.39.3",
|
||||
"hast": "^1.0.0",
|
||||
"hast-util-heading": "^3.0.0",
|
||||
"hast-util-heading-rank": "^3.0.0",
|
||||
"hypermd": "^0.3.11",
|
||||
"iconify-icon": "^2.3.0",
|
||||
"lodash.capitalize": "^4.2.1",
|
||||
"mdast-util-find-and-replace": "^3.0.2",
|
||||
"nodemailer": "^6.10.0",
|
||||
@@ -65,6 +68,8 @@
|
||||
|
||||
"@atlaskit/pragmatic-drag-and-drop": ["@atlaskit/pragmatic-drag-and-drop@1.5.0", "", { "dependencies": { "@babel/runtime": "^7.0.0", "bind-event-listener": "^3.0.0", "raf-schd": "^4.0.3" } }, "sha512-VnHcgOBALm+mbL9CoJPI6wBNQeB0is+CkejdfAlaP8RfBoELe+0sQtE8j4Z4fPRqDzo11OEqUYKHkmx4Ttzozg=="],
|
||||
|
||||
"@atlaskit/pragmatic-drag-and-drop-auto-scroll": ["@atlaskit/pragmatic-drag-and-drop-auto-scroll@2.1.0", "", { "dependencies": { "@atlaskit/pragmatic-drag-and-drop": "^1.4.0", "@babel/runtime": "^7.0.0" } }, "sha512-E52y8/0BTTf4ai6BJyFYgdVHFgQ1AES33KvAVQpZ41jMkoukLIq6UoCudOXku7xs3qoPygQdpC+vitVUuEFJXw=="],
|
||||
|
||||
"@atlaskit/pragmatic-drag-and-drop-hitbox": ["@atlaskit/pragmatic-drag-and-drop-hitbox@1.0.3", "", { "dependencies": { "@atlaskit/pragmatic-drag-and-drop": "^1.1.0", "@babel/runtime": "^7.0.0" } }, "sha512-/Sbu/HqN2VGLYBhnsG7SbRNg98XKkbF6L7XDdBi+izRybfaK1FeMfodPpm/xnBHPJzwYMdkE0qtLyv6afhgMUA=="],
|
||||
|
||||
"@babel/code-frame": ["@babel/code-frame@7.26.2", "", { "dependencies": { "@babel/helper-validator-identifier": "^7.25.9", "js-tokens": "^4.0.0", "picocolors": "^1.0.0" } }, "sha512-RJlIHRueQgwWitWgF8OdFYGZX328Ax5BCemNGlqHfplnRT9ESi8JkFlvaVYbS+UubVY6dpv87Fs2u5M29iNFVQ=="],
|
||||
@@ -129,10 +134,30 @@
|
||||
|
||||
"@babel/types": ["@babel/types@7.26.9", "", { "dependencies": { "@babel/helper-string-parser": "^7.25.9", "@babel/helper-validator-identifier": "^7.25.9" } }, "sha512-Y3IR1cRnOxOCDvMmNiym7XpXQ93iGDDPHx+Zj+NM+rg0fBaShfQLkg+hKPaZCEvg5N/LeCo4+Rj/i3FuJsIQaw=="],
|
||||
|
||||
"@braintree/sanitize-url": ["@braintree/sanitize-url@3.1.0", "", {}, "sha512-GcIY79elgB+azP74j8vqkiXz8xLFfIzbQJdlwOPisgbKT00tviJQuEghOXSMVxJ00HoYJbGswr4kcllUc4xCcg=="],
|
||||
|
||||
"@cloudflare/kv-asset-handler": ["@cloudflare/kv-asset-handler@0.3.4", "", { "dependencies": { "mime": "^3.0.0" } }, "sha512-YLPHc8yASwjNkmcDMQMY35yiWjoKAKnhUbPRszBRS0YgH+IXtsMp61j+yTcnCE3oO2DgP0U3iejLC8FTtKDC8Q=="],
|
||||
|
||||
"@codemirror/autocomplete": ["@codemirror/autocomplete@6.18.6", "", { "dependencies": { "@codemirror/language": "^6.0.0", "@codemirror/state": "^6.0.0", "@codemirror/view": "^6.17.0", "@lezer/common": "^1.0.0" } }, "sha512-PHHBXFomUs5DF+9tCOM/UoW6XQ4R44lLNNhRaW9PKPTU0D7lIjRg3ElxaJnTwsl/oHiR93WSXDBrekhoUGCPtg=="],
|
||||
|
||||
"@codemirror/commands": ["@codemirror/commands@6.8.0", "", { "dependencies": { "@codemirror/language": "^6.0.0", "@codemirror/state": "^6.4.0", "@codemirror/view": "^6.27.0", "@lezer/common": "^1.1.0" } }, "sha512-q8VPEFaEP4ikSlt6ZxjB3zW72+7osfAYW9i8Zu943uqbKuz6utc1+F170hyLUCUltXORjQXRyYQNfkckzA/bPQ=="],
|
||||
|
||||
"@codemirror/lang-css": ["@codemirror/lang-css@6.3.1", "", { "dependencies": { "@codemirror/autocomplete": "^6.0.0", "@codemirror/language": "^6.0.0", "@codemirror/state": "^6.0.0", "@lezer/common": "^1.0.2", "@lezer/css": "^1.1.7" } }, "sha512-kr5fwBGiGtmz6l0LSJIbno9QrifNMUusivHbnA1H6Dmqy4HZFte3UAICix1VuKo0lMPKQr2rqB+0BkKi/S3Ejg=="],
|
||||
|
||||
"@codemirror/lang-html": ["@codemirror/lang-html@6.4.9", "", { "dependencies": { "@codemirror/autocomplete": "^6.0.0", "@codemirror/lang-css": "^6.0.0", "@codemirror/lang-javascript": "^6.0.0", "@codemirror/language": "^6.4.0", "@codemirror/state": "^6.0.0", "@codemirror/view": "^6.17.0", "@lezer/common": "^1.0.0", "@lezer/css": "^1.1.0", "@lezer/html": "^1.3.0" } }, "sha512-aQv37pIMSlueybId/2PVSP6NPnmurFDVmZwzc7jszd2KAF8qd4VBbvNYPXWQq90WIARjsdVkPbw29pszmHws3Q=="],
|
||||
|
||||
"@codemirror/lang-javascript": ["@codemirror/lang-javascript@6.2.3", "", { "dependencies": { "@codemirror/autocomplete": "^6.0.0", "@codemirror/language": "^6.6.0", "@codemirror/lint": "^6.0.0", "@codemirror/state": "^6.0.0", "@codemirror/view": "^6.17.0", "@lezer/common": "^1.0.0", "@lezer/javascript": "^1.0.0" } }, "sha512-8PR3vIWg7pSu7ur8A07pGiYHgy3hHj+mRYRCSG8q+mPIrl0F02rgpGv+DsQTHRTc30rydOsf5PZ7yjKFg2Ackw=="],
|
||||
|
||||
"@codemirror/lang-markdown": ["@codemirror/lang-markdown@6.3.2", "", { "dependencies": { "@codemirror/autocomplete": "^6.7.1", "@codemirror/lang-html": "^6.0.0", "@codemirror/language": "^6.3.0", "@codemirror/state": "^6.0.0", "@codemirror/view": "^6.0.0", "@lezer/common": "^1.2.1", "@lezer/markdown": "^1.0.0" } }, "sha512-c/5MYinGbFxYl4itE9q/rgN/sMTjOr8XL5OWnC+EaRMLfCbVUmmubTJfdgpfcSS2SCaT7b+Q+xi3l6CgoE+BsA=="],
|
||||
|
||||
"@codemirror/language": ["@codemirror/language@6.11.0", "", { "dependencies": { "@codemirror/state": "^6.0.0", "@codemirror/view": "^6.23.0", "@lezer/common": "^1.1.0", "@lezer/highlight": "^1.0.0", "@lezer/lr": "^1.0.0", "style-mod": "^4.0.0" } }, "sha512-A7+f++LodNNc1wGgoRDTt78cOwWm9KVezApgjOMp1W4hM0898nsqBXwF+sbePE7ZRcjN7Sa1Z5m2oN27XkmEjQ=="],
|
||||
|
||||
"@codemirror/lint": ["@codemirror/lint@6.8.5", "", { "dependencies": { "@codemirror/state": "^6.0.0", "@codemirror/view": "^6.35.0", "crelt": "^1.0.5" } }, "sha512-s3n3KisH7dx3vsoeGMxsbRAgKe4O1vbrnKBClm99PU0fWxmxsx5rR2PfqQgIt+2MMJBHbiJ5rfIdLYfB9NNvsA=="],
|
||||
|
||||
"@codemirror/search": ["@codemirror/search@6.5.10", "", { "dependencies": { "@codemirror/state": "^6.0.0", "@codemirror/view": "^6.0.0", "crelt": "^1.0.5" } }, "sha512-RMdPdmsrUf53pb2VwflKGHEe1XVM07hI7vV2ntgw1dmqhimpatSJKva4VA9h4TLUDOD4EIF02201oZurpnEFsg=="],
|
||||
|
||||
"@codemirror/state": ["@codemirror/state@6.5.2", "", { "dependencies": { "@marijn/find-cluster-break": "^1.0.0" } }, "sha512-FVqsPqtPWKVVL3dPSxy8wEF/ymIEuVzF1PK3VbUgrxXpJUSHQWWZz4JMToquRxnkw+36LTamCZG2iua2Ptq0fA=="],
|
||||
|
||||
"@codemirror/view": ["@codemirror/view@6.36.5", "", { "dependencies": { "@codemirror/state": "^6.5.0", "style-mod": "^4.1.0", "w3c-keyname": "^2.2.4" } }, "sha512-cd+FZEUlu3GQCYnguYm3EkhJ8KJVisqqUsCOKedBoAt/d9c76JUUap6U0UrpElln5k6VyrEOYliMuDAKIeDQLg=="],
|
||||
|
||||
"@csstools/selector-resolve-nested": ["@csstools/selector-resolve-nested@3.0.0", "", { "peerDependencies": { "postcss-selector-parser": "^7.0.0" } }, "sha512-ZoK24Yku6VJU1gS79a5PFmC8yn3wIapiKmPgun0hZgEI5AOqgH2kiPRsPz1qkGv4HL+wuDLH83yQyk6inMYrJQ=="],
|
||||
|
||||
"@csstools/selector-specificity": ["@csstools/selector-specificity@5.0.0", "", { "peerDependencies": { "postcss-selector-parser": "^7.0.0" } }, "sha512-PCqQV3c4CoVm3kdPhyeZ07VmBRdH2EpMFA/pd9OASpOEC3aXNGoqPDAZ80D0cLpMBxnmk0+yNhGsEx31hq7Gtw=="],
|
||||
@@ -235,10 +260,22 @@
|
||||
|
||||
"@lezer/common": ["@lezer/common@1.2.3", "", {}, "sha512-w7ojc8ejBqr2REPsWxJjrMFsA/ysDCFICn8zEOR9mrqzOu2amhITYuLD8ag6XZf0CFXDrhKqw7+tW8cX66NaDA=="],
|
||||
|
||||
"@lezer/css": ["@lezer/css@1.1.11", "", { "dependencies": { "@lezer/common": "^1.2.0", "@lezer/highlight": "^1.0.0", "@lezer/lr": "^1.0.0" } }, "sha512-FuAnusbLBl1SEAtfN8NdShxYJiESKw9LAFysfea1T96jD3ydBn12oYjaSG1a04BQRIUd93/0D8e5CV1cUMkmQg=="],
|
||||
|
||||
"@lezer/highlight": ["@lezer/highlight@1.2.1", "", { "dependencies": { "@lezer/common": "^1.0.0" } }, "sha512-Z5duk4RN/3zuVO7Jq0pGLJ3qynpxUVsh7IbUbGj88+uV2ApSAn6kWg2au3iJb+0Zi7kKtqffIESgNcRXWZWmSA=="],
|
||||
|
||||
"@lezer/html": ["@lezer/html@1.3.10", "", { "dependencies": { "@lezer/common": "^1.2.0", "@lezer/highlight": "^1.0.0", "@lezer/lr": "^1.0.0" } }, "sha512-dqpT8nISx/p9Do3AchvYGV3qYc4/rKr3IBZxlHmpIKam56P47RSHkSF5f13Vu9hebS1jM0HmtJIwLbWz1VIY6w=="],
|
||||
|
||||
"@lezer/javascript": ["@lezer/javascript@1.4.21", "", { "dependencies": { "@lezer/common": "^1.2.0", "@lezer/highlight": "^1.1.3", "@lezer/lr": "^1.3.0" } }, "sha512-lL+1fcuxWYPURMM/oFZLEDm0XuLN128QPV+VuGtKpeaOGdcl9F2LYC3nh1S9LkPqx9M0mndZFdXCipNAZpzIkQ=="],
|
||||
|
||||
"@lezer/lr": ["@lezer/lr@1.4.2", "", { "dependencies": { "@lezer/common": "^1.0.0" } }, "sha512-pu0K1jCIdnQ12aWNaAVU5bzi7Bd1w54J3ECgANPmYLtQKP0HBj2cE/5coBD66MT10xbtIuUr7tg0Shbsvk0mDA=="],
|
||||
|
||||
"@lezer/markdown": ["@lezer/markdown@1.4.2", "", { "dependencies": { "@lezer/common": "^1.0.0", "@lezer/highlight": "^1.0.0" } }, "sha512-iYewCigG/517D0xJPQd7RGaCjZAFwROiH8T9h7OTtz0bRVtkxzFhGBFJ9JGKgBBs4uuo1cvxzyQ5iKhDLMcLUQ=="],
|
||||
|
||||
"@mapbox/node-pre-gyp": ["@mapbox/node-pre-gyp@2.0.0", "", { "dependencies": { "consola": "^3.2.3", "detect-libc": "^2.0.0", "https-proxy-agent": "^7.0.5", "node-fetch": "^2.6.7", "nopt": "^8.0.0", "semver": "^7.5.3", "tar": "^7.4.0" }, "bin": { "node-pre-gyp": "bin/node-pre-gyp" } }, "sha512-llMXd39jtP0HpQLVI37Bf1m2ADlEb35GYSh1SDSLsBhR+5iCxiNGlT31yqbNtVHygHAtMy6dWFERpU2JgufhPg=="],
|
||||
|
||||
"@marijn/find-cluster-break": ["@marijn/find-cluster-break@1.0.2", "", {}, "sha512-l0h88YhZFyKdXIFNfSWpyjStDjGHwZ/U7iobcK1cQQD8sejsONdQtTVU+1wVN1PBw40PiiHB1vA5S7VTfQiP9g=="],
|
||||
|
||||
"@markdoc/markdoc": ["@markdoc/markdoc@0.5.1", "", { "optionalDependencies": { "@types/linkify-it": "^3.0.1", "@types/markdown-it": "12.2.3" }, "peerDependencies": { "@types/react": "*", "react": "*" }, "optionalPeers": ["@types/react", "react"] }, "sha512-W2apYOglq0hOnvWbhE70yl6V9++FG+YPFKNHmgiSjv0HTmdJaMLt+NA1LMqoH5LasSiTI7R0yVc5ofjaFh39Pg=="],
|
||||
|
||||
"@netlify/functions": ["@netlify/functions@2.8.2", "", { "dependencies": { "@netlify/serverless-functions-api": "1.26.1" } }, "sha512-DeoAQh8LuNPvBE4qsKlezjKj0PyXDryOFJfJKo3Z1qZLKzQ21sT314KQKPVjfvw6knqijj+IO+0kHXy/TJiqNA=="],
|
||||
@@ -489,8 +526,6 @@
|
||||
|
||||
"@vueuse/shared": ["@vueuse/shared@12.7.0", "", { "dependencies": { "vue": "^3.5.13" } }, "sha512-coLlUw2HHKsm7rPN6WqHJQr18WymN4wkA/3ThFaJ4v4gWGWAQQGK+MJxLuJTBs4mojQiazlVWAKNJNpUWGRkNw=="],
|
||||
|
||||
"abab": ["abab@2.0.6", "", {}, "sha512-j2afSsaIENvHZN2B8GOpF566vZ5WVk5opAiMTvWgaQT8DkbOqsTfvNAvHoRGU2zzP8cPoqys+xHTRDWW8L+/BA=="],
|
||||
|
||||
"abbrev": ["abbrev@3.0.0", "", {}, "sha512-+/kfrslGQ7TNV2ecmQwMJj/B65g5KVq1/L3SGVZ3tCYGqlzFuFCGBZJtMP99wH3NpEUyAjn0zPdPUg0D+DwrOA=="],
|
||||
|
||||
"abort-controller": ["abort-controller@3.0.0", "", { "dependencies": { "event-target-shim": "^5.0.0" } }, "sha512-h8lQ8tacZYnR3vNQTgibj+tODHI5/+l06Au2Pcriv/Gmet0eaj4TwWH41sO9wnHDiQsEj19q0drzdWdeAHtweg=="],
|
||||
@@ -499,16 +534,10 @@
|
||||
|
||||
"acorn": ["acorn@8.14.0", "", { "bin": { "acorn": "bin/acorn" } }, "sha512-cl669nCJTZBsL97OF4kUQm5g5hC2uihk0NxY3WENAC0TYdILVkAyHymAntgxGkl7K+t0cXIrH5siy5S4XkFycA=="],
|
||||
|
||||
"acorn-globals": ["acorn-globals@4.3.4", "", { "dependencies": { "acorn": "^6.0.1", "acorn-walk": "^6.0.1" } }, "sha512-clfQEh21R+D0leSbUdWf3OcfqyaCSAQ8Ryq00bofSekfr9W8u1jyYZo6ir0xu9Gtcf7BjcHJpnbZH7JOCpP60A=="],
|
||||
|
||||
"acorn-import-attributes": ["acorn-import-attributes@1.9.5", "", { "peerDependencies": { "acorn": "^8" } }, "sha512-n02Vykv5uA3eHGM/Z2dQrcD56kL8TyDb2p1+0P83PClMnC/nc+anbQRhIOWnSq4Ke/KvDPrY3C9hDtC/A3eHnQ=="],
|
||||
|
||||
"acorn-walk": ["acorn-walk@6.2.0", "", {}, "sha512-7evsyfH1cLOCdAzZAd43Cic04yKydNx0cF+7tiA19p1XnLLPU4dpCQOqpjqwokFe//vS0QqfqqjCS2JkiIs0cA=="],
|
||||
|
||||
"agent-base": ["agent-base@7.1.3", "", {}, "sha512-jRR5wdylq8CkOe6hei19GGZnxM6rBGwFl3Bg0YItGDimvjGtAvdZk4Pu6Cl4u4Igsws4a1fd1Vq3ezrhn4KmFw=="],
|
||||
|
||||
"ajv": ["ajv@6.12.6", "", { "dependencies": { "fast-deep-equal": "^3.1.1", "fast-json-stable-stringify": "^2.0.0", "json-schema-traverse": "^0.4.1", "uri-js": "^4.2.2" } }, "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g=="],
|
||||
|
||||
"ansi-colors": ["ansi-colors@4.1.3", "", {}, "sha512-/6w/C21Pm1A7aZitlI5Ni/2J6FFQN8i1Cvz3kHABAAbw93v/NlvKdVOqz7CCWz/3iv/JplRSEEZ83XION15ovw=="],
|
||||
|
||||
"ansi-escapes": ["ansi-escapes@4.3.2", "", { "dependencies": { "type-fest": "^0.21.3" } }, "sha512-gKXj5ALrKWQLsYG9jlTRmR/xKluxHV+Z9QEwNIgCfM1/uwPMCuzVVnh5mwTd+OuBZcwSIMbqssNWRm1lE51QaQ=="],
|
||||
@@ -531,32 +560,18 @@
|
||||
|
||||
"aria-hidden": ["aria-hidden@1.2.4", "", { "dependencies": { "tslib": "^2.0.0" } }, "sha512-y+CcFFwelSXpLZk/7fMB2mUbGtX9lKycf1MWJ7CaTIERyitVlyQx6C+sxcROU2BAJ24OiZyK+8wj2i8AlBoS3A=="],
|
||||
|
||||
"array-equal": ["array-equal@1.0.2", "", {}, "sha512-gUHx76KtnhEgB3HOuFYiCm3FIdEs6ocM2asHvNTkfu/Y09qQVrrVVaOKENmS2KkSaGoxgXNqC+ZVtR/n0MOkSA=="],
|
||||
|
||||
"asn1": ["asn1@0.2.6", "", { "dependencies": { "safer-buffer": "~2.1.0" } }, "sha512-ix/FxPn0MDjeyJ7i/yoHGFt/EX6LyNbxSEhPPXODPL+KB0VPk86UYfL0lMdy+KCnv+fmvIzySwaK5COwqVbWTQ=="],
|
||||
|
||||
"assert-plus": ["assert-plus@1.0.0", "", {}, "sha512-NfJ4UzBCcQGLDlQq7nHxH+tv3kyZ0hHQqF5BO6J7tNJeP5do1llPr8dZ8zHonfhAu0PHAdMkSo+8o0wxg9lZWw=="],
|
||||
|
||||
"ast-kit": ["ast-kit@1.4.0", "", { "dependencies": { "@babel/parser": "^7.26.5", "pathe": "^2.0.2" } }, "sha512-BlGeOw73FDsX7z0eZE/wuuafxYoek2yzNJ6l6A1nsb4+z/p87TOPbHaWuN53kFKNuUXiCQa2M+xLF71IqQmRSw=="],
|
||||
|
||||
"ast-walker-scope": ["ast-walker-scope@0.6.2", "", { "dependencies": { "@babel/parser": "^7.25.3", "ast-kit": "^1.0.1" } }, "sha512-1UWOyC50xI3QZkRuDj6PqDtpm1oHWtYs+NQGwqL/2R11eN3Q81PHAHPM0SWW3BNQm53UDwS//Jv8L4CCVLM1bQ=="],
|
||||
|
||||
"async": ["async@2.6.4", "", { "dependencies": { "lodash": "^4.17.14" } }, "sha512-mzo5dfJYwAn29PeiJ0zvwTo04zj8HDJj0Mn8TD7sno7q12prdbnasKJHhkm2c1LgrhlJ0teaea8860oxi51mGA=="],
|
||||
|
||||
"async-limiter": ["async-limiter@1.0.1", "", {}, "sha512-csOlWGAcRFJaI6m+F2WKdnMKr4HhdhFVBk0H/QbJFMCr+uO2kwohwXQPxw/9OCxp05r5ghVBFSyioixx3gfkNQ=="],
|
||||
|
||||
"async-sema": ["async-sema@3.1.1", "", {}, "sha512-tLRNUXati5MFePdAk8dw7Qt7DpxPB60ofAgn8WRhW6a2rcimZnYBP9oxHiv0OHy+Wz7kPMG+t4LGdt31+4EmGg=="],
|
||||
|
||||
"asynckit": ["asynckit@0.4.0", "", {}, "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q=="],
|
||||
|
||||
"at-least-node": ["at-least-node@1.0.0", "", {}, "sha512-+q/t7Ekv1EDY2l6Gda6LLiX14rU9TV20Wa3ofeQmwPFZbOMo9DXrLbOjFaaclkXKWidIaopwAObQDqwWtGUjqg=="],
|
||||
|
||||
"autoprefixer": ["autoprefixer@10.4.20", "", { "dependencies": { "browserslist": "^4.23.3", "caniuse-lite": "^1.0.30001646", "fraction.js": "^4.3.7", "normalize-range": "^0.1.2", "picocolors": "^1.0.1", "postcss-value-parser": "^4.2.0" }, "peerDependencies": { "postcss": "^8.1.0" }, "bin": { "autoprefixer": "bin/autoprefixer" } }, "sha512-XY25y5xSv/wEoqzDyXXME4AFfkZI0P23z6Fs3YgymDnKJkCGOnkL0iTxCa85UTqaSgfcqyf3UA6+c7wUvx/16g=="],
|
||||
|
||||
"aws-sign2": ["aws-sign2@0.7.0", "", {}, "sha512-08kcGqnYf/YmjoRhfxyu+CLxBjUtHLXLXX/vUfx9l2LYzG3c1m61nrpyFUZI6zeS+Li/wWMMidD9KgrqtGq3mA=="],
|
||||
|
||||
"aws4": ["aws4@1.13.2", "", {}, "sha512-lHe62zvbTB5eEABUVi/AwVh0ZKY9rMMDhmm+eeyuuUQbQ3+J+fONVQOZyj+DdrvD4BY33uYniyRJ4UJIaSKAfw=="],
|
||||
|
||||
"b4a": ["b4a@1.6.7", "", {}, "sha512-OnAYlL5b7LEkALw87fUVafQw5rVR9RjwGd4KUwNQ6DrrNmaVaUCgLipfVlzrPQ4tWOR9P0IXGNOx50jYCCdSJg=="],
|
||||
|
||||
"bail": ["bail@2.0.2", "", {}, "sha512-0xO6mYd7JB2YesxDKplafRpsiOzPt9V02ddPCLbY1xYGPOX24NTyN50qnUxgCPcSoYMhKpAuBTjQoRZCAkUDRw=="],
|
||||
@@ -569,8 +584,6 @@
|
||||
|
||||
"basic-auth": ["basic-auth@2.0.1", "", { "dependencies": { "safe-buffer": "5.1.2" } }, "sha512-NF+epuEdnUYVlGuhaxbbq+dvJttwLnGY+YixlXlME5KpQ5W3CnXA5cVTneY3SPbPDRkcjMbifrwmFYcClgOZeg=="],
|
||||
|
||||
"bcrypt-pbkdf": ["bcrypt-pbkdf@1.0.2", "", { "dependencies": { "tweetnacl": "^0.14.3" } }, "sha512-qeFIXtP4MSoi6NLqO12WfqARWWuCKi2Rn/9hJLEmtB5yTNr9DqFWkJRCf2qShWzPeAMRnOgCrq0sg/KLv5ES9w=="],
|
||||
|
||||
"better-sqlite3": ["better-sqlite3@11.8.1", "", { "dependencies": { "bindings": "^1.5.0", "prebuild-install": "^7.1.1" } }, "sha512-9BxNaBkblMjhJW8sMRZxnxVTRgbRmssZW0Oxc1MPBTfiR+WW21e2Mk4qu8CzrcZb1LwPCnFsfDEzq+SNcBU8eg=="],
|
||||
|
||||
"binary-extensions": ["binary-extensions@2.3.0", "", {}, "sha512-Ceh+7ox5qe7LJuLHoY0feh3pHuUDHAcRUeyL2VYghZwfpkNIy/+8Ocg0a3UuSoYzavmylwuLWQOf3hl0jjMMIw=="],
|
||||
@@ -589,8 +602,6 @@
|
||||
|
||||
"braces": ["braces@3.0.3", "", { "dependencies": { "fill-range": "^7.1.1" } }, "sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA=="],
|
||||
|
||||
"browser-process-hrtime": ["browser-process-hrtime@1.0.0", "", {}, "sha512-9o5UecI3GhkpM6DrXr69PblIuWxPKk9Y0jHBRhdocZ2y7YECBFCsHm79Pr3OyR2AvjhDkabFJaDJMYRazHgsow=="],
|
||||
|
||||
"browserslist": ["browserslist@4.24.4", "", { "dependencies": { "caniuse-lite": "^1.0.30001688", "electron-to-chromium": "^1.5.73", "node-releases": "^2.0.19", "update-browserslist-db": "^1.1.1" }, "bin": { "browserslist": "cli.js" } }, "sha512-KDi1Ny1gSePi1vm0q4oxSF8b4DR44GF4BbmS2YdhPLOEqd8pDviZOGH/GsmRwoWJ2+5Lr085X7naowMwKHDG1A=="],
|
||||
|
||||
"buffer": ["buffer@6.0.3", "", { "dependencies": { "base64-js": "^1.3.1", "ieee754": "^1.2.1" } }, "sha512-FTiCpNxtwiZZHEZbcbTIcZjERVICn9yq/pDFkTl95/AxzD1naBctN7YO68riM/gLSDY7sdrMby8hofADYuuqOA=="],
|
||||
@@ -619,8 +630,6 @@
|
||||
|
||||
"caniuse-lite": ["caniuse-lite@1.0.30001700", "", {}, "sha512-2S6XIXwaE7K7erT8dY+kLQcpa5ms63XlRkMkReXjle+kf6c5g38vyMl+Z5y8dSxOFDhcFe+nxnn261PLxBSQsQ=="],
|
||||
|
||||
"caseless": ["caseless@0.12.0", "", {}, "sha512-4tYFyifaFfGacoiObjJegolkwSU4xQNGbVgUiNYVUxbQ2x2lUsFvY4hVgVzGiIe6WLOPqycWXA40l+PWsxthUw=="],
|
||||
|
||||
"ccount": ["ccount@2.0.1", "", {}, "sha512-eyrF0jiFpY+3drT6383f1qhkbGsLSifNAjA61IUjZjmLCWjItY6LB9ft9YhoDgwfmclB2zhu51Lc7+95b8NRAg=="],
|
||||
|
||||
"chalk": ["chalk@5.4.1", "", {}, "sha512-zgVZuo2WcZgfUEmsn6eO3kINexW8RAE4maiQ8QNs8CtpPCSyMiYsULR3HQYkm3w8FIA3SberyMJMSldGsW+U3w=="],
|
||||
@@ -647,7 +656,7 @@
|
||||
|
||||
"co": ["co@4.6.0", "", {}, "sha512-QVb0dM5HvG+uaxitm8wONl7jltx8dqhfU33DcqtOZcLSVIKSDDLDi7+0LbAKiyI8hD9u42m2YxXSkMGWThaecQ=="],
|
||||
|
||||
"codemirror": ["codemirror@5.65.18", "", {}, "sha512-Gaz4gHnkbHMGgahNt3CA5HBk5lLQBqmD/pBgeB4kQU6OedZmqMBjlRF0LSrp2tJ4wlLNPm2FfaUd1pDy0mdlpA=="],
|
||||
"codemirror": ["codemirror@6.0.1", "", { "dependencies": { "@codemirror/autocomplete": "^6.0.0", "@codemirror/commands": "^6.0.0", "@codemirror/language": "^6.0.0", "@codemirror/lint": "^6.0.0", "@codemirror/search": "^6.0.0", "@codemirror/state": "^6.0.0", "@codemirror/view": "^6.0.0" } }, "sha512-J8j+nZ+CdWmIeFIGXEFbFPtpiYacFMDR8GlHK3IyHQJMCaVRfGx9NT+Hxivv1ckLWPvNdZqndbr/7lVhrf/Svg=="],
|
||||
|
||||
"color-convert": ["color-convert@2.0.1", "", { "dependencies": { "color-name": "~1.1.4" } }, "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ=="],
|
||||
|
||||
@@ -657,8 +666,6 @@
|
||||
|
||||
"colorette": ["colorette@1.4.0", "", {}, "sha512-Y2oEozpomLn7Q3HFP7dpww7AtMJplbM9lGZP6RDfHqmbeRjiwRg4n6VM6j4KLmRke85uWEI7JqF17f3pqdRA0g=="],
|
||||
|
||||
"combined-stream": ["combined-stream@1.0.8", "", { "dependencies": { "delayed-stream": "~1.0.0" } }, "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg=="],
|
||||
|
||||
"comma-separated-tokens": ["comma-separated-tokens@2.0.3", "", {}, "sha512-Fu4hJdvzeylCfQPp9SGWidpzrMs7tTrlu6Vb8XGaRGck8QSNZJJp538Wrb60Lax4fPwR64ViY468OIUTbRlGZg=="],
|
||||
|
||||
"commander": ["commander@6.2.1", "", {}, "sha512-U7VdrJFnJgo4xjrHpTzu0yrHPGImdsmD95ZlgYSEajAn2JKzDhDTPG9kBTefmObL2w/ngeZnilk+OV9CG3d7UA=="],
|
||||
@@ -695,6 +702,8 @@
|
||||
|
||||
"crc32-stream": ["crc32-stream@6.0.0", "", { "dependencies": { "crc-32": "^1.2.0", "readable-stream": "^4.0.0" } }, "sha512-piICUB6ei4IlTv1+653yq5+KoqfBYmj9bw6LqXoOneTMDXk5nM1qt12mFW1caG3LlJXEKW1Bp0WggEmIfQB34g=="],
|
||||
|
||||
"crelt": ["crelt@1.0.6", "", {}, "sha512-VQ2MBenTq1fWZUH9DJNGti7kKv6EeAuYr3cLwxUWhIu1baTaXh4Ib5W2CqHVqib4/MqbYGJqiL3Zb8GJZr3l4g=="],
|
||||
|
||||
"croner": ["croner@9.0.0", "", {}, "sha512-onMB0OkDjkXunhdW9htFjEhqrD54+M94i6ackoUkjHKbRnXdyEyKRelp4nJ1kAz32+s27jP1FsebpJCVl0BsvA=="],
|
||||
|
||||
"cronstrue": ["cronstrue@2.54.0", "", { "bin": { "cronstrue": "bin/cli.js" } }, "sha512-vyp5NklDxA5MjPfQgkn0bA+0vRQe7Q9keX7RPdV6rMgd7LtDvbuKgnT+3T5ZAX16anSP5HmahcRp8mziXsLfaw=="],
|
||||
@@ -723,86 +732,8 @@
|
||||
|
||||
"csso": ["csso@4.2.0", "", { "dependencies": { "css-tree": "^1.1.2" } }, "sha512-wvlcdIbf6pwKEk7vHj8/Bkc0B4ylXZruLvOgs9doS5eOsOpuodOV2zJChSpkp+pRpYQLQMeF04nr3Z68Sta9jA=="],
|
||||
|
||||
"cssom": ["cssom@0.3.8", "", {}, "sha512-b0tGHbfegbhPJpxpiBPU2sCkigAqtM9O121le6bbOlgyV+NyGyCmVfJ6QW9eRjz8CpNfWEOYBIMIGRYkLwsIYg=="],
|
||||
|
||||
"cssstyle": ["cssstyle@1.4.0", "", { "dependencies": { "cssom": "0.3.x" } }, "sha512-GBrLZYZ4X4x6/QEoBnIrqb8B/f5l4+8me2dkom/j1Gtbxy0kBv6OGzKuAsGM75bkGwGAFkt56Iwg28S3XTZgSA=="],
|
||||
|
||||
"csstype": ["csstype@3.1.3", "", {}, "sha512-M1uQkMl8rQK/szD0LNhtqxIPLpimGm8sOBwU7lLnCpSbTyY3yeU1Vc7l4KT5zT4s/yOxHH5O7tIuuLOCnLADRw=="],
|
||||
|
||||
"d3": ["d3@7.9.0", "", { "dependencies": { "d3-array": "3", "d3-axis": "3", "d3-brush": "3", "d3-chord": "3", "d3-color": "3", "d3-contour": "4", "d3-delaunay": "6", "d3-dispatch": "3", "d3-drag": "3", "d3-dsv": "3", "d3-ease": "3", "d3-fetch": "3", "d3-force": "3", "d3-format": "3", "d3-geo": "3", "d3-hierarchy": "3", "d3-interpolate": "3", "d3-path": "3", "d3-polygon": "3", "d3-quadtree": "3", "d3-random": "3", "d3-scale": "4", "d3-scale-chromatic": "3", "d3-selection": "3", "d3-shape": "3", "d3-time": "3", "d3-time-format": "4", "d3-timer": "3", "d3-transition": "3", "d3-zoom": "3" } }, "sha512-e1U46jVP+w7Iut8Jt8ri1YsPOvFpg46k+K8TpCb0P+zjCkjkPnV7WzfDJzMHy1LnA+wj5pLT1wjO901gLXeEhA=="],
|
||||
|
||||
"d3-array": ["d3-array@3.2.4", "", { "dependencies": { "internmap": "1 - 2" } }, "sha512-tdQAmyA18i4J7wprpYq8ClcxZy3SC31QMeByyCFyRt7BVHdREQZ5lpzoe5mFEYZUWe+oq8HBvk9JjpibyEV4Jg=="],
|
||||
|
||||
"d3-axis": ["d3-axis@3.0.0", "", {}, "sha512-IH5tgjV4jE/GhHkRV0HiVYPDtvfjHQlQfJHs0usq7M30XcSBvOotpmH1IgkcXsO/5gEQZD43B//fc7SRT5S+xw=="],
|
||||
|
||||
"d3-brush": ["d3-brush@3.0.0", "", { "dependencies": { "d3-dispatch": "1 - 3", "d3-drag": "2 - 3", "d3-interpolate": "1 - 3", "d3-selection": "3", "d3-transition": "3" } }, "sha512-ALnjWlVYkXsVIGlOsuWH1+3udkYFI48Ljihfnh8FZPF2QS9o+PzGLBslO0PjzVoHLZ2KCVgAM8NVkXPJB2aNnQ=="],
|
||||
|
||||
"d3-chord": ["d3-chord@3.0.1", "", { "dependencies": { "d3-path": "1 - 3" } }, "sha512-VE5S6TNa+j8msksl7HwjxMHDM2yNK3XCkusIlpX5kwauBfXuyLAtNg9jCp/iHH61tgI4sb6R/EIMWCqEIdjT/g=="],
|
||||
|
||||
"d3-collection": ["d3-collection@1.0.7", "", {}, "sha512-ii0/r5f4sjKNTfh84Di+DpztYwqKhEyUlKoPrzUFfeSkWxjW49xU2QzO9qrPrNkpdI0XJkfzvmTu8V2Zylln6A=="],
|
||||
|
||||
"d3-color": ["d3-color@3.1.0", "", {}, "sha512-zg/chbXyeBtMQ1LbD/WSoW2DpC3I0mpmPdW+ynRTj/x2DAWYrIY7qeZIHidozwV24m4iavr15lNwIwLxRmOxhA=="],
|
||||
|
||||
"d3-contour": ["d3-contour@4.0.2", "", { "dependencies": { "d3-array": "^3.2.0" } }, "sha512-4EzFTRIikzs47RGmdxbeUvLWtGedDUNkTcmzoeyg4sP/dvCexO47AaQL7VKy/gul85TOxw+IBgA8US2xwbToNA=="],
|
||||
|
||||
"d3-delaunay": ["d3-delaunay@6.0.4", "", { "dependencies": { "delaunator": "5" } }, "sha512-mdjtIZ1XLAM8bm/hx3WwjfHt6Sggek7qH043O8KEjDXN40xi3vx/6pYSVTwLjEgiXQTbvaouWKynLBiUZ6SK6A=="],
|
||||
|
||||
"d3-dispatch": ["d3-dispatch@3.0.1", "", {}, "sha512-rzUyPU/S7rwUflMyLc1ETDeBj0NRuHKKAcvukozwhshr6g6c5d8zh4c2gQjY2bZ0dXeGLWc1PF174P2tVvKhfg=="],
|
||||
|
||||
"d3-drag": ["d3-drag@3.0.0", "", { "dependencies": { "d3-dispatch": "1 - 3", "d3-selection": "3" } }, "sha512-pWbUJLdETVA8lQNJecMxoXfH6x+mO2UQo8rSmZ+QqxcbyA3hfeprFgIT//HW2nlHChWeIIMwS2Fq+gEARkhTkg=="],
|
||||
|
||||
"d3-dsv": ["d3-dsv@3.0.1", "", { "dependencies": { "commander": "7", "iconv-lite": "0.6", "rw": "1" }, "bin": { "csv2json": "bin/dsv2json.js", "csv2tsv": "bin/dsv2dsv.js", "dsv2dsv": "bin/dsv2dsv.js", "dsv2json": "bin/dsv2json.js", "json2csv": "bin/json2dsv.js", "json2dsv": "bin/json2dsv.js", "json2tsv": "bin/json2dsv.js", "tsv2csv": "bin/dsv2dsv.js", "tsv2json": "bin/dsv2json.js" } }, "sha512-UG6OvdI5afDIFP9w4G0mNq50dSOsXHJaRE8arAS5o9ApWnIElp8GZw1Dun8vP8OyHOZ/QJUKUJwxiiCCnUwm+Q=="],
|
||||
|
||||
"d3-ease": ["d3-ease@3.0.1", "", {}, "sha512-wR/XK3D3XcLIZwpbvQwQ5fK+8Ykds1ip7A2Txe0yxncXSdq1L9skcG7blcedkOX+ZcgxGAmLX1FrRGbADwzi0w=="],
|
||||
|
||||
"d3-fetch": ["d3-fetch@3.0.1", "", { "dependencies": { "d3-dsv": "1 - 3" } }, "sha512-kpkQIM20n3oLVBKGg6oHrUchHM3xODkTzjMoj7aWQFq5QEM+R6E4WkzT5+tojDY7yjez8KgCBRoj4aEr99Fdqw=="],
|
||||
|
||||
"d3-force": ["d3-force@3.0.0", "", { "dependencies": { "d3-dispatch": "1 - 3", "d3-quadtree": "1 - 3", "d3-timer": "1 - 3" } }, "sha512-zxV/SsA+U4yte8051P4ECydjD/S+qeYtnaIyAs9tgHCqfguma/aAQDjo85A9Z6EKhBirHRJHXIgJUlffT4wdLg=="],
|
||||
|
||||
"d3-format": ["d3-format@3.1.0", "", {}, "sha512-YyUI6AEuY/Wpt8KWLgZHsIU86atmikuoOmCfommt0LYHiQSPjvX2AcFc38PX0CBpr2RCyZhjex+NS/LPOv6YqA=="],
|
||||
|
||||
"d3-geo": ["d3-geo@3.1.1", "", { "dependencies": { "d3-array": "2.5.0 - 3" } }, "sha512-637ln3gXKXOwhalDzinUgY83KzNWZRKbYubaG+fGVuc/dxO64RRljtCTnf5ecMyE1RIdtqpkVcq0IbtU2S8j2Q=="],
|
||||
|
||||
"d3-hierarchy": ["d3-hierarchy@3.1.2", "", {}, "sha512-FX/9frcub54beBdugHjDCdikxThEqjnR93Qt7PvQTOHxyiNCAlvMrHhclk3cD5VeAaq9fxmfRp+CnWw9rEMBuA=="],
|
||||
|
||||
"d3-interpolate": ["d3-interpolate@3.0.1", "", { "dependencies": { "d3-color": "1 - 3" } }, "sha512-3bYs1rOD33uo8aqJfKP3JWPAibgw8Zm2+L9vBKEHJ2Rg+viTR7o5Mmv5mZcieN+FRYaAOWX5SJATX6k1PWz72g=="],
|
||||
|
||||
"d3-path": ["d3-path@3.1.0", "", {}, "sha512-p3KP5HCf/bvjBSSKuXid6Zqijx7wIfNW+J/maPs+iwR35at5JCbLUT0LzF1cnjbCHWhqzQTIN2Jpe8pRebIEFQ=="],
|
||||
|
||||
"d3-polygon": ["d3-polygon@3.0.1", "", {}, "sha512-3vbA7vXYwfe1SYhED++fPUQlWSYTTGmFmQiany/gdbiWgU/iEyQzyymwL9SkJjFFuCS4902BSzewVGsHHmHtXg=="],
|
||||
|
||||
"d3-quadtree": ["d3-quadtree@3.0.1", "", {}, "sha512-04xDrxQTDTCFwP5H6hRhsRcb9xxv2RzkcsygFzmkSIOJy3PeRJP7sNk3VRIbKXcog561P9oU0/rVH6vDROAgUw=="],
|
||||
|
||||
"d3-random": ["d3-random@3.0.1", "", {}, "sha512-FXMe9GfxTxqd5D6jFsQ+DJ8BJS4E/fT5mqqdjovykEB2oFbTMDVdg1MGFxfQW+FBOGoB++k8swBrgwSHT1cUXQ=="],
|
||||
|
||||
"d3-scale": ["d3-scale@4.0.2", "", { "dependencies": { "d3-array": "2.10.0 - 3", "d3-format": "1 - 3", "d3-interpolate": "1.2.0 - 3", "d3-time": "2.1.1 - 3", "d3-time-format": "2 - 4" } }, "sha512-GZW464g1SH7ag3Y7hXjf8RoUuAFIqklOAq3MRl4OaWabTFJY9PN/E1YklhXLh+OQ3fM9yS2nOkCoS+WLZ6kvxQ=="],
|
||||
|
||||
"d3-scale-chromatic": ["d3-scale-chromatic@3.1.0", "", { "dependencies": { "d3-color": "1 - 3", "d3-interpolate": "1 - 3" } }, "sha512-A3s5PWiZ9YCXFye1o246KoscMWqf8BsD9eRiJ3He7C9OBaxKhAd5TFCdEx/7VbKtxxTsu//1mMJFrEt572cEyQ=="],
|
||||
|
||||
"d3-selection": ["d3-selection@3.0.0", "", {}, "sha512-fmTRWbNMmsmWq6xJV8D19U/gw/bwrHfNXxrIN+HfZgnzqTHp9jOmKMhsTUjXOJnZOdZY9Q28y4yebKzqDKlxlQ=="],
|
||||
|
||||
"d3-shape": ["d3-shape@3.2.0", "", { "dependencies": { "d3-path": "^3.1.0" } }, "sha512-SaLBuwGm3MOViRq2ABk3eLoxwZELpH6zhl3FbAoJ7Vm1gofKx6El1Ib5z23NUEhF9AsGl7y+dzLe5Cw2AArGTA=="],
|
||||
|
||||
"d3-time": ["d3-time@3.1.0", "", { "dependencies": { "d3-array": "2 - 3" } }, "sha512-VqKjzBLejbSMT4IgbmVgDjpkYrNWUYJnbCGo874u7MMKIWsILRX+OpX/gTk8MqjpT1A/c6HY2dCA77ZN0lkQ2Q=="],
|
||||
|
||||
"d3-time-format": ["d3-time-format@4.1.0", "", { "dependencies": { "d3-time": "1 - 3" } }, "sha512-dJxPBlzC7NugB2PDLwo9Q8JiTR3M3e4/XANkreKSUxF8vvXKqm1Yfq4Q5dl8budlunRVlUUaDUgFt7eA8D6NLg=="],
|
||||
|
||||
"d3-timer": ["d3-timer@3.0.1", "", {}, "sha512-ndfJ/JxxMd3nw31uyKoY2naivF+r29V+Lc0svZxe1JvvIRmi8hUsrMvdOwgS1o6uBHmiz91geQ0ylPP0aj1VUA=="],
|
||||
|
||||
"d3-transition": ["d3-transition@3.0.1", "", { "dependencies": { "d3-color": "1 - 3", "d3-dispatch": "1 - 3", "d3-ease": "1 - 3", "d3-interpolate": "1 - 3", "d3-timer": "1 - 3" }, "peerDependencies": { "d3-selection": "2 - 3" } }, "sha512-ApKvfjsSR6tg06xrL434C0WydLr7JewBB3V+/39RMHsaXTOG0zmt/OAXeng5M5LBm0ojmxJrpomQVZ1aPvBL4w=="],
|
||||
|
||||
"d3-voronoi": ["d3-voronoi@1.1.4", "", {}, "sha512-dArJ32hchFsrQ8uMiTBLq256MpnZjeuBtdHpaDlYuQyjU0CVzCJl/BVW+SkszaAeH95D/8gxqAhgx0ouAWAfRg=="],
|
||||
|
||||
"d3-zoom": ["d3-zoom@3.0.0", "", { "dependencies": { "d3-dispatch": "1 - 3", "d3-drag": "2 - 3", "d3-interpolate": "1 - 3", "d3-selection": "2 - 3", "d3-transition": "2 - 3" } }, "sha512-b8AmV3kfQaqWAuacbPuNbL6vahnOJflOhexLzMMNLga62+/nh0JzvJ0aO/5a5MVgUFGS7Hu1P9P03o3fJkDCyw=="],
|
||||
|
||||
"dagre": ["dagre@0.8.5", "", { "dependencies": { "graphlib": "^2.1.8", "lodash": "^4.17.15" } }, "sha512-/aTqmnRta7x7MCCpExk7HQL2O4owCT2h8NT//9I1OQ9vt29Pa0BzSAkR5lwFUcQ7491yVi/3CXU9jQ5o0Mn2Sw=="],
|
||||
|
||||
"dagre-d3": ["dagre-d3@0.6.4", "", { "dependencies": { "d3": "^5.14", "dagre": "^0.8.5", "graphlib": "^2.1.8", "lodash": "^4.17.15" } }, "sha512-e/6jXeCP7/ptlAM48clmX4xTZc5Ek6T6kagS7Oz2HrYSdqcLZFLqpAfh7ldbZRFfxCZVyh61NEPR08UQRVxJzQ=="],
|
||||
|
||||
"dashdash": ["dashdash@1.14.1", "", { "dependencies": { "assert-plus": "^1.0.0" } }, "sha512-jRFi8UDGo6j+odZiEpjazZaWqEal3w/basFjQHQEwVtZJGDpxbH1MeYluwCS8Xq5wmLJooDlMgvVarmWfGM44g=="],
|
||||
|
||||
"data-urls": ["data-urls@1.1.0", "", { "dependencies": { "abab": "^2.0.0", "whatwg-mimetype": "^2.2.0", "whatwg-url": "^7.0.0" } }, "sha512-YTWYI9se1P55u58gL5GkQHW4P6VJBJ5iBT+B5a7i2Tjadhv52paJG0qHX4A0OR6/t52odI64KP2YvFpkDOi3eQ=="],
|
||||
|
||||
"db0": ["db0@0.2.4", "", { "peerDependencies": { "@electric-sql/pglite": "*", "@libsql/client": "*", "better-sqlite3": "*", "drizzle-orm": "*", "mysql2": "*", "sqlite3": "*" }, "optionalPeers": ["@electric-sql/pglite", "@libsql/client", "better-sqlite3", "drizzle-orm", "mysql2", "sqlite3"] }, "sha512-hIzftLH1nMsF95zSLjDLYLbE9huOXnLYUTAQ5yKF5amp0FpeD+B15XJa8BvGYSOeSCH4gl2WahB/y1FcUByQSg=="],
|
||||
|
||||
"debug": ["debug@4.4.0", "", { "dependencies": { "ms": "^2.1.3" } }, "sha512-6WTZ/IxCY/T6BALoZHaE4ctp9xm+Z5kY/pzYaCHRFeyVhojxlrm+46y68HA6hr0TcwEssoxNiDEUJQjfPZ/RYA=="],
|
||||
@@ -827,10 +758,6 @@
|
||||
|
||||
"defu": ["defu@6.1.4", "", {}, "sha512-mEQCMmwJu317oSz8CwdIOdwf3xMif1ttiM8LTufzc3g6kR+9Pe236twL8j3IYT1F7GfRgGcW6MWxzZjLIkuHIg=="],
|
||||
|
||||
"delaunator": ["delaunator@5.0.1", "", { "dependencies": { "robust-predicates": "^3.0.2" } }, "sha512-8nvh+XBe96aCESrGOqMp/84b13H9cdKbG5P2ejQCh4d4sK9RL4371qou9drQjMhvnPmhWl5hnmqbEE0fXr9Xnw=="],
|
||||
|
||||
"delayed-stream": ["delayed-stream@1.0.0", "", {}, "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ=="],
|
||||
|
||||
"delegates": ["delegates@1.0.0", "", {}, "sha512-bd2L678uiWATM6m5Z1VzNCErI3jiGzt6HGY8OVICs40JQq/HALfbyNJmp0UDakEY4pMMaN0Ly5om/B1VI/+xfQ=="],
|
||||
|
||||
"denque": ["denque@2.1.0", "", {}, "sha512-HVQE3AAb/pxF8fQAoiqpvg9i3evqug3hoiwakOyZAwJm+6vZehbkYXZ0l4JxS+I3QxM97v5aaRNhj8v5oBhekw=="],
|
||||
@@ -859,12 +786,8 @@
|
||||
|
||||
"domelementtype": ["domelementtype@2.3.0", "", {}, "sha512-OLETBj6w0OsagBwdXnPdN0cnMfF9opN69co+7ZrbfPGrdpPVNBUj02spi6B1N7wChLQiPn4CSH/zJvXw56gmHw=="],
|
||||
|
||||
"domexception": ["domexception@1.0.1", "", { "dependencies": { "webidl-conversions": "^4.0.2" } }, "sha512-raigMkn7CJNNo6Ihro1fzG7wr3fHuYVytzquZKX5n0yizGsTcYgzdIUwj1X9pK0VvjeihV+XiclP+DjwbsSKug=="],
|
||||
|
||||
"domhandler": ["domhandler@4.3.1", "", { "dependencies": { "domelementtype": "^2.2.0" } }, "sha512-GrwoxYN+uWlzO8uhUXRl0P+kHE4GtVPfYzVLcUxPL7KNdHKj66vvlhiweIHqYYXWlw+T8iLMp42Lm67ghw4WMQ=="],
|
||||
|
||||
"dompurify": ["dompurify@2.3.5", "", {}, "sha512-kD+f8qEaa42+mjdOpKeztu9Mfx5bv9gVLO6K9jRx4uGvh6Wv06Srn4jr1wPNY2OOUGGSKHNFN+A8MA3v0E0QAQ=="],
|
||||
|
||||
"domutils": ["domutils@2.8.0", "", { "dependencies": { "dom-serializer": "^1.0.1", "domelementtype": "^2.2.0", "domhandler": "^4.2.0" } }, "sha512-w96Cjofp72M5IIhpjgobBimYEfoPjx1Vx0BSX9P30WBdZW2WIKU0T1Bd0kz2eNZ9ikjKgHbEyKx8BB6H1L3h3A=="],
|
||||
|
||||
"dot-prop": ["dot-prop@9.0.0", "", { "dependencies": { "type-fest": "^4.18.2" } }, "sha512-1gxPBJpI/pcjQhKgIU91II6Wkay+dLcN3M6rf2uwP8hRur3HtQXjVrdAK3sjC0piaEuxzMwjXChcETiJl47lAQ=="],
|
||||
@@ -881,16 +804,12 @@
|
||||
|
||||
"eastasianwidth": ["eastasianwidth@0.2.0", "", {}, "sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA=="],
|
||||
|
||||
"ecc-jsbn": ["ecc-jsbn@0.1.2", "", { "dependencies": { "jsbn": "~0.1.0", "safer-buffer": "^2.1.0" } }, "sha512-eh9O+hwRHNbG4BLTjEl3nw044CkGm5X6LoaCf7LPp7UU8Qrt47JYNi6nPX8xjW97TKGKm1ouctg0QSpZe9qrnw=="],
|
||||
|
||||
"ee-first": ["ee-first@1.1.1", "", {}, "sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow=="],
|
||||
|
||||
"electron-to-chromium": ["electron-to-chromium@1.5.102", "", {}, "sha512-eHhqaja8tE/FNpIiBrvBjFV/SSKpyWHLvxuR9dPTdo+3V9ppdLmFB7ZZQ98qNovcngPLYIz0oOBF9P0FfZef5Q=="],
|
||||
|
||||
"emoji-regex": ["emoji-regex@8.0.0", "", {}, "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A=="],
|
||||
|
||||
"emojione": ["emojione@3.1.7", "", {}, "sha512-ITb0rrx6iuJKBnThRUE0uiGkwriwnY+919vxsAF+EqBHXhyjCTAcUo/nPNWodHaOJvKGdI1mel2o6TyyxBjjLw=="],
|
||||
|
||||
"encodeurl": ["encodeurl@1.0.2", "", {}, "sha512-TPJXq8JqFaVYm2CWmPvnP2Iyo4ZSM7/QKcSmuMLDObfpH5fi7RUGmd/rTDf+rut/saiDiQEeVTNgAmJEdAOx0w=="],
|
||||
|
||||
"end-of-stream": ["end-of-stream@1.4.4", "", { "dependencies": { "once": "^1.4.0" } }, "sha512-+uw1inIHVPQoaVuHzRyXd21icM+cnt4CzD5rW+NC1wjOUSTOs+Te7FOv7AhN7vS9x/oIyhLP5PR1H+phQAHu5Q=="],
|
||||
@@ -921,20 +840,10 @@
|
||||
|
||||
"escape-string-regexp": ["escape-string-regexp@5.0.0", "", {}, "sha512-/veY75JbMK4j1yjvuUxuVsiS/hr/4iHs9FTT6cgTexxdE0Ly/glccBAkloH/DofkjRbZU3bnoj38mOmhkZ0lHw=="],
|
||||
|
||||
"escodegen": ["escodegen@1.14.3", "", { "dependencies": { "esprima": "^4.0.1", "estraverse": "^4.2.0", "esutils": "^2.0.2", "optionator": "^0.8.1" }, "optionalDependencies": { "source-map": "~0.6.1" }, "bin": { "esgenerate": "bin/esgenerate.js", "escodegen": "bin/escodegen.js" } }, "sha512-qFcX0XJkdg+PB3xjZZG/wKSuT1PnQWx57+TVSjIMmILd2yC/6ByYElPwJnslDsuWuSAp4AwJGumarAAmJch5Kw=="],
|
||||
|
||||
"esprima": ["esprima@4.0.1", "", { "bin": { "esparse": "./bin/esparse.js", "esvalidate": "./bin/esvalidate.js" } }, "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A=="],
|
||||
|
||||
"estraverse": ["estraverse@4.3.0", "", {}, "sha512-39nnKffWz8xN1BU/2c79n9nB9HDzo0niYUqx6xyqUnyoAnQyyWpOTdZEeiCch8BBu515t4wp9ZmgVfVhn9EBpw=="],
|
||||
|
||||
"estree-walker": ["estree-walker@3.0.3", "", { "dependencies": { "@types/estree": "^1.0.0" } }, "sha512-7RUKfXgSMMkzt6ZuXmqapOurLGPPfgj6l9uRZ7lRGolvk0y2yocc35LdcxKC5PQZdn2DMqioAQ2NoWcrTKmm6g=="],
|
||||
|
||||
"esutils": ["esutils@2.0.3", "", {}, "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g=="],
|
||||
|
||||
"etag": ["etag@1.8.1", "", {}, "sha512-aIL5Fx7mawVa300al2BnEE4iNvo1qETxLrPI/o05L7z6go7fCw1J6EQmbK4FmJ2AS7kgVF/KEZWufBfdClMcPg=="],
|
||||
|
||||
"eve-raphael": ["eve-raphael@0.5.0", "", {}, "sha512-jrxnPsCGqng1UZuEp9DecX/AuSyAszATSjf4oEcRxvfxa1Oux4KkIPKBAAWWnpdwfARtr+Q0o9aPYWjsROD7ug=="],
|
||||
|
||||
"event-target-shim": ["event-target-shim@5.0.1", "", {}, "sha512-i/2XbnSz/uxRCU6+NdVJgKWDTM427+MqYbkQzD321DuCQJUqOuJKIA0IM2+W2xtYHdKOmZ4dR6fExsd4SXL+WQ=="],
|
||||
|
||||
"eventemitter3": ["eventemitter3@4.0.7", "", {}, "sha512-8guHBZCwKnFhYdHr2ysuRWErTwhoN2X8XELRlrRwpmfeY2jjuUN4taQMsULKUVo1K4DvZl+0pgfyoysHxvmvEw=="],
|
||||
@@ -949,16 +858,12 @@
|
||||
|
||||
"externality": ["externality@1.0.2", "", { "dependencies": { "enhanced-resolve": "^5.14.1", "mlly": "^1.3.0", "pathe": "^1.1.1", "ufo": "^1.1.2" } }, "sha512-LyExtJWKxtgVzmgtEHyQtLFpw1KFhQphF9nTG8TpAIVkiI/xQ3FJh75tRFLYl4hkn7BNIIdLJInuDAavX35pMw=="],
|
||||
|
||||
"extsprintf": ["extsprintf@1.3.0", "", {}, "sha512-11Ndz7Nv+mvAC1j0ktTa7fAb0vLyGGX+rMHNBYQviQDGU0Hw7lhctJANqbPhu9nV9/izT/IntTgZ7Im/9LJs9g=="],
|
||||
|
||||
"fast-deep-equal": ["fast-deep-equal@3.1.3", "", {}, "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q=="],
|
||||
|
||||
"fast-fifo": ["fast-fifo@1.3.2", "", {}, "sha512-/d9sfos4yxzpwkDkuN7k2SqFKtYNmCTzgfEpz82x34IM9/zc8KGxQoXg1liNC/izpRM/MBdt44Nmx41ZWqk+FQ=="],
|
||||
|
||||
"fast-glob": ["fast-glob@3.3.3", "", { "dependencies": { "@nodelib/fs.stat": "^2.0.2", "@nodelib/fs.walk": "^1.2.3", "glob-parent": "^5.1.2", "merge2": "^1.3.0", "micromatch": "^4.0.8" } }, "sha512-7MptL8U0cqcFdzIzwOTHoilX9x5BrNqye7Z/LuC7kCMRio1EMSyqRK3BEAUD7sXRq4iT4AzTVuZdhgQ2TCvYLg=="],
|
||||
|
||||
"fast-json-stable-stringify": ["fast-json-stable-stringify@2.1.0", "", {}, "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw=="],
|
||||
|
||||
"fast-levenshtein": ["fast-levenshtein@2.0.6", "", {}, "sha512-DCXu6Ifhqcks7TZKY3Hxp3y6qphY5SJZmrWMDrKcERSOXWQdMhU9Ig/PYrzyw/ul9jOIyh0N4M0tbC5hodg8dw=="],
|
||||
|
||||
"fast-npm-meta": ["fast-npm-meta@0.2.2", "", {}, "sha512-E+fdxeaOQGo/CMWc9f4uHFfgUPJRAu7N3uB8GBvB3SDPAIWJK4GKyYhkAGFq+GYrcbKNfQIz5VVQyJnDuPPCrg=="],
|
||||
@@ -977,14 +882,8 @@
|
||||
|
||||
"flatted": ["flatted@3.3.3", "", {}, "sha512-GX+ysw4PBCz0PzosHDepZGANEuFCMLrnRTiEy9McGjmkCQYwRq4A/X786G/fjM/+OjsWSU1ZrY5qyARZmO/uwg=="],
|
||||
|
||||
"flowchart.js": ["flowchart.js@1.18.0", "", { "dependencies": { "raphael": "2.3.0" } }, "sha512-1rZflSLyrj5/+ryzU+qIQr6IGysPIHT4UrgN+6IaVv7pLDSLu7CvC9e0X7FU6ocpRAEtHk5+UaFXv9NZKRoG3g=="],
|
||||
|
||||
"foreground-child": ["foreground-child@3.3.0", "", { "dependencies": { "cross-spawn": "^7.0.0", "signal-exit": "^4.0.1" } }, "sha512-Ld2g8rrAyMYFXBhEqMz8ZAHBi4J4uS1i/CxGMDnjyFWddMXLVcDp051DZfu+t7+ab7Wv6SMqpWmyFIj5UbfFvg=="],
|
||||
|
||||
"forever-agent": ["forever-agent@0.6.1", "", {}, "sha512-j0KLYPhm6zeac4lz3oJ3o65qvgQCcPubiyotZrXqEaG4hNagNYO8qdlUrX5vwqv9ohqeT/Z3j6+yW067yWWdUw=="],
|
||||
|
||||
"form-data": ["form-data@2.3.3", "", { "dependencies": { "asynckit": "^0.4.0", "combined-stream": "^1.0.6", "mime-types": "^2.1.12" } }, "sha512-1lLKB2Mu3aGP1Q/2eCOx0fNbRMe7XdwktwOruhfqqd0rIJWwN4Dh+E3hrPSlDCXnSR7UtZ1N38rVXm+6+MEhJQ=="],
|
||||
|
||||
"format": ["format@0.2.2", "", {}, "sha512-wzsgA6WOq+09wrU1tsJ09udeR/YZRaeArL9e1wPbFg3GG2yDnC2ldKpxs4xunpFF9DgqCqOIra3bc1HWrJ37Ww=="],
|
||||
|
||||
"fraction.js": ["fraction.js@4.3.7", "", {}, "sha512-ZsDfxO51wGAXREY55a7la9LScWpwv9RxIrYABrlvOFBlH/ShPnrtsXeuUIfXKKOVicNxQ+o8JTbJvjS4M89yew=="],
|
||||
@@ -1021,8 +920,6 @@
|
||||
|
||||
"get-tsconfig": ["get-tsconfig@4.10.0", "", { "dependencies": { "resolve-pkg-maps": "^1.0.0" } }, "sha512-kGzZ3LWWQcGIAmg6iWvXn0ei6WDtV26wzHRMwDSzmAbcXrTEXxHy6IehI6/4eT6VRKyMP1eF1VqwrVUmE/LR7A=="],
|
||||
|
||||
"getpass": ["getpass@0.1.7", "", { "dependencies": { "assert-plus": "^1.0.0" } }, "sha512-0fzj9JxOLfJ+XGLhR8ze3unN0KZCgZwiSSDz168VERjK8Wl8kVSdcu2kspd4s4wtAa1y/qrVRiAA0WclVsu0ng=="],
|
||||
|
||||
"giget": ["giget@1.2.4", "", { "dependencies": { "citty": "^0.1.6", "consola": "^3.4.0", "defu": "^6.1.4", "node-fetch-native": "^1.6.6", "nypm": "^0.5.1", "ohash": "^1.1.4", "pathe": "^2.0.2", "tar": "^6.2.1" }, "bin": { "giget": "dist/cli.mjs" } }, "sha512-Wv+daGyispVoA31TrWAVR+aAdP7roubTPEM/8JzRnqXhLbdJH0T9eQyXVFF8fjk3WKTsctII6QcyxILYgNp2DA=="],
|
||||
|
||||
"git-config-path": ["git-config-path@2.0.0", "", {}, "sha512-qc8h1KIQbJpp+241id3GuAtkdyJ+IK+LIVtkiFTRKRrmddDzs3SI9CvP1QYmWBFvm1I/PWRwj//of8bgAc0ltA=="],
|
||||
@@ -1047,18 +944,12 @@
|
||||
|
||||
"graceful-fs": ["graceful-fs@4.2.11", "", {}, "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ=="],
|
||||
|
||||
"graphlib": ["graphlib@2.1.8", "", { "dependencies": { "lodash": "^4.17.15" } }, "sha512-jcLLfkpoVGmH7/InMC/1hIvOPSUh38oJtGhvrOFGzioE1DZ+0YW16RgmOJhHiuWTvGiJQ9Z1Ik43JvkRPRvE+A=="],
|
||||
|
||||
"gzip-size": ["gzip-size@7.0.0", "", { "dependencies": { "duplexer": "^0.1.2" } }, "sha512-O1Ld7Dr+nqPnmGpdhzLmMTQ4vAsD+rHwMm1NLUmoUFFymBOMKxCCrtDxqdBRYXdeEPEi3SyoR4TizJLQrnKBNA=="],
|
||||
|
||||
"h3": ["h3@1.15.0", "", { "dependencies": { "cookie-es": "^1.2.2", "crossws": "^0.3.3", "defu": "^6.1.4", "destr": "^2.0.3", "iron-webcrypto": "^1.2.1", "node-mock-http": "^1.0.0", "ohash": "^1.1.4", "radix3": "^1.1.2", "ufo": "^1.5.4", "uncrypto": "^0.1.3" } }, "sha512-OsjX4JW8J4XGgCgEcad20pepFQWnuKH+OwkCJjogF3C+9AZ1iYdtB4hX6vAb5DskBiu5ljEXqApINjR8CqoCMQ=="],
|
||||
|
||||
"h3-compression": ["h3-compression@0.3.2", "", { "peerDependencies": { "h3": "^1.6.0" } }, "sha512-B+yCKyDRnO0BXSfjAP4tCXJgJwmnKp3GyH5Yh66mY9KuOCrrGQSPk/gBFG2TgH7OyB/6mvqNZ1X0XNVuy0qRsw=="],
|
||||
|
||||
"har-schema": ["har-schema@2.0.0", "", {}, "sha512-Oqluz6zhGX8cyRaTQlFMPw80bSJVG2x/cFb8ZPhUILGgHka9SsokCCOQgpveePerqidZOrT14ipqfJb7ILcW5Q=="],
|
||||
|
||||
"har-validator": ["har-validator@5.1.5", "", { "dependencies": { "ajv": "^6.12.3", "har-schema": "^2.0.0" } }, "sha512-nmT2T0lljbxdQZfspsno9hgrG3Uir6Ks5afism62poxqBM6sDnMEuPmzTq8XN0OEwqKLLdh1jQI3qyE66Nzb3w=="],
|
||||
|
||||
"has-flag": ["has-flag@4.0.0", "", {}, "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ=="],
|
||||
|
||||
"has-symbols": ["has-symbols@1.1.0", "", {}, "sha512-1cDNdwJ2Jaohmb3sg4OmKaMBwuC48sYni5HUw2DvsC8LjGTLK9h+eb1X6RyuOHe4hT0ULCW68iomhjUoKUqlPQ=="],
|
||||
@@ -1093,8 +984,6 @@
|
||||
|
||||
"hookable": ["hookable@5.5.3", "", {}, "sha512-Yc+BQe8SvoXH1643Qez1zqLRmbA5rCL+sSmk6TVos0LWVfNIB7PGncdlId77WzLGSIB5KaWgTaNTs2lNVEI6VQ=="],
|
||||
|
||||
"html-encoding-sniffer": ["html-encoding-sniffer@1.0.2", "", { "dependencies": { "whatwg-encoding": "^1.0.1" } }, "sha512-71lZziiDnsuabfdYiUeWdCVyKuqwWi23L8YeIgV9jSSZHCtb6wB1BKWooH7L3tn4/FuZJMVWyNaIDr4RGmaSYw=="],
|
||||
|
||||
"html-tags": ["html-tags@3.3.1", "", {}, "sha512-ztqyC3kLto0e9WbNp0aeP+M3kTt+nbaIveGmUxAtZa+8iFgKLUOD4YKM5j+f3QD89bra7UeumolZHKuOXnTmeQ=="],
|
||||
|
||||
"html-void-elements": ["html-void-elements@3.0.0", "", {}, "sha512-bEqo66MRXsUGxWHV5IP0PUiAWwoEjba4VCzg0LjFJBpchPaTfyfCKTG6bc5F8ucKec3q5y6qOdGyYTSBEvhCrg=="],
|
||||
@@ -1105,17 +994,13 @@
|
||||
|
||||
"http-shutdown": ["http-shutdown@1.2.2", "", {}, "sha512-S9wWkJ/VSY9/k4qcjG318bqJNruzE4HySUhFYknwmu6LBP97KLLfwNf+n4V1BHurvFNkSKLFnK/RsuUnRTf9Vw=="],
|
||||
|
||||
"http-signature": ["http-signature@1.2.0", "", { "dependencies": { "assert-plus": "^1.0.0", "jsprim": "^1.2.2", "sshpk": "^1.7.0" } }, "sha512-CAbnr6Rz4CYQkLYUtSNXxQPUH2gK8f3iWexVlsnMeD+GjlsQ0Xsy1cOX+mN3dtxYomRy21CiOzU8Uhw6OwncEQ=="],
|
||||
|
||||
"https-proxy-agent": ["https-proxy-agent@7.0.6", "", { "dependencies": { "agent-base": "^7.1.2", "debug": "4" } }, "sha512-vK9P5/iUfdl95AI+JVyUuIcVtd4ofvtrOr3HNtM2yxC9bnMbEdp3x01OhQNnjb8IJYi38VlTE3mBXwcfvywuSw=="],
|
||||
|
||||
"httpxy": ["httpxy@0.1.7", "", {}, "sha512-pXNx8gnANKAndgga5ahefxc++tJvNL87CXoRwxn1cJE2ZkWEojF3tNfQIEhZX/vfpt+wzeAzpUI4qkediX1MLQ=="],
|
||||
|
||||
"human-signals": ["human-signals@8.0.0", "", {}, "sha512-/1/GPCpDUCCYwlERiYjxoczfP0zfvZMU/OWgQPMya9AbAE24vseigFdhAMObpc8Q4lc/kjutPfUddDYyAmejnA=="],
|
||||
|
||||
"hypermd": ["hypermd@0.3.11", "", { "optionalDependencies": { "emojione": "^3.1.6", "flowchart.js": "^1.11.2", "katex": "^0.10.0-alpha", "marked": "^0.4.0", "mathjax": "^2.7.0", "mermaid": "^8.0.0-rc.8", "turndown": "^4.0.1", "turndown-plugin-gfm": "^1.0.1", "twemoji": "^11.0.0" }, "peerDependencies": { "codemirror": "^5.37.0" } }, "sha512-EGgnNgyh2WCJU+emez+X7OHKnV36xKIdmcs9EnrWIaa1Wx//wBetr9xSYhEFeXzD/qSYjezzH1lzDQh1LZIirw=="],
|
||||
|
||||
"iconv-lite": ["iconv-lite@0.6.3", "", { "dependencies": { "safer-buffer": ">= 2.1.2 < 3.0.0" } }, "sha512-4fCk79wshMdzMp2rH06qWrJE4iolqLhCUH+OiuIgU++RB0+94NlDL81atO7GX55uUKueo0txHNtvEyI6D7WdMw=="],
|
||||
"iconify-icon": ["iconify-icon@2.3.0", "", { "dependencies": { "@iconify/types": "^2.0.0" } }, "sha512-C0beI9oTDxQz6voI5CKl7MiJf0Lw4UU8K4G4t6pcUDClLmCvuMOpcvd8MAztQ2SfoH0iv7WHdxBFjekKPFKH2Q=="],
|
||||
|
||||
"icss-replace-symbols": ["icss-replace-symbols@1.1.0", "", {}, "sha512-chIaY3Vh2mh2Q3RGXttaDIzeiPvaVXJ+C4DAh/w3c37SKZ/U6PGMmuicR2EQQp9bKG8zLMCl7I+PtIoOOPp8Gg=="],
|
||||
|
||||
@@ -1141,8 +1026,6 @@
|
||||
|
||||
"ini": ["ini@1.3.8", "", {}, "sha512-JV/yugV2uzW5iMRSiZAyDtQd+nxtUnjeLt0acNdw98kKLrvuRVyB80tsREOE7yvGVgalhZ6RNXCmEHkUKBKxew=="],
|
||||
|
||||
"internmap": ["internmap@2.0.3", "", {}, "sha512-5Hh7Y1wQbvY5ooGgPbDaL5iYLAPzMTUrjMulskHLH6wnv/A+1q5rgEaiuqEjB+oxGXIVZs1FF+R/KPN3ZSQYYg=="],
|
||||
|
||||
"ioredis": ["ioredis@5.5.0", "", { "dependencies": { "@ioredis/commands": "^1.1.1", "cluster-key-slot": "^1.1.0", "debug": "^4.3.4", "denque": "^2.1.0", "lodash.defaults": "^4.2.0", "lodash.isarguments": "^3.1.0", "redis-errors": "^1.2.0", "redis-parser": "^3.0.0", "standard-as-callback": "^2.1.0" } }, "sha512-7CutT89g23FfSa8MDoIFs2GYYa0PaNiW/OrT+nRyjRXHDZd17HmIgy+reOQ/yhh72NznNjGuS8kbCAcA4Ro4mw=="],
|
||||
|
||||
"iron-webcrypto": ["iron-webcrypto@1.2.1", "", {}, "sha512-feOM6FaSr6rEABp/eDfVseKyTMDt+KGpeB35SkVn9Tyn0CqvVsY3EwI0v5i8nMHyJnzCIQf7nsy3p41TPkJZhg=="],
|
||||
@@ -1181,8 +1064,6 @@
|
||||
|
||||
"is-stream": ["is-stream@4.0.1", "", {}, "sha512-Dnz92NInDqYckGEUJv689RbRiTSEHCQ7wOVeALbkOz999YpqT46yMRIGtSNl2iCL1waAZSx40+h59NV/EwzV/A=="],
|
||||
|
||||
"is-typedarray": ["is-typedarray@1.0.0", "", {}, "sha512-cyA56iCMHAh5CdzjJIa4aohJyeO1YbwLi3Jc35MmRU6poroFjIGZzUzupGiRPOjgHg9TLu43xbpwXk523fMxKA=="],
|
||||
|
||||
"is-unicode-supported": ["is-unicode-supported@2.1.0", "", {}, "sha512-mE00Gnza5EEB3Ds0HfMyllZzbBrmLOX3vfWoj9A9PEnTfratQ/BcaJOuMhnkhjXvb2+FkY3VuHqtAGpTPmglFQ=="],
|
||||
|
||||
"is-what": ["is-what@4.1.16", "", {}, "sha512-ZhMwEosbFJkA0YhFnNDgTM4ZxDRsS6HqTo7qsZM08fehyRYIYa0yHu5R6mgo1n/8MgaPBXiPimPD77baVFYg+A=="],
|
||||
@@ -1195,8 +1076,6 @@
|
||||
|
||||
"isexe": ["isexe@2.0.0", "", {}, "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw=="],
|
||||
|
||||
"isstream": ["isstream@0.1.2", "", {}, "sha512-Yljz7ffyPbrLpLngrMtZ7NduUgVvi6wG9RJ9IUcyCd59YQ911PBJphODUcbOVbqYfxe1wuYf/LJ8PauMRwsM/g=="],
|
||||
|
||||
"jackspeak": ["jackspeak@3.4.3", "", { "dependencies": { "@isaacs/cliui": "^8.0.2" }, "optionalDependencies": { "@pkgjs/parseargs": "^0.11.0" } }, "sha512-OGlZQpz2yfahA/Rd1Y8Cd9SIEsqvXkLVoSw/cgwhnhFMDbsQFeZYoJJ7bIZBS9BcamUW96asq/npPWugM+RQBw=="],
|
||||
|
||||
"jiti": ["jiti@2.4.2", "", { "bin": { "jiti": "lib/jiti-cli.mjs" } }, "sha512-rg9zJN+G4n2nfJl5MW3BMygZX56zKPNVEYYqq7adpmMh4Jn2QNEwhvQlFy6jPVdcod7txZtKHWnyZiA3a0zP7A=="],
|
||||
@@ -1207,30 +1086,16 @@
|
||||
|
||||
"js-yaml": ["js-yaml@4.1.0", "", { "dependencies": { "argparse": "^2.0.1" }, "bin": { "js-yaml": "bin/js-yaml.js" } }, "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA=="],
|
||||
|
||||
"jsbn": ["jsbn@0.1.1", "", {}, "sha512-UVU9dibq2JcFWxQPA6KCqj5O42VOmAY3zQUfEKxU0KpTGXwNoCjkX1e13eHNvw/xPynt6pU0rZ1htjWTNTSXsg=="],
|
||||
|
||||
"jsdom": ["jsdom@11.12.0", "", { "dependencies": { "abab": "^2.0.0", "acorn": "^5.5.3", "acorn-globals": "^4.1.0", "array-equal": "^1.0.0", "cssom": ">= 0.3.2 < 0.4.0", "cssstyle": "^1.0.0", "data-urls": "^1.0.0", "domexception": "^1.0.1", "escodegen": "^1.9.1", "html-encoding-sniffer": "^1.0.2", "left-pad": "^1.3.0", "nwsapi": "^2.0.7", "parse5": "4.0.0", "pn": "^1.1.0", "request": "^2.87.0", "request-promise-native": "^1.0.5", "sax": "^1.2.4", "symbol-tree": "^3.2.2", "tough-cookie": "^2.3.4", "w3c-hr-time": "^1.0.1", "webidl-conversions": "^4.0.2", "whatwg-encoding": "^1.0.3", "whatwg-mimetype": "^2.1.0", "whatwg-url": "^6.4.1", "ws": "^5.2.0", "xml-name-validator": "^3.0.0" } }, "sha512-y8Px43oyiBM13Zc1z780FrfNLJCXTL40EWlty/LXUtcjykRBNgLlCjWXpfSPBl2iv+N7koQN+dvqszHZgT/Fjw=="],
|
||||
|
||||
"jsesc": ["jsesc@3.1.0", "", { "bin": { "jsesc": "bin/jsesc" } }, "sha512-/sM3dO2FOzXjKQhJuo0Q173wf2KOo8t4I8vHy6lF9poUp7bKT0/NHE8fPX23PwfhnykfqnC2xRxOnVw5XuGIaA=="],
|
||||
|
||||
"json-schema": ["json-schema@0.4.0", "", {}, "sha512-es94M3nTIfsEPisRafak+HDLfHXnKBhV3vU5eqPcS3flIWqcxJWgXHXiey3YrpaNsanY5ei1VoYEbOzijuq9BA=="],
|
||||
|
||||
"json-schema-traverse": ["json-schema-traverse@1.0.0", "", {}, "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug=="],
|
||||
|
||||
"json-stringify-safe": ["json-stringify-safe@5.0.1", "", {}, "sha512-ZClg6AaYvamvYEE82d3Iyd3vSSIjQ+odgjaTzRuO3s7toCdFKczob2i0zCh7JE8kWn17yvAWhUVxvqGwUalsRA=="],
|
||||
|
||||
"json5": ["json5@2.2.3", "", { "bin": { "json5": "lib/cli.js" } }, "sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg=="],
|
||||
|
||||
"jsonfile": ["jsonfile@6.1.0", "", { "dependencies": { "universalify": "^2.0.0" }, "optionalDependencies": { "graceful-fs": "^4.1.6" } }, "sha512-5dgndWOriYSm5cnYaJNhalLNDKOqFwyDB/rr1E9ZsGciGvKPs8R2xYGCacuf3z6K1YKDz182fd+fY3cn3pMqXQ=="],
|
||||
|
||||
"jsprim": ["jsprim@1.4.2", "", { "dependencies": { "assert-plus": "1.0.0", "extsprintf": "1.3.0", "json-schema": "0.4.0", "verror": "1.10.0" } }, "sha512-P2bSOMAc/ciLz6DzgjVlGJP9+BrJWu5UDGK70C2iweC5QBIeFf0ZXRvGjEj2uYgrY2MkAAhsSWHDWlFtEroZWw=="],
|
||||
|
||||
"katex": ["katex@0.10.2", "", { "dependencies": { "commander": "^2.19.0" }, "bin": { "katex": "cli.js" } }, "sha512-cQOmyIRoMloCoSIOZ1+gEwsksdJZ1EW4SWm3QzxSza/QsnZr6D4U1V9S4q+B/OLm2OQ8TCBecQ8MaIfnScI7cw=="],
|
||||
|
||||
"keygrip": ["keygrip@1.1.0", "", { "dependencies": { "tsscmp": "1.0.6" } }, "sha512-iYSchDJ+liQ8iwbSI2QqsQOvqv58eJCEanyJPJi+Khyu8smkcKSFUCbPwzFcL7YVtZ6eONjqRX/38caJ7QjRAQ=="],
|
||||
|
||||
"khroma": ["khroma@1.4.1", "", {}, "sha512-+GmxKvmiRuCcUYDgR7g5Ngo0JEDeOsGdNONdU2zsiBQaK4z19Y2NvXqfEDE0ZiIrg45GTZyAnPLVsLZZACYm3Q=="],
|
||||
|
||||
"kleur": ["kleur@3.0.3", "", {}, "sha512-eTIzlVOSUR+JxdDFepEYcBMtZ9Qqdef+rnzWdRZuMbOywu5tO2w2N7rqjoANZ5k9vywhL6Br1VRjUIgTQx4E8w=="],
|
||||
|
||||
"klona": ["klona@2.0.6", "", {}, "sha512-dhG34DXATL5hSxJbIexCft8FChFXtmskoZYnoPWjXQuebWYCNkVeV3KkGegCK9CP1oswI/vQibS2GY7Em/sJJA=="],
|
||||
@@ -1253,8 +1118,6 @@
|
||||
|
||||
"lazystream": ["lazystream@1.0.1", "", { "dependencies": { "readable-stream": "^2.0.5" } }, "sha512-b94GiNHQNy6JNTrt5w6zNyffMrNkXZb3KTkCZJb2V1xaEGCk093vkZ2jk3tpaeP33/OiXC+WvK9AxUebnf5nbw=="],
|
||||
|
||||
"left-pad": ["left-pad@1.3.0", "", {}, "sha512-XI5MPzVNApjAyhQzphX8BkmKsKUxD4LdyK24iZeQGinBN9yTQT3bFlCBy/aVx2HrNcqQGsdot8ghrjyrvMCoEA=="],
|
||||
|
||||
"levn": ["levn@0.3.0", "", { "dependencies": { "prelude-ls": "~1.1.2", "type-check": "~0.3.2" } }, "sha512-0OO4y2iOHix2W6ujICbKIaEQXvFQHue65vUG3pb5EUomzPI90z9hsA1VsO/dbIIpC53J8gxM9Q4Oho0jrCM/yA=="],
|
||||
|
||||
"lilconfig": ["lilconfig@3.1.3", "", {}, "sha512-/vlFKAoH5Cgt3Ie+JLhRbwOsCQePABiU3tJ1egGvyQ+33R/vcwM2Zl2QR/LzjsBeItPt3oSVXapn+m4nQDvpzw=="],
|
||||
@@ -1279,8 +1142,6 @@
|
||||
|
||||
"lodash.memoize": ["lodash.memoize@4.1.2", "", {}, "sha512-t7j+NzmgnQzTAYXcsHYLgimltOV1MXHtlOWf6GjL9Kj8GK5FInw5JotxvbOs+IvV1/Dzo04/fCGfLVs7aXb4Ag=="],
|
||||
|
||||
"lodash.sortby": ["lodash.sortby@4.7.0", "", {}, "sha512-HDWXG8isMntAyRF5vZ7xKuEvOhT4AhlRt/3czTSjvGUxjYCBVRQY48ViDHyfYz9VIoBkW4TMGQNapx+l3RUwdA=="],
|
||||
|
||||
"lodash.uniq": ["lodash.uniq@4.5.0", "", {}, "sha512-xfBaXQd9ryd9dlSDvnvI0lvxfLJlYAZzXomUYzLKtUeOQvOP5piqAWuGtrhWeqaXK9hhoM/iyJc5AV+XfsX3HQ=="],
|
||||
|
||||
"longest-streak": ["longest-streak@3.1.0", "", {}, "sha512-9Ri+o0JYgehTaVBBDoMqIl8GXtbWg711O3srftcHhZ0dqnETqLaoIK0x17fUw9rFSlK/0NlsKe0Ahhyl5pXE2g=="],
|
||||
@@ -1295,12 +1156,8 @@
|
||||
|
||||
"markdown-table": ["markdown-table@3.0.4", "", {}, "sha512-wiYz4+JrLyb/DqW2hkFJxP7Vd7JuTDm77fvbM8VfEQdmSMqcImWeeRbHwZjBjIFki/VaMK2BhFi7oUUZeM5bqw=="],
|
||||
|
||||
"marked": ["marked@0.4.0", "", { "bin": { "marked": "./bin/marked" } }, "sha512-tMsdNBgOsrUophCAFQl0XPe6Zqk/uy9gnue+jIIKhykO51hxyu6uNx7zBPy0+y/WKYVZZMspV9YeXLNdKk+iYw=="],
|
||||
|
||||
"math-intrinsics": ["math-intrinsics@1.1.0", "", {}, "sha512-/IXtbwEk5HTPyEwyKX6hGkYXxM9nbj64B+ilVJnC/R6B0pH5G4V3b0pVbL7DBj4tkhBAppbQUlf6F6Xl9LHu1g=="],
|
||||
|
||||
"mathjax": ["mathjax@2.7.9", "", {}, "sha512-NOGEDTIM9+MrsqnjPEjVGNx4q0GQxqm61yQwSK+/5S59i26wId5IC5gNu9/bu8+CCVl5p9G2IHcAl/wJa+5+BQ=="],
|
||||
|
||||
"mdast-util-find-and-replace": ["mdast-util-find-and-replace@3.0.2", "", { "dependencies": { "@types/mdast": "^4.0.0", "escape-string-regexp": "^5.0.0", "unist-util-is": "^6.0.0", "unist-util-visit-parents": "^6.0.0" } }, "sha512-Tmd1Vg/m3Xz43afeNxDIhWRtFZgM2VLyaf4vSTYwudTyeuTneoL3qtWMA5jeLyz/O1vDJmmV4QuScFCA2tBPwg=="],
|
||||
|
||||
"mdast-util-from-markdown": ["mdast-util-from-markdown@2.0.2", "", { "dependencies": { "@types/mdast": "^4.0.0", "@types/unist": "^3.0.0", "decode-named-character-reference": "^1.0.0", "devlop": "^1.0.0", "mdast-util-to-string": "^4.0.0", "micromark": "^4.0.0", "micromark-util-decode-numeric-character-reference": "^2.0.0", "micromark-util-decode-string": "^2.0.0", "micromark-util-normalize-identifier": "^2.0.0", "micromark-util-symbol": "^2.0.0", "micromark-util-types": "^2.0.0", "unist-util-stringify-position": "^4.0.0" } }, "sha512-uZhTV/8NBuw0WHkPTrCqDOl0zVe1BIng5ZtHoDk49ME1qqcjYmmLmOf0gELgcRMxN4w2iuIeVso5/6QymSrgmA=="],
|
||||
@@ -1337,8 +1194,6 @@
|
||||
|
||||
"merge2": ["merge2@1.4.1", "", {}, "sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg=="],
|
||||
|
||||
"mermaid": ["mermaid@8.14.0", "", { "dependencies": { "@braintree/sanitize-url": "^3.1.0", "d3": "^7.0.0", "dagre": "^0.8.5", "dagre-d3": "^0.6.4", "dompurify": "2.3.5", "graphlib": "^2.1.8", "khroma": "^1.4.1", "moment-mini": "^2.24.0", "stylis": "^4.0.10" } }, "sha512-ITSHjwVaby1Li738sxhF48sLTxcNyUAoWfoqyztL1f7J6JOLpHOuQPNLBb6lxGPUA0u7xP9IRULgvod0dKu35A=="],
|
||||
|
||||
"methods": ["methods@1.1.2", "", {}, "sha512-iclAHeNqNm68zFtnZ0e+1L2yUIdvzNoauKU4WBA3VvH/vPFieF7qfRlwUZU+DA9P9bPXIS90ulxoUoCH23sV2w=="],
|
||||
|
||||
"micromark": ["micromark@4.0.1", "", { "dependencies": { "@types/debug": "^4.0.0", "debug": "^4.0.0", "decode-named-character-reference": "^1.0.0", "devlop": "^1.0.0", "micromark-core-commonmark": "^2.0.0", "micromark-factory-space": "^2.0.0", "micromark-util-character": "^2.0.0", "micromark-util-chunked": "^2.0.0", "micromark-util-combine-extensions": "^2.0.0", "micromark-util-decode-numeric-character-reference": "^2.0.0", "micromark-util-encode": "^2.0.0", "micromark-util-normalize-identifier": "^2.0.0", "micromark-util-resolve-all": "^2.0.0", "micromark-util-sanitize-uri": "^2.0.0", "micromark-util-subtokenize": "^2.0.0", "micromark-util-symbol": "^2.0.0", "micromark-util-types": "^2.0.0" } }, "sha512-eBPdkcoCNvYcxQOAKAlceo5SNdzZWfF+FcSupREAzdAh9rRmE239CEQAiTwIgblwnoM8zzj35sZ5ZwvSEOF6Kw=="],
|
||||
@@ -1427,8 +1282,6 @@
|
||||
|
||||
"mlly": ["mlly@1.7.4", "", { "dependencies": { "acorn": "^8.14.0", "pathe": "^2.0.1", "pkg-types": "^1.3.0", "ufo": "^1.5.4" } }, "sha512-qmdSIPC4bDJXgZTCR7XosJiNKySV7O215tsPtDN9iEO/7q/76b/ijtgRu/+epFXSJhijtTCCGp3DWS549P3xKw=="],
|
||||
|
||||
"moment-mini": ["moment-mini@2.29.4", "", {}, "sha512-uhXpYwHFeiTbY9KSgPPRoo1nt8OxNVdMVoTBYHfSEKeRkIkwGpO+gERmhuhBtzfaeOyTkykSrm2+noJBgqt3Hg=="],
|
||||
|
||||
"mrmime": ["mrmime@2.0.1", "", {}, "sha512-Y3wQdFg2Va6etvQ5I82yUhGdsKrcYox6p7FfL1LbK2J4V01F9TGlepTIhnK24t7koZibmg82KGglhA1XK5IsLQ=="],
|
||||
|
||||
"ms": ["ms@2.1.3", "", {}, "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA=="],
|
||||
@@ -1485,12 +1338,8 @@
|
||||
|
||||
"nuxt-site-config-kit": ["nuxt-site-config-kit@3.0.7", "", { "dependencies": { "@nuxt/kit": "^3.15.4", "pkg-types": "^1.3.1", "site-config-stack": "3.0.7", "std-env": "^3.8.0", "ufo": "^1.5.4" } }, "sha512-uxouwnPRak6/6XAEk6dYUiFVM9Vq5mUpyd3ooCwXqT0YYrhM9X6KSDHETsnFa0u+yXKTk/pzzO8fZc0DRBNaSA=="],
|
||||
|
||||
"nwsapi": ["nwsapi@2.2.16", "", {}, "sha512-F1I/bimDpj3ncaNDhfyMWuFqmQDBwDB0Fogc2qpL3BWvkQteFD/8BzWuIRl83rq0DXfm8SGt/HFhLXZyljTXcQ=="],
|
||||
|
||||
"nypm": ["nypm@0.5.2", "", { "dependencies": { "citty": "^0.1.6", "consola": "^3.4.0", "pathe": "^2.0.2", "pkg-types": "^1.3.1", "tinyexec": "^0.3.2", "ufo": "^1.5.4" }, "bin": { "nypm": "dist/cli.mjs" } }, "sha512-AHzvnyUJYSrrphPhRWWZNcoZfArGNp3Vrc4pm/ZurO74tYNTgAPrEyBQEKy+qioqmWlPXwvMZCG2wOaHlPG0Pw=="],
|
||||
|
||||
"oauth-sign": ["oauth-sign@0.9.0", "", {}, "sha512-fexhUFFPTGV8ybAtSIGbV6gOkSv8UtRbDBnAyLQw4QPKkgNlsH2ByPGtMUqdWkos6YCRmAqViwgZrJc/mRDzZQ=="],
|
||||
|
||||
"object-assign": ["object-assign@4.1.1", "", {}, "sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg=="],
|
||||
|
||||
"object-hash": ["object-hash@3.0.0", "", {}, "sha512-RSn9F68PjH9HqtltsSnqYC1XXoWe9Bju5+213R98cNGttag9q9yAOTzdbsqvIa7aNm5WffBZFpWYr2aWrklWAw=="],
|
||||
@@ -1555,8 +1404,6 @@
|
||||
|
||||
"perfect-debounce": ["perfect-debounce@1.0.0", "", {}, "sha512-xCy9V055GLEqoFaHoC1SoLIaLmWctgCUaBaWxDZ7/Zx4CTyX7cJQLJOok/orfjZAh9kEYpjJa4d0KcJmCbctZA=="],
|
||||
|
||||
"performance-now": ["performance-now@2.1.0", "", {}, "sha512-7EAHlyLHI56VEIdK57uwHdHKIaAGbnXPiw0yWbarQZOKaKpvUIgW0jWRVLiatnM+XXlSwsanIBH/hzGMJulMow=="],
|
||||
|
||||
"picocolors": ["picocolors@1.1.1", "", {}, "sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA=="],
|
||||
|
||||
"picomatch": ["picomatch@4.0.2", "", {}, "sha512-M7BAV6Rlcy5u+m6oPhAPFgJTzAioX/6B0DxyvDlo9l8+T3nLKbrczg2WLUyzd45L8RqfUMyGPzekbMvX2Ldkwg=="],
|
||||
@@ -1569,8 +1416,6 @@
|
||||
|
||||
"pluralize": ["pluralize@8.0.0", "", {}, "sha512-Nc3IT5yHzflTfbjgqWcCPpo7DaKy4FnpB0l/zCAW0Tc7jxAiuqSxHasntB3D7887LSrA93kDJ9IXovxJYxyLCA=="],
|
||||
|
||||
"pn": ["pn@1.1.0", "", {}, "sha512-2qHaIQr2VLRFoxe2nASzsV6ef4yOOH+Fi9FBOVH6cqeSgUnoyySPZkxzLuzd+RYOQTRpROA0ztTMqxROKSb/nA=="],
|
||||
|
||||
"portfinder": ["portfinder@1.0.32", "", { "dependencies": { "async": "^2.6.4", "debug": "^3.2.7", "mkdirp": "^0.5.6" } }, "sha512-on2ZJVVDXRADWE6jnQaX0ioEylzgBpQk8r55NE4wjXW1ZxO+BgDlY6DXwj20i0V8eB4SenDQ00WEaxfiIQPcxg=="],
|
||||
|
||||
"postcss": ["postcss@8.5.2", "", { "dependencies": { "nanoid": "^3.3.8", "picocolors": "^1.1.1", "source-map-js": "^1.2.1" } }, "sha512-MjOadfU3Ys9KYoX0AdkBlFEF1Vx37uCCeN4ZHnmwm9FfpbsGWMZeBLMmmpY+6Ocqod7mkdZ0DT31OlbsFrLlkA=="],
|
||||
@@ -1673,14 +1518,8 @@
|
||||
|
||||
"protocols": ["protocols@2.0.2", "", {}, "sha512-hHVTzba3wboROl0/aWRRG9dMytgH6ow//STBZh43l/wQgmMhYhOFi0EHWAPtoCz9IAUymsyP0TSBHkhgMEGNnQ=="],
|
||||
|
||||
"psl": ["psl@1.15.0", "", { "dependencies": { "punycode": "^2.3.1" } }, "sha512-JZd3gMVBAVQkSs6HdNZo9Sdo0LNcQeMNP3CozBJb3JYC/QUYZTnKxP+f8oWRX4rHP5EurWxqAHTSwUCjlNKa1w=="],
|
||||
|
||||
"pump": ["pump@3.0.2", "", { "dependencies": { "end-of-stream": "^1.1.0", "once": "^1.3.1" } }, "sha512-tUPXtzlGM8FE3P0ZL6DVs/3P58k9nk8/jZeQCurTJylQA8qFYzHFfhBJkuqyE0FifOsQ0uKWekiZ5g8wtr28cw=="],
|
||||
|
||||
"punycode": ["punycode@2.3.1", "", {}, "sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg=="],
|
||||
|
||||
"qs": ["qs@6.5.3", "", {}, "sha512-qxXIEh4pCGfHICj1mAJQ2/2XVZkjCDTcEgfoSQxc/fYivUZxTkk7L3bDBJSoNrEzXI17oUO5Dp07ktqE5KzczA=="],
|
||||
|
||||
"queue-microtask": ["queue-microtask@1.2.3", "", {}, "sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A=="],
|
||||
|
||||
"radix-vue": ["radix-vue@1.9.15", "", { "dependencies": { "@floating-ui/dom": "^1.6.7", "@floating-ui/vue": "^1.1.0", "@internationalized/date": "^3.5.4", "@internationalized/number": "^3.5.3", "@tanstack/vue-virtual": "^3.8.1", "@vueuse/core": "^10.11.0", "@vueuse/shared": "^10.11.0", "aria-hidden": "^1.2.4", "defu": "^6.1.4", "fast-deep-equal": "^3.1.3", "nanoid": "^5.0.7" }, "peerDependencies": { "vue": ">= 3.2.0" } }, "sha512-+wz/PBlUTkrqFPS9ZUI1eZ4QHrU2EVbQnPvtnxWY7Q7jZtNE/LAAEf9IDoBoacX1hKfJXBB+SKfZSrv57uofYA=="],
|
||||
@@ -1693,8 +1532,6 @@
|
||||
|
||||
"range-parser": ["range-parser@1.2.1", "", {}, "sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg=="],
|
||||
|
||||
"raphael": ["raphael@2.3.0", "", { "dependencies": { "eve-raphael": "0.5.0" } }, "sha512-w2yIenZAQnp257XUWGni4bLMVxpUpcIl7qgxEgDIXtmSypYtlNxfXWpOBxs7LBTps5sDwhRnrToJrMUrivqNTQ=="],
|
||||
|
||||
"rc": ["rc@1.2.8", "", { "dependencies": { "deep-extend": "^0.6.0", "ini": "~1.3.0", "minimist": "^1.2.0", "strip-json-comments": "~2.0.1" }, "bin": { "rc": "./cli.js" } }, "sha512-y3bGgqKj3QBdxLbLkomlohkvsA8gdAiUQlSBJnBhfn+BPxg4bc62d8TcBW15wavDfgexCgccckhcZvywyQYPOw=="],
|
||||
|
||||
"rc9": ["rc9@2.1.2", "", { "dependencies": { "defu": "^6.1.4", "destr": "^2.0.3" } }, "sha512-btXCnMmRIBINM2LDZoEmOogIZU7Qe7zn4BpomSKZ/ykbLObuBdvG+mFq11DL6fjH1DRwHhrlgtYWG96bJiC7Cg=="],
|
||||
@@ -1733,12 +1570,6 @@
|
||||
|
||||
"replace-in-file": ["replace-in-file@6.3.5", "", { "dependencies": { "chalk": "^4.1.2", "glob": "^7.2.0", "yargs": "^17.2.1" }, "bin": { "replace-in-file": "bin/cli.js" } }, "sha512-arB9d3ENdKva2fxRnSjwBEXfK1npgyci7ZZuwysgAp7ORjHSyxz6oqIjTEv8R0Ydl4Ll7uOAZXL4vbkhGIizCg=="],
|
||||
|
||||
"request": ["request@2.88.2", "", { "dependencies": { "aws-sign2": "~0.7.0", "aws4": "^1.8.0", "caseless": "~0.12.0", "combined-stream": "~1.0.6", "extend": "~3.0.2", "forever-agent": "~0.6.1", "form-data": "~2.3.2", "har-validator": "~5.1.3", "http-signature": "~1.2.0", "is-typedarray": "~1.0.0", "isstream": "~0.1.2", "json-stringify-safe": "~5.0.1", "mime-types": "~2.1.19", "oauth-sign": "~0.9.0", "performance-now": "^2.1.0", "qs": "~6.5.2", "safe-buffer": "^5.1.2", "tough-cookie": "~2.5.0", "tunnel-agent": "^0.6.0", "uuid": "^3.3.2" } }, "sha512-MsvtOrfG9ZcrOwAW+Qi+F6HbD0CWXEh9ou77uOb7FM2WPhwT7smM833PzanhJLsgXjN89Ir6V2PczXNnMpwKhw=="],
|
||||
|
||||
"request-promise-core": ["request-promise-core@1.1.4", "", { "dependencies": { "lodash": "^4.17.19" }, "peerDependencies": { "request": "^2.34" } }, "sha512-TTbAfBBRdWD7aNNOoVOBH4pN/KigV6LyapYNNlAPA8JwbovRti1E88m3sYAwsLi5ryhPKsE9APwnjFTgdUjTpw=="],
|
||||
|
||||
"request-promise-native": ["request-promise-native@1.0.9", "", { "dependencies": { "request-promise-core": "1.1.4", "stealthy-require": "^1.1.1", "tough-cookie": "^2.3.3" }, "peerDependencies": { "request": "^2.34" } }, "sha512-wcW+sIUiWnKgNY0dqCpOZkUbF/I+YPi+f09JZIDa39Ec+q82CpSYniDp+ISgTTbKmnpJWASeJBPZmoxH84wt3g=="],
|
||||
|
||||
"require-directory": ["require-directory@2.1.1", "", {}, "sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q=="],
|
||||
|
||||
"require-from-string": ["require-from-string@2.0.2", "", {}, "sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw=="],
|
||||
@@ -1757,8 +1588,6 @@
|
||||
|
||||
"rimraf": ["rimraf@5.0.10", "", { "dependencies": { "glob": "^10.3.7" }, "bin": { "rimraf": "dist/esm/bin.mjs" } }, "sha512-l0OE8wL34P4nJH/H2ffoaniAokM2qSmrtXHmlpvYr5AVVX8msAyW0l8NVJFDxlSK4u3Uh/f41cQheDVdnYijwQ=="],
|
||||
|
||||
"robust-predicates": ["robust-predicates@3.0.2", "", {}, "sha512-IXgzBWvWQwE6PrDI05OvmXUIruQTcoMDzRsOd5CDvHCVLcLHMTSYvOK5Cm46kWqlV3yAbuSpBZdJ5oP5OUoStg=="],
|
||||
|
||||
"rollup": ["rollup@4.34.8", "", { "dependencies": { "@types/estree": "1.0.6" }, "optionalDependencies": { "@rollup/rollup-android-arm-eabi": "4.34.8", "@rollup/rollup-android-arm64": "4.34.8", "@rollup/rollup-darwin-arm64": "4.34.8", "@rollup/rollup-darwin-x64": "4.34.8", "@rollup/rollup-freebsd-arm64": "4.34.8", "@rollup/rollup-freebsd-x64": "4.34.8", "@rollup/rollup-linux-arm-gnueabihf": "4.34.8", "@rollup/rollup-linux-arm-musleabihf": "4.34.8", "@rollup/rollup-linux-arm64-gnu": "4.34.8", "@rollup/rollup-linux-arm64-musl": "4.34.8", "@rollup/rollup-linux-loongarch64-gnu": "4.34.8", "@rollup/rollup-linux-powerpc64le-gnu": "4.34.8", "@rollup/rollup-linux-riscv64-gnu": "4.34.8", "@rollup/rollup-linux-s390x-gnu": "4.34.8", "@rollup/rollup-linux-x64-gnu": "4.34.8", "@rollup/rollup-linux-x64-musl": "4.34.8", "@rollup/rollup-win32-arm64-msvc": "4.34.8", "@rollup/rollup-win32-ia32-msvc": "4.34.8", "@rollup/rollup-win32-x64-msvc": "4.34.8", "fsevents": "~2.3.2" }, "bin": { "rollup": "dist/bin/rollup" } }, "sha512-489gTVMzAYdiZHFVA/ig/iYFllCcWFHMvUHI1rpFmkoUtRlQxqh6/yiNqnYibjMZ2b/+FUQwldG+aLsEt6bglQ=="],
|
||||
|
||||
"rollup-plugin-postcss": ["rollup-plugin-postcss@4.0.2", "", { "dependencies": { "chalk": "^4.1.0", "concat-with-sourcemaps": "^1.1.0", "cssnano": "^5.0.1", "import-cwd": "^3.0.0", "p-queue": "^6.6.2", "pify": "^5.0.0", "postcss-load-config": "^3.0.0", "postcss-modules": "^4.0.0", "promise.series": "^0.2.0", "resolve": "^1.19.0", "rollup-pluginutils": "^2.8.2", "safe-identifier": "^0.4.2", "style-inject": "^0.3.0" }, "peerDependencies": { "postcss": "8.x" } }, "sha512-05EaY6zvZdmvPUDi3uCcAQoESDcYnv8ogJJQRp6V5kZ6J6P7uAVJlrTZcaaA20wTH527YTnKfkAoPxWI/jPp4w=="],
|
||||
@@ -1773,18 +1602,12 @@
|
||||
|
||||
"run-parallel": ["run-parallel@1.2.0", "", { "dependencies": { "queue-microtask": "^1.2.2" } }, "sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA=="],
|
||||
|
||||
"rw": ["rw@1.3.3", "", {}, "sha512-PdhdWy89SiZogBLaw42zdeqtRJ//zFd2PgQavcICDUgJT5oW10QCRKbJ6bg4r0/UY2M6BWd5tkxuGFRvCkgfHQ=="],
|
||||
|
||||
"safe-buffer": ["safe-buffer@5.1.2", "", {}, "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g=="],
|
||||
|
||||
"safe-identifier": ["safe-identifier@0.4.2", "", {}, "sha512-6pNbSMW6OhAi9j+N8V+U715yBQsaWJ7eyEUaOrawX+isg5ZxhUlV1NipNtgaKHmFGiABwt+ZF04Ii+3Xjkg+8w=="],
|
||||
|
||||
"safe-regex-test": ["safe-regex-test@1.1.0", "", { "dependencies": { "call-bound": "^1.0.2", "es-errors": "^1.3.0", "is-regex": "^1.2.1" } }, "sha512-x/+Cz4YrimQxQccJf5mKEbIa1NzeCRNI5Ecl/ekmlYaampdNLPalVyIcCZNNH3MvmqBugV5TMYZXv0ljslUlaw=="],
|
||||
|
||||
"safer-buffer": ["safer-buffer@2.1.2", "", {}, "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg=="],
|
||||
|
||||
"sax": ["sax@1.4.1", "", {}, "sha512-+aWOz7yVScEGoKNd4PA10LZ8sk0A/z5+nXQG5giUO5rprX9jgYsTdov9qCchZiPIZezbZH+jRut8nPodFAX4Jg=="],
|
||||
|
||||
"scule": ["scule@1.3.0", "", {}, "sha512-6FtHJEvt+pVMIB9IBY+IcCJ6Z5f1iQnytgyfKMhDKgmzYG+TeH/wx1y3l27rshSbLiSanrR9ffZDrEsmjlQF2g=="],
|
||||
|
||||
"semver": ["semver@7.7.1", "", { "bin": { "semver": "bin/semver.js" } }, "sha512-hlq8tAfn0m/61p4BVRcPzIGr6LKiMwo4VM6dGi6pt4qcRkmNzTcWq6eCEjEh+qXjkMDvPlOFFSGwQjoEa6gyMA=="],
|
||||
@@ -1833,8 +1656,6 @@
|
||||
|
||||
"speakingurl": ["speakingurl@14.0.1", "", {}, "sha512-1POYv7uv2gXoyGFpBCmpDVSNV74IfsWlDW216UPjbWufNf+bSU6GdbDsxdcxtfwb4xlI3yxzOTKClUosxARYrQ=="],
|
||||
|
||||
"sshpk": ["sshpk@1.18.0", "", { "dependencies": { "asn1": "~0.2.3", "assert-plus": "^1.0.0", "bcrypt-pbkdf": "^1.0.0", "dashdash": "^1.12.0", "ecc-jsbn": "~0.1.1", "getpass": "^0.1.1", "jsbn": "~0.1.0", "safer-buffer": "^2.0.2", "tweetnacl": "~0.14.0" }, "bin": { "sshpk-conv": "bin/sshpk-conv", "sshpk-sign": "bin/sshpk-sign", "sshpk-verify": "bin/sshpk-verify" } }, "sha512-2p2KJZTSqQ/I3+HX42EpYOa2l3f8Erv8MWKsy2I9uf4wA7yFIkXRffYdsx86y6z4vHtV8u7g+pPlr8/4ouAxsQ=="],
|
||||
|
||||
"stable": ["stable@0.1.8", "", {}, "sha512-ji9qxRnOVfcuLDySj9qzhGSEFVobyt1kIOSkj1qZzYLzq7Tos/oUUWvotUPQLlrsidqsK6tBH89Bc9kL5zHA6w=="],
|
||||
|
||||
"standard-as-callback": ["standard-as-callback@2.1.0", "", {}, "sha512-qoRRSyROncaz1z0mvYqIE4lCd9p2R90i6GxW3uZv5ucSu8tU7B5HXUP1gG8pVZsYNVaXjk8ClXHPttLyxAL48A=="],
|
||||
@@ -1843,8 +1664,6 @@
|
||||
|
||||
"std-env": ["std-env@3.8.0", "", {}, "sha512-Bc3YwwCB+OzldMxOXJIIvC6cPRWr/LxOp48CdQTOkPyk/t4JWWJbrilwBd7RJzKV8QW7tJkcgAmeuLLJugl5/w=="],
|
||||
|
||||
"stealthy-require": ["stealthy-require@1.1.1", "", {}, "sha512-ZnWpYnYugiOVEY5GkcuJK1io5V8QmNYChG62gSit9pQVGErXtrKuPC55ITaVSukmMta5qpMU7vqLt2Lnni4f/g=="],
|
||||
|
||||
"streamx": ["streamx@2.22.0", "", { "dependencies": { "fast-fifo": "^1.3.2", "text-decoder": "^1.1.0" }, "optionalDependencies": { "bare-events": "^2.2.0" } }, "sha512-sLh1evHOzBy/iWRiR6d1zRcLao4gGZr3C1kzNz4fopCOKJb6xD9ub8Mpi9Mr1R6id5o43S+d93fI48UC5uM9aw=="],
|
||||
|
||||
"string-hash": ["string-hash@1.1.3", "", {}, "sha512-kJUvRUFK49aub+a7T1nNE66EJbZBMnBgoC1UbCZ5n6bsZKBRga4KgBRTMn/pFkeCZSYtNeSyMxPDM0AXWELk2A=="],
|
||||
@@ -1869,9 +1688,9 @@
|
||||
|
||||
"style-inject": ["style-inject@0.3.0", "", {}, "sha512-IezA2qp+vcdlhJaVm5SOdPPTUu0FCEqfNSli2vRuSIBbu5Nq5UvygTk/VzeCqfLz2Atj3dVII5QBKGZRZ0edzw=="],
|
||||
|
||||
"stylehacks": ["stylehacks@5.1.1", "", { "dependencies": { "browserslist": "^4.21.4", "postcss-selector-parser": "^6.0.4" }, "peerDependencies": { "postcss": "^8.2.15" } }, "sha512-sBpcd5Hx7G6seo7b1LkpttvTz7ikD0LlH5RmdcBNb6fFR0Fl7LQwHDFr300q4cwUqi+IYrFGmsIHieMBfnN/Bw=="],
|
||||
"style-mod": ["style-mod@4.1.2", "", {}, "sha512-wnD1HyVqpJUI2+eKZ+eo1UwghftP6yuFheBqqe+bWCotBjC2K1YnteJILRMs3SM4V/0dLEW1SC27MWP5y+mwmw=="],
|
||||
|
||||
"stylis": ["stylis@4.3.6", "", {}, "sha512-yQ3rwFWRfwNUY7H5vpU0wfdkNSnvnJinhF9830Swlaxl03zsOjCfmX0ugac+3LtK0lYSgwL/KXc8oYL3mG4YFQ=="],
|
||||
"stylehacks": ["stylehacks@5.1.1", "", { "dependencies": { "browserslist": "^4.21.4", "postcss-selector-parser": "^6.0.4" }, "peerDependencies": { "postcss": "^8.2.15" } }, "sha512-sBpcd5Hx7G6seo7b1LkpttvTz7ikD0LlH5RmdcBNb6fFR0Fl7LQwHDFr300q4cwUqi+IYrFGmsIHieMBfnN/Bw=="],
|
||||
|
||||
"sucrase": ["sucrase@3.35.0", "", { "dependencies": { "@jridgewell/gen-mapping": "^0.3.2", "commander": "^4.0.0", "glob": "^10.3.10", "lines-and-columns": "^1.1.6", "mz": "^2.7.0", "pirates": "^4.0.1", "ts-interface-checker": "^0.1.9" }, "bin": { "sucrase": "bin/sucrase", "sucrase-node": "bin/sucrase-node" } }, "sha512-8EbVDiu9iN/nESwxeSxDKe0dunta1GOlHufmSSXxMD2z2/tMZpDMpvXQGsc+ajGo8y2uYUmixaSRUc/QPoQ0GA=="],
|
||||
|
||||
@@ -1885,8 +1704,6 @@
|
||||
|
||||
"svgo": ["svgo@2.8.0", "", { "dependencies": { "@trysound/sax": "0.2.0", "commander": "^7.2.0", "css-select": "^4.1.3", "css-tree": "^1.1.3", "csso": "^4.2.0", "picocolors": "^1.0.0", "stable": "^0.1.8" }, "bin": { "svgo": "bin/svgo" } }, "sha512-+N/Q9kV1+F+UeWYoSiULYo4xYSDQlTgb+ayMobAXPwMnLvop7oxKMo9OzIrX5x3eS4L4f2UHhc9axXwY8DpChg=="],
|
||||
|
||||
"symbol-tree": ["symbol-tree@3.2.4", "", {}, "sha512-9QNk5KwDF+Bvz+PyObkmSYjI5ksVUYtjW7AU22r2NKcfLJcXp96hkDWU3+XndOsUb+AQ9QhfzfCT2O+CNWT5Tw=="],
|
||||
|
||||
"system-architecture": ["system-architecture@0.1.0", "", {}, "sha512-ulAk51I9UVUyJgxlv9M6lFot2WP3e7t8Kz9+IS6D4rVba1tR9kON+Ey69f+1R4Q8cd45Lod6a4IcJIxnzGc/zA=="],
|
||||
|
||||
"tailwind-config-viewer": ["tailwind-config-viewer@2.0.4", "", { "dependencies": { "@koa/router": "^12.0.1", "commander": "^6.0.0", "fs-extra": "^9.0.1", "koa": "^2.14.2", "koa-static": "^5.0.0", "open": "^7.0.4", "portfinder": "^1.0.26", "replace-in-file": "^6.1.0" }, "peerDependencies": { "tailwindcss": "1 || 2 || 2.0.1-compat || 3" }, "bin": { "tailwind-config-viewer": "cli/index.js", "tailwindcss-config-viewer": "cli/index.js" } }, "sha512-icvcmdMmt9dphvas8wL40qttrHwAnW3QEN4ExJ2zICjwRsPj7gowd1cOceaWG3IfTuM/cTNGQcx+bsjMtmV+cw=="],
|
||||
@@ -1921,9 +1738,7 @@
|
||||
|
||||
"totalist": ["totalist@3.0.1", "", {}, "sha512-sf4i37nQ2LBx4m3wB74y+ubopq6W/dIzXg0FDGjsYnZHVa1Da8FH853wlL2gtUhg+xJXjfk3kUZS3BRoQeoQBQ=="],
|
||||
|
||||
"tough-cookie": ["tough-cookie@2.5.0", "", { "dependencies": { "psl": "^1.1.28", "punycode": "^2.1.1" } }, "sha512-nlLsUzgm1kfLXSXfRZMc1KLAugd4hqJHDTvc2hDIwS3mZAfMEuMbc03SujMF+GEcpaX/qboeycw6iO8JwVv2+g=="],
|
||||
|
||||
"tr46": ["tr46@1.0.1", "", { "dependencies": { "punycode": "^2.1.0" } }, "sha512-dTpowEjclQ7Kgx5SdBkqRzVhERQXov8/l9Ft9dVM9fmg0W0KQSVaXX9T4i6twCPNtYiZM53lpSSUAwJbFPOHxA=="],
|
||||
"tr46": ["tr46@0.0.3", "", {}, "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw=="],
|
||||
|
||||
"trim-lines": ["trim-lines@3.0.1", "", {}, "sha512-kRj8B+YHZCc9kQYdWfJB2/oUl9rA99qbowYYBtr4ui4mZyAQ2JpvVBd/6U2YloATfqBhBTSMhTpgBHtU0Mf3Rg=="],
|
||||
|
||||
@@ -1937,14 +1752,6 @@
|
||||
|
||||
"tunnel-agent": ["tunnel-agent@0.6.0", "", { "dependencies": { "safe-buffer": "^5.0.1" } }, "sha512-McnNiV1l8RYeY8tBgEpuodCC1mLUdbSN+CYBL7kJsJNInOP8UjDDEwdk6Mw60vdLLrr5NHKZhMAOSrR2NZuQ+w=="],
|
||||
|
||||
"turndown": ["turndown@4.0.2", "", { "dependencies": { "jsdom": "^11.9.0" } }, "sha512-pqZ6WrHFGnxXC9q2xJ3Qa7EoLAwrojgFRajWZjxTKwbz9vnNnyi8lLjiD5h86UTPOcMlEyHjm6NMhjEDdlc25A=="],
|
||||
|
||||
"turndown-plugin-gfm": ["turndown-plugin-gfm@1.0.2", "", {}, "sha512-vwz9tfvF7XN/jE0dGoBei3FXWuvll78ohzCZQuOb+ZjWrs3a0XhQVomJEb2Qh4VHTPNRO4GPZh0V7VRbiWwkRg=="],
|
||||
|
||||
"tweetnacl": ["tweetnacl@0.14.5", "", {}, "sha512-KXXFFdAbFXY4geFIwoyNK+f5Z1b7swfXABfL7HXCmoIWMKU3dmS26672A4EeQtDzLKy7SXmfBu51JolvEKwtGA=="],
|
||||
|
||||
"twemoji": ["twemoji@11.3.0", "", {}, "sha512-xN/vlR6+gDmfjt6LInAqwGAv3Agwrmzx5TD1jEFwKS19IOGDrX0/3OB8GP1wUYPVIdkaer5hw6qd+52jzvz0Lg=="],
|
||||
|
||||
"type-check": ["type-check@0.3.2", "", { "dependencies": { "prelude-ls": "~1.1.2" } }, "sha512-ZCmOJdvOWDBYJlzAoFkC+Q0+bUyEOS1ltgp1MGU03fqHG+dbi9tBFU2Rd9QKiDZFAYrhPh2JUf7rZRIuHRKtOg=="],
|
||||
|
||||
"type-fest": ["type-fest@4.35.0", "", {}, "sha512-2/AwEFQDFEy30iOLjrvHDIH7e4HEWH+f1Yl1bI5XMqzuoCUqwYCdxachgsgv0og/JdVZUhbfjcJAoHj5L1753A=="],
|
||||
@@ -2009,20 +1816,14 @@
|
||||
|
||||
"uqr": ["uqr@0.1.2", "", {}, "sha512-MJu7ypHq6QasgF5YRTjqscSzQp/W11zoUk6kvmlH+fmWEs63Y0Eib13hYFwAzagRJcVY8WVnlV+eBDUGMJ5IbA=="],
|
||||
|
||||
"uri-js": ["uri-js@4.4.1", "", { "dependencies": { "punycode": "^2.1.0" } }, "sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg=="],
|
||||
|
||||
"uri-js-replace": ["uri-js-replace@1.0.1", "", {}, "sha512-W+C9NWNLFOoBI2QWDp4UT9pv65r2w5Cx+3sTYFvtMdDBxkKt1syCqsUdSFAChbEe1uK5TfS04wt/nGwmaeIQ0g=="],
|
||||
|
||||
"urlpattern-polyfill": ["urlpattern-polyfill@8.0.2", "", {}, "sha512-Qp95D4TPJl1kC9SKigDcqgyM2VDVO4RiJc2d4qe5GrYm+zbIQCWWKAFaJNQ4BhdFeDGwBmAxqJBwWSJDb9T3BQ=="],
|
||||
|
||||
"util-deprecate": ["util-deprecate@1.0.2", "", {}, "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw=="],
|
||||
|
||||
"uuid": ["uuid@3.4.0", "", { "bin": { "uuid": "./bin/uuid" } }, "sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A=="],
|
||||
|
||||
"vary": ["vary@1.1.2", "", {}, "sha512-BNGbWLfd0eUPabhkXUVm0j8uuvREyTh5ovRa/dyow/BqAbZJyC+5fU+IzQOzmAKzYqYRAISoRhdQr3eIZ/PXqg=="],
|
||||
|
||||
"verror": ["verror@1.10.0", "", { "dependencies": { "assert-plus": "^1.0.0", "core-util-is": "1.0.2", "extsprintf": "^1.2.0" } }, "sha512-ZZKSmDAEFOijERBLkmYfJ+vmk3w+7hOLYDNkRCuRuMJGEmqYNCNLyBBFwWKVMhfwaEF3WOd0Zlw86U/WC/+nYw=="],
|
||||
|
||||
"vfile": ["vfile@6.0.3", "", { "dependencies": { "@types/unist": "^3.0.0", "vfile-message": "^4.0.0" } }, "sha512-KzIbH/9tXat2u30jf+smMwFCsno4wHVdNmzFyL+T/L3UGqqk6JKfVqOFOZEpZSHADH1k40ab6NUIXZq422ov3Q=="],
|
||||
|
||||
"vfile-location": ["vfile-location@5.0.3", "", { "dependencies": { "@types/unist": "^3.0.0", "vfile": "^6.0.0" } }, "sha512-5yXvWDEgqeiYiBe1lbxYF7UMAIm/IcopxMHrMQDq3nvKcjPKIhZklUKL+AE7J7uApI4kwe2snsK+eI6UTj9EHg=="],
|
||||
@@ -2065,19 +1866,15 @@
|
||||
|
||||
"vue-router": ["vue-router@4.5.0", "", { "dependencies": { "@vue/devtools-api": "^6.6.4" }, "peerDependencies": { "vue": "^3.2.0" } }, "sha512-HDuk+PuH5monfNuY+ct49mNmkCRK4xJAV9Ts4z9UFc4rzdDnxQLyCMGGc8pKhZhHTVzfanpNwB/lwqevcBwI4w=="],
|
||||
|
||||
"w3c-hr-time": ["w3c-hr-time@1.0.2", "", { "dependencies": { "browser-process-hrtime": "^1.0.0" } }, "sha512-z8P5DvDNjKDoFIHK7q8r8lackT6l+jo/Ye3HOle7l9nICP9lf1Ci25fy9vHd0JOWewkIFzXIEig3TdKT7JQ5fQ=="],
|
||||
"w3c-keyname": ["w3c-keyname@2.2.8", "", {}, "sha512-dpojBhNsCNN7T82Tm7k26A6G9ML3NkhDsnw9n/eoxSRlVBB4CEtIQ/KTCLI2Fwf3ataSXRhYFkQi3SlnFwPvPQ=="],
|
||||
|
||||
"web-namespaces": ["web-namespaces@2.0.1", "", {}, "sha512-bKr1DkiNa2krS7qxNtdrtHAmzuYGFQLiQ13TsorsdT6ULTkPLKuu5+GsFpDlg6JFjUTwX2DyhMPG2be8uPrqsQ=="],
|
||||
|
||||
"webidl-conversions": ["webidl-conversions@4.0.2", "", {}, "sha512-YQ+BmxuTgd6UXZW3+ICGfyqRyHXVlD5GtQr5+qjiNW7bF0cqrzX500HVXPBOvgXb5YnzDd+h0zqyv61KUD7+Sg=="],
|
||||
"webidl-conversions": ["webidl-conversions@3.0.1", "", {}, "sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ=="],
|
||||
|
||||
"webpack-virtual-modules": ["webpack-virtual-modules@0.6.2", "", {}, "sha512-66/V2i5hQanC51vBQKPH4aI8NMAcBW59FVBs+rC7eGHupMyfn34q7rZIE+ETlJ+XTevqfUhVVBgSUNSW2flEUQ=="],
|
||||
|
||||
"whatwg-encoding": ["whatwg-encoding@1.0.5", "", { "dependencies": { "iconv-lite": "0.4.24" } }, "sha512-b5lim54JOPN9HtzvK9HFXvBma/rnfFeqsic0hSpjtDbVxR3dJKLc+KB4V6GgiGOvl7CY/KNh8rxSo9DKQrnUEw=="],
|
||||
|
||||
"whatwg-mimetype": ["whatwg-mimetype@2.3.0", "", {}, "sha512-M4yMwr6mAnQz76TbJm914+gPpB/nCwvZbJU28cUD6dR004SAxDLOOSUaB1JDRqLtaOV/vi0IC5lEAGFgrjGv/g=="],
|
||||
|
||||
"whatwg-url": ["whatwg-url@6.5.0", "", { "dependencies": { "lodash.sortby": "^4.7.0", "tr46": "^1.0.1", "webidl-conversions": "^4.0.2" } }, "sha512-rhRZRqx/TLJQWUpQ6bmrt2UV4f0HCQ463yQuONJqC6fO2VoEb1pTYddbe59SkYq87aoM5A3bdhMZiUiVws+fzQ=="],
|
||||
"whatwg-url": ["whatwg-url@5.0.0", "", { "dependencies": { "tr46": "~0.0.3", "webidl-conversions": "^3.0.0" } }, "sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw=="],
|
||||
|
||||
"which": ["which@3.0.1", "", { "dependencies": { "isexe": "^2.0.0" }, "bin": { "node-which": "bin/which.js" } }, "sha512-XA1b62dzQzLfaEOSQFTCOd5KFf/1VSzZo7/7TUjnya6u0vGGKzU96UQBZTAThCb2j4/xjBAyii1OhRLJEivHvg=="],
|
||||
|
||||
@@ -2091,8 +1888,6 @@
|
||||
|
||||
"ws": ["ws@8.18.0", "", { "peerDependencies": { "bufferutil": "^4.0.1", "utf-8-validate": ">=5.0.2" }, "optionalPeers": ["bufferutil", "utf-8-validate"] }, "sha512-8VbfWfHLbbwu3+N6OKsOMpBdT4kXPDDB9cJk2bJ6mh9ucxdlnNvH1e+roYkKmN9Nxw2yjz7VzeO9oOz2zJ04Pw=="],
|
||||
|
||||
"xml-name-validator": ["xml-name-validator@3.0.0", "", {}, "sha512-A5CUptxDsvxKJEU3yO6DuWBSJz/qizqzJKOMIfUJHETbBw/sFaDxgd6fxm1ewUaM0jZ444Fc5vC5ROYurg/4Pw=="],
|
||||
|
||||
"xss": ["xss@1.0.15", "", { "dependencies": { "commander": "^2.20.3", "cssfilter": "0.0.10" }, "bin": { "xss": "bin/xss" } }, "sha512-FVdlVVC67WOIPvfOwhoMETV72f6GbW7aOabBC3WxN/oUdoEMDyLz4OgRv5/gck2ZeNqEQu+Tb0kloovXOfpYVg=="],
|
||||
|
||||
"y18n": ["y18n@5.0.8", "", {}, "sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA=="],
|
||||
@@ -2195,10 +1990,6 @@
|
||||
|
||||
"@vue/compiler-sfc/estree-walker": ["estree-walker@2.0.2", "", {}, "sha512-Rfkk/Mp/DL7JVje3u18FxFujQlTNR2q6QfMSMB7AvCBx91NGj/ba3kCfza0f6dVDbw7YlRf/nDrn7pQrCCyQ/w=="],
|
||||
|
||||
"acorn-globals/acorn": ["acorn@6.4.2", "", { "bin": { "acorn": "bin/acorn" } }, "sha512-XtGIhXwF8YM8bJhGxG5kXgjkEuNGLTkoYqVE+KMR+aspr4KGYmKYg7yUe3KghyQ9yheNwLnjmzh/7+gfDBmHCQ=="],
|
||||
|
||||
"ajv/json-schema-traverse": ["json-schema-traverse@0.4.1", "", {}, "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg=="],
|
||||
|
||||
"ansi-escapes/type-fest": ["type-fest@0.21.3", "", {}, "sha512-t0rzBq87m3fVcduHDUFhKmyyX+9eo6WQjZvf51Ea/M0Q7+T374Jp1aUiyUl0GKxp8M/OETVHSDvmkyPgvX+X2w=="],
|
||||
|
||||
"anymatch/picomatch": ["picomatch@2.3.1", "", {}, "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA=="],
|
||||
@@ -2237,12 +2028,6 @@
|
||||
|
||||
"cssnano/yaml": ["yaml@1.10.2", "", {}, "sha512-r3vXyErRCYJ7wg28yvBY5VSoAF8ZvlcW9/BwUzEtUsjvX/DKs24dIkuwjtuprwJJHsbyUbLApepYTR1BN4uHrg=="],
|
||||
|
||||
"d3-dsv/commander": ["commander@7.2.0", "", {}, "sha512-QrWXB+ZQSVPmIWIhtEO9H+gwHaMGYiF5ChvoJ+K9ZGHG/sVsa6yiesAD1GC/x46sET00Xlwo1u49RVVVzvcSkw=="],
|
||||
|
||||
"dagre-d3/d3": ["d3@5.16.0", "", { "dependencies": { "d3-array": "1", "d3-axis": "1", "d3-brush": "1", "d3-chord": "1", "d3-collection": "1", "d3-color": "1", "d3-contour": "1", "d3-dispatch": "1", "d3-drag": "1", "d3-dsv": "1", "d3-ease": "1", "d3-fetch": "1", "d3-force": "1", "d3-format": "1", "d3-geo": "1", "d3-hierarchy": "1", "d3-interpolate": "1", "d3-path": "1", "d3-polygon": "1", "d3-quadtree": "1", "d3-random": "1", "d3-scale": "2", "d3-scale-chromatic": "1", "d3-selection": "1", "d3-shape": "1", "d3-time": "1", "d3-time-format": "2", "d3-timer": "1", "d3-transition": "1", "d3-voronoi": "1", "d3-zoom": "1" } }, "sha512-4PL5hHaHwX4m7Zr1UapXW23apo6pexCgdetdJ5kTmADpG/7T9Gkxw0M0tf/pjoB63ezCCm0u5UaFYy2aMt0Mcw=="],
|
||||
|
||||
"data-urls/whatwg-url": ["whatwg-url@7.1.0", "", { "dependencies": { "lodash.sortby": "^4.7.0", "tr46": "^1.0.1", "webidl-conversions": "^4.0.2" } }, "sha512-WUu7Rg1DroM7oQvGWfOiAK21n74Gg+T4elXEQYkOhtyLeWiJFoOGLXPKI/9gzIie9CtwVLm8wtw6YJdKyxSjeg=="],
|
||||
|
||||
"dom-serializer/entities": ["entities@2.2.0", "", {}, "sha512-p92if5Nz619I0w+akJrLZH0MX0Pb5DX39XOwQTtXSdQQOaYH03S1uIQp4mhOZtAXrxq4ViO67YTiLBo2638o9A=="],
|
||||
|
||||
"execa/@sindresorhus/merge-streams": ["@sindresorhus/merge-streams@4.0.0", "", {}, "sha512-tlqY9xq5ukxTUZBmoOp+m61cqwQD5pHJtFY3Mn8CA8ps6yghLH/Hw8UPdqg4OLmFW3IFlcXnQNmo/dh8HzXYIQ=="],
|
||||
@@ -2263,14 +2048,6 @@
|
||||
|
||||
"is-wsl/is-docker": ["is-docker@2.2.1", "", { "bin": { "is-docker": "cli.js" } }, "sha512-F+i2BKsFrH66iaUFc0woD8sLy8getkwTwtOBjvs56Cx4CgJDeKQeqfz8wAYiSb8JOprWhHH5p77PbmYCvvUuXQ=="],
|
||||
|
||||
"jsdom/acorn": ["acorn@5.7.4", "", { "bin": { "acorn": "bin/acorn" } }, "sha512-1D++VG7BhrtvQpNbBzovKNc1FLGGEE/oGe7b9xJm/RFHMBeUaUGpluV9RLjZa47YFdPcDAenEYuq9pQPcMdLJg=="],
|
||||
|
||||
"jsdom/parse5": ["parse5@4.0.0", "", {}, "sha512-VrZ7eOd3T1Fk4XWNXMgiGBK/z0MG48BWG2uQNU4I72fkQuKUTZpl+u9k+CxEG0twMVzSmXEEz12z5Fnw1jIQFA=="],
|
||||
|
||||
"jsdom/ws": ["ws@5.2.4", "", { "dependencies": { "async-limiter": "~1.0.0" } }, "sha512-fFCejsuC8f9kOSu9FYaOw8CdO68O3h5v0lg4p74o8JqWpwTf9tniOD+nOB78aWoVSS6WptVUmDrp/KPsMVBWFQ=="],
|
||||
|
||||
"katex/commander": ["commander@2.20.3", "", {}, "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ=="],
|
||||
|
||||
"koa/http-errors": ["http-errors@1.8.1", "", { "dependencies": { "depd": "~1.1.2", "inherits": "2.0.4", "setprototypeof": "1.2.0", "statuses": ">= 1.5.0 < 2", "toidentifier": "1.0.1" } }, "sha512-Kpk9Sm7NmI+RHhnj6OIWDI1d6fIoFAtFt9RLaTMRlg/8w49juAStsrBgp0Dp4OdxdVbRIeKhtCUvoi/RuAhO4g=="],
|
||||
|
||||
"koa-send/http-errors": ["http-errors@1.8.1", "", { "dependencies": { "depd": "~1.1.2", "inherits": "2.0.4", "setprototypeof": "1.2.0", "statuses": ">= 1.5.0 < 2", "toidentifier": "1.0.1" } }, "sha512-Kpk9Sm7NmI+RHhnj6OIWDI1d6fIoFAtFt9RLaTMRlg/8w49juAStsrBgp0Dp4OdxdVbRIeKhtCUvoi/RuAhO4g=="],
|
||||
@@ -2293,8 +2070,6 @@
|
||||
|
||||
"nitropack/unimport": ["unimport@3.14.6", "", { "dependencies": { "@rollup/pluginutils": "^5.1.4", "acorn": "^8.14.0", "escape-string-regexp": "^5.0.0", "estree-walker": "^3.0.3", "fast-glob": "^3.3.3", "local-pkg": "^1.0.0", "magic-string": "^0.30.17", "mlly": "^1.7.4", "pathe": "^2.0.1", "picomatch": "^4.0.2", "pkg-types": "^1.3.0", "scule": "^1.3.0", "strip-literal": "^2.1.1", "unplugin": "^1.16.1" } }, "sha512-CYvbDaTT04Rh8bmD8jz3WPmHYZRG/NnvYVzwD6V1YAlvvKROlAeNDUBhkBGzNav2RKaeuXvlWYaa1V4Lfi/O0g=="],
|
||||
|
||||
"node-fetch/whatwg-url": ["whatwg-url@5.0.0", "", { "dependencies": { "tr46": "~0.0.3", "webidl-conversions": "^3.0.0" } }, "sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw=="],
|
||||
|
||||
"npm-run-path/path-key": ["path-key@4.0.0", "", {}, "sha512-haREypq7xkM7ErfgIyA0z+Bj4AGKlMSdlQE2jvJo6huWD1EdkKYV+G/T4nq0YEF2vgTT8kqMFKo1uHn950r4SQ=="],
|
||||
|
||||
"nuxt/chokidar": ["chokidar@4.0.3", "", { "dependencies": { "readdirp": "^4.0.1" } }, "sha512-Qgzu8kfBvo+cA4962jnP1KkS6Dop5NS6g7R5LFYJr4b8Ub94PPQXUksCw9PvXoeXPRRddRNC5C1JQUR2SMGtnA=="],
|
||||
@@ -2347,8 +2122,6 @@
|
||||
|
||||
"replace-in-file/chalk": ["chalk@4.1.2", "", { "dependencies": { "ansi-styles": "^4.1.0", "supports-color": "^7.1.0" } }, "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA=="],
|
||||
|
||||
"request/safe-buffer": ["safe-buffer@5.2.1", "", {}, "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ=="],
|
||||
|
||||
"resolve-path/http-errors": ["http-errors@1.6.3", "", { "dependencies": { "depd": "~1.1.2", "inherits": "2.0.3", "setprototypeof": "1.1.0", "statuses": ">= 1.4.0 < 2" } }, "sha512-lks+lVC8dgGyh97jxvxeYTWQFvh4uw4yC12gVl63Cg30sjPX4wuGcdkICVXDAESr6OJGjqGA8Iz5mkeN6zlD7A=="],
|
||||
|
||||
"rimraf/glob": ["glob@10.4.5", "", { "dependencies": { "foreground-child": "^3.1.0", "jackspeak": "^3.1.2", "minimatch": "^9.0.4", "minipass": "^7.1.2", "package-json-from-dist": "^1.0.0", "path-scurry": "^1.11.1" }, "bin": { "glob": "dist/esm/bin.mjs" } }, "sha512-7Bv8RF0k6xjo7d4A/PxYLbUCfb6c+Vpd2/mB2yRDlew7Jb5hEXiCD9ibfO7wpk8i4sevK6DFny9h7EYbM3/sHg=="],
|
||||
@@ -2411,8 +2184,6 @@
|
||||
|
||||
"unwasm/unplugin": ["unplugin@1.16.1", "", { "dependencies": { "acorn": "^8.14.0", "webpack-virtual-modules": "^0.6.2" } }, "sha512-4/u/j4FrCKdi17jaxuJA0jClGxB1AvU2hw/IuayPc4ay1XGaJs/rbb4v5WKwAjNifjmXK9PIFyuPiaK8azyR9w=="],
|
||||
|
||||
"verror/core-util-is": ["core-util-is@1.0.2", "", {}, "sha512-3lqz5YjWTYnW6dlDa5TLaTCcShfar1e40rmcJVwCBJC6mWlFuj0eCHIElmG1g5kyuJ/GD+8Wn4FFCcz4gJPfaQ=="],
|
||||
|
||||
"vite/esbuild": ["esbuild@0.24.2", "", { "optionalDependencies": { "@esbuild/aix-ppc64": "0.24.2", "@esbuild/android-arm": "0.24.2", "@esbuild/android-arm64": "0.24.2", "@esbuild/android-x64": "0.24.2", "@esbuild/darwin-arm64": "0.24.2", "@esbuild/darwin-x64": "0.24.2", "@esbuild/freebsd-arm64": "0.24.2", "@esbuild/freebsd-x64": "0.24.2", "@esbuild/linux-arm": "0.24.2", "@esbuild/linux-arm64": "0.24.2", "@esbuild/linux-ia32": "0.24.2", "@esbuild/linux-loong64": "0.24.2", "@esbuild/linux-mips64el": "0.24.2", "@esbuild/linux-ppc64": "0.24.2", "@esbuild/linux-riscv64": "0.24.2", "@esbuild/linux-s390x": "0.24.2", "@esbuild/linux-x64": "0.24.2", "@esbuild/netbsd-arm64": "0.24.2", "@esbuild/netbsd-x64": "0.24.2", "@esbuild/openbsd-arm64": "0.24.2", "@esbuild/openbsd-x64": "0.24.2", "@esbuild/sunos-x64": "0.24.2", "@esbuild/win32-arm64": "0.24.2", "@esbuild/win32-ia32": "0.24.2", "@esbuild/win32-x64": "0.24.2" }, "bin": { "esbuild": "bin/esbuild" } }, "sha512-+9egpBW8I3CD5XPe0n6BfT5fxLzxrlDzqydF3aviG+9ni1lDC/OvMHcxqEFV0+LANZG5R1bFMWfUrjVsdwxJvA=="],
|
||||
|
||||
"vite-node/pathe": ["pathe@2.0.3", "", {}, "sha512-WUjGcAqP1gQacoQe+OBJsFA7Ld4DyXuUIjZ5cc75cLHvJ7dtNsTugphxIADwspS+AraAUePCKrSVtPLFj/F88w=="],
|
||||
@@ -2429,8 +2200,6 @@
|
||||
|
||||
"vite-plugin-inspect/open": ["open@10.1.0", "", { "dependencies": { "default-browser": "^5.2.1", "define-lazy-prop": "^3.0.0", "is-inside-container": "^1.0.0", "is-wsl": "^3.1.0" } }, "sha512-mnkeQ1qP5Ue2wd+aivTD3NHd/lZ96Lu0jgf0pwktLPtx6cTZiH7tyeGRRHs0zX0rbrahXPnXlUnbeXyaBBuIaw=="],
|
||||
|
||||
"whatwg-encoding/iconv-lite": ["iconv-lite@0.4.24", "", { "dependencies": { "safer-buffer": ">= 2.1.2 < 3" } }, "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA=="],
|
||||
|
||||
"xss/commander": ["commander@2.20.3", "", {}, "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ=="],
|
||||
|
||||
"@babel/helper-compilation-targets/lru-cache/yallist": ["yallist@3.1.1", "", {}, "sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g=="],
|
||||
@@ -2595,64 +2364,6 @@
|
||||
|
||||
"clipboardy/execa/strip-final-newline": ["strip-final-newline@3.0.0", "", {}, "sha512-dOESqjYr96iWYylGObzd39EuNTa5VJxyvVAEm5Jnh7KGo75V43Hk1odPQkNDyXNmUR6k+gEiDVXnjB8HJ3crXw=="],
|
||||
|
||||
"dagre-d3/d3/d3-array": ["d3-array@1.2.4", "", {}, "sha512-KHW6M86R+FUPYGb3R5XiYjXPq7VzwxZ22buHhAEVG5ztoEcZZMLov530mmccaqA1GghZArjQV46fuc8kUqhhHw=="],
|
||||
|
||||
"dagre-d3/d3/d3-axis": ["d3-axis@1.0.12", "", {}, "sha512-ejINPfPSNdGFKEOAtnBtdkpr24c4d4jsei6Lg98mxf424ivoDP2956/5HDpIAtmHo85lqT4pruy+zEgvRUBqaQ=="],
|
||||
|
||||
"dagre-d3/d3/d3-brush": ["d3-brush@1.1.6", "", { "dependencies": { "d3-dispatch": "1", "d3-drag": "1", "d3-interpolate": "1", "d3-selection": "1", "d3-transition": "1" } }, "sha512-7RW+w7HfMCPyZLifTz/UnJmI5kdkXtpCbombUSs8xniAyo0vIbrDzDwUJB6eJOgl9u5DQOt2TQlYumxzD1SvYA=="],
|
||||
|
||||
"dagre-d3/d3/d3-chord": ["d3-chord@1.0.6", "", { "dependencies": { "d3-array": "1", "d3-path": "1" } }, "sha512-JXA2Dro1Fxw9rJe33Uv+Ckr5IrAa74TlfDEhE/jfLOaXegMQFQTAgAw9WnZL8+HxVBRXaRGCkrNU7pJeylRIuA=="],
|
||||
|
||||
"dagre-d3/d3/d3-color": ["d3-color@1.4.1", "", {}, "sha512-p2sTHSLCJI2QKunbGb7ocOh7DgTAn8IrLx21QRc/BSnodXM4sv6aLQlnfpvehFMLZEfBc6g9pH9SWQccFYfJ9Q=="],
|
||||
|
||||
"dagre-d3/d3/d3-contour": ["d3-contour@1.3.2", "", { "dependencies": { "d3-array": "^1.1.1" } }, "sha512-hoPp4K/rJCu0ladiH6zmJUEz6+u3lgR+GSm/QdM2BBvDraU39Vr7YdDCicJcxP1z8i9B/2dJLgDC1NcvlF8WCg=="],
|
||||
|
||||
"dagre-d3/d3/d3-dispatch": ["d3-dispatch@1.0.6", "", {}, "sha512-fVjoElzjhCEy+Hbn8KygnmMS7Or0a9sI2UzGwoB7cCtvI1XpVN9GpoYlnb3xt2YV66oXYb1fLJ8GMvP4hdU1RA=="],
|
||||
|
||||
"dagre-d3/d3/d3-drag": ["d3-drag@1.2.5", "", { "dependencies": { "d3-dispatch": "1", "d3-selection": "1" } }, "sha512-rD1ohlkKQwMZYkQlYVCrSFxsWPzI97+W+PaEIBNTMxRuxz9RF0Hi5nJWHGVJ3Om9d2fRTe1yOBINJyy/ahV95w=="],
|
||||
|
||||
"dagre-d3/d3/d3-dsv": ["d3-dsv@1.2.0", "", { "dependencies": { "commander": "2", "iconv-lite": "0.4", "rw": "1" }, "bin": { "csv2json": "bin/dsv2json", "csv2tsv": "bin/dsv2dsv", "dsv2dsv": "bin/dsv2dsv", "dsv2json": "bin/dsv2json", "json2csv": "bin/json2dsv", "json2dsv": "bin/json2dsv", "json2tsv": "bin/json2dsv", "tsv2csv": "bin/dsv2dsv", "tsv2json": "bin/dsv2json" } }, "sha512-9yVlqvZcSOMhCYzniHE7EVUws7Fa1zgw+/EAV2BxJoG3ME19V6BQFBwI855XQDsxyOuG7NibqRMTtiF/Qup46g=="],
|
||||
|
||||
"dagre-d3/d3/d3-ease": ["d3-ease@1.0.7", "", {}, "sha512-lx14ZPYkhNx0s/2HX5sLFUI3mbasHjSSpwO/KaaNACweVwxUruKyWVcb293wMv1RqTPZyZ8kSZ2NogUZNcLOFQ=="],
|
||||
|
||||
"dagre-d3/d3/d3-fetch": ["d3-fetch@1.2.0", "", { "dependencies": { "d3-dsv": "1" } }, "sha512-yC78NBVcd2zFAyR/HnUiBS7Lf6inSCoWcSxFfw8FYL7ydiqe80SazNwoffcqOfs95XaLo7yebsmQqDKSsXUtvA=="],
|
||||
|
||||
"dagre-d3/d3/d3-force": ["d3-force@1.2.1", "", { "dependencies": { "d3-collection": "1", "d3-dispatch": "1", "d3-quadtree": "1", "d3-timer": "1" } }, "sha512-HHvehyaiUlVo5CxBJ0yF/xny4xoaxFxDnBXNvNcfW9adORGZfyNF1dj6DGLKyk4Yh3brP/1h3rnDzdIAwL08zg=="],
|
||||
|
||||
"dagre-d3/d3/d3-format": ["d3-format@1.4.5", "", {}, "sha512-J0piedu6Z8iB6TbIGfZgDzfXxUFN3qQRMofy2oPdXzQibYGqPB/9iMcxr/TGalU+2RsyDO+U4f33id8tbnSRMQ=="],
|
||||
|
||||
"dagre-d3/d3/d3-geo": ["d3-geo@1.12.1", "", { "dependencies": { "d3-array": "1" } }, "sha512-XG4d1c/UJSEX9NfU02KwBL6BYPj8YKHxgBEw5om2ZnTRSbIcego6dhHwcxuSR3clxh0EpE38os1DVPOmnYtTPg=="],
|
||||
|
||||
"dagre-d3/d3/d3-hierarchy": ["d3-hierarchy@1.1.9", "", {}, "sha512-j8tPxlqh1srJHAtxfvOUwKNYJkQuBFdM1+JAUfq6xqH5eAqf93L7oG1NVqDa4CpFZNvnNKtCYEUC8KY9yEn9lQ=="],
|
||||
|
||||
"dagre-d3/d3/d3-interpolate": ["d3-interpolate@1.4.0", "", { "dependencies": { "d3-color": "1" } }, "sha512-V9znK0zc3jOPV4VD2zZn0sDhZU3WAE2bmlxdIwwQPPzPjvyLkd8B3JUVdS1IDUFDkWZ72c9qnv1GK2ZagTZ8EA=="],
|
||||
|
||||
"dagre-d3/d3/d3-path": ["d3-path@1.0.9", "", {}, "sha512-VLaYcn81dtHVTjEHd8B+pbe9yHWpXKZUC87PzoFmsFrJqgFwDe/qxfp5MlfsfM1V5E/iVt0MmEbWQ7FVIXh/bg=="],
|
||||
|
||||
"dagre-d3/d3/d3-polygon": ["d3-polygon@1.0.6", "", {}, "sha512-k+RF7WvI08PC8reEoXa/w2nSg5AUMTi+peBD9cmFc+0ixHfbs4QmxxkarVal1IkVkgxVuk9JSHhJURHiyHKAuQ=="],
|
||||
|
||||
"dagre-d3/d3/d3-quadtree": ["d3-quadtree@1.0.7", "", {}, "sha512-RKPAeXnkC59IDGD0Wu5mANy0Q2V28L+fNe65pOCXVdVuTJS3WPKaJlFHer32Rbh9gIo9qMuJXio8ra4+YmIymA=="],
|
||||
|
||||
"dagre-d3/d3/d3-random": ["d3-random@1.1.2", "", {}, "sha512-6AK5BNpIFqP+cx/sreKzNjWbwZQCSUatxq+pPRmFIQaWuoD+NrbVWw7YWpHiXpCQ/NanKdtGDuB+VQcZDaEmYQ=="],
|
||||
|
||||
"dagre-d3/d3/d3-scale": ["d3-scale@2.2.2", "", { "dependencies": { "d3-array": "^1.2.0", "d3-collection": "1", "d3-format": "1", "d3-interpolate": "1", "d3-time": "1", "d3-time-format": "2" } }, "sha512-LbeEvGgIb8UMcAa0EATLNX0lelKWGYDQiPdHj+gLblGVhGLyNbaCn3EvrJf0A3Y/uOOU5aD6MTh5ZFCdEwGiCw=="],
|
||||
|
||||
"dagre-d3/d3/d3-scale-chromatic": ["d3-scale-chromatic@1.5.0", "", { "dependencies": { "d3-color": "1", "d3-interpolate": "1" } }, "sha512-ACcL46DYImpRFMBcpk9HhtIyC7bTBR4fNOPxwVSl0LfulDAwyiHyPOTqcDG1+t5d4P9W7t/2NAuWu59aKko/cg=="],
|
||||
|
||||
"dagre-d3/d3/d3-selection": ["d3-selection@1.4.2", "", {}, "sha512-SJ0BqYihzOjDnnlfyeHT0e30k0K1+5sR3d5fNueCNeuhZTnGw4M4o8mqJchSwgKMXCNFo+e2VTChiSJ0vYtXkg=="],
|
||||
|
||||
"dagre-d3/d3/d3-shape": ["d3-shape@1.3.7", "", { "dependencies": { "d3-path": "1" } }, "sha512-EUkvKjqPFUAZyOlhY5gzCxCeI0Aep04LwIRpsZ/mLFelJiUfnK56jo5JMDSE7yyP2kLSb6LtF+S5chMk7uqPqw=="],
|
||||
|
||||
"dagre-d3/d3/d3-time": ["d3-time@1.1.0", "", {}, "sha512-Xh0isrZ5rPYYdqhAVk8VLnMEidhz5aP7htAADH6MfzgmmicPkTo8LhkLxci61/lCB7n7UmE3bN0leRt+qvkLxA=="],
|
||||
|
||||
"dagre-d3/d3/d3-time-format": ["d3-time-format@2.3.0", "", { "dependencies": { "d3-time": "1" } }, "sha512-guv6b2H37s2Uq/GefleCDtbe0XZAuy7Wa49VGkPVPMfLL9qObgBST3lEHJBMUp8S7NdLQAGIvr2KXk8Hc98iKQ=="],
|
||||
|
||||
"dagre-d3/d3/d3-timer": ["d3-timer@1.0.10", "", {}, "sha512-B1JDm0XDaQC+uvo4DT79H0XmBskgS3l6Ve+1SBCfxgmtIb1AVrPIoqd+nPSv+loMX8szQ0sVUhGngL7D5QPiXw=="],
|
||||
|
||||
"dagre-d3/d3/d3-transition": ["d3-transition@1.3.2", "", { "dependencies": { "d3-color": "1", "d3-dispatch": "1", "d3-ease": "1", "d3-interpolate": "1", "d3-selection": "^1.1.0", "d3-timer": "1" } }, "sha512-sc0gRU4PFqZ47lPVHloMn9tlPcv8jxgOQg+0zjhfZXMQuvppjG6YuwdMBE0TuqCZjeJkLecku/l9R0JPcRhaDA=="],
|
||||
|
||||
"dagre-d3/d3/d3-zoom": ["d3-zoom@1.8.3", "", { "dependencies": { "d3-dispatch": "1", "d3-drag": "1", "d3-interpolate": "1", "d3-selection": "1", "d3-transition": "1" } }, "sha512-VoLXTK4wvy1a0JpH2Il+F2CiOhVu7VRXWF5M/LroMIh3/zBAC3WAt7QoIvPibOavVo20hN6/37vwAsdBejLyKQ=="],
|
||||
|
||||
"http-assert/http-errors/depd": ["depd@1.1.2", "", {}, "sha512-7emPTl6Dpo6JRXOXjLRxck+FlLRX5847cLKEn00PLAgc3g2hTZZgr+e4c2v6QpSmLeFP3n5yUo7ft6avBK/5jQ=="],
|
||||
|
||||
"koa-send/http-errors/depd": ["depd@1.1.2", "", {}, "sha512-7emPTl6Dpo6JRXOXjLRxck+FlLRX5847cLKEn00PLAgc3g2hTZZgr+e4c2v6QpSmLeFP3n5yUo7ft6avBK/5jQ=="],
|
||||
@@ -2715,10 +2426,6 @@
|
||||
|
||||
"nitropack/unimport/unplugin": ["unplugin@1.16.1", "", { "dependencies": { "acorn": "^8.14.0", "webpack-virtual-modules": "^0.6.2" } }, "sha512-4/u/j4FrCKdi17jaxuJA0jClGxB1AvU2hw/IuayPc4ay1XGaJs/rbb4v5WKwAjNifjmXK9PIFyuPiaK8azyR9w=="],
|
||||
|
||||
"node-fetch/whatwg-url/tr46": ["tr46@0.0.3", "", {}, "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw=="],
|
||||
|
||||
"node-fetch/whatwg-url/webidl-conversions": ["webidl-conversions@3.0.1", "", {}, "sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ=="],
|
||||
|
||||
"nuxt/chokidar/readdirp": ["readdirp@4.1.2", "", {}, "sha512-GDhwkLfywWL2s6vEjyhri+eXmfH6j1L7JE27WhqLeYzoh/A3DBaYGEj2H/HFZCn/kMfim73FXxEJTw06WtxQwg=="],
|
||||
|
||||
"nuxt/esbuild/@esbuild/aix-ppc64": ["@esbuild/aix-ppc64@0.24.2", "", { "os": "aix", "cpu": "ppc64" }, "sha512-thpVCb/rhxE/BnMLQ7GReQLLN8q9qbHmI55F4489/ByVg2aQaQ6kbcLb6FHkocZzQhxc4gx0sCk0tJkKBFzDhA=="],
|
||||
@@ -2905,10 +2612,6 @@
|
||||
|
||||
"clipboardy/execa/npm-run-path/path-key": ["path-key@4.0.0", "", {}, "sha512-haREypq7xkM7ErfgIyA0z+Bj4AGKlMSdlQE2jvJo6huWD1EdkKYV+G/T4nq0YEF2vgTT8kqMFKo1uHn950r4SQ=="],
|
||||
|
||||
"dagre-d3/d3/d3-dsv/commander": ["commander@2.20.3", "", {}, "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ=="],
|
||||
|
||||
"dagre-d3/d3/d3-dsv/iconv-lite": ["iconv-lite@0.4.24", "", { "dependencies": { "safer-buffer": ">= 2.1.2 < 3" } }, "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA=="],
|
||||
|
||||
"nitropack/c12/chokidar/readdirp": ["readdirp@4.1.2", "", {}, "sha512-GDhwkLfywWL2s6vEjyhri+eXmfH6j1L7JE27WhqLeYzoh/A3DBaYGEj2H/HFZCn/kMfim73FXxEJTw06WtxQwg=="],
|
||||
|
||||
"rimraf/glob/minimatch/brace-expansion": ["brace-expansion@2.0.1", "", { "dependencies": { "balanced-match": "^1.0.0" } }, "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA=="],
|
||||
|
||||
@@ -29,12 +29,6 @@ type EdgeEditor = InstanceType<typeof CanvasEdgeEditor>;
|
||||
|
||||
const cancelEvent = (e: Event) => e.preventDefault();
|
||||
const stopPropagation = (e: Event) => e.stopImmediatePropagation();
|
||||
function getID(length: number)
|
||||
{
|
||||
for (var id = [], i = 0; i < length; i++)
|
||||
id.push((16 * Math.random() | 0).toString(16));
|
||||
return id.join("");
|
||||
}
|
||||
function center(touches: TouchList): Position
|
||||
{
|
||||
const pos = { x: 0, y: 0 };
|
||||
@@ -58,7 +52,7 @@ function distance(touches: TouchList): number
|
||||
|
||||
<script setup lang="ts">
|
||||
import { Icon } from '@iconify/vue/dist/iconify.js';
|
||||
import { clamp } from '#shared/general.util';
|
||||
import { clamp, getID, ID_SIZE } from '#shared/general.util';
|
||||
import type { CanvasContent, CanvasEdge, CanvasNode } from '~/types/canvas';
|
||||
|
||||
const canvas = defineModel<CanvasContent>({ required: true });
|
||||
@@ -75,12 +69,11 @@ const hints = ref<SnapHint[]>([]);
|
||||
const viewport = computed<Box>(() => {
|
||||
const width = viewportSize.width.value / zoom.value, height = viewportSize.height.value / zoom.value;
|
||||
const movementX = viewportSize.width.value - width, movementY = viewportSize.height.value - height;
|
||||
return { x: -dispX.value + movementX / 2, y: -dispY.value + movementY / 2, w: width, h: height };
|
||||
return { x: -dispX.value + movementX / 2, y: -dispY.value + movementY / 2, width, height };
|
||||
});
|
||||
const updateScaleVar = useDebounceFn(() => {
|
||||
if(transformRef.value)
|
||||
{
|
||||
console.log(zoom.value);
|
||||
transformRef.value.style.setProperty('--tw-scale', zoom.value.toString());
|
||||
}
|
||||
if(canvasRef.value)
|
||||
@@ -100,10 +93,19 @@ const historyPos = ref(-1);
|
||||
const historyCursor = computed(() => history.value.length > 0 && historyPos.value > -1 ? history.value[historyPos.value] : undefined);
|
||||
|
||||
watch(props, () => {
|
||||
snapFinder = new SnapFinder(hints, viewport, { gridSize: 512, preferences: canvasSettings.value, threshold: 16, cellSize: 64 })
|
||||
canvas.value.nodes?.forEach((e) => snapFinder.update(e));
|
||||
snapFinder = new SnapFinder(hints, viewport, { gridSize: 512, preferences: canvasSettings.value, threshold: 16, cellSize: 64 });
|
||||
|
||||
canvas.value.nodes?.forEach((e) => {
|
||||
snapFinder.update(e);
|
||||
});
|
||||
|
||||
focusing.value = undefined;
|
||||
editing.value = undefined;
|
||||
|
||||
dispX.value = 0;
|
||||
dispY.value = 0;
|
||||
zoom.value = 0.5;
|
||||
|
||||
history.value = [];
|
||||
historyPos.value = -1;
|
||||
fakeEdge.value = {};
|
||||
@@ -334,11 +336,10 @@ function edit(element: Element)
|
||||
}
|
||||
function createNode(e: MouseEvent)
|
||||
{
|
||||
let box = canvasRef.value?.getBoundingClientRect()!;
|
||||
const width = 250, height = 100;
|
||||
const x = (e.layerX / zoom.value) - dispX.value - (width / 2);
|
||||
const y = (e.layerY / zoom.value) - dispY.value - (height / 2);
|
||||
const node: CanvasNode = { id: getID(16), x, y, width, height, type: 'text' };
|
||||
const x = e.layerX / zoom.value - dispX.value - width / 2;
|
||||
const y = e.layerY / zoom.value - dispY.value - height / 2;
|
||||
const node: CanvasNode = { id: getID(ID_SIZE), x, y, width, height, type: 'text' };
|
||||
|
||||
if(!canvas.value.nodes)
|
||||
canvas.value.nodes = [node];
|
||||
@@ -404,7 +405,7 @@ function dragEndEdgeTo(e: MouseEvent): void
|
||||
if(fakeEdge.value.snapped)
|
||||
{
|
||||
const node = canvas.value.nodes!.find(e => e.id === fakeEdge.value.drag!.id)!;
|
||||
const edge: CanvasEdge = { fromNode: fakeEdge.value.drag!.id, fromSide: fakeEdge.value.fromSide!, toNode: fakeEdge.value.snapped.node, toSide: fakeEdge.value.snapped.side, id: getID(16), color: node.color };
|
||||
const edge: CanvasEdge = { fromNode: fakeEdge.value.drag!.id, fromSide: fakeEdge.value.fromSide!, toNode: fakeEdge.value.snapped.node, toSide: fakeEdge.value.snapped.side, id: getID(ID_SIZE), color: node.color };
|
||||
canvas.value.edges?.push(edge);
|
||||
|
||||
addAction('create', [{ from: undefined, to: edge, element: { id: edge.id, type: 'edge' } }]);
|
||||
|
||||
@@ -1,134 +0,0 @@
|
||||
<script lang="ts">
|
||||
import type { Editor, EditorConfiguration, EditorChange } from 'codemirror';
|
||||
import { fromTextArea } from 'hypermd';
|
||||
|
||||
import '#shared/hypermd.extend';
|
||||
</script>
|
||||
|
||||
<script setup lang="ts">
|
||||
const { placeholder, autofocus = false, gutters = true, format = 'd-any' } = defineProps<{
|
||||
placeholder?: string
|
||||
autofocus?: boolean
|
||||
gutters?: boolean
|
||||
format?: 'hypermd' | 'd-any'
|
||||
}>();
|
||||
const model = defineModel<string>();
|
||||
const editor = ref<Editor>();
|
||||
|
||||
const input = useTemplateRef('input');
|
||||
|
||||
onMounted(() => {
|
||||
if(input.value)
|
||||
{
|
||||
const e = editor.value = fromTextArea(input.value, {
|
||||
mode: {
|
||||
name: format,
|
||||
hashtag: true,
|
||||
toc: false,
|
||||
math: false,
|
||||
orgModeMarkup: false,
|
||||
tokenTypeOverrides: {
|
||||
hr: "line-HyperMD-hr line-background-HyperMD-hr-bg hr",
|
||||
list1: "list-1",
|
||||
list2: "list-2",
|
||||
list3: "list-3",
|
||||
code: "inline-code",
|
||||
hashtag: "hashtag meta"
|
||||
}
|
||||
},
|
||||
spellcheck: true,
|
||||
autofocus: autofocus,
|
||||
lineNumbers: false,
|
||||
showCursorWhenSelecting: true,
|
||||
indentUnit: 4,
|
||||
autoCloseBrackets: true,
|
||||
foldGutter: gutters,
|
||||
theme: 'custom'
|
||||
} as EditorConfiguration);
|
||||
|
||||
e.setValue(model.value ?? '');
|
||||
e.on('change', (cm: Editor, change: EditorChange) => model.value = cm.getValue());
|
||||
}
|
||||
});
|
||||
|
||||
watchEffect(() => {
|
||||
const value = editor.value?.getValue();
|
||||
if (editor.value && model.value !== value) {
|
||||
editor.value.setValue(model.value ?? '');
|
||||
editor.value.clearHistory();
|
||||
}
|
||||
});
|
||||
|
||||
defineExpose({ focus: () => editor.value?.focus() });
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div :class="{ 'cancel-gutters': !gutters }" class="flex flex-1 w-full justify-stretch items-stretch !font-sans !text-base">
|
||||
<textarea ref="input" class="hidden"></textarea>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style>
|
||||
.CodeMirror
|
||||
{
|
||||
@apply bg-transparent;
|
||||
@apply flex-1 h-full;
|
||||
@apply font-sans;
|
||||
|
||||
@apply text-light-100 dark:text-dark-100;
|
||||
}
|
||||
.cancel-gutters .CodeMirror-gutters
|
||||
{
|
||||
@apply hidden;
|
||||
}
|
||||
.CodeMirror-sizer
|
||||
{
|
||||
@apply !px-3;
|
||||
}
|
||||
.cancel-gutters .CodeMirror-sizer
|
||||
{
|
||||
@apply ms-2;
|
||||
}
|
||||
.CodeMirror-gutters
|
||||
{
|
||||
@apply bg-transparent;
|
||||
@apply border-transparent;
|
||||
}
|
||||
.CodeMirror-gutter-wrapper
|
||||
{
|
||||
@apply absolute top-0 bottom-0;
|
||||
@apply flex justify-center items-center;
|
||||
}
|
||||
.CodeMirror-foldmarker
|
||||
{
|
||||
@apply text-light-100;
|
||||
@apply dark:text-dark-100;
|
||||
@apply ps-3;
|
||||
text-shadow: none;
|
||||
}
|
||||
.hmd-inactive-line .cm-formatting-header, .hmd-inactive-line .cm-formatting-link, .hmd-inactive-line .cm-link-has-alias, .hmd-inactive-line .cm-link-alias-pipe
|
||||
{
|
||||
@apply hidden;
|
||||
}
|
||||
.CodeMirror-line
|
||||
{
|
||||
@apply text-base;
|
||||
}
|
||||
.CodeMirror-cursor
|
||||
{
|
||||
@apply border-light-100 dark:border-dark-100;
|
||||
}
|
||||
.CodeMirror-selected
|
||||
{
|
||||
@apply bg-light-35 dark:bg-dark-35;
|
||||
}
|
||||
.HyperMD-list-line-1 {
|
||||
@apply !ps-0;
|
||||
}
|
||||
.HyperMD-list-line-2 {
|
||||
@apply !ps-6;
|
||||
}
|
||||
.HyperMD-list-line-3 {
|
||||
@apply !ps-12;
|
||||
}
|
||||
</style>
|
||||
@@ -1,40 +0,0 @@
|
||||
<template>
|
||||
<Editor ref="editor" v-model="model" autofocus :gutters="false" />
|
||||
<iframe ref="iframe" class="w-full h-full border-0" sandbox="allow-same-origin allow-scripts"></iframe>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
const model = defineModel<string>();
|
||||
const editor = useTemplateRef('editor'), iframe = useTemplateRef('iframe');
|
||||
|
||||
onMounted(() => {
|
||||
if(iframe.value && iframe.value.contentDocument && editor.value)
|
||||
{
|
||||
editor.value.$el.remove();
|
||||
|
||||
iframe.value.contentDocument.documentElement.setAttribute('class', document.documentElement.getAttribute('class') ?? '');
|
||||
iframe.value.contentDocument.documentElement.setAttribute('style', document.documentElement.getAttribute('style') ?? '');
|
||||
|
||||
const base = iframe.value.contentDocument.head.appendChild(iframe.value.contentDocument.createElement('base'));
|
||||
base.setAttribute('href', window.location.href);
|
||||
|
||||
for(let element of document.getElementsByTagName('link'))
|
||||
{
|
||||
if(element.getAttribute('rel') === 'stylesheet')
|
||||
iframe.value.contentDocument.head.appendChild(element.cloneNode(true));
|
||||
}
|
||||
|
||||
for(let element of document.getElementsByTagName('style'))
|
||||
{
|
||||
iframe.value.contentDocument.head.appendChild(element.cloneNode(true));
|
||||
}
|
||||
|
||||
iframe.value.contentDocument.body.setAttribute('class', document.body.getAttribute('class') ?? '');
|
||||
iframe.value.contentDocument.body.setAttribute('style', document.body.getAttribute('style') ?? '');
|
||||
|
||||
iframe.value.contentDocument.body.appendChild(editor.value.$el);
|
||||
|
||||
editor.value.focus();
|
||||
}
|
||||
});
|
||||
</script>
|
||||
@@ -1,49 +0,0 @@
|
||||
<template>
|
||||
<div v-if="content && content.length > 0">
|
||||
<ProsesRenderer #default v-if="data" :node="data" :proses="proses" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import type { Component } from 'vue';
|
||||
import { heading } from 'hast-util-heading';
|
||||
import { headingRank } from 'hast-util-heading-rank';
|
||||
import { parseId } from '~/shared/general.util';
|
||||
import type { Root } from 'hast';
|
||||
|
||||
const { content, proses, filter } = defineProps<{
|
||||
content: string
|
||||
proses?: Record<string, string | Component>
|
||||
filter?: string
|
||||
}>();
|
||||
|
||||
const parser = useMarkdown(), data = ref<Root>();
|
||||
const node = computed(() => content ? parser(content) : undefined);
|
||||
watch([node], () => {
|
||||
if(!node.value)
|
||||
data.value = undefined;
|
||||
else if(!filter)
|
||||
{
|
||||
data.value = node.value;
|
||||
}
|
||||
else
|
||||
{
|
||||
const start = node.value?.children.findIndex(e => heading(e) && parseId(e.properties.id as string | undefined) === filter) ?? -1;
|
||||
|
||||
if(start === -1)
|
||||
data.value = node.value;
|
||||
else
|
||||
{
|
||||
let end = start;
|
||||
const rank = headingRank(node.value.children[start])!;
|
||||
while(end < node.value.children.length)
|
||||
{
|
||||
end++;
|
||||
if(heading(node.value.children[end]) && headingRank(node.value.children[end])! <= rank)
|
||||
break;
|
||||
}
|
||||
data.value = { ...node.value, children: node.value.children.slice(start, end) };
|
||||
}
|
||||
}
|
||||
}, { immediate: true, });
|
||||
</script>
|
||||
@@ -1,115 +0,0 @@
|
||||
<script lang="ts">
|
||||
import type { RootContent, Root } from 'hast';
|
||||
import { Text, Comment } from 'vue';
|
||||
|
||||
import ProseP from '~/components/prose/ProseP.vue';
|
||||
import ProseA from '~/components/prose/ProseA.vue';
|
||||
import ProseBlockquote from '~/components/prose/ProseBlockquote.vue';
|
||||
import ProseCallout from './prose/ProseCallout.vue';
|
||||
import ProseCode from '~/components/prose/ProseCode.vue';
|
||||
import ProsePre from '~/components/prose/ProsePre.vue';
|
||||
import ProseEm from '~/components/prose/ProseEm.vue';
|
||||
import ProseH1 from '~/components/prose/ProseH1.vue';
|
||||
import ProseH2 from '~/components/prose/ProseH2.vue';
|
||||
import ProseH3 from '~/components/prose/ProseH3.vue';
|
||||
import ProseH4 from '~/components/prose/ProseH4.vue';
|
||||
import ProseH5 from '~/components/prose/ProseH5.vue';
|
||||
import ProseH6 from '~/components/prose/ProseH6.vue';
|
||||
import ProseHr from '~/components/prose/ProseHr.vue';
|
||||
import ProseImg from '~/components/prose/ProseImg.vue';
|
||||
import ProseUl from '~/components/prose/ProseUl.vue';
|
||||
import ProseOl from '~/components/prose/ProseOl.vue';
|
||||
import ProseLi from '~/components/prose/ProseLi.vue';
|
||||
import ProseSmall from './prose/ProseSmall.vue';
|
||||
import ProseStrong from '~/components/prose/ProseStrong.vue';
|
||||
import ProseTable from '~/components/prose/ProseTable.vue';
|
||||
import ProseTag from '~/components/prose/ProseTag.vue';
|
||||
import ProseThead from '~/components/prose/ProseThead.vue';
|
||||
import ProseTbody from '~/components/prose/ProseTbody.vue';
|
||||
import ProseTd from '~/components/prose/ProseTd.vue';
|
||||
import ProseTh from '~/components/prose/ProseTh.vue';
|
||||
import ProseTr from '~/components/prose/ProseTr.vue';
|
||||
import ProseScript from '~/components/prose/ProseScript.vue';
|
||||
|
||||
const proseList = {
|
||||
"p": ProseP,
|
||||
"a": ProseA,
|
||||
"blockquote": ProseBlockquote,
|
||||
"callout": ProseCallout,
|
||||
"code": ProseCode,
|
||||
"pre": ProsePre,
|
||||
"em": ProseEm,
|
||||
"h1": ProseH1,
|
||||
"h2": ProseH2,
|
||||
"h3": ProseH3,
|
||||
"h4": ProseH4,
|
||||
"h5": ProseH5,
|
||||
"h6": ProseH6,
|
||||
"hr": ProseHr,
|
||||
"img": ProseImg,
|
||||
"ul": ProseUl,
|
||||
"ol": ProseOl,
|
||||
"li": ProseLi,
|
||||
"small": ProseSmall,
|
||||
"strong": ProseStrong,
|
||||
"table": ProseTable,
|
||||
"tag": ProseTag,
|
||||
"thead": ProseThead,
|
||||
"tbody": ProseTbody,
|
||||
"td": ProseTd,
|
||||
"th": ProseTh,
|
||||
"tr": ProseTr,
|
||||
"script": ProseScript
|
||||
};
|
||||
|
||||
export default defineComponent({
|
||||
name: 'MarkdownRenderer',
|
||||
props: {
|
||||
node: {
|
||||
type: Object,
|
||||
required: true
|
||||
},
|
||||
proses: {
|
||||
type: Object,
|
||||
default: () => ({})
|
||||
}
|
||||
},
|
||||
async setup(props) {
|
||||
if(props.proses)
|
||||
{
|
||||
for(const prose of Object.keys(props.proses))
|
||||
{
|
||||
if(typeof props.proses[prose] === 'string')
|
||||
props.proses[prose] = await resolveComponent(props.proses[prose]);
|
||||
}
|
||||
}
|
||||
return { tags: Object.assign({}, proseList, props.proses) };
|
||||
},
|
||||
render(ctx: any) {
|
||||
const { node, tags } = ctx;
|
||||
|
||||
if(!node)
|
||||
return null;
|
||||
|
||||
return h('div', null, {default: () => (node as Root).children.map(e => renderNode(e, tags)).filter(e => !!e)});
|
||||
}
|
||||
});
|
||||
|
||||
function renderNode(node: RootContent, tags: Record<string, any>): VNode | undefined
|
||||
{
|
||||
if(node.type === 'text' && node.value.length > 0 && node.value !== '\n')
|
||||
{
|
||||
return h(Text, node.value);
|
||||
}
|
||||
else if(node.type === 'comment' && node.value.length > 0 && node.value !== '\n')
|
||||
{
|
||||
return h(Comment, node.value);
|
||||
}
|
||||
else if(node.type === 'element')
|
||||
{
|
||||
return h(tags[node.tagName] ?? node.tagName, { ...node.properties, class: node.properties.className }, { default: () => node.children.map(e => renderNode(e, tags)).filter(e => !!e) });
|
||||
}
|
||||
|
||||
return undefined;
|
||||
}
|
||||
</script>
|
||||
@@ -2,7 +2,7 @@
|
||||
<div class="absolute" :style="{transform: `translate(${node.x}px, ${node.y}px)`, width: `${node.width}px`, height: `${node.height}px`, '--canvas-color': node.color?.hex}" :class="{'-z-10': node.type === 'group', 'z-10': node.type !== 'group'}">
|
||||
<div :class="[style.border]" class="outline-0 transition-[outline-width] border-2 bg-light-20 dark:bg-dark-20 w-full h-full hover:outline-4">
|
||||
<div class="w-full h-full py-2 px-4 flex !bg-opacity-[0.07] overflow-auto" :class="style.bg">
|
||||
<div v-if="node.text?.length > 0" class="flex items-center">
|
||||
<div v-if="node.text && node.text.length > 0" class="flex items-center">
|
||||
<MarkdownRenderer :content="node.text" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<div class="absolute" ref="dom" :style="{transform: `translate(${node.x}px, ${node.y}px)`, width: `${node.width}px`, height: `${node.height}px`, '--canvas-color': node.color?.hex}" :class="{'-z-10': node.type === 'group', 'z-10': node.type !== 'group'}">
|
||||
<div v-if="!editing || node.type === 'group'" style="outline-style: solid;" :class="[style.border, style.outline, { '!outline-4 cursor-move': focusing }]" class="outline-0 transition-[outline-width] border-2 bg-light-20 dark:bg-dark-20 w-full h-full hover:outline-4">
|
||||
<div class="w-full h-full py-2 px-4 flex !bg-opacity-[0.07] overflow-auto" :class="style.bg" @click.left="(e) => { if(node.type !== 'group') selectNode(e) }" @dblclick.left="(e) => { if(node.type !== 'group') editNode(e) }">
|
||||
<div v-if="node.text?.length > 0" class="flex items-center">
|
||||
<div v-if="node.text && node.text.length > 0" class="flex items-center">
|
||||
<MarkdownRenderer :content="node.text" :proses="{ a: FakeA }" />
|
||||
</div>
|
||||
</div>
|
||||
@@ -85,7 +85,7 @@ function editNode(e: Event) {
|
||||
dom.value?.removeEventListener('mousedown', dragstart);
|
||||
emit('edit', { type: 'node', id: node.id });
|
||||
}
|
||||
function resizeNode(e: MouseEvent, x: number, y: number, w: number, h: number) {
|
||||
function resizeNode(e: MouseEvent, x: number, y: number, width: number, height: number) {
|
||||
e.stopImmediatePropagation();
|
||||
|
||||
const startx = node.x, starty = node.y, startw = node.width, starth = node.height;
|
||||
@@ -96,15 +96,15 @@ function resizeNode(e: MouseEvent, x: number, y: number, w: number, h: number) {
|
||||
|
||||
realx = realx + (e.movementX / zoom) * x;
|
||||
realy = realy + (e.movementY / zoom) * y;
|
||||
realw = Math.max(realw + (e.movementX / zoom) * w, 64);
|
||||
realh = Math.max(realh + (e.movementY / zoom) * h, 64);
|
||||
realw = Math.max(realw + (e.movementX / zoom) * width, 64);
|
||||
realh = Math.max(realh + (e.movementY / zoom) * height, 64);
|
||||
|
||||
const result = e.altKey ? undefined : snap({ ...node, x: realx, y: realy, width: realw, height: realh }, { x, y, w, h });
|
||||
const result = e.altKey ? undefined : snap({ ...node, x: realx, y: realy, width: realw, height: realh }, { x, y, width, height });
|
||||
|
||||
node.x = result?.x ?? realx;
|
||||
node.y = result?.y ?? realy;
|
||||
node.width = result?.w ?? realw;
|
||||
node.height = result?.h ?? realh;
|
||||
node.width = result?.width ?? realw;
|
||||
node.height = result?.height ?? realh;
|
||||
};
|
||||
const resizeend = (e: MouseEvent) => {
|
||||
if(e.button !== 0)
|
||||
@@ -127,7 +127,7 @@ function dragEdge(e: MouseEvent, direction: Direction) {
|
||||
function unselect() {
|
||||
if(editing.value)
|
||||
{
|
||||
const text = node.type === 'group' ? node.label : node.text;
|
||||
const text = node.type === 'group' ? node.label! : node.text!;
|
||||
|
||||
if(text !== oldText)
|
||||
{
|
||||
|
||||
@@ -1,28 +1,4 @@
|
||||
<script lang="ts">
|
||||
import { type Position } from '#shared/canvas.util';
|
||||
import { hasPermissions } from '~/shared/auth.util';
|
||||
|
||||
const cancelEvent = (e: Event) => e.preventDefault();
|
||||
function center(touches: TouchList): Position
|
||||
{
|
||||
const pos = { x: 0, y: 0 };
|
||||
|
||||
for(const touch of touches)
|
||||
{
|
||||
pos.x += touch.clientX;
|
||||
pos.y += touch.clientY;
|
||||
}
|
||||
|
||||
pos.x /= touches.length;
|
||||
pos.y /= touches.length;
|
||||
return pos;
|
||||
}
|
||||
function distance(touches: TouchList): number
|
||||
{
|
||||
const [A, B] = touches;
|
||||
return Math.hypot(B.clientX - A.clientX, B.clientY - A.clientY);
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
stroke-light-red
|
||||
@@ -90,9 +66,8 @@ dark:outline-dark-purple
|
||||
</script>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { Icon } from '@iconify/vue/dist/iconify.js';
|
||||
import { clamp } from '#shared/general.util';
|
||||
import type { CanvasContent } from '~/types/content';
|
||||
import { Canvas } from '#shared/canvas.util';
|
||||
|
||||
const { path } = defineProps<{
|
||||
path: string
|
||||
@@ -102,183 +77,31 @@ const { user } = useUserSession();
|
||||
const { content, get } = useContent();
|
||||
const overview = computed(() => content.value.find(e => e.path === path) as CanvasContent | undefined);
|
||||
const isOwner = computed(() => user.value?.id === overview.value?.owner);
|
||||
|
||||
const loading = ref(false);
|
||||
if(overview.value && !overview.value.content)
|
||||
{
|
||||
loading.value = true;
|
||||
await get(path);
|
||||
loading.value = false;
|
||||
}
|
||||
const canvas = computed(() => overview.value && overview.value.content ? overview.value.content : undefined);
|
||||
|
||||
const dispX = ref(0), dispY = ref(0), minZoom = ref(0.1), zoom = ref(0.5);
|
||||
const canvasRef = useTemplateRef('canvasRef'), transformRef = useTemplateRef('transformRef');
|
||||
|
||||
const reset = (_: MouseEvent) => {
|
||||
zoom.value = minZoom.value;
|
||||
|
||||
dispX.value = 0;
|
||||
dispY.value = 0;
|
||||
|
||||
updateTransform();
|
||||
}
|
||||
const element = useTemplateRef('element');
|
||||
|
||||
onMounted(() => {
|
||||
let lastX = 0, lastY = 0, lastDistance = 0;
|
||||
let box = canvasRef.value?.getBoundingClientRect()!;
|
||||
const dragMove = (e: MouseEvent) => {
|
||||
dispX.value = dispX.value - (lastX - e.clientX) / zoom.value;
|
||||
dispY.value = dispY.value - (lastY - e.clientY) / zoom.value;
|
||||
|
||||
lastX = e.clientX;
|
||||
lastY = e.clientY;
|
||||
|
||||
updateTransform();
|
||||
};
|
||||
const dragEnd = (e: MouseEvent) => {
|
||||
window.removeEventListener('mouseup', dragEnd);
|
||||
window.removeEventListener('mousemove', dragMove);
|
||||
};
|
||||
canvasRef.value?.addEventListener('mouseenter', () => {
|
||||
window.addEventListener('wheel', cancelEvent, { passive: false });
|
||||
document.addEventListener('gesturestart', cancelEvent);
|
||||
document.addEventListener('gesturechange', cancelEvent);
|
||||
|
||||
canvasRef.value?.addEventListener('mouseleave', () => {
|
||||
window.removeEventListener('wheel', cancelEvent);
|
||||
document.removeEventListener('gesturestart', cancelEvent);
|
||||
document.removeEventListener('gesturechange', cancelEvent);
|
||||
});
|
||||
})
|
||||
window.addEventListener('resize', () => box = canvasRef.value?.getBoundingClientRect()!);
|
||||
canvasRef.value?.addEventListener('mousedown', (e) => {
|
||||
lastX = e.clientX;
|
||||
lastY = e.clientY;
|
||||
|
||||
window.addEventListener('mouseup', dragEnd, { passive: true });
|
||||
window.addEventListener('mousemove', dragMove, { passive: true });
|
||||
}, { passive: true });
|
||||
canvasRef.value?.addEventListener('wheel', (e) => {
|
||||
if((zoom.value >= 3 && e.deltaY < 0) || (zoom.value <= minZoom.value && e.deltaY > 0))
|
||||
return;
|
||||
|
||||
const diff = Math.exp(e.deltaY * -0.001);
|
||||
const centerX = (box.x + box.width / 2), centerY = (box.y + box.height / 2);
|
||||
const mousex = centerX - e.clientX, mousey = centerY - e.clientY;
|
||||
|
||||
dispX.value = dispX.value - (mousex / (diff * zoom.value) - mousex / zoom.value);
|
||||
dispY.value = dispY.value - (mousey / (diff * zoom.value) - mousey / zoom.value);
|
||||
|
||||
zoom.value = clamp(zoom.value * diff, minZoom.value, 3)
|
||||
|
||||
updateTransform();
|
||||
}, { passive: true });
|
||||
canvasRef.value?.addEventListener('touchstart', (e) => {
|
||||
({ x: lastX, y: lastY } = center(e.touches));
|
||||
|
||||
if(e.touches.length > 1)
|
||||
{
|
||||
lastDistance = distance(e.touches);
|
||||
}
|
||||
|
||||
canvasRef.value?.addEventListener('touchend', touchend, { passive: true });
|
||||
canvasRef.value?.addEventListener('touchcancel', touchcancel, { passive: true });
|
||||
canvasRef.value?.addEventListener('touchmove', touchmove, { passive: true });
|
||||
}, { passive: true });
|
||||
const touchend = (e: TouchEvent) => {
|
||||
if(e.touches.length > 1)
|
||||
{
|
||||
({ x: lastX, y: lastY } = center(e.touches));
|
||||
}
|
||||
|
||||
canvasRef.value?.removeEventListener('touchend', touchend);
|
||||
canvasRef.value?.removeEventListener('touchcancel', touchcancel);
|
||||
canvasRef.value?.removeEventListener('touchmove', touchmove);
|
||||
};
|
||||
const touchcancel = (e: TouchEvent) => {
|
||||
if(e.touches.length > 1)
|
||||
{
|
||||
({ x: lastX, y: lastY } = center(e.touches));
|
||||
}
|
||||
|
||||
canvasRef.value?.removeEventListener('touchend', touchend);
|
||||
canvasRef.value?.removeEventListener('touchcancel', touchcancel);
|
||||
canvasRef.value?.removeEventListener('touchmove', touchmove);
|
||||
};
|
||||
const touchmove = (e: TouchEvent) => {
|
||||
const pos = center(e.touches);
|
||||
dispX.value = dispX.value - (lastX - pos.x) / zoom.value;
|
||||
dispY.value = dispY.value - (lastY - pos.y) / zoom.value;
|
||||
lastX = pos.x;
|
||||
lastY = pos.y;
|
||||
|
||||
if(e.touches.length === 2)
|
||||
{
|
||||
const dist = distance(e.touches);
|
||||
const diff = dist / lastDistance;
|
||||
|
||||
zoom.value = clamp(zoom.value * diff, minZoom.value, 3);
|
||||
}
|
||||
|
||||
updateTransform();
|
||||
};
|
||||
|
||||
updateTransform();
|
||||
mount();
|
||||
});
|
||||
|
||||
function updateTransform()
|
||||
if(overview.value && !overview.value.content)
|
||||
{
|
||||
if(transformRef.value)
|
||||
await get(path);
|
||||
mount();
|
||||
}
|
||||
|
||||
const canvas = computed(() => overview.value && overview.value.content ? overview.value.content : undefined);
|
||||
|
||||
function mount()
|
||||
{
|
||||
if(element.value && canvas.value)
|
||||
{
|
||||
transformRef.value.style.transform = `scale3d(${zoom.value}, ${zoom.value}, 1) translate3d(${dispX.value}px, ${dispY.value}px, 0)`;
|
||||
transformRef.value.style.setProperty('--tw-scale', zoom.value.toString());
|
||||
const c = new Canvas(canvas.value);
|
||||
element.value.appendChild(c.container);
|
||||
c.mount();
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div ref="canvasRef" class="absolute top-0 left-0 overflow-hidden w-full h-full touch-none" :style="{ '--zoom-multiplier': (1 / Math.pow(zoom, 0.7)) }">
|
||||
<div class="flex flex-col absolute sm:top-2 top-10 left-2 z-[35] overflow-hidden gap-4">
|
||||
<div class="border border-light-35 dark:border-dark-35 bg-light-10 dark:bg-dark-10">
|
||||
<Tooltip message="Zoom avant" side="right">
|
||||
<div @click="zoom = clamp(zoom * 1.1, minZoom, 3); updateTransform()" class="w-8 h-8 flex justify-center items-center p-2 hover:bg-light-30 dark:hover:bg-dark-30 cursor-pointer">
|
||||
<Icon icon="radix-icons:plus" />
|
||||
</div>
|
||||
</Tooltip>
|
||||
<Tooltip message="Reset" side="right">
|
||||
<div @click="zoom = 1; updateTransform();" class="w-8 h-8 flex justify-center items-center p-2 hover:bg-light-30 dark:hover:bg-dark-30 cursor-pointer">
|
||||
<Icon icon="radix-icons:reload" />
|
||||
</div>
|
||||
</Tooltip>
|
||||
<Tooltip message="Tout contenir" side="right">
|
||||
<div @click="reset" class="w-8 h-8 flex justify-center items-center p-2 hover:bg-light-30 dark:hover:bg-dark-30 cursor-pointer">
|
||||
<Icon icon="radix-icons:corners" />
|
||||
</div>
|
||||
</Tooltip>
|
||||
<Tooltip message="Zoom arrière" side="right">
|
||||
<div @click="zoom = clamp(zoom / 1.1, minZoom, 3); updateTransform()" class="w-8 h-8 flex justify-center items-center p-2 hover:bg-light-30 dark:hover:bg-dark-30 cursor-pointer">
|
||||
<Icon icon="radix-icons:minus" />
|
||||
</div>
|
||||
</Tooltip>
|
||||
</div>
|
||||
<NuxtLink v-if="overview && isOwner || hasPermissions(user?.permissions ?? [], ['admin', 'editor'])" :to="{ name: 'explore-edit', hash: `#${encodeURIComponent(overview!.path)}` }" class="border border-light-35 dark:border-dark-35 bg-light-10 dark:bg-dark-10">
|
||||
<Tooltip message="Modifier" side="right">
|
||||
<Icon icon="radix-icons:pencil-1" class="w-8 h-8 p-2" />
|
||||
</Tooltip>
|
||||
</NuxtLink>
|
||||
</div>
|
||||
<div ref="transformRef" :style="{
|
||||
'transform-origin': 'center center',
|
||||
}" class="h-full">
|
||||
<div v-if="canvas" class="absolute top-0 left-0 w-full h-full pointer-events-none *:pointer-events-auto *:select-none touch-none">
|
||||
<div>
|
||||
<CanvasNode v-for="node of canvas.nodes" :key="node.id" ref="nodes" :node="node" :zoom="zoom" />
|
||||
</div>
|
||||
<div>
|
||||
<CanvasEdge v-for="edge of canvas.edges" :key="edge.id" ref="edges" :edge="edge" :nodes="canvas.nodes!" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div ref="element"></div>
|
||||
</template>
|
||||
@@ -1,6 +1,6 @@
|
||||
<template>
|
||||
<NuxtLink class="text-accent-blue inline-flex items-center" :to="overview ? { name: 'explore-path', params: { path: overview.path }, hash: hash } : href" :class="class">
|
||||
<HoverCard nuxt-client class="max-w-[600px] max-h-[600px] w-full overflow-auto z-[45]" :class="{'overflow-hidden !p-0': overview?.type === 'canvas'}" :disabled="!overview">
|
||||
<HoverCard nuxt-client class="min-w-[200px] min-h-[150px] max-w-[600px] max-h-[600px] w-full overflow-auto z-[45]" :class="{'overflow-hidden !p-0': overview?.type === 'canvas'}" :disabled="!overview">
|
||||
<template #content>
|
||||
<Markdown v-if="overview?.type === 'markdown'" class="!px-6" :path="pathname" :filter="hash.substring(1)" popover />
|
||||
<template v-else-if="overview?.type === 'canvas'"><div class="w-[600px] h-[600px] relative"><Canvas :path="pathname" /></div></template>
|
||||
@@ -16,7 +16,7 @@
|
||||
<script setup lang="ts">
|
||||
import { parseURL } from 'ufo';
|
||||
import { Icon } from '@iconify/vue/dist/iconify.js';
|
||||
import { iconByType } from '#shared/general.util';
|
||||
import { iconByType } from '#shared/content.util';
|
||||
|
||||
const { href } = defineProps<{
|
||||
href: string
|
||||
|
||||
@@ -35,7 +35,6 @@ const defaultCalloutIcon = 'radix-icons:info-circled';
|
||||
</script>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref } from 'vue';
|
||||
import { Icon } from '@iconify/vue/dist/iconify.js';
|
||||
const { type, title, fold } = defineProps<{
|
||||
type: string;
|
||||
@@ -43,104 +42,4 @@ const { type, title, fold } = defineProps<{
|
||||
fold?: boolean;
|
||||
}>();
|
||||
const disabled = computed(() => fold === undefined);
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.callout[data-type="abstract"],
|
||||
.callout[data-type="summary"],
|
||||
.callout[data-type="tldr"]
|
||||
{
|
||||
@apply bg-light-cyan;
|
||||
@apply dark:bg-dark-cyan;
|
||||
@apply text-light-cyan;
|
||||
@apply dark:text-dark-cyan;
|
||||
}
|
||||
.callout[data-type="info"]
|
||||
{
|
||||
@apply bg-light-blue;
|
||||
@apply dark:bg-dark-blue;
|
||||
@apply text-light-blue;
|
||||
@apply dark:text-dark-blue;
|
||||
}
|
||||
.callout[data-type="todo"]
|
||||
{
|
||||
@apply bg-light-blue;
|
||||
@apply dark:bg-dark-blue;
|
||||
@apply text-light-blue;
|
||||
@apply dark:text-dark-blue;
|
||||
}
|
||||
.callout[data-type="important"]
|
||||
{
|
||||
@apply bg-light-cyan;
|
||||
@apply dark:bg-dark-cyan;
|
||||
@apply text-light-cyan;
|
||||
@apply dark:text-dark-cyan;
|
||||
}
|
||||
.callout[data-type="tip"],
|
||||
.callout[data-type="hint"]
|
||||
{
|
||||
@apply bg-light-cyan;
|
||||
@apply dark:bg-dark-cyan;
|
||||
@apply text-light-cyan;
|
||||
@apply dark:text-dark-cyan;
|
||||
}
|
||||
.callout[data-type="success"],
|
||||
.callout[data-type="check"],
|
||||
.callout[data-type="done"]
|
||||
{
|
||||
@apply bg-light-green;
|
||||
@apply dark:bg-dark-green;
|
||||
@apply text-light-green;
|
||||
@apply dark:text-dark-green;
|
||||
}
|
||||
.callout[data-type="question"],
|
||||
.callout[data-type="help"],
|
||||
.callout[data-type="faq"]
|
||||
{
|
||||
@apply bg-light-orange;
|
||||
@apply dark:bg-dark-orange;
|
||||
@apply text-light-orange;
|
||||
@apply dark:text-dark-orange;
|
||||
}
|
||||
.callout[data-type="warning"],
|
||||
.callout[data-type="caution"],
|
||||
.callout[data-type="attention"]
|
||||
{
|
||||
@apply bg-light-orange;
|
||||
@apply dark:bg-dark-orange;
|
||||
@apply text-light-orange;
|
||||
@apply dark:text-dark-orange;
|
||||
}
|
||||
.callout[data-type="failure"],
|
||||
.callout[data-type="fail"],
|
||||
.callout[data-type="missing"]
|
||||
{
|
||||
@apply bg-light-red;
|
||||
@apply dark:bg-dark-red;
|
||||
@apply text-light-red;
|
||||
@apply dark:text-dark-red;
|
||||
}
|
||||
.callout[data-type="danger"],
|
||||
.callout[data-type="error"]
|
||||
{
|
||||
@apply bg-light-red;
|
||||
@apply dark:bg-dark-red;
|
||||
@apply text-light-red;
|
||||
@apply dark:text-dark-red;
|
||||
}
|
||||
.callout[data-type="bug"]
|
||||
{
|
||||
@apply bg-light-red;
|
||||
@apply dark:bg-dark-red;
|
||||
@apply text-light-red;
|
||||
@apply dark:text-dark-red;
|
||||
}
|
||||
.callout[data-type="example"]
|
||||
{
|
||||
@apply bg-light-purple;
|
||||
@apply dark:bg-dark-purple;
|
||||
@apply text-light-purple;
|
||||
@apply dark:text-dark-purple;
|
||||
}
|
||||
|
||||
</style>
|
||||
</script>
|
||||
@@ -1,7 +1,12 @@
|
||||
<template>
|
||||
<span class="before:content-['#'] cursor-default bg-accent-blue bg-opacity-10 hover:bg-opacity-20 text-accent-blue text-sm px-1 ms-1 pb-0.5 rounded-full rounded-se-none border border-accent-blue border-opacity-30">
|
||||
<slot></slot>
|
||||
</span>
|
||||
<HoverCard nuxt-client class="min-w-[200px] min-h-[150px] max-w-[600px] max-h-[600px] w-full overflow-auto z-[45]">
|
||||
<template #content>
|
||||
<Markdown class="!px-6" path="tags" :filter="tag" popover />
|
||||
</template>
|
||||
<span class="before:content-['#'] cursor-default bg-accent-blue bg-opacity-10 hover:bg-opacity-20 text-accent-blue text-sm px-1 ms-1 pb-0.5 rounded-full rounded-se-none border border-accent-blue border-opacity-30">
|
||||
<slot></slot>
|
||||
</span>
|
||||
</HoverCard>
|
||||
</template>
|
||||
|
||||
<style>
|
||||
@@ -13,4 +18,13 @@
|
||||
{
|
||||
@apply bg-accent-blue bg-opacity-10 text-accent-blue text-sm pb-0.5 pe-1 rounded-r-[12px] !rounded-se-none border border-l-0 border-accent-blue border-opacity-30;
|
||||
}
|
||||
</style>
|
||||
</style>
|
||||
|
||||
<script setup lang="ts">
|
||||
const { tag } = defineProps<{
|
||||
tag: string
|
||||
}>();
|
||||
|
||||
const { content } = useContent();
|
||||
const overview = computed(() => content.value.find(e => e.path === "tags"));
|
||||
</script>
|
||||
@@ -1,40 +1,45 @@
|
||||
import { Content } from '~/shared/content.util';
|
||||
import type { ExploreContent, ContentComposable, TreeItem } from '~/types/content';
|
||||
|
||||
const useContentState = () => useState<ExploreContent[]>('content', () => []);
|
||||
|
||||
export function useContent(): ContentComposable {
|
||||
const contentState = useContentState();
|
||||
return {
|
||||
content: contentState,
|
||||
tree: computed(() => {
|
||||
const arr: TreeItem[] = [];
|
||||
for(const element of contentState.value)
|
||||
{
|
||||
addChild(arr, element);
|
||||
}
|
||||
return arr;
|
||||
}),
|
||||
fetch,
|
||||
get,
|
||||
}
|
||||
const contentState = useContentState();
|
||||
|
||||
return {
|
||||
content: contentState,
|
||||
tree: computed(() => {
|
||||
const arr: TreeItem[] = [];
|
||||
for(const element of contentState.value)
|
||||
{
|
||||
addChild(arr, element);
|
||||
}
|
||||
return arr;
|
||||
}),
|
||||
fetch,
|
||||
get,
|
||||
}
|
||||
}
|
||||
|
||||
async function fetch(force: boolean) {
|
||||
async function fetch(force: boolean = false) {
|
||||
const content = useContentState();
|
||||
if(content.value.length === 0 || force)
|
||||
content.value = await useRequestFetch()('/api/file/overview');
|
||||
}
|
||||
|
||||
async function get(path: string) {
|
||||
async function get(path: string, force: boolean = false): Promise<ExploreContent | undefined> {
|
||||
const content = useContentState()
|
||||
const value = content.value;
|
||||
const item = value.find(e => e.path === path);
|
||||
if(item)
|
||||
|
||||
if(item && !item.content)
|
||||
{
|
||||
item.content = await useRequestFetch()(`/api/file/content/${encodeURIComponent(path)}`);
|
||||
}
|
||||
|
||||
content.value = value;
|
||||
|
||||
return item;
|
||||
}
|
||||
|
||||
function addChild(arr: TreeItem[], e: ExploreContent): void {
|
||||
|
||||
@@ -8,9 +8,14 @@ import RemarkGfm from 'remark-gfm';
|
||||
import RemarkBreaks from 'remark-breaks';
|
||||
import RemarkFrontmatter from 'remark-frontmatter';
|
||||
|
||||
export default function useMarkdown(): (md: string) => Root
|
||||
interface Parser
|
||||
{
|
||||
let processor: Processor;
|
||||
parse: (md: string) => Promise<Root>;
|
||||
parseSync: (md: string) => Root
|
||||
}
|
||||
export default function useMarkdown(): Parser
|
||||
{
|
||||
let processor: Processor, processorSync: Processor;
|
||||
|
||||
const parse = (markdown: string) => {
|
||||
if (!processor)
|
||||
@@ -19,9 +24,20 @@ export default function useMarkdown(): (md: string) => Root
|
||||
processor.use(RemarkRehype);
|
||||
}
|
||||
|
||||
const processed = processor.run(processor.parse(markdown)) as Promise<Root>;
|
||||
return processed;
|
||||
}
|
||||
|
||||
const parseSync = (markdown: string) => {
|
||||
if (!processor)
|
||||
{
|
||||
processor = unified().use([RemarkParse, RemarkGfm, RemarkOfm, RemarkBreaks, RemarkFrontmatter]);
|
||||
processor.use(RemarkRehype);
|
||||
}
|
||||
|
||||
const processed = processor.runSync(processor.parse(markdown)) as Root;
|
||||
return processed;
|
||||
}
|
||||
|
||||
return parse;
|
||||
return { parse, parseSync };
|
||||
}
|
||||
@@ -1,9 +1,7 @@
|
||||
import type { UserSession, UserSessionComposable } from '~/types/auth'
|
||||
import { useContent } from './useContent'
|
||||
|
||||
const useSessionState = () => useState<UserSession>('nuxt-session', () => ({}))
|
||||
const useAuthReadyState = () => useState('nuxt-auth-ready', () => false)
|
||||
const useContentFetch = (force: boolean) => useContent().fetch(force);
|
||||
|
||||
/**
|
||||
* Composable to get back the user session and utils around it.
|
||||
|
||||
BIN
db.sqlite-shm
BIN
db.sqlite-shm
Binary file not shown.
BIN
db.sqlite-wal
BIN
db.sqlite-wal
Binary file not shown.
46
db/schema.ts
46
db/schema.ts
@@ -1,7 +1,7 @@
|
||||
import { relations } from 'drizzle-orm';
|
||||
import { int, text, sqliteTable, type SQLiteTableExtraConfig, primaryKey, blob } from 'drizzle-orm/sqlite-core';
|
||||
import { int, text, sqliteTable as table, primaryKey, blob } from 'drizzle-orm/sqlite-core';
|
||||
|
||||
export const usersTable = sqliteTable("users", {
|
||||
export const usersTable = table("users", {
|
||||
id: int().primaryKey({ autoIncrement: true }),
|
||||
username: text().notNull().unique(),
|
||||
email: text().notNull().unique(),
|
||||
@@ -9,46 +9,41 @@ export const usersTable = sqliteTable("users", {
|
||||
state: int().notNull().default(0),
|
||||
});
|
||||
|
||||
export const usersDataTable = sqliteTable("users_data", {
|
||||
export const usersDataTable = table("users_data", {
|
||||
id: int().primaryKey().references(() => usersTable.id, { onDelete: 'cascade', onUpdate: 'cascade' }),
|
||||
signin: int({ mode: 'timestamp' }).notNull().$defaultFn(() => new Date()),
|
||||
lastTimestamp: int({ mode: 'timestamp' }).notNull().$defaultFn(() => new Date()),
|
||||
logCount: int().notNull().default(0),
|
||||
});
|
||||
|
||||
export const userSessionsTable = sqliteTable("user_sessions", {
|
||||
export const userSessionsTable = table("user_sessions", {
|
||||
id: int().notNull(),
|
||||
user_id: int().notNull().references(() => usersTable.id, { onDelete: 'cascade', onUpdate: 'cascade' }),
|
||||
timestamp: int({ mode: 'timestamp' }).notNull().$defaultFn(() => new Date()),
|
||||
}, (table): SQLiteTableExtraConfig => {
|
||||
return {
|
||||
pk: primaryKey({ columns: [table.id, table.user_id] }),
|
||||
}
|
||||
});
|
||||
}, (table) => [ primaryKey({ columns: [table.id, table.user_id] }) ]);
|
||||
|
||||
export const userPermissionsTable = sqliteTable("user_permissions", {
|
||||
export const userPermissionsTable = table("user_permissions", {
|
||||
id: int().notNull().references(() => usersTable.id, { onDelete: 'cascade', onUpdate: 'cascade' }),
|
||||
permission: text().notNull(),
|
||||
}, (table): SQLiteTableExtraConfig => {
|
||||
return {
|
||||
pk: primaryKey({ columns: [table.id, table.permission] }),
|
||||
}
|
||||
});
|
||||
}, (table) => [ primaryKey({ columns: [table.id, table.permission] }) ]);
|
||||
|
||||
export const explorerContentTable = sqliteTable("explorer_content", {
|
||||
path: text().primaryKey(),
|
||||
export const projectFilesTable = table("project_files", {
|
||||
id: text().primaryKey(),
|
||||
path: text().notNull().unique(),
|
||||
owner: int().notNull().references(() => usersTable.id, { onDelete: 'cascade', onUpdate: 'cascade' }),
|
||||
title: text().notNull(),
|
||||
type: text({ enum: ['file', 'folder', 'markdown', 'canvas', 'map'] }).notNull(),
|
||||
content: blob({ mode: 'buffer' }),
|
||||
navigable: int({ mode: 'boolean' }).notNull().default(true),
|
||||
private: int({ mode: 'boolean' }).notNull().default(false),
|
||||
order: int().notNull(),
|
||||
visit: int().notNull().default(0),
|
||||
timestamp: int({ mode: 'timestamp' }).notNull().$defaultFn(() => new Date()),
|
||||
});
|
||||
|
||||
export const emailValidationTable = sqliteTable("email_validation", {
|
||||
export const projectContentTable = table("project_content", {
|
||||
id: text().primaryKey(),
|
||||
content: blob({ mode: 'buffer' }),
|
||||
});
|
||||
|
||||
export const emailValidationTable = table("email_validation", {
|
||||
id: text().primaryKey(),
|
||||
timestamp: int({ mode: 'timestamp' }).notNull(),
|
||||
})
|
||||
@@ -57,7 +52,7 @@ export const usersRelation = relations(usersTable, ({ one, many }) => ({
|
||||
data: one(usersDataTable, { fields: [usersTable.id], references: [usersDataTable.id], }),
|
||||
session: many(userSessionsTable),
|
||||
permission: many(userPermissionsTable),
|
||||
content: many(explorerContentTable),
|
||||
files: many(projectFilesTable),
|
||||
}));
|
||||
export const usersDataRelation = relations(usersDataTable, ({ one }) => ({
|
||||
users: one(usersTable, { fields: [usersDataTable.id], references: [usersTable.id], }),
|
||||
@@ -68,6 +63,9 @@ export const userSessionsRelation = relations(userSessionsTable, ({ one }) => ({
|
||||
export const userPermissionsRelation = relations(userPermissionsTable, ({ one }) => ({
|
||||
users: one(usersTable, { fields: [userPermissionsTable.id], references: [usersTable.id], }),
|
||||
}));
|
||||
export const explorerContentRelation = relations(explorerContentTable, ({ one }) => ({
|
||||
users: one(usersTable, { fields: [explorerContentTable.owner], references: [usersTable.id], }),
|
||||
export const projectFilesRelation = relations(projectFilesTable, ({ one }) => ({
|
||||
users: one(usersTable, { fields: [projectFilesTable.owner], references: [usersTable.id], }),
|
||||
}));
|
||||
export const projectContentRelation = relations(projectContentTable, ({ one }) => ({
|
||||
files: one(projectFilesTable, { fields: [projectContentTable.id], references: [projectFilesTable.id], }),
|
||||
}));
|
||||
21
drizzle/0006_luxuriant_blade.sql
Normal file
21
drizzle/0006_luxuriant_blade.sql
Normal file
@@ -0,0 +1,21 @@
|
||||
CREATE TABLE `project_content` (
|
||||
`id` text PRIMARY KEY NOT NULL,
|
||||
`content` blob
|
||||
);
|
||||
--> statement-breakpoint
|
||||
CREATE TABLE `project_files` (
|
||||
`id` text PRIMARY KEY NOT NULL,
|
||||
`path` text NOT NULL,
|
||||
`owner` integer NOT NULL,
|
||||
`title` text NOT NULL,
|
||||
`type` text NOT NULL,
|
||||
`navigable` integer DEFAULT true NOT NULL,
|
||||
`private` integer DEFAULT false NOT NULL,
|
||||
`order` integer NOT NULL,
|
||||
`timestamp` integer NOT NULL,
|
||||
FOREIGN KEY (`owner`) REFERENCES `users`(`id`) ON UPDATE cascade ON DELETE cascade
|
||||
);
|
||||
--> statement-breakpoint
|
||||
CREATE UNIQUE INDEX `project_files_path_unique` ON `project_files` (`path`);--> statement-breakpoint
|
||||
DROP TABLE `explorer_content`;--> statement-breakpoint
|
||||
ALTER TABLE `users_data` DROP COLUMN `logCount`;
|
||||
375
drizzle/meta/0006_snapshot.json
Normal file
375
drizzle/meta/0006_snapshot.json
Normal file
@@ -0,0 +1,375 @@
|
||||
{
|
||||
"version": "6",
|
||||
"dialect": "sqlite",
|
||||
"id": "b24a44ad-b43a-4aba-be9c-350fd41bed04",
|
||||
"prevId": "a2731c1f-4150-4423-946e-670d794f8961",
|
||||
"tables": {
|
||||
"email_validation": {
|
||||
"name": "email_validation",
|
||||
"columns": {
|
||||
"id": {
|
||||
"name": "id",
|
||||
"type": "text",
|
||||
"primaryKey": true,
|
||||
"notNull": true,
|
||||
"autoincrement": false
|
||||
},
|
||||
"timestamp": {
|
||||
"name": "timestamp",
|
||||
"type": "integer",
|
||||
"primaryKey": false,
|
||||
"notNull": true,
|
||||
"autoincrement": false
|
||||
}
|
||||
},
|
||||
"indexes": {},
|
||||
"foreignKeys": {},
|
||||
"compositePrimaryKeys": {},
|
||||
"uniqueConstraints": {},
|
||||
"checkConstraints": {}
|
||||
},
|
||||
"project_content": {
|
||||
"name": "project_content",
|
||||
"columns": {
|
||||
"id": {
|
||||
"name": "id",
|
||||
"type": "text",
|
||||
"primaryKey": true,
|
||||
"notNull": true,
|
||||
"autoincrement": false
|
||||
},
|
||||
"content": {
|
||||
"name": "content",
|
||||
"type": "blob",
|
||||
"primaryKey": false,
|
||||
"notNull": false,
|
||||
"autoincrement": false
|
||||
}
|
||||
},
|
||||
"indexes": {},
|
||||
"foreignKeys": {},
|
||||
"compositePrimaryKeys": {},
|
||||
"uniqueConstraints": {},
|
||||
"checkConstraints": {}
|
||||
},
|
||||
"project_files": {
|
||||
"name": "project_files",
|
||||
"columns": {
|
||||
"id": {
|
||||
"name": "id",
|
||||
"type": "text",
|
||||
"primaryKey": true,
|
||||
"notNull": true,
|
||||
"autoincrement": false
|
||||
},
|
||||
"path": {
|
||||
"name": "path",
|
||||
"type": "text",
|
||||
"primaryKey": false,
|
||||
"notNull": true,
|
||||
"autoincrement": false
|
||||
},
|
||||
"owner": {
|
||||
"name": "owner",
|
||||
"type": "integer",
|
||||
"primaryKey": false,
|
||||
"notNull": true,
|
||||
"autoincrement": false
|
||||
},
|
||||
"title": {
|
||||
"name": "title",
|
||||
"type": "text",
|
||||
"primaryKey": false,
|
||||
"notNull": true,
|
||||
"autoincrement": false
|
||||
},
|
||||
"type": {
|
||||
"name": "type",
|
||||
"type": "text",
|
||||
"primaryKey": false,
|
||||
"notNull": true,
|
||||
"autoincrement": false
|
||||
},
|
||||
"navigable": {
|
||||
"name": "navigable",
|
||||
"type": "integer",
|
||||
"primaryKey": false,
|
||||
"notNull": true,
|
||||
"autoincrement": false,
|
||||
"default": true
|
||||
},
|
||||
"private": {
|
||||
"name": "private",
|
||||
"type": "integer",
|
||||
"primaryKey": false,
|
||||
"notNull": true,
|
||||
"autoincrement": false,
|
||||
"default": false
|
||||
},
|
||||
"order": {
|
||||
"name": "order",
|
||||
"type": "integer",
|
||||
"primaryKey": false,
|
||||
"notNull": true,
|
||||
"autoincrement": false
|
||||
},
|
||||
"timestamp": {
|
||||
"name": "timestamp",
|
||||
"type": "integer",
|
||||
"primaryKey": false,
|
||||
"notNull": true,
|
||||
"autoincrement": false
|
||||
}
|
||||
},
|
||||
"indexes": {
|
||||
"project_files_path_unique": {
|
||||
"name": "project_files_path_unique",
|
||||
"columns": [
|
||||
"path"
|
||||
],
|
||||
"isUnique": true
|
||||
}
|
||||
},
|
||||
"foreignKeys": {
|
||||
"project_files_owner_users_id_fk": {
|
||||
"name": "project_files_owner_users_id_fk",
|
||||
"tableFrom": "project_files",
|
||||
"tableTo": "users",
|
||||
"columnsFrom": [
|
||||
"owner"
|
||||
],
|
||||
"columnsTo": [
|
||||
"id"
|
||||
],
|
||||
"onDelete": "cascade",
|
||||
"onUpdate": "cascade"
|
||||
}
|
||||
},
|
||||
"compositePrimaryKeys": {},
|
||||
"uniqueConstraints": {},
|
||||
"checkConstraints": {}
|
||||
},
|
||||
"user_permissions": {
|
||||
"name": "user_permissions",
|
||||
"columns": {
|
||||
"id": {
|
||||
"name": "id",
|
||||
"type": "integer",
|
||||
"primaryKey": false,
|
||||
"notNull": true,
|
||||
"autoincrement": false
|
||||
},
|
||||
"permission": {
|
||||
"name": "permission",
|
||||
"type": "text",
|
||||
"primaryKey": false,
|
||||
"notNull": true,
|
||||
"autoincrement": false
|
||||
}
|
||||
},
|
||||
"indexes": {},
|
||||
"foreignKeys": {
|
||||
"user_permissions_id_users_id_fk": {
|
||||
"name": "user_permissions_id_users_id_fk",
|
||||
"tableFrom": "user_permissions",
|
||||
"tableTo": "users",
|
||||
"columnsFrom": [
|
||||
"id"
|
||||
],
|
||||
"columnsTo": [
|
||||
"id"
|
||||
],
|
||||
"onDelete": "cascade",
|
||||
"onUpdate": "cascade"
|
||||
}
|
||||
},
|
||||
"compositePrimaryKeys": {
|
||||
"user_permissions_id_permission_pk": {
|
||||
"columns": [
|
||||
"id",
|
||||
"permission"
|
||||
],
|
||||
"name": "user_permissions_id_permission_pk"
|
||||
}
|
||||
},
|
||||
"uniqueConstraints": {},
|
||||
"checkConstraints": {}
|
||||
},
|
||||
"user_sessions": {
|
||||
"name": "user_sessions",
|
||||
"columns": {
|
||||
"id": {
|
||||
"name": "id",
|
||||
"type": "integer",
|
||||
"primaryKey": false,
|
||||
"notNull": true,
|
||||
"autoincrement": false
|
||||
},
|
||||
"user_id": {
|
||||
"name": "user_id",
|
||||
"type": "integer",
|
||||
"primaryKey": false,
|
||||
"notNull": true,
|
||||
"autoincrement": false
|
||||
},
|
||||
"timestamp": {
|
||||
"name": "timestamp",
|
||||
"type": "integer",
|
||||
"primaryKey": false,
|
||||
"notNull": true,
|
||||
"autoincrement": false
|
||||
}
|
||||
},
|
||||
"indexes": {},
|
||||
"foreignKeys": {
|
||||
"user_sessions_user_id_users_id_fk": {
|
||||
"name": "user_sessions_user_id_users_id_fk",
|
||||
"tableFrom": "user_sessions",
|
||||
"tableTo": "users",
|
||||
"columnsFrom": [
|
||||
"user_id"
|
||||
],
|
||||
"columnsTo": [
|
||||
"id"
|
||||
],
|
||||
"onDelete": "cascade",
|
||||
"onUpdate": "cascade"
|
||||
}
|
||||
},
|
||||
"compositePrimaryKeys": {
|
||||
"user_sessions_id_user_id_pk": {
|
||||
"columns": [
|
||||
"id",
|
||||
"user_id"
|
||||
],
|
||||
"name": "user_sessions_id_user_id_pk"
|
||||
}
|
||||
},
|
||||
"uniqueConstraints": {},
|
||||
"checkConstraints": {}
|
||||
},
|
||||
"users_data": {
|
||||
"name": "users_data",
|
||||
"columns": {
|
||||
"id": {
|
||||
"name": "id",
|
||||
"type": "integer",
|
||||
"primaryKey": true,
|
||||
"notNull": true,
|
||||
"autoincrement": false
|
||||
},
|
||||
"signin": {
|
||||
"name": "signin",
|
||||
"type": "integer",
|
||||
"primaryKey": false,
|
||||
"notNull": true,
|
||||
"autoincrement": false
|
||||
},
|
||||
"lastTimestamp": {
|
||||
"name": "lastTimestamp",
|
||||
"type": "integer",
|
||||
"primaryKey": false,
|
||||
"notNull": true,
|
||||
"autoincrement": false
|
||||
}
|
||||
},
|
||||
"indexes": {},
|
||||
"foreignKeys": {
|
||||
"users_data_id_users_id_fk": {
|
||||
"name": "users_data_id_users_id_fk",
|
||||
"tableFrom": "users_data",
|
||||
"tableTo": "users",
|
||||
"columnsFrom": [
|
||||
"id"
|
||||
],
|
||||
"columnsTo": [
|
||||
"id"
|
||||
],
|
||||
"onDelete": "cascade",
|
||||
"onUpdate": "cascade"
|
||||
}
|
||||
},
|
||||
"compositePrimaryKeys": {},
|
||||
"uniqueConstraints": {},
|
||||
"checkConstraints": {}
|
||||
},
|
||||
"users": {
|
||||
"name": "users",
|
||||
"columns": {
|
||||
"id": {
|
||||
"name": "id",
|
||||
"type": "integer",
|
||||
"primaryKey": true,
|
||||
"notNull": true,
|
||||
"autoincrement": true
|
||||
},
|
||||
"username": {
|
||||
"name": "username",
|
||||
"type": "text",
|
||||
"primaryKey": false,
|
||||
"notNull": true,
|
||||
"autoincrement": false
|
||||
},
|
||||
"email": {
|
||||
"name": "email",
|
||||
"type": "text",
|
||||
"primaryKey": false,
|
||||
"notNull": true,
|
||||
"autoincrement": false
|
||||
},
|
||||
"hash": {
|
||||
"name": "hash",
|
||||
"type": "text",
|
||||
"primaryKey": false,
|
||||
"notNull": true,
|
||||
"autoincrement": false
|
||||
},
|
||||
"state": {
|
||||
"name": "state",
|
||||
"type": "integer",
|
||||
"primaryKey": false,
|
||||
"notNull": true,
|
||||
"autoincrement": false,
|
||||
"default": 0
|
||||
}
|
||||
},
|
||||
"indexes": {
|
||||
"users_username_unique": {
|
||||
"name": "users_username_unique",
|
||||
"columns": [
|
||||
"username"
|
||||
],
|
||||
"isUnique": true
|
||||
},
|
||||
"users_email_unique": {
|
||||
"name": "users_email_unique",
|
||||
"columns": [
|
||||
"email"
|
||||
],
|
||||
"isUnique": true
|
||||
},
|
||||
"users_hash_unique": {
|
||||
"name": "users_hash_unique",
|
||||
"columns": [
|
||||
"hash"
|
||||
],
|
||||
"isUnique": true
|
||||
}
|
||||
},
|
||||
"foreignKeys": {},
|
||||
"compositePrimaryKeys": {},
|
||||
"uniqueConstraints": {},
|
||||
"checkConstraints": {}
|
||||
}
|
||||
},
|
||||
"views": {},
|
||||
"enums": {},
|
||||
"_meta": {
|
||||
"schemas": {},
|
||||
"tables": {},
|
||||
"columns": {}
|
||||
},
|
||||
"internal": {
|
||||
"indexes": {}
|
||||
}
|
||||
}
|
||||
@@ -43,6 +43,13 @@
|
||||
"when": 1734426608563,
|
||||
"tag": "0005_panoramic_slayback",
|
||||
"breakpoints": true
|
||||
},
|
||||
{
|
||||
"idx": 6,
|
||||
"version": "6",
|
||||
"when": 1743344302223,
|
||||
"tag": "0006_luxuriant_blade",
|
||||
"breakpoints": true
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
<template>
|
||||
<CollapsibleRoot class="flex flex-1 flex-col" v-model:open="open">
|
||||
<div class="z-50 flex w-full items-center justify-between border-b border-light-35 dark:border-dark-35 px-2">
|
||||
<div class="z-30 flex w-full items-center justify-between border-b border-light-35 dark:border-dark-35 px-2">
|
||||
<div class="flex items-center px-2 gap-4">
|
||||
<CollapsibleTrigger asChild>
|
||||
<Button icon class="!bg-transparent group md:hidden">
|
||||
@@ -29,34 +29,22 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex flex-1 flex-row relative h-screen overflow-hidden">
|
||||
<CollapsibleContent asChild forceMount>
|
||||
<!-- <CollapsibleContent asChild forceMount> -->
|
||||
<div class="bg-light-0 dark:bg-dark-0 z-40 w-screen md:w-[18rem] border-r border-light-30 dark:border-dark-30 flex flex-col justify-between my-2 max-md:data-[state=closed]:hidden">
|
||||
<div class="flex-1 px-2 max-w-full max-h-full overflow-y-auto overflow-x-hidden">
|
||||
<div class="flex-1 px-2 max-w-full max-h-full overflow-y-auto overflow-x-hidden" ref="treeParent">
|
||||
<div class="flex flex-row flex-1 justify-between items-center py-4 px-2">
|
||||
<NuxtLink :href="{ name: 'explore-path', params: { path: 'index' } }" class="flex flex-1 font-bold text-lg items-center border-light-35 dark:border-dark-35 hover:border-accent-blue" active-class="text-accent-blue border-s-2 !border-accent-blue">
|
||||
<span class="pl-3 py-1 flex-1 truncate">Projet</span>
|
||||
</NuxtLink>
|
||||
<NuxtLink v-if="user && hasPermissions(user.permissions, ['admin', 'editor'])" :to="{ name: 'explore-edit' }"><Button icon><Icon icon="radix-icons:pencil-2" /></Button></NuxtLink>
|
||||
</div>
|
||||
<Tree v-if="pages" v-model="pages" :getKey="(item) => item.path" class="ps-4">
|
||||
<template #default="{ item, isExpanded }">
|
||||
<NuxtLink :href="item.value.path && !item.hasChildren ? { name: 'explore-path', params: { path: item.value.path } } : undefined" class="flex flex-1 items-center hover:border-accent-blue hover:text-accent-purple max-w-full" :class="{ 'font-medium': item.hasChildren }" active-class="text-accent-blue" :data-private="item.value.private">
|
||||
<Icon v-if="item.hasChildren" icon="radix-icons:chevron-right" :class="{ 'rotate-90': isExpanded }" class="h-4 w-4 transition-transform absolute" :style="{ 'left': `${item.level / 2 - 1.5}em` }" />
|
||||
<Icon v-else-if="iconByType[item.value.type]" :icon="iconByType[item.value.type]" class="w-5 h-5" />
|
||||
<div class="pl-1.5 py-1.5 flex-1 truncate">
|
||||
{{ item.value.title }}
|
||||
</div>
|
||||
<Tooltip message="Privé" side="right"><Icon v-show="item.value.private" class="mx-1" icon="radix-icons:lock-closed" /></Tooltip>
|
||||
</NuxtLink>
|
||||
</template>
|
||||
</Tree>
|
||||
</div>
|
||||
<div class="xl:px-12 px-6 pt-4 pb-2 text-center text-xs text-light-60 dark:text-dark-60">
|
||||
<NuxtLink class="hover:underline italic" :to="{ name: 'roadmap' }">Roadmap</NuxtLink> - <NuxtLink class="hover:underline italic" :to="{ name: 'legal' }">Mentions légales</NuxtLink>
|
||||
<p>Copyright Peaceultime - 2025</p>
|
||||
</div>
|
||||
</div>
|
||||
</CollapsibleContent>
|
||||
<!-- </CollapsibleContent> -->
|
||||
<slot></slot>
|
||||
</div>
|
||||
</CollapsibleRoot>
|
||||
@@ -64,10 +52,14 @@
|
||||
|
||||
<script setup lang="ts">
|
||||
import { Icon } from '@iconify/vue/dist/iconify.js';
|
||||
import { iconByType } from '#shared/general.util';
|
||||
import type { DropdownOption } from '~/components/base/DropdownMenu.vue';
|
||||
import { hasPermissions } from '~/shared/auth.util';
|
||||
import type { TreeItem } from '~/types/content';
|
||||
import { hasPermissions } from '#shared/auth.util';
|
||||
import { TreeDOM } from '#shared/tree';
|
||||
import { Content, iconByType } from '#shared/content.util';
|
||||
import { dom, icon, text } from '#shared/dom.util';
|
||||
import { unifySlug } from '#shared/general.util';
|
||||
import { popper } from '#shared/floating.util';
|
||||
import { link } from '#shared/proses';
|
||||
|
||||
const options = ref<DropdownOption[]>([{
|
||||
type: 'item',
|
||||
@@ -86,16 +78,43 @@ const { fetch } = useContent();
|
||||
await fetch(false);
|
||||
|
||||
const route = useRouter().currentRoute;
|
||||
const path = computed(() => route.value.params.path ? Array.isArray(route.value.params.path) ? route.value.params.path[0] : route.value.params.path : undefined);
|
||||
const path = computed(() => route.value.params.path ? decodeURIComponent(unifySlug(route.value.params.path)) : undefined);
|
||||
|
||||
await Content.init();
|
||||
const tree = new TreeDOM((item, depth) => {
|
||||
return dom('div', { class: 'group flex items-center ps-2 outline-none relative cursor-pointer', style: { 'padding-left': `${depth / 2 - 0.5}em` } }, [dom('div', { class: ['flex flex-1 items-center hover:border-accent-blue hover:text-accent-purple max-w-full cursor-pointer font-medium'], attributes: { 'data-private': item.private } }, [
|
||||
icon('radix-icons:chevron-right', { class: 'h-4 w-4 transition-transform absolute group-data-[state=open]:rotate-90', style: { 'left': `${depth / 2 - 1.5}em` } }),
|
||||
dom('div', { class: 'pl-1.5 py-1.5 flex-1 truncate', text: item.title, attributes: { title: item.title } }),
|
||||
item.private ? popper(dom('span', { class: 'flex' }, [icon('radix-icons:lock-closed', { class: 'mx-1' })]), { delay: 150, offset: 8, placement: 'right', arrow: true, content: [text('Privé')], class: 'TooltipContent border border-light-30 dark:border-dark-30 px-2 py-1 bg-light-10 dark:bg-dark-10 text-light-70 dark:text-dark-70 z-50' }) : undefined,
|
||||
])]);
|
||||
}, (item, depth) => {
|
||||
return dom('div', { class: 'group flex items-center ps-2 outline-none relative cursor-pointer', style: { 'padding-left': `${depth / 2 - 0.5}em` } }, [link({ class: ['flex flex-1 items-center hover:border-accent-blue hover:text-accent-purple max-w-full'], attributes: { 'data-private': item.private }, active: 'text-accent-blue' }, item.path ? { name: 'explore-path', params: { path: item.path } } : undefined, [
|
||||
icon(iconByType[item.type], { class: 'w-5 h-5', width: 20, height: 20 }),
|
||||
dom('div', { class: 'pl-1.5 py-1.5 flex-1 truncate', text: item.title, attributes: { title: item.title } }),
|
||||
item.private ? popper(dom('span', { class: 'flex' }, [icon('radix-icons:lock-closed', { class: 'mx-1' })]), { delay: 150, offset: 8, placement: 'right', arrow: true, content: [text('Privé')], class: 'TooltipContent border border-light-30 dark:border-dark-30 px-2 py-1 bg-light-10 dark:bg-dark-10 text-light-70 dark:text-dark-70 z-50' }) : undefined,
|
||||
])]);
|
||||
}, (item) => item.navigable);
|
||||
(path.value?.split('/').map((e, i, a) => a.slice(0, i).join('/')) ?? []).forEach(e => tree.toggle(e, true));
|
||||
const treeParent = useTemplateRef('treeParent');
|
||||
|
||||
const unmount = useRouter().afterEach((to, from, failure) => {
|
||||
if(failure)
|
||||
return;
|
||||
|
||||
to.name === 'explore-path' && (unifySlug(to.params.path).split('/').map((e, i, a) => a.slice(0, i).join('/')) ?? []).forEach(e => tree.toggle(e, true));
|
||||
});
|
||||
|
||||
watch(route, () => {
|
||||
open.value = false;
|
||||
});
|
||||
|
||||
const { tree } = useContent();
|
||||
const pages = computed(() => transform(tree.value));
|
||||
function transform(list: TreeItem[] | undefined): TreeItem[] | undefined
|
||||
{
|
||||
return list?.filter(e => e.navigable)?.map(e => ({ ...e, open: path.value?.startsWith(e.path), children: transform(e.children) }));
|
||||
}
|
||||
onMounted(() => {
|
||||
if(treeParent.value)
|
||||
{
|
||||
treeParent.value.appendChild(tree.container);
|
||||
}
|
||||
})
|
||||
onUnmounted(() => {
|
||||
unmount();
|
||||
})
|
||||
</script>
|
||||
@@ -16,6 +16,11 @@ export default defineNuxtConfig({
|
||||
tailwindcss: {
|
||||
viewer: false,
|
||||
config: {
|
||||
content: {
|
||||
files: [
|
||||
"./shared/**/*.{vue,js,jsx,mjs,ts,tsx}"
|
||||
]
|
||||
},
|
||||
theme: {
|
||||
extend: {
|
||||
boxShadow: {
|
||||
@@ -114,6 +119,7 @@ export default defineNuxtConfig({
|
||||
pageTransition: false,
|
||||
layoutTransition: false
|
||||
},
|
||||
ssr: false,
|
||||
components: [
|
||||
{
|
||||
path: '~/components',
|
||||
@@ -135,6 +141,7 @@ export default defineNuxtConfig({
|
||||
runtimeConfig: {
|
||||
session: {
|
||||
password: '699c46bd-9aaa-4364-ad01-510ee4fe7013',
|
||||
maxAge: 60 * 60 * 24 * 30,
|
||||
},
|
||||
database: 'db.sqlite',
|
||||
mail: {
|
||||
@@ -177,5 +184,10 @@ export default defineNuxtConfig({
|
||||
key: fs.readFileSync(path.resolve(__dirname, 'localhost+1-key.pem')).toString('utf-8'),
|
||||
cert: fs.readFileSync(path.resolve(__dirname, 'localhost+1.pem')).toString('utf-8'),
|
||||
}
|
||||
},
|
||||
vue: {
|
||||
compilerOptions: {
|
||||
isCustomElement: (tag) => tag === 'iconify-icon',
|
||||
}
|
||||
}
|
||||
})
|
||||
@@ -8,7 +8,10 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"@atlaskit/pragmatic-drag-and-drop": "^1.5.0",
|
||||
"@atlaskit/pragmatic-drag-and-drop-auto-scroll": "^2.1.0",
|
||||
"@atlaskit/pragmatic-drag-and-drop-hitbox": "^1.0.3",
|
||||
"@codemirror/lang-markdown": "^6.3.2",
|
||||
"@floating-ui/dom": "^1.6.13",
|
||||
"@iconify/vue": "^4.3.0",
|
||||
"@lezer/highlight": "^1.2.1",
|
||||
"@markdoc/markdoc": "^0.5.1",
|
||||
@@ -19,12 +22,12 @@
|
||||
"@vueuse/gesture": "^2.0.0",
|
||||
"@vueuse/math": "^12.7.0",
|
||||
"@vueuse/nuxt": "^12.7.0",
|
||||
"codemirror": "5.65.18",
|
||||
"codemirror": "6.0.1",
|
||||
"drizzle-orm": "^0.39.3",
|
||||
"hast": "^1.0.0",
|
||||
"hast-util-heading": "^3.0.0",
|
||||
"hast-util-heading-rank": "^3.0.0",
|
||||
"hypermd": "^0.3.11",
|
||||
"iconify-icon": "^2.3.0",
|
||||
"lodash.capitalize": "^4.2.1",
|
||||
"mdast-util-find-and-replace": "^3.0.2",
|
||||
"nodemailer": "^6.10.0",
|
||||
|
||||
@@ -31,7 +31,8 @@
|
||||
</script>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { format, iconByType } from '~/shared/general.util';
|
||||
import { format } from '~/shared/general.util';
|
||||
import { iconByType } from '~/shared/content.util';
|
||||
import { Icon } from '@iconify/vue/dist/iconify.js';
|
||||
|
||||
interface File
|
||||
|
||||
@@ -1,24 +1,23 @@
|
||||
<template>
|
||||
<div class="flex flex-1 justify-start items-start" v-if="overview">
|
||||
<div class="flex flex-1 justify-start items-start" ref="element">
|
||||
<Head>
|
||||
<Title>d[any] - {{ overview.title }}</Title>
|
||||
<Title>d[any] - {{ overview?.title ?? "Erreur" }}</Title>
|
||||
</Head>
|
||||
<Markdown v-if="overview.type === 'markdown'" :path="path" />
|
||||
<Canvas v-else-if="overview.type === 'canvas'" :path="path" />
|
||||
<ProseH2 v-else class="flex-1 text-center">Impossible d'afficher le contenu demandé</ProseH2>
|
||||
</div>
|
||||
<div v-else>
|
||||
<Head>
|
||||
<Title>d[any] - Erreur</Title>
|
||||
</Head>
|
||||
<div><ProseH2>Impossible d'afficher le contenu demandé</ProseH2></div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
const route = useRouter().currentRoute;
|
||||
const path = computed(() => Array.isArray(route.value.params.path) ? route.value.params.path[0] : route.value.params.path);
|
||||
import { Content } from '#shared/content.util';
|
||||
import { unifySlug } from '#shared/general.util';
|
||||
|
||||
const { content } = useContent();
|
||||
const overview = computed(() => content.value.find(e => e.path === path.value));
|
||||
const element = useTemplateRef('element'), overview = ref();
|
||||
const route = useRouter().currentRoute;
|
||||
const path = computed(() => unifySlug(route.value.params.path));
|
||||
|
||||
onMounted(async () => {
|
||||
if(element.value && path.value && await Content.ready)
|
||||
{
|
||||
overview.value = Content.render(element.value, path.value);
|
||||
}
|
||||
});
|
||||
</script>
|
||||
@@ -2,228 +2,113 @@
|
||||
<Head>
|
||||
<Title>d[any] - Modification</Title>
|
||||
</Head>
|
||||
<ClientOnly>
|
||||
<CollapsibleRoot asChild class="flex flex-1 flex-col xl:-mx-12 xl:-my-8 lg:-mx-8 lg:-my-6 -mx-6 -my-3 overflow-hidden" v-model="open">
|
||||
<div>
|
||||
<div class="z-50 flex w-full items-center justify-between border-b border-light-35 dark:border-dark-35 px-2">
|
||||
<div class="flex items-center px-2 gap-4">
|
||||
<CollapsibleTrigger asChild>
|
||||
<Button icon class="!bg-transparent group md:hidden">
|
||||
<Icon class="group-data-[state=open]:hidden" icon="radix-icons:hamburger-menu" />
|
||||
<Icon class="group-data-[state=closed]:hidden" icon="radix-icons:cross-1" />
|
||||
</Button>
|
||||
</CollapsibleTrigger>
|
||||
<NuxtLink class="text-light-100 dark:text-dark-100 hover:text-opacity-70 m-2 flex items-center gap-4" aria-label="Accueil" :to="{ path: '/', force: true }">
|
||||
<Avatar src="/logo.dark.svg" class="dark:block hidden" />
|
||||
<Avatar src="/logo.light.svg" class="block dark:hidden" />
|
||||
<span class="text-xl max-md:hidden">d[any]</span>
|
||||
</NuxtLink>
|
||||
</div>
|
||||
<div class="flex items-center px-2 gap-4">
|
||||
<NuxtLink class="text-light-100 dark:text-dark-100 hover:text-light-70 dark:hover:text-dark-70" :to="{ name: 'user-login' }">{{ user!.username }}</NuxtLink>
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex flex-1 flex-row relative overflow-hidden">
|
||||
<CollapsibleContent asChild forceMount>
|
||||
<div class="bg-light-0 dark:bg-dark-0 z-40 w-screen md:w-[18rem] border-r border-light-30 dark:border-dark-30 flex flex-col justify-between my-2 max-md:data-[state=closed]:hidden">
|
||||
<div class="flex-1 px-2 max-w-full max-h-full overflow-y-auto overflow-x-hidden">
|
||||
<div class="flex flex-row justify-between items-center pt-2 pb-4 mb-2 px-2 gap-4 border-b border-light-35 dark:border-dark-35">
|
||||
<Button @click="router.push({ name: 'explore-path', params: { path: selected ? getPath(selected) : 'index' } })">Quitter</Button>
|
||||
<Button @click="save(true);">Enregistrer</Button>
|
||||
<Tooltip side="top" message="Nouveau">
|
||||
<DropdownMenu align="end" side="bottom" :options="[{
|
||||
type: 'item',
|
||||
label: 'Markdown',
|
||||
kbd: 'Ctrl+N',
|
||||
icon: 'radix-icons:file-text',
|
||||
select: () => add('markdown'),
|
||||
}, {
|
||||
type: 'item',
|
||||
label: 'Dossier',
|
||||
kbd: 'Ctrl+Shift+N',
|
||||
icon: 'lucide:folder',
|
||||
select: () => add('folder'),
|
||||
}, {
|
||||
type: 'item',
|
||||
label: 'Canvas',
|
||||
icon: 'ph:graph-light',
|
||||
select: () => add('canvas'),
|
||||
}, {
|
||||
type: 'item',
|
||||
label: 'Carte',
|
||||
icon: 'lucide:map',
|
||||
select: () => add('map'),
|
||||
}, {
|
||||
type: 'item',
|
||||
label: 'Fichier',
|
||||
icon: 'radix-icons:file',
|
||||
select: () => add('file'),
|
||||
}]">
|
||||
<Button icon><Icon class="w-5 h-5" icon="radix-icons:plus" /></Button>
|
||||
</DropdownMenu>
|
||||
</Tooltip>
|
||||
</div>
|
||||
<DraggableTree class="ps-4 text-sm" :items="navigation ?? undefined" :get-key="(item: Partial<TreeItemEditable>) => item.path !== undefined ? getPath(item as TreeItemEditable) : ''" @updateTree="drop"
|
||||
v-model="selected" :defaultExpanded="defaultExpanded" :get-children="(item: Partial<TreeItemEditable>) => item.type === 'folder' ? item.children : undefined" >
|
||||
<template #default="{ handleToggle, handleSelect, isExpanded, isDragging, item }">
|
||||
<div class="flex flex-1 items-center overflow-hidden" :class="{ 'opacity-50': isDragging }" :style="{ 'padding-left': `${item.level / 2 - 0.5}em` }">
|
||||
<div class="flex flex-1 items-center hover:border-accent-blue hover:text-accent-purple group-data-[selected]:text-accent-blue">
|
||||
<Icon @click="handleToggle" v-if="item.hasChildren" icon="radix-icons:chevron-right" :class="{ 'rotate-90': isExpanded }" class="h-4 w-4 transition-transform absolute" :style="{ 'left': `${item.level / 2 - 1.5}em` }" />
|
||||
<Icon v-else-if="iconByType[item.value.type]" :icon="iconByType[item.value.type]" class="w-5 h-5" @click="handleSelect" />
|
||||
<div class="pl-1.5 py-1.5 flex-1 truncate" :title="item.value.title" @click="handleSelect" :class="{ 'font-semibold': item.hasChildren }">
|
||||
{{ item.value.title }}
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex gap-2">
|
||||
<span @click="item.value.private = !item.value.private">
|
||||
<Icon v-if="item.value.private" icon="radix-icons:lock-closed" />
|
||||
<Icon v-else class="text-light-50 dark:text-dark-50" icon="radix-icons:lock-open-2" />
|
||||
</span>
|
||||
<span @click="item.value.navigable = !item.value.navigable">
|
||||
<Icon v-if="item.value.navigable" icon="radix-icons:eye-open" />
|
||||
<Icon v-else class="text-light-50 dark:text-dark-50" icon="radix-icons:eye-none" />
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<template #hint="{ instruction }">
|
||||
<div v-if="instruction" class="absolute h-full w-full top-0 right-0 border-light-50 dark:border-dark-50" :style="{
|
||||
width: `calc(100% - ${instruction.currentLevel / 2 - 1.5}em)`
|
||||
}" :class="{
|
||||
'!border-b-4': instruction?.type === 'reorder-below',
|
||||
'!border-t-4': instruction?.type === 'reorder-above',
|
||||
'!border-4': instruction?.type === 'make-child',
|
||||
}"></div>
|
||||
</template>
|
||||
</DraggableTree>
|
||||
</div>
|
||||
<div class="xl:px-12 px-6 pt-4 pb-2 text-center text-xs text-light-60 dark:text-dark-60">
|
||||
<NuxtLink class="hover:underline italic" :to="{ name: 'roadmap' }">Roadmap</NuxtLink> - <NuxtLink class="hover:underline italic" :to="{ name: 'legal' }">Mentions légales</NuxtLink>
|
||||
<p>Copyright Peaceultime - 2025</p>
|
||||
</div>
|
||||
</div>
|
||||
</CollapsibleContent>
|
||||
<div class="flex flex-1 flex-row max-h-full overflow-hidden">
|
||||
<div v-if="selected" class="flex flex-1 flex-col items-start justify-start max-h-full relative">
|
||||
<Head>
|
||||
<Title>d[any] - Modification de {{ selected.title }}</Title>
|
||||
</Head>
|
||||
<CollapsibleRoot v-model:open="topOpen" class="group data-[state=open]:mt-4 w-full relative">
|
||||
<CollapsibleTrigger asChild>
|
||||
<Button class="absolute left-1/2 -translate-x-1/2 group-data-[state=open]:-bottom-3 group-data-[state=closed]:-bottom-6 z-30" icon>
|
||||
<Icon v-if="topOpen" icon="radix-icons:caret-up" class="h-4 w-4" />
|
||||
<Icon v-else icon="radix-icons:caret-down" class="h-4 w-4" />
|
||||
</Button>
|
||||
</CollapsibleTrigger>
|
||||
<CollapsibleContent class="xl:px-12 lg:px-8 px-6">
|
||||
<div class="pb-2 grid lg:grid-cols-2 grid-cols-1 lg:items-center justify-between gap-x-4 flex-1 border-b border-light-35 dark:border-dark-35">
|
||||
<input type="text" v-model="selected.title" @input="() => {
|
||||
if(selected && !selected.customPath)
|
||||
{
|
||||
selected.name = parsePath(selected.title);
|
||||
rebuildPath(selected.children, getPath(selected));
|
||||
}
|
||||
}" placeholder="Titre" style="line-height: normal;" class="flex-1 md:text-5xl text-4xl md:h-14 h-12 caret-light-50 dark:caret-dark-50 text-light-100 dark:text-dark-100 placeholder:text-light-50 dark:placeholder:text-dark-50 appearance-none outline-none pb-3 font-thin bg-transparent"/>
|
||||
<div class="flex flex-row justify-between items-center gap-x-4">
|
||||
<div v-if="selected.customPath" class="flex lg:items-center truncate">
|
||||
<pre class="md:text-base text-sm truncate" style="direction: rtl">/{{ selected.parent !== '' ? selected.parent + '/' : '' }}</pre>
|
||||
<TextInput v-model="selected.name" @input="(e: Event) => {
|
||||
if(selected && selected.customPath)
|
||||
{
|
||||
selected.name = parsePath(selected.name);
|
||||
rebuildPath(selected.children, getPath(selected));
|
||||
}
|
||||
}" class="mx-0 font-mono"/>
|
||||
</div>
|
||||
<pre v-else class="md:text-base text-sm truncate" style="direction: rtl">{{ getPath(selected) }}/</pre>
|
||||
<div class="flex gap-4">
|
||||
<Dialog :title="`Supprimer '${selected.title}'${selected.children?.length ?? 0 > 0 ? ' et ses enfants' : ''}`">
|
||||
<template #trigger><Button icon class="bg-light-red dark:bg-dark-red !bg-opacity-40 border-light-red dark:border-dark-red hover:bg-light-red dark:hover:bg-dark-red hover:!bg-opacity-70 hover:border-light-red dark:hover:border-dark-red"><Icon icon="radix-icons:trash" /></Button></template>
|
||||
<template #default>
|
||||
<div class="flex gap-4">
|
||||
<DialogClose><Button @click="navigation = tree.remove(navigation, getPath(selected)); selected = undefined;" class="bg-light-red dark:bg-dark-red !bg-opacity-40 border-light-red dark:border-dark-red hover:bg-light-red dark:hover:bg-dark-red hover:!bg-opacity-70 hover:border-light-red dark:hover:border-dark-red">Oui</Button></DialogClose>
|
||||
<DialogClose><Button>Non</Button></DialogClose>
|
||||
</div>
|
||||
</template>
|
||||
</Dialog>
|
||||
<Dialog title="Préférences Markdown" v-if="selected.type === 'markdown'">
|
||||
<template #trigger><Button icon><Icon icon="radix-icons:gear" /></Button></template>
|
||||
<template #default>
|
||||
<Select label="Editeur de markdown" :modelValue="preferences.markdown.editing" @update:model-value="v => preferences.markdown.editing = (v as 'reading' | 'editing' | 'split')">
|
||||
<SelectItem label="Mode lecture" value="reading" />
|
||||
<SelectItem label="Mode edition" value="editing" />
|
||||
<SelectItem label="Ecran partagé" value="split" />
|
||||
</Select>
|
||||
</template>
|
||||
</Dialog>
|
||||
<DropdownMenu align="end" :options="[{
|
||||
type: 'checkbox',
|
||||
label: 'URL custom',
|
||||
select: (state: boolean) => { selected!.customPath = state; if(!state) selected!.name = parsePath(selected!.title) },
|
||||
checked: selected.customPath
|
||||
}]">
|
||||
<Button icon><Icon icon="radix-icons:dots-vertical"/></Button>
|
||||
</DropdownMenu>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</CollapsibleContent>
|
||||
</CollapsibleRoot>
|
||||
<div class="py-4 flex-1 w-full max-h-full flex overflow-hidden xl:px-12 lg:px-8 px-6 relative">
|
||||
<template v-if="selected.type === 'markdown'">
|
||||
<div v-if="contentStatus === 'pending'" class="flex flex-1 justify-center items-center">
|
||||
<Loading />
|
||||
</div>
|
||||
<span v-else-if="contentError">{{ contentError }}</span>
|
||||
<template v-else-if="preferences.markdown.editing === 'editing'">
|
||||
<Editor v-model="selected.content" autofocus class="flex-1 bg-transparent appearance-none outline-none max-h-full resize-none !overflow-y-auto lg:mx-16 xl:mx-32 2xl:mx-64" />
|
||||
</template>
|
||||
<template v-else-if="preferences.markdown.editing === 'reading'">
|
||||
<div class="flex-1 max-h-full !overflow-y-auto px-4 xl:px-32 2xl:px-64"><MarkdownRenderer :content="(debounced as string)" :proses="{ 'a': FakeA }" /></div>
|
||||
</template>
|
||||
<template v-else-if="preferences.markdown.editing === 'split'">
|
||||
<SplitterGroup direction="horizontal" class="flex-1 w-full flex">
|
||||
<SplitterPanel asChild collapsible :collapsedSize="0" :minSize="20" v-slot="{ isCollapsed }" :defaultSize="50">
|
||||
<Editor v-model="selected.content" autofocus class="flex-1 bg-transparent appearance-none outline-none max-h-full resize-none !overflow-y-auto" :class="{ 'hidden': isCollapsed }" />
|
||||
</SplitterPanel>
|
||||
<SplitterResizeHandle class="bg-light-35 dark:bg-dark-35 w-px xl!mx-4 mx-2" />
|
||||
<SplitterPanel asChild collapsible :collapsedSize="0" :minSize="20" v-slot="{ isCollapsed }">
|
||||
<div class="flex-1 max-h-full !overflow-y-auto px-8" :class="{ 'hidden': isCollapsed }"><MarkdownRenderer :content="(debounced as string)" :proses="{ 'a': FakeA }" /></div>
|
||||
</SplitterPanel>
|
||||
</SplitterGroup>
|
||||
</template>
|
||||
</template>
|
||||
<template v-else-if="selected.type === 'canvas'">
|
||||
<CanvasEditor v-if="selected.content" :modelValue="selected.content" :path="getPath(selected)" />
|
||||
</template>
|
||||
<template v-else-if="selected.type === 'map'">
|
||||
<span class="flex flex-1 justify-center items-center"><ProseH3>Editeur de carte en cours de développement</ProseH3></span>
|
||||
</template>
|
||||
<template v-else-if="selected.type === 'file'">
|
||||
<span>Modifier le contenu :</span><input type="file" @change="(e: Event) => console.log((e.target as HTMLInputElement).files?.length)" />
|
||||
</template>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex flex-1 flex-col xl:-mx-12 xl:-my-8 lg:-mx-8 lg:-my-6 -mx-6 -my-3 overflow-hidden">
|
||||
<div class="z-30 flex w-full items-center justify-between border-b border-light-35 dark:border-dark-35 px-2">
|
||||
<div class="flex items-center px-2 gap-4">
|
||||
<!-- <CollapsibleTrigger asChild>
|
||||
<Button icon class="!bg-transparent group md:hidden">
|
||||
<Icon class="group-data-[state=open]:hidden" icon="radix-icons:hamburger-menu" />
|
||||
<Icon class="group-data-[state=closed]:hidden" icon="radix-icons:cross-1" />
|
||||
</Button>
|
||||
</CollapsibleTrigger> -->
|
||||
<NuxtLink class="text-light-100 dark:text-dark-100 hover:text-opacity-70 m-2 flex items-center gap-4" aria-label="Accueil" :to="{ path: '/', force: true }">
|
||||
<Avatar src="/logo.dark.svg" class="dark:block hidden" />
|
||||
<Avatar src="/logo.light.svg" class="block dark:hidden" />
|
||||
<span class="text-xl max-md:hidden">d[any]</span>
|
||||
</NuxtLink>
|
||||
</div>
|
||||
<div class="flex items-center px-2 gap-4">
|
||||
<NuxtLink class="text-light-100 dark:text-dark-100 hover:text-light-70 dark:hover:text-dark-70" :to="{ name: 'user-login' }">{{ user!.username }}</NuxtLink>
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex flex-1 flex-row relative h-screen overflow-hidden">
|
||||
<div class="bg-light-0 dark:bg-dark-0 z-40 w-screen md:w-[18rem] border-r border-light-30 dark:border-dark-30 flex flex-col justify-between my-2 max-md:data-[state=closed]:hidden">
|
||||
<div class="flex-1 px-2 max-w-full max-h-full overflow-y-auto overflow-x-hidden" ref="tree"></div>
|
||||
<div class="xl:px-12 px-6 pt-4 pb-2 text-center text-xs text-light-60 dark:text-dark-60">
|
||||
<NuxtLink class="hover:underline italic" :to="{ name: 'roadmap' }">Roadmap</NuxtLink> - <NuxtLink class="hover:underline italic" :to="{ name: 'legal' }">Mentions légales</NuxtLink>
|
||||
<p>Copyright Peaceultime - 2025</p>
|
||||
</div>
|
||||
</div>
|
||||
</CollapsibleRoot>
|
||||
</ClientOnly>
|
||||
<div class="flex flex-1 flex-row max-h-full overflow-hidden" ref="container"></div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { Icon } from '@iconify/vue/dist/iconify.js';
|
||||
import type { Instruction } from '@atlaskit/pragmatic-drag-and-drop-hitbox/dist/types/tree-item';
|
||||
import { iconByType, convertContentFromText, convertContentToText, DEFAULT_CONTENT,parsePath } from '#shared/general.util';
|
||||
import type { ExploreContent, FileType, TreeItem } from '~/types/content';
|
||||
import FakeA from '~/components/prose/FakeA.vue';
|
||||
import type { Preferences } from '~/types/general';
|
||||
import { Content, Editor } from '#shared/content.util';
|
||||
import { button, loading } from '#shared/proses';
|
||||
import { dom, icon, text } from '~/shared/dom.util';
|
||||
import { modal, popper } from '~/shared/floating.util';
|
||||
|
||||
definePageMeta({
|
||||
rights: ['admin', 'editor'],
|
||||
layout: 'null',
|
||||
});
|
||||
|
||||
export type TreeItemEditable = TreeItem &
|
||||
const toaster = useToast();
|
||||
const { user } = useUserSession();
|
||||
const tree = useTemplateRef('tree'), container = useTemplateRef('container');
|
||||
let editor: Editor;
|
||||
|
||||
function pull()
|
||||
{
|
||||
parent: string;
|
||||
name: string;
|
||||
customPath: boolean;
|
||||
Content.pull().then(e => {
|
||||
toaster.add({ type: 'success', content: 'Données mises à jour avec succès.', timer: true, duration: 7500 });
|
||||
}).catch(e => {
|
||||
toaster.add({ type: 'success', content: 'Une erreur est survenue durant la récupération des données.', timer: true, duration: 7500 });
|
||||
console.error(e);
|
||||
});
|
||||
}
|
||||
function push()
|
||||
{
|
||||
const { close } = modal([dom('div', { class: 'flex flex-col gap-4 justify-center items-center' }, [ dom('div', { class: 'text-xl', text: 'Mise à jour des données' }), loading('large') ])], { priority: false, closeWhenOutside: true, });
|
||||
Content.push().then(e => {
|
||||
close();
|
||||
toaster.add({ type: 'success', content: 'Données mises à jour avec succès.', timer: true, duration: 7500 });
|
||||
}).catch(e => {
|
||||
close();
|
||||
toaster.add({ type: 'success', content: 'Une erreur est survenue durant l\'enregistrement des données.', timer: true, duration: 7500 });
|
||||
console.error(e);
|
||||
});
|
||||
}
|
||||
|
||||
onMounted(async () => {
|
||||
if(tree.value && container.value && await Content.ready)
|
||||
{
|
||||
const load = loading('normal');
|
||||
tree.value.appendChild(load);
|
||||
|
||||
const content = dom('div', { class: 'flex flex-row justify-start items-center gap-4 p-2' }, [
|
||||
popper(button(icon('ph:cloud-arrow-down', { height: 20, width: 20 }), pull, 'p-1'), { placement: 'top', offset: 4, delay: 120, arrow: true, content: [text('Actualiser')], class: 'TooltipContent border border-light-30 dark:border-dark-30 px-2 py-1 bg-light-10 dark:bg-dark-10 text-light-70 dark:text-dark-70 z-50' }),
|
||||
popper(button(icon('ph:cloud-arrow-up', { height: 20, width: 20 }), push, 'p-1'), { placement: 'top', offset: 4, delay: 120, arrow: true, content: [text('Enregistrer')], class: 'TooltipContent border border-light-30 dark:border-dark-30 px-2 py-1 bg-light-10 dark:bg-dark-10 text-light-70 dark:text-dark-70 z-50' }),
|
||||
])
|
||||
|
||||
tree.value.insertBefore(content, load);
|
||||
|
||||
editor = new Editor();
|
||||
|
||||
tree.value.replaceChild(editor.tree.container, load);
|
||||
container.value.appendChild(editor.container);
|
||||
}
|
||||
});
|
||||
|
||||
onBeforeUnmount(() => {
|
||||
editor?.unmount();
|
||||
})
|
||||
/* import { Icon } from '@iconify/vue/dist/iconify.js';
|
||||
import type { Instruction } from '@atlaskit/pragmatic-drag-and-drop-hitbox/dist/types/tree-item';
|
||||
import type { FileType, LocalContent, TreeItem } from '#shared/content.util';
|
||||
import { DEFAULT_CONTENT, iconByType, Content, getPath } from '#shared/content.util';
|
||||
import type { Preferences } from '~/types/general';
|
||||
import { fakeA as proseA } from '#shared/proses';
|
||||
import { parsePath } from '~/shared/general.util';
|
||||
import type { CanvasContent } from '~/types/canvas';
|
||||
|
||||
export type TreeItemEditable = LocalContent &
|
||||
{
|
||||
parent?: string;
|
||||
name?: string;
|
||||
customPath?: boolean;
|
||||
children?: TreeItemEditable[];
|
||||
}
|
||||
|
||||
@@ -240,225 +125,73 @@ const open = ref(true), topOpen = ref(true);
|
||||
const toaster = useToast();
|
||||
const saveStatus = ref<'idle' | 'pending' | 'success' | 'error'>('idle');
|
||||
|
||||
const { content: complete, tree: project } = useContent();
|
||||
const navigation = ref<TreeItemEditable[]>(transform(JSON.parse(JSON.stringify(project.value)))!);
|
||||
const selected = ref<TreeItemEditable>(), edited = ref(false);
|
||||
const contentStatus = ref<'idle' | 'pending' | 'success' | 'error'>('idle'), contentError = ref<string>();
|
||||
let navigation = Content.tree as TreeItemEditable[];
|
||||
const selected = ref<TreeItemEditable>();
|
||||
|
||||
const preferences = useCookie<Preferences>('preferences', { default: () => ({ markdown: { editing: 'split' }, canvas: { snap: true, size: 32 } }), watch: true, maxAge: 60*60*24*31 });
|
||||
const preferences = useCookie<Preferences>('preferences', { default: () => ({ markdown: { editing: 'split' }, canvas: { gridSnap: true, neighborSnap: true, spacing: 32 } }), watch: true, maxAge: 60*60*24*31 });
|
||||
|
||||
watch(selected, async (value, old) => {
|
||||
if(selected.value)
|
||||
{
|
||||
if(!selected.value.content && selected.value.path)
|
||||
{
|
||||
contentStatus.value = 'pending';
|
||||
try
|
||||
{
|
||||
const storedEdit = sessionStorage.getItem(`editing:${encodeURIComponent(selected.value.path)}`);
|
||||
selected.value = await Content.content(selected.value.path);
|
||||
}
|
||||
|
||||
if(storedEdit)
|
||||
{
|
||||
selected.value.content = convertContentFromText(selected.value.type, storedEdit);
|
||||
contentStatus.value = 'success';
|
||||
}
|
||||
else
|
||||
{
|
||||
selected.value.content = (await $fetch(`/api/file/content/${encodeURIComponent(selected.value.path)}`, { query: { type: 'editing'} }));
|
||||
contentStatus.value = 'success';
|
||||
}
|
||||
|
||||
//@ts-ignore
|
||||
debounced.value = selected.value.content ?? '';
|
||||
}
|
||||
catch(e)
|
||||
{
|
||||
contentError.value = (e as Error).message;
|
||||
contentStatus.value = 'error';
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
//@ts-ignore
|
||||
debounced.value = selected.value.content ?? '';
|
||||
}
|
||||
router.replace({ hash: '#' + encodeURIComponent(selected.value.path || getPath(selected.value)) });
|
||||
router.replace({ hash: '#' + encodeURIComponent(selected.value!.path || getPath(selected.value!)) });
|
||||
}
|
||||
else
|
||||
{
|
||||
router.replace({ hash: '' });
|
||||
}
|
||||
})
|
||||
const content = computed(() => selected.value?.content ?? '');
|
||||
const debounced = useDebounce(content, 250, { maxWait: 500 });
|
||||
const debouncedSave = useDebounceFn(save, 60000, { maxWait: 180000 });
|
||||
|
||||
watch(debounced, () => {
|
||||
if(selected.value && debounced.value)
|
||||
sessionStorage.setItem(`editing:${encodeURIComponent(selected.value.path)}`, typeof debounced.value === 'string' ? debounced.value : JSON.stringify(debounced.value));
|
||||
});
|
||||
useShortcuts({
|
||||
meta_s: { usingInput: true, handler: () => save(false), prevent: true },
|
||||
//meta_s: { usingInput: true, handler: () => save(), prevent: true },
|
||||
meta_n: { usingInput: true, handler: () => add('markdown'), prevent: true },
|
||||
meta_shift_n: { usingInput: true, handler: () => add('folder'), prevent: true },
|
||||
meta_shift_z: { usingInput: true, handler: () => router.push({ name: 'explore-path', params: { path: 'index' } }), prevent: true }
|
||||
})
|
||||
|
||||
const tree = {
|
||||
remove(data: TreeItemEditable[], id: string): TreeItemEditable[] {
|
||||
return data
|
||||
.filter(item => getPath(item) !== id)
|
||||
.map((item) => {
|
||||
if (tree.hasChildren(item)) {
|
||||
return {
|
||||
...item,
|
||||
children: tree.remove(item.children ?? [], id),
|
||||
};
|
||||
}
|
||||
return item;
|
||||
});
|
||||
},
|
||||
insertBefore(data: TreeItemEditable[], targetId: string, newItem: TreeItemEditable): TreeItemEditable[] {
|
||||
return data.flatMap((item) => {
|
||||
if (getPath(item) === targetId)
|
||||
return [newItem, item];
|
||||
|
||||
if (tree.hasChildren(item)) {
|
||||
return {
|
||||
...item,
|
||||
children: tree.insertBefore(item.children ?? [], targetId, newItem),
|
||||
};
|
||||
}
|
||||
return item;
|
||||
});
|
||||
},
|
||||
insertAfter(data: TreeItemEditable[], targetId: string, newItem: TreeItemEditable): TreeItemEditable[] {
|
||||
return data.flatMap((item) => {
|
||||
if (getPath(item) === targetId)
|
||||
return [item, newItem];
|
||||
|
||||
if (tree.hasChildren(item)) {
|
||||
return {
|
||||
...item,
|
||||
children: tree.insertAfter(item.children ?? [], targetId, newItem),
|
||||
};
|
||||
}
|
||||
|
||||
return item;
|
||||
});
|
||||
},
|
||||
insertChild(data: TreeItemEditable[], targetId: string, newItem: TreeItemEditable): TreeItemEditable[] {
|
||||
return data.flatMap((item) => {
|
||||
if (getPath(item) === targetId) {
|
||||
// already a parent: add as first child
|
||||
return {
|
||||
...item,
|
||||
// opening item so you can see where item landed
|
||||
isOpen: true,
|
||||
children: [newItem, ...item.children ?? []],
|
||||
};
|
||||
}
|
||||
|
||||
if (!tree.hasChildren(item))
|
||||
return item;
|
||||
|
||||
return {
|
||||
...item,
|
||||
children: tree.insertChild(item.children ?? [], targetId, newItem),
|
||||
};
|
||||
});
|
||||
},
|
||||
find(data: TreeItemEditable[], itemId: string): TreeItemEditable | undefined {
|
||||
for (const item of data) {
|
||||
if (getPath(item) === itemId)
|
||||
return item;
|
||||
|
||||
if (tree.hasChildren(item)) {
|
||||
const result = tree.find(item.children ?? [], itemId);
|
||||
if (result)
|
||||
return result;
|
||||
}
|
||||
}
|
||||
},
|
||||
search(data: TreeItemEditable[], prop: keyof TreeItemEditable, value: string): TreeItemEditable[] {
|
||||
const arr = [];
|
||||
|
||||
for (const item of data)
|
||||
{
|
||||
if (item[prop]?.toString().toLowerCase()?.startsWith(value.toLowerCase()))
|
||||
arr.push(item);
|
||||
|
||||
if (tree.hasChildren(item)) {
|
||||
arr.push(...tree.search(item.children ?? [], prop, value));
|
||||
}
|
||||
}
|
||||
|
||||
return arr;
|
||||
},
|
||||
getPathToItem({
|
||||
current,
|
||||
targetId,
|
||||
parentIds = [],
|
||||
}: {
|
||||
current: TreeItemEditable[]
|
||||
targetId: string
|
||||
parentIds?: string[]
|
||||
}): string[] | undefined {
|
||||
for (const item of current) {
|
||||
if (getPath(item) === targetId)
|
||||
return parentIds;
|
||||
|
||||
const nested = tree.getPathToItem({
|
||||
current: (item.children ?? []),
|
||||
targetId,
|
||||
parentIds: [...parentIds, getPath(item)],
|
||||
});
|
||||
if (nested)
|
||||
return nested;
|
||||
}
|
||||
},
|
||||
hasChildren(item: TreeItemEditable): boolean {
|
||||
return (item.children ?? []).length > 0;
|
||||
},
|
||||
}
|
||||
|
||||
function add(type: FileType): void
|
||||
{
|
||||
if(!navigation.value)
|
||||
if(!navigation)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
const news = [...tree.search(navigation.value, 'title', 'Nouveau')].filter((e, i, a) => a.indexOf(e) === i);
|
||||
const news = [...tree.search(navigation, 'title', 'Nouveau')].filter((e, i, a) => a.indexOf(e) === i);
|
||||
const title = `Nouveau${news.length > 0 ? ' (' + news.length +')' : ''}`;
|
||||
const item: TreeItemEditable = { navigable: true, private: false, parent: '', path: '', title: title, name: parsePath(title), type: type, order: 0, children: [], customPath: false, content: DEFAULT_CONTENT[type], owner: -1, timestamp: new Date(), visit: 0 };
|
||||
|
||||
if(!selected.value)
|
||||
{
|
||||
navigation.value = [...navigation.value, item];
|
||||
navigation = [...navigation, item];
|
||||
}
|
||||
else if(selected.value?.children)
|
||||
{
|
||||
item.parent = getPath(selected.value);
|
||||
navigation.value = tree.insertChild(navigation.value, item.parent, item);
|
||||
navigation = tree.insertChild(navigation, item.parent, item);
|
||||
}
|
||||
else
|
||||
{
|
||||
navigation.value = tree.insertAfter(navigation.value, getPath(selected.value), item);
|
||||
navigation = tree.insertAfter(navigation, getPath(selected.value), item);
|
||||
}
|
||||
}
|
||||
function updateTree(instruction: Instruction, itemId: string, targetId: string) : TreeItemEditable[] | undefined {
|
||||
if(!navigation.value)
|
||||
if(!navigation)
|
||||
return;
|
||||
|
||||
const item = tree.find(navigation.value, itemId);
|
||||
const target = tree.find(navigation.value, targetId);
|
||||
const item = tree.find(navigation, itemId);
|
||||
const target = tree.find(navigation, targetId);
|
||||
|
||||
if(!item)
|
||||
return;
|
||||
|
||||
if (instruction.type === 'reparent') {
|
||||
const path = tree.getPathToItem({
|
||||
current: navigation.value,
|
||||
current: navigation,
|
||||
targetId: targetId,
|
||||
});
|
||||
if (!path) {
|
||||
@@ -467,23 +200,23 @@ function updateTree(instruction: Instruction, itemId: string, targetId: string)
|
||||
}
|
||||
|
||||
const desiredId = path[instruction.desiredLevel];
|
||||
let result = tree.remove(navigation.value, itemId);
|
||||
let result = tree.remove(navigation, itemId);
|
||||
result = tree.insertAfter(result, desiredId, item);
|
||||
return result;
|
||||
}
|
||||
|
||||
// the rest of the actions require you to drop on something else
|
||||
if (itemId === targetId)
|
||||
return navigation.value;
|
||||
return navigation;
|
||||
|
||||
if (instruction.type === 'reorder-above') {
|
||||
let result = tree.remove(navigation.value, itemId);
|
||||
let result = tree.remove(navigation, itemId);
|
||||
result = tree.insertBefore(result, targetId, item);
|
||||
return result;
|
||||
}
|
||||
|
||||
if (instruction.type === 'reorder-below') {
|
||||
let result = tree.remove(navigation.value, itemId);
|
||||
let result = tree.remove(navigation, itemId);
|
||||
result = tree.insertAfter(result, targetId, item);
|
||||
return result;
|
||||
}
|
||||
@@ -492,13 +225,13 @@ function updateTree(instruction: Instruction, itemId: string, targetId: string)
|
||||
if(!target || target.type !== 'folder')
|
||||
return;
|
||||
|
||||
let result = tree.remove(navigation.value, itemId);
|
||||
let result = tree.remove(navigation, itemId);
|
||||
result = tree.insertChild(result, targetId, item);
|
||||
rebuildPath([item], targetId);
|
||||
return result;
|
||||
}
|
||||
|
||||
return navigation.value;
|
||||
return navigation;
|
||||
}
|
||||
function transform(items: TreeItem[] | undefined): TreeItemEditable[] | undefined
|
||||
{
|
||||
@@ -516,7 +249,7 @@ function flatten(items: TreeItemEditable[] | undefined): TreeItemEditable[]
|
||||
}
|
||||
function drop(instruction: Instruction, itemId: string, targetId: string)
|
||||
{
|
||||
navigation.value = updateTree(instruction, itemId, targetId) ?? navigation.value ?? [];
|
||||
navigation = updateTree(instruction, itemId, targetId) ?? navigation ?? [];
|
||||
}
|
||||
function rebuildPath(tree: TreeItemEditable[] | null | undefined, parentPath: string)
|
||||
{
|
||||
@@ -528,38 +261,14 @@ function rebuildPath(tree: TreeItemEditable[] | null | undefined, parentPath: st
|
||||
rebuildPath(e.children, getPath(e));
|
||||
});
|
||||
}
|
||||
async function save(redirect: boolean): Promise<void>
|
||||
function save()
|
||||
{
|
||||
//@ts-ignore
|
||||
const map = (e: TreeItemEditable[]): TreeItemEditable[] => e.map(f => ({ ...f, content: f.content ? convertContentToText(f.type, f.content) : undefined, children: f.children ? map(f.children) : undefined }));
|
||||
saveStatus.value = 'pending';
|
||||
try {
|
||||
const result = await $fetch(`/api/project`, {
|
||||
method: 'post',
|
||||
body: map(navigation.value),
|
||||
});
|
||||
saveStatus.value = 'success';
|
||||
edited.value = false;
|
||||
sessionStorage.clear();
|
||||
|
||||
toaster.clear('error');
|
||||
toaster.add({ type: 'success', content: 'Contenu enregistré', timer: true, duration: 10000 });
|
||||
|
||||
//@ts-ignore
|
||||
complete.value = result as ExploreContent[];
|
||||
if(redirect) router.go(-1);
|
||||
} catch(e: any) {
|
||||
toaster.add({
|
||||
type: 'error', content: e.message, timer: true, duration: 10000
|
||||
})
|
||||
console.error(e);
|
||||
saveStatus.value = 'error';
|
||||
if(selected.value && selected.value.content)
|
||||
{
|
||||
selected.value.path = getPath(selected.value);
|
||||
Content.save(selected.value);
|
||||
}
|
||||
}
|
||||
function getPath(item: TreeItemEditable): string
|
||||
{
|
||||
return [item.parent, parsePath(item.customPath ? item.name : item.title)].filter(e => !!e).join('/');
|
||||
}
|
||||
|
||||
const defaultExpanded = computed(() => {
|
||||
if(router.currentRoute.value.hash)
|
||||
@@ -568,11 +277,11 @@ const defaultExpanded = computed(() => {
|
||||
split.forEach((e, i) => { if(i !== 0) split[i] = split[i - 1] + '/' + e });
|
||||
return split;
|
||||
}
|
||||
})
|
||||
});
|
||||
watch(router.currentRoute, (value) => {
|
||||
if(value && value.hash && navigation.value)
|
||||
selected.value = tree.find(navigation.value, decodeURIComponent(value.hash.substring(1)));
|
||||
if(value && value.hash && navigation)
|
||||
selected.value = tree.find(navigation, decodeURIComponent(value.hash.substring(1)));
|
||||
else
|
||||
selected.value = undefined;
|
||||
}, { immediate: true });
|
||||
}, { immediate: true }); */
|
||||
</script>
|
||||
@@ -1,16 +0,0 @@
|
||||
import { z } from "zod";
|
||||
|
||||
export const fileType = z.enum(['folder', 'file', 'markdown', 'canvas', 'map']);
|
||||
export const schema = z.object({
|
||||
path: z.string(),
|
||||
owner: z.number().finite(),
|
||||
title: z.string(),
|
||||
type: fileType,
|
||||
content: z.string(),
|
||||
navigable: z.boolean(),
|
||||
private: z.boolean(),
|
||||
order: z.number().finite(),
|
||||
});
|
||||
|
||||
export type FileType = z.infer<typeof fileType>;
|
||||
export type File = z.infer<typeof schema>;
|
||||
@@ -1,16 +0,0 @@
|
||||
import { z } from "zod";
|
||||
import { fileType } from "./file";
|
||||
|
||||
export const single = z.object({
|
||||
path: z.string(),
|
||||
owner: z.number().finite(),
|
||||
title: z.string(),
|
||||
type: fileType,
|
||||
navigable: z.boolean(),
|
||||
private: z.boolean(),
|
||||
order: z.number().finite(),
|
||||
});
|
||||
export const table = z.array(single);
|
||||
|
||||
export type Navigation = z.infer<typeof table>;
|
||||
export type NavigationItem = z.infer<typeof single>;
|
||||
@@ -1,22 +1,16 @@
|
||||
import { z } from "zod";
|
||||
import { fileType } from "./file";
|
||||
import { projectFilesTable } from "~/db/schema";
|
||||
|
||||
const baseItem = z.object({
|
||||
export const Project = z.array(z.object({
|
||||
id: z.string(),
|
||||
path: z.string(),
|
||||
parent: z.string(),
|
||||
name: z.string(),
|
||||
title: z.string(),
|
||||
type: fileType,
|
||||
type: z.enum(projectFilesTable.type.enumValues),
|
||||
navigable: z.boolean(),
|
||||
private: z.boolean(),
|
||||
order: z.number().finite(),
|
||||
content: z.string().optional().or(z.null()),
|
||||
});
|
||||
export const item: z.ZodType<ProjectItem> = baseItem.extend({
|
||||
children: z.lazy(() => item.array().optional()),
|
||||
});
|
||||
export const project = z.array(item);
|
||||
timestamp: z.string(),
|
||||
}));
|
||||
|
||||
export type ProjectItem = z.infer<typeof baseItem> & {
|
||||
children?: ProjectItem[]
|
||||
};
|
||||
export type ProjectType = z.infer<typeof Project>;
|
||||
export type ProjectItemType = ProjectType[number];
|
||||
@@ -1,10 +1,10 @@
|
||||
import type { SitemapUrlInput } from '#sitemap/types'
|
||||
import { explorerContentTable } from '~/db/schema';
|
||||
import { projectFilesTable as files } from '~/db/schema';
|
||||
import useDatabase from '~/composables/useDatabase';
|
||||
|
||||
export default defineSitemapEventHandler(() => {
|
||||
const db = useDatabase();
|
||||
const pages = db.select({ path: explorerContentTable.path, lastMod: explorerContentTable.timestamp, navigable: explorerContentTable.navigable, private: explorerContentTable.private, type: explorerContentTable.type }).from(explorerContentTable).all();
|
||||
const pages = db.select({ path: files.path, lastMod: files.timestamp, navigable: files.navigable, private: files.private, type: files.type }).from(files).all();
|
||||
|
||||
return pages.filter(e => e.type !== 'folder' && e.navigable && !e.private && e.path.split('/').map((_, i, a) => a.slice(0, i).join('/')).every(p => !pages.find(_p => _p.path === p)?.private)).map(e => ({
|
||||
loc: `/explore/${encodeURIComponent(e.path)}`,
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import { ne, sql } from 'drizzle-orm';
|
||||
import useDatabase from '~/composables/useDatabase';
|
||||
import { explorerContentTable } from '~/db/schema';
|
||||
import { hasPermissions } from '~/shared/auth.util';
|
||||
import { projectFilesTable } from '~/db/schema';
|
||||
import { hasPermissions } from '#shared/auth.util';
|
||||
|
||||
export default defineEventHandler(async (e) => {
|
||||
const session = await getUserSession(e);
|
||||
@@ -16,17 +15,15 @@ export default defineEventHandler(async (e) => {
|
||||
|
||||
const db = useDatabase();
|
||||
const content = db.select({
|
||||
path: explorerContentTable.path,
|
||||
owner: explorerContentTable.owner,
|
||||
title: explorerContentTable.title,
|
||||
type: explorerContentTable.type,
|
||||
size: sql<number>`CASE WHEN ${explorerContentTable.content} IS NULL THEN 0 ELSE length(${explorerContentTable.content}) END`.as('size'),
|
||||
navigable: explorerContentTable.navigable,
|
||||
private: explorerContentTable.private,
|
||||
order: explorerContentTable.order,
|
||||
visit: explorerContentTable.visit,
|
||||
timestamp: explorerContentTable.timestamp,
|
||||
}).from(explorerContentTable).all();
|
||||
path: projectFilesTable.path,
|
||||
owner: projectFilesTable.owner,
|
||||
title: projectFilesTable.title,
|
||||
type: projectFilesTable.type,
|
||||
navigable: projectFilesTable.navigable,
|
||||
private: projectFilesTable.private,
|
||||
order: projectFilesTable.order,
|
||||
timestamp: projectFilesTable.timestamp,
|
||||
}).from(projectFilesTable).all();
|
||||
|
||||
content.sort((a, b) => {
|
||||
return a.path.split('/').length - b.path.split('/').length;
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
import { sql } from 'drizzle-orm';
|
||||
import useDatabase from '~/composables/useDatabase';
|
||||
import { userSessionsTable } from '~/db/schema';
|
||||
import { hasPermissions } from '~/shared/auth.util';
|
||||
|
||||
export default defineEventHandler(async (e) => {
|
||||
|
||||
@@ -93,8 +93,6 @@ export default defineEventHandler(async (e): Promise<Return> => {
|
||||
}
|
||||
}) as UserSessionRequired);
|
||||
|
||||
db.update(usersDataTable).set({ logCount: user.data.logCount + 1 }).where(eq(usersDataTable.id, user.id)).run();
|
||||
|
||||
setResponseStatus(e, 201);
|
||||
return { success: true, session: data };
|
||||
}
|
||||
|
||||
@@ -71,7 +71,7 @@ export default defineEventHandler(async (e): Promise<Return> => {
|
||||
|
||||
db.insert(usersDataTable).values({ id: sql.placeholder('id') }).prepare().run({ id: id.id });
|
||||
|
||||
logSession(e, await setUserSession(e, { user: { id: id.id, username: body.data.username, email: body.data.email, state: 0, signin: new Date(), permissions: [], lastTimestamp: new Date(), logCount: 1 } }) as UserSessionRequired);
|
||||
logSession(e, await setUserSession(e, { user: { id: id.id, username: body.data.username, email: body.data.email, state: 0, signin: new Date(), permissions: [], lastTimestamp: new Date() } }) as UserSessionRequired);
|
||||
|
||||
const emailId = Bun.hash('register' + id.id + hash, Date.now());
|
||||
const timestamp = Date.now() + 1000 * 60 * 60;
|
||||
|
||||
@@ -71,7 +71,7 @@ export default defineEventHandler(async (e): Promise<Return> => {
|
||||
|
||||
db.insert(usersDataTable).values({ id: sql.placeholder('id') }).prepare().run({ id: id.id });
|
||||
|
||||
logSession(e, await setUserSession(e, { user: { id: id.id, username: body.data.username, email: body.data.email, state: 0, signin: new Date(), permissions: [], lastTimestamp: new Date(), logCount: 1 } }) as UserSessionRequired);
|
||||
logSession(e, await setUserSession(e, { user: { id: id.id, username: body.data.username, email: body.data.email, state: 0, signin: new Date(), permissions: [], lastTimestamp: new Date() } }) as UserSessionRequired);
|
||||
|
||||
await runTask('mail', {
|
||||
payload: {
|
||||
|
||||
@@ -1,37 +0,0 @@
|
||||
import useDatabase from '~/composables/useDatabase';
|
||||
import { explorerContentTable } from '~/db/schema';
|
||||
import { schema } from '~/schemas/file';
|
||||
import { parsePath } from '~/shared/general.util';
|
||||
|
||||
export default defineEventHandler(async (e) => {
|
||||
const body = await readValidatedBody(e, schema.safeParse);
|
||||
if(!body.success)
|
||||
{
|
||||
setResponseStatus(e, 403);
|
||||
throw body.error;
|
||||
}
|
||||
|
||||
const db = useDatabase();
|
||||
|
||||
const buffer = Buffer.from(convertToStorableLinks(body.data.content, db.select({ path: explorerContentTable.path }).from(explorerContentTable).all().map(e => e.path)), 'utf-8');
|
||||
|
||||
const content = db.insert(explorerContentTable).values({ ...body.data, content: buffer }).onConflictDoUpdate({ target: explorerContentTable.path, set: { ...body.data, content: buffer, timestamp: new Date() } });
|
||||
|
||||
if(content !== undefined)
|
||||
{
|
||||
return content;
|
||||
}
|
||||
|
||||
setResponseStatus(e, 404);
|
||||
return;
|
||||
});
|
||||
|
||||
export function convertToStorableLinks(content: string, path: string[]): string
|
||||
{
|
||||
return content.replaceAll(/!?\[\[([^\[\]\|\#]+)?(#+[^\[\]\|\#]+)?(\|[^\[\]\|\#]+)?\]\]/g, (e: string, a1?: string, a2?: string , a3?: string) => {
|
||||
const parsed = parsePath(a1 ?? '%%%%----%%%%----%%%%');
|
||||
const replacer = path.find(e => e.endsWith(parsed));
|
||||
const value = `[[${a1 ? (replacer ?? '') : ''}${a2 ?? ''}${(!a3 && a1 && replacer !== parsed ? '|' + a1 : a3) ?? ''}]]`;
|
||||
return value;
|
||||
});
|
||||
}
|
||||
46
server/api/file/content/[id].get.ts
Normal file
46
server/api/file/content/[id].get.ts
Normal file
@@ -0,0 +1,46 @@
|
||||
import { eq, sql } from 'drizzle-orm';
|
||||
import useDatabase from '~/composables/useDatabase';
|
||||
import { projectFilesTable as files, projectContentTable as content } from '~/db/schema';
|
||||
|
||||
export default defineEventHandler(async (e) => {
|
||||
try
|
||||
{
|
||||
const id = getRouterParam(e, "id") ?? '';
|
||||
if(!id)
|
||||
{
|
||||
setResponseStatus(e, 404);
|
||||
return;
|
||||
}
|
||||
|
||||
const db = useDatabase();
|
||||
const data = db.select({ content: sql<string>`cast(${content.content} as TEXT)`.as('content'), private: files.private, owner: files.owner, }).from(content).leftJoin(files, eq(content.id, files.id)).where(eq(content.id, id)).get();
|
||||
|
||||
if(data && data.content)
|
||||
{
|
||||
const session = await getUserSession(e);
|
||||
|
||||
if(!session || !session.user || session.user.id !== data.owner)
|
||||
{
|
||||
if(data.private)
|
||||
{
|
||||
setResponseStatus(e, 404);
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
return data.content.replace(/%%(.+?)%%/g, "");
|
||||
}
|
||||
}
|
||||
|
||||
return data.content;
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
catch(_e)
|
||||
{
|
||||
console.error(_e);
|
||||
setResponseStatus(e, 500);
|
||||
return;
|
||||
}
|
||||
});
|
||||
43
server/api/file/content/[id].post.ts
Normal file
43
server/api/file/content/[id].post.ts
Normal file
@@ -0,0 +1,43 @@
|
||||
import useDatabase from '~/composables/useDatabase';
|
||||
import { hasPermissions } from '#shared/auth.util';
|
||||
import { projectContentTable, projectFilesTable } from '~/db/schema';
|
||||
import { eq } from 'drizzle-orm';
|
||||
|
||||
export default defineEventHandler(async (e) => {
|
||||
const { user } = await getUserSession(e);
|
||||
|
||||
if(!user || !hasPermissions(user.permissions, ['admin', 'editor']))
|
||||
{
|
||||
throw createError({ statusCode: 401, statusText: 'Unauthorized' });
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
const id = getRouterParam(e, "id") ?? '';
|
||||
const body = await readRawBody(e);
|
||||
|
||||
if(!id)
|
||||
{
|
||||
setResponseStatus(e, 404);
|
||||
return;
|
||||
}
|
||||
|
||||
const db = useDatabase();
|
||||
const item = db.select({ id: projectFilesTable.id }).from(projectFilesTable).where(eq(projectFilesTable.id, id)).get();
|
||||
|
||||
if(!item)
|
||||
{
|
||||
setResponseStatus(e, 404);
|
||||
return;
|
||||
}
|
||||
|
||||
db.insert(projectContentTable).values({ id: id, content: body }).onConflictDoUpdate({ set: { content: body }, target: projectContentTable.id }).run();
|
||||
db.update(projectFilesTable).set({ timestamp: new Date() }).where(eq(projectFilesTable.id, id)).run()
|
||||
}
|
||||
catch(_e)
|
||||
{
|
||||
console.error(_e);
|
||||
setResponseStatus(e, 500);
|
||||
return;
|
||||
}
|
||||
});
|
||||
@@ -1,66 +0,0 @@
|
||||
import { eq, sql } from 'drizzle-orm';
|
||||
import useDatabase from '~/composables/useDatabase';
|
||||
import { explorerContentTable } from '~/db/schema';
|
||||
import { convertContentFromText } from '~/shared/general.util';
|
||||
|
||||
export default defineEventHandler(async (e) => {
|
||||
const path = decodeURIComponent(getRouterParam(e, "path") ?? '');
|
||||
const query = getQuery(e);
|
||||
|
||||
if(!path)
|
||||
{
|
||||
setResponseStatus(e, 404);
|
||||
return;
|
||||
}
|
||||
|
||||
const db = useDatabase();
|
||||
const content = db.select({
|
||||
'content': sql<string>`cast(${explorerContentTable.content} as TEXT)`.as('content'),
|
||||
'private': explorerContentTable.private,
|
||||
'type': explorerContentTable.type,
|
||||
'owner': explorerContentTable.owner,
|
||||
'visit': explorerContentTable.visit,
|
||||
}).from(explorerContentTable).where(eq(explorerContentTable.path, sql.placeholder('path'))).prepare().get({ path });
|
||||
|
||||
if(content !== undefined)
|
||||
{
|
||||
const session = await getUserSession(e);
|
||||
|
||||
if(!session || !session.user || session.user.id !== content.owner)
|
||||
{
|
||||
if(content.private)
|
||||
{
|
||||
setResponseStatus(e, 404);
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
content.content = content.content.replace(/%%(.+)%%/g, "");
|
||||
}
|
||||
}
|
||||
if(query.type === 'view')
|
||||
{
|
||||
db.update(explorerContentTable).set({ visit: content.visit + 1 }).where(eq(explorerContentTable.path, path)).run();
|
||||
}
|
||||
if(query.type === 'editing')
|
||||
{
|
||||
content.content = convertFromStorableLinks(content.content);
|
||||
}
|
||||
|
||||
return convertContentFromText(content.type, content.content);
|
||||
}
|
||||
|
||||
setResponseStatus(e, 404);
|
||||
return;
|
||||
});
|
||||
|
||||
export function convertFromStorableLinks(content: string): string
|
||||
{
|
||||
/*return content.replaceAll(/!?\[\[([^\[\]\|\#]+)?(#+[^\[\]\|\#]+)?(\|[^\[\]\|\#]+)?\]\]/g, (e: string, a1?: string, a2?: string , a3?: string) => {
|
||||
const parsed = parsePath(a1 ?? '%%%%----%%%%----%%%%');
|
||||
const replacer = path.find(e => e.endsWith(parsed)) ?? parsed;
|
||||
const value = `[[${replacer}${a2 ?? ''}${(!a3 && replacer !== parsed ? '|' + a1 : a3) ?? ''}]]`;
|
||||
return value;
|
||||
});*/
|
||||
return content;
|
||||
}
|
||||
@@ -1,13 +1,11 @@
|
||||
import useDatabase from '~/composables/useDatabase';
|
||||
import { getTableColumns } from 'drizzle-orm';
|
||||
import { explorerContentTable } from '~/db/schema';
|
||||
import { projectFilesTable } from '~/db/schema';
|
||||
|
||||
export default defineEventHandler(async (e) => {
|
||||
const { user } = await getUserSession(e);
|
||||
|
||||
const db = useDatabase();
|
||||
const { content: _, ...columns } = getTableColumns(explorerContentTable);
|
||||
const content = db.select(columns).from(explorerContentTable).all();
|
||||
const content = db.select().from(projectFilesTable).all();
|
||||
|
||||
content.sort((a, b) => {
|
||||
return a.path.split('/').length - b.path.split('/').length;
|
||||
@@ -36,6 +34,5 @@ export default defineEventHandler(async (e) => {
|
||||
return content.filter(e => !!e);
|
||||
}
|
||||
|
||||
setResponseStatus(e, 404);
|
||||
return;
|
||||
return [];
|
||||
});
|
||||
76
server/api/file/overview.post.ts
Normal file
76
server/api/file/overview.post.ts
Normal file
@@ -0,0 +1,76 @@
|
||||
import useDatabase from '~/composables/useDatabase';
|
||||
import { hasPermissions } from "#shared/auth.util";
|
||||
import { eq, sql } from "drizzle-orm";
|
||||
import { projectFilesTable } from "~/db/schema";
|
||||
import { Project } from "~/schemas/project";
|
||||
|
||||
export default defineEventHandler(async (e) => {
|
||||
const { user } = await getUserSession(e);
|
||||
|
||||
if(!user || !hasPermissions(user.permissions, ['admin', 'editor']))
|
||||
{
|
||||
throw createError({ statusCode: 401, statusText: 'Unauthorized' });
|
||||
}
|
||||
|
||||
const body = await readValidatedBody(e, Project.safeParse);
|
||||
|
||||
if(!body.success)
|
||||
{
|
||||
throw body.error;
|
||||
}
|
||||
|
||||
const db = useDatabase(), items = body.data, blocked: string[] = [];
|
||||
|
||||
db.transaction((tx) => {
|
||||
const data = tx.select({ id: projectFilesTable.id, timestamp: projectFilesTable.timestamp }).from(projectFilesTable).all();
|
||||
const deletion = tx.delete(projectFilesTable).where(eq(projectFilesTable.id, sql.placeholder('id'))).prepare();
|
||||
|
||||
for(let i = 0; i < items.length; i++)
|
||||
{
|
||||
const item = items[i];
|
||||
|
||||
const index = data.findIndex(e => e.id === item.id);
|
||||
|
||||
if(index !== -1)
|
||||
{
|
||||
if(data[index].timestamp > new Date(item.timestamp))
|
||||
{
|
||||
blocked.push(item.id);
|
||||
continue;
|
||||
}
|
||||
|
||||
data.splice(index, 1);
|
||||
}
|
||||
|
||||
tx.insert(projectFilesTable).values({
|
||||
id: item.id,
|
||||
path: item.path,
|
||||
owner: user.id,
|
||||
title: item.title,
|
||||
type: item.type,
|
||||
navigable: item.navigable,
|
||||
private: item.private,
|
||||
order: item.order,
|
||||
}).onConflictDoUpdate({
|
||||
set: {
|
||||
id: item.id,
|
||||
path: item.path,
|
||||
title: item.title,
|
||||
type: item.type,
|
||||
navigable: item.navigable,
|
||||
private: item.private,
|
||||
order: item.order,
|
||||
timestamp: new Date(),
|
||||
},
|
||||
target: projectFilesTable.id,
|
||||
}).run();
|
||||
}
|
||||
|
||||
for(let i = 0; i < data.length; i++)
|
||||
{
|
||||
deletion.run({ id: data[i].id });
|
||||
}
|
||||
});
|
||||
|
||||
return blocked;
|
||||
});
|
||||
@@ -1,11 +1,11 @@
|
||||
import { eq, sql } from 'drizzle-orm';
|
||||
import useDatabase from '~/composables/useDatabase';
|
||||
import { explorerContentTable } from '~/db/schema';
|
||||
import { projectFilesTable } from '~/db/schema';
|
||||
|
||||
export default defineEventHandler(async (e) => {
|
||||
const path = decodeURIComponent(getRouterParam(e, "path") ?? '');
|
||||
export default defineCachedEventHandler(async (e) => {
|
||||
const id = getRouterParam(e, "id") ?? '';
|
||||
|
||||
if(!path)
|
||||
if(!id)
|
||||
{
|
||||
setResponseStatus(e, 404);
|
||||
return;
|
||||
@@ -14,13 +14,14 @@ export default defineEventHandler(async (e) => {
|
||||
const db = useDatabase();
|
||||
|
||||
const content = db.select({
|
||||
'path': explorerContentTable.path,
|
||||
'owner': explorerContentTable.owner,
|
||||
'title': explorerContentTable.title,
|
||||
'type': explorerContentTable.type,
|
||||
'navigable': explorerContentTable.navigable,
|
||||
'private': explorerContentTable.private,
|
||||
}).from(explorerContentTable).where(eq(explorerContentTable.path, sql.placeholder('path'))).prepare().get({ path });
|
||||
'id': projectFilesTable.id,
|
||||
'path': projectFilesTable.path,
|
||||
'owner': projectFilesTable.owner,
|
||||
'title': projectFilesTable.title,
|
||||
'type': projectFilesTable.type,
|
||||
'navigable': projectFilesTable.navigable,
|
||||
'private': projectFilesTable.private,
|
||||
}).from(projectFilesTable).where(eq(projectFilesTable.id, sql.placeholder('id'))).prepare().get({ id });
|
||||
|
||||
if(content !== undefined)
|
||||
{
|
||||
@@ -47,4 +48,4 @@ export default defineEventHandler(async (e) => {
|
||||
|
||||
setResponseStatus(e, 404);
|
||||
return;
|
||||
});
|
||||
}, { getKey: (e) => getRouterParam(e, "id") ?? '', });
|
||||
@@ -1,77 +0,0 @@
|
||||
import useDatabase from '~/composables/useDatabase';
|
||||
import { explorerContentTable } from '~/db/schema';
|
||||
import type { NavigationItem } from '~/schemas/navigation';
|
||||
|
||||
export type NavigationTreeItem = NavigationItem & { children?: NavigationTreeItem[] };
|
||||
export default defineEventHandler(async (e) => {
|
||||
const { user } = await getUserSession(e);
|
||||
|
||||
const db = useDatabase();
|
||||
const content = db.select({
|
||||
path: explorerContentTable.path,
|
||||
type: explorerContentTable.type,
|
||||
owner: explorerContentTable.owner,
|
||||
title: explorerContentTable.title,
|
||||
navigable: explorerContentTable.navigable,
|
||||
private: explorerContentTable.private,
|
||||
order: explorerContentTable.order,
|
||||
}).from(explorerContentTable).all();
|
||||
|
||||
content.sort((a, b) => {
|
||||
return a.path.split('/').length - b.path.split('/').length;
|
||||
});
|
||||
|
||||
if(content.length > 0)
|
||||
{
|
||||
const navigation: NavigationTreeItem[] = [];
|
||||
|
||||
for(const idx in content)
|
||||
{
|
||||
const item = content[idx];
|
||||
if(!!item.private && (user?.id ?? -1) !== item.owner || !item.navigable)
|
||||
{
|
||||
delete content[idx];
|
||||
continue;
|
||||
}
|
||||
|
||||
const parent = item.path.includes('/') ? item.path.substring(0, item.path.lastIndexOf('/')) : undefined;
|
||||
|
||||
if(parent && !content.find(e => e && e.path === parent))
|
||||
{
|
||||
delete content[idx];
|
||||
continue;
|
||||
}
|
||||
}
|
||||
for(const item of content.filter(e => !!e))
|
||||
{
|
||||
addChild(navigation, item);
|
||||
}
|
||||
|
||||
return navigation;
|
||||
}
|
||||
|
||||
setResponseStatus(e, 404);
|
||||
return;
|
||||
});
|
||||
|
||||
function addChild(arr: NavigationTreeItem[], e: NavigationItem): void
|
||||
{
|
||||
const parent = arr.find(f => e.path.startsWith(f.path));
|
||||
|
||||
if(parent)
|
||||
{
|
||||
if(!parent.children)
|
||||
parent.children = [];
|
||||
|
||||
addChild(parent.children, e);
|
||||
}
|
||||
else
|
||||
{
|
||||
arr.push({ ...e });
|
||||
arr.sort((a, b) => {
|
||||
if(a.order !== b.order)
|
||||
return a.order - b.order;
|
||||
return a.title.localeCompare(b.title);
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -1,80 +0,0 @@
|
||||
import useDatabase from '~/composables/useDatabase';
|
||||
import { explorerContentTable } from '~/db/schema';
|
||||
import type { NavigationItem } from '~/schemas/navigation';
|
||||
import type { ProjectItem, Project } from '~/schemas/project';
|
||||
import { hasPermissions } from '~/shared/auth.util';
|
||||
|
||||
export default defineEventHandler(async (e) => {
|
||||
const { user } = await getUserSession(e);
|
||||
|
||||
if(!user || !hasPermissions(user.permissions, ['editor', 'admin']))
|
||||
{
|
||||
throw createError({
|
||||
statusCode: 401,
|
||||
statusMessage: 'Unauthorized',
|
||||
});
|
||||
}
|
||||
|
||||
const db = useDatabase();
|
||||
const content = db.select({
|
||||
path: explorerContentTable.path,
|
||||
type: explorerContentTable.type,
|
||||
owner: explorerContentTable.owner,
|
||||
title: explorerContentTable.title,
|
||||
navigable: explorerContentTable.navigable,
|
||||
private: explorerContentTable.private,
|
||||
order: explorerContentTable.order,
|
||||
}).from(explorerContentTable).prepare().all();
|
||||
|
||||
content.sort((a, b) => {
|
||||
return a.path.split('/').length - b.path.split('/').length;
|
||||
});
|
||||
|
||||
if(content.length > 0)
|
||||
{
|
||||
const project: Project = {
|
||||
items: [],
|
||||
}
|
||||
|
||||
for(const item of content.filter(e => !!e))
|
||||
{
|
||||
addChild(project.items, item);
|
||||
}
|
||||
|
||||
return project;
|
||||
}
|
||||
|
||||
setResponseStatus(e, 404);
|
||||
return;
|
||||
});
|
||||
|
||||
function addChild(arr: ProjectItem[], e: NavigationItem): void
|
||||
{
|
||||
const parent = arr.find(f => e.path.startsWith(f.path));
|
||||
|
||||
if(parent)
|
||||
{
|
||||
if(!parent.children)
|
||||
parent.children = [];
|
||||
|
||||
addChild(parent.children, e);
|
||||
}
|
||||
else
|
||||
{
|
||||
arr.push({
|
||||
path: e.path,
|
||||
parent: e.path.substring(0, e.path.lastIndexOf('/')),
|
||||
name: e.path.substring(e.path.lastIndexOf('/') + 1),
|
||||
title: e.title,
|
||||
type: e.type,
|
||||
navigable: e.navigable,
|
||||
private: e.private,
|
||||
order: e.order,
|
||||
});
|
||||
arr.sort((a, b) => {
|
||||
if(a.order !== b.order)
|
||||
return a.order - b.order;
|
||||
return a.title.localeCompare(b.title);
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -1,106 +0,0 @@
|
||||
import { hasPermissions } from "#shared/auth.util";
|
||||
import useDatabase from '~/composables/useDatabase';
|
||||
import { explorerContentTable } from '~/db/schema';
|
||||
import { project, type ProjectItem } from '~/schemas/project';
|
||||
import { parsePath } from "#shared/general.util";
|
||||
import { eq, getTableColumns, sql } from "drizzle-orm";
|
||||
import type { ExploreContent, TreeItem } from "~/types/content";
|
||||
import type { TreeItemEditable } from "~/pages/explore/edit/index.vue";
|
||||
|
||||
export default defineEventHandler(async (e) => {
|
||||
const { user } = await getUserSession(e);
|
||||
|
||||
if(!user || !hasPermissions(user.permissions, ['admin', 'editor']))
|
||||
{
|
||||
throw createError({ statusCode: 401, statusText: 'Unauthorized' });
|
||||
}
|
||||
|
||||
const body = await readValidatedBody(e, project.safeParse);
|
||||
|
||||
if(!body.success)
|
||||
{
|
||||
throw body.error;
|
||||
}
|
||||
|
||||
const items = buildOrder(body.data) as Array<TreeItemEditable & { match?: number }>;
|
||||
|
||||
const db = useDatabase();
|
||||
const { ...cols } = getTableColumns(explorerContentTable);
|
||||
const full = db.select(cols).from(explorerContentTable).all() as Record<string, any>[];
|
||||
|
||||
for(let i = full.length - 1; i >= 0; i--)
|
||||
{
|
||||
const item = items.find(e => (e.path === '' ? [e.parent, parsePath(e.name === '' ? e.title : e.name)].filter(e => !!e).join('/') : e.path) === full[i].path);
|
||||
if(item)
|
||||
{
|
||||
item.match = i;
|
||||
full[i].include = true;
|
||||
}
|
||||
}
|
||||
|
||||
db.transaction((tx) => {
|
||||
for(let i = 0; i < items.length; i++)
|
||||
{
|
||||
const item = items[i];
|
||||
const old = full[item.match!];
|
||||
|
||||
const path = [item.parent, parsePath(item.name === '' ? item.title : item.name)].filter(e => !!e).join('/');
|
||||
|
||||
tx.insert(explorerContentTable).values({
|
||||
path: item.path || path,
|
||||
owner: user.id,
|
||||
title: item.title,
|
||||
type: item.type,
|
||||
navigable: item.navigable,
|
||||
private: item.private,
|
||||
order: item.order,
|
||||
content: item.content ?? old?.content ?? null,
|
||||
}).onConflictDoUpdate({
|
||||
set: {
|
||||
path: path,
|
||||
title: item.title,
|
||||
type: item.type,
|
||||
navigable: item.navigable,
|
||||
private: item.private,
|
||||
order: item.order,
|
||||
timestamp: new Date(),
|
||||
content: item.content ?? old?.content ?? null,
|
||||
},
|
||||
target: explorerContentTable.path,
|
||||
}).run();
|
||||
|
||||
if(item.path !== path && !old)
|
||||
{
|
||||
tx.update(explorerContentTable).set({ content: sql`replace(${explorerContentTable.content}, ${sql.placeholder('old')}, ${sql.placeholder('new')})` }).prepare().run({ 'old': item.path, 'new': path });
|
||||
}
|
||||
}
|
||||
for(let i = 0; i < full.length; i++)
|
||||
{
|
||||
if(full[i].include !== true)
|
||||
tx.delete(explorerContentTable).where(eq(explorerContentTable.path, full[i].path)).run();
|
||||
}
|
||||
});
|
||||
|
||||
return items.map(e => ({
|
||||
path: e.path,
|
||||
owner: e.owner,
|
||||
title: e.title,
|
||||
type: e.type,
|
||||
content: e.content,
|
||||
navigable: e.navigable,
|
||||
private: e.private,
|
||||
order: e.order,
|
||||
visit: e.visit,
|
||||
timestamp: e.timestamp,
|
||||
})) as ExploreContent[];
|
||||
});
|
||||
|
||||
function buildOrder(items: ProjectItem[]): ProjectItem[]
|
||||
{
|
||||
items.forEach((e, i) => {
|
||||
e.order = i;
|
||||
if(e.children) e.children = buildOrder(e.children);
|
||||
});
|
||||
|
||||
return items.flatMap(e => [e, ...(e.children ?? [])]);
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
import useDatabase from '~/composables/useDatabase';
|
||||
|
||||
export default defineEventHandler(async (e) => {
|
||||
const query = getQuery(e);
|
||||
|
||||
if (query.search) {
|
||||
const db = useDatabase();
|
||||
|
||||
const files = db.query(`SELECT f.*, u.username, count(c.path) as comments FROM explorer_files f LEFT JOIN users u ON f.owner = u.id LEFT JOIN explorer_comments c ON c.project = f.project AND c.path = f.path WHERE title LIKE ?1 AND private = 0 AND type != "Folder" GROUP BY f.project, f.path`).all(query.search) as FileSearch[];
|
||||
const users = db.query(`SELECT id, username FROM users WHERE username LIKE ?1`).all(query.search) as UserSearch[];
|
||||
|
||||
return {
|
||||
projects,
|
||||
files,
|
||||
users
|
||||
} as Search;
|
||||
}
|
||||
|
||||
setResponseStatus(e, 404);
|
||||
});
|
||||
@@ -1,9 +1,9 @@
|
||||
import useDatabase from "~/composables/useDatabase";
|
||||
import { extname, basename } from 'node:path';
|
||||
import type { FileType } from '~/types/content';
|
||||
import type { CanvasColor, CanvasContent } from "~/types/canvas";
|
||||
import { explorerContentTable } from "~/db/schema";
|
||||
import { convertToStorableLinks } from "../api/file.post";
|
||||
import type { FileType, ProjectContent } from "#shared/content.util";
|
||||
import { getID, ID_SIZE, parsePath } from "#shared/general.util";
|
||||
import { projectContentTable, projectFilesTable } from "~/db/schema";
|
||||
|
||||
const typeMapping: Record<string, FileType> = {
|
||||
".md": "markdown",
|
||||
@@ -17,6 +17,7 @@ export default defineTask({
|
||||
},
|
||||
async run(event) {
|
||||
try {
|
||||
//@ts-ignore
|
||||
const tree = await $fetch('https://git.peaceultime.com/api/v1/repos/peaceultime/system-aspect/git/trees/master', {
|
||||
method: 'get',
|
||||
headers: {
|
||||
@@ -28,21 +29,23 @@ export default defineTask({
|
||||
}
|
||||
}) as { tree: any[] } & Record<string, any>;
|
||||
|
||||
const files: typeof explorerContentTable.$inferInsert[] = await Promise.all(tree.tree.filter((e: any) => !e.path.startsWith(".")).map(async (e, i) => {
|
||||
const files: ProjectContent[] = await Promise.all(tree.tree.filter((e: any) => !e.path.startsWith(".")).map(async (e, i) => {
|
||||
if(e.type === 'tree')
|
||||
{
|
||||
const title = basename(e.path);
|
||||
const order = /(\d+)\. ?(.+)/gsmi.exec(title);
|
||||
const path = (e.path as string).split('/').map(f => { const check = /(\d+)\. ?(.+)/gsmi.exec(f); return check && check[2] ? check[2] : f }).join('/');
|
||||
return {
|
||||
path: path.toLowerCase().replaceAll(" ", "-").normalize("NFD").replace(/[\u0300-\u036f]/g, ""),
|
||||
id: getID(ID_SIZE),
|
||||
path: parsePath(path),
|
||||
order: i,
|
||||
title: order && order[2] ? order[2] : title,
|
||||
type: 'folder',
|
||||
content: null,
|
||||
owner: '1',
|
||||
owner: 1,
|
||||
navigable: true,
|
||||
private: e.path.startsWith('98.Privé'),
|
||||
timestamp: new Date(),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -53,28 +56,28 @@ export default defineTask({
|
||||
const content = (await $fetch(`https://git.peaceultime.com/api/v1/repos/peaceultime/system-aspect/raw/${encodeURIComponent(e.path)}`));
|
||||
|
||||
return {
|
||||
path: (extension === '.md' ? path.replace(extension, '') : path).toLowerCase().replaceAll(" ", "-").normalize("NFD").replace(/[\u0300-\u036f]/g, ""),
|
||||
id: getID(ID_SIZE),
|
||||
path: parsePath(extension === '.md' ? path.replace(extension, '') : path),
|
||||
order: i,
|
||||
title: order && order[2] ? order[2] : title,
|
||||
type: (typeMapping[extension] ?? 'file'),
|
||||
content: reshapeContent(content as string, typeMapping[extension] ?? 'File'),
|
||||
owner: '1',
|
||||
owner: 1,
|
||||
navigable: true,
|
||||
private: e.path.startsWith('98.Privé')
|
||||
private: e.path.startsWith('98.Privé'),
|
||||
timestamp: new Date(),
|
||||
}
|
||||
}));
|
||||
|
||||
const pathList = files.map(e => e.path);
|
||||
files.forEach(e => {
|
||||
if(e.type !== 'folder' && e.content)
|
||||
{
|
||||
e.content = Buffer.from(convertToStorableLinks(e.content.toString('utf-8'), files.map(e => e.path)), 'utf-8');
|
||||
}
|
||||
})
|
||||
files.forEach(e => e.content = reshapeLinks(e.content as string | null, files) ?? null);
|
||||
|
||||
const db = useDatabase();
|
||||
db.delete(explorerContentTable).run();
|
||||
db.insert(explorerContentTable).values(files).run();
|
||||
db.transaction(tx => {
|
||||
db.delete(projectFilesTable).run();
|
||||
db.insert(projectFilesTable).values(files.map(e => {const { content, ...rest } = e; return rest; })).run();
|
||||
db.delete(projectContentTable).run();
|
||||
db.insert(projectContentTable).values(files.map(e => ({ content: e.content ? Buffer.from(e.content as string) : null, id: e.id }))).run();
|
||||
});
|
||||
|
||||
return { result: true };
|
||||
}
|
||||
@@ -87,20 +90,25 @@ export default defineTask({
|
||||
},
|
||||
})
|
||||
|
||||
function reshapeLinks(content: string | null, all: ProjectContent[])
|
||||
{
|
||||
return content?.replace(/\[\[(.*?)?(#.*?)?(\|.*?)?\]\]/g, (str, link, header, title) => {
|
||||
return `[[${link ? parsePath(all.find(e => e.path.endsWith(parsePath(link)))?.path ?? parsePath(link)) : ''}${header ?? ''}${title ?? ''}]]`;
|
||||
});
|
||||
}
|
||||
|
||||
function reshapeContent(content: string, type: FileType): string | null
|
||||
{
|
||||
switch(type)
|
||||
{
|
||||
case "markdown":
|
||||
return content.replaceAll(/!?\[\[([^\[\]\|\#]+)?(#+[^\[\]\|\#]+)?(\|[^\[\]\|\#]+)?\]\]/g, (e: string, a1?: string, a2?: string , a3?: string) => {
|
||||
return `[[${a1?.split('/').map(f => { const check = /(\d+)\. ?(.+)/gsmi.exec(f); return check && check[2] ? check[2] : f }).join('/') ?? ''}${a2 ?? ''}${a3 ?? ''}]]`;
|
||||
});
|
||||
return content;
|
||||
case "file":
|
||||
return content;
|
||||
case "canvas":
|
||||
const data = JSON.parse(content) as CanvasContent;
|
||||
data.edges.forEach(e => e.color = typeof e.color === 'string' ? getColor(e.color) : undefined);
|
||||
data.nodes.forEach(e => e.color = typeof e.color === 'string' ? getColor(e.color) : undefined);
|
||||
data.edges?.forEach(e => e.color = typeof e.color === 'string' ? getColor(e.color) : undefined);
|
||||
data.nodes?.forEach(e => e.color = typeof e.color === 'string' ? getColor(e.color) : undefined);
|
||||
return JSON.stringify(data);
|
||||
default:
|
||||
case 'folder':
|
||||
|
||||
@@ -1,12 +1,6 @@
|
||||
import useDatabase from "~/composables/useDatabase";
|
||||
import type { FileType } from '~/types/content';
|
||||
import { explorerContentTable } from "~/db/schema";
|
||||
import { eq, ne } from "drizzle-orm";
|
||||
|
||||
const typeMapping: Record<string, FileType> = {
|
||||
".md": "markdown",
|
||||
".canvas": "canvas"
|
||||
};
|
||||
import { projectFilesTable, projectContentTable } from "~/db/schema";
|
||||
import { eq } from "drizzle-orm";
|
||||
|
||||
export default defineTask({
|
||||
meta: {
|
||||
@@ -15,19 +9,10 @@ export default defineTask({
|
||||
},
|
||||
async run(event) {
|
||||
try {
|
||||
const tree = await $fetch('https://git.peaceultime.com/api/v1/repos/peaceultime/system-aspect/git/trees/master', {
|
||||
method: 'get',
|
||||
headers: {
|
||||
accept: 'application/json',
|
||||
},
|
||||
params: {
|
||||
recursive: true,
|
||||
per_page: 1000,
|
||||
}
|
||||
}) as any;
|
||||
|
||||
const db = useDatabase();
|
||||
const files = db.select().from(explorerContentTable).where(ne(explorerContentTable.type, 'folder')).all();
|
||||
const files = db.select().from(projectFilesTable).leftJoin(projectContentTable, eq(projectContentTable.id, projectFilesTable.id)).all();
|
||||
|
||||
|
||||
|
||||
return { result: true };
|
||||
}
|
||||
|
||||
@@ -1,9 +1,17 @@
|
||||
import type { CanvasNode } from "~/types/canvas";
|
||||
import { clamp } from "#shared/general.util";
|
||||
import type { CanvasContent, CanvasEdge, CanvasNode } from "~/types/canvas";
|
||||
import { clamp, lerp } from "#shared/general.util";
|
||||
import { dom, icon, svg, text } from "./dom.util";
|
||||
import render from "./markdown.util";
|
||||
import { popper } from "#shared/floating.util";
|
||||
import { Content } from "./content.util";
|
||||
import { History } from "./history.util";
|
||||
import { fakeA, link } from "./proses";
|
||||
import { SnapFinder, SpatialGrid } from "./physics.util";
|
||||
import type { CanvasPreferences } from "~/types/general";
|
||||
|
||||
export type Direction = 'bottom' | 'top' | 'left' | 'right';
|
||||
export type Position = { x: number, y: number };
|
||||
export type Box = Position & { w: number, h: number };
|
||||
export type Box = Position & { width: number, height: number };
|
||||
export type Path = {
|
||||
path: string;
|
||||
from: Position;
|
||||
@@ -100,4 +108,897 @@ export function getCenter(n: Position, i: Position, r: Position, o: Position, e:
|
||||
export function gridSnap(value: number, grid: number): number
|
||||
{
|
||||
return Math.round(value / grid) * grid;
|
||||
}
|
||||
|
||||
const cancelEvent = (e: Event) => e.preventDefault();
|
||||
function center(touches: TouchList): Position
|
||||
{
|
||||
const pos = { x: 0, y: 0 };
|
||||
|
||||
for(const touch of touches)
|
||||
{
|
||||
pos.x += touch.clientX;
|
||||
pos.y += touch.clientY;
|
||||
}
|
||||
|
||||
pos.x /= touches.length;
|
||||
pos.y /= touches.length;
|
||||
return pos;
|
||||
}
|
||||
function distance(touches: TouchList): number
|
||||
{
|
||||
const [A, B] = touches;
|
||||
return Math.hypot(B.clientX - A.clientX, B.clientY - A.clientY);
|
||||
}
|
||||
|
||||
export class Node extends EventTarget
|
||||
{
|
||||
properties: CanvasNode;
|
||||
|
||||
nodeDom!: HTMLDivElement;
|
||||
|
||||
constructor(properties: CanvasNode)
|
||||
{
|
||||
super();
|
||||
|
||||
this.properties = properties;
|
||||
|
||||
this.getDOM()
|
||||
}
|
||||
|
||||
protected getDOM()
|
||||
{
|
||||
const style = this.style;
|
||||
|
||||
this.nodeDom = dom('div', { class: ['absolute', {'-z-10': this.properties.type === 'group', 'z-10': this.properties.type !== 'group'}], style: { transform: `translate(${this.properties.x}px, ${this.properties.y}px)`, width: `${this.properties.width}px`, height: `${this.properties.height}px`, '--canvas-color': this.properties.color?.hex } }, [
|
||||
dom('div', { class: ['outline-0 transition-[outline-width] border-2 bg-light-20 dark:bg-dark-20 w-full h-full hover:outline-4', style.border] }, [
|
||||
dom('div', { class: ['w-full h-full py-2 px-4 flex !bg-opacity-[0.07] overflow-auto', style.bg] }, [this.properties.text ? dom('div', { class: 'flex items-center' }, [render(this.properties.text)]) : undefined])
|
||||
])
|
||||
]);
|
||||
|
||||
if(this.properties.type === 'group')
|
||||
{
|
||||
if(this.properties.label !== undefined)
|
||||
{
|
||||
this.nodeDom.appendChild(dom('div', { class: ['origin-bottom-left tracking-wider border-4 truncate inline-block text-light-100 dark:text-dark-100 absolute bottom-[100%] mb-2 px-2 py-1 font-thin', style.border], style: 'max-width: 100%; font-size: calc(18px * var(--zoom-multiplier))', text: this.properties.label }));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
get style()
|
||||
{
|
||||
return this.properties.color ? this.properties.color?.class ?
|
||||
{ bg: `bg-light-${this.properties.color?.class} dark:bg-dark-${this.properties.color?.class}`, border: `border-light-${this.properties.color?.class} dark:border-dark-${this.properties.color?.class}` } :
|
||||
{ bg: `bg-colored`, border: `border-[color:var(--canvas-color)]` } :
|
||||
{ border: `border-light-40 dark:border-dark-40`, bg: `bg-light-40 dark:bg-dark-40` }
|
||||
}
|
||||
}
|
||||
export class NodeEditable extends Node
|
||||
{
|
||||
private static input: HTMLInputElement = dom('input', { class: 'origin-bottom-left tracking-wider border-4 truncate inline-block text-light-100 dark:text-dark-100 absolute bottom-[100%] appearance-none bg-transparent outline-4 mb-2 px-2 py-1 font-thin min-w-4', style: { 'max-width': '100%', 'font-size': 'calc(18px * var(--zoom-multiplier))' }, listeners: { click: e => e.stopImmediatePropagation() } });
|
||||
|
||||
edges: Set<EdgeEditable> = new Set();
|
||||
|
||||
private dirty: boolean = false;
|
||||
constructor(properties: CanvasNode)
|
||||
{
|
||||
super(properties);
|
||||
}
|
||||
protected override getDOM()
|
||||
{
|
||||
const style = this.style;
|
||||
|
||||
this.nodeDom = dom('div', { class: ['absolute group', {'-z-10': this.properties.type === 'group', 'z-10': this.properties.type !== 'group'}], style: { transform: `translate(${this.properties.x}px, ${this.properties.y}px)`, width: `${this.properties.width}px`, height: `${this.properties.height}px`, '--canvas-color': this.properties.color?.hex } }, [
|
||||
dom('div', { class: ['outline-0 transition-[outline-width] border-2 bg-light-20 dark:bg-dark-20 w-full h-full group-hover:outline-4', style.border, style.outline] }, [
|
||||
dom('div', { class: ['w-full h-full py-2 px-4 flex !bg-opacity-[0.07] overflow-auto', style.bg], listeners: this.properties.type === 'text' ? { mouseenter: e => this.dispatchEvent(new CustomEvent('focus', { detail: this })), click: e => this.dispatchEvent(new CustomEvent('select', { detail: this })), dblclick: e => this.dispatchEvent(new CustomEvent('edit', { detail: this })) } : undefined }, [this.properties.text ? dom('div', { class: 'flex items-center' }, [render(this.properties.text, undefined, { tags: { a: fakeA } })]) : undefined])
|
||||
])
|
||||
]);
|
||||
|
||||
if(this.properties.type === 'group')
|
||||
{
|
||||
if(this.properties.label !== undefined)
|
||||
{
|
||||
this.nodeDom.appendChild(dom('div', { class: ['origin-bottom-left tracking-wider border-4 truncate inline-block text-light-100 dark:text-dark-100 absolute bottom-[100%] mb-2 px-2 py-1 font-thin', style.border], style: 'max-width: 100%; font-size: calc(18px * var(--zoom-multiplier))', text: this.properties.label, listeners: { mouseenter: e => this.dispatchEvent(new CustomEvent('focus', { detail: this })), mouseleave: e => this.dispatchEvent(new CustomEvent('unfocus', { detail: this })), click: e => this.dispatchEvent(new CustomEvent('select', { detail: this })), dblclick: e => this.dispatchEvent(new CustomEvent('edit', { detail: this })) } }));
|
||||
}
|
||||
}
|
||||
}
|
||||
update()
|
||||
{
|
||||
if(!this.dirty)
|
||||
return;
|
||||
|
||||
Object.assign(this.nodeDom.style, {
|
||||
transform: `translate(${this.properties.x}px, ${this.properties.y}px)`,
|
||||
width: `${this.properties.width}px`,
|
||||
height: `${this.properties.height}px`,
|
||||
});
|
||||
this.edges.forEach(e => e.update());
|
||||
this.dirty = false;
|
||||
}
|
||||
|
||||
override get style()
|
||||
{
|
||||
return this.properties.color ? this.properties.color?.class ?
|
||||
{ bg: `bg-light-${this.properties.color?.class} dark:bg-dark-${this.properties.color?.class}`, border: `border-light-${this.properties.color?.class} dark:border-dark-${this.properties.color?.class}`, outline: `outline-light-${this.properties.color?.class} dark:outline-dark-${this.properties.color?.class}` } :
|
||||
{ bg: `bg-colored`, border: `border-[color:var(--canvas-color)]`, outline: `outline-[color:var(--canvas-color)]` } :
|
||||
{ border: `border-light-40 dark:border-dark-40`, bg: `bg-light-40 dark:bg-dark-40`, outline: `outline-light-40 dark:outline-dark-40` }
|
||||
}
|
||||
|
||||
get x()
|
||||
{
|
||||
return this.properties.x;
|
||||
}
|
||||
set x(value: number)
|
||||
{
|
||||
this.properties.x = value;
|
||||
this.dirty = true;
|
||||
}
|
||||
get y()
|
||||
{
|
||||
return this.properties.y;
|
||||
}
|
||||
set y(value: number)
|
||||
{
|
||||
this.properties.y = value;
|
||||
this.dirty = true;
|
||||
}
|
||||
get width()
|
||||
{
|
||||
return this.properties.width;
|
||||
}
|
||||
set width(value: number)
|
||||
{
|
||||
this.properties.width = value;
|
||||
this.dirty = true;
|
||||
}
|
||||
get height()
|
||||
{
|
||||
return this.properties.height;
|
||||
}
|
||||
set height(value: number)
|
||||
{
|
||||
this.properties.height = value;
|
||||
this.dirty = true;
|
||||
}
|
||||
}
|
||||
|
||||
export class Edge extends EventTarget
|
||||
{
|
||||
properties: CanvasEdge;
|
||||
|
||||
edgeDom!: HTMLDivElement;
|
||||
protected from: Node;
|
||||
protected to: Node;
|
||||
protected path: Path;
|
||||
protected labelPos: string;
|
||||
|
||||
constructor(properties: CanvasEdge, from: Node, to: Node)
|
||||
{
|
||||
super();
|
||||
this.properties = properties;
|
||||
|
||||
this.from = from;
|
||||
this.to = to;
|
||||
this.path = getPath(this.from.properties, properties.fromSide, this.to.properties, properties.toSide)!;
|
||||
this.labelPos = labelCenter(this.from.properties, properties.fromSide, this.to.properties, properties.toSide);
|
||||
|
||||
this.getDOM();
|
||||
}
|
||||
|
||||
protected getDOM()
|
||||
{
|
||||
const style = this.style;
|
||||
this.edgeDom = dom('div', { class: 'absolute overflow-visible' }, [
|
||||
this.properties.label ? dom('div', { style: { transform: `${this.labelPos} translate(-50%, -50%)` }, class: 'relative bg-light-20 dark:bg-dark-20 border border-light-35 dark:border-dark-35 px-4 py-2 z-20', text: this.properties.label }) : undefined,
|
||||
svg('svg', { class: 'absolute top-0 overflow-visible h-px w-px' }, [
|
||||
svg('g', { style: {'--canvas-color': this.properties.color?.hex}, class: 'z-0' }, [
|
||||
svg('g', { style: `transform: translate(${this.path!.to.x}px, ${this.path!.to.y}px) scale(var(--zoom-multiplier)) rotate(${rotation[this.path!.side]}deg);` }, [
|
||||
svg('polygon', { class: style.fill, attributes: { points: '0,0 6.5,10.4 -6.5,10.4' } }),
|
||||
]),
|
||||
svg('path', { style: `stroke-width: calc(3px * var(--zoom-multiplier)); stroke-linecap: butt;`, class: [style.stroke, 'fill-none stroke-[4px]'], attributes: { d: this.path!.path } }),
|
||||
]),
|
||||
]),
|
||||
]);
|
||||
}
|
||||
|
||||
get style()
|
||||
{
|
||||
return this.properties.color ? this.properties.color?.class ?
|
||||
{ fill: `fill-light-${this.properties.color?.class} dark:fill-dark-${this.properties.color?.class}`, stroke: `stroke-light-${this.properties.color?.class} dark:stroke-dark-${this.properties.color?.class}` } :
|
||||
{ fill: `fill-colored`, stroke: `stroke-[color:var(--canvas-color)]` } :
|
||||
{ stroke: `stroke-light-40 dark:stroke-dark-40`, fill: `fill-light-40 dark:fill-dark-40` }
|
||||
}
|
||||
}
|
||||
export class EdgeEditable extends Edge
|
||||
{
|
||||
private static input: HTMLInputElement = dom('input', { class: 'relative bg-light-20 dark:bg-dark-20 border border-light-35 dark:border-dark-35 px-4 py-2 z-20 -translate-x-1/2 -translate-y-1/2', listeners: { click: e => e.stopImmediatePropagation() } });
|
||||
private focusing: boolean = false;
|
||||
private editing: boolean = false;
|
||||
|
||||
private pathDom!: SVGPathElement;
|
||||
private inputDom!: HTMLDivElement;
|
||||
constructor(properties: CanvasEdge, from: NodeEditable, to: NodeEditable)
|
||||
{
|
||||
super(properties, from, to);
|
||||
from.edges.add(this);
|
||||
to.edges.add(this);
|
||||
}
|
||||
protected override getDOM()
|
||||
{
|
||||
const style = this.style;
|
||||
this.pathDom = svg('path', { style: { 'stroke-width': `calc(3px * var(--zoom-multiplier))`, 'stroke-linecap': 'butt' }, class: ['transition-[stroke-width] fill-none stroke-[4px]', style.stroke], attributes: { d: this.path.path }, listeners: { mouseenter: e => this.dispatchEvent(new CustomEvent('focus', { detail: this })), click: e => this.dispatchEvent(new CustomEvent('select', { detail: this })), dblclick: e => this.dispatchEvent(new CustomEvent('edit', { detail: this })) } });
|
||||
this.inputDom = dom('div', { class: ['relative bg-light-20 dark:bg-dark-20 border border-light-35 dark:border-dark-35 px-4 py-2 z-20 -translate-x-1/2 -translate-y-1/2', { 'hidden': this.properties.label === undefined }], style: { transform: this.labelPos }, text: this.properties.label });
|
||||
this.edgeDom = dom('div', { class: 'absolute overflow-visible group' }, [
|
||||
this.inputDom,
|
||||
svg('svg', { class: 'absolute top-0 overflow-visible h-px w-px' }, [
|
||||
svg('g', { style: { '--canvas-color': this.properties.color?.hex } }, [
|
||||
svg('g', { style: { transform: `translate(${this.path.to.x}px, ${this.path.to.y}px) scale(var(--zoom-multiplier)) rotate(${rotation[this.path.side]}deg)` } }, [
|
||||
svg('polygon', { class: style.fill, attributes: { 'points': '0,0 6.5,10.4 -6.5,10.4' } }),
|
||||
]),
|
||||
this.pathDom,
|
||||
svg('path', { style: { 'stroke-width': `calc(22px * var(--zoom-multiplier))` }, class: ['fill-none transition-opacity z-30 opacity-0 hover:opacity-25', style.stroke], attributes: { d: this.path.path } }),
|
||||
]),
|
||||
]),
|
||||
]);
|
||||
}
|
||||
update()
|
||||
{
|
||||
this.path = getPath(this.from.properties, this.properties.fromSide, this.to.properties, this.properties.toSide)!;
|
||||
this.pathDom.setAttribute('d', this.path.path);
|
||||
}
|
||||
}
|
||||
|
||||
export class Canvas
|
||||
{
|
||||
static minZoom: number = 0.08;
|
||||
static maxZoom: number = 3;
|
||||
|
||||
protected content: Required<CanvasContent>;
|
||||
protected _zoom: number = 0.5;
|
||||
protected _x: number = 0;
|
||||
protected _y: number = 0;
|
||||
|
||||
protected containZoom: number = this._zoom;
|
||||
protected centerX: number = this._x;
|
||||
protected centerY: number = this._y;
|
||||
|
||||
protected visualZoom: number = this._zoom;
|
||||
protected visualX: number = this._x;
|
||||
protected visualY: number = this._y;
|
||||
|
||||
protected tweener: Tweener = new Tweener();
|
||||
private debouncedTimeout: Timer = setTimeout(() => {}, 0);
|
||||
|
||||
protected transform!: HTMLDivElement;
|
||||
container!: HTMLDivElement;
|
||||
|
||||
protected firstX = 0;
|
||||
protected firstY = 0;
|
||||
protected lastX = 0;
|
||||
protected lastY = 0;
|
||||
protected lastDistance = 0;
|
||||
|
||||
protected nodes: Node[] = [];
|
||||
protected edges: Edge[] = [];
|
||||
|
||||
constructor(content?: CanvasContent)
|
||||
{
|
||||
if(!content)
|
||||
content = { nodes: [], edges: [], groups: [] };
|
||||
|
||||
if(!content.nodes)
|
||||
content.nodes = [];
|
||||
|
||||
if(!content.edges)
|
||||
content.edges = [];
|
||||
|
||||
if(!content.groups)
|
||||
content.groups = [];
|
||||
|
||||
this.content = content as Required<CanvasContent>;
|
||||
|
||||
this.createDOM();
|
||||
}
|
||||
|
||||
protected createDOM()
|
||||
{
|
||||
this.nodes = this.content.nodes.map(e => new Node(e));
|
||||
this.edges = this.content.edges.map(e => new Edge(e, this.nodes.find(f => e.fromNode === f.properties.id)!, this.nodes.find(f => e.toNode === f.properties.id)!));
|
||||
//const { loggedIn, user } = useUserSession();
|
||||
this.transform = dom('div', { class: 'origin-center h-full' }, [
|
||||
dom('div', { class: 'absolute top-0 left-0 w-full h-full pointer-events-none *:pointer-events-auto *:select-none touch-none' }, [
|
||||
dom('div', {}, this.nodes.map(e => e.nodeDom)), dom('div', {}, this.edges.map(e => e.edgeDom)),
|
||||
])
|
||||
]);
|
||||
|
||||
this.container = dom('div', { class: 'absolute top-0 left-0 overflow-hidden w-full h-full touch-none' }, [
|
||||
dom('div', { class: 'flex flex-col absolute sm:top-2 top-10 left-2 z-[35] overflow-hidden gap-4' }, [
|
||||
dom('div', { class: 'border border-light-35 dark:border-dark-35 bg-light-10 dark:bg-dark-10' }, [
|
||||
popper(dom('span', { class: 'w-8 h-8 flex justify-center items-center p-2 hover:bg-light-30 dark:hover:bg-dark-30 cursor-pointer', listeners: { click: () => this.zoomTo(this._x, this._y, clamp(this._zoom * 1.1, this.containZoom, Canvas.maxZoom)) } }, [icon('radix-icons:plus')]), {
|
||||
delay: 120, arrow: true, placement: 'right', offset: 8, content: [text('Zoom avant')], class: 'TooltipContent border border-light-30 dark:border-dark-30 px-2 py-1 bg-light-10 dark:bg-dark-10 text-light-70 dark:text-dark-70 z-50'
|
||||
}),
|
||||
popper(dom('span', { class: 'w-8 h-8 flex justify-center items-center p-2 hover:bg-light-30 dark:hover:bg-dark-30 cursor-pointer', listeners: { click: (e: MouseEvent) => { this.reset(); } } }, [icon('radix-icons:corners')]), {
|
||||
delay: 120, arrow: true, placement: 'right', offset: 8, content: [text('Tout contenir')], class: 'TooltipContent border border-light-30 dark:border-dark-30 px-2 py-1 bg-light-10 dark:bg-dark-10 text-light-70 dark:text-dark-70 z-50'
|
||||
}),
|
||||
popper(dom('span', { class: 'w-8 h-8 flex justify-center items-center p-2 hover:bg-light-30 dark:hover:bg-dark-30 cursor-pointer', listeners: { click: () => this.zoomTo(this._x, this._y, clamp(this._zoom / 1.1, this.containZoom, Canvas.maxZoom)) } }, [icon('radix-icons:minus')]), {
|
||||
delay: 120, arrow: true, placement: 'right', offset: 8, content: [text('Zoom arrière')], class: 'TooltipContent border border-light-30 dark:border-dark-30 px-2 py-1 bg-light-10 dark:bg-dark-10 text-light-70 dark:text-dark-70 z-50'
|
||||
}),
|
||||
]),
|
||||
//link({}, { name: 'explore-edit' }),
|
||||
]), this.transform,
|
||||
]);
|
||||
}
|
||||
|
||||
protected computeLimits()
|
||||
{
|
||||
const box = this.container.getBoundingClientRect();
|
||||
let minX = Infinity, minY = Infinity, maxX = -Infinity, maxY = -Infinity;
|
||||
|
||||
this.content.nodes.forEach(e => {
|
||||
minX = Math.min(minX, e.x);
|
||||
minY = Math.min(minY, e.y);
|
||||
maxX = Math.max(maxX, e.x + e.width);
|
||||
maxY = Math.max(maxY, e.y + e.height);
|
||||
});
|
||||
|
||||
this.containZoom = clamp(Math.pow(1 / Math.max((maxX - minX) / box.width, (maxY - minY) / box.height), 1.05), Canvas.minZoom, 1);
|
||||
this.centerX = -(minX + (maxX - minX) / 2) + box.width / 2;
|
||||
this.centerY = -(minY + (maxY - minY) / 2) + box.height / 2;
|
||||
}
|
||||
|
||||
mount()
|
||||
{
|
||||
const dragMove = (e: MouseEvent) => {
|
||||
this.dragMove(e);
|
||||
};
|
||||
const dragEnd = (e: MouseEvent) => {
|
||||
window.removeEventListener('mouseup', dragEnd);
|
||||
window.removeEventListener('mousemove', dragMove);
|
||||
|
||||
this.dragEnd(e);
|
||||
};
|
||||
this.container.addEventListener('mouseenter', () => {
|
||||
window.addEventListener('wheel', cancelEvent, { passive: false });
|
||||
document.addEventListener('gesturestart', cancelEvent);
|
||||
document.addEventListener('gesturechange', cancelEvent);
|
||||
|
||||
this.container.addEventListener('mouseleave', () => {
|
||||
window.removeEventListener('wheel', cancelEvent);
|
||||
document.removeEventListener('gesturestart', cancelEvent);
|
||||
document.removeEventListener('gesturechange', cancelEvent);
|
||||
});
|
||||
});
|
||||
this.container.addEventListener('mousedown', (e) => {
|
||||
this.lastX = e.clientX;
|
||||
this.lastY = e.clientY;
|
||||
|
||||
const pos = this.getPosFromCursor(e.clientX, e.clientY);
|
||||
this.firstX = pos.x;
|
||||
this.firstY = pos.y;
|
||||
|
||||
window.addEventListener('mouseup', dragEnd, { passive: true });
|
||||
window.addEventListener('mousemove', dragMove, { passive: true });
|
||||
|
||||
this.dragStart(e);
|
||||
}, { passive: true });
|
||||
this.container.addEventListener('wheel', (e) => {
|
||||
if((this._zoom >= Canvas.maxZoom && e.deltaY < 0) || (this._zoom <= this.containZoom && e.deltaY > 0))
|
||||
return;
|
||||
|
||||
const box = this.container.getBoundingClientRect(), diff = Math.exp(e.deltaY * -0.001);
|
||||
const centerX = (box.x + box.width / 2), centerY = (box.y + box.height / 2);
|
||||
const mousex = centerX - e.clientX, mousey = centerY - e.clientY;
|
||||
|
||||
this.zoomTo(this._x - (mousex / (diff * this._zoom) - mousex / this._zoom), this._y - (mousey / (diff * this._zoom) - mousey / this._zoom), clamp(this._zoom * diff, this.containZoom, Canvas.maxZoom));
|
||||
}, { passive: true });
|
||||
this.container.addEventListener('touchstart', (e) => {
|
||||
({ x: this.lastX, y: this.lastY } = center(e.touches));
|
||||
|
||||
if(e.touches.length > 1)
|
||||
{
|
||||
this.lastDistance = distance(e.touches);
|
||||
}
|
||||
|
||||
this.container.addEventListener('touchend', touchend, { passive: true });
|
||||
this.container.addEventListener('touchcancel', touchcancel, { passive: true });
|
||||
this.container.addEventListener('touchmove', touchmove, { passive: true });
|
||||
}, { passive: true });
|
||||
const touchend = (e: TouchEvent) => {
|
||||
if(e.touches.length > 1)
|
||||
{
|
||||
({ x: this.lastX, y: this.lastY } = center(e.touches));
|
||||
}
|
||||
|
||||
this.container.removeEventListener('touchend', touchend);
|
||||
this.container.removeEventListener('touchcancel', touchcancel);
|
||||
this.container.removeEventListener('touchmove', touchmove);
|
||||
};
|
||||
const touchcancel = (e: TouchEvent) => {
|
||||
if(e.touches.length > 1)
|
||||
{
|
||||
({ x: this.lastX, y: this.lastY } = center(e.touches));
|
||||
}
|
||||
|
||||
this.container.removeEventListener('touchend', touchend);
|
||||
this.container.removeEventListener('touchcancel', touchcancel);
|
||||
this.container.removeEventListener('touchmove', touchmove);
|
||||
};
|
||||
const touchmove = (e: TouchEvent) => {
|
||||
const pos = center(e.touches);
|
||||
this._x = this.visualX = this._x - (this.lastX - pos.x) / this._zoom;
|
||||
this._y = this.visualY = this._y - (this.lastY - pos.y) / this._zoom;
|
||||
this.lastX = pos.x;
|
||||
this.lastY = pos.y;
|
||||
|
||||
if(e.touches.length === 2)
|
||||
{
|
||||
const dist = distance(e.touches);
|
||||
const diff = dist / this.lastDistance;
|
||||
|
||||
this._zoom = clamp(this._zoom * diff, this.containZoom, Canvas.maxZoom);
|
||||
}
|
||||
|
||||
this.updateTransform();
|
||||
};
|
||||
|
||||
this.computeLimits();
|
||||
this.reset();
|
||||
}
|
||||
|
||||
protected updateTransform()
|
||||
{
|
||||
this.transform.style.transform = `scale3d(${this.visualZoom}, ${this.visualZoom}, 1) translate3d(${this.visualX}px, ${this.visualY}px, 0)`;
|
||||
|
||||
clearTimeout(this.debouncedTimeout);
|
||||
this.debouncedTimeout = setTimeout(this.updateScale.bind(this), 150);
|
||||
}
|
||||
|
||||
private updateScale()
|
||||
{
|
||||
this.transform.style.setProperty('--tw-scale', this.visualZoom.toString());
|
||||
this.container.style.setProperty('--zoom-multiplier', (1 / Math.pow(this.visualZoom, 0.7)).toFixed(3));
|
||||
}
|
||||
|
||||
protected zoomTo(x: number, y: number, zoom: number)
|
||||
{
|
||||
const oldX = this._x, oldY = this._y, oldZoom = this._zoom;
|
||||
this._x = x;
|
||||
this._y = y;
|
||||
this._zoom = zoom;
|
||||
|
||||
this.tweener.update((e) => {
|
||||
this.visualX = lerp(e, oldX, x);
|
||||
this.visualY = lerp(e, oldY, y);
|
||||
this.visualZoom = lerp(e, oldZoom, zoom);
|
||||
|
||||
this.updateTransform();
|
||||
}, 50);
|
||||
}
|
||||
|
||||
protected reset()
|
||||
{
|
||||
this.zoomTo(this.centerX, this.centerY, this.containZoom);
|
||||
}
|
||||
|
||||
protected dragStart(e: MouseEvent) {}
|
||||
protected dragMove(e: MouseEvent)
|
||||
{
|
||||
this._x = this.visualX = this._x - (this.lastX - e.clientX) / this._zoom;
|
||||
this._y = this.visualY = this._y - (this.lastY - e.clientY) / this._zoom;
|
||||
|
||||
this.lastX = e.clientX;
|
||||
this.lastY = e.clientY;
|
||||
|
||||
this.updateTransform();
|
||||
}
|
||||
protected dragEnd(e: MouseEvent) {}
|
||||
|
||||
protected getPosFromCursor(x: number, y: number): Position
|
||||
{
|
||||
const box = this.container.getBoundingClientRect();
|
||||
const centerX = box.x + box.width / 2, centerY = box.y + box.height / 2;
|
||||
return {x: (x - centerX) / this._zoom - this._x + box.width / 2, y: (y - centerY) / this._zoom - this._y + box.height / 2 };
|
||||
}
|
||||
|
||||
get zoom()
|
||||
{
|
||||
return this._zoom;
|
||||
}
|
||||
get x()
|
||||
{
|
||||
return this._x;
|
||||
}
|
||||
get y()
|
||||
{
|
||||
return this._y;
|
||||
}
|
||||
|
||||
get viewport()
|
||||
{
|
||||
const box = this.container.getBoundingClientRect();
|
||||
const width = box.width / this._zoom, height = box.height / this._zoom;
|
||||
const movementX = box.width - width, movementY = box.height - height;
|
||||
return { x: -this._x + movementX / 2, y: -this._y + movementY / 2, width, height };
|
||||
}
|
||||
}
|
||||
export class CanvasEditor extends Canvas
|
||||
{
|
||||
private static SPACING = 32;
|
||||
private history: History;
|
||||
private focused: NodeEditable | EdgeEditable | undefined;
|
||||
private selection: Set<NodeEditable> = new Set();
|
||||
|
||||
private dragging: boolean = false;
|
||||
private dragger: HTMLElement = dom('div', { class: 'border border-accent-blue absolute shadow-accent-blue pointer-events-none', style: { 'box-shadow': '0 0 2px var(--tw-shadow-color)' } });
|
||||
|
||||
private pattern: SVGElement = svg('svg', { class: 'absolute top-0 left-0 w-full h-full pointer-events-none' }, [
|
||||
svg('pattern', { attributes: { id: 'canvasPattern', patternUnits: 'userSpaceOnUse' } }, [ svg('circle', { class: 'fill-light-35 dark:fill-dark-35', attributes: { cx: '0.75', cy: '0.75', r: '0.75' } }) ]),
|
||||
svg('rect', { attributes: { x: '0', y: '0', width: '100%', height: '100%', fill: 'url(#canvasPattern)' } })
|
||||
]);
|
||||
private nodeHelper: HTMLElement = dom('div', { class: 'cursor-move absolute z-40', listeners: { mousedown: e => this.moveSelection(e) }, style: { width: '0px', height: '0px' } }, [
|
||||
dom('span', { class: 'cursor-n-resize absolute -top-3 -right-3 -left-3 h-6 group', listeners: { mousedown: e => this.resizeSelection(e, 0, 1, 0, -1) } }, [ dom('span', { class: 'hidden group-hover:block absolute rounded-full border-2 border-light-70 dark:border-dark-70 w-4 h-4 top-1 left-1/2 -translate-x-2', listeners: { mousedown: e => this.dragNewEdge(e, 'top') } }) ]),
|
||||
dom('span', { class: 'cursor-s-resize absolute -bottom-3 -right-3 -left-3 h-6 group', listeners: { mousedown: e => this.resizeSelection(e, 0, 0, 0, 1) } }, [ dom('span', { class: 'hidden group-hover:block absolute rounded-full border-2 border-light-70 dark:border-dark-70 w-4 h-4 bottom-1 left-1/2 -translate-x-2', listeners: { mousedown: e => this.dragNewEdge(e, 'bottom') } }) ]),
|
||||
dom('span', { class: 'cursor-e-resize absolute -top-3 -bottom-3 -right-3 w-6 group', listeners: { mousedown: e => this.resizeSelection(e, 0, 0, 1, 0) } }, [ dom('span', { class: 'hidden group-hover:block absolute rounded-full border-2 border-light-70 dark:border-dark-70 w-4 h-4 right-1 top-1/2 -translate-y-2', listeners: { mousedown: e => this.dragNewEdge(e, 'right') } }) ]),
|
||||
dom('span', { class: 'cursor-w-resize absolute -top-3 -bottom-3 -left-3 w-6 group', listeners: { mousedown: e => this.resizeSelection(e, 1, 0, -1, 0) } }, [ dom('span', { class: 'hidden group-hover:block absolute rounded-full border-2 border-light-70 dark:border-dark-70 w-4 h-4 left-1 top-1/2 -translate-y-2', listeners: { mousedown: e => this.dragNewEdge(e, 'left') } }) ]),
|
||||
dom('span', { class: 'cursor-nw-resize absolute -top-4 -left-4 w-8 h-8', listeners: { mousedown: e => this.resizeSelection(e, 1, 1, -1, -1) } }),
|
||||
dom('span', { class: 'cursor-ne-resize absolute -top-4 -right-4 w-8 h-8', listeners: { mousedown: e => this.resizeSelection(e, 0, 1, 1, -1) } }),
|
||||
dom('span', { class: 'cursor-se-resize absolute -bottom-4 -right-4 w-8 h-8', listeners: { mousedown: e => this.resizeSelection(e, 0, 0, 1, 1) } }),
|
||||
dom('span', { class: 'cursor-sw-resize absolute -bottom-4 -left-4 w-8 h-8', listeners: { mousedown: e => this.resizeSelection(e, 1, 0, -1, 1) } }),
|
||||
]);
|
||||
private edgeHelper: HTMLElement = dom('div', { class: 'absolute', listeners: { } });
|
||||
private boxHelper: HTMLElement = dom('div', { class: '-m-2 border border-accent-purple absolute z-10 p-2 box-content', listeners: { mouseenter: () => this.focusSelection() } });
|
||||
|
||||
protected override nodes: NodeEditable[] = [];
|
||||
protected override edges: EdgeEditable[] = [];
|
||||
|
||||
private preferences: Ref<CanvasPreferences>;
|
||||
private grid: SpatialGrid<NodeEditable> = new SpatialGrid<NodeEditable>(128);
|
||||
|
||||
constructor(content?: CanvasContent)
|
||||
{
|
||||
super(content);
|
||||
|
||||
this.createDOM();
|
||||
|
||||
this.history = new History();
|
||||
this.history.register('canvas', {
|
||||
move: {
|
||||
undo: action => {
|
||||
|
||||
},
|
||||
redo: action => {
|
||||
|
||||
},
|
||||
}
|
||||
});
|
||||
|
||||
this.preferences = useCookie<CanvasPreferences>('canvasPreference', { default: () => ({ gridSnap: true, neighborSnap: true, spacing: 32 }) });
|
||||
}
|
||||
protected override createDOM()
|
||||
{
|
||||
if(!this.grid)
|
||||
return;
|
||||
|
||||
this.nodes = this.content.nodes.map(e => {
|
||||
const node = new NodeEditable(e);
|
||||
//@ts-ignore
|
||||
node.properties.type === "text" && node.addEventListener('focus', this.focusNode.bind(this));
|
||||
//@ts-ignore
|
||||
node.addEventListener('select', this.selectNode.bind(this));
|
||||
//@ts-ignore
|
||||
node.addEventListener('edit', this.editNode.bind(this));
|
||||
node.properties.type === "text" && this.grid.insert(node);
|
||||
return node;
|
||||
});
|
||||
this.edges = this.content.edges.map(e => {
|
||||
const edge = new EdgeEditable(e, this.nodes.find(f => e.fromNode === f.properties.id)!, this.nodes.find(f => e.toNode === f.properties.id)!);
|
||||
//@ts-ignore
|
||||
edge.addEventListener('focus', this.focusEdge.bind(this));
|
||||
//@ts-ignore
|
||||
edge.addEventListener('select', this.selectEdge.bind(this));
|
||||
//@ts-ignore
|
||||
edge.addEventListener('edit', this.editEdge.bind(this));
|
||||
return edge;
|
||||
});
|
||||
|
||||
this.transform = dom('div', { class: 'origin-center h-full' }, [
|
||||
dom('div', { class: 'absolute top-0 left-0 w-full h-full pointer-events-none *:pointer-events-auto *:select-none touch-none' }, [
|
||||
dom('div', {}, [...this.nodes.map(e => e.nodeDom), this.nodeHelper]), dom('div', {}, [...this.edges.map(e => e.edgeDom)]),
|
||||
]), this.edgeHelper,
|
||||
]);
|
||||
|
||||
this.container = dom('div', { class: 'absolute top-0 left-0 overflow-hidden w-full h-full touch-none', listeners: { mousedown: () => { this.selection.clear(); this.updateSelection() } } }, [
|
||||
dom('div', { class: 'flex flex-col absolute sm:top-2 top-10 left-2 z-[35] overflow-hidden gap-4' }, [
|
||||
dom('div', { class: 'border border-light-35 dark:border-dark-35 bg-light-10 dark:bg-dark-10' }, [
|
||||
popper(dom('span', { class: 'w-8 h-8 flex justify-center items-center p-2 hover:bg-light-30 dark:hover:bg-dark-30 cursor-pointer', listeners: { click: () => this.zoomTo(this._x, this._y, clamp(this._zoom * 1.1, this.containZoom, Canvas.maxZoom)) } }, [icon('radix-icons:plus')]), {
|
||||
delay: 120, arrow: true, placement: 'right', offset: 8, content: [text('Zoom avant')], class: 'TooltipContent border border-light-30 dark:border-dark-30 px-2 py-1 bg-light-10 dark:bg-dark-10 text-light-70 dark:text-dark-70 z-50'
|
||||
}),
|
||||
popper(dom('span', { class: 'w-8 h-8 flex justify-center items-center p-2 hover:bg-light-30 dark:hover:bg-dark-30 cursor-pointer', listeners: { click: () => this.reset() } }, [icon('radix-icons:corners')]), {
|
||||
delay: 120, arrow: true, placement: 'right', offset: 8, content: [text('Tout contenir')], class: 'TooltipContent border border-light-30 dark:border-dark-30 px-2 py-1 bg-light-10 dark:bg-dark-10 text-light-70 dark:text-dark-70 z-50'
|
||||
}),
|
||||
popper(dom('span', { class: 'w-8 h-8 flex justify-center items-center p-2 hover:bg-light-30 dark:hover:bg-dark-30 cursor-pointer', listeners: { click: () => this.zoomTo(this._x, this._y, clamp(this._zoom / 1.1, this.containZoom, Canvas.maxZoom)) } }, [icon('radix-icons:minus')]), {
|
||||
delay: 120, arrow: true, placement: 'right', offset: 8, content: [text('Zoom arrière')], class: 'TooltipContent border border-light-30 dark:border-dark-30 px-2 py-1 bg-light-10 dark:bg-dark-10 text-light-70 dark:text-dark-70 z-50'
|
||||
}),
|
||||
]),
|
||||
dom('div', { class: 'border border-light-35 dark:border-dark-35 bg-light-10 dark:bg-dark-10' }, [
|
||||
popper(dom('span', { class: 'w-8 h-8 flex justify-center items-center p-2 hover:bg-light-30 dark:hover:bg-dark-30 cursor-pointer', listeners: { click: () => this.history.undo() } }, [icon('ph:arrow-bend-up-left')]), {
|
||||
delay: 120, arrow: true, placement: 'right', offset: 8, content: [text('Annuler (Ctrl+Z)')], class: 'TooltipContent border border-light-30 dark:border-dark-30 px-2 py-1 bg-light-10 dark:bg-dark-10 text-light-70 dark:text-dark-70 z-50'
|
||||
}),
|
||||
popper(dom('span', { class: 'w-8 h-8 flex justify-center items-center p-2 hover:bg-light-30 dark:hover:bg-dark-30 cursor-pointer', listeners: { click: () => this.history.redo() } }, [icon('ph:arrow-bend-up-right')]), {
|
||||
delay: 120, arrow: true, placement: 'right', offset: 8, content: [text('Rétablir (Ctrl+Y)')], class: 'TooltipContent border border-light-30 dark:border-dark-30 px-2 py-1 bg-light-10 dark:bg-dark-10 text-light-70 dark:text-dark-70 z-50'
|
||||
}),
|
||||
]),
|
||||
dom('div', { class: 'border border-light-35 dark:border-dark-35 bg-light-10 dark:bg-dark-10' }, [
|
||||
popper(dom('span', { class: 'w-8 h-8 flex justify-center items-center p-2 hover:bg-light-30 dark:hover:bg-dark-30 cursor-pointer', listeners: { click: () => {} } }, [icon('radix-icons:gear')]), {
|
||||
delay: 120, arrow: true, placement: 'right', offset: 8, content: [text('Préférences')], class: 'TooltipContent border border-light-30 dark:border-dark-30 px-2 py-1 bg-light-10 dark:bg-dark-10 text-light-70 dark:text-dark-70 z-50'
|
||||
}),
|
||||
popper(dom('span', { class: 'w-8 h-8 flex justify-center items-center p-2 hover:bg-light-30 dark:hover:bg-dark-30 cursor-pointer', listeners: { click: () => {} } }, [icon('radix-icons:question-mark-circled')]), {
|
||||
delay: 120, arrow: true, placement: 'right', offset: 8, content: [text('Aide')], class: 'TooltipContent border border-light-30 dark:border-dark-30 px-2 py-1 bg-light-10 dark:bg-dark-10 text-light-70 dark:text-dark-70 z-50'
|
||||
}),
|
||||
]),
|
||||
]), this.pattern, this.transform
|
||||
]);
|
||||
}
|
||||
|
||||
private focusNode(e: CustomEvent<NodeEditable>)
|
||||
{
|
||||
if(this.dragging)
|
||||
return;
|
||||
|
||||
e.stopImmediatePropagation();
|
||||
|
||||
this.focused = e.detail;
|
||||
Object.assign(this.nodeHelper.style, {
|
||||
transform: `translate(${e.detail.x}px, ${e.detail.y}px)`,
|
||||
width: `${e.detail.width}px`,
|
||||
height: `${e.detail.height}px`,
|
||||
});
|
||||
}
|
||||
private selectNode(e: CustomEvent<NodeEditable>)
|
||||
{
|
||||
|
||||
}
|
||||
private editNode(e: CustomEvent<NodeEditable>)
|
||||
{
|
||||
|
||||
}
|
||||
private updateSelection()
|
||||
{
|
||||
if(this.selection.size > 0)
|
||||
{
|
||||
const selectionBox = getBox(this.selection);
|
||||
Object.assign(this.boxHelper.style, {
|
||||
left: `${selectionBox.x}px`,
|
||||
top: `${selectionBox.y}px`,
|
||||
width: `${selectionBox.width}px`,
|
||||
height: `${selectionBox.height}px`,
|
||||
});
|
||||
|
||||
if(this.boxHelper.parentElement === null) this.transform.appendChild(this.boxHelper);
|
||||
}
|
||||
else
|
||||
this.boxHelper.remove();
|
||||
}
|
||||
private focusSelection()
|
||||
{
|
||||
if(this.dragging)
|
||||
return;
|
||||
|
||||
const box = this.boxHelper.getBoundingClientRect();
|
||||
Object.assign(this.nodeHelper.style, {
|
||||
top: `${box.top}px`,
|
||||
left: `${box.left}px`,
|
||||
width: `${box.width}px`,
|
||||
height: `${box.height}px`,
|
||||
});
|
||||
}
|
||||
private moveSelection(e: MouseEvent)
|
||||
{
|
||||
if(!(e.buttons & 1))
|
||||
return;
|
||||
|
||||
e.stopImmediatePropagation();
|
||||
|
||||
if(this.selection.size === 0 && this.focused !== undefined)
|
||||
{
|
||||
this.selection.add(this.focused as NodeEditable);
|
||||
this.updateSelection();
|
||||
}
|
||||
|
||||
const end = () => {
|
||||
if(moveX !== 0 && moveY !== 0)
|
||||
this.history.add('canvas', 'move', [...this.selection.values()].map(e => ({ element: e, from: { x: startX, y: startY }, to: { x: startX + moveX, y: startY + moveY } })));
|
||||
|
||||
window.removeEventListener('mousemove', move);
|
||||
window.removeEventListener('mouseup', end);
|
||||
};
|
||||
const move = (e: MouseEvent) => {
|
||||
const movementX = e.movementX / this._zoom, movementY = e.movementY / this._zoom;
|
||||
|
||||
moveX += movementX;
|
||||
moveY += movementY;
|
||||
|
||||
this.selection.forEach(_e => {
|
||||
_e.x += movementX;
|
||||
_e.y += movementY;
|
||||
|
||||
_e.update();
|
||||
});
|
||||
|
||||
let box = this.boxHelper.getBoundingClientRect();
|
||||
Object.assign(this.boxHelper.style, {
|
||||
left: `${box.x + movementX}px`,
|
||||
top: `${box.y + movementY}px`,
|
||||
})
|
||||
|
||||
box = this.nodeHelper.getBoundingClientRect();
|
||||
Object.assign(this.nodeHelper.style, {
|
||||
left: `${box.x + movementX}px`,
|
||||
top: `${box.y + movementY}px`,
|
||||
})
|
||||
};
|
||||
|
||||
const startX = e.clientX, startY = e.clientY;
|
||||
let moveX = 0, moveY = 0;
|
||||
window.addEventListener('mousemove', move);
|
||||
window.addEventListener('mouseup', end);
|
||||
}
|
||||
private resizeSelection(e: MouseEvent, x: number, y: number, w: number, h: number)
|
||||
{
|
||||
if(!(e.buttons & 1))
|
||||
return;
|
||||
|
||||
e.stopImmediatePropagation();
|
||||
|
||||
|
||||
}
|
||||
private focusEdge(e: CustomEvent<EdgeEditable>)
|
||||
{
|
||||
this.focused = e.detail;
|
||||
}
|
||||
private selectEdge(e: CustomEvent<EdgeEditable>)
|
||||
{
|
||||
|
||||
}
|
||||
private editEdge(e: CustomEvent<EdgeEditable>)
|
||||
{
|
||||
|
||||
}
|
||||
private dragNewEdge(e: MouseEvent, direction: Direction)
|
||||
{
|
||||
e.stopImmediatePropagation();
|
||||
}
|
||||
|
||||
override updateTransform()
|
||||
{
|
||||
super.updateTransform();
|
||||
|
||||
this.pattern.parentElement?.classList.toggle('hidden', !this.preferences.value.gridSnap);
|
||||
if(this.preferences.value.gridSnap)
|
||||
{
|
||||
this.pattern.setAttribute("x", (this.viewport.width / 2 + this._x % CanvasEditor.SPACING * this._zoom).toFixed(3));
|
||||
this.pattern.setAttribute("y", (this.viewport.height / 2 + this._y % CanvasEditor.SPACING * this._zoom).toFixed(3));
|
||||
this.pattern.setAttribute("width", (this._zoom * CanvasEditor.SPACING).toFixed(3));
|
||||
this.pattern.setAttribute("height", (this._zoom * CanvasEditor.SPACING).toFixed(3));
|
||||
|
||||
this.pattern.children[0].setAttribute('cx', (this._zoom).toFixed(3));
|
||||
this.pattern.children[0].setAttribute('cy', (this._zoom).toFixed(3));
|
||||
this.pattern.children[0].setAttribute('r', (this._zoom).toFixed(3));
|
||||
}
|
||||
}
|
||||
override mount()
|
||||
{
|
||||
super.mount();
|
||||
|
||||
this.container.addEventListener('contextmenu', cancelEvent);
|
||||
}
|
||||
protected override dragStart(e: MouseEvent)
|
||||
{
|
||||
super.dragStart(e);
|
||||
|
||||
this.dragging = !!(e.buttons & 1);
|
||||
|
||||
if(this.dragging)
|
||||
{
|
||||
this.transform.appendChild(this.dragger);
|
||||
|
||||
const pos = this.getPosFromCursor(e.clientX, e.clientY);
|
||||
Object.assign(this.dragger.style, {
|
||||
left: `${pos.x}px`,
|
||||
top: `${pos.y}px`,
|
||||
width: `0px`,
|
||||
height: `0px`,
|
||||
});
|
||||
}
|
||||
}
|
||||
protected override dragMove(e: MouseEvent)
|
||||
{
|
||||
if(this.dragging)
|
||||
{
|
||||
const pos = this.getPosFromCursor(e.clientX, e.clientY);
|
||||
const minX = Math.min(this.firstX, pos.x), minY = Math.min(this.firstY, pos.y), maxX = Math.max(this.firstX, pos.x), maxY = Math.max(this.firstY, pos.y);
|
||||
|
||||
Object.assign(this.dragger.style, {
|
||||
left: `${minX}px`,
|
||||
top: `${minY}px`,
|
||||
width: `${maxX - minX}px`,
|
||||
height: `${maxY - minY}px`,
|
||||
});
|
||||
|
||||
this.selection = new Set(this.grid.query(minX, minY, maxX, maxY));
|
||||
this.updateSelection();
|
||||
}
|
||||
else if(!this.dragging)
|
||||
{
|
||||
super.dragMove(e);
|
||||
}
|
||||
}
|
||||
protected override dragEnd(e: MouseEvent)
|
||||
{
|
||||
this.dragging = false;
|
||||
this.dragger.remove();
|
||||
}
|
||||
}
|
||||
|
||||
function getBox<T extends Box>(selection: Set<T>): Box
|
||||
{
|
||||
let minX = Infinity, minY = Infinity, maxX = -Infinity, maxY = -Infinity;
|
||||
|
||||
selection.forEach(e => {
|
||||
minX = Math.min(minX, e.x);
|
||||
minY = Math.min(minY, e.y);
|
||||
maxX = Math.max(maxX, e.x + e.width);
|
||||
maxY = Math.max(maxY, e.y + e.height);
|
||||
});
|
||||
|
||||
return { x: minX, y: minY, width: maxX - minX, height: maxY - minY };
|
||||
}
|
||||
|
||||
class Tweener
|
||||
{
|
||||
static linear = (progress: number) => progress;
|
||||
|
||||
private progress: number;
|
||||
private duration: number;
|
||||
private last: number;
|
||||
|
||||
private animationFrame: number = 0;
|
||||
|
||||
private animation: (progress: number) => number;
|
||||
private tick?: (progress: number) => void;
|
||||
|
||||
constructor(animation: (progress: number) => number = Tweener.linear)
|
||||
{
|
||||
this.progress = 0, this.duration = 0, this.last = 0;
|
||||
this.animation = animation;
|
||||
}
|
||||
private loop(t: DOMHighResTimeStamp)
|
||||
{
|
||||
const elapsed = t - this.last;
|
||||
this.progress = clamp(this.progress + elapsed, 0, this.duration);
|
||||
this.last = t;
|
||||
|
||||
const step = this.animation(clamp(this.progress / this.duration, 0, 1));
|
||||
this.tick!(step);
|
||||
|
||||
if(this.progress < this.duration)
|
||||
this.animationFrame = requestAnimationFrame(this.loop.bind(this));
|
||||
}
|
||||
update(tick: (progress: number) => void, duration: number)
|
||||
{
|
||||
this.duration = duration + this.duration - this.progress;
|
||||
this.progress = 0;
|
||||
this.last = performance.now();
|
||||
this.tick = tick;
|
||||
|
||||
cancelAnimationFrame(this.animationFrame);
|
||||
this.animationFrame = requestAnimationFrame(this.loop.bind(this));
|
||||
}
|
||||
stop()
|
||||
{
|
||||
cancelAnimationFrame(this.animationFrame);
|
||||
|
||||
this.duration = 0;
|
||||
this.progress = 0;
|
||||
}
|
||||
}
|
||||
902
shared/content.util.ts
Normal file
902
shared/content.util.ts
Normal file
@@ -0,0 +1,902 @@
|
||||
import { safeDestr as parse } from 'destr';
|
||||
import { Canvas, CanvasEditor } from "#shared/canvas.util";
|
||||
import render from "#shared/markdown.util";
|
||||
import { confirm, contextmenu, popper } from "#shared/floating.util";
|
||||
import { cancelPropagation, dom, icon, text, type Node } from "#shared/dom.util";
|
||||
import prose, { h1, h2, loading } from "#shared/proses";
|
||||
import { getID, ID_SIZE, parsePath } from '#shared/general.util';
|
||||
import { TreeDOM, type Recursive } from '#shared/tree';
|
||||
import { History } from '#shared/history.util';
|
||||
import { MarkdownEditor } from '#shared/editor.util';
|
||||
import type { CanvasContent } from '~/types/canvas';
|
||||
|
||||
import { combine } from '@atlaskit/pragmatic-drag-and-drop/combine';
|
||||
import { draggable, dropTargetForElements, monitorForElements } from '@atlaskit/pragmatic-drag-and-drop/element/adapter';
|
||||
import { type Instruction, attachInstruction, extractInstruction } from '@atlaskit/pragmatic-drag-and-drop-hitbox/tree-item';
|
||||
import { autoScrollForElements } from '@atlaskit/pragmatic-drag-and-drop-auto-scroll/element';
|
||||
import type { CleanupFn } from '@atlaskit/pragmatic-drag-and-drop/dist/types/internal-types';
|
||||
|
||||
export type FileType = keyof ContentMap;
|
||||
export interface ContentMap
|
||||
{
|
||||
markdown: string;
|
||||
file: string;
|
||||
canvas: CanvasContent;
|
||||
map: string;
|
||||
folder: null;
|
||||
}
|
||||
export interface Overview<T extends FileType>
|
||||
{
|
||||
id: string;
|
||||
path: string;
|
||||
owner: number;
|
||||
title: string;
|
||||
timestamp: Date;
|
||||
navigable: boolean;
|
||||
private: boolean;
|
||||
order: number;
|
||||
type: T;
|
||||
}
|
||||
export type ProjectContent<T extends FileType = FileType> = Overview<T> & { content: ContentMap[T] };
|
||||
|
||||
class AsyncQueue
|
||||
{
|
||||
private size: number;
|
||||
private count: number = 0;
|
||||
private _queue: Array<() => Promise<any>>;
|
||||
|
||||
promise: Promise<void> = Promise.resolve();
|
||||
finished: boolean = true;
|
||||
|
||||
private res: (value: void | PromiseLike<void>) => void = () => {};
|
||||
private rej: (value: void | PromiseLike<void>) => void = () => {};
|
||||
|
||||
constructor(size: number = 8)
|
||||
{
|
||||
this.size = size;
|
||||
this._queue = [];
|
||||
}
|
||||
|
||||
queue(fn: () => Promise<any>): Promise<void>
|
||||
{
|
||||
if(this.finished)
|
||||
{
|
||||
this.finished = false;
|
||||
|
||||
this.promise = new Promise((res, rej) => {
|
||||
this.res = res;
|
||||
this.rej = rej;
|
||||
});
|
||||
}
|
||||
|
||||
this._queue.push(fn);
|
||||
this.refresh();
|
||||
|
||||
return this.promise;
|
||||
}
|
||||
|
||||
private refresh()
|
||||
{
|
||||
for(let i = this.count; i < this.size && this._queue.length > 0; i++)
|
||||
{
|
||||
this.count++;
|
||||
|
||||
const fn = this._queue.shift()!;
|
||||
fn().catch(e => this.rej(e)).then(() => {
|
||||
this.count--;
|
||||
this.refresh();
|
||||
});
|
||||
}
|
||||
|
||||
if(this.count === 0 && this._queue.length === 0 && !this.finished)
|
||||
{
|
||||
this.finished = true;
|
||||
this.res();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export const DEFAULT_CONTENT: Record<FileType, ContentMap[FileType]> = {
|
||||
map: {},
|
||||
canvas: { nodes: [], edges: []},
|
||||
markdown: '',
|
||||
file: '',
|
||||
folder: null,
|
||||
};
|
||||
export type LocalContent<T extends FileType = FileType> = ProjectContent<T> & {
|
||||
localEdit?: boolean;
|
||||
error?: boolean;
|
||||
};
|
||||
export class Content
|
||||
{
|
||||
private static _ready = false;
|
||||
private static initPromise?: Promise<boolean>;
|
||||
|
||||
private static root: FileSystemDirectoryHandle;
|
||||
|
||||
private static _overview: Record<string, Omit<LocalContent, 'content'>>;
|
||||
private static queue = new AsyncQueue();
|
||||
|
||||
static init(): Promise<boolean>
|
||||
{
|
||||
if(Content._ready)
|
||||
return Promise.resolve(true);
|
||||
|
||||
Content.initPromise = new Promise(async (res) => {
|
||||
try
|
||||
{
|
||||
if(!('storage' in navigator))
|
||||
return false;
|
||||
|
||||
Content.root = await navigator.storage.getDirectory();
|
||||
Content.root.getDirectoryHandle('storage', { create: true });
|
||||
|
||||
const overview = await Content.read('overview', { create: true });
|
||||
try
|
||||
{
|
||||
Content._overview = parse<Record<string, Omit<LocalContent, 'content'>>>(overview);
|
||||
}
|
||||
catch(e)
|
||||
{
|
||||
Content._overview = {};
|
||||
await Content.pull();
|
||||
}
|
||||
|
||||
Content._ready = true;
|
||||
}
|
||||
catch(e)
|
||||
{
|
||||
console.error(e);
|
||||
}
|
||||
|
||||
res(Content._ready);
|
||||
});
|
||||
|
||||
return Content.initPromise;
|
||||
}
|
||||
static getFromPath(path: string)
|
||||
{
|
||||
return Object.values(Content._overview).find(e => e.path === path);
|
||||
}
|
||||
static get(id: string)
|
||||
{
|
||||
return Content._overview[id];
|
||||
}
|
||||
static async getContent(id: string): Promise<LocalContent | undefined>
|
||||
{
|
||||
const overview = Content._overview[id];
|
||||
|
||||
if(!overview)
|
||||
return;
|
||||
|
||||
return { ...overview, content: Content.fromString(overview, (await Content.read(id, { create: true }))!) };
|
||||
}
|
||||
static set(id: string, overview?: Omit<LocalContent, 'content'> | Recursive<Omit<LocalContent, 'content'>>)
|
||||
{
|
||||
if(overview === undefined)
|
||||
{
|
||||
delete Content._overview[id];
|
||||
}
|
||||
else
|
||||
{
|
||||
const {
|
||||
id: _id,
|
||||
path: _path,
|
||||
owner: _owner,
|
||||
title: _title,
|
||||
timestamp: _timestamp,
|
||||
navigable: _navigable,
|
||||
private: _private,
|
||||
order: _order,
|
||||
type: _type,
|
||||
...rest
|
||||
} = overview as Recursive<LocalContent>;
|
||||
Content._overview[id] = {
|
||||
id: _id,
|
||||
path: _path,
|
||||
owner: _owner,
|
||||
title: _title,
|
||||
timestamp: _timestamp,
|
||||
navigable: _navigable,
|
||||
private: _private,
|
||||
order: _order,
|
||||
type: _type,
|
||||
};
|
||||
}
|
||||
}
|
||||
static async save(content?: ProjectContent)
|
||||
{
|
||||
const overviewAsString = JSON.stringify(Content._overview)
|
||||
Content.queue.queue(() => Content.write("overview", overviewAsString));
|
||||
|
||||
if(content && content.content)
|
||||
{
|
||||
const contentAsString = Content.toString(content);
|
||||
Content.queue.queue(() => Content.write(content.id, contentAsString));
|
||||
}
|
||||
|
||||
return Content.queue.promise;
|
||||
}
|
||||
static async pull()
|
||||
{
|
||||
const overview = (await useRequestFetch()('/api/file/overview', { cache: 'no-cache' })) as ProjectContent<FileType>[] | undefined;
|
||||
|
||||
if(!overview)
|
||||
{
|
||||
//TODO: Cannot get data :'(
|
||||
//Add a warning ?
|
||||
return;
|
||||
}
|
||||
|
||||
for(const file of overview)
|
||||
{
|
||||
const _overview = Content._overview[file.id];
|
||||
if(_overview && _overview.localEdit)
|
||||
{
|
||||
//TODO: Ask what to do about this file.
|
||||
}
|
||||
else
|
||||
{
|
||||
Content._overview[file.id] = file;
|
||||
|
||||
Content.queue.queue(() => {
|
||||
return useRequestFetch()(`/api/file/content/${file.id}`, { cache: 'no-cache' }).then(async (content: string | undefined) => {
|
||||
if(content)
|
||||
{
|
||||
if(file.type !== 'folder')
|
||||
{
|
||||
Content.queue.queue(() => Content.write(file.id, content, { create: true }));
|
||||
Content.queue.queue(() => Content.write('storage/' + file.path + (file.type === 'canvas' ? '.canvas' : '.md'), Content.toString({ ...file, content: Content.fromString(file, content) }), { create: true }));
|
||||
}
|
||||
}
|
||||
else
|
||||
Content._overview[file.id].error = true;
|
||||
}).catch(e => {
|
||||
Content._overview[file.id].error = true;
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
return Content.queue.queue(() => {
|
||||
return Content.write('overview', JSON.stringify(Content._overview), { create: true });
|
||||
});
|
||||
}
|
||||
static async push()
|
||||
{
|
||||
const blocked = (await useRequestFetch()('/api/file/overview', { method: 'POST', body: Object.values(Content._overview), cache: 'no-cache' }));
|
||||
|
||||
for(const [id, value] of Object.entries(Content._overview).filter(e => !blocked.includes(e[0])))
|
||||
{
|
||||
if(value.type === 'folder')
|
||||
continue;
|
||||
|
||||
Content.queue.queue(() => Content.read(id).then(e => {
|
||||
if(e) Content.queue.queue(() => useRequestFetch()(`/api/file/content/${id}`, { method: 'POST', body: e, cache: 'no-cache' }));
|
||||
}));
|
||||
}
|
||||
|
||||
return Content.queue.promise;
|
||||
}
|
||||
//Maybe store the file handles ? Is it safe to keep them ?
|
||||
private static async read(path: string, options?: FileSystemGetFileOptions): Promise<string | undefined>
|
||||
{
|
||||
try
|
||||
{
|
||||
console.time(`Reading '${path}'`);
|
||||
const handle = await Content.root.getFileHandle(path, options);
|
||||
const file = await handle.getFile();
|
||||
|
||||
const text = await file.text();
|
||||
console.timeEnd(`Reading '${path}'`);
|
||||
return text;
|
||||
}
|
||||
catch(e)
|
||||
{
|
||||
console.error(path, e);
|
||||
console.timeEnd(`Reading '${path}'`);
|
||||
}
|
||||
}
|
||||
private static async goto(path: string, options?: FileSystemGetDirectoryOptions): Promise<FileSystemDirectoryHandle | undefined>
|
||||
{
|
||||
const splitPath = path.split("/");
|
||||
let handle = Content.root;
|
||||
try
|
||||
{
|
||||
for(const p of splitPath)
|
||||
{
|
||||
handle = await handle.getDirectoryHandle(p, options);
|
||||
}
|
||||
return handle;
|
||||
}
|
||||
catch(e)
|
||||
{
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
//Easy to use, but not very performant.
|
||||
private static async write(path: string, content: string, options?: FileSystemGetFileOptions): Promise<void>
|
||||
{
|
||||
const size = new TextEncoder().encode(content).byteLength;
|
||||
console.time(`Writing ${size} bytes to '${path}'`);
|
||||
try
|
||||
{
|
||||
const parent = path.split('/').slice(0, -1).join('/'), basename = path.split('/').slice(-1).join('/');
|
||||
const handle = await (await Content.goto(parent, { create: true }) ?? Content.root).getFileHandle(basename, options);
|
||||
const file = await handle.createWritable({ keepExistingData: false });
|
||||
|
||||
await file.write(content);
|
||||
await file.close();
|
||||
}
|
||||
catch(e)
|
||||
{
|
||||
console.error(path, e);
|
||||
}
|
||||
console.timeEnd(`Writing ${size} bytes to '${path}'`);
|
||||
}
|
||||
|
||||
static get estimate(): Promise<StorageEstimate>
|
||||
{
|
||||
return Content._ready ? navigator.storage.estimate() : Promise.reject();
|
||||
}
|
||||
|
||||
static toString<T extends FileType>(content: ProjectContent<T>): string
|
||||
{
|
||||
return handlers[content.type].toString(content.content);
|
||||
}
|
||||
|
||||
static fromString<T extends FileType>(overview: Omit<ProjectContent<T>, 'content'>, content: string): ContentMap[T]
|
||||
{
|
||||
return handlers[overview.type].fromString(content);
|
||||
}
|
||||
|
||||
static render(parent: HTMLElement, path: string): Omit<LocalContent, 'content'> | undefined
|
||||
{
|
||||
const overview = Content.getFromPath(path);
|
||||
|
||||
if(!!overview)
|
||||
{
|
||||
const load = dom('div', { class: 'flex, flex-1 justify-center items-center' }, [loading('normal')]);
|
||||
parent.appendChild(load);
|
||||
|
||||
function _render<T extends FileType>(content: LocalContent<T>): void
|
||||
{
|
||||
const el = handlers[content.type].render(content);
|
||||
el && parent.replaceChild(el, load);
|
||||
}
|
||||
|
||||
Content.getContent(overview.id).then(content => _render(content!));
|
||||
}
|
||||
else
|
||||
{
|
||||
parent.appendChild(dom('h2', { class: 'flex-1 text-center', text: "Impossible d'afficher le contenu demandé" }));
|
||||
}
|
||||
|
||||
return overview;
|
||||
}
|
||||
|
||||
static get files()
|
||||
{
|
||||
return Object.freeze(Content._overview);
|
||||
}
|
||||
static get tree()
|
||||
{
|
||||
const arr: Recursive<Omit<LocalContent, 'content'>>[] = [];
|
||||
|
||||
function addChild(arr: Recursive<Omit<LocalContent, 'content'>>[], overview: Omit<LocalContent, 'content'>): void {
|
||||
const parent = arr.find(f => overview.path.startsWith(f.path));
|
||||
|
||||
if(parent)
|
||||
{
|
||||
if(!parent.children)
|
||||
parent.children = [];
|
||||
|
||||
(overview as Recursive<typeof overview>).parent = parent;
|
||||
addChild(parent.children, overview);
|
||||
}
|
||||
else
|
||||
{
|
||||
arr.push({ ...overview });
|
||||
arr.sort((a, b) => {
|
||||
if(a.order !== b.order)
|
||||
return a.order - b.order;
|
||||
return a.title.localeCompare(b.title);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
for(const element of Object.values(Content._overview))
|
||||
{
|
||||
addChild(arr, {...element});
|
||||
}
|
||||
|
||||
return arr;
|
||||
}
|
||||
static get ready(): Promise<boolean>
|
||||
{
|
||||
return Content._ready ? Promise.resolve(true) : Content.initPromise ?? Promise.resolve(false);
|
||||
}
|
||||
}
|
||||
|
||||
type ContentTypeHandler<T extends FileType> = {
|
||||
toString: (content: ContentMap[T]) => string;
|
||||
fromString: (str: string) => ContentMap[T];
|
||||
render: (content: LocalContent<T>) => Node;
|
||||
renderEditor: (content: LocalContent<T>) => Node;
|
||||
};
|
||||
|
||||
function reshapeLinks(content: string | null, all: ProjectContent[])
|
||||
{
|
||||
return content?.replace(/\[\[(.*?)?(#.*?)?(\|.*?)?\]\]/g, (str, link, header, title) => {
|
||||
return `[[${link ? parsePath(all.find(e => e.path.endsWith(parsePath(link)))?.path ?? parsePath(link)) : ''}${header ?? ''}${title ?? ''}]]`;
|
||||
});
|
||||
}
|
||||
|
||||
const handlers: { [K in FileType]: ContentTypeHandler<K> } = {
|
||||
canvas: {
|
||||
toString: (content) => {
|
||||
const mapping: Record<string, string> = {
|
||||
'red': '1',
|
||||
'orange': '2',
|
||||
'yellow': '3',
|
||||
'green': '4',
|
||||
'cyan': '5',
|
||||
'purple': '6',
|
||||
};
|
||||
content.edges?.forEach(e => e.color = e.color ? e.color.hex ?? (e.color.class ? mapping[e.color.class]! : undefined) : undefined);
|
||||
content.nodes?.forEach(e => e.color = e.color ? e.color.hex ?? (e.color.class ? mapping[e.color.class]! : undefined) : undefined);
|
||||
|
||||
return JSON.stringify(content);
|
||||
},
|
||||
fromString: (str) => JSON.parse(str),
|
||||
render: (content) => {
|
||||
const c = new Canvas(content.content);
|
||||
queueMicrotask(() => c.mount());
|
||||
return c.container;
|
||||
},
|
||||
renderEditor: (content) => {
|
||||
let element: HTMLElement;
|
||||
if(content.hasOwnProperty('content'))
|
||||
{
|
||||
const c = new CanvasEditor(content.content);
|
||||
queueMicrotask(() => c.mount());
|
||||
element = c.container;
|
||||
}
|
||||
else
|
||||
{
|
||||
element = loading("large");
|
||||
Content.getContent(content.id).then(e => {
|
||||
if(!e)
|
||||
return element.parentElement?.replaceChild(dom('div', { class: '', text: 'Une erreur est survenue.' }), element);
|
||||
|
||||
content.content = e.content as CanvasContent;
|
||||
const c = new CanvasEditor(content.content);
|
||||
queueMicrotask(() => c.mount());
|
||||
element.parentElement?.replaceChild(c.container, element);
|
||||
});
|
||||
}
|
||||
return element;
|
||||
},
|
||||
},
|
||||
markdown: {
|
||||
toString: (content) => content,
|
||||
fromString: (str) => str,
|
||||
render: (content) => {
|
||||
return dom('div', { class: 'flex flex-1 justify-start items-start flex-col lg:px-16 xl:px-32 2xl:px-64 py-6' }, [
|
||||
dom('div', { class: 'flex flex-1 flex-row justify-between items-center' }, [
|
||||
prose('h1', h1, [text(content.title)]),
|
||||
dom('div', { class: 'flex gap-4' }, [
|
||||
//TODO: Edition link
|
||||
]),
|
||||
]),
|
||||
render(content.content),
|
||||
])
|
||||
},
|
||||
renderEditor: (content) => {
|
||||
let element: HTMLElement;
|
||||
if(content.hasOwnProperty('content'))
|
||||
{
|
||||
MarkdownEditor.singleton.content = content.content;
|
||||
element = MarkdownEditor.singleton.dom;
|
||||
}
|
||||
else
|
||||
{
|
||||
element = loading("large");
|
||||
Content.getContent(content.id).then(e => {
|
||||
if(!e)
|
||||
return element.parentElement?.replaceChild(dom('div', { class: '', text: 'Une erreur est survenue.' }), element);
|
||||
|
||||
MarkdownEditor.singleton.content = content.content = (e as typeof content).content;
|
||||
element.parentElement?.replaceChild(MarkdownEditor.singleton.dom, element);
|
||||
});
|
||||
}
|
||||
MarkdownEditor.singleton.onChange = (value) => { content.content = value; };
|
||||
return dom('div', { class: 'flex flex-1 justify-start items-start flex-col lg:px-16 xl:px-32 2xl:px-64 py-6' }, [
|
||||
dom('div', { class: 'flex flex-row justify-between items-center' }, [ prose('h1', h1, [text(content.title)]) ]),
|
||||
dom('div', { class: 'flex flex-1 w-full justify-stretch items-stretch py-2 px-1.5 font-sans text-base' }, [element]),
|
||||
])
|
||||
},
|
||||
},
|
||||
file: {
|
||||
toString: (content) => content,
|
||||
fromString: (str) => str,
|
||||
render: (content) => prose('h2', h2, [text('En cours de développement')], { class: 'flex-1 text-center' }),
|
||||
renderEditor: (content) => prose('h2', h2, [text('En cours de développement')], { class: 'flex-1 text-center' }),
|
||||
},
|
||||
map: {
|
||||
toString: (content) => content,
|
||||
fromString: (str) => str,
|
||||
render: (content) => prose('h2', h2, [text('En cours de développement')], { class: 'flex-1 text-center' }),
|
||||
renderEditor: (content) => prose('h2', h2, [text('En cours de développement')], { class: 'flex-1 text-center' }),
|
||||
},
|
||||
folder: {
|
||||
toString: (_) => '',
|
||||
fromString: (_) => null,
|
||||
render: (content) => prose('h2', h2, [text('En cours de développement')], { class: 'flex-1 text-center' }),
|
||||
renderEditor: (content) => prose('h2', h2, [text('En cours de développement')], { class: 'flex-1 text-center' }),
|
||||
}
|
||||
};
|
||||
|
||||
export const iconByType: Record<FileType, string> = {
|
||||
'folder': 'lucide:folder',
|
||||
'canvas': 'ph:graph-light',
|
||||
'file': 'radix-icons:file',
|
||||
'markdown': 'radix-icons:file-text',
|
||||
'map': 'lucide:map',
|
||||
};
|
||||
|
||||
export class Editor
|
||||
{
|
||||
tree: TreeDOM;
|
||||
container: HTMLDivElement;
|
||||
|
||||
selected?: Recursive<LocalContent & { element?: HTMLElement }>;
|
||||
|
||||
private instruction: HTMLDivElement;
|
||||
private cleanup: CleanupFn;
|
||||
|
||||
private history: History;
|
||||
|
||||
constructor()
|
||||
{
|
||||
this.history = new History();
|
||||
this.history.register('overview', {
|
||||
move: {
|
||||
undo: (action) => {
|
||||
this.tree.tree.remove(action.element.id);
|
||||
action.element.parent = action.from.parent;
|
||||
action.element.order = action.from.order;
|
||||
const path = getPath(action.element), depth = path.split("/").filter(e => !!e).length;
|
||||
|
||||
this.tree.tree.insertAt(action.element, action.to.order as number);
|
||||
action.element.element = this.tree.render(action.element, depth);
|
||||
action.element?.cleanup();
|
||||
this.dragndrop(action.element, depth, action.element.parent);
|
||||
this.tree.update();
|
||||
|
||||
action.element.path = path;
|
||||
},
|
||||
redo: (action) => {
|
||||
this.tree.tree.remove(action.element.id);
|
||||
action.element.parent = action.to.parent;
|
||||
action.element.order = action.to.order;
|
||||
const path = getPath(action.element), depth = path.split("/").filter(e => !!e).length;
|
||||
|
||||
this.tree.tree.insertAt(action.element, action.to.order as number);
|
||||
|
||||
action.element.element = this.tree.render(action.element, depth);
|
||||
action.element?.cleanup();
|
||||
this.dragndrop(action.element, depth, action.element.parent);
|
||||
this.tree.update();
|
||||
|
||||
action.element.path = path;
|
||||
},
|
||||
},
|
||||
add: {
|
||||
undo: (action) => {
|
||||
this.tree.tree.remove(action.element.id);
|
||||
if(this.selected === action.element) this.select();
|
||||
action.element.cleanup();
|
||||
action.element.element?.remove();
|
||||
|
||||
},
|
||||
redo: (action) => {
|
||||
if(!action.element)
|
||||
{
|
||||
const depth = getPath(action.element as LocalContent).split('/').length;
|
||||
action.element.element = this.tree.render(action.element as LocalContent, depth) as HTMLElement;
|
||||
this.dragndrop(action.element as LocalContent, depth, (action.element as Recursive<LocalContent>).parent);
|
||||
}
|
||||
this.tree.tree.insertAt(action.element as Recursive<LocalContent>, action.to as number);
|
||||
this.tree.update();
|
||||
},
|
||||
},
|
||||
remove: {
|
||||
undo: (action) => {
|
||||
this.tree.tree.insertAt(action.element, action.from as number);
|
||||
this.tree.update();
|
||||
},
|
||||
redo: (action) => {
|
||||
this.tree.tree.remove(action.element.id);
|
||||
if(this.selected === action.element) this.select();
|
||||
action.element.cleanup();
|
||||
action.element.element?.remove();
|
||||
},
|
||||
},
|
||||
rename: {
|
||||
undo: (action) => {
|
||||
action.element.title = action.from;
|
||||
action.element.element!.children[0].children[1].textContent = action.from;
|
||||
action.element.element!.children[0].children[1].setAttribute('title', action.from);
|
||||
|
||||
const path = getPath(action.element), depth = path.split("/").filter(e => !!e).length;
|
||||
action.element?.cleanup();
|
||||
this.dragndrop(action.element, depth, action.element.parent);
|
||||
action.element.path = path;
|
||||
},
|
||||
redo: (action) => {
|
||||
action.element.title = action.to;
|
||||
action.element.element!.children[0].children[1].textContent = action.to;
|
||||
action.element.element!.children[0].children[1].setAttribute('title', action.to);
|
||||
|
||||
const path = getPath(action.element), depth = path.split("/").filter(e => !!e).length;
|
||||
action.element?.cleanup();
|
||||
this.dragndrop(action.element, depth, action.element.parent);
|
||||
action.element.path = path;
|
||||
},
|
||||
},
|
||||
navigable: {
|
||||
undo: (action) => {
|
||||
action.element.navigable = action.from;
|
||||
action.element.element!.children[0].children[2].children[0].replaceWith(icon(action.element.navigable ? 'radix-icons:eye-open' : 'radix-icons:eye-none', { class: ['mx-1', { 'opacity-50': !action.element.navigable }] }));
|
||||
},
|
||||
redo: (action) => {
|
||||
action.element.navigable = action.to;
|
||||
action.element.element!.children[0].children[2].children[0].replaceWith(icon(action.element.navigable ? 'radix-icons:eye-open' : 'radix-icons:eye-none', { class: ['mx-1', { 'opacity-50': !action.element.navigable }] }));
|
||||
},
|
||||
},
|
||||
private: {
|
||||
undo: (action) => {
|
||||
action.element.private = action.from;
|
||||
action.element.element!.children[0].children[3].children[0].replaceWith(icon(action.element.private ? 'radix-icons:lock-closed' : 'radix-icons:lock-open-2', { class: ['mx-1', { 'opacity-50': !action.element.private }] }));
|
||||
},
|
||||
redo: (action) => {
|
||||
action.element.private = action.to;
|
||||
action.element.element!.children[0].children[3].children[0].replaceWith(icon(action.element.private ? 'radix-icons:lock-closed' : 'radix-icons:lock-open-2', { class: ['mx-1', { 'opacity-50': !action.element.private }] }));
|
||||
},
|
||||
},
|
||||
}, () => { this.tree.tree.each(e => Content.set(e.id, e)); Content.save(); });
|
||||
|
||||
this.tree = new TreeDOM((item, depth) => {
|
||||
return dom('div', { class: 'group flex items-center ps-2 outline-none relative cursor-pointer', style: { 'padding-left': `${depth / 2 - 0.5}em` } }, [dom('div', { class: ['flex flex-1 items-center hover:border-accent-blue hover:text-accent-purple max-w-full cursor-pointer font-medium'], attributes: { 'data-private': item.private }, listeners: { contextmenu: (e) => this.contextmenu(e, item as LocalContent)} }, [
|
||||
icon('radix-icons:chevron-right', { class: 'h-4 w-4 transition-transform absolute group-data-[state=open]:rotate-90', style: { 'left': `${depth / 2 - 1.5}em` } }),
|
||||
dom('div', { class: 'pl-1.5 py-1.5 flex-1 truncate', text: item.title, attributes: { title: item.title } }),
|
||||
popper(dom('span', { class: 'flex', listeners: { click: e => this.toggleNavigable(e, item as LocalContent) } }, [icon(item.navigable ? 'radix-icons:eye-open' : 'radix-icons:eye-none', { class: ['mx-1', { 'opacity-50': !item.navigable }] })]), { delay: 150, offset: 8, placement: 'left', arrow: true, content: [text('Navigable')], class: 'TooltipContent border border-light-30 dark:border-dark-30 px-2 py-1 bg-light-10 dark:bg-dark-10 text-light-70 dark:text-dark-70 z-50' }),
|
||||
popper(dom('span', { class: 'flex', listeners: { click: e => this.togglePrivate(e, item as LocalContent) } }, [icon(item.private ? 'radix-icons:lock-closed' : 'radix-icons:lock-open-2', { class: ['mx-1', { 'opacity-50': !item.private }] })]), { delay: 150, offset: 8, placement: 'right', arrow: true, content: [text('Privé')], class: 'TooltipContent border border-light-30 dark:border-dark-30 px-2 py-1 bg-light-10 dark:bg-dark-10 text-light-70 dark:text-dark-70 z-50' }),
|
||||
])]);
|
||||
}, (item, depth) => {
|
||||
return dom('div', { class: 'group flex items-center ps-2 outline-none relative cursor-pointer', style: { 'padding-left': `${depth / 2 - 0.5}em` } }, [dom('div', { class: ['flex flex-1 items-center hover:border-accent-blue hover:text-accent-purple max-w-full'], attributes: { 'data-private': item.private }, listeners: { contextmenu: (e) => this.contextmenu(e, item as LocalContent), click: () => this.select(item as LocalContent) } }, [
|
||||
icon(iconByType[item.type], { class: 'w-5 h-5', width: 20, height: 20 }),
|
||||
dom('div', { class: 'pl-1.5 py-1.5 flex-1 truncate', text: item.title, attributes: { title: item.title } }),
|
||||
popper(dom('span', { class: 'flex', listeners: { click: e => this.toggleNavigable(e, item as LocalContent) } }, [icon(item.navigable ? 'radix-icons:eye-open' : 'radix-icons:eye-none', { class: ['mx-1', { 'opacity-50': !item.navigable }] })]), { delay: 150, offset: 8, placement: 'left', arrow: true, content: [text('Navigable')], class: 'TooltipContent border border-light-30 dark:border-dark-30 px-2 py-1 bg-light-10 dark:bg-dark-10 text-light-70 dark:text-dark-70 z-50' }),
|
||||
popper(dom('span', { class: 'flex', listeners: { click: e => this.togglePrivate(e, item as LocalContent) } }, [icon(item.private ? 'radix-icons:lock-closed' : 'radix-icons:lock-open-2', { class: ['mx-1', { 'opacity-50': !item.private }] })]), { delay: 150, offset: 8, placement: 'right', arrow: true, content: [text('Privé')], class: 'TooltipContent border border-light-30 dark:border-dark-30 px-2 py-1 bg-light-10 dark:bg-dark-10 text-light-70 dark:text-dark-70 z-50' }),
|
||||
])]);
|
||||
});
|
||||
|
||||
this.instruction = dom('div', { class: 'absolute h-full w-full top-0 right-0 border-light-50 dark:border-dark-50' });
|
||||
|
||||
this.cleanup = this.setupDnD();
|
||||
|
||||
this.container = dom('div', { class: 'flex flex-1 flex-col items-start justify-start max-h-full relative' }, [dom('div', { class: 'py-4 flex-1 w-full max-h-full flex overflow-auto xl:px-12 lg:px-8 px-6 relative' })]);
|
||||
|
||||
this.select(this.tree.tree.find(useRouter().currentRoute.value.hash.substring(1)) as Recursive<LocalContent & { element?: HTMLElement }> | undefined);
|
||||
}
|
||||
private contextmenu(e: MouseEvent, item: Recursive<LocalContent>)
|
||||
{
|
||||
e.preventDefault();
|
||||
|
||||
const close = contextmenu(e.clientX, e.clientY, [
|
||||
dom('div', { class: 'hover:bg-light-35 dark:hover:bg-dark-35 px-2 gap-2 flex py-1 items-center cursor-pointer text-light-100 dark:text-dark-100', listeners: { click: (e) => { this.add("markdown", item); close() }} }, [icon('radix-icons:plus'), text('Ajouter')]),
|
||||
dom('div', { class: 'hover:bg-light-35 dark:hover:bg-dark-35 px-2 gap-2 flex py-1 items-center cursor-pointer text-light-100 dark:text-dark-100', listeners: { click: (e) => { this.rename(item); close() }} }, [icon('radix-icons:input'), text('Renommer')]),
|
||||
dom('div', { class: 'hover:bg-light-35 dark:hover:bg-dark-35 px-2 gap-2 flex py-1 items-center cursor-pointer text-light-red dark:text-dark-red', listeners: { click: (e) => { close(); confirm(`Confirmer la suppression de ${item.title}${item.children ? ' et de ses enfants' : ''} ?`).then(e => { if(e) this.remove(item)}) }} }, [icon('radix-icons:trash'), text('Supprimer')]),
|
||||
], { placement: 'right-start', offset: 8 });
|
||||
}
|
||||
private add(type: FileType, nextTo: Recursive<LocalContent>)
|
||||
{
|
||||
const count = Object.values(Content.files).filter(e => e.title.match(/^Nouveau( \(\d+\))?$/)).length;
|
||||
const item: Recursive<Omit<LocalContent, 'path' | 'content'> & { element?: HTMLElement }> = { id: getID(ID_SIZE), navigable: true, private: false, owner: 0, order: nextTo.order + 1, timestamp: new Date(), title: count === 0 ? 'Nouveau' : `Nouveau (${count})`, type: type, parent: nextTo.parent };
|
||||
this.history.add('overview', 'add', [{ element: item, from: undefined, to: nextTo.order + 1 }]);
|
||||
}
|
||||
private remove(item: LocalContent & { element?: HTMLElement })
|
||||
{
|
||||
this.history.add('overview', 'remove', [{ element: item, from: item.order, to: undefined }], true);
|
||||
}
|
||||
private rename(item: LocalContent & { element?: HTMLElement })
|
||||
{
|
||||
let exists = true;
|
||||
const change = () =>
|
||||
{
|
||||
const value = input.value || item.title;
|
||||
|
||||
if(exists)
|
||||
{
|
||||
exists = false;
|
||||
|
||||
input.parentElement?.replaceChild(text, input);
|
||||
input.remove();
|
||||
if(value !== item.title) this.history.add('overview', 'rename', [{ element: item, from: item.title, to: value }], true);
|
||||
}
|
||||
}
|
||||
const text = item.element!.children[0].children[1];
|
||||
const input = dom('input', { attributes: { type: 'text', value: item.title }, class: 'bg-light-20 dark:bg-dark-20 outline outline-light-35 dark:outline-dark-35 outline-offset-0 pl-1.5 py-1.5 flex-1', listeners: { mousedown: cancelPropagation, click: cancelPropagation, blur: change, change: change } });
|
||||
|
||||
text.parentElement?.replaceChild(input, text);
|
||||
input.focus();
|
||||
}
|
||||
private toggleNavigable(e: Event, item: LocalContent & { element?: HTMLElement })
|
||||
{
|
||||
cancelPropagation(e);
|
||||
|
||||
this.history.add('overview', 'navigable', [{ element: item, from: item.navigable, to: !item.navigable }], true);
|
||||
}
|
||||
private togglePrivate(e: Event, item: LocalContent & { element?: HTMLElement })
|
||||
{
|
||||
cancelPropagation(e);
|
||||
|
||||
this.history.add('overview', 'private', [{ element: item, from: item.private, to: !item.private }], true);
|
||||
}
|
||||
private setupDnD(): CleanupFn
|
||||
{
|
||||
return combine(...this.tree.tree.accumulate(this.dragndrop.bind(this)), monitorForElements({
|
||||
onDrop: ({ location }) => {
|
||||
if (location.initial.dropTargets.length === 0)
|
||||
return;
|
||||
if (location.current.dropTargets.length === 0)
|
||||
return;
|
||||
|
||||
const target = location.current.dropTargets[0];
|
||||
const instruction = extractInstruction(target.data);
|
||||
|
||||
if (instruction !== null)
|
||||
this.updateTree(instruction, location.initial.dropTargets[0].data.id as string, target.data.id as string);
|
||||
},
|
||||
}), autoScrollForElements({
|
||||
element: this.tree.container,
|
||||
}));
|
||||
}
|
||||
private dragndrop(item: Omit<LocalContent & { element?: HTMLElement, cleanup?: () => void }, "content">, depth: number, parent?: Omit<LocalContent & { element?: HTMLElement }, "content">): CleanupFn
|
||||
{
|
||||
item.cleanup && item.cleanup();
|
||||
|
||||
let opened = false, draggedOpened = false;
|
||||
const element = item.element!;
|
||||
item.cleanup = combine(draggable({
|
||||
element,
|
||||
onDragStart: () => {
|
||||
element.classList.toggle('opacity-50', true);
|
||||
opened = this.tree.opened(item)!;
|
||||
this.tree.toggle(item, false);
|
||||
},
|
||||
onDrop: () => {
|
||||
element.classList.toggle('opacity-50', false);
|
||||
this.tree.toggle(item, opened);
|
||||
},
|
||||
canDrag: ({ element }) => {
|
||||
return !element.querySelector('input[type="text"]');
|
||||
}
|
||||
}),
|
||||
|
||||
dropTargetForElements({
|
||||
element,
|
||||
getData: ({ input }) => {
|
||||
const data = { id: item.id };
|
||||
|
||||
return attachInstruction(data, {
|
||||
input,
|
||||
element,
|
||||
indentPerLevel: 16,
|
||||
currentLevel: depth,
|
||||
mode: !!(item as Recursive<typeof item>).children ? 'expanded' : parent ? ((parent as Recursive<typeof item>).children!.length === item.order + 1 ? 'last-in-group' : 'standard') : this.tree.tree.flatten.slice(-1)[0] === item ? 'last-in-group' : 'standard',
|
||||
block: [],
|
||||
})
|
||||
},
|
||||
canDrop: ({ source }) => {
|
||||
return source.data.id !== getPath(item);
|
||||
},
|
||||
onDrag: ({ self }) => {
|
||||
const instruction = extractInstruction(self.data) as Instruction;
|
||||
|
||||
if(instruction)
|
||||
{
|
||||
if('currentLevel' in instruction) this.instruction.style.width = `calc(100% - ${instruction.currentLevel / 2 - 1.5}em)`;
|
||||
|
||||
this.instruction.classList.toggle('!border-b-4', instruction?.type === 'reorder-below');
|
||||
this.instruction.classList.toggle('!border-t-4', instruction?.type === 'reorder-above');
|
||||
this.instruction.classList.toggle('!border-4', instruction?.type === 'make-child' || instruction?.type === 'reparent');
|
||||
|
||||
if(this.instruction.parentElement === null) element.appendChild(this.instruction);
|
||||
}
|
||||
},
|
||||
onDragEnter: () => {
|
||||
draggedOpened = this.tree.opened(item)!;
|
||||
this.tree.toggle(item, true);
|
||||
},
|
||||
onDragLeave: () => {
|
||||
this.tree.toggle(item, draggedOpened);
|
||||
this.instruction.remove();
|
||||
},
|
||||
onDrop: () => {
|
||||
this.tree.toggle(item, true);
|
||||
this.instruction.remove();
|
||||
},
|
||||
getIsSticky: () => true,
|
||||
}));
|
||||
|
||||
return item.cleanup;
|
||||
}
|
||||
private updateTree(instruction: Instruction, source: string, target: string)
|
||||
{
|
||||
const sourceItem = this.tree.tree.find(source);
|
||||
const targetItem = this.tree.tree.find(target);
|
||||
|
||||
if(!sourceItem || !targetItem || instruction.type === 'instruction-blocked')
|
||||
return;
|
||||
|
||||
const from = { parent: (sourceItem as Recursive<typeof targetItem>).parent, order: sourceItem.order };
|
||||
|
||||
if (source === target)
|
||||
return;
|
||||
|
||||
if (instruction.type === 'reorder-above')
|
||||
this.history.add('overview', 'move', [{ element: sourceItem, from: from, to: { parent: (targetItem as Recursive<typeof targetItem>).parent, order: targetItem!.order }}], true);
|
||||
|
||||
if (instruction.type === 'reorder-below')
|
||||
this.history.add('overview', 'move', [{ element: sourceItem, from: from, to: { parent: (targetItem as Recursive<typeof targetItem>).parent, order: targetItem!.order + 1 }}], true);
|
||||
|
||||
if (instruction.type === 'make-child' && targetItem.type === 'folder')
|
||||
this.history.add('overview', 'move', [{ element: sourceItem, from: from, to: { parent: targetItem, order: 0 }}], true);
|
||||
}
|
||||
private render<T extends FileType>(item: LocalContent<T>): Node
|
||||
{
|
||||
return handlers[item.type].renderEditor(item);
|
||||
}
|
||||
private select(item?: LocalContent & { element?: HTMLElement })
|
||||
{
|
||||
if(this.selected && item)
|
||||
{
|
||||
Content.save(this.selected);
|
||||
}
|
||||
if(this.selected === item)
|
||||
{
|
||||
item?.element!.classList.remove('text-accent-blue');
|
||||
this.selected = undefined;
|
||||
}
|
||||
else
|
||||
{
|
||||
this.selected?.element!.classList.remove('text-accent-blue');
|
||||
item?.element!.classList.add('text-accent-blue');
|
||||
this.selected = item;
|
||||
}
|
||||
|
||||
useRouter().push({ hash: this.selected ? '#' + this.selected.id : '' })
|
||||
|
||||
this.container.firstElementChild!.replaceChildren();
|
||||
this.selected && this.container.firstElementChild!.appendChild(this.render(this.selected) as HTMLElement);
|
||||
}
|
||||
unmount()
|
||||
{
|
||||
this.cleanup();
|
||||
}
|
||||
}
|
||||
|
||||
export function getPath(item: Recursive<Omit<LocalContent, 'content'>>): string
|
||||
export function getPath(item: Omit<LocalContent, 'content'>): string
|
||||
export function getPath(item: any): string
|
||||
{
|
||||
if(item.hasOwnProperty('parent') && item.parent !== undefined)
|
||||
return [getPath(item.parent), parsePath(item.title)].filter(e => !!e).join('/');
|
||||
else if(item.hasOwnProperty('parent'))
|
||||
return parsePath(item.title);
|
||||
else
|
||||
return parsePath(item.title) ?? item.path;
|
||||
}
|
||||
171
shared/dom.util.ts
Normal file
171
shared/dom.util.ts
Normal file
@@ -0,0 +1,171 @@
|
||||
import { iconExists, loadIcon } from 'iconify-icon';
|
||||
|
||||
export type Node = HTMLElement | SVGElement | Text | undefined;
|
||||
export type NodeChildren = Array<Node>;
|
||||
|
||||
export type Class = string | Array<Class> | Record<string, boolean> | undefined;
|
||||
type Listener<K extends keyof HTMLElementEventMap> = | ((ev: HTMLElementEventMap[K]) => any) | {
|
||||
options?: boolean | AddEventListenerOptions;
|
||||
listener: (ev: HTMLElementEventMap[K]) => any;
|
||||
} | undefined;
|
||||
|
||||
export interface NodeProperties
|
||||
{
|
||||
attributes?: Record<string, string | undefined | boolean>;
|
||||
text?: string;
|
||||
class?: Class;
|
||||
style?: Record<string, string | undefined | boolean | number> | string;
|
||||
listeners?: {
|
||||
[K in keyof HTMLElementEventMap]?: Listener<K>
|
||||
};
|
||||
}
|
||||
|
||||
export const cancelPropagation = (e: Event) => e.stopImmediatePropagation();
|
||||
export function dom<K extends keyof HTMLElementTagNameMap>(tag: K, properties?: NodeProperties, children?: NodeChildren): HTMLElementTagNameMap[K]
|
||||
{
|
||||
const element = document.createElement(tag);
|
||||
|
||||
if(children && children.length > 0)
|
||||
for(const c of children) if(c !== undefined) element.appendChild(c);
|
||||
|
||||
if(properties?.attributes)
|
||||
for(const [k, v] of Object.entries(properties.attributes))
|
||||
if(typeof v === 'string') element.setAttribute(k, v);
|
||||
else if(typeof v === 'boolean') element.toggleAttribute(k, v);
|
||||
|
||||
if(properties?.text)
|
||||
element.textContent = properties.text;
|
||||
|
||||
if(properties?.listeners)
|
||||
{
|
||||
for(let [k, v] of Object.entries(properties.listeners))
|
||||
{
|
||||
const key = k as keyof HTMLElementEventMap, value = v as Listener<typeof key>;
|
||||
if(typeof value === 'function')
|
||||
element.addEventListener(key, value);
|
||||
else if(value)
|
||||
element.addEventListener(key, value.listener, value.options);
|
||||
}
|
||||
}
|
||||
|
||||
styling(element, properties ?? {});
|
||||
|
||||
return element;
|
||||
}
|
||||
export function svg<K extends keyof SVGElementTagNameMap>(tag: K, properties?: NodeProperties, children?: Omit<NodeChildren, 'HTMLElement' | 'Text'>): SVGElementTagNameMap[K]
|
||||
{
|
||||
const element = document.createElementNS("http://www.w3.org/2000/svg", tag);
|
||||
|
||||
if(children && children.length > 0)
|
||||
for(const c of children) if(c !== undefined) element.appendChild(c);
|
||||
|
||||
if(properties?.attributes)
|
||||
for(const [k, v] of Object.entries(properties.attributes))
|
||||
if(typeof v === 'string') element.setAttribute(k, v);
|
||||
else if(typeof v === 'boolean') element.toggleAttribute(k, v);
|
||||
|
||||
if(properties?.text)
|
||||
element.textContent = properties.text;
|
||||
|
||||
styling(element, properties ?? {});
|
||||
|
||||
return element;
|
||||
}
|
||||
export function text(data: string): Text
|
||||
{
|
||||
return document.createTextNode(data);
|
||||
}
|
||||
export function styling(element: SVGElement | HTMLElement, properties: {
|
||||
class?: Class;
|
||||
style?: Record<string, string | undefined | boolean | number> | string;
|
||||
}): SVGElement | HTMLElement
|
||||
{
|
||||
if(properties?.class)
|
||||
{
|
||||
element.setAttribute('class', mergeClasses(properties.class));
|
||||
}
|
||||
|
||||
if(properties?.style)
|
||||
{
|
||||
if(typeof properties.style === 'string')
|
||||
{
|
||||
element.setAttribute('style', properties.style);
|
||||
}
|
||||
else
|
||||
for(const [k, v] of Object.entries(properties.style)) if(v !== undefined && v !== false) element.attributeStyleMap.set(k, v);
|
||||
}
|
||||
|
||||
return element;
|
||||
}
|
||||
export interface IconProperties
|
||||
{
|
||||
mode?: string;
|
||||
inline?: boolean;
|
||||
noobserver?: boolean;
|
||||
width?: string|number;
|
||||
height?: string|number;
|
||||
flip?: string;
|
||||
rotate?: number|string;
|
||||
style?: Record<string, string | undefined> | string;
|
||||
class?: Class;
|
||||
}
|
||||
const iconCache: Map<IconProperties & { name: string }, HTMLElement> = new Map();
|
||||
export function icon(name: string, properties?: IconProperties): HTMLElement
|
||||
{
|
||||
const key = { ...properties, name };
|
||||
|
||||
if(iconCache.has(key))
|
||||
return iconCache.get(key)!.cloneNode() as HTMLElement;
|
||||
|
||||
const el = document.createElement('iconify-icon');
|
||||
|
||||
if(!iconExists(name))
|
||||
loadIcon(name);
|
||||
|
||||
el.setAttribute('icon', name);
|
||||
|
||||
properties?.mode && el.setAttribute('mode', properties?.mode.toString());
|
||||
properties?.inline && el.toggleAttribute('inline', properties?.inline);
|
||||
properties?.noobserver && el.toggleAttribute('noobserver', properties?.noobserver);
|
||||
properties?.width && el.setAttribute('width', properties?.width.toString());
|
||||
properties?.height && el.setAttribute('height', properties?.height.toString());
|
||||
properties?.flip && el.setAttribute('flip', properties?.flip.toString());
|
||||
properties?.rotate && el.setAttribute('rotate', properties?.rotate.toString());
|
||||
|
||||
if(properties?.class)
|
||||
{
|
||||
el.setAttribute('class', mergeClasses(properties.class));
|
||||
}
|
||||
if(properties?.style)
|
||||
{
|
||||
if(typeof properties.style === 'string')
|
||||
{
|
||||
el.setAttribute('style', properties.style);
|
||||
}
|
||||
else
|
||||
for(const [k, v] of Object.entries(properties.style)) if(v !== undefined) el.attributeStyleMap.set(k, v);
|
||||
}
|
||||
|
||||
iconCache.set(key, el.cloneNode() as HTMLElement);
|
||||
return el;
|
||||
}
|
||||
|
||||
export function mergeClasses(classes: Class): string
|
||||
{
|
||||
if(typeof classes === 'string')
|
||||
{
|
||||
return classes.trim();
|
||||
}
|
||||
else if(Array.isArray(classes))
|
||||
{
|
||||
return classes.map(e => mergeClasses(e)).join(' ');
|
||||
}
|
||||
else if(classes)
|
||||
{
|
||||
return Object.entries(classes).filter(e => e[1]).map(e => e[0].trim()).join(' ');
|
||||
}
|
||||
else
|
||||
{
|
||||
return '';
|
||||
}
|
||||
}
|
||||
251
shared/editor.util.ts
Normal file
251
shared/editor.util.ts
Normal file
@@ -0,0 +1,251 @@
|
||||
import { crosshairCursor, Decoration, dropCursor, EditorView, keymap, ViewPlugin, ViewUpdate, type DecorationSet } from '@codemirror/view';
|
||||
import { Annotation, EditorState, SelectionRange, type Range } from '@codemirror/state';
|
||||
import { defaultKeymap, history, historyKeymap } from '@codemirror/commands';
|
||||
import { bracketMatching, foldKeymap, HighlightStyle, indentOnInput, syntaxHighlighting, syntaxTree } from '@codemirror/language';
|
||||
import { search, searchKeymap } from '@codemirror/search';
|
||||
import { closeBrackets, closeBracketsKeymap, completionKeymap } from '@codemirror/autocomplete';
|
||||
import { lintKeymap } from '@codemirror/lint';
|
||||
import { markdown, markdownLanguage } from '@codemirror/lang-markdown';
|
||||
import { IterMode, Tree } from '@lezer/common';
|
||||
import { tags } from '@lezer/highlight';
|
||||
import { dom } from './dom.util';
|
||||
const External = Annotation.define<boolean>();
|
||||
const Hidden = Decoration.mark({ class: 'hidden' });
|
||||
const Bullet = Decoration.mark({ class: '*:hidden before:absolute before:top-2 before:left-0 before:inline-block before:w-2 before:h-2 before:rounded before:bg-light-40 dark:before:bg-dark-40 relative ps-4' });
|
||||
const Blockquote = Decoration.line({ class: '*:hidden before:block !ps-4 relative before:absolute before:top-0 before:bottom-0 before:left-0 before:w-1 before:bg-none before:bg-light-30 dark:before:bg-dark-30' });
|
||||
|
||||
const TagTag = tags.special(tags.content);
|
||||
|
||||
const intersects = (a: {
|
||||
from: number;
|
||||
to: number;
|
||||
}, b: {
|
||||
from: number;
|
||||
to: number;
|
||||
}) => !(a.to < b.from || b.to < a.from);
|
||||
|
||||
const highlight = HighlightStyle.define([
|
||||
{ tag: tags.heading1, class: 'text-5xl pt-4 pb-2 after:hidden' },
|
||||
{ tag: tags.heading2, class: 'text-4xl pt-4 pb-2 ps-1 leading-loose after:hidden' },
|
||||
{ tag: tags.heading3, class: 'text-2xl font-bold pt-1 after:hidden' },
|
||||
{ tag: tags.heading4, class: 'text-xl font-semibold pt-1 after:hidden variant-cap' },
|
||||
{ tag: tags.meta, color: "#404740" },
|
||||
{ tag: tags.link, textDecoration: "underline" },
|
||||
{ tag: tags.heading, textDecoration: "underline", fontWeight: "bold" },
|
||||
{ tag: tags.emphasis, fontStyle: "italic" },
|
||||
{ tag: tags.strong, fontWeight: "bold" },
|
||||
{ tag: tags.strikethrough, textDecoration: "line-through" },
|
||||
{ tag: tags.keyword, color: "#708" },
|
||||
{ tag: TagTag, class: 'cursor-default bg-accent-blue bg-opacity-10 hover:bg-opacity-20 text-accent-blue text-sm px-1 ms-1 pb-0.5 rounded-full rounded-se-none border border-accent-blue border-opacity-30' }
|
||||
]);
|
||||
|
||||
class Decorator
|
||||
{
|
||||
static hiddenNodes: string[] = [
|
||||
'HardBreak',
|
||||
'LinkMark',
|
||||
'EmphasisMark',
|
||||
'CodeMark',
|
||||
'CodeInfo',
|
||||
'URL',
|
||||
]
|
||||
decorations: DecorationSet;
|
||||
constructor(view: EditorView)
|
||||
{
|
||||
this.decorations = Decoration.set(this.iterate(syntaxTree(view.state), view.visibleRanges, []), true);
|
||||
}
|
||||
update(update: ViewUpdate)
|
||||
{
|
||||
if(!update.docChanged && !update.viewportChanged && !update.selectionSet)
|
||||
return;
|
||||
|
||||
this.decorations = this.decorations.update({
|
||||
filter: (f, t, v) => false,
|
||||
add: this.iterate(syntaxTree(update.state), update.view.visibleRanges, update.state.selection.ranges),
|
||||
sort: true,
|
||||
});
|
||||
}
|
||||
iterate(tree: Tree, visible: readonly {
|
||||
from: number;
|
||||
to: number;
|
||||
}[], selection: readonly SelectionRange[]): Range<Decoration>[]
|
||||
{
|
||||
const decorations: Range<Decoration>[] = [];
|
||||
|
||||
for (let { from, to } of visible) {
|
||||
tree.iterate({
|
||||
from, to, mode: IterMode.IgnoreMounts,
|
||||
enter: node => {
|
||||
if(node.node.parent && selection.some(e => intersects(e, node.node.parent!)))
|
||||
return true;
|
||||
|
||||
else if(node.name === 'HeaderMark')
|
||||
decorations.push(Hidden.range(node.from, node.to + 1));
|
||||
|
||||
else if(Decorator.hiddenNodes.includes(node.name))
|
||||
decorations.push(Hidden.range(node.from, node.to));
|
||||
|
||||
else if(node.matchContext(['BulletList', 'ListItem']) && node.name === 'ListMark')
|
||||
decorations.push(Bullet.range(node.from, node.to + 1));
|
||||
|
||||
else if(node.matchContext(['Blockquote']))
|
||||
decorations.push(Blockquote.range(node.from, node.from));
|
||||
|
||||
return true;
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
return decorations;
|
||||
}
|
||||
}
|
||||
|
||||
export class MarkdownEditor
|
||||
{
|
||||
private static _singleton: MarkdownEditor;
|
||||
|
||||
private view: EditorView;
|
||||
onChange?: (content: string) => void;
|
||||
constructor()
|
||||
{
|
||||
this.view = new EditorView({
|
||||
extensions: [
|
||||
markdown({
|
||||
base: markdownLanguage,
|
||||
extensions: {
|
||||
defineNodes: [
|
||||
{ name: "Tag", style: TagTag },
|
||||
{ name: "TagMark", style: tags.processingInstruction }
|
||||
],
|
||||
parseInline: [{
|
||||
name: "Tag",
|
||||
parse(cx, next, pos) {
|
||||
if (next != 35 || cx.char(pos + 1) == 35) return -1;
|
||||
let elts = [cx.elt("TagMark", pos, pos + 1)];
|
||||
for (let i = pos + 1; i < cx.end; i++) {
|
||||
let next = cx.char(i);
|
||||
if (next == 35)
|
||||
return cx.addElement(cx.elt("Tag", pos, i + 1, elts.concat(cx.elt("TagMark", i, i + 1))));
|
||||
if (next == 92)
|
||||
elts.push(cx.elt("Escape", i, i++ + 2));
|
||||
if (next == 32 || next == 9 || next == 10 || next == 13) break;
|
||||
}
|
||||
return -1
|
||||
}
|
||||
}],
|
||||
}
|
||||
}),
|
||||
history(),
|
||||
search(),
|
||||
dropCursor(),
|
||||
EditorState.allowMultipleSelections.of(true),
|
||||
indentOnInput(),
|
||||
syntaxHighlighting(highlight),
|
||||
bracketMatching(),
|
||||
closeBrackets(),
|
||||
crosshairCursor(),
|
||||
EditorView.lineWrapping,
|
||||
keymap.of([
|
||||
...closeBracketsKeymap,
|
||||
...defaultKeymap,
|
||||
...searchKeymap,
|
||||
...historyKeymap,
|
||||
...foldKeymap,
|
||||
...completionKeymap,
|
||||
...lintKeymap
|
||||
]),
|
||||
EditorView.updateListener.of((viewUpdate: ViewUpdate) => {
|
||||
if (viewUpdate.docChanged && !viewUpdate.transactions.some(tr => tr.annotation(External)))
|
||||
this.onChange && this.onChange(viewUpdate.state.doc.toString());
|
||||
}),
|
||||
EditorView.contentAttributes.of({spellcheck: "true"}),
|
||||
ViewPlugin.fromClass(Decorator, {
|
||||
decorations: e => e.decorations,
|
||||
})
|
||||
]
|
||||
});
|
||||
}
|
||||
focus()
|
||||
{
|
||||
this.view.focus();
|
||||
}
|
||||
|
||||
set content(value: string)
|
||||
{
|
||||
if (value === undefined)
|
||||
return;
|
||||
|
||||
const currentValue = this.view ? this.view.state.doc.toString() : "";
|
||||
if (this.view && value !== currentValue)
|
||||
{
|
||||
this.view.dispatch({
|
||||
changes: { from: 0, to: currentValue.length, insert: value || "" },
|
||||
annotations: [External.of(true)],
|
||||
});
|
||||
}
|
||||
}
|
||||
get content(): string
|
||||
{
|
||||
return this.view.state.doc.toString();
|
||||
}
|
||||
|
||||
get dom()
|
||||
{
|
||||
return this.view.dom;
|
||||
}
|
||||
|
||||
static get singleton(): MarkdownEditor
|
||||
{
|
||||
if(!MarkdownEditor._singleton)
|
||||
MarkdownEditor._singleton = new MarkdownEditor();
|
||||
return MarkdownEditor._singleton;
|
||||
}
|
||||
}
|
||||
|
||||
export class FramedEditor
|
||||
{
|
||||
editor: MarkdownEditor;
|
||||
dom: HTMLIFrameElement;
|
||||
|
||||
private static _singleton: FramedEditor;
|
||||
static get singleton()
|
||||
{
|
||||
if(!FramedEditor._singleton)
|
||||
FramedEditor._singleton = new FramedEditor();
|
||||
|
||||
return FramedEditor._singleton;
|
||||
}
|
||||
private constructor()
|
||||
{
|
||||
this.editor = MarkdownEditor.singleton;
|
||||
this.dom = dom('iframe');
|
||||
this.dom.addEventListener('load', () => {
|
||||
if(!this.dom.contentDocument)
|
||||
return;
|
||||
|
||||
this.dom.contentDocument.documentElement.setAttribute('class', document.documentElement.getAttribute('class') ?? '');
|
||||
this.dom.contentDocument.documentElement.setAttribute('style', document.documentElement.getAttribute('style') ?? '');
|
||||
|
||||
const base = this.dom.contentDocument.head.appendChild(this.dom.contentDocument.createElement('base'));
|
||||
base.setAttribute('href', window.location.href);
|
||||
|
||||
for(let element of document.getElementsByTagName('link'))
|
||||
{
|
||||
if(element.getAttribute('rel') === 'stylesheet')
|
||||
this.dom.contentDocument.head.appendChild(element.cloneNode(true));
|
||||
}
|
||||
|
||||
for(let element of document.getElementsByTagName('style'))
|
||||
{
|
||||
this.dom.contentDocument.head.appendChild(element.cloneNode(true));
|
||||
}
|
||||
|
||||
this.dom.contentDocument.body.setAttribute('class', document.body.getAttribute('class') ?? '');
|
||||
this.dom.contentDocument.body.setAttribute('style', document.body.getAttribute('style') ?? '');
|
||||
|
||||
this.dom.contentDocument.body.appendChild(this.editor.dom);
|
||||
|
||||
this.editor.focus();
|
||||
})
|
||||
}
|
||||
}
|
||||
272
shared/floating.util.ts
Normal file
272
shared/floating.util.ts
Normal file
@@ -0,0 +1,272 @@
|
||||
import * as FloatingUI from "@floating-ui/dom";
|
||||
import { cancelPropagation, dom, svg, text, type Class, type NodeChildren } from "./dom.util";
|
||||
import { button } from "./proses";
|
||||
|
||||
export interface ContextProperties
|
||||
{
|
||||
placement?: FloatingUI.Placement;
|
||||
offset?: number;
|
||||
arrow?: boolean;
|
||||
class?: Class;
|
||||
}
|
||||
export interface PopperProperties
|
||||
{
|
||||
placement?: FloatingUI.Placement;
|
||||
offset?: number;
|
||||
arrow?: boolean;
|
||||
class?: Class;
|
||||
content?: NodeChildren;
|
||||
delay?: number;
|
||||
|
||||
onShow?: (element: HTMLDivElement) => boolean | void;
|
||||
onHide?: (element: HTMLDivElement) => boolean | void;
|
||||
}
|
||||
|
||||
export interface ModalProperties
|
||||
{
|
||||
priority?: boolean;
|
||||
closeWhenOutside?: boolean;
|
||||
}
|
||||
|
||||
let teleport: HTMLDivElement;
|
||||
export function init()
|
||||
{
|
||||
teleport = dom('div', { attributes: { id: 'popper-container' }, class: 'absolute top-0 left-0' });
|
||||
document.body.appendChild(teleport);
|
||||
}
|
||||
|
||||
export function popper(container: HTMLElement, properties?: PopperProperties): HTMLElement
|
||||
{
|
||||
let shown = false, timeout: Timer;
|
||||
const arrow = svg('svg', { class: 'absolute fill-light-35 dark:fill-dark-35', attributes: { width: "10", height: "7", viewBox: "0 0 30 10" } }, [svg('polygon', { attributes: { points: "0,0 30,0 15,10" } })]);
|
||||
const content = dom('div', { class: ['fixed hidden', properties?.class], attributes: { 'data-state': 'closed' } }, [...(properties?.content ?? []), arrow]);
|
||||
|
||||
function update()
|
||||
{
|
||||
FloatingUI.computePosition(container, content, {
|
||||
placement: properties?.placement,
|
||||
strategy: 'fixed',
|
||||
middleware: [
|
||||
properties?.offset ? FloatingUI.offset(properties?.offset) : undefined,
|
||||
FloatingUI.flip(),
|
||||
properties?.offset ? FloatingUI.shift({ padding: properties?.offset }) : undefined,
|
||||
properties?.offset && properties?.arrow ? FloatingUI.arrow({ element: arrow, padding: 8 }) : undefined,
|
||||
]
|
||||
}).then(({ x, y, placement, middlewareData }) => {
|
||||
Object.assign(content.style, {
|
||||
left: `${x}px`,
|
||||
top: `${y}px`,
|
||||
});
|
||||
|
||||
const side = placement.split('-')[0] as FloatingUI.Side;
|
||||
|
||||
content.setAttribute('data-side', side);
|
||||
|
||||
if(properties?.offset && properties?.arrow)
|
||||
{
|
||||
const { x: arrowX, y: arrowY } = middlewareData.arrow!;
|
||||
|
||||
const staticSide = {
|
||||
top: 'bottom',
|
||||
right: 'left',
|
||||
bottom: 'top',
|
||||
left: 'right',
|
||||
}[side]!;
|
||||
|
||||
const rotation = {
|
||||
top: "0",
|
||||
bottom: "180",
|
||||
left: "270",
|
||||
right: "90"
|
||||
}[side]!;
|
||||
|
||||
Object.assign(arrow.style, {
|
||||
left: arrowX != null ? `${arrowX}px` : '',
|
||||
top: arrowY != null ? `${arrowY}px` : '',
|
||||
right: '',
|
||||
bottom: '',
|
||||
[staticSide]: `-6px`,
|
||||
transform: `rotate(${rotation}deg)`,
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
let stop: () => void | undefined;
|
||||
function show()
|
||||
{
|
||||
if(shown || !properties?.onShow || properties?.onShow(content) !== false)
|
||||
{
|
||||
clearTimeout(timeout);
|
||||
|
||||
timeout = setTimeout(() => {
|
||||
if(!shown)
|
||||
{
|
||||
teleport!.appendChild(content);
|
||||
|
||||
content.setAttribute('data-state', 'open');
|
||||
content.classList.toggle('hidden', false);
|
||||
|
||||
update();
|
||||
stop = FloatingUI.autoUpdate(container, content, update, {
|
||||
animationFrame: true,
|
||||
layoutShift: false,
|
||||
elementResize: false,
|
||||
ancestorScroll: false,
|
||||
ancestorResize: false,
|
||||
});
|
||||
}
|
||||
shown = true;
|
||||
}, properties?.delay ?? 0);
|
||||
}
|
||||
}
|
||||
|
||||
function hide()
|
||||
{
|
||||
if(!properties?.onHide || properties?.onHide(content) !== false)
|
||||
{
|
||||
clearTimeout(timeout);
|
||||
|
||||
timeout = setTimeout(() => {
|
||||
content.remove();
|
||||
stop && stop();
|
||||
|
||||
shown = false;
|
||||
}, shown ? properties?.delay ?? 0 : 0);
|
||||
}
|
||||
}
|
||||
|
||||
function link(element: HTMLElement) {
|
||||
Object.entries({
|
||||
'mouseenter': show,
|
||||
'mouseleave': hide,
|
||||
'focus': show,
|
||||
'blur': hide,
|
||||
} as Record<keyof HTMLElementEventMap, () => void>).forEach(([event, listener]) => {
|
||||
element.addEventListener(event, listener);
|
||||
});
|
||||
}
|
||||
|
||||
link(container);
|
||||
link(content);
|
||||
|
||||
return container;
|
||||
}
|
||||
export function contextmenu(x: number, y: number, content: NodeChildren, properties?: ContextProperties): () => void
|
||||
{
|
||||
const virtual = {
|
||||
getBoundingClientRect() {
|
||||
return {
|
||||
x: x,
|
||||
y: y,
|
||||
top: y,
|
||||
left: x,
|
||||
bottom: y,
|
||||
right: x,
|
||||
width: 0,
|
||||
height: 0,
|
||||
};
|
||||
},
|
||||
};
|
||||
|
||||
const arrow = svg('svg', { class: 'absolute fill-light-35 dark:fill-dark-35', attributes: { width: "10", height: "7", viewBox: "0 0 30 10" } }, [svg('polygon', { attributes: { points: "0,0 30,0 15,10" } })]);
|
||||
const container = dom('div', { class: ['fixed bg-light-20 dark:bg-dark-20 border border-light-35 dark:border-dark-35 z-50', properties?.class] }, content);
|
||||
|
||||
function update()
|
||||
{
|
||||
FloatingUI.computePosition(virtual, container, {
|
||||
placement: properties?.placement,
|
||||
strategy: 'fixed',
|
||||
middleware: [
|
||||
properties?.offset ? FloatingUI.offset(properties?.offset) : undefined,
|
||||
FloatingUI.flip(),
|
||||
properties?.offset ? FloatingUI.shift({ padding: properties?.offset }) : undefined,
|
||||
properties?.offset && properties?.arrow ? FloatingUI.arrow({ element: arrow, padding: 8 }) : undefined,
|
||||
]
|
||||
}).then(({ x, y, placement, middlewareData }) => {
|
||||
Object.assign(container.style, {
|
||||
left: `${x}px`,
|
||||
top: `${y}px`,
|
||||
});
|
||||
|
||||
const side = placement.split('-')[0] as FloatingUI.Side;
|
||||
|
||||
container.setAttribute('data-side', side);
|
||||
|
||||
if(properties?.offset && properties?.arrow)
|
||||
{
|
||||
const { x: arrowX, y: arrowY } = middlewareData.arrow!;
|
||||
|
||||
const staticSide = {
|
||||
top: 'bottom',
|
||||
right: 'left',
|
||||
bottom: 'top',
|
||||
left: 'right',
|
||||
}[side]!;
|
||||
|
||||
const rotation = {
|
||||
top: "0",
|
||||
bottom: "180",
|
||||
left: "270",
|
||||
right: "90"
|
||||
}[side]!;
|
||||
|
||||
Object.assign(arrow.style, {
|
||||
left: arrowX != null ? `${arrowX}px` : '',
|
||||
top: arrowY != null ? `${arrowY}px` : '',
|
||||
right: '',
|
||||
bottom: '',
|
||||
[staticSide]: `-6px`,
|
||||
transform: `rotate(${rotation}deg)`,
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
update();
|
||||
|
||||
document.addEventListener('mousedown', close);
|
||||
container.addEventListener('mousedown', cancelPropagation);
|
||||
|
||||
const stop = FloatingUI.autoUpdate(virtual, container, update, {
|
||||
animationFrame: true,
|
||||
layoutShift: false,
|
||||
elementResize: false,
|
||||
ancestorScroll: false,
|
||||
ancestorResize: false,
|
||||
});
|
||||
teleport!.appendChild(container);
|
||||
|
||||
function close()
|
||||
{
|
||||
document.removeEventListener('mousedown', close);
|
||||
container.removeEventListener('mousedown', cancelPropagation);
|
||||
|
||||
container.remove();
|
||||
stop();
|
||||
}
|
||||
|
||||
return close;
|
||||
}
|
||||
|
||||
export function modal(content: NodeChildren, properties?: ModalProperties)
|
||||
{
|
||||
const _modalBlocker = dom('div', { class: [' absolute top-0 left-0 bottom-0 right-0 z-0', { 'bg-light-0 dark:bg-dark-0 opacity-70': properties?.priority ?? false }], listeners: { click: properties?.closeWhenOutside ? (() => _modal.remove()) : undefined } });
|
||||
const _closer = properties?.priority ? undefined : dom('span', { class: 'absolute top-4 right-4', text: '×', listeners: { click: () => _modal.remove() } });
|
||||
const _modal = dom('div', { class: 'fixed flex justify-center items-center top-0 left-0 bottom-0 right-0 inset-0 z-40' }, [ _modalBlocker, dom('div', { class: 'max-h-[85vh] max-w-[450px] bg-light-10 dark:bg-dark-10 border border-light-30 dark:border-dark-30 p-6 text-light-100 dark:text-dark-100 z-10 relative' }, content)])
|
||||
|
||||
teleport.appendChild(_modal);
|
||||
|
||||
return {
|
||||
close: () => _modal.remove(),
|
||||
}
|
||||
}
|
||||
|
||||
export function confirm(title: string): Promise<boolean>
|
||||
{
|
||||
return new Promise(res => {
|
||||
const mod = modal([ dom('div', { class: 'flex flex-col justify-start gap-4' }, [ dom('div', { class: 'text-xl' }, [ text(title) ]), dom('div', { class: 'flex flex-row gap-2' }, [ button(text("Non"), () => (mod.close(), res(false)), 'h-[35px] px-[15px]'), button(text("Oui"), () => (mod.close(), res(true)), 'h-[35px] px-[15px] !border-light-red dark:!border-dark-red text-light:red dark:text-dark-red') ]) ]) ], {
|
||||
priority: true,
|
||||
closeWhenOutside: false,
|
||||
});
|
||||
})
|
||||
}
|
||||
@@ -1,20 +1,18 @@
|
||||
import type { CanvasContent } from '~/types/canvas';
|
||||
import type { ContentMap, FileType } from '~/types/content';
|
||||
export const ID_SIZE = 32;
|
||||
|
||||
export const DEFAULT_CONTENT: Record<FileType, ContentMap[FileType]['content']> = {
|
||||
map: {},
|
||||
canvas: { nodes: [], edges: []},
|
||||
markdown: '',
|
||||
file: '',
|
||||
folder: null,
|
||||
}
|
||||
export function unifySlug(slug: string | string[]): string
|
||||
{
|
||||
return (Array.isArray(slug) ? slug.join('/') : slug);
|
||||
}
|
||||
export function getID(length: number)
|
||||
{
|
||||
for (var id = [], i = 0; i < length; i++)
|
||||
id.push((16 * Math.random() | 0).toString(16));
|
||||
return id.join("");
|
||||
}
|
||||
export function parsePath(path: string): string
|
||||
{
|
||||
return path.toLowerCase().replaceAll(" ", "-").normalize("NFD").replaceAll(/[\u0300-\u036f]/g, "").replaceAll('(', '').replaceAll(')', '');
|
||||
return path.replace(/(\d+?)\. ?/, '').toLowerCase().replaceAll(" ", "-").normalize("NFD").replaceAll(/[\u0300-\u036f]/g, "").replaceAll('(', '').replaceAll(')', '').replace(/\-+/g, '-');
|
||||
}
|
||||
export function parseId(id: string | undefined): string |undefined
|
||||
{
|
||||
@@ -54,40 +52,4 @@ export function clamp(x: number, min: number, max: number): number
|
||||
export function lerp(x: number, a: number, b: number): number
|
||||
{
|
||||
return (1-x)*a+x*b;
|
||||
}
|
||||
export function convertContentFromText(type: FileType, content: string): CanvasContent | string {
|
||||
switch(type)
|
||||
{
|
||||
case 'canvas':
|
||||
return JSON.parse(content) as CanvasContent;
|
||||
case 'map':
|
||||
case 'file':
|
||||
case 'folder':
|
||||
case 'markdown':
|
||||
return content;
|
||||
default:
|
||||
return content;
|
||||
}
|
||||
}
|
||||
export function convertContentToText(type: FileType, content: any): string {
|
||||
switch(type)
|
||||
{
|
||||
case 'canvas':
|
||||
return JSON.stringify(content);
|
||||
case 'map':
|
||||
case 'file':
|
||||
case 'folder':
|
||||
case 'markdown':
|
||||
return content;
|
||||
default:
|
||||
return content;
|
||||
}
|
||||
}
|
||||
|
||||
export const iconByType: Record<FileType, string> = {
|
||||
'folder': 'lucide:folder',
|
||||
'canvas': 'ph:graph-light',
|
||||
'file': 'radix-icons:file',
|
||||
'markdown': 'radix-icons:file-text',
|
||||
'map': 'lucide:map',
|
||||
}
|
||||
94
shared/history.util.ts
Normal file
94
shared/history.util.ts
Normal file
@@ -0,0 +1,94 @@
|
||||
export type HistoryHandler = {
|
||||
undo: (action: HistoryAction) => void;
|
||||
redo: (action: HistoryAction) => void;
|
||||
}
|
||||
|
||||
interface HistoryEvent
|
||||
{
|
||||
source: string;
|
||||
event: string;
|
||||
actions: HistoryAction[];
|
||||
}
|
||||
interface HistoryAction
|
||||
{
|
||||
element: any;
|
||||
from?: any;
|
||||
to?: any;
|
||||
}
|
||||
|
||||
export class History
|
||||
{
|
||||
private handlers: Record<string, { handlers: Record<string, HistoryHandler>, any?: (action: HistoryAction) => any }>;
|
||||
private history: HistoryEvent[];
|
||||
private position: number;
|
||||
|
||||
constructor()
|
||||
{
|
||||
this.handlers = {};
|
||||
this.history = [];
|
||||
this.position = -1;
|
||||
}
|
||||
get last()
|
||||
{
|
||||
return this.history.length > 0 && this.position > -1 ? this.history[this.position] : undefined;
|
||||
}
|
||||
get undoable()
|
||||
{
|
||||
return this.history && this.position !== -1;
|
||||
}
|
||||
get redoable()
|
||||
{
|
||||
return this.history && this.position < this.history.length - 1;
|
||||
}
|
||||
undo()
|
||||
{
|
||||
const last = this.last;
|
||||
if(!last)
|
||||
return;
|
||||
|
||||
last.actions.forEach(e => {
|
||||
this.handlers[last.source] && this.handlers[last.source].handlers[last.event]?.undo(e)
|
||||
this.handlers[last.source] && this.handlers[last.source].any && this.handlers[last.source].any!(e);
|
||||
});
|
||||
|
||||
this.position--;
|
||||
}
|
||||
redo()
|
||||
{
|
||||
if(!this.history || this.history.length - 1 <= this.position)
|
||||
return;
|
||||
|
||||
this.position++;
|
||||
|
||||
const last = this.last;
|
||||
if(!last)
|
||||
{
|
||||
this.position--;
|
||||
return;
|
||||
}
|
||||
|
||||
last.actions.forEach(e => {
|
||||
this.handlers[last.source] && this.handlers[last.source].handlers[last.event]?.redo(e)
|
||||
this.handlers[last.source] && this.handlers[last.source].any && this.handlers[last.source].any!(e);
|
||||
});
|
||||
}
|
||||
add(source: string, event: string, actions: HistoryAction[], apply: boolean = false)
|
||||
{
|
||||
this.position++;
|
||||
this.history.splice(this.position, history.length - this.position, { source, event, actions });
|
||||
|
||||
if(apply)
|
||||
actions.forEach(e => {
|
||||
this.handlers[source] && this.handlers[source].handlers[event]?.redo(e);
|
||||
this.handlers[source] && this.handlers[source].any && this.handlers[source].any(e);
|
||||
});
|
||||
}
|
||||
register(source: string, handlers: Record<string, HistoryHandler>, any?: (action: HistoryAction) => any)
|
||||
{
|
||||
this.handlers[source] = { handlers, any };
|
||||
}
|
||||
unregister(source: string)
|
||||
{
|
||||
delete this.handlers[source];
|
||||
}
|
||||
}
|
||||
@@ -1,670 +0,0 @@
|
||||
import { defineMode, type Mode, getMode, StringStream, startState } from "codemirror";
|
||||
import type { MarkdownState } from "hypermd/mode/hypermd";
|
||||
|
||||
const EN = /^(?:[*\-+]|^[0-9]+([.)]))\s+/, SN = /^(?:(?:(?:aaas?|about|acap|adiumxtra|af[ps]|aim|apt|attachment|aw|beshare|bitcoin|bolo|callto|cap|chrome(?:-extension)?|cid|coap|com-eventbrite-attendee|content|crid|cvs|data|dav|dict|dlna-(?:playcontainer|playsingle)|dns|doi|dtn|dvb|ed2k|facetime|feed|file|finger|fish|ftp|geo|gg|git|gizmoproject|go|gopher|gtalk|h323|hcp|https?|iax|icap|icon|im|imap|info|ipn|ipp|irc[6s]?|iris(?:\.beep|\.lwz|\.xpc|\.xpcs)?|itms|jar|javascript|jms|keyparc|lastfm|ldaps?|magnet|mailto|maps|market|message|mid|mms|ms-help|msnim|msrps?|mtqp|mumble|mupdate|mvn|news|nfs|nih?|nntp|notes|oid|opaquelocktoken|palm|paparazzi|platform|pop|pres|proxy|psyc|query|res(?:ource)?|rmi|rsync|rtmp|rtsp|secondlife|service|session|sftp|sgn|shttp|sieve|sips?|skype|sm[bs]|snmp|soap\.beeps?|soldat|spotify|ssh|steam|svn|tag|teamspeak|tel(?:net)?|tftp|things|thismessage|tip|tn3270|tv|udp|unreal|urn|ut2004|vemmi|ventrilo|view-source|webcal|wss?|wtai|wyciwyg|xcon(?:-userid)?|xfire|xmlrpc\.beeps?|xmpp|xri|ymsgr|z39\.50[rs]?):(?:\/{1,3}|[a-z0-9%])|www\d{0,3}[.]|[a-z0-9.\-]+[.][a-z]{2,4}\/)(?:[^\s()<>]|\([^\s()<>]*\))+(?:\([^\s()<>]*\)|[^\s`*!()\[\]{};:'".,<>?«»“”‘’]))/i, xN = /^(?:(?:[^<>()[\]\\.,;:\s@\"`]+(?:\.[^<>()[\]\\.,;:\s@\"]+)*)|(?:\".+\"))@(?:(?:\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(?:(?:[a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))\b/, TN = /^(?:[^\u2000-\u206F\u2E00-\u2E7F'!"#$%&()*+,.:;<=>?@^`{|}~\[\]\\\s])+/;
|
||||
const PN = /^\s*[^\|].*?\|.*[^|]\s*$/, IN = /^\s*[^\|].*\|/, FN = /^\|(?:[^|]+\|)+?\s*$/, ON = /^\|/, BN = /^\s*-+\s*:\s*$/, NN = /^\s*:\s*-+\s*$/, RN = /^\s*:\s*-+\s*:\s*$/, HN = /^\s*-+\s*$/;
|
||||
const readSideRegex = /(?:([\u200F\p{sc=Arabic}\p{sc=Hebrew}\p{sc=Syriac}\p{sc=Thaana}])|([\u200E\p{sc=Armenian}\p{sc=Bengali}\p{sc=Bopomofo}\p{sc=Braille}\p{sc=Buhid}\p{sc=Canadian_Aboriginal}\p{sc=Cherokee}\p{sc=Cyrillic}\p{sc=Devanagari}\p{sc=Ethiopic}\p{sc=Georgian}\p{sc=Greek}\p{sc=Gujarati}\p{sc=Gurmukhi}\p{sc=Han}\p{sc=Hangul}\p{sc=Hanunoo}\p{sc=Hiragana}\p{sc=Kannada}\p{sc=Katakana}\p{sc=Khmer}\p{sc=Lao}\p{sc=Latin}\p{sc=Limbu}\p{sc=Malayalam}\p{sc=Mongolian}\p{sc=Myanmar}\p{sc=Ogham}\p{sc=Oriya}\p{sc=Runic}\p{sc=Sinhala}\p{sc=Tagalog}\p{sc=Tagbanwa}\p{sc=Tamil}\p{sc=Telugu}\p{sc=Thai}\p{sc=Tibetan}\p{sc=Yi}]))/u;
|
||||
const readSide = function(e: string) {
|
||||
var t = e.match(readSideRegex);
|
||||
if (t) {
|
||||
if (t[1])
|
||||
return "rtl";
|
||||
if (t[2])
|
||||
return "ltr"
|
||||
}
|
||||
return "auto"
|
||||
}
|
||||
const isLetter = (e: string) => /[a-z]/i.test(e);
|
||||
const clearSubstringWords = (str: string, substring: string) => str.replace(new RegExp("\\s?[^\\s]*".concat(substring, "[^\\s]*","g")), "");
|
||||
const enum HashtagType {
|
||||
NONE = 0,
|
||||
NORMAL = 1,
|
||||
WITH_SPACE = 2
|
||||
}
|
||||
const enum TableType {
|
||||
NONE = 0,
|
||||
SIMPLE = 1,
|
||||
NORMAL = 2
|
||||
}
|
||||
const enum NextMaybe {
|
||||
NONE = 0,
|
||||
FRONT_MATTER = 1,
|
||||
FRONT_MATTER_END = 2
|
||||
}
|
||||
const enum LinkType {
|
||||
NONE = 0,
|
||||
BARELINK = 1,
|
||||
FOOTREF = 2,
|
||||
NORMAL = 3,
|
||||
FOOTNOTE = 4,
|
||||
MAYBE_FOOTNOTE_URL = 5,
|
||||
MAYBE_FOOTNOTE_URL_TITLE = 6,
|
||||
BARELINK2 = 7,
|
||||
FOOTREF2 = 8,
|
||||
INTERNAL_LINK = 9,
|
||||
EMBED = 10,
|
||||
}
|
||||
const CLASSES: Record<number, string> = {
|
||||
1: "hmd-barelink",
|
||||
7: "hmd-barelink2",
|
||||
2: "hmd-barelink footref",
|
||||
4: "hmd-barelink hmd-footnote line-HyperMD-footnote",
|
||||
8: "hmd-footref2",
|
||||
9: "hmd-internal-link",
|
||||
10: "hmd-internal-link hmd-embed",
|
||||
}
|
||||
|
||||
export declare type TokenFunc = (stream: CodeMirror.StringStream, state: HyperMDState) => string;
|
||||
export declare type InnerModeExitChecker = (stream: CodeMirror.StringStream, state: HyperMDState) => {
|
||||
endPos?: number;
|
||||
skipInnerMode?: boolean;
|
||||
style?: string;
|
||||
} | null;
|
||||
interface HyperMDState extends MarkdownState {
|
||||
hmdTableRTL: boolean;
|
||||
highlight: boolean;
|
||||
hasAlias: boolean;
|
||||
isAlias: boolean;
|
||||
comment: boolean;
|
||||
mathed: boolean;
|
||||
internalEmbed: any;
|
||||
internalLink: any;
|
||||
inFootnote: boolean;
|
||||
inlineFootnote: boolean;
|
||||
wasHeading: boolean;
|
||||
isHeading: boolean;
|
||||
hmdTable: TableType;
|
||||
hmdTableID: string | null;
|
||||
hmdTableColumns: string[];
|
||||
hmdTableCol: number;
|
||||
hmdTableRow: number;
|
||||
hmdOverride: TokenFunc | null;
|
||||
hmdHashtag: HashtagType | boolean;
|
||||
hmdInnerStyle: string;
|
||||
hmdInnerExitChecker: InnerModeExitChecker | null;
|
||||
hmdInnerMode: CodeMirror.Mode<any> | null;
|
||||
hmdInnerState: any;
|
||||
hmdLinkType: LinkType;
|
||||
hmdNextMaybe: NextMaybe;
|
||||
hmdNextState: HyperMDState | null;
|
||||
hmdNextStyle: string | null;
|
||||
hmdNextPos: number | null;
|
||||
}
|
||||
|
||||
function resetTable(state: HyperMDState)
|
||||
{
|
||||
state.hmdTable = TableType.NONE,
|
||||
state.hmdTableRTL = !1,
|
||||
state.hmdTableColumns = [],
|
||||
state.hmdTableID = null,
|
||||
state.hmdTableCol = state.hmdTableRow = 0
|
||||
}
|
||||
defineMode('d-any', function(cm, config) {
|
||||
const markdownMode: Mode<MarkdownState> = getMode(cm, { ...config, name: 'markdown' }) as any;
|
||||
const mode: Mode<HyperMDState> = getMode(cm, { ...config, name: 'hypermd' }) as any;
|
||||
|
||||
config = Object.assign({}, {
|
||||
front_matter: !0,
|
||||
math: !0,
|
||||
table: !0,
|
||||
toc: !0,
|
||||
orgModeMarkup: !0,
|
||||
hashtag: !0,
|
||||
fencedCodeBlockHighlighting: !0,
|
||||
highlightFormatting: !0,
|
||||
taskLists: !0,
|
||||
strikethrough: !0,
|
||||
emoji: !1,
|
||||
highlight: !0,
|
||||
headers: !0,
|
||||
blockquotes: !0,
|
||||
indentedCode: !0,
|
||||
lists: !0,
|
||||
hr: !0,
|
||||
blockId: !0
|
||||
}, config)
|
||||
|
||||
function modeOverride(stream: CodeMirror.StringStream, state: HyperMDState): string {
|
||||
const exit = state.hmdInnerExitChecker!(stream, state);
|
||||
const extraStyle = state.hmdInnerStyle;
|
||||
|
||||
let ans = (!exit || !exit.skipInnerMode) && state.hmdInnerMode!.token(stream, state.hmdInnerState) || "";
|
||||
|
||||
if (extraStyle) ans += " " + extraStyle;
|
||||
if (exit) {
|
||||
if (exit.style) ans += " " + exit.style;
|
||||
if (exit.endPos) stream.pos = exit.endPos;
|
||||
|
||||
state.hmdInnerExitChecker = null;
|
||||
state.hmdInnerMode = null;
|
||||
state.hmdInnerState = null;
|
||||
state.hmdOverride = null;
|
||||
}
|
||||
|
||||
return ans.trim();
|
||||
}
|
||||
|
||||
function advanceMarkdown(stream: CodeMirror.StringStream, state: HyperMDState) {
|
||||
if (stream.eol() || state.hmdNextState) return false;
|
||||
|
||||
let oldStart = stream.start;
|
||||
let oldPos = stream.pos;
|
||||
|
||||
stream.start = oldPos;
|
||||
let newState = { ...state };
|
||||
let newStyle = mode.token(stream, newState);
|
||||
|
||||
state.hmdNextPos = stream.pos;
|
||||
state.hmdNextState = newState;
|
||||
state.hmdNextStyle = newStyle;
|
||||
|
||||
stream.start = oldStart;
|
||||
stream.pos = oldPos;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
function createDummyMode(endTag: string): CodeMirror.Mode<void> {
|
||||
return {
|
||||
token(stream) {
|
||||
let endTagSince = stream.string.indexOf(endTag, stream.start);
|
||||
if (endTagSince === -1) stream.skipToEnd(); // endTag not in this line
|
||||
else if (endTagSince === 0) stream.pos += endTag.length; // current token is endTag
|
||||
else {
|
||||
stream.pos = endTagSince;
|
||||
if (stream.string.charAt(endTagSince - 1) === "\\") stream.pos++;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function createSimpleInnerModeExitChecker(endTag: string, retInfo?: ReturnType<InnerModeExitChecker>): InnerModeExitChecker {
|
||||
if (!retInfo) retInfo = {};
|
||||
|
||||
return function (stream, state) {
|
||||
if (stream.string.substring(stream.start, stream.start + endTag.length) === endTag) {
|
||||
retInfo.endPos = stream.start + endTag.length;
|
||||
return retInfo;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
interface BasicInnerModeOptions {
|
||||
skipFirstToken?: boolean
|
||||
style?: string
|
||||
}
|
||||
|
||||
interface InnerModeOptions1 extends BasicInnerModeOptions {
|
||||
fallbackMode: () => CodeMirror.Mode<any>
|
||||
exitChecker: InnerModeExitChecker
|
||||
}
|
||||
|
||||
interface InnerModeOptions2 extends BasicInnerModeOptions {
|
||||
endTag: string
|
||||
}
|
||||
|
||||
type InnerModeOptions = InnerModeOptions1 | InnerModeOptions2
|
||||
|
||||
/**
|
||||
* switch to another mode
|
||||
*
|
||||
* After entering a mode, you can then set `hmdInnerExitStyle` and `hmdInnerState` of `state`
|
||||
*
|
||||
* @returns if `skipFirstToken` not set, returns `innerMode.token(stream, innerState)`, meanwhile, stream advances
|
||||
*/
|
||||
function enterMode(stream: StringStream, state: HyperMDState, mode: string | CodeMirror.Mode<any> | null, opt: InnerModeOptions): string {
|
||||
if (typeof mode === "string") mode = getMode(cm, mode);
|
||||
|
||||
if (!mode || mode["name"] === "null") {
|
||||
if ('endTag' in opt) mode = createDummyMode(opt.endTag);
|
||||
else if(typeof opt.fallbackMode === 'function') mode = opt.fallbackMode();
|
||||
|
||||
if (!mode) throw new Error("no mode");
|
||||
}
|
||||
|
||||
state.hmdInnerExitChecker = ('endTag' in opt) ? createSimpleInnerModeExitChecker(opt.endTag) : opt.exitChecker;
|
||||
state.hmdInnerStyle = opt.style ?? '';
|
||||
state.hmdInnerMode = mode;
|
||||
state.hmdOverride = modeOverride;
|
||||
state.hmdInnerState = startState(mode);
|
||||
|
||||
let ans = opt.style || "";
|
||||
if (!opt.skipFirstToken)
|
||||
ans += " " + mode.token(stream, state.hmdInnerState);
|
||||
|
||||
return ans.trim();
|
||||
}
|
||||
|
||||
const i: Record<string, any> = {
|
||||
htmlBlock: null,
|
||||
block: null
|
||||
};
|
||||
|
||||
return {
|
||||
name: 'd-any',
|
||||
...mode,
|
||||
token(stream, _state) {
|
||||
const state = _state as HyperMDState;
|
||||
stream.tabSize = 4;
|
||||
if (state.hmdOverride)
|
||||
return state.hmdOverride(stream, state);
|
||||
|
||||
if (state.hmdTable && " " === stream.peek())
|
||||
{
|
||||
if ("|" === stream.string[stream.pos - 1] && "\\" !== stream.string[stream.pos - 2])
|
||||
return stream.match(/^ +/), "";
|
||||
if (stream.match(/^ +\|/))
|
||||
return stream.backUp(1), "";
|
||||
}
|
||||
if (state.hmdNextMaybe === NextMaybe.FRONT_MATTER)
|
||||
{
|
||||
if ("---" === stream.string)
|
||||
return state.hmdNextMaybe = NextMaybe.FRONT_MATTER_END, enterMode(stream, state, "yaml", {
|
||||
style: "hmd-frontmatter",
|
||||
fallbackMode: function() {
|
||||
return createDummyMode("---");
|
||||
},
|
||||
exitChecker: function(e, stream) {
|
||||
return e.string.startsWith("---") && "" === e.string.substring(3).trim() ? (stream.hmdNextMaybe = NextMaybe.NONE,
|
||||
{
|
||||
endPos: e.string.length
|
||||
}) : null;
|
||||
}
|
||||
});
|
||||
state.hmdNextMaybe = NextMaybe.NONE;
|
||||
}
|
||||
let a = state.f === i.htmlBlock, c = -1 === state.code, u = state.quote, h = 0 === stream.start;
|
||||
h && (state.inFootnote && state.hmdLinkType === LinkType.MAYBE_FOOTNOTE_URL || (state.hmdLinkType = LinkType.NONE),
|
||||
state.inlineFootnote = !1,
|
||||
state.wasHeading = state.isHeading,
|
||||
state.isHeading = !1,
|
||||
!state.code || 1 !== state.code && 2 !== state.code || (state.code = 0));
|
||||
let d, p, f = state.linkText, m = state.linkHref, v = !(c || a), g = v && !(state.code || state.indentedCode || state.linkHref), y = "", b = !1, w = -1, k = !1;
|
||||
if (v)
|
||||
{
|
||||
if (g && "\\" === stream.peek() && (k = !0), state.list && !state.header && "#" === stream.peek() && /^\s*[*\-+]\s$/.test(stream.string.substring(0, stream.pos)))
|
||||
{
|
||||
const C = stream.match(/^(#+)(?: |$)/, !0);
|
||||
if (C)
|
||||
{
|
||||
const M = C[1].length;
|
||||
return state.header = M, "formatting formatting-header formatting-header-" + M + " header header-" + M;
|
||||
}
|
||||
}
|
||||
if (config.math && g && "$" === stream.peek() && (state.hmdLinkType === LinkType.NONE || state.hmdLinkType === LinkType.MAYBE_FOOTNOTE_URL) && !state.internalLink && !state.internalEmbed)
|
||||
{
|
||||
let E: string[] | null = stream.match(/^(\$)[^\s$]/, !1), S = stream.match(/^(\${2})/, !1), x = E ? "$" : "$$";
|
||||
if (E)
|
||||
{
|
||||
let I = stream.string.slice(stream.pos + 1).match(/[^\\]\$(.|$)/)
|
||||
if(!I || !I[0].match(/^[^\s\\]\$([^0-9]|$)/))
|
||||
E = null;
|
||||
}
|
||||
let T = !1;
|
||||
if (E || S)
|
||||
{
|
||||
if (0 !== stream.pos || state.mathed)
|
||||
{
|
||||
let D = "math";
|
||||
state.quote && (D += " line-HyperMD-quote line-HyperMD-quote-" + state.quote + " line-HyperMD-quote-lazy");
|
||||
const A = getMode(cm, {
|
||||
name: "stex"
|
||||
}), L = "stex" !== A.name;
|
||||
return y += enterMode(stream, state, A, {
|
||||
style: D,
|
||||
skipFirstToken: L,
|
||||
fallbackMode: function() {
|
||||
return createDummyMode(x);
|
||||
},
|
||||
exitChecker: function(e, stream) {
|
||||
let n = e.start, i = e.string, r = "formatting formatting-math formatting-math-end math-";
|
||||
return stream.hmdTable && "|" === i[n] ? {
|
||||
endPos: n,
|
||||
style: r
|
||||
} : i.substring(n, n + x.length) === x ? {
|
||||
endPos: n + x.length,
|
||||
style: r
|
||||
} : null;
|
||||
}
|
||||
}),
|
||||
E ? (L && (stream.pos += E[1].length),
|
||||
y += " formatting formatting-math formatting-math-begin") : (L && (stream.pos += S[1].length),
|
||||
y += " formatting formatting-math formatting-math-begin math-block")
|
||||
}
|
||||
T = !0, w = 0;
|
||||
}
|
||||
state.mathed = T;
|
||||
}
|
||||
if (g) {
|
||||
state.internalLink ? (state.hmdLinkType = LinkType.INTERNAL_LINK,
|
||||
state.internalLink = !1) : state.internalEmbed && (state.hmdLinkType = LinkType.EMBED,
|
||||
state.internalEmbed = !1);
|
||||
let P = state.hmdLinkType === LinkType.INTERNAL_LINK || state.hmdLinkType === LinkType.EMBED;
|
||||
if (P)
|
||||
if ("|" === stream.peek())
|
||||
state.isAlias = !0,
|
||||
w = stream.pos + 1,
|
||||
y += " link-alias-pipe";
|
||||
else if ("]" === stream.peek() && stream.match("]]", !1))
|
||||
state.hmdLinkType = LinkType.NONE,
|
||||
state.linkText = !1,
|
||||
state.isAlias = !1,
|
||||
state.hasAlias = !1,
|
||||
w = stream.pos + 2,
|
||||
y += " formatting-link formatting-link-end";
|
||||
else {
|
||||
b = !0,
|
||||
state.isAlias && (y += " link-alias"),
|
||||
state.hasAlias && !state.isAlias && (y += " link-has-alias");
|
||||
let I = stream.match(/^([^|\]]*?)/, !1);
|
||||
w = stream.pos + Math.max(1, I[0].length)
|
||||
}
|
||||
else if("!" === stream.peek() || "[" === stream.peek())
|
||||
{
|
||||
const I = stream.match(/^(!?\[\[)(.*?)]]/, !1)
|
||||
if(I)
|
||||
"!" === I[1].charAt(0) ? (y += " formatting-link formatting-link-start formatting-embed", state.internalEmbed = !0) : (y += " formatting-link formatting-link-start", state.internalLink = !0), w = stream.pos + I[1].length, state.hasAlias = I[2].includes("|");
|
||||
}
|
||||
if (state.hmdLinkType === LinkType.FOOTREF)
|
||||
if (b = !0,
|
||||
"]" === stream.peek())
|
||||
state.hmdLinkType = LinkType.NONE,
|
||||
w = stream.pos + 1,
|
||||
y += " formatting formatting-link formatting-link-end " + CLASSES[LinkType.FOOTREF];
|
||||
else {
|
||||
let I = stream.match(/^([^\]]*?)/, !1);
|
||||
w = stream.pos + Math.max(1, I[0].length)
|
||||
}
|
||||
else
|
||||
{
|
||||
const I = stream.peek() === "[" && stream.match(/^\[\^([^\]\s]*?)\](:?)/, false);
|
||||
if(I && (h || I[2]))
|
||||
{
|
||||
stream.match("[^"),
|
||||
y += " formatting formatting-link formatting-link-start",
|
||||
state.hmdLinkType = LinkType.FOOTREF,
|
||||
w = stream.pos;
|
||||
}
|
||||
}
|
||||
if (config.blockId && "^" === stream.peek() && stream.match(/^\^([a-zA-Z0-9\-]+)$/))
|
||||
return y += " blockid";
|
||||
!state.inlineFootnote && "^" === stream.peek() && stream.match("^[", !1) ? (state.inlineFootnote = !0,
|
||||
y += " inline-footnote-start formatting-inline-footnote",
|
||||
w = stream.pos + 2) : state.inlineFootnote && !P && state.hmdLinkType === LinkType.NONE && !state.image && stream.match("]") && (state.inlineFootnote = !1,
|
||||
y += " footref inline-footnote inline-footnote-end formatting-inline-footnote",
|
||||
w = stream.pos),
|
||||
"%" === stream.peek() && stream.match("%%", !1) ? (state.comment ? (y += " comment formatting comment-end",
|
||||
state.comment = !1) : (y += " comment formatting comment-start",
|
||||
state.comment = !0),
|
||||
w = stream.pos + 2) : state.comment && (y += " comment")
|
||||
}
|
||||
if (g && (state.hmdLinkType || state.image || state.linkText || (isLetter(stream.peek()!) && stream.match(SN) || (p = stream.peek(),
|
||||
!/[\s<>()[\]\\.,;:\s@\"`]/.test(p!) && stream.match(xN))) && (y += " url",
|
||||
w = stream.pos)),
|
||||
h && state.inFootnote) {
|
||||
let F = stream.match(/^\s*/, !1)[0].replace(/\stream/g, " ").length;
|
||||
F && F % stream.tabSize == 0 ? y += " line-HyperMD-footnote" : state.inFootnote = !1
|
||||
}
|
||||
let O = h && "[" === stream.peek() && stream.match(/^\[((?:[^\]\\]|\\.)*)\]:/, !1);
|
||||
if (O) {
|
||||
let B = O[1];
|
||||
if ("^" !== B[0] || !/\s/.test(B))
|
||||
return stream.match(/\[\^?/),
|
||||
state.hmdLinkType = LinkType.FOOTNOTE,
|
||||
state.formatting = "link",
|
||||
state.linkText = !0,
|
||||
y += "formatting formatting-link link " + CLASSES[LinkType.FOOTNOTE]
|
||||
} else if (state.hmdLinkType === LinkType.FOOTNOTE) {
|
||||
if ("]" === stream.peek() && stream.match("]:"))
|
||||
return y += " formatting formatting-link link " + CLASSES[LinkType.FOOTNOTE],
|
||||
state.linkText = !1,
|
||||
state.inFootnote = !0,
|
||||
state.hmdLinkType = LinkType.MAYBE_FOOTNOTE_URL,
|
||||
//@ts-ignore
|
||||
state.f = state.inline = markdownMode.startState().inline,
|
||||
y;
|
||||
y += " link " + CLASSES[LinkType.FOOTNOTE]
|
||||
} else if (state.hmdLinkType === LinkType.MAYBE_FOOTNOTE_URL) {
|
||||
if (stream.eatSpace())
|
||||
return y;
|
||||
if (isLetter(stream.peek()!) && stream.match(SN))
|
||||
return y += " url hmd-footnote-url",
|
||||
state.hmdLinkType = LinkType.MAYBE_FOOTNOTE_URL_TITLE,
|
||||
y;
|
||||
state.hmdLinkType = LinkType.NONE
|
||||
} else if (state.hmdLinkType === LinkType.MAYBE_FOOTNOTE_URL_TITLE) {
|
||||
if (stream.eatSpace())
|
||||
return y;
|
||||
if (state.hmdLinkType = LinkType.NONE,
|
||||
stream.match(/^(["']).*?\1/) || stream.match(/^\([^)]*?\)/))
|
||||
return y += " hmd-footnote-url-title"
|
||||
}
|
||||
}
|
||||
if (state.hmdTable && "|" === stream.peek() && "\\" !== stream.string[stream.pos - 1] && function(e)
|
||||
{
|
||||
e.code = !1,
|
||||
e.comment = !1,
|
||||
e.em = !1,
|
||||
e.formatting = !1,
|
||||
e.highlight = !1,
|
||||
e.hmdHashtag = !1,
|
||||
e.hmdLinkType = LinkType.NONE,
|
||||
e.isAlias = !1,
|
||||
e.internalEmbed = !1,
|
||||
e.internalLink = !1,
|
||||
e.linkHref = !1,
|
||||
e.linkText = !1,
|
||||
e.linkTitle = !1,
|
||||
e.strikethrough = !1,
|
||||
e.strong = !1
|
||||
}(state),
|
||||
state.hmdNextState)
|
||||
stream.pos = state.hmdNextPos!,
|
||||
y += " " + (state.hmdNextStyle || ""),
|
||||
Object.assign(state, state.hmdNextState),
|
||||
state.hmdNextState = null,
|
||||
state.hmdNextStyle = null,
|
||||
state.hmdNextPos = null;
|
||||
else {
|
||||
let N = h && 0 !== stream.pos;
|
||||
if (b) {
|
||||
//@ts-ignore
|
||||
let R = markdownMode.copyState(state), H = stream.pos;
|
||||
y += " " + (markdownMode.token(stream, R) || ""),
|
||||
stream.pos = H
|
||||
} else
|
||||
y += " " + (markdownMode.token(stream, state) || "");
|
||||
//@ts-ignore
|
||||
N && state.f === state.block && (state.f = state.inline = markdownMode.startState().inline),
|
||||
state.inFootnote && (state.indentationDiff = 0)
|
||||
}
|
||||
y = function(e, text) {
|
||||
return text ? (!config.hr && e.hr && (text = clearSubstringWords(text, "hr"),
|
||||
e.hr = !1),
|
||||
!config.headers && e.header && (text = clearSubstringWords(text, "header"),
|
||||
e.header = 0),
|
||||
!config.indentedCode && e.indentedCode && (text = clearSubstringWords(text, "inline-code"),
|
||||
e.indentedCode = !1),
|
||||
!config.blockquotes && e.quote && (text = clearSubstringWords(text, "quote"),
|
||||
e.quote = 0),
|
||||
!config.lists && e.list && (text = clearSubstringWords(text, "list"),
|
||||
e.list = !1),
|
||||
text) : text
|
||||
}(state, y),
|
||||
y.includes("formatting-task") && (y += " line-HyperMD-task-line"),
|
||||
state.hmdHashtag && (y += " " + config.tokenTypeOverrides.hashtag),
|
||||
-1 !== w && (stream.pos = w),
|
||||
state.header && (state.isHeading = !0),
|
||||
!i.htmlBlock && state.htmlState && (i.htmlBlock = state.f);
|
||||
let V = state.f === i.htmlBlock
|
||||
, z = -1 === state.code;
|
||||
if (v = v && !(V || z),
|
||||
g = g && v && !(state.code || state.indentedCode || state.linkHref),
|
||||
state.hmdTable && V) {
|
||||
let q = stream.current();
|
||||
/(?:^|[^\\])\|/.test(q) && ("" === y.trim() || /string|attribute/.test(y)) && (V = !1,
|
||||
a = !1,
|
||||
state.htmlState = null,
|
||||
state.block = i.block,
|
||||
//@ts-ignore
|
||||
state.f = state.inline = markdownMode.startState().inline,
|
||||
stream.pos = "|" === q ? stream.start : stream.start + 1)
|
||||
}
|
||||
let U = stream.current();
|
||||
if (V !== a && (V ? (y += " hmd-html-begin",
|
||||
i.htmlBlock = state.f) : y += " hmd-html-end"),
|
||||
(c || z) && (state.localMode && c || (y = y.replace("inline-code", "")),
|
||||
y += " line-HyperMD-codeblock line-background-HyperMD-codeblock-bg hmd-codeblock",
|
||||
z !== c && (z ? c || (y += " line-HyperMD-codeblock-begin line-background-HyperMD-codeblock-begin-bg") : y += " line-HyperMD-codeblock-end line-background-HyperMD-codeblock-end-bg")),
|
||||
v) {
|
||||
let _ = state.hmdTable;
|
||||
if (h && _)
|
||||
(_ == TableType.SIMPLE ? IN : ON).test(stream.string) ? (state.hmdTableCol = 0,
|
||||
state.hmdTableRow++) : resetTable(state);
|
||||
if (h && state.header && (/^(?:---+|===+)\s*$/.test(stream.string) && state.prevLine && state.prevLine.header ? y += " line-HyperMD-header-line line-HyperMD-header-line-" + state.header : y += " line-HyperMD-header line-HyperMD-header-" + state.header),
|
||||
state.indentedCode && (y += " hmd-indented-code"),
|
||||
state.quote) {
|
||||
if (stream.match(/^\s*>/, !1) && !stream.eol() || (y += " line-HyperMD-quote line-HyperMD-quote-" + state.quote,
|
||||
/^ {0,3}\>/.test(stream.string) || (y += " line-HyperMD-quote-lazy")),
|
||||
h && (d = U.match(/^\s+/)))
|
||||
return stream.pos = d![0].length,
|
||||
(y += " hmd-indent-in-quote").trim();
|
||||
if (state.quote > u)
|
||||
{
|
||||
const I = "[" === stream.peek() && stream.match(/^\[!([^\]]+)\]([+\-]?)(?:\s|$)/);
|
||||
if(I)
|
||||
y += " line-HyperMD-callout hmd-callout line-HyperMD-quote line-HyperMD-quote-" + state.quote
|
||||
}
|
||||
}
|
||||
let W = (state.listStack[state.listStack.length - 1] || 0) + 3
|
||||
, j = h && /^\s+$/.test(U) && (!1 !== state.list || stream.indentation() <= W)
|
||||
, G = state.list && y.includes("formatting-list");
|
||||
if (G || j && (!1 !== state.list || stream.match(EN, !1))) {
|
||||
let K = state.listStack && state.listStack.length || 0;
|
||||
if (j) {
|
||||
if (stream.match(EN, !1))
|
||||
!1 === state.list && K++;
|
||||
else {
|
||||
for (; K > 0 && stream.pos < state.listStack[K - 1]; )
|
||||
K--;
|
||||
if (!K)
|
||||
return y.trim() || null;
|
||||
y += " line-HyperMD-list-line-nobullet line-HyperMD-list-line line-HyperMD-list-line-".concat(K.toString())
|
||||
}
|
||||
y += " hmd-list-indent hmd-list-indent-".concat(K.toString())
|
||||
} else
|
||||
G && (y += " line-HyperMD-list-line line-HyperMD-list-line-".concat(K.toString()))
|
||||
}
|
||||
if (f !== state.linkText && (f || state.internalLink || state.internalEmbed ? state.hmdLinkType !== LinkType.FOOTNOTE && (state.hmdLinkType in CLASSES && (y += " " + CLASSES[state.hmdLinkType]),
|
||||
state.hmdLinkType = LinkType.NONE) : (d = stream.match(/^([^\]]+)\](\(| ?\[|\:)?/, !1)) ? d[2] ? "[" !== d[2] && " [" !== d[2] || "]" !== stream.string.charAt(stream.pos + d[0].length) ? state.hmdLinkType = LinkType.NORMAL : state.hmdLinkType = LinkType.BARELINK2 : "^" !== d[1][0] || /\s/.test(d[1]) ? state.hmdLinkType = LinkType.BARELINK : state.hmdLinkType = LinkType.FOOTREF : state.hmdLinkType = LinkType.BARELINK),
|
||||
m !== state.linkHref && (m ? state.hmdLinkType && (y += " " + CLASSES[state.hmdLinkType],
|
||||
state.hmdLinkType = LinkType.NONE) : "[" === U && "]" !== stream.peek() && (state.hmdLinkType = LinkType.FOOTREF2)),
|
||||
state.hmdLinkType !== LinkType.NONE && state.hmdLinkType in CLASSES && (y += " " + CLASSES[state.hmdLinkType]),
|
||||
state.inlineFootnote && (y += " footref inline-footnote"),
|
||||
k && U.length > 1) {
|
||||
let Y = U.length - 1
|
||||
, Z = y.replace("formatting-escape", "escape") + " hmd-escape-char";
|
||||
return state.hmdOverride = function(e, stream) {
|
||||
return e.pos += Y,
|
||||
stream.hmdOverride = null,
|
||||
Z.trim()
|
||||
}
|
||||
,
|
||||
y += " hmd-escape-backslash",
|
||||
stream.pos -= Y,
|
||||
y
|
||||
}
|
||||
if (!y.trim() && config.table) {
|
||||
let X = !1;
|
||||
if ("|" === U.charAt(0) && (stream.pos = stream.start + 1,
|
||||
U = "|",
|
||||
X = !0),
|
||||
!_ && state.prevLine && state.prevLine.stream && state.prevLine.stream.string.trim() && !state.wasHeading && (X = !1),
|
||||
X) {
|
||||
if (!_) {
|
||||
PN.test(stream.string) ? _ = TableType.SIMPLE : FN.test(stream.string) && (_ = TableType.NORMAL);
|
||||
let $: string[] | undefined = void 0;
|
||||
if (_) {
|
||||
let Q = stream.lookAhead(1);
|
||||
if (_ === TableType.NORMAL ? FN.test(Q) ? Q = Q.replace(/^\s*\|/, "").replace(/\|\s*$/, "") : _ = TableType.NONE : _ === TableType.SIMPLE && (PN.test(Q) || (_ = TableType.NONE)),
|
||||
_) {
|
||||
$ = Q.split("|");
|
||||
for (let J = 0; J < $.length; J++) {
|
||||
let ee = $[J];
|
||||
if (BN.test(ee))
|
||||
ee = "right";
|
||||
else if (NN.test(ee))
|
||||
ee = "left";
|
||||
else if (RN.test(ee))
|
||||
ee = "center";
|
||||
else {
|
||||
if (!HN.test(ee)) {
|
||||
_ = TableType.NONE;
|
||||
break
|
||||
}
|
||||
ee = "default"
|
||||
}
|
||||
$[J] = ee
|
||||
}
|
||||
}
|
||||
}
|
||||
_ && (state.hmdTable = _,
|
||||
state.hmdTableColumns = $!,
|
||||
"rtl" === readSide(stream.string) && (state.hmdTableRTL = !0),
|
||||
state.hmdTableRow = state.hmdTableCol = 0)
|
||||
}
|
||||
if (_) {
|
||||
let te = state.hmdTableColumns.length - 1
|
||||
, ne = state.hmdTableCol
|
||||
, ee = state.hmdTableRow;
|
||||
0 == ne && (y += " line-HyperMD-table-".concat(_.toString(), " line-HyperMD-table-row line-HyperMD-table-row-").concat(ee.toString()),
|
||||
state.hmdTableRTL && (y += " line-HyperMD-table-rtl")),
|
||||
_ === TableType.NORMAL && (0 === state.hmdTableCol && /^\s*\|$/.test(stream.string.slice(0, stream.pos)) || stream.match(/^\s*$/, !1)) ? y += " hmd-table-sep hmd-table-sep-dummy" : state.hmdTableCol < te && (y += " hmd-table-sep hmd-table-sep-".concat(ne.toString()),
|
||||
state.hmdTableCol += 1)
|
||||
}
|
||||
}
|
||||
}
|
||||
if (_ && 1 === state.hmdTableRow && y.includes("emoji") && (y = ""),
|
||||
g && "<" === U) {
|
||||
let ie = null;
|
||||
if ("!" === stream.peek() && stream.match(/^\![A-Z]+/) ? ie = ">" : "!" === stream.peek() && stream.match("![CDATA[") ? ie = "]]>" : "?" === stream.peek() && (ie = "?>"),
|
||||
null != ie)
|
||||
return enterMode(stream, state, null, {
|
||||
endTag: ie,
|
||||
style: (y + " comment hmd-cdata-html").trim()
|
||||
})
|
||||
}
|
||||
if (config.hashtag && g)
|
||||
if (state.hmdHashtag) {
|
||||
let re = !1;
|
||||
if (!(y = y.replace(/((formatting )?formatting-em|em) /g, "")).includes("formatting") && !/^\s*$/.test(U)) {
|
||||
d = U.match(TN);
|
||||
let oe = U.length - (d ? d[0].length : 0);
|
||||
oe > 0 && (stream.backUp(oe),
|
||||
re = !0)
|
||||
}
|
||||
if (re || (re = stream.eol()),
|
||||
re || (re = !TN.test(stream.peek()!)),
|
||||
re)
|
||||
{
|
||||
let le = stream.current();
|
||||
y += " hashtag-end " + (le = "tag-" + le.replace(/[^_a-zA-Z0-9\-]/g, "")),
|
||||
state.hmdHashtag = !1
|
||||
}
|
||||
} else if ("#" === U && !state.linkText && !state.image && (h || /^\s*$/.test(stream.string.charAt(stream.start - 1)))) {
|
||||
let ae = stream.string.slice(stream.pos).replace(/\\./g, "")
|
||||
, se = TN.exec(ae);
|
||||
if (se && /[^0-9]/.test(se[0])) {
|
||||
let le = "tag-" + se[0].replace(/[^_a-zA-Z0-9\-]/g, "");
|
||||
state.hmdHashtag = !0,
|
||||
y += " formatting formatting-hashtag hashtag-begin " + config.tokenTypeOverrides.hashtag + " " + le
|
||||
}
|
||||
}
|
||||
}
|
||||
return y.trim() || null;
|
||||
},
|
||||
}
|
||||
}, 'd-any');
|
||||
75
shared/markdown.util.ts
Normal file
75
shared/markdown.util.ts
Normal file
@@ -0,0 +1,75 @@
|
||||
import type { Root, RootContent } from "hast";
|
||||
import { dom, styling, text, type Class, type Node } from "./dom.util";
|
||||
import prose, { tag, a, blockquote, h1, h2, h3, h4, h5, hr, li, small, table, td, th, callout, type Prose } from "./proses";
|
||||
import { heading } from "hast-util-heading";
|
||||
import { headingRank } from "hast-util-heading-rank";
|
||||
import { parseId } from "./general.util";
|
||||
import { loading } from "#shared/proses";
|
||||
|
||||
export function renderMarkdown(markdown: Root, proses: Record<string, Prose>): HTMLDivElement
|
||||
{
|
||||
return dom('div', {}, markdown.children.map(e => renderContent(e, proses)));
|
||||
}
|
||||
|
||||
function renderContent(node: RootContent, proses: Record<string, Prose>): Node
|
||||
{
|
||||
if(node.type === 'text' && node.value.length > 0 && node.value !== '\n')
|
||||
{
|
||||
return text(node.value);
|
||||
}
|
||||
else if(node.type === 'comment' && node.value.length > 0 && node.value !== '\n')
|
||||
{
|
||||
return undefined;
|
||||
}
|
||||
else if(node.type === 'element')
|
||||
{
|
||||
const children = node.children.map(e => renderContent(e, proses)), properties = { ...node.properties, class: node.properties.className as string | string[] };
|
||||
if(node.tagName in proses)
|
||||
return prose(node.tagName, proses[node.tagName], children, properties);
|
||||
else
|
||||
return dom(node.tagName as keyof HTMLElementTagNameMap, properties, children);
|
||||
}
|
||||
|
||||
return undefined;
|
||||
}
|
||||
|
||||
export interface MDProperties
|
||||
{
|
||||
class?: Class;
|
||||
style?: string | Record<string, string>;
|
||||
tags?: Record<string, Prose>;
|
||||
}
|
||||
export default function(content: string, filter?: string, properties?: MDProperties): HTMLElement
|
||||
{
|
||||
const load = loading('normal');
|
||||
|
||||
queueMicrotask(() => {
|
||||
useMarkdown().parse(content).then(data => {
|
||||
if(filter)
|
||||
{
|
||||
const start = data?.children.findIndex(e => heading(e) && parseId(e.properties.id as string | undefined) === filter) ?? -1;
|
||||
|
||||
if(start !== -1)
|
||||
{
|
||||
let end = start;
|
||||
const rank = headingRank(data.children[start])!;
|
||||
while(end < data.children.length)
|
||||
{
|
||||
end++;
|
||||
if(heading(data.children[end]) && headingRank(data.children[end])! <= rank)
|
||||
break;
|
||||
}
|
||||
data = { ...data, children: data.children.slice(start, end) };
|
||||
}
|
||||
}
|
||||
|
||||
const el = renderMarkdown(data, { tag, a, blockquote, callout, h1, h2, h3, h4, h5, hr, li, small, table, td, th, ...properties?.tags });
|
||||
|
||||
if(properties) styling(el, properties);
|
||||
|
||||
load.parentElement?.replaceChild(el, load);
|
||||
});
|
||||
})
|
||||
|
||||
return load;
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
import type { CanvasContent, CanvasNode } from "~/types/canvas";
|
||||
import type { CanvasPreferences } from "~/types/general";
|
||||
import type { Position, Box, Direction } from "./canvas.util";
|
||||
import type { Position, Box, Direction, CanvasEditor } from "./canvas.util";
|
||||
|
||||
interface SnapPoint {
|
||||
pos: Position;
|
||||
@@ -26,8 +26,20 @@ const enum TYPE {
|
||||
EDGE,
|
||||
}
|
||||
|
||||
class SpatialGrid {
|
||||
private cells: Map<number, Map<number, Set<string>>> = new Map();
|
||||
export function overlapsBoxes(a: Box, b: Box): boolean
|
||||
{
|
||||
return overlaps(a.x, a.y, a.width, a.height, b.x, b.y, b.width, b.height);
|
||||
}
|
||||
export function overlaps(ax: number, ay: number, aw: number, ah: number, bx: number, by: number, bw: number, bh: number): boolean
|
||||
{
|
||||
return !(bx > (ax + aw)
|
||||
|| (bx + bw) < ax
|
||||
|| by > (ay + ah)
|
||||
|| (by + bh) < ay);
|
||||
}
|
||||
|
||||
export class SpatialGrid<T extends Box> {
|
||||
private cells: Map<number, Map<number, Set<T>>> = new Map();
|
||||
private cellSize: number;
|
||||
|
||||
private minx: number = Infinity;
|
||||
@@ -35,20 +47,23 @@ class SpatialGrid {
|
||||
private maxx: number = -Infinity;
|
||||
private maxy: number = -Infinity;
|
||||
|
||||
private cacheSet: Set<string> = new Set<string>();
|
||||
private cacheSet: Set<T> = new Set<T>();
|
||||
|
||||
constructor(cellSize: number) {
|
||||
constructor(cellSize: number)
|
||||
{
|
||||
this.cellSize = cellSize;
|
||||
}
|
||||
|
||||
private updateBorders(startX: number, startY: number, endX: number, endY: number) {
|
||||
private updateBorders(startX: number, startY: number, endX: number, endY: number)
|
||||
{
|
||||
this.minx = Math.min(this.minx, startX);
|
||||
this.miny = Math.min(this.miny, startY);
|
||||
this.maxx = Math.max(this.maxx, endX);
|
||||
this.maxy = Math.max(this.maxy, endY);
|
||||
}
|
||||
|
||||
insert(node: CanvasNode): void {
|
||||
insert(node: T): void
|
||||
{
|
||||
const startX = Math.floor(node.x / this.cellSize);
|
||||
const startY = Math.floor(node.y / this.cellSize);
|
||||
const endX = Math.ceil((node.x + node.width) / this.cellSize);
|
||||
@@ -59,22 +74,22 @@ class SpatialGrid {
|
||||
for (let i = startX; i <= endX; i++) {
|
||||
let gridX = this.cells.get(i);
|
||||
if (!gridX) {
|
||||
gridX = new Map<number, Set<string>>();
|
||||
gridX = new Map<number, Set<T>>();
|
||||
this.cells.set(i, gridX);
|
||||
}
|
||||
|
||||
for (let j = startY; j <= endY; j++) {
|
||||
let gridY = gridX.get(j);
|
||||
if (!gridY) {
|
||||
gridY = new Set<string>();
|
||||
gridY = new Set<T>();
|
||||
gridX.set(j, gridY);
|
||||
}
|
||||
gridY.add(node.id);
|
||||
gridY.add(node);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
remove(node: CanvasNode): void {
|
||||
remove(node: T): void {
|
||||
const startX = Math.floor(node.x / this.cellSize);
|
||||
const startY = Math.floor(node.y / this.cellSize);
|
||||
const endX = Math.ceil((node.x + node.width) / this.cellSize);
|
||||
@@ -84,17 +99,17 @@ class SpatialGrid {
|
||||
const gridX = this.cells.get(i);
|
||||
if (gridX) {
|
||||
for (let j = startY; j <= endY; j++) {
|
||||
gridX.get(j)?.delete(node.id);
|
||||
gridX.get(j)?.delete(node);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fetch(x: number, y: number): Set<string> | undefined {
|
||||
fetch(x: number, y: number): Set<T> | undefined {
|
||||
return this.query(x, y, x, y);
|
||||
}
|
||||
|
||||
query(x1: number, y1: number, x2: number, y2: number): Set<string> {
|
||||
query(x1: number, y1: number, x2: number, y2: number): Set<T> {
|
||||
this.cacheSet.clear();
|
||||
|
||||
const startX = Math.floor(x1 / this.cellSize);
|
||||
@@ -108,7 +123,7 @@ class SpatialGrid {
|
||||
for (let dy = startY; dy <= endY; dy++) {
|
||||
const cellNodes = gridX.get(dy);
|
||||
if (cellNodes) {
|
||||
cellNodes.forEach(neighbor => this.cacheSet.add(neighbor));
|
||||
cellNodes.forEach(neighbor => !this.cacheSet.has(neighbor) && (overlaps(x1, y1, x2 - x1, y2 - y1, neighbor.x, neighbor.y, neighbor.width, neighbor.height)) && this.cacheSet.add(neighbor));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -117,7 +132,7 @@ class SpatialGrid {
|
||||
return this.cacheSet;
|
||||
}
|
||||
|
||||
getViewportNeighbors(node: CanvasNode, viewport?: Box): Set<string> {
|
||||
getViewportNeighbors(node: T, viewport?: Box): Set<T> {
|
||||
this.cacheSet.clear();
|
||||
|
||||
const startX = Math.floor(node.x / this.cellSize);
|
||||
@@ -127,8 +142,8 @@ class SpatialGrid {
|
||||
|
||||
const minX = Math.max(viewport ? Math.max(this.minx, Math.floor(viewport.x / this.cellSize)) : this.minx, startX - 8);
|
||||
const minY = Math.max(viewport ? Math.max(this.miny, Math.floor(viewport.y / this.cellSize)) : this.miny, startY - 8);
|
||||
const maxX = Math.min(viewport ? Math.min(this.maxx, Math.ceil((viewport.x + viewport.w) / this.cellSize)) : this.maxx, endX + 8);
|
||||
const maxY = Math.min(viewport ? Math.min(this.maxy, Math.ceil((viewport.y + viewport.h) / this.cellSize)) : this.maxy, endY + 8);
|
||||
const maxX = Math.min(viewport ? Math.min(this.maxx, Math.ceil((viewport.x + viewport.width) / this.cellSize)) : this.maxx, endX + 8);
|
||||
const maxY = Math.min(viewport ? Math.min(this.maxy, Math.ceil((viewport.y + viewport.height) / this.cellSize)) : this.maxy, endY + 8);
|
||||
|
||||
for (let dx = minX; dx <= maxX; dx++) {
|
||||
const gridX = this.cells.get(dx);
|
||||
@@ -137,7 +152,7 @@ class SpatialGrid {
|
||||
const cellNodes = gridX.get(dy);
|
||||
if (cellNodes) {
|
||||
cellNodes.forEach(neighbor => {
|
||||
if (neighbor !== node.id) this.cacheSet.add(neighbor);
|
||||
if (neighbor !== node) this.cacheSet.add(neighbor);
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -150,7 +165,7 @@ class SpatialGrid {
|
||||
const cellNodes = gridX.get(dy);
|
||||
if (cellNodes) {
|
||||
cellNodes.forEach(neighbor => {
|
||||
if (neighbor !== node.id) this.cacheSet.add(neighbor);
|
||||
if (neighbor !== node) this.cacheSet.add(neighbor);
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -200,34 +215,33 @@ class SnapPointCache {
|
||||
}
|
||||
|
||||
export class SnapFinder {
|
||||
private spatialGrid: SpatialGrid;
|
||||
private spatialGrid: SpatialGrid<CanvasNode>;
|
||||
private snapPointCache: SnapPointCache;
|
||||
config: SnapConfig;
|
||||
private config: SnapConfig;
|
||||
|
||||
hints: Ref<SnapHint[]>;
|
||||
viewport: Ref<Box>;
|
||||
private canvas: CanvasEditor;
|
||||
private hints: SnapHint[] = [];
|
||||
|
||||
constructor(hints: Ref<SnapHint[]>, viewport: Ref<Box>, config: SnapConfig) {
|
||||
constructor(canvas: CanvasEditor, config: SnapConfig) {
|
||||
this.spatialGrid = new SpatialGrid(config.cellSize);
|
||||
this.snapPointCache = new SnapPointCache();
|
||||
this.config = config;
|
||||
|
||||
this.hints = hints;
|
||||
this.viewport = viewport;
|
||||
this.canvas = canvas;
|
||||
}
|
||||
|
||||
add(node: CanvasNode): void
|
||||
{
|
||||
this.spatialGrid.insert(node);
|
||||
this.snapPointCache.insert(node);
|
||||
this.hints.value.length = 0;
|
||||
this.hints.length = 0;
|
||||
}
|
||||
|
||||
remove(node: CanvasNode): void
|
||||
{
|
||||
this.spatialGrid.remove(node);
|
||||
this.snapPointCache.invalidate(node);
|
||||
this.hints.value.length = 0;
|
||||
this.hints.length = 0;
|
||||
}
|
||||
|
||||
update(node: CanvasNode): void
|
||||
@@ -257,26 +271,26 @@ export class SnapFinder {
|
||||
const result: Partial<Box> = {
|
||||
x: undefined,
|
||||
y: undefined,
|
||||
w: undefined,
|
||||
h: undefined,
|
||||
width: undefined,
|
||||
height: undefined,
|
||||
};
|
||||
|
||||
if(!this.config.preferences.neighborSnap)
|
||||
{
|
||||
result.x = this.snapToGrid(node.x);
|
||||
result.w = this.snapToGrid(node.width);
|
||||
result.width = this.snapToGrid(node.width);
|
||||
result.y = this.snapToGrid(node.y);
|
||||
result.h = this.snapToGrid(node.height);
|
||||
result.height = this.snapToGrid(node.height);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
this.hints.value.length = 0;
|
||||
this.hints.length = 0;
|
||||
|
||||
this.snapPointCache.invalidate(node);
|
||||
this.snapPointCache.insert(node);
|
||||
|
||||
const neighbors = [...this.spatialGrid.getViewportNeighbors(node, this.viewport.value)].flatMap(e => this.snapPointCache.getSnapPoints(e)).filter(e => !!e);
|
||||
const neighbors = [...this.spatialGrid.getViewportNeighbors(node, this.canvas.viewport)].flatMap(e => this.snapPointCache.getSnapPoints(e)).filter(e => !!e);
|
||||
const bestSnap = this.findBestSnap(this.snapPointCache.getSnapPoints(node.id)!, neighbors, this.config.threshold, resizeHandle);
|
||||
|
||||
return this.applySnap(node, bestSnap.x, bestSnap.y, resizeHandle);
|
||||
@@ -323,7 +337,7 @@ export class SnapFinder {
|
||||
yHints.forEach(e => e.start.x += bestSnap.x!);
|
||||
}
|
||||
|
||||
this.hints.value = [...xHints, ...yHints];
|
||||
this.hints = [...xHints, ...yHints];
|
||||
|
||||
return bestSnap;
|
||||
}
|
||||
@@ -335,14 +349,14 @@ export class SnapFinder {
|
||||
|
||||
private applySnap(node: CanvasNode, offsetx?: number, offsety?: number, resizeHandle?: Box): Partial<Box>
|
||||
{
|
||||
const result: Partial<Box> = { x: undefined, y: undefined, w: undefined, h: undefined };
|
||||
const result: Partial<Box> = { x: undefined, y: undefined, width: undefined, height: undefined };
|
||||
|
||||
if (resizeHandle)
|
||||
{
|
||||
result.x = offsetx ? node.x + offsetx * resizeHandle.x : this.snapToGrid(node.x);
|
||||
result.w = offsetx ? node.width + offsetx * resizeHandle.w : this.snapToGrid(node.width);
|
||||
result.w = offsetx ? node.width + offsetx * resizeHandle.width : this.snapToGrid(node.width);
|
||||
result.y = offsety ? node.y + offsety * resizeHandle.y : this.snapToGrid(node.y);
|
||||
result.h = offsety ? node.height - offsety * resizeHandle.h : this.snapToGrid(node.height);
|
||||
result.h = offsety ? node.height - offsety * resizeHandle.height : this.snapToGrid(node.height);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
262
shared/proses.ts
Normal file
262
shared/proses.ts
Normal file
@@ -0,0 +1,262 @@
|
||||
import { dom, icon, type NodeChildren, type Node, type NodeProperties, type Class, mergeClasses } from "#shared/dom.util";
|
||||
import { parseURL } from 'ufo';
|
||||
import render from "#shared/markdown.util";
|
||||
import { popper } from "#shared/floating.util";
|
||||
import { Canvas } from "#shared/canvas.util";
|
||||
import { Content, iconByType, type LocalContent } from "#shared/content.util";
|
||||
import type { RouteLocationAsRelativeTyped, RouteMapGeneric } from "vue-router";
|
||||
import { unifySlug } from "#shared/general.util";
|
||||
|
||||
export type CustomProse = (properties: any, children: NodeChildren) => Node;
|
||||
export type Prose = { class: string } | { custom: CustomProse };
|
||||
export const tag: Prose = {
|
||||
custom(properties, children) {
|
||||
const tag = properties.tag as string;
|
||||
const el = dom('span', { class: "before:content-['#'] cursor-default bg-accent-blue bg-opacity-10 hover:bg-opacity-20 text-accent-blue text-sm px-1 ms-1 pb-0.5 rounded-full rounded-se-none border border-accent-blue border-opacity-30" }, children);
|
||||
const overview = Content.getFromPath('tags');
|
||||
|
||||
let rendered = false;
|
||||
|
||||
if(!!overview)
|
||||
{
|
||||
popper(el, {
|
||||
arrow: true,
|
||||
delay: 150,
|
||||
offset: 10,
|
||||
placement: 'bottom-start',
|
||||
class: 'data-[side=bottom]:animate-slideUpAndFade data-[side=right]:animate-slideLeftAndFade data-[side=left]:animate-slideRightAndFade data-[side=top]:animate-slideDownAndFade w-[300px] bg-light-10 dark:bg-dark-10 border border-light-35 dark:border-dark-35 data-[state=open]:transition-transform text-light-100 dark:text-dark-100 max-w-[600px] max-h-[600px] w-full z-[45]',
|
||||
content: [loading("large")],
|
||||
onShow(content: HTMLDivElement) {
|
||||
if(!rendered)
|
||||
{
|
||||
Content.getContent(overview.id).then((_content) => {
|
||||
content.replaceChild(render((_content as LocalContent<'markdown'>).content ?? '', tag, { class: 'max-w-[600px] max-h-[600px] w-full overflow-auto py-4 px-6' }), content.children[0]);
|
||||
});
|
||||
rendered = true;
|
||||
}
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
return el;
|
||||
}
|
||||
}
|
||||
export const a: Prose = {
|
||||
custom(properties, children) {
|
||||
const href = properties.href as string;
|
||||
const { hash, pathname } = parseURL(href);
|
||||
const router = useRouter();
|
||||
|
||||
const overview = Content.getFromPath(pathname === '' && hash.length > 0 ? unifySlug(router.currentRoute.value.params.path) : pathname);
|
||||
|
||||
const link = overview ? { name: 'explore-path', params: { path: overview.path }, hash: hash } : href, nav = router.resolve(link);
|
||||
|
||||
let rendered = false;
|
||||
|
||||
const el = dom('a', { class: 'text-accent-blue inline-flex items-center', attributes: { href: nav.href }, listeners: {
|
||||
'click': (e) => {
|
||||
e.preventDefault();
|
||||
router.push(link);
|
||||
}
|
||||
}}, [
|
||||
dom('span', {}, [
|
||||
...(children ?? []),
|
||||
overview && overview.type !== 'markdown' ? icon(iconByType[overview.type], { class: 'w-4 h-4 inline-block', inline: true }) : undefined
|
||||
])
|
||||
]);
|
||||
|
||||
if(!!overview)
|
||||
{
|
||||
popper(el, {
|
||||
arrow: true,
|
||||
delay: 150,
|
||||
offset: 12,
|
||||
placement: 'bottom-start',
|
||||
class: 'data-[side=bottom]:animate-slideUpAndFade data-[side=right]:animate-slideLeftAndFade data-[side=left]:animate-slideRightAndFade data-[side=top]:animate-slideDownAndFade w-[300px] bg-light-10 dark:bg-dark-10 border border-light-35 dark:border-dark-35 data-[state=open]:transition-transform text-light-100 dark:text-dark-100 min-w-[200px] min-h-[150px] max-w-[600px] max-h-[600px] w-full z-[45]',
|
||||
content: [loading("large")],
|
||||
onShow(content: HTMLDivElement) {
|
||||
if(!rendered)
|
||||
{
|
||||
Content.getContent(overview.id).then((_content) => {
|
||||
if(_content?.type === 'markdown')
|
||||
{
|
||||
content.replaceChild(render((_content as LocalContent<'markdown'>).content ?? '', hash.length > 0 ? hash.substring(1) : undefined, { class: 'min-w-[200px] min-h-[150px] max-w-[600px] max-h-[600px] w-full overflow-auto py-4 px-6' }), content.children[0]);
|
||||
}
|
||||
if(_content?.type === 'canvas')
|
||||
{
|
||||
const canvas = new Canvas((_content as LocalContent<'canvas'>).content);
|
||||
content.replaceChild(dom('div', { class: 'w-[600px] h-[600px] relative' }, [canvas.container]), content.children[0]);
|
||||
canvas.mount();
|
||||
}
|
||||
});
|
||||
rendered = true;
|
||||
}
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
return el;
|
||||
}
|
||||
}
|
||||
export const fakeA: Prose = {
|
||||
custom(properties, children) {
|
||||
const href = properties.href as string;
|
||||
const { hash, pathname } = parseURL(href);
|
||||
const router = useRouter();
|
||||
|
||||
const overview = Content.getFromPath(pathname === '' && hash.length > 0 ? unifySlug(router.currentRoute.value.params.path) : pathname);
|
||||
|
||||
const el = dom('span', { class: 'cursor-pointer text-accent-blue inline-flex items-center' }, [
|
||||
dom('span', {}, [
|
||||
...(children ?? []),
|
||||
overview && overview.type !== 'markdown' ? icon(iconByType[overview.type], { class: 'w-4 h-4 inline-block', inline: true }) : undefined
|
||||
])
|
||||
]);
|
||||
|
||||
if(!!overview)
|
||||
{
|
||||
const magicKeys = useMagicKeys();
|
||||
popper(el, {
|
||||
arrow: true,
|
||||
delay: 150,
|
||||
offset: 12,
|
||||
placement: 'bottom-start',
|
||||
class: 'data-[side=bottom]:animate-slideUpAndFade data-[side=right]:animate-slideLeftAndFade data-[side=left]:animate-slideRightAndFade data-[side=top]:animate-slideDownAndFade w-[300px] bg-light-10 dark:bg-dark-10 border border-light-35 dark:border-dark-35 data-[state=open]:transition-transform text-light-100 dark:text-dark-100 min-w-[200px] min-h-[150px] max-w-[600px] max-h-[600px] w-full z-[45]',
|
||||
content: [loading("large")],
|
||||
onShow(content: HTMLDivElement) {
|
||||
if(!magicKeys.current.has('control') || magicKeys.current.has('meta'))
|
||||
return false;
|
||||
|
||||
content.replaceChild(loading("large"), content.children[0]);
|
||||
Content.getContent(overview.id).then((_content) => {
|
||||
if(_content?.type === 'markdown')
|
||||
{
|
||||
content.replaceChild(render((_content as LocalContent<'markdown'>).content ?? '', hash.length > 0 ? hash.substring(1) : undefined, { class: 'min-w-[200px] min-h-[150px] max-w-[600px] max-h-[600px] w-full overflow-auto py-4 px-6' }), content.children[0]);
|
||||
}
|
||||
if(_content?.type === 'canvas')
|
||||
{
|
||||
const canvas = new Canvas((_content as LocalContent<'canvas'>).content);
|
||||
content.replaceChild(dom('div', { class: 'w-[600px] h-[600px] relative' }, [canvas.container]), content.children[0]);
|
||||
canvas.mount();
|
||||
}
|
||||
});
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
return el;
|
||||
}
|
||||
}
|
||||
export const callout: Prose = {
|
||||
custom(properties, children) {
|
||||
const calloutIconByType: Record<string, string> = {
|
||||
note: 'radix-icons:pencil-1',
|
||||
abstract: 'radix-icons:file-text',
|
||||
info: 'radix-icons:info-circled',
|
||||
todo: 'radix-icons:check-circled',
|
||||
tip: 'radix-icons:star',
|
||||
success: 'radix-icons:check',
|
||||
question: 'radix-icons:question-mark-circled',
|
||||
warning: 'radix-icons:exclamation-triangle',
|
||||
failure: 'radix-icons:cross-circled',
|
||||
danger: 'radix-icons:circle-backslash',
|
||||
bug: 'solar:bug-linear',
|
||||
example: 'radix-icons:list-bullet',
|
||||
quote: 'radix-icons:quote',
|
||||
};
|
||||
const defaultCalloutIcon = 'radix-icons:info-circled';
|
||||
|
||||
const { type, title, fold }: {
|
||||
type: string;
|
||||
title?: string;
|
||||
fold?: boolean;
|
||||
} = properties;
|
||||
|
||||
let open = fold;
|
||||
const trigger = dom('div', { class: [{'cursor-pointer': fold !== undefined}, 'flex flex-row items-center justify-start ps-2'] }, [icon(calloutIconByType[type] ?? defaultCalloutIcon, { inline: true, width: 24, height: 24, class: 'w-6 h-6 stroke-2 float-start me-2 flex-shrink-0' }), !!title ? dom('span', { class: 'block font-bold text-start', text: title }) : undefined, fold !== undefined ? icon('radix-icons:caret-right', { height: 24, width: 24, class: 'transition-transform group-data-[state=open]:rotate-90 w-6 h-6 mx-6' }) : undefined]);
|
||||
const container = dom('div', { class: 'callout group overflow-hidden my-4 p-3 ps-4 bg-blend-lighten !bg-opacity-25 border-l-4 inline-block pe-8 bg-light-blue dark:bg-dark-blue', attributes: { 'data-state': fold !== false ? 'closed' : 'open', 'data-type': type } }, [
|
||||
trigger,
|
||||
dom('div', { class: 'overflow-hidden group-data-[state=closed]:animate-[collapseClose_0.2s_ease-in-out] group-data-[state=open]:animate-[collapseOpen_0.2s_ease-in-out] group-data-[state=closed]:h-0' }, [
|
||||
dom('div', { class: 'px-2' }, children),
|
||||
])
|
||||
]);
|
||||
|
||||
trigger.addEventListener('click', e => {
|
||||
container.setAttribute('data-state', open ? 'open' : 'closed');
|
||||
open = !open;
|
||||
})
|
||||
|
||||
return container;
|
||||
},
|
||||
}
|
||||
export const blockquote: Prose = {
|
||||
class: 'empty:before:hidden ps-4 my-4 relative before:absolute before:-top-1 before:-bottom-1 before:left-0 before:w-1 before:bg-light-30 dark:before:bg-dark-30',
|
||||
}
|
||||
export const h1: Prose = {
|
||||
class: 'text-5xl font-thin mt-3 mb-8 first:pt-0 pt-2',
|
||||
}
|
||||
export const h2: Prose = {
|
||||
class: 'text-4xl font-semibold mt-3 mb-6 ms-1 first:pt-0 pt-2',
|
||||
}
|
||||
export const h3: Prose = {
|
||||
class: 'text-2xl font-bold mt-2 mb-4',
|
||||
}
|
||||
export const h4: Prose = {
|
||||
class: 'text-xl font-semibold my-2',
|
||||
}
|
||||
export const h5: Prose = {
|
||||
class: 'text-lg font-semibold my-1',
|
||||
}
|
||||
export const hr: Prose = {
|
||||
class: 'border-b border-light-35 dark:border-dark-35 m-4',
|
||||
}
|
||||
export const li: Prose = {
|
||||
class: 'before:absolute before:top-2 before:left-0 before:inline-block before:w-2 before:h-2 before:rounded before:bg-light-40 dark:before:bg-dark-40 relative ps-4',
|
||||
}
|
||||
export const small: Prose = {
|
||||
class: 'text-light-60 dark:text-dark-60 text-sm italic',
|
||||
}
|
||||
export const table: Prose = {
|
||||
class: 'mx-4 my-8 border-collapse border border-light-35 dark:border-dark-35',
|
||||
}
|
||||
export const td: Prose = {
|
||||
class: 'border border-light-35 dark:border-dark-35 py-1 px-2',
|
||||
}
|
||||
export const th: Prose = {
|
||||
class: 'border border-light-35 dark:border-dark-35 px-4 first:pt-0',
|
||||
}
|
||||
|
||||
export default function(tag: string, prose: Prose, children?: NodeChildren, properties?: any): Node
|
||||
{
|
||||
if('class' in prose)
|
||||
{
|
||||
return dom(tag as keyof HTMLElementTagNameMap, { class: [properties?.class, prose.class] }, children ?? []);
|
||||
}
|
||||
else
|
||||
{
|
||||
return prose.custom(properties, children ?? []);
|
||||
}
|
||||
}
|
||||
|
||||
export function link(properties?: NodeProperties & { active?: Class }, link?: RouteLocationAsRelativeTyped<RouteMapGeneric, string>, children?: NodeChildren)
|
||||
{
|
||||
const router = useRouter();
|
||||
const nav = link ? router.resolve(link) : undefined;
|
||||
return dom('a', { ...properties, class: [properties?.class, properties?.active && router.currentRoute.value.fullPath === nav?.fullPath ? properties.active : undefined], attributes: { href: nav?.href, 'data-active': properties?.active ? mergeClasses(properties?.active) : undefined }, listeners: link ? {
|
||||
click: function(e)
|
||||
{
|
||||
e.preventDefault();
|
||||
router.push(link);
|
||||
}
|
||||
} : undefined }, children);
|
||||
}
|
||||
export function loading(size: 'small' | 'normal' | 'large' = 'normal'): HTMLElement
|
||||
{
|
||||
return dom('span', { class: ["after:block after:relative after:rounded-full after:border-transparent after:border-t-accent-purple after:animate-spin", {'w-6 h-6 border-4 border-transparent after:-top-[4px] after:-left-[4px] after:w-6 after:h-6 after:border-4': size === 'normal', 'w-4 h-4 after:-top-[2px] after:-left-[2px] after:w-4 after:h-4 after:border-2': size === 'small', 'w-12 h-12 after:-top-[6px] after:-left-[6px] after:w-12 after:h-12 after:border-[6px]': size === 'large'}] })
|
||||
}
|
||||
export function button(content: Node, onClick?: () => void, cls?: Class)
|
||||
{
|
||||
return dom('button', { class: [`text-light-100 dark:text-dark-100 font-semibold hover:bg-light-30 dark:hover:bg-dark-30 inline-flex items-center justify-center bg-light-25 dark:bg-dark-25 leading-none outline-none
|
||||
border border-light-25 dark:border-dark-25 hover:border-light-30 dark:hover:border-dark-30 active:border-light-40 dark:active:border-dark-40 focus:shadow-raw transition-[box-shadow] focus:shadow-light-40 dark:focus:shadow-dark-40
|
||||
disabled:bg-light-10 dark:disabled:bg-dark-10 disabled:border-none disabled:text-light-50 dark:disabled:text-dark-50`, cls], listeners: { click: onClick } }, [ content ]);
|
||||
}
|
||||
193
shared/tree.ts
Normal file
193
shared/tree.ts
Normal file
@@ -0,0 +1,193 @@
|
||||
import { Content, type LocalContent } from "./content.util";
|
||||
import { dom } from "./dom.util";
|
||||
import { clamp } from "./general.util";
|
||||
|
||||
export type Recursive<T> = T & {
|
||||
children?: T[];
|
||||
parent?: T;
|
||||
};
|
||||
export class Tree<T extends Omit<LocalContent, 'content'>>
|
||||
{
|
||||
private _data: Recursive<T>[];
|
||||
private _flatten: T[];
|
||||
|
||||
constructor(data: T[])
|
||||
{
|
||||
this._data = data;
|
||||
this._flatten = this.accumulate(e => e);
|
||||
}
|
||||
|
||||
remove(id: string)
|
||||
{
|
||||
const recursive = (data?: Recursive<T>[], parent?: T) => data?.filter(e => e.id !== id)?.map((e, i) => {
|
||||
e.order = i;
|
||||
e.children = recursive(e.children as T[], e);
|
||||
return e;
|
||||
});
|
||||
|
||||
this._data = recursive(this._data)!;
|
||||
this._flatten = this.accumulate(e => e);
|
||||
}
|
||||
insertAt(item: Recursive<T>, pos: number)
|
||||
{
|
||||
const parent = item.parent ? item.parent.id : undefined;
|
||||
const recursive = (data?: Recursive<T>[]) => data?.flatMap(e => {
|
||||
if(e.id === parent)
|
||||
{
|
||||
e.children = e.children ?? [];
|
||||
e.children.splice(clamp(pos, 0, e.children.length), 0, item);
|
||||
}
|
||||
else if(e.type === 'folder')
|
||||
e.children = recursive(e.children as T[]);
|
||||
|
||||
return e;
|
||||
}).map((e, i) => { e.order = i; return e; });
|
||||
|
||||
if(!parent || parent === '')
|
||||
{
|
||||
this._data.splice(pos, 0, item);
|
||||
this._data.forEach((e, i) => e.order = i);
|
||||
}
|
||||
else
|
||||
this._data = recursive(this._data)!;
|
||||
|
||||
this._flatten = this.accumulate(e => e);
|
||||
}
|
||||
find(id: string): T | undefined
|
||||
{
|
||||
const recursive = (data?: Recursive<T>[]): T | undefined => {
|
||||
if(!data)
|
||||
return;
|
||||
|
||||
for(const e of data)
|
||||
{
|
||||
if(e.id === id)
|
||||
return e;
|
||||
|
||||
const result = recursive(e.children as T[]);
|
||||
|
||||
if(result)
|
||||
return result;
|
||||
}
|
||||
};
|
||||
|
||||
return recursive(this._data);
|
||||
}
|
||||
search(prop: keyof T, value: string): T[]
|
||||
{
|
||||
const recursive = (data?: Recursive<T>[]): T[] => {
|
||||
if(!data)
|
||||
return [];
|
||||
|
||||
const arr = [];
|
||||
|
||||
for(const e of data)
|
||||
{
|
||||
if(e[prop] === value)
|
||||
arr.push(e);
|
||||
else
|
||||
arr.push(...recursive(e.children as T[]));
|
||||
}
|
||||
|
||||
return arr;
|
||||
};
|
||||
|
||||
return recursive(this._data);
|
||||
}
|
||||
subset(id: string): Tree<T> | undefined
|
||||
{
|
||||
const subset = this.find(id);
|
||||
return subset ? new Tree([subset]) : undefined;
|
||||
}
|
||||
each(callback: (item: T, depth: number, parent?: T) => void)
|
||||
{
|
||||
const recursive = (depth: number, data?: Recursive<T>[], parent?: T) => data?.forEach(e => { callback(e, depth, parent); recursive(depth + 1, e.children as T[], e) });
|
||||
|
||||
recursive(1, this._data);
|
||||
}
|
||||
accumulate(callback: (item: T, depth: number, parent?: T) => any): any[]
|
||||
{
|
||||
const recursive = (depth: number, data?: Recursive<T>[], parent?: T): any[] => data?.flatMap(e => [callback(e, depth, parent), ...recursive(depth + 1, e.children as T[], e)]) ?? [];
|
||||
|
||||
return recursive(1, this._data);
|
||||
}
|
||||
get data()
|
||||
{
|
||||
return this._data;
|
||||
}
|
||||
get flatten()
|
||||
{
|
||||
return this._flatten;
|
||||
}
|
||||
}
|
||||
export class TreeDOM
|
||||
{
|
||||
container: HTMLElement;
|
||||
tree: Tree<Omit<LocalContent & { element?: HTMLElement }, "content">>;
|
||||
|
||||
private filter?: (item: Recursive<Omit<LocalContent, 'content'>>, depth: number) => boolean | undefined;
|
||||
private folder: (item: Recursive<Omit<LocalContent, 'content'>>, depth: number) => HTMLElement;
|
||||
private leaf: (item: Recursive<Omit<LocalContent, 'content'>>, depth: number) => HTMLElement;
|
||||
|
||||
constructor(folder: (item: Recursive<Omit<LocalContent, 'content'>>, depth: number) => HTMLElement, leaf: (item: Recursive<Omit<LocalContent, 'content'>>, depth: number) => HTMLElement, filter?: (item: Recursive<Omit<LocalContent, 'content'>>, depth: number) => boolean | undefined)
|
||||
{
|
||||
this.tree = new Tree(Content.tree);
|
||||
|
||||
this.filter = filter;
|
||||
this.folder = folder;
|
||||
this.leaf = leaf;
|
||||
|
||||
const elements = this.tree.accumulate(this.render.bind(this));
|
||||
this.container = dom('div', { class: 'list-none select-none text-light-100 dark:text-dark-100 text-sm ps-2' }, elements);
|
||||
}
|
||||
render(item: Recursive<Omit<LocalContent & { element?: HTMLElement }, "content">>, depth: number): HTMLElement | undefined
|
||||
{
|
||||
if(this.filter && !(this.filter(item, depth) ?? true))
|
||||
return;
|
||||
|
||||
if(item.type === 'folder')
|
||||
{
|
||||
let folded = false;
|
||||
if(item.element)
|
||||
folded = item.element.getAttribute('data-state') === 'open';
|
||||
item.element = this.folder(item, depth);
|
||||
|
||||
if(!!item.parent) item.element.classList.toggle('hidden', item.parent.element!.getAttribute('data-state') === 'closed' || item.parent.element!.classList.contains('hidden'));
|
||||
item.element.setAttribute('data-state', folded ? 'open' : 'closed');
|
||||
item.element.addEventListener('click', () => this.toggle(item));
|
||||
|
||||
return item.element;
|
||||
}
|
||||
else
|
||||
{
|
||||
item.element = this.leaf(item, depth);
|
||||
|
||||
if(!!item.parent) item.element.classList.toggle('hidden', item.parent.element!.getAttribute('data-state') === 'closed' || item.parent.element!.classList.contains('hidden'));
|
||||
|
||||
return item.element;
|
||||
}
|
||||
}
|
||||
update()
|
||||
{
|
||||
this.container.replaceChildren(...this.tree.flatten.map(e => e.element!));
|
||||
}
|
||||
toggle(item?: Omit<LocalContent & { element?: HTMLElement }, 'content'>, state?: boolean)
|
||||
{
|
||||
if(item && item.type === 'folder')
|
||||
{
|
||||
const open = state ?? item.element!.getAttribute('data-state') !== 'open';
|
||||
item.element!.setAttribute('data-state', open ? 'open' : 'closed');
|
||||
|
||||
new Tree([item]).each((e, _, parent) => {
|
||||
if(!parent)
|
||||
return;
|
||||
|
||||
e.element!.classList.toggle('hidden', !this.opened(parent) || parent.element!.classList.contains('hidden'));
|
||||
});
|
||||
}
|
||||
}
|
||||
opened(item?: Omit<LocalContent & { element?: HTMLElement }, 'content'>): boolean | undefined
|
||||
{
|
||||
return item ? item.element!.getAttribute('data-state') === 'open' : undefined;
|
||||
}
|
||||
}
|
||||
12
types/auth.d.ts
vendored
12
types/auth.d.ts
vendored
@@ -1,4 +1,5 @@
|
||||
import type { ComputedRef, Ref } from 'vue'
|
||||
import type { ComputedRef, Ref } from 'vue';
|
||||
import type { SessionConfig } from 'h3'
|
||||
|
||||
import 'vue-router';
|
||||
declare module 'vue-router'
|
||||
@@ -13,8 +14,8 @@ declare module 'vue-router'
|
||||
}
|
||||
}
|
||||
|
||||
import 'nuxt';
|
||||
declare module 'nuxt'
|
||||
import '@nuxt/schema';
|
||||
declare module '@nuxt/schema'
|
||||
{
|
||||
interface RuntimeConfig
|
||||
{
|
||||
@@ -30,9 +31,8 @@ export interface UserRawData {
|
||||
}
|
||||
|
||||
export interface UserExtendedData {
|
||||
signin: string;
|
||||
lastTimestamp: string;
|
||||
logCount: number;
|
||||
signin: Date;
|
||||
lastTimestamp: Date;
|
||||
}
|
||||
|
||||
export type Permissions = { permissions: string[] };
|
||||
|
||||
2
types/canvas.d.ts
vendored
2
types/canvas.d.ts
vendored
@@ -17,7 +17,7 @@ export interface CanvasNode {
|
||||
height: number;
|
||||
color?: CanvasColor;
|
||||
label?: string;
|
||||
text?: any;
|
||||
text?: string;
|
||||
};
|
||||
export interface CanvasEdge {
|
||||
id: string;
|
||||
|
||||
62
types/content.d.ts
vendored
62
types/content.d.ts
vendored
@@ -1,62 +0,0 @@
|
||||
import type { CanvasContent as Canvas } from "./canvas";
|
||||
import type { MapContent as Map } from "./map";
|
||||
|
||||
|
||||
export type FileType = keyof ContentMap;
|
||||
export interface Overview {
|
||||
path: string;
|
||||
owner: number;
|
||||
title: string;
|
||||
timestamp: Date;
|
||||
navigable: boolean;
|
||||
private: boolean;
|
||||
order: number;
|
||||
visit: number;
|
||||
}
|
||||
export interface CanvasContent extends Overview {
|
||||
type: 'canvas';
|
||||
content?: Canvas;
|
||||
}
|
||||
export interface MapContent extends Overview {
|
||||
type: 'map';
|
||||
content?: string;
|
||||
}
|
||||
export interface MarkdownContent extends Overview {
|
||||
type: 'markdown';
|
||||
content?: string;
|
||||
}
|
||||
export interface FileContent extends Overview {
|
||||
type: 'file';
|
||||
content?: string;
|
||||
}
|
||||
export interface FolderContent extends Overview {
|
||||
type: 'folder';
|
||||
content?: null;
|
||||
}
|
||||
export interface ContentMap
|
||||
{
|
||||
markdown: MarkdownContent;
|
||||
file: FileContent;
|
||||
canvas: CanvasContent;
|
||||
map: MapContent;
|
||||
folder: FolderContent;
|
||||
}
|
||||
|
||||
export type ExploreContent = ContentMap[FileType];
|
||||
|
||||
export type TreeItem = ExploreContent & {
|
||||
children?: TreeItem[];
|
||||
}
|
||||
|
||||
export interface ContentComposable {
|
||||
content: Ref<ExploreContent[]>
|
||||
tree: ComputedRef<TreeItem[]>
|
||||
/**
|
||||
* Fetch the overview of every content from the server.
|
||||
*/
|
||||
fetch: (force: boolean) => Promise<void>
|
||||
/**
|
||||
* Get the given content from the server.
|
||||
*/
|
||||
get: (path: string) => Promise<void>
|
||||
}
|
||||
Reference in New Issue
Block a user