Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate demos to svelte and storybook #261

Closed
wants to merge 37 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
02cf4fe
initial storybook setup
dvdanielamoitzi Feb 1, 2023
85a3b4e
fix reference of chart object
dvdanielamoitzi Feb 1, 2023
1622953
added barchart stories to test
dvsilviyageo Feb 3, 2023
c5d98b9
added the mdx file
dvsilviyageo Feb 5, 2023
e6de59a
fix barchart issue
dvsilviyageo Feb 6, 2023
a33cc7d
added change-matix and horizon graph
dvsilviyageo Feb 15, 2023
efbeee8
added change matrix svelte file in the demos
dvsilviyageo Feb 15, 2023
f307315
Added the svelte file for heatmap, horizon graph and treemap for plotly
dvsilviyageo Feb 15, 2023
cbe8c71
delete the components folder in echarts
dvsilviyageo Feb 15, 2023
49662c0
Changed for barchart svelte
dvsilviyageo Feb 16, 2023
e5dace1
Added plotly demos as svelte files in storybook
dvsilviyageo Feb 16, 2023
5cb517a
Merged with latest develop and resolved conflicts
dvsilviyageo Feb 16, 2023
e7799d5
Removed extra spaces
dvsilviyageo Feb 16, 2023
c0bfcb2
Added echarts to the package json in demos and added barchart svelte …
dvsilviyageo Feb 17, 2023
b2f20a9
Added barchart as svelte file-WIP
dvsilviyageo Feb 17, 2023
16e49b4
Added onboardings to the barchart in echart demos in svelte file
dvsilviyageo Feb 17, 2023
beed15f
Added svelte file for echarts change matrix
dvsilviyageo Feb 17, 2023
a809073
Added echart horizon graph and refactored the folder structure in sto…
dvsilviyageo Feb 17, 2023
7d8b25b
Added scatterplot echarts in svelte and storybook
dvsilviyageo Feb 20, 2023
7a78f11
Added heatmap svelte file to storybook
dvsilviyageo Feb 20, 2023
e4c090b
Add treemap echart to storybook (WIP)
dvsilviyageo Feb 20, 2023
505d68d
Added introduction.mdx file to storybook
dvsilviyageo Feb 20, 2023
d1e8946
Added doc to storybook(WIP)
dvsilviyageo Feb 20, 2023
9161081
Echarts treemap in storybook (WIP)
dvsilviyageo Feb 20, 2023
7aee9a0
Added vega bar chart to storybook
dvsilviyageo Feb 20, 2023
05cedcf
Added vegalite change matrix to storybook
dvsilviyageo Feb 20, 2023
e302e94
Added vega horizonGraph to storybook
dvsilviyageo Feb 20, 2023
01d5c12
Added scatterplot vega to storybook
dvsilviyageo Feb 20, 2023
4104ab5
Refractored data in scatterplot
dvsilviyageo Feb 20, 2023
6be2b98
Refractored the code
dvsilviyageo Feb 21, 2023
2ffe201
Changed folder name
dvsilviyageo Feb 21, 2023
9e23621
Added resize observer to echarts
dvsilviyageo Feb 21, 2023
8ac0f4a
added typescript support in storybook svelte by updating main.js and …
dvsilviyageo Feb 21, 2023
b273091
Added typings for plotly demo
dvsilviyageo Feb 21, 2023
b399478
Added typings to vega demos
dvsilviyageo Feb 21, 2023
21e248c
Added a seperate json file for large data
dvsilviyageo Feb 21, 2023
349e44b
Added resize to echart demos in storybook
dvsilviyageo Feb 23, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53,393 changes: 39,292 additions & 14,101 deletions package-lock.json

Large diffs are not rendered by default.

15 changes: 12 additions & 3 deletions packages/core/src/onboarding.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,10 @@ export const injectOnboarding = (
showBackdrop,
backdropOpacity,
showHideCloseText,
showOnboardingNavigation,
showOnboardingNavigation,
showOnboarding,
contextId
contextId,
visElement
} = visState

