@m3e/icon 1.0.0-rc.1 → 1.0.0-rc.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -6
- package/dist/custom-elements.json +2541 -3
- package/dist/index.js +5 -3
- package/dist/index.js.map +1 -1
- package/dist/index.min.js +5 -2
- package/dist/index.min.js.map +1 -1
- package/dist/src/IconElement.d.ts +0 -1
- package/dist/src/IconElement.d.ts.map +1 -1
- package/package.json +3 -3
- package/cem.config.mjs +0 -16
- package/eslint.config.mjs +0 -13
- package/rollup.config.js +0 -32
- package/src/IconElement.ts +0 -163
- package/src/IconGrade.ts +0 -2
- package/src/IconVariant.ts +0 -2
- package/src/index.ts +0 -3
- package/tsconfig.json +0 -9
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@m3e/icon",
|
|
3
|
-
"version": "1.0.0-rc.
|
|
3
|
+
"version": "1.0.0-rc.3",
|
|
4
4
|
"description": "Icon for M3E",
|
|
5
5
|
"author": "matraic <matraic@yahoo.com>",
|
|
6
6
|
"license": "MIT",
|
|
7
|
-
"homepage": "https://matraic.github.io/m3e/",
|
|
7
|
+
"homepage": "https://matraic.github.io/m3e/#/components/icon.html",
|
|
8
8
|
"repository": {
|
|
9
9
|
"type": "git",
|
|
10
10
|
"url": "git+https://github.com/matraic/m3e.git"
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"clean": "rimraf dist"
|
|
28
28
|
},
|
|
29
29
|
"peerDependencies": {
|
|
30
|
-
"@m3e/core": "1.0.0-rc.
|
|
30
|
+
"@m3e/core": "1.0.0-rc.3",
|
|
31
31
|
"lit": "^3.3.0"
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
package/cem.config.mjs
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { customElementVsCodePlugin } from "custom-element-vs-code-integration";
|
|
2
|
-
|
|
3
|
-
export default {
|
|
4
|
-
globs: ["src/**/*.ts"],
|
|
5
|
-
exclude: ["src/**/*.spec.ts"],
|
|
6
|
-
packagejson: true,
|
|
7
|
-
outdir: "dist",
|
|
8
|
-
litelement: true,
|
|
9
|
-
plugins: [
|
|
10
|
-
customElementVsCodePlugin({
|
|
11
|
-
outdir: "dist",
|
|
12
|
-
htmlFileName: "html-custom-data.json",
|
|
13
|
-
cssFileName: "css-custom-data.json",
|
|
14
|
-
}),
|
|
15
|
-
],
|
|
16
|
-
};
|
package/eslint.config.mjs
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import eslint from "@eslint/js";
|
|
2
|
-
import tseslint from "typescript-eslint";
|
|
3
|
-
import { fileURLToPath } from "url";
|
|
4
|
-
import { dirname } from "path";
|
|
5
|
-
|
|
6
|
-
export default tseslint.config(eslint.configs.recommended, tseslint.configs.recommended, {
|
|
7
|
-
languageOptions: {
|
|
8
|
-
parserOptions: {
|
|
9
|
-
project: true,
|
|
10
|
-
tsconfigRootDir: dirname(fileURLToPath(import.meta.url)),
|
|
11
|
-
},
|
|
12
|
-
},
|
|
13
|
-
});
|
package/rollup.config.js
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import resolve from "@rollup/plugin-node-resolve";
|
|
2
|
-
import terser from "@rollup/plugin-terser";
|
|
3
|
-
import typescript from "@rollup/plugin-typescript";
|
|
4
|
-
|
|
5
|
-
const banner = `/**
|
|
6
|
-
* @license MIT
|
|
7
|
-
* Copyright (c) 2025 matraic
|
|
8
|
-
* See LICENSE file in the project root for full license text.
|
|
9
|
-
*/`;
|
|
10
|
-
|
|
11
|
-
export default [
|
|
12
|
-
{
|
|
13
|
-
input: "src/index.ts",
|
|
14
|
-
output: [
|
|
15
|
-
{
|
|
16
|
-
file: "dist/index.js",
|
|
17
|
-
format: "esm",
|
|
18
|
-
sourcemap: true,
|
|
19
|
-
banner: banner,
|
|
20
|
-
},
|
|
21
|
-
{
|
|
22
|
-
file: "dist/index.min.js",
|
|
23
|
-
format: "esm",
|
|
24
|
-
sourcemap: true,
|
|
25
|
-
banner: banner,
|
|
26
|
-
plugins: [terser({ mangle: true })],
|
|
27
|
-
},
|
|
28
|
-
],
|
|
29
|
-
external: ["@m3e/core", "lit"],
|
|
30
|
-
plugins: [resolve(), typescript()],
|
|
31
|
-
},
|
|
32
|
-
];
|
package/src/IconElement.ts
DELETED
|
@@ -1,163 +0,0 @@
|
|
|
1
|
-
import { css, CSSResultGroup, html, LitElement, PropertyValues } from "lit";
|
|
2
|
-
import { customElement, property, query } from "lit/decorators.js";
|
|
3
|
-
|
|
4
|
-
import { Role } from "@m3e/core";
|
|
5
|
-
|
|
6
|
-
import { IconVariant } from "./IconVariant";
|
|
7
|
-
import { IconGrade } from "./IconGrade";
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* @summary
|
|
11
|
-
* A small symbol used to easily identify an action or category.
|
|
12
|
-
*
|
|
13
|
-
* @description
|
|
14
|
-
* The `m3e-icon` component makes it easier to use Material Symbols in your application. Material Symbols are Google's newest icons supporting
|
|
15
|
-
* a range of design variants. For more information, see:
|
|
16
|
-
* - {@link https://developers.google.com/fonts/docs/material_symbols|Material Symbol Guide}
|
|
17
|
-
* - {@link https://fonts.google.com/icons|Material Symbol Library}
|
|
18
|
-
*
|
|
19
|
-
* The Material Symbols font is the easiest way to incorporate Material Symbols into your application. Using the
|
|
20
|
-
* {@link https://developers.google.com/fonts/docs/css2#forming_api_urls|Fonts CSS API}, you can use variable fonts to optimize icon
|
|
21
|
-
* usage within your application. See {@link https://caniuse.com/variable-fonts|Can I Use's Variable Fonts} to determine whether
|
|
22
|
-
* your user's browser support variable fonts.
|
|
23
|
-
*
|
|
24
|
-
* @example
|
|
25
|
-
* The following example illustrates showing the `home` icon. The `name` attribute specifies the icon to present.
|
|
26
|
-
* ```html
|
|
27
|
-
* <m3e-icon name="home"></m3e-icon>
|
|
28
|
-
* ```
|
|
29
|
-
* @example
|
|
30
|
-
* The next example illustrates a link used to download a variable font for outlined icons with fill support.
|
|
31
|
-
* ```html
|
|
32
|
-
* <link href="https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL,GRAD@24,400,0..1,0" rel="stylesheet"/>
|
|
33
|
-
* ```
|
|
34
|
-
*
|
|
35
|
-
* @tag m3e-icon
|
|
36
|
-
*
|
|
37
|
-
* @attr filled - Whether the icon is filled.
|
|
38
|
-
* @attr grade - The grade of the icon.
|
|
39
|
-
* @attr optical-size - A value from 20 to 48 indicating the optical size of the icon.
|
|
40
|
-
* @attr name - The name of the icon.
|
|
41
|
-
* @attr variant - The appearance variant of the icon.
|
|
42
|
-
* @attr weight - A value from 100 to 700 indicating the weight of the icon.
|
|
43
|
-
*/
|
|
44
|
-
@customElement("m3e-icon")
|
|
45
|
-
export class M3eIconElement extends Role(LitElement, "img") {
|
|
46
|
-
/** The styles of the element. */
|
|
47
|
-
static override styles: CSSResultGroup = css`
|
|
48
|
-
:host {
|
|
49
|
-
display: inline-block;
|
|
50
|
-
user-select: none;
|
|
51
|
-
font-size: var(--m3e-icon-size, 1.5rem);
|
|
52
|
-
width: 1em;
|
|
53
|
-
vertical-align: middle;
|
|
54
|
-
overflow: hidden;
|
|
55
|
-
}
|
|
56
|
-
.icon {
|
|
57
|
-
font-weight: normal;
|
|
58
|
-
font-style: normal;
|
|
59
|
-
line-height: 1;
|
|
60
|
-
letter-spacing: normal;
|
|
61
|
-
text-transform: none;
|
|
62
|
-
white-space: nowrap;
|
|
63
|
-
word-wrap: normal;
|
|
64
|
-
direction: ltr;
|
|
65
|
-
font-feature-settings: "liga";
|
|
66
|
-
-webkit-font-smoothing: antialiased;
|
|
67
|
-
width: inherit;
|
|
68
|
-
height: inherit;
|
|
69
|
-
vertical-align: inherit;
|
|
70
|
-
font-variation-settings: "FILL" var(--_icon-fill, 0), "wght" var(--_icon-weight, 400),
|
|
71
|
-
"GRAD" var(--_icon-grade, 0), "opsz" var(--_icon-optical-size, 24);
|
|
72
|
-
}
|
|
73
|
-
:host([variant="outlined"]) .icon {
|
|
74
|
-
font-family: "Material Symbols Outlined";
|
|
75
|
-
}
|
|
76
|
-
:host([variant="rounded"]) .icon {
|
|
77
|
-
font-family: "Material Symbols Rounded";
|
|
78
|
-
}
|
|
79
|
-
:host([variant="sharp"]) .icon {
|
|
80
|
-
font-family: "Material Symbols Sharp";
|
|
81
|
-
}
|
|
82
|
-
`;
|
|
83
|
-
|
|
84
|
-
/** @private */ @query(".icon") private readonly _icon?: HTMLSpanElement;
|
|
85
|
-
|
|
86
|
-
/** The name of the icon. */
|
|
87
|
-
@property() name: string = "";
|
|
88
|
-
|
|
89
|
-
/**
|
|
90
|
-
* The appearance variant of the icon.
|
|
91
|
-
* @default "outlined"
|
|
92
|
-
*/
|
|
93
|
-
@property({ reflect: true }) variant: IconVariant = "outlined";
|
|
94
|
-
|
|
95
|
-
/**
|
|
96
|
-
* Whether the icon is filled.
|
|
97
|
-
* @default false
|
|
98
|
-
*/
|
|
99
|
-
@property({ type: Boolean, reflect: true }) filled = false;
|
|
100
|
-
|
|
101
|
-
/**
|
|
102
|
-
* The grade of the icon.
|
|
103
|
-
* @default "medium"
|
|
104
|
-
*/
|
|
105
|
-
@property() grade: IconGrade = "medium";
|
|
106
|
-
|
|
107
|
-
/**
|
|
108
|
-
* A value from 100 to 700 indicating the weight of the icon.
|
|
109
|
-
* @default 400
|
|
110
|
-
*/
|
|
111
|
-
@property({ type: Number }) weight = 400;
|
|
112
|
-
|
|
113
|
-
/**
|
|
114
|
-
* A value from 20 to 48 indicating the optical size of the icon.
|
|
115
|
-
* @default 24
|
|
116
|
-
*/
|
|
117
|
-
@property({ attribute: "optical-size", type: Number }) opticalSize = 24;
|
|
118
|
-
|
|
119
|
-
/** @inheritdoc */
|
|
120
|
-
override connectedCallback(): void {
|
|
121
|
-
if (
|
|
122
|
-
!this.hasAttribute("aria-label") &&
|
|
123
|
-
!this.hasAttribute("aria-labelledby") &&
|
|
124
|
-
!this.hasAttribute("aria-hidden")
|
|
125
|
-
) {
|
|
126
|
-
this.ariaHidden = "true";
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
super.connectedCallback();
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
/** @inheritdoc */
|
|
133
|
-
protected override updated(_changedProperties: PropertyValues<this>): void {
|
|
134
|
-
super.updated(_changedProperties);
|
|
135
|
-
|
|
136
|
-
if (_changedProperties.has("filled")) {
|
|
137
|
-
this._icon?.style.setProperty("--_icon-fill", this.filled ? "1" : "0");
|
|
138
|
-
}
|
|
139
|
-
if (_changedProperties.has("grade")) {
|
|
140
|
-
this._icon?.style.setProperty(
|
|
141
|
-
"--_icon-grade",
|
|
142
|
-
this.grade === "low" ? "-25" : this.grade === "high" ? "200" : "0"
|
|
143
|
-
);
|
|
144
|
-
}
|
|
145
|
-
if (_changedProperties.has("weight")) {
|
|
146
|
-
this._icon?.style.setProperty("--_icon-weight", `${this.weight}`);
|
|
147
|
-
}
|
|
148
|
-
if (_changedProperties.has("opticalSize")) {
|
|
149
|
-
this._icon?.style.setProperty("--_icon-optical-size", `${this.opticalSize}`);
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
/** @inheritdoc */
|
|
154
|
-
protected override render(): unknown {
|
|
155
|
-
return html`<div class="icon" aria-hidden="true">${this.name}</div>`;
|
|
156
|
-
}
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
declare global {
|
|
160
|
-
interface HTMLElementTagNameMap {
|
|
161
|
-
"m3e-icon": M3eIconElement;
|
|
162
|
-
}
|
|
163
|
-
}
|
package/src/IconGrade.ts
DELETED
package/src/IconVariant.ts
DELETED
package/src/index.ts
DELETED