snow-flow 3.4.35 → 3.4.39
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.
- package/README.md +412 -287
- package/dist/cli/deploy-artifact.js +2 -2
- package/dist/mcp/servicenow-deployment-mcp.js +1 -1
- package/dist/mcp/servicenow-mcp-server.js +2 -2
- package/dist/mcp/shared/mcp-logger.js +6 -12
- package/dist/queen/agent-factory.js +134 -52
- package/dist/queen/servicenow-queen.d.ts +127 -2
- package/dist/queen/servicenow-queen.js +978 -618
- package/dist/services/widget-deployment-service.d.ts +1 -1
- package/dist/services/widget-deployment-service.js +1 -1
- package/dist/templates/claude-md-template.d.ts +1 -1
- package/dist/templates/claude-md-template.js +2 -2
- package/dist/types/servicenow.types.d.ts +1 -1
- package/dist/utils/dependency-detector.d.ts +1 -1
- package/dist/utils/dependency-detector.js +1 -1
- package/dist/utils/servicenow-client.d.ts +1 -1
- package/dist/utils/servicenow-client.js +4 -8
- package/package.json +1 -1
- package/website/components/README.md +419 -0
- package/website/components/code-display/CodeDisplay.css +583 -0
- package/website/components/code-display/CodeDisplay.html +200 -0
- package/website/components/code-display/CodeDisplay.js +375 -0
- package/website/components/code-display/CodeDisplay.jsx +268 -0
- package/website/components/demo/ComponentLibraryDemo.html +845 -0
- package/website/components/feature-cards/FeatureCards.css +573 -0
- package/website/components/feature-cards/FeatureCards.html +247 -0
- package/website/components/feature-cards/FeatureCards.js +382 -0
- package/website/components/feature-cards/FeatureCards.jsx +235 -0
- package/website/components/hero/Hero.css +558 -0
- package/website/components/hero/Hero.html +98 -0
- package/website/components/hero/Hero.js +415 -0
- package/website/components/hero/Hero.jsx +214 -0
- package/website/components/interactive/InteractiveElements.css +776 -0
- package/website/components/interactive/InteractiveElements.html +283 -0
- package/website/components/interactive/InteractiveElements.js +489 -0
- package/website/components/interactive/InteractiveElements.jsx +444 -0
- package/website/components/layout/LayoutComponents.css +697 -0
- package/website/components/layout/LayoutComponents.html +374 -0
- package/website/components/layout/LayoutComponents.js +447 -0
- package/website/components/layout/LayoutComponents.jsx +379 -0
- package/website/components/navigation/Navigation.css +383 -0
- package/website/components/navigation/Navigation.html +89 -0
- package/website/components/navigation/Navigation.js +248 -0
- package/website/components/navigation/Navigation.jsx +124 -0
- package/website/css/animations.css +854 -0
- package/website/css/style.css +916 -948
- package/website/index.html +394 -424
- package/website/js/animations.js +707 -0
- package/website/js/main.js +310 -383
- package/website/mcp-servers.html +310 -0
|
@@ -0,0 +1,268 @@
|
|
|
1
|
+
import React, { useState, useEffect, useRef } from 'react';
|
|
2
|
+
import './CodeDisplay.css';
|
|
3
|
+
|
|
4
|
+
const CodeDisplay = ({
|
|
5
|
+
code = `// Welcome to Snow-Flow
|
|
6
|
+
const snowFlow = new SnowFlowFramework({
|
|
7
|
+
mode: 'development',
|
|
8
|
+
verbose: true
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
// Execute background script
|
|
12
|
+
await snow_execute_script_with_output({
|
|
13
|
+
script: \`
|
|
14
|
+
var gr = new GlideRecord('incident');
|
|
15
|
+
gr.addActiveQuery();
|
|
16
|
+
gr.query();
|
|
17
|
+
|
|
18
|
+
var count = 0;
|
|
19
|
+
while(gr.next()) {
|
|
20
|
+
count++;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
gs.info('Total incidents: ' + count);
|
|
24
|
+
\`,
|
|
25
|
+
description: 'Count active incidents'
|
|
26
|
+
});`,
|
|
27
|
+
language = 'javascript',
|
|
28
|
+
theme = 'black-white',
|
|
29
|
+
title = 'code-example.js',
|
|
30
|
+
showLineNumbers = true,
|
|
31
|
+
showCopyButton = true,
|
|
32
|
+
showHeader = true,
|
|
33
|
+
editable = false,
|
|
34
|
+
maxHeight = '400px',
|
|
35
|
+
className = '',
|
|
36
|
+
onCopy = null,
|
|
37
|
+
onChange = null
|
|
38
|
+
}) => {
|
|
39
|
+
const [copied, setCopied] = useState(false);
|
|
40
|
+
const [isVisible, setIsVisible] = useState(false);
|
|
41
|
+
const [lineCount, setLineCount] = useState(0);
|
|
42
|
+
const codeRef = useRef(null);
|
|
43
|
+
const containerRef = useRef(null);
|
|
44
|
+
|
|
45
|
+
useEffect(() => {
|
|
46
|
+
// Count lines
|
|
47
|
+
const lines = code.split('\n').length;
|
|
48
|
+
setLineCount(lines);
|
|
49
|
+
}, [code]);
|
|
50
|
+
|
|
51
|
+
useEffect(() => {
|
|
52
|
+
// Intersection observer for entrance animation
|
|
53
|
+
const observer = new IntersectionObserver(
|
|
54
|
+
([entry]) => {
|
|
55
|
+
if (entry.isIntersecting) {
|
|
56
|
+
setIsVisible(true);
|
|
57
|
+
}
|
|
58
|
+
},
|
|
59
|
+
{ threshold: 0.1 }
|
|
60
|
+
);
|
|
61
|
+
|
|
62
|
+
if (containerRef.current) {
|
|
63
|
+
observer.observe(containerRef.current);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
return () => observer.disconnect();
|
|
67
|
+
}, []);
|
|
68
|
+
|
|
69
|
+
useEffect(() => {
|
|
70
|
+
// Simple syntax highlighting for black/white theme
|
|
71
|
+
if (codeRef.current && isVisible) {
|
|
72
|
+
applySyntaxHighlighting();
|
|
73
|
+
}
|
|
74
|
+
}, [code, isVisible]);
|
|
75
|
+
|
|
76
|
+
const applySyntaxHighlighting = () => {
|
|
77
|
+
if (!codeRef.current) return;
|
|
78
|
+
|
|
79
|
+
let highlightedCode = code;
|
|
80
|
+
|
|
81
|
+
// Define patterns for black/white theme
|
|
82
|
+
const patterns = [
|
|
83
|
+
// Comments
|
|
84
|
+
{
|
|
85
|
+
pattern: /(\/\/.*$|\/\*[\s\S]*?\*\/)/gm,
|
|
86
|
+
replacement: '<span class="sf-code-comment">$1</span>'
|
|
87
|
+
},
|
|
88
|
+
// Strings
|
|
89
|
+
{
|
|
90
|
+
pattern: /(['"`])((?:\\.|(?!\1)[^\\\r\n])*?)\1/g,
|
|
91
|
+
replacement: '<span class="sf-code-string">$1$2$1</span>'
|
|
92
|
+
},
|
|
93
|
+
// Keywords
|
|
94
|
+
{
|
|
95
|
+
pattern: /\b(async|await|const|let|var|function|return|if|else|for|while|try|catch|finally|class|extends|import|export|from|default|typeof|instanceof|new|this|super|static|public|private|protected)\b/g,
|
|
96
|
+
replacement: '<span class="sf-code-keyword">$1</span>'
|
|
97
|
+
},
|
|
98
|
+
// Numbers
|
|
99
|
+
{
|
|
100
|
+
pattern: /\b(\d+\.?\d*)\b/g,
|
|
101
|
+
replacement: '<span class="sf-code-number">$1</span>'
|
|
102
|
+
},
|
|
103
|
+
// Functions
|
|
104
|
+
{
|
|
105
|
+
pattern: /\b([a-zA-Z_$][a-zA-Z0-9_$]*)\s*(?=\()/g,
|
|
106
|
+
replacement: '<span class="sf-code-function">$1</span>'
|
|
107
|
+
},
|
|
108
|
+
// Objects and properties
|
|
109
|
+
{
|
|
110
|
+
pattern: /\.([a-zA-Z_$][a-zA-Z0-9_$]*)\b/g,
|
|
111
|
+
replacement: '.<span class="sf-code-property">$1</span>'
|
|
112
|
+
},
|
|
113
|
+
// Operators
|
|
114
|
+
{
|
|
115
|
+
pattern: /(\+|\-|\*|\/|%|=|==|===|!=|!==|<|>|<=|>=|&&|\|\||!|\?|:)/g,
|
|
116
|
+
replacement: '<span class="sf-code-operator">$1</span>'
|
|
117
|
+
}
|
|
118
|
+
];
|
|
119
|
+
|
|
120
|
+
// Apply patterns in sequence
|
|
121
|
+
patterns.forEach(({ pattern, replacement }) => {
|
|
122
|
+
highlightedCode = highlightedCode.replace(pattern, replacement);
|
|
123
|
+
});
|
|
124
|
+
|
|
125
|
+
codeRef.current.innerHTML = highlightedCode;
|
|
126
|
+
};
|
|
127
|
+
|
|
128
|
+
const handleCopy = async () => {
|
|
129
|
+
try {
|
|
130
|
+
await navigator.clipboard.writeText(code);
|
|
131
|
+
setCopied(true);
|
|
132
|
+
|
|
133
|
+
if (onCopy) {
|
|
134
|
+
onCopy(code);
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
// Reset copy state after 2 seconds
|
|
138
|
+
setTimeout(() => setCopied(false), 2000);
|
|
139
|
+
} catch (err) {
|
|
140
|
+
console.error('Failed to copy code:', err);
|
|
141
|
+
|
|
142
|
+
// Fallback for older browsers
|
|
143
|
+
const textArea = document.createElement('textarea');
|
|
144
|
+
textArea.value = code;
|
|
145
|
+
document.body.appendChild(textArea);
|
|
146
|
+
textArea.select();
|
|
147
|
+
document.execCommand('copy');
|
|
148
|
+
document.body.removeChild(textArea);
|
|
149
|
+
|
|
150
|
+
setCopied(true);
|
|
151
|
+
setTimeout(() => setCopied(false), 2000);
|
|
152
|
+
}
|
|
153
|
+
};
|
|
154
|
+
|
|
155
|
+
const handleCodeChange = (e) => {
|
|
156
|
+
if (editable && onChange) {
|
|
157
|
+
onChange(e.target.textContent);
|
|
158
|
+
}
|
|
159
|
+
};
|
|
160
|
+
|
|
161
|
+
const generateLineNumbers = () => {
|
|
162
|
+
return Array.from({ length: lineCount }, (_, i) => (
|
|
163
|
+
<span key={i + 1} className="sf-code-line-number">
|
|
164
|
+
{i + 1}
|
|
165
|
+
</span>
|
|
166
|
+
));
|
|
167
|
+
};
|
|
168
|
+
|
|
169
|
+
const getLanguageIcon = () => {
|
|
170
|
+
const icons = {
|
|
171
|
+
javascript: '{}',
|
|
172
|
+
typescript: 'TS',
|
|
173
|
+
html: '<>',
|
|
174
|
+
css: '🎨',
|
|
175
|
+
python: '🐍',
|
|
176
|
+
java: '☕',
|
|
177
|
+
bash: '$',
|
|
178
|
+
json: '{}',
|
|
179
|
+
xml: '</>',
|
|
180
|
+
sql: '📊'
|
|
181
|
+
};
|
|
182
|
+
return icons[language] || '💻';
|
|
183
|
+
};
|
|
184
|
+
|
|
185
|
+
return (
|
|
186
|
+
<div
|
|
187
|
+
ref={containerRef}
|
|
188
|
+
className={`sf-code-display ${isVisible ? 'sf-code-display--visible' : ''} ${className}`}
|
|
189
|
+
style={{ maxHeight }}
|
|
190
|
+
>
|
|
191
|
+
{showHeader && (
|
|
192
|
+
<div className="sf-code-display__header">
|
|
193
|
+
<div className="sf-code-display__window-controls">
|
|
194
|
+
<span className="sf-code-display__control sf-code-display__control--close"></span>
|
|
195
|
+
<span className="sf-code-display__control sf-code-display__control--minimize"></span>
|
|
196
|
+
<span className="sf-code-display__control sf-code-display__control--maximize"></span>
|
|
197
|
+
</div>
|
|
198
|
+
|
|
199
|
+
<div className="sf-code-display__title">
|
|
200
|
+
<span className="sf-code-display__icon">{getLanguageIcon()}</span>
|
|
201
|
+
<span className="sf-code-display__filename">{title}</span>
|
|
202
|
+
</div>
|
|
203
|
+
|
|
204
|
+
{showCopyButton && (
|
|
205
|
+
<button
|
|
206
|
+
className={`sf-code-display__copy ${copied ? 'sf-code-display__copy--copied' : ''}`}
|
|
207
|
+
onClick={handleCopy}
|
|
208
|
+
title="Copy to clipboard"
|
|
209
|
+
aria-label="Copy code to clipboard"
|
|
210
|
+
>
|
|
211
|
+
{copied ? (
|
|
212
|
+
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2">
|
|
213
|
+
<path d="M20 6L9 17L4 12"/>
|
|
214
|
+
</svg>
|
|
215
|
+
) : (
|
|
216
|
+
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2">
|
|
217
|
+
<rect x="9" y="9" width="13" height="13" rx="2" ry="2"/>
|
|
218
|
+
<path d="M5 15H4a2 2 0 01-2-2V4a2 2 0 012-2h9a2 2 0 012 2v1"/>
|
|
219
|
+
</svg>
|
|
220
|
+
)}
|
|
221
|
+
<span className="sf-code-display__copy-text">
|
|
222
|
+
{copied ? 'Copied!' : 'Copy'}
|
|
223
|
+
</span>
|
|
224
|
+
</button>
|
|
225
|
+
)}
|
|
226
|
+
</div>
|
|
227
|
+
)}
|
|
228
|
+
|
|
229
|
+
<div className="sf-code-display__body">
|
|
230
|
+
{showLineNumbers && (
|
|
231
|
+
<div className="sf-code-display__line-numbers">
|
|
232
|
+
{generateLineNumbers()}
|
|
233
|
+
</div>
|
|
234
|
+
)}
|
|
235
|
+
|
|
236
|
+
<div className="sf-code-display__content">
|
|
237
|
+
<pre className="sf-code-display__pre">
|
|
238
|
+
<code
|
|
239
|
+
ref={codeRef}
|
|
240
|
+
className={`sf-code-display__code language-${language}`}
|
|
241
|
+
contentEditable={editable}
|
|
242
|
+
suppressContentEditableWarning={true}
|
|
243
|
+
onInput={handleCodeChange}
|
|
244
|
+
spellCheck={false}
|
|
245
|
+
>
|
|
246
|
+
{code}
|
|
247
|
+
</code>
|
|
248
|
+
</pre>
|
|
249
|
+
</div>
|
|
250
|
+
</div>
|
|
251
|
+
|
|
252
|
+
{/* Terminal cursor */}
|
|
253
|
+
<div className="sf-code-display__cursor"></div>
|
|
254
|
+
|
|
255
|
+
{/* Copy feedback */}
|
|
256
|
+
{copied && (
|
|
257
|
+
<div className="sf-code-display__copy-feedback">
|
|
258
|
+
<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2">
|
|
259
|
+
<path d="M20 6L9 17L4 12"/>
|
|
260
|
+
</svg>
|
|
261
|
+
Copied to clipboard!
|
|
262
|
+
</div>
|
|
263
|
+
)}
|
|
264
|
+
</div>
|
|
265
|
+
);
|
|
266
|
+
};
|
|
267
|
+
|
|
268
|
+
export default CodeDisplay;
|