@cntwg/html-helper 0.0.24 → 0.0.25

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,13 @@
1
+ #### *v0.0.25*
2
+
3
+ Pre-release version.
4
+
5
+ > - update dependency on `@ygracs/bsfoc-lib-js` module to v0.2.3;
6
+ > - add dependency on `@ygracs/lists-lib-js` module;
7
+ > - remove some deprecates (*see docs for details*);
8
+ > - change pattern for an element manipulation functions (*see docs for details*);
9
+ > - change behavior for `loadItems` method of `THtmlStubItemsSet` class in handling `options` parameter (*see docs for details*).
10
+
1
11
  #### *v0.0.24*
2
12
 
3
13
  Pre-release version.
@@ -1,6 +1,6 @@
1
- >|***rev.*:**|0.1.22|
1
+ >|***rev.*:**|0.1.23|
2
2
  >|:---|---:|
3
- >|date:|2024-11-13|
3
+ >|date:|2025-04-16|
4
4
 
5
5
  ## Introduction
6
6
 
@@ -763,6 +763,8 @@ This class methods loads an items given by `list` in the set and returned quanti
763
763
  | `list` | `array`, `object` | --- | an array of entries or a special descriptive object |
764
764
  | `options` | `boolean`, `object` | --- | an options |
765
765
 
766
+ > \[!] NOTE: *`[since v0.0.25]`* the use of a booleans as an `options` value is deprecated and will be dropped soon.
767
+
766
768
  If the `list` parameter is an `object` that contains the following set of values:
767
769
 
768
770
  | option name | value type | default value | description |
@@ -1,6 +1,6 @@
1
- >|***rev.*:**|0.1.14|
1
+ >|***rev.*:**|0.1.15|
2
2
  >|:---|---:|
3
- >|date:|2024-11-10|
3
+ >|date:|2025-03-29|
4
4
 
5
5
  ## Introduction
6
6
 
@@ -170,7 +170,7 @@ This function enables a given HTML-element.
170
170
  | `obj` | `HTMLElement` | --- | some element to be modified |
171
171
 
172
172
  <a name="activateHTMLElements"></a>
173
- #### **activateHtmlElements(arg_1\[, arg_2\[, ...arg_N]])** => `void`
173
+ #### **activateHTMLElements(arg_1\[, arg_2\[, ...arg_N]])** => `void`
174
174
 
175
175
  This function enables all HTML-elements received as a function arguments.
176
176
 
@@ -207,8 +207,8 @@ The `options` parameter if sets to `true` force the function to remove all dupli
207
207
 
208
208
  > Note: Purpose of those functions will be discussed and some may be deprecate and make obsolete or functionality may be altered. So use it with cautions in mind.
209
209
 
210
- <a name="createNewHtmlElement"></a>
211
- #### **createNewHtmlElement(tagName\[, options])**
210
+ <a name="createNewHTMLElement"></a>
211
+ #### **createNewHTMLElement(tagName\[, options])**
212
212
 
213
213
  This function helps to simplify the process of creating a new HTML-element. It receives the tag name (`tagName` parameter) and the options as a second parameter:
214
214
 
package/index.js CHANGED
@@ -1,4 +1,4 @@
1
- // [v0.1.025-20241115]
1
+ // [v0.1.027-20250329]
2
2
 
3
3
  // === module init block ===
4
4
 
@@ -69,7 +69,7 @@ module.exports.readAsTagName = html_helper.readAsTagName;
69
69
  module.exports.readAsAttrName = html_helper.readAsAttrName;
70
70
  module.exports.readAsAttrValue = html_helper.readAsAttrValue;
71
71
  module.exports.valueToElementID = html_helper.valueToElementID;
72
- module.exports.createNewHtmlElement = html_helper.createNewHtmlElement;
72
+ module.exports.createNewHTMLElement = html_helper.createNewHTMLElement;
73
73
 
74
74
  module.exports.isHTMLButton = html_bts.isHTMLButton;
75
75
 
@@ -85,15 +85,4 @@ module.exports.classes = components;
85
85
 
86
86
  // deprecated
87
87
  module.exports.component = components;
