@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.
Files changed (299) hide show
  1. package/dist/agent.js +148 -0
  2. package/dist/catalog-data.js +93 -0
  3. package/dist/catalog-entries.js +8 -0
  4. package/dist/chunk-432XYPDT.js +1012 -0
  5. package/dist/chunk-54QPRWEG.js +2800 -0
  6. package/dist/chunk-CKGGECAQ.js +239 -0
  7. package/dist/chunk-E3IJDSKY.js +173 -0
  8. package/dist/chunk-JQNZ5UUK.js +226 -0
  9. package/dist/chunk-LQLOG2V3.js +649 -0
  10. package/dist/chunk-MHUEIBJ3.js +117 -0
  11. package/dist/chunk-ORIOBWTD.js +112 -0
  12. package/dist/css/preset/motion.css +78 -0
  13. package/dist/css/preset/tailwind-theme.css +163 -0
  14. package/dist/css/shell/mobile/island.css +478 -0
  15. package/dist/hooks.js +25 -0
  16. package/dist/index.js +7165 -0
  17. package/dist/motion.js +113 -0
  18. package/dist/shell.js +5621 -0
  19. package/dist/types/agent/AgentStreamingState.d.ts +58 -0
  20. package/dist/types/agent/ProseSurface.d.ts +31 -0
  21. package/dist/types/agent/index.d.ts +8 -0
  22. package/dist/types/agent/phase-label.d.ts +13 -0
  23. package/dist/types/agent/presence/AgentPresenceWidget.d.ts +85 -0
  24. package/dist/types/agent/presence/BriefIdentity.d.ts +9 -0
  25. package/dist/types/agent/presence/CompactRead.d.ts +44 -0
  26. package/dist/types/agent/presence/CriteriaRail.d.ts +68 -0
  27. package/dist/types/agent/presence/DefaultNotch.d.ts +2 -0
  28. package/dist/types/agent/presence/FactChip.d.ts +10 -0
  29. package/dist/types/agent/presence/InlinePresenceRead.d.ts +25 -0
  30. package/dist/types/agent/presence/KnowledgePeek.d.ts +23 -0
  31. package/dist/types/agent/presence/LayoutMorphSkeleton.d.ts +59 -0
  32. package/dist/types/agent/presence/PresenceBrief.d.ts +29 -0
  33. package/dist/types/agent/presence/PresenceFiller.d.ts +24 -0
  34. package/dist/types/agent/presence/SourceSift.d.ts +48 -0
  35. package/dist/types/agent/presence/StreamRead.d.ts +50 -0
  36. package/dist/types/agent/presence/VoiceLine.d.ts +19 -0
  37. package/dist/types/agent/presence/band-beat.d.ts +40 -0
  38. package/dist/types/agent/presence/band-row.d.ts +188 -0
  39. package/dist/types/agent/presence/cite-image.d.ts +9 -0
  40. package/dist/types/agent/presence/class-names.d.ts +134 -0
  41. package/dist/types/agent/presence/element-view.d.ts +83 -0
  42. package/dist/types/agent/presence/fact-forms/baseline-forms.d.ts +20 -0
  43. package/dist/types/agent/presence/fact-forms/class-names.d.ts +14 -0
  44. package/dist/types/agent/presence/fact-forms/index.d.ts +3 -0
  45. package/dist/types/agent/presence/fact-forms/register.d.ts +9 -0
  46. package/dist/types/agent/presence/fact-rail.d.ts +76 -0
  47. package/dist/types/agent/presence/fact-slots.d.ts +97 -0
  48. package/dist/types/agent/presence/folded.d.ts +26 -0
  49. package/dist/types/agent/presence/forms.d.ts +5 -0
  50. package/dist/types/agent/presence/index.d.ts +39 -0
  51. package/dist/types/agent/presence/notch/PresenceNotch.d.ts +20 -0
  52. package/dist/types/agent/presence/parts.d.ts +29 -0
  53. package/dist/types/agent/presence/read-data.d.ts +48 -0
  54. package/dist/types/agent/presence/reads.d.ts +37 -0
  55. package/dist/types/agent/presence/sift-deck.d.ts +58 -0
  56. package/dist/types/agent/presence/source-cards/ArticleSourceCard.d.ts +4 -0
  57. package/dist/types/agent/presence/source-cards/CollectionSourceCard.d.ts +4 -0
  58. package/dist/types/agent/presence/source-cards/PolicySourceCard.d.ts +4 -0
  59. package/dist/types/agent/presence/source-cards/ProductSourceCard.d.ts +4 -0
  60. package/dist/types/agent/presence/source-cards/ReviewSourceCard.d.ts +4 -0
  61. package/dist/types/agent/presence/source-cards/SourceCard.d.ts +4 -0
  62. package/dist/types/agent/presence/source-cards/card-frame.d.ts +38 -0
  63. package/dist/types/agent/presence/source-cards/card-marks.d.ts +69 -0
  64. package/dist/types/agent/presence/source-cards/card-plate.d.ts +20 -0
  65. package/dist/types/agent/presence/source-cards/card-shell.d.ts +91 -0
  66. package/dist/types/agent/presence/source-cards/register.d.ts +6 -0
  67. package/dist/types/agent/presence/source-cards/review-passage.d.ts +53 -0
  68. package/dist/types/agent/presence/swatch.d.ts +4 -0
  69. package/dist/types/agent/presence/use-band-facts.d.ts +9 -0
  70. package/dist/types/agent/presence/use-forget-fact.d.ts +56 -0
  71. package/dist/types/agent/presence/use-measured-height.d.ts +11 -0
  72. package/dist/types/catalog-data/base.d.ts +2 -0
  73. package/dist/types/catalog-data/chat.d.ts +55 -0
  74. package/dist/types/catalog-data/content.d.ts +1129 -0
  75. package/dist/types/catalog-data/ecommerce.d.ts +4842 -0
  76. package/dist/types/catalog-data/index.d.ts +7 -0
  77. package/dist/types/catalog-data/social.d.ts +1552 -0
  78. package/dist/types/catalog-data/tokens.d.ts +20 -0
  79. package/dist/types/catalog-data/ugc.d.ts +50 -0
  80. package/dist/types/catalog-entries.d.ts +35 -0
  81. package/dist/types/catalog.d.ts +18 -0
  82. package/dist/types/components/SkeletonSwap.d.ts +27 -0
  83. package/dist/types/components/agentic/AgentText.d.ts +44 -0
  84. package/dist/types/components/agentic/Turn.d.ts +21 -0
  85. package/dist/types/components/browse/CanvasBootLoader.d.ts +16 -0
  86. package/dist/types/components/browse/ContinuationLoading.d.ts +22 -0
  87. package/dist/types/components/browse/canvas-booting.d.ts +37 -0
  88. package/dist/types/components/browse/constants.d.ts +2 -0
  89. package/dist/types/components/browse/index.d.ts +4 -0
  90. package/dist/types/components/chat/SuggestionCards.d.ts +2 -0
  91. package/dist/types/components/chat/index.d.ts +1 -0
  92. package/dist/types/components/content/FAQ.d.ts +12 -0
  93. package/dist/types/components/content/FeatureGrid.d.ts +11 -0
  94. package/dist/types/components/content/InfoCards.d.ts +16 -0
  95. package/dist/types/components/content/Reviews.d.ts +9 -0
  96. package/dist/types/components/content/RichText.d.ts +10 -0
  97. package/dist/types/components/content/article/ArticleDetail.d.ts +15 -0
  98. package/dist/types/components/content/article/BlogCard.d.ts +11 -0
  99. package/dist/types/components/content/article/BlogPosts.d.ts +19 -0
  100. package/dist/types/components/content/page/PageDetail.d.ts +13 -0
  101. package/dist/types/components/content/page/PolicyDetail.d.ts +23 -0
  102. package/dist/types/components/ecommerce/cart/AddToCartButton.d.ts +9 -0
  103. package/dist/types/components/ecommerce/cart/CartContent.d.ts +40 -0
  104. package/dist/types/components/ecommerce/cart/CartDrawer.d.ts +41 -0
  105. package/dist/types/components/ecommerce/cart/CartFoot.d.ts +30 -0
  106. package/dist/types/components/ecommerce/cart/CartLineItem.d.ts +13 -0
  107. package/dist/types/components/ecommerce/cart/CartLineRow.d.ts +17 -0
  108. package/dist/types/components/ecommerce/cart/CartPromoCode.d.ts +29 -0
  109. package/dist/types/components/ecommerce/cart/CartSummary.d.ts +7 -0
  110. package/dist/types/components/ecommerce/cart/CartWidget.d.ts +10 -0
  111. package/dist/types/components/ecommerce/cart/VariantPickerModal.d.ts +12 -0
  112. package/dist/types/components/ecommerce/cart/cart-format.d.ts +8 -0
  113. package/dist/types/components/ecommerce/cart/use-cart-view.d.ts +50 -0
  114. package/dist/types/components/ecommerce/collection/CollectionCard.d.ts +10 -0
  115. package/dist/types/components/ecommerce/collection/CollectionGrid.d.ts +8 -0
  116. package/dist/types/components/ecommerce/collection/CollectionList.d.ts +13 -0
  117. package/dist/types/components/ecommerce/collection/internal/CollectionListItem.d.ts +13 -0
  118. package/dist/types/components/ecommerce/product/AddToRegistry.d.ts +36 -0
  119. package/dist/types/components/ecommerce/product/ComparisonTable.d.ts +25 -0
  120. package/dist/types/components/ecommerce/product/ComparisonTableSkeleton.d.ts +11 -0
  121. package/dist/types/components/ecommerce/product/PresenceProductRail.d.ts +35 -0
  122. package/dist/types/components/ecommerce/product/ProductBadge.d.ts +9 -0
  123. package/dist/types/components/ecommerce/product/ProductCard.d.ts +27 -0
  124. package/dist/types/components/ecommerce/product/ProductDetail.d.ts +25 -0
  125. package/dist/types/components/ecommerce/product/ProductGallery.d.ts +19 -0
  126. package/dist/types/components/ecommerce/product/ProductGrid.d.ts +26 -0
  127. package/dist/types/components/ecommerce/product/ProductImage.d.ts +54 -0
  128. package/dist/types/components/ecommerce/product/ProductOption.d.ts +9 -0
  129. package/dist/types/components/ecommerce/product/ProductPrice.d.ts +8 -0
  130. package/dist/types/components/ecommerce/product/ProductVideoPlayer.d.ts +17 -0
  131. package/dist/types/components/ecommerce/product/comparison-table-parts.d.ts +41 -0
  132. package/dist/types/components/ecommerce/product/comparison-table-rows.d.ts +24 -0
  133. package/dist/types/components/ecommerce/product/image-trim.d.ts +35 -0
  134. package/dist/types/components/ecommerce/product/product-card-glyphs.d.ts +2 -0
  135. package/dist/types/components/ecommerce/product/registry-logos.d.ts +2 -0
  136. package/dist/types/components/ecommerce/product/trim-geometry.d.ts +45 -0
  137. package/dist/types/components/ecommerce/wishlist/WishlistDrawer.d.ts +16 -0
  138. package/dist/types/components/feedback/Skeleton.d.ts +13 -0
  139. package/dist/types/components/feedback/Thinking.d.ts +15 -0
  140. package/dist/types/components/layout/AspectRatio.d.ts +5 -0
  141. package/dist/types/components/layout/Backdrop.d.ts +32 -0
  142. package/dist/types/components/layout/Container.d.ts +6 -0
  143. package/dist/types/components/layout/Divider.d.ts +5 -0
  144. package/dist/types/components/layout/Drawer.d.ts +9 -0
  145. package/dist/types/components/layout/DrawerDockSlot.d.ts +40 -0
  146. package/dist/types/components/layout/Grid.d.ts +8 -0
  147. package/dist/types/components/layout/Modal.d.ts +25 -0
  148. package/dist/types/components/layout/Page.d.ts +11 -0
  149. package/dist/types/components/layout/Section.d.ts +6 -0
  150. package/dist/types/components/layout/Stack.d.ts +7 -0
  151. package/dist/types/components/marketing/AnnouncementBar.d.ts +15 -0
  152. package/dist/types/components/marketing/BrandStory.d.ts +19 -0
  153. package/dist/types/components/marketing/HeroBanner.d.ts +69 -0
  154. package/dist/types/components/marketing/HeroBannerFeatures.d.ts +10 -0
  155. package/dist/types/components/marketing/HeroBannerInline.d.ts +20 -0
  156. package/dist/types/components/marketing/PromoBanner.d.ts +11 -0
  157. package/dist/types/components/marketing/internal/AnnouncementLink.d.ts +5 -0
  158. package/dist/types/components/marketing/internal/AnnouncementMessage.d.ts +10 -0
  159. package/dist/types/components/navigation/Breadcrumbs.d.ts +10 -0
  160. package/dist/types/components/navigation/Footer.d.ts +15 -0
  161. package/dist/types/components/navigation/Header.d.ts +14 -0
  162. package/dist/types/components/navigation/internal/BreadcrumbLink.d.ts +5 -0
  163. package/dist/types/components/navigation/internal/FooterLink.d.ts +5 -0
  164. package/dist/types/components/navigation/internal/HeaderLink.d.ts +5 -0
  165. package/dist/types/components/shell/BaseMark.d.ts +11 -0
  166. package/dist/types/components/shell/CartPill.d.ts +13 -0
  167. package/dist/types/components/shell/ComposerDock.d.ts +9 -0
  168. package/dist/types/components/shell/ErrorBanner.d.ts +14 -0
  169. package/dist/types/components/shell/HistoryMenu.d.ts +15 -0
  170. package/dist/types/components/shell/MenuButton.d.ts +31 -0
  171. package/dist/types/components/shell/MountainRidges.d.ts +11 -0
  172. package/dist/types/components/shell/PendingTurn.d.ts +1 -0
  173. package/dist/types/components/shell/ShellTop.d.ts +35 -0
  174. package/dist/types/components/shell/brand-shell.d.ts +441 -0
  175. package/dist/types/components/shell/index.d.ts +9 -0
  176. package/dist/types/components/shell/marks/index.d.ts +5 -0
  177. package/dist/types/components/social/ReviewCard.d.ts +9 -0
  178. package/dist/types/components/social/ReviewSummary.d.ts +7 -0
  179. package/dist/types/components/social/TestimonialCard.d.ts +9 -0
  180. package/dist/types/components/social/TestimonialCarousel.d.ts +16 -0
  181. package/dist/types/components/social/UgcCard.d.ts +9 -0
  182. package/dist/types/components/social/UgcGallery.d.ts +8 -0
  183. package/dist/types/hooks/index.d.ts +8 -0
  184. package/dist/types/hooks/keyboard.d.ts +18 -0
  185. package/dist/types/hooks/use-container-width.d.ts +11 -0
  186. package/dist/types/hooks/use-dismiss-on-outside.d.ts +23 -0
  187. package/dist/types/hooks/use-focus-on-change.d.ts +8 -0
  188. package/dist/types/hooks/use-focus-trap.d.ts +12 -0
  189. package/dist/types/hooks/use-media-query.d.ts +12 -0
  190. package/dist/types/hooks/use-projection.d.ts +24 -0
  191. package/dist/types/hooks/use-reduced-motion.d.ts +1 -0
  192. package/dist/types/hooks/use-scroll-lock.d.ts +19 -0
  193. package/dist/types/hooks/use-scroll-threshold.d.ts +14 -0
  194. package/dist/types/hooks/use-textarea-autosize.d.ts +16 -0
  195. package/dist/types/index.d.ts +74 -0
  196. package/dist/types/labels-context.d.ts +18 -0
  197. package/dist/types/labels.d.ts +240 -0
  198. package/dist/types/motion/ease.d.ts +10 -0
  199. package/dist/types/motion/generation/ActiveBlockIndicator.d.ts +27 -0
  200. package/dist/types/motion/generation/BlurUpImage.d.ts +23 -0
  201. package/dist/types/motion/generation/ResolveEntrance.d.ts +22 -0
  202. package/dist/types/motion/generation/ShimmerSkeleton.d.ts +20 -0
  203. package/dist/types/motion/generation/WordReveal.d.ts +26 -0
  204. package/dist/types/motion/generation/index.d.ts +6 -0
  205. package/dist/types/motion/hooks/useInViewOnce.d.ts +14 -0
  206. package/dist/types/motion/hooks/useScrollDirection.d.ts +38 -0
  207. package/dist/types/motion/hooks/useScrollProgress.d.ts +23 -0
  208. package/dist/types/motion/hooks/useStableValue.d.ts +36 -0
  209. package/dist/types/motion/hooks/useSuccessFlash.d.ts +1 -0
  210. package/dist/types/motion/index.d.ts +18 -0
  211. package/dist/types/motion/presets.d.ts +335 -0
  212. package/dist/types/motion/primitives/Agent.d.ts +118 -0
  213. package/dist/types/motion/primitives/MorphRegion.d.ts +16 -0
  214. package/dist/types/motion/primitives/Parallax.d.ts +19 -0
  215. package/dist/types/motion/primitives/Pin.d.ts +26 -0
  216. package/dist/types/motion/primitives/Reveal.d.ts +29 -0
  217. package/dist/types/motion/primitives/RevealStagger.d.ts +16 -0
  218. package/dist/types/motion/primitives/StickyShelf.d.ts +18 -0
  219. package/dist/types/primitives/Badge/index.d.ts +12 -0
  220. package/dist/types/primitives/Button/index.d.ts +25 -0
  221. package/dist/types/primitives/Input/index.d.ts +5 -0
  222. package/dist/types/primitives/Money/index.d.ts +13 -0
  223. package/dist/types/primitives/Select/index.d.ts +5 -0
  224. package/dist/types/primitives/Skeleton/index.d.ts +4 -0
  225. package/dist/types/shell/AnimatedPlaceholder.d.ts +13 -0
  226. package/dist/types/shell/BottomSheet.d.ts +54 -0
  227. package/dist/types/shell/Button.d.ts +19 -0
  228. package/dist/types/shell/ChromeSurface.d.ts +33 -0
  229. package/dist/types/shell/Composer.d.ts +56 -0
  230. package/dist/types/shell/ComposerChipStrip.d.ts +9 -0
  231. package/dist/types/shell/ConversationTransition.d.ts +27 -0
  232. package/dist/types/shell/DictationButton.d.ts +24 -0
  233. package/dist/types/shell/DragSheet.d.ts +34 -0
  234. package/dist/types/shell/InlineCompletion.d.ts +38 -0
  235. package/dist/types/shell/LauncherDock.d.ts +40 -0
  236. package/dist/types/shell/ListeningWaveform.d.ts +18 -0
  237. package/dist/types/shell/MenuAccordionPanel.d.ts +26 -0
  238. package/dist/types/shell/MenuDrawer.d.ts +72 -0
  239. package/dist/types/shell/MenuFlyout.d.ts +22 -0
  240. package/dist/types/shell/MenuNav.d.ts +30 -0
  241. package/dist/types/shell/MenuNavBar.d.ts +22 -0
  242. package/dist/types/shell/ShellMenuChrome.d.ts +66 -0
  243. package/dist/types/shell/ShellScaffold.d.ts +92 -0
  244. package/dist/types/shell/SideDock.d.ts +75 -0
  245. package/dist/types/shell/Skeleton.d.ts +22 -0
  246. package/dist/types/shell/Spinner.d.ts +10 -0
  247. package/dist/types/shell/TypedPlaceholder.d.ts +11 -0
  248. package/dist/types/shell/VoiceControl.d.ts +23 -0
  249. package/dist/types/shell/VoiceIsland.d.ts +24 -0
  250. package/dist/types/shell/canvas-gutter-style.d.ts +15 -0
  251. package/dist/types/shell/composer/AttachButton.d.ts +14 -0
  252. package/dist/types/shell/composer/AttachmentStrip.d.ts +12 -0
  253. package/dist/types/shell/composer/ClearSessionButton.d.ts +16 -0
  254. package/dist/types/shell/composer/ConversationHistoryButton.d.ts +25 -0
  255. package/dist/types/shell/composer/ShareCanvasButton.d.ts +19 -0
  256. package/dist/types/shell/composer/ThreadJumpRail.d.ts +43 -0
  257. package/dist/types/shell/composer/composer-metrics.d.ts +6 -0
  258. package/dist/types/shell/composer/field-metrics.d.ts +97 -0
  259. package/dist/types/shell/composer/heic-convert.d.ts +6 -0
  260. package/dist/types/shell/composer/use-field-autosize.d.ts +26 -0
  261. package/dist/types/shell/composer/useComposerAttachments.d.ts +37 -0
  262. package/dist/types/shell/composer/usePromptComposer.d.ts +51 -0
  263. package/dist/types/shell/dock-context.d.ts +10 -0
  264. package/dist/types/shell/index.d.ts +36 -0
  265. package/dist/types/shell/menu-columns.d.ts +19 -0
  266. package/dist/types/shell/mobile/DefaultMobileShell.d.ts +88 -0
  267. package/dist/types/shell/mobile/IslandComposeGroup.d.ts +41 -0
  268. package/dist/types/shell/mobile/IslandInputBar.d.ts +61 -0
  269. package/dist/types/shell/mobile/IslandNavButtons.d.ts +20 -0
  270. package/dist/types/shell/mobile/IslandTrailingAction.d.ts +34 -0
  271. package/dist/types/shell/mobile/MobileChrome.d.ts +34 -0
  272. package/dist/types/shell/mobile/MobileVoiceConsole.d.ts +42 -0
  273. package/dist/types/shell/mobile/MorphIsland.d.ts +105 -0
  274. package/dist/types/shell/mobile/RestIsland.d.ts +41 -0
  275. package/dist/types/shell/mobile/constants.d.ts +26 -0
  276. package/dist/types/shell/mobile/document-scroll-ref.d.ts +22 -0
  277. package/dist/types/shell/mobile/hero-entry-point.d.ts +110 -0
  278. package/dist/types/shell/mobile/island-metrics.d.ts +131 -0
  279. package/dist/types/shell/mobile/sheet-detents.d.ts +49 -0
  280. package/dist/types/shell/mobile/turn-end-action.d.ts +44 -0
  281. package/dist/types/shell/mobile/use-blur-on-canvas-gesture.d.ts +31 -0
  282. package/dist/types/shell/mobile/use-island-fold-scroll.d.ts +28 -0
  283. package/dist/types/shell/mobile/use-keyboard-inset.d.ts +18 -0
  284. package/dist/types/shell/mobile/use-sheet-fold-gesture.d.ts +57 -0
  285. package/dist/types/shell/slots.d.ts +16 -0
  286. package/dist/types/shell/thread-reland.d.ts +22 -0
  287. package/dist/types/shell/use-dock-state.d.ts +54 -0
  288. package/dist/types/types/commerce.d.ts +1 -0
  289. package/dist/types/utils/cn.d.ts +2 -0
  290. package/dist/types/utils/format-money.d.ts +2 -0
  291. package/dist/types/utils/html-to-text.d.ts +8 -0
  292. package/dist/types/utils/sanitize-html.d.ts +12 -0
  293. package/dist/types/utils/use-backdrop-presence.d.ts +24 -0
  294. package/dist/types/utils/use-composer-mode.d.ts +26 -0
  295. package/dist/types/utils/use-is-seed-home.d.ts +13 -0
  296. package/dist/types/utils/use-safe-cart.d.ts +17 -0
  297. package/dist/types/utils/use-safe-facts.d.ts +9 -0
  298. package/dist/types/utils/use-safe-fourty-session.d.ts +15 -0
  299. package/package.json +80 -0
