From 8915cc5a4ab3c60646d21df8100322458fdc8fd1 Mon Sep 17 00:00:00 2001 From: zzcr <894103554@qq.com> Date: Mon, 12 Aug 2024 14:37:16 +0800 Subject: [PATCH 1/6] feat: gitHub-action remove runtime script --- .github/workflows/auto-all-publish.yml | 3 --- package.json | 28 +++++++++++++------------- 2 files changed, 14 insertions(+), 17 deletions(-) diff --git a/.github/workflows/auto-all-publish.yml b/.github/workflows/auto-all-publish.yml index 811f8791bc..77992189ce 100644 --- a/.github/workflows/auto-all-publish.yml +++ b/.github/workflows/auto-all-publish.yml @@ -57,9 +57,6 @@ jobs: - name: Run Build Sass Common run: pnpm build:ui saas-common -t ${{ steps.parseTag.outputs.publishVersion }} -d saas - - - name: Run Build Runtime - run: pnpm build:runtime - name: Run Build Theme run: pnpm build:theme diff --git a/package.json b/package.json index 08d3822440..c8393820c5 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,16 @@ "private": true, "packageManager": "pnpm@8.3.1", "description": "An enterprise-class UI component library, support both Vue.js 2 and Vue.js 3, as well as PC and mobile.", + "author": "OpenTiny Team", + "license": "MIT", "homepage": "https://opentiny.design/tiny-vue", + "repository": { + "type": "git", + "url": "git@github.com:opentiny/tiny-vue.git" + }, + "bugs": { + "url": "https://github.com/opentiny/tiny-vue/issues" + }, "keywords": [ "vue", "vue3", @@ -16,15 +25,6 @@ "renderless-components", "headless-components" ], - "author": "OpenTiny Team", - "license": "MIT", - "repository": { - "type": "git", - "url": "git@github.com:opentiny/tiny-vue.git" - }, - "bugs": { - "url": "https://github.com/opentiny/tiny-vue/issues" - }, "main": "packages/index.js", "engines": { "node": ">=16", @@ -81,7 +81,7 @@ "pub:themeSaas": "pnpm --filter=\"./packages/theme-saas/dist\" publish --no-git-checks --access=public", "pub:renderless": "pnpm --filter=\"./packages/renderless/dist\" publish --no-git-checks --access=public", "pub:runtime": "pnpm --filter=\"./packages/vue-runtime/\" publish --no-git-checks --access=public", - "pub:all": "pnpm pub2 && pnpm pub3 && pnpm pub:theme && pnpm pub:themeMobile && pnpm pub:themeSaas && pnpm pub:renderless && pnpm pub:runtime", + "pub:all": "pnpm pub2 && pnpm pub3 && pnpm pub:theme && pnpm pub:themeMobile && pnpm pub:themeSaas && pnpm pub:renderless", "pub:site": "pnpm -C examples/sites pub", "// ---------- 自动化发测试包 ----------": "", "auto-build-pub": "pnpm -C internals/automate auto-build-pub", @@ -162,6 +162,7 @@ }, "devDependencies": { "@antfu/eslint-config": "^0.38.6", + "@commitlint/config-conventional": "^18.4.3", "@types/color": "^3.0.3", "@types/eslint": "^8.4.10", "@types/node": "^18.11.18", @@ -171,6 +172,7 @@ "@volar-plugins/prettier": "^2.0.0", "@volar-plugins/prettyhtml": "^2.0.0", "@vue/tsconfig": "^0.4.0", + "commitlint": "^18.4.3", "depcheck": "1.4.3", "eslint": "^8.31.0", "eslint-config-prettier": "^8.8.0", @@ -183,11 +185,9 @@ "gulp-less": "^5.0.0", "gulp-svg-inline": "^1.0.1", "gulp-transform": "^3.0.5", + "husky": "^8.0.3", "lerna": "^6.4.0", "lint-staged": "^15.2.0", - "husky": "^8.0.3", - "commitlint": "^18.4.3", - "@commitlint/config-conventional": "^18.4.3", "minimist": "^1.2.8", "node-xlsx": "^0.21.0", "prettier": "^3.0.0", @@ -265,4 +265,4 @@ "> 1%", "last 2 versions" ] -} \ No newline at end of file +} From 1118630b278f808d012a5c4b623d9d6a6a65d5a7 Mon Sep 17 00:00:00 2001 From: chenxi-20 <76168465+chenxi-20@users.noreply.github.com> Date: Mon, 12 Aug 2024 01:26:56 -0700 Subject: [PATCH 2/6] =?UTF-8?q?fix(anchor):=20=E4=BF=AE=E5=A4=8Danchor?= =?UTF-8?q?=E7=82=B9=E5=87=BB=E5=90=8E=E6=BB=9A=E5=8A=A8=E5=93=8D=E5=BA=94?= =?UTF-8?q?=E6=BB=9E=E5=90=8E=E7=9A=84=E9=97=AE=E9=A2=98=EF=BC=8C=E9=80=82?= =?UTF-8?q?=E9=85=8Dsaas=E4=B8=BB=E9=A2=98=20(#1892)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/renderless/src/anchor/index.ts | 9 +- packages/theme-saas/src/anchor/index.less | 151 ++++++++++++++++++++++ packages/theme-saas/theme/defaultTheme.js | 1 + packages/vue/src/anchor/package.json | 18 +-- packages/vue/src/anchor/src/pc.vue | 6 +- 5 files changed, 173 insertions(+), 12 deletions(-) diff --git a/packages/renderless/src/anchor/index.ts b/packages/renderless/src/anchor/index.ts index 450e5ed624..6157e7661f 100644 --- a/packages/renderless/src/anchor/index.ts +++ b/packages/renderless/src/anchor/index.ts @@ -119,7 +119,7 @@ export const handleScroll = (state: IAnchorRenderlessParams['state']) => () => { state.scrollTimer = window.setTimeout(() => { state.isScroll = false clearTimeout(state.scrollTimer) - }, 2000) + }, 200) } // 设置滚动偏移量 @@ -183,6 +183,11 @@ export const onItersectionObserver = return } + if (state.isScroll) { + api.handleScroll() + return + } + for (let key in state.observerLinks) { if (Object.prototype.hasOwnProperty.call(state.observerLinks, key)) { const item = state.observerLinks[key] @@ -202,7 +207,7 @@ export const onItersectionObserver = } } }, - { root: scrollContainer, threshold: [0] } + { root: scrollContainer, threshold: [0, 0.25, 0.5, 1] } ) addObserver({ props, state }) diff --git a/packages/theme-saas/src/anchor/index.less b/packages/theme-saas/src/anchor/index.less index e69de29bb2..192006d72c 100644 --- a/packages/theme-saas/src/anchor/index.less +++ b/packages/theme-saas/src/anchor/index.less @@ -0,0 +1,151 @@ +/** +* Copyright (c) 2022 - present TinyVue Authors. +* Copyright (c) 2022 - present Huawei Cloud Computing Technologies Co., Ltd. +* +* Use of this source code is governed by an MIT-style license. +* +* THE OPEN SOURCE SOFTWARE IN THIS PRODUCT IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, +* BUT WITHOUT ANY WARRANTY, WITHOUT EVEN THE IMPLIED WARRANTY OF MERCHANTABILITY OR FITNESS FOR +* A PARTICULAR PURPOSE. SEE THE APPLICABLE LICENSES FOR MORE DETAILS. +* +*/ + +@import '../custom.less'; + +@anchor-prefix-cls: ~'@{css-prefix}anchor'; + +.@{anchor-prefix-cls} { + @apply bg-transparent; + @apply w-50; + @apply relative; + @apply text-color-text-primary; + @apply text-sm; + + &__affix { + @apply fixed; + z-index: 1; + } + + &__line { + .@{anchor-prefix-cls}-link + .@{anchor-prefix-cls}-link { + margin-top: 0.5em; + } + + .@{anchor-prefix-cls}-link-mask { + @apply absolute; + @apply max-w-0; + border-top-right-radius: 10px; + border-bottom-right-radius: 10px; + left: 2px; + @apply w-full; + background-color: var(--ti-anchor-link-mask-bg-color); + } + + .@{anchor-prefix-cls}-orbit { + @apply absolute; + left: 0; + top: 0; + bottom: 0; + @apply w-1; + @apply rounded; + @apply bg-color-border; + + &-skid { + @apply absolute; + left: 0; + @apply w-1; + @apply bg-color-brand; + @apply rounded; + &--active { + @apply bg-color-brand; + } + } + } + } + + &-link-title:hover { + @apply text-color-brand; + } + + &-link { + @apply ml-4; + cursor: pointer; + @apply leading-9; + + &-title { + display: block; + @apply max-w-full; + padding: var(--ti-anchor-link-title-padding-vertical) var(--ti-anchor-link-title-padding-right) + var(--ti-anchor-link-title-padding-vertical) var(--ti-anchor-link-title-padding-left); + overflow: hidden; + text-overflow: ellipsis; + display: -webkit-box; + -webkit-box-orient: vertical; + -webkit-line-clamp: 1; + @apply text-color-text-primary; + @apply whitespace-nowrap; + &&--active { + @apply text-color-brand; + } + } + } + + &__dot { + @apply w-50; + + .@{anchor-prefix-cls} { + padding: 0 16px; + } + + .@{anchor-prefix-cls}-link { + @apply relative; + padding-left: 10px; + margin-bottom: 16px; + } + + .@{anchor-prefix-cls}-link-title { + padding-left: 16px; + padding-right: 0; + -webkit-line-clamp: 2; + + &:before { + content: ''; + display: block; + @apply w-2; + @apply h-2; + border: 1px solid var(--ti-anchor-dot-border-color); + @apply absolute; + border-radius: 50%; + left: 0px; + top: 6px; + } + + &:after { + content: ''; + display: block; + width: 1px; + background-color: var(--color-border-base); + @apply bg-color-bg-2; + @apply absolute; + border-radius: 50%; + left: 3.5px; + top: 20px; + bottom: -18px; + } + + &:hover, + &--active { + color: var(--ti-anchor-link-active-text-color); + + &:before { + border-color: var(--ti-anchor-link-active-text-color); + @apply opacity-100; + } + } + } + + .@{anchor-prefix-cls}-link:last-child > .@{anchor-prefix-cls}-link-title:after { + @apply hidden; + } + } +} diff --git a/packages/theme-saas/theme/defaultTheme.js b/packages/theme-saas/theme/defaultTheme.js index 6db816e77d..053ffd816e 100644 --- a/packages/theme-saas/theme/defaultTheme.js +++ b/packages/theme-saas/theme/defaultTheme.js @@ -61,6 +61,7 @@ module.exports = { 60: '15rem', 56: '14rem', 52: '13rem', + 50: '12.5rem', 48: '12rem', 45: '11.25rem', 44: '11rem', diff --git a/packages/vue/src/anchor/package.json b/packages/vue/src/anchor/package.json index 13bcddebd3..20ace36261 100644 --- a/packages/vue/src/anchor/package.json +++ b/packages/vue/src/anchor/package.json @@ -1,22 +1,24 @@ { "name": "@opentiny/vue-anchor", + "type": "module", "version": "3.18.0", "description": "", - "main": "lib/index.js", + "license": "MIT", "sideEffects": false, - "type": "module", - "devDependencies": { - "@opentiny-internal/vue-test-utils": "workspace:*", - "vitest": "^0.31.0" - }, + "main": "lib/index.js", + "module": "index.ts", "scripts": { "build": "pnpm -w build:ui $npm_package_name", "//postversion": "pnpm build" }, "dependencies": { - "@opentiny/vue-renderless": "workspace:~", "@opentiny/vue-common": "workspace:~", + "@opentiny/vue-directive": "workspace:~", + "@opentiny/vue-renderless": "workspace:~", "@opentiny/vue-theme": "workspace:~" }, - "license": "MIT" + "devDependencies": { + "@opentiny-internal/vue-test-utils": "workspace:*", + "vitest": "^0.31.0" + } } \ No newline at end of file diff --git a/packages/vue/src/anchor/src/pc.vue b/packages/vue/src/anchor/src/pc.vue index 1d6113d498..655864759c 100644 --- a/packages/vue/src/anchor/src/pc.vue +++ b/packages/vue/src/anchor/src/pc.vue @@ -1,10 +1,12 @@