@pageboard/html 0.12.1 → 0.12.2
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/elements/image.js +4 -0
- package/elements/media.js +1 -1
- package/package.json +1 -1
- package/ui/image.js +2 -10
- package/ui/layout.js +0 -8
- package/ui/media.js +0 -5
- package/ui/transition.css +15 -17
- package/ui/transition.js +6 -6
package/elements/image.js
CHANGED
|
@@ -132,6 +132,8 @@ exports.image = {
|
|
|
132
132
|
class="[display.fit|or:none] [display.horizontal|or:] [display.vertical|or:]"
|
|
133
133
|
alt="[alt]"
|
|
134
134
|
data-src="[url]"
|
|
135
|
+
data-width="[url|meta:width]"
|
|
136
|
+
data-height="[url|meta:height]"
|
|
135
137
|
data-crop="[crop.x|or:50];[crop.y|or:50];[crop.width|or:100];[crop.height|or:100];[crop.zoom|or:100]"
|
|
136
138
|
>
|
|
137
139
|
<div block-content="legend"></div>
|
|
@@ -279,6 +281,8 @@ exports.inlineImage = {
|
|
|
279
281
|
tag: "img",
|
|
280
282
|
html: `<img is="element-img"
|
|
281
283
|
data-src="[url]"
|
|
284
|
+
data-width="[url|meta:width]"
|
|
285
|
+
data-height="[url|meta:height]"
|
|
282
286
|
data-crop="[crop.x];[crop.y];[crop.width];[crop.height];[crop.zoom]"
|
|
283
287
|
alt="" class="ui inline image
|
|
284
288
|
[display.avatar]
|
package/elements/media.js
CHANGED
|
@@ -67,7 +67,7 @@ exports.video = {
|
|
|
67
67
|
},
|
|
68
68
|
html: `<video is="element-video" data-src="[url]" class="[display.fit|or:none]"
|
|
69
69
|
preload="metadata" autoplay="[autoplay]" loop="[loop]"
|
|
70
|
-
muted="[muted]" controls="[controls]"></video>`,
|
|
70
|
+
muted="[muted]" controls="[controls]" width="[url|meta:width]" height="[url|meta:height]"></video>`,
|
|
71
71
|
scripts: [
|
|
72
72
|
'../ui/media.js'
|
|
73
73
|
],
|
package/package.json
CHANGED
package/ui/image.js
CHANGED
|
@@ -93,16 +93,8 @@ const HTMLElementImageConstructor = Superclass => class extends Superclass {
|
|
|
93
93
|
if (this.currentSrc != this.options.src) {
|
|
94
94
|
this.classList.remove('error');
|
|
95
95
|
}
|
|
96
|
-
this.dataset.width
|
|
97
|
-
this.dataset.height
|
|
98
|
-
if (this.options.src) {
|
|
99
|
-
const loc = Page.parse(this.options.src);
|
|
100
|
-
const meta = state.scope.$hrefs?.[loc.pathname];
|
|
101
|
-
if (meta) {
|
|
102
|
-
this.dataset.width = meta.width;
|
|
103
|
-
this.dataset.height = meta.height;
|
|
104
|
-
}
|
|
105
|
-
}
|
|
96
|
+
this.dataset.width ??= this.constructor.defaultWidth || "";
|
|
97
|
+
this.dataset.height ??= this.constructor.defaultHeight || "";
|
|
106
98
|
const { w, h } = this.dimensions;
|
|
107
99
|
if (w) this.image.width = w || this.dataset.width;
|
|
108
100
|
if (h) this.image.height = h || this.dataset.height;
|
package/ui/layout.js
CHANGED
|
@@ -11,14 +11,6 @@ class HTMLElementLayout extends Page.create(HTMLDivElement) {
|
|
|
11
11
|
get fit() {
|
|
12
12
|
return this.options.size || 'none';
|
|
13
13
|
}
|
|
14
|
-
patch(state) {
|
|
15
|
-
if (!this.options.src) return;
|
|
16
|
-
const loc = Page.parse(this.options.src);
|
|
17
|
-
const meta = state.scope.$hrefs?.[loc.pathname] ?? {};
|
|
18
|
-
if (!meta || !meta.width || !meta.height) return;
|
|
19
|
-
this.dataset.width = meta.width;
|
|
20
|
-
this.dataset.height = meta.height;
|
|
21
|
-
}
|
|
22
14
|
reveal(state) {
|
|
23
15
|
this.style.backgroundRepeat = this.options.repeat;
|
|
24
16
|
this.style.backgroundSize = this.options.size;
|
package/ui/media.js
CHANGED
|
@@ -3,11 +3,6 @@ const HTMLElementMediaConstructor = Superclass => class extends Superclass {
|
|
|
3
3
|
|
|
4
4
|
patch(state) {
|
|
5
5
|
this.classList.remove('error', 'loading');
|
|
6
|
-
const loc = Page.parse(this.options.src);
|
|
7
|
-
const meta = state.scope.$hrefs?.[loc.pathname] ?? {};
|
|
8
|
-
if (!meta || !meta.width || !meta.height) return;
|
|
9
|
-
this.width = meta.width;
|
|
10
|
-
this.height = meta.height;
|
|
11
6
|
}
|
|
12
7
|
reveal(state) {
|
|
13
8
|
const curSrc = this.options.src;
|
package/ui/transition.css
CHANGED
|
@@ -1,47 +1,45 @@
|
|
|
1
1
|
/* async progress bar and error signal */
|
|
2
2
|
|
|
3
|
-
body::
|
|
3
|
+
body::before {
|
|
4
4
|
content: "";
|
|
5
5
|
position:fixed;
|
|
6
6
|
display:block;
|
|
7
7
|
left:0;
|
|
8
|
-
top:
|
|
8
|
+
top:0px;
|
|
9
9
|
width:0%;
|
|
10
10
|
height:0;
|
|
11
11
|
opacity:0.7;
|
|
12
12
|
background: #4486cc;
|
|
13
13
|
box-shadow: 0 0 5px rgb(99 162 235 / 70%);
|
|
14
|
-
z-index:
|
|
14
|
+
z-index:10000000;
|
|
15
15
|
}
|
|
16
|
-
html[data-stage] > body::
|
|
16
|
+
html[data-stage] > body::before {
|
|
17
17
|
transition-property:width;
|
|
18
|
-
transition-duration:
|
|
18
|
+
transition-duration:0.5s;
|
|
19
19
|
transition-timing-function:linear;
|
|
20
20
|
}
|
|
21
|
-
html[data-stage="route"] > body::
|
|
22
|
-
html[data-stage="ready"] > body::
|
|
23
|
-
html[data-stage="
|
|
24
|
-
html[data-stage="error"] > body::
|
|
21
|
+
html[data-stage="route"] > body::before,
|
|
22
|
+
html[data-stage="ready"] > body::before,
|
|
23
|
+
html[data-stage="paint"] > body::before,
|
|
24
|
+
html[data-stage="error"] > body::before {
|
|
25
25
|
height:2px;
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
-
html[data-stage="route"] > body::
|
|
28
|
+
html[data-stage="route"] > body::before {
|
|
29
|
+
width:25%;
|
|
30
|
+
}
|
|
31
|
+
html[data-stage="ready"] > body::before {
|
|
29
32
|
width:50%;
|
|
30
33
|
}
|
|
31
|
-
html[data-stage="
|
|
32
|
-
html[data-stage="setup"] > body::after {
|
|
34
|
+
html[data-stage="paint"] > body::before {
|
|
33
35
|
width:100%;
|
|
34
36
|
}
|
|
35
|
-
html[data-stage="error"] > body::
|
|
37
|
+
html[data-stage="error"] > body::before {
|
|
36
38
|
display:block;
|
|
37
39
|
width:100%;
|
|
38
40
|
background:#c33;
|
|
39
41
|
}
|
|
40
42
|
|
|
41
|
-
html.transition > body::after {
|
|
42
|
-
display:none !important;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
43
|
/* transitions */
|
|
46
44
|
html.transition {
|
|
47
45
|
width:100%;
|
package/ui/transition.js
CHANGED
|
@@ -9,15 +9,15 @@ Page.route(state => {
|
|
|
9
9
|
const root = document.documentElement;
|
|
10
10
|
function dtr(state) {
|
|
11
11
|
root.dataset.stage = state.stage;
|
|
12
|
-
if (state.stage == "
|
|
13
|
-
setTimeout(() => root.removeAttribute('data-stage'),
|
|
12
|
+
if (state.stage == "paint") {
|
|
13
|
+
setTimeout(() => root.removeAttribute('data-stage'), 700);
|
|
14
14
|
}
|
|
15
15
|
}
|
|
16
16
|
dtr(state);
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
17
|
+
state.ready(dtr);
|
|
18
|
+
state.patch(dtr);
|
|
19
|
+
state.paint(dtr);
|
|
20
|
+
state.catch(dtr);
|
|
21
21
|
});
|
|
22
22
|
|
|
23
23
|
class Transition {
|