@mapcomponents/deck-gl 0.0.7

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.
Files changed (129) hide show
  1. package/.babelrc +22 -0
  2. package/.editorconfig +19 -0
  3. package/.eslintignore +12 -0
  4. package/.eslintrc.js +30 -0
  5. package/.prettierignore +11 -0
  6. package/.prettierrc.json +6 -0
  7. package/.storybook/.babelrc +26 -0
  8. package/.storybook/main.js +40 -0
  9. package/.storybook/manager.js +6 -0
  10. package/.storybook/mapcomponents_logo.png +0 -0
  11. package/.storybook/preview.js +33 -0
  12. package/.storybook/style.css +15 -0
  13. package/.storybook/wheregroupTheme.js +9 -0
  14. package/CHANGELOG.md +1 -0
  15. package/LICENSE +21 -0
  16. package/README.md +1 -0
  17. package/config/env.js +106 -0
  18. package/config/jest/babelTransform.js +29 -0
  19. package/config/jest/cssTransform.js +14 -0
  20. package/config/jest/fileTransform.js +40 -0
  21. package/config/paths.js +75 -0
  22. package/coverage/clover.xml +6 -0
  23. package/coverage/coverage-final.json +1 -0
  24. package/coverage/lcov-report/base.css +224 -0
  25. package/coverage/lcov-report/block-navigation.js +87 -0
  26. package/coverage/lcov-report/favicon.png +0 -0
  27. package/coverage/lcov-report/index.html +101 -0
  28. package/coverage/lcov-report/prettify.css +1 -0
  29. package/coverage/lcov-report/prettify.js +2 -0
  30. package/coverage/lcov-report/sort-arrow-sprite.png +0 -0
  31. package/coverage/lcov-report/sorter.js +196 -0
  32. package/coverage/lcov.info +0 -0
  33. package/cypress/support/commands.ts +37 -0
  34. package/cypress/support/component-index.html +12 -0
  35. package/cypress/support/component.ts +46 -0
  36. package/cypress.config.ts +101 -0
  37. package/dist/components/MlHexagonMap/MlHexagonMap.d.ts +19 -0
  38. package/dist/components/MlHexagonMap/MlHexagonMap.stories.d.ts +14 -0
  39. package/dist/contexts/DeckGlContext.d.ts +15 -0
  40. package/dist/decorators/MapContextDecorator.d.ts +2 -0
  41. package/dist/hooks/useDeckGl.d.ts +7 -0
  42. package/dist/index.d.ts +2 -0
  43. package/dist/index.esm.js +105 -0
  44. package/dist/index.esm.js.map +1 -0
  45. package/dist/setupTests.d.ts +13 -0
  46. package/dist/stories/components/Readme.d.ts +2 -0
  47. package/dist/util/BubbleForInstructions.d.ts +2 -0
  48. package/dist/util/Instructions.d.ts +14 -0
  49. package/dist/util/index.d.ts +3 -0
  50. package/dist/util/layerRemovalTest.d.ts +2 -0
  51. package/dist/util/sourceRemovalTest.d.ts +2 -0
  52. package/eslintErrorTest.js +10 -0
  53. package/package.json +199 -0
  54. package/public/assets/3D/godzilla_simple.glb +0 -0
  55. package/public/assets/3D/hexa.json +4 -0
  56. package/public/assets/3D/laerm_points.json +1 -0
  57. package/public/assets/dop.png +0 -0
  58. package/public/assets/historic.png +0 -0
  59. package/public/assets/marker.png +0 -0
  60. package/public/assets/osm.png +0 -0
  61. package/public/assets/sample.gpx +716 -0
  62. package/public/assets/sample1.gpx +3003 -0
  63. package/public/assets/sample2.gpx +1264 -0
  64. package/public/assets/sample3.gpx +912 -0
  65. package/public/assets/wg-marker.png +0 -0
  66. package/public/catalogue/.gitkeep +0 -0
  67. package/public/catalogue/mc_meta.json +1 -0
  68. package/public/favicon.ico +0 -0
  69. package/public/index.html +39 -0
  70. package/public/logo.png +0 -0
  71. package/public/manifest.json +25 -0
  72. package/public/robots.txt +3 -0
  73. package/public/thumbnails/MapLibreMap.png +0 -0
  74. package/public/thumbnails/MlCameraFollowPath.png +0 -0
  75. package/public/thumbnails/MlCreatePdfButton.png +0 -0
  76. package/public/thumbnails/MlCreatePdfForm.png +0 -0
  77. package/public/thumbnails/MlDeckGlLayer.png +0 -0
  78. package/public/thumbnails/MlDeckGlTerrainLayer.png +0 -0
  79. package/public/thumbnails/MlDemoDashboard.png +0 -0
  80. package/public/thumbnails/MlFeatureEditor.png +0 -0
  81. package/public/thumbnails/MlFillExtrusionLayer.png +0 -0
  82. package/public/thumbnails/MlFollowGps.png +0 -0
  83. package/public/thumbnails/MlGeoJsonLayer.png +0 -0
  84. package/public/thumbnails/MlGpxViewer.png +0 -0
  85. package/public/thumbnails/MlHillshadeLayer.png +0 -0
  86. package/public/thumbnails/MlIconLayer.png +0 -0
  87. package/public/thumbnails/MlLaermkarte.png +0 -0
  88. package/public/thumbnails/MlLayerMagnify.png +0 -0
  89. package/public/thumbnails/MlLayerSwipe.png +0 -0
  90. package/public/thumbnails/MlMapDrawTools.png +0 -0
  91. package/public/thumbnails/MlMeasureTool.png +0 -0
  92. package/public/thumbnails/MlMobilerImker.png +0 -0
  93. package/public/thumbnails/MlNavigationCompass.png +0 -0
  94. package/public/thumbnails/MlNavigationTools.png +0 -0
  95. package/public/thumbnails/MlOsmLayer.png +0 -0
  96. package/public/thumbnails/MlScaleReference.png +0 -0
  97. package/public/thumbnails/MlSketchTool.png +0 -0
  98. package/public/thumbnails/MlSpatialElevationProfile.png +0 -0
  99. package/public/thumbnails/MlThreeJsLayer.png +0 -0
  100. package/public/thumbnails/MlTransitionGeoJsonLayer.png +0 -0
  101. package/public/thumbnails/MlVectorTileLayer.png +0 -0
  102. package/public/thumbnails/MlWanderApp.png +0 -0
  103. package/public/thumbnails/MlWmsLayer.png +0 -0
  104. package/public/thumbnails/MlWmsLoader.png +0 -0
  105. package/public/thumbnails/useCameraFollowPath.png +0 -0
  106. package/rollup.config.js +67 -0
  107. package/scripts/build-catalogue-markdown-docs.js +28 -0
  108. package/scripts/build-catalogue-meta.js +42 -0
  109. package/scripts/create-map-component.sh +36 -0
  110. package/scripts/test.js +53 -0
  111. package/src/@types/assets/index.d.ts +20 -0
  112. package/src/App.css +0 -0
  113. package/src/components/MlHexagonMap/MlHexagonMap.meta_.json +14 -0
  114. package/src/components/MlHexagonMap/MlHexagonMap.stories.tsx +29 -0
  115. package/src/components/MlHexagonMap/MlHexagonMap.tsx +143 -0
  116. package/src/contexts/DeckGlContext.tsx +66 -0
  117. package/src/custom.d.ts +4 -0
  118. package/src/decorators/MapContextDecorator.js +41 -0
  119. package/src/decorators/style.css +34 -0
  120. package/src/hooks/useDeckGl.tsx +24 -0
  121. package/src/index.ts +2 -0
  122. package/src/setupTests.js +113 -0
  123. package/src/stories/components/Readme.js +7 -0
  124. package/src/util/BubbleForInstructions.js +48 -0
  125. package/src/util/Instructions.tsx +60 -0
  126. package/src/util/index.js +4 -0
  127. package/src/util/layerRemovalTest.js +121 -0
  128. package/src/util/sourceRemovalTest.js +113 -0
  129. package/tsconfig.json +34 -0
