@object-ui/types 0.5.0 → 2.0.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 +1 -1
- package/dist/ai.d.ts +376 -0
- package/dist/ai.d.ts.map +1 -0
- package/dist/ai.js +8 -0
- package/dist/app.d.ts +2 -2
- package/dist/crud.d.ts +3 -0
- package/dist/crud.d.ts.map +1 -1
- package/dist/data-display.d.ts +35 -0
- package/dist/data-display.d.ts.map +1 -1
- package/dist/data-protocol.d.ts +19 -19
- package/dist/data.d.ts +68 -0
- package/dist/data.d.ts.map +1 -1
- package/dist/designer.d.ts +473 -0
- package/dist/designer.d.ts.map +1 -0
- package/dist/designer.js +8 -0
- package/dist/form.d.ts +35 -1
- package/dist/form.d.ts.map +1 -1
- package/dist/index.d.ts +35 -8
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +18 -0
- package/dist/layout.d.ts +63 -8
- package/dist/layout.d.ts.map +1 -1
- package/dist/mobile.d.ts +186 -0
- package/dist/mobile.d.ts.map +1 -0
- package/dist/mobile.js +8 -0
- package/dist/objectql.d.ts +329 -88
- package/dist/objectql.d.ts.map +1 -1
- package/dist/permissions.d.ts +150 -0
- package/dist/permissions.d.ts.map +1 -0
- package/dist/permissions.js +8 -0
- package/dist/tenant.d.ts +138 -0
- package/dist/tenant.d.ts.map +1 -0
- package/dist/tenant.js +8 -0
- package/dist/theme.d.ts +115 -224
- package/dist/theme.d.ts.map +1 -1
- package/dist/ui-action.d.ts +126 -11
- package/dist/ui-action.d.ts.map +1 -1
- package/dist/views.d.ts +10 -0
- package/dist/views.d.ts.map +1 -1
- package/dist/widget.d.ts +181 -0
- package/dist/widget.d.ts.map +1 -0
- package/dist/widget.js +8 -0
- package/dist/workflow.d.ts +340 -0
- package/dist/workflow.d.ts.map +1 -0
- package/dist/workflow.js +8 -0
- package/dist/zod/complex.zod.d.ts +4 -4
- package/dist/zod/crud.zod.d.ts +5 -5
- package/dist/zod/feedback.zod.d.ts +10 -10
- package/dist/zod/form.zod.d.ts +4 -4
- package/dist/zod/index.zod.d.ts +323 -132
- package/dist/zod/index.zod.d.ts.map +1 -1
- package/dist/zod/index.zod.js +4 -4
- package/dist/zod/layout.zod.d.ts +132 -0
- package/dist/zod/layout.zod.d.ts.map +1 -1
- package/dist/zod/layout.zod.js +34 -0
- package/dist/zod/objectql.zod.d.ts +32 -16
- package/dist/zod/objectql.zod.d.ts.map +1 -1
- package/dist/zod/objectql.zod.js +8 -0
- package/dist/zod/reports.zod.d.ts +17 -17
- package/dist/zod/theme.zod.d.ts +947 -266
- package/dist/zod/theme.zod.d.ts.map +1 -1
- package/dist/zod/theme.zod.js +175 -45
- package/dist/zod/views.zod.d.ts +20 -20
- package/package.json +3 -2
- package/src/__tests__/namespace-exports.test.ts +24 -68
- package/src/__tests__/phase2-schemas.test.ts +8 -13
- package/src/ai.ts +454 -0
- package/src/app.ts +2 -2
- package/src/crud.ts +3 -0
- package/src/data-display.ts +31 -0
- package/src/data-protocol.ts +19 -19
- package/src/data.ts +81 -0
- package/src/designer.ts +509 -0
- package/src/form.ts +35 -1
- package/src/index.ts +220 -8
- package/src/layout.ts +66 -8
- package/src/mobile.ts +205 -0
- package/src/objectql.ts +403 -93
- package/src/permissions.ts +166 -0
- package/src/tenant.ts +153 -0
- package/src/theme.ts +147 -260
- package/src/ui-action.ts +166 -27
- package/src/views.ts +7 -0
- package/src/widget.ts +197 -0
- package/src/workflow.ts +409 -0
- package/src/zod/index.zod.ts +14 -3
- package/src/zod/layout.zod.ts +38 -0
- package/src/zod/objectql.zod.ts +8 -0
- package/src/zod/theme.zod.ts +189 -48
package/src/index.ts
CHANGED
|
@@ -94,6 +94,10 @@ export type {
|
|
|
94
94
|
AspectRatioSchema,
|
|
95
95
|
LayoutSchema,
|
|
96
96
|
PageSchema,
|
|
97
|
+
PageType,
|
|
98
|
+
PageRegion,
|
|
99
|
+
PageRegionWidth,
|
|
100
|
+
PageVariable,
|
|
97
101
|
} from './layout';
|
|
98
102
|
|
|
99
103
|
// ============================================================================
|
|
@@ -249,6 +253,7 @@ export type {
|
|
|
249
253
|
DataBinding,
|
|
250
254
|
ValidationError,
|
|
251
255
|
APIError,
|
|
256
|
+
FileUploadResult,
|
|
252
257
|
} from './data';
|
|
253
258
|
|
|
254
259
|
// ============================================================================
|
|
@@ -290,7 +295,10 @@ export type {
|
|
|
290
295
|
ListViewSchema,
|
|
291
296
|
ObjectGridSchema,
|
|
292
297
|
ObjectFormSchema,
|
|
298
|
+
ObjectFormSection,
|
|
293
299
|
ObjectViewSchema,
|
|
300
|
+
NamedListView,
|
|
301
|
+
ViewNavigationConfig,
|
|
294
302
|
ObjectQLComponentSchema,
|
|
295
303
|
} from './objectql';
|
|
296
304
|
|
|
@@ -402,7 +410,7 @@ export type {
|
|
|
402
410
|
ValidationContext,
|
|
403
411
|
AdvancedValidationResult,
|
|
404
412
|
AdvancedValidationError,
|
|
405
|
-
// ObjectStack Spec
|
|
413
|
+
// ObjectStack Spec v2.0.1 Validation
|
|
406
414
|
BaseValidation,
|
|
407
415
|
ScriptValidation,
|
|
408
416
|
UniquenessValidation,
|
|
@@ -432,6 +440,89 @@ export type {
|
|
|
432
440
|
DatasourceMetrics,
|
|
433
441
|
} from './data-protocol';
|
|
434
442
|
|
|
443
|
+
// ============================================================================
|
|
444
|
+
// Permission & RBAC Types (Q2 2026)
|
|
445
|
+
// ============================================================================
|
|
446
|
+
export type {
|
|
447
|
+
PermissionAction,
|
|
448
|
+
PermissionEffect,
|
|
449
|
+
RoleDefinition,
|
|
450
|
+
ObjectLevelPermission,
|
|
451
|
+
FieldLevelPermission,
|
|
452
|
+
RowLevelPermission,
|
|
453
|
+
PermissionCondition,
|
|
454
|
+
ObjectPermissionConfig,
|
|
455
|
+
SharingRuleConfig,
|
|
456
|
+
PermissionCheckResult,
|
|
457
|
+
PermissionContext,
|
|
458
|
+
PermissionGuardConfig,
|
|
459
|
+
} from './permissions';
|
|
460
|
+
|
|
461
|
+
// ============================================================================
|
|
462
|
+
// Multi-Tenancy Types (Q2 2026)
|
|
463
|
+
// ============================================================================
|
|
464
|
+
export type {
|
|
465
|
+
TenantIsolationStrategy,
|
|
466
|
+
TenantStatus,
|
|
467
|
+
TenantPlan,
|
|
468
|
+
TenantConfig,
|
|
469
|
+
TenantBranding,
|
|
470
|
+
TenantLimits,
|
|
471
|
+
TenantContext,
|
|
472
|
+
TenantResolutionStrategy,
|
|
473
|
+
TenantProviderConfig,
|
|
474
|
+
TenantScopedQueryConfig,
|
|
475
|
+
} from './tenant';
|
|
476
|
+
|
|
477
|
+
// ============================================================================
|
|
478
|
+
// Mobile Optimization Types (Q2 2026)
|
|
479
|
+
// ============================================================================
|
|
480
|
+
export type {
|
|
481
|
+
BreakpointName,
|
|
482
|
+
ResponsiveValue,
|
|
483
|
+
ResponsiveConfig,
|
|
484
|
+
MobileOverrides,
|
|
485
|
+
PWAConfig,
|
|
486
|
+
PWAIcon,
|
|
487
|
+
CacheStrategy,
|
|
488
|
+
OfflineConfig,
|
|
489
|
+
OfflineRoute,
|
|
490
|
+
GestureType,
|
|
491
|
+
GestureConfig,
|
|
492
|
+
GestureContext,
|
|
493
|
+
MobileComponentConfig,
|
|
494
|
+
} from './mobile';
|
|
495
|
+
|
|
496
|
+
// ============================================================================
|
|
497
|
+
// Visual Designer Types (Q2 2026)
|
|
498
|
+
// ============================================================================
|
|
499
|
+
export type {
|
|
500
|
+
DesignerPosition,
|
|
501
|
+
DesignerCanvasConfig,
|
|
502
|
+
DesignerComponent,
|
|
503
|
+
PageDesignerSchema,
|
|
504
|
+
DesignerPaletteCategory,
|
|
505
|
+
DesignerPaletteItem,
|
|
506
|
+
DataModelEntity,
|
|
507
|
+
DataModelField,
|
|
508
|
+
DataModelRelationship,
|
|
509
|
+
DataModelDesignerSchema,
|
|
510
|
+
BPMNNodeType,
|
|
511
|
+
BPMNNode,
|
|
512
|
+
BPMNEdge,
|
|
513
|
+
BPMNLane,
|
|
514
|
+
ProcessDesignerSchema,
|
|
515
|
+
ReportSectionType,
|
|
516
|
+
ReportDesignerElement,
|
|
517
|
+
ReportDesignerSection,
|
|
518
|
+
ReportDesignerSchema,
|
|
519
|
+
CollaborationPresence,
|
|
520
|
+
CollaborationOperation,
|
|
521
|
+
CollaborationConfig,
|
|
522
|
+
ViewDesignerColumn,
|
|
523
|
+
ViewDesignerSchema,
|
|
524
|
+
} from './designer';
|
|
525
|
+
|
|
435
526
|
// ============================================================================
|
|
436
527
|
// API and Events - API Integration and Event Handling
|
|
437
528
|
// ============================================================================
|
|
@@ -469,16 +560,24 @@ import type { AppSchema } from './app';
|
|
|
469
560
|
// Phase 2 Schemas - New Additions
|
|
470
561
|
// ============================================================================
|
|
471
562
|
export type {
|
|
472
|
-
// Theme System
|
|
563
|
+
// Theme System (aligned with @objectstack/spec)
|
|
564
|
+
Theme,
|
|
473
565
|
ThemeSchema,
|
|
474
|
-
ThemeDefinition,
|
|
475
566
|
ThemeMode,
|
|
476
567
|
ColorPalette,
|
|
477
568
|
Typography,
|
|
478
|
-
|
|
569
|
+
Spacing,
|
|
479
570
|
BorderRadius,
|
|
571
|
+
Shadow,
|
|
572
|
+
Breakpoints,
|
|
573
|
+
Animation,
|
|
574
|
+
ZIndex,
|
|
575
|
+
ThemeLogo,
|
|
480
576
|
ThemeSwitcherSchema,
|
|
481
577
|
ThemePreviewSchema,
|
|
578
|
+
// Legacy aliases
|
|
579
|
+
ThemeDefinition,
|
|
580
|
+
SpacingScale,
|
|
482
581
|
} from './theme';
|
|
483
582
|
|
|
484
583
|
export type {
|
|
@@ -497,6 +596,37 @@ export type {
|
|
|
497
596
|
ReportViewerSchema,
|
|
498
597
|
} from './reports';
|
|
499
598
|
|
|
599
|
+
export type {
|
|
600
|
+
// Workflow System
|
|
601
|
+
WorkflowStatus,
|
|
602
|
+
WorkflowNodeType,
|
|
603
|
+
WorkflowEdgeType,
|
|
604
|
+
WorkflowNode,
|
|
605
|
+
WorkflowNodeAction,
|
|
606
|
+
WorkflowEdge,
|
|
607
|
+
ApprovalRule,
|
|
608
|
+
WorkflowVariable,
|
|
609
|
+
WorkflowSchema,
|
|
610
|
+
WorkflowDesignerSchema,
|
|
611
|
+
ApprovalHistoryItem,
|
|
612
|
+
ApprovalProcessSchema,
|
|
613
|
+
WorkflowInstanceSchema,
|
|
614
|
+
} from './workflow';
|
|
615
|
+
|
|
616
|
+
export type {
|
|
617
|
+
// AI System
|
|
618
|
+
AIProvider,
|
|
619
|
+
AIModelType,
|
|
620
|
+
AIConfig,
|
|
621
|
+
AIFieldSuggestion,
|
|
622
|
+
AIFormAssistSchema,
|
|
623
|
+
AIRecommendationItem,
|
|
624
|
+
AIRecommendationsSchema,
|
|
625
|
+
NLQueryResult,
|
|
626
|
+
NLQuerySchema,
|
|
627
|
+
AIInsightsSchema,
|
|
628
|
+
} from './ai';
|
|
629
|
+
|
|
500
630
|
export type {
|
|
501
631
|
// Block System
|
|
502
632
|
BlockSchema,
|
|
@@ -609,7 +739,7 @@ export type {
|
|
|
609
739
|
} from './plugin-scope';
|
|
610
740
|
|
|
611
741
|
// ============================================================================
|
|
612
|
-
// UI Actions - Enhanced Action Schema (ObjectStack Spec
|
|
742
|
+
// UI Actions - Enhanced Action Schema (ObjectStack Spec v2.0.1)
|
|
613
743
|
// ============================================================================
|
|
614
744
|
/**
|
|
615
745
|
* Enhanced action schema with location-based placement, parameter collection,
|
|
@@ -625,6 +755,14 @@ export type {
|
|
|
625
755
|
ActionContext,
|
|
626
756
|
ActionResult,
|
|
627
757
|
ActionExecutor,
|
|
758
|
+
BatchOperationConfig,
|
|
759
|
+
BatchOperationResult,
|
|
760
|
+
TransactionIsolationLevel,
|
|
761
|
+
TransactionConfig,
|
|
762
|
+
TransactionResult,
|
|
763
|
+
UndoRedoEntry,
|
|
764
|
+
UndoRedoConfig,
|
|
765
|
+
UndoRedoState,
|
|
628
766
|
} from './ui-action';
|
|
629
767
|
|
|
630
768
|
// ============================================================================
|
|
@@ -638,10 +776,84 @@ export type {
|
|
|
638
776
|
*
|
|
639
777
|
* @example
|
|
640
778
|
* ```typescript
|
|
641
|
-
* import { Data, UI, System, AI, API } from '@object-ui/types';
|
|
779
|
+
* import { Data, UI, System, AI, API, Kernel } from '@object-ui/types';
|
|
642
780
|
*
|
|
643
781
|
* const field: Data.Field = { name: 'task_name', type: 'text' };
|
|
644
|
-
* const
|
|
782
|
+
* const view: UI.ListView = { name: 'all', label: 'All Records', ... };
|
|
783
|
+
* ```
|
|
784
|
+
*/
|
|
785
|
+
export type {
|
|
786
|
+
Data,
|
|
787
|
+
UI,
|
|
788
|
+
System,
|
|
789
|
+
AI,
|
|
790
|
+
API,
|
|
791
|
+
Hub,
|
|
792
|
+
Automation,
|
|
793
|
+
Shared,
|
|
794
|
+
QA,
|
|
795
|
+
Kernel,
|
|
796
|
+
Contracts,
|
|
797
|
+
Integration,
|
|
798
|
+
Studio,
|
|
799
|
+
Identity,
|
|
800
|
+
Security,
|
|
801
|
+
} from '@objectstack/spec';
|
|
802
|
+
|
|
803
|
+
// ============================================================================
|
|
804
|
+
// ObjectStack Protocol Utilities - defineStack, definePlugin
|
|
805
|
+
// ============================================================================
|
|
806
|
+
/**
|
|
807
|
+
* Re-export ObjectStack Protocol utility functions and top-level types.
|
|
808
|
+
*
|
|
809
|
+
* @example
|
|
810
|
+
* ```typescript
|
|
811
|
+
* import { defineStack, definePlugin } from '@object-ui/types';
|
|
812
|
+
*
|
|
813
|
+
* export default defineStack({
|
|
814
|
+
* manifest: { id: 'com.example.app', version: '1.0.0', type: 'app', name: 'My App' },
|
|
815
|
+
* objects: [],
|
|
816
|
+
* apps: [],
|
|
817
|
+
* });
|
|
645
818
|
* ```
|
|
646
819
|
*/
|
|
647
|
-
export
|
|
820
|
+
export {
|
|
821
|
+
defineStack,
|
|
822
|
+
definePlugin,
|
|
823
|
+
ObjectStackSchema,
|
|
824
|
+
ObjectStackDefinitionSchema,
|
|
825
|
+
ObjectStackCapabilitiesSchema,
|
|
826
|
+
ObjectOSCapabilitiesSchema,
|
|
827
|
+
ObjectQLCapabilitiesSchema,
|
|
828
|
+
ObjectUICapabilitiesSchema,
|
|
829
|
+
} from '@objectstack/spec';
|
|
830
|
+
|
|
831
|
+
export type {
|
|
832
|
+
PluginContext,
|
|
833
|
+
ObjectStack,
|
|
834
|
+
ObjectStackDefinition,
|
|
835
|
+
ObjectStackCapabilities,
|
|
836
|
+
ObjectOSCapabilities,
|
|
837
|
+
ObjectQLCapabilities,
|
|
838
|
+
ObjectUICapabilities,
|
|
839
|
+
} from '@objectstack/spec';
|
|
840
|
+
|
|
841
|
+
// ============================================================================
|
|
842
|
+
// Widget System - Runtime Widget Registration (Section 1.6)
|
|
843
|
+
// ============================================================================
|
|
844
|
+
/**
|
|
845
|
+
* Widget manifest and registry types for runtime widget registration,
|
|
846
|
+
* plugin auto-discovery, and custom widget registry.
|
|
847
|
+
*/
|
|
848
|
+
export type {
|
|
849
|
+
WidgetManifest,
|
|
850
|
+
WidgetSource,
|
|
851
|
+
WidgetSourceModule,
|
|
852
|
+
WidgetSourceInline,
|
|
853
|
+
WidgetSourceRegistry,
|
|
854
|
+
WidgetInput,
|
|
855
|
+
WidgetCapabilities,
|
|
856
|
+
ResolvedWidget,
|
|
857
|
+
WidgetRegistryEvent,
|
|
858
|
+
WidgetRegistryListener,
|
|
859
|
+
} from './widget';
|
package/src/layout.ts
CHANGED
|
@@ -424,35 +424,64 @@ export interface AspectRatioSchema extends BaseSchema {
|
|
|
424
424
|
children?: SchemaNode | SchemaNode[];
|
|
425
425
|
}
|
|
426
426
|
|
|
427
|
+
/**
|
|
428
|
+
* Page Type
|
|
429
|
+
* Determines page behavior and default layout template.
|
|
430
|
+
* Aligned with @objectstack/spec Page.type
|
|
431
|
+
*/
|
|
432
|
+
export type PageType = 'record' | 'home' | 'app' | 'utility';
|
|
433
|
+
|
|
434
|
+
/**
|
|
435
|
+
* Page Variable
|
|
436
|
+
* Local page state that can be read/written by components and expressions.
|
|
437
|
+
* Aligned with @objectstack/spec PageVariableSchema
|
|
438
|
+
*/
|
|
439
|
+
export interface PageVariable {
|
|
440
|
+
/** Variable name */
|
|
441
|
+
name: string;
|
|
442
|
+
/** Variable type @default 'string' */
|
|
443
|
+
type?: 'string' | 'number' | 'boolean' | 'object' | 'array';
|
|
444
|
+
/** Default value for initialization */
|
|
445
|
+
defaultValue?: any;
|
|
446
|
+
}
|
|
447
|
+
|
|
448
|
+
/**
|
|
449
|
+
* Page Region Size
|
|
450
|
+
* Aligned with @objectstack/spec PageRegionSchema.width
|
|
451
|
+
*/
|
|
452
|
+
export type PageRegionWidth = 'small' | 'medium' | 'large' | 'full';
|
|
453
|
+
|
|
427
454
|
/**
|
|
428
455
|
* Page Region (Header, Sidebar, Main, etc)
|
|
456
|
+
* Aligned with @objectstack/spec PageRegionSchema
|
|
429
457
|
*/
|
|
430
458
|
export interface PageRegion {
|
|
431
459
|
/**
|
|
432
|
-
* Region name/id
|
|
460
|
+
* Region name/id (e.g. "sidebar", "main", "header")
|
|
433
461
|
*/
|
|
434
462
|
name: string;
|
|
435
463
|
/**
|
|
436
|
-
* Region type
|
|
464
|
+
* Region type — semantic role for layout rendering
|
|
437
465
|
*/
|
|
438
466
|
type?: 'header' | 'sidebar' | 'main' | 'footer' | 'aside';
|
|
439
467
|
/**
|
|
440
|
-
*
|
|
468
|
+
* Region width (spec-aligned enum)
|
|
441
469
|
*/
|
|
442
|
-
width?: string;
|
|
470
|
+
width?: PageRegionWidth | string;
|
|
443
471
|
/**
|
|
444
472
|
* Components in this region
|
|
445
473
|
*/
|
|
446
474
|
components: SchemaNode[];
|
|
447
475
|
/**
|
|
448
|
-
* CSS class
|
|
476
|
+
* CSS class overrides
|
|
449
477
|
*/
|
|
450
478
|
className?: string;
|
|
451
479
|
}
|
|
452
480
|
|
|
453
481
|
/**
|
|
454
482
|
* Page layout component
|
|
455
|
-
* Top-level container for a page route
|
|
483
|
+
* Top-level container for a page route.
|
|
484
|
+
* Aligned with @objectstack/spec PageSchema
|
|
456
485
|
*/
|
|
457
486
|
export interface PageSchema extends BaseSchema {
|
|
458
487
|
type: 'page';
|
|
@@ -461,13 +490,33 @@ export interface PageSchema extends BaseSchema {
|
|
|
461
490
|
*/
|
|
462
491
|
title?: string;
|
|
463
492
|
/**
|
|
464
|
-
|
|
465
|
-
|
|
493
|
+
* Page icon (Lucide icon name)
|
|
494
|
+
*/
|
|
466
495
|
icon?: string;
|
|
467
496
|
/**
|
|
468
497
|
* Page description
|
|
469
498
|
*/
|
|
470
499
|
description?: string;
|
|
500
|
+
/**
|
|
501
|
+
* Page type — determines default layout and behavior
|
|
502
|
+
* @default 'record'
|
|
503
|
+
*/
|
|
504
|
+
pageType?: PageType;
|
|
505
|
+
/**
|
|
506
|
+
* Bound object name (for record pages)
|
|
507
|
+
* Provides record context to components in regions
|
|
508
|
+
*/
|
|
509
|
+
object?: string;
|
|
510
|
+
/**
|
|
511
|
+
* Layout template name (e.g. "default", "header-sidebar-main")
|
|
512
|
+
* @default 'default'
|
|
513
|
+
*/
|
|
514
|
+
template?: string;
|
|
515
|
+
/**
|
|
516
|
+
* Local page state variables
|
|
517
|
+
* Initialized on mount and available to all components via context
|
|
518
|
+
*/
|
|
519
|
+
variables?: PageVariable[];
|
|
471
520
|
/**
|
|
472
521
|
* Page layout regions
|
|
473
522
|
* (Aligned with @objectstack/spec Page.regions)
|
|
@@ -481,6 +530,15 @@ export interface PageSchema extends BaseSchema {
|
|
|
481
530
|
* Alternative content prop
|
|
482
531
|
*/
|
|
483
532
|
children?: SchemaNode | SchemaNode[];
|
|
533
|
+
/**
|
|
534
|
+
* Whether this is the default page for the object/app
|
|
535
|
+
* @default false
|
|
536
|
+
*/
|
|
537
|
+
isDefault?: boolean;
|
|
538
|
+
/**
|
|
539
|
+
* Profiles that can access this page
|
|
540
|
+
*/
|
|
541
|
+
assignedProfiles?: string[];
|
|
484
542
|
}
|
|
485
543
|
|
|
486
544
|
/**
|
package/src/mobile.ts
ADDED
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ObjectUI
|
|
3
|
+
* Copyright (c) 2024-present ObjectStack Inc.
|
|
4
|
+
*
|
|
5
|
+
* This source code is licensed under the MIT license found in the
|
|
6
|
+
* LICENSE file in the root directory of this source tree.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* @object-ui/types - Mobile Optimization Types
|
|
11
|
+
*
|
|
12
|
+
* Type definitions for mobile-responsive components, PWA support,
|
|
13
|
+
* and touch gesture handling.
|
|
14
|
+
*
|
|
15
|
+
* @module mobile
|
|
16
|
+
* @packageDocumentation
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
// ============================================================================
|
|
20
|
+
// Responsive Configuration
|
|
21
|
+
// ============================================================================
|
|
22
|
+
|
|
23
|
+
/** Breakpoint names */
|
|
24
|
+
export type BreakpointName = 'xs' | 'sm' | 'md' | 'lg' | 'xl' | '2xl';
|
|
25
|
+
|
|
26
|
+
/** Responsive value - different values for different breakpoints */
|
|
27
|
+
export type ResponsiveValue<T> = T | Partial<Record<BreakpointName, T>>;
|
|
28
|
+
|
|
29
|
+
/** Responsive layout configuration */
|
|
30
|
+
export interface ResponsiveConfig {
|
|
31
|
+
/** Number of columns at each breakpoint */
|
|
32
|
+
columns?: ResponsiveValue<number>;
|
|
33
|
+
/** Whether to stack vertically on mobile */
|
|
34
|
+
stackOnMobile?: boolean;
|
|
35
|
+
/** Breakpoint at which to stack */
|
|
36
|
+
stackBreakpoint?: BreakpointName;
|
|
37
|
+
/** Gap between items at each breakpoint */
|
|
38
|
+
gap?: ResponsiveValue<string | number>;
|
|
39
|
+
/** Padding at each breakpoint */
|
|
40
|
+
padding?: ResponsiveValue<string | number>;
|
|
41
|
+
/** Whether to hide on specific breakpoints */
|
|
42
|
+
hidden?: BreakpointName[];
|
|
43
|
+
/** Whether to show only on specific breakpoints */
|
|
44
|
+
showOnly?: BreakpointName[];
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/** Mobile-specific component overrides */
|
|
48
|
+
export interface MobileOverrides {
|
|
49
|
+
/** Simplified layout for mobile */
|
|
50
|
+
layout?: 'stack' | 'tabs' | 'accordion' | 'carousel';
|
|
51
|
+
/** Reduced columns for forms */
|
|
52
|
+
columns?: number;
|
|
53
|
+
/** Whether to use bottom sheet instead of modal */
|
|
54
|
+
useBottomSheet?: boolean;
|
|
55
|
+
/** Whether to use full-screen mode */
|
|
56
|
+
fullScreen?: boolean;
|
|
57
|
+
/** Touch-friendly sizing */
|
|
58
|
+
touchTarget?: 'default' | 'large' | 'xlarge';
|
|
59
|
+
/** Simplified navigation */
|
|
60
|
+
navigation?: 'bottom-tabs' | 'hamburger' | 'drawer';
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
// ============================================================================
|
|
64
|
+
// PWA Support
|
|
65
|
+
// ============================================================================
|
|
66
|
+
|
|
67
|
+
/** PWA configuration */
|
|
68
|
+
export interface PWAConfig {
|
|
69
|
+
/** Enable PWA support */
|
|
70
|
+
enabled: boolean;
|
|
71
|
+
/** App name */
|
|
72
|
+
name: string;
|
|
73
|
+
/** Short name for home screen */
|
|
74
|
+
shortName: string;
|
|
75
|
+
/** App description */
|
|
76
|
+
description?: string;
|
|
77
|
+
/** Theme color */
|
|
78
|
+
themeColor?: string;
|
|
79
|
+
/** Background color */
|
|
80
|
+
backgroundColor?: string;
|
|
81
|
+
/** Display mode */
|
|
82
|
+
display?: 'standalone' | 'fullscreen' | 'minimal-ui' | 'browser';
|
|
83
|
+
/** App icons */
|
|
84
|
+
icons?: PWAIcon[];
|
|
85
|
+
/** Start URL */
|
|
86
|
+
startUrl?: string;
|
|
87
|
+
/** Scope */
|
|
88
|
+
scope?: string;
|
|
89
|
+
/** Orientation */
|
|
90
|
+
orientation?: 'any' | 'portrait' | 'landscape';
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
/** PWA icon definition */
|
|
94
|
+
export interface PWAIcon {
|
|
95
|
+
/** Icon URL */
|
|
96
|
+
src: string;
|
|
97
|
+
/** Icon sizes (e.g., '192x192') */
|
|
98
|
+
sizes: string;
|
|
99
|
+
/** MIME type */
|
|
100
|
+
type?: string;
|
|
101
|
+
/** Purpose */
|
|
102
|
+
purpose?: 'any' | 'maskable' | 'monochrome';
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
/** Offline caching strategy */
|
|
106
|
+
export type CacheStrategy = 'cache-first' | 'network-first' | 'stale-while-revalidate' | 'network-only' | 'cache-only';
|
|
107
|
+
|
|
108
|
+
/** Offline configuration */
|
|
109
|
+
export interface OfflineConfig {
|
|
110
|
+
/** Enable offline support */
|
|
111
|
+
enabled: boolean;
|
|
112
|
+
/** Default caching strategy */
|
|
113
|
+
defaultStrategy: CacheStrategy;
|
|
114
|
+
/** Routes with specific caching strategies */
|
|
115
|
+
routes?: OfflineRoute[];
|
|
116
|
+
/** Maximum cache size in bytes */
|
|
117
|
+
maxCacheSize?: number;
|
|
118
|
+
/** Cache expiration in seconds */
|
|
119
|
+
cacheExpiration?: number;
|
|
120
|
+
/** Objects to cache for offline access */
|
|
121
|
+
offlineObjects?: string[];
|
|
122
|
+
/** Sync strategy when back online */
|
|
123
|
+
syncStrategy?: 'immediate' | 'background' | 'manual';
|
|
124
|
+
/** Conflict resolution strategy */
|
|
125
|
+
conflictResolution?: 'server-wins' | 'client-wins' | 'manual';
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
/** Offline route configuration */
|
|
129
|
+
export interface OfflineRoute {
|
|
130
|
+
/** URL pattern (glob or regex) */
|
|
131
|
+
pattern: string;
|
|
132
|
+
/** Caching strategy for this route */
|
|
133
|
+
strategy: CacheStrategy;
|
|
134
|
+
/** Cache name */
|
|
135
|
+
cacheName?: string;
|
|
136
|
+
/** Cache expiration override */
|
|
137
|
+
expiration?: number;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
// ============================================================================
|
|
141
|
+
// Touch Gestures
|
|
142
|
+
// ============================================================================
|
|
143
|
+
|
|
144
|
+
/** Touch gesture types */
|
|
145
|
+
export type GestureType = 'tap' | 'double-tap' | 'long-press' | 'swipe-left' | 'swipe-right' | 'swipe-up' | 'swipe-down' | 'pinch' | 'rotate' | 'pan';
|
|
146
|
+
|
|
147
|
+
/** Gesture handler configuration */
|
|
148
|
+
export interface GestureConfig {
|
|
149
|
+
/** Gesture type */
|
|
150
|
+
type: GestureType;
|
|
151
|
+
/** Action to execute */
|
|
152
|
+
action: string;
|
|
153
|
+
/** Minimum distance for swipe gestures (pixels) */
|
|
154
|
+
threshold?: number;
|
|
155
|
+
/** Duration for long-press (milliseconds) */
|
|
156
|
+
duration?: number;
|
|
157
|
+
/** Whether to prevent default browser behavior */
|
|
158
|
+
preventDefault?: boolean;
|
|
159
|
+
/** Whether gesture is enabled */
|
|
160
|
+
enabled?: boolean;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
/** Touch gesture context */
|
|
164
|
+
export interface GestureContext {
|
|
165
|
+
/** Gesture type that was detected */
|
|
166
|
+
type: GestureType;
|
|
167
|
+
/** Start position */
|
|
168
|
+
startPosition: { x: number; y: number };
|
|
169
|
+
/** End position */
|
|
170
|
+
endPosition: { x: number; y: number };
|
|
171
|
+
/** Distance traveled */
|
|
172
|
+
distance: number;
|
|
173
|
+
/** Direction of movement */
|
|
174
|
+
direction?: 'up' | 'down' | 'left' | 'right';
|
|
175
|
+
/** Duration of gesture in milliseconds */
|
|
176
|
+
duration: number;
|
|
177
|
+
/** Velocity (pixels per millisecond) */
|
|
178
|
+
velocity: number;
|
|
179
|
+
/** Scale for pinch gestures */
|
|
180
|
+
scale?: number;
|
|
181
|
+
/** Rotation angle for rotate gestures */
|
|
182
|
+
rotation?: number;
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
/** Mobile component schema extension */
|
|
186
|
+
export interface MobileComponentConfig {
|
|
187
|
+
/** Responsive configuration */
|
|
188
|
+
responsive?: ResponsiveConfig;
|
|
189
|
+
/** Mobile-specific overrides */
|
|
190
|
+
mobileOverrides?: MobileOverrides;
|
|
191
|
+
/** Touch gesture handlers */
|
|
192
|
+
gestures?: GestureConfig[];
|
|
193
|
+
/** Pull-to-refresh configuration */
|
|
194
|
+
pullToRefresh?: {
|
|
195
|
+
enabled: boolean;
|
|
196
|
+
threshold?: number;
|
|
197
|
+
onRefresh?: string;
|
|
198
|
+
};
|
|
199
|
+
/** Infinite scroll configuration */
|
|
200
|
+
infiniteScroll?: {
|
|
201
|
+
enabled: boolean;
|
|
202
|
+
threshold?: number;
|
|
203
|
+
loadMore?: string;
|
|
204
|
+
};
|
|
205
|
+
}
|