ziko 1.6.0 → 1.6.1

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ziko",
3
- "version": "1.6.0",
3
+ "version": "1.6.1",
4
4
  "description": "A versatile JavaScript library offering a rich set of Hyperscript Based UI components, advanced mathematical utilities, interactivity ,animations, client side routing and more ...",
5
5
  "keywords": [
6
6
  "front-end",
@@ -0,0 +1,41 @@
1
+ /**
2
+ * Represents a parsed XML node.
3
+ */
4
+ export interface XMLNode {
5
+ /**
6
+ * The XML tag name of the node.
7
+ */
8
+ type: string;
9
+
10
+ /**
11
+ * The attributes of the XML node.
12
+ */
13
+ attributes: Record<string, string>;
14
+
15
+ /**
16
+ * The child elements of the XML node.
17
+ */
18
+ children: XMLNode[];
19
+
20
+ /**
21
+ * The text content of the node, if available.
22
+ */
23
+ text?: string;
24
+ }
25
+
26
+ /**
27
+ * Parses an XML string into a tree-like JavaScript object representation.
28
+ *
29
+ * @param xmlString - The XML document as a string.
30
+ * @returns The parsed XML node tree.
31
+ *
32
+ * @example
33
+ * ```ts
34
+ * const xml = `<root><item id="1">Hello</item></root>`;
35
+ * const tree = parseXML(xml);
36
+ *
37
+ * console.log(tree.type); // "root"
38
+ * console.log(tree.children[0].attributes.id); // "1"
39
+ * ```
40
+ */
41
+ export declare function parseXML(xmlString: string): XMLNode;
@@ -1 +1,28 @@
1
- export * from "./xml"
1
+ export function parseXML(xmlString) {
2
+ const parser = new DOMParser();
3
+ const xmlDoc = parser.parseFromString(xmlString, 'text/xml');
4
+ const rootNode = xmlDoc.documentElement;
5
+ const result = parseNode(rootNode);
6
+ return result;
7
+ }
8
+
9
+ function parseNode(node) {
10
+ const obj = {
11
+ type: node.nodeName,
12
+ attributes: {},
13
+ children: []
14
+ };
15
+ for (let i = 0; i < node.attributes.length; i++) {
16
+ const attr = node.attributes[i];
17
+ obj.attributes[attr.name] = attr.value;
18
+ }
19
+ for (let i = 0; i < node.childNodes.length; i++) {
20
+ const child = node.childNodes[i];
21
+ if (child.nodeType === Node.ELEMENT_NODE) {
22
+ obj.children.push(parseNode(child));
23
+ } else if (child.nodeType === Node.TEXT_NODE) {
24
+ obj.text = child.textContent.trim();
25
+ }
26
+ }
27
+ return obj;
28
+ }
@@ -0,0 +1,62 @@
1
+ /**
2
+ * Checks if a string follows camelCase notation.
3
+ *
4
+ * @param text - The string to check.
5
+ * @returns `true` if the string is camelCase, otherwise `false`.
6
+ */
7
+ export declare const is_camelcase: (text?: string) => boolean;
8
+
9
+ /**
10
+ * Checks if a string follows kebab-case (hyphen-case) notation.
11
+ *
12
+ * @param text - The string to check.
13
+ * @returns `true` if the string contains a hyphen separator, otherwise `false`.
14
+ */
15
+ export declare const is_hyphencase: (text?: string) => boolean;
16
+
17
+ /**
18
+ * Checks if a string follows snake_case notation.
19
+ *
20
+ * @param text - The string to check.
21
+ * @returns `true` if the string contains an underscore separator, otherwise `false`.
22
+ */
23
+ export declare const is_snakeCase: (text?: string) => boolean;
24
+
25
+ /**
26
+ * Checks if a string follows PascalCase notation.
27
+ *
28
+ * @param text - The string to check.
29
+ * @returns `true` if the string is PascalCase, otherwise `false`.
30
+ */
31
+ export declare const is_pascalcase: (text?: string) => boolean;
32
+
33
+ /**
34
+ * Checks whether a string is a palindrome.
35
+ *
36
+ * A palindrome is a string that reads the same forward and backward.
37
+ *
38
+ * @param text - The string to check.
39
+ * @returns `true` if the string is a palindrome, otherwise `false`.
40
+ */
41
+ export declare const is_palindrome: (text: string) => boolean;
42
+
43
+ /**
44
+ * Checks whether two words are anagrams.
45
+ *
46
+ * Two words are anagrams if they contain the same characters with the same frequency.
47
+ *
48
+ * @param word - The first word.
49
+ * @param words - The second word to compare with.
50
+ * @returns `true` if both words are anagrams, otherwise `false`.
51
+ */
52
+ export declare const is_anagram: (word: string, words: string) => boolean;
53
+
54
+ /**
55
+ * Checks whether a string is an isogram.
56
+ *
57
+ * An isogram is a word with no repeating characters.
58
+ *
59
+ * @param text - The string to check.
60
+ * @returns `true` if the string has no repeated characters, otherwise `false`.
61
+ */
62
+ export declare const is_isogram: (text?: string) => boolean;
@@ -0,0 +1,159 @@
1
+ /**
2
+ * Converts a camelCase string to hyphen-case.
3
+ *
4
+ * @param text - The camelCase string.
5
+ * @returns The converted hyphen-case string.
6
+ */
7
+ export declare const camel2hyphencase: (text?: string) => string;
8
+
9
+ /**
10
+ * Converts a camelCase string to snake_case.
11
+ *
12
+ * @param text - The camelCase string.
13
+ * @returns The converted snake_case string.
14
+ */
15
+ export declare const camel2snakecase: (text?: string) => string;
16
+
17
+ /**
18
+ * Converts a camelCase string to PascalCase.
19
+ *
20
+ * @param text - The camelCase string.
21
+ * @returns The converted PascalCase string.
22
+ */
23
+ export declare const camel2pascalcase: (text?: string) => string;
24
+
25
+ /**
26
+ * Converts a camelCase string to CONSTANT_CASE.
27
+ *
28
+ * @param text - The camelCase string.
29
+ * @returns The converted CONSTANT_CASE string.
30
+ */
31
+ export declare const camel2constantcase: (text?: string) => string;
32
+
33
+ /**
34
+ * Converts a PascalCase string to snake_case.
35
+ *
36
+ * @param text - The PascalCase string.
37
+ * @returns The converted snake_case string.
38
+ */
39
+ export declare const pascal2snakecase: (text?: string) => string;
40
+
41
+ /**
42
+ * Converts a PascalCase string to hyphen-case.
43
+ *
44
+ * @param text - The PascalCase string.
45
+ * @returns The converted hyphen-case string.
46
+ */
47
+ export declare const pascal2hyphencase: (text?: string) => string;
48
+
49
+ /**
50
+ * Converts a PascalCase string to camelCase.
51
+ *
52
+ * @param text - The PascalCase string.
53
+ * @returns The converted camelCase string.
54
+ */
55
+ export declare const pascal2camelcase: (text?: string) => string;
56
+
57
+ /**
58
+ * Converts a PascalCase string to CONSTANT_CASE.
59
+ *
60
+ * @param text - The PascalCase string.
61
+ * @returns The converted CONSTANT_CASE string.
62
+ */
63
+ export declare const pascal2constantcase: (text?: string) => string;
64
+
65
+ /**
66
+ * Converts a snake_case string to camelCase.
67
+ *
68
+ * @param text - The snake_case string.
69
+ * @returns The converted camelCase string.
70
+ */
71
+ export declare const snake2camelcase: (text?: string) => string;
72
+
73
+ /**
74
+ * Converts a snake_case string to hyphen-case.
75
+ *
76
+ * @param text - The snake_case string.
77
+ * @returns The converted hyphen-case string.
78
+ */
79
+ export declare const snake2hyphencase: (text?: string) => string;
80
+
81
+ /**
82
+ * Converts a snake_case string to PascalCase.
83
+ *
84
+ * @param text - The snake_case string.
85
+ * @returns The converted PascalCase string.
86
+ */
87
+ export declare const snake2pascalcase: (text?: string) => string;
88
+
89
+ /**
90
+ * Converts a snake_case string to CONSTANT_CASE.
91
+ *
92
+ * @param text - The snake_case string.
93
+ * @returns The converted CONSTANT_CASE string.
94
+ */
95
+ export declare const snake2constantcase: (text?: string) => string;
96
+
97
+ /**
98
+ * Converts a hyphen-case string to camelCase.
99
+ *
100
+ * @param text - The hyphen-case string.
101
+ * @returns The converted camelCase string.
102
+ */
103
+ export declare const hyphen2camelcase: (text?: string) => string;
104
+
105
+ /**
106
+ * Converts a hyphen-case string to snake_case.
107
+ *
108
+ * @param text - The hyphen-case string.
109
+ * @returns The converted snake_case string.
110
+ */
111
+ export declare const hyphen2snakecase: (text?: string) => string;
112
+
113
+ /**
114
+ * Converts a hyphen-case string to PascalCase.
115
+ *
116
+ * @param text - The hyphen-case string.
117
+ * @returns The converted PascalCase string.
118
+ */
119
+ export declare const hyphen2pascalcase: (text?: string) => string;
120
+
121
+ /**
122
+ * Converts a hyphen-case string to CONSTANT_CASE.
123
+ *
124
+ * @param text - The hyphen-case string.
125
+ * @returns The converted CONSTANT_CASE string.
126
+ */
127
+ export declare const hyphen2constantcase: (text?: string) => string;
128
+
129
+ /**
130
+ * Converts a CONSTANT_CASE string to camelCase.
131
+ *
132
+ * @param text - The CONSTANT_CASE string.
133
+ * @returns The converted camelCase string.
134
+ */
135
+ export declare const constant2camelcase: (text?: string) => string;
136
+
137
+ /**
138
+ * Converts a CONSTANT_CASE string to snake_case.
139
+ *
140
+ * @param text - The CONSTANT_CASE string.
141
+ * @returns The converted snake_case string.
142
+ */
143
+ export declare const constant2snakecase: (text?: string) => string;
144
+
145
+ /**
146
+ * Converts a CONSTANT_CASE string to PascalCase.
147
+ *
148
+ * @param text - The CONSTANT_CASE string.
149
+ * @returns The converted PascalCase string.
150
+ */
151
+ export declare const constant2pascalcase: (text?: string) => string;
152
+
153
+ /**
154
+ * Converts a CONSTANT_CASE string to hyphen-case.
155
+ *
156
+ * @param text - The CONSTANT_CASE string.
157
+ * @returns The converted hyphen-case string.
158
+ */
159
+ export declare const constant2hyphencase: (text?: string) => string;
@@ -0,0 +1,2 @@
1
+ export * from './checkers/index.d.ts'
2
+ export * from './converters/index.d.ts'
@@ -1,2 +1,2 @@
1
- export * from './converters.js';
2
- export * from './checkers.js'
1
+ export * from './converters/index.js';
2
+ export * from './checkers/index.js'
@@ -0,0 +1,2 @@
1
+ export * from './fragment/index.d.ts'
2
+ export * from './swap/index.d.ts'
@@ -12,7 +12,9 @@ export class UISwap extends UIElement {
12
12
  };
13
13
 
14
14
  this.append(...items);
15
- this.render();
15
+ requestAnimationFrame(() => {
16
+ this.render();
17
+ });
16
18
  }
