@dvcol/neo-svelte 1.1.0 → 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 +15 -0
- package/dist/floating/portal/NeoPortalContainer.svelte +13 -2
- package/dist/floating/portal/neo-portail-container.model.d.ts +2 -2
- package/dist/inputs/NeoNativeSelect.svelte +2 -2
- package/dist/inputs/NeoPin.svelte +2 -2
- package/dist/inputs/NeoRange.svelte +1 -1
- package/dist/inputs/neo-select.model.d.ts +1 -0
- package/dist/loading/NeoLazy.svelte +2 -2
- package/dist/loading/NeoLoadingMatrix.svelte +13 -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/dist/progress/NeoProgressBar.svelte +1 -1
- package/dist/skeletons/NeoSkeletonText.svelte +2 -2
- package/dist/text/NeoMark.svelte +1 -1
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,21 @@
|
|
|
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
|
+
|
|
12
|
+
### [1.1.1](https://github.com/dvcol/neo-svelte/compare/v1.1.0...v1.1.1) (2025-04-21)
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
### Bug Fixes
|
|
16
|
+
|
|
17
|
+
* **lint:** bump deps & fix errors ([b349483](https://github.com/dvcol/neo-svelte/commit/b3494830f2c91586c3b9983e6d016b0fa853c226))
|
|
18
|
+
* **loading:** fix flex behavior ([6bbb288](https://github.com/dvcol/neo-svelte/commit/6bbb288c1e7dcfbd1575960801fdb67dd07c1d11))
|
|
19
|
+
|
|
5
20
|
## [1.1.0](https://github.com/dvcol/neo-svelte/compare/v1.0.1...v1.1.0) (2025-04-21)
|
|
6
21
|
|
|
7
22
|
|
|
@@ -15,6 +15,11 @@
|
|
|
15
15
|
id = `neo-portal-container-${getUUID()}`,
|
|
16
16
|
scale = true,
|
|
17
17
|
|
|
18
|
+
// Flex
|
|
19
|
+
justify,
|
|
20
|
+
align,
|
|
21
|
+
flex,
|
|
22
|
+
|
|
18
23
|
// Other Props
|
|
19
24
|
...rest
|
|
20
25
|
}: NeoPortalContainerProps = $props();
|
|
@@ -39,6 +44,9 @@
|
|
|
39
44
|
class:neo-portal-container={true}
|
|
40
45
|
class:neo-scale={scale}
|
|
41
46
|
class:neo-open={open}
|
|
47
|
+
style:flex
|
|
48
|
+
style:align-items={align}
|
|
49
|
+
style:justify-content={justify}
|
|
42
50
|
{id}
|
|
43
51
|
{...rest}
|
|
44
52
|
>
|
|
@@ -49,6 +57,9 @@
|
|
|
49
57
|
display: contents;
|
|
50
58
|
}
|
|
51
59
|
.neo-portal-container.neo-scale {
|
|
60
|
+
display: flex;
|
|
61
|
+
flex: 1 1 auto;
|
|
62
|
+
flex-direction: column;
|
|
52
63
|
transition-timing-function: var(--neo-portail-container-exit-timing, ease);
|
|
53
64
|
transition-duration: var(--neo-portail-container-exit-duration, 0.4s);
|
|
54
65
|
transition-property: scale, translate;
|
|
@@ -74,8 +85,8 @@
|
|
|
74
85
|
--neo-portail-container-enter-translate: calc(env(safe-area-inset-left) + 1rem);
|
|
75
86
|
}
|
|
76
87
|
.neo-portal-container.neo-scale.neo-open {
|
|
77
|
-
scale: var(--neo-portail-container-enter-scale, 0.98);
|
|
78
|
-
translate: var(--neo-portail-container-enter-translate, 0);
|
|
79
88
|
transition-timing-function: var(--neo-portail-container-enter-timing, ease);
|
|
80
89
|
transition-duration: var(--neo-portail-container-enter-duration, 0.4s);
|
|
90
|
+
scale: var(--neo-portail-container-enter-scale, 0.98);
|
|
91
|
+
translate: var(--neo-portail-container-enter-translate, 0);
|
|
81
92
|
}</style>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { HTMLNeoBaseElement, HTMLRefProps } from '../../utils/html-element.utils.js';
|
|
1
|
+
import type { HTMLFlexProps, HTMLNeoBaseElement, HTMLRefProps } from '../../utils/html-element.utils.js';
|
|
2
2
|
export type NeoPortalContainerProps<Tag extends keyof HTMLElementTagNameMap = 'div'> = {
|
|
3
3
|
/**
|
|
4
4
|
* The HTML tag to use for the container.
|
|
@@ -9,4 +9,4 @@ export type NeoPortalContainerProps<Tag extends keyof HTMLElementTagNameMap = 'd
|
|
|
9
9
|
* Whether to scale the container when a portal dialog is open.
|
|
10
10
|
*/
|
|
11
11
|
scale?: boolean;
|
|
12
|
-
} & HTMLNeoBaseElement<HTMLElementTagNameMap[Tag]> & HTMLRefProps<HTMLElementTagNameMap[Tag]
|
|
12
|
+
} & HTMLNeoBaseElement<HTMLElementTagNameMap[Tag]> & HTMLRefProps<HTMLElementTagNameMap[Tag]> & HTMLFlexProps;
|
|
@@ -82,8 +82,8 @@
|
|
|
82
82
|
{/snippet}
|
|
83
83
|
|
|
84
84
|
{#snippet content()}
|
|
85
|
-
{#each items as { label, ...option }}
|
|
86
|
-
<option {...option} value={option.value}>{label ?? option.value}</option>
|
|
85
|
+
{#each items as { id, label, ...option }, i (id ?? i)}
|
|
86
|
+
<option {id} {...option} value={option.value}>{label ?? option.value}</option>
|
|
87
87
|
{/each}
|
|
88
88
|
{@render children?.()}
|
|
89
89
|
{/snippet}
|
|
@@ -409,9 +409,9 @@
|
|
|
409
409
|
bind:value
|
|
410
410
|
oninvalid={onInvalid}
|
|
411
411
|
/>
|
|
412
|
-
{#each { length: Number(groups) } as _, i}
|
|
412
|
+
{#each { length: Number(groups) } as _, i (i)}
|
|
413
413
|
<div class="neo-pin-group">
|
|
414
|
-
{#each { length: Number(count) } as __, j}
|
|
414
|
+
{#each { length: Number(count) } as __, j (j)}
|
|
415
415
|
<NeoInput
|
|
416
416
|
bind:ref={refs[i][j]}
|
|
417
417
|
bind:value={values[i][j]}
|
|
@@ -516,7 +516,7 @@
|
|
|
516
516
|
<!-- handle after -->
|
|
517
517
|
</span>
|
|
518
518
|
{#if steps > 1}
|
|
519
|
-
{#each { length: (steps ?? 0) + 1 } as _, i}
|
|
519
|
+
{#each { length: (steps ?? 0) + 1 } as _, i (i)}
|
|
520
520
|
{#if showTick(i)}
|
|
521
521
|
{@const filled = isFilled(i)}
|
|
522
522
|
<div class="neo-range-tick" style:--neo-range-tick-index={i}>
|
|
@@ -7,6 +7,7 @@ import type { NeoListItemOrSection, NeoListSelectedItem } from '../list/neo-list
|
|
|
7
7
|
export type NeoNativeSelectOption<Value = unknown> = string | number | ({
|
|
8
8
|
value: Value;
|
|
9
9
|
label?: string | Snippet;
|
|
10
|
+
id?: string | number;
|
|
10
11
|
} & HTMLOptionAttributes);
|
|
11
12
|
export type NeoNativeSelectProps<Value = unknown> = {
|
|
12
13
|
/**
|
|
@@ -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}
|
|
@@ -31,10 +43,9 @@
|
|
|
31
43
|
|
|
32
44
|
<style>.neo-loading-matrix {
|
|
33
45
|
display: flex;
|
|
46
|
+
flex: 1 1 auto;
|
|
34
47
|
align-items: center;
|
|
35
48
|
justify-content: center;
|
|
36
|
-
width: 100%;
|
|
37
|
-
height: 100%;
|
|
38
49
|
opacity: 1;
|
|
39
50
|
transition: opacity 1s ease-in 0.2s;
|
|
40
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)}
|
|
@@ -145,7 +145,7 @@
|
|
|
145
145
|
{...containerRest}
|
|
146
146
|
>
|
|
147
147
|
<NeoProgress bind:ref bind:status bind:value bind:buffer {direction} {width} {height} {track} {...rest} />
|
|
148
|
-
{#each marks as position, index}
|
|
148
|
+
{#each marks as position, index (index)}
|
|
149
149
|
{#if position !== undefined}
|
|
150
150
|
<span bind:this={refs[index]} class="neo-progress-bar-mark" style:--neo-progress-bar-mark-position="{position}%">
|
|
151
151
|
{#if typeof mark === 'function'}
|
|
@@ -104,9 +104,9 @@
|
|
|
104
104
|
{/if}
|
|
105
105
|
|
|
106
106
|
{#if paragraphs && lines}
|
|
107
|
-
{#each Array.from({ length: Number(paragraphs) }) as _, i}
|
|
107
|
+
{#each Array.from({ length: Number(paragraphs) }) as _, i (i)}
|
|
108
108
|
<div class:neo-skeleton-text-paragraph={true} class:neo-alt={alt} class:neo-justify={justify} {...paragraphProps}>
|
|
109
|
-
{#each Array.from({ length: Number(Array.isArray(lines) ? lines[i] : lines) }) as __}
|
|
109
|
+
{#each Array.from({ length: Number(Array.isArray(lines) ? lines[i] : lines) }) as __, j (j)}
|
|
110
110
|
<div class="neo-skeleton-text-line" class:neo-alt={alt}> </div>
|
|
111
111
|
{/each}
|
|
112
112
|
</div>
|
package/dist/text/NeoMark.svelte
CHANGED
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
|
|
25
25
|
<svelte:element this={tag} class:neo-mark={true} {...rest}>
|
|
26
26
|
{#if parts?.length && parts?.at(0)?.mark}
|
|
27
|
-
{#each parts as { token, mark }}{token}{#if mark}<mark>{mark}</mark>{/if}{/each}
|
|
27
|
+
{#each parts as { token, mark }, i (i)}{token}{#if mark}<mark>{mark}</mark>{/if}{/each}
|
|
28
28
|
{:else}
|
|
29
29
|
{value}
|
|
30
30
|
{/if}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dvcol/neo-svelte",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.1.
|
|
4
|
+
"version": "1.1.2",
|
|
5
5
|
"description": "Neomorphic ui library for svelte 5",
|
|
6
6
|
"author": "dvcol",
|
|
7
7
|
"license": "MIT",
|
|
@@ -184,7 +184,7 @@
|
|
|
184
184
|
"devDependencies": {
|
|
185
185
|
"@commitlint/cli": "^19.8.0",
|
|
186
186
|
"@commitlint/config-conventional": "^19.8.0",
|
|
187
|
-
"@dvcol/eslint-config": "^1.
|
|
187
|
+
"@dvcol/eslint-config": "^1.6.0",
|
|
188
188
|
"@dvcol/stylelint-plugin-presets": "^2.1.2",
|
|
189
189
|
"@dvcol/svelte-simple-router": "^1.11.2",
|
|
190
190
|
"@prettier/plugin-xml": "^3.4.1",
|