3.1.1 • Published 2 months ago

@ircam/sc-components v3.1.1

Weekly downloads
-
License
BSD-3-Clause
Repository
github
Last release
2 months ago

sc-components

npm version

sc-components logo

Simple and robust Web Component library for audio and creative applications in the browser.

banner

The library is built with lit.

Demo and Documentation

http://ircam-ismm.github.io/sc-components/

Goal & Philosophy

This is a rather opinionated library, that primarily aims at providing practical and robust interfaces for practitionners in working and performance situations. Hence, it proposes different interaction modalities such as keyboard and MIDI controls where meaningful, and pretty agressively bypasses or overrides certain default browser's behaviours such as context menus, text selection, etc.

Usage

With npm and bundlers

Install the library using npm (or yarn, or whatever)

npm install --save @ircam/sc-components

Each components lives in its own file and can be imported separately, e.g.:

import { html, render } from 'lit';
import '@ircam/sc-components/sc-toggle.js';

render(html`
  <sc-toggle
    @change=${e => console.log(e)}
  ></sc-toggle>
`, document.body);

For convenience, we also provide a global entry point which imports all components. However, in most cases you should avoid using this shortcut to keep your bundle size as small as possible:

import '@ircam/sc-components';

With unpkg

If you don't use a bundler or for simple testing, you can also use the library from https://unpkg.com/.

In HTML file

<!DOCTYPE html>
<html>
<head>
  <script type="module" src="https://unpkg.com/@ircam/sc-components@latest"></script>
</head>
<body>
  <sc-toggle></sc-toggle>
  <script>
    const $toggle = document.querySelector('sc-toggle');
    $toggle.addEventListener('change', e => console.log('Hello toggle', e.detail.value));
  </script>
</body>
<body>

In JS file

import { html, render } from 'https://unpkg.com/lit-html?module';
import 'https://unpkg.com/@ircam/sc-components@latest';

render(html`
  <sc-toggle
    @change=${e => console.log('Hello toggle', e.detail.value)}
  ></sc-toggle>
`, document.body);

Note that this method will import the whole bundled library which is quite large. You may not want to use this is production.

Integration within other frameworks

The library has not been tested within other frameworks such as React or Vue yet.

Any feedback is welcome!

Development notes

Run the doc and tests locally

npm install
npm run doc

Alongside the docs, which already helps in development, the tests directory allows to isolate edge-cases that would not fit into the docs.

npm install
npm run test

Unlock context menu

In development, having the possibility to right-click on an element to inspect it can be quite handy. You can re-enable this behavior by defining the SC_DEBUG global variable and setting it to true:

window.SC_DEBUG = true;

Note that this is done when the docs and tests are launched locally:

window.SC_DEBUG = window.location.hostname === 'localhost';

Contributing

Contributions from everyone are welcome in the form of suggestions, ideas, bug report, pull requests and feedback.

For PRs, please follow the "fork-and-pull" workflow:

  1. Fork the repo on GitHub
  2. Clone your fork on your own machine
  3. Commit your changes to your own branch
  4. Push your work back up to your fork
  5. Submit a pull request

Credits

Vectors and icons by SVG Repo

License

BSD-3-Clause

3.1.1

2 months ago

3.1.0

2 months ago

3.0.1

2 months ago

3.0.0

2 months ago

3.0.0-alpha.83

2 months ago

3.0.0-alpha.81

4 months ago

3.0.0-alpha.82

3 months ago

3.0.0-alpha.70

5 months ago

3.0.0-alpha.69

5 months ago

3.0.0-alpha.68

5 months ago

3.0.0-alpha.61

6 months ago

3.0.0-alpha.63

6 months ago

3.0.0-alpha.62

6 months ago

3.0.0-alpha.65

6 months ago

3.0.0-alpha.64

6 months ago

3.0.0-alpha.67

5 months ago

3.0.0-alpha.66

6 months ago

3.0.0-alpha.80

5 months ago

3.0.0-alpha.72

5 months ago

3.0.0-alpha.71

5 months ago

3.0.0-alpha.74

5 months ago

3.0.0-alpha.73

5 months ago

3.0.0-alpha.76

5 months ago

3.0.0-alpha.75

5 months ago

3.0.0-alpha.78

5 months ago

3.0.0-alpha.77

5 months ago

3.0.0-alpha.60

7 months ago

3.0.0-alpha.59

8 months ago

3.0.0-alpha.58

8 months ago

3.0.0-alpha.57

8 months ago

3.0.0-alpha.56

8 months ago

3.0.0-alpha.54

10 months ago

3.0.0-alpha.55

9 months ago

3.0.0-alpha.53

10 months ago

3.0.0-alpha.52

12 months ago

3.0.0-alpha.50

1 year ago

3.0.0-alpha.49

1 year ago

3.0.0-alpha.48

1 year ago

3.0.0-alpha.47

1 year ago

3.0.0-alpha.46

1 year ago

3.0.0-alpha.7

1 year ago

3.0.0-alpha.6

1 year ago

3.0.0-alpha.9

1 year ago

3.0.0-alpha.8

1 year ago

3.0.0-alpha.36

1 year ago

3.0.0-alpha.14

1 year ago

3.0.0-alpha.35

1 year ago

3.0.0-alpha.13

1 year ago

3.0.0-alpha.38

1 year ago

3.0.0-alpha.16

1 year ago

3.0.0-alpha.37

1 year ago

3.0.0-alpha.15

1 year ago

3.0.0-alpha.18

1 year ago

3.0.0-alpha.3

1 year ago

3.0.0-alpha.39

1 year ago

3.0.0-alpha.17

1 year ago

3.0.0-alpha.2

1 year ago

3.0.0-alpha.5

1 year ago

3.0.0-alpha.19

1 year ago

3.0.0-alpha.4

1 year ago

3.0.0-alpha.30

1 year ago

3.0.0-alpha.32

1 year ago

3.0.0-alpha.10

1 year ago

3.0.0-alpha.31

1 year ago

3.0.0-alpha.34

1 year ago

3.0.0-alpha.12

1 year ago

3.0.0-alpha.33

1 year ago

3.0.0-alpha.11

1 year ago

3.0.0-alpha.25

1 year ago

3.0.0-alpha.24

1 year ago

3.0.0-alpha.27

1 year ago

3.0.0-alpha.26

1 year ago

3.0.0-alpha.29

1 year ago

3.0.0-alpha.28

1 year ago

3.0.0-alpha.41

1 year ago

3.0.0-alpha.40

1 year ago

3.0.0-alpha.43

1 year ago

3.0.0-alpha.21

1 year ago

3.0.0-alpha.42

1 year ago

3.0.0-alpha.20

1 year ago

3.0.0-alpha.45

1 year ago

3.0.0-alpha.23

1 year ago

3.0.0-alpha.44

1 year ago

3.0.0-alpha.22

1 year ago

3.0.0-alpha.1

1 year ago

3.0.0-alpha.0

1 year ago