@onsvisual/svelte-components 0.1.5 → 0.1.7
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.
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
/** @typedef {typeof __propDef.events} OnsLogoEvents */
|
|
3
3
|
/** @typedef {typeof __propDef.slots} OnsLogoSlots */
|
|
4
4
|
export default class OnsLogo extends SvelteComponentTyped<{
|
|
5
|
+
theme?: any;
|
|
5
6
|
width?: any;
|
|
6
7
|
height?: any;
|
|
7
8
|
compact?: boolean;
|
|
@@ -16,6 +17,7 @@ export type OnsLogoSlots = typeof __propDef.slots;
|
|
|
16
17
|
import { SvelteComponentTyped } from "svelte";
|
|
17
18
|
declare const __propDef: {
|
|
18
19
|
props: {
|
|
20
|
+
theme?: any;
|
|
19
21
|
width?: any;
|
|
20
22
|
height?: any;
|
|
21
23
|
compact?: boolean;
|
|
@@ -14,6 +14,8 @@ export default class Scroller extends SvelteComponentTyped<{
|
|
|
14
14
|
visible?: boolean;
|
|
15
15
|
}, {
|
|
16
16
|
change: CustomEvent<any>;
|
|
17
|
+
enter: CustomEvent<any>;
|
|
18
|
+
exit: CustomEvent<any>;
|
|
17
19
|
} & {
|
|
18
20
|
[evt: string]: CustomEvent<any>;
|
|
19
21
|
}, {
|
|
@@ -40,6 +42,8 @@ declare const __propDef: {
|
|
|
40
42
|
};
|
|
41
43
|
events: {
|
|
42
44
|
change: CustomEvent<any>;
|
|
45
|
+
enter: CustomEvent<any>;
|
|
46
|
+
exit: CustomEvent<any>;
|
|
43
47
|
} & {
|
|
44
48
|
[evt: string]: CustomEvent<any>;
|
|
45
49
|
};
|
|
@@ -287,10 +287,10 @@
|
|
|
287
287
|
<div class="ons-grid__col ons-col-auto">
|
|
288
288
|
<a class="ons-header__org-logo-link" href="#0"
|
|
289
289
|
><div class="ons-header__org-logo ons-header__org-logo--large">
|
|
290
|
-
<ONSLogo width="{197}" height="{19}" />
|
|
290
|
+
<ONSLogo theme="{theme}" width="{197}" height="{19}" />
|
|
291
291
|
</div>
|
|
292
292
|
<div class="ons-header__org-logo ons-header__org-logo--small">
|
|
293
|
-
<ONSLogo width="{120}" height="{27}" compact />
|
|
293
|
+
<ONSLogo theme="{theme}" width="{120}" height="{27}" compact />
|
|
294
294
|
</div></a
|
|
295
295
|
>
|
|
296
296
|
</div>
|
|
@@ -302,7 +302,7 @@
|
|
|
302
302
|
<div class="header col-wrap">
|
|
303
303
|
<div class="col col--lg-one-third col--md-one-third">
|
|
304
304
|
<a href="{baseurl}/">
|
|
305
|
-
<ONSLogo className="logo" height="{39}" compact />
|
|
305
|
+
<ONSLogo theme="{theme}" className="logo" height="{39}" compact />
|
|
306
306
|
</a>
|
|
307
307
|
</div>
|
|
308
308
|
<div
|
|
@@ -1,15 +1,12 @@
|
|
|
1
1
|
<script>
|
|
2
|
-
import { getContext } from "svelte";
|
|
3
|
-
|
|
4
|
-
const theme = getContext("theme");
|
|
5
|
-
|
|
6
|
-
$: primary = theme === "dark" ? "white" : "#003c57";
|
|
7
|
-
const secondary = "#a8bd3a";
|
|
8
|
-
|
|
9
2
|
export let compact = false;
|
|
10
3
|
export let className = "ons-svg-logo";
|
|
11
4
|
export let width = null;
|
|
12
5
|
export let height = null;
|
|
6
|
+
export let theme = null;
|
|
7
|
+
|
|
8
|
+
$: primary = theme === "dark" ? "white" : "#003c57";
|
|
9
|
+
const secondary = "#a8bd3a";
|
|
13
10
|
</script>
|
|
14
11
|
|
|
15
12
|
{#if !compact}
|
|
@@ -163,7 +163,6 @@
|
|
|
163
163
|
$: widthStyle = fixed ? `width:${width}px;` : "";
|
|
164
164
|
|
|
165
165
|
function initSections(sections) {
|
|
166
|
-
console.log("updating scroller", sections.length);
|
|
167
166
|
if (scroller) manager.remove(scroller);
|
|
168
167
|
|
|
169
168
|
count = sections.length;
|
|
@@ -189,7 +188,10 @@
|
|
|
189
188
|
const fg = foreground.getBoundingClientRect();
|
|
190
189
|
const bg = background.getBoundingClientRect();
|
|
191
190
|
|
|
192
|
-
|
|
191
|
+
const visible_new = fg.top < wh && fg.bottom > 0;
|
|
192
|
+
const entered = visible_new && !visible;
|
|
193
|
+
const exited = !visible_new && visible;
|
|
194
|
+
visible = visible_new;
|
|
193
195
|
|
|
194
196
|
const foreground_height = fg.bottom - fg.top;
|
|
195
197
|
const background_height = bg.bottom - bg.top;
|
|
@@ -221,7 +223,7 @@
|
|
|
221
223
|
|
|
222
224
|
offset = (threshold_px - top) / (bottom - top);
|
|
223
225
|
if (bottom >= threshold_px) {
|
|
224
|
-
if (index !== i) {
|
|
226
|
+
if (index !== i || entered) {
|
|
225
227
|
index = i;
|
|
226
228
|
sectionId = section.dataset.id ? section.dataset.id : null;
|
|
227
229
|
dispatch("change", { id, index, sectionId });
|
|
@@ -229,6 +231,9 @@
|
|
|
229
231
|
break;
|
|
230
232
|
}
|
|
231
233
|
}
|
|
234
|
+
|
|
235
|
+
if (entered) dispatch("enter", { id, index, sectionId });
|
|
236
|
+
if (exited) dispatch("exit", { id, index, sectionId });
|
|
232
237
|
}
|
|
233
238
|
</script>
|
|
234
239
|
|