@deck.gl-community/react 9.2.0-beta.2 → 9.2.0-beta.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -35,10 +35,6 @@ var __publicField = (obj, key, value) => {
35
35
  var dist_exports = {};
36
36
  __export(dist_exports, {
37
37
  Button: () => Button,
38
- HtmlClusterOverlay: () => HtmlClusterOverlay,
39
- HtmlOverlay: () => HtmlOverlay,
40
- HtmlOverlayItem: () => HtmlOverlayItem,
41
- HtmlTooltipOverlay: () => HtmlTooltipOverlay,
42
38
  Icon: () => Icon,
43
39
  LongPressButton: () => LongPressButton,
44
40
  Modal: () => EditorModal
@@ -170,190 +166,4 @@ var import_boxicons = require("boxicons");
170
166
  function Icon(props) {
171
167
  return React3.createElement("box-icon", { color: "currentColor", ...props });
172
168
  }
173
-
174
- // dist/overlays/html-overlay.js
175
- var React4 = __toESM(require("react"), 1);
176
- var styles = {
177
- mainContainer: {
178
- width: "100%",
179
- height: "100%",
180
- position: "absolute",
181
- pointerEvents: "none",
182
- overflow: "hidden"
183
- }
184
- };
185
- var HtmlOverlay = class extends React4.Component {
186
- // Override this to provide your items
187
- getItems() {
188
- const { children } = this.props;
189
- if (children) {
190
- return Array.isArray(children) ? children : [children];
191
- }
192
- return [];
193
- }
194
- getCoords(coordinates) {
195
- const pos = this.props.viewport.project(coordinates);
196
- if (!pos)
197
- return [-1, -1];
198
- return pos;
199
- }
200
- inView([x, y]) {
201
- const { viewport, overflowMargin = 0 } = this.props;
202
- const { width, height } = viewport;
203
- return !(x < -overflowMargin || y < -overflowMargin || x > width + overflowMargin || y > height + overflowMargin);
204
- }
205
- scaleWithZoom(n) {
206
- const { zoom } = this.props.viewport;
207
- return n / Math.pow(2, 20 - zoom);
208
- }
209
- breakpointWithZoom(threshold, a, b) {
210
- const { zoom } = this.props.viewport;
211
- return zoom > threshold ? a : b;
212
- }
213
- getViewport() {
214
- return this.props.viewport;
215
- }
216
- getZoom() {
217
- return this.props.viewport.zoom;
218
- }
219
- render() {
220
- const { zIndex = 1 } = this.props;
221
- const style = Object.assign({ zIndex }, styles.mainContainer);
222
- const renderItems = [];
223
- this.getItems().filter(Boolean).forEach((item, index) => {
224
- const [x, y] = this.getCoords(item.props.coordinates);
225
- if (this.inView([x, y])) {
226
- const key = item.key === null || item.key === void 0 ? index : item.key;
227
- renderItems.push(React4.cloneElement(item, { x, y, key }));
228
- }
229
- });
230
- return React4.createElement("div", { style }, renderItems);
231
- }
232
- };
233
- // This is needed for Deck.gl 8.0+
234
- __publicField(HtmlOverlay, "deckGLViewProps", true);
235
-
236
- // dist/overlays/html-overlay-item.js
237
- var React5 = __toESM(require("react"), 1);
238
- var HtmlOverlayItem = class extends React5.Component {
239
- render() {
240
- const {
241
- x,
242
- y,
243
- children,
244
- style,
245
- /* coordinates, */
246
- ...props
247
- } = this.props;
248
- const { zIndex = "auto", ...remainingStyle } = style || {};
249
- return (
250
- // Using transform translate to position overlay items will result in a smooth zooming
251
- // effect, whereas using the top/left css properties will cause overlay items to
252
- // jiggle when zooming
253
- React5.createElement(
254
- "div",
255
- { style: { transform: `translate(${x}px, ${y}px)`, position: "absolute", zIndex } },
256
- React5.createElement("div", { style: { userSelect: "none", ...remainingStyle }, ...props }, children)
257
- )
258
- );
259
- }
260
- };
261
-
262
- // dist/overlays/html-cluster-overlay.js
263
- var import_helpers = require("@turf/helpers");
264
- var import_supercluster = __toESM(require("supercluster"), 1);
265
- var HtmlClusterOverlay = class extends HtmlOverlay {
266
- _superCluster;
267
- _lastObjects = null;
268
- getItems() {
269
- const newObjects = this.getAllObjects();
270
- if (newObjects !== this._lastObjects) {
271
- this._superCluster = new import_supercluster.default(this.getClusterOptions());
272
- this._superCluster.load(newObjects.map((object) => (0, import_helpers.point)(this.getObjectCoordinates(object), { object })));
273
- this._lastObjects = newObjects;
274
- }
275
- const clusters = this._superCluster.getClusters([-180, -90, 180, 90], Math.round(this.getZoom()));
276
- return clusters.map(({ geometry: { coordinates }, properties: { cluster, point_count: pointCount, cluster_id: clusterId, object } }) => cluster ? this.renderCluster(coordinates, clusterId, pointCount) : this.renderObject(coordinates, object));
277
- }
278
- getClusterObjects(clusterId) {
279
- return this._superCluster.getLeaves(clusterId, Infinity).map((object) => object.properties.object);
280
- }
281
- // Override to provide items that need clustering.
282
- // If the items have not changed please provide the same array to avoid
283
- // regeneration of the cluster which causes performance issues.
284
- getAllObjects() {
285
- return [];
286
- }
287
- // override to provide coordinates for each object of getAllObjects()
288
- getObjectCoordinates(obj) {
289
- return [0, 0];
290
- }
291
- // Get options object used when instantiating supercluster
292
- getClusterOptions() {
293
- return {
294
- maxZoom: 20
295
- };
296
- }
297
- // override to return an HtmlOverlayItem
298
- renderObject(coordinates, obj) {
299
- return null;
300
- }
301
- // override to return an HtmlOverlayItem
302
- // use getClusterObjects() to get cluster contents
303
- renderCluster(coordinates, clusterId, pointCount) {
304
- return null;
305
- }
306
- };
307
-
308
- // dist/overlays/html-tooltip-overlay.js
309
- var React6 = __toESM(require("react"), 1);
310
- var styles2 = {
311
- tooltip: {
312
- transform: "translate(-50%,-100%)",
313
- backgroundColor: "rgba(0, 0, 0, 0.3)",
314
- padding: "4px 8px",
315
- borderRadius: 8,
316
- color: "white"
317
- }
318
- };
319
- var SHOW_TOOLTIP_TIMEOUT = 250;
320
- var HtmlTooltipOverlay = class extends HtmlOverlay {
321
- constructor(props) {
322
- super(props);
323
- this.state = { visible: false, pickingInfo: null };
324
- }
325
- componentWillMount() {
326
- this.context.nebula.queryObjectEvents.on("pick", ({ event, pickingInfo }) => {
327
- if (this.timeoutID !== null) {
328
- window.clearTimeout(this.timeoutID);
329
- }
330
- this.timeoutID = null;
331
- if (pickingInfo && this._getTooltip(pickingInfo)) {
332
- this.timeoutID = window.setTimeout(() => {
333
- this.setState({ visible: true, pickingInfo });
334
- }, SHOW_TOOLTIP_TIMEOUT);
335
- } else {
336
- this.setState({ visible: false });
337
- }
338
- });
339
- }
340
- timeoutID = null;
341
- state = void 0;
342
- _getTooltip(pickingInfo) {
343
- return pickingInfo.object.style.tooltip;
344
- }
345
- _makeOverlay() {
346
- const { pickingInfo } = this.state;
347
- if (pickingInfo) {
348
- return React6.createElement(HtmlOverlayItem, { key: 0, coordinates: pickingInfo.lngLat, style: styles2.tooltip }, this._getTooltip(pickingInfo));
349
- }
350
- return null;
351
- }
352
- getItems() {
353
- if (this.state.visible) {
354
- return [this._makeOverlay()];
355
- }
356
- return [];
357
- }
358
- };
359
169
  //# sourceMappingURL=index.cjs.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
- "sources": ["../src/index.ts", "../src/components/long-press-button.tsx", "../src/components/modal.tsx", "../src/components/icon.tsx", "../src/overlays/html-overlay.tsx", "../src/overlays/html-overlay-item.tsx", "../src/overlays/html-cluster-overlay.ts", "../src/overlays/html-tooltip-overlay.tsx"],
4
- "sourcesContent": ["// deck.gl-community\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\n// Components (originally from @deck.gl-community/graph-layers)\n\nexport {LongPressButton} from './components/long-press-button';\n\n// Components (originally from @nebula.gl/editor)\n\nexport {EditorModal as Modal} from './components/modal';\nexport {Button} from './components/modal';\nexport {Icon} from './components/icon';\n\n// Overlays (originally from @nebula.gl/overlays)\n\nexport {HtmlOverlay} from './overlays/html-overlay';\nexport {HtmlOverlayItem} from './overlays/html-overlay-item';\nexport {HtmlClusterOverlay} from './overlays/html-cluster-overlay';\n\nexport {HtmlTooltipOverlay} from './overlays/html-tooltip-overlay';\n", "// deck.gl-community\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport React, {PureComponent} from 'react';\nimport PropTypes from 'prop-types';\n\nexport class LongPressButton extends PureComponent {\n static propTypes = {\n onClick: PropTypes.func.isRequired,\n // eslint-disable-next-line react/forbid-prop-types\n children: PropTypes.any.isRequired\n };\n\n buttonPressTimer: ReturnType<typeof setTimeout> | null = null;\n\n _repeat = () => {\n if (this.buttonPressTimer) {\n (this.props as any).onClick();\n this.buttonPressTimer = setTimeout(this._repeat, 100);\n }\n };\n\n _handleButtonPress = () => {\n this.buttonPressTimer = setTimeout(this._repeat, 100);\n };\n\n _handleButtonRelease = () => {\n if (this.buttonPressTimer) {\n clearTimeout(this.buttonPressTimer);\n }\n this.buttonPressTimer = null;\n };\n\n render() {\n return (\n <div\n onMouseDown={(event) => {\n this._handleButtonPress();\n document.addEventListener('mouseup', this._handleButtonRelease, {once: true});\n }}\n >\n {(this.props as any).children}\n </div>\n );\n }\n}\n", "// deck.gl-community\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\n// @ts-nocheck This modal file should be phased out.\n\n/* eslint-env browser */\n\nimport * as React from 'react';\nimport Modal, {ModalProvider} from 'styled-react-modal';\nimport styled from 'styled-components';\n\nexport const Button = styled.button`\n display: inline-block;\n color: #fff;\n background-color: rgb(90, 98, 94);\n font-size: 1em;\n margin: 0.25em;\n padding: 0.375em 0.75em;\n border: 1px solid transparent;\n border-radius: 0.25em;\n display: block;\n`;\n\nconst StyledModal = Modal.styled`\n position: relative;\n display: block;\n width: 50rem;\n height: auto;\n max-width: 500px;\n margin: 1.75rem auto;\n box-sizing: border-box;\n font-family: -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, \"Helvetica Neue\", Arial, \"Noto Sans\", sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\", \"Segoe UI Symbol\", \"Noto Color Emoji\";\n font-size: 1rem;\n font-weight: 400;\n color: rgb(21, 25, 29);\n line-height: 1.5;\n text-align: left;\n`;\n\nconst Content = styled.div`\n position: relative;\n display: flex;\n flex-direction: column;\n width: 100%;\n pointer-events: auto;\n background-color: #fff;\n background-clip: padding-box;\n border: 1px solid rgba(0, 0, 0, 0.2);\n border-radius: 0.3rem;\n outline: 0;\n`;\n\nconst HeaderRow = styled.div`\n display: flex;\n align-items: flex-start;\n justify-content: space-between;\n padding: 0.75rem 0.75rem;\n border-bottom: 1px solid rgb(222, 226, 230);\n`;\n\nconst Header = styled.h5`\n font-size: 1.25rem;\n font-weight: 500;\n margin: 0;\n`;\n\nexport type ModalProps = {\n title: any;\n content: any;\n onClose: () => unknown;\n};\n\nexport function EditorModal(props: ModalProps) {\n const [isOpen, setIsOpen] = React.useState(true);\n\n function toggleModal() {\n if (isOpen) {\n props.onClose();\n }\n setIsOpen(!isOpen);\n }\n\n return (\n <>\n <ModalProvider>\n <StyledModal isOpen={isOpen} onBackgroundClick={toggleModal} onEscapeKeydown={toggleModal}>\n <Content>\n <HeaderRow>\n <Header>{props.title}</Header>\n </HeaderRow>\n {props.content}\n </Content>\n </StyledModal>\n </ModalProvider>\n </>\n );\n}\n", "// deck.gl-community\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport * as React from 'react';\nimport 'boxicons';\n\nexport function Icon(props) {\n // @ts-expect-error TODO\n return <box-icon color=\"currentColor\" {...props} />;\n}\n", "// deck.gl-community\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport * as React from 'react';\n\nconst styles = {\n mainContainer: {\n width: '100%',\n height: '100%',\n position: 'absolute',\n pointerEvents: 'none',\n overflow: 'hidden'\n }\n};\n\ninterface Props {\n viewport?: Record<string, any>;\n zIndex?: number;\n children?: React.ReactNode;\n // Overlay items abruptly disappear when their anchor point passes the edge of the map, which is\n // visible to the user. The overflowMargin prop is used to effectively create a hidden buffer\n // zone that extends from all sides of the map while leaving the visible edge of the map\n // unchanged. With this, overlay items can move into the buffer zone and disappear only when\n // their anchor passes the edge of the buffer zone. This produces a perceived effect of overlay\n // items being rendered as part of the map, instead of separate entities tacked on to the map.\n overflowMargin?: number;\n}\n\nexport class HtmlOverlay extends React.Component<Props> {\n // This is needed for Deck.gl 8.0+\n static deckGLViewProps = true;\n\n // Override this to provide your items\n getItems(): Array<any> {\n const {children} = this.props;\n if (children) {\n return Array.isArray(children) ? children : [children];\n }\n return [];\n }\n\n getCoords(coordinates: number[]): [number, number] {\n const pos = this.props.viewport.project(coordinates);\n if (!pos) return [-1, -1];\n return pos;\n }\n\n inView([x, y]: number[]): boolean {\n const {viewport, overflowMargin = 0} = this.props;\n const {width, height} = viewport;\n return !(\n x < -overflowMargin ||\n y < -overflowMargin ||\n x > width + overflowMargin ||\n y > height + overflowMargin\n );\n }\n\n scaleWithZoom(n: number) {\n const {zoom} = this.props.viewport;\n return n / Math.pow(2, 20 - zoom);\n }\n\n breakpointWithZoom(threshold: number, a: any, b: any): any {\n const {zoom} = this.props.viewport;\n return zoom > threshold ? a : b;\n }\n\n getViewport() {\n return this.props.viewport;\n }\n\n getZoom() {\n return this.props.viewport.zoom;\n }\n\n render() {\n const {zIndex = 1} = this.props;\n const style = Object.assign({zIndex} as any, styles.mainContainer);\n\n const renderItems = [];\n this.getItems()\n .filter(Boolean)\n .forEach((item, index) => {\n const [x, y] = this.getCoords(item.props.coordinates);\n if (this.inView([x, y])) {\n const key = item.key === null || item.key === undefined ? index : item.key;\n renderItems.push(React.cloneElement(item, {x, y, key}));\n }\n });\n\n return <div style={style}>{renderItems}</div>;\n }\n}\n", "// deck.gl-community\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport * as React from 'react';\n\ntype Props = {\n // Injected by HtmlOverlay\n x?: number;\n y?: number;\n\n // User provided\n coordinates: number[];\n children: any;\n style?: Record<string, any>;\n};\n\nexport class HtmlOverlayItem extends React.Component<Props> {\n render() {\n const {x, y, children, style, /* coordinates, */ ...props} = this.props;\n const {zIndex = 'auto', ...remainingStyle} = style || {};\n\n return (\n // Using transform translate to position overlay items will result in a smooth zooming\n // effect, whereas using the top/left css properties will cause overlay items to\n // jiggle when zooming\n <div style={{transform: `translate(${x}px, ${y}px)`, position: 'absolute', zIndex}}>\n <div style={{userSelect: 'none', ...remainingStyle}} {...props}>\n {children}\n </div>\n </div>\n );\n }\n}\n", "// deck.gl-community\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport {point} from '@turf/helpers';\nimport Supercluster from 'supercluster';\nimport {HtmlOverlay} from './html-overlay';\n\nexport class HtmlClusterOverlay<ObjType> extends HtmlOverlay {\n _superCluster: Supercluster;\n _lastObjects: ObjType[] | null | undefined = null;\n\n getItems(): Record<string, any>[] {\n // supercluster().load() is expensive and we want to run it only\n // when necessary and not for every frame.\n\n // TODO: Warn if this is running many times / sec\n\n const newObjects = this.getAllObjects();\n if (newObjects !== this._lastObjects) {\n this._superCluster = new Supercluster(this.getClusterOptions());\n this._superCluster.load(\n newObjects.map((object) => point(this.getObjectCoordinates(object), {object}))\n );\n this._lastObjects = newObjects;\n // console.log('new Supercluster() run');\n }\n\n const clusters = this._superCluster.getClusters(\n [-180, -90, 180, 90],\n Math.round(this.getZoom())\n );\n\n return clusters.map(\n ({\n geometry: {coordinates},\n properties: {cluster, point_count: pointCount, cluster_id: clusterId, object}\n }) =>\n cluster\n ? this.renderCluster(coordinates, clusterId, pointCount)\n : this.renderObject(coordinates, object)\n );\n }\n\n getClusterObjects(clusterId: number): ObjType[] {\n return this._superCluster\n .getLeaves(clusterId, Infinity)\n .map((object) => object.properties.object);\n }\n\n // Override to provide items that need clustering.\n // If the items have not changed please provide the same array to avoid\n // regeneration of the cluster which causes performance issues.\n getAllObjects(): ObjType[] {\n return [];\n }\n\n // override to provide coordinates for each object of getAllObjects()\n getObjectCoordinates(obj: ObjType): [number, number] {\n return [0, 0];\n }\n\n // Get options object used when instantiating supercluster\n getClusterOptions(): Record<string, any> | null | undefined {\n return {\n maxZoom: 20\n };\n }\n\n // override to return an HtmlOverlayItem\n renderObject(coordinates: number[], obj: ObjType): Record<string, any> | null | undefined {\n return null;\n }\n\n // override to return an HtmlOverlayItem\n // use getClusterObjects() to get cluster contents\n renderCluster(\n coordinates: number[],\n clusterId: number,\n pointCount: number\n ): Record<string, any> | null | undefined {\n return null;\n }\n}\n", "// deck.gl-community\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport * as React from 'react';\n\nimport {HtmlOverlay} from './html-overlay';\nimport {HtmlOverlayItem} from './html-overlay-item';\n\ntype State = {\n visible: boolean;\n pickingInfo: Record<string, any> | null | undefined;\n};\n\nconst styles = {\n tooltip: {\n transform: 'translate(-50%,-100%)',\n backgroundColor: 'rgba(0, 0, 0, 0.3)',\n padding: '4px 8px',\n borderRadius: 8,\n color: 'white'\n }\n};\n\nconst SHOW_TOOLTIP_TIMEOUT = 250;\n\nexport class HtmlTooltipOverlay extends HtmlOverlay {\n constructor(props: any) {\n super(props);\n this.state = {visible: false, pickingInfo: null};\n }\n\n componentWillMount() {\n (this.context as any).nebula.queryObjectEvents.on('pick', ({event, pickingInfo}) => {\n if (this.timeoutID !== null) {\n window.clearTimeout(this.timeoutID);\n }\n this.timeoutID = null;\n\n if (pickingInfo && this._getTooltip(pickingInfo)) {\n this.timeoutID = window.setTimeout(() => {\n this.setState({visible: true, pickingInfo});\n }, SHOW_TOOLTIP_TIMEOUT);\n } else {\n this.setState({visible: false});\n }\n });\n }\n\n timeoutID: number | null | undefined = null;\n state: State = undefined!;\n\n _getTooltip(pickingInfo: Record<string, any>): string {\n return pickingInfo.object.style.tooltip;\n }\n\n _makeOverlay() {\n const {pickingInfo} = this.state;\n\n if (pickingInfo) {\n return (\n <HtmlOverlayItem key={0} coordinates={pickingInfo.lngLat} style={styles.tooltip}>\n {this._getTooltip(pickingInfo)}\n </HtmlOverlayItem>\n );\n }\n\n return null;\n }\n\n getItems(): Array<Record<string, any> | null | undefined> {\n if (this.state.visible) {\n return [this._makeOverlay()];\n }\n\n return [];\n }\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;;;;;ACIA,mBAAmC;AACnC,wBAAsB;AAEhB,IAAO,kBAAP,cAA+B,2BAAa;EAOhD,mBAAyD;EAEzD,UAAU,MAAK;AACb,QAAI,KAAK,kBAAkB;AACxB,WAAK,MAAc,QAAO;AAC3B,WAAK,mBAAmB,WAAW,KAAK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vC,QAAe;EAEf,YAAY,aAAgC;AAC1C,WAAO,YAAY,OAAO,MAAM;EAClC;EAEA,eAAY;AACV,UAAM,EAAC,YAAW,IAAI,KAAK;AAE3B,QAAI,aAAa;AACf,aACE,qBAAC,iBAAe,EAAC,KAAK,GAAG,aAAa,YAAY,QAAQ,OAAOA,QAAO,QAAO,GAC5E,KAAK,YAAY,WAAW,CAAC;IAGpC;AAEA,WAAO;EACT;EAEA,WAAQ;AACN,QAAI,KAAK,MAAM,SAAS;AACtB,aAAO,CAAC,KAAK,aAAY,CAAE;IAC7B;AAEA,WAAO,CAAA;EACT;;",
6
- "names": ["React", "PropTypes", "React", "styled", "Modal", "React", "React", "React", "Supercluster", "React", "styles"]
3
+ "sources": ["../src/index.ts", "../src/components/long-press-button.tsx", "../src/components/modal.tsx", "../src/components/icon.tsx"],
4
+ "sourcesContent": ["// deck.gl-community\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\n// Components (originally from @deck.gl-community/graph-layers)\n\nexport {LongPressButton} from './components/long-press-button';\n\n// Components (originally from @nebula.gl/editor)\n\nexport {EditorModal as Modal} from './components/modal';\nexport {Button} from './components/modal';\nexport {Icon} from './components/icon';\n\n// Overlays migrated to @deck.gl-community/widgets\n", "// deck.gl-community\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport React, {PureComponent} from 'react';\nimport PropTypes from 'prop-types';\n\nexport class LongPressButton extends PureComponent {\n static propTypes = {\n onClick: PropTypes.func.isRequired,\n // eslint-disable-next-line react/forbid-prop-types\n children: PropTypes.any.isRequired\n };\n\n buttonPressTimer: ReturnType<typeof setTimeout> | null = null;\n\n _repeat = () => {\n if (this.buttonPressTimer) {\n (this.props as any).onClick();\n this.buttonPressTimer = setTimeout(this._repeat, 100);\n }\n };\n\n _handleButtonPress = () => {\n this.buttonPressTimer = setTimeout(this._repeat, 100);\n };\n\n _handleButtonRelease = () => {\n if (this.buttonPressTimer) {\n clearTimeout(this.buttonPressTimer);\n }\n this.buttonPressTimer = null;\n };\n\n render() {\n return (\n <div\n onMouseDown={(event) => {\n this._handleButtonPress();\n document.addEventListener('mouseup', this._handleButtonRelease, {once: true});\n }}\n >\n {(this.props as any).children}\n </div>\n );\n }\n}\n", "// deck.gl-community\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\n// @ts-nocheck This modal file should be phased out.\n\n/* eslint-env browser */\n\nimport * as React from 'react';\nimport Modal, {ModalProvider} from 'styled-react-modal';\nimport styled from 'styled-components';\n\nexport const Button = styled.button`\n display: inline-block;\n color: #fff;\n background-color: rgb(90, 98, 94);\n font-size: 1em;\n margin: 0.25em;\n padding: 0.375em 0.75em;\n border: 1px solid transparent;\n border-radius: 0.25em;\n display: block;\n`;\n\nconst StyledModal = Modal.styled`\n position: relative;\n display: block;\n width: 50rem;\n height: auto;\n max-width: 500px;\n margin: 1.75rem auto;\n box-sizing: border-box;\n font-family: -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, \"Helvetica Neue\", Arial, \"Noto Sans\", sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\", \"Segoe UI Symbol\", \"Noto Color Emoji\";\n font-size: 1rem;\n font-weight: 400;\n color: rgb(21, 25, 29);\n line-height: 1.5;\n text-align: left;\n`;\n\nconst Content = styled.div`\n position: relative;\n display: flex;\n flex-direction: column;\n width: 100%;\n pointer-events: auto;\n background-color: #fff;\n background-clip: padding-box;\n border: 1px solid rgba(0, 0, 0, 0.2);\n border-radius: 0.3rem;\n outline: 0;\n`;\n\nconst HeaderRow = styled.div`\n display: flex;\n align-items: flex-start;\n justify-content: space-between;\n padding: 0.75rem 0.75rem;\n border-bottom: 1px solid rgb(222, 226, 230);\n`;\n\nconst Header = styled.h5`\n font-size: 1.25rem;\n font-weight: 500;\n margin: 0;\n`;\n\nexport type ModalProps = {\n title: any;\n content: any;\n onClose: () => unknown;\n};\n\nexport function EditorModal(props: ModalProps) {\n const [isOpen, setIsOpen] = React.useState(true);\n\n function toggleModal() {\n if (isOpen) {\n props.onClose();\n }\n setIsOpen(!isOpen);\n }\n\n return (\n <>\n <ModalProvider>\n <StyledModal isOpen={isOpen} onBackgroundClick={toggleModal} onEscapeKeydown={toggleModal}>\n <Content>\n <HeaderRow>\n <Header>{props.title}</Header>\n </HeaderRow>\n {props.content}\n </Content>\n </StyledModal>\n </ModalProvider>\n </>\n );\n}\n", "// deck.gl-community\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport * as React from 'react';\nimport 'boxicons';\n\nexport function Icon(props) {\n // @ts-expect-error TODO\n return <box-icon color=\"currentColor\" {...props} />;\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;ACIA,mBAAmC;AACnC,wBAAsB;AAEhB,IAAO,kBAAP,cAA+B,2BAAa;EAOhD,mBAAyD;EAEzD,UAAU,MAAK;AACb,QAAI,KAAK,kBAAkB;AACxB,WAAK,MAAc,QAAO;AAC3B,WAAK,mBAAmB,WAAW,KAAK,SAAS,GAAG;IACtD;EACF;EAEA,qBAAqB,MAAK;AACxB,SAAK,mBAAmB,WAAW,KAAK,SAAS,GAAG;EACtD;EAEA,uBAAuB,MAAK;AAC1B,QAAI,KAAK,kBAAkB;AACzB,mBAAa,KAAK,gBAAgB;IACpC;AACA,SAAK,mBAAmB;EAC1B;EAEA,SAAM;AACJ,WACE,aAAAA,QAAA,cAAA,OAAA,EACE,aAAa,CAAC,UAAS;AACrB,WAAK,mBAAkB;AACvB,eAAS,iBAAiB,WAAW,KAAK,sBAAsB,EAAC,MAAM,KAAI,CAAC;IAC9E,EAAC,GAEC,KAAK,MAAc,QAAQ;EAGnC;;AArCA,cADW,iBACJ,aAAY;EACjB,SAAS,kBAAAC,QAAU,KAAK;;EAExB,UAAU,kBAAAA,QAAU,IAAI;;;;ACH5B,IAAAC,SAAuB;AACvB,gCAAmC;AACnC,+BAAmB;AAEZ,IAAM,SAAS,yBAAAC,QAAO;;;;;;;;;;;AAY7B,IAAM,cAAc,0BAAAC,QAAM;;;;;;;;;;;;;;;AAgB1B,IAAM,UAAU,yBAAAD,QAAO;;;;;;;;;;;;AAavB,IAAM,YAAY,yBAAAA,QAAO;;;;;;;AAQzB,IAAM,SAAS,yBAAAA,QAAO;;;;;AAYhB,SAAU,YAAY,OAAiB;AAC3C,QAAM,CAAC,QAAQ,SAAS,IAAU,gBAAS,IAAI;AAE/C,WAAS,cAAW;AAClB,QAAI,QAAQ;AACV,YAAM,QAAO;IACf;AACA,cAAU,CAAC,MAAM;EACnB;AAEA,SACE;IAAA;IAAA;IACE;MAAC;MAAa;MACZ;QAAC;QAAW,EAAC,QAAgB,mBAAmB,aAAa,iBAAiB,YAAW;QACvF;UAAC;UAAO;UACN;YAAC;YAAS;YACR,qBAAC,QAAM,MAAE,MAAM,KAAK;UAAU;UAE/B,MAAM;QAAO;MACN;IACE;EACA;AAGtB;;;AC7FA,IAAAE,SAAuB;AACvB,sBAAO;AAED,SAAU,KAAK,OAAK;AAExB,SAAO,qBAAA,YAAA,EAAU,OAAM,gBAAc,GAAK,MAAK,CAAA;AACjD;",
6
+ "names": ["React", "PropTypes", "React", "styled", "Modal", "React"]
7
7
  }
package/dist/index.d.ts CHANGED
@@ -2,8 +2,4 @@ export { LongPressButton } from "./components/long-press-button.js";
2
2
  export { EditorModal as Modal } from "./components/modal.js";
3
3
  export { Button } from "./components/modal.js";
4
4
  export { Icon } from "./components/icon.js";
5
- export { HtmlOverlay } from "./overlays/html-overlay.js";
6
- export { HtmlOverlayItem } from "./overlays/html-overlay-item.js";
7
- export { HtmlClusterOverlay } from "./overlays/html-cluster-overlay.js";
8
- export { HtmlTooltipOverlay } from "./overlays/html-tooltip-overlay.js";
9
5
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAMA,OAAO,EAAC,eAAe,EAAC,0CAAuC;AAI/D,OAAO,EAAC,WAAW,IAAI,KAAK,EAAC,8BAA2B;AACxD,OAAO,EAAC,MAAM,EAAC,8BAA2B;AAC1C,OAAO,EAAC,IAAI,EAAC,6BAA0B;AAIvC,OAAO,EAAC,WAAW,EAAC,mCAAgC;AACpD,OAAO,EAAC,eAAe,EAAC,wCAAqC;AAC7D,OAAO,EAAC,kBAAkB,EAAC,2CAAwC;AAEnE,OAAO,EAAC,kBAAkB,EAAC,2CAAwC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAMA,OAAO,EAAC,eAAe,EAAC,0CAAuC;AAI/D,OAAO,EAAC,WAAW,IAAI,KAAK,EAAC,8BAA2B;AACxD,OAAO,EAAC,MAAM,EAAC,8BAA2B;AAC1C,OAAO,EAAC,IAAI,EAAC,6BAA0B"}
package/dist/index.js CHANGED
@@ -7,9 +7,5 @@ export { LongPressButton } from "./components/long-press-button.js";
7
7
  export { EditorModal as Modal } from "./components/modal.js";
8
8
  export { Button } from "./components/modal.js";
9
9
  export { Icon } from "./components/icon.js";
10
- // Overlays (originally from @nebula.gl/overlays)
11
- export { HtmlOverlay } from "./overlays/html-overlay.js";
12
- export { HtmlOverlayItem } from "./overlays/html-overlay-item.js";
13
- export { HtmlClusterOverlay } from "./overlays/html-cluster-overlay.js";
14
- export { HtmlTooltipOverlay } from "./overlays/html-tooltip-overlay.js";
10
+ // Overlays migrated to @deck.gl-community/widgets
15
11
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,oBAAoB;AACpB,+BAA+B;AAC/B,oCAAoC;AAEpC,+DAA+D;AAE/D,OAAO,EAAC,eAAe,EAAC,0CAAuC;AAE/D,iDAAiD;AAEjD,OAAO,EAAC,WAAW,IAAI,KAAK,EAAC,8BAA2B;AACxD,OAAO,EAAC,MAAM,EAAC,8BAA2B;AAC1C,OAAO,EAAC,IAAI,EAAC,6BAA0B;AAEvC,iDAAiD;AAEjD,OAAO,EAAC,WAAW,EAAC,mCAAgC;AACpD,OAAO,EAAC,eAAe,EAAC,wCAAqC;AAC7D,OAAO,EAAC,kBAAkB,EAAC,2CAAwC;AAEnE,OAAO,EAAC,kBAAkB,EAAC,2CAAwC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,oBAAoB;AACpB,+BAA+B;AAC/B,oCAAoC;AAEpC,+DAA+D;AAE/D,OAAO,EAAC,eAAe,EAAC,0CAAuC;AAE/D,iDAAiD;AAEjD,OAAO,EAAC,WAAW,IAAI,KAAK,EAAC,8BAA2B;AACxD,OAAO,EAAC,MAAM,EAAC,8BAA2B;AAC1C,OAAO,EAAC,IAAI,EAAC,6BAA0B;AAEvC,kDAAkD"}
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@deck.gl-community/react",
3
3
  "description": "React components for deck.gl",
4
4
  "license": "MIT",
5
- "version": "9.2.0-beta.2",
5
+ "version": "9.2.0-beta.4",
6
6
  "repository": {
7
7
  "type": "git",
8
8
  "url": "https://github.com/visgl/deck.gl-community"
@@ -34,16 +34,13 @@
34
34
  "src"
35
35
  ],
36
36
  "dependencies": {
37
- "@turf/helpers": "^6.5.0",
38
37
  "@types/styled-react-modal": "^1.2.5",
39
38
  "boxicons": "^2.1.4",
40
- "preact": "^10.17.0",
41
39
  "prop-types": "^15.8.1",
42
40
  "react": "^18.3.1",
43
41
  "react-dom": "^18.3.1",
44
42
  "styled-components": "^6.1.1",
45
- "styled-react-modal": "^3.1.1",
46
- "supercluster": "^8.0.1"
43
+ "styled-react-modal": "^3.1.1"
47
44
  },
48
- "gitHead": "b434bcba10800f27e95a7c9e6c4c7edd0b915773"
45
+ "gitHead": "7ca4f10b28c9b24546b8278dc4050dba37dc6da0"
49
46
  }
package/src/index.ts CHANGED
@@ -12,10 +12,4 @@ export {EditorModal as Modal} from './components/modal';
12
12
  export {Button} from './components/modal';
13
13
  export {Icon} from './components/icon';
14
14
 
15
- // Overlays (originally from @nebula.gl/overlays)
16
-
17
- export {HtmlOverlay} from './overlays/html-overlay';
18
- export {HtmlOverlayItem} from './overlays/html-overlay-item';
19
- export {HtmlClusterOverlay} from './overlays/html-cluster-overlay';
20
-
21
- export {HtmlTooltipOverlay} from './overlays/html-tooltip-overlay';
15
+ // Overlays migrated to @deck.gl-community/widgets
@@ -1,14 +0,0 @@
1
- import Supercluster from 'supercluster';
2
- import { HtmlOverlay } from "./html-overlay.js";
3
- export declare class HtmlClusterOverlay<ObjType> extends HtmlOverlay {
4
- _superCluster: Supercluster;
5
- _lastObjects: ObjType[] | null | undefined;
6
- getItems(): Record<string, any>[];
7
- getClusterObjects(clusterId: number): ObjType[];
8
- getAllObjects(): ObjType[];
9
- getObjectCoordinates(obj: ObjType): [number, number];
10
- getClusterOptions(): Record<string, any> | null | undefined;
11
- renderObject(coordinates: number[], obj: ObjType): Record<string, any> | null | undefined;
12
- renderCluster(coordinates: number[], clusterId: number, pointCount: number): Record<string, any> | null | undefined;
13
- }
14
- //# sourceMappingURL=html-cluster-overlay.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"html-cluster-overlay.d.ts","sourceRoot":"","sources":["../../src/overlays/html-cluster-overlay.ts"],"names":[],"mappings":"AAKA,OAAO,YAAY,MAAM,cAAc,CAAC;AACxC,OAAO,EAAC,WAAW,EAAC,0BAAuB;AAE3C,qBAAa,kBAAkB,CAAC,OAAO,CAAE,SAAQ,WAAW;IAC1D,aAAa,EAAE,YAAY,CAAC;IAC5B,YAAY,EAAE,OAAO,EAAE,GAAG,IAAI,GAAG,SAAS,CAAQ;IAElD,QAAQ,IAAI,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE;IAgCjC,iBAAiB,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,EAAE;IAS/C,aAAa,IAAI,OAAO,EAAE;IAK1B,oBAAoB,CAAC,GAAG,EAAE,OAAO,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC;IAKpD,iBAAiB,IAAI,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,IAAI,GAAG,SAAS;IAO3D,YAAY,CAAC,WAAW,EAAE,MAAM,EAAE,EAAE,GAAG,EAAE,OAAO,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,IAAI,GAAG,SAAS;IAMzF,aAAa,CACX,WAAW,EAAE,MAAM,EAAE,EACrB,SAAS,EAAE,MAAM,EACjB,UAAU,EAAE,MAAM,GACjB,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,IAAI,GAAG,SAAS;CAG1C"}
@@ -1,57 +0,0 @@
1
- // deck.gl-community
2
- // SPDX-License-Identifier: MIT
3
- // Copyright (c) vis.gl contributors
4
- import { point } from '@turf/helpers';
5
- import Supercluster from 'supercluster';
6
- import { HtmlOverlay } from "./html-overlay.js";
7
- export class HtmlClusterOverlay extends HtmlOverlay {
8
- _superCluster;
9
- _lastObjects = null;
10
- getItems() {
11
- // supercluster().load() is expensive and we want to run it only
12
- // when necessary and not for every frame.
13
- // TODO: Warn if this is running many times / sec
14
- const newObjects = this.getAllObjects();
15
- if (newObjects !== this._lastObjects) {
16
- this._superCluster = new Supercluster(this.getClusterOptions());
17
- this._superCluster.load(newObjects.map((object) => point(this.getObjectCoordinates(object), { object })));
18
- this._lastObjects = newObjects;
19
- // console.log('new Supercluster() run');
20
- }
21
- const clusters = this._superCluster.getClusters([-180, -90, 180, 90], Math.round(this.getZoom()));
22
- return clusters.map(({ geometry: { coordinates }, properties: { cluster, point_count: pointCount, cluster_id: clusterId, object } }) => cluster
23
- ? this.renderCluster(coordinates, clusterId, pointCount)
24
- : this.renderObject(coordinates, object));
25
- }
26
- getClusterObjects(clusterId) {
27
- return this._superCluster
28
- .getLeaves(clusterId, Infinity)
29
- .map((object) => object.properties.object);
30
- }
31
- // Override to provide items that need clustering.
32
- // If the items have not changed please provide the same array to avoid
33
- // regeneration of the cluster which causes performance issues.
34
- getAllObjects() {
35
- return [];
36
- }
37
- // override to provide coordinates for each object of getAllObjects()
38
- getObjectCoordinates(obj) {
39
- return [0, 0];
40
- }
41
- // Get options object used when instantiating supercluster
42
- getClusterOptions() {
43
- return {
44
- maxZoom: 20
45
- };
46
- }
47
- // override to return an HtmlOverlayItem
48
- renderObject(coordinates, obj) {
49
- return null;
50
- }
51
- // override to return an HtmlOverlayItem
52
- // use getClusterObjects() to get cluster contents
53
- renderCluster(coordinates, clusterId, pointCount) {
54
- return null;
55
- }
56
- }
57
- //# sourceMappingURL=html-cluster-overlay.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"html-cluster-overlay.js","sourceRoot":"","sources":["../../src/overlays/html-cluster-overlay.ts"],"names":[],"mappings":"AAAA,oBAAoB;AACpB,+BAA+B;AAC/B,oCAAoC;AAEpC,OAAO,EAAC,KAAK,EAAC,MAAM,eAAe,CAAC;AACpC,OAAO,YAAY,MAAM,cAAc,CAAC;AACxC,OAAO,EAAC,WAAW,EAAC,0BAAuB;AAE3C,MAAM,OAAO,kBAA4B,SAAQ,WAAW;IAC1D,aAAa,CAAe;IAC5B,YAAY,GAAiC,IAAI,CAAC;IAElD,QAAQ;QACN,gEAAgE;QAChE,0CAA0C;QAE1C,iDAAiD;QAEjD,MAAM,UAAU,GAAG,IAAI,CAAC,aAAa,EAAE,CAAC;QACxC,IAAI,UAAU,KAAK,IAAI,CAAC,YAAY,EAAE,CAAC;YACrC,IAAI,CAAC,aAAa,GAAG,IAAI,YAAY,CAAC,IAAI,CAAC,iBAAiB,EAAE,CAAC,CAAC;YAChE,IAAI,CAAC,aAAa,CAAC,IAAI,CACrB,UAAU,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,oBAAoB,CAAC,MAAM,CAAC,EAAE,EAAC,MAAM,EAAC,CAAC,CAAC,CAC/E,CAAC;YACF,IAAI,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AClD,aAAa,CACX,WAAqB,EACrB,SAAiB,EACjB,UAAkB;QAElB,OAAO,IAAI,CAAC;IACd,CAAC;CACF"}
@@ -1,13 +0,0 @@
1
- import * as React from 'react';
2
- type Props = {
3
- x?: number;
4
- y?: number;
5
- coordinates: number[];
6
- children: any;
7
- style?: Record<string, any>;
8
- };
9
- export declare class HtmlOverlayItem extends React.Component<Props> {
10
- render(): React.JSX.Element;
11
- }
12
- export {};
13
- //# sourceMappingURL=html-overlay-item.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"html-overlay-item.d.ts","sourceRoot":"","sources":["../../src/overlays/html-overlay-item.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,KAAK,KAAK,GAAG;IAEX,CAAC,CAAC,EAAE,MAAM,CAAC;IACX,CAAC,CAAC,EAAE,MAAM,CAAC;IAGX,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,QAAQ,EAAE,GAAG,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;CAC7B,CAAC;AAEF,qBAAa,eAAgB,SAAQ,KAAK,CAAC,SAAS,CAAC,KAAK,CAAC;IACzD,MAAM;CAeP"}
@@ -1,17 +0,0 @@
1
- // deck.gl-community
2
- // SPDX-License-Identifier: MIT
3
- // Copyright (c) vis.gl contributors
4
- import * as React from 'react';
5
- export class HtmlOverlayItem extends React.Component {
6
- render() {
7
- const { x, y, children, style, /* coordinates, */ ...props } = this.props;
8
- const { zIndex = 'auto', ...remainingStyle } = style || {};
9
- return (
10
- // Using transform translate to position overlay items will result in a smooth zooming
11
- // effect, whereas using the top/left css properties will cause overlay items to
12
- // jiggle when zooming
13
- React.createElement("div", { style: { transform: `translate(${x}px, ${y}px)`, position: 'absolute', zIndex } },
14
- React.createElement("div", { style: { userSelect: 'none', ...remainingStyle }, ...props }, children)));
15
- }
16
- }
17
- //# sourceMappingURL=html-overlay-item.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"html-overlay-item.js","sourceRoot":"","sources":["../../src/overlays/html-overlay-item.tsx"],"names":[],"mappings":"AAAA,oBAAoB;AACpB,+BAA+B;AAC/B,oCAAoC;AAEpC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAa/B,MAAM,OAAO,eAAgB,SAAQ,KAAK,CAAC,SAAgB;IACzD,MAAM;QACJ,MAAM,EAAC,CAAC,EAAE,CAAC,EAAE,QAAQ,EAAE,KAAK,EAAE,kBAAkB,CAAC,GAAG,KAAK,EAAC,GAAG,IAAI,CAAC,KAAK,CAAC;QACxE,MAAM,EAAC,MAAM,GAAG,MAAM,EAAE,GAAG,cAAc,EAAC,GAAG,KAAK,IAAI,EAAE,CAAC;QAEzD,OAAO;QACL,sFAAsF;QACtF,gFAAgF;QAChF,sBAAsB;QACtB,6BAAK,KAAK,EAAE,EAAC,SAAS,EAAE,aAAa,CAAC,OAAO,CAAC,KAAK,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,EAAC;YAChF,6BAAK,KAAK,EAAE,EAAC,UAAU,EAAE,MAAM,EAAE,GAAG,cAAc,EAAC,KAAM,KAAK,IAC3D,QAAQ,CACL,CACF,CACP,CAAC;IACJ,CAAC;CACF"}
@@ -1,20 +0,0 @@
1
- import * as React from 'react';
2
- interface Props {
3
- viewport?: Record<string, any>;
4
- zIndex?: number;
5
- children?: React.ReactNode;
6
- overflowMargin?: number;
7
- }
8
- export declare class HtmlOverlay extends React.Component<Props> {
9
- static deckGLViewProps: boolean;
10
- getItems(): Array<any>;
11
- getCoords(coordinates: number[]): [number, number];
12
- inView([x, y]: number[]): boolean;
13
- scaleWithZoom(n: number): number;
14
- breakpointWithZoom(threshold: number, a: any, b: any): any;
15
- getViewport(): Record<string, any>;
16
- getZoom(): any;
17
- render(): React.JSX.Element;
18
- }
19
- export {};
20
- //# sourceMappingURL=html-overlay.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"html-overlay.d.ts","sourceRoot":"","sources":["../../src/overlays/html-overlay.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAY/B,UAAU,KAAK;IACb,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC/B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAO3B,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAED,qBAAa,WAAY,SAAQ,KAAK,CAAC,SAAS,CAAC,KAAK,CAAC;IAErD,MAAM,CAAC,eAAe,UAAQ;IAG9B,QAAQ,IAAI,KAAK,CAAC,GAAG,CAAC;IAQtB,SAAS,CAAC,WAAW,EAAE,MAAM,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC;IAMlD,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,MAAM,EAAE,GAAG,OAAO;IAWjC,aAAa,CAAC,CAAC,EAAE,MAAM;IAKvB,kBAAkB,CAAC,SAAS,EAAE,MAAM,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,GAAG,GAAG;IAK1D,WAAW;IAIX,OAAO;IAIP,MAAM;CAiBP"}
@@ -1,69 +0,0 @@
1
- // deck.gl-community
2
- // SPDX-License-Identifier: MIT
3
- // Copyright (c) vis.gl contributors
4
- import * as React from 'react';
5
- const styles = {
6
- mainContainer: {
7
- width: '100%',
8
- height: '100%',
9
- position: 'absolute',
10
- pointerEvents: 'none',
11
- overflow: 'hidden'
12
- }
13
- };
14
- export class HtmlOverlay extends React.Component {
15
- // This is needed for Deck.gl 8.0+
16
- static deckGLViewProps = true;
17
- // Override this to provide your items
18
- getItems() {
19
- const { children } = this.props;
20
- if (children) {
21
- return Array.isArray(children) ? children : [children];
22
- }
23
- return [];
24
- }
25
- getCoords(coordinates) {
26
- const pos = this.props.viewport.project(coordinates);
27
- if (!pos)
28
- return [-1, -1];
29
- return pos;
30
- }
31
- inView([x, y]) {
32
- const { viewport, overflowMargin = 0 } = this.props;
33
- const { width, height } = viewport;
34
- return !(x < -overflowMargin ||
35
- y < -overflowMargin ||
36
- x > width + overflowMargin ||
37
- y > height + overflowMargin);
38
- }
39
- scaleWithZoom(n) {
40
- const { zoom } = this.props.viewport;
41
- return n / Math.pow(2, 20 - zoom);
42
- }
43
- breakpointWithZoom(threshold, a, b) {
44
- const { zoom } = this.props.viewport;
45
- return zoom > threshold ? a : b;
46
- }
47
- getViewport() {
48
- return this.props.viewport;
49
- }
50
- getZoom() {
51
- return this.props.viewport.zoom;
52
- }
53
- render() {
54
- const { zIndex = 1 } = this.props;
55
- const style = Object.assign({ zIndex }, styles.mainContainer);
56
- const renderItems = [];
57
- this.getItems()
58
- .filter(Boolean)
59
- .forEach((item, index) => {
60
- const [x, y] = this.getCoords(item.props.coordinates);
61
- if (this.inView([x, y])) {
62
- const key = item.key === null || item.key === undefined ? index : item.key;
63
- renderItems.push(React.cloneElement(item, { x, y, key }));
64
- }
65
- });
66
- return React.createElement("div", { style: style }, renderItems);
67
- }
68
- }
69
- //# sourceMappingURL=html-overlay.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"html-overlay.js","sourceRoot":"","sources":["../../src/overlays/html-overlay.tsx"],"names":[],"mappings":"AAAA,oBAAoB;AACpB,+BAA+B;AAC/B,oCAAoC;AAEpC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,MAAM,MAAM,GAAG;IACb,aAAa,EAAE;QACb,KAAK,EAAE,MAAM;QACb,MAAM,EAAE,MAAM;QACd,QAAQ,EAAE,UAAU;QACpB,aAAa,EAAE,MAAM;QACrB,QAAQ,EAAE,QAAQ;KACnB;CACF,CAAC;AAeF,MAAM,OAAO,WAAY,SAAQ,KAAK,CAAC,SAAgB;IACrD,kCAAkC;IAClC,MAAM,CAAC,eAAe,GAAG,IAAI,CAAC;IAE9B,sCAAsC;IACtC,QAAQ;QACN,M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o: Record<string, any> | null | undefined;
6
- };
7
- export declare class HtmlTooltipOverlay extends HtmlOverlay {
8
- constructor(props: any);
9
- componentWillMount(): void;
10
- timeoutID: number | null | undefined;
11
- state: State;
12
- _getTooltip(pickingInfo: Record<string, any>): string;
13
- _makeOverlay(): React.JSX.Element;
14
- getItems(): Array<Record<string, any> | null | undefined>;
15
- }
16
- export {};
17
- //# sourceMappingURL=html-tooltip-overlay.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"html-tooltip-overlay.d.ts","sourceRoot":"","sources":["../../src/overlays/html-tooltip-overlay.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAC,WAAW,EAAC,0BAAuB;AAG3C,KAAK,KAAK,GAAG;IACX,OAAO,EAAE,OAAO,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,IAAI,GAAG,SAAS,CAAC;CACrD,CAAC;AAcF,qBAAa,kBAAmB,SAAQ,WAAW;gBACrC,KAAK,EAAE,GAAG;IAKtB,kBAAkB;IAiBlB,SAAS,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAAQ;IAC5C,KAAK,EAAE,KAAK,CAAc;IAE1B,WAAW,CAAC,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,MAAM;IAIrD,YAAY;IAcZ,QAAQ,IAAI,KAAK,CAAC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,IAAI,GAAG,SAAS,CAAC;CAO1D"}
@@ -1,57 +0,0 @@
1
- // deck.gl-community
2
- // SPDX-License-Identifier: MIT
3
- // Copyright (c) vis.gl contributors
4
- import * as React from 'react';
5
- import { HtmlOverlay } from "./html-overlay.js";
6
- import { HtmlOverlayItem } from "./html-overlay-item.js";
7
- const styles = {
8
- tooltip: {
9
- transform: 'translate(-50%,-100%)',
10
- backgroundColor: 'rgba(0, 0, 0, 0.3)',
11
- padding: '4px 8px',
12
- borderRadius: 8,
13
- color: 'white'
14
- }
15
- };
16
- const SHOW_TOOLTIP_TIMEOUT = 250;
17
- export class HtmlTooltipOverlay extends HtmlOverlay {
18
- constructor(props) {
19
- super(props);
20
- this.state = { visible: false, pickingInfo: null };
21
- }
22
- componentWillMount() {
23
- this.context.nebula.queryObjectEvents.on('pick', ({ event, pickingInfo }) => {
24
- if (this.timeoutID !== null) {
25
- window.clearTimeout(this.timeoutID);
26
- }
27
- this.timeoutID = null;
28
- if (pickingInfo && this._getTooltip(pickingInfo)) {
29
- this.timeoutID = window.setTimeout(() => {
30
- this.setState({ visible: true, pickingInfo });
31
- }, SHOW_TOOLTIP_TIMEOUT);
32
- }
33
- else {
34
- this.setState({ visible: false });
35
- }
36
- });
37
- }
38
- timeoutID = null;
39
- state = undefined;
40
- _getTooltip(pickingInfo) {
41
- return pickingInfo.object.style.tooltip;
42
- }
43
- _makeOverlay() {
44
- const { pickingInfo } = this.state;
45
- if (pickingInfo) {
46
- return (React.createElement(HtmlOverlayItem, { key: 0, coordinates: pickingInfo.lngLat, style: styles.tooltip }, this._getTooltip(pickingInfo)));
47
- }
48
- return null;
49
- }
50
- getItems() {
51
- if (this.state.visible) {
52
- return [this._makeOverlay()];
53
- }
54
- return [];
55
- }
56
- }
57
- //# sourceMappingURL=html-tooltip-overlay.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"html-tooltip-overlay.js","sourceRoot":"","sources":["../../src/overlays/html-tooltip-overlay.tsx"],"names":[],"mappings":"AAAA,oBAAoB;AACpB,+BAA+B;AAC/B,oCAAoC;AAEpC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAC,WAAW,EAAC,0BAAuB;AAC3C,OAAO,EAAC,eAAe,EAAC,+BAA4B;AAOpD,MAAM,MAAM,GAAG;IACb,OAAO,EAAE;QACP,SAAS,EAAE,uBAAuB;QAClC,eAAe,EAAE,oBAAoB;QACrC,OAAO,EAAE,SAAS;QACl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CAAC,KAAK,CAAC;QAEjC,IAAI,WAAW,EAAE,CAAC;YAChB,OAAO,CACL,oBAAC,eAAe,IAAC,GAAG,EAAE,CAAC,EAAE,WAAW,EAAE,WAAW,CAAC,MAAM,EAAE,KAAK,EAAE,MAAM,CAAC,OAAO,IAC5E,IAAI,CAAC,WAAW,CAAC,WAAW,CAAC,CACd,CACnB,CAAC;QACJ,CAAC;QAED,OAAO,IAAI,CAAC;IACd,CAAC;IAED,QAAQ;QACN,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC;YACvB,OAAO,CAAC,IAAI,CAAC,YAAY,EAAE,CAAC,CAAC;QAC/B,CAAC;QAED,OAAO,EAAE,CAAC;IACZ,CAAC;CACF"}
@@ -1,84 +0,0 @@
1
- // deck.gl-community
2
- // SPDX-License-Identifier: MIT
3
- // Copyright (c) vis.gl contributors
4
-
5
- import {point} from '@turf/helpers';
6
- import Supercluster from 'supercluster';
7
- import {HtmlOverlay} from './html-overlay';
8
-
9
- export class HtmlClusterOverlay<ObjType> extends HtmlOverlay {
10
- _superCluster: Supercluster;
11
- _lastObjects: ObjType[] | null | undefined = null;
12
-
13
- getItems(): Record<string, any>[] {
14
- // supercluster().load() is expensive and we want to run it only
15
- // when necessary and not for every frame.
16
-
17
- // TODO: Warn if this is running many times / sec
18
-
19
- const newObjects = this.getAllObjects();
20
- if (newObjects !== this._lastObjects) {
21
- this._superCluster = new Supercluster(this.getClusterOptions());
22
- this._superCluster.load(
23
- newObjects.map((object) => point(this.getObjectCoordinates(object), {object}))
24
- );
25
- this._lastObjects = newObjects;
26
- // console.log('new Supercluster() run');
27
- }
28
-
29
- const clusters = this._superCluster.getClusters(
30
- [-180, -90, 180, 90],
31
- Math.round(this.getZoom())
32
- );
33
-
34
- return clusters.map(
35
- ({
36
- geometry: {coordinates},
37
- properties: {cluster, point_count: pointCount, cluster_id: clusterId, object}
38
- }) =>
39
- cluster
40
- ? this.renderCluster(coordinates, clusterId, pointCount)
41
- : this.renderObject(coordinates, object)
42
- );
43
- }
44
-
45
- getClusterObjects(clusterId: number): ObjType[] {
46
- return this._superCluster
47
- .getLeaves(clusterId, Infinity)
48
- .map((object) => object.properties.object);
49
- }
50
-
51
- // Override to provide items that need clustering.
52
- // If the items have not changed please provide the same array to avoid
53
- // regeneration of the cluster which causes performance issues.
54
- getAllObjects(): ObjType[] {
55
- return [];
56
- }
57
-
58
- // override to provide coordinates for each object of getAllObjects()
59
- getObjectCoordinates(obj: ObjType): [number, number] {
60
- return [0, 0];
61
- }
62
-
63
- // Get options object used when instantiating supercluster
64
- getClusterOptions(): Record<string, any> | null | undefined {
65
- return {
66
- maxZoom: 20
67
- };
68
- }
69
-
70
- // override to return an HtmlOverlayItem
71
- renderObject(coordinates: number[], obj: ObjType): Record<string, any> | null | undefined {
72
- return null;
73
- }
74
-
75
- // override to return an HtmlOverlayItem
76
- // use getClusterObjects() to get cluster contents
77
- renderCluster(
78
- coordinates: number[],
79
- clusterId: number,
80
- pointCount: number
81
- ): Record<string, any> | null | undefined {
82
- return null;
83
- }
84
- }
@@ -1,34 +0,0 @@
1
- // deck.gl-community
2
- // SPDX-License-Identifier: MIT
3
- // Copyright (c) vis.gl contributors
4
-
5
- import * as React from 'react';
6
-
7
- type Props = {
8
- // Injected by HtmlOverlay
9
- x?: number;
10
- y?: number;
11
-
12
- // User provided
13
- coordinates: number[];
14
- children: any;
15
- style?: Record<string, any>;
16
- };
17
-
18
- export class HtmlOverlayItem extends React.Component<Props> {
19
- render() {
20
- const {x, y, children, style, /* coordinates, */ ...props} = this.props;
21
- const {zIndex = 'auto', ...remainingStyle} = style || {};
22
-
23
- return (
24
- // Using transform translate to position overlay items will result in a smooth zooming
25
- // effect, whereas using the top/left css properties will cause overlay items to
26
- // jiggle when zooming
27
- <div style={{transform: `translate(${x}px, ${y}px)`, position: 'absolute', zIndex}}>
28
- <div style={{userSelect: 'none', ...remainingStyle}} {...props}>
29
- {children}
30
- </div>
31
- </div>
32
- );
33
- }
34
- }
@@ -1,95 +0,0 @@
1
- // deck.gl-community
2
- // SPDX-License-Identifier: MIT
3
- // Copyright (c) vis.gl contributors
4
-
5
- import * as React from 'react';
6
-
7
- const styles = {
8
- mainContainer: {
9
- width: '100%',
10
- height: '100%',
11
- position: 'absolute',
12
- pointerEvents: 'none',
13
- overflow: 'hidden'
14
- }
15
- };
16
-
17
- interface Props {
18
- viewport?: Record<string, any>;
19
- zIndex?: number;
20
- children?: React.ReactNode;
21
- // Overlay items abruptly disappear when their anchor point passes the edge of the map, which is
22
- // visible to the user. The overflowMargin prop is used to effectively create a hidden buffer
23
- // zone that extends from all sides of the map while leaving the visible edge of the map
24
- // unchanged. With this, overlay items can move into the buffer zone and disappear only when
25
- // their anchor passes the edge of the buffer zone. This produces a perceived effect of overlay
26
- // items being rendered as part of the map, instead of separate entities tacked on to the map.
27
- overflowMargin?: number;
28
- }
29
-
30
- export class HtmlOverlay extends React.Component<Props> {
31
- // This is needed for Deck.gl 8.0+
32
- static deckGLViewProps = true;
33
-
34
- // Override this to provide your items
35
- getItems(): Array<any> {
36
- const {children} = this.props;
37
- if (children) {
38
- return Array.isArray(children) ? children : [children];
39
- }
40
- return [];
41
- }
42
-
43
- getCoords(coordinates: number[]): [number, number] {
44
- const pos = this.props.viewport.project(coordinates);
45
- if (!pos) return [-1, -1];
46
- return pos;
47
- }
48
-
49
- inView([x, y]: number[]): boolean {
50
- const {viewport, overflowMargin = 0} = this.props;
51
- const {width, height} = viewport;
52
- return !(
53
- x < -overflowMargin ||
54
- y < -overflowMargin ||
55
- x > width + overflowMargin ||
56
- y > height + overflowMargin
57
- );
58
- }
59
-
60
- scaleWithZoom(n: number) {
61
- const {zoom} = this.props.viewport;
62
- return n / Math.pow(2, 20 - zoom);
63
- }
64
-
65
- breakpointWithZoom(threshold: number, a: any, b: any): any {
66
- const {zoom} = this.props.viewport;
67
- return zoom > threshold ? a : b;
68
- }
69
-
70
- getViewport() {
71
- return this.props.viewport;
72
- }
73
-
74
- getZoom() {
75
- return this.props.viewport.zoom;
76
- }
77
-
78
- render() {
79
- const {zIndex = 1} = this.props;
80
- const style = Object.assign({zIndex} as any, styles.mainContainer);
81
-
82
- const renderItems = [];
83
- this.getItems()
84
- .filter(Boolean)
85
- .forEach((item, index) => {
86
- const [x, y] = this.getCoords(item.props.coordinates);
87
- if (this.inView([x, y])) {
88
- const key = item.key === null || item.key === undefined ? index : item.key;
89
- renderItems.push(React.cloneElement(item, {x, y, key}));
90
- }
91
- });
92
-
93
- return <div style={style}>{renderItems}</div>;
94
- }
95
- }
@@ -1,78 +0,0 @@
1
- // deck.gl-community
2
- // SPDX-License-Identifier: MIT
3
- // Copyright (c) vis.gl contributors
4
-
5
- import * as React from 'react';
6
-
7
- import {HtmlOverlay} from './html-overlay';
8
- import {HtmlOverlayItem} from './html-overlay-item';
9
-
10
- type State = {
11
- visible: boolean;
12
- pickingInfo: Record<string, any> | null | undefined;
13
- };
14
-
15
- const styles = {
16
- tooltip: {
17
- transform: 'translate(-50%,-100%)',
18
- backgroundColor: 'rgba(0, 0, 0, 0.3)',
19
- padding: '4px 8px',
20
- borderRadius: 8,
21
- color: 'white'
22
- }
23
- };
24
-
25
- const SHOW_TOOLTIP_TIMEOUT = 250;
26
-
27
- export class HtmlTooltipOverlay extends HtmlOverlay {
28
- constructor(props: any) {
29
- super(props);
30
- this.state = {visible: false, pickingInfo: null};
31
- }
32
-
33
- componentWillMount() {
34
- (this.context as any).nebula.queryObjectEvents.on('pick', ({event, pickingInfo}) => {
35
- if (this.timeoutID !== null) {
36
- window.clearTimeout(this.timeoutID);
37
- }
38
- this.timeoutID = null;
39
-
40
- if (pickingInfo && this._getTooltip(pickingInfo)) {
41
- this.timeoutID = window.setTimeout(() => {
42
- this.setState({visible: true, pickingInfo});
43
- }, SHOW_TOOLTIP_TIMEOUT);
44
- } else {
45
- this.setState({visible: false});
46
- }
47
- });
48
- }
49
-
50
- timeoutID: number | null | undefined = null;
51
- state: State = undefined!;
52
-
53
- _getTooltip(pickingInfo: Record<string, any>): string {
54
- return pickingInfo.object.style.tooltip;
55
- }
56
-
57
- _makeOverlay() {
58
- const {pickingInfo} = this.state;
59
-
60
- if (pickingInfo) {
61
- return (
62
- <HtmlOverlayItem key={0} coordinates={pickingInfo.lngLat} style={styles.tooltip}>
63
- {this._getTooltip(pickingInfo)}
64
- </HtmlOverlayItem>
65
- );
66
- }
67
-
68
- return null;
69
- }
70
-
71
- getItems(): Array<Record<string, any> | null | undefined> {
72
- if (this.state.visible) {
73
- return [this._makeOverlay()];
74
- }
75
-
76
- return [];
77
- }
78
- }