tiny-essentials 1.22.4 → 1.22.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.
Files changed (71) hide show
  1. package/changelog/1/1/0.md +1 -0
  2. package/changelog/1/10/0.md +19 -0
  3. package/changelog/1/10/2.md +23 -0
  4. package/changelog/1/11/0.md +66 -0
  5. package/changelog/1/12/0.md +54 -0
  6. package/changelog/1/12/1.md +37 -0
  7. package/changelog/1/12/2.md +29 -0
  8. package/changelog/1/13/0.md +41 -0
  9. package/changelog/1/13/1.md +7 -0
  10. package/changelog/1/13/2.md +13 -0
  11. package/changelog/1/14/0.md +33 -0
  12. package/changelog/1/15/0.md +39 -0
  13. package/changelog/1/16/0.md +42 -0
  14. package/changelog/1/16/1.md +43 -0
  15. package/changelog/1/16/2.md +29 -0
  16. package/changelog/1/17/0.md +28 -0
  17. package/changelog/1/17/1.md +40 -0
  18. package/changelog/1/18/0.md +43 -0
  19. package/changelog/1/18/1.md +12 -0
  20. package/changelog/1/19/1.md +21 -0
  21. package/changelog/1/19/2.md +23 -0
  22. package/changelog/1/19/3.md +15 -0
  23. package/changelog/1/2/0.md +5 -0
  24. package/changelog/1/2/1.md +5 -0
  25. package/changelog/1/20/0.md +9 -0
  26. package/changelog/1/20/1.md +40 -0
  27. package/changelog/1/20/2.md +22 -0
  28. package/changelog/1/20/3.md +39 -0
  29. package/changelog/1/21/0.md +23 -0
  30. package/changelog/1/21/1.md +12 -0
  31. package/changelog/1/21/10.md +23 -0
  32. package/changelog/1/21/2.md +9 -0
  33. package/changelog/1/21/3.md +9 -0
  34. package/changelog/1/21/4.md +9 -0
  35. package/changelog/1/21/6.md +23 -0
  36. package/changelog/1/21/7.md +16 -0
  37. package/changelog/1/21/8.md +5 -0
  38. package/changelog/1/21/9.md +17 -0
  39. package/changelog/1/22/1.md +28 -0
  40. package/changelog/1/22/2.md +17 -0
  41. package/changelog/1/22/3.md +11 -0
  42. package/changelog/1/22/4.md +35 -0
  43. package/changelog/1/22/5.md +23 -0
  44. package/changelog/1/22/6.md +25 -0
  45. package/changelog/1/3/1.md +4 -0
  46. package/changelog/1/3/2.md +2 -0
  47. package/changelog/1/4/0.md +5 -0
  48. package/changelog/1/5/0.md +4 -0
  49. package/changelog/1/5/1.md +2 -0
  50. package/changelog/1/6/0.md +6 -0
  51. package/changelog/1/7/0.md +3 -0
  52. package/changelog/1/7/1.md +3 -0
  53. package/changelog/1/8/0.md +3 -0
  54. package/changelog/1/8/1.md +2 -0
  55. package/changelog/1/8/2.md +2 -0
  56. package/changelog/1/8/3.md +3 -0
  57. package/changelog/1/8/4.md +2 -0
  58. package/changelog/1/8/5.md +6 -0
  59. package/changelog/1/9/0.md +27 -0
  60. package/changelog/1/9/1.md +5 -0
  61. package/changelog/1/9/2.md +14 -0
  62. package/dist/v1/TinyDragger.min.js +1 -1
  63. package/dist/v1/TinyEssentials.min.js +1 -1
  64. package/dist/v1/TinyHtml.min.js +1 -1
  65. package/dist/v1/TinySmartScroller.min.js +1 -1
  66. package/dist/v1/TinyUploadClicker.min.js +1 -1
  67. package/dist/v1/libs/TinyHtml.cjs +400 -20
  68. package/dist/v1/libs/TinyHtml.d.mts +220 -6
  69. package/dist/v1/libs/TinyHtml.mjs +384 -23
  70. package/docs/v1/libs/TinyHtml.md +36 -0
  71. package/package.json +1 -1
