2.10.9 • Published 9 months ago

@epigraph/ar v2.10.9

Weekly downloads
-
License
Apache-2.0
Repository
github
Last release
9 months ago

epigraph-ar

Epigraph's custom web component for AR based on Google's <model-viewer>. As such, it mostly follows their coding conventions except for public APIs. For more information, @see https://github.com/google/model-viewer/wiki/Code-conventions

Examples

<!-- include this in your `<head>` -->
<script async type="module" src='https://cdn.jsdelivr.net/npm/@epigraph/ar/dist/epigraph-ar.min.js'></script>
<!-- include this in your `<head>`, replace 2.9.0 with a specified version -->
<script async type="module" src='https://cdn.jsdelivr.net/npm/@epigraph/ar@2.9.0/dist/epigraph-ar.min.js'></script>
<epigraph-ar sku="some-valid-sku" ua-code="some-valid-ua-code" ga-measurement-id="some-valid-ga-measurement-id" ar-modes="scene-viewer quick-look"></epigraph-ar>
<epigraph-ar viewer-visible sku="some-valid-sku" ua-code="some-valid-ua-code" ga-measurement-id="some-valid-ga-measurement-id" button-mode="none"></epigraph-ar>
<epigraph-ar viewer-visible sku="some-valid-sku" ua-code="some-valid-ua-code" ga-measurement-id="some-valid-ga-measurement-id" button-mode="none" material-variant-selector-visible></epigraph-ar>
<!-- NOTE: only supported on Android Devices compatible with WebXR -->
<epigraph-ar viewer-visible sku="some-valid-sku" ua-code="some-valid-ua-code" ga-measurement-id="some-valid-ga-measurement-id" ar-modes="webxr scene-viewer quick-look" material-variant-selector-visible></epigraph-ar>
<epigraph-ar viewer-visible sku="some-valid-sku" ua-code="some-valid-ua-code" ga-measurement-id="some-valid-ga-measurement-id" button-mode="none" product-tour-visible></epigraph-ar>
<epigraph-ar viewer-visible sku="some-valid-sku" ua-code="some-valid-ua-code" ga-measurement-id="some-valid-ga-measurement-id" product-tour-visible></epigraph-ar>
<epigraph-ar>
<element slot="slot-name"></element>
<epigraph-ar>
epigraph-ar::part(part-name) {
some-rule: some-value;
}
epigraph-ar {
--some-css-property: some-new-value;
}
const epigraphAR = document.querySelector('epigraph-ar');

epigraphAR.addEventListener('event-name', () => {
doSomething();
})

Properties