88
- module.exports.hideHtmlElement = html_helper.hideHtmlElement;
89
- module.exports.showHtmlElement = html_helper.showHtmlElement;
90
- module.exports.selectHtmlElement = html_helper.selectHtmlElement;
91
- module.exports.unselectHtmlElement = html_helper.unselectHtmlElement;
92
- module.exports.markHtmlElementAsCurrent = html_helper.markHtmlElementAsCurrent;
93
- module.exports.unmarkCurrentHtmlElement = html_helper.unmarkCurrentHtmlElement;
94
- module.exports.markHtmlElementAsActive = html_helper.markHtmlElementAsActive;
95
- module.exports.unmarkActiveHtmlElement = html_helper.unmarkActiveHtmlElement;
96
- module.exports.lockHtmlElement = html_helper.lockHtmlElement;
97
- module.exports.unlockHtmlElement = html_helper.unlockHtmlElement;
98
- module.exports.inactivateHtmlElements = html_helper.inactivateHtmlElements;
99
- module.exports.activateHtmlElements = html_helper.activateHtmlElements;
88
+ module.exports.createNewHtmlElement = html_helper.createNewHtmlElement;
@@ -1,10 +1,14 @@
1
- // [v0.1.056-20241119]
1
+ // [v0.1.058-20250416]
2
2
 
3
3
  // === module init block ===
4
4
 
5
5
  const {
6
6
  isNotEmptyString,
7
7
  isPlainObject, valueToArray,
8
+ //TItemsICollection,
9
+ } = require('@ygracs/bsfoc-lib-js');
10
+
11
+ const {
8
12
  TItemsICollection,
9
13
  } = require('@ygracs/bsfoc-lib-js');
10
14
 
