refactor: use defineProps with str() in icon components
Switch leaflet-icon and leaflet-div-icon from bare { attr: '...' }
objects to defineProps(...) with str() factories, consistent with
all other components.
This commit is contained in:
parent
301f223938
commit
d6f7304313
@ -1,15 +1,16 @@
|
|||||||
import { DivIcon, DivIconOptions, Icon } from 'leaflet';
|
import { DivIcon, DivIconOptions, Icon } from 'leaflet';
|
||||||
|
import { defineProps, str } from '../core/props.ts';
|
||||||
import { emitIconChanged } from '../core/register.ts';
|
import { emitIconChanged } from '../core/register.ts';
|
||||||
|
|
||||||
const PROPS = {
|
const PROPS = defineProps({
|
||||||
iconSize: { attr: 'icon-size' },
|
iconSize: str(),
|
||||||
iconAnchor: { attr: 'icon-anchor' },
|
iconAnchor: str(),
|
||||||
popupAnchor: { attr: 'popup-anchor' },
|
popupAnchor: str(),
|
||||||
tooltipAnchor: { attr: 'tooltip-anchor' },
|
tooltipAnchor: str(),
|
||||||
className: { attr: 'class-name' },
|
className: str(),
|
||||||
html: { attr: 'html' },
|
html: str(),
|
||||||
bgPos: { attr: 'bg-pos' },
|
bgPos: str(),
|
||||||
} as const;
|
});
|
||||||
|
|
||||||
const JSON_KEYS = new Set(['iconSize', 'iconAnchor', 'popupAnchor', 'tooltipAnchor', 'bgPos']);
|
const JSON_KEYS = new Set(['iconSize', 'iconAnchor', 'popupAnchor', 'tooltipAnchor', 'bgPos']);
|
||||||
|
|
||||||
|
|||||||
@ -1,19 +1,20 @@
|
|||||||
import { Icon, IconOptions } from 'leaflet';
|
import { Icon, IconOptions } from 'leaflet';
|
||||||
|
import { defineProps, str } from '../core/props.ts';
|
||||||
import { emitIconChanged } from '../core/register.ts';
|
import { emitIconChanged } from '../core/register.ts';
|
||||||
|
|
||||||
const PROPS = {
|
const PROPS = defineProps({
|
||||||
iconUrl: { attr: 'icon-url' },
|
iconUrl: str(),
|
||||||
iconRetinaUrl: { attr: 'icon-retina-url' },
|
iconRetinaUrl: str(),
|
||||||
iconSize: { attr: 'icon-size' },
|
iconSize: str(),
|
||||||
iconAnchor: { attr: 'icon-anchor' },
|
iconAnchor: str(),
|
||||||
popupAnchor: { attr: 'popup-anchor' },
|
popupAnchor: str(),
|
||||||
tooltipAnchor: { attr: 'tooltip-anchor' },
|
tooltipAnchor: str(),
|
||||||
shadowUrl: { attr: 'shadow-url' },
|
shadowUrl: str(),
|
||||||
shadowRetinaUrl: { attr: 'shadow-retina-url' },
|
shadowRetinaUrl: str(),
|
||||||
shadowSize: { attr: 'shadow-size' },
|
shadowSize: str(),
|
||||||
shadowAnchor: { attr: 'shadow-anchor' },
|
shadowAnchor: str(),
|
||||||
className: { attr: 'class-name' },
|
className: str(),
|
||||||
} as const;
|
});
|
||||||
|
|
||||||
const JSON_KEYS = new Set([
|
const JSON_KEYS = new Set([
|
||||||
'iconSize',
|
'iconSize',
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user