@40rty/ams-sdk 0.5.13 → 0.5.15

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/index.js CHANGED
@@ -8327,13 +8327,16 @@ function useCanvasArrangement() {
8327
8327
  // src/canvas/canvas-lead.tsx
8328
8328
  import * as React30 from "react";
8329
8329
  import { jsx as jsx14 } from "react/jsx-runtime";
8330
- var NO_TYPES = [];
8330
+ var NO_LEAD = () => false;
8331
8331
  var CanvasLeadContext = React30.createContext(null);
8332
- function CanvasLeadProvider({ types, children }) {
8332
+ function CanvasLeadProvider(props) {
8333
8333
  const [target, setTarget] = React30.useState(null);
8334
8334
  const [leadId, setLeadId] = React30.useState(null);
8335
- const value = React30.useMemo(() => ({ types, target, setTarget, leadId, setLeadId }), [types, target, leadId]);
8336
- return /* @__PURE__ */ jsx14(CanvasLeadContext.Provider, { value, children });
8335
+ const listed = "types" in props ? props.types : props.except;
8336
+ const only = "types" in props;
8337
+ const canLead = React30.useCallback((type) => listed.includes(type) === only, [listed, only]);
8338
+ const value = React30.useMemo(() => ({ canLead, target, setTarget, leadId, setLeadId }), [canLead, target, leadId]);
8339
+ return /* @__PURE__ */ jsx14(CanvasLeadContext.Provider, { value, children: props.children });
8337
8340
  }
8338
8341
  function CanvasLeadSlot({ className }) {
8339
8342
  const lead = React30.useContext(CanvasLeadContext);
@@ -8352,8 +8355,8 @@ function useCanvasLeadTarget() {
8352
8355
  const report = React30.useCallback((id) => {
8353
8356
  if (setLeadId !== null) setLeadId(id);
8354
8357
  }, [setLeadId]);
8355
- if (lead === null) return { types: NO_TYPES, target: null, report };
8356
- return { types: lead.types, target: lead.target, report };
8358
+ if (lead === null) return { canLead: NO_LEAD, target: null, report };
8359
+ return { canLead: lead.canLead, target: lead.target, report };
8357
8360
  }
8358
8361
 
8359
8362
  // src/canvas/canvas-motion-style.tsx
@@ -12837,7 +12840,7 @@ function useContentActions() {
12837
12840
  import { useEffect as useEffect19, useState as useState19 } from "react";
12838
12841
 
12839
12842
  // package.json
12840
- var version = "0.5.13";
12843
+ var version = "0.5.15";
12841
12844
 
12842
12845
  // src/host/host-modules.ts
12843
12846
  import * as react from "react";
@@ -1,6 +1,23 @@
1
1
  import * as React from 'react';
2
- export declare function CanvasLeadProvider({ types, children }: {
2
+ /**
3
+ * The page's LEAD — one block a brand shows beside its own answer chrome
4
+ * instead of in the canvas flow (a verdict beside the headline that names it).
5
+ *
6
+ * A brand shell names which block types may lead — the ones it lists
7
+ * (`CanvasLeadProvider types`), or every type but the ones it lists
8
+ * (`CanvasLeadProvider except`) — and marks where the lead goes (`<CanvasLeadSlot />`). The engine renders the
9
+ * first top-level block of a lead type into that slot; with no slot mounted it
10
+ * stays in the flow, exactly as before. The agent places nothing — it composes
11
+ * the block; the brand decides where a block of that type sits. The shell reads
12
+ * `useCanvasLead().present` to lay itself out for a page with or without one.
13
+ */
14
+ /** Which block types may lead: only these, or every type but these. */
15
+ export type CanvasLeadRule = {
3
16
  types: readonly string[];
17
+ } | {
18
+ except: readonly string[];
19
+ };
20
+ export declare function CanvasLeadProvider(props: CanvasLeadRule & {
4
21
  children: React.ReactNode;
5
22
  }): React.ReactElement;
6
23
  /** Where the lead block renders. Mount it once, inside `CanvasLeadProvider`. */
@@ -17,7 +34,7 @@ export declare function useCanvasLead(): {
17
34
  * the flow.
18
35
  */
19
36
  export declare function useCanvasLeadTarget(): {
20
- types: readonly string[];
37
+ canLead: (type: string) => boolean;
21
38
  target: HTMLElement | null;
22
39
  report: (id: string | null) => void;
23
40
  };
@@ -7,7 +7,7 @@ export { GenerationStyleContext, GenerationStyleProvider, useGenerationStyle, }
7
7
  export { ShimmerSweep, type ShimmerSweepProps } from './ShimmerSweep';
8
8
  export { FadeTransition, TransitionProvider, useLayoutTransition, type LayoutTransitionItemProps, type LayoutTransitionGroupProps, type LayoutTransition, } from './TransitionContext';
9
9
  export { CanvasArrangementProvider, useCanvasArrangement, type CanvasArrangementValue } from './canvas-arrangement';
10
- export { CanvasLeadProvider, CanvasLeadSlot, useCanvasLead, useCanvasLeadTarget } from './canvas-lead';
10
+ export { CanvasLeadProvider, CanvasLeadSlot, useCanvasLead, useCanvasLeadTarget, type CanvasLeadRule } from './canvas-lead';
11
11
  export { CanvasMotionStyleProvider, useCanvasMotionStyle, type CanvasMotionStyle } from './canvas-motion-style';
12
12
  export { ElementIdContext, useElementId } from './ElementIdContext';
13
13
  export { buildEntranceProps, type EntranceMotionProps } from './generation-entrance';
package/package.json CHANGED
@@ -26,7 +26,7 @@
26
26
  "react": "^18.3.0 || ^19.0.0",
27
27
  "react-dom": "^18.3.0 || ^19.0.0"
28
28
  },
29
- "version": "0.5.13",
29
+ "version": "0.5.15",
30
30
  "homepage": "https://docs.40rty.ai",
31
31
  "license": "UNLICENSED",
32
32
  "engines": {