<a name="Panoramax.components.ui.SemanticsEditor"></a>

## Panoramax.components.ui.SemanticsEditor ⇐ <code>[lit.LitElement](https://lit.dev/docs/api/LitElement/)</code>
**Kind**: static class of <code>Panoramax.components.ui</code>  
**Extends**: <code>[lit.LitElement](https://lit.dev/docs/api/LitElement/)</code>  
**Emits**: [<code>change</code>](#Panoramax.components.ui.SemanticsEditor+event_change)  
**Element**: pnx-semantics-editor  

* [.SemanticsEditor](#Panoramax.components.ui.SemanticsEditor) ⇐ <code>[lit.LitElement](https://lit.dev/docs/api/LitElement/)</code>
    * [new SemanticsEditor()](#new_Panoramax.components.ui.SemanticsEditor_new)
    * [.properties](#Panoramax.components.ui.SemanticsEditor+properties) : <code>Object</code>
    * [.getDiff()](#Panoramax.components.ui.SemanticsEditor+getDiff) ⇒ <code>Array.&lt;object&gt;</code>
    * [.checkValidity()](#Panoramax.components.ui.SemanticsEditor+checkValidity) ⇒ <code>boolean</code>
    * [.reportValidity()](#Panoramax.components.ui.SemanticsEditor+reportValidity)
    * [.reset([baseSemantics])](#Panoramax.components.ui.SemanticsEditor+reset)
    * ["change"](#Panoramax.components.ui.SemanticsEditor+event_change)

<a name="new_Panoramax.components.ui.SemanticsEditor_new"></a>

### new SemanticsEditor()
Semantics Editor offer an easy-to-use input for adding or editing semantics tags.

It manipulates list of `{key: "mypanokey", value: "myvalue"}` entries through `semantics` attribute.

**Example**  
```html
<!-- Basic example -->
<pnx-semantics-editor
   id="editor"
   semantics=${mypic.semantics}
   ._t=${viewer._t}
   onchange=${e => console.log(e.detail.semantics)}
/>

<!-- You can access editor and check its validity through native web browser functions -->
<script>
   const editor = document.getElementById("editor");
   console.log(editor.checkValidity()); // True if input is valid
</script>

<!-- You can change specifically style of textarea -->
<style>
  pnx-semantics-editor::part(text) {
     color: blue;
  }
</style>
```
<a name="Panoramax.components.ui.SemanticsEditor+properties"></a>

### semanticsEditor.properties : <code>Object</code>
Component properties.

**Kind**: instance property of [<code>SemanticsEditor</code>](#Panoramax.components.ui.SemanticsEditor)  
**Properties**

| Name | Type | Default | Description |
| --- | --- | --- | --- |
| [semantics] | <code>object</code> |  | The `semantics` field of a picture or annotation feature. It is updated when field changes, but reflect the whole list of new tags (not delta needed by API). If you want delta, please use getDiff function. |
| [rows] | <code>number</code> | <code>3</code> | The amount of rows shown for textarea |

<a name="Panoramax.components.ui.SemanticsEditor+getDiff"></a>

### semanticsEditor.getDiff() ⇒ <code>Array.&lt;object&gt;</code>
Get current delta between initial tags and user changes.

**Kind**: instance method of [<code>SemanticsEditor</code>](#Panoramax.components.ui.SemanticsEditor)  
**Returns**: <code>Array.&lt;object&gt;</code> - The list of tag changes (in API format)  
<a name="Panoramax.components.ui.SemanticsEditor+checkValidity"></a>

### semanticsEditor.checkValidity() ⇒ <code>boolean</code>
Check if input is having a valid value.

**Kind**: instance method of [<code>SemanticsEditor</code>](#Panoramax.components.ui.SemanticsEditor)  
**Returns**: <code>boolean</code> - True if it's valid  
<a name="Panoramax.components.ui.SemanticsEditor+reportValidity"></a>

### semanticsEditor.reportValidity()
Force display of invalid input

**Kind**: instance method of [<code>SemanticsEditor</code>](#Panoramax.components.ui.SemanticsEditor)  
<a name="Panoramax.components.ui.SemanticsEditor+reset"></a>

### semanticsEditor.reset([baseSemantics])
Forces Editor to goes back to its empty, initial state.

**Kind**: instance method of [<code>SemanticsEditor</code>](#Panoramax.components.ui.SemanticsEditor)  

| Param | Type | Default | Description |
| --- | --- | --- | --- |
| [baseSemantics] | <code>object</code> | <code></code> | Initial existing semantics you want to show in editor. This is useful for getting a diff of only new semantic entries. Leave empty if no tags pre-exist. |

<a name="Panoramax.components.ui.SemanticsEditor+event_change"></a>

### "change"
Event for value change.

Note that this event is launched only on valid input.

**Kind**: event emitted by [<code>SemanticsEditor</code>](#Panoramax.components.ui.SemanticsEditor)  
**Properties**

| Name | Type | Description |
| --- | --- | --- |
| detail.semantics | <code>Array.&lt;object&gt;</code> | The new tags list (in API semantics property format) |
| detail.delta | <code>Array.&lt;object&gt;</code> | The delta between old and current tags (expected by API) |

