@pageboard/html 0.12.2 → 0.12.4
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/inlines.js +123 -10
- package/package.json +1 -1
- package/ui/consent.js +3 -3
- package/ui/embed.js +1 -1
- package/ui/fieldset-list.js +9 -9
- package/ui/fieldset.js +6 -6
- package/ui/form.js +11 -10
- package/ui/image.js +17 -7
- package/ui/inlines.css +51 -0
- package/ui/input-range.js +3 -3
- package/ui/layout.js +8 -3
- package/ui/media.js +4 -4
- package/ui/menu.js +1 -1
- package/ui/pagination.js +1 -1
- package/ui/query-tags.js +1 -1
- package/ui/scroll-link.js +1 -1
- package/ui/select.js +3 -3
- package/ui/site.css +1 -39
- package/ui/sitemap.css +1 -0
- package/ui/sitemap.js +1 -1
- package/ui/transition.js +1 -1
package/elements/inlines.js
CHANGED
|
@@ -81,9 +81,127 @@ exports.strike = {
|
|
|
81
81
|
html: '<s></s>'
|
|
82
82
|
};
|
|
83
83
|
|
|
84
|
-
exports.
|
|
84
|
+
exports.style = {
|
|
85
|
+
priority: 99,
|
|
86
|
+
title: "Style",
|
|
87
|
+
icon: '<i class="paint brush icon"></i>',
|
|
88
|
+
contents: "text*",
|
|
89
|
+
inline: true,
|
|
90
|
+
inplace: true,
|
|
91
|
+
group: "inline nolink",
|
|
92
|
+
tag: 'span.style',
|
|
93
|
+
properties: {
|
|
94
|
+
size: {
|
|
95
|
+
title: 'Size',
|
|
96
|
+
default: null,
|
|
97
|
+
anyOf: [{
|
|
98
|
+
const: null,
|
|
99
|
+
title: 'Default',
|
|
100
|
+
icon: '<span class="icon">∅</span>'
|
|
101
|
+
}, {
|
|
102
|
+
const: 'small',
|
|
103
|
+
title: 'Small',
|
|
104
|
+
icon: '<span class="icon char" style="font-size:0.6em">aA</span>'
|
|
105
|
+
}, {
|
|
106
|
+
const: 'base',
|
|
107
|
+
title: 'Base',
|
|
108
|
+
icon: '<span class="icon char" style="font-size:0.8em">aA</span>'
|
|
109
|
+
}, {
|
|
110
|
+
const: 'large',
|
|
111
|
+
title: 'Large',
|
|
112
|
+
icon: '<span class="icon char" style="font-size:1.2em">aA</span>'
|
|
113
|
+
}, {
|
|
114
|
+
const: 'extra',
|
|
115
|
+
title: 'Extra',
|
|
116
|
+
icon: '<span class="icon char" style="font-size:1.6em">aA</span>'
|
|
117
|
+
}]
|
|
118
|
+
},
|
|
119
|
+
transform: {
|
|
120
|
+
title: 'Transform',
|
|
121
|
+
default: null,
|
|
122
|
+
anyOf: [{
|
|
123
|
+
const: null,
|
|
124
|
+
title: 'Default',
|
|
125
|
+
icon: '<span class="icon">∅</span>'
|
|
126
|
+
}, {
|
|
127
|
+
const: "uppercase",
|
|
128
|
+
title: "upper",
|
|
129
|
+
icon: '<span class="icon">AB</span>'
|
|
130
|
+
}, {
|
|
131
|
+
const: "lowercase",
|
|
132
|
+
title: "lower",
|
|
133
|
+
icon: '<span class="icon">ab</span>'
|
|
134
|
+
}, {
|
|
135
|
+
const: "capitalize",
|
|
136
|
+
title: "all caps",
|
|
137
|
+
icon: '<span class="icon" style="text-transform:capitalize">Ab</span>'
|
|
138
|
+
}, {
|
|
139
|
+
const: "smallcaps",
|
|
140
|
+
title: "small caps",
|
|
141
|
+
icon: '<span class="icon" style="font-variant:small-caps">Ab</span>'
|
|
142
|
+
}]
|
|
143
|
+
},
|
|
144
|
+
color: {
|
|
145
|
+
title: 'Color',
|
|
146
|
+
default: null,
|
|
147
|
+
anyOf: [{
|
|
148
|
+
const: null,
|
|
149
|
+
title: 'Default',
|
|
150
|
+
icon: '<span class="icon">∅</span>'
|
|
151
|
+
}, {
|
|
152
|
+
const: "white",
|
|
153
|
+
title: "White",
|
|
154
|
+
icon: '<i class="icon color" style="color:white">W</i>'
|
|
155
|
+
}, {
|
|
156
|
+
const: "black",
|
|
157
|
+
title: "Black",
|
|
158
|
+
icon: '<i class="icon color" style="color:black">B</i>'
|
|
159
|
+
}, {
|
|
160
|
+
const: "red",
|
|
161
|
+
title: "Red",
|
|
162
|
+
icon: '<i class="icon color" style="color:red">R</i>'
|
|
163
|
+
}, {
|
|
164
|
+
const: "orange",
|
|
165
|
+
title: "Orange",
|
|
166
|
+
icon: '<i class="icon color" style="color:orange">O</i>'
|
|
167
|
+
}, {
|
|
168
|
+
const: "yellow",
|
|
169
|
+
title: "Yellow",
|
|
170
|
+
icon: '<i class="icon color" style="color:yellow">Y</i>'
|
|
171
|
+
}, {
|
|
172
|
+
const: "green",
|
|
173
|
+
title: "Green",
|
|
174
|
+
icon: '<i class="icon color" style="color:green">G</i>'
|
|
175
|
+
}, {
|
|
176
|
+
const: "blue",
|
|
177
|
+
title: "Blue",
|
|
178
|
+
icon: '<i class="icon color" style="color:blue">B</i>'
|
|
179
|
+
}, {
|
|
180
|
+
const: "purple",
|
|
181
|
+
title: "Purple",
|
|
182
|
+
icon: '<i class="icon color" style="color:purple">P</i>'
|
|
183
|
+
}]
|
|
184
|
+
}
|
|
185
|
+
},
|
|
186
|
+
parse: function(dom) {
|
|
187
|
+
const data = {};
|
|
188
|
+
for (const [key, schema] of Object.entries(this.properties)) {
|
|
189
|
+
for (const item of schema.anyOf) {
|
|
190
|
+
if (item.const && dom.classList.contains(item.const)) {
|
|
191
|
+
data[key] = item.const;
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
return data;
|
|
196
|
+
},
|
|
197
|
+
html: '<span class="style [size] [transform] [color]"></span>',
|
|
198
|
+
stylesheets: [
|
|
199
|
+
'../ui/inlines.css'
|
|
200
|
+
]
|
|
201
|
+
};
|
|
202
|
+
|
|
203
|
+
exports.caps = { // deprecated
|
|
85
204
|
priority: 108,
|
|
86
|
-
title: "Capitalization",
|
|
87
205
|
icon: '<span class="icon">A<span style="font-variant: small-caps;">a</span></span>',
|
|
88
206
|
contents: "text*",
|
|
89
207
|
inline: true,
|
|
@@ -92,7 +210,7 @@ exports.caps = {
|
|
|
92
210
|
parse: function(dom) {
|
|
93
211
|
return { transform: dom.className };
|
|
94
212
|
},
|
|
95
|
-
tag: 'span.uppercase,span.lowercase,span.capitalize,span.smallcaps',
|
|
213
|
+
tag: 'span.uppercase:not(.style),span.lowercase:not(.style),span.capitalize:not(.style),span.smallcaps:not(.style)',
|
|
96
214
|
properties: {
|
|
97
215
|
transform: {
|
|
98
216
|
title: 'Transform',
|
|
@@ -119,14 +237,9 @@ exports.caps = {
|
|
|
119
237
|
html: '<span class="[transform]"></span>'
|
|
120
238
|
};
|
|
121
239
|
|
|
122
|
-
exports.color = {
|
|
240
|
+
exports.color = { // deprecated
|
|
123
241
|
priority: 109,
|
|
124
|
-
|
|
125
|
-
icon: `<i class="icon" style="background-image:
|
|
126
|
-
linear-gradient(
|
|
127
|
-
to right,
|
|
128
|
-
red, orange, yellow, green, blue, purple
|
|
129
|
-
);"></i>`,
|
|
242
|
+
icon: '<span class="icon">C</span>',
|
|
130
243
|
properties: {
|
|
131
244
|
color: {
|
|
132
245
|
default: "",
|
package/package.json
CHANGED
package/ui/consent.js
CHANGED
|
@@ -13,7 +13,7 @@ class HTMLElementConsent extends Page.create(HTMLFormElement) {
|
|
|
13
13
|
return !tacit;
|
|
14
14
|
}
|
|
15
15
|
setup(state) {
|
|
16
|
-
if (
|
|
16
|
+
if (state.scope.$write) return;
|
|
17
17
|
if (this.options.transient) {
|
|
18
18
|
const tmpl = this.ownTpl.prerender();
|
|
19
19
|
if (tmpl.content && tmpl.children.length == 0) {
|
|
@@ -30,7 +30,7 @@ class HTMLElementConsent extends Page.create(HTMLFormElement) {
|
|
|
30
30
|
}
|
|
31
31
|
handleSubmit(e, state) {
|
|
32
32
|
if (e.type == "submit") e.preventDefault();
|
|
33
|
-
if (
|
|
33
|
+
if (state.scope.$write) return;
|
|
34
34
|
const fd = window.HTMLElementForm.prototype.read.call(this);
|
|
35
35
|
const consent = fd.consent;
|
|
36
36
|
if (consent == null) {
|
|
@@ -44,7 +44,7 @@ class HTMLElementConsent extends Page.create(HTMLFormElement) {
|
|
|
44
44
|
this.handleSubmit(e, state);
|
|
45
45
|
}
|
|
46
46
|
patch(state) {
|
|
47
|
-
if (
|
|
47
|
+
if (state.scope.$write) return;
|
|
48
48
|
if (this.options.transient) {
|
|
49
49
|
this.ownTpl.prerender();
|
|
50
50
|
}
|
package/ui/embed.js
CHANGED
package/ui/fieldset-list.js
CHANGED
|
@@ -83,10 +83,10 @@ class HTMLElementFieldsetList extends Page.Element {
|
|
|
83
83
|
this.#model = model;
|
|
84
84
|
}
|
|
85
85
|
|
|
86
|
-
#prepare() {
|
|
86
|
+
#prepare(scope) {
|
|
87
87
|
const tpl = this.ownTpl;
|
|
88
88
|
tpl.prerender();
|
|
89
|
-
if (
|
|
89
|
+
if (scope.$write) {
|
|
90
90
|
this.#modelize(tpl);
|
|
91
91
|
return;
|
|
92
92
|
}
|
|
@@ -96,13 +96,13 @@ class HTMLElementFieldsetList extends Page.Element {
|
|
|
96
96
|
}
|
|
97
97
|
}
|
|
98
98
|
|
|
99
|
-
patch(
|
|
100
|
-
this.#prepare();
|
|
101
|
-
if (!this.#size) this.#resize(0,
|
|
99
|
+
patch({ scope }) {
|
|
100
|
+
this.#prepare(scope);
|
|
101
|
+
if (!this.#size) this.#resize(0, scope);
|
|
102
102
|
}
|
|
103
103
|
|
|
104
|
-
setup() {
|
|
105
|
-
this.#prepare();
|
|
104
|
+
setup({ scope }) {
|
|
105
|
+
this.#prepare(scope);
|
|
106
106
|
}
|
|
107
107
|
|
|
108
108
|
#selector(name) {
|
|
@@ -110,7 +110,7 @@ class HTMLElementFieldsetList extends Page.Element {
|
|
|
110
110
|
}
|
|
111
111
|
|
|
112
112
|
#resize(size, scope) {
|
|
113
|
-
if (
|
|
113
|
+
if (scope.$write) return;
|
|
114
114
|
const len = Math.max(Number(this.dataset.size) || 0, size);
|
|
115
115
|
if (this.#size === len) return;
|
|
116
116
|
this.#size = len;
|
|
@@ -205,7 +205,7 @@ class HTMLElementFieldsetList extends Page.Element {
|
|
|
205
205
|
}
|
|
206
206
|
|
|
207
207
|
handleClick(e, state) {
|
|
208
|
-
if (
|
|
208
|
+
if (state.scope.$write) return;
|
|
209
209
|
const btn = e.target.closest('button');
|
|
210
210
|
if (!btn) return;
|
|
211
211
|
const action = btn.value;
|
package/ui/fieldset.js
CHANGED
|
@@ -4,8 +4,8 @@ class HTMLElementFieldSet extends Page.create(HTMLFieldSetElement) {
|
|
|
4
4
|
dataValue: null
|
|
5
5
|
};
|
|
6
6
|
|
|
7
|
-
fill(query) {
|
|
8
|
-
if (
|
|
7
|
+
fill(query, scope) {
|
|
8
|
+
if (scope.$write || !this.options?.name || !this.form) return;
|
|
9
9
|
if (!query) query = this.form.read(true);
|
|
10
10
|
const val = query[this.options.name];
|
|
11
11
|
const disabled = this.disabled = this.hidden = val != this.options.value;
|
|
@@ -16,8 +16,8 @@ class HTMLElementFieldSet extends Page.create(HTMLFieldSetElement) {
|
|
|
16
16
|
|
|
17
17
|
patch(state) {
|
|
18
18
|
// before/after form#fill
|
|
19
|
-
this.fill();
|
|
20
|
-
state.finish(() => this.fill());
|
|
19
|
+
this.fill(null, state.scope);
|
|
20
|
+
state.finish(() => this.fill(null, state.scope));
|
|
21
21
|
}
|
|
22
22
|
setup() {
|
|
23
23
|
this.form?.addEventListener('change', this);
|
|
@@ -25,9 +25,9 @@ class HTMLElementFieldSet extends Page.create(HTMLFieldSetElement) {
|
|
|
25
25
|
close() {
|
|
26
26
|
this.form?.removeEventListener('change', this);
|
|
27
27
|
}
|
|
28
|
-
handleEvent(e) {
|
|
28
|
+
handleEvent(e, state) {
|
|
29
29
|
if (e.type == "change") {
|
|
30
|
-
this.fill();
|
|
30
|
+
this.fill(null, state.scope);
|
|
31
31
|
}
|
|
32
32
|
}
|
|
33
33
|
}
|
package/ui/form.js
CHANGED
|
@@ -96,7 +96,7 @@ class HTMLElementForm extends Page.create(HTMLFormElement) {
|
|
|
96
96
|
return window.HTMLElementTemplate.prototype.getRedirect.call(this, status, this);
|
|
97
97
|
}
|
|
98
98
|
patch(state) {
|
|
99
|
-
if (
|
|
99
|
+
if (state.scope.$write) return;
|
|
100
100
|
if (this.method != "get") {
|
|
101
101
|
// ?submit=<name> for auto-submit
|
|
102
102
|
const name = state.query.submit;
|
|
@@ -220,7 +220,7 @@ class HTMLElementForm extends Page.create(HTMLFormElement) {
|
|
|
220
220
|
}
|
|
221
221
|
}
|
|
222
222
|
for (const node of this.querySelectorAll('fieldset[is="element-fieldset"]')) {
|
|
223
|
-
node.fill(query);
|
|
223
|
+
node.fill(query, scope);
|
|
224
224
|
}
|
|
225
225
|
return vars;
|
|
226
226
|
}
|
|
@@ -268,7 +268,7 @@ class HTMLElementForm extends Page.create(HTMLFormElement) {
|
|
|
268
268
|
}
|
|
269
269
|
handleSubmit(e, state) {
|
|
270
270
|
if (e.type == "submit") e.preventDefault();
|
|
271
|
-
if (
|
|
271
|
+
if (state.scope.$write) return;
|
|
272
272
|
this.toggleMessages();
|
|
273
273
|
if (this.matches('.loading')) return;
|
|
274
274
|
if (e.type != "submit" && this.querySelector('[type="submit"]')) return;
|
|
@@ -299,17 +299,18 @@ class HTMLElementForm extends Page.create(HTMLFormElement) {
|
|
|
299
299
|
if (loc.samePathname(state)) {
|
|
300
300
|
loc.query = { ...state.query, ...loc.query };
|
|
301
301
|
}
|
|
302
|
-
|
|
303
|
-
const p = this.ignoreInputChange
|
|
302
|
+
const nstate = this.ignoreInputChange
|
|
304
303
|
? state.replace(loc)
|
|
305
304
|
: state.push(loc);
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
else status = 0;
|
|
309
|
-
}).then(() => {
|
|
305
|
+
nstate.catch(state => {
|
|
306
|
+
const status = state.error?.status ?? 0;
|
|
310
307
|
this.toggleMessages(status);
|
|
311
308
|
});
|
|
312
309
|
}
|
|
310
|
+
catch(state) {
|
|
311
|
+
const status = state.error?.status ?? 0;
|
|
312
|
+
this.toggleMessages(status);
|
|
313
|
+
}
|
|
313
314
|
async postMethod(e, state) {
|
|
314
315
|
if (e.type != "submit") return;
|
|
315
316
|
const form = this;
|
|
@@ -365,7 +366,7 @@ class HTMLElementForm extends Page.create(HTMLFormElement) {
|
|
|
365
366
|
}
|
|
366
367
|
scope.$vary = vary;
|
|
367
368
|
}
|
|
368
|
-
|
|
369
|
+
state.push(loc, { vary });
|
|
369
370
|
}
|
|
370
371
|
}
|
|
371
372
|
window.HTMLElementForm = HTMLElementForm;
|
package/ui/image.js
CHANGED
|
@@ -7,7 +7,7 @@ const HTMLElementImageConstructor = Superclass => class extends Superclass {
|
|
|
7
7
|
static defaultWidth = 240;
|
|
8
8
|
static defaultHeight = 180;
|
|
9
9
|
|
|
10
|
-
#defer
|
|
10
|
+
#defer;
|
|
11
11
|
|
|
12
12
|
static getZoom({ w, h, rw, rh, fit }) {
|
|
13
13
|
let z = 100;
|
|
@@ -93,11 +93,17 @@ const HTMLElementImageConstructor = Superclass => class extends Superclass {
|
|
|
93
93
|
if (this.currentSrc != this.options.src) {
|
|
94
94
|
this.classList.remove('error');
|
|
95
95
|
}
|
|
96
|
-
|
|
97
|
-
|
|
96
|
+
const d = this.dataset;
|
|
97
|
+
if (d.width == null || d.height == null) {
|
|
98
|
+
const meta = state.scope.$hrefs?.[this.options.src];
|
|
99
|
+
if (meta?.width) d.width = meta.width;
|
|
100
|
+
if (meta?.height) d.height = meta.height;
|
|
101
|
+
}
|
|
102
|
+
d.width ??= this.constructor.defaultWidth || "";
|
|
103
|
+
d.height ??= this.constructor.defaultHeight || "";
|
|
98
104
|
const { w, h } = this.dimensions;
|
|
99
|
-
if (w) this.image.width = w ||
|
|
100
|
-
if (h) this.image.height = h ||
|
|
105
|
+
if (w) this.image.width = w || d.width;
|
|
106
|
+
if (h) this.image.height = h || d.height;
|
|
101
107
|
if (!this.currentSrc) {
|
|
102
108
|
this.placeholder();
|
|
103
109
|
}
|
|
@@ -115,6 +121,9 @@ const HTMLElementImageConstructor = Superclass => class extends Superclass {
|
|
|
115
121
|
this.placeholder(true);
|
|
116
122
|
return;
|
|
117
123
|
}
|
|
124
|
+
if (this.classList.contains('loading')) {
|
|
125
|
+
return;
|
|
126
|
+
}
|
|
118
127
|
const fit = this.fit;
|
|
119
128
|
const r = this.crop;
|
|
120
129
|
|
|
@@ -146,16 +155,17 @@ const HTMLElementImageConstructor = Superclass => class extends Superclass {
|
|
|
146
155
|
const rh = rect.height;
|
|
147
156
|
if (rw == 0 && rh == 0) {
|
|
148
157
|
// don't show
|
|
149
|
-
return
|
|
158
|
+
return;
|
|
150
159
|
}
|
|
151
160
|
loc.query.rs = "z-" + this.constructor.getZoom({ w, h, rw, rh, fit });
|
|
152
161
|
}
|
|
153
162
|
const curSrc = loc.toString();
|
|
154
163
|
if (curSrc != this.currentSrc) {
|
|
155
164
|
this.classList.add('loading');
|
|
165
|
+
this.#defer = new Deferred();
|
|
156
166
|
img.setAttribute('src', curSrc);
|
|
167
|
+
return this.#defer;
|
|
157
168
|
}
|
|
158
|
-
return this.#defer;
|
|
159
169
|
}
|
|
160
170
|
captureLoad() {
|
|
161
171
|
this.#defer.resolve();
|
package/ui/inlines.css
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
span.lighter {
|
|
2
|
+
font-weight:lighter;
|
|
3
|
+
}
|
|
4
|
+
span.capitalize {
|
|
5
|
+
text-transform:capitalize;
|
|
6
|
+
}
|
|
7
|
+
span.lowercase {
|
|
8
|
+
text-transform:lowercase;
|
|
9
|
+
}
|
|
10
|
+
span.uppercase {
|
|
11
|
+
text-transform:uppercase;
|
|
12
|
+
}
|
|
13
|
+
span.smallcaps {
|
|
14
|
+
font-variant:small-caps;
|
|
15
|
+
}
|
|
16
|
+
span.black {
|
|
17
|
+
color: black;
|
|
18
|
+
}
|
|
19
|
+
span.white {
|
|
20
|
+
color: white;
|
|
21
|
+
}
|
|
22
|
+
span.red {
|
|
23
|
+
color: red;
|
|
24
|
+
}
|
|
25
|
+
span.orange {
|
|
26
|
+
color: orange;
|
|
27
|
+
}
|
|
28
|
+
span.yellow {
|
|
29
|
+
color: yellow;
|
|
30
|
+
}
|
|
31
|
+
span.green {
|
|
32
|
+
color: green;
|
|
33
|
+
}
|
|
34
|
+
span.blue {
|
|
35
|
+
color: blue;
|
|
36
|
+
}
|
|
37
|
+
span.purple {
|
|
38
|
+
color: purple;
|
|
39
|
+
}
|
|
40
|
+
span.small {
|
|
41
|
+
font-size: 0.8em;
|
|
42
|
+
}
|
|
43
|
+
span.base {
|
|
44
|
+
font-size: 1.2em;
|
|
45
|
+
}
|
|
46
|
+
span.large {
|
|
47
|
+
font-size: 1.6em;
|
|
48
|
+
}
|
|
49
|
+
span.extra {
|
|
50
|
+
font-size: 2em;
|
|
51
|
+
}
|
package/ui/input-range.js
CHANGED
|
@@ -82,7 +82,7 @@ class HTMLElementInputRange extends Page.create(HTMLInputElement) {
|
|
|
82
82
|
start: opts.multiple ? [null, null] : [null],
|
|
83
83
|
connect: true
|
|
84
84
|
}, this.convertOptions(opts))).on('change', (values) => {
|
|
85
|
-
if (
|
|
85
|
+
if (state.scope.$write) return;
|
|
86
86
|
const isInt = parseInt(opts.step) == opts.step;
|
|
87
87
|
helper.classList.remove('indeterminate');
|
|
88
88
|
if (isInt) values = values.map(n => parseInt(n));
|
|
@@ -96,8 +96,8 @@ class HTMLElementInputRange extends Page.create(HTMLInputElement) {
|
|
|
96
96
|
helper.addEventListener('dblclick', this, true);
|
|
97
97
|
this.patch(state);
|
|
98
98
|
}
|
|
99
|
-
handleEvent(e) {
|
|
100
|
-
if (
|
|
99
|
+
handleEvent(e, state) {
|
|
100
|
+
if (state.scope.$write) return;
|
|
101
101
|
if (e.type == "dblclick" || e.keyCode == 8 || e.keyCode == 46) {
|
|
102
102
|
this.fill();
|
|
103
103
|
this.dispatchEvent(new Event('change', {
|
package/ui/layout.js
CHANGED
|
@@ -8,6 +8,8 @@ class HTMLElementLayout extends Page.create(HTMLDivElement) {
|
|
|
8
8
|
dataPosition:null
|
|
9
9
|
};
|
|
10
10
|
|
|
11
|
+
#defer;
|
|
12
|
+
|
|
11
13
|
get fit() {
|
|
12
14
|
return this.options.size || 'none';
|
|
13
15
|
}
|
|
@@ -63,11 +65,14 @@ class HTMLElementLayout extends Page.create(HTMLDivElement) {
|
|
|
63
65
|
// pass
|
|
64
66
|
}
|
|
65
67
|
this.style.backgroundImage = `url(${curSrc})`;
|
|
68
|
+
this.#defer = new Deferred();
|
|
69
|
+
const img = new Image();
|
|
70
|
+
img.addEventListener('load', this.#defer.resolve);
|
|
71
|
+
img.addEventListener('error', this.#defer.resolve);
|
|
72
|
+
img.src = curSrc;
|
|
73
|
+
return this.#defer;
|
|
66
74
|
}
|
|
67
75
|
}
|
|
68
|
-
captureLoad() {}
|
|
69
|
-
captureError() {}
|
|
70
|
-
placeholder() {}
|
|
71
76
|
}
|
|
72
77
|
|
|
73
78
|
(function(HTMLElementImage) {
|
package/ui/media.js
CHANGED
|
@@ -14,11 +14,11 @@ const HTMLElementMediaConstructor = Superclass => class extends Superclass {
|
|
|
14
14
|
}
|
|
15
15
|
this.setAttribute('src', curSrc);
|
|
16
16
|
}
|
|
17
|
-
if (
|
|
18
|
-
return this.#defer;
|
|
17
|
+
if (state.scope.$write) this.pause();
|
|
18
|
+
// return this.#defer; // do not hang chain
|
|
19
19
|
}
|
|
20
|
-
handleClick(e) {
|
|
21
|
-
if (
|
|
20
|
+
handleClick(e, state) {
|
|
21
|
+
if (state.scope.$write) e.preventDefault();
|
|
22
22
|
}
|
|
23
23
|
captureLoad() {
|
|
24
24
|
this.#defer.resolve();
|
package/ui/menu.js
CHANGED
|
@@ -24,7 +24,7 @@ class HTMLElementMenu extends Page.Element {
|
|
|
24
24
|
});
|
|
25
25
|
}
|
|
26
26
|
setup(state) {
|
|
27
|
-
if (
|
|
27
|
+
if (state.scope.$write || this.matches('.vertical')) return;
|
|
28
28
|
const menu = this.firstElementChild;
|
|
29
29
|
const helper = this.lastElementChild;
|
|
30
30
|
if (helper == menu) {
|
package/ui/pagination.js
CHANGED
package/ui/query-tags.js
CHANGED
|
@@ -27,7 +27,7 @@ class HTMLElementQueryTags extends Page.Element {
|
|
|
27
27
|
const query = state.query;
|
|
28
28
|
state.finish(() => {
|
|
29
29
|
this.labels.textContent = '';
|
|
30
|
-
if (
|
|
30
|
+
if (state.scope.$write) this.insertLabel('', '', 'Auto');
|
|
31
31
|
else for (const [name, val] of Object.entries(query)) {
|
|
32
32
|
this.add(name, val);
|
|
33
33
|
}
|
package/ui/scroll-link.js
CHANGED
|
@@ -4,7 +4,7 @@ class HTMLScrollLinkElement extends Page.create(HTMLAnchorElement) {
|
|
|
4
4
|
};
|
|
5
5
|
|
|
6
6
|
handleClick(e, state) {
|
|
7
|
-
if (
|
|
7
|
+
if (state.scope.$write) return;
|
|
8
8
|
if (this.options.to == "home") {
|
|
9
9
|
const main = document.querySelector('body > main') || document.body;
|
|
10
10
|
main.scrollIntoView({
|
package/ui/select.js
CHANGED
|
@@ -24,7 +24,7 @@ class HTMLElementSelect extends Page.Element {
|
|
|
24
24
|
}
|
|
25
25
|
|
|
26
26
|
handleClick(e, state) {
|
|
27
|
-
if (
|
|
27
|
+
if (state.scope.$write) return;
|
|
28
28
|
const node = e.target;
|
|
29
29
|
const item = node.closest('element-select .item');
|
|
30
30
|
if (item) {
|
|
@@ -143,7 +143,7 @@ class HTMLElementSelect extends Page.Element {
|
|
|
143
143
|
}
|
|
144
144
|
|
|
145
145
|
build(state) {
|
|
146
|
-
if (
|
|
146
|
+
if (state.scope.$write) return;
|
|
147
147
|
if (this.children.length == 1) {
|
|
148
148
|
this.insertAdjacentHTML(
|
|
149
149
|
'afterBegin',
|
|
@@ -169,7 +169,7 @@ class HTMLElementSelect extends Page.Element {
|
|
|
169
169
|
}
|
|
170
170
|
|
|
171
171
|
patch(state) {
|
|
172
|
-
if (this.
|
|
172
|
+
if (this.state.scope.$write) return;
|
|
173
173
|
if (this.children.length == 1) this.build(state);
|
|
174
174
|
|
|
175
175
|
state.finish(() => {
|
package/ui/site.css
CHANGED
|
@@ -106,45 +106,7 @@ p:last-child {
|
|
|
106
106
|
text-align:justify;
|
|
107
107
|
}
|
|
108
108
|
|
|
109
|
-
|
|
110
|
-
font-weight:lighter;
|
|
111
|
-
}
|
|
112
|
-
span.capitalize {
|
|
113
|
-
text-transform:capitalize;
|
|
114
|
-
}
|
|
115
|
-
span.lowercase {
|
|
116
|
-
text-transform:lowercase;
|
|
117
|
-
}
|
|
118
|
-
span.uppercase {
|
|
119
|
-
text-transform:uppercase;
|
|
120
|
-
}
|
|
121
|
-
span.smallcaps {
|
|
122
|
-
font-variant:small-caps;
|
|
123
|
-
}
|
|
124
|
-
span.black {
|
|
125
|
-
color: black;
|
|
126
|
-
}
|
|
127
|
-
span.white {
|
|
128
|
-
color: white;
|
|
129
|
-
}
|
|
130
|
-
span.red {
|
|
131
|
-
color: red;
|
|
132
|
-
}
|
|
133
|
-
span.orange {
|
|
134
|
-
color: orange;
|
|
135
|
-
}
|
|
136
|
-
span.yellow {
|
|
137
|
-
color: yellow;
|
|
138
|
-
}
|
|
139
|
-
span.green {
|
|
140
|
-
color: green;
|
|
141
|
-
}
|
|
142
|
-
span.blue {
|
|
143
|
-
color: blue;
|
|
144
|
-
}
|
|
145
|
-
span.purple {
|
|
146
|
-
color: purple;
|
|
147
|
-
}
|
|
109
|
+
|
|
148
110
|
|
|
149
111
|
/*-------------------
|
|
150
112
|
Links
|
package/ui/sitemap.css
CHANGED
package/ui/sitemap.js
CHANGED
|
@@ -53,7 +53,7 @@ class HTMLElementSitemap extends Page.Element {
|
|
|
53
53
|
}
|
|
54
54
|
|
|
55
55
|
async build(state) {
|
|
56
|
-
if (this.firstElementChild.children.length > 0 &&
|
|
56
|
+
if (this.firstElementChild.children.length > 0 && state.scope.$write) {
|
|
57
57
|
// workaround... build is called a second time with pagecut-placeholder set
|
|
58
58
|
return;
|
|
59
59
|
}
|
package/ui/transition.js
CHANGED
|
@@ -131,7 +131,7 @@ Page.constructor.prototype.mergeBody = function (body, corpse) {
|
|
|
131
131
|
if (this.referrer.scope.transition) {
|
|
132
132
|
this.referrer.scope.transition.end();
|
|
133
133
|
}
|
|
134
|
-
if (
|
|
134
|
+
if (this.scope.$write || body.getAttribute('block-type') != corpse.getAttribute('block-type')) {
|
|
135
135
|
corpse.replaceWith(body);
|
|
136
136
|
} else {
|
|
137
137
|
this.scope.transition = new Transition(this, body, corpse);
|