0.0.33 • Published 7 months ago

@ka-nabellinc/deck-maker-web-components v0.0.33

Weekly downloads
-
License
MIT
Repository
-
Last release
7 months ago

Deck Maker Web Components npm version

Deck Makerがサードパーティー向けに一般公開するWeb Componentsの管理レポジトリです。

主にLitを利用してWeb Componentsの記述を行なっています。

開発

Storybook

下記のコマンドでStorybookを起動し、 src/*の各コンポーネントの開発を行なってください。

yarn install
yarn run storybook

コンポーネントの基本構成

import { LitElement, html, css } from 'lit'
import { property, state, customElement } from 'lit/decorators.js' // https://lit.dev/docs/releases/upgrade/#update-decorator-imports

@customElement('my-element')
export class MyElement extends LitElement {

  @property() firstName: string = ''
  @property() lastName: string = ''

  @state()
  private get fullName() {
    return this.firstName + ' ' + this.lastName
  }

  static styles = [
    css`
      :host {
        display: block;
      }

      * {
        box-sizing: border-box;
      }

      label {
        font-weight: bold;
      }
    `
  ]

  render() {
    return html`
      <label>${this.fullName}</label>
    `;
  }
}

コンポーネントの利用

コンポーネントを利用する際は通常のNPMライブラリと同様に npm, yarn, pnpmでインストールすることができますが、下記の例のようにブラウザから直接呼び出す方法が便利です。

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <!-- Polyfills only needed for Firefox and Edge. -->
  <script src="https://unpkg.com/@webcomponents/webcomponentsjs@latest/webcomponents-loader.js"></script>
  <script type="module" src="https://unpkg.com/@ka-nabellinc/deck-maker-web-components?module"></script>
  <title>Document</title>
</head>
<body>
  <h1>Deck Maker Web Components Sample</h1>
  <yg-deck-recipe ygDeckId="3eef28a6-0a11-4f34-9669-0feea4db412f"></yg-deck-recipe>
</body>
</html>
0.0.33

7 months ago

0.0.30

1 year ago

0.0.31

1 year ago

0.0.32

1 year ago

0.0.25

2 years ago

0.0.26

2 years ago

0.0.27

2 years ago

0.0.28

2 years ago

0.0.29

2 years ago

0.0.20

2 years ago

0.0.21

2 years ago

0.0.22

2 years ago

0.0.23

2 years ago

0.0.24

2 years ago

0.0.14

2 years ago

0.0.15

2 years ago

0.0.16

2 years ago

0.0.17

2 years ago

0.0.18

2 years ago

0.0.19

2 years ago

0.0.13

2 years ago

0.0.10

2 years ago

0.0.12

2 years ago

0.0.9

2 years ago

0.0.8

2 years ago

0.0.7

2 years ago

0.0.5

2 years ago

0.0.4

2 years ago

0.0.3

2 years ago

0.0.2

2 years ago

0.0.1

2 years ago