@x33025/sveltely 0.1.14 → 0.1.15

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.
@@ -10,7 +10,7 @@
10
10
  </script>
11
11
 
12
12
  <div class="sveltely-loader-overlay" role="status" aria-live="polite" aria-label={text}>
13
- <VStack align="center" justify="center" gap="var(--sveltely-gap)">
13
+ <VStack align="center" justify="center" gap={5}>
14
14
  <Spinner />
15
15
  <span class="sveltely-loader-text">{text}</span>
16
16
  </VStack>
@@ -117,9 +117,9 @@
117
117
  <VStack
118
118
  width="100%"
119
119
  maxWidth="860px"
120
- gap="2.5rem"
121
- paddingX="3.5rem"
122
- paddingY="2.5rem"
120
+ gap={25}
121
+ paddingX={35}
122
+ paddingY={25}
123
123
  background="var(--sveltely-background-color)"
124
124
  >
125
125
  <ArticleEditorHeader
@@ -159,7 +159,7 @@
159
159
 
160
160
  {#if faqBlocks.length > 0}
161
161
  <section class="article-editor-faq-section">
162
- <VStack gap="1.25rem">
162
+ <VStack gap={12.5}>
163
163
  {#each faqBlocks as block (block.id)}
164
164
  <TextEditor
165
165
  autosize
@@ -237,7 +237,7 @@
237
237
  });
238
238
  </script>
239
239
 
240
- <VStack gap="0.5rem" paddingX="0" paddingY="0">
240
+ <VStack gap={5} paddingX={0} paddingY={0}>
241
241
  {#each articleBlocks as block (block.id)}
242
242
  {@const dropPlacement = dropPlacementFor(block.id)}
243
243
  {@const textFormat = blockTextFormat(block)}
@@ -13,7 +13,7 @@
13
13
  }>();
14
14
  </script>
15
15
 
16
- <VStack gap="2rem" paddingX="0" paddingY="2rem">
16
+ <VStack gap={20} paddingX={0} paddingY={20}>
17
17
  <TextEditor
18
18
  autosize
19
19
  value={draftTitle}
@@ -12,7 +12,7 @@
12
12
  import HStack from '../HStack';
13
13
  </script>
14
14
 
15
- <HStack align="center" gap={0.75}>
15
+ <HStack align="center" gap={7.5}>
16
16
  <Button label="Default" />
17
17
  <Button
18
18
  label="Solid"
@@ -155,7 +155,7 @@
155
155
  <div class="h-36">
156
156
  <ScrollView
157
157
  contentStyles={{ paddingX: 0, paddingY: 0 }}
158
- borderRadius="var(--sveltely-border-radius-nested)"
158
+ borderRadius={5}
159
159
  background="white"
160
160
  onScroll={handleWebsiteScroll}
161
161
  >
@@ -17,7 +17,7 @@
17
17
  let amount = $state<number | null>(35);
18
18
  </script>
19
19
 
20
- <HStack gap={1} align="center">
20
+ <HStack gap={10} align="center">
21
21
  <Label label="Name" icon={UserIcon} orientation="top">
22
22
  <TextField bind:value={name} placeholder="Sveltely" />
23
23
  </Label>
@@ -29,7 +29,7 @@
29
29
 
30
30
  <ScrollView
31
31
  background="color-mix(in oklab, var(--sveltely-background-color) 94%, var(--sveltely-primary-color))"
32
- borderRadius="var(--sveltely-border-radius)"
32
+ borderRadius={7.5}
33
33
  scrollGradient={false}
34
34
  loader={{ text: 'Loading preview...', promise: pending }}
35
35
  >
