Skip to content

Commit 296e414

Browse files
authored
Merge pull request #8 from novaui-org/develop
Develop
2 parents 1162c62 + 4bd2766 commit 296e414

File tree

10 files changed

+15304
-22948
lines changed

10 files changed

+15304
-22948
lines changed

package-lock.json

Lines changed: 15232 additions & 22904 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/components/package.json

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -39,17 +39,17 @@
3939
"@nova-org/icons": "^0.0.1",
4040
"@oku-ui/motion": "^0.3.4",
4141
"color2k": "^2.0.3",
42-
"vue": "^3.4.21"
42+
"vue": "^3.5.11"
4343
},
4444
"devDependencies": {
45-
"@types/node": "^20.12.11",
46-
"@vitejs/plugin-vue": "^5.0.4",
45+
"@types/node": "^20.16.10",
46+
"@vitejs/plugin-vue": "^5.1.4",
4747
"rollup-plugin-visualizer": "^5.12.0",
48-
"typescript": "^5.4.5",
49-
"vite": "^5.2.11",
50-
"vite-plugin-dts": "^3.9.1",
51-
"vite-plugin-static-copy": "^1.0.4",
48+
"typescript": "^5.6.2",
49+
"vite": "^5.4.8",
50+
"vite-plugin-dts": "^4.2.3",
51+
"vite-plugin-static-copy": "^1.0.6",
5252
"vite-svg-loader": "^5.1.0",
53-
"vue-tsc": "^2.0.17"
53+
"vue-tsc": "^2.1.6"
5454
}
5555
}

packages/components/src/components/NSlideTransition/use-slide-transition.ts

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import type {NSlideTransitionProps} from 'src/components'
2-
import {ref} from 'vue'
32

43
const CLOSED_SIZE = '0px'
54

@@ -51,7 +50,7 @@ function prepareElement(element: HTMLElement, initialStyle: initialStyle) {
5150
return initialStyle.height && initialStyle.height != CLOSED_SIZE ? initialStyle.height : height
5251
}
5352

