@adecore/intelligent-ui 0.64.1 → 0.65.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.
- package/dist/catalog.d.ts +4 -2
- package/dist/catalog.js +6 -3
- package/dist/fallback.js +1 -1
- package/dist/links.d.ts +1 -0
- package/dist/links.js +5 -1
- package/package.json +1 -1
- package/src/catalog.ts +6 -3
- package/src/fallback.ts +1 -1
- package/src/links.ts +6 -1
package/dist/catalog.d.ts
CHANGED
|
@@ -347,12 +347,14 @@ export declare const UI_CATALOG: {
|
|
|
347
347
|
};
|
|
348
348
|
readonly Source: {
|
|
349
349
|
readonly group: 'content';
|
|
350
|
-
readonly description: 'An HTTP or HTTPS source.';
|
|
350
|
+
readonly description: 'An HTTP or HTTPS source by url, or a host node by its id; exactly one.';
|
|
351
351
|
readonly schema: z.ZodObject<{
|
|
352
352
|
title: z.ZodString;
|
|
353
|
-
url: z.ZodString
|
|
353
|
+
url: z.ZodOptional<z.ZodString>;
|
|
354
|
+
node: z.ZodOptional<z.ZodString>;
|
|
354
355
|
}, z.core.$strict>;
|
|
355
356
|
readonly parent: 'Sources';
|
|
357
|
+
readonly needs: 'title url|node';
|
|
356
358
|
};
|
|
357
359
|
readonly File: {
|
|
358
360
|
readonly group: 'links';
|
package/dist/catalog.js
CHANGED
|
@@ -162,9 +162,12 @@ export const UI_CATALOG = {
|
|
|
162
162
|
Sources: { group: 'content', description: 'Numbered sources without preloading.', schema: empty, children: ['Source'] },
|
|
163
163
|
Source: {
|
|
164
164
|
group: 'content',
|
|
165
|
-
description: 'An HTTP or HTTPS source.',
|
|
166
|
-
schema: z
|
|
167
|
-
|
|
165
|
+
description: 'An HTTP or HTTPS source by url, or a host node by its id; exactly one.',
|
|
166
|
+
schema: z
|
|
167
|
+
.strictObject({ title: text, url: text.regex(/^https?:\/\//i).optional(), node: name.optional() })
|
|
168
|
+
.refine((props) => (props.url === undefined) !== (props.node === undefined), 'Give url or node, exclusively.'),
|
|
169
|
+
parent: 'Sources',
|
|
170
|
+
needs: 'title url|node'
|
|
168
171
|
},
|
|
169
172
|
File: {
|
|
170
173
|
group: 'links',
|
package/dist/fallback.js
CHANGED
|
@@ -28,7 +28,7 @@ export function uiNodeFallback(type, props, children) {
|
|
|
28
28
|
return `${uiPlainText(label)}: ${uiPlainText(props.value)}${unit}${previous}\n`;
|
|
29
29
|
}
|
|
30
30
|
case 'Source':
|
|
31
|
-
return `${uiPlainText(label)}: ${uiPlainText(props.url)}\n`;
|
|
31
|
+
return `${uiPlainText(label)}: ${uiPlainText(props.url ?? props.node)}\n`;
|
|
32
32
|
case 'Column':
|
|
33
33
|
return `${uiPlainText(props.title ?? props.key)}${given(props.unit) ? ` (${uiPlainText(props.unit)})` : ''}\n`;
|
|
34
34
|
case 'Table': {
|
package/dist/links.d.ts
CHANGED
|
@@ -42,6 +42,7 @@ export declare const UiLinkResolutionSchema: z.ZodObject<{
|
|
|
42
42
|
conflicted: z.ZodOptional<z.ZodBoolean>;
|
|
43
43
|
relativePath: z.ZodOptional<z.ZodString>;
|
|
44
44
|
label: z.ZodOptional<z.ZodString>;
|
|
45
|
+
detail: z.ZodOptional<z.ZodString>;
|
|
45
46
|
code: z.ZodOptional<z.ZodString>;
|
|
46
47
|
reason: z.ZodOptional<z.ZodString>;
|
|
47
48
|
}, z.core.$strip>;
|
package/dist/links.js
CHANGED
|
@@ -20,6 +20,8 @@ export const UiLinkResolutionSchema = z.object({
|
|
|
20
20
|
conflicted: z.boolean().optional(),
|
|
21
21
|
relativePath: z.string().optional(),
|
|
22
22
|
label: z.string().optional(),
|
|
23
|
+
// A second line under the label where a link stands as a row, such as the sender and date of a cited message.
|
|
24
|
+
detail: z.string().optional(),
|
|
23
25
|
// A code that names the reason across versions; open, so a new one fails nobody.
|
|
24
26
|
code: z.string().optional(),
|
|
25
27
|
reason: z.string().optional()
|
|
@@ -28,7 +30,9 @@ export function uiLinkTargets(block, input = {}, queries = {}, limits = {}) {
|
|
|
28
30
|
const state = uiValidatedState(block, input, queries, limits);
|
|
29
31
|
const targets = Object.create(null);
|
|
30
32
|
eachDrawnNode(evaluateUiBlock(block, state, limits).nodes, (node) => {
|
|
31
|
-
|
|
33
|
+
// A Source that cites a host node links it as a Node would, so the host checks and opens it the same way.
|
|
34
|
+
const candidate = node.type === 'Source' && typeof node.props.node === 'string' ? { type: 'Node', id: node.props.node } : { type: node.type, ...node.props };
|
|
35
|
+
const checked = UiLinkTargetSchema.safeParse(candidate);
|
|
32
36
|
if (checked.success) {
|
|
33
37
|
targets[node.id] = checked.data;
|
|
34
38
|
}
|
package/package.json
CHANGED
package/src/catalog.ts
CHANGED
|
@@ -172,9 +172,12 @@ export const UI_CATALOG = {
|
|
|
172
172
|
Sources: { group: 'content', description: 'Numbered sources without preloading.', schema: empty, children: ['Source'] },
|
|
173
173
|
Source: {
|
|
174
174
|
group: 'content',
|
|
175
|
-
description: 'An HTTP or HTTPS source.',
|
|
176
|
-
schema: z
|
|
177
|
-
|
|
175
|
+
description: 'An HTTP or HTTPS source by url, or a host node by its id; exactly one.',
|
|
176
|
+
schema: z
|
|
177
|
+
.strictObject({ title: text, url: text.regex(/^https?:\/\//i).optional(), node: name.optional() })
|
|
178
|
+
.refine((props) => (props.url === undefined) !== (props.node === undefined), 'Give url or node, exclusively.'),
|
|
179
|
+
parent: 'Sources',
|
|
180
|
+
needs: 'title url|node'
|
|
178
181
|
},
|
|
179
182
|
File: {
|
|
180
183
|
group: 'links',
|
package/src/fallback.ts
CHANGED
|
@@ -32,7 +32,7 @@ export function uiNodeFallback(type: string, props: Readonly<Record<string, unkn
|
|
|
32
32
|
return `${uiPlainText(label)}: ${uiPlainText(props.value)}${unit}${previous}\n`;
|
|
33
33
|
}
|
|
34
34
|
case 'Source':
|
|
35
|
-
return `${uiPlainText(label)}: ${uiPlainText(props.url)}\n`;
|
|
35
|
+
return `${uiPlainText(label)}: ${uiPlainText(props.url ?? props.node)}\n`;
|
|
36
36
|
case 'Column':
|
|
37
37
|
return `${uiPlainText(props.title ?? props.key)}${given(props.unit) ? ` (${uiPlainText(props.unit)})` : ''}\n`;
|
|
38
38
|
case 'Table': {
|
package/src/links.ts
CHANGED
|
@@ -25,6 +25,8 @@ export const UiLinkResolutionSchema = z.object({
|
|
|
25
25
|
conflicted: z.boolean().optional(),
|
|
26
26
|
relativePath: z.string().optional(),
|
|
27
27
|
label: z.string().optional(),
|
|
28
|
+
// A second line under the label where a link stands as a row, such as the sender and date of a cited message.
|
|
29
|
+
detail: z.string().optional(),
|
|
28
30
|
// A code that names the reason across versions; open, so a new one fails nobody.
|
|
29
31
|
code: z.string().optional(),
|
|
30
32
|
reason: z.string().optional()
|
|
@@ -41,7 +43,10 @@ export function uiLinkTargets(
|
|
|
41
43
|
const targets: Record<string, UiLinkTarget> = Object.create(null);
|
|
42
44
|
|
|
43
45
|
eachDrawnNode(evaluateUiBlock(block, state, limits).nodes, (node) => {
|
|
44
|
-
|
|
46
|
+
// A Source that cites a host node links it as a Node would, so the host checks and opens it the same way.
|
|
47
|
+
const candidate =
|
|
48
|
+
node.type === 'Source' && typeof node.props.node === 'string' ? { type: 'Node', id: node.props.node } : { type: node.type, ...node.props };
|
|
49
|
+
const checked = UiLinkTargetSchema.safeParse(candidate);
|
|
45
50
|
|
|
46
51
|
if (checked.success) {
|
|
47
52
|
targets[node.id] = checked.data;
|