@sandboxed/unitjs 2.2.0 → 2.2.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.
package/LICENSE CHANGED
@@ -1,19 +1,202 @@
1
- Copyright (c) 2018 Victor Cruz <vmcruz16@gmail.com>
2
-
3
- Permission is hereby granted, free of charge, to any person obtaining a copy
4
- of this software and associated documentation files (the "Software"), to deal
5
- in the Software without restriction, including without limitation the rights
6
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
- copies of the Software, and to permit persons to whom the Software is
8
- furnished to do so, subject to the following conditions:
9
-
10
- The above copyright notice and this permission notice shall be included in all
11
- copies or substantial portions of the Software.
12
-
13
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19
- SOFTWARE.
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [2025] [Víctor Cruz]
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
package/README.md CHANGED
@@ -1,6 +1,5 @@
1
- # UnitJS v2.0.0 [![CI](https://github.com/vmcruz/UnitJS/actions/workflows/ci.yml/badge.svg)](https://github.com/vmcruz/UnitJS/actions/workflows/ci.yml)
2
-
3
1
  # About
2
+
4
3
  UnitJS is a personal project I've been developing over the years. It follows the `Revealing Module Pattern` along with the [`IIFE Pattern`](http://benalman.com/news/2010/11/immediately-invoked-function-expression/). Started as a simple script for one website, but I realized that as I developed new websites, the same functionality was required. Instead of copy&pasting the code, I decided to start building this library for personal use.
5
4
 
6
5
  The aim of this library is not the support of all web browsers, but to have a lightweight library with JQuery like syntax for specific projects such as: Extensions, plugins, and/or applications.
@@ -16,6 +15,7 @@ yarn add @sandboxed/unitjs
16
15
  Or simple download the version you like from `lib/`, and import the library right into your development environment.
17
16
 
18
17
  ### Browser
18
+
19
19
  ```javascript
20
20
  <script type="module">
21
21
  // ESM only
@@ -26,6 +26,7 @@ Or simple download the version you like from `lib/`, and import the library righ
26
26
  ```
27
27
 
28
28
  ### ESM
29
+
29
30
  ```javascript
30
31
  import { UnitJS as $ } from '@sandboxed/unitjs';
31
32
 
@@ -33,6 +34,7 @@ $(document).ready(() => console.log('ready'));
33
34
  ```
34
35
 
35
36
  ### CommonJS
37
+
36
38
  ```javascript
37
39
  // CJS option 1
38
40
  const $ = require('@sandboxed/unitjs').default;
@@ -44,15 +46,19 @@ $(document).ready(() => console.log('ready'));
44
46
  ```
45
47
 
46
48
  ## What about JQuery
49
+
47
50
  Since JQuery cares about giving support to the vast of web browsers, it tends to be heavy. Most of its functions are not even used, like animations. I've seen projects that require JQuery just to use AJAX functionality, or just the animations. This is the reason I began developing UnitJS.
48
51
 
49
52
  ## What about UnitJS
53
+
50
54
  I believe a library should have a purpose and one purpose only. In this case, I built UnitJS to have just the one thing I used the most in JQuery: DOM manipulation. I could add AJAX functionality, or even animations, but then I'll be creating a JQuery copy. UnitJS is just there to manipulate the DOM, to make your life easier, not to learn a whole new framework just to start coding.
51
55
 
52
56
  ## You should use UnitJS
57
+
53
58
  No, you don't need to!. UnitJS was built for personal use, but you're free to use it if you need it. Be aware though, this library doesn't support all browsers and will not (until all browsers support ES6 I guess).
54
59
 
55
60
  If you just started learning JavaScript, perhaps you shouldn't use this at all. You need to understand what's happening behind scenes before using this library (or any library or framework for that matter).
56
61
 
57
62
  ## That being said
63
+
58
64
  Feel free to fork and redo as much as you need. Let me know what you did or change to build a better UnitJS.
@@ -1 +1,2 @@
1
1
  "use strict";var _=Object.defineProperty;var tt=Object.getOwnPropertyDescriptor;var et=Object.getOwnPropertyNames;var rt=Object.prototype.hasOwnProperty;var h=(t,r)=>{for(var n in r)_(t,n,{get:r[n],enumerable:!0})},nt=(t,r,n,e)=>{if(r&&typeof r=="object"||typeof r=="function")for(let i of et(r))!rt.call(t,i)&&i!==n&&_(t,i,{get:()=>r[i],enumerable:!(e=tt(r,i))||e.enumerable});return t};var ot=t=>nt(_({},"__esModule",{value:!0}),t);var Lt={};h(Lt,{UnitJS:()=>u});module.exports=ot(Lt);var s={};h(s,{addClass:()=>C,append:()=>E,attr:()=>v,css:()=>w,data:()=>T,each:()=>M,first:()=>b,firstChild:()=>L,get:()=>V,hasClass:()=>A,html:()=>H,on:()=>N,parent:()=>k,prepend:()=>F,ready:()=>$,remove:()=>D,removeClass:()=>G,text:()=>P,toggleClass:()=>j,value:()=>R});var g=class extends Error{constructor(r,...n){super(...n),this.name="RequiredType",this.message=r}},y=g;function l(t){return t==null}function o({values:t,typeOf:r=[],instanceOf:n=[],allowEmptyString:e=!1}){let i=n.map(p=>p.name),a=[...r,...i];if(l(t)||!Array.isArray(t))throw new y(`Expected all values to be [ ${a.join(", ")} ] type, but got [ ${typeof t} ]`);let d="undefined";if(t.some(p=>{if(typeof p=="string"&&p===""&&e===!1)return!0;d=typeof p;let z=r.includes(d),Q=n.some(Z=>p instanceof Z);return!z&&!Q}))throw new y(`Expected all values to be [ ${a.join(", ")} ] type, but got [ ${d} ]`);return!0}function S(t){let[r,...n]=t.split("-"),e=n.map(i=>`${i.charAt(0).toUpperCase()}${i.slice(1).toLowerCase()}`);return`${r.toLowerCase()}${e.join("")}`}function st(...t){return o({values:t,typeOf:["string"]}),this.__nodes__.forEach(r=>{r.classList.add(...t)}),this}var C=st;function it(t){o({values:[t],typeOf:["string"],instanceOf:[Element],allowEmptyString:!0});let r=typeof t=="string"?document.createTextNode(t):t;return this.__nodes__.forEach(n=>{n.appendChild(r)}),this}var E=it;function at(t,r){return o({values:[t],typeOf:["string"]}),l(r)?this.__nodes__[0].hasAttribute(t)?this.__nodes__[0].getAttribute(t):null:(this.__nodes__.forEach(n=>{n.setAttribute(t,r)}),this)}var v=at;var O=/(?<value>.+?)(?:\s+!(?<important>important))?\s*$/i,U=["January","February","March","April","May","June","July","August","September","October","November","December"],x=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],J=["click","dblclick","mousedown","mouseup","mousemove","mouseenter","mouseleave","mouseover","mouseout","auxclick","contextmenu","wheel","pointerdown","pointerup","pointermove","pointerenter","pointerleave","pointercancel","keydown","keyup","keypress","touchstart","touchend","touchmove","touchcancel","drag","dragstart","dragend","dragenter","dragleave","dragover","drop","scroll","focus","blur","input","change","submit"];function lt(t,r){if(o({values:[t],typeOf:["string"]}),l(r))return window.getComputedStyle(this.__nodes__[0]).getPropertyValue(t);o({values:[r],typeOf:["string"]});let n=r?.match(O);if(n)return this.__nodes__.forEach(e=>{e.style.setProperty(t,n.groups?.value,n.groups?.important)}),this;throw new TypeError("Unkown CSSStyleValue")}var w=lt;function ft(t,r){o({values:[t],typeOf:["string"]});let n=S(t);return l(r)?this.__nodes__[0].dataset[n]:(o({values:[r],typeOf:["string"],allowEmptyString:!0}),this.__nodes__.forEach(e=>{e.dataset[n]=r}),this)}var T=ft;function pt(...t){return o({values:t,typeOf:["function"]}),this.__nodes__.forEach((r,n,e)=>{t.forEach(i=>i(r,n,e))}),this}var M=pt;function mt(){return this.__nodes__.length?this.__nodes__[0]:null}var b=mt;function ut(){return this.__nodes__.length?this.__nodes__[0].firstChild:null}var L=ut;function dt(t,r=!0){o({values:[t],typeOf:["string"]});let n=r?"every":"some";return this.__nodes__[n](e=>e.classList.contains(t))}var A=dt;function ct(t,r=!1){if(l(t))return this.__nodes__[0].innerHTML;let n=t instanceof HTMLElement?t.innerHTML:t;return o({values:[n],typeOf:["string"],instanceOf:[HTMLElement],allowEmptyString:!0}),this.__nodes__.forEach(e=>{r?e.innerHTML+=n:e.innerHTML=n}),this}var H=ct;function _t(t,...r){return o({values:[t],typeOf:["string"]}),o({values:r,typeOf:["function"]}),this.__nodes__.forEach(n=>{r.forEach(e=>n.addEventListener(t,e,!1))}),this}var N=_t;function ht(){return this.__nodes__.length?this.__nodes__[0].parentNode:null}var k=ht;function gt(t){o({values:[t],typeOf:["string"],instanceOf:[HTMLElement],allowEmptyString:!0});let r=typeof t=="string"?document.createTextNode(t):t;return this.__nodes__.forEach(n=>{n.insertBefore(r,n.firstChild)}),this}var F=gt;function yt(t){return o({values:[t],typeOf:["function"]}),this.__nodes__.forEach(r=>{r instanceof Window||r.nodeType===1?r.addEventListener("load",t,!1):r.addEventListener("DOMContentLoaded",t,!1)}),this}var $=yt;function St(t){return o({values:[t],instanceOf:[Element]}),this.__nodes__.forEach(r=>{try{r.removeChild(t)}catch{throw new SyntaxError(`${t} is not a child of this node`)}}),this}var D=St;function Ct(...t){return o({values:t,typeOf:["string"]}),this.__nodes__.forEach(r=>{r.classList.remove(...t)}),this}var G=Ct;function Et(t){return l(t)?this.__nodes__[0].textContent:(o({values:[t],typeOf:["string"],allowEmptyString:!0}),this.__nodes__.forEach(r=>{r.textContent=t}),this)}var P=Et;function vt(...t){return o({values:t,typeOf:["string"]}),this.__nodes__.forEach(r=>{t.forEach(n=>r.classList.toggle(n))}),this}var j=vt;function Ot(t){return l(t)?this.__nodes__[0].value:(this.__nodes__.forEach(r=>{r.value=t}),this)}var R=Ot;function Ut(t){return this.__nodes__.length?this.__nodes__[t]:null}var V=Ut;var m={};h(m,{create:()=>Y,date:()=>I,i18n:()=>B,navigate:()=>q});function xt(t){return o({values:[t],typeOf:["string"]}),document.createElement(t)}var Y=xt;var f=class t{__nodes__=[];static __i18n__={months:U,days:x};constructor(...r){r.forEach(n=>{if(typeof n=="string")try{let e=Array.from(document.querySelectorAll(n));this.__nodes__.push(...e)}catch{throw new SyntaxError(`${n} is not a valid DOM selector`)}else this.__nodes__.push(n)}),J.forEach(n=>{t.prototype[n]=function(e){return e&&typeof e=="function"?this.on(n,e):this.each(i=>{let a=i[n];typeof a=="function"&&a.call(i)}),this}})}get length(){return this.__nodes__.length}get nodes(){return this.__nodes__}addClass=s.addClass;append=s.append;attr=s.attr;css=s.css;data=s.data;each=s.each;first=s.first;firstChild=s.firstChild;hasClass=s.hasClass;html=s.html;on=s.on;parent=s.parent;prepend=s.prepend;ready=s.ready;remove=s.remove;removeClass=s.removeClass;text=s.text;toggleClass=s.toggleClass;value=s.value;get=s.get};function Jt(t,r=Date.now(),n=0){if(o({values:[t],typeOf:["string"]}),o({values:[n,r],typeOf:["number"]}),!t)throw new TypeError("Empty string is not a valid string format");let e={},i=n*60*60*1e3,a=new Date(r+i);return e.d=a.getUTCDate().toString().padStart(2,"0"),e.j=a.getUTCDate(),e.w=a.getUTCDay(),e.N=e.w===0?7:e.w,e.m=(a.getUTCMonth()+1).toString().padStart(2,"0"),e.n=a.getUTCMonth()+1,e.Y=a.getUTCFullYear(),e.y=e.Y.toString().slice(-2),e.a="am",e.A="AM",e.G=a.getUTCHours(),e.H=e.G.toString().padStart(2,"0"),e.g=e.G===0?12:e.G,e.G>12&&(e.a="pm",e.A="PM",e.g=e.G-12),e.h=e.g.toString().padStart(2,"0"),e.i=a.getUTCMinutes().toString().padStart(2,"0"),e.s=a.getUTCSeconds().toString().padStart(2,"0"),e.v=a.getMilliseconds().toString().padStart(3,"0"),e.l=f.__i18n__.days[e.w],e.D=e.l.substring(0,3),e.F=f.__i18n__.months[a.getUTCMonth()],e.M=e.F.substring(0,3),[...t].reduce((c,p)=>(c+=Object.hasOwn(e,p)?e[p]:p,c),"")}var I=Jt;function wt(t){return o({values:[t],typeOf:["string"]}),window.location=t,window.location}var q=wt;function Tt(t){if(o({values:t,typeOf:["string"]}),t.length!==7)throw new SyntaxError(`Expected the days array to have exactly 7 entries, but got ${t.length}`);f.__i18n__.days=t}var K=Tt;function Mt(t){if(o({values:t,typeOf:["string"]}),t.length!==12)throw new SyntaxError(`Expected the months array to have exactly 12 entries, but got ${t.length}`);f.__i18n__.months=t}var W=Mt;function bt(){return f.__i18n__}var X=bt;var B={days:K,months:W,get:X};var u=(...t)=>new f(...t);u.create=m.create;u.date=m.date;u.navigate=m.navigate;u.i18n=m.i18n;0&&(module.exports={UnitJS});
