From b7f7a43113aff257c865c8e2704e17d1171f1f43 Mon Sep 17 00:00:00 2001 From: Buddy Date: Tue, 8 Sep 2026 21:44:20 -0700 Subject: [PATCH] chore: prep 0.1.0 for npm + JSR publish npm name `leaflet-components` is taken by another author, so the npm package is renamed to `leaflet-web-components`; JSR stays `@buddy/leaflet-components`. Adds the MIT `LICENSE` file (was declared but missing). Entry split so JSR can publish with no slow types: - `src/index.ts` is the shared/JSR entry and no longer carries any `declare global`. - `src/core/globals.ts` (new) holds the `HTMLElementTagNameMap` / `HTMLElementEventMap` augmentations; imported only by the new npm entry `src/index.npm.ts` and by `test/setup.ts`, and listed in `jsr.json`'s `publish.exclude` so it never enters JSR's module graph. - `package.json` `.`/`main`/`module`/`types` now point at `dist/index.npm.*`. Every element file switches from `class extends WithProps({...})` to a `const PROPS` (with an explicit type) plus `const Base: LeafletElementConstructor = WithProps(PROPS)`, which is what clears JSR's `unsupported-super-class-expr` / `missing-explicit-type` errors. Adds a `Positional` alias in `props.ts` and explicit object types on the `shared-props.ts` fragments to keep those annotations short. Empty group tables use `Record`. `npx jsr publish --dry-run` now reports "Success" with zero slow-type errors; `npm run typecheck`, `lint`, `test` (76) and `build` all pass. CLAUDE.md, docs/ and README.md updated for the rename, the entry split, and the `const PROPS` / `const Base` pattern. --- CLAUDE.md | 56 +++-- LICENSE | 21 ++ README.md | 88 +++++-- docs/01-architecture.md | 78 ++++-- docs/02-props-and-attributes.md | 12 +- docs/04-events.md | 7 +- docs/05-special-cases.md | 7 +- docs/06-load-order.md | 11 +- docs/07-tooling-and-build.md | 97 ++++++-- jsr.json | 16 ++ package.json | 15 +- src/core/globals.ts | 81 +++++++ src/core/props.ts | 6 + src/core/register.ts | 14 +- src/core/shared-props.ts | 59 ++++- src/elements/leaflet-circle-marker.ts | 13 +- src/elements/leaflet-circle.ts | 19 +- src/elements/leaflet-control-attribution.ts | 23 +- src/elements/leaflet-control-layers.ts | 32 ++- src/elements/leaflet-control-scale.ts | 32 ++- src/elements/leaflet-control-zoom.ts | 32 ++- src/elements/leaflet-div-icon.ts | 39 +-- src/elements/leaflet-feature-group.ts | 6 +- src/elements/leaflet-geojson.ts | 12 +- src/elements/leaflet-icon.ts | 26 +- src/elements/leaflet-image-overlay.ts | 31 ++- src/elements/leaflet-layer-group.ts | 6 +- src/elements/leaflet-line.ts | 2 +- src/elements/leaflet-map.ts | 251 ++++++++++++-------- src/elements/leaflet-marker.ts | 16 +- src/elements/leaflet-polygon.ts | 6 +- src/elements/leaflet-polyline.ts | 16 +- src/elements/leaflet-popup.ts | 34 ++- src/elements/leaflet-rectangle.ts | 12 +- src/elements/leaflet-svg-overlay.ts | 26 +- src/elements/leaflet-tile-layer-wms.ts | 22 +- src/elements/leaflet-tile-layer.ts | 8 +- src/elements/leaflet-tooltip.ts | 34 ++- src/elements/leaflet-video-overlay.ts | 36 ++- src/index.npm.ts | 15 ++ src/index.ts | 63 +---- test/setup.ts | 7 + 42 files changed, 979 insertions(+), 408 deletions(-) create mode 100644 LICENSE create mode 100644 src/core/globals.ts create mode 100644 src/index.npm.ts diff --git a/CLAUDE.md b/CLAUDE.md index ef02638..76eaecc 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -24,7 +24,7 @@ Formatting runs on `oxfmt` (oxc's Prettier-compatible formatter), configured in ### Testing -Tests run under Vitest + jsdom (`test/**/*.test.ts`), with a single setup file (`test/setup.ts`) that stubs `ResizeObserver` -- jsdom doesn't implement it, and `leaflet-map.ts` constructs one unconditionally. Real Leaflet objects work fine under jsdom for everything this library actually needs to verify (option/attribute wiring, event forwarding); no browser is required. Two things worth knowing: +Tests run under Vitest + jsdom (`test/**/*.test.ts`), with a single setup file (`test/setup.ts`) that stubs `ResizeObserver` (jsdom doesn't implement it, and `leaflet-map.ts` constructs one unconditionally) and imports `src/core/globals.ts` so the ambient `HTMLElementTagNameMap` / `HTMLElementEventMap` augmentations are in scope for the whole test program (tests import element modules directly, not the npm entry that would otherwise pull them in). Real Leaflet objects work fine under jsdom for everything this library actually needs to verify (option/attribute wiring, event forwarding); no browser is required. Two things worth knowing: - Some Leaflet DOM state (the ``/`