@vantageos/mosaic-blocks 0.5.30-alpha → 0.5.32-alpha

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.cjs CHANGED
@@ -48,7 +48,7 @@ function _interopNamespace(e) {
48
48
  var React30__namespace = /*#__PURE__*/_interopNamespace(React30);
49
49
 
50
50
  // src/version.ts
51
- var version = "0.5.30-alpha";
51
+ var version = "0.5.32-alpha";
52
52
  function Placeholder({ label = "mosaic-blocks placeholder" }) {
53
53
  return /* @__PURE__ */ jsxRuntime.jsx("div", { "data-mosaic-block": "placeholder", children: label });
54
54
  }
@@ -2569,10 +2569,14 @@ function MosaicDeviceProvider({ children }) {
2569
2569
  return /* @__PURE__ */ jsxRuntime.jsx(DeviceContext.Provider, { value, children });
2570
2570
  }
2571
2571
  MosaicDeviceProvider.displayName = "MosaicDeviceProvider";
2572
+ var DEVICE_PROVIDER_ERRORS = {
2573
+ // allow-hardcoded-word: developer-facing invariant error, never rendered to an end user
2574
+ missingProvider: "useDevice must be used within a MosaicDeviceProvider"
2575
+ };
2572
2576
  function useDevice() {
2573
2577
  const ctx = React30__namespace.useContext(DeviceContext);
2574
2578
  if (!ctx) {
2575
- throw new Error("useDevice must be used within a MosaicDeviceProvider");
2579
+ throw new Error(DEVICE_PROVIDER_ERRORS.missingProvider);
2576
2580
  }
2577
2581
  return ctx;
2578
2582
  }
@@ -2870,7 +2874,7 @@ function MosaicAdaptiveNavigation({
2870
2874
  {
2871
2875
  className: cn40(
2872
2876
  "flex h-8 w-8 shrink-0 items-center justify-center rounded-full text-xs font-bold",
2873
- item.isComplete ? "bg-green-500 text-white" : "bg-muted text-muted-foreground"
2877
+ item.isComplete ? "bg-success-500 text-white" : "bg-muted text-muted-foreground"
2874
2878
  ),
2875
2879
  "aria-hidden": "true",
2876
2880
  children: item.isComplete ? /* @__PURE__ */ jsxRuntime.jsx(CheckIcon2, {}) : idx + 1
@@ -2930,7 +2934,7 @@ function MosaicAdaptiveNavigation({
2930
2934
  {
2931
2935
  className: cn40(
2932
2936
  "flex h-6 w-6 shrink-0 items-center justify-center rounded-full text-xs font-bold",
2933
- item.isComplete ? "bg-green-500 text-white" : isActive ? "bg-primary-foreground/20 text-primary-foreground" : "bg-background text-muted-foreground"
2937
+ item.isComplete ? "bg-success-500 text-white" : isActive ? "bg-primary-foreground/20 text-primary-foreground" : "bg-background text-muted-foreground"
2934
2938
  ),
2935
2939
  "aria-hidden": "true",
2936
2940
  children: item.isComplete ? /* @__PURE__ */ jsxRuntime.jsx(CheckIcon2, {}) : idx + 1
@@ -3103,6 +3107,9 @@ function MosaicAppSidebar({
3103
3107
  recentItems = [],
3104
3108
  logoSlot,
3105
3109
  footerStatus,
3110
+ chevronPosition = "top",
3111
+ bottomNavItems = [],
3112
+ bottomNavAriaLabel,
3106
3113
  sidebarAriaLabel,
3107
3114
  mainNavAriaLabel,
3108
3115
  quickActionsHeading,
@@ -3118,6 +3125,7 @@ function MosaicAppSidebar({
3118
3125
  injectStyles2();
3119
3126
  }, []);
3120
3127
  const sidebarWidth = isMobile ? "100%" : isCollapsed ? "64px" : "280px";
3128
+ const footerStatusIconClass = "text-success-500";
3121
3129
  const toggleSubmenu = (id) => {
3122
3130
  setExpandedItems((prev) => {
3123
3131
  const next = new Set(prev);
@@ -3132,6 +3140,21 @@ function MosaicAppSidebar({
3132
3140
  const handleNavClick = (href) => {
3133
3141
  onNavigate?.(href);
3134
3142
  };
3143
+ const collapseToggleButton = !isMobile && /* @__PURE__ */ jsxRuntime.jsx(
3144
+ "button",
3145
+ {
3146
+ type: "button",
3147
+ onClick: onToggleCollapse,
3148
+ "aria-label": isCollapsed ? expandSidebarAriaLabel : collapseSidebarAriaLabel,
3149
+ className: cn41(
3150
+ "flex h-9 w-9 items-center justify-center rounded-lg transition-colors",
3151
+ "hover:bg-sidebar-accent text-sidebar-foreground",
3152
+ "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
3153
+ isCollapsed && "mx-auto"
3154
+ ),
3155
+ children: isCollapsed ? /* @__PURE__ */ jsxRuntime.jsx(ChevronRightIcon, {}) : /* @__PURE__ */ jsxRuntime.jsx(ChevronLeftIcon, {})
3156
+ }
3157
+ );
3135
3158
  return /* @__PURE__ */ jsxRuntime.jsxs(
3136
3159
  "div",
3137
3160
  {
@@ -3151,21 +3174,7 @@ function MosaicAppSidebar({
3151
3174
  children: [
3152
3175
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: "shrink-0 border-b border-sidebar-border p-4", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between", children: [
3153
3176
  !isCollapsed && logoSlot && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "mosaic-sidebar-label-in flex items-center gap-2 min-w-0", children: logoSlot }),
3154
- !isMobile && /* @__PURE__ */ jsxRuntime.jsx(
3155
- "button",
3156
- {
3157
- type: "button",
3158
- onClick: onToggleCollapse,
3159
- "aria-label": isCollapsed ? expandSidebarAriaLabel : collapseSidebarAriaLabel,
3160
- className: cn41(
3161
- "flex h-9 w-9 items-center justify-center rounded-lg transition-colors",
3162
- "hover:bg-sidebar-accent text-sidebar-foreground",
3163
- "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
3164
- isCollapsed && "mx-auto"
3165
- ),
3166
- children: isCollapsed ? /* @__PURE__ */ jsxRuntime.jsx(ChevronRightIcon, {}) : /* @__PURE__ */ jsxRuntime.jsx(ChevronLeftIcon, {})
3167
- }
3168
- )
3177
+ chevronPosition === "top" && collapseToggleButton
3169
3178
  ] }) }),
3170
3179
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex-1 overflow-y-auto p-2", style: { scrollbarWidth: "thin" }, children: [
3171
3180
  navItems.length > 0 && /* @__PURE__ */ jsxRuntime.jsx("nav", { "aria-label": mainNavAriaLabel, children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "space-y-0.5", children: navItems.map((item) => {
@@ -3272,13 +3281,60 @@ function MosaicAppSidebar({
3272
3281
  ] })
3273
3282
  ] }),
3274
3283
  footerStatus && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "shrink-0 border-t border-sidebar-border p-4", children: !isCollapsed ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-3 rounded-lg bg-sidebar-accent/30 p-3", children: [
3275
- footerStatus.icon && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-green-500", children: footerStatus.icon }),
3284
+ footerStatus.icon && /* @__PURE__ */ jsxRuntime.jsx("span", { className: footerStatusIconClass, children: footerStatus.icon }),
3276
3285
  !footerStatus.icon && /* @__PURE__ */ jsxRuntime.jsx(TrendingUpIcon, {}),
3277
3286
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "min-w-0 flex-1", children: [
3278
3287
  /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm font-medium text-sidebar-foreground", children: footerStatus.label }),
3279
3288
  footerStatus.sublabel && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs text-sidebar-foreground/60", children: footerStatus.sublabel })
3280
3289
  ] })
3281
- ] }) : /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex justify-center", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex h-8 w-8 items-center justify-center rounded-lg bg-sidebar-accent/30 text-green-500", children: footerStatus.icon ?? /* @__PURE__ */ jsxRuntime.jsx(TrendingUpIcon, {}) }) }) })
3290
+ ] }) : /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex justify-center", children: /* @__PURE__ */ jsxRuntime.jsx(
3291
+ "div",
3292
+ {
3293
+ className: `flex h-8 w-8 items-center justify-center rounded-lg bg-sidebar-accent/30 ${footerStatusIconClass}`,
3294
+ children: footerStatus.icon ?? /* @__PURE__ */ jsxRuntime.jsx(TrendingUpIcon, {})
3295
+ }
3296
+ ) }) }),
3297
+ bottomNavItems.length > 0 && /* @__PURE__ */ jsxRuntime.jsx(
3298
+ "div",
3299
+ {
3300
+ "data-slot": "app-sidebar-bottom-nav",
3301
+ className: cn41("shrink-0 border-t border-sidebar-border p-2", isCollapsed && "px-2"),
3302
+ children: /* @__PURE__ */ jsxRuntime.jsx("nav", { "aria-label": bottomNavAriaLabel, children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "space-y-0.5", children: bottomNavItems.map((item) => {
3303
+ const isActive = activePath === item.href;
3304
+ return /* @__PURE__ */ jsxRuntime.jsx(
3305
+ "button",
3306
+ {
3307
+ type: "button",
3308
+ onClick: () => handleNavClick(item.href),
3309
+ "aria-current": isActive ? "page" : void 0,
3310
+ className: cn41(
3311
+ "group flex w-full min-h-[44px] items-center rounded-lg p-3 transition-colors",
3312
+ "hover:bg-sidebar-accent",
3313
+ "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
3314
+ isActive && "bg-sidebar-accent",
3315
+ isCollapsed ? "justify-center" : "justify-start gap-3"
3316
+ ),
3317
+ children: isCollapsed ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-sidebar-foreground", title: item.label, children: item.icon ?? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-xs font-bold", children: item.label.charAt(0) }) }) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
3318
+ item.icon && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-sidebar-foreground", children: item.icon }),
3319
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "mosaic-sidebar-label-in text-sm font-medium text-sidebar-foreground", children: item.label })
3320
+ ] })
3321
+ },
3322
+ item.id
3323
+ );
3324
+ }) }) })
3325
+ }
3326
+ ),
3327
+ chevronPosition === "bottom" && collapseToggleButton && /* @__PURE__ */ jsxRuntime.jsx(
3328
+ "div",
3329
+ {
3330
+ "data-slot": "app-sidebar-toggle-zone",
3331
+ className: cn41(
3332
+ "shrink-0 border-t border-sidebar-border p-2 flex",
3333
+ isCollapsed ? "justify-center" : "justify-end"
3334
+ ),
3335
+ children: collapseToggleButton
3336
+ }
3337
+ )
3282
3338
  ]
