@orbitcommerce/constellation-docs 1.0.0 → 1.2.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/dist/docs.css +14764 -2237
- package/dist/index.js +2 -2
- package/dist/pages/{Playground-CNbBbErC.js → Playground-Mk1yIWXb.js} +2 -2
- package/dist/pages/_address-data-L9BR499w.js +161 -0
- package/dist/pages/_builder-demo-C0eJUmPU.js +282 -0
- package/dist/pages/_card-art-0be5ncyV.js +18 -0
- package/dist/pages/_conversation-samples-Bq7cn-4d.js +70 -0
- package/dist/pages/{_figures-data-BDmScEny.js → _figures-data-DaDvB7Nm.js} +5 -5
- package/dist/pages/_kpi-examples-DeGCBB9T.js +208 -0
- package/dist/pages/{_overlays-specimens-Dpn6oiyH.js → _overlays-specimens-bawR331Z.js} +33 -23
- package/dist/pages/_preview-specimens-DKQC9HAo.js +153 -0
- package/dist/pages/accordion-Sg0TUqxB.js +1036 -0
- package/dist/pages/address-autocomplete-DP0PUOlK.js +360 -0
- package/dist/pages/address-block-BZOOOPA9.js +368 -0
- package/dist/pages/address-fields-CwSqro3W.js +277 -0
- package/dist/pages/ai-highlight-D3x2vD83.js +642 -0
- package/dist/pages/{alert-BD4e6QTh.js → alert-D3i7xZTU.js} +195 -50
- package/dist/pages/anchored-overlay-BV0OCu2Q.js +788 -0
- package/dist/pages/{app-shell-KbA-nRqZ.js → app-shell-D4hdlHps.js} +133 -54
- package/dist/pages/{area-chart-B91dLcGo.js → area-chart-BEWFwiB2.js} +183 -27
- package/dist/pages/{avatar-DPPHXJAu.js → avatar-BFEqQViw.js} +194 -12
- package/dist/pages/avatar-upload-BDCzJfyN.js +484 -0
- package/dist/pages/{badge-C9JR0thI.js → badge-0-PyMrih.js} +441 -135
- package/dist/pages/bar-chart-DkLogYlt.js +1060 -0
- package/dist/pages/bar-fold-B-3XeIDZ.js +360 -0
- package/dist/pages/board-card-D2tZY_mU.js +415 -0
- package/dist/pages/brand-mark-BqiLvFSR.js +417 -0
- package/dist/pages/{button-D3V912P4.js → button-DAyfssDY.js} +276 -79
- package/dist/pages/{calendar-DSDZ9nRH.js → calendar-Ds7KsgSI.js} +69 -17
- package/dist/pages/canvas-stage-1KiPspkX.js +472 -0
- package/dist/pages/card-CQEM1_wc.js +1567 -0
- package/dist/pages/caret-suggestions-oHI6QvqW.js +526 -0
- package/dist/pages/chart-legend-B20AbakD.js +724 -0
- package/dist/pages/chat-composer-CwzUJYIa.js +437 -0
- package/dist/pages/checkbox-BG9Zkb6j.js +1581 -0
- package/dist/pages/checklist-card-DEyykVFS.js +783 -0
- package/dist/pages/chip-Ck-o3Ui6.js +839 -0
- package/dist/pages/chip-list-k1LxXuCi.js +414 -0
- package/dist/pages/clamp-text-n-iE8RDR.js +203 -0
- package/dist/pages/coachmark-Be2ghobT.js +366 -0
- package/dist/pages/code-block-Dv_Y5GYq.js +622 -0
- package/dist/pages/collab-field-CfqqK7d2.js +696 -0
- package/dist/pages/color-field-CZpfcA-A.js +1127 -0
- package/dist/pages/{colour-BwuO8xAv.js → colour-q2ntvI0w.js} +496 -20
- package/dist/pages/column-mapper-TsTG39cl.js +502 -0
- package/dist/pages/combobox-DvK2j5tI.js +1334 -0
- package/dist/pages/{command-palette-xAD7fOg6.js → command-palette-CJ7uBA04.js} +201 -58
- package/dist/pages/comment-box-CDSGYhr5.js +346 -0
- package/dist/pages/composer-D4B0NgpA.js +689 -0
- package/dist/pages/condition-builder-BZy2ZGXe.js +715 -0
- package/dist/pages/conflict-chooser-C--_9UIS.js +210 -0
- package/dist/pages/context-menu-F9DV30ia.js +487 -0
- package/dist/pages/copy-button-Cn7WiKRF.js +568 -0
- package/dist/pages/copy-field-D3Xt3Jq6.js +511 -0
- package/dist/pages/danger-zone-Db_UUeiP.js +564 -0
- package/dist/pages/date-input-GOW067EB.js +956 -0
- package/dist/pages/{date-picker-BYSa816m.js → date-picker-GdBciR99.js} +186 -38
- package/dist/pages/date-time-BLKCXtVZ.js +678 -0
- package/dist/pages/{delta-CtAo0eIM.js → delta-CNAGv8JY.js} +266 -61
- package/dist/pages/description-list-BPeXn1eW.js +1268 -0
- package/dist/pages/device-switcher-BCaN99c1.js +554 -0
- package/dist/pages/dialog-CRpkRC98.js +3164 -0
- package/dist/pages/{docs-BNOb7AqR.js → docs-lM2UBSir.js} +20 -15
- package/dist/pages/doodle-nzkqi2UI.js +201 -0
- package/dist/pages/drag-ghost-B6kpzC3O.js +426 -0
- package/dist/pages/drill-menu-cskH5mol.js +490 -0
- package/dist/pages/dropzone-DOY_Rhw0.js +1069 -0
- package/dist/pages/element-toolbar-DZIhXlCJ.js +498 -0
- package/dist/pages/emoji-picker-CqaWaffD.js +235 -0
- package/dist/pages/empty-state-4U2txFpI.js +1113 -0
- package/dist/pages/facet-filters-McbBeY9e.js +353 -0
- package/dist/pages/figure-D-HF5vCj.js +563 -0
- package/dist/pages/figure-strip-BB3mNl7D.js +1364 -0
- package/dist/pages/{figure-tabs-CoPFzzKz.js → figure-tabs-QOeQMY6N.js} +153 -35
- package/dist/pages/file-chip-DMDjtlqQ.js +738 -0
- package/dist/pages/filter-pill-DzqNOsD4.js +1295 -0
- package/dist/pages/font-picker-Bqhu0QMh.js +416 -0
- package/dist/pages/form-grid-BfWCVlie.js +692 -0
- package/dist/pages/gallery-BBk2EOri.js +453 -0
- package/dist/pages/gif-picker-CnoDTCaL.js +270 -0
- package/dist/pages/gradient-editor-Bqxp7Fxj.js +378 -0
- package/dist/pages/grouped-checklist-gNZ0tBKU.js +477 -0
- package/dist/pages/heatmap-BohgIcNk.js +507 -0
- package/dist/pages/highlight-text-BfxzfmvS.js +287 -0
- package/dist/pages/{home-dashboard-CFQwDtC9.js → home-dashboard-CxPmvduE.js} +21 -18
- package/dist/pages/hosted-embed-Jef3aIMP.js +163 -0
- package/dist/pages/hosted-field-BLh-53AE.js +208 -0
- package/dist/pages/hosted-field-DEpI4lVS.js +514 -0
- package/dist/pages/{icon-button-C9eSVPPW.js → icon-button-Bu4Gj5sy.js} +370 -31
- package/dist/pages/icon-picker-DEyoMUTh.js +291 -0
- package/dist/pages/icon-tile-DcgxyXPF.js +592 -0
- package/dist/pages/{icons-sxkTs5Ob.js → icons-CJ9Aar3d.js} +315 -52
- package/dist/pages/image-cropper-NyougqLH.js +466 -0
- package/dist/pages/image-field-7knBv4mJ.js +567 -0
- package/dist/pages/import-result-CmTtGXW_.js +486 -0
- package/dist/pages/inline-confirm-CEcI5Lxo.js +327 -0
- package/dist/pages/inline-edit-Ba39SzhM.js +1125 -0
- package/dist/pages/input-CzLCzfyx.js +2372 -0
- package/dist/pages/{installation-DpsX8G_n.js → installation-C3UcpQJT.js} +112 -29
- package/dist/pages/job-indicator-DOXWbFdl.js +755 -0
- package/dist/pages/kanban-Dy9sPAI0.js +740 -0
- package/dist/pages/{kbd-cNfDoikz.js → kbd-UNj4zqxn.js} +15 -14
- package/dist/pages/layout-primitives-CPRaZeyt.js +483 -0
- package/dist/pages/line-chart-CntWxeMF.js +1117 -0
- package/dist/pages/link-CXqvAg9z.js +689 -0
- package/dist/pages/link-picker-BMFGCC67.js +478 -0
- package/dist/pages/link-row-x8yaUuWc.js +595 -0
- package/dist/pages/{live-globe-ClvLn9Lb.js → live-globe-95ROMhGQ.js} +191 -47
- package/dist/pages/loading-overlay-BeGuXM9G.js +456 -0
- package/dist/pages/loading-state-BNbCo51C.js +556 -0
- package/dist/pages/log-viewer-BQz8I_a2.js +503 -0
- package/dist/pages/{logo-BfGF1Pq9.js → logo-B38rnzoq.js} +13 -13
- package/dist/pages/lottie_light-CxEH8eiR.js +9116 -0
- package/dist/pages/markdown-Ied72vMT.js +237 -0
- package/dist/pages/markdown-field-BfnIEKZH.js +193 -0
- package/dist/pages/media-banner-DkStCia0.js +233 -0
- package/dist/pages/{menu-by2sgQ09.js → menu-NrLYKqKp.js} +623 -109
- package/dist/pages/message-thread-Bo4zbxqu.js +731 -0
- package/dist/pages/meta-line-D5p2TycR.js +371 -0
- package/dist/pages/model-viewer-BfokvHoc.js +60288 -0
- package/dist/pages/model-viewer-C8PFO8wk.js +577 -0
- package/dist/pages/month-calendar-T1vw9Rup.js +457 -0
- package/dist/pages/{motion-BvTGc2Dk.js → motion-CrXtiBvA.js} +20 -10
- package/dist/pages/number-input-CuyMZg18.js +968 -0
- package/dist/pages/orbit-loader-DeVBtkFE.js +219 -0
- package/dist/pages/{orbit-spinner-Dil1Z3Oy.js → orbit-spinner-Dxv5qAhr.js} +30 -14
- package/dist/pages/otp-input-CVRoX1mw.js +591 -0
- package/dist/pages/{overview-BPEbZQ6g.js → overview-LA9XRhZc.js} +4 -4
- package/dist/pages/package-dimensions-DFCyZj_T.js +192 -0
- package/dist/pages/{pagination-BBUnGvv5.js → pagination-C1EgVtW4.js} +74 -29
- package/dist/pages/palette-tile-X9ZXu2Z0.js +414 -0
- package/dist/pages/password-field-DHEQKyUC.js +912 -0
- package/dist/pages/person-cell-BmjbADBz.js +564 -0
- package/dist/pages/phone-input-B3G7Qpb2.js +747 -0
- package/dist/pages/plan-card-DRaA6RuB.js +621 -0
- package/dist/pages/plan-card-DtloWvMh.js +258 -0
- package/dist/pages/plan-comparison-BVIGTtbd.js +559 -0
- package/dist/pages/plan-grid-cfPVTB5V.js +251 -0
- package/dist/pages/point-list-BbPmZjsm.js +222 -0
- package/dist/pages/{popover-Db1gLDpb.js → popover-C3Oar9D5.js} +76 -14
- package/dist/pages/presence-avatars-CRZIk8n9.js +328 -0
- package/dist/pages/preview-frame-Bcwk0y_Q.js +1631 -0
- package/dist/pages/price-CRBLoa9h.js +604 -0
- package/dist/pages/{principles-CeAIOIdt.js → principles-pnDyfHpK.js} +9 -9
- package/dist/pages/print-page-BkLv6bW8.js +513 -0
- package/dist/pages/profile-hero-CC9dUzuN.js +498 -0
- package/dist/pages/progress-CP_awmo4.js +904 -0
- package/dist/pages/progress-ring-JuOAwk2T.js +576 -0
- package/dist/pages/{radio-group-CkdBWWfG.js → radio-group-C-4tg6FS.js} +580 -18
- package/dist/pages/radius-control-B2kRA2Ch.js +441 -0
- package/dist/pages/rating-CweKN2SX.js +471 -0
- package/dist/pages/record-layout-DUP_X0RL.js +719 -0
- package/dist/pages/record-pager-y9D7JFgb.js +278 -0
- package/dist/pages/registry-BZg-xAbi.js +594 -0
- package/dist/pages/{release-Dvo684UJ.js → release-Cs6tl16C.js} +4 -1
- package/dist/pages/repeater-BRZYKRQa.js +1351 -0
- package/dist/pages/reply-feedback-BDnHprla.js +192 -0
- package/dist/pages/reveal-BygENBbL.js +460 -0
- package/dist/pages/rich-text-DOFQZEpT.js +156 -0
- package/dist/pages/rich-text-editor-BhIM20JI.js +1265 -0
- package/dist/pages/rolldown-runtime-CbKu08Hx.js +25 -0
- package/dist/pages/{rolling-number-qmvH84Mq.js → rolling-number-GR3Cyfpz.js} +12 -12
- package/dist/pages/row-list-Dl6CYhC-.js +1565 -0
- package/dist/pages/rule-list-DTCmIMpT.js +648 -0
- package/dist/pages/save-status-B5KkyMZP.js +378 -0
- package/dist/pages/schedule-YycI95O1.js +243 -0
- package/dist/pages/scroll-area-B2sGm23Q.js +423 -0
- package/dist/pages/{search-field-BN7MWGQ4.js → search-field-D1uG7R6A.js} +15 -15
- package/dist/pages/search-menu-DMuXyUUW.js +580 -0
- package/dist/pages/secret-field-Dj9x3LL8.js +337 -0
- package/dist/pages/section-rail-BtTCETS5.js +637 -0
- package/dist/pages/section-v2Pubup9.js +639 -0
- package/dist/pages/{segmented-control-CTbIpRBW.js → segmented-control-D-FB1K1T.js} +450 -37
- package/dist/pages/{select-DguELoRR.js → select-DZ43NpOm.js} +22 -17
- package/dist/pages/selection-chrome-Czcs6RN6.js +437 -0
- package/dist/pages/{separator-CPZub9pv.js → separator-CFwqRvfO.js} +99 -22
- package/dist/pages/serp-preview-BGwORjmo.js +346 -0
- package/dist/pages/setting-row-Bt-dZV8H.js +913 -0
- package/dist/pages/{shape-DKvA0YKr.js → shape-DzniHAVT.js} +10 -10
- package/dist/pages/share-list-D4wgBxKN.js +926 -0
- package/dist/pages/side-panel-CCtkrZjs.js +811 -0
- package/dist/pages/site-preview-Dj1hM2Yo.js +353 -0
- package/dist/pages/skeleton-C1F5HkAu.js +1325 -0
- package/dist/pages/skip-link-BxznhSkz.js +252 -0
- package/dist/pages/slider-CAoPURKD.js +774 -0
- package/dist/pages/sortable-card-Sr44uCpI.js +424 -0
- package/dist/pages/sortable-list-DUAleYE1.js +1298 -0
- package/dist/pages/sortable-tree-BLzK-hTE.js +737 -0
- package/dist/pages/spacing-box-CtuvzxQu.js +550 -0
- package/dist/pages/{sparkline-DMMYGbHn.js → sparkline-D3aavCly.js} +301 -22
- package/dist/pages/split-bar-DYgZnFID.js +414 -0
- package/dist/pages/split-button-Be08-VI-.js +335 -0
- package/dist/pages/split-pane-lSNZgTKt.js +523 -0
- package/dist/pages/status-badge-DOdNhmzn.js +1074 -0
- package/dist/pages/status-checklist-CWkjCZIC.js +1152 -0
- package/dist/pages/status-dot-D99gAGsV.js +567 -0
- package/dist/pages/stepper-CxKTbEA-.js +1093 -0
- package/dist/pages/success-mark-CqFTOBEu.js +142 -0
- package/dist/pages/swatch-H_kNvHuC.js +565 -0
- package/dist/pages/{switch-B-Qe4kcT.js → switch-C93K6j9h.js} +151 -51
- package/dist/pages/table-CL0vomno.js +3225 -0
- package/dist/pages/{tabs-B4M-usCV.js → tabs-Dh0mUsLw.js} +256 -21
- package/dist/pages/tag-input-BjZWKKRJ.js +1307 -0
- package/dist/pages/task-card-Dv0sR1-w.js +295 -0
- package/dist/pages/{textarea-fTuUZRQb.js → textarea-CCM-SnGN.js} +271 -15
- package/dist/pages/thumbnail-DwFJL_k1.js +1147 -0
- package/dist/pages/time-input-CA9-uZAa.js +442 -0
- package/dist/pages/time-zone-select-CEtMXVYO.js +296 -0
- package/dist/pages/timeline-BsMUTlpR.js +1798 -0
- package/dist/pages/{toast-CKP03zjy.js → toast-zXLRiMRT.js} +240 -25
- package/dist/pages/tool-rail-B1AbTMCP.js +355 -0
- package/dist/pages/toolbar-B9l_fHKy.js +754 -0
- package/dist/pages/{tooltip-CBYil3kt.js → tooltip-LHtCUkF-.js} +162 -33
- package/dist/pages/translation-field-CTRXiF2N.js +251 -0
- package/dist/pages/tree-checklist-CJj3OcLg.js +451 -0
- package/dist/pages/tree-select-DU1qXHy_.js +492 -0
- package/dist/pages/tree-view-g_RjLtAb.js +739 -0
- package/dist/pages/{typography-PCbg8Bhg.js → typography-BSijtiRl.js} +153 -12
- package/dist/pages/unit-input-Dml4fjmK.js +659 -0
- package/dist/pages/upload-rules-yozEzSah.js +419 -0
- package/dist/pages/url-upload-input-SSnMgfpA.js +307 -0
- package/dist/pages/value-change-CnubDKyO.js +489 -0
- package/dist/pages/weekly-hours-i2EpsmTx.js +287 -0
- package/dist/pages/widget-preview-CUJMyZ_k.js +625 -0
- package/dist/pages/working-status-CENemSsw.js +389 -0
- package/manifest.json +10984 -1108
- package/package.json +2 -2
- package/dist/pages/card-DUggbis3.js +0 -659
- package/dist/pages/checkbox-DwimQaK3.js +0 -365
- package/dist/pages/dialog-BRAf4LMh.js +0 -1451
- package/dist/pages/empty-state-C-mLrXW2.js +0 -417
- package/dist/pages/input-KF9Gkawf.js +0 -1093
- package/dist/pages/registry-CroHzK9I.js +0 -244
- package/dist/pages/skeleton-DLuBhP46.js +0 -561
- package/dist/pages/table-AMoODng4.js +0 -607
|
@@ -0,0 +1,577 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { d as Section$1, i as DocPage, l as Note, n as CodeBlock$1, o as Example, s as Guidelines, u as PropsTable } from "./docs-lM2UBSir.js";
|
|
3
|
+
import { useState } from "react";
|
|
4
|
+
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
5
|
+
import { ModelViewer, setModelViewerSource } from "@orbitcommerce/constellation";
|
|
6
|
+
//#region src/pages/components/model-viewer.tsx
|
|
7
|
+
setModelViewerSource(() => import("./model-viewer-BfokvHoc.js"));
|
|
8
|
+
/** The faces of a box: four corners each, with the face's normal. */
|
|
9
|
+
function boxGeometry([cx, cy, cz, sx, sy, sz], base) {
|
|
10
|
+
const x = sx / 2;
|
|
11
|
+
const y = sy / 2;
|
|
12
|
+
const z = sz / 2;
|
|
13
|
+
const faces = [
|
|
14
|
+
[[
|
|
15
|
+
1,
|
|
16
|
+
0,
|
|
17
|
+
0
|
|
18
|
+
], [
|
|
19
|
+
[
|
|
20
|
+
x,
|
|
21
|
+
-y,
|
|
22
|
+
z
|
|
23
|
+
],
|
|
24
|
+
[
|
|
25
|
+
x,
|
|
26
|
+
-y,
|
|
27
|
+
-z
|
|
28
|
+
],
|
|
29
|
+
[
|
|
30
|
+
x,
|
|
31
|
+
y,
|
|
32
|
+
-z
|
|
33
|
+
],
|
|
34
|
+
[
|
|
35
|
+
x,
|
|
36
|
+
y,
|
|
37
|
+
z
|
|
38
|
+
]
|
|
39
|
+
]],
|
|
40
|
+
[[
|
|
41
|
+
-1,
|
|
42
|
+
0,
|
|
43
|
+
0
|
|
44
|
+
], [
|
|
45
|
+
[
|
|
46
|
+
-x,
|
|
47
|
+
-y,
|
|
48
|
+
-z
|
|
49
|
+
],
|
|
50
|
+
[
|
|
51
|
+
-x,
|
|
52
|
+
-y,
|
|
53
|
+
z
|
|
54
|
+
],
|
|
55
|
+
[
|
|
56
|
+
-x,
|
|
57
|
+
y,
|
|
58
|
+
z
|
|
59
|
+
],
|
|
60
|
+
[
|
|
61
|
+
-x,
|
|
62
|
+
y,
|
|
63
|
+
-z
|
|
64
|
+
]
|
|
65
|
+
]],
|
|
66
|
+
[[
|
|
67
|
+
0,
|
|
68
|
+
1,
|
|
69
|
+
0
|
|
70
|
+
], [
|
|
71
|
+
[
|
|
72
|
+
-x,
|
|
73
|
+
y,
|
|
74
|
+
z
|
|
75
|
+
],
|
|
76
|
+
[
|
|
77
|
+
x,
|
|
78
|
+
y,
|
|
79
|
+
z
|
|
80
|
+
],
|
|
81
|
+
[
|
|
82
|
+
x,
|
|
83
|
+
y,
|
|
84
|
+
-z
|
|
85
|
+
],
|
|
86
|
+
[
|
|
87
|
+
-x,
|
|
88
|
+
y,
|
|
89
|
+
-z
|
|
90
|
+
]
|
|
91
|
+
]],
|
|
92
|
+
[[
|
|
93
|
+
0,
|
|
94
|
+
-1,
|
|
95
|
+
0
|
|
96
|
+
], [
|
|
97
|
+
[
|
|
98
|
+
-x,
|
|
99
|
+
-y,
|
|
100
|
+
-z
|
|
101
|
+
],
|
|
102
|
+
[
|
|
103
|
+
x,
|
|
104
|
+
-y,
|
|
105
|
+
-z
|
|
106
|
+
],
|
|
107
|
+
[
|
|
108
|
+
x,
|
|
109
|
+
-y,
|
|
110
|
+
z
|
|
111
|
+
],
|
|
112
|
+
[
|
|
113
|
+
-x,
|
|
114
|
+
-y,
|
|
115
|
+
z
|
|
116
|
+
]
|
|
117
|
+
]],
|
|
118
|
+
[[
|
|
119
|
+
0,
|
|
120
|
+
0,
|
|
121
|
+
1
|
|
122
|
+
], [
|
|
123
|
+
[
|
|
124
|
+
-x,
|
|
125
|
+
-y,
|
|
126
|
+
z
|
|
127
|
+
],
|
|
128
|
+
[
|
|
129
|
+
x,
|
|
130
|
+
-y,
|
|
131
|
+
z
|
|
132
|
+
],
|
|
133
|
+
[
|
|
134
|
+
x,
|
|
135
|
+
y,
|
|
136
|
+
z
|
|
137
|
+
],
|
|
138
|
+
[
|
|
139
|
+
-x,
|
|
140
|
+
y,
|
|
141
|
+
z
|
|
142
|
+
]
|
|
143
|
+
]],
|
|
144
|
+
[[
|
|
145
|
+
0,
|
|
146
|
+
0,
|
|
147
|
+
-1
|
|
148
|
+
], [
|
|
149
|
+
[
|
|
150
|
+
x,
|
|
151
|
+
-y,
|
|
152
|
+
-z
|
|
153
|
+
],
|
|
154
|
+
[
|
|
155
|
+
-x,
|
|
156
|
+
-y,
|
|
157
|
+
-z
|
|
158
|
+
],
|
|
159
|
+
[
|
|
160
|
+
-x,
|
|
161
|
+
y,
|
|
162
|
+
-z
|
|
163
|
+
],
|
|
164
|
+
[
|
|
165
|
+
x,
|
|
166
|
+
y,
|
|
167
|
+
-z
|
|
168
|
+
]
|
|
169
|
+
]]
|
|
170
|
+
];
|
|
171
|
+
const positions = [];
|
|
172
|
+
const normals = [];
|
|
173
|
+
const indices = [];
|
|
174
|
+
faces.forEach(([normal, corners], face) => {
|
|
175
|
+
for (const [px, py, pz] of corners) {
|
|
176
|
+
positions.push(cx + px, cy + py, cz + pz);
|
|
177
|
+
normals.push(...normal);
|
|
178
|
+
}
|
|
179
|
+
const at = base + face * 4;
|
|
180
|
+
indices.push(at, at + 1, at + 2, at, at + 2, at + 3);
|
|
181
|
+
});
|
|
182
|
+
return {
|
|
183
|
+
positions,
|
|
184
|
+
normals,
|
|
185
|
+
indices
|
|
186
|
+
};
|
|
187
|
+
}
|
|
188
|
+
function base64(bytes) {
|
|
189
|
+
let text = "";
|
|
190
|
+
for (const byte of bytes) text += String.fromCharCode(byte);
|
|
191
|
+
return btoa(text);
|
|
192
|
+
}
|
|
193
|
+
/** A glTF of boxes in one colour, its buffer inside it: what a GLB would hold, small enough to write here. */
|
|
194
|
+
function boxesModel(boxes, colour) {
|
|
195
|
+
const positions = [];
|
|
196
|
+
const normals = [];
|
|
197
|
+
const indices = [];
|
|
198
|
+
boxes.forEach((box, index) => {
|
|
199
|
+
const part = boxGeometry(box, index * 24);
|
|
200
|
+
positions.push(...part.positions);
|
|
201
|
+
normals.push(...part.normals);
|
|
202
|
+
indices.push(...part.indices);
|
|
203
|
+
});
|
|
204
|
+
const position = new Float32Array(positions);
|
|
205
|
+
const normal = new Float32Array(normals);
|
|
206
|
+
const index = new Uint16Array(indices);
|
|
207
|
+
const bytes = new Uint8Array(position.byteLength + normal.byteLength + index.byteLength);
|
|
208
|
+
bytes.set(new Uint8Array(position.buffer), 0);
|
|
209
|
+
bytes.set(new Uint8Array(normal.buffer), position.byteLength);
|
|
210
|
+
bytes.set(new Uint8Array(index.buffer), position.byteLength + normal.byteLength);
|
|
211
|
+
const min = [
|
|
212
|
+
0,
|
|
213
|
+
1,
|
|
214
|
+
2
|
|
215
|
+
].map((axis) => Math.min(...positions.filter((_, i) => i % 3 === axis)));
|
|
216
|
+
const max = [
|
|
217
|
+
0,
|
|
218
|
+
1,
|
|
219
|
+
2
|
|
220
|
+
].map((axis) => Math.max(...positions.filter((_, i) => i % 3 === axis)));
|
|
221
|
+
const gltf = {
|
|
222
|
+
asset: { version: "2.0" },
|
|
223
|
+
scene: 0,
|
|
224
|
+
scenes: [{ nodes: [0] }],
|
|
225
|
+
nodes: [{ mesh: 0 }],
|
|
226
|
+
meshes: [{ primitives: [{
|
|
227
|
+
attributes: {
|
|
228
|
+
POSITION: 0,
|
|
229
|
+
NORMAL: 1
|
|
230
|
+
},
|
|
231
|
+
indices: 2,
|
|
232
|
+
material: 0
|
|
233
|
+
}] }],
|
|
234
|
+
materials: [{ pbrMetallicRoughness: {
|
|
235
|
+
baseColorFactor: [...colour, 1],
|
|
236
|
+
metallicFactor: 0,
|
|
237
|
+
roughnessFactor: .7
|
|
238
|
+
} }],
|
|
239
|
+
buffers: [{
|
|
240
|
+
byteLength: bytes.byteLength,
|
|
241
|
+
uri: `data:application/octet-stream;base64,${base64(bytes)}`
|
|
242
|
+
}],
|
|
243
|
+
bufferViews: [
|
|
244
|
+
{
|
|
245
|
+
buffer: 0,
|
|
246
|
+
byteOffset: 0,
|
|
247
|
+
byteLength: position.byteLength,
|
|
248
|
+
target: 34962
|
|
249
|
+
},
|
|
250
|
+
{
|
|
251
|
+
buffer: 0,
|
|
252
|
+
byteOffset: position.byteLength,
|
|
253
|
+
byteLength: normal.byteLength,
|
|
254
|
+
target: 34962
|
|
255
|
+
},
|
|
256
|
+
{
|
|
257
|
+
buffer: 0,
|
|
258
|
+
byteOffset: position.byteLength + normal.byteLength,
|
|
259
|
+
byteLength: index.byteLength,
|
|
260
|
+
target: 34963
|
|
261
|
+
}
|
|
262
|
+
],
|
|
263
|
+
accessors: [
|
|
264
|
+
{
|
|
265
|
+
bufferView: 0,
|
|
266
|
+
componentType: 5126,
|
|
267
|
+
count: position.length / 3,
|
|
268
|
+
type: "VEC3",
|
|
269
|
+
min,
|
|
270
|
+
max
|
|
271
|
+
},
|
|
272
|
+
{
|
|
273
|
+
bufferView: 1,
|
|
274
|
+
componentType: 5126,
|
|
275
|
+
count: normal.length / 3,
|
|
276
|
+
type: "VEC3"
|
|
277
|
+
},
|
|
278
|
+
{
|
|
279
|
+
bufferView: 2,
|
|
280
|
+
componentType: 5123,
|
|
281
|
+
count: index.length,
|
|
282
|
+
type: "SCALAR"
|
|
283
|
+
}
|
|
284
|
+
]
|
|
285
|
+
};
|
|
286
|
+
return `data:model/gltf+json;base64,${btoa(JSON.stringify(gltf))}`;
|
|
287
|
+
}
|
|
288
|
+
var STOOL = boxesModel([
|
|
289
|
+
[
|
|
290
|
+
0,
|
|
291
|
+
.46,
|
|
292
|
+
0,
|
|
293
|
+
.42,
|
|
294
|
+
.05,
|
|
295
|
+
.42
|
|
296
|
+
],
|
|
297
|
+
[
|
|
298
|
+
-.17,
|
|
299
|
+
.22,
|
|
300
|
+
-.17,
|
|
301
|
+
.04,
|
|
302
|
+
.44,
|
|
303
|
+
.04
|
|
304
|
+
],
|
|
305
|
+
[
|
|
306
|
+
.17,
|
|
307
|
+
.22,
|
|
308
|
+
-.17,
|
|
309
|
+
.04,
|
|
310
|
+
.44,
|
|
311
|
+
.04
|
|
312
|
+
],
|
|
313
|
+
[
|
|
314
|
+
-.17,
|
|
315
|
+
.22,
|
|
316
|
+
.17,
|
|
317
|
+
.04,
|
|
318
|
+
.44,
|
|
319
|
+
.04
|
|
320
|
+
],
|
|
321
|
+
[
|
|
322
|
+
.17,
|
|
323
|
+
.22,
|
|
324
|
+
.17,
|
|
325
|
+
.04,
|
|
326
|
+
.44,
|
|
327
|
+
.04
|
|
328
|
+
]
|
|
329
|
+
], [
|
|
330
|
+
.55,
|
|
331
|
+
.36,
|
|
332
|
+
.2
|
|
333
|
+
]);
|
|
334
|
+
var STOOL_POSTER = `data:image/svg+xml;charset=utf-8,${encodeURIComponent("<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"640\" height=\"420\" viewBox=\"0 0 640 420\"><rect x=\"210\" y=\"120\" width=\"220\" height=\"26\" rx=\"6\" fill=\"#8c5c33\"/><rect x=\"232\" y=\"146\" width=\"18\" height=\"190\" fill=\"#8c5c33\"/><rect x=\"390\" y=\"146\" width=\"18\" height=\"190\" fill=\"#8c5c33\"/><rect x=\"262\" y=\"146\" width=\"14\" height=\"160\" fill=\"#a5754a\"/><rect x=\"364\" y=\"146\" width=\"14\" height=\"160\" fill=\"#a5754a\"/></svg>")}`;
|
|
335
|
+
/**
|
|
336
|
+
* The loading state as a page sees it while the engine is still on its way: this viewer is handed an engine of its own
|
|
337
|
+
* that never arrives, so its poster and spinner stay. (Where the page's engine has already loaded, on a return visit,
|
|
338
|
+
* the stool simply shows.)
|
|
339
|
+
*/
|
|
340
|
+
var NEVER = () => new Promise(() => {});
|
|
341
|
+
function Preview() {
|
|
342
|
+
return /* @__PURE__ */ jsx(ModelViewer, { className: "model-viewer-preview" });
|
|
343
|
+
}
|
|
344
|
+
/** What onLoad hands back: the element, to read what the model holds. */
|
|
345
|
+
function ReadingDemo() {
|
|
346
|
+
const [read, setRead] = useState("Loading the model");
|
|
347
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
348
|
+
className: "model-viewer-stack",
|
|
349
|
+
children: [/* @__PURE__ */ jsx(ModelViewer, {
|
|
350
|
+
src: STOOL,
|
|
351
|
+
alt: "The Harbour oak stool",
|
|
352
|
+
cameraControls: true,
|
|
353
|
+
onLoad: (viewer) => {
|
|
354
|
+
const model = viewer;
|
|
355
|
+
setRead(`Loaded: ${model.availableVariants?.length ?? 0} finishes, ${model.availableAnimations?.length ?? 0} animations`);
|
|
356
|
+
}
|
|
357
|
+
}), /* @__PURE__ */ jsx("p", {
|
|
358
|
+
className: "model-viewer-readout",
|
|
359
|
+
"aria-live": "polite",
|
|
360
|
+
children: read
|
|
361
|
+
})]
|
|
362
|
+
});
|
|
363
|
+
}
|
|
364
|
+
function Page() {
|
|
365
|
+
return /* @__PURE__ */ jsxs(DocPage, {
|
|
366
|
+
title: "Model viewer",
|
|
367
|
+
status: "new",
|
|
368
|
+
importNames: ["ModelViewer", "setModelViewerSource"],
|
|
369
|
+
lead: "A 3D model to turn, zoom and place in the room, on Google's model-viewer web component, which the app loads lazily and hands over once. Until the model is in, its poster shows under a spinner.",
|
|
370
|
+
children: [
|
|
371
|
+
/* @__PURE__ */ jsx(Section$1, {
|
|
372
|
+
id: "basics",
|
|
373
|
+
title: "Basics",
|
|
374
|
+
description: /* @__PURE__ */ jsxs("p", { children: [
|
|
375
|
+
"Hand the viewer its engine once, where the app starts:",
|
|
376
|
+
" ",
|
|
377
|
+
/* @__PURE__ */ jsx("code", { children: "setModelViewerSource(() => import('@google/model-viewer'))" }),
|
|
378
|
+
". The kit does not bring it: an app that shows models installs ",
|
|
379
|
+
/* @__PURE__ */ jsx("code", { children: "@google/model-viewer" }),
|
|
380
|
+
" itself, one that never does never needs it, and the engine is in its own chunk, loaded with the first model. Then give each viewer its ",
|
|
381
|
+
/* @__PURE__ */ jsx("code", { children: "src" }),
|
|
382
|
+
" (glTF or GLB) and ",
|
|
383
|
+
/* @__PURE__ */ jsx("code", { children: "alt" }),
|
|
384
|
+
". Drag to turn the model, scroll or pinch to zoom, or Tab to it and use the arrow keys."
|
|
385
|
+
] }),
|
|
386
|
+
children: /* @__PURE__ */ jsx(Example, {
|
|
387
|
+
align: "fill",
|
|
388
|
+
clientOnly: true,
|
|
389
|
+
code: `// Once, where the app starts
|
|
390
|
+
setModelViewerSource(() => import('@google/model-viewer'))
|
|
391
|
+
|
|
392
|
+
<ModelViewer src={model.url} alt="The Harbour oak stool" autoRotate />`,
|
|
393
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
394
|
+
className: "model-viewer-stack",
|
|
395
|
+
children: /* @__PURE__ */ jsx(ModelViewer, {
|
|
396
|
+
src: STOOL,
|
|
397
|
+
alt: "The Harbour oak stool",
|
|
398
|
+
autoRotate: true
|
|
399
|
+
})
|
|
400
|
+
})
|
|
401
|
+
})
|
|
402
|
+
}),
|
|
403
|
+
/* @__PURE__ */ jsx(Section$1, {
|
|
404
|
+
id: "ar",
|
|
405
|
+
title: "In the room",
|
|
406
|
+
description: /* @__PURE__ */ jsxs("p", { children: [
|
|
407
|
+
/* @__PURE__ */ jsx("code", { children: "ar" }),
|
|
408
|
+
" offers to place the model in the room where the phone can: WebXR, Scene Viewer on Android, and Quick Look on iOS, which reads USDZ, so give it ",
|
|
409
|
+
/* @__PURE__ */ jsx("code", { children: "iosSrc" }),
|
|
410
|
+
" as well. The viewer shows the button only where it works; on a computer it stays hidden. Its words are ",
|
|
411
|
+
/* @__PURE__ */ jsx("code", { children: "labels.ar" }),
|
|
412
|
+
", \"View in your room\"."
|
|
413
|
+
] }),
|
|
414
|
+
children: /* @__PURE__ */ jsx(CodeBlock$1, { code: `<ModelViewer src={model.glbUrl} iosSrc={model.usdzUrl} poster={model.posterUrl} alt={model.name} ar />` })
|
|
415
|
+
}),
|
|
416
|
+
/* @__PURE__ */ jsx(Section$1, {
|
|
417
|
+
id: "states",
|
|
418
|
+
title: "States",
|
|
419
|
+
description: /* @__PURE__ */ jsxs("p", { children: [
|
|
420
|
+
"With no ",
|
|
421
|
+
/* @__PURE__ */ jsx("code", { children: "src" }),
|
|
422
|
+
" the viewer draws its empty state. While the engine or the model loads, the",
|
|
423
|
+
" ",
|
|
424
|
+
/* @__PURE__ */ jsx("code", { children: "poster" }),
|
|
425
|
+
" shows half faded under a spinner, and a screen reader hears \"Loading 3D model\". A model that fails says so, and a page with no engine (no source, or ",
|
|
426
|
+
/* @__PURE__ */ jsx("code", { children: "source={null}" }),
|
|
427
|
+
") shows the poster and says the model cannot be shown here. A new ",
|
|
428
|
+
/* @__PURE__ */ jsx("code", { children: "src" }),
|
|
429
|
+
" starts again. (A model that fails is not shown live here: the engine writes its own error to the console when it is handed a broken file.)"
|
|
430
|
+
] }),
|
|
431
|
+
children: /* @__PURE__ */ jsx(Example, {
|
|
432
|
+
align: "fill",
|
|
433
|
+
clientOnly: true,
|
|
434
|
+
code: `<ModelViewer />
|
|
435
|
+
<ModelViewer src={model.url} poster={model.posterUrl} /> // while it loads
|
|
436
|
+
<ModelViewer src={model.url} source={null} poster={model.posterUrl} />`,
|
|
437
|
+
children: /* @__PURE__ */ jsxs("div", {
|
|
438
|
+
className: "model-viewer-states",
|
|
439
|
+
children: [
|
|
440
|
+
/* @__PURE__ */ jsx(ModelViewer, { className: "model-viewer-small" }),
|
|
441
|
+
/* @__PURE__ */ jsx(ModelViewer, {
|
|
442
|
+
className: "model-viewer-small",
|
|
443
|
+
src: STOOL,
|
|
444
|
+
source: NEVER,
|
|
445
|
+
poster: STOOL_POSTER,
|
|
446
|
+
alt: "The Harbour oak stool"
|
|
447
|
+
}),
|
|
448
|
+
/* @__PURE__ */ jsx(ModelViewer, {
|
|
449
|
+
className: "model-viewer-small",
|
|
450
|
+
src: STOOL,
|
|
451
|
+
source: null,
|
|
452
|
+
poster: STOOL_POSTER,
|
|
453
|
+
alt: "The Harbour oak stool"
|
|
454
|
+
})
|
|
455
|
+
]
|
|
456
|
+
})
|
|
457
|
+
})
|
|
458
|
+
}),
|
|
459
|
+
/* @__PURE__ */ jsxs(Section$1, {
|
|
460
|
+
id: "reading",
|
|
461
|
+
title: "Reading the model",
|
|
462
|
+
description: /* @__PURE__ */ jsxs("p", { children: [
|
|
463
|
+
/* @__PURE__ */ jsx("code", { children: "onLoad" }),
|
|
464
|
+
" hands over the ",
|
|
465
|
+
/* @__PURE__ */ jsx("code", { children: "<model-viewer>" }),
|
|
466
|
+
" element once the model is in: read its",
|
|
467
|
+
" ",
|
|
468
|
+
/* @__PURE__ */ jsx("code", { children: "availableVariants" }),
|
|
469
|
+
" (a product's finishes) and ",
|
|
470
|
+
/* @__PURE__ */ jsx("code", { children: "availableAnimations" }),
|
|
471
|
+
", or take a picture of it with ",
|
|
472
|
+
/* @__PURE__ */ jsx("code", { children: "toDataURL()" }),
|
|
473
|
+
" for a poster."
|
|
474
|
+
] }),
|
|
475
|
+
children: [/* @__PURE__ */ jsx(Example, {
|
|
476
|
+
align: "fill",
|
|
477
|
+
clientOnly: true,
|
|
478
|
+
code: `<ModelViewer src={model.url} onLoad={(viewer) => setFinishes(viewer.availableVariants)} />`,
|
|
479
|
+
children: /* @__PURE__ */ jsx(ReadingDemo, {})
|
|
480
|
+
}), /* @__PURE__ */ jsx(Note, {
|
|
481
|
+
title: "Height",
|
|
482
|
+
children: "The viewer is 320px tall. Set another height with a class or a style on it: the model fills it."
|
|
483
|
+
})]
|
|
484
|
+
}),
|
|
485
|
+
/* @__PURE__ */ jsx(Section$1, {
|
|
486
|
+
id: "accessibility",
|
|
487
|
+
title: "Accessibility",
|
|
488
|
+
children: /* @__PURE__ */ jsx(Guidelines, { items: [
|
|
489
|
+
"Give every model an alt that says what it is (\"The Harbour oak stool\"): the viewer reads it out, and the poster shows it.",
|
|
490
|
+
"The model is one stop in the tab order; the arrow keys turn it and the viewer says how, in its own words.",
|
|
491
|
+
"Loading is said through a polite status; a failure is written in the frame, beside a warning mark.",
|
|
492
|
+
"Auto-rotate stops as soon as the model is touched, and never starts under reduced motion. Leave it off where the model sits beside text that is read.",
|
|
493
|
+
"While the model has the focus, the frame takes the kit’s focus ring; the viewer also draws its own thin ring inside, which no page style can reach."
|
|
494
|
+
] })
|
|
495
|
+
}),
|
|
496
|
+
/* @__PURE__ */ jsxs(Section$1, {
|
|
497
|
+
id: "props",
|
|
498
|
+
title: "Props",
|
|
499
|
+
children: [/* @__PURE__ */ jsx(PropsTable, { rows: [
|
|
500
|
+
{
|
|
501
|
+
name: "src",
|
|
502
|
+
type: "string",
|
|
503
|
+
description: "The model, glTF or GLB. With none, the empty state."
|
|
504
|
+
},
|
|
505
|
+
{
|
|
506
|
+
name: "poster",
|
|
507
|
+
type: "string",
|
|
508
|
+
description: "A picture of the model, while it loads and when it cannot be drawn."
|
|
509
|
+
},
|
|
510
|
+
{
|
|
511
|
+
name: "alt",
|
|
512
|
+
type: "string",
|
|
513
|
+
default: "'3D model'",
|
|
514
|
+
description: "What the model shows."
|
|
515
|
+
},
|
|
516
|
+
{
|
|
517
|
+
name: "cameraControls",
|
|
518
|
+
type: "boolean",
|
|
519
|
+
default: "true",
|
|
520
|
+
description: "Turning and zooming with the pointer, a touch or the keys."
|
|
521
|
+
},
|
|
522
|
+
{
|
|
523
|
+
name: "autoRotate",
|
|
524
|
+
type: "boolean",
|
|
525
|
+
default: "false",
|
|
526
|
+
description: "Turns slowly until touched. Under reduced motion it stands still."
|
|
527
|
+
},
|
|
528
|
+
{
|
|
529
|
+
name: "ar",
|
|
530
|
+
type: "boolean",
|
|
531
|
+
default: "false",
|
|
532
|
+
description: "Offers to place the model in the room where the phone can."
|
|
533
|
+
},
|
|
534
|
+
{
|
|
535
|
+
name: "iosSrc",
|
|
536
|
+
type: "string",
|
|
537
|
+
description: "A USDZ file for Quick Look on iOS."
|
|
538
|
+
},
|
|
539
|
+
{
|
|
540
|
+
name: "environmentImage",
|
|
541
|
+
type: "string",
|
|
542
|
+
default: "'neutral'",
|
|
543
|
+
description: "The light: 'neutral', 'legacy' or an image address."
|
|
544
|
+
},
|
|
545
|
+
{
|
|
546
|
+
name: "shadowIntensity",
|
|
547
|
+
type: "number",
|
|
548
|
+
default: "1",
|
|
549
|
+
description: "How dark the shadow under it is, 0 to 2."
|
|
550
|
+
},
|
|
551
|
+
{
|
|
552
|
+
name: "source",
|
|
553
|
+
type: "ModelViewerSource | null",
|
|
554
|
+
description: "This viewer's own engine, or null for none, in place of the page's."
|
|
555
|
+
},
|
|
556
|
+
{
|
|
557
|
+
name: "onLoad",
|
|
558
|
+
type: "(viewer: HTMLElement) => void",
|
|
559
|
+
description: "The element, once the model is in."
|
|
560
|
+
},
|
|
561
|
+
{
|
|
562
|
+
name: "onError",
|
|
563
|
+
type: "() => void",
|
|
564
|
+
description: "Called when the model cannot be loaded."
|
|
565
|
+
},
|
|
566
|
+
{
|
|
567
|
+
name: "labels",
|
|
568
|
+
type: "Partial<ModelViewerLabels>",
|
|
569
|
+
description: "The words: alt, loading, error, empty, unavailable, ar. modelViewerLabels is the English set."
|
|
570
|
+
}
|
|
571
|
+
] }), /* @__PURE__ */ jsx(Fragment$1, {})]
|
|
572
|
+
})
|
|
573
|
+
]
|
|
574
|
+
});
|
|
575
|
+
}
|
|
576
|
+
//#endregion
|
|
577
|
+
export { Page, Preview };
|