@pageboard/html 0.16.1 → 0.16.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.
@@ -3,26 +3,11 @@ exports.medialist = {
3
3
  priority: 20,
4
4
  group: "block",
5
5
  icon: '<i class="list icon"></i>',
6
- properties: {
7
- size: {
8
- title: 'Size',
9
- anyOf: [{
10
- type: 'null',
11
- title: 'Normal'
12
- }, {
13
- const: 'small',
14
- title: 'Small'
15
- }, {
16
- const: 'large',
17
- title: 'Large'
18
- }]
19
- }
20
- },
21
6
  menu: "widget",
22
7
  contents: "medialist_item+",
23
- html: '<div class="ui items unstackable medialist [size]"></div>',
8
+ html: '<div class="ui items unstackable medialist"></div>',
24
9
  stylesheets: [
25
- '../ui/medialist.css',
10
+ '../ui/item.css',
26
11
  ]
27
12
  };
28
13
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pageboard/html",
3
- "version": "0.16.1",
3
+ "version": "0.16.3",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "repository": {
package/ui/consent.js CHANGED
@@ -17,43 +17,38 @@ class HTMLElementConsent extends Page.create(HTMLFormElement) {
17
17
  if (!tacit) this.explicits.add(consent);
18
18
  return tacit ? "yes" : null;
19
19
  }
20
- paint(state) {
20
+ setup(state) {
21
21
  if (state.scope.$write) return;
22
22
  this.constructor.explicits = new Set();
23
23
  const view = this.ownView;
24
24
  view.textContent = '';
25
25
  const tmpl = this.ownTpl.prerender();
26
26
  view.appendChild(tmpl.content.cloneNode(true));
27
- window.HTMLElementForm.prototype.fill.call(this, state.scope.storage.all());
28
27
  state.chain('consent', this);
29
28
  }
30
29
  chainConsent(state) {
31
30
  if (this.options.transient) {
32
31
  this.classList.remove('visible');
32
+ } else {
33
+ window.HTMLElementForm.prototype.fill.call(this, state.scope.storage.all());
33
34
  }
34
35
  }
35
36
  handleChange(e, state) {
36
37
  if (e.type == "submit" || !this.elements.find(item => item.type == "submit")) {
37
- setTimeout(() => {
38
- // let fieldset handle change first
39
- this.handleSubmit(e, state);
40
- }, 10);
38
+ this.handleSubmit(e, state);
41
39
  }
42
40
  }
43
41
  handleSubmit(e, state) {
44
42
  if (e.type == "submit") e.preventDefault();
45
43
  if (state.scope.$write) return;
46
44
  const consents = window.HTMLElementForm.prototype.read.call(this);
47
- const names = new Set();
48
- for (const node of this.elements) {
49
- if (node.name?.startsWith('consent.')) names.add(node.name);
50
- }
45
+ const list = Array.from(this.constructor.explicits);
51
46
  const def = consents.consent;
52
- if (def != "custom") for (const consent of names) {
53
- consents[consent] = def;
47
+ for (const consent of list) {
48
+ if (def != "custom") consents[consent] = def;
54
49
  }
55
- if (Array.from(names).some(c => consents[c] == null)) {
56
- // not all consents have been answered
50
+ if (list.some(c => consents[c] == null)) {
51
+ // not all explicit consents have been answered
57
52
  return;
58
53
  }
59
54
  for (const [key, val] of Object.entries(consents)) {
package/ui/embed.js CHANGED
@@ -14,13 +14,16 @@ class HTMLElementEmbed extends Page.Element {
14
14
  get currentSrc() {
15
15
  return this.querySelector('iframe')?.getAttribute('src');
16
16
  }
17
- patch(state) {
18
- const { src } = this.options;
19
- if (!src) return;
20
- const { width, height, source } = state.scope.$hrefs?.[src] ?? {};
21
- if (source) this.dataset.source = source;
17
+ #meta() {
18
+ const { width, height } = this.dataset;
22
19
  if (width && height) this.style.paddingBottom = `calc(${height} / ${width} * 100%)`;
23
20
  }
21
+ patch(state) {
22
+ this.#meta(state);
23
+ }
24
+ paint(state) {
25
+ this.#meta(state);
26
+ }
24
27
  consent(state) {
25
28
  const consent = state.scope.storage.get(this.constructor.consent);
26
29
  this.classList.toggle('denied', consent == "no");
package/ui/form.js CHANGED
@@ -101,8 +101,6 @@ class HTMLElementForm extends Page.create(HTMLFormElement) {
101
101
  if (state.scope.$write) return;
102
102
  const name = state.query.submit; // explicit auto-submit
103
103
  if (name && name == this.name || this.elements.length == 0 && this.action != state.toString()) {
104
- // FIXME
105
- // button target="" makes it not part of elements ?
106
104
  if (state.scope.$read) {
107
105
  console.info("form#paint would auto-submit:", this.action);
108
106
  } else {
package/ui/image.js CHANGED
@@ -66,7 +66,7 @@ const HTMLElementImageConstructor = Superclass => class extends Superclass {
66
66
  return img;
67
67
  }
68
68
 
69
- patch(state) {
69
+ #meta() {
70
70
  const {
71
71
  dataset: d,
72
72
  image,
@@ -79,11 +79,6 @@ const HTMLElementImageConstructor = Superclass => class extends Superclass {
79
79
  this.classList.remove('error');
80
80
  }
81
81
 
82
- if (d.width == null || d.height == null) {
83
- const meta = state.scope.$hrefs?.[this.options.src];
84
- if (meta?.width) d.width = meta.width;
85
- if (meta?.height) d.height = meta.height;
86
- }
87
82
  d.width ??= constructor.defaultWidth || "";
88
83
  d.height ??= constructor.defaultHeight || "";
89
84
  image.width = w || d.width;
@@ -97,6 +92,13 @@ const HTMLElementImageConstructor = Superclass => class extends Superclass {
97
92
  }
98
93
  }
99
94
 
95
+ patch() {
96
+ this.#meta();
97
+ }
98
+ paint() {
99
+ this.#meta();
100
+ }
101
+
100
102
  get currentSrc() {
101
103
  return this.image?.currentSrc;
102
104
  }
package/ui/item.css ADDED
@@ -0,0 +1,448 @@
1
+ .ui.items.medialist {
2
+ margin:0;
3
+ }
4
+ .ui.items.medialist > .ui {
5
+ min-height:4em;
6
+ }
7
+ .medialist > .ui > .image > .image {
8
+ position: absolute;
9
+ overflow: hidden;
10
+ max-height: 100%;
11
+ max-width: 100%;
12
+ }
13
+
14
+
15
+ .ui.items > .ui {
16
+ display: flex;
17
+ margin: 1em 0em;
18
+ width: 100%;
19
+ min-height: 0px;
20
+ background: transparent;
21
+ padding: 0em;
22
+ border: none;
23
+ border-radius: 0rem;
24
+ box-shadow: none;
25
+ transition: box-shadow 0.1s ease;
26
+ z-index: "";
27
+ font-size: 1em;
28
+ }
29
+ .ui.items > .ui a {
30
+ cursor: pointer;
31
+ }
32
+
33
+ /*--------------
34
+ Items
35
+ ---------------*/
36
+
37
+ .ui.items {
38
+ margin: 1.5em 0em;
39
+ }
40
+ .ui.items:first-child {
41
+ margin-top: 0em !important;
42
+ }
43
+ .ui.items:last-child {
44
+ margin-bottom: 0em !important;
45
+ }
46
+
47
+ /*--------------
48
+ Item
49
+ ---------------*/
50
+
51
+ .ui.items > .ui::after {
52
+ display: block;
53
+ content: " ";
54
+ height: 0px;
55
+ clear: both;
56
+ overflow: hidden;
57
+ visibility: hidden;
58
+ }
59
+ .ui.items > .ui:first-child {
60
+ margin-top: 0em;
61
+ }
62
+ .ui.items > .ui:last-child {
63
+ margin-bottom: 0em;
64
+ }
65
+
66
+ /*--------------
67
+ Images
68
+ ---------------*/
69
+
70
+ .ui.items > .ui > .image {
71
+ position: relative;
72
+ flex: 0 0 auto;
73
+ display: block;
74
+ float: none;
75
+ margin: 0em;
76
+ padding: 0em;
77
+ max-height: "";
78
+ align-self: top;
79
+ width:175px;
80
+ }
81
+ .ui.items > .ui > .image > img {
82
+ display: block;
83
+ width: 100%;
84
+ height: auto;
85
+ border-radius: 0.125rem;
86
+ border: none;
87
+ }
88
+ .ui.items > .ui > .image:only-child > img {
89
+ border-radius: 0rem;
90
+ }
91
+
92
+ /*--------------
93
+ Content
94
+ ---------------*/
95
+
96
+ .ui.items > .ui > .content {
97
+ display: block;
98
+ flex: 1 1 auto;
99
+ background: none;
100
+ margin: 0em;
101
+ padding: 0em;
102
+ box-shadow: none;
103
+ font-size: 1em;
104
+ border: none;
105
+ border-radius: 0em;
106
+ }
107
+ .ui.items > .ui > .content::after {
108
+ display: block;
109
+ content: " ";
110
+ height: 0px;
111
+ clear: both;
112
+ overflow: hidden;
113
+ visibility: hidden;
114
+ }
115
+ .ui.items > .ui > .image + .content {
116
+ min-width: 0;
117
+ width: auto;
118
+ display: block;
119
+ margin-left: 0em;
120
+ align-self: top;
121
+ padding-left: 1.5em;
122
+ }
123
+ .ui.items > .ui > .content > .header {
124
+ display: inline-block;
125
+ margin: -0.2142em 0em 0em;
126
+ font-family: Lato, "Helvetica Neue", Arial, Helvetica, sans-serif;
127
+ font-weight: bold;
128
+ color: rgb(0 0 0 / 85%);
129
+ }
130
+
131
+ /* Default Header Size */
132
+ .ui.items > .ui > .content > .header:not(.ui) {
133
+ font-size: 1.2857em;
134
+ }
135
+
136
+ /*--------------
137
+ Floated
138
+ ---------------*/
139
+
140
+ .ui.items > .ui [class*="left floated"] {
141
+ float: left;
142
+ }
143
+ .ui.items > .ui [class*="right floated"] {
144
+ float: right;
145
+ }
146
+
147
+ /*--------------
148
+ Content Image
149
+ ---------------*/
150
+
151
+ .ui.items > .ui .content img {
152
+ align-self: middle;
153
+ width: "";
154
+ }
155
+ .ui.items > .ui img.avatar,
156
+ .ui.items > .ui .avatar img {
157
+ width: "";
158
+ height: "";
159
+ border-radius: 500rem;
160
+ }
161
+
162
+ /*--------------
163
+ Description
164
+ ---------------*/
165
+
166
+ .ui.items > .ui > .content > .description {
167
+ margin-top: 0.6em;
168
+ max-width: auto;
169
+ font-size: 1em;
170
+ line-height: 1.4285em;
171
+ color: rgb(0 0 0 / 87%);
172
+ }
173
+
174
+ /*--------------
175
+ Paragraph
176
+ ---------------*/
177
+
178
+ .ui.items > .ui > .content p {
179
+ margin: 0em 0em 0.5em;
180
+ }
181
+ .ui.items > .ui > .content p:last-child {
182
+ margin-bottom: 0em;
183
+ }
184
+
185
+ /*--------------
186
+ Meta
187
+ ---------------*/
188
+
189
+ .ui.items > .ui .meta {
190
+ margin: 0.5em 0em;
191
+ font-size: 1em;
192
+ line-height: 1em;
193
+ color: rgb(0 0 0 / 60%);
194
+ }
195
+ .ui.items > .ui .meta * {
196
+ margin-right: 0.3em;
197
+ }
198
+ .ui.items > .ui .meta :last-child {
199
+ margin-right: 0em;
200
+ }
201
+ .ui.items > .ui .meta [class*="right floated"] {
202
+ margin-right: 0em;
203
+ margin-left: 0.3em;
204
+ }
205
+
206
+ /*--------------
207
+ Links
208
+ ---------------*/
209
+
210
+
211
+ /* Generic */
212
+ .ui.items > .ui > .content a:not(.ui) {
213
+ color: "";
214
+ transition: color 0.1s ease;
215
+ }
216
+ .ui.items > .ui > .content a:not(.ui):hover {
217
+ color: "";
218
+ }
219
+
220
+ /* Header */
221
+ .ui.items > .ui > .content > a.header {
222
+ color: rgb(0 0 0 / 85%);
223
+ }
224
+ .ui.items > .ui > .content > a.header:hover {
225
+ color: #1e70bf;
226
+ }
227
+
228
+ /* Meta */
229
+ .ui.items > .ui .meta > a:not(.ui) {
230
+ color: rgb(0 0 0 / 40%);
231
+ }
232
+ .ui.items > .ui .meta > a:not(.ui):hover {
233
+ color: rgb(0 0 0 / 87%);
234
+ }
235
+
236
+ /*--------------
237
+ Labels
238
+ ---------------*/
239
+
240
+
241
+ /*-----Star----- */
242
+
243
+
244
+ /* Icon */
245
+ .ui.items > .ui > .content .favorite.icon {
246
+ cursor: pointer;
247
+ opacity: 0.75;
248
+ transition: color 0.1s ease;
249
+ }
250
+ .ui.items > .ui > .content .favorite.icon:hover {
251
+ opacity: 1;
252
+ color: #FFB70A;
253
+ }
254
+ .ui.items > .ui > .content .active.favorite.icon {
255
+ color: #FFE623;
256
+ }
257
+
258
+ /*-----Like----- */
259
+
260
+
261
+ /* Icon */
262
+ .ui.items > .ui > .content .like.icon {
263
+ cursor: pointer;
264
+ opacity: 0.75;
265
+ transition: color 0.1s ease;
266
+ }
267
+ .ui.items > .ui > .content .like.icon:hover {
268
+ opacity: 1;
269
+ color: #FF2733;
270
+ }
271
+ .ui.items > .ui > .content .active.like.icon {
272
+ color: #FF2733;
273
+ }
274
+
275
+ /*----------------
276
+ Extra Content
277
+ -----------------*/
278
+
279
+ .ui.items > .ui .extra {
280
+ display: block;
281
+ position: relative;
282
+ background: none;
283
+ margin: 0.5rem 0em 0em;
284
+ width: 100%;
285
+ padding: 0em;
286
+ top: 0em;
287
+ left: 0em;
288
+ color: rgb(0 0 0 / 40%);
289
+ box-shadow: none;
290
+ transition: color 0.1s ease;
291
+ border-top: none;
292
+ }
293
+ .ui.items > .ui .extra > * {
294
+ margin: 0.25rem 0.5rem 0.25rem 0em;
295
+ }
296
+ .ui.items > .ui .extra > [class*="right floated"] {
297
+ margin: 0.25rem 0em 0.25rem 0.5rem;
298
+ }
299
+ .ui.items > .ui .extra::after {
300
+ display: block;
301
+ content: " ";
302
+ height: 0px;
303
+ clear: both;
304
+ overflow: hidden;
305
+ visibility: hidden;
306
+ }
307
+
308
+
309
+ /*******************************
310
+ Responsive
311
+ *******************************/
312
+
313
+
314
+ .ui.one.items > .ui > .image {
315
+ width: 100%;
316
+ }
317
+ .ui.two.items > .ui > .image {
318
+ width: calc(50% - 1em);
319
+ margin-right: 1em;
320
+ }
321
+ .ui.three.items > .ui > .image {
322
+ width: calc(33.3333% - 1em);
323
+ margin-right: 1em;
324
+ }
325
+ .ui.four.items > .ui > .image {
326
+ width: calc(25% - 0.75em);
327
+ margin-right: 0.75em;
328
+ }
329
+ .ui.five.items > .ui > .image {
330
+ width: calc(20% - 0.75em);
331
+ margin-right: 0.75em;
332
+ }
333
+ .ui.six.items > .ui > .image {
334
+ width: calc(16.6667% - 0.75em);
335
+ margin-right: 0.75em;
336
+ }
337
+ .ui.seven.items > .ui > .image {
338
+ width: calc(14.2857% - 0.5em);
339
+ margin-right: 0.5em;
340
+ }
341
+
342
+ @media (width >= 512px) and (width <= 991px) {
343
+ /* Tablet Only */
344
+ .ui.items > .ui {
345
+ margin: 1em 0em;
346
+ }
347
+ .ui.items > .ui > .image + .content {
348
+ display: block;
349
+ padding: 0em 0em 0em 1em;
350
+ }
351
+ }
352
+
353
+ @media (width <= 511px) {
354
+ /* Mobile Only */
355
+ .ui.items.stackable > .ui {
356
+ flex-direction: column;
357
+ margin: 2em 0em;
358
+ }
359
+ .ui.items.stackable > .ui > .image {
360
+ display: block;
361
+ margin-left: auto;
362
+ margin-right: auto;
363
+ }
364
+ .ui.items.stackable > .ui > .image,
365
+ .ui.items.stackable > .ui > .image > img {
366
+ max-width: 100% !important;
367
+ width: 100% !important;
368
+ max-height: 250px !important;
369
+ }
370
+ .ui.items.stackable > .ui > .image + .content {
371
+ display: block;
372
+ padding: 1.5em 0em 0em;
373
+ }
374
+ }
375
+
376
+
377
+ /*******************************
378
+ Variations
379
+ *******************************/
380
+
381
+
382
+ /*-------------------
383
+ Aligned
384
+ --------------------*/
385
+
386
+ .ui.items > .ui > .image + [class*="top aligned"].content {
387
+ align-self: flex-start;
388
+ }
389
+ .ui.items > .ui > .image + [class*="middle aligned"].content {
390
+ align-self: center;
391
+ }
392
+ .ui.items > .ui > .image + [class*="bottom aligned"].content {
393
+ align-self: flex-end;
394
+ }
395
+
396
+ /*--------------
397
+ Relaxed
398
+ ---------------*/
399
+
400
+ .ui.relaxed.items > .ui {
401
+ margin: 1.5em 0em;
402
+ }
403
+ .ui[class*="very relaxed"].items > .ui {
404
+ margin: 2em 0em;
405
+ }
406
+
407
+ /*-------------------
408
+ Divided
409
+ --------------------*/
410
+
411
+ .ui.divided.items > .ui {
412
+ border-top: 1px solid rgb(34 36 38 / 15%);
413
+ margin: 0em;
414
+ padding: 1em 0em;
415
+ }
416
+ .ui.divided.items > .ui:first-child {
417
+ border-top: none;
418
+ margin-top: 0em !important;
419
+ padding-top: 0em !important;
420
+ }
421
+ .ui.divided.items > .ui:last-child {
422
+ margin-bottom: 0em !important;
423
+ padding-bottom: 0em !important;
424
+ }
425
+
426
+ /* Relaxed Divided */
427
+ .ui.relaxed.divided.items > .ui {
428
+ margin: 0em;
429
+ padding: 1.5em 0em;
430
+ }
431
+ .ui[class*="very relaxed"].divided.items > .ui {
432
+ margin: 0em;
433
+ padding: 2em 0em;
434
+ }
435
+
436
+ /*-------------------
437
+ Link
438
+ --------------------*/
439
+
440
+ .ui.items a.ui:hover,
441
+ .ui.link.items > .ui:hover {
442
+ cursor: pointer;
443
+ }
444
+ .ui.items a.ui:hover .content .header,
445
+ .ui.link.items > .ui:hover .content .header {
446
+ color: #1e70bf;
447
+ }
448
+
package/ui/layout.js CHANGED
@@ -10,7 +10,6 @@ class HTMLElementLayout extends Page.create(HTMLDivElement) {
10
10
  return this.style.backgroundSize || 'none';
11
11
  }
12
12
  reveal(state) {
13
- // FIXME all layout triggers unneeded observer reveal, because it's only for backgroundImage
14
13
  if (!this.options.src) {
15
14
  this.style.backgroundImage = '';
16
15
  return;
package/ui/media.js CHANGED
@@ -1,9 +1,6 @@
1
1
  const HTMLElementMediaConstructor = Superclass => class extends Superclass {
2
-
3
- patch(state) {
4
- this.classList.remove('error', 'loading');
5
- }
6
2
  reveal(state) {
3
+ this.classList.remove('error', 'loading');
7
4
  const curSrc = this.options.src;
8
5
  if (curSrc != this.currentSrc) {
9
6
  try {
@@ -31,15 +28,6 @@ class HTMLElementVideo extends HTMLElementMediaConstructor(Page.create(HTMLVideo
31
28
  static defaults = {
32
29
  dataSrc: null
33
30
  };
34
- patch(state) {
35
- super.patch(state);
36
- const { url } = this.options;
37
- if (!url) return;
38
- const { title, width, height } = state.scope.$hrefs?.[url] ?? {};
39
- if (title) this.title = title;
40
- if (width) this.width = width;
41
- if (height) this.height = height;
42
- }
43
31
  }
44
32
  Page.define('element-video', HTMLElementVideo, 'video');
45
33
 
package/ui/medialist.css CHANGED
@@ -1,51 +1,12 @@
1
- .medialist {
2
- margin: 1.5em 0em;
1
+ .ui.items.medialist {
2
+ margin:0;
3
3
  }
4
-
5
- .medialist > .item {
6
- display: flex;
4
+ .ui.items.medialist > .item {
7
5
  min-height:4em;
8
6
  }
9
-
10
- .medialist > .item > .image {
11
- flex: 0 0 auto;
12
- width: 175px;
13
- }
14
-
15
- .medialist.small > .item > .image {
16
- width: 100px;
17
- }
18
-
19
- .medialist.large > .item > .image {
20
- width: 250px;
21
- }
22
-
23
- .medialist > .item > .content {
24
- flex: 1 1 auto;
25
- }
26
-
27
- .medialist:first-child {
28
- margin-top: 0em !important;
29
- }
30
-
31
- .medialist:last-child {
32
- margin-bottom: 0em !important;
33
- }
34
-
35
- @media (width <= 511px) {
36
- /* Mobile Only */
37
- .medialist > .item {
38
- flex-direction: column;
39
- margin: 2em 0em;
40
- }
41
- .medialist > .item > .image {
42
- display: block;
43
- margin-left: auto;
44
- margin-right: auto;
45
- max-width: 100% !important;
46
- width: 100% !important;
47
- }
48
- .medialist > .item > .content {
49
- display: block;
50
- }
7
+ .medialist > .item > .image > .image {
8
+ position: absolute;
9
+ overflow: hidden;
10
+ max-height: 100%;
11
+ max-width: 100%;
51
12
  }
package/ui/transition.js CHANGED
@@ -139,8 +139,6 @@ class Transition {
139
139
  this.root.classList.remove('transition', 'transitioning');
140
140
  this.root.scrollTop = top;
141
141
  this.root.scrollLeft = left;
142
- delete this.from;
143
- delete this.to;
144
142
  delete this.state.scope.transition;
145
143
  delete this.state;
146
144
  }