Skip to content

Update Stencil to v4, plus changes required by that update, mostly to config, tests, and other dev-env stuff#3791

Open
adrianschmidt wants to merge 2 commits intofix-flaky-testsfrom
update-stencil
Open

Update Stencil to v4, plus changes required by that update, mostly to config, tests, and other dev-env stuff#3791
adrianschmidt wants to merge 2 commits intofix-flaky-testsfrom
update-stencil

Conversation

@adrianschmidt
Copy link
Contributor

@adrianschmidt adrianschmidt commented Jan 20, 2026

Summary by CodeRabbit

  • Chores

    • Upgraded Stencil framework from v3.4.2 to v4.36.3
    • Updated Stencil Sass dependency to v3.2.2
    • Added glob utility package
  • Tests

    • Added ResizeObserver polyfill for test environment
    • Updated color picker component test snapshot
  • Refactoring

    • Reorganized component internal type definitions for improved code organization
    • Enhanced configuration for Sass module resolution

✏️ Tip: You can customize this high-level summary in your review settings.

Review:

  • Commits are atomic
  • Commits have the correct type for the changes made
  • Commits with breaking changes are marked as such

Browsers tested:

(Check any that applies, it's ok to leave boxes unchecked if testing something didn't seem relevant.)

Windows:

  • Chrome
  • Edge
  • Firefox

Linux:

  • Chrome
  • Firefox

macOS:

  • Chrome
  • Firefox
  • Safari

Mobile:

  • Chrome on Android
  • iOS

@adrianschmidt adrianschmidt requested a review from a team as a code owner January 20, 2026 20:37
@coderabbitai
Copy link

coderabbitai bot commented Jan 20, 2026

📝 Walkthrough

Walkthrough

This PR updates API Extractor configuration to use a temporary types directory, adds a TSDoc tag fixer script, upgrades Stencil from v3 to v4, changes several component method visibility modifiers from protected to public, refactors link mark types into a separate file, configures Sass plugin include paths, and adds test polyfills and configuration updates.

Changes

Cohort / File(s) Summary
API Extractor & TSDoc Configuration
api-extractor.json, scripts/fix-tsdoc-tags.cjs, tsdoc.json
Updated mainEntryPointFilePath and overrideTsconfig to use temp/types instead of dist/types; added new ae-extra-release-tag rule; added Node.js utility script to convert JSDoc tags to TSDoc format (@default@defaultValue, @private@internal); updated tsdoc.json to extend base config and remove custom tag definitions.
Build & Package Configuration
package.json, stencil.config.ts, stencil.config.dist.ts, stencil.config.docs.ts, scripts/run-tests.cjs
Bumped Stencil from v3.x to v4.x; added glob devDependency; updated api:update and api:verify scripts to run tsdoc fixer before extraction; configured Sass plugin with includePaths: ['node_modules']; modified stencil binary path resolution in run-tests.cjs; added test setup hook.
Component Method Visibility Changes
src/components/checkbox/checkbox.tsx, src/components/dock/dock-button/dock-button.tsx, src/components/portal/portal.tsx
Changed three @Watch handler methods from protected to public: handleCheckedChange, handleIndeterminateChange, handleReadonlyChange (Checkbox); openWatcher (DockButton); onVisible (Portal).
Text Editor Link Mark Type Refactoring
src/components/text-editor/prosemirror-adapter/plugins/link/link-mark.ts, src/components/text-editor/prosemirror-adapter/plugins/link/link-mark.types.ts, src/components/text-editor/prosemirror-adapter/plugins/link/utils.ts, src/components/text-editor/prosemirror-adapter/prosemirror-adapter.tsx
Extracted LinkMarkAttrs interface to new link-mark.types.ts file with href, title, target, rel, referrerpolicy fields; updated import references across link plugin modules.
Miscellaneous Updates
src/components/color-picker/color-picker.spec.tsx, src/components/date-picker/flatpickr-adapter/flatpickr-adapter.tsx, src/index.ts, src/test-setup.ts
Updated test snapshot to include shadowrootdelegatesfocus attribute; added optional chaining guard to checkVisibility call; removed @stencil/core/internal popover JSX augmentation; added ResizeObserver polyfill for test environment.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

  • Update to Stencil 4 #3782 — Implements identical API Extractor configuration updates (mainEntryPointFilePath, overrideTsconfig paths) and the fix-tsdoc-tags.cjs script with package.json script modifications.

Suggested labels

maintenance, 3rd-party

Suggested reviewers

  • jgroth
  • civing
🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 33.33% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: upgrading Stencil to v4 and the associated configuration/test updates required by that upgrade.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch update-stencil

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions
Copy link

Documentation has been published to https://lundalogik.github.io/lime-elements/versions/PR-3791/

…ed changes

Includes v4 migration changes:
- test environment setup with ResizeObserver mock,
- SASS plugin configuration updates, and
- formatting adjustments.
Converts Stencil-generated JSDoc tags to TSDoc format
(@default@DefaultValue, @Private@internal) by copying
types to `./temp/types` before API extraction. Ensures
compatibility with API Extractor's TSDoc requirements
Comment on lines +9 to +19
const path = require('node:path');

