15 Commits (11cae8c89f77fa79406ff858589b6eaad3d8755b)

Author SHA1 Message Date
Buddy 11cae8c89f style: replace Number/String/parseInt/parseFloat with shorter equivalents
Replace Number(x) with +x, String(x) with template literal,
parseInt(x, 10) with +, and parseFloat(x || "0") with +(x ?? 0).
Fix operator precedence with parentheses around ?? expressions.
3 months ago
Buddy 7ae092ac98 refactor: consolidate core modules into utils.ts
Merge path-style.ts and with-props.ts into utils.ts to reduce the
number of core files from 5 to 3 (utils.ts, props.ts, register.ts).
Unify duplicate ../core/utils.ts imports in all component files.
Remove stale re-exports from src/index.ts.
3 months ago
Buddy 10027c9fe7 refactor: rename withProps to WithProps
Capitalize the mixin factory name since it's used in the extends
position (class Foo extends WithProps(...)). Update CLAUDE.md to
match.
3 months ago
Buddy 85f0fbe216 refactor: use .ts extension for relative imports in source
Change all import specifiers from ".js" to ".ts" in TypeScript source
files. Add allowImportingTsExtensions and rewriteRelativeImportExtensions
to tsconfig so tsc strips them to ".js" in the dist output — no build
pipeline changes needed. Update CLAUDE.md to reflect the new extension policy.
3 months ago
Buddy 5d0d15fba1 refactor: move props.ts from src/types/ to src/core/
The types/ directory now only had a single file. The PropDef and
PropTypesFromTable types are foundational to the module infrastructure
(used by utils.ts, with-props.ts, and every component), so core/ is a
better home. Deleted the empty types/ directory.
3 months ago
Buddy 565b79a89c chore: remove unused exports and dead css.d.ts
- camelCase removed entirely (never imported anywhere)
- PATH_STYLE_ATTRS, ChildEntry, createChildRegisterHandler made private
  (used only internally within their modules)
- src/types/css.d.ts deleted (leftover from an earlier
  approach — no .css imports exist in the source)
3 months ago
Buddy 18db84e9a4 feat: derive buildOptions return type from PROPS table via Omit<PropTypesFromTable<TProps>, TExclude[number]>
Use a const type parameter on the exclude array so literal tuples narrow
correctly. The return type now reflects the actual properties and their
kinds (number/string/boolean) instead of Record<string, unknown>.

Four call sites needed local casts where PROPS declares str but Leaflet
expects a narrower type (crossOrigin, offset) — these are design-level
mismatches between HTML attribute types and Leaflet's option types.
3 months ago
Buddy 348e865dae docs: add why/how comments to all src/core modules
Explain design rationale for every exported utility, mixin, registration
helper, and path-style handler
3 months ago
Buddy c69f9c8503 refactor: extract PROP_BY_ATTR + dynamic setter dispatch into helpers
Adds buildAttrMap(props) and setLayerAttr(obj, props, attrMap,
name, val) to utils.ts. The former replaces the PROP_BY_ATTR Map
construction (2 fewer lines per component), the latter replaces
the 6-line dynamic setter dispatch pattern used as the fallback
else block in 6 components.

For WMS, setLayerAttr returns false when no setter exists, so the
caller can fall back to setParams for non-method props.
3 months ago
Buddy 96b48a6ae2 refactor: extract #parsedBounds into parseBoundsAttr helper
Replaces the identical private #parsedBounds method in rectangle,
image-overlay, video-overlay, and svg-overlay with a call to
parseBoundsAttr(el) from utils.ts. Removes 4 x 5 = 20 lines
of method definitions.
3 months ago
Buddy c18829a0e3 refactor: extract duplicate #num helper into standalone numAttr()
Removes the identical private #num method from 5 components
(leaflet-circle, leaflet-circle-marker, leaflet-marker,
leaflet-popup, leaflet-tooltip). Replaces with numAttr(this, PROPS, name)
call to the new helper in utils.ts.
3 months ago
Buddy a8245c0114 chore: remove unused updateViaSetter helper 3 months ago
Buddy 4e1abdcc3d refactor: extract static PROP accessor blocks into definePropAccessors helper
All 17 TypedBase components now share a single definePropAccessors(proto, PROPS)
call in their static block instead of duplicating the getter/setter loop.

Also includes pre-existing cleanup:
- Refine LeafletRegisterEvent type (interface -> generic CustomEvent)
- Drop unused attrToPropName helper
- Fix createChildRegisterHandler return type in layer-group/feature-group
3 months ago
Buddy 1e7ea22342 fix: prevent tooltip crash from empty-string pane option
buildOptions was passing default values for absent attributes,
including empty-string defaults like pane:'', which caused Leaflet to
look up this._panes[''] and return undefined, crashing in appendChild.

- Skip empty-string defaults in buildOptions so Leaflet uses its own
- Broaden createChildRegisterHandler param from LayerGroup to Layer so
  non-container layers (marker, circle, etc.) can intercept popup/tooltip
  children and call bindPopup/bindTooltip instead of bubbling to the map
- Add child-registration handler to every layer component (all 12)
- Fix disconnectedCallback in container components to unbind popups and
  tooltips and remove child layers properly
4 months ago
Buddy 5f3fd5f61a refactor: replace inheritance hierarchy with composable PROPS-table pattern
Remove LeafletElement and LeafletControl base classes. Every component
now self-describes its attributes via a PROPS table, derives observed-
Attributes from it, and generates prototype getters/setters in static {}.

Registration lifecycle is extracted into standalone helpers
(registerWithParent, createChildRegisterHandler). Common update
patterns (path style) are shared via imported helpers instead of
duplicated across 5+ components.

Components manage their own #obj private field instead of a shared
protected leafletObject. Leaflet-map-style declarative patterns are
now consistent across all 20 components.
4 months ago