@leuffen/themejs1 3.0.1 → 3.0.3

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.
@@ -0,0 +1 @@
1
+ export declare function initLoader(): void;
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.initLoader = void 0;
4
+ const hit_index_1 = require("../hit-index");
5
+ console.time("loader");
6
+ function initLoader() {
7
+ let interval = setInterval(() => {
8
+ // Detect if body is loaded
9
+ if (document.querySelector("body")) {
10
+ // Cancel interval
11
+ clearInterval(interval);
12
+ let img = document.querySelector("img").cloneNode(true);
13
+ let loader = document.createElement("div");
14
+ loader.classList.add("loader");
15
+ loader.appendChild(img);
16
+ img.setAttribute("class", "");
17
+ img.setAttribute("loading", "eager");
18
+ let loaderBar = document.createElement("div");
19
+ loaderBar.classList.add("loader-bar");
20
+ loader.appendChild(loaderBar);
21
+ document.querySelector("body").appendChild(loader);
22
+ }
23
+ }, hit_index_1.hitIndex === 1 ? 10 : 350); // Wait 350 on subsequent requests to prevent flickering
24
+ }
25
+ exports.initLoader = initLoader;
@@ -0,0 +1 @@
1
+ export declare const hitIndex: number;
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ var _a, _b;
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.hitIndex = void 0;
5
+ const indexName = "themejs_hit_index";
6
+ let state = sessionStorage.getItem(indexName);
7
+ if (state === null) {
8
+ sessionStorage.setItem(indexName, "0");
9
+ }
10
+ sessionStorage.setItem(indexName, "" + (parseInt((_a = sessionStorage.getItem(indexName)) !== null && _a !== void 0 ? _a : "0") + 1));
11
+ exports.hitIndex = parseInt((_b = sessionStorage.getItem(indexName)) !== null && _b !== void 0 ? _b : "0");
package/embed.scss CHANGED
@@ -1,19 +1,2 @@
1
1
  @import "src/default/loader";
2
2
 
3
- body {
4
- min-height: 5000vh; // 3000vh is enough to make sure the page scrolls to correct position on reload
5
- opacity: 0;
6
- transition: opacity 0.25s;
7
- }
8
-
9
- body.loaded {
10
- min-height: unset;
11
- opacity: 1;
12
- }
13
-
14
- body > * {
15
- display: none;
16
- }
17
- body.loaded > * {
18
- display: block;
19
- }
package/embed.ts ADDED
@@ -0,0 +1,4 @@
1
+ import {initLoader} from "./src/helper/loader";
2
+
3
+
4
+ initLoader()
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@leuffen/themejs1",
3
- "version": "3.0.1",
3
+ "version": "3.0.3",
4
4
  "description": "",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.module.js",
@@ -10,6 +10,10 @@
10
10
  --t-text-color-accent: var(--bs-gray-900);
11
11
  --t-text-color-primary: var(--bs-primary);
12
12
 
13
+ --t-navbar-height: 88px;
14
+
15
+ /* What to substract from 100vh to start the next elemment after fullsize header */
16
+ --t-fullsize-modifier: 150px;
13
17
 
14
18
  --t-header-margin: 0 0 20px 0;
15
19
  --t-paragraf-margin: 0 0 20px 0;
@@ -40,7 +40,7 @@
40
40
 
41
41
  position: relative;
42
42
  &.tjs__hero-max--autoheight {
43
- height: calc(100vh - 200px);
43
+ height: calc(100vh - var(--t-fullsize-modifier, 200px));
44
44
  min-height: var(--layout-min-height, 400px);
45
45
  max-height: var(--layout-max-height, 1000px);
46
46
  }
@@ -1,7 +1,7 @@
1
1
 
2
2
 
