@pushword/js-helper 0.0.57 → 0.0.61

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.57",
3
+ "version": "0.0.61",
4
4
  "description": "Pushword front end helpers. ",
5
5
  "author": "Robin@PiedWeb <contact@piedweb.com>",
6
6
  "license": "MIT",
package/src/app.css ADDED
@@ -0,0 +1,4 @@
1
+ @import "tailwindcss/base";
2
+ @import "tailwindcss/components";
3
+ @import "tailwindcss/utilities";
4
+ @import "@pushword/js-helper/src/tailwind.prose.scss";
package/src/app.js ADDED
@@ -0,0 +1,27 @@
1
+ require("fslightbox");
2
+ import {
3
+ uncloakLinks,
4
+ readableEmail,
5
+ convertImageLinkToWebPLink,
6
+ replaceOn,
7
+ liveBlock,
8
+ } from "@pushword/js-helper/src/helpers.js";
9
+ import { allClickable } from "@pushword/js-helper/src/clickable.js";
10
+
11
+ function onDomChanged() {
12
+ liveBlock();
13
+ convertImageLinkToWebPLink();
14
+ uncloakLinks();
15
+ readableEmail(".cea");
16
+ replaceOn();
17
+ refreshFsLightbox();
18
+ allClickable(".clickable");
19
+ }
20
+
21
+ function onPageLoaded() {
22
+ onDomChanged();
23
+ new FsLightbox();
24
+ }
25
+
26
+ document.addEventListener("DOMContentLoaded", onPageLoaded());
27
+ document.addEventListener("DOMChanged", onDomChanged);
package/src/encore.js CHANGED
@@ -2,15 +2,15 @@ const WatchExternalFilesPlugin = require("webpack-watch-files-plugin").default;
2
2
  const Encore = require("@symfony/webpack-encore");
3
3
  const tailwindcss = require("tailwindcss");
4
4
 
5
- function getFilesToWatch() {
5
+ function getFilesToWatch(basePath = "./..") {
6
6
  return [
7
- "./../vendor/pushword/core/src/templates/**/*.html.twig",
8
- "./../vendor/pushword/core/src/templates/*.html.twig",
9
- "./../vendor/pushword/conversation/src/templates/*.html.twig",
10
- "./../vendor/pushword/admin-block-editor/src/templates/page/*.html.twig",
11
- "./../templates/*.html.twig",
12
- "./../templates/**/*.html.twig",
13
- "./../templates/**/**/*.html.twig",
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) {
@@ -29,24 +29,9 @@ module.exports = {
29
29
  outputPath = "./../public/assets/",
30
30
  publicPath = "/assets",
31
31
  manifestKeyPrefix = null,
32
- filesToCopy = [
33
- {
34
- from: "./media/", // todo explain
35
- to: "[name].[ext]",
36
- pattern: /svg$/,
37
- },
38
- {
39
- from: "./img/",
40
- to: "[name].[ext]",
41
- pattern: /header.jpg$/,
42
- },
43
- {
44
- from: "./favicons",
45
- to: "[name].[ext]",
46
- },
47
- ],
48
- entries = [{ name: "app", file: "./app.js" }],
49
- styleEntries = [{ name: "style", file: "./app.css" }]
32
+ filesToCopy = null,
33
+ entries = null,
34
+ styleEntries = null
50
35
  ) {
51
36
  if (watchFiles === null) {
52
37
  watchFiles = getFilesToWatch();
@@ -56,6 +41,27 @@ module.exports = {
56
41
  tailwindConfig = getTailwindConfig(watchFiles);
57
42
  }
58
43
 
44
+ if (filesToCopy === null) {
45
+ filesToCopy = [
46
+ {
47
+ from: "./favicons",
48
+ to: "[name].[ext]",
49
+ },
50
+ ];
51
+ }
52
+
53
+ if (entries === null) {
54
+ entries = [{ name: "app", file: __dirname + "/app.js" }];
55
+ } else if (typeof entries === "string") {
56
+ entries = [{ name: "app", file: entries }];
57
+ }
58
+
59
+ if (styleEntries === null) {
60
+ styleEntries = [{ name: "style", file: __dirname + "/app.css" }];
61
+ } else if (typeof styleEntries === "string") {
62
+ styleEntries = [{ name: "style", file: styleEntries }];
63
+ }
64
+
59
65
  Encore.setOutputPath(outputPath)
60
66
  .setPublicPath(publicPath)
61
67
  .cleanupOutputBeforeBuild()
package/src/helpers.js CHANGED
@@ -233,7 +233,7 @@ export async function uncloakLinks(attribute = "data-rot", when = "onEvent") {
233
233
  } else {
234
234
  var element = convertLink(event.target);
235
235
  }
236
- fireEventLinksBuilt(element, event);
236
+ if (element) fireEventLinksBuilt(element, event);
237
237
  };
238
238
 
239
239
  if (when == "onEvent") {
@@ -51,8 +51,3 @@ html {
51
51
  max-height: 100vh;
52
52
  padding-top: 1rem;
53
53
  }
54
-
55
- /*
56
- * Special full-width from everywhere alias .w-full-vw:
57
- w-screen relative left-[49%] ml-[-50vw] my-6
58
- */