17
19
  get activeItem(){
18
20
  return this.items[this.states.activeIndex]
@@ -20,7 +22,7 @@ export class UISwap extends UIElement {
20
22
  render() {
21
23
  this.items.forEach((n, i) => {
22
24
 
23
- const initialDisplay = n.element?.style?.display || '';
25
+ const initialDisplay = getComputedStyle(n.element).display;
24
26
  this.#DISPLAYS_MAP.set(n, initialDisplay);
25
27
 
26
28
  if (i !== this.states.activeIndex) {
@@ -28,6 +30,9 @@ export class UISwap extends UIElement {
28
30
  }
29
31
  });
30
32
  }
33
+ get DS(){
34
+ return this.#DISPLAYS_MAP
35
+ }
31
36
  next(n = 1) {
32
37
  return this.activate(this.states.activeIndex + n);
33
38
  }
@@ -1,47 +0,0 @@
1
- function parseXML(xmlString) {
2
- const parser = new DOMParser();
3
- const xmlDoc = parser.parseFromString(xmlString, 'text/xml');
4
- const rootNode = xmlDoc.documentElement;
5
- const result = parseNode(rootNode);
6
- return result;
7
- }
8
-
9
- function parseNode(node) {
10
- const obj = {
11
- type: node.nodeName,
12
- attributes: {},
13
- children: []
14
- };
15
- for (let i = 0; i < node.attributes.length; i++) {
16
- const attr = node.attributes[i];
17
- obj.attributes[attr.name] = attr.value;
18
- }
19
- for (let i = 0; i < node.childNodes.length; i++) {
20
- const child = node.childNodes[i];
21
- if (child.nodeType === Node.ELEMENT_NODE) {
22
- obj.children.push(parseNode(child));
23
- } else if (child.nodeType === Node.TEXT_NODE) {
24
- obj.text = child.textContent.trim();
25
- }
26
- }
27
- return obj;
28
- }
29
- export default parseXML;
30
-
31
- // function htmlParser(element) {
32
- // const obj = {
33
- // type: element.tagName,
34
- // attributes: {},
35
- // children: [],
36
- // };
37
- // for (let i = 0; i < element.attributes.length; i++) {
38
- // const attr = element.attributes[i];
39
- // obj.attributes[attr.name] = attr.value;
40
- // }
41
- // for (let i = 0; i < element.children.length; i++) {
42
- // const child = element.children[i];
43
- // obj.children.push(htmlParser(child));
44
- // }
45
- // return obj;
46
- // }
47
-