@protobase/schema 0.55.5 → 0.55.7

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.
@@ -31,6 +31,8 @@ export declare const addressWords: {
31
31
  readonly open: "open";
32
32
  /** A record page's shown tab, by title. */
33
33
  readonly tab: "tab";
34
+ /** A record's standard page, `standard=true`, on a view whose record page is a component of the app's own. */
35
+ readonly standard: "standard";
34
36
  };
35
37
  /** The path of `address` below `basePath` (such as `/admin`), every name and key encoded the one way the app reads them. */
36
38
  export declare const appPath: (address: AppAddress, basePath?: string) => string;
@@ -30,7 +30,9 @@ const addressWords = {
30
30
  /** A record page's open collapsed group, by title, once per group. */
31
31
  open: "open",
32
32
  /** A record page's shown tab, by title. */
33
- tab: "tab"
33
+ tab: "tab",
34
+ /** A record's standard page, `standard=true`, on a view whose record page is a component of the app's own. */
35
+ standard: "standard"
34
36
  };
35
37
  const listWords = [
36
38
  "list",
@@ -87,6 +89,7 @@ const recordQuery = (address) => {
87
89
  if (address.edit) query.set(addressWords.edit, "true");
88
90
  for (const title of address.open ?? []) query.append(addressWords.open, title);
89
91
  if (address.tab) query.set(addressWords.tab, address.tab);
92
+ if (address.standard) query.set(addressWords.standard, "true");
90
93
  const text = query.toString();
91
94
  return text ? `?${text}` : "";
92
95
  };
@@ -139,13 +142,15 @@ const readAppPath = (pathAndQuery, pages) => {
139
142
  if (second !== void 0) {
140
143
  const open = [...new Set(url.searchParams.getAll(addressWords.open).filter((title) => title !== ""))];
141
144
  const tab = url.searchParams.get(addressWords.tab) || void 0;
145
+ const standard = url.searchParams.get(addressWords.standard) === "true";
142
146
  return {
143
147
  kind: "record",
144
148
  resource: first,
145
149
  key: second,
146
150
  ...url.searchParams.get(addressWords.edit) === "true" && { edit: true },
147
151
  ...open.length > 0 && { open },
148
- ...tab && { tab }
152
+ ...tab && { tab },
153
+ ...standard && { standard }
149
154
  };
150
155
  }
151
156
  const params = url.searchParams;
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { Rollup, RollupCount, RollupFn, RollupSource, RollupValue } from "./computed/rollup.js";
2
2
  import { FileOptions, FileProcessor, FileProcessorInput, ImageFormat, ImageVariant, ImageVariantOptions, imageFormats } from "./files/file-options.js";
3
- import { ActionInputKind, ActionInputModel, ActionModel, ActionRun, AppAddress, BadgeShape, BottomBarItemModel, BottomBarModel, CalendarView, CardFavoriteModel, CardPhotosModel, ChartGranularity, ChartModel, ChartRange, CheckedFilter, CommentsSectionModel, CompareOp, CreateModel, CustomSectionModel, DatePreset, DurationLiteral, DurationUnit, EventModel, EventOperation, ExportModel, FieldFormat, FieldModel, FieldPath, FieldType, FieldViewModel, FieldWidgetModel, FileFieldModel, FilterError, FilterErrorCode, FilterExpr, FilterLayout, FilterOf, FilterValue, FilterWidgetModel, FormModel, GalleryModel, GroupChartModel, GroupItemModel, GroupModel, HelpWhen, HistorySectionModel, JsonValue, KeyValue, LayoutItemModel, ListDisplayModel, ListDragModel, ListModel, ListQuery, Literal, MapSectionModel, MapView, NamedListModel, NavModel, NavRecentModel, NowValue, OrderByItem, ParentAccess, ParentModel, PeriodChartModel, PositionAfterModel, RecordChartModel, RecordChartRange, RecordMode, RecordWhen, RelatedColumnModel, RelatedModel, RelatedPresentation, ResourceModel, SaveFeedback, SaveSearchModel, SearchMatch, SearchResultModel, SearchesOfModel, SectionModel, SectionPresentation, ShowWhen, SignInPromptModel, SignInViewModel, SortSpec, Span, StatusTone, TabItemModel, TabModel, TimelineView, TitleFromModel, UserMenuItemModel, UserMenuModel, ViewModel } from "./model.js";
3
+ import { ActionInputKind, ActionInputModel, ActionModel, ActionRun, AppAddress, BadgeShape, BottomBarItemModel, BottomBarModel, CalendarView, CardFavoriteModel, CardPhotosModel, ChartGranularity, ChartModel, ChartRange, CheckedFilter, CommentsSectionModel, CompareOp, CreateModel, CustomSectionModel, DatePreset, DurationLiteral, DurationUnit, EventModel, EventOperation, ExportModel, FieldFormat, FieldModel, FieldPath, FieldType, FieldViewModel, FieldWidgetModel, FileFieldModel, FilterError, FilterErrorCode, FilterExpr, FilterLayout, FilterOf, FilterValue, FilterWidgetModel, FormModel, GalleryModel, GroupChartModel, GroupItemModel, GroupModel, HelpWhen, HistorySectionModel, JsonValue, KeyValue, LayoutItemModel, ListDisplayModel, ListDragModel, ListModel, ListQuery, Literal, MapSectionModel, MapView, NamedListModel, NavModel, NavRecentModel, NowValue, OrderByItem, ParentAccess, ParentModel, PeriodChartModel, PositionAfterModel, RecordChartModel, RecordChartRange, RecordMode, RecordPageModel, RecordWhen, RelatedColumnModel, RelatedModel, RelatedPresentation, ResourceModel, SaveFeedback, SaveSearchModel, SearchMatch, SearchResultModel, SearchesOfModel, SectionModel, SectionPresentation, ShowWhen, SignInPromptModel, SignInViewModel, SortSpec, Span, StatusTone, TabItemModel, TabModel, TimelineView, TitleFromModel, UserMenuItemModel, UserMenuModel, ViewModel } from "./model.js";
4
4
  import { AccessAction, AccessContext, AccessFn, AccessResult, AccessUser, FieldAccess, FieldRule } from "./access/types.js";
5
5
  import { Encrypted, encrypted } from "./encrypted-value.js";
6
6
  import { AnyField, Constraint, Field, FieldMeta, FieldTypeDef } from "./field.js";
@@ -47,4 +47,4 @@ import { AccessSource, ResolveOptions, ResolvedAccess, RowFilterOperation, acces
47
47
  import { restrictModel } from "./access/restrict.js";
48
48
  import "./access/index.js";
49
49
  import { AssistantAction, AssistantActionRequest, AssistantCardPart, AssistantDiff, AssistantEvent, AssistantMessage, AssistantMessageRequest, AssistantPart, AssistantState, AssistantStep, AssistantStepState, AssistantTablePart, AssistantTextPart, AssistantTone, AssistantWidgetPart } from "./assistant/protocol.js";
50
- export { type Access, type AccessAction, type AccessContext, type AccessFn, type AccessResult, type AccessSource, type AccessUser, type ActionInputKind, type ActionInputModel, type ActionModel, type ActionRun, type AnyField, type AppAddress, type ArgumentSpec, type ArgumentType, type ArgumentsSpec, type AssistantAction, type AssistantActionRequest, type AssistantCardPart, type AssistantDiff, type AssistantEvent, type AssistantMessage, type AssistantMessageRequest, type AssistantPart, type AssistantState, type AssistantStep, type AssistantStepState, type AssistantTablePart, type AssistantTextPart, type AssistantTone, type AssistantWidgetPart, type BadgeShape, type BottomBarItemModel, type BottomBarModel, type BottomBarNames, type BottomBarSource, type CalendarView, type Capability, type CapabilityAction, type CapabilityLimit, type CapabilityScope, type CardFavoriteModel, type CardPhotosModel, type ChartGranularity, type ChartInput, type ChartModel, type ChartRange, type CheckResult, type CheckedFilter, type CommentsSectionModel, type CompareOp, type ComponentRef, type ComputedReveal, type ConnectAddress, type Constraint, type CreateModel, type CreatedOptions, type CustomSectionModel, type DatePreset, type DeletedOptions, type DurationLiteral, type DurationUnit, type Encrypted, type EvaluateOptions, type EventActor, type EventContext, type EventHelpers, type EventMatch, type EventModel, type EventOperation, type EventSpec, type ExactCapability, type ExportModel, type Field, type FieldAccess, type FieldFormat, type FieldMeta, type FieldModel, type FieldPath, type FieldRefValue, type FieldRefs, type FieldRule, type FieldType, type FieldTypeDef, type FieldView, type FieldViewModel, type FieldViews, type FieldWidgetModel, type FieldsInput, type FileField, type FileFieldModel, type FileOptions, type FileProcessor, type FileProcessorInput, type FilterError, type FilterErrorCode, type FilterExpr, type FilterLayout, type FilterLimits, type FilterOf, type FilterParse, type FilterValue, type FilterWidgetModel, type FormAddress, type FormInput, type FormModel, type GalleryModel, type Grant, type GroupChartInput, type GroupChartModel, type GroupItemModel, type GroupModel, type HeldCapability, type HelpWhen, type HistorySectionModel, type ImageFormat, type ImageVariant, type ImageVariantOptions, type InferRecord, type Issue, type JsonValue, type KeyOf, type KeyRefs, type KeyType, type KeyValue, type LayoutItemModel, type ListColumn, type ListDisplayModel, type ListDragModel, type ListModel, type ListQuery, type Literal, type MapSectionModel, type MapView, type NamedListModel, type NavModel, type NavRecentModel, type NowValue, type OrderByCheck, type OrderByItem, type OrderByParse, type ParentAccess, type ParentModel, type PeriodChartInput, type PeriodChartModel, type PositionAfterModel, type RecordChartModel, type RecordChartRange, type RecordKey, type RecordMode, type RecordOf, type RecordWhen, type Ref, type Refs, type RelatedColumnModel, type RelatedModel, type RelatedPresentation, type RelationField, type ResolveOptions, type ResolvedAccess, type ResourceBuilder, type ResourceModel, type RevealCaller, type RoleEntry, type RoleLimit, type Roles, type RolesOptions, type Rollup, type RollupCount, type RollupFn, type RollupSource, type RollupValue, type RowFilterOperation, type Rule, type SaveFeedback, type SaveSearchModel, type SearchMatch, type SearchRef, type SearchRefs, type SearchResultModel, type SearchesOfModel, type SectionModel, type SectionPresentation, type ShowWhen, type SignInAddress, type SignInPromptModel, type SignInStep, type SignInViewModel, type SortSpec, type Span, type StatusTone, type TabItemModel, type TabModel, type TenantOptions, type TimelineView, type TitleFromModel, type UndeletedOptions, type UpdatedOptions, type UserMenuItemModel, type UserMenuModel, type UserMenuSource, type Validator, type ViewBuilder, type ViewModel, type ViewProps, accessWarnings, addressWords, anonymousRole, appPath, argumentsSchema, bottomBar, bottomBarErrors, checkFilter, checkOrderBy, checkRecord, connectParams, connectPath, connectRoute, createWhere, defineRoles, encrypted, enumLabel, evaluateFilter, f, fieldRef, fieldsUsedBy, fitsKeyType, formPath, formRoute, imageFormats, isRecordCondition, keyTypes, layout as l, maxBottomBarItems, parseFilter, parseOrderBy, pickView, printFilter, printOrderBy, readAppPath, readConnectAddress, readFormAddress, readSignInAddress, resolveAccess, resource, restrictModel, rule, signInParams, signInPath, signInRoute, signInSteps, userMenu, view, where };
50
+ export { type Access, type AccessAction, type AccessContext, type AccessFn, type AccessResult, type AccessSource, type AccessUser, type ActionInputKind, type ActionInputModel, type ActionModel, type ActionRun, type AnyField, type AppAddress, type ArgumentSpec, type ArgumentType, type ArgumentsSpec, type AssistantAction, type AssistantActionRequest, type AssistantCardPart, type AssistantDiff, type AssistantEvent, type AssistantMessage, type AssistantMessageRequest, type AssistantPart, type AssistantState, type AssistantStep, type AssistantStepState, type AssistantTablePart, type AssistantTextPart, type AssistantTone, type AssistantWidgetPart, type BadgeShape, type BottomBarItemModel, type BottomBarModel, type BottomBarNames, type BottomBarSource, type CalendarView, type Capability, type CapabilityAction, type CapabilityLimit, type CapabilityScope, type CardFavoriteModel, type CardPhotosModel, type ChartGranularity, type ChartInput, type ChartModel, type ChartRange, type CheckResult, type CheckedFilter, type CommentsSectionModel, type CompareOp, type ComponentRef, type ComputedReveal, type ConnectAddress, type Constraint, type CreateModel, type CreatedOptions, type CustomSectionModel, type DatePreset, type DeletedOptions, type DurationLiteral, type DurationUnit, type Encrypted, type EvaluateOptions, type EventActor, type EventContext, type EventHelpers, type EventMatch, type EventModel, type EventOperation, type EventSpec, type ExactCapability, type ExportModel, type Field, type FieldAccess, type FieldFormat, type FieldMeta, type FieldModel, type FieldPath, type FieldRefValue, type FieldRefs, type FieldRule, type FieldType, type FieldTypeDef, type FieldView, type FieldViewModel, type FieldViews, type FieldWidgetModel, type FieldsInput, type FileField, type FileFieldModel, type FileOptions, type FileProcessor, type FileProcessorInput, type FilterError, type FilterErrorCode, type FilterExpr, type FilterLayout, type FilterLimits, type FilterOf, type FilterParse, type FilterValue, type FilterWidgetModel, type FormAddress, type FormInput, type FormModel, type GalleryModel, type Grant, type GroupChartInput, type GroupChartModel, type GroupItemModel, type GroupModel, type HeldCapability, type HelpWhen, type HistorySectionModel, type ImageFormat, type ImageVariant, type ImageVariantOptions, type InferRecord, type Issue, type JsonValue, type KeyOf, type KeyRefs, type KeyType, type KeyValue, type LayoutItemModel, type ListColumn, type ListDisplayModel, type ListDragModel, type ListModel, type ListQuery, type Literal, type MapSectionModel, type MapView, type NamedListModel, type NavModel, type NavRecentModel, type NowValue, type OrderByCheck, type OrderByItem, type OrderByParse, type ParentAccess, type ParentModel, type PeriodChartInput, type PeriodChartModel, type PositionAfterModel, type RecordChartModel, type RecordChartRange, type RecordKey, type RecordMode, type RecordOf, type RecordPageModel, type RecordWhen, type Ref, type Refs, type RelatedColumnModel, type RelatedModel, type RelatedPresentation, type RelationField, type ResolveOptions, type ResolvedAccess, type ResourceBuilder, type ResourceModel, type RevealCaller, type RoleEntry, type RoleLimit, type Roles, type RolesOptions, type Rollup, type RollupCount, type RollupFn, type RollupSource, type RollupValue, type RowFilterOperation, type Rule, type SaveFeedback, type SaveSearchModel, type SearchMatch, type SearchRef, type SearchRefs, type SearchResultModel, type SearchesOfModel, type SectionModel, type SectionPresentation, type ShowWhen, type SignInAddress, type SignInPromptModel, type SignInStep, type SignInViewModel, type SortSpec, type Span, type StatusTone, type TabItemModel, type TabModel, type TenantOptions, type TimelineView, type TitleFromModel, type UndeletedOptions, type UpdatedOptions, type UserMenuItemModel, type UserMenuModel, type UserMenuSource, type Validator, type ViewBuilder, type ViewModel, type ViewProps, accessWarnings, addressWords, anonymousRole, appPath, argumentsSchema, bottomBar, bottomBarErrors, checkFilter, checkOrderBy, checkRecord, connectParams, connectPath, connectRoute, createWhere, defineRoles, encrypted, enumLabel, evaluateFilter, f, fieldRef, fieldsUsedBy, fitsKeyType, formPath, formRoute, imageFormats, isRecordCondition, keyTypes, layout as l, maxBottomBarItems, parseFilter, parseOrderBy, pickView, printFilter, printOrderBy, readAppPath, readConnectAddress, readFormAddress, readSignInAddress, resolveAccess, resource, restrictModel, rule, signInParams, signInPath, signInRoute, signInSteps, userMenu, view, where };
package/dist/model.d.ts CHANGED
@@ -275,6 +275,11 @@ export type AppAddress = {
275
275
  open?: readonly string[];
276
276
  /** The title of the record page's tab shown; the first tab when omitted. */
277
277
  tab?: string;
278
+ /**
279
+ * The record's standard page, with its form, related records, Edit and Delete, on a view whose record page is a
280
+ * component of the app's own (`.record({ component })`). A view without one ignores it.
281
+ */
282
+ standard?: boolean;
278
283
  } | {
279
284
  /** The form for a new record. */
280
285
  kind: 'create';
@@ -1312,6 +1317,8 @@ export type ViewModel = {
1312
1317
  export?: false | ExportModel;
1313
1318
  /** The page that creates the resource's records, in place of the create form. */
1314
1319
  create?: CreateModel;
1320
+ /** The component of the app's own that is the whole record page, in place of the standard one. */
1321
+ record?: RecordPageModel;
1315
1322
  /** Public forms that create its records for people without an account, each at `/-/forms/<name>`. */
1316
1323
  forms?: FormModel[];
1317
1324
  /** Other lists of the resource, each with its own sidebar entry and address. */
@@ -1364,6 +1371,11 @@ export type CreateModel = {
1364
1371
  /** The composed page shown at `/<resource>/new`, which the list's New button opens. */
1365
1372
  page: string;
1366
1373
  };
1374
+ /** The record page as a component of the app's own (`.record(...)`), filling the content area. */
1375
+ export type RecordPageModel = {
1376
+ /** The component, by the name `protobase.ui.tsx` exports it under. */
1377
+ component: string;
1378
+ };
1367
1379
  /** The list page's Export (`.export(...)`): how many rows a file may hold. */
1368
1380
  export type ExportModel = {
1369
1381
  /** The most rows one file holds; the rows after them are left out, and the export says so. */
package/dist/view.d.ts CHANGED
@@ -4,7 +4,7 @@ import { actions } from "./view-actions.js";
4
4
  import { ChartInput } from "./view-chart.js";
5
5
  import { FormInput } from "./view-form.js";
6
6
  import { ListColumn, columns } from "./view-columns.js";
7
- import { displays } from "./view-displays.js";
7
+ import { ComponentRef, displays } from "./view-displays.js";
8
8
  import { FieldView } from "./view-field.js";
9
9
  import { widgets } from "./view-widgets.js";
10
10
  //#region src/view.d.ts
@@ -193,6 +193,17 @@ export declare class ViewBuilder<R extends {
193
193
  * [Create pages](website/src/content/docs/reference/ui-config.mdx#create-pages).
194
194
  */
195
195
  create(options: CreateModel): ViewBuilder<R>;
196
+ /**
197
+ * The record page at `/<resource>/<key>` is `component`, a component of the app's own declared with `component(...)`
198
+ * and exported from `protobase.ui.tsx`, filling the content area beside the sidebar and under the top bar, where the
199
+ * page does not scroll. It reads the record with `useLayoutRecord()`. The standard record page stays at the record's
200
+ * address with `standard: true`, which the component links to; it shows instead while the component is missing or
201
+ * when it throws. Throws when `component` is a built-in block. See
202
+ * [Full-area record pages](website/src/content/docs/reference/ui-config.mdx#full-area-record-pages).
203
+ */
204
+ record(options: {
205
+ component: ComponentRef<never>;
206
+ }): ViewBuilder<R>;
196
207
  /**
197
208
  * This resource holds saved searches of `resource`, which a list page saves with `.saveSearch(...)`: its list page
198
209
  * shows each of the user's searches with its filters, its `controls` to change in place, the records it finds (with
package/dist/view.js CHANGED
@@ -8,7 +8,7 @@ import { actions } from "./view-actions.js";
8
8
  import { chartModel } from "./view-chart.js";
9
9
  import { formModel } from "./view-form.js";
10
10
  import { columns, isListColumn } from "./view-columns.js";
11
- import { boardErrors, datesErrors, displayErrors, displayFields, displays } from "./view-displays.js";
11
+ import { boardErrors, customComponent, datesErrors, displayErrors, displayFields, displays } from "./view-displays.js";
12
12
  import { FieldView } from "./view-field.js";
13
13
  import { widgets } from "./view-widgets.js";
14
14
  //#region src/view.ts
@@ -280,6 +280,18 @@ var ViewBuilder = class ViewBuilder {
280
280
  return this.next({ create: { ...options } });
281
281
  }
282
282
  /**
283
+ * The record page at `/<resource>/<key>` is `component`, a component of the app's own declared with `component(...)`
284
+ * and exported from `protobase.ui.tsx`, filling the content area beside the sidebar and under the top bar, where the
285
+ * page does not scroll. It reads the record with `useLayoutRecord()`. The standard record page stays at the record's
286
+ * address with `standard: true`, which the component links to; it shows instead while the component is missing or
287
+ * when it throws. Throws when `component` is a built-in block. See
288
+ * [Full-area record pages](website/src/content/docs/reference/ui-config.mdx#full-area-record-pages).
289
+ */
290
+ record(options) {
291
+ const record = { component: customComponent(options.component, "record component") };
292
+ return this.next({ record });
293
+ }
294
+ /**
283
295
  * This resource holds saved searches of `resource`, which a list page saves with `.saveSearch(...)`: its list page
284
296
  * shows each of the user's searches with its filters, its `controls` to change in place, the records it finds (with
285
297
  * `unseen`, newest first, those new since the user last opened its results marked) and a link to all of them. Throws in
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@protobase/schema",
3
- "version": "0.55.5",
3
+ "version": "0.55.7",
4
4
  "description": "Resource, field, view and access definitions for Protobase configs.",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {