brainzlab 0.1.10 → 0.1.11

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: 97098a98bb87f20519522678294b7872e1ff75c9a340dc85c0681bce794bdc27
4
- data.tar.gz: 8842b97cc1d4f27c772df7463c2bca85b13b4d0cf91a0d2fd46b00f900e813f5
3
+ metadata.gz: 49af0bcd7ebaf8cc4b66040ae38be6eb6e8826178e493283b9241083ef54b79f
4
+ data.tar.gz: '0057911ea7e6c7113e06a148863dc7e806e7af32f0bd9eb6f579bb7b69377849'
5
5
  SHA512:
6
- metadata.gz: 1f940b97715f5b5592a834fbedcf409888d31f8421c35ad6435c71bde91068d351270092e816b26f6a1d97bc274bcb457bc612a3599b8bba143478be23564d0a
7
- data.tar.gz: ba2d7b3de3190e84ac3301173a0c2f4f6db3acc7bcbec5c84d73844cbb6f8b745db5d9a5c8c7064a4f6a2bb8a556b998df2d4ae1dfad044ecd9e9c46542ccfe0
6
+ metadata.gz: 91b591d98847edc9f401e6f505df003a1a802319db212615dab3a33a09fd320cde743c9c0dac40717dade391434a127ffa0975b28ec903f07a3907ab3f78f8fd
7
+ data.tar.gz: a9f1105138dc3a9871854e9a6526381950b66c0f2d4e18dcc40b2f434cb55d7f7af3bd2a27933401fa4ebb1b658d68fcf420b3476ebbea7a15944d543c16ab76
data/README.md CHANGED
@@ -47,12 +47,21 @@ bundle config set --global rubygems.pkg.github.com USERNAME:TOKEN
47
47
 
48
48
  ## Quick Start
49
49
 
