tablefilter 0.7.2 → 0.7.4

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 (280) hide show
  1. package/.editorconfig +15 -15
  2. package/.esdoc.json +14 -14
  3. package/.eslintrc +37 -37
  4. package/.github/ISSUE_TEMPLATE/bug_report.md +38 -38
  5. package/.github/ISSUE_TEMPLATE/feature_request.md +36 -36
  6. package/.github/ISSUE_TEMPLATE/support.md +17 -17
  7. package/.github/dependabot.yml +10 -0
  8. package/.github/workflows/build-deploy.yml +113 -0
  9. package/AGENTS.md +36 -0
  10. package/CONTRIBUTING.md +128 -128
  11. package/Gruntfile.js +252 -252
  12. package/LICENSE +21 -21
  13. package/PULL_REQUEST_TEMPLATE.md +24 -24
  14. package/README.md +166 -174
  15. package/ROADMAP/README.md +29 -0
  16. package/ROADMAP/hybrid-migration-strategy.md +234 -0
  17. package/ROADMAP/key-decisions-review.md +213 -0
  18. package/ROADMAP/preliminary-and-milestone-0.8.0-plan.md +308 -0
  19. package/ROADMAP/v1-webcomponents-investigation.md +516 -0
  20. package/dist/starter.html +514 -514
  21. package/dist/tablefilter/tablefilter.js +1 -1
  22. package/dist/tablefilter/tf-1-d2360db09a424b1ed633.js +1 -0
  23. package/index.js +3 -3
  24. package/libs/sortabletable.js +438 -438
  25. package/package.json +79 -79
  26. package/src/array.js +22 -22
  27. package/src/const.js +118 -118
  28. package/src/cookie.js +57 -57
  29. package/src/dom.js +192 -192
  30. package/src/emitter.js +53 -53
  31. package/src/event.js +124 -124
  32. package/src/extensions/advancedGrid/adapterEzEditTable.js +509 -509
  33. package/src/extensions/advancedGrid/advancedGrid.js +2 -2
  34. package/src/extensions/colOps/colOps.js +474 -480
  35. package/src/extensions/colsVisibility/colsVisibility.js +725 -725
  36. package/src/extensions/filtersVisibility/filtersVisibility.js +316 -316
  37. package/src/extensions/sort/adapterSortabletable.js +537 -537
  38. package/src/extensions/sort/sort.js +8 -8
  39. package/src/feature.js +102 -102
  40. package/src/modules/alternateRows.js +145 -145
  41. package/src/modules/baseDropdown.js +160 -160
  42. package/src/modules/checkList.js +519 -519
  43. package/src/modules/clearButton.js +142 -142
  44. package/src/modules/dateType.js +157 -157
  45. package/src/modules/dropdown.js +376 -376
  46. package/src/modules/gridLayout.js +483 -483
  47. package/src/modules/hash.js +126 -126
  48. package/src/modules/help.js +264 -264
  49. package/src/modules/highlightKeywords.js +180 -180
  50. package/src/modules/loader.js +183 -183
  51. package/src/modules/markActiveColumns.js +146 -146
  52. package/src/modules/noResults.js +193 -193
  53. package/src/modules/paging.js +916 -916
  54. package/src/modules/popupFilter.js +461 -461
  55. package/src/modules/rowsCounter.js +207 -207
  56. package/src/modules/state.js +545 -545
  57. package/src/modules/statusBar.js +308 -308
  58. package/src/modules/storage.js +161 -161
  59. package/src/modules/toolbar.js +224 -224
  60. package/src/number.js +96 -32
  61. package/src/root.js +6 -6
  62. package/src/settings.js +53 -53
  63. package/src/sort.js +82 -82
  64. package/src/string.js +112 -112
  65. package/src/tablefilter.js +3053 -3053
  66. package/src/types.js +81 -81
  67. package/static/partials/books-table-with-images.html +327 -327
  68. package/static/partials/books.html +272 -272
  69. package/static/partials/countries-by-continent.html +2592 -2592
  70. package/static/partials/countries-table-tiny.html +436 -436
  71. package/static/partials/countries-table.html +12954 -12954
  72. package/static/partials/dummy-table-with-totals-footer.html +353 -353
  73. package/static/partials/dummy-table.html +502 -502
  74. package/static/partials/pre-inline-script.html +17 -17
  75. package/static/partials/pre.html +1 -1
  76. package/static/partials/style.html +22 -22
  77. package/static/partials/table-with-grouped-headers.html +9258 -9258
  78. package/static/style/active-header.styl +10 -10
  79. package/static/style/alternating-rows.styl +8 -8
  80. package/static/style/config.styl +44 -44
  81. package/static/style/extensions/colsVisibility.styl +71 -71
  82. package/static/style/extensions/filtersVisibility.styl +18 -18
  83. package/static/style/ezedittable.styl +93 -93
  84. package/static/style/filter-checklist.styl +52 -52
  85. package/static/style/filters.styl +111 -111
  86. package/static/style/grid-layout.styl +130 -130
  87. package/static/style/help.styl +57 -57
  88. package/static/style/keyword.styl +8 -8
  89. package/static/style/loader.styl +16 -16
  90. package/static/style/mixins/arrow.styl +63 -63
  91. package/static/style/mixins/box-shadow.styl +8 -8
  92. package/static/style/mixins/empty-content.styl +7 -7
  93. package/static/style/noresults.styl +14 -14
  94. package/static/style/paging.styl +73 -73
  95. package/static/style/reset-button.styl +21 -21
  96. package/static/style/rows-counter.styl +17 -17
  97. package/static/style/sort.styl +20 -20
  98. package/static/style/status-bar.styl +16 -16
  99. package/static/style/table.styl +44 -44
  100. package/static/style/tablefilter.styl +18 -18
  101. package/static/style/themes/default/default.styl +137 -137
  102. package/static/style/themes/mytheme/mytheme.styl +152 -152
  103. package/static/style/themes/skyblue/skyblue.styl +195 -195
  104. package/static/style/themes/transparent/transparent.styl +205 -205
  105. package/static/style/toolbar.styl +58 -58
  106. package/static/templates/advanced-grid-editable.html +140 -140
  107. package/static/templates/advanced-grid-selection.html +93 -93
  108. package/static/templates/auto-filter.html +46 -46
  109. package/static/templates/columns-visibility.html +67 -67
  110. package/static/templates/data-types.html +123 -123
  111. package/static/templates/demo.html +62 -62
  112. package/static/templates/external-filters-visibility-commad.html +49 -49
  113. package/static/templates/external-filters.html +125 -125
  114. package/static/templates/filter-images.html +91 -91
  115. package/static/templates/filters-visibility.html +45 -45
  116. package/static/templates/grid-layout.html +51 -51
  117. package/static/templates/grouped-headers.html +78 -78
  118. package/static/templates/linked-filters-disabled.html +56 -56
  119. package/static/templates/linked-filters.html +45 -45
  120. package/static/templates/load-filters-on-demand.html +42 -42
  121. package/static/templates/pagination.html +78 -78
  122. package/static/templates/requirejs.html +53 -53
  123. package/static/templates/starter.html +61 -61
  124. package/static/templates/theme-roller.html +106 -106
  125. package/test/libs/polyfill.js +359 -359
  126. package/test/libs/qunit/qunit.css +237 -237
  127. package/test/libs/qunit/qunit.js +2495 -2495
  128. package/test/test-active-columns.html +80 -80
  129. package/test/test-active-columns.js +318 -318
  130. package/test/test-alternate-rows.html +80 -80
  131. package/test/test-alternate-rows.js +335 -335
  132. package/test/test-api.html +141 -141
  133. package/test/test-api.js +795 -795
  134. package/test/test-auto-filter.html +80 -80
  135. package/test/test-auto-filter.js +43 -43
  136. package/test/test-callbacks.html +77 -77
  137. package/test/test-callbacks.js +58 -58
  138. package/test/test-case-sensitive-query.html +77 -77
  139. package/test/test-case-sensitive-query.js +39 -39
  140. package/test/test-cell-parser.html +109 -109
  141. package/test/test-cell-parser.js +80 -80
  142. package/test/test-checklist.html +77 -77
  143. package/test/test-checklist.js +267 -267
  144. package/test/test-clear-button.html +79 -79
  145. package/test/test-clear-button.js +182 -182
  146. package/test/test-col-ops-grid-layout.html +129 -129
  147. package/test/test-col-ops-grid-layout.js +134 -134
  148. package/test/test-col-ops-paging.html +129 -129
  149. package/test/test-col-ops-paging.js +154 -154
  150. package/test/test-col-ops.html +129 -129
  151. package/test/test-col-ops.js +337 -202
  152. package/test/test-col-widths.html +80 -80
  153. package/test/test-col-widths.js +40 -40
  154. package/test/test-cols-visibility-grid-layout.html +80 -80
  155. package/test/test-cols-visibility-grid-layout.js +165 -165
  156. package/test/test-cols-visibility.html +80 -80
  157. package/test/test-cols-visibility.js +121 -121
  158. package/test/test-custom-options.html +80 -80
  159. package/test/test-custom-options.js +139 -139
  160. package/test/test-data-types.html +377 -377
  161. package/test/test-data-types.js +392 -392
  162. package/test/test-date-type.html +356 -356
  163. package/test/test-date-type.js +159 -159
  164. package/test/test-disable-enter-key.html +77 -77
  165. package/test/test-disable-enter-key.js +29 -29
  166. package/test/test-disable-filter-onchange.html +77 -77
  167. package/test/test-disable-filter-onchange.js +40 -40
  168. package/test/test-dom-changes.html +77 -77
  169. package/test/test-dom-changes.js +166 -166
  170. package/test/test-dropdown.html +77 -77
  171. package/test/test-dropdown.js +246 -246
  172. package/test/test-emitter.html +77 -77
  173. package/test/test-emitter.js +57 -57
  174. package/test/test-empty-cells-filtering.html +8696 -8696
  175. package/test/test-empty-cells-filtering.js +45 -45
  176. package/test/test-exact-query-match.html +77 -77
  177. package/test/test-exact-query-match.js +56 -56
  178. package/test/test-excluded-rows.html +92 -92
  179. package/test/test-excluded-rows.js +129 -129
  180. package/test/test-external-filters.html +100 -100
  181. package/test/test-external-filters.js +219 -219
  182. package/test/test-filter-html-elements.html +88 -88
  183. package/test/test-filter-html-elements.js +63 -63
  184. package/test/test-filter-operators.html +80 -80
  185. package/test/test-filter-operators.js +264 -264
  186. package/test/test-filtering.html +53 -53
  187. package/test/test-filtering.js +293 -293
  188. package/test/test-filters-visibility-grid-layout.html +80 -80
  189. package/test/test-filters-visibility-grid-layout.js +50 -50
  190. package/test/test-filters-visibility-with-button.html +80 -80
  191. package/test/test-filters-visibility-with-button.js +48 -48
  192. package/test/test-filters-visibility.html +80 -80
  193. package/test/test-filters-visibility.js +48 -48
  194. package/test/test-grid-layout.html +7735 -7735
  195. package/test/test-grid-layout.js +39 -39
  196. package/test/test-grouped-headers.html +154 -154
  197. package/test/test-grouped-headers.js +107 -107
  198. package/test/test-hash.html +78 -78
  199. package/test/test-hash.js +88 -88
  200. package/test/test-help-responsive.html +78 -78
  201. package/test/test-help-responsive.js +70 -70
  202. package/test/test-help.html +77 -77
  203. package/test/test-help.js +217 -217
  204. package/test/test-highlight-keywords.html +77 -77
  205. package/test/test-highlight-keywords.js +94 -94
  206. package/test/test-ignore-diacritics.html +67 -57
  207. package/test/test-ignore-diacritics.js +117 -90
  208. package/test/test-integration-paging-sort.html +79 -79
  209. package/test/test-integration-paging-sort.js +60 -60
  210. package/test/test-linked-filters-disabled-options-grid-layout.html +80 -80
  211. package/test/test-linked-filters-disabled-options-grid-layout.js +73 -73
  212. package/test/test-linked-filters-grid-layout.html +80 -80
  213. package/test/test-linked-filters-grid-layout.js +72 -72
  214. package/test/test-linked-filters-load-filters-on-demand.html +80 -80
  215. package/test/test-linked-filters-load-filters-on-demand.js +99 -99
  216. package/test/test-linked-filters-paging.html +80 -80
  217. package/test/test-linked-filters-paging.js +99 -99
  218. package/test/test-linked-filters.html +80 -80
  219. package/test/test-linked-filters.js +138 -138
  220. package/test/test-load-filters-on-demand.html +77 -77
  221. package/test/test-load-filters-on-demand.js +124 -124
  222. package/test/test-loader.html +79 -79
  223. package/test/test-loader.js +159 -159
  224. package/test/test-no-config.html +80 -80
  225. package/test/test-no-config.js +63 -63
  226. package/test/test-no-filters.html +80 -80
  227. package/test/test-no-filters.js +172 -172
  228. package/test/test-no-headers.html +71 -71
  229. package/test/test-no-headers.js +99 -99
  230. package/test/test-no-results-message.html +262 -262
  231. package/test/test-no-results-message.js +222 -222
  232. package/test/test-no-rows.html +19 -19
  233. package/test/test-no-rows.js +10 -10
  234. package/test/test-one-row.html +29 -29
  235. package/test/test-one-row.js +18 -18
  236. package/test/test-paging.html +78 -78
  237. package/test/test-paging.js +273 -273
  238. package/test/test-popup-filter-one-row.html +38 -38
  239. package/test/test-popup-filter-one-row.js +138 -138
  240. package/test/test-popup-filter.html +78 -78
  241. package/test/test-popup-filter.js +384 -384
  242. package/test/test-popup-filters-grouped-headers.html +104 -104
  243. package/test/test-popup-filters-grouped-headers.js +206 -206
  244. package/test/test-rows-counter.html +77 -77
  245. package/test/test-rows-counter.js +112 -112
  246. package/test/test-single-filter.html +78 -78
  247. package/test/test-single-filter.js +138 -138
  248. package/test/test-sort-custom-sorter.html +243 -243
  249. package/test/test-sort-custom-sorter.js +74 -74
  250. package/test/test-sort-grid-layout.html +142 -142
  251. package/test/test-sort-grid-layout.js +86 -86
  252. package/test/test-sort-key.html +243 -243
  253. package/test/test-sort-key.js +67 -67
  254. package/test/test-sort.html +142 -142
  255. package/test/test-sort.js +126 -126
  256. package/test/test-state.html +78 -78
  257. package/test/test-state.js +369 -369
  258. package/test/test-status-bar.html +79 -79
  259. package/test/test-status-bar.js +146 -146
  260. package/test/test-storage-cookie.html +78 -78
  261. package/test/test-storage-cookie.js +82 -82
  262. package/test/test-storage-local.html +78 -78
  263. package/test/test-storage-local.js +82 -82
  264. package/test/test-tfoot.html +96 -96
  265. package/test/test-tfoot.js +123 -123
  266. package/test/test-thead.html +80 -80
  267. package/test/test-thead.js +69 -69
  268. package/test/test-toolbar.html +81 -81
  269. package/test/test-toolbar.js +218 -218
  270. package/test/test-uneven-rows.html +95 -95
  271. package/test/test-uneven-rows.js +61 -61
  272. package/test/test-watermark.html +80 -80
  273. package/test/test-watermark.js +103 -103
  274. package/test/test.html +141 -141
  275. package/test/test.js +162 -162
  276. package/webpack.config.js +87 -87
  277. package/webpack.dev.config.js +25 -25
  278. package/webpack.test.config.js +44 -44
  279. package/.travis.yml +0 -53
  280. package/dist/tablefilter/tf-1-2aa33b10e0e549020c12.js +0 -1