@@ -0,0 +1,37 @@
1
+ /// <reference types="cypress" />
2
+ // ***********************************************
3
+ // This example commands.ts shows you how to
4
+ // create various custom commands and overwrite
5
+ // existing commands.
6
+ //
7
+ // For more comprehensive examples of custom
8
+ // commands please read more here:
9
+ // https://on.cypress.io/custom-commands
10
+ // ***********************************************
11
+ //
12
+ //
13
+ // -- This is a parent command --
14
+ // Cypress.Commands.add('login', (email, password) => { ... })
15
+ //
16
+ //
17
+ // -- This is a child command --
18
+ // Cypress.Commands.add('drag', { prevSubject: 'element'}, (subject, options) => { ... })
19
+ //
20
+ //
21
+ // -- This is a dual command --
22
+ // Cypress.Commands.add('dismiss', { prevSubject: 'optional'}, (subject, options) => { ... })
23
+ //
24
+ //
25
+ // -- This will overwrite an existing command --
26
+ // Cypress.Commands.overwrite('visit', (originalFn, url, options) => { ... })
27
+ //
28
+ // declare global {
29
+ // namespace Cypress {
30
+ // interface Chainable {
31
+ // login(email: string, password: string): Chainable<void>
32
+ // drag(subject: string, options?: Partial<TypeOptions>): Chainable<Element>
33
+ // dismiss(subject: string, options?: Partial<TypeOptions>): Chainable<Element>
34
+ // visit(originalFn: CommandOriginalFn, url: string, options: Partial<VisitOptions>): Chainable<Element>
35
+ // }
36
+ // }
37
+ // }
@@ -0,0 +1,12 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <meta charset="utf-8">
5
+ <meta http-equiv="X-UA-Compatible" content="IE=edge">
6
+ <meta name="viewport" content="width=device-width,initial-scale=1.0">
7
+ <title>Components App</title>
8
+ </head>
9
+ <body>
10
+ <div data-cy-root></div>
11
+ </body>
12
+ </html>
@@ -0,0 +1,46 @@
1
+ // ***********************************************************
2
+ // This example support/component.ts is processed and
3
+ // loaded automatically before your test files.
4
+ //
5
+ // This is a great place to put global configuration and
6
+ // behavior that modifies Cypress.
7
+ //
8
+ // You can change the location of this file or turn off
9
+ // automatically serving support files with the
10
+ // 'supportFile' configuration option.
11
+ //
12
+ // You can read more here:
13
+ // https://on.cypress.io/configuration
14
+ // ***********************************************************
15
+ import { setGlobalConfig } from "@storybook/testing-react";
16
+ import * as sbPreview from "../../.storybook/preview";
17
+
18
+ setGlobalConfig(sbPreview);
19
+
20
+ // Import commands.js using ES2015 syntax:
21
+ import './commands'
22
+
23
+ // Alternatively you can use CommonJS syntax:
24
+ // require('./commands')
25
+
26
+ import { mount } from 'cypress/react'
27
+
28
+ //import MlCreatePdfForm from "../../src/components/MlCreatePdfForm/MlCreatePdfForm";
29
+
30
+ // Augment the Cypress namespace to include type definitions for
31
+ // your custom command.
32
+ // Alternatively, can be defined in cypress/support/component.d.ts
33
+ // with a <reference path="./component" /> at the top of your spec.
34
+ declare global {
35
+ // eslint-disable-next-line @typescript-eslint/no-namespace
36
+ namespace Cypress {
37
+ interface Chainable {
38
+ mount: typeof mount
39
+ }
40
+ }
41
+ }
42
+
43
+ Cypress.Commands.add('mount', mount)
44
+
45
+ // Example use:
46
+ // cy.mount(<MyComponent />)
@@ -0,0 +1,101 @@
1
+ import { defineConfig } from 'cypress';
2
+
3
+ //const isRunningInCI = process.env.CI === 'true';
4
+
5
+ export default defineConfig({
6
+ component: {
7
+ //supportFile: './cypress/support/component.js',
8
+ devServer: {
9
+ framework: 'react',
10
+ bundler: 'webpack',
11
+ webpackConfig: {
12
+ mode: 'development',
13
+ resolve: {
14
+ extensions: ['.mjs', '.js', '.jsx', '.json', '.cjs', '.ts', '.tsx'],
15
+ },
16
+
17
+ module: {
18
+ rules: [
19
+ {
20
+ test: /\.(js|jsx|tsx|ts)$/, // USE THE babel-loader FOR THESE FILE EXTENSIONS
21
+ use: [
22
+ {
23
+ loader: 'babel-loader',
24
+ options: {
25
+ sourceType: 'unambiguous',
26
+ presets: [
27
+ ['@babel/preset-env', { shippedProposals: true, loose: true }],
28
+ '@babel/preset-typescript',
29
+ '@babel/preset-react',
30
+ ],
31
+ plugins: [
32
+ '@babel/plugin-transform-shorthand-properties',
33
+ '@babel/plugin-transform-block-scoping',
34
+ ['@babel/plugin-proposal-decorators', { legacy: true }],
35
+ ['@babel/plugin-proposal-class-properties', { loose: true }],
36
+ ['@babel/plugin-proposal-private-methods', { loose: true }],
37
+ '@babel/plugin-proposal-export-default-from',
38
+ '@babel/plugin-syntax-dynamic-import',
39
+ [
40
+ '@babel/plugin-proposal-object-rest-spread',
41
+ { loose: true, useBuiltIns: true },
42
+ ],
43
+ '@babel/plugin-transform-classes',
44
+ '@babel/plugin-transform-arrow-functions',
45
+ '@babel/plugin-transform-parameters',
46
+ '@babel/plugin-transform-destructuring',
47
+ '@babel/plugin-transform-spread',
48
+ '@babel/plugin-transform-for-of',
49
+ '@storybook/core-common/node_modules/babel-plugin-macros',
50
+ '@babel/plugin-proposal-optional-chaining',
51
+ '@babel/plugin-proposal-nullish-coalescing-operator',
52
+ [
53
+ 'babel-plugin-polyfill-corejs3',
54
+ {
55
+ method: 'usage-global',
56
+ absoluteImports: 'core-js',
57
+ version: '3.21.1',
58
+ },
59
+ ],
60
+ '@babel/plugin-transform-template-literals',
61
+ ],
62
+ babelrc: true,
63
+ configFile: false,
64
+ },
65
+ },
66
+ ],
67
+ exclude: [ /node_modules/, /dist/ ]
68
+ },
69
+ /*{
70
+ test: /\.(ts|tsx)$/,
71
+ exclude: [/node_modules/],
72
+ use: {
73
+ loader: require.resolve('babel-loader'),
74
+ options: {
75
+ plugins: [],
76
+ presets: ['@babel/preset-typescript'],
77
+ babelrc: false,
78
+ },
79
+ },
80
+ },*/
81
+ {
82
+ test: /\.(svg|ico|jpg|jpeg|png|apng|gif|eot|otf|webp|ttf|woff|woff2|cur|ani|pdf)(\?.*)?$/,
83
+ loader: 'file-loader',
84
+ options: { name: 'static/media/[path][name].[ext]' },
85
+ },
86
+ {
87
+ test: /\.css$/,
88
+ use: [
89
+ 'style-loader',
90
+ {
91
+ loader: 'css-loader',
92
+ options: { importLoaders: 1 },
93
+ },
94
+ ],
95
+ },
96
+ ],
97
+ },
98
+ },
99
+ },
100
+ },
101
+ });
@@ -0,0 +1,19 @@
1
+ /// <reference types="react" />
2
+ export interface MlHexagonMapProps {
3
+ /**
4
+ * Id of the target MapLibre instance in mapContext
5
+ */
6
+ mapId?: string;
7
+ /**
8
+ * Id of an existing layer in the mapLibre instance to help specify the layer order
9
+ * This layer will be visually beneath the layer with the "insertBeforeLayer" id.
10
+ */
11
+ insertBeforeLayer?: string;
12
+ }
13
+ declare const MlHexagonMap: {
14
+ (props: MlHexagonMapProps): JSX.Element;
15
+ defaultProps: {
16
+ mapId: undefined;
17
+ };
18
+ };
19
+ export default MlHexagonMap;
@@ -0,0 +1,14 @@
1
+ /// <reference types="react" />
2
+ declare const storyoptions: {
3
+ title: string;
4
+ component: {
5
+ (props: import("./MlHexagonMap").MlHexagonMapProps): JSX.Element;
6
+ defaultProps: {
7
+ mapId: undefined;
8
+ };
9
+ };
10
+ argTypes: {};
11
+ decorators: ((Story: any, context: any) => JSX.Element)[];
12
+ };
13
+ export default storyoptions;
14
+ export declare const NoiseMap: any;
@@ -0,0 +1,15 @@
1
+ import React, { ReactNode } from 'react';
2
+ import { Deck, Layer } from '@deck.gl/core/typed';
3
+ export interface DeckGlContextType {
4
+ deckGl: Deck | undefined;
5
+ deckGlLayerArray: Layer[];
6
+ setDeckGlLayerArray: React.Dispatch<React.SetStateAction<Layer[]>>;
7
+ }
8
+ interface DeckGlContextProviderProps {
9
+ mapId: string;
10
+ children: ReactNode;
11
+ }
12
+ declare const DeckGlContext: React.Context<DeckGlContextType>;
13
+ declare const DeckGlContextProvider: ({ mapId, children }: DeckGlContextProviderProps) => JSX.Element;
14
+ export { DeckGlContextProvider };
15
+ export default DeckGlContext;
@@ -0,0 +1,2 @@
1
+ export default decorators;
2
+ declare const decorators: ((Story: any, context: any) => JSX.Element)[];
@@ -0,0 +1,7 @@
1
+ import { Layer } from '@deck.gl/core/typed';
2
+ declare function useDeckGl(): {
3
+ addLayer: (layer: Layer) => void;
4
+ removeLayer: (layer: Layer) => void;
5
+ layerArray: Layer<{}>[];
6
+ };
7
+ export default useDeckGl;
@@ -0,0 +1,2 @@
1
+ export { default as DeckGlContext, DeckGlContextProvider } from './contexts/DeckGlContext';
2
+ export { default as useDeckGl } from './hooks/useDeckGl';
@@ -0,0 +1,105 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var React = require('react');
6
+ var reactMaplibre = require('@mapcomponents/react-maplibre');
7
+ var typed = require('@deck.gl/core/typed');
8
+ var typed$1 = require('@deck.gl/mapbox/typed');
9
+
10
+ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
11
+
12
+ var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
13
+
14
+ /******************************************************************************
15
+ Copyright (c) Microsoft Corporation.
16
+
17
+ Permission to use, copy, modify, and/or distribute this software for any
18
+ purpose with or without fee is hereby granted.
19
+
20
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
21
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
22
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
23
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
24
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
25
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
26
+ PERFORMANCE OF THIS SOFTWARE.
27
+ ***************************************************************************** */
28
+
29
+ function __spreadArray(to, from, pack) {
30
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
31
+ if (ar || !(i in from)) {
32
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
33
+ ar[i] = from[i];
34
+ }
35
+ }
36
+ return to.concat(ar || Array.prototype.slice.call(from));
37
+ }
38
+
39
+ var layerId = 'deckgl-layer';
40
+ var DeckGlContext = React__default["default"].createContext({});
41
+ var DeckGlContextProvider = function (_a) {
42
+ var mapId = _a.mapId, children = _a.children;
43
+ var mapHook = reactMaplibre.useMap({ mapId: mapId });
44
+ var _b = React.useState(undefined), deckGl = _b[0], setDeckGl = _b[1];
45
+ var layerRef = React.useRef(undefined);
46
+ var _c = React.useState([]), deckGlLayerArray = _c[0], setDeckGlLayerArray = _c[1];
47
+ React.useEffect(function () {
48
+ if (!mapHook.map)
49
+ return;
50
+ var deck = new typed.Deck({
51
+ gl: mapHook.map.painter.context.gl,
52
+ layers: [],
53
+ });
54
+ layerRef.current = new typed$1.MapboxLayer({
55
+ id: layerId,
56
+ deck: deck,
57
+ });
58
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
59
+ // @ts-ignore
60
+ mapHook.map.addLayer(layerRef.current);
61
+ setDeckGl(deck);
62
+ return function () {
63
+ var _a;
64
+ (_a = mapHook.map) === null || _a === void 0 ? void 0 : _a.removeLayer(layerId);
65
+ layerRef.current = undefined;
66
+ };
67
+ }, [mapHook.map]);
68
+ React.useEffect(function () {
69
+ if (!deckGl)
70
+ return;
71
+ deckGl.setProps({
72
+ layers: __spreadArray([], deckGlLayerArray, true),
73
+ });
74
+ }, [deckGlLayerArray, deckGl]);
75
+ var value = {
76
+ deckGl: deckGl,
77
+ deckGlLayerArray: deckGlLayerArray,
78
+ setDeckGlLayerArray: setDeckGlLayerArray,
79
+ };
80
+ return React__default["default"].createElement(DeckGlContext.Provider, { value: value }, children);
81
+ };
82
+
83
+ function useDeckGl() {
84
+ var deckGlContext = React.useContext(DeckGlContext);
85
+ var layerArray = deckGlContext.deckGlLayerArray;
86
+ function addLayer(layer) {
87
+ var newDeckGLLayerArray = __spreadArray([], layerArray, true);
88
+ newDeckGLLayerArray.push(layer);
89
+ deckGlContext.setDeckGlLayerArray(newDeckGLLayerArray);
90
+ }
91
+ function removeLayer(layer) {
92
+ var newDeckGLLayerArray = layerArray.filter(function (l) { return l !== layer; });
93
+ deckGlContext.setDeckGlLayerArray(newDeckGLLayerArray);
94
+ }
95
+ return {
96
+ addLayer: addLayer,
97
+ removeLayer: removeLayer,
98
+ layerArray: layerArray,
99
+ };
100
+ }
101
+
102
+ exports.DeckGlContext = DeckGlContext;
103
+ exports.DeckGlContextProvider = DeckGlContextProvider;
104
+ exports.useDeckGl = useDeckGl;
105
+ //# sourceMappingURL=index.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.esm.js","sources":["../src/contexts/DeckGlContext.tsx","../src/hooks/useDeckGl.tsx"],"sourcesContent":["import React, { ReactNode, useEffect, useRef, useState } from 'react';\nimport { useMap } from '@mapcomponents/react-maplibre';\nimport { Deck, Layer } from '@deck.gl/core/typed';\nimport { MapboxLayer } from '@deck.gl/mapbox/typed';\n\nexport interface DeckGlContextType {\n\tdeckGl: Deck | undefined;\n\tdeckGlLayerArray: Layer[];\n\tsetDeckGlLayerArray: React.Dispatch<React.SetStateAction<Layer[]>>;\n}\ninterface DeckGlContextProviderProps {\n\tmapId: string;\n\tchildren: ReactNode;\n}\n\nconst layerId = 'deckgl-layer';\nconst DeckGlContext = React.createContext({} as DeckGlContextType);\n\nconst DeckGlContextProvider = ({ mapId, children }: DeckGlContextProviderProps) => {\n\tconst mapHook = useMap({ mapId });\n\n\tconst [deckGl, setDeckGl] = useState<Deck | undefined>(undefined);\n\tconst layerRef = useRef<MapboxLayer<Layer> | undefined>(undefined);\n\tconst [deckGlLayerArray, setDeckGlLayerArray] = useState([]);\n\n\tuseEffect(() => {\n\t\tif (!mapHook.map) return;\n\n\t\tconst deck = new Deck({\n\t\t\tgl: mapHook.map.painter.context.gl,\n\t\t\tlayers: [],\n\t\t});\n\n\t\tlayerRef.current = new MapboxLayer({\n\t\t\tid: layerId,\n\t\t\tdeck: deck,\n\t\t});\n\n\t\t// eslint-disable-next-line @typescript-eslint/ban-ts-comment\n\t\t// @ts-ignore\n\t\tmapHook.map.addLayer(layerRef.current);\n\n\t\tsetDeckGl(deck);\n\t\treturn () => {\n\t\t\tmapHook.map?.removeLayer(layerId);\n\t\t\tlayerRef.current = undefined;\n\t\t};\n\t}, [mapHook.map]);\n\n\tuseEffect(() => {\n\t\tif (!deckGl) return;\n\t\tdeckGl.setProps({\n\t\t\tlayers: [...deckGlLayerArray],\n\t\t});\n\t}, [deckGlLayerArray, deckGl]);\n\n\tconst value = {\n\t\tdeckGl,\n\t\tdeckGlLayerArray,\n\t\tsetDeckGlLayerArray,\n\t};\n\treturn <DeckGlContext.Provider value={value}>{children}</DeckGlContext.Provider>;\n};\n\nexport { DeckGlContextProvider };\nexport default DeckGlContext;\n","import DeckGlContext from '../contexts/DeckGlContext';\nimport { useContext } from 'react';\nimport { Layer } from '@deck.gl/core/typed';\n\nfunction useDeckGl() {\n\tconst deckGlContext = useContext(DeckGlContext);\n\tconst layerArray = deckGlContext.deckGlLayerArray;\n\n\tfunction addLayer(layer: Layer) {\n\t\tconst newDeckGLLayerArray = [...layerArray];\n\t\tnewDeckGLLayerArray.push(layer);\n\t\tdeckGlContext.setDeckGlLayerArray(newDeckGLLayerArray);\n\t}\n\tfunction removeLayer(layer: Layer) {\n\t\tconst newDeckGLLayerArray = layerArray.filter((l) => l !== layer);\n\t\tdeckGlContext.setDeckGlLayerArray(newDeckGLLayerArray);\n\t}\n\treturn {\n\t\taddLayer,\n\t\tremoveLayer,\n\t\tlayerArray,\n\t};\n}\nexport default useDeckGl;\n"],"names":["React","useMap","useState","useRef","useEffect","Deck","MapboxLayer","useContext"],"mappings":";;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AAA;AAChC,QAAA,IAAM,mBAAmB,GAAG,UAAU,CAAC,MAAM,CAAC,UAAC,CAAC,EAAK,EAAA,OAAA,CAAC,KAAK,KAAK,CAAX,EAAW,CAAC,CAAC;AAClE,QAAA,aAAa,CAAC,mBAAmB,CAAC,mBAAmB,CAAC,CAAC;KACvD;IACD,OAAO;AACN,QAAA,QAAQ,EAAA,QAAA;AACR,QAAA,WAAW,EAAA,WAAA;AACX,QAAA,UAAU,EAAA,UAAA;KACV,CAAC;AACH;;;;;;"}
@@ -0,0 +1,13 @@
1
+ export var uuid_regex: string;
2
+ export namespace mockMapLibreMethods {
3
+ const on: any;
4
+ const off: any;
5
+ const addControl: any;
6
+ const removeControl: any;
7
+ const fitBounds: any;
8
+ const hasControl: any;
9
+ function getCanvas(): HTMLCanvasElement;
10
+ function getContainer(): {
11
+ style: {};
12
+ };
13
+ }
@@ -0,0 +1,2 @@
1
+ export default Readme;
2
+ declare function Readme(): JSX.Element;
@@ -0,0 +1,2 @@
1
+ export default BubbleForInstruction;
2
+ declare function BubbleForInstruction(props: any): JSX.Element;
@@ -0,0 +1,14 @@
1
+ /// <reference types="react" />
2
+ import { SxProps } from '@mui/material';
3
+ interface StepObject {
4
+ duration: number;
5
+ props: SxProps;
6
+ content: JSX.Element;
7
+ }
8
+ interface InstructionProps {
9
+ steps: Array<StepObject>;
10
+ open: boolean;
11
+ callback?: () => void;
12
+ }
13
+ declare const Instructions: (props: InstructionProps) => JSX.Element;
14
+ export default Instructions;
@@ -0,0 +1,3 @@
1
+ import layerRemovalTest from "./layerRemovalTest";
2
+ import sourceRemovalTest from "./sourceRemovalTest";
3
+ export { layerRemovalTest, sourceRemovalTest };
@@ -0,0 +1,2 @@
1
+ export default layerRemovalTest;
2
+ declare function layerRemovalTest(ComponentName: any, Component: any, regexLayerNameTest: any, humanReadableLayerName: any, beforeWrapperInit: any, afterWrapperInit: any, createWrapperFunction: any): void;
@@ -0,0 +1,2 @@
1
+ export default sourceRemovalTest;
2
+ declare function sourceRemovalTest(ComponentName: any, Component: any, regexLayerNameTest: any, humanReadableLayerName: any, beforeWrapperInit: any, afterWrapperInit: any): void;
@@ -0,0 +1,10 @@
1
+ const eslintErrorTest = () => {
2
+ let c;
3
+ const b;
4
+ const ab;
5
+ const l = "abc";
6
+ const j = 'oh no'
7
+
8
+ for (let i = 0; i < 10; i--) {}
9
+ while (true) {}
10
+ };
package/package.json ADDED
@@ -0,0 +1,199 @@
1
+ {
2
+ "name": "@mapcomponents/deck-gl",
3
+ "version": "0.0.7",
4
+ "main": "index.js",
5
+ "license": "MIT",
6
+ "module": "dist/index.esm.js",
7
+ "source": "src/index.ts",
8
+ "types": "dist/index.d.ts",
9
+ "scripts": {
10
+ "build": "rollup -c",
11
+ "start": "start-storybook -p 6006 -s public",
12
+ "cypress-test": "npx cypress run --component",
13
+ "test": "node scripts/test.js --env=jest-environment-jsdom-sixteen --watchAll=false --coverage --passWithNoTests",
14
+ "test:noninteractive": "node scripts/test.js --env=jest-environment-jsdom-sixteen --verbose --watchAll=false --coverage --passWithNoTests",
15
+ "test:generate-output": "node scripts/test.js --env=jest-environment-jsdom-sixteen --watchAll=false --json --outputFile=./src/.jest-test-results.json || true",
16
+ "build-storybook": "build-storybook -o docs-build -s public",
17
+ "storybook-docs": "start-storybook --docs --no-manager-cache",
18
+ "build-catalogue-meta": "node scripts/build-catalogue-meta.js",
19
+ "build-catalogue-markdown-docs": "node scripts/build-catalogue-markdown-docs.js",
20
+ "create-component": "./scripts/create-map-component.sh",
21
+ "eslint-lint": "yarn run eslint",
22
+ "prettier-format": "yarn run prettier --check"
23
+ },
24
+ "dependencies": {
25
+ "@deck.gl/aggregation-layers": "^8.8.23",
26
+ "@deck.gl/core": "^8.8.23",
27
+ "@deck.gl/layers": "^8.8.23",
28
+ "@deck.gl/mapbox": "^8.8.23",
29
+ "@emotion/css": "^11.10.5",
30
+ "@emotion/react": "^11.10.5",
31
+ "@emotion/styled": "^11.10.5",
32
+ "@mapbox/mapbox-gl-draw": "^1.4.0",
33
+ "@mapbox/mapbox-gl-sync-move": "^0.3.1",
34
+ "@mapcomponents/react-maplibre": "^0.1.84",
35
+ "@mui/icons-material": "^5.11.0",
36
+ "@mui/material": "^5.11.7",
37
+ "@mui/styles": "^5.11.7",
38
+ "@turf/turf": "^6.5.0",
39
+ "d3": "^7.8.2",
40
+ "jspdf": "^2.5.1",
41
+ "maplibre-gl": "^2.4.0",
42
+ "mui-color": "^2.0.0-beta.2",
43
+ "react-moveable": "^0.46.1",
44
+ "three": "^0.149.0",
45
+ "traverse": "^0.6.7",
46
+ "uuid": "^9.0.0",
47
+ "wms-capabilities": "^0.6.0",
48
+ "xmldom": "^0.6.0"
49
+ },
50
+ "devDependencies": {
51
+ "@babel/preset-react": "^7.18.6",
52
+ "@bahmutov/cy-rollup": "^2.0.0",
53
+ "@cypress/react": "^7.0.2",
54
+ "@cypress/webpack-preprocessor": "^5.16.1",
55
+ "@fontsource/material-icons": "^4.5.4",
56
+ "@fontsource/roboto": "^4.5.8",
57
+ "@rollup/plugin-babel": "^6.0.3",
58
+ "@rollup/plugin-commonjs": "^24.0.1",
59
+ "@rollup/plugin-url": "^8.0.1",
60
+ "@storybook/addon-actions": "^6.5.16",
61
+ "@storybook/addon-docs": "^6.5.16",
62
+ "@storybook/addon-essentials": "^6.5.16",
63
+ "@storybook/addon-links": "^6.5.16",
64
+ "@storybook/addon-storysource": "^6.5.16",
65
+ "@storybook/addons": "^6.5.16",
66
+ "@storybook/builder-webpack5": "^6.5.16",
67
+ "@storybook/manager-webpack5": "^6.5.16",
68
+ "@storybook/node-logger": "^6.5.16",
69
+ "@storybook/react": "^6.5.16",
70
+ "@storybook/testing-react": "^1.3.0",
71
+ "@storybook/theming": "^6.5.16",
72
+ "@svgr/rollup": "^6.5.1",
73
+ "@testing-library/react": "^13.4.0",
74
+ "@types/enzyme": "^3.10.12",
75
+ "@types/expect": "^24.3.0",
76
+ "@types/jest": "^29.4.0",
77
+ "@types/mapbox__mapbox-gl-draw": "^1.3.3",
78
+ "@types/mapbox__point-geometry": "^0.1.2",
79
+ "@types/mapbox__vector-tile": "^1.3.0",
80
+ "@types/react": "^18.0.27",
81
+ "@types/react-dom": "^18.0.10",
82
+ "@types/three": "^0.148.1",
83
+ "@types/uuid": "^9.0.0",
84
+ "@typescript-eslint/eslint-plugin": "^5.49.0",
85
+ "@typescript-eslint/parser": "^5.49.0",
86
+ "@wojtekmaj/enzyme-adapter-react-17": "^0.8.0",
87
+ "avj": "^0.0.0",
88
+ "babel-jest": "^26.6.0",
89
+ "babel-plugin-inline-react-svg": "^2.0.1",
90
+ "babel-plugin-styled-components": "^2.0.7",
91
+ "babel-preset-react-app": "^10.0.1",
92
+ "cypress": "^12.4.1",
93
+ "enzyme": "^3.11.0",
94
+ "eslint": "^8.32.0",
95
+ "eslint-config-prettier": "^8.6.0",
96
+ "eslint-plugin-react": "^7.32.1",
97
+ "glob": "^8.1.0",
98
+ "jest": "26.6.0",
99
+ "jest-circus": "26.6.0",
100
+ "jest-environment-jsdom-sixteen": "^2.0.0",
101
+ "jest-enzyme": "^7.1.2",
102
+ "jest-resolve": "26.6.0",
103
+ "jest-watch-typeahead": "0.6.1",
104
+ "node-fetch": "^3.3.0",
105
+ "postcss": "^8.4.21",
106
+ "prettier": "2.8.3",
107
+ "react": "^18.2.0",
108
+ "react-app-polyfill": "^3.0.0",
109
+ "react-dev-utils": "^12.0.1",
110
+ "react-dom": "^18.2.0",
111
+ "react-draggable": "^4.4.5",
112
+ "react-i18next": "^12.1.4",
113
+ "rollup": "^2.70.1",
114
+ "rollup-plugin-delete": "^2.0.0",
115
+ "rollup-plugin-import-css": "^3.0.3",
116
+ "rollup-plugin-node-externals": "^5.1.2",
117
+ "rollup-plugin-typescript2": "^0.31.2",
118
+ "showdown": "^2.1.0",
119
+ "storybook-source-link": "^2.0.4",
120
+ "ts-jest": "^29.0.5",
121
+ "typescript": "^4.9.4",
122
+ "xmldom": "^0.6.0"
123
+ },
124
+ "jest": {
125
+ "roots": [
126
+ "<rootDir>/src"
127
+ ],
128
+ "collectCoverageFrom": [
129
+ "src/**/*.{js,jsx,ts,tsx}",
130
+ "!src/**/*.d.ts"
131
+ ],
132
+ "setupFiles": [
133
+ "react-app-polyfill/jsdom"
134
+ ],
135
+ "setupFilesAfterEnv": [
136
+ "<rootDir>/src/setupTests.js"
137
+ ],
138
+ "testMatch": [
139
+ "<rootDir>/src/**/__tests__/**/*.{js,jsx,ts,tsx}",
140
+ "<rootDir>/src/**/*.{spec,test}.{js,jsx,ts,tsx}"
141
+ ],
142
+ "testEnvironment": "jsdom",
143
+ "testRunner": "<rootDir>/../../node_modules/jest-circus/runner.js",
144
+ "transform": {
145
+ "^.+\\.(js|jsx|mjs|cjs|ts|tsx)$": "<rootDir>/config/jest/babelTransform.js",
146
+ "^.+\\.css$": "<rootDir>/config/jest/cssTransform.js",
147
+ "^(?!.*\\.(js|jsx|mjs|cjs|ts|tsx|css|json)$)": "<rootDir>/config/jest/fileTransform.js"
148
+ },
149
+ "transformIgnorePatterns": [
150
+ "[/\\\\]node_modules[/\\\\].+\\.(js|jsx|mjs|cjs|ts|tsx)$",
151
+ "^.+\\.module\\.(css|sass|scss)$"
152
+ ],
153
+ "modulePaths": [],
154
+ "moduleNameMapper": {
155
+ "^react-native$": "react-native-web",
156
+ "^.+\\.module\\.(css|sass|scss)$": "identity-obj-proxy",
157
+ "^maplibre-gl/dist/maplibre-gl$": "<rootDir>/../../node_modules/maplibre-gl",
158
+ "d3": "<rootDir>/../../node_modules/d3/dist/d3.min.js"
159
+ },
160
+ "moduleFileExtensions": [
161
+ "web.js",
162
+ "js",
163
+ "web.ts",
164
+ "ts",
165
+ "web.tsx",
166
+ "tsx",
167
+ "json",
168
+ "web.jsx",
169
+ "jsx",
170
+ "node"
171
+ ],
172
+ "watchPlugins": [
173
+ "jest-watch-typeahead/filename",
174
+ "jest-watch-typeahead/testname"
175
+ ],
176
+ "resetMocks": true,
177
+ "coveragePathIgnorePatterns": [
178
+ "/node_modules/",
179
+ "/src/decorators/",
180
+ "/src/lab/",
181
+ "/src/stories/",
182
+ "/src/ui_components/",
183
+ "(.test)\\.(ts|tsx|js)$",
184
+ "index\\.js$",
185
+ ".*/lib/.*",
186
+ ".*/utils/.*",
187
+ ".*/util/.*",
188
+ ".*/assets/.*",
189
+ ".*/custom.d.tsx",
190
+ "custom\\-.*\\-mode\\.js$",
191
+ "(.stories)\\.(ts|tsx|js)$",
192
+ "/distribution/.*\\.(ts|js)$"
193
+ ]
194
+ },
195
+ "publishConfig": {
196
+ "access": "public"
197
+ },
198
+ "gitHead": "ebbc7011de1e8709b14c89816890ad067322df16"
199
+ }
@@ -0,0 +1,4 @@
1
+ [
2
+ {"coordinates": [7.132122000552613, 50.716405378037706]},
3
+ {"coordinates": [7.13212200055666, 50.71640537803666]}
4
+ ]