react-bkoi-gl 1.0.1

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 (138) hide show
  1. package/README.md +96 -0
  2. package/bkoi-gl/package.json +6 -0
  3. package/dist/components/attribution-control.d.ts +11 -0
  4. package/dist/components/attribution-control.js +19 -0
  5. package/dist/components/attribution-control.js.map +1 -0
  6. package/dist/components/fullscreen-control.d.ts +14 -0
  7. package/dist/components/fullscreen-control.js +21 -0
  8. package/dist/components/fullscreen-control.js.map +1 -0
  9. package/dist/components/geolocate-control.d.ts +37 -0
  10. package/dist/components/geolocate-control.js +51 -0
  11. package/dist/components/geolocate-control.js.map +1 -0
  12. package/dist/components/layer.d.ts +17 -0
  13. package/dist/components/layer.js +99 -0
  14. package/dist/components/layer.js.map +1 -0
  15. package/dist/components/map.d.ts +23 -0
  16. package/dist/components/map.js +102 -0
  17. package/dist/components/map.js.map +1 -0
  18. package/dist/components/marker.d.ts +41 -0
  19. package/dist/components/marker.js +102 -0
  20. package/dist/components/marker.js.map +1 -0
  21. package/dist/components/navigation-control.d.ts +11 -0
  22. package/dist/components/navigation-control.js +19 -0
  23. package/dist/components/navigation-control.js.map +1 -0
  24. package/dist/components/popup.d.ts +33 -0
  25. package/dist/components/popup.js +81 -0
  26. package/dist/components/popup.js.map +1 -0
  27. package/dist/components/scale-control.d.ts +13 -0
  28. package/dist/components/scale-control.js +31 -0
  29. package/dist/components/scale-control.js.map +1 -0
  30. package/dist/components/source.d.ts +7 -0
  31. package/dist/components/source.js +98 -0
  32. package/dist/components/source.js.map +1 -0
  33. package/dist/components/use-control.d.ts +9 -0
  34. package/dist/components/use-control.js +31 -0
  35. package/dist/components/use-control.js.map +1 -0
  36. package/dist/components/use-map.d.ts +20 -0
  37. package/dist/components/use-map.js +55 -0
  38. package/dist/components/use-map.js.map +1 -0
  39. package/dist/exports-bkoi-gl.cjs +1512 -0
  40. package/dist/exports-bkoi-gl.d.ts +89 -0
  41. package/dist/exports-bkoi-gl.js +36 -0
  42. package/dist/exports-bkoi-gl.js.map +1 -0
  43. package/dist/exports-mapbox.d.ts +139 -0
  44. package/dist/exports-mapbox.js +36 -0
  45. package/dist/exports-mapbox.js.map +1 -0
  46. package/dist/index.cjs +1514 -0
  47. package/dist/index.d.ts +2 -0
  48. package/dist/index.js +3 -0
  49. package/dist/index.js.map +1 -0
  50. package/dist/mapbox/create-ref.d.ts +9 -0
  51. package/dist/mapbox/create-ref.js +64 -0
  52. package/dist/mapbox/create-ref.js.map +1 -0
  53. package/dist/mapbox/mapbox.d.ts +81 -0
  54. package/dist/mapbox/mapbox.js +477 -0
  55. package/dist/mapbox/mapbox.js.map +1 -0
  56. package/dist/styles/react-bkoi-gl.css +1 -0
  57. package/dist/types/common.d.ts +78 -0
  58. package/dist/types/common.js +2 -0
  59. package/dist/types/common.js.map +1 -0
  60. package/dist/types/events-bkoi-gl.d.ts +49 -0
  61. package/dist/types/events-bkoi-gl.js +2 -0
  62. package/dist/types/events-bkoi-gl.js.map +1 -0
  63. package/dist/types/events-mapbox.d.ts +49 -0
  64. package/dist/types/events-mapbox.js +2 -0
  65. package/dist/types/events-mapbox.js.map +1 -0
  66. package/dist/types/events.d.ts +39 -0
  67. package/dist/types/events.js +2 -0
  68. package/dist/types/events.js.map +1 -0
  69. package/dist/types/index.d.ts +70 -0
  70. package/dist/types/index.js +5 -0
  71. package/dist/types/index.js.map +1 -0
  72. package/dist/types/lib.d.ts +224 -0
  73. package/dist/types/lib.js +2 -0
  74. package/dist/types/lib.js.map +1 -0
  75. package/dist/types/public.d.ts +2 -0
  76. package/dist/types/public.js +2 -0
  77. package/dist/types/public.js.map +1 -0
  78. package/dist/types/style-spec-bkoi-gl.d.ts +9 -0
  79. package/dist/types/style-spec-bkoi-gl.js +2 -0
  80. package/dist/types/style-spec-bkoi-gl.js.map +1 -0
  81. package/dist/types/style-spec-mapbox.d.ts +7 -0
  82. package/dist/types/style-spec-mapbox.js +2 -0
  83. package/dist/types/style-spec-mapbox.js.map +1 -0
  84. package/dist/utils/apply-react-style.d.ts +2 -0
  85. package/dist/utils/apply-react-style.js +16 -0
  86. package/dist/utils/apply-react-style.js.map +1 -0
  87. package/dist/utils/assert.d.ts +1 -0
  88. package/dist/utils/assert.js +6 -0
  89. package/dist/utils/assert.js.map +1 -0
  90. package/dist/utils/deep-equal.d.ts +15 -0
  91. package/dist/utils/deep-equal.js +46 -0
  92. package/dist/utils/deep-equal.js.map +1 -0
  93. package/dist/utils/set-globals.d.ts +22 -0
  94. package/dist/utils/set-globals.js +19 -0
  95. package/dist/utils/set-globals.js.map +1 -0
  96. package/dist/utils/style-utils.d.ts +2 -0
  97. package/dist/utils/style-utils.js +42 -0
  98. package/dist/utils/style-utils.js.map +1 -0
  99. package/dist/utils/transform.d.ts +26 -0
  100. package/dist/utils/transform.js +56 -0
  101. package/dist/utils/transform.js.map +1 -0
  102. package/dist/utils/use-isomorphic-layout-effect.d.ts +3 -0
  103. package/dist/utils/use-isomorphic-layout-effect.js +4 -0
  104. package/dist/utils/use-isomorphic-layout-effect.js.map +1 -0
  105. package/package.json +78 -0
  106. package/src/components/attribution-control.ts +32 -0
  107. package/src/components/fullscreen-control.tsx +37 -0
  108. package/src/components/geolocate-control.ts +90 -0
  109. package/src/components/layer.ts +133 -0
  110. package/src/components/map.tsx +155 -0
  111. package/src/components/marker.ts +137 -0
  112. package/src/components/navigation-control.ts +29 -0
  113. package/src/components/popup.ts +116 -0
  114. package/src/components/scale-control.ts +46 -0
  115. package/src/components/source.ts +158 -0
  116. package/src/components/use-control.ts +64 -0
  117. package/src/components/use-map.tsx +69 -0
  118. package/src/exports-bkoi-gl.ts +156 -0
  119. package/src/exports-mapbox.ts +159 -0
  120. package/src/index.ts +2 -0
  121. package/src/mapbox/create-ref.ts +118 -0
  122. package/src/mapbox/mapbox.ts +742 -0
  123. package/src/types/common.ts +94 -0
  124. package/src/types/events-bkoi-gl.ts +78 -0
  125. package/src/types/events-mapbox.ts +76 -0
  126. package/src/types/events.ts +73 -0
  127. package/src/types/index.ts +93 -0
  128. package/src/types/lib.ts +279 -0
  129. package/src/types/public.ts +9 -0
  130. package/src/types/style-spec-bkoi-gl.ts +81 -0
  131. package/src/types/style-spec-mapbox.ts +80 -0
  132. package/src/utils/apply-react-style.ts +20 -0
  133. package/src/utils/assert.ts +5 -0
  134. package/src/utils/deep-equal.ts +61 -0
  135. package/src/utils/set-globals.ts +57 -0
  136. package/src/utils/style-utils.ts +59 -0
  137. package/src/utils/transform.ts +86 -0
  138. package/src/utils/use-isomorphic-layout-effect.ts +7 -0
@@ -0,0 +1,81 @@
1
+ /*
2
+ * Maplibre Style Specification types
3
+ * Type names are aligned with mapbox
4
+ */
5
+ import type {
6
+ BackgroundLayerSpecification as BackgroundLayer,
7
+ CircleLayerSpecification as CircleLayer,
8
+ FillLayerSpecification as FillLayer,
9
+ FillExtrusionLayerSpecification as FillExtrusionLayer,
10
+ HeatmapLayerSpecification as HeatmapLayer,
11
+ HillshadeLayerSpecification as HillshadeLayer,
12
+ LineLayerSpecification as LineLayer,
13
+ RasterLayerSpecification as RasterLayer,
14
+ SymbolLayerSpecification as SymbolLayer,
15
+ GeoJSONSourceSpecification as GeoJSONSourceRaw,
16
+ VideoSourceSpecification as VideoSourceRaw,
17
+ ImageSourceSpecification as ImageSourceRaw,
18
+ VectorSourceSpecification as VectorSourceRaw,
19
+ RasterSourceSpecification as RasterSource,
20
+ RasterDEMSourceSpecification as RasterDemSource
21
+ } from '@maplibre/maplibre-gl-style-spec';
22
+
23
+ // @ts-ignore
24
+ // eslint-disable-next-line import/no-unresolved
25
+ import {CanvasSourceSpecification as CanvasSourceRaw} from 'bkoi-gl';
26
+
27
+ // Layers
28
+ export type {
29
+ BackgroundLayer,
30
+ CircleLayer,
31
+ FillLayer,
32
+ FillExtrusionLayer,
33
+ HeatmapLayer,
34
+ HillshadeLayer,
35
+ LineLayer,
36
+ RasterLayer,
37
+ SymbolLayer
38
+ };
39
+
40
+ export type AnyLayer =
41
+ | BackgroundLayer
42
+ | CircleLayer
43
+ | FillLayer
44
+ | FillExtrusionLayer
45
+ | HeatmapLayer
46
+ | HillshadeLayer
47
+ | LineLayer
48
+ | RasterLayer
49
+ | SymbolLayer;
50
+
51
+ // Sources
52
+ export type {
53
+ GeoJSONSourceRaw,
54
+ VideoSourceRaw,
55
+ ImageSourceRaw,
56
+ CanvasSourceRaw,
57
+ VectorSourceRaw,
58
+ RasterSource,
59
+ RasterDemSource
60
+ };
61
+
62
+ export type AnySource =
63
+ | GeoJSONSourceRaw
64
+ | VideoSourceRaw
65
+ | ImageSourceRaw
66
+ | CanvasSourceRaw
67
+ | VectorSourceRaw
68
+ | RasterSource
69
+ | RasterDemSource;
70
+
71
+ // Other style types
72
+
73
+ export type {
74
+ StyleSpecification as MapStyle,
75
+ LightSpecification as Light,
76
+ TerrainSpecification as Terrain
77
+ } from '@maplibre/maplibre-gl-style-spec';
78
+
79
+ // The following types are not yet supported by maplibre
80
+ export type Fog = never;
81
+ export type Projection = never;
@@ -0,0 +1,80 @@
1
+ /*
2
+ * Mapbox Style Specification types
3
+ */
4
+ // Layers
5
+ import type {
6
+ BackgroundLayer,
7
+ SkyLayer,
8
+ CircleLayer,
9
+ FillLayer,
10
+ FillExtrusionLayer,
11
+ HeatmapLayer,
12
+ HillshadeLayer,
13
+ LineLayer,
14
+ RasterLayer,
15
+ SymbolLayer
16
+ } from 'mapbox-gl';
17
+
18
+ export type AnyLayer =
19
+ | BackgroundLayer
20
+ | CircleLayer
21
+ | FillExtrusionLayer
22
+ | FillLayer
23
+ | HeatmapLayer
24
+ | HillshadeLayer
25
+ | LineLayer
26
+ | RasterLayer
27
+ | SymbolLayer
28
+ | SkyLayer;
29
+
30
+ export type {
31
+ BackgroundLayer,
32
+ SkyLayer,
33
+ CircleLayer,
34
+ FillLayer,
35
+ FillExtrusionLayer,
36
+ HeatmapLayer,
37
+ HillshadeLayer,
38
+ LineLayer,
39
+ RasterLayer,
40
+ SymbolLayer
41
+ };
42
+
43
+ // Sources
44
+ import type {
45
+ GeoJSONSourceRaw,
46
+ VideoSourceRaw,
47
+ ImageSourceRaw,
48
+ VectorSource as VectorSourceRaw,
49
+ RasterSource,
50
+ CanvasSourceRaw,
51
+ RasterDemSource
52
+ } from 'mapbox-gl';
53
+
54
+ export type AnySource =
55
+ | GeoJSONSourceRaw
56
+ | VideoSourceRaw
57
+ | ImageSourceRaw
58
+ | CanvasSourceRaw
59
+ | VectorSourceRaw
60
+ | RasterSource
61
+ | RasterDemSource;
62
+
63
+ export type {
64
+ GeoJSONSourceRaw,
65
+ VideoSourceRaw,
66
+ ImageSourceRaw,
67
+ CanvasSourceRaw,
68
+ VectorSourceRaw,
69
+ RasterSource,
70
+ RasterDemSource
71
+ };
72
+
73
+ // Other
74
+ export type {
75
+ Style as MapStyle,
76
+ Light,
77
+ Fog,
78
+ TerrainSpecification as Terrain,
79
+ Projection
80
+ } from 'mapbox-gl';
@@ -0,0 +1,20 @@
1
+ import * as React from 'react';
2
+ // This is a simplified version of
3
+ // https://github.com/facebook/react/blob/4131af3e4bf52f3a003537ec95a1655147c81270/src/renderers/dom/shared/CSSPropertyOperations.js#L62
4
+ const unitlessNumber = /box|flex|grid|column|lineHeight|fontWeight|opacity|order|tabSize|zIndex/;
5
+
6
+ export function applyReactStyle(element: HTMLElement, styles: React.CSSProperties) {
7
+ if (!element || !styles) {
8
+ return;
9
+ }
10
+ const style = element.style;
11
+
12
+ for (const key in styles) {
13
+ const value = styles[key];
14
+ if (Number.isFinite(value) && !unitlessNumber.test(key)) {
15
+ style[key] = `${value}px`;
16
+ } else {
17
+ style[key] = value;
18
+ }
19
+ }
20
+ }
@@ -0,0 +1,5 @@
1
+ export default function assert(condition: any, message: string) {
2
+ if (!condition) {
3
+ throw new Error(message);
4
+ }
5
+ }
@@ -0,0 +1,61 @@
1
+ import type {PointLike} from '../types';
2
+
3
+ /**
4
+ * Compare two points
5
+ * @param a
6
+ * @param b
7
+ * @returns true if the points are equal
8
+ */
9
+ export function arePointsEqual(a?: PointLike, b?: PointLike): boolean {
10
+ const ax = Array.isArray(a) ? a[0] : a ? a.x : 0;
11
+ const ay = Array.isArray(a) ? a[1] : a ? a.y : 0;
12
+ const bx = Array.isArray(b) ? b[0] : b ? b.x : 0;
13
+ const by = Array.isArray(b) ? b[1] : b ? b.y : 0;
14
+ return ax === bx && ay === by;
15
+ }
16
+
17
+ /* eslint-disable complexity */
18
+ /**
19
+ * Compare any two objects
20
+ * @param a
21
+ * @param b
22
+ * @returns true if the objects are deep equal
23
+ */
24
+ export function deepEqual(a: any, b: any): boolean {
25
+ if (a === b) {
26
+ return true;
27
+ }
28
+ if (!a || !b) {
29
+ return false;
30
+ }
31
+ if (Array.isArray(a)) {
32
+ if (!Array.isArray(b) || a.length !== b.length) {
33
+ return false;
34
+ }
35
+ for (let i = 0; i < a.length; i++) {
36
+ if (!deepEqual(a[i], b[i])) {
37
+ return false;
38
+ }
39
+ }
40
+ return true;
41
+ } else if (Array.isArray(b)) {
42
+ return false;
43
+ }
44
+ if (typeof a === 'object' && typeof b === 'object') {
45
+ const aKeys = Object.keys(a);
46
+ const bKeys = Object.keys(b);
47
+ if (aKeys.length !== bKeys.length) {
48
+ return false;
49
+ }
50
+ for (const key of aKeys) {
51
+ if (!b.hasOwnProperty(key)) {
52
+ return false;
53
+ }
54
+ if (!deepEqual(a[key], b[key])) {
55
+ return false;
56
+ }
57
+ }
58
+ return true;
59
+ }
60
+ return false;
61
+ }
@@ -0,0 +1,57 @@
1
+ export type GlobalSettings = {
2
+ /** The map's default API URL for requesting tiles, styles, sprites, and glyphs. */
3
+ baseApiUrl?: string;
4
+ /** The maximum number of images (raster tiles, sprites, icons) to load in parallel.
5
+ * @default 16
6
+ */
7
+ maxParallelImageRequests?: number;
8
+ /** The map's RTL text plugin. Necessary for supporting the Arabic and Hebrew languages, which are written right-to-left. */
9
+ RTLTextPlugin?: string | false;
10
+ /** Provides an interface for external module bundlers such as Webpack or Rollup to package mapbox-gl's WebWorker into a separate class and integrate it with the library.
11
+ Takes precedence over `workerUrl`. */
12
+ workerClass?: any;
13
+ /** The number of web workers instantiated on a page with mapbox-gl maps.
14
+ * @default 2
15
+ */
16
+ workerCount?: number;
17
+ /** Provides an interface for loading mapbox-gl's WebWorker bundle from a self-hosted URL.
18
+ * This is useful if your site needs to operate in a strict CSP (Content Security Policy) environment
19
+ * wherein you are not allowed to load JavaScript code from a Blob URL, which is default behavior. */
20
+ workerUrl?: string;
21
+ };
22
+
23
+ const globalSettings = [
24
+ 'baseApiUrl',
25
+ 'maxParallelImageRequests',
26
+ 'workerClass',
27
+ 'workerCount',
28
+ 'workerUrl'
29
+ ] as const;
30
+
31
+ export default function setGlobals(mapLib: any, props: GlobalSettings) {
32
+ for (const key of globalSettings) {
33
+ if (key in props) {
34
+ mapLib[key] = props[key];
35
+ }
36
+ }
37
+
38
+ const {
39
+ RTLTextPlugin = 'https://api.mapbox.com/mapbox-gl-js/plugins/mapbox-gl-rtl-text/v0.2.3/mapbox-gl-rtl-text.js'
40
+ } = props;
41
+ if (
42
+ RTLTextPlugin &&
43
+ mapLib.getRTLTextPluginStatus &&
44
+ mapLib.getRTLTextPluginStatus() === 'unavailable'
45
+ ) {
46
+ mapLib.setRTLTextPlugin(
47
+ RTLTextPlugin,
48
+ (error?: Error) => {
49
+ if (error) {
50
+ // eslint-disable-next-line
51
+ console.error(error);
52
+ }
53
+ },
54
+ true
55
+ );
56
+ }
57
+ }
@@ -0,0 +1,59 @@
1
+ import {ImmutableLike, MapStyle} from '../types';
2
+
3
+ const refProps = ['type', 'source', 'source-layer', 'minzoom', 'maxzoom', 'filter', 'layout'];
4
+
5
+ // Prepare a map style object for diffing
6
+ // If immutable - convert to plain object
7
+ // Work around some issues in older styles that would fail Mapbox's diffing
8
+ export function normalizeStyle(
9
+ style: string | MapStyle | ImmutableLike<MapStyle>
10
+ ): string | MapStyle {
11
+ if (!style) {
12
+ return null;
13
+ }
14
+ if (typeof style === 'string') {
15
+ return style;
16
+ }
17
+ if ('toJS' in style) {
18
+ style = style.toJS();
19
+ }
20
+ if (!style.layers) {
21
+ return style;
22
+ }
23
+ const layerIndex = {};
24
+
25
+ for (const layer of style.layers) {
26
+ layerIndex[layer.id] = layer;
27
+ }
28
+
29
+ const layers = style.layers.map(layer => {
30
+ let normalizedLayer: typeof layer = null;
31
+
32
+ if ('interactive' in layer) {
33
+ normalizedLayer = Object.assign({}, layer);
34
+ // Breaks style diffing :(
35
+ // @ts-ignore legacy field not typed
36
+ delete normalizedLayer.interactive;
37
+ }
38
+
39
+ // Style diffing doesn't work with refs so expand them out manually before diffing.
40
+ // @ts-ignore legacy field not typed
41
+ const layerRef = layerIndex[layer.ref];
42
+ if (layerRef) {
43
+ normalizedLayer = normalizedLayer || Object.assign({}, layer);
44
+ // @ts-ignore
45
+ delete normalizedLayer.ref;
46
+ // https://github.com/mapbox/mapbox-gl-js/blob/master/src/style-spec/deref.js
47
+ for (const propName of refProps) {
48
+ if (propName in layerRef) {
49
+ normalizedLayer[propName] = layerRef[propName];
50
+ }
51
+ }
52
+ }
53
+
54
+ return normalizedLayer || layer;
55
+ });
56
+
57
+ // Do not mutate the style object provided by the user
58
+ return {...style, layers};
59
+ }
@@ -0,0 +1,86 @@
1
+ import type {MapboxProps} from '../mapbox/mapbox';
2
+ import type {Transform, ViewState} from '../types';
3
+ import {deepEqual} from './deep-equal';
4
+
5
+ /**
6
+ * Make a copy of a transform
7
+ * @param tr
8
+ */
9
+ export function cloneTransform(tr: Transform): Transform {
10
+ const newTransform = tr.clone();
11
+ // Work around mapbox bug - this value is not assigned in clone(), only in resize()
12
+ newTransform.pixelsToGLUnits = tr.pixelsToGLUnits;
13
+ return newTransform;
14
+ }
15
+
16
+ /**
17
+ * Copy projection from one transform to another. This only applies to mapbox-gl transforms
18
+ * @param src the transform to copy projection settings from
19
+ * @param dest to transform to copy projection settings to
20
+ */
21
+ export function syncProjection(src: Transform, dest: Transform): void {
22
+ if (!src.getProjection) {
23
+ return;
24
+ }
25
+ const srcProjection = src.getProjection();
26
+ const destProjection = dest.getProjection();
27
+
28
+ if (!deepEqual(srcProjection, destProjection)) {
29
+ dest.setProjection(srcProjection);
30
+ }
31
+ }
32
+
33
+ /**
34
+ * Capture a transform's current state
35
+ * @param transform
36
+ * @returns descriptor of the view state
37
+ */
38
+ export function transformToViewState(tr: Transform): ViewState {
39
+ return {
40
+ longitude: tr.center.lng,
41
+ latitude: tr.center.lat,
42
+ zoom: tr.zoom,
43
+ pitch: tr.pitch,
44
+ bearing: tr.bearing,
45
+ padding: tr.padding
46
+ };
47
+ }
48
+
49
+ /* eslint-disable complexity */
50
+ /**
51
+ * Mutate a transform to match the given view state
52
+ * @param transform
53
+ * @param viewState
54
+ * @returns true if the transform has changed
55
+ */
56
+ export function applyViewStateToTransform(tr: Transform, props: MapboxProps): boolean {
57
+ const v: Partial<ViewState> = props.viewState || props;
58
+ let changed = false;
59
+
60
+ if ('zoom' in v) {
61
+ const zoom = tr.zoom;
62
+ tr.zoom = v.zoom;
63
+ changed = changed || zoom !== tr.zoom;
64
+ }
65
+ if ('bearing' in v) {
66
+ const bearing = tr.bearing;
67
+ tr.bearing = v.bearing;
68
+ changed = changed || bearing !== tr.bearing;
69
+ }
70
+ if ('pitch' in v) {
71
+ const pitch = tr.pitch;
72
+ tr.pitch = v.pitch;
73
+ changed = changed || pitch !== tr.pitch;
74
+ }
75
+ if (v.padding && !tr.isPaddingEqual(v.padding)) {
76
+ changed = true;
77
+ tr.padding = v.padding;
78
+ }
79
+ if ('longitude' in v && 'latitude' in v) {
80
+ const center = tr.center;
81
+ // @ts-ignore
82
+ tr.center = new center.constructor(v.longitude, v.latitude);
83
+ changed = changed || center !== tr.center;
84
+ }
85
+ return changed;
86
+ }
@@ -0,0 +1,7 @@
1
+ // From https://github.com/streamich/react-use/blob/master/src/useIsomorphicLayoutEffect.ts
2
+ // useLayoutEffect but does not trigger warning in server-side rendering
3
+ import {useEffect, useLayoutEffect} from 'react';
4
+
5
+ const useIsomorphicLayoutEffect = typeof document !== 'undefined' ? useLayoutEffect : useEffect;
6
+
7
+ export default useIsomorphicLayoutEffect;