Rewrite as TypeScript npm package with Leaflet v1/v2 dual support#31
Open
jwasilgeo wants to merge 1 commit into
Open
Rewrite as TypeScript npm package with Leaflet v1/v2 dual support#31jwasilgeo wants to merge 1 commit into
jwasilgeo wants to merge 1 commit into
Conversation
- Convert src/CanvasFlowmapLayer.js to TypeScript (ES6 class, strict types) - Add src/index.ts as entry point with named exports and type exports - Add Vite lib-mode build (ESM + UMD outputs) via vite.config.ts - Bundle tween.js; externalize only leaflet (peer dep >=1.7.0 <3.0.0) - Add package.json for npm publish as leaflet-canvas-flowmap-layer - Add tsconfig.json with strict mode and bundler module resolution - Update demo pages to ESM script modules with import maps - Update README with installation, quickstart, and v1→v2 migration guide - Update .gitignore to exclude node_modules/ and dist/ Closes #30, closes #17
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
src/CanvasFlowmapLayer.jsto TypeScript using an ES6 class pattern compatible with both Leaflet v1 and v2leaflet-canvas-flowmap-layer) with ESM, UMD, and TypeScript declaration outputs via Viteleafletis externalized (peer dep>=1.7.0 <3.0.0)Closes #30, closes #17
Breaking changes from v1
L.canvasFlowmapLayer(geoJson, opts)new CanvasFlowmapLayer(geoJson, opts)(named import)window.L.CanvasFlowmapLayerimport { CanvasFlowmapLayer } from 'leaflet-canvas-flowmap-layer'window.Lwindow.LeafletCanvasFlowmapLayer.CanvasFlowmapLayertween.jsseparately<script>tagAll public methods, options, and events are unchanged.
Test plan
npm install— installs cleanlynpm run build— producesdist/canvas-flowmap-layer.js,.umd.cjs,.d.tsnpm run typecheck— zero TypeScript errorsnpm run servethen opendocs/main/index.html— flowmap renders, animation runs, click selection worksdocs/comparison/index.html— layer switching, animation controls, show/clear all workdocs/class-breaks-symbology/index.html— class break symbology renders correctlywrapAroundCanvas: truedraws correctlydist/canvas-flowmap-layer.umd.cjs— global export works