noph-ui 0.35.0 → 0.37.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.
Files changed (91) hide show
  1. package/README.md +14 -13
  2. package/dist/autocomplete/AutoComplete.svelte +1 -1
  3. package/dist/autocomplete/AutoComplete.svelte.d.ts +1 -1
  4. package/dist/autocomplete/types.d.ts +1 -1
  5. package/dist/button/Button.svelte +1 -2
  6. package/dist/button/IconButton.svelte +1 -1
  7. package/dist/button/SegmentedButton.svelte +1 -1
  8. package/dist/card/Card.svelte +1 -1
  9. package/dist/checkbox/Checkbox.svelte +1 -1
  10. package/dist/chip/AssistChip.svelte +1 -1
  11. package/dist/chip/ChipSet.svelte +1 -1
  12. package/dist/chip/FilterChip.svelte +1 -1
  13. package/dist/chip/FilterChip.svelte.d.ts +1 -1
  14. package/dist/chip/InputChip.svelte +1 -3
  15. package/dist/chip/types.d.ts +1 -1
  16. package/dist/date-picker/Calendar.svelte +487 -0
  17. package/dist/date-picker/Calendar.svelte.d.ts +4 -0
  18. package/dist/date-picker/CalendarHeader.svelte +229 -0
  19. package/dist/date-picker/CalendarHeader.svelte.d.ts +27 -0
  20. package/dist/date-picker/DatePickerDialog.svelte +481 -0
  21. package/dist/date-picker/DatePickerDialog.svelte.d.ts +4 -0
  22. package/dist/date-picker/DateRangePicker.svelte +351 -0
  23. package/dist/date-picker/DateRangePicker.svelte.d.ts +4 -0
  24. package/dist/date-picker/DockedDatePicker.svelte +518 -5
  25. package/dist/date-picker/DockedDatePicker.svelte.d.ts +3 -17
  26. package/dist/date-picker/SelectionList.svelte +148 -0
  27. package/dist/date-picker/SelectionList.svelte.d.ts +14 -0
  28. package/dist/date-picker/YearGrid.svelte +195 -0
  29. package/dist/date-picker/YearGrid.svelte.d.ts +11 -0
  30. package/dist/date-picker/dateUtils.d.ts +41 -0
  31. package/dist/date-picker/dateUtils.js +153 -0
  32. package/dist/date-picker/enterAnimation.d.ts +1 -0
  33. package/dist/date-picker/enterAnimation.js +10 -0
  34. package/dist/date-picker/index.d.ts +6 -0
  35. package/dist/date-picker/index.js +6 -0
  36. package/dist/date-picker/types.d.ts +107 -0
  37. package/dist/date-picker/types.js +1 -0
  38. package/dist/dialog/Dialog.svelte +17 -12
  39. package/dist/dialog/types.d.ts +1 -1
  40. package/dist/divider/Divider.svelte +1 -1
  41. package/dist/icons/ArrowDropDownIcon.svelte +3 -0
  42. package/dist/icons/ArrowDropDownIcon.svelte.d.ts +26 -0
  43. package/dist/icons/ChevronLeftIcon.svelte +3 -0
  44. package/dist/icons/ChevronLeftIcon.svelte.d.ts +26 -0
  45. package/dist/icons/ChevronRightIcon.svelte +3 -0
  46. package/dist/icons/ChevronRightIcon.svelte.d.ts +26 -0
  47. package/dist/icons/EditCalendarIcon.svelte +5 -0
  48. package/dist/icons/EditCalendarIcon.svelte.d.ts +26 -0
  49. package/dist/icons/index.d.ts +5 -1
  50. package/dist/icons/index.js +5 -1
  51. package/dist/index.d.ts +2 -0
  52. package/dist/index.js +2 -0
  53. package/dist/list/Item.svelte +1 -1
  54. package/dist/list/List.svelte +1 -1
  55. package/dist/list/ListItem.svelte +1 -1
  56. package/dist/loading-indicator/LoadingIndicator.svelte +135 -0
  57. package/dist/loading-indicator/LoadingIndicator.svelte.d.ts +4 -0
  58. package/dist/loading-indicator/index.d.ts +1 -0
  59. package/dist/loading-indicator/index.js +1 -0
  60. package/dist/loading-indicator/shapes.d.ts +6 -0
  61. package/dist/loading-indicator/shapes.js +49 -0
  62. package/dist/loading-indicator/types.d.ts +7 -0
  63. package/dist/loading-indicator/types.js +1 -0
  64. package/dist/menu/Menu.svelte +3 -3
  65. package/dist/menu/MenuItem.svelte +1 -1
  66. package/dist/menu/types.d.ts +1 -1
  67. package/dist/navigation-drawer/NavigationDrawer.svelte +1 -1
  68. package/dist/navigation-drawer/NavigationDrawerItem.svelte +2 -2
  69. package/dist/navigation-rail/NavigationRail.svelte +1 -1
  70. package/dist/navigation-rail/NavigationRailItem.svelte +1 -1
  71. package/dist/progress/CircularProgress.svelte +1 -1
  72. package/dist/progress/LinearProgress.svelte +24 -7
  73. package/dist/radio/Radio.svelte +1 -1
  74. package/dist/ripple/Ripple.svelte +1 -1
  75. package/dist/select/Option.svelte +0 -1
  76. package/dist/select/Select.svelte +1 -1
  77. package/dist/select/Select.svelte.d.ts +1 -1
  78. package/dist/select/VirtualList.svelte +3 -4
  79. package/dist/slider/Slider.svelte +83 -19
  80. package/dist/slider/Slider.svelte.d.ts +1 -1
  81. package/dist/snackbar/Snackbar.svelte +3 -3
  82. package/dist/switch/Switch.svelte +1 -1
  83. package/dist/tabs/Tab.svelte +1 -1
  84. package/dist/tabs/Tabs.svelte +1 -1
  85. package/dist/tabs/Tabs.svelte.d.ts +1 -1
  86. package/dist/text-field/TextField.svelte +3 -3
  87. package/dist/text-field/TextField.svelte.d.ts +1 -1
  88. package/dist/tooltip/Tooltip.svelte +1 -1
  89. package/dist/types.d.ts +2 -0
  90. package/dist/types.js +23 -21
  91. package/package.json +14 -11
