@xnetjs/react 0.3.0 → 0.5.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/dist/index.d.ts CHANGED
@@ -3,7 +3,7 @@ export { i as FlattenNodeOptions, M as MigrationWarning, c as QueryListResult, d
3
3
  export { ErrorBoundary, ErrorBoundaryProps, InfiniteQueryFilter, InfiniteQueryPage, InfiniteQueryResult, MutateCreate, MutateDelete, MutateOp, MutateRestore, MutateUpdate, OfflineIndicator, OfflineIndicatorProps, PresenceUser, SyncStatus, UseIdentityResult, UseMutateResult, UseNodeOptions, UseNodeResult, useIdentity, useInfiniteQuery, useIsOffline, useMutate, useNode } from './core.js';
4
4
  import { U as UseTaskProjectionSyncResult, T as TaskProjectionInput, a as TaskTreeItem } from './experimental-B2FrBnkV.js';
5
5
  export { A as AddCommentOptions, a0 as AddReactionOptions, bm as AuthErrorScreen, aP as AuthTraceSummary, bl as AuthenticatingScreen, r as CommentNode, C as CommentThread, F as CommentVisibility, ad as CreateMessageRequestOptions, b7 as DemoBanner, b8 as DemoBannerProps, bb as DemoDataExpiredScreen, be as DemoLimits, bd as DemoModeState, b9 as DemoQuotaIndicator, ba as DemoQuotaIndicatorProps, bf as DemoUsage, b2 as DiscoveredPeer, aU as FileRef, ae as FirstContactAdmission, af as FirstContactDecision, ag as FirstContactDecisionInput, G as FirstContactMode, ah as FirstContactVisibility, aK as GrantConsentSummary, aL as GrantInput, bp as HubConnectScreen, aX as HubSearchOptions, aY as HubSearchResult, aZ as HubSearchState, b3 as HubStatusIndicator, bo as ImportIdentityScreen, I as InteractionPermission, ai as MessageRequestNode, aj as MessageRequestProperties, ak as MessageRequestStatus, M as ModeratedCommentNode, H as ModeratedCommentThread, J as ModerationFilterOptions, K as ModerationLabelSummary, bA as OnboardingContextValue, bD as OnboardingEvent, bj as OnboardingFlow, bB as OnboardingFlowProps, bE as OnboardingMachineContext, bh as OnboardingProvider, bz as OnboardingProviderProps, bF as OnboardingReducerState, bC as OnboardingState, P as PageTaskInput, e as PageTaskReferenceInput, bI as PageTasksPanel, bJ as PageTasksPanelProps, bW as PluginRegistryContext, L as PublicInteractionMode, N as PublicInteractionPolicySnapshot, O as PublicInteractionSurface, Q as PublicModerationMode, bv as QUICK_START_TEMPLATES, bG as QuickStartTemplate, a1 as ReactionCounterSnapshot, a2 as ReactionNode, a3 as ReactionType, bq as ReadyScreen, a$ as RemoteSchemaDefinition, b0 as RemoteSchemaState, R as ReplyContext, bQ as SecurityContextActions, bP as SecurityContextState, bR as SecurityContextValue, bM as SecurityProvider, bS as SecurityProviderProps, b4 as Skeleton, b6 as SkeletonProps, br as SmartWelcome, bs as SyncProgressOverlay, bH as SyncProgressOverlayProps, bK as TaskCollectionEmbed, bL as TaskCollectionEmbedProps, j as TaskProjectionHost, i as TaskProjectionReferenceInput, bn as UnsupportedBrowserScreen, aw as UseAuditOptions, av as UseAuditResult, aQ as UseAuthTraceResult, aS as UseBackupReturn, aA as UseBlameResult, aH as UseCanEditResult, aF as UseCanResult, p as UseCommentsOptions, q as UseCommentsResult, ay as UseDiffResult, aV as UseFileUploadReturn, b as UseFindOptions, c as UseFindResult, aM as UseGrantsResult, aq as UseHistoryResult, al as UseMessageRequestsOptions, am as UseMessageRequestsResult, S as UseModeratedThreadOptions, f as UsePageTaskSyncOptions, g as UsePageTaskSyncResult, a4 as UsePolicyFilteredReactionCountersOptions, a5 as UsePolicyFilteredReactionCountersResult, bU as UseSecurityOptions, bV as UseSecurityResult, k as UseTaskProjectionSyncOptions, m as UseTasksOptions, n as UseTasksResult, at as UseUndoOptions, as as UseUndoResult, aC as UseVerificationResult, V as UseVisibleCommentsOptions, W as UseVisibleCommentsResult, bk as WelcomeScreen, by as copyToClipboard, a7 as createConversationKey, bu as createInitialState, a8 as createMessageRequestProperties, v as createModerationLabelIndex, Y as createReactionCounterSnapshot, Z as dedupeReactions, aI as describeGrantConsent, w as evaluateCommentModeration, a9 as evaluateFirstContactDecision, x as evaluateInteractionPermission, aa as findLatestMessageRequest, bw as getPlatformAuthName, ab as hasAcceptedContact, b5 as injectSkeletonStyles, _ as isReactionVisible, y as moderateThread, bt as onboardingReducer, z as selectActiveInteractionPolicy, B as selectPublicInteractionMode, aN as summarizeAuthTrace, ac as summarizeMessageRequest, D as summarizeModerationLabel, E as summarizePublicInteractionPolicy, $ as summarizeReactionNode, bx as truncateDid, au as useAudit, aO as useAuthTrace, aR as useBackup, az as useBlame, aE as useCan, aG as useCanEdit, c7 as useCommand, c0 as useCommands, an as useCommentCount, ao as useCommentCounts, o as useComments, b_ as useContributions, bc as useDemoMode, ax as useDiff, c4 as useEditorExtensions, c5 as useEditorExtensionsSafe, aT as useFileUpload, u as useFind, aJ as useGrants, ap as useHistory, aW as useHubSearch, aD as useHubStatus, c3 as useImporters, a6 as useMessageRequests, t as useModeratedThread, bi as useOnboarding, d as usePageTaskSync, b1 as usePeerDiscovery, bX as usePluginRegistry, bY as usePluginRegistryOptional, bZ as usePlugins, X as usePolicyFilteredReactionCounters, a_ as useRemoteSchema, bT as useSecurity, bN as useSecurityContext, bO as useSecurityContextOptional, c2 as useSidebarItems, c1 as useSlashCommands, bg as useSyncManager, h as useTaskProjectionSync, l as useTasks, ar as useUndo, aB as useVerification, c6 as useView, b$ as useViews, s as useVisibleComments } from './experimental-B2FrBnkV.js';
6
- import { SchemaIRI, Schema, SavedViewDescriptor, DefinedSchema, PropertyBuilder, QueryASTOrderBy, QueryASTPage, QueryASTValidationResult, QueryASTPlannerGate, QueryASTAggregateExecution, ExternalReferenceProvider, SavedViewFeedLayout, SavedViewFeedDensity, FieldType, FieldConfig, ViewType, FilterGroup, SortConfig, RowHeight, SummaryFunction, CellValue } from '@xnetjs/data';
6
+ import { SchemaIRI, Schema, SavedViewDescriptor, DefinedSchema, PropertyBuilder, QueryASTOrderBy, QueryASTPage, QueryASTValidationResult, QueryASTPlannerGate, QueryASTAggregateExecution, ExternalReferenceProvider, SavedViewFeedLayout, SavedViewFeedDensity, FieldType, FieldConfig, ViewType, FilterGroup, SortConfig, RowHeight, SummaryFunction, FormViewConfig, FormFieldRule, CellValue, FormSubmissionMeta } from '@xnetjs/data';
7
7
  export { ColumnConfig, ColumnDefinition, ColumnType, SavedViewFeedDensity, SavedViewFeedLayout, ViewConfig, ViewType } from '@xnetjs/data';
8
8
  import { QueryExecutionMode, QuerySourcePreference, QuerySearchFilter, QueryPageInfo, QueryMetadata } from '@xnetjs/data-bridge';
9
9
  import { LucideIcon } from 'lucide-react';
@@ -520,12 +520,22 @@ interface GridViewModel {
520
520
  rowHeight: RowHeight;
521
521
  columnSummaries: Record<string, SummaryFunction>;
522
522
  sortKey: string;
523
+ formConfig: FormViewConfig | null;
524
+ formRules: Record<string, FormFieldRule>;
525
+ formAccepting: boolean;
523
526
  }
524
527
  interface GridRowModel {
525
528
  id: string;
526
529
  sortKey: string;
527
530
  cells: Record<string, CellValue>;
528
531
  }
532
+ /** Options for `addRow` (exploration 0278: form submissions). */
533
+ interface AddRowOptions {
534
+ /** Explicit node id — deterministic ids make retried submissions upsert. */
535
+ id?: string;
536
+ /** Form-submission provenance stamped on the row. */
537
+ meta?: FormSubmissionMeta;
538
+ }
529
539
  interface UseGridDatabaseOptions {
530
540
  /** Active view ID (defaults to the first view) */
531
541
  viewId?: string;
@@ -556,7 +566,7 @@ interface UseGridDatabaseResult {
556
566
  rowId: string;
557
567
  fieldId: string;
558
568
  }>) => Promise<void>;
559
- addRow: (afterRowId?: string, cells?: Record<string, CellValue>) => Promise<string | null>;
569
+ addRow: (afterRowId?: string, cells?: Record<string, CellValue>, opts?: AddRowOptions) => Promise<string | null>;
560
570
  deleteRows: (rowIds: string[]) => Promise<void>;
561
571
  moveRowToIndex: (rowId: string, targetIndex: number) => Promise<void>;
562
572
  addField: (name: string, type: FieldType, config?: FieldConfig, opts?: {
@@ -576,6 +586,9 @@ interface UseGridDatabaseResult {
576
586
  setGroupBy: (fieldId: string | null) => Promise<void>;
577
587
  setRowHeight: (rowHeight: RowHeight) => Promise<void>;
578
588
  setColumnSummary: (fieldId: string, fn: SummaryFunction) => Promise<void>;
589
+ setFormConfig: (config: FormViewConfig) => Promise<void>;
590
+ setFormRules: (rules: Record<string, FormFieldRule>) => Promise<void>;
591
+ setFormAccepting: (accepting: boolean) => Promise<void>;
579
592
  addView: (name: string, type: ViewType) => Promise<string | null>;
580
593
  renameView: (viewId: string, name: string) => Promise<void>;
581
594
  removeView: (viewId: string) => Promise<void>;
@@ -680,4 +693,4 @@ declare function flattenTaskTree(items: TaskTreeItem[], depth?: number): Rendera
680
693
  declare function formatTaskDueDate(timestamp: number | undefined): string | null;
681
694
  declare function isTaskOverdue(timestamp: number | undefined, completed: boolean): boolean;
682
695
 
683
- export { type CanvasTaskInput, type CheckoutOptions, FlatNode, type GridFieldModel, type GridOptionModel, type GridRowModel, type GridViewModel, QueryFilter, type RenderableTaskRow, type SavedViewCanvasProjectionNode, type SavedViewDateBrushSelection, type SavedViewDateBucketFieldSummary, type SavedViewDateBucketInterval, type SavedViewDateBucketSummary, type SavedViewFacetSelection, type SavedViewFacetSummary, type SavedViewFacetValueSummary, type SavedViewFeedEnrichmentAdapter, type SavedViewFeedEnrichmentEntry, type SavedViewInspectorItem, type SavedViewInspectorItemKind, type SavedViewLensDraft, type SavedViewPresentationMode, type SavedViewPrivacyChip, type SavedViewPrivacyChipTone, type SavedViewPrivacySummary, type SavedViewQueryOverride, type SavedViewQueryResult, SavedViewResultTable, type SavedViewResultTableProps, type SavedViewRowInspectorModel, SavedViewRunner, type SavedViewRunnerProps, type SavedViewSchemaRegistry, type SavedViewSortDirection, type SavedViewVisualCanvasProjectionRequest, SavedViewVisualFeed, type SavedViewVisualLayoutId, type SavedViewVisualLayoutOption, type SavedViewVisualPreviewCreator, type SavedViewVisualPreviewKind, type SavedViewVisualPreviewModel, type SavedViewVisualPreviewPrivacy, type SavedViewVisualPreviewRelationship, type SavedViewVisualTimelineBucket, type SavedViewVisualWorkspaceLayout, TaskProjectionInput, TaskTreeItem, type UseBillingResult, type UseCanvasTaskSyncOptions, type UseCanvasTaskSyncResult, type UseEffectiveSchemaResult, type UseGlobalUndoResult, type UseGridDatabaseOptions, type UseGridDatabaseResult, type UseSavedViewOptions, type UseSavedViewResult, UseTaskProjectionSyncResult, createSavedViewCanvasProjectionNodes, createSavedViewLensDraft, createSavedViewVisualCanvasProjectionRequest, createSavedViewVisualPreviewFingerprint, deriveCachedSavedViewVisualPreviews, deriveSavedViewColumns, deriveSavedViewDateBucketSummaries, deriveSavedViewFacetSummaries, deriveSavedViewPrivacyChips, deriveSavedViewRowInspector, deriveSavedViewTimelineBuckets, deriveSavedViewVisualPreview, deriveSavedViewVisualPreviews, filterSavedViewRowsByDateBrush, filterSavedViewRowsByFacets, flattenTaskTree, formatSavedViewCellValue, formatTaskDueDate, getSavedViewSensitiveResultWarning, hasSavedViewVisualPreviewSensitiveData, isSavedViewVisualPreviewEmbeddable, isTaskOverdue, mergeSavedViewFeedEnrichment, savedViewVisualPreviewIsSelfActor, useBilling, useCanvasTaskSync, useEffectiveSchema, useGlobalUndo, useGridDatabase, useSavedView };
696
+ export { type AddRowOptions, type CanvasTaskInput, type CheckoutOptions, FlatNode, type GridFieldModel, type GridOptionModel, type GridRowModel, type GridViewModel, QueryFilter, type RenderableTaskRow, type SavedViewCanvasProjectionNode, type SavedViewDateBrushSelection, type SavedViewDateBucketFieldSummary, type SavedViewDateBucketInterval, type SavedViewDateBucketSummary, type SavedViewFacetSelection, type SavedViewFacetSummary, type SavedViewFacetValueSummary, type SavedViewFeedEnrichmentAdapter, type SavedViewFeedEnrichmentEntry, type SavedViewInspectorItem, type SavedViewInspectorItemKind, type SavedViewLensDraft, type SavedViewPresentationMode, type SavedViewPrivacyChip, type SavedViewPrivacyChipTone, type SavedViewPrivacySummary, type SavedViewQueryOverride, type SavedViewQueryResult, SavedViewResultTable, type SavedViewResultTableProps, type SavedViewRowInspectorModel, SavedViewRunner, type SavedViewRunnerProps, type SavedViewSchemaRegistry, type SavedViewSortDirection, type SavedViewVisualCanvasProjectionRequest, SavedViewVisualFeed, type SavedViewVisualLayoutId, type SavedViewVisualLayoutOption, type SavedViewVisualPreviewCreator, type SavedViewVisualPreviewKind, type SavedViewVisualPreviewModel, type SavedViewVisualPreviewPrivacy, type SavedViewVisualPreviewRelationship, type SavedViewVisualTimelineBucket, type SavedViewVisualWorkspaceLayout, TaskProjectionInput, TaskTreeItem, type UseBillingResult, type UseCanvasTaskSyncOptions, type UseCanvasTaskSyncResult, type UseEffectiveSchemaResult, type UseGlobalUndoResult, type UseGridDatabaseOptions, type UseGridDatabaseResult, type UseSavedViewOptions, type UseSavedViewResult, UseTaskProjectionSyncResult, createSavedViewCanvasProjectionNodes, createSavedViewLensDraft, createSavedViewVisualCanvasProjectionRequest, createSavedViewVisualPreviewFingerprint, deriveCachedSavedViewVisualPreviews, deriveSavedViewColumns, deriveSavedViewDateBucketSummaries, deriveSavedViewFacetSummaries, deriveSavedViewPrivacyChips, deriveSavedViewRowInspector, deriveSavedViewTimelineBuckets, deriveSavedViewVisualPreview, deriveSavedViewVisualPreviews, filterSavedViewRowsByDateBrush, filterSavedViewRowsByFacets, flattenTaskTree, formatSavedViewCellValue, formatTaskDueDate, getSavedViewSensitiveResultWarning, hasSavedViewVisualPreviewSensitiveData, isSavedViewVisualPreviewEmbeddable, isTaskOverdue, mergeSavedViewFeedEnrichment, savedViewVisualPreviewIsSelfActor, useBilling, useCanvasTaskSync, useEffectiveSchema, useGlobalUndo, useGridDatabase, useSavedView };
package/dist/index.js CHANGED
@@ -4264,7 +4264,10 @@ function toViewModel(node) {
4264
4264
  hiddenFields: node.hiddenFields ?? [],
4265
4265
  rowHeight: asRowHeight(node.rowHeight),
4266
4266
  columnSummaries: node.columnSummaries ?? {},
4267
- sortKey: node.sortKey ?? ""
4267
+ sortKey: node.sortKey ?? "",
4268
+ formConfig: node.formConfig ?? null,
4269
+ formRules: node.formRules ?? {},
4270
+ formAccepting: node.formAccepting ?? true
4268
4271
  };
4269
4272
  }
4270
4273
  function fieldsToColumnDefinitions(fields) {
@@ -4533,7 +4536,7 @@ function useGridDatabase(databaseId, options = {}) {
4533
4536
  [updateRowProps]
4534
4537
  );
4535
4538
  const addRow = useCallback2(
4536
- async (afterRowId, cells) => {
4539
+ async (afterRowId, cells, opts) => {
4537
4540
  let sortKey;
4538
4541
  if (afterRowId) {
4539
4542
  const bySortKey = [...rows].sort((a, b) => compareSortKeys(a.sortKey, b.sortKey));
@@ -4553,11 +4556,16 @@ function useGridDatabase(databaseId, options = {}) {
4553
4556
  for (const [fieldId, value] of Object.entries(cells ?? {})) {
4554
4557
  cellProps[cellKey(fieldId)] = value;
4555
4558
  }
4556
- const node = await mutate.create(DatabaseRowSchema, {
4557
- database: databaseId,
4558
- sortKey,
4559
- ...cellProps
4560
- });
4559
+ const node = await mutate.create(
4560
+ DatabaseRowSchema,
4561
+ {
4562
+ database: databaseId,
4563
+ sortKey,
4564
+ ...opts?.meta ? { submissionMeta: opts.meta } : {},
4565
+ ...cellProps
4566
+ },
4567
+ opts?.id
4568
+ );
4561
4569
  return node?.id ?? null;
4562
4570
  },
4563
4571
  [mutate, databaseId, rows, nextAppendKey]
@@ -4750,6 +4758,27 @@ function useGridDatabase(databaseId, options = {}) {
4750
4758
  },
4751
4759
  [mutate, activeView]
4752
4760
  );
4761
+ const setFormConfig = useCallback2(
4762
+ async (config) => {
4763
+ if (!activeView) return;
4764
+ await mutate.update(DatabaseViewSchema, activeView.id, { formConfig: config });
4765
+ },
4766
+ [mutate, activeView]
4767
+ );
4768
+ const setFormRules = useCallback2(
4769
+ async (rules) => {
4770
+ if (!activeView) return;
4771
+ await mutate.update(DatabaseViewSchema, activeView.id, { formRules: rules });
4772
+ },
4773
+ [mutate, activeView]
4774
+ );
4775
+ const setFormAccepting = useCallback2(
4776
+ async (accepting) => {
4777
+ if (!activeView) return;
4778
+ await mutate.update(DatabaseViewSchema, activeView.id, { formAccepting: accepting });
4779
+ },
4780
+ [mutate, activeView]
4781
+ );
4753
4782
  const addView = useCallback2(
4754
4783
  async (name, type) => {
4755
4784
  const node = await mutate.create(DatabaseViewSchema, {
@@ -4801,6 +4830,9 @@ function useGridDatabase(databaseId, options = {}) {
4801
4830
  setGroupBy,
4802
4831
  setRowHeight,
4803
4832
  setColumnSummary,
4833
+ setFormConfig,
4834
+ setFormRules,
4835
+ setFormAccepting,
4804
4836
  addView,
4805
4837
  renameView,
4806
4838
  removeView,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xnetjs/react",
3
- "version": "0.3.0",
3
+ "version": "0.5.0",
4
4
  "license": "MIT",
5
5
  "repository": {
6
6
  "type": "git",
@@ -46,15 +46,15 @@
46
46
  "y-protocols": "^1.0.6",
47
47
  "yjs": "^13.6.24",
48
48
  "@xnetjs/billing": "0.0.2",
49
- "@xnetjs/core": "0.3.0",
50
- "@xnetjs/crypto": "0.3.0",
51
- "@xnetjs/data": "0.3.0",
52
- "@xnetjs/data-bridge": "0.3.0",
53
- "@xnetjs/history": "0.3.0",
54
- "@xnetjs/identity": "0.3.0",
55
- "@xnetjs/plugins": "0.3.0",
56
- "@xnetjs/runtime": "0.1.4",
57
- "@xnetjs/sync": "0.3.0"
49
+ "@xnetjs/core": "0.5.0",
50
+ "@xnetjs/crypto": "0.5.0",
51
+ "@xnetjs/data": "0.5.0",
52
+ "@xnetjs/data-bridge": "0.5.0",
53
+ "@xnetjs/history": "0.5.0",
54
+ "@xnetjs/identity": "0.5.0",
55
+ "@xnetjs/plugins": "0.5.0",
56
+ "@xnetjs/runtime": "0.1.6",
57
+ "@xnetjs/sync": "0.5.0"
58
58
  },
59
59
  "peerDependencies": {
60
60
  "react": "^18.0.0 || ^19.0.0"