@webqit/webflo 0.20.53 → 0.20.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/package.json CHANGED
@@ -12,7 +12,7 @@
12
12
  "vanila-javascript"
13
13
  ],
14
14
  "homepage": "https://webqit.io/tooling/webflo",
15
- "version": "0.20.53",
15
+ "version": "0.20.55",
16
16
  "license": "MIT",
17
17
  "repository": {
18
18
  "type": "git",
@@ -58,12 +58,16 @@ export class DeviceViewport {
58
58
  return el;
59
59
  }
60
60
 
61
- #scheduleRender() {
61
+ #scheduleRender(lag = 0) {
62
62
  if (this.#timer) return;
63
- this.#timer = requestAnimationFrame(() => {
64
- this.#render();
65
- this.#timer = null;
66
- });
63
+ const exec = () => {
64
+ this.#timer = requestAnimationFrame(() => {
65
+ this.#render();
66
+ this.#timer = null;
67
+ });
68
+ };
69
+ if (!lag) return exec();
70
+ setTimeout(exec, lag);
67
71
  }
68
72
 
69
73
  #render() {
@@ -152,29 +156,31 @@ export class DeviceViewport {
152
156
  return [k.replace(/-([a-z])/g, g => g[1].toUpperCase()), v || true];
153
157
  }));
154
158
 
