@cyclone-ui/state 0.0.4 → 0.0.6

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.
@@ -1 +1 @@
1
- const e=require("../utilities/is-atom.cjs"),t=require("./base-atom.cjs");let n=require("@stryke/type-checks/is-function");function r(r,i){let a=e.isAtom(i)?i:t.baseAtom(i),o=new Set,s=typeof BroadcastChannel>`u`?void 0:new BroadcastChannel(r);s&&(s.onmessage=e=>{for(let t of o)t(e)});let c=t.baseAtom(e=>e(a),(e,t,r)=>{t(a,(0,n.isFunction)(r.value)?r.value(e(a)):r.value),!r.isEvent&&s&&s.postMessage(JSON.stringify(e(a)))});return c.onMount=e=>{let t=t=>{e({isEvent:!0,value:JSON.parse(t.data)})};return o.add(t),()=>{o.delete(t)}},t.baseAtom(e=>e(c),(e,t,n)=>{t(c,{isEvent:!1,value:n})})}exports.atomWithBroadcast=r;
1
+ const e=require("../utilities/is-atom.cjs"),t=require("./base-atom.cjs");let n=require("@stryke/type-checks/is-function");function r(r,i){let a=e.isAtom(i)?i:t.baseAtom(i),o=/* @__PURE__ */ new Set,s=typeof BroadcastChannel>`u`?void 0:new BroadcastChannel(r);s&&(s.onmessage=e=>{for(let t of o)t(e)});let c=t.baseAtom(e=>e(a),(e,t,r)=>{t(a,(0,n.isFunction)(r.value)?r.value(e(a)):r.value),!r.isEvent&&s&&s.postMessage(JSON.stringify(e(a)))});return c.onMount=e=>{let t=t=>{e({isEvent:!0,value:JSON.parse(t.data)})};return o.add(t),()=>{o.delete(t)}},t.baseAtom(e=>e(c),(e,t,n)=>{t(c,{isEvent:!1,value:n})})}exports.atomWithBroadcast=r;
@@ -1,2 +1,2 @@
1
- import{isAtom as e}from"../utilities/is-atom.mjs";import{baseAtom as t}from"./base-atom.mjs";import{isFunction as n}from"@stryke/type-checks/is-function";function r(r,i){let a=e(i)?i:t(i),o=new Set,s=typeof BroadcastChannel>`u`?void 0:new BroadcastChannel(r);s&&(s.onmessage=e=>{for(let t of o)t(e)});let c=t(e=>e(a),(e,t,r)=>{t(a,n(r.value)?r.value(e(a)):r.value),!r.isEvent&&s&&s.postMessage(JSON.stringify(e(a)))});return c.onMount=e=>{let t=t=>{e({isEvent:!0,value:JSON.parse(t.data)})};return o.add(t),()=>{o.delete(t)}},t(e=>e(c),(e,t,n)=>{t(c,{isEvent:!1,value:n})})}export{r as atomWithBroadcast};
1
+ import{isAtom as e}from"../utilities/is-atom.mjs";import{baseAtom as t}from"./base-atom.mjs";import{isFunction as n}from"@stryke/type-checks/is-function";function r(r,i){let a=e(i)?i:t(i),o=/* @__PURE__ */ new Set,s=typeof BroadcastChannel>`u`?void 0:new BroadcastChannel(r);s&&(s.onmessage=e=>{for(let t of o)t(e)});let c=t(e=>e(a),(e,t,r)=>{t(a,n(r.value)?r.value(e(a)):r.value),!r.isEvent&&s&&s.postMessage(JSON.stringify(e(a)))});return c.onMount=e=>{let t=t=>{e({isEvent:!0,value:JSON.parse(t.data)})};return o.add(t),()=>{o.delete(t)}},t(e=>e(c),(e,t,n)=>{t(c,{isEvent:!1,value:n})})}export{r as atomWithBroadcast};
2
2
  //# sourceMappingURL=atom-with-broadcast.mjs.map
