diff --git a/components.d.ts b/components.d.ts index 8e59366a..02f5dc49 100644 --- a/components.d.ts +++ b/components.d.ts @@ -58,6 +58,7 @@ declare module '@vue/runtime-core' { CrontabGenerator: typeof import('./src/tools/crontab-generator/crontab-generator.vue')['default'] CSelect: typeof import('./src/ui/c-select/c-select.vue')['default'] 'CSelect.demo': typeof import('./src/ui/c-select/c-select.demo.vue')['default'] + CssXpathConverter: typeof import('./src/tools/css-xpath-converter/css-xpath-converter.vue')['default'] CTable: typeof import('./src/ui/c-table/c-table.vue')['default'] 'CTable.demo': typeof import('./src/ui/c-table/c-table.demo.vue')['default'] CTextCopyable: typeof import('./src/ui/c-text-copyable/c-text-copyable.vue')['default'] @@ -134,6 +135,7 @@ declare module '@vue/runtime-core' { NCode: typeof import('naive-ui')['NCode'] NCollapseTransition: typeof import('naive-ui')['NCollapseTransition'] NConfigProvider: typeof import('naive-ui')['NConfigProvider'] + NDivider: typeof import('naive-ui')['NDivider'] NEllipsis: typeof import('naive-ui')['NEllipsis'] NForm: typeof import('naive-ui')['NForm'] NFormItem: typeof import('naive-ui')['NFormItem'] diff --git a/package.json b/package.json index 63e5856a..df9e70f7 100644 --- a/package.json +++ b/package.json @@ -56,6 +56,7 @@ "cron-validator": "^1.3.1", "cronstrue": "^2.26.0", "crypto-js": "^4.1.1", + "csstoxpath": "^2.0.0", "date-fns": "^2.29.3", "dompurify": "^3.0.6", "email-normalizer": "^1.0.0", @@ -96,6 +97,7 @@ "vue-tsc": "^1.8.1", "xml-formatter": "^3.3.2", "xml-js": "^1.6.11", + "xpath-to-css": "^1.2.0", "yaml": "^2.2.1" }, "devDependencies": { diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 2311f3af..d3b32edd 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -68,6 +68,9 @@ dependencies: crypto-js: specifier: ^4.1.1 version: 4.1.1 + csstoxpath: + specifier: ^2.0.0 + version: 2.0.0 date-fns: specifier: ^2.29.3 version: 2.29.3 @@ -188,6 +191,9 @@ dependencies: xml-js: specifier: ^1.6.11 version: 1.6.11 + xpath-to-css: + specifier: ^1.2.0 + version: 1.2.0 yaml: specifier: ^2.2.1 version: 2.2.1 @@ -4703,7 +4709,6 @@ packages: /css-what@6.1.0: resolution: {integrity: sha512-HTUrgRJ7r4dsZKU6GjmpfRK1O76h97Z8MfS1G0FozR+oF2kG6Vfe8JE6zwrkbxigziPHinCJ+gCPjA9EaBDtRw==} engines: {node: '>= 6'} - dev: true /cssesc@3.0.0: resolution: {integrity: sha512-/Tb/JcjK111nNScGob5MNtsntNM1aCNUDipB/TkwZFhyDrrE47SOx/18wF2bbjgc3ZzCSKW1T5nt5EbFoAz/Vg==} @@ -4725,6 +4730,13 @@ packages: rrweb-cssom: 0.6.0 dev: true + /csstoxpath@2.0.0: + resolution: {integrity: sha512-tSEk+82vIIcjvLA6WHu1YiCuZ49Rtpv+3bmmiCu2NyGyvlzZUTzQbTGvKdojiyJmYlVfpA2l41HhPpmurxRqSA==} + engines: {node: '>=18'} + dependencies: + css-what: 6.1.0 + dev: false + /csstype@3.0.11: resolution: {integrity: sha512-sa6P2wJ+CAbgyy4KFssIb/JNMLxFvKF1pCYCSXS8ZMuqZnMsrxqI2E5sPyoTpxoPU/gVZMzr2zjOfg8GIZOMsw==} dev: false @@ -9628,6 +9640,11 @@ packages: resolution: {integrity: sha512-JZnDKK8B0RCDw84FNdDAIpZK+JuJw+s7Lz8nksI7SIuU3UXJJslUthsi+uWBUYOwPFwW7W7PRLRfUKpxjtjFCw==} dev: true + /xpath-to-css@1.2.0: + resolution: {integrity: sha512-jOSBw4iYbm9inNP0DbQB7cO0tPBfogG3oLA739eTO3WgJXAelLyZcFlCe2W/gBaYXT0pglXN6tJ7svFVaewBmA==} + engines: {node: '>=4.0.0'} + dev: false + /y18n@4.0.3: resolution: {integrity: sha512-JKhqTOwSrqNA1NY5lSztJ1GrBiUodLMmIZuLiDaMRJ+itFd+ABVE8XBjOvIWL+rSqNDC74LCSFmlb/U4UZ4hJQ==} dev: false diff --git a/src/tools/css-xpath-converter/css-xpath-converter.vue b/src/tools/css-xpath-converter/css-xpath-converter.vue new file mode 100644 index 00000000..bf166976 --- /dev/null +++ b/src/tools/css-xpath-converter/css-xpath-converter.vue @@ -0,0 +1,71 @@ + + + diff --git a/src/tools/css-xpath-converter/csstoxpath.d.ts b/src/tools/css-xpath-converter/csstoxpath.d.ts new file mode 100644 index 00000000..6fc8175d --- /dev/null +++ b/src/tools/css-xpath-converter/csstoxpath.d.ts @@ -0,0 +1,3 @@ +declare module "csstoxpath" { + export default function cssToXPath(xpath: string): string; +} \ No newline at end of file diff --git a/src/tools/css-xpath-converter/index.ts b/src/tools/css-xpath-converter/index.ts new file mode 100644 index 00000000..53785df9 --- /dev/null +++ b/src/tools/css-xpath-converter/index.ts @@ -0,0 +1,12 @@ +import { Braces } from '@vicons/tabler'; +import { defineTool } from '../tool'; + +export const tool = defineTool({ + name: 'CSS XPath Converter', + path: '/css-xpath-converter', + description: 'Convert CSS selector to/from XPath expression', + keywords: ['css', 'xpath', 'converter'], + component: () => import('./css-xpath-converter.vue'), + icon: Braces, + createdAt: new Date('2024-08-15'), +}); diff --git a/src/tools/css-xpath-converter/xpath-to-css.d.ts b/src/tools/css-xpath-converter/xpath-to-css.d.ts new file mode 100644 index 00000000..5fac651c --- /dev/null +++ b/src/tools/css-xpath-converter/xpath-to-css.d.ts @@ -0,0 +1,3 @@ +declare module "xpath-to-css" { + export default function xpathToCSS(xpath: string): string; +} \ No newline at end of file diff --git a/src/tools/index.ts b/src/tools/index.ts index c9003fe8..7b6cc09a 100644 --- a/src/tools/index.ts +++ b/src/tools/index.ts @@ -2,6 +2,7 @@ import { tool as base64FileConverter } from './base64-file-converter'; import { tool as base64StringConverter } from './base64-string-converter'; import { tool as basicAuthGenerator } from './basic-auth-generator'; import { tool as emailNormalizer } from './email-normalizer'; +import { tool as cssXpathConverter } from './css-xpath-converter'; import { tool as asciiTextDrawer } from './ascii-text-drawer'; @@ -156,6 +157,7 @@ export const toolsByCategory: ToolCategory[] = [ xmlFormatter, yamlViewer, emailNormalizer, + cssXpathConverter, ], }, {