@lavalogic/scoria 0.24.0 → 0.25.1

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 (31) hide show
  1. package/dist/Components/Base/ContextWrapper.svelte +1 -0
  2. package/dist/Components/Base/Pagination.svelte +28 -7
  3. package/dist/Components/Base/Pagination.svelte.d.ts +8 -0
  4. package/dist/Components/Base/PaginationProps.d.ts +4 -2
  5. package/dist/Components/Base/Snippets.svelte +3 -0
  6. package/dist/Components/Base/Snippets.svelte.d.ts +1 -0
  7. package/dist/Components/Contexts/ContextMenu.svelte +87 -8
  8. package/dist/Components/Contexts/ContextMenuOption.svelte +35 -9
  9. package/dist/Components/Contexts/ContextMenuOptionProps.d.ts +1 -0
  10. package/dist/Components/Contexts/MaybeFocusable.d.ts +3 -0
  11. package/dist/Components/Contexts/MaybeFocusable.js +1 -0
  12. package/dist/Components/Contexts/Toast.svelte +18 -10
  13. package/dist/Components/HorizontalTabGroup.svelte +0 -23
  14. package/dist/Components/NumberInput.svelte +13 -8
  15. package/dist/Components/Table/Body/Rows/Columns/TableDatePicker.svelte +28 -20
  16. package/dist/Components/Table/Body/Rows/Columns/TableQuerySelect.svelte +22 -53
  17. package/dist/Components/Table/Body/Rows/Columns/TableSelect.svelte +32 -23
  18. package/dist/Components/Table/Body/Rows/TableRow.svelte +86 -60
  19. package/dist/Components/Table/Body/Rows/TableRow.svelte.d.ts +22 -13
  20. package/dist/Components/Table/Body/TableBody.svelte +23 -28
  21. package/dist/Components/Table/Body/TableBody.svelte.d.ts +10 -2
  22. package/dist/Components/Table/Body/TableBodyProps.d.ts +2 -0
  23. package/dist/Components/Table/ColumnDefinitions/ExampleItemColumnDefRepository.svelte.js +8 -8
  24. package/dist/Components/Table/Table.svelte +54 -56
  25. package/dist/Components/Table/Types/Columns/Definitions/ColumnDef.svelte.d.ts +2 -2
  26. package/dist/Components/Table/Types/Context/TableContext.svelte.d.ts +1 -1
  27. package/dist/Components/Table/Types/Context/TableContext.svelte.js +4 -1
  28. package/dist/Components/Touch/NumberKeyboard.svelte +58 -19
  29. package/dist/Components/VerticalTabGroup.svelte +1 -29
  30. package/dist/Types/Internal/TabOption.d.ts +0 -1
  31. package/package.json +1 -1
@@ -34,6 +34,7 @@
34
34
  setContext(AlertContext.identifier, alertContext);
35
35
 
36
36
  // NOTE known limitation. Not expected to mutate after instantiation
37
+ // svelte-ignore state_referenced_locally
37
38
  const untypedListenerContext = new UntypedInputContext(debug);
38
39
  setContext(UntypedInputContext.identifier, untypedListenerContext);
39
40
  </script>
@@ -1,6 +1,17 @@
1
1
  <svelte:options runes />
2
2
 
3
- <script lang="ts" generics="T extends object">
3
+ <!-- @component
4
+ Allows for automated pagination of local content in cases where a collection may become a performance concern
5
+
6
+ ### Usage
7
+ ```svelte
8
+ <Pagination snippet={itemSnippet} pageSize={20} items={dataWrapper.value} key="id" />
9
+ ```
10
+ -->
11
+ <script
12
+ lang="ts"
13
+ generics="T extends object"
14
+ >
4
15
  import { autoPluralise, generateShortUUID } from '../../Helpers/Helpers.svelte.js';
5
16
  import { Colour } from '../../scss/colours.js';
6
17
  import { Side } from '../../Types/Internal/Side.js';
@@ -20,7 +31,7 @@
20
31
  border = false,
21
32
  padding = '1.5rem', //sizing.$regular-padding
22
33
  gap = '1.5rem', // sizing.$regular-gap
23
- height
34
+ height,
24
35
  }: PaginationProps<T> = $props();
25
36
 
26
37
  const _uuid = generateShortUUID();
@@ -101,18 +112,28 @@
101
112
 
102
113
  <div class="scrollable">
103
114
  <div class="block">
