From 5d0d15fba16d5bc0333493e5a62d0f3c74824391 Mon Sep 17 00:00:00 2001 From: Buddy Date: Tue, 9 Jun 2026 09:51:46 -0700 Subject: [PATCH] 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. --- src/components/leaflet-circle-marker.ts | 2 +- src/components/leaflet-circle.ts | 2 +- src/components/leaflet-control-attribution.ts | 2 +- src/components/leaflet-control-scale.ts | 2 +- src/components/leaflet-control-zoom.ts | 2 +- src/components/leaflet-geojson.ts | 2 +- src/components/leaflet-image-overlay.ts | 2 +- src/components/leaflet-marker.ts | 2 +- src/components/leaflet-polygon.ts | 2 +- src/components/leaflet-polyline.ts | 2 +- src/components/leaflet-popup.ts | 2 +- src/components/leaflet-rectangle.ts | 2 +- src/components/leaflet-svg-overlay.ts | 2 +- src/components/leaflet-tile-layer-wms.ts | 2 +- src/components/leaflet-tile-layer.ts | 2 +- src/components/leaflet-tooltip.ts | 2 +- src/components/leaflet-video-overlay.ts | 2 +- src/{types => core}/props.ts | 0 src/core/utils.ts | 2 +- src/core/with-props.ts | 2 +- src/index.ts | 2 +- 21 files changed, 20 insertions(+), 20 deletions(-) rename src/{types => core}/props.ts (100%) diff --git a/src/components/leaflet-circle-marker.ts b/src/components/leaflet-circle-marker.ts index a12783b..c1fb349 100644 --- a/src/components/leaflet-circle-marker.ts +++ b/src/components/leaflet-circle-marker.ts @@ -4,7 +4,7 @@ import { withProps } from '../core/with-props.js'; import { registerChildren, unregisterChildren } from '../core/register.js'; import { isPathStyleAttr, updatePathStyle } from '../core/path-style.js'; -import type { PropDef } from '../types/props.js'; +import type { PropDef } from '../core/props.js'; const PROPS = { lat: { kind: 'num', attr: 'lat', default: 0 }, diff --git a/src/components/leaflet-circle.ts b/src/components/leaflet-circle.ts index a1405b0..7ccdc29 100644 --- a/src/components/leaflet-circle.ts +++ b/src/components/leaflet-circle.ts @@ -4,7 +4,7 @@ import { withProps } from '../core/with-props.js'; import { registerChildren, unregisterChildren } from '../core/register.js'; import { isPathStyleAttr, updatePathStyle } from '../core/path-style.js'; -import type { PropDef } from '../types/props.js'; +import type { PropDef } from '../core/props.js'; const PROPS = { lat: { kind: 'num', attr: 'lat', default: 0 }, diff --git a/src/components/leaflet-control-attribution.ts b/src/components/leaflet-control-attribution.ts index b7b4a46..deb849d 100644 --- a/src/components/leaflet-control-attribution.ts +++ b/src/components/leaflet-control-attribution.ts @@ -2,7 +2,7 @@ import { Control, ControlPosition } from 'leaflet'; import { registerWithParent } from '../core/utils.js'; import { withProps } from '../core/with-props.js'; -import type { PropDef } from '../types/props.js'; +import type { PropDef } from '../core/props.js'; const PROPS = { position: { kind: 'str', attr: 'position', default: 'bottomright' }, diff --git a/src/components/leaflet-control-scale.ts b/src/components/leaflet-control-scale.ts index 3119153..9ae2ceb 100644 --- a/src/components/leaflet-control-scale.ts +++ b/src/components/leaflet-control-scale.ts @@ -2,7 +2,7 @@ import { Control, ControlPosition } from 'leaflet'; import { registerWithParent } from '../core/utils.js'; import { withProps } from '../core/with-props.js'; -import type { PropDef } from '../types/props.js'; +import type { PropDef } from '../core/props.js'; const PROPS = { position: { kind: 'str', attr: 'position', default: 'bottomleft' }, diff --git a/src/components/leaflet-control-zoom.ts b/src/components/leaflet-control-zoom.ts index f038314..2792d04 100644 --- a/src/components/leaflet-control-zoom.ts +++ b/src/components/leaflet-control-zoom.ts @@ -2,7 +2,7 @@ import { Control, ControlPosition } from 'leaflet'; import { registerWithParent } from '../core/utils.js'; import { withProps } from '../core/with-props.js'; -import type { PropDef } from '../types/props.js'; +import type { PropDef } from '../core/props.js'; const PROPS = { position: { kind: 'str', attr: 'position', default: 'topleft' }, diff --git a/src/components/leaflet-geojson.ts b/src/components/leaflet-geojson.ts index d4b2141..ef344e8 100644 --- a/src/components/leaflet-geojson.ts +++ b/src/components/leaflet-geojson.ts @@ -3,7 +3,7 @@ import { buildOptions } from '../core/utils.js'; import { withProps } from '../core/with-props.js'; import { registerChildren, unregisterChildren, getChildren } from '../core/register.js'; -import type { PropDef } from '../types/props.js'; +import type { PropDef } from '../core/props.js'; const PROPS = { data: { kind: 'str', attr: 'data', default: '' }, diff --git a/src/components/leaflet-image-overlay.ts b/src/components/leaflet-image-overlay.ts index f50fd79..ea17fde 100644 --- a/src/components/leaflet-image-overlay.ts +++ b/src/components/leaflet-image-overlay.ts @@ -4,7 +4,7 @@ import { buildOptions, buildAttrMap, setLayerAttr, parseBoundsAttr } from '../co import { withProps } from '../core/with-props.js'; import { registerChildren, unregisterChildren } from '../core/register.js'; -import type { PropDef } from '../types/props.js'; +import type { PropDef } from '../core/props.js'; const PROPS = { url: { kind: 'str', attr: 'url', default: '' }, diff --git a/src/components/leaflet-marker.ts b/src/components/leaflet-marker.ts index 7f4caeb..fa3ee68 100644 --- a/src/components/leaflet-marker.ts +++ b/src/components/leaflet-marker.ts @@ -3,7 +3,7 @@ import { buildOptions, numAttr, buildAttrMap, setLayerAttr } from '../core/utils import { withProps } from '../core/with-props.js'; import { registerChildren, unregisterChildren } from '../core/register.js'; -import type { PropDef } from '../types/props.js'; +import type { PropDef } from '../core/props.js'; const PROPS = { lat: { kind: 'num', attr: 'lat', default: 0 }, diff --git a/src/components/leaflet-polygon.ts b/src/components/leaflet-polygon.ts index 28b377f..516d31f 100644 --- a/src/components/leaflet-polygon.ts +++ b/src/components/leaflet-polygon.ts @@ -4,7 +4,7 @@ import { withProps } from '../core/with-props.js'; import { registerChildren, unregisterChildren } from '../core/register.js'; import { isPathStyleAttr, updatePathStyle } from '../core/path-style.js'; -import type { PropDef } from '../types/props.js'; +import type { PropDef } from '../core/props.js'; import type { LeafletLine } from './leaflet-line.js'; const PROPS = { diff --git a/src/components/leaflet-polyline.ts b/src/components/leaflet-polyline.ts index cd2dcb3..bc2a532 100644 --- a/src/components/leaflet-polyline.ts +++ b/src/components/leaflet-polyline.ts @@ -4,7 +4,7 @@ import { withProps } from '../core/with-props.js'; import { registerChildren, unregisterChildren } from '../core/register.js'; import { isPathStyleAttr, updatePathStyle } from '../core/path-style.js'; -import type { PropDef } from '../types/props.js'; +import type { PropDef } from '../core/props.js'; import type { LeafletLine } from './leaflet-line.js'; const PROPS = { diff --git a/src/components/leaflet-popup.ts b/src/components/leaflet-popup.ts index 3943339..1cb55dd 100644 --- a/src/components/leaflet-popup.ts +++ b/src/components/leaflet-popup.ts @@ -2,7 +2,7 @@ import { Popup } from 'leaflet'; import { registerWithParent, buildOptions, numAttr } from '../core/utils.js'; import { withProps } from '../core/with-props.js'; -import type { PropDef } from '../types/props.js'; +import type { PropDef } from '../core/props.js'; const PROPS = { lat: { kind: 'num', attr: 'lat', default: 0 }, diff --git a/src/components/leaflet-rectangle.ts b/src/components/leaflet-rectangle.ts index 04d70a1..526e2a4 100644 --- a/src/components/leaflet-rectangle.ts +++ b/src/components/leaflet-rectangle.ts @@ -4,7 +4,7 @@ import { withProps } from '../core/with-props.js'; import { registerChildren, unregisterChildren } from '../core/register.js'; import { isPathStyleAttr, updatePathStyle } from '../core/path-style.js'; -import type { PropDef } from '../types/props.js'; +import type { PropDef } from '../core/props.js'; const PROPS = { bounds: { kind: 'str', attr: 'bounds', default: '' }, diff --git a/src/components/leaflet-svg-overlay.ts b/src/components/leaflet-svg-overlay.ts index 5d00aa7..138f968 100644 --- a/src/components/leaflet-svg-overlay.ts +++ b/src/components/leaflet-svg-overlay.ts @@ -4,7 +4,7 @@ import { buildOptions, buildAttrMap, setLayerAttr, parseBoundsAttr } from '../co import { withProps } from '../core/with-props.js'; import { registerChildren, unregisterChildren } from '../core/register.js'; -import type { PropDef } from '../types/props.js'; +import type { PropDef } from '../core/props.js'; const PROPS = { bounds: { kind: 'str', attr: 'bounds', default: '' }, diff --git a/src/components/leaflet-tile-layer-wms.ts b/src/components/leaflet-tile-layer-wms.ts index ef4b99c..2299cdd 100644 --- a/src/components/leaflet-tile-layer-wms.ts +++ b/src/components/leaflet-tile-layer-wms.ts @@ -3,7 +3,7 @@ import { buildOptions, buildAttrMap, setLayerAttr, parseAttributeValue } from '. import { withProps } from '../core/with-props.js'; import { registerChildren, unregisterChildren } from '../core/register.js'; -import type { PropDef } from '../types/props.js'; +import type { PropDef } from '../core/props.js'; const PROPS = { url: { kind: 'str', attr: 'url', default: '' }, diff --git a/src/components/leaflet-tile-layer.ts b/src/components/leaflet-tile-layer.ts index 555ca6b..2264000 100644 --- a/src/components/leaflet-tile-layer.ts +++ b/src/components/leaflet-tile-layer.ts @@ -3,7 +3,7 @@ import { buildOptions, buildAttrMap, setLayerAttr } from '../core/utils.js'; import { withProps } from '../core/with-props.js'; import { registerChildren, unregisterChildren } from '../core/register.js'; -import type { PropDef } from '../types/props.js'; +import type { PropDef } from '../core/props.js'; const PROPS = { url: { kind: 'str', attr: 'url', default: '' }, diff --git a/src/components/leaflet-tooltip.ts b/src/components/leaflet-tooltip.ts index 8d4c85a..4d1fb94 100644 --- a/src/components/leaflet-tooltip.ts +++ b/src/components/leaflet-tooltip.ts @@ -3,7 +3,7 @@ import type { TooltipOptions } from 'leaflet'; import { registerWithParent, buildOptions, numAttr } from '../core/utils.js'; import { withProps } from '../core/with-props.js'; -import type { PropDef } from '../types/props.js'; +import type { PropDef } from '../core/props.js'; const PROPS = { lat: { kind: 'num', attr: 'lat', default: 0 }, diff --git a/src/components/leaflet-video-overlay.ts b/src/components/leaflet-video-overlay.ts index 26a4468..03425d6 100644 --- a/src/components/leaflet-video-overlay.ts +++ b/src/components/leaflet-video-overlay.ts @@ -4,7 +4,7 @@ import { buildOptions, buildAttrMap, setLayerAttr, parseBoundsAttr } from '../co import { withProps } from '../core/with-props.js'; import { registerChildren, unregisterChildren } from '../core/register.js'; -import type { PropDef } from '../types/props.js'; +import type { PropDef } from '../core/props.js'; const PROPS = { url: { kind: 'str', attr: 'url', default: '' }, diff --git a/src/types/props.ts b/src/core/props.ts similarity index 100% rename from src/types/props.ts rename to src/core/props.ts diff --git a/src/core/utils.ts b/src/core/utils.ts index 3faf660..0ee7f41 100644 --- a/src/core/utils.ts +++ b/src/core/utils.ts @@ -1,4 +1,4 @@ -import type { PropDef, PropTypesFromTable } from '../types/props.js'; +import type { PropDef, PropTypesFromTable } from './props.js'; import type { LatLngBoundsExpression } from 'leaflet'; // Parses an HTML attribute string into a typed JS value: diff --git a/src/core/with-props.ts b/src/core/with-props.ts index d07a538..23720e2 100644 --- a/src/core/with-props.ts +++ b/src/core/with-props.ts @@ -1,4 +1,4 @@ -import type { PropDef, PropTypesFromTable } from '../types/props.js'; +import type { PropDef, PropTypesFromTable } from './props.js'; import { definePropAccessors } from './utils.js'; // eslint-disable-next-line @typescript-eslint/no-explicit-any diff --git a/src/index.ts b/src/index.ts index 2c39dae..67ce946 100644 --- a/src/index.ts +++ b/src/index.ts @@ -2,7 +2,7 @@ export * from './core/utils.js'; export * from './core/with-props.js'; export * from './core/path-style.js'; export * from './core/register.js'; -export * from './types/props.js'; +export * from './core/props.js'; export * from './components/leaflet-map.js'; export * from './components/leaflet-marker.js'; export * from './components/leaflet-circle.js';