Skip to content

v2.0.0 — ESM only, new build system, TypeScript types, CSS fixes#108

Merged
nicped merged 2 commits into
mainfrom
v2.0.0
Mar 21, 2026
Merged

v2.0.0 — ESM only, new build system, TypeScript types, CSS fixes#108
nicped merged 2 commits into
mainfrom
v2.0.0

Conversation

@nicped

@nicped nicped commented Mar 21, 2026

Copy link
Copy Markdown
Member

Summary

  • Breaking: ESM only — IIFE build removed, no more window.swiffyslider global or auto-init. Use <script type="module"> or a bundler and call swiffyslider.init() explicitly.
  • New build system — esbuild + lightningcss replaces the VS Code extension pipeline. npm run build / npm run dev.
  • TypeScript declarations — hand-written .d.ts files shipped for both the core and extensions module. No @types/ package needed.
  • JSDoc annotations — all public methods annotated for JS IntelliSense.
  • CSS modernisationgrid-gapgap, removed obsolete -webkit-overflow-scrolling, media queries updated to range syntax, prefers-reduced-motion support added, several bugs fixed.
  • GitHub Actions — CI workflow on PRs, publish workflow on version tags.
  • Docs updated — all HTML updated to v2 ESM loading patterns, old minified assets removed.

Breaking changes

  • Script loading: <script src defer><script type="module">
  • No window.swiffyslider — use named ESM import
  • data-noinit removed — v2 never auto-initializes
  • Extensions: swiffyslider.extensions.*swiffysliderextensions from swiffy-slider/extensions
  • Dist filenames: swiffy-slider.min.js / swiffy-slider.esm.min.jsswiffy-slider.js

Test plan

  • Run npm run build — should complete without errors
  • Open http://localhost:5501 via npm run dev and verify sliders work on the docs site
  • Verify dist/js/ contains .js, .js.map, and .d.ts for both modules
  • Check configuration page — all options apply correctly to the preview slider
  • Verify TypeScript types resolve correctly in a TS project

🤖 Generated with Claude Code

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR delivers Swiffy Slider v2.0.0 as an ESM-only package with a new esbuild/lightningcss build pipeline, shipped TypeScript declarations, and modernized CSS + documentation updates to match the new loading pattern.

Changes:

  • Replace legacy IIFE/dual-build output with a single ESM distribution (core + extensions) and updated package exports.
  • Add hand-written .d.ts files for both modules and expand JSDoc on public APIs.
  • Modernize CSS (gap, range media queries, reduced-motion handling) and update docs/examples to ESM module loading.

Reviewed changes

