gdk-toogle 1.0.1 → 1.0.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5b7fb4c9b37ce9f5712cc5635ff39bea2b3745179ea554dbe4b941f2a9472cab
4
- data.tar.gz: 57a6c432b93d5dc0e88c52f46c653ca26338638f99f866c57e56dc5540a21692
3
+ metadata.gz: cacce942effef205bff4a9e31cd15889c6e3faba254dd3efee2e238519940147
4
+ data.tar.gz: f1e506fe72c8dbe264382fa96544a66e232ea0b40fb0bfb4fb14772b3a0e9702
5
5
  SHA512:
6
- metadata.gz: da4f86f837651e78dc12c7c61e2563cb8e099ff5a6a454e00226728906427243649190743cc36b46bcac34967551542afe8da58f5f5a35e5c6fd834412d434e4
7
- data.tar.gz: 807b565d41e6f131a0811fb7e4d980f1c5a0a5ad5a61c892e81f3c9e6d4c2c614fe269bfadf8087465467deca63d3297080366ad1827b4abd302a09c5fb30e21
6
+ metadata.gz: aac129e17fb36ea58e72b2bd12dbf9d90b52d8055ab787146fc3fccaf0eec5cd178d6f1cf21672e0de6fd48aa9ab9ea15fa5a7d328e522ff430286ecf0c49d16
7
+ data.tar.gz: 83a9942634aab84f4058e743f900f538c5e5bc69c74f8c678c8738b544c96d377ef091cc96302164e33f03bc611db886cd90b10581b47b75a3b5e070ff32173f
data/README.md CHANGED
@@ -10,7 +10,7 @@ GitLab's `Feature` classes, so mounting it in any other Rails app won't work
10
10
 
11
11
  ### Usage within the GitLab Development Kit
12
12
 
13
- The UI is available at http://gdk.test:3000/rails/features.
13
+ The UI is available at http://gdk.test:4000/rails/features.
14
14
 
15
15
  ## Contributing
16
16
 
@@ -29,11 +29,12 @@ The dummy app used for testing includes fake in-memory versions of GitLab's
29
29
  develop the engine without a GDK:
30
30
 
31
31
  ```sh
32
+ bundle install
32
33
  cd spec/dummy
33
34
  bin/rails server
34
35
  ```
35
36
 
36
- Then open http://localhost:3000/toogle. Toggled state lives in memory and
37
+ Then open http://localhost:4000/toogle. Toggled state lives in memory and
37
38
  resets on restart.
38
39
 
39
40
  To test your changes inside a real GDK, point GitLab's `Gemfile` at your
@@ -238,11 +238,8 @@ document.addEventListener("alpine:init", () => {
238
238
  ["@click"]() {
239
239
  this.isDark = !this.isDark;
240
240
  document.cookie = `toogle-dark=${this.isDark}; SameSite=Strict`;
241
- if (this.isDark) {
242
- document.documentElement.classList.remove("light-mode");
243
- } else {
244
- document.documentElement.classList.add("light-mode");
245
- }
241
+ document.documentElement.classList.toggle("dark-mode", this.isDark);
242
+ document.documentElement.classList.toggle("light-mode", !this.isDark);
246
243
  },
247
244
  ["x-bind:title"]() {
248
245
  return `Switch to ${this.isDark ? "Light Mode" : "Dark Mode"}`;
@@ -49,8 +49,11 @@
49
49
  }
50
50
  }
51
51
 
52
+ input:checked + .handle {
53
+ background-color: var(--color-on);
54
+ }
55
+
52
56
  input:checked + .handle:before {
53
- background-color: var(--color-primary);
54
57
  transform: translateX(26px);
55
58
  }
56
59
 
@@ -2,6 +2,7 @@ html {
2
2
  color-scheme: light;
3
3
 
4
4
  --hue-primary: 35;
5
+ --hue-on: 140;
5
6
  --saturation-bg: 5%;
6
7
  --lightness-bg0: 92%; /* page */
7
8
  --lightness-bg2: 97%; /* raised surfaces: inputs, badges */
@@ -11,8 +12,11 @@ html {
11
12
  --lightness-fg: 10%;
12
13
  --lightness-muted: 42%;
13
14
  --lightness-shadow: 65%;
15
+ --saturation-on: 60%; /* toggle track when on */
16
+ --lightness-on: 38%;
14
17
 
15
18
  --color-primary: hsl(var(--hue-primary), 90%, 50%);
19
+ --color-on: hsl(var(--hue-on), var(--saturation-on), var(--lightness-on));
16
20
  --color-text: hsl(var(--hue-primary), 0%, var(--lightness-fg));
17
21
  --color-text-muted: hsl(var(--hue-primary), 5%, var(--lightness-muted));
18
22
  --color-shadow: hsl(0, var(--saturation-bg), var(--lightness-shadow));
@@ -43,6 +47,7 @@ html {
43
47
  );
44
48
  }
45
49
 
50
+ /* Keep in sync with the block below */
46
51
  @media (prefers-color-scheme: dark) {
47
52
  html:not(.light-mode) {
48
53
  color-scheme: dark;
@@ -55,5 +60,23 @@ html {
55
60
  --lightness-fg: 90%;
56
61
  --lightness-muted: 60%;
57
62
  --lightness-shadow: 3%;
63
+ --saturation-on: 45%;
64
+ --lightness-on: 48%;
58
65
  }
59
66
  }
67
+
68
+ /* Keep in sync with the block above */
69
+ html.dark-mode {
70
+ color-scheme: dark;
71
+
72
+ --lightness-bg0: 8%;
73
+ --lightness-bg2: 16%;
74
+ --lightness-track: 22%;
75
+ --lightness-thumb: 70%;
76
+ --lightness-disabled: 12%;
77
+ --lightness-fg: 90%;
78
+ --lightness-muted: 60%;
79
+ --lightness-shadow: 3%;
80
+ --saturation-on: 45%;
81
+ --lightness-on: 48%;
82
+ }
@@ -1,5 +1,6 @@
1
1
  !!!
2
- %html{ class: ("light-mode" if request.cookies["toogle-dark"] == "false") }
2
+ - theme_class = {"true" => "dark-mode", "false" => "light-mode"}[request.cookies["toogle-dark"]]
3
+ %html{ class: theme_class }
3
4
  %head
4
5
  %meta{:content => "text/html; charset=UTF-8", "http-equiv" => "Content-Type"}/
5
6
  %meta(name="viewport" content="width=device-width, initial-scale=1.0")
@@ -1,3 +1,3 @@
1
1
  module Toogle
2
- VERSION = "1.0.1"
2
+ VERSION = "1.0.2"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gdk-toogle
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Thomas Hutterer
@@ -132,7 +132,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
132
132
  - !ruby/object:Gem::Version
133
133
  version: '0'
134
134
  requirements: []
135
- rubygems_version: 4.0.12
135
+ rubygems_version: 4.0.16
136
136
  specification_version: 4
137
137
  summary: Toogle toggles feature flags
138
138
  test_files: []