@reidelsaltres/pureper 0.1.51 → 0.1.55

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/LICENSE CHANGED
@@ -1,21 +1,21 @@
1
- MIT License
2
-
3
- Copyright (c) 2025 ReiDelsAltres
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
1
+ MIT License
2
+
3
+ Copyright (c) 2025 ReiDelsAltres
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
- # Pureper (packaged)
2
-
3
- This package provides the core foundation utilities extracted from the Pureper SPA project (component lifecycle base classes, Triplet helper, Router, ServiceWorker helper, Fetcher, Theme, and selected helpers).
4
-
5
- License
6
- MIT
1
+ # Pureper (packaged)
2
+
3
+ This package provides the core foundation utilities extracted from the Pureper SPA project (component lifecycle base classes, Triplet helper, Router, ServiceWorker helper, Fetcher, Theme, and selected helpers).
4
+
5
+ License
6
+ MIT
package/package.json CHANGED
@@ -1,42 +1,42 @@
1
- {
2
- "name": "@reidelsaltres/pureper",
3
- "version": "0.1.51",
4
- "description": "Minimal library extracted from the Pureper SPA foundation — utilities and base classes for components/pages.",
5
- "type": "module",
6
- "main": "out/src/index.js",
7
- "module": "out/src/index.js",
8
- "types": "out/src/index.d.ts",
9
- "files": [
10
- "out",
11
- "src",
12
- "README.md",
13
- "LICENSE"
14
- ],
15
- "scripts": {
16
- "publish:npm": "npm publish --registry=https://registry.npmjs.org/",
17
- "publish:gh": "npm publish",
18
- "prepack": "tsc",
19
- "types:check": "tsc --noEmit",
20
- "build": "tsc -p tsconfig.json",
21
- "prepare": "npm run build",
22
- "test": "npx tsc -p tests/tsconfig.json"
23
- },
24
- "repository": {
25
- "type": "git",
26
- "url": "git+https://github.com/ReiDelsAltres/Pureper.git"
27
- },
28
- "bugs": {
29
- "url": "https://github.com/ReiDelsAltres/Pureper/issues"
30
- },
31
- "homepage": "https://github.com/ReiDelsAltres/Pureper#readme",
32
- "keywords": [
33
- "spa",
34
- "components",
35
- "typescript"
36
- ],
37
- "author": "ReiDelsAltres",
38
- "license": "MIT",
39
- "dependencies": {
40
- "npmrc-replace-env": "^1.1.4"
41
- }
42
- }
1
+ {
2
+ "name": "@reidelsaltres/pureper",
3
+ "version": "0.1.55",
4
+ "description": "Minimal library extracted from the Pureper SPA foundation — utilities and base classes for components/pages.",
5
+ "type": "module",
6
+ "main": "out/src/index.js",
7
+ "module": "out/src/index.js",
8
+ "types": "out/src/index.d.ts",
9
+ "files": [
10
+ "out",
11
+ "src",
12
+ "README.md",
13
+ "LICENSE"
14
+ ],
15
+ "scripts": {
16
+ "publish:npm": "npm publish --registry=https://registry.npmjs.org/",
17
+ "publish:gh": "npm publish",
18
+ "prepack": "tsc",
19
+ "types:check": "tsc --noEmit",
20
+ "build": "tsc -p tsconfig.json",
21
+ "prepare": "npm run build",
22
+ "test": "npx tsc -p tests/tsconfig.json"
23
+ },
24
+ "repository": {
25
+ "type": "git",
26
+ "url": "git+https://github.com/ReiDelsAltres/Pureper.git"
27
+ },
28
+ "bugs": {
29
+ "url": "https://github.com/ReiDelsAltres/Pureper/issues"
30
+ },
31
+ "homepage": "https://github.com/ReiDelsAltres/Pureper#readme",
32
+ "keywords": [
33
+ "spa",
34
+ "components",
35
+ "typescript"
36
+ ],
37
+ "author": "ReiDelsAltres",
38
+ "license": "MIT",
39
+ "dependencies": {
40
+ "npmrc-replace-env": "^1.1.4"
41
+ }
42
+ }
@@ -1,20 +1,20 @@
1
- export default class Fetcher {
2
- static async fetchText(url: string): Promise<string> {
3
- const response = await this.internalFetch(url);
4
-
5
- return await response.text();
6
- }
7
- static async fetchJSON(url: string): Promise<any> {
8
- const response = await this.internalFetch(url);
9
-
10
- return await response.json();
11
- }
12
-
13
- private static async internalFetch(url: string): Promise<Response> {
14
- const response = await fetch(url, { cache: 'default' });
15
- if (!response.ok) {
16
- throw new Error(`HTTP error! status: ${response.status}`);
17
- }
18
- return response;
19
- }
1
+ export default class Fetcher {
2
+ static async fetchText(url: string): Promise<string> {
3
+ const response = await this.internalFetch(url);
4
+
5
+ return await response.text();
6
+ }
7
+ static async fetchJSON(url: string): Promise<any> {
8
+ const response = await this.internalFetch(url);
9
+
10
+ return await response.json();
11
+ }
12
+
13
+ private static async internalFetch(url: string): Promise<Response> {
14
+ const response = await fetch(url, { cache: 'default' });
15
+ if (!response.ok) {
16
+ throw new Error(`HTTP error! status: ${response.status}`);
17
+ }
18
+ return response;
19
+ }
20
20
  }
@@ -1,37 +1,37 @@
1
- import Fetcher from "./Fetcher.js";
2
-
3
- export type IconName = 'home' | 'user' | 'settings' | 'copy' | 'menu' | 'close' | 'arrow-left' |
4
- 'arrow-right' | 'search' | 'heart' | 'star' | 'palette' | string;
5
-
6
- export type SizeClass = 'xs' | 'sm' | 'md' | 'lg' | 'xl';
7
-
8
- export type ThemeColor = 'primary' | 'secondary' | 'tertiary' | 'additional' |
9
- 'success' | 'warning' | 'error' | 'info' | 'text';
10
-
11
- export let ACTIVE_THEME_KEY = "Empty";
12
-
13
- export async function loadTheme(name: string) : Promise<string> {
14
- return Fetcher.fetchText(`../../../resources/${name}.theme.css`);
15
- }
16
- export async function loadThemeAsInstant(name: string) : Promise<CSSStyleSheet> {
17
- let theme: string = await loadTheme(name);
18
- const sheet = new CSSStyleSheet();
19
- sheet.replaceSync(theme);
20
- return sheet;
21
- }
22
- export async function init() {
23
- ACTIVE_THEME_KEY = localStorage.getItem("theme");
24
- if (ACTIVE_THEME_KEY) {
25
- await setTheme(ACTIVE_THEME_KEY);
26
- } else {
27
- await setTheme("Blazor");
28
- }
29
- }
30
- export async function setTheme(name: string) {
31
- let theme: string = await loadTheme(name);
32
- theme = theme.replace(/\.[\w-]+-theme/g, ":root");
33
- const sheet = new CSSStyleSheet();
34
- sheet.replaceSync(theme);
35
- document.adoptedStyleSheets = [...document.adoptedStyleSheets, sheet];
36
- }
37
-
1
+ import Fetcher from "./Fetcher.js";
2
+
3
+ export type IconName = 'home' | 'user' | 'settings' | 'copy' | 'menu' | 'close' | 'arrow-left' |
4
+ 'arrow-right' | 'search' | 'heart' | 'star' | 'palette' | string;
5
+
6
+ export type SizeClass = 'xs' | 'sm' | 'md' | 'lg' | 'xl';
7
+
8
+ export type ThemeColor = 'primary' | 'secondary' | 'tertiary' | 'additional' |
9
+ 'success' | 'warning' | 'error' | 'info' | 'text';
10
+
11
+ export let ACTIVE_THEME_KEY = "Empty";
12
+
13
+ export async function loadTheme(name: string) : Promise<string> {
14
+ return Fetcher.fetchText(`../../../resources/${name}.theme.css`);
15
+ }
16
+ export async function loadThemeAsInstant(name: string) : Promise<CSSStyleSheet> {
17
+ let theme: string = await loadTheme(name);
18
+ const sheet = new CSSStyleSheet();
19
+ sheet.replaceSync(theme);
20
+ return sheet;
21
+ }
22
+ export async function init() {
23
+ ACTIVE_THEME_KEY = localStorage.getItem("theme");
24
+ if (ACTIVE_THEME_KEY) {
25
+ await setTheme(ACTIVE_THEME_KEY);
26
+ } else {
27
+ await setTheme("Blazor");
28
+ }
29
+ }
30
+ export async function setTheme(name: string) {
31
+ let theme: string = await loadTheme(name);
32
+ theme = theme.replace(/\.[\w-]+-theme/g, ":root");
33
+ const sheet = new CSSStyleSheet();
34
+ sheet.replaceSync(theme);
35
+ document.adoptedStyleSheets = [...document.adoptedStyleSheets, sheet];
36
+ }
37
+