Compare commits

...
5 Commits
Author SHA1 Message Date
Adam Bradley 7f96d8c725 5.2.2 2020-10-07 14:26:08 -05:00
Adam Bradley 7666f2d97a use np for release 2020-10-07 14:25:13 -05:00
Adam Bradley b73bb075fd update property docs 2020-10-07 14:24:56 -05:00
Ben 486ae96765 Fix unlink icons 2020-10-07 10:36:31 -05:00
Adam Bradley eca4c14f05 feat(sanitize): opt-out of sanitizing http fetch svg content 2020-10-07 09:03:20 -05:00
14 changed files with 1820 additions and 508 deletions
+1579 -4
View File
File diff suppressed because it is too large Load Diff
+5 -5
View File
@@ -1,6 +1,6 @@
{
"name": "ionicons",
"version": "5.2.1",
"version": "5.2.2",
"description": "Premium icons for Ionic.",
"files": [
"dist/",
@@ -18,9 +18,7 @@
"build.component": "stencil build",
"collection.copy": "node scripts/collection-copy.js",
"start": "stencil build --dev --watch --serve",
"changelog": "conventional-changelog -p angular -i CHANGELOG.md -s",
"release.prepare": "node scripts/release.js --any-branch",
"release": "node scripts/release.js --publish --any-branch",
"release": "npm run build && np --no-2fa",
"test": "stencil test --spec"
},
"devDependencies": {
@@ -39,6 +37,7 @@
"jest": "26.5.0",
"jest-cli": "26.5.0",
"listr": "^0.14.3",
"np": "^6.5.0",
"svgo": "1.3.2"
},
"keywords": [
@@ -74,5 +73,6 @@
"license": "MIT",
"sideEffects": [
"icons/imports/"
]
],
"dependencies": {}
}
-285
View File
@@ -1,285 +0,0 @@
import fs from 'fs-extra';
import {join} from 'path';
import execa from 'execa';
import inquirer from 'inquirer';
import Listr, { ListrTask } from 'listr';
import semver from 'semver';
const rootDir = join(__dirname, '..');
const packageJsonPath = join(rootDir, 'package.json');
const packageLockJsonPath = join(rootDir, 'package-lock.json');
const cmdArgs = process.argv.slice(2);
const isPublishRelease = cmdArgs.includes('--publish');
const isDryRun = cmdArgs.includes('--dry-run');
const isAnyBranch = cmdArgs.includes('--any-branch');
const isYolo = cmdArgs.includes('--yolo');
function runTasks(newVersion: string, releaseTag: string, isPublishRelease: boolean) {
const pkg = readPkg();
const tasks: ListrTask[] = [];
tasks.push(
{
title: 'Check current branch',
task: () => execa('git', ['symbolic-ref', '--short', 'HEAD']).then(({stdout}) => {
if (stdout !== 'master') {
if (isAnyBranch) {
console.log(`Not on "master" branch, currently on "${stdout}".`);
} else {
throw new Error(`Not on "master" branch, currently on "${stdout}". Use --any-branch to publish anyway.`);
}
}
})
},
{
title: 'Check local working tree',
task: () => execa('git', ['status', '--porcelain']).then(({stdout}) => {
if (stdout !== '') {
if (isYolo) {
console.log('Unclean working tree.');
} else {
throw new Error('Unclean working tree. Commit or stash changes first.');
}
}
})
},
{
title: 'Check remote history',
task: () => execa('git', ['rev-list', '--count', '--left-only', '@{u}...HEAD']).then(({stdout}) => {
if (stdout !== '0') {
if (isAnyBranch) {
console.log('Remote history differs.');
} else {
throw new Error('Remote history differs. Please pull changes.');
}
}
})
}
);
if (!isPublishRelease) {
tasks.push(
{
title: `Set package.json version to ${newVersion}`,
task: () => {
const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, 'utf8'));
packageJson.version = newVersion;
fs.writeFileSync(packageJsonPath, JSON.stringify(packageJson, null, 2) + '\n');
const packageLockJson = JSON.parse(fs.readFileSync(packageLockJsonPath, 'utf8'));
packageLockJson.version = newVersion;
fs.writeFileSync(packageLockJsonPath, JSON.stringify(packageLockJson, null, 2) + '\n');
}
},
{
title: `Build`,
task: () => execa('npm', ['run', 'build'], { cwd: rootDir })
},
{
title: 'Run tests',
task: () => execa('npm', ['test'], { cwd: rootDir })
},
{
title: `Generate Changelog`,
task: () => execa('npm', ['run', 'changelog'], { cwd: rootDir }),
}
);
}
if (isPublishRelease) {
tasks.push(
{
title: `Publish ionicons ${newVersion} (${releaseTag})`,
task: () => {
const args = ['publish'].concat(releaseTag ? ['--tag', releaseTag] : []);
if (isDryRun) {
console.log('[dry-run] npm', args.join(' '));
} else {
return execa('npm', args, { cwd: rootDir });
}
}
},
{
title: 'Tagging the latest commit',
task: () => {
const args = ['tag', `v${newVersion}`];
if (isDryRun) {
console.log('[dry-run] git', args.join(' '));
} else {
return execa('git', args, { cwd: rootDir });
}
}
},
{
title: 'Pushing to Github',
task: () => {
const args = ['push', '--follow-tags'];
if (isDryRun) {
console.log('[dry-run] git', args.join(' '));
} else {
return execa('git', args, { cwd: rootDir });
}
}
}
);
}
const listr = new Listr(tasks);
listr.run()
.then(() => {
if (isPublishRelease) {
console.log(`\n ${pkg.name} ${newVersion} published!! 🎉\n`);
} else {
console.log(`\n ${pkg.name} ${newVersion} prepared, check the diffs and commit 🕵️\n`);
}
})
.catch(err => {
console.error(err);
process.exit(0);
});
}
async function prepareUI() {
const pkg = readPkg();
const oldVersion = pkg.version;
console.log(`\nPrepare to publish ${pkg.name} (currently ${oldVersion}) ${isDryRun ? '[dry-run]' : ''}\n`);
const prompts = [
{
type: 'list',
name: 'version',
message: 'Select semver increment or specify new version',
pageSize: SEMVER_INCREMENTS.length + 2,
choices: SEMVER_INCREMENTS
.map(inc => ({
name: `${inc} ${prettyVersionDiff(oldVersion, inc)}`,
value: inc
})),
filter: (input: any) => isValidVersionInput(input) ? getNewVersion(oldVersion, input) : input
},
{
type: 'confirm',
name: 'confirm',
message: (answers: any) => {
return `Prepare release ${answers.version}. Continue?`;
}
}
];
await inquirer
.prompt(prompts)
.then(answers => {
if (answers.confirm){
const newVersion = answers.version;
return runTasks(newVersion, null, false);
}
})
.catch(err => {
console.error(err);
process.exit(0);
});
}
async function publishUI() {
const pkg = readPkg();
console.log(`\nPublish ${pkg.name} ${pkg.version} ${isDryRun ? '[dry-run]' : ''}\n`);
const prompts = [
{
type: 'list',
name: 'tag',
message: 'How should this release version be tagged in npm?',
choices: () => execa('npm', ['view', '--json', pkg.name, 'dist-tags'])
.then(({stdout}) => {
return Object.keys(JSON.parse(stdout))
.map(tag => {
return {
name: tag,
value: tag
}
});
})
},
{
type: 'confirm',
name: 'confirm',
message: (answers: any) => {
return `Will publish ${pkg.name} ${pkg.version} and tag this release as "${answers.tag}". Continue?`;
}
}
];
await inquirer
.prompt(prompts)
.then(answers => {
if (answers.confirm){
return runTasks(pkg.version, answers.tag, true);
}
})
.catch(err => {
console.error(err);
process.exit(0);
});
}
const SEMVER_INCREMENTS = ['patch', 'minor', 'major', 'prepatch', 'preminor', 'premajor', 'prerelease'];
const PRERELEASE_VERSIONS = ['prepatch', 'preminor', 'premajor', 'prerelease'];
const isValidVersion = (input: string) => Boolean(semver.valid(input));
const isValidVersionInput = (input: string) => SEMVER_INCREMENTS.indexOf(input) !== -1 || isValidVersion(input);
const isPrereleaseVersion = (version: string) => PRERELEASE_VERSIONS.indexOf(version) !== -1 || Boolean(semver.prerelease(version));
function getNewVersion(oldVersion: string, input: any): string {
if (!isValidVersionInput(input)) {
throw new Error(`Version should be either ${SEMVER_INCREMENTS.join(', ')} or a valid semver version.`);
}
return SEMVER_INCREMENTS.indexOf(input) === -1 ? input : semver.inc(oldVersion, input);
};
const readPkg = (): any => JSON.parse(fs.readFileSync(packageJsonPath, 'utf8'));
function prettyVersionDiff(oldVersion: any, inc: any) {
const newVersion = getNewVersion(oldVersion, inc).split('.');
oldVersion = oldVersion.split('.');
let firstVersionChange = false;
const output = [];
for (let i = 0; i < newVersion.length; i++) {
if ((newVersion[i] !== oldVersion[i] && !firstVersionChange)) {
output.push(newVersion[i]);
firstVersionChange = true;
} else if (newVersion[i].indexOf('-') >= 1) {
let preVersion = [];
preVersion = newVersion[i].split('-');
output.push(`${preVersion[0]}-${preVersion[1]}`);
} else {
output.push(newVersion[i]);
}
}
return output.join('.');
}
(async () => {
try {
if (isPublishRelease) {
await publishUI();
} else {
await prepareUI();
}
} catch (e) {
console.error(e);
process.exit(1);
}
})();
+10
View File
@@ -47,6 +47,11 @@ export namespace Components {
* Specifies which icon to use from the built-in set of icons.
*/
"name"?: string;
/**
* When set to `false`, SVG content that is HTTP fetched will not be checked if the response SVG content has any `<script>` elements, or any attributes that start with `on`, such as `onclick`.
* @default true
*/
"sanitize": boolean;
/**
* The size of the icon. Available options are: `"small"` and `"large"`.
*/
@@ -110,6 +115,11 @@ declare namespace LocalJSX {
* Specifies which icon to use from the built-in set of icons.
*/
"name"?: string;
/**
* When set to `false`, SVG content that is HTTP fetched will not be checked if the response SVG content has any `<script>` elements, or any attributes that start with `on`, such as `onclick`.
* @default true
*/
"sanitize"?: boolean;
/**
* The size of the icon. Available options are: `"small"` and `"large"`.
*/
+47 -30
View File
@@ -2,12 +2,11 @@ import { Build, Component, Element, Host, Prop, State, Watch, h } from '@stencil
import { getSvgContent, ioniconContent } from './request';
import { getName, getUrl } from './utils';
@Component({
tag: 'ion-icon',
assetsDir: 'svg',
styleUrl: 'icon.css',
shadow: true
shadow: true,
})
export class Icon {
private io?: IntersectionObserver;
@@ -35,7 +34,7 @@ export class Icon {
/**
* Set the icon to hidden, respectively `true`, to remove it from the accessibility tree.
*/
@Prop({reflect: true}) ariaHidden?: string;
@Prop({ reflect: true }) ariaHidden?: string;
/**
* Specifies which icon to use on `ios` mode.
@@ -81,6 +80,14 @@ export class Icon {
*/
@Prop() lazy = false;
/**
* When set to `false`, SVG content that is HTTP fetched will not be checked
* if the response SVG content has any `<script>` elements, or any attributes
* that start with `on`, such as `onclick`.
* @default true
*/
@Prop() sanitize = true;
connectedCallback() {
// purposely do not return the promise here because loading
// the svg file should not hold up loading the app
@@ -100,16 +107,18 @@ export class Icon {
private waitUntilVisible(el: HTMLElement, rootMargin: string, cb: () => void) {
if (Build.isBrowser && this.lazy && typeof window !== 'undefined' && (window as any).IntersectionObserver) {
const io = this.io = new (window as any).IntersectionObserver((data: IntersectionObserverEntry[]) => {
if (data[0].isIntersecting) {
io.disconnect();
this.io = undefined;
cb();
}
}, { rootMargin });
const io = (this.io = new (window as any).IntersectionObserver(
(data: IntersectionObserverEntry[]) => {
if (data[0].isIntersecting) {
io.disconnect();
this.io = undefined;
cb();
}
},
{ rootMargin },
));
io.observe(el);
} else {
// browser doesn't support IntersectionObserver
// so just fallback to always show it
@@ -117,7 +126,6 @@ export class Icon {
}
}
@Watch('name')
@Watch('src')
@Watch('icon')
@@ -130,7 +138,7 @@ export class Icon {
this.svgContent = ioniconContent.get(url);
} else {
// async if it hasn't been loaded
getSvgContent(url).then(() => this.svgContent = ioniconContent.get(url));
getSvgContent(url, this.sanitize).then(() => (this.svgContent = ioniconContent.get(url)));
}
}
}
@@ -147,31 +155,40 @@ export class Icon {
render() {
const mode = this.mode || 'md';
const flipRtl = this.flipRtl || (this.ariaLabel && (this.ariaLabel.indexOf('arrow') > -1 || this.ariaLabel.indexOf('chevron') > -1) && this.flipRtl !== false);
const flipRtl =
this.flipRtl ||
(this.ariaLabel &&
(this.ariaLabel.indexOf('arrow') > -1 || this.ariaLabel.indexOf('chevron') > -1) &&
this.flipRtl !== false);
return (
<Host role="img" class={{
[mode]: true,
...createColorClasses(this.color),
[`icon-${this.size}`]: !!this.size,
'flip-rtl': !!flipRtl && (this.el.ownerDocument as Document).dir === 'rtl'
}}>{(
(Build.isBrowser && this.svgContent)
? <div class="icon-inner" innerHTML={this.svgContent}></div>
: <div class="icon-inner"></div>
<Host
role="img"
class={{
[mode]: true,
...createColorClasses(this.color),
[`icon-${this.size}`]: !!this.size,
'flip-rtl': !!flipRtl && (this.el.ownerDocument as Document).dir === 'rtl',
}}
>
{Build.isBrowser && this.svgContent ? (
<div class="icon-inner" innerHTML={this.svgContent}></div>
) : (
<div class="icon-inner"></div>
)}
</Host>
);
}
}
const getIonMode = () => (Build.isBrowser && typeof document !== 'undefined' && document.documentElement.getAttribute('mode')) || 'md';
const getIonMode = () =>
(Build.isBrowser && typeof document !== 'undefined' && document.documentElement.getAttribute('mode')) || 'md';
const createColorClasses = (color: string | undefined) => {
return (color) ? {
'ion-color': true,
[`ion-color-${color}`]: true
} : null;
return color
? {
'ion-color': true,
[`ion-color-${color}`]: true,
}
: null;
};
+15 -14
View File
@@ -7,20 +7,21 @@
## Properties
| Property | Attribute | Description | Type | Default |
| ------------ | ------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ---------------------- | -------------- |
| `ariaHidden` | `aria-hidden` | Set the icon to hidden, respectively `true`, to remove it from the accessibility tree. | `string \| undefined` | `undefined` |
| `ariaLabel` | `aria-label` | Specifies the label to use for accessibility. Defaults to the icon name. | `string \| undefined` | `undefined` |
| `color` | `color` | The color to use for the background of the item. | `string \| undefined` | `undefined` |
| `flipRtl` | `flip-rtl` | Specifies whether the icon should horizontally flip when `dir` is `"rtl"`. | `boolean \| undefined` | `undefined` |
| `icon` | `icon` | A combination of both `name` and `src`. If a `src` url is detected it will set the `src` property. Otherwise it assumes it's a built-in named SVG and set the `name` property. | `any` | `undefined` |
| `ios` | `ios` | Specifies which icon to use on `ios` mode. | `string \| undefined` | `undefined` |
| `lazy` | `lazy` | If enabled, ion-icon will be loaded lazily when it's visible in the viewport. Default, `false`. | `boolean` | `false` |
| `md` | `md` | Specifies which icon to use on `md` mode. | `string \| undefined` | `undefined` |
| `mode` | `mode` | The mode determines which platform styles to use. | `string` | `getIonMode()` |
| `name` | `name` | Specifies which icon to use from the built-in set of icons. | `string \| undefined` | `undefined` |
| `size` | `size` | The size of the icon. Available options are: `"small"` and `"large"`. | `string \| undefined` | `undefined` |
| `src` | `src` | Specifies the exact `src` of an SVG file to use. | `string \| undefined` | `undefined` |
| Property | Attribute | Description | Type | Default |
| ------------ | ------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------- | -------------- |
| `ariaHidden` | `aria-hidden` | Set the icon to hidden, respectively `true`, to remove it from the accessibility tree. | `string \| undefined` | `undefined` |
| `ariaLabel` | `aria-label` | Specifies the label to use for accessibility. Defaults to the icon name. | `string \| undefined` | `undefined` |
| `color` | `color` | The color to use for the background of the item. | `string \| undefined` | `undefined` |
| `flipRtl` | `flip-rtl` | Specifies whether the icon should horizontally flip when `dir` is `"rtl"`. | `boolean \| undefined` | `undefined` |
| `icon` | `icon` | A combination of both `name` and `src`. If a `src` url is detected it will set the `src` property. Otherwise it assumes it's a built-in named SVG and set the `name` property. | `any` | `undefined` |
| `ios` | `ios` | Specifies which icon to use on `ios` mode. | `string \| undefined` | `undefined` |
| `lazy` | `lazy` | If enabled, ion-icon will be loaded lazily when it's visible in the viewport. Default, `false`. | `boolean` | `false` |
| `md` | `md` | Specifies which icon to use on `md` mode. | `string \| undefined` | `undefined` |
| `mode` | `mode` | The mode determines which platform styles to use. | `string` | `getIonMode()` |
| `name` | `name` | Specifies which icon to use from the built-in set of icons. | `string \| undefined` | `undefined` |
| `sanitize` | `sanitize` | When set to `false`, SVG content that is HTTP fetched will not be checked if the response SVG content has any `<script>` elements, or any attributes that start with `on`, such as `onclick`. | `boolean` | `true` |
| `size` | `size` | The size of the icon. Available options are: `"small"` and `"large"`. | `string \| undefined` | `undefined` |
| `src` | `src` | Specifies the exact `src` of an SVG file to use. | `string \| undefined` | `undefined` |
----------------------------------------------
+8 -7
View File
@@ -1,21 +1,22 @@
import { validateContent } from './validate';
export const ioniconContent = new Map<string, string>();
const requests = new Map<string, Promise<any>>();
export const getSvgContent = (url: string) => {
export const getSvgContent = (url: string, sanitize: boolean) => {
// see if we already have a request for this url
let req = requests.get(url);
if (!req) {
if (typeof fetch !== 'undefined') {
if (typeof fetch !== 'undefined' && typeof document !== 'undefined') {
// we don't already have a request
req = fetch(url).then(rsp => {
req = fetch(url).then((rsp) => {
if (rsp.ok) {
return rsp.text().then(svgContent => {
ioniconContent.set(url, validateContent(svgContent));
return rsp.text().then((svgContent) => {
if (svgContent && sanitize !== false) {
svgContent = validateContent(svgContent);
}
ioniconContent.set(url, svgContent || '');
});
}
ioniconContent.set(url, '');
+18 -22
View File
@@ -1,36 +1,32 @@
import { isStr } from './utils';
export const validateContent = (svgContent: string) => {
const div = document.createElement('div');
div.innerHTML = svgContent;
export const validateContent = (svgContent: string | null) => {
if (svgContent && typeof document !== 'undefined') {
const div = document.createElement('div');
div.innerHTML = svgContent;
// setup this way to ensure it works on our buddy IE
for (let i = div.childNodes.length - 1; i >= 0; i--) {
if (div.childNodes[i].nodeName.toLowerCase() !== 'svg') {
div.removeChild(div.childNodes[i]);
}
// setup this way to ensure it works on our buddy IE
for (let i = div.childNodes.length - 1; i >= 0; i--) {
if (div.childNodes[i].nodeName.toLowerCase() !== 'svg') {
div.removeChild(div.childNodes[i]);
}
}
// must only have 1 root element
const svgElm = div.firstElementChild;
if (svgElm && svgElm.nodeName.toLowerCase() === 'svg') {
const svgClass = svgElm.getAttribute('class') || '';
svgElm.setAttribute('class', (svgClass + ' s-ion-icon').trim());
// must only have 1 root element
const svgElm = div.firstElementChild;
if (svgElm && svgElm.nodeName.toLowerCase() === 'svg') {
const svgClass = svgElm.getAttribute('class') || '';
svgElm.setAttribute('class', (svgClass + ' s-ion-icon').trim());
// root element must be an svg
// lets double check we've got valid elements
// do not allow scripts
if (isValid(svgElm as any)) {
return div.innerHTML;
}
// root element must be an svg
// lets double check we've got valid elements
// do not allow scripts
if (isValid(svgElm as any)) {
return div.innerHTML;
}
}
return '';
};
export const isValid = (elm: HTMLElement) => {
if (elm.nodeType === 1) {
if (elm.nodeName.toLowerCase() === 'script') {
+1
View File
@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><script>alert('got ya')</script><path d="M0 0h24v24H0z" fill="none"/><path d="M20 8h-2.81c-.45-.78-1.07-1.45-1.82-1.96L17 4.41 15.59 3l-2.17 2.17C12.96 5.06 12.49 5 12 5c-.49 0-.96.06-1.41.17L8.41 3 7 4.41l1.62 1.63C7.88 6.55 7.26 7.22 6.81 8H4v2h2.09c-.05.33-.09.66-.09 1v1H4v2h2v1c0 .34.04.67.09 1H4v2h2.81c1.04 1.79 2.97 3 5.19 3s4.15-1.21 5.19-3H20v-2h-2.09c.05-.33.09-.66.09-1v-1h2v-2h-2v-1c0-.34-.04-.67-.09-1H20V8zm-6 8h-4v-2h4v2zm0-4h-4v-2h4v2z"/></svg>

After

Width:  |  Height:  |  Size: 544 B

+1
View File
@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><script>alert('got ya')</script><path d="M0 0h24v24H0z" fill="none"/><path d="M20 8h-2.81c-.45-.78-1.07-1.45-1.82-1.96L17 4.41 15.59 3l-2.17 2.17C12.96 5.06 12.49 5 12 5c-.49 0-.96.06-1.41.17L8.41 3 7 4.41l1.62 1.63C7.88 6.55 7.26 7.22 6.81 8H4v2h2.09c-.05.33-.09.66-.09 1v1H4v2h2v1c0 .34.04.67.09 1H4v2h2.81c1.04 1.79 2.97 3 5.19 3s4.15-1.21 5.19-3H20v-2h-2.09c.05-.33.09-.66.09-1v-1h2v-2h-2v-1c0-.34-.04-.67-.09-1H20V8zm-6 8h-4v-2h4v2zm0-4h-4v-2h4v2z"/></svg>

After

Width:  |  Height:  |  Size: 544 B

+133 -129
View File
@@ -1,157 +1,161 @@
<!DOCTYPE html>
<html dir="ltr" lang="en" mode="ios">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=5.0" />
<title>Ionicons Icon Component</title>
<script type="module" src="/build/ionicons.esm.js"></script>
<script nomodule src="/build/ionicons.js"></script>
</head>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=5.0">
<title>Ionicons Icon Component</title>
<script type="module" src="/build/ionicons.esm.js"></script>
<script nomodule src="/build/ionicons.js"></script>
</head>
<body>
<h1>Ionicons</h1>
<body>
<h2>Default</h2>
<ion-icon name="cellular"></ion-icon>
<ion-icon name="at"></ion-icon>
<ion-icon name="call"></ion-icon>
<ion-icon name="football"></ion-icon>
<ion-icon name="analytics"></ion-icon>
<ion-icon name="grid"></ion-icon>
<ion-icon name="funnel"></ion-icon>
<ion-icon name="watch"></ion-icon>
<ion-icon name="add-circle-outline"></ion-icon>
<h1>Ionicons</h1>
<h2>Mode from html ios mode attribute</h2>
<ion-icon md="logo-android" ios="logo-apple"></ion-icon>
<ion-icon md="logo-android" ios="logo-apple"></ion-icon>
<h2>Default</h2>
<ion-icon name="cellular"></ion-icon>
<ion-icon name="at"></ion-icon>
<ion-icon name="call"></ion-icon>
<ion-icon name="football"></ion-icon>
<ion-icon name="analytics"></ion-icon>
<ion-icon name="grid"></ion-icon>
<ion-icon name="funnel"></ion-icon>
<ion-icon name="watch"></ion-icon>
<ion-icon name="add-circle-outline"></ion-icon>
<h2>Mode set on icon</h2>
<ion-icon mode="ios" md="logo-android" ios="logo-apple"></ion-icon>
<ion-icon mode="md" md="logo-android" ios="logo-apple"></ion-icon>
<h2>Mode from html ios mode attribute</h2>
<ion-icon md="logo-android" ios="logo-apple"></ion-icon>
<ion-icon md="logo-android" ios="logo-apple"></ion-icon>
<h2>Colors</h2>
<ion-icon color="primary" name="cellular"></ion-icon>
<ion-icon color="secondary" name="at"></ion-icon>
<ion-icon color="tertiary" name="call"></ion-icon>
<ion-icon color="success" name="football"></ion-icon>
<ion-icon color="warning" name="analytics"></ion-icon>
<ion-icon color="danger" name="grid"></ion-icon>
<ion-icon color="light" name="funnel"></ion-icon>
<ion-icon color="medium" name="watch"></ion-icon>
<ion-icon color="dark" name="toggle"></ion-icon>
<h2>Mode set on icon</h2>
<ion-icon mode="ios" md="logo-android" ios="logo-apple"></ion-icon>
<ion-icon mode="md" md="logo-android" ios="logo-apple"></ion-icon>
<h2>Stroke width</h2>
<ion-icon name="heart-outline" style="--ionicon-stroke-width: 8px"></ion-icon>
<h2>Colors</h2>
<ion-icon color="primary" name="cellular"></ion-icon>
<ion-icon color="secondary" name="at"></ion-icon>
<ion-icon color="tertiary" name="call"></ion-icon>
<ion-icon color="success" name="football"></ion-icon>
<ion-icon color="warning" name="analytics"></ion-icon>
<ion-icon color="danger" name="grid"></ion-icon>
<ion-icon color="light" name="funnel"></ion-icon>
<ion-icon color="medium" name="watch"></ion-icon>
<ion-icon color="dark" name="toggle"></ion-icon>
<h2>Font size</h2>
<ion-icon name="book" style="font-size: 50px"></ion-icon>
<ion-icon src="./assets/bug_report.svg" style="font-size: 50px"></ion-icon>
<h2>Stroke width</h2>
<ion-icon name="heart-outline" style="--ionicon-stroke-width: 8px;"></ion-icon>
<h2>Custom SVGs</h2>
<ion-icon src="./assets/bug_report.svg"></ion-icon>
<ion-icon src="./assets/chat.svg"></ion-icon>
<ion-icon src="./assets/commute.svg"></ion-icon>
<ion-icon src="./assets/copyright.svg"></ion-icon>
<ion-icon src="./assets/done_all.svg"></ion-icon>
<ion-icon src="./assets/lock_open.svg"></ion-icon>
<ion-icon src="./assets/toll.svg"></ion-icon>
<ion-icon src="./assets/web_asset.svg"></ion-icon>
<ion-icon src="./assets/work_outline.svg"></ion-icon>
<h2>Font size</h2>
<ion-icon name="book" style="font-size: 50px;"></ion-icon>
<ion-icon src="./assets/bug_report.svg" style="font-size: 50px;"></ion-icon>
<h2>Custom SVGs: colors</h2>
<ion-icon color="primary" src="./assets/bug_report.svg"></ion-icon>
<ion-icon color="secondary" src="./assets/chat.svg"></ion-icon>
<ion-icon color="tertiary" src="./assets/commute.svg"></ion-icon>
<ion-icon color="success" src="./assets/copyright.svg"></ion-icon>
<ion-icon color="warning" src="./assets/done_all.svg"></ion-icon>
<ion-icon color="danger" src="./assets/lock_open.svg"></ion-icon>
<ion-icon color="light" src="./assets/toll.svg"></ion-icon>
<ion-icon color="medium" src="./assets/web_asset.svg"></ion-icon>
<ion-icon color="dark" src="./assets/work_outline.svg"></ion-icon>
<h2>Custom SVGs</h2>
<ion-icon src="./assets/bug_report.svg"></ion-icon>
<ion-icon src="./assets/chat.svg"></ion-icon>
<ion-icon src="./assets/commute.svg"></ion-icon>
<ion-icon src="./assets/copyright.svg"></ion-icon>
<ion-icon src="./assets/done_all.svg"></ion-icon>
<ion-icon src="./assets/lock_open.svg"></ion-icon>
<ion-icon src="./assets/toll.svg"></ion-icon>
<ion-icon src="./assets/web_asset.svg"></ion-icon>
<ion-icon src="./assets/work_outline.svg"></ion-icon>
<h2>Custom CSS</h2>
<ion-icon class="custom" name="grid"></ion-icon>
<ion-icon class="custom" name="funnel"></ion-icon>
<ion-icon class="custom" name="watch"></ion-icon>
<ion-icon class="custom" name="logo-react"></ion-icon>
<ion-icon class="custom" name="logo-javascript"></ion-icon>
<ion-icon class="custom" name="logo-angular"></ion-icon>
<ion-icon class="custom" src="./assets/done_all.svg"></ion-icon>
<ion-icon class="custom" src="./assets/web_asset.svg"></ion-icon>
<ion-icon class="custom" src="./assets/work_outline.svg"></ion-icon>
<h2>Custom SVGs: colors</h2>
<ion-icon color="primary" src="./assets/bug_report.svg"></ion-icon>
<ion-icon color="secondary" src="./assets/chat.svg"></ion-icon>
<ion-icon color="tertiary" src="./assets/commute.svg"></ion-icon>
<ion-icon color="success" src="./assets/copyright.svg"></ion-icon>
<ion-icon color="warning" src="./assets/done_all.svg"></ion-icon>
<ion-icon color="danger" src="./assets/lock_open.svg"></ion-icon>
<ion-icon color="light" src="./assets/toll.svg"></ion-icon>
<ion-icon color="medium" src="./assets/web_asset.svg"></ion-icon>
<ion-icon color="dark" src="./assets/work_outline.svg"></ion-icon>
<h2>Aria</h2>
<ion-icon name="cellular"></ion-icon>
<ion-icon name="cellular" aria-label="Mobile data"></ion-icon>
<ion-icon name="cellular" aria-hidden="true"></ion-icon>
<h2>Custom CSS</h2>
<ion-icon class="custom" name="grid"></ion-icon>
<ion-icon class="custom" name="funnel"></ion-icon>
<ion-icon class="custom" name="watch"></ion-icon>
<ion-icon class="custom" name="logo-react"></ion-icon>
<ion-icon class="custom" name="logo-javascript"></ion-icon>
<ion-icon class="custom" name="logo-angular"></ion-icon>
<ion-icon class="custom" src="./assets/done_all.svg"></ion-icon>
<ion-icon class="custom" src="./assets/web_asset.svg"></ion-icon>
<ion-icon class="custom" src="./assets/work_outline.svg"></ion-icon>
<h1>RTL</h1>
<h2>Aria</h2>
<ion-icon name="cellular"></ion-icon>
<ion-icon name="cellular" aria-label="Mobile data"></ion-icon>
<ion-icon name="cellular" aria-hidden="true"></ion-icon>
<h2>Default: Non-arrows</h2>
<ion-icon name="cut"></ion-icon>
<ion-icon name="call"></ion-icon>
<ion-icon name="checkbox"></ion-icon>
<ion-icon name="brush"></ion-icon>
<h1>RTL</h1>
<h2>Flip: Non-arrows</h2>
<ion-icon name="cut" flip-rtl></ion-icon>
<ion-icon name="call" flip-rtl></ion-icon>
<ion-icon name="checkbox" flip-rtl></ion-icon>
<ion-icon name="brush" flip-rtl></ion-icon>
<h2>Default: Non-arrows</h2>
<ion-icon name="cut"></ion-icon>
<ion-icon name="call"></ion-icon>
<ion-icon name="checkbox"></ion-icon>
<ion-icon name="brush"></ion-icon>
<h2>Auto Flip: arrows</h2>
<ion-icon name="arrow-up"></ion-icon>
<ion-icon name="arrow-forward"></ion-icon>
<ion-icon name="arrow-down"></ion-icon>
<ion-icon name="arrow-back"></ion-icon>
<h2>Flip: Non-arrows</h2>
<ion-icon name="cut" flip-rtl></ion-icon>
<ion-icon name="call" flip-rtl></ion-icon>
<ion-icon name="checkbox" flip-rtl></ion-icon>
<ion-icon name="brush" flip-rtl></ion-icon>
<h2>Un-flip: arrows</h2>
<ion-icon name="arrow-up" flip-rtl="false"></ion-icon>
<ion-icon name="arrow-forward" flip-rtl="false"></ion-icon>
<ion-icon name="arrow-down" flip-rtl="false"></ion-icon>
<ion-icon name="arrow-back" flip-rtl="false"></ion-icon>
<h2>Auto Flip: arrows</h2>
<ion-icon name="arrow-up"></ion-icon>
<ion-icon name="arrow-forward"></ion-icon>
<ion-icon name="arrow-down"></ion-icon>
<ion-icon name="arrow-back"></ion-icon>
<h2>Auto Flip: chevrons</h2>
<ion-icon name="chevron-up"></ion-icon>
<ion-icon name="chevron-forward"></ion-icon>
<ion-icon name="chevron-down"></ion-icon>
<ion-icon name="chevron-back"></ion-icon>
<h2>Un-flip: arrows</h2>
<ion-icon name="arrow-up" flip-rtl="false"></ion-icon>
<ion-icon name="arrow-forward" flip-rtl="false"></ion-icon>
<ion-icon name="arrow-down" flip-rtl="false"></ion-icon>
<ion-icon name="arrow-back" flip-rtl="false"></ion-icon>
<h2>Un-flip: chevrons</h2>
<ion-icon name="chevron-up" flip-rtl="false"></ion-icon>
<ion-icon name="chevron-forward" flip-rtl="false"></ion-icon>
<ion-icon name="chevron-down" flip-rtl="false"></ion-icon>
<ion-icon name="chevron-back" flip-rtl="false"></ion-icon>
<h2>Auto Flip: chevrons</h2>
<ion-icon name="chevron-up"></ion-icon>
<ion-icon name="chevron-forward"></ion-icon>
<ion-icon name="chevron-down"></ion-icon>
<ion-icon name="chevron-back"></ion-icon>
<h2>Sanitized (shouldn't show)</h2>
<ion-icon src="./assets/sanitize.svg"></ion-icon>
<h2>Un-flip: chevrons</h2>
<ion-icon name="chevron-up" flip-rtl="false"></ion-icon>
<ion-icon name="chevron-forward" flip-rtl="false"></ion-icon>
<ion-icon name="chevron-down" flip-rtl="false"></ion-icon>
<ion-icon name="chevron-back" flip-rtl="false"></ion-icon>
<h2>Not Sanitized (should show)</h2>
<ion-icon sanitize="false" src="./assets/no-sanitize.svg"></ion-icon>
<p>
<a href="./cheatsheet.html">Cheatsheet</a>
</p>
<p>
<a href="./cheatsheet.html">Cheatsheet</a>
</p>
<style>
body {
margin: 0;
padding: 16px;
font-size: 32px;
font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
}
<style>
body {
margin: 0;
padding: 16px;
font-size: 32px;
font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
}
h1 {
margin: 15px 0 5px;
font-size: 25px;
}
h1 {
margin: 15px 0 5px;
font-size: 25px;
}
h2 {
margin: 15px 0 5px;
font-size: 18px;
}
h2 {
margin: 15px 0 5px;
font-size: 18px;
}
.custom {
stroke: red;
fill: blue;
}
</style>
</body>
.custom {
stroke: red;
fill: blue;
}
</style>
</body>
</html>
+1 -4
View File
@@ -1,4 +1 @@
<svg width="512" height="512" viewBox="0 0 512 512" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M208 352H144C118.539 352 94.1212 341.886 76.1178 323.882C58.1143 305.879 48 281.461 48 256C48 230.539 58.1143 206.121 76.1178 188.118C94.1212 170.114 118.539 160 144 160H208" stroke="black" stroke-width="36" stroke-linecap="round" stroke-linejoin="round"/>
<path d="M304 160H368C393.461 160 417.879 170.114 435.882 188.118C453.886 206.121 464 230.539 464 256C464 281.461 453.886 305.879 435.882 323.882C417.879 341.886 393.461 352 368 352H304" stroke="black" stroke-width="36" stroke-linecap="round" stroke-linejoin="round"/>
</svg>
<svg id="icons" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path d="M208,352H144a96,96,0,0,1,0-192h64" fill="none" stroke="#000" stroke-linecap="round" stroke-linejoin="round" stroke-width="36"/><path d="M304,160h64a96,96,0,0,1,0,192H304" fill="none" stroke="#000" stroke-linecap="round" stroke-linejoin="round" stroke-width="36"/></svg>

Before

Width:  |  Height:  |  Size: 642 B

After

Width:  |  Height:  |  Size: 351 B

+1 -4
View File
@@ -1,4 +1 @@
<svg width="512" height="512" viewBox="0 0 512 512" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M200.66 352H144C118.539 352 94.1212 341.886 76.1178 323.882C58.1143 305.879 48 281.461 48 256C48 230.539 58.1143 206.121 76.1178 188.118C94.1212 170.114 118.539 160 144 160H199.41" stroke="black" stroke-width="48" stroke-linecap="square" stroke-linejoin="round"/>
<path d="M312.59 160H368C393.461 160 417.879 170.114 435.882 188.118C453.886 206.121 464 230.539 464 256C464 281.461 453.886 305.879 435.882 323.882C417.879 341.886 393.461 352 368 352H311.34" stroke="black" stroke-width="48" stroke-linecap="square" stroke-linejoin="round"/>
</svg>
<svg id="icons" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path d="M200.66,352H144a96,96,0,0,1,0-192h55.41" fill="none" stroke="#000" stroke-linecap="square" stroke-linejoin="round" stroke-width="48"/><path d="M312.59,160H368a96,96,0,0,1,0,192H311.34" fill="none" stroke="#000" stroke-linecap="square" stroke-linejoin="round" stroke-width="48"/></svg>

Before

Width:  |  Height:  |  Size: 656 B

After

Width:  |  Height:  |  Size: 366 B

+1 -4
View File
@@ -1,4 +1 @@
<svg width="512" height="512" viewBox="0 0 512 512" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M200.66 352H144C118.539 352 94.1212 341.886 76.1178 323.882C58.1143 305.879 48 281.461 48 256C48 230.539 58.1143 206.121 76.1178 188.118C94.1212 170.114 118.539 160 144 160H199.41" stroke="black" stroke-width="48" stroke-linecap="round" stroke-linejoin="round"/>
<path d="M312.59 160H368C393.461 160 417.879 170.114 435.882 188.118C453.886 206.121 464 230.539 464 256C464 281.461 453.886 305.879 435.882 323.882C417.879 341.886 393.461 352 368 352H311.34" stroke="black" stroke-width="48" stroke-linecap="round" stroke-linejoin="round"/>
</svg>
<svg id="icons" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path d="M200.66,352H144a96,96,0,0,1,0-192h55.41" fill="none" stroke="#000" stroke-linecap="round" stroke-linejoin="round" stroke-width="48"/><path d="M312.59,160H368a96,96,0,0,1,0,192H311.34" fill="none" stroke="#000" stroke-linecap="round" stroke-linejoin="round" stroke-width="48"/></svg>

Before

Width:  |  Height:  |  Size: 654 B

After

Width:  |  Height:  |  Size: 364 B