kt.js 0.18.1 → 0.18.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/jsx-runtime.mjs +7 -8
- package/package.json +2 -2
package/dist/jsx-runtime.mjs
CHANGED
|
@@ -212,7 +212,7 @@ const svgTempWrapper = document.createElement('div');
|
|
|
212
212
|
* ## About
|
|
213
213
|
* @package @ktjs/core
|
|
214
214
|
* @author Kasukabe Tsumugi <futami16237@gmail.com>
|
|
215
|
-
* @version 0.18.
|
|
215
|
+
* @version 0.18.3 (Last Update: 2026.01.30 23:10:27.447)
|
|
216
216
|
* @license MIT
|
|
217
217
|
* @link https://github.com/baendlorel/kt.js
|
|
218
218
|
* @link https://baendlorel.github.io/ Welcome to my site!
|
|
@@ -240,7 +240,7 @@ const h = (tag, attr, content) => {
|
|
|
240
240
|
* - can alse be used to store normal values, but it is not reactive.
|
|
241
241
|
* @param value mostly an HTMLElement
|
|
242
242
|
*/
|
|
243
|
-
function ref(value) {
|
|
243
|
+
function ref(value, onChange) {
|
|
244
244
|
let _value = value;
|
|
245
245
|
let _onChanges = [];
|
|
246
246
|
return {
|
|
@@ -288,9 +288,10 @@ function jsx(tag, props = {}) {
|
|
|
288
288
|
let el;
|
|
289
289
|
const redraw = (newProps) => {
|
|
290
290
|
props = newProps ? { ...props, ...newProps } : props;
|
|
291
|
-
const old = el;
|
|
292
291
|
el = jsx(tag, props);
|
|
293
|
-
|
|
292
|
+
if (ref !== dummyRef) {
|
|
293
|
+
ref.value = el; // ref setter automatically replaces old element in DOM
|
|
294
|
+
}
|
|
294
295
|
return el;
|
|
295
296
|
};
|
|
296
297
|
if ('k-if' in props && !props['k-if']) {
|
|
@@ -314,7 +315,7 @@ function jsx(tag, props = {}) {
|
|
|
314
315
|
* Fragment support - returns an array of children
|
|
315
316
|
* Note: kt.js doesn't have a real Fragment concept,
|
|
316
317
|
*/
|
|
317
|
-
function Fragment(
|
|
318
|
+
function Fragment(_props) {
|
|
318
319
|
throw new Error("kt.js doesn't have a Fragment concept");
|
|
319
320
|
// const { children } = props ?? {};
|
|
320
321
|
// if (!children) {
|
|
@@ -394,9 +395,7 @@ function createRedrawable(creator) {
|
|
|
394
395
|
const elRef = ref();
|
|
395
396
|
elRef.value = creator();
|
|
396
397
|
const redraw = () => {
|
|
397
|
-
|
|
398
|
-
elRef.value = creator();
|
|
399
|
-
old.replaceWith(elRef.value);
|
|
398
|
+
elRef.value = creator(); // ref setter automatically calls replaceWith
|
|
400
399
|
elRef.value.redraw = redraw;
|
|
401
400
|
return elRef.value;
|
|
402
401
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "kt.js",
|
|
3
|
-
"version": "0.18.
|
|
3
|
+
"version": "0.18.3",
|
|
4
4
|
"author": {
|
|
5
5
|
"name": "Kasukabe Tsumugi",
|
|
6
6
|
"email": "futami16237@gmail.com"
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
],
|
|
42
42
|
"license": "MIT",
|
|
43
43
|
"dependencies": {
|
|
44
|
-
"@ktjs/core": "0.18.
|
|
44
|
+
"@ktjs/core": "0.18.3",
|
|
45
45
|
"@ktjs/shortcuts": "0.7.3"
|
|
46
46
|
},
|
|
47
47
|
"scripts": {
|