@@ -78,7 +82,7 @@ function isHTMLButton(obj) {
78
82
  * @classdesc This class implements an interface of a buttons set
79
83
  */
80
84
  class THtmlButtonsSet {
81
- /** @property {TItemsICollection} */
85
+ /** @type {TItemsICollection} */
82
86
  #_btnCol;
83
87
 
84
88
  /**
@@ -103,20 +107,20 @@ class THtmlButtonsSet {
103
107
  }
104
108
 
105
109
  /**
106
- * @property {string[]}
110
+ * Contains a list of an element names
111
+ * @type {string[]}
107
112
  * @readonly
108
113
  * @see TItemsICollection.ItemNames
109
- * @description Contains a list of an element names
110
114
  */
111
115
  get ItemNames() {
112
116
  return this.#_btnCol.ItemNames;
113
117
  }
114
118
 
115
119
  /**
116
- * @property {string[]}
120
+ * Contains a list of an elements group names
121
+ * @type {string[]}
117
122
  * @readonly
118
123
  * @see TItemsICollection.CategoryNames
119
- * @description Contains a list of an elements group names
120
124
  */
121
125
  get GroupNames() {
122
126
  return this.#_btnCol.CategoryNames;
@@ -267,9 +271,9 @@ class THtmlButtonsSet {
267
271
  }
268
272
 
269
273
  /**
270
- * @returns {function}
274
+ * Returns a function wich do a validation check.
275
+ * @type {isHTMLButton}
271
276
  * @static
272
- * @description Returns a function wich do a validation check.
273
277
  */
274
278
  static get isHTMLButton() {
275
279
  return isHTMLButton;
@@ -282,9 +286,9 @@ class THtmlButtonsSet {
282
286
  * A set provide a three button: <apply>, <reset> and <cancel>.
283
287
  */
284
288
  class THtmlButtonsControllerARCSet {
285
- /** @property {THtmlButtonsSet} */
289
+ /** @type {THtmlButtonsSet} */
286
290
  #_btnSet;
287
- /** @property {Map} */
291
+ /** @type {Map<string, Function>} */
288
292
  #_events;
289
293
 
290
294
  /**
@@ -1,4 +1,4 @@
1
- // [v0.1.017-20241119]
1
+ // [v0.1.019-20250416]
2
2
 
3
3
  // === module init block ===
4
4
 
@@ -9,7 +9,7 @@ const {
9
9
  } = require('@ygracs/bsfoc-lib-js');
10
10
 
11
11
  const {
12
- isHTMLElement, createNewHtmlElement,
12
+ isHTMLElement, createNewHTMLElement,
13
13
  valueToIDString, valueToClassList,
14
14
  readAsAttrValue,
15
15
  showHTMLElement, hideHTMLElement,
@@ -95,19 +95,51 @@ function getLabelPositionID(value) {
95
95
  * (* class definitions *)
96
96
  */
97
97
 
98
+ /**
99
+ * @typedef {Object} OPT_ifcdesc
100
+ * @property {object} [host]
101
+ * @property {string} [idPref]
102
+ * @property {object} [label]
103
+ * @property {object} [labelPosition]
104
+ * @property {boolean} [useDelim]
105
+ * @property {object} [baseClassID]
106
+ * @property {string} [hint]
107
+ * @property {object} [type]
108
+ * @property {boolean} [readonly] - mode flag
109
+ * @description An options set for create ifc
110
+ */
111
+
112
+ /**
113
+ * @typedef {Object} OPT_ifcsett
114
+ * @property {string} [idPref]
115
+ * @property {(string|string[])} [baseClassID]
116
+ * @property {string} [hint]
117
+ * @property {string} [type]
118
+ * @property {boolean} [readonly=true] - mode flag
119
+ * @description An options set for `THtmlInputField`-class
120
+ */
121
+
122
+ /**
123
+ * @typedef {Object} ifcElementsDesc
124
+ * @property {HTMLElement} host - host element
125
+ * @property {HTMLElement} label - label element
126
+ * @property {HTMLElement} field - field element
127
+ * @description A description for input field elements set.
128
+ */
129
+
98
130
  /**
99
131
  * @classdesc This class implements an interface of an input field element
100
132
  */
101
133
  class THtmlInputField {
102
- /** @property {?HTMLElement} */
134
+ /** @type {?HTMLElement} */
103
135
  #_host;// = null;
104
- /** @property {?HTMLElement} */
136
+ /** @type {?HTMLElement} */
105
137
  #_label;// = null;
106
- /** @property {?HTMLElement} */
138
+ /** @type {?HTMLElement} */
107
139
  #_field;// = null;
108
140
  #_id = '';
109
141
  #_value = '';
110
- /** @property {object} */
142
+ /** @type {OPT_ifcsett} */
111
143
  #_options = null;
112
144
  /**
113
145
  * @typedef {Object} statIFCtrl
@@ -118,28 +150,15 @@ class THtmlInputField {
118
150
  * @inner
119
151
  * @description A controller status
120
152
  */
121
- /** @property {statIFCtrl} */
153
+ /** @type {statIFCtrl} */
122
154
  #_status;// = null;
123
- /** @property {Map} */
155
+ /** @type {Map<string, Function>} */
124
156
  #_events;// = null;
125
157
 
126
- /**
127
- * @typedef {Object} ifcElementsDesc
128
- * @property {HTMLElement} host - host element
129
- * @property {HTMLElement} label - label element
130
- * @property {HTMLElement} field - field element
131
- * @description A description for input field elements set.
132
- */
133
-
134
158
  /**
135
159
  * @param {string} name - <*reserved*>
136
160
  * @param {ifcElementsDesc} eholds - elements set
137
- * @param {object} [opt]
138
- * @param {string} [opt.idPref]
139
- * @param {(string|string[])} [opt.baseClassID]
140
- * @param {string} [opt.hint]
141
- * @param {string} [opt.type]
142
- * @param {boolean} [opt.readonly=true]
161
+ * @param {OPT_ifcsett} [opt] - options
143
162
  * @description Creates an instance of an input field element
144
163
  */
145
164
  constructor(name, eholds, opt) {
@@ -185,28 +204,28 @@ class THtmlInputField {
185
204
  }
186
205
 
187
206
  /**
188
- * @property {boolean}
207
+ * Indicates whether element value was modified.
208
+ * @type {boolean}
189
209
  * @readonly
190
- * @description Indicates whether element value was modified.
191
210
  */
192
211
  get isModified() {
193
212
  return this.#_status.isModified;
194
213
  }
195
214
 
196
215
  /**
216
+ * Returns an input element origin type.
197
217
  * @since v0.0.23
198
- * @property {string}
218
+ * @type {string}
199
219
  * @readonly
200
- * @description Returns an input element origin type.
201
220
  */
202
221
  get type() {
203
222
  return this.#_status.fldType;
204
223
  }
205
224
 
206
225
  /**
207
- * @property {string}
226
+ * Containes an element value.
227
+ * @type {string}
208
228
  * @fires THtmlInputField#value-empty
209
- * @description Containes an element value.
210
229
  */
211
230
  get value() {
212
231
  const field = this.#_field;
@@ -371,7 +390,7 @@ class THtmlInputField {
371
390
 
372
391
  /**
373
392
  * @param {string} name - <*reserved*>
374
- * @param {object} opt
393
+ * @param {OPT_ifcdesc} opt - options
375
394
  * @returns {?THtmlInputField}
376
395
  * @static
377
396
  * @description Creates a new element.
@@ -388,17 +407,8 @@ class THtmlInputField {
388
407
 
389
408
  /**
390
409
  * @param {string} name
391
- * @param {object} [opt]
392
- * @param {object} [opt.host]
393
- * @param {string} [opt.idPref]
394
- * @param {object} [opt.label]
395
- * @param {object} [opt.labelPosition]
396
- * @param {boolean} [opt.useDelim]
397
- * @param {object} [opt.baseClassID]
398
- * @param {string} [opt.hint]
399
- * @param {object} [opt.type]
400
- * @param {boolean} [opt.readonly]
401
- * @param {boolean} [doRetChild=false]
410
+ * @param {OPT_ifcdesc} [opt] - options
411
+ * @param {boolean} [doRetChild=false] - mode flag
402
412
  * @returns {(HTMLElement|ifcElementsDesc)}
403
413
  * @static
404
414
  * @description Creates a new elements.
@@ -407,6 +417,7 @@ class THtmlInputField {
407
417
  const id = valueToIDString(name);
408
418
  const _options = isPlainObject(opt) ? opt : {};
409
419
  let fldSubType = '';
420
+ /** @type {OPT_ifcdesc} */
410
421
  let {
411
422
  host,
412
423
  idPref,
@@ -440,7 +451,7 @@ class THtmlInputField {
440
451
  isReadOnly = readAsBool(isReadOnly, true);
441
452
  let fldID = idPref === '' ? id : `${idPref}-${id}`;
442
453
  if (!isHTMLElement(host)) {
443
- host = createNewHtmlElement('div', {
454
+ host = createNewHTMLElement('div', {
444
455
  class: bcidHost,
445
456
  });
446
457
  };
@@ -450,7 +461,7 @@ class THtmlInputField {
450
461
  if (host) {
451
462
  lblHolder = host.querySelector(`label[for="${fldID}"]`);
452
463
  if (!lblHolder) {
453
- lblHolder = createNewHtmlElement('label', {
464
+ lblHolder = createNewHTMLElement('label', {
454
465
  text: label,
455
466
  attr: {
456
467
  for: fldID,
@@ -460,7 +471,7 @@ class THtmlInputField {
460
471
  };
461
472
  fldHolder = host.querySelector(`input#${fldID}`);
462
473
  if (!fldHolder) {
463
- fldHolder = createNewHtmlElement('input', {
474
+ fldHolder = createNewHTMLElement('input', {
464
475
  id: fldID,
465
476
  attr: {
466
477
  type: fldType,
@@ -1,13 +1,17 @@
1
- // [v0.1.067-20241119]
1
+ // [v0.1.069-20250416]
2
2
 
3
3
  // === module init block ===
4
4
 
5
5
  const {
6
6
  readAsNumber,
7
7
  isPlainObject,
8
- TItemsListEx,
8
+ //TItemsListEx,
9
9
  } = require('@ygracs/bsfoc-lib-js');
10
10
 
11
+ const {
12
+ TItemsListEx,
13
+ } = require('@ygracs/lists-lib-js');
14
+
11
15
  const {
12
16
  isHTMLElement, isSelectedHTMLElement, isHiddenHTMLElement,
13
17
  showHTMLElement, hideHTMLElement,
@@ -85,15 +89,23 @@ const ILC_SMODE_CTRL = 2;
85
89
  * (* class definitions *)
86
90
  */
87
91
 
92
+ /**
93
+ * @typedef {Object} OPT_hlconsett
94
+ * @property {boolean} [autoHideNewItems=false]
95
+ * @property {boolean} [markCurrentItem=false]
96
+ * @property {(string|string[])} [itemBaseClassID]
97
+ * @description An options set for `THtmlItemsListContainer`-class
98
+ */
99
+
88
100
  /**
89
101
  * @classdesc This class implements an interfaco for a list container
90
102
  */
91
103
  class THtmlItemsListContainer {
92
- /** @property {?HTMLElement} */
104
+ /** @type {?HTMLElement} */
93
105
  #_host;
94
- /** @property {TItemsListEx} */
106
+ /** @type {TItemsListEx} */
95
107
  #_items;
96
- /** @property {object} */
108
+ /** @type {OPT_hlconsett} */
97
109
  #_options;// = null;
98
110
  /**
99
111
  * @typedef {Object} statILCont
@@ -102,15 +114,12 @@ class THtmlItemsListContainer {
102
114
  * @inner
103
115
  * @description A container status
104
116
  */
105
- /** @property {statILCont} */
117
+ /** @type {statILCont} */
106
118
  #_status;
107
119
 
108
120
  /**
109
121
  * @param {HTMLElement} host
110
- * @param {object} [opt]
111
- * @param {boolean} [opt.autoHideNewItems=false]
112
- * @param {boolean} [opt.markCurrentItem=false]
113
- * @param {(string|string[])} [opt.itemBaseClassID]
122
+ * @param {OPT_hlconsett} [opt] - options
114
123
  * @description Creates an instance of a list container
115
124
  */
116
125
  constructor(host, opt) {
@@ -120,6 +129,7 @@ class THtmlItemsListContainer {
120
129
  const _items = new TItemsListEx();
121
130
  this.#_items = _items;
122
131
  // load options
132
+ /** @type {OPT_hlconsett} */
123
133
  const _options = isPlainObject(opt) ? opt : {};
124
134
  let {
125
135
  autoHideNewItems,
@@ -146,63 +156,63 @@ class THtmlItemsListContainer {
146
156
  }
147
157
 
148
158
  /**
149
- * @property {number}
159
+ * Contains a Qty of an elements
160
+ * @type {number}
150
161
  * @readonly
151
- * @description Contains a Qty of an elements
152
162
  */
153
163
  get count() {
154
164
  return this.#_items.count;
155
165
  }
156
166
 
157
167
  /**
158
- * @property {number}
168
+ * Contains an of the current element
169
+ * @type {number}
159
170
  * @readonly
160
- * @description Contains an of the current element
161
171
  */
162
172
  get curIndex() {
163
173
  return this.#_items.curIndex;
164
174
  }
165
175
 
166
176
  /**
167
- * @property {number}
177
+ * Returns a minimum value of an index
178
+ * @type {number}
168
179
  * @readonly
169
- * @description Returns a minimum value of an index
170
180
  */
171
181
  get minIndex() {
172
182
  return this.#_items.minIndex;
173
183
  }
174
184
 
175
185
  /**
176
- * @property {number}
186
+ * Returns a maximum value of an index
187
+ * @type {number}
177
188
  * @readonly
178
- * @description Returns a maximum value of an index
179
189
  */
180
190
  get maxIndex() {
181
191
  return this.#_items.maxIndex;
182
192
  }
183
193
 
184
194
  /**
185
- * @property {number}
195
+ * Returns a value of a previous index
196
+ * @type {number}
186
197
  * @readonly
187
- * @description Returns a value of a previous index
188
198
  */
189
199
  get prevIndex() {
190
200
  return this.#_items.prevIndex;
191
201
  }
192
202
 
193
203
  /**
194
- * @property {number}
204
+ * Returns a value of a next index
205
+ * @type {number}
195
206
  * @readonly
196
- * @description Returns a value of a next index
197
207
  */
198
208
  get nextIndex() {
199
209
  return this.#_items.nextIndex;
200
210
  }
201
211
 
202
212
  /**
203
- * @property {?HTMLElement}
213
+ * Returns an element in the current index
214
+ * @type {?HTMLElement}
204
215
  * @readonly
205
- * @description Returns an element in the current index
206
216
  */
207
217
  get curItem() {
208
218
  const item = this.#_items.curItem;
@@ -471,19 +481,31 @@ class THtmlItemsListContainer {
471
481
 
472
482
  };
473
483
 
484
+ /**
485
+ * @typedef {Object} OPT_hlctlsett
486
+ * @property {boolean} [autoHideNewItems=false]
487
+ * @property {boolean} [markCurrentItem=false]
488
+ * @property {(string|string[])} [itemBaseClassID]
489
+ * @property {boolean} [showStubsIfEmpty=false]
490
+ * @property {boolean} [allowGroupSelection=false]
491
+ * @property {boolean} [allowSelectionLocks=false]
492
+ * @property {object} [stubs]
493
+ * @description An options set for `THtmlItemsListController`-class
494
+ */
495
+
474
496
  /**
475
497
  * @augments THtmlItemsListContainer
476
498
  * @classdesc This class enhanced a capabilities implemented
477
499
  * in the `THtmlItemsListContainer` class
478
500
  */
479
501
  class THtmlItemsListController extends THtmlItemsListContainer {
480
- /** @property {?HTMLElement} */
502
+ /** @type {?HTMLElement} */
481
503
  #_host;
482
- /** @property {THtmlStubItemsSet} */
504
+ /** @type {THtmlStubItemsSet} */
483
505
  #_stubs;
484
- /** @property {Set} */
506
+ /** @type {Set<HTMLElement>} */
485
507
  #_selects;
486
- /** @property {object} */
508
+ /** @property {OPT_hlctlsett} */
487
509
  #_options;// = null;
488
510
  /**
489
511
  * @typedef {Object} statILCtrl
@@ -499,19 +521,12 @@ class THtmlItemsListController extends THtmlItemsListContainer {
499
521
  */
500
522
  /** @property {statILCtrl} */
501
523
  #_status;
502
- /** @property {Map} */
524
+ /** @property {Map<string, Function>} */
503
525
  #_events;
504
526
 
505
527
  /**
506
528
  * @param {?HTMLElement} host
507
- * @param {object} [opt]
508
- * @param {boolean} [opt.autoHideNewItems=false]
509
- * @param {boolean} [opt.markCurrentItem=false]
510
- * @param {(string|string[])} [opt.itemBaseClassID]
511
- * @param {boolean} [opt.showStubsIfEmpty=false]
512
- * @param {boolean} [opt.allowGroupSelection=false]
513
- * @param {boolean} [opt.allowSelectionLocks=false]
514
- * @param {object} [opt.stubs]
529
+ * @param {OPT_hlctlsett} [opt]
515
530
  * @description Creates a new instance of the class.
516
531
  */
517
532
  constructor(host, opt) {
@@ -638,9 +653,9 @@ class THtmlItemsListController extends THtmlItemsListContainer {
638
653
  };
639
654
 
640
655
  /**
641
- * @property {HTMLElement[]}
656
+ * Returns a list of the selected elements
657
+ * @type {HTMLElement[]}
642
658
  * @readonly
643
- * @description Returns a list of the selected elements
644
659
  */
645
660
  get SelectedItems() {
646
661
  const _selects = this.#_selects;
@@ -653,18 +668,18 @@ class THtmlItemsListController extends THtmlItemsListContainer {
653
668
  }
654
669
 
655
670
  /**
656
- * @property {THtmlStubItemsSet}
671
+ * Returns a `THtmlStubItemsSet` instance
672
+ * @type {THtmlStubItemsSet}
657
673
  * @readonly
658
- * @description Returns a `THtmlStubItemsSet` instance
659
674
  */
660
675
  get StubItems() {
661
676
  return this.#_stubs;
662
677
  }
663
678
 
664
679
  /**
665
- * @property {boolean}
680
+ * Indicates whether a selection is locked
681
+ * @type {boolean}
666
682
  * @readonly
667
- * @description Indicates whether a selection is locked
668
683
  */
669
684
  get isSelectionLocked() {
670
685
  return this.#_status.isSelectionLocked;
@@ -1,4 +1,4 @@
1
- // [v0.1.052-20241119]
1
+ // [v0.1.053-20250416]
2
2
 
3
3
  // === module init block ===
4
4
 
@@ -48,9 +48,9 @@ const BTS_DEF_GROUP_NAME = 'all';
48
48
  * A set provide a buttons: <next>, <previous>, <first> and <last>.
49
49
  */
50
50
  class THtmlListButtonsController {
51
- /** @property {THtmlButtonsSet} */
51
+ /** @type {THtmlButtonsSet} */
52
52
  #_btnSet;
53
- /** @property {Map} */
53
+ /** @type {Map<string, Function>} */
54
54
  #_events;
55
55
 
56
56
  /**
@@ -1,4 +1,4 @@
1
- // [v0.1.045-20241119]
1
+ // [v0.1.046-20250416]
2
2
 
3
3
  // === module init block ===
4
4
 
@@ -26,15 +26,23 @@ const {
26
26
  * (* class definitions *)
27
27
  */
28
28
 
29
+ /**
30
+ * @typedef {Object} OPT_ldstubs
31
+ * @property {string} [defaultItem] - a default element name
32
+ * @property {boolean} [useClear=true] - to clear before load an elements
33
+ * @property {boolean} [force=false] - run in a force mode
34
+ * @description A settings to load stub-elements.
35
+ */
36
+
29
37
  /**
30
38
  * @classdesc This class implements an interface of a stub-items set
31
39
  */
32
40
  class THtmlStubItemsSet {
33
- /** @property {?HTMLElement} */
41
+ /** @type {?HTMLElement} */
34
42
  #_host;
35
- /** @property {Map} */
43
+ /** @type {Map<string, HTMLElement>} */
36
44
  #_items;
37
- /** @property {string} */
45
+ /** @type {string} */
38
46
  #_defItem;
39
47
  #_shownItem = null;
40
48
 
@@ -47,7 +55,7 @@ class THtmlStubItemsSet {
47
55
 
48
56
  /**
49
57
  * @param {HTMLElement} host
50
- * @param {(array|object|OBJ_stubEList)} opt
58
+ * @param {(array|object|OBJ_stubEList)} opt - options
51
59
  * @param {(array|object)} opt.items
52
60
  * @param {string} opt.defaultItem
53
61
  * @param {boolean} opt.force - <*deprecated (since: v0.0.23)*>
@@ -66,8 +74,8 @@ class THtmlStubItemsSet {
66
74
  }
67
75
 
68
76
  /**
69
- * @property {string}
70
- * @description Defines a default element name
77
+ * Defines a default element name
78
+ * @type {string}
71
79
  */
72
80
  get defItem() {
73
81
  return this.#_defItem;
@@ -78,9 +86,9 @@ class THtmlStubItemsSet {
78
86
  }
79
87
 
80
88
  /**
81
- * @property {number}
89
+ * Contains a Qty of an elements
90
+ * @type {number}
82
91
  * @readonly
83
- * @description Contains a Qty of an elements
84
92
  */
85
93
  get count() {
86
94
  return this.#_items.size;
@@ -228,19 +236,12 @@ class THtmlStubItemsSet {
228
236
  return this.hideItem(this.#_defItem);
229
237
  }
230
238
 
231
- /**
232
- * @typedef {Object} OPT_ldstubs
233
- * @property {string} [defaultItem] - a default element name
234
- * @property {boolean} [useClear=true] - to clear before load an elements
235
- * @property {boolean} [force=false] - run in a force mode
236
- * @description A settings to load stub-elements.
237
- */
238
-
239
239
  /**
240
240
  * @param {(Array|OBJ_stubEList)} list - an array of entries or special object
241
241
  * @param {(boolean|OPT_ldstubs)} [opt] - an options
242
242
  * @returns {number}
243
243
  * @description Adds an items to an instance members.
244
+ * @todo [since 0.0.25] deprecate use of `opt` as `boolean`
244
245
  */
245
246
  loadItems(list, opt) {
246
247
  let _options = opt;
@@ -1,4 +1,4 @@
1
- // [v0.1.037-20250220]
1
+ // [v0.1.039-20250329]
2
2
 
3
3
  // === module init block ===
4
4
 
@@ -93,11 +93,6 @@ function hideHTMLElement(obj) {
93
93
  return isSUCCEED;
94
94
  };
95
95
 
96
- /** @deprecated */
97
- function hideHtmlElement(obj) {
98
- return hideHTMLElement(obj);
99
- };
100
-
101
96
  /**
102
97
  * @since v0.0.23
103
98
  * @function showHTMLElement
@@ -111,11 +106,6 @@ function showHTMLElement(obj) {
111
106
  return isSUCCEED;
112
107
  };
113
108
 
114
- /** @deprecated */
115
- function showHtmlElement(obj) {
116
- return showHTMLElement(obj);
117
- };
118
-
119
109
  /**
120
110
  * @since v0.0.23
121
111
  * @function selectHTMLElement
@@ -129,11 +119,6 @@ function selectHTMLElement(obj) {
129
119
  return isSUCCEED;
130
120
  };
131
121
 
132
- /** @deprecated */
133
- function selectHtmlElement(obj) {
134
- return selectHTMLElement(obj);
135
- };
136
-
137
122
  /**
138
123
  * @since v0.0.23
139
124
  * @function unselectHTMLElement
@@ -147,11 +132,6 @@ function unselectHTMLElement(obj) {
147
132
  return isSUCCEED;
148
133
  };
149
134
 
150
- /** @deprecated */
151
- function unselectHtmlElement(obj) {
152
- return unselectHTMLElement(obj);
153
- };
154
-
155
135
  /**
156
136
  * @since v0.0.23
157
137
  * @function markHTMLElementAsCurrent
@@ -165,11 +145,6 @@ function markHTMLElementAsCurrent(obj) {
165
145
  return isSUCCEED;
166
146
  };
167
147
 
168
- /** @deprecated */
169
- function markHtmlElementAsCurrent(obj) {
170
- return markHTMLElementAsCurrent(obj);
171
- };
172
-
173
148
  /**
174
149
  * @since v0.0.23
175
150
  * @function unmarkCurrentHTMLElement
@@ -183,11 +158,6 @@ function unmarkCurrentHTMLElement(obj) {
183
158
  return isSUCCEED;
184
159
  };
185
160
 
186
- /** @deprecated */
187
- function unmarkCurrentHtmlElement(obj) {
188
- return unmarkCurrentHTMLElement(obj);
189
- };
190
-
191
161
  /**
192
162
  * @since v0.0.23
193
163
  * @function markHTMLElementAsActive
@@ -201,11 +171,6 @@ function markHTMLElementAsActive(obj) {
201
171
  return isSUCCEED;
202
172
  };
203
173
 
204
- /** @deprecated */
205
- function markHtmlElementAsActive(obj) {
206
- return markHTMLElementAsActive(obj);
207
- };
208
-
209
174
  /**
210
175
  * @since v0.0.23
211
176
  * @function unmarkActiveHTMLElement
@@ -219,11 +184,6 @@ function unmarkActiveHTMLElement(obj) {
219
184
  return isSUCCEED;
220
185
  };
221
186
 
222
- /** @deprecated */
223
- function unmarkActiveHtmlElement(obj) {
224
- return unmarkActiveHTMLElement(obj);
225
- };
226
-
227
187
  /**
228
188
  * @since v0.0.23
229
189
  * @function lockHTMLElement
@@ -250,11 +210,6 @@ function lockHTMLElement(obj) {
250
210
  return isSUCCEED;
251
211
  };
252
212
 
253
- /** @deprecated */
254
- function lockHtmlElement(obj) {
255
- return lockHTMLElement(obj);
256
- };
257
-
258
213
  /**
259
214
  * @since v0.0.23
260
215
  * @function unlockHTMLElement
@@ -279,11 +234,6 @@ function unlockHTMLElement(obj) {
279
234
  return isSUCCEED;
280
235
  };
281
236
 
282
- /** @deprecated */
283
- function unlockHtmlElement(obj) {
284
- return unlockHTMLElement(obj);
285
- };
286
-
287
237
  /**
288
238
  * @since v0.0.23
289
239
  * @function activateHTMLElements
@@ -297,11 +247,6 @@ function activateHTMLElements(...args) {
297
247
  };
298
248
  };
299
249
 
300
- /** @deprecated */
301
- function activateHtmlElements(...args) {
302
- activateHTMLElements(...args);
303
- };
304
-
305
250
  /**
306
251
  * @since v0.0.23
307
252
  * @function inactivateHTMLElements
@@ -315,11 +260,6 @@ function inactivateHTMLElements(...args) {
315
260
  };
316
261
  };
317
262
 
318
- /** @deprecated */
319
- function inactivateHtmlElements(...args) {
320
- inactivateHTMLElements(...args);
321
- };
322
-
323
263
  /**
324
264
  * @since v0.0.21
325
265
  * @function readAsTagName
@@ -456,13 +396,14 @@ function valueToElementID(value) {
456
396
  */
457
397
 
458
398
  /**
459
- * @function createNewHtmlElement
399
+ * @since 0.0.25
400
+ * @function createNewHTMLElement
460
401
  * @param {string} tagName - an element tag name
461
402
  * @param {elemDesc} [opt] - an element description object
462
403
  * @return {?HTMLElement}
463
404
  * @description Creates a new HTML-element.
464
405
  */
465
- function createNewHtmlElement(tagName, opt) {
406
+ function createNewHTMLElement(tagName, opt) {
466
407
  let item = null;
467
408
  let _tag = readAsTagName(tagName);
468
409
  if (_tag === '') return null;
@@ -534,6 +475,11 @@ function createNewHtmlElement(tagName, opt) {
534
475
  return item;
535
476
  };
536
477
 
478
+ /** @deprecated */
479
+ function createNewHtmlElement(...args) {
480
+ return createNewHTMLElement(...args);
481
+ };
482
+
537
483
  /***
538
484
  * (* class definitions *)
539
485
  */
@@ -570,7 +516,7 @@ module.exports.inactivateHTMLElements = inactivateHTMLElements;
570
516
  module.exports.valueToClassList = valueToClassList;
571
517
 
572
518
  // experimental
573
- module.exports.createNewHtmlElement = createNewHtmlElement;
519
+ module.exports.createNewHTMLElement = createNewHTMLElement;
574
520
  module.exports.readAsAttrValue = readAsAttrValue;
575
521
  module.exports.readAsTagName = readAsTagName;
576
522
  module.exports.readAsAttrName = readAsAttrName;
@@ -580,15 +526,4 @@ module.exports.valueToElementID = valueToElementID;
580
526
  module.exports.valueToIDString = valueToIDString;
581
527
 
582
528
  // @deprecated
583
- module.exports.showHtmlElement = showHtmlElement;
584
- module.exports.hideHtmlElement = hideHtmlElement;
585
- module.exports.selectHtmlElement = selectHtmlElement;
586
- module.exports.unselectHtmlElement = unselectHtmlElement;
587
- module.exports.markHtmlElementAsCurrent = markHtmlElementAsCurrent;
588
- module.exports.unmarkCurrentHtmlElement = unmarkCurrentHtmlElement;
589
- module.exports.markHtmlElementAsActive = markHtmlElementAsActive;
590
- module.exports.unmarkActiveHtmlElement = unmarkActiveHtmlElement;
591
- module.exports.lockHtmlElement = lockHtmlElement;
592
- module.exports.unlockHtmlElement = unlockHtmlElement;
593
- module.exports.activateHtmlElements = activateHtmlElements;
594
- module.exports.inactivateHtmlElements = inactivateHtmlElements;
529
+ module.exports.createNewHtmlElement = createNewHtmlElement;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cntwg/html-helper",
3
- "version": "0.0.24",
3
+ "version": "0.0.25",
4
4
  "description": "A base HTML-helper library for js",
5
5
  "author": "ygracs <cs70th-om@rambler.ru>",
6
6
  "license": "MIT",
@@ -52,7 +52,8 @@
52
52
  "#test-dir/*": "./__test__/*"
53
53
  },
54
54
  "dependencies": {
55
- "@ygracs/bsfoc-lib-js": "^0.2.2"
55
+ "@ygracs/bsfoc-lib-js": "^0.2.3",
56
+ "@ygracs/lists-lib-js": "^0.0.4"
56
57
  },
57
58
  "devDependencies": {
58
59
  "jest": "^29.7.0",