3283
3339
  }
3284
3340
  );
@@ -3596,7 +3652,10 @@ function injectStyles5() {
3596
3652
  document.head.appendChild(s);
3597
3653
  }
3598
3654
  var STATUS_CLASSES = {
3599
- active: "bg-green-500/10 text-green-600 border border-green-500/20 dark:text-green-400",
3655
+ // success-700 already carries a dark-mode-adjusted value in the token set
3656
+ // (@vantageos/mosaic-tokens [data-theme="dark"] block), so no dark: prefix
3657
+ // is needed here — it replaces the old dark:text-green-400 override.
3658
+ active: "bg-success-500/10 text-success-700 border border-success-500/20",
3600
3659
  completed: "bg-blue-500/10 text-blue-600 border border-blue-500/20 dark:text-blue-400",
3601
3660
  archived: "bg-gray-500/10 text-gray-600 border border-gray-500/20 dark:text-gray-400"
3602
3661
  };
@@ -3821,7 +3880,16 @@ function SaveIcon() {
3821
3880
  }
3822
3881
  );
3823
3882
  }
3824
- function ModuleSlot({ label, sublabel, module, onSelect, onRemove }) {
3883
+ function ModuleSlot({
3884
+ label,
3885
+ sublabel,
3886
+ module,
3887
+ onSelect,
3888
+ onRemove,
3889
+ editAriaLabel,
3890
+ removeAriaLabel,
3891
+ selectAriaLabel
3892
+ }) {
3825
3893
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-xl border border-border bg-card", children: [
3826
3894
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "border-b border-border px-4 pt-4 pb-3", children: [
3827
3895
  /* @__PURE__ */ jsxRuntime.jsx("h3", { className: "text-sm font-semibold text-foreground", children: label }),
@@ -3840,7 +3908,7 @@ function ModuleSlot({ label, sublabel, module, onSelect, onRemove }) {
3840
3908
  {
3841
3909
  type: "button",
3842
3910
  onClick: onSelect,
3843
- "aria-label": `Edit ${label}`,
3911
+ "aria-label": editAriaLabel,
3844
3912
  className: "flex h-7 w-7 items-center justify-center rounded-md text-muted-foreground hover:bg-muted hover:text-foreground transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
3845
3913
  children: /* @__PURE__ */ jsxRuntime.jsxs(
3846
3914
  "svg",
@@ -3867,7 +3935,7 @@ function ModuleSlot({ label, sublabel, module, onSelect, onRemove }) {
3867
3935
  {
3868
3936
  type: "button",
3869
3937
  onClick: onRemove,
3870
- "aria-label": `Remove ${label}`,
3938
+ "aria-label": removeAriaLabel,
3871
3939
  className: "flex h-7 w-7 items-center justify-center rounded-md text-destructive hover:bg-destructive/10 transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
3872
3940
  children: /* @__PURE__ */ jsxRuntime.jsxs(
3873
3941
  "svg",
@@ -3895,12 +3963,11 @@ function ModuleSlot({ label, sublabel, module, onSelect, onRemove }) {
3895
3963
  {
3896
3964
  type: "button",
3897
3965
  onClick: onSelect,
3898
- "aria-label": `Select ${label}`,
3966
+ "aria-label": selectAriaLabel,
3899
3967
  className: "flex w-full min-h-[72px] items-center justify-center gap-2 rounded-lg border border-dashed border-border text-sm text-muted-foreground transition-colors hover:border-primary hover:text-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
3900
3968
  children: [
3901
3969
  /* @__PURE__ */ jsxRuntime.jsx(PlusIcon, {}),
3902
- "Select ",
3903
- label
3970
+ selectAriaLabel
3904
3971
  ]
3905
3972
  }
3906
3973
  ) })
@@ -3937,10 +4004,24 @@ function MosaicAgentComposerDesktop({
3937
4004
  previewConfigLabel,
3938
4005
  customInstructionsPreviewLabel,
3939
4006
  selectAllModulesLabel,
3940
- unnamedAgentLabel
4007
+ unnamedAgentLabel,
4008
+ roleSublabel,
4009
+ personaSublabel,
4010
+ frameworkSublabel,
4011
+ editModuleAriaLabel,
4012
+ removeModuleAriaLabel,
4013
+ selectModuleAriaLabel,
4014
+ changeModuleLabel,
4015
+ previewRequires = ["role", "persona", "framework", "model"]
3941
4016
  }) {
3942
4017
  const L = labels;
3943
- const allModulesSelected = !!selectedRole && !!selectedPersona && !!selectedFramework && !!selectedModel;
4018
+ const moduleBySlot = {
4019
+ role: selectedRole,
4020
+ persona: selectedPersona,
4021
+ framework: selectedFramework,
4022
+ model: selectedModel
4023
+ };
4024
+ const allModulesSelected = previewRequires.every((slot) => !!moduleBySlot[slot]);
3944
4025
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-slot": "agent-composer-desktop", className: "grid h-full grid-cols-2 gap-6", children: [
3945
4026
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-5 overflow-y-auto pr-3", children: [
3946
4027
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2", children: [
@@ -3981,30 +4062,39 @@ function MosaicAgentComposerDesktop({
3981
4062
  ModuleSlot,
3982
4063
  {
3983
4064
  label: L.role,
3984
- sublabel: "Professional expertise and domain knowledge",
4065
+ sublabel: roleSublabel,
3985
4066
  module: selectedRole,
3986
4067
  onSelect: onSelectRole,
3987
- onRemove: onRemoveRole
4068
+ onRemove: onRemoveRole,
4069
+ editAriaLabel: editModuleAriaLabel(L.role),
4070
+ removeAriaLabel: removeModuleAriaLabel(L.role),
4071
+ selectAriaLabel: selectModuleAriaLabel(L.role)
3988
4072
  }
3989
4073
  ),
3990
4074
  /* @__PURE__ */ jsxRuntime.jsx(
3991
4075
  ModuleSlot,
3992
4076
  {
3993
4077
  label: L.persona,
3994
- sublabel: "Communication style and personality traits",
4078
+ sublabel: personaSublabel,
3995
4079
  module: selectedPersona,
3996
4080
  onSelect: onSelectPersona,
3997
- onRemove: onRemovePersona
4081
+ onRemove: onRemovePersona,
4082
+ editAriaLabel: editModuleAriaLabel(L.persona),
4083
+ removeAriaLabel: removeModuleAriaLabel(L.persona),
4084
+ selectAriaLabel: selectModuleAriaLabel(L.persona)
3998
4085
  }
3999
4086
  ),
4000
4087
  /* @__PURE__ */ jsxRuntime.jsx(
4001
4088
  ModuleSlot,
4002
4089
  {
4003
4090
  label: L.framework,
4004
- sublabel: "Thinking approach and decision-making process",
4091
+ sublabel: frameworkSublabel,
4005
4092
  module: selectedFramework,
4006
4093
  onSelect: onSelectFramework,
4007
- onRemove: onRemoveFramework
4094
+ onRemove: onRemoveFramework,
4095
+ editAriaLabel: editModuleAriaLabel(L.framework),
4096
+ removeAriaLabel: removeModuleAriaLabel(L.framework),
4097
+ selectAriaLabel: selectModuleAriaLabel(L.framework)
4008
4098
  }
4009
4099
  ),
4010
4100
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-xl border border-border bg-card", children: [
@@ -4025,16 +4115,13 @@ function MosaicAgentComposerDesktop({
4025
4115
  selectedModel.pricingLabel
4026
4116
  ] })
4027
4117
  ] }) }),
4028
- /* @__PURE__ */ jsxRuntime.jsxs(
4118
+ /* @__PURE__ */ jsxRuntime.jsx(
4029
4119
  "button",
4030
4120
  {
4031
4121
  type: "button",
4032
4122
  onClick: onSelectModel,
4033
4123
  className: "flex w-full min-h-[44px] items-center justify-center rounded-lg border border-border text-sm text-muted-foreground transition-colors hover:border-primary hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
4034
- children: [
4035
- "Change ",
4036
- L.model
4037
- ]
4124
+ children: changeModuleLabel(L.model)
4038
4125
  }
4039
4126
  )
4040
4127
  ] }) : /* @__PURE__ */ jsxRuntime.jsxs(
@@ -4042,12 +4129,11 @@ function MosaicAgentComposerDesktop({
4042
4129
  {
4043
4130
  type: "button",
4044
4131
  onClick: onSelectModel,
4045
- "aria-label": `Select ${L.model}`,
4132
+ "aria-label": selectModuleAriaLabel(L.model),
4046
4133
  className: "flex w-full min-h-[72px] items-center justify-center gap-2 rounded-lg border border-dashed border-border text-sm text-muted-foreground transition-colors hover:border-primary hover:text-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
4047
4134
  children: [
4048
4135
  /* @__PURE__ */ jsxRuntime.jsx(PlusIcon, {}),
4049
- "Select ",
4050
- L.model
4136
+ selectModuleAriaLabel(L.model)
4051
4137
  ]
4052
4138
  }
4053
4139
  ) })
@@ -4262,7 +4348,10 @@ function MobileModuleSlot({
4262
4348
  onSelect,
4263
4349
  onRemove,
4264
4350
  isLoading,
4265
- requiredLabel
4351
+ requiredLabel,
4352
+ editAriaLabel,
4353
+ removeAriaLabel,
4354
+ selectAriaLabel
4266
4355
  }) {
4267
4356
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-xl border border-border bg-card", children: [
4268
4357
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: "border-b border-border px-4 pt-3 pb-2", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between", children: [
@@ -4286,7 +4375,7 @@ function MobileModuleSlot({
4286
4375
  type: "button",
4287
4376
  onClick: onSelect,
4288
4377
  disabled: isLoading,
4289
- "aria-label": `Edit ${label}`,
4378
+ "aria-label": editAriaLabel,
4290
4379
  className: "flex h-8 w-8 items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-muted hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:opacity-50",
4291
4380
  children: /* @__PURE__ */ jsxRuntime.jsxs(
4292
4381
  "svg",
@@ -4314,7 +4403,7 @@ function MobileModuleSlot({
4314
4403
  type: "button",
4315
4404
  onClick: onRemove,
4316
4405
  disabled: isLoading,
4317
- "aria-label": `Remove ${label}`,
4406
+ "aria-label": removeAriaLabel,
4318
4407
  className: "flex h-8 w-8 items-center justify-center rounded-md text-destructive transition-colors hover:bg-destructive/10 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:opacity-50",
4319
4408
  children: /* @__PURE__ */ jsxRuntime.jsxs(
4320
4409
  "svg",
@@ -4343,12 +4432,11 @@ function MobileModuleSlot({
4343
4432
  type: "button",
4344
4433
  onClick: onSelect,
4345
4434
  disabled: isLoading,
4346
- "aria-label": `Select ${label}`,
4435
+ "aria-label": selectAriaLabel,
4347
4436
  className: "flex w-full min-h-[64px] items-center justify-center gap-2 rounded-lg border border-dashed border-border text-sm text-muted-foreground transition-colors hover:border-primary hover:text-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:opacity-50",
4348
4437
  children: [
4349
4438
  /* @__PURE__ */ jsxRuntime.jsx(PlusIcon2, {}),
4350
- "Select ",
4351
- label
4439
+ selectAriaLabel
4352
4440
  ]
4353
4441
  }
4354
4442
  ) })
@@ -4384,7 +4472,11 @@ function MosaicAgentComposerMobile({
4384
4472
  goBackAriaLabel,
4385
4473
  savingLabel,
4386
4474
  creatingLabel,
4387
- optionalInstructionsHelp
4475
+ optionalInstructionsHelp,
4476
+ editModuleAriaLabel,
4477
+ removeModuleAriaLabel,
4478
+ selectModuleAriaLabel,
4479
+ changeModuleLabel
4388
4480
  }) {
4389
4481
  const L = labels;
4390
4482
  const instructionsId = React30__namespace.useId();
@@ -4446,7 +4538,10 @@ function MosaicAgentComposerMobile({
4446
4538
  onSelect: onSelectRole,
4447
4539
  onRemove: onRemoveRole,
4448
4540
  isLoading,
4449
- requiredLabel
4541
+ requiredLabel,
4542
+ editAriaLabel: editModuleAriaLabel(L.role),
4543
+ removeAriaLabel: removeModuleAriaLabel(L.role),
4544
+ selectAriaLabel: selectModuleAriaLabel(L.role)
4450
4545
  }
4451
4546
  ),
4452
4547
  /* @__PURE__ */ jsxRuntime.jsx(
@@ -4458,7 +4553,10 @@ function MosaicAgentComposerMobile({
4458
4553
  onSelect: onSelectPersona,
4459
4554
  onRemove: onRemovePersona,
4460
4555
  isLoading,
4461
- requiredLabel
4556
+ requiredLabel,
4557
+ editAriaLabel: editModuleAriaLabel(L.persona),
4558
+ removeAriaLabel: removeModuleAriaLabel(L.persona),
4559
+ selectAriaLabel: selectModuleAriaLabel(L.persona)
4462
4560
  }
4463
4561
  ),
4464
4562
  /* @__PURE__ */ jsxRuntime.jsx(
@@ -4470,7 +4568,10 @@ function MosaicAgentComposerMobile({
4470
4568
  onSelect: onSelectFramework,
4471
4569
  onRemove: onRemoveFramework,
4472
4570
  isLoading,
4473
- requiredLabel
4571
+ requiredLabel,
4572
+ editAriaLabel: editModuleAriaLabel(L.framework),
4573
+ removeAriaLabel: removeModuleAriaLabel(L.framework),
4574
+ selectAriaLabel: selectModuleAriaLabel(L.framework)
4474
4575
  }
4475
4576
  ),
4476
4577
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-xl border border-border bg-card", children: [
@@ -4494,17 +4595,14 @@ function MosaicAgentComposerMobile({
4494
4595
  selectedModel.pricingLabel
4495
4596
  ] })
4496
4597
  ] }) }),
4497
- /* @__PURE__ */ jsxRuntime.jsxs(
4598
+ /* @__PURE__ */ jsxRuntime.jsx(
4498
4599
  "button",
4499
4600
  {
4500
4601
  type: "button",
4501
4602
  onClick: onSelectModel,
4502
4603
  disabled: isLoading,
4503
4604
  className: "flex w-full min-h-[44px] items-center justify-center rounded-lg border border-border text-sm text-muted-foreground transition-colors hover:border-primary hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:opacity-50",
4504
- children: [
4505
- "Change ",
4506
- L.model
4507
- ]
4605
+ children: changeModuleLabel(L.model)
4508
4606
  }
4509
4607
  )
4510
4608
  ] }) : /* @__PURE__ */ jsxRuntime.jsxs(
@@ -4513,12 +4611,11 @@ function MosaicAgentComposerMobile({
4513
4611
  type: "button",
4514
4612
  onClick: onSelectModel,
4515
4613
  disabled: isLoading,
4516
- "aria-label": `Select ${L.model}`,
4614
+ "aria-label": selectModuleAriaLabel(L.model),
4517
4615
  className: "flex w-full min-h-[64px] items-center justify-center gap-2 rounded-lg border border-dashed border-border text-sm text-muted-foreground transition-colors hover:border-primary hover:text-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:opacity-50",
4518
4616
  children: [
4519
4617
  /* @__PURE__ */ jsxRuntime.jsx(PlusIcon2, {}),
4520
- "Select ",
4521
- L.model
4618
+ selectModuleAriaLabel(L.model)
4522
4619
  ]
4523
4620
  }
4524
4621
  ) })
