Jelajahi Sumber

Merge branch 'update-prefixer' into 'develop'

Update prefixer settings and required gitlab runner tags

See merge request pleroma/pleroma-fe!1942
HJ 2 bulan lalu
induk
melakukan
23f8c08809

+ 7 - 0
.browserslistrc

@@ -0,0 +1,7 @@
+>0.2%
+not op_mini all
+Safari > 15
+Firefox >= 115
+Firefox ESR
+Android > 4
+not dead

+ 2 - 0
.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

+ 9 - 0
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.

+ 62 - 0
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`
+  })
+}

+ 4 - 24
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"