From 7b62f6caf23512106ad9efd1de43e820fa665961 Mon Sep 17 00:00:00 2001 From: Victor Westerlund Date: Wed, 14 Aug 2024 17:39:10 +0200 Subject: [PATCH] wip: 2024-08-14T08:34:08+0200 (1723617248) --- modules/docs/contribute.php | 11 + modules/docs/legend-js.php | 24 +++ modules/docs/legend-php.php | 12 ++ modules/snippet/Snippet.php | 33 +++ modules/snippet/snippet.js | 19 ++ .../snippets/docs/API/PHP/VV/css/0.php | 4 + .../snippets/docs/API/PHP/VV/css/1.php | 1 + .../snippets/docs/API/PHP/VV/css/2.php | 1 + .../docs/API/PHP/VV/css/description.php | 4 + .../docs/API/PHP/VV/css/example-1-0.css | 6 + .../docs/API/PHP/VV/css/example-1-1.php | 4 + .../snippets/docs/API/PHP/VV/embed/0.php | 4 + .../snippets/docs/API/PHP/VV/embed/1.php | 1 + .../snippets/docs/API/PHP/VV/embed/2.php | 1 + .../docs/API/PHP/VV/embed/description.php | 4 + .../docs/API/PHP/VV/embed/example-1-0.css | 6 + .../docs/API/PHP/VV/embed/example-1-1.php | 4 + .../snippets/docs/API/PHP/VV/include/0.php | 4 + .../snippets/docs/API/PHP/VV/include/1.php | 1 + .../snippets/docs/API/PHP/VV/include/2.php | 1 + .../docs/API/PHP/VV/include/description.php | 4 + .../docs/API/PHP/VV/include/example-1-0.css | 6 + .../docs/API/PHP/VV/include/example-1-1.php | 4 + .../snippet/snippets/docs/API/PHP/VV/js/0.php | 4 + .../snippet/snippets/docs/API/PHP/VV/js/1.php | 1 + .../snippet/snippets/docs/API/PHP/VV/js/2.php | 1 + .../docs/API/PHP/VV/js/description.php | 4 + .../docs/API/PHP/VV/js/example-1-0.js | 5 + .../docs/API/PHP/VV/js/example-1-1.php | 4 + .../snippets/docs/API/PHP/VV/root/0.php | 1 + .../snippets/docs/API/PHP/VV/root/1.txt | 1 + .../snippets/docs/API/PHP/VV/root/2.php | 9 + .../snippets/docs/API/PHP/VV/root/3.php | 11 + .../docs/API/PHP/VV/root/description.php | 3 + .../snippets/docs/API/PHP/VV/shell/0.php | 1 + .../docs/API/PHP/VV/shell/description.php | 3 + .../docs/API/PHP/VV/shell/example-0-0.php | 4 + .../docs/API/PHP/VV/shell/example-0-1.php | 5 + .../snippet/snippets/docs/installation/0.txt | 1 + .../snippet/snippets/docs/installation/1.txt | 1 + .../snippet/snippets/docs/installation/2.txt | 16 ++ .../snippet/snippets/docs/installation/3.txt | 1 + .../snippet/snippets/docs/installation/4.txt | 1 + .../snippet/snippets/docs/installation/5.txt | 10 + public/assets/css/document.css | 22 +- public/assets/css/shells/docs.css | 200 ++++++++++++++++++ public/assets/js/shells/docs.js | 0 public/docs/API/JS/index.php | 1 + public/docs/API/PHP/VV/css.php | 83 ++++++++ public/docs/API/PHP/VV/embed.php | 72 +++++++ public/docs/API/PHP/VV/include.php | 77 +++++++ public/docs/API/PHP/VV/index.php | 15 ++ public/docs/API/PHP/VV/js.php | 83 ++++++++ public/docs/API/PHP/VV/root.php | 77 +++++++ public/docs/API/PHP/VV/shell.php | 75 +++++++ public/docs/API/PHP/index.php | 26 +++ public/docs/API/index.php | 1 + public/docs/index.php | 15 ++ public/docs/installation.php | 85 ++++++++ public/index.php | 2 +- public/why.php | 3 +- shells/docs.php | 17 ++ 62 files changed, 1092 insertions(+), 8 deletions(-) create mode 100644 modules/docs/contribute.php create mode 100644 modules/docs/legend-js.php create mode 100644 modules/docs/legend-php.php create mode 100644 modules/snippet/Snippet.php create mode 100644 modules/snippet/snippet.js create mode 100644 modules/snippet/snippets/docs/API/PHP/VV/css/0.php create mode 100644 modules/snippet/snippets/docs/API/PHP/VV/css/1.php create mode 100644 modules/snippet/snippets/docs/API/PHP/VV/css/2.php create mode 100644 modules/snippet/snippets/docs/API/PHP/VV/css/description.php create mode 100644 modules/snippet/snippets/docs/API/PHP/VV/css/example-1-0.css create mode 100644 modules/snippet/snippets/docs/API/PHP/VV/css/example-1-1.php create mode 100644 modules/snippet/snippets/docs/API/PHP/VV/embed/0.php create mode 100644 modules/snippet/snippets/docs/API/PHP/VV/embed/1.php create mode 100644 modules/snippet/snippets/docs/API/PHP/VV/embed/2.php create mode 100644 modules/snippet/snippets/docs/API/PHP/VV/embed/description.php create mode 100644 modules/snippet/snippets/docs/API/PHP/VV/embed/example-1-0.css create mode 100644 modules/snippet/snippets/docs/API/PHP/VV/embed/example-1-1.php create mode 100644 modules/snippet/snippets/docs/API/PHP/VV/include/0.php create mode 100644 modules/snippet/snippets/docs/API/PHP/VV/include/1.php create mode 100644 modules/snippet/snippets/docs/API/PHP/VV/include/2.php create mode 100644 modules/snippet/snippets/docs/API/PHP/VV/include/description.php create mode 100644 modules/snippet/snippets/docs/API/PHP/VV/include/example-1-0.css create mode 100644 modules/snippet/snippets/docs/API/PHP/VV/include/example-1-1.php create mode 100644 modules/snippet/snippets/docs/API/PHP/VV/js/0.php create mode 100644 modules/snippet/snippets/docs/API/PHP/VV/js/1.php create mode 100644 modules/snippet/snippets/docs/API/PHP/VV/js/2.php create mode 100644 modules/snippet/snippets/docs/API/PHP/VV/js/description.php create mode 100644 modules/snippet/snippets/docs/API/PHP/VV/js/example-1-0.js create mode 100644 modules/snippet/snippets/docs/API/PHP/VV/js/example-1-1.php create mode 100644 modules/snippet/snippets/docs/API/PHP/VV/root/0.php create mode 100644 modules/snippet/snippets/docs/API/PHP/VV/root/1.txt create mode 100644 modules/snippet/snippets/docs/API/PHP/VV/root/2.php create mode 100644 modules/snippet/snippets/docs/API/PHP/VV/root/3.php create mode 100644 modules/snippet/snippets/docs/API/PHP/VV/root/description.php create mode 100644 modules/snippet/snippets/docs/API/PHP/VV/shell/0.php create mode 100644 modules/snippet/snippets/docs/API/PHP/VV/shell/description.php create mode 100644 modules/snippet/snippets/docs/API/PHP/VV/shell/example-0-0.php create mode 100644 modules/snippet/snippets/docs/API/PHP/VV/shell/example-0-1.php create mode 100644 modules/snippet/snippets/docs/installation/0.txt create mode 100644 modules/snippet/snippets/docs/installation/1.txt create mode 100644 modules/snippet/snippets/docs/installation/2.txt create mode 100644 modules/snippet/snippets/docs/installation/3.txt create mode 100644 modules/snippet/snippets/docs/installation/4.txt create mode 100644 modules/snippet/snippets/docs/installation/5.txt create mode 100644 public/assets/css/shells/docs.css create mode 100644 public/assets/js/shells/docs.js create mode 100644 public/docs/API/JS/index.php create mode 100644 public/docs/API/PHP/VV/css.php create mode 100644 public/docs/API/PHP/VV/embed.php create mode 100644 public/docs/API/PHP/VV/include.php create mode 100644 public/docs/API/PHP/VV/index.php create mode 100644 public/docs/API/PHP/VV/js.php create mode 100644 public/docs/API/PHP/VV/root.php create mode 100644 public/docs/API/PHP/VV/shell.php create mode 100644 public/docs/API/PHP/index.php create mode 100644 public/docs/API/index.php create mode 100644 public/docs/index.php create mode 100644 public/docs/installation.php create mode 100644 shells/docs.php diff --git a/modules/docs/contribute.php b/modules/docs/contribute.php new file mode 100644 index 0000000..a45a6b8 --- /dev/null +++ b/modules/docs/contribute.php @@ -0,0 +1,11 @@ +
+ +

