@canonical/svelte-ds-app-launchpad 0.44.1 → 0.47.0
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.
- package/dist/components/DescriptionList/DescriptionList.svelte +16 -4
- package/dist/components/DescriptionList/DescriptionList.svelte.d.ts +16 -4
- package/dist/components/DescriptionList/common/Item/Item.svelte +2 -3
- package/dist/components/DescriptionList/common/Item/Item.svelte.d.ts +1 -2
- package/dist/components/DescriptionList/common/Item/types.d.ts +1 -13
- package/dist/components/DescriptionList/index.d.ts +5 -1
- package/dist/components/Tooltip/Tooltip.svelte +1 -1
- package/dist/components/Tooltip/Tooltip.svelte.d.ts +1 -1
- package/dist/components/Tooltip/utils/ChainingManager.d.ts +4 -9
- package/dist/components/Tooltip/utils/ChainingManager.js +26 -18
- package/dist/components/Tooltip/utils/useDelayedOpen.svelte.d.ts +2 -2
- package/dist/components/Tooltip/utils/useDelayedOpen.svelte.js +4 -8
- package/package.json +11 -11
|
@@ -34,10 +34,22 @@
|
|
|
34
34
|
## Example Usage
|
|
35
35
|
```svelte
|
|
36
36
|
<DescriptionList layout="list">
|
|
37
|
-
<DescriptionList.Item
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
37
|
+
<DescriptionList.Item>
|
|
38
|
+
<dt>ID</dt>
|
|
39
|
+
<dd>134</dd>
|
|
40
|
+
</DescriptionList.Item>
|
|
41
|
+
<DescriptionList.Item>
|
|
42
|
+
<dt>Requested by</dt>
|
|
43
|
+
<dd>John Smith</dd>
|
|
44
|
+
</DescriptionList.Item>
|
|
45
|
+
<DescriptionList.Item>
|
|
46
|
+
<dt>Created</dt>
|
|
47
|
+
<dd>2023-10-01T12:00:00Z</dd>
|
|
48
|
+
</DescriptionList.Item>
|
|
49
|
+
<DescriptionList.Item>
|
|
50
|
+
<dt>Status</dt>
|
|
51
|
+
<dd>Active</dd>
|
|
52
|
+
</DescriptionList.Item>
|
|
41
53
|
</DescriptionList>
|
|
42
54
|
```
|
|
43
55
|
-->
|
|
@@ -6,10 +6,22 @@ import type { DescriptionListProps } from "./types.js";
|
|
|
6
6
|
* ## Example Usage
|
|
7
7
|
* ```svelte
|
|
8
8
|
* <DescriptionList layout="list">
|
|
9
|
-
* <DescriptionList.Item
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
9
|
+
* <DescriptionList.Item>
|
|
10
|
+
* <dt>ID</dt>
|
|
11
|
+
* <dd>134</dd>
|
|
12
|
+
* </DescriptionList.Item>
|
|
13
|
+
* <DescriptionList.Item>
|
|
14
|
+
* <dt>Requested by</dt>
|
|
15
|
+
* <dd>John Smith</dd>
|
|
16
|
+
* </DescriptionList.Item>
|
|
17
|
+
* <DescriptionList.Item>
|
|
18
|
+
* <dt>Created</dt>
|
|
19
|
+
* <dd>2023-10-01T12:00:00Z</dd>
|
|
20
|
+
* </DescriptionList.Item>
|
|
21
|
+
* <DescriptionList.Item>
|
|
22
|
+
* <dt>Status</dt>
|
|
23
|
+
* <dd>Active</dd>
|
|
24
|
+
* </DescriptionList.Item>
|
|
13
25
|
* </DescriptionList>
|
|
14
26
|
* ```
|
|
15
27
|
*/
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
|
|
8
8
|
const componentCssClassName = "ds description-list-item";
|
|
9
9
|
|
|
10
|
-
let { class: className,
|
|
10
|
+
let { class: className, children, ...rest }: ItemProps = $props();
|
|
11
11
|
|
|
12
12
|
const descriptionListContext = getDescriptionListContext();
|
|
13
13
|
</script>
|
|
@@ -16,6 +16,5 @@
|
|
|
16
16
|
class={[componentCssClassName, className, descriptionListContext.layout]}
|
|
17
17
|
{...rest}
|
|
18
18
|
>
|
|
19
|
-
|
|
20
|
-
<dd>{@render children()}</dd>
|
|
19
|
+
{@render children?.()}
|
|
21
20
|
</div>
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import "./styles.css";
|
|
2
|
-
|
|
3
|
-
declare const Item: import("svelte").Component<ItemProps, {}, "">;
|
|
2
|
+
declare const Item: import("svelte").Component<import("svelte/elements").HTMLAttributes<HTMLDivElement>, {}, "">;
|
|
4
3
|
type Item = ReturnType<typeof Item>;
|
|
5
4
|
export default Item;
|
|
@@ -1,14 +1,2 @@
|
|
|
1
|
-
import type { Snippet } from "svelte";
|
|
2
1
|
import type { SvelteHTMLElements } from "svelte/elements";
|
|
3
|
-
type
|
|
4
|
-
export interface ItemProps extends BaseProps {
|
|
5
|
-
/**
|
|
6
|
-
* Term/name of the item
|
|
7
|
-
*/
|
|
8
|
-
name: string;
|
|
9
|
-
/**
|
|
10
|
-
* Description/content of the item
|
|
11
|
-
*/
|
|
12
|
-
children: Snippet<[]>;
|
|
13
|
-
}
|
|
14
|
-
export {};
|
|
2
|
+
export type ItemProps = SvelteHTMLElements["div"];
|
|
@@ -7,8 +7,12 @@ declare const DescriptionList: typeof DescriptionListRoot & {
|
|
|
7
7
|
* @example
|
|
8
8
|
* ```svelte
|
|
9
9
|
* <DescriptionList>
|
|
10
|
-
* <DescriptionList.Item
|
|
10
|
+
* <DescriptionList.Item>
|
|
11
|
+
* <dt>ID</dt>
|
|
12
|
+
* <dd>134</dd>
|
|
13
|
+
* </DescriptionList.Item>
|
|
11
14
|
* </DescriptionList>
|
|
15
|
+
* ```
|
|
12
16
|
*/
|
|
13
17
|
Item: typeof Item;
|
|
14
18
|
};
|
|
@@ -151,7 +151,7 @@
|
|
|
151
151
|
Tooltip requires JavaScript to function correctly. If JavaScript is disabled, the tooltip content will not be accessible.
|
|
152
152
|
TODO(no-js): Investigate how to handle tooltips without JavaScript.
|
|
153
153
|
|
|
154
|
-
The tooltip enables a short
|
|
154
|
+
The tooltip enables "chaining" while it is visible and for a short window (~350ms) after the last tooltip closes. If any tooltip's trigger is hovered or focused during this time, the tooltip bypasses `delay` and opens immediately.
|
|
155
155
|
|
|
156
156
|
## Example Usage
|
|
157
157
|
```svelte
|
|
@@ -6,7 +6,7 @@ import type { TooltipProps } from "./types.js";
|
|
|
6
6
|
* Tooltip requires JavaScript to function correctly. If JavaScript is disabled, the tooltip content will not be accessible.
|
|
7
7
|
* TODO(no-js): Investigate how to handle tooltips without JavaScript.
|
|
8
8
|
*
|
|
9
|
-
* The tooltip enables a short
|
|
9
|
+
* The tooltip enables "chaining" while it is visible and for a short window (~350ms) after the last tooltip closes. If any tooltip's trigger is hovered or focused during this time, the tooltip bypasses `delay` and opens immediately.
|
|
10
10
|
*
|
|
11
11
|
* ## Example Usage
|
|
12
12
|
* ```svelte
|
|
@@ -1,18 +1,13 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* Keeps chaining active while any tooltip is visible and for a grace period after the last one closes.
|
|
3
3
|
*/
|
|
4
4
|
export declare class ChainingManager {
|
|
5
|
-
|
|
6
|
-
* The duration (in milliseconds) for which chaining remains active after being set to true.
|
|
7
|
-
*/
|
|
8
|
-
private readonly chainingThreshold;
|
|
9
|
-
private _chaining;
|
|
10
|
-
private chainingTimeout;
|
|
5
|
+
#private;
|
|
11
6
|
constructor(
|
|
12
7
|
/**
|
|
13
|
-
* The duration (in milliseconds) for which chaining remains active after
|
|
8
|
+
* The duration (in milliseconds) for which chaining remains active after the last tooltip closes.
|
|
14
9
|
*/
|
|
15
10
|
chainingThreshold: number);
|
|
16
|
-
set chaining(value: boolean);
|
|
17
11
|
get chaining(): boolean;
|
|
12
|
+
acquire(): () => void;
|
|
18
13
|
}
|
|
@@ -1,29 +1,37 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* Keeps chaining active while any tooltip is visible and for a grace period after the last one closes.
|
|
3
3
|
*/
|
|
4
4
|
export class ChainingManager {
|
|
5
|
-
chainingThreshold;
|
|
6
|
-
|
|
7
|
-
chainingTimeout = null;
|
|
5
|
+
#chainingThreshold;
|
|
6
|
+
#activeCount = 0;
|
|
7
|
+
#chainingTimeout = null;
|
|
8
8
|
constructor(
|
|
9
9
|
/**
|
|
10
|
-
* The duration (in milliseconds) for which chaining remains active after
|
|
10
|
+
* The duration (in milliseconds) for which chaining remains active after the last tooltip closes.
|
|
11
11
|
*/
|
|
12
12
|
chainingThreshold) {
|
|
13
|
-
this
|
|
14
|
-
}
|
|
15
|
-
set chaining(value) {
|
|
16
|
-
this._chaining = value;
|
|
17
|
-
if (this.chainingTimeout !== null)
|
|
18
|
-
clearTimeout(this.chainingTimeout);
|
|
19
|
-
if (value) {
|
|
20
|
-
this.chainingTimeout = setTimeout(() => {
|
|
21
|
-
this._chaining = false;
|
|
22
|
-
this.chainingTimeout = null;
|
|
23
|
-
}, this.chainingThreshold);
|
|
24
|
-
}
|
|
13
|
+
this.#chainingThreshold = chainingThreshold;
|
|
25
14
|
}
|
|
26
15
|
get chaining() {
|
|
27
|
-
return this
|
|
16
|
+
return this.#activeCount > 0 || this.#chainingTimeout !== null;
|
|
17
|
+
}
|
|
18
|
+
acquire() {
|
|
19
|
+
if (this.#chainingTimeout !== null) {
|
|
20
|
+
clearTimeout(this.#chainingTimeout);
|
|
21
|
+
this.#chainingTimeout = null;
|
|
22
|
+
}
|
|
23
|
+
this.#activeCount += 1;
|
|
24
|
+
let released = false;
|
|
25
|
+
return () => {
|
|
26
|
+
if (released)
|
|
27
|
+
return;
|
|
28
|
+
released = true;
|
|
29
|
+
this.#activeCount -= 1;
|
|
30
|
+
if (this.#activeCount === 0) {
|
|
31
|
+
this.#chainingTimeout = setTimeout(() => {
|
|
32
|
+
this.#chainingTimeout = null;
|
|
33
|
+
}, this.#chainingThreshold);
|
|
34
|
+
}
|
|
35
|
+
};
|
|
28
36
|
}
|
|
29
37
|
}
|
|
@@ -4,8 +4,8 @@ import type { ChainingManager } from "./ChainingManager.js";
|
|
|
4
4
|
* where successive tooltips open without delay.
|
|
5
5
|
*
|
|
6
6
|
* The returned getter reflects whether the tooltip should currently be considered open
|
|
7
|
-
* (after any applied delay).
|
|
8
|
-
*
|
|
7
|
+
* (after any applied delay). Visible tooltips register with the shared manager
|
|
8
|
+
* until they close or are destroyed.
|
|
9
9
|
*
|
|
10
10
|
* @param getOpen - Reactive getter indicating the raw (immediate) open intent.
|
|
11
11
|
* @param getDelay - Reactive getter providing the delay in milliseconds before showing.
|
|
@@ -4,8 +4,8 @@ import { untrack } from "svelte";
|
|
|
4
4
|
* where successive tooltips open without delay.
|
|
5
5
|
*
|
|
6
6
|
* The returned getter reflects whether the tooltip should currently be considered open
|
|
7
|
-
* (after any applied delay).
|
|
8
|
-
*
|
|
7
|
+
* (after any applied delay). Visible tooltips register with the shared manager
|
|
8
|
+
* until they close or are destroyed.
|
|
9
9
|
*
|
|
10
10
|
* @param getOpen - Reactive getter indicating the raw (immediate) open intent.
|
|
11
11
|
* @param getDelay - Reactive getter providing the delay in milliseconds before showing.
|
|
@@ -29,14 +29,10 @@ export function useDelayedOpen(getOpen, getDelay, chainingManager) {
|
|
|
29
29
|
}
|
|
30
30
|
delayedOpen = false;
|
|
31
31
|
});
|
|
32
|
-
let firstRun = true;
|
|
33
32
|
$effect(() => {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
if (!delayedOpen && !firstRun) {
|
|
37
|
-
chainingManager.chaining = true;
|
|
33
|
+
if (delayedOpen) {
|
|
34
|
+
return chainingManager.acquire();
|
|
38
35
|
}
|
|
39
|
-
firstRun = false;
|
|
40
36
|
});
|
|
41
37
|
return () => delayedOpen;
|
|
42
38
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@canonical/svelte-ds-app-launchpad",
|
|
3
3
|
"description": "Launchpad-specific components for the Pragma design system.",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.47.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"module": "dist/index.js",
|
|
7
7
|
"types": "dist/index.d.ts",
|
|
@@ -64,14 +64,14 @@
|
|
|
64
64
|
"devDependencies": {
|
|
65
65
|
"@biomejs/biome": "2.5.15",
|
|
66
66
|
"@canonical/biome-config": "0.43.0",
|
|
67
|
-
"@canonical/storybook-config": "^0.
|
|
68
|
-
"@canonical/storybook-helpers": "^0.
|
|
69
|
-
"@canonical/svelte-ssr-test": "^0.
|
|
70
|
-
"@canonical/typescript-config-svelte": "^0.
|
|
71
|
-
"@canonical/webarchitect": "0.
|
|
67
|
+
"@canonical/storybook-config": "^0.47.0",
|
|
68
|
+
"@canonical/storybook-helpers": "^0.47.0",
|
|
69
|
+
"@canonical/svelte-ssr-test": "^0.47.0",
|
|
70
|
+
"@canonical/typescript-config-svelte": "^0.47.0",
|
|
71
|
+
"@canonical/webarchitect": "0.44.0",
|
|
72
72
|
"@storybook/addon-docs": "^10.6.0",
|
|
73
73
|
"@storybook/addon-svelte-csf": "^5.1.3",
|
|
74
|
-
"@sveltejs/package": "3.0.
|
|
74
|
+
"@sveltejs/package": "3.0.2",
|
|
75
75
|
"@sveltejs/vite-plugin-svelte": "^7.0.0",
|
|
76
76
|
"@types/bun": "^1.3.10",
|
|
77
77
|
"@vitest/browser": "^5.0.0",
|
|
@@ -85,13 +85,13 @@
|
|
|
85
85
|
"vitest-browser-svelte": "^3.0.0"
|
|
86
86
|
},
|
|
87
87
|
"dependencies": {
|
|
88
|
-
"@canonical/design-tokens": "0.
|
|
89
|
-
"@canonical/styles": "^0.
|
|
90
|
-
"@canonical/svelte-icons": "^0.0
|
|
88
|
+
"@canonical/design-tokens": "0.44.0",
|
|
89
|
+
"@canonical/styles": "^0.47.0",
|
|
90
|
+
"@canonical/svelte-icons": "^0.1.0",
|
|
91
91
|
"@floating-ui/dom": "^1.7.6"
|
|
92
92
|
},
|
|
93
93
|
"peerDependencies": {
|
|
94
94
|
"svelte": "^5.47.1"
|
|
95
95
|
},
|
|
96
|
-
"gitHead": "
|
|
96
|
+
"gitHead": "f846e7e21001a0fcbc4cd9f28c14a55cea7f4974"
|
|
97
97
|
}
|