@salsita-ai/sdk 0.50.0-develop.334b422a4f → 0.50.0-develop.3986957af6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/application-spec/generate-application/code/templates/skills/sdk-content.d.ts +11 -5
- package/dist/application-spec/generate-application/code/templates/skills/sdk-content.js +1 -1
- package/dist/application-spec/generate-application/runtime/admin-runtime/admin-runtime.d.ts +3 -2
- package/dist/application-spec/generate-application/runtime/admin-runtime/admin-runtime.js +1 -1
- package/dist/application-spec/generate-application/runtime/application-runtime.d.ts +12 -4
- package/dist/application-spec/generate-application/runtime/application-runtime.js +1 -1
- package/dist/application-spec/generate-application/runtime/configurator-runtime/configurator-runtime.d.ts +3 -3
- package/dist/application-spec/generate-application/runtime/configurator-runtime/configurator-runtime.js +1 -1
- package/dist/application-spec/generate-application/runtime/sections/expression-runtime.d.ts +9 -3
- package/dist/application-spec/generate-application/runtime/sections/expression-runtime.js +1 -1
- package/dist/configurator/application-runtime/extensions/systems/assistant-system/assistant-system.d.ts +4 -3
- package/dist/configurator/application-runtime/extensions/systems/assistant-system/assistant-system.js +1 -1
- package/dist/configurator/application-runtime/extensions/systems/assistant-system/graphql-tools.d.ts +21 -5
- package/dist/configurator/application-runtime/extensions/systems/assistant-system/graphql-tools.js +1 -1
- package/dist/configurator/common/configurator-interface.d.ts +6 -1
- package/dist/configurator/common/configurator-interface.js +1 -1
- package/dist/configurator/configurator-context/ConfiguratorResponsiveProvider.d.ts +3 -3
- package/dist/configurator/configurator-context/ConfiguratorResponsiveProvider.js +1 -1
- package/dist/configurator/configurator-context/PreviewContextProvider.js +1 -1
- package/dist/configurator/ui/configurator-layout/universal/use-layout-scene-safe-area.js +1 -1
- package/dist/configurator/ui/save-message-snackbars/SaveMessageSnackbars.js +1 -1
- package/dist/docs/index.json +12 -1
- package/dist/docs/integrations/webcomponent-api/basics.mdx +2 -0
- package/dist/docs/layouts/custom-layout.mdx +318 -158
- package/dist/docs/layouts/gallery/ardent-compressor.mdx +1 -0
- package/dist/docs/layouts/gallery/fenwick-window.mdx +198 -127
- package/dist/docs/layouts/gallery/ferrule-bar-station.mdx +6567 -0
- package/dist/docs/layouts/gallery/sunfold-solar.mdx +16 -4
- package/dist/docs/phoenix/configurator-interface.mdx +4 -3
- package/dist/docs/phoenix/sessions-and-access.mdx +2 -0
- package/dist/domain/application/web-component-property.d.ts +3 -1
- package/dist/domain/application/web-component-property.js +1 -1
- package/dist/domain/domain-builder.d.ts +9 -3
- package/dist/domain/domain-builder.js +1 -1
- package/dist/domain/domain-runtime/domain-context/selectors.d.ts +1 -0
- package/dist/domain/domain-runtime/domain-context/selectors.js +1 -1
- package/dist/domain/domain-runtime/domain-runtime.d.ts +4 -0
- package/dist/domain/domain-runtime/errors/implementation-error-collector.d.ts +2 -0
- package/dist/domain/domain-runtime/errors/implementation-error-collector.js +1 -1
- package/dist/domain/domain-runtime/index.d.ts +1 -1
- package/dist/domain/domain-runtime/index.js +1 -1
- package/dist/domain/domain-runtime/spec/index.d.ts +1 -1
- package/dist/domain/domain-runtime/spec/index.js +1 -1
- package/dist/domain/domain-runtime/spec/module-checks/index.d.ts +1 -0
- package/dist/domain/domain-runtime/spec/module-checks/index.js +1 -1
- package/dist/domain/domain-runtime/spec/module-checks/merge-expression-modules.d.ts +23 -0
- package/dist/domain/domain-runtime/spec/module-checks/merge-expression-modules.js +1 -0
- package/dist/domain/domain-runtime/spec/module-checks/resolve-expression-modules.d.ts +3 -4
- package/dist/domain/domain-runtime/spec/module-checks/resolve-expression-modules.js +1 -1
- package/dist/domain/mocks/create-mock-domain-runtime.d.ts +2 -0
- package/dist/editor/domain-editors/DomainSpecContext.js +1 -1
- package/dist/editor/domain-editors/use-implementation-files.d.ts +6 -11
- package/dist/editor/domain-editors/use-implementation-files.js +1 -1
- package/dist/legacy/domain-cli/utils/cache.d.ts +1 -1
- package/dist/legacy/domain-cli/utils/cache.js +1 -1
- package/dist/legacy/phoenix-cli/project-gen/generators/file-templates/agents/claude-md.d.ts +1 -1
- package/dist/legacy/phoenix-cli/project-gen/generators/file-templates/agents/cursor-rules.d.ts +1 -1
- package/dist/legacy/phoenix-cli/project-gen/generators/file-templates/agents/shared-sdk-content.d.ts +1 -1
- package/dist/legacy/phoenix-cli/project-gen/generators/file-templates/agents/shared-sdk-content.js +11 -5
- package/dist/react-sdk/application-runtime/hooks/index.d.ts +1 -0
- package/dist/react-sdk/application-runtime/hooks/index.js +1 -1
- package/dist/react-sdk/application-runtime/hooks/responsive/index.d.ts +3 -0
- package/dist/react-sdk/application-runtime/hooks/responsive/index.js +1 -0
- package/dist/react-sdk/application-runtime/hooks/responsive/use-responsive-actions.d.ts +9 -0
- package/dist/react-sdk/application-runtime/hooks/responsive/use-responsive-actions.js +1 -0
- package/dist/react-sdk/application-runtime/hooks/responsive/use-responsive-application.d.ts +26 -0
- package/dist/react-sdk/application-runtime/hooks/responsive/use-responsive-application.js +1 -0
- package/dist/react-sdk/application-runtime/hooks/responsive/use-responsive-state.d.ts +10 -0
- package/dist/react-sdk/application-runtime/hooks/responsive/use-responsive-state.js +1 -0
- package/dist/react-sdk/application-runtime/hooks/responsive/use-responsive-store.d.ts +24 -0
- package/dist/react-sdk/application-runtime/hooks/responsive/use-responsive-store.js +1 -0
- package/dist/react-sdk/application-runtime/hooks/use-access-service.d.ts +5 -0
- package/dist/react-sdk/application-runtime/hooks/use-access-service.js +1 -1
- package/dist/react-sdk/application-runtime/index.d.ts +1 -0
- package/dist/react-sdk/application-runtime/mocks/create-mock-application-runtime.js +1 -1
- package/dist/react-sdk/application-runtime/responsive/actions.d.ts +47 -0
- package/dist/react-sdk/application-runtime/responsive/actions.js +1 -0
- package/dist/react-sdk/application-runtime/responsive/index.d.ts +4 -0
- package/dist/react-sdk/application-runtime/responsive/index.js +1 -0
- package/dist/react-sdk/application-runtime/responsive/initialize.d.ts +3 -0
- package/dist/react-sdk/application-runtime/responsive/initialize.js +1 -0
- package/dist/react-sdk/application-runtime/responsive/selectors.d.ts +20 -0
- package/dist/react-sdk/application-runtime/responsive/selectors.js +1 -0
- package/dist/react-sdk/application-runtime/responsive/types.d.ts +104 -0
- package/dist/react-sdk/application-runtime/runtime/create-application-runtime.d.ts +91 -0
- package/dist/react-sdk/application-runtime/runtime/create-application-runtime.js +1 -1
- package/dist/react-sdk/domain-context/common-hooks/index.d.ts +1 -0
- package/dist/react-sdk/domain-context/common-hooks/index.js +1 -1
- package/dist/react-sdk/domain-context/common-hooks/use-configuration-save-state.d.ts +23 -0
- package/dist/react-sdk/domain-context/common-hooks/use-configuration-save-state.js +1 -0
- package/dist/react-sdk/domain-context/common-hooks/use-domain-context.d.ts +1 -0
- package/dist/react-sdk/domain-context/index.d.ts +1 -0
- package/dist/react-sdk/domain-context/index.js +1 -1
- package/dist/react-sdk/index.d.ts +0 -1
- package/dist/react-sdk/index.js +1 -1
- package/dist/react-sdk/web-component/create-web-component.js +1 -1
- package/dist/ui-sdk/responsive-application/ResponsiveApplicationProvider.d.ts +2 -2
- package/dist/ui-sdk/responsive-application/responsive-state-store.d.ts +11 -9
- package/dist/ui-sdk/responsive-application/use-store-responsive-info.js +1 -1
- package/package.json +3 -3
- package/dist/react-sdk/responsive-state/ResponsiveStateProvider.d.ts +0 -25
- package/dist/react-sdk/responsive-state/ResponsiveStateProvider.js +0 -1
- package/dist/react-sdk/responsive-state/canvas-padding.d.ts +0 -14
- package/dist/react-sdk/responsive-state/index.d.ts +0 -5
- package/dist/react-sdk/responsive-state/index.js +0 -1
- package/dist/react-sdk/responsive-state/responsive-state-manager.d.ts +0 -111
- package/dist/react-sdk/responsive-state/responsive-state-manager.js +0 -1
- package/dist/react-sdk/responsive-state/use-responsive-state-manager.d.ts +0 -10
- package/dist/react-sdk/responsive-state/use-responsive-state-manager.js +0 -1
- package/dist/react-sdk/responsive-state/use-responsive-state.d.ts +0 -11
- package/dist/react-sdk/responsive-state/use-responsive-state.js +0 -1
- /package/dist/react-sdk/{responsive-state/canvas-padding.js → application-runtime/responsive/types.js} +0 -0
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The part of the canvas, in pixels from each edge, that overlay UI covers. The camera frames the
|
|
3
|
+
* scene inside what is left, so the scene stays visible beside a sidebar or under a preview body.
|
|
4
|
+
*
|
|
5
|
+
* @internal Runtime plumbing for the SDK's own UI. A project layout uses `useActiveViewports()`
|
|
6
|
+
* from `@salsita-ai/sdk/react` and `useSceneSafeArea()` from `@salsita-ai/sdk/configurator`.
|
|
7
|
+
*/
|
|
8
|
+
export interface CanvasPadding {
|
|
9
|
+
readonly top: number;
|
|
10
|
+
readonly right: number;
|
|
11
|
+
readonly bottom: number;
|
|
12
|
+
readonly left: number;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* The widths, in pixels, that split the application's root container into phone, tablet and
|
|
16
|
+
* desktop. The theme decides them; the UI library pushes its theme's values in with
|
|
17
|
+
* `setBreakpoints`.
|
|
18
|
+
*
|
|
19
|
+
* @internal Runtime plumbing for the SDK's own UI. A project layout uses `useActiveViewports()`
|
|
20
|
+
* from `@salsita-ai/sdk/react` and `useSceneSafeArea()` from `@salsita-ai/sdk/configurator`.
|
|
21
|
+
*/
|
|
22
|
+
export interface ResponsiveBreakpoints {
|
|
23
|
+
readonly sm: number;
|
|
24
|
+
readonly md: number;
|
|
25
|
+
readonly lg: number;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* One measurement of the application's root container. The orientation comes from the window,
|
|
29
|
+
* not from the container's aspect ratio.
|
|
30
|
+
*
|
|
31
|
+
* @internal Runtime plumbing for the SDK's own UI. A project layout uses `useActiveViewports()`
|
|
32
|
+
* from `@salsita-ai/sdk/react` and `useSceneSafeArea()` from `@salsita-ai/sdk/configurator`.
|
|
33
|
+
*/
|
|
34
|
+
export interface ResponsiveViewport {
|
|
35
|
+
readonly width: number;
|
|
36
|
+
readonly height: number;
|
|
37
|
+
readonly isLandscape: boolean;
|
|
38
|
+
readonly isPortrait: boolean;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* The size of the application's root container, rounded up to whole pixels.
|
|
42
|
+
*
|
|
43
|
+
* @internal Runtime plumbing for the SDK's own UI. A project layout uses `useActiveViewports()`
|
|
44
|
+
* from `@salsita-ai/sdk/react` and `useSceneSafeArea()` from `@salsita-ai/sdk/configurator`.
|
|
45
|
+
*/
|
|
46
|
+
export interface ResponsiveViewportSize {
|
|
47
|
+
readonly width: number;
|
|
48
|
+
readonly height: number;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* The responsive state of one mounted application: what it measured of its root container, the
|
|
52
|
+
* breakpoints that classify it, the canvas padding the scene is framed with, and whether the
|
|
53
|
+
* container is expanded over the host page, hidden, or in a layout animation.
|
|
54
|
+
*
|
|
55
|
+
* The configurator's root container writes it while it is mounted and resets it when it unmounts.
|
|
56
|
+
*
|
|
57
|
+
* @internal Runtime plumbing for the SDK's own UI. A project layout uses `useActiveViewports()`
|
|
58
|
+
* from `@salsita-ai/sdk/react` and `useSceneSafeArea()` from `@salsita-ai/sdk/configurator`.
|
|
59
|
+
*/
|
|
60
|
+
export interface ResponsiveApplicationState {
|
|
61
|
+
/** `null` until the root container is measured for the first time. */
|
|
62
|
+
readonly viewport: ResponsiveViewport | null;
|
|
63
|
+
readonly breakpoints: ResponsiveBreakpoints;
|
|
64
|
+
readonly canvasPadding: CanvasPadding;
|
|
65
|
+
readonly isExpanded: boolean;
|
|
66
|
+
readonly isHidden: boolean;
|
|
67
|
+
readonly isAnimating: boolean;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* The `responsive` slice, one entry per application: an admin that embeds a configurator runs both
|
|
71
|
+
* in one runtime, and each has its own root container.
|
|
72
|
+
*
|
|
73
|
+
* @internal Runtime plumbing for the SDK's own UI. A project layout uses `useActiveViewports()`
|
|
74
|
+
* from `@salsita-ai/sdk/react` and `useSceneSafeArea()` from `@salsita-ai/sdk/configurator`.
|
|
75
|
+
*/
|
|
76
|
+
export interface ResponsiveRuntimeState {
|
|
77
|
+
readonly configurator: ResponsiveApplicationState;
|
|
78
|
+
readonly admin: ResponsiveApplicationState;
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* The responsive state the UI and the lifecycle read: the size classes of the root container, the
|
|
82
|
+
* canvas padding, and whether the container is expanded, hidden or animating.
|
|
83
|
+
*
|
|
84
|
+
* Every size class is `false` until the container is measured for the first time.
|
|
85
|
+
*
|
|
86
|
+
* @internal Runtime plumbing for the SDK's own UI. A project layout uses `useActiveViewports()`
|
|
87
|
+
* from `@salsita-ai/sdk/react` and `useSceneSafeArea()` from `@salsita-ai/sdk/configurator`.
|
|
88
|
+
*/
|
|
89
|
+
export interface ResponsiveState {
|
|
90
|
+
/** `width < sm` */
|
|
91
|
+
readonly isPhone: boolean;
|
|
92
|
+
/** `width <= md` */
|
|
93
|
+
readonly isMobile: boolean;
|
|
94
|
+
/** `sm < width < lg` */
|
|
95
|
+
readonly isTablet: boolean;
|
|
96
|
+
/** `width > md` */
|
|
97
|
+
readonly isDesktop: boolean;
|
|
98
|
+
readonly isLandscape: boolean;
|
|
99
|
+
readonly isPortrait: boolean;
|
|
100
|
+
readonly canvasPadding: CanvasPadding;
|
|
101
|
+
readonly isExpanded: boolean;
|
|
102
|
+
readonly isHidden: boolean;
|
|
103
|
+
readonly isAnimating: boolean;
|
|
104
|
+
}
|
|
@@ -2,11 +2,13 @@ import { BehaviorSubject } from 'rxjs';
|
|
|
2
2
|
import { type AnyApplicationConfig, type DomainRuntimeState, type WebComponentOptions } from '#package/domain';
|
|
3
3
|
import { type AnyApplicationRuntimeExtension, type DomainApplicationContextSelectors } from '../domain-application-context/index.js';
|
|
4
4
|
import { type IntegrationState } from '../integration/index.js';
|
|
5
|
+
import { type ResponsiveRuntimeState } from '../responsive/index.js';
|
|
5
6
|
import { type RoutingRuntimeState } from '../routing/index.js';
|
|
6
7
|
import { type ApplicationSessionRuntime, SessionService } from '../session/index.js';
|
|
7
8
|
import type { WebComponentApi } from '../web-component/index.js';
|
|
8
9
|
export interface ApplicationRuntimeState extends DomainRuntimeState {
|
|
9
10
|
readonly integration: IntegrationState;
|
|
11
|
+
readonly responsive: ResponsiveRuntimeState;
|
|
10
12
|
readonly routing: RoutingRuntimeState;
|
|
11
13
|
readonly session: ApplicationSessionRuntime;
|
|
12
14
|
}
|
|
@@ -48,6 +50,7 @@ export declare function createApplicationRuntimeSlices<State extends Application
|
|
|
48
50
|
webComponent: import("#package/domain").ApplicationWebComponentState;
|
|
49
51
|
domainContext: import("#package/domain").ApplicationDomainContextState;
|
|
50
52
|
integration: IntegrationState;
|
|
53
|
+
responsive: ResponsiveRuntimeState;
|
|
51
54
|
routing: RoutingRuntimeState;
|
|
52
55
|
session: ApplicationSessionRuntime;
|
|
53
56
|
};
|
|
@@ -424,6 +427,7 @@ export declare function createApplicationRuntimeSlices<State extends Application
|
|
|
424
427
|
getMigrate: () => import("#package/domain").MigrateFunction<import("#package/domain").DomainEntity<string>>;
|
|
425
428
|
getActiveMode: () => import("#package/domain").DomainMode;
|
|
426
429
|
getIsInitialized: () => boolean;
|
|
430
|
+
getIsViewMode: () => boolean;
|
|
427
431
|
getComponentReaderIndexes: () => import("#package/domain").ComponentReaderIndexes;
|
|
428
432
|
getStoreRuntimeDependencies: () => {
|
|
429
433
|
componentReaderIndexes: import("#package/domain").ComponentReaderIndexes;
|
|
@@ -533,6 +537,7 @@ export declare function createApplicationRuntimeSlices<State extends Application
|
|
|
533
537
|
getMigrate: () => import("#package/domain").MigrateFunction<import("#package/domain").DomainEntity<string>>;
|
|
534
538
|
getActiveMode: () => import("#package/domain").DomainMode;
|
|
535
539
|
getIsInitialized: () => boolean;
|
|
540
|
+
getIsViewMode: () => boolean;
|
|
536
541
|
getComponentReaderIndexes: () => import("#package/domain").ComponentReaderIndexes;
|
|
537
542
|
getStoreRuntimeDependencies: () => {
|
|
538
543
|
componentReaderIndexes: import("#package/domain").ComponentReaderIndexes;
|
|
@@ -608,6 +613,24 @@ export declare function createApplicationRuntimeSlices<State extends Application
|
|
|
608
613
|
getPresetEmbeddedState: () => import("../index.js").PresetEmbeddedView | null;
|
|
609
614
|
getRecipeEmbeddedState: () => import("../index.js").RecipeEmbeddedView | null;
|
|
610
615
|
};
|
|
616
|
+
responsive: {
|
|
617
|
+
configurator: {
|
|
618
|
+
selectResponsiveState: import("@salsita-ai/common/utils").Selector<import("../responsive/selectors.js").ResponsiveSelectorState, import("../index.js").ResponsiveState>;
|
|
619
|
+
selectViewportSize: import("@salsita-ai/common/utils").Selector<import("../responsive/selectors.js").ResponsiveSelectorState, import("../index.js").ResponsiveViewportSize>;
|
|
620
|
+
selectCanvasPadding: import("@salsita-ai/common/utils").Selector<import("../responsive/selectors.js").ResponsiveSelectorState, import("../index.js").CanvasPadding>;
|
|
621
|
+
getResponsiveState: () => import("../index.js").ResponsiveState;
|
|
622
|
+
getViewportSize: () => import("../index.js").ResponsiveViewportSize;
|
|
623
|
+
getCanvasPadding: () => import("../index.js").CanvasPadding;
|
|
624
|
+
};
|
|
625
|
+
admin: {
|
|
626
|
+
selectResponsiveState: import("@salsita-ai/common/utils").Selector<import("../responsive/selectors.js").ResponsiveSelectorState, import("../index.js").ResponsiveState>;
|
|
627
|
+
selectViewportSize: import("@salsita-ai/common/utils").Selector<import("../responsive/selectors.js").ResponsiveSelectorState, import("../index.js").ResponsiveViewportSize>;
|
|
628
|
+
selectCanvasPadding: import("@salsita-ai/common/utils").Selector<import("../responsive/selectors.js").ResponsiveSelectorState, import("../index.js").CanvasPadding>;
|
|
629
|
+
getResponsiveState: () => import("../index.js").ResponsiveState;
|
|
630
|
+
getViewportSize: () => import("../index.js").ResponsiveViewportSize;
|
|
631
|
+
getCanvasPadding: () => import("../index.js").CanvasPadding;
|
|
632
|
+
};
|
|
633
|
+
};
|
|
611
634
|
routing: {
|
|
612
635
|
selectRoutingState: import("@salsita-ai/common/utils").Selector<import("../index.js").RoutingSelectorState, import("../index.js").RoutingState>;
|
|
613
636
|
selectEffectiveRoutingState: import("@salsita-ai/common/utils").Selector<import("../index.js").RoutingSelectorState, import("../index.js").RoutingState>;
|
|
@@ -703,6 +726,30 @@ export declare function createApplicationRuntimeSlices<State extends Application
|
|
|
703
726
|
enterEmbeddedView: (view: import("../index.js").EmbeddedView) => void;
|
|
704
727
|
exitEmbeddedView: () => void;
|
|
705
728
|
};
|
|
729
|
+
responsive: {
|
|
730
|
+
configurator: {
|
|
731
|
+
setViewport: (viewport: import("../index.js").ResponsiveViewport) => void;
|
|
732
|
+
setBreakpoints: (breakpoints: import("../index.js").ResponsiveBreakpoints) => void;
|
|
733
|
+
setCanvasPadding: (canvasPadding: import("../index.js").CanvasPadding) => void;
|
|
734
|
+
expand: () => void;
|
|
735
|
+
collapse: () => void;
|
|
736
|
+
hide: () => void;
|
|
737
|
+
show: () => void;
|
|
738
|
+
setAnimating: (isAnimating: boolean) => void;
|
|
739
|
+
reset: () => void;
|
|
740
|
+
};
|
|
741
|
+
admin: {
|
|
742
|
+
setViewport: (viewport: import("../index.js").ResponsiveViewport) => void;
|
|
743
|
+
setBreakpoints: (breakpoints: import("../index.js").ResponsiveBreakpoints) => void;
|
|
744
|
+
setCanvasPadding: (canvasPadding: import("../index.js").CanvasPadding) => void;
|
|
745
|
+
expand: () => void;
|
|
746
|
+
collapse: () => void;
|
|
747
|
+
hide: () => void;
|
|
748
|
+
show: () => void;
|
|
749
|
+
setAnimating: (isAnimating: boolean) => void;
|
|
750
|
+
reset: () => void;
|
|
751
|
+
};
|
|
752
|
+
};
|
|
706
753
|
routing: {
|
|
707
754
|
setRoutingState: (routingState: import("../index.js").RoutingState) => void;
|
|
708
755
|
};
|
|
@@ -1093,6 +1140,7 @@ declare const createApplicationRuntimeImpl: <EXTENSIONS extends readonly AnyAppl
|
|
|
1093
1140
|
getMigrate: () => import("#package/domain").MigrateFunction<import("#package/domain").DomainEntity<string>>;
|
|
1094
1141
|
getActiveMode: () => import("#package/domain").DomainMode;
|
|
1095
1142
|
getIsInitialized: () => boolean;
|
|
1143
|
+
getIsViewMode: () => boolean;
|
|
1096
1144
|
getComponentReaderIndexes: () => import("#package/domain").ComponentReaderIndexes;
|
|
1097
1145
|
getStoreRuntimeDependencies: () => {
|
|
1098
1146
|
componentReaderIndexes: import("#package/domain").ComponentReaderIndexes;
|
|
@@ -1202,6 +1250,7 @@ declare const createApplicationRuntimeImpl: <EXTENSIONS extends readonly AnyAppl
|
|
|
1202
1250
|
getMigrate: () => import("#package/domain").MigrateFunction<import("#package/domain").DomainEntity<string>>;
|
|
1203
1251
|
getActiveMode: () => import("#package/domain").DomainMode;
|
|
1204
1252
|
getIsInitialized: () => boolean;
|
|
1253
|
+
getIsViewMode: () => boolean;
|
|
1205
1254
|
getComponentReaderIndexes: () => import("#package/domain").ComponentReaderIndexes;
|
|
1206
1255
|
getStoreRuntimeDependencies: () => {
|
|
1207
1256
|
componentReaderIndexes: import("#package/domain").ComponentReaderIndexes;
|
|
@@ -1277,6 +1326,24 @@ declare const createApplicationRuntimeImpl: <EXTENSIONS extends readonly AnyAppl
|
|
|
1277
1326
|
getPresetEmbeddedState: () => import("../index.js").PresetEmbeddedView | null;
|
|
1278
1327
|
getRecipeEmbeddedState: () => import("../index.js").RecipeEmbeddedView | null;
|
|
1279
1328
|
};
|
|
1329
|
+
responsive: {
|
|
1330
|
+
configurator: {
|
|
1331
|
+
selectResponsiveState: import("@salsita-ai/common/utils").Selector<import("../responsive/selectors.js").ResponsiveSelectorState, import("../index.js").ResponsiveState>;
|
|
1332
|
+
selectViewportSize: import("@salsita-ai/common/utils").Selector<import("../responsive/selectors.js").ResponsiveSelectorState, import("../index.js").ResponsiveViewportSize>;
|
|
1333
|
+
selectCanvasPadding: import("@salsita-ai/common/utils").Selector<import("../responsive/selectors.js").ResponsiveSelectorState, import("../index.js").CanvasPadding>;
|
|
1334
|
+
getResponsiveState: () => import("../index.js").ResponsiveState;
|
|
1335
|
+
getViewportSize: () => import("../index.js").ResponsiveViewportSize;
|
|
1336
|
+
getCanvasPadding: () => import("../index.js").CanvasPadding;
|
|
1337
|
+
};
|
|
1338
|
+
admin: {
|
|
1339
|
+
selectResponsiveState: import("@salsita-ai/common/utils").Selector<import("../responsive/selectors.js").ResponsiveSelectorState, import("../index.js").ResponsiveState>;
|
|
1340
|
+
selectViewportSize: import("@salsita-ai/common/utils").Selector<import("../responsive/selectors.js").ResponsiveSelectorState, import("../index.js").ResponsiveViewportSize>;
|
|
1341
|
+
selectCanvasPadding: import("@salsita-ai/common/utils").Selector<import("../responsive/selectors.js").ResponsiveSelectorState, import("../index.js").CanvasPadding>;
|
|
1342
|
+
getResponsiveState: () => import("../index.js").ResponsiveState;
|
|
1343
|
+
getViewportSize: () => import("../index.js").ResponsiveViewportSize;
|
|
1344
|
+
getCanvasPadding: () => import("../index.js").CanvasPadding;
|
|
1345
|
+
};
|
|
1346
|
+
};
|
|
1280
1347
|
routing: {
|
|
1281
1348
|
selectRoutingState: import("@salsita-ai/common/utils").Selector<import("../index.js").RoutingSelectorState, import("../index.js").RoutingState>;
|
|
1282
1349
|
selectEffectiveRoutingState: import("@salsita-ai/common/utils").Selector<import("../index.js").RoutingSelectorState, import("../index.js").RoutingState>;
|
|
@@ -1372,6 +1439,30 @@ declare const createApplicationRuntimeImpl: <EXTENSIONS extends readonly AnyAppl
|
|
|
1372
1439
|
enterEmbeddedView: (view: import("../index.js").EmbeddedView) => void;
|
|
1373
1440
|
exitEmbeddedView: () => void;
|
|
1374
1441
|
};
|
|
1442
|
+
responsive: {
|
|
1443
|
+
configurator: {
|
|
1444
|
+
setViewport: (viewport: import("../index.js").ResponsiveViewport) => void;
|
|
1445
|
+
setBreakpoints: (breakpoints: import("../index.js").ResponsiveBreakpoints) => void;
|
|
1446
|
+
setCanvasPadding: (canvasPadding: import("../index.js").CanvasPadding) => void;
|
|
1447
|
+
expand: () => void;
|
|
1448
|
+
collapse: () => void;
|
|
1449
|
+
hide: () => void;
|
|
1450
|
+
show: () => void;
|
|
1451
|
+
setAnimating: (isAnimating: boolean) => void;
|
|
1452
|
+
reset: () => void;
|
|
1453
|
+
};
|
|
1454
|
+
admin: {
|
|
1455
|
+
setViewport: (viewport: import("../index.js").ResponsiveViewport) => void;
|
|
1456
|
+
setBreakpoints: (breakpoints: import("../index.js").ResponsiveBreakpoints) => void;
|
|
1457
|
+
setCanvasPadding: (canvasPadding: import("../index.js").CanvasPadding) => void;
|
|
1458
|
+
expand: () => void;
|
|
1459
|
+
collapse: () => void;
|
|
1460
|
+
hide: () => void;
|
|
1461
|
+
show: () => void;
|
|
1462
|
+
setAnimating: (isAnimating: boolean) => void;
|
|
1463
|
+
reset: () => void;
|
|
1464
|
+
};
|
|
1465
|
+
};
|
|
1375
1466
|
routing: {
|
|
1376
1467
|
setRoutingState: (routingState: import("../index.js").RoutingState) => void;
|
|
1377
1468
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{BehaviorSubject as e}from"rxjs";import{memoOnce as t}from"@salsita-ai/common/utils";import{ImplementationErrors as i,createDomainRuntimeSlices as n,findAssistantFormElementErrors as o,resolveIsDev as s}from"#package/domain";import{initializeAnalyticsService as r}from"../common-services/analytics/analytics-service.js";import{initializeI18n as a,initializeLogger as c}from"../common-services/initialize.js";import{createCommonServicesSelectors as l}from"../common-services/selectors.js";import{createDomainApplicationContextSelectors as m}from"../domain-application-context/index.js";import{createIntegrationActions as p,createIntegrationSelectors as u,initializeIntegration as g}from"../integration/index.js";import{
|
|
1
|
+
import{BehaviorSubject as e}from"rxjs";import{memoOnce as t}from"@salsita-ai/common/utils";import{ImplementationErrors as i,createDomainRuntimeSlices as n,findAssistantFormElementErrors as o,resolveIsDev as s}from"#package/domain";import{initializeAnalyticsService as r}from"../common-services/analytics/analytics-service.js";import{initializeI18n as a,initializeLogger as c}from"../common-services/initialize.js";import{createCommonServicesSelectors as l}from"../common-services/selectors.js";import{createDomainApplicationContextSelectors as m}from"../domain-application-context/index.js";import{createIntegrationActions as p,createIntegrationSelectors as u,initializeIntegration as g}from"../integration/index.js";import{createResponsiveActions as v,createResponsiveSelectors as d,initializeResponsive as S}from"../responsive/index.js";import{createRoutingActions as x,createRoutingSelectors as f,initializeRouting as C}from"../routing/index.js";import{SessionService as y,createSessionRuntimeActions as A,createSessionRuntimeSelectors as b,initializeSessionRuntime as j}from"../session/index.js";export function createApplicationRuntimeSlices(e){let{config:w,bootConfig:R,getSubject:h,getConfiguratorExtensions:E}=e,I=s(w),T=c(w,I),z={analyticsService:r(w,T,I),i18n:a(w),logger:T},{initialize:D,selectors:L,actions:O}=n({config:w,services:z,getSubject:h,getExtensionSystems:e=>Z[e].getInitializableSystems()}),U=D(),{assistant:k,elements:G}=U.spec.configurator,$=o(k?.formElements??[],G);if($.length>0)throw new i($);let q=p({setIntegration:e=>{let t=h(),i=e(t.value.integration);t.next({...t.value,integration:i})}}),B=u({getState:()=>h().value,actions:q}),F=g(),H=x({setRouting:e=>{let t=h(),i=e(t.value.routing);t.next({...t.value,routing:i})}}),J=f({getState:()=>h().value,actions:H,accessActions:O.access,loadedDataActions:O.loadedData,domainServicesSelectors:L.domainServices,overridesSelectors:L.overrides}),K=C(),M=v({setResponsive:e=>{let t=h(),i=e(t.value.responsive);i!==t.value.responsive&&t.next({...t.value,responsive:i})}}),N={configurator:d({getState:()=>h().value,applicationType:"configurator"}),admin:d({getState:()=>h().value,applicationType:"admin"})},P=S(),Q=l({getState:()=>h().value,environmentSelectors:L.environment,specSelectors:L.spec,accessSelectors:L.access,domainServicesSelectors:L.domainServices,webComponentOptions:R.webComponentOptions,webComponentApi:R.webComponentApi,getSessionService:()=>Y(),routingSelectors:J}),V=A({setSessionRuntime:e=>{let t=h(),i=e(t.value.session);t.next({...t.value,session:i})}}),W=b({getState:()=>h().value,sessionContextSelectors:L.sessionContext}),X=j(),Y=t(()=>new y({getLogger:()=>L.domainServices.getLogger(),getAnalyticsService:()=>L.domainServices.getAnalyticsService(),getUnauthenticatedClient:Q.getUnauthenticatedClient,environmentSelectors:L.environment,sessionActions:V,setSessionContext:O.sessionContext.setSessionContext,sessionSelectors:W,specSelectors:L.spec})),Z={configurator:m({applicationType:"configurator",commonServicesSelectors:Q,domainServicesSelectors:L.domainServices,domainContextSelectors:L.domainContext.configurator,getApplicationRuntimeExtensions:E}),admin:m({applicationType:"admin",commonServicesSelectors:Q,domainServicesSelectors:L.domainServices,domainContextSelectors:L.domainContext.admin,getApplicationRuntimeExtensions:()=>[]})};return T.info(`Configurator Application loaded with deployment ID: ${w.deploymentId}!`),T.appendToGlobalContext({deploymentId:w.deploymentId}),{getState:()=>h().value,initialize:()=>({...U,integration:F,responsive:P,routing:K,session:X}),selectors:{...L,commonServices:Q,integration:B,responsive:N,routing:J,session:W,domainApplicationContext:Z},actions:{...O,integration:q,responsive:M,routing:H,session:V}}}export function createApplicationRuntime(t,i,n){return((t,i,n)=>{let o=null,s=null,r=()=>{if(!o)throw Error("Subject not yet initialized!");return o},{initialize:a,...c}=createApplicationRuntimeSlices({config:t,bootConfig:i,getSubject:r,getConfiguratorExtensions:()=>s});return s=n?n(c):[],c.selectors.domainApplicationContext.configurator.getSystems(),o=new e(a()),{...c,getState:()=>r().value,subscribe:e=>{let t=r().subscribe(()=>e());return()=>t.unsubscribe()}}})(t,i,n)}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export*from"./use-configurator-messages.js";export*from"./use-domain-context.js";export*from"./use-entity-selector.js";export*from"./use-observable-selector.js";export*from"./use-slices.js";export*from"./use-state-slice.js";export*from"./use-state-validity.js";export*from"./use-store-selector.js";
|
|
1
|
+
export*from"./use-configuration-save-state.js";export*from"./use-configurator-messages.js";export*from"./use-domain-context.js";export*from"./use-entity-selector.js";export*from"./use-observable-selector.js";export*from"./use-slices.js";export*from"./use-state-slice.js";export*from"./use-state-validity.js";export*from"./use-store-selector.js";
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { type ConfigurationPersistSystemFailure } from '../../application-runtime/index.js';
|
|
2
|
+
/**
|
|
3
|
+
* The save status of the configuration, as `useConfigurationSaveState()` returns it.
|
|
4
|
+
*/
|
|
5
|
+
export interface ConfigurationSaveState {
|
|
6
|
+
/** The revision the configuration is at: the loaded one, then the one the latest save created. */
|
|
7
|
+
readonly revisionId: string;
|
|
8
|
+
/** Whether a save is running. */
|
|
9
|
+
readonly isSaving: boolean;
|
|
10
|
+
/**
|
|
11
|
+
* The latest failed save, `{ error, timestamp }` with `timestamp` in milliseconds since the epoch, or `null` once a
|
|
12
|
+
* later save succeeds or another configuration loads.
|
|
13
|
+
*/
|
|
14
|
+
readonly failure: ConfigurationPersistSystemFailure | null;
|
|
15
|
+
}
|
|
16
|
+
export type UseConfigurationSaveState = () => ConfigurationSaveState;
|
|
17
|
+
/**
|
|
18
|
+
* The save status of the configuration of the application this component is mounted in, read from its persist system:
|
|
19
|
+
* `revisionId`, `isSaving` and `failure`. An editable configuration saves committed changes on its own, three seconds
|
|
20
|
+
* after the last one; a read-only one never saves. Loading a configuration resets the status. Re-renders when any of
|
|
21
|
+
* the three changes; the returned object keeps its identity otherwise.
|
|
22
|
+
*/
|
|
23
|
+
export declare const useConfigurationSaveState: UseConfigurationSaveState;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{useMemo as e}from"react";import{useDomainApplication as r}from"../../application-runtime/index.js";import{useEagerObservableValue as o}from"./use-observable-selector.js";export const useConfigurationSaveState=()=>{let{configurationPersistSystem:t}=r(),i=o(t.revisionId$),a=o(t.saving$),n=o(t.failure$);return e(()=>({revisionId:i,isSaving:a,failure:n}),[i,a,n])};
|
|
@@ -69,6 +69,7 @@ export declare const useDomainContextSelectors: () => {
|
|
|
69
69
|
getMigrate: () => import("#package/domain").MigrateFunction<DomainEntity<string>>;
|
|
70
70
|
getActiveMode: () => import("#package/domain").DomainMode;
|
|
71
71
|
getIsInitialized: () => boolean;
|
|
72
|
+
getIsViewMode: () => boolean;
|
|
72
73
|
getComponentReaderIndexes: () => import("#package/domain").ComponentReaderIndexes;
|
|
73
74
|
getStoreRuntimeDependencies: () => {
|
|
74
75
|
componentReaderIndexes: import("#package/domain").ComponentReaderIndexes;
|
|
@@ -2,6 +2,7 @@ export { useDomain, type UseDomainContext } from './common-hooks/use-domain-cont
|
|
|
2
2
|
export { useStoreSelector, useRenderedSelector, useRenderedSelector$, useStoreSelector$, type UseSynchronizedSelector, type UseSynchronizedSelector$, } from './common-hooks/use-store-selector.js';
|
|
3
3
|
export { useEagerObservableSelector, usePatientObservableSelector, usePatientObservableValue, useEagerObservableValue, } from './common-hooks/use-observable-selector.js';
|
|
4
4
|
export { useStateValidity, type UseStateValidity, useMapViolationHints, type UseMapViolationHints, useControlViolations, type UseControlViolations, useFinalizeViolations, type UseFinalizeViolations, } from './common-hooks/use-state-validity.js';
|
|
5
|
+
export { useConfigurationSaveState, type UseConfigurationSaveState, type ConfigurationSaveState, } from './common-hooks/use-configuration-save-state.js';
|
|
5
6
|
export { useConfiguratorMessages, type UseConfiguratorMessages, type ConfiguratorMessage, } from './common-hooks/use-configurator-messages.js';
|
|
6
7
|
export { useComponent, useRenderedComponent, type UseComponent, useComponents, useDynamicComponents, useRenderedComponents, type UseComponents, useRootComponents, useRootRenderedComponents, type UseRootComponents, useFirstComponent, useFirstRenderedComponent, type UseFirstComponent, useFirstRootComponent, useFirstRootRenderedComponent, type UseFirstRootComponent, } from './component-hooks/use-component.js';
|
|
7
8
|
export { useCommittedState, useCommittedSlice, useRenderedSlice, useRenderedState, type UseSlice, type UseState, } from './common-hooks/use-slices.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export{useDomain}from"./common-hooks/use-domain-context.js";export{useStoreSelector,useRenderedSelector,useRenderedSelector$,useStoreSelector$}from"./common-hooks/use-store-selector.js";export{useEagerObservableSelector,usePatientObservableSelector,usePatientObservableValue,useEagerObservableValue}from"./common-hooks/use-observable-selector.js";export{useStateValidity,useMapViolationHints,useControlViolations,useFinalizeViolations}from"./common-hooks/use-state-validity.js";export{useConfiguratorMessages}from"./common-hooks/use-configurator-messages.js";export{useComponent,useRenderedComponent,useComponents,useDynamicComponents,useRenderedComponents,useRootComponents,useRootRenderedComponents,useFirstComponent,useFirstRenderedComponent,useFirstRootComponent,useFirstRootRenderedComponent}from"./component-hooks/use-component.js";export{useCommittedState,useCommittedSlice,useRenderedSlice,useRenderedState}from"./common-hooks/use-slices.js";export{useDomainEntityState,useDomainEntityRenderedState}from"./entity-hooks/use-domain-entity-state.js";export{useEntityPrice,useRootEntityPrice}from"./entity-hooks/use-entity-price.js";export{useSelectEntity,useSelectedEntity,useSelectedEntityId,useSelectedDomainEntityId,useDeselect,useSelectParent}from"./system-hooks/selection-hooks.js";export{useActiveNavigationState,useActiveViewState,useSetViewState,useActiveToolState,useIsFullscreenActive,useSetFullscreen,useActiveViewports,useDraggedDomainEntityId,useNavigate,usePushNavigate,usePopNavigate}from"./system-hooks/navigation-hooks.js";export{useComposition}from"./system-hooks/composition-hooks.js";export{useUndoRedo}from"./system-hooks/undo-redo-hooks.js";export{useTabNavigation}from"./system-hooks/tab-navigation-hooks.js";export{useStepNavigation}from"./system-hooks/step-navigation-hooks.js";export{useLocaleSwitch}from"./system-hooks/locale-switch-hooks.js";export{useGenerateShareLink}from"./system-hooks/generate-share-link-hooks.js";export{useShareLinks}from"./system-hooks/share-links-hooks.js";export{useHoveredDomainEntityId,useHoveredEntity,useHoveredEntityId}from"./system-hooks/hover-hooks.js";export{useRootEntityState,useRootEntityRenderedState}from"./entity-hooks/use-root-entity-state.js";export{useRootEntityId,useRootEntityRenderedId}from"./entity-hooks/use-root-entity-id.js";export{useEntitySelector,useRootEntitySelector,useRenderedEntitySelector,useRenderedRootEntitySelector}from"./common-hooks/use-entity-selector.js";export{useDimensionState,useDimensions,useDimensionConfig}from"./system-hooks/dimension-hooks.js";
|
|
1
|
+
export{useDomain}from"./common-hooks/use-domain-context.js";export{useStoreSelector,useRenderedSelector,useRenderedSelector$,useStoreSelector$}from"./common-hooks/use-store-selector.js";export{useEagerObservableSelector,usePatientObservableSelector,usePatientObservableValue,useEagerObservableValue}from"./common-hooks/use-observable-selector.js";export{useStateValidity,useMapViolationHints,useControlViolations,useFinalizeViolations}from"./common-hooks/use-state-validity.js";export{useConfigurationSaveState}from"./common-hooks/use-configuration-save-state.js";export{useConfiguratorMessages}from"./common-hooks/use-configurator-messages.js";export{useComponent,useRenderedComponent,useComponents,useDynamicComponents,useRenderedComponents,useRootComponents,useRootRenderedComponents,useFirstComponent,useFirstRenderedComponent,useFirstRootComponent,useFirstRootRenderedComponent}from"./component-hooks/use-component.js";export{useCommittedState,useCommittedSlice,useRenderedSlice,useRenderedState}from"./common-hooks/use-slices.js";export{useDomainEntityState,useDomainEntityRenderedState}from"./entity-hooks/use-domain-entity-state.js";export{useEntityPrice,useRootEntityPrice}from"./entity-hooks/use-entity-price.js";export{useSelectEntity,useSelectedEntity,useSelectedEntityId,useSelectedDomainEntityId,useDeselect,useSelectParent}from"./system-hooks/selection-hooks.js";export{useActiveNavigationState,useActiveViewState,useSetViewState,useActiveToolState,useIsFullscreenActive,useSetFullscreen,useActiveViewports,useDraggedDomainEntityId,useNavigate,usePushNavigate,usePopNavigate}from"./system-hooks/navigation-hooks.js";export{useComposition}from"./system-hooks/composition-hooks.js";export{useUndoRedo}from"./system-hooks/undo-redo-hooks.js";export{useTabNavigation}from"./system-hooks/tab-navigation-hooks.js";export{useStepNavigation}from"./system-hooks/step-navigation-hooks.js";export{useLocaleSwitch}from"./system-hooks/locale-switch-hooks.js";export{useGenerateShareLink}from"./system-hooks/generate-share-link-hooks.js";export{useShareLinks}from"./system-hooks/share-links-hooks.js";export{useHoveredDomainEntityId,useHoveredEntity,useHoveredEntityId}from"./system-hooks/hover-hooks.js";export{useRootEntityState,useRootEntityRenderedState}from"./entity-hooks/use-root-entity-state.js";export{useRootEntityId,useRootEntityRenderedId}from"./entity-hooks/use-root-entity-id.js";export{useEntitySelector,useRootEntitySelector,useRenderedEntitySelector,useRenderedRootEntitySelector}from"./common-hooks/use-entity-selector.js";export{useDimensionState,useDimensions,useDimensionConfig}from"./system-hooks/dimension-hooks.js";
|
|
@@ -8,7 +8,6 @@ export * from './invalid-deployment/index.js';
|
|
|
8
8
|
export * from './web-component/index.js';
|
|
9
9
|
export * from './localizable/index.js';
|
|
10
10
|
export * from './loading-state/index.js';
|
|
11
|
-
export * from './responsive-state/index.js';
|
|
12
11
|
export * from './elements/index.js';
|
|
13
12
|
export * from './scene-control-elements/index.js';
|
|
14
13
|
export * from './handlers/index.js';
|
package/dist/react-sdk/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export*from"./theme/index.js";export*from"./utils/index.js";export*from"./session/index.js";export*from"./domain-context/index.js";export*from"./domain-application-context/index.js";export*from"./domain-controls/index.js";export*from"./invalid-deployment/index.js";export*from"./web-component/index.js";export*from"./localizable/index.js";export*from"./loading-state/index.js";export*from"./
|
|
1
|
+
export*from"./theme/index.js";export*from"./utils/index.js";export*from"./session/index.js";export*from"./domain-context/index.js";export*from"./domain-application-context/index.js";export*from"./domain-controls/index.js";export*from"./invalid-deployment/index.js";export*from"./web-component/index.js";export*from"./localizable/index.js";export*from"./loading-state/index.js";export*from"./elements/index.js";export*from"./scene-control-elements/index.js";export*from"./handlers/index.js";export*from"./application-runtime/index.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as e}from"react/jsx-runtime";import{createRoot as t}from"react-dom/client";import{Subject as r,Subscription as o,filter as s,scan as i}from"rxjs";import{v4 as n}from"uuid";import{standardWebComponentEvents as a,standardWebComponentProperties as l}from"#package/domain";import{WebComponentApp as
|
|
1
|
+
import{jsx as e}from"react/jsx-runtime";import{createRoot as t}from"react-dom/client";import{Subject as r,Subscription as o,filter as s,scan as i}from"rxjs";import{v4 as n}from"uuid";import{standardWebComponentEvents as a,standardWebComponentProperties as l,webComponentAttributeParsers as c}from"#package/domain";import{WebComponentApp as u}from"./WebComponentApp.js";import{createEventDispatcher as p,createStorage as h,createWebComponentApi as b}from"./create-web-component-api.js";import{registerGodModeTarget as d}from"./god-mode/index.js";import{createAttributeNameToPropertyMap as m,createEventTypeByDescriptorMap as f,deriveWebComponentContract as y}from"./web-component-contract.js";let g=Symbol("storagesByPropertyDescriptor"),v=Symbol("reactRoot"),j=Symbol("pendingDisconnection"),S=Symbol("setProperty"),P=Symbol("activeSubscriptions"),w=Symbol("propertiesWithStorages"),C=Symbol("container"),A=Symbol("applicationRuntime"),x=Symbol("webComponentApi"),E=Symbol("PreviousPropertyValues"),O=Symbol("Events"),$=Symbol("Uuid"),k=(e,t,r)=>{let o=t?.attributeParser;if(!o)throw Error("Attribute parser is not defined");let s=o===c.boolean&&r===e?"":r;try{let e=o(s);return{success:!0,data:e}}catch(t){return console.error(`Failed to parse attribute ${e}, ignoring`,t),{success:!1}}};export const createWebComponent=c=>{let{RootComponent:D,webComponentOptions:B,embeddedIntegration:M,applicationRuntimeFactory:W}=c,F=y(B),{properties:V,events:q}=F,N=m(V),R=f(q),T=class Salsita3dConfigurator extends HTMLElement{[g];[v];[j]=null;[P]=[];[w];[C];[A];[x];[E]=new Map;[O]=new r;[$]=n();get applicationRuntime(){return this[A]}static observedAttributes=Array.from(N.keys());[S](e,t,r){let o=t.schema.safeParse(r);if(!o.success)return void console.error(`Invalid value provided for property ${e}, ignoring`,o.error);let s=this[g].get(t);if(!s)return void console.error(`Subject not found for property descriptor of ${e}`);let i=s.isSet;s.isSet=!0,i&&s.subject.value===o.data||s.subject.next(o.data)}constructor(){super(),this[C]=this.attachShadow({mode:"closed"}),this[w]=Object.entries(V).map(([e,t])=>{if(Object.prototype.hasOwnProperty.call(this,e)){let r=t.schema.safeParse(this[e]);if(delete this[e],r.success)return{name:e,propertyDescriptor:t,storage:h(t,r.data)};console.error(`Failed to validate property ${e}, ignoring`,r.error)}if(t.attributeParser&&t.attributeNames){let r=t.attributeNames.find(e=>this.hasAttribute(e)),o=void 0===r?null:this.getAttribute(r);if(void 0!==r&&null!==o){let s=k(r,t,o);if(s.success){let o=t.schema.safeParse(s.data);if(o.success)return{name:e,propertyDescriptor:t,storage:h(t,o.data)};console.error(`Failed to validate attribute ${r}, ignoring`,o.error)}}}return{name:e,propertyDescriptor:t,storage:h(t,t.defaultValue)}}),this[g]=new Map(this[w].map(({propertyDescriptor:e,storage:t})=>[e,t])),this[x]=b({element:this,eventTypeByDescriptor:R,events:this[O],propertiesWithStorages:this[w],storagesByPropertyDescriptor:this[g]}),this[A]=W({webComponentOptions:F,webComponentApi:this[x]})}connectedCallback(){let r;if(null!==this[j]){this[j]=null,this[A].actions.webComponent.startNewGeneration();return}let n=this[A],c=this[x],h=p({element:this,eventTypeByDescriptor:R,storagesByPropertyDescriptor:this[g]},!0),b=this[w].map(({name:e,storage:t})=>t.subject.pipe(i((e,t)=>[e[1],t],[t.subject.value,t.subject.value]),s(([e,t])=>e!==t)).subscribe(([t,r])=>{h(a.propertyChanged,{name:e,oldValue:t,newValue:r})})),m=e=>{if(e)for(let[t,r]of Object.entries(e)){let e=this[w].find(({name:e})=>e===t);if(e){let{storage:o,propertyDescriptor:s}=e;this[E].has(t)||this[E].set(t,o.subject.value);let i=s.schema.safeParse(r);i.success?(o.subject.next(i.data),o.isSet=!0):console.error(`Failed to apply web component property override for "${t}":`,i.error)}}else{for(let[e,t]of this[E]){let r=this[w].find(({name:t})=>t===e);if(r){let{storage:e}=r;e.subject.next(t)}}this[E].clear()}},f=new o(n.subscribe(()=>{let e=n.selectors.overrides.getWebComponentProperties();e!==r&&(r=e,m(e))})),y=new o(d(this,n.actions.environment.setGodMode));this[P]=[...b,f,y],this[v]=t(this[C]),this[v].render(e(u,{runtime:n,container:this[C],children:e(D,{})}));let S=c.getPropertyValue(l.onAttached);if(S)try{S(this)}catch(e){console.error("Error in onAttached handler",e)}this.dispatchEvent(new CustomEvent("attached",{bubbles:!0}))}disconnectedCallback(){let e={};this[j]=e,queueMicrotask(()=>{this[j]===e&&(this[j]=null,this[P].forEach(e=>{e.unsubscribe()}),this[v]?.unmount(),this[v]=void 0)})}attributeChangedCallback(e,t,r){let o=N.get(e);if(!o)throw Error(`Property descriptor not found for attribute: ${e}, despite the attribute being observed`);if(null===r)return o.required?void console.error(`Cannot unset a required attribute ${e}, ignoring`):void this[S](e,o,o.defaultValue);let s=k(e,o,r);s.success&&this[S](e,o,s.data)}};return Object.entries(V).forEach(([e,t])=>{Object.defineProperty(T.prototype,e,{enumerable:!0,configurable:!1,get(){return this[g].get(t).subject.value},set(r){this[S](e,t,r)}})}),M&&(Object.defineProperty(T.prototype,"$events",{enumerable:!1,configurable:!1,get(){return this[O]}}),Object.defineProperty(T.prototype,"uuid",{enumerable:!1,configurable:!1,get(){return this[$]}})),T};
|
|
@@ -6,8 +6,8 @@ export interface ResponsiveApplicationProviderProps extends PropsWithChildren {
|
|
|
6
6
|
* Responsive state owned outside the UI. When given, the provider measures its container into
|
|
7
7
|
* it and `useResponsive()` reads from it; otherwise the provider keeps the state itself.
|
|
8
8
|
*
|
|
9
|
-
* @internal Runtime plumbing for the SDK's own configurator, which passes its
|
|
10
|
-
*
|
|
9
|
+
* @internal Runtime plumbing for the SDK's own configurator, which passes its application
|
|
10
|
+
* runtime's responsive state. A project mounting this provider leaves it out.
|
|
11
11
|
*/
|
|
12
12
|
store?: ResponsiveStateStore;
|
|
13
13
|
}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import type { BehaviorSubject, Observable } from 'rxjs';
|
|
2
1
|
import type { CanvasPadding } from './ResponsiveProvider.js';
|
|
3
2
|
/**
|
|
4
3
|
* The responsive state a `ResponsiveStateStore` holds.
|
|
@@ -20,9 +19,9 @@ export interface ResponsiveStateSnapshot {
|
|
|
20
19
|
}
|
|
21
20
|
/**
|
|
22
21
|
* Responsive state owned outside the UI, which `ResponsiveApplicationProvider` measures its root
|
|
23
|
-
* container into and provides to `useResponsive()`. A mounted Phoenix
|
|
24
|
-
* `
|
|
25
|
-
* without the UI.
|
|
22
|
+
* container into and provides to `useResponsive()`. A mounted Phoenix configurator passes its
|
|
23
|
+
* application runtime's responsive state (`useResponsiveStore()` of `@salsita-ai/sdk/react`), so
|
|
24
|
+
* its lifecycle reads the same state without the UI.
|
|
26
25
|
*
|
|
27
26
|
* Declared here by shape rather than imported, because `ui-sdk` depends on no other SDK package.
|
|
28
27
|
*
|
|
@@ -30,12 +29,15 @@ export interface ResponsiveStateSnapshot {
|
|
|
30
29
|
* `ResponsiveApplicationProvider` leaves `store` out.
|
|
31
30
|
*/
|
|
32
31
|
export interface ResponsiveStateStore {
|
|
33
|
-
|
|
34
|
-
readonly
|
|
35
|
-
|
|
36
|
-
height: number;
|
|
37
|
-
}>;
|
|
32
|
+
/** Calls `onChange` after every change of the store; returns the unsubscribe. */
|
|
33
|
+
readonly subscribe: (onChange: () => void) => () => void;
|
|
34
|
+
/** The same object until a value in it changes. */
|
|
38
35
|
readonly getState: () => ResponsiveStateSnapshot;
|
|
36
|
+
/** The container's size rounded up to whole pixels; the same object until it changes. */
|
|
37
|
+
readonly getViewportSize: () => {
|
|
38
|
+
readonly width: number;
|
|
39
|
+
readonly height: number;
|
|
40
|
+
};
|
|
39
41
|
readonly setViewport: (viewport: {
|
|
40
42
|
readonly width: number;
|
|
41
43
|
readonly height: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{useTheme as e}from"@mui/material";import{useCallback as t,useLayoutEffect as i,useMemo as a,useSyncExternalStore as s}from"react";import{isMobileOnly as
|
|
1
|
+
import{useTheme as e}from"@mui/material";import{useCallback as t,useLayoutEffect as i,useMemo as a,useState as n,useSyncExternalStore as s}from"react";import{isMobileOnly as r}from"react-device-detect";import{BehaviorSubject as o}from"rxjs";import{useResizeObserver as c}from"usehooks-ts";export const useStoreResponsiveInfo=(p,d)=>{let{sm:l,md:u,lg:m}=e().breakpoints.values,g=s(d.subscribe,d.getState),[b]=n(()=>new o(d.getViewportSize()));i(()=>{let e=()=>{let e=d.getViewportSize();e!==b.value&&b.next(e)};return e(),d.subscribe(e)},[d,b]),i(()=>{d.setBreakpoints({sm:l,md:u,lg:m})},[d,l,u,m]);let w=t(e=>{let{width:t,height:i}=e.getBoundingClientRect();d.setViewport({width:t,height:i,isLandscape:window.matchMedia("(orientation: landscape)").matches,isPortrait:window.matchMedia("(orientation: portrait)").matches})},[d]),f=t(e=>{d.setCanvasPadding("function"==typeof e?e(d.getCanvasPadding()):e)},[d]),h=t(()=>{p.current&&w(p.current)},[p,w]);return c({ref:p,onResize:()=>{null!=p.current&&w(p.current)}}),i(()=>{null!=p.current&&w(p.current)},[p,w]),a(()=>({...g,expand:d.expand,collapse:d.collapse,hide:d.hide,show:d.show,isMobileAndMobileLandscape:g.isMobile||g.isLandscape&&g.isTablet&&r,isDesktopExceptMobileLandscape:g.isDesktop&&!(g.isLandscape&&g.isTablet&&r),viewport$:b,getCanvasPadding:d.getCanvasPadding,setCanvasPadding:f,update:h,setAnimating:d.setAnimating}),[g,d,b,f,h])};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@salsita-ai/sdk",
|
|
3
|
-
"version": "0.50.0-develop.
|
|
3
|
+
"version": "0.50.0-develop.3986957af6",
|
|
4
4
|
"description": "TypeScript SDK and CLI for building, running, and deploying Phoenix configurator applications.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"salsita",
|
|
@@ -308,8 +308,8 @@
|
|
|
308
308
|
"yaml": "2.9.0",
|
|
309
309
|
"yargs": "17.7.2",
|
|
310
310
|
"zod": "3.25.76",
|
|
311
|
-
"@salsita-ai/common": "0.50.0-develop.
|
|
312
|
-
"@salsita-ai/contracts": "0.50.0-develop.
|
|
311
|
+
"@salsita-ai/common": "0.50.0-develop.3986957af6",
|
|
312
|
+
"@salsita-ai/contracts": "0.50.0-develop.3986957af6"
|
|
313
313
|
},
|
|
314
314
|
"devDependencies": {
|
|
315
315
|
"@clerk/clerk-react": "5.61.8",
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { type ReactNode } from 'react';
|
|
2
|
-
import type { ResponsiveStateManager } from './responsive-state-manager.js';
|
|
3
|
-
export declare const ResponsiveStateContext: import("react").Context<ResponsiveStateManager | null>;
|
|
4
|
-
/**
|
|
5
|
-
* The props of `ResponsiveStateProvider`.
|
|
6
|
-
*
|
|
7
|
-
* @internal Runtime plumbing behind `useResponsiveState`, for the SDK's own UI. A project layout
|
|
8
|
-
* uses `useActiveViewports()` from `@salsita-ai/sdk/react` and `useSceneSafeArea()` from
|
|
9
|
-
* `@salsita-ai/sdk/configurator`.
|
|
10
|
-
*/
|
|
11
|
-
export interface ResponsiveStateProviderProps {
|
|
12
|
-
readonly children: ReactNode;
|
|
13
|
-
/** The responsive state of the application mounted inside. One per mounted application. */
|
|
14
|
-
readonly manager: ResponsiveStateManager;
|
|
15
|
-
}
|
|
16
|
-
/**
|
|
17
|
-
* Provides the responsive state of one mounted application to the lifecycle and UI inside it.
|
|
18
|
-
* Each mounted application has its own, because each has its own root container: an admin that
|
|
19
|
-
* embeds a configurator runs both in one application runtime.
|
|
20
|
-
*
|
|
21
|
-
* @internal Exists for the SDK's own UI, which reaches the runtime's responsive state through it.
|
|
22
|
-
* A project layout does not use it: it uses `useActiveViewports()` from `@salsita-ai/sdk/react`
|
|
23
|
-
* and `useSceneSafeArea()` from `@salsita-ai/sdk/configurator`.
|
|
24
|
-
*/
|
|
25
|
-
export declare const ResponsiveStateProvider: (props: ResponsiveStateProviderProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{jsx as e}from"react/jsx-runtime";import{createContext as t}from"react";export const ResponsiveStateContext=t(null);export const ResponsiveStateProvider=t=>{let{children:r,manager:o}=t;return e(ResponsiveStateContext.Provider,{value:o,children:r})};
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The part of the canvas, in pixels from each edge, that overlay UI covers. The camera frames the
|
|
3
|
-
* scene inside what is left, so the scene stays visible beside a sidebar or under a preview body.
|
|
4
|
-
*
|
|
5
|
-
* @internal Runtime plumbing behind `useResponsiveState`, for the SDK's own UI. A project layout
|
|
6
|
-
* uses `useActiveViewports()` from `@salsita-ai/sdk/react` and `useSceneSafeArea()` from
|
|
7
|
-
* `@salsita-ai/sdk/configurator`.
|
|
8
|
-
*/
|
|
9
|
-
export interface CanvasPadding {
|
|
10
|
-
readonly top: number;
|
|
11
|
-
readonly right: number;
|
|
12
|
-
readonly bottom: number;
|
|
13
|
-
readonly left: number;
|
|
14
|
-
}
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
export { type CanvasPadding } from './canvas-padding.js';
|
|
2
|
-
export { type ResponsiveBreakpoints, type ResponsiveState, ResponsiveStateManager, type ResponsiveStateManagerOptions, type ResponsiveViewport, } from './responsive-state-manager.js';
|
|
3
|
-
export { ResponsiveStateProvider, type ResponsiveStateProviderProps } from './ResponsiveStateProvider.js';
|
|
4
|
-
export { useResponsiveState } from './use-responsive-state.js';
|
|
5
|
-
export { useResponsiveStateManager } from './use-responsive-state-manager.js';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export{ResponsiveStateManager}from"./responsive-state-manager.js";export{ResponsiveStateProvider}from"./ResponsiveStateProvider.js";export{useResponsiveState}from"./use-responsive-state.js";export{useResponsiveStateManager}from"./use-responsive-state-manager.js";
|