From 71c0f1e729055a86cd2e00bfc909c0472a3bfef3 Mon Sep 17 00:00:00 2001 From: baiwusanyu-c <740132583@qq.com> Date: Mon, 25 Dec 2023 09:30:09 +0800 Subject: [PATCH] feat: added KStatistic component --- .../__snapshots__/statistic.spec.ts.snap | 8 +- .../Statistic/__test__/fixture/prefix.svelte | 7 + .../Statistic/__test__/fixture/suffix.svelte | 7 + .../Statistic/__test__/statistic.spec.ts | 89 ++++- components/Statistic/package.json | 94 ++--- components/Statistic/src/index.svelte | 113 +++--- components/Statistic/src/index.ts | 2 +- components/Statistic/src/types.d.ts | 78 ++-- components/Statistic/tsconfig.json | 17 +- package.json | 376 +++++++++--------- preset/src/shortcuts/index.ts | 6 +- preset/src/shortcuts/src/statistic.ts | 12 +- 12 files changed, 449 insertions(+), 360 deletions(-) create mode 100644 components/Statistic/__test__/fixture/prefix.svelte create mode 100644 components/Statistic/__test__/fixture/suffix.svelte diff --git a/components/Statistic/__test__/__snapshots__/statistic.spec.ts.snap b/components/Statistic/__test__/__snapshots__/statistic.spec.ts.snap index ddafe4fe..769f7d62 100644 --- a/components/Statistic/__test__/__snapshots__/statistic.spec.ts.snap +++ b/components/Statistic/__test__/__snapshots__/statistic.spec.ts.snap @@ -1,3 +1,9 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html -exports[`Test: KStatistic > props: cls 1`] = `"
"`; +exports[`Test: KStatistic > props: cls 1`] = `"
0
"`; + +exports[`Test: KStatistic > props: title 1`] = `"
test-title
0
"`; + +exports[`Test: KStatistic > props: value 1`] = `"
57,454,157
"`; + +exports[`Test: KStatistic > slot: suffix 1`] = `"
Daily active users
268,500
suffix
"`; diff --git a/components/Statistic/__test__/fixture/prefix.svelte b/components/Statistic/__test__/fixture/prefix.svelte new file mode 100644 index 00000000..f70c8841 --- /dev/null +++ b/components/Statistic/__test__/fixture/prefix.svelte @@ -0,0 +1,7 @@ + + + + prefix + diff --git a/components/Statistic/__test__/fixture/suffix.svelte b/components/Statistic/__test__/fixture/suffix.svelte new file mode 100644 index 00000000..48e248e8 --- /dev/null +++ b/components/Statistic/__test__/fixture/suffix.svelte @@ -0,0 +1,7 @@ + + + + suffix + diff --git a/components/Statistic/__test__/statistic.spec.ts b/components/Statistic/__test__/statistic.spec.ts index 174edbec..10a03377 100644 --- a/components/Statistic/__test__/statistic.spec.ts +++ b/components/Statistic/__test__/statistic.spec.ts @@ -1,12 +1,15 @@ import { afterEach, expect, test, describe, beforeEach } from 'vitest'; import KStatistic from '../src'; +import KStatisticSuffix from './fixture/suffix.svelte'; +import KStatisticPrefix from './fixture/prefix.svelte'; +import { tick } from 'svelte'; -let host: HTMLElement; +let host; const initHost = () => { - host = document.createElement('div'); + host = globalThis.document.createElement('div'); host.setAttribute('id', 'host'); - document.body.appendChild(host); + globalThis.document.body.appendChild(host); }; beforeEach(() => { initHost(); @@ -17,6 +20,7 @@ afterEach(() => { describe('Test: KStatistic', () => { test('props: cls', async () => { + // @ts-ignore const instance = new KStatistic({ target: host, props: { @@ -24,10 +28,79 @@ describe('Test: KStatistic', () => { } }); expect(instance).toBeTruthy(); - expect( - (host as HTMLElement)!.innerHTML.includes('k-statistic--test') - ).toBeTruthy(); + expect(host!.innerHTML.includes('k-statistic--test')).toBeTruthy(); expect(host.innerHTML).matchSnapshot(); }); -}) - \ No newline at end of file + + test('props: title', async () => { + // @ts-ignore + const instance = new KStatistic({ + target: host, + props: { + title: 'test-title' + } + }); + expect(instance).toBeTruthy(); + expect(host.querySelector('.k-statistic__head')).toBeTruthy(); + expect(host!.innerHTML.includes('test-title')).toBeTruthy(); + expect(host.innerHTML).matchSnapshot(); + }); + + test('props: value', async () => { + // @ts-ignore + const instance = new KStatistic({ + target: host, + props: { + value: 57454157 + } + }); + expect(instance).toBeTruthy(); + expect(host.querySelector('.k-statistic__content')).toBeTruthy(); + expect(host.querySelector('.k-statistic__value')).toBeTruthy(); + expect(host!.innerHTML.includes('57,454,157')).toBeTruthy(); + expect(host.innerHTML).matchSnapshot(); + }); + + test('props: precision', async () => { + // @ts-ignore + const instance = new KStatistic({ + target: host, + props: { + precision: 6, + value: 268500.123456 + } + }); + expect(instance).toBeTruthy(); + expect(host.querySelector('.k-statistic__content')).toBeTruthy(); + expect(host.querySelector('.k-statistic__value')).toBeTruthy(); + expect(host!.innerHTML.includes('268,500.123456')).toBeTruthy(); + // @ts-ignore + instance.$set({ precision: 4 }); + await tick(); + expect(host!.innerHTML.includes('268,500.1234')).toBeTruthy(); + }); + + test('slot: prefix', async () => { + // @ts-ignore + const instance = new KStatisticPrefix({ + target: host + }); + expect(instance).toBeTruthy(); + expect(host.querySelector('.k-statistic__content')).toBeTruthy(); + expect(host.querySelector('.k-statistic__value')).toBeTruthy(); + expect(host.querySelector('.k-statistic__prefix')).toBeTruthy(); + expect(host.innerHTML).matchSnapshot(); + }); + + test('slot: suffix', async () => { + // @ts-ignore + const instance = new KStatisticSuffix({ + target: host + }); + expect(instance).toBeTruthy(); + expect(host.querySelector('.k-statistic__content')).toBeTruthy(); + expect(host.querySelector('.k-statistic__value')).toBeTruthy(); + expect(host.querySelector('.k-statistic__suffix')).toBeTruthy(); + expect(host.innerHTML).matchSnapshot(); + }); +}); diff --git a/components/Statistic/package.json b/components/Statistic/package.json index f5ac9ef1..31728146 100644 --- a/components/Statistic/package.json +++ b/components/Statistic/package.json @@ -1,48 +1,48 @@ { - "name": "@ikun-ui/statistic", - "version": "0.1.0", - "type": "module", - "main": "src/index.ts", - "types": "src/index.d.ts", - "svelte": "src/index.ts", - "keywords": [ - "svelte", - "svelte3", - "web component", - "component", - "react", - "vue", - "svelte-kit", - "dx" - ], - "files": [ - "dist", - "package.json" - ], - "scripts": { - "build": "npm run build:js && npm run build:svelte", - "build:js": "tsc -p . --outDir dist/ --rootDir src/", - "build:svelte": "svelte-strip strip src/ dist", - "publish:pre": "node ../../scripts/pre-publish.js", - "publish:npm": "pnpm run publish:pre && pnpm publish --no-git-checks --access public" - }, - "publishConfig": { - "access": "public", - "main": "dist/index.js", - "module": "dist/index.js", - "svelte": "dist/index.js", - "types": "dist/index.d.ts" - }, - "dependencies": { - "@ikun-ui/icon": "workspace:*", - "@ikun-ui/utils": "workspace:*", - "baiwusanyu-utils": "^1.0.16", - "clsx": "^2.0.0" - }, - "devDependencies": { - "@tsconfig/svelte": "^5.0.2", - "svelte-strip": "^2.0.0", - "tslib": "^2.6.2", - "typescript": "^5.3.2" - } -} \ No newline at end of file + "name": "@ikun-ui/statistic", + "version": "0.1.0", + "type": "module", + "main": "src/index.ts", + "types": "src/index.d.ts", + "svelte": "src/index.ts", + "keywords": [ + "svelte", + "svelte3", + "web component", + "component", + "react", + "vue", + "svelte-kit", + "dx" + ], + "files": [ + "dist", + "package.json" + ], + "scripts": { + "build": "npm run build:js && npm run build:svelte", + "build:js": "tsc -p . --outDir dist/ --rootDir src/", + "build:svelte": "svelte-strip strip src/ dist", + "publish:pre": "node ../../scripts/pre-publish.js", + "publish:npm": "pnpm run publish:pre && pnpm publish --no-git-checks --access public" + }, + "publishConfig": { + "access": "public", + "main": "dist/index.js", + "module": "dist/index.js", + "svelte": "dist/index.js", + "types": "dist/index.d.ts" + }, + "dependencies": { + "@ikun-ui/icon": "workspace:*", + "@ikun-ui/utils": "workspace:*", + "baiwusanyu-utils": "^1.0.16", + "clsx": "^2.0.0" + }, + "devDependencies": { + "@tsconfig/svelte": "^5.0.2", + "svelte-strip": "^2.0.0", + "tslib": "^2.6.2", + "typescript": "^5.3.2" + } +} diff --git a/components/Statistic/src/index.svelte b/components/Statistic/src/index.svelte index 80268248..1d752092 100644 --- a/components/Statistic/src/index.svelte +++ b/components/Statistic/src/index.svelte @@ -1,71 +1,68 @@
- {#if $$slots.title || title} -
- - { title } - -
- {/if} -
+ {#if $$slots.title || title} +
+ + {title} + +
+ {/if} +
+ {#if $$slots.prefix || prefix} +
+ + {prefix} + +
+ {/if} - {#if $$slots.prefix || prefix} -
- - { prefix } - -
- {/if} + + {displayValue()} + - - { displayValue() } - - - {#if $$slots.suffix || suffix} -
- - { suffix } - -
- {/if} -
+ {#if $$slots.suffix || suffix} +
+ + {suffix} + +
+ {/if} +
diff --git a/components/Statistic/src/index.ts b/components/Statistic/src/index.ts index add3551c..eb6b7882 100644 --- a/components/Statistic/src/index.ts +++ b/components/Statistic/src/index.ts @@ -2,4 +2,4 @@ import Statistic from './index.svelte'; export { Statistic as KStatistic }; -export default Statistic; \ No newline at end of file +export default Statistic; diff --git a/components/Statistic/src/types.d.ts b/components/Statistic/src/types.d.ts index b7686c51..2ea7dad3 100644 --- a/components/Statistic/src/types.d.ts +++ b/components/Statistic/src/types.d.ts @@ -1,43 +1,43 @@ /// import type { ClassValue } from 'clsx'; export type KStatisticProps = { - /** - * @description Setting the decimal point - */ - decimalSeparator: string - /** - * @description Sets the thousandth identifier - */ - groupSeparator: string - /** - * @description numerical precision - */ - precision: number - /** - * @description Custom numerical presentation - */ - formatter: ((value: number) => string | number) | undefined, - /** - * @description TODO: ❓ Numerical content - */ - value: number - /** - * @description Sets the prefix of a number - */ - prefix: string | undefined, + /** + * @description Setting the decimal point + */ + decimalSeparator: string; + /** + * @description Sets the thousandth identifier + */ + groupSeparator: string; + /** + * @description numerical precision + */ + precision: number; + /** + * @description Custom numerical presentation + */ + formatter: ((value: number) => string | number) | undefined; + /** + * @description Numerical content + */ + value: number; + /** + * @description Sets the prefix of a number + */ + prefix: string | undefined; - /** - * @description Sets the suffix of a number - */ - suffix: string | undefined, - /** - * @description Numeric titles - */ - title: string | undefined, - /** - * @description Styles numeric values - */ - valueStyle: string | undefined, - cls: ClassValue, - attrs: Record -} + /** + * @description Sets the suffix of a number + */ + suffix: string | undefined; + /** + * @description Numeric titles + */ + title: string | undefined; + /** + * @description Styles numeric values + */ + valueStyle: string | undefined; + cls: ClassValue; + attrs: Record; +}; diff --git a/components/Statistic/tsconfig.json b/components/Statistic/tsconfig.json index bd4f5280..fe0d7c4f 100644 --- a/components/Statistic/tsconfig.json +++ b/components/Statistic/tsconfig.json @@ -1,12 +1,11 @@ { - "extends": "@tsconfig/svelte/tsconfig.json", + "extends": "@tsconfig/svelte/tsconfig.json", - "compilerOptions": { - "noImplicitAny": true, - "strict": true, - "declaration": true - }, - "include": ["src/**/*.ts", "src/**/*.d.ts", "src/**/*.svelte"], - "exclude": ["node_modules/*", "**/*.spec.ts"] + "compilerOptions": { + "noImplicitAny": true, + "strict": true, + "declaration": true + }, + "include": ["src/**/*.ts", "src/**/*.d.ts", "src/**/*.svelte"], + "exclude": ["node_modules/*", "**/*.spec.ts"] } - \ No newline at end of file diff --git a/package.json b/package.json index e803c70f..08df74a2 100644 --- a/package.json +++ b/package.json @@ -1,189 +1,189 @@ { - "name": "@ikun-ui/core", - "description": "🐔 A Svelte.js based UnoCSS UI library that allows you to make websites", - "packageManager": "pnpm@8.11.0", - "type": "module", - "version": "0.1.0", - "keywords": [ - "svelte", - "svelte3", - "web component", - "component", - "react", - "vue", - "svelte-kit", - "dx" - ], - "license": "MIT", - "author": "baiwusanyu-c", - "homepage": "https://github.com/ikun-svelte/ikun-ui#readme", - "repository": { - "type": "git", - "url": "git+https://github.com/ikun-svelte/ikun-ui.git" - }, - "bugs": { - "url": "https://github.com/ikun-svelte/ikun-ui/issues" - }, - "main": "dist/index.cjs", - "module": "dist/index.js", - "types": "dist/index.d.ts", - "exports": { - ".": { - "types": "./dist/index.d.ts", - "require": "./dist/index.cjs", - "import": "./dist/index.js" - }, - "./*": "./*" - }, - "files": [ - "dist", - "*.d.ts" - ], - "engines": { - "node": ">=14" - }, - "scripts": { - "init": "pnpm i", - "dev": "pnpm run build", - "dev:docs": "pnpm run --filter @ikun-ui/docs docs:dev", - "play": "node scripts/play.js && pnpm run --filter @ikun-ui/play dev", - "build": "run-s build:* && run-s build-*", - "build-preset": "pnpm run --filter @ikun-ui/preset build", - "build-lib": "tsup --config tsup.config.ts", - "build:utils": "pnpm run --filter @ikun-ui/utils build", - "build:components": "node scripts/build.js", - "build#docs": "pnpm run --filter @ikun-ui/docs docs:build", - "preview:docs": "pnpm run --filter @ikun-ui/docs docs:preview", - "test": "pnpm run test:unit && pnpm run test:e2e", - "test:e2e": "pnpm run --filter @ikun-ui/e2e test", - "test:unit": "vitest --watch=false", - "test:update": "vitest -u --watch=true", - "test:coverage": "vitest --coverage --watch=false", - "lint": "prettier --check \"./**/*.{svelte,js,ts,jsx,json,md}\" && eslint .", - "format": "prettier --write \"./**/*.{svelte,js,ts,jsx,json,md}\"", - "release": "bumpp package.json components/*/package.json preset/package.json utils/package.json --commit --push --tag", - "publish:script": "node scripts/publish.js && pnpm run publish:npm", - "publish:npm": "pnpm publish --no-git-checks --access public", - "clean:dist": "rimraf dist && node scripts/clean.js", - "clean:deps": "node scripts/clean-deps.js && node scripts/clean-root-deps.js", - "prepare": "npx simple-git-hooks", - "update:deps": "npx taze -w -r major && pnpm run init", - "create:new:comp": "node scripts/new-component.js statistic" - }, - "peerDependencies": { - "baiwusanyu-utils": "^1.0.14", - "svelte": "^4.0.0", - "unocss": "^0.57.7" - }, - "dependencies": { - "@ikun-ui/alert": "workspace:*", - "@ikun-ui/avatar": "workspace:*", - "@ikun-ui/backtop": "workspace:*", - "@ikun-ui/badge": "workspace:*", - "@ikun-ui/breadcrumb": "workspace:*", - "@ikun-ui/breadcrumb-item": "workspace:*", - "@ikun-ui/button": "workspace:*", - "@ikun-ui/button-group": "workspace:*", - "@ikun-ui/card": "workspace:*", - "@ikun-ui/checkbox": "workspace:*", - "@ikun-ui/checkbox-group": "workspace:*", - "@ikun-ui/client-only": "workspace:*", - "@ikun-ui/collapse": "workspace:*", - "@ikun-ui/collapse-wrapper": "workspace:*", - "@ikun-ui/contextmenu": "workspace:*", - "@ikun-ui/descriptions": "workspace:*", - "@ikun-ui/descriptions-item": "workspace:*", - "@ikun-ui/divider": "workspace:*", - "@ikun-ui/drawer": "workspace:*", - "@ikun-ui/dropdown": "workspace:*", - "@ikun-ui/ellipsis": "workspace:*", - "@ikun-ui/empty": "workspace:*", - "@ikun-ui/eye-dropper": "workspace:*", - "@ikun-ui/form": "workspace:*", - "@ikun-ui/grid": "workspace:*", - "@ikun-ui/icon": "workspace:*", - "@ikun-ui/infinite": "workspace:*", - "@ikun-ui/input": "workspace:*", - "@ikun-ui/layout": "workspace:*", - "@ikun-ui/link": "workspace:*", - "@ikun-ui/mask": "workspace:*", - "@ikun-ui/message": "workspace:*", - "@ikun-ui/message-box": "workspace:*", - "@ikun-ui/modal": "workspace:*", - "@ikun-ui/notify": "workspace:*", - "@ikun-ui/pagination": "workspace:*", - "@ikun-ui/popconfirm": "workspace:*", - "@ikun-ui/popover": "workspace:*", - "@ikun-ui/preset": "workspace:*", - "@ikun-ui/progress": "workspace:*", - "@ikun-ui/radio": "workspace:*", - "@ikun-ui/radio-group": "workspace:*", - "@ikun-ui/rate": "workspace:*", - "@ikun-ui/select": "workspace:*", - "@ikun-ui/slider": "workspace:*", - "@ikun-ui/spin": "workspace:*", - "@ikun-ui/switch": "workspace:*", - "@ikun-ui/tag": "workspace:*", - "@ikun-ui/tooltip": "workspace:*", - "@ikun-ui/utils": "workspace:*", - "@ikun-ui/virtual-list": "workspace:*", - "@ikun-ui/watermark": "workspace:*", - "baiwusanyu-utils": "^1.0.16", - "clsx": "^2.0.0", - "@ikun-ui/tabs": "workspace:*", - "@ikun-ui/carousel": "workspace:*", - "@ikun-ui/affix": "workspace:*", - "@ikun-ui/statistic": "workspace:*" - }, - "devDependencies": { - "@sveltejs/adapter-auto": "^2.1.1", - "@sveltejs/kit": "^1.27.6", - "@sveltejs/package": "^2.2.3", - "@sveltejs/vite-plugin-svelte": "^2.5.3", - "@testing-library/svelte": "^4.0.5", - "@types/node": "^20.10.3", - "@typescript-eslint/eslint-plugin": "^6.13.2", - "@typescript-eslint/parser": "^6.13.2", - "@unocss/preset-mini": "^0.58.0", - "@unocss/preset-uno": "^0.58.0", - "@vitest/ui": "^0.34.6", - "bumpp": "^9.2.0", - "chokidar": "^3.5.3", - "del": "^7.1.0", - "eslint": "^8.55.0", - "eslint-config-prettier": "^9.1.0", - "eslint-plugin-svelte": "^2.35.1", - "fast-glob": "^3.3.2", - "fs-extra": "11.1.1", - "jsdom": "^23.0.1", - "lint-staged": "^15.2.0", - "npm-run-all": "^4.1.5", - "ora": "^7.0.1", - "playwright-chromium": "^1.40.1", - "prettier": "^3.1.0", - "prettier-plugin-svelte": "^3.1.2", - "publint": "^0.2.6", - "rimraf": "^5.0.5", - "shelljs": "^0.8.5", - "simple-git-hooks": "^2.9.0", - "svelte": "^4.2.8", - "svelte-check": "^3.6.2", - "svelte-preprocess": "latest", - "tslib": "^2.6.2", - "tsup": "^8.0.1", - "typescript": "^5.3.2", - "unocss": "^0.58.0", - "vite": "^5.0.5", - "vitest": "^0.34.6" - }, - "lint-staged": { - "*.{svelte,js,ts,jsx,json}": [ - "prettier --write ", - "eslint" - ] - }, - "simple-git-hooks": { - "pre-commit": "npx lint-staged", - "commit-msg": "node vertify-commit.js" - } -} \ No newline at end of file + "name": "@ikun-ui/core", + "description": "🐔 A Svelte.js based UnoCSS UI library that allows you to make websites", + "packageManager": "pnpm@8.11.0", + "type": "module", + "version": "0.1.0", + "keywords": [ + "svelte", + "svelte3", + "web component", + "component", + "react", + "vue", + "svelte-kit", + "dx" + ], + "license": "MIT", + "author": "baiwusanyu-c", + "homepage": "https://github.com/ikun-svelte/ikun-ui#readme", + "repository": { + "type": "git", + "url": "git+https://github.com/ikun-svelte/ikun-ui.git" + }, + "bugs": { + "url": "https://github.com/ikun-svelte/ikun-ui/issues" + }, + "main": "dist/index.cjs", + "module": "dist/index.js", + "types": "dist/index.d.ts", + "exports": { + ".": { + "types": "./dist/index.d.ts", + "require": "./dist/index.cjs", + "import": "./dist/index.js" + }, + "./*": "./*" + }, + "files": [ + "dist", + "*.d.ts" + ], + "engines": { + "node": ">=14" + }, + "scripts": { + "init": "pnpm i", + "dev": "pnpm run build", + "dev:docs": "pnpm run --filter @ikun-ui/docs docs:dev", + "play": "node scripts/play.js && pnpm run --filter @ikun-ui/play dev", + "build": "run-s build:* && run-s build-*", + "build-preset": "pnpm run --filter @ikun-ui/preset build", + "build-lib": "tsup --config tsup.config.ts", + "build:utils": "pnpm run --filter @ikun-ui/utils build", + "build:components": "node scripts/build.js", + "build#docs": "pnpm run --filter @ikun-ui/docs docs:build", + "preview:docs": "pnpm run --filter @ikun-ui/docs docs:preview", + "test": "pnpm run test:unit && pnpm run test:e2e", + "test:e2e": "pnpm run --filter @ikun-ui/e2e test", + "test:unit": "vitest --watch=false", + "test:update": "vitest -u --watch=true", + "test:coverage": "vitest --coverage --watch=false", + "lint": "prettier --check \"./**/*.{svelte,js,ts,jsx,json,md}\" && eslint .", + "format": "prettier --write \"./**/*.{svelte,js,ts,jsx,json,md}\"", + "release": "bumpp package.json components/*/package.json preset/package.json utils/package.json --commit --push --tag", + "publish:script": "node scripts/publish.js && pnpm run publish:npm", + "publish:npm": "pnpm publish --no-git-checks --access public", + "clean:dist": "rimraf dist && node scripts/clean.js", + "clean:deps": "node scripts/clean-deps.js && node scripts/clean-root-deps.js", + "prepare": "npx simple-git-hooks", + "update:deps": "npx taze -w -r major && pnpm run init", + "create:new:comp": "node scripts/new-component.js statistic" + }, + "peerDependencies": { + "baiwusanyu-utils": "^1.0.14", + "svelte": "^4.0.0", + "unocss": "^0.57.7" + }, + "dependencies": { + "@ikun-ui/alert": "workspace:*", + "@ikun-ui/avatar": "workspace:*", + "@ikun-ui/backtop": "workspace:*", + "@ikun-ui/badge": "workspace:*", + "@ikun-ui/breadcrumb": "workspace:*", + "@ikun-ui/breadcrumb-item": "workspace:*", + "@ikun-ui/button": "workspace:*", + "@ikun-ui/button-group": "workspace:*", + "@ikun-ui/card": "workspace:*", + "@ikun-ui/checkbox": "workspace:*", + "@ikun-ui/checkbox-group": "workspace:*", + "@ikun-ui/client-only": "workspace:*", + "@ikun-ui/collapse": "workspace:*", + "@ikun-ui/collapse-wrapper": "workspace:*", + "@ikun-ui/contextmenu": "workspace:*", + "@ikun-ui/descriptions": "workspace:*", + "@ikun-ui/descriptions-item": "workspace:*", + "@ikun-ui/divider": "workspace:*", + "@ikun-ui/drawer": "workspace:*", + "@ikun-ui/dropdown": "workspace:*", + "@ikun-ui/ellipsis": "workspace:*", + "@ikun-ui/empty": "workspace:*", + "@ikun-ui/eye-dropper": "workspace:*", + "@ikun-ui/form": "workspace:*", + "@ikun-ui/grid": "workspace:*", + "@ikun-ui/icon": "workspace:*", + "@ikun-ui/infinite": "workspace:*", + "@ikun-ui/input": "workspace:*", + "@ikun-ui/layout": "workspace:*", + "@ikun-ui/link": "workspace:*", + "@ikun-ui/mask": "workspace:*", + "@ikun-ui/message": "workspace:*", + "@ikun-ui/message-box": "workspace:*", + "@ikun-ui/modal": "workspace:*", + "@ikun-ui/notify": "workspace:*", + "@ikun-ui/pagination": "workspace:*", + "@ikun-ui/popconfirm": "workspace:*", + "@ikun-ui/popover": "workspace:*", + "@ikun-ui/preset": "workspace:*", + "@ikun-ui/progress": "workspace:*", + "@ikun-ui/radio": "workspace:*", + "@ikun-ui/radio-group": "workspace:*", + "@ikun-ui/rate": "workspace:*", + "@ikun-ui/select": "workspace:*", + "@ikun-ui/slider": "workspace:*", + "@ikun-ui/spin": "workspace:*", + "@ikun-ui/switch": "workspace:*", + "@ikun-ui/tag": "workspace:*", + "@ikun-ui/tooltip": "workspace:*", + "@ikun-ui/utils": "workspace:*", + "@ikun-ui/virtual-list": "workspace:*", + "@ikun-ui/watermark": "workspace:*", + "baiwusanyu-utils": "^1.0.16", + "clsx": "^2.0.0", + "@ikun-ui/tabs": "workspace:*", + "@ikun-ui/carousel": "workspace:*", + "@ikun-ui/affix": "workspace:*", + "@ikun-ui/statistic": "workspace:*" + }, + "devDependencies": { + "@sveltejs/adapter-auto": "^2.1.1", + "@sveltejs/kit": "^1.27.6", + "@sveltejs/package": "^2.2.3", + "@sveltejs/vite-plugin-svelte": "^2.5.3", + "@testing-library/svelte": "^4.0.5", + "@types/node": "^20.10.3", + "@typescript-eslint/eslint-plugin": "^6.13.2", + "@typescript-eslint/parser": "^6.13.2", + "@unocss/preset-mini": "^0.58.0", + "@unocss/preset-uno": "^0.58.0", + "@vitest/ui": "^0.34.6", + "bumpp": "^9.2.0", + "chokidar": "^3.5.3", + "del": "^7.1.0", + "eslint": "^8.55.0", + "eslint-config-prettier": "^9.1.0", + "eslint-plugin-svelte": "^2.35.1", + "fast-glob": "^3.3.2", + "fs-extra": "11.1.1", + "jsdom": "^23.0.1", + "lint-staged": "^15.2.0", + "npm-run-all": "^4.1.5", + "ora": "^7.0.1", + "playwright-chromium": "^1.40.1", + "prettier": "^3.1.0", + "prettier-plugin-svelte": "^3.1.2", + "publint": "^0.2.6", + "rimraf": "^5.0.5", + "shelljs": "^0.8.5", + "simple-git-hooks": "^2.9.0", + "svelte": "^4.2.8", + "svelte-check": "^3.6.2", + "svelte-preprocess": "latest", + "tslib": "^2.6.2", + "tsup": "^8.0.1", + "typescript": "^5.3.2", + "unocss": "^0.58.0", + "vite": "^5.0.5", + "vitest": "^0.34.6" + }, + "lint-staged": { + "*.{svelte,js,ts,jsx,json}": [ + "prettier --write ", + "eslint" + ] + }, + "simple-git-hooks": { + "pre-commit": "npx lint-staged", + "commit-msg": "node vertify-commit.js" + } +} diff --git a/preset/src/shortcuts/index.ts b/preset/src/shortcuts/index.ts index 98b9ff7a..ec458312 100644 --- a/preset/src/shortcuts/index.ts +++ b/preset/src/shortcuts/index.ts @@ -50,7 +50,7 @@ import { descriptionsItemShortcuts } from './src/descriptions-item'; import { getDescriptionsItemGridColStartCls } from '../rules/src/descriptions-item'; import { carouselShortcuts } from './src/carousel'; import { affixShortcuts } from './src/affix'; -import { statisticShortcuts } from './src/statistic' +import { statisticShortcuts } from './src/statistic'; export const defaultShortcuts = [ baseShortcuts, commonShortcuts, @@ -143,7 +143,7 @@ export const defaultShortcuts = [ // affix affixShortcuts, // statistic - statisticShortcuts, + statisticShortcuts ] as UserShortcuts; export function getSafeList() { @@ -194,7 +194,7 @@ export function getSafeList() { const descriptionsItemList = Object.keys(descriptionsItemShortcuts); const carouselList = Object.keys(carouselShortcuts); const affixList = Object.keys(affixShortcuts); - const statisticList = Object.keys(statisticShortcuts); + const statisticList = Object.keys(statisticShortcuts); let res = iconList .concat(IKUN_SAFE_LIST) .concat(comList) diff --git a/preset/src/shortcuts/src/statistic.ts b/preset/src/shortcuts/src/statistic.ts index 98ad890a..158a3a9d 100644 --- a/preset/src/shortcuts/src/statistic.ts +++ b/preset/src/shortcuts/src/statistic.ts @@ -1,8 +1,8 @@ export const statisticShortcuts: Record = { - // statistic - 'k-statistic__head': 'text-base text-ikun-tx-base mb-4px leading-20px', - 'k-statistic__content': 'text-base text-ikun-tx-base', - 'k-statistic__value': 'inline-block', - 'k-statistic__prefix': 'inline-block mr-4px', - 'k-statistic__suffix': 'inline-block ml-4px', + // statistic + 'k-statistic__head': 'text-base text-ikun-tx-base mb-4px leading-20px', + 'k-statistic__content': 'text-base text-ikun-tx-base', + 'k-statistic__value': 'inline-block', + 'k-statistic__prefix': 'inline-block mr-4px', + 'k-statistic__suffix': 'inline-block ml-4px' };