seblify 0.1.4

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 (138) hide show
  1. package/README.md +18 -0
  2. package/dist/components/AppShell.svelte +136 -0
  3. package/dist/components/AppShell.svelte.d.ts +13 -0
  4. package/dist/components/Banner.svelte +56 -0
  5. package/dist/components/Banner.svelte.d.ts +9 -0
  6. package/dist/components/Button.svelte +64 -0
  7. package/dist/components/Button.svelte.d.ts +13 -0
  8. package/dist/components/Icon.svelte +67 -0
  9. package/dist/components/Icon.svelte.d.ts +8 -0
  10. package/dist/components/Sidebar.svelte +106 -0
  11. package/dist/components/Sidebar.svelte.d.ts +14 -0
  12. package/dist/components/Snackbar.svelte +26 -0
  13. package/dist/components/Snackbar.svelte.d.ts +7 -0
  14. package/dist/components/Toast.svelte +27 -0
  15. package/dist/components/Toast.svelte.d.ts +7 -0
  16. package/dist/components/action/input/field/pin-input/PinInput.svelte +156 -0
  17. package/dist/components/action/input/field/pin-input/PinInput.svelte.d.ts +10 -0
  18. package/dist/components/action/input/select/checkbox/Checkbox.svelte +71 -0
  19. package/dist/components/action/input/select/checkbox/Checkbox.svelte.d.ts +10 -0
  20. package/dist/components/action/input/select/segment-control/SegmentControl.svelte +150 -0
  21. package/dist/components/action/input/select/segment-control/SegmentControl.svelte.d.ts +15 -0
  22. package/dist/components/action/input/select/slider/Slider.svelte +79 -0
  23. package/dist/components/action/input/select/slider/Slider.svelte.d.ts +11 -0
  24. package/dist/components/action/input/select/switch/Switch.svelte +122 -0
  25. package/dist/components/action/input/select/switch/Switch.svelte.d.ts +10 -0
  26. package/dist/components/action/input/select/theme-switch/ThemeSwitch.svelte +43 -0
  27. package/dist/components/action/input/select/theme-switch/ThemeSwitch.svelte.d.ts +10 -0
  28. package/dist/components/component-doc.d.ts +23 -0
  29. package/dist/components/component-doc.js +1 -0
  30. package/dist/components/display/annotation/badge/Badge.svelte +296 -0
  31. package/dist/components/display/annotation/badge/Badge.svelte.d.ts +16 -0
  32. package/dist/components/display/annotation/tag/Tag.svelte +227 -0
  33. package/dist/components/display/annotation/tag/Tag.svelte.d.ts +16 -0
  34. package/dist/components/display/annotation/tag-group/TagGroup.svelte +33 -0
  35. package/dist/components/display/annotation/tag-group/TagGroup.svelte.d.ts +12 -0
  36. package/dist/components/display/feedback/loading/loading-dots/LoadingDots.svelte +136 -0
  37. package/dist/components/display/feedback/loading/loading-dots/LoadingDots.svelte.d.ts +8 -0
  38. package/dist/components/display/feedback/loading/spinner/Spinner.svelte +110 -0
  39. package/dist/components/display/feedback/loading/spinner/Spinner.svelte.d.ts +8 -0
  40. package/dist/components/display/media/icon/Icon.svelte +41 -0
  41. package/dist/components/display/media/icon/Icon.svelte.d.ts +8 -0
  42. package/dist/components/display/media/icon/IconGlyph.svelte +56 -0
  43. package/dist/components/display/media/icon/IconGlyph.svelte.d.ts +8 -0
  44. package/dist/components/display/typography/eyebrow/Eyebrow.svelte +48 -0
  45. package/dist/components/display/typography/eyebrow/Eyebrow.svelte.d.ts +8 -0
  46. package/dist/components/display/typography/highlight/Highlight.svelte +160 -0
  47. package/dist/components/display/typography/highlight/Highlight.svelte.d.ts +10 -0
  48. package/dist/components/framework/layout/alignment/cluster/Cluster.svelte +142 -0
  49. package/dist/components/framework/layout/alignment/cluster/Cluster.svelte.d.ts +17 -0
  50. package/dist/components/framework/layout/alignment/grid/Grid.svelte +120 -0
  51. package/dist/components/framework/layout/alignment/grid/Grid.svelte.d.ts +18 -0
  52. package/dist/components/framework/layout/alignment/row/Row.svelte +142 -0
  53. package/dist/components/framework/layout/alignment/row/Row.svelte.d.ts +17 -0
  54. package/dist/components/framework/layout/alignment/stack/Stack.svelte +142 -0
  55. package/dist/components/framework/layout/alignment/stack/Stack.svelte.d.ts +17 -0
  56. package/dist/components/framework/layout/container/app-shell/AppShell.svelte +82 -0
  57. package/dist/components/framework/layout/container/app-shell/AppShell.svelte.d.ts +9 -0
  58. package/dist/components/framework/layout/container/page-header/PageHeader.svelte +114 -0
  59. package/dist/components/framework/layout/container/page-header/PageHeader.svelte.d.ts +11 -0
  60. package/dist/components/framework/layout/container/sidebar/Sidebar.svelte +134 -0
  61. package/dist/components/framework/layout/container/sidebar/Sidebar.svelte.d.ts +9 -0
  62. package/dist/components/framework/navigation/context/breadcrumb/Breadcrumb.svelte +72 -0
  63. package/dist/components/framework/navigation/context/breadcrumb/Breadcrumb.svelte.d.ts +10 -0
  64. package/dist/components/framework/navigation/sidenav/Sidenav.svelte +86 -0
  65. package/dist/components/framework/navigation/sidenav/Sidenav.svelte.d.ts +8 -0
  66. package/dist/components/framework/navigation/sidenav/SidenavTree.svelte +265 -0
  67. package/dist/components/framework/navigation/sidenav/SidenavTree.svelte.d.ts +14 -0
  68. package/dist/components/framework/navigation/sidenav/sidenav.d.ts +6 -0
  69. package/dist/components/framework/navigation/sidenav/sidenav.js +1 -0
  70. package/dist/components/framework/surface/paper/Paper.svelte +179 -0
  71. package/dist/components/framework/surface/paper/Paper.svelte.d.ts +18 -0
  72. package/dist/design-system/reserved-props/allowed-options.d.ts +46 -0
  73. package/dist/design-system/reserved-props/allowed-options.js +1 -0
  74. package/dist/design-system/reserved-props/blocked-props.d.ts +9 -0
  75. package/dist/design-system/reserved-props/blocked-props.js +1 -0
  76. package/dist/design-system/reserved-props/complex-types.d.ts +1 -0
  77. package/dist/design-system/reserved-props/complex-types.js +1 -0
  78. package/dist/design-system/reserved-props/type.d.ts +16 -0
  79. package/dist/design-system/reserved-props/type.js +1 -0
  80. package/dist/design-system/theme/tokens.d.ts +7 -0
  81. package/dist/design-system/theme/tokens.js +219 -0
  82. package/dist/icons/generated/chevron-double-down.svelte +16 -0
  83. package/dist/icons/generated/chevron-double-down.svelte.d.ts +7 -0
  84. package/dist/icons/generated/chevron-double-left.svelte +16 -0
  85. package/dist/icons/generated/chevron-double-left.svelte.d.ts +7 -0
  86. package/dist/icons/generated/chevron-double-right.svelte +16 -0
  87. package/dist/icons/generated/chevron-double-right.svelte.d.ts +7 -0
  88. package/dist/icons/generated/chevron-double-up.svelte +16 -0
  89. package/dist/icons/generated/chevron-double-up.svelte.d.ts +7 -0
  90. package/dist/icons/generated/chevron-down.svelte +16 -0
  91. package/dist/icons/generated/chevron-down.svelte.d.ts +7 -0
  92. package/dist/icons/generated/chevron-left.svelte +16 -0
  93. package/dist/icons/generated/chevron-left.svelte.d.ts +7 -0
  94. package/dist/icons/generated/chevron-right.svelte +16 -0
  95. package/dist/icons/generated/chevron-right.svelte.d.ts +7 -0
  96. package/dist/icons/generated/chevron-up.svelte +16 -0
  97. package/dist/icons/generated/chevron-up.svelte.d.ts +7 -0
  98. package/dist/icons/generated/fallback.svelte +17 -0
  99. package/dist/icons/generated/fallback.svelte.d.ts +7 -0
  100. package/dist/icons/generated/heart-circle-outline.svelte +16 -0
  101. package/dist/icons/generated/heart-circle-outline.svelte.d.ts +7 -0
  102. package/dist/icons/generated/heart-circle.svelte +16 -0
  103. package/dist/icons/generated/heart-circle.svelte.d.ts +7 -0
  104. package/dist/icons/generated/heart-half-full.svelte +16 -0
  105. package/dist/icons/generated/heart-half-full.svelte.d.ts +7 -0
  106. package/dist/icons/generated/heart-half-outline.svelte +16 -0
  107. package/dist/icons/generated/heart-half-outline.svelte.d.ts +7 -0
  108. package/dist/icons/generated/heart-half.svelte +16 -0
  109. package/dist/icons/generated/heart-half.svelte.d.ts +7 -0
  110. package/dist/icons/generated/heart-multiple-outline.svelte +23 -0
  111. package/dist/icons/generated/heart-multiple-outline.svelte.d.ts +7 -0
  112. package/dist/icons/generated/heart-multiple.svelte +23 -0
  113. package/dist/icons/generated/heart-multiple.svelte.d.ts +7 -0
  114. package/dist/icons/generated/heart-outline.svelte +16 -0
  115. package/dist/icons/generated/heart-outline.svelte.d.ts +7 -0
  116. package/dist/icons/generated/heart.svelte +16 -0
  117. package/dist/icons/generated/heart.svelte.d.ts +7 -0
  118. package/dist/icons/generated/home-edit-outline.svelte +16 -0
  119. package/dist/icons/generated/home-edit-outline.svelte.d.ts +7 -0
  120. package/dist/icons/generated/home-edit.svelte +16 -0
  121. package/dist/icons/generated/home-edit.svelte.d.ts +7 -0
  122. package/dist/icons/generated/home-outline.svelte +16 -0
  123. package/dist/icons/generated/home-outline.svelte.d.ts +7 -0
  124. package/dist/icons/generated/home.svelte +16 -0
  125. package/dist/icons/generated/home.svelte.d.ts +7 -0
  126. package/dist/icons/generated/index.d.ts +24 -0
  127. package/dist/icons/generated/index.js +24 -0
  128. package/dist/icons/generated/manifest.d.ts +7 -0
  129. package/dist/icons/generated/manifest.js +198 -0
  130. package/dist/icons/generated/tag-heart-outline.svelte +16 -0
  131. package/dist/icons/generated/tag-heart-outline.svelte.d.ts +7 -0
  132. package/dist/icons/generated/tag-heart.svelte +16 -0
  133. package/dist/icons/generated/tag-heart.svelte.d.ts +7 -0
  134. package/dist/index.d.ts +32 -0
  135. package/dist/index.js +28 -0
  136. package/dist/svelte.d.ts +18 -0
  137. package/dist/theme.css +161 -0
  138. package/package.json +69 -0