3
3
  .tjs__navbar-blox {
4
- --height: 65px;
4
+ --height: var(--t-navbar-height, 64px);
5
5
  position: relative;
6
6
  top: 0;
7
7
  width: 100%;
@@ -1,53 +1,98 @@
1
- html.loader::before {
2
- content: "";
3
- font-family: sans-serif;
4
- font-size: 12px;
5
- line-height: 10px;
6
- position: fixed;
7
- text-align: center;
8
- color: white;
9
- margin-top: 1px;
10
- z-index: 2;
11
- -webkit-animation: leu--site-loader 60s ease-out;
12
- animation: leu--site-loader 30s ease-out;
13
- display: block;
14
- background-color: indianred;
15
- height: 3px;
16
- width: 35%;
1
+ body > .loader > .loader-bar {
2
+ position: relative;
3
+ display: block;
4
+ background-color: lightgrey;
5
+ height: 3px;
6
+ width: 70vw;
7
+ max-width: 500px;
17
8
  top: 0;
9
+ z-index: 1;
10
+ margin-top: 25vh;
11
+ &::before {
12
+ content: "";
13
+ font-family: sans-serif;
14
+ font-size: 12px;
15
+ line-height: 10px;
16
+ position: relative;
17
+ text-align: center;
18
+ color: white;
19
+
20
+ z-index: 2;
21
+ -webkit-animation: leu--site-loader 60s ease-out;
22
+ animation: leu--site-loader 30s ease-out;
23
+ display: block;
24
+ background-color: indianred;
25
+ height: 100%;
26
+ width: 35%;
27
+ top: 0;
28
+ }
29
+ }
30
+
31
+
32
+ @keyframes leu--site-loader {
33
+ 3% {
34
+ width: 75%;
35
+
36
+ }
37
+ 5% {
38
+ width: 90%;
39
+ }
40
+ 10% {
41
+ width: 95%;
42
+ }
43
+ 100% {
44
+ width: 100%;
45
+ }
46
+ }
47
+
48
+
49
+ body {
50
+ min-height: 5000vh; // 3000vh is enough to make sure the page scrolls to correct position on reload
51
+ }
52
+
53
+ body.loaded {
54
+ min-height: unset;
55
+ }
56
+
57
+ body > joda-content {
58
+ opacity: 0;
59
+ transition: opacity 0.10s;
18
60
  }
61
+ body.loaded > joda-content {
62
+ opacity: 1;
63
+ }
64
+
19
65
 
20
- html.loader::after {
21
- content: "";
22
- font-family: sans-serif;
23
- font-size: 12px;
24
- line-height: 10px;
66
+ body > .loader {
25
67
  position: fixed;
26
- text-align: center;
27
- color: white;
28
- margin-top: 1px;
29
- -webkit-animation: leu--site-loader 60s ease-out;
30
- animation: leu--site-loader 60s ease-out;
31
- display: block;
32
- background-color: darkgray;
33
- height: 3px;
68
+ z-index: -99;
34
69
  top: 0;
70
+ left: 0;
35
71
  width: 100%;
36
- right: 0;
72
+ height: 100%;
73
+ background: #fff;
74
+ transition: opacity 0.15s;
75
+ display: flex !important;
76
+
77
+ align-items: center;
78
+ align-content: center;
79
+ justify-content: center;
80
+ opacity: 1;
81
+ flex-wrap: wrap;
82
+ flex-direction: column;
83
+
84
+ & > img {
85
+ flex-direction: column;
86
+ display: block !important;
87
+ height: auto !important;
88
+ width: 70vw !important;
89
+ max-width: 500px;
90
+
91
+ }
37
92
  }
38
93
 
39
- @keyframes leu--site-loader {
40
- 3% {
41
- width: 75%;
42
-
43
- }
44
- 5% {
45
- width: 90%;
46
- }
47
- 10% {
48
- width: 95%;
49
- }
50
- 100% {
51
- width: 100%;
52
- }
94
+ body.loaded > .loader {
95
+ opacity: 0;
96
+ //display: none !important;
97
+ z-index: -99;
53
98
  }
@@ -0,0 +1,27 @@
1
+ import {hitIndex} from "../hit-index";
2
+
3
+ console.time("loader");
4
+ export function initLoader() {
5
+ let interval = setInterval(() => {
6
+ // Detect if body is loaded
7
+ if (document.querySelector("body")) {
8
+ // Cancel interval
9
+ clearInterval(interval);
10
+
11
+ let img = document.querySelector("img").cloneNode(true) as HTMLImageElement;
12
+ let loader = document.createElement("div");
13
+ loader.classList.add("loader");
14
+ loader.appendChild(img);
15
+ img.setAttribute("class", "");
16
+ img.setAttribute("loading", "eager");
17
+
18
+ let loaderBar = document.createElement("div");
19
+ loaderBar.classList.add("loader-bar");
20
+ loader.appendChild(loaderBar);
21
+
22
+ document.querySelector("body").appendChild(loader);
23
+ }
24
+ }, hitIndex === 1 ? 10 : 350); // Wait 350 on subsequent requests to prevent flickering
25
+ }
26
+
27
+
@@ -0,0 +1,8 @@
1
+ const indexName = "themejs_hit_index";
2
+ let state = sessionStorage.getItem(indexName);
3
+ if (state === null) {
4
+ sessionStorage.setItem(indexName, "0");
5
+ }
6
+ sessionStorage.setItem(indexName, "" + (parseInt(sessionStorage.getItem(indexName) ?? "0") + 1));
7
+
8
+ export const hitIndex = parseInt(sessionStorage.getItem(indexName) ?? "0");
@@ -28,7 +28,7 @@
28
28
  margin: var(--t-paragraf-margin);
29
29
  }
30
30
  blockquote > p {
31
- font-size: 2.4em;
31
+ font-size: 2.1em;
32
32
  line-height: 1.2em;
33
33
  color: var(--t-text-color) !important;
34
34
  margin: var(--t-header-margin, 0 0 20px 0);