@kvass/widgets 1.2.7 → 1.2.9
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/package.json +4 -1
- package/.github/workflows/semantic-release.yml +0 -21
- package/.prettierrc +0 -6
- package/.releaserc +0 -3
- package/index.html +0 -38
- package/src/contact/README.md +0 -80
- package/src/contact/api.js +0 -82
- package/src/contact/components/Checkbox.ce.vue +0 -127
- package/src/contact/components/Field.ce.vue +0 -156
- package/src/contact/components/Fieldset.ce.vue +0 -63
- package/src/contact/components/Form.ce.vue +0 -407
- package/src/contact/main.js +0 -9
- package/src/contact/utils.js +0 -14
- package/src/flatfinder/README.md +0 -58
- package/src/flatfinder/components/Flatfinder.ce.vue +0 -34
- package/src/flatfinder/main.js +0 -4
- package/src/font-selector/README.md +0 -60
- package/src/font-selector/components/FontSelector.ce.vue +0 -246
- package/src/font-selector/main.js +0 -4
- package/src/font-selector/providers.js +0 -48
- package/src/font-selector/selector.svg +0 -7
- package/src/img-comparison-slider/README.md +0 -69
- package/src/img-comparison-slider/components/ImgComparisonSlider.ce.vue +0 -139
- package/src/img-comparison-slider/main.js +0 -7
- package/src/map/README.md +0 -59
- package/src/map/components/Map.ce.vue +0 -66
- package/src/map/main.js +0 -4
- package/src/project-portal/App.ce.vue +0 -308
- package/src/project-portal/api.js +0 -48
- package/src/project-portal/assets/logo.png +0 -0
- package/src/project-portal/assets/map-pin-solid.svg +0 -1
- package/src/project-portal/components/Card.ce.vue +0 -110
- package/src/project-portal/components/Category.ce.vue +0 -87
- package/src/project-portal/components/CategorySelector.ce.vue +0 -43
- package/src/project-portal/components/ProjectTypeSelector.ce.vue +0 -70
- package/src/project-portal/main.js +0 -16
- package/src/project-portal/styles/_variables.scss +0 -19
- package/src/project-portal/styles/components/_card.scss +0 -178
- package/src/utils/index.js +0 -40
- package/src/vimeo/README.md +0 -58
- package/src/vimeo/components/Vimeo.ce.vue +0 -311
- package/src/vimeo/main.js +0 -4
- package/src/youtube/README.md +0 -58
- package/src/youtube/components/Youtube.ce.vue +0 -322
- package/src/youtube/main.js +0 -4
- package/vite.config.js +0 -51
|
@@ -1,246 +0,0 @@
|
|
|
1
|
-
<script setup>
|
|
2
|
-
import { computed, onMounted, ref, watch } from 'vue'
|
|
3
|
-
import { useCurrentElement } from '@vueuse/core'
|
|
4
|
-
import { providers } from '../providers.js'
|
|
5
|
-
import WebFontLoader from 'webfontloader'
|
|
6
|
-
|
|
7
|
-
const props = defineProps({
|
|
8
|
-
provider: {
|
|
9
|
-
type: String,
|
|
10
|
-
default: 'google',
|
|
11
|
-
},
|
|
12
|
-
type: {
|
|
13
|
-
type: String,
|
|
14
|
-
default: 'text',
|
|
15
|
-
validator: (value) => ['text', 'heading'].includes(value),
|
|
16
|
-
},
|
|
17
|
-
defaultFont: String,
|
|
18
|
-
})
|
|
19
|
-
|
|
20
|
-
const selectedProvider = computed(() =>
|
|
21
|
-
providers.find((p) => p.value === props.provider),
|
|
22
|
-
)
|
|
23
|
-
|
|
24
|
-
const selectedFont = ref(
|
|
25
|
-
selectedProvider.value?.fonts.find((f) => f.value === props.defaultFont) ||
|
|
26
|
-
selectedProvider.value?.fonts[0],
|
|
27
|
-
)
|
|
28
|
-
|
|
29
|
-
const element = useCurrentElement()
|
|
30
|
-
|
|
31
|
-
watch(selectedFont, (newFont) => {
|
|
32
|
-
if (!newFont) return
|
|
33
|
-
|
|
34
|
-
// emit custom event
|
|
35
|
-
element.value.dispatchEvent(
|
|
36
|
-
new CustomEvent('webcomponent:update', {
|
|
37
|
-
detail: {
|
|
38
|
-
font: newFont,
|
|
39
|
-
provider: selectedProvider.value,
|
|
40
|
-
},
|
|
41
|
-
bubbles: true,
|
|
42
|
-
composed: true,
|
|
43
|
-
}),
|
|
44
|
-
)
|
|
45
|
-
})
|
|
46
|
-
|
|
47
|
-
const styles = computed(
|
|
48
|
-
() =>
|
|
49
|
-
selectedFont.value &&
|
|
50
|
-
`--kvass-font-selector-font-family: '${selectedFont.value.value}'`,
|
|
51
|
-
)
|
|
52
|
-
|
|
53
|
-
onMounted(() => {
|
|
54
|
-
if (!selectedProvider.value) throw new Error('Invalid provider')
|
|
55
|
-
|
|
56
|
-
// Initialize WebFontLoader
|
|
57
|
-
const config = Object.fromEntries(
|
|
58
|
-
Object.entries(providers).map(([_, provider]) => [
|
|
59
|
-
provider.value,
|
|
60
|
-
{ families: provider.fonts.map((font) => `${font.value}:400,700`) },
|
|
61
|
-
]),
|
|
62
|
-
)
|
|
63
|
-
|
|
64
|
-
WebFontLoader.load(config)
|
|
65
|
-
})
|
|
66
|
-
</script>
|
|
67
|
-
|
|
68
|
-
<template>
|
|
69
|
-
<div class="kvass-font-selector" :style="styles">
|
|
70
|
-
<select v-model="selectedFont" class="kvass-font-selector__input">
|
|
71
|
-
<optgroup
|
|
72
|
-
v-for="provider in providers"
|
|
73
|
-
:key="provider.value"
|
|
74
|
-
:label="provider.label"
|
|
75
|
-
>
|
|
76
|
-
<option v-for="font in provider.fonts" :key="font.value" :value="font">
|
|
77
|
-
{{ font.label }}
|
|
78
|
-
</option>
|
|
79
|
-
</optgroup>
|
|
80
|
-
</select>
|
|
81
|
-
<div
|
|
82
|
-
:class="[
|
|
83
|
-
`kvass-font-selector__preview kvass-font-selector__preview--${props.type}`,
|
|
84
|
-
]"
|
|
85
|
-
>
|
|
86
|
-
<small class="kvass-font-selector__preview-label">Forhåndsvisning</small>
|
|
87
|
-
<template v-if="props.type === 'heading'">
|
|
88
|
-
<h1>Hovedtittel</h1>
|
|
89
|
-
<h2>Sekundærtittel</h2>
|
|
90
|
-
<h3>Tertiærtittel</h3>
|
|
91
|
-
</template>
|
|
92
|
-
<template v-if="props.type === 'text'">
|
|
93
|
-
<p>
|
|
94
|
-
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus
|
|
95
|
-
imperdiet, nulla et dictum interdum.
|
|
96
|
-
</p>
|
|
97
|
-
</template>
|
|
98
|
-
</div>
|
|
99
|
-
</div>
|
|
100
|
-
</template>
|
|
101
|
-
|
|
102
|
-
<style lang="scss">
|
|
103
|
-
@import url('@kvass/ui/style.css');
|
|
104
|
-
|
|
105
|
-
.kvass-font-selector {
|
|
106
|
-
// Default variables
|
|
107
|
-
--__kvass-font-selector-background-color: white;
|
|
108
|
-
--__kvass-font-selector-padding-y: 1rem;
|
|
109
|
-
--__kvass-font-selector-padding-x: 1rem;
|
|
110
|
-
--__kvass-font-selector-border-width: 1px;
|
|
111
|
-
--__kvass-font-selector-border-style: solid;
|
|
112
|
-
--__kvass-font-selector-border-color: #eaeaea;
|
|
113
|
-
--__kvass-font-selector-border-radius: 6px;
|
|
114
|
-
--__kvass-font-selector-max-width: 500px;
|
|
115
|
-
|
|
116
|
-
border-radius: var(
|
|
117
|
-
--kvass-font-selector-border-radius,
|
|
118
|
-
var(--__kvass-font-selector-border-radius)
|
|
119
|
-
);
|
|
120
|
-
background-color: var(
|
|
121
|
-
--kvass-font-selector-background-color,
|
|
122
|
-
var(--__kvass-font-selector-background-color)
|
|
123
|
-
);
|
|
124
|
-
max-width: var(
|
|
125
|
-
--kvass-font-selector-max-width,
|
|
126
|
-
var(--__kvass-font-selector-max-width)
|
|
127
|
-
);
|
|
128
|
-
position: relative;
|
|
129
|
-
|
|
130
|
-
&::after {
|
|
131
|
-
content: url('../selector.svg');
|
|
132
|
-
position: absolute;
|
|
133
|
-
right: var(
|
|
134
|
-
--kvass-font-selector-padding-x,
|
|
135
|
-
var(--__kvass-font-selector-padding-x)
|
|
136
|
-
);
|
|
137
|
-
top: var(
|
|
138
|
-
--kvass-font-selector-padding-y,
|
|
139
|
-
var(--__kvass-font-selector-padding-y)
|
|
140
|
-
);
|
|
141
|
-
pointer-events: none;
|
|
142
|
-
opacity: 0.5;
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
&__input {
|
|
146
|
-
appearance: none;
|
|
147
|
-
font: inherit;
|
|
148
|
-
width: 100%;
|
|
149
|
-
padding: var(
|
|
150
|
-
--kvass-font-selector-padding-y,
|
|
151
|
-
var(--__kvass-font-selector-padding-y)
|
|
152
|
-
)
|
|
153
|
-
var(
|
|
154
|
-
--kvass-font-selector-padding-x,
|
|
155
|
-
var(--__kvass-font-selector-padding-x)
|
|
156
|
-
);
|
|
157
|
-
border: var(
|
|
158
|
-
--kvass-font-selector-border-width,
|
|
159
|
-
var(--__kvass-font-selector-border-width)
|
|
160
|
-
)
|
|
161
|
-
var(
|
|
162
|
-
--kvass-font-selector-border-style,
|
|
163
|
-
var(--__kvass-font-selector-border-style)
|
|
164
|
-
)
|
|
165
|
-
var(
|
|
166
|
-
--kvass-font-selector-border-color,
|
|
167
|
-
var(--__kvass-font-selector-border-color)
|
|
168
|
-
);
|
|
169
|
-
border-top-left-radius: var(
|
|
170
|
-
--kvass-font-selector-border-radius,
|
|
171
|
-
var(--__kvass-font-selector-border-radius)
|
|
172
|
-
);
|
|
173
|
-
border-top-right-radius: var(
|
|
174
|
-
--kvass-font-selector-border-radius,
|
|
175
|
-
var(--__kvass-font-selector-border-radius)
|
|
176
|
-
);
|
|
177
|
-
border-bottom: none;
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
&__preview {
|
|
181
|
-
display: flex;
|
|
182
|
-
flex-direction: column;
|
|
183
|
-
gap: 1rem;
|
|
184
|
-
padding: var(
|
|
185
|
-
--kvass-font-selector-padding-y,
|
|
186
|
-
var(--__kvass-font-selector-padding-y)
|
|
187
|
-
)
|
|
188
|
-
var(
|
|
189
|
-
--kvass-font-selector-padding-x,
|
|
190
|
-
var(--__kvass-font-selector-padding-x)
|
|
191
|
-
);
|
|
192
|
-
border: var(
|
|
193
|
-
--kvass-font-selector-border-width,
|
|
194
|
-
var(--__kvass-font-selector-border-width)
|
|
195
|
-
)
|
|
196
|
-
var(
|
|
197
|
-
--kvass-font-selector-border-style,
|
|
198
|
-
var(--__kvass-font-selector-border-style)
|
|
199
|
-
)
|
|
200
|
-
var(
|
|
201
|
-
--kvass-font-selector-border-color,
|
|
202
|
-
var(--__kvass-font-selector-border-color)
|
|
203
|
-
);
|
|
204
|
-
border-bottom-right-radius: var(
|
|
205
|
-
--kvass-font-selector-border-radius,
|
|
206
|
-
var(--__kvass-font-selector-border-radius)
|
|
207
|
-
);
|
|
208
|
-
border-bottom-left-radius: var(
|
|
209
|
-
--kvass-font-selector-border-radius,
|
|
210
|
-
var(--__kvass-font-selector-border-radius)
|
|
211
|
-
);
|
|
212
|
-
|
|
213
|
-
p,
|
|
214
|
-
h1,
|
|
215
|
-
h2,
|
|
216
|
-
h3 {
|
|
217
|
-
margin: 0;
|
|
218
|
-
font-family: var(--kvass-font-selector-font-family);
|
|
219
|
-
text-wrap: balance;
|
|
220
|
-
}
|
|
221
|
-
|
|
222
|
-
p {
|
|
223
|
-
line-height: 1.5;
|
|
224
|
-
}
|
|
225
|
-
|
|
226
|
-
h1,
|
|
227
|
-
h2,
|
|
228
|
-
h3 {
|
|
229
|
-
line-height: 1;
|
|
230
|
-
}
|
|
231
|
-
|
|
232
|
-
&--heading {
|
|
233
|
-
font-weight: 700;
|
|
234
|
-
}
|
|
235
|
-
|
|
236
|
-
&--text {
|
|
237
|
-
font-weight: 400;
|
|
238
|
-
}
|
|
239
|
-
|
|
240
|
-
&-label {
|
|
241
|
-
opacity: 0.5;
|
|
242
|
-
letter-spacing: 0.25px;
|
|
243
|
-
}
|
|
244
|
-
}
|
|
245
|
-
}
|
|
246
|
-
</style>
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
export const providers = [
|
|
2
|
-
{
|
|
3
|
-
value: 'google',
|
|
4
|
-
label: 'Google Fonts',
|
|
5
|
-
fonts: [
|
|
6
|
-
{
|
|
7
|
-
value: 'Roboto',
|
|
8
|
-
label: 'Roboto',
|
|
9
|
-
},
|
|
10
|
-
{
|
|
11
|
-
value: 'Open Sans',
|
|
12
|
-
label: 'Open Sans',
|
|
13
|
-
},
|
|
14
|
-
{
|
|
15
|
-
value: 'Lato',
|
|
16
|
-
label: 'Lato',
|
|
17
|
-
},
|
|
18
|
-
{
|
|
19
|
-
value: 'Montserrat',
|
|
20
|
-
label: 'Montserrat',
|
|
21
|
-
},
|
|
22
|
-
{
|
|
23
|
-
value: 'Roboto Condensed',
|
|
24
|
-
label: 'Roboto Condensed',
|
|
25
|
-
},
|
|
26
|
-
{
|
|
27
|
-
value: 'Oswald',
|
|
28
|
-
label: 'Oswald',
|
|
29
|
-
},
|
|
30
|
-
{
|
|
31
|
-
value: 'Poppins',
|
|
32
|
-
label: 'Poppins',
|
|
33
|
-
},
|
|
34
|
-
{
|
|
35
|
-
value: 'Raleway',
|
|
36
|
-
label: 'Raleway',
|
|
37
|
-
},
|
|
38
|
-
{
|
|
39
|
-
value: 'Slabo 27px',
|
|
40
|
-
label: 'Slabo 27px',
|
|
41
|
-
},
|
|
42
|
-
{
|
|
43
|
-
value: 'Merriweather',
|
|
44
|
-
label: 'Merriweather',
|
|
45
|
-
},
|
|
46
|
-
],
|
|
47
|
-
}
|
|
48
|
-
]
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
<svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-selector" width="18"
|
|
2
|
-
height="24" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" fill="none"
|
|
3
|
-
stroke-linecap="round" stroke-linejoin="round">
|
|
4
|
-
<path stroke="none" d="M0 0h24v24H0z" fill="none" />
|
|
5
|
-
<path d="M8 9l4 -4l4 4" />
|
|
6
|
-
<path d="M16 15l-4 4l-4 -4" />
|
|
7
|
-
</svg>
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
# kvass-img-comparison-slider
|
|
2
|
-
|
|
3
|
-
A simple, embeddable Web Component to compare images.
|
|
4
|
-
|
|
5
|
-
`https://unpkg.com/@kvass/widgets@latest/dist/img-comparison-slider.js`
|
|
6
|
-
|
|
7
|
-
## Develop
|
|
8
|
-
|
|
9
|
-
To run in development mode, first install the neccessary packages.
|
|
10
|
-
|
|
11
|
-
```
|
|
12
|
-
npm install
|
|
13
|
-
```
|
|
14
|
-
|
|
15
|
-
Then, run in development mode.
|
|
16
|
-
|
|
17
|
-
```
|
|
18
|
-
npm run dev
|
|
19
|
-
```
|
|
20
|
-
|
|
21
|
-
Open `localhost:3000` in the browser of your choice, and you will see the form widget.
|
|
22
|
-
|
|
23
|
-
## Build
|
|
24
|
-
|
|
25
|
-
To build the widget for production, run `build` instead of `dev`.
|
|
26
|
-
|
|
27
|
-
```
|
|
28
|
-
npm run build
|
|
29
|
-
```
|
|
30
|
-
|
|
31
|
-
To use the widget, use the `<kvass-img-comparison-slider />` element as shown here.
|
|
32
|
-
|
|
33
|
-
```html
|
|
34
|
-
<kvass-img-comparison-slider
|
|
35
|
-
first-image="https://example.com/first-image,First image"
|
|
36
|
-
second-image="https://example.com/second-image,Second image"
|
|
37
|
-
options="direction:vertical,keyboard:disabled"
|
|
38
|
-
></kvass-img-comparison-slider>
|
|
39
|
-
```
|
|
40
|
-
|
|
41
|
-
## Props
|
|
42
|
-
|
|
43
|
-
The component has several props for easy configuration.
|
|
44
|
-
|
|
45
|
-
| Name | Type | Description | Enums |
|
|
46
|
-
| :---------- | :------ | :-------------------------------------------------------- | :---------------------- |
|
|
47
|
-
| **options** | String | key:value pairs separated by comma | The following options: |
|
|
48
|
-
| value | Number | Position of the divider in percents. | `0...100` |
|
|
49
|
-
| hover | Boolean | Automatically slide on mouse over. | `false`, `true` |
|
|
50
|
-
| direction | String | Set slider direction. | `horiontal`, `vertical` |
|
|
51
|
-
| nonce | | Define nonce which gets passed to inline style. | |
|
|
52
|
-
| keyboard | String | Enable/disable slider position control with the keyboard. | `enabled`, `disabled` |
|
|
53
|
-
| handle | Boolean | Enable/disable dragging by handle only. | `false`, `true` |
|
|
54
|
-
| | | | |
|
|
55
|
-
| first-image | String | Image url and text, separated by a comma | |
|
|
56
|
-
| second-mage | String | Image url and text, separated by a comma | |
|
|
57
|
-
| handle-svg | String | The svg on the slider handle | |
|
|
58
|
-
|
|
59
|
-
## Styling
|
|
60
|
-
|
|
61
|
-
The widget's styles are based on CSS custom properties, and can be overwritten.
|
|
62
|
-
These are the available CSS variables.
|
|
63
|
-
|
|
64
|
-
| Name | Description | Default |
|
|
65
|
-
| :------------------------ | :--------------------------------------------------------------------------------------- | :------ |
|
|
66
|
-
| `--divider-width` | Width of the vertical line separating both images | `1px` |
|
|
67
|
-
| `--divider-color` | Color of the vertical line separating the two images | `#fff` |
|
|
68
|
-
| `--divider-shadow` | Shadow cast by the vertical line separating the two images | `none` |
|
|
69
|
-
| `--handle-position-start` | Handle position on the divider axis. In case the handle must be displaced off the center | `50%` |
|
|
@@ -1,139 +0,0 @@
|
|
|
1
|
-
<script setup>
|
|
2
|
-
import { ImgComparisonSlider } from '@img-comparison-slider/vue';
|
|
3
|
-
import { computed } from 'vue';
|
|
4
|
-
|
|
5
|
-
const defaultOptions = {
|
|
6
|
-
value: 50,
|
|
7
|
-
hover: false,
|
|
8
|
-
direction: 'horizontal',
|
|
9
|
-
keyboard: 'enabled',
|
|
10
|
-
handle: false,
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
function createImageObject(imageString) {
|
|
14
|
-
if (!imageString) return {}
|
|
15
|
-
|
|
16
|
-
const split = imageString.split(',')
|
|
17
|
-
return {
|
|
18
|
-
url: split[0],
|
|
19
|
-
description: split[1]
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
const props = defineProps({
|
|
24
|
-
firstImage: {
|
|
25
|
-
type: String,
|
|
26
|
-
default: 'https://assets.kvass.no/641c0b087c49867b0b1065ec,Første bilde'
|
|
27
|
-
},
|
|
28
|
-
secondImage: {
|
|
29
|
-
type: String,
|
|
30
|
-
default: 'https://assets.kvass.no/641c0a8c7c49867b0b106570,Andre bilde'
|
|
31
|
-
},
|
|
32
|
-
|
|
33
|
-
options: {
|
|
34
|
-
type: String,
|
|
35
|
-
default: '',
|
|
36
|
-
},
|
|
37
|
-
|
|
38
|
-
handleSvg: {
|
|
39
|
-
type: String,
|
|
40
|
-
default:
|
|
41
|
-
'<svg xmlns="http://www.w3.org/2000/svg" viewBox="-8 -3 16 6"><path stroke="#fff" d="M -3 -2 L -5 0 L -3 2 M -3 -2 L -3 2 M 3 -2 L 5 0 L 3 2 M 3 -2 L 3 2" stroke-width="1" fill="#fff" vector-effect="non-scaling-stroke"></path></svg>',
|
|
42
|
-
},
|
|
43
|
-
})
|
|
44
|
-
|
|
45
|
-
// images
|
|
46
|
-
const firstImage = createImageObject(props.firstImage)
|
|
47
|
-
const firstImageCaption = computed(() => firstImage.description)
|
|
48
|
-
|
|
49
|
-
const secondImage = createImageObject(props.secondImage)
|
|
50
|
-
const secondImageCaption = computed(() => secondImage.description)
|
|
51
|
-
|
|
52
|
-
// options
|
|
53
|
-
const options = computed(() => {
|
|
54
|
-
const entries = props.options.split(',').map(entry => entry.split(':'))
|
|
55
|
-
return Object.fromEntries(entries)
|
|
56
|
-
})
|
|
57
|
-
</script>
|
|
58
|
-
|
|
59
|
-
<template>
|
|
60
|
-
<ImgComparisonSlider
|
|
61
|
-
:style="`--first-image-caption: ${firstImageCaption}; --second-image-caption: ${secondImageCaption}`" tabindex="0"
|
|
62
|
-
class="img-comparison-slider" v-bind="{
|
|
63
|
-
...defaultOptions,
|
|
64
|
-
...options,
|
|
65
|
-
}">
|
|
66
|
-
<img slot="first" class="img-comparison-slider__image" :src="firstImage.url" />
|
|
67
|
-
<img slot="second" class="img-comparison-slider__image" :src="secondImage.url" />
|
|
68
|
-
|
|
69
|
-
<div slot="handle" class="handle">
|
|
70
|
-
<p class="handle__caption handle__caption--left">
|
|
71
|
-
{{ firstImage.description }}
|
|
72
|
-
</p>
|
|
73
|
-
<div class="handle__svg" v-html="handleSvg"></div>
|
|
74
|
-
<p class="handle__caption handle__caption--right">
|
|
75
|
-
{{ secondImage.description }}
|
|
76
|
-
</p>
|
|
77
|
-
</div>
|
|
78
|
-
</ImgComparisonSlider>
|
|
79
|
-
</template>
|
|
80
|
-
|
|
81
|
-
<style lang="scss">
|
|
82
|
-
.img-comparison-slider {
|
|
83
|
-
width: 100%;
|
|
84
|
-
height: 100%;
|
|
85
|
-
|
|
86
|
-
--divider-width: 4px;
|
|
87
|
-
--divider-color: black;
|
|
88
|
-
|
|
89
|
-
// aspect-ratio: var(--kvass-img-comparison-slider-aspect-ratio, $aspect-ratio);
|
|
90
|
-
// aspect-ratio: var(
|
|
91
|
-
// --kvass-img-comparison-slider-aspect-ratio,
|
|
92
|
-
// $aspect-ratio
|
|
93
|
-
// );
|
|
94
|
-
|
|
95
|
-
&__image {
|
|
96
|
-
width: 100%;
|
|
97
|
-
height: 100%;
|
|
98
|
-
object-fit: cover;
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
.handle {
|
|
102
|
-
display: flex;
|
|
103
|
-
flex-direction: row;
|
|
104
|
-
|
|
105
|
-
justify-content: center;
|
|
106
|
-
align-items: center;
|
|
107
|
-
flex-wrap: nowrap;
|
|
108
|
-
gap: 1rem;
|
|
109
|
-
min-width: 800px;
|
|
110
|
-
|
|
111
|
-
font-size: 1rem;
|
|
112
|
-
|
|
113
|
-
@media (max-width: 600px) {
|
|
114
|
-
font-size: 0.75rem;
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
&__caption {
|
|
118
|
-
color: white;
|
|
119
|
-
word-wrap: wrap;
|
|
120
|
-
width: 100%;
|
|
121
|
-
|
|
122
|
-
&--left {
|
|
123
|
-
text-align: right;
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
&__svg {
|
|
128
|
-
padding: 0.3em;
|
|
129
|
-
background-color: black;
|
|
130
|
-
border-radius: 100%;
|
|
131
|
-
|
|
132
|
-
svg {
|
|
133
|
-
width: 2.5em;
|
|
134
|
-
height: 2.5em;
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
</style>
|
package/src/map/README.md
DELETED
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
# kvass-map
|
|
2
|
-
|
|
3
|
-
A simple, embeddable Web Component for maps.
|
|
4
|
-
|
|
5
|
-
`https://unpkg.com/@kvass/widgets@latest/dist/map.js`
|
|
6
|
-
|
|
7
|
-
## Develop
|
|
8
|
-
|
|
9
|
-
To run in development mode, first install the neccessary packages.
|
|
10
|
-
|
|
11
|
-
```
|
|
12
|
-
npm install
|
|
13
|
-
```
|
|
14
|
-
|
|
15
|
-
Then, run in development mode.
|
|
16
|
-
|
|
17
|
-
```
|
|
18
|
-
npm run dev
|
|
19
|
-
```
|
|
20
|
-
|
|
21
|
-
Open `localhost:3000` in the browser of your choice, and you will see the form widget.
|
|
22
|
-
|
|
23
|
-
## Build
|
|
24
|
-
|
|
25
|
-
To build the widget for production, run `build` instead of `dev`.
|
|
26
|
-
|
|
27
|
-
```
|
|
28
|
-
npm run build
|
|
29
|
-
```
|
|
30
|
-
|
|
31
|
-
To use the widget, use the `<kvass-map />` element as shown here.
|
|
32
|
-
|
|
33
|
-
```html
|
|
34
|
-
<kvass-map coordinates="10.745,59.9123" />
|
|
35
|
-
```
|
|
36
|
-
|
|
37
|
-
## Props
|
|
38
|
-
|
|
39
|
-
The component has several props for easy configuration.
|
|
40
|
-
|
|
41
|
-
| Name | Type | Description | Default |
|
|
42
|
-
| :--------------------- | :------ | :-------------------------------------------------------------------------------------- | :------ |
|
|
43
|
-
| coordinates `required` | String | The coordinates for the main marker. | |
|
|
44
|
-
| markers | String | A list of markers formatted in `lon,lat`. Each marker is separated with `;` | |
|
|
45
|
-
| address | String | The address as a formatted string. This will be visible if `show-address` prop is true. | |
|
|
46
|
-
| show-address | Boolean | Show a panel with the formatted address string. | |
|
|
47
|
-
|
|
48
|
-
## Styling
|
|
49
|
-
|
|
50
|
-
The widget's styles are based on CSS custom properties, and can be overwritten.
|
|
51
|
-
These are the available CSS variables.
|
|
52
|
-
|
|
53
|
-
| Name | Description | Default |
|
|
54
|
-
| :----------------------------- | :---------------------------------------- | :------------------------ |
|
|
55
|
-
| --kvass-map-background | The map's background color | `rgb(0 0 0 / 0.2)` |
|
|
56
|
-
| --kvass-map-address-padding-x | The inline padding of the address panel | `0.5rem` |
|
|
57
|
-
| --kvass-map-address-padding-y | The block padding of the address panel | `1rem` |
|
|
58
|
-
| --kvass-map-address-background | The background color of the address panel | `rgb(0 0 0 / 0.2)` |
|
|
59
|
-
| --kvass-map-address-color | The text color of the address panel | `rgb(255 255 255 / 0.75)` |
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
<script setup>
|
|
2
|
-
import { Map as MapComponent } from '@kvass/map'
|
|
3
|
-
import { LazyLoad } from '@kvass/ui'
|
|
4
|
-
import { computed, reactive } from 'vue'
|
|
5
|
-
|
|
6
|
-
const props = defineProps({
|
|
7
|
-
theme: {
|
|
8
|
-
type: String,
|
|
9
|
-
required: true,
|
|
10
|
-
},
|
|
11
|
-
mapboxApiToken: {
|
|
12
|
-
type: String,
|
|
13
|
-
required: true,
|
|
14
|
-
},
|
|
15
|
-
/**
|
|
16
|
-
* The coordinates in the format of 'latitude,longitude'
|
|
17
|
-
*/
|
|
18
|
-
coordinates: {
|
|
19
|
-
type: String,
|
|
20
|
-
required: true,
|
|
21
|
-
},
|
|
22
|
-
|
|
23
|
-
/**
|
|
24
|
-
* Coordinates for additional map markers in the format of 'latitude,longitude;latitude,longitude'
|
|
25
|
-
*/
|
|
26
|
-
markers: {
|
|
27
|
-
type: String,
|
|
28
|
-
},
|
|
29
|
-
|
|
30
|
-
/**
|
|
31
|
-
* The map zoom level. Lower is more zoomed out
|
|
32
|
-
*/
|
|
33
|
-
zoom: {
|
|
34
|
-
type: String,
|
|
35
|
-
default: '8',
|
|
36
|
-
validator(value) {
|
|
37
|
-
return typeof parseInt(value) === 'number'
|
|
38
|
-
},
|
|
39
|
-
},
|
|
40
|
-
})
|
|
41
|
-
|
|
42
|
-
const coordinatesComp = computed(() => props.coordinates.split(','))
|
|
43
|
-
const markersComp = computed(() =>
|
|
44
|
-
props.markers?.split(';').map((m) => m.split(',')),
|
|
45
|
-
)
|
|
46
|
-
|
|
47
|
-
const mapOptions = reactive({
|
|
48
|
-
style: props.theme,
|
|
49
|
-
accessToken: props.mapboxApiToken,
|
|
50
|
-
})
|
|
51
|
-
</script>
|
|
52
|
-
|
|
53
|
-
<template>
|
|
54
|
-
<LazyLoad>
|
|
55
|
-
<MapComponent
|
|
56
|
-
:coordinates="coordinatesComp"
|
|
57
|
-
:zoom="parseInt(props.zoom)"
|
|
58
|
-
:markers="markersComp"
|
|
59
|
-
:map-options="mapOptions"
|
|
60
|
-
/>
|
|
61
|
-
</LazyLoad>
|
|
62
|
-
</template>
|
|
63
|
-
|
|
64
|
-
<style>
|
|
65
|
-
@import url('@kvass/map/style.css');
|
|
66
|
-
</style>
|
package/src/map/main.js
DELETED