@ktjs/shared 0.19.0 → 0.20.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/dist/index.d.ts +18 -1
- package/dist/index.iife.js +16 -2
- package/dist/index.legacy.js +17 -2
- package/dist/index.mjs +10 -3
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,22 @@
|
|
|
1
1
|
declare const $isArray: (arg: any) => arg is any[];
|
|
2
|
+
declare const $ArrayFrom: {
|
|
3
|
+
<T>(arrayLike: ArrayLike<T>): T[];
|
|
4
|
+
<T, U>(arrayLike: ArrayLike<T>, mapfn: (v: T, k: number) => U, thisArg?: any): U[];
|
|
5
|
+
<T>(iterable: Iterable<T> | ArrayLike<T>): T[];
|
|
6
|
+
<T, U>(iterable: Iterable<T> | ArrayLike<T>, mapfn: (v: T, k: number) => U, thisArg?: any): U[];
|
|
7
|
+
};
|
|
8
|
+
declare const $is: (value1: any, value2: any) => boolean;
|
|
9
|
+
declare const $assign: {
|
|
10
|
+
<T extends {}, U>(target: T, source: U): T & U;
|
|
11
|
+
<T extends {}, U, V>(target: T, source1: U, source2: V): T & U & V;
|
|
12
|
+
<T extends {}, U, V, W>(target: T, source1: U, source2: V, source3: W): T & U & V & W;
|
|
13
|
+
(target: object, ...sources: any[]): any;
|
|
14
|
+
};
|
|
2
15
|
declare const $hasOwn: (v: PropertyKey) => boolean;
|
|
16
|
+
declare const $toString: () => string;
|
|
3
17
|
declare const $keys: <T>(o: T) => Array<keyof T>;
|
|
4
18
|
declare const $defines: <T>(o: T, properties: PropertyDescriptorMap & ThisType<any>) => T;
|
|
19
|
+
declare const $define: <T>(o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType<any>) => T;
|
|
5
20
|
declare const $entries: <T>(o: T) => Array<[keyof T, T[keyof T]]>;
|
|
6
21
|
declare const $isThenable: (o: any) => o is Promise<any>;
|
|
7
22
|
|
|
@@ -14,6 +29,8 @@ declare const $throw: (message: string) => never;
|
|
|
14
29
|
declare const $appendChild: <T extends Node>(node: T) => T;
|
|
15
30
|
declare const originAppend: (...nodes: (Node | string)[]) => void;
|
|
16
31
|
declare const $append: typeof originAppend;
|
|
32
|
+
declare const $buttonDisabledGetter: () => any;
|
|
33
|
+
declare const $buttonDisabledSetter: (v: any) => void;
|
|
17
34
|
declare const parseStyle: (style: string | Partial<CSSStyleDeclaration> | undefined) => string;
|
|
18
35
|
type ChangeHandler<T = string> = (value: T, ...args: any[]) => void;
|
|
19
36
|
declare const generateHandler: <T = string>(props: any, key: string) => ChangeHandler<T>;
|
|
@@ -46,5 +63,5 @@ declare const emplaceParams: (path: string, params: Record<string, string>) => s
|
|
|
46
63
|
*/
|
|
47
64
|
declare const extractParams: (pattern: string, path: string) => Record<string, string> | null;
|
|
48
65
|
|
|
49
|
-
export { $append, $appendChild, $defines, $emptyFn, $entries, $hasOwn, $isArray, $isThenable, $keys, $throw, buildQuery, emplaceParams, extractParams, generateHandler, normalizePath, parseQuery, parseStyle };
|
|
66
|
+
export { $ArrayFrom, $append, $appendChild, $assign, $buttonDisabledGetter, $buttonDisabledSetter, $define, $defines, $emptyFn, $entries, $hasOwn, $is, $isArray, $isThenable, $keys, $throw, $toString, buildQuery, emplaceParams, extractParams, generateHandler, normalizePath, parseQuery, parseStyle };
|
|
50
67
|
export type { ChangeHandler };
|
package/dist/index.iife.js
CHANGED
|
@@ -3,9 +3,14 @@ var __ktjs_shared__ = (function (exports) {
|
|
|
3
3
|
|
|
4
4
|
// Cached native methods for performance optimization
|
|
5
5
|
const $isArray = Array.isArray;
|
|
6
|
+
const $ArrayFrom = Array.from;
|
|
7
|
+
const $is = Object.is;
|
|
8
|
+
const $assign = Object.assign;
|
|
6
9
|
const $hasOwn = Object.prototype.hasOwnProperty;
|
|
10
|
+
const $toString = Object.prototype.toString;
|
|
7
11
|
const $keys = Object.keys;
|
|
8
12
|
const $defines = Object.defineProperties;
|
|
13
|
+
const $define = Object.defineProperty;
|
|
9
14
|
const $entries = Object.entries;
|
|
10
15
|
const $isThenable = (o) => typeof o === 'object' && o !== null && typeof o.then === 'function';
|
|
11
16
|
|
|
@@ -21,6 +26,7 @@ var __ktjs_shared__ = (function (exports) {
|
|
|
21
26
|
const $emptyFn = (() => true);
|
|
22
27
|
|
|
23
28
|
// DOM manipulation utilities
|
|
29
|
+
// # dom natives
|
|
24
30
|
/**
|
|
25
31
|
* & Remove `bind` because it is shockingly slower than wrapper
|
|
26
32
|
* & `window.document` is safe because it is not configurable and its setter is undefined
|
|
@@ -56,7 +62,8 @@ var __ktjs_shared__ = (function (exports) {
|
|
|
56
62
|
$appendChild.call(this, fragment);
|
|
57
63
|
}
|
|
58
64
|
};
|
|
59
|
-
|
|
65
|
+
const { get: $buttonDisabledGetter, set: $buttonDisabledSetter } = Object.getOwnPropertyDescriptor(HTMLButtonElement.prototype, 'disabled');
|
|
66
|
+
// # DOM utilities
|
|
60
67
|
const parseStyle = (style) => {
|
|
61
68
|
if (typeof style === 'string') {
|
|
62
69
|
return style;
|
|
@@ -158,18 +165,25 @@ var __ktjs_shared__ = (function (exports) {
|
|
|
158
165
|
|
|
159
166
|
// Shared utilities and cached native methods for kt.js framework
|
|
160
167
|
// Re-export all utilities
|
|
161
|
-
Object.defineProperty(window, '@ktjs/shared', { value: '0.
|
|
168
|
+
Object.defineProperty(window, '@ktjs/shared', { value: '0.20.1' });
|
|
162
169
|
|
|
170
|
+
exports.$ArrayFrom = $ArrayFrom;
|
|
163
171
|
exports.$append = $append;
|
|
164
172
|
exports.$appendChild = $appendChild;
|
|
173
|
+
exports.$assign = $assign;
|
|
174
|
+
exports.$buttonDisabledGetter = $buttonDisabledGetter;
|
|
175
|
+
exports.$buttonDisabledSetter = $buttonDisabledSetter;
|
|
176
|
+
exports.$define = $define;
|
|
165
177
|
exports.$defines = $defines;
|
|
166
178
|
exports.$emptyFn = $emptyFn;
|
|
167
179
|
exports.$entries = $entries;
|
|
168
180
|
exports.$hasOwn = $hasOwn;
|
|
181
|
+
exports.$is = $is;
|
|
169
182
|
exports.$isArray = $isArray;
|
|
170
183
|
exports.$isThenable = $isThenable;
|
|
171
184
|
exports.$keys = $keys;
|
|
172
185
|
exports.$throw = $throw;
|
|
186
|
+
exports.$toString = $toString;
|
|
173
187
|
exports.buildQuery = buildQuery;
|
|
174
188
|
exports.emplaceParams = emplaceParams;
|
|
175
189
|
exports.extractParams = extractParams;
|
package/dist/index.legacy.js
CHANGED
|
@@ -3,9 +3,14 @@ var __ktjs_shared__ = (function (exports) {
|
|
|
3
3
|
|
|
4
4
|
// Cached native methods for performance optimization
|
|
5
5
|
var $isArray = Array.isArray;
|
|
6
|
+
var $ArrayFrom = Array.from;
|
|
7
|
+
var $is = Object.is;
|
|
8
|
+
var $assign = Object.assign;
|
|
6
9
|
var $hasOwn = Object.prototype.hasOwnProperty;
|
|
10
|
+
var $toString = Object.prototype.toString;
|
|
7
11
|
var $keys = Object.keys;
|
|
8
12
|
var $defines = Object.defineProperties;
|
|
13
|
+
var $define = Object.defineProperty;
|
|
9
14
|
var $entries = Object.entries;
|
|
10
15
|
var $isThenable = function (o) {
|
|
11
16
|
return typeof o === 'object' && o !== null && typeof o.then === 'function';
|
|
@@ -23,6 +28,8 @@ var __ktjs_shared__ = (function (exports) {
|
|
|
23
28
|
var $emptyFn = (function () { return true; });
|
|
24
29
|
|
|
25
30
|
// DOM manipulation utilities
|
|
31
|
+
var _a;
|
|
32
|
+
// # dom natives
|
|
26
33
|
/**
|
|
27
34
|
* & Remove `bind` because it is shockingly slower than wrapper
|
|
28
35
|
* & `window.document` is safe because it is not configurable and its setter is undefined
|
|
@@ -62,7 +69,8 @@ var __ktjs_shared__ = (function (exports) {
|
|
|
62
69
|
$appendChild.call(this, fragment);
|
|
63
70
|
}
|
|
64
71
|
};
|
|
65
|
-
|
|
72
|
+
var $buttonDisabledGetter = (_a = Object.getOwnPropertyDescriptor(HTMLButtonElement.prototype, 'disabled'), _a.get), $buttonDisabledSetter = _a.set;
|
|
73
|
+
// # DOM utilities
|
|
66
74
|
var parseStyle = function (style) {
|
|
67
75
|
if (typeof style === 'string') {
|
|
68
76
|
return style;
|
|
@@ -170,18 +178,25 @@ var __ktjs_shared__ = (function (exports) {
|
|
|
170
178
|
|
|
171
179
|
// Shared utilities and cached native methods for kt.js framework
|
|
172
180
|
// Re-export all utilities
|
|
173
|
-
Object.defineProperty(window, '@ktjs/shared', { value: '0.
|
|
181
|
+
Object.defineProperty(window, '@ktjs/shared', { value: '0.20.1' });
|
|
174
182
|
|
|
183
|
+
exports.$ArrayFrom = $ArrayFrom;
|
|
175
184
|
exports.$append = $append;
|
|
176
185
|
exports.$appendChild = $appendChild;
|
|
186
|
+
exports.$assign = $assign;
|
|
187
|
+
exports.$buttonDisabledGetter = $buttonDisabledGetter;
|
|
188
|
+
exports.$buttonDisabledSetter = $buttonDisabledSetter;
|
|
189
|
+
exports.$define = $define;
|
|
177
190
|
exports.$defines = $defines;
|
|
178
191
|
exports.$emptyFn = $emptyFn;
|
|
179
192
|
exports.$entries = $entries;
|
|
180
193
|
exports.$hasOwn = $hasOwn;
|
|
194
|
+
exports.$is = $is;
|
|
181
195
|
exports.$isArray = $isArray;
|
|
182
196
|
exports.$isThenable = $isThenable;
|
|
183
197
|
exports.$keys = $keys;
|
|
184
198
|
exports.$throw = $throw;
|
|
199
|
+
exports.$toString = $toString;
|
|
185
200
|
exports.buildQuery = buildQuery;
|
|
186
201
|
exports.emplaceParams = emplaceParams;
|
|
187
202
|
exports.extractParams = extractParams;
|
package/dist/index.mjs
CHANGED
|
@@ -1,8 +1,13 @@
|
|
|
1
1
|
// Cached native methods for performance optimization
|
|
2
2
|
const $isArray = Array.isArray;
|
|
3
|
+
const $ArrayFrom = Array.from;
|
|
4
|
+
const $is = Object.is;
|
|
5
|
+
const $assign = Object.assign;
|
|
3
6
|
const $hasOwn = Object.prototype.hasOwnProperty;
|
|
7
|
+
const $toString = Object.prototype.toString;
|
|
4
8
|
const $keys = Object.keys;
|
|
5
9
|
const $defines = Object.defineProperties;
|
|
10
|
+
const $define = Object.defineProperty;
|
|
6
11
|
const $entries = Object.entries;
|
|
7
12
|
const $isThenable = (o) => typeof o === 'object' && o !== null && typeof o.then === 'function';
|
|
8
13
|
|
|
@@ -18,6 +23,7 @@ const $throw = (message) => {
|
|
|
18
23
|
const $emptyFn = (() => true);
|
|
19
24
|
|
|
20
25
|
// DOM manipulation utilities
|
|
26
|
+
// # dom natives
|
|
21
27
|
/**
|
|
22
28
|
* & Remove `bind` because it is shockingly slower than wrapper
|
|
23
29
|
* & `window.document` is safe because it is not configurable and its setter is undefined
|
|
@@ -53,7 +59,8 @@ const $append = // for ie 9/10/11
|
|
|
53
59
|
$appendChild.call(this, fragment);
|
|
54
60
|
}
|
|
55
61
|
};
|
|
56
|
-
|
|
62
|
+
const { get: $buttonDisabledGetter, set: $buttonDisabledSetter } = Object.getOwnPropertyDescriptor(HTMLButtonElement.prototype, 'disabled');
|
|
63
|
+
// # DOM utilities
|
|
57
64
|
const parseStyle = (style) => {
|
|
58
65
|
if (typeof style === 'string') {
|
|
59
66
|
return style;
|
|
@@ -155,6 +162,6 @@ const extractParams = (pattern, path) => {
|
|
|
155
162
|
|
|
156
163
|
// Shared utilities and cached native methods for kt.js framework
|
|
157
164
|
// Re-export all utilities
|
|
158
|
-
Object.defineProperty(window, '@ktjs/shared', { value: '0.
|
|
165
|
+
Object.defineProperty(window, '@ktjs/shared', { value: '0.20.1' });
|
|
159
166
|
|
|
160
|
-
export { $append, $appendChild, $defines, $emptyFn, $entries, $hasOwn, $isArray, $isThenable, $keys, $throw, buildQuery, emplaceParams, extractParams, generateHandler, normalizePath, parseQuery, parseStyle };
|
|
167
|
+
export { $ArrayFrom, $append, $appendChild, $assign, $buttonDisabledGetter, $buttonDisabledSetter, $define, $defines, $emptyFn, $entries, $hasOwn, $is, $isArray, $isThenable, $keys, $throw, $toString, buildQuery, emplaceParams, extractParams, generateHandler, normalizePath, parseQuery, parseStyle };
|