@pacem/pacem-ui 1.0.0-abel
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/LICENSE +191 -0
- package/NOTICE +4 -0
- package/dist/browser/pacem-ui.js +6343 -0
- package/dist/browser/pacem-ui.js.map +1 -0
- package/dist/browser/pacem-ui.min.js +2 -0
- package/dist/browser/pacem-ui.min.js.map +1 -0
- package/dist/bundle/pacem-ui.min.mjs +168 -0
- package/dist/bundle/pacem-ui.mjs +6276 -0
- package/dist/bundle/pacem-ui.mjs.map +7 -0
- package/dist/esm/adapter.js +360 -0
- package/dist/esm/anchor.js +149 -0
- package/dist/esm/balloon.js +583 -0
- package/dist/esm/binder.js +678 -0
- package/dist/esm/blade.js +31 -0
- package/dist/esm/bottom-sheet.js +277 -0
- package/dist/esm/button.js +100 -0
- package/dist/esm/buttonset.js +41 -0
- package/dist/esm/calendar.js +662 -0
- package/dist/esm/collapse.js +72 -0
- package/dist/esm/dialog-abstractions.js +61 -0
- package/dist/esm/dialog.js +102 -0
- package/dist/esm/divider.js +48 -0
- package/dist/esm/icon.js +131 -0
- package/dist/esm/image.js +109 -0
- package/dist/esm/index-components-ui.js +41 -0
- package/dist/esm/index-components.js +1 -0
- package/dist/esm/index-iife.js +3 -0
- package/dist/esm/index.js +1 -0
- package/dist/esm/infinite-scroller.js +137 -0
- package/dist/esm/iterative.js +45 -0
- package/dist/esm/lightbox-abstractions.js +6 -0
- package/dist/esm/lightbox.js +203 -0
- package/dist/esm/loader.js +100 -0
- package/dist/esm/markdown-svc.js +235 -0
- package/dist/esm/markdown.js +35 -0
- package/dist/esm/marquee.js +87 -0
- package/dist/esm/media-query.js +85 -0
- package/dist/esm/menu.js +165 -0
- package/dist/esm/pager.js +111 -0
- package/dist/esm/picture.js +157 -0
- package/dist/esm/progressbar.js +54 -0
- package/dist/esm/sidebar.js +60 -0
- package/dist/esm/slideshow.js +27 -0
- package/dist/esm/social-twitter.js +39 -0
- package/dist/esm/sticky-header.js +113 -0
- package/dist/esm/tabs.js +187 -0
- package/dist/esm/ticker.js +78 -0
- package/dist/esm/toast.js +171 -0
- package/dist/esm/toc.js +171 -0
- package/dist/esm/tuner.js +200 -0
- package/dist/esm/types.js +7 -0
- package/dist/esm/vibration.js +33 -0
- package/dist/esm/view.js +206 -0
- package/dist/esm/window.js +181 -0
- package/package.json +38 -0
- package/typings/index.d.ts +1165 -0
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
import { P, PCSS, Utils, CustomElement, Watch, ViewChild, PropertyConverters, Components, Defaults, Debounce } from '@pacem/pacem-core';
|
|
8
|
+
//namespace Pacem.Components.UI {
|
|
9
|
+
let PacemPagerElement = class PacemPagerElement extends Components.PacemElement {
|
|
10
|
+
propertyChangedCallback(name, old, val, first) {
|
|
11
|
+
super.propertyChangedCallback(name, old, val, first);
|
|
12
|
+
switch (name) {
|
|
13
|
+
case 'index':
|
|
14
|
+
case 'total':
|
|
15
|
+
case 'pages':
|
|
16
|
+
case 'size':
|
|
17
|
+
case 'mode':
|
|
18
|
+
this._databind();
|
|
19
|
+
break;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
_databind() {
|
|
23
|
+
const repeater = this._repeater;
|
|
24
|
+
if (Utils.isNull(repeater))
|
|
25
|
+
return;
|
|
26
|
+
//
|
|
27
|
+
var datasource = [];
|
|
28
|
+
const size = this.size ?? 10, pages = this.pages ?? 5, total = this.total ?? 0, index = this.index ?? 0, mode = this.mode ?? 'standard';
|
|
29
|
+
if (total > 0) {
|
|
30
|
+
let totpages = Math.ceil(total / size);
|
|
31
|
+
let pageindex = Math.floor(index / size);
|
|
32
|
+
let startpageindex = Math.max(0, Math.ceil(pageindex - pages / 2));
|
|
33
|
+
let endpageindex = Math.min(totpages - 1, startpageindex + pages - 1);
|
|
34
|
+
while (startpageindex > 0 && (1 + endpageindex - startpageindex) < pages) {
|
|
35
|
+
startpageindex--;
|
|
36
|
+
}
|
|
37
|
+
if (mode === 'numeric-only') {
|
|
38
|
+
if (startpageindex > 0) {
|
|
39
|
+
datasource.push({ caption: (1).toLocaleString(Utils.lang(this)), index: 0, /*first: true,*/ disabled: !( /*start*/pageindex > 0) });
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
else {
|
|
43
|
+
// |<
|
|
44
|
+
datasource.push({ caption: '«', index: 0, first: true, disabled: !( /*start*/pageindex > 0) });
|
|
45
|
+
// <
|
|
46
|
+
datasource.push({ caption: '<', index: size * (pageindex - 1), previous: true, disabled: !(pageindex > 0) });
|
|
47
|
+
}
|
|
48
|
+
// ...
|
|
49
|
+
if (startpageindex > 0 && mode !== 'numeric-only' || startpageindex > 1 && mode === 'numeric-only') {
|
|
50
|
+
datasource.push({ caption: '…', index: size * (startpageindex - 1) });
|
|
51
|
+
}
|
|
52
|
+
// #
|
|
53
|
+
for (let j = startpageindex; j <= endpageindex; j++) {
|
|
54
|
+
datasource.push({ caption: (j + 1).toLocaleString(Utils.lang(this)), index: j * size });
|
|
55
|
+
}
|
|
56
|
+
// ...
|
|
57
|
+
if (endpageindex < (totpages - 1) && mode !== 'numeric-only' || endpageindex < (totpages - 2) && mode === 'numeric-only') {
|
|
58
|
+
datasource.push({ caption: '…', index: size * (endpageindex + 1) });
|
|
59
|
+
}
|
|
60
|
+
if (mode === 'numeric-only') {
|
|
61
|
+
if (endpageindex < (totpages - 1)) {
|
|
62
|
+
datasource.push({ caption: totpages.toLocaleString(Utils.lang(this)), index: size * (totpages - 1), /*last: true,*/ disabled: !( /*end*/pageindex < (totpages - 1)) });
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
else {
|
|
66
|
+
// >
|
|
67
|
+
datasource.push({ caption: '>', index: size * (pageindex + 1), next: true, disabled: !(pageindex < (totpages - 1)) });
|
|
68
|
+
// >|
|
|
69
|
+
datasource.push({ caption: '»', index: size * (totpages - 1), last: true, disabled: !( /*end*/pageindex < (totpages - 1)) });
|
|
70
|
+
}
|
|
71
|
+
//
|
|
72
|
+
this.index = pageindex * size;
|
|
73
|
+
}
|
|
74
|
+
repeater.datasource = datasource;
|
|
75
|
+
}
|
|
76
|
+
};
|
|
77
|
+
__decorate([
|
|
78
|
+
ViewChild(P + '-repeater')
|
|
79
|
+
], PacemPagerElement.prototype, "_repeater", void 0);
|
|
80
|
+
__decorate([
|
|
81
|
+
Watch({ converter: PropertyConverters.Number })
|
|
82
|
+
], PacemPagerElement.prototype, "index", void 0);
|
|
83
|
+
__decorate([
|
|
84
|
+
Watch({ converter: PropertyConverters.Number, emit: false })
|
|
85
|
+
], PacemPagerElement.prototype, "total", void 0);
|
|
86
|
+
__decorate([
|
|
87
|
+
Watch({ converter: PropertyConverters.Number, emit: false })
|
|
88
|
+
], PacemPagerElement.prototype, "pages", void 0);
|
|
89
|
+
__decorate([
|
|
90
|
+
Watch({ converter: PropertyConverters.Number, emit: false })
|
|
91
|
+
], PacemPagerElement.prototype, "size", void 0);
|
|
92
|
+
__decorate([
|
|
93
|
+
Watch({ converter: PropertyConverters.String, emit: false })
|
|
94
|
+
], PacemPagerElement.prototype, "mode", void 0);
|
|
95
|
+
__decorate([
|
|
96
|
+
Debounce(true)
|
|
97
|
+
], PacemPagerElement.prototype, "_databind", null);
|
|
98
|
+
PacemPagerElement = __decorate([
|
|
99
|
+
CustomElement({
|
|
100
|
+
tagName: P + '-pager', shadow: Defaults.USE_SHADOW_ROOT,
|
|
101
|
+
template: `<${P}-repeater class="${PCSS}-pager"><div class="${PCSS}-buttonset">
|
|
102
|
+
<div class="pager-buttons">
|
|
103
|
+
<template>
|
|
104
|
+
<${P}-button class="${PCSS}-page button" on-click=":host.index = ^item.index" disabled="{{ ^item.disabled }}"
|
|
105
|
+
css-class="{{ { 'currentpage': ^item.index === :host.index, 'firstpage buttonset-first': ^item.first, 'previouspage': ^item.previous, 'nextpage': ^item.next, 'lastpage buttonset-last': ^item.last } }}"><${P}-span content="{{ ^item.caption }}"></${P}-span></${P}-button>
|
|
106
|
+
</template>
|
|
107
|
+
</div>
|
|
108
|
+
</div></${P}-repeater>`
|
|
109
|
+
})
|
|
110
|
+
], PacemPagerElement);
|
|
111
|
+
export { PacemPagerElement };
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
import { P, Utils, CustomElement, Watch, ViewChild, PropertyConverters, Components } from '@pacem/pacem-core';
|
|
8
|
+
//namespace Pacem.Components.UI {
|
|
9
|
+
let PacemPictureSourceElement = class PacemPictureSourceElement extends Components.PacemItemElement {
|
|
10
|
+
propertyChangedCallback(name, old, val, first) {
|
|
11
|
+
super.propertyChangedCallback(name, old, val, first);
|
|
12
|
+
const picture = this.container;
|
|
13
|
+
if (picture instanceof PacemPictureElement && ['srcset', 'media', 'type', 'disabled'].indexOf(name) >= 0) {
|
|
14
|
+
picture.refreshSources();
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
__decorate([
|
|
19
|
+
Watch({ emit: false, converter: PropertyConverters.String })
|
|
20
|
+
], PacemPictureSourceElement.prototype, "srcset", void 0);
|
|
21
|
+
__decorate([
|
|
22
|
+
Watch({ emit: false, converter: PropertyConverters.String })
|
|
23
|
+
], PacemPictureSourceElement.prototype, "media", void 0);
|
|
24
|
+
__decorate([
|
|
25
|
+
Watch({ emit: false, converter: PropertyConverters.String })
|
|
26
|
+
], PacemPictureSourceElement.prototype, "type", void 0);
|
|
27
|
+
PacemPictureSourceElement = __decorate([
|
|
28
|
+
CustomElement({
|
|
29
|
+
tagName: P + '-picture-source'
|
|
30
|
+
})
|
|
31
|
+
], PacemPictureSourceElement);
|
|
32
|
+
export { PacemPictureSourceElement };
|
|
33
|
+
let PacemPictureElement = class PacemPictureElement extends Components.PacemItemsContainerElement {
|
|
34
|
+
constructor() {
|
|
35
|
+
super('img', { 'label': 'picture' });
|
|
36
|
+
this._updateCurrentSrcHandler = (evt) => {
|
|
37
|
+
this.currentSrc = this._img.currentSrc;
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
validate(item) {
|
|
41
|
+
return item instanceof PacemPictureSourceElement;
|
|
42
|
+
}
|
|
43
|
+
propertyChangedCallback(name, old, val, first) {
|
|
44
|
+
super.propertyChangedCallback(name, old, val, first);
|
|
45
|
+
switch (name) {
|
|
46
|
+
case 'src':
|
|
47
|
+
this._setSource();
|
|
48
|
+
break;
|
|
49
|
+
case 'items':
|
|
50
|
+
this._setSources();
|
|
51
|
+
break;
|
|
52
|
+
case 'tooltip':
|
|
53
|
+
this._setAltText();
|
|
54
|
+
break;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
viewActivatedCallback() {
|
|
58
|
+
super.viewActivatedCallback();
|
|
59
|
+
this._img.addEventListener('load', this._updateCurrentSrcHandler, false);
|
|
60
|
+
this._setSource();
|
|
61
|
+
this._setAltText();
|
|
62
|
+
this._setSources();
|
|
63
|
+
}
|
|
64
|
+
disconnectedCallback() {
|
|
65
|
+
const img = this._img;
|
|
66
|
+
if (!Utils.isNull(img)) {
|
|
67
|
+
img.removeEventListener('load', this._updateCurrentSrcHandler, false);
|
|
68
|
+
}
|
|
69
|
+
super.disconnectedCallback();
|
|
70
|
+
}
|
|
71
|
+
refreshSources() {
|
|
72
|
+
this._setSources();
|
|
73
|
+
}
|
|
74
|
+
_setSources(items = this.items) {
|
|
75
|
+
const picture = this._picture, img = this._img;
|
|
76
|
+
if (!Utils.isNull(picture) && !Utils.isNull(img)) {
|
|
77
|
+
const sources = picture.querySelectorAll('source'), itemCount = items?.length ?? 0;
|
|
78
|
+
// populate
|
|
79
|
+
for (let i = 0; i < itemCount; i++) {
|
|
80
|
+
const item = this.items[i];
|
|
81
|
+
let source;
|
|
82
|
+
if (sources.length <= i) {
|
|
83
|
+
source = document.createElement('source');
|
|
84
|
+
source.setAttribute('part', 'source');
|
|
85
|
+
picture.insertBefore(source, img);
|
|
86
|
+
}
|
|
87
|
+
else {
|
|
88
|
+
source = sources.item(i);
|
|
89
|
+
}
|
|
90
|
+
if (item.disabled || Utils.isNullOrEmpty(item.srcset)) {
|
|
91
|
+
source.removeAttribute('srcset');
|
|
92
|
+
}
|
|
93
|
+
else {
|
|
94
|
+
source.srcset = item.srcset;
|
|
95
|
+
}
|
|
96
|
+
if (Utils.isNullOrEmpty(item.media)) {
|
|
97
|
+
source.removeAttribute('media');
|
|
98
|
+
}
|
|
99
|
+
else {
|
|
100
|
+
source.media = item.media;
|
|
101
|
+
}
|
|
102
|
+
if (Utils.isNullOrEmpty(item.type)) {
|
|
103
|
+
source.removeAttribute('type');
|
|
104
|
+
}
|
|
105
|
+
else {
|
|
106
|
+
source.type = item.type;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
// cleanup
|
|
110
|
+
for (let i = sources.length - 1; i >= itemCount; i--) {
|
|
111
|
+
let source = sources.item(i);
|
|
112
|
+
source.remove();
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
_setSource(src = this.src) {
|
|
117
|
+
const img = this._img;
|
|
118
|
+
if (!Utils.isNull(img)) {
|
|
119
|
+
if (Utils.isNullOrEmpty(src)) {
|
|
120
|
+
img.removeAttribute('src');
|
|
121
|
+
}
|
|
122
|
+
else {
|
|
123
|
+
img.src = src;
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
_setAltText(tip = this.tooltip) {
|
|
128
|
+
const img = this._img;
|
|
129
|
+
if (!Utils.isNull(img)) {
|
|
130
|
+
if (Utils.isNullOrEmpty(tip)) {
|
|
131
|
+
img.alt = this.aria.attributes.toObject()['label'];
|
|
132
|
+
}
|
|
133
|
+
else {
|
|
134
|
+
img.alt = tip;
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
};
|
|
139
|
+
__decorate([
|
|
140
|
+
ViewChild('picture')
|
|
141
|
+
], PacemPictureElement.prototype, "_picture", void 0);
|
|
142
|
+
__decorate([
|
|
143
|
+
ViewChild('img')
|
|
144
|
+
], PacemPictureElement.prototype, "_img", void 0);
|
|
145
|
+
__decorate([
|
|
146
|
+
Watch({ emit: false, converter: PropertyConverters.String })
|
|
147
|
+
], PacemPictureElement.prototype, "src", void 0);
|
|
148
|
+
__decorate([
|
|
149
|
+
Watch({ converter: PropertyConverters.String })
|
|
150
|
+
], PacemPictureElement.prototype, "currentSrc", void 0);
|
|
151
|
+
PacemPictureElement = __decorate([
|
|
152
|
+
CustomElement({
|
|
153
|
+
tagName: P + '-picture', shadow: true,
|
|
154
|
+
template: `<picture part="picture"><img loading="lazy" part="img" /></picture><slot></slot>`
|
|
155
|
+
})
|
|
156
|
+
], PacemPictureElement);
|
|
157
|
+
export { PacemPictureElement };
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
import { P, Utils, CustomElement, Watch, ViewChild, PropertyConverters, Components, Defaults } from '@pacem/pacem-core';
|
|
8
|
+
//namespace Pacem.Components.UI {
|
|
9
|
+
let PacemProgressbarElement = class PacemProgressbarElement extends Components.PacemElement {
|
|
10
|
+
constructor() {
|
|
11
|
+
super('progressbar', { 'valuemin': '0%', 'valuemax': '100%', 'valuenow': '0%' });
|
|
12
|
+
}
|
|
13
|
+
propertyChangedCallback(name, old, val, first) {
|
|
14
|
+
super.propertyChangedCallback(name, old, val, first);
|
|
15
|
+
switch (name) {
|
|
16
|
+
case 'percentage':
|
|
17
|
+
this._bar.style.transform = `translateX(${(-100 + (val || 0))}%)`;
|
|
18
|
+
this._glow.style.transform = `scaleX(${((val || 0) * .01)})`;
|
|
19
|
+
let perc = Utils.leftPad(Math.floor(val), 2, '0') + '%';
|
|
20
|
+
this.aria.attributes.set('valuenow', perc);
|
|
21
|
+
if (Utils.isNullOrEmpty(this.caption)) {
|
|
22
|
+
this.aria.attributes.set('valuetext', this._caption.textContent = perc);
|
|
23
|
+
}
|
|
24
|
+
break;
|
|
25
|
+
case 'caption':
|
|
26
|
+
this.aria.attributes.set('valuetext', this._caption.textContent = val);
|
|
27
|
+
break;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
__decorate([
|
|
32
|
+
ViewChild('.progressbar-bar')
|
|
33
|
+
], PacemProgressbarElement.prototype, "_bar", void 0);
|
|
34
|
+
__decorate([
|
|
35
|
+
ViewChild('.progressbar-glow')
|
|
36
|
+
], PacemProgressbarElement.prototype, "_glow", void 0);
|
|
37
|
+
__decorate([
|
|
38
|
+
ViewChild('.progressbar-caption')
|
|
39
|
+
], PacemProgressbarElement.prototype, "_caption", void 0);
|
|
40
|
+
__decorate([
|
|
41
|
+
Watch({ emit: false, converter: PropertyConverters.String })
|
|
42
|
+
], PacemProgressbarElement.prototype, "caption", void 0);
|
|
43
|
+
__decorate([
|
|
44
|
+
Watch({ converter: PropertyConverters.Number })
|
|
45
|
+
], PacemProgressbarElement.prototype, "percentage", void 0);
|
|
46
|
+
PacemProgressbarElement = __decorate([
|
|
47
|
+
CustomElement({
|
|
48
|
+
tagName: P + '-progressbar', shadow: Defaults.USE_SHADOW_ROOT,
|
|
49
|
+
template: `<div class="progressbar-glow"></div>
|
|
50
|
+
<div class="progressbar-track"><div class="progressbar-bar"></div></div>
|
|
51
|
+
<label class="progressbar-caption"></label>`
|
|
52
|
+
})
|
|
53
|
+
], PacemProgressbarElement);
|
|
54
|
+
export { PacemProgressbarElement };
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
import { P, PCSS, Utils, CustomElement, Watch, PropertyConverters, Components, CustomElementUtils } from '@pacem/pacem-core';
|
|
8
|
+
//namespace Pacem.Components.UI {
|
|
9
|
+
let PacemSidebarElement = class PacemSidebarElement extends Components.PacemElement {
|
|
10
|
+
constructor() {
|
|
11
|
+
super(...arguments);
|
|
12
|
+
this.open = false;
|
|
13
|
+
this.synchronizeShell = true;
|
|
14
|
+
}
|
|
15
|
+
propertyChangedCallback(name, old, val, first) {
|
|
16
|
+
super.propertyChangedCallback(name, old, val, first);
|
|
17
|
+
switch (name) {
|
|
18
|
+
case 'open':
|
|
19
|
+
case 'synchronizeShell':
|
|
20
|
+
this._sync();
|
|
21
|
+
break;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
disconnectedCallback() {
|
|
25
|
+
this._sync(false);
|
|
26
|
+
super.disconnectedCallback();
|
|
27
|
+
}
|
|
28
|
+
_sync(val = this.open) {
|
|
29
|
+
const shell = this.#shell;
|
|
30
|
+
if (this.synchronizeShell) {
|
|
31
|
+
Utils.addClass(this, 'sidebar-sync');
|
|
32
|
+
Utils.addClass(shell, PCSS + (val === true ? '-sidebar-open' : '-sidebar-close'));
|
|
33
|
+
Utils.removeClass(shell, PCSS + (val === true ? '-sidebar-close' : '-sidebar-open'));
|
|
34
|
+
}
|
|
35
|
+
else {
|
|
36
|
+
Utils.removeClass(this, 'sidebar-sync');
|
|
37
|
+
Utils.removeClass(shell, PCSS + '-sidebar-close ' + PCSS + '-sidebar-open');
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
#shell;
|
|
41
|
+
connectedCallback() {
|
|
42
|
+
super.connectedCallback();
|
|
43
|
+
this.#shell = CustomElementUtils.findAncestorShell(this);
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
__decorate([
|
|
47
|
+
Watch({ converter: PropertyConverters.Boolean })
|
|
48
|
+
], PacemSidebarElement.prototype, "open", void 0);
|
|
49
|
+
__decorate([
|
|
50
|
+
Watch({ emit: false, converter: PropertyConverters.Boolean })
|
|
51
|
+
], PacemSidebarElement.prototype, "synchronizeShell", void 0);
|
|
52
|
+
PacemSidebarElement = __decorate([
|
|
53
|
+
CustomElement({
|
|
54
|
+
tagName: P + '-sidebar', template: `<${P}-panel class="sidebar-drawer" part="drawer" css-part="{{ { 'open': :host.open } }}" css-class="{{ {'open': :host.open } }}">
|
|
55
|
+
<slot></slot>
|
|
56
|
+
</${P}-panel>`,
|
|
57
|
+
shadow: true
|
|
58
|
+
})
|
|
59
|
+
], PacemSidebarElement);
|
|
60
|
+
export { PacemSidebarElement };
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
import { P, CustomElement, Components } from '@pacem/pacem-core';
|
|
8
|
+
//namespace Pacem.Components.UI {
|
|
9
|
+
let PacemSlideElement = class PacemSlideElement extends Components.PacemIterableElement {
|
|
10
|
+
};
|
|
11
|
+
PacemSlideElement = __decorate([
|
|
12
|
+
CustomElement({
|
|
13
|
+
tagName: P + '-slide'
|
|
14
|
+
})
|
|
15
|
+
], PacemSlideElement);
|
|
16
|
+
export { PacemSlideElement };
|
|
17
|
+
let PacemSlideshowElement = class PacemSlideshowElement extends Components.PacemIterativeElement {
|
|
18
|
+
validate(item) {
|
|
19
|
+
return item instanceof PacemSlideElement;
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
PacemSlideshowElement = __decorate([
|
|
23
|
+
CustomElement({
|
|
24
|
+
tagName: P + '-slideshow'
|
|
25
|
+
})
|
|
26
|
+
], PacemSlideshowElement);
|
|
27
|
+
export { PacemSlideshowElement };
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
import { P, CustomElementUtils, CustomElement, Watch, PropertyConverters, Components } from '@pacem/pacem-core';
|
|
8
|
+
//namespace Pacem.Components.UI.Social {
|
|
9
|
+
let PacemTweetEmbedElement = class PacemTweetEmbedElement extends Components.PacemElement {
|
|
10
|
+
constructor() {
|
|
11
|
+
super(...arguments);
|
|
12
|
+
this._scriptsLoaded = false;
|
|
13
|
+
}
|
|
14
|
+
propertyChangedCallback(name, old, val, first) {
|
|
15
|
+
super.propertyChangedCallback(name, old, val, first);
|
|
16
|
+
if (name === 'tweetid' && this._scriptsLoaded)
|
|
17
|
+
this._render();
|
|
18
|
+
}
|
|
19
|
+
viewActivatedCallback() {
|
|
20
|
+
super.viewActivatedCallback();
|
|
21
|
+
CustomElementUtils.importjs('https://platform.twitter.com/widgets.js').then(() => {
|
|
22
|
+
this._scriptsLoaded = true;
|
|
23
|
+
this._render();
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
_render() {
|
|
27
|
+
if (this.tweetid && this._scriptsLoaded) {
|
|
28
|
+
twttr.ready(tw => tw.widgets.createTweet(this.tweetid, this));
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
__decorate([
|
|
33
|
+
Watch({ emit: false, converter: PropertyConverters.String })
|
|
34
|
+
], PacemTweetEmbedElement.prototype, "tweetid", void 0);
|
|
35
|
+
PacemTweetEmbedElement = __decorate([
|
|
36
|
+
CustomElement({ tagName: P + '-tweetembed' })
|
|
37
|
+
], PacemTweetEmbedElement);
|
|
38
|
+
export { PacemTweetEmbedElement };
|
|
39
|
+
//}
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
import { P, CustomElementUtils, CustomElement, Watch, PropertyConverters, PacemEventTarget, Components, Utils, Logging } from '@pacem/pacem-core';
|
|
8
|
+
//namespace Pacem.Components.UI {
|
|
9
|
+
export var StickyHeaderVisibility;
|
|
10
|
+
(function (StickyHeaderVisibility) {
|
|
11
|
+
StickyHeaderVisibility["Persistent"] = "persistent";
|
|
12
|
+
StickyHeaderVisibility["QuickReturn"] = "quickreturn";
|
|
13
|
+
})(StickyHeaderVisibility || (StickyHeaderVisibility = {}));
|
|
14
|
+
let PacemStickyHeaderElement = class PacemStickyHeaderElement extends PacemEventTarget {
|
|
15
|
+
constructor() {
|
|
16
|
+
super(...arguments);
|
|
17
|
+
this.#previousOffset = { left: 0, top: 0 };
|
|
18
|
+
this._scrollHandler = (evt) => {
|
|
19
|
+
this.offset = evt.detail;
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
#scroller;
|
|
23
|
+
#previousOffset;
|
|
24
|
+
#id;
|
|
25
|
+
#shell;
|
|
26
|
+
_ensureScrollAwareElement() {
|
|
27
|
+
if (Utils.isNull(this.#scroller)) {
|
|
28
|
+
const scroller = this.#scroller = new Components.PacemScrollAwareElement();
|
|
29
|
+
this.log(Logging.LogLevel.Debug, 'creating scroll aware ' + this.#id);
|
|
30
|
+
const shell = this.#shell = CustomElementUtils.findAncestorShell(this);
|
|
31
|
+
shell.appendChild(scroller);
|
|
32
|
+
scroller.dataset["target"] = this.#id;
|
|
33
|
+
scroller.addEventListener(Components.ScrollEventName, this._scrollHandler, false);
|
|
34
|
+
}
|
|
35
|
+
this.#scroller.disabled = this.disabled;
|
|
36
|
+
}
|
|
37
|
+
_manageOffsetChange(offset = this.offset) {
|
|
38
|
+
if (this.disabled) {
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
const visibility = this.visibility || StickyHeaderVisibility.Persistent, lastTop = this.#previousOffset.top, top = offset.top, threshold = this.threshold || 0, shell = this.#shell;
|
|
42
|
+
if (lastTop <= threshold && top > threshold) {
|
|
43
|
+
Utils.removeClass(shell, 'sticky-header-top');
|
|
44
|
+
Utils.addClass(shell, 'sticky-header-scroll');
|
|
45
|
+
// get into wavy behavior and aspect
|
|
46
|
+
if (visibility === StickyHeaderVisibility.QuickReturn) {
|
|
47
|
+
Utils.addClass(shell, 'sticky-header-fade');
|
|
48
|
+
this.visible = false;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
else if (lastTop > threshold && top <= threshold) {
|
|
52
|
+
// back to steady form
|
|
53
|
+
Utils.removeClass(shell, 'sticky-header-fade');
|
|
54
|
+
Utils.removeClass(shell, 'sticky-header-scroll');
|
|
55
|
+
Utils.addClass(shell, 'sticky-header-top');
|
|
56
|
+
}
|
|
57
|
+
else if (lastTop > threshold && top > threshold && lastTop > top) {
|
|
58
|
+
// scrolling up, show
|
|
59
|
+
this.visible = true;
|
|
60
|
+
Utils.removeClass(shell, 'sticky-header-fade');
|
|
61
|
+
}
|
|
62
|
+
else if (lastTop > threshold && top > threshold && lastTop < top && visibility == StickyHeaderVisibility.QuickReturn) {
|
|
63
|
+
// keep scrolling down with quick return, hide
|
|
64
|
+
Utils.addClass(shell, 'sticky-header-fade');
|
|
65
|
+
}
|
|
66
|
+
this.#previousOffset = offset;
|
|
67
|
+
}
|
|
68
|
+
propertyChangedCallback(name, old, val, first) {
|
|
69
|
+
super.propertyChangedCallback(name, old, val, first);
|
|
70
|
+
switch (name) {
|
|
71
|
+
case 'offset':
|
|
72
|
+
this._manageOffsetChange(val);
|
|
73
|
+
break;
|
|
74
|
+
case 'disabled':
|
|
75
|
+
this._ensureScrollAwareElement();
|
|
76
|
+
break;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
connectedCallback() {
|
|
80
|
+
super.connectedCallback();
|
|
81
|
+
this.#id = this.id || 'sticky-' + Utils.uniqueCode();
|
|
82
|
+
this._ensureScrollAwareElement();
|
|
83
|
+
}
|
|
84
|
+
disconnectedCallback() {
|
|
85
|
+
const scroller = this.#scroller, shell = this.#shell;
|
|
86
|
+
if (!Utils.isNull(scroller)) {
|
|
87
|
+
this.log(Logging.LogLevel.Debug, 'disposing scroll aware ' + this.#id);
|
|
88
|
+
scroller.removeEventListener(Components.ScrollEventName, this._scrollHandler, false);
|
|
89
|
+
scroller.remove();
|
|
90
|
+
this.#scroller = undefined;
|
|
91
|
+
Utils.removeClass(shell, 'sticky-header-fade');
|
|
92
|
+
Utils.removeClass(shell, 'sticky-header-top');
|
|
93
|
+
Utils.removeClass(shell, 'sticky-header-scroll');
|
|
94
|
+
}
|
|
95
|
+
super.disconnectedCallback();
|
|
96
|
+
}
|
|
97
|
+
};
|
|
98
|
+
__decorate([
|
|
99
|
+
Watch({ converter: PropertyConverters.Number, emit: false })
|
|
100
|
+
], PacemStickyHeaderElement.prototype, "threshold", void 0);
|
|
101
|
+
__decorate([
|
|
102
|
+
Watch({ converter: PropertyConverters.Point })
|
|
103
|
+
], PacemStickyHeaderElement.prototype, "offset", void 0);
|
|
104
|
+
__decorate([
|
|
105
|
+
Watch({ converter: PropertyConverters.Boolean })
|
|
106
|
+
], PacemStickyHeaderElement.prototype, "visible", void 0);
|
|
107
|
+
__decorate([
|
|
108
|
+
Watch({ converter: PropertyConverters.String, emit: false })
|
|
109
|
+
], PacemStickyHeaderElement.prototype, "visibility", void 0);
|
|
110
|
+
PacemStickyHeaderElement = __decorate([
|
|
111
|
+
CustomElement({ tagName: P + '-sticky-header' })
|
|
112
|
+
], PacemStickyHeaderElement);
|
|
113
|
+
export { PacemStickyHeaderElement };
|