@vantageos/mosaic-blocks 0.4.7-alpha → 0.4.8-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/README.md +5 -4
- package/dist/index.cjs +204 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +186 -2
- package/dist/index.d.ts +186 -2
- package/dist/index.js +204 -2
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -20,7 +20,7 @@ import { Switch } from '@base-ui/react/switch';
|
|
|
20
20
|
export { Tooltip } from '@base-ui/react/tooltip';
|
|
21
21
|
import 'class-variance-authority/types';
|
|
22
22
|
|
|
23
|
-
declare const version = "0.4.
|
|
23
|
+
declare const version = "0.4.8-alpha";
|
|
24
24
|
|
|
25
25
|
/**
|
|
26
26
|
* Placeholder component — infra scaffold only.
|
|
@@ -5153,4 +5153,188 @@ declare namespace MosaicDocumentUpload {
|
|
|
5153
5153
|
var displayName: string;
|
|
5154
5154
|
}
|
|
5155
5155
|
|
|
5156
|
-
|
|
5156
|
+
/**
|
|
5157
|
+
* MosaicUrlScraper — presentational URL-input + scraped-content preview
|
|
5158
|
+
*
|
|
5159
|
+
* Presentational atom. Renders a URL input + submit button and, below it,
|
|
5160
|
+
* one of three host-controlled states: a loading indicator, a scraped
|
|
5161
|
+
* content preview (title/description/optional image/link), or an error
|
|
5162
|
+
* message. The component never performs a network call: submitting a
|
|
5163
|
+
* syntactically-valid URL is surfaced via `onScrape(url: string)` — the
|
|
5164
|
+
* host owns how the page is actually fetched/scraped, how long it takes,
|
|
5165
|
+
* and what counts as an error (invalid URL, unreachable page, empty
|
|
5166
|
+
* content are all just different host-supplied `errorMessage` values).
|
|
5167
|
+
*
|
|
5168
|
+
* Local behaviour (no network involved): a client-side URL-syntax check via
|
|
5169
|
+
* `new URL()` runs on submit so a malformed URL is caught immediately
|
|
5170
|
+
* without a host round-trip. This mirrors the source app's own
|
|
5171
|
+
* `isValidUrl` check — it is UI validation, not a scrape.
|
|
5172
|
+
*
|
|
5173
|
+
* Pattern: MosaicDocumentUpload.tsx (data-slot, inline cn, React 19 ref
|
|
5174
|
+
* prop, displayName, JSDoc, pure variants module, host-controlled status
|
|
5175
|
+
* union as a discriminated prop type).
|
|
5176
|
+
* No "use client" — prepend-use-client.mjs adds it to dist.
|
|
5177
|
+
* Design tokens: --foreground, --muted, --muted-foreground, --border,
|
|
5178
|
+
* --destructive, --ring, --accent, --card, --background.
|
|
5179
|
+
* No icon library — uses a plain "↗" glyph for the external link, matching
|
|
5180
|
+
* the document-upload convention (no lucide-react runtime dependency).
|
|
5181
|
+
* a11y: input has a required accessible name; the external link has a
|
|
5182
|
+
* required per-content accessible name; the loading region uses
|
|
5183
|
+
* role="status".
|
|
5184
|
+
* Bilingual: every user-facing string (placeholder/button labels/loading
|
|
5185
|
+
* message/invalid-URL message/error message/reset label/link+image
|
|
5186
|
+
* accessible names) is a required caller-supplied prop — zero hardcoded
|
|
5187
|
+
* copy, zero default.
|
|
5188
|
+
*
|
|
5189
|
+
* Ported from any-debate-ai components/memory/url-scraper.tsx (rewritten
|
|
5190
|
+
* from scratch — no shared code, no license carried over): dropped the
|
|
5191
|
+
* embedded mock "AI-extracted memories" review UI (app-specific business
|
|
5192
|
+
* logic, same call as document-upload's dropped mock-extraction review)
|
|
5193
|
+
* and the network/simulation logic (violates presentational-component
|
|
5194
|
+
* rule), kept the URL input + scrape action + scraped-content preview +
|
|
5195
|
+
* error-state shape.
|
|
5196
|
+
*
|
|
5197
|
+
* Props are pushed into the `MosaicUrlScraperState` discriminated union
|
|
5198
|
+
* exactly where they are read — no prop is required in a status branch
|
|
5199
|
+
* that never renders it (e.g. `loadingMessage` only exists on the
|
|
5200
|
+
* "loading" variant, `content`/`resetButtonLabel`/`onReset` only on
|
|
5201
|
+
* "success", etc.). Known, documented exception: `imageAlt` is required
|
|
5202
|
+
* on the whole "success" branch, not narrowed further by
|
|
5203
|
+
* `content.image` presence — see the prop's own JSDoc.
|
|
5204
|
+
*
|
|
5205
|
+
* @example
|
|
5206
|
+
* // idle
|
|
5207
|
+
* <MosaicUrlScraper
|
|
5208
|
+
* status="idle"
|
|
5209
|
+
* url={url}
|
|
5210
|
+
* onUrlChange={setUrl}
|
|
5211
|
+
* onScrape={(scrapedUrl) => scrapePage(scrapedUrl)}
|
|
5212
|
+
* inputAriaLabel="URL de la page à aspirer"
|
|
5213
|
+
* inputPlaceholder="https://exemple.com/article"
|
|
5214
|
+
* scrapeButtonLabel="Aspirer"
|
|
5215
|
+
* invalidUrlMessage="Veuillez saisir une URL valide"
|
|
5216
|
+
* />
|
|
5217
|
+
*
|
|
5218
|
+
* @example
|
|
5219
|
+
* // success
|
|
5220
|
+
* <MosaicUrlScraper
|
|
5221
|
+
* {...baseProps}
|
|
5222
|
+
* status="success"
|
|
5223
|
+
* content={content}
|
|
5224
|
+
* openLinkAriaLabel={(pageUrl) => `Ouvrir ${pageUrl} dans un nouvel onglet`}
|
|
5225
|
+
* imageAlt={(title) => `Aperçu de ${title}`}
|
|
5226
|
+
* resetButtonLabel="Aspirer une autre page"
|
|
5227
|
+
* onReset={() => reset()}
|
|
5228
|
+
* />
|
|
5229
|
+
*/
|
|
5230
|
+
|
|
5231
|
+
/** Host-supplied scraped page content, shown once status === "success". */
|
|
5232
|
+
interface MosaicUrlScraperContent {
|
|
5233
|
+
/** Scraped page title, displayed as-is. */
|
|
5234
|
+
title: string;
|
|
5235
|
+
/** Scraped page description/summary, displayed as-is. */
|
|
5236
|
+
description: string;
|
|
5237
|
+
/** Optional preview image URL — the image is rendered only when present. */
|
|
5238
|
+
image?: string;
|
|
5239
|
+
/** The scraped page's canonical URL, used as the external-link href. */
|
|
5240
|
+
url: string;
|
|
5241
|
+
}
|
|
5242
|
+
/**
|
|
5243
|
+
* Base props required in EVERY status — read unconditionally by the
|
|
5244
|
+
* component regardless of `status` (input row + local URL-syntax
|
|
5245
|
+
* validation, both reachable from "idle").
|
|
5246
|
+
*/
|
|
5247
|
+
type MosaicUrlScraperBaseProps = {
|
|
5248
|
+
/** Host-controlled current input value. */
|
|
5249
|
+
url: string;
|
|
5250
|
+
/** Called with the raw input value on every keystroke. */
|
|
5251
|
+
onUrlChange: (url: string) => void;
|
|
5252
|
+
/**
|
|
5253
|
+
* Called with the trimmed URL once it passes local syntax validation.
|
|
5254
|
+
* The component performs no scrape itself — the host decides how the
|
|
5255
|
+
* page is fetched and how `status`/`content`/`errorMessage` are updated
|
|
5256
|
+
* afterward.
|
|
5257
|
+
*/
|
|
5258
|
+
onScrape: (url: string) => void;
|
|
5259
|
+
/** Accessible name for the URL input (`aria-label`). Required, no default. */
|
|
5260
|
+
inputAriaLabel: string;
|
|
5261
|
+
/** Placeholder text for the URL input. Required, no default. */
|
|
5262
|
+
inputPlaceholder: string;
|
|
5263
|
+
/** Label for the submit button when idle/ready. Required, no default. */
|
|
5264
|
+
scrapeButtonLabel: string;
|
|
5265
|
+
/**
|
|
5266
|
+
* Message shown when the local `new URL()` syntax check fails on submit.
|
|
5267
|
+
* Required, no default — this is host copy, not an English fallback.
|
|
5268
|
+
* Reachable from "idle": the local check runs on the first submit,
|
|
5269
|
+
* before the host ever sets `status` to "loading".
|
|
5270
|
+
*/
|
|
5271
|
+
invalidUrlMessage: string;
|
|
5272
|
+
/** Additional Tailwind classes on the root element. */
|
|
5273
|
+
className?: string;
|
|
5274
|
+
/** React 19 ref prop — forwarded to the root element. */
|
|
5275
|
+
ref?: React.Ref<HTMLDivElement>;
|
|
5276
|
+
};
|
|
5277
|
+
/**
|
|
5278
|
+
* Host-controlled scrape status. Every prop that is only ever rendered in
|
|
5279
|
+
* ONE status branch lives on that branch's variant — not on the base
|
|
5280
|
+
* props — so the type contract matches exactly what the component reads
|
|
5281
|
+
* (mirrors MosaicDocumentUploadFile's status-driven shape, and the
|
|
5282
|
+
* memory-card "a required prop must be used exactly where it's declared"
|
|
5283
|
+
* rule).
|
|
5284
|
+
*/
|
|
5285
|
+
type MosaicUrlScraperState = {
|
|
5286
|
+
status: "idle";
|
|
5287
|
+
} | {
|
|
5288
|
+
status: "loading";
|
|
5289
|
+
/** Label for the submit button while status === "loading". Required, no default. */
|
|
5290
|
+
scrapingLabel: string;
|
|
5291
|
+
/** Message shown inside the loading region while status === "loading". Required, no default. */
|
|
5292
|
+
loadingMessage: string;
|
|
5293
|
+
} | {
|
|
5294
|
+
status: "success";
|
|
5295
|
+
content: MosaicUrlScraperContent;
|
|
5296
|
+
/**
|
|
5297
|
+
* Per-content accessible name for the external "open" link, e.g.
|
|
5298
|
+
* `(pageUrl) => \`Open ${pageUrl}\``. Required — no hardcoded string.
|
|
5299
|
+
*/
|
|
5300
|
+
openLinkAriaLabel: (pageUrl: string) => string;
|
|
5301
|
+
/**
|
|
5302
|
+
* Per-content alt text for the preview image. Required on this
|
|
5303
|
+
* branch (not narrowed further by `content.image` presence — see
|
|
5304
|
+
* MosaicUrlScraper.tsx JSDoc for why); invoked only when
|
|
5305
|
+
* `content.image` is actually present.
|
|
5306
|
+
*/
|
|
5307
|
+
imageAlt: (title: string) => string;
|
|
5308
|
+
/** Label for the reset/"scrape another" button. Required, no default. */
|
|
5309
|
+
resetButtonLabel: string;
|
|
5310
|
+
/** Called when the reset/"scrape another" button is activated. */
|
|
5311
|
+
onReset: () => void;
|
|
5312
|
+
} | {
|
|
5313
|
+
status: "error";
|
|
5314
|
+
/**
|
|
5315
|
+
* Host-provided, host-localized error message (e.g. "Invalid URL",
|
|
5316
|
+
* "Page unreachable", "Empty content"). The library never generates
|
|
5317
|
+
* its own error strings — every occurrence is a distinct required
|
|
5318
|
+
* value supplied by the caller.
|
|
5319
|
+
*/
|
|
5320
|
+
errorMessage: string;
|
|
5321
|
+
/** Label for the reset/"scrape another" button. Required, no default. */
|
|
5322
|
+
resetButtonLabel: string;
|
|
5323
|
+
/** Called when the reset/"scrape another" button is activated. */
|
|
5324
|
+
onReset: () => void;
|
|
5325
|
+
};
|
|
5326
|
+
type MosaicUrlScraperProps = MosaicUrlScraperBaseProps & MosaicUrlScraperState;
|
|
5327
|
+
/**
|
|
5328
|
+
* MosaicUrlScraper — production URL-scraper atom for
|
|
5329
|
+
* @vantageos/mosaic-blocks.
|
|
5330
|
+
*
|
|
5331
|
+
* Purely presentational: renders the URL input, the current status
|
|
5332
|
+
* (loading/success/error), and reports a validated scrape request / reset
|
|
5333
|
+
* via callbacks. No network call, no scraping simulation, no built-in copy.
|
|
5334
|
+
*/
|
|
5335
|
+
declare function MosaicUrlScraper(props: MosaicUrlScraperProps): React.JSX.Element;
|
|
5336
|
+
declare namespace MosaicUrlScraper {
|
|
5337
|
+
var displayName: string;
|
|
5338
|
+
}
|
|
5339
|
+
|
|
5340
|
+
export { type Breakpoint, type DeviceContextValue, type Feature3ColItem, type FeatureItem, type FooterColumn, type FooterLink, type HeroCta, type LogoItem, MosaicAccordion, MosaicAccordionItem, type MosaicAccordionItemProps, MosaicAccordionPanel, type MosaicAccordionPanelProps, type MosaicAccordionProps, MosaicAccordionTrigger, type MosaicAccordionTriggerProps, type MosaicActionAccent, type MosaicActivity, MosaicActivityFeed, type MosaicActivityFeedProps, MosaicActivityItem, type MosaicActivityItemProps, type MosaicActivityStatus, MosaicAdaptiveGrid, type MosaicAdaptiveGridProps, MosaicAdaptiveModal, type MosaicAdaptiveModalProps, MosaicAdaptiveNavigation, type MosaicAdaptiveNavigationProps, MosaicAgentCard, type MosaicAgentCardProps, MosaicAgentComposer, MosaicAgentComposerDesktop, MosaicAgentComposerMobile, type MosaicAgentComposerMobileProps, type MosaicAgentComposerProps, type MosaicAgentData, MosaicAgentList, AgentListDesktop as MosaicAgentListDesktop, AgentListMobile as MosaicAgentListMobile, type MosaicAgentListProps, type MosaicAgentPreset, MosaicAgentTeamPreview, type MosaicAgentTeamPreviewProps, MosaicAnimatedList, type MosaicAnimatedListProps, MosaicAppSidebar, type MosaicAppSidebarProps, MosaicAvatar, type MosaicAvatarProps, MosaicBadge, type MosaicBadgeProps, MosaicBlurredOrb, type MosaicBlurredOrbProps, type MosaicBreadcrumb, MosaicButton, type MosaicButtonProps, MosaicCard, MosaicCardContent, type MosaicCardContentProps, MosaicCardDescription, type MosaicCardDescriptionProps, MosaicCardFooter, type MosaicCardFooterProps, MosaicCardHeader, type MosaicCardHeaderProps, type MosaicCardProps, MosaicCardTitle, type MosaicCardTitleProps, MosaicCheckbox, type MosaicCheckboxProps, type MosaicClerkMembership, MosaicClerkOrgSwitcher, type MosaicClerkOrgSwitcherProps, type MosaicClerkOrganization, MosaicClerkWebhookHandler, type MosaicClerkWebhookHandlerOptions, MosaicCollapsible, MosaicCollapsiblePanel, type MosaicCollapsiblePanelProps, type MosaicCollapsibleProps, MosaicCollapsibleTrigger, type MosaicCollapsibleTriggerProps, MosaicCombobox, type MosaicComboboxItem, type MosaicComboboxProps, type MosaicComposerModel, type MosaicComposerModule, MosaicCounter, type MosaicCounterProps, MosaicCreateOrgDialog, type MosaicCreateOrgDialogProps, MosaicDashboardContent, type MosaicDashboardContentProps, MosaicDashboardHeader, type MosaicDashboardHeaderProps, MosaicDashboardLayout, type MosaicDashboardLayoutProps, type MosaicDashboardView, MosaicDataTable, type MosaicDataTableColumn, type MosaicDataTablePagination, type MosaicDataTableProps, MosaicDeleteConfirmationDialog, type MosaicDeleteConfirmationDialogProps, MosaicDeviceProvider, type MosaicDeviceProviderProps, MosaicDocumentUpload, type MosaicDocumentUploadFile, type MosaicDocumentUploadFileStatus, type MosaicDocumentUploadProps, MosaicDropdownMenu, type MosaicDropdownMenuItem, type MosaicDropdownMenuProps, MosaicEmptyState, type MosaicEmptyStateProps, MosaicFallingPattern, type MosaicFallingPatternProps, MosaicFeature3Col, type MosaicFeature3ColProps, MosaicFeatureCenteredMedia, type MosaicFeatureCenteredMediaProps, MosaicField, MosaicFieldControl, type MosaicFieldControlProps, MosaicFieldDescription, type MosaicFieldDescriptionProps, MosaicFieldError, type MosaicFieldErrorProps, MosaicFieldLabel, type MosaicFieldLabelProps, type MosaicFieldProps, MosaicFilterBar, type MosaicFilterBarProps, type MosaicFilterOption, MosaicFilterSidebar, type MosaicFilterSidebarProps, MosaicFooterSimple, type MosaicFooterSimpleProps, MosaicHeroSplit, type MosaicHeroSplitProps, MosaicInput, MosaicInputGroup, type MosaicInputGroupProps, type MosaicInputProps, MosaicIntegrationsBadge, type MosaicIntegrationsBadgeProps, MosaicInviteMemberDialog, type MosaicInviteMemberDialogProps, MosaicKanbanBoard, type MosaicKanbanBoardProps, MosaicKanbanColumn, type MosaicKanbanColumnProps, MosaicLogosGrid, type MosaicLogosGridProps, MosaicMainNav, type MosaicMainNavProps, type MosaicMarketplaceItem, MosaicMarketplaceList, MarketplaceListDesktop as MosaicMarketplaceListDesktop, MarketplaceListMobile as MosaicMarketplaceListMobile, type MosaicMarketplaceListProps, MosaicMemberList, type MosaicMemberListProps, MosaicMemoryCard, type MosaicMemoryCardProps, type MosaicMemoryData, type MosaicMemoryScope, type MosaicMemorySource, type MosaicMessage, MosaicMessageCard, type MosaicMessageCardProps, MosaicMessageList, MessageListDesktop as MosaicMessageListDesktop, MessageListMobile as MosaicMessageListMobile, type MosaicMessageListProps, type MosaicMessageReactions, type MosaicMessageSender, type MosaicMessageSenderType, MosaicModuleCard, type MosaicModuleCardProps, type MosaicModuleData, MosaicModuleForm, type MosaicModuleFormField, type MosaicModuleFormProps, type MosaicModuleItem, MosaicModuleLibrary, type MosaicModuleLibraryProps, type MosaicModuleType, MosaicMultiOrgIndicator, type MosaicMultiOrgIndicatorProps, MosaicMultiTenantProvider, type MosaicMultiTenantProviderProps, type MosaicNavItem, MosaicNavbar, type MosaicNavbarProps, type MosaicNavigationItem, type MosaicOrg, type MosaicOrgInfo, type MosaicOrgMember, MosaicOrgPanel, type MosaicOrgPanelProps, type MosaicOrgPanelTab, MosaicOrgProfilePage, type MosaicOrgProfilePageProps, type MosaicOrgRole, MosaicOrgRoleBadge, type MosaicOrgRoleBadgeProps, type MosaicOrgStats, MosaicOrgSwitcher, type MosaicOrgSwitcherProps, type MosaicSelectItem as MosaicPrefSelectItem, type MosaicPreference, type MosaicPreferenceGroup, MosaicPreferencesPanel, type MosaicPreferencesPanelProps, MosaicPricingCard, type MosaicPricingCardProps, type MosaicProfileField, MosaicProfilePanel, type MosaicProfilePanelProps, MosaicProgress, type MosaicProgressProps, type MosaicQuickAction$1 as MosaicQuickAction, MosaicQuickActionCard, type MosaicQuickActionCardProps, MosaicQuickActionsMenu, type MosaicQuickAction as MosaicQuickActionsMenuItem, type MosaicQuickActionsMenuProps, type MosaicQuickAgent, MosaicQuickAgentSelector, type MosaicQuickAgentSelectorProps, MosaicQuickStartPanel, type MosaicQuickStartPanelProps, MosaicRadioGroup, MosaicRadioGroupItem, type MosaicRadioGroupItemProps, type MosaicRadioGroupProps, type MosaicScenario, MosaicScrollArea, type MosaicScrollAreaProps, MosaicSelect, type MosaicSelectItem$1 as MosaicSelectItem, type MosaicSelectProps, type MosaicSelectorCategory, type MosaicSelectorItem, MosaicSelectorModal, type MosaicSelectorModalProps, MosaicSeparator, type MosaicSeparatorProps, type MosaicSidebarFooterStatus, type MosaicSidebarNavItem, type MosaicSidebarQuickAction, type MosaicSidebarRecentItem, MosaicSignInLayout, type MosaicSignInLayoutProps, MosaicSignUpLayout, type MosaicSignUpLayoutProps, MosaicSkeleton, type MosaicSkeletonProps, MosaicSlider, type MosaicSliderProps, type MosaicStatItem, MosaicStatsGrid, type MosaicStatsGridProps, type MosaicStep, MosaicStepPipeline, type MosaicStepPipelineDotsProps, type MosaicStepPipelineProps, type MosaicStepPipelineSegmentsProps, type MosaicStepStatus, MosaicSwitch, type MosaicSwitchProps, MosaicTabs, MosaicTabsList, type MosaicTabsListProps, MosaicTabsPanel, type MosaicTabsPanelProps, type MosaicTabsProps, MosaicTabsTrigger, type MosaicTabsTriggerProps, type MosaicTemplate, type MosaicTemplateAgent, MosaicTemplateCard, type MosaicTemplateCardProps, MosaicTemplateGallery, type MosaicTemplateGalleryProps, type MosaicTemplateMetadata, MosaicTemplatePreview, type MosaicTemplatePreviewProps, MosaicTestimonialsGrid, type MosaicTestimonialsGridProps, MosaicTextarea, type MosaicTextareaProps, MosaicThemeProvider, type MosaicThemeProviderProps, MosaicThemeToggle, type MosaicThemeToggleProps, MosaicTooltip, MosaicTooltipContent, type MosaicTooltipContentProps, type MosaicTooltipProps, MosaicTooltipProvider, type MosaicTooltipProviderProps, MosaicTooltipRoot, type MosaicTooltipRootProps, MosaicTooltipTrigger, type MosaicTooltipTriggerProps, MosaicUrlScraper, type MosaicUrlScraperContent, type MosaicUrlScraperProps, type MosaicUrlScraperState, MosaicUserButton, type MosaicUserButtonProps, type MosaicWorkspaceContext, type NavCta, type NavLink, type OrbPosition, type Orientation, Placeholder, type PricingCta, type SocialLink, type StatItem, type TestimonialItem, type Theme, badgeVariants, buttonVariants, skeletonVariants, useBreakpoint, useDevice, useMosaicWorkspace as useEffectiveWorkspaceId, useIsDesktop, useIsMobile, useIsTablet, useMediaQuery, useMosaicWorkspace, useOrientation, useViewport, version };
|
package/dist/index.d.ts
CHANGED
|
@@ -20,7 +20,7 @@ import { Switch } from '@base-ui/react/switch';
|
|
|
20
20
|
export { Tooltip } from '@base-ui/react/tooltip';
|
|
21
21
|
import 'class-variance-authority/types';
|
|
22
22
|
|
|
23
|
-
declare const version = "0.4.
|
|
23
|
+
declare const version = "0.4.8-alpha";
|
|
24
24
|
|
|
25
25
|
/**
|
|
26
26
|
* Placeholder component — infra scaffold only.
|
|
@@ -5153,4 +5153,188 @@ declare namespace MosaicDocumentUpload {
|
|
|
5153
5153
|
var displayName: string;
|
|
5154
5154
|
}
|
|
5155
5155
|
|
|
5156
|
-
|
|
5156
|
+
/**
|
|
5157
|
+
* MosaicUrlScraper — presentational URL-input + scraped-content preview
|
|
5158
|
+
*
|
|
5159
|
+
* Presentational atom. Renders a URL input + submit button and, below it,
|
|
5160
|
+
* one of three host-controlled states: a loading indicator, a scraped
|
|
5161
|
+
* content preview (title/description/optional image/link), or an error
|
|
5162
|
+
* message. The component never performs a network call: submitting a
|
|
5163
|
+
* syntactically-valid URL is surfaced via `onScrape(url: string)` — the
|
|
5164
|
+
* host owns how the page is actually fetched/scraped, how long it takes,
|
|
5165
|
+
* and what counts as an error (invalid URL, unreachable page, empty
|
|
5166
|
+
* content are all just different host-supplied `errorMessage` values).
|
|
5167
|
+
*
|
|
5168
|
+
* Local behaviour (no network involved): a client-side URL-syntax check via
|
|
5169
|
+
* `new URL()` runs on submit so a malformed URL is caught immediately
|
|
5170
|
+
* without a host round-trip. This mirrors the source app's own
|
|
5171
|
+
* `isValidUrl` check — it is UI validation, not a scrape.
|
|
5172
|
+
*
|
|
5173
|
+
* Pattern: MosaicDocumentUpload.tsx (data-slot, inline cn, React 19 ref
|
|
5174
|
+
* prop, displayName, JSDoc, pure variants module, host-controlled status
|
|
5175
|
+
* union as a discriminated prop type).
|
|
5176
|
+
* No "use client" — prepend-use-client.mjs adds it to dist.
|
|
5177
|
+
* Design tokens: --foreground, --muted, --muted-foreground, --border,
|
|
5178
|
+
* --destructive, --ring, --accent, --card, --background.
|
|
5179
|
+
* No icon library — uses a plain "↗" glyph for the external link, matching
|
|
5180
|
+
* the document-upload convention (no lucide-react runtime dependency).
|
|
5181
|
+
* a11y: input has a required accessible name; the external link has a
|
|
5182
|
+
* required per-content accessible name; the loading region uses
|
|
5183
|
+
* role="status".
|
|
5184
|
+
* Bilingual: every user-facing string (placeholder/button labels/loading
|
|
5185
|
+
* message/invalid-URL message/error message/reset label/link+image
|
|
5186
|
+
* accessible names) is a required caller-supplied prop — zero hardcoded
|
|
5187
|
+
* copy, zero default.
|
|
5188
|
+
*
|
|
5189
|
+
* Ported from any-debate-ai components/memory/url-scraper.tsx (rewritten
|
|
5190
|
+
* from scratch — no shared code, no license carried over): dropped the
|
|
5191
|
+
* embedded mock "AI-extracted memories" review UI (app-specific business
|
|
5192
|
+
* logic, same call as document-upload's dropped mock-extraction review)
|
|
5193
|
+
* and the network/simulation logic (violates presentational-component
|
|
5194
|
+
* rule), kept the URL input + scrape action + scraped-content preview +
|
|
5195
|
+
* error-state shape.
|
|
5196
|
+
*
|
|
5197
|
+
* Props are pushed into the `MosaicUrlScraperState` discriminated union
|
|
5198
|
+
* exactly where they are read — no prop is required in a status branch
|
|
5199
|
+
* that never renders it (e.g. `loadingMessage` only exists on the
|
|
5200
|
+
* "loading" variant, `content`/`resetButtonLabel`/`onReset` only on
|
|
5201
|
+
* "success", etc.). Known, documented exception: `imageAlt` is required
|
|
5202
|
+
* on the whole "success" branch, not narrowed further by
|
|
5203
|
+
* `content.image` presence — see the prop's own JSDoc.
|
|
5204
|
+
*
|
|
5205
|
+
* @example
|
|
5206
|
+
* // idle
|
|
5207
|
+
* <MosaicUrlScraper
|
|
5208
|
+
* status="idle"
|
|
5209
|
+
* url={url}
|
|
5210
|
+
* onUrlChange={setUrl}
|
|
5211
|
+
* onScrape={(scrapedUrl) => scrapePage(scrapedUrl)}
|
|
5212
|
+
* inputAriaLabel="URL de la page à aspirer"
|
|
5213
|
+
* inputPlaceholder="https://exemple.com/article"
|
|
5214
|
+
* scrapeButtonLabel="Aspirer"
|
|
5215
|
+
* invalidUrlMessage="Veuillez saisir une URL valide"
|
|
5216
|
+
* />
|
|
5217
|
+
*
|
|
5218
|
+
* @example
|
|
5219
|
+
* // success
|
|
5220
|
+
* <MosaicUrlScraper
|
|
5221
|
+
* {...baseProps}
|
|
5222
|
+
* status="success"
|
|
5223
|
+
* content={content}
|
|
5224
|
+
* openLinkAriaLabel={(pageUrl) => `Ouvrir ${pageUrl} dans un nouvel onglet`}
|
|
5225
|
+
* imageAlt={(title) => `Aperçu de ${title}`}
|
|
5226
|
+
* resetButtonLabel="Aspirer une autre page"
|
|
5227
|
+
* onReset={() => reset()}
|
|
5228
|
+
* />
|
|
5229
|
+
*/
|
|
5230
|
+
|
|
5231
|
+
/** Host-supplied scraped page content, shown once status === "success". */
|
|
5232
|
+
interface MosaicUrlScraperContent {
|
|
5233
|
+
/** Scraped page title, displayed as-is. */
|
|
5234
|
+
title: string;
|
|
5235
|
+
/** Scraped page description/summary, displayed as-is. */
|
|
5236
|
+
description: string;
|
|
5237
|
+
/** Optional preview image URL — the image is rendered only when present. */
|
|
5238
|
+
image?: string;
|
|
5239
|
+
/** The scraped page's canonical URL, used as the external-link href. */
|
|
5240
|
+
url: string;
|
|
5241
|
+
}
|
|
5242
|
+
/**
|
|
5243
|
+
* Base props required in EVERY status — read unconditionally by the
|
|
5244
|
+
* component regardless of `status` (input row + local URL-syntax
|
|
5245
|
+
* validation, both reachable from "idle").
|
|
5246
|
+
*/
|
|
5247
|
+
type MosaicUrlScraperBaseProps = {
|
|
5248
|
+
/** Host-controlled current input value. */
|
|
5249
|
+
url: string;
|
|
5250
|
+
/** Called with the raw input value on every keystroke. */
|
|
5251
|
+
onUrlChange: (url: string) => void;
|
|
5252
|
+
/**
|
|
5253
|
+
* Called with the trimmed URL once it passes local syntax validation.
|
|
5254
|
+
* The component performs no scrape itself — the host decides how the
|
|
5255
|
+
* page is fetched and how `status`/`content`/`errorMessage` are updated
|
|
5256
|
+
* afterward.
|
|
5257
|
+
*/
|
|
5258
|
+
onScrape: (url: string) => void;
|
|
5259
|
+
/** Accessible name for the URL input (`aria-label`). Required, no default. */
|
|
5260
|
+
inputAriaLabel: string;
|
|
5261
|
+
/** Placeholder text for the URL input. Required, no default. */
|
|
5262
|
+
inputPlaceholder: string;
|
|
5263
|
+
/** Label for the submit button when idle/ready. Required, no default. */
|
|
5264
|
+
scrapeButtonLabel: string;
|
|
5265
|
+
/**
|
|
5266
|
+
* Message shown when the local `new URL()` syntax check fails on submit.
|
|
5267
|
+
* Required, no default — this is host copy, not an English fallback.
|
|
5268
|
+
* Reachable from "idle": the local check runs on the first submit,
|
|
5269
|
+
* before the host ever sets `status` to "loading".
|
|
5270
|
+
*/
|
|
5271
|
+
invalidUrlMessage: string;
|
|
5272
|
+
/** Additional Tailwind classes on the root element. */
|
|
5273
|
+
className?: string;
|
|
5274
|
+
/** React 19 ref prop — forwarded to the root element. */
|
|
5275
|
+
ref?: React.Ref<HTMLDivElement>;
|
|
5276
|
+
};
|
|
5277
|
+
/**
|
|
5278
|
+
* Host-controlled scrape status. Every prop that is only ever rendered in
|
|
5279
|
+
* ONE status branch lives on that branch's variant — not on the base
|
|
5280
|
+
* props — so the type contract matches exactly what the component reads
|
|
5281
|
+
* (mirrors MosaicDocumentUploadFile's status-driven shape, and the
|
|
5282
|
+
* memory-card "a required prop must be used exactly where it's declared"
|
|
5283
|
+
* rule).
|
|
5284
|
+
*/
|
|
5285
|
+
type MosaicUrlScraperState = {
|
|
5286
|
+
status: "idle";
|
|
5287
|
+
} | {
|
|
5288
|
+
status: "loading";
|
|
5289
|
+
/** Label for the submit button while status === "loading". Required, no default. */
|
|
5290
|
+
scrapingLabel: string;
|
|
5291
|
+
/** Message shown inside the loading region while status === "loading". Required, no default. */
|
|
5292
|
+
loadingMessage: string;
|
|
5293
|
+
} | {
|
|
5294
|
+
status: "success";
|
|
5295
|
+
content: MosaicUrlScraperContent;
|
|
5296
|
+
/**
|
|
5297
|
+
* Per-content accessible name for the external "open" link, e.g.
|
|
5298
|
+
* `(pageUrl) => \`Open ${pageUrl}\``. Required — no hardcoded string.
|
|
5299
|
+
*/
|
|
5300
|
+
openLinkAriaLabel: (pageUrl: string) => string;
|
|
5301
|
+
/**
|
|
5302
|
+
* Per-content alt text for the preview image. Required on this
|
|
5303
|
+
* branch (not narrowed further by `content.image` presence — see
|
|
5304
|
+
* MosaicUrlScraper.tsx JSDoc for why); invoked only when
|
|
5305
|
+
* `content.image` is actually present.
|
|
5306
|
+
*/
|
|
5307
|
+
imageAlt: (title: string) => string;
|
|
5308
|
+
/** Label for the reset/"scrape another" button. Required, no default. */
|
|
5309
|
+
resetButtonLabel: string;
|
|
5310
|
+
/** Called when the reset/"scrape another" button is activated. */
|
|
5311
|
+
onReset: () => void;
|
|
5312
|
+
} | {
|
|
5313
|
+
status: "error";
|
|
5314
|
+
/**
|
|
5315
|
+
* Host-provided, host-localized error message (e.g. "Invalid URL",
|
|
5316
|
+
* "Page unreachable", "Empty content"). The library never generates
|
|
5317
|
+
* its own error strings — every occurrence is a distinct required
|
|
5318
|
+
* value supplied by the caller.
|
|
5319
|
+
*/
|
|
5320
|
+
errorMessage: string;
|
|
5321
|
+
/** Label for the reset/"scrape another" button. Required, no default. */
|
|
5322
|
+
resetButtonLabel: string;
|
|
5323
|
+
/** Called when the reset/"scrape another" button is activated. */
|
|
5324
|
+
onReset: () => void;
|
|
5325
|
+
};
|
|
5326
|
+
type MosaicUrlScraperProps = MosaicUrlScraperBaseProps & MosaicUrlScraperState;
|
|
5327
|
+
/**
|
|
5328
|
+
* MosaicUrlScraper — production URL-scraper atom for
|
|
5329
|
+
* @vantageos/mosaic-blocks.
|
|
5330
|
+
*
|
|
5331
|
+
* Purely presentational: renders the URL input, the current status
|
|
5332
|
+
* (loading/success/error), and reports a validated scrape request / reset
|
|
5333
|
+
* via callbacks. No network call, no scraping simulation, no built-in copy.
|
|
5334
|
+
*/
|
|
5335
|
+
declare function MosaicUrlScraper(props: MosaicUrlScraperProps): React.JSX.Element;
|
|
5336
|
+
declare namespace MosaicUrlScraper {
|
|
5337
|
+
var displayName: string;
|
|
5338
|
+
}
|
|
5339
|
+
|
|
5340
|
+
export { type Breakpoint, type DeviceContextValue, type Feature3ColItem, type FeatureItem, type FooterColumn, type FooterLink, type HeroCta, type LogoItem, MosaicAccordion, MosaicAccordionItem, type MosaicAccordionItemProps, MosaicAccordionPanel, type MosaicAccordionPanelProps, type MosaicAccordionProps, MosaicAccordionTrigger, type MosaicAccordionTriggerProps, type MosaicActionAccent, type MosaicActivity, MosaicActivityFeed, type MosaicActivityFeedProps, MosaicActivityItem, type MosaicActivityItemProps, type MosaicActivityStatus, MosaicAdaptiveGrid, type MosaicAdaptiveGridProps, MosaicAdaptiveModal, type MosaicAdaptiveModalProps, MosaicAdaptiveNavigation, type MosaicAdaptiveNavigationProps, MosaicAgentCard, type MosaicAgentCardProps, MosaicAgentComposer, MosaicAgentComposerDesktop, MosaicAgentComposerMobile, type MosaicAgentComposerMobileProps, type MosaicAgentComposerProps, type MosaicAgentData, MosaicAgentList, AgentListDesktop as MosaicAgentListDesktop, AgentListMobile as MosaicAgentListMobile, type MosaicAgentListProps, type MosaicAgentPreset, MosaicAgentTeamPreview, type MosaicAgentTeamPreviewProps, MosaicAnimatedList, type MosaicAnimatedListProps, MosaicAppSidebar, type MosaicAppSidebarProps, MosaicAvatar, type MosaicAvatarProps, MosaicBadge, type MosaicBadgeProps, MosaicBlurredOrb, type MosaicBlurredOrbProps, type MosaicBreadcrumb, MosaicButton, type MosaicButtonProps, MosaicCard, MosaicCardContent, type MosaicCardContentProps, MosaicCardDescription, type MosaicCardDescriptionProps, MosaicCardFooter, type MosaicCardFooterProps, MosaicCardHeader, type MosaicCardHeaderProps, type MosaicCardProps, MosaicCardTitle, type MosaicCardTitleProps, MosaicCheckbox, type MosaicCheckboxProps, type MosaicClerkMembership, MosaicClerkOrgSwitcher, type MosaicClerkOrgSwitcherProps, type MosaicClerkOrganization, MosaicClerkWebhookHandler, type MosaicClerkWebhookHandlerOptions, MosaicCollapsible, MosaicCollapsiblePanel, type MosaicCollapsiblePanelProps, type MosaicCollapsibleProps, MosaicCollapsibleTrigger, type MosaicCollapsibleTriggerProps, MosaicCombobox, type MosaicComboboxItem, type MosaicComboboxProps, type MosaicComposerModel, type MosaicComposerModule, MosaicCounter, type MosaicCounterProps, MosaicCreateOrgDialog, type MosaicCreateOrgDialogProps, MosaicDashboardContent, type MosaicDashboardContentProps, MosaicDashboardHeader, type MosaicDashboardHeaderProps, MosaicDashboardLayout, type MosaicDashboardLayoutProps, type MosaicDashboardView, MosaicDataTable, type MosaicDataTableColumn, type MosaicDataTablePagination, type MosaicDataTableProps, MosaicDeleteConfirmationDialog, type MosaicDeleteConfirmationDialogProps, MosaicDeviceProvider, type MosaicDeviceProviderProps, MosaicDocumentUpload, type MosaicDocumentUploadFile, type MosaicDocumentUploadFileStatus, type MosaicDocumentUploadProps, MosaicDropdownMenu, type MosaicDropdownMenuItem, type MosaicDropdownMenuProps, MosaicEmptyState, type MosaicEmptyStateProps, MosaicFallingPattern, type MosaicFallingPatternProps, MosaicFeature3Col, type MosaicFeature3ColProps, MosaicFeatureCenteredMedia, type MosaicFeatureCenteredMediaProps, MosaicField, MosaicFieldControl, type MosaicFieldControlProps, MosaicFieldDescription, type MosaicFieldDescriptionProps, MosaicFieldError, type MosaicFieldErrorProps, MosaicFieldLabel, type MosaicFieldLabelProps, type MosaicFieldProps, MosaicFilterBar, type MosaicFilterBarProps, type MosaicFilterOption, MosaicFilterSidebar, type MosaicFilterSidebarProps, MosaicFooterSimple, type MosaicFooterSimpleProps, MosaicHeroSplit, type MosaicHeroSplitProps, MosaicInput, MosaicInputGroup, type MosaicInputGroupProps, type MosaicInputProps, MosaicIntegrationsBadge, type MosaicIntegrationsBadgeProps, MosaicInviteMemberDialog, type MosaicInviteMemberDialogProps, MosaicKanbanBoard, type MosaicKanbanBoardProps, MosaicKanbanColumn, type MosaicKanbanColumnProps, MosaicLogosGrid, type MosaicLogosGridProps, MosaicMainNav, type MosaicMainNavProps, type MosaicMarketplaceItem, MosaicMarketplaceList, MarketplaceListDesktop as MosaicMarketplaceListDesktop, MarketplaceListMobile as MosaicMarketplaceListMobile, type MosaicMarketplaceListProps, MosaicMemberList, type MosaicMemberListProps, MosaicMemoryCard, type MosaicMemoryCardProps, type MosaicMemoryData, type MosaicMemoryScope, type MosaicMemorySource, type MosaicMessage, MosaicMessageCard, type MosaicMessageCardProps, MosaicMessageList, MessageListDesktop as MosaicMessageListDesktop, MessageListMobile as MosaicMessageListMobile, type MosaicMessageListProps, type MosaicMessageReactions, type MosaicMessageSender, type MosaicMessageSenderType, MosaicModuleCard, type MosaicModuleCardProps, type MosaicModuleData, MosaicModuleForm, type MosaicModuleFormField, type MosaicModuleFormProps, type MosaicModuleItem, MosaicModuleLibrary, type MosaicModuleLibraryProps, type MosaicModuleType, MosaicMultiOrgIndicator, type MosaicMultiOrgIndicatorProps, MosaicMultiTenantProvider, type MosaicMultiTenantProviderProps, type MosaicNavItem, MosaicNavbar, type MosaicNavbarProps, type MosaicNavigationItem, type MosaicOrg, type MosaicOrgInfo, type MosaicOrgMember, MosaicOrgPanel, type MosaicOrgPanelProps, type MosaicOrgPanelTab, MosaicOrgProfilePage, type MosaicOrgProfilePageProps, type MosaicOrgRole, MosaicOrgRoleBadge, type MosaicOrgRoleBadgeProps, type MosaicOrgStats, MosaicOrgSwitcher, type MosaicOrgSwitcherProps, type MosaicSelectItem as MosaicPrefSelectItem, type MosaicPreference, type MosaicPreferenceGroup, MosaicPreferencesPanel, type MosaicPreferencesPanelProps, MosaicPricingCard, type MosaicPricingCardProps, type MosaicProfileField, MosaicProfilePanel, type MosaicProfilePanelProps, MosaicProgress, type MosaicProgressProps, type MosaicQuickAction$1 as MosaicQuickAction, MosaicQuickActionCard, type MosaicQuickActionCardProps, MosaicQuickActionsMenu, type MosaicQuickAction as MosaicQuickActionsMenuItem, type MosaicQuickActionsMenuProps, type MosaicQuickAgent, MosaicQuickAgentSelector, type MosaicQuickAgentSelectorProps, MosaicQuickStartPanel, type MosaicQuickStartPanelProps, MosaicRadioGroup, MosaicRadioGroupItem, type MosaicRadioGroupItemProps, type MosaicRadioGroupProps, type MosaicScenario, MosaicScrollArea, type MosaicScrollAreaProps, MosaicSelect, type MosaicSelectItem$1 as MosaicSelectItem, type MosaicSelectProps, type MosaicSelectorCategory, type MosaicSelectorItem, MosaicSelectorModal, type MosaicSelectorModalProps, MosaicSeparator, type MosaicSeparatorProps, type MosaicSidebarFooterStatus, type MosaicSidebarNavItem, type MosaicSidebarQuickAction, type MosaicSidebarRecentItem, MosaicSignInLayout, type MosaicSignInLayoutProps, MosaicSignUpLayout, type MosaicSignUpLayoutProps, MosaicSkeleton, type MosaicSkeletonProps, MosaicSlider, type MosaicSliderProps, type MosaicStatItem, MosaicStatsGrid, type MosaicStatsGridProps, type MosaicStep, MosaicStepPipeline, type MosaicStepPipelineDotsProps, type MosaicStepPipelineProps, type MosaicStepPipelineSegmentsProps, type MosaicStepStatus, MosaicSwitch, type MosaicSwitchProps, MosaicTabs, MosaicTabsList, type MosaicTabsListProps, MosaicTabsPanel, type MosaicTabsPanelProps, type MosaicTabsProps, MosaicTabsTrigger, type MosaicTabsTriggerProps, type MosaicTemplate, type MosaicTemplateAgent, MosaicTemplateCard, type MosaicTemplateCardProps, MosaicTemplateGallery, type MosaicTemplateGalleryProps, type MosaicTemplateMetadata, MosaicTemplatePreview, type MosaicTemplatePreviewProps, MosaicTestimonialsGrid, type MosaicTestimonialsGridProps, MosaicTextarea, type MosaicTextareaProps, MosaicThemeProvider, type MosaicThemeProviderProps, MosaicThemeToggle, type MosaicThemeToggleProps, MosaicTooltip, MosaicTooltipContent, type MosaicTooltipContentProps, type MosaicTooltipProps, MosaicTooltipProvider, type MosaicTooltipProviderProps, MosaicTooltipRoot, type MosaicTooltipRootProps, MosaicTooltipTrigger, type MosaicTooltipTriggerProps, MosaicUrlScraper, type MosaicUrlScraperContent, type MosaicUrlScraperProps, type MosaicUrlScraperState, MosaicUserButton, type MosaicUserButtonProps, type MosaicWorkspaceContext, type NavCta, type NavLink, type OrbPosition, type Orientation, Placeholder, type PricingCta, type SocialLink, type StatItem, type TestimonialItem, type Theme, badgeVariants, buttonVariants, skeletonVariants, useBreakpoint, useDevice, useMosaicWorkspace as useEffectiveWorkspaceId, useIsDesktop, useIsMobile, useIsTablet, useMediaQuery, useMosaicWorkspace, useOrientation, useViewport, version };
|