@golemui/core 0.12.2 → 0.13.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/CHANGELOG.md +4 -0
- package/index.d.ts +1 -1
- package/index.js +535 -541
- package/index.umd.cjs +8 -8
- package/internals.d.ts +2 -0
- package/internals.js +1 -0
- package/internals.umd.cjs +1 -0
- package/lib/context/widget-registry.d.ts +3 -0
- package/lib/context/with-widget.type.d.ts +3 -0
- package/lib/form-widget.d.ts +2 -2
- package/lib/form.d.ts +1 -2
- package/lib/store/model.d.ts +7 -7
- package/lib/store/reducers/initialize.d.ts +2 -2
- package/lib/store/reducers/override-widget-prop.d.ts +2 -2
- package/lib/store/reducers/set-data.d.ts +2 -2
- package/lib/store/reducers/set-form-health.d.ts +2 -2
- package/lib/store/reducers/set-language.d.ts +2 -2
- package/lib/store/reducers/set-meta.d.ts +2 -2
- package/lib/store/reducers/set-widget-data.d.ts +2 -2
- package/lib/utils/decoder.d.ts +3 -3
- package/lib/utils/form.d.ts +2 -2
- package/package.json +9 -1
package/index.umd.cjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
`),n=r.pop(),
|
|
3
|
-
${
|
|
4
|
-
`,""+
|
|
5
|
-
`,r:"\r",t:" ",b:"\b",f:"\f",v:"\v"},
|
|
6
|
-
`,"/*":"*/"};let
|
|
7
|
-
`)for(;
|
|
8
|
-
`,r:"\r",t:" ",b:"\b",f:"\f",v:"\v"},Mt=()=>{const e=[];for(let t="",r;(r=m.charCodeAt(h))!==De;)r?r===yn?(w(),t+=$n[m[h]]||m[h],w()):r===gn&&m.charCodeAt(h+1)===mn?(t&&e.push([,t]),t="",w(2),e.push(v(0,125))):(t+=m[h],w(),r=m.charCodeAt(h),r===De&&t&&e.push([,t])):z("Unterminated template");return w(),e},An=_[De];_[De]=(e,t)=>e&&t<pn?$.asi&&$.newline?void 0:(w(),["``",e,...Mt()]):e?An?.(e,t):(w(),(r=>r.length<2&&r[0]?.[0]===void 0?r[0]||[,""]:["`",...r])(Mt())),l("`",(...e)=>(e=e.map(d),t=>e.map(r=>r(t)).join(""))),l("``",(e,...t)=>{e=d(e);const r=[],n=[];for(const o of t)Array.isArray(o)&&o[0]===void 0?r.push(o[1]):n.push(d(o));const i=Object.assign([...r],{raw:r});return o=>e(o)(i,...n.map(s=>s(o)))}),$.string["'"]=!0,$.number={"0x":16,"0b":2,"0o":8};const Vt={log:(e,t)=>(t?console.log(t,e):console.log(e),e)};function N(e,t,r,n,i){const o=$(Sn(e));return d(o)({$form:t,$meta:r,$errors:n,$formIsInvalid:i,$log:Vt.log})===!0}function Sn(e){return e.replace(/\?\.(\d+)/g,"?.[$1]").replace(/\.(\d+)/g,"[$1]")}const G=e=>{let t=e.formDef.states;if(!t||Object.keys(t).length===0||e.formHealth.status==="errored")return e;const{$formIsInvalid:r,$errors:n}=Be(e);t=En(t);let i=[],o={status:"ok"};try{i=Object.keys(t).map(s=>{const u=t[s];let c;try{c=N(u,e.data,e.meta,n,r)}catch{c=!1}return c===!0?s:void 0}).filter(s=>s!==void 0)}catch(s){const u=s,c=ne.calculateCurrentStateError;o={status:"errored",message:`[${c}] ${u.message}`,code:c}}return{...e,currentStates:i,formHealth:o}};function En(e){const t={};function r(n){const i=n.split(":"),o=[];for(let s=0;s<i.length;s++)o.push(i.slice(0,s+1).join(":"));return o}for(const[n,i]of Object.entries(e)){const o=r(n),s=[];for(const u of o)e[u]&&s.push(`(${e[u]})`);t[n]=s.join(" && ")}return t}const Pe=Symbol("filterMap.skip");function nt(e,t){const r=[];for(let n=0;n<e.length;n++){const i=t(e[n],n,e);i!==Pe&&r.push(i)}return r}function vn(e,t,r){for(let n=0;n<e.length;n++)t(e[n],n,e)&&r(e[n],n,e)}function Bt(e,t,r,n){let i=n;for(let o=0;o<e.length;o++)t(e[o],o,e)&&(i=r(i,e[o],o,e));return i}function Ht(e,t,r){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(!r(e[n],t[n],n,e,t))return!1;return!0}function Gt(e,t){const r=it(e.uid,t);return F(e)?{...e,uid:r,path:In(e.path,t)}:{...e,uid:r}}function it(e,t){if(t.length===0)throw new Error("Repeater indexes cannot be an empty array");const r=t.reduce((n,i)=>`${n}[${i}]`,"");return`${e}${r}`}function In(e,t){if(t.length===0)throw new Error("Repeater indexes cannot be an empty array");const r="items",n=e.split(`.${r}`),i=n.length-1;if(i!==t.length)throw new Error(`Path contains ${i} '${r}' occurrences, but ${t.length} indexes were provided.`);return n.reduce((o,s,u)=>u===0?s:`${o}.${t[u-1]}${s}`)}function ce(e,t){let r=0;return e.replace(/\.items(\??)\./g,(n,i)=>{const o=t[r++];return o===void 0?n:`.${o}${i}.`})}const We=(e,t)=>r=>e(r)?t(r):r,J=e=>e!==void 0&&typeof e=="object"&&e!==null&&"when"in e,K=e=>{const{$formIsInvalid:t,$errors:r}=Be(e);return{...e,widgetFlags:{...Cn(e,r,t),...On(e,r,t)}}};function Cn(e,t,r){return nt(Object.values(e.flatForm),n=>{if(n.uid?.includes("["))return Pe;if(b(n)){const i=n({$form:e.data,errors:void 0,touched:void 0,translate:void 0});return i.uid=n.uid,i}return n}).filter(n=>!!(n.include&&("in"in n.include||"when"in n.include)||n.exclude&&("from"in n.exclude||"when"in n.exclude)||(F(n)||j(n))&&J(n.disabled)||F(n)&&J(n.readonly))).reduce((n,i)=>(n[i.uid]=n[i.uid]||{},i.include&&"in"in i.include?n[i.uid].hidden=!i.include.in.some(o=>e.currentStates.includes(o)):i.include&&"when"in i.include&&(n[i.uid].hidden=!N(i.include.when,e.data,e.meta,t,r)),i.exclude&&"from"in i.exclude?n[i.uid].hidden=i.exclude.from.some(o=>e.currentStates.includes(o)):i.exclude&&"when"in i.exclude&&(n[i.uid].hidden=N(i.exclude.when,e.data,e.meta,t,r)),(F(i)||j(i))&&J(i.disabled)&&(n[i.uid].disabled=N(i.disabled.when,e.data,e.meta,t,r)),F(i)&&J(i.readonly)&&(n[i.uid].readonly=N(i.readonly.when,e.data,e.meta,t,r)),n),{})}function On(e,t,r){return Bt(Object.values(e.flatForm),n=>!b(n)&&n.type==="repeater",(n,i)=>({...n,...Kt(e,i,[],t,r)}),{})}function Kt(e,t,r,n,i){const o=t.props.template,s=k(e.data,t.path);if(!Array.isArray(s))return{};const u={};return s.forEach((c,g)=>{const E=[...r,g];Ve([o]).forEach(y=>{let p;if(b(y)?(p=y({$form:e.data,errors:void 0,touched:void 0,translate:void 0}),p.uid=y.uid):p=y,p.type==="repeater"){const le=Gt(p,E);Object.assign(u,Kt(e,le,E,n,i));return}const P=it(p.uid,E);u[P]=u[P]||{},p.include&&"in"in p.include?u[P].hidden=!p.include.in.some(le=>e.currentStates.includes(le)):p.include&&"when"in p.include&&(u[P].hidden=!N(ce(p.include.when,E),e.data,e.meta,n,i)),p.exclude&&"from"in p.exclude?u[P].hidden=p.exclude.from.some(le=>e.currentStates.includes(le)):p.exclude&&"when"in p.exclude&&(u[P].hidden=N(ce(p.exclude.when,E),e.data,e.meta,n,i)),(F(p)||j(p))&&J(p.disabled)&&(u[P].disabled=N(ce(p.disabled.when,E),e.data,e.meta,n,i)),F(p)&&J(p.readonly)&&(u[P].readonly=N(ce(p.readonly.when,E),e.data,e.meta,n,i))})}),u}const Xt=e=>!(typeof e!="object"||e===null||typeof e.key!="string");function wn(e){const t=new Intl.Locale(e).maximize().script;return["Arab","Hebr","Thaa","Syrc","Tfng","Adlm","Rohg"].includes(t||"")?"rtl":"ltr"}const zt=(e=navigator.language||"en-US")=>{const t=new Set;return{get lang(){return e},translate(n){return n},subscribe(n){return t.add(n),()=>{t.delete(n)}},setLang(n){e=n,t.forEach(i=>i(e))}}},L=e=>t=>({...t,calculatedWidgets:Fn(t,e)});function Fn(e,t){const{$formIsInvalid:r,$errors:n}=Be(e),i=Xn(e,t,r,n),o={};for(const s of Object.keys(e.calculatedWidgets)){if(e.widgetFlags[s]?.hidden)continue;const u=e.calculatedWidgets[s],c=u.source;if(b(c)){o[s]=Dn(s,c,e,t);continue}o[s]=Pn(u,c,e,i)}return o}function Dn(e,t,r,n){const i=t({$form:r.data,errors:t.path?r.validations[t.path]:void 0,touched:t.path?r.touchedControls[t.path]:void 0,translate:n.translate});return i.uid=e,{source:t,current:i}}function Pn(e,t,r,n){const i=new Kn(t,e.current);return i.write("uid",t.uid),i.write("type",t.type),i.write("kind",t.kind),lt(t)?Wn(i,n):j(t)?Tn(i,n):F(t)?Rn(i,n):pe(t)&&kn(i,n),_n(t,i,n,r),(j(t)||F(t))&&Un(t,i,n),pe(t)&&Nn(t,i,r),i.changed?{source:e.source,current:i.current}:e}function Wn(e,t){I(e,t,"size"),I(e,t,"include"),I(e,t,"exclude")}function Tn(e,t){I(e,t,"size"),I(e,t,"include"),I(e,t,"exclude"),I(e,t,"label"),I(e,t,"disabled")}function Rn(e,t){I(e,t,"size"),I(e,t,"include"),I(e,t,"exclude"),I(e,t,"label"),I(e,t,"disabled"),I(e,t,"readonly"),I(e,t,"validator"),I(e,t,"path"),I(e,t,"defaultValue")}function kn(e,t){I(e,t,"size"),I(e,t,"include"),I(e,t,"exclude")}function _n(e,t,r,n){const i=n.widgetPropOverrides[e.uid]??{},o={...e.props??{},...i};for(const s of qt(Object.keys(o)))Ln(t,r,s)}function Un(e,t,r){const n=e.on??{};for(const i of qt(Object.keys(n)))Mn(t,r,i)}function Nn(e,t,r){const n=Jn(e.uid),i=Qn(e.children,n,r.widgetFlags);t.current.children=i;const o=t.previous.children??[];o.length===i.length&&i.every((u,c)=>o[c]&&o[c].uid===i[c].uid)||t.markChanged()}function I(e,t,r){const n=e.source;if(!zn(n,r))return;const i=st(n,r,t.sortedStates);let o;switch(r){case"disabled":case"readonly":o=Bn(i,t,e.source.uid,r);break;default:o=Jt(i,t)}e.write(r,o)}function Ln(e,t,r){const n=e.source.props,i=st(n,r,t.sortedStates);let o=Jt(i,t);const s=t.widgetPropOverrides[e.source.uid]?.[r];s!==void 0&&(o=s),e.write(`props.${r}`,o)}function Mn(e,t,r){const n=e.source.on,i=st(n,r,t.sortedStates);e.write(`on.${r}`,Hn(i,t))}function ot(e,t){return e({$form:t.$form,translate:t.localization.translate})}function Vn(e,t){return t.localization.translate(e.key,Gn(e.params,t),e.default)}function Qt(e,t){return Pr(e,{resolveFormPath:r=>k(t.$form,r)??e,resolveMetaPath:r=>k(t.$meta,r)??e,resolveErrorsPath:r=>k(t.$errors,r)??e,resolveFormIsInvalid:()=>String(t.$formIsInvalid)})}function Jt(e,t){return typeof e=="function"?ot(e,t):Xt(e)?Vn(e,t):typeof e=="string"?Qt(e,t):e}function Bn(e,t,r,n){return typeof e=="function"?ot(e,t):J(e)?t.widgetFlags[r]?.[n]:typeof e=="string"?Qt(e,t):e}function Hn(e,t){return typeof e=="function"?ot(e,t):e}function st(e,t,r){if(e){for(const n of r){const i=e[`${t}.${n}`];if(i!==void 0)return i}return e[t]}}function Gn(e,t){return e&&Object.keys(e).reduce((r,n)=>{const i=String(e[n]);return wr(i)?r[n]=Wr(i,{resolveFormPath:o=>k(t.$form,o)??i,resolveMetaPath:o=>k(t.$meta,o)??i,resolveErrorsPath:o=>k(t.$errors,o)??i,resolveFormIsInvalid:()=>t.$formIsInvalid}):r[n]=i,r},{})}class Kn{constructor(t,r){this._changed=!1,this.source=t,this.previous=r,this.current={}}get changed(){return this._changed}markChanged(){this._changed=!0}write(t,r){Ae(this.current,t,r),k(this.previous,t)!==r&&(this._changed=!0)}}function Xn(e,t,r,n){return{sortedStates:[...e.currentStates].sort((i,o)=>o.length-i.length),widgetPropOverrides:e.widgetPropOverrides,widgetFlags:e.widgetFlags,$form:e.data,$meta:e.meta,$formIsInvalid:r,$errors:n,localization:t}}function zn(e,t){if(t in e)return!0;const r=`${t}.`;return Object.keys(e).some(n=>n.startsWith(r))}function qt(e){return Array.from(new Set(e.map(t=>t.split(".")[0])))}function Qn(e,t,r){const n=t.map(i=>`[${i}]`).join("");return e.filter(i=>{const o=i.uid+n,s=r[o];return!s||s.hidden!==!0})}const Jn=e=>[...e.matchAll(/\[(\d+)\]/g)].map(t=>parseInt(t[1],10)),qn=({lang:e},t)=>{const r={...Le(e),formName:t.payload.formName};let n=t.payload.formDef,i={status:"ok"};if(typeof n=="string"){try{n=JSON.parse(n)}catch(u){const c=u,g=ne.initializeParseError;i={status:"errored",message:`[${g}] ${c.message}`,code:g}}if(i.status==="errored")return{...r,formHealth:i}}if(Array.isArray(n.form)){const u=n,c=u.form;u.form={uid:"",type:"flex",kind:"layout",children:c}}const o=Ne.decode(n);if(o.isOk()){i={status:"ok"};let u={};try{u=Ve([o.value.form]).reduce((c,g)=>{if(c[g.uid])throw{existingWidget:c[g.uid],newWidget:g};return c[g.uid]=g,c},{})}catch(c){const g=ne.initializeUidCollisionError;i={status:"errored",message:`[${g}] ${Yn(c.existingWidget,c.newWidget)}`,code:g},u={}}return{...r,formDef:o.value,flatForm:u,formHealth:i}}const s=ne.initializeUnknownError;return{...r,formHealth:{status:"errored",message:`[${s}] ${o.error}`,code:s}}};function Yn(e,t){const r=n=>F(n)?` at "${n.path}"`:"";return`Duplicate UID "${t.uid}": Assigned to widget "${e.type}"${r(e)} and "${t.type}"${r(t)}.`}function Zn(e,t){return{...e,injectedValidations:{...e.injectedValidations,[t.payload.path]:t.payload.issues}}}const jn=(e,{payload:t})=>{let r;if("path"in t){if(r=Object.values(e.calculatedWidgets).find(({source:i})=>F(i)&&i.path===t.path),!r)return console.warn(`Input with path "${t.path}" not found`),e}else if(r=e.calculatedWidgets[t.uid],!r)return console.warn(`Widget with uid "${t.uid}" not found`),e;const n=e.widgetPropOverrides[r.source.uid]||{};return{...e,widgetPropOverrides:{...e.widgetPropOverrides,[r.source.uid]:{...n,[t.prop]:t.value}}}};function bn(e,t){return{...e,widgetFlags:{...ie(e.widgetFlags,t.payload.uid)},calculatedWidgets:{...ie(e.calculatedWidgets,t.payload.uid)},widgetPropOverrides:{...ie(e.widgetPropOverrides,t.payload.uid)},touchedControls:{...U(e.touchedControls,r=>{const n=e.flatForm[t.payload.uid];return n&&F(n)?ie(r,n.path):r})}}}const xn=(e,t)=>({...e,data:{...t.payload.data}}),ei=(e,t)=>({...e,formHealth:t.payload.formHealth}),ti=(e,t)=>({...e,lang:t.payload.lang}),ri=(e,t)=>({...e,meta:{...t.payload.meta}}),ni=(e,t)=>{const r=k(e.data,t.payload.path);return t.type==="SET_WIDGET_DATA"||t.type==="SET_WIDGET_INITIAL_DATA"&&r===void 0?{...e,data:{...Ae(e.data,t.payload.path,t.payload.data)}}:e};function Yt(e,t){const r=e["~standard"].validate(t);if(r instanceof Promise)throw new TypeError("Schema validation must be synchronous");return r}function Zt(e){return e.issues===void 0}const dt=(e,t)=>r=>{const n=nt(Object.values(r.calculatedWidgets),({current:o})=>F(o)?o:Pe),i=r.validations;return{...r,validations:n.reduce((o,s)=>{if(o[s.path]=null,s.validator){const u=e(s.validator,t),c=k(r.data,s.path),g=Yt(u,c);o[s.path]=Zt(g)?null:g.issues.map(E=>E.message)}return Array.isArray(o[s.path])&&Array.isArray(i[s.path])&&Ht(o[s.path],i[s.path],(u,c)=>u===c)&&(o[s.path]=i[s.path]),o},{})}},ii=({validators:e,validateOn:t,localization:r})=>(n,i)=>{switch(i.type){case"INITIALIZE":return qn(n,i);case"SET_DATA":return U(xn(n,i),G,K,L(r));case"SET_META":return U(ri(n,i),G,K,L(r));case"SET_LANGUAGE":return U(ti(n,i),L(r));case"ADD_WIDGET":return U(Cr(n,i),We(ut,G),We(ut,K),We(ut,L(r)));case"REMOVE_WIDGET":return U(bn(n,i),G,K,L(r));case"SET_WIDGET_INITIAL_DATA":case"SET_WIDGET_DATA":return U(ni(n,i),G,K,L(r));case"OVERRIDE_WIDGET_PROP":return U(jn(n,i),G,K,L(r),We(o=>{let s=!1,u="";"path"in i.payload?(s=!0,u=i.payload.path):F(o.calculatedWidgets[i.payload.uid].current)&&(s=!0,u=o.calculatedWidgets[i.payload.uid].current.path);const c=s&&o.touchedControls[u];return o.touched&&c},dt(e,r)));case"SET_FORM_HEALTH":return ei(n,i);case"VALIDATE_ALL":return U({...n,touched:!0,touchedControls:Object.keys(n.calculatedWidgets).reduce((o,s)=>{const u=n.calculatedWidgets[s].source;return F(u)&&(o[u.path]=!0),o},{})},dt(e,r),G,K,L(r));case"ATTEMPT_VALIDATION":{const o=i.payload.reason,s=i.payload.path;return t==="eager"||o===t||t.includes(o)?U({...n,touched:!0,touchedControls:{...n.touchedControls,[s]:!0}},dt(e,r),G,K,L(r),c=>{const g=i.payload.uid,E=c.calculatedWidgets[g],y=E.source;if(b(y)){const p=y({$form:c.data,errors:c.validations[s],touched:!0,translate:r.translate});return{...c,calculatedWidgets:{...c.calculatedWidgets,[g]:{source:E.source,current:p}}}}return c}):n}case"INJECT_VALIDATION_ISSUES":return Zn(n,i);default:return vr(i)}},ut=e=>e.formHealth.status==="ok";function jt(e=[],t,r,n){const i=new a.BehaviorSubject(Le(n.lang)),o=i.asObservable().pipe(a.distinctUntilChanged()),s=ii({validators:t,validateOn:r,localization:n});function u(y){const p=i.getValue(),P=s(p,y);i.next(P)}let c=u;const g={getState:()=>i.getValue(),dispatch:y=>c(y)};return c=e.map(y=>y(g)).reduceRight((y,p)=>p(y),u),{state$:o,dispatch:c,getState:()=>i.getValue()}}class oi{constructor(){this.widgetRegistry=new ae,this.store={},this.events$=new a.Subject,this.uuid=crypto.randomUUID(),this.itemRenderers={},this.dependencies={}}initialize(t,r=[],n,i,o,s=zt(),u){this.localization=s,this.dependencies=u,this.widgetRegistry.setWidgetLoaders(t),this.itemRenderers=o,this.store=jt(r,n,i,s)}emitEvent(t,r,n){const o=this.store.getState().currentStates.filter(s=>r.on?.[`${t}.${s}`]!==void 0);if(o.length>0)o.forEach(s=>{const u=r.on?.[`${t}.${s}`];this.attemptValidation(t,u,r),u&&this.events$.next({name:u,data:this.store.getState().data,detail:n??void 0,callback:c=>{this.store.dispatch(c)}})});else{const s=r.on?.[t];this.attemptValidation(t,s,r),s&&this.events$.next({name:s,data:this.store.getState().data,detail:n,callback:u=>{this.store.dispatch(u)}})}}attemptValidation(t,r,n){n.kind!=="layout"&&(t==="change"?this.store.dispatch({type:"ATTEMPT_VALIDATION",payload:{reason:"change",path:n.path,uid:n.uid}}):t==="click"&&r==="submit"&&this.store.dispatch({type:"VALIDATE_ALL"}))}}function si(e="GolemUI Form Store"){return t=>{const n=(typeof window<"u"?window.__REDUX_DEVTOOLS_EXTENSION__:void 0)?.connect({name:e});return n?.init(t.getState()),i=>o=>{i(o),n&&n.send(o,t.getState())}}}const di=a.pipe(a.map(e=>e.data),a.distinctUntilChanged()),ui=e=>a.pipe(di,a.map(t=>k(t,e)),a.distinctUntilChanged()),ci=a.pipe(a.filter(e=>e.touched===!0),a.map(e=>e.validations),a.distinctUntilChanged()),li=e=>a.pipe(ci,a.map(t=>t[e]),a.distinctUntilChanged()),ai=a.pipe(a.filter(e=>e.touched===!0),a.map(e=>e.injectedValidations),a.distinctUntilChanged()),fi=e=>a.pipe(ai,a.map(t=>t[e]),a.distinctUntilChanged(),a.startWith(null)),hi=a.pipe(a.map(e=>e.lang),a.distinctUntilChanged()),bt=a.pipe(a.map(e=>e.calculatedWidgets),a.distinctUntilChanged()),pi=e=>t=>a.combineLatest([t.pipe(hi),t.pipe(bt)]).pipe(a.map(([r,n])=>({lang:r,widget:n[e]})),a.filter(r=>r.widget!==void 0),a.distinctUntilChanged((r,n)=>r.lang===n.lang&&r.widget===n.widget),a.map(r=>r.widget.current)),gi=e=>a.pipe(bt,a.map(t=>t[e]),a.filter(t=>t!==void 0),a.map(t=>t.current.children),a.distinctUntilChanged()),xt=a.pipe(a.map(e=>e.widgetFlags),a.distinctUntilChanged()),mi=e=>a.pipe(xt,a.map(t=>t[e]),a.distinctUntilChanged()),yi=a.pipe(a.map(e=>e.touchedControls),a.distinctUntilChanged()),$i=e=>a.pipe(yi,a.map(t=>t[e]),a.distinctUntilChanged()),Ai=a.pipe(a.map(e=>e.formHealth),a.distinctUntilChanged((e,t)=>!(e.status!==t.status||e.status==="errored"))),Si=e=>e.pipe(Ai);let er=!1;function Ei(){er=!0}function tr(){return er}function vi(e,t,r){if(!tr())return;const n=Object.keys(t??{}).filter(i=>i in r);if(n.length>0)throw new Error(`[GolemUI] Widget "${e}": prop keys [${n.join(", ")}] collide with widget fields`)}f.Debug=Vt,f.FormContext=oi,f.SKIP=Pe,f.WidgetRegistry=ae,f.assertNoPropCollisions=vi,f.calculatedLayoutChildrenByUid$=gi,f.calculatedWidgetsByUid$=pi,f.cloneObject=Me,f.compose=Ir,f.createFormStore=jt,f.createInitialState=Le,f.dataByPath$=ui,f.defineForm=Er,f.deleteKey=ie,f.devToolsMiddleware=si,f.enableDevMode=Ei,f.errorCodes=ne,f.filterMap=nt,f.filterReduce=Bt,f.filterTap=vn,f.formDefDecoder=Ne,f.formHealth=Si,f.get=k,f.getDirectionFromLanguage=wn,f.identityTranslator=zt,f.injectedValidationByPath$=fi,f.isActionWidget=j,f.isDevMode=tr,f.isDisplayWidget=lt,f.isFunctionWidget=b,f.isInputWidget=F,f.isLayoutWidget=pe,f.isStandardValidateSuccess=Zt,f.isTranslationConfig=Xt,f.layoutWidgetDecoder=$e,f.makeRepeaterItemConfig=Gt,f.pipe=U,f.selectWidgetFlags=xt,f.set=Ae,f.shortUUID=Re,f.standardValidate=Yt,f.toRepeaterItemUid=it,f.touchedControlsByPath$=$i,f.transformRepeaterItemWhenExpression=ce,f.validationByPath$=li,f.widgetFlagsByUid$=mi,f.zipEvery=Ht,Object.defineProperty(f,Symbol.toStringTag,{value:"Module"})}));
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("rxjs");require("@standard-schema/spec");var rr=class{constructor(e){this.value=e}map(e){return W(e(this.value))}isOk(){return!0}},nr=class{constructor(e){this.error=e}map(e){return I(this.error)}isOk(){return!1}};function W(e){return new rr(e)}function I(e){return new nr(e)}var P=class _e{constructor(t){this.decodeFn=t,this["~standard"]={version:1,vendor:"ts.data.json",validate:r=>{let n=this.decode(r);return n.isOk()?{value:n.value}:{issues:[{message:n.error}]}}},this.decodeToPromise=this.decodePromise,this.chain=this.flatMap}parse(t){let r=this.decode(t);if(r.isOk())return r.value;throw r.error}decode(t){return this.decodeFn(t)}decodePromise(t){return new Promise((r,n)=>{let o=this.decode(t);return o.isOk()?r(o.value):n(o.error)})}map(t){return new _e(r=>{let n=this.decodeFn(r);return n.isOk()?W(t(n.value)):I(n.error)})}flatMap(t){return new _e(r=>{let n=this.decodeFn(r);return n.isOk()?t(n.value).decode(r):I(n.error)})}},or=(e,t,r)=>`<${e}> decoder failed at index "${t}" with error: ${r}`,q=(e,t)=>`${JSON.stringify(e)} is not a valid ${t}`;function Ve(e,t){return new P(r=>{if(r instanceof Array){let n=[];for(let o=0;o<r.length;o++){let i=e.decode(r[o]);if(i.isOk())n.push(i.value);else return I(or(t,o,i.error))}return W(n)}else return I(q(r,"array"))})}function ir(){return new P(e=>typeof e=="boolean"?W(e):I(q(e,"boolean")))}function gt(e){return new P(t=>e().decode(t))}var sr=(e,t)=>`${JSON.stringify(e)} is not exactly ${JSON.stringify(t)}`;function Se(e){return new P(t=>t===e?W(e):I(sr(t,e)))}function Ee(){return new P(e=>typeof e=="number"?W(e):I(q(e,"number")))}var dr=(e,t,r)=>`<${e}> decoder failed at key "${t}" with error: ${r}`;function se(e,t){return new P(r=>{if(r!==null&&typeof r=="object"){let n={};for(let o in e)if(Object.prototype.hasOwnProperty.call(e,o)){let i,s=e[o];if(s instanceof P?i=s.decode(r[o]):i=s.decoder.decode(r[s.fromKey]),i.isOk())n[o]=i.value;else return I(dr(t,o,i.error))}return W(n)}else return I(q(r,t))})}var ur=(e,t)=>`<${e}> decoder failed because ${JSON.stringify(t)} can't be decoded with any of the provided oneOf decoders`;function x(e,t){return new P(r=>{for(let n=0;n<e.length;n++){let o=e[n].decode(r);if(o.isOk())return o}return I(ur(t,r))})}function S(e){return new P(t=>t===void 0?W(void 0):e.decode(t))}var cr=(e,t,r)=>`<${e}> record decoder failed at key "${t}" with error: ${r}`;function lr(e,t){return new P(r=>{if(r!==null&&typeof r=="object"){let n={};for(let o in r)if(Object.prototype.hasOwnProperty.call(r,o)){let i=e.decode(r[o]);if(i.isOk())n[o]=i.value;else return I(cr(t,o,i.error))}return W(n)}else return I(q(r,t))})}function C(){return new P(e=>typeof e=="string"?W(e):I(q(e,"string")))}function X(){return new P(e=>W(e))}function ar(e){return{...e,form:{uid:"",type:"flex",kind:"layout",children:e.form}}}const Be=se({states:S(lr(C(),"states")),form:gt(()=>we)},"FormDef"),He=e=>({formName:"",formDef:Be.parse({form:{kind:"layout",type:"flex",children:[]}}),flatForm:{},currentStates:[],calculatedWidgets:{},validations:{},touchedControls:{},injectedValidations:{},widgetFlags:{},widgetPropOverrides:{},data:{},meta:{},formHealth:{status:"ok"},touched:!1,lang:e}),mt=e=>!(typeof e!="object"||e===null||typeof e.key!="string");function fr(e){const t=new Intl.Locale(e).maximize().script;return["Arab","Hebr","Thaa","Syrc","Tfng","Adlm","Rohg"].includes(t||"")?"rtl":"ltr"}const yt=(e=navigator.language||"en-US")=>{const t=new Set;return{get lang(){return e},translate(n){return n},subscribe(n){return t.add(n),()=>{t.delete(n)}},setLang(n){e=n,t.forEach(o=>o(e))}}};function de(e,t){return new P(r=>{if(typeof r!="object"||r===null)return I(`<${t}> failed. Expected object literal, got "${typeof r}"`);const n={};for(const[o,i]of Object.entries(e)){const s=i.decoder.decode(r[o]);if(!s.isOk())return I(`<${t}> failed at "${o}" with ${s.error}`);if(n[o]=s.value,i.suffixed){for(const[u,c]of Object.entries(r))if(u.startsWith(o+".")){const h=i.decoder.decode(c);if(!h.isOk())return I(`<${t}> failed at "${u}" with ${h.error}`);n[u]=h.value}}}return W(n)})}const Ge=()=>crypto.randomUUID().slice(0,8),$t=e=>typeof e!="function"&&e.kind==="display",Q=e=>typeof e!="function"&&e.kind==="action",D=e=>typeof e!="function"&&e.kind==="input",fe=e=>typeof e!="function"&&e.kind==="layout",Y=e=>typeof e=="function",pr=se({in:Ve(C(),"In[]")},"In"),Ke=se({when:C()},"When"),ve=x([pr,Ke],"In | When"),hr=se({from:Ve(C(),"From[]")},"From"),Ie=x([hr,Ke],"Exclude"),Ue=x([ir(),Ke],"Bool | When"),gr=new P(e=>{const t=typeof e;return t==="function"?W(e):I(`Expected a function, got '${t}'`)}),j=e=>x([e,gr],""),Xe=de({load:{suffixed:!0,decoder:j(S(C()))},click:{suffixed:!0,decoder:j(S(C()))},change:{suffixed:!0,decoder:j(S(C()))},filter:{suffixed:!0,decoder:j(S(C()))},blur:{suffixed:!0,decoder:j(S(C()))}},"On"),mr=se({key:C(),default:S(C()),params:X()},"TranslationConfig"),At=x([C(),mr],"Localizable"),Ce=S(C()).map(e=>e||Ge()),yr=de({kind:{decoder:Se("display")},uid:{decoder:Ce},type:{decoder:C()},size:{suffixed:!0,decoder:S(Ee())},include:{decoder:S(ve)},exclude:{decoder:S(Ie)},props:{decoder:S(X())}},"DisplayWidget"),$r=de({kind:{decoder:Se("action")},uid:{decoder:Ce},type:{decoder:C()},size:{suffixed:!0,decoder:S(Ee())},include:{decoder:S(ve)},exclude:{decoder:S(Ie)},label:{suffixed:!0,decoder:j(At)},disabled:{suffixed:!0,decoder:S(Ue)},on:{decoder:S(Xe)},props:{decoder:S(X())}},"ActionWidget"),Ar=new P(e=>{const t=typeof e;if(t==="function"){const r=e,n=r(void 0);return r.uid=n.uid||Ge(),r.type=n.type,r.path=n.path,W(r)}else return I(`Expected a function, got '${t}'`)}),Sr=de({kind:{decoder:Se("input")},uid:{decoder:Ce},type:{decoder:C()},size:{suffixed:!0,decoder:S(Ee())},include:{decoder:S(ve)},exclude:{decoder:S(Ie)},disabled:{suffixed:!0,decoder:S(Ue)},readonly:{suffixed:!0,decoder:S(Ue)},on:{decoder:S(Xe)},props:{decoder:S(X())},label:{suffixed:!0,decoder:j(S(At))},path:{decoder:C()},defaultValue:{decoder:S(X())},validator:{suffixed:!0,decoder:j(S(X()))}},"InputWidget").map(e=>{const t={...e};if(e.uid||(t.uid=`${e.path}-${e.type}`),e.type==="repeater"){const r=e.props;r.template=we.parse(r.template)}return t}),Er=gt(()=>x([Ar,Sr,we,yr,$r],"FormWidget")),we=de({kind:{decoder:Se("layout")},uid:{decoder:Ce},type:{decoder:C()},size:{suffixed:!0,decoder:S(Ee())},include:{decoder:S(ve)},exclude:{decoder:S(Ie)},props:{decoder:S(X())},on:{decoder:S(Xe)},children:{decoder:Ve(Er,"FormWidget[]")}},"LayoutWidget"),G=class G{constructor(){this.widgetLoaders={},this._ready=!1}get ready(){return this._ready}setWidgetLoaders(t){this.widgetLoaders=t,this._ready=!0}async loadWidget(t){const r=this.widgetLoaders[t];if(!G.sharedCache.has(r)){const n=r().catch(o=>(G.sharedCache.delete(r),Promise.reject(o)));G.sharedCache.set(r,n)}return G.sharedCache.get(r)}};G.sharedCache=new Map;let pe=G;function St(e,t){const r=e["~standard"].validate(t);if(r instanceof Promise)throw new TypeError("Schema validation must be synchronous");return r}function Et(e){return e.issues===void 0}const vr=e=>{throw new Error(`Unhandled case: ${JSON.stringify(e)}`)};function _(e,...t){return t.reduce((r,n)=>n(r),e)}function Ir(...e){return t=>e.reduceRight((r,n)=>n(r),t)}function Cr(e,t){const r=t.payload.widget.uid;if(!r)throw new Error("addWidget: widget must have a uid");return{...e,calculatedWidgets:{...e.calculatedWidgets,[r]:{source:t.payload.widget,current:{}}}}}const ne={calculateCurrentStateError:10,initializeParseError:20,initializeUidCollisionError:21,initializeUnknownError:22,widgetCouldNotBeLoaded:30},R=(e,t)=>{if(e===void 0)throw new Error("obj is undefined");return t.split(".").reduce((r,n)=>r===void 0||n===""?r:Array.isArray(r)?r[parseInt(n,10)]:r[n],e)},Oe=(e,t,r)=>{if(e===null)throw new Error("object is null");if(e===void 0)throw new Error("object is undefined");if(t==="")throw new Error("path cannot be empty");const n=t.split(".");let o=e;for(let s=0;s<n.length-1;s++){const u=n[s],c=n[s+1];(o[u]==null||typeof o[u]!="object")&&(o[u]=wr(c)?[]:{}),o=o[u]}const i=n[n.length-1];return o[i]=r,e};function wr(e){const t=Number(e);return Number.isInteger(t)&&t>=0&&t.toString()===e}const te=(e,t)=>(delete e[t],e);function Ne(e){if(e===null||typeof e!="object")return e;if(Array.isArray(e))return e.map(r=>Ne(r));const t={};for(const r of Object.keys(e))t[r]=Ne(e[r]);return t}const F={FORM:"$form",META:"$meta",ERRORS:"$errors",FORM_IS_INVALID:"$formIsInvalid"},Or=e=>typeof e=="string"&&!e.includes(" ")&&(e.startsWith(`${F.FORM}.`)||e.startsWith(`${F.META}.`)||e.startsWith(`${F.ERRORS}.`)||e===F.FORM_IS_INVALID),Dr=[F.FORM,F.META,F.ERRORS].map(e=>e.replace("$","\\$")).join("|"),Fr=new RegExp(`\\{\\{(?:(?<scope>${Dr})\\.(?<path>[^}]+)|(?<isInvalid>\\${F.FORM_IS_INVALID}))\\}\\}`,"g"),Pr=(e,t)=>typeof e!="string"||!e.includes("{{$")?e:e.replace(Fr,(r,...n)=>{const o=n[n.length-1],{scope:i,path:s,isInvalid:u}=o;try{if(u===F.FORM_IS_INVALID)return t.resolveFormIsInvalid();if(i&&s)switch(i){case F.FORM:return t.resolveFormPath(s);case F.META:return t.resolveMetaPath(s);case F.ERRORS:return t.resolveErrorsPath(s);default:return r}}catch(c){return console.error(`Error resolving Expression: '${e}'`,c),r}return r}),Wr=(e,t)=>{const r=`${F.FORM}.`;if(e.startsWith(r))return t.resolveFormPath(e.replace(r,""));const n=`${F.META}.`;if(e.startsWith(n))return t.resolveMetaPath(e.replace(n,""));const o=`${F.ERRORS}.`;if(e.startsWith(o))return t.resolveErrorsPath(e.replace(o,""));if(e===F.FORM_IS_INVALID)return t.resolveFormIsInvalid()};function ze(e){return e.flatMap(t=>[t,...fe(t)?ze(t.children):[]])}function Je(e){return Object.entries(e.validations).reduce((r,[n,o])=>(o!==null&&(r.$formIsInvalid=!0,Oe(r.$errors,n,[...o])),r),{$formIsInvalid:!1,$errors:{}})}const Qe=32;let Le,p,g,y=e=>(p=0,g=e,y.newline=!1,e=E(),g[p]?z():e||""),z=(e="Unexpected token",t=p,r=g.slice(0,t).split(`
|
|
2
|
+
`),n=r.pop(),o=g.slice(Math.max(0,t-40),t),i="̭",s=(g[t]||" ")+i,u=g.slice(t+1,t+20))=>{throw SyntaxError(`${e} at ${r.length+1}:${n.length+1}
|
|
3
|
+
${g[t-41]!==`
|
|
4
|
+
`,""+o}${s}${u}`)},vt=(e,t=p)=>(Array.isArray(e)&&(e.loc=t),e),Z=(e,t=p,r)=>{for(;r=e(g.charCodeAt(p));)p+=r;return g.slice(t,p)},w=(e=1)=>g[p+=e],Me=e=>p=e,E=(e=0,t)=>{let r,n,o,i,s;for(t&&y.asi&&(y.newline=!1);(r=y.space())&&(s=y.newline,1)&&r!==t&&(o=(n&&r===91&&Le&&y.asi?.(n,e,E)||null)??((i=k[r])&&i(n,e))??(n&&s&&y.asi?.(n,e,E))??(!n&&Z(y.id)));)n=o;return t&&(r==t?(p++,t===125&&y.asi&&(y.newline=!0)):z("Unclosed "+String.fromCharCode(t-(t>42?2:1)))),n},B=(e,t=p)=>{for(Le=!1;(e=g.charCodeAt(p))<=Qe;)y.asi&&e===10&&(y.newline=Le=!0),p++;return e},Tr=(e=p)=>{for(;g.charCodeAt(e)<=Qe;)e++;return g.charCodeAt(e)};y.id=e=>e>=48&&e<=57||e>=65&&e<=90||e>=97&&e<=122||e==36||e==95||e>=192&&e!=215&&e!=247;let Rr=(e,t=e.length)=>g.substr(p,t)===e&&!y.id(g.charCodeAt(p+t)),k=[],ct={},T=(e,t=Qe,r,n=e.charCodeAt(0),o=e.length,i=k[n],s=e.toUpperCase()!==e,u,c)=>(t=ct[e]=!i&&ct[e]||t,k[n]=(h,A,m,f=p)=>(u=m,(m?e==m:(o<2||e.charCodeAt(1)===g.charCodeAt(p+1)&&(o<3||g.substr(p,o)==e))&&(!s||!y.id(g.charCodeAt(p+o)))&&(u=m=e))&&A<t&&(p+=o,(c=r(h))?vt(c,f):(p=f,u=0,!s&&!i&&!h&&z()),c)||i?.(h,A,u))),$=(e,t,r=!1)=>T(e,t,n=>n&&(o=>o&&[e,n,o])(E(t-(r?.5:0)))),H=(e,t,r)=>T(e,t,n=>!n&&(n=E(t-.5))&&[e,n]),ue=(e,t)=>T(e,200,r=>!r&&[,t]),It=(e,t,r)=>T(e,t,(n,o)=>(o=E(t-(r?.5:0)),n?.[0]!==e&&(n=[e,n||null]),o?.[0]===e?n.push(...o.slice(1)):n.push(o||null),n)),qe=(e,t)=>T(e[0],t,r=>!r&&[e,E(0,e.charCodeAt(1))||null]),Ct=(e,t)=>T(e[0],t,r=>r&&[e,r,E(0,e.charCodeAt(1))||null]),ce=(e,t,r,n=e.charCodeAt(0),o=e.length,i=k[n],s)=>k[n]=(u,c,h,A=p)=>!u&&(h?e==h:(o<2||g.substr(p,o)==e)&&(h=e))&&c<t&&!y.id(g.charCodeAt(p+o))&&(!y.prop||y.prop(p+o))&&(Me(p+o),(s=r())?vt(s,A):Me(A),s)||i?.(u,c,h);Object.defineProperty(y,"space",{configurable:!0,enumerable:!0,get:()=>B,set:e=>B=e});const je={},l=(e,t,r=je[e])=>je[e]=(...n)=>t(...n)||r?.(...n),d=e=>Array.isArray(e)?e[0]==null?(t=>()=>t)(e[1]):je[e[0]]?.(...e.slice(1))??z(`Unknown operator: ${e[0]}`,e?.loc):e===void 0?()=>{}:t=>t?.[e],he=46,oe=48,ge=57,kr=69,_r=101,Ur=43,Nr=45,ae=95,wt=110,Lr=97,Mr=102,jr=65,Vr=70,Ot=e=>e.indexOf("_")<0?e:e.replaceAll("_",""),xe=e=>{let t=Ot(Z(r=>r===he&&g.charCodeAt(p+1)!==he||r>=oe&&r<=ge||r===ae||((r===kr||r===_r)&&((r=g.charCodeAt(p+1))>=oe&&r<=ge||r===Ur||r===Nr)?2:0)));return g.charCodeAt(p)===wt?(w(),[,BigInt(t)]):(e=+t)!=e?z():[,e]},Br={2:e=>e===48||e===49||e===ae,8:e=>e>=48&&e<=55||e===ae,16:e=>e>=oe&&e<=ge||e>=Lr&&e<=Mr||e>=jr&&e<=Vr||e===ae};y.number=null;k[he]=e=>!e&&g.charCodeAt(p+1)!==he&&xe();for(let e=oe;e<=ge;e++)k[e]=t=>t?void 0:xe();k[oe]=e=>{if(e)return;const t=y.number;if(t){for(const[r,n]of Object.entries(t))if(r[0]==="0"&&g[p+1]?.toLowerCase()===r[1]){w(2);const o=Ot(Z(Br[n]));return g.charCodeAt(p)===wt?(w(),[,BigInt("0"+r[1]+o)]):[,parseInt(o,n)]}}return xe()};const Hr=92,lt=34,at=39,Gr={n:`
|
|
5
|
+
`,r:"\r",t:" ",b:"\b",f:"\f",v:"\v"},Dt=e=>(t,r,n="")=>{if(!(t||!y.string?.[String.fromCharCode(e)]))return w(),Z(o=>o-e&&(o===Hr?(n+=Gr[g[p+1]]||g[p+1],2):(n+=g[p],1))),g[p]===String.fromCharCode(e)?w():z("Bad string"),[,n]};k[lt]=Dt(lt);k[at]=Dt(at);y.string={'"':!0};const Kr=20;"= += -= *= /= %= |= &= ^= >>= <<=".split(" ").map(e=>$(e,Kr,!0));const Ft=(e,t,r,n)=>typeof e=="string"?o=>t(o,e,o):e[0]==="."?(r=d(e[1]),n=e[2],o=>t(r(o),n,o)):e[0]==="[]"&&e.length===3?(r=d(e[1]),n=d(e[2]),o=>t(r(o),n(o),o)):e[0]==="()"&&e.length===2?Ft(e[1],t):(()=>{throw Error("Invalid assignment target")})(),ft={"=":(e,t,r)=>e[t]=r,"+=":(e,t,r)=>e[t]+=r,"-=":(e,t,r)=>e[t]-=r,"*=":(e,t,r)=>e[t]*=r,"/=":(e,t,r)=>e[t]/=r,"%=":(e,t,r)=>e[t]%=r,"|=":(e,t,r)=>e[t]|=r,"&=":(e,t,r)=>e[t]&=r,"^=":(e,t,r)=>e[t]^=r,">>=":(e,t,r)=>e[t]>>=r,"<<=":(e,t,r)=>e[t]<<=r};for(const e in ft)l(e,(t,r)=>(r=d(r),Ft(t,(n,o,i)=>ft[e](n,o,r(i)))));const Xr=30,zr=40,Jr=140;H("!",Jr);$("||",Xr);$("&&",zr);l("!",e=>(e=d(e),t=>!e(t)));l("||",(e,t)=>(e=d(e),t=d(t),r=>e(r)||t(r)));l("&&",(e,t)=>(e=d(e),t=d(t),r=>e(r)&&t(r)));const Qr=50,qr=60,xr=70,Pt=100,Yr=140;$("|",Qr);$("&",xr);$("^",qr);$(">>",Pt);$("<<",Pt);H("~",Yr);l("~",e=>(e=d(e),t=>~e(t)));l("|",(e,t)=>(e=d(e),t=d(t),r=>e(r)|t(r)));l("&",(e,t)=>(e=d(e),t=d(t),r=>e(r)&t(r)));l("^",(e,t)=>(e=d(e),t=d(t),r=>e(r)^t(r)));l(">>",(e,t)=>(e=d(e),t=d(t),r=>e(r)>>t(r)));l("<<",(e,t)=>(e=d(e),t=d(t),r=>e(r)<<t(r)));const De=90;$("<",De);$(">",De);$("<=",De);$(">=",De);l(">",(e,t)=>(e=d(e),t=d(t),r=>e(r)>t(r)));l("<",(e,t)=>(e=d(e),t=d(t),r=>e(r)<t(r)));l(">=",(e,t)=>(e=d(e),t=d(t),r=>e(r)>=t(r)));l("<=",(e,t)=>(e=d(e),t=d(t),r=>e(r)<=t(r)));const Wt=80;$("==",Wt);$("!=",Wt);l("==",(e,t)=>(e=d(e),t=d(t),r=>e(r)==t(r)));l("!=",(e,t)=>(e=d(e),t=d(t),r=>e(r)!=t(r)));const Tt=110,Ye=120,Rt=140;$("+",Tt);$("-",Tt);$("*",Ye);$("/",Ye);$("%",Ye);H("+",Rt);H("-",Rt);l("+",(e,t)=>t!==void 0?(e=d(e),t=d(t),r=>e(r)+t(r)):(e=d(e),r=>+e(r)));l("-",(e,t)=>t!==void 0?(e=d(e),t=d(t),r=>e(r)-t(r)):(e=d(e),r=>-e(r)));l("*",(e,t)=>(e=d(e),t=d(t),r=>e(r)*t(r)));l("/",(e,t)=>(e=d(e),t=d(t),r=>e(r)/t(r)));l("%",(e,t)=>(e=d(e),t=d(t),r=>e(r)%t(r)));const me=150;T("++",me,e=>e?["++",e,null]:["++",E(me-1)]);T("--",me,e=>e?["--",e,null]:["--",E(me-1)]);const Ze=(e,t,r,n)=>typeof e=="string"?o=>t(o,e):e[0]==="."?(r=d(e[1]),n=e[2],o=>t(r(o),n)):e[0]==="[]"&&e.length===3?(r=d(e[1]),n=d(e[2]),o=>t(r(o),n(o))):e[0]==="()"&&e.length===2?Ze(e[1],t):(()=>{throw Error("Invalid increment target")})();l("++",(e,t)=>Ze(e,t===null?(r,n)=>r[n]++:(r,n)=>++r[n]));l("--",(e,t)=>Ze(e,t===null?(r,n)=>r[n]--:(r,n)=>--r[n]));const Zr=5,br=10;It(",",br);It(";",Zr,!0);const kt=(...e)=>(e=e.map(d),t=>{let r;for(const n of e)r=n(t);return r});l(",",kt);l(";",kt);const en=170;qe("()",en);const V=e=>e?.[0]==="_"&&e[1]==="_"||e==="constructor"||e==="prototype",be=170;Ct("[]",be);$(".",be);Ct("()",be);const ye=e=>{throw Error(e)};l("[]",(e,t)=>t===void 0?(e=e?e[0]===","?e.slice(1):[e]:[],e=e.map(r=>r==null?(()=>{}):r[0]==="..."?(r=d(r[1]),n=>r(n)):(r=d(r),n=>[r(n)])),r=>e.flatMap(n=>n(r))):(t==null&&ye("Missing index"),e=d(e),t=d(t),r=>{const n=t(r);return V(n)?void 0:e(r)[n]}));l(".",(e,t)=>(e=d(e),t=t[0]?t:t[1],V(t)?()=>{}:r=>e(r)[t]));l("()",(e,t)=>{if(t===void 0)return e==null?ye("Empty ()"):d(e);const r=o=>o?.[0]===","&&o.slice(1).some(i=>i==null||r(i));r(t)&&ye("Empty argument");const n=t?t[0]===","?(t=t.slice(1).map(d),o=>t.map(i=>i(o))):(t=d(t),o=>[t(o)]):()=>[];return et(e,(o,i,s)=>o[i](...n(s)))});const J=e=>typeof e=="string"||Array.isArray(e)&&(e[0]==="."||e[0]==="?."||e[0]==="[]"&&e.length===3||e[0]==="?.[]"||e[0]==="()"&&e.length===2&&J(e[1])||e[0]==="{}"),et=(e,t,r,n)=>e==null?ye("Empty ()"):e[0]==="()"&&e.length==2?et(e[1],t):typeof e=="string"?o=>t(o,e,o):e[0]==="."?(r=d(e[1]),n=e[2],o=>t(r(o),n,o)):e[0]==="?."?(r=d(e[1]),n=e[2],o=>{const i=r(o);return i==null?void 0:t(i,n,o)}):e[0]==="[]"&&e.length===3?(r=d(e[1]),n=d(e[2]),o=>t(r(o),n(o),o)):e[0]==="?.[]"?(r=d(e[1]),n=d(e[2]),o=>{const i=r(o);return i==null?void 0:t(i,n(o),o)}):(e=d(e),o=>t([e(o)],0,o)),b=et,tn=32,rn=y.space;y.comment??={"//":`
|
|
6
|
+
`,"/*":"*/"};let We;y.space=()=>{We||(We=Object.entries(y.comment).map(([o,i])=>[o,i,o.charCodeAt(0)]));for(var e;e=rn();){for(var t=0,r;r=We[t++];)if(e===r[2]&&g.substr(p,r[0].length)===r[0]){var n=p+r[0].length;if(r[1]===`
|
|
7
|
+
`)for(;g.charCodeAt(n)>=tn;)n++;else{for(;g[n]&&g.substr(n,r[1].length)!==r[1];)n++;g[n]&&(n+=r[1].length)}Me(n),e=0;break}if(e)return e}return e};const _t=80;$("===",_t);$("!==",_t);l("===",(e,t)=>(e=d(e),t=d(t),r=>e(r)===t(r)));l("!==",(e,t)=>(e=d(e),t=d(t),r=>e(r)!==t(r)));const nn=30;$("??",nn);l("??",(e,t)=>(e=d(e),t=d(t),r=>e(r)??t(r)));const on=130,sn=20;$("**",on,!0);$("**=",sn,!0);l("**",(e,t)=>(e=d(e),t=d(t),r=>e(r)**t(r)));const dn=e=>{throw Error(e)};l("**=",(e,t)=>(J(e)||dn("Invalid assignment target"),t=d(t),b(e,(r,n,o)=>r[n]**=t(o))));const Ut=90;$("in",Ut);$("of",Ut);l("in",(e,t)=>(e=d(e),t=d(t),r=>e(r)in t(r)));const un=20,cn=100,ln=e=>{throw Error(e)};$(">>>",cn);$(">>>=",un,!0);l(">>>",(e,t)=>(e=d(e),t=d(t),r=>e(r)>>>t(r)));l(">>>=",(e,t)=>(J(e)||ln("Invalid assignment target"),t=d(t),b(e,(r,n,o)=>r[n]>>>=t(o))));const tt=5,an=10,fn=20,pn=e=>e[0]?.[0]===","?e[0].slice(1):e,$e=(e,t,r)=>{if(typeof e=="string"){r[e]=t;return}const[n,...o]=e,i=pn(o);if(n==="{}"){const s=[];for(const u of i){if(Array.isArray(u)&&u[0]==="..."){const f={};for(const O in t)s.includes(O)||(f[O]=t[O]);r[u[1]]=f;break}let c,h,A;typeof u=="string"?c=h=u:u[0]==="="?(typeof u[1]=="string"?c=h=u[1]:[,c,h]=u[1],A=u[2]):[,c,h]=u,s.push(c);let m=t[c];m===void 0&&A&&(m=d(A)(r)),$e(h,m,r)}}else if(n==="[]"){let s=0;for(const u of i){if(u===null){s++;continue}if(Array.isArray(u)&&u[0]==="..."){r[u[1]]=t.slice(s);break}let c=u,h;Array.isArray(u)&&u[0]==="="&&([,c,h]=u);let A=t[s++];A===void 0&&h&&(A=d(h)(r)),$e(c,A,r)}}},Nt=e=>{let t=E(an-1);return t?.[0]==="in"||t?.[0]==="of"?[t[0],[e,t[1]],t[2]]:t?.[0]===","?[e,...t.slice(1)]:[e,t]};ce("let",tt+1,()=>Nt("let"));ce("const",tt+1,()=>Nt("const"));ce("var",tt,()=>(B(),["var",E(fn)]));const Lt=(...e)=>(e=e.map(t=>{if(typeof t=="string")return r=>{r[t]=void 0};if(t[0]==="="){const[,r,n]=t,o=d(n);return typeof r=="string"?i=>{i[r]=o(i)}:i=>$e(r,o(i),i)}return d(t)}),t=>{for(const r of e)r(t)});l("let",Lt);l("const",Lt);l("var",e=>typeof e=="string"?t=>{t[e]=void 0}:()=>{});const rt=20,Fe=e=>{throw Error(e)};$("||=",rt,!0);$("&&=",rt,!0);$("??=",rt,!0);l("=",(e,t)=>{if(Array.isArray(e)&&(e[0]==="let"||e[0]==="const"||e[0]==="var")){const r=e[1];return t=d(t),typeof r=="string"?n=>{n[r]=t(n)}:n=>$e(r,t(n),n)}return J(e)||Fe("Invalid assignment target"),t=d(t),b(e,(r,n,o)=>r[n]=t(o))});l("||=",(e,t)=>(J(e)||Fe("Invalid assignment target"),t=d(t),b(e,(r,n,o)=>r[n]||=t(o))));l("&&=",(e,t)=>(J(e)||Fe("Invalid assignment target"),t=d(t),b(e,(r,n,o)=>r[n]&&=t(o))));l("??=",(e,t)=>(J(e)||Fe("Invalid assignment target"),t=d(t),b(e,(r,n,o)=>r[n]??=t(o))));ue("true",!0);ue("false",!1);ue("null",null);ce("undefined",200,()=>[]);ue("NaN",NaN);ue("Infinity",1/0);const Te=20;T("?",Te,(e,t,r)=>e&&(t=E(Te-1))&&Z(n=>n===58)&&(r=E(Te-1),["?",e,t,r]));l("?",(e,t,r)=>(e=d(e),t=d(t),r=d(r),n=>e(n)?t(n):r(n)));const hn=[],gn=20;$("=>",gn,!0);l("=>",(e,t)=>{e=e?.[0]==="()"?e[1]:e;const r=e?e[0]===","?e.slice(1):[e]:[];let n=-1,o=null;const i=r[r.length-1];Array.isArray(i)&&i[0]==="..."&&(n=r.length-1,o=i[1],r.length--);const s=t?.[0]==="{}";return t=d(s?["{",t[1]]:t),u=>(...c)=>{const h={};r.forEach((m,f)=>h[m]=c[f]),o&&(h[o]=c.slice(n));const A=new Proxy(h,{get:(m,f)=>f in m?m[f]:u?.[f],set:(m,f,O)=>((f in m?m:u)[f]=O,!0),has:(m,f)=>f in m||(u?f in u:!1)});try{const m=t(A);return s?void 0:m}catch(m){if(m===hn)return m[0];throw m}}});const mn=140;H("...",mn);l("...",e=>(e=d(e),t=>Object.entries(e(t))));const pt=170;T("?.",pt,(e,t)=>{if(!e)return;const r=B();return r===40?(w(),["?.()",e,E(0,41)||null]):r===91?(w(),["?.[]",e,E(0,93)]):(t=E(pt),t?["?.",e,t]:void 0)});l("?.",(e,t)=>(e=d(e),V(t)?()=>{}:r=>e(r)?.[t]));l("?.[]",(e,t)=>(e=d(e),t=d(t),r=>{const n=t(r);return V(n)?void 0:e(r)?.[n]}));l("?.()",(e,t)=>{const r=t?t[0]===","?(t=t.slice(1).map(d),o=>t.map(i=>i(o))):(t=d(t),o=>[t(o)]):()=>[];if(e[0]==="?."){const o=d(e[1]),i=e[2];return V(i)?()=>{}:s=>o(s)?.[i]?.(...r(s))}if(e[0]==="?.[]"){const o=d(e[1]),i=d(e[2]);return s=>{const u=o(s),c=i(s);return V(c)?void 0:u?.[c]?.(...r(s))}}if(e[0]==="."){const o=d(e[1]),i=e[2];return V(i)?()=>{}:s=>o(s)?.[i]?.(...r(s))}if(e[0]==="[]"&&e.length===3){const o=d(e[1]),i=d(e[2]);return s=>{const u=o(s),c=i(s);return V(c)?void 0:u?.[c]?.(...r(s))}}const n=d(e);return o=>n(o)?.(...r(o))});const ie=140;H("typeof",ie);H("void",ie);H("delete",ie);ce("new",ie,()=>Rr(".target")?(w(7),["new.target"]):["new",E(ie)]);l("typeof",e=>(e=d(e),t=>typeof e(t)));l("void",e=>(e=d(e),t=>(e(t),void 0)));l("delete",e=>{if(e[0]==="."){const t=d(e[1]),r=e[2];return n=>delete t(n)[r]}if(e[0]==="[]"){const t=d(e[1]),r=d(e[2]);return n=>delete t(n)[r(n)]}return()=>!0});l("new",e=>{const t=d(e?.[0]==="()"?e[1]:e),r=e?.[0]==="()"?e[2]:null,n=r?r[0]===","?(o=>i=>o.map(s=>s(i)))(r.slice(1).map(d)):(o=>i=>[o(i)])(d(r)):()=>[];return o=>new(t(o))(...n(o))});const nt=Symbol("accessor"),ot=20,yn=40,Mt=41,jt=123,Vt=125,Bt=e=>t=>{if(t)return;B();const r=Z(y.id);if(!r||(B(),g.charCodeAt(p)!==yn))return!1;w();const n=E(0,Mt);return B(),g.charCodeAt(p)!==jt?!1:(w(),[e,r,n,E(0,Vt)])};T("get",ot-1,Bt("get"));T("set",ot-1,Bt("set"));T("(",ot-1,e=>{if(!e||typeof e!="string")return;const t=E(0,Mt)||null;if(B(),g.charCodeAt(p)===jt)return w(),[":",e,["=>",["()",t],E(0,Vt)||null]]});l("get",(e,t)=>(t=t?d(t):()=>{},r=>[[nt,e,{get:function(){const n=Object.create(r||{});return n.this=this,t(n)}}]]));l("set",(e,t,r)=>(r=r?d(r):()=>{},n=>[[nt,e,{set:function(o){const i=Object.create(n||{});i.this=this,i[t]=o,r(i)}}]]));const $n=20,Ht=200;y.prop=e=>Tr(e)!==58;const An=e=>e==null||typeof e=="string"||[":",",","...","get","set"].includes(e[0]);qe("[]",Ht);qe("{}",Ht);$(":",$n-1,!0);l("{}",(e,t)=>{if(t!==void 0)return;if(!An(e))return d(["{",e]);e=e?e[0]!==","?[e]:e.slice(1):[];const r=e.map(n=>d(typeof n=="string"?[":",n,n]:n));return n=>{const o={},i={};for(const s of r.flatMap(u=>u(n)))if(s[0]===nt){const[,u,c]=s;i[u]={...i[u],...c,configurable:!0,enumerable:!0}}else o[s[0]]=s[1];for(const s in i)Object.defineProperty(o,s,i[s]);return o}});l("{",e=>(e=e?d(e):()=>{},t=>e(Object.create(t))));l(":",(e,t)=>(t=d(t),Array.isArray(e)?(e=d(e),r=>[[e(r),t(r)]]):r=>[[e,t(r)]]));const Sn=170,Ae=96,En=36,vn=123,In=92,Cn={n:`
|
|
8
|
+
`,r:"\r",t:" ",b:"\b",f:"\f",v:"\v"},ht=()=>{const e=[];for(let t="",r;(r=g.charCodeAt(p))!==Ae;)r?r===In?(w(),t+=Cn[g[p]]||g[p],w()):r===En&&g.charCodeAt(p+1)===vn?(t&&e.push([,t]),t="",w(2),e.push(E(0,125))):(t+=g[p],w(),r=g.charCodeAt(p),r===Ae&&t&&e.push([,t])):z("Unterminated template");return w(),e},wn=k[Ae];k[Ae]=(e,t)=>e&&t<Sn?y.asi&&y.newline?void 0:(w(),["``",e,...ht()]):e?wn?.(e,t):(w(),(r=>r.length<2&&r[0]?.[0]===void 0?r[0]||[,""]:["`",...r])(ht()));l("`",(...e)=>(e=e.map(d),t=>e.map(r=>r(t)).join("")));l("``",(e,...t)=>{e=d(e);const r=[],n=[];for(const i of t)Array.isArray(i)&&i[0]===void 0?r.push(i[1]):n.push(d(i));const o=Object.assign([...r],{raw:r});return i=>e(i)(o,...n.map(s=>s(i)))});y.string["'"]=!0;y.number={"0x":16,"0b":2,"0o":8};const Gt={log:(e,t)=>(t?console.log(t,e):console.log(e),e)};function N(e,t,r,n,o){const i=y(On(e));return d(i)({$form:t,$meta:r,$errors:n,$formIsInvalid:o,$log:Gt.log})===!0}function On(e){return e.replace(/\?\.(\d+)/g,"?.[$1]").replace(/\.(\d+)/g,"[$1]")}const L=e=>{let t=e.formDef.states;if(!t||Object.keys(t).length===0||e.formHealth.status==="errored")return e;const{$formIsInvalid:r,$errors:n}=Je(e);t=Dn(t);let o=[],i={status:"ok"};try{o=Object.keys(t).map(s=>{const u=t[s];let c;try{c=N(u,e.data,e.meta,n,r)}catch{c=!1}return c===!0?s:void 0}).filter(s=>s!==void 0)}catch(s){const u=s,c=ne.calculateCurrentStateError;i={status:"errored",message:`[${c}] ${u.message}`,code:c}}return{...e,currentStates:o,formHealth:i}};function Dn(e){const t={};function r(n){const o=n.split(":"),i=[];for(let s=0;s<o.length;s++)i.push(o.slice(0,s+1).join(":"));return i}for(const[n,o]of Object.entries(e)){const i=r(n),s=[];for(const u of i)e[u]&&s.push(`(${e[u]})`);t[n]=s.join(" && ")}return t}const Pe=Symbol("filterMap.skip");function it(e,t){const r=[];for(let n=0;n<e.length;n++){const o=t(e[n],n,e);o!==Pe&&r.push(o)}return r}function Fn(e,t,r){for(let n=0;n<e.length;n++)t(e[n],n,e)&&r(e[n],n,e)}function Kt(e,t,r,n){let o=n;for(let i=0;i<e.length;i++)t(e[i],i,e)&&(o=r(o,e[i],i,e));return o}function Xt(e,t,r){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(!r(e[n],t[n],n,e,t))return!1;return!0}function zt(e,t){const r=st(e.uid,t);return D(e)?{...e,uid:r,path:Pn(e.path,t)}:{...e,uid:r}}function st(e,t){if(t.length===0)throw new Error("Repeater indexes cannot be an empty array");const r=t.reduce((n,o)=>`${n}[${o}]`,"");return`${e}${r}`}function Pn(e,t){if(t.length===0)throw new Error("Repeater indexes cannot be an empty array");const r="items",n=e.split(`.${r}`),o=n.length-1;if(o!==t.length)throw new Error(`Path contains ${o} '${r}' occurrences, but ${t.length} indexes were provided.`);return n.reduce((i,s,u)=>u===0?s:`${i}.${t[u-1]}${s}`)}function re(e,t){let r=0;return e.replace(/\.items(\??)\./g,(n,o)=>{const i=t[r++];return i===void 0?n:`.${i}${o}.`})}const le=(e,t)=>r=>e(r)?t(r):r,K=e=>e!==void 0&&typeof e=="object"&&e!==null&&"when"in e,M=e=>{const{$formIsInvalid:t,$errors:r}=Je(e);return{...e,widgetFlags:{...Wn(e,r,t),...Tn(e,r,t)}}};function Wn(e,t,r){return it(Object.values(e.flatForm),n=>{if(n.uid?.includes("["))return Pe;if(Y(n)){const o=n({$form:e.data,errors:void 0,touched:void 0,translate:void 0});return o.uid=n.uid,o}return n}).filter(n=>!!(n.include&&("in"in n.include||"when"in n.include)||n.exclude&&("from"in n.exclude||"when"in n.exclude)||(D(n)||Q(n))&&K(n.disabled)||D(n)&&K(n.readonly))).reduce((n,o)=>(n[o.uid]=n[o.uid]||{},o.include&&"in"in o.include?n[o.uid].hidden=!o.include.in.some(i=>e.currentStates.includes(i)):o.include&&"when"in o.include&&(n[o.uid].hidden=!N(o.include.when,e.data,e.meta,t,r)),o.exclude&&"from"in o.exclude?n[o.uid].hidden=o.exclude.from.some(i=>e.currentStates.includes(i)):o.exclude&&"when"in o.exclude&&(n[o.uid].hidden=N(o.exclude.when,e.data,e.meta,t,r)),(D(o)||Q(o))&&K(o.disabled)&&(n[o.uid].disabled=N(o.disabled.when,e.data,e.meta,t,r)),D(o)&&K(o.readonly)&&(n[o.uid].readonly=N(o.readonly.when,e.data,e.meta,t,r)),n),{})}function Tn(e,t,r){return Kt(Object.values(e.flatForm),n=>!Y(n)&&n.type==="repeater",(n,o)=>({...n,...Jt(e,o,[],t,r)}),{})}function Jt(e,t,r,n,o){const i=t.props.template,s=R(e.data,t.path);if(!Array.isArray(s))return{};const u={};return s.forEach((c,h)=>{const A=[...r,h];ze([i]).forEach(m=>{let f;if(Y(m)?(f=m({$form:e.data,errors:void 0,touched:void 0,translate:void 0}),f.uid=m.uid):f=m,f.type==="repeater"){const ee=zt(f,A);Object.assign(u,Jt(e,ee,A,n,o));return}const O=st(f.uid,A);u[O]=u[O]||{},f.include&&"in"in f.include?u[O].hidden=!f.include.in.some(ee=>e.currentStates.includes(ee)):f.include&&"when"in f.include&&(u[O].hidden=!N(re(f.include.when,A),e.data,e.meta,n,o)),f.exclude&&"from"in f.exclude?u[O].hidden=f.exclude.from.some(ee=>e.currentStates.includes(ee)):f.exclude&&"when"in f.exclude&&(u[O].hidden=N(re(f.exclude.when,A),e.data,e.meta,n,o)),(D(f)||Q(f))&&K(f.disabled)&&(u[O].disabled=N(re(f.disabled.when,A),e.data,e.meta,n,o)),D(f)&&K(f.readonly)&&(u[O].readonly=N(re(f.readonly.when,A),e.data,e.meta,n,o))})}),u}const U=e=>t=>({...t,calculatedWidgets:Rn(t,e)});function Rn(e,t){const{$formIsInvalid:r,$errors:n}=Je(e),o=qn(e,t,r,n),i={};for(const s of Object.keys(e.calculatedWidgets)){if(e.widgetFlags[s]?.hidden)continue;const u=e.calculatedWidgets[s],c=u.source;if(Y(c)){i[s]=kn(s,c,e,t);continue}i[s]=_n(u,c,e,o)}return i}function kn(e,t,r,n){const o=t({$form:r.data,errors:t.path?r.validations[t.path]:void 0,touched:t.path?r.touchedControls[t.path]:void 0,translate:n.translate});return o.uid=e,{source:t,current:o}}function _n(e,t,r,n){const o=new Qn(t,e.current);return o.write("uid",t.uid),o.write("type",t.type),o.write("kind",t.kind),$t(t)?Un(o,n):Q(t)?Nn(o,n):D(t)?Ln(o,n):fe(t)&&Mn(o,n),jn(t,o,n,r),(Q(t)||D(t))&&Vn(t,o,n),fe(t)&&Bn(t,o,r),o.changed?{source:e.source,current:o.current}:e}function Un(e,t){v(e,t,"size"),v(e,t,"include"),v(e,t,"exclude")}function Nn(e,t){v(e,t,"size"),v(e,t,"include"),v(e,t,"exclude"),v(e,t,"label"),v(e,t,"disabled")}function Ln(e,t){v(e,t,"size"),v(e,t,"include"),v(e,t,"exclude"),v(e,t,"label"),v(e,t,"disabled"),v(e,t,"readonly"),v(e,t,"validator"),v(e,t,"path"),v(e,t,"defaultValue")}function Mn(e,t){v(e,t,"size"),v(e,t,"include"),v(e,t,"exclude")}function jn(e,t,r,n){const o=n.widgetPropOverrides[e.uid]??{},i={...e.props??{},...o};for(const s of xt(Object.keys(i)))Hn(t,r,s)}function Vn(e,t,r){const n=e.on??{};for(const o of xt(Object.keys(n)))Gn(t,r,o)}function Bn(e,t,r){const n=Zn(e.uid),o=Yn(e.children,n,r.widgetFlags);t.current.children=o;const i=t.previous.children??[];i.length===o.length&&o.every((u,c)=>i[c]&&i[c].uid===o[c].uid)||t.markChanged()}function v(e,t,r){const n=e.source;if(!xn(n,r))return;const o=ut(n,r,t.sortedStates);let i;switch(r){case"disabled":case"readonly":i=Xn(o,t,e.source.uid,r);break;default:i=qt(o,t)}e.write(r,i)}function Hn(e,t,r){const n=e.source.props,o=ut(n,r,t.sortedStates);let i=qt(o,t);const s=t.widgetPropOverrides[e.source.uid]?.[r];s!==void 0&&(i=s),e.write(`props.${r}`,i)}function Gn(e,t,r){const n=e.source.on,o=ut(n,r,t.sortedStates);e.write(`on.${r}`,zn(o,t))}function dt(e,t){return e({$form:t.$form,translate:t.localization.translate})}function Kn(e,t){return t.localization.translate(e.key,Jn(e.params,t),e.default)}function Qt(e,t){return Pr(e,{resolveFormPath:r=>R(t.$form,r)??e,resolveMetaPath:r=>R(t.$meta,r)??e,resolveErrorsPath:r=>R(t.$errors,r)??e,resolveFormIsInvalid:()=>String(t.$formIsInvalid)})}function qt(e,t){return typeof e=="function"?dt(e,t):mt(e)?Kn(e,t):typeof e=="string"?Qt(e,t):e}function Xn(e,t,r,n){return typeof e=="function"?dt(e,t):K(e)?t.widgetFlags[r]?.[n]:typeof e=="string"?Qt(e,t):e}function zn(e,t){return typeof e=="function"?dt(e,t):e}function ut(e,t,r){if(e){for(const n of r){const o=e[`${t}.${n}`];if(o!==void 0)return o}return e[t]}}function Jn(e,t){return e&&Object.keys(e).reduce((r,n)=>{const o=String(e[n]);return Or(o)?r[n]=Wr(o,{resolveFormPath:i=>R(t.$form,i)??o,resolveMetaPath:i=>R(t.$meta,i)??o,resolveErrorsPath:i=>R(t.$errors,i)??o,resolveFormIsInvalid:()=>t.$formIsInvalid}):r[n]=o,r},{})}class Qn{constructor(t,r){this._changed=!1,this.source=t,this.previous=r,this.current={}}get changed(){return this._changed}markChanged(){this._changed=!0}write(t,r){Oe(this.current,t,r),R(this.previous,t)!==r&&(this._changed=!0)}}function qn(e,t,r,n){return{sortedStates:[...e.currentStates].sort((o,i)=>i.length-o.length),widgetPropOverrides:e.widgetPropOverrides,widgetFlags:e.widgetFlags,$form:e.data,$meta:e.meta,$formIsInvalid:r,$errors:n,localization:t}}function xn(e,t){if(t in e)return!0;const r=`${t}.`;return Object.keys(e).some(n=>n.startsWith(r))}function xt(e){return Array.from(new Set(e.map(t=>t.split(".")[0])))}function Yn(e,t,r){const n=t.map(o=>`[${o}]`).join("");return e.filter(o=>{const i=o.uid+n,s=r[i];return!s||s.hidden!==!0})}const Zn=e=>[...e.matchAll(/\[(\d+)\]/g)].map(t=>parseInt(t[1],10)),bn=({lang:e},t)=>{const r={...He(e),formName:t.payload.formName};let n=t.payload.formDef,o={status:"ok"};if(typeof n=="string"){try{n=JSON.parse(n)}catch(u){const c=u,h=ne.initializeParseError;o={status:"errored",message:`[${h}] ${c.message}`,code:h}}if(o.status==="errored")return{...r,formHealth:o}}if(Array.isArray(n.form)){const u=n,c=u.form;u.form={uid:"",type:"flex",kind:"layout",children:c}}const i=Be.decode(n);if(i.isOk()){o={status:"ok"};let u={};try{u=ze([i.value.form]).reduce((c,h)=>{const A=h.uid;if(c[A])throw{existingWidget:c[A],newWidget:h};return c[A]=h,c},{})}catch(c){const h=ne.initializeUidCollisionError;o={status:"errored",message:`[${h}] ${eo(c.existingWidget,c.newWidget)}`,code:h},u={}}return{...r,formDef:i.value,flatForm:u,formHealth:o}}const s=ne.initializeUnknownError;return{...r,formHealth:{status:"errored",message:`[${s}] ${i.error}`,code:s}}};function eo(e,t){const r=n=>D(n)?` at "${n.path}"`:"";return`Duplicate UID "${t.uid}": Assigned to widget "${e.type}"${r(e)} and "${t.type}"${r(t)}.`}function to(e,t){return{...e,injectedValidations:{...e.injectedValidations,[t.payload.path]:t.payload.issues}}}const ro=(e,{payload:t})=>{let r;if("path"in t){if(r=Object.values(e.calculatedWidgets).find(({source:i})=>D(i)&&i.path===t.path),!r)return console.warn(`Input with path "${t.path}" not found`),e}else if(r=e.calculatedWidgets[t.uid],!r)return console.warn(`Widget with uid "${t.uid}" not found`),e;const n=r.source.uid,o=e.widgetPropOverrides[n]||{};return{...e,widgetPropOverrides:{...e.widgetPropOverrides,[n]:{...o,[t.prop]:t.value}}}};function no(e,t){return{...e,widgetFlags:{...te(e.widgetFlags,t.payload.uid)},calculatedWidgets:{...te(e.calculatedWidgets,t.payload.uid)},widgetPropOverrides:{...te(e.widgetPropOverrides,t.payload.uid)},touchedControls:{..._(e.touchedControls,r=>{const n=e.flatForm[t.payload.uid];return n&&D(n)?te(r,n.path):r})}}}const oo=(e,t)=>({...e,data:{...t.payload.data}}),io=(e,t)=>({...e,formHealth:t.payload.formHealth}),so=(e,t)=>({...e,lang:t.payload.lang}),uo=(e,t)=>({...e,meta:{...t.payload.meta}}),co=(e,t)=>{const r=R(e.data,t.payload.path);return t.type==="SET_WIDGET_DATA"||t.type==="SET_WIDGET_INITIAL_DATA"&&r===void 0?{...e,data:{...Oe(e.data,t.payload.path,t.payload.data)}}:e},Re=(e,t)=>r=>{const n=it(Object.values(r.calculatedWidgets),({current:i})=>D(i)?i:Pe),o=r.validations;return{...r,validations:n.reduce((i,s)=>{if(i[s.path]=null,s.validator){const u=e(s.validator,t),c=R(r.data,s.path),h=St(u,c);i[s.path]=Et(h)?null:h.issues.map(A=>A.message)}return Array.isArray(i[s.path])&&Array.isArray(o[s.path])&&Xt(i[s.path],o[s.path],(u,c)=>u===c)&&(i[s.path]=o[s.path]),i},{})}},lo=({validators:e,validateOn:t,localization:r})=>(n,o)=>{switch(o.type){case"INITIALIZE":return bn(n,o);case"SET_DATA":return _(oo(n,o),L,M,U(r));case"SET_META":return _(uo(n,o),L,M,U(r));case"SET_LANGUAGE":return _(so(n,o),U(r));case"ADD_WIDGET":return _(Cr(n,o),le(ke,L),le(ke,M),le(ke,U(r)));case"REMOVE_WIDGET":return _(no(n,o),L,M,U(r));case"SET_WIDGET_INITIAL_DATA":case"SET_WIDGET_DATA":return _(co(n,o),L,M,U(r));case"OVERRIDE_WIDGET_PROP":return _(ro(n,o),L,M,U(r),le(i=>{let s=!1,u="";"path"in o.payload?(s=!0,u=o.payload.path):D(i.calculatedWidgets[o.payload.uid].current)&&(s=!0,u=i.calculatedWidgets[o.payload.uid].current.path);const c=s&&i.touchedControls[u];return i.touched&&c},Re(e,r)));case"SET_FORM_HEALTH":return io(n,o);case"VALIDATE_ALL":return _({...n,touched:!0,touchedControls:Object.keys(n.calculatedWidgets).reduce((i,s)=>{const u=n.calculatedWidgets[s].source;return D(u)&&(i[u.path]=!0),i},{})},Re(e,r),L,M,U(r));case"ATTEMPT_VALIDATION":{const i=o.payload.reason,s=o.payload.path;return t==="eager"||i===t||t.includes(i)?_({...n,touched:!0,touchedControls:{...n.touchedControls,[s]:!0}},Re(e,r),L,M,U(r),c=>{const h=o.payload.uid,A=c.calculatedWidgets[h],m=A.source;if(Y(m)){const f=m({$form:c.data,errors:c.validations[s],touched:!0,translate:r.translate});return{...c,calculatedWidgets:{...c.calculatedWidgets,[h]:{source:A.source,current:f}}}}return c}):n}case"INJECT_VALIDATION_ISSUES":return to(n,o);default:return vr(o)}},ke=e=>e.formHealth.status==="ok";function Yt(e=[],t,r,n){const o=new a.BehaviorSubject(He(n.lang)),i=o.asObservable().pipe(a.distinctUntilChanged()),s=lo({validators:t,validateOn:r,localization:n});function u(m){const f=o.getValue(),O=s(f,m);o.next(O)}let c=u;const h={getState:()=>o.getValue(),dispatch:m=>c(m)};return c=e.map(m=>m(h)).reduceRight((m,f)=>f(m),u),{state$:i,dispatch:c,getState:()=>o.getValue()}}class ao{constructor(){this.widgetRegistry=new pe,this.store={},this.events$=new a.Subject,this.uuid=crypto.randomUUID(),this.itemRenderers={},this.dependencies={}}initialize(t,r=[],n,o,i,s=yt(),u){this.localization=s,this.dependencies=u,this.widgetRegistry.setWidgetLoaders(t),this.itemRenderers=i,this.store=Yt(r,n,o,s)}emitEvent(t,r,n){const i=this.store.getState().currentStates.filter(s=>r.on?.[`${t}.${s}`]!==void 0);if(i.length>0)i.forEach(s=>{const u=r.on?.[`${t}.${s}`];this.attemptValidation(t,u,r),u&&this.events$.next({name:u,data:this.store.getState().data,detail:n??void 0,callback:c=>{this.store.dispatch(c)}})});else{const s=r.on?.[t];this.attemptValidation(t,s,r),s&&this.events$.next({name:s,data:this.store.getState().data,detail:n,callback:u=>{this.store.dispatch(u)}})}}attemptValidation(t,r,n){n.kind!=="layout"&&(t==="change"?this.store.dispatch({type:"ATTEMPT_VALIDATION",payload:{reason:"change",path:n.path,uid:n.uid}}):t==="click"&&r==="submit"&&this.store.dispatch({type:"VALIDATE_ALL"}))}}function fo(e="GolemUI Form Store"){return t=>{const n=(typeof window<"u"?window.__REDUX_DEVTOOLS_EXTENSION__:void 0)?.connect({name:e});return n?.init(t.getState()),o=>i=>{o(i),n&&n.send(i,t.getState())}}}const po=a.pipe(a.map(e=>e.data),a.distinctUntilChanged()),ho=e=>a.pipe(po,a.map(t=>R(t,e)),a.distinctUntilChanged()),go=a.pipe(a.filter(e=>e.touched===!0),a.map(e=>e.validations),a.distinctUntilChanged()),mo=e=>a.pipe(go,a.map(t=>t[e]),a.distinctUntilChanged()),yo=a.pipe(a.filter(e=>e.touched===!0),a.map(e=>e.injectedValidations),a.distinctUntilChanged()),$o=e=>a.pipe(yo,a.map(t=>t[e]),a.distinctUntilChanged(),a.startWith(null)),Ao=a.pipe(a.map(e=>e.lang),a.distinctUntilChanged()),Zt=a.pipe(a.map(e=>e.calculatedWidgets),a.distinctUntilChanged()),So=e=>t=>a.combineLatest([t.pipe(Ao),t.pipe(Zt)]).pipe(a.map(([r,n])=>({lang:r,widget:n[e]})),a.filter(r=>r.widget!==void 0),a.distinctUntilChanged((r,n)=>r.lang===n.lang&&r.widget===n.widget),a.map(r=>r.widget.current)),Eo=e=>a.pipe(Zt,a.map(t=>t[e]),a.filter(t=>t!==void 0),a.map(t=>t.current.children),a.distinctUntilChanged()),bt=a.pipe(a.map(e=>e.widgetFlags),a.distinctUntilChanged()),vo=e=>a.pipe(bt,a.map(t=>t[e]),a.distinctUntilChanged()),Io=a.pipe(a.map(e=>e.touchedControls),a.distinctUntilChanged()),Co=e=>a.pipe(Io,a.map(t=>t[e]),a.distinctUntilChanged()),wo=a.pipe(a.map(e=>e.formHealth),a.distinctUntilChanged((e,t)=>!(e.status!==t.status||e.status==="errored"))),Oo=e=>e.pipe(wo);let er=!1;function Do(){er=!0}function tr(){return er}function Fo(e,t,r){if(!tr())return;const n=Object.keys(t??{}).filter(o=>o in r);if(n.length>0)throw new Error(`[GolemUI] Widget "${e}": prop keys [${n.join(", ")}] collide with widget fields`)}exports.Debug=Gt;exports.FormContext=ao;exports.SKIP=Pe;exports.WidgetRegistry=pe;exports.assertNoPropCollisions=Fo;exports.calculatedLayoutChildrenByUid$=Eo;exports.calculatedWidgetsByUid$=So;exports.cloneObject=Ne;exports.compose=Ir;exports.createFormStore=Yt;exports.createInitialState=He;exports.dataByPath$=ho;exports.defineForm=ar;exports.deleteKey=te;exports.devToolsMiddleware=fo;exports.enableDevMode=Do;exports.errorCodes=ne;exports.filterMap=it;exports.filterReduce=Kt;exports.filterTap=Fn;exports.formDefDecoder=Be;exports.formHealth=Oo;exports.get=R;exports.getDirectionFromLanguage=fr;exports.identityTranslator=yt;exports.injectedValidationByPath$=$o;exports.isActionWidget=Q;exports.isDevMode=tr;exports.isDisplayWidget=$t;exports.isFunctionWidget=Y;exports.isInputWidget=D;exports.isLayoutWidget=fe;exports.isStandardValidateSuccess=Et;exports.isTranslationConfig=mt;exports.layoutWidgetDecoder=we;exports.makeRepeaterItemConfig=zt;exports.pipe=_;exports.selectWidgetFlags=bt;exports.set=Oe;exports.shortUUID=Ge;exports.standardValidate=St;exports.toRepeaterItemUid=st;exports.touchedControlsByPath$=Co;exports.transformRepeaterItemWhenExpression=re;exports.validationByPath$=mo;exports.widgetFlagsByUid$=vo;exports.zipEvery=Xt;
|
package/internals.d.ts
ADDED
package/internals.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import { NonFunctionWidget } from '../form-widget';
|
|
2
|
+
/**
|
|
3
|
+
* @internal Framework adapter contract — not part of the end-user public API.
|
|
4
|
+
*/
|
|
2
5
|
export type WidgetLoaders<ComponentType, Widget extends string = NonFunctionWidget['type']> = Record<Widget, () => Promise<ComponentType>>;
|
|
3
6
|
export declare class WidgetRegistry<ComponentType> {
|
|
4
7
|
/**
|
package/lib/form-widget.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
+
import { Decoder } from 'ts.data.json';
|
|
1
2
|
import { Localizable } from './i18n';
|
|
2
3
|
import { DotPath, FunctionWidgetParams, ReactiveExpression, Uid, UiState, WidgetPropertyFunction } from './shared';
|
|
3
4
|
import { AllSuffixable, SomeSuffixable } from './utils/suffixable';
|
|
4
|
-
import * as jd from 'ts.data.json';
|
|
5
5
|
/**
|
|
6
6
|
* The widget type identifier used to resolve the corresponding UI component from the registry.
|
|
7
7
|
* Examples: 'textinput', 'textarea', 'password', 'flex', 'grid', 'heading', 'markdown', 'alert'
|
|
@@ -90,5 +90,5 @@ export declare const isActionWidget: <StateKeys extends string, FormType extends
|
|
|
90
90
|
export declare const isInputWidget: <T, StateKeys extends string, FormType extends Record<string, any> = any>(widget: FormWidget<StateKeys, FormType>) => widget is InputWidget<T, StateKeys, FormType>;
|
|
91
91
|
export declare const isLayoutWidget: <StateKeys extends string, FormType extends Record<string, any> = any>(widget: FormWidget<StateKeys, FormType>) => widget is LayoutWidget<StateKeys, FormType>;
|
|
92
92
|
export declare const isFunctionWidget: <StateKeys extends string, FormType extends Record<string, any> = any>(widget: FormWidget<StateKeys, FormType>) => widget is FunctionWidget<StateKeys, FormType>;
|
|
93
|
-
export declare const layoutWidgetDecoder:
|
|
93
|
+
export declare const layoutWidgetDecoder: Decoder<LayoutWidget<string, any, any, LayoutChildren<string, any>>>;
|
|
94
94
|
export {};
|
package/lib/form.d.ts
CHANGED
|
@@ -5,7 +5,6 @@ import { ItemRenderer } from './item-renderer';
|
|
|
5
5
|
import { ReactiveExpression, UiState, ValidateOn } from './shared';
|
|
6
6
|
import { Action } from './store/actions';
|
|
7
7
|
import { Middleware, State } from './store/model';
|
|
8
|
-
import * as jd from 'ts.data.json';
|
|
9
8
|
export type Form<StateKeys extends UiState = never, FormType extends Record<string, any> = any> = {
|
|
10
9
|
states?: Record<StateKeys, ReactiveExpression>;
|
|
11
10
|
form: LayoutWidget<StateKeys, FormType>;
|
|
@@ -31,7 +30,7 @@ export interface FormInitConfig<ComponentType = unknown> {
|
|
|
31
30
|
data?: Record<string, any>;
|
|
32
31
|
meta?: Record<string, any>;
|
|
33
32
|
}
|
|
34
|
-
export declare const formDefDecoder:
|
|
33
|
+
export declare const formDefDecoder: import('ts.data.json').Decoder<{
|
|
35
34
|
states: {
|
|
36
35
|
[K: string]: string;
|
|
37
36
|
} | undefined;
|
package/lib/store/model.d.ts
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
|
+
import { Form } from '../form';
|
|
2
|
+
import { FormWidget, FunctionWidget } from '../form-widget';
|
|
1
3
|
import { DotPath, Uid, ValidationStatus } from '../shared';
|
|
2
|
-
import * as Form from '../form';
|
|
3
|
-
import * as Widget from '../form-widget';
|
|
4
4
|
export type State = {
|
|
5
5
|
formName: string;
|
|
6
6
|
/**
|
|
7
7
|
* The complete form definition.
|
|
8
8
|
*/
|
|
9
|
-
formDef: Form
|
|
9
|
+
formDef: Form<string>;
|
|
10
10
|
/**
|
|
11
11
|
* Flattened representation of `formDef` as a map from UID to widget definition.
|
|
12
12
|
* Enables more efficient lookup and processing in downstream operations.
|
|
13
13
|
*/
|
|
14
|
-
flatForm: Record<Uid,
|
|
14
|
+
flatForm: Record<Uid, FormWidget<string>>;
|
|
15
15
|
/**
|
|
16
16
|
* List of states computed for the current form state.
|
|
17
17
|
*/
|
|
@@ -20,7 +20,7 @@ export type State = {
|
|
|
20
20
|
* Tracks widgets whose components have been rendered.
|
|
21
21
|
* A widget is added when its component mounts and removed when it unmounts.
|
|
22
22
|
*/
|
|
23
|
-
calculatedWidgets: Record<Uid, DerivedWidget<
|
|
23
|
+
calculatedWidgets: Record<Uid, DerivedWidget<FormWidget<string>>>;
|
|
24
24
|
/**
|
|
25
25
|
* Validations statuses derived from the schema validators expressed declaratively.
|
|
26
26
|
*
|
|
@@ -108,9 +108,9 @@ export type FormHealth = {
|
|
|
108
108
|
* recently computed, fully resolved widget. Reference identity is used for
|
|
109
109
|
* change detection: a new object is created only when a property has changed.
|
|
110
110
|
*/
|
|
111
|
-
export type DerivedWidget<F extends
|
|
111
|
+
export type DerivedWidget<F extends FormWidget<string>> = {
|
|
112
112
|
/** The source widget from which the derived value is computed */
|
|
113
113
|
source: F;
|
|
114
114
|
/** The most recently computed, fully resolved widget */
|
|
115
|
-
current: Exclude<F,
|
|
115
|
+
current: Exclude<F, FunctionWidget<string>>;
|
|
116
116
|
};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
+
import { INITIALIZE } from '../actions';
|
|
1
2
|
import { State } from '../model';
|
|
2
|
-
|
|
3
|
-
export declare const initialize: ({ lang }: State, action: Actions.INITIALIZE) => State;
|
|
3
|
+
export declare const initialize: ({ lang }: State, action: INITIALIZE) => State;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
+
import { OVERRIDE_WIDGET_PROP } from '../actions';
|
|
1
2
|
import { State } from '../model';
|
|
2
|
-
|
|
3
|
-
export declare const overrideWidgetProp: (state: State, { payload }: Actions.OVERRIDE_WIDGET_PROP) => State;
|
|
3
|
+
export declare const overrideWidgetProp: (state: State, { payload }: OVERRIDE_WIDGET_PROP) => State;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
+
import { SET_DATA } from '../actions';
|
|
1
2
|
import { State } from '../model';
|
|
2
|
-
|
|
3
|
-
export declare const setData: (state: State, action: Actions.SET_DATA) => State;
|
|
3
|
+
export declare const setData: (state: State, action: SET_DATA) => State;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
+
import { SET_FORM_HEALTH } from '../actions';
|
|
1
2
|
import { State } from '../model';
|
|
2
|
-
import * as Actions from '../actions';
|
|
3
3
|
/**
|
|
4
4
|
* Updates the operational state of the form.
|
|
5
5
|
* This reflects whether the form is currently functioning normally
|
|
6
6
|
* or is in an errored state.
|
|
7
7
|
*/
|
|
8
|
-
export declare const setFormHealth: (state: State, action:
|
|
8
|
+
export declare const setFormHealth: (state: State, action: SET_FORM_HEALTH) => State;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
+
import { SET_LANGUAGE } from '../actions';
|
|
1
2
|
import { State } from '../model';
|
|
2
|
-
|
|
3
|
-
export declare const setLanguage: (state: State, action: Actions.SET_LANGUAGE) => State;
|
|
3
|
+
export declare const setLanguage: (state: State, action: SET_LANGUAGE) => State;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
+
import { SET_META } from '../actions';
|
|
1
2
|
import { State } from '../model';
|
|
2
|
-
|
|
3
|
-
export declare const setMeta: (state: State, action: Actions.SET_META) => State;
|
|
3
|
+
export declare const setMeta: (state: State, action: SET_META) => State;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
+
import { SET_WIDGET_DATA, SET_WIDGET_INITIAL_DATA } from '../actions';
|
|
1
2
|
import { State } from '../model';
|
|
2
|
-
|
|
3
|
-
export declare const setWidgetData: (state: State, action: Actions.SET_WIDGET_DATA | Actions.SET_WIDGET_INITIAL_DATA) => State;
|
|
3
|
+
export declare const setWidgetData: (state: State, action: SET_WIDGET_DATA | SET_WIDGET_INITIAL_DATA) => State;
|
package/lib/utils/decoder.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { Decoder } from 'ts.data.json';
|
|
2
2
|
export type KeySpec<A> = Record<string, {
|
|
3
3
|
suffixed?: boolean;
|
|
4
|
-
decoder:
|
|
4
|
+
decoder: Decoder<A>;
|
|
5
5
|
}>;
|
|
6
6
|
/**
|
|
7
7
|
* Creates a JSON decoder for objects whose keys are validated against a
|
|
@@ -48,4 +48,4 @@ export type KeySpec<A> = Record<string, {
|
|
|
48
48
|
* });
|
|
49
49
|
* ```
|
|
50
50
|
*/
|
|
51
|
-
export declare function objectWithSuffix<T extends Record<string, any>>(specs: KeySpec<any>, decoderName: string):
|
|
51
|
+
export declare function objectWithSuffix<T extends Record<string, any>>(specs: KeySpec<any>, decoderName: string): Decoder<T>;
|
package/lib/utils/form.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import { FormWidget } from '../form-widget';
|
|
1
2
|
import { $Errors, DotPath } from '../shared';
|
|
2
3
|
import { State } from '../store/model';
|
|
3
|
-
import * as Widget from '../form-widget';
|
|
4
4
|
/**
|
|
5
5
|
* Expression Scopes define the root namespaces accessible within
|
|
6
6
|
* reactive expressions and template strings.
|
|
@@ -68,7 +68,7 @@ export declare const resolveScopedPath: (variable: string, resolvers: ScopedPath
|
|
|
68
68
|
* // Result: [firstName, layout, street, city]
|
|
69
69
|
* ```
|
|
70
70
|
*/
|
|
71
|
-
export declare function flattenForm(widgets:
|
|
71
|
+
export declare function flattenForm(widgets: FormWidget[]): FormWidget[];
|
|
72
72
|
/**
|
|
73
73
|
* Calculates validation variables to be used in reactive expressions
|
|
74
74
|
* e.g. `{ invalidAge: '!!$errors.age' }` or { disabled { when: '$formIsInvalid' } }
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@golemui/core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.13.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./index.umd.cjs",
|
|
6
6
|
"module": "./index.js",
|
|
@@ -10,6 +10,11 @@
|
|
|
10
10
|
"types": "./index.d.ts",
|
|
11
11
|
"import": "./index.js",
|
|
12
12
|
"require": "./index.umd.cjs"
|
|
13
|
+
},
|
|
14
|
+
"./internals": {
|
|
15
|
+
"types": "./internals.d.ts",
|
|
16
|
+
"import": "./internals.js",
|
|
17
|
+
"require": "./internals.umd.cjs"
|
|
13
18
|
}
|
|
14
19
|
},
|
|
15
20
|
"files": [
|
|
@@ -17,6 +22,9 @@
|
|
|
17
22
|
"index.d.ts",
|
|
18
23
|
"index.js",
|
|
19
24
|
"index.umd.cjs",
|
|
25
|
+
"internals.d.ts",
|
|
26
|
+
"internals.js",
|
|
27
|
+
"internals.umd.cjs",
|
|
20
28
|
"*.md"
|
|
21
29
|
],
|
|
22
30
|
"dependencies": {
|