Skip to content

Commit a69d84e

Browse files
authored
Merge pull request #38 from svelte-plugins/v3.0
🧹 ✨ refactor(library): upgrade build scripts, fix type defs, add support for hideOnOutsideClick
2 parents 06a0c2d + 30d30e1 commit a69d84e

27 files changed

+4805
-14059
lines changed

.eslintrc.json

+4
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@
1212
"extends": ["eslint:recommended", "plugin:vitest/recommended"],
1313
"ignorePatterns": ["**/*.snap.js"],
1414
"overrides": [
15+
{
16+
"files": ["*.ts"],
17+
"parser": "@typescript-eslint/parser"
18+
},
1519
{
1620
"files": ["*.svelte"],
1721
"parser": "svelte-eslint-parser"

.github/workflows/unit.yml

+21-16
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,40 @@
1-
name: Unit Tests (Vitest)
2-
1+
name: Unit Tests
32
on:
43
push:
54
branches:
65
- main
6+
paths:
7+
- src/**
78
pull_request:
89
types: [opened, synchronize, reopened]
9-
1010
jobs:
11-
build:
11+
tests:
1212
runs-on: ubuntu-latest
13+
name: Tests
1314
if: |
1415
(
1516
!contains(github.event.head_commit.message, '[skip ci]') &&
1617
!contains(github.event.head_commit.message, 'version bump')
1718
)
1819
steps:
19-
- uses: actions/checkout@v2
20-
- uses: actions/setup-node@v1
20+
- name: Checkout repository
21+
uses: actions/checkout@v3
22+
- name: Install pnpm
23+
uses: pnpm/action-setup@v2
2124
with:
22-
node-version: '18'
23-
registry-url: 'https://registry.npmjs.org'
24-
- uses: szenius/[email protected]
25+
version: 8.11
26+
- name: Install Node
27+
uses: actions/setup-node@v3
2528
with:
26-
timezoneLinux: "America/Los_Angeles"
27-
timezoneMacos: "America/Los_Angeles"
28-
timezoneWindows: "Pacific Standard Time"
29-
- run: npm i
30-
- run: npm test
31-
32-
- uses: actions/upload-artifact@v2
29+
node-version: 20
30+
cache: 'pnpm'
31+
registry-url: 'https://registry.npmjs.org'
32+
- name: Install dependencies
33+
run: pnpm install
34+
- name: Run tests
35+
run: pnpm test
36+
- name: Upload artifacts
37+
uses: actions/upload-artifact@v2
3338
if: failure()
3439
with:
3540
name: unit-tests

.gitignore

+2-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@
1919
!.storybook
2020

2121
# generated
22-
.vercel
22+
/.vercel
23+
/.package-lock.json
2324
/node_modules
2425
/dist
2526

.lintstagedrc

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
{
2-
"./src/**/*.{test.js,js,json,svelte}": [
2+
"./src/**/*.{test.js,ts,json,svelte}": [
3+
"svelte-check --tsconfig ./tsconfig.json",
34
"eslint -c ./.eslintrc.json --fix",
45
"prettier --write"
56
]

.prettierrc.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"printWidth": 120,
2+
"printWidth": 80,
33
"trailingComma": "none",
44
"tabWidth": 2,
55
"semi": true,

README.md

+22-17
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@ yarn add -D @svelte-plugins/tooltips
1212
# or with NPM
1313

1414
npm i -D @svelte-plugins/tooltips
15+
16+
# or with PNPM
17+
18+
pnpm i -D @svelte-plugins/tooltips
1519
```
1620

1721
## Using the Tooltip component
@@ -40,25 +44,26 @@ Checkout out my <u use:tooltip={{ content: 'Hello World!' }}>tooltip</u>
4044
## API
4145

4246
### Props
43-
| Prop | Description | Value |
44-
| :----------- | :------------------------------------------------------------------ | :---------------------------------------------- |
45-
| action | The action that triggers the tooltip (hover | click | prop) | `string` (default: `hover`) |
46-
| animation | The animation to apply to the tooltip | `string` (default: ``) |
47-
| delay | The animation delay in milliseconds to apply to the tooltip | `number` (default: `200`) |
48-
| arrow | If `false`, the tooltip arrow will not be shown. | `boolean` (default: `true`) |
49-
| autoPosition | Adjust tooltip position if viewport clipping occurs | `string` (default: `false`) |
50-
| content | The string or object containing componentref and props | `string` | `object` component (default: ``) |
51-
| maxWidth | The max allowable width of the tooltip content | `number` (default: `200`) |
52-
| position | The position where the tooltip should appear relative to its parent | `string` (default: `top`) |
53-
| theme | The CSS theme class name | `string` (default: ``) |
54-
| show | Allows you to manually control the tooltip visibility | `boolean` (default: `false`) |
55-
| style | The object containing theme variable overrides | `object` (default: `null`) |
47+
| Prop | Description | Value |
48+
| :----------------- | :------------------------------------------------------------------ | :---------------------------------------------- |
49+
| action | The action that triggers the tooltip (hover | click | prop) | `string` (default: `hover`) |
50+
| animation | The animation to apply to the tooltip | `string` (default: ``) |
51+
| arrow | If `false`, the tooltip arrow will not be shown. | `boolean` (default: `true`) |
52+
| autoPosition | Adjust tooltip position if viewport clipping occurs | `boolean` (default: `false`) |
53+
| content | The string or object containing componentref and props | `string` | `object` component (default: ``) |
54+
| delay | The animation delay in milliseconds to apply to the tooltip | `number` (default: `200`) |
55+
| hideOnOutsideClick | Hides a tooltip when an outside click occurs | `boolean` (default: `false`) |
56+
| maxWidth | The max allowable width of the tooltip content | `number` (default: `200`) |
57+
| position | The position where the tooltip should appear relative to its parent | `string` (default: `top`) |
58+
| show | Allows you to manually control the tooltip visibility | `boolean` (default: `false`) |
59+
| style | The object containing theme variable overrides | `object` (default: `null`) |
60+
| theme | The CSS theme class name | `string` (default: ``) |
5661

5762
#### Using components as content
58-
| Prop | Description | Value |
59-
| :-----------------| :------------------------------------------------------------- | :---------------------------------- |
60-
| content.component | Svelte component | `component` (default: `null`) |
61-
| content.props | Any component propeties | `object` (default: `null`) |
63+
| Prop | Description | Value |
64+
| :-----------------| :------------------------------------------------------------------- | :---------------------------------------------- |
65+
| content.component | Svelte component | `component` (default: `null`) |
66+
| content.props | Any component propeties | `object` (default: `null`) |
6267

6368

6469
```svelte

babel.config.json

-7
This file was deleted.

docs/package-lock.json

+18-9
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)