@glboost/react 0.0.0-stage → 0.1.0

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Chase Holdren
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,34 @@
1
- # Temporary Holding Version
1
+ # @glboost/react
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ The [GLBoost](https://glboost.com) 3D viewer as a React component. It renders `<glboost-viewer>`
4
+ (model-viewer under the hood, with GLBoost's presets, LOD, AR, hotspots, variants, measurement, and
5
+ review pins) and loads `embed.js` from the CDN once per page.
6
+
7
+ ```sh
8
+ npm install @glboost/react
9
+ ```
10
+
11
+ ```tsx
12
+ import { GLBoostViewer } from '@glboost/react';
13
+
14
+ export function Product({ assetId }: { assetId: string }) {
15
+ return (
16
+ <GLBoostViewer
17
+ asset={assetId}
18
+ preset="auto"
19
+ ar
20
+ autoRotate
21
+ style={{ width: '100%', height: 480 }}
22
+ onLoad={({ spec, loadMs }) => console.log(spec, loadMs)}
23
+ />
24
+ );
25
+ }
26
+ ```
27
+
28
+ Attributes are props in camelCase (`variantPicker`, `measureUnits`, `noControls`), events are
29
+ callbacks (`onLoad`, `onHotspotClick`, `onCameraChange`, `onVariantChange`, `onMeasureChange`,
30
+ `onLodChange`, `onPinClick`, `onError`), `pins` renders review pins, and a `ref` gives the element's
31
+ JavaScript API (`GLBoostViewerElement`: `getCamera`, `setCamera`, `play`, `setVariant`,
32
+ `startMeasure`, `pickPoint`, …).
33
+
34
+ Docs: https://glboost.com/docs/viewer
@@ -0,0 +1,218 @@
1
+ import * as react from 'react';
2
+ import { CSSProperties, Ref } from 'react';
3
+
4
+ /**
5
+ * Plain shapes shared with `<glboost-viewer>` (`packages/viewer`): the config the CDN serves,
6
+ * hotspots, review pins, camera poses, LOD levels, and measurements. They are declared here so the
7
+ * published package needs no types from the private viewer; the tests check the element class still
8
+ * satisfies `GLBoostViewerElement`.
9
+ */
10
+ /** Camera orbit: yaw and pitch in degrees, distance in model units. */
11
+ interface Pose {
12
+ yaw: number;
13
+ pitch: number;
14
+ distance: number;
15
+ fov?: number;
16
+ }
17
+ type Vec3 = [number, number, number];
18
+ interface Measurement {
19
+ a: Vec3;
20
+ b: Vec3;
21
+ /** Model units (metres for a correctly scaled glTF). */
22
+ distance: number;
23
+ }
24
+ interface Hotspot {
25
+ id: string;
26
+ title: string;
27
+ body?: string;
28
+ position: Vec3;
29
+ normal: Vec3;
30
+ camera?: Pose;
31
+ /** Material variant to switch to when the hotspot is clicked. */
32
+ variant?: string;
33
+ }
34
+ /** A review comment anchored on the model. */
35
+ interface Pin {
36
+ id: string;
37
+ label: string;
38
+ position: Vec3;
39
+ normal: Vec3;
40
+ active?: boolean;
41
+ }
42
+ interface LodLevel {
43
+ /** Canonical spec of the variant. */
44
+ spec: string;
45
+ /** Share of the base triangle count this level keeps; 1 for the base itself. */
46
+ ratio: number;
47
+ triangles: number;
48
+ bytes: number;
49
+ }
50
+ /** Per-variant size, triangles, and score, keyed by canonical spec. */
51
+ type VariantStats = Record<string, {
52
+ bytes: number;
53
+ triangles?: number;
54
+ score?: {
55
+ grade: string;
56
+ points: number;
57
+ };
58
+ }>;
59
+ /** The material-variant chip row: labels and swatches keyed by `KHR_materials_variants` name. */
60
+ interface VariantPicker {
61
+ enabled: boolean;
62
+ labels?: Record<string, string>;
63
+ /** A CSS colour or an https image URL. */
64
+ swatches?: Record<string, string>;
65
+ }
66
+ interface ViewerSettings {
67
+ camera?: Pose;
68
+ target?: Vec3;
69
+ exposure?: number;
70
+ shadowIntensity?: number;
71
+ environment?: string;
72
+ background?: string;
73
+ autoRotate?: boolean;
74
+ animation?: string | null;
75
+ variant?: string | null;
76
+ ar?: boolean;
77
+ variantPicker?: VariantPicker;
78
+ }
79
+ /** Shape of `https://cdn.glboost.com/<assetId>/config.json`. */
80
+ interface ViewerConfig {
81
+ assetId: string;
82
+ name: string;
83
+ versionId: string | null;
84
+ status: 'ready' | 'processing';
85
+ variants: string[];
86
+ /** Canonical spec the request resolved to. */
87
+ spec?: string;
88
+ variantStats?: VariantStats;
89
+ /** Ready export extensions per spec plus `original`. */
90
+ exports?: Record<string, string[]>;
91
+ /** Spec whose `.usdz` Quick Look should open, null when none exists. */
92
+ usdz?: string | null;
93
+ usdzMatchesRequest?: boolean;
94
+ viewerSettings: ViewerSettings | null;
95
+ hotspots: Hotspot[];
96
+ watermark: boolean;
97
+ thumbnail: boolean;
98
+ }
99
+
100
+ /**
101
+ * The JavaScript API of `<glboost-viewer>` once `embed.js` has defined it: what a `ref` on
102
+ * `<GLBoostViewer>` gives you. Mirrors the public members of the element class in
103
+ * `packages/viewer/src/element.ts` (the React package's tests check the class satisfies it).
104
+ */
105
+ interface GLBoostViewerElement extends HTMLElement {
106
+ /** Resolves once the current model has loaded. */
107
+ readonly ready: Promise<void>;
108
+ /** CDN origin the element loads from. */
109
+ get base(): string;
110
+ set base(value: string | null | undefined);
111
+ /** The `config.json` the element resolved, once loaded. */
112
+ readonly currentConfig: ViewerConfig | null;
113
+ /** The preset in use after `preset="auto"` was resolved for this device. */
114
+ readonly resolvedPreset: string | null;
115
+ get lod(): string | null;
116
+ set lod(value: string | null | undefined);
117
+ /** The LOD ladder of the current version, lightest first. */
118
+ readonly lods: LodLevel[];
119
+ readonly currentLod: LodLevel | null;
120
+ getCamera(): Pose;
121
+ setCamera(pose: Partial<Pose>): void;
122
+ recenter(): void;
123
+ readonly animations: string[];
124
+ play(name?: string, options?: {
125
+ speed?: number;
126
+ repetitions?: number;
127
+ }): void;
128
+ pause(): void;
129
+ /** `KHR_materials_variants` names. */
130
+ readonly variants: string[];
131
+ setVariant(name: string | null): void;
132
+ reload(): Promise<void>;
133
+ /** Surface point and normal under a client-space coordinate, or null when the click missed the model. */
134
+ pickPoint(clientX: number, clientY: number): {
135
+ position: [number, number, number];
136
+ normal: [number, number, number];
137
+ } | null;
138
+ /** True while a measurement waits for its endpoints. */
139
+ readonly measuring: boolean;
140
+ readonly measure: Measurement | null;
141
+ startMeasure(): void;
142
+ showMeasure(a: Vec3, b: Vec3): void;
143
+ clearMeasure(): void;
144
+ /** Review pins to render on the model. */
145
+ setPins(pins: Pin[]): void;
146
+ }
147
+
148
+ /** Injects `<base>/_/embed.js` once per page. */
149
+ declare function loadEmbedScript(base?: string): Promise<void>;
150
+ interface GLBoostViewerProps {
151
+ asset: string;
152
+ base?: string;
153
+ preset?: string;
154
+ spec?: string;
155
+ v?: string;
156
+ exp?: string | number;
157
+ sig?: string;
158
+ poster?: 'auto' | string;
159
+ ar?: boolean;
160
+ autoRotate?: boolean;
161
+ noControls?: boolean;
162
+ environment?: string;
163
+ noSettings?: boolean;
164
+ noHotspots?: boolean;
165
+ watermark?: boolean;
166
+ variant?: string;
167
+ alt?: string;
168
+ /** `auto`, `progressive`, or a fixed ratio such as `0.5`; needs a project LOD ladder. */
169
+ lod?: string;
170
+ /** `interaction` shows the poster with a play glyph until the viewer is touched. */
171
+ reveal?: 'auto' | 'interaction' | 'manual';
172
+ loading?: 'auto' | 'lazy' | 'eager';
173
+ /** Chip row for `KHR_materials_variants`; the saved viewer settings can turn it on too. */
174
+ variantPicker?: boolean;
175
+ /** Space-separated tool buttons; `measure` adds the ruler. */
176
+ tools?: string;
177
+ /** `m` (default), `cm`, `mm`, `in`, or `ft`. */
178
+ measureUnits?: string;
179
+ /** Model units per metre for models not built at 1 unit = 1 m. */
180
+ measureScale?: number | string;
181
+ className?: string;
182
+ style?: CSSProperties;
183
+ onLoad?: (detail: {
184
+ assetId: string;
185
+ versionId: string | null;
186
+ spec: string;
187
+ loadMs: number;
188
+ }) => void;
189
+ onHotspotClick?: (hotspot: Hotspot) => void;
190
+ /** Review pins to render; re-applied whenever the array identity changes or the model loads. */
191
+ pins?: Pin[];
192
+ onPinClick?: (id: string) => void;
193
+ onCameraChange?: (pose: Pose & {
194
+ source?: string;
195
+ }) => void;
196
+ onError?: (message: string) => void;
197
+ onLodChange?: (detail: {
198
+ ratio: number;
199
+ spec: string;
200
+ }) => void;
201
+ onVariantChange?: (name: string | null) => void;
202
+ onMeasureChange?: (measurement: (Measurement & {
203
+ text: string;
204
+ }) | null) => void;
205
+ ref?: Ref<GLBoostViewerElement | null>;
206
+ }
207
+ /**
208
+ * React wrapper around `<glboost-viewer>`; loads the embed script from the CDN on first use. Props
209
+ * mirror the element's attributes (camelCase), events become callbacks, and `ref` gives the
210
+ * element's JavaScript API (`GLBoostViewerElement`).
211
+ */
212
+ declare function GLBoostViewer(props: GLBoostViewerProps): react.ReactElement<{
213
+ style: CSSProperties | undefined;
214
+ ref: react.RefObject<GLBoostViewerElement | null>;
215
+ }, string | react.JSXElementConstructor<any>>;
216
+
217
+ export { GLBoostViewer, loadEmbedScript };
218
+ export type { GLBoostViewerElement, GLBoostViewerProps, Hotspot, LodLevel, Measurement, Pin, Pose, VariantPicker, VariantStats, Vec3, ViewerConfig, ViewerSettings };
package/dist/index.js ADDED
@@ -0,0 +1,157 @@
1
+ "use client";
2
+
3
+ // src/index.tsx
4
+ import {
5
+ createElement,
6
+ useEffect,
7
+ useImperativeHandle,
8
+ useRef
9
+ } from "react";
10
+ var DEFAULT_BASE = "https://cdn.glboost.com";
11
+ var loaders = /* @__PURE__ */ new Map();
12
+ function loadEmbedScript(base = DEFAULT_BASE) {
13
+ const src = `${base.replace(/\/+$/, "")}/_/embed.js`;
14
+ if (typeof window === "undefined") return Promise.resolve();
15
+ if (customElements.get("glboost-viewer")) return Promise.resolve();
16
+ let pending = loaders.get(src);
17
+ if (!pending) {
18
+ pending = new Promise((resolve, reject) => {
19
+ const script = document.createElement("script");
20
+ script.src = src;
21
+ script.async = true;
22
+ script.onload = () => resolve();
23
+ script.onerror = () => reject(new Error(`failed to load ${src}`));
24
+ document.head.appendChild(script);
25
+ });
26
+ loaders.set(src, pending);
27
+ }
28
+ return pending;
29
+ }
30
+ function GLBoostViewer(props) {
31
+ const {
32
+ asset,
33
+ base,
34
+ preset,
35
+ spec,
36
+ v,
37
+ exp,
38
+ sig,
39
+ poster,
40
+ ar,
41
+ autoRotate,
42
+ noControls,
43
+ environment,
44
+ noSettings,
45
+ noHotspots,
46
+ watermark,
47
+ variant,
48
+ alt,
49
+ lod,
50
+ reveal,
51
+ loading,
52
+ variantPicker,
53
+ tools,
54
+ measureUnits,
55
+ measureScale,
56
+ className,
57
+ style,
58
+ onLoad,
59
+ onHotspotClick,
60
+ pins,
61
+ onPinClick,
62
+ onCameraChange,
63
+ onError,
64
+ onLodChange,
65
+ onVariantChange,
66
+ onMeasureChange,
67
+ ref
68
+ } = props;
69
+ const elementRef = useRef(null);
70
+ useImperativeHandle(ref, () => elementRef.current, []);
71
+ useEffect(() => {
72
+ loadEmbedScript(base).catch((e) => onError?.(e.message));
73
+ }, [base, onError]);
74
+ useEffect(() => {
75
+ const el = elementRef.current;
76
+ if (!el) return;
77
+ const load = (e) => onLoad?.(e.detail);
78
+ const hotspot = (e) => onHotspotClick?.(e.detail.hotspot);
79
+ const camera = (e) => onCameraChange?.(e.detail);
80
+ const error = (e) => onError?.(e.detail?.message ?? "error");
81
+ const pin = (e) => onPinClick?.(e.detail.id);
82
+ const lodChange = (e) => onLodChange?.(e.detail);
83
+ const variantChange = (e) => onVariantChange?.(e.detail.name);
84
+ const measureChange = (e) => onMeasureChange?.(e.detail);
85
+ el.addEventListener("load", load);
86
+ el.addEventListener("hotspot-click", hotspot);
87
+ el.addEventListener("camera-change", camera);
88
+ el.addEventListener("error", error);
89
+ el.addEventListener("pin-click", pin);
90
+ el.addEventListener("lod-change", lodChange);
91
+ el.addEventListener("variant-change", variantChange);
92
+ el.addEventListener("measure-change", measureChange);
93
+ return () => {
94
+ el.removeEventListener("load", load);
95
+ el.removeEventListener("hotspot-click", hotspot);
96
+ el.removeEventListener("camera-change", camera);
97
+ el.removeEventListener("error", error);
98
+ el.removeEventListener("pin-click", pin);
99
+ el.removeEventListener("lod-change", lodChange);
100
+ el.removeEventListener("variant-change", variantChange);
101
+ el.removeEventListener("measure-change", measureChange);
102
+ };
103
+ }, [
104
+ onLoad,
105
+ onHotspotClick,
106
+ onCameraChange,
107
+ onError,
108
+ onPinClick,
109
+ onLodChange,
110
+ onVariantChange,
111
+ onMeasureChange
112
+ ]);
113
+ useEffect(() => {
114
+ const el = elementRef.current;
115
+ if (!el || !pins) return;
116
+ const apply = () => {
117
+ if (typeof el.setPins === "function") el.setPins(pins);
118
+ };
119
+ apply();
120
+ el.addEventListener("load", apply);
121
+ return () => el.removeEventListener("load", apply);
122
+ }, [pins]);
123
+ const attrs = {
124
+ asset,
125
+ base,
126
+ preset,
127
+ spec,
128
+ v,
129
+ exp: exp === void 0 ? void 0 : String(exp),
130
+ sig,
131
+ poster,
132
+ environment,
133
+ variant,
134
+ alt,
135
+ lod,
136
+ reveal,
137
+ loading,
138
+ tools,
139
+ "measure-units": measureUnits,
140
+ "measure-scale": measureScale === void 0 ? void 0 : String(measureScale),
141
+ class: className
142
+ };
143
+ if (ar) attrs.ar = "";
144
+ if (autoRotate) attrs["auto-rotate"] = "";
145
+ if (noControls) attrs["no-controls"] = "";
146
+ if (noSettings) attrs["no-settings"] = "";
147
+ if (noHotspots) attrs["no-hotspots"] = "";
148
+ if (watermark) attrs.watermark = "";
149
+ if (variantPicker) attrs["variant-picker"] = "";
150
+ for (const key of Object.keys(attrs)) if (attrs[key] === void 0) delete attrs[key];
151
+ return createElement("glboost-viewer", { ...attrs, style, ref: elementRef });
152
+ }
153
+ export {
154
+ GLBoostViewer,
155
+ loadEmbedScript
156
+ };
157
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/index.tsx"],"sourcesContent":["'use client';\n\nimport {\n createElement,\n useEffect,\n useImperativeHandle,\n useRef,\n type CSSProperties,\n type Ref,\n} from 'react';\nimport type { Hotspot, Measurement, Pin, Pose } from './types';\nimport type { GLBoostViewerElement } from './element';\n\nconst DEFAULT_BASE = 'https://cdn.glboost.com';\nconst loaders = new Map<string, Promise<void>>();\n\n/** Injects `<base>/_/embed.js` once per page. */\nexport function loadEmbedScript(base: string = DEFAULT_BASE): Promise<void> {\n const src = `${base.replace(/\\/+$/, '')}/_/embed.js`;\n if (typeof window === 'undefined') return Promise.resolve();\n if (customElements.get('glboost-viewer')) return Promise.resolve();\n let pending = loaders.get(src);\n if (!pending) {\n pending = new Promise<void>((resolve, reject) => {\n const script = document.createElement('script');\n script.src = src;\n script.async = true;\n script.onload = () => resolve();\n script.onerror = () => reject(new Error(`failed to load ${src}`));\n document.head.appendChild(script);\n });\n loaders.set(src, pending);\n }\n return pending;\n}\n\nexport interface GLBoostViewerProps {\n asset: string;\n base?: string;\n preset?: string;\n spec?: string;\n v?: string;\n exp?: string | number;\n sig?: string;\n poster?: 'auto' | string;\n ar?: boolean;\n autoRotate?: boolean;\n noControls?: boolean;\n environment?: string;\n noSettings?: boolean;\n noHotspots?: boolean;\n watermark?: boolean;\n variant?: string;\n alt?: string;\n /** `auto`, `progressive`, or a fixed ratio such as `0.5`; needs a project LOD ladder. */\n lod?: string;\n /** `interaction` shows the poster with a play glyph until the viewer is touched. */\n reveal?: 'auto' | 'interaction' | 'manual';\n loading?: 'auto' | 'lazy' | 'eager';\n /** Chip row for `KHR_materials_variants`; the saved viewer settings can turn it on too. */\n variantPicker?: boolean;\n /** Space-separated tool buttons; `measure` adds the ruler. */\n tools?: string;\n /** `m` (default), `cm`, `mm`, `in`, or `ft`. */\n measureUnits?: string;\n /** Model units per metre for models not built at 1 unit = 1 m. */\n measureScale?: number | string;\n className?: string;\n style?: CSSProperties;\n onLoad?: (detail: {\n assetId: string;\n versionId: string | null;\n spec: string;\n loadMs: number;\n }) => void;\n onHotspotClick?: (hotspot: Hotspot) => void;\n /** Review pins to render; re-applied whenever the array identity changes or the model loads. */\n pins?: Pin[];\n onPinClick?: (id: string) => void;\n onCameraChange?: (pose: Pose & { source?: string }) => void;\n onError?: (message: string) => void;\n onLodChange?: (detail: { ratio: number; spec: string }) => void;\n onVariantChange?: (name: string | null) => void;\n onMeasureChange?: (measurement: (Measurement & { text: string }) | null) => void;\n ref?: Ref<GLBoostViewerElement | null>;\n}\n\n/**\n * React wrapper around `<glboost-viewer>`; loads the embed script from the CDN on first use. Props\n * mirror the element's attributes (camelCase), events become callbacks, and `ref` gives the\n * element's JavaScript API (`GLBoostViewerElement`).\n */\nexport function GLBoostViewer(props: GLBoostViewerProps) {\n const {\n asset,\n base,\n preset,\n spec,\n v,\n exp,\n sig,\n poster,\n ar,\n autoRotate,\n noControls,\n environment,\n noSettings,\n noHotspots,\n watermark,\n variant,\n alt,\n lod,\n reveal,\n loading,\n variantPicker,\n tools,\n measureUnits,\n measureScale,\n className,\n style,\n onLoad,\n onHotspotClick,\n pins,\n onPinClick,\n onCameraChange,\n onError,\n onLodChange,\n onVariantChange,\n onMeasureChange,\n ref,\n } = props;\n const elementRef = useRef<GLBoostViewerElement | null>(null);\n useImperativeHandle(ref as Ref<GLBoostViewerElement>, () => elementRef.current!, []);\n\n useEffect(() => {\n loadEmbedScript(base).catch((e: Error) => onError?.(e.message));\n }, [base, onError]);\n\n useEffect(() => {\n const el = elementRef.current;\n if (!el) return;\n const load = (e: Event) => onLoad?.((e as CustomEvent).detail);\n const hotspot = (e: Event) => onHotspotClick?.((e as CustomEvent).detail.hotspot);\n const camera = (e: Event) => onCameraChange?.((e as CustomEvent).detail);\n const error = (e: Event) => onError?.((e as CustomEvent).detail?.message ?? 'error');\n const pin = (e: Event) => onPinClick?.((e as CustomEvent).detail.id);\n const lodChange = (e: Event) => onLodChange?.((e as CustomEvent).detail);\n const variantChange = (e: Event) => onVariantChange?.((e as CustomEvent).detail.name);\n const measureChange = (e: Event) => onMeasureChange?.((e as CustomEvent).detail);\n el.addEventListener('load', load);\n el.addEventListener('hotspot-click', hotspot);\n el.addEventListener('camera-change', camera);\n el.addEventListener('error', error);\n el.addEventListener('pin-click', pin);\n el.addEventListener('lod-change', lodChange);\n el.addEventListener('variant-change', variantChange);\n el.addEventListener('measure-change', measureChange);\n return () => {\n el.removeEventListener('load', load);\n el.removeEventListener('hotspot-click', hotspot);\n el.removeEventListener('camera-change', camera);\n el.removeEventListener('error', error);\n el.removeEventListener('pin-click', pin);\n el.removeEventListener('lod-change', lodChange);\n el.removeEventListener('variant-change', variantChange);\n el.removeEventListener('measure-change', measureChange);\n };\n }, [\n onLoad,\n onHotspotClick,\n onCameraChange,\n onError,\n onPinClick,\n onLodChange,\n onVariantChange,\n onMeasureChange,\n ]);\n\n useEffect(() => {\n const el = elementRef.current;\n if (!el || !pins) return;\n // The element only exists once embed.js has defined it; apply now and again after each load.\n const apply = () => {\n if (typeof el.setPins === 'function') el.setPins(pins);\n };\n apply();\n el.addEventListener('load', apply);\n return () => el.removeEventListener('load', apply);\n }, [pins]);\n\n const attrs: Record<string, string | undefined> = {\n asset,\n base,\n preset,\n spec,\n v,\n exp: exp === undefined ? undefined : String(exp),\n sig,\n poster,\n environment,\n variant,\n alt,\n lod,\n reveal,\n loading,\n tools,\n 'measure-units': measureUnits,\n 'measure-scale': measureScale === undefined ? undefined : String(measureScale),\n class: className,\n };\n if (ar) attrs.ar = '';\n if (autoRotate) attrs['auto-rotate'] = '';\n if (noControls) attrs['no-controls'] = '';\n if (noSettings) attrs['no-settings'] = '';\n if (noHotspots) attrs['no-hotspots'] = '';\n if (watermark) attrs.watermark = '';\n if (variantPicker) attrs['variant-picker'] = '';\n for (const key of Object.keys(attrs)) if (attrs[key] === undefined) delete attrs[key];\n return createElement('glboost-viewer', { ...attrs, style, ref: elementRef });\n}\n\nexport type { GLBoostViewerElement } from './element';\nexport type * from './types';\n"],"mappings":";;;AAEA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAGK;AAIP,IAAM,eAAe;AACrB,IAAM,UAAU,oBAAI,IAA2B;AAGxC,SAAS,gBAAgB,OAAe,cAA6B;AAC1E,QAAM,MAAM,GAAG,KAAK,QAAQ,QAAQ,EAAE,CAAC;AACvC,MAAI,OAAO,WAAW,YAAa,QAAO,QAAQ,QAAQ;AAC1D,MAAI,eAAe,IAAI,gBAAgB,EAAG,QAAO,QAAQ,QAAQ;AACjE,MAAI,UAAU,QAAQ,IAAI,GAAG;AAC7B,MAAI,CAAC,SAAS;AACZ,cAAU,IAAI,QAAc,CAAC,SAAS,WAAW;AAC/C,YAAM,SAAS,SAAS,cAAc,QAAQ;AAC9C,aAAO,MAAM;AACb,aAAO,QAAQ;AACf,aAAO,SAAS,MAAM,QAAQ;AAC9B,aAAO,UAAU,MAAM,OAAO,IAAI,MAAM,kBAAkB,GAAG,EAAE,CAAC;AAChE,eAAS,KAAK,YAAY,MAAM;AAAA,IAClC,CAAC;AACD,YAAQ,IAAI,KAAK,OAAO;AAAA,EAC1B;AACA,SAAO;AACT;AA0DO,SAAS,cAAc,OAA2B;AACvD,QAAM;AAAA,IACJ;A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,MAAI,WAAY,OAAM,aAAa,IAAI;AACvC,MAAI,WAAY,OAAM,aAAa,IAAI;AACvC,MAAI,WAAY,OAAM,aAAa,IAAI;AACvC,MAAI,WAAY,OAAM,aAAa,IAAI;AACvC,MAAI,UAAW,OAAM,YAAY;AACjC,MAAI,cAAe,OAAM,gBAAgB,IAAI;AAC7C,aAAW,OAAO,OAAO,KAAK,KAAK,EAAG,KAAI,MAAM,GAAG,MAAM,OAAW,QAAO,MAAM,GAAG;AACpF,SAAO,cAAc,kBAAkB,EAAE,GAAG,OAAO,OAAO,KAAK,WAAW,CAAC;AAC7E;","names":[]}
package/package.json CHANGED
@@ -1,6 +1,60 @@
1
1
  {
2
2
  "name": "@glboost/react",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
3
+ "version": "0.1.0",
4
+ "license": "MIT",
5
+ "description": "React wrapper for the GLBoost <glboost-viewer> embed: 3D model viewer with AR, hotspots, LOD, and review pins.",
6
+ "type": "module",
7
+ "sideEffects": false,
8
+ "exports": {
9
+ ".": {
10
+ "types": "./dist/index.d.ts",
11
+ "default": "./dist/index.js"
12
+ }
13
+ },
14
+ "files": [
15
+ "dist",
16
+ "README.md"
17
+ ],
18
+ "engines": {
19
+ "node": ">=20"
20
+ },
21
+ "repository": {
22
+ "type": "git",
23
+ "url": "git+https://github.com/chaseholdren/glboost.git",
24
+ "directory": "packages/react"
25
+ },
26
+ "homepage": "https://glboost.com/docs/viewer",
27
+ "keywords": [
28
+ "gltf",
29
+ "glb",
30
+ "3d",
31
+ "react",
32
+ "model-viewer",
33
+ "glboost"
34
+ ],
35
+ "peerDependencies": {
36
+ "react": ">=18",
37
+ "react-dom": ">=18"
38
+ },
39
+ "devDependencies": {
40
+ "@google/model-viewer": "^4.3.1",
41
+ "@types/node": "^24.13.3",
42
+ "@types/react": "^19",
43
+ "@types/react-dom": "^19.2.7",
44
+ "jsdom": "^30.0.1",
45
+ "react": "19.2.8",
46
+ "react-dom": "19.2.8",
47
+ "tsup": "^9.0.0",
48
+ "typescript": "~5.9.3",
49
+ "vitest": "~4.1.11",
50
+ "@glboost/viewer": "0.0.0"
51
+ },
52
+ "scripts": {
53
+ "build": "tsup",
54
+ "typecheck": "tsc -p tsconfig.json",
55
+ "lint": "eslint --config ../../eslint.config.js .",
56
+ "test": "vitest run"
57
+ },
58
+ "main": "./dist/index.js",
59
+ "types": "./dist/index.d.ts"
6
60
  }