@eodash/eodash 5.0.0-alpha.2.6 → 5.0.0-alpha.2.8

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 (44) hide show
  1. package/core/client/components/DashboardLayout.vue +1 -2
  2. package/core/client/components/MobileLayout.vue +1 -2
  3. package/core/client/composables/DefineWidgets.js +1 -1
  4. package/core/client/composables/index.js +12 -0
  5. package/core/client/eodash.js +15 -2
  6. package/core/client/store/Actions.js +14 -0
  7. package/core/client/types.d.ts +6 -1
  8. package/core/client/utils/index.js +12 -0
  9. package/dist/client/{DashboardLayout-BuDcv6LM.js → DashboardLayout-CKOExc7r.js} +4 -4
  10. package/dist/client/{DynamicWebComponent-BEP4rVce.js → DynamicWebComponent-m1Zbbw6n.js} +4 -4
  11. package/dist/client/EodashDatePicker-CGdJRGZJ.js +252 -0
  12. package/dist/client/{EodashItemFilter-BElmgrST.js → EodashItemFilter-BjM_LHaE.js} +2 -2
  13. package/dist/client/EodashMap-61UMC8sv.js +86917 -0
  14. package/dist/client/EodashMapBtns-DVITfAFx.js +36 -0
  15. package/dist/client/ExportState-DhpK09GR.js +558 -0
  16. package/dist/client/{Footer-CoPx6UXQ.js → Footer-CIwjaddz.js} +11 -11
  17. package/dist/client/Header-BcM-pZFi.js +350 -0
  18. package/dist/client/{IframeWrapper-2w2ye0zM.js → IframeWrapper-CAe6HPqe.js} +1 -1
  19. package/dist/client/{MobileLayout-C9OVcP12.js → MobileLayout-DcZOQX8r.js} +11 -11
  20. package/dist/client/PopUp-DCaITceG.js +300 -0
  21. package/dist/client/VImg-C-I_7puM.js +291 -0
  22. package/dist/client/{VMain-Dm43jd43.js → VMain-Cd3P0YTG.js} +2 -2
  23. package/dist/client/VOverlay-AcvFgk39.js +967 -0
  24. package/dist/client/{WidgetsContainer-BS87sLqk.js → WidgetsContainer-B0-q0EMO.js} +1 -1
  25. package/dist/client/{asWebComponent-CpQUVi2N.js → asWebComponent-zuKR9I1w.js} +5939 -5713
  26. package/dist/client/{decoder-CP4lv0Kb-BHrv68IA.js → decoder-CP4lv0Kb-DdKalImK.js} +1 -1
  27. package/dist/client/eo-dash.js +4 -4
  28. package/dist/client/{eodashSTAC-Q7kbX1Gy.js → eodashSTAC-DGB50vNk.js} +1 -1
  29. package/dist/client/{forwardRefs-BVFQ82G4.js → forwardRefs-BnxE4iKQ.js} +35 -33
  30. package/dist/client/{index-dOzyv_xR.js → index-hSIi5Ygk.js} +8 -8
  31. package/dist/client/{lerc-DzVumYtB-rm1Xco54.js → lerc-DzVumYtB-cTUap6k_.js} +1 -1
  32. package/dist/client/{ssrBoot-L9KejErM.js → ssrBoot-D3KF5Thc.js} +1 -1
  33. package/dist/client/style.css +2 -2
  34. package/dist/client/{transition-DCePIwYR.js → transition-D3a4tiJv.js} +6 -6
  35. package/dist/node/cli.js +2 -2
  36. package/package.json +2 -2
  37. package/widgets/EodashMap.vue +33 -29
  38. package/widgets/EodashMapBtns.vue +33 -0
  39. package/widgets/ExportState.vue +112 -0
  40. package/widgets/PopUp.vue +40 -0
  41. package/dist/client/EodashDatePicker-oFb1zt5E.js +0 -1211
  42. package/dist/client/EodashMap-DXyOgcEd.js +0 -50707
  43. package/dist/client/Header-C-zX31Ys.js +0 -635
  44. package/dist/client/eox-map-L7abwKTR.js +0 -36260