@@ -6194,6 +6291,7 @@ function MosaicQuickAgentSelector({
6194
6291
  availableAgents = [],
6195
6292
  onAddAgent,
6196
6293
  onRemoveAgent,
6294
+ removeAgentAriaLabel,
6197
6295
  onOpenBuilder,
6198
6296
  maxAgents = 4,
6199
6297
  addLabel,
@@ -6254,7 +6352,7 @@ function MosaicQuickAgentSelector({
6254
6352
  "focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",
6255
6353
  isMobile ? "opacity-100" : "opacity-0 transition-opacity group-hover:opacity-100"
6256
6354
  ),
6257
- "aria-label": `Remove ${agent.name}`,
6355
+ "aria-label": removeAgentAriaLabel(agent.name),
6258
6356
  children: /* @__PURE__ */ jsxRuntime.jsx(XIcon, {})
6259
6357
  }
6260
6358
  )
@@ -8922,7 +9020,7 @@ function TrendingIcon() {
8922
9020
  strokeLinecap: "round",
8923
9021
  strokeLinejoin: "round",
8924
9022
  "aria-hidden": "true",
8925
- className: "text-green-500",
9023
+ className: "text-success-500",
8926
9024
  children: [
8927
9025
  /* @__PURE__ */ jsxRuntime.jsx("polyline", { points: "23 6 13.5 15.5 8.5 10.5 1 18" }),
8928
9026
  /* @__PURE__ */ jsxRuntime.jsx("polyline", { points: "17 6 23 6 23 12" })
@@ -9083,7 +9181,8 @@ function MosaicTemplatePreview({
9083
9181
  onSelect,
9084
9182
  onClose,
9085
9183
  selectLabel,
9086
- cancelLabel
9184
+ cancelLabel,
9185
+ formatAgentsHeading
9087
9186
  }) {
9088
9187
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-slot": "template-preview", className: "flex flex-col gap-4 p-4", children: [
9089
9188
  /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
@@ -9095,11 +9194,7 @@ function MosaicTemplatePreview({
9095
9194
  template.type && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "rounded-md border border-border px-2 py-1 text-xs text-muted-foreground", children: template.type })
9096
9195
  ] }),
9097
9196
  template.agents && template.agents.length > 0 && /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
9098
- /* @__PURE__ */ jsxRuntime.jsxs("p", { className: "mb-2 text-sm font-medium", children: [
9099
- "Agents (",
9100
- template.agents.length,
9101
- ")"
9102
- ] }),
9197
+ formatAgentsHeading && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "mb-2 text-sm font-medium", children: formatAgentsHeading(template.agents.length) }),
9103
9198
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-wrap gap-2", children: template.agents.map((agent) => /* @__PURE__ */ jsxRuntime.jsxs(
9104
9199
  "div",
