@ktjs/core 0.7.0 → 0.7.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 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.3 (Last Update: 2025.12.25 09:51:02.157)
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,23 @@ var __ktjs_core__ = (function (exports) {
176
176
  }
177
177
 
178
178
  function applyContent(element, content) {
179
+ console.log('applyContent', content);
180
+ if (typeof content === 'function') {
181
+ content = content();
182
+ }
179
183
  if ($isArray(content)) {
180
- $append.apply(element, content);
184
+ for (let i = 0; i < content.length; i++) {
185
+ let c = content[i];
186
+ if (typeof c === 'function') {
187
+ c = c();
188
+ }
189
+ else if (typeof c === 'number') {
190
+ $append.call(element, c.toString());
191
+ }
192
+ else {
193
+ $append.call(element, c);
194
+ }
195
+ }
181
196
  }
182
197
  else {
183
198
  if (typeof content === 'number') {
@@ -199,7 +214,7 @@ var __ktjs_core__ = (function (exports) {
199
214
  * ## About
200
215
  * @package @ktjs/core
201
216
  * @author Kasukabe Tsumugi <futami16237@gmail.com>
202
- * @version 0.7.0 (Last Update: 2025.12.25 09:28:15.987)
217
+ * @version 0.7.3 (Last Update: 2025.12.25 09:51:02.157)
203
218
  * @license MIT
204
219
  * @link https://github.com/baendlorel/kt.js
205
220
  * @link https://baendlorel.github.io/ Welcome to my site!
@@ -187,8 +187,23 @@ var __ktjs_core__ = (function (exports) {
187
187
  }
188
188
 
189
189
  function applyContent(element, content) {
190
+ console.log('applyContent', content);
191
+ if (typeof content === 'function') {
192
+ content = content();
193
+ }
190
194
  if ($isArray(content)) {
191
- $append.apply(element, content);
195
+ for (var i = 0; i < content.length; i++) {
196
+ var c = content[i];
197
+ if (typeof c === 'function') {
198
+ c = c();
199
+ }
200
+ else if (typeof c === 'number') {
201
+ $append.call(element, c.toString());
202
+ }
203
+ else {
204
+ $append.call(element, c);
205
+ }
206
+ }
192
207
  }
193
208
  else {
194
209
  if (typeof content === 'number') {
@@ -210,7 +225,7 @@ var __ktjs_core__ = (function (exports) {
210
225
  * ## About
211
226
  * @package @ktjs/core
212
227
  * @author Kasukabe Tsumugi <futami16237@gmail.com>
213
- * @version 0.7.0 (Last Update: 2025.12.25 09:28:15.987)
228
+ * @version 0.7.3 (Last Update: 2025.12.25 09:51:02.157)
214
229
  * @license MIT
215
230
  * @link https://github.com/baendlorel/kt.js
216
231
  * @link https://baendlorel.github.io/ Welcome to my site!
package/dist/index.mjs CHANGED
@@ -173,8 +173,23 @@ function applyAttr(element, attr) {
173
173
  }
174
174
 
175
175
  function applyContent(element, content) {
176
+ console.log('applyContent', content);
177
+ if (typeof content === 'function') {
178
+ content = content();
179
+ }
176
180
  if ($isArray(content)) {
177
- $append.apply(element, content);
181
+ for (let i = 0; i < content.length; i++) {
182
+ let c = content[i];
183
+ if (typeof c === 'function') {
184
+ c = c();
185
+ }
186
+ else if (typeof c === 'number') {
187
+ $append.call(element, c.toString());
188
+ }
189
+ else {
190
+ $append.call(element, c);
191
+ }
192
+ }
178
193
  }
179
194
  else {
180
195
  if (typeof content === 'number') {
@@ -196,7 +211,7 @@ function applyContent(element, content) {
196
211
  * ## About
197
212
  * @package @ktjs/core
198
213
  * @author Kasukabe Tsumugi <futami16237@gmail.com>
199
- * @version 0.7.0 (Last Update: 2025.12.25 09:28:15.987)
214
+ * @version 0.7.3 (Last Update: 2025.12.25 09:51:02.157)
200
215
  * @license MIT
201
216
  * @link https://github.com/baendlorel/kt.js
202
217
  * @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.3",
4
4
  "description": "Core functionality for kt.js - DOM manipulation utilities",
5
5
  "type": "module",
6
6
  "module": "./dist/index.mjs",