@fringeworks/react-icon-material-symbols 0.0.0-stage → 0.1.0

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.
Files changed (56) hide show
  1. package/LICENSE +21 -0
  2. package/MaterialSymbolOutlined/MaterialSymbolOutlined.cjs +16 -0
  3. package/MaterialSymbolOutlined/MaterialSymbolOutlined.d.cts +13 -0
  4. package/MaterialSymbolOutlined/MaterialSymbolOutlined.d.mts +13 -0
  5. package/MaterialSymbolOutlined/MaterialSymbolOutlined.mjs +15 -0
  6. package/MaterialSymbolOutlined/index.cjs +5 -0
  7. package/MaterialSymbolOutlined/index.d.cts +2 -0
  8. package/MaterialSymbolOutlined/index.d.mts +2 -0
  9. package/MaterialSymbolOutlined/index.mjs +3 -0
  10. package/MaterialSymbolRounded/MaterialSymbolRounded.cjs +16 -0
  11. package/MaterialSymbolRounded/MaterialSymbolRounded.d.cts +13 -0
  12. package/MaterialSymbolRounded/MaterialSymbolRounded.d.mts +13 -0
  13. package/MaterialSymbolRounded/MaterialSymbolRounded.mjs +15 -0
  14. package/MaterialSymbolRounded/index.cjs +5 -0
  15. package/MaterialSymbolRounded/index.d.cts +2 -0
  16. package/MaterialSymbolRounded/index.d.mts +2 -0
  17. package/MaterialSymbolRounded/index.mjs +3 -0
  18. package/MaterialSymbolSharp/MaterialSymbolSharp.cjs +16 -0
  19. package/MaterialSymbolSharp/MaterialSymbolSharp.d.cts +13 -0
  20. package/MaterialSymbolSharp/MaterialSymbolSharp.d.mts +13 -0
  21. package/MaterialSymbolSharp/MaterialSymbolSharp.mjs +15 -0
  22. package/MaterialSymbolSharp/index.cjs +5 -0
  23. package/MaterialSymbolSharp/index.d.cts +2 -0
  24. package/MaterialSymbolSharp/index.d.mts +2 -0
  25. package/MaterialSymbolSharp/index.mjs +3 -0
  26. package/README.ja.md +282 -0
  27. package/README.md +281 -2
  28. package/_internal/_createMaterialSymbol.cjs +59 -0
  29. package/_internal/_createMaterialSymbol.d.cts +14 -0
  30. package/_internal/_createMaterialSymbol.d.mts +14 -0
  31. package/_internal/_createMaterialSymbol.mjs +58 -0
  32. package/_internal/_materialSymbolValue.cjs +1 -0
  33. package/_internal/_materialSymbolValue.d.cts +8 -0
  34. package/_internal/_materialSymbolValue.d.mts +8 -0
  35. package/_internal/_materialSymbolValue.mjs +1 -0
  36. package/_styles.scss.cjs +5 -0
  37. package/_styles.scss.d.cts +1 -0
  38. package/_styles.scss.d.mts +1 -0
  39. package/_styles.scss.mjs +6 -0
  40. package/constants.cjs +17 -0
  41. package/constants.d.cts +15 -0
  42. package/constants.d.mts +15 -0
  43. package/constants.mjs +16 -0
  44. package/font-outlined.css +1 -0
  45. package/font-rounded.css +1 -0
  46. package/font-sharp.css +1 -0
  47. package/index.cjs +13 -0
  48. package/index.d.cts +10 -0
  49. package/index.d.mts +10 -0
  50. package/index.mjs +9 -0
  51. package/package.json +78 -4
  52. package/styles.css +44 -0
  53. package/types.cjs +1 -0
  54. package/types.d.cts +53 -0
  55. package/types.d.mts +53 -0
  56. package/types.mjs +1 -0
