@simpleplatform/ui-kit 0.3.0 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +55 -38
- package/dist/contracts/index.d.ts +2 -2
- package/dist/contracts/index.d.ts.map +1 -1
- package/dist/contracts/index.js +1 -1
- package/dist/contracts/views.d.ts +13 -30
- package/dist/contracts/views.d.ts.map +1 -1
- package/dist/contracts/views.js +77 -220
- package/dist/elements/status-badge.d.ts.map +1 -1
- package/dist/elements/status-badge.js +11 -15
- package/dist/react/record-view.d.ts.map +1 -1
- package/dist/react/record-view.js +3 -7
- package/package.json +2 -2
- package/theme.css +11 -27
package/README.md
CHANGED
|
@@ -21,11 +21,12 @@ released with an explicit support policy.
|
|
|
21
21
|
pnpm add @simpleplatform/ui-kit @simpleplatform/sdk
|
|
22
22
|
```
|
|
23
23
|
|
|
24
|
-
Managed views require the SDK's private managed-view bridge
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
bridge.
|
|
28
|
-
|
|
24
|
+
Managed views require the SDK's private managed-view bridge and GraphQL
|
|
25
|
+
`RecordWhere` type. The peer and scaffold requirement is
|
|
26
|
+
`@simpleplatform/sdk@^4.1.0`; 4.0.0 is the first published release with the
|
|
27
|
+
bridge. SDK 3.2.0 was never released; SDK 3.1.0 lacks the bridge. Publish the
|
|
28
|
+
compatible SDK before the UI Kit; the UI Kit release check verifies the
|
|
29
|
+
published SDK artifact's bridge. For local review, use matching
|
|
29
30
|
SDK/UI Kit feature builds. React bridges support React 18.3 or 19. The `0.0.0`
|
|
30
31
|
peer exception supports linked workspace builds and does not prove registry
|
|
31
32
|
compatibility.
|
|
@@ -114,11 +115,11 @@ stylesheet does not bundle Tailwind or its base reset.
|
|
|
114
115
|
The fonts are bundled with the Space so they load inside its cross-origin
|
|
115
116
|
iframe. `StatusBadge` uses the shared platform tokens for its light and dark
|
|
116
117
|
colors and dimensions. Its neutral tone uses `--simple-color-surface-sunken`
|
|
117
|
-
for the background
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
`--simple-color-status-
|
|
121
|
-
|
|
118
|
+
for the background and `--simple-color-text-secondary` for the text without a border;
|
|
119
|
+
these tokens contain complete CSS color values, not bare HSL triplets. The other tones
|
|
120
|
+
use the single base `--simple-color-status-info`, `--simple-color-status-success`,
|
|
121
|
+
`--simple-color-status-warning`, and `--simple-color-status-danger` tokens with
|
|
122
|
+
background tints derived automatically via `color-mix` without borders.
|
|
122
123
|
A Space may override the `--simple-*` tokens in its own CSS after the imports,
|
|
123
124
|
including `--simple-font-family-sans` for the font stack. These tokens are shared
|
|
124
125
|
with other UI that uses the platform theme; they are not component-local
|
|
@@ -154,6 +155,9 @@ cross-framework contract.
|
|
|
154
155
|
|
|
155
156
|
`RecordForm` is the default choice for a Record Space that wants the complete
|
|
156
157
|
Simple record experience without rebuilding it.
|
|
158
|
+
These managed component examples assume a Vite Space with
|
|
159
|
+
`VITE_SIMPLE_HOST_ORIGIN` set to its exact trusted HTTP(S) host origin. The SDK
|
|
160
|
+
does not infer that origin from `document.referrer`.
|
|
157
161
|
|
|
158
162
|
Load the stylesheet as described in [Loading the stylesheet](#loading-the-stylesheet)
|
|
159
163
|
before using this example.
|
|
@@ -164,7 +168,8 @@ import { connect } from '@simpleplatform/sdk/space'
|
|
|
164
168
|
import { RecordForm } from '@simpleplatform/ui-kit/react'
|
|
165
169
|
import { useEffect, useState } from 'react'
|
|
166
170
|
|
|
167
|
-
const
|
|
171
|
+
const targetOrigin = import.meta.env.VITE_SIMPLE_HOST_ORIGIN
|
|
172
|
+
const client = connect({ targetOrigin })
|
|
168
173
|
|
|
169
174
|
export function App() {
|
|
170
175
|
const [record, setRecord] = useState<RecordHandle | null>(null)
|
|
@@ -263,7 +268,8 @@ import { connect } from '@simpleplatform/sdk/space'
|
|
|
263
268
|
import { RecordActivity } from '@simpleplatform/ui-kit/react'
|
|
264
269
|
import { useEffect, useState } from 'react'
|
|
265
270
|
|
|
266
|
-
const
|
|
271
|
+
const targetOrigin = import.meta.env.VITE_SIMPLE_HOST_ORIGIN
|
|
272
|
+
const client = connect({ targetOrigin })
|
|
267
273
|
|
|
268
274
|
export function ActivityView() {
|
|
269
275
|
const [record, setRecord] = useState<RecordHandle | null>(null)
|
|
@@ -369,17 +375,20 @@ node scripts/sync-record-view-contract.mjs ../simple
|
|
|
369
375
|
node scripts/sync-record-view-contract.mjs ../simple --check
|
|
370
376
|
```
|
|
371
377
|
|
|
372
|
-
Commit both copies together. The corpus covers
|
|
373
|
-
and current Show more with numeric summaries.
|
|
378
|
+
Commit both copies together. The corpus covers Board lane paging and numeric summaries.
|
|
374
379
|
|
|
375
380
|
Public TypeScript names omit a version suffix. The saved `views` preset-set
|
|
376
|
-
envelope
|
|
381
|
+
envelope and tile layouts use `version: 1`. Preset and controlled filters require
|
|
382
|
+
the native `RecordWhere` object accepted by GraphQL; shorthand and predicate-tree
|
|
383
|
+
filters are rejected without conversion. The UI Kit checks shape, and the
|
|
384
|
+
platform validates fields and operators. General query and URL shorthand
|
|
385
|
+
normalization remains separate from the saved preset contract.
|
|
377
386
|
|
|
378
387
|
```tsx
|
|
379
388
|
import type { SimpleClient } from '@simpleplatform/sdk/space'
|
|
380
389
|
import type {
|
|
381
|
-
FilterExpression,
|
|
382
390
|
ListPreset,
|
|
391
|
+
RecordWhere,
|
|
383
392
|
TableRecordSource,
|
|
384
393
|
ViewItemReference,
|
|
385
394
|
} from '@simpleplatform/ui-kit/contracts'
|
|
@@ -395,8 +404,8 @@ const source: TableRecordSource = {
|
|
|
395
404
|
const preset: ListPreset = {
|
|
396
405
|
config: {
|
|
397
406
|
tile: {
|
|
398
|
-
presentation: '
|
|
399
|
-
|
|
407
|
+
presentation: 'standard',
|
|
408
|
+
subtitleFieldNames: ['status'],
|
|
400
409
|
titleFieldName: 'title',
|
|
401
410
|
version: 1,
|
|
402
411
|
},
|
|
@@ -410,7 +419,7 @@ export function TicketList({ client, openTicket }: {
|
|
|
410
419
|
client: SimpleClient
|
|
411
420
|
openTicket: (reference: ViewItemReference) => void
|
|
412
421
|
}) {
|
|
413
|
-
const [filter, setFilter] = useState<
|
|
422
|
+
const [filter, setFilter] = useState<RecordWhere | undefined>(preset.filter)
|
|
414
423
|
|
|
415
424
|
return (
|
|
416
425
|
<ListView
|
|
@@ -435,10 +444,12 @@ existing record hooks. Presets are versioned and discriminated as `list`, `table
|
|
|
435
444
|
stay with the Space. Controlled views pass both `filter` and
|
|
436
445
|
`onFilterChange`; otherwise the preset's filter initializes view state.
|
|
437
446
|
|
|
438
|
-
The view's built-in
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
447
|
+
The view's built-in controls read and write the native SimpleDB `RecordWhere`
|
|
448
|
+
shape used by preset JSON, URL state, dashboards, and GraphQL variables. Flat
|
|
449
|
+
filters use the quick field picker; grouped, negated, repeated-field, or
|
|
450
|
+
multi-operator filters open the advanced Rule Outline directly. The Space may
|
|
451
|
+
control that same state with `filter` and `onFilterChange`; editor components
|
|
452
|
+
remain platform-owned. Preset icons are derived from `kind`. Tile visuals use provider-qualified IDs from
|
|
442
453
|
`RECORD_VIEW_ICON_IDS`, such as `lucide:star`.
|
|
443
454
|
QuickFilterBar is excluded from the first phase.
|
|
444
455
|
`DataGrid` mounts the existing platform TanStack GenericTable, including its
|
|
@@ -457,10 +468,13 @@ labeled values. Ordinary List/Inbox email tiles keep their sender/date,
|
|
|
457
468
|
subject, and preview layout.
|
|
458
469
|
|
|
459
470
|
Simple and advanced filters reject numeric input that JavaScript cannot
|
|
460
|
-
represent without changing its value
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
471
|
+
represent without changing its value, including unsafe integers in numeric
|
|
472
|
+
`_in` and `_nin` lists; invalid text stays visible for correction. JSON key
|
|
473
|
+
operands remain strings, including keys such as `"123"` or `"true"`.
|
|
474
|
+
Nested AND/OR groups, `_not`, and multi-value operands retain their meaning when
|
|
475
|
+
opening the advanced editor or adding a simple field filter. The editor keeps
|
|
476
|
+
valid native clauses it cannot edit as read-only rules; users can remove a rule
|
|
477
|
+
or group explicitly. It does not silently drop clauses.
|
|
464
478
|
|
|
465
479
|
`Board` may call `onMoveRequest`; it does not persist a move by itself.
|
|
466
480
|
Use `client.records.open()`, check `update()` and `submit()` results, and reject
|
|
@@ -490,7 +504,7 @@ const boardPreset: BoardPreset = {
|
|
|
490
504
|
{ fieldName: 'amount', operation: 'sum' },
|
|
491
505
|
{ fieldName: 'amount', operation: 'average' },
|
|
492
506
|
],
|
|
493
|
-
tile: { presentation: '
|
|
507
|
+
tile: { presentation: 'standard', titleFieldName: 'name', version: 1 },
|
|
494
508
|
},
|
|
495
509
|
id: 'opportunities',
|
|
496
510
|
kind: 'board',
|
|
@@ -509,13 +523,14 @@ was removed, the platform uses `defaultPresetId`. A Space receives an explicit
|
|
|
509
523
|
Space tiles use the same `RecordTileLayout` in List/Table/Board `config.tile`.
|
|
510
524
|
The platform Inbox uses `config.listTile`. Its `detail` defaults to `fields`,
|
|
511
525
|
which requires `detailFieldNames`; `detail: 'record'` renders the platform
|
|
512
|
-
RecordPage and does not accept `detailFieldNames`. The
|
|
513
|
-
`
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
526
|
+
RecordPage and does not accept `detailFieldNames`. The three tile presentations
|
|
527
|
+
are `standard`, `media`, and `message`. Use `standard` for ordinary records,
|
|
528
|
+
people, settings, and enterprise items; `media` reserves an image area;
|
|
529
|
+
`message` arranges sender, received time, subject, and preview. Message tiles use
|
|
530
|
+
`titleFieldName` for the subject, `eyebrowFieldName` for the sender,
|
|
531
|
+
`subtitleFieldNames` for the preview, and `trailingFieldName` for the received
|
|
532
|
+
date/time. List/Inbox message tiles omit generic badges, detail fields, and
|
|
533
|
+
visuals; DataGrid retains selected fields as labeled values. Bind
|
|
519
534
|
title/subtitle/eyebrow/trailing, badge/detail fields, a safe catalog icon, an
|
|
520
535
|
enum icon map, or an authorized document image. Values stay inline and safe inside the parent open action;
|
|
521
536
|
references request only the target ID/display field and fall back to the ID
|
|
@@ -540,9 +555,11 @@ Contract bounds are 20 presets, 80-character IDs, 120-character titles, 200-char
|
|
|
540
555
|
unpadded field names, 40 fields per column/detail/badge array, 5 sort fields,
|
|
541
556
|
80–800px column widths, and 20 total Board lanes with batches of at most 50
|
|
542
557
|
records per lane. Enum icon maps allow 100 unpadded nonempty values of at most 200
|
|
543
|
-
characters and only exported catalog icons.
|
|
544
|
-
|
|
545
|
-
|
|
558
|
+
characters and only exported catalog icons. The SDK uses the `RecordWhere` type
|
|
559
|
+
from `@simpleplatform/sdk/graphql` and passes filter objects to the host unchanged.
|
|
560
|
+
The platform owns runtime structural, field, and operator validation before a
|
|
561
|
+
query runs; field/operator and operand metadata is generated from the SimpleDB
|
|
562
|
+
filter dialect. Container width selects the responsive DataGrid presentation; it is
|
|
546
563
|
not configurable in the preset.
|
|
547
564
|
|
|
548
565
|
The `dev.simple.ui_fixtures` Space API Demo includes a database-backed tile
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export { SIMPLE_STATUS_BADGE_TONES, type SimpleStatusBadgeTone, } from './status-badge.js';
|
|
2
|
-
export {
|
|
3
|
-
export type { BoardMoveRequestV1 as BoardMoveRequest, BoardPresetV1 as BoardPreset, BoardProps, ControlledFilterPropsV1 as ControlledFilterProps, DataGridPresetV1 as DataGridPreset, DataGridProps,
|
|
2
|
+
export { isBoardPresetV1 as isBoardPreset, isControlledFilterPropsV1 as isControlledFilterProps, isDataGridPresetV1 as isDataGridPreset, isInboxPresetV1 as isInboxPreset, isListPresetV1 as isListPreset, isRecordReferenceV1 as isRecordReference, isRecordSortV1 as isRecordSort, isRecordSourceV1 as isRecordSource, isRecordTileLayoutV1 as isRecordTileLayout, isRecordViewPresetV1 as isRecordViewPreset, isViewItemReferenceV1 as isViewItemReference, isViewPresetSetV1 as isViewPresetSet, RECORD_TILE_PRESENTATIONS_V1 as RECORD_TILE_PRESENTATIONS, RECORD_VIEW_ICON_IDS_V1 as RECORD_VIEW_ICON_IDS, RECORD_VIEW_KINDS_V1 as RECORD_VIEW_KINDS, RecordViewContractError, validateBoardPresetV1 as validateBoardPreset, validateControlledFilterPropsV1 as validateControlledFilterProps, validateDataGridPresetV1 as validateDataGridPreset, validateInboxPresetV1 as validateInboxPreset, validateListPresetV1 as validateListPreset, validateRecordReferenceV1 as validateRecordReference, validateRecordSortV1 as validateRecordSort, validateRecordSourceV1 as validateRecordSource, validateRecordTileLayoutV1 as validateRecordTileLayout, validateRecordViewPresetV1 as validateRecordViewPreset, validateTableRecordSourceV1 as validateTableRecordSource, validateViewItemReferenceV1 as validateViewItemReference, validateViewPresetSetV1 as validateViewPresetSet, } from './views.js';
|
|
3
|
+
export type { BoardMoveRequestV1 as BoardMoveRequest, BoardPresetV1 as BoardPreset, BoardProps, ControlledFilterPropsV1 as ControlledFilterProps, DataGridPresetV1 as DataGridPreset, DataGridProps, InboxPresetV1 as InboxPreset, ListPresetV1 as ListPreset, ListViewProps, RecordReferenceV1 as RecordReference, RecordSortV1 as RecordSort, RecordSourceV1 as RecordSource, RecordTileLayoutV1 as RecordTileLayout, RecordTilePresentationV1 as RecordTilePresentation, RecordTileVisualV1 as RecordTileVisual, RecordViewIconIdV1 as RecordViewIconId, RecordViewKindV1 as RecordViewKind, RecordViewPresetV1 as RecordViewPreset, RecordViewPresetBaseV1 as RecordViewPresetBase, RecordViewPropsV1 as RecordViewProps, RecordViewSummaryV1 as RecordViewSummary, RecordWhere, TableRecordSourceV1 as TableRecordSource, ViewItemReferenceV1 as ViewItemReference, ViewPresetSetV1 as ViewPresetSet, } from './views.js';
|
|
4
4
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/contracts/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,yBAAyB,EACzB,KAAK,qBAAqB,GAC3B,MAAM,mBAAmB,CAAA;AAE1B,OAAO,EACL,
|
|
1
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AY,IAAI,UAAU,EAC1B,cAAc,IAAI,YAAY,EAC9B,kBAAkB,IAAI,gBAAgB,EACtC,wBAAwB,IAAI,sBAAsB,EAClD,kBAAkB,IAAI,gBAAgB,EACtC,kBAAkB,IAAI,gBAAgB,EACtC,gBAAgB,IAAI,cAAc,EAClC,kBAAkB,IAAI,gBAAgB,EACtC,sBAAsB,IAAI,oBAAoB,EAC9C,iBAAiB,IAAI,eAAe,EACpC,mBAAmB,IAAI,iBAAiB,EACxC,WAAW,EACX,mBAAmB,IAAI,iBAAiB,EACxC,mBAAmB,IAAI,iBAAiB,EACxC,eAAe,IAAI,aAAa,GACjC,MAAM,YAAY,CAAA"}
|
package/dist/contracts/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export { SIMPLE_STATUS_BADGE_TONES, } from './status-badge.js';
|
|
2
|
-
export {
|
|
2
|
+
export { isBoardPresetV1 as isBoardPreset, isControlledFilterPropsV1 as isControlledFilterProps, isDataGridPresetV1 as isDataGridPreset, isInboxPresetV1 as isInboxPreset, isListPresetV1 as isListPreset, isRecordReferenceV1 as isRecordReference, isRecordSortV1 as isRecordSort, isRecordSourceV1 as isRecordSource, isRecordTileLayoutV1 as isRecordTileLayout, isRecordViewPresetV1 as isRecordViewPreset, isViewItemReferenceV1 as isViewItemReference, isViewPresetSetV1 as isViewPresetSet, RECORD_TILE_PRESENTATIONS_V1 as RECORD_TILE_PRESENTATIONS, RECORD_VIEW_ICON_IDS_V1 as RECORD_VIEW_ICON_IDS, RECORD_VIEW_KINDS_V1 as RECORD_VIEW_KINDS, RecordViewContractError, validateBoardPresetV1 as validateBoardPreset, validateControlledFilterPropsV1 as validateControlledFilterProps, validateDataGridPresetV1 as validateDataGridPreset, validateInboxPresetV1 as validateInboxPreset, validateListPresetV1 as validateListPreset, validateRecordReferenceV1 as validateRecordReference, validateRecordSortV1 as validateRecordSort, validateRecordSourceV1 as validateRecordSource, validateRecordTileLayoutV1 as validateRecordTileLayout, validateRecordViewPresetV1 as validateRecordViewPreset, validateTableRecordSourceV1 as validateTableRecordSource, validateViewItemReferenceV1 as validateViewItemReference, validateViewPresetSetV1 as validateViewPresetSet, } from './views.js';
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
+
import type { RecordWhere } from '@simpleplatform/sdk/graphql';
|
|
1
2
|
import type { SimpleClient } from '@simpleplatform/sdk/space';
|
|
3
|
+
export type { RecordWhere } from '@simpleplatform/sdk/graphql';
|
|
2
4
|
export interface TableRecordSourceV1 {
|
|
3
5
|
appId: string;
|
|
4
6
|
kind: 'table';
|
|
@@ -13,26 +15,6 @@ export interface RecordReferenceV1 {
|
|
|
13
15
|
export type ViewItemReferenceV1 = RecordReferenceV1 & {
|
|
14
16
|
kind: 'record';
|
|
15
17
|
};
|
|
16
|
-
export declare const FILTER_OPERATORS_V1: readonly ["between", "contained_in", "contains", "ends_with", "eq", "future", "gt", "gte", "has_key", "has_keys_all", "has_keys_any", "in", "is_empty", "is_false", "is_not_empty", "is_not_null", "is_null", "is_true", "last_month", "last_n_days", "last_week", "last_year", "lt", "lte", "neq", "next_n_days", "nin", "past", "path_exists", "regex", "starts_with", "this_month", "this_week", "this_year", "today", "yesterday"];
|
|
17
|
-
export type FilterOperatorV1 = typeof FILTER_OPERATORS_V1[number];
|
|
18
|
-
export type FilterValueV1 = boolean | null | number | string | FilterValueV1[] | {
|
|
19
|
-
[key: string]: FilterValueV1;
|
|
20
|
-
};
|
|
21
|
-
export type FilterNodeV1 = {
|
|
22
|
-
children: FilterNodeV1[];
|
|
23
|
-
kind: 'group';
|
|
24
|
-
operator: 'and' | 'or';
|
|
25
|
-
} | {
|
|
26
|
-
fieldName: string;
|
|
27
|
-
kind: 'predicate';
|
|
28
|
-
operator: FilterOperatorV1;
|
|
29
|
-
value?: FilterValueV1 | FilterValueV1[];
|
|
30
|
-
value2?: FilterValueV1;
|
|
31
|
-
};
|
|
32
|
-
export interface FilterExpressionV1 {
|
|
33
|
-
root: FilterNodeV1;
|
|
34
|
-
version: 1;
|
|
35
|
-
}
|
|
36
18
|
export declare const RECORD_VIEW_ICON_IDS_V1: readonly ["lucide:circle-alert", "lucide:arrow-up-right", "lucide:columns-3", "lucide:box", "lucide:calendar-days", "lucide:check", "lucide:clock-3", "lucide:file", "lucide:circle-question-mark", "lucide:inbox", "lucide:layout-grid", "lucide:list", "lucide:mail", "lucide:settings", "lucide:star", "lucide:table", "lucide:tag", "lucide:user-round", "lucide:video"];
|
|
37
19
|
export type RecordViewIconIdV1 = typeof RECORD_VIEW_ICON_IDS_V1[number];
|
|
38
20
|
export interface RecordSortV1 {
|
|
@@ -43,28 +25,32 @@ export interface RecordViewSummaryV1 {
|
|
|
43
25
|
fieldName: string;
|
|
44
26
|
operation: 'average' | 'max' | 'min' | 'sum';
|
|
45
27
|
}
|
|
46
|
-
export declare const RECORD_TILE_PRESENTATIONS_V1: readonly ["
|
|
28
|
+
export declare const RECORD_TILE_PRESENTATIONS_V1: readonly ["standard", "media", "message"];
|
|
47
29
|
export type RecordTilePresentationV1 = typeof RECORD_TILE_PRESENTATIONS_V1[number];
|
|
48
30
|
export type RecordTileVisualV1 = {
|
|
49
31
|
altFieldName?: string;
|
|
50
32
|
fieldName: string;
|
|
51
33
|
fit?: 'contain' | 'cover';
|
|
52
34
|
kind: 'image';
|
|
35
|
+
} | {
|
|
36
|
+
altFieldName?: string;
|
|
37
|
+
fieldName: string;
|
|
38
|
+
kind: 'avatar';
|
|
53
39
|
} | {
|
|
54
40
|
iconId: RecordViewIconIdV1;
|
|
55
41
|
kind: 'icon';
|
|
56
42
|
} | {
|
|
57
43
|
fallbackIconId: RecordViewIconIdV1;
|
|
58
44
|
fieldName: string;
|
|
59
|
-
iconsByValue: Record<string, RecordViewIconIdV1>;
|
|
60
45
|
kind: 'enum-icon';
|
|
61
46
|
};
|
|
62
47
|
export interface RecordTileLayoutV1 {
|
|
63
48
|
badgeFieldNames?: string[];
|
|
49
|
+
badgeStyle?: 'filled' | 'outline';
|
|
64
50
|
detailFieldNames?: string[];
|
|
65
51
|
eyebrowFieldName?: string;
|
|
66
52
|
presentation: RecordTilePresentationV1;
|
|
67
|
-
|
|
53
|
+
subtitleFieldNames?: string[];
|
|
68
54
|
titleFieldName: string;
|
|
69
55
|
trailingFieldName?: string;
|
|
70
56
|
version: 1;
|
|
@@ -73,7 +59,8 @@ export interface RecordTileLayoutV1 {
|
|
|
73
59
|
export declare const RECORD_VIEW_KINDS_V1: readonly ["board", "inbox", "list", "table"];
|
|
74
60
|
export type RecordViewKindV1 = typeof RECORD_VIEW_KINDS_V1[number];
|
|
75
61
|
export interface RecordViewPresetBaseV1 {
|
|
76
|
-
|
|
62
|
+
/** Native GraphQL where value; the platform validates it against the source before querying. */
|
|
63
|
+
filter?: RecordWhere;
|
|
77
64
|
id: string;
|
|
78
65
|
orderBy?: RecordSortV1[];
|
|
79
66
|
title: string;
|
|
@@ -126,8 +113,8 @@ export type ControlledFilterPropsV1 = {
|
|
|
126
113
|
filter?: never;
|
|
127
114
|
onFilterChange?: never;
|
|
128
115
|
} | {
|
|
129
|
-
filter:
|
|
130
|
-
onFilterChange: (filter:
|
|
116
|
+
filter: RecordWhere | undefined;
|
|
117
|
+
onFilterChange: (filter: RecordWhere | undefined) => void;
|
|
131
118
|
};
|
|
132
119
|
export interface RecordViewPropsV1<TPreset extends RecordViewPresetV1> {
|
|
133
120
|
client: SimpleClient;
|
|
@@ -156,10 +143,6 @@ export declare function validateRecordReferenceV1(value: unknown): RecordReferen
|
|
|
156
143
|
export declare function isRecordReferenceV1(value: unknown): value is RecordReferenceV1;
|
|
157
144
|
export declare function validateViewItemReferenceV1(value: unknown): ViewItemReferenceV1;
|
|
158
145
|
export declare function isViewItemReferenceV1(value: unknown): value is ViewItemReferenceV1;
|
|
159
|
-
export declare function validateFilterExpressionV1(value: unknown): FilterExpressionV1;
|
|
160
|
-
/** Validates filter shape for the authorized record source. */
|
|
161
|
-
export declare function validateSourceFilterExpressionV1(source: RecordSourceV1, value: unknown): FilterExpressionV1;
|
|
162
|
-
export declare function isFilterExpressionV1(value: unknown): value is FilterExpressionV1;
|
|
163
146
|
export declare function validateRecordSortV1(value: unknown): RecordSortV1;
|
|
164
147
|
export declare function isRecordSortV1(value: unknown): value is RecordSortV1;
|
|
165
148
|
export declare function validateRecordTileLayoutV1(value: unknown): RecordTileLayoutV1;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"views.d.ts","sourceRoot":"","sources":["../../src/contracts/views.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAA;AAE7D,MAAM,WAAW,mBAAmB;IAClC,KAAK,EAAE,MAAM,CAAA;IACb,IAAI,EAAE,OAAO,CAAA;IACb,OAAO,EAAE,MAAM,CAAA;CAChB;AAED,MAAM,MAAM,cAAc,GAAG,mBAAmB,CAAA;AAEhD,MAAM,WAAW,iBAAiB;IAChC,KAAK,EAAE,MAAM,CAAA;IACb,QAAQ,EAAE,MAAM,CAAA;IAChB,SAAS,EAAE,MAAM,CAAA;CAClB;AAED,MAAM,MAAM,mBAAmB,GAAG,iBAAiB,GAAG;IAAE,IAAI,EAAE,QAAQ,CAAA;CAAE,CAAA;AAExE,eAAO,MAAM,
|
|
1
|
+
{"version":3,"file":"views.d.ts","sourceRoot":"","sources":["../../src/contracts/views.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAA;AAC9D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAA;AAE7D,YAAY,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAA;AAE9D,MAAM,WAAW,mBAAmB;IAClC,KAAK,EAAE,MAAM,CAAA;IACb,IAAI,EAAE,OAAO,CAAA;IACb,OAAO,EAAE,MAAM,CAAA;CAChB;AAED,MAAM,MAAM,cAAc,GAAG,mBAAmB,CAAA;AAEhD,MAAM,WAAW,iBAAiB;IAChC,KAAK,EAAE,MAAM,CAAA;IACb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10
|
-
'has_key',
|
|
11
|
-
'has_keys_all',
|
|
12
|
-
'has_keys_any',
|
|
13
|
-
'in',
|
|
14
|
-
'is_empty',
|
|
15
|
-
'is_false',
|
|
16
|
-
'is_not_empty',
|
|
17
|
-
'is_not_null',
|
|
18
|
-
'is_null',
|
|
19
|
-
'is_true',
|
|
20
|
-
'last_month',
|
|
21
|
-
'last_n_days',
|
|
22
|
-
'last_week',
|
|
23
|
-
'last_year',
|
|
24
|
-
'lt',
|
|
25
|
-
'lte',
|
|
26
|
-
'neq',
|
|
27
|
-
'next_n_days',
|
|
28
|
-
'nin',
|
|
29
|
-
'past',
|
|
30
|
-
'path_exists',
|
|
31
|
-
'regex',
|
|
32
|
-
'starts_with',
|
|
33
|
-
'this_month',
|
|
34
|
-
'this_week',
|
|
35
|
-
'this_year',
|
|
36
|
-
'today',
|
|
37
|
-
'yesterday',
|
|
38
|
-
];
|
|
39
1
|
export const RECORD_VIEW_ICON_IDS_V1 = [
|
|
40
2
|
'lucide:circle-alert',
|
|
41
3
|
'lucide:arrow-up-right',
|
|
@@ -58,13 +20,9 @@ export const RECORD_VIEW_ICON_IDS_V1 = [
|
|
|
58
20
|
'lucide:video',
|
|
59
21
|
];
|
|
60
22
|
export const RECORD_TILE_PRESENTATIONS_V1 = [
|
|
61
|
-
'
|
|
62
|
-
'email',
|
|
23
|
+
'standard',
|
|
63
24
|
'media',
|
|
64
|
-
'
|
|
65
|
-
'row',
|
|
66
|
-
'spotlight',
|
|
67
|
-
'status',
|
|
25
|
+
'message',
|
|
68
26
|
];
|
|
69
27
|
export const RECORD_VIEW_KINDS_V1 = ['board', 'inbox', 'list', 'table'];
|
|
70
28
|
export class RecordViewContractError extends Error {
|
|
@@ -158,165 +116,49 @@ export function isViewItemReferenceV1(value) {
|
|
|
158
116
|
return false;
|
|
159
117
|
}
|
|
160
118
|
}
|
|
161
|
-
const MAX_FILTER_DEPTH = 8;
|
|
162
|
-
const MAX_FILTER_NODES = 100;
|
|
163
|
-
const MAX_GROUP_CHILDREN = 50;
|
|
164
|
-
const MAX_OPERAND_DEPTH = 4;
|
|
165
|
-
const MAX_OPERAND_ITEMS = 100;
|
|
166
|
-
const MAX_STRING_LENGTH = 4096;
|
|
167
119
|
const MAX_PRESETS = 20;
|
|
168
120
|
const MAX_VIEW_FIELDS = 40;
|
|
169
121
|
const MAX_SORT_FIELDS = 5;
|
|
170
122
|
const MAX_LANES = 20;
|
|
171
123
|
const MAX_LANE_PAGE_SIZE = 50;
|
|
124
|
+
const MAX_RECORD_WHERE_DEPTH = 8;
|
|
125
|
+
const MAX_RECORD_WHERE_NODES = 100;
|
|
126
|
+
const MAX_RECORD_WHERE_ENTRIES = 50;
|
|
172
127
|
const SAFE_TILE_ICON_IDS = new Set(RECORD_VIEW_ICON_IDS_V1);
|
|
173
128
|
const isSafeTileIconId = (value) => typeof value === 'string' && SAFE_TILE_ICON_IDS.has(value);
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
if (depth > MAX_OPERAND_DEPTH) {
|
|
194
|
-
throw new RecordViewContractError('Filter operand is nested too deeply.');
|
|
195
|
-
}
|
|
196
|
-
if (value === null || typeof value === 'boolean')
|
|
197
|
-
return value;
|
|
198
|
-
if (typeof value === 'number' && Number.isFinite(value))
|
|
199
|
-
return value;
|
|
200
|
-
if (typeof value === 'string') {
|
|
201
|
-
if (value.length > MAX_STRING_LENGTH)
|
|
202
|
-
throw new RecordViewContractError('Filter operand string is too long.');
|
|
203
|
-
return value;
|
|
204
|
-
}
|
|
205
|
-
if (typeof value !== 'object')
|
|
206
|
-
throw new RecordViewContractError('Filter operands must be JSON values.');
|
|
207
|
-
if (seen.has(value))
|
|
208
|
-
throw new RecordViewContractError('Filter operands cannot contain cycles.');
|
|
209
|
-
seen.add(value);
|
|
210
|
-
try {
|
|
211
|
-
if (Array.isArray(value)) {
|
|
212
|
-
if (value.length > MAX_OPERAND_ITEMS)
|
|
213
|
-
throw new RecordViewContractError('Filter operand contains too many items.');
|
|
214
|
-
return value.map(item => validateJsonValue(item, depth + 1, seen));
|
|
215
|
-
}
|
|
216
|
-
if (!isPlainObject(value))
|
|
217
|
-
throw new RecordViewContractError('Filter operands must be plain JSON objects.');
|
|
218
|
-
const entries = Object.entries(value);
|
|
219
|
-
if (entries.length > MAX_OPERAND_ITEMS)
|
|
220
|
-
throw new RecordViewContractError('Filter operand contains too many properties.');
|
|
221
|
-
return Object.fromEntries(entries.map(([key, item]) => {
|
|
222
|
-
if (!key || key.length > 128 || key === '__proto__' || key === 'constructor' || key === 'prototype')
|
|
223
|
-
throw new RecordViewContractError('Filter operand contains an invalid key.');
|
|
224
|
-
return [key, validateJsonValue(item, depth + 1, seen)];
|
|
225
|
-
}));
|
|
226
|
-
}
|
|
227
|
-
finally {
|
|
228
|
-
seen.delete(value);
|
|
229
|
-
}
|
|
230
|
-
}
|
|
231
|
-
function validateFilterNode(node, depth, state) {
|
|
232
|
-
if (depth > MAX_FILTER_DEPTH || ++state.count > MAX_FILTER_NODES)
|
|
233
|
-
throw new RecordViewContractError('Filter expression is nested too deeply or has too many nodes.');
|
|
234
|
-
if (!isPlainObject(node)) {
|
|
235
|
-
throw new RecordViewContractError('Filter node must be an object.');
|
|
236
|
-
}
|
|
237
|
-
if (node.kind === 'group') {
|
|
238
|
-
assertOnlyKeys(node, ['children', 'kind', 'operator'], 'Filter group');
|
|
239
|
-
if (node.operator !== 'and' && node.operator !== 'or') {
|
|
240
|
-
throw new RecordViewContractError(`Filter group operator must be 'and' or 'or', got ${String(node.operator)}.`);
|
|
241
|
-
}
|
|
242
|
-
if (!Array.isArray(node.children) || node.children.length === 0 || node.children.length > MAX_GROUP_CHILDREN) {
|
|
243
|
-
throw new RecordViewContractError('Filter group children must contain between 1 and 50 nodes.');
|
|
244
|
-
}
|
|
245
|
-
return {
|
|
246
|
-
children: node.children.map(child => validateFilterNode(child, depth + 1, state)),
|
|
247
|
-
kind: 'group',
|
|
248
|
-
operator: node.operator,
|
|
249
|
-
};
|
|
250
|
-
}
|
|
251
|
-
if (node.kind === 'predicate') {
|
|
252
|
-
if (!isNonEmptyString(node.fieldName)) {
|
|
253
|
-
throw new RecordViewContractError('Filter predicate fieldName must be a non-empty string.');
|
|
254
|
-
}
|
|
255
|
-
if (node.fieldName.length > 200)
|
|
256
|
-
throw new RecordViewContractError('Filter predicate fieldName must be at most 200 characters.');
|
|
257
|
-
assertOnlyKeys(node, ['fieldName', 'kind', 'operator', 'value', 'value2'], 'Filter predicate');
|
|
258
|
-
if (!FILTER_OPERATORS_V1.includes(node.operator)) {
|
|
259
|
-
throw new RecordViewContractError(`Unknown filter operator: ${String(node.operator)}.`);
|
|
129
|
+
function assertRecordWhereShape(value, depth = 1, state = { count: 0 }) {
|
|
130
|
+
if (depth > MAX_RECORD_WHERE_DEPTH || ++state.count > MAX_RECORD_WHERE_NODES)
|
|
131
|
+
throw new RecordViewContractError('RecordWhere is nested too deeply or has too many conditions.');
|
|
132
|
+
if (!isPlainObject(value))
|
|
133
|
+
throw new RecordViewContractError('RecordWhere must be an object.');
|
|
134
|
+
const entries = Object.entries(value);
|
|
135
|
+
if (depth > 1 && entries.length === 0)
|
|
136
|
+
throw new RecordViewContractError('RecordWhere clauses cannot be empty.');
|
|
137
|
+
if (entries.length > MAX_RECORD_WHERE_ENTRIES)
|
|
138
|
+
throw new RecordViewContractError(`RecordWhere can contain at most ${MAX_RECORD_WHERE_ENTRIES} clauses.`);
|
|
139
|
+
for (const [key, condition] of entries) {
|
|
140
|
+
if (key.includes('.'))
|
|
141
|
+
throw new RecordViewContractError('Dotted relationship paths must use nested RecordWhere objects.');
|
|
142
|
+
if (key === '_and' || key === '_or') {
|
|
143
|
+
if (!Array.isArray(condition) || condition.length === 0 || condition.length > MAX_RECORD_WHERE_ENTRIES)
|
|
144
|
+
throw new RecordViewContractError(`${key} must contain 1 to ${MAX_RECORD_WHERE_ENTRIES} clauses.`);
|
|
145
|
+
for (const clause of condition)
|
|
146
|
+
assertRecordWhereShape(clause, depth + 1, state);
|
|
147
|
+
continue;
|
|
260
148
|
}
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
if (FILTER_OPERATORS_WITHOUT_VALUES.has(operator)) {
|
|
265
|
-
if (hasValue || hasValue2)
|
|
266
|
-
throw new RecordViewContractError(`Filter operator ${operator} does not accept a value.`);
|
|
149
|
+
if (key === '_not') {
|
|
150
|
+
assertRecordWhereShape(condition, depth + 1, state);
|
|
151
|
+
continue;
|
|
267
152
|
}
|
|
268
|
-
|
|
269
|
-
throw new RecordViewContractError(
|
|
153
|
+
if (!isPlainObject(condition))
|
|
154
|
+
throw new RecordViewContractError('RecordWhere field conditions must use native operator objects.');
|
|
155
|
+
if (Object.keys(condition).length === 0)
|
|
156
|
+
throw new RecordViewContractError('RecordWhere field conditions cannot be empty.');
|
|
157
|
+
for (const [operator, operand] of Object.entries(condition)) {
|
|
158
|
+
if (operator.startsWith('_') && !['_and', '_or', '_not'].includes(operator))
|
|
159
|
+
continue;
|
|
160
|
+
assertRecordWhereShape({ [operator]: operand }, depth + 1, state);
|
|
270
161
|
}
|
|
271
|
-
if (operator === 'between' && !hasValue2)
|
|
272
|
-
throw new RecordViewContractError('Filter operator between requires two values.');
|
|
273
|
-
if (operator !== 'between' && hasValue2)
|
|
274
|
-
throw new RecordViewContractError(`Filter operator ${operator} does not accept a second value.`);
|
|
275
|
-
if ((operator === 'last_n_days' || operator === 'next_n_days') && typeof node.value !== 'number')
|
|
276
|
-
throw new RecordViewContractError(`Filter operator ${operator} requires a number.`);
|
|
277
|
-
const value = hasValue ? validateJsonValue(node.value) : undefined;
|
|
278
|
-
const value2 = hasValue2 ? validateJsonValue(node.value2) : undefined;
|
|
279
|
-
if (operator === 'between' && ((typeof value === 'object' && value !== null) || (typeof value2 === 'object' && value2 !== null)))
|
|
280
|
-
throw new RecordViewContractError('The between filter requires scalar bounds.');
|
|
281
|
-
if (value !== undefined && Array.isArray(value) && value.length > MAX_OPERAND_ITEMS)
|
|
282
|
-
throw new RecordViewContractError('Filter operand contains too many items.');
|
|
283
|
-
return {
|
|
284
|
-
fieldName: node.fieldName,
|
|
285
|
-
kind: 'predicate',
|
|
286
|
-
operator: node.operator,
|
|
287
|
-
...(value !== undefined ? { value } : {}),
|
|
288
|
-
...(value2 !== undefined ? { value2 } : {}),
|
|
289
|
-
};
|
|
290
|
-
}
|
|
291
|
-
throw new RecordViewContractError(`Unknown filter node kind: ${String(node.kind)}.`);
|
|
292
|
-
}
|
|
293
|
-
export function validateFilterExpressionV1(value) {
|
|
294
|
-
if (!isPlainObject(value)) {
|
|
295
|
-
throw new RecordViewContractError('Filter expression must be an object.');
|
|
296
|
-
}
|
|
297
|
-
if (value.version !== 1) {
|
|
298
|
-
throw new RecordViewContractError(`Filter expression version must be 1, got ${String(value.version)}.`);
|
|
299
|
-
}
|
|
300
|
-
assertOnlyKeys(value, ['root', 'version'], 'Filter expression');
|
|
301
|
-
const root = validateFilterNode(value.root, 1, { count: 0 });
|
|
302
|
-
return {
|
|
303
|
-
root,
|
|
304
|
-
version: 1,
|
|
305
|
-
};
|
|
306
|
-
}
|
|
307
|
-
/** Validates filter shape for the authorized record source. */
|
|
308
|
-
export function validateSourceFilterExpressionV1(source, value) {
|
|
309
|
-
validateRecordSourceV1(source);
|
|
310
|
-
const validatedFilter = validateFilterExpressionV1(value);
|
|
311
|
-
return validatedFilter;
|
|
312
|
-
}
|
|
313
|
-
export function isFilterExpressionV1(value) {
|
|
314
|
-
try {
|
|
315
|
-
validateFilterExpressionV1(value);
|
|
316
|
-
return true;
|
|
317
|
-
}
|
|
318
|
-
catch {
|
|
319
|
-
return false;
|
|
320
162
|
}
|
|
321
163
|
}
|
|
322
164
|
export function validateRecordSortV1(value) {
|
|
@@ -359,16 +201,23 @@ export function validateRecordTileLayoutV1(value) {
|
|
|
359
201
|
if (!isNonEmptyString(value.titleFieldName)) {
|
|
360
202
|
throw new RecordViewContractError('Record tile layout titleFieldName must be a non-empty string.');
|
|
361
203
|
}
|
|
362
|
-
if (value.presentation
|
|
363
|
-
|
|
364
|
-
|
|
204
|
+
if (value.badgeStyle !== undefined && (value.presentation !== 'standard' || !['filled', 'outline'].includes(String(value.badgeStyle))))
|
|
205
|
+
throw new RecordViewContractError('Tile badgeStyle must be filled or outline on standard tiles.');
|
|
206
|
+
if (value.presentation === 'message') {
|
|
207
|
+
if (!isNonEmptyString(value.eyebrowFieldName)
|
|
208
|
+
|| !Array.isArray(value.subtitleFieldNames)
|
|
209
|
+
|| value.subtitleFieldNames.length === 0
|
|
210
|
+
|| value.subtitleFieldNames.length > MAX_VIEW_FIELDS
|
|
211
|
+
|| !value.subtitleFieldNames.every(name => isNonEmptyString(name) && name.length <= 200)
|
|
212
|
+
|| !isNonEmptyString(value.trailingFieldName)) {
|
|
213
|
+
throw new RecordViewContractError('Message tiles require sender, preview, and received-at fields.');
|
|
365
214
|
}
|
|
366
215
|
if (value.badgeFieldNames !== undefined || value.detailFieldNames !== undefined || value.visual !== undefined) {
|
|
367
216
|
throw new RecordViewContractError('Email tiles do not support badges, details, or visuals.');
|
|
368
217
|
}
|
|
369
218
|
}
|
|
370
|
-
assertOnlyKeys(value, ['badgeFieldNames', 'detailFieldNames', 'eyebrowFieldName', 'presentation', '
|
|
371
|
-
for (const name of ['titleFieldName', 'eyebrowFieldName', '
|
|
219
|
+
assertOnlyKeys(value, ['badgeFieldNames', 'badgeStyle', 'detailFieldNames', 'eyebrowFieldName', 'presentation', 'subtitleFieldNames', 'titleFieldName', 'trailingFieldName', 'version', 'visual'], 'Record tile layout');
|
|
220
|
+
for (const name of ['titleFieldName', 'eyebrowFieldName', 'trailingFieldName']) {
|
|
372
221
|
const fieldName = value[name];
|
|
373
222
|
if (fieldName !== undefined && (typeof fieldName !== 'string' || fieldName.length > 200))
|
|
374
223
|
throw new RecordViewContractError(`Record tile layout ${name} must be at most 200 characters.`);
|
|
@@ -398,6 +247,22 @@ export function validateRecordTileLayoutV1(value) {
|
|
|
398
247
|
kind: 'image',
|
|
399
248
|
};
|
|
400
249
|
}
|
|
250
|
+
else if (value.visual.kind === 'avatar') {
|
|
251
|
+
if (value.presentation !== 'standard')
|
|
252
|
+
throw new RecordViewContractError('Tile avatar visuals are only supported on standard tiles.');
|
|
253
|
+
if (!isNonEmptyString(value.visual.fieldName))
|
|
254
|
+
throw new RecordViewContractError('Tile avatar visual requires fieldName.');
|
|
255
|
+
if (value.visual.altFieldName !== undefined && !isNonEmptyString(value.visual.altFieldName))
|
|
256
|
+
throw new RecordViewContractError('Tile avatar visual altFieldName must be a non-empty string.');
|
|
257
|
+
if (value.visual.fieldName.length > 200 || (typeof value.visual.altFieldName === 'string' && value.visual.altFieldName.length > 200))
|
|
258
|
+
throw new RecordViewContractError('Tile avatar visual field names must be at most 200 characters.');
|
|
259
|
+
assertOnlyKeys(value.visual, ['altFieldName', 'fieldName', 'kind'], 'Tile avatar visual');
|
|
260
|
+
visual = {
|
|
261
|
+
...(value.visual.altFieldName ? { altFieldName: value.visual.altFieldName } : {}),
|
|
262
|
+
fieldName: value.visual.fieldName,
|
|
263
|
+
kind: 'avatar',
|
|
264
|
+
};
|
|
265
|
+
}
|
|
401
266
|
else if (value.visual.kind === 'icon') {
|
|
402
267
|
if (!isNonEmptyString(value.visual.iconId)) {
|
|
403
268
|
throw new RecordViewContractError('Tile icon visual requires iconId.');
|
|
@@ -411,26 +276,19 @@ export function validateRecordTileLayoutV1(value) {
|
|
|
411
276
|
if (!isNonEmptyString(value.visual.fieldName)) {
|
|
412
277
|
throw new RecordViewContractError('Tile enum-icon visual requires fieldName.');
|
|
413
278
|
}
|
|
414
|
-
if (!isPlainObject(value.visual.iconsByValue)) {
|
|
415
|
-
throw new RecordViewContractError('Tile enum-icon visual requires iconsByValue map.');
|
|
416
|
-
}
|
|
417
|
-
const iconValues = Object.keys(value.visual.iconsByValue);
|
|
418
|
-
if (iconValues.length > 100 || iconValues.some(key => !isNonEmptyString(key) || key.length > 200))
|
|
419
|
-
throw new RecordViewContractError('Tile enum-icon map must contain at most 100 unpadded, non-empty values of at most 200 characters.');
|
|
420
279
|
if (!isNonEmptyString(value.visual.fallbackIconId)) {
|
|
421
280
|
throw new RecordViewContractError('Tile enum-icon visual requires fallbackIconId.');
|
|
422
281
|
}
|
|
423
|
-
if (value.visual.fieldName.length > 200)
|
|
282
|
+
if (value.visual.fieldName.length > 200) {
|
|
424
283
|
throw new RecordViewContractError('Tile enum-icon fieldName must be at most 200 characters.');
|
|
425
|
-
for (const iconId of [value.visual.fallbackIconId, ...Object.values(value.visual.iconsByValue)]) {
|
|
426
|
-
if (!isSafeTileIconId(iconId))
|
|
427
|
-
throw new RecordViewContractError(`Tile icon is not in the platform icon catalogue: ${String(iconId)}.`);
|
|
428
284
|
}
|
|
429
|
-
|
|
285
|
+
if (!isSafeTileIconId(value.visual.fallbackIconId)) {
|
|
286
|
+
throw new RecordViewContractError(`Tile icon is not in the platform icon catalogue: ${String(value.visual.fallbackIconId)}.`);
|
|
287
|
+
}
|
|
288
|
+
assertOnlyKeys(value.visual, ['fallbackIconId', 'fieldName', 'kind'], 'Tile enum icon visual');
|
|
430
289
|
visual = {
|
|
431
290
|
fallbackIconId: value.visual.fallbackIconId,
|
|
432
291
|
fieldName: value.visual.fieldName,
|
|
433
|
-
iconsByValue: Object.fromEntries(Object.entries(value.visual.iconsByValue).map(([key, iconId]) => [key, iconId])),
|
|
434
292
|
kind: 'enum-icon',
|
|
435
293
|
};
|
|
436
294
|
}
|
|
@@ -451,18 +309,16 @@ export function validateRecordTileLayoutV1(value) {
|
|
|
451
309
|
if (value.eyebrowFieldName !== undefined && !isNonEmptyString(value.eyebrowFieldName)) {
|
|
452
310
|
throw new RecordViewContractError('Tile layout eyebrowFieldName must be a non-empty string.');
|
|
453
311
|
}
|
|
454
|
-
if (value.subtitleFieldName !== undefined && !isNonEmptyString(value.subtitleFieldName)) {
|
|
455
|
-
throw new RecordViewContractError('Tile layout subtitleFieldName must be a non-empty string.');
|
|
456
|
-
}
|
|
457
312
|
if (value.trailingFieldName !== undefined && !isNonEmptyString(value.trailingFieldName)) {
|
|
458
313
|
throw new RecordViewContractError('Tile layout trailingFieldName must be a non-empty string.');
|
|
459
314
|
}
|
|
460
315
|
return {
|
|
461
316
|
...(value.badgeFieldNames !== undefined ? { badgeFieldNames: checkOptionalStringArray(value.badgeFieldNames, 'badgeFieldNames') } : {}),
|
|
317
|
+
...(value.badgeStyle !== undefined ? { badgeStyle: value.badgeStyle } : {}),
|
|
462
318
|
...(value.detailFieldNames !== undefined ? { detailFieldNames: checkOptionalStringArray(value.detailFieldNames, 'detailFieldNames') } : {}),
|
|
463
319
|
...(isNonEmptyString(value.eyebrowFieldName) ? { eyebrowFieldName: value.eyebrowFieldName } : {}),
|
|
464
320
|
presentation: value.presentation,
|
|
465
|
-
...(
|
|
321
|
+
...(value.subtitleFieldNames !== undefined ? { subtitleFieldNames: checkOptionalStringArray(value.subtitleFieldNames, 'subtitleFieldNames') } : {}),
|
|
466
322
|
titleFieldName: value.titleFieldName,
|
|
467
323
|
...(isNonEmptyString(value.trailingFieldName) ? { trailingFieldName: value.trailingFieldName } : {}),
|
|
468
324
|
version: 1,
|
|
@@ -491,10 +347,12 @@ function validatePresetBase(value) {
|
|
|
491
347
|
assertOnlyKeys(value, ['config', 'filter', 'id', 'kind', 'orderBy', 'title'], 'Preset');
|
|
492
348
|
if (value.id.length > 80 || value.title.length > 120)
|
|
493
349
|
throw new RecordViewContractError('Preset id must be at most 80 characters and title at most 120 characters.');
|
|
494
|
-
|
|
350
|
+
if (value.filter !== undefined)
|
|
351
|
+
assertRecordWhereShape(value.filter);
|
|
352
|
+
const filter = value.filter;
|
|
495
353
|
const orderBy = validateOrderBy(value.orderBy);
|
|
496
354
|
return {
|
|
497
|
-
...(filter ? { filter } : {}),
|
|
355
|
+
...(value.filter !== undefined ? { filter } : {}),
|
|
498
356
|
id: value.id,
|
|
499
357
|
...(orderBy ? { orderBy } : {}),
|
|
500
358
|
title: value.title,
|
|
@@ -789,14 +647,13 @@ export function validateControlledFilterPropsV1(props) {
|
|
|
789
647
|
throw new RecordViewContractError('Controlled filter requires onFilterChange callback.');
|
|
790
648
|
}
|
|
791
649
|
if (!hasFilter && hasOnFilterChange) {
|
|
792
|
-
throw new RecordViewContractError('Controlled onFilterChange requires filter
|
|
650
|
+
throw new RecordViewContractError('Controlled onFilterChange requires a filter prop.');
|
|
793
651
|
}
|
|
794
652
|
if (typeof props.onFilterChange !== 'function') {
|
|
795
653
|
throw new RecordViewContractError('onFilterChange must be a function.');
|
|
796
654
|
}
|
|
797
|
-
if (props.filter !== undefined)
|
|
798
|
-
|
|
799
|
-
}
|
|
655
|
+
if (props.filter !== undefined)
|
|
656
|
+
assertRecordWhereShape(props.filter);
|
|
800
657
|
return {
|
|
801
658
|
filter: props.filter,
|
|
802
659
|
onFilterChange: props.onFilterChange,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"status-badge.d.ts","sourceRoot":"","sources":["../../src/elements/status-badge.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAA;
|
|
1
|
+
{"version":3,"file":"status-badge.d.ts","sourceRoot":"","sources":["../../src/elements/status-badge.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAA;AA4DzE,QAAA,MAAM,eAAe,EAAE,OAAO,WAAsE,CAAA;AAEpG,8DAA8D;AAC9D,qBAAa,iBAAkB,SAAQ,eAAe;IACpD,MAAM,KAAK,kBAAkB,aAE5B;IAED,IAAI,WAAW,IAAI,MAAM,CAExB;IAED,IAAI,WAAW,CAAC,KAAK,EAAE,MAAM,EAE5B;IAED,IAAI,KAAK,IAAI,MAAM,CAElB;IAED,IAAI,KAAK,CAAC,KAAK,EAAE,MAAM,EAEtB;IAED,IAAI,IAAI,IAAI,qBAAqB,CAGhC;IAED,IAAI,IAAI,CAAC,KAAK,EAAE,qBAAqB,EAEpC;;IAOD,wBAAwB,IAAI,IAAI;IAIhC,iBAAiB,IAAI,IAAI;IAIzB,OAAO,CAAC,MAAM;CAqBf;AAED,wBAAgB,uBAAuB,IAAI,IAAI,CAK9C"}
|
|
@@ -9,7 +9,7 @@ const STATUS_BADGE_STYLES = `
|
|
|
9
9
|
[part="base"] {
|
|
10
10
|
align-items: center;
|
|
11
11
|
background: var(--simple-color-surface-sunken);
|
|
12
|
-
border:
|
|
12
|
+
border: none;
|
|
13
13
|
border-radius: var(--simple-radius-round);
|
|
14
14
|
box-sizing: border-box;
|
|
15
15
|
color: var(--simple-color-text-secondary);
|
|
@@ -18,33 +18,29 @@ const STATUS_BADGE_STYLES = `
|
|
|
18
18
|
font-weight: var(--simple-font-weight-medium);
|
|
19
19
|
line-height: var(--simple-line-height-tight);
|
|
20
20
|
max-width: 100%;
|
|
21
|
-
min-height:
|
|
21
|
+
min-height: 1.25rem;
|
|
22
22
|
overflow-wrap: anywhere;
|
|
23
|
-
padding: 0
|
|
23
|
+
padding: 0.125rem 0.625rem;
|
|
24
24
|
}
|
|
25
25
|
|
|
26
26
|
[part="base"][data-tone="info"] {
|
|
27
|
-
background: var(--simple-color-status-info
|
|
28
|
-
|
|
29
|
-
color: var(--simple-color-status-info-foreground);
|
|
27
|
+
background: color-mix(in srgb, var(--simple-color-status-info) 12%, transparent);
|
|
28
|
+
color: var(--simple-color-status-info);
|
|
30
29
|
}
|
|
31
30
|
|
|
32
31
|
[part="base"][data-tone="success"] {
|
|
33
|
-
background: var(--simple-color-status-success
|
|
34
|
-
|
|
35
|
-
color: var(--simple-color-status-success-foreground);
|
|
32
|
+
background: color-mix(in srgb, var(--simple-color-status-success) 12%, transparent);
|
|
33
|
+
color: var(--simple-color-status-success);
|
|
36
34
|
}
|
|
37
35
|
|
|
38
36
|
[part="base"][data-tone="warning"] {
|
|
39
|
-
background: var(--simple-color-status-warning
|
|
40
|
-
|
|
41
|
-
color: var(--simple-color-status-warning-foreground);
|
|
37
|
+
background: color-mix(in srgb, var(--simple-color-status-warning) 12%, transparent);
|
|
38
|
+
color: var(--simple-color-status-warning);
|
|
42
39
|
}
|
|
43
40
|
|
|
44
41
|
[part="base"][data-tone="danger"] {
|
|
45
|
-
background: var(--simple-color-status-danger
|
|
46
|
-
|
|
47
|
-
color: var(--simple-color-status-danger-foreground);
|
|
42
|
+
background: color-mix(in srgb, var(--simple-color-status-danger) 12%, transparent);
|
|
43
|
+
color: var(--simple-color-status-danger);
|
|
48
44
|
}
|
|
49
45
|
|
|
50
46
|
[part="description"] {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"record-view.d.ts","sourceRoot":"","sources":["../../src/react/record-view.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAEV,UAAU,EACV,aAAa,
|
|
1
|
+
{"version":3,"file":"record-view.d.ts","sourceRoot":"","sources":["../../src/react/record-view.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAEV,UAAU,EACV,aAAa,EACb,aAAa,EAKd,MAAM,uBAAuB,CAAA;AAe9B,MAAM,MAAM,iBAAiB,GACvB,OAAO,GACP,MAAM,GACN,OAAO,CAAA;AAoQb,wBAAgB,QAAQ,CAAC,KAAK,EAAE,aAAa,2CAE5C;AAED,wBAAgB,QAAQ,CAAC,KAAK,EAAE,aAAa,2CAE5C;AAED,wBAAgB,KAAK,CAAC,KAAK,EAAE,UAAU,2CAEtC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
2
|
import { useEffect, useRef, useState } from 'react';
|
|
3
|
-
import { RecordViewContractError, validateBoardPresetV1, validateControlledFilterPropsV1, validateDataGridPresetV1, validateListPresetV1, validateRecordSourceV1,
|
|
3
|
+
import { RecordViewContractError, validateBoardPresetV1, validateControlledFilterPropsV1, validateDataGridPresetV1, validateListPresetV1, validateRecordSourceV1, } from '../contracts/views.js';
|
|
4
4
|
import { loadRuntime, RuntimeLoadError } from '../runtime.js';
|
|
5
5
|
import { waitForElementMount } from './mount-boundary.js';
|
|
6
6
|
import { getManagedUiBridge } from './record-bridge.js';
|
|
@@ -24,10 +24,6 @@ function validateRecordViewProps(props) {
|
|
|
24
24
|
throw new RecordViewContractError('onMoveRequest must be a function.');
|
|
25
25
|
break;
|
|
26
26
|
}
|
|
27
|
-
if (props.preset?.filter !== undefined)
|
|
28
|
-
validateSourceFilterExpressionV1(props.source, props.preset.filter);
|
|
29
|
-
if (props.filter !== undefined)
|
|
30
|
-
validateSourceFilterExpressionV1(props.source, props.filter);
|
|
31
27
|
if (props.onItemOpen !== undefined && typeof props.onItemOpen !== 'function')
|
|
32
28
|
throw new RecordViewContractError('onItemOpen must be a function.');
|
|
33
29
|
}
|
|
@@ -119,8 +115,6 @@ function RecordViewAdapter(props) {
|
|
|
119
115
|
const mountController = new AbortController();
|
|
120
116
|
const mount = async () => {
|
|
121
117
|
try {
|
|
122
|
-
const currentProps = propsRef.current;
|
|
123
|
-
validateRecordViewProps(currentProps);
|
|
124
118
|
if (bridge.runtime) {
|
|
125
119
|
await loadRuntime(bridge.runtime);
|
|
126
120
|
}
|
|
@@ -130,6 +124,8 @@ function RecordViewAdapter(props) {
|
|
|
130
124
|
if (disposed || !containerRef.current) {
|
|
131
125
|
return;
|
|
132
126
|
}
|
|
127
|
+
const currentProps = propsRef.current;
|
|
128
|
+
validateRecordViewProps(currentProps);
|
|
133
129
|
element = document.createElement('simple-record-view');
|
|
134
130
|
element.style.display = 'block';
|
|
135
131
|
element.style.width = '100%';
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@simpleplatform/ui-kit",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.4.0",
|
|
5
5
|
"description": "Supported UI contracts and framework bridges for Simple Spaces",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"repository": {
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
"theme.css"
|
|
43
43
|
],
|
|
44
44
|
"peerDependencies": {
|
|
45
|
-
"@simpleplatform/sdk": "^4.
|
|
45
|
+
"@simpleplatform/sdk": "^4.1.0 || 0.0.0",
|
|
46
46
|
"react": ">=18.3.0 <20"
|
|
47
47
|
},
|
|
48
48
|
"dependencies": {
|
package/theme.css
CHANGED
|
@@ -64,17 +64,9 @@
|
|
|
64
64
|
--simple-color-action-danger-foreground: hsl(0 0% 98%);
|
|
65
65
|
--simple-gradient-action-primary: none;
|
|
66
66
|
--simple-color-status-info: hsl(221 83% 35%);
|
|
67
|
-
--simple-color-status-info-background: hsl(214 95% 93%);
|
|
68
|
-
--simple-color-status-info-foreground: hsl(221 83% 35%);
|
|
69
67
|
--simple-color-status-success: hsl(142 72% 25%);
|
|
70
|
-
--simple-color-status-success-background: hsl(142 76% 90%);
|
|
71
|
-
--simple-color-status-success-foreground: hsl(142 72% 25%);
|
|
72
68
|
--simple-color-status-warning: hsl(28 80% 25%);
|
|
73
|
-
--simple-color-status-warning-background: hsl(38 92% 90%);
|
|
74
|
-
--simple-color-status-warning-foreground: hsl(28 80% 25%);
|
|
75
69
|
--simple-color-status-danger: hsl(0 84.2% 60.2%);
|
|
76
|
-
--simple-color-status-danger-background: hsl(0 84% 95%);
|
|
77
|
-
--simple-color-status-danger-foreground: hsl(0 72% 35%);
|
|
78
70
|
--simple-color-field-background: hsl(0 0% 100%);
|
|
79
71
|
--simple-color-field-background-disabled: hsl(240 4.8% 95.9%);
|
|
80
72
|
--simple-color-field-border: hsl(240 5.9% 90%);
|
|
@@ -128,9 +120,9 @@
|
|
|
128
120
|
--simple-sidebar-width: 16rem;
|
|
129
121
|
--simple-radius-none: 0;
|
|
130
122
|
--simple-radius-sm: 0.25rem;
|
|
131
|
-
--simple-radius-md: 0.
|
|
132
|
-
--simple-radius-lg: 0.
|
|
133
|
-
--simple-radius-xl:
|
|
123
|
+
--simple-radius-md: 0.375rem;
|
|
124
|
+
--simple-radius-lg: 0.5rem;
|
|
125
|
+
--simple-radius-xl: 0.75rem;
|
|
134
126
|
--simple-radius-round: 9999px;
|
|
135
127
|
--simple-shadow-none: none;
|
|
136
128
|
--simple-shadow-sm: 0 1px 2px rgb(0 0 0 / 0.08);
|
|
@@ -192,17 +184,9 @@
|
|
|
192
184
|
--simple-color-navbar-primary: hsl(224.3 76.3% 48%);
|
|
193
185
|
--simple-color-navbar-primary-foreground: hsl(0 0% 100%);
|
|
194
186
|
--simple-color-status-danger: hsl(0 55% 42%);
|
|
195
|
-
--simple-color-status-danger-background: hsl(0 45% 24%);
|
|
196
|
-
--simple-color-status-danger-foreground: hsl(0 85% 88%);
|
|
197
187
|
--simple-color-status-info: hsl(214 70% 45%);
|
|
198
|
-
--simple-color-status-info-background: hsl(214 60% 25%);
|
|
199
|
-
--simple-color-status-info-foreground: hsl(214 95% 90%);
|
|
200
188
|
--simple-color-status-success: hsl(142 50% 38%);
|
|
201
|
-
--simple-color-status-success-background: hsl(142 45% 22%);
|
|
202
|
-
--simple-color-status-success-foreground: hsl(142 65% 85%);
|
|
203
189
|
--simple-color-status-warning: hsl(38 65% 42%);
|
|
204
|
-
--simple-color-status-warning-background: hsl(38 55% 24%);
|
|
205
|
-
--simple-color-status-warning-foreground: hsl(38 90% 85%);
|
|
206
190
|
--simple-color-surface: hsl(240 10% 3.9%);
|
|
207
191
|
--simple-color-surface-active: hsl(240 3.7% 21%);
|
|
208
192
|
--simple-color-surface-disabled: hsl(240 3.7% 15.9%);
|
|
@@ -329,17 +313,17 @@
|
|
|
329
313
|
|
|
330
314
|
/* Semantic utility families: status */
|
|
331
315
|
--color-status-info: var(--simple-color-status-info);
|
|
332
|
-
--color-status-info-background: var(--simple-color-status-info
|
|
333
|
-
--color-status-info-foreground: var(--simple-color-status-info
|
|
316
|
+
--color-status-info-background: color-mix(in srgb, var(--simple-color-status-info) 12%, transparent);
|
|
317
|
+
--color-status-info-foreground: var(--simple-color-status-info);
|
|
334
318
|
--color-status-success: var(--simple-color-status-success);
|
|
335
|
-
--color-status-success-background: var(--simple-color-status-success
|
|
336
|
-
--color-status-success-foreground: var(--simple-color-status-success
|
|
319
|
+
--color-status-success-background: color-mix(in srgb, var(--simple-color-status-success) 12%, transparent);
|
|
320
|
+
--color-status-success-foreground: var(--simple-color-status-success);
|
|
337
321
|
--color-status-warning: var(--simple-color-status-warning);
|
|
338
|
-
--color-status-warning-background: var(--simple-color-status-warning
|
|
339
|
-
--color-status-warning-foreground: var(--simple-color-status-warning
|
|
322
|
+
--color-status-warning-background: color-mix(in srgb, var(--simple-color-status-warning) 12%, transparent);
|
|
323
|
+
--color-status-warning-foreground: var(--simple-color-status-warning);
|
|
340
324
|
--color-status-danger: var(--simple-color-status-danger);
|
|
341
|
-
--color-status-danger-background: var(--simple-color-status-danger
|
|
342
|
-
--color-status-danger-foreground: var(--simple-color-status-danger
|
|
325
|
+
--color-status-danger-background: color-mix(in srgb, var(--simple-color-status-danger) 12%, transparent);
|
|
326
|
+
--color-status-danger-foreground: var(--simple-color-status-danger);
|
|
343
327
|
|
|
344
328
|
/* Semantic utility families: field */
|
|
345
329
|
--color-field-background: var(--simple-color-field-background);
|