@onerjs/gui-editor 8.48.4 → 8.48.6
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.
|
@@ -3297,6 +3297,1312 @@ export interface IDisplayManager {
|
|
|
3297
3297
|
onDispose?(nodeData: INodeData, manager: StateManager): void;
|
|
3298
3298
|
}
|
|
3299
3299
|
|
|
3300
|
+
}
|
|
3301
|
+
declare module "@onerjs/gui-editor/modularTool/modularTool" {
|
|
3302
|
+
import { IDisposable } from "@onerjs/core/index";
|
|
3303
|
+
import { IExtensionFeed } from "@onerjs/gui-editor/modularTool/extensibility/extensionFeed";
|
|
3304
|
+
import { WeaklyTypedServiceDefinition, ServiceContainer } from "@onerjs/gui-editor/modularTool/modularity/serviceContainer";
|
|
3305
|
+
import { ShellServiceOptions } from "@onerjs/gui-editor/modularTool/services/shellService";
|
|
3306
|
+
import { ThemeMode } from "@onerjs/gui-editor/modularTool/services/themeService";
|
|
3307
|
+
export type ModularToolOptions = {
|
|
3308
|
+
/**
|
|
3309
|
+
* The namespace for the tool, used for scoping persisted settings and other storage.
|
|
3310
|
+
*/
|
|
3311
|
+
namespace: string;
|
|
3312
|
+
/**
|
|
3313
|
+
* The container element where the tool will be rendered.
|
|
3314
|
+
*/
|
|
3315
|
+
containerElement: HTMLElement;
|
|
3316
|
+
/**
|
|
3317
|
+
* The service definitions to be registered with the tool.
|
|
3318
|
+
*/
|
|
3319
|
+
serviceDefinitions: readonly WeaklyTypedServiceDefinition[];
|
|
3320
|
+
/**
|
|
3321
|
+
* The theme mode to use. If not specified, the default is "system", which uses the system/browser preference, and the last used mode is persisted.
|
|
3322
|
+
*/
|
|
3323
|
+
themeMode?: ThemeMode;
|
|
3324
|
+
/**
|
|
3325
|
+
* Whether to show the theme selector in the toolbar. Default is true.
|
|
3326
|
+
*/
|
|
3327
|
+
showThemeSelector?: boolean;
|
|
3328
|
+
/**
|
|
3329
|
+
* The extension feeds that provide optional extensions the user can install.
|
|
3330
|
+
*/
|
|
3331
|
+
extensionFeeds?: readonly IExtensionFeed[];
|
|
3332
|
+
/**
|
|
3333
|
+
* An optional parent ServiceContainer. Dependencies not found in the tool's own container
|
|
3334
|
+
* will be resolved from this parent.
|
|
3335
|
+
*/
|
|
3336
|
+
parentContainer?: ServiceContainer;
|
|
3337
|
+
} & ShellServiceOptions;
|
|
3338
|
+
/**
|
|
3339
|
+
* Creates a modular tool with a base set of common tool services, including the toolbar/side pane basic UI layout.
|
|
3340
|
+
* @param options The options for the tool.
|
|
3341
|
+
* @returns A token that can be used to dispose of the tool.
|
|
3342
|
+
*/
|
|
3343
|
+
export function MakeModularTool(options: ModularToolOptions): IDisposable;
|
|
3344
|
+
|
|
3345
|
+
}
|
|
3346
|
+
declare module "@onerjs/gui-editor/modularTool/themes/babylonTheme" {
|
|
3347
|
+
|
|
3348
|
+
export const LightTheme: any;
|
|
3349
|
+
export const DarkTheme: any;
|
|
3350
|
+
|
|
3351
|
+
}
|
|
3352
|
+
declare module "@onerjs/gui-editor/modularTool/services/themeService" {
|
|
3353
|
+
|
|
3354
|
+
import { IDisposable, IReadonlyObservable } from "@onerjs/core/index";
|
|
3355
|
+
import { IService, ServiceDefinition } from "@onerjs/gui-editor/modularTool/modularity/serviceDefinition";
|
|
3356
|
+
import { ISettingsStore, SettingDescriptor } from "@onerjs/gui-editor/modularTool/services/settingsStore";
|
|
3357
|
+
/**
|
|
3358
|
+
* Represents the theme mode preference.
|
|
3359
|
+
*/
|
|
3360
|
+
export type ThemeMode = "system" | "light" | "dark";
|
|
3361
|
+
/**
|
|
3362
|
+
* The setting descriptor for persisting the theme mode preference.
|
|
3363
|
+
*/
|
|
3364
|
+
export const ThemeModeSettingDescriptor: SettingDescriptor<ThemeMode>;
|
|
3365
|
+
/**
|
|
3366
|
+
* Resolves the current theme based on user preference and system settings.
|
|
3367
|
+
* Listens for changes to both the persisted theme mode and the OS-level dark mode preference.
|
|
3368
|
+
*/
|
|
3369
|
+
export class ThemeResolver implements IDisposable {
|
|
3370
|
+
private readonly _settingsStore;
|
|
3371
|
+
private readonly _darkModeMediaQuery;
|
|
3372
|
+
private readonly _onChanged;
|
|
3373
|
+
private readonly _onDarkModeMediaQueryChange;
|
|
3374
|
+
private readonly _settingsStoreObserver;
|
|
3375
|
+
constructor(_settingsStore: ISettingsStore);
|
|
3376
|
+
get onChanged(): IReadonlyObservable<void>;
|
|
3377
|
+
get mode(): ThemeMode;
|
|
3378
|
+
set mode(value: ThemeMode);
|
|
3379
|
+
get isDark(): boolean;
|
|
3380
|
+
toggle(): void;
|
|
3381
|
+
dispose(): void;
|
|
3382
|
+
}
|
|
3383
|
+
/**
|
|
3384
|
+
* The unique identity symbol for the theme service.
|
|
3385
|
+
*/
|
|
3386
|
+
export const ThemeServiceIdentity: unique symbol;
|
|
3387
|
+
/**
|
|
3388
|
+
* Exposes the current theme used by the application.
|
|
3389
|
+
*/
|
|
3390
|
+
export interface IThemeService extends IService<typeof ThemeServiceIdentity> {
|
|
3391
|
+
/**
|
|
3392
|
+
* Whether the current theme is the dark variant or not.
|
|
3393
|
+
*/
|
|
3394
|
+
readonly isDark: boolean;
|
|
3395
|
+
/**
|
|
3396
|
+
* The current theme mode, which can be either "light", "dark" or "system". When set to "system", the theme will match the user's OS-level preference and update automatically when it changes.
|
|
3397
|
+
*/
|
|
3398
|
+
mode: ThemeMode;
|
|
3399
|
+
/**
|
|
3400
|
+
* Toggles the theme mode between light and dark. If the current mode is "system", it will toggle based on the current OS-level preference.
|
|
3401
|
+
*/
|
|
3402
|
+
toggle(): void;
|
|
3403
|
+
/**
|
|
3404
|
+
* The current theme used by the application.
|
|
3405
|
+
*/
|
|
3406
|
+
readonly theme: any;
|
|
3407
|
+
/**
|
|
3408
|
+
* Observable that fires whenever the theme changes.
|
|
3409
|
+
*/
|
|
3410
|
+
readonly onChanged: IReadonlyObservable<void>;
|
|
3411
|
+
}
|
|
3412
|
+
export const ThemeServiceDefinition: ServiceDefinition<[IThemeService], [ISettingsStore]>;
|
|
3413
|
+
|
|
3414
|
+
}
|
|
3415
|
+
declare module "@onerjs/gui-editor/modularTool/services/themeSelectorService" {
|
|
3416
|
+
import { ServiceDefinition } from "@onerjs/gui-editor/modularTool/modularity/serviceDefinition";
|
|
3417
|
+
import { IShellService } from "@onerjs/gui-editor/modularTool/services/shellService";
|
|
3418
|
+
export const ThemeSelectorServiceDefinition: ServiceDefinition<[], [IShellService]>;
|
|
3419
|
+
|
|
3420
|
+
}
|
|
3421
|
+
declare module "@onerjs/gui-editor/modularTool/services/shellSettingsService" {
|
|
3422
|
+
import { ServiceDefinition } from "@onerjs/gui-editor/modularTool/modularity/serviceDefinition";
|
|
3423
|
+
import { ISettingsService } from "@onerjs/gui-editor/modularTool/services/settingsService";
|
|
3424
|
+
export const ShellSettingsServiceDefinition: ServiceDefinition<[], [ISettingsService]>;
|
|
3425
|
+
|
|
3426
|
+
}
|
|
3427
|
+
declare module "@onerjs/gui-editor/modularTool/services/shellService" {
|
|
3428
|
+
import { ComponentType } from "react";
|
|
3429
|
+
import { IDisposable, Nullable } from "@onerjs/core/index";
|
|
3430
|
+
import { IService, ServiceDefinition } from "@onerjs/gui-editor/modularTool/modularity/serviceDefinition";
|
|
3431
|
+
import { SettingDescriptor } from "@onerjs/gui-editor/modularTool/services/settingsStore";
|
|
3432
|
+
/**
|
|
3433
|
+
* Setting descriptor for persisting side pane dock location overrides.
|
|
3434
|
+
*/
|
|
3435
|
+
export const SidePaneDockOverridesSettingDescriptor: SettingDescriptor<Record<string, Readonly<{
|
|
3436
|
+
horizontalLocation: HorizontalLocation;
|
|
3437
|
+
verticalLocation: VerticalLocation;
|
|
3438
|
+
}> | undefined>>;
|
|
3439
|
+
/**
|
|
3440
|
+
* Setting descriptor for persisting the left side pane width adjustment.
|
|
3441
|
+
*/
|
|
3442
|
+
export const LeftSidePaneWidthAdjustSettingDescriptor: SettingDescriptor<number>;
|
|
3443
|
+
/**
|
|
3444
|
+
* Setting descriptor for persisting the left side pane height adjustment.
|
|
3445
|
+
*/
|
|
3446
|
+
export const LeftSidePaneHeightAdjustSettingDescriptor: SettingDescriptor<number>;
|
|
3447
|
+
/**
|
|
3448
|
+
* Setting descriptor for persisting the right side pane width adjustment.
|
|
3449
|
+
*/
|
|
3450
|
+
export const RightSidePaneWidthAdjustSettingDescriptor: SettingDescriptor<number>;
|
|
3451
|
+
/**
|
|
3452
|
+
* Setting descriptor for persisting the right side pane height adjustment.
|
|
3453
|
+
*/
|
|
3454
|
+
export const RightSidePaneHeightAdjustSettingDescriptor: SettingDescriptor<number>;
|
|
3455
|
+
/**
|
|
3456
|
+
* Represents a horizontal location in the shell layout.
|
|
3457
|
+
*/
|
|
3458
|
+
export type HorizontalLocation = "left" | "right";
|
|
3459
|
+
/**
|
|
3460
|
+
* Represents a vertical location in the shell layout.
|
|
3461
|
+
*/
|
|
3462
|
+
export type VerticalLocation = "top" | "bottom";
|
|
3463
|
+
type TeachingMomentInfo = boolean | {
|
|
3464
|
+
readonly title: string;
|
|
3465
|
+
readonly description: string;
|
|
3466
|
+
};
|
|
3467
|
+
/**
|
|
3468
|
+
* Describes an item that can be added to one of the shell's toolbars.
|
|
3469
|
+
*/
|
|
3470
|
+
export type ToolbarItemDefinition = {
|
|
3471
|
+
/**
|
|
3472
|
+
* A unique key for the toolbar item.
|
|
3473
|
+
*/
|
|
3474
|
+
key: string;
|
|
3475
|
+
/**
|
|
3476
|
+
* The component to render for the toolbar item.
|
|
3477
|
+
*/
|
|
3478
|
+
component: ComponentType;
|
|
3479
|
+
/**
|
|
3480
|
+
* An optional order for the toolbar item, relative to other items.
|
|
3481
|
+
* Defaults to 0.
|
|
3482
|
+
*/
|
|
3483
|
+
order?: number;
|
|
3484
|
+
/**
|
|
3485
|
+
* The horizontal location of the toolbar item.
|
|
3486
|
+
* Can be either "left" or "right".
|
|
3487
|
+
* In "compact" toolbar mode, "left" and "right" mean the "compact" toolbars at the top/bottom of the left/right side panes.
|
|
3488
|
+
* In "full" toolbar mode, "left" and "right" mean the left side and right side of the full width toolbars above/below the side panes.
|
|
3489
|
+
*/
|
|
3490
|
+
horizontalLocation: HorizontalLocation;
|
|
3491
|
+
/**
|
|
3492
|
+
* The vertical location of the toolbar item.
|
|
3493
|
+
* Can be either "top" or "bottom".
|
|
3494
|
+
*/
|
|
3495
|
+
verticalLocation: VerticalLocation;
|
|
3496
|
+
/**
|
|
3497
|
+
* An optional display name for the toolbar item, used for teaching moments, tooltips, etc.
|
|
3498
|
+
*/
|
|
3499
|
+
displayName?: string;
|
|
3500
|
+
/**
|
|
3501
|
+
* An optional teaching moment info. The default assumes the toolbar item was added by an extension and provides a generic title and description based on the display name or id, which is helpful for discoverability of new items.
|
|
3502
|
+
* Set this to false to suppress the teaching moment, which may be desirable for built in items or items that are added in a non-dynamic way.
|
|
3503
|
+
* Set it to an object with a title and description to provide a custom teaching moment, which may be desirable if the generic title and description are not sufficient.
|
|
3504
|
+
* Teaching moments are more helpful for dynamically added items, possibly from extensions.
|
|
3505
|
+
*/
|
|
3506
|
+
teachingMoment?: TeachingMomentInfo;
|
|
3507
|
+
};
|
|
3508
|
+
/**
|
|
3509
|
+
* Describes a side pane that can be added to the shell's left or right side.
|
|
3510
|
+
*/
|
|
3511
|
+
export type SidePaneDefinition = {
|
|
3512
|
+
/**
|
|
3513
|
+
* A unique key for the side pane.
|
|
3514
|
+
*/
|
|
3515
|
+
key: string;
|
|
3516
|
+
/**
|
|
3517
|
+
* An icon component to render for the pane tab.
|
|
3518
|
+
*/
|
|
3519
|
+
icon: ComponentType;
|
|
3520
|
+
/**
|
|
3521
|
+
* The component to render for the side pane's content.
|
|
3522
|
+
*/
|
|
3523
|
+
content: ComponentType;
|
|
3524
|
+
/**
|
|
3525
|
+
* An optional order for the side pane, relative to other panes.
|
|
3526
|
+
* Defaults to 0.
|
|
3527
|
+
*/
|
|
3528
|
+
order?: number;
|
|
3529
|
+
/**
|
|
3530
|
+
* The horizontal location of the side pane.
|
|
3531
|
+
* Can be either "left" or "right".
|
|
3532
|
+
*/
|
|
3533
|
+
horizontalLocation: HorizontalLocation;
|
|
3534
|
+
/**
|
|
3535
|
+
* The vertical location of the side pane.
|
|
3536
|
+
* Can be either "top" or "bottom".
|
|
3537
|
+
*/
|
|
3538
|
+
verticalLocation: VerticalLocation;
|
|
3539
|
+
/**
|
|
3540
|
+
* The title of the side pane, displayed as a standardized header at the top of the pane.
|
|
3541
|
+
*/
|
|
3542
|
+
title: string;
|
|
3543
|
+
/**
|
|
3544
|
+
* An optional teaching moment info. The default assumes the side pane was added by an extension and provides a generic title and description based on the display name or id, which is helpful for discoverability of new items.
|
|
3545
|
+
* Set this to false to suppress the teaching moment, which may be desirable for built in items or items that are added in a non-dynamic way.
|
|
3546
|
+
* Set it to an object with a title and description to provide a custom teaching moment, which may be desirable if the generic title and description are not sufficient.
|
|
3547
|
+
* Teaching moments are more helpful for dynamically added panes, possibly from extensions.
|
|
3548
|
+
*/
|
|
3549
|
+
teachingMoment?: TeachingMomentInfo;
|
|
3550
|
+
/**
|
|
3551
|
+
* Keep the pane mounted even when it is not visible. This is useful if you don't want the
|
|
3552
|
+
* user to lose the complex visual state when switching between tabs.
|
|
3553
|
+
*/
|
|
3554
|
+
keepMounted?: boolean;
|
|
3555
|
+
};
|
|
3556
|
+
type RegisteredSidePane = {
|
|
3557
|
+
readonly key: string;
|
|
3558
|
+
select(): void;
|
|
3559
|
+
};
|
|
3560
|
+
type SidePaneContainer = {
|
|
3561
|
+
readonly isDocked: boolean;
|
|
3562
|
+
dock(): void;
|
|
3563
|
+
undock(): void;
|
|
3564
|
+
readonly isCollapsed: boolean;
|
|
3565
|
+
collapse(): void;
|
|
3566
|
+
expand(): void;
|
|
3567
|
+
};
|
|
3568
|
+
/**
|
|
3569
|
+
* Describes content that can be added to the shell's central area (between the side panes and toolbars - e.g. the main content).
|
|
3570
|
+
*/
|
|
3571
|
+
export type CentralContentDefinition = {
|
|
3572
|
+
/**
|
|
3573
|
+
* A unique key for the central content.
|
|
3574
|
+
*/
|
|
3575
|
+
key: string;
|
|
3576
|
+
/**
|
|
3577
|
+
* The component to render for the central content.
|
|
3578
|
+
*/
|
|
3579
|
+
component: ComponentType;
|
|
3580
|
+
/**
|
|
3581
|
+
* An optional order for content, relative to other central content.
|
|
3582
|
+
* Defaults to 0.
|
|
3583
|
+
*/
|
|
3584
|
+
order?: number;
|
|
3585
|
+
};
|
|
3586
|
+
/**
|
|
3587
|
+
* The unique identity symbol for the root component service.
|
|
3588
|
+
*/
|
|
3589
|
+
export const RootComponentServiceIdentity: unique symbol;
|
|
3590
|
+
/**
|
|
3591
|
+
* Exposes a top level component that should be rendered as the React root.
|
|
3592
|
+
*/
|
|
3593
|
+
export interface IRootComponentService extends IService<typeof RootComponentServiceIdentity> {
|
|
3594
|
+
/**
|
|
3595
|
+
* The root component that should be rendered as the React root.
|
|
3596
|
+
*/
|
|
3597
|
+
readonly rootComponent: ComponentType;
|
|
3598
|
+
}
|
|
3599
|
+
/**
|
|
3600
|
+
* The unique identity symbol for the shell service.
|
|
3601
|
+
*/
|
|
3602
|
+
export const ShellServiceIdentity: unique symbol;
|
|
3603
|
+
/**
|
|
3604
|
+
* Provides a shell for the application, including toolbars, side panes, and central content.
|
|
3605
|
+
* This service allows adding toolbar items, side panes, and central content dynamically.
|
|
3606
|
+
*/
|
|
3607
|
+
export interface IShellService extends IService<typeof ShellServiceIdentity> {
|
|
3608
|
+
/**
|
|
3609
|
+
* Adds a new item to one of the shell's toolbars.
|
|
3610
|
+
* @param item Defines the item to add.
|
|
3611
|
+
*/
|
|
3612
|
+
addToolbarItem(item: Readonly<ToolbarItemDefinition>): IDisposable;
|
|
3613
|
+
/**
|
|
3614
|
+
* Adds a new side pane to the shell.
|
|
3615
|
+
* @param pane Defines the side pane to add.
|
|
3616
|
+
*/
|
|
3617
|
+
addSidePane(pane: Readonly<SidePaneDefinition>): IDisposable;
|
|
3618
|
+
/**
|
|
3619
|
+
* Adds new central content to the shell.
|
|
3620
|
+
* @param content Defines the content area to add.
|
|
3621
|
+
*/
|
|
3622
|
+
addCentralContent(content: Readonly<CentralContentDefinition>): IDisposable;
|
|
3623
|
+
/**
|
|
3624
|
+
* The left side pane container.
|
|
3625
|
+
*/
|
|
3626
|
+
readonly leftSidePaneContainer: Nullable<SidePaneContainer>;
|
|
3627
|
+
/**
|
|
3628
|
+
* The right side pane container.
|
|
3629
|
+
*/
|
|
3630
|
+
readonly rightSidePaneContainer: Nullable<SidePaneContainer>;
|
|
3631
|
+
/**
|
|
3632
|
+
* The side panes currently present in the shell.
|
|
3633
|
+
*/
|
|
3634
|
+
readonly sidePanes: readonly RegisteredSidePane[];
|
|
3635
|
+
}
|
|
3636
|
+
type ToolbarMode = "full" | "compact";
|
|
3637
|
+
/**
|
|
3638
|
+
* Options for configuring the shell service.
|
|
3639
|
+
*/
|
|
3640
|
+
export type ShellServiceOptions = {
|
|
3641
|
+
/**
|
|
3642
|
+
* The default width of the left side pane.
|
|
3643
|
+
*/
|
|
3644
|
+
leftPaneDefaultWidth?: number;
|
|
3645
|
+
/**
|
|
3646
|
+
* The minimum width of the left side pane.
|
|
3647
|
+
*/
|
|
3648
|
+
leftPaneMinWidth?: number;
|
|
3649
|
+
/**
|
|
3650
|
+
* The default width of the right side pane.
|
|
3651
|
+
*/
|
|
3652
|
+
rightPaneDefaultWidth?: number;
|
|
3653
|
+
/**
|
|
3654
|
+
* The minimum width of the right side pane.
|
|
3655
|
+
*/
|
|
3656
|
+
rightPaneMinWidth?: number;
|
|
3657
|
+
/**
|
|
3658
|
+
* The mode of the toolbars.
|
|
3659
|
+
* Can be either "full" (default) or "compact".
|
|
3660
|
+
* In "full" mode, toolbars are displayed above and below the side panes.
|
|
3661
|
+
* In "compact" mode, toolbars are displayed at the top and bottom of the left and right side panes.
|
|
3662
|
+
*/
|
|
3663
|
+
toolbarMode?: ToolbarMode;
|
|
3664
|
+
/**
|
|
3665
|
+
* Whether the left side pane should start collapsed. Default is false.
|
|
3666
|
+
*/
|
|
3667
|
+
leftPaneDefaultCollapsed?: boolean;
|
|
3668
|
+
/**
|
|
3669
|
+
* Whether the right side pane should start collapsed. Default is false.
|
|
3670
|
+
*/
|
|
3671
|
+
rightPaneDefaultCollapsed?: boolean;
|
|
3672
|
+
/**
|
|
3673
|
+
* A function that can remap the default location of side panes.
|
|
3674
|
+
* @param sidePane The side pane to remap.
|
|
3675
|
+
* @returns The new location for the side pane.
|
|
3676
|
+
*/
|
|
3677
|
+
sidePaneRemapper?: (sidePane: Readonly<SidePaneDefinition>) => Nullable<{
|
|
3678
|
+
horizontalLocation: HorizontalLocation;
|
|
3679
|
+
verticalLocation: VerticalLocation;
|
|
3680
|
+
}>;
|
|
3681
|
+
};
|
|
3682
|
+
export function MakeShellServiceDefinition({ leftPaneDefaultWidth, leftPaneMinWidth, rightPaneDefaultWidth, rightPaneMinWidth, leftPaneDefaultCollapsed, rightPaneDefaultCollapsed, toolbarMode, sidePaneRemapper, }?: ShellServiceOptions): ServiceDefinition<[IShellService, IRootComponentService], []>;
|
|
3683
|
+
export {};
|
|
3684
|
+
|
|
3685
|
+
}
|
|
3686
|
+
declare module "@onerjs/gui-editor/modularTool/services/settingsStore" {
|
|
3687
|
+
import { IReadonlyObservable } from "@onerjs/core/index";
|
|
3688
|
+
import { IService } from "@onerjs/gui-editor/modularTool/modularity/serviceDefinition";
|
|
3689
|
+
/**
|
|
3690
|
+
* The unique identity symbol for the settings store service.
|
|
3691
|
+
*/
|
|
3692
|
+
export const SettingsStoreIdentity: unique symbol;
|
|
3693
|
+
/**
|
|
3694
|
+
* Describes a setting by its key and default value.
|
|
3695
|
+
*/
|
|
3696
|
+
export type SettingDescriptor<T> = {
|
|
3697
|
+
/**
|
|
3698
|
+
* The unique key used to identify this setting in the store.
|
|
3699
|
+
*/
|
|
3700
|
+
readonly key: string;
|
|
3701
|
+
/**
|
|
3702
|
+
* The default value to use when the setting has not been explicitly set.
|
|
3703
|
+
*/
|
|
3704
|
+
readonly defaultValue: T;
|
|
3705
|
+
};
|
|
3706
|
+
/**
|
|
3707
|
+
* Provides a key-value store for persisting user settings.
|
|
3708
|
+
*/
|
|
3709
|
+
export interface ISettingsStore extends IService<typeof SettingsStoreIdentity> {
|
|
3710
|
+
/**
|
|
3711
|
+
* An observable that notifies when a setting has changed, providing the key of the changed setting.
|
|
3712
|
+
*/
|
|
3713
|
+
onChanged: IReadonlyObservable<string>;
|
|
3714
|
+
/**
|
|
3715
|
+
* Reads a setting from the store.
|
|
3716
|
+
* @param descriptor The descriptor of the setting to read.
|
|
3717
|
+
* @returns The current value of the setting, or the default value if it has not been set.
|
|
3718
|
+
*/
|
|
3719
|
+
readSetting<T>(descriptor: SettingDescriptor<T>): T;
|
|
3720
|
+
/**
|
|
3721
|
+
* Writes a setting to the store.
|
|
3722
|
+
* @param descriptor The descriptor of the setting to write.
|
|
3723
|
+
* @param value The value to write.
|
|
3724
|
+
*/
|
|
3725
|
+
writeSetting<T>(descriptor: SettingDescriptor<T>, value: T): void;
|
|
3726
|
+
}
|
|
3727
|
+
/**
|
|
3728
|
+
* Default implementation of {@link ISettingsStore} that persists settings using browser local storage.
|
|
3729
|
+
*/
|
|
3730
|
+
export class SettingsStore implements ISettingsStore {
|
|
3731
|
+
private readonly _namespace;
|
|
3732
|
+
private readonly _onChanged;
|
|
3733
|
+
/**
|
|
3734
|
+
* Creates a new settings store.
|
|
3735
|
+
* @param _namespace A namespace used to scope the settings keys to avoid collisions with other stores.
|
|
3736
|
+
*/
|
|
3737
|
+
constructor(_namespace: string);
|
|
3738
|
+
get onChanged(): IReadonlyObservable<Readonly<string>>;
|
|
3739
|
+
readSetting<T>(descriptor: SettingDescriptor<T>): T;
|
|
3740
|
+
writeSetting<T>(descriptor: SettingDescriptor<T>, value: T): void;
|
|
3741
|
+
}
|
|
3742
|
+
|
|
3743
|
+
}
|
|
3744
|
+
declare module "@onerjs/gui-editor/modularTool/services/settingsService" {
|
|
3745
|
+
import { IDisposable } from "@onerjs/core/index";
|
|
3746
|
+
import { DynamicAccordionSection, DynamicAccordionSectionContent } from "@onerjs/gui-editor/modularTool/components/extensibleAccordion";
|
|
3747
|
+
import { IService, ServiceDefinition } from "@onerjs/gui-editor/modularTool/modularity/serviceDefinition";
|
|
3748
|
+
import { IShellService } from "@onerjs/gui-editor/modularTool/services/shellService";
|
|
3749
|
+
/**
|
|
3750
|
+
* The unique identity symbol for the settings service.
|
|
3751
|
+
*/
|
|
3752
|
+
export const SettingsServiceIdentity: unique symbol;
|
|
3753
|
+
/**
|
|
3754
|
+
* Allows new sections or content to be added to the Settings pane.
|
|
3755
|
+
*/
|
|
3756
|
+
export interface ISettingsService extends IService<typeof SettingsServiceIdentity> {
|
|
3757
|
+
/**
|
|
3758
|
+
* Adds a new section to the settings pane.
|
|
3759
|
+
* @param section A description of the section to add.
|
|
3760
|
+
*/
|
|
3761
|
+
addSection(section: DynamicAccordionSection): IDisposable;
|
|
3762
|
+
/**
|
|
3763
|
+
* Adds content to one or more sections in the settings pane.
|
|
3764
|
+
* @param content A description of the content to add.
|
|
3765
|
+
*/
|
|
3766
|
+
addSectionContent(content: DynamicAccordionSectionContent<unknown>): IDisposable;
|
|
3767
|
+
}
|
|
3768
|
+
export const SettingsServiceDefinition: ServiceDefinition<[ISettingsService], [IShellService]>;
|
|
3769
|
+
|
|
3770
|
+
}
|
|
3771
|
+
declare module "@onerjs/gui-editor/modularTool/services/reactContextService" {
|
|
3772
|
+
import { Context } from "react";
|
|
3773
|
+
import { IDisposable } from "@onerjs/core/index";
|
|
3774
|
+
import { IService } from "@onerjs/gui-editor/modularTool/modularity/serviceDefinition";
|
|
3775
|
+
/**
|
|
3776
|
+
* The unique identity symbol for the react context service.
|
|
3777
|
+
*/
|
|
3778
|
+
export const ReactContextServiceIdentity: unique symbol;
|
|
3779
|
+
export type ReactContextHandle<T> = IDisposable & {
|
|
3780
|
+
updateValue: (newValue: T) => void;
|
|
3781
|
+
};
|
|
3782
|
+
/**
|
|
3783
|
+
* ReactContextService allows global React contexts to be added/removed/updated.
|
|
3784
|
+
*/
|
|
3785
|
+
export interface IReactContextService extends IService<typeof ReactContextServiceIdentity> {
|
|
3786
|
+
addContext<T>(provider: Context<T>["Provider"], initialValue: T, options?: {
|
|
3787
|
+
order?: number;
|
|
3788
|
+
}): ReactContextHandle<T>;
|
|
3789
|
+
}
|
|
3790
|
+
|
|
3791
|
+
}
|
|
3792
|
+
declare module "@onerjs/gui-editor/modularTool/services/globalSettings" {
|
|
3793
|
+
import { SettingDescriptor } from "@onerjs/gui-editor/modularTool/services/settingsStore";
|
|
3794
|
+
export const CompactModeSettingDescriptor: SettingDescriptor<boolean>;
|
|
3795
|
+
export const DisableCopySettingDescriptor: SettingDescriptor<boolean>;
|
|
3796
|
+
|
|
3797
|
+
}
|
|
3798
|
+
declare module "@onerjs/gui-editor/modularTool/services/extensionsListService" {
|
|
3799
|
+
import { ServiceDefinition } from "@onerjs/gui-editor/modularTool/modularity/serviceDefinition";
|
|
3800
|
+
import { IShellService } from "@onerjs/gui-editor/modularTool/services/shellService";
|
|
3801
|
+
export const ExtensionListServiceDefinition: ServiceDefinition<[], [IShellService]>;
|
|
3802
|
+
|
|
3803
|
+
}
|
|
3804
|
+
declare module "@onerjs/gui-editor/modularTool/modularity/serviceDefinition" {
|
|
3805
|
+
import { IDisposable } from "@onerjs/core/index";
|
|
3806
|
+
/**
|
|
3807
|
+
* A helper to create a service factory function from a class constructor.
|
|
3808
|
+
* @param constructor The class to create a factory function for.
|
|
3809
|
+
* @returns A factory function that creates an instance of the class.
|
|
3810
|
+
*/
|
|
3811
|
+
export function ConstructorFactory<Class extends new (...args: any) => any>(constructor: Class): (...args: ConstructorParameters<Class>) => InstanceType<Class>;
|
|
3812
|
+
const Contract: unique symbol;
|
|
3813
|
+
/**
|
|
3814
|
+
* This interface must be implemented by all service contracts.
|
|
3815
|
+
*/
|
|
3816
|
+
export interface IService<ContractIdentity extends symbol> {
|
|
3817
|
+
/**
|
|
3818
|
+
* @internal
|
|
3819
|
+
*/
|
|
3820
|
+
readonly [Contract]?: ContractIdentity;
|
|
3821
|
+
}
|
|
3822
|
+
type ExtractContractIdentity<ServiceContract extends IService<symbol>> = ServiceContract extends IService<infer ContractIdentity> ? ContractIdentity : never;
|
|
3823
|
+
type ExtractContractIdentities<ServiceContracts extends IService<symbol>[]> = {
|
|
3824
|
+
[Index in keyof ServiceContracts]: ExtractContractIdentity<ServiceContracts[Index]>;
|
|
3825
|
+
};
|
|
3826
|
+
type UnionToIntersection<Union> = (Union extends any ? (k: Union) => void : never) extends (k: infer Intersection) => void ? Intersection : never;
|
|
3827
|
+
type MaybePromise<T> = T | Promise<T>;
|
|
3828
|
+
/**
|
|
3829
|
+
* A factory function responsible for creating a service instance.
|
|
3830
|
+
* Consumed services are passed as arguments to the factory function.
|
|
3831
|
+
* The returned value must implement all produced services, and may IDisposable.
|
|
3832
|
+
* If not services are produced, the returned value may implement IDisposable, otherwise it may return void.
|
|
3833
|
+
*/
|
|
3834
|
+
export type ServiceFactory<Produces extends IService<symbol>[], Consumes extends IService<symbol>[]> = (...dependencies: [...Consumes, abortSignal?: AbortSignal]) => MaybePromise<Produces extends [] ? Partial<IDisposable> | void : Partial<IDisposable> & UnionToIntersection<Produces[number]>>;
|
|
3835
|
+
/**
|
|
3836
|
+
* Defines a service, which is a logical unit that consumes other services (dependencies), and optionally produces services that can be consumed by other services (dependents).
|
|
3837
|
+
*/
|
|
3838
|
+
export type ServiceDefinition<Produces extends IService<symbol>[] = [], Consumes extends IService<symbol>[] = []> = {
|
|
3839
|
+
/**
|
|
3840
|
+
* A human readable name for the service to help with debugging.
|
|
3841
|
+
*/
|
|
3842
|
+
friendlyName: string;
|
|
3843
|
+
/**
|
|
3844
|
+
* A function that instantiates the service.
|
|
3845
|
+
*/
|
|
3846
|
+
factory: ServiceFactory<Produces, Consumes>;
|
|
3847
|
+
} & (Produces extends [] ? {
|
|
3848
|
+
/**
|
|
3849
|
+
* An empty list or undefined, since the type specification has indicated no contracts are produced.
|
|
3850
|
+
*/
|
|
3851
|
+
produces?: [];
|
|
3852
|
+
} : {
|
|
3853
|
+
/**
|
|
3854
|
+
* The list of contract identities that this service produces for consumption by other services.
|
|
3855
|
+
*/
|
|
3856
|
+
produces: ExtractContractIdentities<Produces>;
|
|
3857
|
+
}) & (Consumes extends [] ? {
|
|
3858
|
+
/**
|
|
3859
|
+
* An empty list or undefined, since the type specification has indicated that no other services are consumed.
|
|
3860
|
+
*/
|
|
3861
|
+
consumes?: [];
|
|
3862
|
+
} : {
|
|
3863
|
+
/**
|
|
3864
|
+
* The list of contract identities of other services that this service consumes.
|
|
3865
|
+
*/
|
|
3866
|
+
consumes: ExtractContractIdentities<Consumes>;
|
|
3867
|
+
});
|
|
3868
|
+
export {};
|
|
3869
|
+
|
|
3870
|
+
}
|
|
3871
|
+
declare module "@onerjs/gui-editor/modularTool/modularity/serviceContainer" {
|
|
3872
|
+
import { IDisposable } from "@onerjs/core/index";
|
|
3873
|
+
import { IService, ServiceDefinition } from "@onerjs/gui-editor/modularTool/modularity/serviceDefinition";
|
|
3874
|
+
export type WeaklyTypedServiceDefinition = Omit<ServiceDefinition<IService<symbol>[] | [], IService<symbol>[] | []>, "factory"> & {
|
|
3875
|
+
/**
|
|
3876
|
+
* A factory function responsible for creating a service instance.
|
|
3877
|
+
*/
|
|
3878
|
+
factory: (...args: any) => ReturnType<ServiceDefinition<IService<symbol>[] | [], IService<symbol>[] | []>["factory"]>;
|
|
3879
|
+
};
|
|
3880
|
+
/**
|
|
3881
|
+
* A service container manages the lifetimes of a set of services.
|
|
3882
|
+
* It takes care of instantiating the services in the correct order based on their dependencies,
|
|
3883
|
+
* passing dependencies through to services, and disposing of services when the container is disposed.
|
|
3884
|
+
*/
|
|
3885
|
+
export class ServiceContainer implements IDisposable {
|
|
3886
|
+
private readonly _friendlyName;
|
|
3887
|
+
private readonly _parent?;
|
|
3888
|
+
private _isDisposed;
|
|
3889
|
+
private readonly _serviceDefinitions;
|
|
3890
|
+
private readonly _serviceDependents;
|
|
3891
|
+
private readonly _serviceInstances;
|
|
3892
|
+
private readonly _children;
|
|
3893
|
+
/**
|
|
3894
|
+
* Creates a new ServiceContainer.
|
|
3895
|
+
* @param _friendlyName A human-readable name for debugging.
|
|
3896
|
+
* @param _parent An optional parent container. Dependencies not found locally will be resolved from the parent.
|
|
3897
|
+
*/
|
|
3898
|
+
constructor(_friendlyName: string, _parent?: ServiceContainer | undefined);
|
|
3899
|
+
/**
|
|
3900
|
+
* Adds a set of service definitions in the service container.
|
|
3901
|
+
* The services are sorted based on their dependencies.
|
|
3902
|
+
* @param args The service definitions to register, and optionally an abort signal.
|
|
3903
|
+
* @returns A disposable that will remove the service definition from the service container.
|
|
3904
|
+
*/
|
|
3905
|
+
addServicesAsync(...args: WeaklyTypedServiceDefinition[] | [...serviceDefinitions: WeaklyTypedServiceDefinition[], abortSignal: AbortSignal]): Promise<IDisposable>;
|
|
3906
|
+
/**
|
|
3907
|
+
* Registers a service definition in the service container.
|
|
3908
|
+
* @param serviceDefinition The service definition to register.
|
|
3909
|
+
* @param abortSignal An optional abort signal.
|
|
3910
|
+
* @returns A disposable that will remove the service definition from the service container.
|
|
3911
|
+
*/
|
|
3912
|
+
addServiceAsync<Produces extends IService<symbol>[] = [], Consumes extends IService<symbol>[] = []>(serviceDefinition: ServiceDefinition<Produces, Consumes>, abortSignal?: AbortSignal): Promise<IDisposable>;
|
|
3913
|
+
private _addServiceAsync;
|
|
3914
|
+
/**
|
|
3915
|
+
* Resolves a dependency by contract identity for a consuming service.
|
|
3916
|
+
* Checks local services first, then walks up the parent chain.
|
|
3917
|
+
* Registers the consumer as a dependent in whichever container owns the dependency.
|
|
3918
|
+
* @param contract The contract identity to resolve.
|
|
3919
|
+
* @param consumer The service definition that consumes this dependency.
|
|
3920
|
+
* @returns The resolved service instance.
|
|
3921
|
+
*/
|
|
3922
|
+
private _resolveDependency;
|
|
3923
|
+
/**
|
|
3924
|
+
* Removes a consumer from the dependent set for a given contract, checking locally first then the parent chain.
|
|
3925
|
+
* @param contract The contract identity.
|
|
3926
|
+
* @param consumer The service definition to remove as a dependent.
|
|
3927
|
+
*/
|
|
3928
|
+
private _removeDependentFromChain;
|
|
3929
|
+
private _removeService;
|
|
3930
|
+
/**
|
|
3931
|
+
* Disposes the service container and all contained services.
|
|
3932
|
+
* Throws if this container is still a parent of any live child containers.
|
|
3933
|
+
*/
|
|
3934
|
+
dispose(): void;
|
|
3935
|
+
}
|
|
3936
|
+
|
|
3937
|
+
}
|
|
3938
|
+
declare module "@onerjs/gui-editor/modularTool/misc/observableCollection" {
|
|
3939
|
+
import { IDisposable, IReadonlyObservable } from "@onerjs/core/index";
|
|
3940
|
+
/**
|
|
3941
|
+
* A collection of items that can be observed for changes.
|
|
3942
|
+
*/
|
|
3943
|
+
export class ObservableCollection<T> {
|
|
3944
|
+
private readonly _items;
|
|
3945
|
+
private readonly _keys;
|
|
3946
|
+
private readonly _observable;
|
|
3947
|
+
/**
|
|
3948
|
+
* An observable that notifies observers when the collection changes.
|
|
3949
|
+
*/
|
|
3950
|
+
get observable(): IReadonlyObservable<void>;
|
|
3951
|
+
/**
|
|
3952
|
+
* The items in the collection.
|
|
3953
|
+
*/
|
|
3954
|
+
get items(): readonly T[];
|
|
3955
|
+
/**
|
|
3956
|
+
* Adds an item to the collection.
|
|
3957
|
+
* @param item The item to add.
|
|
3958
|
+
* @returns A disposable that removes the item from the collection when disposed.
|
|
3959
|
+
*/
|
|
3960
|
+
add(item: T): IDisposable;
|
|
3961
|
+
}
|
|
3962
|
+
|
|
3963
|
+
}
|
|
3964
|
+
declare module "@onerjs/gui-editor/modularTool/misc/graphUtils" {
|
|
3965
|
+
/**
|
|
3966
|
+
* Performs a topological sort on a graph.
|
|
3967
|
+
* @param graph The set of nodes that make up the graph.
|
|
3968
|
+
* @param getAdjacentNodes A function that returns the adjacent nodes for a given node.
|
|
3969
|
+
* @param onSortedNode A function that is called for each node in the sorted order.
|
|
3970
|
+
* @remarks
|
|
3971
|
+
* This function allocates. Do not use it in the hot path. Instead use an instance of GraphUtils.
|
|
3972
|
+
*/
|
|
3973
|
+
export function SortGraph<NodeT>(graph: Iterable<NodeT>, getAdjacentNodes: (node: NodeT) => Iterable<NodeT>, onSortedNode: (node: NodeT) => void): void;
|
|
3974
|
+
/**
|
|
3975
|
+
* Traverses a graph.
|
|
3976
|
+
* @param graph The set of nodes that make up the graph.
|
|
3977
|
+
* @param getAdjacentNodes A function that returns the adjacent nodes for a given node.
|
|
3978
|
+
* @param onBeforeTraverse A function that is called before traversing each node.
|
|
3979
|
+
* @param onAfterTraverse A function that is called after traversing each node.
|
|
3980
|
+
* @remarks
|
|
3981
|
+
* This function allocates. Do not use it in the hot path. Instead use an instance of GraphUtils.
|
|
3982
|
+
*/
|
|
3983
|
+
export function TraverseGraph<NodeT>(graph: Iterable<NodeT>, getAdjacentNodes: (node: NodeT) => Iterable<NodeT> | null | undefined, onBeforeTraverse?: (node: NodeT) => void, onAfterTraverse?: (node: NodeT) => void): void;
|
|
3984
|
+
/**
|
|
3985
|
+
* A utility class for performing graph operations.
|
|
3986
|
+
* @remarks
|
|
3987
|
+
* The class allocates new objects, but each operation (e.g. sort, traverse) is allocation free. This is useful when used in the hot path.
|
|
3988
|
+
*/
|
|
3989
|
+
export class GraphUtils<DefaultNodeT = unknown> {
|
|
3990
|
+
private readonly _traversalState;
|
|
3991
|
+
private _isTraversing;
|
|
3992
|
+
/**
|
|
3993
|
+
* Performs a topological sort on a graph.
|
|
3994
|
+
* @param graph The set of nodes that make up the graph.
|
|
3995
|
+
* @param getAdjacentNodes A function that returns the adjacent nodes for a given node.
|
|
3996
|
+
* @param onSortedNode A function that is called for each node in the sorted order.
|
|
3997
|
+
*/
|
|
3998
|
+
sort<NodeT extends DefaultNodeT>(graph: Iterable<NodeT>, getAdjacentNodes: (node: NodeT) => Iterable<NodeT>, onSortedNode: (node: NodeT) => void): void;
|
|
3999
|
+
/**
|
|
4000
|
+
* Traverses a graph.
|
|
4001
|
+
* @param graph The set of nodes that make up the graph.
|
|
4002
|
+
* @param getAdjacentNodes A function that returns the adjacent nodes for a given node.
|
|
4003
|
+
* @param onBeforeTraverse A function that is called before traversing each node.
|
|
4004
|
+
* @param onAfterTraverse A function that is called after traversing each node.
|
|
4005
|
+
*/
|
|
4006
|
+
traverse<NodeT extends DefaultNodeT>(graph: Iterable<NodeT>, getAdjacentNodes: (node: NodeT) => Iterable<NodeT> | null | undefined, onBeforeTraverse?: (node: NodeT) => void, onAfterTraverse?: (node: NodeT) => void): void;
|
|
4007
|
+
private _traverseCore;
|
|
4008
|
+
}
|
|
4009
|
+
|
|
4010
|
+
}
|
|
4011
|
+
declare module "@onerjs/gui-editor/modularTool/misc/assert" {
|
|
4012
|
+
/**
|
|
4013
|
+
* Asserts that the given value is truthy.
|
|
4014
|
+
* @param value The value to check.
|
|
4015
|
+
*/
|
|
4016
|
+
export function Assert(value: unknown): asserts value;
|
|
4017
|
+
|
|
4018
|
+
}
|
|
4019
|
+
declare module "@onerjs/gui-editor/modularTool/hooks/useResizeHandle" {
|
|
4020
|
+
export type GrowDirection = "end" | "start" | "up" | "down";
|
|
4021
|
+
export type UseResizeHandleParams = {
|
|
4022
|
+
/**
|
|
4023
|
+
* The direction in which the element is considered growing in size ('end', 'start', 'up', or 'down').
|
|
4024
|
+
*/
|
|
4025
|
+
growDirection: GrowDirection;
|
|
4026
|
+
/**
|
|
4027
|
+
* The name of the CSS variable that will be set on the wrapper element to reflect the current size of the element.
|
|
4028
|
+
*/
|
|
4029
|
+
variableName: string;
|
|
4030
|
+
/**
|
|
4031
|
+
* A callback that will be called when the element is resized.
|
|
4032
|
+
*
|
|
4033
|
+
* @remarks The passed function should be memoized for better performance.
|
|
4034
|
+
*/
|
|
4035
|
+
onChange?: (value: number) => void;
|
|
4036
|
+
/**
|
|
4037
|
+
* The minimum change allowed (e.g. the smallest negative number allowed).
|
|
4038
|
+
*/
|
|
4039
|
+
minValue?: number;
|
|
4040
|
+
/**
|
|
4041
|
+
* The maximum change allowed (e.g. the largest positive number allowed).
|
|
4042
|
+
*/
|
|
4043
|
+
maxValue?: number;
|
|
4044
|
+
};
|
|
4045
|
+
/**
|
|
4046
|
+
* A custom hook that helps with element resizing.
|
|
4047
|
+
* @param params The parameters for the resize handle.
|
|
4048
|
+
* @returns An object containing refs and a function to set the value.
|
|
4049
|
+
*/
|
|
4050
|
+
export function useResizeHandle(params: UseResizeHandleParams): {
|
|
4051
|
+
elementRef: import("react").Dispatch<import("react").SetStateAction<HTMLElement | null>>;
|
|
4052
|
+
handleRef: import("react").Dispatch<import("react").SetStateAction<HTMLElement | null>>;
|
|
4053
|
+
setValue: (value: number) => void;
|
|
4054
|
+
};
|
|
4055
|
+
|
|
4056
|
+
}
|
|
4057
|
+
declare module "@onerjs/gui-editor/modularTool/hooks/themeHooks" {
|
|
4058
|
+
import { ThemeMode } from "@onerjs/gui-editor/modularTool/services/themeService";
|
|
4059
|
+
/**
|
|
4060
|
+
* Hook that provides the current theme mode state and controls for changing it.
|
|
4061
|
+
* @returns An object with the current dark mode state, theme mode, and functions to set or toggle the theme.
|
|
4062
|
+
*/
|
|
4063
|
+
export function useThemeMode(): {
|
|
4064
|
+
readonly isDarkMode: boolean;
|
|
4065
|
+
readonly themeMode: ThemeMode;
|
|
4066
|
+
readonly setThemeMode: (mode: ThemeMode) => void;
|
|
4067
|
+
readonly toggleThemeMode: () => void | undefined;
|
|
4068
|
+
};
|
|
4069
|
+
/**
|
|
4070
|
+
* Hook that returns the current Fluent UI theme based on the active theme mode.
|
|
4071
|
+
* @param invert If true, inverts the theme (returns light theme in dark mode and vice versa). Defaults to false.
|
|
4072
|
+
* @returns The current Fluent UI theme object.
|
|
4073
|
+
*/
|
|
4074
|
+
|
|
4075
|
+
|
|
4076
|
+
}
|
|
4077
|
+
declare module "@onerjs/gui-editor/modularTool/hooks/teachingMomentHooks" {
|
|
4078
|
+
import { Nullable } from "@onerjs/core/index";
|
|
4079
|
+
|
|
4080
|
+
/**
|
|
4081
|
+
* Creates a hook for managing teaching moment state.
|
|
4082
|
+
* @param name The unique name of the teaching moment.
|
|
4083
|
+
* @returns A hook that returns the teaching moment state.
|
|
4084
|
+
*/
|
|
4085
|
+
export function MakeTeachingMoment(name: string): (suppress?: boolean) => {
|
|
4086
|
+
readonly shouldDisplay: boolean;
|
|
4087
|
+
readonly onDismissed: () => void;
|
|
4088
|
+
readonly reset: () => void;
|
|
4089
|
+
};
|
|
4090
|
+
/**
|
|
4091
|
+
* Creates a hook for managing teaching moment state for a dialog.
|
|
4092
|
+
* @param name The unique name of the teaching moment.
|
|
4093
|
+
* @returns A hook that returns the teaching moment state for a dialog.
|
|
4094
|
+
*/
|
|
4095
|
+
export function MakeDialogTeachingMoment(name: string): (suppress?: boolean) => {
|
|
4096
|
+
readonly shouldDisplay: boolean;
|
|
4097
|
+
readonly onOpenChange: (e: unknown, data: any) => void;
|
|
4098
|
+
readonly reset: () => void;
|
|
4099
|
+
};
|
|
4100
|
+
/**
|
|
4101
|
+
* Creates a hook for managing teaching moment state for a popover.
|
|
4102
|
+
* @param name The unique name of the teaching moment.
|
|
4103
|
+
* @returns A hook that returns the teaching moment state for a popover.
|
|
4104
|
+
*/
|
|
4105
|
+
export function MakePopoverTeachingMoment(name: string): (suppress?: boolean) => {
|
|
4106
|
+
readonly shouldDisplay: boolean;
|
|
4107
|
+
readonly positioningRef: import("react").Dispatch<import("react").SetStateAction<Nullable<any>>>;
|
|
4108
|
+
readonly targetRef: import("react").Dispatch<import("react").SetStateAction<Nullable<HTMLElement>>>;
|
|
4109
|
+
readonly onOpenChange: (e: unknown, data: any) => void;
|
|
4110
|
+
readonly reset: () => void;
|
|
4111
|
+
};
|
|
4112
|
+
|
|
4113
|
+
}
|
|
4114
|
+
declare module "@onerjs/gui-editor/modularTool/hooks/settingsHooks" {
|
|
4115
|
+
import { Dispatch, SetStateAction } from "react";
|
|
4116
|
+
import { SettingDescriptor } from "@onerjs/gui-editor/modularTool/services/settingsStore";
|
|
4117
|
+
/**
|
|
4118
|
+
* Hook that reads and writes a setting from the settings store.
|
|
4119
|
+
* @param descriptor The setting descriptor that identifies the setting and its default value.
|
|
4120
|
+
* @returns A tuple of [currentValue, setValue, resetValue] similar to React's useState.
|
|
4121
|
+
*/
|
|
4122
|
+
export function useSetting<T>(descriptor: SettingDescriptor<T>): [T, Dispatch<SetStateAction<T>>, () => void];
|
|
4123
|
+
|
|
4124
|
+
}
|
|
4125
|
+
declare module "@onerjs/gui-editor/modularTool/hooks/resourceHooks" {
|
|
4126
|
+
import { DependencyList } from "react";
|
|
4127
|
+
import { IDisposable } from "@onerjs/core/index";
|
|
4128
|
+
/**
|
|
4129
|
+
* Custom hook to manage a resource with automatic disposal. The resource is created once initially, and recreated
|
|
4130
|
+
* if the factory function or any dependency changes. Whenever the resource is recreated, the previous instance is
|
|
4131
|
+
* disposed. The final instance is disposed when the component using this hook unmounts.
|
|
4132
|
+
* @param factory A function that creates the resource.
|
|
4133
|
+
* @param deps An optional dependency list. When any dependency changes, the resource is disposed and recreated.
|
|
4134
|
+
* @returns The created resource.
|
|
4135
|
+
*/
|
|
4136
|
+
export function useResource<T extends IDisposable | null | undefined>(factory: () => T, deps?: DependencyList): T;
|
|
4137
|
+
/**
|
|
4138
|
+
* Custom hook to manage an asynchronous resource with automatic disposal. The resource is created once initially, and recreated
|
|
4139
|
+
* if the factory function or any dependency changes. Whenever the resource is recreated, the previous instance is
|
|
4140
|
+
* disposed. The final instance is disposed when the component using this hook unmounts.
|
|
4141
|
+
* @param factory A function that creates the resource.
|
|
4142
|
+
* @param deps An optional dependency list. When any dependency changes, the resource is disposed and recreated.
|
|
4143
|
+
* @returns The created resource.
|
|
4144
|
+
*/
|
|
4145
|
+
export function useAsyncResource<T extends IDisposable | null | undefined>(factory: (abortSignal: AbortSignal) => Promise<T>, deps?: DependencyList): T | undefined;
|
|
4146
|
+
|
|
4147
|
+
}
|
|
4148
|
+
declare module "@onerjs/gui-editor/modularTool/hooks/observableHooks" {
|
|
4149
|
+
import { IReadonlyObservable } from "@onerjs/core/index";
|
|
4150
|
+
import { ObservableCollection } from "@onerjs/gui-editor/modularTool/misc/observableCollection";
|
|
4151
|
+
/**
|
|
4152
|
+
* Returns the current value of the accessor and updates it when the specified event is fired on the specified element.
|
|
4153
|
+
* @param accessor A function that returns the current value.
|
|
4154
|
+
* @param element The element to listen for the event on.
|
|
4155
|
+
* @param eventNames The names of the events to listen for.
|
|
4156
|
+
* @returns The current value of the accessor.
|
|
4157
|
+
* * @remarks If the accessor function is not idempotent (e.g. it returns a different array or object instance each time it is called),
|
|
4158
|
+
* then there is a good chance it should be wrapped in a `useCallback` to prevent unnecessary re-renders or re-render infinite loops.
|
|
4159
|
+
*/
|
|
4160
|
+
export function useEventfulState<T>(accessor: () => T, element: HTMLElement | null | undefined, ...eventNames: string[]): T;
|
|
4161
|
+
/**
|
|
4162
|
+
* Returns the current value of the accessor and updates it when any of the specified observables change.
|
|
4163
|
+
* @param accessor A function that returns the current value.
|
|
4164
|
+
* @param observables The observables to listen for changes on.
|
|
4165
|
+
* @returns The current value of the accessor.
|
|
4166
|
+
* @remarks If the accessor function is not idempotent (e.g. it returns a different array or object instance each time it is called),
|
|
4167
|
+
* then there is a good chance it should be wrapped in a `useCallback` to prevent unnecessary re-renders or re-render infinite loops.
|
|
4168
|
+
*/
|
|
4169
|
+
export function useObservableState<T>(accessor: () => T, ...observables: Array<IReadonlyObservable | null | undefined>): T;
|
|
4170
|
+
/**
|
|
4171
|
+
* Returns a copy of the items in the collection and updates it when the collection changes.
|
|
4172
|
+
* @param collection The collection to observe.
|
|
4173
|
+
* @returns A copy of the items in the collection.
|
|
4174
|
+
*/
|
|
4175
|
+
export function useObservableCollection<T>(collection: ObservableCollection<T>): T[];
|
|
4176
|
+
/**
|
|
4177
|
+
* Returns a copy of the items in the collection sorted by the order property and updates it when the collection changes.
|
|
4178
|
+
* @param collection The collection to observe.
|
|
4179
|
+
* @returns A copy of the items in the collection sorted by the order property.
|
|
4180
|
+
*/
|
|
4181
|
+
export function useOrderedObservableCollection<T extends Readonly<{
|
|
4182
|
+
order?: number;
|
|
4183
|
+
}>>(collection: ObservableCollection<T>): T[];
|
|
4184
|
+
|
|
4185
|
+
}
|
|
4186
|
+
declare module "@onerjs/gui-editor/modularTool/extensibility/extensionManager" {
|
|
4187
|
+
import { IDisposable } from "@onerjs/core/index";
|
|
4188
|
+
import { ServiceContainer } from "@onerjs/gui-editor/modularTool/modularity/serviceContainer";
|
|
4189
|
+
import { IExtensionFeed, ExtensionMetadata } from "@onerjs/gui-editor/modularTool/extensibility/extensionFeed";
|
|
4190
|
+
/**
|
|
4191
|
+
* Represents a loaded extension.
|
|
4192
|
+
*/
|
|
4193
|
+
export interface IExtension {
|
|
4194
|
+
/**
|
|
4195
|
+
* The metadata for the extension.
|
|
4196
|
+
*/
|
|
4197
|
+
readonly metadata: ExtensionMetadata;
|
|
4198
|
+
/**
|
|
4199
|
+
* Whether the extension is currently being installed, uninstalled, enabled, or disabled.
|
|
4200
|
+
*/
|
|
4201
|
+
readonly isStateChanging: boolean;
|
|
4202
|
+
/**
|
|
4203
|
+
* Whether the extension is enabled.
|
|
4204
|
+
*/
|
|
4205
|
+
readonly isInstalled: boolean;
|
|
4206
|
+
/**
|
|
4207
|
+
* Installs the extension.
|
|
4208
|
+
*/
|
|
4209
|
+
installAsync(): Promise<void>;
|
|
4210
|
+
/**
|
|
4211
|
+
* Uninstalls the extension.
|
|
4212
|
+
*/
|
|
4213
|
+
uninstallAsync(): Promise<void>;
|
|
4214
|
+
/**
|
|
4215
|
+
* Adds a handler that is called when the state of the extension changes.
|
|
4216
|
+
* @param handler The handler to add.
|
|
4217
|
+
* @returns A disposable that removes the handler when disposed.
|
|
4218
|
+
*/
|
|
4219
|
+
addStateChangedHandler(handler: () => void): IDisposable;
|
|
4220
|
+
}
|
|
4221
|
+
/**
|
|
4222
|
+
* Provides information about an extension installation failure.
|
|
4223
|
+
*/
|
|
4224
|
+
export type InstallFailedInfo = {
|
|
4225
|
+
/**
|
|
4226
|
+
* The metadata of the extension that failed to install.
|
|
4227
|
+
*/
|
|
4228
|
+
extension: ExtensionMetadata;
|
|
4229
|
+
/**
|
|
4230
|
+
* The error that occurred during the installation.
|
|
4231
|
+
*/
|
|
4232
|
+
error: unknown;
|
|
4233
|
+
};
|
|
4234
|
+
/**
|
|
4235
|
+
* Represents a query for loaded extensions.
|
|
4236
|
+
*/
|
|
4237
|
+
export interface IExtensionQuery {
|
|
4238
|
+
/**
|
|
4239
|
+
* The total number of extensions that satisfy the query.
|
|
4240
|
+
*/
|
|
4241
|
+
readonly totalCount: number;
|
|
4242
|
+
/**
|
|
4243
|
+
* Fetches a range of extensions from the query.
|
|
4244
|
+
* @param index The index of the first extension to fetch.
|
|
4245
|
+
* @param count The number of extensions to fetch.
|
|
4246
|
+
* @returns A promise that resolves to the extensions.
|
|
4247
|
+
*/
|
|
4248
|
+
getExtensionsAsync(index: number, count: number): Promise<IExtension[]>;
|
|
4249
|
+
}
|
|
4250
|
+
/**
|
|
4251
|
+
* Manages the installation, uninstallation, enabling, and disabling of extensions.
|
|
4252
|
+
*/
|
|
4253
|
+
export class ExtensionManager implements IDisposable {
|
|
4254
|
+
private readonly _namespace;
|
|
4255
|
+
private readonly _serviceContainer;
|
|
4256
|
+
private readonly _feeds;
|
|
4257
|
+
private readonly _onInstallFailed;
|
|
4258
|
+
private readonly _installedExtensions;
|
|
4259
|
+
private readonly _stateChangedHandlers;
|
|
4260
|
+
private constructor();
|
|
4261
|
+
/**
|
|
4262
|
+
* Creates a new instance of the ExtensionManager.
|
|
4263
|
+
* This will automatically rehydrate previously installed and enabled extensions.
|
|
4264
|
+
* @param namespace The namespace to use for storing extension state in local storage.
|
|
4265
|
+
* @param serviceContainer The service container to use.
|
|
4266
|
+
* @param feeds The extension feeds to include.
|
|
4267
|
+
* @param onInstallFailed A callback that is called when an extension installation fails.
|
|
4268
|
+
* @returns A promise that resolves to the new instance of the ExtensionManager.
|
|
4269
|
+
*/
|
|
4270
|
+
static CreateAsync(namespace: string, serviceContainer: ServiceContainer, feeds: readonly IExtensionFeed[], onInstallFailed: (info: InstallFailedInfo) => void): Promise<ExtensionManager>;
|
|
4271
|
+
/**
|
|
4272
|
+
* Gets the names of the feeds that are included in the extension manager.
|
|
4273
|
+
* @returns The names of the feeds.
|
|
4274
|
+
*/
|
|
4275
|
+
get feedNames(): string[];
|
|
4276
|
+
/**
|
|
4277
|
+
* Queries the extension manager for extensions.
|
|
4278
|
+
* @param filter The filter to apply to the query.
|
|
4279
|
+
* @param feeds The feeds to include in the query.
|
|
4280
|
+
* @param installedOnly Whether to only include installed extensions.
|
|
4281
|
+
* @returns A promise that resolves to the extension query.
|
|
4282
|
+
*/
|
|
4283
|
+
queryExtensionsAsync(filter?: string, feeds?: string[], installedOnly?: boolean): Promise<IExtensionQuery>;
|
|
4284
|
+
/**
|
|
4285
|
+
* Disposes the extension manager.
|
|
4286
|
+
*/
|
|
4287
|
+
dispose(): void;
|
|
4288
|
+
private _getInstalledExtensionStorageKey;
|
|
4289
|
+
private _updateInstalledExtensionsStorage;
|
|
4290
|
+
private _installAsync;
|
|
4291
|
+
private _uninstallAsync;
|
|
4292
|
+
private _enableAsync;
|
|
4293
|
+
private _disableAsync;
|
|
4294
|
+
private _addStateChangedHandler;
|
|
4295
|
+
private _createExtension;
|
|
4296
|
+
private _createInstalledExtension;
|
|
4297
|
+
}
|
|
4298
|
+
|
|
4299
|
+
}
|
|
4300
|
+
declare module "@onerjs/gui-editor/modularTool/extensibility/extensionFeed" {
|
|
4301
|
+
import { WeaklyTypedServiceDefinition } from "@onerjs/gui-editor/modularTool/modularity/serviceContainer";
|
|
4302
|
+
export type PersonMetadata = {
|
|
4303
|
+
/**
|
|
4304
|
+
* The name of the person.
|
|
4305
|
+
*/
|
|
4306
|
+
readonly name: string;
|
|
4307
|
+
/**
|
|
4308
|
+
* The email address of the person.
|
|
4309
|
+
*/
|
|
4310
|
+
readonly email?: string;
|
|
4311
|
+
/**
|
|
4312
|
+
* The URL to the person's website.
|
|
4313
|
+
*/
|
|
4314
|
+
readonly url?: string;
|
|
4315
|
+
/**
|
|
4316
|
+
* The Babylon forum username of the person.
|
|
4317
|
+
*/
|
|
4318
|
+
readonly forumUserName?: string;
|
|
4319
|
+
/**
|
|
4320
|
+
* A base64 encoded PNG image to use as the person's avatar.
|
|
4321
|
+
*/
|
|
4322
|
+
readonly avatar?: string;
|
|
4323
|
+
};
|
|
4324
|
+
export type ExtensionMetadata = {
|
|
4325
|
+
/**
|
|
4326
|
+
* The name of the extension.
|
|
4327
|
+
*/
|
|
4328
|
+
readonly name: string;
|
|
4329
|
+
/**
|
|
4330
|
+
* The version of the extension (as valid semver).
|
|
4331
|
+
*/
|
|
4332
|
+
readonly version?: string;
|
|
4333
|
+
/**
|
|
4334
|
+
* The description of the extension.
|
|
4335
|
+
*/
|
|
4336
|
+
readonly description: string;
|
|
4337
|
+
/**
|
|
4338
|
+
* The keywords of the extension.
|
|
4339
|
+
*/
|
|
4340
|
+
readonly keywords?: readonly string[];
|
|
4341
|
+
/**
|
|
4342
|
+
* The URL to the extension homepage.
|
|
4343
|
+
*/
|
|
4344
|
+
readonly homepage?: string;
|
|
4345
|
+
/**
|
|
4346
|
+
* Specify the place where your code lives. This is helpful for people who want to contribute.
|
|
4347
|
+
*/
|
|
4348
|
+
readonly repository?: string;
|
|
4349
|
+
/**
|
|
4350
|
+
* The URL to your extension's issue tracker and / or the email address to which issues should be reported. These are helpful for people who encounter issues with your extension.
|
|
4351
|
+
*/
|
|
4352
|
+
readonly bugs?: string;
|
|
4353
|
+
/**
|
|
4354
|
+
* A license for your package so that people know how they are permitted to use it, and any restrictions you're placing on it.
|
|
4355
|
+
*/
|
|
4356
|
+
readonly license?: string;
|
|
4357
|
+
/**
|
|
4358
|
+
* The primary author of the extension.
|
|
4359
|
+
*/
|
|
4360
|
+
readonly author?: string | PersonMetadata;
|
|
4361
|
+
/**
|
|
4362
|
+
* The contributors to the extension.
|
|
4363
|
+
*/
|
|
4364
|
+
readonly contributors?: readonly (string | PersonMetadata)[];
|
|
4365
|
+
};
|
|
4366
|
+
export type ExtensionModule = {
|
|
4367
|
+
/**
|
|
4368
|
+
* The default export of the module (e.g. export default).
|
|
4369
|
+
*/
|
|
4370
|
+
default: {
|
|
4371
|
+
/**
|
|
4372
|
+
* The services that are included with the extension.
|
|
4373
|
+
*/
|
|
4374
|
+
serviceDefinitions?: readonly WeaklyTypedServiceDefinition[];
|
|
4375
|
+
};
|
|
4376
|
+
};
|
|
4377
|
+
/**
|
|
4378
|
+
* Represents a query to fetch subset ranges of extension metadata from a feed.
|
|
4379
|
+
*/
|
|
4380
|
+
export interface IExtensionMetadataQuery {
|
|
4381
|
+
/**
|
|
4382
|
+
* The total number of extensions that satisfy the query.
|
|
4383
|
+
*/
|
|
4384
|
+
readonly totalCount: number;
|
|
4385
|
+
/**
|
|
4386
|
+
* Fetches a range of extension metadata from the feed.
|
|
4387
|
+
* @param index The index of the first extension to fetch.
|
|
4388
|
+
* @param count The number of extensions to fetch.
|
|
4389
|
+
* @returns A promise that resolves to the extension metadata.
|
|
4390
|
+
*/
|
|
4391
|
+
getExtensionMetadataAsync(index: number, count: number): Promise<readonly ExtensionMetadata[]>;
|
|
4392
|
+
}
|
|
4393
|
+
/**
|
|
4394
|
+
* Represents a feed/source of extensions.
|
|
4395
|
+
*/
|
|
4396
|
+
export interface IExtensionFeed {
|
|
4397
|
+
/**
|
|
4398
|
+
* The name of the feed.
|
|
4399
|
+
*/
|
|
4400
|
+
readonly name: string;
|
|
4401
|
+
/**
|
|
4402
|
+
* Creates an extension metadata query given a filter.
|
|
4403
|
+
* @param filter The filter to apply to the query.
|
|
4404
|
+
* @returns A promise that resolves to the extension metadata query.
|
|
4405
|
+
*/
|
|
4406
|
+
queryExtensionsAsync(filter?: string): Promise<IExtensionMetadataQuery>;
|
|
4407
|
+
/**
|
|
4408
|
+
* Gets the extension module for the specified extension.
|
|
4409
|
+
* @param name The name of the extension.
|
|
4410
|
+
* @returns A promise that resolves to the extension module.
|
|
4411
|
+
*/
|
|
4412
|
+
getExtensionModuleAsync(name: string): Promise<ExtensionModule | undefined>;
|
|
4413
|
+
}
|
|
4414
|
+
|
|
4415
|
+
}
|
|
4416
|
+
declare module "@onerjs/gui-editor/modularTool/extensibility/builtInsExtensionFeed" {
|
|
4417
|
+
import { IExtensionFeed, ExtensionMetadata, IExtensionMetadataQuery, ExtensionModule } from "@onerjs/gui-editor/modularTool/extensibility/extensionFeed";
|
|
4418
|
+
export type BuiltInExtension = ExtensionMetadata & {
|
|
4419
|
+
/**
|
|
4420
|
+
* Gets the extension module, typically dynamically importing the extension.
|
|
4421
|
+
* @returns The extension module (e.g. a collection of ServiceDefinitions).
|
|
4422
|
+
*/
|
|
4423
|
+
getExtensionModuleAsync(): Promise<ExtensionModule>;
|
|
4424
|
+
};
|
|
4425
|
+
/**
|
|
4426
|
+
* A simple extension feed implementation that provides a fixed set of "built in" extensions.
|
|
4427
|
+
* "Built in" in this context means extensions that are known at bundling time, and included
|
|
4428
|
+
* in the bundle. Each extension can be dynamically imported so they are split into separate
|
|
4429
|
+
* bundle chunks and downloaded only when first installed.
|
|
4430
|
+
*/
|
|
4431
|
+
export class BuiltInsExtensionFeed implements IExtensionFeed {
|
|
4432
|
+
readonly name: string;
|
|
4433
|
+
private readonly _extensions;
|
|
4434
|
+
constructor(name: string, extensions: Iterable<BuiltInExtension>);
|
|
4435
|
+
queryExtensionsAsync(filter?: string): Promise<IExtensionMetadataQuery>;
|
|
4436
|
+
getExtensionModuleAsync(name: string): Promise<ExtensionModule | undefined>;
|
|
4437
|
+
}
|
|
4438
|
+
|
|
4439
|
+
}
|
|
4440
|
+
declare module "@onerjs/gui-editor/modularTool/contexts/settingsContext" {
|
|
4441
|
+
import { ISettingsStore } from "@onerjs/gui-editor/modularTool/services/settingsStore";
|
|
4442
|
+
export const SettingsStoreContext: import("react").Context<ISettingsStore | undefined>;
|
|
4443
|
+
export function useSettingsStore(): ISettingsStore | undefined;
|
|
4444
|
+
|
|
4445
|
+
}
|
|
4446
|
+
declare module "@onerjs/gui-editor/modularTool/contexts/extensionManagerContext" {
|
|
4447
|
+
import { ExtensionManager } from "@onerjs/gui-editor/modularTool/extensibility/extensionManager";
|
|
4448
|
+
export type ExtensionManagerContext = {
|
|
4449
|
+
readonly extensionManager: ExtensionManager;
|
|
4450
|
+
};
|
|
4451
|
+
export const ExtensionManagerContext: import("react").Context<ExtensionManagerContext | undefined>;
|
|
4452
|
+
export function useExtensionManager(): ExtensionManager | undefined;
|
|
4453
|
+
|
|
4454
|
+
}
|
|
4455
|
+
declare module "@onerjs/gui-editor/modularTool/components/uxContextProvider" {
|
|
4456
|
+
import { FunctionComponent, PropsWithChildren } from "react";
|
|
4457
|
+
export const UXContextProvider: FunctionComponent<PropsWithChildren>;
|
|
4458
|
+
|
|
4459
|
+
}
|
|
4460
|
+
declare module "@onerjs/gui-editor/modularTool/components/theme" {
|
|
4461
|
+
|
|
4462
|
+
import { FunctionComponent } from "react";
|
|
4463
|
+
/**
|
|
4464
|
+
* A themed Fluent UI provider that applies the current theme mode (light or dark).
|
|
4465
|
+
* @param props Fluent provider props, plus an optional `invert` flag to swap the theme.
|
|
4466
|
+
* @returns The themed Fluent UI provider component.
|
|
4467
|
+
*/
|
|
4468
|
+
export const Theme: FunctionComponent<any & {
|
|
4469
|
+
invert?: boolean;
|
|
4470
|
+
}>;
|
|
4471
|
+
|
|
4472
|
+
}
|
|
4473
|
+
declare module "@onerjs/gui-editor/modularTool/components/teachingMoment" {
|
|
4474
|
+
import { FunctionComponent } from "react";
|
|
4475
|
+
import { MakePopoverTeachingMoment } from "@onerjs/gui-editor/modularTool/hooks/teachingMomentHooks";
|
|
4476
|
+
/**
|
|
4477
|
+
* The state returned by the teaching moment hook.
|
|
4478
|
+
*/
|
|
4479
|
+
type TeachingMomentState = ReturnType<ReturnType<typeof MakePopoverTeachingMoment>>;
|
|
4480
|
+
/**
|
|
4481
|
+
* Props for the {@link TeachingMoment} component.
|
|
4482
|
+
*/
|
|
4483
|
+
type TeachingMomentProps = Pick<TeachingMomentState, "shouldDisplay" | "positioningRef" | "onOpenChange"> & {
|
|
4484
|
+
title: string;
|
|
4485
|
+
description: string;
|
|
4486
|
+
};
|
|
4487
|
+
/**
|
|
4488
|
+
* A component that displays a teaching moment popover.
|
|
4489
|
+
* @param props Props for the teaching moment popover.
|
|
4490
|
+
* @returns The teaching moment popover.
|
|
4491
|
+
*/
|
|
4492
|
+
export const TeachingMoment: FunctionComponent<TeachingMomentProps>;
|
|
4493
|
+
export {};
|
|
4494
|
+
|
|
4495
|
+
}
|
|
4496
|
+
declare module "@onerjs/gui-editor/modularTool/components/pane" {
|
|
4497
|
+
/**
|
|
4498
|
+
* Used to apply common styles to panes.
|
|
4499
|
+
*/
|
|
4500
|
+
export const SidePaneContainer: import("react").ForwardRefExoticComponent<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
|
|
4501
|
+
|
|
4502
|
+
}
|
|
4503
|
+
declare module "@onerjs/gui-editor/modularTool/components/extensibleAccordion" {
|
|
4504
|
+
import { ComponentType, PropsWithChildren, Ref } from "react";
|
|
4505
|
+
import { AccordionProps } from "@onerjs/gui-editor/fluent/primitives/accordion";
|
|
4506
|
+
/**
|
|
4507
|
+
* Describes a section within a dynamic accordion that can be added at runtime.
|
|
4508
|
+
*/
|
|
4509
|
+
export type DynamicAccordionSection = Readonly<{
|
|
4510
|
+
/**
|
|
4511
|
+
* A unique identity for the section, which can be referenced by section content.
|
|
4512
|
+
*/
|
|
4513
|
+
identity: string;
|
|
4514
|
+
/**
|
|
4515
|
+
* An optional order for the section, relative to other sections.
|
|
4516
|
+
* Defaults to 0.
|
|
4517
|
+
*/
|
|
4518
|
+
order?: number;
|
|
4519
|
+
/**
|
|
4520
|
+
* An optional flag indicating whether the section should be collapsed by default.
|
|
4521
|
+
* Defaults to false.
|
|
4522
|
+
*/
|
|
4523
|
+
collapseByDefault?: boolean;
|
|
4524
|
+
}>;
|
|
4525
|
+
/**
|
|
4526
|
+
* Describes content that belongs to a section within a dynamic accordion.
|
|
4527
|
+
*/
|
|
4528
|
+
export type DynamicAccordionSectionContent<ContextT> = Readonly<{
|
|
4529
|
+
/**
|
|
4530
|
+
* A unique key for the the content.
|
|
4531
|
+
*/
|
|
4532
|
+
key: string;
|
|
4533
|
+
/**
|
|
4534
|
+
* The section this content belongs to.
|
|
4535
|
+
*/
|
|
4536
|
+
section: string;
|
|
4537
|
+
/**
|
|
4538
|
+
* An optional order for the content within the section.
|
|
4539
|
+
* Defaults to 0.
|
|
4540
|
+
*/
|
|
4541
|
+
order?: number;
|
|
4542
|
+
/**
|
|
4543
|
+
* The React component that will be rendered for this content.
|
|
4544
|
+
*/
|
|
4545
|
+
component: ComponentType<{
|
|
4546
|
+
context: ContextT;
|
|
4547
|
+
}>;
|
|
4548
|
+
}>;
|
|
4549
|
+
/**
|
|
4550
|
+
* Imperative handle for controlling section highlights on the extensible accordion.
|
|
4551
|
+
*/
|
|
4552
|
+
export type SectionsImperativeRef = {
|
|
4553
|
+
/**
|
|
4554
|
+
* Highlights the specified sections, collapsing all others until the context changes.
|
|
4555
|
+
* @param sections The identity strings of the sections to highlight.
|
|
4556
|
+
*/
|
|
4557
|
+
highlightSections: (sections: readonly string[]) => void;
|
|
4558
|
+
};
|
|
4559
|
+
/**
|
|
4560
|
+
* An accordion component that supports dynamically adding sections and section content at runtime.
|
|
4561
|
+
* Combines statically defined children sections with dynamically registered sections and content.
|
|
4562
|
+
* @param props The accordion props including sections, section content, context, and an optional imperative ref.
|
|
4563
|
+
* @returns The extensible accordion component.
|
|
4564
|
+
*/
|
|
4565
|
+
export function ExtensibleAccordion<ContextT = unknown>(props: PropsWithChildren<{
|
|
4566
|
+
sections: readonly DynamicAccordionSection[];
|
|
4567
|
+
sectionContent: readonly DynamicAccordionSectionContent<ContextT>[];
|
|
4568
|
+
context: ContextT;
|
|
4569
|
+
sectionsRef?: Ref<SectionsImperativeRef>;
|
|
4570
|
+
} & AccordionProps>): import("react/jsx-runtime").JSX.Element;
|
|
4571
|
+
|
|
4572
|
+
}
|
|
4573
|
+
declare module "@onerjs/gui-editor/modularTool/components/errorBoundary" {
|
|
4574
|
+
import { ErrorInfo, ReactNode, Component } from "react";
|
|
4575
|
+
/**
|
|
4576
|
+
* Props for the {@link ErrorBoundary} component.
|
|
4577
|
+
*/
|
|
4578
|
+
type ErrorBoundaryProps = {
|
|
4579
|
+
/** Child components to render */
|
|
4580
|
+
children: ReactNode;
|
|
4581
|
+
/** Optional fallback UI to show on error */
|
|
4582
|
+
fallback?: ReactNode;
|
|
4583
|
+
/** Optional callback when an error occurs */
|
|
4584
|
+
onError?: (error: Error, errorInfo: ErrorInfo) => void;
|
|
4585
|
+
/** Optional name for identifying this boundary in logs */
|
|
4586
|
+
name?: string;
|
|
4587
|
+
};
|
|
4588
|
+
type ErrorBoundaryState = {
|
|
4589
|
+
hasError: boolean;
|
|
4590
|
+
error: Error | null;
|
|
4591
|
+
errorInfo: ErrorInfo | null;
|
|
4592
|
+
};
|
|
4593
|
+
/**
|
|
4594
|
+
* Error boundary component that catches JavaScript errors in child components
|
|
4595
|
+
* and displays a fallback UI instead of crashing the entire application.
|
|
4596
|
+
*/
|
|
4597
|
+
export class ErrorBoundary extends Component<ErrorBoundaryProps, ErrorBoundaryState> {
|
|
4598
|
+
constructor(props: ErrorBoundaryProps);
|
|
4599
|
+
static getDerivedStateFromError(error: Error): Partial<ErrorBoundaryState>;
|
|
4600
|
+
componentDidCatch(error: Error, errorInfo: ErrorInfo): void;
|
|
4601
|
+
private _handleRetry;
|
|
4602
|
+
render(): string | number | boolean | Iterable<ReactNode> | import("react/jsx-runtime").JSX.Element | null | undefined;
|
|
4603
|
+
}
|
|
4604
|
+
export {};
|
|
4605
|
+
|
|
3300
4606
|
}
|
|
3301
4607
|
declare module "@onerjs/gui-editor/lines/vector4LineComponent" {
|
|
3302
4608
|
import * as React from "react";
|