Contribute 💕

+

Have you found a problem om this page? Would you like to help make Vegvisir better?

+ +
+
\ No newline at end of file diff --git a/modules/docs/legend-js.php b/modules/docs/legend-js.php new file mode 100644 index 0000000..b142909 --- /dev/null +++ b/modules/docs/legend-js.php @@ -0,0 +1,24 @@ + \ No newline at end of file diff --git a/modules/docs/legend-php.php b/modules/docs/legend-php.php new file mode 100644 index 0000000..819d38b --- /dev/null +++ b/modules/docs/legend-php.php @@ -0,0 +1,12 @@ + \ No newline at end of file diff --git a/modules/snippet/Snippet.php b/modules/snippet/Snippet.php new file mode 100644 index 0000000..e3785b8 --- /dev/null +++ b/modules/snippet/Snippet.php @@ -0,0 +1,33 @@ +value); + + // Bail out if snippet can't be found + if (!is_file($path)) { + return "
!REF#
"; + } + + // Use enum name in lowercase as highlight.js lanuage definer + $output = "
";
+				$output .= htmlspecialchars(file_get_contents($path));
+				$output .= "
"; + + return $output; + } + } + +?> + + \ No newline at end of file diff --git a/modules/snippet/snippet.js b/modules/snippet/snippet.js new file mode 100644 index 0000000..0eefd2a --- /dev/null +++ b/modules/snippet/snippet.js @@ -0,0 +1,19 @@ +import hljs from "https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.10.0/es/highlight.min.js"; + +import php from "https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.10.0/es/languages/php.min.js"; +import css from "https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.10.0/es/languages/css.min.js"; +import plaintext from "https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.10.0/es/languages/plaintext.min.js"; +import javascript from "https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.10.0/es/languages/javascript.min.js"; + +hljs.registerLanguage("php", php); +hljs.registerLanguage("css", css); +hljs.registerLanguage("plaintext", plaintext); +hljs.registerLanguage("javascript", javascript); + +// Initialize syntax highlighting for all code snippets on this page +const highlightElements = () => { + [...document.querySelectorAll("pre code")].forEach(element => hljs.highlightElement(element)); +} + +document.querySelector("[vv-shell-id='6ccb0465']").addEventListener(vegvisir.Navigation.EVENTS.FINISHED, () => highlightElements); +highlightElements(); diff --git a/modules/snippet/snippets/docs/API/PHP/VV/css/0.php b/modules/snippet/snippets/docs/API/PHP/VV/css/0.php new file mode 100644 index 0000000..ebb4007 --- /dev/null +++ b/modules/snippet/snippets/docs/API/PHP/VV/css/0.php @@ -0,0 +1,4 @@ + + +// Without file extension (appended automatically) + \ No newline at end of file diff --git a/modules/snippet/snippets/docs/API/PHP/VV/css/1.php b/modules/snippet/snippets/docs/API/PHP/VV/css/1.php new file mode 100644 index 0000000..0c6476c --- /dev/null +++ b/modules/snippet/snippets/docs/API/PHP/VV/css/1.php @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/modules/snippet/snippets/docs/API/PHP/VV/css/2.php b/modules/snippet/snippets/docs/API/PHP/VV/css/2.php new file mode 100644 index 0000000..77d81a2 --- /dev/null +++ b/modules/snippet/snippets/docs/API/PHP/VV/css/2.php @@ -0,0 +1 @@ +"const hello = ()=>console.log('Hello world');hello()" \ No newline at end of file diff --git a/modules/snippet/snippets/docs/API/PHP/VV/css/description.php b/modules/snippet/snippets/docs/API/PHP/VV/css/description.php new file mode 100644 index 0000000..3251b2c --- /dev/null +++ b/modules/snippet/snippets/docs/API/PHP/VV/css/description.php @@ -0,0 +1,4 @@ +VV::css( + string $pathname, + bool $relative = true +): string \ No newline at end of file diff --git a/modules/snippet/snippets/docs/API/PHP/VV/css/example-1-0.css b/modules/snippet/snippets/docs/API/PHP/VV/css/example-1-0.css new file mode 100644 index 0000000..0d2c803 --- /dev/null +++ b/modules/snippet/snippets/docs/API/PHP/VV/css/example-1-0.css @@ -0,0 +1,6 @@ +/* File: /var/www/my-website/public/assets/css/style.css */ + +p { + color: blue; + background-color: red; +} \ No newline at end of file diff --git a/modules/snippet/snippets/docs/API/PHP/VV/css/example-1-1.php b/modules/snippet/snippets/docs/API/PHP/VV/css/example-1-1.php new file mode 100644 index 0000000..dfb160d --- /dev/null +++ b/modules/snippet/snippets/docs/API/PHP/VV/css/example-1-1.php @@ -0,0 +1,4 @@ +// File: /var/www/my-website/public/index.php + + +

