@salesforcedevs/docs-components 1.17.0-hack-alpha8 → 1.17.2
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/LICENSE +12 -0
- package/lwc.config.json +0 -1
- package/package.json +2 -2
- package/src/modules/doc/content/content.css +6 -17
- package/src/modules/doc/heading/heading.css +0 -56
- package/src/modules/doc/heading/heading.html +0 -40
- package/src/modules/doc/heading/heading.ts +0 -24
- package/src/modules/doc/xmlContent/xmlContent.html +9 -1
- package/src/modules/doc/xmlContent/xmlContent.ts +18 -8
- package/src/modules/docHelpers/contentLayoutStyle/contentLayoutStyle.css +0 -1
- package/src/modules/doc/commentPopup/README.md +0 -322
- package/src/modules/doc/commentPopup/commentDevHelper.ts +0 -380
- package/src/modules/doc/commentPopup/commentPopup.css +0 -440
- package/src/modules/doc/commentPopup/commentPopup.html +0 -138
- package/src/modules/doc/commentPopup/commentPopup.ts +0 -565
- package/src/modules/doc/commentPopup/commentUtils.ts +0 -382
|
@@ -1,380 +0,0 @@
|
|
|
1
|
-
// Development Helper for Comment Management
|
|
2
|
-
// This file provides a simple interface to manage comments during development
|
|
3
|
-
// You can use this in the browser console or create a simple UI for it
|
|
4
|
-
|
|
5
|
-
import {
|
|
6
|
-
exportCommentsToFile,
|
|
7
|
-
importCommentsFromFile,
|
|
8
|
-
getAllComments,
|
|
9
|
-
clearAllComments,
|
|
10
|
-
getCommentsStats,
|
|
11
|
-
convertToApiFormat,
|
|
12
|
-
addComment,
|
|
13
|
-
getCommentsForBranch,
|
|
14
|
-
fetchCommentsForBranch,
|
|
15
|
-
extractCommentsFromApiResponse
|
|
16
|
-
} from "./commentUtils";
|
|
17
|
-
|
|
18
|
-
// Make functions available globally for console access
|
|
19
|
-
if (typeof window !== "undefined") {
|
|
20
|
-
(window as any).CommentDevHelper = {
|
|
21
|
-
exportCommentsToFile,
|
|
22
|
-
importCommentsFromFile,
|
|
23
|
-
getAllComments,
|
|
24
|
-
clearAllComments,
|
|
25
|
-
getCommentsStats,
|
|
26
|
-
convertToApiFormat,
|
|
27
|
-
addComment,
|
|
28
|
-
getCommentsForBranch,
|
|
29
|
-
fetchCommentsForBranch,
|
|
30
|
-
extractCommentsFromApiResponse,
|
|
31
|
-
checkApiAvailability
|
|
32
|
-
};
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
/**
|
|
36
|
-
* Create a simple UI for managing comments during development
|
|
37
|
-
*/
|
|
38
|
-
export function createDevUI(): void {
|
|
39
|
-
if (typeof document === "undefined") {
|
|
40
|
-
return;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
// Check if UI already exists
|
|
44
|
-
if (document.getElementById("comment-dev-ui")) {
|
|
45
|
-
return;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
const ui = document.createElement("div");
|
|
49
|
-
ui.id = "comment-dev-ui";
|
|
50
|
-
ui.style.cssText = `
|
|
51
|
-
position: fixed;
|
|
52
|
-
top: 20px;
|
|
53
|
-
right: 20px;
|
|
54
|
-
width: 350px;
|
|
55
|
-
background: white;
|
|
56
|
-
border: 2px solid #007bff;
|
|
57
|
-
border-radius: 8px;
|
|
58
|
-
padding: 16px;
|
|
59
|
-
font-family: Arial, sans-serif;
|
|
60
|
-
font-size: 14px;
|
|
61
|
-
z-index: 10000;
|
|
62
|
-
box-shadow: 0 4px 12px rgba(0,0,0,0.15);
|
|
63
|
-
max-height: 80vh;
|
|
64
|
-
overflow-y: auto;
|
|
65
|
-
`;
|
|
66
|
-
|
|
67
|
-
const stats = getCommentsStats();
|
|
68
|
-
|
|
69
|
-
ui.innerHTML = `
|
|
70
|
-
<div style="display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px;">
|
|
71
|
-
<h3 style="margin: 0; color: #007bff;">Comment Dev Helper</h3>
|
|
72
|
-
<button onclick="document.getElementById('comment-dev-ui').remove()" style="background: none; border: none; font-size: 18px; cursor: pointer;">×</button>
|
|
73
|
-
</div>
|
|
74
|
-
|
|
75
|
-
<div style="margin-bottom: 12px;">
|
|
76
|
-
<strong>Stats:</strong><br>
|
|
77
|
-
Branches: ${stats.branches.length}<br>
|
|
78
|
-
Locations: ${stats.totalLocations}<br>
|
|
79
|
-
Total Comments: ${stats.totalComments}
|
|
80
|
-
</div>
|
|
81
|
-
|
|
82
|
-
<div style="display: flex; flex-direction: column; gap: 8px;">
|
|
83
|
-
<button onclick="CommentDevHelper.exportCommentsToFile()" style="padding: 8px; background: #28a745; color: white; border: none; border-radius: 4px; cursor: pointer;">
|
|
84
|
-
Export Comments
|
|
85
|
-
</button>
|
|
86
|
-
|
|
87
|
-
<button onclick="CommentDevHelper.clearAllComments()" style="padding: 8px; background: #dc3545; color: white; border: none; border-radius: 4px; cursor: pointer;">
|
|
88
|
-
Clear All Comments
|
|
89
|
-
</button>
|
|
90
|
-
|
|
91
|
-
<button onclick="CommentDevHelper.getCommentsStats()" style="padding: 8px; background: #17a2b8; color: white; border: none; border-radius: 4px; cursor: pointer;">
|
|
92
|
-
Show Stats in Console
|
|
93
|
-
</button>
|
|
94
|
-
|
|
95
|
-
<button onclick="console.log(CommentDevHelper.convertToApiFormat())" style="padding: 8px; background: #6f42c1; color: white; border: none; border-radius: 4px; cursor: pointer;">
|
|
96
|
-
Show API Format in Console
|
|
97
|
-
</button>
|
|
98
|
-
|
|
99
|
-
<button onclick="CommentDevHelper.addSampleCommentsForNewApi()" style="padding: 8px; background: #fd7e14; color: white; border: none; border-radius: 4px; cursor: pointer;">
|
|
100
|
-
Add Sample Comments (New API Format)
|
|
101
|
-
</button>
|
|
102
|
-
|
|
103
|
-
<button onclick="CommentDevHelper.testApiResponseFormat()" style="padding: 8px; background: #20c997; color: white; border: none; border-radius: 4px; cursor: pointer;">
|
|
104
|
-
Test API Response Format
|
|
105
|
-
</button>
|
|
106
|
-
</div>
|
|
107
|
-
|
|
108
|
-
<div style="margin-top: 12px; font-size: 12px; color: #666;">
|
|
109
|
-
<strong>Console Commands:</strong><br>
|
|
110
|
-
CommentDevHelper.exportCommentsToFile()<br>
|
|
111
|
-
CommentDevHelper.clearAllComments()<br>
|
|
112
|
-
CommentDevHelper.getCommentsStats()<br>
|
|
113
|
-
CommentDevHelper.convertToApiFormat()<br>
|
|
114
|
-
CommentDevHelper.getCommentsForBranch('main')<br>
|
|
115
|
-
CommentDevHelper.testApiResponseFormat()
|
|
116
|
-
</div>
|
|
117
|
-
`;
|
|
118
|
-
|
|
119
|
-
document.body.appendChild(ui);
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
/**
|
|
123
|
-
* Remove the development UI
|
|
124
|
-
*/
|
|
125
|
-
export function removeDevUI(): void {
|
|
126
|
-
const ui = document.getElementById("comment-dev-ui");
|
|
127
|
-
if (ui) {
|
|
128
|
-
ui.remove();
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
/**
|
|
133
|
-
* Add sample comments that match the new API format
|
|
134
|
-
*/
|
|
135
|
-
export function addSampleCommentsForNewApi(): void {
|
|
136
|
-
const sampleComments = [
|
|
137
|
-
{
|
|
138
|
-
branch: "feature/documentation-updates",
|
|
139
|
-
file_path: "docs/installation.md",
|
|
140
|
-
heading_title: "Installation Guide",
|
|
141
|
-
start_line: "1",
|
|
142
|
-
end_line: "50",
|
|
143
|
-
comment: {
|
|
144
|
-
comment_text:
|
|
145
|
-
"This installation guide is very helpful for new users.",
|
|
146
|
-
email: "john.doe@example.com",
|
|
147
|
-
timestamp: new Date(Date.now() - 3600000).toISOString() // 1 hour ago
|
|
148
|
-
}
|
|
149
|
-
},
|
|
150
|
-
{
|
|
151
|
-
branch: "feature/documentation-updates",
|
|
152
|
-
file_path: "docs/installation.md",
|
|
153
|
-
heading_title: "Installation Guide",
|
|
154
|
-
start_line: "1",
|
|
155
|
-
end_line: "50",
|
|
156
|
-
comment: {
|
|
157
|
-
comment_text:
|
|
158
|
-
"Consider adding troubleshooting section for common issues.",
|
|
159
|
-
email: "jane.smith@example.com",
|
|
160
|
-
timestamp: new Date(Date.now() - 1800000).toISOString() // 30 minutes ago
|
|
161
|
-
}
|
|
162
|
-
},
|
|
163
|
-
{
|
|
164
|
-
branch: "feature/documentation-updates",
|
|
165
|
-
file_path: "docs/installation.md",
|
|
166
|
-
heading_title: "Prerequisites",
|
|
167
|
-
start_line: "10",
|
|
168
|
-
end_line: "25",
|
|
169
|
-
comment: {
|
|
170
|
-
comment_text:
|
|
171
|
-
"The prerequisites section is clear and well-organized.",
|
|
172
|
-
email: "mike.wilson@example.com",
|
|
173
|
-
timestamp: new Date(Date.now() - 900000).toISOString() // 15 minutes ago
|
|
174
|
-
}
|
|
175
|
-
},
|
|
176
|
-
{
|
|
177
|
-
branch: "feature/documentation-updates",
|
|
178
|
-
file_path: "docs/api.md",
|
|
179
|
-
heading_title: "API Reference",
|
|
180
|
-
start_line: "1",
|
|
181
|
-
end_line: "100",
|
|
182
|
-
comment: {
|
|
183
|
-
comment_text:
|
|
184
|
-
"The API documentation needs more examples for authentication.",
|
|
185
|
-
email: "sarah.jones@example.com",
|
|
186
|
-
timestamp: new Date(Date.now() - 600000).toISOString() // 10 minutes ago
|
|
187
|
-
}
|
|
188
|
-
},
|
|
189
|
-
{
|
|
190
|
-
branch: "feature/documentation-updates",
|
|
191
|
-
file_path: "docs/api.md",
|
|
192
|
-
heading_title: "API Reference",
|
|
193
|
-
start_line: "1",
|
|
194
|
-
end_line: "100",
|
|
195
|
-
comment: {
|
|
196
|
-
comment_text: "Great work on the endpoint descriptions!",
|
|
197
|
-
email: "david.brown@example.com",
|
|
198
|
-
timestamp: new Date().toISOString() // now
|
|
199
|
-
}
|
|
200
|
-
},
|
|
201
|
-
{
|
|
202
|
-
branch: "main",
|
|
203
|
-
file_path: "docs/getting-started.md",
|
|
204
|
-
heading_title: "Quick Start",
|
|
205
|
-
start_line: "1",
|
|
206
|
-
end_line: "30",
|
|
207
|
-
comment: {
|
|
208
|
-
comment_text:
|
|
209
|
-
"This quick start guide is perfect for beginners.",
|
|
210
|
-
email: "alice.johnson@example.com",
|
|
211
|
-
timestamp: new Date(Date.now() - 7200000).toISOString() // 2 hours ago
|
|
212
|
-
}
|
|
213
|
-
}
|
|
214
|
-
];
|
|
215
|
-
|
|
216
|
-
sampleComments.forEach((comment) => {
|
|
217
|
-
addComment(comment);
|
|
218
|
-
});
|
|
219
|
-
|
|
220
|
-
console.log("Added sample comments for new API format");
|
|
221
|
-
console.log("Sample data includes multiple branches, files, and titles");
|
|
222
|
-
|
|
223
|
-
// Refresh the page to show the new comments
|
|
224
|
-
setTimeout(() => {
|
|
225
|
-
window.location.reload();
|
|
226
|
-
}, 1000);
|
|
227
|
-
}
|
|
228
|
-
|
|
229
|
-
/**
|
|
230
|
-
* Test the API response format
|
|
231
|
-
*/
|
|
232
|
-
export function testApiResponseFormat(): void {
|
|
233
|
-
console.log("=== Testing API Response Format ===");
|
|
234
|
-
|
|
235
|
-
// Test with feature/documentation-updates branch
|
|
236
|
-
const featureBranchResponse = getCommentsForBranch(
|
|
237
|
-
"feature/documentation-updates"
|
|
238
|
-
);
|
|
239
|
-
console.log("Feature branch response:", featureBranchResponse);
|
|
240
|
-
|
|
241
|
-
// Test with main branch
|
|
242
|
-
const mainBranchResponse = getCommentsForBranch("main");
|
|
243
|
-
console.log("Main branch response:", mainBranchResponse);
|
|
244
|
-
|
|
245
|
-
// Test extracting specific comments
|
|
246
|
-
const installationComments = extractCommentsFromApiResponse(
|
|
247
|
-
featureBranchResponse,
|
|
248
|
-
"docs/installation.md",
|
|
249
|
-
"Installation Guide"
|
|
250
|
-
);
|
|
251
|
-
console.log("Installation Guide comments:", installationComments);
|
|
252
|
-
|
|
253
|
-
const apiComments = extractCommentsFromApiResponse(
|
|
254
|
-
featureBranchResponse,
|
|
255
|
-
"docs/api.md",
|
|
256
|
-
"API Reference"
|
|
257
|
-
);
|
|
258
|
-
console.log("API Reference comments:", apiComments);
|
|
259
|
-
|
|
260
|
-
console.log("=== API Response Format Test Complete ===");
|
|
261
|
-
}
|
|
262
|
-
|
|
263
|
-
/**
|
|
264
|
-
* Show all comments in a formatted way in the console
|
|
265
|
-
*/
|
|
266
|
-
export function showAllComments(): void {
|
|
267
|
-
const allComments = getAllComments();
|
|
268
|
-
console.log("=== ALL COMMENTS ===");
|
|
269
|
-
console.table(allComments);
|
|
270
|
-
|
|
271
|
-
const stats = getCommentsStats();
|
|
272
|
-
console.log("=== STATISTICS ===");
|
|
273
|
-
console.table(stats.locations);
|
|
274
|
-
|
|
275
|
-
console.log("=== BRANCHES ===");
|
|
276
|
-
console.log("Available branches:", stats.branches);
|
|
277
|
-
}
|
|
278
|
-
|
|
279
|
-
/**
|
|
280
|
-
* Simulate API call and show response
|
|
281
|
-
*/
|
|
282
|
-
export async function simulateApiCall(
|
|
283
|
-
branch: string = "feature/documentation-updates"
|
|
284
|
-
): Promise<void> {
|
|
285
|
-
console.log(`=== Simulating API Call for branch: ${branch} ===`);
|
|
286
|
-
|
|
287
|
-
try {
|
|
288
|
-
const response = await fetchCommentsForBranch(branch);
|
|
289
|
-
console.log("API Response:", response);
|
|
290
|
-
|
|
291
|
-
// Show all paths and titles
|
|
292
|
-
response.paths.forEach((path) => {
|
|
293
|
-
console.log(`File: ${path.path}`);
|
|
294
|
-
path.titles.forEach((title) => {
|
|
295
|
-
console.log(
|
|
296
|
-
` Title: ${title.title} (${title.comments.length} comments)`
|
|
297
|
-
);
|
|
298
|
-
});
|
|
299
|
-
});
|
|
300
|
-
} catch (error) {
|
|
301
|
-
console.error("API call simulation failed:", error);
|
|
302
|
-
}
|
|
303
|
-
}
|
|
304
|
-
|
|
305
|
-
/**
|
|
306
|
-
* Check if the API endpoints are available
|
|
307
|
-
*/
|
|
308
|
-
export async function checkApiAvailability(): Promise<void> {
|
|
309
|
-
console.log("=== Checking API Availability ===");
|
|
310
|
-
|
|
311
|
-
try {
|
|
312
|
-
// Test GET endpoint
|
|
313
|
-
const getResponse = await fetch("/get-comments?branch=test");
|
|
314
|
-
console.log(
|
|
315
|
-
`GET /get-comments status: ${getResponse.status} ${getResponse.statusText}`
|
|
316
|
-
);
|
|
317
|
-
|
|
318
|
-
if (getResponse.ok) {
|
|
319
|
-
console.log("✅ GET /get-comments is available");
|
|
320
|
-
} else {
|
|
321
|
-
console.log("❌ GET /get-comments is not available");
|
|
322
|
-
}
|
|
323
|
-
|
|
324
|
-
// Test POST endpoint (with a test payload)
|
|
325
|
-
const testPayload = {
|
|
326
|
-
branch: "test",
|
|
327
|
-
file_path: "test.md",
|
|
328
|
-
heading_title: "Test",
|
|
329
|
-
start_line: "1",
|
|
330
|
-
end_line: "10",
|
|
331
|
-
comment: {
|
|
332
|
-
comment_text: "Test comment",
|
|
333
|
-
email: "test@example.com",
|
|
334
|
-
timestamp: new Date().toISOString()
|
|
335
|
-
}
|
|
336
|
-
};
|
|
337
|
-
|
|
338
|
-
const postResponse = await fetch("/post-comment", {
|
|
339
|
-
method: "POST",
|
|
340
|
-
headers: {
|
|
341
|
-
"Content-Type": "application/json"
|
|
342
|
-
},
|
|
343
|
-
body: JSON.stringify(testPayload)
|
|
344
|
-
});
|
|
345
|
-
|
|
346
|
-
console.log(
|
|
347
|
-
`POST /post-comment status: ${postResponse.status} ${postResponse.statusText}`
|
|
348
|
-
);
|
|
349
|
-
|
|
350
|
-
if (postResponse.ok) {
|
|
351
|
-
console.log("✅ POST /post-comment is available");
|
|
352
|
-
} else {
|
|
353
|
-
console.log("❌ POST /post-comment is not available");
|
|
354
|
-
}
|
|
355
|
-
|
|
356
|
-
console.log("=== API Availability Check Complete ===");
|
|
357
|
-
} catch (error) {
|
|
358
|
-
console.error("❌ API availability check failed:", error);
|
|
359
|
-
console.log("This is expected if the backend is not running");
|
|
360
|
-
}
|
|
361
|
-
}
|
|
362
|
-
|
|
363
|
-
// Add the helper functions to the global CommentDevHelper
|
|
364
|
-
if (typeof window !== "undefined") {
|
|
365
|
-
(window as any).CommentDevHelper = {
|
|
366
|
-
...(window as any).CommentDevHelper,
|
|
367
|
-
addSampleCommentsForNewApi,
|
|
368
|
-
testApiResponseFormat,
|
|
369
|
-
showAllComments,
|
|
370
|
-
simulateApiCall
|
|
371
|
-
};
|
|
372
|
-
}
|
|
373
|
-
|
|
374
|
-
// Auto-create UI when this module is imported (in development)
|
|
375
|
-
if (typeof window !== "undefined" && window.location.hostname === "localhost") {
|
|
376
|
-
// Only auto-create in development environment
|
|
377
|
-
setTimeout(() => {
|
|
378
|
-
createDevUI();
|
|
379
|
-
}, 1000);
|
|
380
|
-
}
|