@diegopluna/narvi 0.3.8 → 0.3.9

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.
@@ -7,9 +7,17 @@
7
7
  import { colors, play } from '../../tokens.stylex.js';
8
8
  import { media } from '../../media.stylex.js';
9
9
 
10
+ /**
11
+ * The colour of the band. `neutral`, the default, is the text's own colour passing over
12
+ * quieter letters; `accent` is a band of the accent, for the one thing that is live.
13
+ */
14
+ export type ShimmerTone = 'neutral' | 'accent';
15
+
10
16
  export type ShimmerProps = Omit<HTMLAttributes<HTMLSpanElement>, 'children'> & {
11
17
  /** Turn it off to show the text plainly, for example once the work is done. */
12
18
  active?: boolean | undefined;
19
+ /** The colour of the band that passes over the letters. */
20
+ tone?: ShimmerTone | undefined;
13
21
  sx?: Sx | undefined;
14
22
  children?: Snippet | undefined;
15
23
  };
@@ -35,18 +43,13 @@
35
43
  base: {
36
44
  display: 'inline'
37
45
  },
38
- // The letters are only half there until a band of the accent passes over them
46
+ // The letters are only half there until a band of light passes over them
39
47
  active: {
40
48
  color: {
41
49
  default: 'transparent',
42
50
  [media.reducedMotion]: colors.textMuted,
43
51
  [media.forcedColors]: 'CanvasText'
44
52
  },
45
- backgroundImage: {
46
- default: `linear-gradient(90deg, ${colors.textSubtle} 0%, ${colors.textSubtle} 40%, ${colors.accent} 50%, ${colors.textSubtle} 60%, ${colors.textSubtle} 100%)`,
47
- [media.reducedMotion]: 'none',
48
- [media.forcedColors]: 'none'
49
- },
50
53
  backgroundSize: '300% 100%',
51
54
  backgroundClip: 'text',
52
55
  WebkitBackgroundClip: 'text',
@@ -62,19 +65,42 @@
62
65
  animationTimingFunction: { default: 'steps(30)', [media.reducedMotion]: 'steps(12)' },
63
66
  animationIterationCount: 'infinite',
64
67
  animationPlayState: play.whileVisible
68
+ },
69
+ // The band: the text's own colour over its quieter one, or the accent
70
+ neutral: {
71
+ backgroundImage: {
72
+ default: `linear-gradient(90deg, ${colors.textSubtle} 0%, ${colors.textSubtle} 40%, ${colors.text} 50%, ${colors.textSubtle} 60%, ${colors.textSubtle} 100%)`,
73
+ [media.reducedMotion]: 'none',
74
+ [media.forcedColors]: 'none'
75
+ }
76
+ },
77
+ accent: {
78
+ backgroundImage: {
79
+ default: `linear-gradient(90deg, ${colors.textSubtle} 0%, ${colors.textSubtle} 40%, ${colors.accent} 50%, ${colors.textSubtle} 60%, ${colors.textSubtle} 100%)`,
80
+ [media.reducedMotion]: 'none',
81
+ [media.forcedColors]: 'none'
82
+ }
65
83
  }
66
84
  });
67
85
  </script>
68
86
 
69
87
  <script lang="ts">
70
- let { active = true, sx, class: className, children, ...rest }: ShimmerProps = $props();
88
+ let {
89
+ active = true,
90
+ tone = 'neutral',
91
+ sx,
92
+ class: className,
93
+ children,
94
+ ...rest
95
+ }: ShimmerProps = $props();
71
96
  </script>
72
97
 
73
98
  <span
74
99
  data-slot="shimmer"
75
100
  data-active={active || undefined}
101
+ data-tone={tone}
76
102
  {...rest}
77
- {...attrs([styles.base, active && styles.active, sx], className)}
103
+ {...attrs([styles.base, active && styles.active, active && styles[tone], sx], className)}
78
104
  {@attach active && whileVisible}
79
105
  >
80
106
  {@render children?.()}
@@ -1,9 +1,16 @@
1
1
  import type { Snippet } from 'svelte';
2
2
  import type { HTMLAttributes } from 'svelte/elements';
3
3
  import { type Sx } from '../../internal/sx.js';