@@ -1,5 +1,5 @@
1
- import { p as m, aw as d, d as l, av as u, ab as b } from "./asWebComponent-CpQUVi2N.js";
2
- const j = m({
1
+ import { p as f, ay as m, d, bb as l, ab as u } from "./asWebComponent-zuKR9I1w.js";
2
+ const j = f({
3
3
  transition: {
4
4
  type: [Boolean, String, Object],
5
5
  default: "fade-transition",
@@ -15,17 +15,17 @@ const j = m({
15
15
  group: r,
16
16
  ...a
17
17
  } = o, {
18
- component: i = r ? u : b,
18
+ component: i = r ? l : u,
19
19
  ...p
20
20
  } = typeof t == "object" ? t : {};
21
- return d(i, l(typeof t == "string" ? {
21
+ return m(i, d(typeof t == "string" ? {
22
22
  name: n ? "" : t
23
23
  } : p, typeof t == "string" ? {} : Object.fromEntries(Object.entries({
24
24
  disabled: n,
25
25
  group: r
26
26
  }).filter((c) => {
27
- let [y, f] = c;
28
- return f !== void 0;
27
+ let [y, b] = c;
28
+ return b !== void 0;
29
29
  })), a), e);
30
30
  };
31
31
  export {
package/dist/node/cli.js CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import{createLogger as P,defineConfig as C,searchForWorkspaceRoot as x,createServer as k,preview as S,build as F}from"vite";import{readFileSync as U,existsSync as u}from"fs";import t from"path";import{Command as E}from"commander";import{readFile as W,writeFile as I,rm as $,cp as N}from"fs/promises";import O from"@vitejs/plugin-vue";import T,{transformAssetUrls as A}from"vite-plugin-vuetify";const s=v(process.cwd()),b=new E("eodash"),H=JSON.parse(U(t.join(s,"package.json"),"utf-8"));b.version(H.version,"-v, --version","output the current version").option("--publicDir <path>","path to statically served assets folder").option("--no-publicDir","stop serving static assets").option("--outDir <path>","minified output folder").option("-e, --entryPoint <path>","file exporting `createEodash`").option("-w, --widgets <path>","folder that contains vue components as internal widgets").option("--cacheDir <path>","cache folder").option("-r, --runtime <path>","file exporting eodash client runtime config").option("-b, --base <path>","base public path").option("-p, --port <port>","serving port").option("-o, --open","open default browser when the server starts").option("-c, --config <path>","path to eodash server and build configuration file").option("--host [IP address]","specify which IP addresses the server should listen on").option("-l, --lib","builds eodash as a web component library").option("--no-lib","builds eodash as an SPA").option("--no-host","do not expose server to the network").parse(process.argv);const i=await z(b.opts(),process.argv?.[2]),c=v(),L=i.publicDir?t.resolve(s,i.publicDir):t.join(s,"./public"),h=t.join(s,"/src"),l=i.runtime?t.resolve(s,i.runtime):t.join(h,"./runtime.js"),g=i.entryPoint?t.resolve(s,i.entryPoint):t.join(h,"/main.js"),w=i.widgets?t.resolve(s,i.widgets):t.join(h,"widgets"),j=t.join(s,"/.eodash"),f=i.outDir?t.resolve(s,i.outDir):t.join(j,"/dist"),R=i.cacheDir?t.resolve(s,i.cacheDir):t.join(j,"cache"),m=P(void 0,{prefix:"[eodash]"});async function z(e,n){let a=e.config?t.resolve(s,e.config):t.join(s,"eodash.config.js"),o={};return u(a)?o=await import(a).then(r=>r.default instanceof Function?r.default():r.default).catch(r=>{console.error(r)}):a=null,{base:e.base??o?.base,port:Number(e.port??o?.[n]?.port),host:e.host??o?.[n]?.host,open:e.open??o?.[n]?.open,cacheDir:e.cacheDir??o?.cacheDir,entryPoint:e.entryPoint??o?.entryPoint,outDir:e.outDir??o?.outDir,publicDir:e.publicDir??o?.publicDir,runtime:e.runtime??o?.runtime,widgets:e.widgets??o?.widgets,lib:e.lib??o?.lib}}function v(e=import.meta.dirname){if(e.split("/").length)return u(t.resolve(e,"package.json"))?e:v(t.resolve(e,".."));throw new Error("no package root found")}const y=`
2
+ import{createLogger as P,defineConfig as C,searchForWorkspaceRoot as x,createServer as k,preview as S,build as F}from"vite";import{readFileSync as U,existsSync as u}from"fs";import t from"path";import{Command as E}from"commander";import{readFile as W,writeFile as I,rm as $,cp as N}from"fs/promises";import O from"@vitejs/plugin-vue";import T,{transformAssetUrls as A}from"vite-plugin-vuetify";const s=b(process.cwd()),h=new E("eodash"),H=JSON.parse(U(t.join(s,"package.json"),"utf-8"));h.version(H.version,"-v, --version","output the current version"),h.option("--publicDir <path>","path to statically served assets folder").option("--no-publicDir","stop serving static assets").option("--outDir <path>","minified output folder").option("-e, --entryPoint <path>","file exporting `createEodash`").option("-w, --widgets <path>","folder that contains vue components as internal widgets").option("--cacheDir <path>","cache folder").option("-r, --runtime <path>","file exporting eodash client runtime config").option("-b, --base <path>","base public path").option("-p, --port <port>","serving port").option("-o, --open","open default browser when the server starts").option("-c, --config <path>","path to eodash server and build configuration file").option("--host [IP address]","specify which IP addresses the server should listen on").option("-l, --lib","builds eodash as a web component library").option("--no-lib","builds eodash as an SPA").option("--no-host","do not expose server to the network").parse(process.argv);const i=await z(h.opts(),process.argv?.[2]),c=b(),L=i.publicDir?t.resolve(s,i.publicDir):t.join(s,"./public"),f=t.join(s,"/src"),l=i.runtime?t.resolve(s,i.runtime):t.join(f,"./runtime.js"),g=i.entryPoint?t.resolve(s,i.entryPoint):t.join(f,"/main.js"),w=i.widgets?t.resolve(s,i.widgets):t.join(f,"widgets"),j=t.join(s,"/.eodash"),m=i.outDir?t.resolve(s,i.outDir):t.join(j,"/dist"),R=i.cacheDir?t.resolve(s,i.cacheDir):t.join(j,"cache"),v=P(void 0,{prefix:"[eodash]"});async function z(e,n){let a=e.config?t.resolve(s,e.config):t.join(s,"eodash.config.js"),o={};return u(a)?o=await import(a).then(r=>r.default instanceof Function?r.default():r.default).catch(r=>{console.error(r)}):a=null,{base:e.base??o?.base,port:Number(e.port??o?.[n]?.port),host:e.host??o?.[n]?.host,open:e.open??o?.[n]?.open,cacheDir:e.cacheDir??o?.cacheDir,entryPoint:e.entryPoint??o?.entryPoint,outDir:e.outDir??o?.outDir,publicDir:e.publicDir??o?.publicDir,runtime:e.runtime??o?.runtime,widgets:e.widgets??o?.widgets,lib:e.lib??o?.lib}}function b(e=import.meta.dirname){if(e.split("/").length>0)return u(t.resolve(e,"package.json"))?e:b(t.resolve(e,".."));throw new Error("no package root found from "+e)}const y=`
3
3
  <!DOCTYPE html>
4
4
  <html lang="en">
5
5
 
@@ -17,4 +17,4 @@ ${i.lib?`<eo-dash style="height:100dvh;"/>
17
17
  <script type="module" src="${t.resolve(`/@fs/${c}`,"core/client/render.js")}"><\/script>
18
18
  `}
19
19
  </body>
20
- </html>`,D=C(({mode:e,command:n})=>({base:i.base??"",cacheDir:R,plugins:[O({customElement:!1,template:{transformAssetUrls:A,compilerOptions:{isCustomElement:a=>!a.includes("v-")&&a.includes("-")}}}),T({autoImport:!0}),e==="development"&&{name:"inject-html",configureServer:J}],customLogger:m,define:{"process.env":{}},resolve:{alias:{"@":t.join(c,"core/client"),"^":t.join(c,"widgets"),"user:config":g,"user:widgets":w},extensions:[".js",".json",".jsx",".mjs",".ts",".tsx",".vue"]},server:{warmup:{clientFiles:[t.join(c,"core/client/**")]},port:i.port??3e3,open:i.open,fs:{allow:[x(process.cwd())]},host:i.host},root:c,optimizeDeps:e==="development"?{include:["webfontloader","vuetify","vue","pinia","stac-js","urijs"],noDiscovery:!0}:{},publicDir:i.publicDir===!1?!1:L,build:{lib:i.lib&&n==="build"&&{entry:t.join(c,"core/client/asWebComponent.js"),fileName:"eo-dash",formats:["es"],name:"@eodash/eodash"},outDir:f,emptyOutDir:!0,rollupOptions:i.lib&&n==="build"?{input:t.join(c,"core/client/asWebComponent.js")}:void 0,target:"esnext"}}));async function J(e){e.watcher.add([g,l,t.join(w,"**/*.vue")]);let n="";const a=m.info;return m.info=(o,r)=>{if(o.includes("core")){const d=o.split("/")[0].split(" ");d.pop();const p=d.join(" ")+" "+n.replace(s,"");return a(p,r)}return a(o,r)},e.watcher.on("change",async o=>{n=o,o===l&&e.hot.send({type:"full-reload",path:o})}),()=>{e.middlewares.use(async(o,r,d)=>{if(o.originalUrl==="/@fs/config.js"||o.originalUrl==="/config.js"){r.statusCode=200,r.setHeader("Content-Type","text/javascript"),u(l)&&await W(l).then(p=>{r.write(p)}),r.end();return}if(o.url?.endsWith(".html")){r.statusCode=200,r.setHeader("Content-Type","text/html");const p=await e.transformIndexHtml(o.url,y,o.originalUrl);r.end(p);return}d()})}}const M=async()=>{const e=await k(await D({mode:"development",command:"serve"}));await e.listen(),e.printUrls(),e.bindCLIShortcuts({print:!0})},Y=async()=>{const e=async()=>{const n=await D({mode:"production",command:"build"});await F(n),u(l)&&await N(l,t.join(f,"config.js"),{recursive:!0}).catch(a=>{console.error(a)})};if(i.lib)await e();else{const n=t.join(c,"/index.html");await I(n,y).then(async()=>{await e(),await $(n).catch(()=>{console.error("failed to remove index.html")})})}};async function B(){(await S({root:s,base:i.base??"",preview:{port:isNaN(i.port)?8080:i.port,open:i.open,host:i.host},build:{outDir:f}})).printUrls()}const G=process.argv?.[2];(async()=>{switch(G){case"dev":await M();break;case"build":await Y();break;case"preview":await B();break;default:console.error("command not found");break}})();
20
+ </html>`,D=C(({mode:e,command:n})=>({base:i.base??"",cacheDir:R,plugins:[O({customElement:!1,template:{transformAssetUrls:A,compilerOptions:{isCustomElement:a=>!a.includes("v-")&&a.includes("-")}}}),T({autoImport:!0}),e==="development"&&{name:"inject-html",configureServer:J}],customLogger:v,define:{"process.env":{}},resolve:{alias:{"@":t.join(c,"core/client"),"^":t.join(c,"widgets"),"user:config":g,"user:widgets":w},extensions:[".js",".json",".jsx",".mjs",".ts",".tsx",".vue"]},server:{warmup:{clientFiles:[t.join(c,"core/client/**")]},port:i.port??3e3,open:i.open,fs:{allow:[x(process.cwd())]},host:i.host},root:c,optimizeDeps:e==="development"?{include:["webfontloader","vuetify","vue","pinia","stac-js","urijs"],noDiscovery:!0}:{},publicDir:i.publicDir===!1?!1:L,build:{lib:i.lib&&n==="build"&&{entry:t.join(c,"core/client/asWebComponent.js"),fileName:"eo-dash",formats:["es"],name:"@eodash/eodash"},outDir:m,emptyOutDir:!0,rollupOptions:i.lib&&n==="build"?{input:t.join(c,"core/client/asWebComponent.js")}:void 0,target:"esnext"}}));async function J(e){e.watcher.add([g,l,t.join(w,"**/*.vue")]);let n="";const a=v.info;return v.info=(o,r)=>{if(o.includes("core")){const d=o.split("/")[0].split(" ");d.pop();const p=d.join(" ")+" "+n.replace(s,"");return a(p,r)}return a(o,r)},e.watcher.on("change",async o=>{n=o,o===l&&e.hot.send({type:"full-reload",path:o})}),()=>{e.middlewares.use(async(o,r,d)=>{if(o.originalUrl==="/@fs/config.js"||o.originalUrl==="/config.js"){r.statusCode=200,r.setHeader("Content-Type","text/javascript"),u(l)&&await W(l).then(p=>{r.write(p)}),r.end();return}if(o.url?.endsWith(".html")){r.statusCode=200,r.setHeader("Content-Type","text/html");const p=await e.transformIndexHtml(o.url,y,o.originalUrl);r.end(p);return}d()})}}const M=async()=>{const e=await k(await D({mode:"development",command:"serve"}));await e.listen(),e.printUrls(),e.bindCLIShortcuts({print:!0})},Y=async()=>{const e=async()=>{const n=await D({mode:"production",command:"build"});await F(n),u(l)&&await N(l,t.join(m,"config.js"),{recursive:!0}).catch(a=>{console.error(a)})};if(i.lib)await e();else{const n=t.join(c,"/index.html");await I(n,y).then(async()=>{await e(),await $(n).catch(()=>{console.error("failed to remove index.html")})})}};async function B(){(await S({root:s,base:i.base??"",preview:{port:isNaN(i.port)?8080:i.port,open:i.open,host:i.host},build:{outDir:m}})).printUrls()}const G=process.argv?.[2];(async()=>{switch(G){case"dev":await M();break;case"build":await Y();break;case"preview":await B();break;default:console.error("command not found");break}})();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eodash/eodash",
3
- "version": "5.0.0-alpha.2.6",
3
+ "version": "5.0.0-alpha.2.8",
4
4
  "type": "module",
5
5
  "types": "./core/client/types.d.ts",
6
6
  "files": [
@@ -74,7 +74,7 @@
74
74
  "@types/node": "latest",
75
75
  "@types/openlayers": "^4.6.23",
76
76
  "@types/webfontloader": "^1.6.38",
77
- "cypress": "^13.6.6",
77
+ "cypress": "^13.13.0",
78
78
  "eslint": "^9.4.0",
79
79
  "eslint-plugin-vue": "^9.26.0",
80
80
  "prettier": "^3.3.2",
@@ -1,28 +1,32 @@
1
1
  <template>
2
- <DynamicWebComponent
3
- :link="link"
4
- tag-name="eox-map"
5
- :properties="properties"
6
- :on-mounted="onMounted"
7
- :on-unmounted="onUnmounted"
2
+ <eox-map
3
+ class="fill-height fill-width overflow-none"
4
+ ref="eoxMap"
5
+ :config="eoxMapConfig"
8
6
  />
9
7
  </template>
10
8
  <script setup>
11
- import { inject, watch } from "vue";
9
+ import { inject, onMounted, onUnmounted, reactive, ref, watch } from "vue";
12
10
  import { toAbsolute } from "stac-js/src/http.js";
13
11
  import { EodashCollection, extractCollectionUrls } from "@/utils/eodashSTAC";
14
12
  import { eodashKey } from "@/utils/keys";
15
13
  import { datetime, mapPosition } from "@/store/States";
16
- import DynamicWebComponent from "@/components/DynamicWebComponent.vue";
17
14
  import { storeToRefs } from "pinia";
15
+ import { useSTAcStore } from "@/store/stac";
16
+ import "@eox/map";
18
17
  import "@eox/map/dist/eox-map-advanced-layers-and-sources.js";
19
18
 
20
- const eodashConfig = /** @type {import("@/types").Eodash} */ inject(eodashKey);
19
+ const eodashConfig = /** @type {import("@/types").Eodash} */ (
20
+ inject(eodashKey)
21
+ );
21
22
 
22
- /** @type {Record<string, unknown>} */
23
- const properties = {
24
- class: "fill-height fill-width overflow-none",
23
+ /** @type {import("vue").Ref<(HTMLElement & Record<string,unknown>) | null>} */
24
+ const eoxMap = ref(null);
25
+
26
+ const eoxMapConfig = reactive({
27
+ /** @type {(number|undefined)[] | undefined} */
25
28
  center: [15, 48],
29
+ /** @type {number | undefined} */
26
30
  zoom: 4,
27
31
  // TODO: we should probably introduce some way of defining
28
32
  layers: [
@@ -45,17 +49,16 @@ const properties = {
45
49
  },
46
50
  },
47
51
  ],
48
- };
52
+ });
53
+
49
54
  // Check if selected indicator was already set in store
50
55
  if (mapPosition && mapPosition.value && mapPosition.value.length === 3) {
51
56
  // TODO: do further checks for invalid values?
52
57
  // TODO: can we expect the values to be in a specific projection
53
- properties.center = [mapPosition.value?.[0], mapPosition.value[1]];
54
- properties.zoom = mapPosition.value[2];
58
+ eoxMapConfig.center = [mapPosition.value?.[0], mapPosition.value[1]];
59
+ eoxMapConfig.zoom = mapPosition.value[2];
55
60
  }
56
61
 
57
- const link = () => import("@eox/map");
58
-
59
62
  /** @type {import("openlayers").EventsListenerFunctionType} */
60
63
  const handleMoveEnd = (evt) => {
61
64
  const map = /** @type {import("openlayers").Map | undefined} */ (
@@ -73,10 +76,12 @@ const handleMoveEnd = (evt) => {
73
76
  }
74
77
  };
75
78
 
76
- /** @type {import("@/types").WebComponentProps["onMounted"]} */
77
- const onMounted = (el, store) => {
78
- /** @type {any} */
79
- (el)?.map?.on("moveend", handleMoveEnd);
79
+ const store = useSTAcStore();
80
+
81
+ onMounted(() => {
82
+ /** @type {import('ol/Map').default} */
83
+ (eoxMap.value?.map)?.on("moveend", handleMoveEnd);
84
+
80
85
  const { selectedStac } = storeToRefs(store);
81
86
 
82
87
  watch(
@@ -126,7 +131,7 @@ const onMounted = (el, store) => {
126
131
  // TODO: we can check if the collection / indicator has a specific
127
132
  // projection it wants to be displayed in the map we can register
128
133
  // and set the attribute here, e.g. like following
129
- /*
134
+ /*
130
135
  (el)?.registerProjection(
131
136
  'EPSG:3031','+proj=stere +lat_0=-90 +lat_ts=-71 +lon_0=0 +x_0=0 +y_0=0 +datum=WGS84 +units=m +no_defs +type=crs'
132
137
  );
@@ -134,16 +139,15 @@ const onMounted = (el, store) => {
134
139
  */
135
140
 
136
141
  /** @type {any} */
137
- (el).layers = layersCollection;
142
+ (eoxMap.value).layers = layersCollection;
138
143
  }
139
144
  },
140
145
  { immediate: true },
141
146
  );
142
- };
147
+ });
143
148
 
144
- /** @type {import("@/types").WebComponentProps["onUnmounted"]} */
145
- const onUnmounted = (el, _store) => {
146
- /** @type {any} */
147
- (el)?.map?.un("moveend", handleMoveEnd);
148
- };
149
+ onUnmounted(() => {
150
+ /** @type {import('ol/Map').default} */
151
+ (eoxMap.value?.map)?.un("moveend", handleMoveEnd);
152
+ });
149
153
  </script>
@@ -0,0 +1,33 @@
1
+ <template>
2
+ <div ref="rootRef" class="d-flex align-end justify-end my-3 pa-2">
3
+ <v-btn
4
+ class="map-btn"
5
+ :icon="[mdiMapPlus]"
6
+ @click="showMapState = !showMapState"
7
+ />
8
+ <ExportState :header="header" :code="code" v-model="showMapState" />
9
+ </div>
10
+ </template>
11
+ <script setup>
12
+ import { makePanelTransparent } from "@/composables";
13
+ import { mdiMapPlus } from "@mdi/js";
14
+ import ExportState from "^/ExportState.vue";
15
+ import { ref } from "vue";
16
+ const header = "Export Map";
17
+ const code = `<h2>
18
+ code example
19
+ </h2>`;
20
+
21
+ const showMapState = ref(false);
22
+
23
+ /** @type {import("vue").Ref<HTMLDivElement|null>} */
24
+ const rootRef = ref(null);
25
+ makePanelTransparent(rootRef);
26
+ </script>
27
+ <style scoped>
28
+ .map-btn {
29
+ width: 36px;
30
+ height: 36px;
31
+ border-radius: 25%;
32
+ }
33
+ </style>
@@ -0,0 +1,112 @@
1
+ <template>
2
+ <PopUp v-model="dialog">
3
+ <v-card>
4
+ <v-card-title class="bg-primary">
5
+ <h5 class="text-h5">Storytelling map configuration</h5>
6
+ </v-card-title>
7
+
8
+ <v-card-text class="py-5">
9
+ <p class="text-body-2">
10
+ Copy and paste this code into the map layers field of the storytelling
11
+ editor:
12
+ </p>
13
+ <div class="pa-3 code-block">
14
+ {{ getLayers() }}
15
+ </div>
16
+
17
+ <div style="position: absolute; bottom: 15px">
18
+ <v-expand-transition>
19
+ <div v-if="copySuccess" class="text-success mr-3">
20
+ <v-icon color="success" left :icon="[mdiClipboardCheckOutline]" />
21
+ <small>copied!</small>
22
+ </div>
23
+ </v-expand-transition>
24
+ </div>
25
+ <v-row class="d-flex pt-3 justify-end">
26
+ <v-col cols="6" class="flex-column align-center text-end">
27
+ <v-btn
28
+ v-for="btn in copyBtns"
29
+ class="text-body-2"
30
+ @click="btn.copyFn"
31
+ :key="btn.id"
32
+ small
33
+ variant="text"
34
+ :prepend-icon="[mdiContentCopy]"
35
+ >
36
+ copy as {{ btn.copyAs }}
37
+ </v-btn>
38
+ </v-col>
39
+ </v-row>
40
+ </v-card-text>
41
+
42
+ <v-divider></v-divider>
43
+
44
+ <v-card-actions>
45
+ <v-spacer></v-spacer>
46
+ <v-btn variant="text" @click="dialog = !dialog"> Close </v-btn>
47
+ </v-card-actions>
48
+ </v-card>
49
+ </PopUp>
50
+ </template>
51
+ <script setup>
52
+ import { mdiClipboardCheckOutline, mdiContentCopy } from "@mdi/js";
53
+ import PopUp from "./PopUp.vue";
54
+ import { copyToClipBoard } from "@/utils";
55
+ import { computed, ref } from "vue";
56
+ import { getLayers as getLayerAction } from "@/store/Actions";
57
+ import { mapPosition } from "@/store/States";
58
+
59
+ const dialog = defineModel({ type: Boolean, required: true, default: false });
60
+
61
+ const props = defineProps({
62
+ getLayers: {
63
+ type: Function,
64
+ default: getLayerAction,
65
+ },
66
+ });
67
+
68
+ const copySuccess = ref(false);
69
+
70
+ const copyBtns = [
71
+ {
72
+ id: Symbol(),
73
+ copyFn: async () => await copyToClipBoard(mapEntryCode.value, copySuccess),
74
+ copyAs: "simple map",
75
+ },
76
+ {
77
+ id: Symbol(),
78
+ copyFn: async () =>
79
+ await copyToClipBoard(JSON.stringify(props.getLayers()), copySuccess),
80
+ copyAs: "layers configuration",
81
+ },
82
+ {
83
+ id: Symbol(),
84
+ copyFn: async () => await copyToClipBoard(mapStepCode.value, copySuccess),
85
+ copyAs: "map tour section",
86
+ },
87
+ ];
88
+
89
+ const mapStepCode = computed(() => {
90
+ const [x, y, z] = mapPosition.value;
91
+ const preTag = "### <!--{ layers=";
92
+ const endTag = `zoom="${z}" center=[${[x, y]}] animationOptions={duration:500}}-->
93
+ #### Tour step title
94
+ Text describing the current step of the tour and why it is interesting what the map shows currently
95
+ `;
96
+ return `${preTag}'${JSON.stringify(props.getLayers())}' ${endTag}`;
97
+ });
98
+ const mapEntryCode = computed(() => {
99
+ const [x, y, z] = mapPosition.value;
100
+ const preTag =
101
+ '## Map Example <!--{as="eox-map" style="width: 100%; height: 500px;" layers=';
102
+ const endTag = `zoom="${z}" center=[${[x, y]}] }-->`;
103
+ return `${preTag}'${JSON.stringify(props.getLayers())}' ${endTag}`;
104
+ });
105
+ </script>
106
+ <style scoped>
107
+ .code-block {
108
+ background-color: #ddd;
109
+ font-family: monospace;
110
+ font-size: small;
111
+ }
112
+ </style>
@@ -0,0 +1,40 @@
1
+ <template>
2
+ <span>
3
+ <v-dialog
4
+ max-width="500px"
5
+ max-height="500px"
6
+ absolute
7
+ scrollable
8
+ scroll-strategy="block"
9
+ close-on-back
10
+ v-model="dialog"
11
+ >
12
+ <v-sheet>
13
+ <component
14
+ v-if="widget"
15
+ :is="definedWidget.component"
16
+ :key="definedWidget.id"
17
+ v-bind="definedWidget.props"
18
+ />
19
+ <span v-if="$slots.default">
20
+ <slot />
21
+ </span>
22
+ </v-sheet>
23
+ </v-dialog>
24
+ </span>
25
+ </template>
26
+ <script setup>
27
+ import { useDefineWidgets } from "@/composables/DefineWidgets";
28
+
29
+ const dialog = defineModel({ type: Boolean, required: true, default: false });
30
+
31
+ const props = defineProps({
32
+ widget: {
33
+ /** @type {import("vue").PropType<import("@/types").Widget>} */
34
+ type: Object,
35
+ default: undefined,
36
+ },
37
+ });
38
+
39
+ const [definedWidget] = useDefineWidgets([props?.widget]);
40
+ </script>