@x33025/sveltely 0.1.15 → 0.1.16

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,70 @@
1
+ <script lang="ts">
2
+ import type { Snippet } from 'svelte';
3
+ import type { HTMLAnchorAttributes } from 'svelte/elements';
4
+ import { extractStyleProps, surfaceStyle, type StyleProps } from '../../../style/surface';
5
+
6
+ type Props = {
7
+ children?: Snippet;
8
+ label?: string;
9
+ } & StyleProps &
10
+ Omit<HTMLAnchorAttributes, 'children' | 'class' | 'style'> & {
11
+ class?: HTMLAnchorAttributes['class'];
12
+ };
13
+
14
+ let { children, label, class: className = '', ...restProps }: Props = $props();
15
+
16
+ const extractedStyleProps = $derived.by(() => extractStyleProps(restProps));
17
+ const styleProps = $derived(extractedStyleProps.styleProps);
18
+ const props = $derived(extractedStyleProps.restProps);
19
+ const rootStyle = $derived.by(() => surfaceStyle(styleProps, 'link'));
20
+ </script>
21
+
22
+ <a class="link {className}" style={rootStyle} {...props}>
23
+ {#if children}
24
+ {@render children()}
25
+ {:else if label}
26
+ <span>{label}</span>
27
+ {/if}
28
+ </a>
29
+
30
+ <style>
31
+ .link {
32
+ --link-font-size: var(--sveltely-font-size);
33
+ --link-icon-size: calc(var(--link-font-size) * 1.143);
34
+ display: inline-flex;
35
+ min-width: 0;
36
+ align-items: center;
37
+ gap: var(--link-gap, calc(var(--sveltely-gap) * 0.75));
38
+ border-radius: var(--link-border-radius, var(--sveltely-border-radius-nested));
39
+ color: var(--link-color, var(--sveltely-active-color));
40
+ font-size: var(--link-font-size);
41
+ line-height: 1.25;
42
+ text-decoration: none;
43
+ text-underline-offset: 0.18em;
44
+ transition:
45
+ color 150ms,
46
+ background-color 150ms,
47
+ text-decoration-color 150ms;
48
+ }
49
+
50
+ .link:hover {
51
+ color: var(--link-hover-color, var(--sveltely-active-color));
52
+ text-decoration-line: underline;
53
+ text-decoration-color: color-mix(in oklab, currentColor 45%, transparent);
54
+ }
55
+
56
+ .link:focus-visible {
57
+ outline: 2px solid color-mix(in oklab, var(--sveltely-active-color) 24%, white);
58
+ outline-offset: 2px;
59
+ }
60
+
61
+ .link :global(svg) {
62
+ width: var(--link-icon-size);
63
+ height: var(--link-icon-size);
64
+ flex-shrink: 0;
65
+ }
66
+
67
+ .link :global(span) {
68
+ min-width: 0;
69
+ }
70
+ </style>
@@ -0,0 +1,12 @@
1
+ import type { Snippet } from 'svelte';
2
+ import type { HTMLAnchorAttributes } from 'svelte/elements';
3
+ import { type StyleProps } from '../../../style/surface';
4
+ type Props = {
5
+ children?: Snippet;
6
+ label?: string;
7
+ } & StyleProps & Omit<HTMLAnchorAttributes, 'children' | 'class' | 'style'> & {
8
+ class?: HTMLAnchorAttributes['class'];
9
+ };
10
+ declare const Link: import("svelte").Component<Props, {}, "">;
11
+ type Link = ReturnType<typeof Link>;
12
+ export default Link;
@@ -0,0 +1 @@
1
+ export { default } from './Link.svelte';
@@ -0,0 +1 @@
1
+ export { default } from './Link.svelte';
@@ -8,6 +8,6 @@ type Props = {
8
8
  } & StyleProps & Omit<HTMLAnchorAttributes, 'children' | 'class' | 'style'> & {
9
9
  class?: HTMLAnchorAttributes['class'];
10
10
  };
11
- declare const NavigationLink: import("svelte").Component<Props, {}, "">;
12
- type NavigationLink = ReturnType<typeof NavigationLink>;
13
- export default NavigationLink;
11
+ declare const Link: import("svelte").Component<Props, {}, "">;
12
+ type Link = ReturnType<typeof Link>;
13
+ export default Link;
@@ -1,7 +1,9 @@
1
1
  import NavigationStackComponent from './NavigationStack.svelte';
2
+ import Link from './Link.svelte';
2
3
  import Toolbar from './Toolbar.svelte';
3
4
  import SidebarToggle from './SidebarToggle.svelte';
4
5
  declare const NavigationStack: typeof NavigationStackComponent & {
6
+ Link: typeof Link;
5
7
  Toolbar: typeof Toolbar;
6
8
  SidebarToggle: typeof SidebarToggle;
7
9
  };
@@ -1,8 +1,10 @@
1
1
  import NavigationStackComponent from './NavigationStack.svelte';
2
+ import Link from './Link.svelte';
2
3
  import Toolbar from './Toolbar.svelte';
3
4
  import SidebarToggle from './SidebarToggle.svelte';
4
- // Attach subcomponents for NavigationStack.Toolbar/SidebarToggle syntax
5
+ // Attach subcomponents for NavigationStack.Link/Toolbar/SidebarToggle syntax
5
6
  const NavigationStack = NavigationStackComponent;
7
+ NavigationStack.Link = Link;
6
8
  NavigationStack.Toolbar = Toolbar;
7
9
  NavigationStack.SidebarToggle = SidebarToggle;
8
10
  export default NavigationStack;
package/dist/index.d.ts CHANGED
@@ -27,7 +27,7 @@ export { default as Image } from './components/Library/Image';
27
27
  export { default as ImageMask } from './components/Library/ImageMask';
28
28
  export type { ImageMaskValue } from './components/Library/ImageMask';
29
29
  export { default as Label } from './components/Library/Label';
30
- export { default as NavigationLink } from './components/Library/NavigationLink';
30
+ export { default as Link } from './components/Library/Link';
31
31
  export { default as NavigationStack } from './components/Library/NavigationStack';
32
32
  export { default as NumberField } from './components/Library/NumberField';
33
33
  export { default as SegmentedPicker } from './components/Library/SegmentedPicker';
package/dist/index.js CHANGED
@@ -18,7 +18,7 @@ export { default as HStack } from './components/Library/HStack';
18
18
  export { default as Image } from './components/Library/Image';
19
19
  export { default as ImageMask } from './components/Library/ImageMask';
20
20
  export { default as Label } from './components/Library/Label';
21
- export { default as NavigationLink } from './components/Library/NavigationLink';
21
+ export { default as Link } from './components/Library/Link';
22
22
  export { default as NavigationStack } from './components/Library/NavigationStack';
23
23
  export { default as NumberField } from './components/Library/NumberField';
24
24
  export { default as SegmentedPicker } from './components/Library/SegmentedPicker';
@@ -12,17 +12,6 @@
12
12
  --sveltely-padding-x: 0.75rem;
13
13
  --sveltely-padding-y: 0.75rem;
14
14
  --sveltely-gap: 0.5rem;
15
- --sveltely-scale-0: 0;
16
- --sveltely-scale-1: 0.1;
17
- --sveltely-scale-2: 0.2;
18
- --sveltely-scale-3: 0.3;
19
- --sveltely-scale-4: 0.4;
20
- --sveltely-scale-5: 0.5;
21
- --sveltely-scale-6: 0.6;
22
- --sveltely-scale-7: 0.7;
23
- --sveltely-scale-8: 0.8;
24
- --sveltely-scale-9: 0.9;
25
- --sveltely-scale-10: 1;
26
15
  --sveltely-primary-color: var(--color-zinc-900);
27
16
  --sveltely-secondary-color: var(--color-zinc-500);
28
17
  --sveltely-active-color: var(--color-zinc-900);
package/dist/style.css CHANGED
@@ -853,17 +853,6 @@
853
853
  --sveltely-padding-x: 0.75rem;
854
854
  --sveltely-padding-y: 0.75rem;
855
855
  --sveltely-gap: 0.5rem;
856
- --sveltely-scale-0: 0;
857
- --sveltely-scale-1: 0.1;
858
- --sveltely-scale-2: 0.2;
859
- --sveltely-scale-3: 0.3;
860
- --sveltely-scale-4: 0.4;
861
- --sveltely-scale-5: 0.5;
862
- --sveltely-scale-6: 0.6;
863
- --sveltely-scale-7: 0.7;
864
- --sveltely-scale-8: 0.8;
865
- --sveltely-scale-9: 0.9;
866
- --sveltely-scale-10: 1;
867
856
  --sveltely-primary-color: var(--color-zinc-900);
868
857
  --sveltely-secondary-color: var(--color-zinc-500);
869
858
  --sveltely-active-color: var(--color-zinc-900);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@x33025/sveltely",
3
- "version": "0.1.15",
3
+ "version": "0.1.16",
4
4
  "scripts": {
5
5
  "dev": "vite dev",
6
6
  "build": "vite build && npm run prepack",
@@ -1 +0,0 @@
1
- export { default } from './NavigationLink.svelte';
@@ -1 +0,0 @@
1
- export { default } from './NavigationLink.svelte';