@ktjs/core 0.14.2 → 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 +18 -2
- package/dist/index.iife.js +28 -1
- package/dist/index.legacy.js +28 -1
- package/dist/index.mjs +28 -2
- package/dist/jsx/index.d.ts +18 -2
- package/dist/jsx/index.mjs +28 -2
- package/dist/jsx/jsx-runtime.d.ts +1 -1
- package/dist/jsx/jsx-runtime.mjs +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -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!
|
|
@@ -340,6 +340,32 @@ var __ktjs_core__ = (function (exports) {
|
|
|
340
340
|
* This is called when using jsx: "react-jsx" or "react-jsxdev"
|
|
341
341
|
*/
|
|
342
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
|
+
}
|
|
343
369
|
|
|
344
370
|
/**
|
|
345
371
|
* Reference to the created HTML element.
|
|
@@ -365,6 +391,7 @@ var __ktjs_core__ = (function (exports) {
|
|
|
365
391
|
exports.Fragment = Fragment;
|
|
366
392
|
exports.KTAsync = KTAsync;
|
|
367
393
|
exports.createElement = h;
|
|
394
|
+
exports.createRedrawable = createRedrawable;
|
|
368
395
|
exports.h = h;
|
|
369
396
|
exports.jsx = jsx;
|
|
370
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!
|
|
@@ -406,6 +406,32 @@ var __ktjs_core__ = (function (exports) {
|
|
|
406
406
|
* This is called when using jsx: "react-jsx" or "react-jsxdev"
|
|
407
407
|
*/
|
|
408
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
|
+
}
|
|
409
435
|
|
|
410
436
|
/**
|
|
411
437
|
* Reference to the created HTML element.
|
|
@@ -432,6 +458,7 @@ var __ktjs_core__ = (function (exports) {
|
|
|
432
458
|
exports.Fragment = Fragment;
|
|
433
459
|
exports.KTAsync = KTAsync;
|
|
434
460
|
exports.createElement = h;
|
|
461
|
+
exports.createRedrawable = createRedrawable;
|
|
435
462
|
exports.h = h;
|
|
436
463
|
exports.jsx = jsx;
|
|
437
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!
|
|
@@ -337,6 +337,32 @@ const jsxDEV = (...args) => {
|
|
|
337
337
|
* This is called when using jsx: "react-jsx" or "react-jsxdev"
|
|
338
338
|
*/
|
|
339
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
|
+
}
|
|
340
366
|
|
|
341
367
|
/**
|
|
342
368
|
* Reference to the created HTML element.
|
|
@@ -359,4 +385,4 @@ function KTAsync(props) {
|
|
|
359
385
|
return comp;
|
|
360
386
|
}
|
|
361
387
|
|
|
362
|
-
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
|
@@ -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!
|
|
@@ -337,6 +337,32 @@ const jsxDEV = (...args) => {
|
|
|
337
337
|
* This is called when using jsx: "react-jsx" or "react-jsxdev"
|
|
338
338
|
*/
|
|
339
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
|
+
}
|
|
340
366
|
|
|
341
367
|
/**
|
|
342
368
|
* Reference to the created HTML element.
|
|
@@ -347,4 +373,4 @@ function ref(value) {
|
|
|
347
373
|
return { value: value, isKT: true };
|
|
348
374
|
}
|
|
349
375
|
|
|
350
|
-
export { Fragment, h as createElement, jsx, jsxDEV, jsxs, ref };
|
|
376
|
+
export { Fragment, h as createElement, createRedrawable, jsx, jsxDEV, jsxs, ref };
|
|
@@ -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!
|