@nullplatform/ui-plugin-sdk 0.19.0 → 0.19.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.
@@ -0,0 +1,244 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DocumentError = exports.DOCUMENT_NODE_TYPES = exports.DOCUMENT_VOCABULARY_LINE = exports.DOCUMENT_PROFILES = void 0;
4
+ exports.validatePluginDocument = validatePluginDocument;
5
+ exports.assertDocumentVocabulary = assertDocumentVocabulary;
6
+ exports.documentReadCheck = documentReadCheck;
7
+ const allowlist_1 = require("./allowlist");
8
+ /**
9
+ * Plugin documents (contracts 6 to 8): a `document` contribution is a JSON view in the SDUI vocabulary that the host
10
+ * draws with no plugin code running. This module holds the plugin profile's first cut: which node types a document may
11
+ * use, and the rule every read obeys. The full shape of each node is `@nullplatform/sdui-spec`'s to check, and the
12
+ * caller passes the spec in (`assertDocumentVocabulary`) until it is published, so the SDK depends on no renderer.
13
+ */
14
+ /**
15
+ * The plugin profile per vocabulary line (contract 7, proposal to validate with the SDUI owners): the node types a
16
+ * plugin document of that line may use. Within a line the list only grows, so a document published once keeps
17
+ * drawing; a change that would break one opens a new line. A document declares its line in its root (`vocabulary`),
18
+ * the `VOCABULARY_LINE` of `@nullplatform/sdui-spec`.
19
+ *
20
+ * Line 1, the first cut: layouts, labels, read controls, collections drawn as tables and navigation. Left out until
21
+ * the profile grows: `Definition` and `Reference` (the server expands them), `Page`, `Outlet`, `Slot`,
22
+ * `Categorization` and `Category` (routing and placement are the host's), and `Component` (another plugin's code).
23
+ */
24
+ exports.DOCUMENT_PROFILES = {
25
+ 1: ['VerticalLayout', 'HorizontalLayout', 'GridLayout', 'Group', 'Label', 'Control', 'Collection', 'Action'],
26
+ };
27
+ /** The line documents are written in today; the API accepts every line in `DOCUMENT_PROFILES`. */
28
+ exports.DOCUMENT_VOCABULARY_LINE = 1;
29
+ /** Node types of the current line's profile. */
30
+ exports.DOCUMENT_NODE_TYPES = exports.DOCUMENT_PROFILES[exports.DOCUMENT_VOCABULARY_LINE];
31
+ class DocumentError extends Error {
32
+ constructor(message) {
33
+ super(message);
34
+ this.name = 'DocumentError';
35
+ }
36
+ }
37
+ exports.DocumentError = DocumentError;
38
+ /**
39
+ * Keys that write, ask with a body, or need the server, anywhere in the document: a draft and its checks, pickers
40
+ * (`choices` reads candidates as a form), steps after an action, `rule` (expressions over the data, not in this
41
+ * cut), and what only the server writes (`contributions`, `release`).
42
+ */
43
+ const OUT_OF_CUT_KEYS = new Set(['draft', 'body', 'validate', 'choices', 'then', 'rule', 'contributes', 'contributions', 'release']);
44
+ /** One `{{ … }}` placeholder that is a singular path into the context (`$.url.params.id`), never an expression. */
45
+ const PLACEHOLDER = /^\{\{\s*(\$(?:\.[A-Za-z_][A-Za-z0-9_]*|\[[0-9]+\])+)\s*\}\}$/;
46
+ /** A literal path segment: characters an API path or a host route is written with, nothing a browser would drop. */
47
+ const LITERAL_SEGMENT = /^[A-Za-z0-9_~-][A-Za-z0-9_.~-]*$/;
48
+ /**
49
+ * Whitespace, control characters and backslashes anywhere in a url: a browser strips tabs and newlines and reads a
50
+ * backslash as a slash, so `/\t/evil.example.com` would become another site.
51
+ */
52
+ const UNSAFE_CHARACTERS = /[\s\\\u0000-\u001f\u007f]/;
53
+ /** A query parameter's name: a field, or a field with an operator (`name:contains`), as `sdui-spec` names them. */
54
+ const QUERY_PARAM = /^[a-z_][a-z0-9_.]*(:[a-z_]+)?$/;
55
+ /**
56
+ * What a placeholder segment becomes for the permission check: a pattern segment `{param}` matches it, a literal one
57
+ * can't, since no API path segment is written with braces.
58
+ */
59
+ const HOLE = '{{}}';
60
+ const isPlainObject = (value) => !!value && typeof value === 'object' && !Array.isArray(value);
61
+ /**
62
+ * Parses a read url of a plugin document: a public API path, each placeholder a whole segment or a whole query value.
63
+ * Throws a `DocumentError` saying what to write instead.
64
+ */
65
+ function parseRead(url, where) {
66
+ if (/^[a-z][a-z0-9+.-]*:/i.test(url) || url.startsWith('//')) {
67
+ throw new DocumentError(`${where}: "${url}" names a host; a document reads public API paths such as "/application/{{ $.url.params.id }}"`);
68
+ }
69
+ if (!url.startsWith('/'))
70
+ throw new DocumentError(`${where}: "${url}" must start with "/" (a public API path)`);
71
+ if (UNSAFE_CHARACTERS.test(url.replace(/\{\{[^}]*\}\}/g, ''))) {
72
+ throw new DocumentError(`${where}: "${url}" has whitespace, a control character or a backslash`);
73
+ }
74
+ const [path, query] = url.split(/\?(.*)/s, 2);
75
+ const segments = path.split('/').slice(1).map((segment) => {
76
+ if (segment.includes('{') || segment.includes('}')) {
77
+ if (PLACEHOLDER.test(segment))
78
+ return null;
79
+ throw new DocumentError(`${where}: "${url}": a placeholder takes a whole path segment and is a path into the context, such as {{ $.url.params.id }}`);
80
+ }
81
+ if (!LITERAL_SEGMENT.test(segment) || segment === '..') {
82
+ throw new DocumentError(`${where}: "${url}" has an empty, relative or encoded segment, or one with characters outside A-Z, a-z, 0-9 and _ . ~ -`);
83
+ }
84
+ return segment;
85
+ });
86
+ for (const pair of query ? query.split('&') : []) {
87
+ const [name, value = ''] = pair.split(/=(.*)/s, 2);
88
+ if (!QUERY_PARAM.test(name))
89
+ throw new DocumentError(`${where}: "${url}": "${name}" is not a query parameter name`);
90
+ if ((value.includes('{') || value.includes('}')) && !PLACEHOLDER.test(value)) {
91
+ throw new DocumentError(`${where}: "${url}": a placeholder takes a whole query value and is a path into the context`);
92
+ }
93
+ }
94
+ return { segments };
95
+ }
96
+ const asPath = (read, hole) => '/' + read.segments.map((segment, index) => segment ?? hole(index)).join('/');
97
+ /** Checks one read against the plugin's `permissions.api`, with the runtime's own matcher. */
98
+ function assertCovered(read, url, permissions, where) {
99
+ if ((0, allowlist_1.isApiRequestAllowed)(permissions, 'GET', asPath(read, () => HOLE)))
100
+ return;
101
+ const suggested = asPath(read, (index) => `{param${index}}`);
102
+ const hint = read.segments[0] === 'v1' ? ' Paths are relative to the public API root, without "/v1".' : '';
103
+ throw new DocumentError(`${where}: GET ${url} is not covered by permissions.api; declare { "method": "GET", "path": "${suggested}" } or a pattern that covers it.${hint}`);
104
+ }
105
+ function checkText(value, where) {
106
+ if (isPlainObject(value) && 'i18n' in value)
107
+ throw new DocumentError(`${where}: translatable texts ({ "i18n": … }) are not in the first cut; write the text`);
108
+ }
109
+ /**
110
+ * Walks every value of a node's options: each `url` is a read the plugin declared, a `schema` given as a url too,
111
+ * `method` is only GET, and nothing that writes or needs the server.
112
+ */
113
+ function checkOptions(value, where, visit) {
114
+ if (Array.isArray(value)) {
115
+ value.forEach((item, index) => checkOptions(item, `${where}[${index}]`, visit));
116
+ return;
117
+ }
118
+ if (!isPlainObject(value))
119
+ return;
120
+ checkText(value, where);
121
+ for (const [key, child] of Object.entries(value)) {
122
+ const at = `${where}.${key}`;
123
+ if (OUT_OF_CUT_KEYS.has(key))
124
+ throw new DocumentError(`${at} is not in the first cut of plugin documents (read-only, resolved shape)`);
125
+ if (key === 'method' && child !== 'GET')
126
+ throw new DocumentError(`${at}: a document only reads (GET)`);
127
+ if (key === 'kind' && child !== 'navigate')
128
+ throw new DocumentError(`${at}: "${String(child)}" is not in the first cut; an action only navigates`);
129
+ if (key === 'to')
130
+ throw new DocumentError(`${at}: "to" is a page the server turns into a link; a document is drawn as written, so write the host path in "href"`);
131
+ if (key === 'href') {
132
+ if (typeof child !== 'string')
133
+ throw new DocumentError(`${at} must be a string`);
134
+ // A host path, built like a read: never a scheme or a second slash (another site, a script), never `..`, only
135
+ // safe characters. A placeholder fills one segment; the renderer refuses a filled-in link that is not a path
136
+ // of this origin (sdui-engine's `isRootRelativeHref`).
137
+ parseRead(child, at);
138
+ continue;
139
+ }
140
+ if (key === 'url' || (key === 'schema' && typeof child === 'string' && child.startsWith('/'))) {
141
+ if (typeof child !== 'string')
142
+ throw new DocumentError(`${at} must be a string`);
143
+ visit(child, at);
144
+ continue;
145
+ }
146
+ checkOptions(child, at, visit);
147
+ }
148
+ }
149
+ function checkNode(node, where, types, visit) {
150
+ if (!isPlainObject(node))
151
+ throw new DocumentError(`${where} must be an object`);
152
+ const type = node.type;
153
+ if (typeof type !== 'string' || !types.includes(type)) {
154
+ throw new DocumentError(`${where}: node type "${String(type)}" is not in the first cut (${types.join(', ')})`);
155
+ }
156
+ const at = `${where}(${type})`;
157
+ for (const key of Object.keys(node)) {
158
+ if (OUT_OF_CUT_KEYS.has(key))
159
+ throw new DocumentError(`${at}.${key} is not in the first cut of plugin documents (read-only, resolved shape)`);
160
+ }
161
+ checkText(node.label, `${at}.label`);
162
+ const options = node.options;
163
+ if (options !== undefined && !isPlainObject(options))
164
+ throw new DocumentError(`${at}.options must be an object`);
165
+ if (type === 'Collection' && options?.format !== 'table')
166
+ throw new DocumentError(`${at}: a collection is drawn as a table (options.format "table") in the first cut`);
167
+ if (type === 'Action' && options?.kind !== 'navigate')
168
+ throw new DocumentError(`${at}: an action only navigates (options.kind "navigate") in the first cut`);
169
+ checkOptions(options, `${at}.options`, visit);
170
+ if (node.elements !== undefined) {
171
+ if (!Array.isArray(node.elements))
172
+ throw new DocumentError(`${at}.elements must be an array`);
173
+ node.elements.forEach((child, index) => checkNode(child, `${at}.elements[${index}]`, types, visit));
174
+ }
175
+ }
176
+ /** Every read url of a document that already passed `validatePluginDocument`, in document order. */
177
+ function readsOf(document, permissions) {
178
+ const reads = [];
179
+ const types = exports.DOCUMENT_PROFILES[document.vocabulary] ?? [];
180
+ checkNode(document, 'document', types, (url, where) => {
181
+ const read = parseRead(url, where);
182
+ assertCovered(read, url, permissions, where);
183
+ reads.push(read);
184
+ });
185
+ return reads;
186
+ }
187
+ /**
188
+ * Validates an untrusted plugin document against the first cut of the plugin profile and the plugin's
189
+ * `permissions.api` (contract 8): every read is a public API path, GET, covered by a declared permission, with its
190
+ * placeholders as whole segments. Throws a `DocumentError` describing the first problem.
191
+ */
192
+ function validatePluginDocument(input, permissions) {
193
+ if (!isPlainObject(input))
194
+ throw new DocumentError('A document must be a JSON object');
195
+ if (typeof input.vocabulary !== 'number' || !(input.vocabulary in exports.DOCUMENT_PROFILES)) {
196
+ throw new DocumentError(`A document declares its vocabulary line in its root: "vocabulary": ${exports.DOCUMENT_VOCABULARY_LINE} (accepted: ${Object.keys(exports.DOCUMENT_PROFILES).join(', ')})`);
197
+ }
198
+ readsOf(input, permissions);
199
+ return input;
200
+ }
201
+ /**
202
+ * Checks a document against the vocabulary itself (contract 6): a node as the server would answer it, the shape SDUI's
203
+ * renderer draws (ids are uuids, links are `href`, options closed per type). `vocabulary` is the plugin document's own
204
+ * envelope key, so it is set aside first. A line newer than the vocabulary's is refused. Run it after
205
+ * `validatePluginDocument`; throws a `DocumentError` naming up to five problems.
206
+ */
207
+ function assertDocumentVocabulary(document, vocabulary) {
208
+ const { vocabulary: line, ...node } = document;
209
+ if (line > vocabulary.line) {
210
+ throw new DocumentError(`The document's vocabulary line ${line} is newer than this platform's (${vocabulary.line})`);
211
+ }
212
+ const parsed = vocabulary.node.safeParse(node);
213
+ if (parsed.success)
214
+ return;
215
+ const issues = (parsed.error?.issues ?? [])
216
+ .slice(0, 5)
217
+ .map((issue) => `${issue.path.length ? '/' + issue.path.map(String).join('/') : '/'}: ${issue.message}`);
218
+ throw new DocumentError(`The document is not a view the renderer draws: ${issues.join('; ')}`);
219
+ }
220
+ /**
221
+ * Builds the check for the reads the renderer asks for while drawing a document: a read is allowed when it is a GET,
222
+ * the interpolated url's path matches one of the document's read urls (each placeholder exactly one segment) and
223
+ * `permissions.api` covers it. Query strings are never part of the decision, as with widgets. The document is walked
224
+ * once, here, and not on every read; a document whose reads don't pass allows none.
225
+ */
226
+ function documentReadCheck(document, permissions) {
227
+ let reads;
228
+ try {
229
+ reads = readsOf(document, permissions);
230
+ }
231
+ catch {
232
+ reads = [];
233
+ }
234
+ return (method, url) => {
235
+ if (method.toUpperCase() !== 'GET')
236
+ return false;
237
+ const [path] = url.split('?', 1);
238
+ const requested = (0, allowlist_1.normalizePath)(path);
239
+ if (!requested || !(0, allowlist_1.isApiRequestAllowed)(permissions, 'GET', path))
240
+ return false;
241
+ return reads.some((read) => read.segments.length === requested.length &&
242
+ read.segments.every((segment, index) => (segment === null ? requested[index].length > 0 : segment === requested[index])));
243
+ };
244
+ }
@@ -1,10 +1,11 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.assertTopicValue = exports.redactBySchema = exports.projectFields = exports.canProvideTopic = exports.consumeGrant = exports.isFieldPath = exports.topicOwner = exports.isHostTopic = exports.isTopicName = exports.TOPIC_VALUE_MAX_CHARS = exports.resolveAssetUrl = exports.validateStorageUrl = exports.PLUGIN_STORAGE_ORIGIN = exports.WhenError = exports.rolloutIncludes = exports.evaluateWhen = exports.validateWhen = exports.extractRoots = exports.CONTEXT_ROOTS = exports.matchFixture = exports.canonicalizePath = exports.normalizePath = exports.isRequestAllowed = exports.isHttpRequestAllowed = exports.isApiRequestAllowed = exports.isPageTemplateDefinition = exports.pageTemplateProblems = exports.MIN_PAGE_AREA_WIDTH = exports.REQUIRED_PAGE_AREA = exports.PAGE_AREAS = exports.layoutConflicts = exports.pageOf = exports.readPlaceRoots = exports.contextSatisfies = exports.missingContext = exports.PLACE_ROOTS = exports.ManifestError = exports.isSectionSlot = exports.RESERVED_PLUGIN_ID = exports.contributionId = exports.unnamedContributions = exports.validatePublishableManifest = exports.validateManifest = exports.PROTOCOL_VERSION = void 0;
3
+ exports.assertTopicValue = exports.redactBySchema = exports.projectFields = exports.canProvideTopic = exports.consumeGrant = exports.isFieldPath = exports.topicOwner = exports.isHostTopic = exports.isTopicName = exports.TOPIC_VALUE_MAX_CHARS = exports.resolveAssetUrl = exports.validateStorageUrl = exports.PLUGIN_STORAGE_ORIGIN = exports.WhenError = exports.rolloutIncludes = exports.evaluateWhen = exports.validateWhen = exports.extractRoots = exports.CONTEXT_ROOTS = exports.matchFixture = exports.canonicalizePath = exports.normalizePath = exports.isReservedApiRequest = exports.isRequestAllowed = exports.isHttpRequestAllowed = exports.isApiRequestAllowed = exports.isPageTemplateDefinition = exports.pageTemplateProblems = exports.MIN_PAGE_AREA_WIDTH = exports.REQUIRED_PAGE_AREA = exports.PAGE_AREAS = exports.layoutConflicts = exports.pageOf = exports.readPlaceRoots = exports.contextSatisfies = exports.missingContext = exports.PLACE_ROOTS = exports.ManifestError = exports.isSectionSlot = exports.RESERVED_PLUGIN_ID = exports.contributionId = exports.unnamedContributions = exports.validateAuthoredApiPermissions = exports.validatePublishableManifest = exports.validateManifest = exports.PROTOCOL_VERSION = void 0;
4
4
  var manifest_1 = require("./manifest");
