cec-nuxt-lib 0.2.2 → 0.2.5
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.d.mts +1 -1
- package/dist/module.d.ts +1 -1
- package/dist/module.json +3 -3
- package/dist/module.mjs +2 -2
- package/dist/runtime/components/cecBreadcrumb.vue +30 -17
- package/dist/runtime/components/cecHeader.vue +6 -2
- package/dist/types.d.mts +4 -4
- package/dist/types.d.ts +4 -4
- package/package.json +1 -1
package/dist/module.d.mts
CHANGED
|
@@ -2,6 +2,6 @@ import * as _nuxt_schema from '@nuxt/schema';
|
|
|
2
2
|
|
|
3
3
|
interface ModuleOptions {
|
|
4
4
|
}
|
|
5
|
-
declare const _default: _nuxt_schema.NuxtModule<ModuleOptions>;
|
|
5
|
+
declare const _default: _nuxt_schema.NuxtModule<ModuleOptions, ModuleOptions, false>;
|
|
6
6
|
|
|
7
7
|
export { type ModuleOptions, _default as default };
|
package/dist/module.d.ts
CHANGED
|
@@ -2,6 +2,6 @@ import * as _nuxt_schema from '@nuxt/schema';
|
|
|
2
2
|
|
|
3
3
|
interface ModuleOptions {
|
|
4
4
|
}
|
|
5
|
-
declare const _default: _nuxt_schema.NuxtModule<ModuleOptions>;
|
|
5
|
+
declare const _default: _nuxt_schema.NuxtModule<ModuleOptions, ModuleOptions, false>;
|
|
6
6
|
|
|
7
7
|
export { type ModuleOptions, _default as default };
|
package/dist/module.json
CHANGED
package/dist/module.mjs
CHANGED
|
@@ -2,8 +2,8 @@ import { defineNuxtModule, createResolver, addComponentsDir, addImportsDir } fro
|
|
|
2
2
|
|
|
3
3
|
const module = defineNuxtModule({
|
|
4
4
|
meta: {
|
|
5
|
-
name: "cec-
|
|
6
|
-
configKey: "cec-
|
|
5
|
+
name: "cec-nuxt-lib",
|
|
6
|
+
configKey: "cec-nuxt-lib"
|
|
7
7
|
},
|
|
8
8
|
// Default configuration options of the Nuxt module
|
|
9
9
|
defaults: {},
|
|
@@ -3,15 +3,15 @@ import { useState } from '#app';
|
|
|
3
3
|
import { useRuntimeConfig } from '#app';
|
|
4
4
|
import { useRoute } from 'vue-router';
|
|
5
5
|
|
|
6
|
+
const classicPath = useState('classicPath');
|
|
6
7
|
const config = useRuntimeConfig();
|
|
8
|
+
const path = useState('path');
|
|
7
9
|
const route = useRoute();
|
|
8
|
-
const classicPath = useState('classicPath');
|
|
9
10
|
const baseUrl = config.app.baseURL;
|
|
10
11
|
|
|
11
12
|
// Helper functions
|
|
12
13
|
const makeLink = (i, routes) => {
|
|
13
|
-
|
|
14
|
-
return temp.length ? temp : '/';
|
|
14
|
+
return routes.slice(0, i + 1).join('/');
|
|
15
15
|
};
|
|
16
16
|
|
|
17
17
|
const toTitleCase = (str) => {
|
|
@@ -20,19 +20,34 @@ const toTitleCase = (str) => {
|
|
|
20
20
|
: `${str[0].toUpperCase()}${str.slice(1).replace(/[-_]/g, ' ')}`;
|
|
21
21
|
};
|
|
22
22
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
23
|
+
const makeArr = (str) => {
|
|
24
|
+
return str.split('/').reduce((acc, e, i) => {
|
|
25
|
+
if (!i || (i && e.length)) {
|
|
26
|
+
return [...acc, e];
|
|
27
|
+
}
|
|
28
|
+
return acc;
|
|
29
|
+
}, []);
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
const trimPath = (str) => str.replace(/\/$/, '');
|
|
33
|
+
|
|
34
|
+
// Make arrays of the items in the paths
|
|
35
|
+
let routeTrim = trimPath(route.path);
|
|
36
|
+
let pathTrim = trimPath(path.value);
|
|
37
|
+
let routes = makeArr(routeTrim);
|
|
38
|
+
let paths = makeArr(pathTrim);
|
|
39
|
+
|
|
40
|
+
// Use the route path if it includes the node's path
|
|
41
|
+
if (!routeTrim.toLowerCase().startsWith(pathTrim.toLowerCase())) {
|
|
42
|
+
routes = [...paths, ...routes.filter((e) => e.length)];
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
// Get the classic path for legacy links
|
|
46
|
+
let classic = trimPath(classicPath.value).split('/');
|
|
32
47
|
const length = classic.length;
|
|
33
48
|
let hrefs =
|
|
34
|
-
baseUrl.length > 1
|
|
35
|
-
? `${classicPath.value}${
|
|
49
|
+
baseUrl.length > 1 && route.path !== '/'
|
|
50
|
+
? `${classicPath.value}${routeTrim}`.split('/')
|
|
36
51
|
: routes.reduce((acc, e, i) => {
|
|
37
52
|
return classic[i] ? [...acc, classic[i]] : [...acc, e];
|
|
38
53
|
}, []);
|
|
@@ -48,9 +63,7 @@ const links = hrefs.map((e, i) => (!i ? 'Home' : toTitleCase(e)));
|
|
|
48
63
|
<li class="breadcrumb-item" v-for="(l, i) in links" :key="i">
|
|
49
64
|
<span v-if="i === links.length - 1">{{ l }}</span>
|
|
50
65
|
<template v-else-if="i + 1 >= length">
|
|
51
|
-
<NuxtLink :to="makeLink(
|
|
52
|
-
l
|
|
53
|
-
}}</NuxtLink>
|
|
66
|
+
<NuxtLink :to="makeLink(i, routes)">{{ l }}</NuxtLink>
|
|
54
67
|
</template>
|
|
55
68
|
<a v-else :href="'/' + hrefs.slice(1, i + 1).join('/')">
|
|
56
69
|
{{ l }}</a
|
|
@@ -3,6 +3,7 @@ import { onMounted } from 'vue';
|
|
|
3
3
|
import { useState } from '#app';
|
|
4
4
|
|
|
5
5
|
const searchTerm = useState('searchTerm', () => 'Enter keywords:');
|
|
6
|
+
const showSiteSearch = useState('showSiteSearch');
|
|
6
7
|
|
|
7
8
|
// Cookie control config.
|
|
8
9
|
const config = {
|
|
@@ -89,6 +90,7 @@ const config = {
|
|
|
89
90
|
},
|
|
90
91
|
};
|
|
91
92
|
|
|
93
|
+
// Placeholder because we need to wait for browsealoud
|
|
92
94
|
let updateToggleText = () => {
|
|
93
95
|
console.log('toggle');
|
|
94
96
|
};
|
|
@@ -104,7 +106,6 @@ onMounted(() => {
|
|
|
104
106
|
}
|
|
105
107
|
BrowseAloud.panel.toggleBar();
|
|
106
108
|
};
|
|
107
|
-
|
|
108
109
|
try {
|
|
109
110
|
CookieControl.load(config);
|
|
110
111
|
} catch (ignore) {
|
|
@@ -222,7 +223,10 @@ onMounted(() => {
|
|
|
222
223
|
</ul>
|
|
223
224
|
</div>
|
|
224
225
|
<div class="cec-search-site">
|
|
225
|
-
<div
|
|
226
|
+
<div
|
|
227
|
+
class="sys_search-query-control"
|
|
228
|
+
:class="{ 'd-none': !showSiteSearch }"
|
|
229
|
+
>
|
|
226
230
|
<label for="searchTextBox" class="hidden sys_search-label"
|
|
227
231
|
>Search</label
|
|
228
232
|
>
|
package/dist/types.d.mts
CHANGED
|
@@ -3,13 +3,13 @@ import type { ModuleOptions } from './module.js'
|
|
|
3
3
|
|
|
4
4
|
|
|
5
5
|
declare module '@nuxt/schema' {
|
|
6
|
-
interface NuxtConfig { ['cec-
|
|
7
|
-
interface NuxtOptions { ['cec-
|
|
6
|
+
interface NuxtConfig { ['cec-nuxt-lib']?: Partial<ModuleOptions> }
|
|
7
|
+
interface NuxtOptions { ['cec-nuxt-lib']?: ModuleOptions }
|
|
8
8
|
}
|
|
9
9
|
|
|
10
10
|
declare module 'nuxt/schema' {
|
|
11
|
-
interface NuxtConfig { ['cec-
|
|
12
|
-
interface NuxtOptions { ['cec-
|
|
11
|
+
interface NuxtConfig { ['cec-nuxt-lib']?: Partial<ModuleOptions> }
|
|
12
|
+
interface NuxtOptions { ['cec-nuxt-lib']?: ModuleOptions }
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
|
package/dist/types.d.ts
CHANGED
|
@@ -3,13 +3,13 @@ import type { ModuleOptions } from './module'
|
|
|
3
3
|
|
|
4
4
|
|
|
5
5
|
declare module '@nuxt/schema' {
|
|
6
|
-
interface NuxtConfig { ['cec-
|
|
7
|
-
interface NuxtOptions { ['cec-
|
|
6
|
+
interface NuxtConfig { ['cec-nuxt-lib']?: Partial<ModuleOptions> }
|
|
7
|
+
interface NuxtOptions { ['cec-nuxt-lib']?: ModuleOptions }
|
|
8
8
|
}
|
|
9
9
|
|
|
10
10
|
declare module 'nuxt/schema' {
|
|
11
|
-
interface NuxtConfig { ['cec-
|
|
12
|
-
interface NuxtOptions { ['cec-
|
|
11
|
+
interface NuxtConfig { ['cec-nuxt-lib']?: Partial<ModuleOptions> }
|
|
12
|
+
interface NuxtOptions { ['cec-nuxt-lib']?: ModuleOptions }
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
|
package/package.json
CHANGED