@nemigo/layout 1.6.0 → 2.1.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.
@@ -1,21 +1,9 @@
1
- <script module lang="ts"></script>
1
+ <script module lang="ts">export {};
2
+ </script>
2
3
 
3
4
  <script lang="ts">import { preventStop, usePreventStop } from "@nemigo/helpers/html/events";
4
- let {
5
- id,
6
- label,
7
- class: className,
8
- style,
9
- disabled,
10
- load,
11
- onclick: onClick,
12
- onmousedown,
13
- onenterdown,
14
- onkeydown,
15
- oncontextmenu,
16
- children
17
- } = $props();
18
- let ariaLabel = $derived(label ?? void 0);
5
+ let { id, label, class: className, style, disabled, load, onclick: onClick, onmousedown, onenterdown, onkeydown, oncontextmenu, children } = $props();
6
+ let ariaLabel = $derived(label ?? undefined);
19
7
  </script>
20
8
 
21
9
  {#if onClick}
@@ -1,4 +1,5 @@
1
- <script module lang="ts"></script>
1
+ <script module lang="ts">export {};
2
+ </script>
2
3
 
3
4
  <script lang="ts">import { delay as Delay } from "@nemigo/helpers/async";
4
5
  import { isSSR } from "@nemigo/helpers/html";
@@ -0,0 +1,41 @@
1
+ <script lang="ts">import { delay } from "@nemigo/helpers/async";
2
+ import { Navigation } from "@nemigo/svelte/kit/navigation";
3
+ import { linear } from "svelte/easing";
4
+ import { blur } from "svelte/transition";
5
+ let { class: className, duration = 350, handler, children } = $props();
6
+ const __navigation = Navigation.default(handler).hydrate();
7
+ let animate = $state(false);
8
+ let show = $derived(!__navigation.state.signal && !animate);
9
+ const stepper = {
10
+ in: {
11
+ get duration() {
12
+ return duration;
13
+ },
14
+ amount: 7,
15
+ easing: linear
16
+ },
17
+ out: {
18
+ get duration() {
19
+ return duration;
20
+ },
21
+ amount: 14,
22
+ easing: linear
23
+ }
24
+ };
25
+ </script>
26
+
27
+ {#if show}
28
+ <div
29
+ class={className}
30
+ onoutrostart={() => {
31
+ animate = true;
32
+ }}
33
+ onoutroend={() =>
34
+ void delay(25).then(() => {
35
+ animate = false;
36
+ })}
37
+ in:blur={stepper.in}
38
+ out:blur={stepper.out}>
39
+ {@render children()}
40
+ </div>
41
+ {/if}
@@ -0,0 +1,13 @@
1
+ import type { NavigationHandler } from "@nemigo/svelte/kit/navigation";
2
+ import { Navigation } from "@nemigo/svelte/kit/navigation";
3
+ import type { Snippet } from "svelte";
4
+ import type { ClassValue } from "svelte/elements";
5
+ interface Props {
6
+ class?: ClassValue;
7
+ duration?: number;
8
+ handler?: NavigationHandler;
9
+ children: Snippet;
10
+ }
11
+ declare const Navigation: import("svelte").Component<Props, {}, "">;
12
+ type Navigation = ReturnType<typeof Navigation>;
13
+ export default Navigation;
@@ -3,7 +3,7 @@ export const loaderCursorStore = LoaderStore.default();
3
3
  </script>
4
4
 
5
5
  <script lang="ts">$effect(() => {
6
- document.documentElement.style.cursor = loaderCursorStore.state.signal ? "wait" : "auto";
6
+ document.documentElement.style.cursor = loaderCursorStore.state.signal ? "wait" : "auto";
7
7
  });
8
8
  loaderCursorStore.hydrate();
9
9
  </script>
package/package.json CHANGED
@@ -1,21 +1,18 @@
1
1
  {
2
2
  "name": "@nemigo/layout",
3
- "version": "1.6.0",
3
+ "version": "2.1.0",
4
4
  "private": false,
5
5
  "author": {
6
6
  "name": "Vlad Logvin",
7
7
  "email": "vlad.logvin84@gmail.com"
8
8
  },
9
9
  "type": "module",
10
- "engines": {
11
- "node": ">=22",
12
- "pnpm": ">=10.9.0"
13
- },
14
10
  "scripts": {
15
11
  "build": "svelte-package && rimraf .svelte-kit",
16
12
  "check": "svelte-check --tsconfig ./tsconfig.json",
17
- "lint": "eslint ./",
18
- "format": "prettier --write ./"
13
+ "eslint": "bunx --bun eslint ./",
14
+ "eslint:fix": "bunx --bun eslint --fix ./",
15
+ "format": "bunx --bun prettier --write ./"
19
16
  },
20
17
  "exports": {
21
18
  "./Context": {
@@ -30,9 +27,9 @@
30
27
  "types": "./dist/blocks/LazyBlock.svelte.d.ts",
31
28
  "svelte": "./dist/blocks/LazyBlock.svelte"
32
29
  },
33
- "./navigation": {
34
- "types": "./dist/navigation.d.ts",
35
- "svelte": "./dist/navigation.js"
30
+ "./kit/Navigation": {
31
+ "types": "./dist/kit/Navigation.d.ts",
32
+ "svelte": "./dist/kit/Navigation.svelte"
36
33
  },
37
34
  "./stores/LoaderCursor": {
38
35
  "types": "./dist/stores/LoaderCursor.svelte.d.ts",
@@ -40,8 +37,8 @@
40
37
  }
41
38
  },
42
39
  "peerDependencies": {
43
- "@nemigo/helpers": ">=1.5.0",
44
- "@nemigo/svelte": ">=1.5.0",
40
+ "@nemigo/helpers": ">=2.0.0",
41
+ "@nemigo/svelte": ">=2.1.0",
45
42
  "@sveltejs/kit": ">=2.12.0",
46
43
  "svelte": ">=5.0.0"
47
44
  },
@@ -51,8 +48,8 @@
51
48
  }
52
49
  },
53
50
  "devDependencies": {
54
- "@nemigo/configs": "workspace:*",
55
- "@nemigo/helpers": "workspace:*",
56
- "@nemigo/svelte": "workspace:*"
51
+ "@nemigo/configs": "2.1.0",
52
+ "@nemigo/helpers": "2.0.0",
53
+ "@nemigo/svelte": "2.1.0"
57
54
  }
58
55
  }
@@ -1,13 +0,0 @@
1
- import type { IState } from "@nemigo/helpers/types";
2
- import type { ISvelteState } from "@nemigo/svelte";
3
- export interface NavigationHandler {
4
- ignore?: (from: URL, to: URL) => boolean;
5
- equal?: boolean;
6
- }
7
- export declare class Navigation<State extends IState<boolean> = ISvelteState<boolean>> {
8
- state: State;
9
- __handler: NavigationHandler;
10
- static default(handler?: NavigationHandler): Navigation;
11
- constructor(state: State, handler?: NavigationHandler);
12
- hydrate(): this;
13
- }
@@ -1,32 +0,0 @@
1
- import { afterNavigate, beforeNavigate } from "$app/navigation";
2
- import { page } from "$app/state";
3
- import { createSvelteState } from "@nemigo/svelte";
4
- export class Navigation {
5
- state;
6
- __handler;
7
- static default(handler) {
8
- return new Navigation(createSvelteState(false), handler);
9
- }
10
- constructor(state, handler = {}) {
11
- this.state = state;
12
- this.__handler = handler;
13
- }
14
- hydrate() {
15
- afterNavigate(() => this.state.set(false));
16
- beforeNavigate((navigation) => {
17
- if (!navigation.to)
18
- return;
19
- const form_url = page.url;
20
- const to_url = navigation.to.url;
21
- if (!this.__handler.equal && form_url.toString() === to_url.toString())
22
- return;
23
- if (this.__handler.ignore && this.__handler.ignore(form_url, to_url))
24
- return;
25
- if (this.state.get())
26
- navigation.cancel();
27
- else
28
- this.state.set(true);
29
- });
30
- return this;
31
- }
32
- }