@sfgrp/distinguish 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +129 -0
- package/dist/favicon.ico +0 -0
- package/dist/interactive-key.es.js +2881 -0
- package/dist/interactive-key.umd.js +46 -0
- package/dist/style.css +1 -0
- package/package.json +56 -0
package/README.md
ADDED
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
# distinguish
|
|
2
|
+
|
|
3
|
+
An interactive key engine that feeds off of [TaxonWorks](https://taxonworks.org)' [API](https://api.taxonworks.org).
|
|
4
|
+
|
|
5
|
+
## Quick start
|
|
6
|
+
|
|
7
|
+
* Create a github repository.
|
|
8
|
+
* ... create page
|
|
9
|
+
* ... add module
|
|
10
|
+
* ... add configs TOKEN/API
|
|
11
|
+
* ... add action
|
|
12
|
+
* ... visit page
|
|
13
|
+
|
|
14
|
+
## Details
|
|
15
|
+
|
|
16
|
+
Interactive keys are tools used by taxonomists and others to diagnosis or seperate one taxon from another. Distinguish provides an embedable, web-based, interactive key interface. The key uses logic (the "engine") and data managed in an instance of TaxonWorks. Keys can served locally (e.g. by opening a file in your browser) or on websites. They require an internet connection.
|
|
17
|
+
|
|
18
|
+
## Features
|
|
19
|
+
|
|
20
|
+
* ...
|
|
21
|
+
* multi-language support
|
|
22
|
+
* ...
|
|
23
|
+
|
|
24
|
+
## Technical
|
|
25
|
+
|
|
26
|
+
Distinguish is a `<TODO>` module. It is inserted into a webpage via configuration. All functionality is driven from a single, parameterized API call (`/api/v1/...`).
|
|
27
|
+
|
|
28
|
+
## Install
|
|
29
|
+
|
|
30
|
+
### Package manager
|
|
31
|
+
You can install the latest version with the npm CLI command:
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
npm install @sfgrp/distinguish
|
|
35
|
+
```
|
|
36
|
+
As an alternative you can use the Yarn CLI command:
|
|
37
|
+
```bash
|
|
38
|
+
yarn add @sfgrp/distinguish
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
### CDN
|
|
42
|
+
You can copy and paste the following tags into your HTML file.
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
```html
|
|
46
|
+
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@sfgrp/distinguish/dist/style.css">
|
|
47
|
+
<script src="https://cdn.jsdelivr.net/npm/@sfgrp/distinguish/dist/distinguish.umd.min.js"></script>
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
## Usage
|
|
51
|
+
There are three ways to setup Interactive Keys. The easiest way is to let InteractiveKey auto discover your inputs automatically. For that, you simply need to provide a data attribute to your input.
|
|
52
|
+
|
|
53
|
+
### Declarative
|
|
54
|
+
|
|
55
|
+
Add `data-interactive-key="true"` attribute to input elements to initialize it.
|
|
56
|
+
To pass the options you need to add the prefix `data-` and write the option in kebab-case, like the following example:
|
|
57
|
+
|
|
58
|
+
```html
|
|
59
|
+
<input
|
|
60
|
+
data-interactive-key="true"
|
|
61
|
+
data-observation-matrix-id="1"
|
|
62
|
+
data-project-token="xQ9bKrhfQtHYfro9t6YY0A"
|
|
63
|
+
data-base-url="https://sfg.taxonworks.org/api/v1"
|
|
64
|
+
>
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
### Imperative
|
|
68
|
+
You can initialize it by createInteractiveKey function
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
```html
|
|
72
|
+
<div id="interactive-key"></div>
|
|
73
|
+
```
|
|
74
|
+
```javascript
|
|
75
|
+
import createInteractiveKey from '@sfgrp/distinguish'
|
|
76
|
+
import '@sfgrp/distinguish/dist/style.css'
|
|
77
|
+
|
|
78
|
+
const app = new createInteractiveKey('#interactive-key', options)
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
### Vue component (Vue 3.x)
|
|
82
|
+
*Pinia is required in your application to use this component*
|
|
83
|
+
|
|
84
|
+
```javascript
|
|
85
|
+
<template>
|
|
86
|
+
<VueInteractiveKey
|
|
87
|
+
:observationMatrixId="observationId"
|
|
88
|
+
:api-config="config"
|
|
89
|
+
/>
|
|
90
|
+
</template>
|
|
91
|
+
|
|
92
|
+
<script setup>
|
|
93
|
+
import { ref, reactive } from 'vue'
|
|
94
|
+
import { VueInteractiveKey } from '@sfgrp/distinguish'
|
|
95
|
+
import '@sfgrp/distinguish/dist/style.css'
|
|
96
|
+
|
|
97
|
+
const observationMatrixId = ref(1)
|
|
98
|
+
const config = ref({
|
|
99
|
+
baseURL: 'http://localhost:3000/api/v1/',
|
|
100
|
+
projectId: undefined,
|
|
101
|
+
projectToken: '5kshojqRCr83fM3MW7OA9g',
|
|
102
|
+
userToken: undefined
|
|
103
|
+
})
|
|
104
|
+
</script>
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
### Options object
|
|
109
|
+
```javascript
|
|
110
|
+
{
|
|
111
|
+
observationMatrixId: '' // Observation matrix ID
|
|
112
|
+
apiConfig: {
|
|
113
|
+
baseURL: '' // URL API, e.g https://sfg.taxonworks.org/api/v1
|
|
114
|
+
csrfToken: '' // CSRF Token. Don't use it with authentification API params.
|
|
115
|
+
projectId: '', // Project ID. Don't use it with projectToken.
|
|
116
|
+
userToken: '', // User Token. Don't use it with projectToken and csrfToken.
|
|
117
|
+
projectToken: '' // Project token. Don't use it with projectId and userToken.
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
## Building a key (in TaxonWorks)
|
|
123
|
+
|
|
124
|
+
Distinguish is based of interfaces available inside TaxonWorks. Those interfaces have many additional features facilitating curation, annotations, expansion, and editing of the underlying data.
|
|
125
|
+
|
|
126
|
+
## Contributing
|
|
127
|
+
|
|
128
|
+
.. TODO .. simplify, add CONTRIBUTING.md
|
|
129
|
+
|
package/dist/favicon.ico
ADDED
|
Binary file
|