Some content...

\ No newline at end of file diff --git a/modules/snippet/snippets/docs/API/PHP/VV/embed/0.php b/modules/snippet/snippets/docs/API/PHP/VV/embed/0.php new file mode 100644 index 0000000..ebb4007 --- /dev/null +++ b/modules/snippet/snippets/docs/API/PHP/VV/embed/0.php @@ -0,0 +1,4 @@ + + +// Without file extension (appended automatically) + \ No newline at end of file diff --git a/modules/snippet/snippets/docs/API/PHP/VV/embed/1.php b/modules/snippet/snippets/docs/API/PHP/VV/embed/1.php new file mode 100644 index 0000000..0c6476c --- /dev/null +++ b/modules/snippet/snippets/docs/API/PHP/VV/embed/1.php @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/modules/snippet/snippets/docs/API/PHP/VV/embed/2.php b/modules/snippet/snippets/docs/API/PHP/VV/embed/2.php new file mode 100644 index 0000000..77d81a2 --- /dev/null +++ b/modules/snippet/snippets/docs/API/PHP/VV/embed/2.php @@ -0,0 +1 @@ +"const hello = ()=>console.log('Hello world');hello()" \ No newline at end of file diff --git a/modules/snippet/snippets/docs/API/PHP/VV/embed/description.php b/modules/snippet/snippets/docs/API/PHP/VV/embed/description.php new file mode 100644 index 0000000..70b5401 --- /dev/null +++ b/modules/snippet/snippets/docs/API/PHP/VV/embed/description.php @@ -0,0 +1,4 @@ +VV::embed( + string $pathname, + bool $relative = true +): string \ No newline at end of file diff --git a/modules/snippet/snippets/docs/API/PHP/VV/embed/example-1-0.css b/modules/snippet/snippets/docs/API/PHP/VV/embed/example-1-0.css new file mode 100644 index 0000000..0d2c803 --- /dev/null +++ b/modules/snippet/snippets/docs/API/PHP/VV/embed/example-1-0.css @@ -0,0 +1,6 @@ +/* File: /var/www/my-website/public/assets/css/style.css */ + +p { + color: blue; + background-color: red; +} \ No newline at end of file diff --git a/modules/snippet/snippets/docs/API/PHP/VV/embed/example-1-1.php b/modules/snippet/snippets/docs/API/PHP/VV/embed/example-1-1.php new file mode 100644 index 0000000..dfb160d --- /dev/null +++ b/modules/snippet/snippets/docs/API/PHP/VV/embed/example-1-1.php @@ -0,0 +1,4 @@ +// File: /var/www/my-website/public/index.php + + +

Some content...

\ No newline at end of file diff --git a/modules/snippet/snippets/docs/API/PHP/VV/include/0.php b/modules/snippet/snippets/docs/API/PHP/VV/include/0.php new file mode 100644 index 0000000..a6f6f0e --- /dev/null +++ b/modules/snippet/snippets/docs/API/PHP/VV/include/0.php @@ -0,0 +1,4 @@ + + +// Without file extension (appended automatically) + \ No newline at end of file diff --git a/modules/snippet/snippets/docs/API/PHP/VV/include/1.php b/modules/snippet/snippets/docs/API/PHP/VV/include/1.php new file mode 100644 index 0000000..c5ca0f1 --- /dev/null +++ b/modules/snippet/snippets/docs/API/PHP/VV/include/1.php @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/modules/snippet/snippets/docs/API/PHP/VV/include/2.php b/modules/snippet/snippets/docs/API/PHP/VV/include/2.php new file mode 100644 index 0000000..77d81a2 --- /dev/null +++ b/modules/snippet/snippets/docs/API/PHP/VV/include/2.php @@ -0,0 +1 @@ +"const hello = ()=>console.log('Hello world');hello()" \ No newline at end of file diff --git a/modules/snippet/snippets/docs/API/PHP/VV/include/description.php b/modules/snippet/snippets/docs/API/PHP/VV/include/description.php new file mode 100644 index 0000000..c154efc --- /dev/null +++ b/modules/snippet/snippets/docs/API/PHP/VV/include/description.php @@ -0,0 +1,4 @@ +VV::include( + string $pathname, + bool $relative = true +): never \ No newline at end of file diff --git a/modules/snippet/snippets/docs/API/PHP/VV/include/example-1-0.css b/modules/snippet/snippets/docs/API/PHP/VV/include/example-1-0.css new file mode 100644 index 0000000..0d2c803 --- /dev/null +++ b/modules/snippet/snippets/docs/API/PHP/VV/include/example-1-0.css @@ -0,0 +1,6 @@ +/* File: /var/www/my-website/public/assets/css/style.css */ + +p { + color: blue; + background-color: red; +} \ No newline at end of file diff --git a/modules/snippet/snippets/docs/API/PHP/VV/include/example-1-1.php b/modules/snippet/snippets/docs/API/PHP/VV/include/example-1-1.php new file mode 100644 index 0000000..dfb160d --- /dev/null +++ b/modules/snippet/snippets/docs/API/PHP/VV/include/example-1-1.php @@ -0,0 +1,4 @@ +// File: /var/www/my-website/public/index.php + + +