9105
9200
  {
@@ -9541,7 +9636,8 @@ function MosaicModuleForm(props) {
9541
9636
  namePlaceholder,
9542
9637
  descriptionPlaceholder,
9543
9638
  cancelLabel,
9544
- tagListAddPlaceholder
9639
+ tagListAddPlaceholder,
9640
+ removeTagAriaLabel
9545
9641
  } = props;
9546
9642
  const [formData, setFormData] = React30__namespace.useState({
9547
9643
  name: item?.name ?? "",
@@ -9713,7 +9809,7 @@ function MosaicModuleForm(props) {
9713
9809
  type: "button",
9714
9810
  onClick: () => removeTag(field.id, tag),
9715
9811
  className: "hover:text-destructive",
9716
- "aria-label": `Remove ${tag}`,
9812
+ "aria-label": removeTagAriaLabel?.(tag),
9717
9813
  children: /* @__PURE__ */ jsxRuntime.jsx(XIcon2, {})
9718
9814
  }
9719
9815
  )
@@ -9856,7 +9952,8 @@ function LibraryContent({
9856
9952
  deleteItemLabel,
9857
9953
  closeEditorAriaLabel,
9858
9954
  editModalTitle,
9859
- tagListAddPlaceholder
9955
+ tagListAddPlaceholder,
9956
+ removeTagAriaLabel
9860
9957
  }) {
9861
9958
  const [query, setQuery] = React30__namespace.useState("");
9862
9959
  const [activeTab, setActiveTab] = React30__namespace.useState(tabs?.[0]?.id ?? "all");
@@ -9970,6 +10067,7 @@ function LibraryContent({
9970
10067
  descriptionPlaceholder,
9971
10068
  cancelLabel,
9972
10069
  tagListAddPlaceholder,
10070
+ removeTagAriaLabel,
9973
10071
  ...editorMode === "edit" ? { mode: "edit", saveChangesLabel } : { mode: "create", createItemLabel }
9974
10072
  }
9975
10073
  )
@@ -9984,36 +10082,29 @@ MosaicModuleLibrary.displayName = "MosaicModuleLibrary";
9984
10082
  function cn69(...classes) {
9985
10083
  return classes.filter(Boolean).join(" ");
9986
10084
  }
9987
- var roleConfig = {
9988
- owner: {
9989
- label: "Owner",
9990
- className: "bg-primary text-primary-foreground",
9991
- description: "Full access including billing and organization deletion"
9992
- },
9993
- admin: {
9994
- label: "Admin",
9995
- className: "bg-secondary text-secondary-foreground",
9996
- description: "Full access to organization settings and member management"
9997
- },
9998
- member: {
9999
- label: "Member",
10000
- className: "bg-muted text-muted-foreground",
10001
- description: "Standard access to workspaces and content"
10002
- }
10085
+ var roleClassName = {
10086
+ owner: "bg-primary text-primary-foreground",
10087
+ admin: "bg-secondary text-secondary-foreground",
10088
+ member: "bg-muted text-muted-foreground"
10003
10089
  };
10004
- function MosaicOrgRoleBadge({ role, className }) {
10005
- const config = roleConfig[role] ?? roleConfig.member;
10090
+ function MosaicOrgRoleBadge({
10091
+ role,
10092
+ label,
10093
+ description,
10094
+ className
10095
+ }) {
10096
+ const config = roleClassName[role] ?? roleClassName.member;
10006
10097
  return /* @__PURE__ */ jsxRuntime.jsx(
10007
10098
  "span",
10008
10099
  {
10009
10100
  "data-slot": "org-role-badge",
10010
- title: config.description,
10101
+ title: description,
10011
10102
  className: cn69(
10012
10103
  "inline-flex items-center rounded-full px-2 py-0.5 text-xs font-medium",
10013
- config.className,
10104
+ config,
10014
10105
  className
10015
10106
  ),
10016
- children: config.label
10107
+ children: label
10017
10108
  }
10018
10109
  );
10019
10110
  }
@@ -10083,7 +10174,10 @@ function MosaicCreateOrgDialog({
10083
10174
  descriptionPlaceholder,
10084
10175
  cancelLabel,
10085
10176
  creatingLabel,
10086
- createLabel
10177
+ createLabel,
10178
+ nameRequiredMessage,
10179
+ slugRequiredMessage,
10180
+ slugFormatMessage
10087
10181
  }) {
10088
10182
  const [name, setName] = React30__namespace.useState("");
10089
10183
  const [slug, setSlug] = React30__namespace.useState("");
@@ -10091,10 +10185,9 @@ function MosaicCreateOrgDialog({
10091
10185
  const [errors, setErrors] = React30__namespace.useState({});
10092
10186
  const validate = () => {
10093
10187
  const errs = {};
10094
- if (!name.trim()) errs.name = "Name is required";
10095
- if (!slug.trim()) errs.slug = "Slug is required";
10096
- else if (!/^[a-z0-9-]+$/.test(slug))
10097
- errs.slug = "Slug: lowercase letters, numbers, hyphens only";
10188
+ if (!name.trim()) errs.name = true;
10189
+ if (!slug.trim()) errs.slug = "required";
10190
+ else if (!/^[a-z0-9-]+$/.test(slug)) errs.slug = "format";
10098
10191
  setErrors(errs);
10099
10192
  return Object.keys(errs).length === 0;
10100
10193
  };
@@ -10153,7 +10246,7 @@ function MosaicCreateOrgDialog({
10153
10246
  )
10154
10247
  }
10155
10248
  ),
10156
- errors.name && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs text-destructive", children: errors.name })
10249
+ errors.name && nameRequiredMessage && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs text-destructive", children: nameRequiredMessage })
10157
10250
  ] }),
10158
10251
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-1.5", children: [
10159
10252
  /* @__PURE__ */ jsxRuntime.jsx("label", { htmlFor: "org-slug", className: "text-sm font-medium", children: slugFieldLabel }),
@@ -10173,7 +10266,8 @@ function MosaicCreateOrgDialog({
10173
10266
  )
10174
10267
  }
10175
10268
  ),
10176
- errors.slug && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs text-destructive", children: errors.slug })
10269
+ errors.slug === "required" && slugRequiredMessage && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs text-destructive", children: slugRequiredMessage }),
10270
+ errors.slug === "format" && slugFormatMessage && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs text-destructive", children: slugFormatMessage })
10177
10271
  ] }),
