@agent-native/core 0.84.9 → 0.84.12

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 (80) hide show
  1. package/corpus/README.md +1 -1
  2. package/corpus/core/CHANGELOG.md +43 -0
  3. package/corpus/core/package.json +1 -1
  4. package/corpus/core/src/agent/run-store.ts +29 -6
  5. package/corpus/core/src/cli/skills.ts +6 -3
  6. package/corpus/core/src/client/agent-chat-adapter.ts +31 -11
  7. package/corpus/core/src/client/require-session.tsx +20 -1
  8. package/corpus/core/src/client/sharing/ShareButton.tsx +9 -3
  9. package/corpus/core/src/collab/storage.ts +40 -5
  10. package/corpus/core/src/server/auth.ts +6 -0
  11. package/corpus/templates/assets/.agents/skills/logo-composite/SKILL.md +7 -6
  12. package/corpus/templates/assets/AGENTS.md +15 -0
  13. package/corpus/templates/assets/actions/_helpers.ts +3 -1
  14. package/corpus/templates/assets/actions/create-generation-preset.ts +12 -1
  15. package/corpus/templates/assets/actions/generate-asset.ts +5 -1
  16. package/corpus/templates/assets/actions/generate-image-batch.ts +6 -1
  17. package/corpus/templates/assets/actions/generate-image.ts +18 -11
  18. package/corpus/templates/assets/actions/open-asset-picker.ts +4 -2
  19. package/corpus/templates/assets/actions/update-generation-preset.ts +16 -3
  20. package/corpus/templates/assets/app/i18n/zh-TW.ts +3 -0
  21. package/corpus/templates/assets/app/i18n-data.ts +30 -0
  22. package/corpus/templates/assets/app/routes/brand-kits.$id.tsx +42 -7
  23. package/corpus/templates/assets/app/routes/library.tsx +4 -2
  24. package/corpus/templates/assets/changelog/2026-07-01-generation-presets-can-now-composite-your-brand-s-canonical-.md +6 -0
  25. package/corpus/templates/assets/changelog/2026-07-01-tagging-a-preset-now-briefs-the-agent-on-that-preset-s-aesth.md +6 -0
  26. package/corpus/templates/assets/server/lib/preset-chat-context.ts +118 -0
  27. package/corpus/templates/assets/server/plugins/agent-chat.ts +5 -0
  28. package/corpus/templates/assets/shared/api.ts +1 -0
  29. package/corpus/templates/design/actions/export-html.ts +4 -2
  30. package/corpus/templates/design/actions/export-pdf.ts +3 -1
  31. package/corpus/templates/design/actions/export-svg.ts +4 -2
  32. package/corpus/templates/design/actions/export-zip.ts +10 -3
  33. package/corpus/templates/design/actions/get-design-snapshot.ts +41 -4
  34. package/corpus/templates/design/actions/present-design-variants.ts +21 -6
  35. package/corpus/templates/design/actions/update-file.ts +68 -17
  36. package/corpus/templates/design/app/components/design/DesignCanvas.tsx +3 -2
  37. package/corpus/templates/design/app/components/design/EditPanel.tsx +35 -3
  38. package/corpus/templates/design/app/components/design/MotionDock.tsx +46 -11
  39. package/corpus/templates/design/app/components/design/MultiScreenCanvas.tsx +80 -30
  40. package/corpus/templates/design/app/components/design/bridge/editor-chrome.bridge.ts +60 -10
  41. package/corpus/templates/design/app/components/design/canvas-primitive-style.ts +2 -0
  42. package/corpus/templates/design/app/components/design/inspector/InspectorAiActions.tsx +4 -0
  43. package/corpus/templates/design/app/hooks/use-question-flow.ts +2 -2
  44. package/corpus/templates/design/app/hooks/useAgentEditRequest.ts +2 -2
  45. package/corpus/templates/design/app/i18n-data.ts +1 -1
  46. package/corpus/templates/design/app/pages/DesignEditor.tsx +493 -109
  47. package/corpus/templates/design/app/pages/VisualEdit.tsx +4 -16
  48. package/corpus/templates/design/changelog/2026-07-01-improved-variant-pick-follow-ups-so-selected-directions-cont.md +6 -0
  49. package/corpus/templates/design/e2e/helpers.ts +2 -2
  50. package/dist/agent/run-store.d.ts.map +1 -1
  51. package/dist/agent/run-store.js +28 -6
  52. package/dist/agent/run-store.js.map +1 -1
  53. package/dist/cli/skills.d.ts.map +1 -1
  54. package/dist/cli/skills.js +6 -3
  55. package/dist/cli/skills.js.map +1 -1
  56. package/dist/client/agent-chat-adapter.d.ts.map +1 -1
  57. package/dist/client/agent-chat-adapter.js +26 -11
  58. package/dist/client/agent-chat-adapter.js.map +1 -1
  59. package/dist/client/require-session.d.ts +14 -0
  60. package/dist/client/require-session.d.ts.map +1 -1
  61. package/dist/client/require-session.js +19 -1
  62. package/dist/client/require-session.js.map +1 -1
  63. package/dist/client/sharing/ShareButton.d.ts +4 -2
  64. package/dist/client/sharing/ShareButton.d.ts.map +1 -1
  65. package/dist/client/sharing/ShareButton.js +3 -1
  66. package/dist/client/sharing/ShareButton.js.map +1 -1
  67. package/dist/collab/routes.d.ts +1 -1
  68. package/dist/collab/storage.d.ts.map +1 -1
  69. package/dist/collab/storage.js +31 -5
  70. package/dist/collab/storage.js.map +1 -1
  71. package/dist/file-upload/actions/upload-image.d.ts +2 -2
  72. package/dist/notifications/routes.d.ts +2 -2
  73. package/dist/observability/routes.d.ts +6 -6
  74. package/dist/resources/handlers.d.ts +2 -2
  75. package/dist/server/agent-engine-api-key-route.d.ts +1 -1
  76. package/dist/server/auth.d.ts.map +1 -1
  77. package/dist/server/auth.js +7 -0
  78. package/dist/server/auth.js.map +1 -1
  79. package/dist/server/transcribe-voice.d.ts +1 -1
  80. package/package.json +1 -1
