@pushword/js-helper 0.0.133 → 0.0.136
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/package.json +1 -1
- package/src/app.js +1 -1
- package/src/clickable.js +14 -4
- package/src/helpers.js +3 -1
- package/src/tailwind.prose.scss +10 -0
- package/src/utility.css +5 -0
package/package.json
CHANGED
package/src/app.js
CHANGED
package/src/clickable.js
CHANGED
|
@@ -14,7 +14,10 @@ export async function clickable(element) {
|
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
if (link) {
|
|
17
|
-
if (
|
|
17
|
+
if (
|
|
18
|
+
window.location.pathname.replace(/^\//, '') == link.pathname.replace(/^\//, '') &&
|
|
19
|
+
window.location.hostname == link.hostname
|
|
20
|
+
) {
|
|
18
21
|
if (typeof smoothScroll === 'function') {
|
|
19
22
|
smoothScroll(link)
|
|
20
23
|
}
|
|
@@ -41,7 +44,7 @@ export async function clickable(element) {
|
|
|
41
44
|
export function allClickable(selector) {
|
|
42
45
|
document.querySelectorAll(selector).forEach(function (item) {
|
|
43
46
|
item.addEventListener('click', function (event) {
|
|
44
|
-
if (event.ctrlKey || event.metaKey) return
|
|
47
|
+
if (event.ctrlKey || event.metaKey || event.button === 2) return
|
|
45
48
|
clickable(item)
|
|
46
49
|
})
|
|
47
50
|
})
|
|
@@ -54,9 +57,16 @@ export function allClickable(selector) {
|
|
|
54
57
|
* @param {Object} link
|
|
55
58
|
*/
|
|
56
59
|
export function smoothScroll(link, event = null) {
|
|
57
|
-
if (
|
|
60
|
+
if (
|
|
61
|
+
location.pathname.replace(/^\//, '') == link.pathname.replace(/^\//, '') &&
|
|
62
|
+
location.hostname == link.hostname &&
|
|
63
|
+
link.hash != ''
|
|
64
|
+
) {
|
|
58
65
|
var target = document.querySelector(link.hash)
|
|
59
|
-
target =
|
|
66
|
+
target =
|
|
67
|
+
target !== null
|
|
68
|
+
? target
|
|
69
|
+
: document.querySelector('[name=' + link.hash.slice(1) + ']')
|
|
60
70
|
if (target !== null) {
|
|
61
71
|
if (event !== null) event.preventDefault()
|
|
62
72
|
window.scrollTo({
|
package/src/helpers.js
CHANGED
|
@@ -68,6 +68,8 @@ export function liveBlock(liveBlockAttribute = 'live', liveFormSelector = '.live
|
|
|
68
68
|
}
|
|
69
69
|
|
|
70
70
|
var sendForm = function (form, liveFormBlock) {
|
|
71
|
+
if (liveFormBlock.dataset.submitting) return
|
|
72
|
+
liveFormBlock.dataset.submitting = '1'
|
|
71
73
|
setLoader(form)
|
|
72
74
|
|
|
73
75
|
var formData = new FormData(form.srcElement)
|
|
@@ -244,7 +246,7 @@ export async function uncloakLinks(
|
|
|
244
246
|
var convertLink = function (element) {
|
|
245
247
|
// fix "bug" with img
|
|
246
248
|
if (element.getAttribute(attribute) === null) {
|
|
247
|
-
|
|
249
|
+
element = element.closest('[' + attribute + ']')
|
|
248
250
|
}
|
|
249
251
|
if (element === null || element.getAttribute(attribute) === null) return
|
|
250
252
|
var link = document.createElement('a')
|
package/src/tailwind.prose.scss
CHANGED
|
@@ -31,6 +31,11 @@
|
|
|
31
31
|
color: #fff !important;
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
+
.link-btn:focus-visible {
|
|
35
|
+
outline: none;
|
|
36
|
+
box-shadow: 0 0 0 2px white, 0 0 0 4px var(--primary);
|
|
37
|
+
}
|
|
38
|
+
|
|
34
39
|
.link-btn-outline {
|
|
35
40
|
padding: 6px 12px;
|
|
36
41
|
margin-bottom: 0;
|
|
@@ -48,6 +53,11 @@
|
|
|
48
53
|
background-color: var(--primary);
|
|
49
54
|
}
|
|
50
55
|
|
|
56
|
+
.link-btn-outline:focus-visible {
|
|
57
|
+
outline: none;
|
|
58
|
+
box-shadow: 0 0 0 2px white, 0 0 0 4px var(--primary);
|
|
59
|
+
}
|
|
60
|
+
|
|
51
61
|
/**
|
|
52
62
|
* Some smoothiness
|
|
53
63
|
*/
|
package/src/utility.css
CHANGED
|
@@ -39,6 +39,11 @@
|
|
|
39
39
|
justify-content: safe center;
|
|
40
40
|
}
|
|
41
41
|
|
|
42
|
+
/* Prevent prose from overflowing viewport on small screens */
|
|
43
|
+
.prose {
|
|
44
|
+
max-width: min(65ch, 100%);
|
|
45
|
+
}
|
|
46
|
+
|
|
42
47
|
/* Typography customization */
|
|
43
48
|
.prose a:not(.not-prose a),
|
|
44
49
|
.prose span[data-rot]:not(.not-prose span[data-rot]),
|