@ktjs/jsx 0.6.3 → 0.6.4

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.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";var t=require("@ktjs/core");function e(e,r,...n){const o="string"==typeof r?{class:r}:r;return t.h(e,o,n)}const r=e,n=e;Object.defineProperty(exports,"createElement",{enumerable:!0,get:function(){return t.h}}),Object.defineProperty(exports,"h",{enumerable:!0,get:function(){return t.h}}),exports.Fragment=function(e){const{children:r}=e||{};if(!r)return t.ktnull;if(!Array.isArray(r))return r;const n=document.createElement("div");return n.setAttribute("data-kt-fragment","true"),r.forEach(e=>{e&&e!==t.ktnull&&("string"==typeof e?n.appendChild(document.createTextNode(e)):e instanceof HTMLElement&&n.appendChild(e))}),n},exports.jsx=e,exports.jsxDEV=r,exports.jsxs=n;
1
+ "use strict";var t=require("@ktjs/core");function e(e,r,...n){const o="string"==typeof r?{class:r}:r,c=o?.children;return t.h(e,o,c)}const r=e,n=e;Object.defineProperty(exports,"createElement",{enumerable:!0,get:function(){return t.h}}),Object.defineProperty(exports,"h",{enumerable:!0,get:function(){return t.h}}),exports.Fragment=function(e){const{children:r}=e||{};if(!r)return t.ktnull;if(!Array.isArray(r))return r;const n=document.createElement("div");return n.setAttribute("data-kt-fragment","true"),r.forEach(e=>{e&&e!==t.ktnull&&("string"==typeof e?n.appendChild(document.createTextNode(e)):e instanceof HTMLElement&&n.appendChild(e))}),n},exports.jsx=e,exports.jsxDEV=r,exports.jsxs=n;
package/dist/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
- import { HTMLTag, KTRawAttr, KTRawContents, KTRawContent, ktnull, KTAttribute } from '@ktjs/core';
1
+ import { HTMLTag, KTRawAttr, KTRawContent, ktnull, KTAttribute } from '@ktjs/core';
2
2
  export { h as createElement, h } from '@ktjs/core';
3
3
 
4
- declare function jsx<T extends HTMLTag>(tag: T, props: KTRawAttr, ...children: KTRawContents): HTMLElementTagNameMap[T];
4
+ declare function jsx<T extends HTMLTag>(tag: T, props: KTRawAttr, ...metadata: any[]): HTMLElementTagNameMap[T];
5
5
  /**
6
6
  * Fragment support - returns an array of children
7
7
  * Note: kt.js doesn't have a real Fragment concept,
package/dist/index.mjs CHANGED
@@ -1 +1 @@
1
- import{h as t,ktnull as r}from"@ktjs/core";export{h as createElement,h}from"@ktjs/core";function e(r,e,...n){return t(r,"string"==typeof e?{class:e}:e,n)}function n(t){const{children:e}=t||{};if(!e)return r;if(!Array.isArray(e))return e;const n=document.createElement("div");return n.setAttribute("data-kt-fragment","true"),e.forEach(t=>{t&&t!==r&&("string"==typeof t?n.appendChild(document.createTextNode(t)):t instanceof HTMLElement&&n.appendChild(t))}),n}const o=e,c=e;export{n as Fragment,e as jsx,o as jsxDEV,c as jsxs};
1
+ import{h as t,ktnull as r}from"@ktjs/core";export{h as createElement,h}from"@ktjs/core";function e(r,e,...n){const o="string"==typeof e?{class:e}:e,c=o?.children;return t(r,o,c)}function n(t){const{children:e}=t||{};if(!e)return r;if(!Array.isArray(e))return e;const n=document.createElement("div");return n.setAttribute("data-kt-fragment","true"),e.forEach(t=>{t&&t!==r&&("string"==typeof t?n.appendChild(document.createTextNode(t)):t instanceof HTMLElement&&n.appendChild(t))}),n}const o=e,c=e;export{n as Fragment,e as jsx,o as jsxDEV,c as jsxs};
@@ -2,9 +2,10 @@
2
2
 
3
3
  var core = require('@ktjs/core');
4
4
 
5
- function jsx(tag, props, ...children) {
5
+ function jsx(tag, props, ...metadata) {
6
6
  const propObj = typeof props === 'string' ? { class: props } : props;
7
- console.log('jsx tag', tag, 'props', props, 'rest children', children);
7
+ // console.log('jsx tag', tag, 'props', props, 'rest children', children);
8
+ const children = propObj?.children;
8
9
  return core.h(tag, propObj, children);
9
10
  }
10
11
  /**
@@ -1,7 +1,7 @@
1
- import { HTMLTag, KTRawAttr, KTRawContents, KTRawContent, ktnull } from '@ktjs/core';
1
+ import { HTMLTag, KTRawAttr, KTRawContent, ktnull } from '@ktjs/core';
2
2
  export { h as createElement, h } from '@ktjs/core';
3
3
 
4
- declare function jsx<T extends HTMLTag>(tag: T, props: KTRawAttr, ...children: KTRawContents): HTMLElementTagNameMap[T];
4
+ declare function jsx<T extends HTMLTag>(tag: T, props: KTRawAttr, ...metadata: any[]): HTMLElementTagNameMap[T];
5
5
  /**
6
6
  * Fragment support - returns an array of children
7
7
  * Note: kt.js doesn't have a real Fragment concept,
@@ -1,9 +1,10 @@
1
1
  import { h, ktnull } from '@ktjs/core';
2
2
  export { h as createElement, h } from '@ktjs/core';
3
3
 
4
- function jsx(tag, props, ...children) {
4
+ function jsx(tag, props, ...metadata) {
5
5
  const propObj = typeof props === 'string' ? { class: props } : props;
6
- console.log('jsx tag', tag, 'props', props, 'rest children', children);
6
+ // console.log('jsx tag', tag, 'props', props, 'rest children', children);
7
+ const children = propObj?.children;
7
8
  return h(tag, propObj, children);
8
9
  }
9
10
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ktjs/jsx",
3
- "version": "0.6.3",
3
+ "version": "0.6.4",
4
4
  "description": "JSX/TSX support for KT.js - Build UIs with JSX syntax while keeping direct DOM control",
5
5
  "author": {
6
6
  "name": "Kasukabe Tsumugi",