Skip to content

Commit

Permalink
chore: release
Browse files Browse the repository at this point in the history
  • Loading branch information
hemengke1997 committed Feb 13, 2025
1 parent 21ce622 commit 41037ae
Show file tree
Hide file tree
Showing 43 changed files with 3,140 additions and 2,349 deletions.
20 changes: 10 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,22 +31,22 @@
},
"devDependencies": {
"@changesets/changelog-github": "^0.5.0",
"@changesets/cli": "^2.27.8",
"@commitlint/cli": "^19.5.0",
"@changesets/cli": "^2.27.12",
"@commitlint/cli": "^19.7.1",
"@minko-fe/commitlint-config": "^2.1.2",
"@minko-fe/eslint-config": "^4.0.2",
"@minko-fe/eslint-config": "^4.1.1",
"@minko-fe/prettier-config": "^2.2.3",
"@minko-fe/tsconfig": "latest",
"eslint": "^9.10.0",
"npm-run-all2": "^6.2.3",
"eslint": "^9.20.1",
"npm-run-all2": "^6.2.6",
"nyc": "^17.1.0",
"prettier-plugin-astro": "^0.14.1",
"prettier-plugin-tailwindcss": "^0.6.6",
"prettier-plugin-tailwindcss": "^0.6.11",
"simple-git-hooks": "^2.11.1",
"taze": "^0.16.9",
"tsup": "^8.3.0",
"turbo": "^2.1.2",
"typescript": "^5.6.2"
"taze": "^18.5.0",
"tsup": "^8.3.6",
"turbo": "^2.4.2",
"typescript": "^5.7.3"
},
"simple-git-hooks": {
"commit-msg": "npm run commitlint",
Expand Down
5 changes: 5 additions & 0 deletions packages/istanbul-widget/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# istanbul-widget

## 1.9.2
### Patch Changes

- update

## 1.9.1
### Patch Changes

Expand Down
58 changes: 29 additions & 29 deletions packages/istanbul-widget/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "istanbul-widget",
"version": "1.9.1",
"version": "1.9.2",
"description": "收集 istanbul 代码覆盖率的web小组件",
"type": "module",
"keywords": [
Expand Down Expand Up @@ -70,45 +70,45 @@
}
},
"dependencies": {
"@iconify-json/vscode-icons": "^1.2.2",
"@neodrag/react": "^2.0.4",
"@radix-ui/react-alert-dialog": "^1.1.1",
"@radix-ui/react-dialog": "^1.1.1",
"@radix-ui/react-icons": "^1.3.0",
"@radix-ui/react-label": "^2.1.0",
"@radix-ui/react-popover": "^1.1.1",
"@radix-ui/react-slot": "^1.1.0",
"@radix-ui/react-switch": "^1.1.0",
"@radix-ui/react-toast": "^1.2.1",
"class-variance-authority": "^0.7.0",
"consola": "^3.2.3",
"context-state": "^3.1.2",
"@iconify-json/vscode-icons": "^1.2.14",
"@neodrag/react": "^2.3.0",
"@radix-ui/react-alert-dialog": "^1.1.6",
"@radix-ui/react-dialog": "^1.1.6",
"@radix-ui/react-icons": "^1.3.2",
"@radix-ui/react-label": "^2.1.2",
"@radix-ui/react-popover": "^1.1.6",
"@radix-ui/react-slot": "^1.1.2",
"@radix-ui/react-switch": "^1.1.3",
"@radix-ui/react-toast": "^1.2.6",
"class-variance-authority": "^0.7.1",
"consola": "^3.4.0",
"context-state": "^3.2.0",
"eventemitter3": "^5.0.1",
"tw-clsx": "^0.1.0"
"tw-clsx": "^1.0.0"
},
"devDependencies": {
"@iconify/tailwind": "^1.1.3",
"@swc/core": "^1.7.26",
"@iconify/tailwind": "^1.2.0",
"@swc/core": "^1.10.16",
"@types/lodash-es": "^4.17.12",
"@types/node": "^20.16.5",
"@types/react": "^18.3.8",
"@types/react-dom": "^18.3.0",
"@vitejs/plugin-react": "^4.3.1",
"ahooks": "^3.8.1",
"@types/node": "^20.17.18",
"@types/react": "^18.3.18",
"@types/react-dom": "^18.3.5",
"@vitejs/plugin-react": "^4.3.4",
"ahooks": "^3.8.4",
"autoprefixer": "^10.4.20",
"lodash-es": "^4.17.21",
"npm-run-all2": "^6.2.3",
"postcss": "^8.4.47",
"npm-run-all2": "^6.2.6",
"postcss": "^8.5.2",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"rollup-plugin-visualizer": "^5.12.0",
"rollup-plugin-visualizer": "^5.14.0",
"tailwindcss": "3.2.7",
"tailwindcss-animate": "^1.0.7",
"tailwindcss-rem-to-px": "^0.1.1",
"tsup": "^8.3.0",
"tsup-plugin-bundleless": "^1.1.0",
"tsup": "^8.3.6",
"tsup-plugin-bundleless": "^1.2.1",
"tsup-plugin-css-legacy": "^1.0.0",
"typescript": "^5.6.2",
"vite": "^5.4.6"
"typescript": "^5.7.3",
"vite": "^5.4.14"
}
}
24 changes: 6 additions & 18 deletions packages/istanbul-widget/src/core/components/draggable.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { memo, type PropsWithChildren, useEffect, useRef, useState } from 'react'
import { type DragOptions, useDraggable } from '@neodrag/react'
import { memo, type PropsWithChildren, useEffect, useRef } from 'react'
import { useDraggable } from '@neodrag/react'
import { useLocalStorageState, useMemoizedFn } from 'ahooks'
import { max } from 'lodash-es'
import { cn } from '@/components/utils'
Expand All @@ -8,7 +8,6 @@ import Context from '../context'
import { type Position } from '../options.interface'