50
+ ### Get Your API Key
51
+
52
+ 1. Sign up at [platform.brainzlab.ai](https://platform.brainzlab.ai)
53
+ 2. Create or select a project
54
+ 3. Copy your API key (`sk_live_xxx` or `sk_test_xxx`)
55
+ 4. Set it as `BRAINZLAB_SECRET_KEY` environment variable
56
+
57
+ **One key, all products**: Your Platform API key works across Recall, Reflex, Pulse, and all BrainzLab products. No separate keys needed.
58
+
50
59
  ### Configuration
51
60
 
52
61
  ```ruby
53
62
  # config/initializers/brainzlab.rb
54
63
  BrainzLab.configure do |config|
55
- # Authentication (required)
64
+ # Authentication (required) - Your Platform API key
56
65
  config.secret_key = ENV['BRAINZLAB_SECRET_KEY']
57
66
 
58
67
  # Environment
@@ -335,6 +335,26 @@
335
335
  display: none;
336
336
  }
337
337
 
338
+ /* Minimized State - Panel completely hidden */
339
+ .brainz-debug-panel.minimized {
340
+ max-height: 0;
341
+ border-top-width: 0;
342
+ box-shadow: none;
343
+ overflow: hidden;
344
+ pointer-events: none;
345
+ }
346
+
347
+ .brainz-debug-panel.minimized .brainz-debug-toolbar,
348
+ .brainz-debug-panel.minimized .brainz-debug-tabs,
349
+ .brainz-debug-panel.minimized .brainz-debug-content {
350
+ display: none;
351
+ }
352
+
353
+ /* Restore button is visible when minimized */
354
+ .brainz-debug-panel.minimized .brainz-debug-restore {
355
+ pointer-events: auto;
356
+ }
357
+
338
358
  /* Toolbar */
339
359
  .brainz-debug-toolbar {
340
360
  display: flex;
@@ -402,6 +422,73 @@
402
422
  transform: rotate(180deg);
403
423
  }
404
424
 
425
+ /* Minimize Button (on toolbar) */
426
+ .brainz-debug-minimize {
427
+ display: flex;
428
+ align-items: center;
429
+ justify-content: center;
430
+ width: 24px;
431
+ height: 24px;
432
+ padding: 0;
433
+ margin-left: 0.5rem;
434
+ background: transparent;
435
+ border: 1px solid var(--brainz-border);
436
+ border-radius: 4px;
437
+ color: var(--brainz-text-muted);
438
+ cursor: pointer;
439
+ transition: all 0.15s ease;
440
+ flex-shrink: 0;
441
+ }
442
+
443
+ .brainz-debug-minimize:hover {
444
+ background: var(--brainz-cream-200);
445
+ border-color: var(--brainz-border-dark);
446
+ color: var(--brainz-text);
447
+ }
448
+
449
+ .brainz-debug-minimize:active {
450
+ transform: scale(0.95);
451
+ }
452
+
453
+ /* Restore Button (floating, visible when minimized) */
454
+ .brainz-debug-restore {
455
+ position: fixed;
456
+ bottom: 16px;
457
+ left: 16px;
458
+ display: none;
459
+ align-items: center;
460
+ justify-content: center;
461
+ width: 40px;
462
+ height: 40px;
463
+ padding: 0;
464
+ background: white;
465
+ border: 2px solid var(--brainz-orange);
466
+ border-radius: 50%;
467
+ box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15), 0 4px 16px rgba(255, 107, 53, 0.2);
468
+ cursor: pointer;
469
+ transition: all 0.2s ease;
470
+ z-index: 999999;
471
+ }
472
+
473
+ .brainz-debug-restore:hover {
474
+ transform: scale(1.1);
475
+ box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2), 0 6px 20px rgba(255, 107, 53, 0.3);
476
+ }
477
+
478
+ .brainz-debug-restore:active {
479
+ transform: scale(1.05);
480
+ }
481
+
482
+ .brainz-debug-restore img {
483
+ width: 20px;
484
+ height: 20px;
485
+ }
486
+
487
+ /* Show restore button when panel is minimized */
488
+ .brainz-debug-panel.minimized .brainz-debug-restore {
489
+ display: flex;
490
+ }
491
+
405
492
  /* Performance Score */
406
493
  .brainz-score {
407
494
  position: relative;
@@ -31,7 +31,7 @@
31
31
  // Stimulus Controller Definition
32
32
  const DevtoolsController = {
33
33
  static: {
34
- targets: ['panel', 'tab', 'pane', 'toast']
34
+ targets: ['panel', 'tab', 'pane', 'toast', 'restoreBtn']
35
35
  },
36
36
 
37
37
  // Lifecycle
@@ -46,10 +46,32 @@
46
46
 
47
47
  // Actions
48
48
  togglePanel() {
49
+ // Don't toggle if minimized - use restorePanel instead
50
+ if (this.element.classList.contains('minimized')) {
51
+ return;
52
+ }
49
53
  this.element.classList.toggle('collapsed');
50
54
  this.saveState();
51
55
  },
52
56
 
57
+ minimizePanel(event) {
58
+ if (event) {
59
+ event.stopPropagation();
60
+ event.preventDefault();
61
+ }
62
+ this.element.classList.add('minimized');
63
+ this.saveState();
64
+ },
65
+
66
+ restorePanel(event) {
67
+ if (event) {
68
+ event.stopPropagation();
69
+ event.preventDefault();
70
+ }
71
+ this.element.classList.remove('minimized');
72
+ this.saveState();
73
+ },
74
+
53
75
  switchTab(event) {
54
76
  event.stopPropagation();
55
77
  const tabName = event.currentTarget.dataset.tab;
@@ -242,6 +264,7 @@ Controller: ${controllerName || 'unknown'}#${actionName || 'unknown'}
242
264
  const activeTab = this.element.querySelector('[data-devtools-target="tab"].active');
243
265
  sessionStorage.setItem('brainz-devtools-state', JSON.stringify({
244
266
  collapsed: this.element.classList.contains('collapsed'),
267
+ minimized: this.element.classList.contains('minimized'),
245
268
  activeTab: activeTab?.dataset.tab || 'request'
246
269
  }));
247
270
  } catch (e) { /* ignore */ }
@@ -250,7 +273,11 @@ Controller: ${controllerName || 'unknown'}#${actionName || 'unknown'}
250
273
  loadState() {
251
274
  try {
252
275
  const state = JSON.parse(sessionStorage.getItem('brainz-devtools-state'));
253
- if (state?.collapsed) this.element.classList.add('collapsed');
276
+ if (state?.minimized) {
277
+ this.element.classList.add('minimized');
278
+ } else if (state?.collapsed) {
279
+ this.element.classList.add('collapsed');
280
+ }
254
281
  if (state?.activeTab) {
255
282
  const tab = this.element.querySelector(`[data-tab="${state.activeTab}"]`);
256
283
  if (tab) tab.click();
@@ -263,9 +290,14 @@ Controller: ${controllerName || 'unknown'}#${actionName || 'unknown'}
263
290
  this._keyHandler = (e) => {
264
291
  if ((e.ctrlKey || e.metaKey) && e.shiftKey && e.key === 'B') {
265
292
  e.preventDefault();
266
- this.togglePanel();
293
+ // If minimized, restore first
294
+ if (this.element.classList.contains('minimized')) {
295
+ this.restorePanel();
296
+ } else {
297
+ this.togglePanel();
298
+ }
267
299
  }
268
- if (e.key === 'Escape' && !this.element.classList.contains('collapsed')) {
300
+ if (e.key === 'Escape' && !this.element.classList.contains('collapsed') && !this.element.classList.contains('minimized')) {
269
301
  this.togglePanel();
270
302
  }
271
303
  };
@@ -289,11 +321,13 @@ Controller: ${controllerName || 'unknown'}#${actionName || 'unknown'}
289
321
 
290
322
  // Register the devtools controller
291
323
  app.register('devtools', class extends Controller {
292
- static targets = ['tab', 'pane'];
324
+ static targets = ['tab', 'pane', 'restoreBtn'];
293
325
 
294
326
  connect() { DevtoolsController.connect.call(this); }
295
327
  disconnect() { DevtoolsController.disconnect.call(this); }
296
328
  togglePanel() { DevtoolsController.togglePanel.call(this); }
329
+ minimizePanel(e) { DevtoolsController.minimizePanel.call(this, e); }
330
+ restorePanel(e) { DevtoolsController.restorePanel.call(this, e); }
297
331
  switchTab(e) { DevtoolsController.switchTab.call(this, e); }
298
332
  copyToAi(e) { DevtoolsController.copyToAi.call(this, e); }
299
333
  copySql(e) { DevtoolsController.copySql.call(this, e); }
@@ -97,6 +97,12 @@
97
97
  <path d="M2 4l4 4 4-4" stroke="currentColor" stroke-width="1.5" fill="none" stroke-linecap="round" stroke-linejoin="round"/>
98
98
  </svg>
99
99
  </span>
100
+
101
+ <button class="brainz-debug-minimize" data-action="click->devtools#minimizePanel" title="Minimize panel">
102
+ <svg width="12" height="12" viewBox="0 0 12 12">
103
+ <path d="M2 6h8" stroke="currentColor" stroke-width="1.5" fill="none" stroke-linecap="round"/>
104
+ </svg>
105
+ </button>
100
106
  </div>
101
107
 
102
108
  <!-- Tabs -->
@@ -494,6 +500,11 @@
494
500
  </div>
495
501
  </div>
496
502
  </div>
503
+
504
+ <!-- Floating Restore Button (visible when minimized) -->
505
+ <button class="brainz-debug-restore" data-devtools-target="restoreBtn" data-action="click->devtools#restorePanel" title="Restore BrainzLab DevTools (Ctrl+Shift+B)">
506
+ <img src="<%= asset_url('logo.svg') %>" alt="BrainzLab" width="20" height="20">
507
+ </button>
497
508
  </div>
498
509
 
499
510
  <link rel="stylesheet" href="<%= asset_url('devtools.css') %>">
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module BrainzLab
4
- VERSION = '0.1.10'
4
+ VERSION = '0.1.11'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: brainzlab
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.10
4
+ version: 0.1.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brainz Lab