4
+ /**
5
+ * The colour of the band. `neutral`, the default, is the text's own colour passing over
6
+ * quieter letters; `accent` is a band of the accent, for the one thing that is live.
7
+ */
8
+ export type ShimmerTone = 'neutral' | 'accent';
4
9
  export type ShimmerProps = Omit<HTMLAttributes<HTMLSpanElement>, 'children'> & {
5
10
  /** Turn it off to show the text plainly, for example once the work is done. */
6
11
  active?: boolean | undefined;
12
+ /** The colour of the band that passes over the letters. */
13
+ tone?: ShimmerTone | undefined;
7
14
  sx?: Sx | undefined;
8
15
  children?: Snippet | undefined;
9
16
  };
package/dist/index.d.ts CHANGED
@@ -111,7 +111,7 @@ export type { SettingsGroupProps } from './components/settings-group/SettingsGro
111
111
  export { default as SettingsRow } from './components/settings-row/SettingsRow.svelte';
112
112
  export type { SettingsRowControl, SettingsRowProps } from './components/settings-row/SettingsRow.svelte';
113
113
  export { default as Shimmer } from './components/shimmer/Shimmer.svelte';
114
- export type { ShimmerProps } from './components/shimmer/Shimmer.svelte';
114
+ export type { ShimmerProps, ShimmerTone } from './components/shimmer/Shimmer.svelte';
115
115
  export * as Sheet from './components/sheet/index.js';
116
116
  export type { SheetContentProps, SheetSide, SheetSize } from './components/sheet/index.js';
117
117
  export * as Sidebar from './components/sidebar/index.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@diegopluna/narvi",
3
- "version": "0.3.8",
3
+ "version": "0.3.9",
4
4
  "packageManager": "pnpm@12.18.0",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -12,7 +12,7 @@ metadata:
12
12
  Grid, and Narvi's conventions for colour, labels and copy.
13
13
  type: core
14
14
  library: '@diegopluna/narvi'
15
- library_version: '0.3.8'
15
+ library_version: '0.3.9'
16
16
  requires:
17
17
  - setup
18
18
  sources:
@@ -106,7 +106,7 @@ errors with an `Announcer` too.
106
106
  | `Progress` | How far along a task is | `progress` |
107
107
  | `Spinner` | Something in progress | `spinner` |
108
108
  | `Skeleton` | A stand-in for content on its way | `skeleton` |
109
- | `Shimmer` | Text that says work is under way | `shimmer` |
109
+ | `Shimmer` | Text that says work is under way (`tone` `neutral` by default, or `accent` for the one live thing) | `shimmer` |
110
110
  | `RollingText` | A phrase that rolls to its next value ("Reading…", "Running…") | none |
111
111
  | `Announcer` | Says a short message to screen readers without showing anything | `announcer` |
112
112
  | `Avatar.Root`, `.Image`, `.Fallback` | A person: a picture, or initials (`size` `xs` is 20px; `label={null}` beside a written name) | `avatar` |
@@ -12,7 +12,7 @@ metadata:
12
12
  patching the DOM, and decide which links and images text from a model may load.
13
13
  type: core
14
14
  library: '@diegopluna/narvi'
15
- library_version: '0.3.8'
15
+ library_version: '0.3.9'
16
16
  requires:
17
17
  - setup
18
18
  sources:
@@ -11,7 +11,7 @@ metadata:
11
11
  4 when the app uses it.
12
12
  type: lifecycle
13
13
  library: '@diegopluna/narvi'
14
- library_version: '0.3.8'
14
+ library_version: '0.3.9'
15
15
  sources:
16
16
  - src/lib/vite.ts
17
17
  - src/lib/base.css
@@ -12,7 +12,7 @@ metadata:
12
12
  hover, motion and forced-colour preferences.
13
13
  type: core
14
14
  library: '@diegopluna/narvi'
15
- library_version: '0.3.8'
15
+ library_version: '0.3.9'
16
16
  requires:
17
17
  - setup
18
18
  sources:
@@ -11,7 +11,7 @@ metadata:
11
11
  menus and dialogs, and resolve token colours for drawing code that cannot read CSS variables.
12
12
  type: core
13
13
  library: '@diegopluna/narvi'
14
- library_version: '0.3.8'
14
+ library_version: '0.3.9'
15
15
  requires:
16
16
  - setup
17
17
  sources: