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.
- checksums.yaml +7 -0
- data/MIT-LICENSE +20 -0
- data/README.md +48 -0
- data/Rakefile +7 -0
- data/app/assets/config/parapet/grammar-registry.json +52 -0
- data/app/assets/images/parapet/icons/activities/component-inspector.svg +4 -0
- data/app/assets/images/parapet/icons/activities/coverage-heatmap.svg +3 -0
- data/app/assets/images/parapet/icons/activities/discovery-sidebar.svg +3 -0
- data/app/assets/images/parapet/icons/activities/environment-toggles.svg +4 -0
- data/app/assets/images/parapet/icons/activities/failure-inspector.svg +5 -0
- data/app/assets/images/parapet/icons/activities/flaky-history.svg +3 -0
- data/app/assets/images/parapet/icons/activities/flight-recorder.svg +5 -0
- data/app/assets/images/parapet/icons/activities/health-graph.svg +3 -0
- data/app/assets/images/parapet/icons/activities/injection-engine.svg +3 -0
- data/app/assets/images/parapet/icons/activities/live-sql-stream.svg +5 -0
- data/app/assets/images/parapet/icons/activities/live-web-preview.svg +4 -0
- data/app/assets/images/parapet/icons/activities/monaco-editor.svg +5 -0
- data/app/assets/images/parapet/icons/activities/progress-area.svg +3 -0
- data/app/assets/images/parapet/icons/activities/registry-metadata.svg +5 -0
- data/app/assets/images/parapet/icons/activities/seed-inspector.svg +4 -0
- data/app/assets/images/parapet/icons/activities/slow-test-bottlenecks.svg +4 -0
- data/app/assets/images/parapet/icons/activities/smart-search.svg +4 -0
- data/app/assets/images/parapet/icons/activities/snippet-library.svg +4 -0
- data/app/assets/images/parapet/icons/activities/terminal.svg +4 -0
- data/app/assets/images/parapet/icons/activities/unified-schema-view.svg +4 -0
- data/app/assets/images/parapet/icons/activities/visual-comparison.svg +3 -0
- data/app/assets/images/parapet/icons/activities/visual-summary-bar.svg +5 -0
- data/app/assets/images/parapet/icons/nav/ideas.svg +4 -0
- data/app/assets/images/parapet/icons/nav/languages.svg +8 -0
- data/app/assets/images/parapet/icons/nav/profile.svg +4 -0
- data/app/assets/images/parapet/icons/nav/pulse.svg +7 -0
- data/app/assets/images/parapet/icons/nav/settings.svg +4 -0
- data/app/assets/images/parapet/icons/nav/state.svg +5 -0
- data/app/assets/images/parapet/icons/nav/styles.svg +7 -0
- data/app/assets/images/parapet/icons/nav/tests.svg +4 -0
- data/app/assets/images/parapet/icons/nav/traffic.svg +12 -0
- data/app/assets/javascripts/parapet/activity-card.js +439 -0
- data/app/assets/javascripts/parapet/activity-cards.js +291 -0
- data/app/assets/javascripts/parapet/activity-registry.js +181 -0
- data/app/assets/javascripts/parapet/activity-toggles.js +76 -0
- data/app/assets/javascripts/parapet/application.js +37 -0
- data/app/assets/javascripts/parapet/card-failure-inspector.js +134 -0
- data/app/assets/javascripts/parapet/card-file-editor.js +1722 -0
- data/app/assets/javascripts/parapet/card-progress-area.js +297 -0
- data/app/assets/javascripts/parapet/card-smart-search.js +114 -0
- data/app/assets/javascripts/parapet/card-snippet-library.js +251 -0
- data/app/assets/javascripts/parapet/explorer-resizer.js +92 -0
- data/app/assets/javascripts/parapet/parapet_qss.js +342 -0
- data/app/assets/javascripts/parapet/proficiency-filter.js +53 -0
- data/app/assets/javascripts/parapet/sidebar-resizer.js +197 -0
- data/app/assets/javascripts/parapet/styles-workbench.js +819 -0
- data/app/assets/javascripts/parapet/tree-logic.js +320 -0
- data/app/assets/stylesheets/parapet/_qss_variables.scss +122 -0
- data/app/assets/stylesheets/parapet/parapet_qss.scss +69 -0
- data/app/assets/stylesheets/parapet/qss_application.css +260940 -0
- data/app/assets/stylesheets/parapet/qss_application.css.map +1 -0
- data/app/assets/stylesheets/parapet/qss_application.scss +5 -0
- data/app/assets/stylesheets/parapet/qss_workspace.scss +209 -0
- data/app/assets/stylesheets/parapet/sample.qss +22 -0
- data/app/controllers/parapet/application_controller.rb +54 -0
- data/app/controllers/parapet/base_controller.rb +18 -0
- data/app/controllers/parapet/build_suite/dashboard_controller.rb +10 -0
- data/app/controllers/parapet/css_suite/compiler_controller.rb +95 -0
- data/app/controllers/parapet/css_suite/dashboard_controller.rb +10 -0
- data/app/controllers/parapet/css_suite/preview_controller.rb +46 -0
- data/app/controllers/parapet/dashboard_controller.rb +8 -0
- data/app/controllers/parapet/drafts_controller.rb +30 -0
- data/app/controllers/parapet/explorers_controller.rb +53 -0
- data/app/controllers/parapet/files_controller.rb +208 -0
- data/app/controllers/parapet/footers_controller.rb +24 -0
- data/app/controllers/parapet/intentions_suite/dashboard_controller.rb +10 -0
- data/app/controllers/parapet/landing_controller.rb +14 -0
- data/app/controllers/parapet/monitor_suite/dashboard_controller.rb +10 -0
- data/app/controllers/parapet/pm_suite/publish_controller.rb +16 -0
- data/app/controllers/parapet/polyglot_suite/dashboard_controller.rb +10 -0
- data/app/controllers/parapet/runner_controller.rb +34 -0
- data/app/controllers/parapet/sessions_controller.rb +35 -0
- data/app/controllers/parapet/signal_suite/dashboard_controller.rb +10 -0
- data/app/controllers/parapet/test_suite/dashboard_controller.rb +10 -0
- data/app/controllers/parapet/widgets_controller.rb +33 -0
- data/app/helpers/parapet/application_helper.rb +23 -0
- data/app/helpers/parapet/icon_helper.rb +57 -0
- data/app/jobs/parapet/application_job.rb +4 -0
- data/app/mailers/parapet/application_mailer.rb +6 -0
- data/app/models/parapet/activity.rb +14 -0
- data/app/models/parapet/application_record.rb +5 -0
- data/app/models/parapet/current.rb +6 -0
- data/app/models/parapet/draft_recovery.rb +9 -0
- data/app/models/parapet/internal_record.rb +34 -0
- data/app/models/parapet/run_history.rb +22 -0
- data/app/models/parapet/runtime_setting.rb +8 -0
- data/app/models/parapet/session.rb +7 -0
- data/app/models/parapet/suite_assignment.rb +30 -0
- data/app/models/parapet/user.rb +12 -0
- data/app/services/parapet/activity_phrase_renderer.rb +35 -0
- data/app/services/parapet/activity_writer.rb +26 -0
- data/app/services/parapet/authorization.rb +198 -0
- data/app/services/parapet/consistency_auditor.rb +58 -0
- data/app/services/parapet/directory_scanner.rb +159 -0
- data/app/services/parapet/draft_recovery_store.rb +18 -0
- data/app/services/parapet/explorer_manager.rb +402 -0
- data/app/services/parapet/file_save_service.rb +21 -0
- data/app/services/parapet/git_side_ref_committer.rb +50 -0
- data/app/services/parapet/noun_discovery.rb +26 -0
- data/app/services/parapet/publish_gate.rb +83 -0
- data/app/services/parapet/test_runner.rb +178 -0
- data/app/views/layouts/parapet/application.html.erb +83 -0
- data/app/views/layouts/parapet/landing.html.erb +19 -0
- data/app/views/parapet/activities/_ai_error_explainer.html.erb +33 -0
- data/app/views/parapet/activities/_ai_explainer_widget.html.erb +20 -0
- data/app/views/parapet/activities/_calendar_widget.html.erb +31 -0
- data/app/views/parapet/activities/_code_snippets_widget.html.erb +22 -0
- data/app/views/parapet/activities/_coverage_explorer.html.erb +1 -0
- data/app/views/parapet/activities/_dropdown_test.html.erb +20 -0
- data/app/views/parapet/activities/_explorer_node.html.erb +102 -0
- data/app/views/parapet/activities/_explorer_tree.html.erb +16 -0
- data/app/views/parapet/activities/_file_editor.html.erb +183 -0
- data/app/views/parapet/activities/_file_explorer.html.erb +23 -0
- data/app/views/parapet/activities/_fix_suggestions_widget.html.erb +13 -0
- data/app/views/parapet/activities/_generic.html.erb +6 -0
- data/app/views/parapet/activities/_live_preview.html.erb +13 -0
- data/app/views/parapet/activities/_perspective_filters.html.erb +36 -0
- data/app/views/parapet/activities/_progress_area.html.erb +37 -0
- data/app/views/parapet/activities/_project_explorer.html.erb +1 -0
- data/app/views/parapet/activities/_registry_explorer.html.erb +1 -0
- data/app/views/parapet/activities/_run_history.html.erb +2 -0
- data/app/views/parapet/activities/_smart_search.html.erb +11 -0
- data/app/views/parapet/activities/file_explorer/_perspective_scripts.html.erb +58 -0
- data/app/views/parapet/activities/file_explorer/_perspectives.html.erb +0 -0
- data/app/views/parapet/activities/file_explorer/_viewport_scripts.html.erb +33 -0
- data/app/views/parapet/css_suite/_workbench.html.erb +51 -0
- data/app/views/parapet/dashboards/index.html.erb +113 -0
- data/app/views/parapet/debug_panel.html.erb +79 -0
- data/app/views/parapet/debug_panel_tailwind.html.erb +98 -0
- data/app/views/parapet/erb_patch_test.html.erb +5 -0
- data/app/views/parapet/explorers/show.html.erb +1 -0
- data/app/views/parapet/git_viewer.html.erb +62 -0
- data/app/views/parapet/git_viewer_after.html.erb +14 -0
- data/app/views/parapet/git_viewer_before.html.erb +14 -0
- data/app/views/parapet/git_viewer_governed.html.erb +88 -0
- data/app/views/parapet/git_viewer_governed_after.html.erb +36 -0
- data/app/views/parapet/git_viewer_governed_before.html.erb +36 -0
- data/app/views/parapet/git_viewer_tailwind.html.erb +88 -0
- data/app/views/parapet/git_viewer_thin_wrapper.html.erb +85 -0
- data/app/views/parapet/hierarchical_layout_test.html.erb +85 -0
- data/app/views/parapet/hybrid_stress_test.html.erb +25 -0
- data/app/views/parapet/index.html.erb +35 -0
- data/app/views/parapet/mutation_stress_test.html.erb +82 -0
- data/app/views/parapet/recursive_anchoring_test.html.erb +66 -0
- data/app/views/parapet/sessions/new.html.erb +28 -0
- data/app/views/parapet/shared/_cad_inspector.html.erb +92 -0
- data/app/views/parapet/shared/_discovery_sidebar.html.erb +48 -0
- data/app/views/parapet/shared/_explorer_bar.html.erb +71 -0
- data/app/views/parapet/shared/_footer.html.erb +10 -0
- data/app/views/parapet/shared/_footer_ideas.html.erb +36 -0
- data/app/views/parapet/shared/_footer_languages.html.erb +33 -0
- data/app/views/parapet/shared/_footer_pulse.html.erb +33 -0
- data/app/views/parapet/shared/_footer_state.html.erb +33 -0
- data/app/views/parapet/shared/_footer_styles.html.erb +37 -0
- data/app/views/parapet/shared/_footer_tests.html.erb +39 -0
- data/app/views/parapet/shared/_footer_traffic.html.erb +45 -0
- data/app/views/parapet/shared/_global_nav.html.erb +55 -0
- data/app/views/parapet/shared/_head.html.erb +4 -0
- data/app/views/parapet/shared/_header.html.erb +20 -0
- data/app/views/parapet/shared/_object_inspector.html.erb +76 -0
- data/app/views/parapet/shared/_ribbon_header.html.erb +3 -0
- data/app/views/parapet/shared/_root_selector_modal.html.erb +15 -0
- data/app/views/parapet/shared/_tab_bar.html.erb +62 -0
- data/app/views/parapet/shared/activities_ribbon/_agent_group.html.erb +15 -0
- data/app/views/parapet/shared/activities_ribbon/_analysis_group.html.erb +15 -0
- data/app/views/parapet/shared/activities_ribbon/_architect_group.html.erb +21 -0
- data/app/views/parapet/shared/activities_ribbon/_explorer_group.html.erb +12 -0
- data/app/views/parapet/shared/activities_ribbon/_inspector_group.html.erb +15 -0
- data/app/views/parapet/shared/activities_ribbon/_proficiency_filter.html.erb +24 -0
- data/app/views/parapet/shared/activities_ribbon/_runner_group.html.erb +21 -0
- data/app/views/parapet/shared/activities_ribbon/_spatial_inspector_group.html.erb +18 -0
- data/app/views/parapet/shared/activities_ribbon/_studio_group.html.erb +18 -0
- data/app/views/parapet/shared/activities_ribbon/_stylist_group.html.erb +18 -0
- data/app/views/parapet/shared/explorers/_base.html.erb +107 -0
- data/app/views/parapet/shared/explorers/_css.html.erb +1 -0
- data/app/views/parapet/shared/explorers/_intentions.html.erb +1 -0
- data/app/views/parapet/shared/explorers/_project.html.erb +1 -0
- data/app/views/parapet/shared/explorers/_tests.html.erb +1 -0
- data/app/views/parapet/shared/head/_meta.html.erb +3 -0
- data/app/views/parapet/shared/head/_styles_activities.html.erb +152 -0
- data/app/views/parapet/shared/head/_styles_shared.html.erb +52 -0
- data/app/views/parapet/shared/head/_styles_workspace.html.erb +67 -0
- data/app/views/parapet/shared/ribbon_header/_diagnostic_controls.html.erb +17 -0
- data/app/views/parapet/shared/ribbon_header/_execution_controls.html.erb +28 -0
- data/app/views/parapet/shared/ribbon_header/_focus_search.html.erb +5 -0
- data/app/views/parapet/shared/root_selector/_header.html.erb +10 -0
- data/app/views/parapet/shared/root_selector/_path_input.html.erb +13 -0
- data/app/views/parapet/shared/root_selector/_quick_select.html.erb +20 -0
- data/app/views/parapet/shared/root_selector/_scripts.html.erb +61 -0
- data/app/views/parapet/shared/root_selector/_warning.html.erb +11 -0
- data/app/views/parapet/shared/widgets/_base.html.erb +6 -0
- data/app/views/parapet/shared/widgets/_css.html.erb +79 -0
- data/app/views/parapet/widgets/_explainer.html.erb +17 -0
- data/app/views/parapet/widgets/_hotkeys.html.erb +20 -0
- data/app/views/parapet/widgets/_search.html.erb +68 -0
- data/app/views/parapet/widgets/_spatial_inspector.html.erb +54 -0
- data/app/views/parapet/widgets/_widget-explainer.html.erb +17 -0
- data/app/views/parapet/widgets/_widget-hotkeys.html.erb +20 -0
- data/app/views/parapet/widgets/_widget-search.html.erb +68 -0
- data/app/views/parapet/widgets/_widget-snippets.html.erb +18 -0
- data/app/views/parapet/widgets/_widget-suggestions.html.erb +15 -0
- data/app/views/parapet/widgets/show.html.erb +3 -0
- data/app/views/shared/_footer.html.erb +0 -0
- data/config/parapet/qss_config.yml +117 -0
- data/config/parapet/qss_registry.yml +14 -0
- data/config/routes.rb +40 -0
- data/db/migrate/20260916035300_create_run_histories.rb +16 -0
- data/db/migrate/20261002000000_expand_run_histories_for_activity_tracking.rb +7 -0
- data/db/parapet_migrate/20260929184200_create_parapet_users.rb +12 -0
- data/db/parapet_migrate/20260929184300_create_parapet_sessions.rb +9 -0
- data/db/parapet_migrate/20260930000000_create_parapet_runtime_settings.rb +12 -0
- data/db/parapet_migrate/20260930000100_create_parapet_suite_assignments.rb +14 -0
- data/db/parapet_migrate/20261002000000_create_parapet_activities.rb +16 -0
- data/db/parapet_migrate/20261002000100_create_parapet_draft_recoveries.rb +13 -0
- data/db/parapet_schema.rb +64 -0
- data/db/schema.rb +21 -0
- data/db/schema.released.rb +0 -0
- data/lib/parapet/engine.rb +11 -0
- data/lib/parapet/environment_guard.rb +14 -0
- data/lib/parapet/version.rb +3 -0
- data/lib/parapet-rails.rb +1 -0
- data/lib/parapet.rb +59 -0
- data/lib/tasks/parapet_qss.rake +26 -0
- data/lib/tasks/parapet_tasks.rake +25 -0
- data/lib/tasks/randomize_explorer_health.rb +101 -0
- 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
|
+
})();
|