@ktjs/core 0.14.0 → 0.14.1

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
@@ -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.0 (Last Update: 2026.01.16 20:08:50.505)
164
+ * @version 0.14.1 (Last Update: 2026.01.16 22:18:41.846)
165
165
  * @license MIT
166
166
  * @link https://github.com/baendlorel/kt.js
167
167
  * @link https://baendlorel.github.io/ Welcome to my site!
@@ -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.0 (Last Update: 2026.01.16 20:08:50.505)
226
+ * @version 0.14.1 (Last Update: 2026.01.16 22:18:41.846)
227
227
  * @license MIT
228
228
  * @link https://github.com/baendlorel/kt.js
229
229
  * @link https://baendlorel.github.io/ Welcome to my site!
@@ -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.0 (Last Update: 2026.01.16 20:08:50.505)
251
+ * @version 0.14.1 (Last Update: 2026.01.16 22:18:41.846)
252
252
  * @license MIT
253
253
  * @link https://github.com/baendlorel/kt.js
254
254
  * @link https://baendlorel.github.io/ Welcome to my site!
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.0 (Last Update: 2026.01.16 20:08:50.505)
223
+ * @version 0.14.1 (Last Update: 2026.01.16 22:18:41.846)
224
224
  * @license MIT
225
225
  * @link https://github.com/baendlorel/kt.js
226
226
  * @link https://baendlorel.github.io/ Welcome to my site!
@@ -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.0 (Last Update: 2026.01.16 20:08:50.505)
150
+ * @version 0.14.1 (Last Update: 2026.01.16 22:18:41.846)
151
151
  * @license MIT
152
152
  * @link https://github.com/baendlorel/kt.js
153
153
  * @link https://baendlorel.github.io/ Welcome to my site!
@@ -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.0 (Last Update: 2026.01.16 20:08:50.505)
223
+ * @version 0.14.1 (Last Update: 2026.01.16 22:18:41.846)
224
224
  * @license MIT
225
225
  * @link https://github.com/baendlorel/kt.js
226
226
  * @link https://baendlorel.github.io/ Welcome to my site!
@@ -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.0 (Last Update: 2026.01.16 20:08:50.505)
144
+ * @version 0.14.1 (Last Update: 2026.01.16 22:18:41.846)
145
145
  * @license MIT
146
146
  * @link https://github.com/baendlorel/kt.js
147
147
  * @link https://baendlorel.github.io/ Welcome to my site!
@@ -173,4 +173,20 @@ declare const jsxDEV: typeof jsx;
173
173
  */
174
174
  declare const jsxs: typeof jsx;
175
175
 
176
- export { Fragment, h as createElement, h, jsx, jsxDEV, jsxs };
176
+ /**
177
+ * A helper to create redrawable elements
178
+ * ```tsx
179
+ * export function MyComponent() {
180
+ * let aa = 10;
181
+ * // ...
182
+ * // aa might be changed
183
+ * return createRedrawable(() => <div>{aa}</div>);
184
+ * }
185
+ * ```
186
+ * Then the returned element has a `redraw` method to redraw itself with new values.
187
+ * @param creator
188
+ * @returns created element
189
+ */
190
+ declare function createRedrawable(creator: () => KTHTMLElement): KTHTMLElement;
191
+
192
+ export { Fragment, h as createElement, createRedrawable, h, jsx, jsxDEV, jsxs };
@@ -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.0 (Last Update: 2026.01.16 20:08:50.505)
223
+ * @version 0.14.1 (Last Update: 2026.01.16 22:18:41.846)
224
224
  * @license MIT
225
225
  * @link https://github.com/baendlorel/kt.js
226
226
  * @link https://baendlorel.github.io/ Welcome to my site!
@@ -335,5 +335,30 @@ const jsxDEV = (...args) => {
335
335
  * This is called when using jsx: "react-jsx" or "react-jsxdev"
336
336
  */
337
337
  const jsxs = jsx;
338
+ /**
339
+ * A helper to create redrawable elements
340
+ * ```tsx
341
+ * export function MyComponent() {
342
+ * let aa = 10;
343
+ * // ...
344
+ * // aa might be changed
345
+ * return createRedrawable(() => <div>{aa}</div>);
346
+ * }
347
+ * ```
348
+ * Then the returned element has a `redraw` method to redraw itself with new values.
349
+ * @param creator
350
+ * @returns created element
351
+ */
352
+ function createRedrawable(creator) {
353
+ let element = creator();
354
+ const redraw = () => {
355
+ const old = element;
356
+ element = creator();
357
+ old.replaceWith(element);
358
+ element.redraw = redraw;
359
+ };
360
+ element.redraw = redraw;
361
+ return element;
362
+ }
338
363
 
339
- export { Fragment, h as createElement, h, jsx, jsxDEV, jsxs };
364
+ export { Fragment, h as createElement, createRedrawable, h, jsx, jsxDEV, jsxs };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ktjs/core",
3
- "version": "0.14.0",
3
+ "version": "0.14.1",
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",