graphql-docs 5.1.0 → 5.2.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
- data/.github/workflows/tests.yml +1 -1
- data/CHANGELOG.md +4 -0
- data/CONTRIBUTING.md +1 -1
- data/README.md +9 -0
- data/lib/graphql-docs/layouts/assets/_sass/_sidebar.scss +32 -0
- data/lib/graphql-docs/layouts/assets/images/search.svg +3 -0
- data/lib/graphql-docs/layouts/default.html +56 -1
- data/lib/graphql-docs/layouts/includes/sidebar.html +4 -0
- data/lib/graphql-docs/version.rb +1 -1
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cd0680cb4e1d09c704fe10170e4f48340b845a96ec6a91420a1b379cf7b217fd
|
4
|
+
data.tar.gz: dde6edd6ff1dc7c70eab9495cb7f27aacfa3e770815f8bd26c7ddbb71cc05793
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 71424bfe5ab2367fa0c1ac4721104dab9eda558b593293dbc46d6097bd01bfc1670a45adb4a75456f980ebb7f22eaf5b30485b3c2a2fb7b6cc7ee24e91d2bad6
|
7
|
+
data.tar.gz: a1ac5a15d011d9f750c15745a92e3d88a1035a729fd4a9486b159a7fa263e7a0226e3340fe262fa8624428a63d452c884ba60d262b7c51e33109b83cc3700d61
|
data/.github/workflows/tests.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -4,6 +4,10 @@ A concise overview of the public-facing changes to the gem from version to versi
|
|
4
4
|
|
5
5
|
## Unreleased
|
6
6
|
|
7
|
+
## v5.2.0 - 2025-02-09
|
8
|
+
|
9
|
+
- Add search filter to sidebar. Thanks @denisahearn!
|
10
|
+
|
7
11
|
## v5.1.0 - 2024-12-09
|
8
12
|
|
9
13
|
- List queries in the sidebar, similar to mutations. See https://github.com/brettchalupa/graphql-docs/pull/156. Thanks @denisahearn!
|
data/CONTRIBUTING.md
CHANGED
data/README.md
CHANGED
@@ -222,6 +222,15 @@ After checking out the repo, run `bin/setup` to install dependencies. Then, run
|
|
222
222
|
`bin/rake test` to run the tests. You can also run `bin/console` for
|
223
223
|
an interactive prompt that will allow you to experiment.
|
224
224
|
|
225
|
+
### Releasing a new version of the gem
|
226
|
+
|
227
|
+
1. Update CHANGELOG.md
|
228
|
+
2. Bump the version in `lib/graphql-docs/version.rb`
|
229
|
+
3. Make a commit and tag it with `git commit -a vX.X.X`
|
230
|
+
4. Push the commit and tags to GitHub: `git push origin main && git push --tags`
|
231
|
+
5. Build the gem: `gem build`
|
232
|
+
6. Push the gem to RubyGems.org: `gem push graphql-docs-X.X.X.gem`
|
233
|
+
|
225
234
|
## Sample Site
|
226
235
|
|
227
236
|
Clone this repository and run:
|
@@ -69,6 +69,38 @@
|
|
69
69
|
}
|
70
70
|
}
|
71
71
|
}
|
72
|
+
#search {
|
73
|
+
display: flex;
|
74
|
+
position: relative;
|
75
|
+
align-items: center;
|
76
|
+
border: 1px solid #ddd;
|
77
|
+
border-radius: 5px;
|
78
|
+
padding: 0.01em 16px;
|
79
|
+
margin-bottom: 20px;
|
80
|
+
|
81
|
+
img {
|
82
|
+
position: absolute;
|
83
|
+
left: 10px;
|
84
|
+
height: 16px;
|
85
|
+
width: 16px;
|
86
|
+
}
|
87
|
+
|
88
|
+
input {
|
89
|
+
height: 24px;
|
90
|
+
line-height: 1.5;
|
91
|
+
width: 100%;
|
92
|
+
padding-left: 15px;
|
93
|
+
background-color: transparent;
|
94
|
+
color: #444;
|
95
|
+
border: none;
|
96
|
+
font-size: 14px;
|
97
|
+
font-family: 'ProximaNova-Semibold';
|
98
|
+
}
|
99
|
+
|
100
|
+
input:focus {
|
101
|
+
outline: none;
|
102
|
+
}
|
103
|
+
}
|
72
104
|
}
|
73
105
|
|
74
106
|
#sidebar-mobile {
|
@@ -0,0 +1,3 @@
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
|
2
|
+
<path d="M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14" />
|
3
|
+
</svg>
|
@@ -9,16 +9,71 @@
|
|
9
9
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/anchor-js/3.2.2/anchor.min.js"></script>
|
10
10
|
<script>
|
11
11
|
|
12
|
-
// Add anchors on DOMContentLoaded
|
13
12
|
document.addEventListener("DOMContentLoaded", function(event) {
|
13
|
+
// Add anchors
|
14
14
|
anchors.options = {
|
15
15
|
placement: 'left',
|
16
16
|
visible: 'hover',
|
17
17
|
icon: '¶'
|
18
18
|
};
|
19
19
|
anchors.add('h2, h3, h4, h5, h6, .anchored');
|
20
|
+
|
21
|
+
// Add listener for search filter input
|
22
|
+
const sidebarDiv = document.getElementById('sidebar');
|
23
|
+
const searchDiv = sidebarDiv.querySelector('#search')
|
24
|
+
|
25
|
+
if (searchDiv) {
|
26
|
+
const searchInput = searchDiv.querySelector('input');
|
27
|
+
const menuElements = sidebarDiv.querySelectorAll('ul.menu-root');
|
28
|
+
|
29
|
+
const listener = debounce((event) => {
|
30
|
+
const searchValue = event.target.value;
|
31
|
+
applySearchFilter(searchValue, menuElements)
|
32
|
+
}, 500);
|
33
|
+
|
34
|
+
searchInput.addEventListener('input', listener);
|
35
|
+
}
|
20
36
|
});
|
21
37
|
|
38
|
+
function debounce(func, wait) {
|
39
|
+
let timeout;
|
40
|
+
|
41
|
+
return function executedFunction(...args) {
|
42
|
+
const later = () => {
|
43
|
+
clearTimeout(timeout);
|
44
|
+
func(...args);
|
45
|
+
};
|
46
|
+
|
47
|
+
clearTimeout(timeout);
|
48
|
+
timeout = setTimeout(later, wait);
|
49
|
+
};
|
50
|
+
}
|
51
|
+
|
52
|
+
function applySearchFilter(searchValue, menuElements) {
|
53
|
+
menuElements.forEach(menuElement => {
|
54
|
+
const listElements = menuElement.getElementsByTagName('li');
|
55
|
+
let hasVisibleElements = false;
|
56
|
+
Array.from(listElements).forEach(listElement => {
|
57
|
+
let contains = true
|
58
|
+
if (searchValue.length > 0) {
|
59
|
+
const anchorElement = listElement.querySelector('a');
|
60
|
+
const textContent = anchorElement.innerText;
|
61
|
+
contains = textContent.toLowerCase().includes(searchValue.toLowerCase());
|
62
|
+
}
|
63
|
+
|
64
|
+
// Hide the list element if its text does not contain the search value
|
65
|
+
listElement.style.display = contains ? '' : 'none';
|
66
|
+
|
67
|
+
if (contains) {
|
68
|
+
hasVisibleElements = true;
|
69
|
+
}
|
70
|
+
});
|
71
|
+
|
72
|
+
// Hide the entire menu if none of the list items are visible
|
73
|
+
const menuParentElement = menuElement.closest('li')
|
74
|
+
menuParentElement.style.display = hasVisibleElements ? '' : 'none';
|
75
|
+
});
|
76
|
+
}
|
22
77
|
</script>
|
23
78
|
</head>
|
24
79
|
<body>
|
data/lib/graphql-docs/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: graphql-docs
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 5.
|
4
|
+
version: 5.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brett Chalupa
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: exe
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2025-02-10 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: graphql
|
@@ -322,6 +322,7 @@ files:
|
|
322
322
|
- lib/graphql-docs/layouts/assets/images/graphiql.png
|
323
323
|
- lib/graphql-docs/layouts/assets/images/menu.png
|
324
324
|
- lib/graphql-docs/layouts/assets/images/navbar.png
|
325
|
+
- lib/graphql-docs/layouts/assets/images/search.svg
|
325
326
|
- lib/graphql-docs/layouts/assets/webfonts/2C4B9D_B_0.eot
|
326
327
|
- lib/graphql-docs/layouts/assets/webfonts/2C4B9D_B_0.ttf
|
327
328
|
- lib/graphql-docs/layouts/assets/webfonts/2C4B9D_B_0.woff
|
@@ -384,7 +385,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
384
385
|
- !ruby/object:Gem::Version
|
385
386
|
version: '0'
|
386
387
|
requirements: []
|
387
|
-
rubygems_version: 3.
|
388
|
+
rubygems_version: 3.3.27
|
388
389
|
signing_key:
|
389
390
|
specification_version: 4
|
390
391
|
summary: Easily generate beautiful documentation from your GraphQL schema.
|