mirror of
https://github.com/zadam/trilium.git
synced 2025-10-26 07:46:30 +01:00
Port from trilium notes
This commit is contained in:
100
.eslintrc
Normal file
100
.eslintrc
Normal file
@@ -0,0 +1,100 @@
|
||||
{
|
||||
"extends": [
|
||||
"eslint:recommended",
|
||||
"plugin:@typescript-eslint/recommended-type-checked",
|
||||
"plugin:@typescript-eslint/stylistic-type-checked",
|
||||
"plugin:solid/typescript"
|
||||
],
|
||||
"env": {
|
||||
"node": true,
|
||||
"es2020": true,
|
||||
"browser": true,
|
||||
"jquery": true
|
||||
},
|
||||
"plugins": ["@typescript-eslint", "solid"],
|
||||
"parser": "@typescript-eslint/parser",
|
||||
"parserOptions": {
|
||||
"project": ["./tsconfig.eslint.json"],
|
||||
"tsconfigRootDir": ".",
|
||||
"ecmaVersion": 2022,
|
||||
"sourceType": "module",
|
||||
"ecmaFeatures": {
|
||||
"jsx": true
|
||||
}
|
||||
},
|
||||
"rules": {
|
||||
"accessor-pairs": "error",
|
||||
"block-spacing": ["error", "never"],
|
||||
"brace-style": ["error", "stroustrup", {"allowSingleLine": true}],
|
||||
"curly": ["error", "multi-line", "consistent"],
|
||||
"dot-location": ["error", "property"],
|
||||
"dot-notation": "error",
|
||||
"func-call-spacing": "error",
|
||||
"handle-callback-err": "error",
|
||||
"key-spacing": "error",
|
||||
"keyword-spacing": "error",
|
||||
"new-cap": ["error", {"newIsCap": true}],
|
||||
"no-array-constructor": "error",
|
||||
"no-caller": "error",
|
||||
"no-console": "error",
|
||||
"no-duplicate-imports": "error",
|
||||
"no-else-return": "error",
|
||||
"no-eval": "error",
|
||||
"no-floating-decimal": "error",
|
||||
"no-implied-eval": "error",
|
||||
"no-iterator": "error",
|
||||
"no-label-var": "error",
|
||||
"no-labels": "error",
|
||||
"no-lone-blocks": "error",
|
||||
"no-mixed-spaces-and-tabs": "error",
|
||||
"no-multi-spaces": "error",
|
||||
"no-multi-str": "error",
|
||||
"no-new": "error",
|
||||
"no-new-func": "error",
|
||||
"no-new-object": "error",
|
||||
"no-new-wrappers": "error",
|
||||
"no-octal-escape": "error",
|
||||
"no-path-concat": "error",
|
||||
"no-proto": "error",
|
||||
"no-prototype-builtins": "off",
|
||||
"no-redeclare": ["error", {"builtinGlobals": true}],
|
||||
"no-self-compare": "error",
|
||||
"no-sequences": "error",
|
||||
"no-shadow": ["warn", {"builtinGlobals": false, "hoist": "functions"}],
|
||||
"no-tabs": "error",
|
||||
"no-template-curly-in-string": "error",
|
||||
"no-throw-literal": "error",
|
||||
"no-undef": "error",
|
||||
"no-undef-init": "error",
|
||||
"no-unmodified-loop-condition": "error",
|
||||
"no-unneeded-ternary": "error",
|
||||
"no-useless-call": "error",
|
||||
"no-useless-computed-key": "error",
|
||||
"no-useless-constructor": "error",
|
||||
"no-useless-rename": "error",
|
||||
"no-var": "error",
|
||||
"no-whitespace-before-property": "error",
|
||||
"object-curly-spacing": ["error", "never", {"objectsInObjects": false}],
|
||||
"object-property-newline": ["error", {"allowAllPropertiesOnSameLine": true}],
|
||||
"operator-linebreak": ["error", "none", {"overrides": {"?": "before", ":": "before", "&&": "before"}}],
|
||||
"prefer-const": "error",
|
||||
"quote-props": ["error", "consistent-as-needed", {"keywords": true}],
|
||||
"quotes": ["error", "double", {"allowTemplateLiterals": true}],
|
||||
"rest-spread-spacing": "error",
|
||||
"semi": "error",
|
||||
"semi-spacing": "error",
|
||||
"space-before-blocks": "error",
|
||||
"space-in-parens": "error",
|
||||
"space-infix-ops": "error",
|
||||
"space-unary-ops": ["error", {"words": true, "nonwords": false, "overrides": {"typeof": false}}],
|
||||
"spaced-comment": ["error", "always", {"exceptions": ["-", "*"]}],
|
||||
"template-curly-spacing": "error",
|
||||
"wrap-iife": ["error", "inside"],
|
||||
"yield-star-spacing": "error",
|
||||
"yoda": "error"
|
||||
},
|
||||
"globals": {
|
||||
"api": "readonly",
|
||||
"NodeJS": "readonly"
|
||||
}
|
||||
}
|
||||
2
.gitignore
vendored
Normal file
2
.gitignore
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
node_modules/
|
||||
.env
|
||||
201
LICENSE
Normal file
201
LICENSE
Normal file
@@ -0,0 +1,201 @@
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
APPENDIX: How to apply the Apache License to your work.
|
||||
|
||||
To apply the Apache License to your work, attach the following
|
||||
boilerplate notice, with the fields enclosed by brackets "[]"
|
||||
replaced with your own identifying information. (Don't include
|
||||
the brackets!) The text should be enclosed in the appropriate
|
||||
comment syntax for the file format. We also recommend that a
|
||||
file or class name and description of purpose be included on the
|
||||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
|
||||
Copyright [yyyy] [name of copyright owner]
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
2506
package-lock.json
generated
Normal file
2506
package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
21
package.json
Normal file
21
package.json
Normal file
@@ -0,0 +1,21 @@
|
||||
{
|
||||
"name": "trilium.rocks",
|
||||
"version": "1.0.0",
|
||||
"description": "",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"test": "echo \"Error: no test specified\" && exit 1"
|
||||
},
|
||||
"author": "",
|
||||
"license": "ISC",
|
||||
"devDependencies": {
|
||||
"@digitak/esrun": "^3.2.24",
|
||||
"@typescript-eslint/eslint-plugin": "^6.7.2",
|
||||
"@typescript-eslint/parser": "^6.7.2",
|
||||
"dotenv": "^16.3.1",
|
||||
"esbuild": "^0.19.3",
|
||||
"eslint": "^8.49.0",
|
||||
"trilium-etapi": "^0.1.2",
|
||||
"typescript": "^5.2.2"
|
||||
}
|
||||
}
|
||||
6
scripts/.eslintrc
Normal file
6
scripts/.eslintrc
Normal file
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"extends": "../.eslintrc",
|
||||
"rules": {
|
||||
"no-console": "off"
|
||||
}
|
||||
}
|
||||
97
scripts/build.ts
Normal file
97
scripts/build.ts
Normal file
@@ -0,0 +1,97 @@
|
||||
import fs from "node:fs";
|
||||
import path from "node:path";
|
||||
// import {fileURLToPath} from "node:url";
|
||||
|
||||
import dotenv from "dotenv";
|
||||
import tepi from "trilium-etapi";
|
||||
import * as esbuild from "esbuild";
|
||||
|
||||
|
||||
// const fileURL = fileURLToPath(import.meta.url);
|
||||
// let baseDir = path.dirname(fileURL);
|
||||
// if (fileURL.includes("esrun-")) baseDir = path.join(baseDir, "..", "..", "scripts");
|
||||
// const rootDir = path.join(baseDir, "..");
|
||||
// console.log(process.env.npm_package_json);
|
||||
const rootDir = path.dirname(process.env.npm_package_json!);
|
||||
|
||||
|
||||
dotenv.config();
|
||||
if (process.env.TRILIUM_ETAPI_TOKEN) tepi.token(process.env.TRILIUM_ETAPI_TOKEN);
|
||||
|
||||
const bundleMap = {
|
||||
"main.js": process.env.JS_NOTE_ID,
|
||||
"styles.css": process.env.CSS_NOTE_ID
|
||||
};
|
||||
|
||||
const triliumPlugin: esbuild.Plugin = {
|
||||
name: "Trilium",
|
||||
setup(build) {
|
||||
build.onEnd(async result => {
|
||||
if (!result.metafile) return;
|
||||
|
||||
const bundles = Object.keys(result.metafile.outputs);
|
||||
for (const bundle of bundles) {
|
||||
const filename = path.basename(bundle);
|
||||
const noteId = bundleMap[filename as keyof typeof bundleMap];
|
||||
if (!noteId) {
|
||||
console.info(`No note id found for bundle ${bundle}`);
|
||||
continue;
|
||||
}
|
||||
|
||||
const bundlePath = path.join(rootDir, bundle);
|
||||
if (!fs.existsSync(bundlePath)) {
|
||||
console.error(`Could not find bundle ${bundle}`);
|
||||
continue;
|
||||
}
|
||||
|
||||
const contents = fs.readFileSync(bundlePath).toString();
|
||||
await tepi.putNoteContentById(noteId, contents);
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
const modules = ["main", "styles"];
|
||||
const entryPoints: {in: string, out: string}[] = [];
|
||||
const makeEntry = (mod: string) => ({"in": path.join(rootDir, "src", mod, mod === "styles" ? "index.css" : "index.ts"), "out": mod});
|
||||
|
||||
const modulesRequested = process.argv.filter(a => a.startsWith("--module="));
|
||||
for (const mod of modulesRequested) {
|
||||
const module = mod?.replace("--module=", "") ?? "";
|
||||
if (modules.includes(module)) entryPoints.push(makeEntry(module));
|
||||
}
|
||||
|
||||
if (!entryPoints.length) for (const mod of modules) entryPoints.push(makeEntry(mod));
|
||||
|
||||
|
||||
async function runBuild() {
|
||||
const before = performance.now();
|
||||
await esbuild.build({
|
||||
entryPoints: entryPoints,
|
||||
bundle: true,
|
||||
outdir: path.join(rootDir, "dist"),
|
||||
format: "cjs",
|
||||
external: ["fs", "path", "electron", "@electron/remote"],
|
||||
banner: {js: "const require = mod => {try{return window.require(mod);}catch{return {};}};"},
|
||||
target: ["chrome96", "node16"],
|
||||
loader: {
|
||||
".png": "dataurl",
|
||||
".gif": "dataurl",
|
||||
".woff": "dataurl",
|
||||
".woff2": "dataurl",
|
||||
".ttf": "dataurl",
|
||||
".html": "text",
|
||||
".css": "css"
|
||||
},
|
||||
plugins: [triliumPlugin],
|
||||
logLevel: "info",
|
||||
metafile: true,
|
||||
minify: process.argv.includes("--minify")
|
||||
});
|
||||
const after = performance.now();
|
||||
console.log(`Build actually took ${(after - before).toFixed(2)}ms`);
|
||||
}
|
||||
|
||||
runBuild().catch(console.error);
|
||||
312
src/main/index.ts
Normal file
312
src/main/index.ts
Normal file
@@ -0,0 +1,312 @@
|
||||
// https://instance-name/api/notes/vW1cXaYNN7OM/download
|
||||
|
||||
function addHljs() {
|
||||
const link = document.createElement("link");
|
||||
link.rel = "stylesheet";
|
||||
link.href = "api/notes/cVaK9ZJwx5Hs/download";
|
||||
document.head.append(link);
|
||||
|
||||
const script = document.createElement("script");
|
||||
script.src = "api/notes/6PVElIem02b5/download";
|
||||
script.addEventListener("load", () => {
|
||||
hljs.registerAliases(["application-javascript-env-frontend", "application-javascript-env-backend"], {languageName: "javascript"});
|
||||
hljs.addPlugin({
|
||||
"after:highlight": (result) => {
|
||||
// Add api global
|
||||
result.value = result.value.replaceAll(/([^A-Za-z0-9])api\./g, function(match, prefix) {
|
||||
return `${prefix}<span class="hljs-variable language_">api</span>.`;
|
||||
});
|
||||
|
||||
// Add jquery global
|
||||
result.value = result.value.replaceAll(/([^A-Za-z0-9\.])\$\((.+)\)/g, function(match, prefix, variable) {
|
||||
return `${prefix}<span class="hljs-variable language_">$(</span>${variable}<span class="hljs-variable language_">)</span>`;
|
||||
});
|
||||
}
|
||||
})
|
||||
hljs.highlightAll();
|
||||
});
|
||||
document.head.append(script);
|
||||
}
|
||||
|
||||
function fixTableHeaders() {
|
||||
Array.from(document.querySelectorAll("th")).forEach(el => {
|
||||
if (!el.textContent.trim()) el.classList.add("empty");
|
||||
});
|
||||
}
|
||||
|
||||
/*Array.from(document.querySelectorAll("pre code")).forEach(el => {
|
||||
if (el.className.includes("javascript-env")) el.className = "language-javascript";
|
||||
});*/
|
||||
|
||||
function addLogo() {
|
||||
const logo = document.createElement("img");
|
||||
logo.src = "https://raw.githubusercontent.com/zadam/trilium/master/images/icon-color.svg";
|
||||
logo.id = "logo";
|
||||
document.querySelector("#menu > p").append(logo);
|
||||
}
|
||||
|
||||
|
||||
function fixActiveLink() {
|
||||
const active = document.querySelector("#menu strong");
|
||||
const link = document.createElement("a");
|
||||
link.className = "type-text active";
|
||||
link.href = ``;
|
||||
link.textContent = active.textContent;
|
||||
active.replaceWith(link);
|
||||
const id = document.body.dataset.noteId;
|
||||
link.href = `./${id}`;
|
||||
|
||||
/*fetchNote().then(note => {
|
||||
link.href = `./${note.noteId}`;
|
||||
});*/
|
||||
}
|
||||
|
||||
function addSideNav() {
|
||||
const categories = document.querySelectorAll("#menu > ul > li > ul > li");
|
||||
for (const cat of categories) cat.classList.add("category");
|
||||
const active = document.querySelector("#menu .active");
|
||||
const treeToClone = active.closest(".category.submenu-item") ?? active.closest(".submenu-item.hidden");
|
||||
if (!treeToClone) return; // probably homepage
|
||||
const layout = document.querySelector("#layout");
|
||||
const sidebar = document.createElement("ul");
|
||||
sidebar.id = "sidebar";
|
||||
const clone = treeToClone.cloneNode(true);
|
||||
/*const title = document.createElement("div");
|
||||
title.className = "title";
|
||||
title.append(clone.querySelector("p > a"));
|
||||
sidebar.append(title);
|
||||
sidebar.append(clone.querySelector("ul"));*/
|
||||
sidebar.append(clone);
|
||||
if (sidebar.querySelectorAll("li").length <= 1) return;
|
||||
layout.prepend(sidebar);
|
||||
}
|
||||
|
||||
|
||||
async function buildBreadcrumbs() {
|
||||
const main = document.getElementById("main");
|
||||
const placeholder = document.createElement("div");
|
||||
placeholder.id = "breadcrumbs";
|
||||
const pspan = document.createElement("span");
|
||||
const plink = document.createElement("a");
|
||||
pspan.append(plink);
|
||||
plink.href = "#";
|
||||
plink.textContent = document.getElementById("title").textContent;
|
||||
placeholder.append(pspan);
|
||||
main.prepend(placeholder);
|
||||
|
||||
const container = document.createElement("div");
|
||||
container.id = "breadcrumbs";
|
||||
|
||||
// const notePath = [];
|
||||
|
||||
let currentNote, parentId;
|
||||
do {
|
||||
currentNote = await fetchNote(parentId);
|
||||
const span = document.createElement("span");
|
||||
const link = document.createElement("a");
|
||||
link.className = "type-text";
|
||||
link.href = `./${currentNote.noteId}`;
|
||||
link.textContent = currentNote.title;
|
||||
// notePath.splice(0, 0, link);
|
||||
span.append(link);
|
||||
container.prepend(span)
|
||||
parentId = currentNote.parentNoteIds[0];
|
||||
if (parentId === "_share") {
|
||||
link.textContent = "";
|
||||
const logo = document.createElement("img");
|
||||
logo.src = "https://raw.githubusercontent.com/zadam/trilium/master/images/icon-black.svg";
|
||||
link.append(logo);
|
||||
}
|
||||
} while(parentId !== "_share")
|
||||
|
||||
if (container.children.length === 1) return;
|
||||
|
||||
placeholder.replaceWith(container);
|
||||
/*let currentNote = await fetchNote();
|
||||
let parentId = currentNote.parentNoteIds[0];
|
||||
while (parentId !== "_share") {
|
||||
notePath.splice(0, 0, currentNote.title);
|
||||
parentId = currentNote.parentNoteIds[0];
|
||||
currentNote = await fetchNote(parentId);
|
||||
}*/
|
||||
|
||||
// console.log(notePath);
|
||||
}
|
||||
|
||||
|
||||
|
||||
function buildBreadcrumbsFromNav() {
|
||||
const container = document.createElement("ul");
|
||||
container.id = "breadcrumbs";
|
||||
|
||||
const current = document.querySelector("#menu .active");
|
||||
const wrap = document.createElement("li");
|
||||
wrap.append(current.cloneNode(true));
|
||||
container.prepend(wrap);
|
||||
let next = current.closest("ul");
|
||||
while (next) {
|
||||
const clone = next.previousElementSibling.querySelector("a").cloneNode(true);
|
||||
const wrap = document.createElement("li");
|
||||
wrap.append(clone);
|
||||
container.prepend(wrap);
|
||||
next = next.parentElement.closest("ul");
|
||||
if (!next) {
|
||||
clone.textContent = "";
|
||||
const logo = document.createElement("img");
|
||||
logo.src = "https://raw.githubusercontent.com/zadam/trilium/master/images/icon-black.svg";
|
||||
clone.append(logo);
|
||||
}
|
||||
}
|
||||
|
||||
// We don't need this at root
|
||||
if (container.children.length === 1) return;
|
||||
|
||||
const main = document.getElementById("main");
|
||||
main.prepend(container);
|
||||
}
|
||||
|
||||
const submenuBlacklist = ["ZapIU17QNEyU"]
|
||||
//if (item.innerHTML.includes(submenuBlacklist[0])) item.className += " hidden";
|
||||
/*function fixSubMenu() {
|
||||
const items = document.querySelectorAll("#menu > ul > li");
|
||||
for (const item of items) {
|
||||
const sublist = item.querySelector("ul");
|
||||
if (sublist) {
|
||||
if (sublist.children.length) {
|
||||
item.className = "submenu";
|
||||
}
|
||||
else {
|
||||
sublist.remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
}*/
|
||||
|
||||
function fixSubMenu() {
|
||||
const items = document.querySelectorAll("#menu ul li");
|
||||
for (const item of items) {
|
||||
const sublist = item.querySelector("ul");
|
||||
if (sublist) {
|
||||
if (sublist.children.length) {
|
||||
const ihtml = item.innerHTML;
|
||||
for (const bl of submenuBlacklist) {
|
||||
if (!ihtml.includes(bl)) continue;
|
||||
item.classList.add("hidden");
|
||||
}
|
||||
item.classList.add("submenu-item");
|
||||
sublist.classList.add("submenu");
|
||||
if (sublist.querySelector("ul")?.children.length) sublist.classList.add("hasSubmenu");
|
||||
}
|
||||
else {
|
||||
sublist.remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function generateTOC() {
|
||||
const slugify = text => text.toLowerCase().replace(/[^\w]/g, "-");
|
||||
const buildItem = (heading) => {
|
||||
const slug = slugify(heading.textContent);
|
||||
|
||||
const anchor = document.createElement("a");
|
||||
anchor.setAttribute("href", `#${slug}`);
|
||||
anchor.setAttribute("name", slug);
|
||||
anchor.setAttribute("id", slug);
|
||||
anchor.textContent = "#";
|
||||
|
||||
const link = document.createElement("a");
|
||||
link.setAttribute("href", `#${slug}`);
|
||||
link.textContent = heading.textContent;
|
||||
|
||||
heading.append(anchor);
|
||||
|
||||
const li = document.createElement("li");
|
||||
li.append(link);
|
||||
return li;
|
||||
};
|
||||
|
||||
const headings = Array.from(document.querySelectorAll("h1, h2, h3, h4, h5, h6"));
|
||||
const items = headings.map(h => buildItem(h));
|
||||
if (headings.length <= 1) return;
|
||||
|
||||
const getNum = el => parseInt(el.tagName.replace("H","").replace("h",""));
|
||||
|
||||
const toc = document.createElement("ul");
|
||||
toc.id = "toc";
|
||||
const first = headings[1];
|
||||
const firstDepth = getNum(first);
|
||||
|
||||
for (let h = 0; h < headings.length; h++) {
|
||||
const current = headings[h];
|
||||
const currentDepth = getNum(current);
|
||||
if (currentDepth === firstDepth) toc.append(items[h]);
|
||||
|
||||
let nextIndex = h + 1;
|
||||
if (nextIndex >= headings.length) continue;
|
||||
|
||||
const children = [];
|
||||
const childDepth = currentDepth + 1;
|
||||
let nextDepth = getNum(headings[nextIndex]);
|
||||
while (nextDepth > currentDepth) {
|
||||
if (nextDepth === childDepth) children.push(nextIndex);
|
||||
nextIndex++;
|
||||
if (nextIndex < headings.length) nextDepth = getNum(headings[nextIndex]);
|
||||
else nextDepth = currentDepth;
|
||||
}
|
||||
|
||||
if (children.length) {
|
||||
const ul = document.createElement("ul");
|
||||
for (const c of children) ul.append(items[c]);
|
||||
items[h].append(ul);
|
||||
}
|
||||
}
|
||||
|
||||
const sections = headings.slice(1);
|
||||
const links = toc.querySelectorAll("a");
|
||||
function changeLinkState() {
|
||||
let index = sections.length;
|
||||
|
||||
while(--index && window.scrollY + 50 < sections[index].offsetTop) {}
|
||||
|
||||
links.forEach((link) => link.classList.remove('active'));
|
||||
links[index].classList.add('active');
|
||||
}
|
||||
|
||||
changeLinkState();
|
||||
window.addEventListener('scroll', changeLinkState);
|
||||
|
||||
const layout = document.querySelector("#layout");
|
||||
layout.classList.add("toc");
|
||||
layout.append(toc)
|
||||
}
|
||||
|
||||
function addExternalLinks() {
|
||||
const mapping = {
|
||||
EGFtX8Uw96FQ: "https://github.com/zadam/trilium"
|
||||
};
|
||||
|
||||
for (const id in mapping) {
|
||||
const links = document.querySelectorAll(`a[href*="${id}"]`);
|
||||
if (!links.length) {console.warn(`Could not find link to note id ${id}`); continue;}
|
||||
for (const link of links) {
|
||||
link.href = mapping[id];
|
||||
link.target = "_blank";
|
||||
link.rel = "noopener noreferrer";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
try{fixActiveLink();} catch(e){console.error(e)}
|
||||
try{addHljs();} catch(e){console.error(e)}
|
||||
try{fixTableHeaders();} catch(e){console.error(e)}
|
||||
// try{addLogo();} catch{}
|
||||
|
||||
try{fixSubMenu();} catch(e){console.error(e)}
|
||||
try{addSideNav();} catch(e){console.error(e)}
|
||||
try{buildBreadcrumbsFromNav();} catch(e){console.error(e)}
|
||||
try{generateTOC();} catch(e){console.error(e)}
|
||||
try{addExternalLinks();} catch(e){console.error(e)}
|
||||
731
src/styles/index.css
Normal file
731
src/styles/index.css
Normal file
@@ -0,0 +1,731 @@
|
||||
* {box-sizing: border-box;}
|
||||
|
||||
:root {
|
||||
--shadow: 0px 24px 32px rgba(0, 0, 0, 0.04), 0px 16px 24px rgba(0, 0, 0, 0.04), 0px 4px 8px rgba(0, 0, 0, 0.04), 0px 0px 1px rgba(0, 0, 0, 0.04);
|
||||
--blue: #3E82E5;
|
||||
--blue-strong: #008CBD;
|
||||
--gray: gray;
|
||||
--ck-color-table-caption-text: gray;
|
||||
--bg-primary: #1E1E1E;
|
||||
--bg-secondary: #3C3C3C;
|
||||
--text-primary: #ddd;
|
||||
--text-heading: #fff;
|
||||
|
||||
--bottom-layer: #040405;
|
||||
--middle-layer: #0C0D10;
|
||||
--top-layer: #14151B;
|
||||
--accent-layer: #20212B;
|
||||
--accent-color: #3E82E5;
|
||||
|
||||
--container-width: 1400px /*calc(100% - 10%)*/;
|
||||
--pane-size: 20%;
|
||||
scroll-padding-top: calc(72px + 1rem);
|
||||
}
|
||||
|
||||
body {
|
||||
margin: 0px;
|
||||
padding: 0px;
|
||||
background: var(--middle-layer);
|
||||
font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
|
||||
color: var(--text-primary);
|
||||
margin-bottom: 200px;
|
||||
}
|
||||
|
||||
a {
|
||||
text-decoration: none;
|
||||
color: var(--text-primary);
|
||||
transition: color 200ms ease;
|
||||
}
|
||||
|
||||
a:hover {
|
||||
color: var(--accent-color);
|
||||
}
|
||||
|
||||
#main a {
|
||||
color: var(--accent-color);
|
||||
}
|
||||
|
||||
#main a:hover {
|
||||
color: var(--text-heading);
|
||||
}
|
||||
|
||||
/* a[href^="https://"]::after {
|
||||
font-size: smaller;
|
||||
content: "\2197";
|
||||
vertical-align: top;
|
||||
} */
|
||||
|
||||
a[href^="https://"] {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
}
|
||||
|
||||
#main a[href^="https://"] {
|
||||
padding-right: 6px;
|
||||
}
|
||||
|
||||
a[href^="https://"]::after {
|
||||
content: "";
|
||||
background-color: currentcolor;
|
||||
mask: url("data:image/svg+xml;utf8,<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"13.5\" height=\"13.5\" viewBox=\"0 0 24 24\"><path fill=\"currentColor\" d=\"M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z\"></path></svg>");
|
||||
-webkit-mask: url("data:image/svg+xml;utf8,<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"13.5\" height=\"13.5\" viewBox=\"0 0 24 24\"><path fill=\"currentColor\" d=\"M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z\"></path></svg>");
|
||||
width: 13.5px;
|
||||
height: 13.5px;
|
||||
display: inline-flex;
|
||||
}
|
||||
|
||||
/* pre {
|
||||
overflow: auto;
|
||||
}
|
||||
|
||||
img {
|
||||
width: auto;
|
||||
height: auto;
|
||||
max-width: 100%;
|
||||
max-height: 100%;
|
||||
}
|
||||
|
||||
iframe {
|
||||
border: none;
|
||||
border-radius: 0.25rem;
|
||||
}
|
||||
|
||||
#layout {
|
||||
display: flex;
|
||||
flex-flow: row wrap;
|
||||
justify-content: center;
|
||||
min-height: 100vh;
|
||||
max-width: 960px;
|
||||
}
|
||||
|
||||
#main {
|
||||
contain: content;
|
||||
background-color: var(--top-layer);
|
||||
padding: 2rem 3rem 2rem 3rem;
|
||||
box-shadow: 0 2px 10px rgba(0,0,0,.25)!important;
|
||||
order: 2;
|
||||
}
|
||||
|
||||
#title {
|
||||
text-align: center;
|
||||
margin-block-end: 24px;
|
||||
font-size: 32px;
|
||||
line-height: 48px;
|
||||
letter-spacing: 0.02em;
|
||||
} */
|
||||
|
||||
#content {
|
||||
font-size: 16px;
|
||||
font-weight: 400;
|
||||
-webkit-font-smoothing: subpixel-antialiased;
|
||||
line-height: 1.5;
|
||||
overflow-wrap: break-word;
|
||||
word-wrap: break-word;
|
||||
hyphens: auto;
|
||||
letter-spacing: 0.02em;
|
||||
}
|
||||
|
||||
#main h1,
|
||||
#main h2,
|
||||
#main h3,
|
||||
#main h4,
|
||||
#main h5,
|
||||
#main h6 {
|
||||
color: var(--text-heading);
|
||||
line-height: 36px;
|
||||
padding: 5px 0px;
|
||||
letter-spacing: 0.02em;
|
||||
font-weight: 800;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
/* #content h2::before,
|
||||
#content h3::before,
|
||||
#content h4::before{
|
||||
content: '#';
|
||||
color: var(--blue);
|
||||
position: absolute;
|
||||
left: -20px;
|
||||
} */
|
||||
|
||||
#main h1 a,
|
||||
#main h2 a,
|
||||
#main h3 a,
|
||||
#main h4 a,
|
||||
#main h5 a,
|
||||
#main h6 a {
|
||||
color: var(--blue);
|
||||
margin-left: 10px;
|
||||
}
|
||||
|
||||
#content h2 {
|
||||
font-size: 24px;
|
||||
}
|
||||
|
||||
#content h3 {
|
||||
font-size: 20px;
|
||||
}
|
||||
|
||||
#content h4 {
|
||||
font-size: 16px;
|
||||
}
|
||||
|
||||
#content p {
|
||||
margin-block-start: 12px;
|
||||
margin-block-end: 12px;
|
||||
text-align: justify;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
#content hr {
|
||||
height: 1px;
|
||||
}
|
||||
|
||||
#content blockquote {
|
||||
margin-block-start: 12px;
|
||||
margin-block-end: 24px;
|
||||
margin-inline-start: 32px;
|
||||
margin-inline-end: 32px;
|
||||
padding-block-start: 12px;
|
||||
padding-block-end: 12px;
|
||||
padding-inline-start: 16px;
|
||||
padding-inline-end: 16px;
|
||||
background-color: hsla(0deg, 0%, 0%, 0.054);
|
||||
}
|
||||
|
||||
#noteClippedFrom {
|
||||
color: var(--gray);
|
||||
margin-bottom: 0.5rem;
|
||||
font-style:italic;
|
||||
}
|
||||
|
||||
.table {
|
||||
overflow-wrap: anywhere;
|
||||
}
|
||||
|
||||
.pdf-view {
|
||||
width: 100%;
|
||||
min-height: 40rem;
|
||||
}
|
||||
|
||||
.type-file > button {
|
||||
display: block;
|
||||
margin: 2rem auto;
|
||||
background-color: var(--blue);
|
||||
border: none;
|
||||
color: white;
|
||||
padding: 1rem 2rem;
|
||||
text-align: center;
|
||||
text-decoration: none;
|
||||
font-size: 1rem;
|
||||
border-radius: 0.25rem;
|
||||
box-shadow: var(--shadow);
|
||||
}
|
||||
|
||||
.mermaid {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
/* Menu */
|
||||
|
||||
#toggleMenuButton {
|
||||
display: none;
|
||||
}
|
||||
|
||||
/* .showMenu #menu {
|
||||
display: block;
|
||||
}
|
||||
|
||||
#menu strong{
|
||||
color: var(--blue-strong);
|
||||
} */
|
||||
|
||||
/* nav.grid ul {
|
||||
display: flex;
|
||||
flex-flow: row wrap;
|
||||
gap: 1rem;
|
||||
}
|
||||
nav.list {
|
||||
line-height: 1.5;
|
||||
}
|
||||
|
||||
nav ul {
|
||||
list-style-type: none;
|
||||
padding: 0 1rem;
|
||||
}
|
||||
|
||||
#parentLink {
|
||||
display: none;
|
||||
color: var(--gray);
|
||||
position: relative;
|
||||
left: -3rem;
|
||||
top: -1rem;
|
||||
}
|
||||
#parentLink::before {
|
||||
content: "@";
|
||||
}
|
||||
|
||||
input:disabled {
|
||||
border-radius: 3px;
|
||||
background-color: #cacaca;
|
||||
}
|
||||
|
||||
.ck-content .table table {
|
||||
border: 0;
|
||||
}
|
||||
|
||||
.ck-content .table table th {
|
||||
background: #252526;
|
||||
word-wrap: normal;
|
||||
background-clip: padding-box;
|
||||
}
|
||||
|
||||
.ck-content .table table th.empty {
|
||||
opacity: 0;
|
||||
border: 0;
|
||||
}
|
||||
|
||||
@media screen and (min-width: 60rem) {
|
||||
#main {
|
||||
width: 48rem;
|
||||
margin-block-start: 6rem;
|
||||
margin-block-end: 6rem;
|
||||
box-shadow: var(--shadow);
|
||||
border-radius: 4px 4px 0px 0px;
|
||||
}
|
||||
#toggleMenuButton {
|
||||
right: 1rem;
|
||||
top: 1rem;
|
||||
}
|
||||
}
|
||||
|
||||
@media screen and (max-width: 60rem) {
|
||||
#main {
|
||||
width: 100%;
|
||||
}
|
||||
#toggleMenuButton {
|
||||
right: 1rem;
|
||||
bottom: 1rem;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@media screen and (max-width: 32rem) {
|
||||
#main {
|
||||
padding: 4rem 2rem 2rem 2rem;
|
||||
}
|
||||
#content h2::before {
|
||||
left: 1rem;
|
||||
}
|
||||
#parentLink {
|
||||
left: 0rem;
|
||||
}
|
||||
} */
|
||||
|
||||
#menu {
|
||||
display: flex;
|
||||
position: fixed;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
width: inherit;
|
||||
margin: 0 auto;
|
||||
overflow: visible;
|
||||
z-index: 10;
|
||||
background: var(--bottom-layer);
|
||||
padding: 8px 16px;
|
||||
}
|
||||
|
||||
#menu::before {
|
||||
content: "";
|
||||
position: fixed;
|
||||
left: 0;
|
||||
right: 0;
|
||||
background: var(--bottom-layer);
|
||||
height: 72px;
|
||||
z-index: -1;
|
||||
}
|
||||
|
||||
#menu > p > a {
|
||||
display: flex;
|
||||
white-space: nowrap;
|
||||
gap: 10px;
|
||||
align-items: center;
|
||||
/* color: var(--text-heading); */
|
||||
}
|
||||
|
||||
/* #menu > p > a:hover {
|
||||
color: var(--accent-color);
|
||||
} */
|
||||
|
||||
/* #menu a {
|
||||
color: var(--text-heading);
|
||||
}
|
||||
|
||||
#menu a:hover {
|
||||
color: var(--accent-color);
|
||||
} */
|
||||
|
||||
#menu > p > a::before {
|
||||
content: "";
|
||||
display: flex;
|
||||
background: url("https://raw.githubusercontent.com/zadam/trilium/master/images/icon-color.svg");
|
||||
height: 40px;
|
||||
width: 53px;
|
||||
}
|
||||
|
||||
/* #logo {
|
||||
order: 1;
|
||||
height: 40px;
|
||||
} */
|
||||
|
||||
/* #menu > p > strong::before {
|
||||
content: "";
|
||||
display: flex;
|
||||
background: url("https://notes.cloud.zerebos.com/assets/v0.60.4/images/icon-black.svg");
|
||||
} */
|
||||
|
||||
#menu ul, #sidebar ul {
|
||||
list-style: none;
|
||||
padding: 0;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
#menu > ul {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
display: flex;
|
||||
gap: 30px;
|
||||
}
|
||||
|
||||
#menu > ul > li {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
|
||||
|
||||
#menu > ul > li > p > a {
|
||||
display: flex;
|
||||
gap: 10px;
|
||||
align-items: center;
|
||||
font-weight: 700;
|
||||
padding: 16px 0;
|
||||
}
|
||||
|
||||
/* #menu > ul > li > p > a::after {
|
||||
content: '';
|
||||
border: 4px solid transparent;
|
||||
border-top: 4px solid white;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
margin-bottom: -8px;
|
||||
} */
|
||||
|
||||
#menu > ul > li.submenu-item > p > a::after {
|
||||
content: "";
|
||||
border-color: currentcolor #0000;
|
||||
border-style: solid;
|
||||
border-width: .4em .4em 0;
|
||||
position: relative;
|
||||
display: flex;
|
||||
top: 2px;
|
||||
align-items: center;
|
||||
/* transform: translateY(-50%); */
|
||||
}
|
||||
|
||||
#menu > ul > li.submenu-item.hidden > ul,
|
||||
#menu > ul > li.submenu-item.hidden > p > a::after{
|
||||
display: none;
|
||||
}
|
||||
|
||||
#menu > ul > li > ul {
|
||||
/* display: none; */
|
||||
opacity: 0;
|
||||
pointer-events: none;
|
||||
position: absolute;
|
||||
top: 40px;
|
||||
background: #242526;
|
||||
border-radius: 6px;
|
||||
min-width: 150px;
|
||||
right: 50%;
|
||||
transform: translateX(50%);
|
||||
padding: 8px;
|
||||
transition: top 200ms ease, opacity 200ms ease;
|
||||
}
|
||||
|
||||
#menu > ul > li > ul > li a {
|
||||
display: flex;
|
||||
border-radius: 6px;
|
||||
padding: 3px 6px;
|
||||
transition: background-color 200ms ease;
|
||||
}
|
||||
|
||||
#menu > ul > li > ul > li a:hover {
|
||||
background: rgba(255,255,255,0.05);
|
||||
}
|
||||
|
||||
#menu > ul > li > ul > li > ul {
|
||||
display: none;
|
||||
}
|
||||
|
||||
#menu > ul > li:hover > ul {
|
||||
/* display: flex; */
|
||||
top: 50px;
|
||||
opacity: 1;
|
||||
pointer-events: initial;
|
||||
}
|
||||
|
||||
|
||||
body {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
#layout {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
width: var(--container-width);
|
||||
max-width: var(--container-width);
|
||||
margin-top: calc(72px + 1rem);
|
||||
position: relative;
|
||||
height: 100%;
|
||||
gap: 16px;
|
||||
}
|
||||
|
||||
@media screen and (max-width: 1500px) {
|
||||
#layout {
|
||||
width: 1300px;
|
||||
max-width: 1300px;
|
||||
}
|
||||
}
|
||||
|
||||
@media screen and (max-width: 1300px) {
|
||||
#layout {
|
||||
width: 1100px;
|
||||
max-width: 1200px;
|
||||
}
|
||||
}
|
||||
|
||||
#sidebar {
|
||||
flex: var(--pane-size);
|
||||
height: fit-content;
|
||||
position: sticky;
|
||||
top: calc(72px + 1rem);
|
||||
}
|
||||
|
||||
#main {
|
||||
flex: 100%;
|
||||
}
|
||||
|
||||
#layout.toc #main,
|
||||
#sidebar + #main {
|
||||
flex: calc(100% - var(--pane-size));
|
||||
}
|
||||
|
||||
#layout.toc #sidebar + #main {
|
||||
flex: calc(100% - (2 * var(--pane-size)));
|
||||
}
|
||||
|
||||
#main {
|
||||
contain: content;
|
||||
background-color: var(--top-layer);
|
||||
padding: 1rem 3rem 2rem 3rem;
|
||||
box-shadow: 0 2px 10px #00000040;
|
||||
border-radius: 6px;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
#sidebar, #sidebar ul {
|
||||
list-style: none;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
#sidebar {
|
||||
/* padding-right: 20px; */
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* #sidebar .title {
|
||||
text-transform: uppercase;
|
||||
text-align: center;
|
||||
letter-spacing: 5px;
|
||||
color: #777;
|
||||
font-weight: 700;
|
||||
border-bottom: 1px solid #777;
|
||||
} */
|
||||
|
||||
#sidebar p {
|
||||
display: flex;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
#sidebar a {
|
||||
flex: 1;
|
||||
padding: 6px 6px 6px 12px;
|
||||
border-radius: 6px;
|
||||
transition: color 200ms ease, background-color 200ms ease;
|
||||
}
|
||||
|
||||
#sidebar a:hover {
|
||||
background: rgba(255,255,255,0.05);
|
||||
}
|
||||
|
||||
#sidebar > li > ul > li.submenu-item > p > a {
|
||||
text-transform: uppercase;
|
||||
font-weight: 700;
|
||||
color: #555;
|
||||
}
|
||||
|
||||
#sidebar li > ul {
|
||||
margin-top: 5px;
|
||||
}
|
||||
|
||||
#sidebar > li > ul.hasSubmenu,
|
||||
#sidebar > li > ul > li.submenu-item + li.submenu-item {
|
||||
margin-top: 20px;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/* .ck-content pre {background: none;} */
|
||||
.ck-content code {
|
||||
background-color: var(--accent-layer);
|
||||
border-radius: 6px;
|
||||
padding: 3px;
|
||||
}
|
||||
.ck-content pre {
|
||||
background: var(--accent-layer);
|
||||
border-radius: 6px;
|
||||
border: 0;
|
||||
box-shadow: 0 2px 4px #0003;
|
||||
}
|
||||
|
||||
|
||||
#childLinks.list {
|
||||
display: none;
|
||||
}
|
||||
|
||||
|
||||
|
||||
#breadcrumbs {
|
||||
margin-bottom: 30px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
list-style: none;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
#breadcrumbs li {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
#breadcrumbs a {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding: 5px 10px;
|
||||
border-radius: 20px;
|
||||
transition: color 200ms ease, transform 200ms ease, background-color 200ms ease;
|
||||
}
|
||||
|
||||
#breadcrumbs img {
|
||||
width: 18px;
|
||||
filter: invert(100%);
|
||||
}
|
||||
|
||||
#breadcrumbs li:not(:last-child)::after {
|
||||
background: url("data:image/svg+xml;utf8,<svg xmlns=\"http://www.w3.org/2000/svg\" x=\"0px\" y=\"0px\" viewBox=\"0 0 256 256\"><g><g><polygon points=\"79.093,0 48.907,30.187 146.72,128 48.907,225.813 79.093,256 207.093,128\"/></g></g><g></g><g></g><g></g><g></g><g></g><g></g><g></g><g></g><g></g><g></g><g></g><g></g><g></g><g></g><g></g></svg>") center;
|
||||
content: " ";
|
||||
display: inline-block;
|
||||
filter: invert(0.64) sepia(0.11) saturate(0) hue-rotate(149deg) brightness(0.99) contrast(0.95);
|
||||
height: 8px;
|
||||
margin: 0 8px;
|
||||
opacity: .5;
|
||||
width: 8px;
|
||||
}
|
||||
|
||||
#breadcrumbs li:last-child a,
|
||||
#breadcrumbs li a:hover {
|
||||
background: #202127;
|
||||
}
|
||||
|
||||
#breadcrumbs li a:hover {
|
||||
transform: translateY(-3px);
|
||||
}
|
||||
|
||||
#parentLink {
|
||||
display: none;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#toc {
|
||||
flex: var(--pane-size);
|
||||
position: sticky;
|
||||
top: calc(72px + 1rem);
|
||||
height: fit-content;
|
||||
background: var(--top-layer);
|
||||
margin: 0;
|
||||
padding: 16px 16px 16px 32px;
|
||||
border-radius: 6px;
|
||||
}
|
||||
|
||||
#toc, #toc ul {
|
||||
list-style: none;
|
||||
}
|
||||
|
||||
#toc ul {
|
||||
padding-left: 16px;
|
||||
}
|
||||
|
||||
#toc li a {
|
||||
color: var(--text-heading);
|
||||
transition: color 200ms ease;
|
||||
}
|
||||
|
||||
#toc li a:hover,
|
||||
#toc li a.active {
|
||||
color: var(--accent-color);
|
||||
}
|
||||
|
||||
#toc::before {
|
||||
content: "";
|
||||
display: block;
|
||||
position: absolute;
|
||||
left: 16px;
|
||||
top: 20px;
|
||||
width: 2px;
|
||||
height: calc(100% - 40px);
|
||||
background: rgba(255, 255, 255, 0.1);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#childLinks.grid ul li a {
|
||||
border: 1px solid rgba(255, 255, 255, 0.1);
|
||||
}
|
||||
|
||||
#childLinks.grid ul li a:hover {
|
||||
background: rgba(255, 255, 255, 0.1);
|
||||
}
|
||||
8
tsconfig.eslint.json
Normal file
8
tsconfig.eslint.json
Normal file
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"extends": "./tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"rootDir": ".",
|
||||
"noEmit": true
|
||||
},
|
||||
"include": ["src/**/*", "scripts/*", "static/*"],
|
||||
}
|
||||
34
tsconfig.json
Normal file
34
tsconfig.json
Normal file
@@ -0,0 +1,34 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"esModuleInterop": true,
|
||||
"allowSyntheticDefaultImports": true,
|
||||
"resolveJsonModule": true,
|
||||
"declaration": true,
|
||||
"strictNullChecks": true,
|
||||
"moduleResolution": "Node16",
|
||||
"target": "ES2020",
|
||||
"rootDir": "src",
|
||||
"outDir": "lib/cjs",
|
||||
"module": "Node16",
|
||||
"jsx": "preserve",
|
||||
"jsxImportSource": "solid-js",
|
||||
},
|
||||
"include": ["src/**/*"],
|
||||
"typedocOptions": {
|
||||
"name": "TriliumETAPI",
|
||||
"entryPoints": ["src/index.ts"],
|
||||
"out": "docs",
|
||||
"includeVersion": true,
|
||||
"navigationLinks": {
|
||||
"Trilium": "https://github.com/zadam/trilium"
|
||||
},
|
||||
"sidebarLinks": {},
|
||||
"navigation": {
|
||||
"fullTree": true,
|
||||
"includeCategories": true,
|
||||
"includeGroups": false
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user