@ktjs/core 0.15.4 → 0.15.6

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
@@ -98,7 +98,7 @@ interface KTBaseAttribute {
98
98
  title?: string;
99
99
  placeholder?: string;
100
100
  contenteditable?: boolean;
101
- value?: string;
101
+ value?: any;
102
102
  valueAsDate?: Date;
103
103
  valueAsNumber?: number;
104
104
  label?: string;
@@ -116,16 +116,36 @@ interface KTBaseAttribute {
116
116
  }
117
117
 
118
118
  type KTPrefixedEventHandlers = {
119
- [EventName in keyof HTMLElementEventMap as `on:${EventName}`]?: (ev: HTMLElementEventMap[EventName]) => void;
119
+ [EventName in keyof HTMLElementEventMap as `on:${EventName}`]?:
120
+ | ((ev: HTMLElementEventMap[EventName]) => void)
121
+ | (Function & {});
120
122
  };
121
123
 
122
124
  type KTSpecialEventHandlers = {
125
+ /**
126
+ * Directly extract `value` from the input element
127
+ */
123
128
  'on:ktchange'?: (value: string) => void;
129
+ /**
130
+ * Directly extract `value` and trim it
131
+ */
124
132
  'ontrim:ktchange'?: (value: string) => void;
133
+ /**
134
+ * Directly extract `value` and parse it to number
135
+ */
125
136
  'on:ktchangenumber'?: (value: number) => void;
126
137
 
138
+ /**
139
+ * Directly extract `value` from the input element
140
+ */
127
141
  'on:ktinput'?: (value: string) => void;
142
+ /**
143
+ * Directly extract `value` and trim it
144
+ */
128
145
  'ontrim:ktinput'?: (value: string) => void;
146
+ /**
147
+ * Directly extract `value` and parse it to number
148
+ */
129
149
  'on:ktinputnumber'?: (value: number) => void;
130
150
  };
131
151
 
@@ -150,7 +170,7 @@ type HTML<T extends (HTMLTag | SVGTag) & otherstring> = T extends SVGTag ? SVGEl
150
170
  * ## About
151
171
  * @package @ktjs/core
152
172
  * @author Kasukabe Tsumugi <futami16237@gmail.com>
153
- * @version 0.15.4 (Last Update: 2026.01.25 14:47:00.746)
173
+ * @version 0.15.6 (Last Update: 2026.01.27 15:41:57.932)
154
174
  * @license MIT
155
175
  * @link https://github.com/baendlorel/kt.js
156
176
  * @link https://baendlorel.github.io/ Welcome to my site!
@@ -195,7 +195,6 @@ var __ktjs_core__ = (function (exports) {
195
195
  }
196
196
 
197
197
  const defaultCreator = (tag) => document.createElement(tag);
198
- const svgCreator = (tag) => document.createElementNS('http://www.w3.org/2000/svg', tag);
199
198
  let creator = defaultCreator;
200
199
  /**
201
200
  * Create an enhanced HTMLElement.
@@ -207,7 +206,7 @@ var __ktjs_core__ = (function (exports) {
207
206
  * ## About
208
207
  * @package @ktjs/core
209
208
  * @author Kasukabe Tsumugi <futami16237@gmail.com>
210
- * @version 0.15.4 (Last Update: 2026.01.25 14:47:00.746)
209
+ * @version 0.15.6 (Last Update: 2026.01.27 15:41:57.932)
211
210
  * @license MIT
212
211
  * @link https://github.com/baendlorel/kt.js
213
212
  * @link https://baendlorel.github.io/ Welcome to my site!
@@ -218,16 +217,16 @@ var __ktjs_core__ = (function (exports) {
218
217
  if (typeof tag !== 'string') {
219
218
  $throw('tagName must be a string.');
220
219
  }
221
- let lastCreator = creator;
222
- if (tag === 'svg') {
223
- creator = svgCreator;
224
- }
225
220
  // * start creating the element
226
221
  const element = creator(tag);
227
222
  // * Handle content
228
223
  applyAttr(element, attr);
229
224
  applyContent(element, content);
230
- creator = lastCreator; // restore previous creator
225
+ if (tag === 'svg') {
226
+ const div = document.createElement('div');
227
+ div.innerHTML = element.outerHTML;
228
+ return div.firstChild;
229
+ }
231
230
  return element;
232
231
  };
233
232
 
@@ -220,7 +220,6 @@ var __ktjs_core__ = (function (exports) {
220
220
  }
221
221
 
222
222
  var defaultCreator = function (tag) { return document.createElement(tag); };
223
- var svgCreator = function (tag) { return document.createElementNS('http://www.w3.org/2000/svg', tag); };
224
223
  var creator = defaultCreator;
225
224
  /**
226
225
  * Create an enhanced HTMLElement.
@@ -232,7 +231,7 @@ var __ktjs_core__ = (function (exports) {
232
231
  * ## About
233
232
  * @package @ktjs/core
234
233
  * @author Kasukabe Tsumugi <futami16237@gmail.com>
235
- * @version 0.15.4 (Last Update: 2026.01.25 14:47:00.746)
234
+ * @version 0.15.6 (Last Update: 2026.01.27 15:41:57.932)
236
235
  * @license MIT
237
236
  * @link https://github.com/baendlorel/kt.js
238
237
  * @link https://baendlorel.github.io/ Welcome to my site!
@@ -243,16 +242,16 @@ var __ktjs_core__ = (function (exports) {
243
242
  if (typeof tag !== 'string') {
244
243
  $throw('tagName must be a string.');
245
244
  }
246
- var lastCreator = creator;
247
- if (tag === 'svg') {
248
- creator = svgCreator;
249
- }
250
245
  // * start creating the element
251
246
  var element = creator(tag);
252
247
  // * Handle content
253
248
  applyAttr(element, attr);
254
249
  applyContent(element, content);
255
- creator = lastCreator; // restore previous creator
250
+ if (tag === 'svg') {
251
+ var div = document.createElement('div');
252
+ div.innerHTML = element.outerHTML;
253
+ return div.firstChild;
254
+ }
256
255
  return element;
257
256
  };
258
257
 
package/dist/index.mjs CHANGED
@@ -192,7 +192,6 @@ function applyContent(element, content) {
192
192
  }
193
193
 
194
194
  const defaultCreator = (tag) => document.createElement(tag);
195
- const svgCreator = (tag) => document.createElementNS('http://www.w3.org/2000/svg', tag);
196
195
  let creator = defaultCreator;
197
196
  /**
198
197
  * Create an enhanced HTMLElement.
@@ -204,7 +203,7 @@ let creator = defaultCreator;
204
203
  * ## About
205
204
  * @package @ktjs/core
206
205
  * @author Kasukabe Tsumugi <futami16237@gmail.com>
207
- * @version 0.15.4 (Last Update: 2026.01.25 14:47:00.746)
206
+ * @version 0.15.6 (Last Update: 2026.01.27 15:41:57.932)
208
207
  * @license MIT
209
208
  * @link https://github.com/baendlorel/kt.js
210
209
  * @link https://baendlorel.github.io/ Welcome to my site!
@@ -215,16 +214,16 @@ const h = (tag, attr, content) => {
215
214
  if (typeof tag !== 'string') {
216
215
  $throw('tagName must be a string.');
217
216
  }
218
- let lastCreator = creator;
219
- if (tag === 'svg') {
220
- creator = svgCreator;
221
- }
222
217
  // * start creating the element
223
218
  const element = creator(tag);
224
219
  // * Handle content
225
220
  applyAttr(element, attr);
226
221
  applyContent(element, content);
227
- creator = lastCreator; // restore previous creator
222
+ if (tag === 'svg') {
223
+ const div = document.createElement('div');
224
+ div.innerHTML = element.outerHTML;
225
+ return div.firstChild;
226
+ }
228
227
  return element;
229
228
  };
230
229
 
@@ -92,7 +92,7 @@ interface KTBaseAttribute {
92
92
  title?: string;
93
93
  placeholder?: string;
94
94
  contenteditable?: boolean;
95
- value?: string;
95
+ value?: any;
96
96
  valueAsDate?: Date;
97
97
  valueAsNumber?: number;
98
98
  label?: string;
@@ -110,16 +110,36 @@ interface KTBaseAttribute {
110
110
  }
111
111
 
112
112
  type KTPrefixedEventHandlers = {
113
- [EventName in keyof HTMLElementEventMap as `on:${EventName}`]?: (ev: HTMLElementEventMap[EventName]) => void;
113
+ [EventName in keyof HTMLElementEventMap as `on:${EventName}`]?:
114
+ | ((ev: HTMLElementEventMap[EventName]) => void)
115
+ | (Function & {});
114
116
  };
115
117
 
116
118
  type KTSpecialEventHandlers = {
119
+ /**
120
+ * Directly extract `value` from the input element
121
+ */
117
122
  'on:ktchange'?: (value: string) => void;
123
+ /**
124
+ * Directly extract `value` and trim it
125
+ */
118
126
  'ontrim:ktchange'?: (value: string) => void;
127
+ /**
128
+ * Directly extract `value` and parse it to number
129
+ */
119
130
  'on:ktchangenumber'?: (value: number) => void;
120
131
 
132
+ /**
133
+ * Directly extract `value` from the input element
134
+ */
121
135
  'on:ktinput'?: (value: string) => void;
136
+ /**
137
+ * Directly extract `value` and trim it
138
+ */
122
139
  'ontrim:ktinput'?: (value: string) => void;
140
+ /**
141
+ * Directly extract `value` and parse it to number
142
+ */
123
143
  'on:ktinputnumber'?: (value: number) => void;
124
144
  };
125
145
 
@@ -136,7 +156,7 @@ type HTML<T extends (HTMLTag | SVGTag) & otherstring> = T extends SVGTag ? SVGEl
136
156
  * ## About
137
157
  * @package @ktjs/core
138
158
  * @author Kasukabe Tsumugi <futami16237@gmail.com>
139
- * @version 0.15.4 (Last Update: 2026.01.25 14:47:00.746)
159
+ * @version 0.15.6 (Last Update: 2026.01.27 15:41:57.932)
140
160
  * @license MIT
141
161
  * @link https://github.com/baendlorel/kt.js
142
162
  * @link https://baendlorel.github.io/ Welcome to my site!
@@ -192,7 +192,6 @@ function applyContent(element, content) {
192
192
  }
193
193
 
194
194
  const defaultCreator = (tag) => document.createElement(tag);
195
- const svgCreator = (tag) => document.createElementNS('http://www.w3.org/2000/svg', tag);
196
195
  let creator = defaultCreator;
197
196
  /**
198
197
  * Create an enhanced HTMLElement.
@@ -204,7 +203,7 @@ let creator = defaultCreator;
204
203
  * ## About
205
204
  * @package @ktjs/core
206
205
  * @author Kasukabe Tsumugi <futami16237@gmail.com>
207
- * @version 0.15.4 (Last Update: 2026.01.25 14:47:00.746)
206
+ * @version 0.15.6 (Last Update: 2026.01.27 15:41:57.932)
208
207
  * @license MIT
209
208
  * @link https://github.com/baendlorel/kt.js
210
209
  * @link https://baendlorel.github.io/ Welcome to my site!
@@ -215,16 +214,16 @@ const h = (tag, attr, content) => {
215
214
  if (typeof tag !== 'string') {
216
215
  $throw('tagName must be a string.');
217
216
  }
218
- let lastCreator = creator;
219
- if (tag === 'svg') {
220
- creator = svgCreator;
221
- }
222
217
  // * start creating the element
223
218
  const element = creator(tag);
224
219
  // * Handle content
225
220
  applyAttr(element, attr);
226
221
  applyContent(element, content);
227
- creator = lastCreator; // restore previous creator
222
+ if (tag === 'svg') {
223
+ const div = document.createElement('div');
224
+ div.innerHTML = element.outerHTML;
225
+ return div.firstChild;
226
+ }
228
227
  return element;
229
228
  };
230
229
 
@@ -86,7 +86,7 @@ interface KTBaseAttribute {
86
86
  title?: string;
87
87
  placeholder?: string;
88
88
  contenteditable?: boolean;
89
- value?: string;
89
+ value?: any;
90
90
  valueAsDate?: Date;
91
91
  valueAsNumber?: number;
92
92
  label?: string;
@@ -104,16 +104,36 @@ interface KTBaseAttribute {
104
104
  }
105
105
 
106
106
  type KTPrefixedEventHandlers = {
107
- [EventName in keyof HTMLElementEventMap as `on:${EventName}`]?: (ev: HTMLElementEventMap[EventName]) => void;
107
+ [EventName in keyof HTMLElementEventMap as `on:${EventName}`]?:
108
+ | ((ev: HTMLElementEventMap[EventName]) => void)
109
+ | (Function & {});
108
110
  };
109
111
 
110
112
  type KTSpecialEventHandlers = {
113
+ /**
114
+ * Directly extract `value` from the input element
115
+ */
111
116
  'on:ktchange'?: (value: string) => void;
117
+ /**
118
+ * Directly extract `value` and trim it
119
+ */
112
120
  'ontrim:ktchange'?: (value: string) => void;
121
+ /**
122
+ * Directly extract `value` and parse it to number
123
+ */
113
124
  'on:ktchangenumber'?: (value: number) => void;
114
125
 
126
+ /**
127
+ * Directly extract `value` from the input element
128
+ */
115
129
  'on:ktinput'?: (value: string) => void;
130
+ /**
131
+ * Directly extract `value` and trim it
132
+ */
116
133
  'ontrim:ktinput'?: (value: string) => void;
134
+ /**
135
+ * Directly extract `value` and parse it to number
136
+ */
117
137
  'on:ktinputnumber'?: (value: number) => void;
118
138
  };
