@ktjs/shared 0.22.3 → 0.22.5

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 CHANGED
@@ -1,3 +1,16 @@
1
+ /**
2
+ * Mark the attribute as SVG to handle special cases during rendering.
3
+ */
4
+ declare const SVG_ATTR_FLAG = "__kt_svg__";
5
+ /**
6
+ * Mark the attribute as MathML to handle special cases during rendering.
7
+ */
8
+ declare const MATHML_ATTR_FLAG = "__kt_mathml__";
9
+ /**
10
+ * Can be if, else, else-if.
11
+ */
12
+ declare const DIRV_TYPE: unique symbol;
13
+
1
14
  declare const $isArray: (arg: any) => arg is any[];
2
15
  declare const $ArrayFrom: {
3
16
  <T>(arrayLike: ArrayLike<T>): T[];
@@ -18,6 +31,7 @@ declare const $keys: <T>(o: T) => Array<keyof T>;
18
31
  declare const $defines: <T>(o: T, properties: PropertyDescriptorMap & ThisType<any>) => T;
19
32
  declare const $define: <T>(o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType<any>) => T;
20
33
  declare const $entries: <T>(o: T) => Array<[keyof T, T[keyof T]]>;
34
+ declare const $random: () => number;
21
35
  declare const $isThenable: (o: any) => o is Promise<any>;
22
36
 
23
37
  /**
@@ -142,5 +156,5 @@ declare const emplaceParams: (path: string, params: Record<string, string>) => s
142
156
  */
143
157
  declare const extractParams: (pattern: string, path: string) => Record<string, string> | null;
144
158
 
145
- export { $ArrayFrom, $append, $appendChild, $assign, $buttonDisabledGetter, $buttonDisabledSetter, $define, $defines, $emptyFn, $entries, $hasOwn, $is, $isArray, $isNode, $isThenable, $keys, $throw, $toString, $warn, applyModel, buildQuery, emplaceParams, extractParams, generateHandler, normalizePath, parseQuery, parseStyle };
159
+ export { $ArrayFrom, $append, $appendChild, $assign, $buttonDisabledGetter, $buttonDisabledSetter, $define, $defines, $emptyFn, $entries, $hasOwn, $is, $isArray, $isNode, $isThenable, $keys, $random, $throw, $toString, $warn, DIRV_TYPE, MATHML_ATTR_FLAG, SVG_ATTR_FLAG, applyModel, buildQuery, emplaceParams, extractParams, generateHandler, normalizePath, parseQuery, parseStyle };
146
160
  export type { ChangeHandler, ChangeTriggerField, HTMLTag, InputElementTag, MathMLTag, NoTextNodeTag, NonSpecialTags, SVGTag, otherstring };
@@ -1,6 +1,21 @@
1
1
  var __ktjs_shared__ = (function (exports) {
2
2
  'use strict';
3
3
 
4
+ // Shared constants
5
+ // Empty for now - can be extended with framework-wide constants
6
+ /**
7
+ * Mark the attribute as SVG to handle special cases during rendering.
8
+ */
9
+ const SVG_ATTR_FLAG = '__kt_svg__';
10
+ /**
11
+ * Mark the attribute as MathML to handle special cases during rendering.
12
+ */
13
+ const MATHML_ATTR_FLAG = '__kt_mathml__';
14
+ /**
15
+ * Can be if, else, else-if.
16
+ */
17
+ const DIRV_TYPE = Symbol('kt-directive-type');
18
+
4
19
  // Cached native methods for performance optimization
5
20
  const $isArray = Array.isArray;
6
21
  const $ArrayFrom = Array.from;
@@ -12,7 +27,8 @@ var __ktjs_shared__ = (function (exports) {
12
27
  const $defines = Object.defineProperties;
13
28
  const $define = Object.defineProperty;
14
29
  const $entries = Object.entries;
15
- const $isThenable = (o) => typeof o === 'object' && o !== null && typeof o.then === 'function';
30
+ const $random = Math.random;
31
+ const $isThenable = (o) => typeof o?.then === 'function';
16
32
 
17
33
  // Error handling utilities
18
34
  /**
@@ -179,10 +195,14 @@ var __ktjs_shared__ = (function (exports) {
179
195
  return params;
180
196
  };
181
197
 
198
+ if (typeof Symbol === 'undefined') {
199
+ window.Symbol = function Symbol(description) {
200
+ return `@@SYMBOL_${description || ''}_${$random().toString(36).slice(2)}`;
201
+ };
202
+ }
203
+
182
204
  // Shared utilities and cached native methods for kt.js framework
183
- // import './misc/symbol-polyfill.js';
184
- // Re-export all utilities
185
- Object.defineProperty(window, '__ktjs__', { value: '0.22.3' });
205
+ Object.defineProperty(window, '__ktjs__', { value: '0.22.5' });
186
206
 
187
207
  exports.$ArrayFrom = $ArrayFrom;
188
208
  exports.$append = $append;
@@ -200,9 +220,13 @@ var __ktjs_shared__ = (function (exports) {
200
220
  exports.$isNode = $isNode;
201
221
  exports.$isThenable = $isThenable;
202
222
  exports.$keys = $keys;
223
+ exports.$random = $random;
203
224
  exports.$throw = $throw;
204
225
  exports.$toString = $toString;
205
226
  exports.$warn = $warn;
227
+ exports.DIRV_TYPE = DIRV_TYPE;
228
+ exports.MATHML_ATTR_FLAG = MATHML_ATTR_FLAG;
229
+ exports.SVG_ATTR_FLAG = SVG_ATTR_FLAG;
206
230
  exports.applyModel = applyModel;
207
231
  exports.buildQuery = buildQuery;
208
232
  exports.emplaceParams = emplaceParams;
@@ -1,6 +1,21 @@
1
1
  var __ktjs_shared__ = (function (exports) {
2
2
  'use strict';
3
3
 
4
+ // Shared constants
5
+ // Empty for now - can be extended with framework-wide constants
6
+ /**
7
+ * Mark the attribute as SVG to handle special cases during rendering.
8
+ */
9
+ var SVG_ATTR_FLAG = '__kt_svg__';
10
+ /**
11
+ * Mark the attribute as MathML to handle special cases during rendering.
12
+ */
13
+ var MATHML_ATTR_FLAG = '__kt_mathml__';
14
+ /**
15
+ * Can be if, else, else-if.
16
+ */
17
+ var DIRV_TYPE = Symbol('kt-directive-type');
18
+
4
19
  // Cached native methods for performance optimization
5
20
  var $isArray = Array.isArray;
6
21
  var $ArrayFrom = Array.from;
@@ -12,9 +27,8 @@ var __ktjs_shared__ = (function (exports) {
12
27
  var $defines = Object.defineProperties;
13
28
  var $define = Object.defineProperty;
14
29
  var $entries = Object.entries;
15
- var $isThenable = function (o) {
16
- return typeof o === 'object' && o !== null && typeof o.then === 'function';
17
- };
30
+ var $random = Math.random;
31
+ var $isThenable = function (o) { return typeof (o === null || o === void 0 ? void 0 : o.then) === 'function'; };
18
32
 
19
33
  // Error handling utilities
20
34
  /**
@@ -192,10 +206,14 @@ var __ktjs_shared__ = (function (exports) {
192
206
  return params;
193
207
  };
194
208
 
209
+ if (typeof Symbol === 'undefined') {
210
+ window.Symbol = function Symbol(description) {
211
+ return "@@SYMBOL_".concat(description || '', "_").concat($random().toString(36).slice(2));
212
+ };
213
+ }
214
+
195
215
  // Shared utilities and cached native methods for kt.js framework
196
- // import './misc/symbol-polyfill.js';
197
- // Re-export all utilities
198
- Object.defineProperty(window, '__ktjs__', { value: '0.22.3' });
216
+ Object.defineProperty(window, '__ktjs__', { value: '0.22.5' });
199
217
 
200
218
  exports.$ArrayFrom = $ArrayFrom;
201
219
  exports.$append = $append;
@@ -213,9 +231,13 @@ var __ktjs_shared__ = (function (exports) {
213
231
  exports.$isNode = $isNode;
214
232
  exports.$isThenable = $isThenable;
215
233
  exports.$keys = $keys;
234
+ exports.$random = $random;
216
235
  exports.$throw = $throw;
217
236
  exports.$toString = $toString;
218
237
  exports.$warn = $warn;
238
+ exports.DIRV_TYPE = DIRV_TYPE;
239
+ exports.MATHML_ATTR_FLAG = MATHML_ATTR_FLAG;
240
+ exports.SVG_ATTR_FLAG = SVG_ATTR_FLAG;
219
241
  exports.applyModel = applyModel;
220
242
  exports.buildQuery = buildQuery;
221
243
  exports.emplaceParams = emplaceParams;
package/dist/index.mjs CHANGED
@@ -1,3 +1,18 @@
1
+ // Shared constants
2
+ // Empty for now - can be extended with framework-wide constants
3
+ /**
4
+ * Mark the attribute as SVG to handle special cases during rendering.
5
+ */
6
+ const SVG_ATTR_FLAG = '__kt_svg__';
7
+ /**
8
+ * Mark the attribute as MathML to handle special cases during rendering.
9
+ */
10
+ const MATHML_ATTR_FLAG = '__kt_mathml__';
11
+ /**
12
+ * Can be if, else, else-if.
13
+ */
14
+ const DIRV_TYPE = Symbol('kt-directive-type');
15
+
1
16
  // Cached native methods for performance optimization
2
17
  const $isArray = Array.isArray;
3
18
  const $ArrayFrom = Array.from;
@@ -9,7 +24,8 @@ const $keys = Object.keys;
9
24
  const $defines = Object.defineProperties;
10
25
  const $define = Object.defineProperty;
11
26
  const $entries = Object.entries;
12
- const $isThenable = (o) => typeof o === 'object' && o !== null && typeof o.then === 'function';
27
+ const $random = Math.random;
28
+ const $isThenable = (o) => typeof o?.then === 'function';
13
29
 
14
30
  // Error handling utilities
15
31
  /**
@@ -176,9 +192,13 @@ const extractParams = (pattern, path) => {
176
192
  return params;
177
193
  };
178
194
 
195
+ if (typeof Symbol === 'undefined') {
196
+ window.Symbol = function Symbol(description) {
197
+ return `@@SYMBOL_${description || ''}_${$random().toString(36).slice(2)}`;
198
+ };
199
+ }
200
+
179
201
  // Shared utilities and cached native methods for kt.js framework
180
- // import './misc/symbol-polyfill.js';
181
- // Re-export all utilities
182
- Object.defineProperty(window, '__ktjs__', { value: '0.22.3' });
202
+ Object.defineProperty(window, '__ktjs__', { value: '0.22.5' });
183
203
 
184
- export { $ArrayFrom, $append, $appendChild, $assign, $buttonDisabledGetter, $buttonDisabledSetter, $define, $defines, $emptyFn, $entries, $hasOwn, $is, $isArray, $isNode, $isThenable, $keys, $throw, $toString, $warn, applyModel, buildQuery, emplaceParams, extractParams, generateHandler, normalizePath, parseQuery, parseStyle };
204
+ export { $ArrayFrom, $append, $appendChild, $assign, $buttonDisabledGetter, $buttonDisabledSetter, $define, $defines, $emptyFn, $entries, $hasOwn, $is, $isArray, $isNode, $isThenable, $keys, $random, $throw, $toString, $warn, DIRV_TYPE, MATHML_ATTR_FLAG, SVG_ATTR_FLAG, applyModel, buildQuery, emplaceParams, extractParams, generateHandler, normalizePath, parseQuery, parseStyle };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ktjs/shared",
3
- "version": "0.22.3",
3
+ "version": "0.22.5",
4
4
  "description": "Shared utilities and cached native methods for kt.js framework",
5
5
  "type": "module",
6
6
  "module": "./dist/index.mjs",