Some content...

\ No newline at end of file diff --git a/modules/snippet/snippets/docs/API/PHP/VV/js/0.php b/modules/snippet/snippets/docs/API/PHP/VV/js/0.php new file mode 100644 index 0000000..3fc3023 --- /dev/null +++ b/modules/snippet/snippets/docs/API/PHP/VV/js/0.php @@ -0,0 +1,4 @@ + + +// Without file extension (appended automatically) + \ No newline at end of file diff --git a/modules/snippet/snippets/docs/API/PHP/VV/js/1.php b/modules/snippet/snippets/docs/API/PHP/VV/js/1.php new file mode 100644 index 0000000..983cfef --- /dev/null +++ b/modules/snippet/snippets/docs/API/PHP/VV/js/1.php @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/modules/snippet/snippets/docs/API/PHP/VV/js/2.php b/modules/snippet/snippets/docs/API/PHP/VV/js/2.php new file mode 100644 index 0000000..77d81a2 --- /dev/null +++ b/modules/snippet/snippets/docs/API/PHP/VV/js/2.php @@ -0,0 +1 @@ +"const hello = ()=>console.log('Hello world');hello()" \ No newline at end of file diff --git a/modules/snippet/snippets/docs/API/PHP/VV/js/description.php b/modules/snippet/snippets/docs/API/PHP/VV/js/description.php new file mode 100644 index 0000000..fe7dea6 --- /dev/null +++ b/modules/snippet/snippets/docs/API/PHP/VV/js/description.php @@ -0,0 +1,4 @@ +VV::js( + string $pathname, + bool $relative = true +): string \ No newline at end of file diff --git a/modules/snippet/snippets/docs/API/PHP/VV/js/example-1-0.js b/modules/snippet/snippets/docs/API/PHP/VV/js/example-1-0.js new file mode 100644 index 0000000..a4e944e --- /dev/null +++ b/modules/snippet/snippets/docs/API/PHP/VV/js/example-1-0.js @@ -0,0 +1,5 @@ +// File: /var/www/my-website/public/assets/js/script.js + +const hello = () => { + console.log("Hello world!"); +} \ No newline at end of file diff --git a/modules/snippet/snippets/docs/API/PHP/VV/js/example-1-1.php b/modules/snippet/snippets/docs/API/PHP/VV/js/example-1-1.php new file mode 100644 index 0000000..a9a296e --- /dev/null +++ b/modules/snippet/snippets/docs/API/PHP/VV/js/example-1-1.php @@ -0,0 +1,4 @@ +// File: /var/www/my-website/public/index.php + +

Some content...

+ \ No newline at end of file diff --git a/modules/snippet/snippets/docs/API/PHP/VV/root/0.php b/modules/snippet/snippets/docs/API/PHP/VV/root/0.php new file mode 100644 index 0000000..34f4b5a --- /dev/null +++ b/modules/snippet/snippets/docs/API/PHP/VV/root/0.php @@ -0,0 +1 @@ +VV::root("/src/databases"); \ No newline at end of file diff --git a/modules/snippet/snippets/docs/API/PHP/VV/root/1.txt b/modules/snippet/snippets/docs/API/PHP/VV/root/1.txt new file mode 100644 index 0000000..38f9b6d --- /dev/null +++ b/modules/snippet/snippets/docs/API/PHP/VV/root/1.txt @@ -0,0 +1 @@ +"/var/www/my-website/src/databases" \ No newline at end of file diff --git a/modules/snippet/snippets/docs/API/PHP/VV/root/2.php b/modules/snippet/snippets/docs/API/PHP/VV/root/2.php new file mode 100644 index 0000000..c5b8f90 --- /dev/null +++ b/modules/snippet/snippets/docs/API/PHP/VV/root/2.php @@ -0,0 +1,9 @@ +// File: /var/www/my-website/src/MyClass.php + + +

A normal Vegvisir page whch has access to MyClass

\ No newline at end of file diff --git a/modules/snippet/snippets/docs/API/PHP/VV/root/description.php b/modules/snippet/snippets/docs/API/PHP/VV/root/description.php new file mode 100644 index 0000000..6bf4ff6 --- /dev/null +++ b/modules/snippet/snippets/docs/API/PHP/VV/root/description.php @@ -0,0 +1,3 @@ +VV::root( + string $pathname = "" +): string \ No newline at end of file diff --git a/modules/snippet/snippets/docs/API/PHP/VV/shell/0.php b/modules/snippet/snippets/docs/API/PHP/VV/shell/0.php new file mode 100644 index 0000000..0df0de9 --- /dev/null +++ b/modules/snippet/snippets/docs/API/PHP/VV/shell/0.php @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/modules/snippet/snippets/docs/API/PHP/VV/shell/description.php b/modules/snippet/snippets/docs/API/PHP/VV/shell/description.php new file mode 100644 index 0000000..9d82be9 --- /dev/null +++ b/modules/snippet/snippets/docs/API/PHP/VV/shell/description.php @@ -0,0 +1,3 @@ +VV::shell( + string $pathname = "" +): never \ No newline at end of file diff --git a/modules/snippet/snippets/docs/API/PHP/VV/shell/example-0-0.php b/modules/snippet/snippets/docs/API/PHP/VV/shell/example-0-0.php new file mode 100644 index 0000000..091a064 --- /dev/null +++ b/modules/snippet/snippets/docs/API/PHP/VV/shell/example-0-0.php @@ -0,0 +1,4 @@ +// File: /var/www/my-website/public/some-page.php + +

Inner content

