parapet-rails 0.1.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.
Files changed (231) hide show
  1. checksums.yaml +7 -0
  2. data/MIT-LICENSE +20 -0
  3. data/README.md +48 -0
  4. data/Rakefile +7 -0
  5. data/app/assets/config/parapet/grammar-registry.json +52 -0
  6. data/app/assets/images/parapet/icons/activities/component-inspector.svg +4 -0
  7. data/app/assets/images/parapet/icons/activities/coverage-heatmap.svg +3 -0
  8. data/app/assets/images/parapet/icons/activities/discovery-sidebar.svg +3 -0
  9. data/app/assets/images/parapet/icons/activities/environment-toggles.svg +4 -0
  10. data/app/assets/images/parapet/icons/activities/failure-inspector.svg +5 -0
  11. data/app/assets/images/parapet/icons/activities/flaky-history.svg +3 -0
  12. data/app/assets/images/parapet/icons/activities/flight-recorder.svg +5 -0
  13. data/app/assets/images/parapet/icons/activities/health-graph.svg +3 -0
  14. data/app/assets/images/parapet/icons/activities/injection-engine.svg +3 -0
  15. data/app/assets/images/parapet/icons/activities/live-sql-stream.svg +5 -0
  16. data/app/assets/images/parapet/icons/activities/live-web-preview.svg +4 -0
  17. data/app/assets/images/parapet/icons/activities/monaco-editor.svg +5 -0
  18. data/app/assets/images/parapet/icons/activities/progress-area.svg +3 -0
  19. data/app/assets/images/parapet/icons/activities/registry-metadata.svg +5 -0
  20. data/app/assets/images/parapet/icons/activities/seed-inspector.svg +4 -0
  21. data/app/assets/images/parapet/icons/activities/slow-test-bottlenecks.svg +4 -0
  22. data/app/assets/images/parapet/icons/activities/smart-search.svg +4 -0
  23. data/app/assets/images/parapet/icons/activities/snippet-library.svg +4 -0
  24. data/app/assets/images/parapet/icons/activities/terminal.svg +4 -0
  25. data/app/assets/images/parapet/icons/activities/unified-schema-view.svg +4 -0
  26. data/app/assets/images/parapet/icons/activities/visual-comparison.svg +3 -0
  27. data/app/assets/images/parapet/icons/activities/visual-summary-bar.svg +5 -0
  28. data/app/assets/images/parapet/icons/nav/ideas.svg +4 -0
  29. data/app/assets/images/parapet/icons/nav/languages.svg +8 -0
  30. data/app/assets/images/parapet/icons/nav/profile.svg +4 -0
  31. data/app/assets/images/parapet/icons/nav/pulse.svg +7 -0
  32. data/app/assets/images/parapet/icons/nav/settings.svg +4 -0
  33. data/app/assets/images/parapet/icons/nav/state.svg +5 -0
  34. data/app/assets/images/parapet/icons/nav/styles.svg +7 -0
  35. data/app/assets/images/parapet/icons/nav/tests.svg +4 -0
  36. data/app/assets/images/parapet/icons/nav/traffic.svg +12 -0
  37. data/app/assets/javascripts/parapet/activity-card.js +439 -0
  38. data/app/assets/javascripts/parapet/activity-cards.js +291 -0
  39. data/app/assets/javascripts/parapet/activity-registry.js +181 -0
  40. data/app/assets/javascripts/parapet/activity-toggles.js +76 -0
  41. data/app/assets/javascripts/parapet/application.js +37 -0
  42. data/app/assets/javascripts/parapet/card-failure-inspector.js +134 -0
  43. data/app/assets/javascripts/parapet/card-file-editor.js +1722 -0
  44. data/app/assets/javascripts/parapet/card-progress-area.js +297 -0
  45. data/app/assets/javascripts/parapet/card-smart-search.js +114 -0
  46. data/app/assets/javascripts/parapet/card-snippet-library.js +251 -0
  47. data/app/assets/javascripts/parapet/explorer-resizer.js +92 -0
  48. data/app/assets/javascripts/parapet/parapet_qss.js +342 -0
  49. data/app/assets/javascripts/parapet/proficiency-filter.js +53 -0
  50. data/app/assets/javascripts/parapet/sidebar-resizer.js +197 -0
  51. data/app/assets/javascripts/parapet/styles-workbench.js +819 -0
  52. data/app/assets/javascripts/parapet/tree-logic.js +320 -0
  53. data/app/assets/stylesheets/parapet/_qss_variables.scss +122 -0
  54. data/app/assets/stylesheets/parapet/parapet_qss.scss +69 -0
  55. data/app/assets/stylesheets/parapet/qss_application.css +260940 -0
  56. data/app/assets/stylesheets/parapet/qss_application.css.map +1 -0
  57. data/app/assets/stylesheets/parapet/qss_application.scss +5 -0
  58. data/app/assets/stylesheets/parapet/qss_workspace.scss +209 -0
  59. data/app/assets/stylesheets/parapet/sample.qss +22 -0
  60. data/app/controllers/parapet/application_controller.rb +54 -0
  61. data/app/controllers/parapet/base_controller.rb +18 -0
  62. data/app/controllers/parapet/build_suite/dashboard_controller.rb +10 -0
  63. data/app/controllers/parapet/css_suite/compiler_controller.rb +95 -0
  64. data/app/controllers/parapet/css_suite/dashboard_controller.rb +10 -0
  65. data/app/controllers/parapet/css_suite/preview_controller.rb +46 -0
  66. data/app/controllers/parapet/dashboard_controller.rb +8 -0
  67. data/app/controllers/parapet/drafts_controller.rb +30 -0
  68. data/app/controllers/parapet/explorers_controller.rb +53 -0
  69. data/app/controllers/parapet/files_controller.rb +208 -0
  70. data/app/controllers/parapet/footers_controller.rb +24 -0
  71. data/app/controllers/parapet/intentions_suite/dashboard_controller.rb +10 -0
  72. data/app/controllers/parapet/landing_controller.rb +14 -0
  73. data/app/controllers/parapet/monitor_suite/dashboard_controller.rb +10 -0
  74. data/app/controllers/parapet/pm_suite/publish_controller.rb +16 -0
  75. data/app/controllers/parapet/polyglot_suite/dashboard_controller.rb +10 -0
  76. data/app/controllers/parapet/runner_controller.rb +34 -0
  77. data/app/controllers/parapet/sessions_controller.rb +35 -0
  78. data/app/controllers/parapet/signal_suite/dashboard_controller.rb +10 -0
  79. data/app/controllers/parapet/test_suite/dashboard_controller.rb +10 -0
  80. data/app/controllers/parapet/widgets_controller.rb +33 -0
  81. data/app/helpers/parapet/application_helper.rb +23 -0
  82. data/app/helpers/parapet/icon_helper.rb +57 -0
  83. data/app/jobs/parapet/application_job.rb +4 -0
  84. data/app/mailers/parapet/application_mailer.rb +6 -0
  85. data/app/models/parapet/activity.rb +14 -0
  86. data/app/models/parapet/application_record.rb +5 -0
  87. data/app/models/parapet/current.rb +6 -0
  88. data/app/models/parapet/draft_recovery.rb +9 -0
  89. data/app/models/parapet/internal_record.rb +34 -0
  90. data/app/models/parapet/run_history.rb +22 -0
  91. data/app/models/parapet/runtime_setting.rb +8 -0
  92. data/app/models/parapet/session.rb +7 -0
  93. data/app/models/parapet/suite_assignment.rb +30 -0
  94. data/app/models/parapet/user.rb +12 -0
  95. data/app/services/parapet/activity_phrase_renderer.rb +35 -0
  96. data/app/services/parapet/activity_writer.rb +26 -0
  97. data/app/services/parapet/authorization.rb +198 -0
  98. data/app/services/parapet/consistency_auditor.rb +58 -0
  99. data/app/services/parapet/directory_scanner.rb +159 -0
  100. data/app/services/parapet/draft_recovery_store.rb +18 -0
  101. data/app/services/parapet/explorer_manager.rb +402 -0
  102. data/app/services/parapet/file_save_service.rb +21 -0
  103. data/app/services/parapet/git_side_ref_committer.rb +50 -0
  104. data/app/services/parapet/noun_discovery.rb +26 -0
  105. data/app/services/parapet/publish_gate.rb +83 -0
  106. data/app/services/parapet/test_runner.rb +178 -0
  107. data/app/views/layouts/parapet/application.html.erb +83 -0
  108. data/app/views/layouts/parapet/landing.html.erb +19 -0
  109. data/app/views/parapet/activities/_ai_error_explainer.html.erb +33 -0
  110. data/app/views/parapet/activities/_ai_explainer_widget.html.erb +20 -0
  111. data/app/views/parapet/activities/_calendar_widget.html.erb +31 -0
  112. data/app/views/parapet/activities/_code_snippets_widget.html.erb +22 -0
  113. data/app/views/parapet/activities/_coverage_explorer.html.erb +1 -0
  114. data/app/views/parapet/activities/_dropdown_test.html.erb +20 -0
  115. data/app/views/parapet/activities/_explorer_node.html.erb +102 -0
  116. data/app/views/parapet/activities/_explorer_tree.html.erb +16 -0
  117. data/app/views/parapet/activities/_file_editor.html.erb +183 -0
  118. data/app/views/parapet/activities/_file_explorer.html.erb +23 -0
  119. data/app/views/parapet/activities/_fix_suggestions_widget.html.erb +13 -0
  120. data/app/views/parapet/activities/_generic.html.erb +6 -0
  121. data/app/views/parapet/activities/_live_preview.html.erb +13 -0
  122. data/app/views/parapet/activities/_perspective_filters.html.erb +36 -0
  123. data/app/views/parapet/activities/_progress_area.html.erb +37 -0
  124. data/app/views/parapet/activities/_project_explorer.html.erb +1 -0
  125. data/app/views/parapet/activities/_registry_explorer.html.erb +1 -0
  126. data/app/views/parapet/activities/_run_history.html.erb +2 -0
  127. data/app/views/parapet/activities/_smart_search.html.erb +11 -0
  128. data/app/views/parapet/activities/file_explorer/_perspective_scripts.html.erb +58 -0
  129. data/app/views/parapet/activities/file_explorer/_perspectives.html.erb +0 -0
  130. data/app/views/parapet/activities/file_explorer/_viewport_scripts.html.erb +33 -0
  131. data/app/views/parapet/css_suite/_workbench.html.erb +51 -0
  132. data/app/views/parapet/dashboards/index.html.erb +113 -0
  133. data/app/views/parapet/debug_panel.html.erb +79 -0
  134. data/app/views/parapet/debug_panel_tailwind.html.erb +98 -0
  135. data/app/views/parapet/erb_patch_test.html.erb +5 -0
  136. data/app/views/parapet/explorers/show.html.erb +1 -0
  137. data/app/views/parapet/git_viewer.html.erb +62 -0
  138. data/app/views/parapet/git_viewer_after.html.erb +14 -0
  139. data/app/views/parapet/git_viewer_before.html.erb +14 -0
  140. data/app/views/parapet/git_viewer_governed.html.erb +88 -0
  141. data/app/views/parapet/git_viewer_governed_after.html.erb +36 -0
  142. data/app/views/parapet/git_viewer_governed_before.html.erb +36 -0
  143. data/app/views/parapet/git_viewer_tailwind.html.erb +88 -0
  144. data/app/views/parapet/git_viewer_thin_wrapper.html.erb +85 -0
  145. data/app/views/parapet/hierarchical_layout_test.html.erb +85 -0
  146. data/app/views/parapet/hybrid_stress_test.html.erb +25 -0
  147. data/app/views/parapet/index.html.erb +35 -0
  148. data/app/views/parapet/mutation_stress_test.html.erb +82 -0
  149. data/app/views/parapet/recursive_anchoring_test.html.erb +66 -0
  150. data/app/views/parapet/sessions/new.html.erb +28 -0
  151. data/app/views/parapet/shared/_cad_inspector.html.erb +92 -0
  152. data/app/views/parapet/shared/_discovery_sidebar.html.erb +48 -0
  153. data/app/views/parapet/shared/_explorer_bar.html.erb +71 -0
  154. data/app/views/parapet/shared/_footer.html.erb +10 -0
  155. data/app/views/parapet/shared/_footer_ideas.html.erb +36 -0
  156. data/app/views/parapet/shared/_footer_languages.html.erb +33 -0
  157. data/app/views/parapet/shared/_footer_pulse.html.erb +33 -0
  158. data/app/views/parapet/shared/_footer_state.html.erb +33 -0
  159. data/app/views/parapet/shared/_footer_styles.html.erb +37 -0
  160. data/app/views/parapet/shared/_footer_tests.html.erb +39 -0
  161. data/app/views/parapet/shared/_footer_traffic.html.erb +45 -0
  162. data/app/views/parapet/shared/_global_nav.html.erb +55 -0
  163. data/app/views/parapet/shared/_head.html.erb +4 -0
  164. data/app/views/parapet/shared/_header.html.erb +20 -0
  165. data/app/views/parapet/shared/_object_inspector.html.erb +76 -0
  166. data/app/views/parapet/shared/_ribbon_header.html.erb +3 -0
  167. data/app/views/parapet/shared/_root_selector_modal.html.erb +15 -0
  168. data/app/views/parapet/shared/_tab_bar.html.erb +62 -0
  169. data/app/views/parapet/shared/activities_ribbon/_agent_group.html.erb +15 -0
  170. data/app/views/parapet/shared/activities_ribbon/_analysis_group.html.erb +15 -0
  171. data/app/views/parapet/shared/activities_ribbon/_architect_group.html.erb +21 -0
  172. data/app/views/parapet/shared/activities_ribbon/_explorer_group.html.erb +12 -0
  173. data/app/views/parapet/shared/activities_ribbon/_inspector_group.html.erb +15 -0
  174. data/app/views/parapet/shared/activities_ribbon/_proficiency_filter.html.erb +24 -0
  175. data/app/views/parapet/shared/activities_ribbon/_runner_group.html.erb +21 -0
  176. data/app/views/parapet/shared/activities_ribbon/_spatial_inspector_group.html.erb +18 -0
  177. data/app/views/parapet/shared/activities_ribbon/_studio_group.html.erb +18 -0
  178. data/app/views/parapet/shared/activities_ribbon/_stylist_group.html.erb +18 -0
  179. data/app/views/parapet/shared/explorers/_base.html.erb +107 -0
  180. data/app/views/parapet/shared/explorers/_css.html.erb +1 -0
  181. data/app/views/parapet/shared/explorers/_intentions.html.erb +1 -0
  182. data/app/views/parapet/shared/explorers/_project.html.erb +1 -0
  183. data/app/views/parapet/shared/explorers/_tests.html.erb +1 -0
  184. data/app/views/parapet/shared/head/_meta.html.erb +3 -0
  185. data/app/views/parapet/shared/head/_styles_activities.html.erb +152 -0
  186. data/app/views/parapet/shared/head/_styles_shared.html.erb +52 -0
  187. data/app/views/parapet/shared/head/_styles_workspace.html.erb +67 -0
  188. data/app/views/parapet/shared/ribbon_header/_diagnostic_controls.html.erb +17 -0
  189. data/app/views/parapet/shared/ribbon_header/_execution_controls.html.erb +28 -0
  190. data/app/views/parapet/shared/ribbon_header/_focus_search.html.erb +5 -0
  191. data/app/views/parapet/shared/root_selector/_header.html.erb +10 -0
  192. data/app/views/parapet/shared/root_selector/_path_input.html.erb +13 -0
  193. data/app/views/parapet/shared/root_selector/_quick_select.html.erb +20 -0
  194. data/app/views/parapet/shared/root_selector/_scripts.html.erb +61 -0
  195. data/app/views/parapet/shared/root_selector/_warning.html.erb +11 -0
  196. data/app/views/parapet/shared/widgets/_base.html.erb +6 -0
  197. data/app/views/parapet/shared/widgets/_css.html.erb +79 -0
  198. data/app/views/parapet/widgets/_explainer.html.erb +17 -0
  199. data/app/views/parapet/widgets/_hotkeys.html.erb +20 -0
  200. data/app/views/parapet/widgets/_search.html.erb +68 -0
  201. data/app/views/parapet/widgets/_spatial_inspector.html.erb +54 -0
  202. data/app/views/parapet/widgets/_widget-explainer.html.erb +17 -0
  203. data/app/views/parapet/widgets/_widget-hotkeys.html.erb +20 -0
  204. data/app/views/parapet/widgets/_widget-search.html.erb +68 -0
  205. data/app/views/parapet/widgets/_widget-snippets.html.erb +18 -0
  206. data/app/views/parapet/widgets/_widget-suggestions.html.erb +15 -0
  207. data/app/views/parapet/widgets/show.html.erb +3 -0
  208. data/app/views/shared/_footer.html.erb +0 -0
  209. data/config/parapet/qss_config.yml +117 -0
  210. data/config/parapet/qss_registry.yml +14 -0
  211. data/config/routes.rb +40 -0
  212. data/db/migrate/20260916035300_create_run_histories.rb +16 -0
  213. data/db/migrate/20261002000000_expand_run_histories_for_activity_tracking.rb +7 -0
  214. data/db/parapet_migrate/20260929184200_create_parapet_users.rb +12 -0
  215. data/db/parapet_migrate/20260929184300_create_parapet_sessions.rb +9 -0
  216. data/db/parapet_migrate/20260930000000_create_parapet_runtime_settings.rb +12 -0
  217. data/db/parapet_migrate/20260930000100_create_parapet_suite_assignments.rb +14 -0
  218. data/db/parapet_migrate/20261002000000_create_parapet_activities.rb +16 -0
  219. data/db/parapet_migrate/20261002000100_create_parapet_draft_recoveries.rb +13 -0
  220. data/db/parapet_schema.rb +64 -0
  221. data/db/schema.rb +21 -0
  222. data/db/schema.released.rb +0 -0
  223. data/lib/parapet/engine.rb +11 -0
  224. data/lib/parapet/environment_guard.rb +14 -0
  225. data/lib/parapet/version.rb +3 -0
  226. data/lib/parapet-rails.rb +1 -0
  227. data/lib/parapet.rb +59 -0
  228. data/lib/tasks/parapet_qss.rake +26 -0
  229. data/lib/tasks/parapet_tasks.rake +25 -0
  230. data/lib/tasks/randomize_explorer_health.rb +101 -0
  231. metadata +423 -0
