progress on migrating to heex templates and font-icons
This commit is contained in:
parent
d43daafdb7
commit
3eff955672
21793 changed files with 2161968 additions and 16895 deletions
assets_old/node_modules/posthtml-rename-id
98
assets_old/node_modules/posthtml-rename-id/CHANGELOG.md
generated
vendored
Normal file
98
assets_old/node_modules/posthtml-rename-id/CHANGELOG.md
generated
vendored
Normal file
|
@ -0,0 +1,98 @@
|
|||
# Change Log
|
||||
|
||||
All notable changes to this project will be documented in this file.
|
||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||
|
||||
## [1.0.12](https://github.com/JetBrains/svg-mixer/compare/posthtml-rename-id@1.0.11...posthtml-rename-id@1.0.12) (2020-04-03)
|
||||
|
||||
**Note:** Version bump only for package posthtml-rename-id
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<a name="1.0.11"></a>
|
||||
## [1.0.11](https://github.com/JetBrains/svg-mixer/compare/posthtml-rename-id@1.0.10...posthtml-rename-id@1.0.11) (2018-12-05)
|
||||
|
||||
|
||||
|
||||
|
||||
**Note:** Version bump only for package posthtml-rename-id
|
||||
|
||||
<a name="1.0.10"></a>
|
||||
## [1.0.10](https://github.com/JetBrains/svg-mixer/compare/posthtml-rename-id@1.0.9...posthtml-rename-id@1.0.10) (2018-10-29)
|
||||
|
||||
|
||||
|
||||
|
||||
**Note:** Version bump only for package posthtml-rename-id
|
||||
|
||||
<a name="1.0.9"></a>
|
||||
## [1.0.9](https://github.com/kisenka/svg-mixer/packages/posthtml-rename-id/compare/posthtml-rename-id@1.0.8...posthtml-rename-id@1.0.9) (2018-10-29)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* refer to license file in readme ([e34a289](https://github.com/kisenka/svg-mixer/packages/posthtml-rename-id/commit/e34a289))
|
||||
|
||||
|
||||
|
||||
|
||||
<a name="1.0.8"></a>
|
||||
## [1.0.8](https://github.com/kisenka/svg-mixer/packages/posthtml-rename-id/compare/posthtml-rename-id@1.0.7...posthtml-rename-id@1.0.8) (2018-06-18)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* handle `for` attr in label tag ([769fb73](https://github.com/kisenka/svg-mixer/packages/posthtml-rename-id/commit/769fb73)), closes [#27](https://github.com/kisenka/svg-mixer/packages/posthtml-rename-id/issues/27)
|
||||
|
||||
|
||||
|
||||
|
||||
<a name="1.0.7"></a>
|
||||
## [1.0.7](https://github.com/kisenka/svg-mixer/packages/posthtml-rename-id/compare/posthtml-rename-id@1.0.6...posthtml-rename-id@1.0.7) (2018-05-11)
|
||||
|
||||
|
||||
|
||||
|
||||
**Note:** Version bump only for package posthtml-rename-id
|
||||
|
||||
<a name="1.0.6"></a>
|
||||
## [1.0.6](https://github.com/kisenka/svg-mixer/packages/posthtml-rename-id/compare/posthtml-rename-id@1.0.5...posthtml-rename-id@1.0.6) (2018-04-28)
|
||||
|
||||
|
||||
|
||||
|
||||
**Note:** Version bump only for package posthtml-rename-id
|
||||
|
||||
<a name="1.0.5"></a>
|
||||
## [1.0.5](https://github.com/kisenka/svg-mixer/packages/posthtml-rename-id/compare/posthtml-rename-id@1.0.4...posthtml-rename-id@1.0.5) (2018-04-21)
|
||||
|
||||
|
||||
|
||||
|
||||
**Note:** Version bump only for package posthtml-rename-id
|
||||
|
||||
<a name="1.0.4"></a>
|
||||
## [1.0.4](https://github.com/kisenka/svg-baker/packages/posthtml-rename-id/compare/posthtml-rename-id@1.0.4-alpha.0...posthtml-rename-id@1.0.4) (2018-04-13)
|
||||
|
||||
|
||||
|
||||
|
||||
**Note:** Version bump only for package posthtml-rename-id
|
||||
|
||||
<a name="1.0.4-alpha.0"></a>
|
||||
## [1.0.4-alpha.0](https://github.com/kisenka/svg-baker/packages/posthtml-rename-id/compare/posthtml-rename-id@1.0.3...posthtml-rename-id@1.0.4-alpha.0) (2018-04-09)
|
||||
|
||||
|
||||
|
||||
|
||||
**Note:** Version bump only for package posthtml-rename-id
|
||||
|
||||
<a name="1.0.3"></a>
|
||||
## 1.0.3 (2017-05-16)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* symboId not prepended to clipPath IDs in url(...) ([9e685b4](https://github.com/kisenka/svg-baker/packages/posthtml-rename-id/commit/9e685b4))
|
18
assets_old/node_modules/posthtml-rename-id/LICENSE
generated
vendored
Normal file
18
assets_old/node_modules/posthtml-rename-id/LICENSE
generated
vendored
Normal file
|
@ -0,0 +1,18 @@
|
|||
Copyright 2018 JetBrains s.r.o.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
this software and associated documentation files (the "Software"), to deal in
|
||||
the Software without restriction, including without limitation the rights to use,
|
||||
copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
|
||||
Software, and to permit persons to whom the Software is furnished to do so,
|
||||
subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
85
assets_old/node_modules/posthtml-rename-id/README.md
generated
vendored
Normal file
85
assets_old/node_modules/posthtml-rename-id/README.md
generated
vendored
Normal file
|
@ -0,0 +1,85 @@
|
|||
# posthtml-rename-id
|
||||
|
||||
[PostHTML](https://github.com/posthtml/posthtml) plugin to rename id attributes
|
||||
and it's references. Inspired by [grunt-svgstore](https://github.com/FWeinb/grunt-svgstore).
|
||||
|
||||
Handle following cases:
|
||||
|
||||
- `href="#id"` and `xlink:href="#id"`
|
||||
- `style` attribute values like `style="fill: url(#id)"`
|
||||
- `<style>` tag values like `.selector {fill: url(#id)"}`
|
||||
- any other attribute value like `attr="url(#id)"`
|
||||
|
||||
## Demo
|
||||
|
||||
Input
|
||||
```html
|
||||
<style>
|
||||
.selector {fill: url(#qwe)}
|
||||
</style>
|
||||
|
||||
<div id="qwe"></div>
|
||||
<a href="#qwe"></a>
|
||||
```
|
||||
|
||||
Output
|
||||
```html
|
||||
<style>
|
||||
.selector {fill: url(#prefix_qwe)}
|
||||
</style>
|
||||
|
||||
<div id="prefix_qwe"></div>
|
||||
<a href="#prefix_qwe"></a>
|
||||
```
|
||||
|
||||
## Install
|
||||
|
||||
```sh
|
||||
npm install posthtml-rename-id
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
const posthtml = require('posthtml');
|
||||
const rename = require('posthtml-rename-id');
|
||||
|
||||
posthtml()
|
||||
.use(rename('prefix_[id]'))
|
||||
.process('<div id="qwe"></div> <a href="#qwe"></a>')
|
||||
.then(({ html }) => {
|
||||
console.log(html); // <div id="prefix_qwe"></div> <a href="#prefix_qwe"></a>
|
||||
});
|
||||
```
|
||||
|
||||
## Configuration
|
||||
|
||||
### `pattern`
|
||||
|
||||
> Type: `string | function`<br>
|
||||
> Default: `'[id]'`
|
||||
|
||||
Renaming pattern. `[id]` placeholder can be used as current id of an element.
|
||||
If `pattern` provided as a function it will be called with current id as first argument.
|
||||
Function should return the new id as string (`[id]` can be used as well).
|
||||
|
||||
## Examples
|
||||
|
||||
Uppercase all ids:
|
||||
```js
|
||||
posthtml([
|
||||
renameId(id => id.toUpperCase())
|
||||
]);
|
||||
```
|
||||
|
||||
Rename all ids to `elem_{counter}`:
|
||||
```js
|
||||
let c = 0;
|
||||
posthtml([
|
||||
renameId((id) => { c++; return 'elem_' + c; })
|
||||
]);
|
||||
```
|
||||
|
||||
## LICENSE
|
||||
|
||||
[MIT](https://github.com/JetBrains/svg-mixer/blob/master/LICENSE)
|
119
assets_old/node_modules/posthtml-rename-id/index.js
generated
vendored
Normal file
119
assets_old/node_modules/posthtml-rename-id/index.js
generated
vendored
Normal file
|
@ -0,0 +1,119 @@
|
|||
/* eslint-disable no-cond-assign, default-case */
|
||||
const escapeForRegexp = require('escape-string-regexp');
|
||||
|
||||
const URL_PATTERN = /url\(#([^ ]+?)\s*\)/g;
|
||||
const defaultPattern = '[id]';
|
||||
|
||||
/**
|
||||
* @param {string} id
|
||||
* @param {string|Function} pattern
|
||||
*/
|
||||
function renameId(id, pattern) {
|
||||
const result = (typeof pattern === 'function' ? pattern(id) : pattern).toString();
|
||||
const re = new RegExp(escapeForRegexp('[id]'), 'g');
|
||||
return result.replace(re, id);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string|Function} [pattern]
|
||||
* @returns {Function}
|
||||
*/
|
||||
function plugin(pattern) {
|
||||
const p = pattern || defaultPattern;
|
||||
|
||||
return (tree) => {
|
||||
const mappedIds = {};
|
||||
|
||||
tree.match({ attrs: { id: /.*/ } }, (node) => {
|
||||
const { attrs } = node;
|
||||
const currentId = attrs.id;
|
||||
const newId = renameId(currentId, p);
|
||||
attrs.id = newId;
|
||||
|
||||
mappedIds[currentId] = {
|
||||
id: newId,
|
||||
referenced: false,
|
||||
node
|
||||
};
|
||||
|
||||
return node;
|
||||
});
|
||||
|
||||
tree.match({ tag: /.*/ }, (node) => {
|
||||
const { attrs } = node;
|
||||
|
||||
if (node.tag === 'style') {
|
||||
while (true) {
|
||||
const content = Array.isArray(node.content) ? node.content.join('') : node.content.toString();
|
||||
const match = URL_PATTERN.exec(content);
|
||||
if (match === null) {
|
||||
break;
|
||||
}
|
||||
|
||||
const id = match[1];
|
||||
if (mappedIds[id]) {
|
||||
mappedIds[id].referenced = true;
|
||||
const re = new RegExp(escapeForRegexp(match[0]), 'g');
|
||||
node.content = content.replace(re, `url(#${mappedIds[id].id})`);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ('attrs' in node === false) {
|
||||
return node;
|
||||
}
|
||||
|
||||
Object.keys(attrs).forEach((attrName) => {
|
||||
const value = attrs[attrName];
|
||||
let id;
|
||||
let match;
|
||||
|
||||
while ((match = URL_PATTERN.exec(value)) !== null) {
|
||||
id = match[1];
|
||||
if (mappedIds[id]) {
|
||||
mappedIds[id].referenced = true;
|
||||
const re = new RegExp(escapeForRegexp(match[0]), 'g');
|
||||
attrs[attrName] = value.replace(re, `url(#${mappedIds[id].id})`);
|
||||
}
|
||||
}
|
||||
|
||||
let idObj;
|
||||
|
||||
switch (attrName) {
|
||||
case 'href':
|
||||
case 'xlink:href':
|
||||
if (value.substring(0, 1) !== '#') {
|
||||
break;
|
||||
}
|
||||
|
||||
id = value.substring(1);
|
||||
idObj = mappedIds[id];
|
||||
if (idObj) {
|
||||
idObj.referenced = false;
|
||||
attrs[attrName] = `#${idObj.id}`;
|
||||
}
|
||||
break;
|
||||
|
||||
case 'for':
|
||||
if (node.tag !== 'label') {
|
||||
break;
|
||||
}
|
||||
|
||||
id = value;
|
||||
idObj = mappedIds[id];
|
||||
if (idObj) {
|
||||
idObj.referenced = false;
|
||||
attrs[attrName] = idObj.id;
|
||||
}
|
||||
break;
|
||||
}
|
||||
});
|
||||
|
||||
return node;
|
||||
});
|
||||
|
||||
return tree;
|
||||
};
|
||||
}
|
||||
|
||||
module.exports = plugin;
|
20
assets_old/node_modules/posthtml-rename-id/package.json
generated
vendored
Normal file
20
assets_old/node_modules/posthtml-rename-id/package.json
generated
vendored
Normal file
|
@ -0,0 +1,20 @@
|
|||
{
|
||||
"name": "posthtml-rename-id",
|
||||
"version": "1.0.12",
|
||||
"description": "PostHTML plugin to rename id attributes and it's references",
|
||||
"keywords": [
|
||||
"posthtml",
|
||||
"posthtml plugin"
|
||||
],
|
||||
"license": "MIT",
|
||||
"author": "JetBrains",
|
||||
"homepage": "https://github.com/JetBrains/svg-mixer/tree/master/packages/posthtml-rename-id",
|
||||
"repository": "https://github.com/JetBrains/svg-mixer",
|
||||
"files": [
|
||||
"index.js"
|
||||
],
|
||||
"dependencies": {
|
||||
"escape-string-regexp": "1.0.5"
|
||||
},
|
||||
"gitHead": "eb37ef4bcbf7a24173b76319cfa2f299b60ae6dd"
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue