@shwfed/nuxt 0.1.58 → 0.1.60

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
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@shwfed/nuxt",
3
3
  "configKey": "shwfed",
4
- "version": "0.1.58",
4
+ "version": "0.1.60",
5
5
  "builder": {
6
6
  "@nuxt/module-builder": "1.0.2",
7
7
  "unbuild": "3.6.1"
@@ -316,12 +316,11 @@ const activeTab = useSessionStorage("navigation-active-tab", void 0, {
316
316
  onMounted(() => {
317
317
  const baseRaw = app.baseURL ?? "/";
318
318
  const base = baseRaw === "" || baseRaw === "/" ? "/" : baseRaw.replace(/\/*$/, "") + "/";
319
- const pathOnly = route.fullPath.replace(/\?.*$/, "").replace(/#.*$/, "");
320
319
  let pathToMatch;
321
320
  if (base === "/") {
322
- pathToMatch = pathOnly;
323
- } else if (pathOnly.startsWith(base) || pathOnly === base.slice(0, -1)) {
324
- const remainder = pathOnly === base.slice(0, -1) ? "/" : pathOnly.slice(base.length) || "/";
321
+ pathToMatch = route.path;
322
+ } else if (route.fullPath.startsWith(base)) {
323
+ const remainder = route.fullPath.slice(base.length) || "/";
325
324
  pathToMatch = remainder.startsWith("/") ? remainder : `/${remainder}`;
326
325
  } else {
327
326
  pathToMatch = route.path;
@@ -680,7 +679,7 @@ useHead({
680
679
  </Sidebar>
681
680
  </SidebarProvider>
682
681
  <main class="flex-1 flex flex-col bg-zinc-100 overflow-hidden">
683
- <nav class="bg-white p-1 border-b border-zinc-100 h-10 flex items-center justify-start gap-1 overflow-x-hidden cursor-pointer min-w-0">
682
+ <nav class="bg-white p-1 border-b border-zinc-100 h-10 flex items-center justify-start gap-1 overflow-x-hidden min-w-0">
684
683
  <div
685
684
  v-for="tab in tabs"
686
685
  :key="tab"
@@ -1,9 +1,11 @@
1
1
  import { defineNuxtPlugin, navigateTo, useNuxtApp, useRuntimeConfig } from "#app";
2
+ import { useNavigatorLanguage } from "@vueuse/core";
2
3
  import z from "zod";
3
4
  export default defineNuxtPlugin({
4
5
  name: "shwfed-nuxt:api",
5
6
  dependsOn: ["shwfed-nuxt:cel"],
6
7
  setup: (nuxt) => {
8
+ const locale = useNavigatorLanguage();
7
9
  const config = useRuntimeConfig().public.shwfed;
8
10
  const { $dsl } = useNuxtApp();
9
11
  const api = $fetch.create({
@@ -26,6 +28,9 @@ export default defineNuxtPlugin({
26
28
  } catch {
27
29
  }
28
30
  }
31
+ if (locale.isSupported && locale.language.value) {
32
+ options.headers.set("Accept-Language", locale.language.value);
33
+ }
29
34
  },
30
35
  onResponse: ({ response }) => {
31
36
  const authorizeUri = config.apis.authorizeUri;
@@ -4,11 +4,6 @@ declare const _default: import("#app").Plugin<{
4
4
  check: (template: {
5
5
  raw: readonly string[] | ArrayLike<string>;
6
6
  }, ...substitutions: any[]) => import("@marcbachmann/cel-js").TypeCheckResult;
7
- /**
8
- * Synchronous evaluation for render-time usage (e.g. table accessors).
9
- *
10
- * Will throw `TypeError` / `EvaluationError` on failure.
11
- */
12
7
  evaluate: <T>(template: {
13
8
  raw: readonly string[] | ArrayLike<string>;
14
9
  }, ...substitutions: any[]) => (context?: Context) => T;
@@ -18,11 +13,6 @@ declare const _default: import("#app").Plugin<{
18
13
  check: (template: {
19
14
  raw: readonly string[] | ArrayLike<string>;
20
15
  }, ...substitutions: any[]) => import("@marcbachmann/cel-js").TypeCheckResult;
21
- /**
22
- * Synchronous evaluation for render-time usage (e.g. table accessors).
23
- *
24
- * Will throw `TypeError` / `EvaluationError` on failure.
25
- */
26
16
  evaluate: <T>(template: {
27
17
  raw: readonly string[] | ArrayLike<string>;
28
18
  }, ...substitutions: any[]) => (context?: Context) => T;
@@ -10,24 +10,30 @@ export default defineNuxtPlugin({
10
10
  ...config.ci,
11
11
  build: config.ci.build !== void 0 ? BigInt(config.ci.build) : void 0
12
12
  }).registerConstant("apis", "map<string, string>", config.apis);
13
+ const evaluate = (...args) => (context) => {
14
+ return env.evaluate(String.raw(...args), defu({}, getGlobalDslContext(), context, {
15
+ now: /* @__PURE__ */ new Date(),
16
+ today: /* @__PURE__ */ new Date(),
17
+ location: new URL(location.href)
18
+ }));
19
+ };
20
+ if (import.meta.client) {
21
+ Object.assign(
22
+ window,
23
+ {
24
+ cel: {
25
+ evaluate
26
+ }
27
+ }
28
+ );
29
+ }
13
30
  return {
14
31
  provide: {
15
32
  dsl: {
16
33
  check: (...args) => {
17
34
  return env.check(String.raw(...args));
18
35
  },
19
- /**
20
- * Synchronous evaluation for render-time usage (e.g. table accessors).
21
- *
22
- * Will throw `TypeError` / `EvaluationError` on failure.
23
- */
24
- evaluate: (...args) => (context) => {
25
- return env.evaluate(String.raw(...args), defu({}, getGlobalDslContext(), context, {
26
- now: /* @__PURE__ */ new Date(),
27
- today: /* @__PURE__ */ new Date(),
28
- location: new URL(location.href)
29
- }));
30
- }
36
+ evaluate
31
37
  }
32
38
  }
33
39
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shwfed/nuxt",
3
- "version": "0.1.58",
3
+ "version": "0.1.60",
4
4
  "description": "",
5
5
  "license": "MIT",
6
6
  "type": "module",