graphql_playground_rails 0.1.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.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: c5139f09aa47614172a7352f53b73310639d8462d29c86ba7eac4ad32bffb804
4
+ data.tar.gz: a07d4e03cb41a6fe165d6f4236a0335071bf9e31edc7d0ea1171fc68d26e06f7
5
+ SHA512:
6
+ metadata.gz: 05c8369a16351746c409dad58eceb37dd845c59c0ad64e25a394ab16776bfa88c5cb12308b9b63c58b0dbbeb7e40a82f39eb997312c17fafdd9841d60d9b38e7
7
+ data.tar.gz: 373f7eace910fe46be803a1066bd84bc865e0f0b5447af218036a47fc47a397ba11846f41b915670abf6028ed8728b337b3bcd3b1e4e5c1d7bf7876c3a8f9b2a
@@ -0,0 +1,20 @@
1
+ Copyright 2020 Gueorgui Tcherednitchenko
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,53 @@
1
+ # GraphqlPlaygroundRails
2
+
3
+ This is a Rails Engine that simply mounts the [GraphQL
4
+ Playground](https://github.com/prisma-labs/graphql-playground) inside your Rails
5
+ app.
6
+
7
+ There are several other gems doing the same thing, but somehow I haven't been
8
+ able to make any of them work in Rails 6.0.
9
+
10
+ ## Usage
11
+ Mount it in your Rails app by editing `config/routes.rb` as such:
12
+
13
+ ``` ruby
14
+ Rails.application.routes.draw do
15
+ # (...)
16
+ if Rails.env.development?
17
+ mount GraphqlPlaygroundRails::Engine, at: '/gql', graphql_path: '/graphql'
18
+ end
19
+ end
20
+ ```
21
+
22
+ You will be able to access the playground at `http://localhost:3000/gql` after
23
+ you restart your Rails server.
24
+
25
+ ## Installation
26
+ Add this line to your application's Gemfile:
27
+
28
+ ```ruby
29
+ gem 'graphql_playground_rails', github: 'gueorgui/graphql_playground_rails'
30
+ ```
31
+
32
+ And then execute:
33
+ ```bash
34
+ $ bundle
35
+ ```
36
+
37
+ Or install it yourself as:
38
+ ```bash
39
+ $ gem install graphql_playground_rails
40
+ ```
41
+
42
+ ## Acknowledgements
43
+ The structure of the engine has been inspired by
44
+ [graphiql-rails](https://github.com/rmosolgo/graphiql-rails), which mounts
45
+ [GraphiQL](https://github.com/graphql/graphiql) rather than GraphQL Playground.
46
+ The code to show the GraphQL Playground comes from the [graphql-playground
47
+ repository](https://github.com/prisma-labs/graphql-playground/blob/master/packages/graphql-playground-html/withAnimation.html).
48
+
49
+ ## Contributing
50
+ Pull requests are welcome.
51
+
52
+ ## License
53
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
@@ -0,0 +1,32 @@
1
+ begin
2
+ require 'bundler/setup'
3
+ rescue LoadError
4
+ puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
5
+ end
6
+
7
+ require 'rdoc/task'
8
+
9
+ RDoc::Task.new(:rdoc) do |rdoc|
10
+ rdoc.rdoc_dir = 'rdoc'
11
+ rdoc.title = 'GraphqlPlaygroundRails'
12
+ rdoc.options << '--line-numbers'
13
+ rdoc.rdoc_files.include('README.md')
14
+ rdoc.rdoc_files.include('lib/**/*.rb')
15
+ end
16
+
17
+ APP_RAKEFILE = File.expand_path("test/dummy/Rakefile", __dir__)
18
+ load 'rails/tasks/engine.rake'
19
+
20
+ load 'rails/tasks/statistics.rake'
21
+
22
+ require 'bundler/gem_tasks'
23
+
24
+ require 'rake/testtask'
25
+
26
+ Rake::TestTask.new(:test) do |t|
27
+ t.libs << 'test'
28
+ t.pattern = 'test/**/*_test.rb'
29
+ t.verbose = false
30
+ end
31
+
32
+ task default: :test
@@ -0,0 +1 @@
1
+ //= link_directory ../stylesheets/graphql_playground_rails .css
@@ -0,0 +1,15 @@
1
+ /*
2
+ * This is a manifest file that'll be compiled into application.css, which will include all the files
3
+ * listed below.
4
+ *
5
+ * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
6
+ * or any plugin's vendor/assets/stylesheets directory can be referenced here using a relative path.
7
+ *
8
+ * You're free to add application-wide styles to this file and they'll appear at the bottom of the
9
+ * compiled file so the styles you add here take precedence over styles defined in any other CSS/SCSS
10
+ * files in this directory. Styles in this file should be added after the last require_* statement.
11
+ * It is generally better to create a new file per style scope.
12
+ *
13
+ *= require_tree .
14
+ *= require_self
15
+ */
@@ -0,0 +1,4 @@
1
+ /*
2
+ Place all the styles related to the matching controller here.
3
+ They will automatically be included in application.css.
4
+ */
@@ -0,0 +1,5 @@
1
+ module GraphqlPlaygroundRails
2
+ class ApplicationController < ActionController::Base
3
+ protect_from_forgery with: :exception
4
+ end
5
+ end
@@ -0,0 +1,16 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_dependency 'graphql_playground_rails/application_controller'
4
+
5
+ module GraphqlPlaygroundRails
6
+ class PlaygroundController < ApplicationController
7
+ def show; end
8
+
9
+ helper_method :graphql_endpoint_path
10
+ def graphql_endpoint_path
11
+ params[:graphql_path] || raise(
12
+ %(You must include `graphql_path: "/my/endpoint"` when mounting GraphqlPlaygroundRails)
13
+ )
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,9 @@
1
+ module GraphqlPlaygroundRails
2
+ module ApplicationHelper
3
+ include ::Webpacker::Helper
4
+
5
+ def current_webpacker_instance
6
+ GraphqlPlaygroundRails.webpacker
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,4 @@
1
+ module GraphqlPlaygroundRails
2
+ module PlaygroundHelper
3
+ end
4
+ end
@@ -0,0 +1,11 @@
1
+ import React from 'react';
2
+ import ReactDOM from 'react-dom';
3
+ import { Provider } from 'react-redux';
4
+ import { Playground, store } from 'graphql-playground-react';
5
+
6
+ ReactDOM.render(
7
+ <Provider store={store}>
8
+ <Playground endpoint="http://localhost:3000/graphql" />
9
+ </Provider>,
10
+ document.querySelector('#root'),
11
+ );
@@ -0,0 +1,4 @@
1
+ module GraphqlPlaygroundRails
2
+ class ApplicationJob < ActiveJob::Base
3
+ end
4
+ end
@@ -0,0 +1,6 @@
1
+ module GraphqlPlaygroundRails
2
+ class ApplicationMailer < ActionMailer::Base
3
+ default from: 'from@example.com'
4
+ layout 'mailer'
5
+ end
6
+ end
@@ -0,0 +1,5 @@
1
+ module GraphqlPlaygroundRails
2
+ class ApplicationRecord < ActiveRecord::Base
3
+ self.abstract_class = true
4
+ end
5
+ end
@@ -0,0 +1,58 @@
1
+ <div id="loading-wrapper">
2
+ <svg class="logo" viewBox="0 0 128 128" xmlns:xlink="http://www.w3.org/1999/xlink">
3
+ <title>GraphQL Playground Logo</title>
4
+ <defs>
5
+ <linearGradient id="linearGradient-1" x1="4.86%" x2="96.21%" y1="0%" y2="99.66%">
6
+ <stop stop-color="#E00082" stop-opacity=".8" offset="0%"></stop>
7
+ <stop stop-color="#E00082" offset="100%"></stop>
8
+ </linearGradient>
9
+ </defs>
10
+ <g>
11
+ <rect id="Gradient" width="127.96" height="127.96" y="1" fill="url(#linearGradient-1)" rx="4"></rect>
12
+ <path id="Border" fill="#E00082" fill-rule="nonzero" d="M4.7 2.84c-1.58 0-2.86 1.28-2.86 2.85v116.57c0 1.57 1.28 2.84 2.85 2.84h116.57c1.57 0 2.84-1.26 2.84-2.83V5.67c0-1.55-1.26-2.83-2.83-2.83H4.67zM4.7 0h116.58c3.14 0 5.68 2.55 5.68 5.7v116.58c0 3.14-2.54 5.68-5.68 5.68H4.68c-3.13 0-5.68-2.54-5.68-5.68V5.68C-1 2.56 1.55 0 4.7 0z"></path>
13
+ <path class="bglIGM" x="64" y="28" fill="#fff" d="M64 36c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8" style="transform: translate(100px, 100px);"></path>
14
+ <path class="ksxRII" x="95.98500061035156" y="46.510000228881836" fill="#fff" d="M89.04 50.52c-2.2-3.84-.9-8.73 2.94-10.96 3.83-2.2 8.72-.9 10.95 2.94 2.2 3.84.9 8.73-2.94 10.96-3.85 2.2-8.76.9-10.97-2.94"
15
+ style="transform: translate(100px, 100px);"></path>
16
+ <path class="cWrBmb" x="95.97162628173828" y="83.4900016784668" fill="#fff" d="M102.9 87.5c-2.2 3.84-7.1 5.15-10.94 2.94-3.84-2.2-5.14-7.12-2.94-10.96 2.2-3.84 7.12-5.15 10.95-2.94 3.86 2.23 5.16 7.12 2.94 10.96"
17
+ style="transform: translate(100px, 100px);"></path>
18
+ <path class="Wnusb" x="64" y="101.97999572753906" fill="#fff" d="M64 110c-4.43 0-8-3.6-8-8.02 0-4.44 3.57-8.02 8-8.02s8 3.58 8 8.02c0 4.4-3.57 8.02-8 8.02"
19
+ style="transform: translate(100px, 100px);"></path>
20
+ <path class="bfPqf" x="32.03982162475586" y="83.4900016784668" fill="#fff" d="M25.1 87.5c-2.2-3.84-.9-8.73 2.93-10.96 3.83-2.2 8.72-.9 10.95 2.94 2.2 3.84.9 8.73-2.94 10.96-3.85 2.2-8.74.9-10.95-2.94"
21
+ style="transform: translate(100px, 100px);"></path>
22
+ <path class="edRCTN" x="32.033552169799805" y="46.510000228881836" fill="#fff" d="M38.96 50.52c-2.2 3.84-7.12 5.15-10.95 2.94-3.82-2.2-5.12-7.12-2.92-10.96 2.2-3.84 7.12-5.15 10.95-2.94 3.83 2.23 5.14 7.12 2.94 10.96"
23
+ style="transform: translate(100px, 100px);"></path>
24
+ <path class="iEGVWn" stroke="#fff" stroke-width="4" stroke-linecap="round" stroke-linejoin="round" d="M63.55 27.5l32.9 19-32.9-19z"></path>
25
+ <path class="bsocdx" stroke="#fff" stroke-width="4" stroke-linecap="round" stroke-linejoin="round" d="M96 46v38-38z"></path>
26
+ <path class="jAZXmP" stroke="#fff" stroke-width="4" stroke-linecap="round" stroke-linejoin="round" d="M96.45 84.5l-32.9 19 32.9-19z"></path>
27
+ <path class="hSeArx" stroke="#fff" stroke-width="4" stroke-linecap="round" stroke-linejoin="round" d="M64.45 103.5l-32.9-19 32.9 19z"></path>
28
+ <path class="bVgqGk" stroke="#fff" stroke-width="4" stroke-linecap="round" stroke-linejoin="round" d="M32 84V46v38z"></path>
29
+ <path class="hEFqBt" stroke="#fff" stroke-width="4" stroke-linecap="round" stroke-linejoin="round" d="M31.55 46.5l32.9-19-32.9 19z"></path>
30
+ <path class="dzEKCM" id="Triangle-Bottom" stroke="#fff" stroke-width="4" d="M30 84h70" stroke-linecap="round"></path>
31
+ <path class="DYnPx" id="Triangle-Left" stroke="#fff" stroke-width="4" d="M65 26L30 87" stroke-linecap="round"></path>
32
+ <path class="hjPEAQ" id="Triangle-Right" stroke="#fff" stroke-width="4" d="M98 87L63 26" stroke-linecap="round"></path>
33
+ </g>
34
+ </svg>
35
+ <div class="text">Loading
36
+ <span class="dGfHfc">GraphQL Playground</span>
37
+ </div>
38
+ </div>
39
+
40
+ <div id="root" />
41
+ <script type="text/javascript">
42
+ window.addEventListener('load', function (event) {
43
+
44
+ const loadingWrapper = document.getElementById('loading-wrapper');
45
+ loadingWrapper.classList.add('fadeOut');
46
+
47
+
48
+ const root = document.getElementById('root');
49
+ root.classList.add('playgroundIn');
50
+
51
+ GraphQLPlayground.init(root, {
52
+ "endpoint": "<%= graphql_endpoint_path %>",
53
+ "settings": {
54
+ "request.credentials": "include"
55
+ }
56
+ })
57
+ })
58
+ </script>
@@ -0,0 +1,486 @@
1
+ <!DOCTYPE html>
2
+
3
+ <html>
4
+
5
+ <head>
6
+ <meta charset=utf-8 />
7
+ <meta name="viewport" content="user-scalable=no, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, minimal-ui">
8
+ <title>GraphQL Playground</title>
9
+ <link rel="stylesheet" href="//cdn.jsdelivr.net/npm/graphql-playground-react/build/static/css/index.css" />
10
+ <link rel="shortcut icon" href="//cdn.jsdelivr.net/npm/graphql-playground-react/build/favicon.png" />
11
+ <script src="//cdn.jsdelivr.net/npm/graphql-playground-react/build/static/js/middleware.js"></script>
12
+
13
+ </head>
14
+
15
+ <body>
16
+ <style type="text/css">
17
+ html {
18
+ font-family: "Open Sans", sans-serif;
19
+ overflow: hidden;
20
+ }
21
+
22
+ body {
23
+ margin: 0;
24
+ background: #172a3a;
25
+ }
26
+
27
+ .playgroundIn {
28
+ -webkit-animation: playgroundIn 0.5s ease-out forwards;
29
+ animation: playgroundIn 0.5s ease-out forwards;
30
+ }
31
+
32
+ @-webkit-keyframes playgroundIn {
33
+ from {
34
+ opacity: 0;
35
+ -webkit-transform: translateY(10px);
36
+ -ms-transform: translateY(10px);
37
+ transform: translateY(10px);
38
+ }
39
+ to {
40
+ opacity: 1;
41
+ -webkit-transform: translateY(0);
42
+ -ms-transform: translateY(0);
43
+ transform: translateY(0);
44
+ }
45
+ }
46
+
47
+ @keyframes playgroundIn {
48
+ from {
49
+ opacity: 0;
50
+ -webkit-transform: translateY(10px);
51
+ -ms-transform: translateY(10px);
52
+ transform: translateY(10px);
53
+ }
54
+ to {
55
+ opacity: 1;
56
+ -webkit-transform: translateY(0);
57
+ -ms-transform: translateY(0);
58
+ transform: translateY(0);
59
+ }
60
+ }
61
+ </style>
62
+
63
+ <style type="text/css">
64
+ .fadeOut {
65
+ -webkit-animation: fadeOut 0.5s ease-out forwards;
66
+ animation: fadeOut 0.5s ease-out forwards;
67
+ }
68
+
69
+ @-webkit-keyframes fadeIn {
70
+ from {
71
+ opacity: 0;
72
+ -webkit-transform: translateY(-10px);
73
+ -ms-transform: translateY(-10px);
74
+ transform: translateY(-10px);
75
+ }
76
+ to {
77
+ opacity: 1;
78
+ -webkit-transform: translateY(0);
79
+ -ms-transform: translateY(0);
80
+ transform: translateY(0);
81
+ }
82
+ }
83
+
84
+ @keyframes fadeIn {
85
+ from {
86
+ opacity: 0;
87
+ -webkit-transform: translateY(-10px);
88
+ -ms-transform: translateY(-10px);
89
+ transform: translateY(-10px);
90
+ }
91
+ to {
92
+ opacity: 1;
93
+ -webkit-transform: translateY(0);
94
+ -ms-transform: translateY(0);
95
+ transform: translateY(0);
96
+ }
97
+ }
98
+
99
+ @-webkit-keyframes fadeOut {
100
+ from {
101
+ opacity: 1;
102
+ -webkit-transform: translateY(0);
103
+ -ms-transform: translateY(0);
104
+ transform: translateY(0);
105
+ }
106
+ to {
107
+ opacity: 0;
108
+ -webkit-transform: translateY(-10px);
109
+ -ms-transform: translateY(-10px);
110
+ transform: translateY(-10px);
111
+ }
112
+ }
113
+
114
+ @keyframes fadeOut {
115
+ from {
116
+ opacity: 1;
117
+ -webkit-transform: translateY(0);
118
+ -ms-transform: translateY(0);
119
+ transform: translateY(0);
120
+ }
121
+ to {
122
+ opacity: 0;
123
+ -webkit-transform: translateY(-10px);
124
+ -ms-transform: translateY(-10px);
125
+ transform: translateY(-10px);
126
+ }
127
+ }
128
+
129
+ @-webkit-keyframes appearIn {
130
+ from {
131
+ opacity: 0;
132
+ -webkit-transform: translateY(0px);
133
+ -ms-transform: translateY(0px);
134
+ transform: translateY(0px);
135
+ }
136
+ to {
137
+ opacity: 1;
138
+ -webkit-transform: translateY(0);
139
+ -ms-transform: translateY(0);
140
+ transform: translateY(0);
141
+ }
142
+ }
143
+
144
+ @keyframes appearIn {
145
+ from {
146
+ opacity: 0;
147
+ -webkit-transform: translateY(0px);
148
+ -ms-transform: translateY(0px);
149
+ transform: translateY(0px);
150
+ }
151
+ to {
152
+ opacity: 1;
153
+ -webkit-transform: translateY(0);
154
+ -ms-transform: translateY(0);
155
+ transform: translateY(0);
156
+ }
157
+ }
158
+
159
+ @-webkit-keyframes scaleIn {
160
+ from {
161
+ -webkit-transform: scale(0);
162
+ -ms-transform: scale(0);
163
+ transform: scale(0);
164
+ }
165
+ to {
166
+ -webkit-transform: scale(1);
167
+ -ms-transform: scale(1);
168
+ transform: scale(1);
169
+ }
170
+ }
171
+
172
+ @keyframes scaleIn {
173
+ from {
174
+ -webkit-transform: scale(0);
175
+ -ms-transform: scale(0);
176
+ transform: scale(0);
177
+ }
178
+ to {
179
+ -webkit-transform: scale(1);
180
+ -ms-transform: scale(1);
181
+ transform: scale(1);
182
+ }
183
+ }
184
+
185
+ @-webkit-keyframes innerDrawIn {
186
+ 0% {
187
+ stroke-dashoffset: 70;
188
+ }
189
+ 50% {
190
+ stroke-dashoffset: 140;
191
+ }
192
+ 100% {
193
+ stroke-dashoffset: 210;
194
+ }
195
+ }
196
+
197
+ @keyframes innerDrawIn {
198
+ 0% {
199
+ stroke-dashoffset: 70;
200
+ }
201
+ 50% {
202
+ stroke-dashoffset: 140;
203
+ }
204
+ 100% {
205
+ stroke-dashoffset: 210;
206
+ }
207
+ }
208
+
209
+ @-webkit-keyframes outerDrawIn {
210
+ 0% {
211
+ stroke-dashoffset: 76;
212
+ }
213
+ 100% {
214
+ stroke-dashoffset: 152;
215
+ }
216
+ }
217
+
218
+ @keyframes outerDrawIn {
219
+ 0% {
220
+ stroke-dashoffset: 76;
221
+ }
222
+ 100% {
223
+ stroke-dashoffset: 152;
224
+ }
225
+ }
226
+
227
+ .hHWjkv {
228
+ -webkit-transform-origin: 0px 0px;
229
+ -ms-transform-origin: 0px 0px;
230
+ transform-origin: 0px 0px;
231
+ -webkit-transform: scale(0);
232
+ -ms-transform: scale(0);
233
+ transform: scale(0);
234
+ -webkit-animation: scaleIn 0.25s linear forwards 0.2222222222222222s;
235
+ animation: scaleIn 0.25s linear forwards 0.2222222222222222s;
236
+ }
237
+
238
+ .gCDOzd {
239
+ -webkit-transform-origin: 0px 0px;
240
+ -ms-transform-origin: 0px 0px;
241
+ transform-origin: 0px 0px;
242
+ -webkit-transform: scale(0);
243
+ -ms-transform: scale(0);
244
+ transform: scale(0);
245
+ -webkit-animation: scaleIn 0.25s linear forwards 0.4222222222222222s;
246
+ animation: scaleIn 0.25s linear forwards 0.4222222222222222s;
247
+ }
248
+
249
+ .hmCcxi {
250
+ -webkit-transform-origin: 0px 0px;
251
+ -ms-transform-origin: 0px 0px;
252
+ transform-origin: 0px 0px;
253
+ -webkit-transform: scale(0);
254
+ -ms-transform: scale(0);
255
+ transform: scale(0);
256
+ -webkit-animation: scaleIn 0.25s linear forwards 0.6222222222222222s;
257
+ animation: scaleIn 0.25s linear forwards 0.6222222222222222s;
258
+ }
259
+
260
+ .eHamQi {
261
+ -webkit-transform-origin: 0px 0px;
262
+ -ms-transform-origin: 0px 0px;
263
+ transform-origin: 0px 0px;
264
+ -webkit-transform: scale(0);
265
+ -ms-transform: scale(0);
266
+ transform: scale(0);
267
+ -webkit-animation: scaleIn 0.25s linear forwards 0.8222222222222223s;
268
+ animation: scaleIn 0.25s linear forwards 0.8222222222222223s;
269
+ }
270
+
271
+ .byhgGu {
272
+ -webkit-transform-origin: 0px 0px;
273
+ -ms-transform-origin: 0px 0px;
274
+ transform-origin: 0px 0px;
275
+ -webkit-transform: scale(0);
276
+ -ms-transform: scale(0);
277
+ transform: scale(0);
278
+ -webkit-animation: scaleIn 0.25s linear forwards 1.0222222222222221s;
279
+ animation: scaleIn 0.25s linear forwards 1.0222222222222221s;
280
+ }
281
+
282
+ .llAKP {
283
+ -webkit-transform-origin: 0px 0px;
284
+ -ms-transform-origin: 0px 0px;
285
+ transform-origin: 0px 0px;
286
+ -webkit-transform: scale(0);
287
+ -ms-transform: scale(0);
288
+ transform: scale(0);
289
+ -webkit-animation: scaleIn 0.25s linear forwards 1.2222222222222223s;
290
+ animation: scaleIn 0.25s linear forwards 1.2222222222222223s;
291
+ }
292
+
293
+ .bglIGM {
294
+ -webkit-transform-origin: 64px 28px;
295
+ -ms-transform-origin: 64px 28px;
296
+ transform-origin: 64px 28px;
297
+ -webkit-transform: scale(0);
298
+ -ms-transform: scale(0);
299
+ transform: scale(0);
300
+ -webkit-animation: scaleIn 0.25s linear forwards 0.2222222222222222s;
301
+ animation: scaleIn 0.25s linear forwards 0.2222222222222222s;
302
+ }
303
+
304
+ .ksxRII {
305
+ -webkit-transform-origin: 95.98500061035156px 46.510000228881836px;
306
+ -ms-transform-origin: 95.98500061035156px 46.510000228881836px;
307
+ transform-origin: 95.98500061035156px 46.510000228881836px;
308
+ -webkit-transform: scale(0);
309
+ -ms-transform: scale(0);
310
+ transform: scale(0);
311
+ -webkit-animation: scaleIn 0.25s linear forwards 0.4222222222222222s;
312
+ animation: scaleIn 0.25s linear forwards 0.4222222222222222s;
313
+ }
314
+
315
+ .cWrBmb {
316
+ -webkit-transform-origin: 95.97162628173828px 83.4900016784668px;
317
+ -ms-transform-origin: 95.97162628173828px 83.4900016784668px;
318
+ transform-origin: 95.97162628173828px 83.4900016784668px;
319
+ -webkit-transform: scale(0);
320
+ -ms-transform: scale(0);
321
+ transform: scale(0);
322
+ -webkit-animation: scaleIn 0.25s linear forwards 0.6222222222222222s;
323
+ animation: scaleIn 0.25s linear forwards 0.6222222222222222s;
324
+ }
325
+
326
+ .Wnusb {
327
+ -webkit-transform-origin: 64px 101.97999572753906px;
328
+ -ms-transform-origin: 64px 101.97999572753906px;
329
+ transform-origin: 64px 101.97999572753906px;
330
+ -webkit-transform: scale(0);
331
+ -ms-transform: scale(0);
332
+ transform: scale(0);
333
+ -webkit-animation: scaleIn 0.25s linear forwards 0.8222222222222223s;
334
+ animation: scaleIn 0.25s linear forwards 0.8222222222222223s;
335
+ }
336
+
337
+ .bfPqf {
338
+ -webkit-transform-origin: 32.03982162475586px 83.4900016784668px;
339
+ -ms-transform-origin: 32.03982162475586px 83.4900016784668px;
340
+ transform-origin: 32.03982162475586px 83.4900016784668px;
341
+ -webkit-transform: scale(0);
342
+ -ms-transform: scale(0);
343
+ transform: scale(0);
344
+ -webkit-animation: scaleIn 0.25s linear forwards 1.0222222222222221s;
345
+ animation: scaleIn 0.25s linear forwards 1.0222222222222221s;
346
+ }
347
+
348
+ .edRCTN {
349
+ -webkit-transform-origin: 32.033552169799805px 46.510000228881836px;
350
+ -ms-transform-origin: 32.033552169799805px 46.510000228881836px;
351
+ transform-origin: 32.033552169799805px 46.510000228881836px;
352
+ -webkit-transform: scale(0);
353
+ -ms-transform: scale(0);
354
+ transform: scale(0);
355
+ -webkit-animation: scaleIn 0.25s linear forwards 1.2222222222222223s;
356
+ animation: scaleIn 0.25s linear forwards 1.2222222222222223s;
357
+ }
358
+
359
+ .iEGVWn {
360
+ opacity: 0;
361
+ stroke-dasharray: 76;
362
+ -webkit-animation: outerDrawIn 0.5s ease-out forwards 0.3333333333333333s, appearIn 0.1s ease-out forwards 0.3333333333333333s;
363
+ animation: outerDrawIn 0.5s ease-out forwards 0.3333333333333333s, appearIn 0.1s ease-out forwards 0.3333333333333333s;
364
+ -webkit-animation-iteration-count: 1, 1;
365
+ animation-iteration-count: 1, 1;
366
+ }
367
+
368
+ .bsocdx {
369
+ opacity: 0;
370
+ stroke-dasharray: 76;
371
+ -webkit-animation: outerDrawIn 0.5s ease-out forwards 0.5333333333333333s, appearIn 0.1s ease-out forwards 0.5333333333333333s;
372
+ animation: outerDrawIn 0.5s ease-out forwards 0.5333333333333333s, appearIn 0.1s ease-out forwards 0.5333333333333333s;
373
+ -webkit-animation-iteration-count: 1, 1;
374
+ animation-iteration-count: 1, 1;
375
+ }
376
+
377
+ .jAZXmP {
378
+ opacity: 0;
379
+ stroke-dasharray: 76;
380
+ -webkit-animation: outerDrawIn 0.5s ease-out forwards 0.7333333333333334s, appearIn 0.1s ease-out forwards 0.7333333333333334s;
381
+ animation: outerDrawIn 0.5s ease-out forwards 0.7333333333333334s, appearIn 0.1s ease-out forwards 0.7333333333333334s;
382
+ -webkit-animation-iteration-count: 1, 1;
383
+ animation-iteration-count: 1, 1;
384
+ }
385
+
386
+ .hSeArx {
387
+ opacity: 0;
388
+ stroke-dasharray: 76;
389
+ -webkit-animation: outerDrawIn 0.5s ease-out forwards 0.9333333333333333s, appearIn 0.1s ease-out forwards 0.9333333333333333s;
390
+ animation: outerDrawIn 0.5s ease-out forwards 0.9333333333333333s, appearIn 0.1s ease-out forwards 0.9333333333333333s;
391
+ -webkit-animation-iteration-count: 1, 1;
392
+ animation-iteration-count: 1, 1;
393
+ }
394
+
395
+ .bVgqGk {
396
+ opacity: 0;
397
+ stroke-dasharray: 76;
398
+ -webkit-animation: outerDrawIn 0.5s ease-out forwards 1.1333333333333333s, appearIn 0.1s ease-out forwards 1.1333333333333333s;
399
+ animation: outerDrawIn 0.5s ease-out forwards 1.1333333333333333s, appearIn 0.1s ease-out forwards 1.1333333333333333s;
400
+ -webkit-animation-iteration-count: 1, 1;
401
+ animation-iteration-count: 1, 1;
402
+ }
403
+
404
+ .hEFqBt {
405
+ opacity: 0;
406
+ stroke-dasharray: 76;
407
+ -webkit-animation: outerDrawIn 0.5s ease-out forwards 1.3333333333333333s, appearIn 0.1s ease-out forwards 1.3333333333333333s;
408
+ animation: outerDrawIn 0.5s ease-out forwards 1.3333333333333333s, appearIn 0.1s ease-out forwards 1.3333333333333333s;
409
+ -webkit-animation-iteration-count: 1, 1;
410
+ animation-iteration-count: 1, 1;
411
+ }
412
+
413
+ .dzEKCM {
414
+ opacity: 0;
415
+ stroke-dasharray: 70;
416
+ -webkit-animation: innerDrawIn 1s ease-in-out forwards 1.3666666666666667s, appearIn 0.1s linear forwards 1.3666666666666667s;
417
+ animation: innerDrawIn 1s ease-in-out forwards 1.3666666666666667s, appearIn 0.1s linear forwards 1.3666666666666667s;
418
+ -webkit-animation-iteration-count: infinite, 1;
419
+ animation-iteration-count: infinite, 1;
420
+ }
421
+
422
+ .DYnPx {
423
+ opacity: 0;
424
+ stroke-dasharray: 70;
425
+ -webkit-animation: innerDrawIn 1s ease-in-out forwards 1.5333333333333332s, appearIn 0.1s linear forwards 1.5333333333333332s;
426
+ animation: innerDrawIn 1s ease-in-out forwards 1.5333333333333332s, appearIn 0.1s linear forwards 1.5333333333333332s;
427
+ -webkit-animation-iteration-count: infinite, 1;
428
+ animation-iteration-count: infinite, 1;
429
+ }
430
+
431
+ .hjPEAQ {
432
+ opacity: 0;
433
+ stroke-dasharray: 70;
434
+ -webkit-animation: innerDrawIn 1s ease-in-out forwards 1.7000000000000002s, appearIn 0.1s linear forwards 1.7000000000000002s;
435
+ animation: innerDrawIn 1s ease-in-out forwards 1.7000000000000002s, appearIn 0.1s linear forwards 1.7000000000000002s;
436
+ -webkit-animation-iteration-count: infinite, 1;
437
+ animation-iteration-count: infinite, 1;
438
+ }
439
+
440
+ #loading-wrapper {
441
+ position: absolute;
442
+ width: 100vw;
443
+ height: 100vh;
444
+ display: -webkit-box;
445
+ display: -webkit-flex;
446
+ display: -ms-flexbox;
447
+ display: flex;
448
+ -webkit-align-items: center;
449
+ -webkit-box-align: center;
450
+ -ms-flex-align: center;
451
+ align-items: center;
452
+ -webkit-box-pack: center;
453
+ -webkit-justify-content: center;
454
+ -ms-flex-pack: center;
455
+ justify-content: center;
456
+ -webkit-flex-direction: column;
457
+ -ms-flex-direction: column;
458
+ flex-direction: column;
459
+ }
460
+
461
+ .logo {
462
+ width: 75px;
463
+ height: 75px;
464
+ margin-bottom: 20px;
465
+ opacity: 0;
466
+ -webkit-animation: fadeIn 0.5s ease-out forwards;
467
+ animation: fadeIn 0.5s ease-out forwards;
468
+ }
469
+
470
+ .text {
471
+ font-size: 32px;
472
+ font-weight: 200;
473
+ text-align: center;
474
+ color: rgba(255, 255, 255, 0.6);
475
+ opacity: 0;
476
+ -webkit-animation: fadeIn 0.5s ease-out forwards;
477
+ animation: fadeIn 0.5s ease-out forwards;
478
+ }
479
+
480
+ .dGfHfc {
481
+ font-weight: 400;
482
+ }
483
+ </style>
484
+ <%= yield %>
485
+ </body>
486
+ </html>
@@ -0,0 +1,3 @@
1
+ GraphqlPlaygroundRails::Engine.routes.draw do
2
+ root 'playground#show'
3
+ end
@@ -0,0 +1,14 @@
1
+ require 'graphql_playground_rails/engine'
2
+
3
+ module GraphqlPlaygroundRails
4
+ ROOT_PATH = Pathname.new(File.join(__dir__, '..'))
5
+
6
+ class << self
7
+ def webpacker
8
+ @webpacker ||= ::Webpacker::Instance.new(
9
+ root_path: ROOT_PATH,
10
+ config_path: ROOT_PATH.join('config/webpacker.yml')
11
+ )
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,28 @@
1
+ module GraphqlPlaygroundRails
2
+ class Engine < ::Rails::Engine
3
+ isolate_namespace GraphqlPlaygroundRails
4
+
5
+ initializer 'webpacker.proxy' do |app|
6
+ insert_middleware = begin
7
+ GraphqlPlaygroundRails.webpacker.config.dev_server.present?
8
+ rescue
9
+ nil
10
+ end
11
+ next unless insert_middleware
12
+
13
+ app.middleware.insert_before(
14
+ 0, Webpacker::DevServerProxy,
15
+ ssl_verify_none: true,
16
+ webpacker: GraphqlPlaygroundRails.webpacker
17
+ )
18
+ end
19
+
20
+ root_dir = File.dirname(__dir__)
21
+ public_dir = File.join(root_dir, 'public')
22
+ puts "Mounting middleware at root = #{public_dir}"
23
+ config.app_middleware.use(
24
+ Rack::Static,
25
+ urls: ['/playground'], root: public_dir
26
+ )
27
+ end
28
+ end
@@ -0,0 +1,3 @@
1
+ module GraphqlPlaygroundRails
2
+ VERSION = '0.1.0'.freeze
3
+ end
@@ -0,0 +1,59 @@
1
+ # frozen_string_literal: true
2
+
3
+ def ensure_log_goes_to_stdout
4
+ old_logger = Webpacker.logger
5
+ Webpacker.logger = ActiveSupport::Logger.new(STDOUT)
6
+ yield
7
+ ensure
8
+ Webpacker.logger = old_logger
9
+ end
10
+
11
+ namespace :graphql_playground_rails do
12
+ namespace :webpacker do
13
+ desc 'Install dependencies with Yarn'
14
+ task :yarn_install do
15
+ Dir.chdir(File.join(__dir__, '../..')) do
16
+ system 'yarn install --no-progress --production'
17
+ end
18
+ end
19
+
20
+ desc 'Compile JavaScript packs for production with digests, using Webpack'
21
+ task compile: %i[yarn_install environment] do
22
+ Webpacker.with_node_env('production') do
23
+ ensure_log_goes_to_stdout do
24
+ if GraphqlPlaygroundRails.webpacker.commands.compile
25
+ # Success!
26
+ else
27
+ exit!
28
+ end
29
+ end
30
+ end
31
+ end
32
+ end
33
+ end
34
+
35
+ def yarn_install_available?
36
+ rails_major = Rails::VERSION::MAJOR
37
+ rails_minor = Rails::VERSION::MINOR
38
+
39
+ rails_major > 5 || (rails_major == 5 && rails_minor >= 1)
40
+ end
41
+
42
+ def enhance_assets_precompile
43
+ deps = yarn_install_available? ? [] : ['graphql_playground_rails:webpacker:yarn_install']
44
+ Rake::Task['assets:precompile'].enhance(deps) do
45
+ Rake::Task['graphql_playsground_rails:webpacker:compile'].invoke
46
+ end
47
+ end
48
+
49
+ # Compile packs after we've compiled all other assets during precompilation
50
+ skip_webpacker_precompile = %w[no false n f].include?(ENV['WEBPACKER_PRECOMPILE'])
51
+
52
+ unless skip_webpacker_precompile
53
+ if Rake::Task.task_defined?('assets:precompile')
54
+ enhance_assets_precompile
55
+ else
56
+ Rake::Task.define_task('assets:precompile' =>
57
+ 'graphql_playsground_rails:webpacker:compile')
58
+ end
59
+ end
metadata ADDED
@@ -0,0 +1,85 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: graphql_playground_rails
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Gueorgui Tcherednitchenko
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2020-01-28 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rails
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: 6.0.0
20
+ - - "~>"
21
+ - !ruby/object:Gem::Version
22
+ version: 6.0.0
23
+ type: :runtime
24
+ prerelease: false
25
+ version_requirements: !ruby/object:Gem::Requirement
26
+ requirements:
27
+ - - ">="
28
+ - !ruby/object:Gem::Version
29
+ version: 6.0.0
30
+ - - "~>"
31
+ - !ruby/object:Gem::Version
32
+ version: 6.0.0
33
+ description: A Rails engine mounting GraphQL Playground, compatible with Rails 6
34
+ email:
35
+ - gt@gueorgui.net
36
+ executables: []
37
+ extensions: []
38
+ extra_rdoc_files: []
39
+ files:
40
+ - MIT-LICENSE
41
+ - README.md
42
+ - Rakefile
43
+ - app/assets/config/graphql_playground_rails_manifest.js
44
+ - app/assets/stylesheets/graphql_playground_rails/application.css
45
+ - app/assets/stylesheets/graphql_playground_rails/playground.css
46
+ - app/controllers/graphql_playground_rails/application_controller.rb
47
+ - app/controllers/graphql_playground_rails/playground_controller.rb
48
+ - app/helpers/graphql_playground_rails/application_helper.rb
49
+ - app/helpers/graphql_playground_rails/playground_helper.rb
50
+ - app/javascript/packs/index.js
51
+ - app/jobs/graphql_playground_rails/application_job.rb
52
+ - app/mailers/graphql_playground_rails/application_mailer.rb
53
+ - app/models/graphql_playground_rails/application_record.rb
54
+ - app/views/graphql_playground_rails/playground/show.html.erb
55
+ - app/views/layouts/graphql_playground_rails/application.html.erb
56
+ - config/routes.rb
57
+ - lib/graphql_playground_rails.rb
58
+ - lib/graphql_playground_rails/engine.rb
59
+ - lib/graphql_playground_rails/version.rb
60
+ - lib/tasks/graphql_playground_rails_tasks.rake
61
+ homepage: https://github.com/gueorgui/graphql_playground_rails
62
+ licenses:
63
+ - MIT
64
+ metadata:
65
+ allowed_push_host: https://rubygems.org
66
+ post_install_message:
67
+ rdoc_options: []
68
+ require_paths:
69
+ - lib
70
+ required_ruby_version: !ruby/object:Gem::Requirement
71
+ requirements:
72
+ - - ">="
73
+ - !ruby/object:Gem::Version
74
+ version: '0'
75
+ required_rubygems_version: !ruby/object:Gem::Requirement
76
+ requirements:
77
+ - - ">="
78
+ - !ruby/object:Gem::Version
79
+ version: '0'
80
+ requirements: []
81
+ rubygems_version: 3.0.3
82
+ signing_key:
83
+ specification_version: 4
84
+ summary: A Rails engine mounting GraphQL Playground
85
+ test_files: []