tangram-globe 0.3.0__py3-none-any.whl → 0.4.0__py3-none-any.whl

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.
tangram_globe/__init__.py CHANGED
@@ -2,15 +2,26 @@ from dataclasses import dataclass
2
2
  from typing import Annotated
3
3
 
4
4
  import tangram_core
5
- from tangram_core.config import ExposeField
5
+ from tangram_core.config import FrontendMutable
6
6
 
7
7
 
8
8
  @dataclass
9
- class GlobeConfig(tangram_core.config.HasSidebarUiConfig):
10
- topbar_order: Annotated[int, ExposeField()] = 1000
9
+ class GlobeConfig:
10
+ enabled: bool = False
11
+
12
+
13
+ @dataclass
14
+ class GlobeFrontendConfig:
15
+ enabled: Annotated[bool, FrontendMutable()]
16
+
17
+
18
+ def into_frontend(config: GlobeConfig) -> GlobeFrontendConfig:
19
+ return GlobeFrontendConfig(enabled=config.enabled)
11
20
 
12
21
 
13
22
  plugin = tangram_core.Plugin(
14
23
  frontend_path="dist-frontend",
15
24
  config_class=GlobeConfig,
25
+ frontend_config_class=GlobeFrontendConfig,
26
+ into_frontend_config_function=into_frontend,
16
27
  )
@@ -1,37 +1,17 @@
1
- import { defineComponent as s, inject as c, ref as i, createElementBlock as p, openBlock as g, createElementVNode as l, normalizeClass as _ } from "vue";
2
- const m = { class: "globe-toggle" }, u = ["title"], v = /* @__PURE__ */ s({
3
- __name: "GlobeToggle",
4
- setup(o) {
5
- const e = c("tangramApi");
6
- if (!e)
7
- throw new Error("assert: tangram api not provided");
8
- const t = i(!1), r = () => {
1
+ import { watch as a } from "vue";
2
+ function o(e) {
3
+ a(
4
+ () => e.settings.tangram_globe?.values.enabled,
5
+ (t) => {
9
6
  if (!e.map.isReady.value) return;
10
- const n = e.map.getMapInstance(), a = !t.value;
11
- n.setProjection(a ? { type: "globe" } : { type: "mercator" }), t.value = a;
12
- };
13
- return (n, a) => (g(), p("div", m, [
14
- l("button", {
15
- class: _({ active: t.value }),
16
- title: t.value ? "Switch to mercator view" : "Switch to globe view",
17
- onClick: r
18
- }, [...a[0] || (a[0] = [
19
- l("span", { class: "fa fa-globe" }, null, -1)
20
- ])], 10, u)
21
- ]));
22
- }
23
- }), b = (o, e) => {
24
- const t = o.__vccOpts || o;
25
- for (const [r, n] of e)
26
- t[r] = n;
27
- return t;
28
- }, d = /* @__PURE__ */ b(v, [["__scopeId", "data-v-871c94ae"]]);
29
- function w(o, e) {
30
- o.ui.registerWidget("globe-toggle", "TopBar", d, {
31
- priority: e?.topbar_order
7
+ e.map.getMapInstance().setProjection(t ? { type: "globe" } : { type: "mercator" });
8
+ },
9
+ { immediate: !0 }
10
+ ), a(e.map.isReady, (t) => {
11
+ t && e.settings.tangram_globe?.values.enabled && e.map.getMapInstance().setProjection({ type: "globe" });
32
12
  });
33
13
  }
34
14
  export {
35
- w as install
15
+ o as install
36
16
  };
37
17
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../src/tangram_globe/GlobeToggle.vue","../src/tangram_globe/index.ts"],"sourcesContent":["<template>\n <div class=\"globe-toggle\">\n <button\n :class=\"{ active: isGlobeView }\"\n :title=\"isGlobeView ? 'Switch to mercator view' : 'Switch to globe view'\"\n @click=\"toggleGlobe\"\n >\n <span class=\"fa fa-globe\"></span>\n </button>\n </div>\n</template>\n\n<script setup lang=\"ts\">\nimport { ref, inject } from \"vue\";\nimport type { TangramApi } from \"@open-aviation/tangram-core/api\";\n\nconst tangramApi = inject<TangramApi>(\"tangramApi\");\nif (!tangramApi) {\n throw new Error(\"assert: tangram api not provided\");\n}\n\nconst isGlobeView = ref(false);\n\nconst toggleGlobe = () => {\n if (!tangramApi.map.isReady.value) return;\n\n const mapInstance = tangramApi.map.getMapInstance();\n const newGlobeState = !isGlobeView.value;\n\n mapInstance.setProjection(newGlobeState ? { type: \"globe\" } : { type: \"mercator\" });\n\n isGlobeView.value = newGlobeState;\n};\n</script>\n\n<style scoped>\n.globe-toggle button {\n background: white;\n border: 1px solid #ddd;\n border-radius: 4px;\n padding: 8px 12px;\n cursor: pointer;\n font-size: 16px;\n transition: all 0.2s ease;\n color: #333;\n}\n\n.globe-toggle button:hover {\n background: #f5f5f5;\n border-color: #bbb;\n}\n\n.globe-toggle button.active {\n background: oklch(0.72 0.075 245);\n color: white;\n border-color: oklch(0.59 0.075 245);\n}\n</style>\n","import type { TangramApi } from \"@open-aviation/tangram-core/api\";\nimport GlobeToggle from \"./GlobeToggle.vue\";\n\nexport function install(api: TangramApi, config?: SystemConfig) {\n api.ui.registerWidget(\"globe-toggle\", \"TopBar\", GlobeToggle, {\n priority: config?.topbar_order\n });\n}\n"],"names":["tangramApi","inject","isGlobeView","ref","toggleGlobe","mapInstance","newGlobeState","_openBlock","_createElementBlock","_hoisted_1","_createElementVNode","install","api","config","GlobeToggle"],"mappings":";;;;AAgBA,UAAMA,IAAaC,EAAmB,YAAY;AAClD,QAAI,CAACD;AACH,YAAM,IAAI,MAAM,kCAAkC;AAGpD,UAAME,IAAcC,EAAI,EAAK,GAEvBC,IAAc,MAAM;AACxB,UAAI,CAACJ,EAAW,IAAI,QAAQ,MAAO;AAEnC,YAAMK,IAAcL,EAAW,IAAI,eAAA,GAC7BM,IAAgB,CAACJ,EAAY;AAEnC,MAAAG,EAAY,cAAcC,IAAgB,EAAE,MAAM,YAAY,EAAE,MAAM,YAAY,GAElFJ,EAAY,QAAQI;AAAA,IACtB;sBA/BEC,EAAA,GAAAC,EAQM,OARNC,GAQM;AAAA,MAPJC,EAMS,UAAA;AAAA,QALN,mBAAiBR,EAAA,OAAW;AAAA,QAC5B,OAAOA,EAAA,QAAW,4BAAA;AAAA,QAClB,SAAOE;AAAA,MAAA;QAERM,EAAiC,QAAA,EAA3B,OAAM,cAAA,GAAa,MAAA,EAAA;AAAA,MAAA;;;;;;;;;ACJxB,SAASC,EAAQC,GAAiBC,GAAuB;AAC9D,EAAAD,EAAI,GAAG,eAAe,gBAAgB,UAAUE,GAAa;AAAA,IAC3D,UAAUD,GAAQ;AAAA,EAAA,CACnB;AACH;"}
1
+ {"version":3,"file":"index.js","sources":["../src/tangram_globe/index.ts"],"sourcesContent":["import { watch } from \"vue\";\nimport type { TangramApi } from \"@open-aviation/tangram-core/api\";\n\nexport function install(api: TangramApi) {\n watch(\n () => api.settings.tangram_globe?.values.enabled,\n enabled => {\n if (!api.map.isReady.value) return;\n const mapInstance = api.map.getMapInstance();\n mapInstance.setProjection(enabled ? { type: \"globe\" } : { type: \"mercator\" });\n },\n { immediate: true }\n );\n\n watch(api.map.isReady, ready => {\n if (ready && api.settings.tangram_globe?.values.enabled) {\n api.map.getMapInstance().setProjection({ type: \"globe\" });\n }\n });\n}\n"],"names":["install","api","watch","enabled","ready"],"mappings":";AAGO,SAASA,EAAQC,GAAiB;AACvC,EAAAC;AAAA,IACE,MAAMD,EAAI,SAAS,eAAe,OAAO;AAAA,IACzC,CAAAE,MAAW;AACT,UAAI,CAACF,EAAI,IAAI,QAAQ,MAAO;AAE5B,MADoBA,EAAI,IAAI,eAAA,EAChB,cAAcE,IAAU,EAAE,MAAM,YAAY,EAAE,MAAM,YAAY;AAAA,IAC9E;AAAA,IACA,EAAE,WAAW,GAAA;AAAA,EAAK,GAGpBD,EAAMD,EAAI,IAAI,SAAS,CAAAG,MAAS;AAC9B,IAAIA,KAASH,EAAI,SAAS,eAAe,OAAO,WAC9CA,EAAI,IAAI,eAAA,EAAiB,cAAc,EAAE,MAAM,SAAS;AAAA,EAE5D,CAAC;AACH;"}
@@ -1,5 +1,4 @@
1
1
  {
2
2
  "name": "@open-aviation/tangram-globe",
3
- "main": "index.js",
4
- "style": "index.css"
3
+ "main": "index.js"
5
4
  }
tangram_globe/index.ts CHANGED
@@ -1,8 +1,20 @@
1
+ import { watch } from "vue";
1
2
  import type { TangramApi } from "@open-aviation/tangram-core/api";
2
- import GlobeToggle from "./GlobeToggle.vue";
3
3
 
4
- export function install(api: TangramApi, config?: SystemConfig) {
5
- api.ui.registerWidget("globe-toggle", "TopBar", GlobeToggle, {
6
- priority: config?.topbar_order
4
+ export function install(api: TangramApi) {
5
+ watch(
6
+ () => api.settings.tangram_globe?.values.enabled,
7
+ enabled => {
8
+ if (!api.map.isReady.value) return;
9
+ const mapInstance = api.map.getMapInstance();
10
+ mapInstance.setProjection(enabled ? { type: "globe" } : { type: "mercator" });
11
+ },
12
+ { immediate: true }
13
+ );
14
+
15
+ watch(api.map.isReady, ready => {
16
+ if (ready && api.settings.tangram_globe?.values.enabled) {
17
+ api.map.getMapInstance().setProjection({ type: "globe" });
18
+ }
7
19
  });
8
20
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@open-aviation/tangram-globe",
3
- "version": "0.3.0",
3
+ "version": "0.4.0",
4
4
  "private": true,
5
5
  "type": "module",
6
6
  "main": "src/tangram_globe/index.ts",
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: tangram_globe
3
- Version: 0.3.0
3
+ Version: 0.4.0
4
4
  Summary: Globe view toggle plugin for tangram
5
5
  Author: Andres Morfin Veytia
6
6
  License-Expression: AGPL-3.0
@@ -0,0 +1,10 @@
1
+ tangram_globe/__init__.py,sha256=Ud7cWsF60_wnIBA5k3ReHRfC8jw_B2m-pwftRNuRkD0,593
2
+ tangram_globe/index.ts,sha256=PSfn7E7zlHYRrorhFyqV-zIu_Odq8dew5TfxYccL-VA,614
3
+ tangram_globe/dist-frontend/index.js,sha256=dBN4XvT-D3Ox8Sv1momJPqIdbHY5JdXy3Bi_d-QVL4A,489
4
+ tangram_globe/dist-frontend/index.js.map,sha256=WPZ7svHYdKc_AWew0lNX4aCoSj96QnpbBiS8V_Yit1g,1204
5
+ tangram_globe/dist-frontend/plugin.json,sha256=2uliMeTseOdtWtshOCZeUgQ8TGD44TSi8mPXWxCOz7k,66
6
+ tangram_globe/package.json,sha256=c76Q6ieh5__7_egnnhRIygvLbUEJvD3uIXWNADDYRgo,314
7
+ tangram_globe-0.4.0.dist-info/METADATA,sha256=zoTJRQ_tZxOB3v09b12HhhMvE2kuB2O82EJ8bJVU11M,1310
8
+ tangram_globe-0.4.0.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
9
+ tangram_globe-0.4.0.dist-info/entry_points.txt,sha256=XRFuHtmIgj66E_Awq3Vc_TfE7ecXqpTQjp7yXQDdtQE,60
10
+ tangram_globe-0.4.0.dist-info/RECORD,,
@@ -1,58 +0,0 @@
1
- <template>
2
- <div class="globe-toggle">
3
- <button
4
- :class="{ active: isGlobeView }"
5
- :title="isGlobeView ? 'Switch to mercator view' : 'Switch to globe view'"
6
- @click="toggleGlobe"
7
- >
8
- <span class="fa fa-globe"></span>
9
- </button>
10
- </div>
11
- </template>
12
-
13
- <script setup lang="ts">
14
- import { ref, inject } from "vue";
15
- import type { TangramApi } from "@open-aviation/tangram-core/api";
16
-
17
- const tangramApi = inject<TangramApi>("tangramApi");
18
- if (!tangramApi) {
19
- throw new Error("assert: tangram api not provided");
20
- }
21
-
22
- const isGlobeView = ref(false);
23
-
24
- const toggleGlobe = () => {
25
- if (!tangramApi.map.isReady.value) return;
26
-
27
- const mapInstance = tangramApi.map.getMapInstance();
28
- const newGlobeState = !isGlobeView.value;
29
-
30
- mapInstance.setProjection(newGlobeState ? { type: "globe" } : { type: "mercator" });
31
-
32
- isGlobeView.value = newGlobeState;
33
- };
34
- </script>
35
-
36
- <style scoped>
37
- .globe-toggle button {
38
- background: white;
39
- border: 1px solid #ddd;
40
- border-radius: 4px;
41
- padding: 8px 12px;
42
- cursor: pointer;
43
- font-size: 16px;
44
- transition: all 0.2s ease;
45
- color: #333;
46
- }
47
-
48
- .globe-toggle button:hover {
49
- background: #f5f5f5;
50
- border-color: #bbb;
51
- }
52
-
53
- .globe-toggle button.active {
54
- background: oklch(0.72 0.075 245);
55
- color: white;
56
- border-color: oklch(0.59 0.075 245);
57
- }
58
- </style>
@@ -1 +0,0 @@
1
- .globe-toggle button[data-v-871c94ae]{background:#fff;border:1px solid #ddd;border-radius:4px;padding:8px 12px;cursor:pointer;font-size:16px;transition:all .2s ease;color:#333}.globe-toggle button[data-v-871c94ae]:hover{background:#f5f5f5;border-color:#bbb}.globe-toggle button.active[data-v-871c94ae]{background:#7daad1;color:#fff;border-color:#5682a7}
@@ -1,12 +0,0 @@
1
- tangram_globe/GlobeToggle.vue,sha256=sv1BwoELo8geTmMt97z49jAgxjPEnClDkoczLWnNx18,1307
2
- tangram_globe/__init__.py,sha256=FbuSZ2QtWcL8gSt7w3LjFvIxaOFYDZsFxryePm5E5zs,354
3
- tangram_globe/index.ts,sha256=4Dkom8x_QFxJtMX-iqo0l7mJA46RVlOcIHRAFDIlfws,287
4
- tangram_globe/dist-frontend/index.css,sha256=FCsgMwLYcH92yNpoXcDsEml2B5VGPxXxCaZhY5Ot_Ss,354
5
- tangram_globe/dist-frontend/index.js,sha256=A_dwKJDluzk5sXUN9Vt3E_PnvTC51psaW0mC-7ofvPU,1236
6
- tangram_globe/dist-frontend/index.js.map,sha256=X2uKxzQNQN2sKWnsCfi5CDvhrrKqBq_nC1FlKaIYqpo,2683
7
- tangram_globe/dist-frontend/plugin.json,sha256=8HaRCyE8bMHo8zl_YDjZS8rSzsSoWI1BAeFMe0UmFCw,90
8
- tangram_globe/package.json,sha256=4HRiKtho7_BSobn6gvPBVjPnhhGI_obT5hIm9DPJQ0I,314
9
- tangram_globe-0.3.0.dist-info/METADATA,sha256=vWedovs9hEGZdxHKYGm7Epz0jw9WW9Vd3aSbee9UdNU,1310
10
- tangram_globe-0.3.0.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
11
- tangram_globe-0.3.0.dist-info/entry_points.txt,sha256=XRFuHtmIgj66E_Awq3Vc_TfE7ecXqpTQjp7yXQDdtQE,60
12
- tangram_globe-0.3.0.dist-info/RECORD,,