@ktjs/core 0.8.2 → 0.8.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
@@ -22,14 +22,13 @@ type otherstring = string & {};
22
22
  */
23
23
  type HTMLTag = keyof HTMLElementTagNameMap & otherstring;
24
24
 
25
- declare class Ref<T> {
25
+ interface KTRef<T> {
26
26
  value: T;
27
- update: () => T;
28
- constructor(value: T);
27
+ isKT: true;
29
28
  }
30
- declare function ref<T>(value?: T): Ref<T>;
29
+ declare function ref<T>(value?: T): KTRef<T>;
31
30
 
32
- type Ctt = Ref<any> | HTMLElement | string | number | undefined;
31
+ type Ctt = KTRef<any> | HTMLElement | string | number | undefined;
33
32
  type KTRawContent = Ctt[] | Ctt;
34
33
  type KTRawAttr = KTAttribute | string;
35
34
  type KTRawContents = (HTMLElement | string | undefined)[];
@@ -100,6 +99,10 @@ type KTPrefixedEventHandlers = {
100
99
  type KTAttribute = KTBaseAttribute & KTPrefixedEventHandlers;
101
100
 
102
101
  type HTML<T extends HTMLTag & otherstring> = T extends HTMLTag ? HTMLElementTagNameMap[T] : HTMLElement;
102
+ type H = (<T extends HTMLTag>(tag: T, attr?: KTRawAttr, content?: KTRawContent) => HTML<T>) & {
103
+ kDepth: number;
104
+ kUpdater: (() => void)[];
105
+ };
103
106
  /**
104
107
  * Create an enhanced HTMLElement.
105
108
  * - Only supports HTMLElements, **NOT** SVGElements or other Elements.
@@ -110,14 +113,14 @@ type HTML<T extends HTMLTag & otherstring> = T extends HTMLTag ? HTMLElementTagN
110
113
  * ## About
111
114
  * @package @ktjs/core
112
115
  * @author Kasukabe Tsumugi <futami16237@gmail.com>
113
- * @version 0.8.2 (Last Update: 2025.12.25 11:17:07.762)
116
+ * @version 0.8.5 (Last Update: 2025.12.29 10:16:21.619)
114
117
  * @license MIT
115
118
  * @link https://github.com/baendlorel/kt.js
116
119
  * @link https://baendlorel.github.io/ Welcome to my site!
117
120
  * @description Core functionality for kt.js - DOM manipulation utilities with JSX/TSX support
118
121
  * @copyright Copyright (c) 2025 Kasukabe Tsumugi. All rights reserved.
119
122
  */
120
- declare const h: <T extends HTMLTag>(tag: T, attr?: KTRawAttr, content?: KTRawContent) => HTML<T>;
123
+ declare const h: H;
121
124
 
122
125
  /**
123
126
  * @param tag html tag
@@ -161,5 +164,5 @@ declare global {
161
164
  }
162
165
  }
163
166
 
164
- export { Fragment, Ref, h as createElement, h, jsx, jsxDEV, jsxs, ktnull, ref };
165
- export type { EventHandler, HTMLTag, KTAttribute, KTRawAttr, KTRawContent, KTRawContents, KTRuntime };
167
+ export { Fragment, h as createElement, h, jsx, jsxDEV, jsxs, ktnull, ref };
168
+ export type { EventHandler, HTMLTag, KTAttribute, KTRawAttr, KTRawContent, KTRawContents, KTRef, KTRuntime };
@@ -175,38 +175,22 @@ var __ktjs_core__ = (function (exports) {
175
175
  }
176
176
  }
177
177
 
178
- const noop = () => ({});
179
- class Ref {
180
- value;
181
- update;
182
- constructor(value) {
183
- this.value = value;
184
- this.update = noop;
178
+ function apd(element, content) {
179
+ if (content && content.isKT) {
180
+ $append.call(element, content.value);
181
+ }
182
+ else {
183
+ $append.call(element, content);
185
184
  }
186
185
  }
187
- function ref(value) {
188
- return new Ref(value);
189
- }
190
-
191
186
  function applyContent(element, content) {
192
187
  if ($isArray(content)) {
193
188
  for (let i = 0; i < content.length; i++) {
194
- let c = content[i];
195
- if (c instanceof Ref) {
196
- $append.call(element, c.value);
197
- }
198
- else {
199
- $append.call(element, c);
200
- }
189
+ apd(element, content[i]);
201
190
  }
202
191
  }
203
192
  else {
204
- if (content instanceof Ref) {
205
- $append.call(element, content.value);
206
- }
207
- else {
208
- $append.call(element, content);
209
- }
193
+ apd(element, content);
210
194
  }
211
195
  }
212
196
 
@@ -220,14 +204,14 @@ var __ktjs_core__ = (function (exports) {
220
204
  * ## About
221
205
  * @package @ktjs/core
222
206
  * @author Kasukabe Tsumugi <futami16237@gmail.com>
223
- * @version 0.8.2 (Last Update: 2025.12.25 11:17:07.762)
207
+ * @version 0.8.5 (Last Update: 2025.12.29 10:16:21.619)
224
208
  * @license MIT
225
209
  * @link https://github.com/baendlorel/kt.js
226
210
  * @link https://baendlorel.github.io/ Welcome to my site!
227
211
  * @description Core functionality for kt.js - DOM manipulation utilities with JSX/TSX support
228
212
  * @copyright Copyright (c) 2025 Kasukabe Tsumugi. All rights reserved.
229
213
  */
230
- const h = (tag, attr = '', content = '') => {
214
+ const h = ((tag, attr = '', content = '') => {
231
215
  if (typeof tag !== 'string') {
232
216
  $throw('__func__ tagName must be a string.');
233
217
  }
@@ -237,7 +221,7 @@ var __ktjs_core__ = (function (exports) {
237
221
  applyAttr(element, attr);
238
222
  applyContent(element, content);
239
223
  return element;
240
- };
224
+ });
241
225
  $mark(h, 'h');
242
226
 
243
227
  /**
@@ -253,19 +237,13 @@ var __ktjs_core__ = (function (exports) {
253
237
  const children = propObj.children;
254
238
  delete propObj.children;
255
239
  // deal with ref attribute
256
- const ref = 'ref' in propObj && propObj.ref instanceof Ref ? propObj.ref : null;
240
+ const ref = propObj.ref?.isRef ? propObj.ref : null;
257
241
  if (ref) {
258
242
  delete propObj.ref;
259
243
  }
260
244
  const el = h(tag, propObj, children);
261
245
  if (ref) {
262
246
  ref.value = el;
263
- ref.update = () => {
264
- const old = ref.value;
265
- ref.value = h(tag, propObj, children);
266
- old.replaceWith(ref.value);
267
- return ref.value;
268
- };
269
247
  }
270
248
  return el;
271
249
  }
@@ -313,8 +291,11 @@ var __ktjs_core__ = (function (exports) {
313
291
  */
314
292
  const jsxs = jsx;
315
293
 
294
+ function ref(value) {
295
+ return { value: value, isKT: true };
296
+ }
297
+
316
298
  exports.Fragment = Fragment;
317
- exports.Ref = Ref;
318
299
  exports.createElement = h;
319
300
  exports.h = h;
320
301
  exports.jsx = jsx;
@@ -186,37 +186,22 @@ var __ktjs_core__ = (function (exports) {
186
186
  }
187
187
  }
188
188
 
189
- var noop = function () { return ({}); };
190
- var Ref = /** @class */ (function () {
191
- function Ref(value) {
192
- this.value = value;
193
- this.update = noop;
189
+ function apd(element, content) {
190
+ if (content && content.isKT) {
191
+ $append.call(element, content.value);
192
+ }
193
+ else {
194
+ $append.call(element, content);
194
195
  }
195
- return Ref;
196
- }());
197
- function ref(value) {
198
- return new Ref(value);
199
196
  }
200
-
201
197
  function applyContent(element, content) {
202
198
  if ($isArray(content)) {
203
199
  for (var i = 0; i < content.length; i++) {
204
- var c = content[i];
205
- if (c instanceof Ref) {
206
- $append.call(element, c.value);
207
- }
208
- else {
209
- $append.call(element, c);
210
- }
200
+ apd(element, content[i]);
211
201
  }
212
202
  }
213
203
  else {
214
- if (content instanceof Ref) {
215
- $append.call(element, content.value);
216
- }
217
- else {
218
- $append.call(element, content);
219
- }
204
+ apd(element, content);
220
205
  }
221
206
  }
222
207
 
@@ -230,14 +215,14 @@ var __ktjs_core__ = (function (exports) {
230
215
  * ## About
231
216
  * @package @ktjs/core
232
217
  * @author Kasukabe Tsumugi <futami16237@gmail.com>
233
- * @version 0.8.2 (Last Update: 2025.12.25 11:17:07.762)
218
+ * @version 0.8.5 (Last Update: 2025.12.29 10:16:21.619)
234
219
  * @license MIT
235
220
  * @link https://github.com/baendlorel/kt.js
236
221
  * @link https://baendlorel.github.io/ Welcome to my site!
237
222
  * @description Core functionality for kt.js - DOM manipulation utilities with JSX/TSX support
238
223
  * @copyright Copyright (c) 2025 Kasukabe Tsumugi. All rights reserved.
239
224
  */
240
- var h = function (tag, attr, content) {
225
+ var h = (function (tag, attr, content) {
241
226
  if (attr === void 0) { attr = ''; }
242
227
  if (content === void 0) { content = ''; }
243
228
  if (typeof tag !== 'string') {
@@ -249,7 +234,7 @@ var __ktjs_core__ = (function (exports) {
249
234
  applyAttr(element, attr);
250
235
  applyContent(element, content);
251
236
  return element;
252
- };
237
+ });
253
238
  $mark(h, 'h');
254
239
 
255
240
  /******************************************************************************
@@ -290,6 +275,7 @@ var __ktjs_core__ = (function (exports) {
290
275
  * @param _metadata metadata is ignored
291
276
  */
292
277
  function jsx(tag, props) {
278
+ var _a;
293
279
  var propObj = typeof props === 'string' ? { class: props } : props;
294
280
  if (propObj === undefined || propObj === null) {
295
281
  return h(tag);
@@ -297,19 +283,13 @@ var __ktjs_core__ = (function (exports) {
297
283
  var children = propObj.children;
298
284
  delete propObj.children;
299
285
  // deal with ref attribute
300
- var ref = 'ref' in propObj && propObj.ref instanceof Ref ? propObj.ref : null;
286
+ var ref = ((_a = propObj.ref) === null || _a === void 0 ? void 0 : _a.isRef) ? propObj.ref : null;
301
287
  if (ref) {
302
288
  delete propObj.ref;
303
289
  }
304
290
  var el = h(tag, propObj, children);
305
291
  if (ref) {
306
292
  ref.value = el;
307
- ref.update = function () {
308
- var old = ref.value;
309
- ref.value = h(tag, propObj, children);
310
- old.replaceWith(ref.value);
311
- return ref.value;
312
- };
313
293
  }
314
294
  return el;
315
295
  }
@@ -362,8 +342,11 @@ var __ktjs_core__ = (function (exports) {
362
342
  */
363
343
  var jsxs = jsx;
364
344
 
345
+ function ref(value) {
346
+ return { value: value, isKT: true };
347
+ }
348
+
365
349
  exports.Fragment = Fragment;
366
- exports.Ref = Ref;
367
350
  exports.createElement = h;
368
351
  exports.h = h;
369
352
  exports.jsx = jsx;
package/dist/index.mjs CHANGED
@@ -172,38 +172,22 @@ function applyAttr(element, attr) {
172
172
  }
173
173
  }
174
174
 
175
- const noop = () => ({});
176
- class Ref {
177
- value;
178
- update;
179
- constructor(value) {
180
- this.value = value;
181
- this.update = noop;
175
+ function apd(element, content) {
176
+ if (content && content.isKT) {
177
+ $append.call(element, content.value);
178
+ }
179
+ else {
180
+ $append.call(element, content);
182
181
  }
183
182
  }
184
- function ref(value) {
185
- return new Ref(value);
186
- }
187
-
188
183
  function applyContent(element, content) {
189
184
  if ($isArray(content)) {
190
185
  for (let i = 0; i < content.length; i++) {
191
- let c = content[i];
192
- if (c instanceof Ref) {
193
- $append.call(element, c.value);
194
- }
195
- else {
196
- $append.call(element, c);
197
- }
186
+ apd(element, content[i]);
198
187
  }
199
188
  }
200
189
  else {
201
- if (content instanceof Ref) {
202
- $append.call(element, content.value);
203
- }
204
- else {
205
- $append.call(element, content);
206
- }
190
+ apd(element, content);
207
191
  }
208
192
  }
209
193
 
@@ -217,14 +201,14 @@ function applyContent(element, content) {
217
201
  * ## About
218
202
  * @package @ktjs/core
219
203
  * @author Kasukabe Tsumugi <futami16237@gmail.com>
220
- * @version 0.8.2 (Last Update: 2025.12.25 11:17:07.762)
204
+ * @version 0.8.5 (Last Update: 2025.12.29 10:16:21.619)
221
205
  * @license MIT
222
206
  * @link https://github.com/baendlorel/kt.js
223
207
  * @link https://baendlorel.github.io/ Welcome to my site!
224
208
  * @description Core functionality for kt.js - DOM manipulation utilities with JSX/TSX support
225
209
  * @copyright Copyright (c) 2025 Kasukabe Tsumugi. All rights reserved.
226
210
  */
227
- const h = (tag, attr = '', content = '') => {
211
+ const h = ((tag, attr = '', content = '') => {
228
212
  if (typeof tag !== 'string') {
229
213
  $throw('__func__ tagName must be a string.');
230
214
  }
@@ -234,7 +218,7 @@ const h = (tag, attr = '', content = '') => {
234
218
  applyAttr(element, attr);
235
219
  applyContent(element, content);
236
220
  return element;
237
- };
221
+ });
238
222
  $mark(h, 'h');
239
223
 
240
224
  /**
@@ -250,19 +234,13 @@ function jsx(tag, props, ..._metadata) {
250
234
  const children = propObj.children;
251
235
  delete propObj.children;
252
236
  // deal with ref attribute
253
- const ref = 'ref' in propObj && propObj.ref instanceof Ref ? propObj.ref : null;
237
+ const ref = propObj.ref?.isRef ? propObj.ref : null;
254
238
  if (ref) {
255
239
  delete propObj.ref;
256
240
  }
257
241
  const el = h(tag, propObj, children);
258
242
  if (ref) {
259
243
  ref.value = el;
260
- ref.update = () => {
261
- const old = ref.value;
262
- ref.value = h(tag, propObj, children);
263
- old.replaceWith(ref.value);
264
- return ref.value;
265
- };
266
244
  }
267
245
  return el;
268
246
  }
@@ -310,4 +288,8 @@ const jsxDEV = (...args) => {
310
288
  */
311
289
  const jsxs = jsx;
312
290
 
313
- export { Fragment, Ref, h as createElement, h, jsx, jsxDEV, jsxs, ktnull, ref };
291
+ function ref(value) {
292
+ return { value: value, isKT: true };
293
+ }
294
+
295
+ export { Fragment, h as createElement, h, jsx, jsxDEV, jsxs, ktnull, ref };
@@ -5,14 +5,13 @@ type otherstring = string & {};
5
5
  */
6
6
  type HTMLTag = keyof HTMLElementTagNameMap & otherstring;
7
7
 
8
- declare class Ref<T> {
8
+ interface KTRef<T> {
9
9
  value: T;
10
- update: () => T;
11
- constructor(value: T);
10
+ isKT: true;
12
11
  }
13
- declare function ref<T>(value?: T): Ref<T>;
12
+ declare function ref<T>(value?: T): KTRef<T>;
14
13
 
15
- type Ctt = Ref<any> | HTMLElement | string | number | undefined;
14
+ type Ctt = KTRef<any> | HTMLElement | string | number | undefined;
16
15
  type KTRawContent = Ctt[] | Ctt;
17
16
  type KTRawAttr = KTAttribute | string;
18
17
 
@@ -77,6 +76,10 @@ type KTPrefixedEventHandlers = {
77
76
  type KTAttribute = KTBaseAttribute & KTPrefixedEventHandlers;
78
77
 
79
78
  type HTML<T extends HTMLTag & otherstring> = T extends HTMLTag ? HTMLElementTagNameMap[T] : HTMLElement;
79
+ type H = (<T extends HTMLTag>(tag: T, attr?: KTRawAttr, content?: KTRawContent) => HTML<T>) & {
80
+ kDepth: number;
81
+ kUpdater: (() => void)[];
82
+ };
80
83
  /**
81
84
  * Create an enhanced HTMLElement.
82
85
  * - Only supports HTMLElements, **NOT** SVGElements or other Elements.
@@ -87,14 +90,14 @@ type HTML<T extends HTMLTag & otherstring> = T extends HTMLTag ? HTMLElementTagN
87
90
  * ## About
88
91
  * @package @ktjs/core
89
92
  * @author Kasukabe Tsumugi <futami16237@gmail.com>
90
- * @version 0.8.2 (Last Update: 2025.12.25 11:17:07.762)
93
+ * @version 0.8.5 (Last Update: 2025.12.29 10:16:21.619)
91
94
  * @license MIT
92
95
  * @link https://github.com/baendlorel/kt.js
93
96
  * @link https://baendlorel.github.io/ Welcome to my site!
94
97
  * @description Core functionality for kt.js - DOM manipulation utilities with JSX/TSX support
95
98
  * @copyright Copyright (c) 2025 Kasukabe Tsumugi. All rights reserved.
96
99
  */
97
- declare const h: <T extends HTMLTag>(tag: T, attr?: KTRawAttr, content?: KTRawContent) => HTML<T>;
100
+ declare const h: H;
98
101
 
99
102
  /**
100
103
  * This is a `falsy` value used to indicate "no node" in `h` function.
@@ -126,4 +129,23 @@ declare const jsxDEV: typeof jsx;
126
129
  */
127
130
  declare const jsxs: typeof jsx;
128
131
 
129
- export { Fragment, Ref, h as createElement, jsx, jsxDEV, jsxs, ref };
132
+ declare global {
133
+ namespace JSX {
134
+ type Element = HTMLElementTagNameMap[keyof HTMLElementTagNameMap];
135
+
136
+ interface IntrinsicElements {
137
+ [tag: string]: KTAttribute & { children?: KTRawContent };
138
+ }
139
+
140
+ interface IntrinsicAttributes {
141
+ key?: string | number;
142
+ }
143
+
144
+ interface ElementChildrenAttribute {
145
+ children: {};
146
+ }
147
+ }
148
+ }
149
+
150
+ export { Fragment, h as createElement, jsx, jsxDEV, jsxs, ref };
151
+ export type { KTRef };
@@ -155,38 +155,22 @@ function applyAttr(element, attr) {
155
155
  }
156
156
  }
157
157
 
158
- const noop = () => ({});
159
- class Ref {
160
- value;
161
- update;
162
- constructor(value) {
163
- this.value = value;
164
- this.update = noop;
158
+ function apd(element, content) {
159
+ if (content && content.isKT) {
160
+ $append.call(element, content.value);
161
+ }
162
+ else {
163
+ $append.call(element, content);
165
164
  }
166
165
  }
167
- function ref(value) {
168
- return new Ref(value);
169
- }
170
-
171
166
  function applyContent(element, content) {
172
167
  if ($isArray(content)) {
173
168
  for (let i = 0; i < content.length; i++) {
174
- let c = content[i];
175
- if (c instanceof Ref) {
176
- $append.call(element, c.value);
177
- }
178
- else {
179
- $append.call(element, c);
180
- }
169
+ apd(element, content[i]);
181
170
  }
182
171
  }
183
172
  else {
184
- if (content instanceof Ref) {
185
- $append.call(element, content.value);
186
- }
187
- else {
188
- $append.call(element, content);
189
- }
173
+ apd(element, content);
190
174
  }
191
175
  }
192
176
 
@@ -200,14 +184,14 @@ function applyContent(element, content) {
200
184
  * ## About
201
185
  * @package @ktjs/core
202
186
  * @author Kasukabe Tsumugi <futami16237@gmail.com>
203
- * @version 0.8.2 (Last Update: 2025.12.25 11:17:07.762)
187
+ * @version 0.8.5 (Last Update: 2025.12.29 10:16:21.619)
204
188
  * @license MIT
205
189
  * @link https://github.com/baendlorel/kt.js
206
190
  * @link https://baendlorel.github.io/ Welcome to my site!
207
191
  * @description Core functionality for kt.js - DOM manipulation utilities with JSX/TSX support
208
192
  * @copyright Copyright (c) 2025 Kasukabe Tsumugi. All rights reserved.
209
193
  */
210
- const h = (tag, attr = '', content = '') => {
194
+ const h = ((tag, attr = '', content = '') => {
211
195
  if (typeof tag !== 'string') {
212
196
  $throw('__func__ tagName must be a string.');
213
197
  }
@@ -217,7 +201,7 @@ const h = (tag, attr = '', content = '') => {
217
201
  applyAttr(element, attr);
218
202
  applyContent(element, content);
219
203
  return element;
220
- };
204
+ });
221
205
  $mark(h, 'h');
222
206
 
223
207
  /**
@@ -233,19 +217,13 @@ function jsx(tag, props, ..._metadata) {
233
217
  const children = propObj.children;
234
218
  delete propObj.children;
235
219
  // deal with ref attribute
236
- const ref = 'ref' in propObj && propObj.ref instanceof Ref ? propObj.ref : null;
220
+ const ref = propObj.ref?.isRef ? propObj.ref : null;
237
221
  if (ref) {
238
222
  delete propObj.ref;
239
223
  }
240
224
  const el = h(tag, propObj, children);
241
225
  if (ref) {
242
226
  ref.value = el;
243
- ref.update = () => {
244
- const old = ref.value;
245
- ref.value = h(tag, propObj, children);
246
- old.replaceWith(ref.value);
247
- return ref.value;
248
- };
249
227
  }
250
228
  return el;
251
229
  }
@@ -293,4 +271,8 @@ const jsxDEV = (...args) => {
293
271
  */
294
272
  const jsxs = jsx;
295
273
 
296
- export { Fragment, Ref, h as createElement, jsx, jsxDEV, jsxs, ref };
274
+ function ref(value) {
275
+ return { value: value, isKT: true };
276
+ }
277
+
278
+ export { Fragment, h as createElement, jsx, jsxDEV, jsxs, ref };
@@ -5,13 +5,12 @@ type otherstring = string & {};
5
5
  */
6
6
  type HTMLTag = keyof HTMLElementTagNameMap & otherstring;
7
7
 
8
- declare class Ref<T> {
8
+ interface KTRef<T> {
9
9
  value: T;
10
- update: () => T;
11
- constructor(value: T);
10
+ isKT: true;
12
11
  }
13
12
 
14
- type Ctt = Ref<any> | HTMLElement | string | number | undefined;
13
+ type Ctt = KTRef<any> | HTMLElement | string | number | undefined;
15
14
  type KTRawContent = Ctt[] | Ctt;
16
15
  type KTRawAttr = KTAttribute | string;
17
16
 
@@ -76,6 +75,10 @@ type KTPrefixedEventHandlers = {
76
75
  type KTAttribute = KTBaseAttribute & KTPrefixedEventHandlers;
77
76
 
78
77
  type HTML<T extends HTMLTag & otherstring> = T extends HTMLTag ? HTMLElementTagNameMap[T] : HTMLElement;
78
+ type H = (<T extends HTMLTag>(tag: T, attr?: KTRawAttr, content?: KTRawContent) => HTML<T>) & {
79
+ kDepth: number;
80
+ kUpdater: (() => void)[];
81
+ };
79
82
  /**
80
83
  * Create an enhanced HTMLElement.
81
84
  * - Only supports HTMLElements, **NOT** SVGElements or other Elements.
@@ -86,14 +89,14 @@ type HTML<T extends HTMLTag & otherstring> = T extends HTMLTag ? HTMLElementTagN
86
89
  * ## About
87
90
  * @package @ktjs/core
88
91
  * @author Kasukabe Tsumugi <futami16237@gmail.com>
89
- * @version 0.8.2 (Last Update: 2025.12.25 11:17:07.762)
92
+ * @version 0.8.5 (Last Update: 2025.12.29 10:16:21.619)
90
93
  * @license MIT
91
94
  * @link https://github.com/baendlorel/kt.js
92
95
  * @link https://baendlorel.github.io/ Welcome to my site!
93
96
  * @description Core functionality for kt.js - DOM manipulation utilities with JSX/TSX support
94
97
  * @copyright Copyright (c) 2025 Kasukabe Tsumugi. All rights reserved.
95
98
  */
96
- declare const h: <T extends HTMLTag>(tag: T, attr?: KTRawAttr, content?: KTRawContent) => HTML<T>;
99
+ declare const h: H;
97
100
 
98
101
  /**
99
102
  * This is a `falsy` value used to indicate "no node" in `h` function.
@@ -155,35 +155,22 @@ function applyAttr(element, attr) {
155
155
  }
156
156
  }
157
157
 
158
- const noop = () => ({});
159
- class Ref {
160
- value;
161
- update;
162
- constructor(value) {
163
- this.value = value;
164
- this.update = noop;
158
+ function apd(element, content) {
159
+ if (content && content.isKT) {
160
+ $append.call(element, content.value);
161
+ }
162
+ else {
163
+ $append.call(element, content);
165
164
  }
166
165
  }
167
-
168
166
  function applyContent(element, content) {
169
167
  if ($isArray(content)) {
170
168
  for (let i = 0; i < content.length; i++) {
171
- let c = content[i];
172
- if (c instanceof Ref) {
173
- $append.call(element, c.value);
174
- }
175
- else {
176
- $append.call(element, c);
177
- }
169
+ apd(element, content[i]);
178
170
  }
179
171
  }
180
172
  else {
181
- if (content instanceof Ref) {
182
- $append.call(element, content.value);
183
- }
184
- else {
185
- $append.call(element, content);
186
- }
173
+ apd(element, content);
187
174
  }
188
175
  }
189
176
 
@@ -197,14 +184,14 @@ function applyContent(element, content) {
197
184
  * ## About
198
185
  * @package @ktjs/core
199
186
  * @author Kasukabe Tsumugi <futami16237@gmail.com>
200
- * @version 0.8.2 (Last Update: 2025.12.25 11:17:07.762)
187
+ * @version 0.8.5 (Last Update: 2025.12.29 10:16:21.619)
201
188
  * @license MIT
202
189
  * @link https://github.com/baendlorel/kt.js
203
190
  * @link https://baendlorel.github.io/ Welcome to my site!
204
191
  * @description Core functionality for kt.js - DOM manipulation utilities with JSX/TSX support
205
192
  * @copyright Copyright (c) 2025 Kasukabe Tsumugi. All rights reserved.
206
193
  */
207
- const h = (tag, attr = '', content = '') => {
194
+ const h = ((tag, attr = '', content = '') => {
208
195
  if (typeof tag !== 'string') {
209
196
  $throw('__func__ tagName must be a string.');
210
197
  }
@@ -214,7 +201,7 @@ const h = (tag, attr = '', content = '') => {
214
201
  applyAttr(element, attr);
215
202
  applyContent(element, content);
216
203
  return element;
217
- };
204
+ });
218
205
  $mark(h, 'h');
219
206
 
220
207
  /**
@@ -230,19 +217,13 @@ function jsx(tag, props, ..._metadata) {
230
217
  const children = propObj.children;
231
218
  delete propObj.children;
232
219
  // deal with ref attribute
233
- const ref = 'ref' in propObj && propObj.ref instanceof Ref ? propObj.ref : null;
220
+ const ref = propObj.ref?.isRef ? propObj.ref : null;
234
221
  if (ref) {
235
222
  delete propObj.ref;
236
223
  }
237
224
  const el = h(tag, propObj, children);
238
225
  if (ref) {
239
226
  ref.value = el;
240
- ref.update = () => {
241
- const old = ref.value;
242
- ref.value = h(tag, propObj, children);
243
- old.replaceWith(ref.value);
244
- return ref.value;
245
- };
246
227
  }
247
228
  return el;
248
229
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ktjs/core",
3
- "version": "0.8.2",
3
+ "version": "0.8.5",
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",