104
- <Icon name="paper" colour={Colour['$ui-blue-6']} />
115
+ <Icon
116
+ name="paper"
117
+ colour={Colour['$ui-blue-6']}
118
+ />
105
119
  <span>{lastPage} {autoPluralise('Page', lastPage)}</span>
106
120
  </div>
107
121
 
108
122
  <div class="block">
109
123
  <label for="{_uuid}-jump-to-page"
110
- ><Icon name="arrow-move-horizontal" colour={Colour['$ui-blue-6']} /></label
124
+ ><Icon
125
+ name="arrow-move-horizontal"
126
+ colour={Colour['$ui-blue-6']}
127
+ /></label
111
128
  >
112
129
 
113
130
  <label for="{_uuid}-jump-to-page">Jump to page:</label>
114
131
 
115
- <NumberInput id="{_uuid}-jump-to-page" value={pageValue} oninput={onNumberInput} />
132
+ <NumberInput
133
+ id="{_uuid}-jump-to-page"
134
+ value={pageValue}
135
+ oninput={onNumberInput}
136
+ />
116
137
  </div>
117
138
 
118
139
  <div class="block nopad page-arrow">
@@ -126,7 +147,7 @@
126
147
  size={Size.FillHeight}
127
148
  iconLeft={{
128
149
  name: 'left-close',
129
- size: Size.FillHeight
150
+ size: Size.FillHeight,
130
151
  }}>Previous Page</Button
131
152
  >
132
153
  </div>
@@ -158,7 +179,7 @@
158
179
  disabled={pageIndex == lastPageIndex}
159
180
  iconRight={{
160
181
  name: 'right-close',
161
- size: Size.FillHeight
182
+ size: Size.FillHeight,
162
183
  }}>Next Page</Button
163
184
  >
164
185
  </div>
@@ -20,6 +20,14 @@ interface $$IsomorphicComponent {
20
20
  <T extends object>(internal: unknown, props: ReturnType<__sveltets_Render<T>['props']> & {}): ReturnType<__sveltets_Render<T>['exports']>;
21
21
  z_$$bindings?: ReturnType<__sveltets_Render<any>['bindings']>;
22
22
  }
23
+ /**
24
+ * Allows for automated pagination of local content in cases where a collection may become a performance concern
25
+ *
26
+ * ### Usage
27
+ * ```svelte
28
+ * <Pagination snippet={itemSnippet} pageSize={20} items={dataWrapper.value} key="id" />
29
+ * ```
30
+ */
23
31
  declare const Pagination: $$IsomorphicComponent;
24
32
  type Pagination<T extends object> = InstanceType<typeof Pagination<T>>;
25
33
  export default Pagination;
@@ -1,9 +1,11 @@
1
1
  import type { Snippet } from 'svelte';
2
2
  export interface PaginationProps<T extends object> {
3
- items: Array<T>;
3
+ /** Used to index each item for a unique key. Duplicate values will result in error */
4
4
  key: string & keyof T;
5
- pageSize?: number;
5
+ items: Array<T>;
6
+ /** Second argument is the index */
6
7
  snippet: Snippet<[T, number]>;
8
+ pageSize?: number;
7
9
  itemName?: string;
8
10
  border?: boolean;
9
11
  padding?: string;
@@ -1,5 +1,8 @@
1
1
  <svelte:options runes />
2
2
 
3
+ <!-- @component
4
+ An empty component that only exists to export common snippets
5
+ -->
3
6
  <script
4
7
  lang="ts"
5
8
  module
@@ -1,5 +1,6 @@
1
1
  export declare const pending: () => ReturnType<import("svelte").Snippet>;
2
2
  export declare const failed: (e: unknown, retry?: () => void) => ReturnType<import("svelte").Snippet>;
3
+ /** An empty component that only exists to export common snippets */
3
4
  declare const Snippets: import("svelte").Component<Record<string, never>, {}, "">;
4
5
  type Snippets = ReturnType<typeof Snippets>;
5
6
  export default Snippets;
@@ -1,11 +1,17 @@
1
1
  <svelte:options runes />
2
2
 
3
+ <!--
4
+ @component
5
+
6
+
7
+ -->
3
8
  <script lang="ts">
4
9
  import { ContextMenuContext } from '../../Contexts/ContextMenuContext.svelte.js';
5
10
  import { devCatch } from '../../Helpers/Helpers.svelte.js';
6
- import { getContext, tick } from 'svelte';
11
+ import { getContext, tick, untrack } from 'svelte';
7
12
  import { fade } from 'svelte/transition';
8
13
  import ContextMenuOption from './ContextMenuOption.svelte';
14
+ import type { MaybeFocusable } from './MaybeFocusable.js';
9
15
 
10
16
  const contextMenuContext = getContext<ContextMenuContext>(ContextMenuContext.identifier);
11
17
 
@@ -36,8 +42,8 @@
36
42
  .catch(devCatch);
37
43
  }