155
- push(id, config, priority = 1) {
159
+ push(id, config, { priority = 1, lag = 0 } = {}) {
156
160
  if (!id) throw new Error("push() requires a unique ID");
157
161
  if (this.#stack.some(e => e.id === id)) return;
158
162
 
159
163
  const peek = this.peek();
160
164
  if (peek._priority - priority >= 0.2) {
161
- this.#stack.push({ ...config, ...peek, id, _priority: priority });
165
+ this.#stack.push({ ...config, ...peek, id, _priority: priority, _lag: lag });
162
166
  } else {
163
- this.#stack.push({ ...peek, ...config, id, _priority: priority });
167
+ this.#stack.push({ ...peek, ...config, id, _priority: priority, _lag: lag });
164
168
  }
165
169
 
166
- this.#scheduleRender();
170
+ this.#scheduleRender(lag);
167
171
  }
168
172
 
169
173
  pop(...ids) {
170
174
  if (!ids.length) throw new Error("pop() requires a target ID");
175
+ let lag = 0;
171
176
  ids.forEach((id) => {
172
177
  const idx = this.#stack.findIndex(e => e.id === id);
173
178
  if (idx > 0) { // Never pop the initial state at index 0
174
- this.#stack.splice(idx, 1);
179
+ const [entry] = this.#stack.splice(idx, 1);
180
+ lag = Math.max(lag, entry._lag);
175
181
  }
176
182
  });
177
- this.#scheduleRender();
183
+ this.#scheduleRender(lag);
178
184
  }
179
185
 
180
186
  peek() { return this.#stack[this.#stack.length - 1]; }
@@ -41,7 +41,7 @@ export class WebfloClient extends AppRuntime {
41
41
  super(bootstrap);
42
42
  this.#host = host;
43
43
  Object.defineProperty(this.host, 'webfloRuntime', { get: () => this });
44
- this.#location = new URLPlus(this.host.location);
44
+ this.#location = new URLPlus(decodeURI(this.host.location.href), undefined, { compatMode: false });
45
45
  this.#navigator = {
46
46
  requesting: null,
47
47
  redirecting: null,
@@ -51,7 +51,7 @@ export class WebfloClient extends AppRuntime {
51
51
  };
52
52
  this.#transition = {
53
53
  from: new URLPlus(window.origin),
54
- to: new URLPlus(this.host.location),
54
+ to: new URLPlus(decodeURI(this.host.location.href)),
55
55
  rel: 'unrelated',
56
56
  phase: 0
57
57
  };
@@ -437,7 +437,7 @@ export class WebfloClient extends AppRuntime {
437
437
  // Transition UI
438
438
  await this.transitionUI(async () => {
439
439
  // Set post-request states
440
- Observer.set(this.location, 'href', scopeObj.finalUrl);
440
+ Observer.set(this.location, 'href', decodeURI(scopeObj.finalUrl));
441
441
  scopeObj.resetStates();
442
442
 
443
443
  // Error?
@@ -571,6 +571,9 @@ export class WebfloClient extends AppRuntime {
571
571
  await synthesizeWhile(async () => {
572
572
  Observer.set(this.transition, 'phase', 'old');
573
573
  const viewTransition = document.startViewTransition({ update: updateCallback, types: ['navigation', viewTransitionRel] });
574
+ if (detail.navigationType) {
575
+ viewTransition.types.add(detail.navigationType);
576
+ }
574
577
  try { await viewTransition.updateCallbackDone; } catch (e) { console.log(e); }
575
578
  Observer.set(this.transition, 'phase', 'new');
576
579
  try { await viewTransition.ready; } catch (e) { console.log(e); }
@@ -529,7 +529,7 @@ export class ModalElement extends BaseElement {
529
529
  setTimeout(() => {
530
530
  if (minmaxEvents) observer.observe(this.#spacingElement);
531
531
  if (swipeDismiss) observer.observe(this.#sentinelElement);
532
- }, 200);
532
+ }, 300);
533
533
 
534
534
  this.#unbindMinmaxWorker = () => observer.disconnect();
535
535
  }
@@ -703,11 +703,13 @@ export class ModalElement extends BaseElement {
703
703
  --backdrop-filter: var(--modal-backdrop-filter, blur(3px));
704
704
 
705
705
  --radius-length: var(--modal-radius, 1rem);
706
+ --entry-exit-transition-duration: var(--modal-entry-exit-transition-duration, 0.3s);
706
707
 
707
708
  --background: var(--modal-background, rgba(80, 80, 80, 1));
708
709
 
709
710
  --background-accent: var(--modal-background-accent, var(--background));
710
711
  --color-accent: var(--modal-color-accent, var(--color-default));
712
+ --radius-accent: var(--modal-radius-accent, 0px);
711
713
 
712
714
  --color-default: var(--modal-color-default, whitesmoke);
713
715
  --color-info: var(--modal-color-info, whitesmoke);
@@ -789,10 +791,10 @@ export class ModalElement extends BaseElement {
789
791
 
790
792
  :host {
791
793
  transition:
792
- opacity 0.2s,
793
- transform 0.2s,
794
- overlay 0.2s allow-discrete,
795
- display 0.2s allow-discrete;
794
+ opacity var(--entry-exit-transition-duration),
795
+ transform var(--entry-exit-transition-duration),
796
+ overlay var(--entry-exit-transition-duration) allow-discrete,
797
+ display var(--entry-exit-transition-duration) allow-discrete;
796
798
  transition-timing-function: ease-out;
797
799
 
798
800
  transform: var(--exit-transform);
@@ -816,10 +818,10 @@ export class ModalElement extends BaseElement {
816
818
 
817
819
  :host::backdrop {
818
820
  transition:
819
- display 0.2s allow-discrete,
820
- overlay 0.2s allow-discrete,
821
- backdrop-filter 0.2s,
822
- background 0.2s;
821
+ display var(--entry-exit-transition-duration) allow-discrete,
822
+ overlay var(--entry-exit-transition-duration) allow-discrete,
823
+ backdrop-filter var(--entry-exit-transition-duration),
824
+ background var(--entry-exit-transition-duration);
823
825
  }
824
826
 
825
827
  :host(:popover-open)::backdrop {
@@ -1394,6 +1396,7 @@ export class ModalElement extends BaseElement {
1394
1396
  :host(._horz) .view {
1395
1397
  overflow-y: hidden;
1396
1398
  overflow-x: auto;
1399
+ scrollbar-width: none;
1397
1400
 
1398
1401
  scroll-timeline-axis: inline;
1399
1402
  }
@@ -30,7 +30,7 @@ export class HttpEvent111 {
30
30
  node._context.parentEvent = this;
31
31
  });
32
32
 
33
- this.#url = new URLPlus(this.#init.request.url, undefined, { immutable: true });
33
+ this.#url = new URLPlus(this.#init.request.url, undefined, { immutable: true, compatMode: false });
34
34
 
35
35
  this._parentEvent?.signal.addEventListener('abort', () => this.#abortController.abort(), { once: true });
36
36
  this.#init.request.signal?.addEventListener('abort', () => this.#abortController.abort(), { once: true });
@@ -600,6 +600,10 @@ export class WebfloServer extends AppRuntime {
600
600
  responseMeta.set('static', true);
601
601
  responseMeta.set('index', scopeObj.index);
602
602
 
603
+ if (FLAGS['dev'] && httpEvent.url.pathname === '/@hmr') {
604
+ response.headers.set('Cache-Control', 'no-store');
605
+ }
606
+
603
607
  return response;
604
608
  };
605
609