@@ -0,0 +1,53 @@
1
+ // Proficiency Filter Logic
2
+ (function() {
3
+ let selectedLevel = localStorage.getItem('parapet-proficiency-level') !== null
4
+ ? parseInt(localStorage.getItem('parapet-proficiency-level'))
5
+ : -1;
6
+
7
+ function updateProficiencyUI() {
8
+ const chevronHitboxes = document.querySelectorAll('.qss-chevron-hitbox');
9
+ const activityItems = document.querySelectorAll('.qss-activity-item');
10
+ const proficiencyTargets = document.querySelectorAll('.qss-proficiency-target');
11
+
12
+ chevronHitboxes.forEach((hitbox, index) => {
13
+ if (selectedLevel === -1 || index <= selectedLevel) {
14
+ hitbox.classList.remove('off');
15
+ } else {
16
+ hitbox.classList.add('off');
17
+ }
18
+ });
19
+
20
+ activityItems.forEach(item => {
21
+ const itemLevel = parseInt(item.getAttribute('data-proficiency'));
22
+ item.style.display = (selectedLevel === -1 || itemLevel <= selectedLevel) ? 'flex' : 'none';
23
+ });
24
+
25
+ proficiencyTargets.forEach(target => {
26
+ const targetLevel = parseInt(target.getAttribute('data-proficiency'));
27
+ target.style.display = (selectedLevel === -1 || targetLevel <= selectedLevel) ? '' : 'none';
28
+ });
29
+
30
+ localStorage.setItem('parapet-proficiency-level', selectedLevel);
31
+ document.dispatchEvent(new CustomEvent('proficiencyChanged', { detail: { level: selectedLevel } }));
32
+ }
33
+
34
+ document.addEventListener('click', (e) => {
35
+ const hitbox = e.target.closest('.qss-chevron-hitbox');
36
+ if (!hitbox) return;
37
+
38
+ const level = parseInt(hitbox.getAttribute('data-level'));
39
+ if (isNaN(level)) return;
40
+
41
+ selectedLevel = (selectedLevel === level) ? level - 1 : level;
42
+ updateProficiencyUI();
43
+ });
44
+
45
+ function init() {
46
+ if (!document.querySelector('.qss-chevron-hitbox')) return;
47
+ updateProficiencyUI();
48
+ }
49
+
50
+ document.addEventListener('DOMContentLoaded', init);
51
+ document.addEventListener('turbo:load', init);
52
+ init();
53
+ })();
@@ -0,0 +1,197 @@
1
+ (function() {
2
+ console.log("SidebarResizer: Multi-Column & CSS Inspector Spatial Engine starting...");
3
+
4
+ const MIN_WIDTH = 200;
5
+ const MAX_WIDTH = 500;
6
+ const MIN_CONSOLE_HEIGHT = 24;
7
+ const MAX_CONSOLE_HEIGHT = 600;
8
+ const DEFAULT_CONSOLE_EXPANDED = 180;
9
+
10
+ let leftSidebar = {
11
+ el: null,
12
+ handle: null,
13
+ storageKey: 'parapet-sidebar-left-width',
14
+ defaultWidth: 250,
15
+ originOffset: 48,
16
+ workspaceProp: 'left',
17
+ isResizing: false
18
+ };
19
+
20
+ let rightSidebar = {
21
+ el: null,
22
+ handle: null,
23
+ storageKey: 'parapet-sidebar-right-width',
24
+ defaultWidth: 300,
25
+ originOffset: 0,
26
+ workspaceProp: 'right',
27
+ isResizing: false
28
+ };
29
+
30
+ let cssInspector = {
31
+ el: null,
32
+ handle: null,
33
+ trigger: null,
34
+ icon: null,
35
+ storageKey: 'parapet-css-inspector-height',
36
+ isResizing: false,
37
+ lastHeight: DEFAULT_CONSOLE_EXPANDED
38
+ };
39
+
40
+ let wrapper = null;
41
+
42
+ function init() {
43
+ wrapper = document.getElementById('pp-workspace-wrapper');
44
+
45
+ // Initialize Left
46
+ leftSidebar.el = document.getElementById('pp-left-sidebar');
47
+ leftSidebar.handle = document.getElementById('pp-sidebar-resizer');
48
+
49
+ // Initialize Right
50
+ rightSidebar.el = document.getElementById('pp-right-sidebar');
51
+ rightSidebar.handle = document.getElementById('pp-right-resizer');
52
+
53
+ // Initialize CSS Inspector
54
+ cssInspector.el = document.getElementById('pp-workspace-console');
55
+ cssInspector.handle = document.getElementById('pp-console-resizer');
56
+ cssInspector.trigger = document.querySelector('.qss-console-trigger');
57
+ cssInspector.icon = document.querySelector('.qss-console-chevron');
58
+
59
+ if (leftSidebar.el && leftSidebar.handle) setupResizer(leftSidebar);
60
+ if (rightSidebar.el && rightSidebar.handle) setupResizer(rightSidebar);
61
+ if (cssInspector.el && cssInspector.handle) setupConsoleResizer();
62
+
63
+ document.addEventListener('mousemove', handleMouseMove);
64
+ document.addEventListener('mouseup', stopResizing);
65
+ }
66
+
67
+ function setupResizer(sidebar) {
68
+ const saved = localStorage.getItem(sidebar.storageKey);
69
+ applyWidth(sidebar, saved ? parseInt(saved) : sidebar.defaultWidth);
70
+
71
+ sidebar.handle.addEventListener('mousedown', (e) => {
72
+ e.preventDefault();
73
+ sidebar.isResizing = true;
74
+ sidebar.handle.classList.add('qss-resizing');
75
+ document.body.style.cursor = 'col-resize';
76
+ document.body.style.userSelect = 'none';
77
+ });
78
+ }
79
+
80
+ function setupConsoleResizer() {
81
+ const saved = localStorage.getItem(cssInspector.storageKey);
82
+ const height = saved ? parseInt(saved) : MIN_CONSOLE_HEIGHT;
83
+
84
+ // If it was saved as expanded (>24), store that as lastHeight
85
+ if (height > MIN_CONSOLE_HEIGHT) {
86
+ cssInspector.lastHeight = height;
87
+ applyConsoleHeight(height);
88
+ } else {
89
+ applyConsoleHeight(MIN_CONSOLE_HEIGHT);
90
+ }
91
+
92
+ cssInspector.handle.addEventListener('mousedown', (e) => {
93
+ e.preventDefault();
94
+ cssInspector.isResizing = true;
95
+ cssInspector.handle.classList.add('qss-resizing');
96
+ document.body.style.cursor = 'row-resize';
97
+ document.body.style.userSelect = 'none';
98
+ });
99
+
100
+ if (cssInspector.trigger) {
101
+ cssInspector.trigger.addEventListener('click', toggleConsole);
102
+ }
103
+ }
104
+
105
+ function toggleConsole() {
106
+ const currentHeight = cssInspector.el.offsetHeight;
107
+ if (currentHeight <= MIN_CONSOLE_HEIGHT) {
108
+ // Expand
109
+ applyConsoleHeight(cssInspector.lastHeight);
110
+ } else {
111
+ // Collapse
112
+ cssInspector.lastHeight = currentHeight;
113
+ applyConsoleHeight(MIN_CONSOLE_HEIGHT);
114
+ }
115
+ }
116
+
117
+ function applyConsoleHeight(height) {
118
+ height = Math.max(MIN_CONSOLE_HEIGHT, Math.min(MAX_CONSOLE_HEIGHT, height));
119
+ cssInspector.el.style.height = `${height}px`;
120
+
121
+ if (height > MIN_CONSOLE_HEIGHT) {
122
+ cssInspector.el.classList.add('qss-is-expanded');
123
+ } else {
124
+ cssInspector.el.classList.remove('qss-is-expanded');
125
+ }
126
+
127
+ localStorage.setItem(cssInspector.storageKey, height);
128
+ }
129
+
130
+ function handleMouseMove(e) {
131
+ if (leftSidebar.isResizing) {
132
+ const newWidth = e.clientX - leftSidebar.originOffset;
133
+ applyWidth(leftSidebar, newWidth);
134
+ }
135
+ if (rightSidebar.isResizing) {
136
+ const newWidth = window.innerWidth - e.clientX - rightSidebar.originOffset;
137
+ applyWidth(rightSidebar, newWidth);
138
+ }
139
+ if (cssInspector.isResizing) {
140
+ const newHeight = window.innerHeight - e.clientY - 24; // 24 is footer height
141
+ applyConsoleHeight(newHeight);
142
+ if (newHeight > MIN_CONSOLE_HEIGHT) {
143
+ cssInspector.lastHeight = newHeight;
144
+ }
145
+ }
146
+ }
147
+
148
+ function stopResizing() {
149
+ [leftSidebar, rightSidebar].forEach(sidebar => {
150
+ if (sidebar.isResizing) {
151
+ sidebar.isResizing = false;
152
+ sidebar.handle.classList.remove('qss-resizing');
153
+ localStorage.setItem(sidebar.storageKey, parseInt(sidebar.el.style.width));
154
+ }
155
+ });
156
+
157
+ if (cssInspector.isResizing) {
158
+ cssInspector.isResizing = false;
159
+ cssInspector.handle.classList.remove('qss-resizing');
160
+ localStorage.setItem(cssInspector.storageKey, parseInt(cssInspector.el.style.height));
161
+ }
162
+
163
+ document.body.style.cursor = 'default';
164
+ document.body.style.userSelect = 'auto';
165
+ }
166
+
167
+ function applyWidth(sidebar, width) {
168
+ width = Math.max(MIN_WIDTH, Math.min(MAX_WIDTH, width));
169
+ const w = `${width}px`;
170
+
171
+ const stripSpatial = (el, props = ['pos-x', 'pos-r', 'w']) => {
172
+ if (!el) return;
173
+ const regex = new RegExp(`qss-(${props.join('|')})\\[[^\\]]+\\]`, 'g');
174
+ el.className = el.className.replace(regex, '').trim();
175
+ };
176
+
177
+ stripSpatial(sidebar.el, ['w']);
178
+ sidebar.el.style.width = w;
179
+
180
+ if (sidebar.workspaceProp === 'left') {
181
+ stripSpatial(sidebar.handle, ['pos-x']);
182
+ sidebar.handle.style.left = `${sidebar.originOffset + width - 5}px`;
183
+
184
+ stripSpatial(wrapper, ['pos-x']);
185
+ if (wrapper) wrapper.style.left = `${sidebar.originOffset + width}px`;
186
+ } else {
187
+ stripSpatial(sidebar.handle, ['pos-x', 'pos-r']);
188
+ sidebar.handle.style.right = `${sidebar.originOffset + width - 5}px`;
189
+
190
+ stripSpatial(wrapper, ['pos-r']);
191
+ if (wrapper) wrapper.style.right = `${sidebar.originOffset + width}px`;
192
+ }
193
+ }
194
+
195
+ document.addEventListener('turbo:load', init);
196
+ if (document.readyState === 'complete') init();
197
+ })();