119
139
 
@@ -130,7 +150,7 @@ type HTML<T extends (HTMLTag | SVGTag) & otherstring> = T extends SVGTag ? SVGEl
130
150
  * ## About
131
151
  * @package @ktjs/core
132
152
  * @author Kasukabe Tsumugi <futami16237@gmail.com>
133
- * @version 0.15.4 (Last Update: 2026.01.25 14:47:00.746)
153
+ * @version 0.15.6 (Last Update: 2026.01.27 15:41:57.932)
134
154
  * @license MIT
135
155
  * @link https://github.com/baendlorel/kt.js
136
156
  * @link https://baendlorel.github.io/ Welcome to my site!
@@ -192,7 +192,6 @@ function applyContent(element, content) {
192
192
  }
193
193
 
194
194
  const defaultCreator = (tag) => document.createElement(tag);
195
- const svgCreator = (tag) => document.createElementNS('http://www.w3.org/2000/svg', tag);
196
195
  let creator = defaultCreator;
197
196
  /**
198
197
  * Create an enhanced HTMLElement.
@@ -204,7 +203,7 @@ let creator = defaultCreator;
204
203
  * ## About
205
204
  * @package @ktjs/core
206
205
  * @author Kasukabe Tsumugi <futami16237@gmail.com>
207
- * @version 0.15.4 (Last Update: 2026.01.25 14:47:00.746)
206
+ * @version 0.15.6 (Last Update: 2026.01.27 15:41:57.932)
208
207
  * @license MIT
209
208
  * @link https://github.com/baendlorel/kt.js
210
209
  * @link https://baendlorel.github.io/ Welcome to my site!
@@ -215,16 +214,16 @@ const h = (tag, attr, content) => {
215
214
  if (typeof tag !== 'string') {
216
215
  $throw('tagName must be a string.');
217
216
  }
218
- let lastCreator = creator;
219
- if (tag === 'svg') {
220
- creator = svgCreator;
221
- }
222
217
  // * start creating the element
223
218
  const element = creator(tag);
224
219
  // * Handle content
225
220
  applyAttr(element, attr);
226
221
  applyContent(element, content);
227
- creator = lastCreator; // restore previous creator
222
+ if (tag === 'svg') {
223
+ const div = document.createElement('div');
224
+ div.innerHTML = element.outerHTML;
225
+ return div.firstChild;
226
+ }
228
227
  return element;
229
228
  };
230
229
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ktjs/core",
3
- "version": "0.15.4",
3
+ "version": "0.15.6",
4
4
  "description": "Core functionality for kt.js - DOM manipulation utilities with JSX/TSX support",
5
5
  "type": "module",
6
6
  "module": "./dist/index.mjs",