@dvcol/neo-svelte 1.1.1 → 1.1.2
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/CHANGELOG.md +7 -0
- package/dist/loading/NeoLazy.svelte +2 -2
- package/dist/loading/NeoLoadingMatrix.svelte +12 -2
- package/dist/loading/NeoSuspense.svelte +4 -4
- package/dist/loading/neo-lazy.model.d.ts +11 -2
- package/dist/loading/neo-loading-matrix.model.d.ts +2 -2
- package/dist/loading/neo-suspense.model.d.ts +31 -2
- package/dist/nav/NeoTabs.svelte +30 -34
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
|
4
4
|
|
|
5
|
+
### [1.1.2](https://github.com/dvcol/neo-svelte/compare/v1.1.1...v1.1.2) (2025-04-21)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
* **nav:** fix snippet when exported ([bda737c](https://github.com/dvcol/neo-svelte/commit/bda737c4fc9fd206e28253fee559fd02a9528642))
|
|
11
|
+
|
|
5
12
|
### [1.1.1](https://github.com/dvcol/neo-svelte/compare/v1.1.0...v1.1.1) (2025-04-21)
|
|
6
13
|
|
|
7
14
|
|
|
@@ -3,10 +3,10 @@
|
|
|
3
3
|
|
|
4
4
|
import NeoSuspense from './NeoSuspense.svelte';
|
|
5
5
|
|
|
6
|
-
const { component, props: _props,
|
|
6
|
+
const { component, props: _props, children, ...rest }: NeoLazyProps = $props();
|
|
7
7
|
</script>
|
|
8
8
|
|
|
9
|
-
<NeoSuspense promise={component} {
|
|
9
|
+
<NeoSuspense promise={component} {...rest}>
|
|
10
10
|
{#snippet result(Component)}
|
|
11
11
|
<Component {..._props}>
|
|
12
12
|
{@render children?.()}
|
|
@@ -5,9 +5,18 @@
|
|
|
5
5
|
import { toSize } from '../utils/style.utils.js';
|
|
6
6
|
|
|
7
7
|
const {
|
|
8
|
+
// State
|
|
8
9
|
tag = 'div',
|
|
10
|
+
|
|
11
|
+
// Size
|
|
9
12
|
width: _width,
|
|
10
13
|
height: _height,
|
|
14
|
+
|
|
15
|
+
// Flex
|
|
16
|
+
flex,
|
|
17
|
+
align,
|
|
18
|
+
justify,
|
|
19
|
+
|
|
11
20
|
...rest
|
|
12
21
|
}: NeoLoadingMatrixProps = $props();
|
|
13
22
|
|
|
@@ -18,6 +27,9 @@
|
|
|
18
27
|
<svelte:element
|
|
19
28
|
this={tag}
|
|
20
29
|
class:neo-loading-matrix={true}
|
|
30
|
+
style:flex
|
|
31
|
+
style:align-items={align}
|
|
32
|
+
style:justify-content={justify}
|
|
21
33
|
style:--neo-loader-width={width?.absolute}
|
|
22
34
|
style:--neo-loader-max-width={width?.max}
|
|
23
35
|
style:--neo-loader-min-width={width?.min}
|
|
@@ -34,8 +46,6 @@
|
|
|
34
46
|
flex: 1 1 auto;
|
|
35
47
|
align-items: center;
|
|
36
48
|
justify-content: center;
|
|
37
|
-
width: 100%;
|
|
38
|
-
height: 100%;
|
|
39
49
|
opacity: 1;
|
|
40
50
|
transition: opacity 1s ease-in 0.2s;
|
|
41
51
|
}
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
import NeoLoadingMatrix from './NeoLoadingMatrix.svelte';
|
|
8
8
|
|
|
9
|
-
const { promise, delay = 500, loading, result, error, children }: NeoSuspenseProps = $props();
|
|
9
|
+
const { promise, delay = 500, loading, result, error, children, matrixProps }: NeoSuspenseProps = $props();
|
|
10
10
|
|
|
11
11
|
let showLoading = $state(!delay);
|
|
12
12
|
|
|
@@ -19,10 +19,10 @@
|
|
|
19
19
|
|
|
20
20
|
{#await promise}
|
|
21
21
|
{#if showLoading}
|
|
22
|
-
{#if loading}
|
|
22
|
+
{#if loading && typeof loading === 'function'}
|
|
23
23
|
{@render loading(promise)}
|
|
24
|
-
{:else}
|
|
25
|
-
<NeoLoadingMatrix />
|
|
24
|
+
{:else if loading !== false}
|
|
25
|
+
<NeoLoadingMatrix {...matrixProps} />
|
|
26
26
|
{/if}
|
|
27
27
|
{/if}
|
|
28
28
|
{:then resolved}
|
|
@@ -1,11 +1,20 @@
|
|
|
1
1
|
import type { Component, Snippet } from 'svelte';
|
|
2
2
|
import type { NeoSuspenseProps } from './neo-suspense.model.js';
|
|
3
3
|
export type NeoLazyProps<Props extends Record<string, any> = object, Exports extends Record<string, any> = object, Bindings extends keyof Props | '' = string> = {
|
|
4
|
+
/**
|
|
5
|
+
* The component to lazy load.
|
|
6
|
+
*/
|
|
4
7
|
component: Promise<{
|
|
5
8
|
default: Component<Props, Exports, Bindings>;
|
|
6
9
|
}>;
|
|
10
|
+
/**
|
|
11
|
+
* Optional props to pass to the component.
|
|
12
|
+
*/
|
|
7
13
|
props?: Record<string, any>;
|
|
14
|
+
/**
|
|
15
|
+
* Children to render once the component is loaded.
|
|
16
|
+
*/
|
|
8
17
|
children?: Snippet;
|
|
9
|
-
} &
|
|
18
|
+
} & Omit<NeoSuspenseProps<{
|
|
10
19
|
default: Component<Props, Exports, Bindings>;
|
|
11
|
-
}>, '
|
|
20
|
+
}>, 'promise'>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { HTMLNeoBaseElement } from '../utils/html-element.utils.js';
|
|
1
|
+
import type { HTMLFlexProps, HTMLNeoBaseElement } from '../utils/html-element.utils.js';
|
|
2
2
|
import type { SizeInput } from '../utils/style.utils.js';
|
|
3
3
|
export type NeoLoadingMatrixProps<Tag extends keyof HTMLElementTagNameMap = 'div'> = {
|
|
4
4
|
/**
|
|
@@ -15,4 +15,4 @@ export type NeoLoadingMatrixProps<Tag extends keyof HTMLElementTagNameMap = 'div
|
|
|
15
15
|
* Size constraints for the loader icon.
|
|
16
16
|
*/
|
|
17
17
|
height?: SizeInput<'height'>;
|
|
18
|
-
} & HTMLNeoBaseElement<HTMLElementTagNameMap[Tag]
|
|
18
|
+
} & HTMLNeoBaseElement<HTMLElementTagNameMap[Tag]> & HTMLFlexProps;
|
|
@@ -1,9 +1,38 @@
|
|
|
1
|
+
import type { NeoLoadingMatrixProps } from '../index.js';
|
|
1
2
|
import type { Snippet } from 'svelte';
|
|
2
3
|
export interface NeoSuspenseProps<R = any, E = any> {
|
|
4
|
+
/**
|
|
5
|
+
* The promise to await.
|
|
6
|
+
*/
|
|
3
7
|
promise: Promise<R>;
|
|
8
|
+
/**
|
|
9
|
+
* Optional delay before showing the loading state.
|
|
10
|
+
*/
|
|
4
11
|
delay?: number;
|
|
5
|
-
|
|
6
|
-
|
|
12
|
+
/**
|
|
13
|
+
* Optional loading snippet to show while the promise is pending.
|
|
14
|
+
*/
|
|
15
|
+
loading?: Snippet<[Promise<R>]> | false;
|
|
16
|
+
/**
|
|
17
|
+
* Optional component to show when the promise is rejected.
|
|
18
|
+
*/
|
|
7
19
|
error?: Snippet<[E]>;
|
|
20
|
+
/**
|
|
21
|
+
* Optional component to show when the promise is resolved.
|
|
22
|
+
* If none is provided, the `children` prop will be used.
|
|
23
|
+
*
|
|
24
|
+
* @see {@link children}
|
|
25
|
+
*/
|
|
26
|
+
result?: Snippet<[R]>;
|
|
27
|
+
/**
|
|
28
|
+
* Optional component to show when the promise is resolved.
|
|
29
|
+
* If `result` is not provided, this will be used instead.
|
|
30
|
+
* @see {@link result}
|
|
31
|
+
*/
|
|
8
32
|
children?: Snippet;
|
|
33
|
+
/**
|
|
34
|
+
* Optional props to pass to the default loading component if no `loading` prop is provided.
|
|
35
|
+
* @see {@link loading}
|
|
36
|
+
*/
|
|
37
|
+
matrixProps?: NeoLoadingMatrixProps;
|
|
9
38
|
}
|
package/dist/nav/NeoTabs.svelte
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import type { NeoTabContextPositions
|
|
2
|
+
import type { NeoTabContextPositions } from './neo-tabs-context.svelte.js';
|
|
3
3
|
import type { NeoTabsProps, OnChange } from './neo-tabs.model.js';
|
|
4
4
|
|
|
5
5
|
import { toStyle } from '@dvcol/common-utils/common/class';
|
|
@@ -124,43 +124,39 @@
|
|
|
124
124
|
<IconAdd class="neo-tabs-add" />
|
|
125
125
|
{/snippet}
|
|
126
126
|
|
|
127
|
-
{#snippet tabs(ctx: NeoTabsContext = context.state)}
|
|
128
|
-
<svelte:element
|
|
129
|
-
this={containerTag}
|
|
130
|
-
bind:this={ref}
|
|
131
|
-
class:neo-tabs={true}
|
|
132
|
-
class:neo-inset={(elevation ?? 0) < 0}
|
|
133
|
-
class:neo-add={add}
|
|
134
|
-
class:neo-line={line}
|
|
135
|
-
class:neo-pill={pill}
|
|
136
|
-
class:neo-slide={slide}
|
|
137
|
-
class:neo-translate={translate}
|
|
138
|
-
class:neo-vertical={rest.vertical}
|
|
139
|
-
class:neo-rounded={rest.rounded}
|
|
140
|
-
class:neo-dim={dim}
|
|
141
|
-
style:--neo-tabs-slide-box-shadow={slideShadow}
|
|
142
|
-
{...containerRest}
|
|
143
|
-
use:useFn={useProps}
|
|
144
|
-
out:outFn={outProps}
|
|
145
|
-
in:inFn={inProps}
|
|
146
|
-
{style}
|
|
147
|
-
>
|
|
148
|
-
<NeoButtonGroup role="tablist" {pressed} {elevation} {...rest} class={['neo-tabs-group', rest.class]}>
|
|
149
|
-
{@render children?.(ctx)}
|
|
150
|
-
{#if add}
|
|
151
|
-
<div transition:transition={shortFreezeTransition}>
|
|
152
|
-
<NeoButton aria-label="Add new tab" onclick={onadd} {icon} />
|
|
153
|
-
</div>
|
|
154
|
-
{/if}
|
|
155
|
-
</NeoButtonGroup>
|
|
156
|
-
</svelte:element>
|
|
157
|
-
{/snippet}
|
|
158
|
-
|
|
159
127
|
{#if before}
|
|
160
128
|
{@render panes?.(context.state)}
|
|
161
129
|
{/if}
|
|
162
130
|
|
|
163
|
-
|
|
131
|
+
<svelte:element
|
|
132
|
+
this={containerTag}
|
|
133
|
+
bind:this={ref}
|
|
134
|
+
class:neo-tabs={true}
|
|
135
|
+
class:neo-inset={(elevation ?? 0) < 0}
|
|
136
|
+
class:neo-add={add}
|
|
137
|
+
class:neo-line={line}
|
|
138
|
+
class:neo-pill={pill}
|
|
139
|
+
class:neo-slide={slide}
|
|
140
|
+
class:neo-translate={translate}
|
|
141
|
+
class:neo-vertical={rest.vertical}
|
|
142
|
+
class:neo-rounded={rest.rounded}
|
|
143
|
+
class:neo-dim={dim}
|
|
144
|
+
style:--neo-tabs-slide-box-shadow={slideShadow}
|
|
145
|
+
{...containerRest}
|
|
146
|
+
use:useFn={useProps}
|
|
147
|
+
out:outFn={outProps}
|
|
148
|
+
in:inFn={inProps}
|
|
149
|
+
{style}
|
|
150
|
+
>
|
|
151
|
+
<NeoButtonGroup role="tablist" {pressed} {elevation} {...rest} class={['neo-tabs-group', rest.class]}>
|
|
152
|
+
{@render children?.(context.state)}
|
|
153
|
+
{#if add}
|
|
154
|
+
<div transition:transition={shortFreezeTransition}>
|
|
155
|
+
<NeoButton aria-label="Add new tab" onclick={onadd} {icon} />
|
|
156
|
+
</div>
|
|
157
|
+
{/if}
|
|
158
|
+
</NeoButtonGroup>
|
|
159
|
+
</svelte:element>
|
|
164
160
|
|
|
165
161
|
{#if !before}
|
|
166
162
|
{@render panes?.(context.state)}
|