@x33025/sveltely 0.1.1 → 0.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.
Files changed (101) hide show
  1. package/dist/components/Library/Button/Button.demo.svelte +5 -3
  2. package/dist/components/Library/Button/Button.demo.svelte.d.ts +1 -0
  3. package/dist/components/Library/Calendar/Calendar.demo.svelte +2 -14
  4. package/dist/components/Library/Calendar/Calendar.svelte +54 -50
  5. package/dist/components/Library/Divider/Divider.svelte +10 -0
  6. package/dist/components/Library/Divider/Divider.svelte.d.ts +26 -0
  7. package/dist/components/Library/Divider/index.d.ts +1 -0
  8. package/dist/components/Library/Divider/index.js +1 -0
  9. package/dist/components/Library/Dropdown/Dropdown.demo.svelte +10 -3
  10. package/dist/components/Library/Dropdown/Dropdown.svelte +39 -5
  11. package/dist/components/Library/Dropdown/index.d.ts +1 -1
  12. package/dist/components/Library/Dropdown/types.d.ts +4 -1
  13. package/dist/components/Library/Floating/Floating.svelte +35 -1
  14. package/dist/components/Library/ForEach/ForEach.svelte +14 -0
  15. package/dist/components/Library/ForEach/ForEach.svelte.d.ts +28 -0
  16. package/dist/components/Library/ForEach/index.d.ts +1 -0
  17. package/dist/components/Library/ForEach/index.js +1 -0
  18. package/dist/components/Library/Grid/Grid.svelte +74 -0
  19. package/dist/components/Library/Grid/Grid.svelte.d.ts +13 -0
  20. package/dist/components/Library/Grid/index.d.ts +1 -0
  21. package/dist/components/Library/Grid/index.js +1 -0
  22. package/dist/components/Library/GridItem/GridItem.svelte +65 -0
  23. package/dist/components/Library/GridItem/GridItem.svelte.d.ts +14 -0
  24. package/dist/components/Library/GridItem/index.d.ts +1 -0
  25. package/dist/components/Library/GridItem/index.js +1 -0
  26. package/dist/components/Library/HStack/HStack.svelte +45 -0
  27. package/dist/components/Library/HStack/HStack.svelte.d.ts +9 -0
  28. package/dist/components/Library/HStack/index.d.ts +1 -0
  29. package/dist/components/Library/HStack/index.js +1 -0
  30. package/dist/components/Library/Image/Image.demo.svelte +18 -0
  31. package/dist/components/Library/Image/Image.demo.svelte.d.ts +23 -0
  32. package/dist/components/Library/Image/Image.svelte +57 -0
  33. package/dist/components/Library/Image/Image.svelte.d.ts +17 -0
  34. package/dist/components/Library/Image/ImagePlaceholder.svelte +202 -0
  35. package/dist/components/Library/Image/ImagePlaceholder.svelte.d.ts +7 -0
  36. package/dist/components/Library/Image/index.d.ts +1 -0
  37. package/dist/components/Library/Image/index.js +1 -0
  38. package/dist/components/Library/ImageMask/BrushPreview.svelte +119 -0
  39. package/dist/components/Library/ImageMask/BrushPreview.svelte.d.ts +11 -0
  40. package/dist/components/Library/ImageMask/ImageMask.demo.svelte +117 -0
  41. package/dist/components/Library/ImageMask/ImageMask.demo.svelte.d.ts +10 -0
  42. package/dist/components/Library/ImageMask/ImageMask.svelte +46 -0
  43. package/dist/components/Library/ImageMask/ImageMask.svelte.d.ts +20 -0
  44. package/dist/components/Library/ImageMask/MaskLayer.svelte +341 -0
  45. package/dist/components/Library/ImageMask/MaskLayer.svelte.d.ts +12 -0
  46. package/dist/components/Library/ImageMask/contour.d.ts +11 -0
  47. package/dist/components/Library/ImageMask/contour.js +152 -0
  48. package/dist/components/Library/ImageMask/index.d.ts +2 -0
  49. package/dist/components/Library/ImageMask/index.js +1 -0
  50. package/dist/components/Library/ImageMask/marchingAnts.d.ts +8 -0
  51. package/dist/components/Library/ImageMask/marchingAnts.js +29 -0
  52. package/dist/components/Library/ImageMask/maskSurface.d.ts +5 -0
  53. package/dist/components/Library/ImageMask/maskSurface.js +94 -0
  54. package/dist/components/Library/ImageMask/types.d.ts +23 -0
  55. package/dist/components/Library/ImageMask/types.js +1 -0
  56. package/dist/components/Library/Label/Label.demo.svelte +28 -0
  57. package/dist/components/Library/Label/Label.demo.svelte.d.ts +9 -0
  58. package/dist/components/Library/Label/Label.svelte +177 -0
  59. package/dist/components/Library/Label/Label.svelte.d.ts +18 -0
  60. package/dist/components/Library/Label/index.d.ts +1 -0
  61. package/dist/components/Library/Label/index.js +1 -0
  62. package/dist/components/Library/NumberField/NumberField.demo.svelte +21 -0
  63. package/dist/components/Library/NumberField/NumberField.demo.svelte.d.ts +8 -0
  64. package/dist/components/Library/NumberField/NumberField.svelte +194 -0
  65. package/dist/components/Library/NumberField/NumberField.svelte.d.ts +21 -0
  66. package/dist/components/Library/NumberField/index.d.ts +1 -0
  67. package/dist/components/Library/NumberField/index.js +1 -0
  68. package/dist/components/Library/ScrollView/ScrollView.svelte +25 -9
  69. package/dist/components/Library/ScrollView/ScrollView.svelte.d.ts +4 -4
  70. package/dist/components/Library/Spacer/Spacer.svelte +7 -0
  71. package/dist/components/Library/Spacer/Spacer.svelte.d.ts +26 -0
  72. package/dist/components/Library/Spacer/index.d.ts +1 -0
  73. package/dist/components/Library/Spacer/index.js +1 -0
  74. package/dist/components/Library/TextField/TextField.demo.svelte +14 -0
  75. package/dist/components/Library/TextField/TextField.demo.svelte.d.ts +8 -0
  76. package/dist/components/Library/TextField/TextField.svelte +149 -0
  77. package/dist/components/Library/TextField/TextField.svelte.d.ts +19 -0
  78. package/dist/components/Library/TextField/index.d.ts +1 -0
  79. package/dist/components/Library/TextField/index.js +1 -0
  80. package/dist/components/Library/VStack/VStack.svelte +45 -0
  81. package/dist/components/Library/VStack/VStack.svelte.d.ts +9 -0
  82. package/dist/components/Library/VStack/index.d.ts +1 -0
  83. package/dist/components/Library/VStack/index.js +1 -0
  84. package/dist/components/Local/ComponentGrid.svelte +15 -31
  85. package/dist/components/Local/HeroCard.svelte +26 -36
  86. package/dist/components/Local/HeroCard.svelte.d.ts +0 -2
  87. package/dist/index.d.ts +23 -0
  88. package/dist/index.js +17 -0
  89. package/dist/style/index.css +28 -17
  90. package/dist/style/label.d.ts +6 -0
  91. package/dist/style/label.js +4 -0
  92. package/dist/style/layout.d.ts +57 -0
  93. package/dist/style/layout.js +128 -0
  94. package/dist/style/media.d.ts +12 -0
  95. package/dist/style/media.js +8 -0
  96. package/dist/style/scroll.d.ts +7 -0
  97. package/dist/style/scroll.js +5 -0
  98. package/dist/style/text-editor.d.ts +34 -0
  99. package/dist/style/text-editor.js +29 -0
  100. package/dist/style.css +58 -35
  101. package/package.json +1 -1
