@ankhorage/zora 27.6.0 → 27.7.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.
Files changed (96) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/README.md +1 -1
  3. package/dist/capabilities/index.js +94 -5
  4. package/dist/capabilities/index.js.map +5 -5
  5. package/dist/constants/authoring.d.ts +4 -3
  6. package/dist/constants/authoring.d.ts.map +1 -1
  7. package/dist/constants/authoring.js +2 -0
  8. package/dist/constants/authoring.js.map +1 -1
  9. package/dist/features/accordion/accordionItemMeta.d.ts +1 -1
  10. package/dist/features/bottom-sheet/bottomSheetMeta.d.ts +1 -1
  11. package/dist/features/card/cardMeta.d.ts +1 -1
  12. package/dist/features/card/mediaCardMeta.d.ts +1 -1
  13. package/dist/features/card/postCardMeta.d.ts +1 -1
  14. package/dist/features/chat/messageBubbleMeta.d.ts +1 -1
  15. package/dist/features/data-table/adapters/inbound/DataTable.d.ts.map +1 -1
  16. package/dist/features/data-table/adapters/inbound/DataTable.js +90 -18
  17. package/dist/features/data-table/adapters/inbound/DataTable.js.map +1 -1
  18. package/dist/features/data-table/dataTableMeta.d.ts +63 -0
  19. package/dist/features/data-table/dataTableMeta.d.ts.map +1 -1
  20. package/dist/features/data-table/dataTableMeta.js +42 -0
  21. package/dist/features/data-table/dataTableMeta.js.map +1 -1
  22. package/dist/features/data-table/public.d.ts +1 -1
  23. package/dist/features/data-table/public.d.ts.map +1 -1
  24. package/dist/features/data-table/public.js.map +1 -1
  25. package/dist/features/dialog/dialogMeta.d.ts +2 -2
  26. package/dist/features/gradient/gradientMeta.d.ts +1 -1
  27. package/dist/features/graph-view/adapters/inbound/web-artifact/createGraphController.js +7 -2
  28. package/dist/features/graph-view/adapters/inbound/web-artifact/createGraphController.js.map +1 -1
  29. package/dist/features/graph-view/adapters/inbound/web-artifact/createGraphRuntime.d.ts.map +1 -1
  30. package/dist/features/graph-view/adapters/inbound/web-artifact/createGraphRuntime.js +8 -4
  31. package/dist/features/graph-view/adapters/inbound/web-artifact/createGraphRuntime.js.map +1 -1
  32. package/dist/features/graph-view/adapters/inbound/web-artifact/placeAddedGraphNodes.d.ts.map +1 -1
  33. package/dist/features/graph-view/adapters/inbound/web-artifact/placeAddedGraphNodes.js +18 -6
  34. package/dist/features/graph-view/adapters/inbound/web-artifact/placeAddedGraphNodes.js.map +1 -1
  35. package/dist/features/keyboard-avoiding-view/keyboardAvoidingViewMeta.d.ts +1 -1
  36. package/dist/features/layout/gridMeta.d.ts +1 -1
  37. package/dist/features/layout/screenMeta.d.ts +1 -1
  38. package/dist/features/layout/scrollViewMeta.d.ts +1 -1
  39. package/dist/features/layout/viewMeta.d.ts +1 -1
  40. package/dist/features/list/flatListMeta.d.ts +1 -1
  41. package/dist/features/list/sectionListMeta.d.ts +1 -1
  42. package/dist/features/reader/meta.d.ts +2 -2
  43. package/dist/features/registry/bindableComponentMeta.d.ts +42 -3
  44. package/dist/features/registry/bindableComponentMeta.d.ts.map +1 -1
  45. package/dist/features/registry/bindableComponentMeta.js +27 -10
  46. package/dist/features/registry/bindableComponentMeta.js.map +1 -1
  47. package/dist/features/scanner/meta.d.ts +2 -2
  48. package/dist/features/section/screenSectionMeta.d.ts +1 -1
  49. package/dist/features/surface/surfaceMeta.d.ts +1 -1
  50. package/dist/features/tabs/tabPanelMeta.d.ts +1 -1
  51. package/dist/features/timeline/meta.d.ts +79 -3
  52. package/dist/features/timeline/meta.d.ts.map +1 -1
  53. package/dist/features/timeline/meta.js +50 -3
  54. package/dist/features/timeline/meta.js.map +1 -1
  55. package/dist/features/timeline/public.d.ts +1 -1
  56. package/dist/features/timeline/public.d.ts.map +1 -1
  57. package/dist/features/timeline/public.js.map +1 -1
  58. package/dist/readerFree.d.ts +2 -2
  59. package/dist/readerFree.d.ts.map +1 -1
  60. package/dist/readerFree.js.map +1 -1
  61. package/dist/types/data-table.d.ts +37 -0
  62. package/dist/types/data-table.d.ts.map +1 -1
  63. package/dist/types/data-table.js.map +1 -1
  64. package/dist/types/timeline.d.ts +16 -0
  65. package/dist/types/timeline.d.ts.map +1 -1
  66. package/dist/types/timeline.js.map +1 -1
  67. package/package.json +51 -2
  68. package/src/constants/authoring.ts +2 -0
  69. package/src/features/data-table/adapters/inbound/DataTable.test.tsx +127 -6
  70. package/src/features/data-table/adapters/inbound/DataTable.tsx +149 -24
  71. package/src/features/data-table/dataTableMeta.test.ts +23 -0
  72. package/src/features/data-table/dataTableMeta.ts +42 -0
  73. package/src/features/data-table/public.ts +4 -0
  74. package/src/features/graph-view/adapters/inbound/web-artifact/createGraphController.ts +9 -2
  75. package/src/features/graph-view/adapters/inbound/web-artifact/createGraphRuntime.test.ts +108 -1
  76. package/src/features/graph-view/adapters/inbound/web-artifact/createGraphRuntime.ts +11 -3
  77. package/src/features/graph-view/adapters/inbound/web-artifact/placeAddedGraphNodes.test.ts +33 -0
  78. package/src/features/graph-view/adapters/inbound/web-artifact/placeAddedGraphNodes.ts +19 -5
  79. package/src/features/registry/bindableComponentMeta.ts +27 -10
  80. package/src/features/registry/componentMeta.test.ts +45 -0
  81. package/src/features/timeline/manifest.test.tsx +115 -0
  82. package/src/features/timeline/meta.ts +50 -3
  83. package/src/features/timeline/public.ts +6 -1
  84. package/src/readerFree.ts +10 -1
  85. package/src/types/data-table.ts +45 -0
  86. package/src/types/timeline.ts +18 -0
  87. package/web-dist/components/data-table/DataTable.d.ts +1 -1
  88. package/web-dist/components/data-table/DataTable.dependency-3.d.ts +1 -0
  89. package/web-dist/components/data-table/DataTable.js +128 -17
  90. package/web-dist/components/data-table/DataTable.types-0.d.ts +42 -0
  91. package/web-dist/components/data-table/index.d.ts +1 -1
  92. package/web-dist/components/graph-view/GraphView.js +21 -11
  93. package/web-dist/components/timeline/Timeline.d.ts +1 -1
  94. package/web-dist/components/timeline/Timeline.types-0.d.ts +19 -0
  95. package/web-dist/components/timeline/index.d.ts +1 -1
  96. package/web-dist/manifest.json +1 -0
