From 5d7a72cfd2ad914e85d3e697e58f0774c582a9b3 Mon Sep 17 00:00:00 2001 From: Henry Jameson Date: Thu, 19 Sep 2024 15:40:52 +0300 Subject: [PATCH 1/3] update browserslist and update versions we support --- .browserslistrc | 7 +++++++ yarn.lock | 28 ++++------------------------ 2 files changed, 11 insertions(+), 24 deletions(-) create mode 100644 .browserslistrc diff --git a/.browserslistrc b/.browserslistrc new file mode 100644 index 00000000..df2d4716 --- /dev/null +++ b/.browserslistrc @@ -0,0 +1,7 @@ +>0.2% +not op_mini all +Safari > 15 +Firefox >= 115 +Firefox ESR +Android > 4 +not dead diff --git a/yarn.lock b/yarn.lock index c42fe8fa..d6474250 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3144,30 +3144,10 @@ caniuse-api@^3.0.0: lodash.memoize "^4.1.2" lodash.uniq "^4.5.0" -caniuse-lite@^1.0.0, caniuse-lite@^1.0.30001370: - version "1.0.30001376" - resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001376.tgz#af2450833e5a06873fbb030a9556ca9461a2736d" - integrity sha512-I27WhtOQ3X3v3it9gNs/oTpoE5KpwmqKR5oKPA8M0G7uMXh9Ty81Q904HpKUrM30ei7zfcL5jE7AXefgbOfMig== - -caniuse-lite@^1.0.30001359: - version "1.0.30001366" - resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001366.tgz#c73352c83830a9eaf2dea0ff71fb4b9a4bbaa89c" - integrity sha512-yy7XLWCubDobokgzudpkKux8e0UOOnLHE6mlNJBzT3lZJz6s5atSEzjoL+fsCPkI0G8MP5uVdDx1ur/fXEWkZA== - -caniuse-lite@^1.0.30001400: - version "1.0.30001418" - resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001418.tgz#5f459215192a024c99e3e3a53aac310fc7cf24e6" - integrity sha512-oIs7+JL3K9JRQ3jPZjlH6qyYDp+nBTCais7hjh0s+fuBwufc7uZ7hPYMXrDOJhV360KGMTcczMRObk0/iMqZRg== - -caniuse-lite@^1.0.30001587: - version "1.0.30001591" - resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001591.tgz#16745e50263edc9f395895a7cd468b9f3767cf33" - integrity sha512-PCzRMei/vXjJyL5mJtzNiUCKP59dm8Apqc3PH8gJkMnMXZGox93RbE76jHsmLwmIo6/3nsYIpJtx0O7u5PqFuQ== - -caniuse-lite@^1.0.30001599: - version "1.0.30001599" - resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001599.tgz#571cf4f3f1506df9bf41fcbb6d10d5d017817bce" - integrity sha512-LRAQHZ4yT1+f9LemSMeqdMpMxZcc4RMWdj4tiFe3G8tNkWK+E58g+/tzotb5cU6TbcVJLr4fySiAW7XmxQvZQA== +caniuse-lite@^1.0.0, caniuse-lite@^1.0.30001359, caniuse-lite@^1.0.30001370, caniuse-lite@^1.0.30001400, caniuse-lite@^1.0.30001587, caniuse-lite@^1.0.30001599: + version "1.0.30001662" + resolved "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001662.tgz" + integrity sha512-sgMUVwLmGseH8ZIrm1d51UbrhqMCH3jvS7gF/M6byuHOnKyLOBL7W8yz5V02OHwgLGA36o/AFhWzzh4uc5aqTA== chai-nightwatch@0.5.3: version "0.5.3" From 1794d52731607baa3f80ea6a5ab2dbac5bd747ef Mon Sep 17 00:00:00 2001 From: Henry Jameson Date: Thu, 19 Sep 2024 15:43:38 +0300 Subject: [PATCH 2/3] changelog --- changelog.d/browsers-support.change | 9 ++++ src/services/theme_data/iss_serializer.js | 62 +++++++++++++++++++++++ 2 files changed, 71 insertions(+) create mode 100644 changelog.d/browsers-support.change create mode 100644 src/services/theme_data/iss_serializer.js diff --git a/changelog.d/browsers-support.change b/changelog.d/browsers-support.change new file mode 100644 index 00000000..a62e5024 --- /dev/null +++ b/changelog.d/browsers-support.change @@ -0,0 +1,9 @@ +Updated our build system to support browsers: + Safari >= 15 + Firefox >= 115 + Android > 4 + no Opera Mini support + no IE support + no "dead" (unmaintained) browsers support + +This does not guarantee that browsers will or will not work. diff --git a/src/services/theme_data/iss_serializer.js b/src/services/theme_data/iss_serializer.js new file mode 100644 index 00000000..39151e41 --- /dev/null +++ b/src/services/theme_data/iss_serializer.js @@ -0,0 +1,62 @@ +import { unroll } from './iss_utils' + +const getCanonicState = (state) => { + if (state) { + return ['normal', ...state.filter(x => x !== 'normal')] + } else { + return ['normal'] + } +} + +const getCanonicRuleHeader = ({ + component, + variant = 'normal', + parent, + state +}) => ({ + component, + variant, + parent, + state: getCanonicState(state) +}) + +const prepareRule = (rule) => { + const { parent } = rule + const chain = [...unroll(parent), rule].map(getCanonicRuleHeader) + const header = chain.map(({ component, variant, state }) => [ + component, + variant === 'normal' ? '' : ('.' + variant), + state.filter(s => s !== 'normal').map(s => ':' + s).join('') + ].join('')).join(' ') + + console.log(header, rule.directives) + const content = Object.entries(rule.directives).map(([key, value]) => { + let realValue = value + + switch (key) { + case 'shadow': + realValue = realValue.map(v => `${v.inset ? 'inset ' : ''}${v.x} ${v.y} ${v.blur} ${v.spread} ${v.color} / ${v.alpha}`) + } + + if (Array.isArray(realValue)) { + realValue = realValue.join(', ') + } + + return ` ${key}: ${realValue};` + }).sort().join('\n') + + return [ + header, + content + ] +} + +export const serialize = (ruleset) => { + // Scrapped idea: automatically combine same-set directives + // problem: might violate the order rules + + return ruleset.filter(r => Object.keys(r.directives).length > 0).map(r => { + const [header, content] = prepareRule(r) + return `${header} {\n${content}\n}\n\n` + }) +} From e089ca6d9a4592eb2ed0998419113b09906b94b8 Mon Sep 17 00:00:00 2001 From: Henry Jameson Date: Thu, 19 Sep 2024 18:25:37 +0300 Subject: [PATCH 3/3] require himem runner to do building and tests --- .gitlab-ci.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 25e499c4..f4c5cf43 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -45,6 +45,7 @@ test: stage: test tags: - amd64 + - himem variables: APT_CACHE_DIR: apt-cache script: @@ -58,6 +59,7 @@ build: stage: build tags: - amd64 + - himem script: - yarn - npm run build