@pushword/js-helper 0.0.121 → 0.0.123
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 +9 -24
- package/src/FilesToWatch.js +11 -0
- package/src/HorizontalScroll.js +24 -9
- package/src/app.css +83 -4
- package/src/app.js +15 -4
- package/src/encore.js +16 -17
- package/src/helpers.js +79 -55
- package/src/tailwind.config.js +0 -38
- package/src/tailwind.helpers.js +0 -57
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pushword/js-helper",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.123",
|
|
4
4
|
"description": "Pushword front end helpers. ",
|
|
5
5
|
"author": "Robin@PiedWeb <contact@piedweb.com>",
|
|
6
6
|
"license": "MIT",
|
|
@@ -8,33 +8,18 @@
|
|
|
8
8
|
"prettier": "prettier ./src/*.{js,scss} --write"
|
|
9
9
|
},
|
|
10
10
|
"dependencies": {
|
|
11
|
-
"
|
|
12
|
-
"@
|
|
13
|
-
"
|
|
14
|
-
"
|
|
15
|
-
"@tailwindcss/aspect-ratio": "^0.4",
|
|
16
|
-
"@tailwindcss/forms": "^0.5",
|
|
11
|
+
"vite": "^7.1.12",
|
|
12
|
+
"@tailwindcss/vite": "^4.1.16",
|
|
13
|
+
"vite-plugin-static-copy": "^3.1.4",
|
|
14
|
+
"vite-plugin-symfony": "^8.2.2",
|
|
17
15
|
"@tailwindcss/typography": "^0.5",
|
|
18
|
-
"
|
|
19
|
-
"
|
|
16
|
+
"tailwindcss-animated": "^2",
|
|
17
|
+
"@tailwindcss/forms": "^0.5",
|
|
18
|
+
"140.css": "^1.0.1",
|
|
20
19
|
"codemirror": "^6.0",
|
|
21
20
|
"core-js": "^3.38",
|
|
22
21
|
"easymde": "^2.18",
|
|
23
|
-
"
|
|
24
|
-
"fslightbox": "^3.2.2",
|
|
25
|
-
"postcss": "^8.4",
|
|
26
|
-
"postcss-import": "^16",
|
|
27
|
-
"postcss-loader": "^8",
|
|
28
|
-
"sass": "^1.68",
|
|
29
|
-
"sass-loader": "^16",
|
|
30
|
-
"simple-jekyll-search": "^1.9.1",
|
|
31
|
-
"tailwindcss": "^3",
|
|
32
|
-
"tailwindcss-animated": "^2",
|
|
33
|
-
"tailwindcss-hero-patterns": "^0.1",
|
|
34
|
-
"tailwindcss-multi-column": "^1.0.2",
|
|
35
|
-
"webpack": "^5.94",
|
|
36
|
-
"webpack-cli": "^4.9.1 || ^5.0.1",
|
|
37
|
-
"webpack-watch-files-plugin": "^1.1.0"
|
|
22
|
+
"glightbox": "^3.3"
|
|
38
23
|
},
|
|
39
24
|
"repository": {
|
|
40
25
|
"type": "git",
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export default function getFilesToWatch(basePath = './..') {
|
|
2
|
+
return [
|
|
3
|
+
basePath + '/vendor/pushword/core/src/templates/**/*.html.twig',
|
|
4
|
+
basePath + '/vendor/pushword/conversation/src/templates/**/*.html.twig',
|
|
5
|
+
basePath + '/vendor/pushword/admin-block-editor/src/templates/**/*.html.twig',
|
|
6
|
+
basePath + '/vendor/pushword/advanced-main-image/src/templates/**/*.html.twig',
|
|
7
|
+
basePath + '/templates/**/*.html.twig',
|
|
8
|
+
basePath + '/var/TailwindGeneratorCache/*',
|
|
9
|
+
basePath + '/src/Twig/AppExtension.php',
|
|
10
|
+
]
|
|
11
|
+
}
|
package/src/HorizontalScroll.js
CHANGED
|
@@ -5,9 +5,14 @@ class HorizontalScroll {
|
|
|
5
5
|
this.scroller =
|
|
6
6
|
scrollerSelectorOrContainer instanceof HTMLElement
|
|
7
7
|
? scrollerSelectorOrContainer
|
|
8
|
-
: document.querySelector(
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
: document.querySelector(
|
|
9
|
+
scrollerSelectorOrContainer || selectorToFindElementToScroll + '-scroller',
|
|
10
|
+
)
|
|
11
|
+
this.scrollWidth =
|
|
12
|
+
this.scrollContainer.offsetWidth +
|
|
13
|
+
parseInt(window.getComputedStyle(this.scrollContainer).marginLeft)
|
|
14
|
+
this.scrollContainerWidth =
|
|
15
|
+
this.elementToScroll.scrollWidth - this.elementToScroll.clientWidth
|
|
11
16
|
}
|
|
12
17
|
|
|
13
18
|
init() {
|
|
@@ -33,11 +38,21 @@ class HorizontalScroll {
|
|
|
33
38
|
}
|
|
34
39
|
|
|
35
40
|
scroll(scrollerClassToToggle = 'opacity-50') {
|
|
36
|
-
const isRightScroll =
|
|
37
|
-
|
|
41
|
+
const isRightScroll =
|
|
42
|
+
window.event.target == this.scroller.children[1] ||
|
|
43
|
+
window.event.target.parentNode == this.scroller.children[1]
|
|
44
|
+
const scrollPos = isRightScroll
|
|
45
|
+
? (this.elementToScroll.scrollLeft += this.scrollWidth)
|
|
46
|
+
: (this.elementToScroll.scrollLeft -= this.scrollWidth)
|
|
38
47
|
|
|
39
|
-
this.scroller.children[1].classList.toggle(
|
|
40
|
-
|
|
48
|
+
this.scroller.children[1].classList.toggle(
|
|
49
|
+
scrollerClassToToggle,
|
|
50
|
+
scrollPos >= this.scrollContainerWidth,
|
|
51
|
+
)
|
|
52
|
+
this.scroller.children[1].classList.toggle(
|
|
53
|
+
'cursor-pointer',
|
|
54
|
+
scrollPos < this.scrollContainerWidth,
|
|
55
|
+
)
|
|
41
56
|
this.scroller.children[0].classList.toggle(scrollerClassToToggle, scrollPos <= 0)
|
|
42
57
|
this.scroller.children[0].classList.toggle('cursor-pointer', scrollPos > 0)
|
|
43
58
|
}
|
|
@@ -89,10 +104,10 @@ class HorizontalScroll {
|
|
|
89
104
|
</div>
|
|
90
105
|
</div>
|
|
91
106
|
<div id="toScroll2-scroller" class="hidden" onclick="(new HorizontalScroll('#toScroll2', this)).scroll('hidden')">
|
|
92
|
-
<div class="hidden cursor-default cursor-pointer bg-white px-2 text-2xl text-gray-600 white bg-
|
|
107
|
+
<div class="hidden cursor-default cursor-pointer bg-white px-2 text-2xl text-gray-600 white bg-white/50
|
|
93
108
|
absolute h-full top-0 left-0 flex items-center"><span>❮</span></div>
|
|
94
109
|
<div class="cursor-default cursor-pointer bg-white px-2 text-2xl text-gray-600
|
|
95
|
-
absolute h-full top-0 right-0 flex items-center bg-
|
|
110
|
+
absolute h-full top-0 right-0 flex items-center bg-white/50"><span>❯</span></div>
|
|
96
111
|
</div>
|
|
97
112
|
<script>document.addEventListener('DOMContentLoaded', function() {
|
|
98
113
|
(new HorizontalScroll('#toScroll2')).init().activateWheelScroll();
|
package/src/app.css
CHANGED
|
@@ -1,4 +1,83 @@
|
|
|
1
|
-
@import
|
|
2
|
-
|
|
3
|
-
@import
|
|
4
|
-
|
|
1
|
+
@import 'tailwindcss';
|
|
2
|
+
|
|
3
|
+
@import 'tailwindcss-animated';
|
|
4
|
+
|
|
5
|
+
@plugin '@tailwindcss/typography';
|
|
6
|
+
/* @plugin "@tailwindcss/forms"; */
|
|
7
|
+
|
|
8
|
+
/*
|
|
9
|
+
Tailwind content sources for all packages
|
|
10
|
+
-----------------------------------------
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
@source "./../../../../vendor/pushword/**/templates/";
|
|
14
|
+
@source "./../../**/templates/";
|
|
15
|
+
@source "./../../../../templates";
|
|
16
|
+
@source "./../../../../var/TailwindGeneratorCache/*";
|
|
17
|
+
@source "./../../../../vendor/pushword/core/src/Twig/**.php";
|
|
18
|
+
@source "./../../core/src/Twig/**.php";
|
|
19
|
+
@source "./../../../../vendor/pushword/admin/src/templates/markdown_cheatsheet.html.twig";
|
|
20
|
+
@source "./../../admin/src/templates/markdown_cheatsheet.html.twig";
|
|
21
|
+
|
|
22
|
+
/* Tailwind v4 CSS-first configuration */
|
|
23
|
+
@theme {
|
|
24
|
+
/* Custom minHeight values */
|
|
25
|
+
--min-height-screen-1-4: 25vh;
|
|
26
|
+
--min-height-screen-3-4: 75vh;
|
|
27
|
+
--min-height-screen-1-3: 33vh;
|
|
28
|
+
--min-height-screen-2-3: 66vh;
|
|
29
|
+
--min-height-screen-1-2: 50vh;
|
|
30
|
+
|
|
31
|
+
/* Custom colors */
|
|
32
|
+
--color-primary: var(--primary);
|
|
33
|
+
--color-secondary: var(--secondary);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/* Custom variants for first-letter */
|
|
37
|
+
@variant first-letter (&:first-letter);
|
|
38
|
+
|
|
39
|
+
/* Custom variants for first-child */
|
|
40
|
+
@variant first-child (&:first-child);
|
|
41
|
+
|
|
42
|
+
/* Custom utilities - Bleed plugin replacement */
|
|
43
|
+
@utility bleed {
|
|
44
|
+
width: 100vw;
|
|
45
|
+
margin-inline-start: 50%;
|
|
46
|
+
margin-inline-end: unset;
|
|
47
|
+
transform: translateX(-50%);
|
|
48
|
+
max-width: none;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
@utility bleed-disable {
|
|
52
|
+
width: inherit;
|
|
53
|
+
margin-inline-start: inherit;
|
|
54
|
+
margin-inline-end: inherit;
|
|
55
|
+
transform: default;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/* Custom utilities - Justify safe center */
|
|
59
|
+
@utility justify-safe-center {
|
|
60
|
+
justify-content: safe center;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/* Typography customization */
|
|
64
|
+
.prose a:not(.not-prose a),
|
|
65
|
+
.prose span[data-rot]:not(.not-prose span[data-rot]),
|
|
66
|
+
.prose .link:not(.not-prose .link) {
|
|
67
|
+
text-decoration: none;
|
|
68
|
+
color: var(--primary);
|
|
69
|
+
font-weight: 500;
|
|
70
|
+
border-bottom: 1px solid;
|
|
71
|
+
}
|
|
72
|
+
.prose a:hover:not(.not-prose a:hover),
|
|
73
|
+
.prose span[data-rot]:hover:not(.not-prose span[data-rot]:hover),
|
|
74
|
+
.prose .link:hover:not(.not-prose .link:hover) {
|
|
75
|
+
opacity: 0.75;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
.img-stretched {
|
|
79
|
+
@apply w-screen relative left-1/2 right-1/2 mr-[-50vw] ml-[-50vw];
|
|
80
|
+
}
|
|
81
|
+
.img-background {
|
|
82
|
+
@apply px-6 sm:px-12 py-1 text-center bg-gray-200 rounded;
|
|
83
|
+
}
|
package/src/app.js
CHANGED
|
@@ -1,17 +1,28 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
1
|
+
import Glightbox from 'glightbox'
|
|
2
|
+
import {
|
|
3
|
+
uncloakLinks,
|
|
4
|
+
addClassForNormalUser,
|
|
5
|
+
readableEmail,
|
|
6
|
+
convertImageLinkToWebPLink,
|
|
7
|
+
replaceOn,
|
|
8
|
+
liveBlock,
|
|
9
|
+
convertFormFromRot13,
|
|
10
|
+
} from './helpers.js'
|
|
3
11
|
import { allClickable } from './clickable.js'
|
|
4
12
|
|
|
5
13
|
//import { HorizontalScroll } from '@pushword/js-helper/src/horizontalScroll.js';
|
|
6
14
|
//window.HorizontalScroll = HorizontalScroll;
|
|
7
15
|
|
|
16
|
+
let lightbox
|
|
8
17
|
function onDomChanged() {
|
|
9
18
|
liveBlock()
|
|
10
19
|
convertImageLinkToWebPLink()
|
|
11
20
|
uncloakLinks()
|
|
12
21
|
readableEmail('.cea')
|
|
13
22
|
replaceOn()
|
|
14
|
-
|
|
23
|
+
if (lightbox) {
|
|
24
|
+
lightbox.reload()
|
|
25
|
+
}
|
|
15
26
|
allClickable('.clickable')
|
|
16
27
|
addClassForNormalUser()
|
|
17
28
|
convertFormFromRot13()
|
|
@@ -19,7 +30,7 @@ function onDomChanged() {
|
|
|
19
30
|
|
|
20
31
|
function onPageLoaded() {
|
|
21
32
|
onDomChanged()
|
|
22
|
-
new
|
|
33
|
+
lightbox = new Glightbox()
|
|
23
34
|
}
|
|
24
35
|
|
|
25
36
|
document.addEventListener('DOMContentLoaded', onPageLoaded())
|
package/src/encore.js
CHANGED
|
@@ -1,26 +1,19 @@
|
|
|
1
|
+
// @deprecated use vite instead
|
|
2
|
+
|
|
1
3
|
const WatchExternalFilesPlugin = require('webpack-watch-files-plugin').default
|
|
2
4
|
const tailwindcss = require('tailwindcss')
|
|
3
5
|
const postcssImport = require('postcss-import')
|
|
4
6
|
const autoprefixer = require('autoprefixer')
|
|
5
7
|
const Encore = require('@symfony/webpack-encore')
|
|
6
|
-
|
|
7
|
-
function getFilesToWatch(basePath = './..') {
|
|
8
|
-
return [
|
|
9
|
-
basePath + '/vendor/pushword/core/src/templates/**/*.html.twig',
|
|
10
|
-
basePath + '/vendor/pushword/conversation/src/templates/**/*.html.twig',
|
|
11
|
-
basePath + '/vendor/pushword/admin-block-editor/src/templates/**/*.html.twig',
|
|
12
|
-
basePath + '/vendor/pushword/advanced-main-image/src/templates/**/*.html.twig',
|
|
13
|
-
basePath + '/templates/**/*.html.twig',
|
|
14
|
-
basePath + '/var/TailwindGeneratorCache/*',
|
|
15
|
-
basePath + '/src/Twig/AppExtension.php',
|
|
16
|
-
]
|
|
17
|
-
}
|
|
8
|
+
const getFilesToWatch = require('./FilesToWatch')
|
|
18
9
|
|
|
19
10
|
function getTailwindConfig(watchFiles = null) {
|
|
11
|
+
// Tailwind v4 CSS-first: configuration is now handled in CSS files
|
|
12
|
+
// Return a minimal config for content watching only
|
|
20
13
|
if (watchFiles === null) watchFiles = getFilesToWatch()
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
14
|
+
return {
|
|
15
|
+
content: watchFiles,
|
|
16
|
+
}
|
|
24
17
|
}
|
|
25
18
|
|
|
26
19
|
/**
|
|
@@ -76,7 +69,7 @@ function getEncore(
|
|
|
76
69
|
)
|
|
77
70
|
.enablePostCssLoader((options) => {
|
|
78
71
|
options.postcssOptions = {
|
|
79
|
-
plugins: [
|
|
72
|
+
plugins: [require('@tailwindcss/postcss')],
|
|
80
73
|
}
|
|
81
74
|
})
|
|
82
75
|
.disableSingleRuntimeChunk()
|
|
@@ -111,7 +104,13 @@ function getEncore(
|
|
|
111
104
|
if (!isLegacy) {
|
|
112
105
|
Encore.configureBabelPresetEnv((config) => {
|
|
113
106
|
config.targets = {
|
|
114
|
-
browsers: [
|
|
107
|
+
browsers: [
|
|
108
|
+
'Chrome >= 60',
|
|
109
|
+
'Safari >= 10.1',
|
|
110
|
+
'iOS >= 10.3',
|
|
111
|
+
'Firefox >= 54',
|
|
112
|
+
'Edge >= 15',
|
|
113
|
+
],
|
|
115
114
|
}
|
|
116
115
|
})
|
|
117
116
|
} else {
|
package/src/helpers.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import 'core-js/stable'
|
|
2
|
-
import 'regenerator-runtime/runtime'
|
|
2
|
+
//import 'regenerator-runtime/runtime'
|
|
3
3
|
/**
|
|
4
4
|
* List of all functions
|
|
5
5
|
*
|
|
@@ -33,7 +33,9 @@ export function liveBlock(liveBlockAttribute = 'live', liveFormSelector = '.live
|
|
|
33
33
|
|
|
34
34
|
var getLiveBlock = function (item) {
|
|
35
35
|
var url = item.getAttribute('data-' + liveBlockAttribute)
|
|
36
|
-
url = url.startsWith('e:')
|
|
36
|
+
url = url.startsWith('e:')
|
|
37
|
+
? convertShortchutForLink(rot13ToText(url.substring(2)))
|
|
38
|
+
: url
|
|
37
39
|
fetch(url, {
|
|
38
40
|
//headers: { "Content-Type": "application/json", Accept: "text/plain" },
|
|
39
41
|
method: 'POST',
|
|
@@ -51,8 +53,10 @@ export function liveBlock(liveBlockAttribute = 'live', liveFormSelector = '.live
|
|
|
51
53
|
})
|
|
52
54
|
}
|
|
53
55
|
|
|
54
|
-
const spinner =
|
|
55
|
-
|
|
56
|
+
const spinner =
|
|
57
|
+
'<span style="border-top-color: transparent" class="inline-block w-5 h-5 border-4 border-gray-50 border-solid rounded-full animate-spin"></span>'
|
|
58
|
+
const htmlLoader =
|
|
59
|
+
'<div>' + spinner.replace('border-gray-50', 'border-gray-800') + '</div>'
|
|
56
60
|
|
|
57
61
|
var setLoader = function (form) {
|
|
58
62
|
var $submitButton = getSubmitButton(form)
|
|
@@ -94,12 +98,12 @@ export function liveBlock(liveBlockAttribute = 'live', liveFormSelector = '.live
|
|
|
94
98
|
}
|
|
95
99
|
|
|
96
100
|
// Listen data-live
|
|
97
|
-
document.querySelectorAll('[
|
|
101
|
+
document.querySelectorAll('[data-' + liveBlockAttribute + ']').forEach((item) => {
|
|
98
102
|
getLiveBlock(item)
|
|
99
103
|
})
|
|
100
104
|
|
|
101
105
|
// Listen button src-data-live / data-src-live
|
|
102
|
-
document.querySelectorAll('[
|
|
106
|
+
document.querySelectorAll('[data-src-' + liveBlockAttribute + ']').forEach((item) => {
|
|
103
107
|
item.addEventListener('click', (event) => {
|
|
104
108
|
if (item.tagName == 'BUTTON') {
|
|
105
109
|
item.innerHTML = spinner
|
|
@@ -127,7 +131,11 @@ export function liveBlock(liveBlockAttribute = 'live', liveFormSelector = '.live
|
|
|
127
131
|
export function replaceOn(attribute = 'data-replaceBy', eventName = 'click') {
|
|
128
132
|
var loadVideo = function (element) {
|
|
129
133
|
var content = element.getAttribute(attribute)
|
|
130
|
-
if (
|
|
134
|
+
if (
|
|
135
|
+
element.classList.contains('hero-banner-overlay-lg') &&
|
|
136
|
+
element.querySelector('picture') &&
|
|
137
|
+
window.innerWidth < 992
|
|
138
|
+
) {
|
|
131
139
|
element.querySelector('picture').outerHTML = content
|
|
132
140
|
element.querySelector('.btn-play').outerHTML = ' '
|
|
133
141
|
} else {
|
|
@@ -140,17 +148,19 @@ export function replaceOn(attribute = 'data-replaceBy', eventName = 'click') {
|
|
|
140
148
|
document.dispatchEvent(new Event('DOMChanged'))
|
|
141
149
|
}
|
|
142
150
|
|
|
143
|
-
document
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
151
|
+
document
|
|
152
|
+
.querySelectorAll('[' + attribute + ']:not([listen])')
|
|
153
|
+
.forEach(function (element) {
|
|
154
|
+
element.setAttribute('listen', '')
|
|
155
|
+
element.addEventListener(
|
|
156
|
+
eventName,
|
|
157
|
+
function (event) {
|
|
158
|
+
loadVideo(event.currentTarget) //event.currentTarget;
|
|
159
|
+
element.removeAttribute('listen')
|
|
160
|
+
},
|
|
161
|
+
{ once: true },
|
|
162
|
+
)
|
|
163
|
+
})
|
|
154
164
|
}
|
|
155
165
|
|
|
156
166
|
/**
|
|
@@ -201,15 +211,18 @@ export function addClassForNormalUser(attribute = 'data-acinb') {
|
|
|
201
211
|
}
|
|
202
212
|
if (startScrolling === 4) {
|
|
203
213
|
document.removeEventListener('scroll', scrollEventAddClassHandler)
|
|
204
|
-
;[].forEach.call(
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
element.classList.
|
|
211
|
-
|
|
212
|
-
|
|
214
|
+
;[].forEach.call(
|
|
215
|
+
document.querySelectorAll('[' + attribute + ']'),
|
|
216
|
+
function (element) {
|
|
217
|
+
var classToAddRaw = element.getAttribute(attribute)
|
|
218
|
+
var classToAdd = classToAddRaw.split(' ')
|
|
219
|
+
element.removeAttribute(attribute)
|
|
220
|
+
element.classList.add(...classToAdd)
|
|
221
|
+
if (classToAdd.includes('block')) {
|
|
222
|
+
element.classList.remove('hidden')
|
|
223
|
+
}
|
|
224
|
+
},
|
|
225
|
+
)
|
|
213
226
|
if (window.location.hash) {
|
|
214
227
|
const targetElement = document.querySelector(window.location.hash)
|
|
215
228
|
if (targetElement) {
|
|
@@ -233,7 +246,10 @@ export function addClassForNormalUser(attribute = 'data-acinb') {
|
|
|
233
246
|
*
|
|
234
247
|
* @param {string} attribute
|
|
235
248
|
*/
|
|
236
|
-
export async function uncloakLinks(
|
|
249
|
+
export async function uncloakLinks(
|
|
250
|
+
attribute = 'data-rot',
|
|
251
|
+
onClickMouseoverOrTouchstart = true,
|
|
252
|
+
) {
|
|
237
253
|
var convertLink = function (element) {
|
|
238
254
|
// fix "bug" with img
|
|
239
255
|
if (element.getAttribute(attribute) === null) {
|
|
@@ -253,9 +269,12 @@ export async function uncloakLinks(attribute = 'data-rot', onClickMouseoverOrTou
|
|
|
253
269
|
}
|
|
254
270
|
|
|
255
271
|
var convertAll = function (attribute) {
|
|
256
|
-
;[].forEach.call(
|
|
257
|
-
|
|
258
|
-
|
|
272
|
+
;[].forEach.call(
|
|
273
|
+
document.querySelectorAll('[' + attribute + ']'),
|
|
274
|
+
function (element) {
|
|
275
|
+
convertLink(element)
|
|
276
|
+
},
|
|
277
|
+
)
|
|
259
278
|
}
|
|
260
279
|
|
|
261
280
|
var fireEventLinksBuilt = async function (element, event) {
|
|
@@ -277,29 +296,32 @@ export async function uncloakLinks(attribute = 'data-rot', onClickMouseoverOrTou
|
|
|
277
296
|
}
|
|
278
297
|
|
|
279
298
|
if (onClickMouseoverOrTouchstart) {
|
|
280
|
-
;[].forEach.call(
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
299
|
+
;[].forEach.call(
|
|
300
|
+
document.querySelectorAll('[' + attribute + ']'),
|
|
301
|
+
function (element) {
|
|
302
|
+
element.addEventListener(
|
|
303
|
+
'touchstart',
|
|
304
|
+
function (e) {
|
|
305
|
+
convertLinkOnEvent(e)
|
|
306
|
+
},
|
|
307
|
+
{ once: true, passive: true },
|
|
308
|
+
)
|
|
309
|
+
element.addEventListener(
|
|
310
|
+
'click',
|
|
311
|
+
function (e) {
|
|
312
|
+
convertLinkOnEvent(e)
|
|
313
|
+
},
|
|
314
|
+
{ once: true },
|
|
315
|
+
)
|
|
316
|
+
element.addEventListener(
|
|
317
|
+
'mouseover',
|
|
318
|
+
function (e) {
|
|
319
|
+
convertLinkOnEvent(e)
|
|
320
|
+
},
|
|
321
|
+
{ once: true },
|
|
322
|
+
)
|
|
323
|
+
},
|
|
324
|
+
)
|
|
303
325
|
} else convertAll(attribute)
|
|
304
326
|
}
|
|
305
327
|
|
|
@@ -352,7 +374,9 @@ export function readableEmail(selector) {
|
|
|
352
374
|
*/
|
|
353
375
|
export function rot13ToText(str) {
|
|
354
376
|
return str.replace(/[a-zA-Z]/g, function (c) {
|
|
355
|
-
return String.fromCharCode(
|
|
377
|
+
return String.fromCharCode(
|
|
378
|
+
(c <= 'Z' ? 90 : 122) >= (c = c.charCodeAt(0) + 13) ? c : c - 26,
|
|
379
|
+
)
|
|
356
380
|
})
|
|
357
381
|
}
|
|
358
382
|
|
package/src/tailwind.config.js
DELETED
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
const plugin = require('tailwindcss/plugin');
|
|
2
|
-
const pushwordHelper = require('./tailwind.helpers.js');
|
|
3
|
-
|
|
4
|
-
module.exports = {
|
|
5
|
-
mode: 'jit',
|
|
6
|
-
theme: {
|
|
7
|
-
minHeight: {
|
|
8
|
-
0: '0',
|
|
9
|
-
'screen-1/4': '25vh',
|
|
10
|
-
'screen-3/4': '75vh',
|
|
11
|
-
'screen-1/3': '33vh',
|
|
12
|
-
'screen-2/3': '66vh',
|
|
13
|
-
'screen-1/2': '50vh',
|
|
14
|
-
screen: '100vh',
|
|
15
|
-
full: '100%',
|
|
16
|
-
},
|
|
17
|
-
extend: {
|
|
18
|
-
typography: pushwordHelper.extendTailwindTypography(),
|
|
19
|
-
colors: {
|
|
20
|
-
primary: 'var(--primary)',
|
|
21
|
-
secondary: 'var(--secondary)',
|
|
22
|
-
},
|
|
23
|
-
},
|
|
24
|
-
},
|
|
25
|
-
variants: {},
|
|
26
|
-
plugins: [
|
|
27
|
-
require('tailwindcss-multi-column')(),
|
|
28
|
-
require('@tailwindcss/typography'),
|
|
29
|
-
require('@tailwindcss/aspect-ratio'),
|
|
30
|
-
require('@tailwindcss/forms'),
|
|
31
|
-
require('tailwindcss-animated'),
|
|
32
|
-
require('tailwindcss-hero-patterns'),
|
|
33
|
-
plugin(pushwordHelper.twFirstLetterPlugin),
|
|
34
|
-
plugin(pushwordHelper.twFirstChildPlugin),
|
|
35
|
-
plugin(pushwordHelper.twBleedPlugin),
|
|
36
|
-
plugin(pushwordHelper.justifySafeCenterPlugin),
|
|
37
|
-
],
|
|
38
|
-
};
|
package/src/tailwind.helpers.js
DELETED
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
module.exports = {
|
|
2
|
-
extendTailwindTypography: function () {
|
|
3
|
-
return {
|
|
4
|
-
DEFAULT: {
|
|
5
|
-
css: {
|
|
6
|
-
'a, span[data-rot], .link': {
|
|
7
|
-
textDecoration: 'none',
|
|
8
|
-
color: 'var(--primary)',
|
|
9
|
-
fontWeight: 500,
|
|
10
|
-
borderBottom: '1px solid;',
|
|
11
|
-
'&:hover': {
|
|
12
|
-
opacity: '.75',
|
|
13
|
-
},
|
|
14
|
-
},
|
|
15
|
-
},
|
|
16
|
-
},
|
|
17
|
-
}
|
|
18
|
-
},
|
|
19
|
-
twFirstLetterPlugin: function ({ addVariant, e }) {
|
|
20
|
-
addVariant('first-letter', ({ modifySelectors, separator }) => {
|
|
21
|
-
modifySelectors(({ className }) => {
|
|
22
|
-
return `.${e(`first-letter${separator}${className}`)}:first-letter`
|
|
23
|
-
})
|
|
24
|
-
})
|
|
25
|
-
},
|
|
26
|
-
twFirstChildPlugin: function ({ addVariant, e }) {
|
|
27
|
-
addVariant('first-child', ({ modifySelectors, separator }) => {
|
|
28
|
-
modifySelectors(({ className }) => {
|
|
29
|
-
return `.${e(`first-child${separator}${className}`)}:first-child`
|
|
30
|
-
})
|
|
31
|
-
})
|
|
32
|
-
},
|
|
33
|
-
twBleedPlugin: function ({ addUtilities }) {
|
|
34
|
-
addUtilities({
|
|
35
|
-
'.bleed': {
|
|
36
|
-
width: '100vw',
|
|
37
|
-
'margin-inline-start': '50%',
|
|
38
|
-
'margin-inline-end': 'unset',
|
|
39
|
-
transform: 'translateX(-50%)',
|
|
40
|
-
'max-width': 'none',
|
|
41
|
-
},
|
|
42
|
-
'.bleed-disable': {
|
|
43
|
-
width: 'inherit',
|
|
44
|
-
'margin-inline-start': 'inherit',
|
|
45
|
-
'margin-inline-end': 'inherit',
|
|
46
|
-
transform: 'default',
|
|
47
|
-
},
|
|
48
|
-
})
|
|
49
|
-
},
|
|
50
|
-
justifySafeCenterPlugin: function ({ addUtilities }) {
|
|
51
|
-
addUtilities({
|
|
52
|
-
'.justify-safe-center': {
|
|
53
|
-
'justify-content': 'safe center',
|
|
54
|
-
},
|
|
55
|
-
})
|
|
56
|
-
},
|
|
57
|
-
}
|