@pushword/js-helper 0.0.132 → 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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pushword/js-helper",
3
- "version": "0.0.132",
3
+ "version": "0.0.136",
4
4
  "description": "Pushword front end helpers. ",
5
5
  "author": "Robin@PiedWeb <contact@piedweb.com>",
6
6
  "license": "MIT",
package/src/app.css CHANGED
@@ -5,7 +5,7 @@
5
5
  @import './utility.css'; /* node_modules/@pushword/js-helper/src/utility.css */
6
6
  /* @plugin "@tailwindcss/forms"; */
7
7
 
8
- @import './../node_modules/glightbox/dist/css/glightbox.css';
8
+ @import 'glightbox/dist/css/glightbox.css';
9
9
 
10
10
  /*
11
11
  Tailwind content sources for all packages
package/src/app.js CHANGED
@@ -37,5 +37,5 @@ function onPageLoaded() {
37
37
  onDomChanged()
38
38
  }
39
39
 
40
- document.addEventListener('DOMContentLoaded', onPageLoaded())
40
+ document.addEventListener('DOMContentLoaded', onPageLoaded)
41
41
  document.addEventListener('DOMChanged', onDomChanged)
package/src/clickable.js CHANGED
@@ -14,7 +14,10 @@ export async function clickable(element) {
14
14
  }
15
15
 
16
16
  if (link) {
17
- if (window.location.pathname.replace(/^\//, '') == link.pathname.replace(/^\//, '') && window.location.hostname == link.hostname) {
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 (location.pathname.replace(/^\//, '') == link.pathname.replace(/^\//, '') && location.hostname == link.hostname && link.hash != '') {
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 = target !== null ? target : document.querySelector('[name=' + link.hash.slice(1) + ']')
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
- var element = element.closest('[' + attribute + ']')
249
+ element = element.closest('[' + attribute + ']')
248
250
  }
249
251
  if (element === null || element.getAttribute(attribute) === null) return
250
252
  var link = document.createElement('a')
@@ -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]),