@nullplatform/ui-plugin-sdk 0.20.0-beta.0 → 0.21.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.
@@ -518,6 +518,9 @@ export declare const UI_COMPONENTS_CONTRACTS: readonly [{
518
518
  readonly initialState: "object";
519
519
  readonly paginationProps: "object";
520
520
  readonly variant: "string";
521
+ readonly isRowClickable: "string";
522
+ readonly emptyStateProps: "object";
523
+ readonly grouping: "object";
521
524
  };
522
525
  readonly events: {
523
526
  readonly stateChange: "onChangeTableState";
@@ -525,7 +528,12 @@ export declare const UI_COMPONENTS_CONTRACTS: readonly [{
525
528
  };
526
529
  readonly values: {
527
530
  readonly variant: readonly ["default", "embedded", "plain"];
531
+ readonly "grouping.layout": readonly ["rows", "sections"];
532
+ readonly "emptyStateProps.action": readonly [];
533
+ readonly "emptyStateProps.contentComponent": readonly [];
528
534
  };
535
+ readonly cssValues: readonly ["emptyStateProps.sx", "emptyStateProps.height"];
536
+ readonly imageValues: readonly ["emptyStateProps.img"];
529
537
  }, {
530
538
  readonly tag: "np-gauge";
531
539
  readonly component: "Gauge";
@@ -693,6 +701,9 @@ export declare const UI_COMPONENTS_CONTRACTS: readonly [{
693
701
  readonly now: "string";
694
702
  readonly locale: "string";
695
703
  readonly resourceLabel: "string";
704
+ readonly loading: "boolean";
705
+ readonly emptyStateProps: "object";
706
+ readonly maxRows: "number";
696
707
  };
697
708
  readonly events: {
698
709
  readonly barPress: "onBarPress";
@@ -765,4 +776,158 @@ export declare const UI_COMPONENTS_CONTRACTS: readonly [{
765
776
  readonly events: {
766
777
  readonly change: "onChange";
767
778
  };
779
+ }, {
780
+ readonly tag: "np-checkbox";
781
+ readonly component: "Checkbox";
782
+ readonly properties: {
783
+ readonly checked: "boolean";
784
+ readonly disabled: "boolean";
785
+ };
786
+ readonly events: {
787
+ readonly change: "onChange";
788
+ };
789
+ }, {
790
+ readonly tag: "np-checkbox-card";
791
+ readonly component: "CheckboxCard";
792
+ readonly properties: {
793
+ readonly label: "string";
794
+ readonly description: "string";
795
+ readonly icon: "string";
796
+ readonly checked: "boolean";
797
+ readonly size: "string";
798
+ readonly variant: "string";
799
+ readonly align: "string";
800
+ readonly justify: "string";
801
+ readonly orientation: "string";
802
+ readonly indicator: "boolean";
803
+ readonly disabled: "boolean";
804
+ readonly readOnly: "boolean";
805
+ readonly error: "boolean";
806
+ };
807
+ readonly events: {
808
+ readonly change: "onChange";
809
+ };
810
+ readonly values: {
811
+ readonly size: readonly ["sm", "md", "lg"];
812
+ readonly variant: readonly ["outline", "surface", "subtle", "solid"];
813
+ readonly align: readonly ["start", "end", "center"];
814
+ readonly justify: readonly ["start", "end", "center"];
815
+ readonly orientation: readonly ["horizontal", "vertical"];
816
+ };
817
+ }, {
818
+ readonly tag: "np-slider";
819
+ readonly component: "Slider";
820
+ readonly properties: {
821
+ readonly value: "number";
822
+ readonly min: "number";
823
+ readonly max: "number";
824
+ readonly step: "number";
825
+ readonly disabled: "boolean";
826
+ readonly "aria-label": "string";
827
+ };
828
+ readonly events: {
829
+ readonly change: "onChange";
830
+ readonly changeCommitted: "onChangeCommitted";
831
+ };
832
+ }, {
833
+ readonly tag: "np-accordion";
834
+ readonly component: "Accordion";
835
+ readonly properties: {
836
+ readonly expanded: "boolean";
837
+ readonly defaultExpanded: "boolean";
838
+ readonly disabled: "boolean";
839
+ readonly disableGutters: "boolean";
840
+ };
841
+ readonly events: {
842
+ readonly change: "onChange";
843
+ };
844
+ readonly children: true;
845
+ }, {
846
+ readonly tag: "np-accordion-summary";
847
+ readonly component: "AccordionSummary";
848
+ readonly properties: {};
849
+ readonly events: {};
850
+ readonly slots: readonly ["expandIcon"];
851
+ readonly children: true;
852
+ }, {
853
+ readonly tag: "np-accordion-details";
854
+ readonly component: "AccordionDetails";
855
+ readonly properties: {};
856
+ readonly events: {};
857
+ readonly children: true;
858
+ }, {
859
+ readonly tag: "np-date-picker";
860
+ readonly component: "DatePickerField";
861
+ readonly properties: {
862
+ readonly value: "string";
863
+ readonly minDate: "string";
864
+ readonly maxDate: "string";
865
+ readonly timeZone: "string";
866
+ readonly label: "string";
867
+ readonly helperText: "string";
868
+ readonly error: "boolean";
869
+ readonly disabled: "boolean";
870
+ };
871
+ readonly events: {
872
+ readonly change: "onChange";
873
+ };
874
+ }, {
875
+ readonly tag: "np-filter-single-date";
876
+ readonly component: "FilterSingleDateField";
877
+ readonly properties: {
878
+ readonly value: "string";
879
+ readonly preset: "string";
880
+ readonly presets: "array";
881
+ readonly timeZone: "string";
882
+ readonly label: "string";
883
+ readonly placeholder: "string";
884
+ readonly customLabel: "string";
885
+ readonly helperText: "string";
886
+ readonly error: "boolean";
887
+ readonly required: "boolean";
888
+ readonly disabled: "boolean";
889
+ readonly minDate: "string";
890
+ readonly maxDate: "string";
891
+ readonly disablePast: "boolean";
892
+ readonly disableFuture: "boolean";
893
+ readonly hideActionButtons: "boolean";
894
+ };
895
+ readonly events: {
896
+ readonly change: "onChange";
897
+ };
898
+ }, {
899
+ readonly tag: "np-stepper";
900
+ readonly component: "Stepper";
901
+ readonly properties: {
902
+ readonly activeStep: "number";
903
+ readonly orientation: "string";
904
+ readonly alternativeLabel: "boolean";
905
+ readonly nonLinear: "boolean";
906
+ };
907
+ readonly events: {};
908
+ readonly values: {
909
+ readonly orientation: readonly ["horizontal", "vertical"];
910
+ };
911
+ readonly children: true;
912
+ }, {
913
+ readonly tag: "np-step";
914
+ readonly component: "Step";
915
+ readonly properties: {
916
+ readonly index: "number";
917
+ readonly last: "boolean";
918
+ readonly active: "boolean";
919
+ readonly completed: "boolean";
920
+ readonly disabled: "boolean";
921
+ };
922
+ readonly events: {};
923
+ readonly children: true;
924
+ }, {
925
+ readonly tag: "np-step-label";
926
+ readonly component: "StepLabel";
927
+ readonly properties: {
928
+ readonly error: "boolean";
929
+ };
930
+ readonly events: {};
931
+ readonly slots: readonly ["optional"];
932
+ readonly children: true;
768
933
  }];
@@ -1,4 +1,4 @@
1
- // Generated by scripts/sync-contracts.mjs from @nullplatform/react-ui-components@0.16.10. Don't edit: change the contract in
1
+ // Generated by scripts/sync-contracts.mjs from @nullplatform/react-ui-components@0.17.1. Don't edit: change the contract in
2
2
  // react-ui-components, bump `uiComponentsContracts` in package.json and run `pnpm sync:contracts`.
3
3
  export const UI_COMPONENTS_CONTRACTS = [
4
4
  {
@@ -283,9 +283,11 @@ export const UI_COMPONENTS_CONTRACTS = [
283
283
  {
284
284
  tag: "np-data-table",
285
285
  component: "DataTable",
286
- properties: { "columns": "array", "data": "array", "serverSide": "boolean", "isLoading": "boolean", "initialState": "object", "paginationProps": "object", "variant": "string" },
286
+ properties: { "columns": "array", "data": "array", "serverSide": "boolean", "isLoading": "boolean", "initialState": "object", "paginationProps": "object", "variant": "string", "isRowClickable": "string", "emptyStateProps": "object", "grouping": "object" },
287
287
  events: { "stateChange": "onChangeTableState", "rowClick": "onRowClick" },
288
- values: { "variant": ["default", "embedded", "plain"] },
288
+ values: { "variant": ["default", "embedded", "plain"], "grouping.layout": ["rows", "sections"], "emptyStateProps.action": [], "emptyStateProps.contentComponent": [] },
289
+ cssValues: ["emptyStateProps.sx", "emptyStateProps.height"],
290
+ imageValues: ["emptyStateProps.img"],
289
291
  },
290
292
  {
291
293
  tag: "np-gauge",
@@ -348,7 +350,7 @@ export const UI_COMPONENTS_CONTRACTS = [
348
350
  {
349
351
  tag: "np-calendar-timeline",
350
352
  component: "CalendarTimeline",
351
- properties: { "from": "string", "to": "string", "timeZone": "string", "rows": "array", "bars": "array", "selectedId": "string", "now": "string", "locale": "string", "resourceLabel": "string" },
353
+ properties: { "from": "string", "to": "string", "timeZone": "string", "rows": "array", "bars": "array", "selectedId": "string", "now": "string", "locale": "string", "resourceLabel": "string", "loading": "boolean", "emptyStateProps": "object", "maxRows": "number" },
352
354
  events: { "barPress": "onBarPress" },
353
355
  values: { "rows[].kind": ["organization", "account", "namespace", "application"], "bars[].kind": ["freeze", "window"], "bars[].state": ["active", "upcoming", "past"] },
354
356
  },
@@ -378,4 +380,80 @@ export const UI_COMPONENTS_CONTRACTS = [
378
380
  properties: { "start": "string", "end": "string", "allDay": "boolean", "timeZone": "string", "locale": "string", "label": "string", "error": "string", "disabled": "boolean" },
379
381
  events: { "change": "onChange" },
380
382
  },
383
+ {
384
+ tag: "np-checkbox",
385
+ component: "Checkbox",
386
+ properties: { "checked": "boolean", "disabled": "boolean" },
387
+ events: { "change": "onChange" },
388
+ },
389
+ {
390
+ tag: "np-checkbox-card",
391
+ component: "CheckboxCard",
392
+ properties: { "label": "string", "description": "string", "icon": "string", "checked": "boolean", "size": "string", "variant": "string", "align": "string", "justify": "string", "orientation": "string", "indicator": "boolean", "disabled": "boolean", "readOnly": "boolean", "error": "boolean" },
393
+ events: { "change": "onChange" },
394
+ values: { "size": ["sm", "md", "lg"], "variant": ["outline", "surface", "subtle", "solid"], "align": ["start", "end", "center"], "justify": ["start", "end", "center"], "orientation": ["horizontal", "vertical"] },
395
+ },
396
+ {
397
+ tag: "np-slider",
398
+ component: "Slider",
399
+ properties: { "value": "number", "min": "number", "max": "number", "step": "number", "disabled": "boolean", "aria-label": "string" },
400
+ events: { "change": "onChange", "changeCommitted": "onChangeCommitted" },
401
+ },
402
+ {
403
+ tag: "np-accordion",
404
+ component: "Accordion",
405
+ properties: { "expanded": "boolean", "defaultExpanded": "boolean", "disabled": "boolean", "disableGutters": "boolean" },
406
+ events: { "change": "onChange" },
407
+ children: true,
408
+ },
409
+ {
410
+ tag: "np-accordion-summary",
411
+ component: "AccordionSummary",
412
+ properties: {},
413
+ events: {},
414
+ slots: ["expandIcon"],
415
+ children: true,
416
+ },
417
+ {
418
+ tag: "np-accordion-details",
419
+ component: "AccordionDetails",
420
+ properties: {},
421
+ events: {},
422
+ children: true,
423
+ },
424
+ {
425
+ tag: "np-date-picker",
426
+ component: "DatePickerField",
427
+ properties: { "value": "string", "minDate": "string", "maxDate": "string", "timeZone": "string", "label": "string", "helperText": "string", "error": "boolean", "disabled": "boolean" },
428
+ events: { "change": "onChange" },
429
+ },
430
+ {
431
+ tag: "np-filter-single-date",
432
+ component: "FilterSingleDateField",
433
+ properties: { "value": "string", "preset": "string", "presets": "array", "timeZone": "string", "label": "string", "placeholder": "string", "customLabel": "string", "helperText": "string", "error": "boolean", "required": "boolean", "disabled": "boolean", "minDate": "string", "maxDate": "string", "disablePast": "boolean", "disableFuture": "boolean", "hideActionButtons": "boolean" },
434
+ events: { "change": "onChange" },
435
+ },
436
+ {
437
+ tag: "np-stepper",
438
+ component: "Stepper",
439
+ properties: { "activeStep": "number", "orientation": "string", "alternativeLabel": "boolean", "nonLinear": "boolean" },
440
+ events: {},
441
+ values: { "orientation": ["horizontal", "vertical"] },
442
+ children: true,
443
+ },
444
+ {
445
+ tag: "np-step",
446
+ component: "Step",
447
+ properties: { "index": "number", "last": "boolean", "active": "boolean", "completed": "boolean", "disabled": "boolean" },
448
+ events: {},
449
+ children: true,
450
+ },
451
+ {
452
+ tag: "np-step-label",
453
+ component: "StepLabel",
454
+ properties: { "error": "boolean" },
455
+ events: {},
456
+ slots: ["optional"],
457
+ children: true,
458
+ },
381
459
  ];
@@ -5,11 +5,19 @@ import type { TextVariant } from "./catalog.js";
5
5
  */
6
6
  export type DataTableColor = "default" | "primary" | "secondary" | "error" | "info" | "success" | "warning";
7
7
  export type DataTableLabelVariant = "filled" | "outlined" | "ghost" | "soft";
8
- /** A row's menu entry. `icon` is an iconify name, such as `mdi:open-in-new`. */
8
+ /**
9
+ * A row's menu entry, or a button with `display: 'buttons'`. `icon` is an iconify name, such as `mdi:open-in-new`.
10
+ * A `disabled` entry shows but can't be picked.
11
+ */
9
12
  export interface DataTableRowAction {
10
13
  id: string;
11
14
  label: string;
12
15
  icon?: string;
16
+ /** With `display: 'buttons'`, the button's colour. An unknown one draws as `primary`. */
17
+ color?: "inherit" | "primary" | "secondary" | "error" | "info" | "success" | "warning";
18
+ /** With `display: 'buttons'`, the button's variant. An unknown one draws as `contained`. */
19
+ variant?: "contained" | "outlined" | "text";
20
+ disabled?: boolean;
13
21
  }
14
22
  export interface DataTableTypography {
15
23
  variant?: TextVariant;
@@ -82,7 +90,14 @@ export type DataTableFormatter = {
82
90
  } | {
83
91
  type: "actions";
84
92
  config: {
93
+ /** A kebab menu per row (`menu`, the default), or each action as a visible button at the end of the row. */
94
+ display?: "menu" | "buttons";
95
+ /**
96
+ * Every row's actions. A row whose value in this column is a `DataTableRowAction[]` uses that array instead,
97
+ * so rows can differ: an empty one draws nothing.
98
+ */
85
99
  actions: DataTableRowAction[];
100
+ /** The picked action's id and its row. */
86
101
  onAction?: (actionId: string, row: DataTableRow) => void;
87
102
  };
88
103
  };
@@ -104,6 +119,8 @@ export interface DataTableColumn {
104
119
  formatter?: DataTableFormatter;
105
120
  /** Aligns the header and the cells together, such as `right` for numbers. Defaults to `left`. */
106
121
  align?: "left" | "center" | "right";
122
+ /** Draws no column: a field `grouping` groups by without showing it anywhere else. */
123
+ filterOnly?: boolean;
107
124
  }
108
125
  /** A link cell: a route of the host, or an `href` outside it, which opens in a new tab. */
109
126
  export type DataTableLink = {
@@ -119,7 +136,10 @@ export type DataTableAvatar = string | {
119
136
  name: string;
120
137
  color?: DataTableColor;
121
138
  };
122
- /** A row: primitives, `DataTableLink`s in link columns, `DataTableAvatar`s in avatar columns. */
139
+ /**
140
+ * A row: primitives, `DataTableLink`s in link columns, `DataTableAvatar`s in avatar columns, and a
141
+ * `DataTableRowAction[]` in an actions column for that row's own menu.
142
+ */
123
143
  export type DataTableRow = Record<string, unknown>;
124
144
  export interface DataTableState {
125
145
  sorting?: Array<{
@@ -140,3 +160,30 @@ export interface DataTablePagination {
140
160
  /** Hides the pagination bar while every row fits the smallest page size, on the first page. */
141
161
  hideWhenOnePage?: boolean;
142
162
  }
163
+ /**
164
+ * What the table shows with no rows, in place of "No results found". The host passes `img` only from the plugin's
165
+ * bundle storage and `height` only as a plain number; it drops CSS (`sx`) and elements (`action`).
166
+ */
167
+ export interface DataTableEmptyState {
168
+ title?: string;
169
+ description?: string;
170
+ /** An iconify name, drawn in the default empty state's circular well. */
171
+ icon?: string;
172
+ /** An image from the plugin's bundle storage, in place of the icon. */
173
+ img?: string;
174
+ height?: number;
175
+ }
176
+ /**
177
+ * Groups the rows under collapsible headers, client-side: inert with `serverSide`, and it hides the pager. A group
178
+ * is titled with its value, so group by a field that holds the title (a `filterOnly` column if it shows nowhere else).
179
+ */
180
+ export interface DataTableGrouping {
181
+ /** Column ids to group by, outermost first. Empty: flat. */
182
+ value: readonly string[];
183
+ /** Groups mount collapsed. Reset whenever `value` changes. */
184
+ defaultCollapsed?: boolean;
185
+ /** Rows a group shows at first; a show-more row reveals `pageSize` more per click. Without it, all of them. */
186
+ pageSize?: number;
187
+ /** How two or more keys draw: nested header rows in one table (`rows`, the default) or a table per group. */
188
+ layout?: "rows" | "sections";
189
+ }
@@ -0,0 +1,21 @@
1
+ /**
2
+ * What `FilterSingleDateField` takes from a plugin and passes back, which its contract can only type as an array and
3
+ * an event. Instants are ISO-8601 strings.
4
+ */
5
+ /** A choice listed above the calendar, resolved by the plugin when it renders ("in 7 days"). */
6
+ export interface FilterSingleDatePreset {
7
+ /** Any key but `custom`, which names the field's own calendar entry. */
8
+ key: string;
9
+ label: string;
10
+ /** The preset's instant; `null` or left out for a preset that stands for no date ("No expiration"). */
11
+ value?: string | null;
12
+ /** Listed but not selectable. */
13
+ disabled?: boolean;
14
+ }
15
+ /** What `onChange` passes. */
16
+ export interface FilterSingleDateChange {
17
+ /** The chosen instant as UTC ISO-8601, or `null` for no date. */
18
+ value: string | null;
19
+ /** The chosen preset's key, or `null` for a day picked on the calendar. */
20
+ preset: string | null;
21
+ }
@@ -0,0 +1,5 @@
1
+ /**
2
+ * What `FilterSingleDateField` takes from a plugin and passes back, which its contract can only type as an array and
3
+ * an event. Instants are ISO-8601 strings.
4
+ */
5
+ export {};
package/dist/host.d.ts CHANGED
@@ -1,5 +1,4 @@
1
1
  import type { ComponentType } from "react";
2
- import type { AnnouncedCall } from "./protocol.js";
3
2
  export declare function registerTag(component: object, tag: string): void;
4
3
  /** Called by the worker runtime with the elements the host announced on `init`. */
5
4
  export declare function setHostElements(elements: unknown): void;
@@ -9,10 +8,3 @@ export declare function setHostElements(elements: unknown): void;
9
8
  * predate every element that needs the check.
10
9
  */
11
10
  export declare function hostRenders(component: ComponentType<any>): boolean;
12
- /** Called by the worker runtime with the calls the host announced on `init`. */
13
- export declare function setHostCalls(calls: unknown): void;
14
- /**
15
- * Whether this host serves `call`, one a host may lack: an older host, or one whose app cannot do it, refuses it. Offer
16
- * what the call does only when this is true. False on hosts that announce no calls, which predate every call here.
17
- */
18
- export declare function hostSupports(call: AnnouncedCall): boolean;
package/dist/host.js CHANGED
@@ -1,7 +1,6 @@
1
1
  // The tag each catalog component renders, filled in by `component()`.
2
2
  const TAGS = new WeakMap();
3
3
  let hostElements = new Set();
4
- let hostCalls = new Set();
5
4
  export function registerTag(component, tag) {
6
5
  TAGS.set(component, tag);
7
6
  }
@@ -18,14 +17,3 @@ export function hostRenders(component) {
18
17
  const tag = TAGS.get(component);
19
18
  return tag !== undefined && hostElements.has(tag);
20
19
  }
21
- /** Called by the worker runtime with the calls the host announced on `init`. */
22
- export function setHostCalls(calls) {
23
- hostCalls = new Set(Array.isArray(calls) ? calls.filter((call) => typeof call === "string") : []);
24
- }
25
- /**
26
- * Whether this host serves `call`, one a host may lack: an older host, or one whose app cannot do it, refuses it. Offer
27
- * what the call does only when this is true. False on hosts that announce no calls, which predate every call here.
28
- */
29
- export function hostSupports(call) {
30
- return hostCalls.has(call);
31
- }
package/dist/index.d.ts CHANGED
@@ -4,7 +4,7 @@ export { usePluginContext, useNullplatform, useQuery, type WidgetProps, type Que
4
4
  export { nullplatform, type NullplatformBridge } from './bridge.js';
5
5
  export { useTopic, useSetTopic, type UseTopicOptions, type UseTopicResult, type UseSetTopicOptions, type SetTopicState, type TopicMap, type ServiceDraftV1, } from './topics.js';
6
6
  export * from './components.js';
7
- export { hostRenders, hostSupports } from './host.js';
7
+ export { hostRenders } from './host.js';
8
8
  export { Canvas, useCanvas, canDrawCanvas, type CanvasProps, type CanvasHandle, type CanvasOptions, type CanvasFrame, type CanvasItem, type CanvasInput, type CanvasTheme, type CanvasTooltip, } from './canvas.js';
9
- export type { PluginContext, ApiRequest, HttpRequest, HttpResponse, NavigationTarget, SnackbarOptions, ConfirmOptions, ProgressItem, ProgressPanel, FilePickOptions, PickedFile, FileUpload, TopicSnapshot, TopicStatus, AnnouncedCall } from './protocol.js';
9
+ export type { PluginContext, ApiRequest, HttpRequest, HttpResponse, NavigationTarget, SnackbarOptions, ConfirmOptions, TopicSnapshot, TopicStatus } from './protocol.js';
10
10
  export { BridgeError } from './protocol.js';
package/dist/index.js CHANGED
@@ -4,6 +4,6 @@ export { usePluginContext, useNullplatform, useQuery } from './context.js';
4
4
  export { nullplatform } from './bridge.js';
5
5
  export { useTopic, useSetTopic, } from './topics.js';
6
6
  export * from './components.js';
7
- export { hostRenders, hostSupports } from './host.js';
7
+ export { hostRenders } from './host.js';
8
8
  export { Canvas, useCanvas, canDrawCanvas, } from './canvas.js';
9
9
  export { BridgeError } from './protocol.js';
@@ -49,20 +49,6 @@ export interface PluginContext {
49
49
  name?: string;
50
50
  };
51
51
  };
52
- /**
53
- * Set on a service's own pages, and for each service of a list when the host asks which of a plugin's sections
54
- * apply to it. `specification` is the kind of service it is, the same a `when` reads as `service.specification.*`.
55
- */
56
- service?: {
57
- id: number | string;
58
- slug?: string;
59
- name?: string;
60
- specification?: {
61
- id: string;
62
- slug?: string;
63
- name?: string;
64
- };
65
- };
66
52
  /** Set on deployment pages. Not usable in `when` yet (see `CONTEXT_ROOTS`). */
67
53
  deployment?: {
68
54
  id: number | string;
@@ -136,87 +122,6 @@ export declare const CONFIRM_LIMITS: {
136
122
  readonly label: 40;
137
123
  readonly confirmationToken: 100;
138
124
  };
139
- /**
140
- * One line of the host's progress panel: one of the things a longer piece of work is made of (a file of an upload).
141
- * `waiting` has not started, `running` is in flight, `done` and `failed` are over.
142
- */
143
- export interface ProgressItem {
144
- /** Names the line across updates of the same panel. */
145
- id: string;
146
- label: string;
147
- /** A short note under the label: a size, or why it failed. */
148
- detail?: string;
149
- status: 'waiting' | 'running' | 'done' | 'failed';
150
- }
151
- /**
152
- * Work that takes a while, as the host draws it in a corner of the page: a plugin cannot draw over the page. The
153
- * host counts how many items are over out of `items`; it rejects a panel over a cap (see `PROGRESS_LIMITS`) rather
154
- * than cutting what the person reads.
155
- */
156
- export interface ProgressPanel {
157
- title: string;
158
- items: ProgressItem[];
159
- }
160
- /** Caps of a `ProgressPanel`: how many items, and the length of each string. */
161
- export declare const PROGRESS_LIMITS: {
162
- readonly title: 120;
163
- readonly items: 100;
164
- readonly id: 64;
165
- readonly label: 200;
166
- readonly detail: 200;
167
- };
168
- /** What `files.pick` asks the host's file picker for. */
169
- export interface FilePickOptions {
170
- /** The kinds of file the picker offers, as an `<input accept>` list: extensions (`.csv`) or media types (`image/*`). */
171
- accept?: string[];
172
- /** Lets the person pick several files at once (`FILE_LIMITS.picked` at most); one file otherwise. */
173
- multiple?: boolean;
174
- }
175
- /**
176
- * A file the person picked in the host's file picker. Its bytes stay in the host: a plugin never reads them. `id`
177
- * names the file for `files.upload`, for as long as the plugin runs.
178
- */
179
- export interface PickedFile {
180
- id: string;
181
- name: string;
182
- /** Size in bytes. */
183
- size: number;
184
- /** The media type the browser reports for the file; empty when it knows none. */
185
- type: string;
186
- }
187
- /**
188
- * Sends a picked file with an HTML form POST (`multipart/form-data`): every field in `fields`, then the file as
189
- * `file`. This is the shape of an S3 presigned POST. The host sends it without the person's session and cannot read
190
- * the answer (the upload's host need not allow the dashboard's origin), so check afterwards that the file arrived.
191
- */
192
- export interface FileUpload {
193
- /** The `id` of a `PickedFile`. */
194
- file: string;
195
- /** An https URL whose host is declared in `permissions.upload`. */
196
- url: string;
197
- /** Form fields sent before the file. */
198
- fields?: Record<string, string>;
199
- }
200
- /** Caps of `FilePickOptions` and `FileUpload`: counts and string lengths. `picked` is how many files one pick hands back. */
201
- export declare const FILE_LIMITS: {
202
- readonly accept: 20;
203
- readonly acceptEntry: 100;
204
- readonly picked: 100;
205
- readonly url: 2048;
206
- readonly fields: 50;
207
- readonly fieldName: 200;
208
- readonly fieldValue: 8192;
209
- };
210
- /**
211
- * An approval request's id, as the approvals API routes it (`/approval/:id([0-9]{1,})`): digits only. At most 19, a
212
- * 64-bit integer, which holds any id it stores; the host rejects anything else.
213
- */
214
- export declare const APPROVAL_ID: RegExp;
215
- /**
216
- * Bridge calls a host may lack: one older than the call, or whose app leaves its adapter out, refuses it. A host
217
- * that serves one announces it on `init` (see `hostSupports`). Only calls added since that announcement are here.
218
- */
219
- export type AnnouncedCall = 'ui.approval';
220
125
  /** Methods a plugin can call on the host. */
221
126
  export interface BridgeMethods {
222
127
  'assets.url': (path: string) => Promise<string>;
@@ -226,14 +131,6 @@ export interface BridgeMethods {
226
131
  'ui.snackbar': (options: SnackbarOptions) => Promise<void>;
227
132
  /** Resolves `true` only when the person confirms; `false` when they cancel or the host draws no dialog. */
228
133
  'ui.confirm': (options: ConfirmOptions) => Promise<boolean>;
229
- /** Draws, replaces or (with `null`) removes the plugin's progress panel. */
230
- 'ui.progress': (panel: ProgressPanel | null) => Promise<void>;
231
- /** Shows an approval request in the host's modal; resolves once the person closes it, saying nothing of what they did. */
232
- 'ui.approval': (approvalId: string) => Promise<void>;
233
- /** Resolves the files the person picked: none when they cancel, one unless `multiple`. */
234
- 'files.pick': (options?: FilePickOptions) => Promise<PickedFile[]>;
235
- /** Resolves once the form was sent; it does not say whether the upload's host accepted it. */
236
- 'files.upload': (upload: FileUpload) => Promise<void>;
237
134
  'context.get': () => Promise<PluginContext>;
238
135
  'topics.get': (topic: string) => Promise<TopicSnapshot>;
239
136
  'topics.subscribe': (topic: string) => Promise<TopicSnapshot>;
@@ -361,16 +258,12 @@ export type WorkerMessage = {
361
258
  error: SerializedError;
362
259
  };
363
260
  export type HostMessage =
364
- /**
365
- * `elements`: the catalog tags this host draws. Hosts before it fail a widget that renders a tag they lack.
366
- * `calls`: the `AnnouncedCall`s this host serves; hosts before it serve none of them.
367
- */
261
+ /** `elements`: the catalog tags this host draws. Hosts before it fail a widget that renders a tag they lack. */
368
262
  {
369
263
  type: 'init';
370
264
  pluginId: string;
371
265
  context: PluginContext;
372
266
  elements?: string[];
373
- calls?: string[];
374
267
  } | {
375
268
  type: 'mount';
376
269
  mountId: string;
package/dist/protocol.js CHANGED
@@ -9,25 +9,11 @@
9
9
  export const PROTOCOL_VERSION = 1;
10
10
  /** Maximum length of each `ConfirmOptions` string. */
11
11
  export const CONFIRM_LIMITS = { title: 200, message: 1000, label: 40, confirmationToken: 100 };
12
- /** Caps of a `ProgressPanel`: how many items, and the length of each string. */
13
- export const PROGRESS_LIMITS = { title: 120, items: 100, id: 64, label: 200, detail: 200 };
14
- /** Caps of `FilePickOptions` and `FileUpload`: counts and string lengths. `picked` is how many files one pick hands back. */
15
- export const FILE_LIMITS = { accept: 20, acceptEntry: 100, picked: 100, url: 2048, fields: 50, fieldName: 200, fieldValue: 8192 };
16
- /**
17
- * An approval request's id, as the approvals API routes it (`/approval/:id([0-9]{1,})`): digits only. At most 19, a
18
- * 64-bit integer, which holds any id it stores; the host rejects anything else.
19
- */
20
- export const APPROVAL_ID = /^[0-9]{1,19}$/;
21
12
  /** How long the host gives a bridge call before it answers `TIMEOUT`. */
22
13
  export const BRIDGE_CALL_DEADLINE_MS = 30000;
23
14
  /** Calls that wait for a person, not a machine, and so get longer than `BRIDGE_CALL_DEADLINE_MS`. */
24
15
  export const BRIDGE_CALL_DEADLINES_MS = {
25
16
  'ui.confirm': 10 * 60 * 1000,
26
- // Reading an approval and completing its checklist takes longer than a yes or no.
27
- 'ui.approval': 30 * 60 * 1000,
28
- 'files.pick': 10 * 60 * 1000,
29
- // Not a person, but a file on a slow connection: the same ten minutes.
30
- 'files.upload': 10 * 60 * 1000,
31
17
  };
32
18
  /** The host's deadline for one call. */
33
19
  export function bridgeCallDeadline(method) {
package/dist/worker.js CHANGED
@@ -9,7 +9,7 @@ import { BatchingRemoteConnection } from '@remote-dom/core/elements';
9
9
  import { defineCatalogElements, ROOT_TAG } from './elements.js';
10
10
  import { bridge } from './bridge.js';
11
11
  import { PluginContextProvider, broadcastContext } from './context.js';
12
- import { setHostCalls, setHostElements } from './host.js';
12
+ import { setHostElements } from './host.js';
13
13
  import { receiveTopic } from './topics.js';
14
14
  import { attachCanvasPort, receiveCanvas } from './canvas.js';
15
15
  import { PROTOCOL_VERSION, createIdGenerator, serializeError, serializeFunctions, } from './protocol.js';
@@ -89,7 +89,6 @@ function handle(port, message) {
89
89
  case 'init':
90
90
  pluginId = message.pluginId;
91
91
  setHostElements(message.elements);
92
- setHostCalls(message.calls);
93
92
  broadcastContext(message.context);
94
93
  break;
95
94
  case 'mount':