38
44
 
39
- let menuEl: HTMLDivElement | undefined = $state();
40
- function onPageClick(e: MouseEvent) {
45
+ let menuEl = $state<HTMLUListElement | undefined>();
46
+ function closeOnClickOutside(e: MouseEvent) {
41
47
  if (!menuEl) {
42
48
  return;
43
49
  }
@@ -46,14 +52,81 @@
46
52
  }
47
53
  contextMenuContext.closeMenu();
48
54
  }
55
+
56
+ let previousElement = $state<MaybeFocusable | null | undefined>();
57
+
58
+ $effect.pre(() => {
59
+ if (contextMenuContext.showMenu) {
60
+ untrack(() => {
61
+ previousElement = document.activeElement as MaybeFocusable;
62
+ });
63
+ }
64
+ });
65
+
66
+ function refocusPrevious() {
67
+ previousElement?.focus?.();
68
+ }
69
+
70
+ function focusNext() {
71
+ if (!menuEl) {
72
+ return;
73
+ }
74
+ const items = [...menuEl.querySelectorAll<HTMLElement>('[role="menuitem"]')];
75
+ const index = items.indexOf(document.activeElement as HTMLElement);
76
+ const found = items.at((index + 1) % items.length);
77
+ if (!found) {
78
+ console.warn(`could not find next item`);
79
+ }
80
+ found?.focus();
81
+ }
82
+
83
+ function focusPrev() {
84
+ if (!menuEl) {
85
+ return;
86
+ }
87
+ const items = [...menuEl.querySelectorAll<HTMLElement>('[role="menuitem"]')];
88
+ const index = items.indexOf(document.activeElement as HTMLElement);
89
+
90
+ const found = items.at((index - 1 + items.length) % items.length);
91
+ if (!found) {
92
+ console.warn('could not find prev item');
93
+ }
94
+ found?.focus();
95
+ }
49
96
  </script>
50
97
 
51
- <svelte:body onclick={onPageClick} />
98
+ <svelte:body onclick={closeOnClickOutside} />
52
99
 
