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<TheClass, typeof PROPS> = WithProps(PROPS)`,
which is what clears JSR's `unsupported-super-class-expr` /
`missing-explicit-type` errors. Adds a `Positional<T, Obj>` alias in
`props.ts` and explicit object types on the `shared-props.ts` fragments to
keep those annotations short. Empty group tables use `Record<never, never>`.
`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.
main
parent
f9c07a263d
commit
b7f7a43113
@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2026 Buddy Sandidge
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
@ -1,8 +1,24 @@
|
||||
{
|
||||
"name": "@buddy/leaflet-components",
|
||||
"version": "0.1.0",
|
||||
"license": "MIT",
|
||||
"exports": {
|
||||
".": "./src/index.ts",
|
||||
"./elements": "./src/elements/index.ts"
|
||||
},
|
||||
"publish": {
|
||||
"exclude": [
|
||||
"src/index.npm.ts",
|
||||
"src/core/globals.ts",
|
||||
"test/",
|
||||
"docs/",
|
||||
"demos/",
|
||||
"dist/",
|
||||
"index.html",
|
||||
"*.config.ts",
|
||||
"tsconfig*.json",
|
||||
".idea/",
|
||||
".claude/"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
@ -0,0 +1,81 @@
|
||||
// Ambient DOM augmentations: the `leaflet-*` tag -> element class map, and the
|
||||
// custom bubbling events the registration protocol fires. Kept in this
|
||||
// standalone module -- imported only by `src/index.npm.ts`, never by
|
||||
// `src/index.ts` or anything in `jsr.json`'s export graph -- because JSR's
|
||||
// "no slow types" check rejects `declare global` anywhere it can reach. npm
|
||||
// consumers get these automatically via the package's `.` entry; the whole
|
||||
// `src/` tree also sees them at build/typecheck time because this file is
|
||||
// under `tsconfig.json`'s `include`. See docs/ for the split rationale.
|
||||
import type {
|
||||
LeafletCRSChangedEvent,
|
||||
LeafletIconChangedEvent,
|
||||
LeafletLayerEvent,
|
||||
LeafletLineRemoveEvent,
|
||||
LeafletLineSyncEvent,
|
||||
LeafletRegisterEvent,
|
||||
} from './register.ts';
|
||||
import type {
|
||||
LeafletCircleElement,
|
||||
LeafletCircleMarkerElement,
|
||||
LeafletControlAttributionElement,
|
||||
LeafletControlLayersElement,
|
||||
LeafletControlScaleElement,
|
||||
LeafletControlZoomElement,
|
||||
LeafletDivIconElement,
|
||||
LeafletFeatureGroupElement,
|
||||
LeafletGeoJSONElement,
|
||||
LeafletIconElement,
|
||||
LeafletImageOverlayElement,
|
||||
LeafletLayerGroupElement,
|
||||
LeafletLineElement,
|
||||
LeafletMapElement,
|
||||
LeafletMarkerElement,
|
||||
LeafletPolygonElement,
|
||||
LeafletPolylineElement,
|
||||
LeafletPopupElement,
|
||||
LeafletRectangleElement,
|
||||
LeafletSVGOverlayElement,
|
||||
LeafletTileLayerElement,
|
||||
LeafletTileLayerWMSElement,
|
||||
LeafletTooltipElement,
|
||||
LeafletVideoOverlayElement,
|
||||
} from '../elements/index.ts';
|
||||
|
||||
declare global {
|
||||
interface HTMLElementEventMap {
|
||||
'leaflet-register': LeafletRegisterEvent;
|
||||
'leaflet-add-layer': LeafletLayerEvent;
|
||||
'leaflet-remove-layer': LeafletLayerEvent;
|
||||
'icon-changed': LeafletIconChangedEvent;
|
||||
'leaflet-line-sync': LeafletLineSyncEvent;
|
||||
'leaflet-line-remove': LeafletLineRemoveEvent;
|
||||
'leaflet-crs-changed': LeafletCRSChangedEvent;
|
||||
}
|
||||
|
||||
interface HTMLElementTagNameMap {
|
||||
'leaflet-map': LeafletMapElement;
|
||||
'leaflet-marker': LeafletMarkerElement;
|
||||
'leaflet-circle': LeafletCircleElement;
|
||||
'leaflet-circle-marker': LeafletCircleMarkerElement;
|
||||
'leaflet-line': LeafletLineElement;
|
||||
'leaflet-polygon': LeafletPolygonElement;
|
||||
'leaflet-polyline': LeafletPolylineElement;
|
||||
'leaflet-rectangle': LeafletRectangleElement;
|
||||
'leaflet-tile-layer': LeafletTileLayerElement;
|
||||
'leaflet-tile-layer-wms': LeafletTileLayerWMSElement;
|
||||
'leaflet-image-overlay': LeafletImageOverlayElement;
|
||||
'leaflet-video-overlay': LeafletVideoOverlayElement;
|
||||
'leaflet-svg-overlay': LeafletSVGOverlayElement;
|
||||
'leaflet-layer-group': LeafletLayerGroupElement;
|
||||
'leaflet-feature-group': LeafletFeatureGroupElement;
|
||||
'leaflet-geojson': LeafletGeoJSONElement;
|
||||
'leaflet-control-layers': LeafletControlLayersElement;
|
||||
'leaflet-control-zoom': LeafletControlZoomElement;
|
||||
'leaflet-control-attribution': LeafletControlAttributionElement;
|
||||
'leaflet-control-scale': LeafletControlScaleElement;
|
||||
'leaflet-popup': LeafletPopupElement;
|
||||
'leaflet-tooltip': LeafletTooltipElement;
|
||||
'leaflet-icon': LeafletIconElement;
|
||||
'leaflet-div-icon': LeafletDivIconElement;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,15 @@
|
||||
// npm package entry point.
|
||||
//
|
||||
// Identical to `./index.ts` (every element class, every helper, and the
|
||||
// side-effect `customElements.define` calls) but additionally installs the
|
||||
// ambient DOM augmentations from `./core/globals.ts` -- the `leaflet-*` tag
|
||||
// map and the custom-event map -- so `document.querySelector('leaflet-map')`
|
||||
// and `el.addEventListener('leaflet-register', ...)` are typed out of the box.
|
||||
//
|
||||
// `./index.ts` is kept free of that import because it is the module JSR
|
||||
// publishes, and JSR's "no slow types" rule forbids `declare global` anywhere
|
||||
// in the published graph. JSR consumers import `./index.ts` and can pull in
|
||||
// `leaflet-components/elements` etc.; they just don't get the ambient globals.
|
||||
import './core/globals.ts';
|
||||
|
||||
export * from './index.ts';
|
||||
Loading…
Reference in New Issue