@salesforcedevs/docs-components 0.0.1-edit → 0.0.1-superscript

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.
Files changed (41) hide show
  1. package/lwc.config.json +2 -1
  2. package/package.json +29 -28
  3. package/src/modules/doc/amfReference/amfReference.css +0 -12
  4. package/src/modules/doc/amfReference/amfReference.html +2 -6
  5. package/src/modules/doc/amfReference/amfReference.ts +48 -37
  6. package/src/modules/doc/amfTopic/amfTopic.ts +24 -0
  7. package/src/modules/doc/breadcrumbs/breadcrumbs.html +0 -1
  8. package/src/modules/doc/componentPlayground/componentPlayground.css +11 -3
  9. package/src/modules/doc/componentPlayground/componentPlayground.html +4 -4
  10. package/src/modules/doc/componentPlayground/componentPlayground.ts +69 -1
  11. package/src/modules/doc/content/content.ts +0 -1
  12. package/src/modules/doc/contentCallout/contentCallout.css +1 -0
  13. package/src/modules/doc/contentLayout/contentLayout.html +53 -56
  14. package/src/modules/doc/contentLayout/contentLayout.ts +82 -43
  15. package/src/modules/doc/contentMedia/contentMedia.css +1 -1
  16. package/src/modules/doc/header/header.html +5 -1
  17. package/src/modules/doc/header/header.ts +10 -0
  18. package/src/modules/doc/lwcContentLayout/lwcContentLayout.css +8 -0
  19. package/src/modules/doc/lwcContentLayout/lwcContentLayout.html +38 -42
  20. package/src/modules/doc/lwcContentLayout/lwcContentLayout.ts +116 -15
  21. package/src/modules/doc/phase/phase.css +0 -7
  22. package/src/modules/doc/redocReference/redocReference.css +7 -0
  23. package/src/modules/doc/redocReference/redocReference.html +13 -0
  24. package/src/modules/doc/redocReference/redocReference.ts +425 -0
  25. package/src/modules/doc/specificationContent/specificationContent.html +15 -9
  26. package/src/modules/doc/specificationContent/specificationContent.ts +39 -0
  27. package/src/modules/doc/superscriptSubscript/superscriptSubscript.html +8 -0
  28. package/src/modules/doc/superscriptSubscript/superscriptSubscript.ts +16 -0
  29. package/src/modules/doc/versionPicker/versionPicker.html +2 -0
  30. package/src/modules/doc/xmlContent/xmlContent.css +0 -10
  31. package/src/modules/doc/xmlContent/xmlContent.html +11 -8
  32. package/src/modules/doc/xmlContent/xmlContent.ts +95 -53
  33. package/src/modules/docHelpers/amfStyle/amfStyle.css +0 -2
  34. package/src/modules/docHelpers/contentLayoutStyle/contentLayoutStyle.css +32 -1
  35. package/src/modules/doc/chat/README.md +0 -179
  36. package/src/modules/doc/chat/chat.css +0 -818
  37. package/src/modules/doc/chat/chat.html +0 -241
  38. package/src/modules/doc/chat/chat.ts +0 -586
  39. package/src/modules/doc/editFile/editFile.css +0 -514
  40. package/src/modules/doc/editFile/editFile.html +0 -164
  41. package/src/modules/doc/editFile/editFile.ts +0 -213
