@stonecrop/beam 0.31.0 → 0.33.0
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/dist/assets/index.css +645 -1
- package/dist/beam.js +674 -591
- package/dist/beam.js.map +1 -1
- package/dist/src/components/ActionFooter.vue.d.ts +18 -0
- package/dist/src/components/ActionFooter.vue.d.ts.map +1 -0
- package/dist/src/components/BeamArrow.vue.d.ts +7 -0
- package/dist/src/components/BeamArrow.vue.d.ts.map +1 -0
- package/dist/src/components/BeamBtn.vue.d.ts +14 -0
- package/dist/src/components/BeamBtn.vue.d.ts.map +1 -0
- package/dist/src/components/BeamDayDivider.vue.d.ts +17 -0
- package/dist/src/components/BeamDayDivider.vue.d.ts.map +1 -0
- package/dist/src/components/BeamFilter.vue.d.ts +13 -0
- package/dist/src/components/BeamFilter.vue.d.ts.map +1 -0
- package/dist/src/components/BeamFilterOption.vue.d.ts +13 -0
- package/dist/src/components/BeamFilterOption.vue.d.ts.map +1 -0
- package/dist/src/components/BeamHeading.vue.d.ts +14 -0
- package/dist/src/components/BeamHeading.vue.d.ts.map +1 -0
- package/dist/src/components/BeamMetadata.vue.d.ts +23 -0
- package/dist/src/components/BeamMetadata.vue.d.ts.map +1 -0
- package/dist/src/components/BeamModal.vue.d.ts +26 -0
- package/dist/src/components/BeamModal.vue.d.ts.map +1 -0
- package/dist/src/components/BeamModalOutlet.vue.d.ts +10 -0
- package/dist/src/components/BeamModalOutlet.vue.d.ts.map +1 -0
- package/dist/src/components/BeamProgress.vue.d.ts +10 -0
- package/dist/src/components/BeamProgress.vue.d.ts.map +1 -0
- package/dist/src/components/Confirm.vue.d.ts +4 -0
- package/dist/src/components/Confirm.vue.d.ts.map +1 -0
- package/dist/src/components/FixedTop.vue.d.ts +14 -0
- package/dist/src/components/FixedTop.vue.d.ts.map +1 -0
- package/dist/src/components/ItemCheck.vue.d.ts +11 -0
- package/dist/src/components/ItemCheck.vue.d.ts.map +1 -0
- package/dist/src/components/ItemCount.vue.d.ts +19 -0
- package/dist/src/components/ItemCount.vue.d.ts.map +1 -0
- package/dist/src/components/ListAnchor.vue.d.ts +17 -0
- package/dist/src/components/ListAnchor.vue.d.ts.map +1 -0
- package/dist/src/components/ListItem.vue.d.ts +12 -0
- package/dist/src/components/ListItem.vue.d.ts.map +1 -0
- package/dist/src/components/ListView.vue.d.ts +14 -0
- package/dist/src/components/ListView.vue.d.ts.map +1 -0
- package/dist/src/components/Navbar.vue.d.ts +20 -0
- package/dist/src/components/Navbar.vue.d.ts.map +1 -0
- package/dist/src/components/ScanInput.vue.d.ts +12 -0
- package/dist/src/components/ScanInput.vue.d.ts.map +1 -0
- package/dist/src/components/SegmentedDisplay.vue.d.ts +11 -0
- package/dist/src/components/SegmentedDisplay.vue.d.ts.map +1 -0
- package/dist/src/components/SplitColumn.vue.d.ts +21 -0
- package/dist/src/components/SplitColumn.vue.d.ts.map +1 -0
- package/dist/src/components/ToggleArrow.vue.d.ts +7 -0
- package/dist/src/components/ToggleArrow.vue.d.ts.map +1 -0
- package/dist/{tsdoc-metadata.json → src/tsdoc-metadata.json} +1 -1
- package/package.json +31 -26
- package/dist/beam.d.ts +0 -167
- package/dist/beam.tsbuildinfo +0 -1
- package/dist/src/composables/mqtt.js +0 -85
- package/dist/src/index.js +0 -56
- package/dist/src/types/index.js +0 -0
- package/src/components/ActionFooter.vue +0 -31
- package/src/components/BeamArrow.vue +0 -37
- package/src/components/BeamBtn.vue +0 -32
- package/src/components/BeamDayDivider.vue +0 -60
- package/src/components/BeamFilter.vue +0 -58
- package/src/components/BeamFilterOption.vue +0 -150
- package/src/components/BeamHeading.vue +0 -17
- package/src/components/BeamMetadata.vue +0 -118
- package/src/components/BeamModal.vue +0 -28
- package/src/components/BeamModalOutlet.vue +0 -18
- package/src/components/BeamProgress.vue +0 -23
- package/src/components/Confirm.vue +0 -29
- package/src/components/FixedTop.vue +0 -13
- package/src/components/ItemCheck.vue +0 -76
- package/src/components/ItemCount.vue +0 -55
- package/src/components/ListAnchor.vue +0 -17
- package/src/components/ListItem.vue +0 -85
- package/src/components/ListView.vue +0 -62
- package/src/components/Navbar.vue +0 -42
- package/src/components/ScanInput.vue +0 -23
- package/src/components/SegmentedDisplay.vue +0 -55
- package/src/components/SplitColumn.vue +0 -49
- package/src/components/ToggleArrow.vue +0 -35
- package/src/composables/mqtt.ts +0 -102
- package/src/index.ts +0 -87
- package/src/onscan.d.ts +0 -45
- package/src/shims-vue.d.ts +0 -7
- package/src/types/index.ts +0 -77
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<li tabindex="0" class="beam_list-item">
|
|
3
|
-
<div class="beam_list-text">
|
|
4
|
-
<label class="beam--bold">{{ listItem.label }}</label>
|
|
5
|
-
<p>{{ listItem.description }}</p>
|
|
6
|
-
</div>
|
|
7
|
-
|
|
8
|
-
<ItemCount
|
|
9
|
-
v-if="listItem.count"
|
|
10
|
-
v-model="listItem.count.count"
|
|
11
|
-
:debounce="listItem.debounce"
|
|
12
|
-
:denominator="listItem.count.of"
|
|
13
|
-
:editable="true"
|
|
14
|
-
:uom="listItem.count.uom" />
|
|
15
|
-
<ItemCheck v-if="listItem.hasOwnProperty('checked')" v-model="listItem.checked" />
|
|
16
|
-
</li>
|
|
17
|
-
</template>
|
|
18
|
-
|
|
19
|
-
<script setup lang="ts">
|
|
20
|
-
import { ref, watch } from 'vue'
|
|
21
|
-
|
|
22
|
-
import ItemCount from './ItemCount.vue'
|
|
23
|
-
import ItemCheck from './ItemCheck.vue'
|
|
24
|
-
import type { ListViewItem } from '../types'
|
|
25
|
-
|
|
26
|
-
const { item } = defineProps<{ item: ListViewItem }>()
|
|
27
|
-
const emit = defineEmits<{ update: [item: ListViewItem] }>()
|
|
28
|
-
|
|
29
|
-
const listItem = ref(item)
|
|
30
|
-
|
|
31
|
-
watch(
|
|
32
|
-
listItem,
|
|
33
|
-
value => {
|
|
34
|
-
emit('update', value)
|
|
35
|
-
},
|
|
36
|
-
{ deep: true }
|
|
37
|
-
)
|
|
38
|
-
</script>
|
|
39
|
-
|
|
40
|
-
<style scoped>
|
|
41
|
-
.beam_list-item {
|
|
42
|
-
padding: 0.625rem;
|
|
43
|
-
border-bottom: 1px solid var(--sc-row-border-color);
|
|
44
|
-
max-width: 100%;
|
|
45
|
-
box-sizing: border-box;
|
|
46
|
-
display: flex;
|
|
47
|
-
flex-flow: row nowrap;
|
|
48
|
-
justify-content: space-between;
|
|
49
|
-
gap: 1.25rem;
|
|
50
|
-
cursor: pointer;
|
|
51
|
-
outline: 2px solid transparent;
|
|
52
|
-
outline-offset: -1px;
|
|
53
|
-
|
|
54
|
-
&:focus {
|
|
55
|
-
outline: 2px solid var(--sc-focus-cell-outline);
|
|
56
|
-
background-color: var(--sc-focus-cell-background);
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
.beam_list-text {
|
|
61
|
-
width: 80%;
|
|
62
|
-
text-overflow: ellipsis;
|
|
63
|
-
white-space: nowrap;
|
|
64
|
-
overflow: hidden;
|
|
65
|
-
flex-grow: 1;
|
|
66
|
-
font-size: 0.875rem;
|
|
67
|
-
color: var(--sc-primary-text-color);
|
|
68
|
-
|
|
69
|
-
& label,
|
|
70
|
-
& p {
|
|
71
|
-
overflow: hidden;
|
|
72
|
-
text-overflow: ellipsis;
|
|
73
|
-
width: 100%;
|
|
74
|
-
display: block;
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
.beam_list-item label {
|
|
79
|
-
display: block;
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
.beam_list-item p {
|
|
83
|
-
margin: 0;
|
|
84
|
-
}
|
|
85
|
-
</style>
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<ul class="beam_list-view">
|
|
3
|
-
<li v-for="item in items" :key="item.barcode || item.label">
|
|
4
|
-
<template v-if="item.linkComponent == 'BeamDayDivider'">
|
|
5
|
-
<BeamDayDivider :item="item"></BeamDayDivider>
|
|
6
|
-
</template>
|
|
7
|
-
|
|
8
|
-
<template v-else-if="item.linkComponent">
|
|
9
|
-
<component :is="item.linkComponent" :to="item.route" tabindex="-1">
|
|
10
|
-
<ListItem :item="item" @update="handleUpdate"></ListItem>
|
|
11
|
-
</component>
|
|
12
|
-
</template>
|
|
13
|
-
|
|
14
|
-
<template v-else>
|
|
15
|
-
<ListItem :item="item" @update="handleUpdate"></ListItem>
|
|
16
|
-
</template>
|
|
17
|
-
</li>
|
|
18
|
-
</ul>
|
|
19
|
-
</template>
|
|
20
|
-
|
|
21
|
-
<script setup lang="ts">
|
|
22
|
-
import { onMounted, onUnmounted } from 'vue'
|
|
23
|
-
|
|
24
|
-
import BeamDayDivider from './BeamDayDivider.vue'
|
|
25
|
-
import ListItem from './ListItem.vue'
|
|
26
|
-
import type { ListViewItem } from '../types'
|
|
27
|
-
|
|
28
|
-
defineProps<{ items: ListViewItem[] }>()
|
|
29
|
-
const emit = defineEmits<{ update: [item: ListViewItem]; scrollbottom: [] }>()
|
|
30
|
-
|
|
31
|
-
onMounted(() => {
|
|
32
|
-
window.addEventListener('scroll', handleScroll)
|
|
33
|
-
})
|
|
34
|
-
|
|
35
|
-
onUnmounted(() => {
|
|
36
|
-
window.removeEventListener('scroll', handleScroll)
|
|
37
|
-
})
|
|
38
|
-
|
|
39
|
-
const handleUpdate = (item: ListViewItem) => emit('update', item)
|
|
40
|
-
const handleScroll = () => {
|
|
41
|
-
const scrollHeightDifference = document.documentElement.scrollHeight - window.innerHeight
|
|
42
|
-
const scrollposition = document.documentElement.scrollTop
|
|
43
|
-
if (scrollHeightDifference - scrollposition <= 2) {
|
|
44
|
-
emit('scrollbottom')
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
</script>
|
|
48
|
-
|
|
49
|
-
<style scoped>
|
|
50
|
-
.beam_list-view {
|
|
51
|
-
font-family: var(--sc-font-family);
|
|
52
|
-
list-style-type: none;
|
|
53
|
-
margin-top: 1px;
|
|
54
|
-
margin-left: var(--sc-list-margin);
|
|
55
|
-
margin-right: var(--sc-list-margin);
|
|
56
|
-
padding: 0;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
ul.beam_list-view:last-of-type {
|
|
60
|
-
padding-bottom: 2.5em;
|
|
61
|
-
}
|
|
62
|
-
</style>
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<nav class="beam_navbar">
|
|
3
|
-
<slot name="title">
|
|
4
|
-
<BeamHeading>TITLE</BeamHeading>
|
|
5
|
-
</slot>
|
|
6
|
-
<BeamBtn @click="handlePrimaryAction">
|
|
7
|
-
<slot name="navbaraction">Action</slot>
|
|
8
|
-
</BeamBtn>
|
|
9
|
-
</nav>
|
|
10
|
-
</template>
|
|
11
|
-
|
|
12
|
-
<script setup lang="ts">
|
|
13
|
-
const emit = defineEmits<{ click: [] }>()
|
|
14
|
-
|
|
15
|
-
const handlePrimaryAction = () => {
|
|
16
|
-
emit('click')
|
|
17
|
-
}
|
|
18
|
-
</script>
|
|
19
|
-
|
|
20
|
-
<style scoped>
|
|
21
|
-
.beam_navbar {
|
|
22
|
-
padding: 0.625rem;
|
|
23
|
-
background-color: var(--sc-primary-color);
|
|
24
|
-
margin-left: 0;
|
|
25
|
-
min-height: 2em;
|
|
26
|
-
max-height: 2em;
|
|
27
|
-
color: var(--sc-primary-text-color);
|
|
28
|
-
display: flex;
|
|
29
|
-
flex-flow: row nowrap;
|
|
30
|
-
align-content: center;
|
|
31
|
-
justify-content: space-between;
|
|
32
|
-
align-items: center;
|
|
33
|
-
position: sticky;
|
|
34
|
-
top: 0;
|
|
35
|
-
font-family: var(--sc-font-family);
|
|
36
|
-
border-bottom: 1px solid var(--sc-row-border-color);
|
|
37
|
-
|
|
38
|
-
& h1 {
|
|
39
|
-
margin-left: 0.625rem;
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
</style>
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div id="scan_input"></div>
|
|
3
|
-
</template>
|
|
4
|
-
|
|
5
|
-
<script setup lang="ts">
|
|
6
|
-
import onScan from 'onscan.js'
|
|
7
|
-
import type { OnScan } from 'onscan.js'
|
|
8
|
-
import { onMounted, onUnmounted } from 'vue'
|
|
9
|
-
|
|
10
|
-
const emit = defineEmits<{ scanInstance: [instance: OnScan] }>()
|
|
11
|
-
const props = defineProps<{
|
|
12
|
-
scanHandler: (barcode: string, qty: number) => void
|
|
13
|
-
}>()
|
|
14
|
-
|
|
15
|
-
onMounted(() => {
|
|
16
|
-
const instance = onScan.attachTo(window, { onScan: props.scanHandler })
|
|
17
|
-
emit('scanInstance', instance)
|
|
18
|
-
})
|
|
19
|
-
|
|
20
|
-
onUnmounted(() => {
|
|
21
|
-
onScan.detachFrom(window)
|
|
22
|
-
})
|
|
23
|
-
</script>
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div class="segmented-display" :style="{ background: getColor(displayColor) }">
|
|
3
|
-
<h1 class="segmented-display-output" :style="{ color: getColor(textColor) }">{{ getOutput }}</h1>
|
|
4
|
-
</div>
|
|
5
|
-
</template>
|
|
6
|
-
|
|
7
|
-
<script setup lang="ts">
|
|
8
|
-
import { computed } from 'vue'
|
|
9
|
-
|
|
10
|
-
import { BeamColor } from '../types'
|
|
11
|
-
|
|
12
|
-
const {
|
|
13
|
-
displayInput = 120.2568,
|
|
14
|
-
decimalPlaces = 2,
|
|
15
|
-
displayColor = 'gray',
|
|
16
|
-
textColor = 'white',
|
|
17
|
-
} = defineProps<{
|
|
18
|
-
displayInput?: number
|
|
19
|
-
decimalPlaces?: number
|
|
20
|
-
displayColor?: BeamColor
|
|
21
|
-
textColor?: BeamColor
|
|
22
|
-
}>()
|
|
23
|
-
|
|
24
|
-
const getOutput = computed(() => {
|
|
25
|
-
if (displayInput === 0) return Number(0).toFixed(decimalPlaces)
|
|
26
|
-
return displayInput.toFixed(decimalPlaces)
|
|
27
|
-
})
|
|
28
|
-
|
|
29
|
-
const getColor = (color: BeamColor) => {
|
|
30
|
-
return color?.substring(0, 2) == '--' ? `var(${color})` : color
|
|
31
|
-
}
|
|
32
|
-
</script>
|
|
33
|
-
|
|
34
|
-
<style scoped>
|
|
35
|
-
.segmented-display {
|
|
36
|
-
width: 100%;
|
|
37
|
-
padding: 1rem;
|
|
38
|
-
box-sizing: border-box;
|
|
39
|
-
display: flex;
|
|
40
|
-
background: var(--sc-segmented-display-background);
|
|
41
|
-
align-items: center;
|
|
42
|
-
justify-content: flex-end;
|
|
43
|
-
}
|
|
44
|
-
.segmented-display-output {
|
|
45
|
-
text-align: right;
|
|
46
|
-
font-family: Segment7, Arimo, sans-serif;
|
|
47
|
-
font-weight: normal;
|
|
48
|
-
font-size: var(--sc-segemented-display-font-size);
|
|
49
|
-
padding: 0;
|
|
50
|
-
margin: 0;
|
|
51
|
-
letter-spacing: 0.3rem;
|
|
52
|
-
margin-bottom: -0.7rem;
|
|
53
|
-
color: var(--sc-segmented-display-color);
|
|
54
|
-
}
|
|
55
|
-
</style>
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div class="two-column" :style="{ justifyContent, alignItems }">
|
|
3
|
-
<div class="column column-left">
|
|
4
|
-
<slot name="left"></slot>
|
|
5
|
-
</div>
|
|
6
|
-
<div class="column column-right">
|
|
7
|
-
<slot name="right"></slot>
|
|
8
|
-
</div>
|
|
9
|
-
</div>
|
|
10
|
-
</template>
|
|
11
|
-
|
|
12
|
-
<script setup lang="ts">
|
|
13
|
-
import type { CSSProperties } from 'vue'
|
|
14
|
-
|
|
15
|
-
const { justifyContent = 'space-between', alignItems = 'flex-start' } = defineProps<{
|
|
16
|
-
justifyContent?: CSSProperties['justifyContent']
|
|
17
|
-
alignItems?: CSSProperties['alignItems']
|
|
18
|
-
}>()
|
|
19
|
-
</script>
|
|
20
|
-
|
|
21
|
-
<style scoped>
|
|
22
|
-
.two-column {
|
|
23
|
-
display: flex;
|
|
24
|
-
flex-direction: row;
|
|
25
|
-
justify-content: space-between;
|
|
26
|
-
align-items: baseline;
|
|
27
|
-
gap: 1rem;
|
|
28
|
-
|
|
29
|
-
@media screen and (max-width: 400px) {
|
|
30
|
-
flex-direction: column;
|
|
31
|
-
gap: 0;
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
.column {
|
|
36
|
-
flex-grow: 1;
|
|
37
|
-
width: 50%;
|
|
38
|
-
@media screen and (max-width: 400px) {
|
|
39
|
-
width: 100%;
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
.column-right {
|
|
44
|
-
text-align: right;
|
|
45
|
-
@media screen and (max-width: 400px) {
|
|
46
|
-
text-align: left;
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
</style>
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div class="arrow-icon" :class="{ open }">
|
|
3
|
-
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 35.36 70.71">
|
|
4
|
-
<polygon points="0 70.71 0 0 35.36 35.36 0 70.71" />
|
|
5
|
-
</svg>
|
|
6
|
-
</div>
|
|
7
|
-
</template>
|
|
8
|
-
|
|
9
|
-
<script setup lang="ts">
|
|
10
|
-
const { open } = defineProps<{ open: boolean }>()
|
|
11
|
-
</script>
|
|
12
|
-
|
|
13
|
-
<style scoped>
|
|
14
|
-
svg {
|
|
15
|
-
width: 100%;
|
|
16
|
-
overflow: visible;
|
|
17
|
-
fill: var(--sc-primary-text-color);
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
.arrow-icon {
|
|
21
|
-
width: 0.4rem;
|
|
22
|
-
transform: rotate(0);
|
|
23
|
-
transform-origin: center;
|
|
24
|
-
position: relative;
|
|
25
|
-
transition: all 0.1s ease-in-out;
|
|
26
|
-
margin: 0.5rem;
|
|
27
|
-
cursor: pointer;
|
|
28
|
-
display: flex;
|
|
29
|
-
align-items: center;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
.open {
|
|
33
|
-
transform: rotate(90deg);
|
|
34
|
-
}
|
|
35
|
-
</style>
|
package/src/composables/mqtt.ts
DELETED
|
@@ -1,102 +0,0 @@
|
|
|
1
|
-
import mqtt, { type MqttClient } from 'mqtt'
|
|
2
|
-
import { onMounted, onUnmounted, ref } from 'vue'
|
|
3
|
-
|
|
4
|
-
import { IMqttStream } from '../types'
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* Use MQTT stream
|
|
8
|
-
* @param options - MQTT stream options
|
|
9
|
-
* @returns MQTT stream messages
|
|
10
|
-
* @beta
|
|
11
|
-
*/
|
|
12
|
-
export const useMqttStream = async (options: IMqttStream) => {
|
|
13
|
-
const messages = ref<Record<string, string[]>>({})
|
|
14
|
-
|
|
15
|
-
if (options.host && options.port) {
|
|
16
|
-
const portActive = await isPortActive(options.host, options.port)
|
|
17
|
-
if (!portActive) {
|
|
18
|
-
return { messages }
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
const client = ref<MqttClient>()
|
|
23
|
-
|
|
24
|
-
onMounted(() => {
|
|
25
|
-
client.value = mqtt.connect(options)
|
|
26
|
-
|
|
27
|
-
if (!options.topics) {
|
|
28
|
-
options.topics = ['#']
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
for (const topic of options.topics) {
|
|
32
|
-
client.value.subscribe(topic, err => {
|
|
33
|
-
if (err) {
|
|
34
|
-
throw err
|
|
35
|
-
}
|
|
36
|
-
})
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
client.value.on('message', (topic, message) => {
|
|
40
|
-
if (!messages.value[topic]) {
|
|
41
|
-
messages.value[topic] = []
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
messages.value[topic].push(message.toString())
|
|
45
|
-
})
|
|
46
|
-
})
|
|
47
|
-
|
|
48
|
-
onUnmounted(() => {
|
|
49
|
-
client.value?.end()
|
|
50
|
-
})
|
|
51
|
-
|
|
52
|
-
return { messages }
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
/**
|
|
56
|
-
* Check if a local port has a service running
|
|
57
|
-
* @param host the host to check
|
|
58
|
-
* @param port the port to check
|
|
59
|
-
* @returns true if the port has a service running, false otherwise
|
|
60
|
-
*
|
|
61
|
-
* @beta
|
|
62
|
-
*/
|
|
63
|
-
export const isPortActive = async (host: string, port: number) => {
|
|
64
|
-
try {
|
|
65
|
-
const controller = new AbortController()
|
|
66
|
-
// Set a timeout of 2 seconds
|
|
67
|
-
const timeoutId = setTimeout(() => controller.abort(), 2000)
|
|
68
|
-
|
|
69
|
-
try {
|
|
70
|
-
await fetch(`${host}:${port}`, {
|
|
71
|
-
mode: 'no-cors', // This allows checking without CORS issues
|
|
72
|
-
signal: controller.signal,
|
|
73
|
-
})
|
|
74
|
-
|
|
75
|
-
clearTimeout(timeoutId)
|
|
76
|
-
// If we get any response, the port is in use
|
|
77
|
-
return true
|
|
78
|
-
} catch (error) {
|
|
79
|
-
clearTimeout(timeoutId)
|
|
80
|
-
if (error instanceof DOMException && error.name === 'AbortError') {
|
|
81
|
-
// Timeout - port is probably not in use
|
|
82
|
-
return false
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
// For connection refused errors, we need to check the error message
|
|
86
|
-
// as different browsers handle this differently
|
|
87
|
-
const errorString = String(error)
|
|
88
|
-
if (
|
|
89
|
-
errorString.includes('NetworkError') ||
|
|
90
|
-
errorString.includes('Failed to fetch') ||
|
|
91
|
-
errorString.includes('net::ERR_CONNECTION_REFUSED')
|
|
92
|
-
) {
|
|
93
|
-
return false
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
// If we get here, there might be something running on the port
|
|
97
|
-
return true
|
|
98
|
-
}
|
|
99
|
-
} catch {
|
|
100
|
-
return false
|
|
101
|
-
}
|
|
102
|
-
}
|
package/src/index.ts
DELETED
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
import { App } from 'vue'
|
|
2
|
-
|
|
3
|
-
import ActionFooter from './components/ActionFooter.vue'
|
|
4
|
-
import BeamArrow from './components/BeamArrow.vue'
|
|
5
|
-
import BeamBtn from './components/BeamBtn.vue'
|
|
6
|
-
import BeamDayDivider from './components/BeamDayDivider.vue'
|
|
7
|
-
import BeamFilter from './components/BeamFilter.vue'
|
|
8
|
-
import BeamFilterOption from './components/BeamFilterOption.vue'
|
|
9
|
-
import BeamHeading from './components/BeamHeading.vue'
|
|
10
|
-
import BeamMetadata from './components/BeamMetadata.vue'
|
|
11
|
-
import BeamModal from './components/BeamModal.vue'
|
|
12
|
-
import BeamModalOutlet from './components/BeamModalOutlet.vue'
|
|
13
|
-
import BeamProgress from './components/BeamProgress.vue'
|
|
14
|
-
import Confirm from './components/Confirm.vue'
|
|
15
|
-
import FixedTop from './components/FixedTop.vue'
|
|
16
|
-
import ItemCheck from './components/ItemCheck.vue'
|
|
17
|
-
import ItemCount from './components/ItemCount.vue'
|
|
18
|
-
import ListAnchor from './components/ListAnchor.vue'
|
|
19
|
-
import ListItem from './components/ListItem.vue'
|
|
20
|
-
import ListView from './components/ListView.vue'
|
|
21
|
-
import Navbar from './components/Navbar.vue'
|
|
22
|
-
import ScanInput from './components/ScanInput.vue'
|
|
23
|
-
import SegmentedDisplay from './components/SegmentedDisplay.vue'
|
|
24
|
-
import SplitColumn from './components/SplitColumn.vue'
|
|
25
|
-
import ToggleArrow from './components/ToggleArrow.vue'
|
|
26
|
-
import { useMqttStream } from './composables/mqtt'
|
|
27
|
-
export type * from './types'
|
|
28
|
-
import '../themes/beam.css'
|
|
29
|
-
|
|
30
|
-
/**
|
|
31
|
-
* Install all Beam components
|
|
32
|
-
* @param app - Vue app instance
|
|
33
|
-
* @public
|
|
34
|
-
*/
|
|
35
|
-
function install(app: App /* options */) {
|
|
36
|
-
app.component('ActionFooter', ActionFooter)
|
|
37
|
-
app.component('BeamArrow', BeamArrow)
|
|
38
|
-
app.component('BeamBtn', BeamBtn)
|
|
39
|
-
app.component('BeamDayDivider', BeamDayDivider)
|
|
40
|
-
app.component('BeamFilter', BeamFilter)
|
|
41
|
-
app.component('BeamFilterOption', BeamFilterOption)
|
|
42
|
-
app.component('BeamHeading', BeamHeading)
|
|
43
|
-
app.component('BeamMetadata', BeamMetadata)
|
|
44
|
-
app.component('BeamModal', BeamModal)
|
|
45
|
-
app.component('BeamModalOutlet', BeamModalOutlet)
|
|
46
|
-
app.component('BeamProgress', BeamProgress)
|
|
47
|
-
app.component('Confirm', Confirm)
|
|
48
|
-
app.component('FixedTop', FixedTop)
|
|
49
|
-
app.component('ItemCheck', ItemCheck)
|
|
50
|
-
app.component('ItemCount', ItemCount)
|
|
51
|
-
app.component('ListAnchor', ListAnchor)
|
|
52
|
-
app.component('ListItem', ListItem)
|
|
53
|
-
app.component('ListView', ListView)
|
|
54
|
-
app.component('Navbar', Navbar)
|
|
55
|
-
app.component('ScanInput', ScanInput)
|
|
56
|
-
app.component('SegmentedDisplay', SegmentedDisplay)
|
|
57
|
-
app.component('SplitColumn', SplitColumn)
|
|
58
|
-
app.component('ToggleArrow', ToggleArrow)
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
export {
|
|
62
|
-
ActionFooter,
|
|
63
|
-
BeamArrow,
|
|
64
|
-
BeamBtn,
|
|
65
|
-
BeamDayDivider,
|
|
66
|
-
BeamFilter,
|
|
67
|
-
BeamFilterOption,
|
|
68
|
-
BeamHeading,
|
|
69
|
-
BeamMetadata,
|
|
70
|
-
BeamModal,
|
|
71
|
-
BeamModalOutlet,
|
|
72
|
-
BeamProgress,
|
|
73
|
-
Confirm,
|
|
74
|
-
FixedTop,
|
|
75
|
-
ItemCheck,
|
|
76
|
-
ItemCount,
|
|
77
|
-
ListAnchor,
|
|
78
|
-
ListItem,
|
|
79
|
-
ListView,
|
|
80
|
-
Navbar,
|
|
81
|
-
ScanInput,
|
|
82
|
-
SegmentedDisplay,
|
|
83
|
-
SplitColumn,
|
|
84
|
-
ToggleArrow,
|
|
85
|
-
install,
|
|
86
|
-
useMqttStream,
|
|
87
|
-
}
|
package/src/onscan.d.ts
DELETED
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
// onscan.js ships no typings and has no @types package, so its import was implicitly `any` —
|
|
2
|
-
// which also made `onScan` unusable as a type. Declared here against the library's actual public
|
|
3
|
-
// surface (v1.5.2); the chainable methods return the singleton itself, which is why `attachTo`
|
|
4
|
-
// hands back something you can call `simulate` on.
|
|
5
|
-
declare module 'onscan.js' {
|
|
6
|
-
export interface OnScanOptions {
|
|
7
|
-
onScan?: (scanned: string, qty: number) => void
|
|
8
|
-
onScanError?: (debug: { message: string }) => void
|
|
9
|
-
onKeyProcess?: (char: string, event: KeyboardEvent) => void
|
|
10
|
-
onKeyDetect?: (keyCode: number, event: KeyboardEvent) => void
|
|
11
|
-
onPaste?: (pasted: string, event: ClipboardEvent) => void
|
|
12
|
-
keyCodeMapper?: (event: KeyboardEvent) => string | null
|
|
13
|
-
onScanButtonLongPress?: () => void
|
|
14
|
-
scanButtonKeyCode?: number | false
|
|
15
|
-
scanButtonLongPressTime?: number
|
|
16
|
-
timeBeforeScanTest?: number
|
|
17
|
-
avgTimeByChar?: number
|
|
18
|
-
minLength?: number
|
|
19
|
-
suffixKeyCodes?: number[]
|
|
20
|
-
prefixKeyCodes?: number[]
|
|
21
|
-
ignoreIfFocusOn?: boolean | string | Element | Element[]
|
|
22
|
-
stopPropagation?: boolean
|
|
23
|
-
preventDefault?: boolean
|
|
24
|
-
captureEvents?: boolean
|
|
25
|
-
reactToKeydown?: boolean
|
|
26
|
-
reactToPaste?: boolean
|
|
27
|
-
singleScanQty?: number
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
export interface OnScan {
|
|
31
|
-
/** Attaches the scanner listeners to `target`. Throws if it is already attached. */
|
|
32
|
-
attachTo(target: EventTarget, options?: OnScanOptions): OnScan
|
|
33
|
-
detachFrom(target: EventTarget): void
|
|
34
|
-
getOptions(target: EventTarget): OnScanOptions
|
|
35
|
-
setOptions(target: EventTarget, options: OnScanOptions): OnScan
|
|
36
|
-
/** Feeds a scan through as if a scanner produced it. */
|
|
37
|
-
simulate(target: EventTarget, code: string | number[]): OnScan
|
|
38
|
-
isScanInProgressFor(target: EventTarget): boolean
|
|
39
|
-
isAttachedTo(target: EventTarget): boolean
|
|
40
|
-
decodeKeyEvent(event: KeyboardEvent): string | null
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
const onScan: OnScan
|
|
44
|
-
export default onScan
|
|
45
|
-
}
|
package/src/shims-vue.d.ts
DELETED
package/src/types/index.ts
DELETED
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
import type { IClientOptions } from 'mqtt'
|
|
2
|
-
import { CSSProperties } from 'vue'
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* Configuration object for ListView component items
|
|
6
|
-
* @public
|
|
7
|
-
*/
|
|
8
|
-
export type ListViewItem = {
|
|
9
|
-
barcode?: string
|
|
10
|
-
checked?: boolean
|
|
11
|
-
count?: {
|
|
12
|
-
count: number
|
|
13
|
-
of: number
|
|
14
|
-
uom?: string
|
|
15
|
-
}
|
|
16
|
-
date?: string
|
|
17
|
-
dateFormat?: string
|
|
18
|
-
debounce?: number
|
|
19
|
-
description?: string
|
|
20
|
-
label?: string
|
|
21
|
-
linkComponent?: string
|
|
22
|
-
route?: string
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
* Union type for color values - supports RGB, RGBA, HEX, HSL, HSLA, or CSS color string
|
|
27
|
-
* @public
|
|
28
|
-
*/
|
|
29
|
-
export type BeamColor = RGB | RGBA | HEX | HSL | HSLA | CSSProperties['color']
|
|
30
|
-
|
|
31
|
-
/**
|
|
32
|
-
* Filter choice with label and value for BeamFilter component
|
|
33
|
-
* @public
|
|
34
|
-
*/
|
|
35
|
-
export type BeamFilterChoice = {
|
|
36
|
-
label: string
|
|
37
|
-
value: string
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
/**
|
|
41
|
-
* RGB color string representation
|
|
42
|
-
* @public
|
|
43
|
-
*/
|
|
44
|
-
export type RGB = `rgb(${number}, ${number}, ${number})`
|
|
45
|
-
|
|
46
|
-
/**
|
|
47
|
-
* RGBA color string representation
|
|
48
|
-
* @public
|
|
49
|
-
*/
|
|
50
|
-
export type RGBA = `rgba(${number}, ${number}, ${number}, ${number})`
|
|
51
|
-
|
|
52
|
-
/**
|
|
53
|
-
* HSL color string representation
|
|
54
|
-
* @public
|
|
55
|
-
*/
|
|
56
|
-
export type HSL = `hsl(${number}, ${number}%, ${number}%)`
|
|
57
|
-
|
|
58
|
-
/**
|
|
59
|
-
* HSLA color string representation
|
|
60
|
-
* @public
|
|
61
|
-
*/
|
|
62
|
-
export type HSLA = `hsl(${number}, ${number}%, ${number}%), ${number}`
|
|
63
|
-
|
|
64
|
-
/**
|
|
65
|
-
* HEX color string representation
|
|
66
|
-
* @public
|
|
67
|
-
*/
|
|
68
|
-
export type HEX = `#${string}`
|
|
69
|
-
|
|
70
|
-
/**
|
|
71
|
-
* MQTT stream options
|
|
72
|
-
* @public
|
|
73
|
-
*/
|
|
74
|
-
export interface IMqttStream extends IClientOptions {
|
|
75
|
-
/** MQTT topics to subscribe to */
|
|
76
|
-
topics?: string[]
|
|
77
|
-
}
|