+ \ No newline at end of file diff --git a/modules/snippet/snippets/docs/API/PHP/VV/shell/example-0-1.php b/modules/snippet/snippets/docs/API/PHP/VV/shell/example-0-1.php new file mode 100644 index 0000000..9dad618 --- /dev/null +++ b/modules/snippet/snippets/docs/API/PHP/VV/shell/example-0-1.php @@ -0,0 +1,5 @@ +// File: /var/www/my-website/shells/some-shell.php + +

This paragraph will be above the wrapped content

+ +

This parahraph will be below the wrapped content

\ No newline at end of file diff --git a/modules/snippet/snippets/docs/installation/0.txt b/modules/snippet/snippets/docs/installation/0.txt new file mode 100644 index 0000000..6a68fe0 --- /dev/null +++ b/modules/snippet/snippets/docs/installation/0.txt @@ -0,0 +1 @@ +git clone https://codeberg.org/vegvisir/vegvisir.git --depth 1 \ No newline at end of file diff --git a/modules/snippet/snippets/docs/installation/1.txt b/modules/snippet/snippets/docs/installation/1.txt new file mode 100644 index 0000000..312037a --- /dev/null +++ b/modules/snippet/snippets/docs/installation/1.txt @@ -0,0 +1 @@ +composer install --optimize-autoloader \ No newline at end of file diff --git a/modules/snippet/snippets/docs/installation/2.txt b/modules/snippet/snippets/docs/installation/2.txt new file mode 100644 index 0000000..92a4de8 --- /dev/null +++ b/modules/snippet/snippets/docs/installation/2.txt @@ -0,0 +1,16 @@ +# You might need to alter this block to suit your NGINX configuration +# The important thing is that all requests should be routed to /public/index.php + +server { + listen 80; + server_name _; + + root /var/www/vegvisir/public; + + location / { + try_files /index.php =503; + + include snippets/fastcgi-php.conf; + fastcgi_pass unix:/run/php/php8.3-fpm.sock; + } +} \ No newline at end of file diff --git a/modules/snippet/snippets/docs/installation/3.txt b/modules/snippet/snippets/docs/installation/3.txt new file mode 100644 index 0000000..8b30c60 --- /dev/null +++ b/modules/snippet/snippets/docs/installation/3.txt @@ -0,0 +1 @@ +mkdir /var/www/my-website \ No newline at end of file diff --git a/modules/snippet/snippets/docs/installation/4.txt b/modules/snippet/snippets/docs/installation/4.txt new file mode 100644 index 0000000..038eaa1 --- /dev/null +++ b/modules/snippet/snippets/docs/installation/4.txt @@ -0,0 +1 @@ +cp -p /var/www/vegvisir/.env.example.ini /var/www/vegvisir/.env.ini \ No newline at end of file diff --git a/modules/snippet/snippets/docs/installation/5.txt b/modules/snippet/snippets/docs/installation/5.txt new file mode 100644 index 0000000..7c45f5b --- /dev/null +++ b/modules/snippet/snippets/docs/installation/5.txt @@ -0,0 +1,10 @@ +# /var/www/vegvisir/.env.ini + +; +--------------------+ +; | Base configuration | +; +--------------------+ + +; An absolute path to the root directory of your website +root_path = "/var/www/my-website" + +... \ No newline at end of file diff --git a/public/assets/css/document.css b/public/assets/css/document.css index 27adae2..2b7b5c5 100644 --- a/public/assets/css/document.css +++ b/public/assets/css/document.css @@ -4,8 +4,12 @@ --color-deep: rgba(var(--primer-color-deep)); --color-light: rgba(var(--primer-color-light)); + --border-style-width: 3px; + --border-style: solid var(--border-style-width) rgba(var(--primer-color-deep), .1); + --padding: 10px; --running-size: 70px; + --max-width: 1400px; } /* # Cornerstones */ @@ -43,6 +47,12 @@ a { text-decoration-thickness: var(--underline-tickness); } +@media (hover: hover) { + :is(h1, h2, h3, p, li) > a:hover { + text-decoration-color: var(--color-deep); + } +} + h1 { font-size: 30px; color: var(--color-accent); @@ -53,7 +63,7 @@ h2 { } h3 { - font-size: 25px; + font-size: 18px; } /* ## Sections */ @@ -64,7 +74,9 @@ container { margin: auto; height: 100%; display: flex; - width: clamp(900px, 80vw, 1400px); + min-width: 900px; + width: clamp(900px, 100%, 80vw); + max-width: var(--max-width); align-items: center; gap: var(--padding); padding: var(--padding) 0; @@ -120,8 +132,8 @@ header { top: 0px; position: sticky; background-color: white; - height: calc(var(--running-size) + var(--border-width)); - border-bottom: solid var(--border-width) rgba(var(--primer-color-deep), .1); + height: calc(var(--running-size) + var(--border-style-width)); + border-bottom: var(--border-style); z-index: 1000; } @@ -144,7 +156,7 @@ header ul:last-child { } [vv-top-page="/help"] header a[href="/help"] button, -[vv-top-page="/docs"] header a[href="/docs"] button, +[vv-top-page^="/docs"] header a[href="/docs"] button, [vv-top-page="/demos"] header a[href="/demos"] button, [vv-top-page="/why"] header a[href="/why"] button { font-weight: bold; diff --git a/public/assets/css/shells/docs.css b/public/assets/css/shells/docs.css new file mode 100644 index 0000000..5510227 --- /dev/null +++ b/public/assets/css/shells/docs.css @@ -0,0 +1,200 @@ +[vv-shell-id="/"] { + display: grid; + min-height: calc(100svh - var(--running-size) - var(--border-style-width)); + grid-template-columns: 400px 1fr; + max-width: var(--max-width); + gap: calc(var(--padding) * 2); + margin: auto; +} + +[vv-shell-id="6ccb0465"] { + display: flex; + flex-direction: column; + gap: calc(var(--padding) * 2); + margin-top: calc(var(--padding) * 2); +} + +hr { + border: unset; + border-top: var(--border-style); +} + +/* # Aside */ + +aside { + height: 100%; + display: flex; + flex-direction: column; + padding: var(--padding) 0; + border-right: var(--border-style); +} + +aside button { + width: calc(100% - var(--padding)); + text-align: left; +} + +aside hr { + margin: var(--padding) 0; +} + +aside ul { + list-style: none; + padding-left: 0; +} + +aside ul ul { + padding-left: var(--padding); +} + +aside ul > p { + margin: var(--padding) 0; +} + +/* ---- */ + +aside .cc + ul { + display: none; +} + +aside .cc.php button { + background-color: rgba(122, 134, 184, .2); +} + +aside .cc.js button { + background-color: rgba(240, 219, 79, .3); +} + +[vv-page^="/docs/API/PHP"] aside .cc.php + ul, +[vv-page^="/docs/API/JS"] aside .cc.js + ul { + display: initial; +} + +/* # Collapsible */ + +details { + border: 1px solid #aaa; + border-radius: 4px; + padding: 0.5em 0.5em 0; +} + +summary { + margin: -0.5em -0.5em 0; + padding: 0.5em; + cursor: pointer; +} + +details[open] { + width: 100%; + padding: 0.5em; +} + +details[open] summary { + border-bottom: 1px solid #aaa; + margin-bottom: 0.5em; +} + +/* # Sections */ + +/* ## Inset */ + +section.inset { + padding-left: var(--padding); +} + +/* ## Markdown */ + +section.md container { + padding-top: 0; + flex-direction: column; + align-items: baseline; +} + +section.md :is(h1, h2, h3) { + cursor: pointer; +} + +section.md h1::before { + content: "#"; + opacity: 1; + padding: 0 10px; + margin-right: .5em; + color: var(--color-light); + background-color: var(--color-deep); +} + +section.md h2::before { + content: "#"; + opacity: 1; + margin-right: .5em; + color: var(--color-deep); +} + +/* ## Code inline */ + +:is(h1, h2, h3, a, p, quote) > code { + padding: 5px; + border-radius: 6px; + white-space: nowrap; + font-family: 'Courier New', monospace; + background-color: rgba(0, 0, 0, .05); +} + +code.tag::before { + content: "<"; +} + +code.tag::after { + content: ">"; +} + +/* ## Code block */ + +section.md pre { + width: 100%; + tab-size: 3; +} + +section.md pre code { + --copy-size: 37px; + --copy-inset: 5px; + --copy-border-size: 1px; + + position: relative; + padding-right: calc(var(--copy-size) + (var(--copy-inset) * 2) + var(--padding)); + border-radius: 6px; +} + +section.md pre code::after { + content: "📋"; + display: grid; + font-size: 20px; + cursor: pointer; + position: absolute; + border-radius: 4px; + align-items: center; + justify-items: center; + top: var(--copy-inset); + width: var(--copy-size); + right: var(--copy-inset); + height: var(--copy-size); + border: solid 1px rgba(255, 255, 255, .1); + background-color: rgba(255, 255, 255, .1); +} + +@media (hover: hover) { + section.md h1:hover::before { + background-color: black; + } + + section.md :is(h1, h2, h3):hover::after { + content: " <- click to copy link"; + font-size: .5em; + opacity: .5; + } + + section.md pre code:hover::after { + border: solid 1px rgba(255, 255, 255, .3); + background-color: rgba(255, 255, 255, .2); + } +} \ No newline at end of file diff --git a/public/assets/js/shells/docs.js b/public/assets/js/shells/docs.js new file mode 100644 index 0000000..e69de29 diff --git a/public/docs/API/JS/index.php b/public/docs/API/JS/index.php new file mode 100644 index 0000000..0df0de9 --- /dev/null +++ b/public/docs/API/JS/index.php @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/public/docs/API/PHP/VV/css.php b/public/docs/API/PHP/VV/css.php new file mode 100644 index 0000000..7139e5a --- /dev/null +++ b/public/docs/API/PHP/VV/css.php @@ -0,0 +1,83 @@ + + +
+ +

