@40rty/ams-ui 0.4.2 → 0.4.4

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/shell.js CHANGED
@@ -2462,7 +2462,7 @@ import {
2462
2462
  } from "@40rty/ams-sdk";
2463
2463
 
2464
2464
  // src/shell/ShellScaffold.tsx
2465
- import React28 from "react";
2465
+ import React29 from "react";
2466
2466
  import { useDockState } from "@40rty/ams-sdk";
2467
2467
 
2468
2468
  // src/shell/slots.ts
@@ -2473,7 +2473,7 @@ function resolveShellSlot(slot, dock) {
2473
2473
  }
2474
2474
 
2475
2475
  // src/shell/mobile/DefaultMobileShell.tsx
2476
- import * as React26 from "react";
2476
+ import * as React27 from "react";
2477
2477
  import { useSessionState, useFourtySession as useFourtySession7 } from "@40rty/ams-sdk";
2478
2478
 
2479
2479
  // src/shell/mobile/MobileChrome.tsx
@@ -4098,6 +4098,27 @@ function MobileVoiceConsole({ placeholder, placeholderExamples, historySheet, on
4098
4098
  ] });
4099
4099
  }
4100
4100
 
4101
+ // src/shell/mobile/PageComposerDock.tsx
4102
+ import * as React26 from "react";
4103
+ import { jsx as jsx29 } from "react/jsx-runtime";
4104
+ function PageComposerDock({
4105
+ bottom,
4106
+ onHeightChange,
4107
+ children
4108
+ }) {
4109
+ const ref = React26.useRef(null);
4110
+ React26.useLayoutEffect(() => {
4111
+ const node = ref.current;
4112
+ if (node === null) return;
4113
+ const report = () => onHeightChange(node.getBoundingClientRect().height);
4114
+ report();
4115
+ const observer = new ResizeObserver(report);
4116
+ observer.observe(node);
4117
+ return () => observer.disconnect();
4118
+ }, [onHeightChange]);
4119
+ return /* @__PURE__ */ jsx29("div", { ref, "data-fourty-shell-part": "canvasComposer", style: { position: "fixed", left: 0, right: 0, bottom, zIndex: 40 }, children });
4120
+ }
4121
+
4101
4122
  // src/shell/mobile/document-scroll-ref.ts
