@reuters-graphics/graphics-svelte-components

0.3.32 • Public • Published

⚙️ graphics-svelte-components

npm version

Svelte components for graphics pages.

➡️ Components demos & docs site

Built with:

Quickstart

yarn add @reuters-graphics/graphics-svelte-components
<script>
  import { Nav } from '@reuters-graphics/graphics-svelte-components';
</script>

<Nav />

📚 Read the docs...

... for details on using all the components included.

With SvelteKit/Vite

If you're using this package with SvelteKit (which uses Vite), you'll likely need to add some of its dependencies to Vite's dependency pre-bundling config. For example:

export default {
  // ...
  kit: {
    // ...
    vite: {
      // ...
      optimizeDeps: {
        include: ['lodash-es', 'pym.js', 'classnames', 'ua-parser-js'],
      },
    },
  },
};

If you're using the graphics kit this config is already included.

Developing new components

First step: make a branch for your new component.

Next, add your component in a folder one level below src/lib, for example:

src/
  lib/
    MyComponent/ 👈
      index.svelte 👈

Be sure to export your component from the library's entry module, src/lib/index.js:

// src/lib/index.js
export { default as MyComponent } from './MyComponent/index.svelte';

To document and demo your component, add a docs.svx file in your component directory:

MyComponent/
  docs.svx 👈
  index.svelte

Use Svelte in Markdown syntax to demo your component and document its features.

Note, you must add some basic frontmatter data -- a title, description and slug -- to make your demo page discoverable in the demo site.

Example

---
title: MyComponent
description: A component that does things.
slug: my-component
---

<script>
  import MyComponent from './index.svelte';
  import DemoContainer from '../_docs/DemoContainer/index.svelte';
</script>

# MyComponent

A component that does things.

```svelte
<script>
  import { MyComponent } from '@reuters-graphics/graphics-svelte-components';
</script>

<MyComponent />
```

<DemoContainer>
  <MyComponent />
</DemoContainer>

When you're ready, make a pull pequest for your component.

Publishing

Once you've completed documenting your component, commit it and then version the package, which will publish the library to npm:

git add .
git commit -m "my new component added"
git push origin master
npm version patch

Versions

Current Tags

VersionDownloads (Last 7 Days)Tag
0.3.320latest

Version History

VersionDownloads (Last 7 Days)Published
0.3.320
0.3.310
0.3.300
0.3.290
0.3.280
0.3.270
0.3.260
0.3.250
0.3.240
0.3.230
0.3.220
0.3.200
0.3.190
0.3.180
0.3.171
0.3.131
0.3.121
0.3.92
0.3.81
0.3.60
0.3.50
0.3.40
0.3.30
0.2.40
0.2.30
0.2.20
0.2.10
0.2.00
0.1.570
0.1.560
0.1.550
0.1.540
0.1.530
0.1.520
0.1.510
0.1.500
0.1.490
0.1.481
0.1.471
0.1.461
0.1.451
0.1.440
0.1.430
0.1.420
0.1.410
0.1.400
0.1.390
0.1.380
0.1.360
0.1.350
0.1.340
0.1.330
0.1.290
0.1.280
0.1.260
0.1.250
0.1.240
0.1.230
0.1.220
0.1.210
0.1.200
0.1.190
0.1.180
0.1.170
0.1.160
0.1.150
0.1.140
0.1.130
0.1.120
0.1.110
0.1.100
0.1.90
0.1.80
0.1.70
0.1.60
0.1.30
0.0.30
0.0.20
0.0.10

Package Sidebar

Install

npm i @reuters-graphics/graphics-svelte-components

Weekly Downloads

10

Version

0.3.32

License

none

Unpacked Size

1.05 MB

Total Files

77

Last publish

Collaborators

  • allyjlevine
  • hobbes7878
  • mf475
  • pkd2512
  • swhart22
  • su.dev