@pacem/pacem-ui 2.0.0-kepler → 2.0.0-lyapunov
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/dist/browser/pacem-ui.js +116 -30
- package/dist/browser/pacem-ui.js.map +1 -1
- package/dist/browser/pacem-ui.min.js +2 -2
- package/dist/bundle/pacem-ui.min.mjs +42 -42
- package/dist/bundle/pacem-ui.mjs +109 -26
- package/dist/bundle/pacem-ui.mjs.map +2 -2
- package/dist/docs/pacem-ui.json +75 -0
- package/dist/esm/adapter.js +1 -1
- package/dist/esm/anchor.js +1 -1
- package/dist/esm/balloon.js +1 -1
- package/dist/esm/binder.js +1 -1
- package/dist/esm/blade.js +1 -1
- package/dist/esm/bottom-sheet.js +1 -1
- package/dist/esm/button.js +1 -1
- package/dist/esm/buttonset.js +1 -1
- package/dist/esm/calendar.js +1 -1
- package/dist/esm/collapse.js +1 -1
- package/dist/esm/dialog-abstractions.js +1 -1
- package/dist/esm/dialog.js +1 -1
- package/dist/esm/divider.js +1 -1
- package/dist/esm/icon.js +1 -1
- package/dist/esm/image.js +1 -1
- package/dist/esm/index-components-ui.js +1 -1
- package/dist/esm/index-components.js +1 -1
- package/dist/esm/index-iife.js +1 -1
- package/dist/esm/index.js +1 -1
- package/dist/esm/infinite-scroller.js +1 -1
- package/dist/esm/iterative.js +1 -1
- package/dist/esm/lightbox-abstractions.js +1 -1
- package/dist/esm/lightbox.js +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/esm/markdown-svc.js +1 -1
- package/dist/esm/markdown.js +1 -1
- package/dist/esm/marquee.js +1 -1
- package/dist/esm/media-query.js +1 -1
- package/dist/esm/menu.js +1 -1
- package/dist/esm/pager.js +1 -1
- package/dist/esm/picture.js +1 -1
- package/dist/esm/progressbar.js +1 -1
- package/dist/esm/sidebar.js +1 -1
- package/dist/esm/slideshow.js +1 -1
- package/dist/esm/social-twitter.js +1 -1
- package/dist/esm/sticky-header.js +1 -1
- package/dist/esm/tabs.js +1 -1
- package/dist/esm/ticker.js +1 -1
- package/dist/esm/toast.js +1 -1
- package/dist/esm/toc.js +1 -1
- package/dist/esm/tuner.js +1 -1
- package/dist/esm/types.js +1 -1
- package/dist/esm/vibration.js +1 -1
- package/dist/esm/view.js +116 -31
- package/dist/esm/window.js +1 -1
- package/package.json +1 -1
- package/typings/index.d.ts +33 -0
package/dist/bundle/pacem-ui.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @pacem/pacem-ui v2.0.0-
|
|
2
|
+
* @pacem/pacem-ui v2.0.0-lyapunov (https://js.pacem.it)
|
|
3
3
|
* Pacem (https://pacem.it)
|
|
4
4
|
* Licensed under Apache-2.0
|
|
5
5
|
*/
|
|
@@ -5968,9 +5968,93 @@ var PacemViewElement = class PacemViewElement2 extends PacemEventTarget6 {
|
|
|
5968
5968
|
this._manageRef();
|
|
5969
5969
|
}
|
|
5970
5970
|
}
|
|
5971
|
+
disconnectedCallback() {
|
|
5972
|
+
this._dispose(this.url);
|
|
5973
|
+
super.disconnectedCallback();
|
|
5974
|
+
}
|
|
5971
5975
|
_isReference(url) {
|
|
5972
5976
|
return url instanceof HTMLElement || typeof url === "string" && url.trim().startsWith("#");
|
|
5973
5977
|
}
|
|
5978
|
+
/**
|
|
5979
|
+
* Resolves a reference source to its element, as {@link _manageRef} does: the element itself, or the
|
|
5980
|
+
* `<template>` a `#id` string points to; `null` for anything else.
|
|
5981
|
+
*/
|
|
5982
|
+
_resolveRef(source) {
|
|
5983
|
+
if (source instanceof HTMLElement) {
|
|
5984
|
+
return source;
|
|
5985
|
+
}
|
|
5986
|
+
if (typeof source !== "string" || !this._isReference(source)) {
|
|
5987
|
+
return null;
|
|
5988
|
+
}
|
|
5989
|
+
return document.querySelector("template" + source);
|
|
5990
|
+
}
|
|
5991
|
+
/**
|
|
5992
|
+
* Whether `url` is the source of the initial content ({@link initialContentUrl}): urls match by their string,
|
|
5993
|
+
* references by the element they resolve to. Any other source consumes it.
|
|
5994
|
+
*/
|
|
5995
|
+
_isInitialContent(url) {
|
|
5996
|
+
const initial = this.initialContentUrl;
|
|
5997
|
+
if (Utils32.isNull(initial)) {
|
|
5998
|
+
return false;
|
|
5999
|
+
}
|
|
6000
|
+
let matches = false;
|
|
6001
|
+
if (!this._isReference(url)) {
|
|
6002
|
+
matches = typeof url === "string" && url === initial;
|
|
6003
|
+
} else if (this._isReference(initial)) {
|
|
6004
|
+
const target = this._resolveRef(url);
|
|
6005
|
+
matches = !Utils32.isNull(target) && target === this._resolveRef(initial);
|
|
6006
|
+
}
|
|
6007
|
+
if (!matches) {
|
|
6008
|
+
this.initialContentUrl = null;
|
|
6009
|
+
}
|
|
6010
|
+
return matches;
|
|
6011
|
+
}
|
|
6012
|
+
/**
|
|
6013
|
+
* Keeps the initial content: announced once, as a fresh content would be (a reference may be managed twice on
|
|
6014
|
+
* activation: the second time, it was announced already).
|
|
6015
|
+
*/
|
|
6016
|
+
_adoptInitialContent() {
|
|
6017
|
+
clearTimeout(this._fetchHandle);
|
|
6018
|
+
if (this.#renderVersion > 0) {
|
|
6019
|
+
return;
|
|
6020
|
+
}
|
|
6021
|
+
this._render(null);
|
|
6022
|
+
}
|
|
6023
|
+
/**
|
|
6024
|
+
* The rendering pipeline of every content: a new version, `prerender`, the content on the next frame, `render`
|
|
6025
|
+
* (dropped when newer content came meanwhile).
|
|
6026
|
+
* @param fill Writes the new content (the former one is cleared first); `null` keeps the content already there
|
|
6027
|
+
* (the initial content), which also leaves {@link initialContentUrl} in place.
|
|
6028
|
+
* @param waitForAnimation Whether `render` waits for the view's css transition (see `fetching`) instead of
|
|
6029
|
+
* following the content right away.
|
|
6030
|
+
*/
|
|
6031
|
+
_render(fill, waitForAnimation = false) {
|
|
6032
|
+
cancelAnimationFrame(this._renderHandle);
|
|
6033
|
+
const version = ++this.#renderVersion;
|
|
6034
|
+
const replacing = !Utils32.isNull(fill);
|
|
6035
|
+
if (replacing) {
|
|
6036
|
+
this.initialContentUrl = null;
|
|
6037
|
+
this.innerHTML = "";
|
|
6038
|
+
}
|
|
6039
|
+
this._dispatchPrerender();
|
|
6040
|
+
this._renderHandle = requestAnimationFrame(() => {
|
|
6041
|
+
if (replacing) {
|
|
6042
|
+
fill();
|
|
6043
|
+
}
|
|
6044
|
+
if (!waitForAnimation) {
|
|
6045
|
+
this._dispatchRenderOf(version);
|
|
6046
|
+
return;
|
|
6047
|
+
}
|
|
6048
|
+
Utils32.addAnimationEndCallback(this, () => this._dispatchRenderOf(version), ANIM_TIMEOUT);
|
|
6049
|
+
});
|
|
6050
|
+
}
|
|
6051
|
+
/** Dispatches `render` for the content of `version`, unless newer content superseded it. */
|
|
6052
|
+
_dispatchRenderOf(version) {
|
|
6053
|
+
if (version !== this.#renderVersion) {
|
|
6054
|
+
return;
|
|
6055
|
+
}
|
|
6056
|
+
this._dispatchRender();
|
|
6057
|
+
}
|
|
5974
6058
|
_dispose(url) {
|
|
5975
6059
|
if (url instanceof Components33.PacemTemplateProxyElement) {
|
|
5976
6060
|
url.removeEventListener("templatechange", this._templateChangeHandler);
|
|
@@ -5981,22 +6065,32 @@ var PacemViewElement = class PacemViewElement2 extends PacemEventTarget6 {
|
|
|
5981
6065
|
return;
|
|
5982
6066
|
}
|
|
5983
6067
|
const debounce = this.debounce || 0, url = this.url;
|
|
5984
|
-
;
|
|
5985
6068
|
if (this._isReference(url)) {
|
|
5986
6069
|
clearTimeout(this._fetchHandle);
|
|
5987
6070
|
this._fetchHandle = setTimeout((() => this._manageRef()), debounce);
|
|
5988
6071
|
} else if (typeof url === "string" && !Utils32.isNullOrEmpty(url)) {
|
|
6072
|
+
if (this._isInitialContent(url)) {
|
|
6073
|
+
this._adoptInitialContent();
|
|
6074
|
+
return;
|
|
6075
|
+
}
|
|
5989
6076
|
this.fetching = true;
|
|
5990
6077
|
clearTimeout(this._fetchHandle);
|
|
5991
6078
|
this._fetchHandle = setTimeout((() => this._manageUrl(url)), debounce);
|
|
5992
6079
|
} else {
|
|
5993
6080
|
this.innerHTML = "";
|
|
6081
|
+
this.initialContentUrl = null;
|
|
5994
6082
|
}
|
|
5995
6083
|
}
|
|
5996
6084
|
_manageRef() {
|
|
5997
|
-
const url = this.url, tmpl =
|
|
6085
|
+
const url = this.url, tmpl = this._resolveRef(url);
|
|
5998
6086
|
if (tmpl instanceof Components33.PacemTemplateProxyElement) {
|
|
5999
6087
|
tmpl.addEventListener("templatechange", this._templateChangeHandler, false);
|
|
6088
|
+
}
|
|
6089
|
+
if (this._isInitialContent(url)) {
|
|
6090
|
+
this._adoptInitialContent();
|
|
6091
|
+
return;
|
|
6092
|
+
}
|
|
6093
|
+
if (tmpl instanceof Components33.PacemTemplateProxyElement) {
|
|
6000
6094
|
this._setTmpl(tmpl.target);
|
|
6001
6095
|
} else if (tmpl instanceof HTMLTemplateElement) {
|
|
6002
6096
|
this._setTmpl(tmpl);
|
|
@@ -6007,17 +6101,13 @@ var PacemViewElement = class PacemViewElement2 extends PacemEventTarget6 {
|
|
|
6007
6101
|
}
|
|
6008
6102
|
}
|
|
6009
6103
|
_setTmpl(tmpl) {
|
|
6010
|
-
|
|
6011
|
-
|
|
6012
|
-
|
|
6013
|
-
|
|
6014
|
-
this.
|
|
6015
|
-
|
|
6016
|
-
|
|
6017
|
-
return;
|
|
6018
|
-
}
|
|
6019
|
-
this.appendChild(tmpl.cloneNode(true).content);
|
|
6020
|
-
this._dispatchRender();
|
|
6104
|
+
if (Utils32.isNull(tmpl)) {
|
|
6105
|
+
this.log(Logging4.LogLevel.Error, `Template element not found.`);
|
|
6106
|
+
return;
|
|
6107
|
+
}
|
|
6108
|
+
this._render(() => {
|
|
6109
|
+
const clone = tmpl.cloneNode(true);
|
|
6110
|
+
this.appendChild(clone.content);
|
|
6021
6111
|
});
|
|
6022
6112
|
}
|
|
6023
6113
|
#aborter;
|
|
@@ -6070,22 +6160,12 @@ var PacemViewElement = class PacemViewElement2 extends PacemEventTarget6 {
|
|
|
6070
6160
|
});
|
|
6071
6161
|
}
|
|
6072
6162
|
_manageResult(result) {
|
|
6073
|
-
cancelAnimationFrame(this._renderHandle);
|
|
6074
|
-
const version = ++this.#renderVersion;
|
|
6075
6163
|
this.scrollTo({ top: 0, left: 0, behavior: "instant" });
|
|
6076
|
-
this.
|
|
6077
|
-
this._dispatchPrerender();
|
|
6078
|
-
this._renderHandle = requestAnimationFrame(() => {
|
|
6164
|
+
this._render(() => {
|
|
6079
6165
|
this.innerHTML = result;
|
|
6080
6166
|
this.fetching = false;
|
|
6081
6167
|
this.progress = Number.NaN;
|
|
6082
|
-
|
|
6083
|
-
if (version !== this.#renderVersion) {
|
|
6084
|
-
return;
|
|
6085
|
-
}
|
|
6086
|
-
this._dispatchRender();
|
|
6087
|
-
}, ANIM_TIMEOUT);
|
|
6088
|
-
});
|
|
6168
|
+
}, true);
|
|
6089
6169
|
}
|
|
6090
6170
|
#resizeHandle;
|
|
6091
6171
|
_dispatchRender() {
|
|
@@ -6120,6 +6200,9 @@ __decorate37([
|
|
|
6120
6200
|
__decorate37([
|
|
6121
6201
|
Watch34({ emit: false, converter: PropertyConverters32.Number })
|
|
6122
6202
|
], PacemViewElement.prototype, "debounce", void 0);
|
|
6203
|
+
__decorate37([
|
|
6204
|
+
Watch34({ emit: false, converter: ElementOrStringPropertyConverter })
|
|
6205
|
+
], PacemViewElement.prototype, "initialContentUrl", void 0);
|
|
6123
6206
|
PacemViewElement = __decorate37([
|
|
6124
6207
|
CustomElement35({
|
|
6125
6208
|
tagName: P36 + "-view"
|