@@ -0,0 +1,26 @@
1
+ export default ChevronLeftIcon;
2
+ type ChevronLeftIcon = SvelteComponent<{
3
+ [x: string]: never;
4
+ }, {
5
+ [evt: string]: CustomEvent<any>;
6
+ }, {}> & {
7
+ $$bindings?: string | undefined;
8
+ };
9
+ declare const ChevronLeftIcon: $$__sveltets_2_IsomorphicComponent<{
10
+ [x: string]: never;
11
+ }, {
12
+ [evt: string]: CustomEvent<any>;
13
+ }, {}, {}, string>;
14
+ interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
15
+ new (options: import("svelte").ComponentConstructorOptions<Props>): import("svelte").SvelteComponent<Props, Events, Slots> & {
16
+ $$bindings?: Bindings;
17
+ } & Exports;
18
+ (internal: unknown, props: {
19
+ $$events?: Events;
20
+ $$slots?: Slots;
21
+ }): Exports & {
22
+ $set?: any;
23
+ $on?: any;
24
+ };
25
+ z_$$bindings?: Bindings;
26
+ }
@@ -0,0 +1,3 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 -960 960 960" width="24"
2
+ ><path d="M504-480 320-664l56-56 240 240-240 240-56-56 184-184Z" /></svg
3
+ >
@@ -0,0 +1,26 @@
1
+ export default ChevronRightIcon;
2
+ type ChevronRightIcon = SvelteComponent<{
3
+ [x: string]: never;
4
+ }, {
5
+ [evt: string]: CustomEvent<any>;
6
+ }, {}> & {
7
+ $$bindings?: string | undefined;
8
+ };
9
+ declare const ChevronRightIcon: $$__sveltets_2_IsomorphicComponent<{
10
+ [x: string]: never;
11
+ }, {
12
+ [evt: string]: CustomEvent<any>;
13
+ }, {}, {}, string>;
14
+ interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
15
+ new (options: import("svelte").ComponentConstructorOptions<Props>): import("svelte").SvelteComponent<Props, Events, Slots> & {
16
+ $$bindings?: Bindings;
17
+ } & Exports;
18
+ (internal: unknown, props: {
19
+ $$events?: Events;
20
+ $$slots?: Slots;
21
+ }): Exports & {
22
+ $set?: any;
23
+ $on?: any;
24
+ };
25
+ z_$$bindings?: Bindings;
26
+ }
@@ -0,0 +1,5 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 -960 960 960" width="24"
2
+ ><path
3
+ d="M200-80q-33 0-56.5-23.5T120-160v-560q0-33 23.5-56.5T200-800h40v-80h80v80h320v-80h80v80h40q33 0 56.5 23.5T840-720v200h-80v-40H200v400h280v80H200Zm0-560h560v-80H200v80Zm0 0v-80 80ZM560-80v-123l221-220q9-9 20-13t22-4q12 0 23 4.5t20 13.5l37 37q8 9 12.5 20t4.5 22q0 11-4 22.5T903-300L683-80H560Zm300-263-37-37 37 37ZM620-140h38l121-122-18-19-19-18-122 121v38Zm141-141-19-18 37 37-18-19Z"
4
+ /></svg
5
+ >
@@ -0,0 +1,26 @@
1
+ export default EditCalendarIcon;
2
+ type EditCalendarIcon = SvelteComponent<{
3
+ [x: string]: never;
4
+ }, {
5
+ [evt: string]: CustomEvent<any>;
6
+ }, {}> & {
7
+ $$bindings?: string | undefined;
8
+ };
9
+ declare const EditCalendarIcon: $$__sveltets_2_IsomorphicComponent<{
10
+ [x: string]: never;
11
+ }, {
12
+ [evt: string]: CustomEvent<any>;
13
+ }, {}, {}, string>;
14
+ interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
15
+ new (options: import("svelte").ComponentConstructorOptions<Props>): import("svelte").SvelteComponent<Props, Events, Slots> & {
16
+ $$bindings?: Bindings;
17
+ } & Exports;
18
+ (internal: unknown, props: {
19
+ $$events?: Events;
20
+ $$slots?: Slots;
21
+ }): Exports & {
22
+ $set?: any;
23
+ $on?: any;
24
+ };
25
+ z_$$bindings?: Bindings;
26
+ }
@@ -1,24 +1,28 @@
1
1
  export { default as AccountCircleIcon } from './AccountCircleIcon.svelte';
2
2
  export { default as ArrowBackIcon } from './ArrowBackIcon.svelte';