const stencilScript = require.resolve('@stencil/core/bin/stencil');
const stencilScript = path.resolve(
__dirname,
'..',
'node_modules',
'@stencil',
'core',
'bin',
'stencil'
);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Resolve the stencil CLI path directly (can't use require.resolve because Stencil v4's package.json exports field doesn't expose bin/stencil).

@adrianschmidt
Copy link
Contributor Author

@coderabbitai full review

@coderabbitai
Copy link

coderabbitai bot commented Jan 20, 2026

✅ Actions performed

Full review triggered.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Fix all issues with AI agents
In `@package.json`:
- Around line 19-20: The api:verify script currently short‑circuits when
src/components.d.ts exists and also runs the build twice on the fallback; change
the script so it always runs node scripts/fix-tsdoc-tags.cjs and api-extractor
run, and only invokes npm run build when the file is missing. Update the
"api:verify" entry to perform a shell conditional (if/then/else or grouped
condition) that checks shx test -f src/components.d.ts and runs either the
post-build steps (node scripts/fix-tsdoc-tags.cjs && api-extractor run) after a
build or just those post-build steps when the file already exists, ensuring no
duplicate npm run build and no short‑circuiting of fix-tsdoc-tags.cjs or
api-extractor.

In `@src/components/date-picker/flatpickr-adapter/flatpickr-adapter.tsx`:
- Around line 165-167: The current guard in the create/init path uses optional
chaining on (this.container as any).checkVisibility?.() which yields undefined
when the method is missing and causes an unintended early return; update the
check so you only return early if checkVisibility explicitly returns false
(i.e., call checkVisibility only when it exists and treat undefined as visible).
Locate the conditional around this.isOpen and (this.container as
any).checkVisibility in flatpickr-adapter.tsx and change it to call
checkVisibility only if present and test for === false (or use typeof to detect
the function) so creation proceeds when the API is unavailable.

Comment on lines +19 to +20
"api:update": "npm run build && node scripts/fix-tsdoc-tags.cjs && api-extractor run --local --verbose",
"api:verify": "shx test -f src/components.d.ts || (npm run build && npm run build) && node scripts/fix-tsdoc-tags.cjs && api-extractor run",
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Fix api:verify short‑circuiting and duplicate build.

At Line 20, || short‑circuits the rest of the script when src/components.d.ts exists, so fix-tsdoc-tags and api-extractor never run. Also the build runs twice on the fallback path.

✅ Proposed fix
-    "api:verify": "shx test -f src/components.d.ts || (npm run build && npm run build) && node scripts/fix-tsdoc-tags.cjs && api-extractor run",
+    "api:verify": "(shx test -f src/components.d.ts || npm run build) && node scripts/fix-tsdoc-tags.cjs && api-extractor run",
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
"api:update": "npm run build && node scripts/fix-tsdoc-tags.cjs && api-extractor run --local --verbose",
"api:verify": "shx test -f src/components.d.ts || (npm run build && npm run build) && node scripts/fix-tsdoc-tags.cjs && api-extractor run",
"api:update": "npm run build && node scripts/fix-tsdoc-tags.cjs && api-extractor run --local --verbose",
"api:verify": "(shx test -f src/components.d.ts || npm run build) && node scripts/fix-tsdoc-tags.cjs && api-extractor run",
🤖 Prompt for AI Agents
In `@package.json` around lines 19 - 20, The api:verify script currently
short‑circuits when src/components.d.ts exists and also runs the build twice on
the fallback; change the script so it always runs node
scripts/fix-tsdoc-tags.cjs and api-extractor run, and only invokes npm run build
when the file is missing. Update the "api:verify" entry to perform a shell
conditional (if/then/else or grouped condition) that checks shx test -f
src/components.d.ts and runs either the post-build steps (node
scripts/fix-tsdoc-tags.cjs && api-extractor run) after a build or just those
post-build steps when the file already exists, ensuring no duplicate npm run
build and no short‑circuiting of fix-tsdoc-tags.cjs or api-extractor.

Comment on lines +165 to 167
if (!this.isOpen || !(this.container as any).checkVisibility?.()) {
return;
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

Optional chaining fallback breaks functionality when checkVisibility is unavailable.

When checkVisibility is not defined (e.g., older browsers, JSDOM test environments), checkVisibility?.() returns undefined. Negating undefined yields true, causing this method to return early and never create the flatpickr.

The intended behavior is likely: skip creation only if the element is explicitly not visible; if the API is unavailable, assume visible and proceed.

🐛 Proposed fix
-        if (!this.isOpen || !(this.container as any).checkVisibility?.()) {
+        if (!this.isOpen || (this.container as any).checkVisibility?.() === false) {
             return;
         }

This only returns early when checkVisibility explicitly returns false. If the method is undefined or returns true, the code proceeds normally.

🤖 Prompt for AI Agents
In `@src/components/date-picker/flatpickr-adapter/flatpickr-adapter.tsx` around
lines 165 - 167, The current guard in the create/init path uses optional
chaining on (this.container as any).checkVisibility?.() which yields undefined
when the method is missing and causes an unintended early return; update the
check so you only return early if checkVisibility explicitly returns false
(i.e., call checkVisibility only when it exists and treat undefined as visible).
Locate the conditional around this.isOpen and (this.container as
any).checkVisibility in flatpickr-adapter.tsx and change it to call
checkVisibility only if present and test for === false (or use typeof to detect
the function) so creation proceeds when the API is unavailable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant