diff --git a/.gitignore b/.gitignore index a547bf3..5284926 100644 --- a/.gitignore +++ b/.gitignore @@ -9,6 +9,7 @@ lerna-debug.log* node_modules dist +docs dist-ssr *.local diff --git a/lib/styles/index.scss b/lib/styles/index.scss index 0db665d..2a40ca5 100644 --- a/lib/styles/index.scss +++ b/lib/styles/index.scss @@ -90,22 +90,9 @@ margin-right: 6px; } .na-suffix { - // position: absolute; - // right: -10px; - // margin-left: 100px; top: 0; bottom: 0; - // color: #303133; padding: 0px 10px; margin-left: 10px; border-left: #fff 1px solid; - // width: 100px; - // margin-left: 6px; - // border: solid red 1px; - // .na-suffix_content{ - // color: #333; - // text-align: center; - // padding: 10px ; - // } - // background-color: #fff; } diff --git a/package.json b/package.json index 338ae3b..93fe331 100644 --- a/package.json +++ b/package.json @@ -2,6 +2,12 @@ "name": "@nanometer/nm", "version": "1.2.3", "type": "module", + "scripts": { + "dev": "vite", + "build": "tsc && vite build", + "preview": "vite preview --config vite.demo.config.js", + "build:demo": "vite build --config vite.demo.config.js" + }, "files": [ "dist" ], @@ -21,11 +27,6 @@ "./dist/style.css": "./dist/style.css" }, "types": "dist/main.d.ts", - "scripts": { - "dev": "vite", - "build": "tsc && vite build", - "preview": "vite preview" - }, "devDependencies": { "@types/estree": "^1.0.5", "@types/resolve": "^1.20.6", @@ -33,8 +34,5 @@ "typescript": "^5.2.2", "vite": "^5.2.0", "vite-plugin-dts": "^3.9.1" - }, - "dependencies": { - } } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 501e3e4..b706acf 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -7,10 +7,6 @@ settings: importers: .: - dependencies: - vite-plugin-dts: - specifier: ^3.9.1 - version: 3.9.1(rollup@4.14.0)(typescript@5.4.4)(vite@5.2.8(sass@1.74.1)) devDependencies: '@types/estree': specifier: ^1.0.5 @@ -27,6 +23,9 @@ importers: vite: specifier: ^5.2.0 version: 5.2.8(sass@1.74.1) + vite-plugin-dts: + specifier: ^3.9.1 + version: 3.9.1(rollup@4.14.0)(typescript@5.4.4)(vite@5.2.8(sass@1.74.1)) packages: @@ -239,36 +238,43 @@ packages: resolution: {integrity: sha512-x+uJ6MAYRlHGe9wi4HQjxpaKHPM3d3JjqqCkeC5gpnnI6OWovLdXTpfa8trjxPLnWKyBsSi5kne+146GAxFt4A==} cpu: [arm64] os: [linux] + libc: [glibc] '@rollup/rollup-linux-arm64-musl@4.14.0': resolution: {integrity: sha512-nrRw8ZTQKg6+Lttwqo6a2VxR9tOroa2m91XbdQ2sUUzHoedXlsyvY1fN4xWdqz8PKmf4orDwejxXHjh7YBGUCA==} cpu: [arm64] os: [linux] + libc: [musl] '@rollup/rollup-linux-powerpc64le-gnu@4.14.0': resolution: {integrity: sha512-xV0d5jDb4aFu84XKr+lcUJ9y3qpIWhttO3Qev97z8DKLXR62LC3cXT/bMZXrjLF9X+P5oSmJTzAhqwUbY96PnA==} cpu: [ppc64le] os: [linux] + libc: [glibc] '@rollup/rollup-linux-riscv64-gnu@4.14.0': resolution: {integrity: sha512-SDDhBQwZX6LPRoPYjAZWyL27LbcBo7WdBFWJi5PI9RPCzU8ijzkQn7tt8NXiXRiFMJCVpkuMkBf4OxSxVMizAw==} cpu: [riscv64] os: [linux] + libc: [glibc] '@rollup/rollup-linux-s390x-gnu@4.14.0': resolution: {integrity: sha512-RxB/qez8zIDshNJDufYlTT0ZTVut5eCpAZ3bdXDU9yTxBzui3KhbGjROK2OYTTor7alM7XBhssgoO3CZ0XD3qA==} cpu: [s390x] os: [linux] + libc: [glibc] '@rollup/rollup-linux-x64-gnu@4.14.0': resolution: {integrity: sha512-C6y6z2eCNCfhZxT9u+jAM2Fup89ZjiG5pIzZIDycs1IwESviLxwkQcFRGLjnDrP+PT+v5i4YFvlcfAs+LnreXg==} cpu: [x64] os: [linux] + libc: [glibc] '@rollup/rollup-linux-x64-musl@4.14.0': resolution: {integrity: sha512-i0QwbHYfnOMYsBEyjxcwGu5SMIi9sImDVjDg087hpzXqhBSosxkE7gyIYFHgfFl4mr7RrXksIBZ4DoLoP4FhJg==} cpu: [x64] os: [linux] + libc: [musl] '@rollup/rollup-win32-arm64-msvc@4.14.0': resolution: {integrity: sha512-Fq52EYb0riNHLBTAcL0cun+rRwyZ10S9vKzhGKKgeD+XbwunszSY0rVMco5KbOsTlwovP2rTOkiII/fQ4ih/zQ==} diff --git a/src/counter.ts b/src/counter.ts index 195041f..af01c1b 100644 --- a/src/counter.ts +++ b/src/counter.ts @@ -1,14 +1,12 @@ import message from "../lib/main"; -export function setupCounter(element: HTMLButtonElement) { - element.innerHTML = `click me`; - // element.addEventListener('click', () => message(document.getElementById(`h1`))) - // element.addEventListener('click', () => message('hello world')) +import { messageType } from './../lib/message'; +export function setupCounter(element: HTMLButtonElement,type:messageType) { element.addEventListener("click", () =>{ // message("✨Hello, I'm Pengpeng✨ ,I come from a place far away called the Land of No Stories.") message({ - type: "success", - content: "✨Hello, I'm Pengpeng✨ ,I come from a place far away called the Land of No Stories.", - durationTime: 5000, + type: type, + content: "✨Hello, world✨ ,I come from a place far away called the Land of No Stories.", + durationTime: 3000, suffix:'close', // beforeEvent:()=>{ // console.log('close','我要停下来') diff --git a/src/main.ts b/src/main.ts index 2fa57b5..7b3be9a 100644 --- a/src/main.ts +++ b/src/main.ts @@ -8,15 +8,25 @@ document.querySelector('#app')!.innerHTML = ` -

code play

+

+ This is a great message prompter, it takes up very little memory and space, but provides common usage, and from a modern front-end build, you can use it alone in the project or incorporate it into the base library, it is very useful. +

- - + + + + +
` -setupCounter1(document.querySelector('#close')!) -setupCounter(document.querySelector('#counter')!) +// +setupCounter(document.querySelector('#counter-success')!,'success') +setupCounter(document.querySelector('#counter-warning')!,'warning') +setupCounter(document.querySelector('#counter-info')!,'info') +setupCounter(document.querySelector('#counter-error')!,'error') + +// setupCounter(document.querySelector('#counter')!) diff --git a/vite.demo.config.js b/vite.demo.config.js new file mode 100644 index 0000000..7088886 --- /dev/null +++ b/vite.demo.config.js @@ -0,0 +1,9 @@ +import { defineConfig } from 'vite' +export default defineConfig({ + mode:"production", + build:{ + target:"modules", + outDir:'docs', + + } + }) \ No newline at end of file