tablefilter 0.7.3 → 0.7.5
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/.editorconfig +15 -15
- package/.esdoc.json +14 -14
- package/.eslintrc +37 -37
- package/.gitattributes +16 -0
- package/.github/ISSUE_TEMPLATE/bug_report.md +38 -38
- package/.github/ISSUE_TEMPLATE/feature_request.md +36 -36
- package/.github/ISSUE_TEMPLATE/support.md +17 -17
- package/.github/dependabot.yml +10 -0
- package/.github/workflows/build-deploy.yml +141 -0
- package/.github/workflows/opencode-review.yml +104 -0
- package/.github/workflows/opencode.yml +34 -0
- package/AGENTS.md +36 -0
- package/CONTRIBUTING.md +128 -128
- package/Gruntfile.js +252 -252
- package/LICENSE +21 -21
- package/PULL_REQUEST_TEMPLATE.md +24 -24
- package/README.md +166 -174
- package/ROADMAP/README.md +34 -0
- package/ROADMAP/content-projection-parity.md +162 -0
- package/ROADMAP/hybrid-migration-strategy.md +275 -0
- package/ROADMAP/key-decisions-review.md +215 -0
- package/ROADMAP/preliminary-and-milestone-0.8.0-plan.md +307 -0
- package/ROADMAP/v1-webcomponents-investigation.md +521 -0
- package/dist/starter.html +514 -514
- package/dist/tablefilter/style/colsVisibility.css +1 -1
- package/dist/tablefilter/style/filtersVisibility.css +1 -1
- package/dist/tablefilter/style/tablefilter.css +1 -1
- package/dist/tablefilter/style/themes/default/default.css +1 -1
- package/dist/tablefilter/style/themes/mytheme/mytheme.css +1 -1
- package/dist/tablefilter/style/themes/skyblue/skyblue.css +1 -1
- package/dist/tablefilter/style/themes/transparent/transparent.css +1 -1
- package/dist/tablefilter/tablefilter.js +1 -1
- package/dist/tablefilter/tablefilter.vite.js +4 -0
- package/dist/tablefilter/tf-1-a5c3a73bd559e47dd5a2.js +1 -0
- package/dist/tablefilter/tf-2-3a936d22b849361acff5.js +6 -0
- package/dist/tablefilter.cjs.js +4 -0
- package/dist/tablefilter.esm.js +7278 -0
- package/dist/tablefilter.umd.js +4 -0
- package/index.js +3 -3
- package/libs/sortabletable.js +438 -438
- package/package.json +12 -5
- package/playwright.config.js +25 -0
- package/scripts/check-css-tokens.js +65 -0
- package/src/array.js +22 -22
- package/src/components/table-filter.js +243 -0
- package/src/components/tf-clear-button.js +95 -0
- package/src/components/tf-rows-counter.js +82 -0
- package/src/components/tf-status.js +106 -0
- package/src/const.js +118 -118
- package/src/cookie.js +57 -57
- package/src/dom.js +192 -192
- package/src/emitter.js +53 -53
- package/src/event.js +124 -124
- package/src/extensions/advancedGrid/adapterEzEditTable.js +509 -509
- package/src/extensions/advancedGrid/advancedGrid.js +2 -2
- package/src/extensions/colOps/colOps.js +474 -480
- package/src/extensions/colsVisibility/colsVisibility.js +725 -725
- package/src/extensions/filtersVisibility/filtersVisibility.js +316 -316
- package/src/extensions/sort/adapterSortabletable.js +537 -537
- package/src/extensions/sort/sort.js +8 -8
- package/src/feature.js +102 -102
- package/src/modules/alternateRows.js +145 -145
- package/src/modules/baseDropdown.js +160 -160
- package/src/modules/checkList.js +519 -519
- package/src/modules/clearButton.js +196 -142
- package/src/modules/dateType.js +157 -157
- package/src/modules/dropdown.js +376 -376
- package/src/modules/gridLayout.js +483 -483
- package/src/modules/hash.js +126 -126
- package/src/modules/help.js +264 -264
- package/src/modules/highlightKeywords.js +180 -180
- package/src/modules/loader.js +183 -183
- package/src/modules/markActiveColumns.js +146 -146
- package/src/modules/noResults.js +193 -193
- package/src/modules/paging.js +916 -916
- package/src/modules/popupFilter.js +461 -461
- package/src/modules/rowsCounter.js +230 -207
- package/src/modules/state.js +545 -545
- package/src/modules/statusBar.js +340 -308
- package/src/modules/storage.js +161 -161
- package/src/modules/toolbar.js +224 -224
- package/src/number.js +96 -32
- package/src/root.js +6 -6
- package/src/sanitize.js +25 -0
- package/src/settings.js +53 -53
- package/src/sort.js +82 -82
- package/src/string.js +112 -112
- package/src/tablefilter.js +3053 -3053
- package/src/types.js +81 -81
- package/static/partials/books-table-with-images.html +327 -327
- package/static/partials/books.html +272 -272
- package/static/partials/countries-by-continent.html +2592 -2592
- package/static/partials/countries-table-tiny.html +436 -436
- package/static/partials/countries-table.html +12954 -12954
- package/static/partials/dummy-table-with-totals-footer.html +353 -353
- package/static/partials/dummy-table.html +502 -502
- package/static/partials/pre-inline-script.html +17 -17
- package/static/partials/pre.html +1 -1
- package/static/partials/style.html +22 -22
- package/static/partials/table-with-grouped-headers.html +9258 -9258
- package/static/style/active-header.styl +10 -10
- package/static/style/alternating-rows.styl +8 -8
- package/static/style/config.styl +44 -44
- package/static/style/custom-properties.styl +43 -0
- package/static/style/extensions/colsVisibility.styl +71 -71
- package/static/style/extensions/filtersVisibility.styl +18 -18
- package/static/style/ezedittable.styl +93 -93
- package/static/style/filter-checklist.styl +52 -52
- package/static/style/filters.styl +111 -111
- package/static/style/grid-layout.styl +130 -130
- package/static/style/help.styl +57 -57
- package/static/style/keyword.styl +8 -8
- package/static/style/loader.styl +16 -16
- package/static/style/mixins/arrow.styl +63 -63
- package/static/style/mixins/box-shadow.styl +8 -8
- package/static/style/mixins/empty-content.styl +7 -7
- package/static/style/noresults.styl +14 -14
- package/static/style/paging.styl +73 -73
- package/static/style/reset-button.styl +21 -21
- package/static/style/rows-counter.styl +17 -17
- package/static/style/sort.styl +20 -20
- package/static/style/status-bar.styl +13 -16
- package/static/style/table.styl +44 -44
- package/static/style/tablefilter.styl +19 -18
- package/static/style/themes/default/default.styl +137 -137
- package/static/style/themes/mytheme/mytheme.styl +152 -152
- package/static/style/themes/skyblue/skyblue.styl +195 -195
- package/static/style/themes/transparent/transparent.styl +205 -205
- package/static/style/toolbar.styl +58 -58
- package/static/templates/advanced-grid-editable.html +140 -140
- package/static/templates/advanced-grid-selection.html +93 -93
- package/static/templates/auto-filter.html +46 -46
- package/static/templates/columns-visibility.html +67 -67
- package/static/templates/data-types.html +123 -123
- package/static/templates/demo.html +62 -62
- package/static/templates/external-filters-visibility-commad.html +49 -49
- package/static/templates/external-filters.html +125 -125
- package/static/templates/filter-images.html +91 -91
- package/static/templates/filters-visibility.html +45 -45
- package/static/templates/grid-layout.html +51 -51
- package/static/templates/grouped-headers.html +78 -78
- package/static/templates/linked-filters-disabled.html +56 -56
- package/static/templates/linked-filters.html +45 -45
- package/static/templates/load-filters-on-demand.html +42 -42
- package/static/templates/pagination.html +78 -78
- package/static/templates/requirejs.html +53 -53
- package/static/templates/starter.html +61 -61
- package/static/templates/table-filter.html +40 -0
- package/static/templates/theme-roller.html +106 -106
- package/test/libs/polyfill.js +359 -359
- package/test/libs/qunit/qunit.css +237 -237
- package/test/libs/qunit/qunit.js +2495 -2495
- package/test/playwright/axe.baseline.spec.js +34 -0
- package/test/playwright/axe.statusbar.spec.js +35 -0
- package/test/playwright/axeScan.js +42 -0
- package/test/playwright/ce-bridge.spec.js +167 -0
- package/test/playwright/qunit.all.spec.js +10 -0
- package/test/playwright/qunit.single.spec.js +14 -0
- package/test/playwright/qunitSuite.js +56 -0
- package/test/playwright/table-filter.config.spec.js +265 -0
- package/test/playwright/table-filter.demo.spec.js +60 -0
- package/test/playwright/table-filter.element.spec.js +477 -0
- package/test/playwright/tf-clear-button.spec.js +135 -0
- package/test/playwright/tf-rows-counter.spec.js +172 -0
- package/test/playwright/tf-status.spec.js +258 -0
- package/test/test-active-columns.html +80 -80
- package/test/test-active-columns.js +318 -318
- package/test/test-alternate-rows.html +80 -80
- package/test/test-alternate-rows.js +335 -335
- package/test/test-api.html +141 -141
- package/test/test-api.js +795 -795
- package/test/test-auto-filter.html +80 -80
- package/test/test-auto-filter.js +43 -43
- package/test/test-callbacks.html +77 -77
- package/test/test-callbacks.js +58 -58
- package/test/test-case-sensitive-query.html +77 -77
- package/test/test-case-sensitive-query.js +39 -39
- package/test/test-cell-parser.html +109 -109
- package/test/test-cell-parser.js +80 -80
- package/test/test-checklist.html +77 -77
- package/test/test-checklist.js +267 -267
- package/test/test-clear-button.html +79 -79
- package/test/test-clear-button.js +183 -182
- package/test/test-col-ops-grid-layout.html +129 -129
- package/test/test-col-ops-grid-layout.js +134 -134
- package/test/test-col-ops-paging.html +129 -129
- package/test/test-col-ops-paging.js +154 -154
- package/test/test-col-ops.html +129 -129
- package/test/test-col-ops.js +337 -202
- package/test/test-col-widths.html +80 -80
- package/test/test-col-widths.js +40 -40
- package/test/test-cols-visibility-grid-layout.html +80 -80
- package/test/test-cols-visibility-grid-layout.js +165 -165
- package/test/test-cols-visibility.html +80 -80
- package/test/test-cols-visibility.js +121 -121
- package/test/test-custom-options.html +80 -80
- package/test/test-custom-options.js +139 -139
- package/test/test-data-types.html +377 -377
- package/test/test-data-types.js +392 -392
- package/test/test-date-type.html +356 -356
- package/test/test-date-type.js +159 -159
- package/test/test-disable-enter-key.html +77 -77
- package/test/test-disable-enter-key.js +29 -29
- package/test/test-disable-filter-onchange.html +77 -77
- package/test/test-disable-filter-onchange.js +40 -40
- package/test/test-dom-changes.html +77 -77
- package/test/test-dom-changes.js +166 -166
- package/test/test-dropdown.html +77 -77
- package/test/test-dropdown.js +246 -246
- package/test/test-emitter.html +77 -77
- package/test/test-emitter.js +57 -57
- package/test/test-empty-cells-filtering.html +8696 -8696
- package/test/test-empty-cells-filtering.js +45 -45
- package/test/test-exact-query-match.html +77 -77
- package/test/test-exact-query-match.js +56 -56
- package/test/test-excluded-rows.html +92 -92
- package/test/test-excluded-rows.js +129 -129
- package/test/test-external-filters.html +100 -100
- package/test/test-external-filters.js +219 -219
- package/test/test-filter-html-elements.html +88 -88
- package/test/test-filter-html-elements.js +63 -63
- package/test/test-filter-operators.html +80 -80
- package/test/test-filter-operators.js +264 -264
- package/test/test-filtering.html +53 -53
- package/test/test-filtering.js +293 -293
- package/test/test-filters-visibility-grid-layout.html +80 -80
- package/test/test-filters-visibility-grid-layout.js +50 -50
- package/test/test-filters-visibility-with-button.html +80 -80
- package/test/test-filters-visibility-with-button.js +48 -48
- package/test/test-filters-visibility.html +80 -80
- package/test/test-filters-visibility.js +48 -48
- package/test/test-grid-layout.html +7735 -7735
- package/test/test-grid-layout.js +39 -39
- package/test/test-grouped-headers.html +154 -154
- package/test/test-grouped-headers.js +107 -107
- package/test/test-hash.html +78 -78
- package/test/test-hash.js +88 -88
- package/test/test-help-responsive.html +78 -78
- package/test/test-help-responsive.js +70 -70
- package/test/test-help.html +77 -77
- package/test/test-help.js +217 -217
- package/test/test-highlight-keywords.html +77 -77
- package/test/test-highlight-keywords.js +94 -94
- package/test/test-ignore-diacritics.html +67 -57
- package/test/test-ignore-diacritics.js +117 -90
- package/test/test-integration-paging-sort.html +79 -79
- package/test/test-integration-paging-sort.js +60 -60
- package/test/test-linked-filters-disabled-options-grid-layout.html +80 -80
- package/test/test-linked-filters-disabled-options-grid-layout.js +73 -73
- package/test/test-linked-filters-grid-layout.html +80 -80
- package/test/test-linked-filters-grid-layout.js +72 -72
- package/test/test-linked-filters-load-filters-on-demand.html +80 -80
- package/test/test-linked-filters-load-filters-on-demand.js +99 -99
- package/test/test-linked-filters-paging.html +80 -80
- package/test/test-linked-filters-paging.js +99 -99
- package/test/test-linked-filters.html +80 -80
- package/test/test-linked-filters.js +138 -138
- package/test/test-load-filters-on-demand.html +77 -77
- package/test/test-load-filters-on-demand.js +124 -124
- package/test/test-loader.html +79 -79
- package/test/test-loader.js +159 -159
- package/test/test-no-config.html +80 -80
- package/test/test-no-config.js +63 -63
- package/test/test-no-filters.html +80 -80
- package/test/test-no-filters.js +172 -172
- package/test/test-no-headers.html +71 -71
- package/test/test-no-headers.js +99 -99
- package/test/test-no-results-message.html +262 -262
- package/test/test-no-results-message.js +222 -222
- package/test/test-no-rows.html +19 -19
- package/test/test-no-rows.js +10 -10
- package/test/test-one-row.html +29 -29
- package/test/test-one-row.js +18 -18
- package/test/test-paging.html +78 -78
- package/test/test-paging.js +273 -273
- package/test/test-popup-filter-one-row.html +38 -38
- package/test/test-popup-filter-one-row.js +138 -138
- package/test/test-popup-filter.html +78 -78
- package/test/test-popup-filter.js +384 -384
- package/test/test-popup-filters-grouped-headers.html +104 -104
- package/test/test-popup-filters-grouped-headers.js +206 -206
- package/test/test-rows-counter.html +77 -77
- package/test/test-rows-counter.js +114 -112
- package/test/test-single-filter.html +78 -78
- package/test/test-single-filter.js +138 -138
- package/test/test-sort-custom-sorter.html +243 -243
- package/test/test-sort-custom-sorter.js +74 -74
- package/test/test-sort-grid-layout.html +142 -142
- package/test/test-sort-grid-layout.js +86 -86
- package/test/test-sort-key.html +243 -243
- package/test/test-sort-key.js +67 -67
- package/test/test-sort.html +142 -142
- package/test/test-sort.js +126 -126
- package/test/test-state.html +78 -78
- package/test/test-state.js +369 -369
- package/test/test-status-bar.html +79 -79
- package/test/test-status-bar.js +149 -146
- package/test/test-storage-cookie.html +78 -78
- package/test/test-storage-cookie.js +82 -82
- package/test/test-storage-local.html +78 -78
- package/test/test-storage-local.js +82 -82
- package/test/test-tfoot.html +96 -96
- package/test/test-tfoot.js +123 -123
- package/test/test-thead.html +80 -80
- package/test/test-thead.js +69 -69
- package/test/test-toolbar.html +81 -81
- package/test/test-toolbar.js +218 -218
- package/test/test-uneven-rows.html +95 -95
- package/test/test-uneven-rows.js +61 -61
- package/test/test-watermark.html +80 -80
- package/test/test-watermark.js +103 -103
- package/test/test.html +141 -141
- package/test/test.js +162 -162
- package/vite.config.js +71 -0
- package/webpack.config.js +99 -87
- package/webpack.dev.config.js +25 -25
- package/webpack.test.config.js +44 -44
- package/.travis.yml +0 -53
- package/dist/tablefilter/tf-1-2aa33b10e0e549020c12.js +0 -1
|
@@ -0,0 +1,521 @@
|
|
|
1
|
+
# TableFilter v1.0.0 Architecture & Migration Investigation
|
|
2
|
+
## Transition to Native Web Components, Universal Accessibility (WCAG 2.2), and Complete Contract Compatibility
|
|
3
|
+
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
## Executive Summary
|
|
7
|
+
|
|
8
|
+
**TableFilter** (currently at `v0.7.3`) is a mature, battle-tested JavaScript library that transforms standard HTML tables into rich, interactive data tables with column filtering, sorting, pagination, and calculations. It is backed by extensive documentation (Wiki, ESDoc, demos) and a 74-file test suite comprising 739 test cases that define an exacting operational contract.
|
|
9
|
+
|
|
10
|
+
Transitioning TableFilter to **Version 1.0.0** represents a milestone evolution:
|
|
11
|
+
1. **Native Web Components**: Adopting W3C Standard Custom Elements (`<table-filter>`) with Shadow DOM encapsulation and slot projection, eliminating framework lock-in and script tag fragility.
|
|
12
|
+
2. **Universal Accessibility (WCAG 2.2 AA/AAA & WAI-ARIA APG)**: Resolving critical accessibility shortcomings in legacy versions (unlabeled inputs, inaccessible sort triggers, custom checklists without ARIA widget semantics, silent state transitions) to make every filter, modal, and data view completely operable by screen readers and keyboard users.
|
|
13
|
+
3. **100% Contract Preservation**: Fulfilling the entire configuration schema, imperative API (`new TableFilter(...)`), event emitter lifecycle, and extension ecosystem documented across the project specifications.
|
|
14
|
+
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
## 1. Contract Analysis: The Baseline Specification
|
|
18
|
+
|
|
19
|
+
The TableFilter specification consists of three core layers documented in the wiki, codebase, and tests:
|
|
20
|
+
|
|
21
|
+
```
|
|
22
|
+
+-----------------------------------------------------------------------+
|
|
23
|
+
| CONSUMER INTERFACE |
|
|
24
|
+
| Declarative: <table-filter> | Imperative: new TableFilter(...) |
|
|
25
|
+
+-----------------------------------+-----------------------------------+
|
|
26
|
+
| PUBLIC API |
|
|
27
|
+
| Methods (init, filter, clear) | Events (before-filtering, etc.) |
|
|
28
|
+
+-----------------------------------+-----------------------------------+
|
|
29
|
+
| CONFIGURATION CONTRACT |
|
|
30
|
+
| Main Options (col_types, etc.) | Feature Blocks (paging, etc.) |
|
|
31
|
+
+-----------------------------------+-----------------------------------+
|
|
32
|
+
| EXTENSIONS ECOSYSTEM |
|
|
33
|
+
| sort | colsVisibility | filtersVisibility | colOps | advGrid |
|
|
34
|
+
+-----------------------------------------------------------------------+
|
|
35
|
+
| DATA & FILTERING ENGINE |
|
|
36
|
+
| Operators (<, >, =, rgx:) | Type Formats (date, num, regex) |
|
|
37
|
+
+-----------------------------------------------------------------------+
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
### 1.1 Constructor & Instantiation Contract
|
|
41
|
+
- **Signatures**:
|
|
42
|
+
- `new TableFilter(tableElement: HTMLTableElement, [refRow: number], [config: object])`
|
|
43
|
+
- `new TableFilter(tableId: string, [refRow: number], [config: object])`
|
|
44
|
+
- **Behavior**:
|
|
45
|
+
- Validates table presence; extracts or generates instance ID (`tf.id`).
|
|
46
|
+
- Sets up `refRow` (default index `0` or `1` depending on headers and filters row placement).
|
|
47
|
+
- Normalizes legacy/shorthand configurations into normalized internal structures.
|
|
48
|
+
- Registers modules/features in the feature registry.
|
|
49
|
+
- Registers extensions in the extension registry.
|
|
50
|
+
|
|
51
|
+
### 1.2 Configuration Schema Contract
|
|
52
|
+
The library contract defines over 100 configuration properties across 20 distinct modules:
|
|
53
|
+
|
|
54
|
+
| Functional Area | Primary Configuration Properties | Expected Behavior |
|
|
55
|
+
| :--- | :--- | :--- |
|
|
56
|
+
| **Grid & Filters Row** | `grid`, `filters_row_index`, `col_{n}`, `col_types`, `auto_filter`, `enter_key` | Controls filter type per column (`input`, `select`, `multiple`, `checklist`, `none`), row index (0=above headers, 1=below), debounce delay. |
|
|
57
|
+
| **Data Matching** | `exact_match`, `columns_exact_match`, `case_sensitive`, `ignore_diacritics`, `empty_operator`, `nonempty_operator` | Controls string normalization, regex parsing, empty/non-empty matching tokens. |
|
|
58
|
+
| **Data Types & Locales** | `col_types`, `locale`, `thousands_separator`, `decimal_separator` | Formatted numbers (`1.234,56` vs `1,234.56`), ISO & localized dates (`{dd}.{MM}.{yyyy}`). |
|
|
59
|
+
| **Dropdown & Checklist** | `enable_slc_reset_filter`, `load_filters_on_demand`, `sort_filter_options_asc`, `custom_options` | Populates unique values from column cells; handles linked/cascading filter state. |
|
|
60
|
+
| **Pagination** | `paging`, `paging_length`, `results_per_page`, `page_selector_type`, `has_nb_pages` | Chunks visible rows into pages, renders navigation buttons and jump selectors. |
|
|
61
|
+
| **Toolbar & Containers** | `toolbar`, `rows_counter`, `status_bar`, `btn_reset`, `loader`, `help_instructions` | Creates multi-zone toolbar (`left`, `center`, `right`) with live counters, reset button, and status text. |
|
|
62
|
+
| **State Persistence** | `state.types` (`'local_storage'`, `'cookie'`, `'hash'`), `state.filters`, `state.page_nb` | Serializes and restores filter strings, page indices, and column visibility. |
|
|
63
|
+
| **Extensions** | `extensions: [{ name: 'sort' }, { name: 'colsVisibility' }, ...]` | Asynchronously loads/initializes extension packages. |
|
|
64
|
+
|
|
65
|
+
### 1.3 Public API & Event Emitter Contract
|
|
66
|
+
- **Essential Methods**:
|
|
67
|
+
- Filtering: `filter()`, `clearFilters()`, `setFilterValue(colIndex, value)`, `getFilterValue(colIndex)`, `getFiltersValue()`.
|
|
68
|
+
- Introspection: `getFilteredData()`, `getTableData()`, `getValidRows()`, `getValidRowsNb()`, `getFilterableRowsNb()`, `getCellValue(cell)`, `getCellData(cell)`.
|
|
69
|
+
- DOM References: `dom()`, `getFilterElement(colIndex)`, `getHeaderElement(colIndex)`, `getFiltersRowIndex()`, `getHeadersRowIndex()`.
|
|
70
|
+
- Lifecycle: `init()`, `destroy()`, `isInitialized()`, `feature(name)`, `extension(name)`, `registerExtension(inst, name)`.
|
|
71
|
+
- **Event Lifecycle**:
|
|
72
|
+
- Sequential event bus firing:
|
|
73
|
+
`before-filter-init` → `filters-row-inserted` → `after-filter-init` → `initialized` → `before-filtering` → `cell-processed` → `row-processed` → `row-validated` → `after-filtering` → `before-clearing-filters` → `after-clearing-filters` → `destroy`.
|
|
74
|
+
|
|
75
|
+
### 1.4 Operator & Query Parsing Contract
|
|
76
|
+
- Standard comparison operators: `<`, `<=`, `=`, `>=`, `>`.
|
|
77
|
+
- Logical & matching operators: `*` (contains/wildcard), `!` (negation), `{` (starts with), `}` (ends with), `||` (OR), `&&` (AND), `rgx:` (regular expression).
|
|
78
|
+
- Null state operators: `[empty]`, `[nonempty]`.
|
|
79
|
+
|
|
80
|
+
---
|
|
81
|
+
|
|
82
|
+
## 2. Native Web Components Architecture for v1.0.0
|
|
83
|
+
|
|
84
|
+
### 2.1 Autonomous Custom Elements vs. Customized Built-in Elements
|
|
85
|
+
In the HTML Web Components specification, two approaches exist:
|
|
86
|
+
1. **Customized built-in element**: `<table is="table-filter">`.
|
|
87
|
+
- *Limitation*: Apple/WebKit has refused to implement customized built-in elements (`is=""`) in Safari. Polyfills are brittle and do not conform to native standards.
|
|
88
|
+
2. **Autonomous custom element**: `<table-filter>`.
|
|
89
|
+
- *Advantage*: Supported universally across all modern browsers (Chrome, Edge, Firefox, Safari, iOS, Android).
|
|
90
|
+
- *Structure*: Wraps or references the native `<table>` element using slots.
|
|
91
|
+
|
|
92
|
+
```html
|
|
93
|
+
<!-- Declarative Pattern 1: Table Slotted Inside Custom Element (Recommended) -->
|
|
94
|
+
<table-filter paging auto-filter theme="default">
|
|
95
|
+
<table id="my-table">
|
|
96
|
+
<thead>
|
|
97
|
+
<tr><th>From</th><th>Destination</th><th>Distance</th></tr>
|
|
98
|
+
</thead>
|
|
99
|
+
<tbody>
|
|
100
|
+
<tr><td>Sydney</td><td>Melbourne</td><td>877</td></tr>
|
|
101
|
+
</tbody>
|
|
102
|
+
</table>
|
|
103
|
+
</table-filter>
|
|
104
|
+
|
|
105
|
+
<!-- Declarative Pattern 2: External Reference via 'for' Attribute -->
|
|
106
|
+
<table-filter for="my-table" paging></table-filter>
|
|
107
|
+
<table id="my-table">...</table>
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
### 2.2 Shadow DOM vs. Light DOM: Accessibility & Semantics
|
|
111
|
+
HTML `<table>` semantics are strictly parsed by browser layout and accessibility engines:
|
|
112
|
+
- `<table>` elements **must not** contain custom elements as direct children between `<table>`, `<tbody>`, and `<tr>`.
|
|
113
|
+
- Placing the table in the Light DOM (projected via `<slot>` into `<table-filter>`) ensures:
|
|
114
|
+
1. Accessibility tree integrity: Screen readers parse the native table header-to-cell relationships without shadow boundary clipping.
|
|
115
|
+
2. Consumer CSS styling: Global application stylesheets (Bootstrap, Tailwind, custom design systems) continue to style table rows and cells naturally.
|
|
116
|
+
3. Progressive enhancement: If JavaScript is disabled or fails to load, the raw HTML table remains fully rendered and legible.
|
|
117
|
+
|
|
118
|
+
```
|
|
119
|
+
+-------------------------------------------------------------+
|
|
120
|
+
| <table-filter> (Host Custom Element) |
|
|
121
|
+
| |
|
|
122
|
+
| [ Shadow DOM ] |
|
|
123
|
+
| +---------------------------------------------------------+ |
|
|
124
|
+
| | <tf-toolbar part="toolbar-top"> | |
|
|
125
|
+
| | <slot name="top-toolbar"> | |
|
|
126
|
+
| | <tf-status part="status" role="status"></tf-status> | |
|
|
127
|
+
| | <tf-rows-counter part="counter"></tf-rows-counter> | |
|
|
128
|
+
| | <tf-clear-button part="clear-btn"></tf-clear-button>| |
|
|
129
|
+
| | </slot> | |
|
|
130
|
+
| | </tf-toolbar> | |
|
|
131
|
+
| +---------------------------------------------------------+ |
|
|
132
|
+
| | <div class="table-container" part="table-container"> | |
|
|
133
|
+
| | <slot></slot> <------------------------------------+ | |
|
|
134
|
+
| | </div> | | |
|
|
135
|
+
| +-------------------------------------------------------|-+ |
|
|
136
|
+
| | <tf-toolbar part="toolbar-bottom"> | | |
|
|
137
|
+
| | <slot name="bottom-toolbar"> | | |
|
|
138
|
+
| | <tf-pager part="pager"></tf-pager> | | |
|
|
139
|
+
| | </slot> | | |
|
|
140
|
+
| | </tf-toolbar> | | |
|
|
141
|
+
| +-------------------------------------------------------|-+ |
|
|
142
|
+
| | |
|
|
143
|
+
| [ Light DOM (Slotted Content) ] | |
|
|
144
|
+
| +-------------------------------------------------------|-+ |
|
|
145
|
+
| | <table id="my-table"> <-------------------------------+ | |
|
|
146
|
+
| | <thead> | |
|
|
147
|
+
| | <tr class="tf-headers-row">...</tr> | |
|
|
148
|
+
| | <tr class="tf-filters-row"> | |
|
|
149
|
+
| | <th><tf-filter-input col="0"></tf-filter-input></th>|
|
|
150
|
+
| | <th><tf-checklist col="1"></tf-checklist></th> | |
|
|
151
|
+
| | <th><tf-dropdown col="2"></tf-dropdown></th> | |
|
|
152
|
+
| | </tr> | |
|
|
153
|
+
| | </thead> | |
|
|
154
|
+
| | <tbody>...</tbody> | |
|
|
155
|
+
| | </table> | |
|
|
156
|
+
| +---------------------------------------------------------+ |
|
|
157
|
+
+-------------------------------------------------------------+
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
### 2.3 Modular Component Suite
|
|
161
|
+
v1.0.0 decomposes the monolithic script into focused custom elements:
|
|
162
|
+
|
|
163
|
+
1. `<table-filter>`: Root orchestrator, state manager, and public API provider.
|
|
164
|
+
2. `<tf-toolbar>`: Multi-section flex container (`left`, `center`, `right`) managing UI controls.
|
|
165
|
+
3. `<tf-filter-input>`: Accessible search input with integrated debounce, clear button, and operator help popover.
|
|
166
|
+
4. `<tf-dropdown>`: Accessible native `<select>` wrapper with dynamic option collection.
|
|
167
|
+
5. `<tf-checklist>`: Accessible ARIA Combobox/Listbox multi-select popup with search, select-all, and keyboard navigation.
|
|
168
|
+
6. `<tf-pager>`: Accessible pagination component with WAI-ARIA buttons, page indicator, and results-per-page selector.
|
|
169
|
+
7. `<tf-status>`: Accessible live status announcements (`role="status"`, `aria-live="polite"`).
|
|
170
|
+
8. `<tf-rows-counter>`: Live region counter displaying total and filtered row counts.
|
|
171
|
+
9. `<tf-clear-button>`: Accessible reset button dispatching filter reset actions.
|
|
172
|
+
10. `<tf-dialog>`: Accessible modal/popover container for help instructions, column visibility manager, and popup filters.
|
|
173
|
+
|
|
174
|
+
### 2.4 Dual API Architecture (Declarative + Imperative Backward Compatibility)
|
|
175
|
+
To guarantee 100% backward compatibility for existing codebases:
|
|
176
|
+
|
|
177
|
+
```javascript
|
|
178
|
+
// Legacy Imperative Instantiation remains fully supported:
|
|
179
|
+
const tf = new TableFilter(document.querySelector('#my-table'), {
|
|
180
|
+
base_path: 'dist/tablefilter/',
|
|
181
|
+
paging: true,
|
|
182
|
+
col_types: ['string', 'number', 'date']
|
|
183
|
+
});
|
|
184
|
+
tf.init();
|
|
185
|
+
|
|
186
|
+
// Under the hood:
|
|
187
|
+
// 1. TableFilter class wraps or mounts the <table-filter> custom element.
|
|
188
|
+
// 2. All legacy methods (filter, clearFilters, getFilteredData, etc.) proxy directly
|
|
189
|
+
// to the underlying web component controller.
|
|
190
|
+
// 3. Emitter events and DOM CustomEvents are synchronized bidirectionally.
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
---
|
|
194
|
+
|
|
195
|
+
## 3. Comprehensive Accessibility (A11y) Strategy
|
|
196
|
+
|
|
197
|
+
### 3.1 Standards & Conformance Targets
|
|
198
|
+
- **Conformance Target**: WCAG 2.2 Level AA (Level AAA where feasible).
|
|
199
|
+
- **ARIA Specifications**: WAI-ARIA 1.2 / 1.3 & WAI-ARIA Authoring Practices Guide (APG) Table and Data Grid patterns.
|
|
200
|
+
- **Section 508 & EN 301 549**: Fully aligned.
|
|
201
|
+
|
|
202
|
+
### 3.2 Component-by-Component Accessibility Implementation
|
|
203
|
+
|
|
204
|
+
#### 1. Sortable Column Headers
|
|
205
|
+
*Legacy Problem*: `<th>` click listeners with cursor pointer; no keyboard access, no state announcement for screen readers.
|
|
206
|
+
*v1.0.0 Implementation*:
|
|
207
|
+
- Interactive trigger inside `<th>`:
|
|
208
|
+
```html
|
|
209
|
+
<th scope="col" aria-sort="ascending">
|
|
210
|
+
<button type="button" class="tf-sort-btn" id="sort-col-0">
|
|
211
|
+
<span>Destination</span>
|
|
212
|
+
<svg class="tf-sort-icon" aria-hidden="true" focusable="false">...</svg>
|
|
213
|
+
</button>
|
|
214
|
+
</th>
|
|
215
|
+
```
|
|
216
|
+
- Attributes: `aria-sort="none"`, `aria-sort="ascending"`, or `aria-sort="descending"`.
|
|
217
|
+
- Keyboard: `Enter` or `Space` toggles sort direction.
|
|
218
|
+
- Screen Reader Output: *"Destination, sortable column, sorted ascending. Activate to sort descending."*
|
|
219
|
+
|
|
220
|
+
#### 2. Filter Inputs
|
|
221
|
+
*Legacy Problem*: Plain `<input type="text">` without label, `aria-label`, or relationship to column headers.
|
|
222
|
+
*v1.0.0 Implementation*:
|
|
223
|
+
```html
|
|
224
|
+
<th scope="col">
|
|
225
|
+
<div class="tf-filter-wrap">
|
|
226
|
+
<label for="flt-0-input" class="sr-only">Filter Destination</label>
|
|
227
|
+
<input
|
|
228
|
+
type="search"
|
|
229
|
+
id="flt-0-input"
|
|
230
|
+
class="tf-filter-input"
|
|
231
|
+
aria-label="Filter Destination"
|
|
232
|
+
aria-describedby="flt-0-desc"
|
|
233
|
+
placeholder="Filter..."
|
|
234
|
+
autocomplete="off"
|
|
235
|
+
spellcheck="false"
|
|
236
|
+
/>
|
|
237
|
+
<span id="flt-0-desc" class="sr-only">Supports operators like >, <, =, and wildcard *</span>
|
|
238
|
+
<button type="button" class="tf-clear-filter-btn" aria-label="Clear Destination filter">
|
|
239
|
+
<svg aria-hidden="true">...</svg>
|
|
240
|
+
</button>
|
|
241
|
+
</div>
|
|
242
|
+
</th>
|
|
243
|
+
```
|
|
244
|
+
|
|
245
|
+
#### 3. Checklist Multi-Select Filter
|
|
246
|
+
*Legacy Problem*: Plain `<div>` with `<ul>`/`<li>` and checkboxes, unnavigable via arrow keys, not adhering to combobox pattern.
|
|
247
|
+
*v1.0.0 Implementation (WAI-ARIA Combobox / Listbox Pattern)*:
|
|
248
|
+
- Trigger Button:
|
|
249
|
+
```html
|
|
250
|
+
<button
|
|
251
|
+
type="button"
|
|
252
|
+
id="btn-chk-1"
|
|
253
|
+
class="tf-checklist-trigger"
|
|
254
|
+
aria-haspopup="listbox"
|
|
255
|
+
aria-expanded="false"
|
|
256
|
+
aria-controls="listbox-chk-1"
|
|
257
|
+
aria-label="Filter Category, 2 items selected"
|
|
258
|
+
>
|
|
259
|
+
<span>Category (2)</span>
|
|
260
|
+
<svg aria-hidden="true">...</svg>
|
|
261
|
+
</button>
|
|
262
|
+
```
|
|
263
|
+
- Dropdown Popover:
|
|
264
|
+
```html
|
|
265
|
+
<div
|
|
266
|
+
id="listbox-chk-1"
|
|
267
|
+
role="listbox"
|
|
268
|
+
aria-multiselectable="true"
|
|
269
|
+
aria-label="Filter Category options"
|
|
270
|
+
tabindex="-1"
|
|
271
|
+
>
|
|
272
|
+
<div role="option" id="opt-1-0" aria-selected="false" tabindex="0">
|
|
273
|
+
<input type="checkbox" id="chk-opt-1-0" aria-hidden="true" tabindex="-1" />
|
|
274
|
+
<label for="chk-opt-1-0">All</label>
|
|
275
|
+
</div>
|
|
276
|
+
<div role="option" id="opt-1-1" aria-selected="true" tabindex="-1">
|
|
277
|
+
<input type="checkbox" id="chk-opt-1-1" checked aria-hidden="true" tabindex="-1" />
|
|
278
|
+
<label for="chk-opt-1-1">Electronics</label>
|
|
279
|
+
</div>
|
|
280
|
+
</div>
|
|
281
|
+
```
|
|
282
|
+
- Keyboard Navigation:
|
|
283
|
+
- `Down Arrow` / `Up Arrow`: Moves active descendant focus through options.
|
|
284
|
+
- `Space`: Toggles `aria-selected` and checkbox state.
|
|
285
|
+
- `Enter`: Closes dropdown and executes filter.
|
|
286
|
+
- `Escape`: Cancels/closes dropdown and returns focus to trigger button.
|
|
287
|
+
- `Home` / `End`: Moves focus to first/last option.
|
|
288
|
+
|
|
289
|
+
#### 4. Pagination Controls
|
|
290
|
+
*Legacy Problem*: `<span>` elements with click handlers or unlabeled buttons.
|
|
291
|
+
*v1.0.0 Implementation*:
|
|
292
|
+
```html
|
|
293
|
+
<nav class="tf-pagination" aria-label="Table Pagination">
|
|
294
|
+
<button type="button" aria-label="First page" disabled>
|
|
295
|
+
<svg aria-hidden="true">...</svg>
|
|
296
|
+
</button>
|
|
297
|
+
<button type="button" aria-label="Previous page" disabled>
|
|
298
|
+
<svg aria-hidden="true">...</svg>
|
|
299
|
+
</button>
|
|
300
|
+
|
|
301
|
+
<span class="tf-pager-status" aria-current="page">
|
|
302
|
+
Page <input type="number" min="1" max="10" value="1" aria-label="Current page" /> of 10
|
|
303
|
+
</span>
|
|
304
|
+
|
|
305
|
+
<button type="button" aria-label="Next page">
|
|
306
|
+
<svg aria-hidden="true">...</svg>
|
|
307
|
+
</button>
|
|
308
|
+
<button type="button" aria-label="Last page">
|
|
309
|
+
<svg aria-hidden="true">...</svg>
|
|
310
|
+
</button>
|
|
311
|
+
|
|
312
|
+
<label for="page-size-slc">Rows per page</label>
|
|
313
|
+
<select id="page-size-slc" aria-label="Rows per page">
|
|
314
|
+
<option value="10" selected>10</option>
|
|
315
|
+
<option value="25">25</option>
|
|
316
|
+
<option value="50">50</option>
|
|
317
|
+
</select>
|
|
318
|
+
</nav>
|
|
319
|
+
```
|
|
320
|
+
|
|
321
|
+
#### 5. Live Regions & Dynamic Announcements (WCAG 4.1.3)
|
|
322
|
+
*Legacy Problem*: Filtering and sorting execute silently without notifying assistive technologies.
|
|
323
|
+
*v1.0.0 Implementation*:
|
|
324
|
+
- Dedicated Live Announcer inside `<table-filter>` Shadow DOM:
|
|
325
|
+
```html
|
|
326
|
+
<div class="sr-only" role="status" aria-live="polite" aria-atomic="true" id="live-announcer"></div>
|
|
327
|
+
```
|
|
328
|
+
- Dynamic Announcements:
|
|
329
|
+
- On Filter Completed: `"Filtering complete. 14 rows matching out of 150."`
|
|
330
|
+
- On Zero Results: `"No matching rows found."`
|
|
331
|
+
- On Clear Filters: `"All filters cleared. 150 rows displayed."`
|
|
332
|
+
- On Sort: `"Table sorted by Destination ascending."`
|
|
333
|
+
- On Page Change: `"Showing page 2 of 15 (rows 11 to 20)."`
|
|
334
|
+
|
|
335
|
+
#### 6. High Contrast & Visual Accessibility
|
|
336
|
+
- **Visible Focus Indicator (WCAG 2.4.11 / 2.4.13)**:
|
|
337
|
+
`outline: 2px solid var(--tf-focus-ring, #0969da); outline-offset: 2px;` with minimum 3:1 contrast against adjacent colors.
|
|
338
|
+
- **Forced Colors Mode (`@media (forced-colors: active)`)**:
|
|
339
|
+
Replace raster image icons with inline SVGs utilizing `currentColor` and `CanvasText` system colors.
|
|
340
|
+
- **Color Contrast (WCAG 1.4.3 / 1.4.11)**:
|
|
341
|
+
- All text contrast ≥ 4.5:1.
|
|
342
|
+
- Active filter indicators & borders ≥ 3:1.
|
|
343
|
+
- Filter state never conveyed by color alone; active filters display an explicit icon and tooltip.
|
|
344
|
+
|
|
345
|
+
---
|
|
346
|
+
|
|
347
|
+
## 4. Technical Debt Liquidation & Modern Tooling
|
|
348
|
+
|
|
349
|
+
To ensure a solid v1.0.0 release, the build system and dependencies require comprehensive modernization:
|
|
350
|
+
|
|
351
|
+
| Area | Current Legacy State (`v0.7.3`) | Modernized Target State (`v1.0.0`) | Rationale |
|
|
352
|
+
| :--- | :--- | :--- | :--- |
|
|
353
|
+
| **Build Tooling** | Webpack 4 + Grunt + Babel 7.10 | Vite / Rollup + esbuild | Fast ESM builds, tree-shaking, standard module output (ESM, CJS, UMD). |
|
|
354
|
+
| **Node.js Target** | Node 8 / 10 | Node 18 / 20 / 22 / 24+ LTS | Eliminates deprecated build dependencies and vulnerability alerts. |
|
|
355
|
+
| **CSS Preprocessing**| Stylus (`.styl`) | CSS Custom Properties + PostCSS / Vanilla CSS | Native CSS features (nesting, variables, `:has()`, `:focus-visible`). |
|
|
356
|
+
| **Language & Typings**| ES2015 with ESDoc comments | Modern Standard JS (ESM) with JSDoc | Stays pure JavaScript; no TypeScript migration overhead, zero compilation friction. |
|
|
357
|
+
| **Icons & Media** | Raster GIF / PNG images (`btn_first_page.gif`, etc.) | Scalable Vector Graphics (SVG) + CSS | High-DPI crispness, theming via `currentColor`, WCAG contrast compliance. |
|
|
358
|
+
| **Testing Engine** | Grunt QUnit + PhantomJS / connect | Vitest / Playwright + Web Test Runner | Real browser testing across Chromium, WebKit, and Firefox engines. |
|
|
359
|
+
| **Automated A11y** | None | `@axe-core/playwright` / `axe-core` | Continuous integration checks against WCAG 2.2 rules on every commit. |
|
|
360
|
+
| **Third-Party Helpers**| `sugar-date`, `diacritics`, `format-number` | Native `Intl`, `String.normalize('NFD')`, lightweight date parser | Reduces bundle size by ~45KB; leverages native browser platform APIs. |
|
|
361
|
+
|
|
362
|
+
---
|
|
363
|
+
|
|
364
|
+
## 5. Step-by-Step Implementation Roadmap to v1.0.0
|
|
365
|
+
|
|
366
|
+
```mermaid
|
|
367
|
+
flowchart TD
|
|
368
|
+
subgraph Phase1["Phase 1: Build & Testing Foundation"]
|
|
369
|
+
P1_1["Setup Modern Monorepo / Tooling (Vite/Rollup)"] --> P1_2["Port QUnit 739 Test Suite to Vitest/Playwright"]
|
|
370
|
+
P1_2 --> P1_3["Integrate Axe-Core Automated A11y Suite"]
|
|
371
|
+
end
|
|
372
|
+
|
|
373
|
+
subgraph Phase2["Phase 2: Decoupled Core Data Engine"]
|
|
374
|
+
P2_1["Extract Headless Table Engine (Filtering, Sorting, Paging)"] --> P2_2["Modernize Types, Operators & Internationalization (Intl)"]
|
|
375
|
+
P2_2 --> P2_3["Verify 100% Contract Equivalence against Existing Suite"]
|
|
376
|
+
end
|
|
377
|
+
|
|
378
|
+
subgraph Phase3["Phase 3: Web Components Suite Implementation"]
|
|
379
|
+
P3_1["Develop Root Custom Element <table-filter>"] --> P3_2["Develop Slotted Sub-elements (Toolbar, Filter, Pager)"]
|
|
380
|
+
P3_3["Implement Imperative Backward-Compatibility Bridge"] --> P3_2
|
|
381
|
+
end
|
|
382
|
+
|
|
383
|
+
subgraph Phase4["Phase 4: Complete Accessibility Overhaul"]
|
|
384
|
+
P4_1["ARIA Patterns (Combobox, Dialog, Table Headers)"] --> P4_2["Live Regions & Polite Announcements Engine"]
|
|
385
|
+
P4_2 --> P4_3["Keyboard Navigation, Focus Traps & Roving Tabindex"]
|
|
386
|
+
end
|
|
387
|
+
|
|
388
|
+
subgraph Phase5["Phase 5: Design System & Theming"]
|
|
389
|
+
P5_1["Replace Stylus with CSS Custom Properties"] --> P5_2["Replace Raster Images with Themeable SVGs"]
|
|
390
|
+
P5_2 --> P5_3["Support Dark Mode & Forced-Colors (High Contrast)"]
|
|
391
|
+
end
|
|
392
|
+
|
|
393
|
+
subgraph Phase6["Phase 6: Extensions Porting & Verification"]
|
|
394
|
+
P6_1["Refactor Extensions (sort, colsVisibility, colOps, advGrid)"] --> P6_2["End-to-End Regression & A11y Verification"]
|
|
395
|
+
P6_2 --> P6_3["Modernized Documentation & Migration Guides"]
|
|
396
|
+
end
|
|
397
|
+
|
|
398
|
+
Phase1 --> Phase2
|
|
399
|
+
Phase2 --> Phase3
|
|
400
|
+
Phase3 --> Phase4
|
|
401
|
+
Phase4 --> Phase5
|
|
402
|
+
Phase5 --> Phase6
|
|
403
|
+
Phase6 --> Milestone1["TableFilter 1.0.0 Stable Release"]
|
|
404
|
+
```
|
|
405
|
+
|
|
406
|
+
### Phase 1: Tooling Modernization & Dual-Test Harness
|
|
407
|
+
1. **Initialize Modern Build System**:
|
|
408
|
+
- Replace Grunt and Webpack 4 with Vite / Rollup.
|
|
409
|
+
- Configure output targets:
|
|
410
|
+
- `dist/tablefilter.esm.js` (Modern ESM with Web Components).
|
|
411
|
+
- `dist/tablefilter.cjs.js` (CommonJS module).
|
|
412
|
+
- `dist/tablefilter.js` (UMD / IIFE bundle for legacy `<script>` tag consumers).
|
|
413
|
+
2. **Harness Existing QUnit Test Suite**:
|
|
414
|
+
- Run all 74 test files and 739 test assertions in a headless modern browser environment to create the regression baseline.
|
|
415
|
+
- Setup `@axe-core/playwright` to test each fixture for WCAG 2.2 violations.
|
|
416
|
+
|
|
417
|
+
### Phase 2: Decoupled Headless Core Engine
|
|
418
|
+
1. **Separate Data Logic from DOM Manipulation**:
|
|
419
|
+
- Abstract data filtering, query parsing (`<`, `>`, `||`, `&&`, regex), type conversions, and pagination into a pure, headless engine.
|
|
420
|
+
- Eliminate obsolete polyfills (`supportsClassList`, IE8 checks).
|
|
421
|
+
2. **Modernize Platform Utilities**:
|
|
422
|
+
- Replace external `diacritics` package with native `String.prototype.normalize('NFD').replace(/[\u0300-\u036f]/g, '')`.
|
|
423
|
+
- Implement localized number parsing using native `Intl.NumberFormat`.
|
|
424
|
+
- Maintain Sugar Date format compatibility for custom legacy date strings.
|
|
425
|
+
3. **Contract Regression Gate**:
|
|
426
|
+
- Validate that 100% of headless engine tests pass identical assertions.
|
|
427
|
+
|
|
428
|
+
### Phase 3: Web Components Suite & Imperative Adapter
|
|
429
|
+
1. **Implement Root `<table-filter>`**:
|
|
430
|
+
- Register custom element `customElements.define('table-filter', TableFilterElement)`.
|
|
431
|
+
- Implement Shadow DOM with default slots:
|
|
432
|
+
- `<slot name="top-toolbar"></slot>`
|
|
433
|
+
- `<slot></slot>` (default slot for light DOM `<table>`)
|
|
434
|
+
- `<slot name="bottom-toolbar"></slot>`
|
|
435
|
+
- Attach `MutationObserver` on the slotted table to reactively observe row additions, deletions, or cell changes (`rows-changed`).
|
|
436
|
+
2. **Implement Sub-Components**:
|
|
437
|
+
- Build `<tf-toolbar>`, `<tf-filter-input>`, `<tf-dropdown>`, `<tf-checklist>`, `<tf-pager>`, `<tf-status>`, `<tf-rows-counter>`, `<tf-clear-button>`, `<tf-dialog>`.
|
|
438
|
+
3. **Implement Imperative `TableFilter` Class Adapter**:
|
|
439
|
+
- Preserve exact constructor signature: `new TableFilter(table, refRow, config)`.
|
|
440
|
+
- Proxy calls (`tf.filter()`, `tf.clearFilters()`, etc.) directly to the Web Component controller.
|
|
441
|
+
- Preserve `tf.emitter` with all existing event names while also emitting standard DOM `CustomEvent` instances.
|
|
442
|
+
|
|
443
|
+
### Phase 4: Universal Accessibility (WCAG 2.2 AA/AAA)
|
|
444
|
+
1. **ARIA Structure & Header Sorting**:
|
|
445
|
+
- Wrap column headers in `<button type="button" class="tf-sort-btn">`.
|
|
446
|
+
- Set `aria-sort="none|ascending|descending"` dynamically.
|
|
447
|
+
2. **Form Controls & Inputs**:
|
|
448
|
+
- Ensure every `<input>` has an explicitly associated `<label>` (visually hidden via `.sr-only` where design requires) and `aria-label`.
|
|
449
|
+
- Add clear buttons with accessible labels for every filter input.
|
|
450
|
+
3. **Combobox / Checklist Widget**:
|
|
451
|
+
- Implement WAI-ARIA APG Combobox with Multi-Select Listbox.
|
|
452
|
+
- Full keyboard navigation (Arrows, Space, Enter, Escape, Home, End).
|
|
453
|
+
4. **Live Announcer**:
|
|
454
|
+
- Centralize live region announcements via `aria-live="polite"` for filter matches, clearing, page changes, and sorting actions.
|
|
455
|
+
5. **Dialog & Popovers**:
|
|
456
|
+
- Implement `<dialog>` or `role="dialog"` for help popovers, column visibility dropdowns, and popup filters with focus trapping and `Esc` dismissal.
|
|
457
|
+
|
|
458
|
+
### Phase 5: Modern Theming & Design System
|
|
459
|
+
|
|
460
|
+
> **Sequencing:** items 1–3 below (token API + docs, Stylus→CSS, SVG icons, dark mode / forced-colors) are **deferred to the "Styling modernization (post-1.0)" milestone** (after the v1.0.0 parity launch). Only item 4 — preserving the legacy styling configuration — stays on the parity path.
|
|
461
|
+
|
|
462
|
+
1. **CSS Custom Properties**:
|
|
463
|
+
- Define token system:
|
|
464
|
+
```css
|
|
465
|
+
:host, table-filter {
|
|
466
|
+
--tf-primary: #0969da;
|
|
467
|
+
--tf-primary-hover: #085fc4;
|
|
468
|
+
--tf-bg: #ffffff;
|
|
469
|
+
--tf-text: #24292f;
|
|
470
|
+
--tf-border: #d0d7de;
|
|
471
|
+
--tf-focus-ring: #0969da;
|
|
472
|
+
--tf-row-alt: #f6f8fa;
|
|
473
|
+
--tf-active-col: #ddf4ff;
|
|
474
|
+
}
|
|
475
|
+
```
|
|
476
|
+
2. **CSS Shadow Parts**:
|
|
477
|
+
- Expose `::part(toolbar)`, `::part(filter-input)`, `::part(pager)`, `::part(status)` for custom styling. The configurable legacy class (`status_bar.css_class` and friends) stays on the host, so `.status::part(message)` keeps consumer/theme styling working across the shadow boundary.
|
|
478
|
+
3. **Theme Ports**:
|
|
479
|
+
- Port legacy themes (`default`, `mytheme`, `skyblue`, `transparent`) to clean CSS files setting the custom properties.
|
|
480
|
+
- Replace raster `.gif`/`.png` icons with crisp, theme-aware inline SVGs.
|
|
481
|
+
4. **Preserve the legacy styling configuration (additive, not a rewrite)**:
|
|
482
|
+
- Keep every configurable class name and the core stylesheet/theme **loader** (`base_path`, `style_path`, `stylesheet`, `themes`, `themes_path`, `enable_default_theme`) plus the core class options (`flts_row_css_class`, `flt_css_class`, `flt_multi_css_class`, `flt_small_css_class`, `single_filter.css_class`, `btn_css_class`). Tokens and `::part()` extend this surface; they do not replace it. Porting it into `<table-filter>` is tracked by **#993**.
|
|
483
|
+
|
|
484
|
+
### Phase 6: Extensions Porting & Backward Compatibility Verification
|
|
485
|
+
1. **Extension Modernization**:
|
|
486
|
+
- `sort`: Seamlessly integrate with native `aria-sort` column headers.
|
|
487
|
+
- `colsVisibility`: Accessible popover modal with checkboxes and `aria-controls`.
|
|
488
|
+
- `filtersVisibility`: Accessible toggle button with `aria-expanded`.
|
|
489
|
+
- `colOps`: Native calculation updates with `aria-live="polite"`.
|
|
490
|
+
- `advancedGrid`: Accessible APG Data Grid mode (`role="grid"`).
|
|
491
|
+
2. **Automated Verification**:
|
|
492
|
+
- Execute the complete 739 QUnit test suite against both the imperative API and declarative Web Components.
|
|
493
|
+
- Execute Axe-core automated tests across all 50+ demo fixtures with zero accessibility violations.
|
|
494
|
+
3. **Documentation & Release Preparation**:
|
|
495
|
+
- Update documentation site with Web Component examples and migration guide.
|
|
496
|
+
- Maintain existing comprehensive JSDoc comments across all modules.
|
|
497
|
+
|
|
498
|
+
---
|
|
499
|
+
|
|
500
|
+
## 6. Migration Guide & Deprecation Strategy
|
|
501
|
+
|
|
502
|
+
### Non-Breaking Changes (Zero Code Changes Required)
|
|
503
|
+
- Existing HTML with `<script src="tablefilter.js"></script>` and `new TableFilter('#myTable', config)` continues to function identically.
|
|
504
|
+
- All configuration options (e.g. `col_types`, `paging`, `auto_filter`, `state`, etc.) are recognized and supported.
|
|
505
|
+
- All public methods (`tf.filter()`, `tf.getFilteredData()`) return identical data structures.
|
|
506
|
+
|
|
507
|
+
### Backward Compatibility: `grid_layout` and `sticky_headers`
|
|
508
|
+
- **Both `grid_layout` and `sticky_headers` are fully supported**: `grid_layout` is an established, widely used feature providing synchronized scrolling headers, fixed column widths, and scroll positions. For complete backward compatibility, `grid_layout` will **not** be ditched or deprecated; its full contract and functionality are preserved alongside `sticky_headers`.
|
|
509
|
+
|
|
510
|
+
### Deprecated Features & Recommended Upgrades
|
|
511
|
+
| Deprecated Feature | Modern Alternative in v1.0.0 | Migration Action |
|
|
512
|
+
| :--- | :--- | :--- |
|
|
513
|
+
| `base_path` script loading | Native ES module imports or bundled Web Component | Optional: `base_path` remains supported for asset resolution, but modern bundlers/CDNs can import ESM directly. |
|
|
514
|
+
| External raster GIFs (`btn_first_page.gif`) | Built-in accessible SVGs | Automatic; custom image paths remain supported via props. |
|
|
515
|
+
| Non-semantic `<span>` paging buttons | Semantic `<button>` elements with ARIA | Automatic upgrade; custom HTML templates supported. |
|
|
516
|
+
|
|
517
|
+
---
|
|
518
|
+
|
|
519
|
+
## 7. Conclusion & Next Steps
|
|
520
|
+
|
|
521
|
+
Achieving **Version 1.0.0** for TableFilter as an accessible Native Web Component is an achievable, high-impact project. Because the existing documentation and test suite provide a crystal-clear contract, the migration can proceed with confidence, eliminating historical technical debt while delivering a modern, accessible, zero-dependency component library ready for the next decade of the web.
|