@40rty/ams-ui 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/agent.js +148 -0
- package/dist/catalog-data.js +93 -0
- package/dist/catalog-entries.js +8 -0
- package/dist/chunk-432XYPDT.js +1012 -0
- package/dist/chunk-54QPRWEG.js +2800 -0
- package/dist/chunk-CKGGECAQ.js +239 -0
- package/dist/chunk-E3IJDSKY.js +173 -0
- package/dist/chunk-JQNZ5UUK.js +226 -0
- package/dist/chunk-LQLOG2V3.js +649 -0
- package/dist/chunk-MHUEIBJ3.js +117 -0
- package/dist/chunk-ORIOBWTD.js +112 -0
- package/dist/css/preset/motion.css +78 -0
- package/dist/css/preset/tailwind-theme.css +163 -0
- package/dist/css/shell/mobile/island.css +478 -0
- package/dist/hooks.js +25 -0
- package/dist/index.js +7165 -0
- package/dist/motion.js +113 -0
- package/dist/shell.js +5621 -0
- package/dist/types/agent/AgentStreamingState.d.ts +58 -0
- package/dist/types/agent/ProseSurface.d.ts +31 -0
- package/dist/types/agent/index.d.ts +8 -0
- package/dist/types/agent/phase-label.d.ts +13 -0
- package/dist/types/agent/presence/AgentPresenceWidget.d.ts +85 -0
- package/dist/types/agent/presence/BriefIdentity.d.ts +9 -0
- package/dist/types/agent/presence/CompactRead.d.ts +44 -0
- package/dist/types/agent/presence/CriteriaRail.d.ts +68 -0
- package/dist/types/agent/presence/DefaultNotch.d.ts +2 -0
- package/dist/types/agent/presence/FactChip.d.ts +10 -0
- package/dist/types/agent/presence/InlinePresenceRead.d.ts +25 -0
- package/dist/types/agent/presence/KnowledgePeek.d.ts +23 -0
- package/dist/types/agent/presence/LayoutMorphSkeleton.d.ts +59 -0
- package/dist/types/agent/presence/PresenceBrief.d.ts +29 -0
- package/dist/types/agent/presence/PresenceFiller.d.ts +24 -0
- package/dist/types/agent/presence/SourceSift.d.ts +48 -0
- package/dist/types/agent/presence/StreamRead.d.ts +50 -0
- package/dist/types/agent/presence/VoiceLine.d.ts +19 -0
- package/dist/types/agent/presence/band-beat.d.ts +40 -0
- package/dist/types/agent/presence/band-row.d.ts +188 -0
- package/dist/types/agent/presence/cite-image.d.ts +9 -0
- package/dist/types/agent/presence/class-names.d.ts +134 -0
- package/dist/types/agent/presence/element-view.d.ts +83 -0
- package/dist/types/agent/presence/fact-forms/baseline-forms.d.ts +20 -0
- package/dist/types/agent/presence/fact-forms/class-names.d.ts +14 -0
- package/dist/types/agent/presence/fact-forms/index.d.ts +3 -0
- package/dist/types/agent/presence/fact-forms/register.d.ts +9 -0
- package/dist/types/agent/presence/fact-rail.d.ts +76 -0
- package/dist/types/agent/presence/fact-slots.d.ts +97 -0
- package/dist/types/agent/presence/folded.d.ts +26 -0
- package/dist/types/agent/presence/forms.d.ts +5 -0
- package/dist/types/agent/presence/index.d.ts +39 -0
- package/dist/types/agent/presence/notch/PresenceNotch.d.ts +20 -0
- package/dist/types/agent/presence/parts.d.ts +29 -0
- package/dist/types/agent/presence/read-data.d.ts +48 -0
- package/dist/types/agent/presence/reads.d.ts +37 -0
- package/dist/types/agent/presence/sift-deck.d.ts +58 -0
- package/dist/types/agent/presence/source-cards/ArticleSourceCard.d.ts +4 -0
- package/dist/types/agent/presence/source-cards/CollectionSourceCard.d.ts +4 -0
- package/dist/types/agent/presence/source-cards/PolicySourceCard.d.ts +4 -0
- package/dist/types/agent/presence/source-cards/ProductSourceCard.d.ts +4 -0
- package/dist/types/agent/presence/source-cards/ReviewSourceCard.d.ts +4 -0
- package/dist/types/agent/presence/source-cards/SourceCard.d.ts +4 -0
- package/dist/types/agent/presence/source-cards/card-frame.d.ts +38 -0
- package/dist/types/agent/presence/source-cards/card-marks.d.ts +69 -0
- package/dist/types/agent/presence/source-cards/card-plate.d.ts +20 -0
- package/dist/types/agent/presence/source-cards/card-shell.d.ts +91 -0
- package/dist/types/agent/presence/source-cards/register.d.ts +6 -0
- package/dist/types/agent/presence/source-cards/review-passage.d.ts +53 -0
- package/dist/types/agent/presence/swatch.d.ts +4 -0
- package/dist/types/agent/presence/use-band-facts.d.ts +9 -0
- package/dist/types/agent/presence/use-forget-fact.d.ts +56 -0
- package/dist/types/agent/presence/use-measured-height.d.ts +11 -0
- package/dist/types/catalog-data/base.d.ts +2 -0
- package/dist/types/catalog-data/chat.d.ts +55 -0
- package/dist/types/catalog-data/content.d.ts +1129 -0
- package/dist/types/catalog-data/ecommerce.d.ts +4842 -0
- package/dist/types/catalog-data/index.d.ts +7 -0
- package/dist/types/catalog-data/social.d.ts +1552 -0
- package/dist/types/catalog-data/tokens.d.ts +20 -0
- package/dist/types/catalog-data/ugc.d.ts +50 -0
- package/dist/types/catalog-entries.d.ts +35 -0
- package/dist/types/catalog.d.ts +18 -0
- package/dist/types/components/SkeletonSwap.d.ts +27 -0
- package/dist/types/components/agentic/AgentText.d.ts +44 -0
- package/dist/types/components/agentic/Turn.d.ts +21 -0
- package/dist/types/components/browse/CanvasBootLoader.d.ts +16 -0
- package/dist/types/components/browse/ContinuationLoading.d.ts +22 -0
- package/dist/types/components/browse/canvas-booting.d.ts +37 -0
- package/dist/types/components/browse/constants.d.ts +2 -0
- package/dist/types/components/browse/index.d.ts +4 -0
- package/dist/types/components/chat/SuggestionCards.d.ts +2 -0
- package/dist/types/components/chat/index.d.ts +1 -0
- package/dist/types/components/content/FAQ.d.ts +12 -0
- package/dist/types/components/content/FeatureGrid.d.ts +11 -0
- package/dist/types/components/content/InfoCards.d.ts +16 -0
- package/dist/types/components/content/Reviews.d.ts +9 -0
- package/dist/types/components/content/RichText.d.ts +10 -0
- package/dist/types/components/content/article/ArticleDetail.d.ts +15 -0
- package/dist/types/components/content/article/BlogCard.d.ts +11 -0
- package/dist/types/components/content/article/BlogPosts.d.ts +19 -0
- package/dist/types/components/content/page/PageDetail.d.ts +13 -0
- package/dist/types/components/content/page/PolicyDetail.d.ts +23 -0
- package/dist/types/components/ecommerce/cart/AddToCartButton.d.ts +9 -0
- package/dist/types/components/ecommerce/cart/CartContent.d.ts +40 -0
- package/dist/types/components/ecommerce/cart/CartDrawer.d.ts +41 -0
- package/dist/types/components/ecommerce/cart/CartFoot.d.ts +30 -0
- package/dist/types/components/ecommerce/cart/CartLineItem.d.ts +13 -0
- package/dist/types/components/ecommerce/cart/CartLineRow.d.ts +17 -0
- package/dist/types/components/ecommerce/cart/CartPromoCode.d.ts +29 -0
- package/dist/types/components/ecommerce/cart/CartSummary.d.ts +7 -0
- package/dist/types/components/ecommerce/cart/CartWidget.d.ts +10 -0
- package/dist/types/components/ecommerce/cart/VariantPickerModal.d.ts +12 -0
- package/dist/types/components/ecommerce/cart/cart-format.d.ts +8 -0
- package/dist/types/components/ecommerce/cart/use-cart-view.d.ts +50 -0
- package/dist/types/components/ecommerce/collection/CollectionCard.d.ts +10 -0
- package/dist/types/components/ecommerce/collection/CollectionGrid.d.ts +8 -0
- package/dist/types/components/ecommerce/collection/CollectionList.d.ts +13 -0
- package/dist/types/components/ecommerce/collection/internal/CollectionListItem.d.ts +13 -0
- package/dist/types/components/ecommerce/product/AddToRegistry.d.ts +36 -0
- package/dist/types/components/ecommerce/product/ComparisonTable.d.ts +25 -0
- package/dist/types/components/ecommerce/product/ComparisonTableSkeleton.d.ts +11 -0
- package/dist/types/components/ecommerce/product/PresenceProductRail.d.ts +35 -0
- package/dist/types/components/ecommerce/product/ProductBadge.d.ts +9 -0
- package/dist/types/components/ecommerce/product/ProductCard.d.ts +27 -0
- package/dist/types/components/ecommerce/product/ProductDetail.d.ts +25 -0
- package/dist/types/components/ecommerce/product/ProductGallery.d.ts +19 -0
- package/dist/types/components/ecommerce/product/ProductGrid.d.ts +26 -0
- package/dist/types/components/ecommerce/product/ProductImage.d.ts +54 -0
- package/dist/types/components/ecommerce/product/ProductOption.d.ts +9 -0
- package/dist/types/components/ecommerce/product/ProductPrice.d.ts +8 -0
- package/dist/types/components/ecommerce/product/ProductVideoPlayer.d.ts +17 -0
- package/dist/types/components/ecommerce/product/comparison-table-parts.d.ts +41 -0
- package/dist/types/components/ecommerce/product/comparison-table-rows.d.ts +24 -0
- package/dist/types/components/ecommerce/product/image-trim.d.ts +35 -0
- package/dist/types/components/ecommerce/product/product-card-glyphs.d.ts +2 -0
- package/dist/types/components/ecommerce/product/registry-logos.d.ts +2 -0
- package/dist/types/components/ecommerce/product/trim-geometry.d.ts +45 -0
- package/dist/types/components/ecommerce/wishlist/WishlistDrawer.d.ts +16 -0
- package/dist/types/components/feedback/Skeleton.d.ts +13 -0
- package/dist/types/components/feedback/Thinking.d.ts +15 -0
- package/dist/types/components/layout/AspectRatio.d.ts +5 -0
- package/dist/types/components/layout/Backdrop.d.ts +32 -0
- package/dist/types/components/layout/Container.d.ts +6 -0
- package/dist/types/components/layout/Divider.d.ts +5 -0
- package/dist/types/components/layout/Drawer.d.ts +9 -0
- package/dist/types/components/layout/DrawerDockSlot.d.ts +40 -0
- package/dist/types/components/layout/Grid.d.ts +8 -0
- package/dist/types/components/layout/Modal.d.ts +25 -0
- package/dist/types/components/layout/Page.d.ts +11 -0
- package/dist/types/components/layout/Section.d.ts +6 -0
- package/dist/types/components/layout/Stack.d.ts +7 -0
- package/dist/types/components/marketing/AnnouncementBar.d.ts +15 -0
- package/dist/types/components/marketing/BrandStory.d.ts +19 -0
- package/dist/types/components/marketing/HeroBanner.d.ts +69 -0
- package/dist/types/components/marketing/HeroBannerFeatures.d.ts +10 -0
- package/dist/types/components/marketing/HeroBannerInline.d.ts +20 -0
- package/dist/types/components/marketing/PromoBanner.d.ts +11 -0
- package/dist/types/components/marketing/internal/AnnouncementLink.d.ts +5 -0
- package/dist/types/components/marketing/internal/AnnouncementMessage.d.ts +10 -0
- package/dist/types/components/navigation/Breadcrumbs.d.ts +10 -0
- package/dist/types/components/navigation/Footer.d.ts +15 -0
- package/dist/types/components/navigation/Header.d.ts +14 -0
- package/dist/types/components/navigation/internal/BreadcrumbLink.d.ts +5 -0
- package/dist/types/components/navigation/internal/FooterLink.d.ts +5 -0
- package/dist/types/components/navigation/internal/HeaderLink.d.ts +5 -0
- package/dist/types/components/shell/BaseMark.d.ts +11 -0
- package/dist/types/components/shell/CartPill.d.ts +13 -0
- package/dist/types/components/shell/ComposerDock.d.ts +9 -0
- package/dist/types/components/shell/ErrorBanner.d.ts +14 -0
- package/dist/types/components/shell/HistoryMenu.d.ts +15 -0
- package/dist/types/components/shell/MenuButton.d.ts +31 -0
- package/dist/types/components/shell/MountainRidges.d.ts +11 -0
- package/dist/types/components/shell/PendingTurn.d.ts +1 -0
- package/dist/types/components/shell/ShellTop.d.ts +35 -0
- package/dist/types/components/shell/brand-shell.d.ts +441 -0
- package/dist/types/components/shell/index.d.ts +9 -0
- package/dist/types/components/shell/marks/index.d.ts +5 -0
- package/dist/types/components/social/ReviewCard.d.ts +9 -0
- package/dist/types/components/social/ReviewSummary.d.ts +7 -0
- package/dist/types/components/social/TestimonialCard.d.ts +9 -0
- package/dist/types/components/social/TestimonialCarousel.d.ts +16 -0
- package/dist/types/components/social/UgcCard.d.ts +9 -0
- package/dist/types/components/social/UgcGallery.d.ts +8 -0
- package/dist/types/hooks/index.d.ts +8 -0
- package/dist/types/hooks/keyboard.d.ts +18 -0
- package/dist/types/hooks/use-container-width.d.ts +11 -0
- package/dist/types/hooks/use-dismiss-on-outside.d.ts +23 -0
- package/dist/types/hooks/use-focus-on-change.d.ts +8 -0
- package/dist/types/hooks/use-focus-trap.d.ts +12 -0
- package/dist/types/hooks/use-media-query.d.ts +12 -0
- package/dist/types/hooks/use-projection.d.ts +24 -0
- package/dist/types/hooks/use-reduced-motion.d.ts +1 -0
- package/dist/types/hooks/use-scroll-lock.d.ts +19 -0
- package/dist/types/hooks/use-scroll-threshold.d.ts +14 -0
- package/dist/types/hooks/use-textarea-autosize.d.ts +16 -0
- package/dist/types/index.d.ts +74 -0
- package/dist/types/labels-context.d.ts +18 -0
- package/dist/types/labels.d.ts +240 -0
- package/dist/types/motion/ease.d.ts +10 -0
- package/dist/types/motion/generation/ActiveBlockIndicator.d.ts +27 -0
- package/dist/types/motion/generation/BlurUpImage.d.ts +23 -0
- package/dist/types/motion/generation/ResolveEntrance.d.ts +22 -0
- package/dist/types/motion/generation/ShimmerSkeleton.d.ts +20 -0
- package/dist/types/motion/generation/WordReveal.d.ts +26 -0
- package/dist/types/motion/generation/index.d.ts +6 -0
- package/dist/types/motion/hooks/useInViewOnce.d.ts +14 -0
- package/dist/types/motion/hooks/useScrollDirection.d.ts +38 -0
- package/dist/types/motion/hooks/useScrollProgress.d.ts +23 -0
- package/dist/types/motion/hooks/useStableValue.d.ts +36 -0
- package/dist/types/motion/hooks/useSuccessFlash.d.ts +1 -0
- package/dist/types/motion/index.d.ts +18 -0
- package/dist/types/motion/presets.d.ts +335 -0
- package/dist/types/motion/primitives/Agent.d.ts +118 -0
- package/dist/types/motion/primitives/MorphRegion.d.ts +16 -0
- package/dist/types/motion/primitives/Parallax.d.ts +19 -0
- package/dist/types/motion/primitives/Pin.d.ts +26 -0
- package/dist/types/motion/primitives/Reveal.d.ts +29 -0
- package/dist/types/motion/primitives/RevealStagger.d.ts +16 -0
- package/dist/types/motion/primitives/StickyShelf.d.ts +18 -0
- package/dist/types/primitives/Badge/index.d.ts +12 -0
- package/dist/types/primitives/Button/index.d.ts +25 -0
- package/dist/types/primitives/Input/index.d.ts +5 -0
- package/dist/types/primitives/Money/index.d.ts +13 -0
- package/dist/types/primitives/Select/index.d.ts +5 -0
- package/dist/types/primitives/Skeleton/index.d.ts +4 -0
- package/dist/types/shell/AnimatedPlaceholder.d.ts +13 -0
- package/dist/types/shell/BottomSheet.d.ts +54 -0
- package/dist/types/shell/Button.d.ts +19 -0
- package/dist/types/shell/ChromeSurface.d.ts +33 -0
- package/dist/types/shell/Composer.d.ts +56 -0
- package/dist/types/shell/ComposerChipStrip.d.ts +9 -0
- package/dist/types/shell/ConversationTransition.d.ts +27 -0
- package/dist/types/shell/DictationButton.d.ts +24 -0
- package/dist/types/shell/DragSheet.d.ts +34 -0
- package/dist/types/shell/InlineCompletion.d.ts +38 -0
- package/dist/types/shell/LauncherDock.d.ts +40 -0
- package/dist/types/shell/ListeningWaveform.d.ts +18 -0
- package/dist/types/shell/MenuAccordionPanel.d.ts +26 -0
- package/dist/types/shell/MenuDrawer.d.ts +72 -0
- package/dist/types/shell/MenuFlyout.d.ts +22 -0
- package/dist/types/shell/MenuNav.d.ts +30 -0
- package/dist/types/shell/MenuNavBar.d.ts +22 -0
- package/dist/types/shell/ShellMenuChrome.d.ts +66 -0
- package/dist/types/shell/ShellScaffold.d.ts +92 -0
- package/dist/types/shell/SideDock.d.ts +75 -0
- package/dist/types/shell/Skeleton.d.ts +22 -0
- package/dist/types/shell/Spinner.d.ts +10 -0
- package/dist/types/shell/TypedPlaceholder.d.ts +11 -0
- package/dist/types/shell/VoiceControl.d.ts +23 -0
- package/dist/types/shell/VoiceIsland.d.ts +24 -0
- package/dist/types/shell/canvas-gutter-style.d.ts +15 -0
- package/dist/types/shell/composer/AttachButton.d.ts +14 -0
- package/dist/types/shell/composer/AttachmentStrip.d.ts +12 -0
- package/dist/types/shell/composer/ClearSessionButton.d.ts +16 -0
- package/dist/types/shell/composer/ConversationHistoryButton.d.ts +25 -0
- package/dist/types/shell/composer/ShareCanvasButton.d.ts +19 -0
- package/dist/types/shell/composer/ThreadJumpRail.d.ts +43 -0
- package/dist/types/shell/composer/composer-metrics.d.ts +6 -0
- package/dist/types/shell/composer/field-metrics.d.ts +97 -0
- package/dist/types/shell/composer/heic-convert.d.ts +6 -0
- package/dist/types/shell/composer/use-field-autosize.d.ts +26 -0
- package/dist/types/shell/composer/useComposerAttachments.d.ts +37 -0
- package/dist/types/shell/composer/usePromptComposer.d.ts +51 -0
- package/dist/types/shell/dock-context.d.ts +10 -0
- package/dist/types/shell/index.d.ts +36 -0
- package/dist/types/shell/menu-columns.d.ts +19 -0
- package/dist/types/shell/mobile/DefaultMobileShell.d.ts +88 -0
- package/dist/types/shell/mobile/IslandComposeGroup.d.ts +41 -0
- package/dist/types/shell/mobile/IslandInputBar.d.ts +61 -0
- package/dist/types/shell/mobile/IslandNavButtons.d.ts +20 -0
- package/dist/types/shell/mobile/IslandTrailingAction.d.ts +34 -0
- package/dist/types/shell/mobile/MobileChrome.d.ts +34 -0
- package/dist/types/shell/mobile/MobileVoiceConsole.d.ts +42 -0
- package/dist/types/shell/mobile/MorphIsland.d.ts +105 -0
- package/dist/types/shell/mobile/RestIsland.d.ts +41 -0
- package/dist/types/shell/mobile/constants.d.ts +26 -0
- package/dist/types/shell/mobile/document-scroll-ref.d.ts +22 -0
- package/dist/types/shell/mobile/hero-entry-point.d.ts +110 -0
- package/dist/types/shell/mobile/island-metrics.d.ts +131 -0
- package/dist/types/shell/mobile/sheet-detents.d.ts +49 -0
- package/dist/types/shell/mobile/turn-end-action.d.ts +44 -0
- package/dist/types/shell/mobile/use-blur-on-canvas-gesture.d.ts +31 -0
- package/dist/types/shell/mobile/use-island-fold-scroll.d.ts +28 -0
- package/dist/types/shell/mobile/use-keyboard-inset.d.ts +18 -0
- package/dist/types/shell/mobile/use-sheet-fold-gesture.d.ts +57 -0
- package/dist/types/shell/slots.d.ts +16 -0
- package/dist/types/shell/thread-reland.d.ts +22 -0
- package/dist/types/shell/use-dock-state.d.ts +54 -0
- package/dist/types/types/commerce.d.ts +1 -0
- package/dist/types/utils/cn.d.ts +2 -0
- package/dist/types/utils/format-money.d.ts +2 -0
- package/dist/types/utils/html-to-text.d.ts +8 -0
- package/dist/types/utils/sanitize-html.d.ts +12 -0
- package/dist/types/utils/use-backdrop-presence.d.ts +24 -0
- package/dist/types/utils/use-composer-mode.d.ts +26 -0
- package/dist/types/utils/use-is-seed-home.d.ts +13 -0
- package/dist/types/utils/use-safe-cart.d.ts +17 -0
- package/dist/types/utils/use-safe-facts.d.ts +9 -0
- package/dist/types/utils/use-safe-fourty-session.d.ts +15 -0
- package/package.json +80 -0
|
@@ -0,0 +1,239 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import {
|
|
3
|
+
agentTextExamples,
|
|
4
|
+
agentTextProps,
|
|
5
|
+
articleDetailExamples,
|
|
6
|
+
articleDetailProps,
|
|
7
|
+
backdropExamples,
|
|
8
|
+
backdropProps,
|
|
9
|
+
blogPostsExamples,
|
|
10
|
+
blogPostsProps,
|
|
11
|
+
brandStoryExamples,
|
|
12
|
+
brandStoryProps,
|
|
13
|
+
collectionListExamples,
|
|
14
|
+
collectionListProps,
|
|
15
|
+
comparisonTableExamples,
|
|
16
|
+
comparisonTableProps,
|
|
17
|
+
faqExamples,
|
|
18
|
+
faqProps,
|
|
19
|
+
heroExamples,
|
|
20
|
+
heroProps,
|
|
21
|
+
infoCardsExamples,
|
|
22
|
+
infoCardsProps,
|
|
23
|
+
pageDetailExamples,
|
|
24
|
+
pageDetailProps,
|
|
25
|
+
pageProps,
|
|
26
|
+
policyDetailExamples,
|
|
27
|
+
policyDetailProps,
|
|
28
|
+
productDetailExamples,
|
|
29
|
+
productDetailProps,
|
|
30
|
+
productGridExamples,
|
|
31
|
+
productGridProps,
|
|
32
|
+
reviewsExamples,
|
|
33
|
+
reviewsProps,
|
|
34
|
+
testimonialsExamples,
|
|
35
|
+
testimonialsProps,
|
|
36
|
+
turnExamples,
|
|
37
|
+
turnProps,
|
|
38
|
+
ugcExamples,
|
|
39
|
+
ugcProps
|
|
40
|
+
} from "./chunk-LQLOG2V3.js";
|
|
41
|
+
|
|
42
|
+
// src/catalog-entries.ts
|
|
43
|
+
var catalog = {
|
|
44
|
+
// ── Root Layout ─────────────────────────────────────────────────────
|
|
45
|
+
page: {
|
|
46
|
+
type: "page",
|
|
47
|
+
alwaysInclude: true,
|
|
48
|
+
propsSchema: pageProps,
|
|
49
|
+
layout: "fullbleed",
|
|
50
|
+
progressLabel: "Composing the page"
|
|
51
|
+
},
|
|
52
|
+
// ── Page-level chrome ─────────────────────────────────────────────
|
|
53
|
+
backdrop: {
|
|
54
|
+
type: "backdrop",
|
|
55
|
+
propsSchema: backdropProps,
|
|
56
|
+
examples: backdropExamples,
|
|
57
|
+
layout: "fullbleed",
|
|
58
|
+
alwaysInclude: false
|
|
59
|
+
},
|
|
60
|
+
// ── Hero / Content ────────────────────────────────────────────────
|
|
61
|
+
hero: {
|
|
62
|
+
type: "hero",
|
|
63
|
+
propsSchema: heroProps,
|
|
64
|
+
examples: heroExamples,
|
|
65
|
+
layout: "fullbleed",
|
|
66
|
+
defaultLayoutWeight: 0,
|
|
67
|
+
defaultMaxHeight: "lg",
|
|
68
|
+
progressLabel: "Composing the hero"
|
|
69
|
+
},
|
|
70
|
+
brandStory: {
|
|
71
|
+
type: "brandStory",
|
|
72
|
+
propsSchema: brandStoryProps,
|
|
73
|
+
examples: brandStoryExamples,
|
|
74
|
+
layout: "fullbleed",
|
|
75
|
+
defaultLayoutWeight: 1,
|
|
76
|
+
defaultMaxHeight: "lg",
|
|
77
|
+
progressLabel: "Telling the story"
|
|
78
|
+
},
|
|
79
|
+
blogPosts: {
|
|
80
|
+
type: "blogPosts",
|
|
81
|
+
propsSchema: blogPostsProps,
|
|
82
|
+
examples: blogPostsExamples,
|
|
83
|
+
layout: "fullbleed",
|
|
84
|
+
defaultLayoutWeight: 1,
|
|
85
|
+
progressLabel: "Gathering articles",
|
|
86
|
+
requires: ["resolve:article"]
|
|
87
|
+
},
|
|
88
|
+
articleDetail: {
|
|
89
|
+
type: "articleDetail",
|
|
90
|
+
propsSchema: articleDetailProps,
|
|
91
|
+
examples: articleDetailExamples,
|
|
92
|
+
layout: "fullbleed",
|
|
93
|
+
defaultLayoutWeight: 1,
|
|
94
|
+
progressLabel: "Opening the article",
|
|
95
|
+
requires: ["resolve:article"]
|
|
96
|
+
},
|
|
97
|
+
pageDetail: {
|
|
98
|
+
type: "pageDetail",
|
|
99
|
+
propsSchema: pageDetailProps,
|
|
100
|
+
examples: pageDetailExamples,
|
|
101
|
+
layout: "fullbleed",
|
|
102
|
+
defaultLayoutWeight: 1,
|
|
103
|
+
progressLabel: "Opening the page",
|
|
104
|
+
requires: ["resolve:page"]
|
|
105
|
+
},
|
|
106
|
+
policyDetail: {
|
|
107
|
+
type: "policyDetail",
|
|
108
|
+
propsSchema: policyDetailProps,
|
|
109
|
+
examples: policyDetailExamples,
|
|
110
|
+
// Layout is conditional on `mode`: 'answer' / 'excerpt' render as a
|
|
111
|
+
// small inline card (composable); 'full' renders fullbleed. The
|
|
112
|
+
// catalog entry omits the static `layout` flag — the runtime + prompt
|
|
113
|
+
// both consult the mode prop. See policy-detail.md for the rule.
|
|
114
|
+
defaultLayoutWeight: 1,
|
|
115
|
+
progressLabel: "Opening the policy",
|
|
116
|
+
requires: ["resolve:policy"]
|
|
117
|
+
},
|
|
118
|
+
infoCards: {
|
|
119
|
+
type: "infoCards",
|
|
120
|
+
propsSchema: infoCardsProps,
|
|
121
|
+
examples: infoCardsExamples,
|
|
122
|
+
layout: "fullbleed",
|
|
123
|
+
defaultLayoutWeight: 0,
|
|
124
|
+
defaultMaxHeight: "md",
|
|
125
|
+
progressLabel: "Laying out info cards"
|
|
126
|
+
},
|
|
127
|
+
collectionList: {
|
|
128
|
+
type: "collectionList",
|
|
129
|
+
propsSchema: collectionListProps,
|
|
130
|
+
examples: collectionListExamples,
|
|
131
|
+
layout: "fullbleed",
|
|
132
|
+
defaultLayoutWeight: 1,
|
|
133
|
+
progressLabel: "Mapping the categories",
|
|
134
|
+
requires: ["resolve:collection"]
|
|
135
|
+
},
|
|
136
|
+
faq: {
|
|
137
|
+
type: "faq",
|
|
138
|
+
propsSchema: faqProps,
|
|
139
|
+
examples: faqExamples,
|
|
140
|
+
layout: "fullbleed",
|
|
141
|
+
defaultLayoutWeight: 1,
|
|
142
|
+
progressLabel: "Listing the FAQ"
|
|
143
|
+
},
|
|
144
|
+
// ── Product ───────────────────────────────────────────────────────
|
|
145
|
+
// Action-parity (architecture-invariants §III.4): a component that wires a
|
|
146
|
+
// mutation affordance REQUIRES the affordance's action token, so a space
|
|
147
|
+
// whose provider can't back the button never composes the button — and the
|
|
148
|
+
// agent's verb set provably covers everything these surfaces let the
|
|
149
|
+
// visitor do.
|
|
150
|
+
productGrid: {
|
|
151
|
+
type: "productGrid",
|
|
152
|
+
propsSchema: productGridProps,
|
|
153
|
+
examples: productGridExamples,
|
|
154
|
+
layout: "fullbleed",
|
|
155
|
+
defaultLayoutWeight: 1,
|
|
156
|
+
progressLabel: "Laying out the picks",
|
|
157
|
+
// Cards quick-add to cart.
|
|
158
|
+
requires: ["resolve:product", "action:cart.add"]
|
|
159
|
+
},
|
|
160
|
+
productDetail: {
|
|
161
|
+
type: "productDetail",
|
|
162
|
+
propsSchema: productDetailProps,
|
|
163
|
+
examples: productDetailExamples,
|
|
164
|
+
layout: "fullbleed",
|
|
165
|
+
progressLabel: "Opening the details",
|
|
166
|
+
defaultLayoutWeight: 1,
|
|
167
|
+
// Add-to-bag, the wishlist heart, and the option picker.
|
|
168
|
+
requires: ["resolve:product", "action:cart.add", "action:wishlist.toggle", "action:product.select_option"]
|
|
169
|
+
},
|
|
170
|
+
comparisonTable: {
|
|
171
|
+
type: "comparisonTable",
|
|
172
|
+
propsSchema: comparisonTableProps,
|
|
173
|
+
examples: comparisonTableExamples,
|
|
174
|
+
layout: "fullbleed",
|
|
175
|
+
defaultLayoutWeight: 1,
|
|
176
|
+
progressLabel: "Setting up the comparison",
|
|
177
|
+
// Per-column add-to-bag cells.
|
|
178
|
+
requires: ["resolve:product", "action:cart.add"]
|
|
179
|
+
},
|
|
180
|
+
// ── Social ────────────────────────────────────────────────────────
|
|
181
|
+
reviews: {
|
|
182
|
+
type: "reviews",
|
|
183
|
+
propsSchema: reviewsProps,
|
|
184
|
+
examples: reviewsExamples,
|
|
185
|
+
layout: "fullbleed",
|
|
186
|
+
defaultLayoutWeight: 1,
|
|
187
|
+
progressLabel: "Pulling reviews"
|
|
188
|
+
},
|
|
189
|
+
testimonials: {
|
|
190
|
+
type: "testimonials",
|
|
191
|
+
propsSchema: testimonialsProps,
|
|
192
|
+
examples: testimonialsExamples,
|
|
193
|
+
layout: "fullbleed",
|
|
194
|
+
defaultLayoutWeight: 1,
|
|
195
|
+
progressLabel: "Pulling testimonials"
|
|
196
|
+
},
|
|
197
|
+
ugc: {
|
|
198
|
+
type: "ugc",
|
|
199
|
+
propsSchema: ugcProps,
|
|
200
|
+
examples: ugcExamples,
|
|
201
|
+
layout: "fullbleed",
|
|
202
|
+
defaultLayoutWeight: 1,
|
|
203
|
+
progressLabel: "Loading customer posts"
|
|
204
|
+
},
|
|
205
|
+
// ── Per-turn response wrappers ────────────────────────────────────
|
|
206
|
+
// These live IN the layout spec — emitted as elements alongside hero,
|
|
207
|
+
// grid, story, etc. They are the agent's response surface, not chat-shell
|
|
208
|
+
// chrome. The chat shell (composer pill) does not render prose when these
|
|
209
|
+
// components are part of the active layout.
|
|
210
|
+
agentText: {
|
|
211
|
+
type: "agentText",
|
|
212
|
+
propsSchema: agentTextProps,
|
|
213
|
+
examples: agentTextExamples,
|
|
214
|
+
layout: "fullbleed",
|
|
215
|
+
bindings: [
|
|
216
|
+
// Streaming agent prose flows into `text`. LLM emits an empty
|
|
217
|
+
// agentText; this binding accumulates deltas as they arrive.
|
|
218
|
+
{ source: "signal:text.delta", prop: "text", accumulate: "concat-text" },
|
|
219
|
+
// Final non-streamed text replaces the streamed accumulator.
|
|
220
|
+
{ source: "signal:text.done", prop: "text", accumulate: "replace" }
|
|
221
|
+
]
|
|
222
|
+
},
|
|
223
|
+
turn: {
|
|
224
|
+
type: "turn",
|
|
225
|
+
propsSchema: turnProps,
|
|
226
|
+
examples: turnExamples,
|
|
227
|
+
layout: "fullbleed",
|
|
228
|
+
defaultLayoutWeight: 0,
|
|
229
|
+
bindings: [
|
|
230
|
+
// The user's prompt is part of session state; SDK injects it into
|
|
231
|
+
// the turn wrapper. LLM never repeats it in the YAML.
|
|
232
|
+
{ source: "session.lastUserMessage", prop: "prompt", accumulate: "replace" }
|
|
233
|
+
]
|
|
234
|
+
}
|
|
235
|
+
};
|
|
236
|
+
|
|
237
|
+
export {
|
|
238
|
+
catalog
|
|
239
|
+
};
|
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
// src/agent/AgentStreamingState.tsx
|
|
4
|
+
import * as React from "react";
|
|
5
|
+
import { useFourtySession } from "@40rty/ams-sdk";
|
|
6
|
+
|
|
7
|
+
// src/agent/phase-label.ts
|
|
8
|
+
var PHASE_LABELS = {};
|
|
9
|
+
function defaultPhaseLabel(progress) {
|
|
10
|
+
if (progress === null) return null;
|
|
11
|
+
if (typeof progress.label === "string" && progress.label.length > 0) return progress.label;
|
|
12
|
+
const mapped = PHASE_LABELS[progress.phase];
|
|
13
|
+
if (typeof mapped === "string") return mapped;
|
|
14
|
+
return null;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
// src/agent/AgentStreamingState.tsx
|
|
18
|
+
import { Fragment, jsx } from "react/jsx-runtime";
|
|
19
|
+
function AgentStreamingState({ children }) {
|
|
20
|
+
const { currentProgress, reasoningText } = useFourtySession();
|
|
21
|
+
const state = React.useMemo(() => {
|
|
22
|
+
if (currentProgress === null) {
|
|
23
|
+
return {
|
|
24
|
+
progress: null,
|
|
25
|
+
label: null,
|
|
26
|
+
phase: null,
|
|
27
|
+
description: null,
|
|
28
|
+
count: null,
|
|
29
|
+
percent: null,
|
|
30
|
+
previews: [],
|
|
31
|
+
hasProgress: false,
|
|
32
|
+
reasoningText,
|
|
33
|
+
hasReasoning: reasoningText.length > 0
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
return {
|
|
37
|
+
progress: currentProgress,
|
|
38
|
+
label: defaultPhaseLabel(currentProgress),
|
|
39
|
+
phase: currentProgress.phase,
|
|
40
|
+
description: typeof currentProgress.description === "string" && currentProgress.description.length > 0 ? currentProgress.description : null,
|
|
41
|
+
count: currentProgress.count !== void 0 ? currentProgress.count : null,
|
|
42
|
+
percent: typeof currentProgress.percent === "number" ? currentProgress.percent : null,
|
|
43
|
+
previews: Array.isArray(currentProgress.previews) ? currentProgress.previews : [],
|
|
44
|
+
hasProgress: true,
|
|
45
|
+
reasoningText,
|
|
46
|
+
hasReasoning: reasoningText.length > 0
|
|
47
|
+
};
|
|
48
|
+
}, [currentProgress, reasoningText]);
|
|
49
|
+
return /* @__PURE__ */ jsx(Fragment, { children: children(state) });
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
// src/agent/ProseSurface.tsx
|
|
53
|
+
import * as React2 from "react";
|
|
54
|
+
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
55
|
+
var Streamdown = React2.lazy(async () => {
|
|
56
|
+
const mod = await import("streamdown");
|
|
57
|
+
return { default: mod.Streamdown };
|
|
58
|
+
});
|
|
59
|
+
var warmed = false;
|
|
60
|
+
function warmStreamdown() {
|
|
61
|
+
if (warmed) return;
|
|
62
|
+
warmed = true;
|
|
63
|
+
const load = () => {
|
|
64
|
+
void import("streamdown").catch((err) => {
|
|
65
|
+
console.warn("[ProseSurface] streamdown warm-up failed:", err);
|
|
66
|
+
});
|
|
67
|
+
};
|
|
68
|
+
if (typeof requestIdleCallback === "function") requestIdleCallback(load, { timeout: 2e3 });
|
|
69
|
+
else setTimeout(load, 0);
|
|
70
|
+
}
|
|
71
|
+
function ProseFallback({ text }) {
|
|
72
|
+
return /* @__PURE__ */ jsx2("div", { className: "whitespace-pre-wrap", children: text });
|
|
73
|
+
}
|
|
74
|
+
var ProseSurface = ({
|
|
75
|
+
text,
|
|
76
|
+
streaming = false,
|
|
77
|
+
className = "agent-md"
|
|
78
|
+
}) => {
|
|
79
|
+
React2.useEffect(() => {
|
|
80
|
+
warmStreamdown();
|
|
81
|
+
}, []);
|
|
82
|
+
if (text.length === 0) return null;
|
|
83
|
+
return /* @__PURE__ */ jsx2("div", { className, children: /* @__PURE__ */ jsx2(React2.Suspense, { fallback: /* @__PURE__ */ jsx2(ProseFallback, { text }), children: /* @__PURE__ */ jsx2(
|
|
84
|
+
Streamdown,
|
|
85
|
+
{
|
|
86
|
+
mode: streaming ? "streaming" : "static",
|
|
87
|
+
isAnimating: streaming,
|
|
88
|
+
animated: { animation: "fadeIn", sep: "word", duration: 260 },
|
|
89
|
+
caret: "block",
|
|
90
|
+
controls: false,
|
|
91
|
+
lineNumbers: false,
|
|
92
|
+
children: text
|
|
93
|
+
}
|
|
94
|
+
) }) });
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
// src/agent/index.ts
|
|
98
|
+
import { renderInline as renderInline2 } from "@40rty/ams-sdk";
|
|
99
|
+
|
|
100
|
+
// src/components/agentic/AgentText.tsx
|
|
101
|
+
import React3 from "react";
|
|
102
|
+
import { useStream, renderInline } from "@40rty/ams-sdk";
|
|
103
|
+
import { jsx as jsx3 } from "react/jsx-runtime";
|
|
104
|
+
function sanitizeProse(raw) {
|
|
105
|
+
return raw.replace(/[ \t]{2,}/g, " ").replace(/\n{3,}/g, "\n\n");
|
|
106
|
+
}
|
|
107
|
+
function normalizeInlineBullets(text) {
|
|
108
|
+
return text.replace(/(\*\*|: |\.\s|;\s)\s*([*-])\s+\*\*/g, "$1\n$2 **");
|
|
109
|
+
}
|
|
110
|
+
function blockifyProse(text) {
|
|
111
|
+
const blocks = [];
|
|
112
|
+
const lines = normalizeInlineBullets(text).split("\n");
|
|
113
|
+
let paraBuf = [];
|
|
114
|
+
let listBuf = [];
|
|
115
|
+
let key = 0;
|
|
116
|
+
const flushPara = () => {
|
|
117
|
+
if (paraBuf.length === 0) return;
|
|
118
|
+
blocks.push(/* @__PURE__ */ jsx3("p", { className: "agent-prose", children: renderInline(paraBuf.join(" ").trim(), `p${key}`) }, `p-${key++}`));
|
|
119
|
+
paraBuf = [];
|
|
120
|
+
};
|
|
121
|
+
const flushList = () => {
|
|
122
|
+
if (listBuf.length === 0) return;
|
|
123
|
+
blocks.push(
|
|
124
|
+
/* @__PURE__ */ jsx3("ul", { className: "agent-prose-list", children: listBuf.map((it, i) => /* @__PURE__ */ jsx3("li", { children: renderInline(it, `u${key}-${i}`) }, i)) }, `u-${key++}`)
|
|
125
|
+
);
|
|
126
|
+
listBuf = [];
|
|
127
|
+
};
|
|
128
|
+
for (const rawLine of lines) {
|
|
129
|
+
const line = rawLine.trim();
|
|
130
|
+
if (line.length === 0) {
|
|
131
|
+
flushPara();
|
|
132
|
+
flushList();
|
|
133
|
+
continue;
|
|
134
|
+
}
|
|
135
|
+
const bullet = /^[*-]\s+(.*)$/.exec(line);
|
|
136
|
+
if (bullet) {
|
|
137
|
+
flushPara();
|
|
138
|
+
listBuf.push(bullet[1]);
|
|
139
|
+
} else {
|
|
140
|
+
flushList();
|
|
141
|
+
paraBuf.push(line);
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
flushPara();
|
|
145
|
+
flushList();
|
|
146
|
+
return blocks;
|
|
147
|
+
}
|
|
148
|
+
var AgentText = ({ text, parts }) => {
|
|
149
|
+
const streamProse = useStream("prose");
|
|
150
|
+
const effectiveText = typeof text === "string" && text.length > 0 ? text : streamProse;
|
|
151
|
+
const hasParts = Array.isArray(parts) && parts.length > 0;
|
|
152
|
+
const hasText = effectiveText.length > 0;
|
|
153
|
+
if (!hasParts && !hasText) return null;
|
|
154
|
+
if (hasParts) {
|
|
155
|
+
return /* @__PURE__ */ jsx3("div", { className: "agent-text", children: /* @__PURE__ */ jsx3("p", { className: "agent-prose agent-prose--lede", children: parts.map(
|
|
156
|
+
(part, i) => part.type === "em" ? /* @__PURE__ */ jsx3("span", { className: "em-h", children: part.value }, i) : /* @__PURE__ */ jsx3(React3.Fragment, { children: part.value }, i)
|
|
157
|
+
) }) });
|
|
158
|
+
}
|
|
159
|
+
const sanitized = sanitizeProse(effectiveText);
|
|
160
|
+
return /* @__PURE__ */ jsx3("div", { className: "agent-text", children: blockifyProse(sanitized) });
|
|
161
|
+
};
|
|
162
|
+
var AgentText_default = AgentText;
|
|
163
|
+
|
|
164
|
+
export {
|
|
165
|
+
renderInline,
|
|
166
|
+
sanitizeProse,
|
|
167
|
+
blockifyProse,
|
|
168
|
+
AgentText_default,
|
|
169
|
+
defaultPhaseLabel,
|
|
170
|
+
AgentStreamingState,
|
|
171
|
+
ProseSurface,
|
|
172
|
+
renderInline2
|
|
173
|
+
};
|
|
@@ -0,0 +1,226 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
// src/utils/cn.ts
|
|
4
|
+
import { clsx } from "clsx";
|
|
5
|
+
import { twMerge } from "tailwind-merge";
|
|
6
|
+
function cn(...inputs) {
|
|
7
|
+
return twMerge(clsx(inputs));
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
// src/shell/Spinner.tsx
|
|
11
|
+
import { motion } from "framer-motion";
|
|
12
|
+
import { jsx } from "react/jsx-runtime";
|
|
13
|
+
function Spinner({ size = 14 }) {
|
|
14
|
+
return /* @__PURE__ */ jsx(
|
|
15
|
+
motion.span,
|
|
16
|
+
{
|
|
17
|
+
"aria-hidden": "true",
|
|
18
|
+
animate: { rotate: 360 },
|
|
19
|
+
transition: { duration: 0.6, repeat: Infinity, ease: "linear" },
|
|
20
|
+
style: {
|
|
21
|
+
display: "inline-block",
|
|
22
|
+
width: size,
|
|
23
|
+
height: size,
|
|
24
|
+
border: "2px solid currentColor",
|
|
25
|
+
borderRightColor: "transparent",
|
|
26
|
+
borderRadius: "50%",
|
|
27
|
+
verticalAlign: "middle"
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
// src/hooks/use-media-query.ts
|
|
34
|
+
import { useState, useEffect } from "react";
|
|
35
|
+
import { useViewportWindow } from "@40rty/ams-sdk";
|
|
36
|
+
function useMediaQuery(query) {
|
|
37
|
+
const win = useViewportWindow();
|
|
38
|
+
const [matches, setMatches] = useState(false);
|
|
39
|
+
useEffect(() => {
|
|
40
|
+
if (win === null) return;
|
|
41
|
+
const mql = win.matchMedia(query);
|
|
42
|
+
setMatches(mql.matches);
|
|
43
|
+
const handler = (e) => setMatches(e.matches);
|
|
44
|
+
mql.addEventListener("change", handler);
|
|
45
|
+
return () => mql.removeEventListener("change", handler);
|
|
46
|
+
}, [query, win]);
|
|
47
|
+
return matches;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
// src/hooks/use-scroll-lock.ts
|
|
51
|
+
import { useEffect as useEffect2 } from "react";
|
|
52
|
+
var holders = /* @__PURE__ */ new Set();
|
|
53
|
+
var restoreOverflow = null;
|
|
54
|
+
function useScrollLock(locked, anchorRef) {
|
|
55
|
+
useEffect2(() => {
|
|
56
|
+
if (!locked) return;
|
|
57
|
+
const node = anchorRef.current;
|
|
58
|
+
if (node === null) return;
|
|
59
|
+
const root = node.ownerDocument.documentElement;
|
|
60
|
+
const holder = /* @__PURE__ */ Symbol("scroll-lock");
|
|
61
|
+
if (holders.size === 0) {
|
|
62
|
+
restoreOverflow = root.style.overflow;
|
|
63
|
+
root.style.overflow = "hidden";
|
|
64
|
+
}
|
|
65
|
+
holders.add(holder);
|
|
66
|
+
return () => {
|
|
67
|
+
holders.delete(holder);
|
|
68
|
+
if (holders.size > 0) return;
|
|
69
|
+
root.style.overflow = restoreOverflow === null ? "" : restoreOverflow;
|
|
70
|
+
restoreOverflow = null;
|
|
71
|
+
};
|
|
72
|
+
}, [locked, anchorRef]);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
// src/shell/DragSheet.tsx
|
|
76
|
+
import * as React from "react";
|
|
77
|
+
import { motion as motion2, AnimatePresence, useDragControls, useReducedMotion } from "framer-motion";
|
|
78
|
+
import { jsx as jsx2, jsxs } from "react/jsx-runtime";
|
|
79
|
+
var ROOT_CLASS = "fourty-drag-sheet";
|
|
80
|
+
var SCRIM_CLASS = "fourty-drag-sheet__scrim";
|
|
81
|
+
var PANEL_CLASS = "fourty-drag-sheet__panel";
|
|
82
|
+
var HANDLE_CLASS = "fourty-drag-sheet__handle";
|
|
83
|
+
var GRIP_CLASS = "fourty-drag-sheet__grip";
|
|
84
|
+
var BODY_CLASS = "fourty-drag-sheet__body";
|
|
85
|
+
var SPRING = { type: "spring", stiffness: 360, damping: 38, mass: 0.9 };
|
|
86
|
+
var DISMISS_OFFSET = 120;
|
|
87
|
+
var DISMISS_VELOCITY = 620;
|
|
88
|
+
var EXPAND_OFFSET = 56;
|
|
89
|
+
var EXPAND_VELOCITY = 460;
|
|
90
|
+
var DEFAULT_HEIGHT_FRACTION = 0.72;
|
|
91
|
+
var FULL_HEIGHT = "100dvh";
|
|
92
|
+
var HEIGHT_EASE = "cubic-bezier(0.22, 1, 0.36, 1)";
|
|
93
|
+
function DragSheet({
|
|
94
|
+
open,
|
|
95
|
+
onClose,
|
|
96
|
+
label,
|
|
97
|
+
heightFraction = DEFAULT_HEIGHT_FRACTION,
|
|
98
|
+
fit = false,
|
|
99
|
+
className,
|
|
100
|
+
children
|
|
101
|
+
}) {
|
|
102
|
+
const reduceMotion = useReducedMotion() === true;
|
|
103
|
+
const dragControls = useDragControls();
|
|
104
|
+
const [detent, setDetent] = React.useState("default");
|
|
105
|
+
React.useEffect(() => {
|
|
106
|
+
if (open) setDetent("default");
|
|
107
|
+
}, [open]);
|
|
108
|
+
const startDrag = (e) => {
|
|
109
|
+
dragControls.start(e);
|
|
110
|
+
};
|
|
111
|
+
const onGripDragEnd = (offsetY, velocityY) => {
|
|
112
|
+
if (offsetY < -EXPAND_OFFSET || velocityY < -EXPAND_VELOCITY) {
|
|
113
|
+
if (detent === "default") setDetent("full");
|
|
114
|
+
return;
|
|
115
|
+
}
|
|
116
|
+
if (offsetY > DISMISS_OFFSET || velocityY > DISMISS_VELOCITY) {
|
|
117
|
+
if (detent === "full") setDetent("default");
|
|
118
|
+
else onClose();
|
|
119
|
+
}
|
|
120
|
+
};
|
|
121
|
+
const isFull = detent === "full";
|
|
122
|
+
const detentMax = `calc(${heightFraction} * 100dvh)`;
|
|
123
|
+
const panelHeight = isFull ? FULL_HEIGHT : fit ? "auto" : detentMax;
|
|
124
|
+
const panelMaxHeight = isFull ? FULL_HEIGHT : detentMax;
|
|
125
|
+
return /* @__PURE__ */ jsx2(AnimatePresence, { children: open && // Fixed, viewport-sized containing block for the scrim + panel below.
|
|
126
|
+
// Both are `position: absolute`, so without a positioned root they'd
|
|
127
|
+
// resolve to whatever ancestor happens to be positioned — on the mobile
|
|
128
|
+
// shell that's the tall, `position: relative` document-scroll root, which
|
|
129
|
+
// pins the panel's `bottom: 0` to the bottom of the whole page (not the
|
|
130
|
+
// viewport) and lets the canvas bleed through the scrim. `fixed` here is
|
|
131
|
+
// the same viewport-pin the MorphIsland uses; `z-index` matches the
|
|
132
|
+
// desktop modal (above the island at 60 and the chrome at 50).
|
|
133
|
+
/* @__PURE__ */ jsxs("div", { className: ROOT_CLASS, style: { position: "fixed", inset: 0, zIndex: 80 }, children: [
|
|
134
|
+
/* @__PURE__ */ jsx2(
|
|
135
|
+
motion2.div,
|
|
136
|
+
{
|
|
137
|
+
"aria-hidden": "true",
|
|
138
|
+
className: SCRIM_CLASS,
|
|
139
|
+
onClick: onClose,
|
|
140
|
+
initial: { opacity: 0 },
|
|
141
|
+
animate: { opacity: 0.4 },
|
|
142
|
+
exit: { opacity: 0 },
|
|
143
|
+
transition: { duration: 0.2 },
|
|
144
|
+
style: { position: "absolute", inset: 0, background: "#121212", zIndex: 70 }
|
|
145
|
+
}
|
|
146
|
+
),
|
|
147
|
+
/* @__PURE__ */ jsxs(
|
|
148
|
+
motion2.div,
|
|
149
|
+
{
|
|
150
|
+
role: "dialog",
|
|
151
|
+
"aria-label": label,
|
|
152
|
+
"aria-modal": "true",
|
|
153
|
+
className: cn(PANEL_CLASS, className),
|
|
154
|
+
initial: reduceMotion ? { opacity: 0 } : { y: "100%" },
|
|
155
|
+
animate: reduceMotion ? { opacity: 1 } : { y: 0 },
|
|
156
|
+
exit: reduceMotion ? { opacity: 0 } : { y: "100%" },
|
|
157
|
+
transition: SPRING,
|
|
158
|
+
drag: reduceMotion ? false : "y",
|
|
159
|
+
dragControls,
|
|
160
|
+
dragListener: false,
|
|
161
|
+
dragConstraints: { top: 0, bottom: 0 },
|
|
162
|
+
dragElastic: { top: detent === "full" ? 0 : 0.35, bottom: 0.6 },
|
|
163
|
+
dragMomentum: false,
|
|
164
|
+
onDragEnd: (_e, info) => onGripDragEnd(info.offset.y, info.velocity.y),
|
|
165
|
+
style: {
|
|
166
|
+
position: "absolute",
|
|
167
|
+
left: 0,
|
|
168
|
+
right: 0,
|
|
169
|
+
bottom: 0,
|
|
170
|
+
height: panelHeight,
|
|
171
|
+
maxHeight: panelMaxHeight,
|
|
172
|
+
// The detent snap rides a CSS height transition (bottom-pinned so the
|
|
173
|
+
// composer stays on screen); framer owns only the transform track, so
|
|
174
|
+
// the two never contend for the same property.
|
|
175
|
+
transition: `height 320ms ${HEIGHT_EASE}`,
|
|
176
|
+
zIndex: 71,
|
|
177
|
+
display: "flex",
|
|
178
|
+
flexDirection: "column",
|
|
179
|
+
overflow: "hidden",
|
|
180
|
+
// Brand-themable surface (SM = white). Radius / shadow / border are
|
|
181
|
+
// STATIC CSS on the class hooks — never animated.
|
|
182
|
+
background: "var(--fourty-sheet-bg, var(--color-surface))"
|
|
183
|
+
},
|
|
184
|
+
children: [
|
|
185
|
+
/* @__PURE__ */ jsx2(
|
|
186
|
+
"div",
|
|
187
|
+
{
|
|
188
|
+
className: HANDLE_CLASS,
|
|
189
|
+
onPointerDown: startDrag,
|
|
190
|
+
style: {
|
|
191
|
+
flex: "0 0 auto",
|
|
192
|
+
display: "flex",
|
|
193
|
+
justifyContent: "center",
|
|
194
|
+
padding: "10px 0 6px",
|
|
195
|
+
cursor: "grab",
|
|
196
|
+
touchAction: "none"
|
|
197
|
+
},
|
|
198
|
+
children: /* @__PURE__ */ jsx2(
|
|
199
|
+
"div",
|
|
200
|
+
{
|
|
201
|
+
className: GRIP_CLASS,
|
|
202
|
+
style: {
|
|
203
|
+
width: 40,
|
|
204
|
+
height: 4,
|
|
205
|
+
borderRadius: 999,
|
|
206
|
+
background: "var(--fourty-sheet-handle, var(--color-text))",
|
|
207
|
+
opacity: 0.32
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
)
|
|
211
|
+
}
|
|
212
|
+
),
|
|
213
|
+
/* @__PURE__ */ jsx2("div", { className: BODY_CLASS, style: { position: "relative", flex: 1, minHeight: 0, display: "flex", flexDirection: "column" }, children })
|
|
214
|
+
]
|
|
215
|
+
}
|
|
216
|
+
)
|
|
217
|
+
] }, "drag-sheet") });
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
export {
|
|
221
|
+
cn,
|
|
222
|
+
Spinner,
|
|
223
|
+
useMediaQuery,
|
|
224
|
+
useScrollLock,
|
|
225
|
+
DragSheet
|
|
226
|
+
};
|