4102
4123
  function assignRef(ref, value) {
4103
4124
  if (ref === void 0 || ref === null) return;
@@ -4119,7 +4140,7 @@ function documentScrollRef(forwarded) {
4119
4140
  }
4120
4141
 
4121
4142
  // src/shell/mobile/DefaultMobileShell.tsx
4122
- import { Fragment as Fragment7, jsx as jsx29, jsxs as jsxs19 } from "react/jsx-runtime";
4143
+ import { Fragment as Fragment7, jsx as jsx30, jsxs as jsxs19 } from "react/jsx-runtime";
4123
4144
  var MOBILE_GUTTER_MAX = 16;
4124
4145
  function scrollToTop() {
4125
4146
  if (typeof document === "undefined") return;
@@ -4131,42 +4152,44 @@ function DefaultMobileShell(props) {
4131
4152
  const { messages } = useSessionState();
4132
4153
  const { isSubmitting, isRunning } = useFourtySession7();
4133
4154
  const working = isSubmitting || isRunning;
4134
- const [open, setOpen] = React26.useState(false);
4135
- const toggle = React26.useCallback(() => setOpen((v) => !v), []);
4136
- const dock = React26.useMemo(() => ({ open, toggle }), [open, toggle]);
4155
+ const [open, setOpen] = React27.useState(false);
4156
+ const toggle = React27.useCallback(() => setOpen((v) => !v), []);
4157
+ const dock = React27.useMemo(() => ({ open, toggle }), [open, toggle]);
4137
4158
  const gutter = Math.min(props.gutter === void 0 ? MOBILE_GUTTER_MAX : props.gutter, MOBILE_GUTTER_MAX);
4138
4159
  const placeholder = props.placeholder === void 0 ? DEFAULT_PLACEHOLDER : props.placeholder;
4139
4160
  const canvasGutterStyle = { paddingLeft: gutter, paddingRight: gutter, "--fourty-canvas-gutter": `${gutter}px` };
4140
- const [islandFaceHeight, setIslandFaceHeight] = React26.useState(null);
4141
- const [heroEntryClaims, setHeroEntryClaims] = React26.useState(0);
4142
- const claimHeroEntry = React26.useCallback((delta) => {
4161
+ const [islandFaceHeight, setIslandFaceHeight] = React27.useState(null);
4162
+ const [heroEntryClaims, setHeroEntryClaims] = React27.useState(0);
4163
+ const claimHeroEntry = React27.useCallback((delta) => {
4143
4164
  setHeroEntryClaims((n) => Math.max(0, n + delta));
4144
4165
  }, []);
4145
4166
  const heroOwnsEntry = heroEntryClaims > 0;
4146
4167
  const withholdIsland = heroOwnsEntry && !working;
4147
4168
  const hasAsked = messages.some((m) => m.role === "user");
4148
- const hadAsked = React26.useRef(hasAsked);
4149
- React26.useEffect(() => {
4169
+ const hadAsked = React27.useRef(hasAsked);
4170
+ React27.useEffect(() => {
4150
4171
  const was = hadAsked.current;
4151
4172
  hadAsked.current = hasAsked;
4152
4173
  if (!was || hasAsked) return;
4153
4174
  scrollToTop();
4154
4175
  }, [hasAsked]);
4155
- const wasWithheld = React26.useRef(false);
4176
+ const wasWithheld = React27.useRef(false);
4156
4177
  const enterFromFloor = wasWithheld.current && !withholdIsland;
4157
- React26.useEffect(() => {
4178
+ React27.useEffect(() => {
4158
4179
  wasWithheld.current = withholdIsland;
4159
4180
  }, [withholdIsland]);
4160
- const canvasBottomClearance = withholdIsland ? 0 : islandFaceHeight === null ? MOBILE_CANVAS_BOTTOM_CLEARANCE : islandFaceHeight + ISLAND_CLEARANCE_BREATHING;
4161
- const shellRef = React26.useRef(null);
4181
+ const pageComposes = props.canvasComposer !== void 0;
4182
+ const measuredClearance = islandFaceHeight === null ? MOBILE_CANVAS_BOTTOM_CLEARANCE : islandFaceHeight + ISLAND_CLEARANCE_BREATHING;
4183
+ const canvasBottomClearance = withholdIsland ? 0 : measuredClearance;
4184
+ const shellRef = React27.useRef(null);
4162
4185
  const chromeInset = useKeyboardInset(shellRef);
4163
4186
  const restingChromeInset = chromeInset > KEYBOARD_LIKELY_MIN_PX ? 0 : chromeInset;
4164
4187
  const resolveScrollRef = documentScrollRef(props.scrollRef);
4165
- const rootRef = React26.useCallback((node) => {
4188
+ const rootRef = React27.useCallback((node) => {
4166
4189
  shellRef.current = node;
4167
4190
  resolveScrollRef(node);
4168
4191
  }, [props.scrollRef]);
4169
- React26.useLayoutEffect(() => {
4192
+ React27.useLayoutEffect(() => {
4170
4193
  if (typeof window === "undefined") return;
4171
4194
  const nav = window.performance.getEntriesByType("navigation")[0];
4172
4195
  const isReload = nav !== void 0 && nav.type === "reload";
@@ -4178,7 +4201,7 @@ function DefaultMobileShell(props) {
4178
4201
  window.history.scrollRestoration = previous;
4179
4202
  };
4180
4203
  }, []);
4181
- React26.useEffect(() => {
4204
+ React27.useEffect(() => {
4182
4205
  const target = document.scrollingElement;
4183
4206
  if (!(target instanceof HTMLElement)) return;
4184
4207
  const previous = target.style.scrollPaddingTop;
@@ -4223,21 +4246,22 @@ function DefaultMobileShell(props) {
4223
4246
  background: "var(--fourty-color-bg)"
4224
4247
  },
4225
4248
  children: [
4226
- /* @__PURE__ */ jsx29(MobileChrome, { logo: resolveShellSlot(props.logo, dock), launchers: resolveShellSlot(props.launchers, dock) }),
4249
+ /* @__PURE__ */ jsx30(MobileChrome, { logo: resolveShellSlot(props.logo, dock), launchers: resolveShellSlot(props.launchers, dock) }),
4227
4250
  /* @__PURE__ */ jsxs19(HeroEntryPointProvider, { claim: claimHeroEntry, claimed: heroOwnsEntry, children: [
4228
- /* @__PURE__ */ jsx29(
4251
+ /* @__PURE__ */ jsx30(
4229
4252
  "main",
4230
4253
  {
4231
4254
  style: {
4232
4255
  paddingBottom: `${canvasBottomClearance + restingChromeInset + ISLAND_BOTTOM_GAP}px`
4233
4256
  },
4234
4257
  children: /* @__PURE__ */ jsxs19("div", { style: canvasGutterStyle, children: [
4235
- /* @__PURE__ */ jsx29(ConversationTransition, { children: props.canvas }),
4258
+ /* @__PURE__ */ jsx30(ConversationTransition, { children: props.canvas }),
4236
4259
  props.footer
4237
4260
  ] })
4238
4261
  }
4239
4262
  ),
4240
- !withholdIsland && /* @__PURE__ */ jsx29(
4263
+ pageComposes && !withholdIsland && /* @__PURE__ */ jsx30(PageComposerDock, { bottom: chromeInset, onHeightChange: setIslandFaceHeight, children: resolveShellSlot(props.canvasComposer, dock) }),
4264
+ !pageComposes && !withholdIsland && /* @__PURE__ */ jsx30(
4241
4265
  MobileVoiceConsole,
4242
4266
  {
4243
4267
  enterFromFloor,
@@ -4254,8 +4278,8 @@ function DefaultMobileShell(props) {
4254
4278
  // opacity once `atSheet`) — a visible seam between the grip
4255
4279
  // and the notch's own color, right where they should read as
4256
4280
  // one continuous surface.
4257
- /* @__PURE__ */ jsx29("div", { style: { marginTop: -ISLAND_GRIP_H, paddingTop: ISLAND_GRIP_H }, children: props.presenceNotch }),
4258
- /* @__PURE__ */ jsx29("div", { style: { position: "relative", flex: 1, minHeight: 0 }, children: resolveShellSlot(props.composer, { open: true, toggle: close }) })
4281
+ /* @__PURE__ */ jsx30("div", { style: { marginTop: -ISLAND_GRIP_H, paddingTop: ISLAND_GRIP_H }, children: props.presenceNotch }),
4282
+ /* @__PURE__ */ jsx30("div", { style: { position: "relative", flex: 1, minHeight: 0 }, children: resolveShellSlot(props.composer, { open: true, toggle: close }) })
4259
4283
  ] }),
4260
4284
  onIslandHeightChange: setIslandFaceHeight
4261
4285
  }
@@ -4268,14 +4292,14 @@ function DefaultMobileShell(props) {
4268
4292
  }
4269
4293
 
4270
4294
  // src/shell/dock-context.tsx
4271
- import * as React27 from "react";
4272
- import { jsx as jsx30 } from "react/jsx-runtime";
4273
- var ShellDockContext = React27.createContext(null);
4295
+ import * as React28 from "react";
4296
+ import { jsx as jsx31 } from "react/jsx-runtime";
4297
+ var ShellDockContext = React28.createContext(null);
4274
4298
  function ShellDockProvider({ value, children }) {
4275
- return /* @__PURE__ */ jsx30(ShellDockContext.Provider, { value, children });
4299
+ return /* @__PURE__ */ jsx31(ShellDockContext.Provider, { value, children });
4276
4300
  }
4277
4301
  function useShellDock() {
4278
- const dock = React27.useContext(ShellDockContext);
4302
+ const dock = React28.useContext(ShellDockContext);
4279
4303
  if (dock === null) {
4280
4304
  throw new Error("useShellDock: no ShellDockProvider in the tree \u2014 this component must render inside a ShellScaffold canvas.");
4281
4305
  }
@@ -4283,7 +4307,7 @@ function useShellDock() {
4283
4307
  }
4284
4308
 
4285
4309
  // src/shell/ShellScaffold.tsx
4286
- import { jsx as jsx31, jsxs as jsxs20 } from "react/jsx-runtime";
4310
+ import { jsx as jsx32, jsxs as jsxs20 } from "react/jsx-runtime";
4287
4311
  var DEFAULTS = {
4288
4312
  dockWidth: 420,
4289
4313
  dockTop: 0,
@@ -4310,22 +4334,28 @@ function ShellScaffold(props) {
4310
4334
  };
4311
4335
  const isMobile = useMediaQuery(mq);
4312
4336
  const dock = useDockState(props.reopenDockOnMessage === true, props.canvasComposer === void 0);
4337
+ const [heroEntryClaims, setHeroEntryClaims] = React29.useState(0);
4338
+ const claimHeroEntry = React29.useCallback((delta) => {
4339
+ setHeroEntryClaims((n) => Math.max(0, n + delta));
4340
+ }, []);
4341
+ const heroOwnsEntry = heroEntryClaims > 0;
4313
4342
  const resizable = props.resizableDock === true;
4314
- const [liveWidth, setLiveWidth] = React28.useState(dockWidth);
4315
- const [resizing, setResizing] = React28.useState(false);
4343
+ const [liveWidth, setLiveWidth] = React29.useState(dockWidth);
4344
+ const [resizing, setResizing] = React29.useState(false);
4316
4345
  const effectiveWidth = resizable ? liveWidth : dockWidth;
4317
4346
  const canvasSpacing = useSideDockSpacing(dock.open, effectiveWidth, !resizing);
4318
4347
  if (props.mobile !== void 0 && isMobile) {
4319
- return /* @__PURE__ */ jsx31(ShellDockProvider, { value: dock, children: props.mobile });
4348
+ return /* @__PURE__ */ jsx32(ShellDockProvider, { value: dock, children: props.mobile });
4320
4349
  }
4321
4350
  if (isMobile) {
4322
- return /* @__PURE__ */ jsx31(ShellDockProvider, { value: dock, children: /* @__PURE__ */ jsx31(
4351
+ return /* @__PURE__ */ jsx32(ShellDockProvider, { value: dock, children: /* @__PURE__ */ jsx32(
4323
4352
  DefaultMobileShell,
4324
4353
  {
4325
4354
  canvas: props.canvas,
4326
4355
  footer: props.footer,
4327
4356
  composer: props.composer,
4328
4357
  presenceNotch: props.presenceNotch,
4358
+ canvasComposer: props.canvasComposer,
4329
4359
  launchers: props.launchers,
4330
4360
  drawers: props.drawers,
4331
4361
  logo: props.logo !== void 0 ? props.logo : props.header,
@@ -4337,11 +4367,11 @@ function ShellScaffold(props) {
4337
4367
  }
4338
4368
  ) });
4339
4369
  }
4340
- const canvasContent = /* @__PURE__ */ jsx31(ShellDockProvider, { value: dock, children: wrapTransition ? /* @__PURE__ */ jsx31(ConversationTransition, { children: props.canvas }) : props.canvas });
4370
+ const canvasContent = /* @__PURE__ */ jsx32(ShellDockProvider, { value: dock, children: /* @__PURE__ */ jsx32(HeroEntryPointProvider, { claim: claimHeroEntry, claimed: heroOwnsEntry, children: wrapTransition ? /* @__PURE__ */ jsx32(ConversationTransition, { children: props.canvas }) : props.canvas }) });
4341
4371
  return /* @__PURE__ */ jsxs20("div", { style: { display: "flex", flexDirection: "column", height: "100%", minHeight: 0, background: "var(--fourty-color-bg)" }, children: [
4342
4372
  props.presenceNotch,
4343
4373
  /* @__PURE__ */ jsxs20("div", { style: { position: "relative", flex: 1, minHeight: 0, background: "var(--fourty-color-bg)" }, children: [
4344
- /* @__PURE__ */ jsx31(
4374
+ /* @__PURE__ */ jsx32(
4345
4375
  "main",
4346
4376
  {
4347
4377
  ref: props.scrollRef,
@@ -4356,14 +4386,14 @@ function ShellScaffold(props) {
4356
4386
  ...canvasSpacing
4357
4387
  },
4358
4388
  children: /* @__PURE__ */ jsxs20("div", { "data-fourty-canvas": "", style: canvasGutterStyle, children: [
4359
- /* @__PURE__ */ jsx31("div", { style: { flex: 1, minHeight: 0 }, children: canvasContent }),
4360
- props.canvasComposer !== void 0 && /* @__PURE__ */ jsx31("div", { "data-fourty-shell-part": "composer", style: { position: "sticky", bottom: 0, zIndex: dockZIndex }, children: resolveShellSlot(props.canvasComposer, dock) }),
4389
+ /* @__PURE__ */ jsx32("div", { style: { flex: 1, minHeight: 0 }, children: canvasContent }),
4390
+ props.canvasComposer !== void 0 && !heroOwnsEntry && /* @__PURE__ */ jsx32("div", { "data-fourty-shell-part": "composer", style: { position: "sticky", bottom: 0, zIndex: dockZIndex }, children: resolveShellSlot(props.canvasComposer, dock) }),
4361
4391
  props.footer
4362
4392
  ] })
4363
4393
  }
4364
4394
  ),
4365
4395
  resolveShellSlot(props.header, dock),
4366
- /* @__PURE__ */ jsx31(
4396
+ /* @__PURE__ */ jsx32(
4367
4397
  SideDock,
4368
4398
  {
4369
4399
  open: dock.open,
@@ -4385,17 +4415,17 @@ function ShellScaffold(props) {
4385
4415
  }
4386
4416
 
4387
4417
  // src/shell/MenuDrawer.tsx
4388
- import * as React30 from "react";
4418
+ import * as React31 from "react";
4389
4419
  import { useFormFactor as useFormFactor6 } from "@40rty/ams-sdk";
4390
4420
 
4391
4421
  // src/shell/menu-columns.tsx
4392
- import { jsx as jsx32, jsxs as jsxs21 } from "react/jsx-runtime";
4422
+ import { jsx as jsx33, jsxs as jsxs21 } from "react/jsx-runtime";
4393
4423
  function MenuColumn({
4394
4424
  column,
4395
4425
  onPick
4396
4426
  }) {
4397
4427
  return /* @__PURE__ */ jsxs21("div", { style: { minWidth: 132, display: "flex", flexDirection: "column" }, children: [
4398
- /* @__PURE__ */ jsx32(
4428
+ /* @__PURE__ */ jsx33(
4399
4429
  "div",
4400
4430
  {
4401
4431
  style: {
@@ -4409,7 +4439,7 @@ function MenuColumn({
4409
4439
  children: column.title
4410
4440
  }
4411
4441
  ),
4412
- column.links.map((l) => /* @__PURE__ */ jsx32(
4442
+ column.links.map((l) => /* @__PURE__ */ jsx33(
4413
4443
  motion.button,
4414
4444
  {
4415
4445
  type: "button",
@@ -4437,14 +4467,14 @@ function MenuColumn({
4437
4467
  }
4438
4468
 
4439
4469
  // src/shell/MenuFlyout.tsx
4440
- import { jsx as jsx33 } from "react/jsx-runtime";
4470
+ import { jsx as jsx34 } from "react/jsx-runtime";
4441
4471
  function MenuFlyout({
4442
4472
  item,
4443
4473
  onPick
4444
4474
  }) {
4445
4475
  const columns = item.megaMenu?.columns;
4446
4476
  if (columns === void 0 || columns.length === 0) return null;
4447
- return /* @__PURE__ */ jsx33(
4477
+ return /* @__PURE__ */ jsx34(
4448
4478
  motion.div,
4449
4479
  {
4450
4480
  initial: { opacity: 0, x: -10 },
@@ -4464,16 +4494,16 @@ function MenuFlyout({
4464
4494
  flexWrap: "wrap",
4465
4495
  alignContent: "flex-start"
4466
4496
  },
4467
- children: columns.map((col) => /* @__PURE__ */ jsx33(MenuColumn, { column: col, onPick }, col.title))
4497
+ children: columns.map((col) => /* @__PURE__ */ jsx34(MenuColumn, { column: col, onPick }, col.title))
4468
4498
  }
4469
4499
  );
4470
4500
  }
4471
4501
 
4472
4502
  // src/shell/MenuNav.tsx
4473
- import * as React29 from "react";
4503
+ import * as React30 from "react";
4474
4504
 
4475
4505
  // src/shell/MenuAccordionPanel.tsx
4476
- import { jsx as jsx34, jsxs as jsxs22 } from "react/jsx-runtime";
4506
+ import { jsx as jsx35, jsxs as jsxs22 } from "react/jsx-runtime";
4477
4507
  function MenuAccordionPanel({
4478
4508
  item,
4479
4509
  onPick
@@ -4482,7 +4512,7 @@ function MenuAccordionPanel({
4482
4512
  const columns = item.megaMenu?.columns;
4483
4513
  if (columns === void 0 || columns.length === 0) return null;
4484
4514
  const action = item.action;
4485
- return /* @__PURE__ */ jsx34(
4515
+ return /* @__PURE__ */ jsx35(
4486
4516
  motion.div,
4487
4517
  {
4488
4518
  role: "menu",
@@ -4532,12 +4562,12 @@ function MenuAccordionPanel({
4532
4562
  color: "var(--color-text)"
4533
4563
  },
4534
4564
  children: [
4535
- /* @__PURE__ */ jsx34("span", { children: labels.menu.shopAll(item.label) }),
4536
- /* @__PURE__ */ jsx34("span", { "aria-hidden": "true", style: { opacity: 0.5 }, children: "\u2192" })
4565
+ /* @__PURE__ */ jsx35("span", { children: labels.menu.shopAll(item.label) }),
4566
+ /* @__PURE__ */ jsx35("span", { "aria-hidden": "true", style: { opacity: 0.5 }, children: "\u2192" })
4537
4567
  ]
4538
4568
  }
4539
4569
  ),
4540
- columns.map((col) => /* @__PURE__ */ jsx34(MenuColumn, { column: col, onPick }, col.title))
4570
+ columns.map((col) => /* @__PURE__ */ jsx35(MenuColumn, { column: col, onPick }, col.title))
4541
4571
  ]
4542
4572
  }
4543
4573
  )
@@ -4546,7 +4576,7 @@ function MenuAccordionPanel({
4546
4576
  }
4547
4577
 
4548
4578
  // src/shell/MenuNav.tsx
4549
- import { jsx as jsx35, jsxs as jsxs23 } from "react/jsx-runtime";
4579
+ import { jsx as jsx36, jsxs as jsxs23 } from "react/jsx-runtime";
4550
4580
  function MenuNav({
4551
4581
  items,
4552
4582
  mode,
@@ -4554,11 +4584,11 @@ function MenuNav({
4554
4584
  onOpenChange,
4555
4585
  onPick
4556
4586
  }) {
4557
- return /* @__PURE__ */ jsx35("nav", { style: { display: "flex", flexDirection: "column", paddingBottom: 24 }, children: items.map((item, i) => {
4587
+ return /* @__PURE__ */ jsx36("nav", { style: { display: "flex", flexDirection: "column", paddingBottom: 24 }, children: items.map((item, i) => {
4558
4588
  const hasMega = item.megaMenu !== void 0 && item.megaMenu.columns.length > 0;
4559
4589
  const isOpen = openIndex === i;
4560
4590
  const inverted = mode === "hover" && isOpen;
4561
- return /* @__PURE__ */ jsxs23(React29.Fragment, { children: [
4591
+ return /* @__PURE__ */ jsxs23(React30.Fragment, { children: [
4562
4592
  /* @__PURE__ */ jsxs23(
4563
4593
  motion.button,
4564
4594
  {
@@ -4596,8 +4626,8 @@ function MenuNav({
4596
4626
  textAlign: "left"
4597
4627
  },
4598
4628
  children: [
4599
- /* @__PURE__ */ jsx35("span", { children: item.label }),
4600
- /* @__PURE__ */ jsx35(
4629
+ /* @__PURE__ */ jsx36("span", { children: item.label }),
4630
+ /* @__PURE__ */ jsx36(
4601
4631
  "span",
4602
4632
  {
4603
4633
  "aria-hidden": "true",
@@ -4615,13 +4645,13 @@ function MenuNav({
4615
4645
  ]
4616
4646
  }
4617
4647
  ),
4618
- mode === "accordion" && /* @__PURE__ */ jsx35(AnimatePresence, { initial: false, children: isOpen && hasMega && /* @__PURE__ */ jsx35(MenuAccordionPanel, { item, onPick }) })
4648
+ mode === "accordion" && /* @__PURE__ */ jsx36(AnimatePresence, { initial: false, children: isOpen && hasMega && /* @__PURE__ */ jsx36(MenuAccordionPanel, { item, onPick }) })
4619
4649
  ] }, item.label);
4620
4650
  }) });
4621
4651
  }
4622
4652
 
4623
4653
  // src/shell/MenuDrawer.tsx
4624
- import { Fragment as Fragment9, jsx as jsx36, jsxs as jsxs24 } from "react/jsx-runtime";
4654
+ import { Fragment as Fragment9, jsx as jsx37, jsxs as jsxs24 } from "react/jsx-runtime";
4625
4655
  function MenuTrigger({
4626
4656
  onClick,
4627
4657
  icon,
@@ -4653,7 +4683,7 @@ function MenuTrigger({
4653
4683
  },
4654
4684
  children: [
4655
4685
  icon,
4656
- label !== void 0 && /* @__PURE__ */ jsx36("span", { children: label })
4686
+ label !== void 0 && /* @__PURE__ */ jsx37("span", { children: label })
4657
4687
  ]
4658
4688
  }
4659
4689
  );
@@ -4666,7 +4696,7 @@ function MenuDrawer({
4666
4696
  onSelectItem,
4667
4697
  panelWidth = DEFAULT_PANEL_WIDTH
4668
4698
  }) {
4669
- const pick = React30.useCallback(
4699
+ const pick = React31.useCallback(
4670
4700
  (item) => {
4671
4701
  onClose();
4672
4702
  onSelectItem(item);
@@ -4675,15 +4705,15 @@ function MenuDrawer({
4675
4705
  );
4676
4706
  const { isMobile, isTouch } = useFormFactor6();
4677
4707
  const mode = isTouch || isMobile ? "accordion" : "hover";
4678
- const panelRef = React30.useRef(null);
4708
+ const panelRef = React31.useRef(null);
4679
4709
  useScrollLock(open, panelRef);
4680
- const [openIndex, setOpenIndex] = React30.useState(null);
4681
- React30.useEffect(() => {
4710
+ const [openIndex, setOpenIndex] = React31.useState(null);
4711
+ React31.useEffect(() => {
4682
4712
  if (!open) setOpenIndex(null);
4683
4713
  }, [open]);
4684
4714
  const openItem = openIndex === null ? null : items[openIndex];
4685
- return /* @__PURE__ */ jsx36(AnimatePresence, { children: open && /* @__PURE__ */ jsxs24(Fragment9, { children: [
4686
- /* @__PURE__ */ jsx36(
4715
+ return /* @__PURE__ */ jsx37(AnimatePresence, { children: open && /* @__PURE__ */ jsxs24(Fragment9, { children: [
4716
+ /* @__PURE__ */ jsx37(
4687
4717
  motion.div,
4688
4718
  {
4689
4719
  initial: { opacity: 0 },
@@ -4747,7 +4777,7 @@ function MenuDrawer({
4747
4777
  overflowY: "auto"
4748
4778
  },
4749
4779
  children: [
4750
- /* @__PURE__ */ jsx36(
4780
+ /* @__PURE__ */ jsx37(
4751
4781
  "div",
4752
4782
  {
4753
4783
  style: {
@@ -4758,7 +4788,7 @@ function MenuDrawer({
4758
4788
  justifyContent: "flex-end",
4759
4789
  padding: "0 16px"
4760
4790
  },
4761
- children: /* @__PURE__ */ jsx36(
4791
+ children: /* @__PURE__ */ jsx37(
4762
4792
  motion.button,
4763
4793
  {
4764
4794
  type: "button",
@@ -4780,7 +4810,7 @@ function MenuDrawer({
4780
4810
  justifyContent: "center",
4781
4811
  color: "var(--color-text)"
4782
4812
  },
4783
- children: /* @__PURE__ */ jsx36("svg", { viewBox: "0 0 24 24", width: 13, height: 13, fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ jsx36(
4813
+ children: /* @__PURE__ */ jsx37("svg", { viewBox: "0 0 24 24", width: 13, height: 13, fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ jsx37(
4784
4814
  "path",
4785
4815
  {
4786
4816
  d: "M18 6 6 18M6 6l12 12",
@@ -4794,7 +4824,7 @@ function MenuDrawer({
4794
4824
  )
4795
4825
  }
4796
4826
  ),
4797
- /* @__PURE__ */ jsx36(
4827
+ /* @__PURE__ */ jsx37(
4798
4828
  MenuNav,
4799
4829
  {
4800
4830
  items,
@@ -4807,7 +4837,7 @@ function MenuDrawer({
4807
4837
  ]
4808
4838
  }
4809
4839
  ),
4810
- mode === "hover" && /* @__PURE__ */ jsx36(AnimatePresence, { children: openItem !== null && openItem !== void 0 && openItem.megaMenu !== void 0 && /* @__PURE__ */ jsx36(MenuFlyout, { item: openItem, onPick: pick }) })
4840
+ mode === "hover" && /* @__PURE__ */ jsx37(AnimatePresence, { children: openItem !== null && openItem !== void 0 && openItem.megaMenu !== void 0 && /* @__PURE__ */ jsx37(MenuFlyout, { item: openItem, onPick: pick }) })
4811
4841
  ]
4812
4842
  }
4813
4843
  )
@@ -4815,22 +4845,22 @@ function MenuDrawer({
4815
4845
  }
4816
4846
 
4817
4847
  // src/shell/MenuNavBar.tsx
4818
- import * as React31 from "react";
4819
- import { jsx as jsx37, jsxs as jsxs25 } from "react/jsx-runtime";
4848
+ import * as React32 from "react";
4849
+ import { jsx as jsx38, jsxs as jsxs25 } from "react/jsx-runtime";
4820
4850
  function MenuNavBar({
4821
4851
  items,
4822
4852
  onSelectItem,
4823
4853
  gap = 26
4824
4854
  }) {
4825
- const [openIndex, setOpenIndex] = React31.useState(null);
4826
- const pick = React31.useCallback(
4855
+ const [openIndex, setOpenIndex] = React32.useState(null);
4856
+ const pick = React32.useCallback(
4827
4857
  (item) => {
4828
4858
  setOpenIndex(null);
4829
4859
  onSelectItem(item);
4830
4860
  },
4831
4861
  [onSelectItem]
4832
4862
  );
4833
- return /* @__PURE__ */ jsx37(
4863
+ return /* @__PURE__ */ jsx38(
4834
4864
  "nav",
4835
4865
  {
4836
4866
  "aria-label": "Site menu",
@@ -4850,7 +4880,7 @@ function MenuNavBar({
4850
4880
  // THIS label instead of the row's first item regardless of which
4851
4881
  // one is hovered.
4852
4882
  /* @__PURE__ */ jsxs25("div", { style: { position: "relative" }, children: [
4853
- /* @__PURE__ */ jsx37(
4883
+ /* @__PURE__ */ jsx38(
4854
4884
  motion.button,
4855
4885
  {
4856
4886
  type: "button",
@@ -4880,7 +4910,7 @@ function MenuNavBar({
4880
4910
  children: item.label
4881
4911
  }
4882
4912
  ),
4883
- /* @__PURE__ */ jsx37(AnimatePresence, { children: isOpen && item.megaMenu !== void 0 && /* @__PURE__ */ jsx37(
4913
+ /* @__PURE__ */ jsx38(AnimatePresence, { children: isOpen && item.megaMenu !== void 0 && /* @__PURE__ */ jsx38(
4884
4914
  motion.div,
4885
4915
  {
4886
4916
  initial: { opacity: 0, y: -6 },
@@ -4896,7 +4926,7 @@ function MenuNavBar({
4896
4926
  paddingTop: 14,
4897
4927
  zIndex: 55
4898
4928
  },
4899
- children: /* @__PURE__ */ jsx37(
4929
+ children: /* @__PURE__ */ jsx38(
4900
4930
  "div",
4901
4931
  {
4902
4932
  style: {
@@ -4906,7 +4936,7 @@ function MenuNavBar({
4906
4936
  display: "flex",
4907
4937
  gap: 30
4908
4938
  },
4909
- children: item.megaMenu.columns.map((col) => /* @__PURE__ */ jsx37(MenuColumn, { column: col, onPick: pick }, col.title))
4939
+ children: item.megaMenu.columns.map((col) => /* @__PURE__ */ jsx38(MenuColumn, { column: col, onPick: pick }, col.title))
4910
4940
  }
4911
4941
  )
4912
4942
  }
@@ -4919,9 +4949,9 @@ function MenuNavBar({
4919
4949
  }
4920
4950
 
4921
4951
  // src/shell/ShellMenuChrome.tsx
4922
- import * as React32 from "react";
4952
+ import * as React33 from "react";
4923
4953
  import { useExclusiveOverlay as useExclusiveOverlay2, useFormFactor as useFormFactor7, useScrollContainerRef as useScrollContainerRef3 } from "@40rty/ams-sdk";
4924
- import { Fragment as Fragment10, jsx as jsx38, jsxs as jsxs26 } from "react/jsx-runtime";
4954
+ import { Fragment as Fragment10, jsx as jsx39, jsxs as jsxs26 } from "react/jsx-runtime";
4925
4955
  function ShellMenuChrome({
4926
4956
  logo,
4927
4957
  menuIcon,
@@ -4933,8 +4963,8 @@ function ShellMenuChrome({
4933
4963
  panelWidth,
4934
4964
  className
4935
4965
  }) {
4936
- const [open, setOpen] = React32.useState(false);
4937
- useExclusiveOverlay2("menu", open, React32.useCallback(() => setOpen(false), []));
4966
+ const [open, setOpen] = React33.useState(false);
4967
+ useExclusiveOverlay2("menu", open, React33.useCallback(() => setOpen(false), []));
4938
4968
  const { isMobile } = useFormFactor7();
4939
4969
  const scrolled = useScrollThreshold(useScrollContainerRef3(), 0);
4940
4970
  return /* @__PURE__ */ jsxs26(Fragment10, { children: [
@@ -4963,9 +4993,9 @@ function ShellMenuChrome({
4963
4993
  zIndex: 50
4964
4994
  },
4965
4995
  children: [
4966
- /* @__PURE__ */ jsx38("span", { style: { justifySelf: "start", display: "inline-flex", alignItems: "center" }, children: items.length > 0 && /* @__PURE__ */ jsx38(MenuTrigger, { onClick: () => setOpen(true), icon: menuIcon }) }),
4967
- /* @__PURE__ */ jsx38("span", { style: { display: "inline-flex", alignItems: "center", minWidth: 0 }, children: logo }),
4968
- /* @__PURE__ */ jsx38("span", { "aria-hidden": true })
4996
+ /* @__PURE__ */ jsx39("span", { style: { justifySelf: "start", display: "inline-flex", alignItems: "center" }, children: items.length > 0 && /* @__PURE__ */ jsx39(MenuTrigger, { onClick: () => setOpen(true), icon: menuIcon }) }),
4997
+ /* @__PURE__ */ jsx39("span", { style: { display: "inline-flex", alignItems: "center", minWidth: 0 }, children: logo }),
4998
+ /* @__PURE__ */ jsx39("span", { "aria-hidden": true })
4969
4999
  ]
4970
5000
  }
4971
5001
  ) : /* @__PURE__ */ jsxs26(
@@ -4990,15 +5020,15 @@ function ShellMenuChrome({
4990
5020
  zIndex: 50
4991
5021
  },
4992
5022
  children: [
4993
- /* @__PURE__ */ jsx38(ChromeSurface, { visible: scrolled, lifted: scrolled }),
5023
+ /* @__PURE__ */ jsx39(ChromeSurface, { visible: scrolled, lifted: scrolled }),
4994
5024
  /* @__PURE__ */ jsxs26("div", { style: { position: "relative", display: "flex", alignItems: "center", gap, minWidth: 0 }, children: [
4995
5025
  logo,
4996
- items.length > 0 && /* @__PURE__ */ jsx38(MenuNavBar, { items, onSelectItem })
5026
+ items.length > 0 && /* @__PURE__ */ jsx39(MenuNavBar, { items, onSelectItem })
4997
5027
  ] })
4998
5028
  ]
4999
5029
  }
5000
5030
  ),
5001
- isMobile && /* @__PURE__ */ jsx38(
5031
+ isMobile && /* @__PURE__ */ jsx39(
5002
5032
  MenuDrawer,
5003
5033
  {
5004
5034
  open,
@@ -5013,7 +5043,7 @@ function ShellMenuChrome({
5013
5043
 
5014
5044
  // src/shell/LauncherDock.tsx
5015
5045
  import { useFormFactor as useFormFactor8 } from "@40rty/ams-sdk";
5016
- import { jsx as jsx39 } from "react/jsx-runtime";
5046
+ import { jsx as jsx40 } from "react/jsx-runtime";
5017
5047
  function LauncherDock({
5018
5048
  children,
5019
5049
  top = 12,
@@ -5024,7 +5054,7 @@ function LauncherDock({
5024
5054
  }) {
5025
5055
  const { isMobile } = useFormFactor8();
5026
5056
  if (isMobile) {
5027
- return /* @__PURE__ */ jsx39(
5057
+ return /* @__PURE__ */ jsx40(
5028
5058
  "div",
5029
5059
  {
5030
5060
  "data-fourty-shell-part": "launchers",
@@ -5034,7 +5064,7 @@ function LauncherDock({
5034
5064
  }
5035
5065
  );
5036
5066
  }
5037
- return /* @__PURE__ */ jsx39(
5067
+ return /* @__PURE__ */ jsx40(
5038
5068
  "div",
5039
5069
  {
5040
5070
  "data-fourty-shell-part": "launchers",
@@ -5058,7 +5088,7 @@ function LauncherDock({
5058
5088
  }
5059
5089
 
5060
5090
  // src/shell/Button.tsx
5061
- import { Fragment as Fragment11, jsx as jsx40, jsxs as jsxs27 } from "react/jsx-runtime";
5091
+ import { Fragment as Fragment11, jsx as jsx41, jsxs as jsxs27 } from "react/jsx-runtime";
5062
5092
  var SIZE_SPEC = {
5063
5093
  sm: { padding: "8px 14px", fontSize: 11, iconSize: 14, height: 32 },
5064
5094
  md: { padding: "12px 24px", fontSize: 13.3333, iconSize: 16, height: 42 },
@@ -5211,7 +5241,7 @@ function Button({
5211
5241
  };
5212
5242
  const labelText = children !== void 0 ? children : label;
5213
5243
  const computedAriaLabel = ariaLabel !== void 0 ? ariaLabel : isIconOnly && label !== void 0 ? label : void 0;
5214
- return /* @__PURE__ */ jsx40(
5244
+ return /* @__PURE__ */ jsx41(
5215
5245
  "button",
5216
5246
  {
5217
5247
  type,
@@ -5221,11 +5251,11 @@ function Button({
5221
5251
  style: baseStyle,
5222
5252
  onMouseEnter,
5223
5253
  onMouseLeave,
5224
- children: loading ? /* @__PURE__ */ jsx40(Spinner, { size: s.iconSize - 2 }) : /* @__PURE__ */ jsxs27(Fragment11, { children: [
5225
- Icon && iconPosition === "left" && !isIconOnly && /* @__PURE__ */ jsx40(Icon, { size: s.iconSize, strokeWidth: 1.5 }),
5226
- Icon && isIconOnly && /* @__PURE__ */ jsx40(Icon, { size: s.iconSize + 2, strokeWidth: 1.5 }),
5254
+ children: loading ? /* @__PURE__ */ jsx41(Spinner, { size: s.iconSize - 2 }) : /* @__PURE__ */ jsxs27(Fragment11, { children: [
5255
+ Icon && iconPosition === "left" && !isIconOnly && /* @__PURE__ */ jsx41(Icon, { size: s.iconSize, strokeWidth: 1.5 }),
5256
+ Icon && isIconOnly && /* @__PURE__ */ jsx41(Icon, { size: s.iconSize + 2, strokeWidth: 1.5 }),
5227
5257
  !isIconOnly && labelText,
5228
- Icon && iconPosition === "right" && !isIconOnly && /* @__PURE__ */ jsx40(Icon, { size: s.iconSize, strokeWidth: 1.5 })
5258
+ Icon && iconPosition === "right" && !isIconOnly && /* @__PURE__ */ jsx41(Icon, { size: s.iconSize, strokeWidth: 1.5 })
5229
5259
  ] })
5230
5260
  }
5231
5261
  );
@@ -5233,7 +5263,7 @@ function Button({
5233
5263
 
5234
5264
  // src/shell/Skeleton.tsx
5235
5265
  import { motion as motion3 } from "framer-motion";
5236
- import { jsx as jsx41 } from "react/jsx-runtime";
5266
+ import { jsx as jsx42 } from "react/jsx-runtime";
5237
5267
  var BASE_STYLE = {
5238
5268
  display: "inline-block",
5239
5269
  backgroundColor: "var(--color-surface-alt, #f3f3f3)",
@@ -5257,13 +5287,13 @@ function Skeleton({
5257
5287
  style
5258
5288
  }) {
5259
5289
  const variantStyle = variant === "text" ? { width: dim(width, "100%"), height: dim(height, "1em") } : variant === "pill" ? { width: dim(width, 48), height: dim(height, 18) } : { width: dim(width, "100%"), height: dim(height, "100%") };
5260
- return /* @__PURE__ */ jsx41(
5290
+ return /* @__PURE__ */ jsx42(
5261
5291
  "span",
5262
5292
  {
5263
5293
  className,
5264
5294
  "aria-hidden": "true",
5265
5295
  style: { ...BASE_STYLE, ...variantStyle, ...style },
5266
- children: /* @__PURE__ */ jsx41(
5296
+ children: /* @__PURE__ */ jsx42(
5267
5297
  motion3.span,
5268
5298
  {
5269
5299
  style: SHIMMER_OVERLAY_STYLE,
@@ -27,7 +27,9 @@ export interface ShellScaffoldProps {
27
27
  * of the canvas scroll. For a shell whose conversation IS the canvas (each
28
28
  * turn a page with its own answer). The side dock stays available as an
29
29
  * optional view of the thread: it never opens by itself, only on the
30
- * visitor's toggle. Mobile keeps the island, fed by `composer`.
30
+ * visitor's toggle. A phone keeps this same input, pinned to the bottom of the
31
+ * screen (`PageComposerDock`), in place of the island: the conversation is the
32
+ * page on every screen.
31
33
  */
32
34
  canvasComposer?: ShellSlot;
33
35
  /** Ref attached to the scrolling `<main>` — the platform scroll container
@@ -14,6 +14,10 @@ export interface DefaultMobileShellProps {
14
14
  * already looking at the thread when they'd want to see it. Carries the
15
15
  * standing knowledge (dossier) chips. Omit to render none. */
16
16
  presenceNotch?: React.ReactNode;
17
+ /** The shell's page composer (`ShellScaffold`'s `canvasComposer`). When the
18
+ * shell asks from the page, a phone keeps that same input, pinned to the
19
+ * bottom (`PageComposerDock`), and the island is not mounted. */
20
+ canvasComposer?: ShellSlot;
17
21
  /** Control cluster (cart / wishlist / account) — the top chrome's right cell.
18
22
  * Expected IN FLOW (see `LauncherDock`): the cell centres it on the bar's own
19
23
  * line, alongside the hamburger and the brand mark. */
@@ -0,0 +1,13 @@
1
+ import * as React from 'react';
2
+ /**
3
+ * The brand's own page composer, pinned to the bottom of a phone screen — the
4
+ * mobile home of a shell's `canvasComposer`. A shell that asks from the page
5
+ * (the conversation is the page: each turn heads its own) keeps that same input
6
+ * on a phone, in place of the platform island. Lifted by the keyboard / browser
7
+ * chrome inset; reports its height so the canvas keeps clear of it.
8
+ */
9
+ export declare function PageComposerDock({ bottom, onHeightChange, children, }: {
10
+ bottom: number;
11
+ onHeightChange: (height: number) => void;
12
+ children: React.ReactNode;
13
+ }): React.ReactElement;
@@ -79,12 +79,14 @@ export declare function HeroEntryPointProvider({ claim, claimed, children, }: {
79
79
  */
80
80
  export declare function useHeroEntryPointVisible(): boolean;
81
81
  /**
82
- * Called by a brand hero for as long as IT is the mobile entry point.
82
+ * Called by a brand hero for as long as IT is the entry point — its own
83
+ * prompt box showing and on screen. The phone's island and a shell's page
84
+ * composer (`canvasComposer`, desktop and phone) stand aside for exactly that
85
+ * long.
83
86
  *
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.
87
+ * Pass `false` once the hero's own box has retired (or scrolled away) to
88
+ * release. Outside a shell there is no provider and this is a no-op, so a
89
+ * component can call it unconditionally without knowing where it is mounted.
88
90
  */
89
91
  export declare function useClaimHeroEntryPoint(active: boolean): void;
90
92
  /**
package/package.json CHANGED
@@ -71,12 +71,12 @@
71
71
  "zod": "^3.23.0"
72
72
  },
73
73
  "peerDependencies": {
74
- "@40rty/ams-sdk": "0.4.2",
74
+ "@40rty/ams-sdk": "0.4.4",
75
75
  "lucide-react": ">=0.400.0",
76
76
  "react": ">=18.0.0",
77
77
  "react-dom": ">=18.0.0"
78
78
  },
79
- "version": "0.4.2",
79
+ "version": "0.4.4",
80
80
  "homepage": "https://docs.40rty.ai",
81
81
  "license": "UNLICENSED",
82
82
  "engines": {