tera-system-ui 0.0.20 → 0.0.21

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 (52) hide show
  1. package/dist/components/brand-logo/BrandLogo.svelte +31 -31
  2. package/dist/components/button/Button.svelte +49 -49
  3. package/dist/components/combobox/Combobox.svelte +8 -8
  4. package/dist/components/command/command.scss +72 -72
  5. package/dist/components/command/components/Command.svelte +120 -120
  6. package/dist/components/command/components/CommandEmpty.svelte +30 -30
  7. package/dist/components/command/components/CommandGroup.svelte +110 -110
  8. package/dist/components/command/components/CommandInput.svelte +92 -92
  9. package/dist/components/command/components/CommandItem.svelte +110 -110
  10. package/dist/components/command/components/CommandList.svelte +56 -56
  11. package/dist/components/command/components/CommandLoading.svelte +28 -28
  12. package/dist/components/command/components/CommandSeparator.svelte +21 -21
  13. package/dist/components/dialog/Dialog.astro +63 -63
  14. package/dist/components/dialog/Dialog.svelte +109 -109
  15. package/dist/components/dialog/dialog.scss +115 -115
  16. package/dist/components/header/Header.svelte +36 -36
  17. package/dist/components/header/header.scss +19 -19
  18. package/dist/components/icons/IconArrowBigRightFilled.svelte +10 -10
  19. package/dist/components/icons/IconBook.svelte +10 -10
  20. package/dist/components/icons/IconBookmarkPlus.svelte +10 -10
  21. package/dist/components/icons/IconCalculator.svelte +10 -10
  22. package/dist/components/icons/IconCheck.svelte +10 -10
  23. package/dist/components/icons/IconChevronDown.svelte +10 -10
  24. package/dist/components/icons/IconCopy.svelte +10 -10
  25. package/dist/components/icons/IconCopyCheckFilled.svelte +10 -10
  26. package/dist/components/icons/IconHamburger.svelte +10 -10
  27. package/dist/components/icons/IconLanguage.svelte +10 -10
  28. package/dist/components/icons/IconLoader2.svelte +10 -10
  29. package/dist/components/icons/IconMoon.svelte +10 -10
  30. package/dist/components/icons/IconPointFilled.svelte +10 -10
  31. package/dist/components/icons/IconSearch.svelte +10 -10
  32. package/dist/components/icons/IconSun.svelte +10 -10
  33. package/dist/components/icons/IconSwitchHorizontal.svelte +10 -10
  34. package/dist/components/icons/IconSwitchVertical.svelte +10 -10
  35. package/dist/components/icons/IconTransform.svelte +10 -10
  36. package/dist/components/icons/IconX.svelte +10 -10
  37. package/dist/components/input/Input.svelte +24 -24
  38. package/dist/components/language-picker-button/LanguagePickerButton.svelte +109 -109
  39. package/dist/components/light-dark-toggle/LightDarkToggle.svelte +36 -36
  40. package/dist/components/popover/Popover.svelte +136 -136
  41. package/dist/components/popover-responsive/PopoverResponsive.svelte +87 -87
  42. package/dist/components/side-navigation/SideNavigation.svelte +114 -114
  43. package/dist/components/side-navigation/SideNavigationItem.svelte +17 -17
  44. package/dist/components/side-navigation/SideNavigationLayout.svelte +19 -19
  45. package/dist/components/side-navigation/sidenav.scss +149 -149
  46. package/dist/components/tera-ui-context/TeraUiContext.svelte +28 -28
  47. package/dist/themes/scrollbar.scss +37 -37
  48. package/dist/themes/tera-ui-base.css +210 -210
  49. package/dist/themes/tw-preset.cjs +153 -153
  50. package/package.json +97 -96
  51. package/scripts/add-component-template.js +121 -121
  52. package/scripts/generate-ts-index.js +136 -136