5
5
  Object.defineProperty(exports, "PROTOCOL_VERSION", { enumerable: true, get: function () { return manifest_1.PROTOCOL_VERSION; } });
6
6
  Object.defineProperty(exports, "validateManifest", { enumerable: true, get: function () { return manifest_1.validateManifest; } });
7
7
  Object.defineProperty(exports, "validatePublishableManifest", { enumerable: true, get: function () { return manifest_1.validatePublishableManifest; } });
8
+ Object.defineProperty(exports, "validateAuthoredApiPermissions", { enumerable: true, get: function () { return manifest_1.validateAuthoredApiPermissions; } });
8
9
  Object.defineProperty(exports, "unnamedContributions", { enumerable: true, get: function () { return manifest_1.unnamedContributions; } });
9
10
  Object.defineProperty(exports, "contributionId", { enumerable: true, get: function () { return manifest_1.contributionId; } });
10
11
  Object.defineProperty(exports, "RESERVED_PLUGIN_ID", { enumerable: true, get: function () { return manifest_1.RESERVED_PLUGIN_ID; } });
@@ -28,6 +29,7 @@ var allowlist_1 = require("./allowlist");
28
29
  Object.defineProperty(exports, "isApiRequestAllowed", { enumerable: true, get: function () { return allowlist_1.isApiRequestAllowed; } });
