@macrostrat/map-interface 1.6.0 → 2.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.
- package/CHANGELOG.md +13 -0
- package/dist/container.cjs +134 -0
- package/dist/container.cjs.map +1 -0
- package/dist/container.d.ts +17 -0
- package/dist/container.js +131 -0
- package/dist/container.js.map +1 -0
- package/dist/context-panel/index.cjs +81 -0
- package/dist/context-panel/index.cjs.map +1 -0
- package/dist/context-panel/index.d.ts +36 -0
- package/dist/context-panel/index.js +79 -0
- package/dist/context-panel/index.js.map +1 -0
- package/dist/context-panel/main.module.sass.cjs +16 -0
- package/dist/context-panel/main.module.sass.cjs.map +1 -0
- package/dist/context-panel/main.module.sass.js +16 -0
- package/dist/context-panel/main.module.sass.js.map +1 -0
- package/dist/controls.cjs +56 -0
- package/dist/controls.cjs.map +1 -0
- package/dist/controls.d.ts +3 -0
- package/dist/controls.js +54 -0
- package/dist/controls.js.map +1 -0
- package/dist/dev/index.d.ts +4 -0
- package/dist/dev/main.module.sass.cjs +30 -0
- package/dist/dev/main.module.sass.cjs.map +1 -0
- package/dist/dev/main.module.sass.js +30 -0
- package/dist/dev/main.module.sass.js.map +1 -0
- package/dist/dev/map-page.cjs +158 -0
- package/dist/dev/map-page.cjs.map +1 -0
- package/dist/dev/map-page.d.ts +26 -0
- package/dist/dev/map-page.js +155 -0
- package/dist/dev/map-page.js.map +1 -0
- package/dist/dev/tile-extent.cjs +39 -0
- package/dist/dev/tile-extent.cjs.map +1 -0
- package/dist/dev/tile-extent.d.ts +10 -0
- package/dist/dev/tile-extent.js +39 -0
- package/dist/dev/tile-extent.js.map +1 -0
- package/dist/dev/vector-tile-features.cjs +214 -0
- package/dist/dev/vector-tile-features.cjs.map +1 -0
- package/dist/dev/vector-tile-features.d.ts +29 -0
- package/dist/dev/vector-tile-features.js +212 -0
- package/dist/dev/vector-tile-features.js.map +1 -0
- package/dist/dev/xray.cjs +93 -0
- package/dist/dev/xray.cjs.map +1 -0
- package/dist/dev/xray.d.ts +41 -0
- package/dist/dev/xray.js +93 -0
- package/dist/dev/xray.js.map +1 -0
- package/dist/expansion-panel/headers.cjs +22 -0
- package/dist/expansion-panel/headers.cjs.map +1 -0
- package/dist/expansion-panel/headers.d.ts +1 -0
- package/dist/expansion-panel/headers.js +20 -0
- package/dist/expansion-panel/headers.js.map +1 -0
- package/dist/expansion-panel/index.cjs +128 -0
- package/dist/expansion-panel/index.cjs.map +1 -0
- package/dist/expansion-panel/index.d.ts +18 -0
- package/dist/expansion-panel/index.js +125 -0
- package/dist/expansion-panel/index.js.map +1 -0
- package/dist/expansion-panel/main.module.sass.cjs +27 -0
- package/dist/expansion-panel/main.module.sass.cjs.map +1 -0
- package/dist/expansion-panel/main.module.sass.js +27 -0
- package/dist/expansion-panel/main.module.sass.js.map +1 -0
- package/dist/hash-string.cjs +81 -0
- package/dist/hash-string.cjs.map +1 -0
- package/dist/hash-string.d.ts +12 -0
- package/dist/hash-string.js +81 -0
- package/dist/hash-string.js.map +1 -0
- package/dist/helpers.cjs +164 -0
- package/dist/helpers.cjs.map +1 -0
- package/dist/helpers.d.ts +34 -0
- package/dist/helpers.js +162 -0
- package/dist/helpers.js.map +1 -0
- package/dist/index.cjs +73 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.js +73 -0
- package/dist/index.js.map +1 -0
- package/dist/location-details/fetch.d.ts +4 -0
- package/dist/location-details/fossil-collections/collections.cjs +70 -0
- package/dist/location-details/fossil-collections/collections.cjs.map +1 -0
- package/dist/location-details/fossil-collections/collections.d.ts +3 -0
- package/dist/location-details/fossil-collections/collections.js +68 -0
- package/dist/location-details/fossil-collections/collections.js.map +1 -0
- package/dist/location-details/fossil-collections/index.cjs +15 -0
- package/dist/location-details/fossil-collections/index.cjs.map +1 -0
- package/dist/location-details/fossil-collections/index.d.ts +3 -0
- package/dist/location-details/fossil-collections/index.js +13 -0
- package/dist/location-details/fossil-collections/index.js.map +1 -0
- package/dist/location-details/fossil-collections/main.module.sass.cjs +7 -0
- package/dist/location-details/fossil-collections/main.module.sass.cjs.map +1 -0
- package/dist/location-details/fossil-collections/main.module.sass.js +8 -0
- package/dist/location-details/fossil-collections/main.module.sass.js.map +1 -0
- package/dist/location-details/index.d.ts +5 -0
- package/dist/location-details/info-blocks.cjs +84 -0
- package/dist/location-details/info-blocks.cjs.map +1 -0
- package/dist/location-details/info-blocks.d.ts +9 -0
- package/dist/location-details/info-blocks.js +81 -0
- package/dist/location-details/info-blocks.js.map +1 -0
- package/dist/location-details/info-blocks.module.sass.cjs +18 -0
- package/dist/location-details/info-blocks.module.sass.cjs.map +1 -0
- package/dist/location-details/info-blocks.module.sass.js +18 -0
- package/dist/location-details/info-blocks.module.sass.js.map +1 -0
- package/dist/location-details/macrostrat-linked.cjs +358 -0
- package/dist/location-details/macrostrat-linked.cjs.map +1 -0
- package/dist/location-details/macrostrat-linked.d.ts +1 -0
- package/dist/location-details/macrostrat-linked.js +355 -0
- package/dist/location-details/macrostrat-linked.js.map +1 -0
- package/dist/location-details/main.module.sass.cjs +20 -0
- package/dist/location-details/main.module.sass.cjs.map +1 -0
- package/dist/location-details/main.module.sass.js +20 -0
- package/dist/location-details/main.module.sass.js.map +1 -0
- package/dist/location-details/physiography.cjs +32 -0
- package/dist/location-details/physiography.cjs.map +1 -0
- package/dist/location-details/physiography.d.ts +1 -0
- package/dist/location-details/physiography.js +30 -0
- package/dist/location-details/physiography.js.map +1 -0
- package/dist/location-details/reg-strat.cjs +92 -0
- package/dist/location-details/reg-strat.cjs.map +1 -0
- package/dist/location-details/reg-strat.d.ts +6 -0
- package/dist/location-details/reg-strat.js +90 -0
- package/dist/location-details/reg-strat.js.map +1 -0
- package/dist/location-details/utils/formatting.cjs +16 -0
- package/dist/location-details/utils/formatting.cjs.map +1 -0
- package/dist/location-details/utils/formatting.d.ts +16 -0
- package/dist/location-details/utils/formatting.js +16 -0
- package/dist/location-details/utils/formatting.js.map +1 -0
- package/dist/location-details/utils/fossils.cjs +149 -0
- package/dist/location-details/utils/fossils.cjs.map +1 -0
- package/dist/location-details/utils/fossils.d.ts +3 -0
- package/dist/location-details/utils/fossils.js +149 -0
- package/dist/location-details/utils/fossils.js.map +1 -0
- package/dist/location-details/utils/index.cjs +15 -0
- package/dist/location-details/utils/index.cjs.map +1 -0
- package/dist/location-details/utils/index.d.ts +12 -0
- package/dist/location-details/utils/index.js +15 -0
- package/dist/location-details/utils/index.js.map +1 -0
- package/dist/location-details/xdd-panel/article.cjs +64 -0
- package/dist/location-details/xdd-panel/article.cjs.map +1 -0
- package/dist/location-details/xdd-panel/article.d.ts +1 -0
- package/dist/location-details/xdd-panel/article.js +62 -0
- package/dist/location-details/xdd-panel/article.js.map +1 -0
- package/dist/location-details/xdd-panel/index.cjs +71 -0
- package/dist/location-details/xdd-panel/index.cjs.map +1 -0
- package/dist/location-details/xdd-panel/index.d.ts +18 -0
- package/dist/location-details/xdd-panel/index.js +69 -0
- package/dist/location-details/xdd-panel/index.js.map +1 -0
- package/dist/location-details/xdd-panel/journal.cjs +27 -0
- package/dist/{cjs/map-interface.3ca778c5.js.map → location-details/xdd-panel/journal.cjs.map} +1 -1
- package/dist/location-details/xdd-panel/journal.d.ts +20 -0
- package/dist/location-details/xdd-panel/journal.js +25 -0
- package/dist/location-details/xdd-panel/journal.js.map +1 -0
- package/dist/location-panel/header.cjs +112 -0
- package/dist/location-panel/header.cjs.map +1 -0
- package/dist/location-panel/header.d.ts +16 -0
- package/dist/location-panel/header.js +109 -0
- package/dist/location-panel/header.js.map +1 -0
- package/dist/location-panel/index.cjs +45 -0
- package/dist/location-panel/index.cjs.map +1 -0
- package/dist/location-panel/index.d.ts +15 -0
- package/dist/location-panel/index.js +42 -0
- package/dist/location-panel/index.js.map +1 -0
- package/dist/location-panel/main.module.sass.cjs +23 -0
- package/dist/location-panel/main.module.sass.cjs.map +1 -0
- package/dist/location-panel/main.module.sass.js +23 -0
- package/dist/location-panel/main.module.sass.js.map +1 -0
- package/dist/main.module.sass.cjs +70 -0
- package/dist/main.module.sass.cjs.map +1 -0
- package/dist/main.module.sass.js +70 -0
- package/dist/main.module.sass.js.map +1 -0
- package/dist/map-interface.css +1060 -0
- package/dist/map-view.cjs +204 -0
- package/dist/map-view.cjs.map +1 -0
- package/dist/map-view.d.ts +41 -0
- package/dist/map-view.js +200 -0
- package/dist/map-view.js.map +1 -0
- package/dist/utils.cjs +35 -0
- package/dist/utils.cjs.map +1 -0
- package/dist/utils.d.ts +7 -0
- package/dist/utils.js +35 -0
- package/dist/utils.js.map +1 -0
- package/package.json +56 -49
- package/src/context-panel/main.module.sass +3 -3
- package/src/dev/main.module.sass +1 -1
- package/src/expansion-panel/main.module.sass +4 -4
- package/src/location-details/fossil-collections/main.module.sass +1 -1
- package/src/location-details/info-blocks.module.sass +35 -0
- package/src/location-details/info-blocks.ts +1 -1
- package/src/location-details/macrostrat-linked.ts +1 -1
- package/src/location-details/{main.module.styl → main.module.sass} +21 -21
- package/src/location-panel/main.module.sass +3 -3
- package/src/main.module.sass +15 -15
- package/dist/cjs/index.js +0 -54
- package/dist/cjs/index.js.map +0 -1
- package/dist/cjs/map-interface.0e252a74.js +0 -88
- package/dist/cjs/map-interface.0e252a74.js.map +0 -1
- package/dist/cjs/map-interface.11056b04.js +0 -390
- package/dist/cjs/map-interface.11056b04.js.map +0 -1
- package/dist/cjs/map-interface.12e5d744.js +0 -123
- package/dist/cjs/map-interface.12e5d744.js.map +0 -1
- package/dist/cjs/map-interface.1b386e07.css +0 -111
- package/dist/cjs/map-interface.1b386e07.css.map +0 -1
- package/dist/cjs/map-interface.1faa2839.js +0 -14
- package/dist/cjs/map-interface.1faa2839.js.map +0 -1
- package/dist/cjs/map-interface.225c9340.js +0 -71
- package/dist/cjs/map-interface.225c9340.js.map +0 -1
- package/dist/cjs/map-interface.23d5c62c.js +0 -135
- package/dist/cjs/map-interface.23d5c62c.js.map +0 -1
- package/dist/cjs/map-interface.24a1c14e.js +0 -46
- package/dist/cjs/map-interface.24a1c14e.js.map +0 -1
- package/dist/cjs/map-interface.26497065.css +0 -92
- package/dist/cjs/map-interface.26497065.css.map +0 -1
- package/dist/cjs/map-interface.31742bd3.js +0 -65
- package/dist/cjs/map-interface.31742bd3.js.map +0 -1
- package/dist/cjs/map-interface.354aaa39.js +0 -135
- package/dist/cjs/map-interface.354aaa39.js.map +0 -1
- package/dist/cjs/map-interface.368b346c.css +0 -45
- package/dist/cjs/map-interface.368b346c.css.map +0 -1
- package/dist/cjs/map-interface.3ca778c5.js +0 -57
- package/dist/cjs/map-interface.4267aa3a.js +0 -68
- package/dist/cjs/map-interface.4267aa3a.js.map +0 -1
- package/dist/cjs/map-interface.441d3b83.css +0 -69
- package/dist/cjs/map-interface.441d3b83.css.map +0 -1
- package/dist/cjs/map-interface.46d1c77b.js +0 -189
- package/dist/cjs/map-interface.46d1c77b.js.map +0 -1
- package/dist/cjs/map-interface.4a3d9662.js +0 -112
- package/dist/cjs/map-interface.4a3d9662.js.map +0 -1
- package/dist/cjs/map-interface.4a401c1f.css +0 -584
- package/dist/cjs/map-interface.4a401c1f.css.map +0 -1
- package/dist/cjs/map-interface.4c5addca.js +0 -89
- package/dist/cjs/map-interface.4c5addca.js.map +0 -1
- package/dist/cjs/map-interface.5a4f4529.js +0 -38
- package/dist/cjs/map-interface.5a4f4529.js.map +0 -1
- package/dist/cjs/map-interface.633d24e6.css +0 -22
- package/dist/cjs/map-interface.633d24e6.css.map +0 -1
- package/dist/cjs/map-interface.67001b26.js +0 -66
- package/dist/cjs/map-interface.67001b26.js.map +0 -1
- package/dist/cjs/map-interface.69b2e2a9.js +0 -25
- package/dist/cjs/map-interface.69b2e2a9.js.map +0 -1
- package/dist/cjs/map-interface.70458f75.js +0 -26
- package/dist/cjs/map-interface.70458f75.js.map +0 -1
- package/dist/cjs/map-interface.7170f35e.js +0 -65
- package/dist/cjs/map-interface.7170f35e.js.map +0 -1
- package/dist/cjs/map-interface.7509f2c1.js +0 -29
- package/dist/cjs/map-interface.7509f2c1.js.map +0 -1
- package/dist/cjs/map-interface.7bdbe4b6.js +0 -220
- package/dist/cjs/map-interface.7bdbe4b6.js.map +0 -1
- package/dist/cjs/map-interface.8d67cc21.js +0 -100
- package/dist/cjs/map-interface.8d67cc21.js.map +0 -1
- package/dist/cjs/map-interface.99a048dc.js +0 -79
- package/dist/cjs/map-interface.99a048dc.js.map +0 -1
- package/dist/cjs/map-interface.a3c2552f.js +0 -33
- package/dist/cjs/map-interface.a3c2552f.js.map +0 -1
- package/dist/cjs/map-interface.a960d638.js +0 -185
- package/dist/cjs/map-interface.a960d638.js.map +0 -1
- package/dist/cjs/map-interface.a9fe0f5d.js +0 -170
- package/dist/cjs/map-interface.a9fe0f5d.js.map +0 -1
- package/dist/cjs/map-interface.abe5fe65.js +0 -50
- package/dist/cjs/map-interface.abe5fe65.js.map +0 -1
- package/dist/cjs/map-interface.adb45df9.css +0 -191
- package/dist/cjs/map-interface.adb45df9.css.map +0 -1
- package/dist/cjs/map-interface.ae4c52a6.css +0 -52
- package/dist/cjs/map-interface.ae4c52a6.css.map +0 -1
- package/dist/cjs/map-interface.bda26b27.js +0 -134
- package/dist/cjs/map-interface.bda26b27.js.map +0 -1
- package/dist/cjs/map-interface.c5061c96.js +0 -36
- package/dist/cjs/map-interface.c5061c96.js.map +0 -1
- package/dist/cjs/map-interface.cd485bb4.js +0 -41
- package/dist/cjs/map-interface.cd485bb4.js.map +0 -1
- package/dist/cjs/map-interface.cf6c9a68.js +0 -208
- package/dist/cjs/map-interface.cf6c9a68.js.map +0 -1
- package/dist/cjs/map-interface.e74ded77.js +0 -135
- package/dist/cjs/map-interface.e74ded77.js.map +0 -1
- package/dist/cjs/map-interface.e975d65c.js +0 -23
- package/dist/cjs/map-interface.e975d65c.js.map +0 -1
- package/dist/cjs/map-interface.e9bcd5c0.js +0 -268
- package/dist/cjs/map-interface.e9bcd5c0.js.map +0 -1
- package/dist/cjs/map-interface.f8826069.js +0 -46
- package/dist/cjs/map-interface.f8826069.js.map +0 -1
- package/dist/cjs/map-interface.f9611285.js +0 -32
- package/dist/cjs/map-interface.f9611285.js.map +0 -1
- package/dist/cjs/map-interface.ffb109ef.js +0 -46
- package/dist/cjs/map-interface.ffb109ef.js.map +0 -1
- package/dist/esm/index.d.ts +0 -334
- package/dist/esm/index.d.ts.map +0 -1
- package/dist/esm/index.js +0 -27
- package/dist/esm/index.js.map +0 -1
- package/dist/esm/map-interface.01826888.js +0 -67
- package/dist/esm/map-interface.01826888.js.map +0 -1
- package/dist/esm/map-interface.021cf79b.js +0 -18
- package/dist/esm/map-interface.021cf79b.js.map +0 -1
- package/dist/esm/map-interface.065737fe.js +0 -172
- package/dist/esm/map-interface.065737fe.js.map +0 -1
- package/dist/esm/map-interface.0b1aa8f2.js +0 -81
- package/dist/esm/map-interface.0b1aa8f2.js.map +0 -1
- package/dist/esm/map-interface.1843c708.js +0 -83
- package/dist/esm/map-interface.1843c708.js.map +0 -1
- package/dist/esm/map-interface.1d38872e.js +0 -385
- package/dist/esm/map-interface.1d38872e.js.map +0 -1
- package/dist/esm/map-interface.1db44824.js +0 -24
- package/dist/esm/map-interface.1db44824.js.map +0 -1
- package/dist/esm/map-interface.22ea3934.js +0 -41
- package/dist/esm/map-interface.22ea3934.js.map +0 -1
- package/dist/esm/map-interface.2350f590.js +0 -48
- package/dist/esm/map-interface.2350f590.js.map +0 -1
- package/dist/esm/map-interface.27587c50.js +0 -126
- package/dist/esm/map-interface.27587c50.js.map +0 -1
- package/dist/esm/map-interface.2892a5fb.js +0 -178
- package/dist/esm/map-interface.2892a5fb.js.map +0 -1
- package/dist/esm/map-interface.3033c825.js +0 -40
- package/dist/esm/map-interface.3033c825.js.map +0 -1
- package/dist/esm/map-interface.3f07937e.js +0 -124
- package/dist/esm/map-interface.3f07937e.js.map +0 -1
- package/dist/esm/map-interface.473f1f2b.js +0 -28
- package/dist/esm/map-interface.473f1f2b.js.map +0 -1
- package/dist/esm/map-interface.50edfdfd.js +0 -74
- package/dist/esm/map-interface.50edfdfd.js.map +0 -1
- package/dist/esm/map-interface.557de808.js +0 -13
- package/dist/esm/map-interface.557de808.js.map +0 -1
- package/dist/esm/map-interface.578a7505.js +0 -130
- package/dist/esm/map-interface.578a7505.js.map +0 -1
- package/dist/esm/map-interface.59896194.js +0 -37
- package/dist/esm/map-interface.59896194.js.map +0 -1
- package/dist/esm/map-interface.64c62ba1.js +0 -62
- package/dist/esm/map-interface.64c62ba1.js.map +0 -1
- package/dist/esm/map-interface.672c2e0b.js +0 -182
- package/dist/esm/map-interface.672c2e0b.js.map +0 -1
- package/dist/esm/map-interface.6e65dcaf.js +0 -58
- package/dist/esm/map-interface.6e65dcaf.js.map +0 -1
- package/dist/esm/map-interface.70d6a7ff.js +0 -16
- package/dist/esm/map-interface.70d6a7ff.js.map +0 -1
- package/dist/esm/map-interface.72b1bfba.js +0 -94
- package/dist/esm/map-interface.72b1bfba.js.map +0 -1
- package/dist/esm/map-interface.786d6e58.js +0 -258
- package/dist/esm/map-interface.786d6e58.js.map +0 -1
- package/dist/esm/map-interface.7ea8a1e0.js +0 -40
- package/dist/esm/map-interface.7ea8a1e0.js.map +0 -1
- package/dist/esm/map-interface.9152234b.js +0 -114
- package/dist/esm/map-interface.9152234b.js.map +0 -1
- package/dist/esm/map-interface.957e414c.js +0 -52
- package/dist/esm/map-interface.957e414c.js.map +0 -1
- package/dist/esm/map-interface.a03a7a23.js +0 -16
- package/dist/esm/map-interface.a03a7a23.js.map +0 -1
- package/dist/esm/map-interface.a8c94450.js +0 -55
- package/dist/esm/map-interface.a8c94450.js.map +0 -1
- package/dist/esm/map-interface.bdef07d2.js +0 -34
- package/dist/esm/map-interface.bdef07d2.js.map +0 -1
- package/dist/esm/map-interface.c2a61cbf.js +0 -62
- package/dist/esm/map-interface.c2a61cbf.js.map +0 -1
- package/dist/esm/map-interface.c52c2fec.js +0 -130
- package/dist/esm/map-interface.c52c2fec.js.map +0 -1
- package/dist/esm/map-interface.c99b53b6.js +0 -43
- package/dist/esm/map-interface.c99b53b6.js.map +0 -1
- package/dist/esm/map-interface.ca1ee406.js +0 -214
- package/dist/esm/map-interface.ca1ee406.js.map +0 -1
- package/dist/esm/map-interface.e418553b.js +0 -107
- package/dist/esm/map-interface.e418553b.js.map +0 -1
- package/dist/esm/map-interface.e63d862d.js +0 -15
- package/dist/esm/map-interface.e63d862d.js.map +0 -1
- package/dist/esm/map-interface.f7b8bdb7.js +0 -192
- package/dist/esm/map-interface.f7b8bdb7.js.map +0 -1
- package/dist/node/index.js +0 -2
- package/dist/node/index.js.map +0 -1
- package/dist/node/map-interface.07882229.css +0 -2
- package/dist/node/map-interface.07882229.css.map +0 -1
- package/dist/node/map-interface.0e71fd95.js +0 -2
- package/dist/node/map-interface.0e71fd95.js.map +0 -1
- package/dist/node/map-interface.10f5ef81.js +0 -2
- package/dist/node/map-interface.10f5ef81.js.map +0 -1
- package/dist/node/map-interface.1a5eecac.js +0 -2
- package/dist/node/map-interface.1a5eecac.js.map +0 -1
- package/dist/node/map-interface.1be49df8.css +0 -2
- package/dist/node/map-interface.1be49df8.css.map +0 -1
- package/dist/node/map-interface.254e457a.js +0 -2
- package/dist/node/map-interface.254e457a.js.map +0 -1
- package/dist/node/map-interface.2d12b35c.js +0 -2
- package/dist/node/map-interface.2d12b35c.js.map +0 -1
- package/dist/node/map-interface.33b7734a.js +0 -2
- package/dist/node/map-interface.33b7734a.js.map +0 -1
- package/dist/node/map-interface.3ea55e0c.js +0 -2
- package/dist/node/map-interface.3ea55e0c.js.map +0 -1
- package/dist/node/map-interface.41e916d1.js +0 -2
- package/dist/node/map-interface.41e916d1.js.map +0 -1
- package/dist/node/map-interface.42ef081d.css +0 -2
- package/dist/node/map-interface.42ef081d.css.map +0 -1
- package/dist/node/map-interface.47b81f95.js +0 -2
- package/dist/node/map-interface.47b81f95.js.map +0 -1
- package/dist/node/map-interface.4b4f8fdf.js +0 -2
- package/dist/node/map-interface.4b4f8fdf.js.map +0 -1
- package/dist/node/map-interface.4df6e2c7.js +0 -2
- package/dist/node/map-interface.4df6e2c7.js.map +0 -1
- package/dist/node/map-interface.5736d6f8.js +0 -2
- package/dist/node/map-interface.5736d6f8.js.map +0 -1
- package/dist/node/map-interface.593e09ed.js +0 -2
- package/dist/node/map-interface.593e09ed.js.map +0 -1
- package/dist/node/map-interface.62b147ce.js +0 -2
- package/dist/node/map-interface.62b147ce.js.map +0 -1
- package/dist/node/map-interface.6314eef1.js +0 -2
- package/dist/node/map-interface.6314eef1.js.map +0 -1
- package/dist/node/map-interface.713361a4.js +0 -2
- package/dist/node/map-interface.713361a4.js.map +0 -1
- package/dist/node/map-interface.722387fb.js +0 -2
- package/dist/node/map-interface.722387fb.js.map +0 -1
- package/dist/node/map-interface.78e05655.js +0 -2
- package/dist/node/map-interface.78e05655.js.map +0 -1
- package/dist/node/map-interface.7aaa58c9.js +0 -2
- package/dist/node/map-interface.7aaa58c9.js.map +0 -1
- package/dist/node/map-interface.83fa8028.js +0 -2
- package/dist/node/map-interface.83fa8028.js.map +0 -1
- package/dist/node/map-interface.9317d050.js +0 -2
- package/dist/node/map-interface.9317d050.js.map +0 -1
- package/dist/node/map-interface.971af4bc.js +0 -2
- package/dist/node/map-interface.971af4bc.js.map +0 -1
- package/dist/node/map-interface.9824c03a.js +0 -2
- package/dist/node/map-interface.9824c03a.js.map +0 -1
- package/dist/node/map-interface.992dea73.js +0 -2
- package/dist/node/map-interface.992dea73.js.map +0 -1
- package/dist/node/map-interface.a1252092.css +0 -2
- package/dist/node/map-interface.a1252092.css.map +0 -1
- package/dist/node/map-interface.a8a16138.js +0 -2
- package/dist/node/map-interface.a8a16138.js.map +0 -1
- package/dist/node/map-interface.ae3d2d83.js +0 -2
- package/dist/node/map-interface.ae3d2d83.js.map +0 -1
- package/dist/node/map-interface.b0e1ad1b.js +0 -2
- package/dist/node/map-interface.b0e1ad1b.js.map +0 -1
- package/dist/node/map-interface.b14f08e8.js +0 -2
- package/dist/node/map-interface.b14f08e8.js.map +0 -1
- package/dist/node/map-interface.b33fab5e.js +0 -2
- package/dist/node/map-interface.b33fab5e.js.map +0 -1
- package/dist/node/map-interface.bd78832e.css +0 -2
- package/dist/node/map-interface.bd78832e.css.map +0 -1
- package/dist/node/map-interface.bf86da7c.js +0 -2
- package/dist/node/map-interface.bf86da7c.js.map +0 -1
- package/dist/node/map-interface.c5c0ad06.js +0 -2
- package/dist/node/map-interface.c5c0ad06.js.map +0 -1
- package/dist/node/map-interface.d22d91e9.css +0 -2
- package/dist/node/map-interface.d22d91e9.css.map +0 -1
- package/dist/node/map-interface.d2fce135.css +0 -2
- package/dist/node/map-interface.d2fce135.css.map +0 -1
- package/dist/node/map-interface.d5eba479.css +0 -2
- package/dist/node/map-interface.d5eba479.css.map +0 -1
- package/dist/node/map-interface.e7598785.js +0 -2
- package/dist/node/map-interface.e7598785.js.map +0 -1
- package/dist/node/map-interface.ed6b5586.js +0 -2
- package/dist/node/map-interface.ed6b5586.js.map +0 -1
- package/dist/node/map-interface.f13f7aeb.js +0 -2
- package/dist/node/map-interface.f13f7aeb.js.map +0 -1
- package/dist/node/map-interface.f413c362.js +0 -2
- package/dist/node/map-interface.f413c362.js.map +0 -1
- package/dist/node/map-interface.f4d2a5eb.js +0 -2
- package/dist/node/map-interface.f4d2a5eb.js.map +0 -1
- package/dist/node/map-interface.fdd35e74.js +0 -2
- package/dist/node/map-interface.fdd35e74.js.map +0 -1
- package/src/location-details/info-blocks.module.styl +0 -39
|
@@ -0,0 +1,214 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const core = require("@blueprintjs/core");
|
|
4
|
+
const mapboxReact = require("@macrostrat/mapbox-react");
|
|
5
|
+
const h$1 = require("@macrostrat/hyper");
|
|
6
|
+
const main_module = require("./main.module.sass.cjs");
|
|
7
|
+
const React = require("react");
|
|
8
|
+
const uiComponents = require("@macrostrat/ui-components");
|
|
9
|
+
const d3Array = require("d3-array");
|
|
10
|
+
const index = require("../expansion-panel/index.cjs");
|
|
11
|
+
const _interopDefault = (e) => e && e.__esModule ? e : { default: e };
|
|
12
|
+
const h__default = /* @__PURE__ */ _interopDefault(h$1);
|
|
13
|
+
const h = h__default.default.styled(main_module.default);
|
|
14
|
+
function FeatureProperties({ data, ...rest }) {
|
|
15
|
+
const [showControls, setShowControls] = React.useState(false);
|
|
16
|
+
const onMouseEnter = React.useCallback(() => setShowControls(true), []);
|
|
17
|
+
const onMouseLeave = React.useCallback(() => setShowControls(false), []);
|
|
18
|
+
return h("div.feature-properties", { onMouseEnter, onMouseLeave }, [
|
|
19
|
+
h.if(showControls)("div.controls", h(CopyJSONButton, { data })),
|
|
20
|
+
h(uiComponents.JSONView, {
|
|
21
|
+
data,
|
|
22
|
+
hideRoot: true,
|
|
23
|
+
...rest
|
|
24
|
+
})
|
|
25
|
+
]);
|
|
26
|
+
}
|
|
27
|
+
function FeatureRecord({ feature }) {
|
|
28
|
+
const props = feature.properties;
|
|
29
|
+
return h("div.feature-record", [
|
|
30
|
+
h.if(Object.keys(props).length > 0)(FeatureProperties, { data: props })
|
|
31
|
+
]);
|
|
32
|
+
}
|
|
33
|
+
function CopyJSONButton({ data }) {
|
|
34
|
+
const [copied, setCopied] = React.useState(false);
|
|
35
|
+
return h(core.Button, {
|
|
36
|
+
icon: copied ? "tick" : "clipboard",
|
|
37
|
+
intent: copied ? core.Intent.SUCCESS : core.Intent.NONE,
|
|
38
|
+
minimal: true,
|
|
39
|
+
small: true,
|
|
40
|
+
onClick() {
|
|
41
|
+
navigator.clipboard.writeText(JSON.stringify(data, null, 2));
|
|
42
|
+
setCopied(true);
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
function FeatureSelectionHandler({
|
|
47
|
+
selectedLocation,
|
|
48
|
+
setFeatures,
|
|
49
|
+
radius = 2
|
|
50
|
+
}) {
|
|
51
|
+
const mapRef = mapboxReact.useMapRef();
|
|
52
|
+
const isLoading = mapboxReact.useMapStatus((s) => s.isLoading);
|
|
53
|
+
const isInitialized = mapboxReact.useMapStatus((s) => s.isInitialized);
|
|
54
|
+
const prevLocation = React.useRef(null);
|
|
55
|
+
const prevFeatures = React.useRef([]);
|
|
56
|
+
React.useEffect(() => {
|
|
57
|
+
const map = mapRef?.current;
|
|
58
|
+
if (map == null) return;
|
|
59
|
+
if (selectedLocation == null) {
|
|
60
|
+
setFeatures(null);
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
if (!isInitialized) return;
|
|
64
|
+
const hasPreviouslyLoadedFeatures = prevFeatures.current.length > 0;
|
|
65
|
+
const locationMemo = JSON.stringify(selectedLocation);
|
|
66
|
+
if (locationMemo == prevLocation.current && hasPreviouslyLoadedFeatures)
|
|
67
|
+
return;
|
|
68
|
+
prevLocation.current = locationMemo;
|
|
69
|
+
const r = radius;
|
|
70
|
+
const pt = map.project(selectedLocation);
|
|
71
|
+
const bbox = [
|
|
72
|
+
[pt.x - r, pt.y - r],
|
|
73
|
+
[pt.x + r, pt.y + r]
|
|
74
|
+
];
|
|
75
|
+
const features = map.queryRenderedFeatures(bbox);
|
|
76
|
+
prevFeatures.current = features ?? [];
|
|
77
|
+
setFeatures(features);
|
|
78
|
+
}, [isInitialized, selectedLocation, isLoading]);
|
|
79
|
+
return null;
|
|
80
|
+
}
|
|
81
|
+
function FeatureHeader({ feature }) {
|
|
82
|
+
return h("div.feature-header", [
|
|
83
|
+
h("h3", [
|
|
84
|
+
h(KeyValue, { label: "Source", value: feature.source }),
|
|
85
|
+
h(KeyValue, { label: "Source layer", value: feature.sourceLayer })
|
|
86
|
+
])
|
|
87
|
+
]);
|
|
88
|
+
}
|
|
89
|
+
function KeyValue({ label, value }) {
|
|
90
|
+
return h("span.key-value", [h("span.key", label), h("code.value", value)]);
|
|
91
|
+
}
|
|
92
|
+
function LoadingAwareFeatureSet({ features, sourceID }) {
|
|
93
|
+
const map = mapboxReact.useMapRef();
|
|
94
|
+
if (map?.current == null) return null;
|
|
95
|
+
const [isLoaded, setIsLoaded] = React.useState(false);
|
|
96
|
+
const sourceFeatures = features.filter((d) => d.source == "burwell");
|
|
97
|
+
React.useEffect(() => {
|
|
98
|
+
if (sourceFeatures.length > 0) {
|
|
99
|
+
setIsLoaded(true);
|
|
100
|
+
return;
|
|
101
|
+
}
|
|
102
|
+
const isLoaded2 = map.current.isSourceLoaded(sourceID);
|
|
103
|
+
setIsLoaded(isLoaded2);
|
|
104
|
+
if (!isLoaded2) {
|
|
105
|
+
map.current.once("sourcedata", (e) => {
|
|
106
|
+
if (e.sourceId == sourceID) {
|
|
107
|
+
setIsLoaded(true);
|
|
108
|
+
}
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
}, [map.current, sourceID, sourceFeatures.length]);
|
|
112
|
+
if (!isLoaded) return h(core.Spinner);
|
|
113
|
+
return h(Features, { features: sourceFeatures });
|
|
114
|
+
}
|
|
115
|
+
function TileInfo({ feature, showExtent, setShowExtent }) {
|
|
116
|
+
if (feature == null) return null;
|
|
117
|
+
const size = feature._vectorTileFeature._pbf.length;
|
|
118
|
+
return h("div.tile-info", [
|
|
119
|
+
h("h3", "Tile"),
|
|
120
|
+
h("div.tile-index", [
|
|
121
|
+
h(KeyValue, { label: "x", value: feature._x }),
|
|
122
|
+
h(KeyValue, { label: "y", value: feature._y }),
|
|
123
|
+
h(KeyValue, { label: "z", value: feature._z })
|
|
124
|
+
]),
|
|
125
|
+
h("div.spacer"),
|
|
126
|
+
h(KeyValue, { label: "Size", value: formatSize(size) }),
|
|
127
|
+
h(core.Switch, {
|
|
128
|
+
label: "Show extent",
|
|
129
|
+
alignIndicator: "right",
|
|
130
|
+
checked: showExtent,
|
|
131
|
+
onChange() {
|
|
132
|
+
setShowExtent(!showExtent);
|
|
133
|
+
}
|
|
134
|
+
})
|
|
135
|
+
]);
|
|
136
|
+
}
|
|
137
|
+
function formatSize(size) {
|
|
138
|
+
if (size > 1e6)
|
|
139
|
+
return h(UnitNumber, { value: size / 1e6, unit: "Mb" });
|
|
140
|
+
if (size > 1e3) return h(UnitNumber, { value: size / 1e3, unit: "Kb" });
|
|
141
|
+
return `${size} bytes`;
|
|
142
|
+
}
|
|
143
|
+
function UnitNumber({ value, unit, precision = 1 }) {
|
|
144
|
+
return h("span.unit-number", [
|
|
145
|
+
h("span.number", value.toFixed(precision)),
|
|
146
|
+
h("span.unit", unit)
|
|
147
|
+
]);
|
|
148
|
+
}
|
|
149
|
+
function FeaturePanel({
|
|
150
|
+
features,
|
|
151
|
+
focusedSource = null,
|
|
152
|
+
focusedSourceTitle = null
|
|
153
|
+
}) {
|
|
154
|
+
if (features == null) return null;
|
|
155
|
+
let focusedSourcePanel = null;
|
|
156
|
+
let filteredFeatures = features;
|
|
157
|
+
let title = "Features";
|
|
158
|
+
if (focusedSource != null) {
|
|
159
|
+
title = "Basemap features";
|
|
160
|
+
focusedSourcePanel = h(
|
|
161
|
+
index.ExpansionPanel,
|
|
162
|
+
{
|
|
163
|
+
title: focusedSourceTitle ?? "Macrostrat features",
|
|
164
|
+
className: "macrostrat-features",
|
|
165
|
+
expanded: true
|
|
166
|
+
},
|
|
167
|
+
[
|
|
168
|
+
h(LoadingAwareFeatureSet, {
|
|
169
|
+
features,
|
|
170
|
+
sourceID: focusedSource
|
|
171
|
+
})
|
|
172
|
+
]
|
|
173
|
+
);
|
|
174
|
+
filteredFeatures = features.filter((d) => d.source != focusedSource);
|
|
175
|
+
}
|
|
176
|
+
return h("div.feature-panel", [
|
|
177
|
+
focusedSourcePanel,
|
|
178
|
+
h(
|
|
179
|
+
index.ExpansionPanel,
|
|
180
|
+
{ title, className: "basemap-features", expanded: focusedSource == null },
|
|
181
|
+
[
|
|
182
|
+
h(FeatureGroups, {
|
|
183
|
+
features: filteredFeatures
|
|
184
|
+
})
|
|
185
|
+
]
|
|
186
|
+
)
|
|
187
|
+
]);
|
|
188
|
+
}
|
|
189
|
+
function FeatureGroups({ features }) {
|
|
190
|
+
if (features == null) return null;
|
|
191
|
+
const groups = d3Array.group(features, (d) => `${d.source} - ${d.sourceLayer}`);
|
|
192
|
+
return h(
|
|
193
|
+
"div.feature-groups",
|
|
194
|
+
Array.from(groups).map(([key, features2]) => {
|
|
195
|
+
return h("div.feature-group", [
|
|
196
|
+
h(FeatureHeader, { feature: features2[0] }),
|
|
197
|
+
h(Features, { features: features2 })
|
|
198
|
+
]);
|
|
199
|
+
})
|
|
200
|
+
);
|
|
201
|
+
}
|
|
202
|
+
function Features({ features }) {
|
|
203
|
+
return h(
|
|
204
|
+
"div.features",
|
|
205
|
+
features.map((feature, i) => h(FeatureRecord, { key: i, feature }))
|
|
206
|
+
);
|
|
207
|
+
}
|
|
208
|
+
exports.FeaturePanel = FeaturePanel;
|
|
209
|
+
exports.FeatureProperties = FeatureProperties;
|
|
210
|
+
exports.FeatureRecord = FeatureRecord;
|
|
211
|
+
exports.FeatureSelectionHandler = FeatureSelectionHandler;
|
|
212
|
+
exports.Features = Features;
|
|
213
|
+
exports.TileInfo = TileInfo;
|
|
214
|
+
//# sourceMappingURL=vector-tile-features.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vector-tile-features.cjs","sources":["../../src/dev/vector-tile-features.ts"],"sourcesContent":["import { Spinner, Switch, Button, Intent } from \"@blueprintjs/core\";\nimport { useMapRef, useMapStatus } from \"@macrostrat/mapbox-react\";\nimport mapboxgl from \"mapbox-gl\";\nimport hyper from \"@macrostrat/hyper\";\nimport styles from \"./main.module.sass\";\nimport { useCallback, useEffect, useRef, useState } from \"react\";\nimport { JSONView } from \"@macrostrat/ui-components\";\nimport { group } from \"d3-array\";\nimport { ExpansionPanel } from \"../expansion-panel\";\n\nconst h = hyper.styled(styles);\n\nexport function FeatureProperties({ data, ...rest }) {\n // Instead of managing hover state with CSS, we use a state variable,\n // so that the button re-renders when the state changes\n const [showControls, setShowControls] = useState(false);\n const onMouseEnter = useCallback(() => setShowControls(true), []);\n const onMouseLeave = useCallback(() => setShowControls(false), []);\n\n return h(\"div.feature-properties\", { onMouseEnter, onMouseLeave }, [\n h.if(showControls)(\"div.controls\", h(CopyJSONButton, { data })),\n h(JSONView, {\n data,\n hideRoot: true,\n ...rest,\n }),\n ]);\n}\n\nexport function FeatureRecord({ feature }) {\n const props = feature.properties;\n return h(\"div.feature-record\", [\n h.if(Object.keys(props).length > 0)(FeatureProperties, { data: props }),\n ]);\n}\n\nfunction CopyJSONButton({ data }) {\n const [copied, setCopied] = useState(false);\n return h(Button, {\n icon: copied ? \"tick\" : \"clipboard\",\n intent: copied ? Intent.SUCCESS : Intent.NONE,\n minimal: true,\n small: true,\n onClick() {\n navigator.clipboard.writeText(JSON.stringify(data, null, 2));\n setCopied(true);\n },\n });\n}\n\n/** This component wraps queryRenderedFeatures to get features at a given location */\nexport function FeatureSelectionHandler({\n selectedLocation,\n setFeatures,\n radius = 2,\n}: {\n selectedLocation: mapboxgl.LngLat;\n setFeatures: (features: mapboxgl.MapboxGeoJSONFeature[]) => void;\n radius?: number;\n}) {\n const mapRef = useMapRef();\n const isLoading = useMapStatus((s) => s.isLoading);\n const isInitialized = useMapStatus((s) => s.isInitialized);\n const prevLocation = useRef(null);\n const prevFeatures = useRef([]);\n\n useEffect(() => {\n const map = mapRef?.current;\n if (map == null) return;\n if (selectedLocation == null) {\n setFeatures(null);\n return;\n }\n\n if (!isInitialized) return;\n\n const hasPreviouslyLoadedFeatures = prevFeatures.current.length > 0;\n\n const locationMemo = JSON.stringify(selectedLocation);\n if (locationMemo == prevLocation.current && hasPreviouslyLoadedFeatures)\n return;\n\n prevLocation.current = locationMemo;\n\n // Don't update if the location hasn't changed\n //if (selectedLocation == prevLocation) return;\n\n const r = radius;\n const pt = map.project(selectedLocation);\n\n const bbox: [mapboxgl.PointLike, mapboxgl.PointLike] = [\n [pt.x - r, pt.y - r],\n [pt.x + r, pt.y + r],\n ];\n const features = map.queryRenderedFeatures(bbox);\n prevFeatures.current = features ?? [];\n setFeatures(features);\n }, [isInitialized, selectedLocation, isLoading]);\n\n return null;\n}\n\nfunction FeatureHeader({ feature }) {\n return h(\"div.feature-header\", [\n h(\"h3\", [\n h(KeyValue, { label: \"Source\", value: feature.source }),\n h(KeyValue, { label: \"Source layer\", value: feature.sourceLayer }),\n ]),\n ]);\n}\n\nfunction KeyValue({ label, value }) {\n return h(\"span.key-value\", [h(\"span.key\", label), h(\"code.value\", value)]);\n}\n\nfunction LoadingAwareFeatureSet({ features, sourceID }) {\n const map = useMapRef();\n if (map?.current == null) return null;\n const [isLoaded, setIsLoaded] = useState(false);\n\n const sourceFeatures = features.filter((d) => d.source == \"burwell\");\n\n useEffect(() => {\n if (sourceFeatures.length > 0) {\n setIsLoaded(true);\n return;\n }\n\n const isLoaded = map.current.isSourceLoaded(sourceID);\n setIsLoaded(isLoaded);\n if (!isLoaded) {\n map.current.once(\"sourcedata\", (e) => {\n if (e.sourceId == sourceID) {\n setIsLoaded(true);\n }\n });\n }\n }, [map.current, sourceID, sourceFeatures.length]);\n\n if (!isLoaded) return h(Spinner);\n return h(Features, { features: sourceFeatures });\n}\n\nexport function TileInfo({ feature, showExtent, setShowExtent }) {\n if (feature == null) return null;\n const size = feature._vectorTileFeature._pbf.length;\n return h(\"div.tile-info\", [\n h(\"h3\", \"Tile\"),\n h(\"div.tile-index\", [\n h(KeyValue, { label: \"x\", value: feature._x }),\n h(KeyValue, { label: \"y\", value: feature._y }),\n h(KeyValue, { label: \"z\", value: feature._z }),\n ]),\n h(\"div.spacer\"),\n h(KeyValue, { label: \"Size\", value: formatSize(size) }),\n h(Switch, {\n label: \"Show extent\",\n alignIndicator: \"right\",\n checked: showExtent,\n onChange() {\n setShowExtent(!showExtent);\n },\n }),\n ]);\n}\n\nfunction formatSize(size: number) {\n if (size > 1000000)\n return h(UnitNumber, { value: size / 1000000, unit: \"Mb\" });\n if (size > 1000) return h(UnitNumber, { value: size / 1000, unit: \"Kb\" });\n return `${size} bytes`;\n}\n\nfunction UnitNumber({ value, unit, precision = 1 }) {\n return h(\"span.unit-number\", [\n h(\"span.number\", value.toFixed(precision)),\n h(\"span.unit\", unit),\n ]);\n}\n\nexport function FeaturePanel({\n features,\n focusedSource = null,\n focusedSourceTitle = null,\n}) {\n if (features == null) return null;\n\n let focusedSourcePanel = null;\n let filteredFeatures = features;\n let title = \"Features\";\n\n if (focusedSource != null) {\n title = \"Basemap features\";\n focusedSourcePanel = h(\n ExpansionPanel,\n {\n title: focusedSourceTitle ?? \"Macrostrat features\",\n className: \"macrostrat-features\",\n expanded: true,\n },\n [\n h(LoadingAwareFeatureSet, {\n features,\n sourceID: focusedSource,\n }),\n ],\n );\n filteredFeatures = features.filter((d) => d.source != focusedSource);\n }\n\n return h(\"div.feature-panel\", [\n focusedSourcePanel,\n h(\n ExpansionPanel,\n { title, className: \"basemap-features\", expanded: focusedSource == null },\n [\n h(FeatureGroups, {\n features: filteredFeatures,\n }),\n ],\n ),\n ]);\n}\n\nfunction FeatureGroups({ features }) {\n /** Group features by source and sourceLayer */\n if (features == null) return null;\n\n const groups = group(features, (d: any) => `${d.source} - ${d.sourceLayer}`);\n\n return h(\n \"div.feature-groups\",\n Array.from(groups).map(([key, features]) => {\n return h(\"div.feature-group\", [\n h(FeatureHeader, { feature: features[0] }),\n h(Features, { features }),\n ]);\n }),\n );\n}\n\nexport function Features({ features }) {\n return h(\n \"div.features\",\n features.map((feature, i) => h(FeatureRecord, { key: i, feature })),\n );\n}\n"],"names":["hyper","styles","useState","useCallback","JSONView","Button","Intent","useMapRef","useMapStatus","useRef","useEffect","isLoaded","Spinner","Switch","ExpansionPanel","group","features"],"mappings":";;;;;;;;;;;;AAUA,MAAM,IAAIA,WAAAA,QAAM,OAAOC,mBAAM;AAEtB,SAAS,kBAAkB,EAAE,MAAM,GAAG,QAAQ;AAGnD,QAAM,CAAC,cAAc,eAAe,IAAIC,MAAAA,SAAS,KAAK;AACtD,QAAM,eAAeC,MAAAA,YAAY,MAAM,gBAAgB,IAAI,GAAG,CAAA,CAAE;AAChE,QAAM,eAAeA,MAAAA,Y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AAE,IAAI,CAAC,CAAC,KAAKC,SAAQ,MAAM;AAC1C,aAAO,EAAE,qBAAqB;AAAA,QAC5B,EAAE,eAAe,EAAE,SAASA,UAAS,CAAC,GAAG;AAAA,QACzC,EAAE,UAAU,EAAE,UAAAA,WAAU;AAAA,MAAA,CACzB;AAAA,IACH,CAAC;AAAA,EAAA;AAEL;AAEO,SAAS,SAAS,EAAE,YAAY;AACrC,SAAO;AAAA,IACL;AAAA,IACA,SAAS,IAAI,CAAC,SAAS,MAAM,EAAE,eAAe,EAAE,KAAK,GAAG,SAAS,CAAC;AAAA,EAAA;AAEtE;;;;;;;"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
export declare function FeatureProperties({ data, ...rest }: {
|
|
2
|
+
[x: string]: any;
|
|
3
|
+
data: any;
|
|
4
|
+
}): import('react').DOMElement<{
|
|
5
|
+
onMouseEnter: () => void;
|
|
6
|
+
onMouseLeave: () => void;
|
|
7
|
+
}, Element>;
|
|
8
|
+
export declare function FeatureRecord({ feature }: {
|
|
9
|
+
feature: any;
|
|
10
|
+
}): import('react').DOMElement<import('react').DOMAttributes<Element>, Element>;
|
|
11
|
+
/** This component wraps queryRenderedFeatures to get features at a given location */
|
|
12
|
+
export declare function FeatureSelectionHandler({ selectedLocation, setFeatures, radius, }: {
|
|
13
|
+
selectedLocation: mapboxgl.LngLat;
|
|
14
|
+
setFeatures: (features: mapboxgl.MapboxGeoJSONFeature[]) => void;
|
|
15
|
+
radius?: number;
|
|
16
|
+
}): any;
|
|
17
|
+
export declare function TileInfo({ feature, showExtent, setShowExtent }: {
|
|
18
|
+
feature: any;
|
|
19
|
+
showExtent: any;
|
|
20
|
+
setShowExtent: any;
|
|
21
|
+
}): import('react').DOMElement<import('react').DOMAttributes<Element>, Element>;
|
|
22
|
+
export declare function FeaturePanel({ features, focusedSource, focusedSourceTitle, }: {
|
|
23
|
+
features: any;
|
|
24
|
+
focusedSource?: any;
|
|
25
|
+
focusedSourceTitle?: any;
|
|
26
|
+
}): import('react').DOMElement<import('react').DOMAttributes<Element>, Element>;
|
|
27
|
+
export declare function Features({ features }: {
|
|
28
|
+
features: any;
|
|
29
|
+
}): import('react').DOMElement<any, Element>;
|
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
import { Switch, Spinner, Button, Intent } from "@blueprintjs/core";
|
|
2
|
+
import { useMapRef, useMapStatus } from "@macrostrat/mapbox-react";
|
|
3
|
+
import h$1 from "@macrostrat/hyper";
|
|
4
|
+
import styles from "./main.module.sass.js";
|
|
5
|
+
import { useState, useCallback, useRef, useEffect } from "react";
|
|
6
|
+
import { JSONView } from "@macrostrat/ui-components";
|
|
7
|
+
import { group } from "d3-array";
|
|
8
|
+
import { ExpansionPanel } from "../expansion-panel/index.js";
|
|
9
|
+
const h = h$1.styled(styles);
|
|
10
|
+
function FeatureProperties({ data, ...rest }) {
|
|
11
|
+
const [showControls, setShowControls] = useState(false);
|
|
12
|
+
const onMouseEnter = useCallback(() => setShowControls(true), []);
|
|
13
|
+
const onMouseLeave = useCallback(() => setShowControls(false), []);
|
|
14
|
+
return h("div.feature-properties", { onMouseEnter, onMouseLeave }, [
|
|
15
|
+
h.if(showControls)("div.controls", h(CopyJSONButton, { data })),
|
|
16
|
+
h(JSONView, {
|
|
17
|
+
data,
|
|
18
|
+
hideRoot: true,
|
|
19
|
+
...rest
|
|
20
|
+
})
|
|
21
|
+
]);
|
|
22
|
+
}
|
|
23
|
+
function FeatureRecord({ feature }) {
|
|
24
|
+
const props = feature.properties;
|
|
25
|
+
return h("div.feature-record", [
|
|
26
|
+
h.if(Object.keys(props).length > 0)(FeatureProperties, { data: props })
|
|
27
|
+
]);
|
|
28
|
+
}
|
|
29
|
+
function CopyJSONButton({ data }) {
|
|
30
|
+
const [copied, setCopied] = useState(false);
|
|
31
|
+
return h(Button, {
|
|
32
|
+
icon: copied ? "tick" : "clipboard",
|
|
33
|
+
intent: copied ? Intent.SUCCESS : Intent.NONE,
|
|
34
|
+
minimal: true,
|
|
35
|
+
small: true,
|
|
36
|
+
onClick() {
|
|
37
|
+
navigator.clipboard.writeText(JSON.stringify(data, null, 2));
|
|
38
|
+
setCopied(true);
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
function FeatureSelectionHandler({
|
|
43
|
+
selectedLocation,
|
|
44
|
+
setFeatures,
|
|
45
|
+
radius = 2
|
|
46
|
+
}) {
|
|
47
|
+
const mapRef = useMapRef();
|
|
48
|
+
const isLoading = useMapStatus((s) => s.isLoading);
|
|
49
|
+
const isInitialized = useMapStatus((s) => s.isInitialized);
|
|
50
|
+
const prevLocation = useRef(null);
|
|
51
|
+
const prevFeatures = useRef([]);
|
|
52
|
+
useEffect(() => {
|
|
53
|
+
const map = mapRef?.current;
|
|
54
|
+
if (map == null) return;
|
|
55
|
+
if (selectedLocation == null) {
|
|
56
|
+
setFeatures(null);
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
if (!isInitialized) return;
|
|
60
|
+
const hasPreviouslyLoadedFeatures = prevFeatures.current.length > 0;
|
|
61
|
+
const locationMemo = JSON.stringify(selectedLocation);
|
|
62
|
+
if (locationMemo == prevLocation.current && hasPreviouslyLoadedFeatures)
|
|
63
|
+
return;
|
|
64
|
+
prevLocation.current = locationMemo;
|
|
65
|
+
const r = radius;
|
|
66
|
+
const pt = map.project(selectedLocation);
|
|
67
|
+
const bbox = [
|
|
68
|
+
[pt.x - r, pt.y - r],
|
|
69
|
+
[pt.x + r, pt.y + r]
|
|
70
|
+
];
|
|
71
|
+
const features = map.queryRenderedFeatures(bbox);
|
|
72
|
+
prevFeatures.current = features ?? [];
|
|
73
|
+
setFeatures(features);
|
|
74
|
+
}, [isInitialized, selectedLocation, isLoading]);
|
|
75
|
+
return null;
|
|
76
|
+
}
|
|
77
|
+
function FeatureHeader({ feature }) {
|
|
78
|
+
return h("div.feature-header", [
|
|
79
|
+
h("h3", [
|
|
80
|
+
h(KeyValue, { label: "Source", value: feature.source }),
|
|
81
|
+
h(KeyValue, { label: "Source layer", value: feature.sourceLayer })
|
|
82
|
+
])
|
|
83
|
+
]);
|
|
84
|
+
}
|
|
85
|
+
function KeyValue({ label, value }) {
|
|
86
|
+
return h("span.key-value", [h("span.key", label), h("code.value", value)]);
|
|
87
|
+
}
|
|
88
|
+
function LoadingAwareFeatureSet({ features, sourceID }) {
|
|
89
|
+
const map = useMapRef();
|
|
90
|
+
if (map?.current == null) return null;
|
|
91
|
+
const [isLoaded, setIsLoaded] = useState(false);
|
|
92
|
+
const sourceFeatures = features.filter((d) => d.source == "burwell");
|
|
93
|
+
useEffect(() => {
|
|
94
|
+
if (sourceFeatures.length > 0) {
|
|
95
|
+
setIsLoaded(true);
|
|
96
|
+
return;
|
|
97
|
+
}
|
|
98
|
+
const isLoaded2 = map.current.isSourceLoaded(sourceID);
|
|
99
|
+
setIsLoaded(isLoaded2);
|
|
100
|
+
if (!isLoaded2) {
|
|
101
|
+
map.current.once("sourcedata", (e) => {
|
|
102
|
+
if (e.sourceId == sourceID) {
|
|
103
|
+
setIsLoaded(true);
|
|
104
|
+
}
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
}, [map.current, sourceID, sourceFeatures.length]);
|
|
108
|
+
if (!isLoaded) return h(Spinner);
|
|
109
|
+
return h(Features, { features: sourceFeatures });
|
|
110
|
+
}
|
|
111
|
+
function TileInfo({ feature, showExtent, setShowExtent }) {
|
|
112
|
+
if (feature == null) return null;
|
|
113
|
+
const size = feature._vectorTileFeature._pbf.length;
|
|
114
|
+
return h("div.tile-info", [
|
|
115
|
+
h("h3", "Tile"),
|
|
116
|
+
h("div.tile-index", [
|
|
117
|
+
h(KeyValue, { label: "x", value: feature._x }),
|
|
118
|
+
h(KeyValue, { label: "y", value: feature._y }),
|
|
119
|
+
h(KeyValue, { label: "z", value: feature._z })
|
|
120
|
+
]),
|
|
121
|
+
h("div.spacer"),
|
|
122
|
+
h(KeyValue, { label: "Size", value: formatSize(size) }),
|
|
123
|
+
h(Switch, {
|
|
124
|
+
label: "Show extent",
|
|
125
|
+
alignIndicator: "right",
|
|
126
|
+
checked: showExtent,
|
|
127
|
+
onChange() {
|
|
128
|
+
setShowExtent(!showExtent);
|
|
129
|
+
}
|
|
130
|
+
})
|
|
131
|
+
]);
|
|
132
|
+
}
|
|
133
|
+
function formatSize(size) {
|
|
134
|
+
if (size > 1e6)
|
|
135
|
+
return h(UnitNumber, { value: size / 1e6, unit: "Mb" });
|
|
136
|
+
if (size > 1e3) return h(UnitNumber, { value: size / 1e3, unit: "Kb" });
|
|
137
|
+
return `${size} bytes`;
|
|
138
|
+
}
|
|
139
|
+
function UnitNumber({ value, unit, precision = 1 }) {
|
|
140
|
+
return h("span.unit-number", [
|
|
141
|
+
h("span.number", value.toFixed(precision)),
|
|
142
|
+
h("span.unit", unit)
|
|
143
|
+
]);
|
|
144
|
+
}
|
|
145
|
+
function FeaturePanel({
|
|
146
|
+
features,
|
|
147
|
+
focusedSource = null,
|
|
148
|
+
focusedSourceTitle = null
|
|
149
|
+
}) {
|
|
150
|
+
if (features == null) return null;
|
|
151
|
+
let focusedSourcePanel = null;
|
|
152
|
+
let filteredFeatures = features;
|
|
153
|
+
let title = "Features";
|
|
154
|
+
if (focusedSource != null) {
|
|
155
|
+
title = "Basemap features";
|
|
156
|
+
focusedSourcePanel = h(
|
|
157
|
+
ExpansionPanel,
|
|
158
|
+
{
|
|
159
|
+
title: focusedSourceTitle ?? "Macrostrat features",
|
|
160
|
+
className: "macrostrat-features",
|
|
161
|
+
expanded: true
|
|
162
|
+
},
|
|
163
|
+
[
|
|
164
|
+
h(LoadingAwareFeatureSet, {
|
|
165
|
+
features,
|
|
166
|
+
sourceID: focusedSource
|
|
167
|
+
})
|
|
168
|
+
]
|
|
169
|
+
);
|
|
170
|
+
filteredFeatures = features.filter((d) => d.source != focusedSource);
|
|
171
|
+
}
|
|
172
|
+
return h("div.feature-panel", [
|
|
173
|
+
focusedSourcePanel,
|
|
174
|
+
h(
|
|
175
|
+
ExpansionPanel,
|
|
176
|
+
{ title, className: "basemap-features", expanded: focusedSource == null },
|
|
177
|
+
[
|
|
178
|
+
h(FeatureGroups, {
|
|
179
|
+
features: filteredFeatures
|
|
180
|
+
})
|
|
181
|
+
]
|
|
182
|
+
)
|
|
183
|
+
]);
|
|
184
|
+
}
|
|
185
|
+
function FeatureGroups({ features }) {
|
|
186
|
+
if (features == null) return null;
|
|
187
|
+
const groups = group(features, (d) => `${d.source} - ${d.sourceLayer}`);
|
|
188
|
+
return h(
|
|
189
|
+
"div.feature-groups",
|
|
190
|
+
Array.from(groups).map(([key, features2]) => {
|
|
191
|
+
return h("div.feature-group", [
|
|
192
|
+
h(FeatureHeader, { feature: features2[0] }),
|
|
193
|
+
h(Features, { features: features2 })
|
|
194
|
+
]);
|
|
195
|
+
})
|
|
196
|
+
);
|
|
197
|
+
}
|
|
198
|
+
function Features({ features }) {
|
|
199
|
+
return h(
|
|
200
|
+
"div.features",
|
|
201
|
+
features.map((feature, i) => h(FeatureRecord, { key: i, feature }))
|
|
202
|
+
);
|
|
203
|
+
}
|
|
204
|
+
export {
|
|
205
|
+
FeaturePanel,
|
|
206
|
+
FeatureProperties,
|
|
207
|
+
FeatureRecord,
|
|
208
|
+
FeatureSelectionHandler,
|
|
209
|
+
Features,
|
|
210
|
+
TileInfo
|
|
211
|
+
};
|
|
212
|
+
//# sourceMappingURL=vector-tile-features.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vector-tile-features.js","sources":["../../src/dev/vector-tile-features.ts"],"sourcesContent":["import { Spinner, Switch, Button, Intent } from \"@blueprintjs/core\";\nimport { useMapRef, useMapStatus } from \"@macrostrat/mapbox-react\";\nimport mapboxgl from \"mapbox-gl\";\nimport hyper from \"@macrostrat/hyper\";\nimport styles from \"./main.module.sass\";\nimport { useCallback, useEffect, useRef, useState } from \"react\";\nimport { JSONView } from \"@macrostrat/ui-components\";\nimport { group } from \"d3-array\";\nimport { ExpansionPanel } from \"../expansion-panel\";\n\nconst h = hyper.styled(styles);\n\nexport function FeatureProperties({ data, ...rest }) {\n // Instead of managing hover state with CSS, we use a state variable,\n // so that the button re-renders when the state changes\n const [showControls, setShowControls] = useState(false);\n const onMouseEnter = useCallback(() => setShowControls(true), []);\n const onMouseLeave = useCallback(() => setShowControls(false), []);\n\n return h(\"div.feature-properties\", { onMouseEnter, onMouseLeave }, [\n h.if(showControls)(\"div.controls\", h(CopyJSONButton, { data })),\n h(JSONView, {\n data,\n hideRoot: true,\n ...rest,\n }),\n ]);\n}\n\nexport function FeatureRecord({ feature }) {\n const props = feature.properties;\n return h(\"div.feature-record\", [\n h.if(Object.keys(props).length > 0)(FeatureProperties, { data: props }),\n ]);\n}\n\nfunction CopyJSONButton({ data }) {\n const [copied, setCopied] = useState(false);\n return h(Button, {\n icon: copied ? \"tick\" : \"clipboard\",\n intent: copied ? Intent.SUCCESS : Intent.NONE,\n minimal: true,\n small: true,\n onClick() {\n navigator.clipboard.writeText(JSON.stringify(data, null, 2));\n setCopied(true);\n },\n });\n}\n\n/** This component wraps queryRenderedFeatures to get features at a given location */\nexport function FeatureSelectionHandler({\n selectedLocation,\n setFeatures,\n radius = 2,\n}: {\n selectedLocation: mapboxgl.LngLat;\n setFeatures: (features: mapboxgl.MapboxGeoJSONFeature[]) => void;\n radius?: number;\n}) {\n const mapRef = useMapRef();\n const isLoading = useMapStatus((s) => s.isLoading);\n const isInitialized = useMapStatus((s) => s.isInitialized);\n const prevLocation = useRef(null);\n const prevFeatures = useRef([]);\n\n useEffect(() => {\n const map = mapRef?.current;\n if (map == null) return;\n if (selectedLocation == null) {\n setFeatures(null);\n return;\n }\n\n if (!isInitialized) return;\n\n const hasPreviouslyLoadedFeatures = prevFeatures.current.length > 0;\n\n const locationMemo = JSON.stringify(selectedLocation);\n if (locationMemo == prevLocation.current && hasPreviouslyLoadedFeatures)\n return;\n\n prevLocation.current = locationMemo;\n\n // Don't update if the location hasn't changed\n //if (selectedLocation == prevLocation) return;\n\n const r = radius;\n const pt = map.project(selectedLocation);\n\n const bbox: [mapboxgl.PointLike, mapboxgl.PointLike] = [\n [pt.x - r, pt.y - r],\n [pt.x + r, pt.y + r],\n ];\n const features = map.queryRenderedFeatures(bbox);\n prevFeatures.current = features ?? [];\n setFeatures(features);\n }, [isInitialized, selectedLocation, isLoading]);\n\n return null;\n}\n\nfunction FeatureHeader({ feature }) {\n return h(\"div.feature-header\", [\n h(\"h3\", [\n h(KeyValue, { label: \"Source\", value: feature.source }),\n h(KeyValue, { label: \"Source layer\", value: feature.sourceLayer }),\n ]),\n ]);\n}\n\nfunction KeyValue({ label, value }) {\n return h(\"span.key-value\", [h(\"span.key\", label), h(\"code.value\", value)]);\n}\n\nfunction LoadingAwareFeatureSet({ features, sourceID }) {\n const map = useMapRef();\n if (map?.current == null) return null;\n const [isLoaded, setIsLoaded] = useState(false);\n\n const sourceFeatures = features.filter((d) => d.source == \"burwell\");\n\n useEffect(() => {\n if (sourceFeatures.length > 0) {\n setIsLoaded(true);\n return;\n }\n\n const isLoaded = map.current.isSourceLoaded(sourceID);\n setIsLoaded(isLoaded);\n if (!isLoaded) {\n map.current.once(\"sourcedata\", (e) => {\n if (e.sourceId == sourceID) {\n setIsLoaded(true);\n }\n });\n }\n }, [map.current, sourceID, sourceFeatures.length]);\n\n if (!isLoaded) return h(Spinner);\n return h(Features, { features: sourceFeatures });\n}\n\nexport function TileInfo({ feature, showExtent, setShowExtent }) {\n if (feature == null) return null;\n const size = feature._vectorTileFeature._pbf.length;\n return h(\"div.tile-info\", [\n h(\"h3\", \"Tile\"),\n h(\"div.tile-index\", [\n h(KeyValue, { label: \"x\", value: feature._x }),\n h(KeyValue, { label: \"y\", value: feature._y }),\n h(KeyValue, { label: \"z\", value: feature._z }),\n ]),\n h(\"div.spacer\"),\n h(KeyValue, { label: \"Size\", value: formatSize(size) }),\n h(Switch, {\n label: \"Show extent\",\n alignIndicator: \"right\",\n checked: showExtent,\n onChange() {\n setShowExtent(!showExtent);\n },\n }),\n ]);\n}\n\nfunction formatSize(size: number) {\n if (size > 1000000)\n return h(UnitNumber, { value: size / 1000000, unit: \"Mb\" });\n if (size > 1000) return h(UnitNumber, { value: size / 1000, unit: \"Kb\" });\n return `${size} bytes`;\n}\n\nfunction UnitNumber({ value, unit, precision = 1 }) {\n return h(\"span.unit-number\", [\n h(\"span.number\", value.toFixed(precision)),\n h(\"span.unit\", unit),\n ]);\n}\n\nexport function FeaturePanel({\n features,\n focusedSource = null,\n focusedSourceTitle = null,\n}) {\n if (features == null) return null;\n\n let focusedSourcePanel = null;\n let filteredFeatures = features;\n let title = \"Features\";\n\n if (focusedSource != null) {\n title = \"Basemap features\";\n focusedSourcePanel = h(\n ExpansionPanel,\n {\n title: focusedSourceTitle ?? \"Macrostrat features\",\n className: \"macrostrat-features\",\n expanded: true,\n },\n [\n h(LoadingAwareFeatureSet, {\n features,\n sourceID: focusedSource,\n }),\n ],\n );\n filteredFeatures = features.filter((d) => d.source != focusedSource);\n }\n\n return h(\"div.feature-panel\", [\n focusedSourcePanel,\n h(\n ExpansionPanel,\n { title, className: \"basemap-features\", expanded: focusedSource == null },\n [\n h(FeatureGroups, {\n features: filteredFeatures,\n }),\n ],\n ),\n ]);\n}\n\nfunction FeatureGroups({ features }) {\n /** Group features by source and sourceLayer */\n if (features == null) return null;\n\n const groups = group(features, (d: any) => `${d.source} - ${d.sourceLayer}`);\n\n return h(\n \"div.feature-groups\",\n Array.from(groups).map(([key, features]) => {\n return h(\"div.feature-group\", [\n h(FeatureHeader, { feature: features[0] }),\n h(Features, { features }),\n ]);\n }),\n );\n}\n\nexport function Features({ features }) {\n return h(\n \"div.features\",\n features.map((feature, i) => h(FeatureRecord, { key: i, feature })),\n );\n}\n"],"names":["hyper","isLoaded","features"],"mappings":";;;;;;;;AAUA,MAAM,IAAIA,IAAM,OAAO,MAAM;AAEtB,SAAS,kBAAkB,EAAE,MAAM,GAAG,QAAQ;AAGnD,QAAM,CAAC,cAAc,eAAe,IAAI,SAAS,KAAK;AACt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A,QAC5B,EAAE,eAAe,EAAE,SAASA,UAAS,CAAC,GAAG;AAAA,QACzC,EAAE,UAAU,EAAE,UAAAA,WAAU;AAAA,MAAA,CACzB;AAAA,IACH,CAAC;AAAA,EAAA;AAEL;AAEO,SAAS,SAAS,EAAE,YAAY;AACrC,SAAO;AAAA,IACL;AAAA,IACA,SAAS,IAAI,CAAC,SAAS,MAAM,EAAE,eAAe,EAAE,KAAK,GAAG,SAAS,CAAC;AAAA,EAAA;AAEtE;"}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const mapboxUtils = require("@macrostrat/mapbox-utils");
|
|
4
|
+
const colorUtils = require("@macrostrat/color-utils");
|
|
5
|
+
async function buildXRayStyle(baseStyle, params = null) {
|
|
6
|
+
const {
|
|
7
|
+
inDarkMode = false,
|
|
8
|
+
color = "rgb(74, 242, 161)",
|
|
9
|
+
mapboxToken,
|
|
10
|
+
xRaySources
|
|
11
|
+
} = params;
|
|
12
|
+
const style = await mapboxUtils.getMapboxStyle(baseStyle, { access_token: mapboxToken });
|
|
13
|
+
const sources = xRaySources ?? Object.keys(style.sources);
|
|
14
|
+
let layers = [];
|
|
15
|
+
for (let layer of style.layers) {
|
|
16
|
+
if ("source" in layer && typeof layer.source === "string" && !sources.includes(layer.source)) {
|
|
17
|
+
layers.push(layer);
|
|
18
|
+
continue;
|
|
19
|
+
}
|
|
20
|
+
let newLayer = transformMapboxLayer(layer, color, inDarkMode);
|
|
21
|
+
if (newLayer != null) {
|
|
22
|
+
layers.push(newLayer);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
return {
|
|
26
|
+
...style,
|
|
27
|
+
layers
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
function transformMapboxLayer(layer, color, inDarkMode) {
|
|
31
|
+
const c = colorUtils.asChromaColor(color);
|
|
32
|
+
const xRayColor = (opacity = 1, darken = 0) => {
|
|
33
|
+
if (!inDarkMode) {
|
|
34
|
+
return colorUtils.toRGBAString(c.darken(2 - darken).alpha(opacity));
|
|
35
|
+
}
|
|
36
|
+
return colorUtils.toRGBAString(c.alpha(opacity).darken(darken));
|
|
37
|
+
};
|
|
38
|
+
if (layer.type == "background") {
|
|
39
|
+
return null;
|
|
40
|
+
}
|
|
41
|
+
let newLayer = { ...layer };
|
|
42
|
+
console.log(xRayColor(0.5));
|
|
43
|
+
if (layer.type == "fill") {
|
|
44
|
+
newLayer.paint = {
|
|
45
|
+
"fill-color": xRayColor(0.1),
|
|
46
|
+
"fill-outline-color": xRayColor(0.5)
|
|
47
|
+
};
|
|
48
|
+
} else if (layer.type == "line") {
|
|
49
|
+
newLayer.paint = {
|
|
50
|
+
"line-color": xRayColor(0.5, 0),
|
|
51
|
+
"line-width": 1.5
|
|
52
|
+
};
|
|
53
|
+
} else if (layer.type == "symbol") {
|
|
54
|
+
newLayer.paint = {
|
|
55
|
+
"text-color": xRayColor(1, -0.5),
|
|
56
|
+
"text-halo-color": "#000"
|
|
57
|
+
};
|
|
58
|
+
} else if (layer.type == "circle") {
|
|
59
|
+
newLayer.paint = {
|
|
60
|
+
"circle-color": xRayColor(0.5, 0),
|
|
61
|
+
"circle-stroke-color": xRayColor(0.5, 1),
|
|
62
|
+
"circle-radius": 2
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
return newLayer;
|
|
66
|
+
}
|
|
67
|
+
async function buildInspectorStyle(baseStyle, overlayStyle = null, params = {}) {
|
|
68
|
+
const {
|
|
69
|
+
mapboxToken,
|
|
70
|
+
xRay = false,
|
|
71
|
+
xRaySources: _xRaySources,
|
|
72
|
+
...rest
|
|
73
|
+
} = params;
|
|
74
|
+
let xRaySources = _xRaySources;
|
|
75
|
+
let style = await mapboxUtils.getMapboxStyle(baseStyle, {
|
|
76
|
+
access_token: mapboxToken
|
|
77
|
+
});
|
|
78
|
+
if (overlayStyle != null) {
|
|
79
|
+
const overlay = await mapboxUtils.getMapboxStyle(overlayStyle, {
|
|
80
|
+
access_token: mapboxToken
|
|
81
|
+
});
|
|
82
|
+
style = mapboxUtils.mergeStyles(style, overlay);
|
|
83
|
+
xRaySources ??= Object.keys(overlay.sources);
|
|
84
|
+
}
|
|
85
|
+
if (xRay) {
|
|
86
|
+
xRaySources ??= Object.keys(style.sources);
|
|
87
|
+
style = await buildXRayStyle(style, { ...rest, mapboxToken, xRaySources });
|
|
88
|
+
}
|
|
89
|
+
return style;
|
|
90
|
+
}
|
|
91
|
+
exports.buildInspectorStyle = buildInspectorStyle;
|
|
92
|
+
exports.buildXRayStyle = buildXRayStyle;
|
|
93
|
+
//# sourceMappingURL=xray.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"xray.cjs","sources":["../../src/dev/xray.ts"],"sourcesContent":["import { getMapboxStyle, mergeStyles } from \"@macrostrat/mapbox-utils\";\nimport { asChromaColor, toRGBAString } from \"@macrostrat/color-utils\";\nimport mapboxgl from \"mapbox-gl\";\n\ninterface XRayOptions {\n color?: string;\n inDarkMode?: boolean;\n mapboxToken?: string;\n xRaySources?: string[];\n}\n\nexport async function buildXRayStyle(\n baseStyle: string | object,\n params: XRayOptions = null,\n) {\n const {\n inDarkMode = false,\n color = \"rgb(74, 242, 161)\",\n mapboxToken,\n xRaySources,\n } = params;\n const style = await getMapboxStyle(baseStyle, { access_token: mapboxToken });\n const sources = xRaySources ?? Object.keys(style.sources);\n\n let layers = [];\n for (let layer of style.layers) {\n if (\n \"source\" in layer &&\n typeof layer.source === \"string\" &&\n !sources.includes(layer.source)\n ) {\n layers.push(layer);\n continue;\n }\n let newLayer = transformMapboxLayer(layer, color, inDarkMode);\n if (newLayer != null) {\n layers.push(newLayer);\n }\n }\n\n return {\n ...style,\n layers,\n };\n}\n\nfunction transformMapboxLayer(layer, color, inDarkMode) {\n const c = asChromaColor(color);\n const xRayColor = (opacity = 1, darken = 0) => {\n if (!inDarkMode) {\n return toRGBAString(c.darken(2 - darken).alpha(opacity));\n }\n return toRGBAString(c.alpha(opacity).darken(darken));\n };\n\n if (layer.type == \"background\") {\n return null;\n }\n\n let newLayer = { ...layer };\n\n console.log(xRayColor(0.5));\n\n if (layer.type == \"fill\") {\n newLayer.paint = {\n \"fill-color\": xRayColor(0.1),\n \"fill-outline-color\": xRayColor(0.5),\n };\n } else if (layer.type == \"line\") {\n newLayer.paint = {\n \"line-color\": xRayColor(0.5, 0),\n \"line-width\": 1.5,\n };\n } else if (layer.type == \"symbol\") {\n newLayer.paint = {\n \"text-color\": xRayColor(1, -0.5),\n \"text-halo-color\": \"#000\",\n };\n } else if (layer.type == \"circle\") {\n newLayer.paint = {\n \"circle-color\": xRayColor(0.5, 0),\n \"circle-stroke-color\": xRayColor(0.5, 1),\n \"circle-radius\": 2,\n };\n }\n\n return newLayer;\n}\n\ntype InspectorStyleOptions = XRayOptions & {\n xRay?: boolean;\n};\n\nexport async function buildInspectorStyle(\n baseStyle: mapboxgl.Style | string,\n overlayStyle: mapboxgl.Style | string | null = null,\n params: InspectorStyleOptions = {},\n) {\n const {\n mapboxToken,\n xRay = false,\n xRaySources: _xRaySources,\n ...rest\n } = params;\n let xRaySources = _xRaySources;\n let style = await getMapboxStyle(baseStyle, {\n access_token: mapboxToken,\n });\n\n if (overlayStyle != null) {\n const overlay = await getMapboxStyle(overlayStyle, {\n access_token: mapboxToken,\n });\n style = mergeStyles(style, overlay);\n xRaySources ??= Object.keys(overlay.sources);\n }\n\n if (xRay) {\n // If we haven't specified sources, then we'll use all of them\n xRaySources ??= Object.keys(style.sources);\n\n style = await buildXRayStyle(style, { ...rest, mapboxToken, xRaySources });\n }\n return style;\n}\n"],"names":["getMapboxStyle","asChromaColor","toRGBAString","mergeStyles"],"mappings":";;;;AAWA,eAAsB,eACpB,WACA,SAAsB,MACtB;AACA,QAAM;AAAA,IACJ,aAAa;AAAA,IACb,QAAQ;AAAA,IACR;AAAA,IACA;AAAA,EAAA,IACE;AACJ,QAAM,QAAQ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GAAG,IAAI;AAAA,MAC/B,mBAAmB;AAAA,IAAA;AAAA,EAEvB,WAAW,MAAM,QAAQ,UAAU;AACjC,aAAS,QAAQ;AAAA,MACf,gBAAgB,UAAU,KAAK,CAAC;AAAA,MAChC,uBAAuB,UAAU,KAAK,CAAC;AAAA,MACvC,iBAAiB;AAAA,IAAA;AAAA,EAErB;AAEA,SAAO;AACT;AAMA,eAAsB,oBACpB,WACA,eAA+C,MAC/C,SAAgC,CAAA,GAChC;AACA,QAAM;AAAA,IACJ;AAAA,IACA,OAAO;AAAA,IACP,aAAa;AAAA,IACb,GAAG;AAAA,EAAA,IACD;AACJ,MAAI,cAAc;AAClB,MAAI,QAAQ,MAAMF,YAAAA,eAAe,WAAW;AAAA,IAC1C,cAAc;AAAA,EAAA,CACf;AAED,MAAI,gBAAgB,MAAM;AACxB,UAAM,UAAU,MAAMA,YAAAA,eAAe,cAAc;AAAA,MACjD,cAAc;AAAA,IAAA,CACf;AACD,YAAQG,YAAAA,YAAY,OAAO,OAAO;AAClC,oBAAgB,OAAO,KAAK,QAAQ,OAAO;AAAA,EAC7C;AAEA,MAAI,MAAM;AAER,oBAAgB,OAAO,KAAK,MAAM,OAAO;AAEzC,YAAQ,MAAM,eAAe,OAAO,EAAE,GAAG,MAAM,aAAa,aAAa;AAAA,EAC3E;AACA,SAAO;AACT;;;"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
interface XRayOptions {
|
|
2
|
+
color?: string;
|
|
3
|
+
inDarkMode?: boolean;
|
|
4
|
+
mapboxToken?: string;
|
|
5
|
+
xRaySources?: string[];
|
|
6
|
+
}
|
|
7
|
+
export declare function buildXRayStyle(baseStyle: string | object, params?: XRayOptions): Promise<{
|
|
8
|
+
layers: any[];
|
|
9
|
+
version: 8;
|
|
10
|
+
fragment?: boolean;
|
|
11
|
+
name?: string;
|
|
12
|
+
metadata?: unknown;
|
|
13
|
+
center?: Array<number>;
|
|
14
|
+
zoom?: number;
|
|
15
|
+
bearing?: number;
|
|
16
|
+
pitch?: number;
|
|
17
|
+
light?: import('mapbox-gl').LightSpecification;
|
|
18
|
+
lights?: Array<import('mapbox-gl').LightsSpecification>;
|
|
19
|
+
terrain?: import('mapbox-gl').TerrainSpecification | null | undefined;
|
|
20
|
+
fog?: import('mapbox-gl').FogSpecification;
|
|
21
|
+
snow?: import('mapbox-gl').SnowSpecification;
|
|
22
|
+
rain?: import('mapbox-gl').RainSpecification;
|
|
23
|
+
camera?: import('mapbox-gl').CameraSpecification;
|
|
24
|
+
"color-theme"?: import('mapbox-gl').ColorThemeSpecification;
|
|
25
|
+
indoor?: import('mapbox-gl').IndoorSpecification;
|
|
26
|
+
imports?: Array<import('mapbox-gl').ImportSpecification>;
|
|
27
|
+
iconsets?: import('mapbox-gl').IconsetsSpecification;
|
|
28
|
+
schema?: import('mapbox-gl').SchemaSpecification;
|
|
29
|
+
sources: import('mapbox-gl').SourcesSpecification;
|
|
30
|
+
sprite?: string;
|
|
31
|
+
glyphs?: string;
|
|
32
|
+
transition?: import('mapbox-gl').TransitionSpecification;
|
|
33
|
+
projection?: import('mapbox-gl').ProjectionSpecification;
|
|
34
|
+
models?: import('mapbox-gl').ModelsSpecification;
|
|
35
|
+
featuresets?: import('mapbox-gl').FeaturesetsSpecification;
|
|
36
|
+
}>;
|
|
37
|
+
type InspectorStyleOptions = XRayOptions & {
|
|
38
|
+
xRay?: boolean;
|
|
39
|
+
};
|
|
40
|
+
export declare function buildInspectorStyle(baseStyle: mapboxgl.Style | string, overlayStyle?: mapboxgl.Style | string | null, params?: InspectorStyleOptions): Promise<import('mapbox-gl').StyleSpecification>;
|
|
41
|
+
export {};
|