@zeus-js/output-react-wrapper 0.1.0-beta.3 → 0.1.0-beta.5

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.
@@ -0,0 +1,53 @@
1
+ /**
2
+ * output-react-wrapper v0.1.0-beta.5
3
+ * (c) 2026 baicie
4
+ * Released under the MIT License.
5
+ **/
6
+ import { createComponent as createComponent$1 } from "@lit/react";
7
+ //#region packages/web-c/output-react-wrapper/src/runtime/createComponent.ts
8
+ function createComponent(options) {
9
+ var _customElements$get;
10
+ const { defineCustomElement, react, tagName, transformTag, elementClass, events = {}, slots = [], displayName } = options;
11
+ const finalTagName = transformTag ? transformTag(tagName) : tagName;
12
+ defineCustomElement === null || defineCustomElement === void 0 || defineCustomElement();
13
+ const LitComponent = createComponent$1({
14
+ react,
15
+ tagName: finalTagName,
16
+ elementClass: elementClass !== null && elementClass !== void 0 ? elementClass : typeof customElements === "undefined" ? HTMLElement : (_customElements$get = customElements.get(finalTagName)) !== null && _customElements$get !== void 0 ? _customElements$get : HTMLElement,
17
+ events,
18
+ displayName
19
+ });
20
+ if (!slots.length) return LitComponent;
21
+ const slotSet = new Set(slots);
22
+ return react.forwardRef((inputProps, ref) => {
23
+ const rest = {};
24
+ const slottedChildren = [];
25
+ if (inputProps == null) {
26
+ rest.ref = ref;
27
+ return react.createElement(LitComponent, rest);
28
+ }
29
+ const props = inputProps;
30
+ for (const key in props) {
31
+ if (!Object.prototype.hasOwnProperty.call(props, key)) continue;
32
+ const value = props[key];
33
+ if (slotSet.has(key)) {
34
+ const child = createNamedSlot(react, key, value);
35
+ if (child != null) slottedChildren.push(child);
36
+ continue;
37
+ }
38
+ rest[key] = value;
39
+ }
40
+ rest.ref = ref;
41
+ if (props.children != null) slottedChildren.push(props.children);
42
+ return react.createElement(LitComponent, rest, ...slottedChildren);
43
+ });
44
+ }
45
+ function createNamedSlot(react, name, value) {
46
+ if (value == null || value === false) return null;
47
+ return react.createElement("span", {
48
+ slot: name,
49
+ style: { display: "contents" }
50
+ }, value);
51
+ }
52
+ //#endregion
53
+ export { createComponent };
@@ -0,0 +1,53 @@
1
+ /**
2
+ * output-react-wrapper v0.1.0-beta.5
3
+ * (c) 2026 baicie
4
+ * Released under the MIT License.
5
+ **/
6
+ import { createComponent as createComponent$1 } from "@lit/react";
7
+ //#region packages/web-c/output-react-wrapper/src/runtime/createComponent.ts
8
+ function createComponent(options) {
9
+ var _customElements$get;
10
+ const { defineCustomElement, react, tagName, transformTag, elementClass, events = {}, slots = [], displayName } = options;
11
+ const finalTagName = transformTag ? transformTag(tagName) : tagName;
12
+ defineCustomElement === null || defineCustomElement === void 0 || defineCustomElement();
13
+ const LitComponent = createComponent$1({
14
+ react,
15
+ tagName: finalTagName,
16
+ elementClass: elementClass !== null && elementClass !== void 0 ? elementClass : typeof customElements === "undefined" ? HTMLElement : (_customElements$get = customElements.get(finalTagName)) !== null && _customElements$get !== void 0 ? _customElements$get : HTMLElement,
17
+ events,
18
+ displayName
19
+ });
20
+ if (!slots.length) return LitComponent;
21
+ const slotSet = new Set(slots);
22
+ return react.forwardRef((inputProps, ref) => {
23
+ const rest = {};
24
+ const slottedChildren = [];
25
+ if (inputProps == null) {
26
+ rest.ref = ref;
27
+ return react.createElement(LitComponent, rest);
28
+ }
29
+ const props = inputProps;
30
+ for (const key in props) {
31
+ if (!Object.prototype.hasOwnProperty.call(props, key)) continue;
32
+ const value = props[key];
33
+ if (slotSet.has(key)) {
34
+ const child = createNamedSlot(react, key, value);
35
+ if (child != null) slottedChildren.push(child);
36
+ continue;
37
+ }
38
+ rest[key] = value;
39
+ }
40
+ rest.ref = ref;
41
+ if (props.children != null) slottedChildren.push(props.children);
42
+ return react.createElement(LitComponent, rest, ...slottedChildren);
43
+ });
44
+ }
45
+ function createNamedSlot(react, name, value) {
46
+ if (value == null || value === false) return null;
47
+ return react.createElement("span", {
48
+ slot: name,
49
+ style: { display: "contents" }
50
+ }, value);
51
+ }
52
+ //#endregion
53
+ export { createComponent };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zeus-js/output-react-wrapper",
3
- "version": "0.1.0-beta.3",
3
+ "version": "0.1.0-beta.5",
4
4
  "description": "Zeus React wrapper output plugin",
5
5
  "type": "module",
6
6
  "main": "index.js",
@@ -21,6 +21,11 @@
21
21
  "development": "./dist/output-react-wrapper.cjs.js",
22
22
  "default": "./index.js"
23
23
  }
24
+ },
25
+ "./runtime": {
26
+ "types": "./dist/runtime/index.d.ts",
27
+ "import": "./dist/runtime/index.js",
28
+ "require": "./dist/runtime/index.cjs.js"
24
29
  }
25
30
  },
26
31
  "sideEffects": false,
@@ -33,17 +38,28 @@
33
38
  "formats": [
34
39
  "esm-bundler",
35
40
  "cjs"
41
+ ],
42
+ "additionalEntries": [
43
+ {
44
+ "entry": "runtime/index.ts",
45
+ "output": "dist/runtime/index.js"
46
+ }
36
47
  ]
37
48
  },
38
49
  "dependencies": {
39
- "@zeus-js/bundler-plugin": "0.1.0-beta.3",
40
- "@zeus-js/component-dts": "0.1.0-beta.3",
41
- "@zeus-js/component-analyzer": "0.1.0-beta.3"
50
+ "@lit/react": "^1.0.8",
51
+ "@zeus-js/component-analyzer": "0.1.0-beta.5",
52
+ "@zeus-js/bundler-plugin": "0.1.0-beta.5",
53
+ "@zeus-js/component-dts": "0.1.0-beta.5"
42
54
  },
43
55
  "peerDependencies": {
56
+ "@types/react": "17 || 18 || 19",
44
57
  "react": ">=18"
45
58
  },
46
59
  "peerDependenciesMeta": {
60
+ "@types/react": {
61
+ "optional": true
62
+ },
47
63
  "react": {
48
64
  "optional": true
49
65
  }