@@ -0,0 +1,83 @@
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
+ active?: boolean;
10
+ } & StyleProps &
11
+ Omit<HTMLAnchorAttributes, 'children' | 'class' | 'style'> & {
12
+ class?: HTMLAnchorAttributes['class'];
13
+ };
14
+
15
+ let { children, label, active = false, class: className = '', ...restProps }: Props = $props();
16
+
17
+ const extractedStyleProps = $derived.by(() => extractStyleProps(restProps));
18
+ const styleProps = $derived(extractedStyleProps.styleProps);
19
+ const props = $derived(extractedStyleProps.restProps);
20
+ const rootStyle = $derived.by(() => surfaceStyle(styleProps, 'navigation-link'));
21
+ </script>
22
+
23
+ <a
24
+ class="navigation-link {className}"
25
+ class:navigation-link-active={active}
26
+ style={rootStyle}
27
+ {...props}
28
+ >
29
+ {#if children}
30
+ {@render children()}
31
+ {:else if label}
32
+ <span>{label}</span>
33
+ {/if}
34
+ </a>
35
+
36
+ <style>
37
+ .navigation-link {
38
+ --navigation-link-font-size: calc(var(--sveltely-font-size) * 0.875);
39
+ --navigation-link-scale: calc(var(--navigation-link-font-size) / 0.875rem);
40
+ --navigation-link-icon-size: calc(var(--navigation-link-font-size) * 1.143);
41
+ display: flex;
42
+ min-width: 0;
43
+ align-items: center;
44
+ border-radius: var(--navigation-link-border-radius, var(--sveltely-border-radius));
45
+ color: var(--navigation-link-color, var(--sveltely-primary-color));
46
+ gap: var(--navigation-link-gap, var(--sveltely-gap));
47
+ font-size: var(--navigation-link-font-size);
48
+ line-height: 1.25;
49
+ padding: var(
50
+ --navigation-link-padding-y,
51
+ calc(var(--sveltely-padding-y) * 0.67 * var(--navigation-link-scale))
52
+ )
53
+ var(
54
+ --navigation-link-padding-x,
55
+ calc(var(--sveltely-padding-x) * var(--navigation-link-scale))
56
+ );
57
+ text-decoration: none;
58
+ transition:
59
+ color 150ms,
60
+ background-color 150ms;
61
+ }
62
+
63
+ .navigation-link:hover,
64
+ .navigation-link-active {
65
+ background: var(--navigation-link-active-background, var(--sveltely-hover-color));
66
+ }
67
+
68
+ .navigation-link :global(svg) {
69
+ width: var(--navigation-link-icon-size);
70
+ height: var(--navigation-link-icon-size);
71
+ flex-shrink: 0;
72
+ }
73
+
74
+ .navigation-link :global(span) {
75
+ min-width: 0;
76
+ }
77
+
78
+ .navigation-link > span {
79
+ overflow: hidden;
80
+ text-overflow: ellipsis;
81
+ white-space: nowrap;
82
+ }
83
+ </style>
@@ -0,0 +1,13 @@
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
+ active?: boolean;
8
+ } & StyleProps & Omit<HTMLAnchorAttributes, 'children' | 'class' | 'style'> & {
9
+ class?: HTMLAnchorAttributes['class'];
10
+ };
11
+ declare const NavigationLink: import("svelte").Component<Props, {}, "">;
12
+ type NavigationLink = ReturnType<typeof NavigationLink>;
13
+ export default NavigationLink;
@@ -0,0 +1 @@
1
+ export { default } from './NavigationLink.svelte';
@@ -0,0 +1 @@
1
+ export { default } from './NavigationLink.svelte';
@@ -57,8 +57,10 @@
57
57
 
