@ktjs/core 0.25.0 → 0.26.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 +513 -464
- package/dist/index.iife.js +34 -6
- package/dist/index.legacy.js +39 -8
- package/dist/index.mjs +34 -6
- package/dist/jsx/index.d.ts +539 -463
- package/dist/jsx/index.mjs +34 -6
- package/dist/jsx/jsx-runtime.d.ts +1 -1
- package/dist/jsx/jsx-runtime.mjs +34 -6
- package/package.json +1 -1
package/dist/index.iife.js
CHANGED
|
@@ -142,19 +142,41 @@ var __ktjs_core__ = (function (exports) {
|
|
|
142
142
|
};
|
|
143
143
|
|
|
144
144
|
const defaultHandler = (element, key, value) => element.setAttribute(key, value);
|
|
145
|
+
const setElementStyle = (element, style) => {
|
|
146
|
+
if (typeof style === 'string') {
|
|
147
|
+
element.style.cssText = style;
|
|
148
|
+
return;
|
|
149
|
+
}
|
|
150
|
+
for (const key in style) {
|
|
151
|
+
element.style[key] = style[key];
|
|
152
|
+
}
|
|
153
|
+
};
|
|
145
154
|
function attrIsObject(element, attr) {
|
|
146
155
|
const classValue = attr.class || attr.className;
|
|
147
156
|
if (classValue !== undefined) {
|
|
148
|
-
|
|
157
|
+
if (isKT(classValue)) {
|
|
158
|
+
element.setAttribute('class', classValue.value);
|
|
159
|
+
classValue.addOnChange((v) => element.setAttribute('class', v));
|
|
160
|
+
}
|
|
161
|
+
else {
|
|
162
|
+
// todo 这里要让undefined 排除出reactify类型工具之外
|
|
163
|
+
element.setAttribute('class', classValue);
|
|
164
|
+
}
|
|
149
165
|
}
|
|
166
|
+
// todo 这里加入reactive支持
|
|
167
|
+
// todo 类型定义也要支持reactive响应式
|
|
150
168
|
const style = attr.style;
|
|
151
169
|
if (style) {
|
|
152
170
|
if (typeof style === 'string') {
|
|
153
171
|
element.setAttribute('style', style);
|
|
154
172
|
}
|
|
155
173
|
else if (typeof style === 'object') {
|
|
156
|
-
|
|
157
|
-
element
|
|
174
|
+
if (isKT(style)) {
|
|
175
|
+
setElementStyle(element, style.value);
|
|
176
|
+
style.addOnChange((v) => setElementStyle(element, v));
|
|
177
|
+
}
|
|
178
|
+
else {
|
|
179
|
+
setElementStyle(element, style);
|
|
158
180
|
}
|
|
159
181
|
}
|
|
160
182
|
}
|
|
@@ -186,8 +208,14 @@ var __ktjs_core__ = (function (exports) {
|
|
|
186
208
|
}
|
|
187
209
|
// normal attributes
|
|
188
210
|
else {
|
|
189
|
-
|
|
190
|
-
|
|
211
|
+
const handler = handlers[key] || defaultHandler;
|
|
212
|
+
if (isKT(o)) {
|
|
213
|
+
handler(element, key, o.value);
|
|
214
|
+
o.addOnChange((v) => handler(element, key, v));
|
|
215
|
+
}
|
|
216
|
+
else {
|
|
217
|
+
handler(element, key, o);
|
|
218
|
+
}
|
|
191
219
|
}
|
|
192
220
|
}
|
|
193
221
|
}
|
|
@@ -571,7 +599,7 @@ var __ktjs_core__ = (function (exports) {
|
|
|
571
599
|
* ## About
|
|
572
600
|
* @package @ktjs/core
|
|
573
601
|
* @author Kasukabe Tsumugi <futami16237@gmail.com>
|
|
574
|
-
* @version 0.
|
|
602
|
+
* @version 0.26.1 (Last Update: 2026.02.05 17:35:29.547)
|
|
575
603
|
* @license MIT
|
|
576
604
|
* @link https://github.com/baendlorel/kt.js
|
|
577
605
|
* @link https://baendlorel.github.io/ Welcome to my site!
|
package/dist/index.legacy.js
CHANGED
|
@@ -144,19 +144,41 @@ var __ktjs_core__ = (function (exports) {
|
|
|
144
144
|
var defaultHandler = function (element, key, value) {
|
|
145
145
|
return element.setAttribute(key, value);
|
|
146
146
|
};
|
|
147
|
+
var setElementStyle = function (element, style) {
|
|
148
|
+
if (typeof style === 'string') {
|
|
149
|
+
element.style.cssText = style;
|
|
150
|
+
return;
|
|
151
|
+
}
|
|
152
|
+
for (var key in style) {
|
|
153
|
+
element.style[key] = style[key];
|
|
154
|
+
}
|
|
155
|
+
};
|
|
147
156
|
function attrIsObject(element, attr) {
|
|
148
157
|
var classValue = attr.class || attr.className;
|
|
149
158
|
if (classValue !== undefined) {
|
|
150
|
-
|
|
159
|
+
if (isKT(classValue)) {
|
|
160
|
+
element.setAttribute('class', classValue.value);
|
|
161
|
+
classValue.addOnChange(function (v) { return element.setAttribute('class', v); });
|
|
162
|
+
}
|
|
163
|
+
else {
|
|
164
|
+
// todo 这里要让undefined 排除出reactify类型工具之外
|
|
165
|
+
element.setAttribute('class', classValue);
|
|
166
|
+
}
|
|
151
167
|
}
|
|
168
|
+
// todo 这里加入reactive支持
|
|
169
|
+
// todo 类型定义也要支持reactive响应式
|
|
152
170
|
var style = attr.style;
|
|
153
171
|
if (style) {
|
|
154
172
|
if (typeof style === 'string') {
|
|
155
173
|
element.setAttribute('style', style);
|
|
156
174
|
}
|
|
157
175
|
else if (typeof style === 'object') {
|
|
158
|
-
|
|
159
|
-
element
|
|
176
|
+
if (isKT(style)) {
|
|
177
|
+
setElementStyle(element, style.value);
|
|
178
|
+
style.addOnChange(function (v) { return setElementStyle(element, v); });
|
|
179
|
+
}
|
|
180
|
+
else {
|
|
181
|
+
setElementStyle(element, style);
|
|
160
182
|
}
|
|
161
183
|
}
|
|
162
184
|
}
|
|
@@ -170,7 +192,7 @@ var __ktjs_core__ = (function (exports) {
|
|
|
170
192
|
element.innerHTML = html;
|
|
171
193
|
}
|
|
172
194
|
}
|
|
173
|
-
|
|
195
|
+
var _loop_1 = function (key) {
|
|
174
196
|
if (key === 'k-if' ||
|
|
175
197
|
key === 'k-model' ||
|
|
176
198
|
key === 'ref' ||
|
|
@@ -179,7 +201,7 @@ var __ktjs_core__ = (function (exports) {
|
|
|
179
201
|
key === 'style' ||
|
|
180
202
|
key === 'children' ||
|
|
181
203
|
key === 'k-html') {
|
|
182
|
-
continue;
|
|
204
|
+
return "continue";
|
|
183
205
|
}
|
|
184
206
|
var o = attr[key];
|
|
185
207
|
// normal event handler
|
|
@@ -188,9 +210,18 @@ var __ktjs_core__ = (function (exports) {
|
|
|
188
210
|
}
|
|
189
211
|
// normal attributes
|
|
190
212
|
else {
|
|
191
|
-
|
|
192
|
-
|
|
213
|
+
var handler_1 = handlers[key] || defaultHandler;
|
|
214
|
+
if (isKT(o)) {
|
|
215
|
+
handler_1(element, key, o.value);
|
|
216
|
+
o.addOnChange(function (v) { return handler_1(element, key, v); });
|
|
217
|
+
}
|
|
218
|
+
else {
|
|
219
|
+
handler_1(element, key, o);
|
|
220
|
+
}
|
|
193
221
|
}
|
|
222
|
+
};
|
|
223
|
+
for (var key in attr) {
|
|
224
|
+
_loop_1(key);
|
|
194
225
|
}
|
|
195
226
|
}
|
|
196
227
|
function applyAttr(element, attr) {
|
|
@@ -571,7 +602,7 @@ var __ktjs_core__ = (function (exports) {
|
|
|
571
602
|
* ## About
|
|
572
603
|
* @package @ktjs/core
|
|
573
604
|
* @author Kasukabe Tsumugi <futami16237@gmail.com>
|
|
574
|
-
* @version 0.
|
|
605
|
+
* @version 0.26.1 (Last Update: 2026.02.05 17:35:29.547)
|
|
575
606
|
* @license MIT
|
|
576
607
|
* @link https://github.com/baendlorel/kt.js
|
|
577
608
|
* @link https://baendlorel.github.io/ Welcome to my site!
|
package/dist/index.mjs
CHANGED
|
@@ -139,19 +139,41 @@ const handlers = {
|
|
|
139
139
|
};
|
|
140
140
|
|
|
141
141
|
const defaultHandler = (element, key, value) => element.setAttribute(key, value);
|
|
142
|
+
const setElementStyle = (element, style) => {
|
|
143
|
+
if (typeof style === 'string') {
|
|
144
|
+
element.style.cssText = style;
|
|
145
|
+
return;
|
|
146
|
+
}
|
|
147
|
+
for (const key in style) {
|
|
148
|
+
element.style[key] = style[key];
|
|
149
|
+
}
|
|
150
|
+
};
|
|
142
151
|
function attrIsObject(element, attr) {
|
|
143
152
|
const classValue = attr.class || attr.className;
|
|
144
153
|
if (classValue !== undefined) {
|
|
145
|
-
|
|
154
|
+
if (isKT(classValue)) {
|
|
155
|
+
element.setAttribute('class', classValue.value);
|
|
156
|
+
classValue.addOnChange((v) => element.setAttribute('class', v));
|
|
157
|
+
}
|
|
158
|
+
else {
|
|
159
|
+
// todo 这里要让undefined 排除出reactify类型工具之外
|
|
160
|
+
element.setAttribute('class', classValue);
|
|
161
|
+
}
|
|
146
162
|
}
|
|
163
|
+
// todo 这里加入reactive支持
|
|
164
|
+
// todo 类型定义也要支持reactive响应式
|
|
147
165
|
const style = attr.style;
|
|
148
166
|
if (style) {
|
|
149
167
|
if (typeof style === 'string') {
|
|
150
168
|
element.setAttribute('style', style);
|
|
151
169
|
}
|
|
152
170
|
else if (typeof style === 'object') {
|
|
153
|
-
|
|
154
|
-
element
|
|
171
|
+
if (isKT(style)) {
|
|
172
|
+
setElementStyle(element, style.value);
|
|
173
|
+
style.addOnChange((v) => setElementStyle(element, v));
|
|
174
|
+
}
|
|
175
|
+
else {
|
|
176
|
+
setElementStyle(element, style);
|
|
155
177
|
}
|
|
156
178
|
}
|
|
157
179
|
}
|
|
@@ -183,8 +205,14 @@ function attrIsObject(element, attr) {
|
|
|
183
205
|
}
|
|
184
206
|
// normal attributes
|
|
185
207
|
else {
|
|
186
|
-
|
|
187
|
-
|
|
208
|
+
const handler = handlers[key] || defaultHandler;
|
|
209
|
+
if (isKT(o)) {
|
|
210
|
+
handler(element, key, o.value);
|
|
211
|
+
o.addOnChange((v) => handler(element, key, v));
|
|
212
|
+
}
|
|
213
|
+
else {
|
|
214
|
+
handler(element, key, o);
|
|
215
|
+
}
|
|
188
216
|
}
|
|
189
217
|
}
|
|
190
218
|
}
|
|
@@ -568,7 +596,7 @@ let creator = htmlCreator;
|
|
|
568
596
|
* ## About
|
|
569
597
|
* @package @ktjs/core
|
|
570
598
|
* @author Kasukabe Tsumugi <futami16237@gmail.com>
|
|
571
|
-
* @version 0.
|
|
599
|
+
* @version 0.26.1 (Last Update: 2026.02.05 17:35:29.547)
|
|
572
600
|
* @license MIT
|
|
573
601
|
* @link https://github.com/baendlorel/kt.js
|
|
574
602
|
* @link https://baendlorel.github.io/ Welcome to my site!
|