29
30
  Object.defineProperty(exports, "isHttpRequestAllowed", { enumerable: true, get: function () { return allowlist_1.isHttpRequestAllowed; } });
30
31
  Object.defineProperty(exports, "isRequestAllowed", { enumerable: true, get: function () { return allowlist_1.isRequestAllowed; } });
32
+ Object.defineProperty(exports, "isReservedApiRequest", { enumerable: true, get: function () { return allowlist_1.isReservedApiRequest; } });
31
33
  Object.defineProperty(exports, "normalizePath", { enumerable: true, get: function () { return allowlist_1.normalizePath; } });
32
34
  Object.defineProperty(exports, "canonicalizePath", { enumerable: true, get: function () { return allowlist_1.canonicalizePath; } });
33
35
  var fixtures_1 = require("./fixtures");
@@ -5,10 +5,12 @@ exports.isSectionSlot = isSectionSlot;
5
5
  exports.validateManifest = validateManifest;
6
6
  exports.contributionId = contributionId;
7
7
  exports.validatePublishableManifest = validatePublishableManifest;
8
+ exports.validateAuthoredApiPermissions = validateAuthoredApiPermissions;
8
9
  exports.unnamedContributions = unnamedContributions;
9
10
  const when_1 = require("./when");
10
11
  const topics_1 = require("./topics");
