@spatial-elements/core 0.1.0-beta.1 → 1.0.0-beta.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +13 -2
- package/dist/catalog/CatalogGeometryFade.d.ts.map +1 -1
- package/dist/catalog/CatalogGeometryFade.js +6 -2
- package/dist/catalog/CatalogGeometryFade.js.map +1 -1
- package/dist/catalog/CatalogPreparation.d.ts +3 -3
- package/dist/catalog/CatalogPreparation.d.ts.map +1 -1
- package/dist/catalog/CatalogPreparation.js +2 -1
- package/dist/catalog/CatalogPreparation.js.map +1 -1
- package/dist/catalog/CatalogSpatialElementLayer.d.ts.map +1 -1
- package/dist/catalog/CatalogSpatialElementLayer.js +33 -17
- package/dist/catalog/CatalogSpatialElementLayer.js.map +1 -1
- package/dist/catalog/CatalogTransition.d.ts.map +1 -1
- package/dist/catalog/CatalogTransition.js +25 -7
- package/dist/catalog/CatalogTransition.js.map +1 -1
- package/dist/catalog/SpatialPageRegistry.d.ts +17 -0
- package/dist/catalog/SpatialPageRegistry.d.ts.map +1 -0
- package/dist/catalog/SpatialPageRegistry.js +21 -0
- package/dist/catalog/SpatialPageRegistry.js.map +1 -0
- package/dist/catalog/catalogPage.d.ts +7 -3
- package/dist/catalog/catalogPage.d.ts.map +1 -1
- package/dist/catalog/catalogPage.js.map +1 -1
- package/dist/catalog/spatialElementAssets.d.ts +5 -5
- package/dist/catalog/spatialElementAssets.d.ts.map +1 -1
- package/dist/catalog/spatialElementAssets.js.map +1 -1
- package/dist/catalog/spatialElementLodPair.d.ts +2 -1
- package/dist/catalog/spatialElementLodPair.d.ts.map +1 -1
- package/dist/catalog/spatialElementLodPair.js.map +1 -1
- package/dist/index.d.ts +4 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -1
- package/dist/index.js.map +1 -1
- package/dist/spatial-element/SpatialElementDockController.d.ts.map +1 -1
- package/dist/spatial-element/SpatialElementDockController.js +4 -3
- package/dist/spatial-element/SpatialElementDockController.js.map +1 -1
- package/dist/spatial-element/spatialElement.d.ts +16 -12
- package/dist/spatial-element/spatialElement.d.ts.map +1 -1
- package/dist/spatial-element/spatialElement.js +32 -6
- package/dist/spatial-element/spatialElement.js.map +1 -1
- package/dist/spatial-element/spatialElementGeometry.d.ts +22 -0
- package/dist/spatial-element/spatialElementGeometry.d.ts.map +1 -0
- package/dist/spatial-element/spatialElementGeometry.js +40 -0
- package/dist/spatial-element/spatialElementGeometry.js.map +1 -0
- package/dist/spatial-element/spatialElementScene.d.ts +16 -0
- package/dist/spatial-element/spatialElementScene.d.ts.map +1 -0
- package/dist/spatial-element/spatialElementScene.js +22 -0
- package/dist/spatial-element/spatialElementScene.js.map +1 -0
- package/dist/spatial-element/spatialTheme.d.ts +16 -0
- package/dist/spatial-element/spatialTheme.d.ts.map +1 -0
- package/dist/spatial-element/spatialTheme.js +53 -0
- package/dist/spatial-element/spatialTheme.js.map +1 -0
- package/dist/spatial-element/types.d.ts +63 -33
- package/dist/spatial-element/types.d.ts.map +1 -1
- package/dist/spatial-element/types.js.map +1 -1
- package/dist/stage/MinimapController.js +1 -1
- package/dist/stage/MinimapController.js.map +1 -1
- package/dist/stage/PanelPresentationController.d.ts.map +1 -1
- package/dist/stage/PanelPresentationController.js +5 -3
- package/dist/stage/PanelPresentationController.js.map +1 -1
- package/dist/stage/SpatialElementInteractionController.d.ts +0 -1
- package/dist/stage/SpatialElementInteractionController.d.ts.map +1 -1
- package/dist/stage/SpatialElementInteractionController.js +0 -2
- package/dist/stage/SpatialElementInteractionController.js.map +1 -1
- package/dist/stage/StageExperience.d.ts +10 -4
- package/dist/stage/StageExperience.d.ts.map +1 -1
- package/dist/stage/StageExperience.js +18 -8
- package/dist/stage/StageExperience.js.map +1 -1
- package/dist/stage/StageRenderPipeline.d.ts +8 -1
- package/dist/stage/StageRenderPipeline.d.ts.map +1 -1
- package/dist/stage/StageRenderPipeline.js +23 -6
- package/dist/stage/StageRenderPipeline.js.map +1 -1
- package/dist/stage/VirtualScrollController.d.ts.map +1 -1
- package/dist/stage/VirtualScrollController.js +0 -2
- package/dist/stage/VirtualScrollController.js.map +1 -1
- package/dist/stage/minimap/MinimapGeometry.d.ts.map +1 -1
- package/dist/stage/minimap/MinimapGeometry.js +29 -0
- package/dist/stage/minimap/MinimapGeometry.js.map +1 -1
- package/dist/stage/panelContext.d.ts +1 -1
- package/dist/stage/panelContext.d.ts.map +1 -1
- package/dist/stage/panelContext.js.map +1 -1
- package/dist/stage/renderSettings.d.ts +10 -0
- package/dist/stage/renderSettings.d.ts.map +1 -0
- package/dist/stage/renderSettings.js +27 -0
- package/dist/stage/renderSettings.js.map +1 -0
- package/dist/stage/renderTargetInventory.d.ts +1 -1
- package/dist/stage/renderTargetInventory.js +1 -1
- package/dist/stage/renderTargetInventory.js.map +1 -1
- package/dist/stage/spatialElementFrame.d.ts.map +1 -1
- package/dist/stage/spatialElementFrame.js +5 -1
- package/dist/stage/spatialElementFrame.js.map +1 -1
- package/dist/stage/stageTypes.d.ts +9 -0
- package/dist/stage/stageTypes.d.ts.map +1 -1
- package/dist/stage/stageTypes.js.map +1 -1
- package/package.json +3 -3
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import type { SpatialListItem, SpatialElementSectionStyle,
|
|
1
|
+
import type { SpatialListItem, SpatialElementSectionStyle, SpatialElementData } from './types.js';
|
|
2
|
+
import type { SpatialElementSceneSource } from './spatialElementScene.js';
|
|
2
3
|
/** Validates section identifiers before they are used as DOM anchors. */
|
|
3
4
|
export declare function isSpatialElementSectionId(value: string): boolean;
|
|
4
5
|
/** Converts section styling data into scoped CSS custom properties. */
|
|
@@ -9,20 +10,23 @@ export declare function findSpatialElement<T extends {
|
|
|
9
10
|
}>(spatialElements: readonly T[], spatialElementId: string): T | undefined;
|
|
10
11
|
interface SpatialListSource {
|
|
11
12
|
id: string;
|
|
12
|
-
eyebrow
|
|
13
|
+
eyebrow?: string;
|
|
13
14
|
title: string;
|
|
14
|
-
features
|
|
15
|
+
features?: readonly {
|
|
15
16
|
label: string;
|
|
17
|
+
marker?: string;
|
|
16
18
|
}[];
|
|
19
|
+
action?: SpatialElementData['action'];
|
|
17
20
|
}
|
|
18
|
-
/**
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
21
|
+
/**
|
|
22
|
+
* Creates category items, including scene assets and the shared detail summary, from element data.
|
|
23
|
+
* `basePath` is the application's detail route prefix (e.g. `/shop/elements`).
|
|
24
|
+
* IDs are URL-encoded; no assets are loaded by this helper. Text-only sources also work.
|
|
25
|
+
*/
|
|
26
|
+
export declare function getSpatialListItems(spatialElements: readonly (SpatialListSource & Partial<SpatialElementSceneSource>)[], basePath: string): SpatialListItem[];
|
|
27
|
+
/** @internal Normalized presentation document; the public authoring type keeps optional content optional. */
|
|
28
|
+
export type ResolvedSpatialElementData = SpatialElementData & Required<Pick<SpatialElementData, 'brandId' | 'pageTitle' | 'eyebrow' | 'features' | 'breadcrumbs' | 'media'>>;
|
|
29
|
+
/** @internal Resolve presentation defaults without mutating route data or inventing link destinations. */
|
|
30
|
+
export declare function resolveSpatialElementData(element: SpatialElementData, brandId: string): ResolvedSpatialElementData;
|
|
27
31
|
export {};
|
|
28
32
|
//# sourceMappingURL=spatialElement.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"spatialElement.d.ts","sourceRoot":"","sources":["../../src/spatial-element/spatialElement.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,0BAA0B,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"spatialElement.d.ts","sourceRoot":"","sources":["../../src/spatial-element/spatialElement.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,0BAA0B,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAClG,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,0BAA0B,CAAC;AAI1E,yEAAyE;AACzE,wBAAgB,yBAAyB,CAAC,KAAK,EAAE,MAAM,WAEtD;AAED,uEAAuE;AACvE,wBAAgB,6BAA6B,CAAC,KAAK,EAAE,0BAA0B,GAAG,SAAS,UAgB1F;AAOD,sFAAsF;AACtF,wBAAgB,kBAAkB,CAAC,CAAC,SAAS;IAAE,EAAE,EAAE,MAAM,CAAA;CAAE,EAC1D,eAAe,EAAE,SAAS,CAAC,EAAE,EAC7B,gBAAgB,EAAE,MAAM,iBAGxB;AAED,UAAU,iBAAiB;IAC1B,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,SAAS;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;IACzD,MAAM,CAAC,EAAE,kBAAkB,CAAC,QAAQ,CAAC,CAAC;CACtC;AAED;;;;GAIG;AACH,wBAAgB,mBAAmB,CAClC,eAAe,EAAE,SAAS,CAAC,iBAAiB,GAAG,OAAO,CAAC,yBAAyB,CAAC,CAAC,EAAE,EACpF,QAAQ,EAAE,MAAM,GACd,eAAe,EAAE,CAmBnB;AAED,6GAA6G;AAC7G,MAAM,MAAM,0BAA0B,GAAG,kBAAkB,GAC1D,QAAQ,CACP,IAAI,CACH,kBAAkB,EAClB,SAAS,GAAG,WAAW,GAAG,SAAS,GAAG,UAAU,GAAG,aAAa,GAAG,OAAO,CAC1E,CACD,CAAC;AAEH,0GAA0G;AAC1G,wBAAgB,yBAAyB,CACxC,OAAO,EAAE,kBAAkB,EAC3B,OAAO,EAAE,MAAM,GACb,0BAA0B,CAe5B"}
|
|
@@ -29,17 +29,43 @@ function toPercentage(value) {
|
|
|
29
29
|
export function findSpatialElement(spatialElements, spatialElementId) {
|
|
30
30
|
return spatialElements.find((spatialElement) => spatialElement.id === spatialElementId);
|
|
31
31
|
}
|
|
32
|
-
|
|
32
|
+
/**
|
|
33
|
+
* Creates category items, including scene assets and the shared detail summary, from element data.
|
|
34
|
+
* `basePath` is the application's detail route prefix (e.g. `/shop/elements`).
|
|
35
|
+
* IDs are URL-encoded; no assets are loaded by this helper. Text-only sources also work.
|
|
36
|
+
*/
|
|
37
|
+
export function getSpatialListItems(spatialElements, basePath) {
|
|
33
38
|
const normalizedBasePath = basePath.replace(/\/$/, '');
|
|
34
39
|
return spatialElements.map((spatialElement) => ({
|
|
35
40
|
id: spatialElement.id,
|
|
36
41
|
href: `${normalizedBasePath}/${encodeURIComponent(spatialElement.id)}`,
|
|
37
|
-
eyebrow: spatialElement.eyebrow,
|
|
42
|
+
eyebrow: spatialElement.eyebrow ?? '',
|
|
38
43
|
title: spatialElement.title,
|
|
39
|
-
features: spatialElement.features.map(({ label }) => label),
|
|
40
|
-
...(
|
|
41
|
-
|
|
42
|
-
|
|
44
|
+
features: (spatialElement.features ?? []).map(({ label }) => label),
|
|
45
|
+
summary: { features: [...(spatialElement.features ?? [])], action: spatialElement.action },
|
|
46
|
+
geometry: spatialElement.geometry,
|
|
47
|
+
hdr: spatialElement.hdr,
|
|
48
|
+
background: spatialElement.background,
|
|
49
|
+
model: spatialElement.model,
|
|
50
|
+
camera: spatialElement.camera,
|
|
51
|
+
assetManifest: spatialElement.assetManifest,
|
|
52
|
+
fallbackImage: spatialElement.fallbackImage,
|
|
53
|
+
fallbackImageSize: spatialElement.fallbackImageSize
|
|
43
54
|
}));
|
|
44
55
|
}
|
|
56
|
+
/** @internal Resolve presentation defaults without mutating route data or inventing link destinations. */
|
|
57
|
+
export function resolveSpatialElementData(element, brandId) {
|
|
58
|
+
if (element.brandId && element.brandId !== brandId) {
|
|
59
|
+
throw new Error(`Element "${element.id}" belongs to "${element.brandId}", but the shell uses "${brandId}".`);
|
|
60
|
+
}
|
|
61
|
+
return {
|
|
62
|
+
...element,
|
|
63
|
+
brandId,
|
|
64
|
+
pageTitle: element.pageTitle ?? element.title,
|
|
65
|
+
eyebrow: element.eyebrow ?? '',
|
|
66
|
+
features: element.features ?? [],
|
|
67
|
+
breadcrumbs: element.breadcrumbs ?? [],
|
|
68
|
+
media: element.media ?? [{ id: 'model', kind: 'minimap', label: '3D view' }]
|
|
69
|
+
};
|
|
70
|
+
}
|
|
45
71
|
//# sourceMappingURL=spatialElement.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"spatialElement.js","sourceRoot":"","sources":["../../src/spatial-element/spatialElement.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"spatialElement.js","sourceRoot":"","sources":["../../src/spatial-element/spatialElement.ts"],"names":[],"mappings":"AAGA,MAAM,kBAAkB,GAAG,mBAAmB,CAAC;AAE/C,yEAAyE;AACzE,MAAM,UAAU,yBAAyB,CAAC,KAAa;IACtD,OAAO,kBAAkB,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;AACvC,CAAC;AAED,uEAAuE;AACvE,MAAM,UAAU,6BAA6B,CAAC,KAA6C;IAC1F,IAAI,CAAC,KAAK;QAAE,OAAO,EAAE,CAAC;IAEtB,OAAO;QACN,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,mCAAmC,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE;QACjE,KAAK,CAAC,WAAW,KAAK,SAAS;YAC9B,CAAC,CAAC,2CAA2C,YAAY,CAAC,KAAK,CAAC,WAAW,CAAC,EAAE;YAC9E,CAAC,CAAC,EAAE;QACL,KAAK,CAAC,YAAY,KAAK,SAAS;YAC/B,CAAC,CAAC,4CAA4C,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,YAAY,EAAE,CAAC,CAAC,IAAI;YACjF,CAAC,CAAC,EAAE;QACL,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC,oCAAoC,KAAK,CAAC,SAAS,EAAE,CAAC,CAAC,CAAC,EAAE;QAC5E,KAAK,CAAC,KAAK,C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AAE,CAAC,GAAG,CAAC,cAAc,CAAC,QAAQ,IAAI,EAAE,CAAC,CAAC,EAAE,MAAM,EAAE,cAAc,CAAC,MAAM,EAAE;QAC1F,QAAQ,EAAE,cAAc,CAAC,QAAQ;QACjC,GAAG,EAAE,cAAc,CAAC,GAAG;QACvB,UAAU,EAAE,cAAc,CAAC,UAAU;QACrC,KAAK,EAAE,cAAc,CAAC,KAAK;QAC3B,MAAM,EAAE,cAAc,CAAC,MAAM;QAC7B,aAAa,EAAE,cAAc,CAAC,aAAa;QAC3C,aAAa,EAAE,cAAc,CAAC,aAAa;QAC3C,iBAAiB,EAAE,cAAc,CAAC,iBAAiB;KACnD,CAAC,CAAC,CAAC;AACL,CAAC;AAWD,0GAA0G;AAC1G,MAAM,UAAU,yBAAyB,CACxC,OAA2B,EAC3B,OAAe;IAEf,IAAI,OAAO,CAAC,OAAO,IAAI,OAAO,CAAC,OAAO,KAAK,OAAO,EAAE,CAAC;QACpD,MAAM,IAAI,KAAK,CACd,YAAY,OAAO,CAAC,EAAE,iBAAiB,OAAO,CAAC,OAAO,0BAA0B,OAAO,IAAI,CAC3F,CAAC;IACH,CAAC;IACD,OAAO;QACN,GAAG,OAAO;QACV,OAAO;QACP,SAAS,EAAE,OAAO,CAAC,SAAS,IAAI,OAAO,CAAC,KAAK;QAC7C,OAAO,EAAE,OAAO,CAAC,OAAO,IAAI,EAAE;QAC9B,QAAQ,EAAE,OAAO,CAAC,QAAQ,IAAI,EAAE;QAChC,WAAW,EAAE,OAAO,CAAC,WAAW,IAAI,EAAE;QACtC,KAAK,EAAE,OAAO,CAAC,KAAK,IAAI,CAAC,EAAE,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC;KAC5E,CAAC;AACH,CAAC","sourcesContent":["import type { SpatialListItem, SpatialElementSectionStyle, SpatialElementData } from './types.js';\nimport type { SpatialElementSceneSource } from './spatialElementScene.js';\n\nconst SECTION_ID_PATTERN = /^[a-z][a-z0-9-]*$/;\n\n/** Validates section identifiers before they are used as DOM anchors. */\nexport function isSpatialElementSectionId(value: string) {\n\treturn SECTION_ID_PATTERN.test(value);\n}\n\n/** Converts section styling data into scoped CSS custom properties. */\nexport function getSpatialElementSectionStyle(style: SpatialElementSectionStyle | undefined) {\n\tif (!style) return '';\n\n\treturn [\n\t\tstyle.tint ? `--spatial-element-section-tint: ${style.tint}` : '',\n\t\tstyle.tintOpacity !== undefined\n\t\t\t? `--spatial-element-section-tint-opacity: ${toPercentage(style.tintOpacity)}`\n\t\t\t: '',\n\t\tstyle.backdropBlur !== undefined\n\t\t\t? `--spatial-element-section-backdrop-blur: ${Math.max(style.backdropBlur, 0)}px`\n\t\t\t: '',\n\t\tstyle.textColor ? `--spatial-element-section-color: ${style.textColor}` : '',\n\t\tstyle.width ? `--spatial-element-section-width: ${style.width}` : ''\n\t]\n\t\t.filter(Boolean)\n\t\t.join('; ');\n}\n\nfunction toPercentage(value: number) {\n\tconst finiteValue = Number.isFinite(value) ? value : 0;\n\treturn `${Math.min(Math.max(finiteValue, 0), 1) * 100}%`;\n}\n\n/** Finds a element by route id while retaining a narrow, serializable return type. */\nexport function findSpatialElement<T extends { id: string }>(\n\tspatialElements: readonly T[],\n\tspatialElementId: string\n) {\n\treturn spatialElements.find((spatialElement) => spatialElement.id === spatialElementId);\n}\n\ninterface SpatialListSource {\n\tid: string;\n\teyebrow?: string;\n\ttitle: string;\n\tfeatures?: readonly { label: string; marker?: string }[];\n\taction?: SpatialElementData['action'];\n}\n\n/**\n * Creates category items, including scene assets and the shared detail summary, from element data.\n * `basePath` is the application's detail route prefix (e.g. `/shop/elements`).\n * IDs are URL-encoded; no assets are loaded by this helper. Text-only sources also work.\n */\nexport function getSpatialListItems(\n\tspatialElements: readonly (SpatialListSource & Partial<SpatialElementSceneSource>)[],\n\tbasePath: string\n): SpatialListItem[] {\n\tconst normalizedBasePath = basePath.replace(/\\/$/, '');\n\n\treturn spatialElements.map((spatialElement) => ({\n\t\tid: spatialElement.id,\n\t\thref: `${normalizedBasePath}/${encodeURIComponent(spatialElement.id)}`,\n\t\teyebrow: spatialElement.eyebrow ?? '',\n\t\ttitle: spatialElement.title,\n\t\tfeatures: (spatialElement.features ?? []).map(({ label }) => label),\n\t\tsummary: { features: [...(spatialElement.features ?? [])], action: spatialElement.action },\n\t\tgeometry: spatialElement.geometry,\n\t\thdr: spatialElement.hdr,\n\t\tbackground: spatialElement.background,\n\t\tmodel: spatialElement.model,\n\t\tcamera: spatialElement.camera,\n\t\tassetManifest: spatialElement.assetManifest,\n\t\tfallbackImage: spatialElement.fallbackImage,\n\t\tfallbackImageSize: spatialElement.fallbackImageSize\n\t}));\n}\n\n/** @internal Normalized presentation document; the public authoring type keeps optional content optional. */\nexport type ResolvedSpatialElementData = SpatialElementData &\n\tRequired<\n\t\tPick<\n\t\t\tSpatialElementData,\n\t\t\t'brandId' | 'pageTitle' | 'eyebrow' | 'features' | 'breadcrumbs' | 'media'\n\t\t>\n\t>;\n\n/** @internal Resolve presentation defaults without mutating route data or inventing link destinations. */\nexport function resolveSpatialElementData(\n\telement: SpatialElementData,\n\tbrandId: string\n): ResolvedSpatialElementData {\n\tif (element.brandId && element.brandId !== brandId) {\n\t\tthrow new Error(\n\t\t\t`Element \"${element.id}\" belongs to \"${element.brandId}\", but the shell uses \"${brandId}\".`\n\t\t);\n\t}\n\treturn {\n\t\t...element,\n\t\tbrandId,\n\t\tpageTitle: element.pageTitle ?? element.title,\n\t\teyebrow: element.eyebrow ?? '',\n\t\tfeatures: element.features ?? [],\n\t\tbreadcrumbs: element.breadcrumbs ?? [],\n\t\tmedia: element.media ?? [{ id: 'model', kind: 'minimap', label: '3D view' }]\n\t};\n}\n"]}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { SpatialElementAssetResource } from '../catalog/spatialElementAssets.js';
|
|
2
|
+
import type { SpatialElementLodPair } from '../catalog/spatialElementLodPair.js';
|
|
3
|
+
/** Two required representations in the same authored coordinate frame. */
|
|
4
|
+
export interface SpatialElementGeometry {
|
|
5
|
+
/** Lightweight GLB used in categories and during navigation. A URL is sufficient. */
|
|
6
|
+
low: string | SpatialElementAssetResource;
|
|
7
|
+
/** Detailed GLB used on the detail page. The same URL as low shares one cached load. */
|
|
8
|
+
high: string | SpatialElementAssetResource;
|
|
9
|
+
/** Optional generated coordinate transform, column-major. Defaults to identity. */
|
|
10
|
+
assetToFrame?: SpatialElementLodPair['assetToFrame'];
|
|
11
|
+
/** Optional shared frame bounds. Without these, the Low model determines the fit. */
|
|
12
|
+
bounds?: SpatialElementLodPair['bounds'];
|
|
13
|
+
/** Optional generated frame revision, independent of each resource's revision. */
|
|
14
|
+
revision?: string;
|
|
15
|
+
/** Optional provenance; declaring a shared frame does not verify physical dimensions. */
|
|
16
|
+
status?: SpatialElementLodPair['status'];
|
|
17
|
+
}
|
|
18
|
+
/** Adapt an existing asset-pipeline LOD pair without exposing its redundant sourceUrl. */
|
|
19
|
+
export declare function geometryFromLodPair(pair: SpatialElementLodPair): SpatialElementGeometry;
|
|
20
|
+
/** @internal Normalize URL shorthand once at the authoring/runtime boundary. */
|
|
21
|
+
export declare function resolveSpatialElementGeometry(geometry: SpatialElementGeometry): SpatialElementLodPair;
|
|
22
|
+
//# sourceMappingURL=spatialElementGeometry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"spatialElementGeometry.d.ts","sourceRoot":"","sources":["../../src/spatial-element/spatialElementGeometry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,oCAAoC,CAAC;AACtF,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,qCAAqC,CAAC;AAEjF,0EAA0E;AAC1E,MAAM,WAAW,sBAAsB;IACtC,qFAAqF;IACrF,GAAG,EAAE,MAAM,GAAG,2BAA2B,CAAC;IAC1C,wFAAwF;IACxF,IAAI,EAAE,MAAM,GAAG,2BAA2B,CAAC;IAC3C,mFAAmF;IACnF,YAAY,CAAC,EAAE,qBAAqB,CAAC,cAAc,CAAC,CAAC;IACrD,qFAAqF;IACrF,MAAM,CAAC,EAAE,qBAAqB,CAAC,QAAQ,CAAC,CAAC;IACzC,kFAAkF;IAClF,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,yFAAyF;IACzF,MAAM,CAAC,EAAE,qBAAqB,CAAC,QAAQ,CAAC,CAAC;CACzC;AAED,0FAA0F;AAC1F,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,qBAAqB,GAAG,sBAAsB,CAGvF;AAED,gFAAgF;AAChF,wBAAgB,6BAA6B,CAC5C,QAAQ,EAAE,sBAAsB,GAC9B,qBAAqB,CAqCvB"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/** Adapt an existing asset-pipeline LOD pair without exposing its redundant sourceUrl. */
|
|
2
|
+
export function geometryFromLodPair(pair) {
|
|
3
|
+
const { sourceUrl: _, ...geometry } = pair;
|
|
4
|
+
return geometry;
|
|
5
|
+
}
|
|
6
|
+
/** @internal Normalize URL shorthand once at the authoring/runtime boundary. */
|
|
7
|
+
export function resolveSpatialElementGeometry(geometry) {
|
|
8
|
+
const resource = (value) => {
|
|
9
|
+
const result = typeof value === 'string'
|
|
10
|
+
? { url: value, format: 'glb', revision: 'url-versioned' }
|
|
11
|
+
: value;
|
|
12
|
+
if (!result?.url?.trim() || !result.revision)
|
|
13
|
+
throw new Error('geometry.low and geometry.high must each specify a non-empty model URL.');
|
|
14
|
+
return result;
|
|
15
|
+
};
|
|
16
|
+
if (!geometry)
|
|
17
|
+
throw new Error('Spatial elements require geometry: { low, high }.');
|
|
18
|
+
let low = resource(geometry.low), high = resource(geometry.high);
|
|
19
|
+
if (low.url === high.url) {
|
|
20
|
+
if (typeof geometry.low !== 'string' &&
|
|
21
|
+
typeof geometry.high !== 'string' &&
|
|
22
|
+
(low.revision !== high.revision ||
|
|
23
|
+
low.format !== high.format ||
|
|
24
|
+
JSON.stringify(low.requirements) !== JSON.stringify(high.requirements))) {
|
|
25
|
+
throw new Error('Identical geometry URLs must use matching resource revisions and decoder requirements.');
|
|
26
|
+
}
|
|
27
|
+
// A role never changes asset identity, including when one side uses URL shorthand.
|
|
28
|
+
low = high = typeof geometry.low !== 'string' ? low : high;
|
|
29
|
+
}
|
|
30
|
+
return {
|
|
31
|
+
low,
|
|
32
|
+
high,
|
|
33
|
+
sourceUrl: high.url,
|
|
34
|
+
revision: geometry.revision ?? 'geometry-v1',
|
|
35
|
+
status: geometry.status ?? 'provisional-shared-frame',
|
|
36
|
+
assetToFrame: geometry.assetToFrame ?? [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1],
|
|
37
|
+
bounds: geometry.bounds
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
//# sourceMappingURL=spatialElementGeometry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"spatialElementGeometry.js","sourceRoot":"","sources":["../../src/spatial-element/spatialElementGeometry.ts"],"names":[],"mappings":"AAmBA,0FAA0F;AAC1F,MAAM,UAAU,mBAAmB,CAAC,IAA2B;IAC9D,MAAM,EAAE,SAAS,EAAE,CAAC,EAAE,GAAG,QAAQ,EAAE,GAAG,IAAI,CAAC;IAC3C,OAAO,QAAQ,CAAC;AACjB,CAAC;AAED,gFAAgF;AAChF,MAAM,UAAU,6BAA6B,CAC5C,QAAgC;IAEhC,MAAM,QAAQ,GAAG,CAAC,KAA2C,EAA+B,EAAE;QAC7F,MAAM,MAAM,GACX,OAAO,KAAK,KAAK,QAAQ;YACxB,CAAC,CAAC,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM,EAAE,KAAc,EAAE,QAAQ,EAAE,eAAe,EAAE;YACnE,CAAC,CAAC,KAAK,CAAC;QACV,IAAI,CAAC,MAAM,EAAE,GAAG,EAAE,IAAI,EAAE,IAAI,CAAC,MAAM,CAAC,QAAQ;YAC3C,MAAM,IAAI,KAAK,CAAC,yEAAy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AC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;QACvF,MAAM,EAAE,QAAQ,CAAC,MAAM;KACvB,CAAC;AACH,CAAC","sourcesContent":["import type { SpatialElementAssetResource } from '../catalog/spatialElementAssets.js';\nimport type { SpatialElementLodPair } from '../catalog/spatialElementLodPair.js';\n\n/** Two required representations in the same authored coordinate frame. */\nexport interface SpatialElementGeometry {\n\t/** Lightweight GLB used in categories and during navigation. A URL is sufficient. */\n\tlow: string | SpatialElementAssetResource;\n\t/** Detailed GLB used on the detail page. The same URL as low shares one cached load. */\n\thigh: string | SpatialElementAssetResource;\n\t/** Optional generated coordinate transform, column-major. Defaults to identity. */\n\tassetToFrame?: SpatialElementLodPair['assetToFrame'];\n\t/** Optional shared frame bounds. Without these, the Low model determines the fit. */\n\tbounds?: SpatialElementLodPair['bounds'];\n\t/** Optional generated frame revision, independent of each resource's revision. */\n\trevision?: string;\n\t/** Optional provenance; declaring a shared frame does not verify physical dimensions. */\n\tstatus?: SpatialElementLodPair['status'];\n}\n\n/** Adapt an existing asset-pipeline LOD pair without exposing its redundant sourceUrl. */\nexport function geometryFromLodPair(pair: SpatialElementLodPair): SpatialElementGeometry {\n\tconst { sourceUrl: _, ...geometry } = pair;\n\treturn geometry;\n}\n\n/** @internal Normalize URL shorthand once at the authoring/runtime boundary. */\nexport function resolveSpatialElementGeometry(\n\tgeometry: SpatialElementGeometry\n): SpatialElementLodPair {\n\tconst resource = (value: string | SpatialElementAssetResource): SpatialElementAssetResource => {\n\t\tconst result =\n\t\t\ttypeof value === 'string'\n\t\t\t\t? { url: value, format: 'glb' as const, revision: 'url-versioned' }\n\t\t\t\t: value;\n\t\tif (!result?.url?.trim() || !result.revision)\n\t\t\tthrow new Error('geometry.low and geometry.high must each specify a non-empty model URL.');\n\t\treturn result;\n\t};\n\tif (!geometry) throw new Error('Spatial elements require geometry: { low, high }.');\n\tlet low = resource(geometry.low),\n\t\thigh = resource(geometry.high);\n\tif (low.url === high.url) {\n\t\tif (\n\t\t\ttypeof geometry.low !== 'string' &&\n\t\t\ttypeof geometry.high !== 'string' &&\n\t\t\t(low.revision !== high.revision ||\n\t\t\t\tlow.format !== high.format ||\n\t\t\t\tJSON.stringify(low.requirements) !== JSON.stringify(high.requirements))\n\t\t) {\n\t\t\tthrow new Error(\n\t\t\t\t'Identical geometry URLs must use matching resource revisions and decoder requirements.'\n\t\t\t);\n\t\t}\n\t\t// A role never changes asset identity, including when one side uses URL shorthand.\n\t\tlow = high = typeof geometry.low !== 'string' ? low : high;\n\t}\n\treturn {\n\t\tlow,\n\t\thigh,\n\t\tsourceUrl: high.url,\n\t\trevision: geometry.revision ?? 'geometry-v1',\n\t\tstatus: geometry.status ?? 'provisional-shared-frame',\n\t\tassetToFrame: geometry.assetToFrame ?? [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1],\n\t\tbounds: geometry.bounds\n\t};\n}\n"]}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { SpatialElementData, SpatialListItem } from './types.js';
|
|
2
|
+
import type { SpatialElementLodPair } from '../catalog/spatialElementLodPair.js';
|
|
3
|
+
type ElementAppearance = Pick<SpatialElementData, 'hdr' | 'background' | 'model' | 'camera' | 'assetManifest' | 'fallbackImage' | 'fallbackImageSize'>;
|
|
4
|
+
/** @internal Legacy renderer projection, derived from the single public geometry field. */
|
|
5
|
+
export interface SpatialElementScene extends ElementAppearance {
|
|
6
|
+
glb: string;
|
|
7
|
+
lodPair?: SpatialElementLodPair;
|
|
8
|
+
}
|
|
9
|
+
/** @internal Authoring inputs; never pass a renderer projection back through this boundary. */
|
|
10
|
+
export type SpatialElementSceneSource = ElementAppearance & Pick<SpatialElementData, 'geometry'>;
|
|
11
|
+
/** @internal Content and runtime pose callbacks never participate in asset identity. */
|
|
12
|
+
export declare function getSpatialElementScene(element: SpatialElementSceneSource): SpatialElementScene;
|
|
13
|
+
/** @internal Text-only cards intentionally have no geometry. */
|
|
14
|
+
export declare function hasSpatialElementScene(element: SpatialListItem): element is SpatialListItem & SpatialElementSceneSource;
|
|
15
|
+
export {};
|
|
16
|
+
//# sourceMappingURL=spatialElementScene.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"spatialElementScene.d.ts","sourceRoot":"","sources":["../../src/spatial-element/spatialElementScene.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AACtE,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,qCAAqC,CAAC;AAGjF,KAAK,iBAAiB,GAAG,IAAI,CAC5B,kBAAkB,EAChB,KAAK,GACL,YAAY,GACZ,OAAO,GACP,QAAQ,GACR,eAAe,GACf,eAAe,GACf,mBAAmB,CACrB,CAAC;AACF,2FAA2F;AAC3F,MAAM,WAAW,mBAAoB,SAAQ,iBAAiB;IAC7D,GAAG,EAAE,MAAM,CAAC;IACZ,OAAO,CAAC,EAAE,qBAAqB,CAAC;CAChC;AACD,+FAA+F;AAC/F,MAAM,MAAM,yBAAyB,GAAG,iBAAiB,GAAG,IAAI,CAAC,kBAAkB,EAAE,UAAU,CAAC,CAAC;AAEjG,wFAAwF;AACxF,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,yBAAyB,GAAG,mBAAmB,CAe9F;AACD,gEAAgE;AAChE,wBAAgB,sBAAsB,CACrC,OAAO,EAAE,eAAe,GACtB,OAAO,IAAI,eAAe,GAAG,yBAAyB,CAExD"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { resolveSpatialElementGeometry } from './spatialElementGeometry.js';
|
|
2
|
+
/** @internal Content and runtime pose callbacks never participate in asset identity. */
|
|
3
|
+
export function getSpatialElementScene(element) {
|
|
4
|
+
const { hdr, background, model, camera, assetManifest, fallbackImage, fallbackImageSize } = element;
|
|
5
|
+
const lodPair = resolveSpatialElementGeometry(element.geometry);
|
|
6
|
+
return {
|
|
7
|
+
glb: lodPair.sourceUrl,
|
|
8
|
+
lodPair,
|
|
9
|
+
hdr,
|
|
10
|
+
background,
|
|
11
|
+
model,
|
|
12
|
+
camera,
|
|
13
|
+
assetManifest,
|
|
14
|
+
fallbackImage,
|
|
15
|
+
fallbackImageSize
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
/** @internal Text-only cards intentionally have no geometry. */
|
|
19
|
+
export function hasSpatialElementScene(element) {
|
|
20
|
+
return Boolean(element.geometry && element.hdr);
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=spatialElementScene.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"spatialElementScene.js","sourceRoot":"","sources":["../../src/spatial-element/spatialElementScene.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,6BAA6B,EAAE,MAAM,6BAA6B,CAAC;AAoB5E,wFAAwF;AACxF,MAAM,UAAU,sBAAsB,CAAC,OAAkC;IACxE,MAAM,EAAE,GAAG,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,EAAE,aAAa,EAAE,aAAa,EAAE,iBAAiB,EAAE,GACxF,OAAO,CAAC;IACT,MAAM,OAAO,GAAG,6BAA6B,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;IAChE,OAAO;QACN,GAAG,EAAE,OAAO,CAAC,SAAS;QACtB,OAAO;QACP,GAAG;QACH,UAAU;QACV,KAAK;QACL,MAAM;QACN,aAAa;QACb,aAAa;QACb,iBAAiB;KACjB,CAAC;AACH,CAAC;AACD,gEAAgE;AAChE,MAAM,UAAU,sBAAsB,CACrC,OAAwB;IAExB,OAAO,OAAO,CAAC,OAAO,CAAC,QAAQ,IAAI,OAAO,CAAC,GAAG,CAAC,CAAC;AACjD,CAAC","sourcesContent":["import type { SpatialElementData, SpatialListItem } from './types.js';\nimport type { SpatialElementLodPair } from '../catalog/spatialElementLodPair.js';\nimport { resolveSpatialElementGeometry } from './spatialElementGeometry.js';\n\ntype ElementAppearance = Pick<\n\tSpatialElementData,\n\t| 'hdr'\n\t| 'background'\n\t| 'model'\n\t| 'camera'\n\t| 'assetManifest'\n\t| 'fallbackImage'\n\t| 'fallbackImageSize'\n>;\n/** @internal Legacy renderer projection, derived from the single public geometry field. */\nexport interface SpatialElementScene extends ElementAppearance {\n\tglb: string;\n\tlodPair?: SpatialElementLodPair;\n}\n/** @internal Authoring inputs; never pass a renderer projection back through this boundary. */\nexport type SpatialElementSceneSource = ElementAppearance & Pick<SpatialElementData, 'geometry'>;\n\n/** @internal Content and runtime pose callbacks never participate in asset identity. */\nexport function getSpatialElementScene(element: SpatialElementSceneSource): SpatialElementScene {\n\tconst { hdr, background, model, camera, assetManifest, fallbackImage, fallbackImageSize } =\n\t\telement;\n\tconst lodPair = resolveSpatialElementGeometry(element.geometry);\n\treturn {\n\t\tglb: lodPair.sourceUrl,\n\t\tlodPair,\n\t\thdr,\n\t\tbackground,\n\t\tmodel,\n\t\tcamera,\n\t\tassetManifest,\n\t\tfallbackImage,\n\t\tfallbackImageSize\n\t};\n}\n/** @internal Text-only cards intentionally have no geometry. */\nexport function hasSpatialElementScene(\n\telement: SpatialListItem\n): element is SpatialListItem & SpatialElementSceneSource {\n\treturn Boolean(element.geometry && element.hdr);\n}\n"]}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { SpatialTheme } from './types.js';
|
|
2
|
+
/** Input for createSpatialTheme. Every appearance group merges with the library defaults. */
|
|
3
|
+
export type SpatialThemeOptions = Pick<SpatialTheme, 'id' | 'name'> & {
|
|
4
|
+
/** Flat page color, independent of each element's HDR background. Default: #eef1f4. */
|
|
5
|
+
background?: string;
|
|
6
|
+
} & {
|
|
7
|
+
[K in Exclude<keyof SpatialTheme, 'id' | 'name' | 'background'>]?: Partial<SpatialTheme[K]>;
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* Creates a complete theme from a brand identity and optional appearance overrides.
|
|
11
|
+
* Nested groups merge field-by-field; returned objects are independent between calls.
|
|
12
|
+
* @example
|
|
13
|
+
* const theme = createSpatialTheme({ id: 'shop', name: 'My shop', colors: { accent: '#285c89' } });
|
|
14
|
+
*/
|
|
15
|
+
export declare function createSpatialTheme(options: SpatialThemeOptions): SpatialTheme;
|
|
16
|
+
//# sourceMappingURL=spatialTheme.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"spatialTheme.d.ts","sourceRoot":"","sources":["../../src/spatial-element/spatialTheme.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAE/C,6FAA6F;AAC7F,MAAM,MAAM,mBAAmB,GAAG,IAAI,CAAC,YAAY,EAAE,IAAI,GAAG,MAAM,CAAC,GAAG;IACrE,uFAAuF;IACvF,UAAU,CAAC,EAAE,MAAM,CAAC;CACpB,GAAG;KAAG,CAAC,IAAI,OAAO,CAAC,MAAM,YAAY,EAAE,IAAI,GAAG,MAAM,GAAG,YAAY,CAAC,CAAC,CAAC,EAAE,OAAO,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC;CAAE,CAAC;AAEpG;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,mBAAmB,GAAG,YAAY,CA6C7E"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Creates a complete theme from a brand identity and optional appearance overrides.
|
|
3
|
+
* Nested groups merge field-by-field; returned objects are independent between calls.
|
|
4
|
+
* @example
|
|
5
|
+
* const theme = createSpatialTheme({ id: 'shop', name: 'My shop', colors: { accent: '#285c89' } });
|
|
6
|
+
*/
|
|
7
|
+
export function createSpatialTheme(options) {
|
|
8
|
+
return {
|
|
9
|
+
id: options.id,
|
|
10
|
+
name: options.name,
|
|
11
|
+
background: options.background ?? '#eef1f4',
|
|
12
|
+
minimapTheme: {
|
|
13
|
+
expandedHeight: 240,
|
|
14
|
+
overlayColor: '#000000',
|
|
15
|
+
overlayOpacity: 0.35,
|
|
16
|
+
overlayBlur: 5,
|
|
17
|
+
contextOpacity: 0,
|
|
18
|
+
viewportColor: options.colors?.accent ?? '#285c89',
|
|
19
|
+
...options.minimapTheme
|
|
20
|
+
},
|
|
21
|
+
interactionTheme: {
|
|
22
|
+
outlineColor: options.colors?.accent ?? '#285c89',
|
|
23
|
+
...options.interactionTheme
|
|
24
|
+
},
|
|
25
|
+
panelShape: { radius: 16, contentInset: 26, ...options.panelShape },
|
|
26
|
+
panelTheme: {
|
|
27
|
+
surface: 'frosted',
|
|
28
|
+
tint: '#ffffff',
|
|
29
|
+
tintOpacity: 0.65,
|
|
30
|
+
backdropBlur: 8,
|
|
31
|
+
shadowIntensity: 0.2,
|
|
32
|
+
opacity: 1,
|
|
33
|
+
...options.panelTheme
|
|
34
|
+
},
|
|
35
|
+
dockedPanelTheme: {
|
|
36
|
+
tint: '#ffffff',
|
|
37
|
+
tintOpacity: 0.92,
|
|
38
|
+
backdropBlur: 5,
|
|
39
|
+
shadowIntensity: 0.2,
|
|
40
|
+
...options.dockedPanelTheme
|
|
41
|
+
},
|
|
42
|
+
sectionTheme: { tint: '#ffffff', tintOpacity: 0.8, backdropBlur: 8, ...options.sectionTheme },
|
|
43
|
+
colors: {
|
|
44
|
+
ink: '#173047',
|
|
45
|
+
body: '#263c4d',
|
|
46
|
+
accent: '#285c89',
|
|
47
|
+
onAccent: '#ffffff',
|
|
48
|
+
tabBackground: '#e4ebf1',
|
|
49
|
+
...options.colors
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
//# sourceMappingURL=spatialTheme.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"spatialTheme.js","sourceRoot":"","sources":["../../src/spatial-element/spatialTheme.ts"],"names":[],"mappings":"AAQA;;;;;GAKG;AACH,MAAM,UAAU,kBAAkB,CAAC,OAA4B;IAC9D,OAAO;QACN,EAAE,EAAE,OAAO,CAAC,EAAE;QACd,IAAI,EAAE,OAAO,CAAC,IAAI;QAClB,UAAU,EAAE,OAAO,CAAC,UAAU,IAAI,SAAS;QAC3C,YAAY,EAAE;YACb,cAAc,EAAE,GAAG;YACnB,YAAY,EAAE,SAAS;YACvB,cAAc,EAAE,IAAI;YACpB,WAAW,EAAE,CAAC;YACd,cAAc,EAAE,CAAC;YACjB,aAAa,EAAE,OAAO,CAAC,MAAM,EAAE,MAAM,IAAI,SAAS;YAClD,GAAG,OAAO,CAAC,YAAY;SACvB;QACD,gBAAgB,EAAE;YACjB,YAAY,EAAE,OAAO,CAAC,MAAM,EAAE,MAAM,IAAI,SAAS;YACjD,GAAG,OAAO,CAAC,gBAAgB;SAC3B;QACD,UAAU,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,YAAY,EAAE,EAAE,EAAE,GAAG,OAAO,CAAC,UAAU,EAAE;QACnE,UAAU,EAAE;YACX,OAAO,EAAE,SAAS;YAClB,IAAI,EAAE,SAAS;YACf,WAAW,EAAE,IAAI;YACjB,YAAY,EAAE,CAAC;YACf,eAAe,EAAE,GAAG;YACpB,OAAO,EAAE,CAAC;YACV,GAAG,OAAO,CAAC,UAAU;SACrB;QACD,gBAAgB,EAAE;YACjB,IAAI,EAAE,SAAS;YACf,WAAW,EAAE,IAAI;YACjB,YAAY,EAAE,CAAC;YACf,eAAe,EAAE,GAAG;YACpB,GAAG,OAAO,CAAC,gBAAgB;SAC3B;QACD,YAAY,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,WAAW,EAAE,GAAG,EAAE,YAAY,EAAE,CAAC,EAAE,GAAG,OAAO,CAAC,YAAY,EAAE;QAC7F,MAAM,EAAE;YACP,GAAG,EAAE,SAAS;YACd,IAAI,EAAE,SAAS;YACf,MAAM,EAAE,SAAS;YACjB,QAAQ,EAAE,SAAS;YACnB,aAAa,EAAE,SAAS;YACxB,GAAG,OAAO,CAAC,MAAM;SACjB;KACD,CAAC;AACH,CAAC","sourcesContent":["import type { SpatialTheme } from './types.js';\n\n/** Input for createSpatialTheme. Every appearance group merges with the library defaults. */\nexport type SpatialThemeOptions = Pick<SpatialTheme, 'id' | 'name'> & {\n\t/** Flat page color, independent of each element's HDR background. Default: #eef1f4. */\n\tbackground?: string;\n} & { [K in Exclude<keyof SpatialTheme, 'id' | 'name' | 'background'>]?: Partial<SpatialTheme[K]> };\n\n/**\n * Creates a complete theme from a brand identity and optional appearance overrides.\n * Nested groups merge field-by-field; returned objects are independent between calls.\n * @example\n * const theme = createSpatialTheme({ id: 'shop', name: 'My shop', colors: { accent: '#285c89' } });\n */\nexport function createSpatialTheme(options: SpatialThemeOptions): SpatialTheme {\n\treturn {\n\t\tid: options.id,\n\t\tname: options.name,\n\t\tbackground: options.background ?? '#eef1f4',\n\t\tminimapTheme: {\n\t\t\texpandedHeight: 240,\n\t\t\toverlayColor: '#000000',\n\t\t\toverlayOpacity: 0.35,\n\t\t\toverlayBlur: 5,\n\t\t\tcontextOpacity: 0,\n\t\t\tviewportColor: options.colors?.accent ?? '#285c89',\n\t\t\t...options.minimapTheme\n\t\t},\n\t\tinteractionTheme: {\n\t\t\toutlineColor: options.colors?.accent ?? '#285c89',\n\t\t\t...options.interactionTheme\n\t\t},\n\t\tpanelShape: { radius: 16, contentInset: 26, ...options.panelShape },\n\t\tpanelTheme: {\n\t\t\tsurface: 'frosted',\n\t\t\ttint: '#ffffff',\n\t\t\ttintOpacity: 0.65,\n\t\t\tbackdropBlur: 8,\n\t\t\tshadowIntensity: 0.2,\n\t\t\topacity: 1,\n\t\t\t...options.panelTheme\n\t\t},\n\t\tdockedPanelTheme: {\n\t\t\ttint: '#ffffff',\n\t\t\ttintOpacity: 0.92,\n\t\t\tbackdropBlur: 5,\n\t\t\tshadowIntensity: 0.2,\n\t\t\t...options.dockedPanelTheme\n\t\t},\n\t\tsectionTheme: { tint: '#ffffff', tintOpacity: 0.8, backdropBlur: 8, ...options.sectionTheme },\n\t\tcolors: {\n\t\t\tink: '#173047',\n\t\t\tbody: '#263c4d',\n\t\t\taccent: '#285c89',\n\t\t\tonAccent: '#ffffff',\n\t\t\ttabBackground: '#e4ebf1',\n\t\t\t...options.colors\n\t\t}\n\t};\n}\n"]}
|
|
@@ -1,27 +1,14 @@
|
|
|
1
1
|
import type { VerifiedSpatialElementAssetManifest } from '../catalog/spatialElementAssets.js';
|
|
2
|
-
import type {
|
|
2
|
+
import type { SpatialElementGeometry } from './spatialElementGeometry.js';
|
|
3
3
|
import type { BackgroundSettings, StageCameraSettings, StageInteractionTheme, StageModelSettings } from '../stage/stageTypes.js';
|
|
4
4
|
import type { StagePanelMinimapOptions, StagePanelShape, StagePanelTheme } from '../stage/panelContext.js';
|
|
5
|
-
/**
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
glb: string;
|
|
13
|
-
/** SpatialElement pose and non-spatial-element geometry exclusions applied after loading the GLB. */
|
|
14
|
-
model?: StageModelSettings;
|
|
15
|
-
/** Initial camera orbit; distance and element framing remain automatic. */
|
|
16
|
-
camera?: StageCameraSettings;
|
|
17
|
-
/** Accessible fallback image shown before enhancement or without JavaScript. */
|
|
18
|
-
fallbackImage?: string;
|
|
19
|
-
/** Actual pixel dimensions of the fallback asset, independent of element dimensions. */
|
|
20
|
-
fallbackImageSize?: readonly [number, number];
|
|
21
|
-
}
|
|
22
|
-
/** Compact element data used by a brand catalog without loading a detail document in the layout. */
|
|
23
|
-
export interface SpatialListItem {
|
|
24
|
-
/** Runtime-only pose provider installed by a spatial section, never serialized in route data. */
|
|
5
|
+
/**
|
|
6
|
+
* Category-card projection created by {@link getSpatialListItems}.
|
|
7
|
+
* Includes the element's assets automatically; pass these items to ListSection or CarouselSection.
|
|
8
|
+
* Detail-only media and breadcrumbs are omitted. No catalog data belongs in the layout.
|
|
9
|
+
*/
|
|
10
|
+
export interface SpatialListItem extends Partial<Pick<SpatialElementData, 'geometry' | 'hdr' | 'background' | 'model' | 'camera' | 'assetManifest' | 'fallbackImage' | 'fallbackImageSize'>> {
|
|
11
|
+
/** @internal Runtime-only pose provider installed by a section, never serialized in route data. */
|
|
25
12
|
pose?: import('../catalog/catalogPose.js').CatalogPoseProvider;
|
|
26
13
|
/** Optional full summary projection, sourced from the same document as the DETAIL. */
|
|
27
14
|
summary?: {
|
|
@@ -35,15 +22,18 @@ export interface SpatialListItem {
|
|
|
35
22
|
};
|
|
36
23
|
/** Stable optional key when the same element occurs twice within a section. */
|
|
37
24
|
itemKey?: string;
|
|
38
|
-
/**
|
|
25
|
+
/** @internal Presentation identity assigned by a section; assets retain element identity. */
|
|
39
26
|
occurrence?: string;
|
|
27
|
+
/** Stable element identity, shared with the detail document. */
|
|
40
28
|
id: string;
|
|
29
|
+
/** Ordinary link to the detail page. */
|
|
41
30
|
href: string;
|
|
31
|
+
/** Short label above the title; the helper supplies an empty string when omitted. */
|
|
42
32
|
eyebrow: string;
|
|
33
|
+
/** Visible card title. */
|
|
43
34
|
title: string;
|
|
35
|
+
/** Plain-text feature labels for compact card presentation. */
|
|
44
36
|
features: string[];
|
|
45
|
-
/** Temporary asset metadata for the catalog renderer while manifests are introduced. */
|
|
46
|
-
stage?: SpatialStageConfig;
|
|
47
37
|
}
|
|
48
38
|
/** Shared CSS-glass controls for regular element sections. */
|
|
49
39
|
export interface SpatialSectionTheme {
|
|
@@ -66,16 +56,25 @@ export interface SpatialDockedPanelTheme {
|
|
|
66
56
|
}
|
|
67
57
|
/** Shared visual language supplied by a brand layout to element pages beneath it. */
|
|
68
58
|
export interface SpatialTheme {
|
|
59
|
+
/** Stable namespace shared by pages and transitions, e.g. `shop`. Not an element ID. */
|
|
69
60
|
id: string;
|
|
61
|
+
/** Human-readable brand name used in accessible labels. */
|
|
70
62
|
name: string;
|
|
71
63
|
/** Opaque CSS/Three.js color behind content and the independently revealed HDR stage. */
|
|
72
64
|
background: string;
|
|
65
|
+
/** Shared minimap appearance; element-specific framing belongs in SpatialElementData.minimap. */
|
|
73
66
|
minimapTheme: SpatialMinimapTheme;
|
|
67
|
+
/** Hover/selection outline appearance. */
|
|
74
68
|
interactionTheme: Partial<StageInteractionTheme>;
|
|
69
|
+
/** Panel corner radius and content padding, in CSS pixels. */
|
|
75
70
|
panelShape: StagePanelShape;
|
|
71
|
+
/** Default panel material. `frosted` uses CSS blur; `glass` also uses GPU refraction. */
|
|
76
72
|
panelTheme: StagePanelTheme;
|
|
73
|
+
/** Appearance of the compact header and tabs shown after scrolling past the hero. */
|
|
77
74
|
dockedPanelTheme: SpatialDockedPanelTheme;
|
|
75
|
+
/** Appearance of ordinary HTML content sections. */
|
|
78
76
|
sectionTheme: SpatialSectionTheme;
|
|
77
|
+
/** Semantic text, action and navigation colors. */
|
|
79
78
|
colors: {
|
|
80
79
|
ink: string;
|
|
81
80
|
body: string;
|
|
@@ -139,23 +138,54 @@ export interface SpatialElementSectionDefinition {
|
|
|
139
138
|
}
|
|
140
139
|
/** Minimal section metadata consumed by generated element navigation. */
|
|
141
140
|
export type SpatialElementSectionNavigationItem = Pick<SpatialElementSectionDefinition, 'id' | 'title'>;
|
|
142
|
-
/**
|
|
141
|
+
/**
|
|
142
|
+
* Serializable element content AND its 3D presentation. Supply the same source data to
|
|
143
|
+
* getSpatialListItems on a category page and SpatialElementPage on the detail page.
|
|
144
|
+
* Only id, title, geometry and hdr are required. Layout-wide appearance belongs in SpatialTheme.
|
|
145
|
+
*/
|
|
143
146
|
export interface SpatialElementData {
|
|
147
|
+
/** Stable element identity within the shell's theme namespace; also used by findSpatialElement. */
|
|
144
148
|
id: string;
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
149
|
+
/** Optional identity assertion. When supplied, must match the enclosing theme.id. */
|
|
150
|
+
brandId?: string;
|
|
151
|
+
/** Document title. Defaults to title. */
|
|
152
|
+
pageTitle?: string;
|
|
153
|
+
/** Short category/series label displayed above the title. Defaults to an empty string. */
|
|
154
|
+
eyebrow?: string;
|
|
155
|
+
/** Visible element name. */
|
|
148
156
|
title: string;
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
157
|
+
/** Summary bullets. Defaults to an empty list. */
|
|
158
|
+
features?: SpatialElementFeature[];
|
|
159
|
+
/** Optional primary action; omitted actions render no button. */
|
|
160
|
+
action?: SpatialElementAction;
|
|
161
|
+
/** Required Low/High model sources. Identical URLs share one load; both exports must share coordinates. */
|
|
162
|
+
geometry: SpatialElementGeometry;
|
|
163
|
+
/** Detail lighting and background HDR. Category lighting is explicitly set on ContentPage.hdr. */
|
|
164
|
+
hdr: string;
|
|
165
|
+
/** HDR background blur/tint. Does not change the theme's flat page background or model lighting. */
|
|
166
|
+
background?: BackgroundSettings;
|
|
167
|
+
/** Imported model pose, excluded meshes and material replacements. Rotations are in radians. */
|
|
168
|
+
model?: StageModelSettings;
|
|
169
|
+
/** Initial orbit in degrees and optional fit controls. Distance is fitted automatically. */
|
|
170
|
+
camera?: StageCameraSettings;
|
|
171
|
+
/** Advanced verified resource manifest. Omit for the normal GLB/LOD workflow. */
|
|
172
|
+
assetManifest?: VerifiedSpatialElementAssetManifest;
|
|
173
|
+
/** Poster URL displayed during loading, without JavaScript, or when WebGPU is unavailable. */
|
|
174
|
+
fallbackImage?: string;
|
|
175
|
+
/** Actual poster pixel dimensions [width, height], not physical model dimensions. */
|
|
176
|
+
fallbackImageSize?: readonly [number, number];
|
|
177
|
+
/** Navigation trail. Entries without href are plain text; defaults to an empty list. */
|
|
178
|
+
breadcrumbs?: SpatialElementBreadcrumb[];
|
|
179
|
+
/** Media rail entries. Defaults to one interactive 3D minimap; [] hides the rail's entries. */
|
|
180
|
+
media?: SpatialElementMediaItem[];
|
|
181
|
+
/** Element-specific minimap fit/hover/docked pose. Colors come from the theme. */
|
|
154
182
|
minimap?: Omit<StagePanelMinimapOptions, keyof SpatialMinimapTheme>;
|
|
155
183
|
}
|
|
156
184
|
/** Brand-wide minimap appearance; framing and model pose remain spatial-element-specific. */
|
|
157
185
|
export type SpatialMinimapTheme = Pick<StagePanelMinimapOptions, 'expandedHeight' | 'overlayColor' | 'overlayOpacity' | 'overlayBlur' | 'contextColor' | 'contextOpacity' | 'viewportColor'>;
|
|
186
|
+
/** Category/content page metadata; only title is required. */
|
|
158
187
|
export interface ContentPageData {
|
|
188
|
+
/** Browser document title; defaults to title. */
|
|
159
189
|
pageTitle?: string;
|
|
160
190
|
title: string;
|
|
161
191
|
eyebrow?: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/spatial-element/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mCAAmC,EAAE,MAAM,oCAAoC,CAAC;AAC9F,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/spatial-element/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mCAAmC,EAAE,MAAM,oCAAoC,CAAC;AAC9F,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AAC1E,OAAO,KAAK,EACX,kBAAkB,EAClB,mBAAmB,EACnB,qBAAqB,EACrB,kBAAkB,EAClB,MAAM,wBAAwB,CAAC;AAChC,OAAO,KAAK,EACX,wBAAwB,EACxB,eAAe,EACf,eAAe,EACf,MAAM,0BAA0B,CAAC;AAElC;;;;GAIG;AACH,MAAM,WAAW,eAAgB,SAAQ,OAAO,CAC/C,IAAI,CACH,kBAAkB,EAChB,UAAU,GACV,KAAK,GACL,YAAY,GACZ,OAAO,GACP,QAAQ,GACR,eAAe,GACf,eAAe,GACf,mBAAmB,CACrB,CACD;IACA,mGAAmG;IACnG,IAAI,CAAC,EAAE,OAAO,2BAA2B,EAAE,mBAAmB,CAAC;IAC/D,sFAAsF;IACtF,OAAO,CAAC,EAAE;QACT,QAAQ,EAAE,qBAAqB,EAAE,CAAC;QAClC,MAAM,CAAC,EAAE,oBAAoB,CAAC;QAC9B,qEAAqE;QACrE,WAAW,CAAC,EAAE;YAAE,IAAI,EAAE,MAAM,CAAC;YAAC,KAAK,EAAE,MAAM,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,wFAAwF;IACxF,WAAW,CAAC,EAAE,wBAAwB,EAAE,CAAC;IACzC,+FAA+F;IAC/F,KAAK,CAAC,EAAE,uBAAuB,EAAE,CAAC;IAClC,kFAAkF;IAClF,OAAO,CAAC,EAAE,IAAI,CAAC,wBAAwB,EAAE,MAAM,mBAAmB,CAAC,CAAC;CACpE;AAED,6FAA6F;AAC7F,MAAM,MAAM,mBAAmB,GAAG,IAAI,CACrC,wBAAwB,EACtB,gBAAgB,GAChB,cAAc,GACd,gBAAgB,GAChB,aAAa,GACb,cAAc,GACd,gBAAgB,GAChB,eAAe,CACjB,CAAC;AAEF,8DAA8D;AAC9D,MAAM,WAAW,eAAe;IAC/B,iDAAiD;IACjD,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,wBAAwB,EAAE,CAAC;CACzC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/spatial-element/types.ts"],"names":[],"mappings":"","sourcesContent":["import type { VerifiedSpatialElementAssetManifest } from '../catalog/spatialElementAssets.js';\nimport type {
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/spatial-element/types.ts"],"names":[],"mappings":"","sourcesContent":["import type { VerifiedSpatialElementAssetManifest } from '../catalog/spatialElementAssets.js';\nimport type { SpatialElementGeometry } from './spatialElementGeometry.js';\nimport type {\n\tBackgroundSettings,\n\tStageCameraSettings,\n\tStageInteractionTheme,\n\tStageModelSettings\n} from '../stage/stageTypes.js';\nimport type {\n\tStagePanelMinimapOptions,\n\tStagePanelShape,\n\tStagePanelTheme\n} from '../stage/panelContext.js';\n\n/**\n * Category-card projection created by {@link getSpatialListItems}.\n * Includes the element's assets automatically; pass these items to ListSection or CarouselSection.\n * Detail-only media and breadcrumbs are omitted. No catalog data belongs in the layout.\n */\nexport interface SpatialListItem extends Partial<\n\tPick<\n\t\tSpatialElementData,\n\t\t| 'geometry'\n\t\t| 'hdr'\n\t\t| 'background'\n\t\t| 'model'\n\t\t| 'camera'\n\t\t| 'assetManifest'\n\t\t| 'fallbackImage'\n\t\t| 'fallbackImageSize'\n\t>\n> {\n\t/** @internal Runtime-only pose provider installed by a section, never serialized in route data. */\n\tpose?: import('../catalog/catalogPose.js').CatalogPoseProvider;\n\t/** Optional full summary projection, sourced from the same document as the DETAIL. */\n\tsummary?: {\n\t\tfeatures: SpatialElementFeature[];\n\t\taction?: SpatialElementAction;\n\t\t/** Optional authored link to an existing element content section. */\n\t\tsectionLink?: { href: string; label: string };\n\t};\n\t/** Stable optional key when the same element occurs twice within a section. */\n\titemKey?: string;\n\t/** @internal Presentation identity assigned by a section; assets retain element identity. */\n\toccurrence?: string;\n\t/** Stable element identity, shared with the detail document. */\n\tid: string;\n\t/** Ordinary link to the detail page. */\n\thref: string;\n\t/** Short label above the title; the helper supplies an empty string when omitted. */\n\teyebrow: string;\n\t/** Visible card title. */\n\ttitle: string;\n\t/** Plain-text feature labels for compact card presentation. */\n\tfeatures: string[];\n}\n\n/** Shared CSS-glass controls for regular element sections. */\nexport interface SpatialSectionTheme {\n\ttint: string;\n\t/** Direct tint opacity from zero to one. */\n\ttintOpacity: number;\n\t/** CSS backdrop blur radius in pixels. */\n\tbackdropBlur: number;\n}\n\n/** CSS material used only by the fixed element header and its docked subnavigation. */\nexport interface SpatialDockedPanelTheme {\n\t/** Gaussian CSS backdrop blur radius in pixels. */\n\tbackdropBlur: number;\n\t/** Surface tint, using the same color representation as a stage panel. */\n\ttint: NonNullable<StagePanelTheme['tint']>;\n\t/** Direct tint opacity from zero to one. */\n\ttintOpacity: number;\n\t/** Normalized shadow intensity from zero to one. */\n\tshadowIntensity: number;\n}\n\n/** Shared visual language supplied by a brand layout to element pages beneath it. */\nexport interface SpatialTheme {\n\t/** Stable namespace shared by pages and transitions, e.g. `shop`. Not an element ID. */\n\tid: string;\n\t/** Human-readable brand name used in accessible labels. */\n\tname: string;\n\t/** Opaque CSS/Three.js color behind content and the independently revealed HDR stage. */\n\tbackground: string;\n\t/** Shared minimap appearance; element-specific framing belongs in SpatialElementData.minimap. */\n\tminimapTheme: SpatialMinimapTheme;\n\t/** Hover/selection outline appearance. */\n\tinteractionTheme: Partial<StageInteractionTheme>;\n\t/** Panel corner radius and content padding, in CSS pixels. */\n\tpanelShape: StagePanelShape;\n\t/** Default panel material. `frosted` uses CSS blur; `glass` also uses GPU refraction. */\n\tpanelTheme: StagePanelTheme;\n\t/** Appearance of the compact header and tabs shown after scrolling past the hero. */\n\tdockedPanelTheme: SpatialDockedPanelTheme;\n\t/** Appearance of ordinary HTML content sections. */\n\tsectionTheme: SpatialSectionTheme;\n\t/** Semantic text, action and navigation colors. */\n\tcolors: {\n\t\tink: string;\n\t\tbody: string;\n\t\taccent: string;\n\t\tonAccent: string;\n\t\ttabBackground: string;\n\t};\n}\n\n/** A single line in the spatial-element-summary feature list. */\nexport interface SpatialElementFeature {\n\tlabel: string;\n\t/** Optional short marker displayed before the feature text. */\n\tmarker?: string;\n}\n\n/** Primary conversion action displayed in the element summary panel. */\nexport interface SpatialElementAction {\n\tlabel: string;\n\t/** Stable behavior identity for shared presentation; never supplies an event handler. */\n\tsemanticId?: string;\n\thref?: string;\n\tariaLabel?: string;\n}\n\n/** A breadcrumb link or terminal breadcrumb label. */\nexport interface SpatialElementBreadcrumb {\n\tlabel: string;\n\thref?: string;\n}\n\n/** Media entries rendered in the element rail. */\nexport type SpatialElementMediaItem =\n\t| { id: string; kind: 'minimap'; label: string }\n\t| { id: string; kind: 'drawing'; label: string }\n\t| { id: string; kind: 'image'; label: string; src: string; alt: string };\n\n/** Optional CSS presentation for a regular HTML element section. */\nexport interface SpatialElementSectionStyle {\n\t/** Overrides the brand section tint. */\n\ttint?: string;\n\t/** Overrides the brand section tint opacity from zero to one. */\n\ttintOpacity?: number;\n\t/** Overrides the brand section backdrop blur radius in pixels. */\n\tbackdropBlur?: number;\n\ttextColor?: string;\n\t/** CSS max-width such as `920px`, `72rem`, or `100%`. */\n\twidth?: string;\n}\n\n/** Metadata supplied to a composable spatial-element `Section`. */\nexport interface SpatialElementSectionDefinition {\n\tid: string;\n\ttitle: string;\n\tstyle?: SpatialElementSectionStyle;\n}\n\n/** Minimal section metadata consumed by generated element navigation. */\nexport type SpatialElementSectionNavigationItem = Pick<\n\tSpatialElementSectionDefinition,\n\t'id' | 'title'\n>;\n\n/**\n * Serializable element content AND its 3D presentation. Supply the same source data to\n * getSpatialListItems on a category page and SpatialElementPage on the detail page.\n * Only id, title, geometry and hdr are required. Layout-wide appearance belongs in SpatialTheme.\n */\nexport interface SpatialElementData {\n\t/** Stable element identity within the shell's theme namespace; also used by findSpatialElement. */\n\tid: string;\n\t/** Optional identity assertion. When supplied, must match the enclosing theme.id. */\n\tbrandId?: string;\n\t/** Document title. Defaults to title. */\n\tpageTitle?: string;\n\t/** Short category/series label displayed above the title. Defaults to an empty string. */\n\teyebrow?: string;\n\t/** Visible element name. */\n\ttitle: string;\n\t/** Summary bullets. Defaults to an empty list. */\n\tfeatures?: SpatialElementFeature[];\n\t/** Optional primary action; omitted actions render no button. */\n\taction?: SpatialElementAction;\n\t/** Required Low/High model sources. Identical URLs share one load; both exports must share coordinates. */\n\tgeometry: SpatialElementGeometry;\n\t/** Detail lighting and background HDR. Category lighting is explicitly set on ContentPage.hdr. */\n\thdr: string;\n\t/** HDR background blur/tint. Does not change the theme's flat page background or model lighting. */\n\tbackground?: BackgroundSettings;\n\t/** Imported model pose, excluded meshes and material replacements. Rotations are in radians. */\n\tmodel?: StageModelSettings;\n\t/** Initial orbit in degrees and optional fit controls. Distance is fitted automatically. */\n\tcamera?: StageCameraSettings;\n\t/** Advanced verified resource manifest. Omit for the normal GLB/LOD workflow. */\n\tassetManifest?: VerifiedSpatialElementAssetManifest;\n\t/** Poster URL displayed during loading, without JavaScript, or when WebGPU is unavailable. */\n\tfallbackImage?: string;\n\t/** Actual poster pixel dimensions [width, height], not physical model dimensions. */\n\tfallbackImageSize?: readonly [number, number];\n\t/** Navigation trail. Entries without href are plain text; defaults to an empty list. */\n\tbreadcrumbs?: SpatialElementBreadcrumb[];\n\t/** Media rail entries. Defaults to one interactive 3D minimap; [] hides the rail's entries. */\n\tmedia?: SpatialElementMediaItem[];\n\t/** Element-specific minimap fit/hover/docked pose. Colors come from the theme. */\n\tminimap?: Omit<StagePanelMinimapOptions, keyof SpatialMinimapTheme>;\n}\n\n/** Brand-wide minimap appearance; framing and model pose remain spatial-element-specific. */\nexport type SpatialMinimapTheme = Pick<\n\tStagePanelMinimapOptions,\n\t| 'expandedHeight'\n\t| 'overlayColor'\n\t| 'overlayOpacity'\n\t| 'overlayBlur'\n\t| 'contextColor'\n\t| 'contextOpacity'\n\t| 'viewportColor'\n>;\n\n/** Category/content page metadata; only title is required. */\nexport interface ContentPageData {\n\t/** Browser document title; defaults to title. */\n\tpageTitle?: string;\n\ttitle: string;\n\teyebrow?: string;\n\tintro?: string;\n\tbreadcrumbs?: SpatialElementBreadcrumb[];\n}\n"]}
|
|
@@ -124,7 +124,7 @@ export class MinimapController {
|
|
|
124
124
|
const maximumPanelScale = Math.max(resolved.expandedHeight / baseHeight, 1);
|
|
125
125
|
const captureExtentWidth = baseWidth * maximumPanelScale + blurGuard * 2;
|
|
126
126
|
const captureExtentHeight = baseHeight * maximumPanelScale + blurGuard * 2;
|
|
127
|
-
const maximumSourcePixelsPerCssPixel =
|
|
127
|
+
const maximumSourcePixelsPerCssPixel = this.getFullPixelRatio();
|
|
128
128
|
const aspect = baseWidth / Math.max(baseHeight, 1);
|
|
129
129
|
const modelRadius = Math.max(sphere.radius, 0.001);
|
|
130
130
|
const panelDistance = Math.max(this.panelCamera.position.z - panel.group.position.z, modelRadius * 2);
|