From ab8907909b1cb02b091e6ed22b7a2806bc837f33 Mon Sep 17 00:00:00 2001 From: Henry Jameson Date: Tue, 24 Sep 2024 00:23:25 +0300 Subject: [PATCH 1/2] add 'none' keyword to PISS shadow definiton that equals empty array --- src/components/button_unstyled.style.js | 3 ++- src/components/panel_header.style.js | 3 ++- src/services/theme_data/iss_deserializer.js | 6 +++++- src/services/theme_data/iss_serializer.js | 6 +++++- .../unit/specs/services/theme_data/iss_deserializer.spec.js | 4 ++-- 5 files changed, 16 insertions(+), 6 deletions(-) diff --git a/src/components/button_unstyled.style.js b/src/components/button_unstyled.style.js index 435f9cc6..65b5c57b 100644 --- a/src/components/button_unstyled.style.js +++ b/src/components/button_unstyled.style.js @@ -16,7 +16,8 @@ export default { { directives: { background: '#ffffff', - opacity: 0 + opacity: 0, + shadow: [] } }, { diff --git a/src/components/panel_header.style.js b/src/components/panel_header.style.js index 010e42cd..32464bc5 100644 --- a/src/components/panel_header.style.js +++ b/src/components/panel_header.style.js @@ -16,7 +16,8 @@ export default { component: 'PanelHeader', directives: { backgroundNoCssColor: 'yes', - background: '--fg' + background: '--fg', + shadow: [] } } ] diff --git a/src/services/theme_data/iss_deserializer.js b/src/services/theme_data/iss_deserializer.js index 5d71f35f..909e9411 100644 --- a/src/services/theme_data/iss_deserializer.js +++ b/src/services/theme_data/iss_deserializer.js @@ -138,7 +138,11 @@ export const deserialize = (input) => { const [property, value] = d.split(':') let realValue = value.trim() if (property === 'shadow') { - realValue = value.split(',').map(v => parseShadow(v.trim())) + if (realValue === 'none') { + realValue = [] + } else { + realValue = value.split(',').map(v => parseShadow(v.trim())) + } } if (!Number.isNaN(Number(value))) { realValue = Number(value) } diff --git a/src/services/theme_data/iss_serializer.js b/src/services/theme_data/iss_serializer.js index 959852b7..8b7cf5d8 100644 --- a/src/services/theme_data/iss_serializer.js +++ b/src/services/theme_data/iss_serializer.js @@ -32,7 +32,11 @@ export const serialize = (ruleset) => { } else { switch (directive) { case 'shadow': - return ` ${directive}: ${value.map(serializeShadow).join(', ')}` + if (value.length > 0) { + return ` ${directive}: ${value.map(serializeShadow).join(', ')}` + } else { + return ` ${directive}: none` + } default: return ` ${directive}: ${value}` } diff --git a/test/unit/specs/services/theme_data/iss_deserializer.spec.js b/test/unit/specs/services/theme_data/iss_deserializer.spec.js index 01f8dacf..6eb25dfe 100644 --- a/test/unit/specs/services/theme_data/iss_deserializer.spec.js +++ b/test/unit/specs/services/theme_data/iss_deserializer.spec.js @@ -19,7 +19,7 @@ describe('ISS (de)serialization', () => { /* // Debug snippet const onlyComponent = componentsContext('./components/panel_header.style.js').default - it(`(De)serialization of component ${onlyComponent.name} works`, () => { + it.only(`(De)serialization of component ${onlyComponent.name} works`, () => { const normalized = onlyComponent.defaultRules.map(x => ({ component: onlyComponent.name, ...x })) console.log('BEGIN INPUT ================') console.log(normalized) @@ -36,5 +36,5 @@ describe('ISS (de)serialization', () => { // for some reason comparing objects directly fails the assert expect(JSON.stringify(deserialized, null, 2)).to.equal(JSON.stringify(normalized, null, 2)) }) - */ + /* */ }) From 7a7ed917b369c44b62edde52c01ef615f476ed47 Mon Sep 17 00:00:00 2001 From: Henry Jameson Date: Tue, 24 Sep 2024 00:26:05 +0300 Subject: [PATCH 2/2] """changelog""" --- changelog.d/piss-fix.skip | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 changelog.d/piss-fix.skip diff --git a/changelog.d/piss-fix.skip b/changelog.d/piss-fix.skip new file mode 100644 index 00000000..e69de29b