@40rty/ams-ui 0.4.2 → 0.4.3

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 && !pageComposes ? 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 && /* @__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,
@@ -4311,21 +4335,22 @@ function ShellScaffold(props) {
4311
4335
  const isMobile = useMediaQuery(mq);
4312
4336
  const dock = useDockState(props.reopenDockOnMessage === true, props.canvasComposer === void 0);
4313
4337
  const resizable = props.resizableDock === true;
4314
- const [liveWidth, setLiveWidth] = React28.useState(dockWidth);
4315
- const [resizing, setResizing] = React28.useState(false);
4338
+ const [liveWidth, setLiveWidth] = React29.useState(dockWidth);
4339
+ const [resizing, setResizing] = React29.useState(false);
4316
4340
  const effectiveWidth = resizable ? liveWidth : dockWidth;
4317
4341
  const canvasSpacing = useSideDockSpacing(dock.open, effectiveWidth, !resizing);
4318
4342
  if (props.mobile !== void 0 && isMobile) {
4319
- return /* @__PURE__ */ jsx31(ShellDockProvider, { value: dock, children: props.mobile });
4343
+ return /* @__PURE__ */ jsx32(ShellDockProvider, { value: dock, children: props.mobile });
4320
4344
  }
4321
4345
  if (isMobile) {
4322
- return /* @__PURE__ */ jsx31(ShellDockProvider, { value: dock, children: /* @__PURE__ */ jsx31(
4346
+ return /* @__PURE__ */ jsx32(ShellDockProvider, { value: dock, children: /* @__PURE__ */ jsx32(
4323
4347
  DefaultMobileShell,
4324
4348
  {
4325
4349
  canvas: props.canvas,
4326
4350
  footer: props.footer,
4327
4351
  composer: props.composer,
4328
4352
  presenceNotch: props.presenceNotch,
4353
+ canvasComposer: props.canvasComposer,
4329
4354
  launchers: props.launchers,
4330
4355
  drawers: props.drawers,
4331
4356
  logo: props.logo !== void 0 ? props.logo : props.header,
@@ -4337,11 +4362,11 @@ function ShellScaffold(props) {
4337
4362
  }
4338
4363
  ) });
4339
4364
  }
4340
- const canvasContent = /* @__PURE__ */ jsx31(ShellDockProvider, { value: dock, children: wrapTransition ? /* @__PURE__ */ jsx31(ConversationTransition, { children: props.canvas }) : props.canvas });
4365
+ const canvasContent = /* @__PURE__ */ jsx32(ShellDockProvider, { value: dock, children: wrapTransition ? /* @__PURE__ */ jsx32(ConversationTransition, { children: props.canvas }) : props.canvas });
4341
4366
  return /* @__PURE__ */ jsxs20("div", { style: { display: "flex", flexDirection: "column", height: "100%", minHeight: 0, background: "var(--fourty-color-bg)" }, children: [
4342
4367
  props.presenceNotch,
4343
4368
  /* @__PURE__ */ jsxs20("div", { style: { position: "relative", flex: 1, minHeight: 0, background: "var(--fourty-color-bg)" }, children: [
4344
- /* @__PURE__ */ jsx31(
4369
+ /* @__PURE__ */ jsx32(
4345
4370
  "main",
4346
4371
  {
4347
4372
  ref: props.scrollRef,
@@ -4356,14 +4381,14 @@ function ShellScaffold(props) {
4356
4381
  ...canvasSpacing
4357
4382
  },
4358
4383
  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) }),
4384
+ /* @__PURE__ */ jsx32("div", { style: { flex: 1, minHeight: 0 }, children: canvasContent }),
4385
+ props.canvasComposer !== void 0 && /* @__PURE__ */ jsx32("div", { "data-fourty-shell-part": "composer", style: { position: "sticky", bottom: 0, zIndex: dockZIndex }, children: resolveShellSlot(props.canvasComposer, dock) }),
4361
4386
  props.footer
4362
4387
  ] })
4363
4388
  }
4364
4389
  ),
4365
4390
  resolveShellSlot(props.header, dock),
4366
- /* @__PURE__ */ jsx31(
4391
+ /* @__PURE__ */ jsx32(
4367
4392
  SideDock,
4368
4393
  {
4369
4394
  open: dock.open,
@@ -4385,17 +4410,17 @@ function ShellScaffold(props) {
4385
4410
  }
4386
4411
 
4387
4412
  // src/shell/MenuDrawer.tsx
4388
- import * as React30 from "react";
4413
+ import * as React31 from "react";
4389
4414
  import { useFormFactor as useFormFactor6 } from "@40rty/ams-sdk";
4390
4415
 
4391
4416
  // src/shell/menu-columns.tsx
4392
- import { jsx as jsx32, jsxs as jsxs21 } from "react/jsx-runtime";
4417
+ import { jsx as jsx33, jsxs as jsxs21 } from "react/jsx-runtime";
4393
4418
  function MenuColumn({
4394
4419
  column,
4395
4420
  onPick
4396
4421
  }) {
4397
4422
  return /* @__PURE__ */ jsxs21("div", { style: { minWidth: 132, display: "flex", flexDirection: "column" }, children: [
4398
- /* @__PURE__ */ jsx32(
4423
+ /* @__PURE__ */ jsx33(
4399
4424
  "div",
4400
4425
  {
4401
4426
  style: {
@@ -4409,7 +4434,7 @@ function MenuColumn({
4409
4434
  children: column.title
4410
4435
  }
4411
4436
  ),
4412
- column.links.map((l) => /* @__PURE__ */ jsx32(
4437
+ column.links.map((l) => /* @__PURE__ */ jsx33(
4413
4438
  motion.button,
4414
4439
  {
4415
4440
  type: "button",
@@ -4437,14 +4462,14 @@ function MenuColumn({
4437
4462
  }
4438
4463
 
4439
4464
  // src/shell/MenuFlyout.tsx
4440
- import { jsx as jsx33 } from "react/jsx-runtime";
4465
+ import { jsx as jsx34 } from "react/jsx-runtime";
4441
4466
  function MenuFlyout({
4442
4467
  item,
4443
4468
  onPick
4444
4469
  }) {
4445
4470
  const columns = item.megaMenu?.columns;
4446
4471
  if (columns === void 0 || columns.length === 0) return null;
4447
- return /* @__PURE__ */ jsx33(
4472
+ return /* @__PURE__ */ jsx34(
4448
4473
  motion.div,
4449
4474
  {
4450
4475
  initial: { opacity: 0, x: -10 },
@@ -4464,16 +4489,16 @@ function MenuFlyout({
4464
4489
  flexWrap: "wrap",
4465
4490
  alignContent: "flex-start"
4466
4491
  },
4467
- children: columns.map((col) => /* @__PURE__ */ jsx33(MenuColumn, { column: col, onPick }, col.title))
4492
+ children: columns.map((col) => /* @__PURE__ */ jsx34(MenuColumn, { column: col, onPick }, col.title))
4468
4493
  }
4469
4494
  );
4470
4495
  }
4471
4496
 
4472
4497
  // src/shell/MenuNav.tsx
4473
- import * as React29 from "react";
4498
+ import * as React30 from "react";
4474
4499
 
4475
4500
  // src/shell/MenuAccordionPanel.tsx
4476
- import { jsx as jsx34, jsxs as jsxs22 } from "react/jsx-runtime";
4501
+ import { jsx as jsx35, jsxs as jsxs22 } from "react/jsx-runtime";
4477
4502
  function MenuAccordionPanel({
4478
4503
  item,
4479
4504
  onPick
@@ -4482,7 +4507,7 @@ function MenuAccordionPanel({
4482
4507
  const columns = item.megaMenu?.columns;
4483
4508
  if (columns === void 0 || columns.length === 0) return null;
4484
4509
  const action = item.action;
4485
- return /* @__PURE__ */ jsx34(
4510
+ return /* @__PURE__ */ jsx35(
4486
4511
  motion.div,
4487
4512
  {
4488
4513
  role: "menu",
@@ -4532,12 +4557,12 @@ function MenuAccordionPanel({
4532
4557
  color: "var(--color-text)"
4533
4558
  },
4534
4559
  children: [
4535
- /* @__PURE__ */ jsx34("span", { children: labels.menu.shopAll(item.label) }),
4536
- /* @__PURE__ */ jsx34("span", { "aria-hidden": "true", style: { opacity: 0.5 }, children: "\u2192" })
4560
+ /* @__PURE__ */ jsx35("span", { children: labels.menu.shopAll(item.label) }),
4561
+ /* @__PURE__ */ jsx35("span", { "aria-hidden": "true", style: { opacity: 0.5 }, children: "\u2192" })
4537
4562
  ]
4538
4563
  }
4539
4564
  ),
4540
- columns.map((col) => /* @__PURE__ */ jsx34(MenuColumn, { column: col, onPick }, col.title))
4565
+ columns.map((col) => /* @__PURE__ */ jsx35(MenuColumn, { column: col, onPick }, col.title))
4541
4566
  ]
4542
4567
  }
4543
4568
  )
@@ -4546,7 +4571,7 @@ function MenuAccordionPanel({
4546
4571
  }
4547
4572
 
4548
4573
  // src/shell/MenuNav.tsx
4549
- import { jsx as jsx35, jsxs as jsxs23 } from "react/jsx-runtime";
4574
+ import { jsx as jsx36, jsxs as jsxs23 } from "react/jsx-runtime";
4550
4575
  function MenuNav({
4551
4576
  items,
4552
4577
  mode,
@@ -4554,11 +4579,11 @@ function MenuNav({
4554
4579
  onOpenChange,
4555
4580
  onPick
4556
4581
  }) {
4557
- return /* @__PURE__ */ jsx35("nav", { style: { display: "flex", flexDirection: "column", paddingBottom: 24 }, children: items.map((item, i) => {
4582
+ return /* @__PURE__ */ jsx36("nav", { style: { display: "flex", flexDirection: "column", paddingBottom: 24 }, children: items.map((item, i) => {
4558
4583
  const hasMega = item.megaMenu !== void 0 && item.megaMenu.columns.length > 0;
4559
4584
  const isOpen = openIndex === i;
4560
4585
  const inverted = mode === "hover" && isOpen;
4561
- return /* @__PURE__ */ jsxs23(React29.Fragment, { children: [
4586
+ return /* @__PURE__ */ jsxs23(React30.Fragment, { children: [
4562
4587
  /* @__PURE__ */ jsxs23(
4563
4588
  motion.button,
4564
4589
  {
@@ -4596,8 +4621,8 @@ function MenuNav({
4596
4621
  textAlign: "left"
4597
4622
  },
4598
4623
  children: [
4599
- /* @__PURE__ */ jsx35("span", { children: item.label }),
4600
- /* @__PURE__ */ jsx35(
4624
+ /* @__PURE__ */ jsx36("span", { children: item.label }),
4625
+ /* @__PURE__ */ jsx36(
4601
4626
  "span",
4602
4627
  {
4603
4628
  "aria-hidden": "true",
@@ -4615,13 +4640,13 @@ function MenuNav({
4615
4640
  ]
4616
4641
  }
4617
4642
  ),
4618
- mode === "accordion" && /* @__PURE__ */ jsx35(AnimatePresence, { initial: false, children: isOpen && hasMega && /* @__PURE__ */ jsx35(MenuAccordionPanel, { item, onPick }) })
4643
+ mode === "accordion" && /* @__PURE__ */ jsx36(AnimatePresence, { initial: false, children: isOpen && hasMega && /* @__PURE__ */ jsx36(MenuAccordionPanel, { item, onPick }) })
4619
4644
  ] }, item.label);
4620
4645
  }) });
4621
4646
  }
4622
4647
 
4623
4648
  // src/shell/MenuDrawer.tsx
4624
- import { Fragment as Fragment9, jsx as jsx36, jsxs as jsxs24 } from "react/jsx-runtime";
4649
+ import { Fragment as Fragment9, jsx as jsx37, jsxs as jsxs24 } from "react/jsx-runtime";
4625
4650
  function MenuTrigger({
4626
4651
  onClick,
4627
4652
  icon,
@@ -4653,7 +4678,7 @@ function MenuTrigger({
4653
4678
  },
4654
4679
  children: [
4655
4680
  icon,
4656
- label !== void 0 && /* @__PURE__ */ jsx36("span", { children: label })
4681
+ label !== void 0 && /* @__PURE__ */ jsx37("span", { children: label })
4657
4682
  ]
4658
4683
  }
4659
4684
  );
@@ -4666,7 +4691,7 @@ function MenuDrawer({
4666
4691
  onSelectItem,
4667
4692
  panelWidth = DEFAULT_PANEL_WIDTH
4668
4693
  }) {
4669
- const pick = React30.useCallback(
4694
+ const pick = React31.useCallback(
4670
4695
  (item) => {
4671
4696
  onClose();
4672
4697
  onSelectItem(item);
@@ -4675,15 +4700,15 @@ function MenuDrawer({
4675
4700
  );
4676
4701
  const { isMobile, isTouch } = useFormFactor6();
4677
4702
  const mode = isTouch || isMobile ? "accordion" : "hover";
4678
- const panelRef = React30.useRef(null);
4703
+ const panelRef = React31.useRef(null);
4679
4704
  useScrollLock(open, panelRef);
4680
- const [openIndex, setOpenIndex] = React30.useState(null);
4681
- React30.useEffect(() => {
4705
+ const [openIndex, setOpenIndex] = React31.useState(null);
4706
+ React31.useEffect(() => {
4682
4707
  if (!open) setOpenIndex(null);
4683
4708
  }, [open]);
4684
4709
  const openItem = openIndex === null ? null : items[openIndex];
4685
- return /* @__PURE__ */ jsx36(AnimatePresence, { children: open && /* @__PURE__ */ jsxs24(Fragment9, { children: [
4686
- /* @__PURE__ */ jsx36(
4710
+ return /* @__PURE__ */ jsx37(AnimatePresence, { children: open && /* @__PURE__ */ jsxs24(Fragment9, { children: [
4711
+ /* @__PURE__ */ jsx37(
4687
4712
  motion.div,
4688
4713
  {
4689
4714
  initial: { opacity: 0 },
@@ -4747,7 +4772,7 @@ function MenuDrawer({
4747
4772
  overflowY: "auto"
4748
4773
  },
4749
4774
  children: [
4750
- /* @__PURE__ */ jsx36(
4775
+ /* @__PURE__ */ jsx37(
4751
4776
  "div",
4752
4777
  {
4753
4778
  style: {
@@ -4758,7 +4783,7 @@ function MenuDrawer({
4758
4783
  justifyContent: "flex-end",
4759
4784
  padding: "0 16px"
4760
4785
  },
4761
- children: /* @__PURE__ */ jsx36(
4786
+ children: /* @__PURE__ */ jsx37(
4762
4787
  motion.button,
4763
4788
  {
4764
4789
  type: "button",
@@ -4780,7 +4805,7 @@ function MenuDrawer({
4780
4805
  justifyContent: "center",
4781
4806
  color: "var(--color-text)"
4782
4807
  },
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(
4808
+ 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
4809
  "path",
4785
4810
  {
4786
4811
  d: "M18 6 6 18M6 6l12 12",
@@ -4794,7 +4819,7 @@ function MenuDrawer({
4794
4819
  )
4795
4820
  }
4796
4821
  ),
4797
- /* @__PURE__ */ jsx36(
4822
+ /* @__PURE__ */ jsx37(
4798
4823
  MenuNav,
4799
4824
  {
4800
4825
  items,
@@ -4807,7 +4832,7 @@ function MenuDrawer({
4807
4832
  ]
4808
4833
  }
4809
4834
  ),
4810
- mode === "hover" && /* @__PURE__ */ jsx36(AnimatePresence, { children: openItem !== null && openItem !== void 0 && openItem.megaMenu !== void 0 && /* @__PURE__ */ jsx36(MenuFlyout, { item: openItem, onPick: pick }) })
4835
+ mode === "hover" && /* @__PURE__ */ jsx37(AnimatePresence, { children: openItem !== null && openItem !== void 0 && openItem.megaMenu !== void 0 && /* @__PURE__ */ jsx37(MenuFlyout, { item: openItem, onPick: pick }) })
4811
4836
  ]
4812
4837
  }
4813
4838
  )
@@ -4815,22 +4840,22 @@ function MenuDrawer({
4815
4840
  }
4816
4841
 
4817
4842
  // src/shell/MenuNavBar.tsx
4818
- import * as React31 from "react";
4819
- import { jsx as jsx37, jsxs as jsxs25 } from "react/jsx-runtime";
4843
+ import * as React32 from "react";
4844
+ import { jsx as jsx38, jsxs as jsxs25 } from "react/jsx-runtime";
4820
4845
  function MenuNavBar({
4821
4846
  items,
4822
4847
  onSelectItem,
4823
4848
  gap = 26
4824
4849
  }) {
4825
- const [openIndex, setOpenIndex] = React31.useState(null);
4826
- const pick = React31.useCallback(
4850
+ const [openIndex, setOpenIndex] = React32.useState(null);
4851
+ const pick = React32.useCallback(
4827
4852
  (item) => {
4828
4853
  setOpenIndex(null);
4829
4854
  onSelectItem(item);
4830
4855
  },
4831
4856
  [onSelectItem]
4832
4857
  );
4833
- return /* @__PURE__ */ jsx37(
4858
+ return /* @__PURE__ */ jsx38(
4834
4859
  "nav",
4835
4860
  {
4836
4861
  "aria-label": "Site menu",
@@ -4850,7 +4875,7 @@ function MenuNavBar({
4850
4875
  // THIS label instead of the row's first item regardless of which
4851
4876
  // one is hovered.
4852
4877
  /* @__PURE__ */ jsxs25("div", { style: { position: "relative" }, children: [
4853
- /* @__PURE__ */ jsx37(
4878
+ /* @__PURE__ */ jsx38(
4854
4879
  motion.button,
4855
4880
  {
4856
4881
  type: "button",
@@ -4880,7 +4905,7 @@ function MenuNavBar({
4880
4905
  children: item.label
4881
4906
  }
4882
4907
  ),
4883
- /* @__PURE__ */ jsx37(AnimatePresence, { children: isOpen && item.megaMenu !== void 0 && /* @__PURE__ */ jsx37(
4908
+ /* @__PURE__ */ jsx38(AnimatePresence, { children: isOpen && item.megaMenu !== void 0 && /* @__PURE__ */ jsx38(
4884
4909
  motion.div,
4885
4910
  {
4886
4911
  initial: { opacity: 0, y: -6 },
@@ -4896,7 +4921,7 @@ function MenuNavBar({
4896
4921
  paddingTop: 14,
4897
4922
  zIndex: 55
4898
4923
  },
4899
- children: /* @__PURE__ */ jsx37(
4924
+ children: /* @__PURE__ */ jsx38(
4900
4925
  "div",
4901
4926
  {
4902
4927
  style: {
@@ -4906,7 +4931,7 @@ function MenuNavBar({
4906
4931
  display: "flex",
4907
4932
  gap: 30
4908
4933
  },
4909
- children: item.megaMenu.columns.map((col) => /* @__PURE__ */ jsx37(MenuColumn, { column: col, onPick: pick }, col.title))
4934
+ children: item.megaMenu.columns.map((col) => /* @__PURE__ */ jsx38(MenuColumn, { column: col, onPick: pick }, col.title))
4910
4935
  }
4911
4936
  )
4912
4937
  }
@@ -4919,9 +4944,9 @@ function MenuNavBar({
4919
4944
  }
4920
4945
 
4921
4946
  // src/shell/ShellMenuChrome.tsx
4922
- import * as React32 from "react";
4947
+ import * as React33 from "react";
4923
4948
  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";
4949
+ import { Fragment as Fragment10, jsx as jsx39, jsxs as jsxs26 } from "react/jsx-runtime";
4925
4950
  function ShellMenuChrome({
4926
4951
  logo,
4927
4952
  menuIcon,
@@ -4933,8 +4958,8 @@ function ShellMenuChrome({
4933
4958
  panelWidth,
4934
4959
  className
4935
4960
  }) {
4936
- const [open, setOpen] = React32.useState(false);
4937
- useExclusiveOverlay2("menu", open, React32.useCallback(() => setOpen(false), []));
4961
+ const [open, setOpen] = React33.useState(false);
4962
+ useExclusiveOverlay2("menu", open, React33.useCallback(() => setOpen(false), []));
4938
4963
  const { isMobile } = useFormFactor7();
4939
4964
  const scrolled = useScrollThreshold(useScrollContainerRef3(), 0);
4940
4965
  return /* @__PURE__ */ jsxs26(Fragment10, { children: [
@@ -4963,9 +4988,9 @@ function ShellMenuChrome({
4963
4988
  zIndex: 50
4964
4989
  },
4965
4990
  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 })
4991
+ /* @__PURE__ */ jsx39("span", { style: { justifySelf: "start", display: "inline-flex", alignItems: "center" }, children: items.length > 0 && /* @__PURE__ */ jsx39(MenuTrigger, { onClick: () => setOpen(true), icon: menuIcon }) }),
4992
+ /* @__PURE__ */ jsx39("span", { style: { display: "inline-flex", alignItems: "center", minWidth: 0 }, children: logo }),
4993
+ /* @__PURE__ */ jsx39("span", { "aria-hidden": true })
4969
4994
  ]
4970
4995
  }
4971
4996
  ) : /* @__PURE__ */ jsxs26(
@@ -4990,15 +5015,15 @@ function ShellMenuChrome({
4990
5015
  zIndex: 50
4991
5016
  },
4992
5017
  children: [
4993
- /* @__PURE__ */ jsx38(ChromeSurface, { visible: scrolled, lifted: scrolled }),
5018
+ /* @__PURE__ */ jsx39(ChromeSurface, { visible: scrolled, lifted: scrolled }),
4994
5019
  /* @__PURE__ */ jsxs26("div", { style: { position: "relative", display: "flex", alignItems: "center", gap, minWidth: 0 }, children: [
4995
5020
  logo,
4996
- items.length > 0 && /* @__PURE__ */ jsx38(MenuNavBar, { items, onSelectItem })
5021
+ items.length > 0 && /* @__PURE__ */ jsx39(MenuNavBar, { items, onSelectItem })
4997
5022
  ] })
4998
5023
  ]
4999
5024
  }
5000
5025
  ),
5001
- isMobile && /* @__PURE__ */ jsx38(
5026
+ isMobile && /* @__PURE__ */ jsx39(
5002
5027
  MenuDrawer,
5003
5028
  {
5004
5029
  open,
@@ -5013,7 +5038,7 @@ function ShellMenuChrome({
5013
5038
 
5014
5039
  // src/shell/LauncherDock.tsx
5015
5040
  import { useFormFactor as useFormFactor8 } from "@40rty/ams-sdk";
5016
- import { jsx as jsx39 } from "react/jsx-runtime";
5041
+ import { jsx as jsx40 } from "react/jsx-runtime";
5017
5042
  function LauncherDock({
5018
5043
  children,
5019
5044
  top = 12,
@@ -5024,7 +5049,7 @@ function LauncherDock({
5024
5049
  }) {
5025
5050
  const { isMobile } = useFormFactor8();
5026
5051
  if (isMobile) {
5027
- return /* @__PURE__ */ jsx39(
5052
+ return /* @__PURE__ */ jsx40(
5028
5053
  "div",
5029
5054
  {
5030
5055
  "data-fourty-shell-part": "launchers",
@@ -5034,7 +5059,7 @@ function LauncherDock({
5034
5059
  }
5035
5060
  );
5036
5061
  }
5037
- return /* @__PURE__ */ jsx39(
5062
+ return /* @__PURE__ */ jsx40(
5038
5063
  "div",
5039
5064
  {
5040
5065
  "data-fourty-shell-part": "launchers",
@@ -5058,7 +5083,7 @@ function LauncherDock({
5058
5083
  }
5059
5084
 
5060
5085
  // src/shell/Button.tsx
5061
- import { Fragment as Fragment11, jsx as jsx40, jsxs as jsxs27 } from "react/jsx-runtime";
5086
+ import { Fragment as Fragment11, jsx as jsx41, jsxs as jsxs27 } from "react/jsx-runtime";
5062
5087
  var SIZE_SPEC = {
5063
5088
  sm: { padding: "8px 14px", fontSize: 11, iconSize: 14, height: 32 },
5064
5089
  md: { padding: "12px 24px", fontSize: 13.3333, iconSize: 16, height: 42 },
@@ -5211,7 +5236,7 @@ function Button({
5211
5236
  };
5212
5237
  const labelText = children !== void 0 ? children : label;
5213
5238
  const computedAriaLabel = ariaLabel !== void 0 ? ariaLabel : isIconOnly && label !== void 0 ? label : void 0;
5214
- return /* @__PURE__ */ jsx40(
5239
+ return /* @__PURE__ */ jsx41(
5215
5240
  "button",
5216
5241
  {
5217
5242
  type,
@@ -5221,11 +5246,11 @@ function Button({
5221
5246
  style: baseStyle,
5222
5247
  onMouseEnter,
5223
5248
  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 }),
5249
+ children: loading ? /* @__PURE__ */ jsx41(Spinner, { size: s.iconSize - 2 }) : /* @__PURE__ */ jsxs27(Fragment11, { children: [
5250
+ Icon && iconPosition === "left" && !isIconOnly && /* @__PURE__ */ jsx41(Icon, { size: s.iconSize, strokeWidth: 1.5 }),
5251
+ Icon && isIconOnly && /* @__PURE__ */ jsx41(Icon, { size: s.iconSize + 2, strokeWidth: 1.5 }),
5227
5252
  !isIconOnly && labelText,
5228
- Icon && iconPosition === "right" && !isIconOnly && /* @__PURE__ */ jsx40(Icon, { size: s.iconSize, strokeWidth: 1.5 })
5253
+ Icon && iconPosition === "right" && !isIconOnly && /* @__PURE__ */ jsx41(Icon, { size: s.iconSize, strokeWidth: 1.5 })
5229
5254
  ] })
5230
5255
  }
5231
5256
  );
@@ -5233,7 +5258,7 @@ function Button({
5233
5258
 
5234
5259
  // src/shell/Skeleton.tsx
5235
5260
  import { motion as motion3 } from "framer-motion";
5236
- import { jsx as jsx41 } from "react/jsx-runtime";
5261
+ import { jsx as jsx42 } from "react/jsx-runtime";
5237
5262
  var BASE_STYLE = {
5238
5263
  display: "inline-block",
5239
5264
  backgroundColor: "var(--color-surface-alt, #f3f3f3)",
@@ -5257,13 +5282,13 @@ function Skeleton({
5257
5282
  style
5258
5283
  }) {
5259
5284
  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(
5285
+ return /* @__PURE__ */ jsx42(
5261
5286
  "span",
5262
5287
  {
5263
5288
  className,
5264
5289
  "aria-hidden": "true",
5265
5290
  style: { ...BASE_STYLE, ...variantStyle, ...style },
5266
- children: /* @__PURE__ */ jsx41(
5291
+ children: /* @__PURE__ */ jsx42(
5267
5292
  motion3.span,
5268
5293
  {
5269
5294
  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;
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.3",
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.3",
80
80
  "homepage": "https://docs.40rty.ai",
81
81
  "license": "UNLICENSED",
82
82
  "engines": {