58
58
  const shellStyle = $derived.by(() => {
59
59
  const declarations = [
60
- `--navigation-stack-left-width: ${left && leftOpen ? 'var(--navigation-stack-sidebar-width)' : '0px'};`,
61
- `--navigation-stack-right-width: ${right && rightOpen ? 'var(--navigation-stack-sidebar-width)' : '0px'};`
60
+ `--navigation-stack-left-width: ${left || leftHeader ? 'var(--navigation-stack-sidebar-width)' : '0px'};`,
61
+ `--navigation-stack-right-width: ${right || rightHeader ? 'var(--navigation-stack-sidebar-width)' : '0px'};`,
62
+ `--navigation-stack-center-margin-left: ${left && leftOpen ? 'var(--navigation-stack-left-width)' : '0px'};`,
63
+ `--navigation-stack-center-margin-right: ${right && rightOpen ? 'var(--navigation-stack-right-width)' : '0px'};`
62
64
  ];
63
65
  const stylePropDeclarations = surfaceStyle(styleProps, 'navigation-stack');
64
66
  if (stylePropDeclarations) declarations.push(stylePropDeclarations);
@@ -152,7 +154,6 @@
152
154
  var(--navigation-stack-right-width);
153
155
  grid-template-rows: auto minmax(0, 1fr);
154
156
  overflow: hidden;
155
- transition: grid-template-columns 300ms ease-in-out;
156
157
  }
157
158
 
158
159
  .navigation-stack-pane {
@@ -171,7 +172,15 @@
171
172
 
172
173
  .navigation-stack-pane-center.navigation-stack-pane-header,
173
174
  .navigation-stack-pane-center.navigation-stack-pane-body {
174
- grid-column: 2;
175
+ grid-column: 1 / 4;
176
+ margin-left: var(--navigation-stack-center-margin-left);
177
+ margin-right: var(--navigation-stack-center-margin-right);
178
+ z-index: 2;
179
+ transition:
180
+ margin-left 300ms ease-in-out,
181
+ margin-right 300ms ease-in-out,
182
+ border-color 300ms ease-in-out,
183
+ background-color 300ms ease-in-out;
175
184
  }
176
185
 
177
186
  .navigation-stack-pane-right.navigation-stack-pane-header,
@@ -202,6 +211,7 @@
202
211
  }
203
212
 
204
213
  .navigation-stack-content {
214
+ background: var(--sveltely-background-color);
205
215
  overflow: auto;
206
216
  }
207
217
 
@@ -23,9 +23,9 @@
23
23
  <Grid
24
24
  columns="repeat(auto-fit, minmax(min(100%, 18rem), 1fr))"
25
25
  autoRows={14}
26
- gap={1}
27
- paddingX="calc(var(--sveltely-padding-x) * 2)"
28
- paddingY="calc(var(--sveltely-padding-y) * 2)"
26
+ gap={10}
27
+ paddingX={15}
28
+ paddingY={15}
29
29
  >
30
30
  {#each demos as entry (entry.name)}
31
31
  {@const DemoComponent = entry.component}
@@ -17,12 +17,12 @@
17
17
  height="100%"
18
18
  shrink={0}
19
19
  align="stretch"
20
- gap={0.5}
20
+ gap={5}
21
21
  border="1px solid var(--sveltely-border-color)"
22
- borderRadius={0.75}
22
+ borderRadius={7.5}
23
23
  background="var(--sveltely-background-color)"
24
- paddingX={1.5}
25
- paddingY={1.5}
24
+ paddingX={15}
25
+ paddingY={15}
26
26
  >
27
27
  {#if title}
28
28
  <h1 class="text-3xl font-semibold tracking-tight text-[var(--sveltely-primary-color)]">
@@ -17,12 +17,12 @@
17
17
  };
18
18
 
19
19
  let {
20
- fontSize = $bindable(1),
21
- borderRadius = $bindable(0.75),
22
- paddingX = $bindable(0.75),
23
- paddingY = $bindable(0.75),
24
- gap = $bindable(0.5),
25
- inset = $bindable(0.25),
20
+ fontSize = $bindable(10),
21
+ borderRadius = $bindable(7.5),
22
+ paddingX = $bindable(7.5),
23
+ paddingY = $bindable(7.5),
24
+ gap = $bindable(5),
25
+ inset = $bindable(2.5),
26
26
  borderColor = $bindable('#e4e4e7'),
27
27
  primaryColor = $bindable('#18181b'),
28
28
  secondaryColor = $bindable('#71717a'),
@@ -42,44 +42,44 @@
42
42
  <div class="vstack gap-2">
43
43
  <div class="hstack items-center justify-between gap-3">
44
44
  <span class="font-medium">Font size</span>
45
- <span class="text-[var(--sveltely-secondary-color)]">{fontSize.toFixed(2)}rem</span>
45
+ <span class="text-[var(--sveltely-secondary-color)]">{fontSize.toFixed(1)}</span>
46
46
  </div>
47
- <Slider bind:value={fontSize} min={0.5} max={2} step={0.05} />
47
+ <Slider bind:value={fontSize} min={5} max={20} step={0.5} />
48
48
  </div>
49
49
  <div class="vstack gap-2">
50
50
  <div class="hstack items-center justify-between gap-3">
51
51
  <span class="font-medium">Border radius</span>
52
- <span class="text-[var(--sveltely-secondary-color)]">{borderRadius.toFixed(2)}rem</span>
52
+ <span class="text-[var(--sveltely-secondary-color)]">{borderRadius.toFixed(1)}</span>
53
53
  </div>
54
- <Slider bind:value={borderRadius} min={0} max={3} step={0.05} />
54
+ <Slider bind:value={borderRadius} min={0} max={30} step={0.5} />
55
55
  </div>
56
56
  <div class="vstack gap-2">
57
57
  <div class="hstack items-center justify-between gap-3">
58
58
  <span class="font-medium">Padding X</span>
59
- <span class="text-[var(--sveltely-secondary-color)]">{paddingX.toFixed(2)}rem</span>
59
+ <span class="text-[var(--sveltely-secondary-color)]">{paddingX.toFixed(1)}</span>
60
60
  </div>
61
- <Slider bind:value={paddingX} min={0} max={2} step="any" />
61
+ <Slider bind:value={paddingX} min={0} max={20} step="any" />
62
62
  </div>
63
63
  <div class="vstack gap-2">
64
64
  <div class="hstack items-center justify-between gap-3">
65
65
  <span class="font-medium">Padding Y</span>
66
- <span class="text-[var(--sveltely-secondary-color)]">{paddingY.toFixed(2)}rem</span>
66
+ <span class="text-[var(--sveltely-secondary-color)]">{paddingY.toFixed(1)}</span>
67
67
  </div>
68
- <Slider bind:value={paddingY} min={0} max={2} step="any" />
68
+ <Slider bind:value={paddingY} min={0} max={20} step="any" />
69
69
  </div>
70
70
  <div class="vstack gap-2">
71
71
  <div class="hstack items-center justify-between gap-3">
72
72
  <span class="font-medium">Gap</span>
73
- <span class="text-[var(--sveltely-secondary-color)]">{gap.toFixed(2)}rem</span>
73
+ <span class="text-[var(--sveltely-secondary-color)]">{gap.toFixed(1)}</span>
74
74
  </div>
75
- <Slider bind:value={gap} min={0} max={2} step="any" />
75
+ <Slider bind:value={gap} min={0} max={20} step="any" />
76
76
  </div>
77
77
  <div class="vstack gap-2">
78
78
  <div class="hstack items-center justify-between gap-3">
79
79
  <span class="font-medium">Inset</span>
80
- <span class="text-[var(--sveltely-secondary-color)]">{inset.toFixed(2)}rem</span>
80
+ <span class="text-[var(--sveltely-secondary-color)]">{inset.toFixed(1)}</span>
81
81
  </div>
82
- <Slider bind:value={inset} min={0} max={1} step="any" />
82
+ <Slider bind:value={inset} min={0} max={10} step="any" />
83
83
  </div>
84
84
  <div class="vstack gap-2">
85
85
  <div class="hstack items-center justify-between gap-3">
package/dist/index.d.ts CHANGED
@@ -27,6 +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
31
  export { default as NavigationStack } from './components/Library/NavigationStack';
31
32
  export { default as NumberField } from './components/Library/NumberField';
32
33
  export { default as SegmentedPicker } from './components/Library/SegmentedPicker';
package/dist/index.js CHANGED
@@ -18,6 +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
22
  export { default as NavigationStack } from './components/Library/NavigationStack';
22
23
  export { default as NumberField } from './components/Library/NumberField';
23
24
  export { default as SegmentedPicker } from './components/Library/SegmentedPicker';
@@ -12,6 +12,17 @@
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;
15
26
  --sveltely-primary-color: var(--color-zinc-900);
16
27
  --sveltely-secondary-color: var(--color-zinc-500);
17
28
  --sveltely-active-color: var(--color-zinc-900);
@@ -1,10 +1,10 @@
1
1
  export type StyleProps = {
2
- fontSize?: number | string;
3
- paddingX?: number | string;
4
- paddingY?: number | string;
5
- gap?: number | string;
6
- borderRadius?: number | string;
7
- inset?: number | string;
2
+ fontSize?: number;
3
+ paddingX?: number;
4
+ paddingY?: number;
5
+ gap?: number;
6
+ borderRadius?: number;
7
+ inset?: number;
8
8
  background?: string;
9
9
  borderColor?: string;
10
10
  color?: string;
@@ -9,7 +9,7 @@ const STYLE_PROP_KEYS = new Set([
9
9
  'borderColor',
10
10
  'color'
11
11
  ]);
12
- const toRem = (value) => value === undefined ? undefined : typeof value === 'number' ? `${value}rem` : value;
12
+ const toRem = (value) => (value === undefined ? undefined : `${value / 10}rem`);
13
13
  const pushVar = (declarations, name, value) => {
14
14
  const resolved = toRem(value);
15
15
  if (resolved === undefined)
package/dist/style.css CHANGED
@@ -853,6 +853,17 @@
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;
856
867
  --sveltely-primary-color: var(--color-zinc-900);
857
868
  --sveltely-secondary-color: var(--color-zinc-500);
858
869
  --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.14",
3
+ "version": "0.1.15",
4
4
  "scripts": {
5
5
  "dev": "vite dev",
6
6
  "build": "vite build && npm run prepack",