mypgs 1.4.0 → 1.4.1

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.
@@ -20,6 +20,8 @@ import "./components/_notifications.js";
20
20
  //= IMPORT REGISTRY
21
21
  import "./_imports.js";
22
22
 
23
+ //= LAYOUT
24
+ import "./layout/_header.js";
25
+
23
26
  //= PATTERNS
24
- import "./patterns/_header.js";
25
27
  import "./patterns/_cookieConsent.js";
@@ -62,6 +62,12 @@ declare global {
62
62
 
63
63
  interface PgsBag extends PgsElementApi {}
64
64
 
65
+ namespace React {
66
+ interface HTMLAttributes<T> {
67
+ pgsHtml?: string;
68
+ }
69
+ }
70
+
65
71
  var pgs: PgsFunction;
66
72
  }
67
73
 
@@ -23,6 +23,8 @@
23
23
  @include meta.load-css("layout/grid");
24
24
  @include meta.load-css("layout/pageShell");
25
25
  @include meta.load-css("layout/gap");
26
+ @include meta.load-css("layout/header");
27
+ @include meta.load-css("layout/footer");
26
28
  }
27
29
 
28
30
  /*
@@ -56,7 +58,5 @@
56
58
  |--------------------------------------------------------------------------
57
59
  */
58
60
  [pgs~=initP] {
59
- @include meta.load-css("patterns/header");
60
- @include meta.load-css("patterns/footer");
61
61
  @include meta.load-css("patterns/cookieConsent");
62
- }
62
+ }
package/dist/index.d.ts CHANGED
@@ -61,6 +61,12 @@ declare global {
61
61
 
62
62
  interface PgsBag extends PgsElementApi {}
63
63
 
64
+ namespace React {
65
+ interface HTMLAttributes<T> {
66
+ pgsHtml?: string;
67
+ }
68
+ }
69
+
64
70
  var pgs: PgsFunction;
65
71
  }
66
72
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mypgs",
3
- "version": "1.4.0",
3
+ "version": "1.4.1",
4
4
  "description": "MyPGS frontend theme and UI behaviors, with bundled JavaScript and CSS assets.",
5
5
  "main": "./dist/javascript/index.js",
6
6
  "module": "./assets/javascript/index.js",
@@ -12,7 +12,8 @@
12
12
  "default": "./dist/javascript/index.js"
13
13
  },
14
14
  "./style.css": "./dist/css/index.css",
15
- "./style.min.css": "./dist/css/index.min.css"
15
+ "./style.min.css": "./dist/css/index.min.css",
16
+ "./vite-plugin-pgs": "./plugins/vite-plugin-pgs.js"
16
17
  },
17
18
  "style": "./dist/css/index.css",
18
19
  "scripts": {
@@ -0,0 +1,14 @@
1
+ export default function pgsVite() {
2
+ return {
3
+ name: "vite-plugin-pgs-html",
4
+
5
+ transform(code, id) {
6
+ if (!/\.(jsx|tsx)$/.test(id)) return null;
7
+
8
+ return {
9
+ code: code.replace(/\bpgsHtml=/g, "pgs="),
10
+ map: null,
11
+ };
12
+ },
13
+ };
14
+ }
@@ -31,15 +31,13 @@ const templateFiles = [
31
31
  "layout/flex.html",
32
32
  "layout/grid.html",
33
33
  "layout/pageShell.html",
34
+ "layout/footer.html",
35
+ "layout/header.html",
34
36
  "patterns/cookieConsent.html",
35
- "patterns/header.html",
36
- "patterns/footer.html",
37
37
  ];
38
38
 
39
39
  function getTemplateTitle(path) {
40
- return path
41
- .replace(".html", "")
42
- .replace("/", " / ")
40
+ return path.replace(".html", "").replace("/", " / ")
43
41
  }
44
42
 
45
43
  function renderSourceTemplate(section, html) {
@@ -72,9 +70,7 @@ function renderTitle(section, path) {
72
70
 
73
71
  async function loadTemplate(path) {
74
72
  const response = await fetch(path);
75
- if (!response.ok) {
76
- throw new Error(`${path}: ${response.status}`);
77
- }
73
+ if (!response.ok) throw new Error(`${path}: ${response.status}`);
78
74
  return response.text();
79
75
  }
80
76
 
@@ -90,8 +86,8 @@ async function bootDemo() {
90
86
  const AFTER = document.getElementById("templates-demo-after");
91
87
 
92
88
  for (const path of templateFiles) {
93
- const isHeader = path === "patterns/header.html";
94
- const isfooter = path === "patterns/footer.html";
89
+ const isHeader = path === "layout/header.html";
90
+ const isfooter = path === "layout/footer.html";
95
91
  const isBody = path === "layout/body.html";
96
92
 
97
93
  if (isHeader || isfooter) {
@@ -103,7 +99,6 @@ async function bootDemo() {
103
99
  message.textContent = `Template non caricato: ${error.message}`;
104
100
  layoutRoot.append(message);
105
101
  }
106
-
107
102
  continue;
108
103
  }
109
104
 
@@ -116,7 +111,6 @@ async function bootDemo() {
116
111
  const html = await loadTemplate(path);
117
112
  renderSourceTemplate(section, html);
118
113
  MAIN.append(section);
119
-
120
114
  continue
121
115
  }
122
116
 
@@ -133,7 +127,6 @@ async function bootDemo() {
133
127
 
134
128
  if (path == "layout/section.html" || path == "layout/pageShell.html") {
135
129
  section.style.display = "contents";
136
-
137
130
  Array.from(section.children).forEach(c => c.style.width = "100%");
138
131
  }
139
132
  }
File without changes
File without changes
File without changes
File without changes