aprog 2.2.2 → 2.2.3

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/index.js CHANGED
@@ -15,10 +15,11 @@ export { cookie, storage, session, cacheKey, downloadFile } from './src/storage.
15
15
  export { paginate, parseData, __paginate, __counter } from './src/paginate.js';
16
16
  export { saveItem, loadItem, setSecretKey } from './src/secretStorage.js';
17
17
  export {
18
- pushHTMLElementPrototype, pushAfterHTMLElementPrototype,
19
- pushBeforeHTMLElementPrototype, dataHTMLElementPrototype,
20
- toKebabCaseStringPrototype, toSnakeCaseStringPrototype,
21
- repeatHTMLElementPrototype
18
+ pushHTMLElementPrototype, prepushHTMLElementPrototype,
19
+ pushAfterHTMLElementPrototype, pushBeforeHTMLElementPrototype,
20
+ dataHTMLElementPrototype, toKebabCaseStringPrototype,
21
+ toSnakeCaseStringPrototype, repeatHTMLElementPrototype,
22
+ replaceChildrenHTMLElementPrototype
22
23
  } from './src/html.js';
23
24
  export { prism } from "./src/prism.js";
24
25
  export { uniquePage } from "./src/pages.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aprog",
3
- "version": "2.2.2",
3
+ "version": "2.2.3",
4
4
  "description": "Допоміжна JavaScript-бібліотека для проєктів",
5
5
  "main": "index.js",
6
6
  "exports": {
@@ -25,6 +25,7 @@ export const ButtonConstructor = {
25
25
  type = undefined,
26
26
  text = "",
27
27
  callback = () => {},
28
+ ...props
28
29
  } = {}) {
29
30
  return this.is = button({
30
31
  id: id || GUID(),
@@ -32,7 +33,8 @@ export const ButtonConstructor = {
32
33
  style: style,
33
34
  ...(type && {type: type}),
34
35
  value: text,
35
- onClick: callback
36
+ onClick: callback,
37
+ ...props
36
38
  });
37
39
  },
38
40
 
@@ -28,17 +28,21 @@ export const InputConstructor = {
28
28
  value = undefined,
29
29
  nameCallback = "onInput",
30
30
  callback = () => {},
31
+ ...props
31
32
  } = {}) {
32
- return this.is = input({
33
+ this.is = input({
33
34
  id: id || GUID(),
34
35
  class: `${this.class} input ${className}`.trim(),
35
36
  style: style,
36
37
  ...(type && {type: type}),
37
- focus: focus,
38
38
  ...(placeholder && {placeholder: placeholder}),
39
39
  ...(value && {value: value}),
40
40
  [nameCallback]: callback,
41
+ ...props
41
42
  });
43
+
44
+ if (focus) queueMicrotask(() => this.is.focus());
45
+ return this.is;
42
46
  },
43
47
 
44
48
  /**
@@ -25,6 +25,7 @@ export const SelectConstructor = {
25
25
  option = undefined,
26
26
  options = undefined,
27
27
  callback = () => {},
28
+ ...props
28
29
  } = {}) {
29
30
  return this.is = select({
30
31
  id: id || GUID(),
@@ -33,6 +34,7 @@ export const SelectConstructor = {
33
34
  ...(option && {option: option}),
34
35
  ...(options && {options: options}),
35
36
  onChange: callback,
37
+ ...props
36
38
  });
37
39
  },
38
40
 
package/src/html.js CHANGED
@@ -7,6 +7,15 @@ export function pushHTMLElementPrototype() {
7
7
  }
8
8
  }
9
9
 
10
+ export function prepushHTMLElementPrototype() {
11
+ if (!HTMLElement.prototype.prepush) {
12
+ HTMLElement.prototype.prepush = function(element) {
13
+ this.innerHTML = null;
14
+ this.prepend(element);
15
+ };
16
+ }
17
+ }
18
+
10
19
  export function pushAfterHTMLElementPrototype() {
11
20
  if (!HTMLElement.prototype.pushAfter) {
12
21
  HTMLElement.prototype.pushAfter = function (element, existingChild) {