type DraggableProps = PropsWithChildren<{
dragOptions: DragOptions
className?: string
}>

Expand All @@ -22,42 +21,31 @@ const bounds = {
}

function Draggable(props: DraggableProps) {
const { children, dragOptions, className } = props
const { children, className } = props

const { defaultPosition, float } = Context.usePicker(['defaultPosition', 'float'])

const handleRef = useRef<HTMLDivElement>(null)
const draggableRef = useRef<HTMLDivElement>(null)

const [dragging, setDragging] = useState(false)

const [position, setPosition] = useLocalStorageState(`${ISTANBUL_WIDGET_ID}_position`, {
defaultValue: {
x: defaultPosition?.x || 0,
y: defaultPosition?.y || 0,
},
})

useDraggable(draggableRef, {
...dragOptions,
const { isDragging } = useDraggable(draggableRef, {
position,
handle: handleRef,
onDragStart(data) {
setDragging(true)
dragOptions.onDragStart?.(data)
},

onDrag: (data) => {
const { offsetX, offsetY } = data
setPosition({ x: offsetX, y: offsetY })
dragOptions.onDrag?.(data)
},
onDragEnd(data) {
setDragging(false)

const { offsetX, offsetY } = data
setPosition(fixFloatPosition({ x: offsetX, y: offsetY }))

dragOptions.onDragEnd?.(data)
},
axis: 'both',
bounds,
Expand Down Expand Up @@ -128,7 +116,7 @@ function Draggable(props: DraggableProps) {
return (
<div
ref={draggableRef}
className={cn('iw-w-fit iw-pointer-events-auto', !dragging ? 'iw-transition-transform' : '')}
className={cn('iw-w-fit iw-pointer-events-auto', !isDragging ? 'iw-transition-transform' : '')}
>
<div ref={handleRef} className={className}>
{children}
Expand Down
45 changes: 3 additions & 42 deletions packages/istanbul-widget/src/core/istanbul-widget.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
import { memo, useLayoutEffect, useRef, useState } from 'react'
import { memo, useLayoutEffect, useState } from 'react'
import { Popover, PopoverArrow, PopoverClose, PopoverContent, PopoverTrigger } from '@/components/ui/popover'
import { Toaster } from '@/components/ui/toaster'
import { ISTANBUL_WIDGET_ID } from '@/utils/const'
import { $ } from '@/utils/query'
import Draggable from './components/draggable'
import Context from './context'
import { type Position } from './options.interface'

function IstanbulWidgetComponent() {
const { theme, pluginList } = Context.usePicker(['theme', 'pluginList'])
Expand All @@ -28,50 +27,12 @@ function IstanbulWidgetComponent() {
}
}, [])

const dragging = useRef<boolean>(false)
const draggingTimer = useRef<number | null>(null)
const [dragPos, setDragPos] = useState<Position>({ x: 0, y: 0 })

return (
<>
<div className='iw-block iw-fixed iw-z-[99999] iw-right-0 iw-top-0 iw-left-0 iw-bottom-0 iw-pointer-events-none'>
<Popover open={popoverOpen} onOpenChange={setPopoverOpen}>
<Draggable
dragOptions={{
onDragStart({ offsetX, offsetY }) {
setDragPos({ x: offsetX, y: offsetY })
},
onDrag({ offsetX, offsetY }) {
const dragX = Math.abs(dragPos.x - offsetX)
const dragY = Math.abs(dragPos.y - offsetY)

if (dragX > 10 || dragY > 10) {
setPopoverOpen(false)
draggingTimer.current && window.clearTimeout(draggingTimer.current)
dragging.current = true
} else {
dragging.current = false
}
},
onDragEnd() {
if (dragging.current) {
draggingTimer.current = window.setTimeout(() => {
dragging.current = false
}, 20)
}
},
}}
className='iw-rounded-full iw-overflow-hidden'
>
<PopoverTrigger
asChild
onClick={(e) => {
if (dragging.current) {
e.preventDefault()
return
}
}}
>
<Draggable className='iw-rounded-full iw-overflow-hidden'>
<PopoverTrigger asChild>
<div
className='iw-w-10 iw-h-10 iw-flex iw-justify-center iw-items-center iw-p-2 iw-cursor-pointer'
style={{
Expand Down
7 changes: 7 additions & 0 deletions packages/vite-plugin-istanbul-widget/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# vite-plugin-istanbul-widget

## 1.9.3
### Patch Changes

- update
- Updated dependencies
- istanbul-widget@1.9.2

## 1.9.2
### Patch Changes

Expand Down
15 changes: 9 additions & 6 deletions packages/vite-plugin-istanbul-widget/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ export default defineConfig({
```ts
import { vitePlugin as remix } from '@remix-run/dev'
import { defineConfig } from 'vite'
import { istanbulWidget } from 'vite-plugin-istanbul-widget/remix'
import { istanbulWidget } from 'vite-plugin-istanbul-widget'

export default defineConfig({
plugins: [
Expand Down Expand Up @@ -151,6 +151,14 @@ type VitePluginIstanbulWidgetOptions = {
* @default false
*/
enabled?: boolean
/**
* 入口文件
* 对于 csr 项目,入口通常是 src/main 或 app/main
* 对于 remix/rr7 项目,入口通常是 app/root
*
* 默认情况自动探测 ['src/main', 'src/root', 'app/main', 'app/root']
*/
entry?: string
/**
* 是否检查正式环境
* 若为true,则正式环境下禁用插件
Expand All @@ -171,10 +179,5 @@ type VitePluginIstanbulWidgetOptions = {
* @description false 则关闭 istanbul-widget 控件
*/
istanbulWidgetConfig: IstanbulWidgetOptions | false
/**
* 延迟istanbul-widget初始化(ms)
* @default 0
*/
delayIstanbulWidgetInit?: number
}
```
29 changes: 8 additions & 21 deletions packages/vite-plugin-istanbul-widget/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "vite-plugin-istanbul-widget",
"version": "1.9.2",
"version": "1.9.3",
"description": "集成了 istanbul-widget 和 vite-plugin-istanbul 的vite插件",
"type": "module",
"keywords": [
Expand Down Expand Up @@ -35,20 +35,6 @@
"require": "./dist/astro.cjs",
"import": "./dist/astro.js",
"default": "./dist/astro.js"
},
"./remix": {
"types": "./remix.d.ts",
"require": "./dist/remix.cjs",
"import": "./dist/remix.js",
"default": "./dist/remix.js"
},
"./remix/client": {
"require": "./dist/remix/client.cjs",
"import": "./dist/remix/client.js",
"default": "./dist/remix/client.js"
},
"./client": {
"types": "./client.d.ts"
}
},
"scripts": {
Expand Down Expand Up @@ -78,28 +64,29 @@
},
"dependencies": {
"@istanbuljs/load-nyc-config": "1.1.0",
"debug": "^4.3.7",
"debug": "^4.4.0",
"es-module-lexer": "1.5.3",
"espree": "10.0.1",
"execa": "8.0.1",
"istanbul-lib-instrument": "6.0.2",
"istanbul-widget": "workspace:*",
"magic-string": "^0.30.11",
"magic-string": "^0.30.17",
"picocolors": "1.0.0",
"source-map": "0.7.4",
"test-exclude": "6.0.0",
"tiny-glob": "^0.2.9",
"vite-plugin-istanbul": "6.0.2"
},
"devDependencies": {
"@types/debug": "^4.1.12",
"@types/lodash-es": "^4.17.12",
"@types/node": "^20.16.5",
"@types/react": "^18.3.8",
"@types/node": "^20.17.18",
"@types/react": "^18.3.18",
"@types/serialize-javascript": "5.0.4",
"lodash-es": "^4.17.21",
"react": "^18.3.1",
"serialize-javascript": "6.0.2",
"tsup": "^8.3.0",
"typescript": "^5.6.2"
"tsup": "^8.3.6",
"typescript": "^5.7.3"
}
}
1 change: 0 additions & 1 deletion packages/vite-plugin-istanbul-widget/remix.d.ts

This file was deleted.

Loading

0 comments on commit 41037ae

Please sign in to comment.