@teipublisher/pb-components 2.26.0-next-3.13 → 2.26.0-next-3.15

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 CHANGED
@@ -1,3 +1,23 @@
1
+ # [2.26.0-next-3.15](https://github.com/eeditiones/tei-publisher-components/compare/v2.26.0-next-3.14...v2.26.0-next-3.15) (2025-09-11)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * **pb-timeline:** remove paper-button; improve styling and tooltip positioning ([c95cb1e](https://github.com/eeditiones/tei-publisher-components/commit/c95cb1e3fe2a39793aebc512cb0487f1139e23be))
7
+
8
+ # [2.26.0-next-3.14](https://github.com/eeditiones/tei-publisher-components/compare/v2.26.0-next-3.13...v2.26.0-next-3.14) (2025-09-10)
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * **pb-facsimile:** component did not initialize if openseadragon was already loaded; this prevented multiple instances on the same page ([16c881b](https://github.com/eeditiones/tei-publisher-components/commit/16c881bdd0e1c7d9d441414d020778050f714f5e))
14
+ * **pb-view:** start listening to pb-refresh after component is ready; prevents race condition ([6196e03](https://github.com/eeditiones/tei-publisher-components/commit/6196e03e648fad9d37404f4d7d06a5bbcfe317a3))
15
+
16
+
17
+ ### Features
18
+
19
+ * **pb-grid:** drop polymer components ([8014c9c](https://github.com/eeditiones/tei-publisher-components/commit/8014c9cdd1bd79834e4fcd7c2f0d6d5d16349f2c))
20
+
1
21
  # [2.26.0-next-3.13](https://github.com/eeditiones/tei-publisher-components/compare/v2.26.0-next-3.12...v2.26.0-next-3.13) (2025-09-10)
2
22
 
3
23
 
@@ -5,6 +5,16 @@
5
5
  <meta name="viewport" content="width=device-width, minimum-scale=1, initial-scale=1, user-scalable=yes" />
6
6
 
7
7
  <title>pb-grid Demo</title>
8
+ <style>
9
+ svg {
10
+ width: 1rem;
11
+ height: 1rem;
12
+ }
13
+
14
+ pb-grid-action {
15
+ margin-bottom: 1rem;
16
+ }
17
+ </style>
8
18
  <script src="https://cdn.jsdelivr.net/npm/@webcomponents/webcomponentsjs/webcomponents-loader.js"></script><script type="module" src="../pb-components-bundle.js"></script>
9
19
  </head>
10
20
 
@@ -15,9 +25,7 @@
15
25
  <pb-document id="document1" path="test/orlik_to_serafin.xml" odd="serafin" view="single"></pb-document>
16
26
 
17
27
  <pb-grid-action action="add" class="grid-add" grid="#grid" initial="1">
18
- <paper-button>
19
- <iron-icon icon="icons:add"></iron-icon> Add Column
20
- </paper-button>
28
+ <button>Add Column</button>
21
29
  </pb-grid-action>
22
30
  <!-- Define the grid with one initial column -->
23
31
  <pb-grid id="grid" panels="[0,1]" subscribe="transcription" animation="true">
@@ -25,9 +33,14 @@
25
33
  <template>
26
34
  <pb-panel emit="transcription">
27
35
  <!-- Added to the toolbar -->
28
- <pb-grid-action grid="#grid" slot="toolbar" action="remove">
29
- <paper-icon-button icon="icons:close"></paper-icon-button>
30
- </pb-grid-action>
36
+ <li slot="toolbar">
37
+ <pb-grid-action grid="#grid" action="remove">
38
+ <svg xmlns="http://www.w3.org/2000/svg" class="ionicon" viewBox="0 0 512 512">
39
+ <path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="32"
40
+ d="M368 368L144 144M368 144L144 368" />
41
+ </svg>
42
+ </pb-grid-action>
43
+ </li>
31
44
  <template title="Transcription">
32
45
  <pb-view class="animated" src="document1"
33
46
  xpath="! (.//text[@xml:lang = 'la']/body | .//text/body)[1]" emit="transcription">
@@ -1,4 +1,4 @@
1
- import{d as e,P as t,h as i}from"./paper-checkbox-4f410b1f.js";import{g as s,N as n}from"./paper-listbox-c2468542.js";
1
+ import{s as e,a as t,I as i,b as s,d as o,P as a,h as n}from"./paper-checkbox-cbe53089.js";import{f as r,N as l}from"./paper-listbox-8ed8b3e3.js";
2
2
  /**
3
3
  @license
4
4
  Copyright (c) 2015 The Polymer Project Authors. All rights reserved.
@@ -8,7 +8,7 @@ http://polymer.github.io/AUTHORS.txt The complete set of contributors may be
8
8
  found at http://polymer.github.io/CONTRIBUTORS.txt Code distributed by Google as
9
9
  part of the polymer project is also subject to an additional IP rights grant
10
10
  found at http://polymer.github.io/PATENTS.txt
11
- */const o=document.createElement("template");o.setAttribute("style","display: none;"),o.innerHTML='<dom-module id="paper-dialog-shared-styles">\n <template>\n <style>\n :host {\n display: block;\n margin: 24px 40px;\n\n background: var(--paper-dialog-background-color, var(--primary-background-color));\n color: var(--paper-dialog-color, var(--primary-text-color));\n\n @apply --paper-font-body1;\n @apply --shadow-elevation-16dp;\n @apply --paper-dialog;\n }\n\n :host > ::slotted(*) {\n margin-top: 20px;\n padding: 0 24px;\n }\n\n :host > ::slotted(.no-padding) {\n padding: 0;\n }\n\n \n :host > ::slotted(*:first-child) {\n margin-top: 24px;\n }\n\n :host > ::slotted(*:last-child) {\n margin-bottom: 24px;\n }\n\n /* In 1.x, this selector was `:host > ::content h2`. In 2.x <slot> allows\n to select direct children only, which increases the weight of this\n selector, so we have to re-define first-child/last-child margins below. */\n :host > ::slotted(h2) {\n position: relative;\n margin: 0;\n\n @apply --paper-font-title;\n @apply --paper-dialog-title;\n }\n\n /* Apply mixin again, in case it sets margin-top. */\n :host > ::slotted(h2:first-child) {\n margin-top: 24px;\n @apply --paper-dialog-title;\n }\n\n /* Apply mixin again, in case it sets margin-bottom. */\n :host > ::slotted(h2:last-child) {\n margin-bottom: 24px;\n @apply --paper-dialog-title;\n }\n\n :host > ::slotted(.paper-dialog-buttons),\n :host > ::slotted(.buttons) {\n position: relative;\n padding: 8px 8px 8px 24px;\n margin: 0;\n\n color: var(--paper-dialog-button-color, var(--primary-color));\n\n @apply --layout-horizontal;\n @apply --layout-end-justified;\n }\n </style>\n </template>\n</dom-module>',document.head.appendChild(o.content);
11
+ */const h={properties:{elevation:{type:Number,reflectToAttribute:!0,readOnly:!0}},observers:["_calculateElevation(focused, disabled, active, pressed, receivedFocusFromKeyboard)","_computeKeyboardClass(receivedFocusFromKeyboard)"],hostAttributes:{role:"button",tabindex:"0",animated:!0},_calculateElevation:function(){var e=1;this.disabled?e=0:this.active||this.pressed?e=4:this.receivedFocusFromKeyboard&&(e=3),this._setElevation(e)},_computeKeyboardClass:function(e){this.toggleClass("keyboard-focus",e)},_spaceKeyDownHandler:function(t){e._spaceKeyDownHandler.call(this,t),this.hasRipple()&&this.getRipple().ripples.length<1&&this._ripple.uiDownAction()},_spaceKeyUpHandler:function(t){e._spaceKeyUpHandler.call(this,t),this.hasRipple()&&this._ripple.uiUpAction()}},d=[t,i,s,h],p=document.createElement("template");p.setAttribute("style","display: none;"),p.innerHTML='<dom-module id="paper-dialog-shared-styles">\n <template>\n <style>\n :host {\n display: block;\n margin: 24px 40px;\n\n background: var(--paper-dialog-background-color, var(--primary-background-color));\n color: var(--paper-dialog-color, var(--primary-text-color));\n\n @apply --paper-font-body1;\n @apply --shadow-elevation-16dp;\n @apply --paper-dialog;\n }\n\n :host > ::slotted(*) {\n margin-top: 20px;\n padding: 0 24px;\n }\n\n :host > ::slotted(.no-padding) {\n padding: 0;\n }\n\n \n :host > ::slotted(*:first-child) {\n margin-top: 24px;\n }\n\n :host > ::slotted(*:last-child) {\n margin-bottom: 24px;\n }\n\n /* In 1.x, this selector was `:host > ::content h2`. In 2.x <slot> allows\n to select direct children only, which increases the weight of this\n selector, so we have to re-define first-child/last-child margins below. */\n :host > ::slotted(h2) {\n position: relative;\n margin: 0;\n\n @apply --paper-font-title;\n @apply --paper-dialog-title;\n }\n\n /* Apply mixin again, in case it sets margin-top. */\n :host > ::slotted(h2:first-child) {\n margin-top: 24px;\n @apply --paper-dialog-title;\n }\n\n /* Apply mixin again, in case it sets margin-bottom. */\n :host > ::slotted(h2:last-child) {\n margin-bottom: 24px;\n @apply --paper-dialog-title;\n }\n\n :host > ::slotted(.paper-dialog-buttons),\n :host > ::slotted(.buttons) {\n position: relative;\n padding: 8px 8px 8px 24px;\n margin: 0;\n\n color: var(--paper-dialog-button-color, var(--primary-color));\n\n @apply --layout-horizontal;\n @apply --layout-end-justified;\n }\n </style>\n </template>\n</dom-module>',document.head.appendChild(p.content);
12
12
  /**
13
13
  @license
14
14
  Copyright (c) 2015 The Polymer Project Authors. All rights reserved.
@@ -19,7 +19,7 @@ found at http://polymer.github.io/CONTRIBUTORS.txt Code distributed by Google as
19
19
  part of the polymer project is also subject to an additional IP rights grant
20
20
  found at http://polymer.github.io/PATENTS.txt
21
21
  */
22
- const a={hostAttributes:{role:"dialog",tabindex:"-1"},properties:{modal:{type:Boolean,value:!1},__readied:{type:Boolean,value:!1}},observers:["_modalChanged(modal, __readied)"],listeners:{tap:"_onDialogClick"},ready:function(){this.__prevNoCancelOnOutsideClick=this.noCancelOnOutsideClick,this.__prevNoCancelOnEscKey=this.noCancelOnEscKey,this.__prevWithBackdrop=this.withBackdrop,this.__readied=!0},_modalChanged:function(e,t){t&&(e?(this.__prevNoCancelOnOutsideClick=this.noCancelOnOutsideClick,this.__prevNoCancelOnEscKey=this.noCancelOnEscKey,this.__prevWithBackdrop=this.withBackdrop,this.noCancelOnOutsideClick=!0,this.noCancelOnEscKey=!0,this.withBackdrop=!0):(this.noCancelOnOutsideClick=this.noCancelOnOutsideClick&&this.__prevNoCancelOnOutsideClick,this.noCancelOnEscKey=this.noCancelOnEscKey&&this.__prevNoCancelOnEscKey,this.withBackdrop=this.withBackdrop&&this.__prevWithBackdrop))},_updateClosingReasonConfirmed:function(e){this.closingReason=this.closingReason||{},this.closingReason.confirmed=e},_onDialogClick:function(t){for(var i=e(t).path,s=0,n=i.indexOf(this);s<n;s++){var o=i[s];if(o.hasAttribute&&(o.hasAttribute("dialog-dismiss")||o.hasAttribute("dialog-confirm"))){this._updateClosingReasonConfirmed(o.hasAttribute("dialog-confirm")),this.close(),t.stopPropagation();break}}}};
22
+ const c={hostAttributes:{role:"dialog",tabindex:"-1"},properties:{modal:{type:Boolean,value:!1},__readied:{type:Boolean,value:!1}},observers:["_modalChanged(modal, __readied)"],listeners:{tap:"_onDialogClick"},ready:function(){this.__prevNoCancelOnOutsideClick=this.noCancelOnOutsideClick,this.__prevNoCancelOnEscKey=this.noCancelOnEscKey,this.__prevWithBackdrop=this.withBackdrop,this.__readied=!0},_modalChanged:function(e,t){t&&(e?(this.__prevNoCancelOnOutsideClick=this.noCancelOnOutsideClick,this.__prevNoCancelOnEscKey=this.noCancelOnEscKey,this.__prevWithBackdrop=this.withBackdrop,this.noCancelOnOutsideClick=!0,this.noCancelOnEscKey=!0,this.withBackdrop=!0):(this.noCancelOnOutsideClick=this.noCancelOnOutsideClick&&this.__prevNoCancelOnOutsideClick,this.noCancelOnEscKey=this.noCancelOnEscKey&&this.__prevNoCancelOnEscKey,this.withBackdrop=this.withBackdrop&&this.__prevWithBackdrop))},_updateClosingReasonConfirmed:function(e){this.closingReason=this.closingReason||{},this.closingReason.confirmed=e},_onDialogClick:function(e){for(var t=o(e).path,i=0,s=t.indexOf(this);i<s;i++){var a=t[i];if(a.hasAttribute&&(a.hasAttribute("dialog-dismiss")||a.hasAttribute("dialog-confirm"))){this._updateClosingReasonConfirmed(a.hasAttribute("dialog-confirm")),this.close(),e.stopPropagation();break}}}};
23
23
  /**
24
24
  @license
25
25
  Copyright (c) 2015 The Polymer Project Authors. All rights reserved.
@@ -30,10 +30,10 @@ found at http://polymer.github.io/CONTRIBUTORS.txt Code distributed by Google as
30
30
  part of the polymer project is also subject to an additional IP rights grant
31
31
  found at http://polymer.github.io/PATENTS.txt
32
32
  */
33
- t({_template:i`
33
+ a({_template:n`
34
34
  <style include="paper-dialog-shared-styles"></style>
35
35
  <slot></slot>
36
- `,is:"paper-dialog",behaviors:[[s,a],n],listeners:{"neon-animation-finish":"_onNeonAnimationFinish"},_renderOpened:function(){this.cancelAnimation(),this.playAnimation("entry")},_renderClosed:function(){this.cancelAnimation(),this.playAnimation("exit")},_onNeonAnimationFinish:function(){this.opened?this._finishRenderOpened():this._finishRenderClosed()}}),
36
+ `,is:"paper-dialog",behaviors:[[r,c],l],listeners:{"neon-animation-finish":"_onNeonAnimationFinish"},_renderOpened:function(){this.cancelAnimation(),this.playAnimation("entry")},_renderClosed:function(){this.cancelAnimation(),this.playAnimation("exit")},_onNeonAnimationFinish:function(){this.opened?this._finishRenderOpened():this._finishRenderClosed()}}),
37
37
  /**
38
38
  @license
39
39
  Copyright (c) 2015 The Polymer Project Authors. All rights reserved.
@@ -44,7 +44,7 @@ found at http://polymer.github.io/CONTRIBUTORS.txt Code distributed by Google as
44
44
  part of the polymer project is also subject to an additional IP rights grant
45
45
  found at http://polymer.github.io/PATENTS.txt
46
46
  */
47
- t({_template:i`
47
+ a({_template:n`
48
48
  <style>
49
49
 
50
50
  :host {
@@ -87,7 +87,7 @@ t({_template:i`
87
87
  <div id="scrollable" class="scrollable" on-scroll="updateScrollState">
88
88
  <slot></slot>
89
89
  </div>
90
- `,is:"paper-dialog-scrollable",properties:{dialogElement:{type:Object}},get scrollTarget(){return this.$.scrollable},ready:function(){this._ensureTarget(),this.classList.add("no-padding")},attached:function(){this._ensureTarget(),requestAnimationFrame(this.updateScrollState.bind(this))},updateScrollState:function(){this.toggleClass("is-scrolled",this.scrollTarget.scrollTop>0),this.toggleClass("can-scroll",this.scrollTarget.offsetHeight<this.scrollTarget.scrollHeight),this.toggleClass("scrolled-to-bottom",this.scrollTarget.scrollTop+this.scrollTarget.offsetHeight>=this.scrollTarget.scrollHeight)},_ensureTarget:function(){this.dialogElement=this.dialogElement||this.parentElement,this.dialogElement&&this.dialogElement.behaviors&&this.dialogElement.behaviors.indexOf(a)>=0?(this.dialogElement.sizingTarget=this.scrollTarget,this.scrollTarget.classList.remove("fit")):this.dialogElement&&this.scrollTarget.classList.add("fit")}}),
90
+ `,is:"paper-dialog-scrollable",properties:{dialogElement:{type:Object}},get scrollTarget(){return this.$.scrollable},ready:function(){this._ensureTarget(),this.classList.add("no-padding")},attached:function(){this._ensureTarget(),requestAnimationFrame(this.updateScrollState.bind(this))},updateScrollState:function(){this.toggleClass("is-scrolled",this.scrollTarget.scrollTop>0),this.toggleClass("can-scroll",this.scrollTarget.offsetHeight<this.scrollTarget.scrollHeight),this.toggleClass("scrolled-to-bottom",this.scrollTarget.scrollTop+this.scrollTarget.offsetHeight>=this.scrollTarget.scrollHeight)},_ensureTarget:function(){this.dialogElement=this.dialogElement||this.parentElement,this.dialogElement&&this.dialogElement.behaviors&&this.dialogElement.behaviors.indexOf(c)>=0?(this.dialogElement.sizingTarget=this.scrollTarget,this.scrollTarget.classList.remove("fit")):this.dialogElement&&this.scrollTarget.classList.add("fit")}});
91
91
  /**
92
92
  @license
93
93
  Copyright (c) 2015 The Polymer Project Authors. All rights reserved.
@@ -98,7 +98,104 @@ found at http://polymer.github.io/CONTRIBUTORS.txt Code distributed by Google as
98
98
  part of the polymer project is also subject to an additional IP rights grant
99
99
  found at http://polymer.github.io/PATENTS.txt
100
100
  */
101
- t({_template:i`
101
+ const u=n`
102
+ <style include="paper-material-styles">
103
+ /* Need to specify the same specificity as the styles imported from paper-material. */
104
+ :host {
105
+ @apply --layout-inline;
106
+ @apply --layout-center-center;
107
+ position: relative;
108
+ box-sizing: border-box;
109
+ min-width: 5.14em;
110
+ margin: 0 0.29em;
111
+ background: transparent;
112
+ -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
113
+ -webkit-tap-highlight-color: transparent;
114
+ font: inherit;
115
+ text-transform: uppercase;
116
+ outline-width: 0;
117
+ border-radius: 3px;
118
+ -moz-user-select: none;
119
+ -ms-user-select: none;
120
+ -webkit-user-select: none;
121
+ user-select: none;
122
+ cursor: pointer;
123
+ z-index: 0;
124
+ padding: 0.7em 0.57em;
125
+
126
+ @apply --paper-font-common-base;
127
+ @apply --paper-button;
128
+ }
129
+
130
+ :host([elevation="1"]) {
131
+ @apply --paper-material-elevation-1;
132
+ }
133
+
134
+ :host([elevation="2"]) {
135
+ @apply --paper-material-elevation-2;
136
+ }
137
+
138
+ :host([elevation="3"]) {
139
+ @apply --paper-material-elevation-3;
140
+ }
141
+
142
+ :host([elevation="4"]) {
143
+ @apply --paper-material-elevation-4;
144
+ }
145
+
146
+ :host([elevation="5"]) {
147
+ @apply --paper-material-elevation-5;
148
+ }
149
+
150
+ :host([hidden]) {
151
+ display: none !important;
152
+ }
153
+
154
+ :host([raised].keyboard-focus) {
155
+ font-weight: bold;
156
+ @apply --paper-button-raised-keyboard-focus;
157
+ }
158
+
159
+ :host(:not([raised]).keyboard-focus) {
160
+ font-weight: bold;
161
+ @apply --paper-button-flat-keyboard-focus;
162
+ }
163
+
164
+ :host([disabled]) {
165
+ background: none;
166
+ color: #a8a8a8;
167
+ cursor: auto;
168
+ pointer-events: none;
169
+
170
+ @apply --paper-button-disabled;
171
+ }
172
+
173
+ :host([disabled][raised]) {
174
+ background: #eaeaea;
175
+ }
176
+
177
+
178
+ :host([animated]) {
179
+ @apply --shadow-transition;
180
+ }
181
+
182
+ paper-ripple {
183
+ color: var(--paper-button-ink-color);
184
+ }
185
+ </style>
186
+
187
+ <slot></slot>`;u.setAttribute("strip-whitespace",""),a({_template:u,is:"paper-button",behaviors:[d],properties:{raised:{type:Boolean,reflectToAttribute:!0,value:!1,observer:"_calculateElevation"}},_calculateElevation:function(){this.raised?h._calculateElevation.apply(this):this._setElevation(0)}}),
188
+ /**
189
+ @license
190
+ Copyright (c) 2015 The Polymer Project Authors. All rights reserved.
191
+ This code may only be used under the BSD style license found at
192
+ http://polymer.github.io/LICENSE.txt The complete set of authors may be found at
193
+ http://polymer.github.io/AUTHORS.txt The complete set of contributors may be
194
+ found at http://polymer.github.io/CONTRIBUTORS.txt Code distributed by Google as
195
+ part of the polymer project is also subject to an additional IP rights grant
196
+ found at http://polymer.github.io/PATENTS.txt
197
+ */
198
+ a({_template:n`
102
199
  <style>
103
200
  :host {
104
201
  display: block;
@@ -110,4 +207,4 @@ t({_template:i`
110
207
 
111
208
  <!-- This form is used for submission -->
112
209
  <form id="helper" action\$="[[action]]" method\$="[[method]]" enctype\$="[[enctype]]"></form>
113
- `,is:"iron-form",properties:{allowRedirect:{type:Boolean,value:!1},headers:{type:Object,value:function(){return{}}},withCredentials:{type:Boolean,value:!1}},attached:function(){this._form||(this._form=e(this).querySelector("form"),this._form?(this._init(),this.async(this._saveInitialValues.bind(this),1)):this._nodeObserver=e(this).observeNodes(function(t){for(var i=0;i<t.addedNodes.length;i++)"FORM"===t.addedNodes[i].tagName&&(this._form=t.addedNodes[i],this._init(),e(this).unobserveNodes(this._nodeObserver),this._nodeObserver=null)}.bind(this)))},detached:function(){this._nodeObserver&&(e(this).unobserveNodes(this._nodeObserver),this._nodeObserver=null)},_init:function(){this._form.addEventListener("submit",this.submit.bind(this)),this._form.addEventListener("reset",this.reset.bind(this)),this._defaults=this._defaults||new WeakMap,this._saveInitialValues()},saveResetValues:function(){this._saveInitialValues(!0)},_saveInitialValues:function(e){for(var t=this._getValidatableElements(),i=0;i<t.length;i++){var s=t[i];if(!this._defaults.has(s)||e){var n={value:s.value};"checked"in s&&(n.checked=s.checked),"invalid"in s&&(n.invalid=s.invalid),this._defaults.set(s,n)}}},validate:function(){if(!this._form)return!1;if(""===this._form.getAttribute("novalidate"))return!0;for(var e,t=this._form.checkValidity(),i=this._getValidatableElements(),s=0;e=i[s],s<i.length;s++){var n=e;n.validate&&(t=!!n.validate()&&t)}return t},submit:function(e){if(e&&e.preventDefault(),this._form)if(this.validate()){this.$.helper.textContent="";var t=this.serializeForm();if(this.allowRedirect){for(var i in t)this.$.helper.appendChild(this._createHiddenElement(i,t[i]));this.$.helper.action=this._form.getAttribute("action"),this.$.helper.method=this._form.getAttribute("method")||"GET",this.$.helper.contentType=this._form.getAttribute("enctype")||"application/x-www-form-urlencoded",this.$.helper.submit(),this.fire("iron-form-submit")}else this._makeAjaxRequest(t)}else this.fire("iron-form-invalid")},reset:function(e){if(e&&e.preventDefault(),this._form)if(e&&"reset"===e.type&&e.target===this._form){for(var t=this._getValidatableElements(),i=0;i<t.length;i++){var s=t[i];if(this._defaults.has(s)){var n=this._defaults.get(s);for(var o in n)s[o]=n[o]}}this.fire("iron-form-reset")}else this._form.reset()},serializeForm:function(){for(var e=this._getSubmittableElements(),t={},i=0;i<e.length;i++)for(var s=this._serializeElementValues(e[i]),n=0;n<s.length;n++)this._addSerializedElement(t,e[i].name,s[n]);return t},_handleFormResponse:function(e){this.fire("iron-form-response",e.detail)},_handleFormError:function(e){this.fire("iron-form-error",e.detail)},_makeAjaxRequest:function(e){this.request||(this.request=document.createElement("iron-ajax"),this.request.addEventListener("response",this._handleFormResponse.bind(this)),this.request.addEventListener("error",this._handleFormError.bind(this))),this.request.url=this._form.getAttribute("action"),this.request.method=this._form.getAttribute("method")||"GET",this.request.contentType=this._form.getAttribute("enctype")||"application/x-www-form-urlencoded",this.request.withCredentials=this.withCredentials,this.request.headers=this.headers,"POST"===this._form.method.toUpperCase()?this.request.body=e:this.request.params=e,this.fire("iron-form-presubmit",{},{cancelable:!0}).defaultPrevented||(this.request.generateRequest(),this.fire("iron-form-submit",e))},_getValidatableElements:function(){return this._findElements(this._form,!0,!1)},_getSubmittableElements:function(){return this._findElements(this._form,!1,!1)},_findElements:function(t,i,s,n){n=n||[];for(var o=e(t).querySelectorAll("*"),a=0;a<o.length;a++)s||"slot"!==o[a].localName&&"content"!==o[a].localName?this._searchSubmittable(n,o[a],i):this._searchSubmittableInSlot(n,o[a],i);return n},_searchSubmittableInSlot:function(t,i,s){for(var n=e(i).getDistributedNodes(),o=0;o<n.length;o++)if(n[o].nodeType!==Node.TEXT_NODE){this._searchSubmittable(t,n[o],s);for(var a=e(n[o]).querySelectorAll("*"),r=0;r<a.length;r++)this._searchSubmittable(t,a[r],s)}},_searchSubmittable:function(e,t,i){this._isSubmittable(t,i)?e.push(t):t.root&&this._findElements(t.root,i,!0,e)},_isSubmittable:function(e,t){return!e.disabled&&(t?e.name||"function"==typeof e.validate:e.name)},_serializeElementValues:function(e){var t=e.tagName.toLowerCase();return"button"===t||"input"===t&&("submit"===e.type||"reset"===e.type)?[]:"select"===t?this._serializeSelectValues(e):"input"===t?this._serializeInputValues(e):e._hasIronCheckedElementBehavior&&!e.checked?[]:[e.value]},_serializeSelectValues:function(e){for(var t=[],i=0;i<e.options.length;i++)e.options[i].selected&&t.push(e.options[i].value);return t},_serializeInputValues:function(e){var t=e.type.toLowerCase();return("checkbox"!==t&&"radio"!==t||e.checked)&&"file"!==t?[e.value]:[]},_createHiddenElement:function(e,t){var i=document.createElement("input");return i.setAttribute("type","hidden"),i.setAttribute("name",e),i.setAttribute("value",t),i},_addSerializedElement:function(e,t,i){void 0===e[t]?e[t]=i:(Array.isArray(e[t])||(e[t]=[e[t]]),e[t].push(i))}});
210
+ `,is:"iron-form",properties:{allowRedirect:{type:Boolean,value:!1},headers:{type:Object,value:function(){return{}}},withCredentials:{type:Boolean,value:!1}},attached:function(){this._form||(this._form=o(this).querySelector("form"),this._form?(this._init(),this.async(this._saveInitialValues.bind(this),1)):this._nodeObserver=o(this).observeNodes(function(e){for(var t=0;t<e.addedNodes.length;t++)"FORM"===e.addedNodes[t].tagName&&(this._form=e.addedNodes[t],this._init(),o(this).unobserveNodes(this._nodeObserver),this._nodeObserver=null)}.bind(this)))},detached:function(){this._nodeObserver&&(o(this).unobserveNodes(this._nodeObserver),this._nodeObserver=null)},_init:function(){this._form.addEventListener("submit",this.submit.bind(this)),this._form.addEventListener("reset",this.reset.bind(this)),this._defaults=this._defaults||new WeakMap,this._saveInitialValues()},saveResetValues:function(){this._saveInitialValues(!0)},_saveInitialValues:function(e){for(var t=this._getValidatableElements(),i=0;i<t.length;i++){var s=t[i];if(!this._defaults.has(s)||e){var o={value:s.value};"checked"in s&&(o.checked=s.checked),"invalid"in s&&(o.invalid=s.invalid),this._defaults.set(s,o)}}},validate:function(){if(!this._form)return!1;if(""===this._form.getAttribute("novalidate"))return!0;for(var e,t=this._form.checkValidity(),i=this._getValidatableElements(),s=0;e=i[s],s<i.length;s++){var o=e;o.validate&&(t=!!o.validate()&&t)}return t},submit:function(e){if(e&&e.preventDefault(),this._form)if(this.validate()){this.$.helper.textContent="";var t=this.serializeForm();if(this.allowRedirect){for(var i in t)this.$.helper.appendChild(this._createHiddenElement(i,t[i]));this.$.helper.action=this._form.getAttribute("action"),this.$.helper.method=this._form.getAttribute("method")||"GET",this.$.helper.contentType=this._form.getAttribute("enctype")||"application/x-www-form-urlencoded",this.$.helper.submit(),this.fire("iron-form-submit")}else this._makeAjaxRequest(t)}else this.fire("iron-form-invalid")},reset:function(e){if(e&&e.preventDefault(),this._form)if(e&&"reset"===e.type&&e.target===this._form){for(var t=this._getValidatableElements(),i=0;i<t.length;i++){var s=t[i];if(this._defaults.has(s)){var o=this._defaults.get(s);for(var a in o)s[a]=o[a]}}this.fire("iron-form-reset")}else this._form.reset()},serializeForm:function(){for(var e=this._getSubmittableElements(),t={},i=0;i<e.length;i++)for(var s=this._serializeElementValues(e[i]),o=0;o<s.length;o++)this._addSerializedElement(t,e[i].name,s[o]);return t},_handleFormResponse:function(e){this.fire("iron-form-response",e.detail)},_handleFormError:function(e){this.fire("iron-form-error",e.detail)},_makeAjaxRequest:function(e){this.request||(this.request=document.createElement("iron-ajax"),this.request.addEventListener("response",this._handleFormResponse.bind(this)),this.request.addEventListener("error",this._handleFormError.bind(this))),this.request.url=this._form.getAttribute("action"),this.request.method=this._form.getAttribute("method")||"GET",this.request.contentType=this._form.getAttribute("enctype")||"application/x-www-form-urlencoded",this.request.withCredentials=this.withCredentials,this.request.headers=this.headers,"POST"===this._form.method.toUpperCase()?this.request.body=e:this.request.params=e,this.fire("iron-form-presubmit",{},{cancelable:!0}).defaultPrevented||(this.request.generateRequest(),this.fire("iron-form-submit",e))},_getValidatableElements:function(){return this._findElements(this._form,!0,!1)},_getSubmittableElements:function(){return this._findElements(this._form,!1,!1)},_findElements:function(e,t,i,s){s=s||[];for(var a=o(e).querySelectorAll("*"),n=0;n<a.length;n++)i||"slot"!==a[n].localName&&"content"!==a[n].localName?this._searchSubmittable(s,a[n],t):this._searchSubmittableInSlot(s,a[n],t);return s},_searchSubmittableInSlot:function(e,t,i){for(var s=o(t).getDistributedNodes(),a=0;a<s.length;a++)if(s[a].nodeType!==Node.TEXT_NODE){this._searchSubmittable(e,s[a],i);for(var n=o(s[a]).querySelectorAll("*"),r=0;r<n.length;r++)this._searchSubmittable(e,n[r],i)}},_searchSubmittable:function(e,t,i){this._isSubmittable(t,i)?e.push(t):t.root&&this._findElements(t.root,i,!0,e)},_isSubmittable:function(e,t){return!e.disabled&&(t?e.name||"function"==typeof e.validate:e.name)},_serializeElementValues:function(e){var t=e.tagName.toLowerCase();return"button"===t||"input"===t&&("submit"===e.type||"reset"===e.type)?[]:"select"===t?this._serializeSelectValues(e):"input"===t?this._serializeInputValues(e):e._hasIronCheckedElementBehavior&&!e.checked?[]:[e.value]},_serializeSelectValues:function(e){for(var t=[],i=0;i<e.options.length;i++)e.options[i].selected&&t.push(e.options[i].value);return t},_serializeInputValues:function(e){var t=e.type.toLowerCase();return("checkbox"!==t&&"radio"!==t||e.checked)&&"file"!==t?[e.value]:[]},_createHiddenElement:function(e,t){var i=document.createElement("input");return i.setAttribute("type","hidden"),i.setAttribute("name",e),i.setAttribute("value",t),i},_addSerializedElement:function(e,t,i){void 0===e[t]?e[t]=i:(Array.isArray(e[t])||(e[t]=[e[t]]),e[t].push(i))}});export{d as P};