10178
10272
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-1.5", children: [
10179
10273
  /* @__PURE__ */ jsxRuntime.jsx("label", { htmlFor: "org-desc", className: "text-sm font-medium", children: descriptionFieldLabel }),
@@ -10216,16 +10310,12 @@ function MosaicCreateOrgDialog({
10216
10310
  );
10217
10311
  }
10218
10312
  MosaicCreateOrgDialog.displayName = "MosaicCreateOrgDialog";
10219
- var DEFAULT_ROLES = [
10220
- { value: "admin", label: "Admin" },
10221
- { value: "member", label: "Member" }
10222
- ];
10223
10313
  function MosaicInviteMemberDialog({
10224
10314
  open,
10225
10315
  onOpenChange,
10226
10316
  onInvite,
10227
10317
  isLoading = false,
10228
- roles = DEFAULT_ROLES,
10318
+ roles,
10229
10319
  title,
10230
10320
  closeAriaLabel,
10231
10321
  emailFieldLabel,
@@ -10233,15 +10323,17 @@ function MosaicInviteMemberDialog({
10233
10323
  roleFieldLabel,
10234
10324
  cancelLabel,
10235
10325
  sendingLabel,
10236
- sendInvitationLabel
10326
+ sendInvitationLabel,
10327
+ emailRequiredMessage,
10328
+ emailInvalidMessage
10237
10329
  }) {
10238
10330
  const [email, setEmail] = React30__namespace.useState("");
10239
10331
  const [role, setRole] = React30__namespace.useState("member");
10240
10332
  const [errors, setErrors] = React30__namespace.useState({});
10241
10333
  const validate = () => {
10242
10334
  const errs = {};
10243
- if (!email.trim()) errs.email = "Email is required";
10244
- else if (!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(email)) errs.email = "Invalid email";
10335
+ if (!email.trim()) errs.email = "required";
10336
+ else if (!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(email)) errs.email = "invalid";
10245
10337
  setErrors(errs);
10246
10338
  return Object.keys(errs).length === 0;
10247
10339
  };
@@ -10286,7 +10378,8 @@ function MosaicInviteMemberDialog({
10286
10378
  )
10287
10379
  }
10288
10380
  ),
10289
- errors.email && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs text-destructive", children: errors.email })
10381
+ errors.email === "required" && emailRequiredMessage && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs text-destructive", children: emailRequiredMessage }),
10382
+ errors.email === "invalid" && emailInvalidMessage && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs text-destructive", children: emailInvalidMessage })
10290
10383
  ] }),
