@collabdt/plugin-kit 0.13.0 → 0.15.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/CHANGELOG.md +22 -2
- package/dist/index.js +1 -0
- package/dist/types/sdkModules.d.ts +26 -0
- package/dist/types/tour.d.ts +98 -0
- package/dist/types/tour.js +0 -0
- package/package.json +5 -1
package/CHANGELOG.md
CHANGED
|
@@ -8,15 +8,35 @@ repository root.
|
|
|
8
8
|
|
|
9
9
|
## [Unreleased]
|
|
10
10
|
|
|
11
|
+
## [0.15.0] - 2026-11-24
|
|
12
|
+
|
|
13
|
+
### Added
|
|
14
|
+
- `TourSection` and `TourSections` declarations for `@collabdt/core/plugins-sdk/tour`, and `sections` on
|
|
15
|
+
`GuidedTourProps`, matching the core release that adds the tour sections dialog.
|
|
16
|
+
|
|
17
|
+
## [0.14.0] - 2026-11-23
|
|
18
|
+
|
|
19
|
+
### Added
|
|
20
|
+
- `@collabdt/core/plugins-sdk/tour` as an external, with its declarations (`GuidedTour`, `useTour`,
|
|
21
|
+
`browserTourStore`, `findSidebarPageLink`, `setToolbarPanel`, `TourBody`, `splitTerm`). The types are also
|
|
22
|
+
exported from `@collabdt/plugin-kit/types/tour`. Using it requires a platform running `@collabdt/core` with
|
|
23
|
+
the same addition.
|
|
24
|
+
Steps also take `items`, `shortcut` and `skip`, and `onEnter` may return a cleanup; `GuidedTour` takes `startAt`,
|
|
25
|
+
`onFinish` and `onStepChange`.
|
|
26
|
+
|
|
11
27
|
## [0.13.0] - 2026-10-23
|
|
12
28
|
|
|
13
29
|
### Added
|
|
14
30
|
- `category` on `PluginManifest`: an optional free-form grouping such as `live-data`, informational only.
|
|
15
|
-
- `PluginUser` and `usePluginUser()` in the `@collabdt/core/plugins-sdk/data` declarations: the signed-in user's
|
|
16
|
-
`id` and `name`, or `null` while the session loads or when signed out.
|
|
17
31
|
- `hide()` on `PluginDatasetState` in the `@collabdt/core/plugins-sdk/data` declarations. It needs a platform
|
|
18
32
|
running `@collabdt/core` with the same addition.
|
|
19
33
|
|
|
34
|
+
## [0.12.0] - 2026-10-13
|
|
35
|
+
|
|
36
|
+
### Added
|
|
37
|
+
- `PluginUser` and `usePluginUser()` in the `@collabdt/core/plugins-sdk/data` declarations: the signed-in user's
|
|
38
|
+
`id` and `name`, or `null` while the session loads or when signed out.
|
|
39
|
+
|
|
20
40
|
## [0.11.0] - 2026-10-09
|
|
21
41
|
|
|
22
42
|
### Added
|
package/dist/index.js
CHANGED
|
@@ -288,3 +288,29 @@ declare module '@collabdt/core/plugins-sdk/charts' {
|
|
|
288
288
|
export const XAxis: import('./charts').RechartsComponent
|
|
289
289
|
export const YAxis: import('./charts').RechartsComponent
|
|
290
290
|
}
|
|
291
|
+
|
|
292
|
+
declare module '@collabdt/core/plugins-sdk/tour' {
|
|
293
|
+
export type TourTarget = import('./tour').TourTarget
|
|
294
|
+
export type TourItem = import('./tour').TourItem
|
|
295
|
+
export type TourStep = import('./tour').TourStep
|
|
296
|
+
export type GuidedTourLabels = import('./tour').GuidedTourLabels
|
|
297
|
+
export type TourSection = import('./tour').TourSection
|
|
298
|
+
export type TourSections = import('./tour').TourSections
|
|
299
|
+
export type GuidedTourProps = import('./tour').GuidedTourProps
|
|
300
|
+
export type TourStore = import('./tour').TourStore
|
|
301
|
+
export type BrowserTourStoreOptions = import('./tour').BrowserTourStoreOptions
|
|
302
|
+
|
|
303
|
+
/** A step-by-step guide that spotlights parts of the page while leaving it usable underneath. */
|
|
304
|
+
export const GuidedTour: import('./tour').GuidedTourComponent
|
|
305
|
+
export const TourBody: import('./tour').TourBodyComponent
|
|
306
|
+
export function splitTerm(line: string): [string | null, string]
|
|
307
|
+
|
|
308
|
+
/** Whether a tour is showing: open until hidden or finished, then closed for as long as `store` remembers. */
|
|
309
|
+
export function useTour(tourId: string, store?: TourStore): { open: boolean; start: () => void; hide: () => void }
|
|
310
|
+
export function browserTourStore(options: BrowserTourStoreOptions, backing?: import('./tour').FlagStorage | null): TourStore
|
|
311
|
+
|
|
312
|
+
/** The app sidebar's button for a page, matched on its title. */
|
|
313
|
+
export function findSidebarPageLink(title: string, lookup?: Pick<Document, 'querySelectorAll'>): HTMLElement | null
|
|
314
|
+
/** Opens or closes the toolbar dropdown holding `element` through the toggle that controls it. */
|
|
315
|
+
export function setToolbarPanel(element: Element | null, open: boolean, lookup?: Pick<Document, 'querySelectorAll' | 'getElementById'>): void
|
|
316
|
+
}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
|
|
3
|
+
/** A `data-tour` anchor id, a function finding the element, or `null` to centre the card. */
|
|
4
|
+
type TourTarget = string | (() => Element | null | undefined) | null;
|
|
5
|
+
/** A row under a step's body; with `onSelect` it is a button, e.g. one that starts a tour of the part it names. */
|
|
6
|
+
interface TourItem {
|
|
7
|
+
id: string;
|
|
8
|
+
term: string;
|
|
9
|
+
description: string;
|
|
10
|
+
icon?: React.ComponentType<{
|
|
11
|
+
className?: string;
|
|
12
|
+
}>;
|
|
13
|
+
onSelect?: () => void;
|
|
14
|
+
}
|
|
15
|
+
interface TourStep {
|
|
16
|
+
id: string;
|
|
17
|
+
target: TourTarget;
|
|
18
|
+
title: string;
|
|
19
|
+
/** A string splits on newlines; `term — description` lines become a definition list. */
|
|
20
|
+
body: React.ReactNode;
|
|
21
|
+
items?: TourItem[];
|
|
22
|
+
/** Runs when the step opens, to open a panel the target needs; a returned function runs when the step closes. */
|
|
23
|
+
onEnter?: () => void | (() => void);
|
|
24
|
+
/** Points an arrow at the target and ends the tour when the target is clicked. */
|
|
25
|
+
invite?: boolean;
|
|
26
|
+
/** Whether to scroll the target into view; `false` for targets that fill the page, like a map. */
|
|
27
|
+
scroll?: boolean;
|
|
28
|
+
/** A small button at the top of the card, e.g. one that skips to the tour of the page the viewer is on. */
|
|
29
|
+
shortcut?: {
|
|
30
|
+
label: string;
|
|
31
|
+
onSelect: () => void;
|
|
32
|
+
};
|
|
33
|
+
/** Checked when Next or Back would reach the step; `true` passes over it, e.g. a hint for a state the page is not in. */
|
|
34
|
+
skip?: () => boolean;
|
|
35
|
+
}
|
|
36
|
+
/** A tour listed in the sections dialog; `start` opens it on the step with that id. */
|
|
37
|
+
interface TourSection {
|
|
38
|
+
id: string;
|
|
39
|
+
title: string;
|
|
40
|
+
description?: string;
|
|
41
|
+
steps: {
|
|
42
|
+
id: string;
|
|
43
|
+
title: string;
|
|
44
|
+
}[];
|
|
45
|
+
start: (stepId: string) => void;
|
|
46
|
+
}
|
|
47
|
+
interface TourSections {
|
|
48
|
+
/** Called when the dialog opens, so the list reflects the page at that moment. */
|
|
49
|
+
list: () => TourSection[];
|
|
50
|
+
/** The id of the section this tour is; picking one of its steps moves within the open tour. */
|
|
51
|
+
current: string;
|
|
52
|
+
}
|
|
53
|
+
interface GuidedTourLabels {
|
|
54
|
+
next: string;
|
|
55
|
+
back: string;
|
|
56
|
+
finish: string;
|
|
57
|
+
hide: string;
|
|
58
|
+
missing: string;
|
|
59
|
+
progress: (step: number, total: number) => string;
|
|
60
|
+
}
|
|
61
|
+
interface GuidedTourProps {
|
|
62
|
+
steps: TourStep[];
|
|
63
|
+
/** Called when the viewer hides, escapes or finishes the tour. */
|
|
64
|
+
onHide: () => void;
|
|
65
|
+
/** Called by Finish on the last step instead of `onHide`, e.g. to return to the tour this one branched from. */
|
|
66
|
+
onFinish?: () => void;
|
|
67
|
+
/** Called with the id of each step as it opens, e.g. to reopen on it if the tour remounts. */
|
|
68
|
+
onStepChange?: (stepId: string) => void;
|
|
69
|
+
/** The id of the step to open on; the first step when absent or unknown. */
|
|
70
|
+
startAt?: string;
|
|
71
|
+
/** Elements the card must not cover, such as the panel a step points into. */
|
|
72
|
+
avoid?: () => Element[];
|
|
73
|
+
/** Shown at the start of the card's header, e.g. a logo. */
|
|
74
|
+
header?: React.ReactNode;
|
|
75
|
+
/** Adds a button to the card's header that lists every section in a dialog, to jump to any of their steps. */
|
|
76
|
+
sections?: TourSections;
|
|
77
|
+
labels?: Partial<GuidedTourLabels>;
|
|
78
|
+
/** Scopes CSS variable overrides (`--tour-accent`, …) to this tour. */
|
|
79
|
+
className?: string;
|
|
80
|
+
}
|
|
81
|
+
type GuidedTourComponent = (props: GuidedTourProps) => React.ReactNode;
|
|
82
|
+
type TourBodyComponent = (props: {
|
|
83
|
+
body: React.ReactNode;
|
|
84
|
+
}) => React.ReactNode;
|
|
85
|
+
/** Remembers which tours a viewer has finished or hidden, so they do not reopen. */
|
|
86
|
+
interface TourStore {
|
|
87
|
+
isDone: (tourId: string) => boolean;
|
|
88
|
+
markDone: (tourId: string) => void;
|
|
89
|
+
}
|
|
90
|
+
type FlagStorage = Pick<Storage, 'getItem' | 'setItem'>;
|
|
91
|
+
interface BrowserTourStoreOptions {
|
|
92
|
+
/** `session` brings the tour back in a new browser session; `local` keeps it closed on this device. */
|
|
93
|
+
storage?: 'session' | 'local';
|
|
94
|
+
/** Prefixes the storage key, so two plugins' tours with the same id stay apart. */
|
|
95
|
+
namespace: string;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
export type { BrowserTourStoreOptions, FlagStorage, GuidedTourComponent, GuidedTourLabels, GuidedTourProps, TourBodyComponent, TourItem, TourSection, TourSections, TourStep, TourStore, TourTarget };
|
|
File without changes
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@collabdt/plugin-kit",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.15.0",
|
|
4
4
|
"description": "Build preset and types for authoring CDT plugins.",
|
|
5
5
|
"license": "AGPL-3.0-or-later",
|
|
6
6
|
"type": "module",
|
|
@@ -42,6 +42,10 @@
|
|
|
42
42
|
"./types/ui": {
|
|
43
43
|
"types": "./dist/types/ui.d.ts",
|
|
44
44
|
"default": "./dist/types/ui.js"
|
|
45
|
+
},
|
|
46
|
+
"./types/tour": {
|
|
47
|
+
"types": "./dist/types/tour.d.ts",
|
|
48
|
+
"default": "./dist/types/tour.js"
|
|
45
49
|
}
|
|
46
50
|
},
|
|
47
51
|
"scripts": {
|