Skip to content

Commit

Permalink
Merge remote-tracking branch 'Cyace84/docs'
Browse files Browse the repository at this point in the history
  • Loading branch information
Rexagon committed Oct 4, 2023
2 parents aedb130 + bc17006 commit f16b8a1
Showing 54 changed files with 12,927 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -73,3 +73,8 @@ docs/_build/
.python-version

python/**/*.so

# Docs
docs/.vitepress/dist
docs/.vitepress/cache
docs/node_modules
86 changes: 86 additions & 0 deletions docs/.eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
{
"root": true,
"env": {
"browser": true,
"node": true
},
"extends": [
"plugin:vue/recommended",
"plugin:import/errors",
"plugin:import/warnings",
"plugin:import/typescript",
"plugin:sonarjs/recommended",
"plugin:@typescript-eslint/recommended",
"plugin:import/recommended",
"plugin:import/typescript",
"prettier"
],
"plugins": ["@typescript-eslint", "import", "prettier", "sonarjs", "vue"],
"parser": "vue-eslint-parser",
"parserOptions": {
"parser": "@typescript-eslint/parser",
"project": "./tsconfig.eslint.json",
"extraFileExtensions": [".vue"]
},
"settings": {
"import/extensions": [".ts", ".tsx", ".js", ".scss", ".css", ".vue"],
"import/parsers": {
"@typescript-eslint/parser": [".ts", ".tsx"]
},
"import/resolver": {
"typescript": {
"alwaysTryTypes": true
}
}
},
"rules": {
"import/no-named-as-default": 0,
"prettier/prettier": "error",
"import/order": [
"error",
{
"groups": [["external", "builtin"], "internal", ["parent", "sibling", "index"]],
"alphabetize": {
"order": "asc",
"caseInsensitive": true
},
"newlines-between": "always"
}
],
"newline-before-return": ["error"],
"comma-dangle": [
"error",
{
"arrays": "always-multiline",
"objects": "always-multiline",
"imports": "always-multiline",
"exports": "always-multiline",
"functions": "never"
}
],

"import/no-default-export": "off",
"import/default": "off",
"no-restricted-exports": ["error", { "restrictedNamedExports": ["default"] }],
"curly": "error",
"no-console": "error",
"no-shadow": "off",
"@typescript-eslint/no-shadow": ["error"],
"@typescript-eslint/no-unused-vars": "error",
"@typescript-eslint/no-explicit-any": "error",
"@typescript-eslint/no-unnecessary-type-assertion": "error",
"@typescript-eslint/promise-function-async": "error",
"@typescript-eslint/prefer-for-of": "error",
"@typescript-eslint/no-useless-constructor": "error",
"@typescript-eslint/no-use-before-define": "error",
"@typescript-eslint/no-this-alias": "error",
"@typescript-eslint/no-require-imports": "error",
"@typescript-eslint/no-for-in-array": "error",
"@typescript-eslint/no-array-constructor": "error",
"@typescript-eslint/await-thenable": "error",
"@typescript-eslint/require-array-sort-compare": "error",
"@typescript-eslint/ban-ts-comment": "warn",
"no-restricted-imports": "error",
"vue/no-v-html": "off"
}
}
28 changes: 28 additions & 0 deletions docs/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*

node_modules
dist
dist-ssr
*.local
.vitepress/dist
.vitepress/cache

