@ktjs/core 0.7.0 → 0.7.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
@@ -22,7 +22,8 @@ type otherstring = string & {};
22
22
  */
23
23
  type HTMLTag = keyof HTMLElementTagNameMap & otherstring;
24
24
 
25
- type KTRawContent = (HTMLElement | string | undefined | number)[] | HTMLElement | string | number;
25
+ type Ctt = HTMLElement | string | number | undefined;
26
+ type KTRawContent = (Ctt | (() => Ctt))[] | Ctt;
26
27
  type KTRawAttr = KTAttribute | string;
27
28
  type KTRawContents = (HTMLElement | string | undefined)[];
28
29
 
@@ -102,7 +103,7 @@ type HTML<T extends HTMLTag & otherstring> = T extends HTMLTag ? HTMLElementTagN
102
103
  * ## About
103
104
  * @package @ktjs/core
104
105
  * @author Kasukabe Tsumugi <futami16237@gmail.com>
105
- * @version 0.7.0 (Last Update: 2025.12.25 09:28:15.987)
106
+ * @version 0.7.1 (Last Update: 2025.12.25 09:44:03.948)
106
107
  * @license MIT
107
108
  * @link https://github.com/baendlorel/kt.js
108
109
  * @link https://baendlorel.github.io/ Welcome to my site!
@@ -176,8 +176,22 @@ var __ktjs_core__ = (function (exports) {
176
176
  }
177
177
 
178
178
  function applyContent(element, content) {
179
+ if (typeof content === 'function') {
180
+ content = content();
181
+ }
179
182
  if ($isArray(content)) {
180
- $append.apply(element, content);
183
+ for (let i = 0; i < content.length; i++) {
184
+ let c = content[i];
185
+ if (typeof c === 'function') {
186
+ c = c();
187
+ }
188
+ else if (typeof c === 'number') {
189
+ $append.call(element, c.toString());
190
+ }
191
+ else {
192
+ $append.call(element, c);
193
+ }
194
+ }
181
195
  }
182
196
  else {
183
197
  if (typeof content === 'number') {
@@ -199,7 +213,7 @@ var __ktjs_core__ = (function (exports) {
199
213
  * ## About
200
214
  * @package @ktjs/core
201
215
  * @author Kasukabe Tsumugi <futami16237@gmail.com>
202
- * @version 0.7.0 (Last Update: 2025.12.25 09:28:15.987)
216
+ * @version 0.7.1 (Last Update: 2025.12.25 09:44:03.948)
203
217
  * @license MIT
204
218
  * @link https://github.com/baendlorel/kt.js
205
219
  * @link https://baendlorel.github.io/ Welcome to my site!
@@ -187,8 +187,22 @@ var __ktjs_core__ = (function (exports) {
187
187
  }
188
188
 
189
189
  function applyContent(element, content) {
190
+ if (typeof content === 'function') {
191
+ content = content();
192
+ }
190
193
  if ($isArray(content)) {
191
- $append.apply(element, content);
194
+ for (var i = 0; i < content.length; i++) {
195
+ var c = content[i];
196
+ if (typeof c === 'function') {
197
+ c = c();
198
+ }
199
+ else if (typeof c === 'number') {
200
+ $append.call(element, c.toString());
201
+ }
202
+ else {
203
+ $append.call(element, c);
204
+ }
205
+ }
192
206
  }
193
207
  else {
194
208
  if (typeof content === 'number') {
@@ -210,7 +224,7 @@ var __ktjs_core__ = (function (exports) {
210
224
  * ## About
211
225
  * @package @ktjs/core
212
226
  * @author Kasukabe Tsumugi <futami16237@gmail.com>
213
- * @version 0.7.0 (Last Update: 2025.12.25 09:28:15.987)
227
+ * @version 0.7.1 (Last Update: 2025.12.25 09:44:03.948)
214
228
  * @license MIT
215
229
  * @link https://github.com/baendlorel/kt.js
216
230
  * @link https://baendlorel.github.io/ Welcome to my site!
package/dist/index.mjs CHANGED
@@ -173,8 +173,22 @@ function applyAttr(element, attr) {
173
173
  }
174
174
 
175
175
  function applyContent(element, content) {
176
+ if (typeof content === 'function') {
177
+ content = content();
178
+ }
176
179
  if ($isArray(content)) {
177
- $append.apply(element, content);
180
+ for (let i = 0; i < content.length; i++) {
181
+ let c = content[i];
182
+ if (typeof c === 'function') {
183
+ c = c();
184
+ }
185
+ else if (typeof c === 'number') {
186
+ $append.call(element, c.toString());
187
+ }
188
+ else {
189
+ $append.call(element, c);
190
+ }
191
+ }
178
192
  }
179
193
  else {
180
194
  if (typeof content === 'number') {
@@ -196,7 +210,7 @@ function applyContent(element, content) {
196
210
  * ## About
197
211
  * @package @ktjs/core
198
212
  * @author Kasukabe Tsumugi <futami16237@gmail.com>
199
- * @version 0.7.0 (Last Update: 2025.12.25 09:28:15.987)
213
+ * @version 0.7.1 (Last Update: 2025.12.25 09:44:03.948)
200
214
  * @license MIT
201
215
  * @link https://github.com/baendlorel/kt.js
202
216
  * @link https://baendlorel.github.io/ Welcome to my site!
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ktjs/core",
3
- "version": "0.7.0",
3
+ "version": "0.7.1",
4
4
  "description": "Core functionality for kt.js - DOM manipulation utilities",
5
5
  "type": "module",
6
6
  "module": "./dist/index.mjs",