utopia-project 0.38.0 → 0.40.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data/lib/utopia/project/base.rb +4 -14
- data/lib/utopia/project/guides.rb +66 -0
- data/lib/utopia/project/import_map.rb +2 -0
- data/lib/utopia/project/sidebar.rb +6 -16
- data/lib/utopia/project/version.rb +1 -1
- data/pages/_page.xnode +1 -18
- data/pages/_usage.xnode +2 -2
- data/pages/guides/index.xnode +17 -8
- data/pages/guides/show.xnode +34 -1
- data/pages/releases/index.xnode +0 -1
- data/public/_static/application.js +24 -0
- data/public/_static/links.js +18 -16
- data/public/_static/sidebar.js +205 -133
- data/public/_static/site.css +34 -0
- data/readme.md +6 -4
- data/releases.md +6 -0
- data.tar.gz.sig +0 -0
- metadata +6 -77
- metadata.gz.sig +3 -1
- data/public/_components/jquery/jquery.js +0 -10716
- data/public/_components/jquery/jquery.min.js +0 -2
- data/public/_components/jquery/jquery.min.map +0 -1
- data/public/_components/jquery/jquery.slim.js +0 -8617
- data/public/_components/jquery/jquery.slim.min.js +0 -2
- data/public/_components/jquery/jquery.slim.min.map +0 -1
- data/public/_components/jquery-litebox/jquery.litebox.css +0 -23
- data/public/_components/jquery-litebox/jquery.litebox.gallery.css +0 -48
- data/public/_components/jquery-litebox/jquery.litebox.js +0 -30
- data/public/_components/jquery-syntax/base/jquery.syntax.brush.apache.css +0 -12
- data/public/_components/jquery-syntax/base/jquery.syntax.brush.applescript.css +0 -5
- data/public/_components/jquery-syntax/base/jquery.syntax.brush.assembly.css +0 -8
- data/public/_components/jquery-syntax/base/jquery.syntax.brush.bash-script.css +0 -4
- data/public/_components/jquery-syntax/base/jquery.syntax.brush.bash.css +0 -2
- data/public/_components/jquery-syntax/base/jquery.syntax.brush.clang.css +0 -6
- data/public/_components/jquery-syntax/base/jquery.syntax.brush.css.css +0 -14
- data/public/_components/jquery-syntax/base/jquery.syntax.brush.diff.css +0 -16
- data/public/_components/jquery-syntax/base/jquery.syntax.brush.html.css +0 -3
- data/public/_components/jquery-syntax/base/jquery.syntax.brush.ocaml.css +0 -3
- data/public/_components/jquery-syntax/base/jquery.syntax.brush.protobuf.css +0 -2
- data/public/_components/jquery-syntax/base/jquery.syntax.brush.python.css +0 -6
- data/public/_components/jquery-syntax/base/jquery.syntax.brush.ruby.css +0 -2
- data/public/_components/jquery-syntax/base/jquery.syntax.brush.xml.css +0 -35
- data/public/_components/jquery-syntax/base/jquery.syntax.core.css +0 -58
- data/public/_components/jquery-syntax/base/jquery.syntax.editor.css +0 -6
- data/public/_components/jquery-syntax/base/theme.js +0 -1
- data/public/_components/jquery-syntax/bright/jquery.syntax.core.css +0 -27
- data/public/_components/jquery-syntax/bright/theme.js +0 -1
- data/public/_components/jquery-syntax/jquery.syntax.brush.apache.js +0 -3
- data/public/_components/jquery-syntax/jquery.syntax.brush.applescript.js +0 -5
- data/public/_components/jquery-syntax/jquery.syntax.brush.assembly.js +0 -3
- data/public/_components/jquery-syntax/jquery.syntax.brush.bash-script.js +0 -4
- data/public/_components/jquery-syntax/jquery.syntax.brush.bash.js +0 -2
- data/public/_components/jquery-syntax/jquery.syntax.brush.basic.js +0 -5
- data/public/_components/jquery-syntax/jquery.syntax.brush.clang.js +0 -5
- data/public/_components/jquery-syntax/jquery.syntax.brush.csharp.js +0 -4
- data/public/_components/jquery-syntax/jquery.syntax.brush.css.js +0 -5
- data/public/_components/jquery-syntax/jquery.syntax.brush.diff.js +0 -2
- data/public/_components/jquery-syntax/jquery.syntax.brush.go.js +0 -3
- data/public/_components/jquery-syntax/jquery.syntax.brush.haskell.js +0 -3
- data/public/_components/jquery-syntax/jquery.syntax.brush.html.js +0 -4
- data/public/_components/jquery-syntax/jquery.syntax.brush.io.js +0 -3
- data/public/_components/jquery-syntax/jquery.syntax.brush.java.js +0 -4
- data/public/_components/jquery-syntax/jquery.syntax.brush.javascript.js +0 -3
- data/public/_components/jquery-syntax/jquery.syntax.brush.kai.js +0 -2
- data/public/_components/jquery-syntax/jquery.syntax.brush.lisp.js +0 -2
- data/public/_components/jquery-syntax/jquery.syntax.brush.lua.js +0 -3
- data/public/_components/jquery-syntax/jquery.syntax.brush.nginx.js +0 -2
- data/public/_components/jquery-syntax/jquery.syntax.brush.ocaml.js +0 -4
- data/public/_components/jquery-syntax/jquery.syntax.brush.ooc.js +0 -4
- data/public/_components/jquery-syntax/jquery.syntax.brush.pascal.js +0 -4
- data/public/_components/jquery-syntax/jquery.syntax.brush.perl5.js +0 -3
- data/public/_components/jquery-syntax/jquery.syntax.brush.php-script.js +0 -4
- data/public/_components/jquery-syntax/jquery.syntax.brush.php.js +0 -2
- data/public/_components/jquery-syntax/jquery.syntax.brush.plain.js +0 -2
- data/public/_components/jquery-syntax/jquery.syntax.brush.protobuf.js +0 -3
- data/public/_components/jquery-syntax/jquery.syntax.brush.python.js +0 -5
- data/public/_components/jquery-syntax/jquery.syntax.brush.ruby.js +0 -5
- data/public/_components/jquery-syntax/jquery.syntax.brush.scala.js +0 -4
- data/public/_components/jquery-syntax/jquery.syntax.brush.smalltalk.js +0 -2
- data/public/_components/jquery-syntax/jquery.syntax.brush.sql.js +0 -4
- data/public/_components/jquery-syntax/jquery.syntax.brush.super-collider.js +0 -3
- data/public/_components/jquery-syntax/jquery.syntax.brush.swift.js +0 -3
- data/public/_components/jquery-syntax/jquery.syntax.brush.xml.js +0 -4
- data/public/_components/jquery-syntax/jquery.syntax.brush.xrb.js +0 -2
- data/public/_components/jquery-syntax/jquery.syntax.brush.yaml.js +0 -2
- data/public/_components/jquery-syntax/jquery.syntax.cache.js +0 -7
- data/public/_components/jquery-syntax/jquery.syntax.core.js +0 -34
- data/public/_components/jquery-syntax/jquery.syntax.editor.js +0 -11
- data/public/_components/jquery-syntax/jquery.syntax.js +0 -8
- data/public/_components/jquery-syntax/jquery.syntax.min.js +0 -13
- data/public/_components/jquery-syntax/paper/jquery.syntax.core.css +0 -31
- data/public/_components/jquery-syntax/paper/theme.js +0 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 9857e236b8690b3e3c8ae113309fdf2af695222643cc998bcac8862c09232465
|
|
4
|
+
data.tar.gz: b8ccb22331616e6f1ff287c067bf22ace7148c7627a6be9209be9c86f928a87d
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: c9e2c1640bb841704474c7bf6e3bf1a077fa9eae05267fb45874ea5b07c2beefcdfd92011d152e55db42fff3a1b037611355ddcd94e9f43b6425049f765e4741
|
|
7
|
+
data.tar.gz: 21796bcb1f5844dce244d0421a92d86ee3e25a0bf8daa05e12e6c41103fbc0e64f6703f8de664e1ce1110509876f0073850e55980c95847a8c492959ec14da3c
|
checksums.yaml.gz.sig
CHANGED
|
Binary file
|
data/lib/utopia/project/base.rb
CHANGED
|
@@ -15,7 +15,7 @@ require "thread/local"
|
|
|
15
15
|
require_relative "document"
|
|
16
16
|
require_relative "releases_document"
|
|
17
17
|
|
|
18
|
-
require_relative "
|
|
18
|
+
require_relative "guides"
|
|
19
19
|
require_relative "linkify"
|
|
20
20
|
|
|
21
21
|
module Utopia
|
|
@@ -193,10 +193,8 @@ module Utopia
|
|
|
193
193
|
end
|
|
194
194
|
end
|
|
195
195
|
|
|
196
|
-
#
|
|
197
|
-
# @
|
|
198
|
-
# @parameter guide [Guide]
|
|
199
|
-
# @returns [Enumerator(Guide)] If no block given.
|
|
196
|
+
# Get the guides collection for this project.
|
|
197
|
+
# @returns [Guides]
|
|
200
198
|
#
|
|
201
199
|
# @example List guide titles
|
|
202
200
|
# base = Utopia::Project::Base.new
|
|
@@ -204,15 +202,7 @@ module Utopia
|
|
|
204
202
|
# puts guide.title
|
|
205
203
|
# end
|
|
206
204
|
def guides
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
@links.index("/guides").each do |link|
|
|
210
|
-
guide_path = File.join(@root, link.path)
|
|
211
|
-
|
|
212
|
-
next unless File.directory?(guide_path)
|
|
213
|
-
|
|
214
|
-
yield Guide.new(self, guide_path, link.info)
|
|
215
|
-
end
|
|
205
|
+
@guides ||= Guides.new(self, @links)
|
|
216
206
|
end
|
|
217
207
|
|
|
218
208
|
def readme_document
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# Released under the MIT License.
|
|
4
|
+
# Copyright, 2025, by Samuel Williams.
|
|
5
|
+
|
|
6
|
+
require_relative "guide"
|
|
7
|
+
|
|
8
|
+
module Utopia
|
|
9
|
+
module Project
|
|
10
|
+
# A collection of guides with navigation and lookup capabilities.
|
|
11
|
+
class Guides
|
|
12
|
+
include Enumerable
|
|
13
|
+
|
|
14
|
+
# Initialize the guides collection.
|
|
15
|
+
# @parameter base [Base] The base instance for the project.
|
|
16
|
+
# @parameter links [Object] The links index for finding guides.
|
|
17
|
+
def initialize(base, links)
|
|
18
|
+
@base = base
|
|
19
|
+
@links = links
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
# Iterate over all guides.
|
|
23
|
+
# @yields {|guide| ...} If a block is given.
|
|
24
|
+
# @parameter guide [Guide]
|
|
25
|
+
# @returns [Enumerator(Guide)] If no block is given.
|
|
26
|
+
def each(&block)
|
|
27
|
+
return to_enum(:each) unless block_given?
|
|
28
|
+
|
|
29
|
+
@links.index("/guides").each do |link|
|
|
30
|
+
guide_path = File.join(@base.root, link.path)
|
|
31
|
+
|
|
32
|
+
next unless File.directory?(guide_path)
|
|
33
|
+
|
|
34
|
+
yield Guide.new(@base, guide_path, link.info)
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
# Get all guides as a sorted array.
|
|
39
|
+
# @returns [Array(Guide)]
|
|
40
|
+
def to_a
|
|
41
|
+
@array ||= super.sort
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
# Find a guide by name.
|
|
45
|
+
# @parameter name [String] The guide name.
|
|
46
|
+
# @returns [Guide | Nil]
|
|
47
|
+
def [](name)
|
|
48
|
+
to_a.find { |guide| guide.name == name }
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
# Get the related guides (previous and next) for the given guide.
|
|
52
|
+
# @parameter guide [Guide] The current guide.
|
|
53
|
+
# @returns [Array(Guide | Nil, Guide | Nil)] A two-element array containing the previous and next guides.
|
|
54
|
+
def related(guide)
|
|
55
|
+
index = to_a.index { |g| g.name == guide.name }
|
|
56
|
+
return [nil, nil] unless index
|
|
57
|
+
|
|
58
|
+
previous_guide = index > 0 ? to_a[index - 1] : nil
|
|
59
|
+
next_guide = index < to_a.size - 1 ? to_a[index + 1] : nil
|
|
60
|
+
|
|
61
|
+
[previous_guide, next_guide]
|
|
62
|
+
end
|
|
63
|
+
end
|
|
64
|
+
end
|
|
65
|
+
end
|
|
66
|
+
|
|
@@ -90,24 +90,14 @@ module Utopia
|
|
|
90
90
|
private
|
|
91
91
|
|
|
92
92
|
def self.extract_headings_from_document(document)
|
|
93
|
-
|
|
94
|
-
return headings unless document&.root
|
|
93
|
+
return [] unless document&.root
|
|
95
94
|
|
|
96
|
-
document.root.
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
title = XRB::Markup.raw(fragment.to_html)
|
|
103
|
-
level = node.header_level
|
|
104
|
-
anchor = Markly::Renderer::HTML.anchor_for(fragment)
|
|
105
|
-
|
|
106
|
-
headings << Entry.new(title, level, anchor)
|
|
107
|
-
end
|
|
95
|
+
Markly::Renderer::Headings.extract(document.root, min_level: 2, max_level: 3).map do |heading|
|
|
96
|
+
fragment = heading.node.dup.extract_children
|
|
97
|
+
title = XRB::Markup.raw(fragment.to_html)
|
|
98
|
+
|
|
99
|
+
Entry.new(title, heading.level, heading.anchor)
|
|
108
100
|
end
|
|
109
|
-
|
|
110
|
-
headings
|
|
111
101
|
end
|
|
112
102
|
end
|
|
113
103
|
end
|
data/pages/_page.xnode
CHANGED
|
@@ -16,24 +16,7 @@
|
|
|
16
16
|
<link rel="stylesheet" href="/_static/site.css" type="text/css" media="screen" />
|
|
17
17
|
|
|
18
18
|
#{Utopia::Project::IMPORT_MAP.relative_to(request.env["REQUEST_PATH"]).to_html}
|
|
19
|
-
|
|
20
|
-
<script src="/_components/jquery/jquery.min.js"></script>
|
|
21
|
-
|
|
22
|
-
<script src="/_static/links.js"></script>
|
|
23
|
-
|
|
24
|
-
<script type="module">
|
|
25
|
-
// <![CDATA[
|
|
26
|
-
import {Syntax} from '@socketry/syntax';
|
|
27
|
-
document.addEventListener('DOMContentLoaded', async function() {
|
|
28
|
-
await Syntax.highlight();
|
|
29
|
-
});
|
|
30
|
-
|
|
31
|
-
import mermaid from 'mermaid';
|
|
32
|
-
const isDarkMode = window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches;
|
|
33
|
-
const theme = isDarkMode ? 'dark' : 'default';
|
|
34
|
-
mermaid.initialize({startOnLoad: true, theme: theme});
|
|
35
|
-
// ]]>
|
|
36
|
-
</script>
|
|
19
|
+
<script type="module" src="/_static/application.js"></script>
|
|
37
20
|
</head>
|
|
38
21
|
<body>
|
|
39
22
|
<content:header />
|
data/pages/_usage.xnode
CHANGED
data/pages/guides/index.xnode
CHANGED
|
@@ -1,16 +1,25 @@
|
|
|
1
1
|
<content:page>
|
|
2
|
-
<?r
|
|
3
|
-
base = self[:base]
|
|
4
|
-
?>
|
|
5
2
|
<content:heading>Guides</content:heading>
|
|
6
3
|
|
|
7
|
-
<
|
|
4
|
+
<section>
|
|
8
5
|
<?r
|
|
9
|
-
base =
|
|
6
|
+
base = self[:base]
|
|
10
7
|
|
|
11
|
-
base.guides do |guide|
|
|
12
|
-
|
|
8
|
+
base.guides.each do |guide|
|
|
9
|
+
?>
|
|
10
|
+
<section>
|
|
11
|
+
<h3><a href="#{guide.href}">#{guide.title}</a></h3>
|
|
12
|
+
|
|
13
|
+
<?r if description = guide.description ?>
|
|
14
|
+
#{Markup.raw description.to_html}
|
|
15
|
+
<?r elsif documentation = guide.documentation ?>
|
|
16
|
+
#{base.format(documentation.text, language: guide.documentation.language)}
|
|
17
|
+
<?r else ?>
|
|
18
|
+
<p>No description.</p>
|
|
19
|
+
<?r end ?>
|
|
20
|
+
</section>
|
|
21
|
+
<?r
|
|
13
22
|
end
|
|
14
23
|
?>
|
|
15
|
-
</
|
|
24
|
+
</section>
|
|
16
25
|
</content:page>
|
data/pages/guides/show.xnode
CHANGED
|
@@ -9,6 +9,24 @@
|
|
|
9
9
|
#{navigation.to_html}
|
|
10
10
|
</aside>
|
|
11
11
|
<div class="content">
|
|
12
|
+
<?r
|
|
13
|
+
previous_guide, next_guide = base.guides.related(guide)
|
|
14
|
+
|
|
15
|
+
if previous_guide or next_guide
|
|
16
|
+
?>
|
|
17
|
+
<nav class="top">
|
|
18
|
+
<?r if previous_guide
|
|
19
|
+
?><a href="#{previous_guide.href}" class="previous">← #{previous_guide.title}</a><?r
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
if next_guide
|
|
23
|
+
?><a href="#{next_guide.href}" class="next">#{next_guide.title} →</a><?r
|
|
24
|
+
end ?>
|
|
25
|
+
</nav>
|
|
26
|
+
<?r
|
|
27
|
+
end
|
|
28
|
+
?>
|
|
29
|
+
|
|
12
30
|
<content:heading>#{guide.title}</content:heading>
|
|
13
31
|
|
|
14
32
|
<?r
|
|
@@ -27,6 +45,21 @@
|
|
|
27
45
|
end
|
|
28
46
|
end
|
|
29
47
|
?>
|
|
48
|
+
|
|
49
|
+
<?r
|
|
50
|
+
if previous_guide or next_guide
|
|
51
|
+
?>
|
|
52
|
+
<nav class="bottom">
|
|
53
|
+
<?r if previous_guide
|
|
54
|
+
?><a href="#{previous_guide.href}" class="previous">← #{previous_guide.title}</a><?r
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
if next_guide
|
|
58
|
+
?><a href="#{next_guide.href}" class="next">#{next_guide.title} →</a><?r
|
|
59
|
+
end ?>
|
|
60
|
+
</nav>
|
|
61
|
+
<?r
|
|
62
|
+
end
|
|
63
|
+
?>
|
|
30
64
|
</div>
|
|
31
|
-
<script src="/_static/sidebar.js"></script>
|
|
32
65
|
</content:page>
|
data/pages/releases/index.xnode
CHANGED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Application Initialization
|
|
3
|
+
* Main entry point for client-side functionality
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
// Import dependencies:
|
|
7
|
+
import {Syntax} from '@socketry/syntax';
|
|
8
|
+
import mermaid from 'mermaid';
|
|
9
|
+
import {initializeSectionHeadingLinks} from './links.js';
|
|
10
|
+
import {SidebarNavigation} from './sidebar.js';
|
|
11
|
+
|
|
12
|
+
// Initialize Mermaid with theme detection:
|
|
13
|
+
const isDarkMode = window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches;
|
|
14
|
+
const theme = isDarkMode ? 'dark' : 'default';
|
|
15
|
+
mermaid.initialize({startOnLoad: true, theme: theme});
|
|
16
|
+
|
|
17
|
+
// Initialize section self-links:
|
|
18
|
+
initializeSectionHeadingLinks();
|
|
19
|
+
|
|
20
|
+
// Initialize sidebar navigation:
|
|
21
|
+
SidebarNavigation.initialize();
|
|
22
|
+
|
|
23
|
+
// Initialize syntax highlighting:
|
|
24
|
+
await Syntax.highlight();
|
data/public/_static/links.js
CHANGED
|
@@ -1,21 +1,23 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Section Heading Links
|
|
3
|
+
* Adds pilcrow (¶) self-links to section headings for easy linking
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
export function initializeSectionHeadingLinks() {
|
|
7
|
+
const sections = document.querySelectorAll('section[id]');
|
|
8
|
+
|
|
9
|
+
sections.forEach(element => {
|
|
10
|
+
const anchor = document.createElement('a');
|
|
8
11
|
|
|
12
|
+
anchor.appendChild(document.createTextNode("¶"));
|
|
9
13
|
anchor.href = "#" + element.id;
|
|
10
14
|
anchor.className = "self";
|
|
11
15
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
heading.appendChild(anchor);
|
|
16
|
+
const heading = element.firstChild;
|
|
17
|
+
if (heading) {
|
|
18
|
+
anchor.title = heading.innerText;
|
|
19
|
+
heading.appendChild(document.createTextNode(' '));
|
|
20
|
+
heading.appendChild(anchor);
|
|
21
|
+
}
|
|
20
22
|
});
|
|
21
|
-
}
|
|
23
|
+
}
|