@pontive/pontkit-core 1.18.0 → 1.19.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/catalog.json +1 -1
- package/custom-elements.json +1 -1
- package/dist/index.js +28 -7
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +30 -9
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1340,7 +1340,11 @@
|
|
|
1340
1340
|
`}};nh([a({type:String})],la.prototype,"variant",2);la=nh([p("pont-empty-media")],la);var lb=Object.getOwnPropertyDescriptor,db=(e,t,r,o)=>{for(var n=o>1?void 0:o?lb(t,r):t,i=e.length-1,s;i>=0;i--)(s=e[i])&&(n=s(n)||n);return n};let Nd=class extends f{createRenderRoot(){return this}get _titleSlot(){return this.querySelector('[data-slot="empty-title"]')}firstUpdated(){const e=this._titleSlot;if(!e)return;Array.from(this.childNodes).filter(r=>r!==e).forEach(r=>e.appendChild(r))}render(){return l`<div data-slot="empty-title"></div>`}};Nd=db([p("pont-empty-title")],Nd);var cb=Object.getOwnPropertyDescriptor,pb=(e,t,r,o)=>{for(var n=o>1?void 0:o?cb(t,r):t,i=e.length-1,s;i>=0;i--)(s=e[i])&&(n=s(n)||n);return n};let Md=class extends f{createRenderRoot(){return this}get _setSlot(){return this.querySelector('[data-slot="field-set"]')}firstUpdated(){const e=this._setSlot;if(!e)return;Array.from(this.childNodes).filter(r=>r!==e).forEach(r=>e.appendChild(r))}render(){return l`
|
|
1341
1341
|
<fieldset data-pont-field-set data-slot="field-set"></fieldset>
|
|
1342
1342
|
`}};Md=pb([p("pont-field-set")],Md);var hb=Object.defineProperty,ub=Object.getOwnPropertyDescriptor,oh=(e,t,r,o)=>{for(var n=o>1?void 0:o?ub(t,r):t,i=e.length-1,s;i>=0;i--)(s=e[i])&&(n=(o?s(t,r,n):s(n))||n);return o&&n&&hb(t,r,n),n};let da=class extends f{constructor(){super(...arguments),this.variant="legend"}createRenderRoot(){return this}get _legendSlot(){return this.querySelector('[data-slot="field-legend"]')}firstUpdated(){const e=this._legendSlot;if(!e)return;Array.from(this.childNodes).filter(r=>r!==e).forEach(r=>e.appendChild(r))}render(){return l`
|
|
1343
|
-
<legend
|
|
1343
|
+
<legend
|
|
1344
|
+
data-pont-field-legend
|
|
1345
|
+
data-slot="field-legend"
|
|
1346
|
+
data-variant=${this.variant}
|
|
1347
|
+
></legend>
|
|
1344
1348
|
`}};oh([a({type:String})],da.prototype,"variant",2);da=oh([p("pont-field-legend")],da);var mb=Object.defineProperty,gb=Object.getOwnPropertyDescriptor,ih=(e,t,r,o)=>{for(var n=o>1?void 0:o?gb(t,r):t,i=e.length-1,s;i>=0;i--)(s=e[i])&&(n=(o?s(t,r,n):s(n))||n);return o&&n&&mb(t,r,n),n};let ca=class extends f{constructor(){super(...arguments),this.type="field"}createRenderRoot(){return this}get _groupSlot(){return this.querySelector('[data-slot="field-group"]')}firstUpdated(){const e=this._groupSlot;if(!e)return;Array.from(this.childNodes).filter(r=>r!==e).forEach(r=>e.appendChild(r))}render(){return l`
|
|
1345
1349
|
<div
|
|
1346
1350
|
data-pont-field-group
|
|
@@ -1356,7 +1360,7 @@
|
|
|
1356
1360
|
data-invalid=${this.invalid?"true":h}
|
|
1357
1361
|
role="group"
|
|
1358
1362
|
></div>
|
|
1359
|
-
`}};Mi([a({type:String})],wo.prototype,"orientation",2);Mi([a({type:Boolean})],wo.prototype,"disabled",2);Mi([a({type:Boolean})],wo.prototype,"invalid",2);wo=Mi([p("pont-field")],wo);var bb=Object.getOwnPropertyDescriptor,yb=(e,t,r,o)=>{for(var n=o>1?void 0:o?bb(t,r):t,i=e.length-1,s;i>=0;i--)(s=e[i])&&(n=s(n)||n);return n};let Bd=class extends f{createRenderRoot(){return this}get _contentSlot(){return this.querySelector('[data-slot="field-content"]')}firstUpdated(){const e=this._contentSlot;if(!e)return;Array.from(this.childNodes).filter(r=>r!==e).forEach(r=>e.appendChild(r))}render(){return l`<div data-slot="field-content"></div>`}};Bd=yb([p("pont-field-content")],Bd);var _b=Object.defineProperty,wb=Object.getOwnPropertyDescriptor,sh=(e,t,r,o)=>{for(var n=o>1?void 0:o?wb(t,r):t,i=e.length-1,s;i>=0;i--)(s=e[i])&&(n=(o?s(t,r,n):s(n))||n);return o&&n&&_b(t,r,n),n};let pa=class extends f{get _rootSlot(){return this.querySelector('[data-slot="label"]')}firstUpdated(e){Array.from(this.childNodes).forEach(t=>{var r;t!==this._rootSlot&&((r=this._rootSlot)==null||r.appendChild(t))})}createRenderRoot(){return this}render(){return l`
|
|
1363
|
+
`}};Mi([a({type:String})],wo.prototype,"orientation",2);Mi([a({type:Boolean})],wo.prototype,"disabled",2);Mi([a({type:Boolean})],wo.prototype,"invalid",2);wo=Mi([p("pont-field")],wo);var bb=Object.getOwnPropertyDescriptor,yb=(e,t,r,o)=>{for(var n=o>1?void 0:o?bb(t,r):t,i=e.length-1,s;i>=0;i--)(s=e[i])&&(n=s(n)||n);return n};let Bd=class extends f{createRenderRoot(){return this}get _contentSlot(){return this.querySelector('[data-slot="field-content"]')}firstUpdated(){const e=this._contentSlot;if(!e)return;Array.from(this.childNodes).filter(r=>r!==e).forEach(r=>e.appendChild(r))}render(){return l`<div data-pont-field-content data-slot="field-content"></div>`}};Bd=yb([p("pont-field-content")],Bd);var _b=Object.defineProperty,wb=Object.getOwnPropertyDescriptor,sh=(e,t,r,o)=>{for(var n=o>1?void 0:o?wb(t,r):t,i=e.length-1,s;i>=0;i--)(s=e[i])&&(n=(o?s(t,r,n):s(n))||n);return o&&n&&_b(t,r,n),n};let pa=class extends f{get _rootSlot(){return this.querySelector('[data-slot="label"]')}firstUpdated(e){Array.from(this.childNodes).forEach(t=>{var r;t!==this._rootSlot&&((r=this._rootSlot)==null||r.appendChild(t))})}createRenderRoot(){return this}render(){return l`
|
|
1360
1364
|
<label
|
|
1361
1365
|
data-pont-label
|
|
1362
1366
|
data-slot="label"
|
|
@@ -1368,16 +1372,33 @@
|
|
|
1368
1372
|
data-slot="field-label"
|
|
1369
1373
|
data-for=${this.for??h}
|
|
1370
1374
|
></pont-label>
|
|
1371
|
-
`}};ah([a({type:String})],ha.prototype,"for",2);ha=ah([p("pont-field-label")],ha);var Cb=Object.getOwnPropertyDescriptor,Eb=(e,t,r,o)=>{for(var n=o>1?void 0:o?Cb(t,r):t,i=e.length-1,s;i>=0;i--)(s=e[i])&&(n=s(n)||n);return n};let Ud=class extends f{createRenderRoot(){return this}get _titleSlot(){return this.querySelector('[data-slot="field-label"]')}firstUpdated(){const e=this._titleSlot;if(!e)return;Array.from(this.childNodes).filter(r=>r!==e).forEach(r=>e.appendChild(r))}render(){return l`<div data-slot="field-label"></div>`}};Ud=Eb([p("pont-field-title")],Ud);var Sb=Object.getOwnPropertyDescriptor,xb=(e,t,r,o)=>{for(var n=o>1?void 0:o?Sb(t,r):t,i=e.length-1,s;i>=0;i--)(s=e[i])&&(n=s(n)||n);return n};let qd=class extends f{createRenderRoot(){return this}get _descriptionSlot(){return this.querySelector('[data-slot="field-description"]')}firstUpdated(){const e=this._descriptionSlot;if(!e)return;Array.from(this.childNodes).filter(r=>r!==e).forEach(r=>e.appendChild(r))}render(){return l
|
|
1372
|
-
<
|
|
1375
|
+
`}};ah([a({type:String})],ha.prototype,"for",2);ha=ah([p("pont-field-label")],ha);var Cb=Object.getOwnPropertyDescriptor,Eb=(e,t,r,o)=>{for(var n=o>1?void 0:o?Cb(t,r):t,i=e.length-1,s;i>=0;i--)(s=e[i])&&(n=s(n)||n);return n};let Ud=class extends f{createRenderRoot(){return this}get _titleSlot(){return this.querySelector('[data-slot="field-label"]')}firstUpdated(){const e=this._titleSlot;if(!e)return;Array.from(this.childNodes).filter(r=>r!==e).forEach(r=>e.appendChild(r))}render(){return l`<div data-pont-field-title data-slot="field-label"></div>`}};Ud=Eb([p("pont-field-title")],Ud);var Sb=Object.getOwnPropertyDescriptor,xb=(e,t,r,o)=>{for(var n=o>1?void 0:o?Sb(t,r):t,i=e.length-1,s;i>=0;i--)(s=e[i])&&(n=s(n)||n);return n};let qd=class extends f{createRenderRoot(){return this}get _descriptionSlot(){return this.querySelector('[data-slot="field-description"]')}firstUpdated(){const e=this._descriptionSlot;if(!e)return;Array.from(this.childNodes).filter(r=>r!==e).forEach(r=>e.appendChild(r))}render(){return l`
|
|
1376
|
+
<p data-pont-field-description data-slot="field-description"></p>
|
|
1377
|
+
`}};qd=xb([p("pont-field-description")],qd);var Ob=Object.getOwnPropertyDescriptor,Rb=(e,t,r,o)=>{for(var n=o>1?void 0:o?Ob(t,r):t,i=e.length-1,s;i>=0;i--)(s=e[i])&&(n=s(n)||n);return n};let jd=class extends f{constructor(){super(...arguments),this._observer=null}createRenderRoot(){return this}get _separatorSlot(){return this.querySelector('[data-slot="field-separator"]')}get _contentSlot(){return this.querySelector('[data-slot="field-separator-content"]')}_getExternalNodes(){const e=this._separatorSlot;return Array.from(this.childNodes).filter(t=>{var r;return!(t===e||t.nodeType===Node.COMMENT_NODE||t.nodeType===Node.TEXT_NODE&&!((r=t.textContent)!=null&&r.trim()))})}_processChildren(){const e=this._separatorSlot;if(!e)return;const t=this._getExternalNodes();if(t.length>0){let r=this._contentSlot;r||(r=document.createElement("span"),r.setAttribute("data-slot","field-separator-content"),e.appendChild(r)),t.forEach(o=>r.appendChild(o)),e.setAttribute("data-content","true")}else{const r=this._contentSlot;r&&e.removeChild(r),e.setAttribute("data-content","false")}}firstUpdated(){this._processChildren(),this._observer=new MutationObserver(()=>{this._observer.disconnect(),this._processChildren(),this._observer.observe(this,{childList:!0})}),this._observer.observe(this,{childList:!0})}disconnectedCallback(){var e;super.disconnectedCallback(),(e=this._observer)==null||e.disconnect(),this._observer=null}render(){return l`
|
|
1378
|
+
<div data-pont-field-separator data-slot="field-separator">
|
|
1373
1379
|
<pont-separator></pont-separator>
|
|
1374
|
-
<span
|
|
1380
|
+
<span
|
|
1381
|
+
data-pont-field-separator-content
|
|
1382
|
+
data-slot="field-separator-content"
|
|
1383
|
+
></span>
|
|
1375
1384
|
</div>
|
|
1376
1385
|
`}};jd=Rb([p("pont-field-separator")],jd);var Ib=Object.defineProperty,Ab=Object.getOwnPropertyDescriptor,lh=(e,t,r,o)=>{for(var n=o>1?void 0:o?Ab(t,r):t,i=e.length-1,s;i>=0;i--)(s=e[i])&&(n=(o?s(t,r,n):s(n))||n);return o&&n&&Ib(t,r,n),n};let ua=class extends f{constructor(){super(...arguments),this._hasUserContent=!1}createRenderRoot(){return this}connectedCallback(){super.connectedCallback(),this._hasUserContent=this.innerHTML.trim().length>0}_renderContent(){var t,r;if(!((t=this.errors)!=null&&t.length))return null;const e=[...new Map(this.errors.map(o=>[o==null?void 0:o.message,o])).values()];return e.length===1?(r=e[0])!=null&&r.message?e[0].message:null:l`
|
|
1377
|
-
<ul data-slot="field-error-content">
|
|
1386
|
+
<ul data-pont-field-error-content data-slot="field-error-content">
|
|
1378
1387
|
${e.map((o,n)=>o!=null&&o.message?l`<li key=${n}>${o.message}</li>`:h)}
|
|
1379
1388
|
</ul>
|
|
1380
|
-
`}render(){const e=this._hasUserContent,t=this._renderContent();if(e){const r=Array.from(this.childNodes);return l`
|
|
1389
|
+
`}render(){const e=this._hasUserContent,t=this._renderContent();if(e){const r=Array.from(this.childNodes);return l`
|
|
1390
|
+
<div
|
|
1391
|
+
data-pont-field-error
|
|
1392
|
+
data-slot="field-error"
|
|
1393
|
+
role="alert"
|
|
1394
|
+
>${r}</div>
|
|
1395
|
+
`}return t?l`
|
|
1396
|
+
<div
|
|
1397
|
+
data-pont-field-error
|
|
1398
|
+
data-slot="field-error"
|
|
1399
|
+
role="alert"
|
|
1400
|
+
>${t}</div>
|
|
1401
|
+
`:(this.style.display="none",h)}};lh([a({type:Array})],ua.prototype,"errors",2);ua=lh([p("pont-field-error")],ua);class dh{constructor(){this.values={},this.errors={},this.validators={},this.subscribers=new Set}registerField({name:t,defaultValue:r="",validator:o}){t in this.values||(this.values[t]=r),o&&(this.validators[t]=o)}unregisterField(t){delete this.values[t],delete this.errors[t],delete this.validators[t]}setValue(t,r){t in this.validators||console.warn(`[FormController] setValue called before validator was registered for "${t}"`),this.values[t]=r,this.validateField(t),this.notify()}getValue(t){return this.values[t]}getError(t){return this.errors[t]??null}validateField(t){const r=this.validators[t],o=this.values[t],n=r?r(o):null;return this.errors[t]=n,this.notify(),!n}validateAll(){let t=!0;return Object.keys(this.validators).forEach(r=>{this.validateField(r)||(t=!1)}),t}subscribe(t){return this.subscribers.add(t),()=>this.subscribers.delete(t)}notify(){this.subscribers.forEach(t=>t())}getValues(){return{...this.values}}getErrors(){return{...this.errors}}}const To="pont-form-context",us=new WeakMap,Tb=Xr(class extends Lp{render(e){return h}update(e,[t]){var o;const r=t!==this.G;return r&&this.rt(void 0),(r||this.lt!==this.ct)&&(this.G=t,this.ht=(o=e.options)==null?void 0:o.host,this.rt(this.ct=e.element)),h}rt(e){if(this.G!==void 0)if(this.isConnected||(e=void 0),typeof this.G=="function"){const t=this.ht??globalThis;let r=us.get(t);r===void 0&&(r=new WeakMap,us.set(t,r)),r.get(this.G)!==void 0&&this.G.call(this.ht,void 0),r.set(this.G,e),e!==void 0&&this.G.call(this.ht,e)}else this.G.value=e}get lt(){var e,t;return typeof this.G=="function"?(e=us.get(this.ht??globalThis))==null?void 0:e.get(this.G):(t=this.G)==null?void 0:t.value}disconnected(){this.lt===this.ct&&this.rt(void 0)}reconnected(){this.rt(this.ct)}});var Db=Object.defineProperty,Lb=Object.getOwnPropertyDescriptor,ch=(e,t,r,o)=>{for(var n=o>1?void 0:o?Lb(t,r):t,i=e.length-1,s;i>=0;i--)(s=e[i])&&(n=(o?s(t,r,n):s(n))||n);return o&&n&&Db(t,r,n),n};let ma=class extends y{constructor(){super(...arguments),this.form=new dh,this.handleSubmit=e=>{if(e.preventDefault(),this.form.validateAll()){const r=this.form.getValues();alert(JSON.stringify(r,null,2))}}}createRenderRoot(){return this}async firstUpdated(e){await this.updateComplete,Array.from(this.childNodes).forEach(t=>{t!==this.formElement&&this.formElement.appendChild(t)}),this.querySelectorAll("pont-form-field").forEach(t=>{const r=t.getAttribute("name"),o=t.validators,n=o==null?void 0:o[0];this.form.registerField({name:r,validator:n})})}render(){return l`
|
|
1381
1402
|
<form
|
|
1382
1403
|
part="form-controller"
|
|
1383
1404
|
class="${m("",this.className)}"
|