@pushword/js-helper 0.0.62 → 0.0.66
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/encore.js +35 -31
- package/src/helpers.js +12 -7
- package/src/tailwind.helpers.js +22 -17
package/package.json
CHANGED
package/src/encore.js
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
const WatchExternalFilesPlugin = require(
|
|
2
|
-
const Encore = require(
|
|
3
|
-
const tailwindcss = require(
|
|
1
|
+
const WatchExternalFilesPlugin = require('webpack-watch-files-plugin').default;
|
|
2
|
+
const Encore = require('@symfony/webpack-encore');
|
|
3
|
+
const tailwindcss = require('tailwindcss');
|
|
4
4
|
|
|
5
|
-
function getFilesToWatch(basePath =
|
|
5
|
+
function getFilesToWatch(basePath = './..') {
|
|
6
6
|
return [
|
|
7
|
-
basePath +
|
|
8
|
-
basePath +
|
|
9
|
-
basePath +
|
|
10
|
-
basePath +
|
|
11
|
-
basePath +
|
|
12
|
-
basePath +
|
|
13
|
-
basePath +
|
|
7
|
+
basePath + '/vendor/pushword/core/src/templates/**/*.html.twig',
|
|
8
|
+
basePath + '/vendor/pushword/core/src/templates/*.html.twig',
|
|
9
|
+
basePath + '/vendor/pushword/conversation/src/templates/*.html.twig',
|
|
10
|
+
basePath + '/vendor/pushword/admin-block-editor/src/templates/page/*.html.twig',
|
|
11
|
+
basePath + '/templates/*.html.twig',
|
|
12
|
+
basePath + '/templates/**/*.html.twig',
|
|
13
|
+
basePath + '/templates/**/**/*.html.twig',
|
|
14
14
|
];
|
|
15
15
|
}
|
|
16
16
|
function getTailwindConfig(watchFiles = null) {
|
|
17
17
|
if (watchFiles === null) watchFiles = getFilesToWatch();
|
|
18
|
-
var tailwindConfig = require(
|
|
18
|
+
var tailwindConfig = require('@pushword/js-helper/src/tailwind.config.js');
|
|
19
19
|
tailwindConfig.content = watchFiles;
|
|
20
20
|
return tailwindConfig;
|
|
21
21
|
}
|
|
@@ -24,14 +24,14 @@ module.exports = {
|
|
|
24
24
|
getFilesToWatch: getFilesToWatch,
|
|
25
25
|
getTailwindConfig: getTailwindConfig,
|
|
26
26
|
getEncore: function (
|
|
27
|
-
watchFiles = null,
|
|
28
|
-
tailwindConfig = null,
|
|
29
|
-
outputPath =
|
|
30
|
-
publicPath =
|
|
31
|
-
manifestKeyPrefix = null,
|
|
32
|
-
filesToCopy = null,
|
|
33
|
-
entries = null,
|
|
34
|
-
styleEntries = null
|
|
27
|
+
watchFiles = null, // default: getFilesToWatch()
|
|
28
|
+
tailwindConfig = null, // default : getTailwindConfig()
|
|
29
|
+
outputPath = null, // default : './../public/assets/'
|
|
30
|
+
publicPath = null, // default: '/assets'
|
|
31
|
+
manifestKeyPrefix = null, // default: null
|
|
32
|
+
filesToCopy = null, // default :: ... from: /favicons. ...
|
|
33
|
+
entries = null, // [{ name: 'app', file: '/node_modules/@pushword/js-helper/src/app.js' }];
|
|
34
|
+
styleEntries = null // [{ name: 'style', file: '/node_modules/@pushword/js-helper/src/app.css' }];
|
|
35
35
|
) {
|
|
36
36
|
if (watchFiles === null) {
|
|
37
37
|
watchFiles = getFilesToWatch();
|
|
@@ -44,26 +44,26 @@ module.exports = {
|
|
|
44
44
|
if (filesToCopy === null) {
|
|
45
45
|
filesToCopy = [
|
|
46
46
|
{
|
|
47
|
-
from:
|
|
48
|
-
to:
|
|
47
|
+
from: './favicons',
|
|
48
|
+
to: '[name].[ext]',
|
|
49
49
|
},
|
|
50
50
|
];
|
|
51
51
|
}
|
|
52
52
|
|
|
53
53
|
if (entries === null) {
|
|
54
|
-
entries = [{ name:
|
|
55
|
-
} else if (typeof entries ===
|
|
56
|
-
entries = [{ name:
|
|
54
|
+
entries = [{ name: 'app', file: __dirname + '/app.js' }];
|
|
55
|
+
} else if (typeof entries === 'string') {
|
|
56
|
+
entries = [{ name: 'app', file: entries }];
|
|
57
57
|
}
|
|
58
58
|
|
|
59
59
|
if (styleEntries === null) {
|
|
60
|
-
styleEntries = [{ name:
|
|
61
|
-
} else if (typeof styleEntries ===
|
|
62
|
-
styleEntries = [{ name:
|
|
60
|
+
styleEntries = [{ name: 'style', file: __dirname + '/app.css' }];
|
|
61
|
+
} else if (typeof styleEntries === 'string') {
|
|
62
|
+
styleEntries = [{ name: 'style', file: styleEntries }];
|
|
63
63
|
}
|
|
64
64
|
|
|
65
|
-
Encore.setOutputPath(outputPath)
|
|
66
|
-
.setPublicPath(publicPath)
|
|
65
|
+
Encore.setOutputPath(outputPath ?? './../public/assets/')
|
|
66
|
+
.setPublicPath(publicPath ?? '/assets')
|
|
67
67
|
.cleanupOutputBeforeBuild()
|
|
68
68
|
.enableSassLoader()
|
|
69
69
|
.enableSourceMaps(false)
|
|
@@ -75,7 +75,11 @@ module.exports = {
|
|
|
75
75
|
)
|
|
76
76
|
.enablePostCssLoader((options) => {
|
|
77
77
|
options.postcssOptions = {
|
|
78
|
-
plugins: [
|
|
78
|
+
plugins: [
|
|
79
|
+
require('postcss-import'),
|
|
80
|
+
tailwindcss(tailwindConfig),
|
|
81
|
+
require('autoprefixer'),
|
|
82
|
+
],
|
|
79
83
|
};
|
|
80
84
|
})
|
|
81
85
|
.disableSingleRuntimeChunk();
|
package/src/helpers.js
CHANGED
|
@@ -29,7 +29,7 @@ export function liveBlock(liveBlockAttribute = "data-live", liveFormSelector = "
|
|
|
29
29
|
|
|
30
30
|
var getLiveBlock = function (item) {
|
|
31
31
|
var url = item.getAttribute(liveBlockAttribute);
|
|
32
|
-
url =
|
|
32
|
+
url = url.startsWith("e:") ? convertShortchutForLink(rot13ToText(url.substring(2))) : url;
|
|
33
33
|
fetch(url, {
|
|
34
34
|
//headers: { "Content-Type": "application/json", Accept: "text/plain" },
|
|
35
35
|
method: "POST",
|
|
@@ -47,13 +47,14 @@ export function liveBlock(liveBlockAttribute = "data-live", liveFormSelector = "
|
|
|
47
47
|
});
|
|
48
48
|
};
|
|
49
49
|
|
|
50
|
-
|
|
51
|
-
'<
|
|
50
|
+
const spinner =
|
|
51
|
+
'<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>';
|
|
52
|
+
const htmlLoader = "<div>" + spinner.replace("border-gray-50", "border-gray-800") + "</div>";
|
|
52
53
|
|
|
53
54
|
var setLoader = function (form) {
|
|
54
55
|
var $submitButton = getSubmitButton(form);
|
|
55
56
|
if ($submitButton !== undefined) {
|
|
56
|
-
var initialButton = $submitButton.outerHTML;
|
|
57
|
+
//var initialButton = $submitButton.outerHTML;
|
|
57
58
|
$submitButton.innerHTML = "";
|
|
58
59
|
$submitButton.outerHTML = htmlLoader;
|
|
59
60
|
}
|
|
@@ -97,6 +98,10 @@ export function liveBlock(liveBlockAttribute = "data-live", liveFormSelector = "
|
|
|
97
98
|
// Listen button src-data-live
|
|
98
99
|
document.querySelectorAll("[src-" + liveBlockAttribute + "]").forEach((item) => {
|
|
99
100
|
item.addEventListener("click", (event) => {
|
|
101
|
+
if (item.tagName == "BUTTON") {
|
|
102
|
+
item.innerHTML = spinner;
|
|
103
|
+
item.setAttribute("disabled", true);
|
|
104
|
+
}
|
|
100
105
|
btnToBlock(event, item);
|
|
101
106
|
});
|
|
102
107
|
});
|
|
@@ -280,13 +285,13 @@ export function convertFormFromRot13(attribute = "data-frot") {
|
|
|
280
285
|
|
|
281
286
|
export function convertShortchutForLink(str) {
|
|
282
287
|
if (str.charAt(0) == "-") {
|
|
283
|
-
return
|
|
288
|
+
return "http://" + str.substring(1);
|
|
284
289
|
}
|
|
285
290
|
if (str.charAt(0) == "_") {
|
|
286
|
-
return
|
|
291
|
+
return "https://" + str.substring(1);
|
|
287
292
|
}
|
|
288
293
|
if (str.charAt(0) == "@") {
|
|
289
|
-
return
|
|
294
|
+
return "mailto:" + str.substring(1);
|
|
290
295
|
}
|
|
291
296
|
return str;
|
|
292
297
|
}
|
package/src/tailwind.helpers.js
CHANGED
|
@@ -3,11 +3,16 @@ module.exports = {
|
|
|
3
3
|
return {
|
|
4
4
|
DEFAULT: {
|
|
5
5
|
css: {
|
|
6
|
-
|
|
6
|
+
a: {
|
|
7
|
+
textDecoration: 'none',
|
|
8
|
+
},
|
|
9
|
+
':where(a):not(:where([class~=not-prose] *)), :where(span[data-rot]):not(:where([class~=not-prose] *))':
|
|
7
10
|
{
|
|
8
|
-
color:
|
|
9
|
-
|
|
10
|
-
|
|
11
|
+
color: 'var(--primary)',
|
|
12
|
+
fontWeight: 500,
|
|
13
|
+
borderBottom: '1px solid;',
|
|
14
|
+
'&:hover': {
|
|
15
|
+
opacity: '.75',
|
|
11
16
|
},
|
|
12
17
|
},
|
|
13
18
|
},
|
|
@@ -15,14 +20,14 @@ module.exports = {
|
|
|
15
20
|
};
|
|
16
21
|
},
|
|
17
22
|
twFirstLetterPlugin: function ({ addVariant, e }) {
|
|
18
|
-
addVariant(
|
|
23
|
+
addVariant('first-letter', ({ modifySelectors, separator }) => {
|
|
19
24
|
modifySelectors(({ className }) => {
|
|
20
25
|
return `.${e(`first-letter${separator}${className}`)}:first-letter`;
|
|
21
26
|
});
|
|
22
27
|
});
|
|
23
28
|
},
|
|
24
29
|
twFirstChildPlugin: function ({ addVariant, e }) {
|
|
25
|
-
addVariant(
|
|
30
|
+
addVariant('first-child', ({ modifySelectors, separator }) => {
|
|
26
31
|
modifySelectors(({ className }) => {
|
|
27
32
|
return `.${e(`first-child${separator}${className}`)}:first-child`;
|
|
28
33
|
});
|
|
@@ -30,18 +35,18 @@ module.exports = {
|
|
|
30
35
|
},
|
|
31
36
|
twBleedPlugin: function ({ addUtilities }) {
|
|
32
37
|
addUtilities({
|
|
33
|
-
|
|
34
|
-
width:
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
transform:
|
|
38
|
-
|
|
38
|
+
'.bleed': {
|
|
39
|
+
width: '100vw',
|
|
40
|
+
'margin-inline-start': '50%',
|
|
41
|
+
'margin-inline-end': 'unset',
|
|
42
|
+
transform: 'translateX(-50%)',
|
|
43
|
+
'max-width': 'none',
|
|
39
44
|
},
|
|
40
|
-
|
|
41
|
-
width:
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
transform:
|
|
45
|
+
'.bleed-disable': {
|
|
46
|
+
width: 'inherit',
|
|
47
|
+
'margin-inline-start': 'inherit',
|
|
48
|
+
'margin-inline-end': 'inherit',
|
|
49
|
+
transform: 'default',
|
|
45
50
|
},
|
|
46
51
|
});
|
|
47
52
|
},
|