@likable-hair/svelte 0.0.23 → 0.0.26
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/common/Card.svelte +6 -11
- package/common/Card.svelte.d.ts +5 -1
- package/common/MediaQuery.svelte +0 -0
- package/common/MediaQuery.svelte.d.ts +19 -0
- package/navigation/Navigator.svelte.d.ts +1 -0
- package/navigation/TabSwitcher.svelte +11 -13
- package/navigation/TabSwitcher.svelte.d.ts +3 -0
- package/package.json +3 -1
- package/stores/mediaQuery.d.ts +9 -0
- package/stores/mediaQuery.js +44 -0
package/common/Card.svelte
CHANGED
|
@@ -1,14 +1,6 @@
|
|
|
1
|
-
<script >export let outlined = false, maxWidth = undefined, maxHeight = undefined, minWidth = undefined, minHeight = undefined, width = 'fit-content', height = undefined, padding = "5px", borderRadius = "5px", backgroundColor = "rgb(252, 252, 252)", color = undefined, borderColor = undefined, borderWidth = undefined,
|
|
1
|
+
<script >export let outlined = false, maxWidth = undefined, maxHeight = undefined, minWidth = undefined, minHeight = undefined, width = 'fit-content', height = undefined, padding = "5px", borderRadius = "5px", backgroundColor = "rgb(252, 252, 252)", color = undefined, borderColor = undefined, borderWidth = undefined, marginBottom = undefined, marginTop = undefined, marginLeft = undefined, marginRight = undefined, boxShadow = "0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1)";
|
|
2
2
|
</script>
|
|
3
3
|
|
|
4
|
-
<style>
|
|
5
|
-
.shadow-lg {
|
|
6
|
-
--shadow: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
|
|
7
|
-
--shadow-colored: 0 10px 15px -3px #000, 0 4px 6px -4px #000;
|
|
8
|
-
box-shadow: inset 0 0 0 calc(1px + 0px) rgb(255 255 255/0.1), 0 0 #0000, 0 0 #0000;
|
|
9
|
-
}
|
|
10
|
-
</style>
|
|
11
|
-
|
|
12
4
|
<div
|
|
13
5
|
style:width={width}
|
|
14
6
|
style:max-width={maxWidth}
|
|
@@ -22,10 +14,13 @@
|
|
|
22
14
|
style:color={color}
|
|
23
15
|
style:border-color={borderColor}
|
|
24
16
|
style:border-width={borderWidth}
|
|
25
|
-
style={
|
|
17
|
+
style:margin-bottom={marginBottom}
|
|
18
|
+
style:margin-top={marginTop}
|
|
19
|
+
style:margin-left={marginLeft}
|
|
20
|
+
style:margin-right={marginRight}
|
|
21
|
+
style:box-shadow={boxShadow}
|
|
26
22
|
style:display="flex"
|
|
27
23
|
style:flex-direction="column"
|
|
28
|
-
class="shadow-lg"
|
|
29
24
|
class:border-solid={outlined}
|
|
30
25
|
>
|
|
31
26
|
<div
|
package/common/Card.svelte.d.ts
CHANGED
|
@@ -14,7 +14,11 @@ declare const __propDef: {
|
|
|
14
14
|
color?: string;
|
|
15
15
|
borderColor?: string;
|
|
16
16
|
borderWidth?: string;
|
|
17
|
-
|
|
17
|
+
marginBottom?: string;
|
|
18
|
+
marginTop?: string;
|
|
19
|
+
marginLeft?: string;
|
|
20
|
+
marginRight?: string;
|
|
21
|
+
boxShadow?: string;
|
|
18
22
|
};
|
|
19
23
|
events: {
|
|
20
24
|
[evt: string]: CustomEvent<any>;
|
|
File without changes
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/** @typedef {typeof __propDef.props} MediaQueryProps */
|
|
2
|
+
/** @typedef {typeof __propDef.events} MediaQueryEvents */
|
|
3
|
+
/** @typedef {typeof __propDef.slots} MediaQuerySlots */
|
|
4
|
+
export default class MediaQuery extends SvelteComponentTyped<{}, {
|
|
5
|
+
[evt: string]: CustomEvent<any>;
|
|
6
|
+
}, {}> {
|
|
7
|
+
}
|
|
8
|
+
export type MediaQueryProps = typeof __propDef.props;
|
|
9
|
+
export type MediaQueryEvents = typeof __propDef.events;
|
|
10
|
+
export type MediaQuerySlots = typeof __propDef.slots;
|
|
11
|
+
import { SvelteComponentTyped } from "svelte";
|
|
12
|
+
declare const __propDef: {
|
|
13
|
+
props: {};
|
|
14
|
+
events: {
|
|
15
|
+
[evt: string]: CustomEvent<any>;
|
|
16
|
+
};
|
|
17
|
+
slots: {};
|
|
18
|
+
};
|
|
19
|
+
export {};
|
|
@@ -2,9 +2,7 @@
|
|
|
2
2
|
</script>
|
|
3
3
|
|
|
4
4
|
<script >import { onMount } from 'svelte';
|
|
5
|
-
export let tabs = [];
|
|
6
|
-
export let selected = undefined;
|
|
7
|
-
export let mandatory = true;
|
|
5
|
+
export let tabs = [], selected = undefined, mandatory = true, width = undefined, color = "rgb(51 65 85)", bookmarkColor = undefined;
|
|
8
6
|
let tabButtons = {};
|
|
9
7
|
onMount(() => {
|
|
10
8
|
if (mandatory && !selected && tabs.length > 0)
|
|
@@ -28,7 +26,7 @@ function setBookmarkPosition() {
|
|
|
28
26
|
<div
|
|
29
27
|
style:position="relative"
|
|
30
28
|
style:display="flex"
|
|
31
|
-
|
|
29
|
+
style:width={width}
|
|
32
30
|
>
|
|
33
31
|
{#each tabs as tab}
|
|
34
32
|
<div
|
|
@@ -36,6 +34,7 @@ function setBookmarkPosition() {
|
|
|
36
34
|
style:margin-left="12px"
|
|
37
35
|
style:margin-right="12px"
|
|
38
36
|
style:padding="8px"
|
|
37
|
+
style:--tab-switcher-color={color}
|
|
39
38
|
class:selected-tab={tab.name == selected}
|
|
40
39
|
on:click={() => handleTabClick(tab)}
|
|
41
40
|
bind:this={tabButtons[tab.name]}
|
|
@@ -46,27 +45,26 @@ function setBookmarkPosition() {
|
|
|
46
45
|
<span
|
|
47
46
|
style:left={bookmarkLeft + 'px'}
|
|
48
47
|
style:width={bookmarkWidth + 'px'}
|
|
48
|
+
style:--tab-switcher-bookmark-color={bookmarkColor || color}
|
|
49
49
|
class="bookmark"
|
|
50
50
|
></span>
|
|
51
|
-
<span
|
|
51
|
+
<span
|
|
52
|
+
style:width={width}
|
|
53
|
+
class="horizontal-guide"
|
|
54
|
+
></span>
|
|
52
55
|
</div>
|
|
53
56
|
|
|
54
57
|
<style>
|
|
55
|
-
.tab-switcher-container {
|
|
56
|
-
width: var(--width)
|
|
57
|
-
}
|
|
58
|
-
|
|
59
58
|
.selected-tab {
|
|
60
|
-
color: var(--color, rgb(51 65 85));
|
|
59
|
+
color: var(--tab-switcher-color, rgb(51 65 85));
|
|
61
60
|
}
|
|
62
61
|
|
|
63
62
|
.horizontal-guide {
|
|
64
63
|
position: absolute;
|
|
65
|
-
width: var(--width, 100%);
|
|
66
64
|
z-index: 5;
|
|
67
65
|
bottom: 0px;
|
|
68
66
|
height: 1px;
|
|
69
|
-
background-color: var(--color, rgb(51 65 85));
|
|
67
|
+
background-color: var(--tab-switcher-color, rgb(51 65 85));
|
|
70
68
|
opacity: 20%;
|
|
71
69
|
}
|
|
72
70
|
|
|
@@ -76,7 +74,7 @@ function setBookmarkPosition() {
|
|
|
76
74
|
height: 2px;
|
|
77
75
|
border-radius: 0.125rem;
|
|
78
76
|
z-index: 10;
|
|
79
|
-
background-color: var(--bookmark-color, var(--color, rgb(51 65 85)));
|
|
77
|
+
background-color: var(--tab-switcher-bookmark-color, var(--tab-switcher-color, rgb(51 65 85)));
|
|
80
78
|
transition: left 400ms, width 400ms;
|
|
81
79
|
}
|
|
82
80
|
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@likable-hair/svelte",
|
|
3
3
|
"description": "A Svelte component for likablehair",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.26",
|
|
5
5
|
"devDependencies": {
|
|
6
6
|
"@sveltejs/adapter-auto": "next",
|
|
7
7
|
"@sveltejs/kit": "next",
|
|
@@ -28,6 +28,7 @@
|
|
|
28
28
|
"./common/Card.svelte": "./common/Card.svelte",
|
|
29
29
|
"./common/Gesture.svelte": "./common/Gesture.svelte",
|
|
30
30
|
"./common/IntersectionObserver.svelte": "./common/IntersectionObserver.svelte",
|
|
31
|
+
"./common/MediaQuery.svelte": "./common/MediaQuery.svelte",
|
|
31
32
|
"./common/materialDesign.css": "./common/materialDesign.css",
|
|
32
33
|
"./dates/Calendar.svelte": "./dates/Calendar.svelte",
|
|
33
34
|
"./dates/utils": "./dates/utils.js",
|
|
@@ -50,6 +51,7 @@
|
|
|
50
51
|
"./progress/ProgressBar.svelte": "./progress/ProgressBar.svelte",
|
|
51
52
|
"./shop/ProductCard.svelte": "./shop/ProductCard.svelte",
|
|
52
53
|
"./shop/ProductsGrid.svelte": "./shop/ProductsGrid.svelte",
|
|
54
|
+
"./stores/mediaQuery": "./stores/mediaQuery.js",
|
|
53
55
|
"./timeline/ScrollTimeLine.svelte": "./timeline/ScrollTimeLine.svelte",
|
|
54
56
|
"./timeline/SimpleTimeLine.svelte": "./timeline/SimpleTimeLine.svelte"
|
|
55
57
|
},
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/*
|
|
2
|
+
320px — 480px: Mobile devices
|
|
3
|
+
481px — 768px: iPads, Tablets
|
|
4
|
+
769px — 1024px: Small screens, laptops
|
|
5
|
+
1025px — 1200px: Desktops, large screens
|
|
6
|
+
1201px and more — Extra large screens, TV
|
|
7
|
+
*/
|
|
8
|
+
import { readable } from "svelte/store";
|
|
9
|
+
import { browser } from "$app/env";
|
|
10
|
+
// 320px — 480px: Mobile devices
|
|
11
|
+
function handleMatchOnXsQuery(event) {
|
|
12
|
+
if (event.matches) {
|
|
13
|
+
return {
|
|
14
|
+
xs: true,
|
|
15
|
+
s: false,
|
|
16
|
+
m: false,
|
|
17
|
+
l: false,
|
|
18
|
+
xl: false
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
export default readable({
|
|
23
|
+
xs: false,
|
|
24
|
+
s: false,
|
|
25
|
+
m: true,
|
|
26
|
+
l: false,
|
|
27
|
+
xl: false
|
|
28
|
+
}, set => {
|
|
29
|
+
let mqlXs;
|
|
30
|
+
let listenerXs = (e) => {
|
|
31
|
+
const results = handleMatchOnXsQuery(e);
|
|
32
|
+
if (!!results)
|
|
33
|
+
set(results);
|
|
34
|
+
};
|
|
35
|
+
if (browser) {
|
|
36
|
+
mqlXs = window.matchMedia("(min-width: 320px) and (max-width: 480px)");
|
|
37
|
+
mqlXs.addEventListener("change", listenerXs);
|
|
38
|
+
}
|
|
39
|
+
return () => {
|
|
40
|
+
if (browser) {
|
|
41
|
+
mqlXs.removeEventListener("change", listenerXs);
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
});
|