contextId.set(contextKey)
Expand Down Expand Up @@ -91,8 +92,16 @@ export const injectOnboarding = (

const ref = { update: () => {} }

const updateOnboarding = (config: IAhoiConfig) => {
/**
*
* @param config the ahoiConfig to update
* @param element optional the updated element
*/
const updateOnboarding = (config: IAhoiConfig, element?: Element) => {
onboardingMessages.set(config.onboardingMessages)
if(element) {
visElement.set(element)
}
ref.update()
}

Expand Down
44 changes: 44 additions & 0 deletions packages/demos/.storybook/main.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
// const sveltePreprocess = require ('svelte-preprocess');

module.exports = {
"webpackFinal": async (config) => {
const svelteLoader = config.module.rules.find(
(r) => r.loader && r.loader.includes("svelte-loader"),
)
svelteLoader.options.preprocess = require("svelte-preprocess")({})
return config
},
"stories": [
"../**/*.stories.mdx",
"../**/*.stories.@(js|jsx|ts|tsx|svelte)"
],
"addons": [
"@storybook/addon-links",
"@storybook/addon-essentials",
"@storybook/addon-docs",
"@storybook/addon-interactions",
"@storybook/addon-svelte-csf",
"@storybook/addon-storysource"
],
"framework": "@storybook/svelte",

// svelteOptions: {
// preprocess: sveltePreprocess({
// babel: {
// presets: [
// [
// '@babel/preset-env',
// {
// loose: true,
// modules: false,
// targets: {
// esmodules: true,
// }
// }
// ]
// ]
// }
// })
// }

}
10 changes: 10 additions & 0 deletions packages/demos/.storybook/preview.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
export const parameters = {
actions: { argTypesRegex: "^on[A-Z].*" },
controls: {
matchers: {
color: /(background|color)$/i,
date: /Date$/,
},

},
}
4 changes: 4 additions & 0 deletions packages/demos/Visahoi/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
/node_modules/
/public/build/

.DS_Store
3 changes: 3 additions & 0 deletions packages/demos/Visahoi/.vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"recommendations": ["svelte.svelte-vscode"]
}
107 changes: 107 additions & 0 deletions packages/demos/Visahoi/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
# This repo is no longer maintained. Consider using `npm init vite` and selecting the `svelte` option or — if you want a full-fledged app framework and don't mind using pre-1.0 software — use [SvelteKit](https://kit.svelte.dev), the official application framework for Svelte.

---

# svelte app

This is a project template for [Svelte](https://svelte.dev) apps. It lives at https://github.com/sveltejs/template.

To create a new project based on this template using [degit](https://github.com/Rich-Harris/degit):

```bash
npx degit sveltejs/template svelte-app
cd svelte-app
```

*Note that you will need to have [Node.js](https://nodejs.org) installed.*


## Get started

Install the dependencies...

```bash
cd svelte-app
npm install
```

...then start [Rollup](https://rollupjs.org):

```bash
npm run dev
```

Navigate to [localhost:8080](http://localhost:8080). You should see your app running. Edit a component file in `src`, save it, and reload the page to see your changes.

By default, the server will only respond to requests from localhost. To allow connections from other computers, edit the `sirv` commands in package.json to include the option `--host 0.0.0.0`.

If you're using [Visual Studio Code](https://code.visualstudio.com/) we recommend installing the official extension [Svelte for VS Code](https://marketplace.visualstudio.com/items?itemName=svelte.svelte-vscode). If you are using other editors you may need to install a plugin in order to get syntax highlighting and intellisense.

## Building and running in production mode

To create an optimised version of the app:

```bash
npm run build
```

You can run the newly built app with `npm run start`. This uses [sirv](https://github.com/lukeed/sirv), which is included in your package.json's `dependencies` so that the app will work when you deploy to platforms like [Heroku](https://heroku.com).


## Single-page app mode

By default, sirv will only respond to requests that match files in `public`. This is to maximise compatibility with static fileservers, allowing you to deploy your app anywhere.

If you're building a single-page app (SPA) with multiple routes, sirv needs to be able to respond to requests for *any* path. You can make it so by editing the `"start"` command in package.json:

```js
"start": "sirv public --single"
```

## Using TypeScript

This template comes with a script to set up a TypeScript development environment, you can run it immediately after cloning the template with:

```bash
node scripts/setupTypeScript.js
```

Or remove the script via:

```bash
rm scripts/setupTypeScript.js
```

If you want to use `baseUrl` or `path` aliases within your `tsconfig`, you need to set up `@rollup/plugin-alias` to tell Rollup to resolve the aliases. For more info, see [this StackOverflow question](https://stackoverflow.com/questions/63427935/setup-tsconfig-path-in-svelte).

## Deploying to the web

### With [Vercel](https://vercel.com)

Install `vercel` if you haven't already:

```bash
npm install -g vercel
```

Then, from within your project folder:

```bash
cd public
vercel deploy --name my-project
```

### With [surge](https://surge.sh/)

Install `surge` if you haven't already:

```bash
npm install -g surge
```

Then, from within your project folder:

```bash
npm run build
surge public my-project.surge.sh
```
30 changes: 30 additions & 0 deletions packages/demos/Visahoi/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
"name": "svelte-app",
"version": "1.0.0",
"private": true,
"scripts": {
"build": "rollup -c",
"dev": "rollup -c -w",
"start": "sirv public --no-clear",
"check": "svelte-check --tsconfig ./tsconfig.json"
},
"devDependencies": {
"@rollup/plugin-commonjs": "^17.0.0",
"@rollup/plugin-node-resolve": "^11.0.0",
"rollup": "^2.3.4",
"rollup-plugin-css-only": "^3.1.0",
"rollup-plugin-livereload": "^2.0.0",
"rollup-plugin-svelte": "^7.0.0",
"rollup-plugin-terser": "^7.0.0",
"svelte": "^3.0.0",
"svelte-check": "^2.0.0",
"svelte-preprocess": "^4.0.0",
"@rollup/plugin-typescript": "^8.0.0",
"typescript": "^4.0.0",
"tslib": "^2.0.0",
"@tsconfig/svelte": "^2.0.0"
},
"dependencies": {
"sirv-cli": "^2.0.0"
}
}
Binary file added packages/demos/Visahoi/public/favicon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
63 changes: 63 additions & 0 deletions packages/demos/Visahoi/public/global.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
html, body {
position: relative;
width: 100%;
height: 100%;
}

body {
color: #333;
margin: 0;
padding: 8px;
box-sizing: border-box;
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
}

a {
color: rgb(0,100,200);
text-decoration: none;
}

a:hover {
text-decoration: underline;
}

a:visited {
color: rgb(0,80,160);
}

label {
display: block;
}

input, button, select, textarea {
font-family: inherit;
font-size: inherit;
-webkit-padding: 0.4em 0;
padding: 0.4em;
margin: 0 0 0.5em 0;
box-sizing: border-box;
border: 1px solid #ccc;
border-radius: 2px;
}

input:disabled {
color: #ccc;
}

button {
color: #333;
background-color: #f4f4f4;
outline: none;
}

button:disabled {
color: #999;
}

button:not(:disabled):active {
background-color: #ddd;
}

button:focus {
border-color: #666;
}
18 changes: 18 additions & 0 deletions packages/demos/Visahoi/public/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset='utf-8'>
<meta name='viewport' content='width=device-width,initial-scale=1'>

<title>Svelte app</title>

<link rel='icon' type='image/png' href='/favicon.png'>
<link rel='stylesheet' href='/global.css'>
<link rel='stylesheet' href='/build/bundle.css'>

<script defer src='/build/bundle.js'></script>
</head>

<body>
</body>
</html>
Loading