PropertyAttributeModifiersTypeDefaultDescription
arButtonModeAttributebutton-modestring"mobile desktop"sets ar button modes for the ar-button, maps to the enumerationempty string - NONEmobile - MOBILEdesktop - DESKTOPmobile desktop - BOTH
arButtonRolloverNudgear-button-rollover-nudgebooleanfalsetoggles the ability to show arollover nudge when the AR/QR button is hovered
arModesar-modesstring"scene-viewer quick-look"sets ar modes for the ar experiencewebxr/scene-viewer - androidquick-look - iOS
arPlacementar-placementstring"floor"sets ar placement for the ar experiencefloor - place ar object on the floorwall - place ar object on the wall
autoStartauto-startbooleanfalseused to load the 3D viewer automatically on desktop
cameraOrbitcamera-orbitstring"55deg 69deg auto"sets the viewer camera orbit values
canActivateARreadonlypublic method to get ar-capability status
environmentImageenvironment-imagestring"neutral"sets environmental lightingempty string - default scene optimized for load speedneutral - applies even lighting on all sidesHDR Image - supply HDR Image source url to this to apply custom lighting
gaEventLabelTypega-event-label-typestring"name"flag to use different values for GA event labelname - use product name or hotspot feature namesku - use product skuname and sku - use '{name} - {sku}'sku and name - use '{sku} - {name}'
interactionPromptThresholdinteraction-prompt-thresholdnumber3000flag to toggle UserWithArSupport/UserWithQrSupport GA event reporting
internalMeasurementsVisibleinternal-measurements-visiblebooleanfalsesets visibility of internal model measurements
materialVariantSelectorVisiblematerial-variant-selector-visiblebooleanfalsesets visibility of material variant selector
maxCameraOrbitmax-camera-orbitstring"auto 100deg auto"sets the maximum camera orbiteach part of the string represents the following in order: roll(theta) yaw(phi) radiusthis uses Euler angles @see https://en.wikipedia.org/wiki/Euler_angles#Proper_Euler_angles_2 for more information
measurementUnitmeasurement-unitstring"imperial"sets which measurement system to use for internal measurementsimperial - uses the imperial systemmetric - uses the metric system
minCameraOrbitmin-camera-orbitstring"auto 0deg auto"sets the minimum camera orbiteach part of the string represents the following in order: roll(theta) yaw(phi) radiusthis uses Euler angles @see https://en.wikipedia.org/wiki/Euler_angles#Proper_Euler_angles_2 for more information
namestring"EPIGRAPH-AR"name to be used for the internal logging service
orbitSensitivityorbit-sensitivitynumber"1"sets the orbit sensitivitytakes any number, negative values reverse orbit
posterBackgroundposterstring""sets the source url for the poster background
posterForegroundposter-foregroundstring""sets the source url for the icon to display on top of the poster
mobilePosterForegroundmobile-poster-foregroundstring""sets the source url for the icon to display on top of the poster on mobile devices, defaults to the value of poster-foreground if none are provided
productTourVisibleproduct-tour-visiblebooleanfalsesets visibility of product tour
shadowIntensityshadow-intensitynumber1modifies the shadow intensity of the model
showPosterOnCloseshow-poster-on-closebooleanfalsesets ability to reset model-viewer to poster upon closing fullscreen
skuskustring""to be used with epigraph product skus
stopTouchPropagationstop-touch-propagationbooleanfalsemodifies whether touch events on the 3D viewer are allowed to propagate
themethemestring"default"used to indicate UI/UX themes
uaCodeua-codestring""to be used with client ua-code
gaMeasurementIdga-measurement-idstring""to be used with client ga-measurement-id
verboseLoggingverbose-loggingbooleanfalseused to log debugging information
viewerVisibleviewer-visiblebooleanfalsesets visibility of the 3D viewerTODO: set a
method call to toggle this property based on response from mediator
disableMobileFullscreendisable-mobile-fullscreenbooleanfalseused to disable fullscreen on mobile devices

Methods

MethodTypeDescription
dismissPoster(): voidpublic method to dismiss viewer poster
showPoster(): voidpublic method to show viewer poster
closeModal(): voidpublic method to close iOS fullscreen modal
launchFullscreen(): voidpublic method to open fullscreen or fullscreen modal

Events

EventTypeDescription
epigraph-ar-capability-determinedCustomEvent<{ canActivateAr: any; }>custom event to indicate whether the device is AR capable
epigraph-ar-loading-errorCustomEvent<{ message: any; stack: any; }>custom event to bubble up the model load error event from model-viewer, inheriting message and stack
epigraph-ar-model-loadedcustom event to bubble up the model loaded event from model-viewer
epigraph-experience-typeCustomEvent<ExperienceDetails>custom event to detail what experience is currently being rendered
epigraph-invalid-productcustom event to indicate product associated with the sku is invalid
epigraph-valid-productcustom event to indicate product associated with the sku is valid
epigraph-ar-poster-dismissedcustom event to indicate when the model-viewer poster is dismissed
epigraph-ar-fullscreen-openedcustom event to indicate when fullscreen is opened on the model-viewer
epigraph-ar-fullscreen-closecustom event to indicate when fullscreen is closed on the model-viewer
epigraph-modal-openedcustom event to indicate when the ios fullscreen modal is opened
epigraph-modal-closecustom event to indicate when the ios fullscreen modal is closed

Slots

NameDescription
ar-buttonreplaces the ar-button but maintains the onclick function
ar-button-rollover-nudgereplaces the rollover nudge that appears onhover, if enabled
mobile-product-tour-buttonreplaces the mobile product tour launch button
posterreplaces the viewer poster
poster-foregroundreplaces the poster icon
mobile-poster-foregroundreplaces the mobile poster icon
progress-barreplaces the progress indicator
qr-modal-closereplaces the qr-modal close button
qr-modal-donereplaces the qr-modal done button
qr-modal-instructionreplaces the qr-modal instruction
qr-modal-requirementreplaces the qr-modal requirement
qr-modal-titlereplaces the qr-modal title
viewer-modal-exit-buttonreplaces the button that exits the fullscreen viewer

CSS Shadow Parts

