@nemigo/layout 0.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.
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { Snippet } from "svelte";
|
|
2
|
+
export interface ContextProps {
|
|
3
|
+
key: string;
|
|
4
|
+
value: unknown;
|
|
5
|
+
children: Snippet;
|
|
6
|
+
}
|
|
7
|
+
declare const Context: import("svelte").Component<ContextProps, {}, "">;
|
|
8
|
+
type Context = ReturnType<typeof Context>;
|
|
9
|
+
export default Context;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
<script module lang="ts"></script>
|
|
2
|
+
|
|
3
|
+
<script lang="ts">import { delay as Delay } from "@nemigo/helpers/async";
|
|
4
|
+
import { isSSR } from "@nemigo/helpers/html";
|
|
5
|
+
let { delay, trigger, load } = $props();
|
|
6
|
+
const _trigger = isSSR ? trigger ?? Delay(delay ?? 500) : null;
|
|
7
|
+
</script>
|
|
8
|
+
|
|
9
|
+
{#if !isSSR}
|
|
10
|
+
{#await _trigger then _}
|
|
11
|
+
{#await load() then { default: Component }}<Component />{/await}
|
|
12
|
+
{/await}
|
|
13
|
+
{/if}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { Timestamp } from "@nemigo/helpers/types";
|
|
2
|
+
import type { Component } from "svelte";
|
|
3
|
+
export interface LazyBlockProps {
|
|
4
|
+
/**
|
|
5
|
+
* @default 500
|
|
6
|
+
*/
|
|
7
|
+
delay?: Timestamp;
|
|
8
|
+
trigger?: Promise<any>;
|
|
9
|
+
load: () => Promise<{
|
|
10
|
+
default: Component;
|
|
11
|
+
}>;
|
|
12
|
+
}
|
|
13
|
+
declare const LazyBlock: Component<LazyBlockProps, {}, "">;
|
|
14
|
+
type LazyBlock = ReturnType<typeof LazyBlock>;
|
|
15
|
+
export default LazyBlock;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
<script module lang="ts">import { LoaderStore } from "@nemigo/svelte/loader";
|
|
2
|
+
export const loaderCursorStore = new LoaderStore(true);
|
|
3
|
+
</script>
|
|
4
|
+
|
|
5
|
+
<script lang="ts">$effect(() => {
|
|
6
|
+
document.documentElement.style.cursor = loaderCursorStore.store.value ? "wait" : "auto";
|
|
7
|
+
});
|
|
8
|
+
loaderCursorStore.hydrate();
|
|
9
|
+
</script>
|
package/package.json
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@nemigo/layout",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"private": false,
|
|
5
|
+
"author": {
|
|
6
|
+
"name": "Vlad Logvin",
|
|
7
|
+
"email": "vlad.logvin84@gmail.com"
|
|
8
|
+
},
|
|
9
|
+
"type": "module",
|
|
10
|
+
"scripts": {
|
|
11
|
+
"build": "svelte-package && rimraf .svelte-kit",
|
|
12
|
+
"check": "tsc --noemit",
|
|
13
|
+
"lint": "eslint ./",
|
|
14
|
+
"format": "prettier --write ./"
|
|
15
|
+
},
|
|
16
|
+
"exports": {
|
|
17
|
+
"./Context": {
|
|
18
|
+
"types": "./dist/Context.svelte.d.ts",
|
|
19
|
+
"svelte": "./dist/Context.svelte"
|
|
20
|
+
},
|
|
21
|
+
"./blocks/LazyBlock": {
|
|
22
|
+
"types": "./dist/blocks/LazyBlock.svelte.d.ts",
|
|
23
|
+
"svelte": "./dist/blocks/LazyBlock.svelte"
|
|
24
|
+
},
|
|
25
|
+
"./stores/LoaderCursor": {
|
|
26
|
+
"types": "./dist/blocks/LoaderCursor.svelte.d.ts",
|
|
27
|
+
"svelte": "./dist/blocks/LoaderCursor.svelte"
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
"peerDependencies": {
|
|
31
|
+
"@nemigo/helpers": ">0.7.0",
|
|
32
|
+
"@nemigo/svelte": ">0.3.0",
|
|
33
|
+
"svelte": "^5.0.0"
|
|
34
|
+
},
|
|
35
|
+
"devDependencies": {
|
|
36
|
+
"@nemigo/configs": "workspace:*",
|
|
37
|
+
"@nemigo/helpers": "workspace:*",
|
|
38
|
+
"@nemigo/svelte": "workspace:*"
|
|
39
|
+
}
|
|
40
|
+
}
|