showcase-rails 0.4.5 → 0.5.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/MIT-LICENSE +1 -1
- data/README.md +9 -2
- data/app/assets/builds/showcase.css +72 -50
- data/app/assets/builds/showcase.highlights.css +8 -0
- data/app/views/layouts/showcase.html.erb +17 -0
- data/app/views/showcase/engine/_root.html.erb +10 -3
- data/config/tailwind.config.js +1 -0
- data/lib/showcase/version.rb +1 -1
- metadata +5 -9
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 762f93c7afc1ffebdb446132710f91b8070d1dacf388752916195a18de572953
|
|
4
|
+
data.tar.gz: bc98f34767b38cc924aa19088a184d3a2919fe5ec23886dce3b4080cd3200498
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 326043beab9c4e250a882f889c2ae857ae0a0227cb21b416607a0337c85638e5e6ea4304b5b7e062258e9a56179416c08d482c32da31c2aff79884e496671a19
|
|
7
|
+
data.tar.gz: 34a4435d411b1d6a747efe95724f4458b8faa58bd4bf62a005228072682114a73faae29b5122c10bd643c1f23c757017af66a76479fd7c59a26f057b1c8476e3
|
data/MIT-LICENSE
CHANGED
data/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Showcase lets you build previews for your partials, components, view helpers, Stimulus controllers and more — Rails engines included!
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
You can see it in action on [https://bullettrain.co/docs/showcase](https://bullettrain.co/docs/showcase).
|
|
6
6
|
|
|
7
7
|
| Light Mode | Dark Mode |
|
|
8
8
|
| --- | --- |
|
|
@@ -12,6 +12,13 @@ Each sample shows the render time in milliseconds and the allocation count so it
|
|
|
12
12
|
|
|
13
13
|
## What can I showcase?
|
|
14
14
|
|
|
15
|
+
Add a partial in `app/views/showcase/previews` and it'll show up in Showcase's sidebar menu.
|
|
16
|
+
|
|
17
|
+
So `app/views/showcase/previews/_button.html.erb` will add top-level Button page. Directories are respected so a `app/views/showcase/previews/deeply/nested/_partial.html.erb` file will create Deeply > Nested > Partial in the sidebar.
|
|
18
|
+
|
|
19
|
+
Within each partial preview file, you get access to a `showcase` local variable.
|
|
20
|
+
Here's some examples of using it, and what you can showcase in your app or engine.
|
|
21
|
+
|
|
15
22
|
### Rails partials
|
|
16
23
|
|
|
17
24
|
Here's how to showcase a standard button component written with standard Rails partials:
|
|
@@ -393,7 +400,7 @@ partials, make sure to include `"showcase"` in your list of assets.
|
|
|
393
400
|
[showcase/engine/_stylesheets.html.erb]: app/views/showcase/engine/_stylesheets.html.erb
|
|
394
401
|
|
|
395
402
|
## Contributing
|
|
396
|
-
|
|
403
|
+
Please open issues and/or pull requests with any feedback, fixes, or potential features you'd like us to look at. Thank you!
|
|
397
404
|
|
|
398
405
|
## License
|
|
399
406
|
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
|
@@ -1,31 +1,3 @@
|
|
|
1
|
-
/*
|
|
2
|
-
! tailwindcss v3.2.7 | MIT License | https://tailwindcss.com
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
/*
|
|
6
|
-
1. Prevent padding and border from affecting element width. (https://github.com/mozdevs/cssremedy/issues/4)
|
|
7
|
-
2. Allow adding a border to an element by just adding a border-width. (https://github.com/tailwindcss/tailwindcss/pull/116)
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
* {
|
|
11
|
-
box-sizing: border-box;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
html {
|
|
15
|
-
line-height: 1.5;
|
|
16
|
-
font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
body {
|
|
20
|
-
margin: 0;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
pre {
|
|
24
|
-
margin: 0;
|
|
25
|
-
font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
|
|
26
|
-
font-size: 1em;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
1
|
*, ::before, ::after {
|
|
30
2
|
--tw-border-spacing-x: 0;
|
|
31
3
|
--tw-border-spacing-y: 0;
|
|
@@ -74,6 +46,10 @@ pre {
|
|
|
74
46
|
--tw-backdrop-opacity: ;
|
|
75
47
|
--tw-backdrop-saturate: ;
|
|
76
48
|
--tw-backdrop-sepia: ;
|
|
49
|
+
--tw-contain-size: ;
|
|
50
|
+
--tw-contain-layout: ;
|
|
51
|
+
--tw-contain-paint: ;
|
|
52
|
+
--tw-contain-style: ;
|
|
77
53
|
}
|
|
78
54
|
|
|
79
55
|
::backdrop {
|
|
@@ -124,6 +100,38 @@ pre {
|
|
|
124
100
|
--tw-backdrop-opacity: ;
|
|
125
101
|
--tw-backdrop-saturate: ;
|
|
126
102
|
--tw-backdrop-sepia: ;
|
|
103
|
+
--tw-contain-size: ;
|
|
104
|
+
--tw-contain-layout: ;
|
|
105
|
+
--tw-contain-paint: ;
|
|
106
|
+
--tw-contain-style: ;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
/*
|
|
110
|
+
! tailwindcss v3.2.7 | MIT License | https://tailwindcss.com
|
|
111
|
+
*/
|
|
112
|
+
|
|
113
|
+
/*
|
|
114
|
+
1. Prevent padding and border from affecting element width. (https://github.com/mozdevs/cssremedy/issues/4)
|
|
115
|
+
2. Allow adding a border to an element by just adding a border-width. (https://github.com/tailwindcss/tailwindcss/pull/116)
|
|
116
|
+
*/
|
|
117
|
+
|
|
118
|
+
* {
|
|
119
|
+
box-sizing: border-box;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
html {
|
|
123
|
+
line-height: 1.5;
|
|
124
|
+
font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
body {
|
|
128
|
+
margin: 0;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
pre {
|
|
132
|
+
margin: 0;
|
|
133
|
+
font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
|
|
134
|
+
font-size: 1em;
|
|
127
135
|
}
|
|
128
136
|
|
|
129
137
|
.sc-link {
|
|
@@ -191,6 +199,10 @@ pre {
|
|
|
191
199
|
display: list-item;
|
|
192
200
|
}
|
|
193
201
|
|
|
202
|
+
.sc-hidden {
|
|
203
|
+
display: none;
|
|
204
|
+
}
|
|
205
|
+
|
|
194
206
|
.sc-h-full {
|
|
195
207
|
height: 100%;
|
|
196
208
|
}
|
|
@@ -241,6 +253,10 @@ pre {
|
|
|
241
253
|
align-items: center;
|
|
242
254
|
}
|
|
243
255
|
|
|
256
|
+
.sc-items-baseline {
|
|
257
|
+
align-items: baseline;
|
|
258
|
+
}
|
|
259
|
+
|
|
244
260
|
.sc-justify-between {
|
|
245
261
|
justify-content: space-between;
|
|
246
262
|
}
|
|
@@ -479,33 +495,39 @@ pre {
|
|
|
479
495
|
background-color: rgb(238 242 255 / var(--tw-bg-opacity));
|
|
480
496
|
}
|
|
481
497
|
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
}
|
|
498
|
+
.dark\:sc-block:is(.sc-dark *) {
|
|
499
|
+
display: block;
|
|
500
|
+
}
|
|
486
501
|
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
}
|
|
502
|
+
.dark\:sc-hidden:is(.sc-dark *) {
|
|
503
|
+
display: none;
|
|
504
|
+
}
|
|
491
505
|
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
}
|
|
506
|
+
.dark\:sc-bg-neutral-700\/50:is(.sc-dark *) {
|
|
507
|
+
background-color: rgb(64 64 64 / 0.5);
|
|
508
|
+
}
|
|
496
509
|
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
510
|
+
.dark\:sc-bg-neutral-800:is(.sc-dark *) {
|
|
511
|
+
--tw-bg-opacity: 1;
|
|
512
|
+
background-color: rgb(38 38 38 / var(--tw-bg-opacity));
|
|
513
|
+
}
|
|
500
514
|
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
515
|
+
.dark\:sc-bg-neutral-900:is(.sc-dark *) {
|
|
516
|
+
--tw-bg-opacity: 1;
|
|
517
|
+
background-color: rgb(23 23 23 / var(--tw-bg-opacity));
|
|
518
|
+
}
|
|
505
519
|
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
520
|
+
.dark\:sc-text-inherit:is(.sc-dark *) {
|
|
521
|
+
color: inherit;
|
|
522
|
+
}
|
|
523
|
+
|
|
524
|
+
.dark\:sc-text-white:is(.sc-dark *) {
|
|
525
|
+
--tw-text-opacity: 1;
|
|
526
|
+
color: rgb(255 255 255 / var(--tw-text-opacity));
|
|
527
|
+
}
|
|
528
|
+
|
|
529
|
+
.dark\:hover\:sc-bg-neutral-700\/50:hover:is(.sc-dark *) {
|
|
530
|
+
background-color: rgb(64 64 64 / 0.5);
|
|
509
531
|
}
|
|
510
532
|
|
|
511
533
|
@media (min-width: 768px) {
|
|
@@ -39,6 +39,10 @@
|
|
|
39
39
|
color: #116329;
|
|
40
40
|
background-color: #dafbe1;
|
|
41
41
|
}
|
|
42
|
+
.sc-highlight .ges {
|
|
43
|
+
font-weight: bold;
|
|
44
|
+
font-style: italic;
|
|
45
|
+
}
|
|
42
46
|
.sc-highlight .kc {
|
|
43
47
|
color: #0550ae;
|
|
44
48
|
}
|
|
@@ -153,6 +157,10 @@
|
|
|
153
157
|
color: #aff5b4;
|
|
154
158
|
background-color: #033a16;
|
|
155
159
|
}
|
|
160
|
+
.sc-highlight .ges {
|
|
161
|
+
font-weight: bold;
|
|
162
|
+
font-style: italic;
|
|
163
|
+
}
|
|
156
164
|
.sc-highlight .kc {
|
|
157
165
|
color: #79c0ff;
|
|
158
166
|
}
|
|
@@ -4,6 +4,23 @@
|
|
|
4
4
|
<title>Showcase</title>
|
|
5
5
|
<meta name="viewport" content="width=device-width,initial-scale=1">
|
|
6
6
|
|
|
7
|
+
<script>
|
|
8
|
+
// We're setting this directly here to help prevent Flash of Unstyled Content (FOUC).
|
|
9
|
+
class Showcase {
|
|
10
|
+
static start() {
|
|
11
|
+
const preference = window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light"
|
|
12
|
+
this.colorScheme = localStorage.colorScheme || preference
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
static set colorScheme(value) {
|
|
16
|
+
localStorage.colorScheme = value
|
|
17
|
+
document.documentElement.classList.toggle("sc-dark", value === "dark")
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
Showcase.start()
|
|
22
|
+
</script>
|
|
23
|
+
|
|
7
24
|
<%= render "showcase/engine/head" %>
|
|
8
25
|
<%= render "showcase/engine/stylesheets" %>
|
|
9
26
|
<%= render "showcase/engine/javascripts" %>
|
|
@@ -1,9 +1,16 @@
|
|
|
1
1
|
<main class="sc-flex sc-flex-wrap dark:sc-bg-neutral-900 dark:sc-text-white" aria-labelledby="showcase_main_title">
|
|
2
2
|
<section class="sc-grid sc-grid-cols-12 sc-w-full">
|
|
3
3
|
<nav class="sc-col-span-3 xl:sc-col-span-2 sc-h-full sc-border-0 sc-border-r sc-border-solid sc-border-gray-200">
|
|
4
|
-
<
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
<header class="sc-flex sc-items-baseline sc-pt-5 sc-pb-2 sc-pl-4">
|
|
5
|
+
<h1 id="showcase_main_title" class="sc-font-black sc-text-2xl sc-m-0">
|
|
6
|
+
<%= link_to "Showcase", root_url, class: "sc-link" %>
|
|
7
|
+
</h1>
|
|
8
|
+
|
|
9
|
+
<section class="sc-link sc-text-sm sc-px-2 sc-cursor-pointer">
|
|
10
|
+
<a onclick="Showcase.colorScheme = 'light'" class="sc-hidden dark:sc-block">light mode</a>
|
|
11
|
+
<a onclick="Showcase.colorScheme = 'dark'" class="sc-block dark:sc-hidden">dark mode</a>
|
|
12
|
+
</section>
|
|
13
|
+
</header>
|
|
7
14
|
|
|
8
15
|
<%= render Showcase::Path.tree %>
|
|
9
16
|
</nav>
|
data/config/tailwind.config.js
CHANGED
data/lib/showcase/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: showcase-rails
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.5.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Daniel Pence
|
|
8
8
|
- Kasper Timm Hansen
|
|
9
|
-
autorequire:
|
|
10
9
|
bindir: bin
|
|
11
10
|
cert_chain: []
|
|
12
|
-
date:
|
|
11
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
13
12
|
dependencies:
|
|
14
13
|
- !ruby/object:Gem::Dependency
|
|
15
14
|
name: rails
|
|
@@ -17,14 +16,14 @@ dependencies:
|
|
|
17
16
|
requirements:
|
|
18
17
|
- - ">="
|
|
19
18
|
- !ruby/object:Gem::Version
|
|
20
|
-
version:
|
|
19
|
+
version: '7.2'
|
|
21
20
|
type: :runtime
|
|
22
21
|
prerelease: false
|
|
23
22
|
version_requirements: !ruby/object:Gem::Requirement
|
|
24
23
|
requirements:
|
|
25
24
|
- - ">="
|
|
26
25
|
- !ruby/object:Gem::Version
|
|
27
|
-
version:
|
|
26
|
+
version: '7.2'
|
|
28
27
|
- !ruby/object:Gem::Dependency
|
|
29
28
|
name: tailwindcss-rails
|
|
30
29
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -39,7 +38,6 @@ dependencies:
|
|
|
39
38
|
- - ">="
|
|
40
39
|
- !ruby/object:Gem::Version
|
|
41
40
|
version: '0'
|
|
42
|
-
description:
|
|
43
41
|
email:
|
|
44
42
|
- hey@kaspth.com
|
|
45
43
|
executables: []
|
|
@@ -88,7 +86,6 @@ metadata:
|
|
|
88
86
|
homepage_uri: https://github.com/kaspth/showcase
|
|
89
87
|
source_code_uri: https://github.com/kaspth/showcase
|
|
90
88
|
changelog_uri: https://github.com/kaspth/showcase/blob/main/CHANGELOG.md
|
|
91
|
-
post_install_message:
|
|
92
89
|
rdoc_options: []
|
|
93
90
|
require_paths:
|
|
94
91
|
- lib
|
|
@@ -103,8 +100,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
103
100
|
- !ruby/object:Gem::Version
|
|
104
101
|
version: '0'
|
|
105
102
|
requirements: []
|
|
106
|
-
rubygems_version: 3.
|
|
107
|
-
signing_key:
|
|
103
|
+
rubygems_version: 3.7.2
|
|
108
104
|
specification_version: 4
|
|
109
105
|
summary: Showcase helps you show off and document your partials, components, view
|
|
110
106
|
helpers and Stimulus controllers.
|