@roomle/embedding-lib 0.0.0-dev-a4754cb
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/.releaserc.json +60 -0
- package/README.md +13 -0
- package/browser-BxG7yIaK.mjs +16 -0
- package/browser-CW9o-dtT.mjs +18 -0
- package/comlink-B2Kj_5Ge.mjs +206 -0
- package/comlink-B5lV2OWp.mjs +226 -0
- package/drag-ghost-BOwjMbG3.mjs +65 -0
- package/drag-ghost-BQ8r6NVo.mjs +60 -0
- package/drag-in-BP_E53zb.mjs +102 -0
- package/drag-in-QhL3zGC0.mjs +108 -0
- package/embedding-plugins.d.ts +2 -0
- package/embedding-plugins.js +2 -0
- package/embedding-plugins.min.js +2 -0
- package/from-custom-view-BM_zRJCf.mjs +227 -0
- package/from-custom-view-D2Z1YmCx.mjs +226 -0
- package/from-website-CPVeVVMI.mjs +123 -0
- package/from-website-DlklVbxU.mjs +118 -0
- package/hi-mcp-server-BtrPxgNY.mjs +5278 -0
- package/hi-mcp-server-ukmMIPNu.mjs +4866 -0
- package/hi.d.ts +2 -0
- package/hi.js +182 -0
- package/hi.min.js +167 -0
- package/package.json +50 -0
- package/packages/embedding-lib/src/connector.d.ts +44 -0
- package/packages/embedding-lib/src/embedding-plugins.d.ts +9 -0
- package/packages/embedding-lib/src/hi.d.ts +22 -0
- package/packages/embedding-lib/src/homag-intelligence/hi-callbacks.d.ts +3 -0
- package/packages/embedding-lib/src/homag-intelligence/hi-mcp/agent-facing.d.ts +35 -0
- package/packages/embedding-lib/src/homag-intelligence/hi-mcp/hi-mcp-server.d.ts +3 -0
- package/packages/embedding-lib/src/homag-intelligence/hi-mcp/mcp-tool.d.ts +69 -0
- package/packages/embedding-lib/src/homag-intelligence/hi-mcp/plan-history.d.ts +33 -0
- package/packages/embedding-lib/src/homag-intelligence/hi-mcp/planner-api.d.ts +32 -0
- package/packages/embedding-lib/src/homag-intelligence/hi-mcp/skills.d.ts +23 -0
- package/packages/embedding-lib/src/homag-intelligence/hi-mcp/tool-executors.d.ts +4 -0
- package/packages/embedding-lib/src/homag-intelligence/hi-mcp-tools.d.ts +11 -0
- package/packages/embedding-lib/src/homag-intelligence/hi-order-manager.d.ts +3 -0
- package/packages/embedding-lib/src/homag-intelligence/hi-planning-assistant.d.ts +55 -0
- package/packages/embedding-lib/src/homag-intelligence/hi-requests.d.ts +35 -0
- package/packages/embedding-lib/src/homag-intelligence/hi-setup.d.ts +6 -0
- package/packages/embedding-lib/src/homag-intelligence/hi-utils.d.ts +8 -0
- package/packages/embedding-lib/src/plugins/constants.d.ts +19 -0
- package/packages/embedding-lib/src/plugins/drag-in.d.ts +32 -0
- package/packages/embedding-lib/src/plugins/strategy/drag-phase.d.ts +25 -0
- package/packages/embedding-lib/src/plugins/strategy/from-custom-view.d.ts +39 -0
- package/packages/embedding-lib/src/plugins/strategy/from-website.d.ts +45 -0
- package/packages/embedding-lib/src/plugins/strategy/types.d.ts +14 -0
- package/packages/embedding-lib/src/plugins/types.d.ts +35 -0
- package/packages/embedding-lib/src/roomle-embedding-lib.d.ts +82 -0
- package/packages/embedding-lib/src/utils.d.ts +35 -0
- package/roomle-embedding-lib.d.ts +6 -0
- package/roomle-embedding-lib.js +396 -0
- package/roomle-embedding-lib.min.js +366 -0
- package/utils-DxJ3PcKe.mjs +131 -0
- package/utils-wJ80awOA.mjs +123 -0
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/** A frontmatter field as YAML reads it: a scalar, or a nested field (metadata) as an object of scalars. */
|
|
2
|
+
export type FrontmatterValue = string | Record<string, string>;
|
|
3
|
+
/** A planning skill in the Agent Skills format: a directory with SKILL.md and supporting files. */
|
|
4
|
+
export interface Skill {
|
|
5
|
+
name: string;
|
|
6
|
+
description: string;
|
|
7
|
+
frontmatter: Record<string, FrontmatterValue>;
|
|
8
|
+
/** The text of every file of the skill by its path in the skill's directory. */
|
|
9
|
+
texts: Record<string, string>;
|
|
10
|
+
files: string[];
|
|
11
|
+
}
|
|
12
|
+
export declare const SKILL_FILE = "SKILL.md";
|
|
13
|
+
/**
|
|
14
|
+
* Reads every skill of the skills directory, given as the text of each file by
|
|
15
|
+
* its path below the directory; a broken skill fails the load and names its
|
|
16
|
+
* file.
|
|
17
|
+
*/
|
|
18
|
+
export declare const loadSkills: (files: Record<string, string>) => Skill[];
|
|
19
|
+
/** One line per skill: its name and its description. */
|
|
20
|
+
export declare const skillIndex: (skills: Skill[]) => string;
|
|
21
|
+
/** A file of a skill by its path; only a file of the skill's list is read. */
|
|
22
|
+
export declare const readSkillFile: (skills: Skill[], name: string, file?: string) => string;
|
|
23
|
+
export declare const skills: Skill[];
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { PlanHistory } from './plan-history';
|
|
2
|
+
import { PlannerApi } from './planner-api';
|
|
3
|
+
export type ToolExecutor = (roomDesignerApi: PlannerApi, args: Record<string, unknown>) => Promise<unknown>;
|
|
4
|
+
export declare const createToolExecutors: (planHistory: PlanHistory) => Record<string, ToolExecutor>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { HiMcpTools } from './hi-mcp/mcp-tool';
|
|
2
|
+
import { HiMcpPlannerApi } from './hi-mcp/planner-api';
|
|
3
|
+
/**
|
|
4
|
+
* Creates the HI MCP tools for an AI agent that plans in the planner of this
|
|
5
|
+
* page: the tools of the HI MCP server as an AI SDK tool set, without the MCP
|
|
6
|
+
* protocol. The host passes the tool set as `tools` to its own `streamText`.
|
|
7
|
+
* The tools call the planner through `roomDesignerApi.extended` and chain its
|
|
8
|
+
* `onHistoryChange` callback; a host that sets its own handler sets it before.
|
|
9
|
+
* The tool code is loaded on the first call.
|
|
10
|
+
*/
|
|
11
|
+
export declare const createHiMcpTools: (roomDesignerApi: HiMcpPlannerApi) => Promise<HiMcpTools>;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { HomagIntelligenceInitData } from '../../../web-sdk/packages';
|
|
2
|
+
export declare const omPostRequest: (hiInitData: HomagIntelligenceInitData, body: any, url: string, extraHeaders?: Record<string, string>) => Promise<any>;
|
|
3
|
+
export declare const omGetRequest: (hiInitData: HomagIntelligenceInitData, url: string, extraHeaders?: Record<string, string>) => Promise<any>;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { PlanningAssistantOutput, PlanningAssistantPrompt } from '../../../web-sdk/packages';
|
|
2
|
+
import { HiMcpPlannerApi } from './hi-mcp/planner-api';
|
|
3
|
+
/**
|
|
4
|
+
* The model of the AI Planning Assistant as a JSON object: everything
|
|
5
|
+
* `loadChatModel` and `startPlanningAssistant` need to reach it.
|
|
6
|
+
*/
|
|
7
|
+
export interface PlanningAssistantConfig {
|
|
8
|
+
/** `azure` for a deployment on an Azure AI Foundry resource, else the provider of the model. */
|
|
9
|
+
provider: 'azure' | 'mistral' | 'anthropic' | 'google';
|
|
10
|
+
/** The model id at the provider; for `azure` the name of the deployment. */
|
|
11
|
+
model: string;
|
|
12
|
+
/** The API key of the provider; for `azure` the key of the Foundry resource. */
|
|
13
|
+
apiKey: string;
|
|
14
|
+
/** `azure` only: the OpenAI v1 endpoint of the Foundry resource, e.g. `https://<resource>.services.ai.azure.com/openai/v1`. */
|
|
15
|
+
baseUrl?: string;
|
|
16
|
+
/** `azure` only: call the deployment through the Chat Completions API instead of the Responses API. */
|
|
17
|
+
chatCompletions?: boolean;
|
|
18
|
+
/** `azure` only: the reasoning effort of the deployment; its default when unset. */
|
|
19
|
+
reasoningEffort?: string;
|
|
20
|
+
/** Whether the model reads images: the window offers the image drop only then. */
|
|
21
|
+
readsImages: boolean;
|
|
22
|
+
}
|
|
23
|
+
/** The planner the planning assistant runs in: the HI MCP tools' planner API, the agent prompts and the window. */
|
|
24
|
+
export type PlanningAssistantPlannerApi = HiMcpPlannerApi & {
|
|
25
|
+
extended: {
|
|
26
|
+
getExternalObjectAgentPrompts(): Promise<{
|
|
27
|
+
systemPrompt: string;
|
|
28
|
+
imagePrompt: string;
|
|
29
|
+
}>;
|
|
30
|
+
planningAssistantOutput(part: PlanningAssistantOutput): unknown;
|
|
31
|
+
callbacks: {
|
|
32
|
+
onPlanningAssistantPrompt?: (prompt: PlanningAssistantPrompt) => Promise<void>;
|
|
33
|
+
};
|
|
34
|
+
};
|
|
35
|
+
};
|
|
36
|
+
/** The AI SDK language model of the config and the provider options `streamText` takes with it. */
|
|
37
|
+
export declare const loadChatModel: ({ provider, model, apiKey, baseUrl, chatCompletions, reasoningEffort, }: PlanningAssistantConfig) => Promise<{
|
|
38
|
+
languageModel: any;
|
|
39
|
+
providerOptions: {
|
|
40
|
+
azure: {
|
|
41
|
+
reasoningEffort: string;
|
|
42
|
+
};
|
|
43
|
+
};
|
|
44
|
+
} | {
|
|
45
|
+
languageModel: any;
|
|
46
|
+
providerOptions?: undefined;
|
|
47
|
+
}>;
|
|
48
|
+
/**
|
|
49
|
+
* Runs the planning agent of the AI Planning Assistant window
|
|
50
|
+
* (featureFlags.planningAssistant) in this page: the window hands every
|
|
51
|
+
* message to "onPlanningAssistantPrompt", the agent calls the HI MCP tools,
|
|
52
|
+
* the tools call the planner of this page, and the agent's output goes to
|
|
53
|
+
* "planningAssistantOutput". Aborting the signal ends a running turn.
|
|
54
|
+
*/
|
|
55
|
+
export declare const startPlanningAssistant: (roomDesignerApi: PlanningAssistantPlannerApi, config: PlanningAssistantConfig, signal: AbortSignal) => Promise<void>;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { HomagIntelligenceInitData } from '../../../web-sdk/packages';
|
|
2
|
+
/**
|
|
3
|
+
* Register a subscription/library combination that requires the legacy
|
|
4
|
+
* TecConfig URL format.
|
|
5
|
+
*
|
|
6
|
+
* Call this **before** `setupHi` so that subsequent data fetches
|
|
7
|
+
* (`libLoadArticleCatalog`, `libLoadMasterData`, `libLoadCalcScript`)
|
|
8
|
+
* use the correct URL scheme.
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* ```typescript
|
|
12
|
+
* import { registerLegacyUrlFormat, setupHi } from '@roomle/embedding-lib/hi';
|
|
13
|
+
*
|
|
14
|
+
* registerLegacyUrlFormat('5bf5fac8-58af-4a95-a5e0-41a4dc52d5f5', 'Furniture_Smith');
|
|
15
|
+
* await setupHi(hiOptions, callbacks);
|
|
16
|
+
* ```
|
|
17
|
+
*/
|
|
18
|
+
export declare const registerLegacyUrlFormat: (subscriptionId: string, libraryId: string) => void;
|
|
19
|
+
/**
|
|
20
|
+
* Unregister a subscription/library combination so it no longer uses the
|
|
21
|
+
* legacy TecConfig URL format.
|
|
22
|
+
*
|
|
23
|
+
* Useful when HOMAG migrates a subscription to the newer URL scheme.
|
|
24
|
+
*
|
|
25
|
+
* @example
|
|
26
|
+
* ```typescript
|
|
27
|
+
* import { unregisterLegacyUrlFormat } from '@roomle/embedding-lib/hi';
|
|
28
|
+
*
|
|
29
|
+
* unregisterLegacyUrlFormat('e2fe8b3d-da31-4a20-92ab-ab6e3839300e', 'Furniture_Smith');
|
|
30
|
+
* ```
|
|
31
|
+
*/
|
|
32
|
+
export declare const unregisterLegacyUrlFormat: (subscriptionId: string, libraryId: string) => void;
|
|
33
|
+
export declare const libLoadArticleCatalog: (hiInitData: HomagIntelligenceInitData) => Promise<any>;
|
|
34
|
+
export declare const libLoadMasterData: (hiInitData: HomagIntelligenceInitData) => Promise<any>;
|
|
35
|
+
export declare const libLoadCalcScript: (hiInitData: HomagIntelligenceInitData) => Promise<string>;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { HiCallbacks } from '../../../common/src/hi/hi-types';
|
|
2
|
+
import { HomagIntelligenceInitData, GlobalInitDataDefinition } from '../../../web-sdk/packages';
|
|
3
|
+
/** @internal Exported for testing purposes */
|
|
4
|
+
export declare const setFallbackLanguage: (hiInitData: HomagIntelligenceInitData, globalInitData: GlobalInitDataDefinition) => void;
|
|
5
|
+
export declare const setupHi: (libraryIdOrOptions: HomagIntelligenceInitData | string, callbacks?: Partial<HiCallbacks>) => Promise<void>;
|
|
6
|
+
export declare const cleanupHi: () => void;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { HomagIntelligenceInitData } from '../../../web-sdk/packages';
|
|
2
|
+
export declare const HOMAG_INTELLIGENCE_ENDPOINT = "https://europe-west3-rml-showcases.cloudfunctions.net/proxy_request?url=";
|
|
3
|
+
/**
|
|
4
|
+
* Returns `hiInitData` unchanged when its `libraryId` already matches the
|
|
5
|
+
* requested one (avoiding an unnecessary allocation), otherwise returns a
|
|
6
|
+
* shallow copy with the `libraryId` overridden.
|
|
7
|
+
*/
|
|
8
|
+
export declare const withLibraryId: (hiInitData: HomagIntelligenceInitData, libraryId: string) => HomagIntelligenceInitData;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export declare const RML_DRAG_IN_STYLES_ID = "rml-drag-in-styles";
|
|
2
|
+
export declare const RML_DRAG_IN_DRAG_ELEMENT_ID = "rml-drag-in-drag-element";
|
|
3
|
+
export declare const RML_DRAG_IN_OVERLAY_CSS_CLASS = "rml-drag-in-overlay";
|
|
4
|
+
export declare const RML_DRAG_IN_DRAG_GHOST_CSS_CLASS = "rml-drag-in-drag-ghost";
|
|
5
|
+
export declare const RML_DRAG_IN_FADE_IN_ANIMATION = "rml-drag-in-fade-in";
|
|
6
|
+
export declare const RML_DRAG_IN_FADE_OUT_ANIMATION = "rml-drag-in-fade-out";
|
|
7
|
+
export declare const RML_CSS_CLASSES: {
|
|
8
|
+
readonly DISPLAY_NONE: "rml-display-none";
|
|
9
|
+
};
|
|
10
|
+
export declare const TARGET_OPACITY = 0.5;
|
|
11
|
+
export declare const ANIMATION_DURATION = "250ms";
|
|
12
|
+
export declare const ANIMATION_DIRECTION = "forwards";
|
|
13
|
+
export declare const RML_DRAG_GHOST_FADE_IN_ANIMATION_CSS = "@keyframes rml-drag-in-fade-in {from{opacity: 0;}to {opacity: 0.5;}}";
|
|
14
|
+
export declare const RML_DRAG_GHOST_FADE_OUT_ANIMATION_CSS = "@keyframes rml-drag-in-fade-out {from{opacity: 0.5;}to {opacity: 0;}}";
|
|
15
|
+
export declare const RML_DRAG_GHOST_FADE_IN = "rml-drag-in-fade-in 250ms forwards";
|
|
16
|
+
export declare const RML_DRAG_GHOST_FADE_OUT = "rml-drag-in-fade-out 250ms forwards";
|
|
17
|
+
export declare const RML_DRAG_IN_FALLBACK_GHOST_URL = "https://res.cloudinary.com/roomle/image/upload/v1729679975/fallback_afpyqr.jpg";
|
|
18
|
+
export declare const RML_DRAG_IN_FALLBACK_GHOST_WIDTH = 112;
|
|
19
|
+
export declare const RML_DRAG_IN_FALLBACK_GHOST_HEIGHT = 112;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { RapiId } from '../../../web-sdk/packages';
|
|
2
|
+
import { ExposedApi } from '../../../../src/configurator/embedding/exposed-api';
|
|
3
|
+
import { DragInSettings, EmbeddingPlugin, EmbeddingPluginMode } from './types';
|
|
4
|
+
import { PossibleCustomViewsAndMain } from '../../../../src/configurator/embedding/custom-views';
|
|
5
|
+
import { DragInStrategy } from './strategy/types';
|
|
6
|
+
import { OnBeforeUpdateDragGhost } from '../embedding-plugins';
|
|
7
|
+
export declare class DragIn extends EmbeddingPlugin implements DragInStrategy {
|
|
8
|
+
options: DragInSettings;
|
|
9
|
+
private _strategy;
|
|
10
|
+
private _customDragSignal;
|
|
11
|
+
private _injectStyles;
|
|
12
|
+
private _initializeDragGhost;
|
|
13
|
+
constructor(instance: ExposedApi, mainDomElement: HTMLIFrameElement | HTMLBodyElement, mode: EmbeddingPluginMode, viewName: PossibleCustomViewsAndMain);
|
|
14
|
+
init(): Promise<void>;
|
|
15
|
+
get isDragging(): boolean;
|
|
16
|
+
dragStart(id: RapiId, event: DragEvent | TouchEvent | MouseEvent, type?: string): void;
|
|
17
|
+
dragUpdate(event: DragEvent | TouchEvent | MouseEvent): void;
|
|
18
|
+
dragEnd(): void;
|
|
19
|
+
touchStart(id: RapiId, event: TouchEvent, type?: string): void;
|
|
20
|
+
touchMove(event: TouchEvent): void;
|
|
21
|
+
touchEnd(): void;
|
|
22
|
+
dispose(): void;
|
|
23
|
+
beforeUpdateGhost(handler: OnBeforeUpdateDragGhost): void;
|
|
24
|
+
registerCustomDrag({ customDragStart, customDragEnd, customDragUpdate, beforeUpdateGhost, }: {
|
|
25
|
+
customDragStart: (event: MouseEvent | TouchEvent) => void;
|
|
26
|
+
customDragEnd: (event: MouseEvent | TouchEvent) => void;
|
|
27
|
+
customDragUpdate: (event: MouseEvent | TouchEvent) => void;
|
|
28
|
+
beforeUpdateGhost?: OnBeforeUpdateDragGhost;
|
|
29
|
+
}): void;
|
|
30
|
+
unregisterCustomDrag(): void;
|
|
31
|
+
releaseInput(event: DragEvent | TouchEvent | MouseEvent): void;
|
|
32
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* How far a drag-in strategy's `dragStart` has got.
|
|
3
|
+
*
|
|
4
|
+
* Both strategies ask Rubens for bounding rects over `MessageHandler` — an
|
|
5
|
+
* `await` — while `dragUpdate` keeps firing synchronously. In that window a drag
|
|
6
|
+
* is running but the strategy cannot yet tell whether the pointer is over the
|
|
7
|
+
* canvas, so changing the scene there is what caused RML-17511. The rects live
|
|
8
|
+
* inside `ready` rather than in nullable fields, so "not loaded yet" cannot be
|
|
9
|
+
* mistaken for "that element does not exist".
|
|
10
|
+
*
|
|
11
|
+
* `failed` is terminal: `dragUpdate` should keep ignoring events instead of
|
|
12
|
+
* looking like it is still loading. Details in
|
|
13
|
+
* `.agents/findings/homag-drag-in-inserts-object-twice.md`.
|
|
14
|
+
*/
|
|
15
|
+
export type DragPhase<TBounds> = {
|
|
16
|
+
kind: 'idle';
|
|
17
|
+
} | {
|
|
18
|
+
kind: 'starting';
|
|
19
|
+
} | {
|
|
20
|
+
kind: 'ready';
|
|
21
|
+
bounds: TBounds;
|
|
22
|
+
} | {
|
|
23
|
+
kind: 'failed';
|
|
24
|
+
reason: string;
|
|
25
|
+
};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { DragInStrategy } from './types';
|
|
2
|
+
import { ID_TYPE, RapiId } from '../../../../web-sdk/packages';
|
|
3
|
+
import { ExposedApi } from '../../../../../src/configurator/embedding/exposed-api';
|
|
4
|
+
import { DragInSettings } from '../types';
|
|
5
|
+
import { PossibleCustomViewsAndMain } from '../../../../../src/configurator/embedding/custom-views';
|
|
6
|
+
import { OnBeforeUpdateDragGhost } from '../../embedding-plugins';
|
|
7
|
+
export declare class DragInFromCustomViewStrategy implements DragInStrategy {
|
|
8
|
+
private _options;
|
|
9
|
+
private _instance;
|
|
10
|
+
private _mainDomElement;
|
|
11
|
+
private _viewName;
|
|
12
|
+
private _currentCustomDrag;
|
|
13
|
+
private _startTarget;
|
|
14
|
+
private _dragGhost;
|
|
15
|
+
private _onBeforeUpdateDrag;
|
|
16
|
+
isDragging: boolean;
|
|
17
|
+
private _hasEnteredIframe;
|
|
18
|
+
private _pendingDragIn;
|
|
19
|
+
private _phase;
|
|
20
|
+
private _dragGeneration;
|
|
21
|
+
/** Kept so `dispose()` can remove the listener again. */
|
|
22
|
+
private _parentWithDragLeave;
|
|
23
|
+
/** Same listener and same reasoning as `_parentDragLeave` in `from-website.ts`. */
|
|
24
|
+
private _parentDragLeave;
|
|
25
|
+
constructor(instance: ExposedApi, mainDomElement: HTMLIFrameElement, options: DragInSettings, viewName: PossibleCustomViewsAndMain);
|
|
26
|
+
beforeUpdateGhost(handler: OnBeforeUpdateDragGhost): void;
|
|
27
|
+
_dragStart(id: RapiId, _event: MouseEvent | TouchEvent, type?: ID_TYPE): Promise<void>;
|
|
28
|
+
_dragUpdate(event: MouseEvent | TouchEvent): void;
|
|
29
|
+
_dragEnd(): void;
|
|
30
|
+
dragStart(id: RapiId, event: MouseEvent | TouchEvent, type: ID_TYPE): void;
|
|
31
|
+
dragEnd(): void;
|
|
32
|
+
dragUpdate(event: MouseEvent | TouchEvent): void;
|
|
33
|
+
touchStart(id: RapiId, event: TouchEvent, type?: ID_TYPE): void;
|
|
34
|
+
touchMove(event: TouchEvent): void;
|
|
35
|
+
touchEnd(): void;
|
|
36
|
+
dispose(): void;
|
|
37
|
+
private _resetStartTarget;
|
|
38
|
+
releaseInput(_event: TouchEvent | MouseEvent): void;
|
|
39
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { DragInStrategy } from './types';
|
|
2
|
+
import { ID_TYPE, RapiId } from '../../../../web-sdk/packages';
|
|
3
|
+
import { ExposedApi } from '../../../../../src/configurator/embedding/exposed-api';
|
|
4
|
+
import { DragInOptions } from '../types';
|
|
5
|
+
import { OnBeforeUpdateDragGhost } from '../../embedding-plugins';
|
|
6
|
+
export declare class DragInFromWebsiteStrategy implements DragInStrategy {
|
|
7
|
+
private _options;
|
|
8
|
+
private _instance;
|
|
9
|
+
private _mainDomElement;
|
|
10
|
+
private _currentDrag;
|
|
11
|
+
private _firefoxDragPosition;
|
|
12
|
+
private _onBeforeUpdateDrag;
|
|
13
|
+
isDragging: boolean;
|
|
14
|
+
private _hasEnteredIframe;
|
|
15
|
+
private _dragInObjectCalled;
|
|
16
|
+
private _pendingDragIn;
|
|
17
|
+
private _phase;
|
|
18
|
+
/**
|
|
19
|
+
* Bumped by `dragStart` and `dragEnd`, so a `dragStart` still awaiting its rect
|
|
20
|
+
* cannot arm the *next* drag with this drag's rects.
|
|
21
|
+
*/
|
|
22
|
+
private _dragGeneration;
|
|
23
|
+
private _currentTouch;
|
|
24
|
+
/** Kept so `dispose()` can remove the listener again. */
|
|
25
|
+
private _parentWithDragLeave;
|
|
26
|
+
private _firefoxFallback;
|
|
27
|
+
/**
|
|
28
|
+
* Fires for every `dragleave` bubbling up through the iframe's parent, ours or
|
|
29
|
+
* not, so it needs the same guard `dragUpdate` has. Kept because `dragUpdate`
|
|
30
|
+
* bails once `getXY` reports 0,0, leaving this the only cancel for a drag that
|
|
31
|
+
* ends outside the iframe. Trade-off of the reset in
|
|
32
|
+
* `.agents/plans/drag-in-host-page-hardening.md`.
|
|
33
|
+
*/
|
|
34
|
+
private _parentDragLeave;
|
|
35
|
+
constructor(instance: ExposedApi, mainDomElement: HTMLIFrameElement, options: DragInOptions);
|
|
36
|
+
beforeUpdateGhost(handler: OnBeforeUpdateDragGhost): void;
|
|
37
|
+
dragStart(id: RapiId, event: DragEvent | TouchEvent, type?: ID_TYPE): Promise<void>;
|
|
38
|
+
dragUpdate(event: DragEvent | TouchEvent): void;
|
|
39
|
+
dragEnd(): void;
|
|
40
|
+
touchStart(id: RapiId, event: TouchEvent, type?: ID_TYPE): void;
|
|
41
|
+
touchMove(event: TouchEvent): void;
|
|
42
|
+
touchEnd(): void;
|
|
43
|
+
dispose(): void;
|
|
44
|
+
releaseInput(_event: DragEvent | TouchEvent | MouseEvent): void;
|
|
45
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { RapiId } from '../../../../web-sdk/packages';
|
|
2
|
+
import { OnBeforeUpdateDragGhost } from '../../embedding-plugins';
|
|
3
|
+
export interface DragInStrategy {
|
|
4
|
+
isDragging: boolean;
|
|
5
|
+
dragStart(id: RapiId, event: DragEvent | TouchEvent | MouseEvent, type?: string): void | Promise<void>;
|
|
6
|
+
dragUpdate(event: DragEvent | TouchEvent | MouseEvent): void;
|
|
7
|
+
dragEnd(): void;
|
|
8
|
+
touchStart(id: RapiId, event: TouchEvent, type?: string): void;
|
|
9
|
+
touchMove(event: TouchEvent): void;
|
|
10
|
+
touchEnd(): void;
|
|
11
|
+
beforeUpdateGhost(handler: OnBeforeUpdateDragGhost): void;
|
|
12
|
+
releaseInput(event: DragEvent | TouchEvent | MouseEvent): void;
|
|
13
|
+
dispose(): void;
|
|
14
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { ExposedApi } from '../../../../src/configurator/embedding/exposed-api';
|
|
2
|
+
import { PossibleCustomViewsAndMain } from '../../../../src/configurator/embedding/custom-views';
|
|
3
|
+
import { PointRect } from '../../../common/src/utils/drag';
|
|
4
|
+
export type EmbeddingPluginMode = 'website' | 'custom-view';
|
|
5
|
+
export declare class EmbeddingPlugin {
|
|
6
|
+
protected _mainDomElement: HTMLIFrameElement | HTMLBodyElement;
|
|
7
|
+
protected _instance: ExposedApi;
|
|
8
|
+
protected _mode: EmbeddingPluginMode;
|
|
9
|
+
protected _viewName: PossibleCustomViewsAndMain;
|
|
10
|
+
constructor(instance: ExposedApi, iframe: HTMLIFrameElement | HTMLBodyElement, mode: EmbeddingPluginMode, viewName: PossibleCustomViewsAndMain);
|
|
11
|
+
init(): Promise<void>;
|
|
12
|
+
}
|
|
13
|
+
export interface DragInSettings {
|
|
14
|
+
dragInOverlapX?: number;
|
|
15
|
+
dragInOverlapY?: number;
|
|
16
|
+
fingerSize?: number;
|
|
17
|
+
touchDragDelay?: number;
|
|
18
|
+
touchDragEpsilon?: number;
|
|
19
|
+
customDragDelay?: number;
|
|
20
|
+
customDragEpsilon?: number;
|
|
21
|
+
}
|
|
22
|
+
export interface DragGhostOptions {
|
|
23
|
+
external?: boolean;
|
|
24
|
+
visibleIn?: PointRect;
|
|
25
|
+
hiddenIn?: PointRect;
|
|
26
|
+
url?: string;
|
|
27
|
+
width?: number;
|
|
28
|
+
height?: number;
|
|
29
|
+
element?: HTMLElement;
|
|
30
|
+
}
|
|
31
|
+
export interface DragInOptions {
|
|
32
|
+
settings?: DragInSettings;
|
|
33
|
+
ghost?: DragGhostOptions;
|
|
34
|
+
mode?: EmbeddingPluginMode;
|
|
35
|
+
}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { ConfiguratorSettings, UiInitData } from '../../../src/configurator/embedding/types';
|
|
2
|
+
import { PossibleCustomViews } from '../../../src/configurator/embedding/custom-views';
|
|
3
|
+
import { ConfiguratorUiCallbacks, RoomleConfigurator, RoomleGLBViewer, RoomlePlanner } from '../../web-sdk/packages';
|
|
4
|
+
import { DragIn } from './plugins/drag-in';
|
|
5
|
+
import { Connector, RoomleEmbeddingApiKeys } from './connector';
|
|
6
|
+
export declare const NAMESPACE: {
|
|
7
|
+
[key: string]: keyof RoomleEmbeddingApiKeys | 'callbacks';
|
|
8
|
+
};
|
|
9
|
+
export declare const NAMESPACE_SEPARATOR = ".";
|
|
10
|
+
export declare const SDK_CALLBACK: string;
|
|
11
|
+
export declare const HANDSHAKE_MESSAGES: {
|
|
12
|
+
REQUEST_BOOT: string;
|
|
13
|
+
SETUP: string;
|
|
14
|
+
WEBSITE_READY: string;
|
|
15
|
+
};
|
|
16
|
+
export declare const WELL_KNOWN_MESSAGES: {
|
|
17
|
+
GET_METHODS: string;
|
|
18
|
+
RETURN_METHODS: string;
|
|
19
|
+
REGISTER_CUSTOM_VIEW: string;
|
|
20
|
+
REGISTER_CUSTOM_VIEW_DONE: string;
|
|
21
|
+
};
|
|
22
|
+
export declare const isExposable: (name: string) => boolean;
|
|
23
|
+
export declare const getMethodNames: (proto: any, namespace: string, isCallback?: boolean) => string[];
|
|
24
|
+
export declare const getConfiguratorSettings: (configuratorId: string, initData: UiInitData) => Promise<ConfiguratorSettings>;
|
|
25
|
+
export declare const INTERACTION_CONTAINER_SELECTOR = "data-rml-interaction-container";
|
|
26
|
+
export type { ConfiguratorSettings, UiInitData, } from '../../../src/configurator/embedding/types';
|
|
27
|
+
interface PluginMap {
|
|
28
|
+
dragIn: typeof DragIn;
|
|
29
|
+
}
|
|
30
|
+
export type AvailablePlugins = {
|
|
31
|
+
[K in keyof PluginMap]?: InstanceType<PluginMap[K]>;
|
|
32
|
+
};
|
|
33
|
+
export type PluginConstructors = {
|
|
34
|
+
[K in keyof PluginMap]: PluginMap[K];
|
|
35
|
+
};
|
|
36
|
+
export type PluginDefinitions = Array<keyof AvailablePlugins | {
|
|
37
|
+
name: keyof AvailablePlugins;
|
|
38
|
+
loader: () => Promise<PluginConstructors[keyof PluginConstructors]>;
|
|
39
|
+
}>;
|
|
40
|
+
export type RoomleConfiguratorApi = RoomleEmbeddingApi<RoomleConfigurator, ConfiguratorUiCallbacks>;
|
|
41
|
+
export type RoomleViewerApi = RoomleEmbeddingApi<RoomleGLBViewer, ConfiguratorUiCallbacks>;
|
|
42
|
+
export type RoomlePlannerApi = RoomleEmbeddingApi<RoomlePlanner, ConfiguratorUiCallbacks>;
|
|
43
|
+
export default class RoomleEmbeddingApi<SdkType, SdkCallbacks> extends Connector<SdkType, SdkCallbacks> {
|
|
44
|
+
static createPlanner(configuratorId: string, container: HTMLElement, initData: UiInitData, plugins?: PluginDefinitions): Promise<RoomlePlannerApi>;
|
|
45
|
+
static connect(customView: PossibleCustomViews, plugins?: PluginDefinitions): Promise<Connector<RoomleConfigurator<readonly []>, ConfiguratorUiCallbacks>>;
|
|
46
|
+
/**
|
|
47
|
+
* Method to create a new instance of a Roomle Configurator
|
|
48
|
+
* @param configuratorId the id which identifies your configurator, you will get this ID from your Roomle Contact Person
|
|
49
|
+
* @param container DOM container in which the configurator should be placed
|
|
50
|
+
* @param initData settings with which the configurator should be started
|
|
51
|
+
*/
|
|
52
|
+
static createConfigurator(configuratorId: string, container: HTMLElement, initData: UiInitData, plugins?: PluginDefinitions): Promise<RoomleConfiguratorApi>;
|
|
53
|
+
/**
|
|
54
|
+
* Method to create a new instance of a Roomle Configurator
|
|
55
|
+
* @deprecated please use "createConfigurator"
|
|
56
|
+
* @param configuratorId the id which identifies your configurator, you will get this ID from your Roomle Contact Person
|
|
57
|
+
* @param container DOM container in which the configurator should be placed
|
|
58
|
+
* @param initData settings with which the configurator should be started
|
|
59
|
+
*/
|
|
60
|
+
static create(configuratorId: string, container: HTMLElement, initData: UiInitData, plugins: PluginDefinitions): Promise<RoomleConfiguratorApi>;
|
|
61
|
+
/**
|
|
62
|
+
* Method to create a new instance of a Roomle Viewer
|
|
63
|
+
* @param configuratorId the id which identifies your configurator, you will get this ID from your Roomle Contact Person
|
|
64
|
+
* @param container DOM container in which the configurator should be placed
|
|
65
|
+
* @param initData settings with which the configurator should be started
|
|
66
|
+
*/
|
|
67
|
+
static createViewer(configuratorId: string, container: HTMLElement, initData: UiInitData, plugins?: PluginDefinitions): Promise<RoomleViewerApi>;
|
|
68
|
+
private static _create;
|
|
69
|
+
private _waitForIframe;
|
|
70
|
+
private _container;
|
|
71
|
+
private _configuratorSettings;
|
|
72
|
+
private _initData;
|
|
73
|
+
private _iframe;
|
|
74
|
+
private constructor();
|
|
75
|
+
teardown(): void;
|
|
76
|
+
private _createIframe;
|
|
77
|
+
private _onResize;
|
|
78
|
+
private _onUseFullPage;
|
|
79
|
+
private _onBackToWebsite;
|
|
80
|
+
private _executeMessage;
|
|
81
|
+
}
|
|
82
|
+
export { type Connector } from './connector';
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { Nullable } from '../../common/src/utils/types';
|
|
2
|
+
export declare const getComputedStyleCached: (element: HTMLElement) => CSSStyleDeclaration;
|
|
3
|
+
export declare const convertToPixels: (value: string, unit: string, element: HTMLElement) => number;
|
|
4
|
+
export declare const getXY: (element: HTMLElement, event: DragEvent | TouchEvent, fallback?: {
|
|
5
|
+
x: number;
|
|
6
|
+
y: number;
|
|
7
|
+
}) => {
|
|
8
|
+
x: number;
|
|
9
|
+
y: number;
|
|
10
|
+
};
|
|
11
|
+
export declare const extractClientXY: (event: MouseEvent | DragEvent | TouchEvent, fallback?: Nullable<{
|
|
12
|
+
x: number;
|
|
13
|
+
y: number;
|
|
14
|
+
}>) => {
|
|
15
|
+
clientX: number;
|
|
16
|
+
clientY: number;
|
|
17
|
+
};
|
|
18
|
+
export declare const createGracefulProxy: <T extends object>(target: Partial<T>) => T;
|
|
19
|
+
export declare const isPointInBounds: (clientX: number, clientY: number, bounds: {
|
|
20
|
+
left: number;
|
|
21
|
+
right: number;
|
|
22
|
+
top: number;
|
|
23
|
+
bottom: number;
|
|
24
|
+
}) => boolean;
|
|
25
|
+
export declare const isOverVisibleCanvasFromCustomView: (clientX: number, clientY: number, canvasBb: Nullable<DOMRect>, overlayBb: Nullable<DOMRect>, interactionContainerBb: Nullable<DOMRect>, iframeBounds?: DOMRect) => boolean;
|
|
26
|
+
/**
|
|
27
|
+
* Is the point over Rubens' visible 3D canvas? The host-page vantage point of
|
|
28
|
+
* `isOverVisibleCanvasFromCustomView` above: all it has is the iframe rect,
|
|
29
|
+
* standing in for the canvas, minus the interaction container.
|
|
30
|
+
*
|
|
31
|
+
* `interactionContainer` arrives in iframe-local coordinates and is offset here.
|
|
32
|
+
* `null` means there is none, so the whole iframe is canvas — pass it only once
|
|
33
|
+
* that is known, never while the rect is still loading (RML-17511).
|
|
34
|
+
*/
|
|
35
|
+
export declare const isOverVisibleCanvasFromHostPage: (clientX: number, clientY: number, iframeBounds: DOMRect, interactionContainer: Nullable<DOMRect>) => boolean;
|