54-
function getEnterKeyframes(height: string, initialStyle: initialStyle) {
53+
function getEnterKeyframes(height: string, initialStyle: initialStyle, parentGap: string | null) {
5554
return [
5655
{
5756
height: CLOSED_SIZE,
@@ -60,7 +59,8 @@ function getEnterKeyframes(height: string, initialStyle: initialStyle) {
6059
paddingBottom: CLOSED_SIZE,
6160
borderTopWidth: CLOSED_SIZE,
6261
borderBottomWidth: CLOSED_SIZE,
63-
marginTop: CLOSED_SIZE,
62+
/* Handle case, where item is inside flexbox and gap is used */
63+
marginTop: parentGap ? `-${parentGap}` : CLOSED_SIZE,
6464
marginBottom: CLOSED_SIZE,
6565
},
6666
{
@@ -94,11 +94,25 @@ function animateTransition(
9494
return animation
9595
}
9696

97+
function getParentGap(element: Element): string | null {
98+
const parentElement = element.parentElement
99+
if (!parentElement) {
100+
return null
101+
}
102+
103+
const {rowGap, display} = getComputedStyle(element.parentElement!)
104+
if (display !== 'flex' || rowGap === 'normal') {
105+
return null
106+
}
107+
108+
return rowGap
109+
}
110+
97111
export function useSlideTransition(props: NSlideTransitionProps) {
98112
function enterTransition(element: Element, doneCallback: () => void) {
99113
const initialStyle = getElementStyle(<HTMLElement>element)
100114
const height = prepareElement(<HTMLElement>element, initialStyle)
101-
const keyframes = getEnterKeyframes(height, initialStyle)
115+
const keyframes = getEnterKeyframes(height, initialStyle, getParentGap(element))
102116
const options = {duration: props.duration, easing: 'ease-in-out'}
103117

104118
animateTransition(<HTMLElement>element, initialStyle, doneCallback, keyframes, options)
@@ -111,7 +125,7 @@ export function useSlideTransition(props: NSlideTransitionProps) {
111125
;(<HTMLElement>element).style.height = height
112126
;(<HTMLElement>element).style.overflow = 'hidden'
113127

114-
const keyframes = getEnterKeyframes(height, initialStyle).reverse()
128+
const keyframes = getEnterKeyframes(height, initialStyle, getParentGap(element)).reverse()
115129
const options = {duration: props.duration, easing: 'ease-in-out'}
116130
animateTransition(<HTMLElement>element, initialStyle, doneCallback, keyframes, options)
117131
}

packages/components/src/components/NSlideTransitionHorizontal/use-slide-transition-horizontal.ts

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ function getElementStyle(element: HTMLElement) {
3535
}
3636
}
3737

38-
function getEnterKeyframes(width: string, initialStyle: initialStyle) {
38+
function getEnterKeyframes(width: string, initialStyle: initialStyle, parentGap: string | null) {
3939
return [
4040
{
4141
width: CLOSED_SIZE,
@@ -45,7 +45,8 @@ function getEnterKeyframes(width: string, initialStyle: initialStyle) {
4545
paddingRight: CLOSED_SIZE,
4646
borderLeftWidth: CLOSED_SIZE,
4747
borderRightWidth: CLOSED_SIZE,
48-
marginLeft: CLOSED_SIZE,
48+
/* Handle case, where item is inside flexbox and gap is used */
49+
marginLeft: parentGap ? `-${parentGap}` : CLOSED_SIZE,
4950
marginRight: CLOSED_SIZE,
5051
},
5152
{
@@ -80,6 +81,20 @@ function animateTransition(
8081
return animation
8182
}
8283

84+
function getParentGap(element: Element): string | null {
85+
const parentElement = element.parentElement
86+
if (!parentElement) {
87+
return null
88+
}
89+
90+
const {columnGap, display} = getComputedStyle(element.parentElement!)
91+
if (display !== 'flex' || columnGap === 'normal') {
92+
return null
93+
}
94+
95+
return columnGap
96+
}
97+
8398
export function useSlideTransitionHorizontal(props: NSlideTransitionProps) {
8499
function enterTransition(element: Element, doneCallback: () => void) {
85100
const initialStyle = getElementStyle(<HTMLElement>element)
@@ -88,7 +103,7 @@ export function useSlideTransitionHorizontal(props: NSlideTransitionProps) {
88103
;(<HTMLElement>element).style.width = width
89104
;(<HTMLElement>element).style.overflow = 'hidden'
90105

91-
const keyframes = getEnterKeyframes(width, initialStyle)
106+
const keyframes = getEnterKeyframes(width, initialStyle, getParentGap(element))
92107
const options = {duration: props.duration, easing: 'ease-in-out'}
93108
animateTransition(<HTMLElement>element, initialStyle, doneCallback, keyframes, options)
94109
}
@@ -100,7 +115,7 @@ export function useSlideTransitionHorizontal(props: NSlideTransitionProps) {
100115
;(<HTMLElement>element).style.width = width
101116
;(<HTMLElement>element).style.overflow = 'hidden'
102117

103-
const keyframes = getEnterKeyframes(width, initialStyle).reverse()
118+
const keyframes = getEnterKeyframes(width, initialStyle, getParentGap(element)).reverse()
104119
const options = {duration: props.duration, easing: 'ease-in-out'}
105120
animateTransition(<HTMLElement>element, initialStyle, doneCallback, keyframes, options)
106121
}

packages/docs/.vitepress/config.mts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ export default defineConfig({
5858
preprocessorOptions: {
5959
scss: {
6060
additionalData: '@import "@nova-org/components/scss/index.variables.scss";',
61+
api: 'modern-compiler',
6162
},
6263
},
6364
},

packages/docs/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,16 @@
1717
"preview": "vitepress preview"
1818
},
1919
"devDependencies": {
20-
"sass": "^1.75.0",
21-
"vitepress": "^1.1.0"
20+
"sass": "^1.79.4",
21+
"vitepress": "^1.3.4"
2222
},
2323
"dependencies": {
2424
"@nova-org/components": "^0.0.1",
2525
"@nova-org/icons": "^0.0.1",
2626
"@oku-ui/motion": "^0.3.4"
2727
},
2828
"peerDependencies": {
29-
"vue": "^3.4.21"
29+
"vue": "^3.5.11"
3030
},
3131
"nx": {
3232
"targets": {

packages/docs/transitions/SlideHorizontal.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,7 @@ Slide transition (horizontal) animates element's:
2525
- **Width**
2626
- **Margin** (left, right)
2727
- **Padding** (left, right)
28-
29-
[//]: # (TODO: Add animating flex - or wrap single into separate DIV)
28+
- **Flex gap** - when an element is placed inside a flexbox element with a gap property set, it will also animate it
3029

3130
<display-container>
3231
<single/>

packages/docs/transitions/SlideVertical.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ import Multiple from '../examples/transitions/slide-vertical/Multiple.vue'
77

88
# Slide transition - vertical
99

10-
Slide transition (vertical) provides a simple way to **animate height** of single or multiple components or HTML elements when
11-
using conditional rendering.
10+
Slide transition (vertical) provides a simple way to **animate height** of single or multiple components or HTML
11+
elements when using conditional rendering.
1212

1313
## Import
1414

@@ -25,8 +25,7 @@ Slide transition (vertical) animates element's:
2525
- **Height**
2626
- **Margin** (top, bottom)
2727
- **Padding** (top, bottom)
28-
29-
[//]: # (TODO: Add animating flex - or wrap single into separate DIV)
28+
- **Flex gap** - when an element is placed inside a flexbox element with a gap property set, it will also animate it
3029

3130
<display-container vertical>
3231
<single/>

packages/icons/package.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,11 @@
3535
"icons:generate": "npx ts-node --esm ./scripts/index.mts icons"
3636
},
3737
"devDependencies": {
38-
"@types/node": "^20.11.28",
39-
"typescript": "^5.4.2",
40-
"vite": "^5.1.6",
41-
"vite-plugin-dts": "^3.7.3",
38+
"@types/node": "^20.16.10",
39+
"typescript": "^5.6.2",
40+
"vite": "^5.4.8",
41+
"vite-plugin-dts": "^4.2.3",
4242
"vite-svg-loader": "^5.1.0",
43-
"vue-tsc": "^2.0.6"
43+
"vue-tsc": "^2.1.6"
4444
}
4545
}

packages/storybook/package.json

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -22,19 +22,19 @@
2222
"vue": "^3.3.4"
2323
},
2424
"devDependencies": {
25-
"@storybook/addon-essentials": "^7.4.6",
26-
"@storybook/addon-interactions": "^7.4.6",
27-
"@storybook/addon-links": "^7.4.6",
28-
"@storybook/blocks": "^7.4.6",
25+
"@storybook/addon-essentials": "^8.3.5",
26+
"@storybook/addon-interactions": "^8.3.5",
27+
"@storybook/addon-links": "^8.3.5",
28+
"@storybook/blocks": "^8.3.5",
2929
"@storybook/testing-library": "^0.2.2",
30-
"@storybook/vue3": "^7.4.6",
31-
"@storybook/vue3-vite": "^7.4.6",
32-
"@vitejs/plugin-vue": "^4.2.3",
33-
"react": "^18.2.0",
34-
"react-dom": "^18.2.0",
35-
"storybook": "^7.4.6",
36-
"typescript": "^5.0.2",
37-
"vite": "^4.4.5",
38-
"vue-tsc": "^1.8.5"
30+
"@storybook/vue3": "^8.3.5",
31+
"@storybook/vue3-vite": "^8.3.5",
32+
"@vitejs/plugin-vue": "^5.1.4",
33+
"react": "^18.3.1",
34+
"react-dom": "^18.3.1",
35+
"storybook": "^8.3.5",
36+
"typescript": "^5.6.2",
37+
"vite": "^5.4.8",
38+
"vue-tsc": "^2.1.6"
3939
}
4040
}

0 commit comments

Comments
 (0)