11
12
  const context_1 = require("./context");
13
+ const allowlist_1 = require("./allowlist");
12
14
  exports.PROTOCOL_VERSION = 1;
13
15
  class ManifestError extends Error {
14
16
  constructor(message) {
@@ -102,7 +104,8 @@ function validateManifest(input) {
102
104
  permissions.api = rawPermissions.api.map((raw, index) => {
103
105
  const p = (raw ?? {});
104
106
  const where = `permissions.api[${index}]`;
105
- return { method: readMethod(p.method, where), path: readPath(p.path, where) };
107
+ const method = readMethod(p.method, where);
108
+ return { method, path: readPath(p.path, where) };
106
109
  });
107
110
  }
108
111
  if (rawPermissions.http !== undefined) {
@@ -214,6 +217,27 @@ function validatePublishableManifest(input) {
214
217
  });
215
218
  return manifest;
216
219
  }
220
+ /**
221
+ * What a manifest's `permissions.api` must meet where the manifest is written: at publish and in developer mode, never
222
+ * where a stored revision is read. Each path names its resource, so a reviewer reading the manifest sees what the
223
+ * plugin calls, and none names an operation no plugin may call (`isReservedApiRequest`). A revision published before
224
+ * these rules keeps loading, and the call itself is refused (`isApiRequestAllowed`), so a page loses one call, not
225
+ * the whole plugin. A placeholder deeper in the path can still cover a reserved operation (`POST /catalog/{kind}/{type}`):
226
+ * that too is refused at call time, on the path actually requested.
227
+ */
228
+ function validateAuthoredApiPermissions(manifest) {
229
+ (manifest.permissions?.api ?? []).forEach(({ method, path }, index) => {
230
+ const where = `permissions.api[${index}]`;
231
+ const [resource] = path.slice(1).split('/');
232
+ if (resource.startsWith('{') && resource.endsWith('}')) {
233
+ throw new ManifestError(`${where}.path must name its resource: "${resource}" cannot be the first segment`);
234
+ }
235
+ if ((0, allowlist_1.isReservedApiRequest)(method, path)) {
236
+ throw new ManifestError(`${where}: plugins may not ${method === '*' ? 'call' : method} ${path}: it is reserved, because a plugin acts with the rights of whoever views it`);
237
+ }
238
+ });
239
+ return manifest;
240
+ }
217
241
  /**
218
242
  * Contributions that go by their widget for lack of an `id`. Publishable, but renaming the widget would rename the
219
243
  * block, its flag and its place in layouts, so the CLI warns about them.
@@ -1,5 +1,6 @@
1
1
  import type { ReactNode } from "react";
2
2
  import type { UI_COMPONENTS_CONTRACTS } from "./contracts.generated.js";
3
+ import type { CalendarEvent, CalendarSlot, CalendarTimelineBar, CalendarTimelineRow } from "./calendar.js";
3
4
  import type { DataTableColumn, DataTablePagination, DataTableRow, DataTableState } from "./dataTable.js";
4
5
  type Contract = (typeof UI_COMPONENTS_CONTRACTS)[number];
5
6
  /** The elements the SDK takes from @nullplatform/react-ui-components' contracts. */
@@ -27,6 +28,28 @@ interface ContractPropTypes {
27
28
  onChangeTableState?: (state: DataTableState) => void;
28
29
  onRowClick?: (row: DataTableRow) => void;
29
30
  };
31
+ "np-calendar-month": {
32
+ events?: readonly CalendarEvent[];
33
+ onEventPress?: (id: string) => void;
34
+ /** A `YYYY-MM-DD` day. */
35
+ onDayPress?: (day: string) => void;
36
+ onMorePress?: (day: string) => void;
37
+ };
38
+ "np-calendar-week": {
39
+ events?: readonly CalendarEvent[];
40
+ onEventPress?: (id: string) => void;
41
+ onSlotPress?: (slot: CalendarSlot) => void;
42
+ };
43
+ "np-calendar-timeline": {
44
+ rows?: readonly CalendarTimelineRow[];
45
+ bars?: readonly CalendarTimelineBar[];
46
+ /** The timeline reads only these two. */
47
+ emptyStateProps?: {
48
+ title?: string;
49
+ description?: string;
50
+ };
51
+ onBarPress?: (id: string) => void;
52
+ };
30
53
  }
