completion-kit 0.5.21 → 0.5.23

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: e04e66d89aab0762a3d58532984bf73a8a18c47c7f29002c4138c0770f412fd9
4
- data.tar.gz: 221647dc0afd30c24644be27e1b909e901752478044b3270abc9fd717355d782
3
+ metadata.gz: 3f3a33489dfdc8c4b5744b3d04ef7f1fbb7d4c257e6198e1213b2a6508247a05
4
+ data.tar.gz: b9c96940b2b4954d707068bee76e6beee58ae19e3f20194cece5643e813fe3b5
5
5
  SHA512:
6
- metadata.gz: a974fe2b24af3ab7e12a354ab946ec1817f5740507c0c052266879dfa9a2a82d091f79034140e15585c60fd6c6a7c80ae1e86fe7bcd262da8b8ea686ea65f0a6
7
- data.tar.gz: cb1339bc6e3b4787a2fb3a6b82a789d46432938781d17745914cb8763590b7c339f9d666c6139ea9e4e8f4c44818de49727234af9fe7b1585379abdca3c308ec
6
+ metadata.gz: d787d4f44220fd48907954c871b5576d10a4fcb3baf5a7d4106fcf9a30cf06563c3fad3a4e2cb3cf2027843b50b5fd52c1aadf0910fc402dbd04d14d54f73a8d
7
+ data.tar.gz: 7d24b2744b473e98403ff30b7c7bb664f1b1f76a72330a973f290b049b67c76ca6283d5f26dc32b70d0d4bce529bbf267d7dd3ff2d06febf1781b1bb5c2b05a8
@@ -118,6 +118,35 @@ form.button_to {
118
118
  padding: 0.75rem 0;
119
119
  }
120
120
 
