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,291 @@
|
|
|
1
|
+
(function(global) {
|
|
2
|
+
console.log("ActivityCards: Script execution started");
|
|
3
|
+
|
|
4
|
+
const ActivityCards = {
|
|
5
|
+
active: {},
|
|
6
|
+
DRAG_Z: 1000,
|
|
7
|
+
PROMOTE_Z: 500,
|
|
8
|
+
Z_LEVELS: [10, 20, 30, 40, 500],
|
|
9
|
+
registry: {},
|
|
10
|
+
settings: {
|
|
11
|
+
gridSize: 5,
|
|
12
|
+
autoSave: true
|
|
13
|
+
},
|
|
14
|
+
state: {
|
|
15
|
+
layoutName: 'default',
|
|
16
|
+
lastFocused: null,
|
|
17
|
+
promotedCardId: null,
|
|
18
|
+
cards: {}
|
|
19
|
+
},
|
|
20
|
+
|
|
21
|
+
zLabel: function(z) {
|
|
22
|
+
const idx = this.Z_LEVELS.indexOf(z);
|
|
23
|
+
return idx >= 0 ? String(idx + 1) : '?';
|
|
24
|
+
},
|
|
25
|
+
|
|
26
|
+
getProficiencyLevel: function() {
|
|
27
|
+
const saved = localStorage.getItem('parapet-proficiency-level');
|
|
28
|
+
return saved !== null ? parseInt(saved) : -1;
|
|
29
|
+
},
|
|
30
|
+
|
|
31
|
+
init: function() {
|
|
32
|
+
const saved = localStorage.getItem('parapet-workspace-state');
|
|
33
|
+
if (saved) {
|
|
34
|
+
try {
|
|
35
|
+
this.state = JSON.parse(saved);
|
|
36
|
+
} catch (e) {
|
|
37
|
+
console.warn("ActivityCards: Failed to parse saved state", e);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
this.syncCSS();
|
|
41
|
+
this.initResizeObserver();
|
|
42
|
+
|
|
43
|
+
// Listen for proficiency changes to re-layout
|
|
44
|
+
document.addEventListener('proficiencyChanged', () => {
|
|
45
|
+
this.applyLayout();
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
console.log("ActivityCards: Global object initialized");
|
|
49
|
+
},
|
|
50
|
+
|
|
51
|
+
initResizeObserver: function() {
|
|
52
|
+
const layers = document.querySelector('#pp-workspace-layers');
|
|
53
|
+
if (!layers) return;
|
|
54
|
+
|
|
55
|
+
const observer = new ResizeObserver((entries) => {
|
|
56
|
+
const entry = entries[0];
|
|
57
|
+
if (!entry) return;
|
|
58
|
+
|
|
59
|
+
const { width, height } = entry.contentRect;
|
|
60
|
+
|
|
61
|
+
// Use requestAnimationFrame to ensure we read layout after CSS transition/re-calc
|
|
62
|
+
requestAnimationFrame(() => {
|
|
63
|
+
Object.values(this.active).forEach(card => {
|
|
64
|
+
card.constrainToBoundaries(width, height);
|
|
65
|
+
card.updateElementStyles();
|
|
66
|
+
card.onResize();
|
|
67
|
+
card.saveState();
|
|
68
|
+
});
|
|
69
|
+
});
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
observer.observe(layers);
|
|
73
|
+
},
|
|
74
|
+
|
|
75
|
+
save: function() {
|
|
76
|
+
try {
|
|
77
|
+
localStorage.setItem('parapet-workspace-state', JSON.stringify(this.state));
|
|
78
|
+
} catch(e) {
|
|
79
|
+
console.warn('ActivityCards: state serialization failed —', e.message);
|
|
80
|
+
}
|
|
81
|
+
},
|
|
82
|
+
|
|
83
|
+
updateCardState: function(id, state) {
|
|
84
|
+
this.state.cards[id] = { ...state };
|
|
85
|
+
if (this.settings.autoSave) this.save();
|
|
86
|
+
},
|
|
87
|
+
|
|
88
|
+
getCardState: function(id) {
|
|
89
|
+
return this.state.cards[id] || null;
|
|
90
|
+
},
|
|
91
|
+
|
|
92
|
+
removeCardState: function(id) {
|
|
93
|
+
delete this.state.cards[id];
|
|
94
|
+
if (this.settings.autoSave) this.save();
|
|
95
|
+
},
|
|
96
|
+
|
|
97
|
+
cleanTitle: function(title) {
|
|
98
|
+
if (!title) return '';
|
|
99
|
+
return title.replace(/\s*\([NIAP]\)\s*-\s*\w+\s*$/, '').trim();
|
|
100
|
+
},
|
|
101
|
+
|
|
102
|
+
generateIdFromTitle: function(title) {
|
|
103
|
+
if (!title) return null;
|
|
104
|
+
let id = title.split(' (')[0].toLowerCase().replace(/\s+/g, '-');
|
|
105
|
+
const mapping = {
|
|
106
|
+
'failure-inspector': 'ai-error-explainer',
|
|
107
|
+
'discovery-sidebar': 'discovery-sidebar',
|
|
108
|
+
'live-web-preview': 'live-preview'
|
|
109
|
+
};
|
|
110
|
+
return mapping[id] || id;
|
|
111
|
+
},
|
|
112
|
+
|
|
113
|
+
register: function(id, CardClass) {
|
|
114
|
+
this.registry[id] = CardClass;
|
|
115
|
+
// If the card was previously registered as a stub, or we have saved state for it,
|
|
116
|
+
// we don't necessarily respawn, but the next spawn will use the new class.
|
|
117
|
+
console.log(`ActivityCards: Registered class for ${id}`);
|
|
118
|
+
},
|
|
119
|
+
|
|
120
|
+
updateGridSize: function(newSize) {
|
|
121
|
+
this.settings.gridSize = parseInt(newSize);
|
|
122
|
+
this.syncCSS();
|
|
123
|
+
Object.values(this.active).forEach(card => {
|
|
124
|
+
card.alignToGrid();
|
|
125
|
+
card.updateElementStyles();
|
|
126
|
+
});
|
|
127
|
+
},
|
|
128
|
+
|
|
129
|
+
syncCSS: function() {
|
|
130
|
+
document.documentElement.style.setProperty('--qss-grid-size', `${this.settings.gridSize}px`);
|
|
131
|
+
document.documentElement.style.setProperty('--qss-card-radius', `${this.settings.gridSize}px`);
|
|
132
|
+
},
|
|
133
|
+
|
|
134
|
+
applyLayout: function() {
|
|
135
|
+
const level = this.getProficiencyLevel();
|
|
136
|
+
if (level === -1 || level >= 2) {
|
|
137
|
+
this.masonryPack();
|
|
138
|
+
} else {
|
|
139
|
+
this.structuredLayout();
|
|
140
|
+
}
|
|
141
|
+
},
|
|
142
|
+
|
|
143
|
+
structuredLayout: function(containerSelector = '#pp-workspace-layers') {
|
|
144
|
+
const container = document.querySelector(containerSelector);
|
|
145
|
+
if (!container) return;
|
|
146
|
+
const cRect = container.getBoundingClientRect();
|
|
147
|
+
const GRID_SIZE = this.settings.gridSize;
|
|
148
|
+
|
|
149
|
+
// Only layout cards that have not been manually positioned by the user
|
|
150
|
+
const cards = Object.values(this.active).filter(c => {
|
|
151
|
+
const isUserPositioned = c.state.userPositioned === true;
|
|
152
|
+
if (c.id === 'file-editor') {
|
|
153
|
+
console.log(`ActivityCards: card ${c.id} userPositioned=${isUserPositioned} x=${c.state.x} y=${c.state.y}`);
|
|
154
|
+
}
|
|
155
|
+
return c.state.visible && !isUserPositioned && !c.state.pinned;
|
|
156
|
+
});
|
|
157
|
+
if (cards.length === 0) return;
|
|
158
|
+
|
|
159
|
+
// Column 1: Explorer / Snippets (20% width)
|
|
160
|
+
// Column 2: Editor (60% width)
|
|
161
|
+
// Column 3: Runner / Diagnostics (20% width)
|
|
162
|
+
const colWidths = [
|
|
163
|
+
Math.floor(cRect.width * 0.2 / GRID_SIZE) * GRID_SIZE,
|
|
164
|
+
Math.floor(cRect.width * 0.6 / GRID_SIZE) * GRID_SIZE,
|
|
165
|
+
Math.floor(cRect.width * 0.2 / GRID_SIZE) * GRID_SIZE
|
|
166
|
+
];
|
|
167
|
+
|
|
168
|
+
const col1 = cards.filter(c => c.id === 'file-explorer' || c.id === 'snippet-library');
|
|
169
|
+
const col2 = cards.filter(c => c.id === 'file-editor');
|
|
170
|
+
const col3 = cards.filter(c => !col1.includes(c) && !col2.includes(c));
|
|
171
|
+
|
|
172
|
+
const layoutColumn = (colCards, x, width) => {
|
|
173
|
+
if (colCards.length === 0) return;
|
|
174
|
+
const totalPadding = (colCards.length - 1) * GRID_SIZE;
|
|
175
|
+
const cardHeight = Math.floor((cRect.height - totalPadding) / colCards.length / GRID_SIZE) * GRID_SIZE;
|
|
176
|
+
|
|
177
|
+
colCards.forEach((card, idx) => {
|
|
178
|
+
// Force positioning ONLY if not user positioned
|
|
179
|
+
card.state.x = x;
|
|
180
|
+
card.state.y = idx * (cardHeight + GRID_SIZE);
|
|
181
|
+
card.state.width = width;
|
|
182
|
+
card.state.height = cardHeight;
|
|
183
|
+
card.updateElementStyles();
|
|
184
|
+
card.saveState();
|
|
185
|
+
});
|
|
186
|
+
};
|
|
187
|
+
|
|
188
|
+
layoutColumn(col1, 0, colWidths[0]);
|
|
189
|
+
layoutColumn(col2, colWidths[0] + GRID_SIZE, colWidths[1] - (GRID_SIZE * 2));
|
|
190
|
+
layoutColumn(col3, colWidths[0] + colWidths[1], colWidths[2] - GRID_SIZE);
|
|
191
|
+
},
|
|
192
|
+
|
|
193
|
+
spawn: function(options, containerSelector = '#pp-workspace-layers') {
|
|
194
|
+
const container = document.querySelector(containerSelector);
|
|
195
|
+
if (!container) return;
|
|
196
|
+
|
|
197
|
+
// If ID is provided, use it as the definitive key in active registry
|
|
198
|
+
const id = options.id || `card-${Math.random().toString(36).substr(2, 9)}`;
|
|
199
|
+
if (this.active[id]) return this.active[id];
|
|
200
|
+
|
|
201
|
+
console.log(`ActivityCards: Spawning ${id}. Registry keys:`, Object.keys(this.registry));
|
|
202
|
+
const CardClass = this.registry[id] || ActivityCard;
|
|
203
|
+
console.log(`ActivityCards: Using class ${CardClass.name} for ${id}`);
|
|
204
|
+
|
|
205
|
+
const card = new CardClass({ ...options, id: id });
|
|
206
|
+
card.render(container);
|
|
207
|
+
card.state.visible = true;
|
|
208
|
+
card.saveState();
|
|
209
|
+
this.active[id] = card;
|
|
210
|
+
|
|
211
|
+
// Re-apply layout on spawn
|
|
212
|
+
this.applyLayout();
|
|
213
|
+
|
|
214
|
+
document.dispatchEvent(new CustomEvent('cardSpawned', { detail: { id: id } }));
|
|
215
|
+
return card;
|
|
216
|
+
},
|
|
217
|
+
|
|
218
|
+
masonryPack: function(containerSelector = '#pp-workspace-layers') {
|
|
219
|
+
const container = document.querySelector(containerSelector);
|
|
220
|
+
if (!container) return;
|
|
221
|
+
const cRect = container.getBoundingClientRect();
|
|
222
|
+
const GRID_SIZE = this.settings.gridSize;
|
|
223
|
+
const MARGIN = GRID_SIZE;
|
|
224
|
+
|
|
225
|
+
// Skip pinned and user-positioned cards
|
|
226
|
+
const cards = Object.values(this.active).filter(c => {
|
|
227
|
+
const isUserPositioned = c.state.userPositioned === true;
|
|
228
|
+
return !c.state.pinned && !isUserPositioned;
|
|
229
|
+
});
|
|
230
|
+
const sizeWeight = { 'xlarge': 0, 'large': 1, 'medium': 2, 'small': 3 };
|
|
231
|
+
const orientWeight = { 'neutral': 0, 'horizontal': 1, 'vertical': 2 };
|
|
232
|
+
cards.sort((a, b) => (sizeWeight[a.state.size] - sizeWeight[b.state.size]) || (orientWeight[a.state.orientation] - orientWeight[b.state.orientation]) || (a.state.y - b.state.y) || (a.state.x - b.state.x));
|
|
233
|
+
const placedCards = [];
|
|
234
|
+
cards.forEach(card => {
|
|
235
|
+
let placed = false;
|
|
236
|
+
for (let y = 0; y < 5000; y += GRID_SIZE) {
|
|
237
|
+
for (let x = 0; x < cRect.width - card.state.width; x += GRID_SIZE) {
|
|
238
|
+
const testState = { x, y, width: card.state.width, height: card.state.height };
|
|
239
|
+
const isOccupied = placedCards.some(p => {
|
|
240
|
+
const pBound = { x: p.state.x - MARGIN, y: p.state.y - MARGIN, width: p.state.width + (MARGIN * 2), height: p.state.height + (MARGIN * 2) };
|
|
241
|
+
return card.isOverlapping(testState, pBound);
|
|
242
|
+
});
|
|
243
|
+
if (!isOccupied) {
|
|
244
|
+
card.state.x = x;
|
|
245
|
+
card.state.y = y;
|
|
246
|
+
card.updateElementStyles();
|
|
247
|
+
card.saveState();
|
|
248
|
+
placedCards.push(card);
|
|
249
|
+
placed = true;
|
|
250
|
+
break;
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
if (placed) break;
|
|
254
|
+
}
|
|
255
|
+
});
|
|
256
|
+
},
|
|
257
|
+
|
|
258
|
+
promote: function(cardId) {
|
|
259
|
+
const card = this.active[cardId];
|
|
260
|
+
if (!card || card.state.pinned) return;
|
|
261
|
+
if (this.state.promotedCardId && this.state.promotedCardId !== cardId) {
|
|
262
|
+
const prev = this.active[this.state.promotedCardId];
|
|
263
|
+
if (prev) prev.demote();
|
|
264
|
+
}
|
|
265
|
+
this.state.promotedCardId = cardId;
|
|
266
|
+
card.state.zIndex = this.PROMOTE_Z;
|
|
267
|
+
card.element.style.zIndex = this.PROMOTE_Z;
|
|
268
|
+
card.element.classList.add('qss-promoted');
|
|
269
|
+
const zDisplay = card.element.querySelector('.qss-z-index-display');
|
|
270
|
+
if (zDisplay) zDisplay.textContent = this.zLabel(this.PROMOTE_Z);
|
|
271
|
+
card.saveState();
|
|
272
|
+
},
|
|
273
|
+
|
|
274
|
+
respawnAll: function() {
|
|
275
|
+
Object.keys(this.state.cards).forEach(id => {
|
|
276
|
+
const saved = this.state.cards[id];
|
|
277
|
+
if (!this.active[id] && saved.visible !== false) this.spawn({ id: id });
|
|
278
|
+
});
|
|
279
|
+
this.applyLayout();
|
|
280
|
+
}
|
|
281
|
+
};
|
|
282
|
+
|
|
283
|
+
global.ActivityCards = ActivityCards;
|
|
284
|
+
ActivityCards.init();
|
|
285
|
+
|
|
286
|
+
// Ensure all script-based registrations (like FileEditorCard) complete before respawning
|
|
287
|
+
document.addEventListener('DOMContentLoaded', function() {
|
|
288
|
+
setTimeout(function() { ActivityCards.respawnAll(); }, 0);
|
|
289
|
+
});
|
|
290
|
+
|
|
291
|
+
})(typeof window !== 'undefined' ? window : this);
|
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
//
|
|
2
|
+
// activity-registry.js — Stub factory for unimplemented cards.
|
|
3
|
+
//
|
|
4
|
+
// CONVENTION: When a card is implemented, create card-[name].js which:
|
|
5
|
+
// 1. defines `class FooCard extends ActivityCard`
|
|
6
|
+
// 2. calls `ActivityCards.registry['foo'] = FooCard`
|
|
7
|
+
// 3. is added to application.html.erb AFTER activity-registry.js
|
|
8
|
+
// The card-[name].js registration overwrites the stub here.
|
|
9
|
+
//
|
|
10
|
+
// This file should shrink over time as cards graduate to their own files.
|
|
11
|
+
//
|
|
12
|
+
|
|
13
|
+
(function() {
|
|
14
|
+
|
|
15
|
+
var stubs = {
|
|
16
|
+
'smart-search': {
|
|
17
|
+
title: 'Smart Search',
|
|
18
|
+
icon: `<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><path class="icon-path" d="M11 19C15.4183 19 19 15.4183 19 11C19 6.58172 15.4183 3 11 3C6.58172 3 3 6.58172 3 11C3 15.4183 6.58172 19 11 19Z" stroke="currentColor" stroke-width="2"/><path class="icon-path" d="M21 21L16.65 16.65" stroke="currentColor" stroke-width="2"/></svg>`,
|
|
19
|
+
keyArea: 'Explorer', proficiency: 2,
|
|
20
|
+
orientation: 'vertical', size: 'medium',
|
|
21
|
+
width: 300, height: 200, minWidth: 200, minHeight: 150
|
|
22
|
+
},
|
|
23
|
+
'live-preview': {
|
|
24
|
+
title: 'Live Web Preview',
|
|
25
|
+
icon: `<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><path class="icon-path" d="M1 12C1 12 5 4 12 4C19 4 23 12 23 12C23 12 19 20 12 20C5 20 1 12 1 12Z" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/><circle class="icon-path" cx="12" cy="12" r="3" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/></svg>`,
|
|
26
|
+
keyArea: 'Stylist', proficiency: 0,
|
|
27
|
+
orientation: 'neutral', size: 'medium',
|
|
28
|
+
width: 400, height: 250, minWidth: 300, minHeight: 200
|
|
29
|
+
},
|
|
30
|
+
'ai-error-explainer': {
|
|
31
|
+
title: 'Failure Inspector',
|
|
32
|
+
icon: `<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><path class="icon-path" d="M12 22C17.5228 22 22 17.5228 22 12C22 6.47715 17.5228 2 12 2C6.47715 2 2 6.47715 2 12C2 17.5228 6.47715 22 12 22Z" stroke="currentColor" stroke-width="2"/><path class="icon-path" d="M12 8V12M12 16H12.01" stroke="currentColor" stroke-width="2"/></svg>`,
|
|
33
|
+
keyArea: 'Runner', proficiency: 1,
|
|
34
|
+
orientation: 'neutral', size: 'small',
|
|
35
|
+
width: 480, height: 380, minWidth: 300, minHeight: 250
|
|
36
|
+
},
|
|
37
|
+
'file-explorer': {
|
|
38
|
+
title: 'File Explorer',
|
|
39
|
+
icon: 'folder',
|
|
40
|
+
keyArea: 'Explorer', proficiency: 0,
|
|
41
|
+
orientation: 'vertical', size: 'medium',
|
|
42
|
+
width: 250, height: 600, minWidth: 200
|
|
43
|
+
},
|
|
44
|
+
'environment-toggles': {
|
|
45
|
+
title: 'Environment Toggles',
|
|
46
|
+
icon: 'toggle-right',
|
|
47
|
+
keyArea: 'Stylist', proficiency: 1,
|
|
48
|
+
orientation: 'horizontal', size: 'small',
|
|
49
|
+
width: 300, height: 150, minWidth: 200, minHeight: 100
|
|
50
|
+
},
|
|
51
|
+
'component-inspector': {
|
|
52
|
+
title: 'Component Inspector',
|
|
53
|
+
icon: 'inspect',
|
|
54
|
+
keyArea: 'Stylist', proficiency: 2,
|
|
55
|
+
orientation: 'neutral', size: 'medium',
|
|
56
|
+
width: 400, height: 300, minWidth: 250, minHeight: 200
|
|
57
|
+
},
|
|
58
|
+
'injection-engine': {
|
|
59
|
+
title: 'Injection Engine',
|
|
60
|
+
icon: 'zap',
|
|
61
|
+
keyArea: 'Stylist', proficiency: 2,
|
|
62
|
+
orientation: 'vertical', size: 'medium',
|
|
63
|
+
width: 350, height: 380, minWidth: 250, minHeight: 250
|
|
64
|
+
},
|
|
65
|
+
'seed-inspector': {
|
|
66
|
+
title: 'Seed Inspector',
|
|
67
|
+
icon: 'leaf',
|
|
68
|
+
keyArea: 'Inspector', proficiency: 2,
|
|
69
|
+
orientation: 'vertical', size: 'medium',
|
|
70
|
+
width: 360, height: 440, minWidth: 250, minHeight: 300
|
|
71
|
+
},
|
|
72
|
+
'unified-schema-view': {
|
|
73
|
+
title: 'Unified Schema View',
|
|
74
|
+
icon: 'table',
|
|
75
|
+
keyArea: 'Inspector', proficiency: 2,
|
|
76
|
+
orientation: 'vertical', size: 'medium',
|
|
77
|
+
width: 400, height: 380, minWidth: 250, minHeight: 250
|
|
78
|
+
},
|
|
79
|
+
'live-sql-stream': {
|
|
80
|
+
title: 'Live SQL Stream',
|
|
81
|
+
icon: 'database',
|
|
82
|
+
keyArea: 'Inspector', proficiency: 2,
|
|
83
|
+
orientation: 'horizontal', size: 'medium',
|
|
84
|
+
width: 520, height: 260, minWidth: 300, minHeight: 150
|
|
85
|
+
},
|
|
86
|
+
'registry-metadata': {
|
|
87
|
+
title: 'Registry Metadata',
|
|
88
|
+
icon: 'database',
|
|
89
|
+
keyArea: 'Explorer', proficiency: 2,
|
|
90
|
+
orientation: 'vertical', size: 'medium',
|
|
91
|
+
width: 360, height: 420, minWidth: 250, minHeight: 250
|
|
92
|
+
},
|
|
93
|
+
'visual-summary-bar': {
|
|
94
|
+
title: 'Visual Summary Bar',
|
|
95
|
+
icon: 'bar-chart',
|
|
96
|
+
keyArea: 'Runner', proficiency: 1,
|
|
97
|
+
orientation: 'horizontal', size: 'small',
|
|
98
|
+
width: 420, height: 120, minWidth: 250, minHeight: 80
|
|
99
|
+
},
|
|
100
|
+
'terminal': {
|
|
101
|
+
title: 'Terminal',
|
|
102
|
+
icon: 'terminal',
|
|
103
|
+
keyArea: 'Runner', proficiency: 3,
|
|
104
|
+
orientation: 'horizontal', size: 'large',
|
|
105
|
+
width: 620, height: 300, minWidth: 350, minHeight: 180
|
|
106
|
+
},
|
|
107
|
+
'visual-comparison': {
|
|
108
|
+
title: 'Visual Comparison',
|
|
109
|
+
icon: 'columns-2',
|
|
110
|
+
keyArea: 'Runner', proficiency: 2,
|
|
111
|
+
orientation: 'neutral', size: 'large',
|
|
112
|
+
width: 720, height: 420, minWidth: 400, minHeight: 250
|
|
113
|
+
},
|
|
114
|
+
'snippet-library': {
|
|
115
|
+
title: 'Snippet Library',
|
|
116
|
+
icon: 'book-open',
|
|
117
|
+
keyArea: 'Studio', proficiency: 2,
|
|
118
|
+
orientation: 'vertical', size: 'medium',
|
|
119
|
+
width: 300, height: 420, minWidth: 220, minHeight: 280
|
|
120
|
+
},
|
|
121
|
+
'flight-recorder': {
|
|
122
|
+
title: 'Flight Recorder',
|
|
123
|
+
icon: 'history',
|
|
124
|
+
keyArea: 'Studio', proficiency: 3,
|
|
125
|
+
orientation: 'vertical', size: 'medium',
|
|
126
|
+
width: 340, height: 440, minWidth: 220, minHeight: 300
|
|
127
|
+
},
|
|
128
|
+
'health-graph': {
|
|
129
|
+
title: 'Health Graph',
|
|
130
|
+
icon: 'trending-up',
|
|
131
|
+
keyArea: 'Studio', proficiency: 3,
|
|
132
|
+
orientation: 'horizontal', size: 'medium',
|
|
133
|
+
width: 520, height: 300, minWidth: 300, minHeight: 200
|
|
134
|
+
},
|
|
135
|
+
'coverage-heatmap': {
|
|
136
|
+
title: 'Coverage Heatmap',
|
|
137
|
+
icon: 'layers',
|
|
138
|
+
keyArea: 'Analysis', proficiency: 2,
|
|
139
|
+
orientation: 'neutral', size: 'large',
|
|
140
|
+
width: 520, height: 400, minWidth: 300, minHeight: 250
|
|
141
|
+
},
|
|
142
|
+
'flaky-history': {
|
|
143
|
+
title: 'Flaky History',
|
|
144
|
+
icon: 'refresh-cw',
|
|
145
|
+
keyArea: 'Analysis', proficiency: 2,
|
|
146
|
+
orientation: 'neutral', size: 'medium',
|
|
147
|
+
width: 420, height: 360, minWidth: 280, minHeight: 220
|
|
148
|
+
},
|
|
149
|
+
'slow-test-bottlenecks': {
|
|
150
|
+
title: 'Slow Test Bottlenecks',
|
|
151
|
+
icon: 'clock',
|
|
152
|
+
keyArea: 'Analysis', proficiency: 2,
|
|
153
|
+
orientation: 'horizontal', size: 'medium',
|
|
154
|
+
width: 460, height: 280, minWidth: 280, minHeight: 180
|
|
155
|
+
}
|
|
156
|
+
};
|
|
157
|
+
|
|
158
|
+
Object.entries(stubs).forEach(function(entry) {
|
|
159
|
+
var id = entry[0];
|
|
160
|
+
var def = entry[1];
|
|
161
|
+
|
|
162
|
+
// Skip if a real class has already registered for this ID
|
|
163
|
+
if (ActivityCards.registry[id] && ActivityCards.registry[id].prototype instanceof ActivityCard) {
|
|
164
|
+
console.log(`ActivityRegistry: Skipping stub for ${id}, already registered.`);
|
|
165
|
+
return;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
var StubCard = class extends ActivityCard {
|
|
169
|
+
get cardTitle() { return def.title; }
|
|
170
|
+
get cardIcon() { return def.icon; }
|
|
171
|
+
get cardKeyArea() { return def.keyArea; }
|
|
172
|
+
get cardProficiency() { return def.proficiency || 0; }
|
|
173
|
+
defaults() {
|
|
174
|
+
return Object.assign({}, super.defaults(), def);
|
|
175
|
+
}
|
|
176
|
+
};
|
|
177
|
+
StubCard.cardId = id;
|
|
178
|
+
ActivityCards.register(id, StubCard);
|
|
179
|
+
});
|
|
180
|
+
|
|
181
|
+
})();
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
// Activity Toggles — bridges ribbon buttons to ActivityCards.spawn
|
|
2
|
+
(function() {
|
|
3
|
+
function init() {
|
|
4
|
+
document.querySelectorAll('.qss-activity-item').forEach(function(item) {
|
|
5
|
+
if (item._toggleBound) return;
|
|
6
|
+
item._toggleBound = true;
|
|
7
|
+
|
|
8
|
+
item.addEventListener('click', function(e) {
|
|
9
|
+
const cardId = item.dataset.activityId;
|
|
10
|
+
if (!cardId) return;
|
|
11
|
+
|
|
12
|
+
// Handle Live Preview specially (it's a global popup, not a masonry card)
|
|
13
|
+
if (cardId === 'live-preview') {
|
|
14
|
+
if (window.ParapetPreview) window.ParapetPreview.toggle();
|
|
15
|
+
return;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
if (!window.ActivityCards) return;
|
|
19
|
+
|
|
20
|
+
if (e.shiftKey && item.classList.contains('qss-active')) {
|
|
21
|
+
window.ActivityCards.promote(cardId);
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
if (item.classList.contains('qss-active')) {
|
|
26
|
+
item.classList.remove('qss-active');
|
|
27
|
+
if (window.ActivityCards.active[cardId]) {
|
|
28
|
+
window.ActivityCards.active[cardId].destroy();
|
|
29
|
+
}
|
|
30
|
+
} else {
|
|
31
|
+
item.classList.add('qss-active');
|
|
32
|
+
const svg = item.querySelector('svg');
|
|
33
|
+
window.ActivityCards.spawn({
|
|
34
|
+
id: cardId,
|
|
35
|
+
icon: svg ? svg.outerHTML : null
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
});
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
document.addEventListener('cardSpawned', function(e) {
|
|
42
|
+
const cardId = e.detail.id;
|
|
43
|
+
document.querySelectorAll('.qss-activity-item').forEach(function(item) {
|
|
44
|
+
if (item.dataset.activityId === cardId) {
|
|
45
|
+
item.classList.add('qss-active');
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
document.addEventListener('cardClosed', function(e) {
|
|
51
|
+
const cardId = e.detail.id;
|
|
52
|
+
document.querySelectorAll('.qss-activity-item').forEach(function(item) {
|
|
53
|
+
if (item.dataset.activityId === cardId) {
|
|
54
|
+
item.classList.remove('qss-active');
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
// Sync Live Preview ribbon state
|
|
60
|
+
document.addEventListener('previewOpened', function() {
|
|
61
|
+
document.querySelectorAll('.qss-activity-item[data-activity-id="live-preview"]').forEach(function(item) {
|
|
62
|
+
item.classList.add('qss-active');
|
|
63
|
+
});
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
document.addEventListener('previewClosed', function() {
|
|
67
|
+
document.querySelectorAll('.qss-activity-item[data-activity-id="live-preview"]').forEach(function(item) {
|
|
68
|
+
item.classList.remove('qss-active');
|
|
69
|
+
});
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
document.addEventListener('DOMContentLoaded', init);
|
|
74
|
+
document.addEventListener('turbo:load', init);
|
|
75
|
+
if (document.readyState === 'complete' || document.readyState === 'interactive') init();
|
|
76
|
+
})();
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
(function() {
|
|
2
|
+
// Start QSS Engine
|
|
3
|
+
if (typeof QSSEngine !== 'undefined') {
|
|
4
|
+
QSSEngine.startPulse();
|
|
5
|
+
QSSEngine.startObserver();
|
|
6
|
+
}
|
|
7
|
+
let flashTimeout = null;
|
|
8
|
+
|
|
9
|
+
document.addEventListener('parapet:flash', (e) => {
|
|
10
|
+
const flashEl = document.getElementById('qss-footer-flash');
|
|
11
|
+
const contentEl = document.getElementById('qss-footer-flash-content');
|
|
12
|
+
const dotEl = document.getElementById('qss-footer-flash-dot');
|
|
13
|
+
if (!flashEl || !contentEl) return;
|
|
14
|
+
|
|
15
|
+
const { message, type } = e.detail;
|
|
16
|
+
contentEl.textContent = message;
|
|
17
|
+
|
|
18
|
+
// Reset dot colors
|
|
19
|
+
if (dotEl) {
|
|
20
|
+
dotEl.className = 'qss-w-1.5 qss-h-1.5 qss-rounded-full'; // Reset classes
|
|
21
|
+
if (type === 'alert' || type === 'error') dotEl.classList.add('qss-bg-red-400');
|
|
22
|
+
else if (type === 'notice' || type === 'success') dotEl.classList.add('qss-bg-emerald-400');
|
|
23
|
+
else dotEl.classList.add('qss-bg-amber-400');
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
// Show (Fade In + Scale)
|
|
27
|
+
flashEl.classList.remove('qss-opacity-0', 'qss-scale-95');
|
|
28
|
+
flashEl.classList.add('qss-opacity-100', 'qss-scale-100');
|
|
29
|
+
|
|
30
|
+
// Auto-Hide after delay
|
|
31
|
+
if (flashTimeout) clearTimeout(flashTimeout);
|
|
32
|
+
flashTimeout = setTimeout(() => {
|
|
33
|
+
flashEl.classList.remove('qss-opacity-100', 'qss-scale-100');
|
|
34
|
+
flashEl.classList.add('qss-opacity-0', 'qss-scale-95');
|
|
35
|
+
}, 3500);
|
|
36
|
+
});
|
|
37
|
+
})();
|