@@ -1 +1 @@
1
- let e=require("jotai/vanilla"),t=require("@stryke/helpers/is-equal");function n(n){let r=(0,e.atom)(0),i=(0,e.atom)(()=>({inProgress:0,mounted:!1,promise:void 0,pendingError:void 0,cleanup:void 0,fromCleanup:!1,isRecursing:!1,isRefreshing:!1,get:(()=>{}),set:(()=>{})}),(e,t)=>{let n=e(i);return Object.assign(n,{mounted:!0,get:e,set:t}),t(r,e=>e+1),()=>{n.mounted=!1,l(n),u(n)}});i.onMount=e=>e();let a=(0,e.atom)(async e=>{e(r);let a=e(i);if(!a.mounted||a.isRecursing||a.inProgress&&!a.isRefreshing)return a.promise;u(a);let o=new Map,s=t=>{let n=e(t);return o.set(t,n),n};s.peek=e=>a.get(e);let d=(...t)=>{try{return++a.inProgress,a.set(...t)}finally{Array.from(o.keys(),e),--a.inProgress}};d.recurse=(n,...r)=>{if(a.fromCleanup){if(process.env.NODE_ENV!==`production`)throw Error(`set.recurse is not allowed in cleanup`);return}try{return a.isRecursing=!0,a.set(n,...r)}finally{a.isRecursing=!1,Array.from(o).some(([n,r])=>!(0,t.isEqual)(e(n),r))&&c(a)}},++a.inProgress;function f(){try{if(a.isRefreshing=!1,!a.mounted)return;l(a),a.cleanup=n(s,d)}catch(e){a.pendingError=e,c(a)}finally{a.promise=void 0,--a.inProgress}}return a.isRefreshing?f():a.promise=Promise.resolve().then(f)});if(process.env.NODE_ENV!==`production`){function o(e,t){Object.defineProperty(e,"debugLabel",{get:()=>`${s.debugLabel??`effect`}:${t}`}),e.debugPrivate=!0}o(r,`refresh`),o(i,`ref`),o(a,`base`)}let s=(0,e.atom)(e=>void e(a));return s;function c(e){try{e.isRefreshing=!0,e.set(r,e=>e+1)}finally{e.isRefreshing=!1}}function l(e){if(e.cleanup)try{e.fromCleanup=!0,e.cleanup()}finally{e.fromCleanup=!1,e.cleanup=void 0}}function u(e){if(`e`in e){let t=e.pendingError;throw delete e.pendingError,t}}}exports.atomWithEffect=n;
1
+ let e=require("jotai/vanilla"),t=require("@stryke/helpers/is-equal");function n(n){let r=(0,e.atom)(0),i=(0,e.atom)(()=>({inProgress:0,mounted:!1,promise:void 0,pendingError:void 0,cleanup:void 0,fromCleanup:!1,isRecursing:!1,isRefreshing:!1,get:(()=>{}),set:(()=>{})}),(e,t)=>{let n=e(i);return Object.assign(n,{mounted:!0,get:e,set:t}),t(r,e=>e+1),()=>{n.mounted=!1,l(n),u(n)}});i.onMount=e=>e();let a=(0,e.atom)(async e=>{e(r);let a=e(i);if(!a.mounted||a.isRecursing||a.inProgress&&!a.isRefreshing)return a.promise;u(a);let o=/* @__PURE__ */ new Map,s=t=>{let n=e(t);return o.set(t,n),n};s.peek=e=>a.get(e);let d=(...t)=>{try{return++a.inProgress,a.set(...t)}finally{Array.from(o.keys(),e),--a.inProgress}};d.recurse=(n,...r)=>{if(a.fromCleanup){if(process.env.NODE_ENV!==`production`)throw Error(`set.recurse is not allowed in cleanup`);return}try{return a.isRecursing=!0,a.set(n,...r)}finally{a.isRecursing=!1,Array.from(o).some(([n,r])=>!(0,t.isEqual)(e(n),r))&&c(a)}},++a.inProgress;function f(){try{if(a.isRefreshing=!1,!a.mounted)return;l(a),a.cleanup=n(s,d)}catch(e){a.pendingError=e,c(a)}finally{a.promise=void 0,--a.inProgress}}return a.isRefreshing?f():a.promise=Promise.resolve().then(f)});if(process.env.NODE_ENV!==`production`){function o(e,t){Object.defineProperty(e,"debugLabel",{get:()=>`${s.debugLabel??`effect`}:${t}`}),e.debugPrivate=!0}o(r,`refresh`),o(i,`ref`),o(a,`base`)}let s=(0,e.atom)(e=>void e(a));return s;function c(e){try{e.isRefreshing=!0,e.set(r,e=>e+1)}finally{e.isRefreshing=!1}}function l(e){if(e.cleanup)try{e.fromCleanup=!0,e.cleanup()}finally{e.fromCleanup=!1,e.cleanup=void 0}}function u(e){if(`e`in e){let t=e.pendingError;throw delete e.pendingError,t}}}exports.atomWithEffect=n;
@@ -1,2 +1,2 @@
1
- import{atom as e}from"jotai/vanilla";import{isEqual as t}from"@stryke/helpers/is-equal";function n(n){let r=e(0),i=e(()=>({inProgress:0,mounted:!1,promise:void 0,pendingError:void 0,cleanup:void 0,fromCleanup:!1,isRecursing:!1,isRefreshing:!1,get:(()=>{}),set:(()=>{})}),(e,t)=>{let n=e(i);return Object.assign(n,{mounted:!0,get:e,set:t}),t(r,e=>e+1),()=>{n.mounted=!1,s(n),c(n)}});i.onMount=e=>e();let a=e(async e=>{e(r);let a=e(i);if(!a.mounted||a.isRecursing||a.inProgress&&!a.isRefreshing)return a.promise;c(a);let l=new Map,u=t=>{let n=e(t);return l.set(t,n),n};u.peek=e=>a.get(e);let d=(...t)=>{try{return++a.inProgress,a.set(...t)}finally{Array.from(l.keys(),e),--a.inProgress}};d.recurse=(n,...r)=>{if(!a.fromCleanup)try{return a.isRecursing=!0,a.set(n,...r)}finally{a.isRecursing=!1,Array.from(l).some(([n,r])=>!t(e(n),r))&&o(a)}},++a.inProgress;function f(){try{if(a.isRefreshing=!1,!a.mounted)return;s(a),a.cleanup=n(u,d)}catch(e){a.pendingError=e,o(a)}finally{a.promise=void 0,--a.inProgress}}return a.isRefreshing?f():a.promise=Promise.resolve().then(f)});return e(e=>void e(a));function o(e){try{e.isRefreshing=!0,e.set(r,e=>e+1)}finally{e.isRefreshing=!1}}function s(e){if(e.cleanup)try{e.fromCleanup=!0,e.cleanup()}finally{e.fromCleanup=!1,e.cleanup=void 0}}function c(e){if(`e`in e){let t=e.pendingError;throw delete e.pendingError,t}}}export{n as atomWithEffect};
1
+ import{atom as e}from"jotai/vanilla";import{isEqual as t}from"@stryke/helpers/is-equal";function n(n){let r=e(0),i=e(()=>({inProgress:0,mounted:!1,promise:void 0,pendingError:void 0,cleanup:void 0,fromCleanup:!1,isRecursing:!1,isRefreshing:!1,get:(()=>{}),set:(()=>{})}),(e,t)=>{let n=e(i);return Object.assign(n,{mounted:!0,get:e,set:t}),t(r,e=>e+1),()=>{n.mounted=!1,s(n),c(n)}});i.onMount=e=>e();let a=e(async e=>{e(r);let a=e(i);if(!a.mounted||a.isRecursing||a.inProgress&&!a.isRefreshing)return a.promise;c(a);let l=/* @__PURE__ */ new Map,u=t=>{let n=e(t);return l.set(t,n),n};u.peek=e=>a.get(e);let d=(...t)=>{try{return++a.inProgress,a.set(...t)}finally{Array.from(l.keys(),e),--a.inProgress}};d.recurse=(n,...r)=>{if(!a.fromCleanup)try{return a.isRecursing=!0,a.set(n,...r)}finally{a.isRecursing=!1,Array.from(l).some(([n,r])=>!t(e(n),r))&&o(a)}},++a.inProgress;function f(){try{if(a.isRefreshing=!1,!a.mounted)return;s(a),a.cleanup=n(u,d)}catch(e){a.pendingError=e,o(a)}finally{a.promise=void 0,--a.inProgress}}return a.isRefreshing?f():a.promise=Promise.resolve().then(f)});return e(e=>void e(a));function o(e){try{e.isRefreshing=!0,e.set(r,e=>e+1)}finally{e.isRefreshing=!1}}function s(e){if(e.cleanup)try{e.fromCleanup=!0,e.cleanup()}finally{e.fromCleanup=!1,e.cleanup=void 0}}function c(e){if(`e`in e){let t=e.pendingError;throw delete e.pendingError,t}}}export{n as atomWithEffect};
2
2
  //# sourceMappingURL=atom-with-effect.mjs.map
