documentation-hub 5.7.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/.eslintrc.json +43 -0
- package/.github/workflows/build.yml +64 -0
- package/.github/workflows/ci.yml +39 -0
- package/.vscode/extensions.json +3 -0
- package/Current.md +97 -0
- package/DocHub_Image.png +0 -0
- package/README.md +666 -0
- package/USER_GUIDE.md +1173 -0
- package/Updater.md +311 -0
- package/build/256x256.png +0 -0
- package/build/512x512.png +0 -0
- package/build/app-update.yml +4 -0
- package/build/create-icon.js +208 -0
- package/build/icon.ico +0 -0
- package/build/icon.png +0 -0
- package/build/icon_1024x1024.png +0 -0
- package/dist/assets/Analytics-BpsG9895.js +1 -0
- package/dist/assets/Card-IAZin8kp.js +1 -0
- package/dist/assets/CurrentSession-B-rFkHvf.js +12 -0
- package/dist/assets/Dashboard-C_5gMb0q.js +1 -0
- package/dist/assets/Documents-CqZ25axS.js +1 -0
- package/dist/assets/Input-l89xwXBi.js +1 -0
- package/dist/assets/Reporting-DqdHJY_a.js +1 -0
- package/dist/assets/Search-XNbu5z_3.js +1 -0
- package/dist/assets/SessionManager-lH9hZfzH.js +1 -0
- package/dist/assets/Sessions-ClZOPYNc.js +1 -0
- package/dist/assets/Settings-DUEHGURa.js +11 -0
- package/dist/assets/index-8xUe8ptc.js +24 -0
- package/dist/assets/index-RYyJqF7O.css +1 -0
- package/dist/assets/path-BkOl0AGO.js +1 -0
- package/dist/assets/promises-ID_B9S-h.js +1 -0
- package/dist/assets/urlHelpers-TvgahX0r.js +1 -0
- package/dist/assets/useToast-yRSO1dkm.js +1 -0
- package/dist/assets/vendor-charts-RkGK5ROP.js +36 -0
- package/dist/assets/vendor-db-l0sNRNKZ.js +1 -0
- package/dist/assets/vendor-react-BVZ_anCF.js +4 -0
- package/dist/assets/vendor-search-Dw8P0qyA.js +1 -0
- package/dist/assets/vendor-ui-BU7NfluV.js +53 -0
- package/dist/electron/PowerAutomateApiService-LfW09ZGr.js +147 -0
- package/dist/electron/main-CXkNtyv-.js +19789 -0
- package/dist/electron/main.js +5 -0
- package/dist/electron/preload.js +1 -0
- package/dist/icon.png +0 -0
- package/dist/index.html +27 -0
- package/docs/CODEBASE_ANALYSIS_REPORT.md +309 -0
- package/docs/DEBUG_LOGGING_GUIDE.md +244 -0
- package/docs/README.md +115 -0
- package/docs/TOC_WIRING_GUIDE.md +344 -0
- package/docs/analysis/Bullet_Symbol_Bug_Analysis.md +136 -0
- package/docs/analysis/DOCXMLATER_ANALYSIS_SUMMARY.txt +169 -0
- package/docs/analysis/Document_Processing_Issues_Analysis.md +704 -0
- package/docs/analysis/FIELD_PRESERVATION_ANALYSIS.md +1200 -0
- package/docs/analysis/INDENTATION_PRESERVE_ANALYSIS.md +181 -0
- package/docs/analysis/INDENTATION_PRESERVE_IMPLEMENTATION.md +207 -0
- package/docs/analysis/List_Implementation.md +206 -0
- package/docs/analysis/List_Implementation_Accuracy_Report.md +366 -0
- package/docs/analysis/PROCESSING_OPTIONS_UI_UPDATES.md +220 -0
- package/docs/analysis/RefactorStyles.md +852 -0
- package/docs/analysis/STYLE_PARAMETER_ENHANCEMENT.md +143 -0
- package/docs/analysis/docxmlater-comparison-todo-2025-11-13.md +636 -0
- package/docs/analysis/docxmlater-implementation-analysis-2025-11-13.md +340 -0
- package/docs/analysis/docxmlater-template_ui-integration-analysis.md +263 -0
- package/docs/analysis/github-issues-to-create.md +237 -0
- package/docs/api/API_README.md +538 -0
- package/docs/api/API_REFERENCE.md +751 -0
- package/docs/api/TYPE_DEFINITIONS.md +869 -0
- package/docs/architecture/FONT_EMBEDDING_GUIDE.md +318 -0
- package/docs/architecture/docxmlater-functions-and-structure.md +726 -0
- package/docs/docxmlater-readme.md +1341 -0
- package/docs/fixes/EXECUTION_LOG_TEST_BASE.md +573 -0
- package/docs/fixes/HYPERLINK_TEXT_SANITIZATION.md +253 -0
- package/docs/fixes/README.md +37 -0
- package/docs/github-issues/issue-1-body.md +125 -0
- package/docs/github-issues/issue-10-body.md +850 -0
- package/docs/github-issues/issue-2-body.md +200 -0
- package/docs/github-issues/issue-3-body.md +270 -0
- package/docs/github-issues/issue-4-body.md +169 -0
- package/docs/github-issues/issue-5-body.md +173 -0
- package/docs/github-issues/issue-6-body.md +158 -0
- package/docs/github-issues/issue-7-body.md +171 -0
- package/docs/github-issues/issue-8-body.md +407 -0
- package/docs/github-issues/issue-9-body.md +515 -0
- package/docs/github-issues/issue-tracker.md +274 -0
- package/docs/github-issues/predictive-analysis-2025-10-18.md +2131 -0
- package/docs/implementation/List_Framework_Refactor_Plan.md +336 -0
- package/docs/implementation/PRIMARY_TEXT_COLOR_FEATURE.md +217 -0
- package/docs/implementation/RELEASE_PLAN_v2.1.0.md +362 -0
- package/docs/implementation/RefactorStyles.md +588 -0
- package/docs/implementation/implement-plan.md +489 -0
- package/docs/implementation/missing-helpers-implementation.md +391 -0
- package/docs/implementation/refactor-plan.md +520 -0
- package/docs/implementation/session-implementation-complete.md +233 -0
- package/docs/implementation/session-management-plan.md +250 -0
- package/docs/setup-checklist.md +77 -0
- package/docs/versions/changelog.md +345 -0
- package/electron/customUpdater.ts +656 -0
- package/electron/main.ts +2441 -0
- package/electron/memoryConfig.ts +187 -0
- package/electron/preload.ts +394 -0
- package/electron/proxyConfig.ts +340 -0
- package/electron/services/BackupService.ts +452 -0
- package/electron/services/DictionaryService.ts +402 -0
- package/electron/services/LocalDictionaryLookupService.ts +147 -0
- package/electron/services/PowerAutomateApiService.ts +231 -0
- package/electron/services/SharePointSyncService.ts +474 -0
- package/electron/windowsCertStore.ts +427 -0
- package/electron/zscalerConfig.ts +381 -0
- package/eslint.config.js +92 -0
- package/jest.config.js +52 -0
- package/package.json +214 -0
- package/postcss.config.mjs +6 -0
- package/public/icon.png +0 -0
- package/publish-release.ps1 +5 -0
- package/renovate.json +30 -0
- package/src/App.tsx +216 -0
- package/src/__mocks__/p-limit.js +12 -0
- package/src/__mocks__/styleMock.js +1 -0
- package/src/components/common/BugReportButton.tsx +44 -0
- package/src/components/common/BugReportDialog.tsx +193 -0
- package/src/components/common/Button.tsx +153 -0
- package/src/components/common/Card.tsx +86 -0
- package/src/components/common/ColorPickerDialog.tsx +177 -0
- package/src/components/common/ConfirmDialog.tsx +96 -0
- package/src/components/common/DebugConsole.tsx +275 -0
- package/src/components/common/EmptyState.tsx +183 -0
- package/src/components/common/ErrorBoundary.tsx +98 -0
- package/src/components/common/ErrorDetailsDialog.tsx +153 -0
- package/src/components/common/ErrorFallback.tsx +218 -0
- package/src/components/common/Input.tsx +109 -0
- package/src/components/common/Skeleton.tsx +184 -0
- package/src/components/common/SplashScreen.tsx +81 -0
- package/src/components/common/Toast.tsx +155 -0
- package/src/components/common/Tooltip.tsx +79 -0
- package/src/components/common/UpdateNotification.tsx +320 -0
- package/src/components/comparison/ComparisonWindow.tsx +374 -0
- package/src/components/comparison/SideBySideDiff.tsx +486 -0
- package/src/components/comparison/index.ts +8 -0
- package/src/components/document/DocumentUploader.tsx +288 -0
- package/src/components/document/HyperlinkPreview.tsx +430 -0
- package/src/components/document/HyperlinkService.md +1484 -0
- package/src/components/document/Hyperlink_Technical_Documentation.md +496 -0
- package/src/components/document/InlineChangesView.tsx +707 -0
- package/src/components/document/ProcessingProgress.tsx +303 -0
- package/src/components/document/ProcessingResults.tsx +256 -0
- package/src/components/document/TrackedChangesDetail.tsx +530 -0
- package/src/components/document/TrackedChangesPanel.tsx +546 -0
- package/src/components/document/VirtualDocumentList.tsx +240 -0
- package/src/components/editor/DocumentEditor.tsx +723 -0
- package/src/components/editor/DocumentEditorModal.tsx +640 -0
- package/src/components/editor/EditorQuickActions.tsx +502 -0
- package/src/components/editor/EditorToolbar.tsx +312 -0
- package/src/components/editor/TableEditor.tsx +926 -0
- package/src/components/editor/index.ts +18 -0
- package/src/components/layout/Header.tsx +190 -0
- package/src/components/layout/Sidebar.tsx +313 -0
- package/src/components/layout/TitleBar.tsx +190 -0
- package/src/components/navigation/CommandPalette.tsx +233 -0
- package/src/components/navigation/KeyboardShortcutsModal.tsx +173 -0
- package/src/components/sessions/ChangeItem.tsx +408 -0
- package/src/components/sessions/ChangeViewer.tsx +1155 -0
- package/src/components/sessions/DocumentComparisonModal.tsx +314 -0
- package/src/components/sessions/ProcessingOptions.tsx +297 -0
- package/src/components/sessions/ReplacementsTab.tsx +438 -0
- package/src/components/sessions/RevisionHandlingOptions.tsx +87 -0
- package/src/components/sessions/SessionManager.tsx +188 -0
- package/src/components/sessions/StylesEditor.tsx +1335 -0
- package/src/components/sessions/TabContainer.tsx +151 -0
- package/src/components/sessions/VirtualSessionList.tsx +157 -0
- package/src/components/sessions/sessionToProcessorManager.tsx +420 -0
- package/src/components/settings/CertificateManager.tsx +410 -0
- package/src/components/settings/SegmentedControl.tsx +88 -0
- package/src/components/settings/SettingRow.tsx +52 -0
- package/src/contexts/GlobalStatsContext.tsx +396 -0
- package/src/contexts/SessionContext.tsx +2129 -0
- package/src/contexts/ThemeContext.tsx +428 -0
- package/src/contexts/UserSettingsContext.tsx +290 -0
- package/src/contexts/__tests__/GlobalStatsContext.test.tsx +390 -0
- package/src/global.d.ts +273 -0
- package/src/hooks/useDocumentQueue.tsx +210 -0
- package/src/hooks/useToast.tsx +55 -0
- package/src/main.tsx +10 -0
- package/src/pages/Analytics.tsx +386 -0
- package/src/pages/CurrentSession.tsx +1174 -0
- package/src/pages/Dashboard.tsx +319 -0
- package/src/pages/Documents.tsx +317 -0
- package/src/pages/Projects.tsx +250 -0
- package/src/pages/Reporting.tsx +386 -0
- package/src/pages/Search.tsx +349 -0
- package/src/pages/Sessions.tsx +285 -0
- package/src/pages/Settings.tsx +2662 -0
- package/src/services/HyperlinkService.ts +1085 -0
- package/src/services/document/DocXMLaterProcessor.ts +617 -0
- package/src/services/document/DocumentProcessingComparison.ts +856 -0
- package/src/services/document/DocumentSnapshotService.ts +575 -0
- package/src/services/document/WordDocumentProcessor.ts +10509 -0
- package/src/services/document/__tests__/DocXMLaterProcessor.hyperlinks.test.md +311 -0
- package/src/services/document/__tests__/WordDocumentProcessor.integration.test.ts +515 -0
- package/src/services/document/__tests__/WordDocumentProcessor.test.ts +812 -0
- package/src/services/document/blanklines/BlankLineManager.ts +658 -0
- package/src/services/document/blanklines/__tests__/paragraphChecks.test.ts +281 -0
- package/src/services/document/blanklines/helpers/blankLineInsertion.ts +87 -0
- package/src/services/document/blanklines/helpers/blankLineSnapshot.ts +251 -0
- package/src/services/document/blanklines/helpers/clearCustom.ts +121 -0
- package/src/services/document/blanklines/helpers/contextChecks.ts +117 -0
- package/src/services/document/blanklines/helpers/imageChecks.ts +51 -0
- package/src/services/document/blanklines/helpers/paragraphChecks.ts +236 -0
- package/src/services/document/blanklines/helpers/removeBlanksBetweenListItems.ts +91 -0
- package/src/services/document/blanklines/helpers/removeTrailingBlanks.ts +35 -0
- package/src/services/document/blanklines/helpers/tableGuards.ts +21 -0
- package/src/services/document/blanklines/index.ts +67 -0
- package/src/services/document/blanklines/rules/additionRules.ts +337 -0
- package/src/services/document/blanklines/rules/indentationRules.ts +317 -0
- package/src/services/document/blanklines/rules/removalRules.ts +362 -0
- package/src/services/document/blanklines/rules/ruleTypes.ts +92 -0
- package/src/services/document/blanklines/types.ts +29 -0
- package/src/services/document/helpers/ImageBorderCropper.ts +377 -0
- package/src/services/document/helpers/__tests__/whitespace.test.ts +272 -0
- package/src/services/document/helpers/whitespace.ts +117 -0
- package/src/services/document/list/ListNormalizer.ts +947 -0
- package/src/services/document/list/index.ts +45 -0
- package/src/services/document/list/list-detection.ts +275 -0
- package/src/services/document/list/list-types.ts +162 -0
- package/src/services/document/processors/HyperlinkProcessor.ts +370 -0
- package/src/services/document/processors/ListProcessor.ts +257 -0
- package/src/services/document/processors/StructureProcessor.ts +176 -0
- package/src/services/document/processors/StyleProcessor.ts +389 -0
- package/src/services/document/processors/TableProcessor.ts +2238 -0
- package/src/services/document/processors/__tests__/HyperlinkProcessor.test.ts +314 -0
- package/src/services/document/processors/__tests__/ListProcessor.test.ts +291 -0
- package/src/services/document/processors/__tests__/StructureProcessor.test.ts +257 -0
- package/src/services/document/processors/__tests__/TableProcessor.hlp-tips-bullets.test.ts +459 -0
- package/src/services/document/processors/__tests__/TableProcessor.test.ts +1604 -0
- package/src/services/document/processors/index.ts +28 -0
- package/src/services/document/types/docx-processing.ts +310 -0
- package/src/services/editor/EditorActionHandlers.ts +901 -0
- package/src/services/editor/index.ts +13 -0
- package/src/setupTests.ts +47 -0
- package/src/styles/global.css +782 -0
- package/src/types/backup.ts +132 -0
- package/src/types/dictionary.ts +125 -0
- package/src/types/document-processing.ts +331 -0
- package/src/types/docxmlater-augments.d.ts +142 -0
- package/src/types/editor.ts +280 -0
- package/src/types/electron.ts +340 -0
- package/src/types/globalStats.ts +155 -0
- package/src/types/hyperlink.ts +471 -0
- package/src/types/operations.ts +354 -0
- package/src/types/session.ts +427 -0
- package/src/types/settings.ts +112 -0
- package/src/utils/MemoryMonitor.ts +248 -0
- package/src/utils/cn.ts +6 -0
- package/src/utils/colorConvert.ts +306 -0
- package/src/utils/diffUtils.ts +347 -0
- package/src/utils/documentUtils.ts +202 -0
- package/src/utils/electronGuard.ts +62 -0
- package/src/utils/indexedDB.ts +915 -0
- package/src/utils/logger.ts +717 -0
- package/src/utils/pathSecurity.ts +232 -0
- package/src/utils/pathValidator.ts +236 -0
- package/src/utils/processingTimeEstimator.ts +153 -0
- package/src/utils/safeJsonParse.ts +62 -0
- package/src/utils/textSanitizer.ts +162 -0
- package/src/utils/urlHelpers.ts +304 -0
- package/src/utils/urlPatterns.ts +198 -0
- package/src/utils/urlSanitizer.ts +152 -0
- package/src/vite-env.d.ts +11 -0
- package/tsconfig.electron.json +19 -0
- package/tsconfig.json +36 -0
- package/tsconfig.node.json +12 -0
- package/typedoc.json +45 -0
- package/vite.config.ts +152 -0
|
@@ -0,0 +1,336 @@
|
|
|
1
|
+
# List Implementation Framework Refactoring Plan
|
|
2
|
+
|
|
3
|
+
**Goal:** Replace custom XML injection with docxmlater framework methods
|
|
4
|
+
**Benefit:** Simpler, more maintainable code using framework best practices
|
|
5
|
+
**Status:** Planning Phase
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## Executive Summary
|
|
10
|
+
|
|
11
|
+
Replace ~180 lines of custom XML manipulation code with framework's built-in `standardizeBulletSymbols()` and `standardizeNumberedListPrefixes()` methods. This simplifies the codebase while maintaining all current functionality.
|
|
12
|
+
|
|
13
|
+
**Note:** Font will remain Verdana for list symbols (not Calibri) - this is intentional for proper bullet character rendering in Word.
|
|
14
|
+
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
## Framework Methods to Use
|
|
18
|
+
|
|
19
|
+
### 1. `doc.standardizeBulletSymbols(options)`
|
|
20
|
+
|
|
21
|
+
**Purpose:** Standardize bullet list formatting across document
|
|
22
|
+
**API:** `Document.d.ts:268-276`
|
|
23
|
+
|
|
24
|
+
```typescript
|
|
25
|
+
doc.standardizeBulletSymbols({
|
|
26
|
+
font: 'Verdana',
|
|
27
|
+
fontSize: 12,
|
|
28
|
+
color: '000000',
|
|
29
|
+
bold: true,
|
|
30
|
+
});
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
### 2. `doc.standardizeNumberedListPrefixes(options)`
|
|
34
|
+
|
|
35
|
+
**Purpose:** Standardize numbered list formatting across document
|
|
36
|
+
**API:** `Document.d.ts:278-285`
|
|
37
|
+
|
|
38
|
+
```typescript
|
|
39
|
+
doc.standardizeNumberedListPrefixes({
|
|
40
|
+
font: 'Verdana',
|
|
41
|
+
fontSize: 12,
|
|
42
|
+
color: '000000',
|
|
43
|
+
bold: true,
|
|
44
|
+
});
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
---
|
|
48
|
+
|
|
49
|
+
## Files to Modify
|
|
50
|
+
|
|
51
|
+
### WordDocumentProcessor.ts
|
|
52
|
+
|
|
53
|
+
**Methods to DELETE:**
|
|
54
|
+
|
|
55
|
+
1. `injectCompleteRunPropertiesToNumbering()` (lines 3133-3209) - 77 lines
|
|
56
|
+
2. Calls to this method in:
|
|
57
|
+
- `applyBulletUniformity()` (line 2979)
|
|
58
|
+
- `applyNumberedUniformity()` (line 3071)
|
|
59
|
+
|
|
60
|
+
**Methods to KEEP (but modify):**
|
|
61
|
+
|
|
62
|
+
1. `injectIndentationToNumbering()` - Still needed for custom indentation from UI
|
|
63
|
+
2. `applyBulletUniformity()` - Replace XML injection call with framework method
|
|
64
|
+
3. `applyNumberedUniformity()` - Replace XML injection call with framework method
|
|
65
|
+
4. `standardizeListPrefixFormatting()` - Can be simplified to use framework methods
|
|
66
|
+
|
|
67
|
+
**Methods to REFACTOR:**
|
|
68
|
+
|
|
69
|
+
1. `standardizeNumberingColors()` (lines 3343-3358) - Use framework methods instead of custom injection
|
|
70
|
+
|
|
71
|
+
---
|
|
72
|
+
|
|
73
|
+
## Refactoring Steps
|
|
74
|
+
|
|
75
|
+
### Step 1: Update applyBulletUniformity()
|
|
76
|
+
|
|
77
|
+
**Current (line 2979):**
|
|
78
|
+
|
|
79
|
+
```typescript
|
|
80
|
+
const injectionSuccess = await this.injectCompleteRunPropertiesToNumbering(doc, numId);
|
|
81
|
+
if (injectionSuccess) {
|
|
82
|
+
this.log.debug('Applied 12pt bold black formatting to bullet list symbols');
|
|
83
|
+
}
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
**Replace with:**
|
|
87
|
+
|
|
88
|
+
```typescript
|
|
89
|
+
const result = doc.standardizeBulletSymbols({
|
|
90
|
+
font: 'Verdana',
|
|
91
|
+
fontSize: 12,
|
|
92
|
+
color: '000000',
|
|
93
|
+
bold: true,
|
|
94
|
+
});
|
|
95
|
+
this.log.debug(`Standardized ${result.listsUpdated} bullet lists, ${result.levelsModified} levels`);
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
### Step 2: Update applyNumberedUniformity()
|
|
99
|
+
|
|
100
|
+
**Current (line 3071):**
|
|
101
|
+
|
|
102
|
+
```typescript
|
|
103
|
+
const injectionSuccess = await this.injectCompleteRunPropertiesToNumbering(doc, numId);
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
**Replace with:**
|
|
107
|
+
|
|
108
|
+
```typescript
|
|
109
|
+
const result = doc.standardizeNumberedListPrefixes({
|
|
110
|
+
font: 'Verdana',
|
|
111
|
+
fontSize: 12,
|
|
112
|
+
color: '000000',
|
|
113
|
+
bold: true,
|
|
114
|
+
});
|
|
115
|
+
this.log.debug(
|
|
116
|
+
`Standardized ${result.listsUpdated} numbered lists, ${result.levelsModified} levels`
|
|
117
|
+
);
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
### Step 3: Update standardizeNumberingColors()
|
|
121
|
+
|
|
122
|
+
**Current (lines 3343-3358):**
|
|
123
|
+
|
|
124
|
+
```typescript
|
|
125
|
+
private async standardizeNumberingColors(doc: Document): Promise<boolean> {
|
|
126
|
+
try {
|
|
127
|
+
const success = await this.injectCompleteRunPropertiesToNumbering(doc);
|
|
128
|
+
if (success) {
|
|
129
|
+
this.log.debug('Standardized all numbering colors to black...');
|
|
130
|
+
return true;
|
|
131
|
+
}
|
|
132
|
+
return false;
|
|
133
|
+
} catch (error) {
|
|
134
|
+
this.log.warn('Unable to standardize numbering colors:', error);
|
|
135
|
+
return false;
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
**Replace with:**
|
|
141
|
+
|
|
142
|
+
```typescript
|
|
143
|
+
private async standardizeNumberingColors(doc: Document): Promise<boolean> {
|
|
144
|
+
try {
|
|
145
|
+
const bulletResult = doc.standardizeBulletSymbols({ color: '000000', bold: true });
|
|
146
|
+
const numberedResult = doc.standardizeNumberedListPrefixes({ color: '000000', bold: true });
|
|
147
|
+
|
|
148
|
+
if (bulletResult.listsUpdated > 0 || numberedResult.listsUpdated > 0) {
|
|
149
|
+
this.log.debug('Standardized all numbering colors to black using framework methods');
|
|
150
|
+
return true;
|
|
151
|
+
}
|
|
152
|
+
return false;
|
|
153
|
+
} catch (error) {
|
|
154
|
+
this.log.warn('Unable to standardize numbering colors:', error);
|
|
155
|
+
return false;
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
### Step 4: Delete injectCompleteRunPropertiesToNumbering()
|
|
161
|
+
|
|
162
|
+
**Action:** Remove entire method (lines 3133-3209)
|
|
163
|
+
**Verification:** Search codebase to ensure no other call sites exist
|
|
164
|
+
|
|
165
|
+
### Step 5: Update standardizeListPrefixFormatting() (Optional Improvement)
|
|
166
|
+
|
|
167
|
+
**Current:** Uses custom XML regex (lines 1916-2041)
|
|
168
|
+
**Optional:** Replace with framework methods for cleaner code
|
|
169
|
+
|
|
170
|
+
---
|
|
171
|
+
|
|
172
|
+
## Testing Checklist
|
|
173
|
+
|
|
174
|
+
### Pre-Testing
|
|
175
|
+
|
|
176
|
+
- [ ] Create feature branch: `refactor/list-framework-methods`
|
|
177
|
+
- [ ] Build project successfully
|
|
178
|
+
- [ ] Run existing tests to establish baseline
|
|
179
|
+
|
|
180
|
+
### Bullet List Testing
|
|
181
|
+
|
|
182
|
+
- [ ] Create document with bullet lists
|
|
183
|
+
- [ ] Verify custom bullet symbols from UI are preserved
|
|
184
|
+
- [ ] Verify formatting: Verdana 12pt bold black
|
|
185
|
+
- [ ] Verify indentation works correctly (UI-configured values)
|
|
186
|
+
- [ ] Test multi-level lists (levels 0-8)
|
|
187
|
+
|
|
188
|
+
### Numbered List Testing
|
|
189
|
+
|
|
190
|
+
- [ ] Create document with numbered lists
|
|
191
|
+
- [ ] Verify different formats work (1., a., i., I., A.)
|
|
192
|
+
- [ ] Verify formatting: Verdana 12pt bold black
|
|
193
|
+
- [ ] Verify indentation works correctly
|
|
194
|
+
- [ ] Test multi-level lists
|
|
195
|
+
|
|
196
|
+
### Edge Cases
|
|
197
|
+
|
|
198
|
+
- [ ] Empty lists
|
|
199
|
+
- [ ] Mixed bullet/numbered lists in same document
|
|
200
|
+
- [ ] Lists in table cells
|
|
201
|
+
- [ ] Lists with custom colors (should be standardized to black)
|
|
202
|
+
- [ ] Documents without any lists
|
|
203
|
+
|
|
204
|
+
### Regression Testing
|
|
205
|
+
|
|
206
|
+
- [ ] Process existing test documents
|
|
207
|
+
- [ ] Compare output with baseline (before refactoring)
|
|
208
|
+
- [ ] Verify no unexpected changes to non-list content
|
|
209
|
+
- [ ] Performance: Ensure no slowdown
|
|
210
|
+
|
|
211
|
+
---
|
|
212
|
+
|
|
213
|
+
## Expected Benefits
|
|
214
|
+
|
|
215
|
+
### Code Reduction
|
|
216
|
+
|
|
217
|
+
- **Before:** ~77 lines (injectCompleteRunPropertiesToNumbering)
|
|
218
|
+
- **After:** ~3-5 lines per call site
|
|
219
|
+
- **Total Savings:** ~65-70 lines of complex XML manipulation code
|
|
220
|
+
|
|
221
|
+
### Maintainability
|
|
222
|
+
|
|
223
|
+
- ✅ Framework handles OOXML compliance
|
|
224
|
+
- ✅ No regex parsing of XML
|
|
225
|
+
- ✅ Type-safe with TypeScript definitions
|
|
226
|
+
- ✅ Future framework updates automatically improve functionality
|
|
227
|
+
|
|
228
|
+
### Risk Mitigation
|
|
229
|
+
|
|
230
|
+
- ✅ Less custom code = fewer bugs
|
|
231
|
+
- ✅ Framework is well-tested
|
|
232
|
+
- ✅ Easier to understand for new developers
|
|
233
|
+
|
|
234
|
+
---
|
|
235
|
+
|
|
236
|
+
## Migration Checklist
|
|
237
|
+
|
|
238
|
+
### Phase 1: Preparation
|
|
239
|
+
|
|
240
|
+
- [x] Analyze current implementation
|
|
241
|
+
- [x] Identify framework methods to use
|
|
242
|
+
- [x] Create refactoring plan
|
|
243
|
+
- [ ] Review plan with team
|
|
244
|
+
- [ ] Create feature branch
|
|
245
|
+
|
|
246
|
+
### Phase 2: Implementation
|
|
247
|
+
|
|
248
|
+
- [ ] Modify `applyBulletUniformity()`
|
|
249
|
+
- [ ] Modify `applyNumberedUniformity()`
|
|
250
|
+
- [ ] Modify `standardizeNumberingColors()`
|
|
251
|
+
- [ ] Delete `injectCompleteRunPropertiesToNumbering()`
|
|
252
|
+
- [ ] Build and fix any compilation errors
|
|
253
|
+
|
|
254
|
+
### Phase 3: Testing
|
|
255
|
+
|
|
256
|
+
- [ ] Run unit tests
|
|
257
|
+
- [ ] Manual testing with sample documents
|
|
258
|
+
- [ ] Edge case testing
|
|
259
|
+
- [ ] Performance testing
|
|
260
|
+
- [ ] Regression testing
|
|
261
|
+
|
|
262
|
+
### Phase 4: Documentation
|
|
263
|
+
|
|
264
|
+
- [ ] Update code comments
|
|
265
|
+
- [ ] Update List_Implementation.md (mark framework methods as "USED")
|
|
266
|
+
- [ ] Add migration notes to commit message
|
|
267
|
+
- [ ] Update CHANGELOG if applicable
|
|
268
|
+
|
|
269
|
+
### Phase 5: Deployment
|
|
270
|
+
|
|
271
|
+
- [ ] Code review
|
|
272
|
+
- [ ] Merge to development
|
|
273
|
+
- [ ] Monitor for issues
|
|
274
|
+
- [ ] Document any framework limitations discovered
|
|
275
|
+
|
|
276
|
+
---
|
|
277
|
+
|
|
278
|
+
## Rollback Plan
|
|
279
|
+
|
|
280
|
+
If issues are discovered after deployment:
|
|
281
|
+
|
|
282
|
+
1. **Immediate:** Revert commit via Git
|
|
283
|
+
2. **Investigation:** Analyze what framework method didn't handle
|
|
284
|
+
3. **Options:**
|
|
285
|
+
- Fix by adjusting framework method parameters
|
|
286
|
+
- Add supplementary code for edge cases
|
|
287
|
+
- Keep framework methods + minimal custom code
|
|
288
|
+
4. **Never:** Go back to 100% custom XML - use hybrid approach if needed
|
|
289
|
+
|
|
290
|
+
---
|
|
291
|
+
|
|
292
|
+
## Questions & Answers
|
|
293
|
+
|
|
294
|
+
**Q: Will Verdana font work correctly for all bullet characters?**
|
|
295
|
+
A: Yes - Verdana is specifically chosen for proper Unicode bullet rendering in Word. Calibri/Arial are mentioned in documentation but Verdana is the actual implementation choice.
|
|
296
|
+
|
|
297
|
+
**Q: What about custom indentation from UI settings?**
|
|
298
|
+
A: Keep `injectIndentationToNumbering()` - framework doesn't expose per-level indentation customization via API.
|
|
299
|
+
|
|
300
|
+
**Q: Can we use `getBulletSymbolWithFont()` for predefined styles?**
|
|
301
|
+
A: Not in this refactor - current implementation uses user-configured bullets. This could be a future enhancement.
|
|
302
|
+
|
|
303
|
+
**Q: Will this affect existing documents?**
|
|
304
|
+
A: No - documents are processed fresh each time. Old documents remain unchanged until reprocessed.
|
|
305
|
+
|
|
306
|
+
---
|
|
307
|
+
|
|
308
|
+
## Success Criteria
|
|
309
|
+
|
|
310
|
+
- ✅ All tests pass
|
|
311
|
+
- ✅ No regression in list formatting
|
|
312
|
+
- ✅ Code reduction of >60 lines
|
|
313
|
+
- ✅ No performance degradation
|
|
314
|
+
- ✅ Team approves changes
|
|
315
|
+
|
|
316
|
+
---
|
|
317
|
+
|
|
318
|
+
## Next Actions
|
|
319
|
+
|
|
320
|
+
1. **Review this plan** - Get team approval
|
|
321
|
+
2. **Create feature branch** - Start implementation
|
|
322
|
+
3. **Implement Step 1** - Bullet list refactoring
|
|
323
|
+
4. **Test thoroughly** - Before proceeding
|
|
324
|
+
5. **Continue with Steps 2-4** - Complete refactoring
|
|
325
|
+
6. **Final testing** - Full regression suite
|
|
326
|
+
7. **Documentation** - Update all relevant docs
|
|
327
|
+
8. **Merge** - Deploy to development
|
|
328
|
+
|
|
329
|
+
---
|
|
330
|
+
|
|
331
|
+
## References
|
|
332
|
+
|
|
333
|
+
- **Accuracy Report:** [`List_Implementation_Accuracy_Report.md`](List_Implementation_Accuracy_Report.md)
|
|
334
|
+
- **Current Code:** [`WordDocumentProcessor.ts`](../src/services/document/WordDocumentProcessor.ts)
|
|
335
|
+
- **Framework API:** [`Document.d.ts`](../node_modules/docxmlater/dist/core/Document.d.ts)
|
|
336
|
+
- **Original Docs:** [`List_Implementation.md`](../../List_Implementation.md)
|
|
@@ -0,0 +1,217 @@
|
|
|
1
|
+
# Luminance-Based Primary Text Color Feature
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
Automatically calculates optimal text color (black or white) for primary-colored elements based on the luminance of the custom primary color. This ensures text remains readable on buttons, badges, and other primary-colored UI elements regardless of the custom color chosen.
|
|
6
|
+
|
|
7
|
+
## How It Works
|
|
8
|
+
|
|
9
|
+
### 1. Color Calculation (ThemeContext.tsx)
|
|
10
|
+
|
|
11
|
+
When custom colors are enabled, the system:
|
|
12
|
+
|
|
13
|
+
- Reads the user's custom primary color (e.g., `#3b82f6`)
|
|
14
|
+
- Calculates its luminance using WCAG 2.1 formula
|
|
15
|
+
- Determines optimal contrast text color:
|
|
16
|
+
- **Light backgrounds** (luminance > 0.5) → Black text (`#000000`)
|
|
17
|
+
- **Dark backgrounds** (luminance ≤ 0.5) → White text (`#FFFFFF`)
|
|
18
|
+
|
|
19
|
+
```typescript
|
|
20
|
+
// ThemeContext.tsx line 216
|
|
21
|
+
const primaryTextColor = getContrastTextColor(customPrimaryColor);
|
|
22
|
+
root.style.setProperty('--custom-primary-text', hexToHSL(primaryTextColor));
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
### 2. CSS Variable Application (global.css)
|
|
26
|
+
|
|
27
|
+
The calculated text color is applied through CSS variables:
|
|
28
|
+
|
|
29
|
+
```css
|
|
30
|
+
/* Line 275-276: Override the CSS variable */
|
|
31
|
+
[data-custom-colors='true'] {
|
|
32
|
+
--color-primary-foreground: hsl(var(--custom-primary-text)) !important;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/* Lines 279-285: Apply to all primary elements */
|
|
36
|
+
[data-custom-colors='true'] .bg-primary,
|
|
37
|
+
[data-custom-colors='true'] .bg-primary *,
|
|
38
|
+
[data-custom-colors='true'] button.bg-primary,
|
|
39
|
+
[data-custom-colors='true'] button.bg-primary * {
|
|
40
|
+
color: hsl(var(--custom-primary-text)) !important;
|
|
41
|
+
}
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
### 3. Automatic Mode Detection
|
|
45
|
+
|
|
46
|
+
The system intelligently switches between modes:
|
|
47
|
+
|
|
48
|
+
**Standard Mode (Light/Dark themes):**
|
|
49
|
+
|
|
50
|
+
- Uses preset `--color-primary-foreground` from theme
|
|
51
|
+
- Light mode: `hsl(210 40% 98%)` (near white)
|
|
52
|
+
- Dark mode: `hsl(210 40% 98%)` (near white)
|
|
53
|
+
|
|
54
|
+
**Custom Color Mode:**
|
|
55
|
+
|
|
56
|
+
- Activates when: Settings → Appearance → "Custom Theme Colors" is enabled
|
|
57
|
+
- Calculates text color dynamically based on chosen primary color
|
|
58
|
+
- Updates automatically when primary color changes
|
|
59
|
+
|
|
60
|
+
## User Experience
|
|
61
|
+
|
|
62
|
+
### Enabling Custom Colors
|
|
63
|
+
|
|
64
|
+
1. Open **Settings** → **Appearance**
|
|
65
|
+
2. Toggle **"Custom Theme Colors"** ON
|
|
66
|
+
3. Click the primary color picker
|
|
67
|
+
4. Choose any color - text will automatically adjust
|
|
68
|
+
|
|
69
|
+
### Visual Examples
|
|
70
|
+
|
|
71
|
+
#### Example 1: Light Primary Color
|
|
72
|
+
|
|
73
|
+
- **Primary Color:** `#FFD700` (Gold - luminance 0.78)
|
|
74
|
+
- **Calculated Text:** Black (`#000000`)
|
|
75
|
+
- **Result:** Dark text on light gold background ✓ Readable
|
|
76
|
+
|
|
77
|
+
#### Example 2: Dark Primary Color
|
|
78
|
+
|
|
79
|
+
- **Primary Color:** `#1a1a2e` (Dark Navy - luminance 0.05)
|
|
80
|
+
- **Calculated Text:** White (`#FFFFFF`)
|
|
81
|
+
- **Result:** White text on dark navy background ✓ Readable
|
|
82
|
+
|
|
83
|
+
#### Example 3: Medium Primary Color
|
|
84
|
+
|
|
85
|
+
- **Primary Color:** `#3b82f6` (Blue - luminance 0.32)
|
|
86
|
+
- **Calculated Text:** White (`#FFFFFF`)
|
|
87
|
+
- **Result:** White text on blue background ✓ Readable
|
|
88
|
+
|
|
89
|
+
## Technical Details
|
|
90
|
+
|
|
91
|
+
### Luminance Calculation
|
|
92
|
+
|
|
93
|
+
Uses WCAG 2.1 relative luminance formula:
|
|
94
|
+
|
|
95
|
+
```text
|
|
96
|
+
L = 0.2126 * R + 0.7152 * G + 0.0722 * B
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
With gamma correction for sRGB color space.
|
|
100
|
+
|
|
101
|
+
### Affected Elements
|
|
102
|
+
|
|
103
|
+
All elements using these classes:
|
|
104
|
+
|
|
105
|
+
- `.bg-primary` - Primary background color
|
|
106
|
+
- `.text-primary-foreground` - Primary foreground text
|
|
107
|
+
- `button.bg-primary` - Primary buttons (like "Process Documents")
|
|
108
|
+
- Badges, checkboxes, toggles with primary color
|
|
109
|
+
|
|
110
|
+
### File Changes
|
|
111
|
+
|
|
112
|
+
1. **src/styles/global.css** (lines 271-290)
|
|
113
|
+
- Added `--color-primary-foreground` override
|
|
114
|
+
- Added `.bg-primary` text color rules
|
|
115
|
+
- Added `.text-primary-foreground` rules
|
|
116
|
+
|
|
117
|
+
2. **src/contexts/ThemeContext.tsx** (existing, line 216)
|
|
118
|
+
- Already calculates `primaryTextColor`
|
|
119
|
+
- Already sets `--custom-primary-text` variable
|
|
120
|
+
|
|
121
|
+
## Testing Guide
|
|
122
|
+
|
|
123
|
+
### Manual Test Scenarios
|
|
124
|
+
|
|
125
|
+
#### Test 1: Very Light Primary Color
|
|
126
|
+
|
|
127
|
+
1. Enable Custom Theme Colors
|
|
128
|
+
2. Set primary color to: `#FFEB3B` (bright yellow)
|
|
129
|
+
3. **Expected:** All primary buttons show **BLACK** text
|
|
130
|
+
4. **Verify:** Text is clearly readable
|
|
131
|
+
|
|
132
|
+
#### Test 2: Very Dark Primary Color
|
|
133
|
+
|
|
134
|
+
1. Enable Custom Theme Colors
|
|
135
|
+
2. Set primary color to: `#212121` (very dark gray)
|
|
136
|
+
3. **Expected:** All primary buttons show **WHITE** text
|
|
137
|
+
4. **Verify:** Text is clearly readable
|
|
138
|
+
|
|
139
|
+
#### Test 3: Medium Brightness Colors
|
|
140
|
+
|
|
141
|
+
1. Test colors around the threshold (luminance ~0.5):
|
|
142
|
+
- `#808080` (medium gray) → White text
|
|
143
|
+
- `#00AA00` (medium green) → White text
|
|
144
|
+
- `#FFA500` (orange) → Black text
|
|
145
|
+
- `#4169E1` (royal blue) → White text
|
|
146
|
+
|
|
147
|
+
#### Test 4: Mode Switching
|
|
148
|
+
|
|
149
|
+
1. Enable Custom Theme Colors with light primary color
|
|
150
|
+
2. **Verify:** Black text appears
|
|
151
|
+
3. Disable Custom Theme Colors
|
|
152
|
+
4. **Verify:** Returns to standard theme text color
|
|
153
|
+
5. Re-enable Custom Theme Colors
|
|
154
|
+
6. **Verify:** Black text reappears correctly
|
|
155
|
+
|
|
156
|
+
### Visual Testing Checklist
|
|
157
|
+
|
|
158
|
+
- [ ] Process Documents button (CurrentSession page)
|
|
159
|
+
- [ ] Active session indicators (Sidebar)
|
|
160
|
+
- [ ] Primary action buttons (SessionManager)
|
|
161
|
+
- [ ] Update notification button (UpdateNotification)
|
|
162
|
+
- [ ] Save buttons in Settings
|
|
163
|
+
- [ ] Active tab indicators
|
|
164
|
+
|
|
165
|
+
## Troubleshooting
|
|
166
|
+
|
|
167
|
+
### Text Color Not Updating
|
|
168
|
+
|
|
169
|
+
**Symptom:** Text remains default color after changing primary color
|
|
170
|
+
|
|
171
|
+
**Solutions:**
|
|
172
|
+
|
|
173
|
+
1. Ensure "Custom Theme Colors" toggle is ON
|
|
174
|
+
2. Hard refresh browser (Ctrl+Shift+R)
|
|
175
|
+
3. Check browser console for errors
|
|
176
|
+
4. Verify `data-custom-colors="true"` attribute on `<html>` element
|
|
177
|
+
|
|
178
|
+
### Poor Contrast
|
|
179
|
+
|
|
180
|
+
**Symptom:** Text is barely visible on primary color
|
|
181
|
+
|
|
182
|
+
**Root Cause:** The threshold (0.5) works for most colors but edge cases may need adjustment
|
|
183
|
+
|
|
184
|
+
**Solution:** Adjust threshold in `colorConvert.ts`:
|
|
185
|
+
|
|
186
|
+
```typescript
|
|
187
|
+
// Line 165 - Current threshold
|
|
188
|
+
return luminance > 0.5 ? '#000000' : '#FFFFFF';
|
|
189
|
+
|
|
190
|
+
// If needed, adjust to 0.45 or 0.55 for better results
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
### Text Color in Standard Mode
|
|
194
|
+
|
|
195
|
+
**Symptom:** Custom text colors appear when custom mode is disabled
|
|
196
|
+
|
|
197
|
+
**Solution:** This should not happen - CSS rules only apply when `[data-custom-colors='true']`. Check that the attribute is being removed when disabling custom colors.
|
|
198
|
+
|
|
199
|
+
## Browser Compatibility
|
|
200
|
+
|
|
201
|
+
- ✅ Chrome/Edge 88+ (CSS `color-mix`, `hsl()` variables)
|
|
202
|
+
- ✅ Firefox 88+
|
|
203
|
+
- ✅ Safari 15.4+
|
|
204
|
+
- ❌ IE 11 (not supported)
|
|
205
|
+
|
|
206
|
+
## Performance Impact
|
|
207
|
+
|
|
208
|
+
- **Negligible** - Color calculation happens once on theme change
|
|
209
|
+
- CSS variables update instantly without re-render
|
|
210
|
+
- No JavaScript running during normal usage
|
|
211
|
+
|
|
212
|
+
## Future Enhancements
|
|
213
|
+
|
|
214
|
+
1. **Contrast Ratio Display:** Show WCAG contrast ratio in color picker
|
|
215
|
+
2. **Accessibility Warnings:** Alert when contrast is below AA standard
|
|
216
|
+
3. **Preview Mode:** Show text samples before applying color
|
|
217
|
+
4. **Smart Suggestions:** Recommend primary colors with good contrast
|