121
+ /* Mobile navigation — a <details> hamburger. On desktop the trigger is
122
+ hidden and the nav shows inline; at the mobile breakpoint the nav
123
+ collapses behind the trigger and opens as a dropdown panel. The two
124
+ always-show rules cover both the legacy and ::details-content models for
125
+ hiding closed <details> content. This block must precede the mobile media
126
+ query so the media query's rules win on source order. */
127
+ .ck-nav-menu {
128
+ position: relative;
129
+ display: flex;
130
+ }
131
+ .ck-nav-menu > .ck-nav { display: flex; }
132
+ .ck-nav-menu::details-content { content-visibility: visible; }
133
+ .ck-nav-menu__trigger {
134
+ display: none;
135
+ align-items: center;
136
+ justify-content: center;
137
+ width: 2.6rem;
138
+ height: 2.6rem;
139
+ color: var(--ck-text);
140
+ background: var(--ck-surface);
141
+ border: 1px solid var(--ck-line);
142
+ border-radius: var(--ck-radius);
143
+ cursor: pointer;
144
+ list-style: none;
145
+ }
146
+ .ck-nav-menu__trigger::-webkit-details-marker { display: none; }
147
+ .ck-nav-menu__trigger::marker { content: ""; }
148
+ .ck-nav-menu[open] .ck-nav-menu__trigger { border-color: var(--ck-dim); }
149
+
121
150
  .ck-brand {
122
151
  display: inline-flex;
123
152
  align-items: center;
@@ -2755,12 +2784,21 @@ select.ck-input {
2755
2784
  }
2756
2785
 
2757
2786
  .ck-actions,
2758
- .ck-toolbar,
2759
- .ck-nav {
2787
+ .ck-toolbar {
2760
2788
  width: 100%;
2761
2789
  }
2762
2790
 
2791
+ /* Page header stacks: title, then lead text full-width, then action. */
2792
+ .ck-page-header {
2793
+ flex-direction: column;
2794
+ align-items: stretch;
2795
+ }
2796
+
2797
+ /* Result tables scroll horizontally within their own box instead of
2798
+ stretching the page — fixed column widths overflow a phone otherwise. */
2763
2799
  .ck-results-table {
2800
+ display: block;
2801
+ overflow-x: auto;
2764
2802
  font-size: 0.85rem;
2765
2803
  }
2766
2804
 
@@ -2776,6 +2814,29 @@ select.ck-input {
2776
2814
  .ck-review-card {
2777
2815
  padding: 1rem;
2778
2816
  }
2817
+
2818
+ /* Topbar nav collapses behind the hamburger trigger. */
2819
+ .ck-nav-menu__trigger {
2820
+ display: inline-flex;
2821
+ }
2822
+ .ck-nav-menu:not([open]) > .ck-nav {
2823
+ display: none;
2824
+ }
2825
+ .ck-nav-menu[open] > .ck-nav {
2826
+ position: absolute;
2827
+ right: 0;
2828
+ top: calc(100% + 0.6rem);
2829
+ flex-direction: column;
2830
+ align-items: stretch;
2831
+ width: 13rem;
2832
+ padding: 0.5rem;
2833
+ gap: 0.35rem;
2834
+ background: var(--ck-surface);
2835
+ border: 1px solid var(--ck-line);
2836
+ border-radius: var(--ck-radius);
2837
+ box-shadow: 0 14px 30px rgba(0, 0, 0, 0.5);
2838
+ z-index: 50;
2839
+ }
2779
2840
  }
2780
2841
 
2781
2842
  .ck-api-endpoint {
@@ -4728,6 +4789,7 @@ a.tag-mark {
4728
4789
  right: 0;
4729
4790
  z-index: 30;
4730
4791
  width: 22rem;
4792
+ max-width: calc(100vw - 1.5rem);
4731
4793
  max-height: 19rem;
4732
4794
  overflow-y: auto;
4733
4795
  margin: 0;
@@ -128,6 +128,7 @@ module CompletionKit
128
128
  end
129
129
 
130
130
  def render_partial(partial, locals)
131
+ CompletionKit::Engine.warm_routes!
131
132
  CompletionKit::ApplicationController.render(partial: partial, locals: locals)
132
133
  end
133
134
  end
@@ -231,7 +231,7 @@ module CompletionKit
231
231
  end
232
232
 
233
233
  def render_engine_partial(partial, locals)
234
- CompletionKit::Engine.routes.url_helpers
234
+ CompletionKit::Engine.warm_routes!
235
235
  CompletionKit::ApplicationController.render(
236
236
  partial: partial,
237
237
  locals: locals
@@ -17,6 +17,10 @@
17
17
  <div class="ck-wrap ck-topbar__inner">
18
18
  <%= link_to (main_app.respond_to?(:root_path) ? main_app.root_path : prompts_path), class: "ck-brand" do %><%= image_tag "completion_kit/logo.png", alt: "CompletionKit", style: "height: 64px; width: auto;" %><span class="ck-brand__name">Completion<span class="ck-brand__kit">Kit</span></span><% end %>
19
19
 
20
+ <details class="ck-nav-menu">
21
+ <summary class="ck-nav-menu__trigger" aria-label="Menu">
22
+ <svg viewBox="0 0 24 24" width="22" height="22" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" aria-hidden="true"><line x1="3" y1="6" x2="21" y2="6"/><line x1="3" y1="12" x2="21" y2="12"/><line x1="3" y1="18" x2="21" y2="18"/></svg>
23
+ </summary>
20
24
  <nav class="ck-nav">
21
25
  <% active = ->(path) { request.path.start_with?(path) ? ck_button_classes(:dark) : ck_button_classes(:light, variant: :outline) } %>
22
26
  <%= link_to "Prompts", prompts_path, class: active.(prompts_path) %>
@@ -39,6 +43,7 @@
39
43
  <%= button_to "Log out", main_app.logout_path, method: :delete, class: ck_button_classes(:light, variant: :outline) %>
40
44
  <% end %>
41
45
  </nav>
46
+ </details>
42
47
  </div>
43
48
  </header>
44
49
 
@@ -7,6 +7,21 @@ module CompletionKit
7
7
 
8
8
  paths.add "app/services", eager_load: true
9
9
 
10
+ ROUTES_WARMUP_LOCK = Mutex.new
11
+ @routes_warmed = false
12
+
13
+ # Materialise the engine's lazy route set once, single-threaded. Background
14
+ # worker threads that render engine partials for Turbo broadcasts otherwise
15
+ # race the lazy first-load and raise "undefined method 'run_response_path'"
16
+ # (production survives only because eager_load finalises routes at boot).
17
+ def self.warm_routes!
18
+ ROUTES_WARMUP_LOCK.synchronize do
19
+ return if @routes_warmed
20
+ routes.url_helpers.root_path
21
+ @routes_warmed = true
22
+ end
23
+ end
24
+
10
25
  def self.register_assets(app)
11
26
  app.config.assets.precompile += %w(
12
27
  completion_kit/application.css
@@ -1,3 +1,3 @@
1
1
  module CompletionKit
2
- VERSION = "0.5.21"
2
+ VERSION = "0.5.23"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: completion-kit
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.21
4
+ version: 0.5.23
5
5
  platform: ruby
6
6
  authors:
7
7
  - Damien Bastin