Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/main' into fix/canvas-radius-b…
Browse files Browse the repository at this point in the history
…order
  • Loading branch information
pecoram committed Nov 7, 2024
2 parents f0dd82b + 17b7829 commit 4669644
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 16 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@lightningjs/renderer",
"version": "2.6.1",
"version": "2.6.2",
"description": "Lightning 3 Renderer",
"type": "module",
"main": "./dist/exports/index.js",
Expand Down
38 changes: 23 additions & 15 deletions src/main-api/Inspector.ts
Original file line number Diff line number Diff line change
Expand Up @@ -272,25 +272,33 @@ export class Inspector {
): CoreNode | CoreTextNode {
// Define traps for each property in knownProperties
knownProperties.forEach((property) => {
const originalProp = Object.getOwnPropertyDescriptor(node, property);
if (!originalProp) {
let originalProp = Object.getOwnPropertyDescriptor(node, property);

if (originalProp === undefined) {
// Search the prototype chain for the property descriptor
const proto = Object.getPrototypeOf(node) as CoreNode | CoreTextNode;
originalProp = Object.getOwnPropertyDescriptor(proto, property);
}

if (originalProp === undefined) {
return;
}

Object.defineProperties(node, {
[property]: {
get() {
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
return originalProp.get?.call(node);
},
set(value) {
originalProp.set?.call(node, value);
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-call
this.updateNodeProperty(div, property, value);
},
configurable: true,
enumerable: true,
Object.defineProperty(node, property, {
get() {
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
return originalProp?.get?.call(node);
},
set: (value) => {
originalProp?.set?.call(node, value);
this.updateNodeProperty(
div,
property as keyof CoreNodeProps | keyof CoreTextNodeProps,
value,
);
},
configurable: true,
enumerable: true,
});
});

Expand Down

0 comments on commit 4669644

Please sign in to comment.