# Editor directories and files
.vscode/*
!.vscode/extensions.json
.idea
.DS_Store
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?

.vitepress/cache
18 changes: 18 additions & 0 deletions docs/.prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"tabWidth": 2,
"printWidth": 100,
"useTabs": false,
"semi": true,
"singleQuote": true,
"trailingComma": "es5",
"bracketSpacing": true,
"arrowParens": "avoid",
"overrides": [
{
"files": "*.md",
"options": {
"printWidth": 70
}
}
]
}
104 changes: 104 additions & 0 deletions docs/.vitepress/config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
import vue from '@vitejs/plugin-vue';

const HELP_URL = 'https://t.me/everdev';
const FEEDBACK_URL = '';
const GITHUB_URL = '';

module.exports = {
title: 'Nekoton Python Docs',
base: '/',
description: 'nekoton-python',

plugins: [vue()],
rewrites: {
'src/pages/index.md': 'index.md',
'src/pages/concepts/data-representation.md': 'concepts/data-representation.md',
'src/pages/concepts/abi.md': 'concepts/abi.md',
'src/pages/concepts/accounts.md': 'concepts/accounts.md',
'src/pages/concepts/messages.md': 'concepts/messages.md',
'src/pages/concepts/transactions.md': 'concepts/transactions.md',
'src/pages/guides/installation-and-quick-start.md': 'installation-and-quick-start.md',
'src/pages/guides/keys-and-signatures.md': 'guides/keys-and-signatures.md',
'src/pages/guides/working-with-cells.md': 'guides/working-with-cells.md',
'src/pages/guides/working-with-abi.md': 'guides/working-with-abi.md',
'src/pages/guides/working-with-accounts.md': 'guides/working-with-accounts.md',
'src/pages/guides/working-with-messages.md': 'guides/working-with-messages.md',
'src/pages/guides/working-with-transactions.md': 'guides/working-with-transactions.md',
'src/pages/guides/working-with-transport.md': 'guides/working-with-transport.md',
},
themeConfig: {
search: {
provider: 'local',
},
nav: [
{ text: 'Feedback', link: FEEDBACK_URL },
{ text: 'Community', link: HELP_URL },
],
sidebar: [
{ text: 'Overview', link: '/' },
{
text: 'Installation & Quick Start',
link: '/installation-and-quick-start.md',
},

{
text: 'Concepts',
collapsable: false,
items: [
{
text: 'Data Representation',
link: '/concepts/data-representation.md',
},
{ text: 'ABI', link: '/concepts/abi.md' },
{ text: 'Accounts', link: '/concepts/accounts.md' },
{ text: 'Messages', link: '/concepts/messages.md' },
{ text: 'Transactions', link: '/concepts/transactions.md' },
],
},

{
text: 'Guide',
collapsable: false,

items: [
{
text: 'Keys & Signatures',
link: '/guides/keys-and-signatures.md',
},
{
text: 'Working with Cells',
link: '/guides/working-with-cells.md',
},
{
text: 'Working with ABI',
link: '/guides/working-with-abi.md',
},
{
text: 'Working with Accounts',
link: '/guides/working-with-accounts.md',
},
{
text: 'Working with Messages',
link: '/guides/working-with-messages.md',
},
{
text: 'Working with Transactions',
link: '/guides/working-with-transactions.md',
},
{
text: 'Working with Transport',
link: '/guides/working-with-transport.md',
},
],
},
],
editLink: {
pattern: 'https://github.com/cyace84/nekoton-python/edit/docs/docs/:path',
},
socialLinks: [{ icon: 'github', link: GITHUB_URL }],
},

esbuild: {
target: ['chrome89', 'edge89', 'firefox79', 'safari14.1'],
},
};
58 changes: 58 additions & 0 deletions docs/.vitepress/theme/components/BDKLayout.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
<script setup lang="ts">
import { useRoute, useData } from 'vitepress';
import DefaultTheme from 'vitepress/theme';
import { onMounted, computed, ref, Ref, onUpdated } from 'vue';
import { getApiReference, ApiRefPage } from './../../../src/api';
import BDKWalletControl from './BDKWalletControl.vue';
import BDKOutline from './shared/outline/BDKOutline.vue';
const { Layout } = DefaultTheme;
const route = useRoute();
const { frontmatter } = useData();
const dynamicContent = ref<string | undefined>('');
const projectName = frontmatter.value.projectName ?? '';
let pageName = computed(() => {
let name = route.path.split('/').pop() ?? '';
return name.replace('.html', '');
});
let apiReference: Ref<void | ApiRefPage | undefined> = ref();
const isApiReferencePage = computed(() => {
return frontmatter.value.apiReference ?? false;
});
onMounted(async () => {
if (!isApiReferencePage.value) {
return;
}
apiReference.value = await getApiReference(projectName, pageName.value);
dynamicContent.value = apiReference.value?.content;
});
onUpdated(async () => {
if (!isApiReferencePage.value) {
return;
}
apiReference.value = await getApiReference(projectName, pageName.value);
dynamicContent.value = apiReference.value?.content;
});
</script>

<template>
<Layout>
<template #nav-bar-content-after>
<Suspense>
<BDKWalletControl />
</Suspense>
</template>
<template v-if="isApiReferencePage" #aside-outline-before>
<BDKOutline :content="dynamicContent" />
</template>
</Layout>
</template>
80 changes: 80 additions & 0 deletions docs/.vitepress/theme/components/BDKPage.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
<template>
<div v-if="apiReference.content === '' || apiReference.content === undefined">Loading...</div>
<div v-else class="page-container">
<div class="page-content" v-html="apiReference.content"></div>
</div>
</template>

<script lang="ts">
import { defineComponent, ref, onMounted, nextTick } from 'vue';
import { getApiReference } from './../../../src/api';
import { NodeEnv } from './../../../src/config';
interface ApiResponse {
content: string;
}
export default defineComponent({
name: 'BDKPage',
props: {
projectName: {
type: String,
default: '',
},
pageName: {
type: String,
default: '',
},
nodeEnv: {
type: String as () => NodeEnv,
default: 'local',
},
},
setup(props) {
const apiReference = ref<ApiResponse>({ content: '' });
onMounted(async () => {
const response = await getApiReference(props.projectName, props.pageName, props.nodeEnv);
if (response) {
apiReference.value = response;
}
await nextTick();
if (typeof window !== 'undefined' && typeof document !== 'undefined') {
const hash = window.location.hash;
if (hash) {
const element = document.getElementById(hash.substring(1));
if (element) {
element.scrollIntoView({ behavior: 'smooth' });
}
}
}
});
return { apiReference };
},
});
</script>

<style scoped>
.page-container {
display: flex;
flex-direction: row;
}
.page-outline {
position: fixed;
top: 96px;
right: calc(100vw - 85.3%);
height: 100vh;
width: 200px;
overflow-y: auto;
}
@media screen and (max-width: 1279px) {
.page-outline {
display: none;
}
}
</style>
Loading

0 comments on commit f16b8a1

Please sign in to comment.