3
+ export { default as ArrowDropDownIcon } from './ArrowDropDownIcon.svelte';
3
4
  export { default as ArrowForwardIcon } from './ArrowForwardIcon.svelte';
4
5
  export { default as BreakingNewsIcon } from './BreakingNewsIcon.svelte';
5
6
  export { default as BrightnessMediumIcon } from './BrightnessMediumIcon.svelte';
6
7
  export { default as CalendarToday } from './CalendarToday.svelte';
7
8
  export { default as ChatIcon } from './ChatIcon.svelte';
8
9
  export { default as CheckIcon } from './CheckIcon.svelte';
10
+ export { default as ChevronLeftIcon } from './ChevronLeftIcon.svelte';
11
+ export { default as ChevronRightIcon } from './ChevronRightIcon.svelte';
9
12
  export { default as CloseIcon } from './CloseIcon.svelte';
10
13
  export { default as DarkModeIcon } from './DarkModeIcon.svelte';
11
14
  export { default as DashboardIcon } from './DashboardIcon.svelte';
12
15
  export { default as DownloadIcon } from './DownloadIcon.svelte';
16
+ export { default as EditCalendarIcon } from './EditCalendarIcon.svelte';
13
17
  export { default as ErrorIcon } from './ErrorIcon.svelte';
14
18
  export { default as GroupsIcon } from './GroupsIcon.svelte';
15
19
  export { default as LanguageIcon } from './LanguageIcon.svelte';
16
20
  export { default as LightModeIcon } from './LightModeIcon.svelte';
17
21
  export { default as MenuIcon } from './MenuIcon.svelte';
18
22
  export { default as OpenInNewIcon } from './OpenInNewIcon.svelte';
23
+ export { default as SearchIcon } from './SearchIcon.svelte';
19
24
  export { default as SendIcon } from './SendIcon.svelte';
20
25
  export { default as SportsGymnasticsIcon } from './SportsGymnasticsIcon.svelte';
21
- export { default as SearchIcon } from './SearchIcon.svelte';
22
26
  export { default as VisibilityIcon } from './VisibilityIcon.svelte';
23
27
  export { default as VisibilityOffIcon } from './VisibilityOffIcon.svelte';
24
28
  export { default as Icon } from './Icon.svelte';
@@ -1,24 +1,28 @@
1
1
  export { default as AccountCircleIcon } from './AccountCircleIcon.svelte';
2
2
  export { default as ArrowBackIcon } from './ArrowBackIcon.svelte';
3
+ export { default as ArrowDropDownIcon } from './ArrowDropDownIcon.svelte';
3
4
  export { default as ArrowForwardIcon } from './ArrowForwardIcon.svelte';
4
5
  export { default as BreakingNewsIcon } from './BreakingNewsIcon.svelte';
5
6
  export { default as BrightnessMediumIcon } from './BrightnessMediumIcon.svelte';
6
7
  export { default as CalendarToday } from './CalendarToday.svelte';
7
8
  export { default as ChatIcon } from './ChatIcon.svelte';
8
9
  export { default as CheckIcon } from './CheckIcon.svelte';
10
+ export { default as ChevronLeftIcon } from './ChevronLeftIcon.svelte';
11
+ export { default as ChevronRightIcon } from './ChevronRightIcon.svelte';
9
12
  export { default as CloseIcon } from './CloseIcon.svelte';
10
13
  export { default as DarkModeIcon } from './DarkModeIcon.svelte';
11
14
  export { default as DashboardIcon } from './DashboardIcon.svelte';
12
15
  export { default as DownloadIcon } from './DownloadIcon.svelte';
16
+ export { default as EditCalendarIcon } from './EditCalendarIcon.svelte';
13
17
  export { default as ErrorIcon } from './ErrorIcon.svelte';
14
18
  export { default as GroupsIcon } from './GroupsIcon.svelte';
15
19
  export { default as LanguageIcon } from './LanguageIcon.svelte';
16
20
  export { default as LightModeIcon } from './LightModeIcon.svelte';
17
21
  export { default as MenuIcon } from './MenuIcon.svelte';
18
22
  export { default as OpenInNewIcon } from './OpenInNewIcon.svelte';
23
+ export { default as SearchIcon } from './SearchIcon.svelte';
19
24
  export { default as SendIcon } from './SendIcon.svelte';
20
25
  export { default as SportsGymnasticsIcon } from './SportsGymnasticsIcon.svelte';
21
- export { default as SearchIcon } from './SearchIcon.svelte';
22
26
  export { default as VisibilityIcon } from './VisibilityIcon.svelte';
23
27
  export { default as VisibilityOffIcon } from './VisibilityOffIcon.svelte';
24
28
  export { default as Icon } from './Icon.svelte';
package/dist/index.d.ts CHANGED
@@ -4,9 +4,11 @@ export * from './button/index.js';
4
4
  export * from './card/index.js';
5
5
  export * from './checkbox/index.js';
6
6
  export * from './chip/index.js';
7
+ export * from './date-picker/index.js';
7
8
  export * from './dialog/index.js';
8
9
  export * from './divider/index.js';
9
10
  export * from './list/index.js';
11
+ export * from './loading-indicator/index.js';
10
12
  export * from './menu/index.js';
11
13
  export * from './navigation-drawer/index.js';
12
14
  export * from './navigation-rail/index.js';
package/dist/index.js CHANGED
@@ -4,9 +4,11 @@ export * from './button/index.js';
4
4
  export * from './card/index.js';
5
5
  export * from './checkbox/index.js';