(Vegvisir 2, Vegvisir 3)

+

VV::css()

+

Import and minify a CSS file.

+

The syntax is identical to VV::js(), and VV::embed().

+
+
+
+ +

Description

+ +

VV::css() imports and minifies a CSS styleheet file and returns it as a string.

+
+
+ + +
+ +

Parameters

+
+
+
+ +

pathname

+

Path to a CSS stylesheet file to import relative from project root.

+
+ Example + +
+
+
+
+ +

relative

+

Path provided to pathname will be a relative when this parameter is true (default). Set to false to make path absolute.

+
+ Example + +
+
+
+ + +
+ +

Return values

+
+
+
+ +

string

+

A string containing minified CSS. Please note that linebreaks are preserved.

+

Will return an empty string if the path provided to pathname is not a valid CSS stylesheet file, or if it failed to import.

+
+ Example + +
+
+
+ + +
+ +

Examples

+
+
+
+ +

Basic usage

+

Let's take the following CSS stylesheet file and put it into a page.

+ + +

By using VV::css() inside a style, we've enabled this stylesheet for that specific page.

+
+
+ + + + + \ No newline at end of file diff --git a/public/docs/API/PHP/VV/embed.php b/public/docs/API/PHP/VV/embed.php new file mode 100644 index 0000000..8efca7f --- /dev/null +++ b/public/docs/API/PHP/VV/embed.php @@ -0,0 +1,72 @@ + + +
+ +

(Vegvisir 2, Vegvisir 3)

+

VV::embed()

+

Import and inline the contents of any file without executing code.

+

The syntax is identical to VV::js(), and VV::css().

+
+
+
+ +

Description

+ +

VV::embed() returns the contents of any file as a string.

+
+
+ + +
+ +

Parameters

+
+
+
+ +

pathname

+

Path to a file to embed relative from project root.

+
+
+
+ +

relative

+

Path provided to pathname will be a relative when this parameter is true (default). Set to false to make path absolute.

+
+
+ + +
+ +

Return values

+
+
+
+ +

string

+

A string containing the raw contents of the file. File encoding is preserved.

+

Will return an empty string if the path provided to pathname is not a valid file, or if it failed to import.

+
+
+ + +
+ +

Examples

+
+
+
+ +

Basic usage

+

Here is an example the embeds an SVG file directly on a page.

+

This can come in handy for small icons stored in a separate directory as an example.

+ + +