PartDescription
ar-button-containerpoints to the ar button container
ar-button-rollover-nudgepoints to the rollover nudge that displays on hover
default-ar-buttonpoints to the default ar button
default-poster-foregroundpoints to the default poster icon
default-poster-backgroundpoints to the default poster background
default-poster-background-imagepoints to the default poster background image
hotspot-buttonpoints to the hotspot buttons
hotspot-button-annotationpoints to the hotspot button annotation
hotspot-button-inner-circlepoints to the inner circle of the hotspot button
material-variant-selectorpoints to the <material-variant-selector> element
material-variant-selector-buttonpoints to the selector buttons themselves
material-variant-selector-containerpoints to the container housing the selectors
mobile-product-tour-button-defaultpoints to the default mobile product tour launch button
model-viewerpoints to the <model-viewer> element
poster-foregroundpoints to the poster icon
poster-foreground-imagepoints to the poster icon image
mobile-poster-foregroundpoints to the mobile poster icon
mobile-poster-foreground-imagepoints to the mobile poster icon image
product-tourpoints to the <product-tour> element
product-tour-carousel-mediapoints to the media housed inside media carousels
product-tour-close-containerpoints to the side panel close button container
product-tour-close-defaultpoints to the side panel default close button
product-tour-containerpoints to the side panel container
product-tour-feature-content-containerpoints to the side panel feature content containers
product-tour-feature-descriptionpoints to the description of the feature text
product-tour-feature-media-containerpoints to the containers housing feature media
product-tour-feature-text-containerpoints to the container housing the feature text
product-tour-feature-titlepoints to the title of the feature text
product-tour-inner-content-containerpoints to the side panel inner content container
product-tour-media-carouselpoints to the feature media carousels
product-tour-media-carousel-dotpoints to the control buttons for the media carousels
product-tour-media-controls-containerpoints to the containers housing the control buttons for the media carousels
product-tour-media-titlepoints to the feature media titles
qr-modalpoints to the <qr-modal> element
qr-modal-backgroundpoints to the modal background
qr-modal-close-defaultpoints to the default close button in the qr-modal
qr-modal-containerpoints to the main modal
qr-modal-done-defaultpoints to the default done button in the qr-modal
qr-modal-instruction-defaultpoints to the default instruction in the qr-modal
qr-modal-qr-containerpoints to the qr container within the qr-modal
qr-modal-qr-imagepoints to the qr image in the modal
qr-modal-requirement-defaultpoints to the default requirement in the qr-modal
qr-modal-title-defaultpoints to the default title in the qr-modal
viewer-modal-exit-buttonpoints to the button that exits the fullscreen viewer on mobile
webxr-bannerpoints to the webxr banner
webxr-banner-namepoints to the product name in the text portion
webxr-banner-pdppoints to the the url text below the name in the text portion
webxr-banner-textpoints to the text portion of the webxr banner
webxr-banner-visit-buttonpoints to the visit button in the banner

CSS Custom Properties

