@collabdt/plugin-kit 0.13.0 → 0.14.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 CHANGED
@@ -8,15 +8,29 @@ repository root.
8
8
 
9
9
  ## [Unreleased]
10
10
 
11
+ ## [0.14.0] - 2026-11-23
12
+
13
+ ### Added
14
+ - `@collabdt/core/plugins-sdk/tour` as an external, with its declarations (`GuidedTour`, `useTour`,
15
+ `browserTourStore`, `findSidebarPageLink`, `setToolbarPanel`, `TourBody`, `splitTerm`). The types are also
16
+ exported from `@collabdt/plugin-kit/types/tour`. Using it requires a platform running `@collabdt/core` with
17
+ the same addition.
18
+ Steps also take `items`, `shortcut` and `skip`, and `onEnter` may return a cleanup; `GuidedTour` takes `startAt`,
19
+ `onFinish` and `onStepChange`.
20
+
11
21
  ## [0.13.0] - 2026-10-23
12
22
 
13
23
  ### Added
14
24
  - `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
25
  - `hide()` on `PluginDatasetState` in the `@collabdt/core/plugins-sdk/data` declarations. It needs a platform
18
26
  running `@collabdt/core` with the same addition.
19
27
 
28
+ ## [0.12.0] - 2026-10-13
29
+
30
+ ### Added
31
+ - `PluginUser` and `usePluginUser()` in the `@collabdt/core/plugins-sdk/data` declarations: the signed-in user's
32
+ `id` and `name`, or `null` while the session loads or when signed out.
33
+
20
34
  ## [0.11.0] - 2026-10-09
21
35
 
22
36
  ### Added
package/dist/index.js CHANGED
@@ -11,6 +11,7 @@ var PLUGIN_EXTERNALS = [
11
11
  "@collabdt/core/plugins-sdk/state",
12
12
  "@collabdt/core/plugins-sdk/ui",
13
13
  "@collabdt/core/plugins-sdk/components",
14
+ "@collabdt/core/plugins-sdk/tour",
14
15
  "@collabdt/core/plugins-sdk/charts"
15
16
  ];
16
17
  var KNOWN_FORBIDDEN = [
@@ -288,3 +288,27 @@ 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 GuidedTourProps = import('./tour').GuidedTourProps
298
+ export type TourStore = import('./tour').TourStore
299
+ export type BrowserTourStoreOptions = import('./tour').BrowserTourStoreOptions
300
+
301
+ /** A step-by-step guide that spotlights parts of the page while leaving it usable underneath. */
302
+ export const GuidedTour: import('./tour').GuidedTourComponent
303
+ export const TourBody: import('./tour').TourBodyComponent
304
+ export function splitTerm(line: string): [string | null, string]
305
+
306
+ /** Whether a tour is showing: open until hidden or finished, then closed for as long as `store` remembers. */
307
+ export function useTour(tourId: string, store?: TourStore): { open: boolean; start: () => void; hide: () => void }
308
+ export function browserTourStore(options: BrowserTourStoreOptions, backing?: import('./tour').FlagStorage | null): TourStore
309
+
310
+ /** The app sidebar's button for a page, matched on its title. */
311
+ export function findSidebarPageLink(title: string, lookup?: Pick<Document, 'querySelectorAll'>): HTMLElement | null
312
+ /** Opens or closes the toolbar dropdown holding `element` through the toggle that controls it. */
313
+ export function setToolbarPanel(element: Element | null, open: boolean, lookup?: Pick<Document, 'querySelectorAll' | 'getElementById'>): void
314
+ }
@@ -0,0 +1,79 @@
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
+ interface GuidedTourLabels {
37
+ next: string;
38
+ back: string;
39
+ finish: string;
40
+ hide: string;
41
+ missing: string;
42
+ progress: (step: number, total: number) => string;
43
+ }
44
+ interface GuidedTourProps {
45
+ steps: TourStep[];
46
+ /** Called when the viewer hides, escapes or finishes the tour. */
47
+ onHide: () => void;
48
+ /** Called by Finish on the last step instead of `onHide`, e.g. to return to the tour this one branched from. */
49
+ onFinish?: () => void;
50
+ /** Called with the id of each step as it opens, e.g. to reopen on it if the tour remounts. */
51
+ onStepChange?: (stepId: string) => void;
52
+ /** The id of the step to open on; the first step when absent or unknown. */
53
+ startAt?: string;
54
+ /** Elements the card must not cover, such as the panel a step points into. */
55
+ avoid?: () => Element[];
56
+ /** Shown at the start of the card's header, e.g. a logo. */
57
+ header?: React.ReactNode;
58
+ labels?: Partial<GuidedTourLabels>;
59
+ /** Scopes CSS variable overrides (`--tour-accent`, …) to this tour. */
60
+ className?: string;
61
+ }
62
+ type GuidedTourComponent = (props: GuidedTourProps) => React.ReactNode;
63
+ type TourBodyComponent = (props: {
64
+ body: React.ReactNode;
65
+ }) => React.ReactNode;
66
+ /** Remembers which tours a viewer has finished or hidden, so they do not reopen. */
67
+ interface TourStore {
68
+ isDone: (tourId: string) => boolean;
69
+ markDone: (tourId: string) => void;
70
+ }
71
+ type FlagStorage = Pick<Storage, 'getItem' | 'setItem'>;
72
+ interface BrowserTourStoreOptions {
73
+ /** `session` brings the tour back in a new browser session; `local` keeps it closed on this device. */
74
+ storage?: 'session' | 'local';
75
+ /** Prefixes the storage key, so two plugins' tours with the same id stay apart. */
76
+ namespace: string;
77
+ }
78
+
79
+ export type { BrowserTourStoreOptions, FlagStorage, GuidedTourComponent, GuidedTourLabels, GuidedTourProps, TourBodyComponent, TourItem, 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.13.0",
3
+ "version": "0.14.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": {