By using VV::css() inside a style, we've enabled this stylesheet for that specific page.

+
+
+ + + + + \ No newline at end of file diff --git a/public/docs/API/PHP/VV/include.php b/public/docs/API/PHP/VV/include.php new file mode 100644 index 0000000..b95e5e7 --- /dev/null +++ b/public/docs/API/PHP/VV/include.php @@ -0,0 +1,77 @@ + + +
+ +

(Vegvisir 2, Vegvisir 3)

+

VV::include()

+

Inline contents of one page inside another page.

+

The syntax and functionality is similar to VV::embed(), except it executes included code.

+
+
+
+ +

Description

+ +

VV::include() lets you put the contents of one page into another page.

+
+
+ + +
+ +

Parameters

+
+
+
+ +

pathname

+

Path to a PHP file to import and evaluate relative from project root.

+
+ Example + +
+
+
+
+ +

relative

+

Path provided to pathname will be a relative when this parameter is true (default). Set to false to make path absolute.

+
+ Example + +
+
+
+ + +
+ +

Return values

+
+
+
+ +

This method will return whatever the compiled output of the included PHP file will be.

+
+
+ + +
+ +

Examples

+
+
+
+ +

Basic usage

+

Let's take the following CSS stylesheet file and put it into a page.

+ + +

By using VV::css() inside a style, we've enabled this stylesheet for that specific page.

+
+
+ + + + + \ No newline at end of file diff --git a/public/docs/API/PHP/VV/index.php b/public/docs/API/PHP/VV/index.php new file mode 100644 index 0000000..112af80 --- /dev/null +++ b/public/docs/API/PHP/VV/index.php @@ -0,0 +1,15 @@ +
+ +

VV

+