@@ -57,5 +57,19 @@ export interface RequireSessionProps {
57
57
  }
58
58
  /** Build the framework sign-in URL that returns to the current location. */
59
59
  export declare function buildSignInReturnHref(): string;
60
+ /**
61
+ * True when the browser is already sitting on the framework sign-in entry
62
+ * point. Redirecting to sign-in from here would append the current sign-in
63
+ * URL as a fresh `?return=`, re-encode it, and navigate again — an infinite
64
+ * loop of ever-growing `…sign-in?return=%252F…sign-in%253Freturn%253D…` URLs.
65
+ *
66
+ * This happens when the authenticated app shell (wrapped in `RequireSession`)
67
+ * is served at the sign-in path instead of the framework login HTML — e.g.
68
+ * under a base-path deploy where the SPA shell answers `/<app>/_agent-native/
69
+ * sign-in`. The sign-in page is the framework's job, not the gate's: never
70
+ * redirect to ourselves. Compared against `agentNativePath(...)` so it matches
71
+ * whether or not the app is mounted under a base path.
72
+ */
73
+ export declare function isOnSignInPage(): boolean;
60
74
  export declare function RequireSession({ children, fallback, redirect, signedOut, bypass, }: RequireSessionProps): React.JSX.Element;
61
75
  //# sourceMappingURL=require-session.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"require-session.d.ts","sourceRoot":"","sources":["../../src/client/require-session.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,OAAO,KAA4B,MAAM,OAAO,CAAC;AAMjD,MAAM,WAAW,mBAAmB;IAClC,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B;;;OAGG;IACH,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B;;;;;;OAMG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;OAGG;IACH,SAAS,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC5B;;;;OAIG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAED,4EAA4E;AAC5E,wBAAgB,qBAAqB,IAAI,MAAM,CAM9C;AAED,wBAAgB,cAAc,CAAC,EAC7B,QAAQ,EACR,QAAQ,EACR,QAAe,EACf,SAAS,EACT,MAAc,GACf,EAAE,mBAAmB,qBA4BrB"}