@@ -0,0 +1,516 @@
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` &rarr; `filters-row-inserted` &rarr; `after-filter-init` &rarr; `initialized` &rarr; `before-filtering` &rarr; `cell-processed` &rarr; `row-processed` &rarr; `row-validated` &rarr; `after-filtering` &rarr; `before-clearing-filters` &rarr; `after-clearing-filters` &rarr; `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 &ge; 4.5:1.
342
+ - Active filter indicators & borders &ge; 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
+ 1. **CSS Custom Properties**:
460
+ - Define token system:
461
+ ```css
462
+ :host, table-filter {
463
+ --tf-primary: #0969da;
464
+ --tf-primary-hover: #085fc4;
465
+ --tf-bg: #ffffff;
466
+ --tf-text: #24292f;
467
+ --tf-border: #d0d7de;
468
+ --tf-focus-ring: #0969da;
469
+ --tf-row-alt: #f6f8fa;
470
+ --tf-active-col: #ddf4ff;
471
+ }
472
+ ```
473
+ 2. **CSS Shadow Parts**:
474
+ - Expose `::part(toolbar)`, `::part(filter-input)`, `::part(pager)`, `::part(status)` for custom styling.
475
+ 3. **Theme Ports**:
476
+ - Port legacy themes (`default`, `mytheme`, `skyblue`, `transparent`) to clean CSS files setting the custom properties.
477
+ - Replace raster `.gif`/`.png` icons with crisp, theme-aware inline SVGs.
478
+
479
+ ### Phase 6: Extensions Porting & Backward Compatibility Verification
480
+ 1. **Extension Modernization**:
481
+ - `sort`: Seamlessly integrate with native `aria-sort` column headers.
482
+ - `colsVisibility`: Accessible popover modal with checkboxes and `aria-controls`.
483
+ - `filtersVisibility`: Accessible toggle button with `aria-expanded`.
484
+ - `colOps`: Native calculation updates with `aria-live="polite"`.
485
+ - `advancedGrid`: Accessible APG Data Grid mode (`role="grid"`).
486
+ 2. **Automated Verification**:
487
+ - Execute the complete 739 QUnit test suite against both the imperative API and declarative Web Components.
488
+ - Execute Axe-core automated tests across all 50+ demo fixtures with zero accessibility violations.
489
+ 3. **Documentation & Release Preparation**:
490
+ - Update documentation site with Web Component examples and migration guide.
491
+ - Maintain existing comprehensive JSDoc comments across all modules.
492
+
493
+ ---
494
+
495
+ ## 6. Migration Guide & Deprecation Strategy
496
+
497
+ ### Non-Breaking Changes (Zero Code Changes Required)
498
+ - Existing HTML with `<script src="tablefilter.js"></script>` and `new TableFilter('#myTable', config)` continues to function identically.
499
+ - All configuration options (e.g. `col_types`, `paging`, `auto_filter`, `state`, etc.) are recognized and supported.
500
+ - All public methods (`tf.filter()`, `tf.getFilteredData()`) return identical data structures.
501
+
502
+ ### Backward Compatibility: `grid_layout` and `sticky_headers`
503
+ - **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`.
504
+
505
+ ### Deprecated Features & Recommended Upgrades
506
+ | Deprecated Feature | Modern Alternative in v1.0.0 | Migration Action |
507
+ | :--- | :--- | :--- |
508
+ | `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. |
509
+ | External raster GIFs (`btn_first_page.gif`) | Built-in accessible SVGs | Automatic; custom image paths remain supported via props. |
510
+ | Non-semantic `<span>` paging buttons | Semantic `<button>` elements with ARIA | Automatic upgrade; custom HTML templates supported. |
511
+
512
+ ---
513
+
514
+ ## 7. Conclusion & Next Steps
515
+
516
+ 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.