@spirobel/mininext 0.2.4 → 0.2.6

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/mininext/html.ts CHANGED
@@ -145,10 +145,16 @@ function JsonTemplateProcessor(danger: boolean = false) {
145
145
  }
146
146
  export const json = JsonTemplateProcessor();
147
147
  export const dangerjson = JsonTemplateProcessor(true);
148
-
149
- let default_head = html` <title>mini-next</title>
148
+ export const commonHead = /*html*/ `
150
149
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
151
- <style>
150
+ <script>
151
+ /* prevent form resubmission */
152
+ if (window.history.replaceState) {
153
+ window.history.replaceState(null, null, window.location.href);
154
+ }
155
+ </script>`;
156
+ export const cssReset = /*html*/ `
157
+ <style>
152
158
  /* CSS Reset */
153
159
  * {
154
160
  margin: 0;
@@ -162,13 +168,11 @@ let default_head = html` <title>mini-next</title>
162
168
  background-color: #000;
163
169
  color: #fff; /* Set the default text color to white for better contrast */
164
170
  }
165
- </style>
166
- <script>
167
- /* prevent form resubmission */
168
- if (window.history.replaceState) {
169
- window.history.replaceState(null, null, window.location.href);
170
- }
171
- </script>`;
171
+ </style>`;
172
+ let default_head = html`
173
+ <title>mini-next</title>
174
+ ${commonHead} ${cssReset}
175
+ `;
172
176
  /**
173
177
  * Set the default head for all pages. Can still be overwritten on a per page basis
174
178
  * @param defaultHead - HtmlString
@@ -217,7 +221,7 @@ export async function htmlResponder(
217
221
  flattend.unshift(/*html*/ `<!DOCTYPE html>
218
222
  <html>
219
223
  <head>
220
- ${Reloader || ""} ${head}
224
+ ${global.Reloader || ""} ${head}
221
225
  </head>
222
226
  <body>
223
227
  `);
@@ -1,5 +1,5 @@
1
1
  import { url, Mini, type HtmlHandler } from "./url";
2
- import { html, isError, HtmlString, head } from "./html";
2
+ import { html, isError, HtmlString, head, commonHead, cssReset } from "./html";
3
3
  import { watch } from "fs/promises";
4
4
  import * as path from "path";
5
5
  const PROJECT_ROOT = import.meta.dir + "/../../../../";
@@ -162,4 +162,6 @@ export {
162
162
  type HtmlHandler,
163
163
  Mini,
164
164
  standardDevReloader,
165
+ commonHead,
166
+ cssReset,
165
167
  };
package/package.json CHANGED
@@ -12,7 +12,7 @@
12
12
 
13
13
  },
14
14
  "files": ["dist", "mininext"],
15
- "version": "0.2.4",
15
+ "version": "0.2.6",
16
16
  "devDependencies": {
17
17
  "@types/bun": "latest"
18
18
  },