kt.js 0.6.14 → 0.6.16

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,71 @@
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
+ const propObj = typeof props === 'string' ? { class: props } : props;
11
+ if (propObj === undefined || propObj === null) {
12
+ return h(tag);
13
+ }
14
+ const children = propObj.children;
15
+ delete propObj.children;
16
+ // deal with ref attribute
17
+ const hasRef = 'ref' in propObj && typeof propObj.ref === 'object' && propObj.ref !== null;
18
+ const ref = hasRef ? propObj.ref : null;
19
+ if (hasRef) {
20
+ delete propObj.ref;
21
+ }
22
+ const el = h(tag, propObj, children);
23
+ if (hasRef) {
24
+ ref.value = el;
25
+ }
26
+ return el;
27
+ }
28
+ /**
29
+ * Fragment support - returns an array of children
30
+ * Note: kt.js doesn't have a real Fragment concept,
31
+ * so we return ktnull for empty fragments or flatten children
32
+ */
33
+ function Fragment(props) {
34
+ window.__ktjs__.throws("kt.js doesn't have a Fragment concept");
35
+ // const { children } = props || {};
36
+ // if (!children) {
37
+ // return ktnull;
38
+ // }
39
+ // // If single child, return it directly
40
+ // if (!Array.isArray(children)) {
41
+ // return children as HTMLElement;
42
+ // }
43
+ // // For multiple children, create a document fragment wrapper
44
+ // // This is a limitation - JSX fragments must be wrapped in kt.js
45
+ // const wrapper = document.createElement('div');
46
+ // wrapper.setAttribute('data-kt-fragment', 'true');
47
+ // children.forEach((child) => {
48
+ // if (child && child !== ktnull) {
49
+ // if (typeof child === 'string') {
50
+ // wrapper.appendChild(document.createTextNode(child));
51
+ // } else if (child instanceof HTMLElement) {
52
+ // wrapper.appendChild(child);
53
+ // }
54
+ // }
55
+ // });
56
+ // return wrapper;
57
+ }
58
+ /**
59
+ * JSX Development runtime - same as jsx but with additional dev checks
60
+ */
61
+ const jsxDEV = (...args) => {
62
+ console.log('JSX runtime called:', ...args);
63
+ return jsx(...args);
64
+ };
65
+ /**
66
+ * JSX runtime for React 17+ automatic runtime
67
+ * This is called when using jsx: "react-jsx" or "react-jsxdev"
68
+ */
69
+ const jsxs = jsx;
70
+
71
+ 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.16",
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.16",
46
+ "@ktjs/shortcuts": "0.6.6"
47
47
  },
48
48
  "scripts": {
49
49
  "build": "rollup -c rollup.config.mjs",