From 76a89c10953315ae1bc81990e6f35d2c64bf70a2 Mon Sep 17 00:00:00 2001 From: Suresh Kumar Gangumalla Date: Wed, 18 Sep 2024 17:31:32 +0530 Subject: [PATCH 1/3] Updated identification of dynamic component Added flag is used to determine the dynamic component is whether blits component or not. Signed-off-by: Suresh Kumar Gangumalla --- src/component.js | 3 +++ src/lib/codegenerator/generator.js | 2 +- src/lib/symbols.js | 2 ++ 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/component.js b/src/component.js index 005eff2a..40ddfeb2 100644 --- a/src/component.js +++ b/src/component.js @@ -260,6 +260,9 @@ const Component = (name = required('name'), config = required('config')) => { // during the code generation step factory.config = config + // To determine whether dynamic component is actual Blits component or not + factory[symbols.isComponent] = true + return factory } diff --git a/src/lib/codegenerator/generator.js b/src/lib/codegenerator/generator.js index 7f689a88..2bb7ba13 100644 --- a/src/lib/codegenerator/generator.js +++ b/src/lib/codegenerator/generator.js @@ -234,7 +234,7 @@ const generateComponentCode = function ( if(!component${counter}) { throw new Error('Component "${templateObject[Symbol.for('componentType')]}" not found') } - } else if(typeof componentType === 'function' && componentType.name === 'factory') { + } else if(typeof componentType === 'function' && componentType[Symbol.for('isComponent')] === true) { component${counter} = componentType } diff --git a/src/lib/symbols.js b/src/lib/symbols.js index a79ac125..0b33faf0 100644 --- a/src/lib/symbols.js +++ b/src/lib/symbols.js @@ -44,4 +44,6 @@ export default { slots: Symbol.for('slots'), // Symbol 'componentType' utilized within generated code componentType: Symbol.for('componentType'), + // Symbol 'isComponent' utilized within generated code + isComponent: Symbol.for('isComponent'), } From 150d8e4a7ebc3d8d7880dae3d40606ca5768f8b7 Mon Sep 17 00:00:00 2001 From: Michiel van der Geest Date: Fri, 20 Sep 2024 10:12:15 +0200 Subject: [PATCH 2/3] Fixed timing issue in percentage calculation when node is not available yet, but parent is. --- src/engines/L3/element.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/engines/L3/element.js b/src/engines/L3/element.js index 01140d9f..94bd2c3d 100644 --- a/src/engines/L3/element.js +++ b/src/engines/L3/element.js @@ -39,9 +39,9 @@ const parsePercentage = function (v, base) { return v } else if (v.indexOf('%') === v.length - 1) { return ( - this.element.parent && - this.element.parent[base] && - this.element.parent[base] * (parseFloat(v) / 100) + (this.element.config.parent && + (this.element.config.parent.node[base] || 0) * (parseFloat(v) / 100)) || + 0 ) } return v From 2aa7701a7768ff9fe162d68e8b2524eb576c4666 Mon Sep 17 00:00:00 2001 From: Michiel van der Geest Date: Tue, 24 Sep 2024 09:17:20 +0200 Subject: [PATCH 3/3] Bumped version to 1.4.2. Updated changelog. --- CHANGELOG.md | 7 +++++++ package-lock.json | 4 ++-- package.json | 2 +- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 02afb0a3..5fb9178e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,12 @@ # Changelog +## v1.4.2 + +_24 sept 2024_ + +- Fixed timing issue with calculation of percentages +- Improved check to see if object is a Blits component, so it's more robust in case of code minification + ## v1.4.1 _18 sept 2024_ diff --git a/package-lock.json b/package-lock.json index 4d5500da..c21b5682 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@lightningjs/blits", - "version": "1.4.1", + "version": "1.4.2", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@lightningjs/blits", - "version": "1.4.1", + "version": "1.4.2", "license": "Apache-2.0", "dependencies": { "@lightningjs/msdf-generator": "^1.0.2", diff --git a/package.json b/package.json index 3cab3d51..10920747 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@lightningjs/blits", - "version": "1.4.1", + "version": "1.4.2", "description": "Blits: The Lightning 3 App Development Framework", "bin": "bin/index.js", "exports": {