PropertyDescription
--ar-button-active-background-coloredits ar-button background color when clicked
--ar-button-background-coloredits ar-button background color
--ar-button-border-coloredits ar-button border color
--ar-button-hover-background-coloredits ar-button background color when hovered
--ar-button-hover-text-coloredits ar-button text color when hovered
--ar-button-text-coloredits ar-button text color
--ar-icon-frame-coloredits ar-icon frame color
--ar-icon-hover-frame-coloredits ar-icon frame color when hovered
--ar-icon-hover-vector-1-coloredits ar-icon vector 1 color when hovered
--ar-icon-hover-vector-2-coloredits ar-icon vector 2 color when hovered
--ar-icon-hover-vector-3-coloredits ar-icon vector 3 color when hovered
--ar-icon-vector-1-coloredits ar-icon vector 1 (top face) color
--ar-icon-vector-2-coloredits ar-icon vector 2 (left face) color
--ar-icon-vector-3-coloredits ar-icon vector 3 (right face) color
--hotspot-button-background-coloredits hotspot button background color
--hotspot-button-border-coloredits hotspot button border color
--hotspot-button-focus-border-coloredits hotspot button border color when focused
--hotspot-inner-circle-border-coloredits hotspot button inner circle border color
--hotspot-inner-circle-viewed-border-coloredits hotspot button inner circle border color when viewed
--mobile-product-tour-button-background-coloredits product-tour mobile button background color
--mobile-product-tour-button-text-coloredits product-tour mobile button text color
--product-tour-background-coloredits product-tour background color
--product-tour-close-button-fill-coloredits product-tour close button fill color
--product-tour-close-button-hover-fill-coloredits product-tour close button fill color when hovered
--product-tour-close-button-hover-stroke-coloredits product-tour close-button stroke color when hovered
--product-tour-close-button-stroke-coloredits product-tour close-button stroke color
--product-tour-current-dot-background-coloredits product-tour control dot background color when it points to a current image
--product-tour-dot-background-coloredits product-tour control dot background color
--model-viewer-mobile-close-button-outline-coloredits product-tour mobile close button outline color
--model-viewer-mobile-close-button-stroke-coloredits product-tour mobile close button stroke color
--progress-ring-coloredits the progress ring color
--progress-ring-radiusedits the progress ring radius
--progress-ring-thicknessedits the progress ring thickness
--qr-modal-close-button-stroke-coloredits qr-modal close button stroke color
--qr-modal-done-button-active-background-coloredits qr-modal done button background color when clicked
--qr-modal-done-button-background-coloredits qr-modal done button background color
--qr-modal-done-button-border-coloredits qr-modal done button border color
--qr-modal-done-button-hover-background-coloredits qr-modal done button background color when hovered
--qr-modal-done-button-hover-text-coloredits qr-modal done button text color when hovered
--qr-modal-done-button-text-coloredits qr-modal done button text color
--qr-modal-instruction-coloredits qr-modal instruction text color
--qr-modal-requirement-coloredits qr-modal requirement text color
--qr-modal-title-coloredits qr-modal title text color
2.10.9

9 months ago

2.10.7

12 months ago

2.10.8

12 months ago

2.10.6

1 year ago

2.10.5

2 years ago

2.10.6-beta

2 years ago

2.8.1

2 years ago

2.8.0

2 years ago

2.9.2

2 years ago

2.9.1

2 years ago

2.9.3

2 years ago

2.10.1

2 years ago

2.10.2

2 years ago

2.10.0

2 years ago

2.7.0

2 years ago

2.10.3

2 years ago

2.10.4

2 years ago

2.6.0

2 years ago

2.9.0

2 years ago

2.4.10

3 years ago

2.4.12

3 years ago

2.4.11

3 years ago

2.4.9

3 years ago

2.4.8

3 years ago

2.5.0

2 years ago

2.5.2

2 years ago

2.5.1

2 years ago

2.4.1

3 years ago

2.4.0

3 years ago

2.4.3

3 years ago

2.4.2

3 years ago

2.3.23

3 years ago

2.4.5

3 years ago

2.4.4

3 years ago

2.3.20

3 years ago

2.3.22

3 years ago

2.3.21

3 years ago

2.4.7

3 years ago

2.4.6

3 years ago

2.3.17

3 years ago

2.3.16

3 years ago

2.3.19

3 years ago

2.3.18

3 years ago

2.3.15

3 years ago

2.3.14

3 years ago

2.3.8

3 years ago

2.3.7

3 years ago

2.3.9

3 years ago

2.3.4

3 years ago

2.3.3

3 years ago

2.3.6

3 years ago

2.3.5

3 years ago

2.3.13

3 years ago

2.3.12

3 years ago

2.3.11

3 years ago

2.3.10

3 years ago

2.3.0

3 years ago

2.3.2

3 years ago

2.3.1

3 years ago

2.2.1

3 years ago

2.2.3

3 years ago

2.2.2

3 years ago

2.2.0

3 years ago

2.1.1

3 years ago

2.0.3

3 years ago

2.0.2

4 years ago

2.0.5

3 years ago

2.0.4

3 years ago

2.0.1

4 years ago

2.0.0

4 years ago

2.1.0

3 years ago

2.0.0-beta.1

4 years ago

2.0.0-alpha.7

4 years ago

2.0.0-alpha.6

4 years ago

2.0.0-alpha.3

4 years ago

2.0.0-alpha.4

4 years ago

2.0.0-alpha.5

4 years ago

2.0.0-alpha.1

4 years ago

2.0.0-alpha.2

4 years ago

1.1.8

4 years ago

1.1.7

4 years ago

1.1.6

4 years ago

1.1.5

4 years ago

1.1.4

4 years ago

1.1.3

4 years ago

1.1.2

4 years ago

1.1.0

4 years ago

1.0.9

4 years ago