@paroicms/public-menu-plugin 0.7.0 → 0.9.0

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.
@@ -1,17 +1,16 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const data_formatters_lib_1 = require("@paroi/data-formatters-lib");
4
- const public_server_lib_1 = require("@paroicms/public-server-lib");
5
- const node_path_1 = require("node:path");
6
- const projectDir = (0, node_path_1.dirname)(__dirname);
7
- const packageDir = (0, node_path_1.dirname)(projectDir);
8
- const version = (0, data_formatters_lib_1.strVal)(require((0, node_path_1.join)(packageDir, "package.json")).version);
1
+ import { strVal } from "@paroi/data-formatters-lib";
2
+ import { escapeHtml, resolveModuleDirectory, } from "@paroicms/public-server-lib";
3
+ import { readFileSync } from "node:fs";
4
+ import { dirname, join } from "node:path";
5
+ const projectDir = resolveModuleDirectory(import.meta.url, { parent: true });
6
+ const packageDir = dirname(projectDir);
7
+ const version = strVal(JSON.parse(readFileSync(join(packageDir, "package.json"), "utf-8")).version);
9
8
  const plugin = {
10
9
  version,
11
10
  slug: "public-menu",
12
11
  async siteInit(service) {
13
- service.setPublicAssetsDirectory((0, node_path_1.join)(packageDir, "public-front", "dist"));
14
- service.addHeadTag(`<link rel="stylesheet" href="${(0, public_server_lib_1.escapeHtml)(`${service.pluginAssetsUrl}/public-front-plugin.css`)}">`, `<script type="module" src="${(0, public_server_lib_1.escapeHtml)(`${service.pluginAssetsUrl}/public-front-plugin.mjs`)}"></script>`);
12
+ service.setPublicAssetsDirectory(join(packageDir, "public-front", "dist"));
13
+ service.addHeadTag(`<link rel="stylesheet" href="${escapeHtml(`${service.pluginAssetsUrl}/public-front-plugin.css`)}">`, `<script type="module" src="${escapeHtml(`${service.pluginAssetsUrl}/public-front-plugin.mjs`)}"></script>`);
15
14
  },
16
15
  };
17
- exports.default = plugin;
16
+ export default plugin;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@paroicms/public-menu-plugin",
3
- "version": "0.7.0",
3
+ "version": "0.9.0",
4
4
  "description": "Public menu plugin for ParoiCMS",
5
5
  "keywords": [
6
6
  "paroicms",
@@ -20,7 +20,7 @@
20
20
  "build": "npm run build:backend && npm run build:public",
21
21
  "build:backend": "(cd backend && tsc)",
22
22
  "build:public": "(cd public-front && tsc && vite build && npm run minify:public)",
23
- "minify:public": "terser public-front/dist/public-front-plugin.mjs --output public-front/dist/public-front-plugin.mjs",
23
+ "minify:public": "terser public-front/dist/public-front-plugin.mjs --output public-front/dist/public-front-plugin.mjs",
24
24
  "build:public:watch": "(cd public-front && tsc && vite build --watch)",
25
25
  "clear": "rimraf backend/dist/* public-front/dist/*"
26
26
  },
@@ -32,19 +32,20 @@
32
32
  "@paroicms/public-server-lib": "0"
33
33
  },
34
34
  "devDependencies": {
35
- "@paroicms/public-anywhere-lib": "0.14.0",
36
- "@paroicms/public-server-lib": "0.22.1",
37
- "@paroicms/tiny-modal": "0.1.0",
38
- "@types/node": "~22.10.7",
35
+ "@paroicms/public-anywhere-lib": "0.19.0",
36
+ "@paroicms/public-server-lib": "0.26.0",
37
+ "@paroicms/tiny-modal": "0.3.0",
38
+ "@types/node": "~22.13.10",
39
39
  "rimraf": "~6.0.1",
40
- "sass": "~1.83.4",
40
+ "sass": "~1.84.0",
41
41
  "solid-devtools": "~0.33.0",
42
42
  "solid-js": "1.9.4",
43
- "typescript": "~5.7.3",
44
- "vite": "~6.0.7",
43
+ "typescript": "~5.8.2",
44
+ "vite": "~6.1.0",
45
45
  "vite-plugin-solid": "~2.11.0",
46
46
  "terser": "~5.37.0"
47
47
  },
48
+ "type": "module",
48
49
  "main": "backend/dist/plugin.js",