2
+ //# sourceMappingURL=unit.min.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/unit.ts","../../src/methods/public/index.ts","../../src/utils/RequiredType.error.ts","../../src/utils/fns.ts","../../src/methods/public/addClass.ts","../../src/methods/public/append.ts","../../src/methods/public/attr.ts","../../src/constants/index.ts","../../src/methods/public/css.ts","../../src/methods/public/data.ts","../../src/methods/public/each.ts","../../src/methods/public/first.ts","../../src/methods/public/firstChild.ts","../../src/methods/public/hasClass.ts","../../src/methods/public/html.ts","../../src/methods/public/on.ts","../../src/methods/public/parent.ts","../../src/methods/public/prepend.ts","../../src/methods/public/ready.ts","../../src/methods/public/remove.ts","../../src/methods/public/removeClass.ts","../../src/methods/public/text.ts","../../src/methods/public/toggleClass.ts","../../src/methods/public/value.ts","../../src/methods/public/get.ts","../../src/methods/static/index.ts","../../src/methods/static/create.ts","../../src/unit.class.ts","../../src/methods/static/date.ts","../../src/methods/static/navigate.ts","../../src/methods/static/i18n/days.ts","../../src/methods/static/i18n/months.ts","../../src/methods/static/i18n/get.ts","../../src/methods/static/i18n/index.ts"],"sourcesContent":["import { staticMethods } from './methods';\nimport { UnitJSClass } from './unit.class';\n\nconst UnitJS = (...selectors: any[]) => new UnitJSClass(...selectors);\n\nUnitJS.create = staticMethods.create;\nUnitJS.date = staticMethods.date;\nUnitJS.navigate = staticMethods.navigate;\nUnitJS.i18n = staticMethods.i18n;\n\nexport { UnitJS };\n","import addClass from './addClass';\nimport append from './append';\nimport attr from './attr';\nimport css from './css';\nimport data from './data';\nimport each from './each';\nimport first from './first';\nimport firstChild from './firstChild';\nimport hasClass from './hasClass';\nimport html from './html';\nimport on from './on';\nimport parent from './parent';\nimport prepend from './prepend';\nimport ready from './ready';\nimport remove from './remove';\nimport removeClass from './removeClass';\nimport text from './text';\nimport toggleClass from './toggleClass';\nimport value from './value';\nimport get from './get';\n\nexport {\n addClass,\n append,\n attr,\n css,\n data,\n each,\n first,\n firstChild,\n hasClass,\n html,\n on,\n parent,\n prepend,\n ready,\n remove,\n removeClass,\n text,\n toggleClass,\n value,\n get,\n};\n","class RequiredType extends Error {\n constructor(message: string, ...params: any[]) {\n super(...params);\n\n this.name = 'RequiredType';\n this.message = message;\n }\n}\n\nexport default RequiredType;\n","import { type PrimitiveType } from '../types';\nimport RequiredType from './RequiredType.error';\n\n/**\n * Validates whether the value is null or undefined\n */\nexport function isNullOrUndefined(value: unknown): value is null | undefined {\n return value === null || value === undefined;\n}\n\ntype AllOfArguments = {\n values: any[];\n typeOf?: PrimitiveType[];\n // eslint-disable-next-line @typescript-eslint/no-unsafe-function-type\n instanceOf?: Function[];\n allowEmptyString?: boolean;\n};\n\n/**\n * Validates that all values in the array conform to at least one of the specified primitive types\n * or are instances of one of the specified constructor functions.\n */\nexport function allOf({\n values,\n typeOf = [],\n instanceOf = [],\n allowEmptyString = false,\n}: AllOfArguments) {\n const instancesNames = instanceOf.map((instance) => instance.name);\n const expectedData = [...typeOf, ...instancesNames];\n\n if (isNullOrUndefined(values) || !Array.isArray(values)) {\n throw new RequiredType(\n `Expected all values to be [ ${expectedData.join(', ')} ] type, but got [ ${typeof values} ]`\n );\n }\n\n let currentType: PrimitiveType = 'undefined';\n\n const notConforms = values.some((value) => {\n if (\n typeof value === 'string' &&\n value === '' &&\n allowEmptyString === false\n ) {\n return true;\n }\n\n currentType = typeof value;\n\n const isSupportedType = typeOf.includes(currentType);\n const isSupportedInstance = instanceOf.some(\n (instance) => value instanceof instance\n );\n\n return !isSupportedType && !isSupportedInstance;\n });\n\n if (notConforms) {\n throw new RequiredType(\n `Expected all values to be [ ${expectedData.join(', ')} ] type, but got [ ${currentType} ]`\n );\n }\n\n return true;\n}\n\n/**\n * Returns the camel case representation of a kebab cased string\n */\nexport function camelFromKebab(kebab: string) {\n const [lower, ...rest] = kebab.split('-');\n const pascalRest = rest.map(\n (word) => `${word.charAt(0).toUpperCase()}${word.slice(1).toLowerCase()}`\n );\n\n return `${lower.toLowerCase()}${pascalRest.join('')}`;\n}\n","import { UnitJSClass } from '../../unit.class';\nimport { allOf } from '../../utils/fns';\n\n/**\n * Adds one or more CSS classes to each node.\n *\n * @this {UnitJSClass}\n * @param {...string} classNames - One or more class names to add.\n * @returns {this} The current instance for chaining.\n * @throws {RequiredType} If any className is not a string.\n */\nfunction addClass(this: UnitJSClass, ...classNames: string[]) {\n allOf({ values: classNames, typeOf: ['string'] });\n\n this.__nodes__.forEach((node) => {\n node.classList.add(...classNames);\n });\n\n return this;\n}\n\nexport default addClass;\n","import { UnitJSClass } from '../../unit.class';\nimport { allOf } from '../../utils/fns';\n\n/**\n * Appends a DOM element or a text node (from string) to each node.\n *\n * @param {string | Element} element - A string to create a text node, or a DOM node to append.\n * @returns {this} The current instance for chaining.\n * @throws {RequiredType} If the input is neither a string nor a Node.\n */\nfunction append(this: UnitJSClass, element: string | Element) {\n allOf({\n values: [element],\n typeOf: ['string'],\n instanceOf: [Element],\n allowEmptyString: true,\n });\n\n const htmlElement =\n typeof element === 'string' ? document.createTextNode(element) : element;\n\n this.__nodes__.forEach((node) => {\n node.appendChild(htmlElement);\n });\n\n return this;\n}\n\nexport default append;\n","import { UnitJSClass } from '../../unit.class';\nimport { allOf, isNullOrUndefined } from '../../utils/fns';\n\n/**\n * Gets or sets the value of a specified attribute on DOM nodes in the current context.\n *\n * @param {string} attribute - The name of the attribute to get or set.\n * @param {string} [value] - The value to assign. If omitted, the current value is returned.\n * @returns {string|this} Returns the attribute value, or the current instance for chaining.\n * @throws {RequiredType} If `attribute` is not a string or `value` (when provided) is not a string.\n */\nfunction attr(this: UnitJSClass, attribute: string, value?: string) {\n allOf({ values: [attribute], typeOf: ['string'] });\n\n if (isNullOrUndefined(value)) {\n if (this.__nodes__[0].hasAttribute(attribute)) {\n return this.__nodes__[0].getAttribute(attribute);\n }\n\n return null;\n }\n\n this.__nodes__.forEach((node) => {\n node.setAttribute(attribute, value);\n });\n\n return this;\n}\n\nexport default attr;\n","export const CSS_VALUE_REGEX =\n /(?<value>.+?)(?:\\s+!(?<important>important))?\\s*$/i;\n\nexport const MONTHS = [\n 'January',\n 'February',\n 'March',\n 'April',\n 'May',\n 'June',\n 'July',\n 'August',\n 'September',\n 'October',\n 'November',\n 'December',\n];\n\nexport const DAYS = [\n 'Sunday',\n 'Monday',\n 'Tuesday',\n 'Wednesday',\n 'Thursday',\n 'Friday',\n 'Saturday',\n];\n\nexport const SHORTCUT_EVENTS = [\n // Mouse\n 'click',\n 'dblclick',\n 'mousedown',\n 'mouseup',\n 'mousemove',\n 'mouseenter',\n 'mouseleave',\n 'mouseover',\n 'mouseout',\n 'auxclick',\n 'contextmenu',\n 'wheel',\n\n // Pointer (covers mouse, touch, pen)\n 'pointerdown',\n 'pointerup',\n 'pointermove',\n 'pointerenter',\n 'pointerleave',\n 'pointercancel',\n\n // Keyboard\n 'keydown',\n 'keyup',\n 'keypress',\n\n // Touch\n 'touchstart',\n 'touchend',\n 'touchmove',\n 'touchcancel',\n\n // Drag & Drop\n 'drag',\n 'dragstart',\n 'dragend',\n 'dragenter',\n 'dragleave',\n 'dragover',\n 'drop',\n\n // Scroll & focus\n 'scroll',\n 'focus',\n 'blur',\n\n // Form\n 'input',\n 'change',\n 'submit',\n];\n","import { CSS_VALUE_REGEX } from '../../constants';\nimport { UnitJSClass } from '../../unit.class';\nimport { allOf, isNullOrUndefined } from '../../utils/fns';\n\n/**\n * Gets or sets a CSS property on all nodes in the current context.\n *\n * @param {string} property - The CSS property name (in camelCase or kebab-case).\n * @param {string} [value] - The value to set for the CSS property. If omitted, acts as a getter.\n * @returns {string|this} The computed style value, or the current instance for chaining.\n * @throws {RequiredType} If `property` is not a string or `value` (when provided) is not a string.\n */\nfunction css(this: UnitJSClass, property: string, value?: string) {\n allOf({ values: [property], typeOf: ['string'] });\n\n if (isNullOrUndefined(value)) {\n const computedStyles = window.getComputedStyle(this.__nodes__[0]);\n\n return computedStyles.getPropertyValue(property);\n }\n\n allOf({ values: [value], typeOf: ['string'] });\n\n const matches = value?.match(CSS_VALUE_REGEX);\n\n if (matches) {\n this.__nodes__.forEach((node) => {\n node.style.setProperty(\n property,\n matches.groups?.value,\n matches.groups?.important\n );\n });\n\n return this;\n }\n\n throw new TypeError('Unkown CSSStyleValue');\n}\n\nexport default css;\n","import { UnitJSClass } from '../../unit.class';\nimport { allOf, camelFromKebab, isNullOrUndefined } from '../../utils/fns';\n\n/**\n * Gets or sets a data attribute (from `dataset`) on all nodes in the current context.\n *\n * @param {string} property - The camelCase name of the data attribute (without 'data-' prefix).\n * @param {string} [value] - The value to set for the data attribute. If omitted, acts as a getter.\n * @returns {string|this} The data attribute value, or the current instance for chaining.\n * @throws {RequiredType} If `property` is not a string or `value` (when provided) is not a string.\n */\nfunction data(this: UnitJSClass, property: string, value?: string) {\n allOf({ values: [property], typeOf: ['string'] });\n\n const camelProperty = camelFromKebab(property);\n\n if (isNullOrUndefined(value)) {\n return this.__nodes__[0].dataset[camelProperty];\n }\n\n allOf({ values: [value], typeOf: ['string'], allowEmptyString: true });\n\n this.__nodes__.forEach((node) => {\n node.dataset[camelProperty] = value;\n });\n\n return this;\n}\n\nexport default data;\n","import { FunctionSignature } from '../../types';\nimport { UnitJSClass } from '../../unit.class';\nimport { allOf } from '../../utils/fns';\n\n/**\n * Executes one or more callback functions on each node.\n *\n * @param {...Function} fns - One or more functions to execute on each node. Each function\n * should accept `(node, index, nodesArray)` as arguments.\n * @returns {this} The current instance for chaining.\n * @throws {RequiredType} If any argument is not a function.\n */\nfunction each(this: UnitJSClass, ...fns: FunctionSignature[]) {\n allOf({ values: fns, typeOf: ['function'] });\n\n this.__nodes__.forEach((node, index, nodeArray) => {\n fns.forEach((fn) => fn(node, index, nodeArray));\n });\n\n return this;\n}\n\nexport default each;\n","import { UnitJSClass } from '../../unit.class';\n\n/**\n * Returns the first node in the collection.\n *\n * @returns {any|null} The first node, or `null` if empty.\n */\nfunction first(this: UnitJSClass) {\n if (!this.__nodes__.length) {\n return null;\n }\n\n return this.__nodes__[0];\n}\n\nexport default first;\n","import { UnitJSClass } from '../../unit.class';\n\n/**\n * Returns the first child node of the first element.\n *\n * @returns {Node|null} The first child node, or `null` if none.\n */\nfunction firstChild(this: UnitJSClass) {\n if (!this.__nodes__.length) {\n return null;\n }\n\n return this.__nodes__[0].firstChild;\n}\n\nexport default firstChild;\n","import { UnitJSClass } from '../../unit.class';\nimport { allOf } from '../../utils/fns';\n\n/**\n * Checks if nodes have the specified class.\n *\n * @param {string} className - The class name to check.\n * @param {boolean} [strict=true] - If `true`, all nodes must have the class; otherwise, some.\n * @returns {boolean} Whether the nodes meet the class condition.\n * @throws {RequiredType} If `className` is not a string.\n */\nfunction hasClass(this: UnitJSClass, className: string, strict = true) {\n allOf({ values: [className], typeOf: ['string'] });\n\n const method = strict ? 'every' : 'some';\n\n return this.__nodes__[method]((node) => node.classList.contains(className));\n}\n\nexport default hasClass;\n","import { UnitJSClass } from '../../unit.class';\nimport { allOf, isNullOrUndefined } from '../../utils/fns';\n\n/**\n * Gets or sets the HTML content of nodes.\n *\n * @param {string|HTMLElement} [html] - HTML string or element to set or append.\n * @param {boolean} [append=false] - If `true`, appends instead of replacing.\n * @returns {string|this} HTML string if getting, or the current instance for chaining if setting.\n * @throws {RequiredType} If `html` is provided and is not a string or HTMLElement.\n */\nfunction html(this: UnitJSClass, html?: string | HTMLElement, append = false) {\n if (isNullOrUndefined(html)) {\n return this.__nodes__[0].innerHTML;\n }\n\n const strHtml = html instanceof HTMLElement ? html.innerHTML : html;\n\n allOf({\n values: [strHtml],\n typeOf: ['string'],\n instanceOf: [HTMLElement],\n allowEmptyString: true,\n });\n\n this.__nodes__.forEach((node) => {\n if (append) {\n node.innerHTML += strHtml;\n } else {\n node.innerHTML = strHtml;\n }\n });\n\n return this;\n}\n\nexport default html;\n","import { UnitJSClass } from '../../unit.class';\nimport { allOf } from '../../utils/fns';\n\n/**\n * Attaches one or more event listeners to all nodes.\n *\n * @param {string} event - The event type to listen for.\n * @param {...Function} fns - One or more handler functions.\n * @returns {this} The current instance for chaining.\n * @throws {RequiredType} If `event` is not a string or any handler is not a function.\n */\nfunction on(\n this: UnitJSClass,\n event: keyof HTMLElementEventMap,\n ...fns: ((ev: Event) => void)[]\n) {\n allOf({ values: [event], typeOf: ['string'] });\n allOf({ values: fns, typeOf: ['function'] });\n\n this.__nodes__.forEach((node) => {\n fns.forEach((fn) => node.addEventListener(event, fn, false));\n });\n\n return this;\n}\n\nexport default on;\n","import { UnitJSClass } from '../../unit.class';\n\n/**\n * Returns the parent node of the first element.\n *\n * @returns {HTMLElement|null} The parent node, or `null` if empty.\n */\nfunction parent(this: UnitJSClass) {\n if (!this.__nodes__.length) {\n return null;\n }\n\n return this.__nodes__[0].parentNode;\n}\n\nexport default parent;\n","import { UnitJSClass } from '../../unit.class';\nimport { allOf } from '../../utils/fns';\n\n/**\n * Prepends a DOM element or a text node (from string) to each node.\n *\n * @param {string | HTMLElement} element - A string to create a text node, or a DOM node to prepend.\n * @returns {this} The current instance for chaining.\n * @throws {RequiredType} If the input is neither a string nor a Node.\n */\nfunction prepend(this: UnitJSClass, element: string | HTMLElement) {\n allOf({\n values: [element],\n typeOf: ['string'],\n instanceOf: [HTMLElement],\n allowEmptyString: true,\n });\n\n const htmlElement =\n typeof element === 'string' ? document.createTextNode(element) : element;\n\n this.__nodes__.forEach((node) => {\n node.insertBefore(htmlElement, node.firstChild);\n });\n\n return this;\n}\n\nexport default prepend;\n","import { UnitJSClass } from '../../unit.class';\nimport { allOf } from '../../utils/fns';\n\n/**\n * Adds a 'load' event listener to each node.\n * Useful for elements like images, iframes, and window.\n *\n * @param {Function} fn - The handler for the 'load' event.\n * @returns {this} The current instance for chaining.\n * @throws {RequiredType} If `fn` is not a function.\n */\nfunction ready(this: UnitJSClass, fn: (ev: Event) => void) {\n allOf({ values: [fn], typeOf: ['function'] });\n\n this.__nodes__.forEach((node) => {\n if (node instanceof Window || node.nodeType === 1) {\n node.addEventListener('load', fn, false);\n } else {\n node.addEventListener('DOMContentLoaded', fn, false);\n }\n });\n return this;\n}\n\nexport default ready;\n","import { UnitJSClass } from '../../unit.class';\nimport { allOf } from '../../utils/fns';\n\n/**\n * Removes a specified child element from each node.\n *\n * @param {Element} element - The child element to remove.\n * @returns {this} The current instance for chaining.\n * @throws {RequiredType} If `element` is not an Element.\n */\nfunction remove(this: UnitJSClass, element: Element) {\n allOf({ values: [element], instanceOf: [Element] });\n\n this.__nodes__.forEach((node) => {\n try {\n node.removeChild(element);\n } catch {\n throw new SyntaxError(`${element} is not a child of this node`);\n }\n });\n\n return this;\n}\n\nexport default remove;\n","import { UnitJSClass } from '../../unit.class';\nimport { allOf } from '../../utils/fns';\n\n/**\n * Removes one or more classes from all nodes.\n *\n * @param {...string} classNames - One or more class names to remove.\n * @returns {this} The current instance for chaining.\n * @throws {RequiredType} If any class name is not a string.\n */\nfunction removeClass(this: UnitJSClass, ...classNames: string[]) {\n allOf({ values: classNames, typeOf: ['string'] });\n\n this.__nodes__.forEach((node) => {\n node.classList.remove(...classNames);\n });\n\n return this;\n}\n\nexport default removeClass;\n","import { UnitJSClass } from '../../unit.class';\nimport { allOf, isNullOrUndefined } from '../../utils/fns';\n\n/**\n * Gets or sets the text content of nodes.\n *\n * @param {string} [text] - The text to set.\n * @returns {string|this} The text content, or the current instance for chaining if setting.\n * @throws {RequiredType} If `text` is provided and is not a string.\n */\nfunction text(this: UnitJSClass, text?: string) {\n if (isNullOrUndefined(text)) {\n return this.__nodes__[0].textContent;\n }\n\n allOf({ values: [text], typeOf: ['string'], allowEmptyString: true });\n\n this.__nodes__.forEach((node) => {\n node.textContent = text;\n });\n\n return this;\n}\n\nexport default text;\n","import { UnitJSClass } from '../../unit.class';\nimport { allOf } from '../../utils/fns';\n\n/**\n * Toggles one or more classes on all nodes.\n *\n * @param {...string} classNames - Classes to toggle.\n * @returns {this} The current instance for chaining.\n * @throws {RequiredType} If any class name is not a string.\n */\nfunction toggleClass(this: UnitJSClass, ...classNames: string[]) {\n allOf({ values: classNames, typeOf: ['string'] });\n\n this.__nodes__.forEach((node) => {\n classNames.forEach((className) => node.classList.toggle(className));\n });\n\n return this;\n}\n\nexport default toggleClass;\n","import { UnitJSClass } from '../../unit.class';\nimport { isNullOrUndefined } from '../../utils/fns';\n\n/**\n * Gets or sets the `value` property of nodes.\n *\n * @param {any} [value] - The value to set.\n * @returns {string|this} The value if getting, or the current instance for chaining if setting.\n */\nfunction value(this: UnitJSClass, value?: any) {\n if (isNullOrUndefined(value)) {\n return (this.__nodes__[0] as HTMLInputElement).value;\n }\n\n this.__nodes__.forEach((node) => {\n (node as HTMLInputElement).value = value;\n });\n\n return this;\n}\n\nexport default value;\n","import { UnitJSClass } from '../../unit.class';\n\n/**\n * Returns the nth node in the collection.\n *\n * @returns {any|null} The nth node, or `null` if empty.\n */\nfunction get(this: UnitJSClass, index: number) {\n if (!this.__nodes__.length) {\n return null;\n }\n\n return this.__nodes__[index];\n}\n\nexport default get;\n","import create from './create';\nimport date from './date';\nimport navigate from './navigate';\nimport i18n from './i18n';\n\nexport { create, date, navigate, i18n };\n","import { allOf } from '../../utils/fns';\n\n/**\n * Creates a new DOM element by tag name.\n *\n * @param {string} element - The tag name of the element to create.\n * @returns {HTMLElement} The created element.\n * @throws {RequiredType} If `element` is not a string.\n */\nfunction create(element: string) {\n allOf({ values: [element], typeOf: ['string'] });\n\n return document.createElement(element);\n}\n\nexport default create;\n","import { DAYS, MONTHS, SHORTCUT_EVENTS } from './constants';\nimport { publicMethods } from './methods';\n\nexport class UnitJSClass {\n __nodes__: any[] = [];\n [k: string]: any;\n\n static __i18n__ = {\n months: MONTHS,\n days: DAYS,\n };\n\n constructor(...selectors: any[]) {\n selectors.forEach((selector) => {\n if (typeof selector === 'string') {\n try {\n const selectedNodes = Array.from(document.querySelectorAll(selector));\n this.__nodes__.push(...selectedNodes);\n } catch {\n throw new SyntaxError(`${selector} is not a valid DOM selector`);\n }\n } else {\n this.__nodes__.push(selector);\n }\n });\n\n // Inject dom events\n SHORTCUT_EVENTS.forEach((e) => {\n UnitJSClass.prototype[e] = function (fn?: (ev: Event) => void) {\n if (fn && typeof fn === 'function') {\n this.on(e as keyof ElementEventMap, fn);\n } else {\n this.each((node) => {\n const method = node[e as keyof HTMLElement];\n\n if (typeof method === 'function') {\n (method as () => void).call(node);\n }\n });\n }\n return this;\n };\n });\n }\n\n get length() {\n return this.__nodes__.length;\n }\n\n get nodes() {\n return this.__nodes__;\n }\n\n addClass = publicMethods.addClass;\n append = publicMethods.append;\n attr = publicMethods.attr;\n css = publicMethods.css;\n data = publicMethods.data;\n each = publicMethods.each;\n first = publicMethods.first;\n firstChild = publicMethods.firstChild;\n hasClass = publicMethods.hasClass;\n html = publicMethods.html;\n on = publicMethods.on;\n parent = publicMethods.parent;\n prepend = publicMethods.prepend;\n ready = publicMethods.ready;\n remove = publicMethods.remove;\n removeClass = publicMethods.removeClass;\n text = publicMethods.text;\n toggleClass = publicMethods.toggleClass;\n value = publicMethods.value;\n get = publicMethods.get;\n}\n","import { UnitJSClass } from '../../unit.class';\nimport { allOf } from '../../utils/fns';\n\n/**\n * Formats a UTC timestamp into a custom string using PHP-style date format symbols.\n *\n * Inspired by PHP's `date()` function, this method formats a date based on a given format string,\n * a UNIX timestamp (in milliseconds), and an optional UTC offset (in hours). It supports\n * localization via `this.days` and `this.months` static methods.\n *\n * Supported format characters:\n * - `d` – Day of the month, 2 digits (e.g. \"01\" to \"31\")\n * - `j` – Day of the month without leading zeros (1 to 31)\n * - `w` – Day of the week (0 = Sunday to 6 = Saturday)\n * - `N` – ISO-8601 weekday number (1 = Monday to 7 = Sunday)\n * - `l` – Full name of the day (from `this.__i18n__.days`)\n * - `D` – Short name of the day (first 3 letters of `l`)\n * - `m` – Month number with leading zeros (01 to 12)\n * - `n` – Month number without leading zeros (1 to 12)\n * - `F` – Full month name (from `this.__i18n__.months`)\n * - `M` – Short month name (first 3 letters of `F`)\n * - `Y` – Full 4-digit year (e.g. \"2025\")\n * - `y` – Last two digits of the year (e.g. \"25\")\n * - `G` – 24-hour format without leading zeros (0 to 23)\n * - `H` – 24-hour format with leading zeros (00 to 23)\n * - `g` – 12-hour format without leading zeros (1 to 12)\n * - `h` – 12-hour format with leading zeros (01 to 12)\n * - `a` – Lowercase am/pm\n * - `A` – Uppercase AM/PM\n * - `i` – Minutes with leading zeros (00 to 59)\n * - `s` – Seconds with leading zeros (00 to 59)\n * - `v` – Milliseconds with leading zeros (000 to 999)\n *\n * Any character not recognized as a formatting symbol will be passed through literally.\n *\n * @param {string} format - The PHP-style format string to use.\n * @param {number} [timestamp=Date.now()] - The timestamp to format (in milliseconds).\n * @param {number} [offset=0] - UTC offset in hours (e.g. `-5` for GMT-5).\n * @throws {TypeError} If `this.__i18n__.months` is not a valid array of 12 items\n * or `this.__i18n__.days` of 7.\n * @throws {RequiredType} If invalid argument types are passed to the function.\n * @returns {string} The formatted date string.\n */\nfunction date(format: string, timestamp = Date.now(), offset = 0) {\n allOf({ values: [format], typeOf: ['string'] });\n allOf({ values: [offset, timestamp], typeOf: ['number'] });\n\n if (!format) {\n throw new TypeError('Empty string is not a valid string format');\n }\n\n const validFormat: { [key: string]: string | number } = {};\n const timestampOffsetMs = offset * 60 * 60 * 1000;\n const dateObject = new Date(timestamp + timestampOffsetMs);\n\n validFormat.d = dateObject.getUTCDate().toString().padStart(2, '0');\n validFormat.j = dateObject.getUTCDate();\n validFormat.w = dateObject.getUTCDay();\n validFormat.N = validFormat.w === 0 ? 7 : validFormat.w;\n validFormat.m = (dateObject.getUTCMonth() + 1).toString().padStart(2, '0');\n validFormat.n = dateObject.getUTCMonth() + 1;\n validFormat.Y = dateObject.getUTCFullYear();\n validFormat.y = validFormat.Y.toString().slice(-2);\n\n validFormat.a = 'am';\n validFormat.A = 'AM';\n validFormat.G = dateObject.getUTCHours();\n validFormat.H = validFormat.G.toString().padStart(2, '0');\n validFormat.g = validFormat.G === 0 ? 12 : validFormat.G;\n\n if (validFormat.G > 12) {\n validFormat.a = 'pm';\n validFormat.A = 'PM';\n validFormat.g = validFormat.G - 12;\n }\n\n validFormat.h = validFormat.g.toString().padStart(2, '0');\n validFormat.i = dateObject.getUTCMinutes().toString().padStart(2, '0');\n validFormat.s = dateObject.getUTCSeconds().toString().padStart(2, '0');\n validFormat.v = dateObject.getMilliseconds().toString().padStart(3, '0');\n\n validFormat.l = UnitJSClass.__i18n__.days[validFormat.w];\n validFormat.D = (validFormat.l as string).substring(0, 3);\n validFormat.F = UnitJSClass.__i18n__.months[dateObject.getUTCMonth()];\n validFormat.M = (validFormat.F as string).substring(0, 3);\n\n const fixedFormat = [...format].reduce((acc, sym) => {\n acc += Object.hasOwn(validFormat, sym) ? validFormat[sym] : sym;\n\n return acc;\n }, '');\n\n return fixedFormat;\n}\n\nexport default date;\n","import { allOf } from '../../utils/fns';\n\n/**\n * Navigates to the specified URL.\n *\n * @param {string} url - The URL to navigate to.\n */\nfunction navigate(url: string) {\n allOf({ values: [url], typeOf: ['string'] });\n\n window.location = url as string & Location;\n return window.location;\n}\n\nexport default navigate;\n","import { UnitJSClass } from '../../../unit.class';\nimport { allOf } from '../../../utils/fns';\n\n/**\n * Sets the localized day names.\n *\n * @param {string[]} days - Array of 7 day names.\n * @returns {void}\n * @throws {RequiredType} If input is not an array of strings.\n * @throws {SyntaxError} If input does not have exactly 7 entries.\n */\nfunction days(days: string[]) {\n allOf({ values: days, typeOf: ['string'] });\n\n if (days.length !== 7) {\n throw new SyntaxError(\n `Expected the days array to have exactly 7 entries, but got ${days.length}`\n );\n }\n\n UnitJSClass.__i18n__.days = days;\n}\n\nexport default days;\n","import { UnitJSClass } from '../../../unit.class';\nimport { allOf } from '../../../utils/fns';\n\n/**\n * Sets the localized month names.\n *\n * @param {string[]} months - Array of 12 month names.\n * @returns {void}\n * @throws {RequiredType} If input is not an array of strings.\n * @throws {SyntaxError} If input is not an array of 12 entries.\n */\nfunction months(months: string[]) {\n allOf({ values: months, typeOf: ['string'] });\n\n if (months.length !== 12) {\n throw new SyntaxError(\n `Expected the months array to have exactly 12 entries, but got ${months.length}`\n );\n }\n\n UnitJSClass.__i18n__.months = months;\n}\n\nexport default months;\n","import { UnitJSClass } from '../../../unit.class';\n\n/**\n * Exposes the i18n configuration object.\n *\n * @returns {{ months: string[], days: string[] }}\n */\nfunction get() {\n return UnitJSClass.__i18n__;\n}\n\nexport default get;\n","import days from './days';\nimport months from './months';\nimport get from './get';\n\nexport default {\n days,\n months,\n get,\n};\n"],"mappings":"kbAAA,IAAAA,GAAA,GAAAC,EAAAD,GAAA,YAAAE,IAAA,eAAAC,GAAAH,ICAA,IAAAI,EAAA,GAAAC,EAAAD,EAAA,cAAAE,EAAA,WAAAC,EAAA,SAAAC,EAAA,QAAAC,EAAA,SAAAC,EAAA,SAAAC,EAAA,UAAAC,EAAA,eAAAC,EAAA,QAAAC,EAAA,aAAAC,EAAA,SAAAC,EAAA,OAAAC,EAAA,WAAAC,EAAA,YAAAC,EAAA,UAAAC,EAAA,WAAAC,EAAA,gBAAAC,EAAA,SAAAC,EAAA,gBAAAC,EAAA,UAAAC,ICAA,IAAMC,EAAN,cAA2B,KAAM,CAC/B,YAAYC,KAAoBC,EAAe,CAC7C,MAAM,GAAGA,CAAM,EAEf,KAAK,KAAO,eACZ,KAAK,QAAUD,CACjB,CACF,EAEOE,EAAQH,ECHR,SAASI,EAAkBC,EAA2C,CAC3E,OAAOA,GAAU,IACnB,CAcO,SAASC,EAAM,CACpB,OAAAC,EACA,OAAAC,EAAS,CAAC,EACV,WAAAC,EAAa,CAAC,EACd,iBAAAC,EAAmB,EACrB,EAAmB,CACjB,IAAMC,EAAiBF,EAAW,IAAKG,GAAaA,EAAS,IAAI,EAC3DC,EAAe,CAAC,GAAGL,EAAQ,GAAGG,CAAc,EAElD,GAAIP,EAAkBG,CAAM,GAAK,CAAC,MAAM,QAAQA,CAAM,EACpD,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8DAA8DA,EAAK,MAAM,EAC3E,EAGFE,EAAY,SAAS,KAAOF,CAC9B,CAEA,IAAOG,EAAQH,GCZf,SAASI,GAAOA,EAAkB,CAGhC,GAFAC,EAAM,CAAE,OAAQD,EAAQ,OAAQ,CAAC,QAAQ,CAAE,CAAC,EAExCA,EAAO,SAAW,GACpB,MAAM,IAAI,YACR,iEAAiEA,EAAO,MAAM,EAChF,EAGFE,EAAY,SAAS,OAASF,CAChC,CAEA,IAAOG,EAAQH,GChBf,SAASI,IAAM,CACb,OAAOC,EAAY,QACrB,CAEA,IAAOC,EAAQF,GCPf,IAAOG,EAAQ,CACb,KAAAC,EACA,OAAAC,EACA,IAAAC,CACF,EjCLA,IAAMC,EAAS,IAAIC,IAAqB,IAAIC,EAAY,GAAGD,CAAS,EAEpED,EAAO,OAASG,EAAc,OAC9BH,EAAO,KAAOG,EAAc,KAC5BH,EAAO,SAAWG,EAAc,SAChCH,EAAO,KAAOG,EAAc","names":["unit_exports","__export","UnitJS","__toCommonJS","public_exports","__export","addClass_default","append_default","attr_default","css_default","data_default","each_default","first_default","firstChild_default","get_default","hasClass_default","html_default","on_default","parent_default","prepend_default","ready_default","remove_default","removeClass_default","text_default","toggleClass_default","value_default","RequiredType","message","params","RequiredType_error_default","isNullOrUndefined","value","allOf","values","typeOf","instanceOf","allowEmptyString","instancesNames","instance","expectedData","RequiredType_error_default","currentType","isSupportedType","isSupportedInstance","camelFromKebab","kebab","lower","rest","pascalRest","word","addClass","classNames","allOf","node","addClass_default","append","element","allOf","htmlElement","node","append_default","attr","attribute","value","allOf","isNullOrUndefined","node","attr_default","CSS_VALUE_REGEX","MONTHS","DAYS","SHORTCUT_EVENTS","css","property","value","allOf","isNullOrUndefined","matches","CSS_VALUE_REGEX","node","css_default","data","property","value","allOf","camelProperty","camelFromKebab","isNullOrUndefined","node","data_default","each","fns","allOf","node","index","nodeArray","fn","each_default","first","first_default","firstChild","firstChild_default","hasClass","className","strict","allOf","method","node","hasClass_default","html","append","isNullOrUndefined","strHtml","allOf","node","html_default","on","event","fns","allOf","node","fn","on_default","parent","parent_default","prepend","element","allOf","htmlElement","node","prepend_default","ready","fn","allOf","node","ready_default","remove","element","allOf","node","remove_default","removeClass","classNames","allOf","node","removeClass_default","text","isNullOrUndefined","allOf","node","text_default","toggleClass","classNames","allOf","node","className","toggleClass_default","value","isNullOrUndefined","node","value_default","get","index","get_default","static_exports","__export","create_default","date_default","i18n_default","navigate_default","create","element","allOf","create_default","UnitJSClass","_UnitJSClass","MONTHS","DAYS","selectors","selector","selectedNodes","SHORTCUT_EVENTS","e","fn","node","method","public_exports","date","format","timestamp","offset","allOf","validFormat","timestampOffsetMs","dateObject","UnitJSClass","acc","sym","date_default","navigate","url","allOf","navigate_default","days","allOf","UnitJSClass","days_default","months","allOf","UnitJSClass","months_default","get","UnitJSClass","get_default","i18n_default","days_default","months_default","get_default","UnitJS","selectors","UnitJSClass","static_exports"]}
@@ -1 +1,2 @@
1
1
  var Z=Object.defineProperty;var g=(t,r)=>{for(var n in r)Z(t,n,{get:r[n],enumerable:!0})};var s={};g(s,{addClass:()=>S,append:()=>C,attr:()=>E,css:()=>J,data:()=>w,each:()=>T,first:()=>M,firstChild:()=>b,get:()=>R,hasClass:()=>L,html:()=>A,on:()=>H,parent:()=>N,prepend:()=>k,ready:()=>F,remove:()=>$,removeClass:()=>D,text:()=>G,toggleClass:()=>P,value:()=>j});var _=class extends Error{constructor(r,...n){super(...n),this.name="RequiredType",this.message=r}},h=_;function a(t){return t==null}function o({values:t,typeOf:r=[],instanceOf:n=[],allowEmptyString:e=!1}){let f=n.map(p=>p.name),i=[...r,...f];if(a(t)||!Array.isArray(t))throw new h(`Expected all values to be [ ${i.join(", ")} ] type, but got [ ${typeof t} ]`);let u="undefined";if(t.some(p=>{if(typeof p=="string"&&p===""&&e===!1)return!0;u=typeof p;let B=r.includes(u),z=n.some(Q=>p instanceof Q);return!B&&!z}))throw new h(`Expected all values to be [ ${i.join(", ")} ] type, but got [ ${u} ]`);return!0}function y(t){let[r,...n]=t.split("-"),e=n.map(f=>`${f.charAt(0).toUpperCase()}${f.slice(1).toLowerCase()}`);return`${r.toLowerCase()}${e.join("")}`}function tt(...t){return o({values:t,typeOf:["string"]}),this.__nodes__.forEach(r=>{r.classList.add(...t)}),this}var S=tt;function et(t){o({values:[t],typeOf:["string"],instanceOf:[Element],allowEmptyString:!0});let r=typeof t=="string"?document.createTextNode(t):t;return this.__nodes__.forEach(n=>{n.appendChild(r)}),this}var C=et;function rt(t,r){return o({values:[t],typeOf:["string"]}),a(r)?this.__nodes__[0].hasAttribute(t)?this.__nodes__[0].getAttribute(t):null:(this.__nodes__.forEach(n=>{n.setAttribute(t,r)}),this)}var E=rt;var v=/(?<value>.+?)(?:\s+!(?<important>important))?\s*$/i,O=["January","February","March","April","May","June","July","August","September","October","November","December"],U=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],x=["click","dblclick","mousedown","mouseup","mousemove","mouseenter","mouseleave","mouseover","mouseout","auxclick","contextmenu","wheel","pointerdown","pointerup","pointermove","pointerenter","pointerleave","pointercancel","keydown","keyup","keypress","touchstart","touchend","touchmove","touchcancel","drag","dragstart","dragend","dragenter","dragleave","dragover","drop","scroll","focus","blur","input","change","submit"];function nt(t,r){if(o({values:[t],typeOf:["string"]}),a(r))return window.getComputedStyle(this.__nodes__[0]).getPropertyValue(t);o({values:[r],typeOf:["string"]});let n=r?.match(v);if(n)return this.__nodes__.forEach(e=>{e.style.setProperty(t,n.groups?.value,n.groups?.important)}),this;throw new TypeError("Unkown CSSStyleValue")}var J=nt;function ot(t,r){o({values:[t],typeOf:["string"]});let n=y(t);return a(r)?this.__nodes__[0].dataset[n]:(o({values:[r],typeOf:["string"],allowEmptyString:!0}),this.__nodes__.forEach(e=>{e.dataset[n]=r}),this)}var w=ot;function st(...t){return o({values:t,typeOf:["function"]}),this.__nodes__.forEach((r,n,e)=>{t.forEach(f=>f(r,n,e))}),this}var T=st;function it(){return this.__nodes__.length?this.__nodes__[0]:null}var M=it;function at(){return this.__nodes__.length?this.__nodes__[0].firstChild:null}var b=at;function lt(t,r=!0){o({values:[t],typeOf:["string"]});let n=r?"every":"some";return this.__nodes__[n](e=>e.classList.contains(t))}var L=lt;function ft(t,r=!1){if(a(t))return this.__nodes__[0].innerHTML;let n=t instanceof HTMLElement?t.innerHTML:t;return o({values:[n],typeOf:["string"],instanceOf:[HTMLElement],allowEmptyString:!0}),this.__nodes__.forEach(e=>{r?e.innerHTML+=n:e.innerHTML=n}),this}var A=ft;function pt(t,...r){return o({values:[t],typeOf:["string"]}),o({values:r,typeOf:["function"]}),this.__nodes__.forEach(n=>{r.forEach(e=>n.addEventListener(t,e,!1))}),this}var H=pt;function mt(){return this.__nodes__.length?this.__nodes__[0].parentNode:null}var N=mt;function ut(t){o({values:[t],typeOf:["string"],instanceOf:[HTMLElement],allowEmptyString:!0});let r=typeof t=="string"?document.createTextNode(t):t;return this.__nodes__.forEach(n=>{n.insertBefore(r,n.firstChild)}),this}var k=ut;function dt(t){return o({values:[t],typeOf:["function"]}),this.__nodes__.forEach(r=>{r instanceof Window||r.nodeType===1?r.addEventListener("load",t,!1):r.addEventListener("DOMContentLoaded",t,!1)}),this}var F=dt;function ct(t){return o({values:[t],instanceOf:[Element]}),this.__nodes__.forEach(r=>{try{r.removeChild(t)}catch{throw new SyntaxError(`${t} is not a child of this node`)}}),this}var $=ct;function _t(...t){return o({values:t,typeOf:["string"]}),this.__nodes__.forEach(r=>{r.classList.remove(...t)}),this}var D=_t;function ht(t){return a(t)?this.__nodes__[0].textContent:(o({values:[t],typeOf:["string"],allowEmptyString:!0}),this.__nodes__.forEach(r=>{r.textContent=t}),this)}var G=ht;function gt(...t){return o({values:t,typeOf:["string"]}),this.__nodes__.forEach(r=>{t.forEach(n=>r.classList.toggle(n))}),this}var P=gt;function yt(t){return a(t)?this.__nodes__[0].value:(this.__nodes__.forEach(r=>{r.value=t}),this)}var j=yt;function St(t){return this.__nodes__.length?this.__nodes__[t]:null}var R=St;var m={};g(m,{create:()=>V,date:()=>Y,i18n:()=>X,navigate:()=>I});function Ct(t){return o({values:[t],typeOf:["string"]}),document.createElement(t)}var V=Ct;var l=class t{__nodes__=[];static __i18n__={months:O,days:U};constructor(...r){r.forEach(n=>{if(typeof n=="string")try{let e=Array.from(document.querySelectorAll(n));this.__nodes__.push(...e)}catch{throw new SyntaxError(`${n} is not a valid DOM selector`)}else this.__nodes__.push(n)}),x.forEach(n=>{t.prototype[n]=function(e){return e&&typeof e=="function"?this.on(n,e):this.each(f=>{let i=f[n];typeof i=="function"&&i.call(f)}),this}})}get length(){return this.__nodes__.length}get nodes(){return this.__nodes__}addClass=s.addClass;append=s.append;attr=s.attr;css=s.css;data=s.data;each=s.each;first=s.first;firstChild=s.firstChild;hasClass=s.hasClass;html=s.html;on=s.on;parent=s.parent;prepend=s.prepend;ready=s.ready;remove=s.remove;removeClass=s.removeClass;text=s.text;toggleClass=s.toggleClass;value=s.value;get=s.get};function Et(t,r=Date.now(),n=0){if(o({values:[t],typeOf:["string"]}),o({values:[n,r],typeOf:["number"]}),!t)throw new TypeError("Empty string is not a valid string format");let e={},f=n*60*60*1e3,i=new Date(r+f);return e.d=i.getUTCDate().toString().padStart(2,"0"),e.j=i.getUTCDate(),e.w=i.getUTCDay(),e.N=e.w===0?7:e.w,e.m=(i.getUTCMonth()+1).toString().padStart(2,"0"),e.n=i.getUTCMonth()+1,e.Y=i.getUTCFullYear(),e.y=e.Y.toString().slice(-2),e.a="am",e.A="AM",e.G=i.getUTCHours(),e.H=e.G.toString().padStart(2,"0"),e.g=e.G===0?12:e.G,e.G>12&&(e.a="pm",e.A="PM",e.g=e.G-12),e.h=e.g.toString().padStart(2,"0"),e.i=i.getUTCMinutes().toString().padStart(2,"0"),e.s=i.getUTCSeconds().toString().padStart(2,"0"),e.v=i.getMilliseconds().toString().padStart(3,"0"),e.l=l.__i18n__.days[e.w],e.D=e.l.substring(0,3),e.F=l.__i18n__.months[i.getUTCMonth()],e.M=e.F.substring(0,3),[...t].reduce((c,p)=>(c+=Object.hasOwn(e,p)?e[p]:p,c),"")}var Y=Et;function vt(t){return o({values:[t],typeOf:["string"]}),window.location=t,window.location}var I=vt;function Ot(t){if(o({values:t,typeOf:["string"]}),t.length!==7)throw new SyntaxError(`Expected the days array to have exactly 7 entries, but got ${t.length}`);l.__i18n__.days=t}var q=Ot;function Ut(t){if(o({values:t,typeOf:["string"]}),t.length!==12)throw new SyntaxError(`Expected the months array to have exactly 12 entries, but got ${t.length}`);l.__i18n__.months=t}var K=Ut;function xt(){return l.__i18n__}var W=xt;var X={days:q,months:K,get:W};var d=(...t)=>new l(...t);d.create=m.create;d.date=m.date;d.navigate=m.navigate;d.i18n=m.i18n;export{d as UnitJS};
