@ktjs/core 0.14.1 → 0.14.3
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 +19 -3
- package/dist/index.iife.js +30 -1
- package/dist/index.legacy.js +30 -1
- package/dist/index.mjs +30 -2
- package/dist/jsx/index.d.ts +19 -3
- package/dist/jsx/index.mjs +30 -2
- package/dist/jsx/jsx-runtime.d.ts +2 -2
- package/dist/jsx/jsx-runtime.mjs +4 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -21,7 +21,7 @@ type KTHTMLElement = HTMLElement & {
|
|
|
21
21
|
* Automically generate a redraw function if it is not provided
|
|
22
22
|
* @param props
|
|
23
23
|
*/
|
|
24
|
-
redraw: (props?: KTAttribute, children?: KTRawContent) =>
|
|
24
|
+
redraw: (props?: KTAttribute, children?: KTRawContent) => KTHTMLElement;
|
|
25
25
|
};
|
|
26
26
|
|
|
27
27
|
declare global {
|
|
@@ -161,7 +161,7 @@ type H = (<T extends HTMLTag>(tag: T, attr?: KTRawAttr, content?: KTRawContent)
|
|
|
161
161
|
* ## About
|
|
162
162
|
* @package @ktjs/core
|
|
163
163
|
* @author Kasukabe Tsumugi <futami16237@gmail.com>
|
|
164
|
-
* @version 0.14.
|
|
164
|
+
* @version 0.14.3 (Last Update: 2026.01.16 22:28:22.311)
|
|
165
165
|
* @license MIT
|
|
166
166
|
* @link https://github.com/baendlorel/kt.js
|
|
167
167
|
* @link https://baendlorel.github.io/ Welcome to my site!
|
|
@@ -193,6 +193,22 @@ declare const jsxDEV: typeof jsx;
|
|
|
193
193
|
*/
|
|
194
194
|
declare const jsxs: typeof jsx;
|
|
195
195
|
|
|
196
|
+
/**
|
|
197
|
+
* A helper to create redrawable elements
|
|
198
|
+
* ```tsx
|
|
199
|
+
* export function MyComponent() {
|
|
200
|
+
* let aa = 10;
|
|
201
|
+
* // ...
|
|
202
|
+
* // aa might be changed
|
|
203
|
+
* return createRedrawable(() => <div>{aa}</div>);
|
|
204
|
+
* }
|
|
205
|
+
* ```
|
|
206
|
+
* Then the returned element has a `redraw` method to redraw itself with new values.
|
|
207
|
+
* @param creator
|
|
208
|
+
* @returns created element
|
|
209
|
+
*/
|
|
210
|
+
declare function createRedrawable(creator: () => KTHTMLElement): KTHTMLElement;
|
|
211
|
+
|
|
196
212
|
/**
|
|
197
213
|
* Extract component props type (excluding ref and children)
|
|
198
214
|
*/
|
|
@@ -204,5 +220,5 @@ declare function KTAsync<T extends KTComponent>(props: {
|
|
|
204
220
|
children?: KTRawContent;
|
|
205
221
|
} & ExtractComponentProps<T>): KTHTMLElement;
|
|
206
222
|
|
|
207
|
-
export { Fragment, KTAsync, h as createElement, h, jsx, jsxDEV, jsxs, ref };
|
|
223
|
+
export { Fragment, KTAsync, h as createElement, createRedrawable, h, jsx, jsxDEV, jsxs, ref };
|
|
208
224
|
export type { EventHandler, HTMLTag, KTAttribute, KTHTMLElement, KTRawAttr, KTRawContent, KTRawContents, KTRef };
|
package/dist/index.iife.js
CHANGED
|
@@ -223,7 +223,7 @@ var __ktjs_core__ = (function (exports) {
|
|
|
223
223
|
* ## About
|
|
224
224
|
* @package @ktjs/core
|
|
225
225
|
* @author Kasukabe Tsumugi <futami16237@gmail.com>
|
|
226
|
-
* @version 0.14.
|
|
226
|
+
* @version 0.14.3 (Last Update: 2026.01.16 22:28:22.311)
|
|
227
227
|
* @license MIT
|
|
228
228
|
* @link https://github.com/baendlorel/kt.js
|
|
229
229
|
* @link https://baendlorel.github.io/ Welcome to my site!
|
|
@@ -268,6 +268,7 @@ var __ktjs_core__ = (function (exports) {
|
|
|
268
268
|
ref.value = el;
|
|
269
269
|
}
|
|
270
270
|
old.replaceWith(el);
|
|
271
|
+
return el;
|
|
271
272
|
};
|
|
272
273
|
}
|
|
273
274
|
if (ref) {
|
|
@@ -294,6 +295,7 @@ var __ktjs_core__ = (function (exports) {
|
|
|
294
295
|
ref.value = el;
|
|
295
296
|
}
|
|
296
297
|
old.replaceWith(el);
|
|
298
|
+
return el;
|
|
297
299
|
};
|
|
298
300
|
return el;
|
|
299
301
|
}
|
|
@@ -338,6 +340,32 @@ var __ktjs_core__ = (function (exports) {
|
|
|
338
340
|
* This is called when using jsx: "react-jsx" or "react-jsxdev"
|
|
339
341
|
*/
|
|
340
342
|
const jsxs = jsx;
|
|
343
|
+
/**
|
|
344
|
+
* A helper to create redrawable elements
|
|
345
|
+
* ```tsx
|
|
346
|
+
* export function MyComponent() {
|
|
347
|
+
* let aa = 10;
|
|
348
|
+
* // ...
|
|
349
|
+
* // aa might be changed
|
|
350
|
+
* return createRedrawable(() => <div>{aa}</div>);
|
|
351
|
+
* }
|
|
352
|
+
* ```
|
|
353
|
+
* Then the returned element has a `redraw` method to redraw itself with new values.
|
|
354
|
+
* @param creator
|
|
355
|
+
* @returns created element
|
|
356
|
+
*/
|
|
357
|
+
function createRedrawable(creator) {
|
|
358
|
+
let element = creator();
|
|
359
|
+
const redraw = () => {
|
|
360
|
+
const old = element;
|
|
361
|
+
element = creator();
|
|
362
|
+
old.replaceWith(element);
|
|
363
|
+
element.redraw = redraw;
|
|
364
|
+
return element;
|
|
365
|
+
};
|
|
366
|
+
element.redraw = redraw;
|
|
367
|
+
return element;
|
|
368
|
+
}
|
|
341
369
|
|
|
342
370
|
/**
|
|
343
371
|
* Reference to the created HTML element.
|
|
@@ -363,6 +391,7 @@ var __ktjs_core__ = (function (exports) {
|
|
|
363
391
|
exports.Fragment = Fragment;
|
|
364
392
|
exports.KTAsync = KTAsync;
|
|
365
393
|
exports.createElement = h;
|
|
394
|
+
exports.createRedrawable = createRedrawable;
|
|
366
395
|
exports.h = h;
|
|
367
396
|
exports.jsx = jsx;
|
|
368
397
|
exports.jsxDEV = jsxDEV;
|
package/dist/index.legacy.js
CHANGED
|
@@ -248,7 +248,7 @@ var __ktjs_core__ = (function (exports) {
|
|
|
248
248
|
* ## About
|
|
249
249
|
* @package @ktjs/core
|
|
250
250
|
* @author Kasukabe Tsumugi <futami16237@gmail.com>
|
|
251
|
-
* @version 0.14.
|
|
251
|
+
* @version 0.14.3 (Last Update: 2026.01.16 22:28:22.311)
|
|
252
252
|
* @license MIT
|
|
253
253
|
* @link https://github.com/baendlorel/kt.js
|
|
254
254
|
* @link https://baendlorel.github.io/ Welcome to my site!
|
|
@@ -330,6 +330,7 @@ var __ktjs_core__ = (function (exports) {
|
|
|
330
330
|
ref.value = el_1;
|
|
331
331
|
}
|
|
332
332
|
old.replaceWith(el_1);
|
|
333
|
+
return el_1;
|
|
333
334
|
};
|
|
334
335
|
}
|
|
335
336
|
if (ref) {
|
|
@@ -356,6 +357,7 @@ var __ktjs_core__ = (function (exports) {
|
|
|
356
357
|
ref.value = el_2;
|
|
357
358
|
}
|
|
358
359
|
old.replaceWith(el_2);
|
|
360
|
+
return el_2;
|
|
359
361
|
};
|
|
360
362
|
return el_2;
|
|
361
363
|
}
|
|
@@ -404,6 +406,32 @@ var __ktjs_core__ = (function (exports) {
|
|
|
404
406
|
* This is called when using jsx: "react-jsx" or "react-jsxdev"
|
|
405
407
|
*/
|
|
406
408
|
var jsxs = jsx;
|
|
409
|
+
/**
|
|
410
|
+
* A helper to create redrawable elements
|
|
411
|
+
* ```tsx
|
|
412
|
+
* export function MyComponent() {
|
|
413
|
+
* let aa = 10;
|
|
414
|
+
* // ...
|
|
415
|
+
* // aa might be changed
|
|
416
|
+
* return createRedrawable(() => <div>{aa}</div>);
|
|
417
|
+
* }
|
|
418
|
+
* ```
|
|
419
|
+
* Then the returned element has a `redraw` method to redraw itself with new values.
|
|
420
|
+
* @param creator
|
|
421
|
+
* @returns created element
|
|
422
|
+
*/
|
|
423
|
+
function createRedrawable(creator) {
|
|
424
|
+
var element = creator();
|
|
425
|
+
var redraw = function () {
|
|
426
|
+
var old = element;
|
|
427
|
+
element = creator();
|
|
428
|
+
old.replaceWith(element);
|
|
429
|
+
element.redraw = redraw;
|
|
430
|
+
return element;
|
|
431
|
+
};
|
|
432
|
+
element.redraw = redraw;
|
|
433
|
+
return element;
|
|
434
|
+
}
|
|
407
435
|
|
|
408
436
|
/**
|
|
409
437
|
* Reference to the created HTML element.
|
|
@@ -430,6 +458,7 @@ var __ktjs_core__ = (function (exports) {
|
|
|
430
458
|
exports.Fragment = Fragment;
|
|
431
459
|
exports.KTAsync = KTAsync;
|
|
432
460
|
exports.createElement = h;
|
|
461
|
+
exports.createRedrawable = createRedrawable;
|
|
433
462
|
exports.h = h;
|
|
434
463
|
exports.jsx = jsx;
|
|
435
464
|
exports.jsxDEV = jsxDEV;
|
package/dist/index.mjs
CHANGED
|
@@ -220,7 +220,7 @@ function applyContent(element, content) {
|
|
|
220
220
|
* ## About
|
|
221
221
|
* @package @ktjs/core
|
|
222
222
|
* @author Kasukabe Tsumugi <futami16237@gmail.com>
|
|
223
|
-
* @version 0.14.
|
|
223
|
+
* @version 0.14.3 (Last Update: 2026.01.16 22:28:22.311)
|
|
224
224
|
* @license MIT
|
|
225
225
|
* @link https://github.com/baendlorel/kt.js
|
|
226
226
|
* @link https://baendlorel.github.io/ Welcome to my site!
|
|
@@ -265,6 +265,7 @@ function jsx(tag, props = {}) {
|
|
|
265
265
|
ref.value = el;
|
|
266
266
|
}
|
|
267
267
|
old.replaceWith(el);
|
|
268
|
+
return el;
|
|
268
269
|
};
|
|
269
270
|
}
|
|
270
271
|
if (ref) {
|
|
@@ -291,6 +292,7 @@ function jsx(tag, props = {}) {
|
|
|
291
292
|
ref.value = el;
|
|
292
293
|
}
|
|
293
294
|
old.replaceWith(el);
|
|
295
|
+
return el;
|
|
294
296
|
};
|
|
295
297
|
return el;
|
|
296
298
|
}
|
|
@@ -335,6 +337,32 @@ const jsxDEV = (...args) => {
|
|
|
335
337
|
* This is called when using jsx: "react-jsx" or "react-jsxdev"
|
|
336
338
|
*/
|
|
337
339
|
const jsxs = jsx;
|
|
340
|
+
/**
|
|
341
|
+
* A helper to create redrawable elements
|
|
342
|
+
* ```tsx
|
|
343
|
+
* export function MyComponent() {
|
|
344
|
+
* let aa = 10;
|
|
345
|
+
* // ...
|
|
346
|
+
* // aa might be changed
|
|
347
|
+
* return createRedrawable(() => <div>{aa}</div>);
|
|
348
|
+
* }
|
|
349
|
+
* ```
|
|
350
|
+
* Then the returned element has a `redraw` method to redraw itself with new values.
|
|
351
|
+
* @param creator
|
|
352
|
+
* @returns created element
|
|
353
|
+
*/
|
|
354
|
+
function createRedrawable(creator) {
|
|
355
|
+
let element = creator();
|
|
356
|
+
const redraw = () => {
|
|
357
|
+
const old = element;
|
|
358
|
+
element = creator();
|
|
359
|
+
old.replaceWith(element);
|
|
360
|
+
element.redraw = redraw;
|
|
361
|
+
return element;
|
|
362
|
+
};
|
|
363
|
+
element.redraw = redraw;
|
|
364
|
+
return element;
|
|
365
|
+
}
|
|
338
366
|
|
|
339
367
|
/**
|
|
340
368
|
* Reference to the created HTML element.
|
|
@@ -357,4 +385,4 @@ function KTAsync(props) {
|
|
|
357
385
|
return comp;
|
|
358
386
|
}
|
|
359
387
|
|
|
360
|
-
export { Fragment, KTAsync, h as createElement, h, jsx, jsxDEV, jsxs, ref };
|
|
388
|
+
export { Fragment, KTAsync, h as createElement, createRedrawable, h, jsx, jsxDEV, jsxs, ref };
|
package/dist/jsx/index.d.ts
CHANGED
|
@@ -21,7 +21,7 @@ type KTHTMLElement = HTMLElement & {
|
|
|
21
21
|
* Automically generate a redraw function if it is not provided
|
|
22
22
|
* @param props
|
|
23
23
|
*/
|
|
24
|
-
redraw: (props?: KTAttribute, children?: KTRawContent) =>
|
|
24
|
+
redraw: (props?: KTAttribute, children?: KTRawContent) => KTHTMLElement;
|
|
25
25
|
};
|
|
26
26
|
|
|
27
27
|
declare global {
|
|
@@ -147,7 +147,7 @@ type H = (<T extends HTMLTag>(tag: T, attr?: KTRawAttr, content?: KTRawContent)
|
|
|
147
147
|
* ## About
|
|
148
148
|
* @package @ktjs/core
|
|
149
149
|
* @author Kasukabe Tsumugi <futami16237@gmail.com>
|
|
150
|
-
* @version 0.14.
|
|
150
|
+
* @version 0.14.3 (Last Update: 2026.01.16 22:28:22.311)
|
|
151
151
|
* @license MIT
|
|
152
152
|
* @link https://github.com/baendlorel/kt.js
|
|
153
153
|
* @link https://baendlorel.github.io/ Welcome to my site!
|
|
@@ -179,5 +179,21 @@ declare const jsxDEV: typeof jsx;
|
|
|
179
179
|
*/
|
|
180
180
|
declare const jsxs: typeof jsx;
|
|
181
181
|
|
|
182
|
-
|
|
182
|
+
/**
|
|
183
|
+
* A helper to create redrawable elements
|
|
184
|
+
* ```tsx
|
|
185
|
+
* export function MyComponent() {
|
|
186
|
+
* let aa = 10;
|
|
187
|
+
* // ...
|
|
188
|
+
* // aa might be changed
|
|
189
|
+
* return createRedrawable(() => <div>{aa}</div>);
|
|
190
|
+
* }
|
|
191
|
+
* ```
|
|
192
|
+
* Then the returned element has a `redraw` method to redraw itself with new values.
|
|
193
|
+
* @param creator
|
|
194
|
+
* @returns created element
|
|
195
|
+
*/
|
|
196
|
+
declare function createRedrawable(creator: () => KTHTMLElement): KTHTMLElement;
|
|
197
|
+
|
|
198
|
+
export { Fragment, h as createElement, createRedrawable, jsx, jsxDEV, jsxs, ref };
|
|
183
199
|
export type { KTHTMLElement, KTRef };
|
package/dist/jsx/index.mjs
CHANGED
|
@@ -220,7 +220,7 @@ function applyContent(element, content) {
|
|
|
220
220
|
* ## About
|
|
221
221
|
* @package @ktjs/core
|
|
222
222
|
* @author Kasukabe Tsumugi <futami16237@gmail.com>
|
|
223
|
-
* @version 0.14.
|
|
223
|
+
* @version 0.14.3 (Last Update: 2026.01.16 22:28:22.311)
|
|
224
224
|
* @license MIT
|
|
225
225
|
* @link https://github.com/baendlorel/kt.js
|
|
226
226
|
* @link https://baendlorel.github.io/ Welcome to my site!
|
|
@@ -265,6 +265,7 @@ function jsx(tag, props = {}) {
|
|
|
265
265
|
ref.value = el;
|
|
266
266
|
}
|
|
267
267
|
old.replaceWith(el);
|
|
268
|
+
return el;
|
|
268
269
|
};
|
|
269
270
|
}
|
|
270
271
|
if (ref) {
|
|
@@ -291,6 +292,7 @@ function jsx(tag, props = {}) {
|
|
|
291
292
|
ref.value = el;
|
|
292
293
|
}
|
|
293
294
|
old.replaceWith(el);
|
|
295
|
+
return el;
|
|
294
296
|
};
|
|
295
297
|
return el;
|
|
296
298
|
}
|
|
@@ -335,6 +337,32 @@ const jsxDEV = (...args) => {
|
|
|
335
337
|
* This is called when using jsx: "react-jsx" or "react-jsxdev"
|
|
336
338
|
*/
|
|
337
339
|
const jsxs = jsx;
|
|
340
|
+
/**
|
|
341
|
+
* A helper to create redrawable elements
|
|
342
|
+
* ```tsx
|
|
343
|
+
* export function MyComponent() {
|
|
344
|
+
* let aa = 10;
|
|
345
|
+
* // ...
|
|
346
|
+
* // aa might be changed
|
|
347
|
+
* return createRedrawable(() => <div>{aa}</div>);
|
|
348
|
+
* }
|
|
349
|
+
* ```
|
|
350
|
+
* Then the returned element has a `redraw` method to redraw itself with new values.
|
|
351
|
+
* @param creator
|
|
352
|
+
* @returns created element
|
|
353
|
+
*/
|
|
354
|
+
function createRedrawable(creator) {
|
|
355
|
+
let element = creator();
|
|
356
|
+
const redraw = () => {
|
|
357
|
+
const old = element;
|
|
358
|
+
element = creator();
|
|
359
|
+
old.replaceWith(element);
|
|
360
|
+
element.redraw = redraw;
|
|
361
|
+
return element;
|
|
362
|
+
};
|
|
363
|
+
element.redraw = redraw;
|
|
364
|
+
return element;
|
|
365
|
+
}
|
|
338
366
|
|
|
339
367
|
/**
|
|
340
368
|
* Reference to the created HTML element.
|
|
@@ -345,4 +373,4 @@ function ref(value) {
|
|
|
345
373
|
return { value: value, isKT: true };
|
|
346
374
|
}
|
|
347
375
|
|
|
348
|
-
export { Fragment, h as createElement, jsx, jsxDEV, jsxs, ref };
|
|
376
|
+
export { Fragment, h as createElement, createRedrawable, jsx, jsxDEV, jsxs, ref };
|
|
@@ -15,7 +15,7 @@ type KTHTMLElement = HTMLElement & {
|
|
|
15
15
|
* Automically generate a redraw function if it is not provided
|
|
16
16
|
* @param props
|
|
17
17
|
*/
|
|
18
|
-
redraw: (props?: KTAttribute, children?: KTRawContent) =>
|
|
18
|
+
redraw: (props?: KTAttribute, children?: KTRawContent) => KTHTMLElement;
|
|
19
19
|
};
|
|
20
20
|
|
|
21
21
|
declare global {
|
|
@@ -141,7 +141,7 @@ type H = (<T extends HTMLTag>(tag: T, attr?: KTRawAttr, content?: KTRawContent)
|
|
|
141
141
|
* ## About
|
|
142
142
|
* @package @ktjs/core
|
|
143
143
|
* @author Kasukabe Tsumugi <futami16237@gmail.com>
|
|
144
|
-
* @version 0.14.
|
|
144
|
+
* @version 0.14.3 (Last Update: 2026.01.16 22:28:22.311)
|
|
145
145
|
* @license MIT
|
|
146
146
|
* @link https://github.com/baendlorel/kt.js
|
|
147
147
|
* @link https://baendlorel.github.io/ Welcome to my site!
|
package/dist/jsx/jsx-runtime.mjs
CHANGED
|
@@ -220,7 +220,7 @@ function applyContent(element, content) {
|
|
|
220
220
|
* ## About
|
|
221
221
|
* @package @ktjs/core
|
|
222
222
|
* @author Kasukabe Tsumugi <futami16237@gmail.com>
|
|
223
|
-
* @version 0.14.
|
|
223
|
+
* @version 0.14.3 (Last Update: 2026.01.16 22:28:22.311)
|
|
224
224
|
* @license MIT
|
|
225
225
|
* @link https://github.com/baendlorel/kt.js
|
|
226
226
|
* @link https://baendlorel.github.io/ Welcome to my site!
|
|
@@ -265,6 +265,7 @@ function jsx(tag, props = {}) {
|
|
|
265
265
|
ref.value = el;
|
|
266
266
|
}
|
|
267
267
|
old.replaceWith(el);
|
|
268
|
+
return el;
|
|
268
269
|
};
|
|
269
270
|
}
|
|
270
271
|
if (ref) {
|
|
@@ -291,6 +292,7 @@ function jsx(tag, props = {}) {
|
|
|
291
292
|
ref.value = el;
|
|
292
293
|
}
|
|
293
294
|
old.replaceWith(el);
|
|
295
|
+
return el;
|
|
294
296
|
};
|
|
295
297
|
return el;
|
|
296
298
|
}
|
|
@@ -356,6 +358,7 @@ function createRedrawable(creator) {
|
|
|
356
358
|
element = creator();
|
|
357
359
|
old.replaceWith(element);
|
|
358
360
|
element.redraw = redraw;
|
|
361
|
+
return element;
|
|
359
362
|
};
|
|
360
363
|
element.redraw = redraw;
|
|
361
364
|
return element;
|