The VV (two "V"'s, not a W) contains everything needed to interact with Vegvisir's PHP features.

+

The class can not be instanced since it only contains static methods.

+
+
+
+ +

Namespace

+

The VV class is accessible without a namespace from any PHP file within your project.

+

The class intentionally lacks a namespace to reduce the (all be it short) boilerplate code that would be required to import and use it on every page of your project.

+
+
+ \ No newline at end of file diff --git a/public/docs/API/PHP/VV/js.php b/public/docs/API/PHP/VV/js.php new file mode 100644 index 0000000..5dea272 --- /dev/null +++ b/public/docs/API/PHP/VV/js.php @@ -0,0 +1,83 @@ + + +
+ +

(Vegvisir 2, Vegvisir 3)

+

VV::js()

+

Import and minify a JavaScript file.

+

The syntax is identical to VV::css(), and VV::embed().

+
+
+
+ +

Description

+ +

VV::js() imports and minifies a JavaScript file and returns it as a string.

+
+
+ + +
+ +

Parameters

+
+
+
+ +

pathname

+

Path to a JavaScript file to import relative from project root.

+
+ Example + +
+
+
+
+ +

relative

+

Path provided to pathname will be a relative when this parameter is true (default). Set to false to make path absolute.

+
+ Example + +
+
+
+ + +
+ +

Return values

+
+
+
+ +

string

+

A string containing minified JavaScript. Please note that linebreaks are preserved.

+

Will return an empty string if the path provided to pathname is not a valid JavaScript file, or if it failed to import.

+
+ Example + +
+
+
+ + +
+ +

Examples

+
+
+
+ +

Basic usage

+

Let's take the following JavaScript file and put it into a page.

+ + +

By using VV::js() inside a script, we've enabled the code for that specific page.

+
+
+ + + + + \ No newline at end of file diff --git a/public/docs/API/PHP/VV/root.php b/public/docs/API/PHP/VV/root.php new file mode 100644 index 0000000..9294aed --- /dev/null +++ b/public/docs/API/PHP/VV/root.php @@ -0,0 +1,77 @@ + + +
+ +

(Vegvisir 3)

+

VV::root()

+

Return an absolute path to a file or folder relative from project root.

+
+
+
+ +

Description

+ +

Return an absolute path to a file or folder relative from project root. This method does not process the entity at the provided location in any way. It simply returns an absolute path to it, which can be used with other functions.

+
+
+ + +
+ +

Parameters

+
+
+
+ +

pathname

+

Path to a location relative from project root. This parameter is an empty string by default, which will return an absolute path to project root itself.

+
+ Example + +
+
+
+ + +
+ +

Return values

+
+
+
+ +

string

+

An absolute path to the relative location provided by pathname.

+
+ Example + +
+
+
+ + +
+ +

Examples

+
+
+
+ +

Basic usage

+

VV::root() doesn't do anything on its own other than "convert" a relative path into an absolute one.

+

This can come in really handy when importing other PHP classes within your project. Let's import a PHP class from one location in the project into a public page.

+
+
+
+ + +

Let's import and use this class on our page with VV::root().

+ + +
+
+ + + + + \ No newline at end of file diff --git a/public/docs/API/PHP/VV/shell.php b/public/docs/API/PHP/VV/shell.php new file mode 100644 index 0000000..a923a51 --- /dev/null +++ b/public/docs/API/PHP/VV/shell.php @@ -0,0 +1,75 @@ + + +
+ +

(Vegvisir 3)

+

VV::shell()

+

Wrap contents of a page within another page.

+

This method is similar to VV::include() except it lets you place persistent content around the included page.

+
+
+
+ +

Description

+ +

VV::shell() is a powerful method which lets you put the contents of one page into a vv-shell tag on another page.

+

Subsequent navigations to pages using the same shell will preserve the outer shell's state. The shell will not be fetched again.

+
+
+ + +
+ +

Parameters

+
+
+
+ +

pathname

+

Path to a PHP shell page relative from project root which the contents of the initiator page will be wrapped inside.

+
+ Example + +
+
+
+ + +
+ +

Return values

+
+
+
+ +

This method is buffered and will flush the buffer contents to stdout when the last shell has been imported.

+
+
+ + +
+ +

Examples

+
+
+
+ +

Basic usage

+

If we want the contents of page /public/some-page.php wrapped inside the contents of /shells/some-shell.php, we can do the following:

+ +

Place a VV::shell() snippet at the end of the page you wish to wrap.

+
+
+
+ +

Now let's add a vv-shell tag somewhere in our /shells/some-shell.php file.

+ +

The contents of /public/some-page.php will replace the inner contents of the vv-shell tag.

+

The shell file acts like any other Vegvisir page, which means you have access to all VV methods.

+
+
+ + + + + \ No newline at end of file diff --git a/public/docs/API/PHP/index.php b/public/docs/API/PHP/index.php new file mode 100644 index 0000000..84cd640 --- /dev/null +++ b/public/docs/API/PHP/index.php @@ -0,0 +1,26 @@ +
+ +

PHP Cheat Sheet

+

Vegvisir only has one class you need to worry about. The VV class contains everything needed to interact with Vegvisir functions from project pages.

+
+
+
+ +

Useful thoughts

+

Here are some one-liners to help remember what things do.

+
+
+
+ +

Difference between VV::include() and VV::shell()

+

VV::include() puts content inside another page.

+

VV::shell() puts a page inside other content.

+
+
+
+ +

Manual pages

+ +
+
+ \ No newline at end of file diff --git a/public/docs/API/index.php b/public/docs/API/index.php new file mode 100644 index 0000000..0df0de9 --- /dev/null +++ b/public/docs/API/index.php @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/public/docs/index.php b/public/docs/index.php new file mode 100644 index 0000000..4a37ffd --- /dev/null +++ b/public/docs/index.php @@ -0,0 +1,15 @@ +
+ +

Introduction

+

Vegvisir is a PHP and JavaScript web framework developed by Victor Westerlund as a hobby project.

+

This framework is not intended to replace the true-and-tested like Laravel, it would be interesting of course if it gained some users but my goal is to keep this project small and flexible.

+
+
+
+ +

Scope

+

This documentation only covers the new experimental version of Vegvisir, which is version 3.

+

The older versions of Vegvisir can be found here. They lack proper documentation and function a bit differently than Vegvisir 3 which has been largely rewritten from scratch. The main addition to version 3 are what I call "shells".

+
+
+ \ No newline at end of file diff --git a/public/docs/installation.php b/public/docs/installation.php new file mode 100644 index 0000000..3640e61 --- /dev/null +++ b/public/docs/installation.php @@ -0,0 +1,85 @@ + +
+ +

Installation

+

In this guide we will be installing Vegvisir on a Debian-based system with NGINX as the web server. The process should be similar for other configurations as well.

+

Please contact me if you need help

+
+
+
+ +

Prerequisites

+
    +
  • PHP 8.0 or newer (PHP 8.3 is recommended)
  • +
  • A web server (NGINX is used in this guide)
  • +
+
+
+
+ +

Step 1: Clone the repo

+

Let's start by cloning Vegvisir to a folder. The code for Vegvisir will be separate from the code for your project.

+ +

I have cloned this into the folder /var/www/vegvisir but you can put it wherever you want.

+
+
+
+ +

Step 2: Install dependencies

+

Vegvisir only has one dependency, let's cd into our folder and install it with Composer.

+ +
+
+
+ +

Step 3: Configure virtual host

+

We will be pointing a virtual host to the /public/index.php file from the Vegvisir root directory.

+

Since your project files will live in a different directory, this can be set-and-forget.

+ +
+
+
+ +

Step 4: Create project folder

+

We're almost done here. We want to create a separate folder which will hold our project files.

+

Let's create a folder /var/www/my-website as an example - you can put this wherever you want!

+ +
+
+
+ +

Step 5: Point Vegvisir to project folder

+

Now let's finish up by pointing Vegvisir to the folder we just created.

+

Make a copy of the .env.example.ini file from Vegvisir's root directory and place it in the same spot as .env.ini

+ +
+
+
+ +

There is only one line we need to change inside the .env.ini file we just created. It should be the top most variable called root_path.

+

Change the value of this variable to an absolute path to your project root folder. In our case it will be /var/www/my-website.

+ +
+
+
+ +

Done!

+

That's all there is to it. Restart your webserver if you haven't and navigate to your published website.

+

If everything worked correctly, you should see a default landing page with a summary.

+
+
+
+
+ +

Static assets

+

Vegvisir will automatically serve anything that isn't a .php file under /public in your project directory as a static asset. You can for example put your robots.txt file under /public/robots.txt and it will be returned as a text/plain document.

+

While this works fine for smaller assets, they still have to be passed through the PHP CGI. This process is a bit slower than serving assets with your web server directly - and might be a lot slower for larger files.

+

To fix this, let's add an optional location block to our NGINX configuration which will handle assets. The process should be similar for other web servers - contact me if you need help.

+
+
+
+ +

Let's add the following location block to our NGINX virtual host that we set up in Step X.

+
+
+ \ No newline at end of file diff --git a/public/index.php b/public/index.php index 2d35b59..08f3c00 100644 --- a/public/index.php +++ b/public/index.php @@ -13,7 +13,7 @@
-

hi

+

Freedom to CREATE

\ No newline at end of file diff --git a/public/why.php b/public/why.php index f0349d7..bc95501 100644 --- a/public/why.php +++ b/public/why.php @@ -9,9 +9,8 @@
-

Sorry, did I studder?

By loading what's needed and changing only what needs to change on a page, Vegvisir can compile a custom server-side rendered response body for each request depending on what the client already has loaded.

-

For example, why should the header on this page be loaded again when you navigate to another page on this site? Your browser has already fetched, compiled, and rendered everything needed to display it. And when you for example navigate to the documentation page, why should the documentation pages inner "shell" be replaced when you navigate the documentation pages?

+

For example, why should the header on this page be loaded again when you navigate to another page on this site? Your browser has already fetched, compiled, and rendered everything needed to display it. And when you navigate to the documentation page, why should the documentation page inner "shell" be replaced when you navigate the documentation pages?

Each Vegvisir navigation request contains a list of all loaded shells, which the Vegvisir back-end uses to determine what content should be returned depending on what the client has already loaded.

diff --git a/shells/docs.php b/shells/docs.php new file mode 100644 index 0000000..97802d0 --- /dev/null +++ b/shells/docs.php @@ -0,0 +1,17 @@ + + + + \ No newline at end of file