10291
10384
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-1.5", children: [
10292
10385
  /* @__PURE__ */ jsxRuntime.jsx("label", { htmlFor: "invite-role", className: "text-sm font-medium", children: roleFieldLabel }),
@@ -10336,7 +10429,11 @@ function MemberRow({
10336
10429
  roles,
10337
10430
  youLabel,
10338
10431
  memberActionsAriaLabel,
10339
- removeMemberLabel
10432
+ removeMemberLabel,
10433
+ roleDescriptions,
10434
+ roleLabels,
10435
+ joinedLabel,
10436
+ makeRoleLabel
10340
10437
  }) {
10341
10438
  const [menuOpen, setMenuOpen] = React30__namespace.useState(false);
10342
10439
  const menuRef = React30__namespace.useRef(null);
@@ -10366,12 +10463,16 @@ function MemberRow({
10366
10463
  isSelf && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "shrink-0 rounded-full bg-muted px-1.5 py-0.5 text-[10px] text-muted-foreground", children: youLabel })
10367
10464
  ] }),
10368
10465
  /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs text-muted-foreground truncate", children: member.email }),
10369
- joinedDate && /* @__PURE__ */ jsxRuntime.jsxs("p", { className: "text-xs text-muted-foreground", children: [
10370
- "Joined ",
10371
- joinedDate
10372
- ] })
10466
+ joinedDate && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs text-muted-foreground", children: joinedLabel(joinedDate) })
10373
10467
  ] }),
