6.0.0 • Published 6 months ago

sham-ui-directives v6.0.0

Weekly downloads
104
License
-
Repository
-
Last release
6 months ago

sham-ui-directives

Build Status npm version MIT Licence

Directives for sham-ui-templates

Install

# npm
npm install sham-ui-directives
# yarn
yarn add sham-ui-directives

API

Table of Contents

disabled

Directive for "disabled" attribute

Examples
<template>
  <input :disabled={{inputDisabled}}/>
</template>

<script>
    import { disabled } from 'sham-ui-directives';

    function extendContext() {
        this.ctx.appendDirectives( { disabled } );
    }

    function Input( options ) {
        options( {
            [ $.inputDisabled ]: true
        } );
    }

    export default Component( extendContext, Template, Input );
</script>

EventListener

Base directive class for event listener

Parameters
  • type
Examples
import { EventListener } from 'sham-ui-directives';

// directive for 'click' event listener
class onclick extends EventListener {
    constructor() {
        super( 'click' );
    }
}

onclick

Extends EventListener

Directive for 'click' listener

Examples
<template>
  <button :onclick={{() => window.alert( 'Clicked' )}}>Click me!</button>
</template>
<script>
    import { onclick } from 'sham-ui-directives';

    function extendContext() {
        this.ctx.appendDirectives( { onclick } );
    }

    export default Component( extendContext, Template );
</script>

onsubmit

Extends EventListener

Directive for 'submit' listener

onload

Extends EventListener

Directive for 'load' listener

onresize

Extends EventListener

Directive for 'resize' listener

onscroll

Extends EventListener

Directive for 'scroll' listener

oninput

Extends EventListener

Directive for 'input' listener

onselect

Extends EventListener

Directive for 'select' listener

ref

Directive for reference to Node

Parameters
  • component
Examples
<template>
  <input :ref={{$.inputField}} value="default value"/>
</template>
<script>
    import { ref } from 'sham-ui-directives';

    function extendContext() {
        this.ctx.appendDirectives( { ref } );
    }

    function Input( options, didMount ) {
        didMount( () => {
            alert( this.inputField.value );
        } )
    }

    export default Component( extendContext, Template, Input );
</script>

UpdateOnEvent

Base directive class for event listener

Parameters
  • component
  • type
Examples
import { UpdateOnEvent } from 'sham-ui-directives';

// directive for update on 'input' event listener
class updateOnEvent extends UpdateOnEvent {
    constructor() {
        super( 'input' );
    }
}

onChangeUpdate

Extends UpdateOnEvent

Update on 'change' event

Parameters
  • component

onInputUpdate

Extends UpdateOnEvent

Update on 'input' event

Parameters
  • component
6.0.0-alpha.7

7 months ago

6.0.0

6 months ago

6.0.0-alpha.6

8 months ago

6.0.0-alpha.4

2 years ago

6.0.0-alpha.5

1 year ago

6.0.0-alpha.3

2 years ago

6.0.0-alpha.1

2 years ago

6.0.0-alpha.2

2 years ago

5.0.0

2 years ago

5.0.0-alpha.13

2 years ago

5.0.0-alpha.12

2 years ago

5.0.0-alpha.11

2 years ago

5.0.0-alpha.10

3 years ago

5.0.0-alpha.9

3 years ago

5.0.0-alpha.8

3 years ago

5.0.0-alpha.7

3 years ago

5.0.0-alpha.6

3 years ago

5.0.0-alpha.5

3 years ago

5.0.0-alpha.4

3 years ago

5.0.0-alpha.3

3 years ago

5.0.0-alpha.2

3 years ago

5.0.0-alpha.1

3 years ago

5.0.0-alpha.0

3 years ago

4.1.2

3 years ago

4.1.1

3 years ago

4.1.0

3 years ago

4.0.3

4 years ago

4.0.2

4 years ago

4.0.1

4 years ago

4.0.0

5 years ago

3.0.1

5 years ago

3.0.0

5 years ago

2.0.4

5 years ago

2.0.3

5 years ago

2.0.2

5 years ago

2.0.1

5 years ago

2.0.0

5 years ago

1.0.0

6 years ago

0.0.1

6 years ago