@tekkare/auriga 0.2.44 → 0.2.46
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 +1 -1
- package/dist/runtime/components/argChaptersNav.vue +1 -1
- package/dist/runtime/components/argScopeCriteria.vue +1 -1
- package/dist/runtime/components/argScopeManage.vue +1 -1
- package/dist/runtime/components/argSearchInput.vue +1 -1
- package/dist/runtime/components/argSidebar.vue +5 -5
- package/dist/runtime/components/localTextHighlight.vue +251 -0
- package/dist/runtime/components/localTextHighlight.vue.d.ts +96 -0
- package/package.json +1 -1
package/dist/module.json
CHANGED
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
class="arg_sidebar_home"
|
|
21
21
|
>
|
|
22
22
|
<arg-tooltip
|
|
23
|
-
:tooltip-text="langData?.home"
|
|
23
|
+
:tooltip-text="langData === null ? '' : langData?.home"
|
|
24
24
|
:disable="sidebarOpen"
|
|
25
25
|
dir="right"
|
|
26
26
|
:class="[
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
</nuxt-link>
|
|
35
35
|
<div class="sidebar_toggle" @click="toggleSidebar()">
|
|
36
36
|
<arg-tooltip
|
|
37
|
-
:tooltip-text="langData?.open"
|
|
37
|
+
:tooltip-text="langData === null ? '' : langData?.open"
|
|
38
38
|
:disable="sidebarOpen"
|
|
39
39
|
dir="right"
|
|
40
40
|
:class="[
|
|
@@ -91,14 +91,14 @@ export default defineComponent({
|
|
|
91
91
|
type: String,
|
|
92
92
|
default: "en",
|
|
93
93
|
validator: (value) => {
|
|
94
|
-
return ["en", "fr", "es"].includes(value);
|
|
94
|
+
return ["en", "fr", "es", "jp"].includes(value);
|
|
95
95
|
}
|
|
96
96
|
},
|
|
97
97
|
homeLink: { type: String, default: "/" }
|
|
98
98
|
},
|
|
99
99
|
emits: ["onSidebarChange", "update:Sidebar"],
|
|
100
100
|
setup(props, { emit }) {
|
|
101
|
-
onMounted(() => {
|
|
101
|
+
onMounted(async () => {
|
|
102
102
|
window?.addEventListener("resize", handleResize);
|
|
103
103
|
handleResize();
|
|
104
104
|
});
|
|
@@ -114,7 +114,7 @@ export default defineComponent({
|
|
|
114
114
|
}
|
|
115
115
|
}
|
|
116
116
|
onBeforeMount(async () => {
|
|
117
|
-
setLang();
|
|
117
|
+
await setLang();
|
|
118
118
|
});
|
|
119
119
|
watch(
|
|
120
120
|
() => props.lang,
|
|
@@ -0,0 +1,251 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div :class="haveReadMore && needsMore ? 'crop_display' : ''">
|
|
3
|
+
<div
|
|
4
|
+
:id="id"
|
|
5
|
+
:class="crop && !showMore ? 'crop' : ''"
|
|
6
|
+
:style="crop && !showMore ? `-webkit-line-clamp: ${lines}` : ''"
|
|
7
|
+
v-html="renderText"
|
|
8
|
+
/>
|
|
9
|
+
<arg-text-btn v-if="crop && haveReadMore && needsMore" @click="toggleMore">
|
|
10
|
+
{{ getReadMore }}
|
|
11
|
+
</arg-text-btn>
|
|
12
|
+
</div>
|
|
13
|
+
</template>
|
|
14
|
+
|
|
15
|
+
<script>
|
|
16
|
+
import { onMounted, ref, computed, defineComponent } from "vue";
|
|
17
|
+
import argTextBtn from "./argTextBtn.vue";
|
|
18
|
+
export default defineComponent({
|
|
19
|
+
name: "localTextHighlight",
|
|
20
|
+
components: { argTextBtn },
|
|
21
|
+
props: {
|
|
22
|
+
text: {
|
|
23
|
+
type: String,
|
|
24
|
+
required: true
|
|
25
|
+
},
|
|
26
|
+
queries: {
|
|
27
|
+
type: Array,
|
|
28
|
+
default: null
|
|
29
|
+
},
|
|
30
|
+
crop: {
|
|
31
|
+
type: Boolean,
|
|
32
|
+
default: false
|
|
33
|
+
},
|
|
34
|
+
lines: {
|
|
35
|
+
type: Number,
|
|
36
|
+
default: 3
|
|
37
|
+
},
|
|
38
|
+
haveReadMore: {
|
|
39
|
+
type: Boolean,
|
|
40
|
+
default: false
|
|
41
|
+
},
|
|
42
|
+
id: {
|
|
43
|
+
type: String,
|
|
44
|
+
default: null
|
|
45
|
+
},
|
|
46
|
+
customReadMore: {
|
|
47
|
+
type: Object,
|
|
48
|
+
default: null
|
|
49
|
+
},
|
|
50
|
+
lang: {
|
|
51
|
+
type: String,
|
|
52
|
+
default: "en",
|
|
53
|
+
validator: (value) => {
|
|
54
|
+
return ["en", "fr", "es"].includes(value);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
},
|
|
58
|
+
emits: ["onShowMore", "onShowLess"],
|
|
59
|
+
setup(props, { emit }) {
|
|
60
|
+
const showMore = ref(false);
|
|
61
|
+
const indic = ref(null);
|
|
62
|
+
const getReadMore = computed(() => {
|
|
63
|
+
if (props.customReadMore !== null) {
|
|
64
|
+
return showMore.value ? props.customReadMore.less : props.customReadMore.more;
|
|
65
|
+
} else {
|
|
66
|
+
const texts = {
|
|
67
|
+
more: { en: "Read more", fr: "Voir plus", es: "Ver m\xE1s" },
|
|
68
|
+
less: { en: "Read less", fr: "Voir moins", es: "Ver menos" }
|
|
69
|
+
};
|
|
70
|
+
return showMore.value ? texts.less[props.lang] : texts.more[props.lang];
|
|
71
|
+
}
|
|
72
|
+
});
|
|
73
|
+
function toggleMore() {
|
|
74
|
+
showMore.value = !showMore.value;
|
|
75
|
+
if (showMore.value) {
|
|
76
|
+
emit("onShowMore");
|
|
77
|
+
} else {
|
|
78
|
+
emit("onShowLess");
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
function escapeRegExp(str) {
|
|
82
|
+
return str.replace(/[.*+?^${}()|[\]\\]/g, "\\<script lang="ts">
|
|
83
|
+
import { onMounted, ref, computed, defineComponent } from "vue";
|
|
84
|
+
import argTextBtn from "./argTextBtn.vue";
|
|
85
|
+
|
|
86
|
+
export default defineComponent({
|
|
87
|
+
name: "localTextHighlight",
|
|
88
|
+
components: { argTextBtn },
|
|
89
|
+
props: {
|
|
90
|
+
text: {
|
|
91
|
+
type: String,
|
|
92
|
+
required: true,
|
|
93
|
+
},
|
|
94
|
+
queries: {
|
|
95
|
+
type: Array as () => string[],
|
|
96
|
+
default: null,
|
|
97
|
+
},
|
|
98
|
+
crop: {
|
|
99
|
+
type: Boolean,
|
|
100
|
+
default: false,
|
|
101
|
+
},
|
|
102
|
+
lines: {
|
|
103
|
+
type: Number,
|
|
104
|
+
default: 3,
|
|
105
|
+
},
|
|
106
|
+
haveReadMore: {
|
|
107
|
+
type: Boolean,
|
|
108
|
+
default: false,
|
|
109
|
+
},
|
|
110
|
+
id: {
|
|
111
|
+
type: String,
|
|
112
|
+
default: null,
|
|
113
|
+
},
|
|
114
|
+
customReadMore: {
|
|
115
|
+
type: Object as () => { more: string; less: string },
|
|
116
|
+
default: null,
|
|
117
|
+
},
|
|
118
|
+
lang: {
|
|
119
|
+
type: String as () => "en" | "fr" | "es",
|
|
120
|
+
default: "en",
|
|
121
|
+
validator: (value: string) => {
|
|
122
|
+
return ["en", "fr", "es"].includes(value);
|
|
123
|
+
},
|
|
124
|
+
},
|
|
125
|
+
},
|
|
126
|
+
emits: ["onShowMore", "onShowLess"],
|
|
127
|
+
setup(props, { emit }) {
|
|
128
|
+
const showMore = ref(false);
|
|
129
|
+
const indic = ref<HTMLElement | null>(null);
|
|
130
|
+
|
|
131
|
+
const getReadMore = computed(() => {
|
|
132
|
+
if (props.customReadMore !== null) {
|
|
133
|
+
return showMore.value
|
|
134
|
+
? props.customReadMore.less
|
|
135
|
+
: props.customReadMore.more;
|
|
136
|
+
} else {
|
|
137
|
+
const texts = {
|
|
138
|
+
more: { en: "Read more", fr: "Voir plus", es: "Ver más" },
|
|
139
|
+
less: { en: "Read less", fr: "Voir moins", es: "Ver menos" },
|
|
140
|
+
};
|
|
141
|
+
return showMore.value ? texts.less[props.lang] : texts.more[props.lang];
|
|
142
|
+
}
|
|
143
|
+
});
|
|
144
|
+
|
|
145
|
+
function toggleMore() {
|
|
146
|
+
showMore.value = !showMore.value;
|
|
147
|
+
|
|
148
|
+
if (showMore.value) {
|
|
149
|
+
emit("onShowMore");
|
|
150
|
+
} else {
|
|
151
|
+
emit("onShowLess");
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
function escapeRegExp(str: string) {
|
|
156
|
+
return str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
const needsMore = computed(() => {
|
|
160
|
+
const fullHeight = ref(0);
|
|
161
|
+
const originalHeight = ref(0);
|
|
162
|
+
|
|
163
|
+
if (indic.value !== null) {
|
|
164
|
+
indic.value.classList.remove("crop");
|
|
165
|
+
|
|
166
|
+
fullHeight.value = indic.value.clientHeight;
|
|
167
|
+
indic.value.classList.add("crop");
|
|
168
|
+
originalHeight.value = indic.value.clientHeight;
|
|
169
|
+
}
|
|
170
|
+
return fullHeight.value > originalHeight.value;
|
|
171
|
+
});
|
|
172
|
+
|
|
173
|
+
const renderText = computed(() => {
|
|
174
|
+
let returnText = props.text;
|
|
175
|
+
if (
|
|
176
|
+
props.queries !== null &&
|
|
177
|
+
props.queries.length > 0 &&
|
|
178
|
+
returnText !== null
|
|
179
|
+
) {
|
|
180
|
+
props.queries.forEach((word: string) => {
|
|
181
|
+
const regex = new RegExp(`\\b(${escapeRegExp(word)})\\b`, "gi");
|
|
182
|
+
returnText = returnText.replace(regex, (match: string) => {
|
|
183
|
+
if (match.toLowerCase() === "mark") {
|
|
184
|
+
return match;
|
|
185
|
+
}
|
|
186
|
+
return `<mark>${match}</mark>`;
|
|
187
|
+
});
|
|
188
|
+
});
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
return returnText;
|
|
192
|
+
});
|
|
193
|
+
|
|
194
|
+
onMounted(() => {
|
|
195
|
+
indic.value = document.getElementById(props.id);
|
|
196
|
+
});
|
|
197
|
+
|
|
198
|
+
return {
|
|
199
|
+
showMore,
|
|
200
|
+
needsMore,
|
|
201
|
+
renderText,
|
|
202
|
+
getReadMore,
|
|
203
|
+
toggleMore,
|
|
204
|
+
};
|
|
205
|
+
},
|
|
206
|
+
});
|
|
207
|
+
</script>");
|
|
208
|
+
}
|
|
209
|
+
const needsMore = computed(() => {
|
|
210
|
+
const fullHeight = ref(0);
|
|
211
|
+
const originalHeight = ref(0);
|
|
212
|
+
if (indic.value !== null) {
|
|
213
|
+
indic.value.classList.remove("crop");
|
|
214
|
+
fullHeight.value = indic.value.clientHeight;
|
|
215
|
+
indic.value.classList.add("crop");
|
|
216
|
+
originalHeight.value = indic.value.clientHeight;
|
|
217
|
+
}
|
|
218
|
+
return fullHeight.value > originalHeight.value;
|
|
219
|
+
});
|
|
220
|
+
const renderText = computed(() => {
|
|
221
|
+
let returnText = props.text;
|
|
222
|
+
if (props.queries !== null && props.queries.length > 0 && returnText !== null) {
|
|
223
|
+
props.queries.forEach((word) => {
|
|
224
|
+
const regex = new RegExp(`\\b(${escapeRegExp(word)})\\b`, "gi");
|
|
225
|
+
returnText = returnText.replace(regex, (match) => {
|
|
226
|
+
if (match.toLowerCase() === "mark") {
|
|
227
|
+
return match;
|
|
228
|
+
}
|
|
229
|
+
return `<mark>${match}</mark>`;
|
|
230
|
+
});
|
|
231
|
+
});
|
|
232
|
+
}
|
|
233
|
+
return returnText;
|
|
234
|
+
});
|
|
235
|
+
onMounted(() => {
|
|
236
|
+
indic.value = document.getElementById(props.id);
|
|
237
|
+
});
|
|
238
|
+
return {
|
|
239
|
+
showMore,
|
|
240
|
+
needsMore,
|
|
241
|
+
renderText,
|
|
242
|
+
getReadMore,
|
|
243
|
+
toggleMore
|
|
244
|
+
};
|
|
245
|
+
}
|
|
246
|
+
});
|
|
247
|
+
</script>
|
|
248
|
+
|
|
249
|
+
<style scoped>
|
|
250
|
+
.crop{display:-webkit-box;-webkit-box-orient:vertical;overflow:hidden}.crop_display{align-items:flex-start;display:flex;flex-direction:column;gap:8px}
|
|
251
|
+
</style>
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
declare const _default: import("vue").DefineComponent<{
|
|
2
|
+
text: {
|
|
3
|
+
type: StringConstructor;
|
|
4
|
+
required: true;
|
|
5
|
+
};
|
|
6
|
+
queries: {
|
|
7
|
+
type: () => string[];
|
|
8
|
+
default: null;
|
|
9
|
+
};
|
|
10
|
+
crop: {
|
|
11
|
+
type: BooleanConstructor;
|
|
12
|
+
default: boolean;
|
|
13
|
+
};
|
|
14
|
+
lines: {
|
|
15
|
+
type: NumberConstructor;
|
|
16
|
+
default: number;
|
|
17
|
+
};
|
|
18
|
+
haveReadMore: {
|
|
19
|
+
type: BooleanConstructor;
|
|
20
|
+
default: boolean;
|
|
21
|
+
};
|
|
22
|
+
id: {
|
|
23
|
+
type: StringConstructor;
|
|
24
|
+
default: null;
|
|
25
|
+
};
|
|
26
|
+
customReadMore: {
|
|
27
|
+
type: () => {
|
|
28
|
+
more: string;
|
|
29
|
+
less: string;
|
|
30
|
+
};
|
|
31
|
+
default: null;
|
|
32
|
+
};
|
|
33
|
+
lang: {
|
|
34
|
+
type: () => "en" | "fr" | "es";
|
|
35
|
+
default: string;
|
|
36
|
+
validator: (value: string) => boolean;
|
|
37
|
+
};
|
|
38
|
+
}, {
|
|
39
|
+
showMore: import("vue").Ref<boolean>;
|
|
40
|
+
needsMore: import("vue").ComputedRef<boolean>;
|
|
41
|
+
renderText: import("vue").ComputedRef<string>;
|
|
42
|
+
getReadMore: import("vue").ComputedRef<string>;
|
|
43
|
+
toggleMore: () => void;
|
|
44
|
+
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("onShowMore" | "onShowLess")[], "onShowMore" | "onShowLess", import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
45
|
+
text: {
|
|
46
|
+
type: StringConstructor;
|
|
47
|
+
required: true;
|
|
48
|
+
};
|
|
49
|
+
queries: {
|
|
50
|
+
type: () => string[];
|
|
51
|
+
default: null;
|
|
52
|
+
};
|
|
53
|
+
crop: {
|
|
54
|
+
type: BooleanConstructor;
|
|
55
|
+
default: boolean;
|
|
56
|
+
};
|
|
57
|
+
lines: {
|
|
58
|
+
type: NumberConstructor;
|
|
59
|
+
default: number;
|
|
60
|
+
};
|
|
61
|
+
haveReadMore: {
|
|
62
|
+
type: BooleanConstructor;
|
|
63
|
+
default: boolean;
|
|
64
|
+
};
|
|
65
|
+
id: {
|
|
66
|
+
type: StringConstructor;
|
|
67
|
+
default: null;
|
|
68
|
+
};
|
|
69
|
+
customReadMore: {
|
|
70
|
+
type: () => {
|
|
71
|
+
more: string;
|
|
72
|
+
less: string;
|
|
73
|
+
};
|
|
74
|
+
default: null;
|
|
75
|
+
};
|
|
76
|
+
lang: {
|
|
77
|
+
type: () => "en" | "fr" | "es";
|
|
78
|
+
default: string;
|
|
79
|
+
validator: (value: string) => boolean;
|
|
80
|
+
};
|
|
81
|
+
}>> & {
|
|
82
|
+
onOnShowMore?: ((...args: any[]) => any) | undefined;
|
|
83
|
+
onOnShowLess?: ((...args: any[]) => any) | undefined;
|
|
84
|
+
}, {
|
|
85
|
+
id: string;
|
|
86
|
+
lang: "en" | "fr" | "es";
|
|
87
|
+
queries: string[];
|
|
88
|
+
crop: boolean;
|
|
89
|
+
lines: number;
|
|
90
|
+
haveReadMore: boolean;
|
|
91
|
+
customReadMore: {
|
|
92
|
+
more: string;
|
|
93
|
+
less: string;
|
|
94
|
+
};
|
|
95
|
+
}, {}>;
|
|
96
|
+
export default _default;
|