10374
- /* @__PURE__ */ jsxRuntime.jsx(MosaicOrgRoleBadge, { role: member.role }),
10468
+ /* @__PURE__ */ jsxRuntime.jsx(
10469
+ MosaicOrgRoleBadge,
10470
+ {
10471
+ role: member.role,
10472
+ label: roleLabels[member.role],
10473
+ description: roleDescriptions[member.role]
10474
+ }
10475
+ ),
10375
10476
  !isSelf && (onChangeRole || onRemoveMember) && /* @__PURE__ */ jsxRuntime.jsxs("div", { ref: menuRef, className: "relative shrink-0", children: [
10376
10477
  /* @__PURE__ */ jsxRuntime.jsx(
10377
10478
  "button",
@@ -10409,7 +10510,7 @@ function MemberRow({
10409
10510
  className: "absolute right-0 top-full z-50 mt-1 min-w-[160px] rounded-md border border-border bg-popover py-1 shadow-md",
10410
10511
  children: [
10411
10512
  onChangeRole && roles?.map(
10412
- (r) => r.value !== member.role && /* @__PURE__ */ jsxRuntime.jsxs(
10513
+ (r) => r.value !== member.role && /* @__PURE__ */ jsxRuntime.jsx(
10413
10514
  "button",
10414
10515
  {
10415
10516
  type: "button",
@@ -10419,10 +10520,7 @@ function MemberRow({
10419
10520
  setMenuOpen(false);
10420
10521
  },
10421
10522
  className: "flex w-full items-center gap-2 px-3 py-2 text-sm text-foreground hover:bg-accent hover:text-accent-foreground",
10422
- children: [
10423
- "Make ",
10424
- r.label
10425
- ]
10523
+ children: makeRoleLabel(r.label)
10426
10524
  },
10427
10525
  r.value
10428
10526
  )
@@ -10452,7 +10550,7 @@ function MosaicMemberList({
10452
10550
  onChangeRole,
10453
10551
  onRemoveMember,
10454
10552
  onInvite,
10455
- roles = DEFAULT_ROLES,
10553
+ roles,
10456
10554
  isLoading,
10457
10555
  searchPlaceholder,
10458
10556
  youLabel,
@@ -10460,6 +10558,10 @@ function MosaicMemberList({
10460
10558
  removeMemberLabel,
10461
10559
  emptyMessage,
10462
10560
  inviteLabel,
10561
+ roleDescriptions,
10562
+ roleLabels,
10563
+ joinedLabel,
10564
+ makeRoleLabel,
10463
10565
  className
10464
10566
  }) {
10465
10567
  const [query, setQuery] = React30__namespace.useState("");
@@ -10532,7 +10634,7 @@ function MosaicMemberList({
10532
10634
  }
10533
10635
  )
10534
10636
  ] }),
10535
- isLoading ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "space-y-3", children: [0, 1, 2].map((i) => /* @__PURE__ */ jsxRuntime.jsx("div", { className: "h-14 animate-pulse rounded-lg bg-muted" }, i)) }) : /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "divide-y divide-border", children: [
10637
+ isLoading ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "space-y-3", children: ["skeleton-1", "skeleton-2", "skeleton-3"].map((skeletonId) => /* @__PURE__ */ jsxRuntime.jsx("div", { className: "h-14 animate-pulse rounded-lg bg-muted" }, skeletonId)) }) : /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "divide-y divide-border", children: [
10536
10638
  filtered.map((member) => /* @__PURE__ */ jsxRuntime.jsx(
10537
10639
  MemberRow,
10538
10640
  {
@@ -10543,7 +10645,11 @@ function MosaicMemberList({
10543
10645
  roles,
10544
10646
  youLabel,
10545
10647
  memberActionsAriaLabel,
10546
- removeMemberLabel
10648
+ removeMemberLabel,
10649
+ roleDescriptions,
10650
+ roleLabels,
10651
+ joinedLabel,
10652
+ makeRoleLabel
10547
10653
  },
10548
10654
  member.id
10549
10655
  )),
@@ -10742,6 +10848,7 @@ function MosaicDashboardHeader({
10742
10848
  subtitle,
10743
10849
  notificationCount = 0,
10744
10850
  onNotificationsClick,
10851
+ notificationsAriaLabel,
10745
10852
  onSearchChange,
10746
10853
  actions,
10747
10854
  logoSlot,
@@ -10810,7 +10917,7 @@ function MosaicDashboardHeader({
10810
10917
  type: "button",
10811
10918
  onClick: onNotificationsClick,
10812
10919
  className: "relative inline-flex h-8 w-8 items-center justify-center rounded-md text-muted-foreground hover:bg-accent hover:text-accent-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
10813
- "aria-label": `Notifications${notificationCount > 0 ? ` (${notificationCount})` : ""}`,
10920
+ "aria-label": notificationsAriaLabel?.(notificationCount),
10814
10921
  children: [
10815
10922
  /* @__PURE__ */ jsxRuntime.jsx(BellIcon, {}),
10816
10923
  notificationCount > 0 && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "absolute -right-1 -top-1 flex h-4 w-4 items-center justify-center rounded-full bg-primary text-[10px] font-bold text-primary-foreground", children: notificationCount > 9 ? "9+" : notificationCount })
@@ -12467,9 +12574,11 @@ function MosaicChatThread({
12467
12574
  children,
12468
12575
  scrollToBottomLabel,
12469
12576
  className,
12470
- ref
12577
+ ref,
12578
+ onVisibleRangeChange
12471
12579
  }) {
12472
12580
  const containerRef = React30.useRef(null);
12581
+ const contentRef = React30.useRef(null);
12473
12582
  const isAtBottomRef = React30.useRef(true);
12474
12583
  const [isAtBottom, setIsAtBottom] = React30.useState(true);
12475
12584
  function setRefs(node) {
@@ -12525,6 +12634,37 @@ function MosaicChatThread({
12525
12634
  document.removeEventListener("selectionchange", handleSelectionChange);
12526
12635
  };
12527
12636
  }, []);
12637
+ React30.useEffect(() => {
12638
+ if (!onVisibleRangeChange) {
12639
+ return;
12640
+ }
12641
+ const content = contentRef.current;
12642
+ if (!content) {
12643
+ return;
12644
+ }
12645
+ const visibility = /* @__PURE__ */ new Map();
12646
+ const observer = new IntersectionObserver((entries) => {
12647
+ for (const entry of entries) {
12648
+ visibility.set(entry.target, entry.isIntersecting);
12649
+ }
12650
+ const visibleMessageIds = [];
12651
+ for (const child of Array.from(content.children)) {
12652
+ if (child.id && visibility.get(child)) {
12653
+ visibleMessageIds.push(child.id);
12654
+ }
12655
+ }
12656
+ onVisibleRangeChange({
12657
+ visibleMessageIds,
12658
+ currentAnchorId: visibleMessageIds[0] ?? null
12659
+ });
12660
+ });
12661
+ for (const child of Array.from(content.children)) {
12662
+ observer.observe(child);
12663
+ }
12664
+ return () => {
12665
+ observer.disconnect();
12666
+ };
12667
+ }, [children, onVisibleRangeChange]);
12528
12668
  React30.useLayoutEffect(() => {
12529
12669
  const element = containerRef.current;
12530
12670
  if (element && isAtBottomRef.current) {
@@ -12541,7 +12681,7 @@ function MosaicChatThread({
12541
12681
  onKeyDown: handleKeyDown,
12542
12682
  className: cn80(chatThreadRootVariants(), className),
12543
12683
  children: [
12544
- /* @__PURE__ */ jsxRuntime.jsx("div", { "data-slot": "chat-thread-content", className: chatThreadContentVariants(), children }),
12684
+ /* @__PURE__ */ jsxRuntime.jsx("div", { ref: contentRef, "data-slot": "chat-thread-content", className: chatThreadContentVariants(), children }),
12545
12685
  !isAtBottom && /* @__PURE__ */ jsxRuntime.jsx(
12546
12686
  "button",
12547
12687
  {