@abraca/nuxt 2.97.0 → 2.99.0

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/dist/module.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "compatibility": {
5
5
  "nuxt": ">=4.0.0"
6
6
  },
7
- "version": "2.97.0",
7
+ "version": "2.99.0",
8
8
  "builder": {
9
9
  "@nuxt/module-builder": "1.0.2",
10
10
  "unbuild": "3.6.1"
@@ -12,8 +12,8 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {
12
12
  awareness: boolean;
13
13
  tag: "video" | "audio";
14
14
  live: boolean;
15
- controls: boolean;
16
15
  total: boolean;
16
+ controls: boolean;
17
17
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
18
18
  declare const _default: typeof __VLS_export;
19
19
  export default _default;
@@ -12,8 +12,8 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {
12
12
  awareness: boolean;
13
13
  tag: "video" | "audio";
14
14
  live: boolean;
15
- controls: boolean;
16
15
  total: boolean;
16
+ controls: boolean;
17
17
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
18
18
  declare const _default: typeof __VLS_export;
19
19
  export default _default;
@@ -1,17 +1,21 @@
1
1
  <script setup>
2
2
  import { ref, watch, nextTick, onUnmounted } from "vue";
3
- import { useRuntimeConfig } from "#imports";
3
+ import { mapboxAccessToken as resolveMapboxToken, MAPBOX_TOKEN_MISSING } from "../../utils/mapboxToken";
4
4
  const props = defineProps({
5
5
  latValue: { type: Number, required: false },
6
6
  lngValue: { type: Number, required: false },
7
7
  open: { type: Boolean, required: true }
8
8
  });
9
9
  const emit = defineEmits(["update:lat", "update:lng", "update:open", "clear"]);
10
- const mapboxAccessToken = useRuntimeConfig().public?.abracadabra?.mapboxToken;
10
+ const mapboxAccessToken = resolveMapboxToken();
11
11
  let mapboxgl = null;
12
12
  const mapboxError = ref(null);
13
13
  async function loadMapbox() {
14
14
  if (mapboxgl) return true;
15
+ if (!mapboxAccessToken) {
16
+ mapboxError.value = MAPBOX_TOKEN_MISSING;
17
+ return false;
18
+ }
15
19
  try {
16
20
  const mod = await import("mapbox-gl");
17
21
  mapboxgl = mod.default || mod;
@@ -3,6 +3,7 @@ import { ref, computed, watch, nextTick, shallowRef, onMounted, onBeforeUnmount,
3
3
  import { useRuntimeConfig, useColorMode, useAppConfig, useToast } from "#imports";
4
4
  import { useRouter } from "vue-router";
5
5
  import { avatarBorderStyle } from "../../utils/avatarStyle";
6
+ import { mapboxAccessToken as resolveMapboxToken, MAPBOX_TOKEN_MISSING } from "../../utils/mapboxToken";
6
7
  import { useAbracadabra } from "../../composables/useAbracadabra";
7
8
  import { useDocSlugs } from "../../composables/useDocSlugs";
8
9
  import { useRendererBase } from "../../composables/useRendererBase";
@@ -1683,9 +1684,9 @@ onMounted(async () => {
1683
1684
  }
1684
1685
  if (!mapContainer.value) return;
1685
1686
  window.addEventListener("keydown", onKeyDown);
1686
- const token = config.public?.abracadabra?.mapboxToken;
1687
+ const token = resolveMapboxToken();
1687
1688
  if (!token) {
1688
- mapboxError.value = "Mapbox access token not configured. Set abracadabra.mapboxToken in runtimeConfig.public.";
1689
+ mapboxError.value = MAPBOX_TOKEN_MISSING;
1689
1690
  return;
1690
1691
  }
1691
1692
  mapboxgl.accessToken = token;
@@ -14,13 +14,13 @@ type __VLS_Props = {
14
14
  extraItems?: DropdownMenuItem[][];
15
15
  };
16
16
  declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
17
- logout: () => any;
18
17
  "open-settings": () => any;
19
18
  "open-account": () => any;
19
+ logout: () => any;
20
20
  }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
21
- onLogout?: (() => any) | undefined;
22
21
  "onOpen-settings"?: (() => any) | undefined;
23
22
  "onOpen-account"?: (() => any) | undefined;
23
+ onLogout?: (() => any) | undefined;
24
24
  }>, {
25
25
  color: string;
26
26
  collapsed: boolean;
@@ -14,13 +14,13 @@ type __VLS_Props = {
14
14
  extraItems?: DropdownMenuItem[][];
15
15
  };
16
16
  declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
17
- logout: () => any;
18
17
  "open-settings": () => any;
19
18
  "open-account": () => any;
19
+ logout: () => any;
20
20
  }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
21
- onLogout?: (() => any) | undefined;
22
21
  "onOpen-settings"?: (() => any) | undefined;
23
22
  "onOpen-account"?: (() => any) | undefined;
23
+ onLogout?: (() => any) | undefined;
24
24
  }>, {
25
25
  color: string;
26
26
  collapsed: boolean;
@@ -0,0 +1,7 @@
1
+ /** The token, or `''` when the app has not configured one. */
2
+ export declare function mapboxAccessToken(): string;
3
+ /**
4
+ * The sentence a map surface shows when there is no token — one wording, so a
5
+ * renderer and a picker on the same page do not blame different things.
6
+ */
7
+ export declare const MAPBOX_TOKEN_MISSING = "Mapbox access token not configured. Set `abracadabra.mapboxToken` in your Nuxt config.";
@@ -0,0 +1,7 @@
1
+ import { useRuntimeConfig } from "#imports";
2
+ export function mapboxAccessToken() {
3
+ const pub = useRuntimeConfig().public;
4
+ const token = pub?.abracadabra?.mapboxToken ?? pub?.abracadabra?.mapboxAccessToken ?? pub?.mapboxAccessToken ?? "";
5
+ return typeof token === "string" ? token.trim() : "";
6
+ }
7
+ export const MAPBOX_TOKEN_MISSING = "Mapbox access token not configured. Set `abracadabra.mapboxToken` in your Nuxt config.";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abraca/nuxt",
3
- "version": "2.97.0",
3
+ "version": "2.99.0",
4
4
  "description": "First-class Nuxt module for the Abracadabra CRDT collaboration platform",
5
5
  "repository": "abracadabra/abracadabra-nuxt",
6
6
  "license": "MIT",
@@ -173,10 +173,10 @@
173
173
  }
174
174
  },
175
175
  "devDependencies": {
176
- "@abraca/convert": "^2.96.0",
177
- "@abraca/dabra": "^2.96.0",
178
- "@abraca/plugin": "^2.96.0",
179
- "@abraca/schema": "^2.96.0",
176
+ "@abraca/convert": "^2.97.0",
177
+ "@abraca/dabra": "^2.97.0",
178
+ "@abraca/plugin": "^2.97.0",
179
+ "@abraca/schema": "^2.97.0",
180
180
  "@codemirror/autocomplete": "^6.18.0",
181
181
  "@codemirror/commands": "^6.7.0",
182
182
  "@codemirror/lang-css": "^6.3.1",