@@ -1,213 +0,0 @@
1
- import { LightningElement, api, track } from "lwc";
2
- import cx from "classnames";
3
- import { normalizeBoolean } from "dxUtils/normalizers";
4
-
5
- interface ApiResponse {
6
- success: boolean;
7
- data?: string;
8
- message?: string;
9
- error?: string;
10
- }
11
-
12
- export default class EditFile extends LightningElement {
13
- @api fileName: string = "";
14
- @api apiEndpoint: string = "/api/edit-file";
15
- @api title: string = "Edit File";
16
-
17
- @api
18
- get disabled() {
19
- return this._disabled;
20
- }
21
-
22
- set disabled(value) {
23
- this._disabled = normalizeBoolean(value);
24
- }
25
-
26
- @track isPopoverOpen: boolean = false;
27
- @track isLoading: boolean = false;
28
- @track isSaving: boolean = false;
29
- @track fileContent: string = "";
30
- @track originalContent: string = "";
31
- @track errorMessage: string = "";
32
-
33
- private _disabled: boolean = false;
34
-
35
- // API Configuration
36
- private static readonly FETCH_ENDPOINT = "/api/file/fetch";
37
- private static readonly SAVE_ENDPOINT = "/api/file/save";
38
-
39
- get popoverClass() {
40
- return cx(
41
- "edit-file-popover",
42
- this.isPopoverOpen && "edit-file-popover_open"
43
- );
44
- }
45
-
46
- get overlayClass() {
47
- return cx(
48
- "edit-file-overlay",
49
- this.isPopoverOpen && "edit-file-overlay_open"
50
- );
51
- }
52
-
53
- get saveButtonClass() {
54
- return cx(
55
- "edit-file-button",
56
- "edit-file-button_primary",
57
- (this.isSaving || this.isContentUnchanged) && "edit-file-button_disabled"
58
- );
59
- }
60
-
61
- get isContentUnchanged() {
62
- return this.fileContent === this.originalContent;
63
- }
64
-
65
- // Open the edit file popover
66
- async handleEditClick() {
67
- if (this.disabled) return;
68
-
69
- this.isPopoverOpen = true;
70
- this.errorMessage = "";
71
- await this.fetchFileContent();
72
- }
73
-
74
- // Fetch file content from API
75
- private async fetchFileContent() {
76
- if (!this.fileName) {
77
- this.errorMessage = "No file specified to edit";
78
- return;
79
- }
80
-
81
- this.isLoading = true;
82
-
83
- try {
84
- const response = await fetch(EditFile.FETCH_ENDPOINT, {
85
- method: "POST",
86
- headers: {
87
- "Content-Type": "application/json",
88
- },
89
- body: JSON.stringify({
90
- fileName: this.fileName,
91
- action: "fetch"
92
- })
93
- });
94
-
95
- if (!response.ok) {
96
- throw new Error(`Failed to fetch file: ${response.status}`);
97
- }
98
-
99
- const data: ApiResponse = await response.json();
100
-
101
- if (data.success && data.data !== undefined) {
102
- this.fileContent = data.data;
103
- this.originalContent = data.data;
104
- this.errorMessage = "";
105
- } else {
106
- this.errorMessage = data.error || data.message || "Failed to load file content";
107
- }
108
- } catch (error) {
109
- console.error("Error fetching file content:", error);
110
- this.errorMessage = error instanceof Error ? error.message : "Failed to connect to server";
111
- } finally {
112
- this.isLoading = false;
113
- }
114
- }
115
-
116
- // Handle content change in textarea
117
- handleContentChange(event: Event) {
118
- const target = event.target as HTMLTextAreaElement;
119
- this.fileContent = target.value;
120
- }
121
-
122
- // Handle cancel action
123
- handleCancel() {
124
- this.isPopoverOpen = false;
125
- this.fileContent = "";
126
- this.originalContent = "";
127
- this.errorMessage = "";
128
- this.isLoading = false;
129
- this.isSaving = false;
130
-
131
- // Dispatch cancel event
132
- this.dispatchEvent(
133
- new CustomEvent("editcancel", {
134
- detail: { fileName: this.fileName }
135
- })
136
- );
137
- }
138
-
139
- // Handle save action
140
- async handleSave() {
141
- if (this.isSaving || this.isContentUnchanged || this.disabled) return;
142
-
143
- this.isSaving = true;
144
- this.errorMessage = "";
145
-
146
- try {
147
- const response = await fetch(EditFile.SAVE_ENDPOINT, {
148
- method: "POST",
149
- headers: {
150
- "Content-Type": "application/json",
151
- },
152
- body: JSON.stringify({
153
- fileName: this.fileName,
154
- content: this.fileContent,
155
- action: "save"
156
- })
157
- });
158
-
159
- if (!response.ok) {
160
- throw new Error(`Failed to save file: ${response.status}`);
161
- }
162
-
163
- const data: ApiResponse = await response.json();
164
-
165
- if (data.success) {
166
- this.originalContent = this.fileContent;
167
- this.isPopoverOpen = false;
168
-
169
- // Dispatch success event
170
- this.dispatchEvent(
171
- new CustomEvent("editsuccess", {
172
- detail: {
173
- fileName: this.fileName,
174
- content: this.fileContent,
175
- message: data.message || "File saved successfully"
176
- }
177
- })
178
- );
179
- } else {
180
- this.errorMessage = data.error || data.message || "Failed to save file";
181
- }
182
- } catch (error) {
183
- console.error("Error saving file:", error);
184
- this.errorMessage = error instanceof Error ? error.message : "Failed to connect to server";
185
- } finally {
186
- this.isSaving = false;
187
- }
188
- }
189
-
190
- // Handle overlay click to close popover
191
- handleOverlayClick(event: Event) {
192
- if (event.target === event.currentTarget) {
193
- this.handleCancel();
194
- }
195
- }
196
-
197
- // Handle escape key to close popover
198
- handleKeyDown(event: KeyboardEvent) {
199
- if (event.key === "Escape" && this.isPopoverOpen) {
200
- this.handleCancel();
201
- }
202
- }
203
-
204
- connectedCallback() {
205
- // Add escape key listener
206
- document.addEventListener("keydown", this.handleKeyDown.bind(this));
207
- }
208
-
209
- disconnectedCallback() {
210
- // Remove escape key listener
211
- document.removeEventListener("keydown", this.handleKeyDown.bind(this));
212
- }
213
- }