gdk-toogle 0.9.3 → 0.9.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b41975a3c2a35c12eecaad91aa7bfd949d68d0132576d1f68ecca48987abf641
4
- data.tar.gz: ad9ede84ae8f37f9286699d33163f360a04854a00abb3fbfb4ec6b07e3ec386f
3
+ metadata.gz: 126d3207f78acad2e5a2af3959117efd93a9a6b210187afafb4b4b69e1db33b9
4
+ data.tar.gz: 26b6411779359a408db3f218e3e9d71d5f33538277c9cf276183c8756c63ede8
5
5
  SHA512:
6
- metadata.gz: 20a49dff67060c27ab608f9851570494726856f34e0deb11ad3c60266b72a3af13260384c63ddf3afe3284449e9984e03f3fd345a9302c6e132760a515c124eb
7
- data.tar.gz: 1d372ec1b321404ad287154a027aef0a1732116ffedd449602bcd57f57e4d4d77b0a0e5ea11f2e5ed5e7c5caf3901ae99569485f3db8c0e50c7bc5f581ba5957
6
+ metadata.gz: 19cd5ab3ca2ecf53b0f4712ada95810c468a37e963d70cf726081dacf6797ce2cf63d9cc193c79d924a658e7d5effcb4042f1e5cc0f0210a11b4cc077a45b04a
7
+ data.tar.gz: 9f88ab74e9ed65a6ccdc031378d59b3310b52f2cdd0a8703d58f837cf7c357f9f2679b754fb525c99c1e7d934e81ef10e1c775f627ecad8c13da108b6aece209
data/README.md CHANGED
@@ -8,14 +8,7 @@ This gem was written specifically for the GitLab codebase. It won't work in any
8
8
 
9
9
  ### Usage within the GitLab Development Kit
10
10
 
11
- This gem is still an experiment and not yet part of our `Gemfile`. So for now, to try out this gem, take the following steps:
12
-
13
- - `git clone` this repository to your machine.
14
- - Add `gem 'toogle', path: 'local_toogle_path_here'` to the Gemfile and `bundle`.
15
- - Add `mount Toogle::Engine, at: '/rails/toogle'` to `config/routes/development.rb`.
16
- - Restart the rails server to pick up the new route: `gdk restart rails-web`
17
-
18
- The UI is now availabe at http://gdk.test:3000/rails/toogle.
11
+ The UI is availabe at http://gdk.test:3000/rails/features.
19
12
 
20
13
  ## Contributing
21
14
 
@@ -29,6 +22,23 @@ The system specs in `spec/system` are configured to use Firefox as headless brow
29
22
 
30
23
  **Tip:** If you don't have Firefox installed on your machine, or if you are on Ubuntu and have Firefox installed only via Snap, you can switch to Chrome by changing the `driven_by` to `:selenium_chrome_headless` in `spec/rails_helper.rb`.
31
24
 
25
+ ## Tech stack
26
+
27
+ One design goal of this little Rails engine was to keep it free of any dependencies, that GitLab uses today.
28
+ Because, tomorrow we might decide to ditch one or the other tech we use today, and Toogle shouldn't break just because GitLab removes `sassc`, as an example (that actually happened during development).
29
+
30
+ That's why Toogle only depends on the bare basics: `rails`, `sprockets` and `haml`.
31
+
32
+ ### Javascript
33
+
34
+ Toogle uses [Alpine.js](https://alpinejs.dev/) from a `<script>` tag so it does not use or depend on our Vue.js usage or any bundler. Alpine is very similar to Vue, so it's really easy to pick up. Give it a try!
35
+
36
+ ### CSS
37
+
38
+ Toogle uses native unprocessed CSS to not depend on any specific preprocessor. Modern CSS is awesome, and all modern browsers support things like nested selectors today.
39
+
40
+ For theming and dark mode, it uses CSS variables and HSL colors, which makes it super easy to switch from light to dark by just changing the variable that makes up the _Lightness_. Check it out!
41
+
32
42
  ## License
33
43
 
34
44
  The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
@@ -4,7 +4,8 @@
4
4
  var(--saturation-bg),
5
5
  var(--lightness-bg1)
6
6
  );
