Skip to content

Commit 60d2206

Browse files
committed
1.2.9 (#18)
* Tests - Drop experimental webkit tests, streamline actions * Pkg - Up deps, bump 1.2.9, enable watch dev mode * Core - Refactor syntax, improve readability * Pkg - Edit readme * Pkg - Enable publish using provenance statements * Demo - Update examples, readme * CI - Enable publish on release tag
1 parent 8b0ded8 commit 60d2206

File tree

13 files changed

+168
-156
lines changed

13 files changed

+168
-156
lines changed

.github/workflows/chrome.yml renamed to .github/workflows/chrome-tests.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
name: Chrome Tests
22

3-
on: [push]
3+
on:
4+
push:
5+
workflow_call:
46

57
jobs:
68
cypress-ct:
@@ -15,8 +17,6 @@ jobs:
1517
id: pnpm-install
1618
with:
1719
version: 8
18-
run_install: false
19-
- name: Install dependencies
20-
run: pnpm install
20+
run_install: true
2121
- name: Chrome tests
2222
run: pnpm run test:chrome

.github/workflows/firefox.yml renamed to .github/workflows/firefox-tests.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
name: Firefox Tests
22

3-
on: [push]
3+
on:
4+
push:
5+
workflow_call:
46

57
jobs:
68
cypress-ct:
@@ -15,8 +17,6 @@ jobs:
1517
id: pnpm-install
1618
with:
1719
version: 8
18-
run_install: false
19-
- name: Install dependencies
20-
run: pnpm install
20+
run_install: true
2121
- name: Firefox tests
2222
run: pnpm run test:firefox

.github/workflows/publish.yml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: Publish to NPM
2+
3+
on:
4+
push:
5+
tags: ['v*']
6+
workflow_dispatch:
7+
8+
jobs:
9+
chrome-tests:
10+
uses: ./.github/workflows/chrome-tests.yml
11+
firefox-tests:
12+
uses: ./.github/workflows/firefox-tests.yml
13+
publish:
14+
needs: [chrome-tests, firefox-tests]
15+
runs-on: ubuntu-latest
16+
permissions:
17+
contents: read
18+
id-token: write
19+
steps:
20+
- uses: actions/checkout@v3
21+
- uses: actions/setup-node@v3
22+
with:
23+
node-version: '19.x'
24+
registry-url: 'https://registry.npmjs.org'
25+
- uses: pnpm/action-setup@v2
26+
name: Install pnpm
27+
with:
28+
version: 8
29+
run_install: true
30+
- name: Build
31+
run: pnpm build
32+
- name: Pack
33+
run: rm -rf *.tgz && npm pack
34+
- name: Publish
35+
run: npm publish *.tgz --provenance
36+
env:
37+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

.github/workflows/webkit.yml

Lines changed: 0 additions & 22 deletions
This file was deleted.

README.md

Lines changed: 18 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
![npm](https://img.shields.io/npm/v/vue-collapsed?color=46c119) ![dependencies](https://img.shields.io/badge/dependencies-0-success) ![npm bundle size](https://img.shields.io/bundlephobia/minzip/vue-collapsed?color=success) ![downloads](https://img.shields.io/npm/dm/vue-collapsed) ![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/smastrom/vue-collapsed/chrome.yml?branch=main&label=tests)
1+
![npm](https://img.shields.io/npm/v/vue-collapsed?color=46c119) ![dependencies](https://img.shields.io/badge/dependencies-0-success) ![npm bundle size](https://img.shields.io/bundlephobia/minzip/vue-collapsed?color=success) ![downloads](https://img.shields.io/npm/dm/vue-collapsed) ![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/smastrom/vue-collapsed/chrome-tests.yml?branch=main&label=tests)
22

33
# Vue Collapsed
44

@@ -14,10 +14,6 @@ Check out my other packages for Vue 3:
1414
> _Fully-featured notification system for Vue and Nuxt._
1515
> [Visit repo ➔ ](https://github.com/smastrom/notivue)
1616
17-
> 🔥 **Vue Use Fixed Header**
18-
> _Turn your boring fixed header into a smart one with one line of code._
19-
> [Visit repo ➔ ](https://github.com/smastrom/vue-use-fixed-header)
20-
2117
> 👌 **Vue Use Active Scroll**
2218
> _Accurate TOC/sidebar links without compromises._
2319
> [Visit repo ➔ ](https://github.com/smastrom/vue-use-active-scroll)
@@ -27,9 +23,10 @@ Check out my other packages for Vue 3:
2723
## Installation
2824

2925
```shell
30-
npm i -S vue-collapsed
26+
npm i vue-collapsed
3127
# yarn add vue-collapsed
3228
# pnpm add vue-collapsed
29+
# bun add vue-collapsed
3330
```
3431

3532
## Props
@@ -63,7 +60,7 @@ const isExpanded = ref(false)
6360
<button @click="isExpanded = !isExpanded">Trigger</button>
6461
6562
<Collapse :when="isExpanded">
66-
<p>This is a paragraph.</p>
63+
<p>{{ 'Collapsed '.repeat(100) }}</p>
6764
</Collapse>
6865
</template>
6966
```
@@ -84,7 +81,7 @@ If you prefer to use a custom duration or easing, add a class to Collapse that t
8481

8582
```vue
8683
<Collapse :when="isExpanded" class="v-collapse">
87-
<p>This is a paragraph.</p>
84+
<p>{{ 'Collapsed '.repeat(100) }}</p>
8885
</Collapse>
8986
```
9087

@@ -95,10 +92,6 @@ If you prefer to use a custom duration or easing, add a class to Collapse that t
9592
}
9693
```
9794

98-
:bulb: Use [calc()](https://developer.mozilla.org/en-US/docs/Web/CSS/calc) to control the speed while keeping the ratio, _e.g. `calc(var(--vc-auto-duration) * 0.75)`_.
99-
100-
:bulb: Find a full list of easings at [easings.net](https://easings.net).
101-
10295
### Multiple transitions
10396

10497
To transition other properties use the attribute `data-collapse`:
@@ -111,7 +104,9 @@ To transition other properties use the attribute `data-collapse`:
111104
```css
112105
.v-collapse {
113106
--dur-easing: var(--vc-auto-duration) cubic-bezier(0.33, 1, 0.68, 1);
114-
transition: height var(--dur-easing), opacity var(--dur-easing);
107+
transition:
108+
height var(--dur-easing),
109+
opacity var(--dur-easing);
115110
}
116111

117112
.v-collapse[data-collapse='expanded'],
@@ -141,7 +136,7 @@ Above values can also be accessed using `v-slot`:
141136

142137
```vue
143138
<Collapse :when="isExpanded" class="v-collapse" v-slot="{ state }">
144-
{{ state === 'collapsing' ? 'Collapsing the content...' : null }}
139+
{{ state === 'collapsing' ? 'Collapsing content...' : null }}
145140
</Collapse>
146141
```
147142

@@ -212,16 +207,19 @@ import { Collapse } from 'vue-collapsed'
212207
213208
const isExpanded = ref(false)
214209
210+
const TOGGLE_ID = 'toggle-id'
211+
const COLLAPSE_ID = 'collapse-id'
212+
215213
const toggleAttrs = computed(() => ({
216-
id: 'toggle-id',
217-
'aria-controls': 'collapse-id',
214+
id: TOGGLE_ID,
215+
'aria-controls': COLLAPSE_ID,
218216
'aria-expanded': isExpanded.value
219217
}))
220218
221219
const collapseAttrs = {
222220
role: 'region',
223-
id: 'collapse-id',
224-
'aria-labelledby': 'toggle-id'
221+
id: COLLAPSE_ID,
222+
'aria-labelledby': TOGGLE_ID
225223
}
226224
227225
function handleCollapse() {
@@ -233,7 +231,7 @@ function handleCollapse() {
233231
<div>
234232
<button v-bind="toggleAttrs" @click="handleCollapse">This a panel.</button>
235233
<Collapse v-bind="collapseAttrs" :when="isExpanded">
236-
<p>This is a paragraph.</p>
234+
<p>{{ 'Collapsed '.repeat(100) }}</p>
237235
</Collapse>
238236
</div>
239237
</template>
@@ -244,7 +242,7 @@ function handleCollapse() {
244242
```vue
245243
<template>
246244
<Collapse :when="isExpanded" class="instant-collapse">
247-
<p>This is a paragraph.</p>
245+
<p>{{ 'Collapsed '.repeat(100) }}</p>
248246
</Collapse>
249247
</template>
250248

cypress.config.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import { defineConfig } from 'cypress'
33
export default defineConfig({
44
component: {
55
video: false,
6-
experimentalWebKitSupport: true,
76
devServer: {
87
framework: 'vue',
98
bundler: 'vite',

demo/SingleCollapse.vue

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,18 @@ function handleCollapse() {
1515
* https://www.w3.org/WAI/ARIA/apg/example-index/accordion/accordion
1616
*/
1717
18+
const TOGGLE_ID = 'toggle'
19+
const COLLAPSE_ID = 'collapse'
20+
1821
const toggleAttrs = computed(() => ({
19-
id: 'toggle',
22+
id: TOGGLE_ID,
23+
'aria-controls': COLLAPSE_ID,
2024
'aria-expanded': isExpanded.value,
21-
'aria-controls': 'collapse',
2225
}))
2326
2427
const collapseAttrs = {
25-
'aria-labelledby': 'toggle',
26-
id: 'collapse',
28+
'aria-labelledby': TOGGLE_ID,
29+
id: COLLAPSE_ID,
2730
role: 'region',
2831
}
2932
</script>

demo/main.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import Collapse from '../src/Collapse.vue'
1+
import { Collapse } from '../dist'
22
import { createApp } from 'vue'
33
import App from './App.vue'
44

package.json

Lines changed: 19 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "vue-collapsed",
3-
"version": "1.2.8",
3+
"version": "1.2.9",
44
"private": false,
55
"description": "Dynamic CSS height transition from any to auto and vice versa for Vue 3. Accordion ready.",
66
"keywords": [
@@ -39,37 +39,33 @@
3939
"dist/*"
4040
],
4141
"scripts": {
42-
"build": "rimraf dist && vite build",
42+
"build": "vite build",
4343
"postbuild": "pnpm pack",
44-
"build:app": "vite build --mode app",
45-
"dev": "vite",
46-
"preview": "vite build --mode app && vite preview",
44+
"build:app": "vite build && vite build --mode app",
45+
"dev": "concurrently \"vite\" \"vite build --watch\"",
46+
"preview": "vite build:app && vite preview",
4747
"prepare": "husky install",
48-
"test:chrome": "cypress run --component --browser chrome",
49-
"test:firefox": "cypress run --component --browser firefox",
50-
"test:webkit": "cypress run --component --browser webkit",
51-
"test": "pnpm test:chrome && pnpm test:firefox && pnpm test:webkit",
52-
"test:gui": "cypress open --component"
48+
"test:chrome": "pnpm build && cypress run --component --browser chrome",
49+
"test:firefox": "pnpm build && cypress run --component --browser firefox",
50+
"test:gui": "concurrently \"vite build --watch\" \"cypress open --component\""
5351
},
5452
"lint-staged": {
5553
"*.{ts,vue,md}": "prettier --write"
5654
},
5755
"devDependencies": {
58-
"@babel/types": "^7.22.10",
59-
"@rollup/plugin-terser": "^0.4.3",
60-
"@types/node": "^18.17.6",
61-
"@vitejs/plugin-vue": "^4.3.1",
62-
"cypress": "^12.17.4",
56+
"@rollup/plugin-terser": "^0.4.4",
57+
"@types/node": "^20.8.7",
58+
"@vitejs/plugin-vue": "^4.4.0",
59+
"concurrently": "^8.2.2",
60+
"cypress": "^13.3.2",
6361
"cypress-wait-frames": "^0.9.4",
6462
"husky": "^8.0.3",
65-
"lint-staged": "^13.3.0",
66-
"playwright-webkit": "^1.37.1",
67-
"prettier": "^2.8.8",
68-
"rimraf": "^4.4.1",
69-
"typescript": "^4.9.5",
70-
"vite": "^4.4.9",
71-
"vite-plugin-dts": "^1.7.3",
63+
"lint-staged": "^15.0.2",
64+
"prettier": "^3.0.3",
65+
"typescript": "^5.2.2",
66+
"vite": "^4.5.0",
67+
"vite-plugin-dts": "^3.6.0",
7268
"vue": "^3.3.4",
73-
"vue-tsc": "^1.8.8"
69+
"vue-tsc": "^1.8.19"
7470
}
7571
}

0 commit comments

Comments
 (0)