@htmlplus/element 2.12.0 → 2.13.0
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/README.md +2 -2
- package/bundlers.d.ts +20 -0
- package/{bundlers/vite.js → bundlers.js} +39 -3
- package/client-5FqNUiuz.d.ts +309 -0
- package/client-Dse96R-O.js +1805 -0
- package/client.d.ts +1 -0
- package/client.js +3 -0
- package/constants.d.ts +48 -0
- package/constants.js +60 -0
- package/internal.d.ts +1 -0
- package/internal.js +3 -0
- package/package.json +8 -4
- package/transformer.d.ts +139 -0
- package/transformer.js +1277 -0
- package/bundlers/rollup.d.ts +0 -7
- package/bundlers/rollup.js +0 -23
- package/bundlers/vite.d.ts +0 -8
- package/client/decorators/bind.d.ts +0 -8
- package/client/decorators/bind.js +0 -21
- package/client/decorators/context.d.ts +0 -3
- package/client/decorators/context.js +0 -121
- package/client/decorators/direction.d.ts +0 -5
- package/client/decorators/direction.js +0 -8
- package/client/decorators/element.d.ts +0 -7
- package/client/decorators/element.js +0 -65
- package/client/decorators/event.d.ts +0 -35
- package/client/decorators/event.js +0 -53
- package/client/decorators/host.d.ts +0 -4
- package/client/decorators/host.js +0 -7
- package/client/decorators/index.d.ts +0 -15
- package/client/decorators/index.js +0 -15
- package/client/decorators/isRTL.d.ts +0 -4
- package/client/decorators/isRTL.js +0 -7
- package/client/decorators/listen.d.ts +0 -52
- package/client/decorators/listen.js +0 -37
- package/client/decorators/method.d.ts +0 -6
- package/client/decorators/method.js +0 -15
- package/client/decorators/property.d.ts +0 -25
- package/client/decorators/property.js +0 -94
- package/client/decorators/query.d.ts +0 -9
- package/client/decorators/query.js +0 -12
- package/client/decorators/queryAll.d.ts +0 -12
- package/client/decorators/queryAll.js +0 -15
- package/client/decorators/slots.d.ts +0 -4
- package/client/decorators/slots.js +0 -7
- package/client/decorators/state.d.ts +0 -6
- package/client/decorators/state.js +0 -23
- package/client/decorators/watch.d.ts +0 -11
- package/client/decorators/watch.js +0 -31
- package/client/index.d.ts +0 -2
- package/client/index.js +0 -2
- package/client/utils/appendToMethod.d.ts +0 -1
- package/client/utils/appendToMethod.js +0 -15
- package/client/utils/attributes.d.ts +0 -2
- package/client/utils/attributes.js +0 -33
- package/client/utils/call.d.ts +0 -1
- package/client/utils/call.js +0 -3
- package/client/utils/classes.d.ts +0 -4
- package/client/utils/classes.js +0 -45
- package/client/utils/config.d.ts +0 -39
- package/client/utils/config.js +0 -28
- package/client/utils/defineProperty.d.ts +0 -1
- package/client/utils/defineProperty.js +0 -1
- package/client/utils/direction.d.ts +0 -6
- package/client/utils/direction.js +0 -8
- package/client/utils/event.d.ts +0 -13
- package/client/utils/event.js +0 -48
- package/client/utils/getFramework.d.ts +0 -2
- package/client/utils/getFramework.js +0 -20
- package/client/utils/getStyles.d.ts +0 -2
- package/client/utils/getStyles.js +0 -4
- package/client/utils/getTag.d.ts +0 -2
- package/client/utils/getTag.js +0 -4
- package/client/utils/host.d.ts +0 -5
- package/client/utils/host.js +0 -12
- package/client/utils/index.d.ts +0 -32
- package/client/utils/index.js +0 -32
- package/client/utils/isCSSColor.d.ts +0 -5
- package/client/utils/isCSSColor.js +0 -9
- package/client/utils/isEvent.d.ts +0 -1
- package/client/utils/isEvent.js +0 -3
- package/client/utils/isRTL.d.ts +0 -5
- package/client/utils/isRTL.js +0 -5
- package/client/utils/isServer.d.ts +0 -4
- package/client/utils/isServer.js +0 -6
- package/client/utils/merge.d.ts +0 -1
- package/client/utils/merge.js +0 -22
- package/client/utils/query.d.ts +0 -5
- package/client/utils/query.js +0 -7
- package/client/utils/queryAll.d.ts +0 -5
- package/client/utils/queryAll.js +0 -7
- package/client/utils/request.d.ts +0 -9
- package/client/utils/request.js +0 -106
- package/client/utils/shadowRoot.d.ts +0 -2
- package/client/utils/shadowRoot.js +0 -4
- package/client/utils/slots.d.ts +0 -9
- package/client/utils/slots.js +0 -18
- package/client/utils/styles.d.ts +0 -4
- package/client/utils/styles.js +0 -10
- package/client/utils/task.d.ts +0 -6
- package/client/utils/task.js +0 -34
- package/client/utils/toBoolean.d.ts +0 -1
- package/client/utils/toBoolean.js +0 -3
- package/client/utils/toDecorator.d.ts +0 -2
- package/client/utils/toDecorator.js +0 -10
- package/client/utils/toEvent.d.ts +0 -1
- package/client/utils/toEvent.js +0 -3
- package/client/utils/toProperty.d.ts +0 -1
- package/client/utils/toProperty.js +0 -55
- package/client/utils/toUnit.d.ts +0 -4
- package/client/utils/toUnit.js +0 -10
- package/client/utils/typeOf.d.ts +0 -3
- package/client/utils/typeOf.js +0 -6
- package/client/utils/uhtml.d.ts +0 -22
- package/client/utils/uhtml.js +0 -703
- package/client/utils/updateAttribute.d.ts +0 -2
- package/client/utils/updateAttribute.js +0 -10
- package/constants/index.d.ts +0 -48
- package/constants/index.js +0 -60
- package/transformer/index.d.ts +0 -3
- package/transformer/index.js +0 -3
- package/transformer/plugins/assets.d.ts +0 -7
- package/transformer/plugins/assets.js +0 -26
- package/transformer/plugins/copy.d.ts +0 -9
- package/transformer/plugins/copy.js +0 -29
- package/transformer/plugins/customElement.d.ts +0 -7
- package/transformer/plugins/customElement.js +0 -392
- package/transformer/plugins/document.d.ts +0 -7
- package/transformer/plugins/document.js +0 -206
- package/transformer/plugins/extract.d.ts +0 -2
- package/transformer/plugins/extract.js +0 -22
- package/transformer/plugins/index.d.ts +0 -12
- package/transformer/plugins/index.js +0 -12
- package/transformer/plugins/parse.d.ts +0 -6
- package/transformer/plugins/parse.js +0 -13
- package/transformer/plugins/read.d.ts +0 -7
- package/transformer/plugins/read.js +0 -19
- package/transformer/plugins/readme.d.ts +0 -6
- package/transformer/plugins/readme.js +0 -24
- package/transformer/plugins/style.d.ts +0 -6
- package/transformer/plugins/style.js +0 -42
- package/transformer/plugins/validate.d.ts +0 -2
- package/transformer/plugins/validate.js +0 -40
- package/transformer/plugins/visualStudioCode.d.ts +0 -8
- package/transformer/plugins/visualStudioCode.js +0 -73
- package/transformer/plugins/webTypes.d.ts +0 -10
- package/transformer/plugins/webTypes.js +0 -74
- package/transformer/transformer.d.ts +0 -8
- package/transformer/transformer.js +0 -78
- package/transformer/transformer.types.d.ts +0 -52
- package/transformer/transformer.types.js +0 -1
- package/transformer/utils/addDependency.d.ts +0 -7
- package/transformer/utils/addDependency.js +0 -64
- package/transformer/utils/extractAttribute.d.ts +0 -2
- package/transformer/utils/extractAttribute.js +0 -10
- package/transformer/utils/extractFromComment.d.ts +0 -4
- package/transformer/utils/extractFromComment.js +0 -51
- package/transformer/utils/getInitializer.d.ts +0 -2
- package/transformer/utils/getInitializer.js +0 -3
- package/transformer/utils/getType.d.ts +0 -2
- package/transformer/utils/getType.js +0 -89
- package/transformer/utils/getTypeReference.d.ts +0 -2
- package/transformer/utils/getTypeReference.js +0 -33
- package/transformer/utils/hasDecorator.d.ts +0 -1
- package/transformer/utils/hasDecorator.js +0 -5
- package/transformer/utils/index.d.ts +0 -10
- package/transformer/utils/index.js +0 -10
- package/transformer/utils/print.d.ts +0 -2
- package/transformer/utils/print.js +0 -5
- package/transformer/utils/printType.d.ts +0 -1
- package/transformer/utils/printType.js +0 -69
- package/transformer/utils/visitor.d.ts +0 -2
- package/transformer/utils/visitor.js +0 -5
- package/types/index.d.ts +0 -2
- package/types/index.js +0 -1
package/client/utils/index.js
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
export * from './appendToMethod.js';
|
|
2
|
-
export * from './attributes.js';
|
|
3
|
-
export * from './call.js';
|
|
4
|
-
export * from './classes.js';
|
|
5
|
-
export * from './config.js';
|
|
6
|
-
export * from './defineProperty.js';
|
|
7
|
-
export * from './direction.js';
|
|
8
|
-
export * from './event.js';
|
|
9
|
-
export * from './getFramework.js';
|
|
10
|
-
export * from './getStyles.js';
|
|
11
|
-
export * from './getTag.js';
|
|
12
|
-
export * from './host.js';
|
|
13
|
-
export * from './isCSSColor.js';
|
|
14
|
-
export * from './isEvent.js';
|
|
15
|
-
export * from './isRTL.js';
|
|
16
|
-
export * from './isServer.js';
|
|
17
|
-
export * from './merge.js';
|
|
18
|
-
export * from './query.js';
|
|
19
|
-
export * from './queryAll.js';
|
|
20
|
-
export * from './request.js';
|
|
21
|
-
export * from './shadowRoot.js';
|
|
22
|
-
export * from './slots.js';
|
|
23
|
-
export * from './styles.js';
|
|
24
|
-
export * from './task.js';
|
|
25
|
-
export * from './toBoolean.js';
|
|
26
|
-
export * from './toDecorator.js';
|
|
27
|
-
export * from './toEvent.js';
|
|
28
|
-
export * from './toProperty.js';
|
|
29
|
-
export * from './toUnit.js';
|
|
30
|
-
export * from './typeOf.js';
|
|
31
|
-
export * from './uhtml.js';
|
|
32
|
-
export * from './updateAttribute.js';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const isEvent: (input: string) => boolean;
|
package/client/utils/isEvent.js
DELETED
package/client/utils/isRTL.d.ts
DELETED
package/client/utils/isRTL.js
DELETED
package/client/utils/isServer.js
DELETED
package/client/utils/merge.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const merge: (target: any, ...sources: any[]) => any;
|
package/client/utils/merge.js
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { typeOf } from './typeOf.js';
|
|
2
|
-
export const merge = (target, ...sources) => {
|
|
3
|
-
for (const source of sources) {
|
|
4
|
-
if (!source)
|
|
5
|
-
continue;
|
|
6
|
-
if (typeOf(source) != 'object') {
|
|
7
|
-
target = source;
|
|
8
|
-
continue;
|
|
9
|
-
}
|
|
10
|
-
for (const key of Object.keys(source)) {
|
|
11
|
-
if (target[key] instanceof Object &&
|
|
12
|
-
source[key] instanceof Object &&
|
|
13
|
-
target[key] !== source[key]) {
|
|
14
|
-
target[key] = merge(target[key], source[key]);
|
|
15
|
-
}
|
|
16
|
-
else {
|
|
17
|
-
target[key] = source[key];
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
return target;
|
|
22
|
-
};
|
package/client/utils/query.d.ts
DELETED
package/client/utils/query.js
DELETED
package/client/utils/queryAll.js
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { HTMLPlusElement } from '../../types/index.js';
|
|
2
|
-
/**
|
|
3
|
-
* Updates the DOM with a scheduled task.
|
|
4
|
-
* @param target The element instance.
|
|
5
|
-
* @param name Property/State name.
|
|
6
|
-
* @param previous The previous value of Property/State.
|
|
7
|
-
* @param callback Invoked when the rendering phase is completed.
|
|
8
|
-
*/
|
|
9
|
-
export declare const request: (target: HTMLPlusElement, name?: string, previous?: any, callback?: (skipped: boolean) => void) => void;
|
package/client/utils/request.js
DELETED
|
@@ -1,106 +0,0 @@
|
|
|
1
|
-
import * as CONSTANTS from '../../constants/index.js';
|
|
2
|
-
import { call } from './call.js';
|
|
3
|
-
import { getStyles } from './getStyles.js';
|
|
4
|
-
import { shadowRoot } from './shadowRoot.js';
|
|
5
|
-
import { task } from './task.js';
|
|
6
|
-
import { render } from './uhtml.js';
|
|
7
|
-
/**
|
|
8
|
-
* Updates the DOM with a scheduled task.
|
|
9
|
-
* @param target The element instance.
|
|
10
|
-
* @param name Property/State name.
|
|
11
|
-
* @param previous The previous value of Property/State.
|
|
12
|
-
* @param callback Invoked when the rendering phase is completed.
|
|
13
|
-
*/
|
|
14
|
-
export const request = (target, name, previous, callback) => {
|
|
15
|
-
// Creates/Gets a stacks.
|
|
16
|
-
const stacks = (target[CONSTANTS.API_STACKS] ||= new Map());
|
|
17
|
-
// Creates/Updates a stack.
|
|
18
|
-
const stack = stacks.get(name) || { callbacks: [], previous };
|
|
19
|
-
// Adds the callback to the stack, if exists.
|
|
20
|
-
callback && stack.callbacks.push(callback);
|
|
21
|
-
// Stores the stack.
|
|
22
|
-
stacks.set(name, stack);
|
|
23
|
-
// Defines a handler.
|
|
24
|
-
const handler = () => {
|
|
25
|
-
// Skips the rendering phase if DOM isn't ready.
|
|
26
|
-
if (!target[CONSTANTS.API_CONNECTED])
|
|
27
|
-
return;
|
|
28
|
-
// Calculates the states to pass into lifecycles' callbacks.
|
|
29
|
-
const states = new Map(Array.from(stacks)
|
|
30
|
-
.filter((stack) => stack[0])
|
|
31
|
-
.map((stack) => [stack[0], stack[1].previous]));
|
|
32
|
-
// Calls the lifecycle's callback before the rendering phase.
|
|
33
|
-
call(target, CONSTANTS.LIFECYCLE_UPDATE, states);
|
|
34
|
-
// Renders template to the DOM.
|
|
35
|
-
render(shadowRoot(target), () => call(target, CONSTANTS.METHOD_RENDER));
|
|
36
|
-
// Invokes requests' callback.
|
|
37
|
-
stacks.forEach((state) => {
|
|
38
|
-
state.callbacks.forEach((callback, index, callbacks) => {
|
|
39
|
-
callback(callbacks.length - 1 != index);
|
|
40
|
-
});
|
|
41
|
-
});
|
|
42
|
-
// TODO
|
|
43
|
-
(() => {
|
|
44
|
-
const raw = getStyles(target);
|
|
45
|
-
if (!raw)
|
|
46
|
-
return;
|
|
47
|
-
const regex1 = /this-([\w-]+)(?:-([\w-]+))?/g;
|
|
48
|
-
const regex2 = /(\s*\w+\s*:\s*(undefined|null)\s*;?)/g;
|
|
49
|
-
const hasGlobal = raw.includes(':global');
|
|
50
|
-
const hasVariable = raw.includes('this-');
|
|
51
|
-
let localSheet = target[CONSTANTS.API_STYLE];
|
|
52
|
-
let globalSheet = target.constructor[CONSTANTS.API_STYLE];
|
|
53
|
-
if (!hasVariable && localSheet)
|
|
54
|
-
return;
|
|
55
|
-
const parsed = raw
|
|
56
|
-
.replace(regex1, (match, key) => {
|
|
57
|
-
let value = target;
|
|
58
|
-
for (const section of key.split('-')) {
|
|
59
|
-
value = value?.[section];
|
|
60
|
-
}
|
|
61
|
-
return value;
|
|
62
|
-
})
|
|
63
|
-
.replace(regex2, '');
|
|
64
|
-
if (!localSheet) {
|
|
65
|
-
localSheet = new CSSStyleSheet();
|
|
66
|
-
target[CONSTANTS.API_STYLE] = localSheet;
|
|
67
|
-
shadowRoot(target).adoptedStyleSheets.push(localSheet);
|
|
68
|
-
}
|
|
69
|
-
const localStyle = parsed;
|
|
70
|
-
localSheet.replace(localStyle);
|
|
71
|
-
if (!hasGlobal || globalSheet)
|
|
72
|
-
return;
|
|
73
|
-
if (!globalSheet) {
|
|
74
|
-
globalSheet = new CSSStyleSheet();
|
|
75
|
-
target.constructor[CONSTANTS.API_STYLE] = globalSheet;
|
|
76
|
-
document.adoptedStyleSheets.push(globalSheet);
|
|
77
|
-
}
|
|
78
|
-
const globalStyle = parsed
|
|
79
|
-
.split('}')
|
|
80
|
-
.map((rule) => {
|
|
81
|
-
let [selectors, properties] = rule.split('{');
|
|
82
|
-
selectors = selectors
|
|
83
|
-
.split(',')
|
|
84
|
-
.map((selector) => selector.trim())
|
|
85
|
-
.filter((selector) => selector.startsWith(':global'))
|
|
86
|
-
.map((selector) => selector.replace(':global', ''))
|
|
87
|
-
.map((selector) => selector.trim())
|
|
88
|
-
.join(',');
|
|
89
|
-
return selectors ? `${selectors}{${properties}}` : '';
|
|
90
|
-
})
|
|
91
|
-
.filter((selector) => !!selector)
|
|
92
|
-
.join('');
|
|
93
|
-
globalSheet.replace(globalStyle);
|
|
94
|
-
})();
|
|
95
|
-
// Calls the lifecycle's callback after the rendering phase.
|
|
96
|
-
call(target, CONSTANTS.LIFECYCLE_UPDATED, states);
|
|
97
|
-
// Clears stacks.
|
|
98
|
-
stacks.clear();
|
|
99
|
-
// TODO: related to the @Watch decorator.
|
|
100
|
-
target[CONSTANTS.API_RENDER_COMPLETED] = true;
|
|
101
|
-
};
|
|
102
|
-
// Creates/Gets a micro task function.
|
|
103
|
-
target[CONSTANTS.API_REQUEST] ||= task({ handler });
|
|
104
|
-
// Calls the micro task.
|
|
105
|
-
call(target, CONSTANTS.API_REQUEST);
|
|
106
|
-
};
|
package/client/utils/slots.d.ts
DELETED
package/client/utils/slots.js
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { host } from './host.js';
|
|
2
|
-
/**
|
|
3
|
-
* Returns the slots name.
|
|
4
|
-
*/
|
|
5
|
-
export const slots = (target) => {
|
|
6
|
-
const element = host(target);
|
|
7
|
-
const slots = {};
|
|
8
|
-
const children = Array.from(element.childNodes);
|
|
9
|
-
for (const child of children) {
|
|
10
|
-
if (child.nodeName == '#comment')
|
|
11
|
-
continue;
|
|
12
|
-
const name = child['slot'] || (child.nodeValue?.trim() && 'default') || ('slot' in child && 'default');
|
|
13
|
-
if (!name)
|
|
14
|
-
continue;
|
|
15
|
-
slots[name] = true;
|
|
16
|
-
}
|
|
17
|
-
return slots;
|
|
18
|
-
};
|
package/client/utils/styles.d.ts
DELETED
package/client/utils/styles.js
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { kebabCase } from 'change-case';
|
|
2
|
-
/**
|
|
3
|
-
* Converts a JavaScript object containing CSS styles to a CSS string.
|
|
4
|
-
*/
|
|
5
|
-
export const styles = (input) => {
|
|
6
|
-
return Object.keys(input)
|
|
7
|
-
.filter((key) => input[key] !== undefined && input[key] !== null)
|
|
8
|
-
.map((key) => `${key.startsWith('--') ? '--' : ''}${kebabCase(key)}: ${input[key]}`)
|
|
9
|
-
.join('; ');
|
|
10
|
-
};
|
package/client/utils/task.d.ts
DELETED
package/client/utils/task.js
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
export const task = (options) => {
|
|
2
|
-
let running, promise;
|
|
3
|
-
const run = () => {
|
|
4
|
-
if (options.canStart && !options.canStart())
|
|
5
|
-
return Promise.resolve(false);
|
|
6
|
-
if (!running)
|
|
7
|
-
promise = enqueue();
|
|
8
|
-
return promise;
|
|
9
|
-
};
|
|
10
|
-
const enqueue = async () => {
|
|
11
|
-
running = true;
|
|
12
|
-
try {
|
|
13
|
-
await promise;
|
|
14
|
-
}
|
|
15
|
-
catch (error) {
|
|
16
|
-
Promise.reject(error);
|
|
17
|
-
}
|
|
18
|
-
// TODO: maybe is optional
|
|
19
|
-
if (!running)
|
|
20
|
-
return promise;
|
|
21
|
-
try {
|
|
22
|
-
if (options.canRun && !options.canRun())
|
|
23
|
-
return (running = false);
|
|
24
|
-
options.handler();
|
|
25
|
-
running = false;
|
|
26
|
-
return true;
|
|
27
|
-
}
|
|
28
|
-
catch (error) {
|
|
29
|
-
running = false;
|
|
30
|
-
throw error;
|
|
31
|
-
}
|
|
32
|
-
};
|
|
33
|
-
return run;
|
|
34
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const toBoolean: (input: any) => boolean;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const toEvent: (input: string) => string;
|
package/client/utils/toEvent.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const toProperty: (input: any, type?: any) => any;
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
import * as CONSTANTS from '../../constants/index.js';
|
|
2
|
-
import { typeOf } from './typeOf.js';
|
|
3
|
-
export const toProperty = (input, type) => {
|
|
4
|
-
if (type === undefined)
|
|
5
|
-
return input;
|
|
6
|
-
const string = `${input}`;
|
|
7
|
-
if (CONSTANTS.TYPE_BOOLEAN & type || type === Boolean) {
|
|
8
|
-
if (string === '')
|
|
9
|
-
return true;
|
|
10
|
-
if (string === 'true')
|
|
11
|
-
return true;
|
|
12
|
-
if (string === 'false')
|
|
13
|
-
return false;
|
|
14
|
-
}
|
|
15
|
-
if (CONSTANTS.TYPE_NUMBER & type || type === Number) {
|
|
16
|
-
if (string != '' && !isNaN(input)) {
|
|
17
|
-
return parseFloat(input);
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
if (CONSTANTS.TYPE_NULL & type || type === null) {
|
|
21
|
-
if (string === 'null') {
|
|
22
|
-
return null;
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
if (CONSTANTS.TYPE_DATE & type || type === Date) {
|
|
26
|
-
const value = new Date(input);
|
|
27
|
-
if (value.toString() != 'Invalid Date') {
|
|
28
|
-
return value;
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
if (CONSTANTS.TYPE_ARRAY & type || type === Array) {
|
|
32
|
-
try {
|
|
33
|
-
const value = JSON.parse(input);
|
|
34
|
-
if (typeOf(value) == 'array') {
|
|
35
|
-
return value;
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
catch { }
|
|
39
|
-
}
|
|
40
|
-
if (CONSTANTS.TYPE_OBJECT & type || type === Object) {
|
|
41
|
-
try {
|
|
42
|
-
const value = JSON.parse(input);
|
|
43
|
-
if (typeOf(value) == 'object') {
|
|
44
|
-
return value;
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
catch { }
|
|
48
|
-
}
|
|
49
|
-
if (CONSTANTS.TYPE_UNDEFINED & type || type === undefined) {
|
|
50
|
-
if (string === 'undefined') {
|
|
51
|
-
return undefined;
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
return input;
|
|
55
|
-
};
|
package/client/utils/toUnit.d.ts
DELETED
package/client/utils/toUnit.js
DELETED
package/client/utils/typeOf.d.ts
DELETED
package/client/utils/typeOf.js
DELETED
package/client/utils/uhtml.d.ts
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Holds all details wrappers needed to render the content further on.
|
|
3
|
-
* @constructor
|
|
4
|
-
* @param {string} type The hole type, either `html` or `svg`.
|
|
5
|
-
* @param {string[]} template The template literals used to the define the content.
|
|
6
|
-
* @param {Array} values Zero, one, or more interpolated values to render.
|
|
7
|
-
*/
|
|
8
|
-
export class Hole {
|
|
9
|
-
constructor(type: any, template: any, values: any);
|
|
10
|
-
type: any;
|
|
11
|
-
template: any;
|
|
12
|
-
values: any;
|
|
13
|
-
}
|
|
14
|
-
export const html: ((template: any, ...values: any[]) => Hole) & {
|
|
15
|
-
for(ref: any, id: any): any;
|
|
16
|
-
node: (template: any, ...values: any[]) => any;
|
|
17
|
-
};
|
|
18
|
-
export function render(where: any, what: any): any;
|
|
19
|
-
export const svg: ((template: any, ...values: any[]) => Hole) & {
|
|
20
|
-
for(ref: any, id: any): any;
|
|
21
|
-
node: (template: any, ...values: any[]) => any;
|
|
22
|
-
};
|