@codady/icax 0.0.1

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 (59) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/LICENSE +24 -0
  3. package/README.md +0 -0
  4. package/dist/icax.cjs.js +113 -0
  5. package/dist/icax.cjs.min.js +15 -0
  6. package/dist/icax.esm.js +111 -0
  7. package/dist/icax.esm.min.js +15 -0
  8. package/dist/icax.umd.js +119 -0
  9. package/dist/icax.umd.min.js +15 -0
  10. package/examples/demo.html +52 -0
  11. package/package.json +75 -0
  12. package/rollup.config.js +68 -0
  13. package/script-mini.js +43 -0
  14. package/script-note.js +34 -0
  15. package/src/icax.js +27 -0
  16. package/src/icax.ts +34 -0
  17. package/src/icaxCheck.js +3 -0
  18. package/src/icaxCheck.ts +11 -0
  19. package/src/icaxCircle.js +3 -0
  20. package/src/icaxCircle.ts +11 -0
  21. package/src/icaxClipboard - /345/211/257/346/234/254.js" +3 -0
  22. package/src/icaxClipboard.js +3 -0
  23. package/src/icaxClipboard.ts +11 -0
  24. package/src/icaxClose - /345/211/257/346/234/254.js" +3 -0
  25. package/src/icaxClose.js +3 -0
  26. package/src/icaxClose.ts +11 -0
  27. package/src/icaxCopy - /345/211/257/346/234/254.js" +3 -0
  28. package/src/icaxCopy.js +3 -0
  29. package/src/icaxCopy.ts +11 -0
  30. package/src/icaxDivide - /345/211/257/346/234/254.js" +3 -0
  31. package/src/icaxDivide.js +3 -0
  32. package/src/icaxDivide.ts +11 -0
  33. package/src/icaxDown.js +3 -0
  34. package/src/icaxDown.ts +11 -0
  35. package/src/icaxLeft - /345/211/257/346/234/254.js" +3 -0
  36. package/src/icaxLeft.js +3 -0
  37. package/src/icaxLeft.ts +11 -0
  38. package/src/icaxMinus - /345/211/257/346/234/254.js" +3 -0
  39. package/src/icaxMinus.js +3 -0
  40. package/src/icaxMinus.ts +11 -0
  41. package/src/icaxPercent - /345/211/257/346/234/254.js" +3 -0
  42. package/src/icaxPercent.js +3 -0
  43. package/src/icaxPercent.ts +11 -0
  44. package/src/icaxPlus - /345/211/257/346/234/254.js" +3 -0
  45. package/src/icaxPlus.js +3 -0
  46. package/src/icaxPlus.ts +11 -0
  47. package/src/icaxRight - /345/211/257/346/234/254.js" +3 -0
  48. package/src/icaxRight.js +3 -0
  49. package/src/icaxRight.ts +11 -0
  50. package/src/icaxSquare - /345/211/257/346/234/254.js" +3 -0
  51. package/src/icaxSquare.js +3 -0
  52. package/src/icaxSquare.ts +11 -0
  53. package/src/icaxUp.js +4 -0
  54. package/src/icaxUp.ts +12 -0
  55. package/src/style.js +9 -0
  56. package/src/style.ts +9 -0
  57. package/src/wrap.js +13 -0
  58. package/src/wrap.ts +18 -0
  59. package/tsconfig.json +108 -0