@@ -1,30 +1,30 @@
1
- <script lang="ts">
2
- import {getState} from '../command.js';
3
- import type {EmptyProps} from '../types.js';
4
- import {derived} from "svelte/store";
5
- import {onMount} from "svelte";
6
-
7
- type $$Props = EmptyProps;
8
-
9
- let {children, ...restProps}: $$Props = $props()
10
-
11
- let isFirstRender = $state(true);
12
- const commandState = getState();
13
-
14
- let render = derived(commandState, ($commandState) => ($commandState.filtered.count === 0))
15
-
16
- onMount(() => {
17
- isFirstRender = false;
18
- });
19
-
20
- const attrs = {
21
- 'data-cmdk-empty': '',
22
- role: 'presentation'
23
- };
24
- </script>
25
-
26
- {#if !isFirstRender && $render}
27
- <div {...attrs} {...restProps}>
28
- {@render children?.()}
29
- </div>
30
- {/if}
1
+ <script lang="ts">
2
+ import {getState} from '../command.js';
3
+ import type {EmptyProps} from '../types.js';
4
+ import {derived} from "svelte/store";
5
+ import {onMount} from "svelte";
6
+
7
+ type $$Props = EmptyProps;
8
+
9
+ let {children, ...restProps}: $$Props = $props()
10
+
11
+ let isFirstRender = $state(true);
12
+ const commandState = getState();
13
+
14
+ let render = derived(commandState, ($commandState) => ($commandState.filtered.count === 0))
15
+
16
+ onMount(() => {
17
+ isFirstRender = false;
18
+ });
19
+
20
+ const attrs = {
21
+ 'data-cmdk-empty': '',
22
+ role: 'presentation'
23
+ };
24
+ </script>
25
+
26
+ {#if !isFirstRender && $render}
27
+ <div {...attrs} {...restProps}>
28
+ {@render children?.()}
29
+ </div>
30
+ {/if}
@@ -1,110 +1,110 @@
1
- <script lang="ts">
2
- import {generateId} from '../../../internal/index.js';
3
- import {derived} from 'svelte/store';
4
- import {createGroup, getCtx, getState, VALUE_ATTR} from '../command.js';
5
- import type {GroupProps} from '../types.js';
6
- import {onMount} from 'svelte';
7
-
8
- type $$Props = GroupProps;
9
-
10
- let {
11
- children,
12
- heading,
13
- value = '',
14
- alwaysRender = false,
15
- ...restProps
16
- }: $$Props = $props()
17
-
18
- const {id} = createGroup(alwaysRender);
19
-
20
- const context = getCtx();
21
- const commandState = getState();
22
- const headingId = generateId();
23
-
24
- const render = derived(commandState, ($state) => {
25
- if (alwaysRender) return true;
26
- if (context.filter() === false) return true;
27
- if (!$commandState.search) return true;
28
- return $commandState.filtered.groups.has(id);
29
- });
30
-
31
-
32
- onMount(() => {
33
- const unsubGroup = context.group(id);
34
- return unsubGroup;
35
- });
36
-
37
-
38
- function containerAction(node: HTMLElement) {
39
-
40
- if (value) {
41
- context.value(id, value);
42
- node.setAttribute(VALUE_ATTR, value);
43
- return;
44
- }
45
-
46
- if (heading) {
47
- value = heading.trim().toLowerCase();
48
- } else if (node.textContent) {
49
- value = node.textContent.trim().toLowerCase();
50
- }
51
-
52
- context.value(id, value);
53
- node.setAttribute(VALUE_ATTR, value);
54
- }
55
-
56
- let containerAttrs = $state()
57
-
58
- $effect(() => {
59
- containerAttrs = {
60
- 'data-cmdk-group': '',
61
- role: 'presentation',
62
- hidden: $render ? undefined : true,
63
- 'data-value': value
64
- }
65
- })
66
-
67
-
68
- const headingAttrs = {
69
- 'data-cmdk-group-heading': '',
70
- 'aria-hidden': true,
71
- id: headingId
72
- };
73
-
74
- let groupAttrs = $state()
75
- $effect(() => {
76
- groupAttrs = {
77
- 'data-cmdk-group-items': '',
78
- role: 'group',
79
- 'aria-labelledby': heading ? headingId : undefined
80
- };
81
- })
82
-
83
- let container = $state()
84
- $effect(() => {
85
- container = {
86
- action: containerAction,
87
- attrs: containerAttrs
88
- };
89
- })
90
-
91
-
92
- let group = $state()
93
- $effect(() => {
94
- group = {
95
- attrs: groupAttrs
96
- };
97
- })
98
- </script>
99
-
100
- <div use:containerAction {...containerAttrs} {...restProps}>
101
- {#if heading}
102
- <div {...headingAttrs}>
103
- {heading}
104
- </div>
105
- {/if}
106
- <div {...groupAttrs}>
107
- <!-- <slot {container} {group} heading={{ attrs: headingAttrs }}/>-->
108
- {@render children?.()}
109
- </div>
110
- </div>
1
+ <script lang="ts">
2
+ import {generateId} from '../../../internal/index.js';
3
+ import {derived} from 'svelte/store';
4
+ import {createGroup, getCtx, getState, VALUE_ATTR} from '../command.js';
5
+ import type {GroupProps} from '../types.js';
6
+ import {onMount} from 'svelte';
7
+
8
+ type $$Props = GroupProps;
9
+
10
+ let {
11
+ children,
12
+ heading,
13
+ value = '',
14
+ alwaysRender = false,
15
+ ...restProps
16
+ }: $$Props = $props()
17
+
18
+ const {id} = createGroup(alwaysRender);
19
+
20
+ const context = getCtx();
21
+ const commandState = getState();
22
+ const headingId = generateId();
23
+
24
+ const render = derived(commandState, ($state) => {
25
+ if (alwaysRender) return true;
26
+ if (context.filter() === false) return true;
27
+ if (!$commandState.search) return true;
28
+ return $commandState.filtered.groups.has(id);
29
+ });
30
+
31
+
32
+ onMount(() => {
33
+ const unsubGroup = context.group(id);
34
+ return unsubGroup;
35
+ });
36
+
37
+
38
+ function containerAction(node: HTMLElement) {
39
+
40
+ if (value) {
41
+ context.value(id, value);
42
+ node.setAttribute(VALUE_ATTR, value);
43
+ return;
44
+ }
45
+
46
+ if (heading) {
47
+ value = heading.trim().toLowerCase();
48
+ } else if (node.textContent) {
49
+ value = node.textContent.trim().toLowerCase();
50
+ }
51
+
52
+ context.value(id, value);
53
+ node.setAttribute(VALUE_ATTR, value);
54
+ }
55
+
56
+ let containerAttrs = $state()
57
+
58
+ $effect(() => {
59
+ containerAttrs = {
60
+ 'data-cmdk-group': '',
61
+ role: 'presentation',
62
+ hidden: $render ? undefined : true,
63
+ 'data-value': value
64
+ }
65
+ })
66
+
67
+
68
+ const headingAttrs = {
69
+ 'data-cmdk-group-heading': '',
70
+ 'aria-hidden': true,
71
+ id: headingId
72
+ };
73
+
74
+ let groupAttrs = $state()
75
+ $effect(() => {
76
+ groupAttrs = {
77
+ 'data-cmdk-group-items': '',
78
+ role: 'group',
79
+ 'aria-labelledby': heading ? headingId : undefined
80
+ };
81
+ })
82
+
83
+ let container = $state()
84
+ $effect(() => {
85
+ container = {
86
+ action: containerAction,
87
+ attrs: containerAttrs
88
+ };
89
+ })
90
+
91
+
92
+ let group = $state()
93
+ $effect(() => {
94
+ group = {
95
+ attrs: groupAttrs
96
+ };
97
+ })
98
+ </script>
99
+
100
+ <div use:containerAction {...containerAttrs} {...restProps}>
101
+ {#if heading}
102
+ <div {...headingAttrs}>
103
+ {heading}
104
+ </div>
105
+ {/if}
106
+ <div {...groupAttrs}>
107
+ <!-- <slot {container} {group} heading={{ attrs: headingAttrs }}/>-->
108
+ {@render children?.()}
109
+ </div>
110
+ </div>
@@ -1,93 +1,93 @@
1
- <script lang="ts">
2
- import {derived, get} from 'svelte/store';
3
- import {getCtx, getState, ITEM_SELECTOR, VALUE_ATTR} from '../command.js';
4
- import {isBrowser} from '../../../internal/index.js';
5
- import type {InputEvents, InputProps} from '../types.js';
6
- import {sleep} from '../../../internal/helpers/sleep.js';
7
- import {styles} from "../../input/Input";
8
- import {IconSearch} from "../../..";
9
-
10
- type $$Props = InputProps;
11
- type $$Events = InputEvents;
12
-
13
- const {ids, commandEl} = getCtx();
14
- const commandState = getState();
15
-
16
- const valueStore = derived(commandState, ($commandState) => $commandState.value);
17
-
18
- let {
19
- autofocus = undefined,
20
- value = $bindable(),
21
- el,
22
- class: className,
23
- ...restProps
24
- }: $$Props & {
25
- el?: HTMLElement
26
- } = $props()
27
-
28
-
29
- const selectedItemId = derived([valueStore, commandEl], ([$value, $commandEl]) => {
30
- if (!isBrowser) return undefined;
31
- const item = $commandEl?.querySelector(`${ITEM_SELECTOR}[${VALUE_ATTR}="${$value}"]`);
32
- return item?.getAttribute('id');
33
- });
34
-
35
- function handleValueUpdate(v: string) {
36
- commandState.updateState('search', v);
37
- }
38
-
39
- function action(node: HTMLInputElement) {
40
- if (autofocus) {
41
- sleep(200).then(() => {
42
- node.focus()
43
- console.log('CommandInput autofocus')
44
- });
45
- }
46
- }
47
-
48
- let attrs = $state<Record<string, unknown>>()
49
-
50
- $effect(() => {
51
- attrs = {
52
- type: 'text',
53
- 'data-cmdk-input': '',
54
- autocomplete: 'off',
55
- autocorrect: 'off',
56
- spellcheck: false,
57
- 'aria-autocomplete': 'list',
58
- role: 'combobox',
59
- 'aria-expanded': true,
60
- 'aria-controls': ids.list,
61
- 'aria-labelledby': ids.label,
62
- 'aria-activedescendant': $selectedItemId ?? undefined,
63
- id: ids.input
64
- };
65
- })
66
-
67
- $effect(() => {
68
- return () => {
69
- value = ''
70
- }
71
- })
72
- </script>
73
-
74
- <div class="relative">
75
- <input
76
- class={styles({
77
- variant: 'borderless',
78
- size: 'lg',
79
- class: className + ' pl-9 border-b border-b-neutral-token-5 rounded-none text-sm',
80
- })}
81
- bind:this={el}
82
- {...attrs}
83
- bind:value={value}
84
- use:action
85
- {...restProps}
86
- onkeydown={() => {}}
87
- oninput={() => {handleValueUpdate(value)}}
88
- onfocus={() => {}}
89
- onblur={() => {}}
90
- onchange={() => {}}
91
- />
92
- <IconSearch class="absolute top-1/2 left-2 -translate-y-1/2 size-icon-xs opacity-60"/>
1
+ <script lang="ts">
2
+ import {derived, get} from 'svelte/store';
3
+ import {getCtx, getState, ITEM_SELECTOR, VALUE_ATTR} from '../command.js';
4
+ import {isBrowser} from '../../../internal/index.js';
5
+ import type {InputEvents, InputProps} from '../types.js';
6
+ import {sleep} from '../../../internal/helpers/sleep.js';
7
+ import {styles} from "../../input/Input";
8
+ import {IconSearch} from "../../..";
9
+
10
+ type $$Props = InputProps;
11
+ type $$Events = InputEvents;
12
+
13
+ const {ids, commandEl} = getCtx();
14
+ const commandState = getState();
15
+
16
+ const valueStore = derived(commandState, ($commandState) => $commandState.value);
17
+
18
+ let {
19
+ autofocus = undefined,
20
+ value = $bindable(),
21
+ el,
22
+ class: className,
23
+ ...restProps
24
+ }: $$Props & {
25
+ el?: HTMLElement,
26
+ } = $props()
27
+
28
+
29
+ const selectedItemId = derived([valueStore, commandEl], ([$value, $commandEl]) => {
30
+ if (!isBrowser) return undefined;
31
+ const item = $commandEl?.querySelector(`${ITEM_SELECTOR}[${VALUE_ATTR}="${$value}"]`);
32
+ return item?.getAttribute('id');
33
+ });
34
+
35
+ function handleValueUpdate(v: string) {
36
+ commandState.updateState('search', v);
37
+ }
38
+
39
+ function action(node: HTMLInputElement) {
40
+ if (autofocus) {
41
+ sleep(200).then(() => {
42
+ node.focus()
43
+ console.log('CommandInput autofocus')
44
+ });
45
+ }
46
+ }
47
+
48
+ let attrs = $state<Record<string, unknown>>()
49
+
50
+ $effect(() => {
51
+ attrs = {
52
+ type: 'text',
53
+ 'data-cmdk-input': '',
54
+ autocomplete: 'off',
55
+ autocorrect: 'off',
56
+ spellcheck: false,
57
+ 'aria-autocomplete': 'list',
58
+ role: 'combobox',
59
+ 'aria-expanded': true,
60
+ 'aria-controls': ids.list,
61
+ 'aria-labelledby': ids.label,
62
+ 'aria-activedescendant': $selectedItemId ?? undefined,
63
+ id: ids.input
64
+ };
65
+ })
66
+
67
+ $effect(() => {
68
+ return () => {
69
+ value = ''
70
+ }
71
+ })
72
+ </script>
73
+
74
+ <div class="relative">
75
+ <input
76
+ class={styles({
77
+ variant: 'borderless',
78
+ size: 'lg',
79
+ class: className + ' pl-9 border-b border-b-neutral-token-5 rounded-none text-sm',
80
+ })}
81
+ bind:this={el}
82
+ {...attrs}
83
+ bind:value={value}
84
+ use:action
85
+ {...restProps}
86
+ onkeydown={() => {}}
87
+ oninput={() => {handleValueUpdate(value)}}
88
+ onfocus={() => {}}
89
+ onblur={() => {}}
90
+ onchange={() => {}}
91
+ />
92
+ <IconSearch class="absolute top-1/2 left-2 -translate-y-1/2 size-icon-xs opacity-60"/>
93
93
  </div>