@scania/tegel-react 1.51.0 → 1.52.0-happy-dom-beta.0
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/runtime.js +6 -6
- package/dist/types/runtime.d.ts +2 -2
- package/package.json +2 -2
package/dist/runtime.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Custom runtime wrapper for @stencil/react-output-target.
|
|
3
3
|
*
|
|
4
|
-
* In JSDOM (vitest / jest), Stencil's lazy-loaded property-to-attribute
|
|
4
|
+
* In JSDOM/HappyDOM (vitest / jest), Stencil's lazy-loaded property-to-attribute
|
|
5
5
|
* reflection never fires, so props set as JS properties via @lit/react's
|
|
6
6
|
* createComponent are invisible to getAttribute(). This wrapper detects
|
|
7
|
-
* JSDOM and adds a useLayoutEffect that explicitly syncs primitive props
|
|
7
|
+
* JSDOM/HappyDOM and adds a useLayoutEffect that explicitly syncs primitive props
|
|
8
8
|
* to DOM attributes. In real browsers, the original component is returned
|
|
9
9
|
* unchanged — zero runtime cost.
|
|
10
10
|
*/
|
|
@@ -21,8 +21,8 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
21
21
|
};
|
|
22
22
|
import { createComponent as litCreateComponent } from '@lit/react';
|
|
23
23
|
import React from 'react';
|
|
24
|
-
// ----------
|
|
25
|
-
const
|
|
24
|
+
// ---------- Test DOM detection ----------
|
|
25
|
+
const isTestDom = typeof navigator !== 'undefined' && /(jsdom|happydom)/i.test(navigator.userAgent);
|
|
26
26
|
// ---------- Attribute helpers ----------
|
|
27
27
|
const reservedProps = new Set(['children', 'localName', 'ref', 'style', 'className']);
|
|
28
28
|
function camelToDash(str) {
|
|
@@ -58,10 +58,10 @@ export const createComponent = (_a) => {
|
|
|
58
58
|
const resolvedTagName = transformTag ? transformTag(tagName) : tagName;
|
|
59
59
|
const OriginalComponent = litCreateComponent(Object.assign(Object.assign({}, rest), { tagName: resolvedTagName }));
|
|
60
60
|
// In real browsers Stencil's proxy handles reflection — return as-is.
|
|
61
|
-
if (!
|
|
61
|
+
if (!isTestDom) {
|
|
62
62
|
return OriginalComponent;
|
|
63
63
|
}
|
|
64
|
-
// ---
|
|
64
|
+
// --- Test DOM wrapper ---
|
|
65
65
|
const { elementClass, events } = rest;
|
|
66
66
|
const eventKeys = new Set(Object.keys(events !== null && events !== void 0 ? events : {}));
|
|
67
67
|
const WrappedComponent = React.forwardRef((props, ref) => {
|
package/dist/types/runtime.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Custom runtime wrapper for @stencil/react-output-target.
|
|
3
3
|
*
|
|
4
|
-
* In JSDOM (vitest / jest), Stencil's lazy-loaded property-to-attribute
|
|
4
|
+
* In JSDOM/HappyDOM (vitest / jest), Stencil's lazy-loaded property-to-attribute
|
|
5
5
|
* reflection never fires, so props set as JS properties via @lit/react's
|
|
6
6
|
* createComponent are invisible to getAttribute(). This wrapper detects
|
|
7
|
-
* JSDOM and adds a useLayoutEffect that explicitly syncs primitive props
|
|
7
|
+
* JSDOM/HappyDOM and adds a useLayoutEffect that explicitly syncs primitive props
|
|
8
8
|
* to DOM attributes. In real browsers, the original component is returned
|
|
9
9
|
* unchanged — zero runtime cost.
|
|
10
10
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@scania/tegel-react",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.52.0-happy-dom-beta.0",
|
|
4
4
|
"description": "React wrappers for Tegel package",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.js",
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
},
|
|
28
28
|
"homepage": "https://github.com/scania-digital-design-system/tegel#readme",
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@scania/tegel": "
|
|
30
|
+
"@scania/tegel": "1.52.0-happy-dom-beta.0",
|
|
31
31
|
"@stencil/react-output-target": "1.3.0"
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|