paginar 0.2.0 → 0.2.1
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/demo/slot/slot-chapter1.html +150 -2
- package/dist/index.es.js +35 -25
- package/dist/index.es.js.map +1 -1
- package/dist/style.css +12 -8
- package/package.json +1 -1
- package/src/App.ce.vue +2 -0
- package/src/assets/main.css +2 -2
- package/src/components/FootnotesAside.vue +15 -14
- package/src/composables/useFootnotes.js +1 -1
- package/src/composables/useReferences.js +3 -1
- package/src/composables/useTextContent.js +6 -4
- package/src/tailwind.css +6 -2
package/dist/style.css
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
|
|
2
|
-
.width-enter-active[data-v-
|
|
3
|
-
.width-leave-active[data-v-
|
|
2
|
+
.width-enter-active[data-v-a72e8c45],
|
|
3
|
+
.width-leave-active[data-v-a72e8c45] {
|
|
4
4
|
transition: width .5s;
|
|
5
5
|
}
|
|
6
|
-
.width-enter-active>*[data-v-
|
|
6
|
+
.width-enter-active>*[data-v-a72e8c45] {
|
|
7
7
|
transition-property: opacity;
|
|
8
8
|
transition-duration: .2s;
|
|
9
9
|
transition-delay: .3s;
|
|
10
10
|
}
|
|
11
|
-
.width-leave-active>*[data-v-
|
|
11
|
+
.width-leave-active>*[data-v-a72e8c45] {
|
|
12
12
|
transition: opacity .25s;
|
|
13
13
|
}
|
|
14
|
-
.width-enter[data-v-
|
|
15
|
-
.width-leave-to[data-v-
|
|
14
|
+
.width-enter[data-v-a72e8c45],
|
|
15
|
+
.width-leave-to[data-v-a72e8c45] {
|
|
16
16
|
width: 0;
|
|
17
17
|
}
|
|
18
18
|
/*
|
|
@@ -647,8 +647,8 @@ video {
|
|
|
647
647
|
margin-bottom: 2rem;
|
|
648
648
|
}
|
|
649
649
|
|
|
650
|
-
.mb-
|
|
651
|
-
margin-bottom:
|
|
650
|
+
.mb-6 {
|
|
651
|
+
margin-bottom: 1.5rem;
|
|
652
652
|
}
|
|
653
653
|
|
|
654
654
|
.ml-4 {
|
|
@@ -1089,6 +1089,10 @@ video {
|
|
|
1089
1089
|
display: grid;
|
|
1090
1090
|
}
|
|
1091
1091
|
|
|
1092
|
+
.md\:w-\[40em\] {
|
|
1093
|
+
width: 40em;
|
|
1094
|
+
}
|
|
1095
|
+
|
|
1092
1096
|
.md\:w-2\/5 {
|
|
1093
1097
|
width: 40%;
|
|
1094
1098
|
}
|
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"description": "A flipping page web component for reading long texts on the brower",
|
|
5
5
|
"main": "dist/index.es.js",
|
|
6
6
|
"module": "dist/index.es.js",
|
|
7
|
-
"version": "0.2.
|
|
7
|
+
"version": "0.2.1",
|
|
8
8
|
"repository": {
|
|
9
9
|
"type": "git",
|
|
10
10
|
"url": "git+https://github.com/educkf/paginar.git"
|
package/src/App.ce.vue
CHANGED
|
@@ -58,10 +58,12 @@ onMounted(async () => {
|
|
|
58
58
|
watch(
|
|
59
59
|
props,
|
|
60
60
|
() => {
|
|
61
|
+
console.log(props)
|
|
61
62
|
if (props.hasOwnProperty('readerBlocked')) {
|
|
62
63
|
const readerBlocked = typeof props.readerBlocked === 'boolean'
|
|
63
64
|
? props.readerBlocked
|
|
64
65
|
: props.readerBlocked === 'true'
|
|
66
|
+
console.log(readerBlocked)
|
|
65
67
|
useReaderSettings.setBlocked(readerBlocked)
|
|
66
68
|
}
|
|
67
69
|
}
|
package/src/assets/main.css
CHANGED
|
@@ -133,8 +133,8 @@ header.wrapper {
|
|
|
133
133
|
}
|
|
134
134
|
|
|
135
135
|
#asidebar {
|
|
136
|
-
background: var(--
|
|
137
|
-
color: var(--
|
|
136
|
+
background: var(--sidebar-backgorund, #690000);
|
|
137
|
+
color: var(--sidebar-text, #f3f4f6);
|
|
138
138
|
}
|
|
139
139
|
|
|
140
140
|
/* slider */
|
|
@@ -14,20 +14,13 @@ const showFootnotes = computed(() => useFootnotes.showFootnotes.value)
|
|
|
14
14
|
const footnotes = computed(() => useFootnotes.footnotes.value)
|
|
15
15
|
|
|
16
16
|
const oldBlockedValue = ref(null)
|
|
17
|
+
const footnoteList = ref(null)
|
|
17
18
|
|
|
18
19
|
function hideAside() {
|
|
19
20
|
useFootnotes.setHighlightedFootnote(null)
|
|
20
21
|
useFootnotes.setShowFootnotes(false)
|
|
21
22
|
}
|
|
22
23
|
|
|
23
|
-
onMounted(() => {
|
|
24
|
-
if (footnote.value) {
|
|
25
|
-
var topPos = document.getElementById(footnote.value.id).offsetTop
|
|
26
|
-
document.getElementById('asidebar').scrollTop = topPos - 50
|
|
27
|
-
document.getElementById(footnote.value.id).focus()
|
|
28
|
-
}
|
|
29
|
-
})
|
|
30
|
-
|
|
31
24
|
onKeyStroke('Escape', () => {
|
|
32
25
|
if (footnote.value || showFootnotes.value) {
|
|
33
26
|
hideAside()
|
|
@@ -49,6 +42,14 @@ watch(
|
|
|
49
42
|
}
|
|
50
43
|
oldBlockedValue.value = null
|
|
51
44
|
}
|
|
45
|
+
|
|
46
|
+
if (footnote.value) {
|
|
47
|
+
setTimeout(() => {
|
|
48
|
+
const element = footnoteList.value.querySelector(`#${footnote.value.id}`)
|
|
49
|
+
element.scrollIntoView()
|
|
50
|
+
element.focus()
|
|
51
|
+
}, 50)
|
|
52
|
+
}
|
|
52
53
|
}
|
|
53
54
|
)
|
|
54
55
|
|
|
@@ -57,15 +58,15 @@ watch(
|
|
|
57
58
|
<template>
|
|
58
59
|
<transition name="width">
|
|
59
60
|
<div v-if="show || showFootnotes" id="asidebar"
|
|
60
|
-
class="absolute top-0 right-0 w-96 flex-shrink-0 h-screen overflow-auto overflow-x-hidden z-20 shadow-2xl"
|
|
61
|
+
class="absolute top-0 right-0 w-96 md:w-[40em] flex-shrink-0 h-screen overflow-auto overflow-x-hidden z-20 shadow-2xl"
|
|
61
62
|
>
|
|
62
63
|
<button @click.prevent="hideAside()" class="fixed top-4 right-8 z-20">
|
|
63
64
|
<IconClose class="w-6 h-6 text-white" />
|
|
64
65
|
</button>
|
|
65
66
|
|
|
66
|
-
<div class="w-
|
|
67
|
+
<div class="w-full p-4">
|
|
67
68
|
<header class="text-areia py-4 pl-4">
|
|
68
|
-
<div class="flex items-center mb-
|
|
69
|
+
<div class="flex items-center mb-6">
|
|
69
70
|
<IconNotes class="w-8 h-8" />
|
|
70
71
|
<span class="ml-4">
|
|
71
72
|
|
|
@@ -78,10 +79,10 @@ watch(
|
|
|
78
79
|
</header>
|
|
79
80
|
|
|
80
81
|
<section>
|
|
81
|
-
<ul>
|
|
82
|
+
<ul ref="footnoteList">
|
|
82
83
|
<li v-for="(footnoteItem, index) in footnotes"
|
|
83
|
-
:key="footnoteItem.
|
|
84
|
-
:id="footnoteItem.
|
|
84
|
+
:key="footnoteItem.id"
|
|
85
|
+
:id="footnoteItem.id"
|
|
85
86
|
v-html="`<span class='footnote-index'>${index + 1}.</span> ${footnoteItem.text}`"
|
|
86
87
|
class="text-left border-b border-b-white/25 last:border-transparent
|
|
87
88
|
pb-10 mt-10 px-10 relative
|
|
@@ -22,7 +22,7 @@ function setHighlightedFootnote(footnote) {
|
|
|
22
22
|
}
|
|
23
23
|
|
|
24
24
|
function applyFootnote(event) {
|
|
25
|
-
const classList = event.target.classList.value.split(' ')
|
|
25
|
+
const classList = event.target.closest('.footnote')?.classList.value.split(' ')
|
|
26
26
|
|
|
27
27
|
if (classList.length === 0)
|
|
28
28
|
return
|
|
@@ -37,7 +37,9 @@ function applyReferences(contentRaw) {
|
|
|
37
37
|
}
|
|
38
38
|
|
|
39
39
|
function applyReference(event) {
|
|
40
|
-
const
|
|
40
|
+
const target = event.target.closest('.reference')?.getAttribute("data-ref")
|
|
41
|
+
|
|
42
|
+
const ref = state.references.find(item => target && item.cit === target)
|
|
41
43
|
if (ref) {
|
|
42
44
|
state.reference = ref
|
|
43
45
|
}
|
|
@@ -32,14 +32,16 @@ async function initContent(contentString, contentWrapper) {
|
|
|
32
32
|
// if content comes from file, apply references to file
|
|
33
33
|
if (content?.summary?.[0]?.file) {
|
|
34
34
|
const text = await getContent(content.summary?.[0]?.file)
|
|
35
|
-
const newContent = applyReferences
|
|
35
|
+
const newContent = content.applyReferences
|
|
36
|
+
? applyReferences(text)
|
|
37
|
+
: text
|
|
36
38
|
state.content = newContent
|
|
37
39
|
|
|
38
40
|
// else if content comes from slot, apply references to slot
|
|
39
41
|
} else {
|
|
40
42
|
const content = document.querySelectorAll('[slot="content"]')
|
|
41
43
|
|
|
42
|
-
if (content && content?.[0]?.innerHTML) {
|
|
44
|
+
if (content && content?.[0]?.innerHTML && content.applyReferences) {
|
|
43
45
|
const newContent = applyReferences(content?.[0]?.innerHTML)
|
|
44
46
|
if (newContent) {
|
|
45
47
|
content[0].innerHTML = newContent
|
|
@@ -75,11 +77,11 @@ function listenToClicks(contentWrapper) {
|
|
|
75
77
|
}
|
|
76
78
|
|
|
77
79
|
function getClickedReferenceData(event) {
|
|
78
|
-
if (event.target.
|
|
80
|
+
if (event.target.closest('.reference')) {
|
|
79
81
|
useReferences.applyReference(event)
|
|
80
82
|
}
|
|
81
83
|
|
|
82
|
-
if (event.target.
|
|
84
|
+
if (event.target.closest('.footnote')) {
|
|
83
85
|
useFootnotes.applyFootnote(event)
|
|
84
86
|
}
|
|
85
87
|
}
|
package/src/tailwind.css
CHANGED
|
@@ -630,8 +630,8 @@ video {
|
|
|
630
630
|
margin-bottom: 2rem;
|
|
631
631
|
}
|
|
632
632
|
|
|
633
|
-
.mb-
|
|
634
|
-
margin-bottom:
|
|
633
|
+
.mb-6 {
|
|
634
|
+
margin-bottom: 1.5rem;
|
|
635
635
|
}
|
|
636
636
|
|
|
637
637
|
.ml-4 {
|
|
@@ -1072,6 +1072,10 @@ video {
|
|
|
1072
1072
|
display: grid;
|
|
1073
1073
|
}
|
|
1074
1074
|
|
|
1075
|
+
.md\:w-\[40em\] {
|
|
1076
|
+
width: 40em;
|
|
1077
|
+
}
|
|
1078
|
+
|
|
1075
1079
|
.md\:w-2\/5 {
|
|
1076
1080
|
width: 40%;
|
|
1077
1081
|
}
|