@@ -0,0 +1,26 @@
1
+ /** Slim top chrome bar (logo + launchers) height. */
2
+ export declare const MOBILE_TOPBAR_HEIGHT = 56;
3
+ /**
4
+ * Horizontal inset of the top chrome bar's outermost cells — the corner the
5
+ * hamburger sits in on one side and the launcher cluster on the other. Shared
6
+ * by `MobileChrome` (the bar) and `ShellMenuChrome`'s mobile row (the layer
7
+ * that spans it), so the two corners are symmetric by construction instead of
8
+ * by two matching literals.
9
+ */
10
+ export declare const MOBILE_TOPBAR_INSET_X = 14;
11
+ /**
12
+ * Breathing room reserved below the island face, on top of its own height —
13
+ * shared by the static fallback below and the live clearance
14
+ * `DefaultMobileShell` computes once the island reports its real height.
15
+ */
16
+ export declare const ISLAND_CLEARANCE_BREATHING: number;
17
+ /**
18
+ * Scroll clearance under the canvas so the last section clears the resting
19
+ * morph island, BEFORE its live height is first measured. `DefaultMobileShell`
20
+ * switches to the island's measured height once `MorphIsland` reports one —
21
+ * a composing island carrying follow-up chips + a presence read is taller
22
+ * than this single-line floor, and a static clearance would let it overlap
23
+ * the canvas content sitting above it. The browser-toolbar inset + safe area
24
+ * are added at the call site.
25
+ */
26
+ export declare const MOBILE_CANVAS_BOTTOM_CLEARANCE: number;
@@ -0,0 +1,22 @@
1
+ import type { Ref } from 'react';
2
+ /**
3
+ * A ref CALLBACK — not a `useEffect` — that resolves `document.scrollingElement`
4
+ * into `forwarded` at the exact moment its own host element mounts/unmounts.
5
+ *
6
+ * Why a callback and not an effect writing `document.scrollingElement`
7
+ * directly into `forwarded`: `forwarded` (`ScrollContainerContext`'s ref) is
8
+ * ALSO where the desktop shell attaches its own real scrolling node, via a
9
+ * normal `ref={props.scrollRef}` JSX attribute — React's OWN commit-phase
10
+ * ref mechanism. An `apps/[slug]` page transiently renders the DESKTOP shell
11
+ * on the very first paint even on a mobile device (a deliberate SSR-safe
12
+ * default, corrected after hydration) — desktop's real ref attachment wins
13
+ * that first commit, and nothing about a later `useEffect` write can
14
+ * reliably undo it: child effects fire before ancestor effects, so an
15
+ * ancestor's effect always loses the ordering race, and even a render-phase
16
+ * write gets silently overwritten by desktop's OWN commit-phase attachment
17
+ * moments later in the SAME pass. Using a REF CALLBACK on an element that
18
+ * mounts/unmounts in lockstep with this shell gives it the IDENTICAL commit-
19
+ * phase timing desktop's attachment uses — whichever shell is ACTUALLY
20
+ * mounted in a given commit wins the ref, with no race, by construction.
21
+ */
22
+ export declare function documentScrollRef(forwarded: Ref<HTMLElement> | undefined): (node: HTMLElement | null) => void;
@@ -0,0 +1,110 @@
1
+ import * as React from 'react';
2
+ /**
3
+ * WHO OWNS THE FIRST SCREEN — the brand's hero, or the platform's island.
4
+ *
5
+ * On a phone the island is normally the only way to talk to the space, so it
6
+ * is docked on the floor from first paint. But a brand hero can carry its own
7
+ * entry point — a prompt box sitting in the hero, where the visitor is already
8
+ * looking, with the brand's own conversation starters under it (babysense's
9
+ * `HeroPromptInput`). When it does, two surfaces are asking the same question
10
+ * at once, and the one at the bottom of the screen is the one the visitor did
11
+ * not come for.
12
+ *
13
+ * THE RULEBOOK this implements, in the product's own words:
14
+ *
15
+ * 1. Landing fresh on the HOME page: the hero banner carries the text box,
16
+ * and the island is not shown.
17
+ * 1.1 Once scrolled so that box is no longer visible: show the island.
18
+ * 2. On ALL OTHER pages: always show the island, collapsed or expanded.
19
+ *
20
+ * Rule 2 is not coded anywhere, and that is deliberate — it FALLS OUT of how
21
+ * rule 1 is expressed. Withholding requires a LIVE claim from a hero's own
22
+ * prompt box, and that box exists only on the home page's seed layout, so a
23
+ * view that never claims can never be withheld from. Anything that made the
24
+ * withholding survive a view change — a latch keyed to the session rather than
25
+ * to the live claim, say — would break rule 2 silently and everywhere at once.
26
+ * `__tests__/default-mobile-submit` states all three rules as tests.
27
+ *
28
+ * So the hero CLAIMS the entry point for as long as its own box is showing AND
29
+ * on screen, and the island is withheld for exactly that long — unmounted, not
30
+ * hidden, with the canvas keeping the floor space it would have reserved.
31
+ * SYMMETRIC, both ways, every pass: box on screen, no island; box off screen,
32
+ * island.
33
+ *
34
+ * It used to LATCH — withheld only until the claim first lifted, after which
35
+ * returning to the hero merely folded the island to its pill, on the reasoning
36
+ * that a control which vanishes when you go back to where you started is one
37
+ * you have to rediscover. That was overruled. The hero banner and its prompt
38
+ * box own the top of the home page, and an island sitting under them is the
39
+ * second box asking the same question that this whole mechanism exists to
40
+ * prevent.
41
+ *
42
+ * Dropping the latch also removed the only piece of state that could outlive a
43
+ * VIEW CHANGE, which is the shape of bug that leaves a product page with no
44
+ * island at all. Withholding now reads one live signal and nothing else, so
45
+ * there is nothing to go stale.
46
+ *
47
+ * The flicker the latch guarded against is handled where it belongs — in
48
+ * `useOnScreen`'s hysteresis below.
49
+ *
50
+ * (`useHeroEntryPointVisible` is still read by the console's fold gate. With
51
+ * the island unmounted for the whole life of a claim that term can no longer
52
+ * fire on its own; it is kept as the honest expression of "a live claim means
53
+ * step aside", and because this contract has now been rewritten twice.)
54
+ *
55
+ * The hero never imports the island and the island never imports the hero. The
56
+ * claim is the whole contract, and a brand that never claims gets today's
57
+ * always-docked island with nothing to opt out of.
58
+ *
59
+ * A COUNTER, not a boolean. The canvas replaces its content (the pre-session
60
+ * seed giving way to the session's own layout, `ConversationTransition`
61
+ * crossfading a turn), so the hero is a NEW component instance on the other
62
+ * side of a swap and React may mount the incoming one before unmounting the
63
+ * outgoing one — or after. Counting claims makes the order irrelevant: a swap
64
+ * goes 1 → 2 → 1 or 1 → 0 → 1 and settles claimed either way, where a boolean
65
+ * could be left false with a live hero box on screen (and the island would
66
+ * appear underneath it).
67
+ */
68
+ /** `+1` on claim, `-1` on release. */
69
+ export type HeroEntryClaim = (delta: 1 | -1) => void;
70
+ export declare function HeroEntryPointProvider({ claim, claimed, children, }: {
71
+ claim: HeroEntryClaim;
72
+ claimed: boolean;
73
+ children: React.ReactNode;
74
+ }): React.ReactElement;
75
+ /**
76
+ * Read by the mobile console: is a brand hero's own entry point on screen
77
+ * right now? False everywhere there is no provider (desktop, embed), so a
78
+ * consumer can call it without knowing which shell it is in.
79
+ */
80
+ export declare function useHeroEntryPointVisible(): boolean;
81
+ /**
82
+ * Called by a brand hero for as long as IT is the mobile entry point.
83
+ *
84
+ * Pass `false` (desktop, or once the hero's own box has retired) to release.
85
+ * Outside the mobile shell there is no provider and this is a no-op, so a
86
+ * component can call it unconditionally without knowing which shell it is
87
+ * mounted in.
88
+ */
89
+ export declare function useClaimHeroEntryPoint(active: boolean): void;
90
+ /**
91
+ * Is this element actually ON SCREEN — with hysteresis, so a boundary does not
92
+ * flicker.
93
+ *
94
+ * The hero's prompt box claims the entry point, and the claim has to end when
95
+ * the box scrolls away: a visitor reading down the page has left the box
96
+ * behind, and with the island still withheld they have no way to ask anything
97
+ * without scrolling back up to find one. "Is the box still on screen" is
98
+ * exactly the question, and an `IntersectionObserver` answers it without
99
+ * anyone plumbing scroll offsets around.
100
+ *
101
+ * TWO thresholds, not one. At a single threshold the boundary is a knife edge:
102
+ * a visitor who parks the page with the box half off screen gets the island
103
+ * mounting and unmounting under every small correction of their thumb. It
104
+ * takes `exit` visibility to give up the claim and the much stricter `enter`
105
+ * to take it back, so the two states overlap and neither can chatter.
106
+ */
107
+ export declare function useOnScreen(ref: React.RefObject<HTMLElement | null>, opts?: {
108
+ enter?: number;
109
+ exit?: number;
110
+ }): boolean;
@@ -0,0 +1,131 @@
1
+ /** The island's resting bar height — the shell's canvas-clearance baseline. */
2
+ export declare const VOICE_ISLAND_HEIGHT = 48;
3
+ /** `IslandComposeGroup`'s textarea line height — one rendered line of draft. */
4
+ export declare const ISLAND_FIELD_LINE_PX = 20;
5
+ /**
6
+ * How many lines the island's field may grow to before it holds and scrolls
7
+ * inside itself.
8
+ *
9
+ * The field used to be pinned to ONE line with `white-space: nowrap`, so a
10
+ * draft longer than the bar scrolled sideways under the caret: the visitor
11
+ * could see the word they were typing and nothing they had typed before it.
12
+ * On a surface whose whole job is composing a question, "I can't read my own
13
+ * sentence" is the bug. The field wraps and grows instead, and the island —
14
+ * already an auto-height surface that FLIP-animates its own size changes —
15
+ * grows with it.
16
+ *
17
+ * Five, not unbounded: the island floats OVER the canvas, so an unbounded
18
+ * field would let a long draft eat the page it is about to ask about. At the
19
+ * cap the box holds still and scrolls internally, which is also where the
20
+ * conversation sheet (a full-height composer, one drag up) becomes the better
21
+ * surface anyway.
22
+ */
23
+ export declare const ISLAND_FIELD_MAX_LINES = 5;
24
+ /**
25
+ * Lines of the streaming presence read the collapsed notch shows.
26
+ *
27
+ * One line could only ever show the opening fragment of an answer before the
28
+ * edge-fade cut it off, which on a phone — where the island is the whole
29
+ * conversation surface until you drag the sheet up — meant a reply you could
30
+ * not begin to read without opening something. Two lines is enough to carry a
31
+ * real first sentence, and still short enough that the island stays a bar
32
+ * rather than becoming a panel.
33
+ */
34
+ export declare const ISLAND_NOTCH_READ_LINES = 2;
35
+ /** The grip's own vertical footprint (padding + mark) — reserved ABOVE the
36
+ * sheet/island faces so the handle never overlaps them. Must match
37
+ * `.fourty-morph-grip`'s CSS box: 8px padding + the 5px chevron + 8px padding
38
+ * = 21px. A stale value here is exactly what used to show up as a jump the
39
+ * instant the surface went from auto-height to a measured one — and the pair
40
+ * is asserted in `__tests__/island-compose.test.ts` precisely because the two
41
+ * live in different files and drifted once already. Also the source
42
+ * `DefaultMobileShell` reads to bleed the sheet's first-child content
43
+ * (`presenceNotch`) UNDER the grip's own row, so the two share one continuous
44
+ * background instead of a visible seam where the grip's row (transparent — it
45
+ * sits on whatever the surface's base background is once the ink slab fades
46
+ * open) meets it. */
47
+ export declare const ISLAND_GRIP_H = 21;
48
+ /** Gap above the reserved chrome zone at rest (browser toolbar / home
49
+ * indicator only — no keyboard). */
50
+ export declare const ISLAND_BOTTOM_GAP = 16;
51
+ /**
52
+ * How long the surface takes to travel to a new `bottom`.
53
+ *
54
+ * The ORDINARY case is short: the offset moves by a few dozen pixels when the
55
+ * browser toolbar retracts or the keyboard opens, and the island should ride
56
+ * up with the keys rather than be watched doing it.
57
+ */
58
+ export declare const ISLAND_BOTTOM_TRAVEL_MS = 240;
59
+ /**
60
+ * The island's ARRIVAL, when a brand hero owned the first screen and has just
61
+ * handed it back (see `hero-entry-point.tsx`).
62
+ *
63
+ * It rises from below the floor rather than appearing. The visitor has just
64
+ * sent their first message from a box in the hero and their eyes are up there,
65
+ * on the answer beginning to render; a bar that simply exists at the bottom on
66
+ * the next frame is a thing they will find later, by accident. Something that
67
+ * MOVES into place at the edge of vision is a thing they saw arrive, and they
68
+ * know where it is without having to look for it.
69
+ *
70
+ * Slower than the resting travel because it is a first appearance rather than
71
+ * an adjustment, and on a spring so it settles rather than stopping.
72
+ */
73
+ export declare const ISLAND_ENTER_SPRING: {
74
+ type: "spring";
75
+ stiffness: number;
76
+ damping: number;
77
+ mass: number;
78
+ };
79
+ /** The house ease-out, for every other change of `bottom`. */
80
+ export declare const ISLAND_BOTTOM_TRAVEL_EASE = "cubic-bezier(0.22, 1, 0.36, 1)";
81
+ /** Snug gap above the on-screen keyboard — tighter than the resting gap
82
+ * since the keyboard itself already reads as a hard edge. */
83
+ export declare const ISLAND_KEYBOARD_GAP = 8;
84
+ /**
85
+ * THE COLLAPSED PILL — what the island becomes while the visitor reads.
86
+ *
87
+ * The fold used to SINK the bar past the shell floor and leave a 10px sliver
88
+ * of it showing. That was already the second try (the first faded it to
89
+ * nothing), and it inherited the same failure in a milder form: a 10px band
90
+ * at the very bottom edge of a phone is not a control anybody finds. It reads
91
+ * as a rendering artefact — a strip of something cut off by the screen — and
92
+ * it needed a light sweeping along it every ten seconds to be locatable at
93
+ * all, which is the tell. A surface that has to flash to be found is hiding.
94
+ *
95
+ * So the island does not leave. It CONDENSES: same slab, same ink, same
96
+ * shadow, shrunk to a small pill that sits at its usual dock, fully on screen,
97
+ * holding the island's own idle glyph. That is the shape Google's Docs island
98
+ * uses for the same problem, and it is right for the same reason — a small
99
+ * ellipse floating clear of the floor is unambiguously an object, unambiguously
100
+ * tappable, and takes almost nothing from the page.
101
+ *
102
+ * Object permanence is preserved the way it always should have been: the
103
+ * surface never travels off screen, so the visitor watches ONE thing shrink
104
+ * and grow back. Nothing has to reappear from anywhere.
105
+ *
106
+ * 112 × 40. The height is a real thumb target — a hair under the 44pt guidance
107
+ * on its own, comfortably over it once the gap it floats in is counted, and
108
+ * short enough against the 48px resting bar that the condense is legible as a
109
+ * condense. The width is the part that does the work: at 112 it is plainly a
110
+ * PILL, not a circular FAB (which would compete with whatever floating button
111
+ * a brand already has down there) and not a shortened bar, and it leaves the
112
+ * canvas behind it essentially uninterrupted.
113
+ */
114
+ export declare const ISLAND_COLLAPSED_W = 112;
115
+ export declare const ISLAND_COLLAPSED_H = 40;
116
+ /**
117
+ * Above this measured chrome-inset (px), treat it as the on-screen keyboard
118
+ * rather than browser toolbar / home-indicator safe area. iOS toolbar +
119
+ * home-indicator reservations run well under 100px; any real keyboard is
120
+ * taller than this by a wide margin, so a single threshold cleanly separates
121
+ * the two without a second signal.
122
+ */
123
+ export declare const KEYBOARD_LIKELY_MIN_PX = 120;
124
+ /**
125
+ * How far a touch on the open sheet must travel before its axis is decided.
126
+ * Under this, both deltas are finger noise. The sheet's fold gesture is vertical
127
+ * and the follow-up chip rail scrolls horizontally, so the two share a surface;
128
+ * a level rail flick is never perfectly level, and engaging the fold on any
129
+ * downward component collapses the sheet under a sideways swipe.
130
+ */
131
+ export declare const SHEET_AXIS_LOCK_SLOP_PX = 6;
@@ -0,0 +1,49 @@
1
+ /**
2
+ * Open rest positions, shortest first. The peek detent is a THIRD of the screen
3
+ * in spirit but floored a little above it: the sheet's own fixed chrome (dock
4
+ * header band + input row + chip rail ≈ 130px) does not shrink with it, so a
5
+ * literal 1/3 leaves no thread at all — the detent would read as broken rather
6
+ * than compact.
7
+ */
8
+ export declare const SHEET_DETENT_FRACTIONS: readonly number[];
9
+ /**
10
+ * The sheet is NON-MODAL below its tallest detent — iOS's
11
+ * `largestUndimmedDetentIdentifier`. At peek and half there is no scrim, no
12
+ * scroll lock, and no pointer interception: the canvas behind stays live, so
13
+ * the visitor can scroll and tap products with the conversation still up.
14
+ * Only the FULL detent, which covers the screen anyway, dims and goes modal
15
+ * (and only then does a tap outside dismiss).
16
+ *
17
+ * `dimSpan` returns the progress leg across which that transition happens —
18
+ * from the largest undimmed detent to the top of the ladder. Derived from the
19
+ * ladder rather than a constant so it stays correct if the detents change.
20
+ */
21
+ export declare function dimSpan(ladder: number[]): {
22
+ from: number;
23
+ to: number;
24
+ };
25
+ /**
26
+ * The progress value (0 = island, 1 = full sheet) at which the surface stands
27
+ * `fraction` of the viewport tall.
28
+ *
29
+ * `collapsedH` (the island + its grip) is the axis's real zero, so the mapping
30
+ * is `(target - collapsed) / (sheet - collapsed)`. A fraction that lands at or
31
+ * below the island's own height clamps to 0 — there is no detent shorter than
32
+ * the island.
33
+ */
34
+ export declare function detentProgress(fraction: number, collapsedH: number, sheetH: number): number;
35
+ /**
36
+ * The full detent ladder on the progress axis, including the island itself
37
+ * (0) as the closed detent. Ascending, de-duplicated: on a short viewport two
38
+ * fractions can collapse onto the same progress, and a ladder with a repeated
39
+ * rung would make `nearestDetent` pick between two identical targets.
40
+ */
41
+ export declare function detentLadder(collapsedH: number, sheetH: number): number[];
42
+ /**
43
+ * Where a release should settle: the detent nearest the finger's PROJECTED
44
+ * position, so velocity carries the sheet the way it was thrown.
45
+ *
46
+ * `velocityY` is the pointer's vertical velocity in px/s, screen-positive
47
+ * DOWNWARD — the morph axis runs the other way, hence the negation.
48
+ */
49
+ export declare function nearestDetent(current: number, velocityY: number, travelPx: number, ladder: number[]): number;
@@ -0,0 +1,44 @@
1
+ /**
2
+ * What the morph surface should do when a turn finishes.
3
+ *
4
+ * Extracted from `MobileVoiceConsole`'s turn-boundary effect so the rule is
5
+ * readable and checkable on its own — it decides whether the visitor SEES the
6
+ * agent's answer, and it is driven by three inputs that are easy to get subtly
7
+ * wrong (a chip-gen pass that appends no message, an assistant message that
8
+ * lands a render after `isRunning` flips, and a layout object that is a fresh
9
+ * reference every render even when its content is identical).
10
+ */
11
+ /** A thread message, structurally — only what this decision reads. */
12
+ export interface TurnEndMessage {
13
+ role: string;
14
+ text: string;
15
+ }
16
+ export type TurnEndAction =
17
+ /** Talk-only answer: pop the sheet, it is the only surface that can show it. */
18
+ 'open'
19
+ /** The canvas carries the answer: stay folded so the visitor sees it. */
20
+ | 'close'
21
+ /** Nothing resolved this turn — leave the surface exactly as it is. */
22
+ | 'none';
23
+ export interface TurnEndInputs {
24
+ /** Thread messages as they stand now. */
25
+ messages: readonly TurnEndMessage[];
26
+ /** `messages.length` captured when the turn STARTED. */
27
+ startMessageCount: number;
28
+ /** `JSON.stringify(layout)` now. Serialized, never a reference compare: the
29
+ * store hands back a fresh layout object with identical content, so `===`
30
+ * reads every no-op turn as "changed". */
31
+ layoutSignature: string;
32
+ /** The same signature captured when the turn STARTED. */
33
+ startLayoutSignature: string;
34
+ }
35
+ /**
36
+ * The rule, in one place.
37
+ *
38
+ * `'none'` unless the turn actually appended a non-empty assistant message —
39
+ * the post-answer chip-gen pass appends none, and must never toggle the
40
+ * surface. Then: canvas unchanged → `'open'` (the answer lives only in prose,
41
+ * and the island read is a single clamped line), canvas changed → `'close'`
42
+ * (the new layout IS the answer).
43
+ */
44
+ export declare function turnEndAction(inputs: TurnEndInputs): TurnEndAction;
@@ -0,0 +1,31 @@
1
+ import * as React from 'react';
2
+ /**
3
+ * Reading the page puts the keyboard away.
4
+ *
5
+ * With the field focused, the island is pinned open above the keys (it has to
6
+ * be — see the compose veto in `MobileVoiceConsole`), so a visitor who gave up
7
+ * on typing and started scrolling was left reading the canvas through a
8
+ * keyboard, with the island parked on top of it and no obvious way to dismiss
9
+ * either. Moving the page is the visitor saying they are done typing; this
10
+ * carries that through to the only thing that can act on it, a blur. The
11
+ * keyboard then closes on its own, the compose veto lifts, and the island folds
12
+ * under the rules it already has — nothing here folds anything directly.
13
+ *
14
+ * A GESTURE, not a `scroll` event. That distinction is the whole design.
15
+ * Focusing the field makes iOS scroll the page to reveal it, and that
16
+ * programmatic scroll is indistinguishable from a reading-scroll at the
17
+ * `scroll` event — blurring on one would blur the field the instant it was
18
+ * tapped, which is the same class of race the compose veto exists to close.
19
+ * `touchmove` and `wheel` can only come from a finger or a trackpad, so they
20
+ * cannot be produced by the very focus they would be cancelling.
21
+ *
22
+ * Gestures INSIDE the surface are the island's own — dragging the grip,
23
+ * flicking the chip rail, scrolling a grown draft — and must not dismiss
24
+ * anything. Only a gesture on the page behind it counts.
25
+ *
26
+ * Guarded on `document.activeElement` rather than a focus flag: it is the same
27
+ * question asked of the DOM instead of mirrored in state, so it cannot go
28
+ * stale, and it makes the listener a no-op at zero cost whenever the visitor
29
+ * is not typing.
30
+ */
31
+ export declare function useBlurOnCanvasGesture(taRef: React.RefObject<HTMLTextAreaElement | null>): void;
@@ -0,0 +1,28 @@
1
+ import * as React from 'react';
2
+ export interface IslandFoldScroll {
3
+ /** True from the first scroll event of a session until it has been quiet for
4
+ * `SCROLL_IDLE_MS`. */
5
+ scrolling: boolean;
6
+ }
7
+ /**
8
+ * Is the canvas being scrolled right now?
9
+ *
10
+ * That is all this is. It used to also own the island's automatic RISE — an
11
+ * idle timer that brought the surface back once a scroll went quiet, plus a
12
+ * content guard that withheld that rise while interactive canvas content still
13
+ * sat in the band the island was about to re-occupy.
14
+ *
15
+ * Both are gone because the rise itself is (see `MobileVoiceConsole`'s fold
16
+ * gate): the island now stays folded until the visitor asks for it. With no
17
+ * automatic rise there is nothing for a guard to withhold — the folded island
18
+ * is already out of the way of the CTA the guard existed to protect, and it
19
+ * stays that way for as long as the visitor is reading rather than for a
20
+ * timeout. The remaining signal is used for one thing: telling when a scroll
21
+ * session has ended, so a summon can survive the momentum still unwinding
22
+ * under the finger that tapped and expire on the NEXT one.
23
+ *
24
+ * Direction (`collapsed`, `atTop`) and the other fold gates (`summoned`,
25
+ * `sheetOpen`, `working`) are the caller's concern — this hook only owns the
26
+ * raw DOM `scroll` listener and its debounce.
27
+ */
28
+ export declare function useIslandFoldScroll(scrollRef: React.RefObject<HTMLElement | null>): IslandFoldScroll;
@@ -0,0 +1,18 @@
1
+ import * as React from 'react';
2
+ /**
3
+ * `useKeyboardInset` — how many px of the layout viewport the on-screen keyboard
4
+ * currently covers, off the VisualViewport API. Zero when no keyboard is up.
5
+ *
6
+ * iOS Safari opens the keyboard OVER the layout viewport (its default
7
+ * `interactive-widget=resizes-visual`, and it ignores the meta anyway), so
8
+ * `dvh` / a bottom-anchored floating bar don't move — the island ends up
9
+ * stranded behind or gapped from the keyboard. VisualViewport is the only
10
+ * reliable signal: `innerHeight − (visualViewport.height + offsetTop)` is the
11
+ * covered slab. Callers lift a bottom-pinned surface by this so its input sits
12
+ * just above the keyboard.
13
+ *
14
+ * Scoped to the element's own document (`ownerDocument.defaultView`), never the
15
+ * global `window`, so it's SSR-safe and multi-window-safe; listeners live on the
16
+ * scoped `visualViewport` and are torn down on unmount.
17
+ */
18
+ export declare function useKeyboardInset(ref: React.RefObject<HTMLElement | null>): number;
@@ -0,0 +1,57 @@
1
+ import * as React from 'react';
2
+ import type { MotionValue } from '../../motion';
3
+ /**
4
+ * Sheet-face drag-to-resize — a pull on the open sheet moves it between its
5
+ * detents, native-bottom-sheet style: down folds it back toward the island, up
6
+ * grows it toward the full sheet. Release settles on the nearest detent (see
7
+ * `sheet-detents.ts`); this hook only drives the axis and reports the release
8
+ * velocity, so every gesture that can let the sheet go lands the same way.
9
+ *
10
+ * Two things make this harder than a `onPan` handler:
11
+ *
12
+ * 1. **It must beat WebKit.** Framer's `onPan` (pointer events) and CSS
13
+ * `touch-action` are both browser HEURISTICS — WebKit can commit a touch to
14
+ * its own native scroll/rubber-band before either takes effect, especially
15
+ * over a nested `overflow-y: auto` list, and once committed it stops
16
+ * delivering pointermove to JS entirely (the drag "fights" the gesture,
17
+ * unresponsive). The only mechanism that authoritatively wins every time is
18
+ * `preventDefault()` from inside a NON-PASSIVE native `touchmove` listener,
19
+ * which a declarative React/framer handler cannot guarantee (React's
20
+ * synthetic touch handlers are passive). Hence raw `addEventListener`.
21
+ *
22
+ * 2. **It shares the sheet with scrollers on BOTH axes.** The thread history
23
+ * scrolls vertically; the follow-up chip rail scrolls horizontally. A fold
24
+ * that engages on any downward component swallows a sideways flick on the
25
+ * rail (a rail flick is never perfectly level), so the rail feels dead and
26
+ * the sheet collapses under the finger. The gesture therefore LOCKS AN AXIS
27
+ * on the first movement past a slop threshold and honours it for the rest of
28
+ * the touch: vertical → the sheet may fold; horizontal → the browser keeps
29
+ * the touch and the rail scrolls, and we never call `preventDefault`.
30
+ *
31
+ * The vertical-scroller gate is a TOP-edge gate with a mid-gesture HANDOFF:
32
+ * - At touch start the fold arms only when the touched vertical scroller
33
+ * already rests at its TOP (`scrollTop 0`) — the native-sheet convention.
34
+ * The BOTTOM edge must NOT arm it: `ThreadHistory` rests scrolled to its
35
+ * bottom (latest message), and arming there made every pull-down fold the
36
+ * sheet instead of scrolling back through the conversation — the visitor
37
+ * literally could not read their history.
38
+ * - Mid-thread, a downward pull is a normal scroll — but the SAME touch keeps
39
+ * being watched, and the moment the scroller reaches its top while the
40
+ * finger is still pulling down, the fold ARMS FROM THERE (re-baselined to
41
+ * the current finger position): scroll-to-top and fold-away run as one
42
+ * continuous gesture, exactly like a native sheet's scroll handoff.
43
+ */
44
+ export interface SheetFoldGesture {
45
+ /** The sheet face — the gesture surface. Also the walk's upper bound. */
46
+ sheetFaceRef: React.RefObject<HTMLDivElement | null>;
47
+ /** True while the surface is morphed to the sheet; the gesture is inert otherwise. */
48
+ atSheet: boolean;
49
+ /** Morph travel in px — converts finger distance into progress. */
50
+ travel: number;
51
+ /** The morph's 0 (island) → 1 (sheet) axis. */
52
+ progress: MotionValue<number>;
53
+ /** Let the sheet go: settles it on the detent nearest where the release
54
+ * velocity (px/s, screen-positive downward) was carrying it. */
55
+ settle: (velocityY: number) => void;
56
+ }
57
+ export declare function useSheetFoldGesture({ sheetFaceRef, atSheet, travel, progress, settle }: SheetFoldGesture): void;
@@ -0,0 +1,16 @@
1
+ import type React from 'react';
2
+ /**
3
+ * Shell slot contract — shared by the desktop `ShellScaffold` and the mobile
4
+ * `DefaultMobileShell` so both resolve chrome the same way (and so the mobile
5
+ * shell can import the contract without a cycle back through ShellScaffold).
6
+ */
7
+ /** Dock state handed to slots that can open/close the composer surface. */
8
+ export interface ShellDockState {
9
+ open: boolean;
10
+ toggle: () => void;
11
+ }
12
+ /** A slot is either static markup or a function of the dock state. */
13
+ export type ShellSlot = React.ReactNode | ((dock: ShellDockState) => React.ReactNode);
14
+ /** Resolve a slot to markup: static nodes pass through, function slots receive
15
+ * the live dock state. Exported for unit testing the slot contract. */
16
+ export declare function resolveShellSlot(slot: ShellSlot | undefined, dock: ShellDockState): React.ReactNode;
@@ -0,0 +1,22 @@
1
+ import * as React from 'react';
2
+ /**
3
+ * "The thread just became visible again" — a counter, bumped by whichever
4
+ * surface re-opened it.
5
+ *
6
+ * `useThreadLanding` (the single owner of where the thread scroller lands)
7
+ * treats its head landing as a one-shot per key. That was one-shot per SCROLLER
8
+ * until the mobile conversation sheet stopped unmounting: `MorphIsland` morphs
9
+ * ONE surface between the resting island and the full sheet, so the thread's
10
+ * scroller is created once — while the thread is still empty — and a landing
11
+ * keyed to the scroller fires there and never again.
12
+ *
13
+ * This carries the re-open signal from the surface that pops to the `Composer`
14
+ * that owns the scroller, WITHOUT either of them knowing about the other: the
15
+ * composer is a brand-supplied slot, so there is no prop path between them.
16
+ *
17
+ * Default `0` — a surface that never bumps (the desktop dock) keeps exactly the
18
+ * old one-shot-on-mount behaviour.
19
+ */
20
+ export declare const ThreadRelandContext: React.Context<number>;
21
+ /** The current re-open key. Feed it straight to `useThreadLanding`. */
22
+ export declare function useThreadRelandKey(): number;
@@ -0,0 +1,54 @@
1
+ import type { ShellDockState } from './slots';
2
+ /**
3
+ * When is the side dock open?
4
+ *
5
+ * Four inputs, and the whole difficulty is telling some of them apart:
6
+ *
7
+ * - the HOST's persisted answer (`useDockPersistence`) — the panel as the
8
+ * visitor left it, known on the very first render, server included;
9
+ * - ENGAGEMENT — has the visitor chatted or navigated (`useHasLeftSeedHome`);
10
+ * - a NEW user turn, which reopens the panel for shells that opt in;
11
+ * - whether an external agent is DRIVING the page (`useAgentDriven`).
12
+ *
13
+ * ── WHY AN AGENT TURN IS NOT ENGAGEMENT ────────────────────────────────────
14
+ *
15
+ * The last input is the newest and it exists because of a bug that shipped: a
16
+ * WebMCP client calling `send_message` writes a user message, which trips BOTH
17
+ * of the other two — it reads as the visitor having chatted, and as a brand new
18
+ * user turn. So the side dock opened on every agent call, sliding a chat panel
19
+ * over the canvas while `ComposerDock` was correctly folding its own composer to
20
+ * a bubble. Half the shell stood down and the other half threw itself open.
21
+ *
22
+ * There is nobody on this page to read that panel: the conversation is happening
23
+ * in the agent's client, and the dock is reserving a third of the viewport for
24
+ * it. So an agent-driven page keeps the panel shut — INCLUDING over a persisted
25
+ * "open", because a remembered preference is about the visitor's own browsing,
26
+ * not about a session someone else is driving.
27
+ *
28
+ * The visitor's own toggle still outranks all of it. That is the same contract
29
+ * the composer keeps: agent-driven folds the surface, and it stays folded until
30
+ * the human opens it THEMSELVES, after which nothing an agent does closes it.
31
+ *
32
+ * Engagement is derived from session state that does not exist during the
33
+ * server render and does not exist on the client's first render either: it
34
+ * arrives when the session restores, a few hundred milliseconds after paint.
35
+ * So a returning visitor's page painted dock-shut and then snapped it open,
36
+ * shoving the canvas — and it did that even to someone who had deliberately
37
+ * folded the panel, because replayed history is indistinguishable from live
38
+ * engagement if you only look at the current value.
39
+ *
40
+ * The session becoming known is the moment this load's own history has
41
+ * finished arriving, so it is the BASELINE: engagement already true at the
42
+ * baseline is history (accounted for by the persisted answer), and only what
43
+ * happens after it counts as the visitor engaging now.
44
+ *
45
+ * With NO persisted answer (`initialOpen: null` — a host that persists
46
+ * nothing, or a visitor we have never seen) there is nothing to account for
47
+ * and any engagement latches, exactly as it always did.
48
+ */
49
+ /**
50
+ * `autoOpen: false` — the dock never opens by itself (engagement, a new message):
51
+ * only the visitor's own toggle opens it. For a shell whose conversation already
52
+ * lives in the page, where the dock is an optional view of the thread.
53
+ */
54
+ export declare function useDockState(reopenOnMessage: boolean, autoOpen: boolean): ShellDockState;
@@ -0,0 +1 @@
1
+ export type { Money, Image, ProductVariant, Product, Collection, CartLine, Cart } from '@40rty/ams-sdk';
@@ -0,0 +1,2 @@
1
+ import { type ClassValue } from 'clsx';
2
+ export declare function cn(...inputs: ClassValue[]): string;
@@ -0,0 +1,2 @@
1
+ import type { Money } from '../types/commerce';
2
+ export declare function formatMoney(money: Money | null | undefined, locale?: string): string;
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Converts merchant-authored HTML (e.g. a Shopify `descriptionHtml`) into
3
+ * plain text: block/line boundaries (`<br>`, `</p>`, `</li>`, `</div>`,
4
+ * `</h1-6>`) become newlines, remaining tags are dropped, and entities
5
+ * (`&amp;`, `&nbsp;`, `&#10003;`, …) are decoded to their real characters —
6
+ * unlike a bare tag-stripping regex, which leaves entities un-decoded.
7
+ */
8
+ export declare function htmlToText(html: string): string;