@@ -1 +1 @@
1
- const e=require("../../base/utilities/create-molecule.cjs");require("../../base/index.cjs");const t=require("../atoms/atom-with-field.cjs"),n=require("../atoms/atom-with-messages.cjs"),r=require("../utilities/validators.cjs"),i=require("./form-molecule.cjs");let a=require("@stryke/type-checks/is-function"),o=require("jotai/utils"),s=require("@stryke/helpers/is-equal"),c=require("jotai"),l=require("@stryke/type-checks/is-string"),u=require("@stryke/helpers/deep-merge"),ee=require("@stryke/helpers/get-field"),d=require("@stryke/helpers/to-path"),f=require("@stryke/type-checks/is-set"),p=require("jotai-optics");const m={theme:`base`,size:`$true`,debounceMs:100,isEqual:s.isEqual,required:!1,disabled:!1,clearable:!1,initialValue:null},h=e.createMoleculeApi(s=>{let h=e.use(i.FormApi.Scope),g=(0,c.atom)(()=>h),_=e.use(i.FormApi.Molecule),v=(0,c.atom)(m),y=(0,c.atom)(e=>{let t=e(_.options),n=e(v),i=(0,u.deepMerge)(t.defaultFieldOptions,n);return(0,u.deepMerge)({validate:{onBlur:i.required?[r.requiredValidator]:[]}},i)},(e,t,n)=>{let r={};r=(0,a.isFunction)(n)?n(e(v)):n===o.RESET?{}:n,t(v,(0,u.deepMerge)(m,r))}),b=(0,d.toPath)(s.includes(`-`)?s.slice(s.indexOf(`-`)+1):s),x=(0,c.atom)(()=>b),S=(0,c.atom)(e=>e(x).slice(-1)[0]),C=(0,p.focusAtom)(_.focusedFields,e=>e.path(...b)),w=(0,p.focusAtom)(_.requiredFields,e=>e.path(...b)),T=(0,p.focusAtom)(_.disabledFields,e=>e.path(...b)),E=(0,c.atom)(e=>e(w)??e(y).required,(e,t,n)=>{t(w,n)}),D=(0,c.atom)(e=>e(T)??e(y).disabled,(e,t,n)=>{t(T,n)}),O=(0,c.atom)(e=>e(y).clearable),k=(0,p.focusAtom)(_.touchedFields,e=>e.path(...b)),A=(0,p.focusAtom)(_.blurredFields,e=>e.path(...b)),j=(0,p.focusAtom)(_.validatingFields,e=>e.path(...b)),M=(0,p.focusAtom)(_.validationResultsFields,e=>e.path(...b)),te=(0,p.focusAtom)(_.tabIndexes,e=>e.path(...b)),N=(0,p.focusAtom)(_.refs,e=>e.path(...b)),P=(0,p.focusAtom)(_.initialValues,e=>e.path(...b)),F=(0,p.focusAtom)(_.values,e=>e.path(...b)),I=(0,c.atom)(e=>e(y).isEqual(e(F),e(P))),L=n.atomWithFieldsMessageTypes(M,`danger`),R=n.atomWithFieldsMessageTypes(M,`warning`),z=n.atomWithFieldsMessageTypes(M,`info`),B=n.atomWithFieldsMessageTypes(M,`discovery`),V=n.atomWithFieldsMessageTypes(M,`success`),H=n.atomWithFieldsMessageTypes(M,`positive`),U=n.atomWithFieldsMessageTypes(M,`negative`),W=n.atomWithFieldsMessageList(M,`danger`),G=n.atomWithFieldsMessageList(M,`warning`),K=n.atomWithFieldsMessageList(M,`info`),q=n.atomWithFieldsMessageList(M,`discovery`),J=n.atomWithFieldsMessageList(M,`success`),Y=n.atomWithFieldsMessageList(M,`positive`),X=n.atomWithFieldsMessageList(M,`negative`),Z=(0,c.atom)(e=>e(W).length>0),Q=(0,c.atom)(e=>!e(Z)),ne=(0,c.atom)(e=>{let t=e(y),n=e(F),r;return r=t?.format?t.format(n):n,(0,f.isSet)(r)?(0,l.isString)(r)?r:String(r):``}),$=t.atomWithFieldItems(y,F,D),re=(0,o.splitAtom)($),ie=(0,o.atomWithDefault)(e=>e(y).size??`$true`);return{options:y,form:g,name:S,path:x,initialValue:P,previousValue:(0,c.atom)(e=>{let t=e(_.previousValues);return(0,ee.getField)(t,e(x).join(`.`))??null}),value:F,formattedValue:ne,focused:C,required:E,disabled:D,clearable:O,touched:k,blurred:A,validating:j,validationResults:M,tabIndex:te,ref:N,pristine:(0,c.atom)(e=>!e(I)),dirty:I,items:$,itemsAtoms:re,size:ie,errors:L,warnings:R,info:z,discovery:B,success:V,positive:H,negative:U,dangerMessages:W,warningMessages:G,infoMessages:K,discoveryMessages:q,successMessages:J,positiveMessages:Y,negativeMessages:X,theme:n.atomWithTheme(y,W,G,K,q,J,Y,X),messages:n.atomWithMessages(W,G,K,q,J,Y,X),invalid:Z,valid:Q}},{type:`field`});exports.DEFAULT_FIELD_OPTIONS=m,exports.FieldApi=h;
1
+ const e=require("../../base/utilities/create-molecule.cjs");require("../../base/index.cjs");const t=require("../atoms/atom-with-field.cjs"),n=require("../atoms/atom-with-messages.cjs"),r=require("../utilities/validators.cjs"),i=require("./form-molecule.cjs");let a=require("@stryke/type-checks/is-function"),o=require("jotai/utils"),s=require("@stryke/helpers/is-equal"),c=require("jotai"),l=require("@stryke/type-checks/is-string"),u=require("@stryke/helpers/deep-merge"),ee=require("@stryke/helpers/get-field"),d=require("@stryke/helpers/to-path"),f=require("@stryke/type-checks/is-set"),p=require("jotai-optics");const m={theme:`base`,size:`md`,debounceMs:100,isEqual:s.isEqual,required:!1,disabled:!1,clearable:!1,initialValue:null},h=e.createMoleculeApi(s=>{let h=e.use(i.FormApi.Scope),g=(0,c.atom)(()=>h),_=e.use(i.FormApi.Molecule),v=(0,c.atom)(m),y=(0,c.atom)(e=>{let t=e(_.options),n=e(v),i=(0,u.deepMerge)(t.defaultFieldOptions,n);return(0,u.deepMerge)({validate:{onBlur:i.required?[r.requiredValidator]:[]}},i)},(e,t,n)=>{let r={};r=(0,a.isFunction)(n)?n(e(v)):n===o.RESET?{}:n,t(v,(0,u.deepMerge)(m,r))}),b=(0,d.toPath)(s.includes(`-`)?s.slice(s.indexOf(`-`)+1):s),x=(0,c.atom)(()=>b),S=(0,c.atom)(e=>e(x).slice(-1)[0]),C=(0,p.focusAtom)(_.focusedFields,e=>e.path(...b)),w=(0,p.focusAtom)(_.requiredFields,e=>e.path(...b)),T=(0,p.focusAtom)(_.disabledFields,e=>e.path(...b)),E=(0,c.atom)(e=>e(w)??e(y).required,(e,t,n)=>{t(w,n)}),D=(0,c.atom)(e=>e(T)??e(y).disabled,(e,t,n)=>{t(T,n)}),O=(0,c.atom)(e=>e(y).clearable),k=(0,p.focusAtom)(_.touchedFields,e=>e.path(...b)),A=(0,p.focusAtom)(_.blurredFields,e=>e.path(...b)),j=(0,p.focusAtom)(_.validatingFields,e=>e.path(...b)),M=(0,p.focusAtom)(_.validationResultsFields,e=>e.path(...b)),te=(0,p.focusAtom)(_.tabIndexes,e=>e.path(...b)),N=(0,p.focusAtom)(_.refs,e=>e.path(...b)),P=(0,p.focusAtom)(_.initialValues,e=>e.path(...b)),F=(0,p.focusAtom)(_.values,e=>e.path(...b)),I=(0,c.atom)(e=>e(y).isEqual(e(F),e(P))),L=n.atomWithFieldsMessageTypes(M,`danger`),R=n.atomWithFieldsMessageTypes(M,`warning`),z=n.atomWithFieldsMessageTypes(M,`info`),B=n.atomWithFieldsMessageTypes(M,`discovery`),V=n.atomWithFieldsMessageTypes(M,`success`),H=n.atomWithFieldsMessageTypes(M,`positive`),U=n.atomWithFieldsMessageTypes(M,`negative`),W=n.atomWithFieldsMessageList(M,`danger`),G=n.atomWithFieldsMessageList(M,`warning`),K=n.atomWithFieldsMessageList(M,`info`),q=n.atomWithFieldsMessageList(M,`discovery`),J=n.atomWithFieldsMessageList(M,`success`),Y=n.atomWithFieldsMessageList(M,`positive`),X=n.atomWithFieldsMessageList(M,`negative`),Z=(0,c.atom)(e=>e(W).length>0),Q=(0,c.atom)(e=>!e(Z)),ne=(0,c.atom)(e=>{let t=e(y),n=e(F),r;return r=t?.format?t.format(n):n,(0,f.isSet)(r)?(0,l.isString)(r)?r:String(r):``}),$=t.atomWithFieldItems(y,F,D),re=(0,o.splitAtom)($),ie=(0,o.atomWithDefault)(e=>e(y).size??`md`);return{options:y,form:g,name:S,path:x,initialValue:P,previousValue:(0,c.atom)(e=>{let t=e(_.previousValues);return(0,ee.getField)(t,e(x).join(`.`))??null}),value:F,formattedValue:ne,focused:C,required:E,disabled:D,clearable:O,touched:k,blurred:A,validating:j,validationResults:M,tabIndex:te,ref:N,pristine:(0,c.atom)(e=>!e(I)),dirty:I,items:$,itemsAtoms:re,size:ie,errors:L,warnings:R,info:z,discovery:B,success:V,positive:H,negative:U,dangerMessages:W,warningMessages:G,infoMessages:K,discoveryMessages:q,successMessages:J,positiveMessages:Y,negativeMessages:X,theme:n.atomWithTheme(y,W,G,K,q,J,Y,X),messages:n.atomWithMessages(W,G,K,q,J,Y,X),invalid:Z,valid:Q}},{type:`field`});exports.DEFAULT_FIELD_OPTIONS=m,exports.FieldApi=h;
@@ -1,2 +1,2 @@
1
- import{createMoleculeApi as e,use as t}from"../../base/utilities/create-molecule.mjs";import"../../base/index.mjs";import{atomWithFieldItems as n}from"../atoms/atom-with-field.mjs";import{atomWithFieldsMessageList as r,atomWithFieldsMessageTypes as i,atomWithMessages as ee,atomWithTheme as a}from"../atoms/atom-with-messages.mjs";import{requiredValidator as o}from"../utilities/validators.mjs";import{FormApi as s}from"./form-molecule.mjs";import{isFunction as c}from"@stryke/type-checks/is-function";import{RESET as l,atomWithDefault as u,splitAtom as d}from"jotai/utils";import{isEqual as f}from"@stryke/helpers/is-equal";import{atom as p}from"jotai";import{isString as m}from"@stryke/type-checks/is-string";import{deepMerge as h}from"@stryke/helpers/deep-merge";import{getField as te}from"@stryke/helpers/get-field";import{toPath as ne}from"@stryke/helpers/to-path";import{isSet as re}from"@stryke/type-checks/is-set";import{focusAtom as g}from"jotai-optics";const _={theme:`base`,size:`$true`,debounceMs:100,isEqual:f,required:!1,disabled:!1,clearable:!1,initialValue:null},v=e(e=>{let f=t(s.Scope),v=p(()=>f),y=t(s.Molecule),b=p(_),x=p(e=>{let t=e(y.options),n=e(b),r=h(t.defaultFieldOptions,n);return h({validate:{onBlur:r.required?[o]:[]}},r)},(e,t,n)=>{let r={};r=c(n)?n(e(b)):n===l?{}:n,t(b,h(_,r))}),S=ne(e.includes(`-`)?e.slice(e.indexOf(`-`)+1):e),C=p(()=>S),ie=p(e=>e(C).slice(-1)[0]),ae=g(y.focusedFields,e=>e.path(...S)),w=g(y.requiredFields,e=>e.path(...S)),T=g(y.disabledFields,e=>e.path(...S)),oe=p(e=>e(w)??e(x).required,(e,t,n)=>{t(w,n)}),E=p(e=>e(T)??e(x).disabled,(e,t,n)=>{t(T,n)}),D=p(e=>e(x).clearable),O=g(y.touchedFields,e=>e.path(...S)),k=g(y.blurredFields,e=>e.path(...S)),A=g(y.validatingFields,e=>e.path(...S)),j=g(y.validationResultsFields,e=>e.path(...S)),M=g(y.tabIndexes,e=>e.path(...S)),N=g(y.refs,e=>e.path(...S)),P=g(y.initialValues,e=>e.path(...S)),F=g(y.values,e=>e.path(...S)),I=p(e=>e(x).isEqual(e(F),e(P))),L=i(j,`danger`),R=i(j,`warning`),z=i(j,`info`),B=i(j,`discovery`),V=i(j,`success`),H=i(j,`positive`),U=i(j,`negative`),W=r(j,`danger`),G=r(j,`warning`),K=r(j,`info`),q=r(j,`discovery`),J=r(j,`success`),Y=r(j,`positive`),X=r(j,`negative`),Z=p(e=>e(W).length>0),se=p(e=>!e(Z)),ce=p(e=>{let t=e(x),n=e(F),r;return r=t?.format?t.format(n):n,re(r)?m(r)?r:String(r):``}),Q=n(x,F,E),le=d(Q),$=u(e=>e(x).size??`$true`);return{options:x,form:v,name:ie,path:C,initialValue:P,previousValue:p(e=>{let t=e(y.previousValues);return te(t,e(C).join(`.`))??null}),value:F,formattedValue:ce,focused:ae,required:oe,disabled:E,clearable:D,touched:O,blurred:k,validating:A,validationResults:j,tabIndex:M,ref:N,pristine:p(e=>!e(I)),dirty:I,items:Q,itemsAtoms:le,size:$,errors:L,warnings:R,info:z,discovery:B,success:V,positive:H,negative:U,dangerMessages:W,warningMessages:G,infoMessages:K,discoveryMessages:q,successMessages:J,positiveMessages:Y,negativeMessages:X,theme:a(x,W,G,K,q,J,Y,X),messages:ee(W,G,K,q,J,Y,X),invalid:Z,valid:se}},{type:`field`});export{_ as DEFAULT_FIELD_OPTIONS,v as FieldApi};
1
+ import{createMoleculeApi as e,use as t}from"../../base/utilities/create-molecule.mjs";import"../../base/index.mjs";import{atomWithFieldItems as n}from"../atoms/atom-with-field.mjs";import{atomWithFieldsMessageList as r,atomWithFieldsMessageTypes as i,atomWithMessages as ee,atomWithTheme as a}from"../atoms/atom-with-messages.mjs";import{requiredValidator as o}from"../utilities/validators.mjs";import{FormApi as s}from"./form-molecule.mjs";import{isFunction as c}from"@stryke/type-checks/is-function";import{RESET as l,atomWithDefault as u,splitAtom as d}from"jotai/utils";import{isEqual as f}from"@stryke/helpers/is-equal";import{atom as p}from"jotai";import{isString as m}from"@stryke/type-checks/is-string";import{deepMerge as h}from"@stryke/helpers/deep-merge";import{getField as te}from"@stryke/helpers/get-field";import{toPath as ne}from"@stryke/helpers/to-path";import{isSet as re}from"@stryke/type-checks/is-set";import{focusAtom as g}from"jotai-optics";const _={theme:`base`,size:`md`,debounceMs:100,isEqual:f,required:!1,disabled:!1,clearable:!1,initialValue:null},v=e(e=>{let f=t(s.Scope),v=p(()=>f),y=t(s.Molecule),b=p(_),x=p(e=>{let t=e(y.options),n=e(b),r=h(t.defaultFieldOptions,n);return h({validate:{onBlur:r.required?[o]:[]}},r)},(e,t,n)=>{let r={};r=c(n)?n(e(b)):n===l?{}:n,t(b,h(_,r))}),S=ne(e.includes(`-`)?e.slice(e.indexOf(`-`)+1):e),C=p(()=>S),ie=p(e=>e(C).slice(-1)[0]),ae=g(y.focusedFields,e=>e.path(...S)),w=g(y.requiredFields,e=>e.path(...S)),T=g(y.disabledFields,e=>e.path(...S)),oe=p(e=>e(w)??e(x).required,(e,t,n)=>{t(w,n)}),E=p(e=>e(T)??e(x).disabled,(e,t,n)=>{t(T,n)}),D=p(e=>e(x).clearable),O=g(y.touchedFields,e=>e.path(...S)),k=g(y.blurredFields,e=>e.path(...S)),A=g(y.validatingFields,e=>e.path(...S)),j=g(y.validationResultsFields,e=>e.path(...S)),M=g(y.tabIndexes,e=>e.path(...S)),N=g(y.refs,e=>e.path(...S)),P=g(y.initialValues,e=>e.path(...S)),F=g(y.values,e=>e.path(...S)),I=p(e=>e(x).isEqual(e(F),e(P))),L=i(j,`danger`),R=i(j,`warning`),z=i(j,`info`),B=i(j,`discovery`),V=i(j,`success`),H=i(j,`positive`),U=i(j,`negative`),W=r(j,`danger`),G=r(j,`warning`),K=r(j,`info`),q=r(j,`discovery`),J=r(j,`success`),Y=r(j,`positive`),X=r(j,`negative`),Z=p(e=>e(W).length>0),se=p(e=>!e(Z)),ce=p(e=>{let t=e(x),n=e(F),r;return r=t?.format?t.format(n):n,re(r)?m(r)?r:String(r):``}),Q=n(x,F,E),le=d(Q),$=u(e=>e(x).size??`md`);return{options:x,form:v,name:ie,path:C,initialValue:P,previousValue:p(e=>{let t=e(y.previousValues);return te(t,e(C).join(`.`))??null}),value:F,formattedValue:ce,focused:ae,required:oe,disabled:E,clearable:D,touched:O,blurred:k,validating:A,validationResults:j,tabIndex:M,ref:N,pristine:p(e=>!e(I)),dirty:I,items:Q,itemsAtoms:le,size:$,errors:L,warnings:R,info:z,discovery:B,success:V,positive:H,negative:U,dangerMessages:W,warningMessages:G,infoMessages:K,discoveryMessages:q,successMessages:J,positiveMessages:Y,negativeMessages:X,theme:a(x,W,G,K,q,J,Y,X),messages:ee(W,G,K,q,J,Y,X),invalid:Z,valid:se}},{type:`field`});export{_ as DEFAULT_FIELD_OPTIONS,v as FieldApi};
2
2
  //# sourceMappingURL=field-molecule.mjs.map
@@ -1 +1 @@
1
- const e={INITIALIZE:`initialize`,CHANGE:`change`,BLUR:`blur`,SUBMIT:`submit`,SERVER:`server`};exports.ValidationCause=e;
1
+ require("@cyclone-ui/helpers");const e={INITIALIZE:`initialize`,CHANGE:`change`,BLUR:`blur`,SUBMIT:`submit`,SERVER:`server`};exports.ValidationCause=e;
@@ -3,6 +3,7 @@ import { MoleculeState } from "../base/utilities/create-molecule.cjs";
3
3
  import { Atom, Getter, PrimitiveAtom, SetStateAction, Setter, WritableAtom } from "jotai";
4
4
  import { RESET } from "jotai/utils";
5
5
  import { Ref } from "react";
6
+ import { FormControlSize } from "@cyclone-ui/helpers";
6
7
  import { MaskitoOptions } from "@maskito/core";
7
8
  import { MaybePromise } from "@stryke/types/base";
8
9
  import { SelectOption, SelectOptionValue } from "@stryke/types/form";
@@ -153,9 +154,9 @@ interface FieldOptions<TFieldValue> {
153
154
  /**
154
155
  * The default size of the field.
155
156
  *
156
- * @defaultValue "$true"
157
+ * @defaultValue "md"
157
158
  */
158
- size?: `$${string}` | `$${string}.${string}` | `$${string}.${number}` | `$${number}`;
159
+ size?: FormControlSize;
159
160
  /**
160
161
  * The default required status of the field.
161
162
  *
@@ -263,7 +264,7 @@ interface FieldAtoms<TFieldValue> {
263
264
  formattedValue: Atom<string>;
264
265
  items: WritableAtom<SelectOption<SelectOptionValue, string>[], [SetStateAction<SelectOption<SelectOptionValue, string>[]>], void>;
265
266
  itemsAtoms: WritableAtom<PrimitiveAtom<SelectOption<SelectOptionValue, string>>[], [SplitAtomAction<SelectOption<SelectOptionValue, string>>], void>;
266
- size: WritableAtom<`$${string}` | `$${string}.${string}` | `$${string}.${number}` | `$${number}`, [SetStateAction<`$${string}` | `$${string}.${string}` | `$${string}.${number}` | `$${number}`>], void>;
267
+ size: WritableAtom<FormControlSize, [SetStateAction<FormControlSize>], void>;
267
268
  errors: Atom<ValidationDetail<"danger">[]>;
268
269
  warnings: Atom<ValidationDetail<"warning">[]>;
269
270
  info: Atom<ValidationDetail<"info">[]>;
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.cts","names":[],"sources":["../../src/form/types.ts"],"mappings":";;;;;;;;;;;;;;KA2CY;cAGC;EACiB,YAAA;EACR,QAAA;EACJ,MAAA;EACI,QAAA;EACA,QAAA;;KAGV,UAAU,iBACpB,OAAO,QACP,eAAe,QACf,OAAO,iBACP,KAAK,QACL,K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,UAAU,aACR,gBAAgB,uBACf,eAAe,gBAAgB;EAGlC,KAAK,aACH,gBAAgB,aAAa,IAAI,qBAChC,eAAe,gBAAgB,aAAa,IAAI;EAInD,UAAU;EACV,OAAO;EAEP,eAAe,KAAK;EACpB,cAAc,aAAa,cAAc,eAAe;EACxD,OAAO,aAAa,cAAc,eAAe;EACjD,gBAAgB;EAEhB,OAAO,aACL,aAAa,+BACZ,eAAe,aAAa;EAG/B,YAAY,aACV,cAAc,aAAa,gCAC1B,gBAAgB,aAAa;EAIhC,MAAM,aAAa,kBAAkB,eAAe;EAEpD,QAAQ,KAAK;EACb,UAAU,KAAK;EACf,MAAM,KAAK;EACX,WAAW,KAAK;EAChB,SAAS,KAAK;EACd,UAAU,KAAK;EACf,UAAU,KAAK;EAEf,gBAAgB,KAAK;EACrB,iBAAiB,KAAK;EACtB,cAAc,KAAK;EACnB,mBAAmB,KAAK;EACxB,iBAAiB,KAAK;EACtB,kBAAkB,KAAK;EACvB,kBAAkB,KAAK;EAEvB,OAAO;EACP,UAAU,KAAK;EAEf,SAAS;EACT,OAAO"}
@@ -3,6 +3,7 @@ import { MoleculeState } from "../base/utilities/create-molecule.mjs";
3
3
  import { RESET } from "jotai/utils";
4
4
  import { Atom, Getter, PrimitiveAtom, SetStateAction, Setter, WritableAtom } from "jotai";
5
5
  import { Ref } from "react";
6
+ import { FormControlSize } from "@cyclone-ui/helpers";
6
7
  import { MaskitoOptions } from "@maskito/core";
7
8
  import { MaybePromise } from "@stryke/types/base";
8
9
  import { SelectOption, SelectOptionValue } from "@stryke/types/form";
@@ -153,9 +154,9 @@ interface FieldOptions<TFieldValue> {
153
154
  /**
154
155
  * The default size of the field.
155
156
  *
156
- * @defaultValue "$true"
157
+ * @defaultValue "md"
157
158
  */
158
- size?: `$${string}` | `$${string}.${string}` | `$${string}.${number}` | `$${number}`;
159
+ size?: FormControlSize;
159
160
  /**
160
161
  * The default required status of the field.
161
162
  *
@@ -263,7 +264,7 @@ interface FieldAtoms<TFieldValue> {
263
264
  formattedValue: Atom<string>;
264
265
  items: WritableAtom<SelectOption<SelectOptionValue, string>[], [SetStateAction<SelectOption<SelectOptionValue, string>[]>], void>;
265
266
  itemsAtoms: WritableAtom<PrimitiveAtom<SelectOption<SelectOptionValue, string>>[], [SplitAtomAction<SelectOption<SelectOptionValue, string>>], void>;
266
- size: WritableAtom<`$${string}` | `$${string}.${string}` | `$${string}.${number}` | `$${number}`, [SetStateAction<`$${string}` | `$${string}.${string}` | `$${string}.${number}` | `$${number}`>], void>;
267
+ size: WritableAtom<FormControlSize, [SetStateAction<FormControlSize>], void>;
267
268
  errors: Atom<ValidationDetail<"danger">[]>;
268
269
  warnings: Atom<ValidationDetail<"warning">[]>;
269
270
  info: Atom<ValidationDetail<"info">[]>;
@@ -1,2 +1,2 @@
1
- const e={INITIALIZE:`initialize`,CHANGE:`change`,BLUR:`blur`,SUBMIT:`submit`,SERVER:`server`};export{e as ValidationCause};
1
+ import"@cyclone-ui/helpers";const e={INITIALIZE:`initialize`,CHANGE:`change`,BLUR:`blur`,SUBMIT:`submit`,SERVER:`server`};export{e as ValidationCause};
2
2
  //# sourceMappingURL=types.mjs.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cyclone-ui/state",
3
- "version": "0.0.4",
3
+ "version": "0.0.6",
4
4
  "type": "module",
5
5
  "description": "A state management package used to handle state in Storm Software applications.",
6
6
  "repository": {
@@ -114,15 +114,15 @@
114
114
  "dependencies": {
115
115
  "@maskito/core": "^3.11.1",
116
116
  "@maskito/react": "^3.11.1",
117
- "@stryke/async": "^0.1.42",
118
- "@stryke/env": "^0.20.133",
119
- "@stryke/helpers": "^0.10.54",
120
- "@stryke/hooks": "^0.4.131",
121
- "@stryke/json": "^0.15.38",
122
- "@stryke/string-format": "^0.17.56",
123
- "@stryke/type-checks": "^0.6.47",
124
- "@stryke/types": "^0.12.42",
125
- "@stryke/unique-id": "^0.3.127",
117
+ "@stryke/async": "^0.1.43",
118
+ "@stryke/env": "^0.20.134",
119
+ "@stryke/helpers": "^0.10.55",
120
+ "@stryke/hooks": "^0.4.132",
121
+ "@stryke/json": "^0.15.39",
122
+ "@stryke/string-format": "^0.17.57",
123
+ "@stryke/type-checks": "^0.6.48",
124
+ "@stryke/types": "^0.12.43",
125
+ "@stryke/unique-id": "^0.3.128",
126
126
  "@tamagui/core": "^2.7.7",
127
127
  "@tamagui/portal": "^2.7.7",
128
128
  "@tamagui/toast": "^2.7.7",
@@ -131,10 +131,11 @@
131
131
  "maska": "^3.2.1",
132
132
  "optics-ts": "^2.4.1",
133
133
  "react-native-safe-area-context": "^4.14.1",
134
- "valibot": "^0.42.1"
134
+ "valibot": "^0.42.1",
135
+ "@cyclone-ui/helpers": "0.3.5"
135
136
  },
136
137
  "devDependencies": {
137
- "@powerlines/plugin-tsdown": "^0.1.613",
138
+ "@powerlines/plugin-tsdown": "^0.1.614",
138
139
  "jotai": "^2.20.3",
139
140
  "react": "^19.3.0",
140
141
  "react-dom": "^19.3.0",
@@ -142,5 +143,5 @@
142
143
  },
143
144
  "publishConfig": { "access": "public" },
144
145
  "module": "./dist/index.mjs",
145
- "gitHead": "9db5f851b36388d0389803ae12a59a6227b6f657"
146
+ "gitHead": "c768933eb1607d9614dbcf8df2a37d4f7ea1c169"
146
147
  }