@paperless/core 1.38.5 → 1.38.7
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/CHANGELOG.md +19 -0
- package/dist/build/p-c7c6176b.entry.js +2 -0
- package/dist/build/p-c7c6176b.entry.js.map +1 -0
- package/dist/build/paperless.esm.js +1 -1
- package/dist/build/paperless.esm.js.map +1 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/p-stepper.cjs.entry.js +32 -17
- package/dist/cjs/p-stepper.cjs.entry.js.map +1 -1
- package/dist/cjs/paperless.cjs.js +1 -1
- package/dist/collection/components/molecules/stepper/stepper.component.js +32 -22
- package/dist/collection/components/molecules/stepper/stepper.component.js.map +1 -1
- package/dist/components/p-stepper.js +33 -19
- package/dist/components/p-stepper.js.map +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/esm/p-stepper.entry.js +32 -17
- package/dist/esm/p-stepper.entry.js.map +1 -1
- package/dist/esm/paperless.js +1 -1
- package/dist/index.html +1 -1
- package/dist/paperless/p-c7c6176b.entry.js +2 -0
- package/dist/paperless/p-c7c6176b.entry.js.map +1 -0
- package/dist/paperless/paperless.esm.js +1 -1
- package/dist/paperless/paperless.esm.js.map +1 -1
- package/dist/sw.js +1 -1
- package/dist/sw.js.map +1 -1
- package/dist/types/components/molecules/stepper/stepper.component.d.ts +3 -2
- package/hydrate/index.js +33 -19
- package/package.json +1 -1
- package/dist/build/p-72a02f5f.entry.js +0 -2
- package/dist/build/p-72a02f5f.entry.js.map +0 -1
- package/dist/paperless/p-72a02f5f.entry.js +0 -2
- package/dist/paperless/p-72a02f5f.entry.js.map +0 -1
package/hydrate/index.js
CHANGED
|
@@ -21377,18 +21377,25 @@ const stepperComponentCss = "/*!@.flex*/.flex.sc-p-stepper{display:flex!importan
|
|
|
21377
21377
|
class Stepper {
|
|
21378
21378
|
constructor(hostRef) {
|
|
21379
21379
|
registerInstance(this, hostRef);
|
|
21380
|
+
this._rendering = false;
|
|
21381
|
+
this._loaded = false;
|
|
21380
21382
|
this.activeStep = 1;
|
|
21381
21383
|
this.direction = 'horizontal';
|
|
21382
21384
|
this.contentPosition = 'end';
|
|
21383
|
-
this._rerender = false;
|
|
21384
21385
|
}
|
|
21385
|
-
|
|
21386
|
-
|
|
21386
|
+
// private _steps: Array<HTMLPStepperItemElement>;
|
|
21387
|
+
componentDidLoad() {
|
|
21388
|
+
this._loaded = true;
|
|
21389
|
+
this._generateSteps(true);
|
|
21387
21390
|
}
|
|
21388
21391
|
render() {
|
|
21389
|
-
return (hAsync(Host, { class: "p-stepper" }, hAsync("slot",
|
|
21392
|
+
return (hAsync(Host, { class: "p-stepper" }, hAsync("slot", { onSlotchange: () => this._generateSteps() })));
|
|
21390
21393
|
}
|
|
21391
|
-
_generateSteps() {
|
|
21394
|
+
async _generateSteps(firstLoad = false) {
|
|
21395
|
+
if (!firstLoad && (!this._el || this._rendering || !this._loaded)) {
|
|
21396
|
+
return;
|
|
21397
|
+
}
|
|
21398
|
+
this._rendering = true;
|
|
21392
21399
|
let activeStep = this.activeStep - 1 || 0;
|
|
21393
21400
|
const items = this._el.querySelectorAll('p-stepper-item');
|
|
21394
21401
|
if (!this.activeStep || activeStep < 0) {
|
|
@@ -21403,9 +21410,13 @@ class Stepper {
|
|
|
21403
21410
|
}
|
|
21404
21411
|
}
|
|
21405
21412
|
for (let i = 0; i < (items === null || items === void 0 ? void 0 : items.length); i++) {
|
|
21413
|
+
let directionChanged = false;
|
|
21406
21414
|
const item = items.item(i);
|
|
21407
21415
|
item.active = i === activeStep;
|
|
21408
21416
|
item.finished = i < activeStep;
|
|
21417
|
+
if (item.direction !== this.direction) {
|
|
21418
|
+
directionChanged = true;
|
|
21419
|
+
}
|
|
21409
21420
|
item.direction = this.direction;
|
|
21410
21421
|
item.align =
|
|
21411
21422
|
i === 0 ? 'start' : i === (items === null || items === void 0 ? void 0 : items.length) - 1 ? 'end' : 'center';
|
|
@@ -21414,7 +21425,14 @@ class Stepper {
|
|
|
21414
21425
|
const nextItem = item.nextElementSibling;
|
|
21415
21426
|
if (nextItem &&
|
|
21416
21427
|
nextItem.tagName.toLowerCase() === 'p-stepper-item') {
|
|
21417
|
-
|
|
21428
|
+
// super hacky, but we want to wait for the css of the `item.direction` change to be applied before querying for the item.clientHeight
|
|
21429
|
+
// otherwise we always get the initial "16"
|
|
21430
|
+
if (directionChanged) {
|
|
21431
|
+
await new Promise((resolve) => setTimeout(resolve, 10));
|
|
21432
|
+
}
|
|
21433
|
+
const heightDiff = (item.clientHeight > 16
|
|
21434
|
+
? item.clientHeight - 16
|
|
21435
|
+
: item.clientHeight) / 2;
|
|
21418
21436
|
const stepperLine = document.createElement('p-stepper-line');
|
|
21419
21437
|
stepperLine.direction = this.direction;
|
|
21420
21438
|
stepperLine.active = i <= activeStep;
|
|
@@ -21424,6 +21442,11 @@ class Stepper {
|
|
|
21424
21442
|
stepperLine.style.minHeight = `calc(1rem + ${(heightDiff * 2) / 16}rem)`;
|
|
21425
21443
|
}
|
|
21426
21444
|
this._el.insertBefore(stepperLine, nextItem);
|
|
21445
|
+
const previous = stepperLine.previousElementSibling;
|
|
21446
|
+
if (previous &&
|
|
21447
|
+
previous.tagName.toLowerCase() === 'p-stepper-line') {
|
|
21448
|
+
previous.remove();
|
|
21449
|
+
}
|
|
21427
21450
|
continue;
|
|
21428
21451
|
}
|
|
21429
21452
|
}
|
|
@@ -21435,20 +21458,12 @@ class Stepper {
|
|
|
21435
21458
|
}
|
|
21436
21459
|
}
|
|
21437
21460
|
}
|
|
21438
|
-
|
|
21439
|
-
const lines = this._el.querySelectorAll('p-stepper-line');
|
|
21440
|
-
let didRemove = false;
|
|
21461
|
+
const lines = this._el.querySelectorAll('p-stepper-line + p-stepper-line, p-stepper-line:not(:has(+ p-stepper-item))');
|
|
21441
21462
|
for (let j = lines.length - 1; j >= 0; j--) {
|
|
21442
21463
|
const line = lines.item(j);
|
|
21443
|
-
|
|
21444
|
-
if (previousItem.tagName.toLowerCase() === 'p-stepper-line') {
|
|
21445
|
-
didRemove = true;
|
|
21446
|
-
line.remove();
|
|
21447
|
-
}
|
|
21448
|
-
}
|
|
21449
|
-
if (didRemove) {
|
|
21450
|
-
this._rerender = !this._rerender;
|
|
21464
|
+
line.remove();
|
|
21451
21465
|
}
|
|
21466
|
+
setTimeout(() => (this._rendering = false), 100);
|
|
21452
21467
|
}
|
|
21453
21468
|
get _el() { return getElement(this); }
|
|
21454
21469
|
static get watchers() { return {
|
|
@@ -21461,8 +21476,7 @@ class Stepper {
|
|
|
21461
21476
|
"$members$": {
|
|
21462
21477
|
"activeStep": [2, "active-step"],
|
|
21463
21478
|
"direction": [513],
|
|
21464
|
-
"contentPosition": [513, "content-position"]
|
|
21465
|
-
"_rerender": [32]
|
|
21479
|
+
"contentPosition": [513, "content-position"]
|
|
21466
21480
|
},
|
|
21467
21481
|
"$listeners$": undefined,
|
|
21468
21482
|
"$lazyBundleId$": "-",
|
package/package.json
CHANGED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{r as t,h as e,H as i,g as s}from"./p-e4d5e7a7.js";const o=".flex{display:flex!important}.h-auto{height:auto!important}.w-full{width:100%!important}.flex-col{flex-direction:column!important}.flex-wrap{flex-wrap:wrap!important}*{box-sizing:border-box}:host{display:flex}:host([direction=horizontal]){align-items:flex-end;height:auto}:host([direction=vertical]){align-items:flex-start;flex-direction:column;flex-wrap:wrap;min-height:100%;width:100%}:host([direction=vertical][content-position=start]){align-items:flex-end}.static{position:static!important}";const n=class{constructor(e){t(this,e);this.activeStep=1;this.direction="horizontal";this.contentPosition="end";this._rerender=false}componentDidRender(){this._generateSteps()}render(){return e(i,{class:"p-stepper"},e("slot",null))}_generateSteps(){let t=this.activeStep-1||0;const e=this._el.querySelectorAll("p-stepper-item");if(!this.activeStep||t<0){for(let i=0;i<(e===null||e===void 0?void 0:e.length);i++){const s=e.item(i);if(s.active){t=i}if(t<0&&s.finished){t=i+1}}}for(let i=0;i<(e===null||e===void 0?void 0:e.length);i++){const s=e.item(i);s.active=i===t;s.finished=i<t;s.direction=this.direction;s.align=i===0?"start":i===(e===null||e===void 0?void 0:e.length)-1?"end":"center";s.contentPosition=this.contentPosition;if(i<e.length-1){const e=s.nextElementSibling;if(e&&e.tagName.toLowerCase()==="p-stepper-item"){const o=(s.clientHeight-16)/2;const n=document.createElement("p-stepper-line");n.direction=this.direction;n.active=i<=t;if(o>0&&this.direction==="vertical"){n.style.marginTop=`-${o/16}rem`;n.style.marginBottom=`-${o/16}rem`;n.style.minHeight=`calc(1rem + ${o*2/16}rem)`}this._el.insertBefore(n,e);continue}}if(i>0){const t=s.previousElementSibling;if(t.tagName.toLowerCase()==="p-stepper-line"){t.direction=this.direction;t.active=s.active||s.finished}}}const i=this._el.querySelectorAll("p-stepper-line");let s=false;for(let t=i.length-1;t>=0;t--){const e=i.item(t);const o=e.previousElementSibling;if(o.tagName.toLowerCase()==="p-stepper-line"){s=true;e.remove()}}if(s){this._rerender=!this._rerender}}get _el(){return s(this)}static get watchers(){return{activeStep:["_generateSteps"]}}};n.style=o;export{n as p_stepper};
|
|
2
|
-
//# sourceMappingURL=p-72a02f5f.entry.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["stepperComponentCss","Stepper","componentDidRender","this","_generateSteps","render","h","Host","class","activeStep","items","_el","querySelectorAll","i","length","item","active","finished","direction","align","contentPosition","nextItem","nextElementSibling","tagName","toLowerCase","heightDiff","clientHeight","stepperLine","document","createElement","style","marginTop","marginBottom","minHeight","insertBefore","previousItem","previousElementSibling","lines","didRemove","j","line","remove","_rerender"],"sources":["src/components/molecules/stepper/stepper.component.scss?tag=p-stepper&encapsulation=shadow","src/components/molecules/stepper/stepper.component.tsx"],"sourcesContent":[":host {\n\t@apply flex;\n}\n\n:host([direction='horizontal']) {\n\t@apply h-auto items-end;\n}\n\n:host([direction='vertical']) {\n\t@apply flex-col flex-wrap items-start;\n\t@apply w-full min-h-full;\n}\n\n:host([direction='vertical'][content-position='start']) {\n\t@apply items-end;\n}\n","import { Component, Element, h, Host, Prop, State, Watch } from '@stencil/core';\n\n@Component({\n\ttag: 'p-stepper',\n\tstyleUrl: 'stepper.component.scss',\n\tshadow: true,\n})\nexport class Stepper {\n\t/**\n\t * The currently active step\n\t */\n\t@Prop() activeStep: number = 1;\n\n\t/**\n\t * The direction of the stepper\n\t */\n\t@Prop({ reflect: true }) direction: 'horizontal' | 'vertical' =\n\t\t'horizontal';\n\n\t/**\n\t * The position of the content in case of vertical direction\n\t */\n\t@Prop({ reflect: true }) contentPosition: 'start' | 'end' = 'end';\n\n\t/**\n\t * The host element\n\t */\n\t@Element() private _el: HTMLElement;\n\n\t// private _steps: Array<HTMLPStepperItemElement>;\n\t@State() _rerender = false;\n\n\tcomponentDidRender() {\n\t\tthis._generateSteps();\n\t}\n\n\trender() {\n\t\treturn (\n\t\t\t<Host class=\"p-stepper\">\n\t\t\t\t<slot />\n\t\t\t</Host>\n\t\t);\n\t}\n\n\t@Watch('activeStep')\n\tprivate _generateSteps() {\n\t\tlet activeStep = this.activeStep - 1 || 0;\n\t\tconst items = this._el.querySelectorAll('p-stepper-item');\n\n\t\tif (!this.activeStep || activeStep < 0) {\n\t\t\tfor (let i = 0; i < items?.length; i++) {\n\t\t\t\tconst item = items.item(i) as any;\n\n\t\t\t\tif (item.active) {\n\t\t\t\t\tactiveStep = i;\n\t\t\t\t}\n\n\t\t\t\tif (activeStep < 0 && item.finished) {\n\t\t\t\t\tactiveStep = i + 1;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tfor (let i = 0; i < items?.length; i++) {\n\t\t\tconst item = items.item(i) as any;\n\n\t\t\titem.active = i === activeStep;\n\t\t\titem.finished = i < activeStep;\n\t\t\titem.direction = this.direction;\n\t\t\titem.align =\n\t\t\t\ti === 0 ? 'start' : i === items?.length - 1 ? 'end' : 'center';\n\t\t\titem.contentPosition = this.contentPosition;\n\n\t\t\tif (i < items.length - 1) {\n\t\t\t\tconst nextItem = item.nextElementSibling;\n\t\t\t\tif (\n\t\t\t\t\tnextItem &&\n\t\t\t\t\tnextItem.tagName.toLowerCase() === 'p-stepper-item'\n\t\t\t\t) {\n\t\t\t\t\tconst heightDiff = (item.clientHeight - 16) / 2;\n\n\t\t\t\t\tconst stepperLine =\n\t\t\t\t\t\tdocument.createElement('p-stepper-line');\n\n\t\t\t\t\tstepperLine.direction = this.direction;\n\t\t\t\t\tstepperLine.active = i <= activeStep;\n\n\t\t\t\t\tif (heightDiff > 0 && this.direction === 'vertical') {\n\t\t\t\t\t\tstepperLine.style.marginTop = `-${heightDiff / 16}rem`;\n\t\t\t\t\t\tstepperLine.style.marginBottom = `-${\n\t\t\t\t\t\t\theightDiff / 16\n\t\t\t\t\t\t}rem`;\n\t\t\t\t\t\tstepperLine.style.minHeight = `calc(1rem + ${\n\t\t\t\t\t\t\t(heightDiff * 2) / 16\n\t\t\t\t\t\t}rem)`;\n\t\t\t\t\t}\n\n\t\t\t\t\tthis._el.insertBefore(stepperLine, nextItem);\n\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (i > 0) {\n\t\t\t\tconst previousItem = item.previousElementSibling;\n\t\t\t\tif (previousItem.tagName.toLowerCase() === 'p-stepper-line') {\n\t\t\t\t\tpreviousItem.direction = this.direction;\n\t\t\t\t\tpreviousItem.active = item.active || item.finished;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// remove duplicate lines\n\t\tconst lines = this._el.querySelectorAll('p-stepper-line');\n\t\tlet didRemove = false;\n\t\tfor (let j = lines.length - 1; j >= 0; j--) {\n\t\t\tconst line = lines.item(j);\n\t\t\tconst previousItem = line.previousElementSibling;\n\t\t\tif (previousItem.tagName.toLowerCase() === 'p-stepper-line') {\n\t\t\t\tdidRemove = true;\n\t\t\t\tline.remove();\n\t\t\t}\n\t\t}\n\n\t\tif (didRemove) {\n\t\t\tthis._rerender = !this._rerender;\n\t\t}\n\t}\n}\n"],"mappings":"yDAAA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Ae,IAChCP,EAAa,QAEdE,EAAYG,MAAMG,UAAY,eAC5BR,EAAa,EAAK,Q,CAIrBtB,KAAKQ,IAAIuB,aAAaP,EAAaN,GAEnC,Q,EAIF,GAAIR,EAAI,EAAG,CACV,MAAMsB,EAAepB,EAAKqB,uBAC1B,GAAID,EAAaZ,QAAQC,gBAAkB,iBAAkB,CAC5DW,EAAajB,UAAYf,KAAKe,UAC9BiB,EAAanB,OAASD,EAAKC,QAAUD,EAAKE,Q,GAM7C,MAAMoB,EAAQlC,KAAKQ,IAAIC,iBAAiB,kBACxC,IAAI0B,EAAY,MAChB,IAAK,IAAIC,EAAIF,EAAMvB,OAAS,EAAGyB,GAAK,EAAGA,IAAK,CAC3C,MAAMC,EAAOH,EAAMtB,KAAKwB,GACxB,MAAMJ,EAAeK,EAAKJ,uBAC1B,GAAID,EAAaZ,QAAQC,gBAAkB,iBAAkB,CAC5Dc,EAAY,KACZE,EAAKC,Q,EAIP,GAAIH,EAAW,CACdnC,KAAKuC,WAAavC,KAAKuC,S"}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{r as t,h as e,H as i,g as s}from"./p-e4d5e7a7.js";const o=".flex{display:flex!important}.h-auto{height:auto!important}.w-full{width:100%!important}.flex-col{flex-direction:column!important}.flex-wrap{flex-wrap:wrap!important}*{box-sizing:border-box}:host{display:flex}:host([direction=horizontal]){align-items:flex-end;height:auto}:host([direction=vertical]){align-items:flex-start;flex-direction:column;flex-wrap:wrap;min-height:100%;width:100%}:host([direction=vertical][content-position=start]){align-items:flex-end}.static{position:static!important}";const n=class{constructor(e){t(this,e);this.activeStep=1;this.direction="horizontal";this.contentPosition="end";this._rerender=false}componentDidRender(){this._generateSteps()}render(){return e(i,{class:"p-stepper"},e("slot",null))}_generateSteps(){let t=this.activeStep-1||0;const e=this._el.querySelectorAll("p-stepper-item");if(!this.activeStep||t<0){for(let i=0;i<(e===null||e===void 0?void 0:e.length);i++){const s=e.item(i);if(s.active){t=i}if(t<0&&s.finished){t=i+1}}}for(let i=0;i<(e===null||e===void 0?void 0:e.length);i++){const s=e.item(i);s.active=i===t;s.finished=i<t;s.direction=this.direction;s.align=i===0?"start":i===(e===null||e===void 0?void 0:e.length)-1?"end":"center";s.contentPosition=this.contentPosition;if(i<e.length-1){const e=s.nextElementSibling;if(e&&e.tagName.toLowerCase()==="p-stepper-item"){const o=(s.clientHeight-16)/2;const n=document.createElement("p-stepper-line");n.direction=this.direction;n.active=i<=t;if(o>0&&this.direction==="vertical"){n.style.marginTop=`-${o/16}rem`;n.style.marginBottom=`-${o/16}rem`;n.style.minHeight=`calc(1rem + ${o*2/16}rem)`}this._el.insertBefore(n,e);continue}}if(i>0){const t=s.previousElementSibling;if(t.tagName.toLowerCase()==="p-stepper-line"){t.direction=this.direction;t.active=s.active||s.finished}}}const i=this._el.querySelectorAll("p-stepper-line");let s=false;for(let t=i.length-1;t>=0;t--){const e=i.item(t);const o=e.previousElementSibling;if(o.tagName.toLowerCase()==="p-stepper-line"){s=true;e.remove()}}if(s){this._rerender=!this._rerender}}get _el(){return s(this)}static get watchers(){return{activeStep:["_generateSteps"]}}};n.style=o;export{n as p_stepper};
|
|
2
|
-
//# sourceMappingURL=p-72a02f5f.entry.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["stepperComponentCss","Stepper","componentDidRender","this","_generateSteps","render","h","Host","class","activeStep","items","_el","querySelectorAll","i","length","item","active","finished","direction","align","contentPosition","nextItem","nextElementSibling","tagName","toLowerCase","heightDiff","clientHeight","stepperLine","document","createElement","style","marginTop","marginBottom","minHeight","insertBefore","previousItem","previousElementSibling","lines","didRemove","j","line","remove","_rerender"],"sources":["src/components/molecules/stepper/stepper.component.scss?tag=p-stepper&encapsulation=shadow","src/components/molecules/stepper/stepper.component.tsx"],"sourcesContent":[":host {\n\t@apply flex;\n}\n\n:host([direction='horizontal']) {\n\t@apply h-auto items-end;\n}\n\n:host([direction='vertical']) {\n\t@apply flex-col flex-wrap items-start;\n\t@apply w-full min-h-full;\n}\n\n:host([direction='vertical'][content-position='start']) {\n\t@apply items-end;\n}\n","import { Component, Element, h, Host, Prop, State, Watch } from '@stencil/core';\n\n@Component({\n\ttag: 'p-stepper',\n\tstyleUrl: 'stepper.component.scss',\n\tshadow: true,\n})\nexport class Stepper {\n\t/**\n\t * The currently active step\n\t */\n\t@Prop() activeStep: number = 1;\n\n\t/**\n\t * The direction of the stepper\n\t */\n\t@Prop({ reflect: true }) direction: 'horizontal' | 'vertical' =\n\t\t'horizontal';\n\n\t/**\n\t * The position of the content in case of vertical direction\n\t */\n\t@Prop({ reflect: true }) contentPosition: 'start' | 'end' = 'end';\n\n\t/**\n\t * The host element\n\t */\n\t@Element() private _el: HTMLElement;\n\n\t// private _steps: Array<HTMLPStepperItemElement>;\n\t@State() _rerender = false;\n\n\tcomponentDidRender() {\n\t\tthis._generateSteps();\n\t}\n\n\trender() {\n\t\treturn (\n\t\t\t<Host class=\"p-stepper\">\n\t\t\t\t<slot />\n\t\t\t</Host>\n\t\t);\n\t}\n\n\t@Watch('activeStep')\n\tprivate _generateSteps() {\n\t\tlet activeStep = this.activeStep - 1 || 0;\n\t\tconst items = this._el.querySelectorAll('p-stepper-item');\n\n\t\tif (!this.activeStep || activeStep < 0) {\n\t\t\tfor (let i = 0; i < items?.length; i++) {\n\t\t\t\tconst item = items.item(i) as any;\n\n\t\t\t\tif (item.active) {\n\t\t\t\t\tactiveStep = i;\n\t\t\t\t}\n\n\t\t\t\tif (activeStep < 0 && item.finished) {\n\t\t\t\t\tactiveStep = i + 1;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tfor (let i = 0; i < items?.length; i++) {\n\t\t\tconst item = items.item(i) as any;\n\n\t\t\titem.active = i === activeStep;\n\t\t\titem.finished = i < activeStep;\n\t\t\titem.direction = this.direction;\n\t\t\titem.align =\n\t\t\t\ti === 0 ? 'start' : i === items?.length - 1 ? 'end' : 'center';\n\t\t\titem.contentPosition = this.contentPosition;\n\n\t\t\tif (i < items.length - 1) {\n\t\t\t\tconst nextItem = item.nextElementSibling;\n\t\t\t\tif (\n\t\t\t\t\tnextItem &&\n\t\t\t\t\tnextItem.tagName.toLowerCase() === 'p-stepper-item'\n\t\t\t\t) {\n\t\t\t\t\tconst heightDiff = (item.clientHeight - 16) / 2;\n\n\t\t\t\t\tconst stepperLine =\n\t\t\t\t\t\tdocument.createElement('p-stepper-line');\n\n\t\t\t\t\tstepperLine.direction = this.direction;\n\t\t\t\t\tstepperLine.active = i <= activeStep;\n\n\t\t\t\t\tif (heightDiff > 0 && this.direction === 'vertical') {\n\t\t\t\t\t\tstepperLine.style.marginTop = `-${heightDiff / 16}rem`;\n\t\t\t\t\t\tstepperLine.style.marginBottom = `-${\n\t\t\t\t\t\t\theightDiff / 16\n\t\t\t\t\t\t}rem`;\n\t\t\t\t\t\tstepperLine.style.minHeight = `calc(1rem + ${\n\t\t\t\t\t\t\t(heightDiff * 2) / 16\n\t\t\t\t\t\t}rem)`;\n\t\t\t\t\t}\n\n\t\t\t\t\tthis._el.insertBefore(stepperLine, nextItem);\n\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (i > 0) {\n\t\t\t\tconst previousItem = item.previousElementSibling;\n\t\t\t\tif (previousItem.tagName.toLowerCase() === 'p-stepper-line') {\n\t\t\t\t\tpreviousItem.direction = this.direction;\n\t\t\t\t\tpreviousItem.active = item.active || item.finished;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// remove duplicate lines\n\t\tconst lines = this._el.querySelectorAll('p-stepper-line');\n\t\tlet didRemove = false;\n\t\tfor (let j = lines.length - 1; j >= 0; j--) {\n\t\t\tconst line = lines.item(j);\n\t\t\tconst previousItem = line.previousElementSibling;\n\t\t\tif (previousItem.tagName.toLowerCase() === 'p-stepper-line') {\n\t\t\t\tdidRemove = true;\n\t\t\t\tline.remove();\n\t\t\t}\n\t\t}\n\n\t\tif (didRemove) {\n\t\t\tthis._rerender = !this._rer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