53
100
  {#if contextMenuContext.showMenu}
54
- <div transition:fade={{ duration: 50 }} bind:this={menuEl} style="top: {_y}px; left: {_x}px;">
55
- {#each contextMenuContext.items as item (item)}
101
+ <ul
102
+ transition:fade={{ duration: 50 }}
103
+ bind:this={menuEl}
104
+ style="top: {_y}px; left: {_x}px;"
105
+ role="menu"
106
+ aria-label="Context menu"
107
+ onkeydown={(e) => {
108
+ if (e.key === 'Escape') {
109
+ e.stopImmediatePropagation();
110
+ e.stopPropagation();
111
+ e.preventDefault();
112
+ contextMenuContext.closeMenu();
113
+ refocusPrevious();
114
+ } else if (e.key == 'ArrowUp') {
115
+ e.stopImmediatePropagation();
116
+ e.stopPropagation();
117
+ e.preventDefault();
118
+ focusPrev();
119
+ } else if (e.key == 'ArrowDown') {
120
+ e.stopImmediatePropagation();
121
+ e.stopPropagation();
122
+ e.preventDefault();
123
+ focusNext();
124
+ }
125
+ }}
126
+ >
127
+ {#each contextMenuContext.items as item, index (item)}
56
128
  <ContextMenuOption
129
+ {index}
57
130
  disabled={item.disabled}
58
131
  onclick={() => {
59
132
  item.callback();
@@ -62,17 +135,23 @@
62
135
  text={item.text}
63
136
  />
64
137
  {/each}
65
- </div>
138
+ </ul>
66
139
  {/if}
67
140
 
68
141
  <style>
69
- div {
142
+ ul {
143
+ padding: 4px;
70
144
  position: fixed;
71
145
  display: grid;
72
146
  border: 1px solid #0003;
73
147
  box-shadow: 2px 2px 5px 0px #0002;
148
+ gap: 4px;
74
149
  background: white;
75
150
  z-index: 9999;
76
151
  line-height: initial;
77
152
  }
153
+
154
+ ul:focus {
155
+ outline: none;
156
+ }
78
157
  </style>
@@ -1,21 +1,40 @@
1
1
  <svelte:options runes />
2
2
 
3
3
  <script lang="ts">
4
+ import { devCatch } from '../../Helpers/Helpers.svelte.js';
5
+ import { tick } from 'svelte';
4
6
  import type { ContextMenuOptionProps } from './ContextMenuOptionProps.js';
5
7
 
6
8
  let {
7
9
  text = $bindable(''),
10
+ index,
8
11
  disabled = false,
9
12
  onclick,
10
- children
13
+ children,
11
14
  }: ContextMenuOptionProps = $props();
15
+
16
+ let element = $state<HTMLButtonElement | undefined>();
17
+
18
+ $effect(() => {
19
+ void element;
20
+ if (index == 0) {
21
+ tick()
22
+ .then(() => {
23
+ if (element) {
24
+ element.focus();
25
+ }
26
+ })
27
+ .catch(devCatch);
28
+ }
29
+ });
12
30
  </script>
13
31
 
14
- <!-- svelte-ignore a11y_click_events_have_key_events -->
15
- <!-- svelte-ignore a11y_no_static_element_interactions -->
16
- <div
32
+ <button
17
33
  class="context-menu-item"
34
+ role="menuitem"
18
35
  class:disabled
36
+ tabindex={index}
37
+ bind:this={element}
19
38
  onclick={(e) => {
20
39
  e.stopImmediatePropagation();
21
40
  e.stopPropagation();
@@ -28,9 +47,11 @@
28
47
  {:else if children}
29
48
  {@render children()}
30
49
  {/if}
31
- </div>
50
+ </button>
32
51
 
33
- <style>div {
52
+ <style>button {
53
+ background-color: #ffffff;
54
+ border: none;
34
55
  padding: 4px 15px;
35
56
  cursor: default;
36
57
  font-size: 14px;
@@ -40,14 +61,19 @@
40
61
  user-select: none;
41
62
  }
42
63
 
43
- div:hover {
64
+ button:focus,
65
+ button:focus-within {
66
+ outline: solid 1px #259fc7;
67
+ }
68
+
69
+ button:hover {
44
70
  background: rgba(0, 0, 0, 0.1333333333);
45
71
  }
46
72
 
47
- div.disabled {
73
+ button.disabled {
48
74
  color: rgba(0, 0, 0, 0.4);
49
75
  }
50
76
 
51
- div.disabled:hover {
77
+ button.disabled:hover {
52
78
  background: #ffffff;
53
79
  }</style>
@@ -1,5 +1,6 @@
1
1
  import type { Snippet } from 'svelte';
2
2
  export interface ContextMenuOptionProps {
3
+ index: number;
3
4
  text?: string;
4
5
  disabled?: boolean | undefined;
5
6
  onclick?: (e: MouseEvent) => void;
@@ -0,0 +1,3 @@
1
+ export interface MaybeFocusable {
2
+ focus?: () => void;
3
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -1,6 +1,9 @@
1
1
  <svelte:options runes />
2
2
 
3
- <script lang="ts" module>
3
+ <script
4
+ lang="ts"
5
+ module
6
+ >
4
7
  import { ColourSet } from '../../scss/colours.js';
5
8
  import { Size } from '../../Types/Internal/Size.js';
6
9
  import { Validity } from '../../Types/Internal/Validity.js';
@@ -14,7 +17,9 @@
14
17
  let { toast, copy }: ToastProps = $props();
15
18
  </script>
16
19
 
17
- <article
20
+ <output
21
+ role={toast.result == Validity.Invalid ? 'alert' : 'status'}
22
+ aria-live={toast.result == Validity.Invalid ? 'assertive' : 'polite'}
18
23
  class:info={toast.result == Validity.Info}
19
24
  class:success={toast.result == Validity.Valid}
20
25
  class:warning={toast.result == Validity.Warning}
@@ -31,7 +36,10 @@
31
36
  colourSet={ColourSet.Auxiliary}
32
37
  />
33
38
  {:else}
34
- <Icon name="info" size={Size.MediumLarge} />
39
+ <Icon
40
+ name="info"
41
+ size={Size.MediumLarge}
42
+ />
35
43
  {/if}
36
44
  </div>
37
45
  <span>{toast.message}</span>
@@ -48,36 +56,36 @@
48
56
  </div>
49
57
  {/if}
50
58
  </div>
51
- </article>
59
+ </output>
52
60
 
53
- <style>article {
61
+ <style>output {
54
62
  font-weight: 700;
55
63
  font-size: 1.125rem;
56
64
  padding: 0.75rem;
57
65
  border-radius: 4px;
58
66
  }
59
- article.info, article.success {
67
+ output.info, output.success {
60
68
  color: #ffffff;
61
69
  --colour: #ffffff;
62
70
  background-color: #259fc7;
63
71
  }
64
- article.warning {
72
+ output.warning {
65
73
  color: #ffffff;
66
74
  --colour: #ffffff;
67
75
  background-color: #e7b500;
68
76
  }
69
- article.error {
77
+ output.error {
70
78
  color: #ffffff;
71
79
  --colour: #ffffff;
72
80
  background-color: #aa1414;
73
81
  }
74
- article > div {
82
+ output > div {
75
83
  display: flex;
76
84
  flex-flow: row nowrap;
77
85
  gap: 0.75rem;
78
86
  align-items: center;
79
87
  }
80
- article span {
88
+ output span {
81
89
  text-wrap: nowrap;
82
90
  word-break: keep-all;
83
91
  overflow: hidden;
@@ -4,8 +4,6 @@
4
4
  lang="ts"
5
5
  generics="CommonDenominator"
6
6
  >
7
- import { dev } from '$app/environment';
8
-
9
7
  import HorizontalTabGroupButton from './HorizontalTabGroupButton.svelte';
10
8
  import type { HorizontalTabGroupProps } from './HorizontalTabGroupProps.js';
11
9
  let {
@@ -16,27 +14,6 @@
16
14
  noRadius = false,
17
15
  grow = false,
18
16
  }: HorizontalTabGroupProps<CommonDenominator> = $props();
19
-
20
- $effect(() => {
21
- if (!dev) {
22
- return;
23
- }
24
- for (const tab of tabs) {
25
- if (tab.debug) {
26
- $inspect(
27
- tab.label,
28
- tab.content,
29
- tab.onclick,
30
- tab.args,
31
- tab.iconLeft,
32
- tab.iconRight,
33
- tab.isValid,
34
- tab.disabled,
35
- tab.visible
36
- );
37
- }
38
- }
39
- });
40
17
  </script>
41
18
 
42
19
  <div
@@ -31,11 +31,10 @@
31
31
  oninput,
32
32
 
33
33
  inputRef = $bindable(),
34
- 'data-type': dataType
34
+ 'data-type': dataType,
35
35
  }: NumberInputProps = $props();
36
36
 
37
- // HACK cannot alter signature because it's passed by a use: directive
38
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
37
+ // NOTE cannot alter signature because it's passed by a use: directive
39
38
  function numberValidator(_node: HTMLInputElement, _newValue: number | null) {
40
39
  return {
41
40
  update(newValue: number) {
@@ -43,7 +42,7 @@
43
42
  const overMaximum = max != undefined && max < newValue;
44
43
 
45
44
  value = isNaN(newValue) ? 0 : underMinimum ? min : overMaximum ? max : newValue;
46
- }
45
+ },
47
46
  };
48
47
  }
49
48
 
@@ -69,13 +68,18 @@
69
68
  >{labelTop}{#if optional}<i>&nbsp;- optional</i>{/if}</span
70
69
  >
71
70
  {#if variant === InputVariant.Default}
72
- <span class="border" class:invalid={isInvalid}
71
+ <span
72
+ class="border"
73
+ class:invalid={isInvalid}
73
74
  >{labelTop}{#if optional}<i>&nbsp;- optional</i>{/if}</span
74
75
  >
75
76
  {/if}
76
77
  {/if}
77
78
  <!-- style="--background-colour: {leftIcon?.backgroundColour ?? rightIcon?.backgroundColour};" -->
78
- <div class="icon-container" class:for-modal={variant == InputVariant.Modal}>
79
+ <div
80
+ class="icon-container"
81
+ class:for-modal={variant == InputVariant.Modal}
82
+ >
79
83
  {#if leftIcon}
80
84
  <Icon
81
85
  name={leftIcon.name}
@@ -128,8 +132,9 @@
128
132
  />
129
133
  {/if}
130
134
  {#if labelRight}
131
- <span class="right-label inset" class:for-modal={variant == InputVariant.Modal}
132
- >{labelRight}</span
135
+ <span
136
+ class="right-label inset"
137
+ class:for-modal={variant == InputVariant.Modal}>{labelRight}</span
133
138
  >
134
139
  {/if}
135
140
  </div>
@@ -46,29 +46,37 @@
46
46
  tableContext.focusStartIsBeingEdited
47
47
  );
48
48
 
49
+ function handleEditable(isEditable: boolean): Promise<void> {
50
+ if (isEditable) {
51
+ return tick().then(() => {
52
+ modalLock = true;
53
+ });
54
+ } else {
55
+ if (modalLock) {
56
+ return tick().then(() => {
57
+ if (!tableContext.singleClickEditing) {
58
+ tableContext.focusStartIsBeingEdited = false;
59
+ }
60
+ modalLock = false;
61
+ });
62
+ }
63
+
64
+ return Promise.resolve();
65
+ }
66
+ }
67
+
49
68
  $effect(() => {
50
69
  void editable;
51
70
  if (wantsToBeEdited) {
52
- editable
53
- .then((isEditable) => {
54
- if (isEditable) {
55
- return tick().then(() => {
56
- modalLock = true;
57
- });
58
- } else {
59
- if (modalLock) {
60
- return tick().then(() => {
61
- if (!tableContext.singleClickEditing) {
62
- tableContext.focusStartIsBeingEdited = false;
63
- }
64
- modalLock = false;
65
- });
66
- }
67
-
68
- return;
69
- }
70
- })
71
- .catch(devCatch);
71
+ if (editable instanceof Promise) {
72
+ editable
73
+ .then((isEditable) => {
74
+ return handleEditable(isEditable);
75
+ })
76
+ .catch(devCatch);
77
+ } else {
78
+ handleEditable(editable).catch(devCatch);
79
+ }
72
80
  } else {
73
81
  tick()
74
82
  .then(() => {
@@ -89,71 +89,40 @@
89
89
 
90
90
  let isBeingEdited = $state(false);
91
91
 
92
- /*
93
- $effect(() => {
94
- void editable;
95
- if (wantsToBeEdited) {
96
- if (editable) {
97
- tick()
98
- .then(() => {
99
- untrack(() => {
100
- isBeingEdited = true;
101
- });
102
- })
103
- .catch(devCatch);
104
- } else {
105
- tick()
106
- .then(() => {
107
- untrack(() => {
108
- tableContext.focusStartIsBeingEdited = false;
109
- });
110
- })
111
- .catch(devCatch);
112
- }
92
+ function handleIsEditable(isEditable: boolean): Promise<void> {
93
+ if (isEditable) {
94
+ return tick().then(() => {
95
+ isBeingEdited = true;
96
+ });
113
97
  } else {
114
98
  if (isBeingEdited) {
115
- tick()
99
+ return tick()
116
100
  .then(() => {
117
- untrack(() => {
118
- if (!tableContext.singleClickEditing) {
119
- tableContext.focusStartIsBeingEdited = false;
120
- }
101
+ if (!tableContext.singleClickEditing) {
102
+ tableContext.focusStartIsBeingEdited = false;
103
+ }
121
104
 
122
- isBeingEdited = false;
123
- });
105
+ isBeingEdited = false;
124
106
  })
125
107
  .catch(devCatch);
126
108
  }
127
109
  }
128
- });
129
- */
110
+ return Promise.resolve();
111
+ }
112
+
130
113
  $effect(() => {
131
114
  void editable;
132
115
  if (wantsToBeEdited) {
133
- editable
134
- .then((isEditable) => {
135
- if (isEditable) {
136
- return tick().then(() => {
137
- isBeingEdited = true;
138
- });
139
- } else {
140
- if (isBeingEdited) {
141
- return tick()
142
- .then(() => {
143
- if (!tableContext.singleClickEditing) {
144
- tableContext.focusStartIsBeingEdited = false;
145
- }
146
-
147
- isBeingEdited = false;
148
- })
149
- .catch(devCatch);
150
- }
151
- }
152
-
153
- return;
154
- })
116
+ if (editable instanceof Promise) {
117
+ editable
118
+ .then((isEditable) => {
119
+ return handleIsEditable(isEditable);
120
+ })
155
121
 
156
- .catch(devCatch);
122
+ .catch(devCatch);
123
+ } else {
124
+ handleIsEditable(editable).catch(devCatch);
125
+ }
157
126
  } else {
158
127
  tick()
159
128
  .then(() => {