@ktjs/shared 0.22.6 → 0.22.8
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 +5 -3
- package/dist/index.iife.js +24 -20
- package/dist/index.legacy.js +68 -20
- package/dist/index.mjs +22 -20
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -39,7 +39,9 @@ declare const $isThenable: (o: any) => o is Promise<any>;
|
|
|
39
39
|
* @see ./.scripts/replace.mjs
|
|
40
40
|
*/
|
|
41
41
|
declare const $throw: (message: string) => never;
|
|
42
|
-
declare const $warn:
|
|
42
|
+
declare const $warn: typeof console.warn;
|
|
43
|
+
declare const $error: typeof console.error;
|
|
44
|
+
declare const $debug: typeof console.debug;
|
|
43
45
|
|
|
44
46
|
type otherstring = string & {};
|
|
45
47
|
|
|
@@ -123,7 +125,6 @@ declare const $buttonDisabledGetter: () => any;
|
|
|
123
125
|
declare const $buttonDisabledSetter: (v: any) => void;
|
|
124
126
|
declare const parseStyle: (style: string | Partial<CSSStyleDeclaration> | undefined) => string;
|
|
125
127
|
type ChangeHandler<T = string> = (value: T, ...args: any[]) => void;
|
|
126
|
-
declare const generateHandler: <T = string>(props: any, key: string) => ChangeHandler<T>;
|
|
127
128
|
/**
|
|
128
129
|
* Used for `k-model`
|
|
129
130
|
*/
|
|
@@ -136,6 +137,7 @@ declare const applyModel: (element: HTMLElementTagNameMap[InputElementTag], valu
|
|
|
136
137
|
* Default empty function
|
|
137
138
|
*/
|
|
138
139
|
declare const $emptyFn: (...args: any[]) => any;
|
|
140
|
+
declare const $isSame: (a: unknown, b: unknown) => boolean;
|
|
139
141
|
|
|
140
142
|
/**
|
|
141
143
|
* Normalize path by joining parts and ensuring leading slash
|
|
@@ -160,5 +162,5 @@ declare const emplaceParams: (path: string, params: Record<string, string>) => s
|
|
|
160
162
|
*/
|
|
161
163
|
declare const extractParams: (pattern: string, path: string) => Record<string, string> | null;
|
|
162
164
|
|
|
163
|
-
export { $ArrayFrom, $append, $appendChild, $assign, $buttonDisabledGetter, $buttonDisabledSetter, $define, $defines, $emptyFn, $entries, $hasOwn, $is, $isArray, $isNode, $isThenable, $keys, $random, $replaceNode, $throw, $toString, $warn, DIRV_TYPE, MATHML_ATTR_FLAG, SVG_ATTR_FLAG, applyModel, buildQuery, emplaceParams, extractParams,
|
|
165
|
+
export { $ArrayFrom, $append, $appendChild, $assign, $buttonDisabledGetter, $buttonDisabledSetter, $debug, $define, $defines, $emptyFn, $entries, $error, $hasOwn, $is, $isArray, $isNode, $isSame, $isThenable, $keys, $random, $replaceNode, $throw, $toString, $warn, DIRV_TYPE, MATHML_ATTR_FLAG, SVG_ATTR_FLAG, applyModel, buildQuery, emplaceParams, extractParams, normalizePath, parseQuery, parseStyle };
|
|
164
166
|
export type { ChangeHandler, ChangeTriggerField, HTMLTag, InputElementTag, MathMLTag, NoTextNodeTag, NonSpecialTags, SVGTag, otherstring };
|
package/dist/index.iife.js
CHANGED
|
@@ -38,15 +38,15 @@ var __ktjs_shared__ = (function (exports) {
|
|
|
38
38
|
const $throw = (message) => {
|
|
39
39
|
throw new Error('[kt.js error]' + message);
|
|
40
40
|
};
|
|
41
|
-
const $warn = (
|
|
42
|
-
console.warn('[kt.js warn]
|
|
41
|
+
const $warn = (...args) => {
|
|
42
|
+
console.warn('[kt.js warn]', ...args);
|
|
43
|
+
};
|
|
44
|
+
const $error = (...args) => {
|
|
45
|
+
console.error('[kt.js error]', ...args);
|
|
46
|
+
};
|
|
47
|
+
const $debug = (...args) => {
|
|
48
|
+
console.debug('[kt.js debug]', ...args);
|
|
43
49
|
};
|
|
44
|
-
|
|
45
|
-
// String manipulation utilities
|
|
46
|
-
/**
|
|
47
|
-
* Default empty function
|
|
48
|
-
*/
|
|
49
|
-
const $emptyFn = (() => true);
|
|
50
50
|
|
|
51
51
|
// DOM manipulation utilities
|
|
52
52
|
// # dom natives
|
|
@@ -114,16 +114,6 @@ var __ktjs_shared__ = (function (exports) {
|
|
|
114
114
|
}
|
|
115
115
|
return '';
|
|
116
116
|
};
|
|
117
|
-
const generateHandler = (props, key) => {
|
|
118
|
-
const handler = props[key];
|
|
119
|
-
if (typeof handler === 'function') {
|
|
120
|
-
return handler;
|
|
121
|
-
}
|
|
122
|
-
else if (handler && typeof handler === 'object' && handler.isKT) {
|
|
123
|
-
return (value) => (handler.value = value);
|
|
124
|
-
}
|
|
125
|
-
return $emptyFn;
|
|
126
|
-
};
|
|
127
117
|
/**
|
|
128
118
|
* Used for `k-model`
|
|
129
119
|
*/
|
|
@@ -133,6 +123,18 @@ var __ktjs_shared__ = (function (exports) {
|
|
|
133
123
|
element.addEventListener(eventName, () => (valueRef.value = element[propName]));
|
|
134
124
|
};
|
|
135
125
|
|
|
126
|
+
// String manipulation utilities
|
|
127
|
+
/**
|
|
128
|
+
* Default empty function
|
|
129
|
+
*/
|
|
130
|
+
const $emptyFn = (() => true);
|
|
131
|
+
const $isSame = (a, b) => {
|
|
132
|
+
if ($isArray(a)) {
|
|
133
|
+
return true; // always trigger an array
|
|
134
|
+
}
|
|
135
|
+
return $is(a, b);
|
|
136
|
+
};
|
|
137
|
+
|
|
136
138
|
/**
|
|
137
139
|
* Normalize path by joining parts and ensuring leading slash
|
|
138
140
|
*/
|
|
@@ -213,7 +215,7 @@ var __ktjs_shared__ = (function (exports) {
|
|
|
213
215
|
}
|
|
214
216
|
|
|
215
217
|
// Shared utilities and cached native methods for kt.js framework
|
|
216
|
-
Object.defineProperty(window, '__ktjs__', { value: '0.22.
|
|
218
|
+
Object.defineProperty(window, '__ktjs__', { value: '0.22.8' });
|
|
217
219
|
|
|
218
220
|
exports.$ArrayFrom = $ArrayFrom;
|
|
219
221
|
exports.$append = $append;
|
|
@@ -221,14 +223,17 @@ var __ktjs_shared__ = (function (exports) {
|
|
|
221
223
|
exports.$assign = $assign;
|
|
222
224
|
exports.$buttonDisabledGetter = $buttonDisabledGetter;
|
|
223
225
|
exports.$buttonDisabledSetter = $buttonDisabledSetter;
|
|
226
|
+
exports.$debug = $debug;
|
|
224
227
|
exports.$define = $define;
|
|
225
228
|
exports.$defines = $defines;
|
|
226
229
|
exports.$emptyFn = $emptyFn;
|
|
227
230
|
exports.$entries = $entries;
|
|
231
|
+
exports.$error = $error;
|
|
228
232
|
exports.$hasOwn = $hasOwn;
|
|
229
233
|
exports.$is = $is;
|
|
230
234
|
exports.$isArray = $isArray;
|
|
231
235
|
exports.$isNode = $isNode;
|
|
236
|
+
exports.$isSame = $isSame;
|
|
232
237
|
exports.$isThenable = $isThenable;
|
|
233
238
|
exports.$keys = $keys;
|
|
234
239
|
exports.$random = $random;
|
|
@@ -243,7 +248,6 @@ var __ktjs_shared__ = (function (exports) {
|
|
|
243
248
|
exports.buildQuery = buildQuery;
|
|
244
249
|
exports.emplaceParams = emplaceParams;
|
|
245
250
|
exports.extractParams = extractParams;
|
|
246
|
-
exports.generateHandler = generateHandler;
|
|
247
251
|
exports.normalizePath = normalizePath;
|
|
248
252
|
exports.parseQuery = parseQuery;
|
|
249
253
|
exports.parseStyle = parseStyle;
|
package/dist/index.legacy.js
CHANGED
|
@@ -30,6 +30,38 @@ var __ktjs_shared__ = (function (exports) {
|
|
|
30
30
|
var $random = Math.random;
|
|
31
31
|
var $isThenable = function (o) { return typeof (o === null || o === void 0 ? void 0 : o.then) === 'function'; };
|
|
32
32
|
|
|
33
|
+
/******************************************************************************
|
|
34
|
+
Copyright (c) Microsoft Corporation.
|
|
35
|
+
|
|
36
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
37
|
+
purpose with or without fee is hereby granted.
|
|
38
|
+
|
|
39
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
40
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
41
|
+
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
42
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
43
|
+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
44
|
+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
45
|
+
PERFORMANCE OF THIS SOFTWARE.
|
|
46
|
+
***************************************************************************** */
|
|
47
|
+
/* global Reflect, Promise, SuppressedError, Symbol, Iterator */
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
function __spreadArray(to, from, pack) {
|
|
51
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
52
|
+
if (ar || !(i in from)) {
|
|
53
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
54
|
+
ar[i] = from[i];
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
|
61
|
+
var e = new Error(message);
|
|
62
|
+
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
63
|
+
};
|
|
64
|
+
|
|
33
65
|
// Error handling utilities
|
|
34
66
|
/**
|
|
35
67
|
* * Actually, these functions will be replaced as they are by @rollup/plugin-replace
|
|
@@ -38,15 +70,27 @@ var __ktjs_shared__ = (function (exports) {
|
|
|
38
70
|
var $throw = function (message) {
|
|
39
71
|
throw new Error('[kt.js error]' + message);
|
|
40
72
|
};
|
|
41
|
-
var $warn = function (
|
|
42
|
-
|
|
73
|
+
var $warn = function () {
|
|
74
|
+
var args = [];
|
|
75
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
76
|
+
args[_i] = arguments[_i];
|
|
77
|
+
}
|
|
78
|
+
console.warn.apply(console, __spreadArray(['[kt.js warn]'], args, false));
|
|
79
|
+
};
|
|
80
|
+
var $error = function () {
|
|
81
|
+
var args = [];
|
|
82
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
83
|
+
args[_i] = arguments[_i];
|
|
84
|
+
}
|
|
85
|
+
console.error.apply(console, __spreadArray(['[kt.js error]'], args, false));
|
|
86
|
+
};
|
|
87
|
+
var $debug = function () {
|
|
88
|
+
var args = [];
|
|
89
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
90
|
+
args[_i] = arguments[_i];
|
|
91
|
+
}
|
|
92
|
+
console.debug.apply(console, __spreadArray(['[kt.js debug]'], args, false));
|
|
43
93
|
};
|
|
44
|
-
|
|
45
|
-
// String manipulation utilities
|
|
46
|
-
/**
|
|
47
|
-
* Default empty function
|
|
48
|
-
*/
|
|
49
|
-
var $emptyFn = (function () { return true; });
|
|
50
94
|
|
|
51
95
|
// DOM manipulation utilities
|
|
52
96
|
var _a;
|
|
@@ -120,16 +164,6 @@ var __ktjs_shared__ = (function (exports) {
|
|
|
120
164
|
}
|
|
121
165
|
return '';
|
|
122
166
|
};
|
|
123
|
-
var generateHandler = function (props, key) {
|
|
124
|
-
var handler = props[key];
|
|
125
|
-
if (typeof handler === 'function') {
|
|
126
|
-
return handler;
|
|
127
|
-
}
|
|
128
|
-
else if (handler && typeof handler === 'object' && handler.isKT) {
|
|
129
|
-
return function (value) { return (handler.value = value); };
|
|
130
|
-
}
|
|
131
|
-
return $emptyFn;
|
|
132
|
-
};
|
|
133
167
|
/**
|
|
134
168
|
* Used for `k-model`
|
|
135
169
|
*/
|
|
@@ -139,6 +173,18 @@ var __ktjs_shared__ = (function (exports) {
|
|
|
139
173
|
element.addEventListener(eventName, function () { return (valueRef.value = element[propName]); });
|
|
140
174
|
};
|
|
141
175
|
|
|
176
|
+
// String manipulation utilities
|
|
177
|
+
/**
|
|
178
|
+
* Default empty function
|
|
179
|
+
*/
|
|
180
|
+
var $emptyFn = (function () { return true; });
|
|
181
|
+
var $isSame = function (a, b) {
|
|
182
|
+
if ($isArray(a)) {
|
|
183
|
+
return true; // always trigger an array
|
|
184
|
+
}
|
|
185
|
+
return $is(a, b);
|
|
186
|
+
};
|
|
187
|
+
|
|
142
188
|
/**
|
|
143
189
|
* Normalize path by joining parts and ensuring leading slash
|
|
144
190
|
*/
|
|
@@ -224,7 +270,7 @@ var __ktjs_shared__ = (function (exports) {
|
|
|
224
270
|
}
|
|
225
271
|
|
|
226
272
|
// Shared utilities and cached native methods for kt.js framework
|
|
227
|
-
Object.defineProperty(window, '__ktjs__', { value: '0.22.
|
|
273
|
+
Object.defineProperty(window, '__ktjs__', { value: '0.22.8' });
|
|
228
274
|
|
|
229
275
|
exports.$ArrayFrom = $ArrayFrom;
|
|
230
276
|
exports.$append = $append;
|
|
@@ -232,14 +278,17 @@ var __ktjs_shared__ = (function (exports) {
|
|
|
232
278
|
exports.$assign = $assign;
|
|
233
279
|
exports.$buttonDisabledGetter = $buttonDisabledGetter;
|
|
234
280
|
exports.$buttonDisabledSetter = $buttonDisabledSetter;
|
|
281
|
+
exports.$debug = $debug;
|
|
235
282
|
exports.$define = $define;
|
|
236
283
|
exports.$defines = $defines;
|
|
237
284
|
exports.$emptyFn = $emptyFn;
|
|
238
285
|
exports.$entries = $entries;
|
|
286
|
+
exports.$error = $error;
|
|
239
287
|
exports.$hasOwn = $hasOwn;
|
|
240
288
|
exports.$is = $is;
|
|
241
289
|
exports.$isArray = $isArray;
|
|
242
290
|
exports.$isNode = $isNode;
|
|
291
|
+
exports.$isSame = $isSame;
|
|
243
292
|
exports.$isThenable = $isThenable;
|
|
244
293
|
exports.$keys = $keys;
|
|
245
294
|
exports.$random = $random;
|
|
@@ -254,7 +303,6 @@ var __ktjs_shared__ = (function (exports) {
|
|
|
254
303
|
exports.buildQuery = buildQuery;
|
|
255
304
|
exports.emplaceParams = emplaceParams;
|
|
256
305
|
exports.extractParams = extractParams;
|
|
257
|
-
exports.generateHandler = generateHandler;
|
|
258
306
|
exports.normalizePath = normalizePath;
|
|
259
307
|
exports.parseQuery = parseQuery;
|
|
260
308
|
exports.parseStyle = parseStyle;
|
package/dist/index.mjs
CHANGED
|
@@ -35,15 +35,15 @@ const $isThenable = (o) => typeof o?.then === 'function';
|
|
|
35
35
|
const $throw = (message) => {
|
|
36
36
|
throw new Error('[kt.js error]' + message);
|
|
37
37
|
};
|
|
38
|
-
const $warn = (
|
|
39
|
-
console.warn('[kt.js warn]
|
|
38
|
+
const $warn = (...args) => {
|
|
39
|
+
console.warn('[kt.js warn]', ...args);
|
|
40
|
+
};
|
|
41
|
+
const $error = (...args) => {
|
|
42
|
+
console.error('[kt.js error]', ...args);
|
|
43
|
+
};
|
|
44
|
+
const $debug = (...args) => {
|
|
45
|
+
console.debug('[kt.js debug]', ...args);
|
|
40
46
|
};
|
|
41
|
-
|
|
42
|
-
// String manipulation utilities
|
|
43
|
-
/**
|
|
44
|
-
* Default empty function
|
|
45
|
-
*/
|
|
46
|
-
const $emptyFn = (() => true);
|
|
47
47
|
|
|
48
48
|
// DOM manipulation utilities
|
|
49
49
|
// # dom natives
|
|
@@ -111,16 +111,6 @@ const parseStyle = (style) => {
|
|
|
111
111
|
}
|
|
112
112
|
return '';
|
|
113
113
|
};
|
|
114
|
-
const generateHandler = (props, key) => {
|
|
115
|
-
const handler = props[key];
|
|
116
|
-
if (typeof handler === 'function') {
|
|
117
|
-
return handler;
|
|
118
|
-
}
|
|
119
|
-
else if (handler && typeof handler === 'object' && handler.isKT) {
|
|
120
|
-
return (value) => (handler.value = value);
|
|
121
|
-
}
|
|
122
|
-
return $emptyFn;
|
|
123
|
-
};
|
|
124
114
|
/**
|
|
125
115
|
* Used for `k-model`
|
|
126
116
|
*/
|
|
@@ -130,6 +120,18 @@ const applyModel = (element, valueRef, propName, eventName) => {
|
|
|
130
120
|
element.addEventListener(eventName, () => (valueRef.value = element[propName]));
|
|
131
121
|
};
|
|
132
122
|
|
|
123
|
+
// String manipulation utilities
|
|
124
|
+
/**
|
|
125
|
+
* Default empty function
|
|
126
|
+
*/
|
|
127
|
+
const $emptyFn = (() => true);
|
|
128
|
+
const $isSame = (a, b) => {
|
|
129
|
+
if ($isArray(a)) {
|
|
130
|
+
return true; // always trigger an array
|
|
131
|
+
}
|
|
132
|
+
return $is(a, b);
|
|
133
|
+
};
|
|
134
|
+
|
|
133
135
|
/**
|
|
134
136
|
* Normalize path by joining parts and ensuring leading slash
|
|
135
137
|
*/
|
|
@@ -210,6 +212,6 @@ if (typeof Symbol === 'undefined') {
|
|
|
210
212
|
}
|
|
211
213
|
|
|
212
214
|
// Shared utilities and cached native methods for kt.js framework
|
|
213
|
-
Object.defineProperty(window, '__ktjs__', { value: '0.22.
|
|
215
|
+
Object.defineProperty(window, '__ktjs__', { value: '0.22.8' });
|
|
214
216
|
|
|
215
|
-
export { $ArrayFrom, $append, $appendChild, $assign, $buttonDisabledGetter, $buttonDisabledSetter, $define, $defines, $emptyFn, $entries, $hasOwn, $is, $isArray, $isNode, $isThenable, $keys, $random, $replaceNode, $throw, $toString, $warn, DIRV_TYPE, MATHML_ATTR_FLAG, SVG_ATTR_FLAG, applyModel, buildQuery, emplaceParams, extractParams,
|
|
217
|
+
export { $ArrayFrom, $append, $appendChild, $assign, $buttonDisabledGetter, $buttonDisabledSetter, $debug, $define, $defines, $emptyFn, $entries, $error, $hasOwn, $is, $isArray, $isNode, $isSame, $isThenable, $keys, $random, $replaceNode, $throw, $toString, $warn, DIRV_TYPE, MATHML_ATTR_FLAG, SVG_ATTR_FLAG, applyModel, buildQuery, emplaceParams, extractParams, normalizePath, parseQuery, parseStyle };
|