kt.js 0.6.14 → 0.6.15

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.
@@ -1 +1,27 @@
1
- var kt=function(t,e,n,c){"use strict";return Object.keys(e).forEach(function(n){"default"===n||Object.prototype.hasOwnProperty.call(t,n)||Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[n]}})}),Object.keys(n).forEach(function(e){"default"===e||Object.prototype.hasOwnProperty.call(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:function(){return n[e]}})}),Object.keys(c).forEach(function(e){"default"===e||Object.prototype.hasOwnProperty.call(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:function(){return c[e]}})}),t}({},__ktjs_core__,jsx,__ktjs_shortcuts__);
1
+ var kt = (function (exports, core, jsx, shortcuts) {
2
+ 'use strict';
3
+
4
+
5
+
6
+ Object.keys(core).forEach(function (k) {
7
+ if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
8
+ enumerable: true,
9
+ get: function () { return core[k]; }
10
+ });
11
+ });
12
+ Object.keys(jsx).forEach(function (k) {
13
+ if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
14
+ enumerable: true,
15
+ get: function () { return jsx[k]; }
16
+ });
17
+ });
18
+ Object.keys(shortcuts).forEach(function (k) {
19
+ if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
20
+ enumerable: true,
21
+ get: function () { return shortcuts[k]; }
22
+ });
23
+ });
24
+
25
+ return exports;
26
+
27
+ })({}, __ktjs_core__, jsx, __ktjs_shortcuts__);
package/dist/index.mjs CHANGED
@@ -1 +1,3 @@
1
- export*from"@ktjs/core";export*from"@ktjs/jsx";export*from"@ktjs/shortcuts";
1
+ export * from '@ktjs/core';
2
+ export * from '@ktjs/jsx';
3
+ export * from '@ktjs/shortcuts';
@@ -1 +1,69 @@
1
- import{h as t}from"@ktjs/core";export{h as createElement,h}from"@ktjs/core";function e(e,n,...o){const r="string"==typeof n?{class:n}:n;if(null==r)return t(e);const c=r.children;delete r.children;const s="ref"in r&&"object"==typeof r.ref&&null!==r.ref,l=s?r.ref:null;s&&delete r.ref;const f=t(e,r,c);return s&&(l.value=f),f}function n(t){window.__ktjs__.throws("kt.js doesn't have a Fragment concept")}const o=e,r=e;export{n as Fragment,e as jsx,o as jsxDEV,r as jsxs};
1
+ import { h } from '@ktjs/core';
2
+ export { h as createElement, h } from '@ktjs/core';
3
+
4
+ /**
5
+ * @param tag html tag
6
+ * @param props properties/attributes
7
+ * @param _metadata metadata is ignored
8
+ */
9
+ function jsx(tag, props, ..._metadata) {
10
+ console.log('JSX runtime called:', tag, props, _metadata);
11
+ const propObj = typeof props === 'string' ? { class: props } : props;
12
+ if (propObj === undefined || propObj === null) {
13
+ return h(tag);
14
+ }
15
+ const children = propObj.children;
16
+ delete propObj.children;
17
+ // deal with ref attribute
18
+ const hasRef = 'ref' in propObj && typeof propObj.ref === 'object' && propObj.ref !== null;
19
+ const ref = hasRef ? propObj.ref : null;
20
+ if (hasRef) {
21
+ delete propObj.ref;
22
+ }
23
+ const el = h(tag, propObj, children);
24
+ if (hasRef) {
25
+ ref.value = el;
26
+ }
27
+ return el;
28
+ }
29
+ /**
30
+ * Fragment support - returns an array of children
31
+ * Note: kt.js doesn't have a real Fragment concept,
32
+ * so we return ktnull for empty fragments or flatten children
33
+ */
34
+ function Fragment(props) {
35
+ window.__ktjs__.throws("kt.js doesn't have a Fragment concept");
36
+ // const { children } = props || {};
37
+ // if (!children) {
38
+ // return ktnull;
39
+ // }
40
+ // // If single child, return it directly
41
+ // if (!Array.isArray(children)) {
42
+ // return children as HTMLElement;
43
+ // }
44
+ // // For multiple children, create a document fragment wrapper
45
+ // // This is a limitation - JSX fragments must be wrapped in kt.js
46
+ // const wrapper = document.createElement('div');
47
+ // wrapper.setAttribute('data-kt-fragment', 'true');
48
+ // children.forEach((child) => {
49
+ // if (child && child !== ktnull) {
50
+ // if (typeof child === 'string') {
51
+ // wrapper.appendChild(document.createTextNode(child));
52
+ // } else if (child instanceof HTMLElement) {
53
+ // wrapper.appendChild(child);
54
+ // }
55
+ // }
56
+ // });
57
+ // return wrapper;
58
+ }
59
+ /**
60
+ * JSX Development runtime - same as jsx but with additional dev checks
61
+ */
62
+ const jsxDEV = jsx;
63
+ /**
64
+ * JSX runtime for React 17+ automatic runtime
65
+ * This is called when using jsx: "react-jsx" or "react-jsxdev"
66
+ */
67
+ const jsxs = jsx;
68
+
69
+ export { Fragment, jsx, jsxDEV, jsxs };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kt.js",
3
- "version": "0.6.14",
3
+ "version": "0.6.15",
4
4
  "author": {
5
5
  "name": "Kasukabe Tsumugi",
6
6
  "email": "futami16237@gmail.com"
@@ -42,8 +42,8 @@
42
42
  "license": "MIT",
43
43
  "dependencies": {
44
44
  "@ktjs/core": "0.6.12",
45
- "@ktjs/shortcuts": "0.6.6",
46
- "@ktjs/jsx": "0.6.14"
45
+ "@ktjs/jsx": "0.6.15",
46
+ "@ktjs/shortcuts": "0.6.6"
47
47
  },
48
48
  "scripts": {
49
49
  "build": "rollup -c rollup.config.mjs",