6
6
  export * from './chip/index.js';
7
+ export * from './date-picker/index.js';
7
8
  export * from './dialog/index.js';
8
9
  export * from './divider/index.js';
9
10
  export * from './list/index.js';
11
+ export * from './loading-indicator/index.js';
10
12
  export * from './menu/index.js';
11
13
  export * from './navigation-drawer/index.js';
12
14
  export * from './navigation-rail/index.js';
@@ -1,6 +1,6 @@
1
1
  <script lang="ts">
2
2
  import Ripple from '../ripple/Ripple.svelte'
3
- import type { ItemProps } from './types.ts'
3
+ import type { ItemProps } from './types.js'
4
4
 
5
5
  let {
6
6
  selected = false,
@@ -1,5 +1,5 @@
1
1
  <script lang="ts">
2
- import type { ListProps } from './types.ts'
2
+ import type { ListProps } from './types.js'
3
3
 
4
4
  let { element = $bindable(), children, ...attributes }: ListProps = $props()
5
5
  </script>
@@ -1,6 +1,6 @@
1
1
  <script lang="ts">
2
2
  import Item from './Item.svelte'
3
- import type { ListItemProps } from './types.ts'
3
+ import type { ListItemProps } from './types.js'
4
4
 
5
5
  let { ...attributes }: ListItemProps = $props()
6
6
  </script>
@@ -0,0 +1,135 @@
1
+ <script lang="ts">
2
+ import {
3
+ DETERMINATE_SCALE,
4
+ DETERMINATE_SHAPES,
5
+ INDETERMINATE_SCALE,
6
+ INDETERMINATE_SHAPES,
7
+ VIEWBOX,
8
+ outlinePath,
9
+ } from './shapes.js'
10
+ import type { LoadingIndicatorProps } from './types.js'
11
+
12
+ let {
13
+ value = 0,
14
+ max = 1,
15
+ indeterminate = false,
16
+ contained = false,
17
+ ...attributes
18
+ }: LoadingIndicatorProps = $props()
19
+
20
+ const MORPH_DURATION = 650
21
+ const ROTATION_DURATION = 4666
22
+ const QUARTER_TURN = 90
23
+ const CENTER = VIEWBOX / 2
24
+ const DAMPING_RATIO = 0.6
25
+ const NATURAL_FREQUENCY = Math.sqrt(200)
26
+ const DAMPED_FREQUENCY = NATURAL_FREQUENCY * Math.sqrt(1 - DAMPING_RATIO * DAMPING_RATIO)
27
+ const springValue = (seconds: number) =>
28
+ 1 -
29
+ Math.exp(-DAMPING_RATIO * NATURAL_FREQUENCY * seconds) *
30
+ (Math.cos(DAMPED_FREQUENCY * seconds) +
31
+ ((DAMPING_RATIO * NATURAL_FREQUENCY) / DAMPED_FREQUENCY) *
32
+ Math.sin(DAMPED_FREQUENCY * seconds))
33
+
34
+ const clamp = (n: number) => (n > 0 ? Math.min(n, 1) : 0)
35
+ const rotate = (degrees: number) => `rotate(${(degrees % 360).toFixed(2)} ${CENTER} ${CENTER})`
36
+
37
+ const initialPath = outlinePath(
38
+ INDETERMINATE_SHAPES[0],
39
+ INDETERMINATE_SHAPES[1],
40
+ 0,
41
+ INDETERMINATE_SCALE,
42
+ )
43
+
44
+ let progress = $derived(clamp(value / max))
45
+ let determinatePath = $derived(
46
+ outlinePath(DETERMINATE_SHAPES[0], DETERMINATE_SHAPES[1], progress, DETERMINATE_SCALE),
47
+ )
48
+
49
+ let indicator = $state<SVGPathElement>()
50
+
51
+ $effect(() => {
52
+ if (!indicator) return
53
+ const path = indicator
54
+ const start = performance.now()
55
+ let raf = 0
56
+ const frame = (now: number) => {
57
+ raf = requestAnimationFrame(frame)
58
+ const elapsed = Math.max(0, now - start)
59
+ const index = Math.floor(elapsed / MORPH_DURATION)
60
+ const morph = springValue((elapsed % MORPH_DURATION) / 1000)
61
+ path.setAttribute(
62
+ 'd',
63
+ outlinePath(
64
+ INDETERMINATE_SHAPES[index % INDETERMINATE_SHAPES.length],
65
+ INDETERMINATE_SHAPES[(index + 1) % INDETERMINATE_SHAPES.length],
66
+ clamp(morph),
67
+ INDETERMINATE_SCALE,
68
+ ),
69
+ )
70
+ path.setAttribute(
71
+ 'transform',
72
+ rotate((elapsed / ROTATION_DURATION) * 360 + (index + morph) * QUARTER_TURN),
73
+ )
74
+ }
75
+ raf = requestAnimationFrame(frame)
76
+ return () => cancelAnimationFrame(raf)
77
+ })
78
+ </script>
79
+
80
+ <div
81
+ {...attributes}
82
+ class={['np-loading-indicator', contained && 'contained']}
83
+ role="progressbar"
84
+ aria-valuemin="0"
85
+ aria-valuemax={max}
86
+ aria-valuenow={indeterminate ? undefined : value}
87
+ >
88
+ <svg viewBox="0 0 {VIEWBOX} {VIEWBOX}" aria-hidden="true">
89
+ {#if indeterminate}
90
+ <path bind:this={indicator} class="indicator" d={initialPath}></path>
91
+ {:else}
92
+ <path class="indicator" d={determinatePath} transform={rotate(-progress * 180)}></path>
93
+ {/if}
94
+ </svg>
95
+ </div>
96
+
97
+ <style>
98
+ .np-loading-indicator {
99
+ all: unset;
100
+ --_color: var(--np-color-primary);
101
+ display: inline-flex;
102
+ vertical-align: middle;
103
+ align-items: center;
104
+ justify-content: center;
105
+ inline-size: var(--np-loading-indicator-size, 3rem);
106
+ block-size: var(--np-loading-indicator-size, 3rem);
107
+ border-radius: var(--np-shape-corner-full);
108
+ contain: strict;
109
+ content-visibility: auto;
110
+ }
111
+
112
+ .contained {
113
+ --_color: var(--np-color-on-primary-container);
114
+ background-color: var(
115
+ --np-loading-indicator-container-color,
116
+ var(--np-color-primary-container)
117
+ );
118
+ }
119
+
120
+ svg {
121
+ display: block;
122
+ inline-size: 100%;
123
+ block-size: 100%;
124
+ }
125
+
126
+ .indicator {
127
+ fill: var(--np-loading-indicator-color, var(--_color));
128
+ }
129
+
130
+ @media (forced-colors: active) {
131
+ .indicator {
132
+ fill: CanvasText;
133
+ }
134
+ }
135
+ </style>
@@ -0,0 +1,4 @@
1
+ import type { LoadingIndicatorProps } from './types.ts';
2
+ declare const LoadingIndicator: import("svelte").Component<LoadingIndicatorProps, {}, "">;
3
+ type LoadingIndicator = ReturnType<typeof LoadingIndicator>;
4
+ export default LoadingIndicator;
@@ -0,0 +1 @@
1
+ export { default as LoadingIndicator } from './LoadingIndicator.svelte';
@@ -0,0 +1 @@
1
+ export { default as LoadingIndicator } from './LoadingIndicator.svelte';
@@ -0,0 +1,6 @@
1
+ export declare const INDETERMINATE_SHAPES: number[][];
2
+ export declare const DETERMINATE_SHAPES: number[][];
3
+ export declare const INDETERMINATE_SCALE = 0.6853;
4
+ export declare const DETERMINATE_SCALE = 0.7917;
5
+ export declare const VIEWBOX = 48;
6
+ export declare const outlinePath: (from: number[], to: number[], progress: number, scale: number) => string;
@@ -0,0 +1,49 @@
1
+ const SAMPLE_COUNT = 128;
2
+ const decode = (encoded) => {
3
+ const radii = [];
4
+ for (let i = 0; i < SAMPLE_COUNT; i++) {
5
+ radii.push(parseInt(encoded.slice(i * 3, i * 3 + 3), 36) / 10000);
6
+ }
7
+ return radii;
8
+ };
9
+ export const INDETERMINATE_SHAPES = [
10
+ // MaterialShapes.SoftBurst
11
+ '2zl30r3533bb3ik3pq3se3s33oh3gs39u33v30a2zn31b3693co3k53qk3sk3ro3n53fb38k32t2zz2zr32037h3e23ls3r83sm3r43lj3dv37c31y2zr30032w38p3fi3ne3rq3sj3qf3jw3ch3653192zm30b33y39z3h03oo3s53sd3pk3ib3b534z30q2zl30r3533bb3ik3pq3se3s33oh3gs39u33v30a2zn31b3693co3k53qk3sk3ro3n53fb38k32t2zz2zr32037h3e23ls3r83sm3r43lj3dv37c31y2zr30032w38p3fi3ne3rq3sj3qf3jw3ch3653192zm30b33y39z3h03oo3s53sd3pk3ib3b534z30q',
12
+ // MaterialShapes.Cookie9Sided
13
+ '3ne3kp3hr3g53fr3gl3iq3m33ot3qq3rw3sa3rz3qx3p33mg3jc3hi3gz3hn3jn3my3pp3rn3st3t73sv3rs3pw3n73jz3i23hg3i23jz3n73pw3rs3sv3t73st3rn3pp3my3jn3hn3gz3hi3jc3mg3p33qx3rz3sa3rw3qq3ot3m33iq3gl3fr3g53hr3kp3ne3pb3qg3qw3qm3pm3nv3lc3i13fk3eg3ei3fr3ie3lc3nh3ov3pk3pk3ou3ne3l83i93fb3dr3df3e83gb3jh3lz3nr3os3p53os3nr3lz3jh3gb3e83df3dr3fb3i93l83ne3ou3pk3pk3ov3nh3lc3ie3fr3ei3eg3fk3i13lc3nv3pm3qm3qw3qg3pb',
14
+ // MaterialShapes.Pentagon
15
+ '3ng3lh3jw3im3ho3h23gq3gq3h03hl3ih3jp3l93n63ph3s73vc3y23zz41241e40z3zr3xr3uz3se3q73od3mx3lt3l13kk3kf3kk3l13lt3mx3od3q73se3uz3xr3zr40z41e4123zz3y23vc3s73ph3n63l93jp3ih3hl3h03gq3gq3h23ho3im3jw3lh3ng3pp3rf3se3sp3sb3r93pg3mx3jm3gc3dh3b138z37935u34r33x33e33533533f33y34s35w37b3913b43df3f93gk3hb3hl3hb3gk3f93df3b439137b35w34s33y33f33533533e33x34r35u37938z3b13dh3gc3jm3mx3pg3r93sb3sp3se3rf3pp',
16
+ // MaterialShapes.Pill
17
+ '3t53rz3qr3pj3o93mz3lo3kd3j13hp3gd3f13dq3cp3by3bj3be3bj3by3cp3dq3f13gd3hp3j13kd3lo3mz3o93pj3qr3rz3t53ua3vd3wc3wu3xm3yg3z83zx40k41341j41x42842f42k42l42k42f42841x41j41340k3zx3z83yg3xm3wu3wc3vd3ua3t53rz3qr3pj3o93mz3lo3kd3j13hp3gd3f13dq3cp3by3bj3be3bj3by3cp3dq3f13gd3hp3j13kd3lo3mz3o93pj3qr3rz3t53ua3vd3wc3wu3xm3yg3z83zx40k41341j41x42842f42k42l42k42f42841x41j41340k3zx3z83yg3xm3wu3wc3vd3ua',
18
+ // MaterialShapes.Sunny
19
+ '3t63sa3pe3l73hi3ea3bj3973893973bj3ea3hi3l73pe3sa3t63sa3pe3l73hi3ea3bj3973893973bj3ea3hi3l73pe3sa3t63sa3pe3l73hi3ea3bj3973893973bj3ea3hi3l73pe3sa3t63sa3pe3l73hi3ea3bj3973893973bj3ea3hi3l73pe3sa3t63sa3pe3l73hi3ea3bj3973893973bj3ea3hi3l73pe3sa3t63sa3pe3l73hi3ea3bj3973893973bj3ea3hi3l73pe3sa3t63sa3pe3l73hi3ea3bj3973893973bj3ea3hi3l73pe3sa3t63sa3pe3l73hi3ea3bj3973893973bj3ea3hi3l73pe3sa',
20
+ // MaterialShapes.Cookie4Sided
21
+ '2yr2z530a32b35g39l3ea3iv3mz3qk3tm3w53y73zr40v41j41r41i40u3zr3y63w43tk3qi3mw3it3e739j35f32a3092z42yr2z530a32b35g39l3ea3iv3mz3qk3tm3w53y73zr40v41j41r41i40u3zr3y63w43tk3qi3mw3it3e739j35f32a3092z42yr2z530a32b35g39l3ea3iv3mz3qk3tm3w53y73zr40v41j41r41i40u3zr3y63w43tk3qi3mw3it3e739j35f32a3092z42yr2z530a32b35g39l3ea3iv3mz3qk3tm3w53y73zr40v41j41r41i40u3zr3y63w43tk3qi3mw3it3e739j35f32a3092z4',
22
+ // MaterialShapes.Oval
23
+ '3ec3bw39m37i35k33s32630q2zg2yb2xc2wj2vv2vd2uz2ur2up2ur2uz2vd2vv2wj2xc2yb2zg30q32633s35k37i39m3bw3ec3gx3jn3mi3ph3sj3vn3yr41t44r47j4a14c84e14fd4g64gg4g64fd4e14c84a147j44r41t3yr3vn3sj3ph3mi3jn3gx3ec3bw39m37i35k33s32630q2zg2yb2xc2wj2vv2vd2uz2ur2up2ur2uz2vd2vv2wj2xc2yb2zg30q32633s35k37i39m3bw3ec3gx3jn3mi3ph3sj3vn3yr41t44r47j4a14c84e14fd4g64gg4g64fd4e14c84a147j44r41t3yr3vn3sj3ph3mi3jn3gx',
24
+ ].map(decode);
25
+ export const DETERMINATE_SHAPES = [
26
+ // MaterialShapes.Circle
27
+ '3so3so3so3so3so3so3so3so3so3so3so3so3so3so3so3so3so3so3so3so3so3so3so3so3so3so3so3so3so3so3so3so3so3so3so3so3so3so3so3so3so3so3so3so3so3so3so3so3so3so3so3so3so3so3so3so3so3so3so3so3so3so3so3so3so3so3so3so3so3so3so3so3so3so3so3so3so3so3so3so3so3so3so3so3so3so3so3so3so3so3so3so3so3so3so3so3so3so3so3so3so3so3so3so3so3so3so3so3so3so3so3so3so3so3so3so3so3so3so3so3so3so3so3so3so3so3so3so',
28
+ // MaterialShapes.SoftBurst
29
+ '2zl30r3533bb3ik3pq3se3s33oh3gs39u33v30a2zn31b3693co3k53qk3sk3ro3n53fb38k32t2zz2zr32037h3e23ls3r83sm3r43lj3dv37c31y2zr30032w38p3fi3ne3rq3sj3qf3jw3ch3653192zm30b33y39z3h03oo3s53sd3pk3ib3b534z30q2zl30r3533bb3ik3pq3se3s33oh3gs39u33v30a2zn31b3693co3k53qk3sk3ro3n53fb38k32t2zz2zr32037h3e23ls3r83sm3r43lj3dv37c31y2zr30032w38p3fi3ne3rq3sj3qf3jw3ch3653192zm30b33y39z3h03oo3s53sd3pk3ib3b534z30q',
30
+ ].map(decode);
31
+ export const INDETERMINATE_SCALE = 0.6853;
32
+ export const DETERMINATE_SCALE = 0.7917;
33
+ export const VIEWBOX = 48;
34
+ const CENTER = VIEWBOX / 2;
35
+ const COS = Array.from({ length: SAMPLE_COUNT }, (_, i) => Math.cos((2 * Math.PI * i) / SAMPLE_COUNT));
36
+ const SIN = Array.from({ length: SAMPLE_COUNT }, (_, i) => Math.sin((2 * Math.PI * i) / SAMPLE_COUNT));
37
+ export const outlinePath = (from, to, progress, scale) => {
38
+ const size = VIEWBOX * scale;
39
+ let d = '';
40
+ for (let i = 0; i < SAMPLE_COUNT; i++) {
41
+ const radius = (from[i] + (to[i] - from[i]) * progress) * size;
42
+ d +=
43
+ (i === 0 ? 'M' : 'L') +
44
+ (CENTER + radius * COS[i]).toFixed(2) +
45
+ ',' +
46
+ (CENTER + radius * SIN[i]).toFixed(2);
47
+ }
48
+ return d + 'Z';
49
+ };
@@ -0,0 +1,7 @@
1
+ export interface LoadingIndicatorProps {
2
+ value?: number;
3
+ max?: number;
4
+ indeterminate?: boolean;
5
+ contained?: boolean;
6
+ 'aria-label'?: string | undefined | null;
7
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -1,6 +1,6 @@
1
1
  <script lang="ts">
2
2
  import { arrowKeyNav, rovingTabindex } from '../keyboard-nav.js'
3
- import type { MenuProps } from './types.ts'
3
+ import type { MenuProps } from './types.js'
4
4
  import { on } from 'svelte/events'
5
5
 
6
6
  const MENU_ITEM_SELECTOR = '[role="menuitem"]'
@@ -22,11 +22,11 @@
22
22
  let clientHeight = $state(0)
23
23
  let innerHeight = $state(0)
24
24
 
25
- export function showPopover() {
25
+ export const showPopover = () => {
26
26
  element?.showPopover()
27
27
  }
28
28
 
29
- export function hidePopover() {
29
+ export const hidePopover = () => {
30
30
  element?.hidePopover()
31
31
  }
32
32
  const refreshValues = () => {
@@ -1,6 +1,6 @@
1
1
  <script lang="ts">
2
2
  import Item from '../list/Item.svelte'
3
- import type { MenuItemProps } from './types.ts'
3
+ import type { MenuItemProps } from './types.js'
4
4
 
5
5
  let { ...attributes }: MenuItemProps = $props()
6
6
  </script>
@@ -1,4 +1,4 @@
1
- import type { ItemProps } from '../list/types.ts';
1
+ import type { ItemProps } from '../list/types.js';
2
2
  import type { Snippet } from 'svelte';
3
3
  import type { HTMLAttributes } from 'svelte/elements';
4
4
  export interface MenuProps extends HTMLAttributes<HTMLDivElement> {
@@ -1,6 +1,6 @@
1
1
  <script lang="ts">
2
2
  import { arrowKeyNav, rovingTabindex } from '../keyboard-nav.js'
3
- import type { NavigationDrawerProps } from './types.ts'
3
+ import type { NavigationDrawerProps } from './types.js'
4
4
  let {
5
5
  modal = false,
6
6
  backdrop = false,
@@ -1,7 +1,7 @@
1
1
  <script lang="ts">
2
2
  import Ripple from '../ripple/Ripple.svelte'
3
3
  import type { HTMLButtonAttributes } from 'svelte/elements'
4
- import type { NavigationDrawerItemProps } from './types.ts'
4
+ import type { NavigationDrawerItemProps } from './types.js'
5
5
 
6
6
  let {
7
7
  selected = false,
@@ -86,7 +86,7 @@
86
86
  transition-property: transform, opacity;
87
87
  transition-timing-function: linear;
88
88
  background-color: var(--np-color-secondary-container);
89
- border-radius: var(--np-shape-corner-full);
89
+ border-radius: var(--np-navigation-drawer-item-container-shape, var(--np-shape-corner-full));
90
90
  z-index: -1;
91
91
  }
92
92
 
@@ -1,6 +1,6 @@
1
1
  <script lang="ts">
2
2
  import { arrowKeyNav, rovingTabindex } from '../keyboard-nav.js'
3
- import type { NavigationRailProps } from './types.ts'
3
+ import type { NavigationRailProps } from './types.js'
4
4
 
5
5
  let { children, onkeydown: userKeydown, ...attributes }: NavigationRailProps = $props()
6
6
 
@@ -1,7 +1,7 @@
1
1
  <script lang="ts">
2
2
  import Ripple from '../ripple/Ripple.svelte'
3
3
  import type { HTMLButtonAttributes } from 'svelte/elements'
4
- import type { NavigationRailItemProps } from './types.ts'
4
+ import type { NavigationRailItemProps } from './types.js'
5
5
 
6
6
  let { selected, icon, label, ...attributes }: NavigationRailItemProps = $props()
7
7
  let touchEl: HTMLSpanElement | undefined = $state()
@@ -1,6 +1,6 @@
1
1
  <script lang="ts">
2
2
  import { MediaQuery } from 'svelte/reactivity'
3
- import type { CircularProgressProps } from './types.ts'
3
+ import type { CircularProgressProps } from './types.js'
4
4
 
5
5
  let {
6
6
  value = 0,
@@ -1,6 +1,6 @@
1
1
  <script lang="ts">
2
2
  import { MediaQuery } from 'svelte/reactivity'
3
- import type { LinearProgressProps } from './types.ts'
3
+ import type { LinearProgressProps } from './types.js'
4
4
 
5
5
  let {
6
6
  value = 0,
@@ -22,9 +22,8 @@
22
22
  let wave = $derived(wavy && !reducedMotion.current)
23
23
 
24
24
  let wavelength = $derived(indeterminate ? INDETERMINATE_WAVELENGTH : DETERMINATE_WAVELENGTH)
25
- let amplitude = $derived(
26
- !wave ? 0 : indeterminate || (value / max > 0.1 && value / max < 0.95) ? 1 : 0,
27
- )
25
+ const amplitudeFor = (fraction: number) =>
26
+ !wave ? 0 : indeterminate || (fraction > 0.1 && fraction < 0.95) ? 1 : 0
28
27
 
29
28
  const cubicBezier = (x1: number, y1: number, x2: number, y2: number) => {
30
29
  const A = (a: number, b: number) => 1 - 3 * b + 3 * a
@@ -112,6 +111,10 @@
112
111
  const len = wavelength
113
112
  const width = containerWidth
114
113
  const host = wavePathA?.closest('.progress') as HTMLElement | null
114
+ // Live declaration: --np-lp-percent is a registered custom property that carries
115
+ // the same transition as the track, so reading it each frame gives the wave the
116
+ // eased position instead of jumping straight to the new value.
117
+ const hostStyles = host && getComputedStyle(host)
115
118
  let raf = 0
116
119
  let last = 0
117
120
  const frame = (now: number) => {
@@ -119,7 +122,12 @@
119
122
  const dt = last ? Math.min(64, now - last) : 16
120
123
  last = now
121
124
  const phase = ((now / 1000) % 1) * len
122
- renderedAmplitude += (amplitude - renderedAmplitude) * Math.min(1, dt / 500)
125
+ const eased =
126
+ hostStyles && !indeterminate
127
+ ? parseFloat(hostStyles.getPropertyValue('--np-lp-percent'))
128
+ : percent
129
+ const shown = Number.isFinite(eased) ? eased : percent
130
+ renderedAmplitude += (amplitudeFor(shown / 100) - renderedAmplitude) * Math.min(1, dt / 500)
123
131
  const wave = buildWave(width, len, renderedAmplitude, phase)
124
132
  if (indeterminate) {
125
133
  const t = now % CYCLE
@@ -131,7 +139,7 @@
131
139
  trim(wavePathA, wave, t1 * width, h1 * width)
132
140
  trim(wavePathB, wave, t2 * width, h2 * width)
133
141
  } else {
134
- trim(wavePathA, wave, 0, (percent / 100) * width)
142
+ trim(wavePathA, wave, 0, (shown / 100) * width)
135
143
  }
136
144
  }
137
145
  raf = requestAnimationFrame(frame)
@@ -148,7 +156,7 @@
148
156
  let gapOn = $derived(percent > 0 ? 1 : 0)
149
157
 
150
158
  let trackStyles = $derived(
151
- `--_percent:${percent}%;--_buffer-percent:${bufferPercent}%;--_gap-on:${gapOn}`,
159
+ `--_percent:${percent}%;--np-lp-percent:${percent}%;--_buffer-percent:${bufferPercent}%;--_gap-on:${gapOn}`,
152
160
  )
153
161
 
154
162
  let hideDots = $derived(indeterminate || !hasBuffer || bufferValue >= max || value >= max)
@@ -328,6 +336,15 @@
328
336
  inherits: true;
329
337
  initial-value: 0%;
330
338
  }
339
+ @property --np-lp-percent {
340
+ syntax: '<percentage>';
341
+ inherits: true;
342
+ initial-value: 0%;
343
+ }
344
+
345
+ .progress.wavy:not(.indeterminate) {
346
+ transition: --np-lp-percent var(--np-motion-expressive-default-effects);
347
+ }
331
348
 
332
349
  .progress.indeterminate {
333
350
  animation:
@@ -1,6 +1,6 @@
1
1
  <script lang="ts">
2
2
  import Ripple from '../ripple/Ripple.svelte'
3
- import type { RadioProps } from './types.ts'
3
+ import type { RadioProps } from './types.js'
4
4
 
5
5
  let {
6
6
  checked,
@@ -1,6 +1,6 @@
1
1
  <script lang="ts">
2
2
  import { on } from 'svelte/events'
3
- import type { RippleProps } from './types.ts'
3
+ import type { RippleProps } from './types.js'
4
4
 
5
5
  let {
6
6
  forceHover = false,
@@ -30,7 +30,6 @@
30
30
  padding: 0.5rem 1rem;
31
31
  gap: 0.75rem;
32
32
  height: 2rem;
33
- background: var(--np-surface);
34
33
  align-items: center;
35
34
 
36
35
  &:checked {
@@ -4,7 +4,7 @@
4
4
  import Check from './Check.svelte'
5
5
  import VirtualList from './VirtualList.svelte'
6
6
  import { tick } from 'svelte'
7
- import type { SelectOption, SelectProps } from './types.ts'
7
+ import type { SelectOption, SelectProps } from './types.js'
8
8
 
9
9
  let {
10
10
  options = [],
@@ -1,4 +1,4 @@
1
1
  import type { SelectProps } from './types.ts';
2
- declare const Select: import("svelte").Component<SelectProps, {}, "element" | "value">;
2
+ declare const Select: import("svelte").Component<SelectProps, {}, "value" | "element">;
3
3
  type Select = ReturnType<typeof Select>;
4
4
  export default Select;