@popaya/pgsg-viewer 0.1.9 → 0.1.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-3HV5SAZ7.js → chunk-Z7DBLRJH.js} +8 -2
- package/dist/chunk-Z7DBLRJH.js.map +1 -0
- package/dist/core/index.d.ts +6 -1
- package/dist/core/index.js +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -1
- package/dist/{pgsg-three-viewer-TOCXQMZQ.js → pgsg-three-viewer-KBOYGHT3.js} +721 -377
- package/dist/pgsg-three-viewer-KBOYGHT3.js.map +1 -0
- package/dist/react/index.d.ts +1 -0
- package/dist/react/index.js +418 -16
- package/dist/react/index.js.map +1 -1
- package/package.json +24 -2
- package/dist/chunk-3HV5SAZ7.js.map +0 -1
- package/dist/pgsg-three-viewer-TOCXQMZQ.js.map +0 -1
package/dist/react/index.js
CHANGED
|
@@ -1,10 +1,409 @@
|
|
|
1
1
|
import {
|
|
2
2
|
PGSGViewer
|
|
3
|
-
} from "../chunk-
|
|
3
|
+
} from "../chunk-Z7DBLRJH.js";
|
|
4
|
+
|
|
5
|
+
// #style-inject:#style-inject
|
|
6
|
+
function styleInject(css, { insertAt } = {}) {
|
|
7
|
+
if (!css || typeof document === "undefined") return;
|
|
8
|
+
const head = document.head || document.getElementsByTagName("head")[0];
|
|
9
|
+
const style = document.createElement("style");
|
|
10
|
+
style.type = "text/css";
|
|
11
|
+
if (insertAt === "top") {
|
|
12
|
+
if (head.firstChild) {
|
|
13
|
+
head.insertBefore(style, head.firstChild);
|
|
14
|
+
} else {
|
|
15
|
+
head.appendChild(style);
|
|
16
|
+
}
|
|
17
|
+
} else {
|
|
18
|
+
head.appendChild(style);
|
|
19
|
+
}
|
|
20
|
+
if (style.styleSheet) {
|
|
21
|
+
style.styleSheet.cssText = css;
|
|
22
|
+
} else {
|
|
23
|
+
style.appendChild(document.createTextNode(css));
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
// src/styles/viewer.css
|
|
28
|
+
styleInject('/*! tailwindcss v4.2.1 | MIT License | https://tailwindcss.com */\n@layer properties;\n@layer theme, base, components, utilities;\n@layer theme {\n :root,\n :host {\n --font-sans:\n ui-sans-serif,\n system-ui,\n sans-serif,\n "Apple Color Emoji",\n "Segoe UI Emoji",\n "Segoe UI Symbol",\n "Noto Color Emoji";\n --font-mono:\n ui-monospace,\n SFMono-Regular,\n Menlo,\n Monaco,\n Consolas,\n "Liberation Mono",\n "Courier New",\n monospace;\n --color-blue-500: oklch(62.3% 0.214 259.815);\n --color-blue-600: oklch(54.6% 0.245 262.881);\n --color-black: #000;\n --color-white: #fff;\n --spacing: 0.25rem;\n --text-sm: 0.875rem;\n --text-sm--line-height: calc(1.25 / 0.875);\n --text-lg: 1.125rem;\n --text-lg--line-height: calc(1.75 / 1.125);\n --font-weight-medium: 500;\n --font-weight-semibold: 600;\n --ease-out: cubic-bezier(0, 0, 0.2, 1);\n --blur-2xl: 40px;\n --default-transition-duration: 150ms;\n --default-transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);\n --default-font-family: var(--font-sans);\n --default-mono-font-family: var(--font-mono);\n }\n}\n@layer base {\n *,\n ::after,\n ::before,\n ::backdrop,\n ::file-selector-button {\n box-sizing: border-box;\n margin: 0;\n padding: 0;\n border: 0 solid;\n }\n html,\n :host {\n line-height: 1.5;\n -webkit-text-size-adjust: 100%;\n tab-size: 4;\n font-family: var(--default-font-family, ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji");\n font-feature-settings: var(--default-font-feature-settings, normal);\n font-variation-settings: var(--default-font-variation-settings, normal);\n -webkit-tap-highlight-color: transparent;\n }\n hr {\n height: 0;\n color: inherit;\n border-top-width: 1px;\n }\n abbr:where([title]) {\n -webkit-text-decoration: underline dotted;\n text-decoration: underline dotted;\n }\n h1,\n h2,\n h3,\n h4,\n h5,\n h6 {\n font-size: inherit;\n font-weight: inherit;\n }\n a {\n color: inherit;\n -webkit-text-decoration: inherit;\n text-decoration: inherit;\n }\n b,\n strong {\n font-weight: bolder;\n }\n code,\n kbd,\n samp,\n pre {\n font-family: var(--default-mono-font-family, ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace);\n font-feature-settings: var(--default-mono-font-feature-settings, normal);\n font-variation-settings: var(--default-mono-font-variation-settings, normal);\n font-size: 1em;\n }\n small {\n font-size: 80%;\n }\n sub,\n sup {\n font-size: 75%;\n line-height: 0;\n position: relative;\n vertical-align: baseline;\n }\n sub {\n bottom: -0.25em;\n }\n sup {\n top: -0.5em;\n }\n table {\n text-indent: 0;\n border-color: inherit;\n border-collapse: collapse;\n }\n :-moz-focusring {\n outline: auto;\n }\n progress {\n vertical-align: baseline;\n }\n summary {\n display: list-item;\n }\n ol,\n ul,\n menu {\n list-style: none;\n }\n img,\n svg,\n video,\n canvas,\n audio,\n iframe,\n embed,\n object {\n display: block;\n vertical-align: middle;\n }\n img,\n video {\n max-width: 100%;\n height: auto;\n }\n button,\n input,\n select,\n optgroup,\n textarea,\n ::file-selector-button {\n font: inherit;\n font-feature-settings: inherit;\n font-variation-settings: inherit;\n letter-spacing: inherit;\n color: inherit;\n border-radius: 0;\n background-color: transparent;\n opacity: 1;\n }\n :where(select:is([multiple], [size])) optgroup {\n font-weight: bolder;\n }\n :where(select:is([multiple], [size])) optgroup option {\n padding-inline-start: 20px;\n }\n ::file-selector-button {\n margin-inline-end: 4px;\n }\n ::placeholder {\n opacity: 1;\n }\n @supports (not (-webkit-appearance: -apple-pay-button)) or (contain-intrinsic-size: 1px) {\n ::placeholder {\n color: currentcolor;\n @supports (color: color-mix(in lab, red, red)) {\n color: color-mix(in oklab, currentcolor 50%, transparent);\n }\n }\n }\n textarea {\n resize: vertical;\n }\n ::-webkit-search-decoration {\n -webkit-appearance: none;\n }\n ::-webkit-date-and-time-value {\n min-height: 1lh;\n text-align: inherit;\n }\n ::-webkit-datetime-edit {\n display: inline-flex;\n }\n ::-webkit-datetime-edit-fields-wrapper {\n padding: 0;\n }\n ::-webkit-datetime-edit,\n ::-webkit-datetime-edit-year-field,\n ::-webkit-datetime-edit-month-field,\n ::-webkit-datetime-edit-day-field,\n ::-webkit-datetime-edit-hour-field,\n ::-webkit-datetime-edit-minute-field,\n ::-webkit-datetime-edit-second-field,\n ::-webkit-datetime-edit-millisecond-field,\n ::-webkit-datetime-edit-meridiem-field {\n padding-block: 0;\n }\n ::-webkit-calendar-picker-indicator {\n line-height: 1;\n }\n :-moz-ui-invalid {\n box-shadow: none;\n }\n button,\n input:where([type=button], [type=reset], [type=submit]),\n ::file-selector-button {\n appearance: button;\n }\n ::-webkit-inner-spin-button,\n ::-webkit-outer-spin-button {\n height: auto;\n }\n [hidden]:where(:not([hidden=until-found])) {\n display: none !important;\n }\n}\n@layer utilities {\n .pointer-events-auto {\n pointer-events: auto;\n }\n .pointer-events-none {\n pointer-events: none;\n }\n .invisible {\n visibility: hidden;\n }\n .visible {\n visibility: visible;\n }\n .absolute {\n position: absolute;\n }\n .relative {\n position: relative;\n }\n .static {\n position: static;\n }\n .start {\n inset-inline-start: var(--spacing);\n }\n .end {\n inset-inline-end: var(--spacing);\n }\n .top-0 {\n top: calc(var(--spacing) * 0);\n }\n .right-0 {\n right: calc(var(--spacing) * 0);\n }\n .bottom-0 {\n bottom: calc(var(--spacing) * 0);\n }\n .z-50 {\n z-index: 50;\n }\n .z-100 {\n z-index: 100;\n }\n .container {\n width: 100%;\n @media (width >= 40rem) {\n max-width: 40rem;\n }\n @media (width >= 48rem) {\n max-width: 48rem;\n }\n @media (width >= 64rem) {\n max-width: 64rem;\n }\n @media (width >= 80rem) {\n max-width: 80rem;\n }\n @media (width >= 96rem) {\n max-width: 96rem;\n }\n }\n .mt-4 {\n margin-top: calc(var(--spacing) * 4);\n }\n .block {\n display: block;\n }\n .flex {\n display: flex;\n }\n .grid {\n display: grid;\n }\n .size-4 {\n width: calc(var(--spacing) * 4);\n height: calc(var(--spacing) * 4);\n }\n .size-5 {\n width: calc(var(--spacing) * 5);\n height: calc(var(--spacing) * 5);\n }\n .h-full {\n height: 100%;\n }\n .max-h-\\[60px\\] {\n max-height: 60px;\n }\n .w-0 {\n width: calc(var(--spacing) * 0);\n }\n .w-\\[360px\\] {\n width: 360px;\n }\n .w-full {\n width: 100%;\n }\n .max-w-0 {\n max-width: calc(var(--spacing) * 0);\n }\n .max-w-\\[520px\\] {\n max-width: 520px;\n }\n .flex-1 {\n flex: 1;\n }\n .translate-x-0 {\n --tw-translate-x: calc(var(--spacing) * 0);\n translate: var(--tw-translate-x) var(--tw-translate-y);\n }\n .translate-x-6 {\n --tw-translate-x: calc(var(--spacing) * 6);\n translate: var(--tw-translate-x) var(--tw-translate-y);\n }\n .translate-x-full {\n --tw-translate-x: 100%;\n translate: var(--tw-translate-x) var(--tw-translate-y);\n }\n .scale-95 {\n --tw-scale-x: 95%;\n --tw-scale-y: 95%;\n --tw-scale-z: 95%;\n scale: var(--tw-scale-x) var(--tw-scale-y);\n }\n .scale-100 {\n --tw-scale-x: 100%;\n --tw-scale-y: 100%;\n --tw-scale-z: 100%;\n scale: var(--tw-scale-x) var(--tw-scale-y);\n }\n .transform {\n transform: var(--tw-rotate-x,) var(--tw-rotate-y,) var(--tw-rotate-z,) var(--tw-skew-x,) var(--tw-skew-y,);\n }\n .cursor-default {\n cursor: default;\n }\n .cursor-pointer {\n cursor: pointer;\n }\n .resize-none {\n resize: none;\n }\n .flex-col {\n flex-direction: column;\n }\n .flex-row {\n flex-direction: row;\n }\n .flex-row-reverse {\n flex-direction: row-reverse;\n }\n .items-center {\n align-items: center;\n }\n .items-end {\n align-items: flex-end;\n }\n .items-stretch {\n align-items: stretch;\n }\n .justify-between {\n justify-content: space-between;\n }\n .gap-1 {\n gap: calc(var(--spacing) * 1);\n }\n .gap-1\\.5 {\n gap: calc(var(--spacing) * 1.5);\n }\n .gap-2 {\n gap: calc(var(--spacing) * 2);\n }\n .gap-3 {\n gap: calc(var(--spacing) * 3);\n }\n .overflow-hidden {\n overflow: hidden;\n }\n .rounded-full {\n border-radius: calc(infinity * 1px);\n }\n .rounded-md {\n border-radius: calc(var(--radius) - 2px);\n }\n .border {\n border-style: var(--tw-border-style);\n border-width: 1px;\n }\n .border-l {\n border-left-style: var(--tw-border-style);\n border-left-width: 1px;\n }\n .border-black\\/20 {\n border-color: color-mix(in srgb, #000 20%, transparent);\n @supports (color: color-mix(in lab, red, red)) {\n border-color: color-mix(in oklab, var(--color-black) 20%, transparent);\n }\n }\n .border-white\\/10 {\n border-color: color-mix(in srgb, #fff 10%, transparent);\n @supports (color: color-mix(in lab, red, red)) {\n border-color: color-mix(in oklab, var(--color-white) 10%, transparent);\n }\n }\n .border-white\\/20 {\n border-color: color-mix(in srgb, #fff 20%, transparent);\n @supports (color: color-mix(in lab, red, red)) {\n border-color: color-mix(in oklab, var(--color-white) 20%, transparent);\n }\n }\n .border-l-white\\/1 {\n border-left-color: color-mix(in srgb, #fff 1%, transparent);\n @supports (color: color-mix(in lab, red, red)) {\n border-left-color: color-mix(in oklab, var(--color-white) 1%, transparent);\n }\n }\n .bg-\\[rgba\\(15\\,15\\,15\\,0\\.9\\)\\] {\n background-color: rgba(15, 15, 15, 0.9);\n }\n .bg-blue-500 {\n background-color: var(--color-blue-500);\n }\n .bg-transparent {\n background-color: transparent;\n }\n .bg-white\\/10 {\n background-color: color-mix(in srgb, #fff 10%, transparent);\n @supports (color: color-mix(in lab, red, red)) {\n background-color: color-mix(in oklab, var(--color-white) 10%, transparent);\n }\n }\n .bg-linear-to-br {\n --tw-gradient-position: to bottom right;\n @supports (background-image: linear-gradient(in lab, red, red)) {\n --tw-gradient-position: to bottom right in oklab;\n }\n background-image: linear-gradient(var(--tw-gradient-stops));\n }\n .bg-gradient-to-br {\n --tw-gradient-position: to bottom right in oklab;\n background-image: linear-gradient(var(--tw-gradient-stops));\n }\n .from-black\\/20 {\n --tw-gradient-from: color-mix(in srgb, #000 20%, transparent);\n @supports (color: color-mix(in lab, red, red)) {\n --tw-gradient-from: color-mix(in oklab, var(--color-black) 20%, transparent);\n }\n --tw-gradient-stops: var(--tw-gradient-via-stops, var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position));\n }\n .from-white\\/20 {\n --tw-gradient-from: color-mix(in srgb, #fff 20%, transparent);\n @supports (color: color-mix(in lab, red, red)) {\n --tw-gradient-from: color-mix(in oklab, var(--color-white) 20%, transparent);\n }\n --tw-gradient-stops: var(--tw-gradient-via-stops, var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position));\n }\n .to-transparent {\n --tw-gradient-to: transparent;\n --tw-gradient-stops: var(--tw-gradient-via-stops, var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position));\n }\n .to-white\\/5 {\n --tw-gradient-to: color-mix(in srgb, #fff 5%, transparent);\n @supports (color: color-mix(in lab, red, red)) {\n --tw-gradient-to: color-mix(in oklab, var(--color-white) 5%, transparent);\n }\n --tw-gradient-stops: var(--tw-gradient-via-stops, var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position));\n }\n .object-cover {\n object-fit: cover;\n }\n .p-2\\.5 {\n padding: calc(var(--spacing) * 2.5);\n }\n .p-3 {\n padding: calc(var(--spacing) * 3);\n }\n .p-3\\.5 {\n padding: calc(var(--spacing) * 3.5);\n }\n .px-2 {\n padding-inline: calc(var(--spacing) * 2);\n }\n .px-3 {\n padding-inline: calc(var(--spacing) * 3);\n }\n .py-1 {\n padding-block: calc(var(--spacing) * 1);\n }\n .py-1\\.5 {\n padding-block: calc(var(--spacing) * 1.5);\n }\n .py-2 {\n padding-block: calc(var(--spacing) * 2);\n }\n .pr-2 {\n padding-right: calc(var(--spacing) * 2);\n }\n .pr-14 {\n padding-right: calc(var(--spacing) * 14);\n }\n .pb-2\\.5 {\n padding-bottom: calc(var(--spacing) * 2.5);\n }\n .pl-2 {\n padding-left: calc(var(--spacing) * 2);\n }\n .text-lg {\n font-size: var(--text-lg);\n line-height: var(--tw-leading, var(--text-lg--line-height));\n }\n .text-sm {\n font-size: var(--text-sm);\n line-height: var(--tw-leading, var(--text-sm--line-height));\n }\n .font-medium {\n --tw-font-weight: var(--font-weight-medium);\n font-weight: var(--font-weight-medium);\n }\n .font-semibold {\n --tw-font-weight: var(--font-weight-semibold);\n font-weight: var(--font-weight-semibold);\n }\n .text-white {\n color: var(--color-white);\n }\n .text-white\\/60 {\n color: color-mix(in srgb, #fff 60%, transparent);\n @supports (color: color-mix(in lab, red, red)) {\n color: color-mix(in oklab, var(--color-white) 60%, transparent);\n }\n }\n .opacity-0 {\n opacity: 0%;\n }\n .opacity-100 {\n opacity: 100%;\n }\n .shadow-\\[0_8px_32px_rgba\\(0\\,0\\,0\\,0\\.25\\)\\] {\n --tw-shadow: 0 8px 32px var(--tw-shadow-color, rgba(0,0,0,0.25));\n box-shadow:\n var(--tw-inset-shadow),\n var(--tw-inset-ring-shadow),\n var(--tw-ring-offset-shadow),\n var(--tw-ring-shadow),\n var(--tw-shadow);\n }\n .shadow-lg {\n --tw-shadow: 0 10px 15px -3px var(--tw-shadow-color, rgb(0 0 0 / 0.1)), 0 4px 6px -4px var(--tw-shadow-color, rgb(0 0 0 / 0.1));\n box-shadow:\n var(--tw-inset-shadow),\n var(--tw-inset-ring-shadow),\n var(--tw-ring-offset-shadow),\n var(--tw-ring-shadow),\n var(--tw-shadow);\n }\n .shadow-none {\n --tw-shadow: 0 0 #0000;\n box-shadow:\n var(--tw-inset-shadow),\n var(--tw-inset-ring-shadow),\n var(--tw-ring-offset-shadow),\n var(--tw-ring-shadow),\n var(--tw-shadow);\n }\n .shadow-white\\/10 {\n --tw-shadow-color: color-mix(in srgb, #fff 10%, transparent);\n @supports (color: color-mix(in lab, red, red)) {\n --tw-shadow-color: color-mix(in oklab, color-mix(in oklab, var(--color-white) 10%, transparent) var(--tw-shadow-alpha), transparent);\n }\n }\n .blur {\n --tw-blur: blur(8px);\n filter: var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,);\n }\n .filter {\n filter: var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,);\n }\n .backdrop-blur-2xl {\n --tw-backdrop-blur: blur(var(--blur-2xl));\n -webkit-backdrop-filter: var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,);\n backdrop-filter: var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,);\n }\n .transition-all {\n transition-property: all;\n transition-timing-function: var(--tw-ease, var(--default-transition-timing-function));\n transition-duration: var(--tw-duration, var(--default-transition-duration));\n }\n .transition-opacity {\n transition-property: opacity;\n transition-timing-function: var(--tw-ease, var(--default-transition-timing-function));\n transition-duration: var(--tw-duration, var(--default-transition-duration));\n }\n .delay-200 {\n transition-delay: 200ms;\n }\n .duration-200 {\n --tw-duration: 200ms;\n transition-duration: 200ms;\n }\n .duration-300 {\n --tw-duration: 300ms;\n transition-duration: 300ms;\n }\n .ease-out {\n --tw-ease: var(--ease-out);\n transition-timing-function: var(--ease-out);\n }\n .delay-200 {\n animation-delay: calc(200*1ms);\n animation-delay: .2s;\n --tw-animation-delay: calc(200*1ms);\n --tw-animation-delay: .2s;\n }\n .outline-none {\n --tw-outline-style: none;\n outline-style: none;\n }\n .running {\n animation-play-state: running;\n }\n .hover\\:border-black\\/10 {\n &:hover {\n @media (hover: hover) {\n border-color: color-mix(in srgb, #000 10%, transparent);\n @supports (color: color-mix(in lab, red, red)) {\n border-color: color-mix(in oklab, var(--color-black) 10%, transparent);\n }\n }\n }\n }\n .hover\\:bg-blue-600 {\n &:hover {\n @media (hover: hover) {\n background-color: var(--color-blue-600);\n }\n }\n }\n .hover\\:bg-white\\/10 {\n &:hover {\n @media (hover: hover) {\n background-color: color-mix(in srgb, #fff 10%, transparent);\n @supports (color: color-mix(in lab, red, red)) {\n background-color: color-mix(in oklab, var(--color-white) 10%, transparent);\n }\n }\n }\n }\n .hover\\:bg-white\\/20 {\n &:hover {\n @media (hover: hover) {\n background-color: color-mix(in srgb, #fff 20%, transparent);\n @supports (color: color-mix(in lab, red, red)) {\n background-color: color-mix(in oklab, var(--color-white) 20%, transparent);\n }\n }\n }\n }\n .hover\\:from-black\\/20 {\n &:hover {\n @media (hover: hover) {\n --tw-gradient-from: color-mix(in srgb, #000 20%, transparent);\n @supports (color: color-mix(in lab, red, red)) {\n --tw-gradient-from: color-mix(in oklab, var(--color-black) 20%, transparent);\n }\n --tw-gradient-stops: var(--tw-gradient-via-stops, var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position));\n }\n }\n }\n .hover\\:to-transparent {\n &:hover {\n @media (hover: hover) {\n --tw-gradient-to: transparent;\n --tw-gradient-stops: var(--tw-gradient-via-stops, var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position));\n }\n }\n }\n .disabled\\:opacity-50 {\n &:disabled {\n opacity: 50%;\n }\n }\n .dark\\:border-white\\/20 {\n &:is(.dark *) {\n border-color: color-mix(in srgb, #fff 20%, transparent);\n @supports (color: color-mix(in lab, red, red)) {\n border-color: color-mix(in oklab, var(--color-white) 20%, transparent);\n }\n }\n }\n .dark\\:from-white\\/10 {\n &:is(.dark *) {\n --tw-gradient-from: color-mix(in srgb, #fff 10%, transparent);\n @supports (color: color-mix(in lab, red, red)) {\n --tw-gradient-from: color-mix(in oklab, var(--color-white) 10%, transparent);\n }\n --tw-gradient-stops: var(--tw-gradient-via-stops, var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position));\n }\n }\n .dark\\:to-transparent {\n &:is(.dark *) {\n --tw-gradient-to: transparent;\n --tw-gradient-stops: var(--tw-gradient-via-stops, var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position));\n }\n }\n .dark\\:to-white\\/5 {\n &:is(.dark *) {\n --tw-gradient-to: color-mix(in srgb, #fff 5%, transparent);\n @supports (color: color-mix(in lab, red, red)) {\n --tw-gradient-to: color-mix(in oklab, var(--color-white) 5%, transparent);\n }\n --tw-gradient-stops: var(--tw-gradient-via-stops, var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position));\n }\n }\n}\n@property --tw-animation-delay { syntax: "*"; inherits: false; initial-value: 0s; }\n@property --tw-animation-direction { syntax: "*"; inherits: false; initial-value: normal; }\n@property --tw-animation-duration { syntax: "*"; inherits: false; }\n@property --tw-animation-fill-mode { syntax: "*"; inherits: false; initial-value: none; }\n@property --tw-animation-iteration-count { syntax: "*"; inherits: false; initial-value: 1; }\n@property --tw-enter-blur { syntax: "*"; inherits: false; initial-value: 0; }\n@property --tw-enter-opacity { syntax: "*"; inherits: false; initial-value: 1; }\n@property --tw-enter-rotate { syntax: "*"; inherits: false; initial-value: 0; }\n@property --tw-enter-scale { syntax: "*"; inherits: false; initial-value: 1; }\n@property --tw-enter-translate-x { syntax: "*"; inherits: false; initial-value: 0; }\n@property --tw-enter-translate-y { syntax: "*"; inherits: false; initial-value: 0; }\n@property --tw-exit-blur { syntax: "*"; inherits: false; initial-value: 0; }\n@property --tw-exit-opacity { syntax: "*"; inherits: false; initial-value: 1; }\n@property --tw-exit-rotate { syntax: "*"; inherits: false; initial-value: 0; }\n@property --tw-exit-scale { syntax: "*"; inherits: false; initial-value: 1; }\n@property --tw-exit-translate-x { syntax: "*"; inherits: false; initial-value: 0; }\n@property --tw-exit-translate-y { syntax: "*"; inherits: false; initial-value: 0; }\n:root {\n --radius: 0.625rem;\n --background: oklch(1 0 0);\n --foreground: oklch(0.145 0 0);\n --card: oklch(1 0 0);\n --card-foreground: oklch(0.145 0 0);\n --popover: oklch(1 0 0);\n --popover-foreground: oklch(0.145 0 0);\n --primary: oklch(0.205 0 0);\n --primary-foreground: oklch(0.985 0 0);\n --secondary: oklch(0.97 0 0);\n --secondary-foreground: oklch(0.205 0 0);\n --muted: oklch(0.97 0 0);\n --muted-foreground: oklch(0.556 0 0);\n --accent: oklch(0.97 0 0);\n --accent-foreground: oklch(0.205 0 0);\n --destructive: oklch(0.577 0.245 27.325);\n --border: oklch(0.922 0 0);\n --input: oklch(0.922 0 0);\n --ring: oklch(0.708 0 0);\n --chart-1: oklch(0.646 0.222 41.116);\n --chart-2: oklch(0.6 0.118 184.704);\n --chart-3: oklch(0.398 0.07 227.392);\n --chart-4: oklch(0.828 0.189 84.429);\n --chart-5: oklch(0.769 0.188 70.08);\n --sidebar: oklch(0.985 0 0);\n --sidebar-foreground: oklch(0.145 0 0);\n --sidebar-primary: oklch(0.205 0 0);\n --sidebar-primary-foreground: oklch(0.985 0 0);\n --sidebar-accent: oklch(0.97 0 0);\n --sidebar-accent-foreground: oklch(0.205 0 0);\n --sidebar-border: oklch(0.922 0 0);\n --sidebar-ring: oklch(0.708 0 0);\n}\n.dark {\n --background: oklch(0.145 0 0);\n --foreground: oklch(0.985 0 0);\n --card: oklch(0.205 0 0);\n --card-foreground: oklch(0.985 0 0);\n --popover: oklch(0.205 0 0);\n --popover-foreground: oklch(0.985 0 0);\n --primary: oklch(0.922 0 0);\n --primary-foreground: oklch(0.205 0 0);\n --secondary: oklch(0.269 0 0);\n --secondary-foreground: oklch(0.985 0 0);\n --muted: oklch(0.269 0 0);\n --muted-foreground: oklch(0.708 0 0);\n --accent: oklch(0.269 0 0);\n --accent-foreground: oklch(0.985 0 0);\n --destructive: oklch(0.704 0.191 22.216);\n --border: oklch(1 0 0 / 10%);\n --input: oklch(1 0 0 / 15%);\n --ring: oklch(0.556 0 0);\n --chart-1: oklch(0.488 0.243 264.376);\n --chart-2: oklch(0.696 0.17 162.48);\n --chart-3: oklch(0.769 0.188 70.08);\n --chart-4: oklch(0.627 0.265 303.9);\n --chart-5: oklch(0.645 0.246 16.439);\n --sidebar: oklch(0.205 0 0);\n --sidebar-foreground: oklch(0.985 0 0);\n --sidebar-primary: oklch(0.488 0.243 264.376);\n --sidebar-primary-foreground: oklch(0.985 0 0);\n --sidebar-accent: oklch(0.269 0 0);\n --sidebar-accent-foreground: oklch(0.985 0 0);\n --sidebar-border: oklch(1 0 0 / 10%);\n --sidebar-ring: oklch(0.556 0 0);\n}\n@layer base {\n * {\n border-color: var(--border);\n outline-color: var(--ring);\n @supports (color: color-mix(in lab, red, red)) {\n outline-color: color-mix(in oklab, var(--ring) 50%, transparent);\n }\n }\n body {\n background-color: var(--background);\n color: var(--foreground);\n }\n}\n@property --tw-translate-x { syntax: "*"; inherits: false; initial-value: 0; }\n@property --tw-translate-y { syntax: "*"; inherits: false; initial-value: 0; }\n@property --tw-translate-z { syntax: "*"; inherits: false; initial-value: 0; }\n@property --tw-scale-x { syntax: "*"; inherits: false; initial-value: 1; }\n@property --tw-scale-y { syntax: "*"; inherits: false; initial-value: 1; }\n@property --tw-scale-z { syntax: "*"; inherits: false; initial-value: 1; }\n@property --tw-rotate-x { syntax: "*"; inherits: false; }\n@property --tw-rotate-y { syntax: "*"; inherits: false; }\n@property --tw-rotate-z { syntax: "*"; inherits: false; }\n@property --tw-skew-x { syntax: "*"; inherits: false; }\n@property --tw-skew-y { syntax: "*"; inherits: false; }\n@property --tw-border-style { syntax: "*"; inherits: false; initial-value: solid; }\n@property --tw-gradient-position { syntax: "*"; inherits: false; }\n@property --tw-gradient-from { syntax: "<color>"; inherits: false; initial-value: #0000; }\n@property --tw-gradient-via { syntax: "<color>"; inherits: false; initial-value: #0000; }\n@property --tw-gradient-to { syntax: "<color>"; inherits: false; initial-value: #0000; }\n@property --tw-gradient-stops { syntax: "*"; inherits: false; }\n@property --tw-gradient-via-stops { syntax: "*"; inherits: false; }\n@property --tw-gradient-from-position { syntax: "<length-percentage>"; inherits: false; initial-value: 0%; }\n@property --tw-gradient-via-position { syntax: "<length-percentage>"; inherits: false; initial-value: 50%; }\n@property --tw-gradient-to-position { syntax: "<length-percentage>"; inherits: false; initial-value: 100%; }\n@property --tw-font-weight { syntax: "*"; inherits: false; }\n@property --tw-shadow { syntax: "*"; inherits: false; initial-value: 0 0 #0000; }\n@property --tw-shadow-color { syntax: "*"; inherits: false; }\n@property --tw-shadow-alpha { syntax: "<percentage>"; inherits: false; initial-value: 100%; }\n@property --tw-inset-shadow { syntax: "*"; inherits: false; initial-value: 0 0 #0000; }\n@property --tw-inset-shadow-color { syntax: "*"; inherits: false; }\n@property --tw-inset-shadow-alpha { syntax: "<percentage>"; inherits: false; initial-value: 100%; }\n@property --tw-ring-color { syntax: "*"; inherits: false; }\n@property --tw-ring-shadow { syntax: "*"; inherits: false; initial-value: 0 0 #0000; }\n@property --tw-inset-ring-color { syntax: "*"; inherits: false; }\n@property --tw-inset-ring-shadow { syntax: "*"; inherits: false; initial-value: 0 0 #0000; }\n@property --tw-ring-inset { syntax: "*"; inherits: false; }\n@property --tw-ring-offset-width { syntax: "<length>"; inherits: false; initial-value: 0px; }\n@property --tw-ring-offset-color { syntax: "*"; inherits: false; initial-value: #fff; }\n@property --tw-ring-offset-shadow { syntax: "*"; inherits: false; initial-value: 0 0 #0000; }\n@property --tw-blur { syntax: "*"; inherits: false; }\n@property --tw-brightness { syntax: "*"; inherits: false; }\n@property --tw-contrast { syntax: "*"; inherits: false; }\n@property --tw-grayscale { syntax: "*"; inherits: false; }\n@property --tw-hue-rotate { syntax: "*"; inherits: false; }\n@property --tw-invert { syntax: "*"; inherits: false; }\n@property --tw-opacity { syntax: "*"; inherits: false; }\n@property --tw-saturate { syntax: "*"; inherits: false; }\n@property --tw-sepia { syntax: "*"; inherits: false; }\n@property --tw-drop-shadow { syntax: "*"; inherits: false; }\n@property --tw-drop-shadow-color { syntax: "*"; inherits: false; }\n@property --tw-drop-shadow-alpha { syntax: "<percentage>"; inherits: false; initial-value: 100%; }\n@property --tw-drop-shadow-size { syntax: "*"; inherits: false; }\n@property --tw-backdrop-blur { syntax: "*"; inherits: false; }\n@property --tw-backdrop-brightness { syntax: "*"; inherits: false; }\n@property --tw-backdrop-contrast { syntax: "*"; inherits: false; }\n@property --tw-backdrop-grayscale { syntax: "*"; inherits: false; }\n@property --tw-backdrop-hue-rotate { syntax: "*"; inherits: false; }\n@property --tw-backdrop-invert { syntax: "*"; inherits: false; }\n@property --tw-backdrop-opacity { syntax: "*"; inherits: false; }\n@property --tw-backdrop-saturate { syntax: "*"; inherits: false; }\n@property --tw-backdrop-sepia { syntax: "*"; inherits: false; }\n@property --tw-duration { syntax: "*"; inherits: false; }\n@property --tw-ease { syntax: "*"; inherits: false; }\n@layer properties {\n @supports ((-webkit-hyphens: none) and (not (margin-trim: inline))) or ((-moz-orient: inline) and (not (color:rgb(from red r g b)))) {\n *,\n ::before,\n ::after,\n ::backdrop {\n --tw-translate-x: 0;\n --tw-translate-y: 0;\n --tw-translate-z: 0;\n --tw-scale-x: 1;\n --tw-scale-y: 1;\n --tw-scale-z: 1;\n --tw-rotate-x: initial;\n --tw-rotate-y: initial;\n --tw-rotate-z: initial;\n --tw-skew-x: initial;\n --tw-skew-y: initial;\n --tw-border-style: solid;\n --tw-gradient-position: initial;\n --tw-gradient-from: #0000;\n --tw-gradient-via: #0000;\n --tw-gradient-to: #0000;\n --tw-gradient-stops: initial;\n --tw-gradient-via-stops: initial;\n --tw-gradient-from-position: 0%;\n --tw-gradient-via-position: 50%;\n --tw-gradient-to-position: 100%;\n --tw-font-weight: initial;\n --tw-shadow: 0 0 #0000;\n --tw-shadow-color: initial;\n --tw-shadow-alpha: 100%;\n --tw-inset-shadow: 0 0 #0000;\n --tw-inset-shadow-color: initial;\n --tw-inset-shadow-alpha: 100%;\n --tw-ring-color: initial;\n --tw-ring-shadow: 0 0 #0000;\n --tw-inset-ring-color: initial;\n --tw-inset-ring-shadow: 0 0 #0000;\n --tw-ring-inset: initial;\n --tw-ring-offset-width: 0px;\n --tw-ring-offset-color: #fff;\n --tw-ring-offset-shadow: 0 0 #0000;\n --tw-blur: initial;\n --tw-brightness: initial;\n --tw-contrast: initial;\n --tw-grayscale: initial;\n --tw-hue-rotate: initial;\n --tw-invert: initial;\n --tw-opacity: initial;\n --tw-saturate: initial;\n --tw-sepia: initial;\n --tw-drop-shadow: initial;\n --tw-drop-shadow-color: initial;\n --tw-drop-shadow-alpha: 100%;\n --tw-drop-shadow-size: initial;\n --tw-backdrop-blur: initial;\n --tw-backdrop-brightness: initial;\n --tw-backdrop-contrast: initial;\n --tw-backdrop-grayscale: initial;\n --tw-backdrop-hue-rotate: initial;\n --tw-backdrop-invert: initial;\n --tw-backdrop-opacity: initial;\n --tw-backdrop-saturate: initial;\n --tw-backdrop-sepia: initial;\n --tw-duration: initial;\n --tw-ease: initial;\n --tw-animation-delay: 0s;\n --tw-animation-direction: normal;\n --tw-animation-duration: initial;\n --tw-animation-fill-mode: none;\n --tw-animation-iteration-count: 1;\n --tw-enter-blur: 0;\n --tw-enter-opacity: 1;\n --tw-enter-rotate: 0;\n --tw-enter-scale: 1;\n --tw-enter-translate-x: 0;\n --tw-enter-translate-y: 0;\n --tw-exit-blur: 0;\n --tw-exit-opacity: 1;\n --tw-exit-rotate: 0;\n --tw-exit-scale: 1;\n --tw-exit-translate-x: 0;\n --tw-exit-translate-y: 0;\n }\n }\n}\n');
|
|
4
29
|
|
|
5
30
|
// src/react/PGSGCanvas.tsx
|
|
6
|
-
import * as
|
|
31
|
+
import * as React5 from "react";
|
|
32
|
+
|
|
33
|
+
// src/react/PGSGViewControls.tsx
|
|
34
|
+
import * as React4 from "react";
|
|
35
|
+
|
|
36
|
+
// src/lib/utils.ts
|
|
37
|
+
import { clsx } from "clsx";
|
|
38
|
+
import { twMerge } from "tailwind-merge";
|
|
39
|
+
var glass = "bg-gradient-to-br from-white/20 to-white/5 dark:from-white/10 dark:to-transparent backdrop-blur-2xl border border-white/20 shadow-[0_8px_32px_rgba(0,0,0,0.25)]";
|
|
40
|
+
function cn(...inputs) {
|
|
41
|
+
return twMerge(clsx(inputs));
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
// src/react/controls/PGSGViewer3D.tsx
|
|
7
45
|
import { jsx } from "react/jsx-runtime";
|
|
46
|
+
function PGSGViewer3D({
|
|
47
|
+
open,
|
|
48
|
+
setOpen
|
|
49
|
+
}) {
|
|
50
|
+
return /* @__PURE__ */ jsx("div", { className: "relative flex items-center flex-row-reverse overflow-hidden pointer-events-auto", children: /* @__PURE__ */ jsx(
|
|
51
|
+
"button",
|
|
52
|
+
{
|
|
53
|
+
onClick: () => setOpen(!open),
|
|
54
|
+
className: cn(
|
|
55
|
+
glass,
|
|
56
|
+
"p-3 rounded-full pointer-events-auto z-100 shadow-lg shadow-white/10 cursor-pointer",
|
|
57
|
+
open && "from-black/20 to-transparent border-black/20 dark:from-white/10 dark:to-white/5 dark:border-white/20"
|
|
58
|
+
),
|
|
59
|
+
children: /* @__PURE__ */ jsx("span", { className: "text-white font-semibold", children: "3D" })
|
|
60
|
+
}
|
|
61
|
+
) });
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
// src/react/controls/PGSGViewerMode.tsx
|
|
65
|
+
import * as React from "react";
|
|
66
|
+
import {
|
|
67
|
+
Rotate3D,
|
|
68
|
+
RulerDimensionLine,
|
|
69
|
+
Footprints,
|
|
70
|
+
Icon,
|
|
71
|
+
ChevronLeft,
|
|
72
|
+
X
|
|
73
|
+
} from "lucide-react";
|
|
74
|
+
import { floorPlan } from "@lucide/lab";
|
|
75
|
+
import { jsx as jsx2, jsxs } from "react/jsx-runtime";
|
|
76
|
+
function PGSGViewerMode({ viewer }) {
|
|
77
|
+
const [mode, setMode] = React.useState("orbit");
|
|
78
|
+
const [open, setOpen] = React.useState(false);
|
|
79
|
+
const choose = (m) => {
|
|
80
|
+
if (!viewer) return null;
|
|
81
|
+
viewer.setCameraMode(m);
|
|
82
|
+
setMode(m);
|
|
83
|
+
setOpen(false);
|
|
84
|
+
};
|
|
85
|
+
React.useEffect(() => {
|
|
86
|
+
if (!open) return;
|
|
87
|
+
const onDown = (e) => {
|
|
88
|
+
const t = e.target;
|
|
89
|
+
if (!t?.closest("[data-pgsg-controls]")) setOpen(false);
|
|
90
|
+
};
|
|
91
|
+
window.addEventListener("pointerdown", onDown, { capture: true });
|
|
92
|
+
return () => window.removeEventListener("pointerdown", onDown, {
|
|
93
|
+
capture: true
|
|
94
|
+
});
|
|
95
|
+
}, [open]);
|
|
96
|
+
let icon = null;
|
|
97
|
+
switch (mode) {
|
|
98
|
+
case "walk":
|
|
99
|
+
icon = /* @__PURE__ */ jsx2(Footprints, { className: "size-5 text-white" });
|
|
100
|
+
break;
|
|
101
|
+
case "orbit":
|
|
102
|
+
icon = /* @__PURE__ */ jsx2(Rotate3D, { className: "size-5 text-white" });
|
|
103
|
+
break;
|
|
104
|
+
case "floorplan":
|
|
105
|
+
icon = /* @__PURE__ */ jsx2(Icon, { iconNode: floorPlan, className: "size-5 text-white" });
|
|
106
|
+
break;
|
|
107
|
+
case "measure":
|
|
108
|
+
icon = /* @__PURE__ */ jsx2(RulerDimensionLine, { className: "size-5 text-white" });
|
|
109
|
+
break;
|
|
110
|
+
default:
|
|
111
|
+
icon = /* @__PURE__ */ jsx2(Rotate3D, { className: "size-5 text-white" });
|
|
112
|
+
break;
|
|
113
|
+
}
|
|
114
|
+
return /* @__PURE__ */ jsxs(
|
|
115
|
+
"div",
|
|
116
|
+
{
|
|
117
|
+
"data-pgsg-controls": true,
|
|
118
|
+
className: "relative flex items-center flex-row-reverse overflow-hidden pointer-events-auto",
|
|
119
|
+
children: [
|
|
120
|
+
/* @__PURE__ */ jsx2(
|
|
121
|
+
"div",
|
|
122
|
+
{
|
|
123
|
+
className: cn(
|
|
124
|
+
glass,
|
|
125
|
+
"p-3 rounded-full pointer-events-auto z-100 shadow-lg shadow-white/10"
|
|
126
|
+
),
|
|
127
|
+
children: icon
|
|
128
|
+
}
|
|
129
|
+
),
|
|
130
|
+
/* @__PURE__ */ jsxs(
|
|
131
|
+
"div",
|
|
132
|
+
{
|
|
133
|
+
className: cn(
|
|
134
|
+
"flex items-center pointer-events-auto h-full overflow-hidden"
|
|
135
|
+
),
|
|
136
|
+
children: [
|
|
137
|
+
/* @__PURE__ */ jsx2(
|
|
138
|
+
"div",
|
|
139
|
+
{
|
|
140
|
+
className: cn(
|
|
141
|
+
"flex items-center h-full transition-all duration-300 ease-out",
|
|
142
|
+
open ? "opacity-100 translate-x-full scale-95 pointer-events-none" : "opacity-100 translate-x-0 scale-100"
|
|
143
|
+
),
|
|
144
|
+
children: /* @__PURE__ */ jsx2(
|
|
145
|
+
"button",
|
|
146
|
+
{
|
|
147
|
+
onClick: () => setOpen(!open),
|
|
148
|
+
className: "p-2.5 rounded-full pointer-events-auto",
|
|
149
|
+
children: /* @__PURE__ */ jsx2(ChevronLeft, { className: "size-5 text-white" })
|
|
150
|
+
}
|
|
151
|
+
)
|
|
152
|
+
}
|
|
153
|
+
),
|
|
154
|
+
/* @__PURE__ */ jsxs(
|
|
155
|
+
"div",
|
|
156
|
+
{
|
|
157
|
+
className: cn(
|
|
158
|
+
glass,
|
|
159
|
+
"flex flex-row-reverse items-center gap-1.5 absolute bottom-0 right-0 h-full rounded-full pointer-events-auto transition-all duration-300 ease-out overflow-hidden pr-14 pl-2 shadow-none",
|
|
160
|
+
open ? "opacity-100 translate-x-0 scale-100 max-w-[520px]" : "opacity-0 translate-x-6 scale-95 pointer-events-none max-w-0"
|
|
161
|
+
),
|
|
162
|
+
children: [
|
|
163
|
+
/* @__PURE__ */ jsx2(
|
|
164
|
+
"button",
|
|
165
|
+
{
|
|
166
|
+
onClick: () => choose("walk"),
|
|
167
|
+
className: cn(
|
|
168
|
+
"p-2.5 rounded-full pointer-events-auto transition-all duration-300 ease-out",
|
|
169
|
+
mode === "walk" ? "bg-white/10 cursor-default" : "hover:bg-white/10 cursor-pointer"
|
|
170
|
+
),
|
|
171
|
+
children: /* @__PURE__ */ jsx2(Footprints, { className: "size-4 text-white" })
|
|
172
|
+
}
|
|
173
|
+
),
|
|
174
|
+
/* @__PURE__ */ jsx2(
|
|
175
|
+
"button",
|
|
176
|
+
{
|
|
177
|
+
onClick: () => choose("orbit"),
|
|
178
|
+
className: cn(
|
|
179
|
+
"p-2.5 rounded-full pointer-events-auto transition-all duration-300 ease-out",
|
|
180
|
+
mode === "orbit" ? "bg-white/10 cursor-default" : "hover:bg-white/10 cursor-pointer"
|
|
181
|
+
),
|
|
182
|
+
children: /* @__PURE__ */ jsx2(Rotate3D, { className: "size-4 text-white" })
|
|
183
|
+
}
|
|
184
|
+
),
|
|
185
|
+
/* @__PURE__ */ jsx2(
|
|
186
|
+
"button",
|
|
187
|
+
{
|
|
188
|
+
onClick: () => choose("floorplan"),
|
|
189
|
+
className: cn(
|
|
190
|
+
"p-2.5 rounded-full pointer-events-auto transition-all duration-300 ease-out",
|
|
191
|
+
mode === "floorplan" ? "bg-white/10 cursor-default" : "hover:bg-white/10 cursor-pointer"
|
|
192
|
+
),
|
|
193
|
+
children: /* @__PURE__ */ jsx2(Icon, { iconNode: floorPlan, className: "size-4 text-white" })
|
|
194
|
+
}
|
|
195
|
+
),
|
|
196
|
+
/* @__PURE__ */ jsx2(
|
|
197
|
+
"button",
|
|
198
|
+
{
|
|
199
|
+
onClick: () => setMode("measure"),
|
|
200
|
+
className: cn(
|
|
201
|
+
"p-2.5 rounded-full pointer-events-auto transition-all duration-300 ease-out",
|
|
202
|
+
mode === "measure" ? "bg-white/10 cursor-default" : "hover:bg-white/10 cursor-pointer"
|
|
203
|
+
),
|
|
204
|
+
children: /* @__PURE__ */ jsx2(RulerDimensionLine, { className: "size-4 text-white" })
|
|
205
|
+
}
|
|
206
|
+
),
|
|
207
|
+
/* @__PURE__ */ jsx2(
|
|
208
|
+
"button",
|
|
209
|
+
{
|
|
210
|
+
onClick: () => setOpen(false),
|
|
211
|
+
className: cn(
|
|
212
|
+
"p-2.5 rounded-full pointer-events-auto delay-200 transition-opacity duration-200 ease-out cursor-pointer",
|
|
213
|
+
open ? "opacity-100" : "opacity-0 pointer-events-none"
|
|
214
|
+
),
|
|
215
|
+
children: /* @__PURE__ */ jsx2(X, { className: "size-4 text-white/60" })
|
|
216
|
+
}
|
|
217
|
+
)
|
|
218
|
+
]
|
|
219
|
+
}
|
|
220
|
+
)
|
|
221
|
+
]
|
|
222
|
+
}
|
|
223
|
+
)
|
|
224
|
+
]
|
|
225
|
+
}
|
|
226
|
+
);
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
// src/react/controls/PGSGViewerSettings.tsx
|
|
230
|
+
import * as React2 from "react";
|
|
231
|
+
import { Settings } from "lucide-react";
|
|
232
|
+
import { jsx as jsx3 } from "react/jsx-runtime";
|
|
233
|
+
function PGSGViewerSettings({
|
|
234
|
+
viewer,
|
|
235
|
+
className
|
|
236
|
+
}) {
|
|
237
|
+
const [open, setOpen] = React2.useState(false);
|
|
238
|
+
const [grid, setGrid] = React2.useState(false);
|
|
239
|
+
if (!viewer) return null;
|
|
240
|
+
return /* @__PURE__ */ jsx3(
|
|
241
|
+
"button",
|
|
242
|
+
{
|
|
243
|
+
onClick: () => setOpen(!open),
|
|
244
|
+
className: cn(glass, "p-2.5 rounded-full pointer-events-auto"),
|
|
245
|
+
children: /* @__PURE__ */ jsx3(Settings, { className: "size-4 text-white" })
|
|
246
|
+
}
|
|
247
|
+
);
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
// src/react/controls/PGSGViewer3DSheet.tsx
|
|
251
|
+
import * as React3 from "react";
|
|
252
|
+
import { Sparkles, X as X2 } from "lucide-react";
|
|
253
|
+
import { Fragment, jsx as jsx4, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
254
|
+
function PGSGViewer3DSheet({
|
|
255
|
+
open,
|
|
256
|
+
setOpen,
|
|
257
|
+
viewer
|
|
258
|
+
}) {
|
|
259
|
+
const [text, setText] = React3.useState("");
|
|
260
|
+
const [loading, setLoading] = React3.useState(false);
|
|
261
|
+
const [modelUrl, setModelUrl] = React3.useState(null);
|
|
262
|
+
const [previewImage, setPreviewImage] = React3.useState(null);
|
|
263
|
+
const handleTextChange = (e) => {
|
|
264
|
+
setText(e.target.value);
|
|
265
|
+
};
|
|
266
|
+
const handleGenerateModel = async () => {
|
|
267
|
+
if (!viewer) return;
|
|
268
|
+
const prompt = text.trim();
|
|
269
|
+
if (!prompt) return;
|
|
270
|
+
setLoading(true);
|
|
271
|
+
try {
|
|
272
|
+
const res = await fetch(`http://localhost:9999/v1/mesh/text-to-3d`, {
|
|
273
|
+
method: "POST",
|
|
274
|
+
headers: { "Content-Type": "application/json" },
|
|
275
|
+
body: JSON.stringify({ prompt })
|
|
276
|
+
});
|
|
277
|
+
if (!res.ok) {
|
|
278
|
+
throw new Error("Failed to generate model");
|
|
279
|
+
}
|
|
280
|
+
const data = await res.json();
|
|
281
|
+
const modelUrl2 = `http://localhost:9999/v1/mesh/text-to-3d/${data.id}/model`;
|
|
282
|
+
const previewUrl = `http://localhost:9999/v1/mesh/text-to-3d/${data.id}/generated`;
|
|
283
|
+
setModelUrl(modelUrl2);
|
|
284
|
+
setPreviewImage(previewUrl);
|
|
285
|
+
} catch (error) {
|
|
286
|
+
console.error(error);
|
|
287
|
+
} finally {
|
|
288
|
+
setLoading(false);
|
|
289
|
+
}
|
|
290
|
+
};
|
|
291
|
+
const handlePlaceModel = () => {
|
|
292
|
+
if (!viewer || !modelUrl) return;
|
|
293
|
+
viewer.enablePlacementMode(modelUrl);
|
|
294
|
+
setOpen(false);
|
|
295
|
+
};
|
|
296
|
+
return /* @__PURE__ */ jsx4(Fragment, { children: /* @__PURE__ */ jsxs2("div", { className: "h-full w-[360px] bg-[rgba(15,15,15,0.9)] border-l border-l-white/1 backdrop-blur-(10px) p-3.5 text-white/60 z-100", children: [
|
|
297
|
+
/* @__PURE__ */ jsxs2("div", { className: "flex items-center justify-between pb-2.5", children: [
|
|
298
|
+
/* @__PURE__ */ jsx4("h4", { className: "text-lg font-semibold", children: "Text to 3D Model" }),
|
|
299
|
+
/* @__PURE__ */ jsx4(
|
|
300
|
+
"button",
|
|
301
|
+
{
|
|
302
|
+
type: "button",
|
|
303
|
+
onClick: () => setOpen(false),
|
|
304
|
+
className: "p-2.5 rounded-full pointer-events-auto",
|
|
305
|
+
children: /* @__PURE__ */ jsx4(X2, { className: "size-4" })
|
|
306
|
+
}
|
|
307
|
+
)
|
|
308
|
+
] }),
|
|
309
|
+
/* @__PURE__ */ jsxs2("div", { className: "flex items-center px-2 py-1.5 max-h-[60px] rounded-md bg-white/10 text-sm", children: [
|
|
310
|
+
/* @__PURE__ */ jsx4("div", { className: "flex flex-1 h-full items-center relative", children: /* @__PURE__ */ jsx4(
|
|
311
|
+
"textarea",
|
|
312
|
+
{
|
|
313
|
+
rows: 1,
|
|
314
|
+
value: text,
|
|
315
|
+
onChange: handleTextChange,
|
|
316
|
+
placeholder: "Describe your 3D model",
|
|
317
|
+
className: "w-full resize-none outline-none bg-transparent text-white/60"
|
|
318
|
+
}
|
|
319
|
+
) }),
|
|
320
|
+
/* @__PURE__ */ jsxs2(
|
|
321
|
+
"button",
|
|
322
|
+
{
|
|
323
|
+
type: "button",
|
|
324
|
+
onClick: handleGenerateModel,
|
|
325
|
+
className: cn(
|
|
326
|
+
"bg-linear-to-br from-white/20 to-white/5 border border-white/20 px-2 py-1 rounded-full pointer-events-none transition-all duration-300 ease-out flex items-center gap-1 disabled:opacity-50",
|
|
327
|
+
text.trim() && !loading && "pointer-events-auto hover:from-black/20 hover:to-transparent hover:border-black/10 cursor-pointer"
|
|
328
|
+
),
|
|
329
|
+
disabled: !text.trim() || loading,
|
|
330
|
+
children: [
|
|
331
|
+
/* @__PURE__ */ jsx4(Sparkles, { className: "size-4 text-white" }),
|
|
332
|
+
/* @__PURE__ */ jsx4("span", { className: "text-white text-sm font-medium", children: loading ? "Generating..." : "Generate" })
|
|
333
|
+
]
|
|
334
|
+
}
|
|
335
|
+
)
|
|
336
|
+
] }),
|
|
337
|
+
modelUrl && /* @__PURE__ */ jsxs2("div", { className: "mt-4 flex flex-col gap-3", children: [
|
|
338
|
+
previewImage && /* @__PURE__ */ jsx4("div", { className: "rounded-md overflow-hidden border border-white/10", children: /* @__PURE__ */ jsx4("img", { src: previewImage, className: "w-full object-cover" }) }),
|
|
339
|
+
/* @__PURE__ */ jsxs2("div", { className: "flex gap-2", children: [
|
|
340
|
+
/* @__PURE__ */ jsx4(
|
|
341
|
+
"button",
|
|
342
|
+
{
|
|
343
|
+
onClick: handleGenerateModel,
|
|
344
|
+
className: "flex-1 px-3 py-2 rounded-md bg-white/10 hover:bg-white/20 text-sm",
|
|
345
|
+
children: "Regenerate"
|
|
346
|
+
}
|
|
347
|
+
),
|
|
348
|
+
/* @__PURE__ */ jsx4(
|
|
349
|
+
"button",
|
|
350
|
+
{
|
|
351
|
+
onClick: handlePlaceModel,
|
|
352
|
+
className: "flex-1 px-3 py-2 rounded-md bg-blue-500 hover:bg-blue-600 text-white text-sm",
|
|
353
|
+
children: "Place Model"
|
|
354
|
+
}
|
|
355
|
+
)
|
|
356
|
+
] })
|
|
357
|
+
] })
|
|
358
|
+
] }) });
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
// src/react/PGSGViewControls.tsx
|
|
362
|
+
import { jsx as jsx5, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
363
|
+
function PGSGViewerControls({
|
|
364
|
+
viewer,
|
|
365
|
+
className
|
|
366
|
+
}) {
|
|
367
|
+
const [open, setOpen] = React4.useState(false);
|
|
368
|
+
if (!viewer) return null;
|
|
369
|
+
return /* @__PURE__ */ jsxs3(
|
|
370
|
+
"div",
|
|
371
|
+
{
|
|
372
|
+
className: cn(
|
|
373
|
+
"absolute top-0 right-0 h-full flex flex-row items-stretch z-50"
|
|
374
|
+
),
|
|
375
|
+
children: [
|
|
376
|
+
/* @__PURE__ */ jsxs3("div", { className: "flex flex-col justify-between items-end py-2 pr-2", children: [
|
|
377
|
+
/* @__PURE__ */ jsx5(PGSGViewerSettings, { viewer }),
|
|
378
|
+
/* @__PURE__ */ jsxs3("div", { className: "flex flex-col gap-2", children: [
|
|
379
|
+
/* @__PURE__ */ jsx5(PGSGViewer3D, { open, setOpen }),
|
|
380
|
+
/* @__PURE__ */ jsx5(PGSGViewerMode, { viewer })
|
|
381
|
+
] })
|
|
382
|
+
] }),
|
|
383
|
+
/* @__PURE__ */ jsx5(
|
|
384
|
+
"div",
|
|
385
|
+
{
|
|
386
|
+
className: cn(
|
|
387
|
+
"overflow-hidden transition-all duration-300 ease-out w-0",
|
|
388
|
+
open && "w-[360px]"
|
|
389
|
+
),
|
|
390
|
+
children: /* @__PURE__ */ jsx5(
|
|
391
|
+
PGSGViewer3DSheet,
|
|
392
|
+
{
|
|
393
|
+
open,
|
|
394
|
+
setOpen,
|
|
395
|
+
viewer
|
|
396
|
+
}
|
|
397
|
+
)
|
|
398
|
+
}
|
|
399
|
+
)
|
|
400
|
+
]
|
|
401
|
+
}
|
|
402
|
+
);
|
|
403
|
+
}
|
|
404
|
+
|
|
405
|
+
// src/react/PGSGCanvas.tsx
|
|
406
|
+
import { jsx as jsx6 } from "react/jsx-runtime";
|
|
8
407
|
function PGSGCanvas({
|
|
9
408
|
src,
|
|
10
409
|
type = "pgsg",
|
|
@@ -12,33 +411,36 @@ function PGSGCanvas({
|
|
|
12
411
|
onReady,
|
|
13
412
|
colliderSrc
|
|
14
413
|
}) {
|
|
15
|
-
const ref =
|
|
16
|
-
const
|
|
17
|
-
|
|
414
|
+
const ref = React5.useRef(null);
|
|
415
|
+
const [viewer, setViewer] = React5.useState(null);
|
|
416
|
+
React5.useEffect(() => {
|
|
18
417
|
if (!ref.current) return;
|
|
19
|
-
|
|
20
|
-
const viewer = new PGSGViewer({
|
|
418
|
+
const instance = new PGSGViewer({
|
|
21
419
|
container: ref.current,
|
|
22
420
|
source: { type, url: src },
|
|
23
421
|
colliderSource: colliderSrc,
|
|
24
422
|
debug: true,
|
|
25
423
|
viewerType: "three"
|
|
26
424
|
});
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
onReady?.(
|
|
425
|
+
setViewer(instance);
|
|
426
|
+
instance.load().then(() => {
|
|
427
|
+
onReady?.(instance);
|
|
30
428
|
});
|
|
31
429
|
return () => {
|
|
32
|
-
|
|
33
|
-
|
|
430
|
+
instance.destroy();
|
|
431
|
+
setViewer(null);
|
|
34
432
|
};
|
|
35
|
-
}, [src]);
|
|
36
|
-
return /* @__PURE__ */
|
|
433
|
+
}, [src, type, colliderSrc]);
|
|
434
|
+
return /* @__PURE__ */ jsx6(
|
|
37
435
|
"div",
|
|
38
436
|
{
|
|
39
437
|
ref,
|
|
40
|
-
className,
|
|
41
|
-
style: {
|
|
438
|
+
className: cn("relative w-full h-full", className),
|
|
439
|
+
style: {
|
|
440
|
+
width: "100%",
|
|
441
|
+
height: "100%"
|
|
442
|
+
},
|
|
443
|
+
children: /* @__PURE__ */ jsx6(PGSGViewerControls, { viewer })
|
|
42
444
|
}
|
|
43
445
|
);
|
|
44
446
|
}
|