@progressive-development/pd-content 0.9.2 → 1.0.0
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 +21 -2
- package/README.md +42 -57
- package/dist/_virtual/_commonjsHelpers.js +7 -0
- package/dist/_virtual/prism-java.js +3 -0
- package/dist/_virtual/prism-java2.js +3 -0
- package/dist/_virtual/prism-python.js +3 -0
- package/dist/_virtual/prism-python2.js +3 -0
- package/dist/_virtual/prism-typescript.js +3 -0
- package/dist/_virtual/prism-typescript2.js +3 -0
- package/dist/_virtual/prism.js +7 -0
- package/dist/_virtual/prism2.js +3 -0
- package/dist/generated/locales/be.d.ts +10 -0
- package/dist/generated/locales/be.d.ts.map +1 -1
- package/dist/generated/locales/de.d.ts +10 -0
- package/dist/generated/locales/de.d.ts.map +1 -1
- package/dist/generated/locales/en.d.ts +10 -0
- package/dist/generated/locales/en.d.ts.map +1 -1
- package/dist/index.d.ts +8 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +9 -0
- package/dist/locales/be.js +11 -1
- package/dist/locales/de.js +11 -1
- package/dist/locales/en.js +11 -1
- package/dist/node_modules/.pnpm/prismjs@1.30.0/node_modules/prismjs/components/prism-bash.js +235 -0
- package/dist/node_modules/.pnpm/prismjs@1.30.0/node_modules/prismjs/components/prism-java.js +135 -0
- package/dist/node_modules/.pnpm/prismjs@1.30.0/node_modules/prismjs/components/prism-json.js +27 -0
- package/dist/node_modules/.pnpm/prismjs@1.30.0/node_modules/prismjs/components/prism-markdown.js +415 -0
- package/dist/node_modules/.pnpm/prismjs@1.30.0/node_modules/prismjs/components/prism-python.js +76 -0
- package/dist/node_modules/.pnpm/prismjs@1.30.0/node_modules/prismjs/components/prism-sql.js +32 -0
- package/dist/node_modules/.pnpm/prismjs@1.30.0/node_modules/prismjs/components/prism-typescript.js +71 -0
- package/dist/node_modules/.pnpm/prismjs@1.30.0/node_modules/prismjs/components/prism-yaml.js +83 -0
- package/dist/node_modules/.pnpm/prismjs@1.30.0/node_modules/prismjs/prism.js +1959 -0
- package/dist/pd-box-view/PdBoxView.d.ts +9 -0
- package/dist/pd-box-view/PdBoxView.d.ts.map +1 -1
- package/dist/pd-box-view/pd-box-view.stories.d.ts +41 -8
- package/dist/pd-box-view/pd-box-view.stories.d.ts.map +1 -1
- package/dist/pd-code-snippet/PdCodeSnippet.d.ts +105 -0
- package/dist/pd-code-snippet/PdCodeSnippet.d.ts.map +1 -0
- package/dist/pd-code-snippet/PdCodeSnippet.js +504 -0
- package/dist/pd-code-snippet/pd-code-snippet.d.ts +4 -0
- package/dist/pd-code-snippet/pd-code-snippet.d.ts.map +1 -0
- package/dist/pd-code-snippet/pd-code-snippet.js +5 -0
- package/dist/pd-code-snippet/pd-code-snippet.stories.d.ts +55 -0
- package/dist/pd-code-snippet/pd-code-snippet.stories.d.ts.map +1 -0
- package/dist/pd-collapse/PdCollapse.d.ts +31 -7
- package/dist/pd-collapse/PdCollapse.d.ts.map +1 -1
- package/dist/pd-collapse/PdCollapse.js +73 -15
- package/dist/pd-collapse/pd-collapse.stories.d.ts +49 -21
- package/dist/pd-collapse/pd-collapse.stories.d.ts.map +1 -1
- package/dist/pd-collapse-group/PdCollapseGroup.d.ts +8 -7
- package/dist/pd-collapse-group/PdCollapseGroup.d.ts.map +1 -1
- package/dist/pd-collapse-group/PdCollapseGroup.js +7 -6
- package/dist/pd-collapse-group/pd-collapse-group.stories.d.ts +39 -4
- package/dist/pd-collapse-group/pd-collapse-group.stories.d.ts.map +1 -1
- package/dist/pd-edit-content/PdEditContent.d.ts +13 -0
- package/dist/pd-edit-content/PdEditContent.d.ts.map +1 -1
- package/dist/pd-edit-content/PdEditContent.js +33 -7
- package/dist/pd-edit-content/pd-edit-content.stories.d.ts +54 -10
- package/dist/pd-edit-content/pd-edit-content.stories.d.ts.map +1 -1
- package/dist/pd-loading-state/PdLoadingState.d.ts +64 -0
- package/dist/pd-loading-state/PdLoadingState.d.ts.map +1 -0
- package/dist/pd-loading-state/PdLoadingState.js +219 -0
- package/dist/pd-loading-state/pd-loading-state.d.ts +6 -0
- package/dist/pd-loading-state/pd-loading-state.d.ts.map +1 -0
- package/dist/pd-loading-state/pd-loading-state.stories.d.ts +48 -0
- package/dist/pd-loading-state/pd-loading-state.stories.d.ts.map +1 -0
- package/dist/pd-loading-state.d.ts +2 -0
- package/dist/pd-loading-state.js +1 -0
- package/dist/pd-more-info/PdMoreInfo.d.ts +6 -2
- package/dist/pd-more-info/PdMoreInfo.d.ts.map +1 -1
- package/dist/pd-more-info/PdMoreInfo.js +30 -2
- package/dist/pd-more-info/pd-more-info.stories.d.ts +41 -5
- package/dist/pd-more-info/pd-more-info.stories.d.ts.map +1 -1
- package/dist/pd-notice-box/PdNoticeBox.d.ts +88 -0
- package/dist/pd-notice-box/PdNoticeBox.d.ts.map +1 -0
- package/dist/pd-notice-box/PdNoticeBox.js +224 -0
- package/dist/pd-notice-box/pd-notice-box.d.ts +3 -0
- package/dist/pd-notice-box/pd-notice-box.d.ts.map +1 -0
- package/dist/pd-notice-box/pd-notice-box.js +8 -0
- package/dist/pd-notice-box/pd-notice-box.stories.d.ts +58 -0
- package/dist/pd-notice-box/pd-notice-box.stories.d.ts.map +1 -0
- package/dist/pd-panel-viewer/PdPanel.d.ts +5 -0
- package/dist/pd-panel-viewer/PdPanel.d.ts.map +1 -1
- package/dist/pd-panel-viewer/PdPanelViewer.d.ts +53 -2
- package/dist/pd-panel-viewer/PdPanelViewer.d.ts.map +1 -1
- package/dist/pd-panel-viewer/PdPanelViewer.js +188 -33
- package/dist/pd-panel-viewer/pd-panel-viewer.stories.d.ts +46 -0
- package/dist/pd-panel-viewer/pd-panel-viewer.stories.d.ts.map +1 -0
- package/dist/pd-resize-content/PdResizeContent.d.ts +12 -10
- package/dist/pd-resize-content/PdResizeContent.d.ts.map +1 -1
- package/dist/pd-resize-content/PdResizeContent.js +19 -9
- package/dist/pd-resize-content/pd-resize-content.stories.d.ts +36 -4
- package/dist/pd-resize-content/pd-resize-content.stories.d.ts.map +1 -1
- package/dist/pd-tab/PdTab.d.ts +35 -2
- package/dist/pd-tab/PdTab.d.ts.map +1 -1
- package/dist/pd-tab/PdTab.js +181 -68
- package/dist/pd-tab/pd-tab.stories.d.ts +51 -21
- package/dist/pd-tab/pd-tab.stories.d.ts.map +1 -1
- package/dist/pd-timeline/PdTimeline.d.ts +50 -0
- package/dist/pd-timeline/PdTimeline.d.ts.map +1 -0
- package/dist/pd-timeline/PdTimeline.js +315 -0
- package/dist/pd-timeline/pd-timeline.d.ts +3 -0
- package/dist/pd-timeline/pd-timeline.d.ts.map +1 -0
- package/dist/pd-timeline/pd-timeline.stories.d.ts +56 -0
- package/dist/pd-timeline/pd-timeline.stories.d.ts.map +1 -0
- package/dist/pd-timeline-wizard/PdTimelineWizard.d.ts +39 -0
- package/dist/pd-timeline-wizard/PdTimelineWizard.d.ts.map +1 -0
- package/dist/pd-timeline-wizard/PdTimelineWizard.js +150 -0
- package/dist/pd-timeline-wizard/pd-timeline-wizard.d.ts +3 -0
- package/dist/pd-timeline-wizard/pd-timeline-wizard.d.ts.map +1 -0
- package/dist/pd-timeline-wizard/pd-timeline-wizard.stories.d.ts +54 -0
- package/dist/pd-timeline-wizard/pd-timeline-wizard.stories.d.ts.map +1 -0
- package/dist/pd-timeline-wizard.d.ts +2 -0
- package/dist/pd-timeline-wizard.js +8 -0
- package/dist/pd-timeline.d.ts +2 -0
- package/dist/pd-timeline.js +8 -0
- package/dist/types.d.ts +25 -0
- package/dist/types.d.ts.map +1 -1
- package/package.json +16 -7
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { LitElement, css, html } from 'lit';
|
|
2
|
-
import { property } from 'lit/decorators.js';
|
|
1
|
+
import { LitElement, css, nothing, html } from 'lit';
|
|
2
|
+
import { property, state } from 'lit/decorators.js';
|
|
3
3
|
import { classMap } from 'lit/directives/class-map.js';
|
|
4
|
-
import
|
|
4
|
+
import { msg } from '@lit/localize';
|
|
5
5
|
import '@progressive-development/pd-icon/pd-icon';
|
|
6
6
|
|
|
7
7
|
var __defProp = Object.defineProperty;
|
|
@@ -13,16 +13,78 @@ var __decorateClass = (decorators, target, key, kind) => {
|
|
|
13
13
|
if (result) __defProp(target, key, result);
|
|
14
14
|
return result;
|
|
15
15
|
};
|
|
16
|
-
let timer;
|
|
17
16
|
class PdPanelViewer extends LitElement {
|
|
18
17
|
constructor() {
|
|
19
18
|
super(...arguments);
|
|
20
19
|
this.withProgress = false;
|
|
21
20
|
this.deltaCalc = 3;
|
|
22
21
|
this._index = 0;
|
|
23
|
-
// eslint-disable-next-line no-undef
|
|
24
22
|
this._panData = {};
|
|
25
23
|
this._update = {};
|
|
24
|
+
/** @ignore */
|
|
25
|
+
this._resizeObserver = null;
|
|
26
|
+
/** @ignore */
|
|
27
|
+
this._pointerStartX = 0;
|
|
28
|
+
/** @ignore */
|
|
29
|
+
this._pointerStartY = 0;
|
|
30
|
+
/** @ignore */
|
|
31
|
+
this._activePointerId = null;
|
|
32
|
+
/** @ignore */
|
|
33
|
+
this._pointerMoved = false;
|
|
34
|
+
/** @ignore */
|
|
35
|
+
this._dragThreshold = 5;
|
|
36
|
+
/** @ignore */
|
|
37
|
+
this._isHorizontalDrag = null;
|
|
38
|
+
// --- Pointer Event Handlers ---
|
|
39
|
+
this._onPointerDown = (e) => {
|
|
40
|
+
if (e.button !== 0) return;
|
|
41
|
+
this._activePointerId = e.pointerId;
|
|
42
|
+
this._pointerStartX = e.clientX;
|
|
43
|
+
this._pointerStartY = e.clientY;
|
|
44
|
+
this._pointerMoved = false;
|
|
45
|
+
this._isHorizontalDrag = null;
|
|
46
|
+
this.setPointerCapture(e.pointerId);
|
|
47
|
+
};
|
|
48
|
+
this._onPointerMove = (e) => {
|
|
49
|
+
if (e.pointerId !== this._activePointerId) return;
|
|
50
|
+
const deltaX = e.clientX - this._pointerStartX;
|
|
51
|
+
const deltaY = e.clientY - this._pointerStartY;
|
|
52
|
+
if (this._isHorizontalDrag === null) {
|
|
53
|
+
const absDx = Math.abs(deltaX);
|
|
54
|
+
const absDy = Math.abs(deltaY);
|
|
55
|
+
if (absDx < this._dragThreshold && absDy < this._dragThreshold) return;
|
|
56
|
+
this._isHorizontalDrag = absDx > absDy;
|
|
57
|
+
if (this._isHorizontalDrag) {
|
|
58
|
+
this.style.userSelect = "none";
|
|
59
|
+
window.getSelection()?.removeAllRanges();
|
|
60
|
+
}
|
|
61
|
+
if (!this._isHorizontalDrag) {
|
|
62
|
+
this._activePointerId = null;
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
if (!this._isHorizontalDrag) return;
|
|
67
|
+
e.preventDefault();
|
|
68
|
+
this._pointerMoved = true;
|
|
69
|
+
this._panData = { deltaX, isFinal: false };
|
|
70
|
+
};
|
|
71
|
+
this._onPointerUp = (e) => {
|
|
72
|
+
if (e.pointerId !== this._activePointerId) return;
|
|
73
|
+
if (this._pointerMoved && this._isHorizontalDrag) {
|
|
74
|
+
const deltaX = e.clientX - this._pointerStartX;
|
|
75
|
+
this._panData = { deltaX, isFinal: true };
|
|
76
|
+
}
|
|
77
|
+
this._activePointerId = null;
|
|
78
|
+
this._isHorizontalDrag = null;
|
|
79
|
+
this.style.userSelect = "";
|
|
80
|
+
};
|
|
81
|
+
this._onPointerCancel = (e) => {
|
|
82
|
+
if (e.pointerId !== this._activePointerId) return;
|
|
83
|
+
this._panData = { deltaX: 0, isFinal: true };
|
|
84
|
+
this._activePointerId = null;
|
|
85
|
+
this._isHorizontalDrag = null;
|
|
86
|
+
this.style.userSelect = "";
|
|
87
|
+
};
|
|
26
88
|
}
|
|
27
89
|
static {
|
|
28
90
|
this.styles = css`
|
|
@@ -32,7 +94,7 @@ class PdPanelViewer extends LitElement {
|
|
|
32
94
|
width: 100%;
|
|
33
95
|
max-width: var(--pd-panel-width, 1170px);
|
|
34
96
|
overflow: var(--pd-panel-overflow, hidden);
|
|
35
|
-
background-color: var(--pd-panel-viewer-bg-col);
|
|
97
|
+
background-color: var(--pd-panel-viewer-bg-col, var(--pd-default-col));
|
|
36
98
|
}
|
|
37
99
|
|
|
38
100
|
.panel-container {
|
|
@@ -47,9 +109,18 @@ class PdPanelViewer extends LitElement {
|
|
|
47
109
|
|
|
48
110
|
pd-icon {
|
|
49
111
|
position: absolute;
|
|
50
|
-
top: calc(50% - 25px);
|
|
112
|
+
top: var(--pd-panel-nav-top, calc(50% - 25px));
|
|
51
113
|
height: 50px;
|
|
52
114
|
cursor: pointer;
|
|
115
|
+
--pd-icon-col-active: var(--pd-panel-icon-col, var(--pd-on-primary-col));
|
|
116
|
+
--pd-icon-col-hover: var(
|
|
117
|
+
--pd-panel-icon-col-hover,
|
|
118
|
+
var(--pd-on-primary-col)
|
|
119
|
+
);
|
|
120
|
+
--pd-icon-col-disabled: var(
|
|
121
|
+
--pd-panel-icon-col-disabled,
|
|
122
|
+
var(--pd-default-disabled-col)
|
|
123
|
+
);
|
|
53
124
|
}
|
|
54
125
|
|
|
55
126
|
#prev {
|
|
@@ -60,6 +131,16 @@ class PdPanelViewer extends LitElement {
|
|
|
60
131
|
right: 0;
|
|
61
132
|
}
|
|
62
133
|
|
|
134
|
+
@media (max-width: 768px) {
|
|
135
|
+
.panel-container {
|
|
136
|
+
padding: 0 0.5rem;
|
|
137
|
+
}
|
|
138
|
+
pd-icon {
|
|
139
|
+
height: 36px;
|
|
140
|
+
top: var(--pd-panel-nav-top, calc(50% - 18px));
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
|
|
63
144
|
#progress {
|
|
64
145
|
position: relative;
|
|
65
146
|
height: 20px;
|
|
@@ -74,14 +155,17 @@ class PdPanelViewer extends LitElement {
|
|
|
74
155
|
}
|
|
75
156
|
|
|
76
157
|
#progress > div {
|
|
77
|
-
background: var(--pd-panel-progress-col,
|
|
158
|
+
background: var(--pd-panel-progress-col, rgba(255, 255, 255, 0.4));
|
|
78
159
|
height: 4px;
|
|
79
160
|
transition: background 0.3s linear;
|
|
80
161
|
cursor: pointer;
|
|
81
162
|
}
|
|
82
163
|
|
|
83
164
|
#progress > div.watched {
|
|
84
|
-
background: var(
|
|
165
|
+
background: var(
|
|
166
|
+
--pd-panel-progress-watched-col,
|
|
167
|
+
var(--pd-on-primary-col)
|
|
168
|
+
);
|
|
85
169
|
}
|
|
86
170
|
|
|
87
171
|
::slotted(*) {
|
|
@@ -103,61 +187,113 @@ class PdPanelViewer extends LitElement {
|
|
|
103
187
|
}
|
|
104
188
|
render() {
|
|
105
189
|
return html`
|
|
106
|
-
<div
|
|
190
|
+
<div
|
|
191
|
+
class="panel-container"
|
|
192
|
+
role="region"
|
|
193
|
+
aria-roledescription="carousel"
|
|
194
|
+
aria-label="${msg("Panel viewer", {
|
|
195
|
+
id: "pd.panel.viewer.aria.label"
|
|
196
|
+
})}"
|
|
197
|
+
aria-live="polite"
|
|
198
|
+
>
|
|
107
199
|
<slot></slot>
|
|
108
200
|
<pd-icon
|
|
109
201
|
id="prev"
|
|
110
202
|
icon="previousArrow"
|
|
111
|
-
activeIcon
|
|
203
|
+
?activeIcon="${true}"
|
|
112
204
|
?disabled="${this.index <= 0}"
|
|
205
|
+
aria-label="${msg("Previous panel", { id: "pd.panel.viewer.prev" })}"
|
|
206
|
+
role="button"
|
|
207
|
+
tabindex="0"
|
|
113
208
|
@click=${this.previous}
|
|
209
|
+
@keydown=${this._onNavKeyDown}
|
|
114
210
|
></pd-icon>
|
|
115
211
|
<pd-icon
|
|
116
212
|
id="next"
|
|
117
213
|
icon="nextArrow"
|
|
118
|
-
activeIcon
|
|
214
|
+
?activeIcon="${true}"
|
|
119
215
|
?disabled="${this.index === this.children.length - 1}"
|
|
216
|
+
aria-label="${msg("Next panel", { id: "pd.panel.viewer.next" })}"
|
|
217
|
+
role="button"
|
|
218
|
+
tabindex="0"
|
|
120
219
|
@click=${this.next}
|
|
220
|
+
@keydown=${this._onNavKeyDown}
|
|
121
221
|
></pd-icon>
|
|
122
222
|
</div>
|
|
123
|
-
${this.withProgress ? html` <div
|
|
223
|
+
${this.withProgress ? html` <div
|
|
224
|
+
id="progress"
|
|
225
|
+
role="tablist"
|
|
226
|
+
aria-label="${msg("Panel navigation", {
|
|
227
|
+
id: "pd.panel.viewer.progress"
|
|
228
|
+
})}"
|
|
229
|
+
>
|
|
124
230
|
${Array.from(this.children).map(
|
|
125
231
|
(childEl, i) => html` <div
|
|
232
|
+
role="tab"
|
|
233
|
+
tabindex="0"
|
|
234
|
+
aria-selected="${i === this.index}"
|
|
235
|
+
aria-label="${msg("Panel", {
|
|
236
|
+
id: "pd.panel.viewer.panel"
|
|
237
|
+
})} ${i + 1}"
|
|
126
238
|
@click="${() => {
|
|
127
239
|
this._index = i;
|
|
128
240
|
}}"
|
|
241
|
+
@keydown="${(e) => this._onProgressKeyDown(e, i)}"
|
|
129
242
|
class=${classMap({ watched: i <= this.index })}
|
|
130
243
|
></div>`
|
|
131
244
|
)}
|
|
132
|
-
</div>` :
|
|
245
|
+
</div>` : nothing}
|
|
133
246
|
`;
|
|
134
247
|
}
|
|
135
248
|
firstUpdated() {
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
249
|
+
this.addEventListener("pointerdown", this._onPointerDown);
|
|
250
|
+
this.addEventListener("pointermove", this._onPointerMove);
|
|
251
|
+
this.addEventListener("pointerup", this._onPointerUp);
|
|
252
|
+
this.addEventListener("pointercancel", this._onPointerCancel);
|
|
253
|
+
this.addEventListener("dragstart", (e) => e.preventDefault());
|
|
254
|
+
this.style.touchAction = "pan-y";
|
|
255
|
+
this._resizeObserver = new ResizeObserver(() => {
|
|
256
|
+
this._panData = {};
|
|
257
|
+
this._updateLayout();
|
|
139
258
|
});
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
}
|
|
148
|
-
|
|
259
|
+
this._resizeObserver.observe(this);
|
|
260
|
+
}
|
|
261
|
+
disconnectedCallback() {
|
|
262
|
+
super.disconnectedCallback();
|
|
263
|
+
if (this._resizeObserver) {
|
|
264
|
+
this._resizeObserver.disconnect();
|
|
265
|
+
this._resizeObserver = null;
|
|
266
|
+
}
|
|
267
|
+
this.removeEventListener("pointerdown", this._onPointerDown);
|
|
268
|
+
this.removeEventListener("pointermove", this._onPointerMove);
|
|
269
|
+
this.removeEventListener("pointerup", this._onPointerUp);
|
|
270
|
+
this.removeEventListener("pointercancel", this._onPointerCancel);
|
|
149
271
|
}
|
|
150
272
|
update(changedProperties) {
|
|
273
|
+
super.update(changedProperties);
|
|
274
|
+
this._updateLayout();
|
|
275
|
+
}
|
|
276
|
+
/**
|
|
277
|
+
* Positions all panels using translate3d + scale based on current index and pan delta.
|
|
278
|
+
* Handles snap-to-panel decision when pan gesture ends (isFinal).
|
|
279
|
+
*
|
|
280
|
+
* Historical note: Layout-Berechnung aus dem original StackBlitz-Beispiel übernommen.
|
|
281
|
+
* @see https://stackblitz.com/edit/lit-story-viewer?file=story-viewer.ts
|
|
282
|
+
*/
|
|
283
|
+
_updateLayout() {
|
|
151
284
|
const { isFinal = false } = this._panData;
|
|
152
285
|
let { deltaX = 0 } = this._panData;
|
|
153
286
|
const width = this.clientWidth;
|
|
287
|
+
if (width === 0) return;
|
|
154
288
|
const minScale = 0.8;
|
|
155
|
-
if (
|
|
289
|
+
if (isFinal && deltaX !== 0) {
|
|
156
290
|
if (deltaX > width / this.deltaCalc) {
|
|
157
291
|
this.previous();
|
|
158
292
|
} else if (deltaX < -width / this.deltaCalc) {
|
|
159
293
|
this.next();
|
|
160
294
|
}
|
|
295
|
+
this._panData = {};
|
|
296
|
+
deltaX = 0;
|
|
161
297
|
}
|
|
162
298
|
deltaX = isFinal ? 0 : deltaX;
|
|
163
299
|
Array.from(this.children).forEach((el, i) => {
|
|
@@ -165,10 +301,10 @@ class PdPanelViewer extends LitElement {
|
|
|
165
301
|
const u = deltaX / width + (i - this.index);
|
|
166
302
|
const v = -Math.abs(u * (1 - minScale)) + 1;
|
|
167
303
|
const scale = Math.max(v, minScale);
|
|
168
|
-
|
|
169
|
-
|
|
304
|
+
const htmlEl = el;
|
|
305
|
+
htmlEl.style.transform = `translate3d(${x}px,0,0) scale(${scale})`;
|
|
306
|
+
htmlEl.style.opacity = String(scale);
|
|
170
307
|
});
|
|
171
|
-
super.update(changedProperties);
|
|
172
308
|
}
|
|
173
309
|
/* Advance to the next story card if possible */
|
|
174
310
|
next() {
|
|
@@ -186,6 +322,25 @@ class PdPanelViewer extends LitElement {
|
|
|
186
322
|
);
|
|
187
323
|
this._update = false;
|
|
188
324
|
}
|
|
325
|
+
// --- Keyboard Handlers ---
|
|
326
|
+
_onNavKeyDown(e) {
|
|
327
|
+
if (e.key === "Enter" || e.key === " ") {
|
|
328
|
+
e.preventDefault();
|
|
329
|
+
e.currentTarget?.click();
|
|
330
|
+
}
|
|
331
|
+
}
|
|
332
|
+
_onProgressKeyDown(e, index) {
|
|
333
|
+
if (e.key === "Enter" || e.key === " ") {
|
|
334
|
+
e.preventDefault();
|
|
335
|
+
this._index = index;
|
|
336
|
+
} else if (e.key === "ArrowRight" || e.key === "ArrowDown") {
|
|
337
|
+
e.preventDefault();
|
|
338
|
+
this.next();
|
|
339
|
+
} else if (e.key === "ArrowLeft" || e.key === "ArrowUp") {
|
|
340
|
+
e.preventDefault();
|
|
341
|
+
this.previous();
|
|
342
|
+
}
|
|
343
|
+
}
|
|
189
344
|
}
|
|
190
345
|
__decorateClass([
|
|
191
346
|
property({ type: Boolean })
|
|
@@ -194,13 +349,13 @@ __decorateClass([
|
|
|
194
349
|
property({ type: Number })
|
|
195
350
|
], PdPanelViewer.prototype, "deltaCalc");
|
|
196
351
|
__decorateClass([
|
|
197
|
-
|
|
352
|
+
state()
|
|
198
353
|
], PdPanelViewer.prototype, "_index");
|
|
199
354
|
__decorateClass([
|
|
200
|
-
|
|
355
|
+
state()
|
|
201
356
|
], PdPanelViewer.prototype, "_panData");
|
|
202
357
|
__decorateClass([
|
|
203
|
-
|
|
358
|
+
state()
|
|
204
359
|
], PdPanelViewer.prototype, "_update");
|
|
205
360
|
|
|
206
361
|
export { PdPanelViewer };
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { Meta, StoryObj } from '@storybook/web-components-vite';
|
|
2
|
+
/**
|
|
3
|
+
* Story arguments interface for pd-panel-viewer component.
|
|
4
|
+
* Maps to the component's public API.
|
|
5
|
+
*/
|
|
6
|
+
interface PdPanelViewerArgs {
|
|
7
|
+
/** Show progress indicator bar below the panels */
|
|
8
|
+
withProgress: boolean;
|
|
9
|
+
/** Swipe sensitivity divisor (higher = less sensitive) */
|
|
10
|
+
deltaCalc: number;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* ## pd-panel-viewer
|
|
14
|
+
*
|
|
15
|
+
* A carousel/slider component for displaying panels with swipe gestures and navigation arrows.
|
|
16
|
+
*
|
|
17
|
+
* ### Features
|
|
18
|
+
* - Swipe navigation via pointer events (touch and mouse)
|
|
19
|
+
* - Previous/next arrow buttons for navigation
|
|
20
|
+
* - Optional progress indicator bar with clickable segments
|
|
21
|
+
* - Smooth CSS transitions with scale effects
|
|
22
|
+
* - Configurable swipe sensitivity via `deltaCalc`
|
|
23
|
+
* - Responsive layout adapting to container width
|
|
24
|
+
* - `entered` and `exited` events dispatched on child panels
|
|
25
|
+
*
|
|
26
|
+
* ### Accessibility
|
|
27
|
+
* - Container uses `role="region"` with `aria-roledescription="carousel"`
|
|
28
|
+
* - Navigation arrows: `role="button"`, `tabindex="0"`, localized `aria-label`
|
|
29
|
+
* - Progress indicator: `role="tablist"` with `role="tab"` on each segment
|
|
30
|
+
* - `aria-live="polite"` announces panel changes to screen readers
|
|
31
|
+
* - Keyboard: Tab between arrows/progress, Enter/Space to activate, Arrow keys on progress tabs
|
|
32
|
+
*/
|
|
33
|
+
declare const meta: Meta<PdPanelViewerArgs>;
|
|
34
|
+
export default meta;
|
|
35
|
+
type Story = StoryObj<PdPanelViewerArgs>;
|
|
36
|
+
/** Default panel viewer with progress indicator. Interactive via Controls panel. */
|
|
37
|
+
export declare const Default: Story;
|
|
38
|
+
/** Visual comparison: with progress, without progress, and compact size. */
|
|
39
|
+
export declare const AllVariants: Story;
|
|
40
|
+
/** Panel viewer with gradient content cards showing a realistic use case. */
|
|
41
|
+
export declare const ContentCards: Story;
|
|
42
|
+
/** Side-by-side comparison of high vs. low swipe sensitivity. */
|
|
43
|
+
export declare const SwipeSensitivity: Story;
|
|
44
|
+
/** CSS Custom Properties -- Branded and Redesigned variants. */
|
|
45
|
+
export declare const CustomStyling: Story;
|
|
46
|
+
//# sourceMappingURL=pd-panel-viewer.stories.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pd-panel-viewer.stories.d.ts","sourceRoot":"","sources":["../../src/pd-panel-viewer/pd-panel-viewer.stories.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,gCAAgC,CAAC;AAGrE,OAAO,sBAAsB,CAAC;AAM9B;;;GAGG;AACH,UAAU,iBAAiB;IACzB,mDAAmD;IACnD,YAAY,EAAE,OAAO,CAAC;IACtB,0DAA0D;IAC1D,SAAS,EAAE,MAAM,CAAC;CACnB;AAkGD;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,iBAAiB,CA+DjC,CAAC;AAEF,eAAe,IAAI,CAAC;AACpB,KAAK,KAAK,GAAG,QAAQ,CAAC,iBAAiB,CAAC,CAAC;AAMzC,oFAAoF;AACpF,eAAO,MAAM,OAAO,EAAE,KAUrB,CAAC;AAMF,4EAA4E;AAC5E,eAAO,MAAM,WAAW,EAAE,KA0CzB,CAAC;AAMF,6EAA6E;AAC7E,eAAO,MAAM,YAAY,EAAE,KAkB1B,CAAC;AAMF,iEAAiE;AACjE,eAAO,MAAM,gBAAgB,EAAE,KA0C9B,CAAC;AAMF,gEAAgE;AAChE,eAAO,MAAM,aAAa,EAAE,KAyE3B,CAAC"}
|
|
@@ -1,15 +1,12 @@
|
|
|
1
1
|
import { LitElement } from 'lit';
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
* Komponente zur responsiven Darstellung von Inhalten.
|
|
6
|
-
* Wenn die Bildschirmbreite unter `resizeWidth` liegt, wird ein Popup angezeigt.
|
|
3
|
+
* Responsive content component that switches between inline and popup display.
|
|
7
4
|
*
|
|
8
|
-
* @
|
|
9
|
-
* @
|
|
5
|
+
* @tagname pd-resize-content
|
|
6
|
+
* @summary Responsive content wrapper that shows popup below breakpoint.
|
|
10
7
|
*
|
|
11
|
-
* @slot resize-content -
|
|
12
|
-
* @slot preview-content -
|
|
8
|
+
* @slot resize-content - Main content shown when viewport is wide enough.
|
|
9
|
+
* @slot preview-content - Preview content shown in popup trigger when viewport is narrow.
|
|
13
10
|
*/
|
|
14
11
|
export declare class PdResizeContent extends LitElement {
|
|
15
12
|
/**
|
|
@@ -17,11 +14,16 @@ export declare class PdResizeContent extends LitElement {
|
|
|
17
14
|
*/
|
|
18
15
|
resizeWidth: string;
|
|
19
16
|
/**
|
|
20
|
-
* Interner Zustand: Gibt an, ob der Inhalt versteckt werden soll und stattdessen ein Popup angezeigt wird.
|
|
21
|
-
*/
|
|
17
|
+
* * Interner Zustand: Gibt an, ob der Inhalt versteckt werden soll und stattdessen ein Popup angezeigt wird.
|
|
18
|
+
* @ignore */
|
|
22
19
|
private _hideContent;
|
|
20
|
+
/** @ignore */
|
|
21
|
+
private _mediaQueryList?;
|
|
22
|
+
/** @ignore */
|
|
23
|
+
private _mediaQueryHandler?;
|
|
23
24
|
static styles: import('lit').CSSResult;
|
|
24
25
|
connectedCallback(): void;
|
|
26
|
+
disconnectedCallback(): void;
|
|
25
27
|
protected render(): import('lit').TemplateResult<1>;
|
|
26
28
|
}
|
|
27
29
|
//# sourceMappingURL=PdResizeContent.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PdResizeContent.d.ts","sourceRoot":"","sources":["../../src/pd-resize-content/PdResizeContent.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,UAAU,EAAa,MAAM,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"PdResizeContent.d.ts","sourceRoot":"","sources":["../../src/pd-resize-content/PdResizeContent.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,UAAU,EAAa,MAAM,KAAK,CAAC;AAG5C,OAAO,6CAA6C,CAAC;AAErD;;;;;;;;GAQG;AACH,qBAAa,eAAgB,SAAQ,UAAU;IAC7C;;OAEG;IAEH,WAAW,SAAY;IAEvB;;iBAEa;IAEb,OAAO,CAAC,YAAY,CAAS;IAE7B,cAAc;IACd,OAAO,CAAC,eAAe,CAAC,CAAiB;IACzC,cAAc;IACd,OAAO,CAAC,kBAAkB,CAAC,CAAmC;IAE9D,MAAM,CAAC,MAAM,0BAaX;IAEF,iBAAiB,IAAI,IAAI;IAazB,oBAAoB,IAAI,IAAI;IAU5B,SAAS,CAAC,MAAM;CAUjB"}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { LitElement, css, html } from 'lit';
|
|
2
2
|
import { property, state } from 'lit/decorators.js';
|
|
3
|
-
import { installMediaQueryWatcher } from 'pwa-helpers/media-query';
|
|
4
3
|
import '@progressive-development/pd-dialog/pd-popup';
|
|
5
4
|
|
|
6
5
|
var __defProp = Object.defineProperty;
|
|
@@ -25,23 +24,34 @@ class PdResizeContent extends LitElement {
|
|
|
25
24
|
}
|
|
26
25
|
|
|
27
26
|
h3 {
|
|
28
|
-
color:
|
|
29
|
-
font-family:
|
|
27
|
+
color: var(--pd-default-col);
|
|
28
|
+
font-family: var(--pd-default-font-title-family);
|
|
30
29
|
}
|
|
31
30
|
|
|
32
31
|
p {
|
|
33
|
-
color:
|
|
32
|
+
color: var(--pd-default-col);
|
|
34
33
|
}
|
|
35
34
|
`;
|
|
36
35
|
}
|
|
37
36
|
connectedCallback() {
|
|
38
37
|
super.connectedCallback();
|
|
39
|
-
|
|
40
|
-
`(min-width: ${this.resizeWidth})
|
|
41
|
-
(matches) => {
|
|
42
|
-
this._hideContent = !matches;
|
|
43
|
-
}
|
|
38
|
+
this._mediaQueryList = window.matchMedia(
|
|
39
|
+
`(min-width: ${this.resizeWidth})`
|
|
44
40
|
);
|
|
41
|
+
this._mediaQueryHandler = (e) => {
|
|
42
|
+
this._hideContent = !e.matches;
|
|
43
|
+
};
|
|
44
|
+
this._hideContent = !this._mediaQueryList.matches;
|
|
45
|
+
this._mediaQueryList.addEventListener("change", this._mediaQueryHandler);
|
|
46
|
+
}
|
|
47
|
+
disconnectedCallback() {
|
|
48
|
+
super.disconnectedCallback();
|
|
49
|
+
if (this._mediaQueryList && this._mediaQueryHandler) {
|
|
50
|
+
this._mediaQueryList.removeEventListener(
|
|
51
|
+
"change",
|
|
52
|
+
this._mediaQueryHandler
|
|
53
|
+
);
|
|
54
|
+
}
|
|
45
55
|
}
|
|
46
56
|
render() {
|
|
47
57
|
return this._hideContent ? html`
|
|
@@ -1,5 +1,37 @@
|
|
|
1
|
-
import { Meta,
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import { Meta, StoryObj } from '@storybook/web-components-vite';
|
|
2
|
+
/**
|
|
3
|
+
* Story arguments interface for pd-resize-content component.
|
|
4
|
+
* Maps to the component's public API.
|
|
5
|
+
*/
|
|
6
|
+
interface PdResizeContentArgs {
|
|
7
|
+
/** Minimum width threshold - below this, content shows in popup */
|
|
8
|
+
resizeWidth: string;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* ## pd-resize-content
|
|
12
|
+
*
|
|
13
|
+
* A responsive content component that switches between inline display and popup
|
|
14
|
+
* based on viewport width. Uses a native media query watcher for performance.
|
|
15
|
+
*
|
|
16
|
+
* ### Features
|
|
17
|
+
* - Responsive display: automatically switches between inline and popup
|
|
18
|
+
* - Configurable breakpoint via `resizeWidth` property
|
|
19
|
+
* - Media query based for optimal performance
|
|
20
|
+
* - Two slots: `resize-content` for full content, `preview-content` for popup trigger
|
|
21
|
+
* - Delegates to `pd-popup` when viewport is narrow
|
|
22
|
+
*
|
|
23
|
+
* ### Accessibility
|
|
24
|
+
* - Content remains accessible in both inline and popup modes
|
|
25
|
+
* - Popup mode inherits accessibility from `pd-popup` component
|
|
26
|
+
* - No keyboard traps; content is reachable via Tab navigation
|
|
27
|
+
*/
|
|
28
|
+
declare const meta: Meta<PdResizeContentArgs>;
|
|
29
|
+
export default meta;
|
|
30
|
+
type Story = StoryObj<PdResizeContentArgs>;
|
|
31
|
+
/** Default resize-content with 800px breakpoint. Resize the browser window to see the popup behavior. */
|
|
32
|
+
export declare const Default: Story;
|
|
33
|
+
/** All breakpoint sizes at a glance. Resize the browser to see each threshold in action. */
|
|
34
|
+
export declare const BreakpointComparison: Story;
|
|
35
|
+
/** Rich content like tables that benefit from responsive display. */
|
|
36
|
+
export declare const WithRichContent: Story;
|
|
5
37
|
//# sourceMappingURL=pd-resize-content.stories.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pd-resize-content.stories.d.ts","sourceRoot":"","sources":["../../src/pd-resize-content/pd-resize-content.stories.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"pd-resize-content.stories.d.ts","sourceRoot":"","sources":["../../src/pd-resize-content/pd-resize-content.stories.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,gCAAgC,CAAC;AAGrE,OAAO,wBAAwB,CAAC;AAMhC;;;GAGG;AACH,UAAU,mBAAmB;IAC3B,mEAAmE;IACnE,WAAW,EAAE,MAAM,CAAC;CACrB;AAMD;;;;;;;;;;;;;;;;;GAiBG;AACH,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,mBAAmB,CAuDnC,CAAC;AAEF,eAAe,IAAI,CAAC;AACpB,KAAK,KAAK,GAAG,QAAQ,CAAC,mBAAmB,CAAC,CAAC;AAM3C,yGAAyG;AACzG,eAAO,MAAM,OAAO,EAAE,KAErB,CAAC;AAMF,4FAA4F;AAC5F,eAAO,MAAM,oBAAoB,EAAE,KA2DlC,CAAC;AAMF,qEAAqE;AACrE,eAAO,MAAM,eAAe,EAAE,KA0G7B,CAAC"}
|
package/dist/pd-tab/PdTab.d.ts
CHANGED
|
@@ -1,16 +1,49 @@
|
|
|
1
1
|
import { LitElement, CSSResultGroup } from 'lit';
|
|
2
2
|
import { TabHeader } from '../types';
|
|
3
3
|
/**
|
|
4
|
+
* Tab navigation component with header tabs and content slots.
|
|
5
|
+
*
|
|
6
|
+
* Supports responsive label switching (full → short labels)
|
|
7
|
+
* when tabs overflow their container.
|
|
8
|
+
*
|
|
4
9
|
* @tagname pd-tab
|
|
10
|
+
* @summary Tab navigation with responsive label switching.
|
|
11
|
+
*
|
|
12
|
+
* @event tab-selected - Fired when a tab is selected. Emits the tab key.
|
|
13
|
+
*
|
|
14
|
+
* @slot [key] - Named slots for each tab content, matching the tab key.
|
|
15
|
+
*
|
|
16
|
+
* @cssprop --pd-tab-header-padding - Tab header padding. Default: `0.5em 1em`.
|
|
17
|
+
* @cssprop --pd-tab-font-size - Tab font size. Default: `0.875rem`.
|
|
18
|
+
* @cssprop --pd-tab-font-size-compact - Font size in compact mode. Default: `0.8rem`.
|
|
19
|
+
* @cssprop --pd-tab-text-col - Tab text color.
|
|
20
|
+
* @cssprop --pd-tab-active-text-col - Active tab text color.
|
|
21
|
+
* @cssprop --pd-tab-active-indicator-col - Active tab underline color.
|
|
22
|
+
* @cssprop --pd-tab-active-indicator-height - Active tab underline thickness. Default: `2px`.
|
|
23
|
+
* @cssprop --pd-tab-hover-bg-col - Tab hover background.
|
|
24
|
+
* @cssprop --pd-tab-disabled-text-col - Disabled tab text color.
|
|
25
|
+
* @cssprop --pd-tab-icon-size - Icon size in tab headers. Default: `1.125em`.
|
|
26
|
+
* @cssprop --pd-tab-icon-gap - Gap between icon and label. Default: `0.35em`.
|
|
27
|
+
* @cssprop --pd-tab-content-padding - Content area padding.
|
|
28
|
+
* @cssprop --pd-tab-content-border - Content area border.
|
|
5
29
|
*/
|
|
6
30
|
export declare class PdTab extends LitElement {
|
|
31
|
+
/** Array of tab header definitions. */
|
|
7
32
|
tabs: TabHeader[];
|
|
33
|
+
/** Key of the initially active tab. */
|
|
8
34
|
defaultTab?: string;
|
|
9
|
-
_activeTab
|
|
35
|
+
private _activeTab?;
|
|
36
|
+
private _headerContainer;
|
|
37
|
+
private _resizeObserver;
|
|
10
38
|
static styles: CSSResultGroup;
|
|
11
|
-
protected
|
|
39
|
+
protected willUpdate(changedProperties: Map<string, unknown>): void;
|
|
40
|
+
protected updated(changedProperties: Map<string, unknown>): void;
|
|
41
|
+
firstUpdated(): void;
|
|
42
|
+
disconnectedCallback(): void;
|
|
12
43
|
render(): import('lit').TemplateResult<1>;
|
|
13
44
|
reset(): void;
|
|
45
|
+
private _checkOverflow;
|
|
46
|
+
private _onKeyDown;
|
|
14
47
|
private _tabSelected;
|
|
15
48
|
}
|
|
16
49
|
//# sourceMappingURL=PdTab.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PdTab.d.ts","sourceRoot":"","sources":["../../src/pd-tab/PdTab.ts"],"names":[],"mappings":"AAAA,OAAO,EAAQ,UAAU,
|
|
1
|
+
{"version":3,"file":"PdTab.d.ts","sourceRoot":"","sources":["../../src/pd-tab/PdTab.ts"],"names":[],"mappings":"AAAA,OAAO,EAAQ,UAAU,EAAgB,cAAc,EAAE,MAAM,KAAK,CAAC;AAGrE,OAAO,0CAA0C,CAAC;AAElD,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAErC;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,qBAAa,KAAM,SAAQ,UAAU;IACnC,uCAAuC;IAEvC,IAAI,EAAE,SAAS,EAAE,CAAM;IAEvB,uCAAuC;IAEvC,UAAU,CAAC,EAAE,MAAM,CAAC;IAGpB,OAAO,CAAC,UAAU,CAAC,CAAS;IAG5B,OAAO,CAAC,gBAAgB,CAAe;IAEvC,OAAO,CAAC,eAAe,CAA+B;IAEtD,MAAM,CAAC,MAAM,EAiHR,cAAc,CAAC;cAED,UAAU,CAAC,iBAAiB,EAAE,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI;cAMzD,OAAO,CAAC,iBAAiB,EAAE,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI;IAMhE,YAAY,IAAI,IAAI;IAKpB,oBAAoB,IAAI,IAAI;IAQrC,MAAM;IAiDN,KAAK;IAQL,OAAO,CAAC,cAAc;IAgBtB,OAAO,CAAC,UAAU;IAsDlB,OAAO,CAAC,YAAY;CAcrB"}
|