@@ -1,61 +1,51 @@
1
1
  <script lang="ts">
2
2
  import type { Snippet } from 'svelte';
3
+ import HStack from '../Library/HStack';
4
+ import VStack from '../Library/VStack';
3
5
 
4
6
  type Props = {
5
7
  title?: string;
6
8
  description?: string;
7
9
  children?: Snippet;
8
- columnSpan?: 1 | 2;
9
- rowSpan?: 1 | 2;
10
10
  };
11
11
 
12
- let {
13
- title,
14
- description = '',
15
- children,
16
- columnSpan = 1,
17
- rowSpan = 1
18
- }: Props = $props();
12
+ let { title, description = '', children }: Props = $props();
19
13
  </script>
20
14
 
21
- <div class="hero-card vstack shrink-0 gap-2" data-column-span={columnSpan} data-row-span={rowSpan}>
15
+ <VStack
16
+ minHeight={14}
17
+ height="100%"
18
+ shrink={0}
19
+ align="stretch"
20
+ gap={0.5}
21
+ border="1px solid var(--sveltely-border-color)"
22
+ borderRadius={0.75}
23
+ background="white"
24
+ paddingX={1.5}
25
+ paddingY={1.5}
26
+ >
22
27
  {#if title}
23
28
  <h1 class="text-3xl font-semibold tracking-tight text-zinc-950">{title}</h1>
24
29
  {#if description}
25
30
  <p class="max-w-3xl text-sm text-zinc-600">{description}</p>
26
31
  {/if}
27
32
  {/if}
28
- <div
29
- class="hero-card-content center flex"
30
- >
33
+ <VStack grow shrink overflow="hidden" paddingX={0} paddingY={0}>
31
34
  {#if children}
32
- {@render children()}
35
+ <HStack minWidth="min-content" minHeight="100%" align="center" justify="center">
36
+ {@render children()}
37
+ </HStack>
33
38
  {/if}
34
- </div>
35
- </div>
39
+ </VStack>
40
+ </VStack>
36
41
 
37
42
  <style>
38
- .hero-card {
39
- --hero-card-inset-x: calc(var(--sveltely-padding-x) * 2);
40
- --hero-card-inset-y: calc(var(--sveltely-padding-y) * 2);
41
- --hero-card-inset: max(var(--hero-card-inset-x), var(--hero-card-inset-y));
42
- --sveltely-nested-inset: var(--hero-card-inset);
43
- background: white;
44
- padding: 1.5rem 1.5rem;
43
+ h1 {
44
+ font-size: 1rem;
45
+ line-height: 1.5rem;
45
46
  }
46
47
 
47
- .hero-card-content {
48
- min-height: 0;
49
- flex: 1 1 auto;
50
- }
51
-
52
- @media (min-width: 48rem) {
53
- .hero-card[data-column-span='2'] {
54
- grid-column: span 2;
55
- }
56
-
57
- .hero-card[data-row-span='2'] {
58
- grid-row: span 2;
59
- }
48
+ p {
49
+ max-width: none;
60
50
  }
61
51
  </style>
@@ -3,8 +3,6 @@ type Props = {
3
3
  title?: string;
4
4
  description?: string;
5
5
  children?: Snippet;
6
- columnSpan?: 1 | 2;
7
- rowSpan?: 1 | 2;
8
6
  };
9
7
  declare const HeroCard: import("svelte").Component<Props, {}, "">;
10
8
  type HeroCard = ReturnType<typeof HeroCard>;
package/dist/index.d.ts CHANGED
@@ -2,21 +2,43 @@ export { motion, hover } from './actions/motion';
2
2
  export { portalHost, portalContent } from './actions/portal';
3
3
  export { tooltip } from './actions/tooltip';
4
4
  export type { TooltipOptions } from './actions/tooltip';
5
+ export { LayoutAlignment, LayoutJustification, LayoutOverflow, LayoutSize } from './style/layout';
6
+ export type { LayoutAlignmentValue, LayoutJustificationValue, LayoutOverflowValue, LayoutProps, LayoutSizeValue } from './style/layout';
7
+ export { LabelOrientation } from './style/label';
8
+ export type { LabelOrientationValue } from './style/label';
9
+ export { ImageFit, ImageLoading } from './style/media';
10
+ export type { ImageFitValue, ImageLoadingValue } from './style/media';
11
+ export { ScrollAxis } from './style/scroll';
12
+ export type { ScrollAxisValue } from './style/scroll';
13
+ export { TextAlignment, TextFieldType, TextInputMode } from './style/text-editor';
14
+ export type { TextAlignmentValue, TextEditorProps, TextFieldTypeValue, TextInputModeValue } from './style/text-editor';
5
15
  export { default as AnimatedNumber } from './components/Library/AnimatedNumber';
6
16
  export { default as Button } from './components/Library/Button';
7
17
  export { default as Checkbox } from './components/Library/Checkbox';
8
18
  export { default as GlowEffect } from './components/Library/GlowEffect';
19
+ export { default as Grid } from './components/Library/Grid';
20
+ export { default as GridItem } from './components/Library/GridItem';
21
+ export { default as HStack } from './components/Library/HStack';
22
+ export { default as Image } from './components/Library/Image';
23
+ export { default as ImageMask } from './components/Library/ImageMask';
24
+ export type { ImageMaskValue } from './components/Library/ImageMask';
25
+ export { default as Label } from './components/Library/Label';
9
26
  export { default as NavigationStack } from './components/Library/NavigationStack';
27
+ export { default as NumberField } from './components/Library/NumberField';
10
28
  export { default as SegmentedPicker } from './components/Library/SegmentedPicker';
11
29
  export { default as Pagination } from './components/Library/Pagination';
12
30
  export { default as Dropdown } from './components/Library/Dropdown';
31
+ export { default as Divider } from './components/Library/Divider';
32
+ export { default as ForEach } from './components/Library/ForEach';
13
33
  export { default as TimePicker } from './components/Library/TimePicker';
14
34
  export { default as WheelPicker } from './components/Library/WheelPicker';
15
35
  export { default as Slider } from './components/Library/Slider';
16
36
  export { default as Switch } from './components/Library/Switch';
17
37
  export { default as Sheet } from './components/Library/Sheet';
38
+ export { default as Spacer } from './components/Library/Spacer';
18
39
  export { default as Spinner } from './components/Library/Spinner';
19
40
  export { default as TextShimmer } from './components/Library/TextShimmer';
41
+ export { default as TextField } from './components/Library/TextField';
20
42
  export { default as Popover } from './components/Library/Popover';
21
43
  export { default as ChipInput } from './components/Library/ChipInput';
22
44
  export { default as Calendar } from './components/Library/Calendar';
@@ -24,3 +46,4 @@ export { default as AsyncButton } from './components/Library/AsyncButton';
24
46
  export { default as SearchInput } from './components/Library/SearchInput';
25
47
  export { default as ScrollView } from './components/Library/ScrollView';
26
48
  export { default as TokenSearchInput } from './components/Library/TokenSearchInput';
49
+ export { default as VStack } from './components/Library/VStack';
package/dist/index.js CHANGED
@@ -1,21 +1,37 @@
1
1
  export { motion, hover } from './actions/motion';
2
2
  export { portalHost, portalContent } from './actions/portal';
3
3
  export { tooltip } from './actions/tooltip';
4
+ export { LayoutAlignment, LayoutJustification, LayoutOverflow, LayoutSize } from './style/layout';
5
+ export { LabelOrientation } from './style/label';
6
+ export { ImageFit, ImageLoading } from './style/media';
7
+ export { ScrollAxis } from './style/scroll';
8
+ export { TextAlignment, TextFieldType, TextInputMode } from './style/text-editor';
4
9
  export { default as AnimatedNumber } from './components/Library/AnimatedNumber';
5
10
  export { default as Button } from './components/Library/Button';
6
11
  export { default as Checkbox } from './components/Library/Checkbox';
7
12
  export { default as GlowEffect } from './components/Library/GlowEffect';
13
+ export { default as Grid } from './components/Library/Grid';
14
+ export { default as GridItem } from './components/Library/GridItem';
15
+ export { default as HStack } from './components/Library/HStack';
16
+ export { default as Image } from './components/Library/Image';
17
+ export { default as ImageMask } from './components/Library/ImageMask';
18
+ export { default as Label } from './components/Library/Label';
8
19
  export { default as NavigationStack } from './components/Library/NavigationStack';
20
+ export { default as NumberField } from './components/Library/NumberField';
9
21
  export { default as SegmentedPicker } from './components/Library/SegmentedPicker';
10
22
  export { default as Pagination } from './components/Library/Pagination';
11
23
  export { default as Dropdown } from './components/Library/Dropdown';
24
+ export { default as Divider } from './components/Library/Divider';
25
+ export { default as ForEach } from './components/Library/ForEach';
12
26
  export { default as TimePicker } from './components/Library/TimePicker';
13
27
  export { default as WheelPicker } from './components/Library/WheelPicker';
14
28
  export { default as Slider } from './components/Library/Slider';
15
29
  export { default as Switch } from './components/Library/Switch';
16
30
  export { default as Sheet } from './components/Library/Sheet';
31
+ export { default as Spacer } from './components/Library/Spacer';
17
32
  export { default as Spinner } from './components/Library/Spinner';
18
33
  export { default as TextShimmer } from './components/Library/TextShimmer';
34
+ export { default as TextField } from './components/Library/TextField';
19
35
  export { default as Popover } from './components/Library/Popover';
20
36
  export { default as ChipInput } from './components/Library/ChipInput';
21
37
  export { default as Calendar } from './components/Library/Calendar';
@@ -23,3 +39,4 @@ export { default as AsyncButton } from './components/Library/AsyncButton';
23
39
  export { default as SearchInput } from './components/Library/SearchInput';
24
40
  export { default as ScrollView } from './components/Library/ScrollView';
25
41
  export { default as TokenSearchInput } from './components/Library/TokenSearchInput';
42
+ export { default as VStack } from './components/Library/VStack';
@@ -7,7 +7,7 @@
7
7
  :root {
8
8
  --sveltely-font-size: 1rem;
9
9
  --sveltely-border-radius: 0.75rem;
10
- --sveltely-inset: 0px;
10
+ --sveltely-inset: 0.25rem;
11
11
  --sveltely-nested-inset: var(--sveltely-inset);
12
12
  --sveltely-padding-x: 0.75rem;
13
13
  --sveltely-padding-y: 0.75rem;
@@ -48,6 +48,14 @@
48
48
  background-clip: padding-box;
49
49
  }
50
50
 
51
+ button {
52
+ cursor: pointer;
53
+ }
54
+
55
+ button:disabled {
56
+ cursor: not-allowed;
57
+ }
58
+
51
59
  input::-webkit-search-decoration,
52
60
  input::-webkit-search-cancel-button,
53
61
  input::-webkit-search-results-button,
@@ -88,23 +96,26 @@
88
96
  @apply flex min-h-0 min-w-0 flex-row;
89
97
  }
90
98
 
91
- .spacer {
92
- flex: 1 1 auto;
99
+ .button,
100
+ .async-button,
101
+ .segmented-picker,
102
+ .switch,
103
+ .checkbox,
104
+ .search-input,
105
+ .token-search-input,
106
+ .chip-input,
107
+ .dropdown,
108
+ .pagination,
109
+ .calendar,
110
+ .wheel-picker,
111
+ .time-picker,
112
+ .slider,
113
+ .spinner,
114
+ .image,
115
+ .image-mask,
116
+ .text-shimmer {
117
+ flex-shrink: 0;
93
118
  }
94
-
95
- .divider {
96
- @apply bg-gray-200/70;
97
- }
98
- }
99
-
100
- .hstack > .divider {
101
- width: 1px;
102
- align-self: stretch;
103
- }
104
-
105
- .vstack > .divider {
106
- height: 1px;
107
- width: 100%;
108
119
  }
109
120
 
110
121
  .overflow-auto > .vstack,
@@ -0,0 +1,6 @@
1
+ export declare const LabelOrientation: {
2
+ readonly top: "top";
3
+ readonly left: "left";
4
+ };
5
+ export type LabelOrientationValue = (typeof LabelOrientation)[keyof typeof LabelOrientation];
6
+ export type LabelOrientation = LabelOrientationValue;
@@ -0,0 +1,4 @@
1
+ export const LabelOrientation = {
2
+ top: 'top',
3
+ left: 'left'
4
+ };
@@ -0,0 +1,57 @@
1
+ type StringWithAutocomplete<T extends string> = T | (string & {});
2
+ export declare const LayoutSize: {
3
+ readonly full: "full";
4
+ readonly fit: "fit";
5
+ };
6
+ export declare const LayoutOverflow: {
7
+ readonly visible: "visible";
8
+ readonly hidden: "hidden";
9
+ readonly clip: "clip";
10
+ readonly auto: "auto";
11
+ readonly scroll: "scroll";
12
+ };
13
+ export declare const LayoutAlignment: {
14
+ readonly start: "start";
15
+ readonly center: "center";
16
+ readonly end: "end";
17
+ readonly stretch: "stretch";
18
+ readonly baseline: "baseline";
19
+ };
20
+ export declare const LayoutJustification: {
21
+ readonly start: "start";
22
+ readonly center: "center";
23
+ readonly end: "end";
24
+ readonly between: "between";
25
+ readonly around: "around";
26
+ readonly evenly: "evenly";
27
+ };
28
+ export type LayoutSizeValue = (typeof LayoutSize)[keyof typeof LayoutSize];
29
+ export type LayoutOverflowValue = (typeof LayoutOverflow)[keyof typeof LayoutOverflow];
30
+ export type LayoutAlignmentValue = (typeof LayoutAlignment)[keyof typeof LayoutAlignment];
31
+ export type LayoutJustificationValue = (typeof LayoutJustification)[keyof typeof LayoutJustification];
32
+ export type LayoutSize = StringWithAutocomplete<LayoutSizeValue> | number;
33
+ export type LayoutOverflow = LayoutOverflowValue;
34
+ export type LayoutAlignment = LayoutAlignmentValue;
35
+ export type LayoutJustification = LayoutJustificationValue;
36
+ export type LayoutProps = {
37
+ size?: LayoutSize;
38
+ width?: number | string;
39
+ height?: number | string;
40
+ minWidth?: number | string;
41
+ minHeight?: number | string;
42
+ maxWidth?: number | string;
43
+ maxHeight?: number | string;
44
+ grow?: boolean | number;
45
+ shrink?: boolean | number;
46
+ basis?: number | string;
47
+ border?: boolean | string;
48
+ overflow?: LayoutOverflow;
49
+ align?: LayoutAlignment;
50
+ justify?: LayoutJustification;
51
+ };
52
+ export declare const extractLayoutProps: <T extends Record<string, unknown>>(props: T) => {
53
+ layoutProps: Partial<LayoutProps>;
54
+ restProps: Record<string, unknown>;
55
+ };
56
+ export declare const layoutStyle: (styles?: LayoutProps) => string;
57
+ export {};
@@ -0,0 +1,128 @@
1
+ export const LayoutSize = {
2
+ full: 'full',
3
+ fit: 'fit'
4
+ };
5
+ export const LayoutOverflow = {
6
+ visible: 'visible',
7
+ hidden: 'hidden',
8
+ clip: 'clip',
9
+ auto: 'auto',
10
+ scroll: 'scroll'
11
+ };
12
+ export const LayoutAlignment = {
13
+ start: 'start',
14
+ center: 'center',
15
+ end: 'end',
16
+ stretch: 'stretch',
17
+ baseline: 'baseline'
18
+ };
19
+ export const LayoutJustification = {
20
+ start: 'start',
21
+ center: 'center',
22
+ end: 'end',
23
+ between: 'between',
24
+ around: 'around',
25
+ evenly: 'evenly'
26
+ };
27
+ const LAYOUT_PROP_KEYS = new Set([
28
+ 'size',
29
+ 'width',
30
+ 'height',
31
+ 'minWidth',
32
+ 'minHeight',
33
+ 'maxWidth',
34
+ 'maxHeight',
35
+ 'grow',
36
+ 'shrink',
37
+ 'basis',
38
+ 'border',
39
+ 'overflow',
40
+ 'align',
41
+ 'justify'
42
+ ]);
43
+ const toRem = (value) => value === undefined ? undefined : typeof value === 'number' ? `${value}rem` : value;
44
+ const toSize = (value) => {
45
+ if (value === 'full')
46
+ return '100%';
47
+ if (value === 'fit')
48
+ return 'fit-content';
49
+ return toRem(value);
50
+ };
51
+ const pushDeclaration = (declarations, name, value) => {
52
+ const resolved = toRem(value);
53
+ if (resolved === undefined)
54
+ return;
55
+ declarations.push(`${name}: ${resolved};`);
56
+ };
57
+ const pushFlexValue = (declarations, name, value) => {
58
+ if (value === undefined)
59
+ return;
60
+ declarations.push(`${name}: ${value === true ? 1 : value === false ? 0 : value};`);
61
+ };
62
+ const alignValues = {
63
+ start: 'flex-start',
64
+ center: 'center',
65
+ end: 'flex-end',
66
+ stretch: 'stretch',
67
+ baseline: 'baseline'
68
+ };
69
+ const justifyValues = {
70
+ start: 'flex-start',
71
+ center: 'center',
72
+ end: 'flex-end',
73
+ between: 'space-between',
74
+ around: 'space-around',
75
+ evenly: 'space-evenly'
76
+ };
77
+ export const extractLayoutProps = (props) => {
78
+ const layoutProps = {};
79
+ const restProps = {};
80
+ for (const [key, value] of Object.entries(props)) {
81
+ if (LAYOUT_PROP_KEYS.has(key)) {
82
+ layoutProps[key] = value;
83
+ continue;
84
+ }
85
+ restProps[key] = value;
86
+ }
87
+ return {
88
+ layoutProps,
89
+ restProps
90
+ };
91
+ };
92
+ export const layoutStyle = (styles) => {
93
+ if (!styles)
94
+ return '';
95
+ const declarations = [];
96
+ const resolvedSize = toSize(styles.size);
97
+ if (resolvedSize !== undefined) {
98
+ declarations.push(`width: ${resolvedSize};`, `height: ${resolvedSize};`);
99
+ }
100
+ pushDeclaration(declarations, 'width', styles.width);
101
+ pushDeclaration(declarations, 'height', styles.height);
102
+ pushDeclaration(declarations, 'min-width', styles.minWidth);
103
+ pushDeclaration(declarations, 'min-height', styles.minHeight);
104
+ pushDeclaration(declarations, 'max-width', styles.maxWidth);
105
+ pushDeclaration(declarations, 'max-height', styles.maxHeight);
106
+ pushFlexValue(declarations, 'flex-grow', styles.grow);
107
+ pushFlexValue(declarations, 'flex-shrink', styles.shrink);
108
+ pushDeclaration(declarations, 'flex-basis', styles.basis);
109
+ if (styles.border === true) {
110
+ declarations.push('border: 1px solid var(--sveltely-border-color);');
111
+ }
112
+ else if (typeof styles.border === 'string') {
113
+ const borderValue = /\b(solid|dashed|dotted|double|none|hidden)\b|\d/.test(styles.border)
114
+ ? styles.border
115
+ : `1px solid ${styles.border}`;
116
+ declarations.push(`border: ${borderValue};`);
117
+ }
118
+ if (styles.overflow !== undefined) {
119
+ declarations.push(`overflow: ${styles.overflow};`);
120
+ }
121
+ if (styles.align !== undefined) {
122
+ declarations.push(`align-items: ${alignValues[styles.align]};`);
123
+ }
124
+ if (styles.justify !== undefined) {
125
+ declarations.push(`justify-content: ${justifyValues[styles.justify]};`);
126
+ }
127
+ return declarations.join(' ');
128
+ };
@@ -0,0 +1,12 @@
1
+ export declare const ImageFit: {
2
+ readonly contain: "contain";
3
+ readonly cover: "cover";
4
+ };
5
+ export declare const ImageLoading: {
6
+ readonly eager: "eager";
7
+ readonly lazy: "lazy";
8
+ };
9
+ export type ImageFitValue = (typeof ImageFit)[keyof typeof ImageFit];
10
+ export type ImageLoadingValue = (typeof ImageLoading)[keyof typeof ImageLoading];
11
+ export type ImageFit = ImageFitValue;
12
+ export type ImageLoading = ImageLoadingValue;
@@ -0,0 +1,8 @@
1
+ export const ImageFit = {
2
+ contain: 'contain',
3
+ cover: 'cover'
4
+ };
5
+ export const ImageLoading = {
6
+ eager: 'eager',
7
+ lazy: 'lazy'
8
+ };
@@ -0,0 +1,7 @@
1
+ export declare const ScrollAxis: {
2
+ readonly vertical: "vertical";
3
+ readonly horizontal: "horizontal";
4
+ readonly both: "both";
5
+ };
6
+ export type ScrollAxisValue = (typeof ScrollAxis)[keyof typeof ScrollAxis];
7
+ export type ScrollAxis = ScrollAxisValue;
@@ -0,0 +1,5 @@
1
+ export const ScrollAxis = {
2
+ vertical: 'vertical',
3
+ horizontal: 'horizontal',
4
+ both: 'both'
5
+ };
@@ -0,0 +1,34 @@
1
+ export declare const TextAlignment: {
2
+ readonly left: "left";
3
+ readonly center: "center";
4
+ readonly right: "right";
5
+ readonly start: "start";
6
+ readonly end: "end";
7
+ };
8
+ export type TextAlignmentValue = (typeof TextAlignment)[keyof typeof TextAlignment];
9
+ export type TextAlignment = TextAlignmentValue;
10
+ export declare const TextInputMode: {
11
+ readonly none: "none";
12
+ readonly text: "text";
13
+ readonly tel: "tel";
14
+ readonly url: "url";
15
+ readonly email: "email";
16
+ readonly numeric: "numeric";
17
+ readonly decimal: "decimal";
18
+ readonly search: "search";
19
+ };
20
+ export declare const TextFieldType: {
21
+ readonly text: "text";
22
+ readonly email: "email";
23
+ readonly password: "password";
24
+ readonly url: "url";
25
+ readonly tel: "tel";
26
+ };
27
+ export type TextInputModeValue = (typeof TextInputMode)[keyof typeof TextInputMode];
28
+ export type TextFieldTypeValue = (typeof TextFieldType)[keyof typeof TextFieldType];
29
+ export type TextInputMode = TextInputModeValue;
30
+ export type TextFieldType = TextFieldTypeValue;
31
+ export type TextEditorProps = {
32
+ textAlign?: TextAlignment;
33
+ };
34
+ export declare const textEditorStyle: (props?: TextEditorProps, prefix?: string) => string;
@@ -0,0 +1,29 @@
1
+ export const TextAlignment = {
2
+ left: 'left',
3
+ center: 'center',
4
+ right: 'right',
5
+ start: 'start',
6
+ end: 'end'
7
+ };
8
+ export const TextInputMode = {
9
+ none: 'none',
10
+ text: 'text',
11
+ tel: 'tel',
12
+ url: 'url',
13
+ email: 'email',
14
+ numeric: 'numeric',
15
+ decimal: 'decimal',
16
+ search: 'search'
17
+ };
18
+ export const TextFieldType = {
19
+ text: 'text',
20
+ email: 'email',
21
+ password: 'password',
22
+ url: 'url',
23
+ tel: 'tel'
24
+ };
25
+ export const textEditorStyle = (props, prefix = 'text-field') => {
26
+ if (!props?.textAlign)
27
+ return '';
28
+ return `--${prefix}-text-align: ${props.textAlign};`;
29
+ };