progress on migrating to heex templates and font-icons

This commit is contained in:
Adam Piontek 2022-08-13 07:32:36 -04:00
parent d43daafdb7
commit 3eff955672
21793 changed files with 2161968 additions and 16895 deletions

30
assets_old/node_modules/icss-utils/CHANGELOG.md generated vendored Normal file
View file

@ -0,0 +1,30 @@
# Change Log
All notable changes to this project will be documented in this file.
This project adheres to [Semantic Versioning](http://semver.org/).
## [5.1.0] - 2020-11-19
### Features
- feat: support at-rule versions of `import`/`export`
## [5.0.0] - 2020-10-12
### BREAKING CHANGE
- minimum supported `postcss` version is `^8.1.0`
### Fixes
- minimum supported `Node.js` version is `^10 || ^12 || >= 14`
- compatibility with PostCSS 8
## [5.0.0-rc.0] - 2020-09-21
### BREAKING CHANGE
- minimum supported `Node.js` version is `>= 10.13.0 || >= 12.13.0 || >= 14`
- minimum supported `postcss` version is `^8.0.0`
- `postcss` was moved to `peerDependencies`, you need to install `postcss` in your project before use the plugin
- you need to pass `postcss` API to using `createICSSRules` (third argument)

6
assets_old/node_modules/icss-utils/LICENSE.md generated vendored Normal file
View file

@ -0,0 +1,6 @@
ISC License (ISC)
Copyright 2018 Glen Maddern
Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.

94
assets_old/node_modules/icss-utils/README.md generated vendored Normal file
View file

@ -0,0 +1,94 @@
[![Build Status](https://travis-ci.org/css-modules/icss-utils.svg)](https://travis-ci.org/css-modules/icss-utils)
# ICSS Utils
## replaceSymbols
Governs the way tokens are searched & replaced during the linking stage of ICSS loading.
This is broken into its own module in case the behaviour needs to be replicated in other PostCSS plugins
(i.e. [CSS Modules Values](https://github.com/css-modules/postcss-modules-values))
```js
import { replaceSymbols, replaceValueSymbols } from "icss-utils";
replaceSymbols(css, replacements);
replaceValueSymbols(string, replacements);
```
Where:
- `css` is the PostCSS tree you're working with
- `replacements` is an JS object of `symbol: "replacement"` pairs, where all occurrences of `symbol` are replaced with `replacement`.
A symbol is a string of alphanumeric, `-` or `_` characters. A replacement can be any string. They are replaced in the following places:
- In the value of a declaration, i.e. `color: my_symbol;` or `box-shadow: 0 0 blur spread shadow-color`
- In a media expression i.e. `@media small {}` or `@media screen and not-large {}`
## extractICSS(css, removeRules = true, mode = 'auto')
Extracts and remove (if removeRules is equal true) from PostCSS tree `:import`, `@icss-import`, `:export` and `@icss-export` statements.
```js
import postcss from "postcss";
import { extractICSS } from "icss-utils";
const css = postcss.parse(`
:import(colors) {
a: b;
}
:export {
c: d;
}
`);
extractICSS(css);
/*
{
icssImports: {
colors: {
a: 'b'
}
},
icssExports: {
c: 'd'
}
}
*/
```
By default both the pseudo and at-rule form of the import and export statements
will be removed. Pass the `mode` option to limit to only one type.
## createICSSRules(icssImports, icssExports, mode = 'rule')
Converts icss imports and exports definitions to postcss ast
```js
createICSSRules(
{
colors: {
a: "b",
},
},
{
c: "d",
},
// Need pass `rule` and `decl` from postcss
// Please look at `Step 4` https://evilmartians.com/chronicles/postcss-8-plugin-migration
postcss
);
```
By default it will create pseudo selector rules (`:import` and `:export`). Pass
`at-rule` for `mode` to instead generate `@icss-import` and `@icss-export`, which
may be more resilient to post processing by other tools.
## License
ISC
---
Glen Maddern, Bogdan Chadkin and Evilebottnawi 2015-present.

52
assets_old/node_modules/icss-utils/package.json generated vendored Normal file
View file

@ -0,0 +1,52 @@
{
"name": "icss-utils",
"version": "5.1.0",
"description": "ICSS utils for postcss ast",
"main": "src/index.js",
"engines": {
"node": "^10 || ^12 || >= 14"
},
"files": [
"src"
],
"scripts": {
"prettier": "prettier -l --ignore-path .gitignore . \"!test/test-cases\"",
"eslint": "eslint --ignore-path .gitignore .",
"lint": "yarn eslint && yarn prettier",
"test:only": "jest",
"test:watch": "jest --watch",
"test:coverage": "jest --coverage --collectCoverageFrom=\"src/**/*\"",
"pretest": "yarn lint",
"test": "yarn test:coverage",
"prepublishOnly": "yarn test"
},
"repository": {
"type": "git",
"url": "git+https://github.com/css-modules/icss-utils.git"
},
"keywords": [
"css",
"modules",
"icss",
"postcss"
],
"author": "Glen Maddern",
"license": "ISC",
"bugs": {
"url": "https://github.com/css-modules/icss-utils/issues"
},
"homepage": "https://github.com/css-modules/icss-utils#readme",
"devDependencies": {
"coveralls": "^3.1.0",
"eslint": "^7.9.0",
"eslint-config-prettier": "^6.12.0",
"husky": "^4.3.0",
"jest": "^26.4.2",
"lint-staged": "^10.4.0",
"postcss": "^8.1.0",
"prettier": "^2.1.2"
},
"peerDependencies": {
"postcss": "^8.1.0"
}
}

View file

@ -0,0 +1,67 @@
const createImports = (imports, postcss, mode = "rule") => {
return Object.keys(imports).map((path) => {
const aliases = imports[path];
const declarations = Object.keys(aliases).map((key) =>
postcss.decl({
prop: key,
value: aliases[key],
raws: { before: "\n " },
})
);
const hasDeclarations = declarations.length > 0;
const rule =
mode === "rule"
? postcss.rule({
selector: `:import('${path}')`,
raws: { after: hasDeclarations ? "\n" : "" },
})
: postcss.atRule({
name: "icss-import",
params: `'${path}'`,
raws: { after: hasDeclarations ? "\n" : "" },
});
if (hasDeclarations) {
rule.append(declarations);
}
return rule;
});
};
const createExports = (exports, postcss, mode = "rule") => {
const declarations = Object.keys(exports).map((key) =>
postcss.decl({
prop: key,
value: exports[key],
raws: { before: "\n " },
})
);
if (declarations.length === 0) {
return [];
}
const rule =
mode === "rule"
? postcss.rule({
selector: `:export`,
raws: { after: "\n" },
})
: postcss.atRule({
name: "icss-export",
raws: { after: "\n" },
});
rule.append(declarations);
return [rule];
};
const createICSSRules = (imports, exports, postcss, mode) => [
...createImports(imports, postcss, mode),
...createExports(exports, postcss, mode),
];
module.exports = createICSSRules;

76
assets_old/node_modules/icss-utils/src/extractICSS.js generated vendored Normal file
View file

@ -0,0 +1,76 @@
const importPattern = /^:import\(("[^"]*"|'[^']*'|[^"']+)\)$/;
const balancedQuotes = /^("[^"]*"|'[^']*'|[^"']+)$/;
const getDeclsObject = (rule) => {
const object = {};
rule.walkDecls((decl) => {
const before = decl.raws.before ? decl.raws.before.trim() : "";
object[before + decl.prop] = decl.value;
});
return object;
};
/**
*
* @param {string} css
* @param {boolean} removeRules
* @param {'auto' | 'rule' | 'at-rule'} mode
*/
const extractICSS = (css, removeRules = true, mode = "auto") => {
const icssImports = {};
const icssExports = {};
function addImports(node, path) {
const unquoted = path.replace(/'|"/g, "");
icssImports[unquoted] = Object.assign(
icssImports[unquoted] || {},
getDeclsObject(node)
);
if (removeRules) {
node.remove();
}
}
function addExports(node) {
Object.assign(icssExports, getDeclsObject(node));
if (removeRules) {
node.remove();
}
}
css.each((node) => {
if (node.type === "rule" && mode !== "at-rule") {
if (node.selector.slice(0, 7) === ":import") {
const matches = importPattern.exec(node.selector);
if (matches) {
addImports(node, matches[1]);
}
}
if (node.selector === ":export") {
addExports(node);
}
}
if (node.type === "atrule" && mode !== "rule") {
if (node.name === "icss-import") {
const matches = balancedQuotes.exec(node.params);
if (matches) {
addImports(node, matches[1]);
}
}
if (node.name === "icss-export") {
addExports(node);
}
}
});
return { icssImports, icssExports };
};
module.exports = extractICSS;

11
assets_old/node_modules/icss-utils/src/index.js generated vendored Normal file
View file

@ -0,0 +1,11 @@
const replaceValueSymbols = require("./replaceValueSymbols.js");
const replaceSymbols = require("./replaceSymbols.js");
const extractICSS = require("./extractICSS.js");
const createICSSRules = require("./createICSSRules.js");
module.exports = {
replaceValueSymbols,
replaceSymbols,
extractICSS,
createICSSRules,
};

View file

@ -0,0 +1,18 @@
const replaceValueSymbols = require("./replaceValueSymbols.js");
const replaceSymbols = (css, replacements) => {
css.walk((node) => {
if (node.type === "decl" && node.value) {
node.value = replaceValueSymbols(node.value.toString(), replacements);
} else if (node.type === "rule" && node.selector) {
node.selector = replaceValueSymbols(
node.selector.toString(),
replacements
);
} else if (node.type === "atrule" && node.params) {
node.params = replaceValueSymbols(node.params.toString(), replacements);
}
});
};
module.exports = replaceSymbols;

View file

@ -0,0 +1,22 @@
const matchValueName = /[$]?[\w-]+/g;
const replaceValueSymbols = (value, replacements) => {
let matches;
while ((matches = matchValueName.exec(value))) {
const replacement = replacements[matches[0]];
if (replacement) {
value =
value.slice(0, matches.index) +
replacement +
value.slice(matchValueName.lastIndex);
matchValueName.lastIndex -= matches[0].length - replacement.length;
}
}
return value;
};
module.exports = replaceValueSymbols;