49
50
  "files": [
50
51
  "backend/dist",
@@ -1 +1 @@
1
- import{insert as M,template as p}from"https://esm.sh/solid-js@1.9.4/web";function y(t){const c=t.dataset.activateMenuItems?.trim();if(!c)return;const{id:s,parents:n}=JSON.parse(c),e=new Set(n);e.add(s);const o=t.querySelectorAll("[data-menu-item-id]");for(const i of o){const l=i.dataset.menuItemId;l!==void 0&&e.has(l)&&i.classList.add("active")}}function h({openButton:t,dialogContent:c}){const s=t?typeof t=="string"?document.querySelector(t):t:void 0,n=typeof c=="string"?document.querySelector(c):c;if(!n)return;n instanceof HTMLTemplateElement||n.classList.remove("HiddenForTinyModal");const e=document.createElement("dialog");e.classList.add("TinyModal");const o=document.createElement("button");o.classList.add("TinyModal-closeBtn"),e.appendChild(o);const i=document.createElement("div");i.classList.add("TinyModal-wrapper"),i.appendChild(n instanceof HTMLTemplateElement?n.content.cloneNode(!0):n),e.appendChild(i),document.body.appendChild(e);const l=new Map;function d(a,r){l.has(a)||l.set(a,[]),l.get(a)?.push(r)}function u(a){l.has(a)&&l.get(a)?.forEach((r=>r()))}function m(){e.showModal(),document.body.style.overflow="hidden",u("open")}function f(){e.close()}return s?.addEventListener("click",m),o.addEventListener("click",f),e.addEventListener("close",(()=>{document.body.style.overflow="",u("close")})),{open:m,close:f,on:d}}var v=p("<div class=MobileMenu>"),b=p('<button class=MobileMenuBtn type=button><svg xmlns=http://www.w3.org/2000/svg viewBox="0 0 24 24"fill=currentColor data-testid=IconBurger width=35 height=35><title>IconBurger</title><path d="M4 18h16c.55 0 1-.45 1-1s-.45-1-1-1H4c-.55 0-1 .45-1 1s.45 1 1 1zm0-5h16c.55 0 1-.45 1-1s-.45-1-1-1H4c-.55 0-1 .45-1 1s.45 1 1 1zM3 7c0 .55.45 1 1 1h16c.55 0 1-.45 1-1s-.45-1-1-1H4c-.55 0-1 .45-1 1z">');function g(t,c){const n=window.getComputedStyle(t).getPropertyValue("--siteAppMobileMenuMaxWidth");if(!window.matchMedia(`(max-width: ${n})`).matches)return;const o=document.querySelector('[data-mobile-menu="button"]');if(!o)return;E(t);const i=(()=>{var d=v();return M(d,t),d})();t.style.display==="none"&&t.style.removeProperty("display");const l=b();o.appendChild(l),h({openButton:l,dialogContent:i})}function E(t){const c=document.querySelectorAll("[data-mobile-menu-part]");for(const s of c){const n=s.dataset.mobileMenuPart,e=s.dataset.mobileMenuAction!=="move",o=t.querySelector(`[data-inject="${n}"]`);o&&o.appendChild(e?s.cloneNode(!0):s)}}document.addEventListener("DOMContentLoaded",(()=>{const t=document.documentElement.lang,c={mobileMenu:g},s=document.querySelectorAll("[data-effect]");for(const e of s){const o=e.dataset.effect;if(!o)continue;const i=c[o];i&&i(e,{language:t})}const n=document.querySelectorAll("[data-activate-menu-items]");for(const e of n)y(e)}));
1
+ import{template as p,insert as M}from"https://esm.sh/solid-js@1.9.4/web";function y(t){const c=t.dataset.activateMenuItems?.trim();if(!c)return;const{id:s,parents:n}=JSON.parse(c),e=new Set(n);e.add(s);const o=t.querySelectorAll("[data-menu-item-id]");for(const i of o){const l=i.dataset.menuItemId;l!==void 0&&e.has(l)&&i.classList.add("active")}}function h({openButton:t,dialogContent:c}){const s=t?typeof t=="string"?document.querySelector(t):t:void 0,n=typeof c=="string"?document.querySelector(c):c;if(!n)return;n instanceof HTMLTemplateElement||n.classList.remove("HiddenForTinyModal");const e=document.createElement("dialog");e.classList.add("TinyModal");const o=document.createElement("button");o.classList.add("TinyModal-closeBtn"),e.appendChild(o);const i=document.createElement("div");i.classList.add("TinyModal-wrapper"),i.appendChild(n instanceof HTMLTemplateElement?n.content.cloneNode(!0):n),e.appendChild(i),document.body.appendChild(e);const l=new Map;function d(a,r){l.has(a)||l.set(a,[]),l.get(a)?.push(r)}function u(a){l.has(a)&&l.get(a)?.forEach((r=>r()))}function m(){e.showModal(),document.body.style.overflow="hidden",u("open")}function f(){e.close()}return s?.addEventListener("click",m),o.addEventListener("click",f),e.addEventListener("close",(()=>{document.body.style.overflow="",u("close")})),{open:m,close:f,on:d}}var v=p("<div class=MobileMenu>"),b=p('<button class=MobileMenuBtn type=button><svg xmlns=http://www.w3.org/2000/svg viewBox="0 0 24 24"fill=currentColor data-testid=IconBurger width=35 height=35><title>IconBurger</title><path d="M4 18h16c.55 0 1-.45 1-1s-.45-1-1-1H4c-.55 0-1 .45-1 1s.45 1 1 1zm0-5h16c.55 0 1-.45 1-1s-.45-1-1-1H4c-.55 0-1 .45-1 1s.45 1 1 1zM3 7c0 .55.45 1 1 1h16c.55 0 1-.45 1-1s-.45-1-1-1H4c-.55 0-1 .45-1 1z">');function g(t,c){const n=window.getComputedStyle(t).getPropertyValue("--siteAppMobileMenuMaxWidth");if(!window.matchMedia(`(max-width: ${n})`).matches)return;const o=document.querySelector('[data-mobile-menu="button"]');if(!o)return;E(t);const i=(()=>{var d=v();return M(d,t),d})();t.style.display==="none"&&t.style.removeProperty("display");const l=b();o.appendChild(l),h({openButton:l,dialogContent:i})}function E(t){const c=document.querySelectorAll("[data-mobile-menu-part]");for(const s of c){const n=s.dataset.mobileMenuPart,e=s.dataset.mobileMenuAction!=="move",o=t.querySelector(`[data-inject="${n}"]`);o&&o.appendChild(e?s.cloneNode(!0):s)}}document.addEventListener("DOMContentLoaded",(()=>{const t=document.documentElement.lang,c={mobileMenu:g},s=document.querySelectorAll("[data-effect]");for(const e of s){const o=e.dataset.effect;if(!o)continue;const i=c[o];i&&i(e,{language:t})}const n=document.querySelectorAll("[data-activate-menu-items]");for(const e of n)y(e)}));