@progressive-development/pd-content 0.9.2 → 1.0.1
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 +56 -2
- package/dist/pd-panel-viewer/PdPanelViewer.d.ts.map +1 -1
- package/dist/pd-panel-viewer/PdPanelViewer.js +199 -36
- 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 (Drag Gesture on .panel-content) ---
|
|
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
|
+
e.currentTarget.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 {
|
|
@@ -45,11 +107,28 @@ class PdPanelViewer extends LitElement {
|
|
|
45
107
|
box-sizing: border-box;
|
|
46
108
|
}
|
|
47
109
|
|
|
110
|
+
.panel-content {
|
|
111
|
+
position: relative;
|
|
112
|
+
width: 100%;
|
|
113
|
+
height: 100%;
|
|
114
|
+
touch-action: pan-y;
|
|
115
|
+
}
|
|
116
|
+
|
|
48
117
|
pd-icon {
|
|
49
118
|
position: absolute;
|
|
50
|
-
top: calc(50% - 25px);
|
|
119
|
+
top: var(--pd-panel-nav-top, calc(50% - 25px));
|
|
51
120
|
height: 50px;
|
|
52
121
|
cursor: pointer;
|
|
122
|
+
z-index: 1;
|
|
123
|
+
--pd-icon-col-active: var(--pd-panel-icon-col, var(--pd-on-primary-col));
|
|
124
|
+
--pd-icon-col-hover: var(
|
|
125
|
+
--pd-panel-icon-col-hover,
|
|
126
|
+
var(--pd-on-primary-col)
|
|
127
|
+
);
|
|
128
|
+
--pd-icon-col-disabled: var(
|
|
129
|
+
--pd-panel-icon-col-disabled,
|
|
130
|
+
var(--pd-default-disabled-col)
|
|
131
|
+
);
|
|
53
132
|
}
|
|
54
133
|
|
|
55
134
|
#prev {
|
|
@@ -60,11 +139,21 @@ class PdPanelViewer extends LitElement {
|
|
|
60
139
|
right: 0;
|
|
61
140
|
}
|
|
62
141
|
|
|
142
|
+
@media (max-width: 768px) {
|
|
143
|
+
.panel-container {
|
|
144
|
+
padding: 0 0.5rem;
|
|
145
|
+
}
|
|
146
|
+
pd-icon {
|
|
147
|
+
height: 36px;
|
|
148
|
+
top: var(--pd-panel-nav-top, calc(50% - 18px));
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
|
|
63
152
|
#progress {
|
|
64
153
|
position: relative;
|
|
65
154
|
height: 20px;
|
|
66
155
|
width: 50%;
|
|
67
|
-
margin: 0.5rem auto;
|
|
156
|
+
margin: var(--pd-panel-progress-margin, 0.5rem auto);
|
|
68
157
|
display: grid;
|
|
69
158
|
grid-auto-flow: column;
|
|
70
159
|
grid-auto-columns: 1fr;
|
|
@@ -74,14 +163,18 @@ class PdPanelViewer extends LitElement {
|
|
|
74
163
|
}
|
|
75
164
|
|
|
76
165
|
#progress > div {
|
|
77
|
-
background: var(--pd-panel-progress-col,
|
|
78
|
-
height: 4px;
|
|
166
|
+
background: var(--pd-panel-progress-col, rgba(255, 255, 255, 0.4));
|
|
167
|
+
height: var(--pd-panel-progress-height, 4px);
|
|
168
|
+
border-radius: var(--pd-panel-progress-border-radius, 0);
|
|
79
169
|
transition: background 0.3s linear;
|
|
80
170
|
cursor: pointer;
|
|
81
171
|
}
|
|
82
172
|
|
|
83
173
|
#progress > div.watched {
|
|
84
|
-
background: var(
|
|
174
|
+
background: var(
|
|
175
|
+
--pd-panel-progress-watched-col,
|
|
176
|
+
var(--pd-on-primary-col)
|
|
177
|
+
);
|
|
85
178
|
}
|
|
86
179
|
|
|
87
180
|
::slotted(*) {
|
|
@@ -103,61 +196,112 @@ class PdPanelViewer extends LitElement {
|
|
|
103
196
|
}
|
|
104
197
|
render() {
|
|
105
198
|
return html`
|
|
106
|
-
<div
|
|
107
|
-
|
|
199
|
+
<div
|
|
200
|
+
class="panel-container"
|
|
201
|
+
role="region"
|
|
202
|
+
aria-roledescription="carousel"
|
|
203
|
+
aria-label="${msg("Panel viewer", {
|
|
204
|
+
id: "pd.panel.viewer.aria.label"
|
|
205
|
+
})}"
|
|
206
|
+
aria-live="polite"
|
|
207
|
+
>
|
|
208
|
+
<div
|
|
209
|
+
class="panel-content"
|
|
210
|
+
@pointerdown=${this._onPointerDown}
|
|
211
|
+
@pointermove=${this._onPointerMove}
|
|
212
|
+
@pointerup=${this._onPointerUp}
|
|
213
|
+
@pointercancel=${this._onPointerCancel}
|
|
214
|
+
@dragstart=${(e) => e.preventDefault()}
|
|
215
|
+
>
|
|
216
|
+
<slot></slot>
|
|
217
|
+
</div>
|
|
108
218
|
<pd-icon
|
|
109
219
|
id="prev"
|
|
110
220
|
icon="previousArrow"
|
|
111
|
-
activeIcon
|
|
221
|
+
?activeIcon="${true}"
|
|
112
222
|
?disabled="${this.index <= 0}"
|
|
223
|
+
aria-label="${msg("Previous panel", { id: "pd.panel.viewer.prev" })}"
|
|
224
|
+
role="button"
|
|
225
|
+
tabindex="0"
|
|
113
226
|
@click=${this.previous}
|
|
227
|
+
@keydown=${this._onNavKeyDown}
|
|
114
228
|
></pd-icon>
|
|
115
229
|
<pd-icon
|
|
116
230
|
id="next"
|
|
117
231
|
icon="nextArrow"
|
|
118
|
-
activeIcon
|
|
232
|
+
?activeIcon="${true}"
|
|
119
233
|
?disabled="${this.index === this.children.length - 1}"
|
|
234
|
+
aria-label="${msg("Next panel", { id: "pd.panel.viewer.next" })}"
|
|
235
|
+
role="button"
|
|
236
|
+
tabindex="0"
|
|
120
237
|
@click=${this.next}
|
|
238
|
+
@keydown=${this._onNavKeyDown}
|
|
121
239
|
></pd-icon>
|
|
122
240
|
</div>
|
|
123
|
-
${this.withProgress ? html` <div
|
|
241
|
+
${this.withProgress ? html` <div
|
|
242
|
+
id="progress"
|
|
243
|
+
role="tablist"
|
|
244
|
+
aria-label="${msg("Panel navigation", {
|
|
245
|
+
id: "pd.panel.viewer.progress"
|
|
246
|
+
})}"
|
|
247
|
+
>
|
|
124
248
|
${Array.from(this.children).map(
|
|
125
249
|
(childEl, i) => html` <div
|
|
250
|
+
role="tab"
|
|
251
|
+
tabindex="0"
|
|
252
|
+
aria-selected="${i === this.index}"
|
|
253
|
+
aria-label="${msg("Panel", {
|
|
254
|
+
id: "pd.panel.viewer.panel"
|
|
255
|
+
})} ${i + 1}"
|
|
126
256
|
@click="${() => {
|
|
127
257
|
this._index = i;
|
|
128
258
|
}}"
|
|
259
|
+
@keydown="${(e) => this._onProgressKeyDown(e, i)}"
|
|
129
260
|
class=${classMap({ watched: i <= this.index })}
|
|
130
261
|
></div>`
|
|
131
262
|
)}
|
|
132
|
-
</div>` :
|
|
263
|
+
</div>` : nothing}
|
|
133
264
|
`;
|
|
134
265
|
}
|
|
135
266
|
firstUpdated() {
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
this.
|
|
267
|
+
this._resizeObserver = new ResizeObserver(() => {
|
|
268
|
+
this._panData = {};
|
|
269
|
+
this._updateLayout();
|
|
139
270
|
});
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
}
|
|
148
|
-
ro.observe(this);
|
|
271
|
+
this._resizeObserver.observe(this);
|
|
272
|
+
}
|
|
273
|
+
disconnectedCallback() {
|
|
274
|
+
super.disconnectedCallback();
|
|
275
|
+
if (this._resizeObserver) {
|
|
276
|
+
this._resizeObserver.disconnect();
|
|
277
|
+
this._resizeObserver = null;
|
|
278
|
+
}
|
|
149
279
|
}
|
|
150
280
|
update(changedProperties) {
|
|
281
|
+
super.update(changedProperties);
|
|
282
|
+
this._updateLayout();
|
|
283
|
+
}
|
|
284
|
+
/**
|
|
285
|
+
* Positions all panels using translate3d + scale based on current index and pan delta.
|
|
286
|
+
* Handles snap-to-panel decision when pan gesture ends (isFinal).
|
|
287
|
+
*
|
|
288
|
+
* Historical note: Layout-Berechnung aus dem original StackBlitz-Beispiel übernommen.
|
|
289
|
+
* @see https://stackblitz.com/edit/lit-story-viewer?file=story-viewer.ts
|
|
290
|
+
*/
|
|
291
|
+
_updateLayout() {
|
|
151
292
|
const { isFinal = false } = this._panData;
|
|
152
293
|
let { deltaX = 0 } = this._panData;
|
|
153
294
|
const width = this.clientWidth;
|
|
295
|
+
if (width === 0) return;
|
|
154
296
|
const minScale = 0.8;
|
|
155
|
-
if (
|
|
297
|
+
if (isFinal && deltaX !== 0) {
|
|
156
298
|
if (deltaX > width / this.deltaCalc) {
|
|
157
299
|
this.previous();
|
|
158
300
|
} else if (deltaX < -width / this.deltaCalc) {
|
|
159
301
|
this.next();
|
|
160
302
|
}
|
|
303
|
+
this._panData = {};
|
|
304
|
+
deltaX = 0;
|
|
161
305
|
}
|
|
162
306
|
deltaX = isFinal ? 0 : deltaX;
|
|
163
307
|
Array.from(this.children).forEach((el, i) => {
|
|
@@ -165,10 +309,10 @@ class PdPanelViewer extends LitElement {
|
|
|
165
309
|
const u = deltaX / width + (i - this.index);
|
|
166
310
|
const v = -Math.abs(u * (1 - minScale)) + 1;
|
|
167
311
|
const scale = Math.max(v, minScale);
|
|
168
|
-
|
|
169
|
-
|
|
312
|
+
const htmlEl = el;
|
|
313
|
+
htmlEl.style.transform = `translate3d(${x}px,0,0) scale(${scale})`;
|
|
314
|
+
htmlEl.style.opacity = String(scale);
|
|
170
315
|
});
|
|
171
|
-
super.update(changedProperties);
|
|
172
316
|
}
|
|
173
317
|
/* Advance to the next story card if possible */
|
|
174
318
|
next() {
|
|
@@ -186,6 +330,25 @@ class PdPanelViewer extends LitElement {
|
|
|
186
330
|
);
|
|
187
331
|
this._update = false;
|
|
188
332
|
}
|
|
333
|
+
// --- Keyboard Handlers ---
|
|
334
|
+
_onNavKeyDown(e) {
|
|
335
|
+
if (e.key === "Enter" || e.key === " ") {
|
|
336
|
+
e.preventDefault();
|
|
337
|
+
e.currentTarget?.click();
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
_onProgressKeyDown(e, index) {
|
|
341
|
+
if (e.key === "Enter" || e.key === " ") {
|
|
342
|
+
e.preventDefault();
|
|
343
|
+
this._index = index;
|
|
344
|
+
} else if (e.key === "ArrowRight" || e.key === "ArrowDown") {
|
|
345
|
+
e.preventDefault();
|
|
346
|
+
this.next();
|
|
347
|
+
} else if (e.key === "ArrowLeft" || e.key === "ArrowUp") {
|
|
348
|
+
e.preventDefault();
|
|
349
|
+
this.previous();
|
|
350
|
+
}
|
|
351
|
+
}
|
|
189
352
|
}
|
|
190
353
|
__decorateClass([
|
|
191
354
|
property({ type: Boolean })
|
|
@@ -194,13 +357,13 @@ __decorateClass([
|
|
|
194
357
|
property({ type: Number })
|
|
195
358
|
], PdPanelViewer.prototype, "deltaCalc");
|
|
196
359
|
__decorateClass([
|
|
197
|
-
|
|
360
|
+
state()
|
|
198
361
|
], PdPanelViewer.prototype, "_index");
|
|
199
362
|
__decorateClass([
|
|
200
|
-
|
|
363
|
+
state()
|
|
201
364
|
], PdPanelViewer.prototype, "_panData");
|
|
202
365
|
__decorateClass([
|
|
203
|
-
|
|
366
|
+
state()
|
|
204
367
|
], PdPanelViewer.prototype, "_update");
|
|
205
368
|
|
|
206
369
|
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"}
|