7
- border-radius: 5px;
8
- padding: 2rem;
9
7
  box-shadow: 0 10px 16px var(--color-shadow);
8
+ border-radius: 5px;
9
+ padding: 1rem;
10
+ max-width: 100%;
10
11
  }
@@ -4,6 +4,7 @@
4
4
  width: 60px;
5
5
  height: 34px;
6
6
  margin: 4px;
7
+ flex-shrink: 0;
7
8
 
8
9
  input {
9
10
  opacity: 0;
@@ -1,11 +1,11 @@
1
+ * {
2
+ box-sizing: border-box;
3
+ }
4
+
1
5
  html {
2
6
  color: var(--color-text);
3
7
  transition: 0.2s;
4
- background-image: radial-gradient(
5
- circle at 10vh 10vw,
6
- hsl(var(--hue-primary), var(--saturation-bg), var(--lightness-bg1)),
7
- hsl(var(--hue-primary), var(--saturation-bg), var(--lightness-bg0))
8
- );
8
+ background-color: var(--color-page-bg);
9
9
  }
10
10
 
11
11
  body {
@@ -12,7 +12,6 @@ body {
12
12
  gap: 1rem;
13
13
 
14
14
  padding: 1rem;
15
- z-index: 2;
16
15
 
17
16
  a,
18
17
  span {
@@ -25,15 +24,30 @@ body {
25
24
 
26
25
  > main {
27
26
  display: flex;
28
- flex-direction: column-reverse;
29
- align-items: stretch;
30
- justify-content: start;
31
- width: 100ch;
32
- max-width: 95%;
33
- margin: auto;
27
+ flex-direction: column;
28
+ align-items: center;
29
+ justify-content: center;
34
30
  gap: 3rem;
35
- padding: 2rem 0;
31
+
32
+ padding: 0 1rem;
36
33
  flex-grow: 1;
34
+
35
+ &.with-sticky-search {
36
+ margin-top: 4rem;
37
+
38
+ .sticky-search {
39
+ align-self: center;
40
+ position: sticky;
41
+ width: min(100%, 80ch);
42
+ top: 0;
43
+ background-image: linear-gradient(
44
+ var(--color-page-bg) 90%,
45
+ transparent 100%
46
+ );
47
+ padding-bottom: 0.5rem;
48
+ z-index: 2;
49
+ }
50
+ }
37
51
  }
38
52
 
39
53
  > footer {
@@ -35,3 +35,8 @@
35
35
  .w-100 {
36
36
  width: 100%;
37
37
  }
38
+
39
+ .ellipsis {
40
+ overflow-x: hidden;
41
+ text-overflow: ellipsis;
42
+ }
@@ -10,6 +10,11 @@ html {
10
10
  --color-primary: hsl(var(--hue-primary), 90%, 50%);
11
11
  --color-text: hsl(var(--hue-primary), 0%, var(--lightness-fg));
12
12
  --color-shadow: hsl(0, var(--saturation-bg), var(--lightness-shadow));
13
+ --color-page-bg: hsl(
14
+ var(--hue-primary),
15
+ var(--saturation-bg),
16
+ var(--lightness-bg0)
17
+ );
13
18
  }
14
19
 
15
20
  @media (prefers-color-scheme: dark) {
@@ -16,12 +16,6 @@
16
16
  %nav.d-flex.gap
17
17
  = link_to main_app.root_path do
18
18
  = render partial: "shared/logo", formats: :svg
19
- %span ›
20
- = link_to_unless_current "Feature flags", features_path do
21
- %span Feature flags
22
- - if @feature
23
- %span ›
24
- %span= @feature.name
25
19
 
26
20
  %button(x-data="darkModeSwitcher" x-bind="button")
27
21
  %svg(x-show="isDark" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round")
@@ -39,7 +33,7 @@
39
33
  -# 🌙
40
34
  %path(d="M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z")
41
35
 
42
- %main
36
+ %main.with-sticky-search
43
37
  = yield
44
38
  - if notice.present?
45
39
  #notice.d-flex.row.center.gap
@@ -1,3 +1,24 @@
1
+ .sticky-search
2
+ .d-flex.col{
3
+ "x-data": "{query: '', show: false}",
4
+ "@click.outside": "show = false",
5
+ "@keyup.esc": "show = false"}
6
+ %input.large.w-100#search{
7
+ "type": "search",
8
+ "placeholder": "Search and toggle feature flags",
9
+ "x-model.debounce.400ms": "query",
10
+ "x-ref": "search",
11
+ "x-on:input": "show = true",
12
+ "x-on:focus": "show = true"}
13
+ %template(x-if="show")
14
+ .d-flex.col.stretch{
15
+ "x-anchor.bottom-start.offset.5" => "$refs.search",
16
+ "x-transition": nil}
17
+ .grow{
18
+ "data-url": definitions_path,
19
+ "x-data": "{}",
20
+ "x-init": "$el.innerHTML = await (await fetch($el.dataset.url)).text()"}
21
+
1
22
  .card
2
23
  %h3 My feature flags
3
24
  %small These features already use custom settings in this GDK.
@@ -5,7 +26,7 @@
5
26
  %ul(x-data="features('#{features_url}')")
6
27
  %template(x-for="feature in features" :key="feature.name")
7
28
  %li.feature-toggle(x-data="{ showMore: false }"){"@click.outside": "showMore = false"}
8
- .d-flex.row
29
+ .d-flex.row.nowrap
9
30
  %template(x-if="feature.state === 'unknown'")
10
31
  %label.toggle(title="This feature does not exist on the current branch.")
11
32
  %input(type="checkbox" disabled :name="feature.name")
@@ -15,7 +36,7 @@
15
36
  %input(type="checkbox" x-on:change="toggleFeature(feature)" :checked="feature.state === 'enabled'" :name="feature.name")
16
37
  %span.handle.round
17
38
 
18
- %code.grow(x-text="feature.name")
39
+ %code.grow.ellipsis(x-text="feature.name")
19
40
 
20
41
  %button(title="Show more" x-on:click="showMore = !showMore")
21
42
  %svg(xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round")
@@ -52,25 +73,4 @@
52
73
  %button(x-on:click="$refs.copyText.select(); document.execCommand('copy');") Copy
53
74
  %p(x-show="!features.length") No active feature flags in this GDK yet.
54
75
 
55
- .card(style="margin: 8vh 0 5vh;")
56
- %h3 Search and toggle feature flags
57
- .d-flex.col{
58
- "x-data": "{query: '', show: false}",
59
- "@click.outside": "show = false",
60
- "@keyup.esc": "show = false"}
61
- %input.large.w-100#search{
62
- "type": "search",
63
- "x-model.debounce.400ms": "query",
64
- "x-ref": "search",
65
- "x-on:input": "show = true",
66
- "x-on:focus": "show = true"}
67
- %template(x-if="show")
68
- .d-flex.col.stretch{
69
- "x-anchor.bottom-start.offset.5" => "$refs.search",
70
- "x-transition": nil}
71
- .grow{
72
- "data-url": definitions_path,
73
- "x-data": "{}",
74
- "x-init": "$el.innerHTML = await (await fetch($el.dataset.url)).text()"}
75
-
76
76
  = render "dialog"
@@ -1,3 +1,3 @@
1
1
  module Toogle
2
- VERSION = "0.9.3"
2
+ VERSION = "0.9.5"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gdk-toogle
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.3
4
+ version: 0.9.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Thomas Hutterer
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-03-15 00:00:00.000000000 Z
11
+ date: 2024-05-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails