tablefilter 0.7.4 → 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.
Files changed (75) hide show
  1. package/.gitattributes +16 -0
  2. package/.github/workflows/build-deploy.yml +30 -2
  3. package/.github/workflows/opencode-review.yml +104 -0
  4. package/.github/workflows/opencode.yml +34 -0
  5. package/ROADMAP/README.md +6 -1
  6. package/ROADMAP/content-projection-parity.md +162 -0
  7. package/ROADMAP/hybrid-migration-strategy.md +48 -7
  8. package/ROADMAP/key-decisions-review.md +5 -3
  9. package/ROADMAP/preliminary-and-milestone-0.8.0-plan.md +11 -12
  10. package/ROADMAP/v1-webcomponents-investigation.md +6 -1
  11. package/dist/starter.html +2 -2
  12. package/dist/tablefilter/style/colsVisibility.css +1 -1
  13. package/dist/tablefilter/style/filtersVisibility.css +1 -1
  14. package/dist/tablefilter/style/tablefilter.css +1 -1
  15. package/dist/tablefilter/style/themes/default/default.css +1 -1
  16. package/dist/tablefilter/style/themes/mytheme/mytheme.css +1 -1
  17. package/dist/tablefilter/style/themes/skyblue/skyblue.css +1 -1
  18. package/dist/tablefilter/style/themes/transparent/transparent.css +1 -1
  19. package/dist/tablefilter/tablefilter.js +1 -1
  20. package/dist/tablefilter/tablefilter.vite.js +4 -0
  21. package/dist/tablefilter/tf-1-a5c3a73bd559e47dd5a2.js +1 -0
  22. package/dist/tablefilter/tf-2-3a936d22b849361acff5.js +6 -0
  23. package/dist/tablefilter.cjs.js +4 -0
  24. package/dist/tablefilter.esm.js +7278 -0
  25. package/dist/tablefilter.umd.js +4 -0
  26. package/package.json +12 -5
  27. package/playwright.config.js +25 -0
  28. package/scripts/check-css-tokens.js +65 -0
  29. package/src/components/table-filter.js +243 -0
  30. package/src/components/tf-clear-button.js +95 -0
  31. package/src/components/tf-rows-counter.js +82 -0
  32. package/src/components/tf-status.js +106 -0
  33. package/src/modules/clearButton.js +65 -11
  34. package/src/modules/rowsCounter.js +48 -25
  35. package/src/modules/statusBar.js +62 -30
  36. package/src/sanitize.js +25 -0
  37. package/static/style/active-header.styl +2 -2
  38. package/static/style/alternating-rows.styl +2 -2
  39. package/static/style/config.styl +18 -18
  40. package/static/style/custom-properties.styl +43 -0
  41. package/static/style/ezedittable.styl +12 -12
  42. package/static/style/filter-checklist.styl +3 -3
  43. package/static/style/filters.styl +8 -8
  44. package/static/style/grid-layout.styl +9 -9
  45. package/static/style/help.styl +9 -9
  46. package/static/style/keyword.styl +1 -1
  47. package/static/style/loader.styl +3 -3
  48. package/static/style/noresults.styl +1 -1
  49. package/static/style/paging.styl +1 -1
  50. package/static/style/rows-counter.styl +1 -1
  51. package/static/style/status-bar.styl +1 -4
  52. package/static/style/tablefilter.styl +1 -0
  53. package/static/style/themes/skyblue/skyblue.styl +2 -2
  54. package/static/style/themes/transparent/transparent.styl +2 -2
  55. package/static/style/toolbar.styl +1 -1
  56. package/static/templates/table-filter.html +40 -0
  57. package/test/playwright/axe.baseline.spec.js +34 -0
  58. package/test/playwright/axe.statusbar.spec.js +35 -0
  59. package/test/playwright/axeScan.js +42 -0
  60. package/test/playwright/ce-bridge.spec.js +167 -0
  61. package/test/playwright/qunit.all.spec.js +10 -0
  62. package/test/playwright/qunit.single.spec.js +14 -0
  63. package/test/playwright/qunitSuite.js +56 -0
  64. package/test/playwright/table-filter.config.spec.js +265 -0
  65. package/test/playwright/table-filter.demo.spec.js +60 -0
  66. package/test/playwright/table-filter.element.spec.js +477 -0
  67. package/test/playwright/tf-clear-button.spec.js +135 -0
  68. package/test/playwright/tf-rows-counter.spec.js +172 -0
  69. package/test/playwright/tf-status.spec.js +258 -0
  70. package/test/test-clear-button.js +1 -0
  71. package/test/test-rows-counter.js +2 -0
  72. package/test/test-status-bar.js +3 -0
  73. package/vite.config.js +71 -0
  74. package/webpack.config.js +12 -0
  75. package/dist/tablefilter/tf-1-d2360db09a424b1ed633.js +0 -1
package/.gitattributes ADDED
@@ -0,0 +1,16 @@
1
+ # Normalise line endings: LF in the repository and in working trees.
2
+ # Working on Windows via /mnt/c let CRLF slip into tracked files, which
3
+ # showed up as whole-file diffs with no content change.
4
+ * text=auto eol=lf
5
+
6
+ # Binary assets: never normalise, never diff as text.
7
+ *.png binary
8
+ *.jpg binary
9
+ *.jpeg binary
10
+ *.gif binary
11
+ *.ico binary
12
+ *.bmp binary
13
+ *.woff binary
14
+ *.woff2 binary
15
+ *.ttf binary
16
+ *.eot binary
@@ -31,12 +31,23 @@ jobs:
31
31
  - name: Install dependencies
32
32
  run: npm install --no-audit --no-fund
33
33
 
34
+ - name: Check CSS token fallbacks
35
+ run: npm run lint:css-tokens
36
+
34
37
  - uses: actions/setup-node@v4
35
38
  with:
36
39
  node-version: 8.9.4
37
40
 
38
- - name: Test
39
- run: npm test
41
+ # Legacy PhantomJS gate retired: it lacks Intl, so qunit:all can
42
+ # no longer validate the suites. This keeps its eslint +
43
+ # webpack + CSS signal; Playwright runs the suites below.
44
+ - name: Build test bundles
45
+ run: npx grunt build-test
46
+
47
+ # Demos are build output (gitignored); the axe baseline spec
48
+ # scans demos/demo.html, so build them before Playwright runs.
49
+ - name: Build demo pages
50
+ run: npx grunt build-demos
40
51
 
41
52
  - name: Upload coverage
42
53
  run: npm run codecov
@@ -45,11 +56,28 @@ jobs:
45
56
  with:
46
57
  node-version: 24
47
58
 
59
+ - name: Install Playwright browsers
60
+ run: npx playwright install --with-deps chromium
61
+
62
+ - name: Playwright QUnit suites
63
+ run: npm run test:playwright
64
+
48
65
  - name: Build deployment files
49
66
  run: npm run build:all
50
67
  env:
51
68
  NODE_OPTIONS: --openssl-legacy-provider
52
69
 
70
+ # After the webpack build: its CleanWebpackPlugin wipes dist/, so the
71
+ # Vite outputs (esm/cjs/umd + staged legacy copy) would not survive
72
+ # otherwise.
73
+ - name: Build Vite bundles
74
+ run: npm run build:vite
75
+
76
+ # Guard: the published legacy bundle must stay the webpack flat-global
77
+ # build until #965 migrates consumers to the Vite namespace.
78
+ - name: Check legacy bundle is the webpack build
79
+ run: grep -q webpackUniversalModuleDefinition dist/tablefilter/tablefilter.js
80
+
53
81
  - name: Upload deployment files
54
82
  if: github.event_name == 'push' && github.ref == 'refs/heads/master'
55
83
  uses: actions/upload-artifact@v4
@@ -0,0 +1,104 @@
1
+ name: opencode-review
2
+
3
+ # Automatic pull-request review. Runs the opencode CLI directly (v2 CI mode)
4
+ # instead of the anomalyco/opencode action: the action refuses runs triggered
5
+ # by app bots, while the CLI path has no actor gate, so bot-created PRs get
6
+ # reviewed too. The review is posted as github-actions[bot]. Same secret and
7
+ # model as opencode.yml.
8
+ on:
9
+ pull_request:
10
+ # When the PR first appears or becomes ready — not on every push. Later
11
+ # pushes are covered by the local agent's own checks, and re-reviewing
12
+ # each one stacks duplicate comments.
13
+ types: [opened, reopened, ready_for_review]
14
+ # Manual re-run for a failed review (no close/reopen dance required).
15
+ workflow_dispatch:
16
+ inputs:
17
+ pr:
18
+ description: 'PR number to review'
19
+ required: true
20
+
21
+ # One review per PR: a reopen cancels a superseded run instead of stacking
22
+ # duplicate reviews. Manual dispatches carry their PR in inputs (no
23
+ # pull_request context), so fall back to it to keep groups distinct.
24
+ concurrency:
25
+ group: opencode-review-${{ github.event.pull_request.number || github.event.inputs.pr }}
26
+ cancel-in-progress: true
27
+
28
+ jobs:
29
+ review:
30
+ # Drafts are skipped (ready_for_review picks them up when marked ready).
31
+ # Fork PRs are skipped too: secrets are not passed to the runner and
32
+ # GITHUB_TOKEN is forced read-only for them, so the review would only fail.
33
+ # Dependabot PRs are skipped: they run with a read-only token, so the
34
+ # comment step could never post. Manual dispatches always run (the clicker
35
+ # chose the PR explicitly).
36
+ if: >-
37
+ github.actor != 'dependabot[bot]' &&
38
+ (github.event_name == 'workflow_dispatch' ||
39
+ (github.event.pull_request.draft == false &&
40
+ github.event.pull_request.head.repo.full_name == github.repository))
41
+ runs-on: ubuntu-latest
42
+ # Reviews take ~10 minutes; bound a hung agent run instead of holding the
43
+ # concurrency group until the 6-hour default.
44
+ timeout-minutes: 30
45
+ permissions:
46
+ # Read-only on purpose: the reviewer must not commit. The local agent
47
+ # already pushed its edits, and a review-time push would fork history.
48
+ contents: read
49
+ pull-requests: write
50
+ issues: write
51
+ steps:
52
+ - name: Checkout repository
53
+ # Skipped on manual dispatch: the next step checks out the PR head.
54
+ if: github.event_name != 'workflow_dispatch'
55
+ uses: actions/checkout@v6
56
+ with:
57
+ persist-credentials: false
58
+
59
+ - name: Checkout PR head (manual dispatch only)
60
+ if: github.event_name == 'workflow_dispatch'
61
+ uses: actions/checkout@v6
62
+ with:
63
+ persist-credentials: false
64
+ ref: ${{ format('refs/pull/{0}/head', github.event.inputs.pr) }}
65
+
66
+ - name: Review with opencode CLI
67
+ env:
68
+ OPENCODE_API_KEY: ${{ secrets.OPENCODE_API_KEY }}
69
+ GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
70
+ PR_NUMBER: ${{ github.event.pull_request.number || github.event.inputs.pr }}
71
+ run: |
72
+ # The CLI prints the reply on stdout and its progress/errors on
73
+ # stderr, so the redirect alone is the comment body; a non-zero exit
74
+ # fails the step and trips "Report review failure" below.
75
+ npm install --global @opencode/cli@2.0.30
76
+ opencode run --standalone --model opencode/big-pickle \
77
+ "Review PR $PR_NUMBER in ${{ github.repository }}. Get the change
78
+ with 'gh pr diff $PR_NUMBER --repo ${{ github.repository }}'
79
+ (GH_TOKEN is set) and review the diff itself; do not run tests.
80
+ Start with a title: 'Review — Verdict: Approve / Changes requested
81
+ / Flagged'. Be thorough - check the diff rather than trusting its
82
+ description - and apply the conventions in AGENTS.md. Flag dead
83
+ code or debug output left in the diff. Write only the findings,
84
+ each with file:line and a concrete fix. Skip the narration, the
85
+ restating and the thinking out loud. Keep it concise and focused;
86
+ one line is enough when it is sound." > /tmp/review.md
87
+ # Ceiling on a runaway reply: thorough is fine, unbounded is not.
88
+ head -c 20000 /tmp/review.md > /tmp/review.capped.md &&
89
+ mv /tmp/review.capped.md /tmp/review.md
90
+ # An empty reply would make the comment step fail obscurely.
91
+ [ -s /tmp/review.md ] || { echo "review empty: no stdout" >&2; exit 1; }
92
+ gh pr comment "$PR_NUMBER" \
93
+ --repo "${{ github.repository }}" --body-file /tmp/review.md
94
+
95
+ - name: Report review failure
96
+ # A silent failure is a missing review with no visible cause; link
97
+ # the failed run instead.
98
+ if: failure()
99
+ env:
100
+ GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
101
+ PR_NUMBER: ${{ github.event.pull_request.number || github.event.inputs.pr }}
102
+ run: |
103
+ gh pr comment "$PR_NUMBER" --repo "${{ github.repository }}" \
104
+ --body "Automated review failed: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"
@@ -0,0 +1,34 @@
1
+ name: opencode
2
+
3
+ on:
4
+ issue_comment:
5
+ types: [created]
6
+ pull_request_review_comment:
7
+ types: [created]
8
+
9
+ jobs:
10
+ opencode:
11
+ if: |
12
+ contains(github.event.comment.body, ' /oc') ||
13
+ startsWith(github.event.comment.body, '/oc') ||
14
+ contains(github.event.comment.body, ' /opencode') ||
15
+ startsWith(github.event.comment.body, '/opencode')
16
+ runs-on: ubuntu-latest
17
+ permissions:
18
+ id-token: write
19
+ contents: read
20
+ pull-requests: read
21
+ issues: read
22
+ steps:
23
+ - name: Checkout repository
24
+ uses: actions/checkout@v6
25
+ with:
26
+ persist-credentials: false
27
+
28
+ - name: Run opencode
29
+ uses: anomalyco/opencode/github@latest
30
+ env:
31
+ OPENCODE_API_KEY: ${{ secrets.OPENCODE_API_KEY }}
32
+ with:
33
+ model: opencode/big-pickle
34
+ agent: plan
package/ROADMAP/README.md CHANGED
@@ -19,7 +19,7 @@ This directory contains the complete technical specification, architectural inve
19
19
 
20
20
  3. [**Key Architectural Decisions Review**](./key-decisions-review.md)
21
21
  - In-depth evaluation of the three preliminary decisions:
22
- - **Build Tooling Migration**: Vite multi-bundle output (ESM, CJS, UMD) and CSS Custom Properties.
22
+ - **Build Tooling Migration**: Vite multi-bundle output (ESM, CJS, UMD) and CSS Custom Properties. Keeps every class name and the core stylesheet/theme loader + class options (tracked by [#993](https://github.com/koalyptus/TableFilter/issues/993)); tokens and `::part()` are additive. Token/theme *modernization* is deferred to the "Styling modernization (post-1.0)" milestone, after the v1.0.0 launch.
23
23
  - **Dependency Rationalization**: Native browser replacements for `diacritics` and `format-number`.
24
24
  - **Test Runner Modernization**: Playwright headless execution of all 74 QUnit test suites with integrated Axe-Core audits.
25
25
 
@@ -27,3 +27,8 @@ This directory contains the complete technical specification, architectural inve
27
27
  - Step-by-step technical blueprints for preliminary tooling and dependency rationalization.
28
28
  - Implementation specification for Milestone 0.8.0 components (`<table-filter>` and `<tf-status>`).
29
29
  - Concrete execution task checklist with verification gates.
30
+
31
+ 5. [**Content Projection Parity (custom HTML / slotted content)**](./content-projection-parity.md)
32
+ - Inventory of every legacy `innerHTML` config option (`btn_reset.html`, `loader.html`, `help_instructions.*`, `no_results_message.content`, pager button HTML, extension button HTML, colOps `write_method`).
33
+ - One mechanism for all: default `<slot>` + `part`s, with per-option mapping rules.
34
+ - Per-milestone execution plan and the `<tf-status>` HTML-message regression. Owned by [#1012](https://github.com/koalyptus/TableFilter/issues/1012).
@@ -0,0 +1,162 @@
1
+ # Content Projection Parity (custom HTML / slotted content)
2
+
3
+ **Status:** proposed — owned by [#1012](https://github.com/koalyptus/TableFilter/issues/1012).
4
+ **Scope:** every feature that lets a consumer inject markup through config.
5
+
6
+ ## 1. Why this exists
7
+
8
+ Legacy TableFilter lets consumers inject markup through many config options,
9
+ which are written to the DOM with `innerHTML`. The v1.0.0 migration promises
10
+ 100% configuration/API parity
11
+ ([v1-webcomponents-investigation.md](./v1-webcomponents-investigation.md) §2.4,
12
+ [hybrid-migration-strategy.md](./hybrid-migration-strategy.md)), so every one of
13
+ these options must keep working — or the change must be an explicit, documented
14
+ migration note ([#947](https://github.com/koalyptus/TableFilter/issues/947)).
15
+
16
+ Left ad hoc, each bridge would invent its own escape hatch. This document fixes
17
+ one mechanism and one set of rules for all of them.
18
+
19
+ ## 2. Inventory (legacy `innerHTML` injection)
20
+
21
+ | # | Feature | Config key(s) | Property | Injected at | Target element | Milestone |
22
+ |---|---------|---------------|----------|-------------|----------------|-----------|
23
+ | 1 | ClearButton | `btn_reset.html` (default `<input class="reset">`) | `this.html` | `clearButton.js:113` | `<tf-clear-button>` | 0.8.0 |
24
+ | 2 | StatusBar | `status_bar.text`, `msg_*` | `this.text`, `this.msg*` | `statusBar.js:278` | `<tf-status>` | 0.8.0 |
25
+ | 3 | RowsCounter | generated count text | `this.label` | `rowsCounter.js:193` | `<tf-rows-counter>` | 0.8.0 |
26
+ | 4 | Loader | `loader.html` | `this.html` | `loader.js:125` | `<tf-loader>` | 0.8.x |
27
+ | 5 | Help | `help_instructions.html`, `.text`, `.btn_html`, `.btn_text` | `this.instrHtml`, `this.instrText`, `this.btnHtml`, `this.btnText` | `help.js:181,188,194,199` | `<tf-help>` | 0.8.x |
28
+ | 6 | NoResults | `no_results_message.content` ("accepts HTML") | `this.content` | `noResults.js:102` | `<tf-no-results>` | 0.8.x |
29
+ | 7 | PopupFilter | `popup_filters.image_html` | `this.iconHtml` | `popupFilter.js:256` | `<tf-popup-filter>` | 0.8.x |
30
+ | 8 | Paging | `btn_{next,prev,first,last}_page_html` | `this.btn*PageHtml` | `paging.js:400,414,428,442` | `<tf-pager>` | 0.9.0 |
31
+ | 9 | filtersVisibility | `btn_text`, `btn_html` (+ computed collapse/expand) | `this.btn*Html`, `this.btnText` | `filtersVisibility.js:234,237` | extension | post-1.0 |
32
+ | 10 | colsVisibility | `btn_text` (`'Columns&#9660;'`), `btn_html`, `btn_close_text`, `btn_close_html`, `text` | `this.btn*Html`, `this.btn*Text`, `this.text` | `colsVisibility.js:429,437,465,524,528` | extension | post-1.0 |
33
+ | 11 | colOps | `write_method: 'innerHTML'` | `this.outputTypes` | `colOps.js:425` | light-DOM cells | n/a |
34
+
35
+ Two properties of this table drive the plan:
36
+
37
+ - Some **`*_text`** defaults already carry markup or entities
38
+ (`colsVisibility.btn_text = 'Columns&#9660;'`; the **default
39
+ `help_instructions.text` is a block of HTML**). "Text" was never really text.
40
+ - Some **`*_html`** defaults are themselves *interactive controls*
41
+ (`<input class="reset">` for ClearButton; `<input>` pager buttons).
42
+
43
+ ## 3. Decision
44
+
45
+ **Custom content is DOM projected into a slot — not policy-free HTML string
46
+ props.** Every migrated component exposes:
47
+
48
+ - a **default `<slot>`** for consumer-supplied content, and
49
+ - **`part`** hooks for nodes the component generates itself.
50
+
51
+ The bridge maps legacy options onto that surface with these rules.
52
+
53
+ | Rule | Applies to | Behaviour |
54
+ |------|-----------|-----------|
55
+ | **P1 Slot-first** | all components | One mechanism: default slot + `part`s. No bespoke `innerHTML` API per component. |
56
+ | **P2 `*_html` → light DOM** | `btn_reset.html`, `loader.html`, `help_instructions.html`, `btn_html`, `image_html`, `btn_*_page_html` | Bridge sets `host.innerHTML = cfg` (sanitised per P7); the slot renders it. Keeps integrator CSS classes working (content stays in light DOM). |
57
+ | **P3 `*_text` → text** | `*_text`, `text`, `content`, `msg_*` | Rendered with `textContent`. Legacy defaults that embed markup/entities are split into plain text + a `*_html` path (fix the default, not the consumer). |
58
+ | **P4 No wrapper (route 2)** | button components (ClearButton, Help widget, Paging, filtersVisibility, colsVisibility) | The element renders the bare `<slot>`; a slotted control is the control; the host adds button semantics only for element-rendered content. No nested controls. |
59
+ | **P5 Messages preserve HTML** | StatusBar, NoResults | The message node renders configured values as HTML (`innerHTML`), matching legacy `statusBar` (`msgContainer.innerHTML = t`). The label/`text` stays text (legacy used a text node). No silent escaping. |
60
+ | **P6 Extensions off-shadow** | colOps, gridLayout | Content written into the light-DOM table is unaffected by Shadow DOM; keep as-is. |
61
+ | **P7 Sanitised boundary** | all | Config HTML is integrator-authored but always passed through `sanitizeHtml()` (DOMPurify) before `innerHTML`: ordinary markup is preserved, scripts / event handlers / `javascript:` URLs are stripped. The one shared helper is the trust boundary. |
62
+
63
+ ### P4 in practice — route 2 (no wrapper)
64
+
65
+ The element template is `<button part="button"><slot></slot></button>`, so a
66
+ slotted `btn_reset.html` becomes a control inside a control
67
+ (`<button><input type="button" class="reset"></button>` — invalid, two
68
+ activatable elements). Legacy had no wrapper: the `<input class="reset">` /
69
+ `<a class="reset">` was the control.
70
+
71
+ **Chosen route: 2 (no wrapper).** The element renders the bare `<slot>` and
72
+ never wraps consumer content in a `<button>`. The contract:
73
+
74
+ - **Consumer content** (`*_html`, or declarative light DOM) is projected
75
+ verbatim and owns its semantics. For `btn_reset.html` the `<input
76
+ class="reset">` / `<a class="reset">` stays the control. The host adds **no**
77
+ `role="button"`/`tabindex` (no double control) but still listens for the
78
+ bubbling `click` to fire the feature action.
79
+ - **No consumer content**: the element renders its own control *and only then*
80
+ exposes button semantics (`role="button"`, `tabindex="0"`, Enter/Space),
81
+ themed via `::part(button)`.
82
+
83
+ Consequences:
84
+
85
+ - `btn_reset.html` works verbatim, including the default `<input class="reset">`
86
+ icon, so the theme's `input.reset` (`static/style/reset-button.styl`) keeps
87
+ painting it. The interim `!this.html` icon-mode fallback to the legacy path
88
+ can then be dropped.
89
+ - `<tf-clear-button>` must change: remove the wrapper `<button>` and stop
90
+ `_update()` setting `button.textContent` (today that deletes the `<slot>`, so
91
+ slotted content is never projected).
92
+ - Pager / filtersVisibility / colsVisibility / Help widget adopt the same
93
+ shape: bare slot; host semantics only for element-rendered content.
94
+
95
+ Trade-off accepted: for consumer-supplied controls the element is a wrapper,
96
+ not a single `<button>`.
97
+
98
+ ## 4. Resolved regression: `<tf-status>` HTML messages
99
+
100
+ The merged `<tf-status>` bridge renders messages with `textContent`
101
+ (`src/components/tf-status.js`), while legacy `statusBar` used `innerHTML`
102
+ (`statusBar.js:278`). Consumers who put markup in `status_bar.text` / `msg_*`
103
+ now see escaped text.
104
+
105
+ **Decision (parity wins): fix.** Render the `message` part with `innerHTML`
106
+ from the `message` attribute, i.e. `this._msgEl.innerHTML = ...`, with the
107
+ markup passed through `sanitizeHtml()` first (P7). The `label` part stays
108
+ `textContent` — legacy also used a text node for `text`
109
+ (`statusBar.js` `labelSpan.appendChild(createText(this.text))`), so it is
110
+ already correct. Implemented in
111
+ [#1014](https://github.com/koalyptus/TableFilter/issues/1014), with
112
+ HTML-message and sanitiser tests.
113
+
114
+ ## 5. Per-milestone execution
115
+
116
+ ### 0.8.0 (parity of the shipped leaf components)
117
+ - [x] `<tf-status>`: render the message part as sanitised HTML (§4, decided); keep the label as text ([#1014](https://github.com/koalyptus/TableFilter/issues/1014)).
118
+ - [ ] `<tf-clear-button>`: rework to route 2 (§3) — remove the wrapper
119
+ `<button>`, keep the `<slot>`, stop `_update()` deleting it, and add host
120
+ semantics only for element-rendered content. Then drop the `!this.html`
121
+ icon-mode fallback.
122
+ - [ ] `<tf-rows-counter>`: no consumer markup; confirm label is text-only.
123
+
124
+ ### 0.8.x
125
+ - [ ] Route every `*_html` injection below through `sanitizeHtml()` (P7).
126
+ - [ ] `<tf-loader>`: `loader.html` → slot (P2); text fallback (P3).
127
+ - [ ] `<tf-help>`: instructions (`html`/`text`) + button (`btn_html`/`btn_text`) → slot(s); fix the HTML default (inventory row 5).
128
+ - [ ] `<tf-no-results>`: `content` → slot or part; decide text vs HTML for the default message.
129
+ - [ ] `<tf-popup-filter>`: `image_html` → slotted icon (P2); the icon element owns its semantics (P4 route 2).
130
+
131
+ ### 0.9.0
132
+ - [ ] `<tf-pager>`: `btn_*_page_html` → slotted button content (P2/P4 route 2); `btn_*_page_text` → text (P3).
133
+
134
+ ### post-1.0 (extensions)
135
+ - [ ] filtersVisibility / colsVisibility: `*_html` → slots, `*_text` → text; fix entity defaults.
136
+ - [ ] colOps: unaffected (P6).
137
+
138
+ ## 6. Alternatives considered
139
+
140
+ - **Keep `innerHTML` string props on every component.** Rejected: duplicates the
141
+ legacy problem, no declarative story, and breaks the "structure/hooks only"
142
+ rule the components already follow.
143
+ - **Render everything as `textContent`.** Rejected: silently breaks documented
144
+ HTML config (Help default text, Loader, NoResults, Pager buttons).
145
+ - **No sanitiser.** Rejected (review on
146
+ [#1014](https://github.com/koalyptus/TableFilter/issues/1014)): raw
147
+ `innerHTML` of config
148
+ markup is an XSS sink waiting for one accidental untrusted value. Instead
149
+ every injection goes through `sanitizeHtml()` (`src/sanitize.js`,
150
+ **DOMPurify**), the project's first runtime dependency — an accepted
151
+ trade-off, since a small, audited sanitiser beats a bespoke one. It is a
152
+ boundary, not a behaviour change for benign config.
153
+
154
+ ## 7. Verification
155
+
156
+ Each component bridge that handles a `*_html`/`*_text` option adds a Playwright
157
+ test asserting (a) the configured content renders through the slot/part,
158
+ (b) it is not dropped, and (c) for `*_html`, dangerous markup is stripped by
159
+ `sanitizeHtml()` (see the `tf-status` sanitiser test in
160
+ [#1014](https://github.com/koalyptus/TableFilter/issues/1014)). The icon-mode
161
+ case in the bridge suite `test/playwright/ce-bridge.spec.js`
162
+ ([#1011](https://github.com/koalyptus/TableFilter/issues/1011)) is the template.
@@ -75,8 +75,24 @@ The hybrid architecture combines two complementary vectors:
75
75
  ### Concrete Example: Migrating `StatusBar` to `<tf-status>`
76
76
 
77
77
  #### Step 1: Define the Independent Custom Element (`src/components/tf-status.js`)
78
+ The element is **structure and behaviour only**: open shadow root, `part="label"` /
79
+ `part="message"`, and no class or `<style>` of its own. That keeps the element
80
+ free of an invented, non-themeable styling surface and lets the existing
81
+ stylesheet/theme system stay authoritative.
78
82
  ```javascript
83
+ const template = document.createElement('template');
84
+ template.innerHTML = `
85
+ <span part="label"></span>
86
+ <span part="message"></span>
87
+ `;
88
+
79
89
  export class TfStatus extends HTMLElement {
90
+ constructor() {
91
+ super();
92
+ this.attachShadow({ mode: 'open' });
93
+ this.shadowRoot.appendChild(template.content.cloneNode(true));
94
+ }
95
+
80
96
  static get observedAttributes() { return ['text', 'message']; }
81
97
 
82
98
  connectedCallback() {
@@ -88,14 +104,15 @@ export class TfStatus extends HTMLElement {
88
104
  }
89
105
 
90
106
  setMessage(msg) {
91
- this.message = msg;
92
- this.render();
107
+ this.setAttribute('message', msg == null ? '' : String(msg));
93
108
  }
94
109
 
95
110
  render() {
96
- const text = this.getAttribute('text') || '';
97
- const msg = this.message || this.getAttribute('message') || '';
98
- this.innerHTML = `<span class="tf-status-label">${text}</span><span class="tf-status-msg">${msg}</span>`;
111
+ // Themed via ::part(label) / ::part(message) and inherited --tf-* tokens
112
+ this.shadowRoot.querySelector('[part="label"]').textContent =
113
+ this.getAttribute('text') || '';
114
+ this.shadowRoot.querySelector('[part="message"]').textContent =
115
+ this.getAttribute('message') || '';
99
116
  }
100
117
  }
101
118
  customElements.define('tf-status', TfStatus);
@@ -115,7 +132,10 @@ export class StatusBar extends Feature {
115
132
  init() {
116
133
  if (this.initialized) return;
117
134
 
118
- // Create the native Web Component
135
+ // Create the native Web Component. The configurable class
136
+ // (status_bar.css_class, default 'status') goes on the host so the
137
+ // existing stylesheet/themes keep driving the look; the element
138
+ // itself stays class-free.
119
139
  const statusEl = document.createElement('tf-status');
120
140
  statusEl.className = this.f.css_class || 'status';
121
141
  if (this.f.text) statusEl.setAttribute('text', this.f.text);
@@ -152,6 +172,25 @@ export class StatusBar extends Feature {
152
172
  3. The DOM element now carries `role="status"` and `aria-live="polite"` automatically.
153
173
  4. If a consumer prefers to write `<tf-status>` manually in their markup, TableFilter can bind to it via `target_id`.
154
174
 
175
+ ### Bridge init convention (temporary, until #965 namespace migration)
176
+ Bridged features split `init()` into two focused methods so the legacy path is a
177
+ clean deletion boundary:
178
+
179
+ - `init()` resolves the target element, then delegates to `initCE(targetEl)` or
180
+ `initLegacy(targetEl)`.
181
+ - `initCE(targetEl)` builds only the custom-element DOM.
182
+ - `initLegacy(targetEl)` builds only the legacy DOM.
183
+ - `TODO(#965)` marks both the static import and the guard. When #965 lands,
184
+ `initLegacy()` (and the guard) are deleted wholesale and `init()` calls
185
+ `initCE()` directly. No scattered `if/else` blocks survive.
186
+
187
+ `destroy()` is *not* split. Teardown is identical on both paths — remove the
188
+ container created by `init()` — and `destroy()` already returns unless a
189
+ successful `init()` set that container, so there is nothing to branch on. A
190
+ `destroyCE()`/`destroyLegacy()` pair (and a flag to choose between them) would
191
+ just be two identical methods. The init split is where the divergence lives;
192
+ teardown needs no legacy-specific code to delete.
193
+
155
194
  ---
156
195
 
157
196
  ## 3. Module Migration Priority & Risk Matrix
@@ -176,9 +215,11 @@ A crucial challenge in hybrid Web Component systems is boundary traversal:
176
215
  - **Rule 1: Never place the table inside closed Shadow DOM during hybrid migration.**
177
216
  Legacy features and external extensions query table rows directly via `this.dom().rows[i]`. The table must remain in the **Light DOM** (projected through a `<slot>` into `<table-filter>`).
178
217
  - **Rule 2: Leaf UI components (`<tf-status>`, `<tf-rows-counter>`, `<tf-clear-button>`) can use Shadow DOM immediately.**
179
- Because TableFilter communicates with them via their JS element references (`this.statusEl.setMessage(...)`), their internal template can be fully encapsulated in Shadow DOM.
218
+ Because TableFilter communicates with them via their JS element references (`this.statusEl.setMessage(...)`), their internal template can be fully encapsulated in Shadow DOM. Their styling stays configurable: the configurable class (`status_bar.css_class` and friends) is applied to the **host**, internals are reached through `::part()`, and colours come from the inherited `--tf-*` tokens, so the class + stylesheet + theme system is never bypassed.
180
219
  - **Rule 3: Slotted header controls use Light DOM or CSS Shadow Parts.**
181
220
  Filter inputs inserted into the table header row (`fltrow`) must remain accessible to the table accessibility tree and standard DOM queries (`tf.getFilterElement(colIndex)`).
221
+ - **Rule 4: Preserve the core styling configuration.**
222
+ Styling config is not only per-feature: the engine (`src/tablefilter.js`) owns the stylesheet/theme loader (`base_path`, `style_path`, `stylesheet`, `themes`, `themes_path`, `enable_default_theme`) and 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`) plus the `TF` / `resp` / `sticky` table classes. All of these keep working unchanged; `--tf-*` tokens and `::part()` are additive. Porting them into `<table-filter>` is tracked by **#993**.
182
223
 
183
224
  ---
184
225
 
@@ -39,7 +39,8 @@
39
39
 
40
40
  ### 1.3 CSS Modernization Strategy
41
41
  - **Preserve CSS Selectors**: Keep all existing class names (`.flt`, `.fltsRow`, `.status`, `.pgSlc`, `.div_checklist`, `.rspg`) intact so third-party stylesheets continue working without changes.
42
- - **Introduce CSS Custom Properties (`--tf-*`)**:
42
+ - **Preserve the core styling configuration**: Styling is not only per-feature. The engine (`src/tablefilter.js`) owns the stylesheet/theme **loader** (`base_path`, `style_path`, `stylesheet`, `themes`, `themes_path`, `enable_default_theme`) and 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`) plus the `TF` / `resp` / `sticky` classes applied to the table. Per-feature classes live in the modules and extensions. All of these must keep working when the components take over; porting the loader and core keys into `<table-filter>` is tracked by **#993**.
43
+ - **Introduce CSS Custom Properties (`--tf-*`)** _(additive, not a replacement for the class + stylesheet + theme system)_:
43
44
  Replace hardcoded color definitions with CSS variables:
44
45
  ```css
45
46
  :root, table-filter {
@@ -53,14 +54,15 @@
53
54
  --tf-active-col: #ddf4ff;
54
55
  }
55
56
  ```
56
- - **Stylus Deprecation Path**:
57
+ **Status — additive and deferred.** The tokens are an inert scaffold introduced in #892: every use is `var(--tf-x, <previous value>)`, so rendering is unchanged and the theme stylesheets keep overriding exactly as before. The token *API* and its documentation (#945), the Stylus→CSS build (#944), SVG icons (#943) and dark mode / forced-colors (#969) are the **"Styling modernization (post-1.0)" milestone** — they run *after* the v1.0.0 parity launch, where modernization continues — not part of the parity milestone. Parity does not depend on them: shadow internals are themeable via the host class + `::part()` (custom properties are an ergonomic overlay for bulk/runtime/cross-boundary theming, and are colours only).
58
+ - **Stylus Deprecation Path** _(post-parity, see above)_:
57
59
  - Phase 1: Output standard CSS directly alongside the existing theme stylesheets (`default`, `mytheme`, `skyblue`, `transparent`).
58
60
  - Phase 2: Deprecate `.styl` files and retain pure modern CSS with native CSS variables and nesting.
59
61
 
60
62
  ### 1.4 Trade-offs & Edge Cases
61
63
  | Consideration | Risk | Resolution |
62
64
  | :--- | :--- | :--- |
63
- | **Legacy `base_path` option** | Existing consumers configure `base_path: 'dist/tablefilter/'` to load CSS and extensions dynamically. | Preserve `tf.basePath` resolution in the UMD bundle while allowing ESM consumers to import styles directly (`import 'tablefilter/style'`). |
65
+ | **Legacy `base_path` option** | Existing consumers configure `base_path: 'dist/tablefilter/'` to load CSS and extensions dynamically. | Preserve `tf.basePath` resolution in the UMD bundle while allowing ESM consumers to import styles directly (`import 'tablefilter/style'`). Note: the `style_path` / `stylesheet` / `themes_path` overrides are currently ignored (**#822**) and are restored as part of **#993**. |
64
66
  | **Extension Bundling** | Extensions (`sort`, `colOps`, etc.) are currently loaded via dynamic script tags. | Vite can output individual extension chunks (`dist/tablefilter/extensions/sort/sort.js`) matching the legacy file structure. |
65
67
 
66
68
  ---
@@ -79,8 +79,12 @@ export default defineConfig({
79
79
  ```
80
80
 
81
81
  ### Modern CSS & Custom Properties Transition
82
+
83
+ > **Sequencing:** the token/theme *modernization* below belongs to the **"Styling modernization (post-1.0)" milestone**, after the v1.0.0 parity launch (see key-decisions 1.3). The parity-critical part is preserving the class names and the core styling configuration — not the tokens.
84
+
82
85
  - Retain existing CSS class names (`.flt`, `.fltsRow`, `.status`, `.pgSlc`, `.div_checklist`) to guarantee that consumer styling does not break.
83
- - Modernize styles by substituting hardcoded colors with **CSS Custom Properties**:
86
+ - Preserve the **core** styling configuration, not just the per-feature classes: the stylesheet/theme loader (`base_path`, `style_path`, `stylesheet`, `themes`, `themes_path`, `enable_default_theme`) and 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`). Porting these into `<table-filter>` is tracked by **#993**.
87
+ - Modernize styles by substituting hardcoded colors with **CSS Custom Properties** (additive — the class/stylesheet/theme system stays authoritative):
84
88
  ```css
85
89
  :root, table-filter {
86
90
  --tf-primary: #0969da;
@@ -244,18 +248,13 @@ customElements.define('table-filter', TableFilterElement);
244
248
  ```
245
249
 
246
250
  ### Component 2: `<tf-status>` Component (`src/components/tf-status.js`)
247
- An accessible status message component encapsulating Open Shadow DOM with CSS parts:
251
+ An accessible status message component encapsulating Open Shadow DOM with `::part()` hooks. The element is **structure and behaviour only**: it ships no `<style>` and hardcodes no CSS class, so it does not invent a parallel styling surface. The configurable status class (`status_bar.css_class`, default `status`) is applied to the **host** by the bridge (see below), and the default look belongs to the stylesheet/themes as `.status` / `.status::part(label|message)`, with colours from the inherited `--tf-*` tokens. Porting the core stylesheet/theme loader and class options is tracked by **#993**.
248
252
 
249
253
  ```javascript
250
254
  const template = document.createElement('template');
251
255
  template.innerHTML = `
252
- <style>
253
- :host { display: inline-block; }
254
- .status-text { margin-right: 0.25rem; font-weight: normal; }
255
- .status-msg { font-weight: 600; color: var(--tf-status-color, inherit); }
256
- </style>
257
- <span class="status-text" part="label"></span>
258
- <span class="status-msg" part="message"></span>
256
+ <span part="label"></span>
257
+ <span part="message"></span>
259
258
  `;
260
259
 
261
260
  export class TfStatusElement extends HTMLElement {
@@ -263,8 +262,8 @@ export class TfStatusElement extends HTMLElement {
263
262
  super();
264
263
  this.attachShadow({ mode: 'open' });
265
264
  this.shadowRoot.appendChild(template.content.cloneNode(true));
266
- this._labelEl = this.shadowRoot.querySelector('.status-text');
267
- this._msgEl = this.shadowRoot.querySelector('.status-msg');
265
+ this._labelEl = this.shadowRoot.querySelector('[part="label"]');
266
+ this._msgEl = this.shadowRoot.querySelector('[part="message"]');
268
267
  }
269
268
 
270
269
  connectedCallback() {
@@ -278,7 +277,7 @@ export class TfStatusElement extends HTMLElement {
278
277
  attributeChangedCallback() { this._update(); }
279
278
 
280
279
  setMessage(msg) {
281
- this.setAttribute('message', msg || '');
280
+ this.setAttribute('message', msg == null ? '' : String(msg));
282
281
  }
283
282
 
284
283
  _update() {
@@ -456,6 +456,9 @@ flowchart TD
456
456
  - Implement `<dialog>` or `role="dialog"` for help popovers, column visibility dropdowns, and popup filters with focus trapping and `Esc` dismissal.
457
457
 
458
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
+
459
462
  1. **CSS Custom Properties**:
460
463
  - Define token system:
461
464
  ```css
@@ -471,10 +474,12 @@ flowchart TD
471
474
  }
472
475
  ```
473
476
  2. **CSS Shadow Parts**:
474
- - Expose `::part(toolbar)`, `::part(filter-input)`, `::part(pager)`, `::part(status)` for custom styling.
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.
475
478
  3. **Theme Ports**:
476
479
  - Port legacy themes (`default`, `mytheme`, `skyblue`, `transparent`) to clean CSS files setting the custom properties.
477
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**.
478
483
 
479
484
  ### Phase 6: Extensions Porting & Backward Compatibility Verification
480
485
  1. **Extension Modernization**:
package/dist/starter.html CHANGED
@@ -1,10 +1,10 @@
1
1
  <!DOCTYPE html>
2
2
  <html lang="en">
3
3
  <head>
4
- <title>tablefilter v0.7.4 - Starter</title>
4
+ <title>tablefilter v0.7.5 - Starter</title>
5
5
  </head>
6
6
  <body>
7
- <h1>tablefilter v0.7.4</h1>
7
+ <h1>tablefilter v0.7.5</h1>
8
8
 
9
9
 
10
10
 
@@ -1 +1 @@
1
- span.colVisSpan{text-align:left;}span.colVisSpan a.colVis{display:inline-block;padding:7px 5px 0;font-size:inherit;font-weight:inherit;vertical-align:top}div.colVisCont{position:relative;background:#fff;-webkit-box-shadow:3px 3px 2px #888;-moz-box-shadow:3px 3px 2px #888;box-shadow:3px 3px 2px #888;position:absolute;display:none;border:1px solid #ccc;height:auto;width:250px;background-color:#fff;margin:35px 0 0 -100px;z-index:10000;padding:10px 10px 10px 10px;text-align:left;font-size:inherit;}div.colVisCont:after,div.colVisCont:before{bottom:100%;left:50%;border:solid transparent;content:" ";height:0;width:0;position:absolute;pointer-events:none}div.colVisCont:after{border-color:rgba(255,255,255,0);border-bottom-color:#fff;border-width:10px;margin-left:-10px}div.colVisCont:before{border-color:rgba(255,255,255,0);border-bottom-color:#ccc;border-width:12px;margin-left:-12px}div.colVisCont p{margin:6px auto 6px auto}div.colVisCont a.colVis{display:initial;font-weight:inherit}ul.cols_checklist{padding:0;margin:0;list-style-type:none;}ul.cols_checklist label{display:block}ul.cols_checklist input{vertical-align:middle;margin:2px 5px 2px 1px}li.cols_checklist_item{padding:4px;margin:0;}li.cols_checklist_item:hover{background-color:#335ea8;color:#fff}.cols_checklist_slc_item{background-color:#335ea8;color:#fff}
1
+ span.colVisSpan{text-align:left}span.colVisSpan a.colVis{display:inline-block;padding:7px 5px 0;font-size:inherit;font-weight:inherit;vertical-align:top}div.colVisCont{position:relative;background:#fff;-webkit-box-shadow:3px 3px 2px #888;-moz-box-shadow:3px 3px 2px #888;box-shadow:3px 3px 2px #888;position:absolute;display:none;border:1px solid #ccc;height:auto;width:250px;background-color:#fff;margin:35px 0 0 -100px;z-index:10000;padding:10px 10px 10px 10px;text-align:left;font-size:inherit}div.colVisCont:after,div.colVisCont:before{bottom:100%;left:50%;border:solid transparent;content:" ";height:0;width:0;position:absolute;pointer-events:none}div.colVisCont:after{border-color:rgba(255,255,255,0);border-bottom-color:#fff;border-width:10px;margin-left:-10px}div.colVisCont:before{border-color:rgba(255,255,255,0);border-bottom-color:#ccc;border-width:12px;margin-left:-12px}div.colVisCont p{margin:6px auto 6px auto}div.colVisCont a.colVis{display:initial;font-weight:inherit}ul.cols_checklist{padding:0;margin:0;list-style-type:none}ul.cols_checklist label{display:block}ul.cols_checklist input{vertical-align:middle;margin:2px 5px 2px 1px}li.cols_checklist_item{padding:4px;margin:0}li.cols_checklist_item:hover{background-color:#335ea8;color:#fff}.cols_checklist_slc_item{background-color:#335ea8;color:#fff}
@@ -1 +1 @@
1
- span.expClpFlt a.btnExpClpFlt{width:35px;height:35px;display:inline-block;}span.expClpFlt a.btnExpClpFlt:hover{background-color:#f4f4f4}span.expClpFlt img{padding:8px 11px 11px 11px}
1
+ span.expClpFlt a.btnExpClpFlt{width:35px;height:35px;display:inline-block}span.expClpFlt a.btnExpClpFlt:hover{background-color:var(--tf-border-light,#f4f4f4)}span.expClpFlt img{padding:8px 11px 11px 11px}