meta_workflows 0.8.15 → 0.8.16
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 96552fbab72118354ae3e4ff4e960751cf3f6c4157b783c618b08c90bdfaf3d8
|
4
|
+
data.tar.gz: 2deea6a1b1899874c50b8bb9148eb7358d41d63dad996b4659bf5b62c1dd41e3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 67b87b7d61be328304623c3fb34d4b1282e8fbe3f3ee872b3cd6f596a34a4bc56e2396358ca839aad76ab2692f148659467b24e215b4f406eee38242698c5e5b
|
7
|
+
data.tar.gz: acfc10a24ad5c4e01871614a82bf10cf15df07ce96c6312b1ff17c79f15d1369c3a90f41eeaf8256af386f6b2ad89994ae4f81deb5d5117b1f7261298aa66945
|
@@ -14,9 +14,31 @@ module MetaWorkflows
|
|
14
14
|
end
|
15
15
|
end
|
16
16
|
|
17
|
-
# Generate a formatted JSON display with syntax highlighting
|
17
|
+
# Generate a formatted JSON display with syntax highlighting using json-viewer component
|
18
18
|
def json_display(data, classes: 'bg-gray-100 p-4 rounded-lg text-sm overflow-x-auto')
|
19
|
-
content_tag
|
19
|
+
return content_tag(:div, 'No data', class: 'text-gray-500 italic') if data.blank?
|
20
|
+
|
21
|
+
begin
|
22
|
+
# Convert data to JSON object if it's a string, otherwise use as-is
|
23
|
+
json_data = data.is_a?(String) ? JSON.parse(data) : data
|
24
|
+
|
25
|
+
# Generate a unique ID for this json-viewer instance
|
26
|
+
viewer_id = "json-viewer-#{SecureRandom.hex(4)}"
|
27
|
+
|
28
|
+
# Create the json-viewer element and set data via JavaScript
|
29
|
+
content_tag :div, class: classes do
|
30
|
+
viewer_element = content_tag(:'json-viewer', '', id: viewer_id,
|
31
|
+
expanded: true,
|
32
|
+
style: json_viewer_styles)
|
33
|
+
|
34
|
+
script_tag = javascript_tag(json_viewer_script(viewer_id, json_data))
|
35
|
+
|
36
|
+
viewer_element + script_tag
|
37
|
+
end
|
38
|
+
rescue JSON::ParserError
|
39
|
+
# Fallback to original pre tag display if JSON parsing fails
|
40
|
+
content_tag :pre, data.to_s, class: classes
|
41
|
+
end
|
20
42
|
end
|
21
43
|
|
22
44
|
# Helper to format token usage
|
@@ -26,5 +48,35 @@ module MetaWorkflows
|
|
26
48
|
|
27
49
|
"Tokens: #{tokens.join('/')}"
|
28
50
|
end
|
51
|
+
|
52
|
+
private
|
53
|
+
|
54
|
+
def json_viewer_styles
|
55
|
+
styles = [
|
56
|
+
'--background-color: transparent',
|
57
|
+
'--indentguide-color: #6b7280',
|
58
|
+
'--string-color: #059669',
|
59
|
+
'--number-color: #dc2626',
|
60
|
+
'--boolean-color: #2563eb',
|
61
|
+
'--null-color: #7c3aed',
|
62
|
+
'--property-color: #1f2937',
|
63
|
+
'--preview-color: #374151',
|
64
|
+
'--expand-icon-color: #374151'
|
65
|
+
]
|
66
|
+
"#{styles.join('; ')};"
|
67
|
+
end
|
68
|
+
|
69
|
+
def json_viewer_script(viewer_id, json_data)
|
70
|
+
"document.addEventListener('DOMContentLoaded', function() {
|
71
|
+
const viewer = document.getElementById('#{viewer_id}');
|
72
|
+
if (viewer) {
|
73
|
+
viewer.data = #{json_data.to_json};
|
74
|
+
// Expand only the first level by default
|
75
|
+
if (typeof viewer.expand === 'function') {
|
76
|
+
viewer.expand('*');
|
77
|
+
}
|
78
|
+
}
|
79
|
+
});"
|
80
|
+
end
|
29
81
|
end
|
30
82
|
end
|
@@ -12,6 +12,9 @@
|
|
12
12
|
<!-- Tailwind CSS -->
|
13
13
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
14
14
|
<script src="https://cdn.tailwindcss.com"></script>
|
15
|
+
|
16
|
+
<!-- JSON Viewer Web Component -->
|
17
|
+
<script src="https://unpkg.com/@alenaksu/json-viewer@2.1.0/dist/json-viewer.bundle.js"></script>
|
15
18
|
</head>
|
16
19
|
<body class="bg-gray-50 min-h-screen">
|
17
20
|
<!-- Header Navigation -->
|
@@ -3,7 +3,7 @@
|
|
3
3
|
module MetaWorkflows
|
4
4
|
MAJOR = 0
|
5
5
|
MINOR = 8
|
6
|
-
PATCH =
|
6
|
+
PATCH = 16 # this is automatically incremented by the build process
|
7
7
|
|
8
8
|
VERSION = "#{MetaWorkflows::MAJOR}.#{MetaWorkflows::MINOR}.#{MetaWorkflows::PATCH}".freeze
|
9
9
|
end
|