31
54
  type Typed<Tag, Props> = Tag extends keyof ContractPropTypes ? Omit<Props, keyof ContractPropTypes[Tag]> & Pick<ContractPropTypes[Tag], Extract<keyof ContractPropTypes[Tag], keyof Props>> : Props;
32
55
  /**
@@ -693,6 +693,9 @@ export declare const UI_COMPONENTS_CONTRACTS: readonly [{
693
693
  readonly now: "string";
694
694
  readonly locale: "string";
695
695
  readonly resourceLabel: "string";
696
+ readonly loading: "boolean";
697
+ readonly emptyStateProps: "object";
698
+ readonly maxRows: "number";
696
699
  };
697
700
  readonly events: {
698
701
  readonly barPress: "onBarPress";
@@ -765,4 +768,158 @@ export declare const UI_COMPONENTS_CONTRACTS: readonly [{
765
768
  readonly events: {
766
769
  readonly change: "onChange";
767
770
  };
771
+ }, {
772
+ readonly tag: "np-checkbox";
773
+ readonly component: "Checkbox";
774
+ readonly properties: {
775
+ readonly checked: "boolean";
776
+ readonly disabled: "boolean";
777
+ };
778
+ readonly events: {
779
+ readonly change: "onChange";
780
+ };
781
+ }, {
782
+ readonly tag: "np-checkbox-card";
783
+ readonly component: "CheckboxCard";
784
+ readonly properties: {
785
+ readonly label: "string";
786
+ readonly description: "string";
787
+ readonly icon: "string";
788
+ readonly checked: "boolean";
789
+ readonly size: "string";
790
+ readonly variant: "string";
791
+ readonly align: "string";
792
+ readonly justify: "string";
793
+ readonly orientation: "string";
794
+ readonly indicator: "boolean";
795
+ readonly disabled: "boolean";
796
+ readonly readOnly: "boolean";
797
+ readonly error: "boolean";
798
+ };
799
+ readonly events: {
800
+ readonly change: "onChange";
801
+ };
802
+ readonly values: {
803
+ readonly size: readonly ["sm", "md", "lg"];
804
+ readonly variant: readonly ["outline", "surface", "subtle", "solid"];
805
+ readonly align: readonly ["start", "end", "center"];
806
+ readonly justify: readonly ["start", "end", "center"];
807
+ readonly orientation: readonly ["horizontal", "vertical"];
808
+ };
809
+ }, {
810
+ readonly tag: "np-slider";
811
+ readonly component: "Slider";
812
+ readonly properties: {
813
+ readonly value: "number";
814
+ readonly min: "number";
815
+ readonly max: "number";
816
+ readonly step: "number";
817
+ readonly disabled: "boolean";
818
+ readonly "aria-label": "string";
819
+ };
820
+ readonly events: {
821
+ readonly change: "onChange";
822
+ readonly changeCommitted: "onChangeCommitted";
823
+ };
824
+ }, {
825
+ readonly tag: "np-accordion";
826
+ readonly component: "Accordion";
827
+ readonly properties: {
828
+ readonly expanded: "boolean";
829
+ readonly defaultExpanded: "boolean";
830
+ readonly disabled: "boolean";
831
+ readonly disableGutters: "boolean";
832
+ };
833
+ readonly events: {
834
+ readonly change: "onChange";
835
+ };
836
+ readonly children: true;
837
+ }, {
838
+ readonly tag: "np-accordion-summary";
839
+ readonly component: "AccordionSummary";
840
+ readonly properties: {};
841
+ readonly events: {};
842
+ readonly slots: readonly ["expandIcon"];
843
+ readonly children: true;
844
+ }, {
845
+ readonly tag: "np-accordion-details";
846
+ readonly component: "AccordionDetails";
847
+ readonly properties: {};
848
+ readonly events: {};
849
+ readonly children: true;
850
+ }, {
851
+ readonly tag: "np-date-picker";
852
+ readonly component: "DatePickerField";
853
+ readonly properties: {
854
+ readonly value: "string";
855
+ readonly minDate: "string";
856
+ readonly maxDate: "string";
857
+ readonly timeZone: "string";
858
+ readonly label: "string";
859
+ readonly helperText: "string";
860
+ readonly error: "boolean";
861
+ readonly disabled: "boolean";
862
+ };
863
+ readonly events: {
864
+ readonly change: "onChange";
865
+ };
866
+ }, {
867
+ readonly tag: "np-filter-single-date";
868
+ readonly component: "FilterSingleDateField";
869
+ readonly properties: {
870
+ readonly value: "string";
871
+ readonly preset: "string";
872
+ readonly presets: "array";
873
+ readonly timeZone: "string";
874
+ readonly label: "string";
875
+ readonly placeholder: "string";
876
+ readonly customLabel: "string";
877
+ readonly helperText: "string";
878
+ readonly error: "boolean";
879
+ readonly required: "boolean";
880
+ readonly disabled: "boolean";
881
+ readonly minDate: "string";
882
+ readonly maxDate: "string";
883
+ readonly disablePast: "boolean";
884
+ readonly disableFuture: "boolean";
885
+ readonly hideActionButtons: "boolean";
886
+ };
887
+ readonly events: {
888
+ readonly change: "onChange";
889
+ };
890
+ }, {
891
+ readonly tag: "np-stepper";
892
+ readonly component: "Stepper";
893
+ readonly properties: {
894
+ readonly activeStep: "number";
895
+ readonly orientation: "string";
896
+ readonly alternativeLabel: "boolean";
897
+ readonly nonLinear: "boolean";
898
+ };
899
+ readonly events: {};
900
+ readonly values: {
901
+ readonly orientation: readonly ["horizontal", "vertical"];
902
+ };
903
+ readonly children: true;
904
+ }, {
905
+ readonly tag: "np-step";
906
+ readonly component: "Step";
907
+ readonly properties: {
908
+ readonly index: "number";
909
+ readonly last: "boolean";
910
+ readonly active: "boolean";
911
+ readonly completed: "boolean";
912
+ readonly disabled: "boolean";
913
+ };
914
+ readonly events: {};
915
+ readonly children: true;
916
+ }, {
917
+ readonly tag: "np-step-label";
918
+ readonly component: "StepLabel";
919
+ readonly properties: {
920
+ readonly error: "boolean";
921
+ };
922
+ readonly events: {};
923
+ readonly slots: readonly ["optional"];
924
+ readonly children: true;
768
925
  }];
@@ -1,4 +1,4 @@
1
- // Generated by scripts/sync-contracts.mjs from @nullplatform/react-ui-components@0.16.0. Don't edit: change the contract in
1
+ // Generated by scripts/sync-contracts.mjs from @nullplatform/react-ui-components@0.16.15. 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
  {
@@ -348,7 +348,7 @@ export const UI_COMPONENTS_CONTRACTS = [
348
348
  {
349
349
  tag: "np-calendar-timeline",
350
350
  component: "CalendarTimeline",
351
- properties: { "from": "string", "to": "string", "timeZone": "string", "rows": "array", "bars": "array", "selectedId": "string", "now": "string", "locale": "string", "resourceLabel": "string" },
351
+ 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
352
  events: { "barPress": "onBarPress" },
353
353
  values: { "rows[].kind": ["organization", "account", "namespace", "application"], "bars[].kind": ["freeze", "window"], "bars[].state": ["active", "upcoming", "past"] },
354
354
  },
@@ -378,4 +378,80 @@ export const UI_COMPONENTS_CONTRACTS = [
378
378
  properties: { "start": "string", "end": "string", "allDay": "boolean", "timeZone": "string", "locale": "string", "label": "string", "error": "string", "disabled": "boolean" },
379
379
  events: { "change": "onChange" },
380
380
  },
381
+ {
382
+ tag: "np-checkbox",
383
+ component: "Checkbox",
384
+ properties: { "checked": "boolean", "disabled": "boolean" },
385
+ events: { "change": "onChange" },
386
+ },
387
+ {
388
+ tag: "np-checkbox-card",
389
+ component: "CheckboxCard",
390
+ 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" },
391
+ events: { "change": "onChange" },
392
+ values: { "size": ["sm", "md", "lg"], "variant": ["outline", "surface", "subtle", "solid"], "align": ["start", "end", "center"], "justify": ["start", "end", "center"], "orientation": ["horizontal", "vertical"] },
393
+ },
394
+ {
395
+ tag: "np-slider",
396
+ component: "Slider",
397
+ properties: { "value": "number", "min": "number", "max": "number", "step": "number", "disabled": "boolean", "aria-label": "string" },
398
+ events: { "change": "onChange", "changeCommitted": "onChangeCommitted" },
399
+ },
400
+ {
401
+ tag: "np-accordion",
402
+ component: "Accordion",
403
+ properties: { "expanded": "boolean", "defaultExpanded": "boolean", "disabled": "boolean", "disableGutters": "boolean" },
404
+ events: { "change": "onChange" },
405
+ children: true,
406
+ },
407
+ {
408
+ tag: "np-accordion-summary",
409
+ component: "AccordionSummary",
410
+ properties: {},
411
+ events: {},
412
+ slots: ["expandIcon"],
413
+ children: true,
414
+ },
415
+ {
416
+ tag: "np-accordion-details",
417
+ component: "AccordionDetails",
418
+ properties: {},
419
+ events: {},
420
+ children: true,
421
+ },
422
+ {
423
+ tag: "np-date-picker",
424
+ component: "DatePickerField",
425
+ properties: { "value": "string", "minDate": "string", "maxDate": "string", "timeZone": "string", "label": "string", "helperText": "string", "error": "boolean", "disabled": "boolean" },
426
+ events: { "change": "onChange" },
427
+ },
428
+ {
429
+ tag: "np-filter-single-date",
430
+ component: "FilterSingleDateField",
431
+ 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" },
432
+ events: { "change": "onChange" },
433
+ },
434
+ {
435
+ tag: "np-stepper",
436
+ component: "Stepper",
437
+ properties: { "activeStep": "number", "orientation": "string", "alternativeLabel": "boolean", "nonLinear": "boolean" },
438
+ events: {},
439
+ values: { "orientation": ["horizontal", "vertical"] },
440
+ children: true,
441
+ },
442
+ {
443
+ tag: "np-step",
444
+ component: "Step",
445
+ properties: { "index": "number", "last": "boolean", "active": "boolean", "completed": "boolean", "disabled": "boolean" },
446
+ events: {},
447
+ children: true,
448
+ },
449
+ {
450
+ tag: "np-step-label",
451
+ component: "StepLabel",
452
+ properties: { "error": "boolean" },
453
+ events: {},
454
+ slots: ["optional"],
455
+ children: true,
456
+ },
381
457
  ];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nullplatform/ui-plugin-sdk",
3
- "version": "0.19.0",
3
+ "version": "0.19.1",
4
4
  "description": "SDK for nullplatform UI plugins: catalog components, bridge client and defineUI",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -42,7 +42,7 @@
42
42
  "test": "vitest run --passWithNoTests",
43
43
  "sync:contracts": "node scripts/sync-contracts.mjs"
44
44
  },
45
- "uiComponentsContracts": "0.16.0",
45
+ "uiComponentsContracts": "0.16.15",
46
46
  "dependencies": {
47
47
  "@remote-dom/core": "^1.11.1",
48
48
  "@remote-dom/react": "^1.2.2",