Skip to content

Commit d9d8504

Browse files
authored
Merge pull request #51 from palerdot/svelte-v5
v3: Svelte v5
2 parents 7ec0f09 + 6db39a5 commit d9d8504

22 files changed

+8463
-11994
lines changed

.circleci/config.yml

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

.github/workflows/test.yml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: Test Coverage
2+
3+
on:
4+
push:
5+
branches: [ master ]
6+
pull_request:
7+
branches: [ master ]
8+
9+
jobs:
10+
cache-and-install:
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- name: Checkout
15+
uses: actions/checkout@v4
16+
17+
# https://phoenixnap.com/kb/git-checkout-submodule
18+
- name: Checkout submodules
19+
run: git submodule update --init --recursive
20+
21+
- uses: pnpm/action-setup@v4
22+
name: Install pnpm
23+
24+
- name: Install Node.js
25+
uses: actions/setup-node@v4
26+
with:
27+
node-version: 20
28+
cache: 'pnpm'
29+
30+
- name: Install dependencies
31+
run: pnpm install
32+
33+
- name: Run tests
34+
run: pnpm test

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
.DS_Store
22
node_modules
33
/dist/
4+
5+
.svelte-kit

.gitmodules

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
[submodule "lib/d3-speedometer"]
22
path = lib/d3-speedometer
3-
url = git://github.com/palerdot/react-d3-speedometer
3+
url = https://github.com/palerdot/react-d3-speedometer

.storybook/main.js

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,33 @@
11
module.exports = {
2-
stories: ["../stories/**/*.stories.js"],
2+
stories: [
3+
"../stories/**/*.stories.mdx",
4+
"../stories/**/*.stories.@(js|jsx|ts|tsx)",
5+
],
6+
37
addons: [
48
"@storybook/addon-actions",
59
"@storybook/addon-links",
610
"@storybook/addon-storysource",
711
"@storybook/addon-docs",
812
],
13+
14+
async viteFinal(config, { configType }) {
15+
// customize the Vite config here
16+
return {
17+
...config,
18+
define: {
19+
...config.define,
20+
global: "window",
21+
},
22+
}
23+
},
24+
25+
framework: {
26+
name: "@storybook/svelte-vite",
27+
options: {},
28+
},
29+
30+
docs: {
31+
autodocs: true,
32+
},
933
}

.storybook/manager.js

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,16 @@
1-
import { addons } from "@storybook/addons"
2-
import { themes } from "@storybook/theming"
1+
import { addons } from "@storybook/manager-api"
2+
import { themes, create } from "@storybook/theming/create"
3+
import theme from "../src/core/theme"
4+
5+
const speedoTheme = create({
6+
...themes.dark,
7+
...theme,
8+
9+
brandTitle: "svelte-speedometer",
10+
brandUrl: "https://github.com/palerdot/svelte-speedometer",
11+
})
312

413
addons.setConfig({
514
showPanel: true,
6-
theme: themes.dark,
15+
theme: speedoTheme,
716
})

.storybook/preview.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import { addParameters } from "@storybook/svelte"
21
import { create } from "@storybook/theming/create"
32

43
import theme from "../src/core/theme"
@@ -10,7 +9,7 @@ const speedoTheme = create({
109
brandUrl: "https://github.com/palerdot/svelte-speedometer",
1110
})
1211

13-
addParameters({
12+
export const parameters = {
1413
options: {
1514
/**
1615
* display the top-level grouping as a "root" in the sidebar
@@ -23,4 +22,5 @@ addParameters({
2322
docs: {
2423
previewSource: "open",
2524
},
26-
})
25+
}
26+
export const tags = ["autodocs"];

README.md

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,20 @@
22

33
**svelte-speedometer** is a react component library for showing speedometer like gauge using d3.
44

5-
[![CircleCI Build Status](https://circleci.com/gh/palerdot/svelte-speedometer.svg?style=svg)](https://circleci.com/gh/palerdot/svelte-speedometer)
65
[![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat-square)](https://github.com/prettier/prettier)
7-
8-
[![NPM](https://nodei.co/npm/svelte-speedometer.png)](https://npmjs.org/package/svelte-speedometer)
6+
[![Github](https://github.com/palerdot/svelte-speedometer/actions/workflows/test.yml/badge.svg)](https://github.com/palerdot/svelte-speedometer/actions/workflows/test.yml/badge.svg)
7+
[![npm version](https://badge.fury.io/js/svelte-speedometer.svg)](https://badge.fury.io/js/svelte-speedometer)
98

109
![svelte-speedometer](https://raw.githubusercontent.com/palerdot/svelte-speedometer/master/speedo.gif)
1110

12-
**NOTE:** If you are using `Svelte v5`, please use upcoming `v3.0`.`v2.0` is compatible with `Svelte` `v3` or `v4`.
11+
12+
**IMPORTANT:** If you are using `Svelte v5`, please use `v3.0`.`v2.0` is compatible with `Svelte v3 or v4`.
1313

1414
## Usage:
1515

16+
**pnpm**
17+
`pnpm add svelte-speedometer`
18+
1619
**Yarn:**
1720
`yarn add svelte-speedometer`
1821

@@ -58,6 +61,7 @@ import Speedometer from "svelte-speedometer"
5861
| ringWidth | Number | 60 | Width of the speedometer ring. |
5962
| textColor | String | #666 | Should be a valid color code - colorname, hexadecimal name or rgb value. Used for both showing the current value and the segment values |
6063
| valueFormat | String | | should be a valid format for [d3-format](https://github.com/d3/d3-format#locale_format). By default, no formatter is used. You can use a valid d3 format identifier (for eg: `d` to convert float to integers), to format the values. **Note:** This formatter affects all the values (current value, segment values) displayed in the speedometer |
64+
| segmentValueFormatter | Function | value => value | Custom segment values formatter function. This function is applied after 'valueFormat' prop if present. |
6165
| currentValueText | String | ${value} | Should be provided a string which should have **${value}** placeholder which will be replaced with current value. By default, current value is shown (formatted with `valueFormat`). For example, if current Value is 333 if you would like to show `Current Value: 333`, you should provide a string **`Current Value: ${value}`**. See [Live Example](https://palerdot.in/svelte-speedometer/?selectedKind=svelte-speedometer&selectedStory=Custom%20Current%20Value%20Text&full=0&down=1&left=1&panelRight=0) |
6266
| currentValuePlaceholderStyle | String | ${value} | Should be provided a placeholder string which will be replaced with current value in `currentValueTextProp`. For example: you can use ruby like interpolation by giving following props - `<Speedometer currentValueText="Current Value: #{value}" currentValuePlaceholderStyle={"#{value}"} />`. This is also helpful if you face `no-template-curly-in-string` eslint warnings and would like to use different placeholder for current value |
6367
| customSegmentStops | Array | [] | Array of values **starting** at `min` value, and **ending** at `max` value. This configuration is useful if you would like to split the segments at custom points or have unequal segments at preferred values. If the values does not begin and end with `min` and `max` value respectively, an error will be thrown. This configuration will override `segments` prop, since total number of segments will be `length - 1` of `customSegmentProps`. For example, `[0, 50, 75, 100]` value will have three segments - `0-50`, `50-75`, `75-100`. See [Live Example](https://palerdot.in/svelte-speedometer/?path=/story/svelte-speedometer--custom-segment-stops) |

jest.config.js

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

0 commit comments

Comments
 (0)