@@ -1,3 +1,4 @@
1
+ import type { MediaAssetReference } from '@ankhorage/contracts';
1
2
  import type { ButtonIconSpec } from '@ankhorage/surface';
2
3
  import type React from 'react';
3
4
 
@@ -5,6 +6,23 @@ import type { ZoraBaseProps } from './base';
5
6
  import type { ImageProps } from './image';
6
7
  import type { ZoraColor } from './theme';
7
8
 
9
+ /** Portable Timeline item shape accepted by an AppManifest component node. */
10
+ export interface TimelineManifestItem {
11
+ readonly id: string;
12
+ readonly title: string;
13
+ readonly description?: string;
14
+ readonly meta?: string;
15
+ readonly status?: ZoraColor;
16
+ readonly marker?: MediaAssetReference;
17
+ readonly markerAlt?: string;
18
+ }
19
+
20
+ /** Portable Timeline props accepted by an AppManifest component node. */
21
+ export interface TimelineManifestProps {
22
+ readonly items: readonly TimelineManifestItem[];
23
+ readonly compact?: boolean;
24
+ }
25
+
8
26
  export interface TimelineItem {
9
27
  id: string;
10
28
  title: React.ReactNode;
@@ -6,4 +6,4 @@ import type { DataTableProps } from './DataTable.types-0';
6
6
  * Displays structured tabular data with responsive columns and optional controlled row selection.
7
7
  */
8
8
  export declare const DataTable: <TRow extends object>(props: DataTableProps<TRow>) => React.ReactElement | null;
9
- export type { DataTableCellContext, DataTableColumn, DataTableColumnAlign, DataTableDensity, DataTableProps, DataTableRowAction, DataTableSortDirection, DataTableSortState } from './DataTable.types-0';
9
+ export type { DataTableCellContext, DataTableCellSpec, DataTableColumn, DataTableColumnAlign, DataTableDensity, DataTableProps, DataTableRowAction, DataTableRowActivateEvent, DataTableRowField, DataTableSelectionChangeEvent, DataTableSortDirection, DataTableSortState } from './DataTable.types-0';
@@ -0,0 +1 @@
1
+ export type TextVariant = 'body' | 'lead' | 'bodySmall' | 'caption' | 'label' | 'eyebrow' | 'code';
@@ -29,7 +29,9 @@ import {
29
29
  import"../../chunks/Accordion-ms1y70gq.js";
30
30
  import"../../chunks/Accordion-9hcbf56f.js";
31
31
  import"../../chunks/Accordion-260pyaxy.js";
32
- import"../../chunks/Accordion-kcca65d8.js";
32
+ import {
33
+ Image2
34
+ } from "../../chunks/Accordion-kcca65d8.js";
33
35
  import {
34
36
  EmptyState2
35
37
  } from "../../chunks/Accordion-tnt1txfq.js";
@@ -74,6 +76,7 @@ function Show({ when, children, fallback = null }) {
74
76
 
75
77
  // src/features/data-table/adapters/inbound/DataTable.tsx
76
78
  var import_react_native = __toESM(require_cjs(), 1);
79
+ import React from "react";
77
80
 
78
81
  // src/features/data-table/utils/resolveDataTableRowKey.ts
79
82
  function resolveDataTableRowKey(row, index, rowKey, rowId) {
@@ -146,6 +149,74 @@ function renderDefaultCell(value) {
146
149
  }
147
150
  return "—";
148
151
  }
152
+ function resolveCellField(row, field) {
153
+ return Object.getOwnPropertyDescriptor(row, field)?.value;
154
+ }
155
+ function resolveCellString(value) {
156
+ return typeof value === "string" || typeof value === "number" ? String(value) : undefined;
157
+ }
158
+ function resolveExternalWebsiteUrl(url) {
159
+ try {
160
+ const parsedUrl = new URL(url);
161
+ return parsedUrl.protocol === "http:" || parsedUrl.protocol === "https:" ? url : undefined;
162
+ } catch {
163
+ return;
164
+ }
165
+ }
166
+ function openExternalUrl(url) {
167
+ const externalUrl = resolveExternalWebsiteUrl(url);
168
+ if (externalUrl) {
169
+ import_react_native.Linking.openURL(externalUrl);
170
+ }
171
+ }
172
+ function renderPortableCell(cell, row) {
173
+ switch (cell.kind) {
174
+ case "image": {
175
+ const source = resolveCellString(resolveCellField(row, cell.source));
176
+ const alt = resolveCellString(resolveCellField(row, cell.alt ?? cell.source));
177
+ return /* @__PURE__ */ jsx2(Image2, {
178
+ alt,
179
+ height: 32,
180
+ radius: "s",
181
+ source,
182
+ width: 32
183
+ });
184
+ }
185
+ case "text":
186
+ return /* @__PURE__ */ jsx2(Text3, {
187
+ variant: cell.variant ?? "bodySmall",
188
+ weight: cell.weight,
189
+ children: renderDefaultCell(resolveCellField(row, cell.value))
190
+ });
191
+ case "link": {
192
+ const href = resolveCellString(resolveCellField(row, cell.href));
193
+ const label = resolveCellString(resolveCellField(row, cell.label ?? cell.href)) ?? href;
194
+ const externalUrl = href ? resolveExternalWebsiteUrl(href) : undefined;
195
+ return externalUrl ? /* @__PURE__ */ jsx2(import_react_native.Pressable, {
196
+ accessibilityRole: "link",
197
+ onPress: () => openExternalUrl(externalUrl),
198
+ children: /* @__PURE__ */ jsx2(Text3, {
199
+ color: "primary",
200
+ variant: cell.variant ?? "bodySmall",
201
+ weight: "medium",
202
+ children: label
203
+ })
204
+ }) : /* @__PURE__ */ jsx2(Text3, {
205
+ variant: "bodySmall",
206
+ children: "—"
207
+ });
208
+ }
209
+ case "stack":
210
+ return /* @__PURE__ */ jsx2(View2, {
211
+ align: cell.align,
212
+ direction: cell.direction,
213
+ gap: cell.gap,
214
+ children: cell.children.map((child, index) => /* @__PURE__ */ jsx2(React.Fragment, {
215
+ children: renderPortableCell(child, row)
216
+ }, `cell-${index}`))
217
+ });
218
+ }
219
+ }
149
220
  function createCellContext(column, row, rowIndex) {
150
221
  return {
151
222
  column,
@@ -156,12 +227,17 @@ function createCellContext(column, row, rowIndex) {
156
227
  }
157
228
  function renderCell(column, row, rowIndex) {
158
229
  const context = createCellContext(column, row, rowIndex);
159
- return column.renderCell ? column.renderCell(context) : renderDefaultCell(context.value);
230
+ if (column.renderCell)
231
+ return column.renderCell(context);
232
+ if (column.cell)
233
+ return renderPortableCell(column.cell, row);
234
+ return renderDefaultCell(context.value);
160
235
  }
161
236
  function renderTableCell(column, row, rowIndex) {
162
- if (column.renderCell) {
237
+ if (column.renderCell)
163
238
  return column.renderCell(createCellContext(column, row, rowIndex));
164
- }
239
+ if (column.cell)
240
+ return renderPortableCell(column.cell, row);
165
241
  return /* @__PURE__ */ jsx2(Text3, {
166
242
  align: resolveTextAlign(column.align),
167
243
  variant: "bodySmall",
@@ -178,6 +254,10 @@ function resolveNextVisibleSelection(selectedRowIds, visibleRowIds, selected) {
178
254
  const visibleRowIdSet = new Set(visibleRowIds);
179
255
  return selected ? [...new Set([...selectedRowIds, ...visibleRowIds])] : selectedRowIds.filter((selectedRowId) => !visibleRowIdSet.has(selectedRowId));
180
256
  }
257
+ function emitSelectionChange(selectedRowIds, onSelectedRowIdsChange, onSelectionChange) {
258
+ onSelectedRowIdsChange?.(selectedRowIds);
259
+ onSelectionChange?.({ selectedRowIds });
260
+ }
181
261
  function mapRowActions(row, actions) {
182
262
  return actions.map((action) => ({
183
263
  description: action.description,
@@ -304,6 +384,8 @@ function DataTableDesktop({
304
384
  rowKey,
305
385
  selectedRowIds,
306
386
  onSelectedRowIdsChange,
387
+ onSelectionChange,
388
+ onRowActivate,
307
389
  sort,
308
390
  onSortChange,
309
391
  density,
@@ -315,7 +397,7 @@ function DataTableDesktop({
315
397
  const controlledSelectedRowIds = selectedRowIds ?? [];
316
398
  const selectedRowIdSet = new Set(controlledSelectedRowIds);
317
399
  const selectionEnabled = selectedRowIds !== undefined;
318
- const selectionDisabled = interactionPolicy === "passive" || onSelectedRowIdsChange === undefined;
400
+ const selectionDisabled = interactionPolicy === "passive" || onSelectedRowIdsChange === undefined && onSelectionChange === undefined;
319
401
  const hasRowActions = rows.some((row, rowIndex) => (rowActions?.(row, rowIndex).length ?? 0) > 0);
320
402
  const selection = selectionEnabled ? {
321
403
  allVisibleSelected: rowIds.every((currentRowId) => selectedRowIdSet.has(currentRowId)),
@@ -323,7 +405,7 @@ function DataTableDesktop({
323
405
  onAllVisibleSelectedChange: (selected) => {
324
406
  if (selectionDisabled)
325
407
  return;
326
- onSelectedRowIdsChange(resolveNextVisibleSelection(controlledSelectedRowIds, rowIds, selected));
408
+ emitSelectionChange(resolveNextVisibleSelection(controlledSelectedRowIds, rowIds, selected), onSelectedRowIdsChange, onSelectionChange);
327
409
  }
328
410
  } : undefined;
329
411
  return /* @__PURE__ */ jsx2(import_react_native.ScrollView, {
@@ -370,16 +452,28 @@ function DataTableDesktop({
370
452
  onCheckedChange: (nextSelected) => {
371
453
  if (selectionDisabled)
372
454
  return;
373
- onSelectedRowIdsChange(resolveNextSelectedRowIds(controlledSelectedRowIds, currentRowId, nextSelected));
455
+ emitSelectionChange(resolveNextSelectedRowIds(controlledSelectedRowIds, currentRowId, nextSelected), onSelectedRowIdsChange, onSelectionChange);
374
456
  }
375
457
  })
376
458
  }) : null,
377
- columns.map((column) => /* @__PURE__ */ jsx2(View2, {
378
- px: padding.px,
379
- py: padding.py,
380
- style: resolveCellStyle(column),
381
- children: renderTableCell(column, row, rowIndex)
382
- }, column.id)),
459
+ /* @__PURE__ */ jsx2(View2, {
460
+ direction: "row",
461
+ style: { flexGrow: 1, flexShrink: 1 },
462
+ children: columns.map((column) => /* @__PURE__ */ jsx2(View2, {
463
+ px: padding.px,
464
+ py: padding.py,
465
+ style: resolveCellStyle(column),
466
+ children: renderTableCell(column, row, rowIndex)
467
+ }, column.id))
468
+ }),
469
+ onRowActivate ? /* @__PURE__ */ jsx2(IconButton2, {
470
+ icon: { name: "arrow-forward" },
471
+ interactionPolicy,
472
+ label: `Activate row ${currentRowId}`,
473
+ onPress: () => onRowActivate({ rowId: currentRowId }),
474
+ size: "s",
475
+ variant: "ghost"
476
+ }) : null,
383
477
  hasRowActions ? /* @__PURE__ */ jsx2(View2, {
384
478
  px: padding.px,
385
479
  py: padding.py,
@@ -404,6 +498,8 @@ function DataTableMobile({
404
498
  rowKey,
405
499
  selectedRowIds,
406
500
  onSelectedRowIdsChange,
501
+ onSelectionChange,
502
+ onRowActivate,
407
503
  testID,
408
504
  interactionPolicy
409
505
  }) {
@@ -411,15 +507,30 @@ function DataTableMobile({
411
507
  const controlledSelectedRowIds = selectedRowIds ?? [];
412
508
  const selectedRowIdSet = new Set(controlledSelectedRowIds);
413
509
  const selectionEnabled = selectedRowIds !== undefined;
414
- const selectionDisabled = interactionPolicy === "passive" || onSelectedRowIdsChange === undefined;
510
+ const selectionDisabled = interactionPolicy === "passive" || onSelectedRowIdsChange === undefined && onSelectionChange === undefined;
415
511
  return /* @__PURE__ */ jsx2(View2, {
416
512
  gap: "s",
417
513
  children: rows.map((row, rowIndex) => {
418
514
  const currentRowId = resolveDataTableRowKey(row, rowIndex, rowKey, rowId);
419
515
  const title = primaryColumn ? renderCell(primaryColumn, row, rowIndex) : `Row ${rowIndex + 1}`;
420
516
  const actions = renderRowActions({ row, rowActions, rowIndex, testID, interactionPolicy });
517
+ const rowActivation = onRowActivate ? /* @__PURE__ */ jsx2(IconButton2, {
518
+ icon: { name: "arrow-forward" },
519
+ interactionPolicy,
520
+ label: `Activate row ${currentRowId}`,
521
+ onPress: () => onRowActivate({ rowId: currentRowId }),
522
+ size: "s",
523
+ variant: "ghost"
524
+ }) : null;
421
525
  return /* @__PURE__ */ jsx2(Card2, {
422
- actions,
526
+ actions: rowActivation || actions ? /* @__PURE__ */ jsxs(View2, {
527
+ direction: "row",
528
+ gap: "xs",
529
+ children: [
530
+ rowActivation,
531
+ actions
532
+ ]
533
+ }) : null,
423
534
  compact: true,
424
535
  interactionPolicy,
425
536
  testID: testID ? `${testID}-card-${rowIndex}` : undefined,
@@ -435,7 +546,7 @@ function DataTableMobile({
435
546
  onCheckedChange: (nextSelected) => {
436
547
  if (selectionDisabled)
437
548
  return;
438
- onSelectedRowIdsChange(resolveNextSelectedRowIds(controlledSelectedRowIds, currentRowId, nextSelected));
549
+ emitSelectionChange(resolveNextSelectedRowIds(controlledSelectedRowIds, currentRowId, nextSelected), onSelectedRowIdsChange, onSelectionChange);
439
550
  }
440
551
  }) : null,
441
552
  detailColumns.map((column) => /* @__PURE__ */ jsxs(View2, {
@@ -447,7 +558,7 @@ function DataTableMobile({
447
558
  weight: "semiBold",
448
559
  children: column.header
449
560
  }),
450
- column.renderCell ? renderCell(column, row, rowIndex) : /* @__PURE__ */ jsx2(Text3, {
561
+ column.renderCell || column.cell ? renderCell(column, row, rowIndex) : /* @__PURE__ */ jsx2(Text3, {
451
562
  variant: "bodySmall",
452
563
  children: renderDefaultCell(resolveAccessorValue(row, column))
453
564
  })
@@ -6,12 +6,40 @@ import type { ZoraBaseProps } from './DataTable.dependency-0';
6
6
 
7
7
  import type { PopoverMenuActionIntent } from './DataTable.dependency-2';
8
8
 
9
+ import type { TextVariant } from './DataTable.dependency-3';
10
+
9
11
  export type DataTableColumnAlign = 'start' | 'center' | 'end';
10
12
 
11
13
  export type DataTableDensity = 'comfortable' | 'compact';
12
14
 
13
15
  export type DataTableSortDirection = 'asc' | 'desc';
14
16
 
17
+ /** A portable reference to a string-valued row field used by a manifest cell. */
18
+ export type DataTableRowField<TRow extends object> = Extract<keyof TRow, string>;
19
+
20
+ /** Serializable rich presentations for a DataTable column. */
21
+ export type DataTableCellSpec<TRow extends object> = {
22
+ readonly kind: 'image';
23
+ readonly source: DataTableRowField<TRow>;
24
+ readonly alt?: DataTableRowField<TRow>;
25
+ } | {
26
+ readonly kind: 'text';
27
+ readonly value: DataTableRowField<TRow>;
28
+ readonly weight?: 'regular' | 'medium' | 'semiBold' | 'bold';
29
+ readonly variant?: TextVariant;
30
+ } | {
31
+ readonly kind: 'link';
32
+ readonly href: DataTableRowField<TRow>;
33
+ readonly label?: DataTableRowField<TRow>;
34
+ readonly variant?: TextVariant;
35
+ } | {
36
+ readonly kind: 'stack';
37
+ readonly direction: 'row' | 'column';
38
+ readonly align?: 'flex-start' | 'center' | 'flex-end' | 'stretch' | 'baseline';
39
+ readonly gap?: 'xxs' | 'xs' | 's' | 'm' | 'l';
40
+ readonly children: readonly DataTableCellSpec<TRow>[];
41
+ };
42
+
15
43
  export interface DataTableSortState {
16
44
  columnId: string;
17
45
  direction: DataTableSortDirection;
@@ -32,9 +60,19 @@ export interface DataTableColumn<TRow extends object> {
32
60
  width?: number;
33
61
  minWidth?: number;
34
62
  sortable?: boolean;
63
+ /** Portable manifest presentation. Takes precedence over the default accessor rendering. */
64
+ cell?: DataTableCellSpec<TRow>;
35
65
  renderCell?: (context: DataTableCellContext<TRow>) => React.ReactNode;
36
66
  }
37
67
 
68
+ export interface DataTableSelectionChangeEvent {
69
+ readonly selectedRowIds: readonly string[];
70
+ }
71
+
72
+ export interface DataTableRowActivateEvent {
73
+ readonly rowId: string;
74
+ }
75
+
38
76
  export interface DataTableRowAction<TRow extends object> {
39
77
  id: string;
40
78
  title: React.ReactNode;
@@ -54,6 +92,10 @@ export interface DataTableProps<TRow extends object> extends ZoraBaseProps {
54
92
  selectedRowIds?: readonly string[];
55
93
  /** Receives the next controlled selection after a row or visible-row toggle. */
56
94
  onSelectedRowIdsChange?: (selectedRowIds: readonly string[]) => void;
95
+ /** Emits the serializable controlled selection payload used by AppManifest events. */
96
+ onSelectionChange?: (event: DataTableSelectionChangeEvent) => void;
97
+ /** Emits a row activation independently of checkbox selection. */
98
+ onRowActivate?: (event: DataTableRowActivateEvent) => void;
57
99
  rowActions?: (row: TRow, index: number) => readonly DataTableRowAction<TRow>[];
58
100
  sort?: DataTableSortState;
59
101
  onSortChange?: (sort: DataTableSortState) => void;
@@ -1,2 +1,2 @@
1
1
  export { DataTable } from './DataTable';
2
- export type { DataTableCellContext, DataTableColumn, DataTableColumnAlign, DataTableDensity, DataTableProps, DataTableRowAction, DataTableSortDirection, DataTableSortState } from './DataTable';
2
+ export type { DataTableCellContext, DataTableCellSpec, DataTableColumn, DataTableColumnAlign, DataTableDensity, DataTableProps, DataTableRowAction, DataTableRowActivateEvent, DataTableRowField, DataTableSelectionChangeEvent, DataTableSortDirection, DataTableSortState } from './DataTable';
@@ -123304,11 +123304,12 @@ function measureRenderedNodes(cy, nodeIds) {
123304
123304
  const node = cy.getElementById(id);
123305
123305
  if (!node.isNode())
123306
123306
  return [];
123307
+ const bounds = node.isParent() ? node.renderedBoundingBox() : null;
123307
123308
  return [
123308
123309
  {
123309
123310
  id,
123310
- position: node.renderedPosition(),
123311
- size: { width: node.renderedOuterWidth(), height: node.renderedOuterHeight() }
123311
+ position: bounds === null ? node.renderedPosition() : { x: bounds.x1 + bounds.w / 2, y: bounds.y1 + bounds.h / 2 },
123312
+ size: bounds === null ? { width: node.renderedOuterWidth(), height: node.renderedOuterHeight() } : { width: bounds.w, height: bounds.h }
123312
123313
  }
123313
123314
  ];
123314
123315
  });
@@ -123499,20 +123500,27 @@ function placeAddedGraphNodes(cy, previousNodes, nodes) {
123499
123500
  const addedNodes = nodes.filter((node) => !previousNodeIds.has(node.id)).sort((left, right) => left.id.localeCompare(right.id));
123500
123501
  if (addedNodes.length === 0)
123501
123502
  return;
123503
+ const addedLeaves = addedNodes.map((node) => cy.getElementById(node.id)).filter((node) => !node.empty() && !node.isParent());
123504
+ if (addedLeaves.length === 0)
123505
+ return;
123502
123506
  const retainedNodes = cy.nodes().filter((node) => previousNodeIds.has(node.id()) && !node.isParent());
123503
123507
  const bounds = retainedNodes.boundingBox({ includeEdges: false, includeLabels: true });
123504
- const origin = retainedNodes.empty() ? { x: 0, y: 0 } : { x: bounds.x2 + GRID_GAP, y: bounds.y1 };
123505
- const columns = Math.ceil(Math.sqrt(addedNodes.length));
123506
- addedNodes.forEach((node, index) => {
123507
- const graphNode = cy.getElementById(node.id);
123508
- if (graphNode.empty() || graphNode.isParent())
123509
- return;
123508
+ const origin = retainedNodes.empty() ? getVisibleViewportCenter(cy) : { x: bounds.x2 + GRID_GAP, y: bounds.y1 };
123509
+ const columns = Math.ceil(Math.sqrt(addedLeaves.length));
123510
+ addedLeaves.forEach((graphNode, index) => {
123510
123511
  graphNode.position({
123511
123512
  x: origin.x + index % columns * GRID_GAP,
123512
123513
  y: origin.y + Math.floor(index / columns) * GRID_GAP
123513
123514
  });
123514
123515
  });
123515
123516
  }
123517
+ function getVisibleViewportCenter(cy) {
123518
+ const extent = cy.extent();
123519
+ return {
123520
+ x: (extent.x1 + extent.x2) / 2,
123521
+ y: (extent.y1 + extent.y2) / 2
123522
+ };
123523
+ }
123516
123524
 
123517
123525
  // src/features/graph-view/adapters/inbound/web-artifact/readGraphRenderedNodes.ts
123518
123526
  function readGraphRenderedNodes(cy, hoveredNodeIds) {
@@ -124066,6 +124074,7 @@ function createGraphRuntime(container, callbacksRef, readLatestPointerDown = ()
124066
124074
  minZoom: 0.05,
124067
124075
  maxZoom: 2,
124068
124076
  selectionType: "additive",
124077
+ styleEnabled: true,
124069
124078
  userPanningEnabled: true
124070
124079
  });
124071
124080
  const state = createRuntimeState(cy, container, callbacksRef, readLatestPointerDown);
@@ -124150,14 +124159,14 @@ function updateRuntime(state, input) {
124150
124159
  state.cy.batch(() => {
124151
124160
  if (previous?.nodes !== input.nodes || previous.edges !== input.edges) {
124152
124161
  syncGraphElements(state.cy, input.nodes, input.edges);
124153
- if (preservesTopology)
124154
- placeAddedGraphNodes(state.cy, previous?.nodes ?? [], input.nodes);
124155
124162
  }
124156
124163
  if (previous?.styleRules !== input.styleRules || previous?.richNodeRendering !== input.richNodeRendering) {
124157
124164
  state.loopSizer.reset();
124158
124165
  applyGraphStyles(state.cy, input.styleRules, input.richNodeRendering);
124159
124166
  }
124160
124167
  });
124168
+ if (preservesTopology)
124169
+ placeAddedGraphNodes(state.cy, previous?.nodes ?? [], input.nodes);
124161
124170
  sizeGraphNodesToLabels(state.cy, state.labelSizedNodeIds, input.sizeNodesToLabels === true && !input.richNodeRendering);
124162
124171
  applyKnownNodeSizes(state);
124163
124172
  state.loopSizer.update();
@@ -124193,7 +124202,8 @@ function getRetainedNodeIds(previous, input, preservesTopology) {
124193
124202
  if (!preservesTopology || previous === null)
124194
124203
  return null;
124195
124204
  const nextNodeIds = new Set(input.nodes.map((node) => node.id));
124196
- return new Set(previous.nodes.map((node) => node.id).filter((id) => nextNodeIds.has(id)));
124205
+ const nextParentIds = new Set(input.nodes.flatMap((node) => node.parentId === undefined ? [] : [node.parentId]));
124206
+ return new Set(previous.nodes.map((node) => node.id).filter((id) => nextNodeIds.has(id) && !nextParentIds.has(id)));
124197
124207
  }
124198
124208
  function startCurrentLayout(state, input) {
124199
124209
  if (!state.readyRef.current) {
@@ -8,4 +8,4 @@ import type { TimelineProps } from './Timeline.types-0';
8
8
 
9
9
  */
10
10
  export declare const Timeline: (props: TimelineProps) => React.ReactElement | null;
11
- export type { TimelineItem, TimelineProps } from './Timeline.types-0';
11
+ export type { TimelineItem, TimelineManifestItem, TimelineManifestProps, TimelineProps } from './Timeline.types-0';
@@ -1,3 +1,5 @@
1
+ import type { MediaAssetReference } from '@ankhorage/contracts';
2
+
1
3
  import type { ButtonIconSpec } from '@ankhorage/surface';
2
4
 
3
5
  import type React from 'react';
@@ -8,6 +10,23 @@ import type { ImageProps } from './Timeline.dependency-2';
8
10
 
9
11
  import type { ZoraColor } from './Timeline.dependency-4';
10
12
 
13
+ /** Portable Timeline item shape accepted by an AppManifest component node. */
14
+ export interface TimelineManifestItem {
15
+ readonly id: string;
16
+ readonly title: string;
17
+ readonly description?: string;
18
+ readonly meta?: string;
19
+ readonly status?: ZoraColor;
20
+ readonly marker?: MediaAssetReference;
21
+ readonly markerAlt?: string;
22
+ }
23
+
24
+ /** Portable Timeline props accepted by an AppManifest component node. */
25
+ export interface TimelineManifestProps {
26
+ readonly items: readonly TimelineManifestItem[];
27
+ readonly compact?: boolean;
28
+ }
29
+
11
30
  export interface TimelineItem {
12
31
  id: string;
13
32
  title: React.ReactNode;
@@ -1,2 +1,2 @@
1
1
  export { Timeline } from './Timeline';
2
- export type { TimelineItem, TimelineProps } from './Timeline';
2
+ export type { TimelineItem, TimelineManifestItem, TimelineManifestProps, TimelineProps } from './Timeline';
@@ -1290,6 +1290,7 @@
1290
1290
  "components/data-table/DataTable.dependency-0.d.ts",
1291
1291
  "components/data-table/DataTable.dependency-1.d.ts",
1292
1292
  "components/data-table/DataTable.dependency-2.d.ts",
1293
+ "components/data-table/DataTable.dependency-3.d.ts",
1293
1294
  "components/data-table/DataTable.types-0.d.ts",
1294
1295
  "components/data-table/index.js",
1295
1296
  "components/data-table/index.d.ts",