Skip to content

Commit a92a6bc

Browse files
committed
v3 wip
1 parent 3a42474 commit a92a6bc

33 files changed

+2773
-381
lines changed

.prettierrc

+47-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,48 @@
11
{
2-
"semi": false,
3-
"singleQuote": true
4-
}
2+
"semi": false,
3+
"singleQuote": true,
4+
"plugins": ["@homer0/prettier-plugin-jsdoc"],
5+
"jsdocAllowDescriptionOnNewLinesForTags": ["remarks"],
6+
"jsdocTagsOrder": [
7+
"type",
8+
"typedef",
9+
"callback",
10+
"function",
11+
"method",
12+
"class",
13+
"file",
14+
"constant",
15+
"description",
16+
"remarks",
17+
"classdesc",
18+
"param",
19+
"property",
20+
"returns",
21+
"template",
22+
"augments",
23+
"extends",
24+
"throws",
25+
"yields",
26+
"fires",
27+
"listens",
28+
"async",
29+
"abstract",
30+
"override",
31+
"private",
32+
"protected",
33+
"public",
34+
"access",
35+
"desprecated",
36+
"author",
37+
"version",
38+
"since",
39+
"member",
40+
"memberof",
41+
"category",
42+
"external",
43+
"see",
44+
"example",
45+
"other",
46+
"todo"
47+
]
48+
}

README.md

+8-5
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,17 @@
66
</p>
77
<p align="center">
88
📍 Use a React component as <a href="https://react-leaflet.js.org/">React Leaflet</a> markers.<br/>
9-
🔄 Familiar swap-in API that feels like React Leaflet.<br/>
9+
🔄 Swap-in API that feels like React Leaflet (yup, popups & tooltips too).<br/>
1010
✨ Can use state, context etc. It's a full component. No BS.<br/>
11-
💪 It's strongly typed.
11+
🖼️ Powerful layout options with sensible automated defaults. Put your icon where you want.
12+
💪 It's a strongly typed ESM package, automatically tested against a real browser.
1213
</p>
1314

1415
# What is it
1516

16-
A tiny wrapper for [react-leaflet](https://react-leaflet.js.org/)'s `<Marker />` component that allows you to use a React component as a marker, with **working state, handlers, and access to parent contexts**.
17+
A wrapper for [react-leaflet](https://react-leaflet.js.org/)'s `<Marker />` component that allows you to use a React component as a marker icon, with **working state, handlers, and access to parent contexts**. It also works with existing [react-leaflet](https://react-leaflet.js.org/) functionality that supplements markers, i.e. `<Popup>` and `<Tooltip>`.
18+
19+
It handles markers of any size (dynamically) and positioning is handled for you. If you like, you can also tune this with a sensible API that hides away Leaflet's cumbersome absolute-pixel-offsets approach. Want your icon anchored below the coordinates rather than above? No problem.
1720

1821
The approach this library uses differs from other approaches that use `renderToString` in that it instead uses React's [Portal](https://react.dev/reference/react-dom/createPortal) functionality to achieve the effect. That means the component is not static, but a full first-class component that can have its own state, event handlers & lifecycle.
1922

@@ -96,7 +99,7 @@ Below is a list of properties this object can be provided.
9699
The `layoutMode` controls how the bounding box of the React component marker behaves. It accepts two options:
97100

98101
- `fit-content` _(default)_. In this mode, the React component itself defines the dimensions of the marker. The component can shrink and expand at will. Logic internally to this library centers the component on its coordinates to match Leaflets default positioning; however, Leaflet itself is effectively no longer in control of this.
99-
- `fit-parent`. In this mode, the dimensions of the React component marker are bound by the `iconSize` passed to `componentIconOpts.rootDivOpts`. Leaflet is therefore in control of the dimensions and positioning. Component markers should use elements with 100% width & height to fill the available size if needed.
102+
- `fit-parent`. In this mode, the dimensions of the React component marker are bound by the `iconSize` passed to `componentIconOpts.manualLayoutOpts`. Leaflet is therefore in control of the dimensions and positioning. Component markers should use elements with 100% width & height to fill the available size if needed.
100103

101104
#### `rootDivOpts`
102105

@@ -129,4 +132,4 @@ Can be set to `false` in order to not warn in console about cases where `compone
129132

130133
`true` by default.
131134

132-
Can be set to `false` in order to not warn in console about cases where the `layoutMode` was `fit-parent` but their was no `iconSize` defined in the `rootDivOpts`.
135+
Can be set to `false` in order to not warn in console about cases where the `layoutMode` was `fit-parent` but their was no `iconSize` defined in the `manualLayoutOpts`.

0 commit comments

Comments
 (0)