cec-nuxt-lib 0.12.3 → 0.12.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.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "cec-nuxt-lib",
3
3
  "configKey": "cec-nuxt-lib",
4
- "version": "0.12.3",
4
+ "version": "0.12.5",
5
5
  "builder": {
6
6
  "@nuxt/module-builder": "1.0.1",
7
7
  "unbuild": "3.5.0"
@@ -52,7 +52,11 @@ const links = hrefs.map(
52
52
  <li class="breadcrumb-item" v-for="(l, i) in links" :key="i">
53
53
  <!-- Node we are on -->
54
54
  <span v-if="i === links.length - 1">{{
55
- links.includes("Parties") ? toTitleCase(decodeURIComponent(l)) : page.eventTitle ? page.eventTitle : decodeURIComponent(l)
55
+ links.includes('Parties')
56
+ ? toTitleCase(decodeURIComponent(l))
57
+ : page.eventTitle
58
+ ? page.eventTitle
59
+ : decodeURIComponent(l)
56
60
  }}</span>
57
61
  <!-- Nuxt links -->
58
62
  <template v-else-if="i + 1 >= length">
@@ -2,7 +2,7 @@
2
2
  import { useState } from "#app";
3
3
  import { createRenderer, text } from "@contensis/canvas-html";
4
4
  const getCanvas = (data) => renderer({ data });
5
- const settings = useState("settings");
5
+ const page = useState("page");
6
6
  let canvasHtml;
7
7
  const props = defineProps({
8
8
  canvas: {
@@ -354,8 +354,8 @@ const makeQuestions = (data, id) => {
354
354
  );
355
355
  qu.select += "</select>";
356
356
  }
357
- if (!settings.value.questions.some((e) => e.id === id)) {
358
- settings.value.questions.push({
357
+ if (!page.value.questions.some((e) => e.id === id)) {
358
+ page.value.questions.push({
359
359
  id,
360
360
  question: data.question,
361
361
  stack: [0]
@@ -604,10 +604,10 @@ const genericListAsAccordion = (props2) => {
604
604
  };
605
605
  const genList = (item, id) => {
606
606
  let heading = item.title ? `<h2 class="fs-4 mt-3">${item.title}</h2>` : "";
607
- return settings.value.listItems[id] && settings.value.listItems[id].length ? `
607
+ return page.value.listItems[id] && page.value.listItems[id].length ? `
608
608
  ${heading}
609
609
  <ul>
610
- ${settings.value.listItems[id].reduce((acc, e) => {
610
+ ${page.value.listItems[id].reduce((acc, e) => {
611
611
  return e.sys.dataFormat === "webpage" ? `${acc}
612
612
  <li><a href="${processUri(e.sys.uri)}">${e.title}</a></li>
613
613
  ` : `${acc}
@@ -1,7 +1,6 @@
1
1
  <script setup>
2
2
  import { useState } from "#app";
3
3
  const page = useState("page");
4
- const settings = useState("settings");
5
4
  const props = defineProps({
6
5
  reviewed: {
7
6
  type: String,
@@ -31,7 +30,7 @@ const dateOptions = {
31
30
  <p v-if="reviewed && !page.hideReviewDate">
32
31
  <small
33
32
  >Page last reviewed:
34
- {{ new Date(reviewed).toLocaleDateString("en-GB", dateOptions) }}
33
+ {{ new Date(reviewed).toLocaleDateString('en-GB', dateOptions) }}
35
34
  </small>
36
35
  </p>
37
36
  <div class="accordion pb-4">
@@ -60,7 +59,7 @@ const dateOptions = {
60
59
  <ul class="list-unstyled list-inline">
61
60
  <li class="list-inline-item me-3">
62
61
  <a
63
- :href="`https://digital-core.cheshireeast.gov.uk/w/webpage/request?form=improve_this_page&pageTitle=${encodeURIComponent(title)}&pagePath=${settings.baseUrl}${path}`"
62
+ :href="`https://digital-core.cheshireeast.gov.uk/w/webpage/request?form=improve_this_page&pageTitle=${encodeURIComponent(title)}&pagePath=${page.baseUrl}${path}`"
64
63
  id="yes-feedback"
65
64
  class="liberty_form_link btn btn-lg btn-outline-secondary btn-example-1 btn-chevron rounded-pill text-left"
66
65
  >Yes<span class="visually-hidden">
@@ -1,28 +1,7 @@
1
- declare const _default: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
2
- reviewed: {
3
- type: StringConstructor;
4
- required: true;
5
- };
6
- path: {
7
- type: StringConstructor;
8
- required: true;
9
- };
10
- title: {
11
- type: StringConstructor;
12
- required: true;
13
- };
14
- }>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
15
- reviewed: {
16
- type: StringConstructor;
17
- required: true;
18
- };
19
- path: {
20
- type: StringConstructor;
21
- required: true;
22
- };
23
- title: {
24
- type: StringConstructor;
25
- required: true;
26
- };
27
- }>> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
1
+ declare const _default: import("vue").DefineComponent<{}, {
2
+ path: string;
3
+ reviewed: string;
4
+ title: string;
5
+ $props: any;
6
+ }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
28
7
  export default _default;
@@ -2,7 +2,6 @@
2
2
  import { onMounted } from "vue";
3
3
  import { useState, navigateTo } from "#app";
4
4
  const page = useState("page");
5
- const settings = useState("settings");
6
5
  const regex = /^https:\/\/digital-core\.cheshireeast\.gov\.uk(?!.*(?:&pagePath|&pageTitle|login)).*$/;
7
6
  const config = {
8
7
  apiKey: "c1a902dfad207b122cca32738e623af375e1d2ee",
@@ -81,9 +80,9 @@ const config = {
81
80
  }
82
81
  };
83
82
  const doSearch = async () => {
84
- if (settings.value.searchTerms) {
83
+ if (page.value.searchTerms) {
85
84
  await navigateTo(
86
- `https://www.cheshireeast.gov.uk/search-results?search_keywords=${encodeURI(settings.value.searchTerms)}`,
85
+ `https://www.cheshireeast.gov.uk/search-results?search_keywords=${encodeURI(page.value.searchTerms.trim())}`,
87
86
  { external: true }
88
87
  );
89
88
  }
@@ -142,7 +141,7 @@ onMounted(() => {
142
141
  const getQuInfo = (b) => {
143
142
  let temp = b.id.split("_");
144
143
  let id = temp[3];
145
- let q = settings.value.questions.find((e) => e.id === id);
144
+ let q = page.value.questions.find((e) => e.id === id);
146
145
  if (q) {
147
146
  let myQ = q.question[parseInt(temp[4])];
148
147
  if (temp.length === 6) {
@@ -195,7 +194,7 @@ onMounted(() => {
195
194
  forms.forEach((link) => {
196
195
  link.href = `${link.href}&pageTitle=${encodeURIComponent(
197
196
  page.value.title
198
- )}&pagePath=${settings.value.baseUrl}${encodeURIComponent(settings.value.path)}`;
197
+ )}&pagePath=${page.value.baseUrl}${encodeURIComponent(page.value.path)}`;
199
198
  });
200
199
  const setUpListeners = () => {
201
200
  let qSelects = Array.from(
@@ -227,7 +226,7 @@ onMounted(() => {
227
226
  });
228
227
  };
229
228
  const goto = (id, index, addToStack = true) => {
230
- let qTop = settings.value.questions.find((e) => e.id === id);
229
+ let qTop = page.value.questions.find((e) => e.id === id);
231
230
  if (!index) {
232
231
  qTop.stack = [0];
233
232
  }
@@ -249,12 +248,12 @@ onMounted(() => {
249
248
  );
250
249
  };
251
250
  const prev = (id) => {
252
- let qTop = settings.value.questions.find((e) => e.id === id);
251
+ let qTop = page.value.questions.find((e) => e.id === id);
253
252
  let ind = qTop.stack.pop();
254
253
  goto(id, ind, !qTop.stack.length);
255
254
  };
256
255
  const reset = (id) => {
257
- let qTop = settings.value.questions.find((e) => e.id === id);
256
+ let qTop = page.value.questions.find((e) => e.id === id);
258
257
  if (qTop.stack.length) {
259
258
  qTop.stack = [];
260
259
  goto(id, 0);
@@ -349,10 +348,10 @@ onMounted(() => {
349
348
  >Search</label
350
349
  >
351
350
  <input
352
- v-model="settings.searchTerms"
351
+ v-model="page.searchTerms"
353
352
  @keypress.enter="doSearch"
354
353
  placeholder="Enter keywords"
355
- @focus="settings.searchTerms = ''"
354
+ @focus="page.searchTerms = ''"
356
355
  type="text"
357
356
  id="searchTextBox"
358
357
  class="sys_searchbox"
@@ -1,7 +1,6 @@
1
1
  <script setup>
2
2
  import { useState, useHead, useSeoMeta } from "#app";
3
3
  const page = useState("page");
4
- const settings = useState("settings");
5
4
  let reviewDate = page.value.dateReviewed ? new Date(page.value.dateReviewed) : /* @__PURE__ */ new Date();
6
5
  let reviewISO = reviewDate.toISOString().slice(0, 10);
7
6
  let meta = [
@@ -71,7 +70,7 @@ useHead({
71
70
  },
72
71
  {
73
72
  "@type": "ContactPoint",
74
- url: `https://digital-core.cheshireeast.gov.uk/w/webpage/request?form=contact_us&pageTitle=${encodeURIComponent(page.value.title)}&pagePath=${settings.value.baseUrl}${settings.value.path}`,
73
+ url: `https://digital-core.cheshireeast.gov.uk/w/webpage/request?form=contact_us&pageTitle=${encodeURIComponent(page.value.title)}&pagePath=${page.value.baseUrl}${page.value.path}`,
75
74
  contactType: "Online contact form",
76
75
  areaServed: "Cheshire East"
77
76
  }
@@ -104,7 +103,7 @@ useHead({
104
103
  });
105
104
  useSeoMeta({
106
105
  ogTitle: page.value.title,
107
- ogImage: settings.value.ogImage,
106
+ ogImage: page.value.ogImage,
108
107
  ogDescription: page.value.title
109
108
  });
110
109
  </script>
@@ -1,12 +1,12 @@
1
1
  <script setup>
2
2
  import { useState } from "#app";
3
- const settings = useState("settings");
3
+ const page = useState("page");
4
4
  </script>
5
5
 
6
6
  <template>
7
7
  <h2>Related pages</h2>
8
8
  <ul>
9
- <li v-for="item in settings.siblings">
9
+ <li v-for="item in page.siblings">
10
10
  <a :href="item.path">{{ item.displayName }}</a>
11
11
  </li>
12
12
  </ul>
@@ -1,13 +1,12 @@
1
1
  <script setup>
2
2
  import { useState } from "#app";
3
3
  const page = useState("page");
4
- const settings = useState("settings");
5
4
  const goToPage = (n) => {
6
- settings.value.pageIndex = n;
7
- settings.value.scrollTo.scrollIntoView();
5
+ page.value.pageIndex = n;
6
+ page.value.scrollTo.scrollIntoView();
8
7
  };
9
8
  const getResults = () => {
10
- return settings.value.pages.reduce((acc, p) => {
9
+ return page.value.pages.reduce((acc, p) => {
11
10
  return acc + p.length;
12
11
  }, 0);
13
12
  };
@@ -17,7 +16,7 @@ const getResults = () => {
17
16
  <div>
18
17
  <nav
19
18
  class="my-4"
20
- v-if="settings.pages.length > 1"
19
+ v-if="page.pages.length > 1"
21
20
  aria-label="Results data navigation"
22
21
  >
23
22
  <ol class="pagination d-flex flex-wrap my-2 ms-0">
@@ -26,7 +25,7 @@ const getResults = () => {
26
25
  class="page-link rounded"
27
26
  type="button"
28
27
  aria-label="First"
29
- :class="{ disabled: !settings.pageIndex }"
28
+ :class="{ disabled: !page.pageIndex }"
30
29
  @click="goToPage(0)"
31
30
  >
32
31
  First
@@ -37,15 +36,15 @@ const getResults = () => {
37
36
  class="page-link rounded"
38
37
  type="button"
39
38
  aria-label="Previous"
40
- :class="{ disabled: !settings.pageIndex }"
41
- @click="goToPage(settings.pageIndex - 1)"
39
+ :class="{ disabled: !page.pageIndex }"
40
+ @click="goToPage(page.pageIndex - 1)"
42
41
  >
43
42
  Previous
44
43
  </button>
45
44
  </li>
46
45
  <li class="page-item mb-2 rounded disabled current">
47
46
  <button class="page-link rounded" type="button">
48
- {{ settings.pageIndex + 1 }}
47
+ {{ page.pageIndex + 1 }}
49
48
  </button>
50
49
  </li>
51
50
  <li class="page-item mb-2">
@@ -54,9 +53,9 @@ const getResults = () => {
54
53
  type="button"
55
54
  aria-label="Next"
56
55
  :class="{
57
- disabled: settings.pageIndex + 1 === settings.pages.length,
56
+ disabled: page.pageIndex + 1 === page.pages.length,
58
57
  }"
59
- @click="goToPage(settings.pageIndex + 1)"
58
+ @click="goToPage(page.pageIndex + 1)"
60
59
  >
61
60
  Next
62
61
  </button>
@@ -67,9 +66,9 @@ const getResults = () => {
67
66
  type="button"
68
67
  aria-label="Last"
69
68
  :class="{
70
- disabled: settings.pageIndex === settings.pages.length - 1,
69
+ disabled: page.pageIndex === page.pages.length - 1,
71
70
  }"
72
- @click="goToPage(settings.pages.length - 1)"
71
+ @click="goToPage(page.pages.length - 1)"
73
72
  >
74
73
  Last
75
74
  </button>
@@ -78,16 +77,11 @@ const getResults = () => {
78
77
  </nav>
79
78
  <p>
80
79
  <span
81
- v-if="
82
- page.showResultsNum &&
83
- settings.pages[0] &&
84
- settings.pages[0].length > 0
85
- "
80
+ v-if="page.showResultsNum && page.pages[0] && page.pages[0].length > 0"
86
81
  >Total results: {{ getResults() }}.&nbsp;</span
87
82
  >
88
- <span v-if="settings.pages.length > 1"
89
- >Viewing page {{ settings.pageIndex + 1 }} of
90
- {{ settings.pages.length }}.</span
83
+ <span v-if="page.pages.length > 1"
84
+ >Viewing page {{ page.pageIndex + 1 }} of {{ page.pages.length }}.</span
91
85
  >
92
86
  </p>
93
87
  </div>
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "0.12.3",
2
+ "version": "0.12.5",
3
3
  "name": "cec-nuxt-lib",
4
4
  "description": "Nuxt components and assets",
5
5
  "license": "MIT",