2
+ //# sourceMappingURL=unit.min.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/methods/public/index.ts","../../src/utils/RequiredType.error.ts","../../src/utils/fns.ts","../../src/methods/public/addClass.ts","../../src/methods/public/append.ts","../../src/methods/public/attr.ts","../../src/constants/index.ts","../../src/methods/public/css.ts","../../src/methods/public/data.ts","../../src/methods/public/each.ts","../../src/methods/public/first.ts","../../src/methods/public/firstChild.ts","../../src/methods/public/hasClass.ts","../../src/methods/public/html.ts","../../src/methods/public/on.ts","../../src/methods/public/parent.ts","../../src/methods/public/prepend.ts","../../src/methods/public/ready.ts","../../src/methods/public/remove.ts","../../src/methods/public/removeClass.ts","../../src/methods/public/text.ts","../../src/methods/public/toggleClass.ts","../../src/methods/public/value.ts","../../src/methods/public/get.ts","../../src/methods/static/index.ts","../../src/methods/static/create.ts","../../src/unit.class.ts","../../src/methods/static/date.ts","../../src/methods/static/navigate.ts","../../src/methods/static/i18n/days.ts","../../src/methods/static/i18n/months.ts","../../src/methods/static/i18n/get.ts","../../src/methods/static/i18n/index.ts","../../src/unit.ts"],"sourcesContent":["import addClass from './addClass';\nimport append from './append';\nimport attr from './attr';\nimport css from './css';\nimport data from './data';\nimport each from './each';\nimport first from './first';\nimport firstChild from './firstChild';\nimport hasClass from './hasClass';\nimport html from './html';\nimport on from './on';\nimport parent from './parent';\nimport prepend from './prepend';\nimport ready from './ready';\nimport remove from './remove';\nimport removeClass from './removeClass';\nimport text from './text';\nimport toggleClass from './toggleClass';\nimport value from './value';\nimport get from './get';\n\nexport {\n addClass,\n append,\n attr,\n css,\n data,\n each,\n first,\n firstChild,\n hasClass,\n html,\n on,\n parent,\n prepend,\n ready,\n remove,\n removeClass,\n text,\n toggleClass,\n value,\n get,\n};\n","class RequiredType extends Error {\n constructor(message: string, ...params: any[]) {\n super(...params);\n\n this.name = 'RequiredType';\n this.message = message;\n }\n}\n\nexport default RequiredType;\n","import { type PrimitiveType } from '../types';\nimport RequiredType from './RequiredType.error';\n\n/**\n * Validates whether the value is null or undefined\n */\nexport function isNullOrUndefined(value: unknown): value is null | undefined {\n return value === null || value === undefined;\n}\n\ntype AllOfArguments = {\n values: any[];\n typeOf?: PrimitiveType[];\n // eslint-disable-next-line @typescript-eslint/no-unsafe-function-type\n instanceOf?: Function[];\n allowEmptyString?: boolean;\n};\n\n/**\n * Validates that all values in the array conform to at least one of the specified primitive types\n * or are instances of one of the specified constructor functions.\n */\nexport function allOf({\n values,\n typeOf = [],\n instanceOf = [],\n allowEmptyString = false,\n}: AllOfArguments) {\n const instancesNames = instanceOf.map((instance) => instance.name);\n const expectedData = [...typeOf, ...instancesNames];\n\n if (isNullOrUndefined(values) || !Array.isArray(values)) {\n throw new RequiredType(\n `Expected all values to be [ ${expectedData.join(', ')} ] type, but got [ ${typeof values} ]`\n );\n }\n\n let currentType: PrimitiveType = 'undefined';\n\n const notConforms = values.some((value) => {\n if (\n typeof value === 'string' &&\n value === '' &&\n allowEmptyString === false\n ) {\n return true;\n }\n\n currentType = typeof value;\n\n const isSupportedType = typeOf.includes(currentType);\n const isSupportedInstance = instanceOf.some(\n (instance) => value instanceof instance\n );\n\n return !isSupportedType && !isSupportedInstance;\n });\n\n if (notConforms) {\n throw new RequiredType(\n `Expected all values to be [ ${expectedData.join(', ')} ] type, but got [ ${currentType} ]`\n );\n }\n\n return true;\n}\n\n/**\n * Returns the camel case representation of a kebab cased string\n */\nexport function camelFromKebab(kebab: string) {\n const [lower, ...rest] = kebab.split('-');\n const pascalRest = rest.map(\n (word) => `${word.charAt(0).toUpperCase()}${word.slice(1).toLowerCase()}`\n );\n\n return `${lower.toLowerCase()}${pascalRest.join('')}`;\n}\n","import { UnitJSClass } from '../../unit.class';\nimport { allOf } from '../../utils/fns';\n\n/**\n * Adds one or more CSS classes to each node.\n *\n * @this {UnitJSClass}\n * @param {...string} classNames - One or more class names to add.\n * @returns {this} The current instance for chaining.\n * @throws {RequiredType} If any className is not a string.\n */\nfunction addClass(this: UnitJSClass, ...classNames: string[]) {\n allOf({ values: classNames, typeOf: ['string'] });\n\n this.__nodes__.forEach((node) => {\n node.classList.add(...classNames);\n });\n\n return this;\n}\n\nexport default addClass;\n","import { UnitJSClass } from '../../unit.class';\nimport { allOf } from '../../utils/fns';\n\n/**\n * Appends a DOM element or a text node (from string) to each node.\n *\n * @param {string | Element} element - A string to create a text node, or a DOM node to append.\n * @returns {this} The current instance for chaining.\n * @throws {RequiredType} If the input is neither a string nor a Node.\n */\nfunction append(this: UnitJSClass, element: string | Element) {\n allOf({\n values: [element],\n typeOf: ['string'],\n instanceOf: [Element],\n allowEmptyString: true,\n });\n\n const htmlElement =\n typeof element === 'string' ? document.createTextNode(element) : element;\n\n this.__nodes__.forEach((node) => {\n node.appendChild(htmlElement);\n });\n\n return this;\n}\n\nexport default append;\n","import { UnitJSClass } from '../../unit.class';\nimport { allOf, isNullOrUndefined } from '../../utils/fns';\n\n/**\n * Gets or sets the value of a specified attribute on DOM nodes in the current context.\n *\n * @param {string} attribute - The name of the attribute to get or set.\n * @param {string} [value] - The value to assign. If omitted, the current value is returned.\n * @returns {string|this} Returns the attribute value, or the current instance for chaining.\n * @throws {RequiredType} If `attribute` is not a string or `value` (when provided) is not a string.\n */\nfunction attr(this: UnitJSClass, attribute: string, value?: string) {\n allOf({ values: [attribute], typeOf: ['string'] });\n\n if (isNullOrUndefined(value)) {\n if (this.__nodes__[0].hasAttribute(attribute)) {\n return this.__nodes__[0].getAttribute(attribute);\n }\n\n return null;\n }\n\n this.__nodes__.forEach((node) => {\n node.setAttribute(attribute, value);\n });\n\n return this;\n}\n\nexport default attr;\n","export const CSS_VALUE_REGEX =\n /(?<value>.+?)(?:\\s+!(?<important>important))?\\s*$/i;\n\nexport const MONTHS = [\n 'January',\n 'February',\n 'March',\n 'April',\n 'May',\n 'June',\n 'July',\n 'August',\n 'September',\n 'October',\n 'November',\n 'December',\n];\n\nexport const DAYS = [\n 'Sunday',\n 'Monday',\n 'Tuesday',\n 'Wednesday',\n 'Thursday',\n 'Friday',\n 'Saturday',\n];\n\nexport const SHORTCUT_EVENTS = [\n // Mouse\n 'click',\n 'dblclick',\n 'mousedown',\n 'mouseup',\n 'mousemove',\n 'mouseenter',\n 'mouseleave',\n 'mouseover',\n 'mouseout',\n 'auxclick',\n 'contextmenu',\n 'wheel',\n\n // Pointer (covers mouse, touch, pen)\n 'pointerdown',\n 'pointerup',\n 'pointermove',\n 'pointerenter',\n 'pointerleave',\n 'pointercancel',\n\n // Keyboard\n 'keydown',\n 'keyup',\n 'keypress',\n\n // Touch\n 'touchstart',\n 'touchend',\n 'touchmove',\n 'touchcancel',\n\n // Drag & Drop\n 'drag',\n 'dragstart',\n 'dragend',\n 'dragenter',\n 'dragleave',\n 'dragover',\n 'drop',\n\n // Scroll & focus\n 'scroll',\n 'focus',\n 'blur',\n\n // Form\n 'input',\n 'change',\n 'submit',\n];\n","import { CSS_VALUE_REGEX } from '../../constants';\nimport { UnitJSClass } from '../../unit.class';\nimport { allOf, isNullOrUndefined } from '../../utils/fns';\n\n/**\n * Gets or sets a CSS property on all nodes in the current context.\n *\n * @param {string} property - The CSS property name (in camelCase or kebab-case).\n * @param {string} [value] - The value to set for the CSS property. If omitted, acts as a getter.\n * @returns {string|this} The computed style value, or the current instance for chaining.\n * @throws {RequiredType} If `property` is not a string or `value` (when provided) is not a string.\n */\nfunction css(this: UnitJSClass, property: string, value?: string) {\n allOf({ values: [property], typeOf: ['string'] });\n\n if (isNullOrUndefined(value)) {\n const computedStyles = window.getComputedStyle(this.__nodes__[0]);\n\n return computedStyles.getPropertyValue(property);\n }\n\n allOf({ values: [value], typeOf: ['string'] });\n\n const matches = value?.match(CSS_VALUE_REGEX);\n\n if (matches) {\n this.__nodes__.forEach((node) => {\n node.style.setProperty(\n property,\n matches.groups?.value,\n matches.groups?.important\n );\n });\n\n return this;\n }\n\n throw new TypeError('Unkown CSSStyleValue');\n}\n\nexport default css;\n","import { UnitJSClass } from '../../unit.class';\nimport { allOf, camelFromKebab, isNullOrUndefined } from '../../utils/fns';\n\n/**\n * Gets or sets a data attribute (from `dataset`) on all nodes in the current context.\n *\n * @param {string} property - The camelCase name of the data attribute (without 'data-' prefix).\n * @param {string} [value] - The value to set for the data attribute. If omitted, acts as a getter.\n * @returns {string|this} The data attribute value, or the current instance for chaining.\n * @throws {RequiredType} If `property` is not a string or `value` (when provided) is not a string.\n */\nfunction data(this: UnitJSClass, property: string, value?: string) {\n allOf({ values: [property], typeOf: ['string'] });\n\n const camelProperty = camelFromKebab(property);\n\n if (isNullOrUndefined(value)) {\n return this.__nodes__[0].dataset[camelProperty];\n }\n\n allOf({ values: [value], typeOf: ['string'], allowEmptyString: true });\n\n this.__nodes__.forEach((node) => {\n node.dataset[camelProperty] = value;\n });\n\n return this;\n}\n\nexport default data;\n","import { FunctionSignature } from '../../types';\nimport { UnitJSClass } from '../../unit.class';\nimport { allOf } from '../../utils/fns';\n\n/**\n * Executes one or more callback functions on each node.\n *\n * @param {...Function} fns - One or more functions to execute on each node. Each function\n * should accept `(node, index, nodesArray)` as arguments.\n * @returns {this} The current instance for chaining.\n * @throws {RequiredType} If any argument is not a function.\n */\nfunction each(this: UnitJSClass, ...fns: FunctionSignature[]) {\n allOf({ values: fns, typeOf: ['function'] });\n\n this.__nodes__.forEach((node, index, nodeArray) => {\n fns.forEach((fn) => fn(node, index, nodeArray));\n });\n\n return this;\n}\n\nexport default each;\n","import { UnitJSClass } from '../../unit.class';\n\n/**\n * Returns the first node in the collection.\n *\n * @returns {any|null} The first node, or `null` if empty.\n */\nfunction first(this: UnitJSClass) {\n if (!this.__nodes__.length) {\n return null;\n }\n\n return this.__nodes__[0];\n}\n\nexport default first;\n","import { UnitJSClass } from '../../unit.class';\n\n/**\n * Returns the first child node of the first element.\n *\n * @returns {Node|null} The first child node, or `null` if none.\n */\nfunction firstChild(this: UnitJSClass) {\n if (!this.__nodes__.length) {\n return null;\n }\n\n return this.__nodes__[0].firstChild;\n}\n\nexport default firstChild;\n","import { UnitJSClass } from '../../unit.class';\nimport { allOf } from '../../utils/fns';\n\n/**\n * Checks if nodes have the specified class.\n *\n * @param {string} className - The class name to check.\n * @param {boolean} [strict=true] - If `true`, all nodes must have the class; otherwise, some.\n * @returns {boolean} Whether the nodes meet the class condition.\n * @throws {RequiredType} If `className` is not a string.\n */\nfunction hasClass(this: UnitJSClass, className: string, strict = true) {\n allOf({ values: [className], typeOf: ['string'] });\n\n const method = strict ? 'every' : 'some';\n\n return this.__nodes__[method]((node) => node.classList.contains(className));\n}\n\nexport default hasClass;\n","import { UnitJSClass } from '../../unit.class';\nimport { allOf, isNullOrUndefined } from '../../utils/fns';\n\n/**\n * Gets or sets the HTML content of nodes.\n *\n * @param {string|HTMLElement} [html] - HTML string or element to set or append.\n * @param {boolean} [append=false] - If `true`, appends instead of replacing.\n * @returns {string|this} HTML string if getting, or the current instance for chaining if setting.\n * @throws {RequiredType} If `html` is provided and is not a string or HTMLElement.\n */\nfunction html(this: UnitJSClass, html?: string | HTMLElement, append = false) {\n if (isNullOrUndefined(html)) {\n return this.__nodes__[0].innerHTML;\n }\n\n const strHtml = html instanceof HTMLElement ? html.innerHTML : html;\n\n allOf({\n values: [strHtml],\n typeOf: ['string'],\n instanceOf: [HTMLElement],\n allowEmptyString: true,\n });\n\n this.__nodes__.forEach((node) => {\n if (append) {\n node.innerHTML += strHtml;\n } else {\n node.innerHTML = strHtml;\n }\n });\n\n return this;\n}\n\nexport default html;\n","import { UnitJSClass } from '../../unit.class';\nimport { allOf } from '../../utils/fns';\n\n/**\n * Attaches one or more event listeners to all nodes.\n *\n * @param {string} event - The event type to listen for.\n * @param {...Function} fns - One or more handler functions.\n * @returns {this} The current instance for chaining.\n * @throws {RequiredType} If `event` is not a string or any handler is not a function.\n */\nfunction on(\n this: UnitJSClass,\n event: keyof HTMLElementEventMap,\n ...fns: ((ev: Event) => void)[]\n) {\n allOf({ values: [event], typeOf: ['string'] });\n allOf({ values: fns, typeOf: ['function'] });\n\n this.__nodes__.forEach((node) => {\n fns.forEach((fn) => node.addEventListener(event, fn, false));\n });\n\n return this;\n}\n\nexport default on;\n","import { UnitJSClass } from '../../unit.class';\n\n/**\n * Returns the parent node of the first element.\n *\n * @returns {HTMLElement|null} The parent node, or `null` if empty.\n */\nfunction parent(this: UnitJSClass) {\n if (!this.__nodes__.length) {\n return null;\n }\n\n return this.__nodes__[0].parentNode;\n}\n\nexport default parent;\n","import { UnitJSClass } from '../../unit.class';\nimport { allOf } from '../../utils/fns';\n\n/**\n * Prepends a DOM element or a text node (from string) to each node.\n *\n * @param {string | HTMLElement} element - A string to create a text node, or a DOM node to prepend.\n * @returns {this} The current instance for chaining.\n * @throws {RequiredType} If the input is neither a string nor a Node.\n */\nfunction prepend(this: UnitJSClass, element: string | HTMLElement) {\n allOf({\n values: [element],\n typeOf: ['string'],\n instanceOf: [HTMLElement],\n allowEmptyString: true,\n });\n\n const htmlElement =\n typeof element === 'string' ? document.createTextNode(element) : element;\n\n this.__nodes__.forEach((node) => {\n node.insertBefore(htmlElement, node.firstChild);\n });\n\n return this;\n}\n\nexport default prepend;\n","import { UnitJSClass } from '../../unit.class';\nimport { allOf } from '../../utils/fns';\n\n/**\n * Adds a 'load' event listener to each node.\n * Useful for elements like images, iframes, and window.\n *\n * @param {Function} fn - The handler for the 'load' event.\n * @returns {this} The current instance for chaining.\n * @throws {RequiredType} If `fn` is not a function.\n */\nfunction ready(this: UnitJSClass, fn: (ev: Event) => void) {\n allOf({ values: [fn], typeOf: ['function'] });\n\n this.__nodes__.forEach((node) => {\n if (node instanceof Window || node.nodeType === 1) {\n node.addEventListener('load', fn, false);\n } else {\n node.addEventListener('DOMContentLoaded', fn, false);\n }\n });\n return this;\n}\n\nexport default ready;\n","import { UnitJSClass } from '../../unit.class';\nimport { allOf } from '../../utils/fns';\n\n/**\n * Removes a specified child element from each node.\n *\n * @param {Element} element - The child element to remove.\n * @returns {this} The current instance for chaining.\n * @throws {RequiredType} If `element` is not an Element.\n */\nfunction remove(this: UnitJSClass, element: Element) {\n allOf({ values: [element], instanceOf: [Element] });\n\n this.__nodes__.forEach((node) => {\n try {\n node.removeChild(element);\n } catch {\n throw new SyntaxError(`${element} is not a child of this node`);\n }\n });\n\n return this;\n}\n\nexport default remove;\n","import { UnitJSClass } from '../../unit.class';\nimport { allOf } from '../../utils/fns';\n\n/**\n * Removes one or more classes from all nodes.\n *\n * @param {...string} classNames - One or more class names to remove.\n * @returns {this} The current instance for chaining.\n * @throws {RequiredType} If any class name is not a string.\n */\nfunction removeClass(this: UnitJSClass, ...classNames: string[]) {\n allOf({ values: classNames, typeOf: ['string'] });\n\n this.__nodes__.forEach((node) => {\n node.classList.remove(...classNames);\n });\n\n return this;\n}\n\nexport default removeClass;\n","import { UnitJSClass } from '../../unit.class';\nimport { allOf, isNullOrUndefined } from '../../utils/fns';\n\n/**\n * Gets or sets the text content of nodes.\n *\n * @param {string} [text] - The text to set.\n * @returns {string|this} The text content, or the current instance for chaining if setting.\n * @throws {RequiredType} If `text` is provided and is not a string.\n */\nfunction text(this: UnitJSClass, text?: string) {\n if (isNullOrUndefined(text)) {\n return this.__nodes__[0].textContent;\n }\n\n allOf({ values: [text], typeOf: ['string'], allowEmptyString: true });\n\n this.__nodes__.forEach((node) => {\n node.textContent = text;\n });\n\n return this;\n}\n\nexport default text;\n","import { UnitJSClass } from '../../unit.class';\nimport { allOf } from '../../utils/fns';\n\n/**\n * Toggles one or more classes on all nodes.\n *\n * @param {...string} classNames - Classes to toggle.\n * @returns {this} The current instance for chaining.\n * @throws {RequiredType} If any class name is not a string.\n */\nfunction toggleClass(this: UnitJSClass, ...classNames: string[]) {\n allOf({ values: classNames, typeOf: ['string'] });\n\n this.__nodes__.forEach((node) => {\n classNames.forEach((className) => node.classList.toggle(className));\n });\n\n return this;\n}\n\nexport default toggleClass;\n","import { UnitJSClass } from '../../unit.class';\nimport { isNullOrUndefined } from '../../utils/fns';\n\n/**\n * Gets or sets the `value` property of nodes.\n *\n * @param {any} [value] - The value to set.\n * @returns {string|this} The value if getting, or the current instance for chaining if setting.\n */\nfunction value(this: UnitJSClass, value?: any) {\n if (isNullOrUndefined(value)) {\n return (this.__nodes__[0] as HTMLInputElement).value;\n }\n\n this.__nodes__.forEach((node) => {\n (node as HTMLInputElement).value = value;\n });\n\n return this;\n}\n\nexport default value;\n","import { UnitJSClass } from '../../unit.class';\n\n/**\n * Returns the nth node in the collection.\n *\n * @returns {any|null} The nth node, or `null` if empty.\n */\nfunction get(this: UnitJSClass, index: number) {\n if (!this.__nodes__.length) {\n return null;\n }\n\n return this.__nodes__[index];\n}\n\nexport default get;\n","import create from './create';\nimport date from './date';\nimport navigate from './navigate';\nimport i18n from './i18n';\n\nexport { create, date, navigate, i18n };\n","import { allOf } from '../../utils/fns';\n\n/**\n * Creates a new DOM element by tag name.\n *\n * @param {string} element - The tag name of the element to create.\n * @returns {HTMLElement} The created element.\n * @throws {RequiredType} If `element` is not a string.\n */\nfunction create(element: string) {\n allOf({ values: [element], typeOf: ['string'] });\n\n return document.createElement(element);\n}\n\nexport default create;\n","import { DAYS, MONTHS, SHORTCUT_EVENTS } from './constants';\nimport { publicMethods } from './methods';\n\nexport class UnitJSClass {\n __nodes__: any[] = [];\n [k: string]: any;\n\n static __i18n__ = {\n months: MONTHS,\n days: DAYS,\n };\n\n constructor(...selectors: any[]) {\n selectors.forEach((selector) => {\n if (typeof selector === 'string') {\n try {\n const selectedNodes = Array.from(document.querySelectorAll(selector));\n this.__nodes__.push(...selectedNodes);\n } catch {\n throw new SyntaxError(`${selector} is not a valid DOM selector`);\n }\n } else {\n this.__nodes__.push(selector);\n }\n });\n\n // Inject dom events\n SHORTCUT_EVENTS.forEach((e) => {\n UnitJSClass.prototype[e] = function (fn?: (ev: Event) => void) {\n if (fn && typeof fn === 'function') {\n this.on(e as keyof ElementEventMap, fn);\n } else {\n this.each((node) => {\n const method = node[e as keyof HTMLElement];\n\n if (typeof method === 'function') {\n (method as () => void).call(node);\n }\n });\n }\n return this;\n };\n });\n }\n\n get length() {\n return this.__nodes__.length;\n }\n\n get nodes() {\n return this.__nodes__;\n }\n\n addClass = publicMethods.addClass;\n append = publicMethods.append;\n attr = publicMethods.attr;\n css = publicMethods.css;\n data = publicMethods.data;\n each = publicMethods.each;\n first = publicMethods.first;\n firstChild = publicMethods.firstChild;\n hasClass = publicMethods.hasClass;\n html = publicMethods.html;\n on = publicMethods.on;\n parent = publicMethods.parent;\n prepend = publicMethods.prepend;\n ready = publicMethods.ready;\n remove = publicMethods.remove;\n removeClass = publicMethods.removeClass;\n text = publicMethods.text;\n toggleClass = publicMethods.toggleClass;\n value = publicMethods.value;\n get = publicMethods.get;\n}\n","import { UnitJSClass } from '../../unit.class';\nimport { allOf } from '../../utils/fns';\n\n/**\n * Formats a UTC timestamp into a custom string using PHP-style date format symbols.\n *\n * Inspired by PHP's `date()` function, this method formats a date based on a given format string,\n * a UNIX timestamp (in milliseconds), and an optional UTC offset (in hours). It supports\n * localization via `this.days` and `this.months` static methods.\n *\n * Supported format characters:\n * - `d` – Day of the month, 2 digits (e.g. \"01\" to \"31\")\n * - `j` – Day of the month without leading zeros (1 to 31)\n * - `w` – Day of the week (0 = Sunday to 6 = Saturday)\n * - `N` – ISO-8601 weekday number (1 = Monday to 7 = Sunday)\n * - `l` – Full name of the day (from `this.__i18n__.days`)\n * - `D` – Short name of the day (first 3 letters of `l`)\n * - `m` – Month number with leading zeros (01 to 12)\n * - `n` – Month number without leading zeros (1 to 12)\n * - `F` – Full month name (from `this.__i18n__.months`)\n * - `M` – Short month name (first 3 letters of `F`)\n * - `Y` – Full 4-digit year (e.g. \"2025\")\n * - `y` – Last two digits of the year (e.g. \"25\")\n * - `G` – 24-hour format without leading zeros (0 to 23)\n * - `H` – 24-hour format with leading zeros (00 to 23)\n * - `g` – 12-hour format without leading zeros (1 to 12)\n * - `h` – 12-hour format with leading zeros (01 to 12)\n * - `a` – Lowercase am/pm\n * - `A` – Uppercase AM/PM\n * - `i` – Minutes with leading zeros (00 to 59)\n * - `s` – Seconds with leading zeros (00 to 59)\n * - `v` – Milliseconds with leading zeros (000 to 999)\n *\n * Any character not recognized as a formatting symbol will be passed through literally.\n *\n * @param {string} format - The PHP-style format string to use.\n * @param {number} [timestamp=Date.now()] - The timestamp to format (in milliseconds).\n * @param {number} [offset=0] - UTC offset in hours (e.g. `-5` for GMT-5).\n * @throws {TypeError} If `this.__i18n__.months` is not a valid array of 12 items\n * or `this.__i18n__.days` of 7.\n * @throws {RequiredType} If invalid argument types are passed to the function.\n * @returns {string} The formatted date string.\n */\nfunction date(format: string, timestamp = Date.now(), offset = 0) {\n allOf({ values: [format], typeOf: ['string'] });\n allOf({ values: [offset, timestamp], typeOf: ['number'] });\n\n if (!format) {\n throw new TypeError('Empty string is not a valid string format');\n }\n\n const validFormat: { [key: string]: string | number } = {};\n const timestampOffsetMs = offset * 60 * 60 * 1000;\n const dateObject = new Date(timestamp + timestampOffsetMs);\n\n validFormat.d = dateObject.getUTCDate().toString().padStart(2, '0');\n validFormat.j = dateObject.getUTCDate();\n validFormat.w = dateObject.getUTCDay();\n validFormat.N = validFormat.w === 0 ? 7 : validFormat.w;\n validFormat.m = (dateObject.getUTCMonth() + 1).toString().padStart(2, '0');\n validFormat.n = dateObject.getUTCMonth() + 1;\n validFormat.Y = dateObject.getUTCFullYear();\n validFormat.y = validFormat.Y.toString().slice(-2);\n\n validFormat.a = 'am';\n validFormat.A = 'AM';\n validFormat.G = dateObject.getUTCHours();\n validFormat.H = validFormat.G.toString().padStart(2, '0');\n validFormat.g = validFormat.G === 0 ? 12 : validFormat.G;\n\n if (validFormat.G > 12) {\n validFormat.a = 'pm';\n validFormat.A = 'PM';\n validFormat.g = validFormat.G - 12;\n }\n\n validFormat.h = validFormat.g.toString().padStart(2, '0');\n validFormat.i = dateObject.getUTCMinutes().toString().padStart(2, '0');\n validFormat.s = dateObject.getUTCSeconds().toString().padStart(2, '0');\n validFormat.v = dateObject.getMilliseconds().toString().padStart(3, '0');\n\n validFormat.l = UnitJSClass.__i18n__.days[validFormat.w];\n validFormat.D = (validFormat.l as string).substring(0, 3);\n validFormat.F = UnitJSClass.__i18n__.months[dateObject.getUTCMonth()];\n validFormat.M = (validFormat.F as string).substring(0, 3);\n\n const fixedFormat = [...format].reduce((acc, sym) => {\n acc += Object.hasOwn(validFormat, sym) ? validFormat[sym] : sym;\n\n return acc;\n }, '');\n\n return fixedFormat;\n}\n\nexport default date;\n","import { allOf } from '../../utils/fns';\n\n/**\n * Navigates to the specified URL.\n *\n * @param {string} url - The URL to navigate to.\n */\nfunction navigate(url: string) {\n allOf({ values: [url], typeOf: ['string'] });\n\n window.location = url as string & Location;\n return window.location;\n}\n\nexport default navigate;\n","import { UnitJSClass } from '../../../unit.class';\nimport { allOf } from '../../../utils/fns';\n\n/**\n * Sets the localized day names.\n *\n * @param {string[]} days - Array of 7 day names.\n * @returns {void}\n * @throws {RequiredType} If input is not an array of strings.\n * @throws {SyntaxError} If input does not have exactly 7 entries.\n */\nfunction days(days: string[]) {\n allOf({ values: days, typeOf: ['string'] });\n\n if (days.length !== 7) {\n throw new SyntaxError(\n `Expected the days array to have exactly 7 entries, but got ${days.length}`\n );\n }\n\n UnitJSClass.__i18n__.days = days;\n}\n\nexport default days;\n","import { UnitJSClass } from '../../../unit.class';\nimport { allOf } from '../../../utils/fns';\n\n/**\n * Sets the localized month names.\n *\n * @param {string[]} months - Array of 12 month names.\n * @returns {void}\n * @throws {RequiredType} If input is not an array of strings.\n * @throws {SyntaxError} If input is not an array of 12 entries.\n */\nfunction months(months: string[]) {\n allOf({ values: months, typeOf: ['string'] });\n\n if (months.length !== 12) {\n throw new SyntaxError(\n `Expected the months array to have exactly 12 entries, but got ${months.length}`\n );\n }\n\n UnitJSClass.__i18n__.months = months;\n}\n\nexport default months;\n","import { UnitJSClass } from '../../../unit.class';\n\n/**\n * Exposes the i18n configuration object.\n *\n * @returns {{ months: string[], days: string[] }}\n */\nfunction get() {\n return UnitJSClass.__i18n__;\n}\n\nexport default get;\n","import days from './days';\nimport months from './months';\nimport get from './get';\n\nexport default {\n days,\n months,\n get,\n};\n","import { staticMethods } from './methods';\nimport { UnitJSClass } from './unit.class';\n\nconst UnitJS = (...selectors: any[]) => new UnitJSClass(...selectors);\n\nUnitJS.create = staticMethods.create;\nUnitJS.date = staticMethods.date;\nUnitJS.navigate = staticMethods.navigate;\nUnitJS.i18n = staticMethods.i18n;\n\nexport { UnitJS };\n"],"mappings":"0FAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,cAAAE,EAAA,WAAAC,EAAA,SAAAC,EAAA,QAAAC,EAAA,SAAAC,EAAA,SAAAC,EAAA,UAAAC,EAAA,eAAAC,EAAA,QAAAC,EAAA,aAAAC,EAAA,SAAAC,EAAA,OAAAC,EAAA,WAAAC,EAAA,YAAAC,EAAA,UAAAC,EAAA,WAAAC,EAAA,gBAAAC,EAAA,SAAAC,EAAA,gBAAAC,EAAA,UAAAC,ICAA,IAAMC,EAAN,cAA2B,KAAM,CAC/B,YAAYC,KAAoBC,EAAe,CAC7C,MAAM,GAAGA,CAAM,EAEf,KAAK,KAAO,eACZ,KAAK,QAAUD,CACjB,CACF,EAEOE,EAAQH,ECHR,SAASI,EAAkBC,EAA2C,CAC3E,OAAOA,GAAU,IACnB,CAcO,SAASC,EAA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,CAAE,OAAQ,CAACD,CAAG,EAAG,OAAQ,CAAC,QAAQ,CAAE,CAAC,EAE3C,OAAO,SAAWA,EACX,OAAO,QAChB,CAEA,IAAOE,EAAQH,GCHf,SAASI,GAAKA,EAAgB,CAG5B,GAFAC,EAAM,CAAE,OAAQD,EAAM,OAAQ,CAAC,QAAQ,CAAE,CAAC,EAEtCA,EAAK,SAAW,EAClB,MAAM,IAAI,YACR,8DAA8DA,EAAK,MAAM,EAC3E,EAGFE,EAAY,SAAS,KAAOF,CAC9B,CAEA,IAAOG,EAAQH,GCZf,SAASI,GAAOA,EAAkB,CAGhC,GAFAC,EAAM,CAAE,OAAQD,EAAQ,OAAQ,CAAC,QAAQ,CAAE,CAAC,EAExCA,EAAO,SAAW,GACpB,MAAM,IAAI,YACR,iEAAiEA,EAAO,MAAM,EAChF,EAGFE,EAAY,SAAS,OAASF,CAChC,CAEA,IAAOG,EAAQH,GChBf,SAASI,IAAM,CACb,OAAOC,EAAY,QACrB,CAEA,IAAOC,EAAQF,GCPf,IAAOG,EAAQ,CACb,KAAAC,EACA,OAAAC,EACA,IAAAC,CACF,ECLA,IAAMC,EAAS,IAAIC,IAAqB,IAAIC,EAAY,GAAGD,CAAS,EAEpED,EAAO,OAASG,EAAc,OAC9BH,EAAO,KAAOG,EAAc,KAC5BH,EAAO,SAAWG,EAAc,SAChCH,EAAO,KAAOG,EAAc","names":["public_exports","__export","addClass_default","append_default","attr_default","css_default","data_default","each_default","first_default","firstChild_default","get_default","hasClass_default","html_default","on_default","parent_default","prepend_default","ready_default","remove_default","removeClass_default","text_default","toggleClass_default","value_default","RequiredType","message","params","RequiredType_error_default","isNullOrUndefined","value","allOf","values","typeOf","instanceOf","allowEmptyString","instancesNames","instance","expectedData","RequiredType_error_default","currentType","isSupportedType","isSupportedInstance","camelFromKebab","kebab","lower","rest","pascalRest","word","addClass","classNames","allOf","node","addClass_default","append","element","allOf","htmlElement","node","append_default","attr","attribute","value","allOf","isNullOrUndefined","node","attr_default","CSS_VALUE_REGEX","MONTHS","DAYS","SHORTCUT_EVENTS","css","property","value","allOf","isNullOrUndefined","matches","CSS_VALUE_REGEX","node","css_default","data","property","value","allOf","camelProperty","camelFromKebab","isNullOrUndefined","node","data_default","each","fns","allOf","node","index","nodeArray","fn","each_default","first","first_default","firstChild","firstChild_default","hasClass","className","strict","allOf","method","node","hasClass_default","html","append","isNullOrUndefined","strHtml","allOf","node","html_default","on","event","fns","allOf","node","fn","on_default","parent","parent_default","prepend","element","allOf","htmlElement","node","prepend_default","ready","fn","allOf","node","ready_default","remove","element","allOf","node","remove_default","removeClass","classNames","allOf","node","removeClass_default","text","isNullOrUndefined","allOf","node","text_default","toggleClass","classNames","allOf","node","className","toggleClass_default","value","isNullOrUndefined","node","value_default","get","index","get_default","static_exports","__export","create_default","date_default","i18n_default","navigate_default","create","element","allOf","create_default","UnitJSClass","_UnitJSClass","MONTHS","DAYS","selectors","selector","selectedNodes","SHORTCUT_EVENTS","e","fn","node","method","public_exports","date","format","timestamp","offset","allOf","validFormat","timestampOffsetMs","dateObject","UnitJSClass","acc","sym","date_default","navigate","url","allOf","navigate_default","days","allOf","UnitJSClass","days_default","months","allOf","UnitJSClass","months_default","get","UnitJSClass","get_default","i18n_default","days_default","months_default","get_default","UnitJS","selectors","UnitJSClass","static_exports"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sandboxed/unitjs",
3
- "version": "2.2.0",
3
+ "version": "2.2.6",
4
4
  "description": "UnitJS follows the `Revealing Module Pattern`. Easy to use DOM manipulation light-weight library",
5
5
  "main": "lib/cjs/unit.cjs",
6
6
  "module": "./lib/esm/unit.js",
@@ -25,7 +25,7 @@
25
25
  },
26
26
  "keywords": [],
27
27
  "author": "",
28
- "license": "MIT",
28
+ "license": "Apache-2.0",
29
29
  "bugs": {
30
30
  "url": "https://github.com/vmcruz/UnitJS/issues"
31
31
  },
@@ -41,10 +41,13 @@
41
41
  "jest-environment-jsdom": "^30.0.5",
42
42
  "prettier": "^3.6.2",
43
43
  "ts-jest": "^29.4.0",
44
- "tsup": "^8.5.0",
44
+ "tsup": "8.5.0",
45
45
  "typescript": "^5.8.3",
46
46
  "typescript-eslint": "^8.38.0"
47
47
  },
48
- "node": ">=18.0.0",
48
+ "engines": {
49
+ "node": ">=20.19.0"
50
+ },
51
+ "engineStrict": true,
49
52
  "type": "module"
50
53
  }