@@ -286,6 +286,90 @@ const __elemCollision = {
286
286
  class TinyHtml {
287
287
  /** @typedef {import('../basics/collision.mjs').ObjRect} ObjRect */
288
288
  static Utils = { ...TinyCollision };
289
+ /**
290
+ * Controls whether TinyHtml emits detailed debug output to the console.
291
+ * When enabled, helper methods print structured diagnostics for easier troubleshooting.
292
+ * @type {boolean}
293
+ */
294
+ static #elemDebug = false;
295
+ /**
296
+ * Gets whether debug output is enabled.
297
+ * @returns {boolean} True if debug output is enabled; otherwise, false.
298
+ */
299
+ static get elemDebug() {
300
+ return TinyHtml.#elemDebug;
301
+ }
302
+ /**
303
+ * Enables or disables debug output.
304
+ * @param {boolean} value True to enable debug output; false to disable.
305
+ * @throws {TypeError} Thrown if the provided value is not a boolean.
306
+ * @returns {void}
307
+ */
308
+ static set elemDebug(value) {
309
+ if (typeof value !== 'boolean')
310
+ throw new TypeError('Expected a boolean value for elemDebug');
311
+ TinyHtml.#elemDebug = value;
312
+ }
313
+ /**
314
+ * Logs a standardized debug error for element validation, including a console.table
315
+ * with the involved elements. Use this when an element argument is invalid, unexpected,
316
+ * or fails a guard/validation.
317
+ *
318
+ * The output includes:
319
+ * - A concise error header
320
+ * - A stack trace (when supported)
321
+ * - A table of elements (index, typeof, constructor, summary, value)
322
+ * - The specific problematic element, if provided
323
+ *
324
+ * @param {(ConstructorElValues | EventTarget | TinyElement | null)[]} elems
325
+ * A list of elements participating in the operation (may include nulls).
326
+ * @param {ConstructorElValues | EventTarget | TinyElement | null} [elem]
327
+ * The specific element that triggered the error, if available.
328
+ * @returns {void}
329
+ */
330
+ static _debugElemError(elems, elem) {
331
+ if (!TinyHtml.#elemDebug)
332
+ return;
333
+ const header = '[TinyHtml Debug] Element validation error';
334
+ console.groupCollapsed(`${header}${elem ? ' — details below' : ''}`);
335
+ console.error(header);
336
+ // Stack trace for call-site visibility
337
+ if (typeof Error !== 'undefined' && typeof Error.captureStackTrace === 'function') {
338
+ const err = new Error(header);
339
+ Error.captureStackTrace(err, TinyHtml._debugElemError);
340
+ console.error(err.stack);
341
+ }
342
+ else {
343
+ console.trace(header);
344
+ }
345
+ // Tabular overview of provided elements
346
+ if (Array.isArray(elems)) {
347
+ const rows = elems.map((el, index) => {
348
+ const typeOf = el === null ? 'null' : typeof el;
349
+ const ctor = el?.constructor?.name ?? (el === null ? 'null' : 'primitive');
350
+ const isDomEl = typeof Element !== 'undefined' && el instanceof Element;
351
+ const summary = isDomEl
352
+ ? `${el.tagName?.toLowerCase?.() ?? 'element'}#${el.id || ''}.${String(el.className || '')
353
+ .trim()
354
+ .replace(/\s+/g, '.')}`
355
+ : el && typeof el === 'object' && 'nodeType' in el
356
+ ? `nodeType:${ /** @type {any} */(el).nodeType}`
357
+ : '';
358
+ return { index, typeOf, constructor: ctor, summary, value: el };
359
+ });
360
+ console.table(rows);
361
+ }
362
+ else {
363
+ console.warn('[TinyHtml Debug] "elems" is not an array:', elems);
364
+ }
365
+ // Highlight the specific problematic element, if any
366
+ if (arguments.length > 1) {
367
+ console.error('[TinyHtml Debug] Problematic element:', elem);
368
+ if (elem && typeof elem === 'object')
369
+ console.dir(elem);
370
+ }
371
+ console.groupEnd();
372
+ }
289
373
  /**
290
374
  * Parse inline styles into an object.
291
375
  * @param {string} styleText
@@ -815,8 +899,10 @@ class TinyHtml {
815
899
  if (!(this.#el[index] instanceof Element) &&
816
900
  !(this.#el[index] instanceof Window) &&
817
901
  !(this.#el[index] instanceof Document) &&
818
- !(this.#el[index] instanceof Text))
902
+ !(this.#el[index] instanceof Text)) {
903
+ TinyHtml._debugElemError([...this.#el], this.#el[index]);
819
904
  throw new Error(`[TinyHtml] Invalid Element in ${where}().`);
905
+ }
820
906
  return this.#el[index];
821
907
  }
822
908
  /**
@@ -830,8 +916,10 @@ class TinyHtml {
830
916
  if (!this.#el.every((el) => el instanceof Element ||
831
917
  el instanceof Window ||
832
918
  el instanceof Document ||
833
- el instanceof Text))
919
+ el instanceof Text)) {
920
+ TinyHtml._debugElemError([...this.#el]);
834
921
  throw new Error(`[TinyHtml] Invalid Element in ${where}().`);
922
+ }
835
923
  return [...this.#el];
836
924
  }
837
925
  //////////////////////////////////////////////////////
@@ -860,8 +948,10 @@ class TinyHtml {
860
948
  break;
861
949
  }
862
950
  }
863
- if (!allowed)
951
+ if (!allowed) {
952
+ TinyHtml._debugElemError([...item], result);
864
953
  throw new Error(`[TinyHtml] Invalid element of the list "${elemName.join(',')}" in ${where}().`);
954
+ }
865
955
  results.push(result);
866
956
  return result;
867
957
  }));
@@ -888,8 +978,10 @@ class TinyHtml {
888
978
  const checkElement = (item) => {
889
979
  const elem = item[0];
890
980
  const result = elem instanceof TinyHtml ? elem._getElements(where) : [elem];
891
- if (result.length > 1)
981
+ if (result.length > 1) {
982
+ TinyHtml._debugElemError([...item]);
892
983
  throw new Error(`[TinyHtml] Invalid element amount in ${where}() (Received ${result.length}/1).`);
984
+ }
893
985
  let allowed = false;
894
986
  for (const TheTinyElement of TheTinyElements) {
895
987
  if (result[0] instanceof TheTinyElement) {
@@ -901,14 +993,18 @@ class TinyHtml {
901
993
  result[0] = null;
902
994
  allowed = true;
903
995
  }
904
- if (!allowed)
996
+ if (!allowed) {
997
+ TinyHtml._debugElemError([...item], result[0]);
905
998
  throw new Error(`[TinyHtml] Invalid element of the list "${elemName.join(',')}" in ${where}().`);
999
+ }
906
1000
  return result[0];
907
1001
  };
908
1002
  if (!Array.isArray(elems))
909
1003
  return checkElement([elems]);
910
- if (elems.length > 1)
1004
+ if (elems.length > 1) {
1005
+ TinyHtml._debugElemError([...elems]);
911
1006
  throw new Error(`[TinyHtml] Invalid element amount in ${where}() (Received ${elems.length}/1).`);
1007
+ }
912
1008
  return checkElement(elems);
913
1009
  }
914
1010
  /**
@@ -5843,6 +5939,277 @@ class TinyHtml {
5843
5939
  const propName = typeof TinyHtml.attrFix[name] === 'string' ? TinyHtml.attrFix[name] : name;
5844
5940
  return propName;
5845
5941
  }
5942
+ ////////////////////////////////////////////////////////////////////
5943
+ /**
5944
+ * Returns the BigInt value of an attribute.
5945
+ * @param {TinyElement} el
5946
+ * @param {string} name
5947
+ * @returns {bigint|null}
5948
+ */
5949
+ static attrBigInt(el, name) {
5950
+ const elem = TinyHtml._preElem(el, 'attrBigInt');
5951
+ const val = elem.getAttribute(TinyHtml.getAttrName(name));
5952
+ if (val == null)
5953
+ return null;
5954
+ try {
5955
+ return BigInt(val);
5956
+ }
5957
+ catch {
5958
+ return null;
5959
+ }
5960
+ }
5961
+ /**
5962
+ * Returns the BigInt value of an attribute.
5963
+ * @param {string} name
5964
+ * @returns {bigint|null}
5965
+ */
5966
+ attrBigInt(name) {
5967
+ return TinyHtml.attrBigInt(this, name);
5968
+ }
5969
+ /**
5970
+ * Set a BigInt attribute.
5971
+ * @template {TinyElement|TinyElement[]} T
5972
+ * @param {T} el
5973
+ * @param {string} name
5974
+ * @param {bigint} value
5975
+ * @returns {T}
5976
+ */
5977
+ static setAttrBigInt(el, name, value) {
5978
+ if (typeof value !== 'bigint')
5979
+ throw new Error('Value is not a valid BigInt.');
5980
+ return TinyHtml.setAttr(el, name, value.toString());
5981
+ }
5982
+ /**
5983
+ * Set a BigInt attribute.
5984
+ * @param {string} name
5985
+ * @param {bigint} value
5986
+ * @returns {this}
5987
+ */
5988
+ setAttrBigInt(name, value) {
5989
+ return TinyHtml.setAttrBigInt(this, name, value);
5990
+ }
5991
+ /**
5992
+ * Returns the Date value of an attribute.
5993
+ * @param {TinyElement} el
5994
+ * @param {string} name
5995
+ * @returns {Date|null}
5996
+ */
5997
+ static attrDate(el, name) {
5998
+ const elem = TinyHtml._preElem(el, 'attrDate');
5999
+ const val = elem.getAttribute(TinyHtml.getAttrName(name));
6000
+ if (!val)
6001
+ return null;
6002
+ const d = new Date(val);
6003
+ return Number.isNaN(d.getTime()) ? null : d;
6004
+ }
6005
+ /**
6006
+ * Returns the Date value of an attribute.
6007
+ * @param {string} name
6008
+ * @returns {Date|null}
6009
+ */
6010
+ attrDate(name) {
6011
+ return TinyHtml.attrDate(this, name);
6012
+ }
6013
+ /**
6014
+ * Set a Date attribute.
6015
+ * @template {TinyElement|TinyElement[]} T
6016
+ * @param {T} el
6017
+ * @param {string} name
6018
+ * @param {Date} value
6019
+ * @returns {T}
6020
+ */
6021
+ static setAttrDate(el, name, value) {
6022
+ if (!(value instanceof Date) || Number.isNaN(value.getTime()))
6023
+ throw new Error('Value is not a valid Date.');
6024
+ return TinyHtml.setAttr(el, name, value.toISOString());
6025
+ }
6026
+ /**
6027
+ * Set a Date attribute.
6028
+ * @param {string} name
6029
+ * @param {Date} value
6030
+ * @returns {this}
6031
+ */
6032
+ setAttrDate(name, value) {
6033
+ return TinyHtml.setAttrDate(this, name, value);
6034
+ }
6035
+ /**
6036
+ * Returns the JSON value of an attribute.
6037
+ * @param {TinyElement} el
6038
+ * @param {string} name
6039
+ * @returns {any|null}
6040
+ */
6041
+ static attrJson(el, name) {
6042
+ const elem = TinyHtml._preElem(el, 'attrJson');
6043
+ const val = elem.getAttribute(TinyHtml.getAttrName(name));
6044
+ if (!val)
6045
+ return null;
6046
+ try {
6047
+ return JSON.parse(val);
6048
+ }
6049
+ catch {
6050
+ return null;
6051
+ }
6052
+ }
6053
+ /**
6054
+ * Returns the JSON value of an attribute.
6055
+ * @param {string} name
6056
+ * @returns {any|null}
6057
+ */
6058
+ attrJson(name) {
6059
+ return TinyHtml.attrJson(this, name);
6060
+ }
6061
+ /**
6062
+ * Set a JSON attribute.
6063
+ * @template {TinyElement|TinyElement[]} T
6064
+ * @param {T} el
6065
+ * @param {string} name
6066
+ * @param {any} value
6067
+ * @param {(this: any, key: string, value: any) => any} [replacer]
6068
+ * @param {number|string} [space]
6069
+ * @returns {T}
6070
+ */
6071
+ static setAttrJson(el, name, value, replacer, space) {
6072
+ const data = JSON.stringify(value, replacer, space);
6073
+ return TinyHtml.setAttr(el, name, data);
6074
+ }
6075
+ /**
6076
+ * Set a JSON attribute.
6077
+ * @param {string} name
6078
+ * @param {any} value
6079
+ * @param {(this: any, key: string, value: any) => any} [replacer]
6080
+ * @param {number|string} [space]
6081
+ * @returns {this}
6082
+ */
6083
+ setAttrJson(name, value, replacer, space) {
6084
+ return TinyHtml.setAttrJson(this, name, value, replacer, space);
6085
+ }
6086
+ /**
6087
+ * Returns the number value of an attribute.
6088
+ * @param {TinyElement} el
6089
+ * @param {string} name
6090
+ * @returns {number|null}
6091
+ */
6092
+ static attrNumber(el, name) {
6093
+ const elem = TinyHtml._preElem(el, 'attrNumber');
6094
+ const val = elem.getAttribute(TinyHtml.getAttrName(name));
6095
+ return val != null ? parseFloat(val) : null;
6096
+ }
6097
+ /**
6098
+ * Returns the number value of an attribute.
6099
+ * @param {string} name
6100
+ * @returns {number|null}
6101
+ */
6102
+ attrNumber(name) {
6103
+ return TinyHtml.attrNumber(this, name);
6104
+ }
6105
+ /**
6106
+ * Set a number attribute.
6107
+ * @template {TinyElement|TinyElement[]} T
6108
+ * @param {T} el
6109
+ * @param {string} name
6110
+ * @param {number} value
6111
+ * @returns {T}
6112
+ */
6113
+ static setAttrNumber(el, name, value) {
6114
+ if (typeof value !== 'number')
6115
+ throw new Error('Value is not a valid number.');
6116
+ return TinyHtml.setAttr(el, name, value.toString());
6117
+ }
6118
+ /**
6119
+ * Set a number attribute.
6120
+ * @param {string} name
6121
+ * @param {number} value
6122
+ * @returns {this}
6123
+ */
6124
+ setAttrNumber(name, value) {
6125
+ return TinyHtml.setAttrNumber(this, name, value);
6126
+ }
6127
+ /**
6128
+ * Returns the boolean value of an attribute.
6129
+ * @param {TinyElement} el
6130
+ * @param {string} name
6131
+ * @returns {boolean|null}
6132
+ */
6133
+ static attrBoolean(el, name) {
6134
+ const elem = TinyHtml._preElem(el, 'attrBoolean');
6135
+ const val = elem.getAttribute(TinyHtml.getAttrName(name));
6136
+ if (val === null)
6137
+ return null;
6138
+ if (val !== 'true' && val !== 'false')
6139
+ return null;
6140
+ return /^true$/i.test(val);
6141
+ }
6142
+ /**
6143
+ * Returns the boolean value of an attribute.
6144
+ * @param {string} name
6145
+ * @returns {boolean|null}
6146
+ */
6147
+ attrBoolean(name) {
6148
+ return TinyHtml.attrBoolean(this, name);
6149
+ }
6150
+ /**
6151
+ * Set a boolean attribute.
6152
+ * @template {TinyElement|TinyElement[]} T
6153
+ * @param {T} el
6154
+ * @param {string} name
6155
+ * @param {boolean} value
6156
+ * @returns {T}
6157
+ */
6158
+ static setAttrBoolean(el, name, value) {
6159
+ if (typeof value !== 'boolean')
6160
+ throw new Error('Value is not a valid boolean.');
6161
+ return TinyHtml.setAttr(el, name, value.toString());
6162
+ }
6163
+ /**
6164
+ * Set a boolean attribute.
6165
+ * @param {string} name
6166
+ * @param {boolean} value
6167
+ * @returns {this}
6168
+ */
6169
+ setAttrBoolean(name, value) {
6170
+ return TinyHtml.setAttrBoolean(this, name, value);
6171
+ }
6172
+ /**
6173
+ * Returns the string value of an attribute.
6174
+ * @param {TinyElement} el
6175
+ * @param {string} name
6176
+ * @returns {string|null}
6177
+ */
6178
+ static attrString(el, name) {
6179
+ const elem = TinyHtml._preElem(el, 'attrString');
6180
+ const value = elem.getAttribute(TinyHtml.getAttrName(name));
6181
+ return typeof value === 'string' ? value : null;
6182
+ }
6183
+ /**
6184
+ * Returns the string value of an attribute.
6185
+ * @param {string} name
6186
+ * @returns {string|null}
6187
+ */
6188
+ attrString(name) {
6189
+ return TinyHtml.attrString(this, name);
6190
+ }
6191
+ /**
6192
+ * Set a string attribute.
6193
+ * @template {TinyElement|TinyElement[]} T
6194
+ * @param {T} el
6195
+ * @param {string} name
6196
+ * @param {string} value
6197
+ * @returns {T}
6198
+ */
6199
+ static setAttrString(el, name, value) {
6200
+ if (typeof value !== 'string')
6201
+ throw new Error('Value is not a valid string.');
6202
+ return TinyHtml.setAttr(el, name, value);
6203
+ }
6204
+ /**
6205
+ * Set a string attribute.
6206
+ * @param {string} name
6207
+ * @param {string} value
6208
+ * @returns {this}
6209
+ */
6210
+ setAttrString(name, value) {
6211
+ return TinyHtml.setAttrString(this, name, value);
6212
+ }
5846
6213
  /**
5847
6214
  * Get an attribute on an element.
5848
6215
  * @param {TinyElement} el
@@ -5867,43 +6234,37 @@ class TinyHtml {
5867
6234
  * Set one or multiple attributes on an element.
5868
6235
  * @template {TinyElement|TinyElement[]} T
5869
6236
  * @param {T} el - Target element(s).
5870
- * @param {string|Record<string, string|null>} name - Attribute name or an object of attributes.
5871
- * @param {string|number|null} [value=null] - Attribute value (ignored if "name" is an object).
6237
+ * @param {string|Record<string, any>} name - Attribute name or an object of attributes.
6238
+ * @param {any} [value=null] - Attribute value (ignored if "name" is an object).
5872
6239
  * @returns {T}
5873
6240
  */
5874
6241
  static setAttr(el, name, value = null) {
5875
6242
  const elems = TinyHtml._preElems(el, 'setAttr');
5876
6243
  // Multiple attributes at once
5877
6244
  if (typeof name === 'object' && name !== null) {
5878
- Object.entries(name).forEach(([attr, val]) => {
5879
- if (val !== null && typeof val !== 'string' && typeof val !== 'number')
5880
- throw new TypeError(`The value for "${attr}" must be a string/number or null.`);
5881
- elems.forEach((elem) => {
5882
- if (val === null)
5883
- elem.removeAttribute(TinyHtml.getAttrName(attr));
5884
- else
5885
- elem.setAttribute(TinyHtml.getAttrName(attr), val);
5886
- });
5887
- });
6245
+ Object.entries(name).forEach(([attr, val]) => elems.forEach((elem) => {
6246
+ if (val === null)
6247
+ elem.removeAttribute(TinyHtml.getAttrName(attr));
6248
+ else
6249
+ elem.setAttribute(TinyHtml.getAttrName(attr), String(val));
6250
+ }));
5888
6251
  return el;
5889
6252
  }
5890
6253
  // Single attribute
5891
6254
  if (typeof name !== 'string')
5892
6255
  throw new TypeError('The "name" must be a string.');
5893
- if (value !== null && typeof value !== 'string')
5894
- throw new TypeError('The "value" must be a string.');
5895
6256
  elems.forEach((elem) => {
5896
6257
  if (value === null)
5897
6258
  elem.removeAttribute(TinyHtml.getAttrName(name));
5898
6259
  else
5899
- elem.setAttribute(TinyHtml.getAttrName(name), value);
6260
+ elem.setAttribute(TinyHtml.getAttrName(name), String(value));
5900
6261
  });
5901
6262
  return el;
5902
6263
  }
5903
6264
  /**
5904
6265
  * Set one or multiple attributes on an element.
5905
- * @param {string|Record<string, string|null>} name - Attribute name or an object of attributes.
5906
- * @param {string|number|null} [value=null] - Attribute value (ignored if "name" is an object).
6266
+ * @param {string|Record<string, any>} name - Attribute name or an object of attributes.
6267
+ * @param {any} [value=null] - Attribute value (ignored if "name" is an object).
5907
6268
  * @returns {this}
5908
6269
  */
5909
6270
  setAttr(name, value) {
@@ -2076,6 +2076,42 @@ element.removeAttr("data-test"); // Remove
2076
2076
  element.hasAttr("id"); // Check
2077
2077
  ```
2078
2078
 
2079
+ ```js
2080
+ element.attrBigInt("example"); // Get
2081
+ element.setAttrBigInt("example", 10n); // Set
2082
+ element.setAttrBigInt({ "example": 10n }); // Set
2083
+ ```
2084
+
2085
+ ```js
2086
+ element.attrDate("example"); // Get
2087
+ element.setAttrDate("example", new Date()); // Set
2088
+ element.setAttrDate({ "example": new Date() }); // Set
2089
+ ```
2090
+
2091
+ ```js
2092
+ element.attrJson("example"); // Get
2093
+ element.setAttrJson("example", { pudding: true }); // Set
2094
+ element.setAttrJson({ "example": { pudding: true } }); // Set
2095
+ ```
2096
+
2097
+ ```js
2098
+ element.attrNumber("example"); // Get
2099
+ element.setAttrNumber("example", 1); // Set
2100
+ element.setAttrNumber({ "example": 1 }); // Set
2101
+ ```
2102
+
2103
+ ```js
2104
+ element.attrBoolean("example"); // Get
2105
+ element.setAttrBoolean("example", true); // Set
2106
+ element.setAttrBoolean({ "example": true }); // Set
2107
+ ```
2108
+
2109
+ ```js
2110
+ element.attrString("example"); // Get
2111
+ element.setAttrString("example", "pudding"); // Set
2112
+ element.setAttrString({ "example": "pudding" }); // Set
2113
+ ```
2114
+
2079
2115
  Works on both single and multiple elements (static or instance).
2080
2116
  Safe and type-checked — throws if misuse is detected.
2081
2117
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tiny-essentials",
3
- "version": "1.22.4",
3
+ "version": "1.22.6",
4
4
  "description": "Collection of small, essential scripts designed to be used across various projects. These simple utilities are crafted for speed, ease of use, and versatility.",
5
5
  "scripts": {
6
6
  "test": "npm run test:mjs && npm run test:cjs && npm run test:js",