@@ -0,0 +1,136 @@
1
+ <script lang="ts">
2
+ import type { SeblifyProps } from 'seblify';
3
+
4
+ type LoadingDotsTone =
5
+ | 'neutral'
6
+ | 'primary'
7
+ | 'success'
8
+ | 'danger'
9
+ | 'warning'
10
+ | 'info'
11
+ | 'inverse';
12
+
13
+ type Props = SeblifyProps<{
14
+ label?: string;
15
+ size?: 'xs' | 'sm' | 'md' | 'lg';
16
+ tone?: LoadingDotsTone;
17
+ }>;
18
+
19
+ let { label = 'Loading', size, tone }: Props = $props();
20
+ </script>
21
+
22
+ <span
23
+ aria-label={label}
24
+ class:size-lg={size === 'lg'}
25
+ class:size-md={size === 'md'}
26
+ class:size-sm={size === 'sm'}
27
+ class:size-xs={size === 'xs'}
28
+ data-tone={tone}
29
+ class="loading-dots"
30
+ role="status"
31
+ >
32
+ <span></span>
33
+ <span></span>
34
+ <span></span>
35
+ </span>
36
+
37
+ <style>
38
+ .loading-dots {
39
+ display: inline-flex;
40
+ gap: var(--dot-gap, var(--seblify-current-loading-dots-gap, 5px));
41
+ align-items: center;
42
+ width: fit-content;
43
+ color: var(
44
+ --loading-dots-color,
45
+ var(
46
+ --seblify-current-tone-fill,
47
+ var(--seblify-color-fill-primary, #146a6f)
48
+ )
49
+ );
50
+ }
51
+
52
+ .size-sm {
53
+ --dot-size: 6px;
54
+ --dot-gap: 4px;
55
+ }
56
+
57
+ .size-xs {
58
+ --dot-size: 4px;
59
+ --dot-gap: 3px;
60
+ }
61
+
62
+ .size-md {
63
+ --dot-size: 8px;
64
+ --dot-gap: 5px;
65
+ }
66
+
67
+ .size-lg {
68
+ --dot-size: 11px;
69
+ --dot-gap: 7px;
70
+ }
71
+
72
+ .loading-dots[data-tone='neutral'] {
73
+ --loading-dots-color: var(--seblify-color-fill-neutral, #516176);
74
+ }
75
+
76
+ .loading-dots[data-tone='primary'] {
77
+ --loading-dots-color: var(--seblify-color-fill-primary, #146a6f);
78
+ }
79
+
80
+ .loading-dots[data-tone='success'] {
81
+ --loading-dots-color: var(--seblify-color-fill-success, #1f7a3f);
82
+ }
83
+
84
+ .loading-dots[data-tone='danger'] {
85
+ --loading-dots-color: var(--seblify-color-fill-danger, #c93434);
86
+ }
87
+
88
+ .loading-dots[data-tone='warning'] {
89
+ --loading-dots-color: var(--seblify-color-fill-warning, #8a5a00);
90
+ }
91
+
92
+ .loading-dots[data-tone='info'] {
93
+ --loading-dots-color: var(--seblify-color-fill-info, #1f6fb2);
94
+ }
95
+
96
+ .loading-dots[data-tone='inverse'] {
97
+ --loading-dots-color: var(--seblify-color-fill-inverse, #172033);
98
+ }
99
+
100
+ span span {
101
+ width: var(--dot-size, var(--seblify-current-loading-dot-size, 8px));
102
+ height: var(--dot-size, var(--seblify-current-loading-dot-size, 8px));
103
+ border-radius: 999px;
104
+ background: currentColor;
105
+ animation: pulse 900ms ease-in-out infinite;
106
+ }
107
+
108
+ span span:nth-child(2) {
109
+ animation-delay: 120ms;
110
+ }
111
+
112
+ span span:nth-child(3) {
113
+ animation-delay: 240ms;
114
+ }
115
+
116
+ @keyframes pulse {
117
+ 0%,
118
+ 80%,
119
+ 100% {
120
+ opacity: 0.35;
121
+ transform: scale(0.78);
122
+ }
123
+
124
+ 40% {
125
+ opacity: 1;
126
+ transform: scale(1);
127
+ }
128
+ }
129
+
130
+ @media (prefers-reduced-motion: reduce) {
131
+ span span {
132
+ animation: none;
133
+ opacity: 0.75;
134
+ }
135
+ }
136
+ </style>
@@ -0,0 +1,8 @@
1
+ type LoadingDotsTone = 'neutral' | 'primary' | 'success' | 'danger' | 'warning' | 'info' | 'inverse';
2
+ declare const LoadingDots: import("svelte").Component<{
3
+ label?: string | undefined;
4
+ size?: "xs" | "sm" | "md" | "lg" | undefined;
5
+ tone?: LoadingDotsTone | undefined;
6
+ }, {}, "">;
7
+ type LoadingDots = ReturnType<typeof LoadingDots>;
8
+ export default LoadingDots;
@@ -0,0 +1,110 @@
1
+ <script lang="ts">
2
+ import type { SeblifyProps } from 'seblify';
3
+
4
+ type SpinnerTone =
5
+ | 'neutral'
6
+ | 'primary'
7
+ | 'success'
8
+ | 'danger'
9
+ | 'warning'
10
+ | 'info'
11
+ | 'inverse';
12
+
13
+ type Props = SeblifyProps<{
14
+ label?: string;
15
+ size?: 'xs' | 'sm' | 'md' | 'lg';
16
+ tone?: SpinnerTone;
17
+ }>;
18
+
19
+ let { label = 'Loading', size, tone }: Props = $props();
20
+ </script>
21
+
22
+ <span
23
+ aria-label={label}
24
+ class:size-md={size === 'md'}
25
+ class:size-lg={size === 'lg'}
26
+ class:size-sm={size === 'sm'}
27
+ class:size-xs={size === 'xs'}
28
+ class="spinner"
29
+ data-tone={tone}
30
+ role="status"
31
+ ></span>
32
+
33
+ <style>
34
+ .spinner {
35
+ display: inline-block;
36
+ width: var(--spinner-size, var(--seblify-current-spinner-size, 26px));
37
+ height: var(--spinner-size, var(--seblify-current-spinner-size, 26px));
38
+ border: var(--spinner-width, var(--seblify-current-spinner-width, 3px))
39
+ solid var(--seblify-color-border, #c8d2df);
40
+ border-top-color: var(
41
+ --spinner-color,
42
+ var(
43
+ --seblify-current-tone-fill,
44
+ var(--seblify-color-fill-primary, #146a6f)
45
+ )
46
+ );
47
+ border-radius: 999px;
48
+ animation: spin 800ms linear infinite;
49
+ }
50
+
51
+ .size-sm {
52
+ --spinner-size: 18px;
53
+ --spinner-width: 2px;
54
+ }
55
+
56
+ .size-xs {
57
+ --spinner-size: 14px;
58
+ --spinner-width: 2px;
59
+ }
60
+
61
+ .size-md {
62
+ --spinner-size: 26px;
63
+ --spinner-width: 3px;
64
+ }
65
+
66
+ .size-lg {
67
+ --spinner-size: 38px;
68
+ --spinner-width: 4px;
69
+ }
70
+
71
+ .spinner[data-tone='neutral'] {
72
+ --spinner-color: var(--seblify-color-fill-neutral, #516176);
73
+ }
74
+
75
+ .spinner[data-tone='primary'] {
76
+ --spinner-color: var(--seblify-color-fill-primary, #146a6f);
77
+ }
78
+
79
+ .spinner[data-tone='success'] {
80
+ --spinner-color: var(--seblify-color-fill-success, #1f7a3f);
81
+ }
82
+
83
+ .spinner[data-tone='danger'] {
84
+ --spinner-color: var(--seblify-color-fill-danger, #c93434);
85
+ }
86
+
87
+ .spinner[data-tone='warning'] {
88
+ --spinner-color: var(--seblify-color-fill-warning, #8a5a00);
89
+ }
90
+
91
+ .spinner[data-tone='info'] {
92
+ --spinner-color: var(--seblify-color-fill-info, #1f6fb2);
93
+ }
94
+
95
+ .spinner[data-tone='inverse'] {
96
+ --spinner-color: var(--seblify-color-fill-inverse, #172033);
97
+ }
98
+
99
+ @keyframes spin {
100
+ to {
101
+ transform: rotate(360deg);
102
+ }
103
+ }
104
+
105
+ @media (prefers-reduced-motion: reduce) {
106
+ .spinner {
107
+ animation-duration: 1400ms;
108
+ }
109
+ }
110
+ </style>
@@ -0,0 +1,8 @@
1
+ type SpinnerTone = 'neutral' | 'primary' | 'success' | 'danger' | 'warning' | 'info' | 'inverse';
2
+ declare const Spinner: import("svelte").Component<{
3
+ label?: string | undefined;
4
+ size?: "xs" | "sm" | "md" | "lg" | undefined;
5
+ tone?: SpinnerTone | undefined;
6
+ }, {}, "">;
7
+ type Spinner = ReturnType<typeof Spinner>;
8
+ export default Spinner;
@@ -0,0 +1,41 @@
1
+ <script lang="ts">
2
+ import type { SeblifyProps, CustomCssSize } from 'seblify';
3
+ import IconGlyph from './IconGlyph.svelte';
4
+
5
+ const iconModules = import.meta.glob<string>(
6
+ '../../../../icons/svg/**/*.svg',
7
+ {
8
+ eager: true,
9
+ import: 'default',
10
+ query: '?raw',
11
+ },
12
+ );
13
+
14
+ type Props = SeblifyProps<{
15
+ label?: string;
16
+ name: string;
17
+ size?: number | CustomCssSize;
18
+ }>;
19
+
20
+ let { label, name, size }: Props = $props();
21
+ const fallbackIcon =
22
+ iconModules['../../../../icons/svg/fallback/fallback.svg'];
23
+
24
+ function iconSource(iconName: string): string {
25
+ const safeName = iconName.trim();
26
+ const folder = safeName.split('-')[0];
27
+
28
+ if (!safeName || !folder) {
29
+ return fallbackIcon;
30
+ }
31
+
32
+ return (
33
+ iconModules[`../../../../icons/svg/${folder}/${safeName}.svg`] ??
34
+ fallbackIcon
35
+ );
36
+ }
37
+
38
+ let source = $derived(iconSource(name));
39
+ </script>
40
+
41
+ <IconGlyph {label} {size} {source} />
@@ -0,0 +1,8 @@
1
+ import type { CustomCssSize } from 'seblify';
2
+ declare const Icon: import("svelte").Component<{
3
+ label?: string | undefined;
4
+ name: string;
5
+ size?: (number | CustomCssSize) | undefined;
6
+ }, {}, "">;
7
+ type Icon = ReturnType<typeof Icon>;
8
+ export default Icon;
@@ -0,0 +1,56 @@
1
+ <script lang="ts">
2
+ import type { SeblifyProps, CustomCssSize } from 'seblify';
3
+
4
+ type Props = SeblifyProps<{
5
+ label?: string;
6
+ size?: number | CustomCssSize;
7
+ source: string;
8
+ }>;
9
+
10
+ let { label, size, source }: Props = $props();
11
+
12
+ function cssSize(value?: number | string): string | undefined {
13
+ if (value === undefined) {
14
+ return undefined;
15
+ }
16
+
17
+ return typeof value === 'number' ? `${value}px` : value;
18
+ }
19
+
20
+ let sizeValue = $derived(cssSize(size));
21
+ </script>
22
+
23
+ <span
24
+ aria-hidden={label ? undefined : 'true'}
25
+ aria-label={label}
26
+ class="icon"
27
+ role={label ? 'img' : undefined}
28
+ style:--icon-size={sizeValue}
29
+ >
30
+ {@html source}
31
+ </span>
32
+
33
+ <style>
34
+ .icon {
35
+ display: inline-block;
36
+ width: var(--icon-size, var(--seblify-current-icon-size, 24px));
37
+ height: var(--icon-size, var(--seblify-current-icon-size, 24px));
38
+ flex: 0 0 auto;
39
+ color: currentColor;
40
+ line-height: 0;
41
+ }
42
+
43
+ .icon :global(svg) {
44
+ width: 100%;
45
+ height: 100%;
46
+ display: block;
47
+ }
48
+
49
+ .icon :global([fill]:not([fill='none'])) {
50
+ fill: currentColor;
51
+ }
52
+
53
+ .icon :global([stroke]:not([stroke='none'])) {
54
+ stroke: currentColor;
55
+ }
56
+ </style>
@@ -0,0 +1,8 @@
1
+ import type { CustomCssSize } from 'seblify';
2
+ declare const IconGlyph: import("svelte").Component<{
3
+ label?: string | undefined;
4
+ size?: (number | CustomCssSize) | undefined;
5
+ source: string;
6
+ }, {}, "">;
7
+ type IconGlyph = ReturnType<typeof IconGlyph>;
8
+ export default IconGlyph;
@@ -0,0 +1,48 @@
1
+ <script lang="ts">
2
+ import type { SeblifyProps } from 'seblify';
3
+ import type { Snippet } from 'svelte';
4
+
5
+ type EyebrowColor = 'accent' | 'neutral' | 'muted';
6
+
7
+ type Props = SeblifyProps<{
8
+ children?: Snippet;
9
+ color?: EyebrowColor;
10
+ }>;
11
+
12
+ let { children, color = 'accent' }: Props = $props();
13
+ </script>
14
+
15
+ <span
16
+ class:accent={color === 'accent'}
17
+ class:muted={color === 'muted'}
18
+ class:neutral={color === 'neutral'}
19
+ class="eyebrow"
20
+ >
21
+ {@render children?.()}
22
+ </span>
23
+
24
+ <style>
25
+ .eyebrow {
26
+ display: inline-flex;
27
+ max-width: 100%;
28
+ align-items: center;
29
+ color: var(--seblify-color-fill-accent, #146a6f);
30
+ font-size: 0.75rem;
31
+ font-weight: 800;
32
+ letter-spacing: 0.08em;
33
+ line-height: 1.2;
34
+ text-transform: uppercase;
35
+ }
36
+
37
+ .neutral {
38
+ color: var(--seblify-color-text, #172033);
39
+ }
40
+
41
+ .muted {
42
+ color: var(--seblify-color-text-subtle, #667085);
43
+ }
44
+
45
+ .accent {
46
+ color: var(--seblify-color-fill-accent, #146a6f);
47
+ }
48
+ </style>
@@ -0,0 +1,8 @@
1
+ import type { Snippet } from 'svelte';
2
+ type EyebrowColor = 'accent' | 'neutral' | 'muted';
3
+ declare const Eyebrow: import("svelte").Component<{
4
+ children?: Snippet | undefined;
5
+ color?: EyebrowColor | undefined;
6
+ }, {}, "">;
7
+ type Eyebrow = ReturnType<typeof Eyebrow>;
8
+ export default Eyebrow;
@@ -0,0 +1,160 @@
1
+ <script lang="ts">
2
+ import type { SeblifyProps } from 'seblify';
3
+
4
+ type HighlightTone =
5
+ | 'neutral'
6
+ | 'primary'
7
+ | 'success'
8
+ | 'danger'
9
+ | 'warning'
10
+ | 'info';
11
+ type HighlightVariant = 'soft' | 'tint' | 'plain';
12
+
13
+ interface Segment {
14
+ text: string;
15
+ match: boolean;
16
+ }
17
+
18
+ type Props = SeblifyProps<{
19
+ query?: string | string[];
20
+ text: string;
21
+ tone?: HighlightTone;
22
+ variant?: HighlightVariant;
23
+ }>;
24
+
25
+ let {
26
+ query = [],
27
+ text,
28
+ tone = 'primary',
29
+ variant = 'tint',
30
+ }: Props = $props();
31
+
32
+ function escapeRegExp(value: string): string {
33
+ return value.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
34
+ }
35
+
36
+ function normalizeQueries(value: string | string[]): string[] {
37
+ const values = Array.isArray(value) ? value : [value];
38
+
39
+ return [...new Set(values.map((item) => item.trim()).filter(Boolean))];
40
+ }
41
+
42
+ function splitSegments(
43
+ sourceText: string,
44
+ sourceQuery: string | string[],
45
+ ): Segment[] {
46
+ const queries = normalizeQueries(sourceQuery);
47
+
48
+ if (!sourceText || queries.length === 0) {
49
+ return [{ text: sourceText, match: false }];
50
+ }
51
+
52
+ const pattern = queries
53
+ .sort((left, right) => right.length - left.length)
54
+ .map(escapeRegExp)
55
+ .join('|');
56
+ const regex = new RegExp(`(${pattern})`, 'gi');
57
+ const parts = sourceText.split(regex).filter((part) => part.length > 0);
58
+
59
+ return parts.map((part) => ({
60
+ text: part,
61
+ match: queries.some(
62
+ (queryPart) => queryPart.toLowerCase() === part.toLowerCase(),
63
+ ),
64
+ }));
65
+ }
66
+
67
+ let segments = $derived(splitSegments(text, query));
68
+ </script>
69
+
70
+ <span class="highlight">
71
+ {#each segments as segment}
72
+ {#if segment.match}
73
+ <mark data-tone={tone} data-variant={variant}>{segment.text}</mark>
74
+ {:else}
75
+ {segment.text}
76
+ {/if}
77
+ {/each}
78
+ </span>
79
+
80
+ <style>
81
+ .highlight {
82
+ color: inherit;
83
+ }
84
+
85
+ mark {
86
+ --highlight-fill: var(--seblify-color-fill-primary, #146a6f);
87
+ --highlight-fill-text: var(--seblify-color-fill-primary-text, #ffffff);
88
+ --highlight-surface: var(--seblify-color-surface-accent, #f7fbfb);
89
+ --highlight-default-text: var(--seblify-color-text, currentColor);
90
+ --highlight-text: var(--seblify-color-fill-primary, #146a6f);
91
+
92
+ border-radius: 4px;
93
+ padding: 0;
94
+ color: var(--highlight-default-text);
95
+ background: var(--highlight-surface);
96
+ }
97
+
98
+ mark[data-tone='neutral'] {
99
+ --highlight-fill: var(--seblify-color-fill-neutral, #516176);
100
+ --highlight-fill-text: var(--seblify-color-fill-neutral-text, #ffffff);
101
+ --highlight-surface: var(--seblify-color-surface-muted, #d9e0e8);
102
+ --highlight-default-text: var(--seblify-color-text, #172033);
103
+ --highlight-text: var(--seblify-color-text-muted, #516176);
104
+ }
105
+
106
+ mark[data-tone='primary'] {
107
+ --highlight-fill: var(--seblify-color-fill-primary, #146a6f);
108
+ --highlight-fill-text: var(--seblify-color-fill-primary-text, #ffffff);
109
+ --highlight-surface: var(--seblify-color-surface-accent, #f7fbfb);
110
+ --highlight-default-text: var(--seblify-color-text, #172033);
111
+ --highlight-text: var(--seblify-color-fill-primary, #146a6f);
112
+ }
113
+
114
+ mark[data-tone='success'] {
115
+ --highlight-fill: var(--seblify-color-fill-success, #1f7a3f);
116
+ --highlight-fill-text: var(--seblify-color-fill-success-text, #ffffff);
117
+ --highlight-surface: var(--seblify-color-success-surface, #e8f8ee);
118
+ --highlight-default-text: var(--seblify-color-text, #172033);
119
+ --highlight-text: var(--seblify-color-success-text, #143d25);
120
+ }
121
+
122
+ mark[data-tone='danger'] {
123
+ --highlight-fill: var(--seblify-color-fill-danger, #c93434);
124
+ --highlight-fill-text: var(--seblify-color-fill-danger-text, #ffffff);
125
+ --highlight-surface: var(--seblify-color-error-surface, #fff0f0);
126
+ --highlight-default-text: var(--seblify-color-text, #172033);
127
+ --highlight-text: var(--seblify-color-error-text, #5a1717);
128
+ }
129
+
130
+ mark[data-tone='warning'] {
131
+ --highlight-fill: var(--seblify-color-fill-warning, #8a5a00);
132
+ --highlight-fill-text: var(--seblify-color-fill-warning-text, #ffffff);
133
+ --highlight-surface: var(--seblify-color-warning-surface, #fff6d8);
134
+ --highlight-default-text: var(--seblify-color-text, #172033);
135
+ --highlight-text: var(--seblify-color-warning-text, #4d3900);
136
+ }
137
+
138
+ mark[data-tone='info'] {
139
+ --highlight-fill: var(--seblify-color-fill-info, #1f6fb2);
140
+ --highlight-fill-text: var(--seblify-color-fill-info-text, #ffffff);
141
+ --highlight-surface: var(--seblify-color-info-surface, #eaf3ff);
142
+ --highlight-default-text: var(--seblify-color-text, #172033);
143
+ --highlight-text: var(--seblify-color-info-text, #102f55);
144
+ }
145
+
146
+ mark[data-variant='soft'] {
147
+ color: var(--highlight-default-text);
148
+ background: var(--highlight-surface);
149
+ }
150
+
151
+ mark[data-variant='tint'] {
152
+ color: var(--highlight-text);
153
+ background: var(--highlight-surface);
154
+ }
155
+
156
+ mark[data-variant='plain'] {
157
+ color: var(--highlight-text);
158
+ background: transparent;
159
+ }
160
+ </style>
@@ -0,0 +1,10 @@
1
+ type HighlightTone = 'neutral' | 'primary' | 'success' | 'danger' | 'warning' | 'info';
2
+ type HighlightVariant = 'soft' | 'tint' | 'plain';
3
+ declare const Highlight: import("svelte").Component<{
4
+ query?: string | string[] | undefined;
5
+ text: string;
6
+ tone?: HighlightTone | undefined;
7
+ variant?: HighlightVariant | undefined;
8
+ }, {}, "">;
9
+ type Highlight = ReturnType<typeof Highlight>;
10
+ export default Highlight;