@salsita-ai/sdk 0.50.0-develop.f9cd9b3a12 → 0.50.0-develop.fda84314a5
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/index.d.ts +1 -0
- package/dist/application/index.js +1 -1
- package/dist/application/mount-application.d.ts +1 -1
- package/dist/application/mount-application.js +1 -1
- package/dist/application/mount-configurator.d.ts +19 -0
- package/dist/application/mount-configurator.js +1 -0
- package/dist/application/mounted-application-runtime.d.ts +4 -0
- package/dist/application/mounted-application-runtime.js +1 -0
- package/dist/application/register-web-component.d.ts +2 -0
- package/dist/application/register-web-component.js +1 -0
- package/dist/application-spec/generate-application/implementations/phx-application-types.d.ts +25 -0
- package/dist/application-spec/generate-application/implementations/phx-application-types.js +1 -0
- package/dist/application-spec/generate-application/implementations/phx-domain.d.ts +36 -0
- package/dist/application-spec/generate-application/implementations/phx-domain.js +1 -0
- package/dist/application-spec/generate-application/implementations/phx-model.d.ts +24 -0
- package/dist/application-spec/generate-application/implementations/phx-model.js +1 -0
- package/dist/application-spec/generate-application/implementations/phx.d.ts +22 -0
- package/dist/application-spec/generate-application/implementations/phx.js +1 -0
- package/dist/application-spec/generate-application/index.d.ts +2 -0
- package/dist/application-spec/generate-application/index.js +1 -1
- package/dist/application-spec/generate-application/runtime/admin-runtime/admin-model-runtime.d.ts +3 -3
- package/dist/application-spec/generate-application/runtime/admin-runtime/admin-runtime.d.ts +7 -4
- package/dist/application-spec/generate-application/runtime/admin-runtime/admin-runtime.js +1 -1
- package/dist/application-spec/generate-application/runtime/admin-runtime/admin-spec-runtime.d.ts +16 -0
- package/dist/application-spec/generate-application/runtime/admin-runtime/admin-spec-runtime.js +1 -0
- package/dist/application-spec/generate-application/runtime/application-runtime.d.ts +17 -4
- package/dist/application-spec/generate-application/runtime/application-runtime.js +1 -1
- package/dist/application-spec/generate-application/runtime/application-spec-slice.d.ts +71 -0
- package/dist/application-spec/generate-application/runtime/application-spec-slice.js +1 -0
- package/dist/application-spec/generate-application/runtime/configurator-runtime/configurator-model-runtime.d.ts +3 -3
- package/dist/application-spec/generate-application/runtime/configurator-runtime/configurator-runtime.d.ts +7 -5
- package/dist/application-spec/generate-application/runtime/configurator-runtime/configurator-runtime.js +1 -1
- package/dist/application-spec/generate-application/runtime/configurator-runtime/configurator-spec-runtime.d.ts +16 -0
- package/dist/application-spec/generate-application/runtime/configurator-runtime/configurator-spec-runtime.js +1 -0
- package/dist/application-spec/generate-application/runtime/create-application.d.ts +57 -0
- package/dist/application-spec/generate-application/runtime/create-application.js +1 -0
- package/dist/application-spec/generate-application/runtime/index.d.ts +8 -0
- package/dist/application-spec/generate-application/runtime/index.js +1 -0
- 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/application-spec/generate-application/runtime/spec-runtime.d.ts +21 -0
- package/dist/application-spec/generate-application/runtime/spec-runtime.js +1 -0
- package/dist/application-spec/generate-application/runtime-spec/encoded-runtime-spec.d.ts +3 -2
- package/dist/application-spec/generate-application/runtime-spec/runtime-spec.d.ts +44 -9
- package/dist/application-spec/generate-application/runtime-spec/runtime-spec.js +1 -1
- package/dist/client/authorized-client.d.ts +3 -1
- package/dist/client/authorized-client.js +1 -1
- package/dist/client/contract.d.ts +17 -0
- package/dist/client/index.d.ts +1 -1
- package/dist/client/local-authorized-client.d.ts +3 -1
- package/dist/client/local-authorized-client.js +1 -1
- package/dist/client/memory-authorized-client.d.ts +4 -1
- package/dist/client/memory-authorized-client.js +1 -1
- package/dist/client/phoenix-api.d.ts +228 -0
- package/dist/configurator/ConfiguratorApp.js +1 -1
- package/dist/configurator/app-loader-content/index.d.ts +0 -1
- package/dist/configurator/app-loader-content/index.js +1 -1
- package/dist/configurator/application-runtime/extensions/selectors.js +1 -1
- package/dist/configurator/application-runtime/extensions/systems/assistant-system/assistant-system.d.ts +13 -0
- 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 +2 -1
- package/dist/configurator/application-runtime/extensions/systems/assistant-system/graphql-tools.js +1 -1
- package/dist/configurator/application-runtime/extensions/systems/graphql-system/graphql-system.d.ts +15 -9
- package/dist/configurator/application-runtime/extensions/systems/graphql-system/graphql-system.js +1 -1
- package/dist/configurator/common/configurator-interface.d.ts +3 -5
- package/dist/configurator/common/configurator-interface.js +1 -1
- package/dist/configurator/configuration-not-found-page/BuiltInConfigurationNotFoundPage.d.ts +5 -0
- package/dist/configurator/configuration-not-found-page/BuiltInConfigurationNotFoundPage.js +1 -0
- package/dist/configurator/configuration-not-found-page/ConfigurationNotFoundPageElement.d.ts +0 -6
- package/dist/configurator/configuration-not-found-page/ConfigurationNotFoundPageElement.js +1 -1
- package/dist/configurator/configuration-not-found-page/index.d.ts +2 -2
- package/dist/configurator/configuration-not-found-page/index.js +1 -1
- package/dist/configurator/configurator-error-page/BuiltInConfiguratorErrorPage.d.ts +3 -3
- package/dist/configurator/configurator-error-page/BuiltInConfiguratorErrorPage.js +1 -1
- package/dist/configurator/configurator-error-page/ConfiguratorErrorPageElement.d.ts +0 -5
- package/dist/configurator/configurator-error-page/ConfiguratorErrorPageElement.js +1 -1
- package/dist/configurator/configurator-error-page/index.d.ts +1 -2
- package/dist/configurator/configurator-error-page/index.js +1 -1
- package/dist/configurator/index.d.ts +9 -2
- package/dist/configurator/index.js +1 -1
- package/dist/configurator/pages/default-configurator-elements.js +1 -1
- package/dist/configurator/pages/error-boundaries/LoadingErrorBoundary.js +1 -1
- package/dist/configurator/ui/assistant/screenshots/ScreenshotThumbnails.d.ts +1 -1
- package/dist/configurator/ui/assistant/screenshots/ScreenshotThumbnails.js +1 -1
- package/dist/configurator/ui/assistant/screenshots/tool-screenshots.d.ts +12 -4
- package/dist/configurator/ui/assistant/screenshots/tool-screenshots.js +1 -1
- package/dist/configurator/ui/assistant/screenshots/use-screenshot-src.d.ts +8 -0
- package/dist/configurator/ui/assistant/screenshots/use-screenshot-src.js +1 -0
- package/dist/configurator/ui/configurator-layout/slots/canvas/LayoutCanvas.js +1 -1
- package/dist/configurator/ui/configurator-layout/slots/canvas/SharedCanvas.js +1 -1
- package/dist/configurator/ui/legacy/layout/common/ReactiveInterfaceLayout.js +1 -1
- package/dist/configurator/ui/phoenix-layout-elements/AppLoader.d.ts +0 -7
- package/dist/configurator/ui/phoenix-layout-elements/AppLoader.js +2 -2
- package/dist/configurator/ui/phoenix-layout-elements/index.d.ts +8 -1
- package/dist/configurator/ui/phoenix-layout-elements/index.js +1 -1
- package/dist/configurator/ui/preset-layout/PresetUi.d.ts +0 -2
- package/dist/configurator/ui/preset-layout/PresetUi.js +1 -1
- package/dist/configurator/ui/preset-layout/index.d.ts +6 -1
- package/dist/configurator/ui/preset-layout/index.js +1 -1
- package/dist/docs/index.json +34 -1
- package/dist/docs/layouts/gallery/corvid-drone.mdx +3428 -0
- package/dist/docs/layouts/gallery/nightjar-guitar.mdx +3698 -0
- package/dist/docs/layouts/gallery/tidepool-aquascape.mdx +5203 -0
- package/dist/docs/phoenix/configurator-interface.mdx +4 -3
- package/dist/docs/phoenix/sdk-builder-workflow.mdx +4 -2
- package/dist/domain/application/assistant/build-assistant-manifest.js +1 -1
- package/dist/domain/application/assistant/generate-assistant-prompt.js +1 -1
- package/dist/domain/application/configurator-builder.d.ts +7 -1
- package/dist/domain/application/configurator-builder.js +1 -1
- package/dist/domain/application/index.d.ts +1 -1
- package/dist/domain/application/index.js +1 -1
- package/dist/domain/application/standard-properties.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/application.d.ts +39 -0
- package/dist/domain/domain-runtime/application.js +1 -0
- package/dist/domain/domain-runtime/domain-runtime.d.ts +36 -4
- package/dist/domain/domain-runtime/domain-runtime.js +1 -1
- package/dist/domain/domain-runtime/environment/initialize.d.ts +1 -1
- 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 +2 -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/domain-runtime/web-component/actions.d.ts +3 -0
- package/dist/domain/domain-runtime/web-component/actions.js +1 -1
- package/dist/domain/domain-runtime/web-component/initialize.d.ts +1 -0
- package/dist/domain/domain-runtime/web-component/initialize.js +1 -1
- package/dist/domain/domain-runtime/web-component/selectors.d.ts +2 -0
- package/dist/domain/domain-runtime/web-component/selectors.js +1 -1
- package/dist/domain/domain-runtime/web-component/types.d.ts +6 -3
- package/dist/domain/mocks/create-mock-domain-runtime.d.ts +5 -0
- package/dist/editor/domain-editors/DomainSpecContext.js +1 -1
- package/dist/editor/domain-editors/apply-spec-update.d.ts +2 -1
- package/dist/editor/domain-editors/apply-spec-update.js +1 -1
- package/dist/editor/domain-editors/use-implementation-files.d.ts +6 -14
- package/dist/editor/domain-editors/use-implementation-files.js +1 -1
- package/dist/react-sdk/application-runtime/common-services/analytics/analytics-service.d.ts +1 -1
- package/dist/react-sdk/application-runtime/common-services/initialize.d.ts +2 -2
- 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/loading/index.d.ts +5 -0
- package/dist/react-sdk/application-runtime/hooks/loading/index.js +1 -0
- package/dist/react-sdk/application-runtime/hooks/loading/loader-host-context.d.ts +11 -0
- package/dist/react-sdk/application-runtime/hooks/loading/loader-host-context.js +1 -0
- package/dist/react-sdk/application-runtime/hooks/loading/use-is-awaiting-loading-phase.d.ts +8 -0
- package/dist/react-sdk/application-runtime/hooks/loading/use-is-awaiting-loading-phase.js +1 -0
- package/dist/react-sdk/application-runtime/hooks/loading/use-is-loader-hosted.d.ts +7 -0
- package/dist/react-sdk/application-runtime/hooks/loading/use-is-loader-hosted.js +1 -0
- package/dist/react-sdk/application-runtime/hooks/loading/use-loading-actions.d.ts +9 -0
- package/dist/react-sdk/application-runtime/hooks/loading/use-loading-actions.js +1 -0
- package/dist/react-sdk/application-runtime/hooks/loading/use-loading-application.d.ts +24 -0
- package/dist/react-sdk/application-runtime/hooks/loading/use-loading-application.js +1 -0
- package/dist/react-sdk/application-runtime/hooks/use-access-service.js +1 -1
- package/dist/react-sdk/application-runtime/hooks/use-web-component-readonly-sync.d.ts +4 -11
- package/dist/react-sdk/application-runtime/hooks/use-web-component-readonly-sync.js +1 -1
- package/dist/react-sdk/application-runtime/hooks/use-web-component.d.ts +5 -0
- package/dist/react-sdk/application-runtime/hooks/use-web-component.js +1 -1
- package/dist/react-sdk/application-runtime/host-properties/actions.d.ts +15 -0
- package/dist/react-sdk/application-runtime/host-properties/actions.js +1 -0
- package/dist/react-sdk/application-runtime/host-properties/connect-host-properties.d.ts +30 -0
- package/dist/react-sdk/application-runtime/host-properties/connect-host-properties.js +1 -0
- package/dist/react-sdk/application-runtime/host-properties/domain-host-properties.d.ts +7 -0
- package/dist/react-sdk/application-runtime/host-properties/domain-host-properties.js +1 -0
- package/dist/react-sdk/application-runtime/host-properties/host-property-descriptors.d.ts +21 -0
- package/dist/react-sdk/application-runtime/host-properties/host-property-descriptors.js +1 -0
- package/dist/react-sdk/application-runtime/host-properties/host-property-scopes.d.ts +42 -0
- package/dist/react-sdk/application-runtime/host-properties/host-property-scopes.js +1 -0
- package/dist/react-sdk/application-runtime/host-properties/index.d.ts +8 -0
- package/dist/react-sdk/application-runtime/host-properties/index.js +1 -0
- package/dist/react-sdk/application-runtime/host-properties/initialize.d.ts +7 -0
- package/dist/react-sdk/application-runtime/host-properties/initialize.js +1 -0
- package/dist/react-sdk/application-runtime/host-properties/selectors.d.ts +54 -0
- package/dist/react-sdk/application-runtime/host-properties/selectors.js +1 -0
- package/dist/react-sdk/application-runtime/host-properties/types.d.ts +18 -0
- package/dist/react-sdk/application-runtime/index.d.ts +2 -0
- package/dist/react-sdk/application-runtime/loading/actions.d.ts +45 -0
- package/dist/react-sdk/application-runtime/loading/actions.js +1 -0
- package/dist/react-sdk/application-runtime/loading/index.d.ts +4 -0
- package/dist/react-sdk/application-runtime/loading/index.js +1 -0
- package/dist/react-sdk/application-runtime/loading/initialize.d.ts +3 -0
- package/dist/react-sdk/application-runtime/loading/initialize.js +1 -0
- package/dist/react-sdk/application-runtime/loading/selectors.d.ts +18 -0
- package/dist/react-sdk/application-runtime/loading/selectors.js +1 -0
- package/dist/react-sdk/application-runtime/loading/types.d.ts +59 -0
- package/dist/react-sdk/application-runtime/loading/types.js +1 -0
- package/dist/react-sdk/application-runtime/mocks/create-mock-application-runtime.js +1 -1
- package/dist/react-sdk/application-runtime/provider/ApplicationRuntime.d.ts +6 -0
- package/dist/react-sdk/application-runtime/provider/ApplicationRuntime.js +1 -1
- package/dist/react-sdk/application-runtime/provider/ApplicationType.d.ts +7 -0
- package/dist/react-sdk/application-runtime/provider/ApplicationType.js +1 -1
- package/dist/react-sdk/application-runtime/runtime/create-application-runtime.d.ts +218 -8
- package/dist/react-sdk/application-runtime/runtime/create-application-runtime.js +1 -1
- package/dist/react-sdk/domain-application-context/BackendDataProvider.js +1 -1
- package/dist/react-sdk/domain-application-context/FrontendDataProvider.js +1 -1
- package/dist/react-sdk/domain-application-context/PublishedDataProvider.js +1 -1
- package/dist/react-sdk/elements/index.d.ts +0 -1
- package/dist/react-sdk/index.d.ts +1 -0
- package/dist/react-sdk/index.js +1 -1
- package/dist/react-sdk/loading-state/LoaderHost.d.ts +20 -0
- package/dist/react-sdk/loading-state/LoaderHost.js +1 -0
- package/dist/react-sdk/loading-state/built-in-loading-phase.d.ts +9 -0
- package/dist/react-sdk/loading-state/built-in-loading-phase.js +1 -0
- package/dist/react-sdk/loading-state/create-app-loader.d.ts +18 -0
- package/dist/react-sdk/loading-state/create-app-loader.js +1 -0
- package/dist/react-sdk/loading-state/index.d.ts +4 -2
- package/dist/react-sdk/loading-state/index.js +1 -1
- package/dist/react-sdk/loading-state/{LoadingStateProvider.d.ts → loading-state-hooks.d.ts} +3 -12
- package/dist/react-sdk/loading-state/loading-state-hooks.js +1 -0
- package/dist/react-sdk/page-elements/ConfigurationNotFoundPagePropsProvider.d.ts +17 -0
- package/dist/react-sdk/page-elements/ConfigurationNotFoundPagePropsProvider.js +1 -0
- package/dist/react-sdk/page-elements/ConfiguratorErrorPagePropsProvider.d.ts +17 -0
- package/dist/react-sdk/page-elements/ConfiguratorErrorPagePropsProvider.js +1 -0
- package/dist/react-sdk/page-elements/configurator-error-page-props.js +1 -0
- package/dist/{configurator/configuration-not-found-page → react-sdk/page-elements}/create-configuration-not-found-page.d.ts +7 -1
- package/dist/react-sdk/page-elements/create-configuration-not-found-page.js +1 -0
- package/dist/{configurator/configurator-error-page → react-sdk/page-elements}/create-configurator-error-page.d.ts +6 -1
- package/dist/react-sdk/page-elements/create-configurator-error-page.js +1 -0
- package/dist/react-sdk/page-elements/create-preset-ui.d.ts +9 -0
- package/dist/react-sdk/page-elements/create-preset-ui.js +1 -0
- package/dist/react-sdk/page-elements/index.d.ts +6 -0
- package/dist/react-sdk/page-elements/index.js +1 -0
- package/dist/react-sdk/session/SessionServiceProvider.js +1 -1
- package/package.json +3 -3
- package/dist/configurator/app-loader-content/app-loader-content-name.d.ts +0 -5
- package/dist/configurator/app-loader-content/app-loader-content-name.js +0 -1
- package/dist/configurator/configuration-not-found-page/create-configuration-not-found-page.js +0 -1
- package/dist/configurator/configurator-error-page/create-configurator-error-page.js +0 -1
- package/dist/react-sdk/loading-state/LoadingStateProvider.js +0 -1
- package/dist/react-sdk/loading-state/loading-state-manager.d.ts +0 -37
- package/dist/react-sdk/loading-state/loading-state-manager.js +0 -1
- /package/dist/react-sdk/{elements/configurator-error-page-props.js → application-runtime/host-properties/types.js} +0 -0
- /package/dist/react-sdk/{elements → page-elements}/configurator-error-page-props.d.ts +0 -0
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { AnonymousExpression, AnyExpressions } from '../../../core/index.js';
|
|
2
|
+
import { type ImplementationErrorCollector } from '../../errors/index.js';
|
|
3
|
+
import { type ProjectModule } from './project-modules.js';
|
|
4
|
+
type AnyAnonymousExpression = AnonymousExpression<any, any, any, any, any, any, unknown>;
|
|
5
|
+
type AliasMap = Readonly<Record<string, readonly string[]>>;
|
|
6
|
+
/** The expression names that already have a value, by entity type, so no project file may define them. */
|
|
7
|
+
export type ValuedExpressions = ReadonlyMap<string, ReadonlySet<string>>;
|
|
8
|
+
/** Whether a file's default export has the shape of the expressions folder contract. */
|
|
9
|
+
export declare const isExpressionExport: (value: unknown) => value is Record<string, Record<string, AnyAnonymousExpression>>;
|
|
10
|
+
/**
|
|
11
|
+
* Merges the `src/expressions/` files (or `src/admin/expressions/`) into the expressions of each
|
|
12
|
+
* entity type. It checks each file against the folder contract, rejects an expression that two
|
|
13
|
+
* files, or two keys of one file, define for one entity type after the aliases of `aliasMap` are
|
|
14
|
+
* expanded, and rejects an expression listed in `valued`, which the application gives a value
|
|
15
|
+
* already. Each accepted expression gets its `origin`: its name and the entity type or alias the
|
|
16
|
+
* file keys it by.
|
|
17
|
+
*
|
|
18
|
+
* Each file is checked on its own: a wrong file is recorded in `errors` with all its conflicts and
|
|
19
|
+
* left out, and the files after it still merge. Without `errors`, everything recorded is thrown at
|
|
20
|
+
* the end as one `ImplementationErrors`.
|
|
21
|
+
*/
|
|
22
|
+
export declare const mergeExpressionModules: (modules: readonly ProjectModule[], aliasMap: AliasMap, errors?: ImplementationErrorCollector, valued?: ValuedExpressions) => AnyExpressions;
|
|
23
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{ImplementationError as e,ImplementationErrors as o,createImplementationErrorCollector as t}from"../../errors/index.js";import{SHARED_FOLDER_HINT as i,createContractError as n,isRecord as r}from"./project-modules.js";let s={expected:"an object of expressions keyed by entity type or alias, then by expression name",fix:`Create it with phx.domain.implementCustomExpressions({ ... }) (phx.domain.admin.implementCustomExpressions({ ... }) under src/admin/), ${i}.`},a=e=>r(e)&&"function"==typeof e.evaluate,p=e=>r(e)&&Object.values(e).every(a);export const isExpressionExport=e=>r(e)&&Object.values(e).every(p);let l=(o,t,i)=>new e({code:"DUPLICATE_DEFINITION",origin:o,problem:`Duplicate expression ${t}`,fix:i}),d=(e,t,i,r)=>{if(!isExpressionExport(e.exports))throw n(e,s,e.exports);let a=[],p=new Map,d=[];for(let[o,n]of Object.entries(e.exports))for(let s of t[o]??[o])for(let[t,f]of Object.entries(n)){let n=`${s}.${t}`,h=p.get(n),m=i.get(n);r.get(s)?.has(t)?d.push(l(e.origin,n,"The application already gives it a value (an $eval, $msg or read in the spec, a relation, the $violations of its invariants, or a built-in expression of the SDK), so this implementation would be ignored. Remove it from the file, or declare the expression in the spec with a type and no value.")):void 0!==h?d.push(l(e.origin,n,`The file defines it on both ${h} and ${o}, so its value would depend on the order the definitions are merged in. Define it once, on the alias or on the entity type.`)):void 0!==m&&d.push(l(e.origin,n,`It is also defined in ${m}, so its value would depend on file order. Keep one definition and remove the other.`)),p.set(n,o),a.push({key:n,entityType:s,typeOrAlias:o,name:t,expression:f})}if(d.length>0)throw new o(d);return a};export const mergeExpressionModules=(e,o,i,n=new Map)=>{let r=i??t(),s=new Map,a={};for(let t of e)for(let{key:e,entityType:i,typeOrAlias:p,name:l,expression:f}of r.attempt(()=>d(t,o,s,n),[]))s.set(e,t.origin),a[i]={...a[i],[l]:{...f,origin:{name:l,typeOrAlias:p}}};return void 0===i&&r.throwIfAny(),a};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { AnonymousExpression } from '../../../core/index.js';
|
|
2
|
-
import {
|
|
2
|
+
import type { ProjectModule } from './project-modules.js';
|
|
3
3
|
/** The expressions of one validated expression file, keyed by entity type or alias, then by expression name. */
|
|
4
4
|
export interface ExpressionModule {
|
|
5
5
|
readonly origin: string;
|
|
@@ -7,9 +7,8 @@ export interface ExpressionModule {
|
|
|
7
7
|
}
|
|
8
8
|
type AnyAnonymousExpression = AnonymousExpression<any, any, any, any, any, any, unknown>;
|
|
9
9
|
/**
|
|
10
|
-
* Validates the `src/expressions/` files
|
|
11
|
-
*
|
|
12
|
-
* aliases at different points; within one file the builder's own duplicate check applies.
|
|
10
|
+
* Validates the `src/expressions/` files with the checks of {@link mergeExpressionModules}, throws
|
|
11
|
+
* everything they find as one `ImplementationErrors`, and returns each file on its own, unmerged.
|
|
13
12
|
*/
|
|
14
13
|
export declare const resolveExpressionModules: (modules: readonly ProjectModule[], aliasMap: Readonly<Record<string, readonly string[]>>) => readonly ExpressionModule[];
|
|
15
14
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{isExpressionExport as e,mergeExpressionModules as o}from"./merge-expression-modules.js";export const resolveExpressionModules=(s,r)=>(o(s,r),s.flatMap(o=>e(o.exports)?[{origin:o.origin,expressions:o.exports}]:[]));
|
|
@@ -4,7 +4,10 @@ interface Context {
|
|
|
4
4
|
}
|
|
5
5
|
export declare const createWebComponentActions: (context: Context) => {
|
|
6
6
|
setReadonly: (readonlyValue: boolean) => void;
|
|
7
|
+
setLocale: (locale: string) => void;
|
|
7
8
|
startNewGeneration: () => void;
|
|
8
9
|
};
|
|
9
10
|
export type WebComponentActions = ReturnType<typeof createWebComponentActions>;
|
|
11
|
+
/** The writers the host-property mirror needs: the public `setReadonly` and the internal `setLocale`. */
|
|
12
|
+
export type WebComponentHostActions = Pick<WebComponentActions, 'setReadonly' | 'setLocale'>;
|
|
10
13
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export const createWebComponentActions=e=>({setReadonly:t=>{e.setWebComponentState(e=>({...e,readonly:t}))},startNewGeneration:()=>{e.setWebComponentState(e=>({...e,webcomponentGeneration:e.webcomponentGeneration+1}))}});
|
|
1
|
+
export const createWebComponentActions=e=>({setReadonly:t=>{e.setWebComponentState(e=>({...e,readonly:t}))},setLocale:t=>{e.setWebComponentState(e=>({...e,locale:t}))},startNewGeneration:()=>{e.setWebComponentState(e=>({...e,webcomponentGeneration:e.webcomponentGeneration+1}))}});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export const initializeWebComponent=()=>({readonly:!1,webcomponentGeneration:0});
|
|
1
|
+
import{DEFAULT_FALLBACK_LOCALE as e}from"#package/i18n";export const initializeWebComponent=()=>({readonly:!1,locale:e,webcomponentGeneration:0});
|
|
@@ -8,6 +8,8 @@ interface Context {
|
|
|
8
8
|
export declare const createWebComponentSelectors: (context: Context) => {
|
|
9
9
|
selectReadonly: import("@salsita-ai/common/utils").Selector<WebComponentSelectorState, boolean>;
|
|
10
10
|
getReadonly: () => boolean;
|
|
11
|
+
selectLocale: import("@salsita-ai/common/utils").Selector<WebComponentSelectorState, string>;
|
|
12
|
+
getLocale: () => string;
|
|
11
13
|
getWebcomponentGeneration: () => number;
|
|
12
14
|
};
|
|
13
15
|
export type WebComponentSelectors = ReturnType<typeof createWebComponentSelectors>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{createSelector as e}from"@salsita-ai/common/utils";export const createWebComponentSelectors=o=>{let{getState:n}=o,t=e.withTypes(),a=t([t.leaf(e=>e.webComponent.readonly)],e=>e),
|
|
1
|
+
import{createSelector as e}from"@salsita-ai/common/utils";export const createWebComponentSelectors=o=>{let{getState:n}=o,t=e.withTypes(),a=t([t.leaf(e=>e.webComponent.readonly)],e=>e),l=t.leaf(e=>e.webComponent.locale),m=t([t.leaf(e=>e.webComponent.webcomponentGeneration)],e=>e);return{selectReadonly:a,getReadonly:()=>a(n()),selectLocale:l,getLocale:()=>l(n()),getWebcomponentGeneration:()=>m(n())}};
|
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Runtime-owned web-component state shared by configurator and admin applications.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
* `
|
|
6
|
-
*
|
|
4
|
+
* The application runtime mirrors the host properties a domain system reads, `readonly` and
|
|
5
|
+
* `locale`, from the element into this slice, so non-React domain systems read them from runtime
|
|
6
|
+
* selectors. The element's property storage stays their source.
|
|
7
7
|
*/
|
|
8
8
|
export interface ApplicationWebComponentState {
|
|
9
|
+
/** The host's `readonly` property; the effective mode derives from it. */
|
|
9
10
|
readonly readonly: boolean;
|
|
11
|
+
/** The host's `locale` property as set, not resolved against the available locales. */
|
|
12
|
+
readonly locale: string;
|
|
10
13
|
/**
|
|
11
14
|
* Bumped when the host moves the custom element in the DOM and the element is reconnected with
|
|
12
15
|
* its React tree retained. A move resets the CSSOM of every speedy emotion `<style>` tag inside
|
|
@@ -341,6 +341,8 @@ export declare const createMockDomainRuntime: <ENTITIES extends DomainEntity<str
|
|
|
341
341
|
webComponent: {
|
|
342
342
|
selectReadonly: import("@salsita-ai/common/utils").Selector<import("../index.js").WebComponentSelectorState, boolean>;
|
|
343
343
|
getReadonly: () => boolean;
|
|
344
|
+
selectLocale: import("@salsita-ai/common/utils").Selector<import("../index.js").WebComponentSelectorState, string>;
|
|
345
|
+
getLocale: () => string;
|
|
344
346
|
getWebcomponentGeneration: () => number;
|
|
345
347
|
};
|
|
346
348
|
domainContext: {
|
|
@@ -629,6 +631,9 @@ export declare const createMockDomainRuntime: <ENTITIES extends DomainEntity<str
|
|
|
629
631
|
};
|
|
630
632
|
};
|
|
631
633
|
};
|
|
634
|
+
hostMirrorActions: {
|
|
635
|
+
setLocale: (locale: string) => void;
|
|
636
|
+
};
|
|
632
637
|
getState: () => import("../index.js").DomainRuntimeState;
|
|
633
638
|
subscribe: (callback: () => void) => () => void;
|
|
634
639
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as e}from"react/jsx-runtime";import r from"lodash-es/debounce.js";import t from"promise-queue";import{createContext as o,useCallback as n,useContext as i,useEffect as s,useMemo as a,useRef as c,useState as
|
|
1
|
+
import{jsx as e}from"react/jsx-runtime";import r from"lodash-es/debounce.js";import t from"promise-queue";import{createContext as o,useCallback as n,useContext as i,useEffect as s,useMemo as a,useRef as c,useState as l}from"react";import{match as m}from"ts-pattern";import{ApplicationRuntime as u,BinaryFile as p,RawProjectFiles as d,RuntimeReferenceStore as g,TextFile as f,buildPhoenixDefinitions as v,isConfiguratorModelSchemaCompatible as S,isTextFile as h,parseApplicationFiles as y}from"#package/application-spec";import{createImplementationErrorCollector as E,findActionImplementationConflicts as x,getAllPhxDefinitions as A}from"#package/domain";import{useApplicationRuntime as C,useMountGuard as D}from"#package/react-sdk";import{useEditorConnection as w}from"../services/EditorConnectionContext.js";import{trpc as N}from"../services/trpc.js";import{applyRuntimeReset as P,applySpecUpdate as R,prepareRuntimeRefresh as _,prepareRuntimeReset as j}from"./apply-spec-update.js";import{useDiagnostics as I}from"./use-diagnostics.js";import{useImplementationFiles as L}from"./use-implementation-files.js";import{getWasmSwcParsers as k}from"./wasm-swc-parsers.js";let b=o(null),M={debug:e=>console.debug(e)},O=e=>e instanceof Error?e.message:String(e);export const DomainSpecProvider=o=>{let{children:i,domainSpec:T,initialRawProjectFiles:$}=o,[F,z]=l(a(()=>T?[{fileName:"domain.yaml",content:T}]:$?$.files.filter(h).map(e=>({fileName:e.name,content:e.content})):[],[T,$])),[H,q]=l(null),U=a(()=>new g,[]),G=a(()=>v(A()),[]),Q=c(null),B=C(),{getImplementationFiles:V}=L(),{diagnostics:Y,unreadDiagnosticCount:Z,setDiagnostics:J,pushDiagnostic:K,clearDiagnostics:W,markDiagnosticsRead:X}=I(),ee=a(()=>new t(1,1/0),[]),er=c(0),et=c(null),{mutateAsync:eo}=N.requestSpecFiles.useMutation(),{mutateAsync:en}=N.save.useMutation(),ei=D(),{localMode:es,connectionStatus:ea}=w(),{data:ec}=N.getEditorConfig.useQuery(void 0,{enabled:!es&&"connected"===ea}),el=es||ec?.specSync===!0,em=F.length>0?F:void 0,eu=a(()=>F.map(e=>e.fileName),[F]),ep=a(()=>r(async e=>{if(!es&&"connected"===ea&&0!==e.length)try{await en(e.map(e=>({fileName:e.fileName,content:e.content})))}catch(e){console.error("[DomainSpecContext] Failed to save files to disk:",e)}},1e3),[es,ea,en]);s(()=>()=>{ep.cancel()},[ep]);let ed=n(()=>{q(null)},[]),eg=n(async(e,r)=>{z(t=>{let o=t.find(r=>r.fileName===e)?t.map(t=>t.fileName===e?{...t,content:r}:t):[...t,{fileName:e,content:r}];return ep(o),o})},[ep]),ef=n(async(e,r)=>{let t,o,n=()=>ei()&&er.current===r;if(!n())return;let i=d(e.rawProjectFiles.files.map(e=>m(e).with({kind:"text"},e=>f(e.name,e.content)).with({kind:"binary"},e=>p(e.name)).exhaustive()));z(i.files.filter(h).map(e=>({fileName:e.name,content:e.content})));try{t=await k()}catch(e){if(!n())return;J([{code:"MODULE_ANALYZER_UNAVAILABLE",message:`The editor's module analyzer failed to load: ${e instanceof Error?e.message:String(e)}`,severity:"error",source:"spec",path:[]}]);return}if(!n())return;let s=y({rawProjectFiles:i,phxDefinitions:G},{analyzer:t.analyzer,evalExpressionParser:t.evalExpressionParser,referenceStore:U,logger:M});if(console.info(`[DomainSpecContext] Spec parsed: ${s.ok?"ok":"error"}, ${s.diagnostics.length} diagnostics`),!s.ok)return void J([...s.errors,...s.diagnostics].map(e=>({...e,source:"spec"})));W();let{applicationSpec:a}=s.value,c=await V({application:s.value,projectRoot:e.projectRoot});if(!n())return;if(c.errors.length>0)return void J(c.errors.map(e=>({code:e.code,message:e.message,severity:"error",source:"reload",path:[]})));let l=x([...a.configurator.actions.values()].map(e=>String(e.name)),c.actionImplementations??B.getState().spec.configurator.actionImplementations);if(l.extra.length>0&&console.error(`[DomainSpecContext] Action implementations without a declaration: ${l.extra.join(", ")}`),l.missing.length>0){let e=`Missing action implementations: ${l.missing.join(", ")}. Add each to a default export of phx.domain.implementActions({ ... }) in src/actions/.`;console.error(`[DomainSpecContext] ${e}`),K({code:"MISSING_ACTION_IMPLEMENTATIONS",message:e,severity:"error",source:"runtime"});return}let g=E(),v=u(a,U,c.expressionModules,c.importedTransformers,c.invariantImplementations,c.adminExpressionModules,void 0,void 0,void 0,g);for(let e of g.recorded())console.error(`[DomainSpecContext] ${e.message}`),K({code:e.code,message:e.message,severity:"error",source:"runtime"});if(!v.ok)return void U.clear();let{runtime:A}=v,C=null===Q.current||S(Q.current.configurator,a.configurator),D=B.selectors.environment.getPersistenceConfig();if(!C){let e;if("server"===D.type)return void K({code:"HOT_RELOAD_MODEL_CHANGE_REQUIRES_RESTART",message:"Domain model changes require an application restart and were not applied.",severity:"error",source:"runtime"});if(!B.selectors.domainContext.configurator.getInitializationState().isCurrent)return void B.selectors.domainServices.getLogger().debug("[DomainSpecContext] Skipping the model reset because no configurator session is initialized; the change applies once a session loads under the new spec.");try{e=j({runtime:A,implementationFiles:c,previousSpec:B.getState().spec})}catch(e){K({code:"HOT_RELOAD_PREPARE_FAILED",message:O(e),severity:"error",source:"runtime"});return}for(let r of(B.selectors.domainServices.getLogger().debug("[DomainSpecContext] Reseeding the reset session directly from the spec preset; onPresetLoadedHandler and ProductSelected analytics are intentionally skipped."),P(B,e,B.selectors.domainApplicationContext.configurator.getConfigurationPersistSystem().revisionId$.value),Q.current=a,e.implementationErrors))K({code:r.code,message:r.message,severity:"error",source:"runtime"});return}try{o=_({runtime:A,implementationFiles:c,previousSpec:B.getState().spec})}catch(e){K({code:"HOT_RELOAD_PREPARE_FAILED",message:O(e),severity:"error",source:"runtime"});return}if(n())for(let e of(R(B,o),Q.current=a,o.implementationErrors))K({code:e.code,message:e.message,severity:"error",source:"runtime"})},[B,V,ei,G,K,U,J,W]),ev=c(null),eS=n(e=>{let r=er.current+1;er.current=r,et.current={data:e,generation:r},ee.add(async()=>{let e=et.current;e&&e.data!==ev.current&&(et.current=null,ev.current=e.data,await ef(e.data,e.generation))})},[ef,ee]);N.onSpecChange.useSubscription(void 0,{enabled:!es&&el,onData:eS}),s(()=>{!es&&el&&eo().catch(()=>{console.warn("[DomainSpecContext] Failed to request spec files")})},[eo,es,el]);let eh=a(()=>({files:em,fileNames:eu,updateFile:eg,parsing:!1,parseError:H,clearParseError:ed,diagnostics:Y,clearDiagnostics:W,unreadDiagnosticCount:Z,markDiagnosticsRead:X}),[em,eu,eg,H,ed,Y,W,Z,X]);return e(b.Provider,{value:eh,children:i})};export const useDomainSpecContext=()=>{let e=i(b);if(null===e)throw Error("useDomainSpecContext must be used within DomainSpecProvider");return e};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type ApplicationRuntime as GeneratedApplicationRuntime } from '#package/application-spec';
|
|
2
2
|
import { type ImplementationError, type ApplicationSpec as RuntimeApplicationSpec } from '#package/domain';
|
|
3
3
|
import type { ApplicationRuntime } from '#package/react-sdk';
|
|
4
4
|
import type { ImplementationFiles } from './use-implementation-files.js';
|
|
@@ -23,6 +23,7 @@ export interface PrepareRuntimeRefreshInput {
|
|
|
23
23
|
readonly implementationFiles: ImplementationFiles;
|
|
24
24
|
readonly previousSpec: RuntimeApplicationSpec;
|
|
25
25
|
}
|
|
26
|
+
/** Refreshes the configurator sections of the live spec while the model's schema stays. */
|
|
26
27
|
export declare const prepareRuntimeRefresh: (input: PrepareRuntimeRefreshInput) => PreparedRuntimeRefresh;
|
|
27
28
|
/** Rebuilds every model-owned configurator field for an incompatible schema replacement. */
|
|
28
29
|
export declare const prepareRuntimeReset: (input: PrepareRuntimeRefreshInput) => PreparedRuntimeReset;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{applicationSpecSlice as e}from"#package/application-spec";import{findAssistantFormElementErrors as t}from"#package/domain";import{getPhoenixThemes as o}from"#package/ui-sdk";let n=e=>({handlers:e.handlers,elements:e.elements,customComponentOptics:e.customComponentOptics,actionImplementations:e.actionImplementations}),r=({configurator:e})=>t(e.assistant?.formElements??[],e.elements);export const prepareRuntimeRefresh=t=>{let i=e({runtime:t.runtime,modules:n(t.implementationFiles),themePresets:o(),previous:t.previousSpec,model:"keep"});return{nextSpec:i,implementationErrors:r(i)}};export const prepareRuntimeReset=t=>{let i=e({runtime:t.runtime,modules:n(t.implementationFiles),themePresets:o(),previous:t.previousSpec,model:"rebuild"}),s=i.configurator.presets[0];if(void 0===s)throw Error("Cannot reset the configurator after a model change because the application spec has no presets.");return{firstPreset:s,nextSpec:i,implementationErrors:r(i)}};let i=(e,t)=>{e.actions.spec.updateSpec(t)};export const applyRuntimeRefresh=(e,t)=>i(e,t.nextSpec);export const applyRuntimeReset=(e,t,o)=>{i(e,t.nextSpec),e.actions.loadedData.completeConfiguratorLoad({initialRevisionId:o,initialEntities:t.firstPreset.initialDomainEntities,modelVersion:t.nextSpec.configurator.modelVersion,rootEntityType:t.firstPreset.rootEntityType,schemaIdentity:t.nextSpec.configurator.factory})};export const applySpecUpdate=(e,t)=>i(e,t.nextSpec);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Application,
|
|
1
|
+
import type { Application, InvariantImplementations } from '#package/application-spec';
|
|
2
2
|
import { type AnyActionImplementations, type DomainComponentOptic, type DomainEntity, type ElementRegistration, type HandlerRegistration, type ImportedTransformer, type ProjectModule, type SystemComponentTypeConstraint } from '#package/domain';
|
|
3
3
|
type RuntimeData = Record<string, unknown>;
|
|
4
4
|
type RuntimeEntity = DomainEntity<string>;
|
|
@@ -21,15 +21,17 @@ export interface ReloadError {
|
|
|
21
21
|
/**
|
|
22
22
|
* The freshly reloaded (or cached) implementation files needed to build an `ApplicationRuntime`.
|
|
23
23
|
*
|
|
24
|
-
* `
|
|
24
|
+
* `expressionModules` and `adminExpressionModules` are the expression files as imported, unchecked:
|
|
25
|
+
* `ApplicationRuntime` checks and merges them with the aliases of the spec being edited.
|
|
26
|
+
* `expressionModules`, `adminExpressionModules`, `invariantImplementations`, `importedTransformers` and `customComponentOptics` always contain the latest
|
|
25
27
|
* successfully loaded values. So does `actionImplementations`, which is `null` only until the first successful load: a round
|
|
26
28
|
* that loaded them may be dropped before it is applied, and the next round must still carry them.
|
|
27
29
|
* `handlers`/`elements` are `null` when their category did not change this round.
|
|
28
30
|
*/
|
|
29
31
|
export interface ImplementationFiles {
|
|
30
|
-
readonly
|
|
32
|
+
readonly expressionModules: readonly ProjectModule[];
|
|
31
33
|
readonly actionImplementations: AnyActionImplementations | null;
|
|
32
|
-
readonly
|
|
34
|
+
readonly adminExpressionModules?: readonly ProjectModule[];
|
|
33
35
|
readonly invariantImplementations: InvariantImplementations;
|
|
34
36
|
readonly importedTransformers: readonly ImportedTransformer[];
|
|
35
37
|
readonly customComponentOptics: readonly ReloadedComponentOptic[] | null;
|
|
@@ -41,17 +43,7 @@ export interface GetImplementationFilesProps {
|
|
|
41
43
|
readonly application: Application;
|
|
42
44
|
readonly projectRoot: string;
|
|
43
45
|
}
|
|
44
|
-
type ResolvedExpressions = ExpressionImplementations;
|
|
45
|
-
/**
|
|
46
|
-
* Validates the expression modules through the resolver the domain builder uses, then expands their
|
|
47
|
-
* aliases. The expansion stays here because the editor rebuilds expressions against the alias map of
|
|
48
|
-
* the spec being edited, where the built app's domain builder holds its own.
|
|
49
|
-
*/
|
|
50
|
-
export declare const mergeExpressionModules: (modules: readonly ProjectModule[], aliasMap: Record<string, readonly string[]>) => ResolvedExpressions;
|
|
51
46
|
export declare const mergeComponentOptics: <ComponentOptic>(generatedComponentOptics: readonly ComponentOptic[], customComponentOptics: readonly ComponentOptic[]) => readonly ComponentOptic[];
|
|
52
|
-
export declare const getCustomComponentOptics: <ComponentOptic extends {
|
|
53
|
-
readonly generated?: boolean;
|
|
54
|
-
}>(componentOptics: readonly ComponentOptic[]) => readonly ComponentOptic[];
|
|
55
47
|
/**
|
|
56
48
|
* Owns the should-reload gating and cross-update caching for project implementation files
|
|
57
49
|
* (expressions, actions, invariants, components, transformers, handlers, elements). Returns `getImplementationFiles`,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{useCallback as e,useRef as n}from"react";import{
|
|
1
|
+
import{useCallback as e,useRef as n}from"react";import{resolveActionModules as t,resolveComponentOpticModules as a,resolveElementModule as r,resolveHandlerModule as o,resolveInvariantModules as i,resolveTransformerModule as s}from"#package/domain";import{importImplementationFile as l}from"./import-implementation-file.js";let m=e=>e instanceof Error?e.message:String(e),c=async(e,n)=>{let t=Date.now();return Promise.all(e.map(async e=>({origin:e,exports:await l(`/@fs/${n}/${e}?t=${t}`)})))},p=async(e,n)=>t(await c(e,n));export const mergeComponentOptics=(e,n)=>e.concat(n);let u=async(e,n)=>a(await c(e,n)),d=async(e,n)=>i(await c(e,n)),f=async(e,n)=>(await c(e,n)).map(s),h=async(e,n)=>(await c(e,n)).map(e=>({filePath:e.origin,registrations:o(e)})),g=async(e,n)=>(await c(e,n)).map(e=>({filePath:e.origin,registrations:r(e)}));export const useImplementationFiles=()=>{let t=n([]),a=n(null),r=n([]),o=n(0),i=n(null),s=n({}),l=n(null),E=n(null),F=n(null),w=n([]),I=n(null),y=n(null),A=n(new Map),R=n(new Map);return{getImplementationFiles:e(async e=>{let{application:n,projectRoot:O}=e,D=++o.current,{applicationSpec:L,categorizedFiles:S}=n,C=[],_=t.current,$=r.current,v=s.current,x=F.current,N=w.current,M=S.expressionsChanged,P=S.actionsChanged,b=S.componentsChanged,H=S.transformersChanged,T=S.handlersChanged,k=S.elementsChanged,j=Object.fromEntries(S.invariants.map(e=>[e.file.name,e.depHash])),J=l.current,X=JSON.stringify(L.configurator.invariants.entries),V=null===J||E.current!==X||Object.keys(J).length!==S.invariants.length||S.invariants.some(e=>J[e.file.name]!==e.depHash);if(console.info(`[useImplementationFiles] Changed: spec=${S.specChanged}, expressions=${S.expressionsChanged}, actions=${S.actionsChanged}, adminExpressions=${S.adminExpressionsChanged}, transformers=${S.transformersChanged}, handlers=${S.handlersChanged}, elements=${S.elementsChanged}`),M){console.info("[useImplementationFiles] Reloading expression implementations");try{t.current=_=await c(S.expressions.map(e=>e.file.name),O)}catch(e){console.warn("[useImplementationFiles] Failed to reload expressions:",e),C.push({code:"RELOAD_EXPRESSIONS_FAILED",message:m(e)})}}let q=a.current;if(P){console.info("[useImplementationFiles] Reloading action implementations");try{a.current=q=await p(S.actions.map(e=>e.file.name),O)}catch(e){console.warn("[useImplementationFiles] Failed to reload actions:",e),C.push({code:"RELOAD_ACTIONS_FAILED",message:m(e)})}}let z=JSON.stringify({projectRoot:O,files:S.adminExpressions.map(e=>[e.file.name,e.depHash])});if(D===o.current&&i.current!==z)try{$=await c(S.adminExpressions.map(e=>e.file.name),O),D===o.current&&(r.current=$,i.current=z)}catch(e){C.push({code:"RELOAD_ADMIN_EXPRESSIONS_FAILED",message:m(e)})}if(b){console.info("[useImplementationFiles] Reloading component optics");try{F.current=x=await u(S.components.map(e=>e.file.name),O)}catch(e){console.warn("[useImplementationFiles] Failed to reload components:",e),C.push({code:"RELOAD_COMPONENTS_FAILED",message:m(e)})}}if(V){console.info("[useImplementationFiles] Reloading invariant implementations");try{s.current=v=await d(S.invariants.map(e=>e.file.name),O),l.current=j,E.current=X}catch(e){console.warn("[useImplementationFiles] Failed to reload invariants:",e),C.push({code:"RELOAD_INVARIANTS_FAILED",message:m(e)})}}if(H){console.info("[useImplementationFiles] Reloading transformer implementations");try{w.current=N=await f(S.transformers.map(e=>e.file.name),O)}catch(e){console.warn("[useImplementationFiles] Failed to reload transformers:",e),C.push({code:"RELOAD_TRANSFORMERS_FAILED",message:m(e)})}}let B=null;if(T){console.info("[useImplementationFiles] Reloading handler implementations");try{let e=Object.fromEntries(S.handlers.map(e=>[e.file.name,e.depHash])),n=I.current,t=t=>null===n||n[t]!==e[t],a=R.current,r=S.handlers.map(e=>e.file.name),o=r.filter(e=>t(e)||!a.has(e)),i=await h(o,O),s=new Map(i.map(e=>[e.filePath,e])),l=r.map(e=>{let n=s.get(e)??a.get(e);if(!n)throw Error(`Handler file "${e}" was neither re-imported nor cached from a previous round. This is a hot-reload bookkeeping bug — reload the editor page to recover.`);return n}),m=l.flatMap(e=>e.registrations),c={};for(let{filePath:n,registrations:a}of l){let r=t(n)?e[n]:void 0;if(r)for(let e of a)c[e.name]=r}console.info(`[useImplementationFiles] Staged handlers for registry (${m.length} total)`),B={handlers:m,nameHashes:c},R.current=new Map(l.map(e=>[e.filePath,e])),I.current=e}catch(e){console.warn("[useImplementationFiles] Failed to reload handlers:",e),C.push({code:"RELOAD_HANDLERS_FAILED",message:m(e)})}}let G=null;if(k){console.info("[useImplementationFiles] Reloading element implementations");try{let e=Object.fromEntries(S.elements.map(e=>[e.file.name,e.depHash])),n=y.current,t=t=>null===n||n[t]!==e[t],a=A.current,r=S.elements.map(e=>e.file.name),o=r.filter(e=>t(e)||!a.has(e)),i=await g(o,O),s=new Map(i.map(e=>[e.filePath,e])),l=r.map(e=>{let n=s.get(e)??a.get(e);if(!n)throw Error(`Element file "${e}" was neither re-imported nor cached from a previous round. This is a hot-reload bookkeeping bug — reload the editor page to recover.`);return n}),m=l.flatMap(e=>e.registrations),c={},p=0;for(let{filePath:n,registrations:a}of l){let r=t(n)?e[n]:void 0;for(let e of a)if("assistantFormElement"!==e.type){if("entity"===e.type||"layout"===e.type){r&&(c[e.name]=r);continue}r&&(c[`icon:${p}`]=r),p+=1}}console.info(`[useImplementationFiles] Staged elements for registry (${m.length} total)`),G={elements:m,nameHashes:c},A.current=new Map(l.map(e=>[e.filePath,e])),y.current=e}catch(e){console.warn("[useImplementationFiles] Failed to reload elements:",e),C.push({code:"RELOAD_ELEMENTS_FAILED",message:m(e)})}}return{expressionModules:_,actionImplementations:q,adminExpressionModules:$,invariantImplementations:v,importedTransformers:N,customComponentOptics:x,handlers:B,elements:G,errors:C}},[])}};
|
|
@@ -17,5 +17,5 @@ export declare const CommonAnalyticsFactory: {
|
|
|
17
17
|
Initialized: typeof Initialized;
|
|
18
18
|
ConfigurationLoaded: typeof ConfigurationLoaded;
|
|
19
19
|
};
|
|
20
|
-
export declare const initializeAnalyticsService: (config: AnyApplicationConfig, logger: Logger, isDev: boolean) => AnalyticsSystem;
|
|
20
|
+
export declare const initializeAnalyticsService: (config: Pick<AnyApplicationConfig, 'services' | 'defaultEnvs'>, logger: Logger, isDev: boolean) => AnalyticsSystem;
|
|
21
21
|
export {};
|
|
@@ -2,6 +2,6 @@ import type { I18n } from '@lingui/core';
|
|
|
2
2
|
import { QueryClient } from '@tanstack/react-query';
|
|
3
3
|
import { type Logger } from '@salsita-ai/common/utils';
|
|
4
4
|
import type { AnyApplicationConfig } from '#package/domain';
|
|
5
|
-
export declare const initializeLogger: (config: AnyApplicationConfig, isDev: boolean) => Logger;
|
|
6
|
-
export declare const initializeI18n: (config: AnyApplicationConfig) => I18n;
|
|
5
|
+
export declare const initializeLogger: (config: Pick<AnyApplicationConfig, 'services' | 'defaultEnvs' | 'version'>, isDev: boolean) => Logger;
|
|
6
|
+
export declare const initializeI18n: (config: Pick<AnyApplicationConfig, 'services'>) => I18n;
|
|
7
7
|
export declare const createQueryClient: (logger: Logger) => QueryClient;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export*from"./use-application-runtime-selector.js";export{AccessServiceProvider,useAccessInfoActions,useAccessService,useAdminRawAccessService,useAdminRawAccessInfo,useConfigurationId,useConfiguratorRawAccessService,useConfiguratorRawAccessInfo,useProvidedAccessService}from"./use-access-service.js";export*from"./use-logger.js";export*from"./use-analytics-service.js";export*from"./use-application-query-client.js";export*from"./use-i18n.js";export*from"./use-spec.js";export*from"./use-environment.js";export*from"./use-overrides.js";export*from"./use-domain-application-props.js";export*from"./use-resource-url.js";export*from"./use-integration.js";export*from"./use-routing.js";export*from"./use-loaded-data.js";export*from"./use-domain-data.js";export*from"./use-session.js";export*from"./use-authorized-client.js";export*from"./use-authenticated-client.js";export*from"./use-phoenix-element-slots.js";export*from"./use-phoenix-handler-slots.js";export*from"./use-domain-application.js";export*from"./use-web-component.js";export*from"./use-web-component-readonly-sync.js";export*from"./data/index.js";export*from"./responsive/index.js";
|
|
1
|
+
export*from"./use-application-runtime-selector.js";export{AccessServiceProvider,useAccessInfoActions,useAccessService,useAdminRawAccessService,useAdminRawAccessInfo,useConfigurationId,useConfiguratorRawAccessService,useConfiguratorRawAccessInfo,useProvidedAccessService}from"./use-access-service.js";export*from"./use-logger.js";export*from"./use-analytics-service.js";export*from"./use-application-query-client.js";export*from"./use-i18n.js";export*from"./use-spec.js";export*from"./use-environment.js";export*from"./use-overrides.js";export*from"./use-domain-application-props.js";export*from"./use-resource-url.js";export*from"./use-integration.js";export*from"./use-routing.js";export*from"./use-loaded-data.js";export*from"./use-domain-data.js";export*from"./use-session.js";export*from"./use-authorized-client.js";export*from"./use-authenticated-client.js";export*from"./use-phoenix-element-slots.js";export*from"./use-phoenix-handler-slots.js";export*from"./use-domain-application.js";export*from"./use-web-component.js";export*from"./use-web-component-readonly-sync.js";export*from"./data/index.js";export*from"./loading/index.js";export*from"./responsive/index.js";
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { LoaderHostContext } from './loader-host-context.js';
|
|
2
|
+
export { useIsAwaitingLoadingPhase } from './use-is-awaiting-loading-phase.js';
|
|
3
|
+
export { useIsLoaderHosted } from './use-is-loader-hosted.js';
|
|
4
|
+
export { useLoadingActions } from './use-loading-actions.js';
|
|
5
|
+
export { useLoadingApplication } from './use-loading-application.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{LoaderHostContext}from"./loader-host-context.js";export{useIsAwaitingLoadingPhase}from"./use-is-awaiting-loading-phase.js";export{useIsLoaderHosted}from"./use-is-loader-hosted.js";export{useLoadingActions}from"./use-loading-actions.js";export{useLoadingApplication}from"./use-loading-application.js";
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Whether a component is mounted below the application's `LoaderHost`, which provides `true`. It is
|
|
3
|
+
* `false` everywhere else, as in the admin, which hosts no loader.
|
|
4
|
+
*
|
|
5
|
+
* It is a fact about the React tree, so it is a context and not part of the runtime's `loading`
|
|
6
|
+
* slice. It lives beside the hooks that read it rather than beside `LoaderHost`, because
|
|
7
|
+
* `loading-state/` imports from this folder and never the other way.
|
|
8
|
+
*
|
|
9
|
+
* @internal Runtime plumbing for the SDK's own UI.
|
|
10
|
+
*/
|
|
11
|
+
export declare const LoaderHostContext: import("react").Context<boolean>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{createContext as o}from"react";export const LoaderHostContext=o(!1);
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Whether the application this component is mounted in expects the loading phase `id` and that
|
|
3
|
+
* phase has not started since its loader host mounted. The loader stays up across that gap.
|
|
4
|
+
* `false` outside a loader host.
|
|
5
|
+
*
|
|
6
|
+
* @internal Runtime plumbing for the SDK's own UI.
|
|
7
|
+
*/
|
|
8
|
+
export declare const useIsAwaitingLoadingPhase: (id: string) => boolean;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{useCallback as e}from"react";import{useApplicationRuntimeSelector as o}from"../use-application-runtime-selector.js";import{useIsLoaderHosted as t}from"./use-is-loader-hosted.js";import{useLoadingApplication as s}from"./use-loading-application.js";export const useIsAwaitingLoadingPhase=i=>{let r=s(),a=t(),m=o(e(()=>r?.selectors.getIsAwaitingPhase(i)??!1,[r,i]));return a&&m};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Whether this component is mounted below the application's `LoaderHost`. Without one, the SDK's
|
|
3
|
+
* own UI shows its inline loaders, as the admin does.
|
|
4
|
+
*
|
|
5
|
+
* @internal Runtime plumbing for the SDK's own UI.
|
|
6
|
+
*/
|
|
7
|
+
export declare const useIsLoaderHosted: () => boolean;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{useContext as o}from"react";import{LoaderHostContext as t}from"./loader-host-context.js";export const useIsLoaderHosted=()=>o(t);
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { LoadingActions } from '../../loading/index.js';
|
|
2
|
+
/**
|
|
3
|
+
* The loading actions of the application this component is mounted in, or `null` outside its
|
|
4
|
+
* loader host, so that nothing reports phases no loader shows. Stable while the host stays mounted.
|
|
5
|
+
*
|
|
6
|
+
* @internal Runtime plumbing for the SDK's own UI. A project reports a phase with
|
|
7
|
+
* `phx.frontend.useLoadingState()`.
|
|
8
|
+
*/
|
|
9
|
+
export declare const useLoadingActions: () => LoadingActions | null;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{useIsLoaderHosted as o}from"./use-is-loader-hosted.js";import{useLoadingApplication as s}from"./use-loading-application.js";export const useLoadingActions=()=>{let t=s(),i=o();return null!==t&&i?t.actions:null};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The selectors and actions of the loading state of the application this component is mounted in,
|
|
3
|
+
* chosen by its `ApplicationTypeProvider` as the domain context hooks choose theirs. `null` outside
|
|
4
|
+
* an `ApplicationRuntimeProvider` or an `ApplicationTypeProvider`: the session and data providers also run in trees without one, where
|
|
5
|
+
* no loader is hosted.
|
|
6
|
+
*
|
|
7
|
+
* @internal Runtime plumbing for the SDK's own UI.
|
|
8
|
+
*/
|
|
9
|
+
export declare const useLoadingApplication: () => {
|
|
10
|
+
selectors: {
|
|
11
|
+
selectLoadingState: import("@salsita-ai/common/utils").Selector<import("../../loading/selectors.js").LoadingSelectorState, import("../../index.js").LoadingState>;
|
|
12
|
+
getLoadingState: () => import("../../index.js").LoadingState;
|
|
13
|
+
getIsAwaitingPhase: (id: string) => boolean;
|
|
14
|
+
};
|
|
15
|
+
actions: {
|
|
16
|
+
startPhase: (phase: import("../../index.js").LoadingPhase) => void;
|
|
17
|
+
endPhase: (id: string) => void;
|
|
18
|
+
reportError: () => void;
|
|
19
|
+
clearError: () => void;
|
|
20
|
+
expectPhase: (id: string) => void;
|
|
21
|
+
dropExpectation: (id: string) => void;
|
|
22
|
+
resetSlot: () => void;
|
|
23
|
+
};
|
|
24
|
+
} | null;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{useMemo as o}from"react";import{useOptionalApplicationRuntime as i,useOptionalApplicationType as n}from"../../provider/index.js";import{ApplicationType as r}from"../../runtime/index.js";export const useLoadingApplication=()=>{let t=i(),e=n();return o(()=>null===t||null===e?null:e===r.Admin?{selectors:t.selectors.loading.admin,actions:t.actions.loading.admin}:{selectors:t.selectors.loading.configurator,actions:t.actions.loading.configurator},[t,e])};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as e}from"react/jsx-runtime";import{createContext as s,useContext as c,useMemo as o}from"react";import{
|
|
1
|
+
import{jsx as e}from"react/jsx-runtime";import{createContext as s,useContext as c,useMemo as o}from"react";import{useApplicationRuntime as r,useApplicationType as t}from"../provider/index.js";import{ApplicationType as i}from"../runtime/index.js";import{useApplicationRuntimeSelector as n}from"./use-application-runtime-selector.js";let a=s(null);export const AccessServiceProvider=s=>e(a.Provider,{value:s.value,children:s.children});export const useProvidedAccessService=()=>{let e=c(a);if(null===e)throw Error("Access service not found! Render access-dependent hooks inside AccessServiceProvider.");return e};export const useAccessService=()=>{let e=t(),s=r(),c=useProvidedAccessService(),a=n(e===i.Admin?s.selectors.domainContext.admin.getIsViewMode:s.selectors.domainContext.configurator.getIsViewMode);return o(()=>({...c,accessInfo:{...c.accessInfo,viewMode:a}}),[c,a])};export const useConfigurationId=()=>useProvidedAccessService().configurationId;export const useConfiguratorRawAccessService=()=>n(r().selectors.access.getConfiguratorRawAccessService);export const useAdminRawAccessService=()=>n(r().selectors.access.getAdminRawAccessService);export const useConfiguratorRawAccessInfo=()=>n(r().selectors.access.getConfiguratorRawAccessInfo);export const useAdminRawAccessInfo=()=>n(r().selectors.access.getAdminRawAccessInfo);export const useAccessInfoActions=()=>r().actions.access;
|
|
@@ -1,15 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
2
|
+
* Does nothing. The application runtime mirrors the host's `readonly` web-component property into
|
|
3
|
+
* runtime state itself, from its construction on, so no component has to.
|
|
4
4
|
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
* embedded that way.
|
|
8
|
-
*
|
|
9
|
-
* Root placement means a domain lifecycle mounting in the same commit can initialize before the
|
|
10
|
-
* first value lands, since React runs child effects before parent effects. That is harmless: nothing
|
|
11
|
-
* reads the effective mode while initializing — persistence reads it per save request, and the
|
|
12
|
-
* domain context picks a later change up through the expression context, whose identity `reconcile`
|
|
13
|
-
* compares on every runtime notification.
|
|
5
|
+
* @deprecated The runtime keeps `readonly` in sync without it; remove the call. This hook will be
|
|
6
|
+
* removed in a future version.
|
|
14
7
|
*/
|
|
15
8
|
export declare const useWebComponentReadonlySync: () => void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
export const useWebComponentReadonlySync=()=>{};
|
|
@@ -7,6 +7,11 @@ export declare const useWebComponentApi: () => WebComponentApi;
|
|
|
7
7
|
export declare function useWebComponentProperty$<T>(property: WebComponentPropertyDescriptor<T>): BehaviorSubject<T>;
|
|
8
8
|
export declare function useWebComponentPropertySetter<T>(property: WebComponentPropertyDescriptor<T>): Dispatch<SetStateAction<T>>;
|
|
9
9
|
export declare const useWebComponentPropertyState: <T>(property: WebComponentPropertyDescriptor<T>) => [value: T, setValue: Dispatch<SetStateAction<T>>];
|
|
10
|
+
/**
|
|
11
|
+
* The property's current value; re-renders when it changes. A standard property the runtime
|
|
12
|
+
* mirrors is read from the slice its scope names, `hostProperties` or the domain's `webComponent`;
|
|
13
|
+
* any other property from its storage.
|
|
14
|
+
*/
|
|
10
15
|
export declare const useWebComponentPropertyValue: <T>(property: WebComponentPropertyDescriptor<T>) => T;
|
|
11
16
|
export declare const useDispatchWebComponentEvent: <T, R>(event: WebComponentEventDescriptor<T, R>) => (payload: T) => Promise<R | undefined>;
|
|
12
17
|
export declare const useWebcomponentGeneration: () => number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{useCallback as e}from"react";import{useEagerObservableValue as o}from"../../domain-context/common-hooks/use-observable-selector.js";import{
|
|
1
|
+
import{useCallback as e}from"react";import{useEagerObservableValue as o}from"../../domain-context/common-hooks/use-observable-selector.js";import{findMirroredHostPropertyReader as t}from"../host-properties/index.js";import{useApplicationRuntime as n}from"../provider/index.js";import{useApplicationRuntimeSelector as r}from"./use-application-runtime-selector.js";export const useWebComponentOptions=()=>n().selectors.commonServices.getWebComponentOptions();export const useWebComponentApi=()=>n().selectors.commonServices.getWebComponentApi();export function useWebComponentProperty$(e){return useWebComponentApi().getPropertyStorage(e).subject}export function useWebComponentPropertySetter(o){let t=useWebComponentProperty$(o);return e(e=>{let o="function"==typeof e?e(t.value):e;o!==t.value&&t.next(o)},[t])}export const useWebComponentPropertyState=e=>[useWebComponentPropertyValue(e),useWebComponentPropertySetter(e)];export const useWebComponentPropertyValue=e=>{let p=n(),s=useWebComponentProperty$(e),m=t(e),u=o(s,null===m);return r(()=>null===m?u:m(p.selectors))};export const useDispatchWebComponentEvent=o=>{let t=useWebComponentApi();return e(async e=>t.dispatchEvent(o,e),[o,t])};export const useWebcomponentGeneration=()=>r(n().selectors.webComponent.getWebcomponentGeneration);
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { HostPropertyName } from './host-property-scopes.js';
|
|
2
|
+
import type { HostPropertiesState, HostPropertyValue } from './types.js';
|
|
3
|
+
interface Context {
|
|
4
|
+
readonly setHostProperties: (update: (state: HostPropertiesState) => HostPropertiesState) => void;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* Internal to the runtime: only the subscription `connectHostProperties` sets up calls these. The
|
|
8
|
+
* runtime does not expose them on `actions`, because the host writes properties through the
|
|
9
|
+
* element.
|
|
10
|
+
*/
|
|
11
|
+
export declare const createHostPropertiesActions: (context: Context) => {
|
|
12
|
+
setHostProperty: <NAME extends HostPropertyName>(name: NAME, value: HostPropertyValue<NAME>) => void;
|
|
13
|
+
};
|
|
14
|
+
export type HostPropertiesActions = ReturnType<typeof createHostPropertiesActions>;
|
|
15
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{isShallowEqual as t}from"@salsita-ai/common/utils";export const createHostPropertiesActions=o=>{let{setHostProperties:r}=o;return{setHostProperty:(o,e)=>{r(r=>t(r[o],e)?r:{...r,[o]:e})}}};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { WebComponentHostActions, WebComponentSelectors } from '#package/domain';
|
|
2
|
+
import type { WebComponentApi } from '../web-component/index.js';
|
|
3
|
+
import type { HostPropertiesActions } from './actions.js';
|
|
4
|
+
interface Context {
|
|
5
|
+
readonly webComponentApi: WebComponentApi;
|
|
6
|
+
readonly actions: HostPropertiesActions;
|
|
7
|
+
/** The domain's `webComponent` slice, which keeps the domain-scoped properties. */
|
|
8
|
+
readonly domainSelectors: WebComponentSelectors;
|
|
9
|
+
readonly domainActions: WebComponentHostActions;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* The runtime-owned subscription behind the mirrored host properties: mirrors each mirrored
|
|
13
|
+
* property storage of the element into the slice its scope names, the application-scoped ones
|
|
14
|
+
* into `hostProperties` and the domain-scoped ones into the domain's `webComponent`. Either slice
|
|
15
|
+
* publishes only when a value changes, equal meaning shallowly equal.
|
|
16
|
+
*
|
|
17
|
+
* The runtime calls it once, right after its subject exists, and keeps it for its whole lifetime,
|
|
18
|
+
* as long as the element that owns the storages. The storages are `BehaviorSubject`s, so the first
|
|
19
|
+
* emissions replay the values the slices were initialized with and publish nothing, except a
|
|
20
|
+
* domain-scoped property the host set before the runtime existed. The admin application gets the
|
|
21
|
+
* domain-scoped properties too: its element never sets `readonly`, so the value stays `false`.
|
|
22
|
+
*
|
|
23
|
+
* Interim: the element's property storages are still the store and these slices a read mirror,
|
|
24
|
+
* so every mirrored value is held twice. CON-3142 makes the slice the only store (the element's
|
|
25
|
+
* setters and attribute parsing write it) and removes the storages and this subscription.
|
|
26
|
+
*
|
|
27
|
+
* @returns the unsubscribe, for tests and runtimes that end before their element.
|
|
28
|
+
*/
|
|
29
|
+
export declare const connectHostProperties: (context: Context) => (() => void);
|
|
30
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{isShallowEqual as r}from"@salsita-ai/common/utils";import{getDomainHostProperty as o,setDomainHostProperty as t}from"./domain-host-properties.js";import{hostPropertyDescriptors as s}from"./host-property-descriptors.js";import{domainHostPropertyNames as e,hostPropertyNames as p}from"./host-property-scopes.js";export const connectHostProperties=i=>{let{webComponentApi:m,actions:c,domainSelectors:a,domainActions:b}=i,u=[...p.map(r=>m.getPropertyStorage(s[r]).subject.subscribe(o=>{c.setHostProperty(r,o)})),...e.map(e=>m.getPropertyStorage(s[e]).subject.subscribe(s=>{r(o(a,e),s)||t(b,e,s)}))];return()=>{u.forEach(r=>{r.unsubscribe()})}};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { WebComponentHostActions, WebComponentSelectors } from '#package/domain';
|
|
2
|
+
import type { DomainHostPropertyName } from './host-property-scopes.js';
|
|
3
|
+
import type { HostPropertyValue } from './types.js';
|
|
4
|
+
/** A domain-scoped property's current value in the domain's `webComponent` slice. */
|
|
5
|
+
export declare const getDomainHostProperty: <NAME extends DomainHostPropertyName>(selectors: WebComponentSelectors, name: NAME) => HostPropertyValue<NAME>;
|
|
6
|
+
/** Writes a domain-scoped property into the domain's `webComponent` slice. */
|
|
7
|
+
export declare const setDomainHostProperty: <NAME extends DomainHostPropertyName>(actions: WebComponentHostActions, name: NAME, value: HostPropertyValue<NAME>) => void;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
let e={readonly:{get:e=>e.getReadonly(),set:(e,t)=>{e.setReadonly(t)}},locale:{get:e=>e.getLocale(),set:(e,t)=>{e.setLocale(t)}}};export const getDomainHostProperty=(t,o)=>e[o].get(t);export const setDomainHostProperty=(t,o,s)=>{e[o].set(t,s)};
|