Copilot reviewed 31 out of 62 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
src/swiffy-slider.js Core slider module refactor to exported ESM object + JSDoc + behavior fixes.
src/swiffy-slider.esm.js Removes legacy separate ESM source entry (now redundant).
src/swiffy-slider.d.ts Adds TypeScript declarations for core module API.
src/swiffy-slider.css CSS modernization (gap, reduced motion, MQ range syntax, fixes).
src/swiffy-slider-extensions.js Extensions module refactor to exported ESM object + improved drag timer handling.
src/swiffy-slider-extensions.d.ts Adds TypeScript declarations for extensions module API.
package.json Bumps to 2.0.0, switches exports to dist output + types, updates scripts and Node engine.
docs/index.html Updates docs site homepage to load v2 assets and ESM init patterns.
docs/examples/index.html Updates examples page to ESM module loading + new CSS path.
docs/docs/slider-sizes/index.html Updates docs page to ESM module loading + new CSS path.
docs/docs/slider-options/index.html Updates docs page to ESM module loading + new CSS path.
docs/docs/slider-navigation/index.html Updates docs page to ESM module loading + new CSS path.
docs/docs/slider-indicators/index.html Updates docs page to ESM module loading + new CSS path.
docs/docs/slider-animation/index.html Updates docs page to ESM module loading + minor copy fix.
docs/docs/index.html Major docs refresh for v2 loading, API, TS guidance, and removed legacy guidance.
docs/configuration/index.html Updates configurator to use ESM modules and updated init calls.
docs/concept.html Removes outdated concept page.
docs/assets/js/swiffy-slider.min.js.map Removes legacy minified asset sourcemap.
docs/assets/js/swiffy-slider.min.js Removes legacy minified asset.
docs/assets/js/swiffy-slider.js.map Adds new built ESM sourcemap for docs.
docs/assets/js/swiffy-slider.js Adds new built ESM core bundle for docs.
docs/assets/js/swiffy-slider.esm.min.js.map Removes legacy minified ESM asset sourcemap.
docs/assets/js/swiffy-slider.esm.min.js Removes legacy minified ESM asset.
docs/assets/js/swiffy-slider-extensions.min.js.map Removes legacy extensions minified asset sourcemap.
docs/assets/js/swiffy-slider-extensions.min.js Removes legacy extensions minified asset.
docs/assets/js/swiffy-slider-extensions.js.map Adds new built ESM extensions sourcemap for docs.
docs/assets/js/swiffy-slider-extensions.js Adds new built ESM extensions bundle for docs.
docs/assets/css/swiffy-slider.min.css.map Removes legacy minified CSS sourcemap.
docs/assets/css/swiffy-slider.min.css Removes legacy minified CSS.
docs/assets/css/swiffy-slider.css Adds new built CSS output for docs (with sourcemap reference).
dist/js/swiffy-slider.min.js.map Removes legacy minified dist sourcemap.
dist/js/swiffy-slider.min.js Removes legacy minified dist JS.
dist/js/swiffy-slider.js.map Adds new dist ESM sourcemap for core.
dist/js/swiffy-slider.js Replaces dist output with ESM export build.
dist/js/swiffy-slider.esm.min.js.map Removes legacy minified ESM dist sourcemap.
dist/js/swiffy-slider.esm.min.js Removes legacy minified ESM dist JS.
dist/js/swiffy-slider.esm.js Removes legacy separate ESM dist entry.
dist/js/swiffy-slider.d.ts Adds dist-shipped TypeScript declarations for core.
dist/js/swiffy-slider-extensions.min.js.map Removes legacy extensions minified dist sourcemap.
dist/js/swiffy-slider-extensions.min.js Removes legacy extensions minified dist JS.
dist/js/swiffy-slider-extensions.js.map Adds new dist ESM sourcemap for extensions.
dist/js/swiffy-slider-extensions.js Replaces extensions dist output with ESM export build.
dist/js/swiffy-slider-extensions.d.ts Adds dist-shipped TypeScript declarations for extensions.
dist/css/swiffy-slider.min.css.map Removes legacy minified dist CSS sourcemap.
dist/css/swiffy-slider.min.css Removes legacy minified dist CSS.
build.js Adds new build orchestrator (esbuild + lightningcss + copy to docs/assets).
SECURITY.md Adds a security policy and reporting instructions.
LICENSE Updates copyright year range.
Changelog.md Adds v2.0.0 changelog entry and highlights breaking changes.
CLAUDE.md Adds repo/build/dev workflow guidance and architecture notes.
.vscode/settings.json Removes editor-specific VS Code pipeline configuration.
.vscode/readme-extensions-used.txt Removes outdated docs about VS Code extension-based build.
.gitignore Adds node_modules/ ignore.
.github/workflows/publish.yml Adds tag-triggered npm publish workflow.
.github/workflows/ci.yml Adds PR CI build workflow.
.github/CONTRIBUTING.md Adds contributor guidance and project expectations.
.claude/settings.local.json Adds local Claude tool permissions config.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread docs/index.html
Comment thread src/swiffy-slider.js Outdated
Comment thread docs/configuration/index.html
Comment thread docs/assets/css/swiffy-slider.css Outdated
Comment thread docs/docs/index.html
- setVisibleSlides: observe only direct children (:scope > *) to avoid
  applying slide-visible to nested elements and excess observer load
- configuration/index.html: use Promise.all to avoid race condition
  between core and extensions imports overwriting window.swiffyslider
- build.js: rewrite sourceMappingURL in docs CSS copy to use relative
  path so browser devtools can resolve the map from docs/assets/css/

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@nicped nicped self-assigned this Mar 21, 2026
@nicped nicped merged commit 6e152a2 into main Mar 21, 2026
2 checks passed
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.

2 participants