voc-lib-js 1.0.7 → 1.0.9

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/dist/main.d.mts CHANGED
@@ -47,4 +47,4 @@ declare const FormsLib: {
47
47
  renderForm: typeof renderForm;
48
48
  };
49
49
 
50
- export { FormsLib };
50
+ export { FormsLib, FormsLib as default };
package/dist/main.d.ts CHANGED
@@ -47,4 +47,4 @@ declare const FormsLib: {
47
47
  renderForm: typeof renderForm;
48
48
  };
49
49
 
50
- export { FormsLib };
50
+ export { FormsLib, FormsLib as default };
@@ -1 +1 @@
1
- "use strict";var FormsLib=(()=>{var y=Object.defineProperty;var f=Object.getOwnPropertyDescriptor;var L=Object.getOwnPropertyNames;var C=Object.prototype.hasOwnProperty;var T=(r,a)=>{for(var m in a)y(r,m,{get:a[m],enumerable:!0})},k=(r,a,m,E)=>{if(a&&typeof a=="object"||typeof a=="function")for(let o of L(a))!C.call(r,o)&&o!==m&&y(r,o,{get:()=>a[o],enumerable:!(E=f(a,o))||E.enumerable});return r};var M=r=>k(y({},"__esModule",{value:!0}),r);var v={};T(v,{FormsLib:()=>H});function b(r){console.log("Form submitted:",r)}function F(r,a){let m=[];if(typeof r=="string"?m=Array.from(document.querySelectorAll(r)):m=[r],m.length===0)return null;function E(){let l=document.createElement("form");l.id=a.id;let u=document.createElement("h2");u.textContent=a.form_name,l.appendChild(u);function c(e,n){n&&(n.min_length!==void 0&&(e.minLength=n.min_length),n.max_length!==void 0&&(e.maxLength=n.max_length),n.regex&&(e instanceof HTMLInputElement?e.pattern=n.regex:e.dataset.pattern=n.regex))}function p(e){if(!e.key&&!e.label)return null;let n=document.createElement("div");if(n.className="form-group",e.label){let t=document.createElement("label");t.htmlFor=e.key||"",t.textContent=e.label+(e.required?" *":""),n.appendChild(t)}let i=null;switch(e.type){case"textarea":{let t=document.createElement("textarea");e.key&&(t.name=e.key),e.required&&(t.required=!0),c(t,e.validation),i=t;break}case"select":{let t=document.createElement("select");e.key&&(t.name=e.key),e.required&&(t.required=!0),e.options&&e.options.forEach(d=>{let s=document.createElement("option");s.value=d.value,s.textContent=d.label,e.default===d.value&&(s.selected=!0),t.appendChild(s)}),i=t;break}case"radio":{let t=document.createElement("div");t.className="radio-group "+(e.direction||"vertical"),e.options&&e.options.forEach(d=>{let s=document.createElement("label");s.style.display=e.direction==="horizontal"?"inline-block":"block";let h=document.createElement("input");h.type="radio",h.name=e.key||"",h.value=d.value,s.appendChild(h),s.appendChild(document.createTextNode(d.label)),t.appendChild(s)}),i=t;break}default:{let t=document.createElement("input");t.type=e.type||"text",e.key&&(t.name=e.key),e.required&&(t.required=!0),c(t,e.validation),i=t;break}}if(i&&n.appendChild(i),e.hint_text){let t=document.createElement("small");t.className="hint",t.textContent=e.hint_text,n.appendChild(t)}return n}a.fields.forEach(e=>{if(e.type==="row"){let n=document.createElement("div");if(n.className="form-row",e.label){let i=document.createElement("h3");i.textContent=e.label,n.appendChild(i)}e.items.forEach(i=>{let t=p(i);t&&n.appendChild(t)}),l.appendChild(n)}else{let n=p(e);n&&l.appendChild(n)}});let g=document.createElement("button");return g.type="submit",g.textContent="Submit",l.appendChild(g),l}let o=E();return m[0].appendChild(o),{element:o,validate:()=>{let l=[];return o.querySelectorAll(":invalid").forEach(c=>{let p=c.validationMessage;l.push({element:c,message:p})}),l},submitForm:()=>{b(o)},getValues:()=>{let l=new FormData(o),u={};return l.forEach((c,p)=>{u[p]=c}),u}}}var x={renderForm:F};var H=x;return M(v);})();
1
+ "use strict";var FormsLib=(()=>{var y=Object.defineProperty;var L=Object.getOwnPropertyDescriptor;var C=Object.getOwnPropertyNames;var T=Object.prototype.hasOwnProperty;var k=(r,a)=>{for(var m in a)y(r,m,{get:a[m],enumerable:!0})},M=(r,a,m,E)=>{if(a&&typeof a=="object"||typeof a=="function")for(let o of C(a))!T.call(r,o)&&o!==m&&y(r,o,{get:()=>a[o],enumerable:!(E=L(a,o))||E.enumerable});return r};var H=r=>M(y({},"__esModule",{value:!0}),r);var _={};k(_,{FormsLib:()=>f,default:()=>v});function b(r){console.log("Form submitted:",r)}function F(r,a){let m=[];if(typeof r=="string"?m=Array.from(document.querySelectorAll(r)):m=[r],m.length===0)return null;function E(){let l=document.createElement("form");l.id=a.id;let u=document.createElement("h2");u.textContent=a.form_name,l.appendChild(u);function c(e,n){n&&(n.min_length!==void 0&&(e.minLength=n.min_length),n.max_length!==void 0&&(e.maxLength=n.max_length),n.regex&&(e instanceof HTMLInputElement?e.pattern=n.regex:e.dataset.pattern=n.regex))}function p(e){if(!e.key&&!e.label)return null;let n=document.createElement("div");if(n.className="form-group",e.label){let t=document.createElement("label");t.htmlFor=e.key||"",t.textContent=e.label+(e.required?" *":""),n.appendChild(t)}let i=null;switch(e.type){case"textarea":{let t=document.createElement("textarea");e.key&&(t.name=e.key),e.required&&(t.required=!0),c(t,e.validation),i=t;break}case"select":{let t=document.createElement("select");e.key&&(t.name=e.key),e.required&&(t.required=!0),e.options&&e.options.forEach(d=>{let s=document.createElement("option");s.value=d.value,s.textContent=d.label,e.default===d.value&&(s.selected=!0),t.appendChild(s)}),i=t;break}case"radio":{let t=document.createElement("div");t.className="radio-group "+(e.direction||"vertical"),e.options&&e.options.forEach(d=>{let s=document.createElement("label");s.style.display=e.direction==="horizontal"?"inline-block":"block";let h=document.createElement("input");h.type="radio",h.name=e.key||"",h.value=d.value,s.appendChild(h),s.appendChild(document.createTextNode(d.label)),t.appendChild(s)}),i=t;break}default:{let t=document.createElement("input");t.type=e.type||"text",e.key&&(t.name=e.key),e.required&&(t.required=!0),c(t,e.validation),i=t;break}}if(i&&n.appendChild(i),e.hint_text){let t=document.createElement("small");t.className="hint",t.textContent=e.hint_text,n.appendChild(t)}return n}a.fields.forEach(e=>{if(e.type==="row"){let n=document.createElement("div");if(n.className="form-row",e.label){let i=document.createElement("h3");i.textContent=e.label,n.appendChild(i)}e.items.forEach(i=>{let t=p(i);t&&n.appendChild(t)}),l.appendChild(n)}else{let n=p(e);n&&l.appendChild(n)}});let g=document.createElement("button");return g.type="submit",g.textContent="Submit",l.appendChild(g),l}let o=E();return m[0].appendChild(o),{element:o,validate:()=>{let l=[];return o.querySelectorAll(":invalid").forEach(c=>{let p=c.validationMessage;l.push({element:c,message:p})}),l},submitForm:()=>{b(o)},getValues:()=>{let l=new FormData(o),u={};return l.forEach((c,p)=>{u[p]=c}),u}}}var x={renderForm:F};var f=x,v=f;return H(_);})();
package/dist/main.js CHANGED
@@ -1 +1 @@
1
- "use strict";var y=Object.defineProperty;var f=Object.getOwnPropertyDescriptor;var L=Object.getOwnPropertyNames;var C=Object.prototype.hasOwnProperty;var T=(r,a)=>{for(var m in a)y(r,m,{get:a[m],enumerable:!0})},k=(r,a,m,E)=>{if(a&&typeof a=="object"||typeof a=="function")for(let o of L(a))!C.call(r,o)&&o!==m&&y(r,o,{get:()=>a[o],enumerable:!(E=f(a,o))||E.enumerable});return r};var M=r=>k(y({},"__esModule",{value:!0}),r);var v={};T(v,{FormsLib:()=>H});module.exports=M(v);function b(r){console.log("Form submitted:",r)}function F(r,a){let m=[];if(typeof r=="string"?m=Array.from(document.querySelectorAll(r)):m=[r],m.length===0)return null;function E(){let l=document.createElement("form");l.id=a.id;let u=document.createElement("h2");u.textContent=a.form_name,l.appendChild(u);function c(e,n){n&&(n.min_length!==void 0&&(e.minLength=n.min_length),n.max_length!==void 0&&(e.maxLength=n.max_length),n.regex&&(e instanceof HTMLInputElement?e.pattern=n.regex:e.dataset.pattern=n.regex))}function p(e){if(!e.key&&!e.label)return null;let n=document.createElement("div");if(n.className="form-group",e.label){let t=document.createElement("label");t.htmlFor=e.key||"",t.textContent=e.label+(e.required?" *":""),n.appendChild(t)}let i=null;switch(e.type){case"textarea":{let t=document.createElement("textarea");e.key&&(t.name=e.key),e.required&&(t.required=!0),c(t,e.validation),i=t;break}case"select":{let t=document.createElement("select");e.key&&(t.name=e.key),e.required&&(t.required=!0),e.options&&e.options.forEach(d=>{let s=document.createElement("option");s.value=d.value,s.textContent=d.label,e.default===d.value&&(s.selected=!0),t.appendChild(s)}),i=t;break}case"radio":{let t=document.createElement("div");t.className="radio-group "+(e.direction||"vertical"),e.options&&e.options.forEach(d=>{let s=document.createElement("label");s.style.display=e.direction==="horizontal"?"inline-block":"block";let h=document.createElement("input");h.type="radio",h.name=e.key||"",h.value=d.value,s.appendChild(h),s.appendChild(document.createTextNode(d.label)),t.appendChild(s)}),i=t;break}default:{let t=document.createElement("input");t.type=e.type||"text",e.key&&(t.name=e.key),e.required&&(t.required=!0),c(t,e.validation),i=t;break}}if(i&&n.appendChild(i),e.hint_text){let t=document.createElement("small");t.className="hint",t.textContent=e.hint_text,n.appendChild(t)}return n}a.fields.forEach(e=>{if(e.type==="row"){let n=document.createElement("div");if(n.className="form-row",e.label){let i=document.createElement("h3");i.textContent=e.label,n.appendChild(i)}e.items.forEach(i=>{let t=p(i);t&&n.appendChild(t)}),l.appendChild(n)}else{let n=p(e);n&&l.appendChild(n)}});let g=document.createElement("button");return g.type="submit",g.textContent="Submit",l.appendChild(g),l}let o=E();return m[0].appendChild(o),{element:o,validate:()=>{let l=[];return o.querySelectorAll(":invalid").forEach(c=>{let p=c.validationMessage;l.push({element:c,message:p})}),l},submitForm:()=>{b(o)},getValues:()=>{let l=new FormData(o),u={};return l.forEach((c,p)=>{u[p]=c}),u}}}var x={renderForm:F};var H=x;0&&(module.exports={FormsLib});
1
+ "use strict";var y=Object.defineProperty;var L=Object.getOwnPropertyDescriptor;var C=Object.getOwnPropertyNames;var T=Object.prototype.hasOwnProperty;var k=(r,a)=>{for(var m in a)y(r,m,{get:a[m],enumerable:!0})},M=(r,a,m,E)=>{if(a&&typeof a=="object"||typeof a=="function")for(let o of C(a))!T.call(r,o)&&o!==m&&y(r,o,{get:()=>a[o],enumerable:!(E=L(a,o))||E.enumerable});return r};var H=r=>M(y({},"__esModule",{value:!0}),r);var _={};k(_,{FormsLib:()=>f,default:()=>v});module.exports=H(_);function b(r){console.log("Form submitted:",r)}function F(r,a){let m=[];if(typeof r=="string"?m=Array.from(document.querySelectorAll(r)):m=[r],m.length===0)return null;function E(){let l=document.createElement("form");l.id=a.id;let u=document.createElement("h2");u.textContent=a.form_name,l.appendChild(u);function c(e,n){n&&(n.min_length!==void 0&&(e.minLength=n.min_length),n.max_length!==void 0&&(e.maxLength=n.max_length),n.regex&&(e instanceof HTMLInputElement?e.pattern=n.regex:e.dataset.pattern=n.regex))}function p(e){if(!e.key&&!e.label)return null;let n=document.createElement("div");if(n.className="form-group",e.label){let t=document.createElement("label");t.htmlFor=e.key||"",t.textContent=e.label+(e.required?" *":""),n.appendChild(t)}let i=null;switch(e.type){case"textarea":{let t=document.createElement("textarea");e.key&&(t.name=e.key),e.required&&(t.required=!0),c(t,e.validation),i=t;break}case"select":{let t=document.createElement("select");e.key&&(t.name=e.key),e.required&&(t.required=!0),e.options&&e.options.forEach(d=>{let s=document.createElement("option");s.value=d.value,s.textContent=d.label,e.default===d.value&&(s.selected=!0),t.appendChild(s)}),i=t;break}case"radio":{let t=document.createElement("div");t.className="radio-group "+(e.direction||"vertical"),e.options&&e.options.forEach(d=>{let s=document.createElement("label");s.style.display=e.direction==="horizontal"?"inline-block":"block";let h=document.createElement("input");h.type="radio",h.name=e.key||"",h.value=d.value,s.appendChild(h),s.appendChild(document.createTextNode(d.label)),t.appendChild(s)}),i=t;break}default:{let t=document.createElement("input");t.type=e.type||"text",e.key&&(t.name=e.key),e.required&&(t.required=!0),c(t,e.validation),i=t;break}}if(i&&n.appendChild(i),e.hint_text){let t=document.createElement("small");t.className="hint",t.textContent=e.hint_text,n.appendChild(t)}return n}a.fields.forEach(e=>{if(e.type==="row"){let n=document.createElement("div");if(n.className="form-row",e.label){let i=document.createElement("h3");i.textContent=e.label,n.appendChild(i)}e.items.forEach(i=>{let t=p(i);t&&n.appendChild(t)}),l.appendChild(n)}else{let n=p(e);n&&l.appendChild(n)}});let g=document.createElement("button");return g.type="submit",g.textContent="Submit",l.appendChild(g),l}let o=E();return m[0].appendChild(o),{element:o,validate:()=>{let l=[];return o.querySelectorAll(":invalid").forEach(c=>{let p=c.validationMessage;l.push({element:c,message:p})}),l},submitForm:()=>{b(o)},getValues:()=>{let l=new FormData(o),u={};return l.forEach((c,p)=>{u[p]=c}),u}}}var x={renderForm:F};var f=x,v=f;0&&(module.exports={FormsLib});
package/dist/main.mjs CHANGED
@@ -1 +1 @@
1
- function g(c){console.log("Form submitted:",c)}function y(c,E){let p=[];if(typeof c=="string"?p=Array.from(document.querySelectorAll(c)):p=[c],p.length===0)return null;function F(){let r=document.createElement("form");r.id=E.id;let i=document.createElement("h2");i.textContent=E.form_name,r.appendChild(i);function l(e,n){n&&(n.min_length!==void 0&&(e.minLength=n.min_length),n.max_length!==void 0&&(e.maxLength=n.max_length),n.regex&&(e instanceof HTMLInputElement?e.pattern=n.regex:e.dataset.pattern=n.regex))}function m(e){if(!e.key&&!e.label)return null;let n=document.createElement("div");if(n.className="form-group",e.label){let t=document.createElement("label");t.htmlFor=e.key||"",t.textContent=e.label+(e.required?" *":""),n.appendChild(t)}let a=null;switch(e.type){case"textarea":{let t=document.createElement("textarea");e.key&&(t.name=e.key),e.required&&(t.required=!0),l(t,e.validation),a=t;break}case"select":{let t=document.createElement("select");e.key&&(t.name=e.key),e.required&&(t.required=!0),e.options&&e.options.forEach(s=>{let o=document.createElement("option");o.value=s.value,o.textContent=s.label,e.default===s.value&&(o.selected=!0),t.appendChild(o)}),a=t;break}case"radio":{let t=document.createElement("div");t.className="radio-group "+(e.direction||"vertical"),e.options&&e.options.forEach(s=>{let o=document.createElement("label");o.style.display=e.direction==="horizontal"?"inline-block":"block";let d=document.createElement("input");d.type="radio",d.name=e.key||"",d.value=s.value,o.appendChild(d),o.appendChild(document.createTextNode(s.label)),t.appendChild(o)}),a=t;break}default:{let t=document.createElement("input");t.type=e.type||"text",e.key&&(t.name=e.key),e.required&&(t.required=!0),l(t,e.validation),a=t;break}}if(a&&n.appendChild(a),e.hint_text){let t=document.createElement("small");t.className="hint",t.textContent=e.hint_text,n.appendChild(t)}return n}E.fields.forEach(e=>{if(e.type==="row"){let n=document.createElement("div");if(n.className="form-row",e.label){let a=document.createElement("h3");a.textContent=e.label,n.appendChild(a)}e.items.forEach(a=>{let t=m(a);t&&n.appendChild(t)}),r.appendChild(n)}else{let n=m(e);n&&r.appendChild(n)}});let h=document.createElement("button");return h.type="submit",h.textContent="Submit",r.appendChild(h),r}let u=F();return p[0].appendChild(u),{element:u,validate:()=>{let r=[];return u.querySelectorAll(":invalid").forEach(l=>{let m=l.validationMessage;r.push({element:l,message:m})}),r},submitForm:()=>{g(u)},getValues:()=>{let r=new FormData(u),i={};return r.forEach((l,m)=>{i[m]=l}),i}}}var b={renderForm:y};var M=b;export{M as FormsLib};
1
+ function g(c){console.log("Form submitted:",c)}function y(c,E){let p=[];if(typeof c=="string"?p=Array.from(document.querySelectorAll(c)):p=[c],p.length===0)return null;function F(){let r=document.createElement("form");r.id=E.id;let i=document.createElement("h2");i.textContent=E.form_name,r.appendChild(i);function l(e,n){n&&(n.min_length!==void 0&&(e.minLength=n.min_length),n.max_length!==void 0&&(e.maxLength=n.max_length),n.regex&&(e instanceof HTMLInputElement?e.pattern=n.regex:e.dataset.pattern=n.regex))}function m(e){if(!e.key&&!e.label)return null;let n=document.createElement("div");if(n.className="form-group",e.label){let t=document.createElement("label");t.htmlFor=e.key||"",t.textContent=e.label+(e.required?" *":""),n.appendChild(t)}let a=null;switch(e.type){case"textarea":{let t=document.createElement("textarea");e.key&&(t.name=e.key),e.required&&(t.required=!0),l(t,e.validation),a=t;break}case"select":{let t=document.createElement("select");e.key&&(t.name=e.key),e.required&&(t.required=!0),e.options&&e.options.forEach(s=>{let o=document.createElement("option");o.value=s.value,o.textContent=s.label,e.default===s.value&&(o.selected=!0),t.appendChild(o)}),a=t;break}case"radio":{let t=document.createElement("div");t.className="radio-group "+(e.direction||"vertical"),e.options&&e.options.forEach(s=>{let o=document.createElement("label");o.style.display=e.direction==="horizontal"?"inline-block":"block";let d=document.createElement("input");d.type="radio",d.name=e.key||"",d.value=s.value,o.appendChild(d),o.appendChild(document.createTextNode(s.label)),t.appendChild(o)}),a=t;break}default:{let t=document.createElement("input");t.type=e.type||"text",e.key&&(t.name=e.key),e.required&&(t.required=!0),l(t,e.validation),a=t;break}}if(a&&n.appendChild(a),e.hint_text){let t=document.createElement("small");t.className="hint",t.textContent=e.hint_text,n.appendChild(t)}return n}E.fields.forEach(e=>{if(e.type==="row"){let n=document.createElement("div");if(n.className="form-row",e.label){let a=document.createElement("h3");a.textContent=e.label,n.appendChild(a)}e.items.forEach(a=>{let t=m(a);t&&n.appendChild(t)}),r.appendChild(n)}else{let n=m(e);n&&r.appendChild(n)}});let h=document.createElement("button");return h.type="submit",h.textContent="Submit",r.appendChild(h),r}let u=F();return p[0].appendChild(u),{element:u,validate:()=>{let r=[];return u.querySelectorAll(":invalid").forEach(l=>{let m=l.validationMessage;r.push({element:l,message:m})}),r},submitForm:()=>{g(u)},getValues:()=>{let r=new FormData(u),i={};return r.forEach((l,m)=>{i[m]=l}),i}}}var b={renderForm:y};var x=b,H=x;export{x as FormsLib,H as default};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "voc-lib-js",
3
- "version": "1.0.7",
3
+ "version": "1.0.9",
4
4
  "description": "A JavaScript library for VocPhone",
5
5
  "main": "./dist/main.cjs",
6
6
  "module": "./dist/main.mjs",