1
+ {"version":3,"file":"require-session.d.ts","sourceRoot":"","sources":["../../src/client/require-session.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,OAAO,KAA4B,MAAM,OAAO,CAAC;AAMjD,MAAM,WAAW,mBAAmB;IAClC,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B;;;OAGG;IACH,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B;;;;;;OAMG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;OAGG;IACH,SAAS,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC5B;;;;OAIG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAED,4EAA4E;AAC5E,wBAAgB,qBAAqB,IAAI,MAAM,CAM9C;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,cAAc,IAAI,OAAO,CAGxC;AAED,wBAAgB,cAAc,CAAC,EAC7B,QAAQ,EACR,QAAQ,EACR,QAAe,EACf,SAAS,EACT,MAAc,GACf,EAAE,mBAAmB,qBA6BrB"}
@@ -40,13 +40,31 @@ export function buildSignInReturnHref() {
40
40
  const ret = window.location.pathname + window.location.search + window.location.hash;
41
41
  return `${base}?return=${encodeURIComponent(ret)}`;
42
42
  }
43
+ /**
44
+ * True when the browser is already sitting on the framework sign-in entry
45
+ * point. Redirecting to sign-in from here would append the current sign-in
46
+ * URL as a fresh `?return=`, re-encode it, and navigate again — an infinite
47
+ * loop of ever-growing `…sign-in?return=%252F…sign-in%253Freturn%253D…` URLs.
48
+ *
49
+ * This happens when the authenticated app shell (wrapped in `RequireSession`)
50
+ * is served at the sign-in path instead of the framework login HTML — e.g.
51
+ * under a base-path deploy where the SPA shell answers `/<app>/_agent-native/
52
+ * sign-in`. The sign-in page is the framework's job, not the gate's: never
53
+ * redirect to ourselves. Compared against `agentNativePath(...)` so it matches
54
+ * whether or not the app is mounted under a base path.
55
+ */
56
+ export function isOnSignInPage() {
57
+ if (typeof window === "undefined")
58
+ return false;
59
+ return window.location.pathname === agentNativePath("/_agent-native/sign-in");
60
+ }
43
61
  export function RequireSession({ children, fallback, redirect = true, signedOut, bypass = false, }) {
44
62
  const { session, isLoading } = useSession();
45
63
  // Guard against firing the redirect more than once (effect re-runs, React
46
64
  // StrictMode double-invoke) — a second navigation while the first is in
47
65
  // flight is harmless but noisy.
48
66
  const redirectedRef = useRef(false);
49
- const mustRedirect = !bypass && !isLoading && !session && redirect;
67
+ const mustRedirect = !bypass && !isLoading && !session && redirect && !isOnSignInPage();
50
68
  useEffect(() => {
51
69
  if (!mustRedirect)
52
70
  return;
@@ -1 +1 @@
1
- {"version":3,"file":"require-session.js","sourceRoot":"","sources":["../../src/client/require-session.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,OAAc,EAAE,SAAS,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CAAC,CAAC;IACnD,CAAC,EAAE,CAAC,YAAY,CAAC,CAAC,CAAC;IAEnB,IAAI,MAAM;QAAE,OAAO,4BAAG,QAAQ,GAAI,CAAC;IACnC,4EAA4E;IAC5E,yDAAyD;IACzD,IAAI,SAAS;QAAE,OAAO,4BAAG,QAAQ,IAAI,KAAC,cAAc,KAAG,GAAI,CAAC;IAC5D,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,IAAI,QAAQ;YAAE,OAAO,4BAAG,QAAQ,IAAI,KAAC,cAAc,KAAG,GAAI,CAAC;QAC3D,OAAO,4BAAG,SAAS,IAAI,IAAI,GAAI,CAAC;IAClC,CAAC;IACD,OAAO,4BAAG,QAAQ,GAAI,CAAC;AACzB,CAAC","sourcesContent":["/**\n * Client-side session gate for an authenticated app shell.\n *\n * Wrap a template's private app shell with <RequireSession> so a logged-out\n * visitor is sent to the framework sign-in page instead of being left staring\n * at an infinite loading spinner.\n *\n * Why this exists in addition to the server-side auth guard (`runAuthGuard`,\n * which serves the onboarding/sign-in HTML for unauthenticated requests):\n * the server guard only protects requests that actually reach the Nitro\n * function. A statically-served / CDN-cached SPA shell, or a client-side\n * (React Router) navigation made after the session expired, never re-hits the\n * guard — so the app boots with no session, every data query 401s, and the UI\n * sticks on its loading state forever. This component closes that gap by\n * resolving the session on the client and redirecting when there is none.\n *\n * Place it INSIDE your providers (so the fallback is themed) but AROUND the\n * routed app layout:\n *\n * <AppProviders ...>\n * <RequireSession>\n * <AppLayout><Outlet /></AppLayout>\n * </RequireSession>\n * </AppProviders>\n *\n * Templates with public/anonymous routes (share pages, embeds) must NOT wrap\n * their whole app — gate only the private subtree, or pass `bypass` for the\n * surfaces that authenticate by another mechanism.\n */\nimport React, { useEffect, useRef } from \"react\";\n\nimport { agentNativePath } from \"./api-path.js\";\nimport { DefaultSpinner } from \"./DefaultSpinner.js\";\nimport { useSession } from \"./use-session.js\";\n\nexport interface RequireSessionProps {\n children: React.ReactNode;\n /**\n * Rendered while the session is being resolved and while a redirect is in\n * flight. Defaults to the framework `<DefaultSpinner />`.\n */\n fallback?: React.ReactNode;\n /**\n * When true (default), unauthenticated visitors are redirected to the\n * framework sign-in entry point (`/_agent-native/sign-in`) with a `return`\n * query pointing back at the current URL — so they land back here once\n * signed in. When false, `signedOut` is rendered instead and no navigation\n * happens.\n */\n redirect?: boolean;\n /**\n * Rendered for unauthenticated visitors when `redirect` is false. Ignored\n * when `redirect` is true.\n */\n signedOut?: React.ReactNode;\n /**\n * Skip the gate entirely and always render children. Use for surfaces that\n * authenticate by another mechanism (e.g. an embed/popout iframe carrying\n * its own token) so they are never bounced to the sign-in page.\n */\n bypass?: boolean;\n}\n\n/** Build the framework sign-in URL that returns to the current location. */\nexport function buildSignInReturnHref(): string {\n const base = agentNativePath(\"/_agent-native/sign-in\");\n if (typeof window === \"undefined\") return base;\n const ret =\n window.location.pathname + window.location.search + window.location.hash;\n return `${base}?return=${encodeURIComponent(ret)}`;\n}\n\nexport function RequireSession({\n children,\n fallback,\n redirect = true,\n signedOut,\n bypass = false,\n}: RequireSessionProps) {\n const { session, isLoading } = useSession();\n // Guard against firing the redirect more than once (effect re-runs, React\n // StrictMode double-invoke) — a second navigation while the first is in\n // flight is harmless but noisy.\n const redirectedRef = useRef(false);\n\n const mustRedirect = !bypass && !isLoading && !session && redirect;\n\n useEffect(() => {\n if (!mustRedirect) return;\n if (redirectedRef.current) return;\n if (typeof window === \"undefined\") return;\n redirectedRef.current = true;\n // `replace` (not `assign`) so the dead authenticated URL doesn't land in\n // history — pressing Back after signing in shouldn't bounce here again.\n window.location.replace(buildSignInReturnHref());\n }, [mustRedirect]);\n\n if (bypass) return <>{children}</>;\n // Still resolving, or redirect already in flight: show the loading fallback\n // rather than flashing app chrome the visitor can't use.\n if (isLoading) return <>{fallback ?? <DefaultSpinner />}</>;\n if (!session) {\n if (redirect) return <>{fallback ?? <DefaultSpinner />}</>;\n return <>{signedOut ?? null}</>;\n }\n return <>{children}</>;\n}\n"]}
1
+ {"version":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,SAAS,IAAI,CAAC,OAAO,IAAI,QAAQ,IAAI,CAAC,cAAc,EAAE,CAAC;IAErE,SAAS,CAAC,GAAG,EAAE;QACb,IAAI,CAAC,YAAY;YAAE,OAAO;QAC1B,IAAI,aAAa,CAAC,OAAO;YAAE,OAAO;QAClC,IAAI,OAAO,MAAM,KAAK,WAAW;YAAE,OAAO;QAC1C,aAAa,CAAC,OAAO,GAAG,IAAI,CAAC;QAC7B,yEAAyE;QACzE,wEAAwE;QACxE,MAAM,CAAC,QAAQ,CAAC,OAAO,CAAC,qBAAqB,EAAE,CAAC,CAAC;IACnD,CAAC,EAAE,CAAC,YAAY,CAAC,CAAC,CAAC;IAEnB,IAAI,MAAM;QAAE,OAAO,4BAAG,QAAQ,GAAI,CAAC;IACnC,4EAA4E;IAC5E,yDAAyD;IACzD,IAAI,SAAS;QAAE,OAAO,4BAAG,QAAQ,IAAI,KAAC,cAAc,KAAG,GAAI,CAAC;IAC5D,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,IAAI,QAAQ;YAAE,OAAO,4BAAG,QAAQ,IAAI,KAAC,cAAc,KAAG,GAAI,CAAC;QAC3D,OAAO,4BAAG,SAAS,IAAI,IAAI,GAAI,CAAC;IAClC,CAAC;IACD,OAAO,4BAAG,QAAQ,GAAI,CAAC;AACzB,CAAC","sourcesContent":["/**\n * Client-side session gate for an authenticated app shell.\n *\n * Wrap a template's private app shell with <RequireSession> so a logged-out\n * visitor is sent to the framework sign-in page instead of being left staring\n * at an infinite loading spinner.\n *\n * Why this exists in addition to the server-side auth guard (`runAuthGuard`,\n * which serves the onboarding/sign-in HTML for unauthenticated requests):\n * the server guard only protects requests that actually reach the Nitro\n * function. A statically-served / CDN-cached SPA shell, or a client-side\n * (React Router) navigation made after the session expired, never re-hits the\n * guard — so the app boots with no session, every data query 401s, and the UI\n * sticks on its loading state forever. This component closes that gap by\n * resolving the session on the client and redirecting when there is none.\n *\n * Place it INSIDE your providers (so the fallback is themed) but AROUND the\n * routed app layout:\n *\n * <AppProviders ...>\n * <RequireSession>\n * <AppLayout><Outlet /></AppLayout>\n * </RequireSession>\n * </AppProviders>\n *\n * Templates with public/anonymous routes (share pages, embeds) must NOT wrap\n * their whole app — gate only the private subtree, or pass `bypass` for the\n * surfaces that authenticate by another mechanism.\n */\nimport React, { useEffect, useRef } from \"react\";\n\nimport { agentNativePath } from \"./api-path.js\";\nimport { DefaultSpinner } from \"./DefaultSpinner.js\";\nimport { useSession } from \"./use-session.js\";\n\nexport interface RequireSessionProps {\n children: React.ReactNode;\n /**\n * Rendered while the session is being resolved and while a redirect is in\n * flight. Defaults to the framework `<DefaultSpinner />`.\n */\n fallback?: React.ReactNode;\n /**\n * When true (default), unauthenticated visitors are redirected to the\n * framework sign-in entry point (`/_agent-native/sign-in`) with a `return`\n * query pointing back at the current URL — so they land back here once\n * signed in. When false, `signedOut` is rendered instead and no navigation\n * happens.\n */\n redirect?: boolean;\n /**\n * Rendered for unauthenticated visitors when `redirect` is false. Ignored\n * when `redirect` is true.\n */\n signedOut?: React.ReactNode;\n /**\n * Skip the gate entirely and always render children. Use for surfaces that\n * authenticate by another mechanism (e.g. an embed/popout iframe carrying\n * its own token) so they are never bounced to the sign-in page.\n */\n bypass?: boolean;\n}\n\n/** Build the framework sign-in URL that returns to the current location. */\nexport function buildSignInReturnHref(): string {\n const base = agentNativePath(\"/_agent-native/sign-in\");\n if (typeof window === \"undefined\") return base;\n const ret =\n window.location.pathname + window.location.search + window.location.hash;\n return `${base}?return=${encodeURIComponent(ret)}`;\n}\n\n/**\n * True when the browser is already sitting on the framework sign-in entry\n * point. Redirecting to sign-in from here would append the current sign-in\n * URL as a fresh `?return=`, re-encode it, and navigate again — an infinite\n * loop of ever-growing `…sign-in?return=%252F…sign-in%253Freturn%253D…` URLs.\n *\n * This happens when the authenticated app shell (wrapped in `RequireSession`)\n * is served at the sign-in path instead of the framework login HTML — e.g.\n * under a base-path deploy where the SPA shell answers `/<app>/_agent-native/\n * sign-in`. The sign-in page is the framework's job, not the gate's: never\n * redirect to ourselves. Compared against `agentNativePath(...)` so it matches\n * whether or not the app is mounted under a base path.\n */\nexport function isOnSignInPage(): boolean {\n if (typeof window === \"undefined\") return false;\n return window.location.pathname === agentNativePath(\"/_agent-native/sign-in\");\n}\n\nexport function RequireSession({\n children,\n fallback,\n redirect = true,\n signedOut,\n bypass = false,\n}: RequireSessionProps) {\n const { session, isLoading } = useSession();\n // Guard against firing the redirect more than once (effect re-runs, React\n // StrictMode double-invoke) — a second navigation while the first is in\n // flight is harmless but noisy.\n const redirectedRef = useRef(false);\n\n const mustRedirect =\n !bypass && !isLoading && !session && redirect && !isOnSignInPage();\n\n useEffect(() => {\n if (!mustRedirect) return;\n if (redirectedRef.current) return;\n if (typeof window === \"undefined\") return;\n redirectedRef.current = true;\n // `replace` (not `assign`) so the dead authenticated URL doesn't land in\n // history — pressing Back after signing in shouldn't bounce here again.\n window.location.replace(buildSignInReturnHref());\n }, [mustRedirect]);\n\n if (bypass) return <>{children}</>;\n // Still resolving, or redirect already in flight: show the loading fallback\n // rather than flashing app chrome the visitor can't use.\n if (isLoading) return <>{fallback ?? <DefaultSpinner />}</>;\n if (!session) {\n if (redirect) return <>{fallback ?? <DefaultSpinner />}</>;\n return <>{signedOut ?? null}</>;\n }\n return <>{children}</>;\n}\n"]}
@@ -6,8 +6,10 @@ export interface ShareButtonProps {
6
6
  /** @deprecated No longer affects rendering — trigger always says
7
7
  * "Share". Kept for callsite compatibility. */
8
8
  variant?: "compact" | "label";
9
- /** Optional trigger style. Defaults to the Google-Docs-style "Share" label. */
10
- trigger?: "label" | "icon";
9
+ /** Optional trigger style. Defaults to the Google-Docs-style "Share" label.
10
+ * Use "label-icon" to render a leading share glyph alongside the label so
11
+ * the trigger matches adjacent icon+label buttons; "icon" is icon-only. */
12
+ trigger?: "label" | "icon" | "label-icon";
11
13
  /** @deprecated Label triggers no longer render a visibility/share glyph. */
12
14
  hideTriggerIcon?: boolean;
13
15
  /** Optional className applied to the trigger button. */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AAG,SAAS,GAAG,KAAK,GAAG,QAAQ,CAAC;AAsH/C;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,gBAAgB,+BAgJlD"}
@@ -149,8 +149,10 @@ export function ShareButton(props) {
149
149
  });
150
150
  };
151
151
  // The default trigger stays text-only; the icon trigger keeps the share glyph.
152
+ // "label-icon" renders the glyph alongside the label for icon+label parity.
152
153
  const iconOnly = props.trigger === "icon";
153
- return (_jsxs(Popover, { open: open, onOpenChange: handleOpenChange, children: [_jsx(PopoverTrigger, { asChild: true, children: _jsxs("button", { type: "button", className: cn(iconOnly ? BUTTON_GHOST_ICON : BUTTON_OUTLINE_SM, props.triggerClassName), "aria-label": iconOnly ? "Share" : undefined, children: [iconOnly ? _jsx(IconShare3, { size: 16, strokeWidth: 1.75 }) : null, !iconOnly && _jsx("span", { children: "Share" })] }) }), _jsx(PopoverContent, { align: "end", sideOffset: 6, "data-agent-native-share-overlay": "", className: cn("z-[2000] w-[min(460px,92vw)] rounded-lg p-4 shadow-lg", SHARE_POPOVER_SURFACE, props.popoverClassName), onOpenAutoFocus: (e) => e.preventDefault(), onInteractOutside: handleSharePopoverInteractOutside, children: _jsx(SharePanel, { ...props, sharesQuery: sharesQuery, visibilityOverride: pendingVisibility, onVisibilityChange: handleVisibilityChange, onClose: () => handleOpenChange(false), activeTab: activeShareTab, onTabChange: handleShareTabChange }) })] }));
154
+ const showLabelIcon = props.trigger === "label-icon";
155
+ return (_jsxs(Popover, { open: open, onOpenChange: handleOpenChange, children: [_jsx(PopoverTrigger, { asChild: true, children: _jsxs("button", { type: "button", className: cn(iconOnly ? BUTTON_GHOST_ICON : BUTTON_OUTLINE_SM, props.triggerClassName), "aria-label": iconOnly ? "Share" : undefined, children: [iconOnly || showLabelIcon ? (_jsx(IconShare3, { size: 16, strokeWidth: 1.75 })) : null, !iconOnly && _jsx("span", { children: "Share" })] }) }), _jsx(PopoverContent, { align: "end", sideOffset: 6, "data-agent-native-share-overlay": "", className: cn("z-[2000] w-[min(460px,92vw)] rounded-lg p-4 shadow-lg", SHARE_POPOVER_SURFACE, props.popoverClassName), onOpenAutoFocus: (e) => e.preventDefault(), onInteractOutside: handleSharePopoverInteractOutside, children: _jsx(SharePanel, { ...props, sharesQuery: sharesQuery, visibilityOverride: pendingVisibility, onVisibilityChange: handleVisibilityChange, onClose: () => handleOpenChange(false), activeTab: activeShareTab, onTabChange: handleShareTabChange }) })] }));
154
156
  }
155
157
  function useOrgMemberSearch(query, enabled) {
156
158
  const search = query.trim();