package/script-mini.js ADDED
@@ -0,0 +1,43 @@
1
+
2
+ /**
3
+ * Last modified: 2026/01/07 17:15:50
4
+ */
5
+ import { exec } from 'child_process';
6
+
7
+ const runCommand = (command) => {
8
+ return new Promise((resolve, reject) => {
9
+ exec(command, (error, stdout, stderr) => {
10
+ if (error) {
11
+ reject(`exec error: ${error}`);
12
+ return;
13
+ }
14
+ if (stderr) {
15
+ reject(`stderr: ${stderr}`);
16
+ return;
17
+ }
18
+ resolve(stdout);
19
+ });
20
+ });
21
+ };
22
+
23
+ const minifyJsFile = (input, output) => {
24
+ const command = `npx terser ${input} -o ${output} -c arguments,dead_code,directives,arrows,drop_console -m keep_classnames=true,keep_fnames=true`;
25
+ return runCommand(command);
26
+ };
27
+
28
+
29
+ const minifyJs = async () => {
30
+ try {
31
+
32
+
33
+ await minifyJsFile('./dist/icax.umd.js', './dist/icax.umd.min.js');
34
+ await minifyJsFile('./dist/icax.esm.js', './dist/icax.esm.min.js');
35
+ await minifyJsFile('./dist/icax.cjs.js', './dist/icax.cjs.min.js');
36
+
37
+ console.log('Minification complete.');
38
+ } catch (error) {
39
+ console.error(`Error during minification: ${error}`);
40
+ }
41
+ };
42
+
43
+ minifyJs();
package/script-note.js ADDED
@@ -0,0 +1,34 @@
1
+
2
+ /**
3
+ * Last modified: 2026/01/07 17:14:51
4
+ */
5
+ import { readFileSync } from 'fs';
6
+ import { fileURLToPath } from 'url';
7
+ import { dirname, resolve } from 'path';
8
+
9
+ const __filename = fileURLToPath(import.meta.url);
10
+ const __dirname = dirname(__filename);
11
+
12
+ const pkg = JSON.parse(readFileSync(resolve(__dirname, './package.json'), 'utf8'));
13
+
14
+ const now = new Date();
15
+ const times = now.getFullYear() + '-' + (now.getMonth() + 1) + '-' + now.getDate() + ' ' + now.getHours() + ':' + now.getMinutes() + ':' + now.getSeconds();
16
+
17
+ const note = `
18
+ /*!
19
+ * @since Last modified: ${times}
20
+ * @name Icax event management system.
21
+ * @version ${pkg.version}
22
+ * @author AXUI development team <3217728223@qq.com>
23
+ * @description Icax.
24
+ * @see {@link https://icax.axui.cn|Official website}
25
+ * @see {@link https://github.com/codady/icax/issues|github issues}
26
+ * @see {@link https://gitee.com/codady/icax/issues|Gitee issues}
27
+ * @see {@link https://www.npmjs.com/package/@codady/icax|NPM}
28
+ * @issue QQ Group No.1:952502085
29
+ * @copyright This software supports the MIT License, allowing free learning and commercial use, but please retain the terms 'Icax', 'Icax' and 'COAX' within the software.
30
+ * @license MIT license
31
+ */
32
+ `;
33
+
34
+ export default note;
package/src/icax.js ADDED
@@ -0,0 +1,27 @@
1
+ /**
2
+ * Last modified: 2026/01/07 09:48:55
3
+ */
4
+ 'use strict';
5
+ import icaxCheck from "./icaxCheck";
6
+ import icaxCircle from "./icaxCircle";
7
+ import icaxClipboard from "./icaxClipboard";
8
+ import icaxClose from "./icaxClose";
9
+ import icaxCopy from "./icaxCopy";
10
+ import icaxDown from "./icaxDown";
11
+ import icaxLeft from "./icaxLeft";
12
+ import icaxRight from "./icaxRight";
13
+ import icaxSquare from "./icaxSquare";
14
+ import icaxUp from "./icaxUp";
15
+ const icax = {
16
+ left: icaxLeft,
17
+ right: icaxRight,
18
+ up: icaxUp,
19
+ down: icaxDown,
20
+ copy: icaxCopy,
21
+ clipboard: icaxClipboard,
22
+ close: icaxClose,
23
+ check: icaxCheck,
24
+ square: icaxSquare,
25
+ circle: icaxCircle,
26
+ };
27
+ export default icax;
package/src/icax.ts ADDED
@@ -0,0 +1,34 @@
1
+ /**
2
+ * Last modified: 2026/01/07 09:48:55
3
+ */
4
+ 'use strict'
5
+
6
+ import icaxCheck from "./icaxCheck";
7
+ import icaxCircle from "./icaxCircle";
8
+ import icaxClipboard from "./icaxClipboard";
9
+ import icaxClose from "./icaxClose";
10
+ import icaxCopy from "./icaxCopy";
11
+ import icaxDown from "./icaxDown";
12
+ import icaxLeft from "./icaxLeft";
13
+ import icaxRight from "./icaxRight";
14
+ import icaxSquare from "./icaxSquare";
15
+ import icaxUp from "./icaxUp";
16
+
17
+
18
+
19
+ const icax = {
20
+ left: icaxLeft,
21
+ right: icaxRight,
22
+ up: icaxUp,
23
+ down: icaxDown,
24
+ copy:icaxCopy,
25
+ clipboard:icaxClipboard,
26
+ close:icaxClose,
27
+ check:icaxCheck,
28
+ square:icaxSquare,
29
+ circle:icaxCircle,
30
+
31
+
32
+ };
33
+
34
+ export default icax;
@@ -0,0 +1,3 @@
1
+ import wrap from "./wrap";
2
+ const icaxCheck = (options) => wrap(`<polyline points="20 6 9 17 4 12"></polyline>`, icaxCheck, false, options);
3
+ export default icaxCheck;
@@ -0,0 +1,11 @@
1
+ import { IcaxOptions } from "../types/icax";
2
+ import wrap from "./wrap";
3
+
4
+ const icaxCheck = (options?: IcaxOptions): string =>
5
+ wrap(
6
+ `<polyline points="20 6 9 17 4 12"></polyline>`,
7
+ icaxCheck,
8
+ false,
9
+ options
10
+ );
11
+ export default icaxCheck;
@@ -0,0 +1,3 @@
1
+ import wrap from "./wrap";
2
+ const icaxCircle = (options) => wrap(`<circle cx="12" cy="12" r="10"></circle>`, icaxCircle, false, options);
3
+ export default icaxCircle;
@@ -0,0 +1,11 @@
1
+ import { IcaxOptions } from "../types/icax";
2
+ import wrap from "./wrap";
3
+
4
+ const icaxCircle = (options?: IcaxOptions): string =>
5
+ wrap(
6
+ `<circle cx="12" cy="12" r="10"></circle>`,
7
+ icaxCircle,
8
+ false,
9
+ options
10
+ );
11
+ export default icaxCircle;
@@ -0,0 +1,3 @@
1
+ import wrap from "./wrap";
2
+ const icaxClipboard = (options) => wrap(`<path d="M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2"></path><rect x="8" y="2" width="8" height="4" rx="1" ry="1"></rect>`, icaxClipboard, options);
3
+ export default icaxClipboard;
@@ -0,0 +1,3 @@
1
+ import wrap from "./wrap";
2
+ const icaxClipboard = (options) => wrap(`<path d="M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2"></path><rect x="8" y="2" width="8" height="4" rx="1" ry="1"></rect>`, icaxClipboard, false, options);
3
+ export default icaxClipboard;
@@ -0,0 +1,11 @@
1
+ import { IcaxOptions } from "../types/icax";
2
+ import wrap from "./wrap";
3
+
4
+ const icaxClipboard = (options?: IcaxOptions): string =>
5
+ wrap(
6
+ `<path d="M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2"></path><rect x="8" y="2" width="8" height="4" rx="1" ry="1"></rect>`,
7
+ icaxClipboard,
8
+ false,
9
+ options
10
+ );
11
+ export default icaxClipboard;
@@ -0,0 +1,3 @@
1
+ import wrap from "./wrap";
2
+ const icaxCopy = (options) => wrap(`<line x1="18" y1="6" x2="6" y2="18"></line><line x1="6" y1="6" x2="18" y2="18"></line>`, icaxCopy, options);
3
+ export default icaxCopy;
@@ -0,0 +1,3 @@
1
+ import wrap from "./wrap";
2
+ const icaxClose = (options) => wrap(`<line x1="18" y1="6" x2="6" y2="18"></line><line x1="6" y1="6" x2="18" y2="18"></line>`, icaxClose, false, options);
3
+ export default icaxClose;
@@ -0,0 +1,11 @@
1
+ import { IcaxOptions } from "../types/icax";
2
+ import wrap from "./wrap";
3
+
4
+ const icaxClose = (options?: IcaxOptions): string =>
5
+ wrap(
6
+ `<line x1="18" y1="6" x2="6" y2="18"></line><line x1="6" y1="6" x2="18" y2="18"></line>`,
7
+ icaxClose,
8
+ false,
9
+ options
10
+ );
11
+ export default icaxClose;
@@ -0,0 +1,3 @@
1
+ import wrap from "./wrap";
2
+ const icaxCopy = (options) => wrap(`<rect x="9" y="9" width="13" height="13" rx="2" ry="2"></rect><path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"></path>`, icaxCopy, options);
3
+ export default icaxCopy;
@@ -0,0 +1,3 @@
1
+ import wrap from "./wrap";
2
+ const icaxCopy = (options) => wrap(`<rect x="9" y="9" width="13" height="13" rx="2" ry="2"></rect><path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"></path>`, icaxCopy, false, options);
3
+ export default icaxCopy;
@@ -0,0 +1,11 @@
1
+ import { IcaxOptions } from "../types/icax";
2
+ import wrap from "./wrap";
3
+
4
+ const icaxCopy = (options?: IcaxOptions): string =>
5
+ wrap(
6
+ `<rect x="9" y="9" width="13" height="13" rx="2" ry="2"></rect><path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"></path>`,
7
+ icaxCopy,
8
+ false,
9
+ options
10
+ );
11
+ export default icaxCopy;
@@ -0,0 +1,3 @@
1
+ import wrap from "./wrap";
2
+ const icaxDivide = (options) => wrap(`<circle cx="12" cy="6" r="2"></circle><line x1="5" y1="12" x2="19" y2="12"></line><circle cx="12" cy="18" r="2"></circle>`, icaxDivide, options);
3
+ export default icaxDivide;
@@ -0,0 +1,3 @@
1
+ import wrap from "./wrap";
2
+ const icaxDivide = (options) => wrap(`<circle cx="12" cy="6" r="2"></circle><line x1="5" y1="12" x2="19" y2="12"></line><circle cx="12" cy="18" r="2"></circle>`, icaxDivide, false, options);
3
+ export default icaxDivide;
@@ -0,0 +1,11 @@
1
+ import { IcaxOptions } from "../types/icax";
2
+ import wrap from "./wrap";
3
+
4
+ const icaxDivide = (options?: IcaxOptions): string =>
5
+ wrap(
6
+ `<circle cx="12" cy="6" r="2"></circle><line x1="5" y1="12" x2="19" y2="12"></line><circle cx="12" cy="18" r="2"></circle>`,
7
+ icaxDivide,
8
+ false,
9
+ options
10
+ );
11
+ export default icaxDivide;
@@ -0,0 +1,3 @@
1
+ import wrap from "./wrap";
2
+ const icaxDown = (options) => wrap(`<polyline points="6 9 12 15 18 9"></polyline>`, icaxDown, false, options);
3
+ export default icaxDown;
@@ -0,0 +1,11 @@
1
+ import { IcaxOptions } from "../types/icax";
2
+ import wrap from "./wrap";
3
+
4
+ const icaxDown = (options?: IcaxOptions): string =>
5
+ wrap(
6
+ `<polyline points="6 9 12 15 18 9"></polyline>`,
7
+ icaxDown,
8
+ false,
9
+ options
10
+ );
11
+ export default icaxDown;
@@ -0,0 +1,3 @@
1
+ import wrap from "./wrap";
2
+ const icaxLeft = (options) => wrap(`<polyline points="15 18 9 12 15 6"></polyline>`, icaxLeft, options);
3
+ export default icaxLeft;
@@ -0,0 +1,3 @@
1
+ import wrap from "./wrap";
2
+ const icaxLeft = (options) => wrap(`<polyline points="15 18 9 12 15 6"></polyline>`, icaxLeft, true, options);
3
+ export default icaxLeft;
@@ -0,0 +1,11 @@
1
+ import { IcaxOptions } from "../types/icax";
2
+ import wrap from "./wrap";
3
+
4
+ const icaxLeft = (options?: IcaxOptions): string =>
5
+ wrap(
6
+ `<polyline points="15 18 9 12 15 6"></polyline>`,
7
+ icaxLeft,
8
+ true,
9
+ options
10
+ );
11
+ export default icaxLeft;
@@ -0,0 +1,3 @@
1
+ import wrap from "./wrap";
2
+ const icaxMinus = (options) => wrap(`<line x1="5" y1="12" x2="19" y2="12"></line>`, icaxMinus, options);
3
+ export default icaxMinus;
@@ -0,0 +1,3 @@
1
+ import wrap from "./wrap";
2
+ const icaxMinus = (options) => wrap(`<line x1="5" y1="12" x2="19" y2="12"></line>`, icaxMinus, false, options);
3
+ export default icaxMinus;
@@ -0,0 +1,11 @@
1
+ import { IcaxOptions } from "../types/icax";
2
+ import wrap from "./wrap";
3
+
4
+ const icaxMinus = (options?: IcaxOptions): string =>
5
+ wrap(
6
+ `<line x1="5" y1="12" x2="19" y2="12"></line>`,
7
+ icaxMinus,
8
+ false,
9
+ options
10
+ );
11
+ export default icaxMinus;
@@ -0,0 +1,3 @@
1
+ import wrap from "./wrap";
2
+ const icaxPercent = (options) => wrap(`<line x1="19" y1="5" x2="5" y2="19"></line><circle cx="6.5" cy="6.5" r="2.5"></circle><circle cx="17.5" cy="17.5" r="2.5"></circle>`, icaxPercent, options);
3
+ export default icaxPercent;
@@ -0,0 +1,3 @@
1
+ import wrap from "./wrap";
2
+ const icaxPercent = (options) => wrap(`<line x1="19" y1="5" x2="5" y2="19"></line><circle cx="6.5" cy="6.5" r="2.5"></circle><circle cx="17.5" cy="17.5" r="2.5"></circle>`, icaxPercent, false, options);
3
+ export default icaxPercent;
@@ -0,0 +1,11 @@
1
+ import { IcaxOptions } from "../types/icax";
2
+ import wrap from "./wrap";
3
+
4
+ const icaxPercent = (options?: IcaxOptions): string =>
5
+ wrap(
6
+ `<line x1="19" y1="5" x2="5" y2="19"></line><circle cx="6.5" cy="6.5" r="2.5"></circle><circle cx="17.5" cy="17.5" r="2.5"></circle>`,
7
+ icaxPercent,
8
+ false,
9
+ options
10
+ );
11
+ export default icaxPercent;
@@ -0,0 +1,3 @@
1
+ import wrap from "./wrap";
2
+ const icaxPlus = (options) => wrap(`<line x1="12" y1="5" x2="12" y2="19"></line><line x1="5" y1="12" x2="19" y2="12"></line>`, icaxPlus, options);
3
+ export default icaxPlus;
@@ -0,0 +1,3 @@
1
+ import wrap from "./wrap";
2
+ const icaxPlus = (options) => wrap(`<line x1="12" y1="5" x2="12" y2="19"></line><line x1="5" y1="12" x2="19" y2="12"></line>`, icaxPlus, false, options);
3
+ export default icaxPlus;
@@ -0,0 +1,11 @@
1
+ import { IcaxOptions } from "../types/icax";
2
+ import wrap from "./wrap";
3
+
4
+ const icaxPlus = (options?: IcaxOptions): string =>
5
+ wrap(
6
+ `<line x1="12" y1="5" x2="12" y2="19"></line><line x1="5" y1="12" x2="19" y2="12"></line>`,
7
+ icaxPlus,
8
+ false,
9
+ options
10
+ );
11
+ export default icaxPlus;
@@ -0,0 +1,3 @@
1
+ import wrap from "./wrap";
2
+ const icaxRight = (options) => wrap(`<polyline points="9 18 15 12 9 6"></polyline>`, icaxRight, options);
3
+ export default icaxRight;
@@ -0,0 +1,3 @@
1
+ import wrap from "./wrap";
2
+ const icaxRight = (options) => wrap(`<polyline points="9 18 15 12 9 6"></polyline>`, icaxRight, true, options);
3
+ export default icaxRight;
@@ -0,0 +1,11 @@
1
+ import { IcaxOptions } from "../types/icax";
2
+ import wrap from "./wrap";
3
+
4
+ const icaxRight = (options?: IcaxOptions): string =>
5
+ wrap(
6
+ `<polyline points="9 18 15 12 9 6"></polyline>`,
7
+ icaxRight,
8
+ true,
9
+ options
10
+ );
11
+ export default icaxRight;
@@ -0,0 +1,3 @@
1
+ import wrap from "./wrap";
2
+ const icaxDivide = (options) => wrap(`<circle cx="12" cy="6" r="2"></circle><line x1="5" y1="12" x2="19" y2="12"></line><circle cx="12" cy="18" r="2"></circle>`, icaxDivide, options);
3
+ export default icaxDivide;
@@ -0,0 +1,3 @@
1
+ import wrap from "./wrap";
2
+ const icaxSquare = (options) => wrap(`<rect x="3" y="3" width="18" height="18" rx="2" ry="2"></rect>`, icaxSquare, false, options);
3
+ export default icaxSquare;
@@ -0,0 +1,11 @@
1
+ import { IcaxOptions } from "../types/icax";
2
+ import wrap from "./wrap";
3
+
4
+ const icaxSquare = (options?: IcaxOptions): string =>
5
+ wrap(
6
+ `<rect x="3" y="3" width="18" height="18" rx="2" ry="2"></rect>`,
7
+ icaxSquare,
8
+ false,
9
+ options
10
+ );
11
+ export default icaxSquare;
package/src/icaxUp.js ADDED
@@ -0,0 +1,4 @@
1
+ import wrap from "./wrap";
2
+ const icaxUp = (options) => wrap(`<polyline points="18 15 12 9 6 15"></polyline>`, icaxUp, false, options);
3
+ ;
4
+ export default icaxUp;
package/src/icaxUp.ts ADDED
@@ -0,0 +1,12 @@
1
+ import { IcaxOptions } from "../types/icax";
2
+ import wrap from "./wrap";
3
+
4
+ const icaxUp = (options?: IcaxOptions): string =>
5
+ wrap(
6
+ `<polyline points="18 15 12 9 6 15"></polyline>`,
7
+ icaxUp,
8
+ false,
9
+ options
10
+ );
11
+ ;
12
+ export default icaxUp;
package/src/style.js ADDED
@@ -0,0 +1,9 @@
1
+ export const style = (name = '') => `
2
+ <style>
3
+ :where([dir="rtl"]) .icax-${name},
4
+ :where(:dir(rtl)) .icax-${name} {
5
+ transform: scaleX(-1);
6
+ transform-origin: center;
7
+ }
8
+ </style>
9
+ `;
package/src/style.ts ADDED
@@ -0,0 +1,9 @@
1
+ export const style =(name:string='')=> `
2
+ <style>
3
+ :where([dir="rtl"]) .icax-${name},
4
+ :where(:dir(rtl)) .icax-${name} {
5
+ transform: scaleX(-1);
6
+ transform-origin: center;
7
+ }
8
+ </style>
9
+ `;
package/src/wrap.js ADDED
@@ -0,0 +1,13 @@
1
+ import parseClasses from "../node_modules/@codady/utils/src/parseClasses";
2
+ import { style } from "./style";
3
+ const wrap = (content, fun, isRtl = false, options) => {
4
+ const size = options?.size || '1em', color = options?.color || 'currentColor', thickness = options?.thickness || 2, classes = options?.classes ? parseClasses(options.classes).join(' ') : '',
5
+ // 得到 "icax-left"
6
+ origName = fun.name.replace(/([A-Z])/g, "-$1").toLowerCase();
7
+ return `<svg xmlns="http://www.w3.org/2000/svg" width="${size}" height="${size}" viewBox="0 0 24 24" fill="none" stroke="${color}"
8
+ stroke-width="${thickness}" stroke-linecap="round" stroke-linejoin="round" class="${origName} ${classes}">
9
+ ${isRtl ? style(origName.split('-')[1]) : ''}
10
+ ${content}
11
+ </svg>`;
12
+ };
13
+ export default wrap;
package/src/wrap.ts ADDED
@@ -0,0 +1,18 @@
1
+ import parseClasses from "../node_modules/@codady/utils/src/parseClasses";
2
+ import { IcaxOptions } from "../types/icax";
3
+ import { style } from "./style";
4
+
5
+ const wrap = (content: string, fun: Function, isRtl = false, options?: IcaxOptions): string => {
6
+ const size = options?.size || '1em',
7
+ color = options?.color || 'currentColor',
8
+ thickness = options?.thickness || 2,
9
+ classes = options?.classes ? parseClasses(options.classes).join(' ') : '',
10
+ // 得到 "icax-left"
11
+ origName = fun.name.replace(/([A-Z])/g, "-$1").toLowerCase();
12
+ return `<svg xmlns="http://www.w3.org/2000/svg" width="${size}" height="${size}" viewBox="0 0 24 24" fill="none" stroke="${color}"
13
+ stroke-width="${thickness}" stroke-linecap="round" stroke-linejoin="round" class="${origName} ${classes}">
14
+ ${isRtl ? style(origName.split('-')[1]) : ''}
15
+ ${content}
16
+ </svg>`;
17
+ }
18
+ export default wrap;
package/tsconfig.json ADDED
@@ -0,0 +1,108 @@
1
+ {
2
+ "compilerOptions": {
3
+ /* Visit https://aka.ms/tsconfig to read more about this file */
4
+ /* Projects */
5
+ // "incremental": true, /* Save .tsbuildinfo files to allow for incremental compilation of projects. */
6
+ // "composite": true, /* Enable constraints that allow a TypeScript project to be used with project references. */
7
+ // "tsBuildInfoFile": "./.tsbuildinfo", /* Specify the path to .tsbuildinfo incremental compilation file. */
8
+ // "disableSourceOfProjectReferenceRedirect": true, /* Disable preferring source files instead of declaration files when referencing composite projects. */
9
+ // "disableSolutionSearching": true, /* Opt a project out of multi-project reference checking when editing. */
10
+ // "disableReferencedProjectLoad": true, /* Reduce the number of projects loaded automatically by TypeScript. */
11
+ /* Language and Environment */
12
+ "target": "es2022", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */
13
+ //"lib": [], /* Specify a set of bundled library declaration files that describe the target runtime environment. */
14
+ // "jsx": "preserve", /* Specify what JSX code is generated. */
15
+ // "experimentalDecorators": true, /* Enable experimental support for legacy experimental decorators. */
16
+ // "emitDecoratorMetadata": true, /* Emit design-type metadata for decorated declarations in source files. */
17
+ // "jsxFactory": "", /* Specify the JSX factory function used when targeting React JSX emit, e.g. 'React.createElement' or 'h'. */
18
+ // "jsxFragmentFactory": "", /* Specify the JSX Fragment reference used for fragments when targeting React JSX emit e.g. 'React.Fragment' or 'Fragment'. */
19
+ // "jsxImportSource": "", /* Specify module specifier used to import the JSX factory functions when using 'jsx: react-jsx*'. */
20
+ // "reactNamespace": "", /* Specify the object invoked for 'createElement'. This only applies when targeting 'react' JSX emit. */
21
+ // "noLib": true, /* Disable including any library files, including the default lib.d.ts. */
22
+ // "useDefineForClassFields": true, /* Emit ECMAScript-standard-compliant class fields. */
23
+ // "moduleDetection": "auto", /* Control what method is used to detect module-format JS files. */
24
+ /* Modules */
25
+ "module": "es2020", /* Specify what module code is generated. */
26
+ // "rootDir": "./", /* Specify the root folder within your source files. */
27
+ // "moduleResolution": "node10", /* Specify how TypeScript looks up a file from a given module specifier. */
28
+ // "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */
29
+ // "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */
30
+ // "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */
31
+ // "typeRoots": [], /* Specify multiple folders that act like './node_modules/@types'. */
32
+ "types": ["node"], /* Specify type package names to be included without being referenced in a source file. */
33
+ // "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */
34
+ // "moduleSuffixes": [], /* List of file name suffixes to search when resolving a module. */
35
+ // "allowImportingTsExtensions": true, /* Allow imports to include TypeScript file extensions. Requires '--moduleResolution bundler' and either '--noEmit' or '--emitDeclarationOnly' to be set. */
36
+ // "resolvePackageJsonExports": true, /* Use the package.json 'exports' field when resolving package imports. */
37
+ // "resolvePackageJsonImports": true, /* Use the package.json 'imports' field when resolving imports. */
38
+ // "customConditions": [], /* Conditions to set in addition to the resolver-specific defaults when resolving imports. */
39
+ // "resolveJsonModule": true, /* Enable importing .json files. */
40
+ // "allowArbitraryExtensions": true, /* Enable importing files with any extension, provided a declaration file is present. */
41
+ // "noResolve": true, /* Disallow 'import's, 'require's or '<reference>'s from expanding the number of files TypeScript should add to a project. */
42
+ /* JavaScript Support */
43
+ // "allowJs": true, /* Allow JavaScript files to be a part of your program. Use the 'checkJS' option to get errors from these files. */
44
+ // "checkJs": true, /* Enable error reporting in type-checked JavaScript files. */
45
+ // "maxNodeModuleJsDepth": 1, /* Specify the maximum folder depth used for checking JavaScript files from 'node_modules'. Only applicable with 'allowJs'. */
46
+ /* Emit */
47
+ // "declaration": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */
48
+ // "declarationMap": true, /* Create sourcemaps for d.ts files. */
49
+ // "emitDeclarationOnly": true, /* Only output d.ts files and not JavaScript files. */
50
+ // "sourceMap": true, /* Create source map files for emitted JavaScript files. */
51
+ // "inlineSourceMap": true, /* Include sourcemap files inside the emitted JavaScript. */
52
+ // "outFile": "./", /* Specify a file that bundles all outputs into one JavaScript file. If 'declaration' is true, also designates a file that bundles all .d.ts output. */
53
+ // "outDir": "./", /* Specify an output folder for all emitted files. */
54
+ "removeComments": false, /* Disable emitting comments. */
55
+ // "noEmit": true, /* Disable emitting files from a compilation. */
56
+ // "importHelpers": true, /* Allow importing helper functions from tslib once per project, instead of including them per-file. */
57
+ // "importsNotUsedAsValues": "remove", /* Specify emit/checking behavior for imports that are only used for types. */
58
+ // "downlevelIteration": true, /* Emit more compliant, but verbose and less performant JavaScript for iteration. */
59
+ // "sourceRoot": "", /* Specify the root path for debuggers to find the reference source code. */
60
+ // "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */
61
+ // "inlineSources": true, /* Include source code in the sourcemaps inside the emitted JavaScript. */
62
+ // "emitBOM": true, /* Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files. */
63
+ // "newLine": "crlf", /* Set the newline character for emitting files. */
64
+ // "stripInternal": true, /* Disable emitting declarations that have '@internal' in their JSDoc comments. */
65
+ // "noEmitHelpers": true, /* Disable generating custom helper functions like '__extends' in compiled output. */
66
+ // "noEmitOnError": true, /* Disable emitting files if any type checking errors are reported. */
67
+ // "preserveConstEnums": true, /* Disable erasing 'const enum' declarations in generated code. */
68
+ // "declarationDir": "./", /* Specify the output directory for generated declaration files. */
69
+ // "preserveValueImports": true, /* Preserve unused imported values in the JavaScript output that would otherwise be removed. */
70
+ /* Interop Constraints */
71
+ // "isolatedModules": true, /* Ensure that each file can be safely transpiled without relying on other imports. */
72
+ // "verbatimModuleSyntax": true, /* Do not transform or elide any imports or exports not marked as type-only, ensuring they are written in the output file's format based on the 'module' setting. */
73
+ // "allowSyntheticDefaultImports": true, /* Allow 'import x from y' when a module doesn't have a default export. */
74
+ "esModuleInterop": true, /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */
75
+ // "preserveSymlinks": true, /* Disable resolving symlinks to their realpath. This correlates to the same flag in node. */
76
+ "forceConsistentCasingInFileNames": true, /* Ensure that casing is correct in imports. */
77
+ /* Type Checking */
78
+ "strict": true, /* Enable all strict type-checking options. */
79
+ // "noImplicitAny": true, /* Enable error reporting for expressions and declarations with an implied 'any' type. */
80
+ // "strictNullChecks": true, /* When type checking, take into account 'null' and 'undefined'. */
81
+ // "strictFunctionTypes": true, /* When assigning functions, check to ensure parameters and the return values are subtype-compatible. */
82
+ // "strictBindCallApply": true, /* Check that the arguments for 'bind', 'call', and 'apply' methods match the original function. */
83
+ // "strictPropertyInitialization": true, /* Check for class properties that are declared but not set in the constructor. */
84
+ // "noImplicitThis": true, /* Enable error reporting when 'this' is given the type 'any'. */
85
+ // "useUnknownInCatchVariables": true, /* Default catch clause variables as 'unknown' instead of 'any'. */
86
+ // "alwaysStrict": true, /* Ensure 'use strict' is always emitted. */
87
+ // "noUnusedLocals": true, /* Enable error reporting when local variables aren't read. */
88
+ // "noUnusedParameters": true, /* Raise an error when a function parameter isn't read. */
89
+ // "exactOptionalPropertyTypes": true, /* Interpret optional property types as written, rather than adding 'undefined'. */
90
+ // "noImplicitReturns": true, /* Enable error reporting for codepaths that do not explicitly return in a function. */
91
+ // "noFallthroughCasesInSwitch": true, /* Enable error reporting for fallthrough cases in switch statements. */
92
+ // "noUncheckedIndexedAccess": true, /* Add 'undefined' to a type when accessed using an index. */
93
+ // "noImplicitOverride": true, /* Ensure overriding members in derived classes are marked with an override modifier. */
94
+ // "noPropertyAccessFromIndexSignature": true, /* Enforces using indexed accessors for keys declared using an indexed type. */
95
+ // "allowUnusedLabels": true, /* Disable error reporting for unused labels. */
96
+ // "allowUnreachableCode": true, /* Disable error reporting for unreachable code. */
97
+ /* Completeness */
98
+ // "skipDefaultLibCheck": true, /* Skip type checking .d.ts files that are included with TypeScript. */
99
+ "skipLibCheck": true, /* Skip type checking all .d.ts files. */
100
+ },
101
+ // "include": [
102
+ //"src/",
103
+ //"types/",
104
+ //], /*Only compile files in the 'src/scripts' directory 仅编译'src/scripts'目录中的文件*/
105
+ "exclude": [
106
+ "node_modules"
107
+ ],
108
+ }