package/constants.mjs ADDED
@@ -0,0 +1,16 @@
1
+ // src/constants.ts
2
+ /**
3
+ * Material Symbols の部品のデザインの定義(受け付けるデザインのプロパティと、効く状態)
4
+ *
5
+ * 可変フォントの軸のうち、CSS のプロパティが無い塗り(`FILL`)・グレード(`GRAD`)・光学サイズ(`opsz`)は、
6
+ * 例外として `filled`・`grade`・`opticalSize` のキーにしている。太さ(`wght`)は CSS の `font-weight` で効くので `fontWeight`。
7
+ * `hover` はアイコン自身の `:hover` に効く。
8
+ */
9
+ const materialSymbolDesignDefinition = { properties: {
10
+ fontWeight: ["hover"],
11
+ filled: ["hover"],
12
+ grade: ["hover"],
13
+ opticalSize: []
14
+ } };
15
+
16
+ export { materialSymbolDesignDefinition };
@@ -0,0 +1 @@
1
+ @import 'material-symbols/outlined.css';
@@ -0,0 +1 @@
1
+ @import 'material-symbols/rounded.css';
package/font-sharp.css ADDED
@@ -0,0 +1 @@
1
+ @import 'material-symbols/sharp.css';
package/index.cjs ADDED
@@ -0,0 +1,13 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
+ const require_constants = require("./constants.cjs");
3
+ const require_MaterialSymbolOutlined_MaterialSymbolOutlined = require("./MaterialSymbolOutlined/MaterialSymbolOutlined.cjs");
4
+ require("./MaterialSymbolOutlined/index.cjs");
5
+ const require_MaterialSymbolRounded_MaterialSymbolRounded = require("./MaterialSymbolRounded/MaterialSymbolRounded.cjs");
6
+ require("./MaterialSymbolRounded/index.cjs");
7
+ const require_MaterialSymbolSharp_MaterialSymbolSharp = require("./MaterialSymbolSharp/MaterialSymbolSharp.cjs");
8
+ require("./MaterialSymbolSharp/index.cjs");
9
+
10
+ exports.MaterialSymbolOutlined = require_MaterialSymbolOutlined_MaterialSymbolOutlined.default;
11
+ exports.MaterialSymbolRounded = require_MaterialSymbolRounded_MaterialSymbolRounded.default;
12
+ exports.MaterialSymbolSharp = require_MaterialSymbolSharp_MaterialSymbolSharp.default;
13
+ exports.materialSymbolDesignDefinition = require_constants.materialSymbolDesignDefinition;
package/index.d.cts ADDED
@@ -0,0 +1,10 @@
1
+ import { materialSymbolDesignDefinition } from "./constants.cjs";
2
+ import MaterialSymbolOutlined from "./MaterialSymbolOutlined/MaterialSymbolOutlined.cjs";
3
+ import "./MaterialSymbolOutlined/index.cjs";
4
+ import MaterialSymbolRounded from "./MaterialSymbolRounded/MaterialSymbolRounded.cjs";
5
+ import "./MaterialSymbolRounded/index.cjs";
6
+ import MaterialSymbolSharp from "./MaterialSymbolSharp/MaterialSymbolSharp.cjs";
7
+ import "./MaterialSymbolSharp/index.cjs";
8
+ import { MaterialSymbolValue } from "./_internal/_materialSymbolValue.cjs";
9
+ import { DesignDefinition, DesignPartDefinition, DesignPropertyValues, DesignState, DesignValue, FontIconWebFont, MaterialSymbolComponent, MaterialSymbolDesign, MaterialSymbolProps } from "./types.cjs";
10
+ export { type DesignDefinition, type DesignPartDefinition, type DesignPropertyValues, type DesignState, type DesignValue, type FontIconWebFont, type MaterialSymbolComponent, type MaterialSymbolDesign, MaterialSymbolOutlined, type MaterialSymbolProps, MaterialSymbolRounded, MaterialSymbolSharp, type MaterialSymbolValue, materialSymbolDesignDefinition };
package/index.d.mts ADDED
@@ -0,0 +1,10 @@
1
+ import { materialSymbolDesignDefinition } from "./constants.mjs";
2
+ import "./MaterialSymbolOutlined/index.mjs";
3
+ import MaterialSymbolRounded from "./MaterialSymbolRounded/MaterialSymbolRounded.mjs";
4
+ import "./MaterialSymbolRounded/index.mjs";
5
+ import MaterialSymbolSharp from "./MaterialSymbolSharp/MaterialSymbolSharp.mjs";
6
+ import "./MaterialSymbolSharp/index.mjs";
7
+ import { MaterialSymbolValue } from "./_internal/_materialSymbolValue.mjs";
8
+ import { DesignDefinition, DesignPartDefinition, DesignPropertyValues, DesignState, DesignValue, FontIconWebFont, MaterialSymbolComponent, MaterialSymbolDesign, MaterialSymbolProps } from "./types.mjs";
9
+ import MaterialSymbolOutlined from "./MaterialSymbolOutlined/MaterialSymbolOutlined.mjs";
10
+ export { type DesignDefinition, type DesignPartDefinition, type DesignPropertyValues, type DesignState, type DesignValue, type FontIconWebFont, type MaterialSymbolComponent, type MaterialSymbolDesign, MaterialSymbolOutlined, type MaterialSymbolProps, MaterialSymbolRounded, MaterialSymbolSharp, type MaterialSymbolValue, materialSymbolDesignDefinition };
package/index.mjs ADDED
@@ -0,0 +1,9 @@
1
+ import { materialSymbolDesignDefinition } from "./constants.mjs";
2
+ import MaterialSymbolOutlined from "./MaterialSymbolOutlined/MaterialSymbolOutlined.mjs";
3
+ import "./MaterialSymbolOutlined/index.mjs";
4
+ import MaterialSymbolRounded from "./MaterialSymbolRounded/MaterialSymbolRounded.mjs";
5
+ import "./MaterialSymbolRounded/index.mjs";
6
+ import MaterialSymbolSharp from "./MaterialSymbolSharp/MaterialSymbolSharp.mjs";
7
+ import "./MaterialSymbolSharp/index.mjs";
8
+
9
+ export { MaterialSymbolOutlined, MaterialSymbolRounded, MaterialSymbolSharp, materialSymbolDesignDefinition };
package/package.json CHANGED
@@ -1,6 +1,80 @@
1
1
  {
2
2
  "name": "@fringeworks/react-icon-material-symbols",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.1.0",
4
+ "description": "A library some will find handy, for using Material Symbols as typed React components with variable font axes.",
5
+ "keywords": [
6
+ "react",
7
+ "icon",
8
+ "material-symbols",
9
+ "icon-font"
10
+ ],
11
+ "repository": {
12
+ "type": "git",
13
+ "url": "git+https://github.com/fringeworks-js/react-icon-material-symbols.git"
14
+ },
15
+ "license": "MIT",
16
+ "author": "Mitsuhiro Seino",
17
+ "sideEffects": [
18
+ "**/*.css"
19
+ ],
20
+ "type": "module",
21
+ "exports": {
22
+ ".": {
23
+ "import": {
24
+ "types": "./index.d.mts",
25
+ "default": "./index.mjs"
26
+ },
27
+ "require": {
28
+ "types": "./index.d.cts",
29
+ "default": "./index.cjs"
30
+ }
31
+ },
32
+ "./MaterialSymbolOutlined": {
33
+ "import": {
34
+ "types": "./MaterialSymbolOutlined/index.d.mts",
35
+ "default": "./MaterialSymbolOutlined/index.mjs"
36
+ },
37
+ "require": {
38
+ "types": "./MaterialSymbolOutlined/index.d.cts",
39
+ "default": "./MaterialSymbolOutlined/index.cjs"
40
+ }
41
+ },
42
+ "./MaterialSymbolRounded": {
43
+ "import": {
44
+ "types": "./MaterialSymbolRounded/index.d.mts",
45
+ "default": "./MaterialSymbolRounded/index.mjs"
46
+ },
47
+ "require": {
48
+ "types": "./MaterialSymbolRounded/index.d.cts",
49
+ "default": "./MaterialSymbolRounded/index.cjs"
50
+ }
51
+ },
52
+ "./MaterialSymbolSharp": {
53
+ "import": {
54
+ "types": "./MaterialSymbolSharp/index.d.mts",
55
+ "default": "./MaterialSymbolSharp/index.mjs"
56
+ },
57
+ "require": {
58
+ "types": "./MaterialSymbolSharp/index.d.cts",
59
+ "default": "./MaterialSymbolSharp/index.cjs"
60
+ }
61
+ },
62
+ "./package.json": "./package.json",
63
+ "./styles.css": "./styles.css",
64
+ "./font-outlined.css": "./font-outlined.css",
65
+ "./font-rounded.css": "./font-rounded.css",
66
+ "./font-sharp.css": "./font-sharp.css"
67
+ },
68
+ "main": "./index.cjs",
69
+ "module": "./index.mjs",
70
+ "types": "./index.d.cts",
71
+ "dependencies": {
72
+ "@fringeworks/react-contract": "^0.2.2",
73
+ "@fringeworks/react-icon": "^0.1.0",
74
+ "@fringeworks/react-merge": "^0.9.2",
75
+ "material-symbols": "^0.49.0"
76
+ },
77
+ "peerDependencies": {
78
+ "react": "^18.0.0 || ^19.0.0"
79
+ }
80
+ }
package/styles.css ADDED
@@ -0,0 +1,44 @@
1
+ :where(.frg-icon) {
2
+ display: inline-block;
3
+ flex-shrink: 0;
4
+ box-sizing: content-box;
5
+ width: 1em;
6
+ height: 1em;
7
+ overflow: hidden;
8
+ vertical-align: -0.125em;
9
+ line-height: 1;
10
+ }
11
+
12
+ :where(.frg-fonticon) {
13
+ font-style: normal;
14
+ font-weight: normal;
15
+ letter-spacing: normal;
16
+ text-transform: none;
17
+ text-align: center;
18
+ white-space: nowrap;
19
+ word-wrap: normal;
20
+ direction: ltr;
21
+ font-feature-settings: "liga";
22
+ -webkit-font-smoothing: antialiased;
23
+ -moz-osx-font-smoothing: grayscale;
24
+ -webkit-user-select: none;
25
+ user-select: none;
26
+ }
27
+
28
+ :where(.frg-materialsymbol) {
29
+ font-weight: var(--frg-materialsymbol-fontWeight, 400);
30
+ font-variation-settings: "FILL" var(--frg-materialsymbol-filled, 0), "GRAD" var(--frg-materialsymbol-grade, 0);
31
+ }
32
+
33
+ :where(.frg-materialsymbol-opticalSize) {
34
+ font-variation-settings: "FILL" var(--frg-materialsymbol-filled, 0), "GRAD" var(--frg-materialsymbol-grade, 0), "opsz" var(--frg-materialsymbol-opticalSize, 24);
35
+ }
36
+
37
+ :where(.frg-materialsymbol:hover) {
38
+ font-weight: var(--frg-materialsymbol-fontWeight-hover, var(--frg-materialsymbol-fontWeight, 400));
39
+ font-variation-settings: "FILL" var(--frg-materialsymbol-filled-hover, var(--frg-materialsymbol-filled, 0)), "GRAD" var(--frg-materialsymbol-grade-hover, var(--frg-materialsymbol-grade, 0));
40
+ }
41
+
42
+ :where(.frg-materialsymbol-opticalSize:hover) {
43
+ font-variation-settings: "FILL" var(--frg-materialsymbol-filled-hover, var(--frg-materialsymbol-filled, 0)), "GRAD" var(--frg-materialsymbol-grade-hover, var(--frg-materialsymbol-grade, 0)), "opsz" var(--frg-materialsymbol-opticalSize, 24);
44
+ }
package/types.cjs ADDED
@@ -0,0 +1 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
package/types.d.cts ADDED
@@ -0,0 +1,53 @@
1
+ import { MaterialSymbolValue } from "./_internal/_materialSymbolValue.cjs";
2
+ import { materialSymbolDesignDefinition } from "./constants.cjs";
3
+ import { Design, DesignDefinition, DesignPartDefinition, DesignPropertyValues, DesignState, DesignValue } from "@fringeworks/react-contract";
4
+ import { FontIconProps, FontIconWebFont, FontIconWebFont as FontIconWebFont$1 } from "@fringeworks/react-icon";
5
+ import { ReactElement } from "react";
6
+ /**
7
+ * Material Symbols の部品のデザインの値
8
+ */
9
+ export type MaterialSymbolDesign = Design<typeof materialSymbolDesignDefinition>;
10
+ /**
11
+ * Material Symbols の部品のプロパティ
12
+ *
13
+ * `value` でアイコンの名前を受け取る。そのほかの props は `<span>` に渡す。
14
+ */
15
+ export type MaterialSymbolProps = FontIconProps<MaterialSymbolValue> & {
16
+ /**
17
+ * 太さ(`wght` の軸。100〜700)。`font-weight` で描く
18
+ */
19
+ weight?: number;
20
+ /**
21
+ * 塗りつぶした形にする(`FILL` の軸)
22
+ * @default false
23
+ */
24
+ filled?: boolean;
25
+ /**
26
+ * グレード(`GRAD` の軸。-25〜200)。太さを変えずに線の濃さを変える
27
+ */
28
+ grade?: number;
29
+ /**
30
+ * 光学サイズ(`opsz` の軸。20〜48)。指定しなければ、ブラウザーが文字の大きさに合わせて決める
31
+ */
32
+ opticalSize?: number;
33
+ /**
34
+ * デザインの値(軸ごとに、`hover` の値も指定できる)。同じ軸のプロパティを指定した場合は、状態なしの値をプロパティで上書きする
35
+ */
36
+ design?: MaterialSymbolDesign;
37
+ };
38
+ /**
39
+ * Material Symbols の部品(`MaterialSymbolOutlined`・`MaterialSymbolRounded`・`MaterialSymbolSharp`)
40
+ */
41
+ export type MaterialSymbolComponent = {
42
+ (props: MaterialSymbolProps): ReactElement;
43
+ /**
44
+ * この部品のアイコンを描くのに要る Web フォント(react-defer-rendering の `useDeferUntilWebFontReady` に渡せる)
45
+ */
46
+ readonly webFonts: readonly FontIconWebFont$1[];
47
+ /**
48
+ * デザインの定義(react-contract の `withDesign` が読む)
49
+ */
50
+ readonly designDefinition: typeof materialSymbolDesignDefinition;
51
+ displayName?: string;
52
+ };
53
+ export type { DesignDefinition, DesignPartDefinition, DesignPropertyValues, DesignState, DesignValue, FontIconWebFont, MaterialSymbolValue };
package/types.d.mts ADDED
@@ -0,0 +1,53 @@
1
+ import { MaterialSymbolValue } from "./_internal/_materialSymbolValue.mjs";
2
+ import { materialSymbolDesignDefinition } from "./constants.mjs";
3
+ import { Design, DesignDefinition, DesignPartDefinition, DesignPropertyValues, DesignState, DesignValue } from "@fringeworks/react-contract";
4
+ import { FontIconProps, FontIconWebFont, FontIconWebFont as FontIconWebFont$1 } from "@fringeworks/react-icon";
5
+ import { ReactElement } from "react";
6
+ /**
7
+ * Material Symbols の部品のデザインの値
8
+ */
9
+ export type MaterialSymbolDesign = Design<typeof materialSymbolDesignDefinition>;
10
+ /**
11
+ * Material Symbols の部品のプロパティ
12
+ *
13
+ * `value` でアイコンの名前を受け取る。そのほかの props は `<span>` に渡す。
14
+ */
15
+ export type MaterialSymbolProps = FontIconProps<MaterialSymbolValue> & {
16
+ /**
17
+ * 太さ(`wght` の軸。100〜700)。`font-weight` で描く
18
+ */
19
+ weight?: number;
20
+ /**
21
+ * 塗りつぶした形にする(`FILL` の軸)
22
+ * @default false
23
+ */
24
+ filled?: boolean;
25
+ /**
26
+ * グレード(`GRAD` の軸。-25〜200)。太さを変えずに線の濃さを変える
27
+ */
28
+ grade?: number;
29
+ /**
30
+ * 光学サイズ(`opsz` の軸。20〜48)。指定しなければ、ブラウザーが文字の大きさに合わせて決める
31
+ */
32
+ opticalSize?: number;
33
+ /**
34
+ * デザインの値(軸ごとに、`hover` の値も指定できる)。同じ軸のプロパティを指定した場合は、状態なしの値をプロパティで上書きする
35
+ */
36
+ design?: MaterialSymbolDesign;
37
+ };
38
+ /**
39
+ * Material Symbols の部品(`MaterialSymbolOutlined`・`MaterialSymbolRounded`・`MaterialSymbolSharp`)
40
+ */
41
+ export type MaterialSymbolComponent = {
42
+ (props: MaterialSymbolProps): ReactElement;
43
+ /**
44
+ * この部品のアイコンを描くのに要る Web フォント(react-defer-rendering の `useDeferUntilWebFontReady` に渡せる)
45
+ */
46
+ readonly webFonts: readonly FontIconWebFont$1[];
47
+ /**
48
+ * デザインの定義(react-contract の `withDesign` が読む)
49
+ */
50
+ readonly designDefinition: typeof materialSymbolDesignDefinition;
51
+ displayName?: string;
52
+ };
53
+ export type { DesignDefinition, DesignPartDefinition, DesignPropertyValues, DesignState, DesignValue, FontIconWebFont, MaterialSymbolValue };
package/types.mjs ADDED
@@ -0,0 +1 @@
1
+ export { };