@fluid-app/widget-runtime 0.1.4 → 0.1.6
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 +36 -0
- package/dist/index.cjs +3 -2
- package/dist/index.d.cts +3 -2
- package/dist/index.d.mts +3 -2
- package/dist/index.mjs +3 -3
- package/dist/{remote-dom-renderer-CKvnUH8G.d.mts → remote-dom-renderer-BGIZ0FRi.d.mts} +35 -1
- package/dist/remote-dom-renderer-BGIZ0FRi.d.mts.map +1 -0
- package/dist/{remote-dom-renderer-f7OWlvvv.cjs → remote-dom-renderer-BlZKfMAA.cjs} +340 -172
- package/dist/remote-dom-renderer-BlZKfMAA.cjs.map +1 -0
- package/dist/{remote-dom-renderer-CeYSItkU.d.cts → remote-dom-renderer-BoB9jd3B.d.cts} +35 -1
- package/dist/remote-dom-renderer-BoB9jd3B.d.cts.map +1 -0
- package/dist/{remote-dom-renderer-CpdKWANy.mjs → remote-dom-renderer-Dn3pfVsl.mjs} +340 -172
- package/dist/remote-dom-renderer-Dn3pfVsl.mjs.map +1 -0
- package/dist/remote-dom-ui-contract-B140dMly.d.mts +632 -0
- package/dist/remote-dom-ui-contract-B140dMly.d.mts.map +1 -0
- package/dist/remote-dom-ui-contract-BLOyWbT2.d.cts +632 -0
- package/dist/remote-dom-ui-contract-BLOyWbT2.d.cts.map +1 -0
- package/dist/remote-dom-values-B5UZPDRy.cjs +849 -0
- package/dist/remote-dom-values-B5UZPDRy.cjs.map +1 -0
- package/dist/remote-dom-values-D4AgBNWr.d.cts.map +1 -1
- package/dist/remote-dom-values-EwoLXnSn.d.mts.map +1 -1
- package/dist/remote-dom-values-wEbrw5iW.mjs +790 -0
- package/dist/remote-dom-values-wEbrw5iW.mjs.map +1 -0
- package/dist/remote-dom.cjs +2 -2
- package/dist/remote-dom.d.cts +1 -1
- package/dist/remote-dom.d.mts +1 -1
- package/dist/remote-dom.mjs +2 -2
- package/dist/{worker-react-renderer-BKzig_Vy.mjs → worker-react-renderer-BV6ExKCS.mjs} +17 -40
- package/dist/worker-react-renderer-BV6ExKCS.mjs.map +1 -0
- package/dist/{worker-react-renderer-BvHZ2o0B.cjs → worker-react-renderer-CR-TvErh.cjs} +18 -41
- package/dist/worker-react-renderer-CR-TvErh.cjs.map +1 -0
- package/dist/worker.cjs +18 -3
- package/dist/worker.cjs.map +1 -1
- package/dist/worker.d.cts +17 -2
- package/dist/worker.d.cts.map +1 -1
- package/dist/worker.d.mts +17 -1
- package/dist/worker.d.mts.map +1 -1
- package/dist/worker.mjs +17 -3
- package/dist/worker.mjs.map +1 -1
- package/package.json +1 -1
- package/dist/remote-dom-renderer-CKvnUH8G.d.mts.map +0 -1
- package/dist/remote-dom-renderer-CeYSItkU.d.cts.map +0 -1
- package/dist/remote-dom-renderer-CpdKWANy.mjs.map +0 -1
- package/dist/remote-dom-renderer-f7OWlvvv.cjs.map +0 -1
- package/dist/remote-dom-values-BSAxrOE7.mjs +0 -238
- package/dist/remote-dom-values-BSAxrOE7.mjs.map +0 -1
- package/dist/remote-dom-values-DbgIedSg.cjs +0 -297
- package/dist/remote-dom-values-DbgIedSg.cjs.map +0 -1
- package/dist/worker-react-renderer-BKzig_Vy.mjs.map +0 -1
- package/dist/worker-react-renderer-BvHZ2o0B.cjs.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"remote-dom-values-wEbrw5iW.mjs","names":[],"sources":["../src/remote-dom-ui-contract.ts","../src/remote-dom-values.ts"],"sourcesContent":["import type { ReactNode } from \"react\";\n\nexport const REMOTE_DOM_UI_CONTRACT_VERSION = \"2\";\nexport const REMOTE_DOM_LEGACY_UI_CONTRACT_VERSION = \"1\";\nexport const REMOTE_DOM_SUPPORTED_UI_CONTRACT_VERSIONS = [\n REMOTE_DOM_LEGACY_UI_CONTRACT_VERSION,\n REMOTE_DOM_UI_CONTRACT_VERSION,\n] as const;\n\nexport type RemoteDomUiValueCodec =\n | \"boolean\"\n | \"finite-number-array\"\n | \"finite-number\"\n | \"navigation-url\"\n | \"option-array\"\n | \"string\"\n | \"string-array\"\n | \"string-or-string-array\"\n | \"url\";\n\nexport interface RemoteDomUiEventDefinition {\n readonly propName: string;\n readonly eventName: string;\n readonly payload: RemoteDomUiValueCodec | \"void\";\n}\n\nexport interface RemoteDomUiComponentDefinition {\n readonly exportName: string;\n readonly tagName: `fluid-ui-${string}` | \"fluid-spacer-widget\";\n readonly properties: Readonly<Record<string, RemoteDomUiValueCodec>>;\n readonly events: readonly RemoteDomUiEventDefinition[];\n readonly contractVersion: \"1\" | \"2\";\n}\n\ntype RemoteDomUiCodecValue<Codec extends RemoteDomUiValueCodec | \"void\"> =\n Codec extends \"boolean\"\n ? boolean\n : Codec extends \"finite-number-array\"\n ? readonly number[]\n : Codec extends \"finite-number\"\n ? number\n : Codec extends \"option-array\"\n ? readonly RemoteDomUiOption[]\n : Codec extends \"string\"\n ? string\n : Codec extends \"navigation-url\" | \"url\"\n ? string\n : Codec extends \"string-array\"\n ? readonly string[]\n : Codec extends \"string-or-string-array\"\n ? string | readonly string[]\n : Codec extends \"void\"\n ? void\n : never;\n\n/** Serializable label and value pair used by remote choice components. */\nexport interface RemoteDomUiOption {\n readonly label: string;\n readonly value: string;\n}\n\nconst noProperties = {} as const;\nconst noEvents = [] as const;\n\nconst commonProperties = {\n \"aria-label\": \"string\",\n disabled: \"boolean\",\n id: \"string\",\n} as const satisfies Readonly<Record<string, RemoteDomUiValueCodec>>;\n\nconst disclosureProperties = {\n defaultOpen: \"boolean\",\n open: \"boolean\",\n} as const satisfies Readonly<Record<string, RemoteDomUiValueCodec>>;\n\nconst disclosureEvents = [\n {\n propName: \"onOpenChange\",\n eventName: \"open-change\",\n payload: \"boolean\",\n },\n] as const satisfies readonly RemoteDomUiEventDefinition[];\n\nconst valueProperties = {\n defaultValue: \"string\",\n value: \"string\",\n} as const satisfies Readonly<Record<string, RemoteDomUiValueCodec>>;\n\nconst valueEvents = [\n {\n propName: \"onValueChange\",\n eventName: \"value-change\",\n payload: \"string\",\n },\n] as const satisfies readonly RemoteDomUiEventDefinition[];\n\nconst singleOrMultipleValueEvents = [\n {\n propName: \"onValueChange\",\n eventName: \"value-change\",\n payload: \"string-or-string-array\",\n },\n] as const satisfies readonly RemoteDomUiEventDefinition[];\n\ntype RemoteDomUiLiteralComponentDefinition<\n Name extends string,\n Properties extends Readonly<Record<string, RemoteDomUiValueCodec>>,\n Events extends readonly RemoteDomUiEventDefinition[],\n> = {\n readonly exportName: Name;\n readonly tagName: `fluid-ui-${string}`;\n readonly properties: Properties;\n readonly events: Events;\n readonly contractVersion: \"2\";\n};\n\nfunction component<const Name extends string>(\n exportName: Name,\n): RemoteDomUiLiteralComponentDefinition<\n Name,\n typeof noProperties,\n typeof noEvents\n>;\nfunction component<\n const Name extends string,\n const Properties extends Readonly<Record<string, RemoteDomUiValueCodec>>,\n>(\n exportName: Name,\n properties: Properties,\n): RemoteDomUiLiteralComponentDefinition<Name, Properties, typeof noEvents>;\nfunction component<\n const Name extends string,\n const Properties extends Readonly<Record<string, RemoteDomUiValueCodec>>,\n const Events extends readonly RemoteDomUiEventDefinition[],\n>(\n exportName: Name,\n properties: Properties,\n events: Events,\n): RemoteDomUiLiteralComponentDefinition<Name, Properties, Events>;\nfunction component(\n exportName: string,\n properties: Readonly<Record<string, RemoteDomUiValueCodec>> = noProperties,\n events: readonly RemoteDomUiEventDefinition[] = noEvents,\n): RemoteDomUiComponentDefinition {\n return {\n exportName,\n tagName: `fluid-ui-${exportName\n .replace(/([a-z0-9])([A-Z])/g, \"$1-$2\")\n .toLowerCase()}`,\n properties,\n events,\n contractVersion: \"2\",\n };\n}\n\n/**\n * Reviewed positive allowlist for host-rendered Fluid UI in Remote DOM widgets.\n * This is runtime security policy; it must never be inferred from React props.\n */\nexport const REMOTE_DOM_UI_COMPONENTS = [\n component(\n \"Accordion\",\n {\n ...commonProperties,\n collapsible: \"boolean\",\n defaultValue: \"string-or-string-array\",\n dir: \"string\",\n orientation: \"string\",\n type: \"string\",\n value: \"string-or-string-array\",\n },\n singleOrMultipleValueEvents,\n ),\n component(\"AccordionItem\", { ...commonProperties, value: \"string\" }),\n component(\"AccordionTrigger\", commonProperties),\n component(\"AccordionContent\", noProperties),\n component(\"Alert\", { ...commonProperties, variant: \"string\" }),\n component(\"AlertTitle\"),\n component(\"AlertDescription\"),\n component(\"AlertDialog\", disclosureProperties, disclosureEvents),\n component(\"AlertDialogTrigger\", commonProperties),\n component(\"AlertDialogContent\"),\n component(\"AlertDialogHeader\"),\n component(\"AlertDialogFooter\"),\n component(\"AlertDialogTitle\"),\n component(\"AlertDialogDescription\"),\n component(\"AlertDialogMedia\"),\n component(\"AlertDialogAction\", commonProperties),\n component(\"AlertDialogCancel\", commonProperties),\n component(\"Avatar\", { size: \"string\" }),\n component(\"AvatarImage\", { alt: \"string\", src: \"url\" }),\n component(\"AvatarFallback\", { delayMs: \"finite-number\" }),\n component(\"AvatarBadge\"),\n component(\"AvatarGroup\"),\n component(\"AvatarGroupCount\"),\n component(\"Badge\", { variant: \"string\" }),\n component(\"Breadcrumb\"),\n component(\"BreadcrumbList\"),\n component(\"BreadcrumbItem\"),\n component(\"BreadcrumbLink\", { href: \"navigation-url\" }),\n component(\"BreadcrumbPage\"),\n component(\"BreadcrumbSeparator\"),\n component(\"BreadcrumbEllipsis\"),\n component(\n \"Button\",\n {\n ...commonProperties,\n name: \"string\",\n size: \"string\",\n type: \"string\",\n value: \"string\",\n variant: \"string\",\n },\n [{ propName: \"onPress\", eventName: \"press\", payload: \"void\" }],\n ),\n component(\n \"Calendar\",\n {\n defaultMonth: \"string\",\n disabledDates: \"string-array\",\n fromDate: \"string\",\n month: \"string\",\n selected: \"string\",\n showOutsideDays: \"boolean\",\n toDate: \"string\",\n },\n [\n {\n propName: \"onMonthChange\",\n eventName: \"month-change\",\n payload: \"string\",\n },\n {\n propName: \"onSelectedChange\",\n eventName: \"selected-change\",\n payload: \"string\",\n },\n ],\n ),\n component(\n \"Checkbox\",\n {\n ...commonProperties,\n checked: \"boolean\",\n defaultChecked: \"boolean\",\n name: \"string\",\n required: \"boolean\",\n value: \"string\",\n },\n [\n {\n propName: \"onCheckedChange\",\n eventName: \"checked-change\",\n payload: \"boolean\",\n },\n ],\n ),\n component(\"Card\"),\n component(\"CardHeader\"),\n component(\"CardFooter\"),\n component(\"CardTitle\"),\n component(\"CardAction\"),\n component(\"CardDescription\"),\n component(\"CardContent\"),\n component(\"Collapsible\", disclosureProperties, disclosureEvents),\n component(\"CollapsibleTrigger\", commonProperties),\n component(\"CollapsibleContent\"),\n component(\n \"Command\",\n { loop: \"boolean\", shouldFilter: \"boolean\", value: \"string\" },\n valueEvents,\n ),\n component(\n \"CommandInput\",\n {\n ...commonProperties,\n placeholder: \"string\",\n value: \"string\",\n },\n valueEvents,\n ),\n component(\"CommandList\"),\n component(\"CommandEmpty\"),\n component(\"CommandGroup\", { heading: \"string\", value: \"string\" }),\n component(\n \"CommandItem\",\n { ...commonProperties, keywords: \"string-array\", value: \"string\" },\n [{ propName: \"onSelect\", eventName: \"select\", payload: \"string\" }],\n ),\n component(\"CommandShortcut\"),\n component(\"CommandSeparator\", { alwaysRender: \"boolean\" }),\n component(\n \"DatePicker\",\n {\n ...commonProperties,\n placeholder: \"string\",\n value: \"string\",\n },\n [{ propName: \"onChange\", eventName: \"change\", payload: \"string\" }],\n ),\n component(\"Dialog\", disclosureProperties, disclosureEvents),\n component(\"DialogTrigger\", commonProperties),\n component(\"DialogContent\", {\n ...commonProperties,\n showCloseButton: \"boolean\",\n }),\n component(\"DialogHeader\"),\n component(\"DialogFooter\"),\n component(\"DialogTitle\"),\n component(\"DialogDescription\"),\n component(\"DialogClose\", commonProperties),\n component(\"DropdownMenu\", disclosureProperties, disclosureEvents),\n component(\"DropdownMenuTrigger\", commonProperties),\n component(\"DropdownMenuContent\", {\n align: \"string\",\n alignOffset: \"finite-number\",\n side: \"string\",\n sideOffset: \"finite-number\",\n }),\n component(\"DropdownMenuGroup\"),\n component(\"DropdownMenuLabel\", { inset: \"boolean\" }),\n component(\"DropdownMenuItem\", { ...commonProperties, inset: \"boolean\" }, [\n { propName: \"onSelect\", eventName: \"select\", payload: \"void\" },\n ]),\n component(\n \"DropdownMenuCheckboxItem\",\n { ...commonProperties, checked: \"boolean\" },\n [\n {\n propName: \"onCheckedChange\",\n eventName: \"checked-change\",\n payload: \"boolean\",\n },\n ],\n ),\n component(\"DropdownMenuRadioGroup\", valueProperties, valueEvents),\n component(\"DropdownMenuRadioItem\", { ...commonProperties, value: \"string\" }),\n component(\"DropdownMenuSeparator\"),\n component(\"DropdownMenuShortcut\"),\n component(\"DropdownMenuSub\", disclosureProperties, disclosureEvents),\n component(\"DropdownMenuSubTrigger\", {\n ...commonProperties,\n inset: \"boolean\",\n }),\n component(\"DropdownMenuSubContent\", {\n alignOffset: \"finite-number\",\n sideOffset: \"finite-number\",\n }),\n component(\n \"Input\",\n {\n ...commonProperties,\n autoComplete: \"string\",\n checked: \"boolean\",\n max: \"string\",\n maxLength: \"finite-number\",\n min: \"string\",\n minLength: \"finite-number\",\n name: \"string\",\n pattern: \"string\",\n placeholder: \"string\",\n readOnly: \"boolean\",\n required: \"boolean\",\n step: \"string\",\n type: \"string\",\n value: \"string\",\n },\n [\n { propName: \"onBlur\", eventName: \"blur\", payload: \"void\" },\n { propName: \"onFocus\", eventName: \"focus\", payload: \"void\" },\n {\n propName: \"onValueChange\",\n eventName: \"value-change\",\n payload: \"string\",\n },\n ],\n ),\n component(\"Label\", { htmlFor: \"string\" }),\n component(\"Pagination\"),\n component(\"PaginationContent\"),\n component(\"PaginationItem\"),\n component(\"PaginationLink\", {\n ...commonProperties,\n href: \"navigation-url\",\n isActive: \"boolean\",\n size: \"string\",\n }),\n component(\"PaginationPrevious\", { href: \"navigation-url\" }),\n component(\"PaginationNext\", { href: \"navigation-url\" }),\n component(\"PaginationEllipsis\"),\n component(\n \"Popover\",\n { ...disclosureProperties, modal: \"boolean\" },\n disclosureEvents,\n ),\n component(\"PopoverTrigger\", commonProperties),\n component(\"PopoverAnchor\"),\n component(\"PopoverContent\", {\n align: \"string\",\n alignOffset: \"finite-number\",\n side: \"string\",\n sideOffset: \"finite-number\",\n }),\n component(\"PopoverHeader\"),\n component(\"PopoverTitle\"),\n component(\"PopoverDescription\"),\n component(\"Progress\", { max: \"finite-number\", value: \"finite-number\" }),\n component(\n \"RadioGroup\",\n {\n ...commonProperties,\n ...valueProperties,\n orientation: \"string\",\n required: \"boolean\",\n },\n valueEvents,\n ),\n component(\"RadioGroupItem\", { ...commonProperties, value: \"string\" }),\n component(\"ScrollArea\", { dir: \"string\", type: \"string\" }),\n component(\"ScrollBar\", { orientation: \"string\" }),\n component(\n \"Select\",\n {\n ...commonProperties,\n ...valueProperties,\n name: \"string\",\n open: \"boolean\",\n required: \"boolean\",\n },\n [...valueEvents, ...disclosureEvents],\n ),\n component(\"SelectGroup\"),\n component(\"SelectValue\", { placeholder: \"string\" }),\n component(\"SelectTrigger\", { ...commonProperties, size: \"string\" }),\n component(\"SelectContent\", {\n align: \"string\",\n position: \"string\",\n side: \"string\",\n sideOffset: \"finite-number\",\n }),\n component(\"SelectLabel\"),\n component(\"SelectItem\", {\n ...commonProperties,\n textValue: \"string\",\n value: \"string\",\n }),\n component(\"SelectSeparator\"),\n component(\"SelectScrollUpButton\"),\n component(\"SelectScrollDownButton\"),\n component(\"Separator\", { decorative: \"boolean\", orientation: \"string\" }),\n component(\"Sheet\", disclosureProperties, disclosureEvents),\n component(\"SheetTrigger\", commonProperties),\n component(\"SheetContent\", { ...commonProperties, side: \"string\" }),\n component(\"SheetHeader\"),\n component(\"SheetFooter\"),\n component(\"SheetTitle\"),\n component(\"SheetDescription\"),\n component(\"SheetClose\", commonProperties),\n component(\"Skeleton\", { \"aria-label\": \"string\" }),\n component(\n \"Slider\",\n {\n ...commonProperties,\n defaultValue: \"finite-number-array\",\n inverted: \"boolean\",\n max: \"finite-number\",\n min: \"finite-number\",\n name: \"string\",\n orientation: \"string\",\n step: \"finite-number\",\n value: \"finite-number-array\",\n },\n [\n {\n propName: \"onValueChange\",\n eventName: \"value-change\",\n payload: \"finite-number-array\",\n },\n {\n propName: \"onValueCommit\",\n eventName: \"value-commit\",\n payload: \"finite-number-array\",\n },\n ],\n ),\n component(\"Spinner\", { \"aria-label\": \"string\" }),\n component(\"SpinnerWithText\", { text: \"string\", variant: \"string\" }),\n component(\n \"Switch\",\n {\n ...commonProperties,\n checked: \"boolean\",\n defaultChecked: \"boolean\",\n name: \"string\",\n required: \"boolean\",\n value: \"string\",\n },\n [\n {\n propName: \"onCheckedChange\",\n eventName: \"checked-change\",\n payload: \"boolean\",\n },\n ],\n ),\n component(\"Table\"),\n component(\"TableHeader\"),\n component(\"TableBody\"),\n component(\"TableFooter\"),\n component(\"TableRow\"),\n component(\"TableHead\"),\n component(\"TableCell\"),\n component(\"TableCaption\"),\n component(\n \"Tabs\",\n {\n ...commonProperties,\n ...valueProperties,\n activationMode: \"string\",\n orientation: \"string\",\n },\n valueEvents,\n ),\n component(\"TabsList\", { loop: \"boolean\" }),\n component(\"TabsTrigger\", { ...commonProperties, value: \"string\" }),\n component(\"TabsContent\", { value: \"string\" }),\n component(\n \"Textarea\",\n {\n ...commonProperties,\n autoComplete: \"string\",\n maxLength: \"finite-number\",\n minLength: \"finite-number\",\n name: \"string\",\n placeholder: \"string\",\n readOnly: \"boolean\",\n required: \"boolean\",\n rows: \"finite-number\",\n value: \"string\",\n },\n [\n { propName: \"onBlur\", eventName: \"blur\", payload: \"void\" },\n { propName: \"onFocus\", eventName: \"focus\", payload: \"void\" },\n {\n propName: \"onValueChange\",\n eventName: \"value-change\",\n payload: \"string\",\n },\n ],\n ),\n component(\n \"Toggle\",\n {\n ...commonProperties,\n defaultPressed: \"boolean\",\n pressed: \"boolean\",\n size: \"string\",\n variant: \"string\",\n },\n [\n {\n propName: \"onPressedChange\",\n eventName: \"pressed-change\",\n payload: \"boolean\",\n },\n ],\n ),\n component(\n \"ToggleGroup\",\n {\n ...commonProperties,\n defaultValue: \"string-or-string-array\",\n orientation: \"string\",\n rovingFocus: \"boolean\",\n spacing: \"finite-number\",\n type: \"string\",\n value: \"string-or-string-array\",\n },\n singleOrMultipleValueEvents,\n ),\n component(\"ToggleGroupItem\", { ...commonProperties, value: \"string\" }),\n component(\n \"Tooltip\",\n { defaultOpen: \"boolean\", delayDuration: \"finite-number\", open: \"boolean\" },\n disclosureEvents,\n ),\n component(\"TooltipTrigger\", commonProperties),\n component(\"TooltipContent\", {\n align: \"string\",\n side: \"string\",\n sideOffset: \"finite-number\",\n }),\n component(\n \"Combobox\",\n {\n ...commonProperties,\n emptyText: \"string\",\n options: \"option-array\",\n placeholder: \"string\",\n value: \"string\",\n zIndex: \"finite-number\",\n },\n valueEvents,\n ),\n component(\n \"InfiniteScrollSentinel\",\n {\n hasMore: \"boolean\",\n isLoading: \"boolean\",\n rootMargin: \"string\",\n },\n [{ propName: \"onLoadMore\", eventName: \"load-more\", payload: \"void\" }],\n ),\n component(\n \"PhoneInput\",\n {\n ...commonProperties,\n defaultCountry: \"string\",\n emptyText: \"string\",\n error: \"boolean\",\n searchPlaceholder: \"string\",\n value: \"string\",\n },\n [\n { propName: \"onBlur\", eventName: \"blur\", payload: \"void\" },\n { propName: \"onFocus\", eventName: \"focus\", payload: \"void\" },\n {\n propName: \"onValueChange\",\n eventName: \"value-change\",\n payload: \"string\",\n },\n ],\n ),\n {\n exportName: \"SearchSort\",\n tagName: \"fluid-ui-search-sort\",\n properties: {\n clearLabel: \"string\",\n placeholder: \"string\",\n searchValue: \"string\",\n sortLabel: \"string\",\n sortOptions: \"option-array\",\n sortValue: \"string\",\n },\n events: [\n {\n propName: \"onSearchChange\",\n eventName: \"search-change\",\n payload: \"string\",\n },\n { propName: \"onSortChange\", eventName: \"sort-change\", payload: \"string\" },\n ],\n contractVersion: \"1\",\n },\n {\n exportName: \"FluidSpacerWidget\",\n tagName: \"fluid-spacer-widget\",\n properties: {\n customHeight: \"string\",\n previewMode: \"boolean\",\n },\n events: noEvents,\n contractVersion: \"1\",\n },\n] as const satisfies readonly RemoteDomUiComponentDefinition[];\n\n/** Names of the Fluid UI components available to a Remote DOM widget. */\nexport type RemoteDomUiComponentName =\n (typeof REMOTE_DOM_UI_COMPONENTS)[number][\"exportName\"];\n\ntype RemoteDomUiDefinition<Name extends RemoteDomUiComponentName> = Extract<\n (typeof REMOTE_DOM_UI_COMPONENTS)[number],\n { readonly exportName: Name }\n>;\n\ntype RemoteDomUiPropertyProps<Name extends RemoteDomUiComponentName> = {\n readonly [Property in keyof RemoteDomUiDefinition<Name>[\"properties\"]]?: RemoteDomUiDefinition<Name>[\"properties\"][Property] extends RemoteDomUiValueCodec\n ? RemoteDomUiCodecValue<RemoteDomUiDefinition<Name>[\"properties\"][Property]>\n : never;\n};\n\ntype RemoteDomUiEventProps<Name extends RemoteDomUiComponentName> = {\n readonly [Event in RemoteDomUiDefinition<Name>[\"events\"][number] as Event[\"propName\"]]?: Event[\"payload\"] extends \"void\"\n ? () => void\n : (value: RemoteDomUiCodecValue<Event[\"payload\"]>) => void;\n};\n\ntype RemoteDomUiBaseComponentProps<Name extends RemoteDomUiComponentName> =\n RemoteDomUiPropertyProps<Name> &\n RemoteDomUiEventProps<Name> & {\n /** Content rendered inside the host-owned Fluid component. */\n readonly children?: ReactNode;\n };\n\ntype RemoteDomUiSearchSortProps = Omit<\n RemoteDomUiBaseComponentProps<\"SearchSort\">,\n | \"onSearchChange\"\n | \"onSortChange\"\n | \"searchValue\"\n | \"sortOptions\"\n | \"sortValue\"\n> &\n Required<\n Pick<\n RemoteDomUiBaseComponentProps<\"SearchSort\">,\n \"onSearchChange\" | \"searchValue\"\n >\n > &\n (\n | {\n readonly onSortChange?: never;\n readonly sortOptions?: never;\n readonly sortValue?: never;\n }\n | Required<\n Pick<\n RemoteDomUiBaseComponentProps<\"SearchSort\">,\n \"onSortChange\" | \"sortOptions\" | \"sortValue\"\n >\n >\n );\n\n/** JSON-safe props accepted by one reviewed worker Fluid UI component. */\nexport type RemoteDomUiComponentProps<Name extends RemoteDomUiComponentName> =\n Name extends \"Combobox\"\n ? RemoteDomUiBaseComponentProps<\"Combobox\"> &\n Required<\n Pick<\n RemoteDomUiBaseComponentProps<\"Combobox\">,\n \"onValueChange\" | \"options\" | \"value\"\n >\n >\n : Name extends \"SearchSort\"\n ? RemoteDomUiSearchSortProps\n : RemoteDomUiBaseComponentProps<Name>;\n\nexport const REMOTE_DOM_UI_EXCLUSIONS = {\n Chart: \"Recharts and render-function contracts are not serializable.\",\n Form: \"React Hook Form state, context, and render props stay worker-local.\",\n IconButton: \"Its required Lucide component prop is not serializable.\",\n IconToggle: \"Its required Lucide component prop is not serializable.\",\n MobileActionSheet:\n \"Viewport-level mobile presentation cannot be contained with behavioral parity.\",\n MobileBottomSheet:\n \"Viewport-level mobile presentation cannot be contained with behavioral parity.\",\n PortalContainerProvider:\n \"The widget host owns its contained portal destination.\",\n ResponsiveDialog:\n \"Its mobile presentation depends on an excluded viewport-level sheet.\",\n Toaster:\n \"Toast presentation is a global side effect outside widget ownership.\",\n fluidToast:\n \"Toast presentation is a global side effect outside widget ownership.\",\n useZodForm: \"React Hook Form state and schema integration stay worker-local.\",\n} as const;\n\nexport const REMOTE_DOM_UI_COMPONENT_BY_TAG: ReadonlyMap<\n string,\n RemoteDomUiComponentDefinition\n> = new Map(\n REMOTE_DOM_UI_COMPONENTS.map((definition) => [\n definition.tagName,\n definition,\n ]),\n);\n\nexport function getRemoteDomUiComponent(\n tagName: string,\n): RemoteDomUiComponentDefinition | undefined {\n return REMOTE_DOM_UI_COMPONENT_BY_TAG.get(tagName);\n}\n","import type {\n RemoteMutationRecord,\n RemoteNodeSerialization,\n} from \"@remote-dom/core\";\nimport {\n REMOTE_DOM_UI_COMPONENTS,\n type RemoteDomUiEventDefinition,\n} from \"./remote-dom-ui-contract\";\n\nexport const REMOTE_DOM_FULLSCREEN_CAPABILITY = \"fullscreen\";\nexport const FLUID_SEARCH_SORT_TAG_NAME = \"fluid-ui-search-sort\";\nexport const FLUID_SPACER_WIDGET_TAG_NAME = \"fluid-spacer-widget\";\n\n/** Canonical element allowlist shared by the worker registration and host sanitizer. */\nexport const REMOTE_DOM_ALLOWED_TAG_NAMES = [\n \"a\",\n \"abbr\",\n \"address\",\n \"article\",\n \"aside\",\n \"audio\",\n \"b\",\n \"bdi\",\n \"bdo\",\n \"blockquote\",\n \"br\",\n \"button\",\n \"caption\",\n \"cite\",\n \"code\",\n \"col\",\n \"colgroup\",\n \"data\",\n \"dd\",\n \"del\",\n \"details\",\n \"dfn\",\n \"dialog\",\n \"div\",\n \"dl\",\n \"dt\",\n \"em\",\n \"fieldset\",\n \"figcaption\",\n \"figure\",\n \"footer\",\n \"form\",\n \"h1\",\n \"h2\",\n \"h3\",\n \"h4\",\n \"h5\",\n \"h6\",\n \"header\",\n \"hr\",\n \"i\",\n \"img\",\n \"input\",\n \"ins\",\n \"kbd\",\n \"label\",\n \"legend\",\n \"li\",\n \"main\",\n \"mark\",\n \"meter\",\n \"nav\",\n \"ol\",\n \"optgroup\",\n \"option\",\n \"output\",\n \"p\",\n \"picture\",\n \"pre\",\n \"progress\",\n \"q\",\n \"rp\",\n \"rt\",\n \"ruby\",\n \"s\",\n \"samp\",\n \"section\",\n \"select\",\n \"small\",\n \"source\",\n \"span\",\n \"strong\",\n \"sub\",\n \"summary\",\n \"sup\",\n \"table\",\n \"tbody\",\n \"td\",\n \"textarea\",\n \"tfoot\",\n \"th\",\n \"thead\",\n \"time\",\n \"tr\",\n \"track\",\n \"u\",\n \"ul\",\n \"var\",\n \"video\",\n \"wbr\",\n ...REMOTE_DOM_UI_COMPONENTS.map(({ tagName }) => tagName),\n] as const;\n\n/** Canonical event allowlist shared by worker elements and host forwarding. */\nexport const SUPPORTED_REMOTE_DOM_EVENTS = [\n \"blur\",\n \"change\",\n \"click\",\n \"contextmenu\",\n \"dblclick\",\n \"focus\",\n \"input\",\n \"keydown\",\n \"keypress\",\n \"keyup\",\n \"mousedown\",\n \"mouseenter\",\n \"mouseleave\",\n \"mousemove\",\n \"mouseout\",\n \"mouseover\",\n \"mouseup\",\n \"pointercancel\",\n \"pointerdown\",\n \"pointerenter\",\n \"pointerleave\",\n \"pointermove\",\n \"pointerout\",\n \"pointerover\",\n \"pointerup\",\n \"submit\",\n] as const;\nexport const REMOTE_DOM_SEARCH_SORT_EVENTS = [\n \"search-change\",\n \"sort-change\",\n] as const;\nexport const REMOTE_DOM_UI_EVENTS = [\n ...new Set(\n REMOTE_DOM_UI_COMPONENTS.flatMap(({ events }) =>\n (events as readonly RemoteDomUiEventDefinition[]).map(\n ({ eventName }) => eventName,\n ),\n ),\n ),\n] as const;\n\nexport type RemoteDomRemoteNode = RemoteNodeSerialization;\nexport type RemoteDomRemoteMutationRecord = RemoteMutationRecord;\n\nexport type RemoteDomSerializableValue =\n | null\n | boolean\n | number\n | string\n | readonly RemoteDomSerializableValue[]\n | { readonly [key: string]: RemoteDomSerializableValue };\n\nconst REMOTE_DOM_UNSAFE_PROPERTY_KEYS = new Set([\n \"__proto__\",\n \"constructor\",\n \"prototype\",\n]);\nconst MAX_REMOTE_DOM_SERIALIZATION_DEPTH = 50;\n\nexport function isSafeRemoteDomPropertyKey(key: string): boolean {\n return !REMOTE_DOM_UNSAFE_PROPERTY_KEYS.has(key);\n}\n\n/** Converts an arbitrary value into a structured-clone-safe Remote DOM value. */\nexport function toRemoteDomSerializableValue(\n value: unknown,\n): RemoteDomSerializableValue | undefined {\n return serializeRemoteDomValue(value, new WeakSet<object>(), 0);\n}\n\nfunction serializeRemoteDomValue(\n value: unknown,\n ancestors: WeakSet<object>,\n depth: number,\n): RemoteDomSerializableValue | undefined {\n if (\n value === undefined ||\n typeof value === \"function\" ||\n typeof value === \"symbol\"\n ) {\n return undefined;\n }\n if (typeof value === \"bigint\") return value.toString();\n if (\n value === null ||\n typeof value === \"string\" ||\n typeof value === \"boolean\"\n ) {\n return value;\n }\n if (typeof value === \"number\") {\n return Number.isFinite(value) ? value : null;\n }\n if (typeof value !== \"object\") return null;\n if (depth > MAX_REMOTE_DOM_SERIALIZATION_DEPTH || ancestors.has(value)) {\n return null;\n }\n if (value instanceof Date) {\n return Number.isFinite(value.getTime()) ? value.toISOString() : null;\n }\n if (value instanceof Error) {\n return { name: value.name, message: value.message };\n }\n\n ancestors.add(value);\n try {\n if (Array.isArray(value)) {\n return value.map(\n (item) => serializeRemoteDomValue(item, ancestors, depth + 1) ?? null,\n );\n }\n\n const prototype = Object.getPrototypeOf(value);\n if (prototype !== Object.prototype && prototype !== null) return null;\n\n const serialized: Record<string, RemoteDomSerializableValue> = {};\n for (const [key, item] of Object.entries(value)) {\n if (!isSafeRemoteDomPropertyKey(key)) continue;\n\n const serializedItem = serializeRemoteDomValue(\n item,\n ancestors,\n depth + 1,\n );\n if (serializedItem !== undefined) serialized[key] = serializedItem;\n }\n return serialized;\n } finally {\n ancestors.delete(value);\n }\n}\n\nexport function isRemoteDomSerializableValue(\n value: unknown,\n): value is RemoteDomSerializableValue {\n return isRemoteDomSerializableValueInternal(value, new WeakSet<object>(), 0);\n}\n\nfunction isRemoteDomSerializableValueInternal(\n value: unknown,\n seen: WeakSet<object>,\n depth: number,\n): value is RemoteDomSerializableValue {\n if (value === null) return true;\n\n switch (typeof value) {\n case \"boolean\":\n case \"string\":\n return true;\n case \"number\":\n return Number.isFinite(value);\n case \"object\":\n return isRemoteDomSerializableObject(value, seen, depth);\n default:\n return false;\n }\n}\n\nfunction isRemoteDomSerializableObject(\n value: object,\n ancestors: WeakSet<object>,\n depth: number,\n): value is\n | readonly RemoteDomSerializableValue[]\n | { readonly [key: string]: RemoteDomSerializableValue } {\n if (depth > 50 || ancestors.has(value)) return false;\n\n const prototype = Object.getPrototypeOf(value);\n if (\n !Array.isArray(value) &&\n prototype !== Object.prototype &&\n prototype !== null\n ) {\n return false;\n }\n\n ancestors.add(value);\n try {\n if (Array.isArray(value)) {\n return value.every((item) =>\n isRemoteDomSerializableValueInternal(item, ancestors, depth + 1),\n );\n }\n\n return Object.entries(value).every(\n ([key, item]) =>\n isSafeRemoteDomPropertyKey(key) &&\n isRemoteDomSerializableValueInternal(item, ancestors, depth + 1),\n );\n } finally {\n ancestors.delete(value);\n }\n}\n\nexport type RemoteDomNodeProperties = Readonly<\n Record<string, RemoteDomSerializableValue | undefined>\n>;\n\nexport interface RemoteDomNavigationIntent {\n readonly href: string;\n readonly url: string;\n readonly targetId?: string;\n readonly source: \"anchor\";\n readonly altKey: boolean;\n readonly ctrlKey: boolean;\n readonly metaKey: boolean;\n readonly shiftKey: boolean;\n readonly button: number;\n}\n\nexport const DEFAULT_REMOTE_DOM_MEDIA_ORIGINS = [\n \"https://assets.fluid.app\",\n \"https://cdn.fluid.app\",\n \"https://ik.imagekit.io\",\n \"https://media.fluid.app\",\n] as const;\n\nexport interface RemoteDomUrlOriginPolicy {\n readonly artifactOrigins: readonly string[];\n readonly artifactBaseUrl?: string;\n readonly mediaOrigins: readonly string[];\n readonly navigationOrigin?: string;\n}\n\nexport interface RemoteDomUrlOriginPolicyInput {\n readonly artifactUrls: readonly string[];\n readonly mediaOrigins?: readonly string[];\n readonly navigationOrigin?: string;\n}\n\nexport function createRemoteDomUrlOriginPolicy({\n artifactUrls,\n mediaOrigins = DEFAULT_REMOTE_DOM_MEDIA_ORIGINS,\n navigationOrigin,\n}: RemoteDomUrlOriginPolicyInput): RemoteDomUrlOriginPolicy {\n const artifactOriginSet = new Set<string>();\n let artifactBaseUrl: string | undefined;\n for (const artifactUrl of artifactUrls) {\n const normalizedUrl = normalizeRemoteDomHttpUrl(artifactUrl);\n if (!normalizedUrl) continue;\n artifactOriginSet.add(normalizedUrl.origin);\n artifactBaseUrl ??= normalizedUrl.href;\n }\n\n const mediaOriginSet = new Set<string>();\n for (const mediaOrigin of mediaOrigins) {\n const origin = normalizeRemoteDomHttpOrigin(mediaOrigin);\n if (origin) mediaOriginSet.add(origin);\n }\n\n const navigationHttpOrigin = navigationOrigin\n ? normalizeRemoteDomHttpOrigin(navigationOrigin)\n : undefined;\n\n return {\n artifactOrigins: Array.from(artifactOriginSet),\n ...(artifactBaseUrl ? { artifactBaseUrl } : {}),\n mediaOrigins: Array.from(mediaOriginSet),\n ...(navigationHttpOrigin === undefined\n ? {}\n : { navigationOrigin: navigationHttpOrigin }),\n };\n}\n\nfunction normalizeRemoteDomHttpOrigin(value: string): string | undefined {\n return normalizeRemoteDomHttpUrl(value)?.origin;\n}\n\nfunction normalizeRemoteDomHttpUrl(value: string): URL | undefined {\n try {\n const parsedUrl = new URL(value);\n return parsedUrl.protocol === \"http:\" || parsedUrl.protocol === \"https:\"\n ? parsedUrl\n : undefined;\n } catch {\n return undefined;\n }\n}\n\nexport interface RemoteDomProtocolError {\n readonly code: string;\n readonly message: string;\n readonly details?: RemoteDomSerializableValue;\n}\n"],"mappings":"AAIA,MAAa,4CAA4C,CAAA,KAAA,IAGxD;AAsDD,MAAM,eAAe,EAAE;AACvB,MAAM,WAAW,EAAE;AAEnB,MAAM,mBAAmB;CACvB,cAAc;CACd,UAAU;CACV,IAAI;CACL;AAED,MAAM,uBAAuB;CAC3B,aAAa;CACb,MAAM;CACP;AAED,MAAM,mBAAmB,CACvB;CACE,UAAU;CACV,WAAW;CACX,SAAS;CACV,CACF;AAED,MAAM,kBAAkB;CACtB,cAAc;CACd,OAAO;CACR;AAED,MAAM,cAAc,CAClB;CACE,UAAU;CACV,WAAW;CACX,SAAS;CACV,CACF;AAED,MAAM,8BAA8B,CAClC;CACE,UAAU;CACV,WAAW;CACX,SAAS;CACV,CACF;AAqCD,SAAS,UACP,YACA,aAA8D,cAC9D,SAAgD,UAChB;AAChC,QAAO;EACL;EACA,SAAS,YAAY,WAClB,QAAQ,sBAAsB,QAAQ,CACtC,aAAa;EAChB;EACA;EACA,iBAAiB;EAClB;;;;;;AAOH,MAAa,2BAA2B;CACtC,UACE,aACA;EACE,GAAG;EACH,aAAa;EACb,cAAc;EACd,KAAK;EACL,aAAa;EACb,MAAM;EACN,OAAO;EACR,EACD,4BACD;CAC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,IAAI,IACN,yBAAyB,KAAK,eAAe,CAC3C,WAAW,SACX,WACD,CAAC,CACH;AAED,SAAgB,wBACd,SAC4C;AAC5C,QAAO,+BAA+B,IAAI,QAAQ;;;;ACxvBpD,MAAa,mCAAmC;;AAKhD,MAAa,+BAA+B;CAC1C;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA,GAAG,yBAAyB,KAAK,EAAE,cAAc,QAAQ;CAC1D;;AAGD,MAAa,8BAA8B;CACzC;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACD;AAKmC,CAClC,GAAG,IAAI,IACL,yBAAyB,SAAS,EAAE,aACjC,OAAiD,KAC/C,EAAE,gBAAgB,UACpB,CACF,CACF,CACF;AAaD,MAAM,kCAAkC,IAAI,IAAI;CAC9C;CACA;CACA;CACD,CAAC;AACF,MAAM,qCAAqC;AAE3C,SAAgB,2BAA2B,KAAsB;AAC/D,QAAO,CAAC,gCAAgC,IAAI,IAAI;;;AAIlD,SAAgB,6BACd,OACwC;AACxC,QAAO,wBAAwB,uBAAO,IAAI,SAAiB,EAAE,EAAE;;AAGjE,SAAS,wBACP,OACA,WACA,OACwC;AACxC,KACE,UAAU,KAAA,KACV,OAAO,UAAU,cAC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,6BAA6B,OAAmC;AACvE,QAAO,0BAA0B,MAAM,EAAE;;AAG3C,SAAS,0BAA0B,OAAgC;AACjE,KAAI;EACF,MAAM,YAAY,IAAI,IAAI,MAAM;AAChC,SAAO,UAAU,aAAa,WAAW,UAAU,aAAa,WAC5D,YACA,KAAA;SACE;AACN"}
|
package/dist/remote-dom.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_remote_dom_renderer = require("./remote-dom-renderer-
|
|
3
|
-
const require_remote_dom_values = require("./remote-dom-values-
|
|
2
|
+
const require_remote_dom_renderer = require("./remote-dom-renderer-BlZKfMAA.cjs");
|
|
3
|
+
const require_remote_dom_values = require("./remote-dom-values-B5UZPDRy.cjs");
|
|
4
4
|
exports.isRemoteDomSerializableValue = require_remote_dom_values.isRemoteDomSerializableValue;
|
|
5
5
|
exports.mountRemoteDomWidget = require_remote_dom_renderer.mountRemoteDomWidget;
|
|
6
6
|
exports.toRemoteDomSerializableValue = require_remote_dom_values.toRemoteDomSerializableValue;
|
package/dist/remote-dom.d.cts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { a as isRemoteDomSerializableValue, i as RemoteDomUrlOriginPolicyInput, n as RemoteDomSerializableValue, o as toRemoteDomSerializableValue, r as RemoteDomUrlOriginPolicy, t as RemoteDomNavigationIntent } from "./remote-dom-values-D4AgBNWr.cjs";
|
|
2
|
-
import { a as RemoteDomWidgetHandle, c as mountRemoteDomWidget, d as RemoteDomStyleAttachment, f as RemoteDomThemeBridgeOptions, i as RemoteDomWidgetArtifact, l as RemoteDomCssFetcher, n as RemoteDomCapabilityDeclaration, o as RemoteDomWorkerFactory, r as RemoteDomFullscreenRequest, s as RemoteDomWorkerLike, t as MountRemoteDomWidgetOptions, u as RemoteDomCssUrlInput } from "./remote-dom-renderer-
|
|
2
|
+
import { a as RemoteDomWidgetHandle, c as mountRemoteDomWidget, d as RemoteDomStyleAttachment, f as RemoteDomThemeBridgeOptions, i as RemoteDomWidgetArtifact, l as RemoteDomCssFetcher, n as RemoteDomCapabilityDeclaration, o as RemoteDomWorkerFactory, r as RemoteDomFullscreenRequest, s as RemoteDomWorkerLike, t as MountRemoteDomWidgetOptions, u as RemoteDomCssUrlInput } from "./remote-dom-renderer-BoB9jd3B.cjs";
|
|
3
3
|
export { type MountRemoteDomWidgetOptions, type RemoteDomCapabilityDeclaration, type RemoteDomCssFetcher, type RemoteDomCssUrlInput, type RemoteDomFullscreenRequest, type RemoteDomNavigationIntent, type RemoteDomSerializableValue, type RemoteDomStyleAttachment, type RemoteDomThemeBridgeOptions, type RemoteDomUrlOriginPolicy, type RemoteDomUrlOriginPolicyInput, type RemoteDomWidgetArtifact, type RemoteDomWidgetHandle, type RemoteDomWorkerFactory, type RemoteDomWorkerLike, isRemoteDomSerializableValue, mountRemoteDomWidget, toRemoteDomSerializableValue };
|
package/dist/remote-dom.d.mts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { a as isRemoteDomSerializableValue, i as RemoteDomUrlOriginPolicyInput, n as RemoteDomSerializableValue, o as toRemoteDomSerializableValue, r as RemoteDomUrlOriginPolicy, t as RemoteDomNavigationIntent } from "./remote-dom-values-EwoLXnSn.mjs";
|
|
2
|
-
import { a as RemoteDomWidgetHandle, c as mountRemoteDomWidget, d as RemoteDomStyleAttachment, f as RemoteDomThemeBridgeOptions, i as RemoteDomWidgetArtifact, l as RemoteDomCssFetcher, n as RemoteDomCapabilityDeclaration, o as RemoteDomWorkerFactory, r as RemoteDomFullscreenRequest, s as RemoteDomWorkerLike, t as MountRemoteDomWidgetOptions, u as RemoteDomCssUrlInput } from "./remote-dom-renderer-
|
|
2
|
+
import { a as RemoteDomWidgetHandle, c as mountRemoteDomWidget, d as RemoteDomStyleAttachment, f as RemoteDomThemeBridgeOptions, i as RemoteDomWidgetArtifact, l as RemoteDomCssFetcher, n as RemoteDomCapabilityDeclaration, o as RemoteDomWorkerFactory, r as RemoteDomFullscreenRequest, s as RemoteDomWorkerLike, t as MountRemoteDomWidgetOptions, u as RemoteDomCssUrlInput } from "./remote-dom-renderer-BGIZ0FRi.mjs";
|
|
3
3
|
export { type MountRemoteDomWidgetOptions, type RemoteDomCapabilityDeclaration, type RemoteDomCssFetcher, type RemoteDomCssUrlInput, type RemoteDomFullscreenRequest, type RemoteDomNavigationIntent, type RemoteDomSerializableValue, type RemoteDomStyleAttachment, type RemoteDomThemeBridgeOptions, type RemoteDomUrlOriginPolicy, type RemoteDomUrlOriginPolicyInput, type RemoteDomWidgetArtifact, type RemoteDomWidgetHandle, type RemoteDomWorkerFactory, type RemoteDomWorkerLike, isRemoteDomSerializableValue, mountRemoteDomWidget, toRemoteDomSerializableValue };
|
package/dist/remote-dom.mjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { t as mountRemoteDomWidget } from "./remote-dom-renderer-
|
|
1
|
+
import { a as isRemoteDomSerializableValue, s as toRemoteDomSerializableValue } from "./remote-dom-values-wEbrw5iW.mjs";
|
|
2
|
+
import { t as mountRemoteDomWidget } from "./remote-dom-renderer-Dn3pfVsl.mjs";
|
|
3
3
|
export { isRemoteDomSerializableValue, mountRemoteDomWidget, toRemoteDomSerializableValue };
|
|
@@ -1,14 +1,10 @@
|
|
|
1
|
-
import { a as
|
|
2
|
-
import { BatchingRemoteConnection, RemoteRootElement, createRemoteElement } from "@remote-dom/core/elements";
|
|
1
|
+
import { a as isRemoteDomSerializableValue, l as REMOTE_DOM_UI_COMPONENTS, r as SUPPORTED_REMOTE_DOM_EVENTS, t as REMOTE_DOM_ALLOWED_TAG_NAMES } from "./remote-dom-values-wEbrw5iW.mjs";
|
|
3
2
|
import { flushSync } from "react-dom";
|
|
4
3
|
import { createRoot } from "react-dom/client";
|
|
4
|
+
import { BatchingRemoteConnection, RemoteRootElement, createRemoteElement } from "@remote-dom/core/elements";
|
|
5
5
|
//#region src/worker-react-renderer.ts
|
|
6
6
|
const REMOTE_ROOT_TAG_NAME = "remote-root";
|
|
7
7
|
const standardEventDefinitions = createRemoteEventDefinitions(SUPPORTED_REMOTE_DOM_EVENTS);
|
|
8
|
-
const searchSortEventDefinitions = {
|
|
9
|
-
...standardEventDefinitions,
|
|
10
|
-
...createRemoteEventDefinitions(REMOTE_DOM_SEARCH_SORT_EVENTS)
|
|
11
|
-
};
|
|
12
8
|
const FluidRemoteElement = createRemoteElement({ events: standardEventDefinitions });
|
|
13
9
|
const RemoteInputElement = createRemoteElement({
|
|
14
10
|
events: standardEventDefinitions,
|
|
@@ -35,28 +31,6 @@ var FluidRemoteInputElement = class extends RemoteInputElement {
|
|
|
35
31
|
if (typeof checked === "boolean") this.updateRemoteProperty("checked", checked);
|
|
36
32
|
}
|
|
37
33
|
};
|
|
38
|
-
const FluidRemoteSearchSortElement = createRemoteElement({
|
|
39
|
-
events: searchSortEventDefinitions,
|
|
40
|
-
properties: {
|
|
41
|
-
placeholder: { attribute: false },
|
|
42
|
-
searchValue: {
|
|
43
|
-
attribute: false,
|
|
44
|
-
default: ""
|
|
45
|
-
},
|
|
46
|
-
sortOptions: { attribute: false },
|
|
47
|
-
sortValue: { attribute: false }
|
|
48
|
-
}
|
|
49
|
-
});
|
|
50
|
-
const FluidRemoteSpacerWidgetElement = createRemoteElement({
|
|
51
|
-
events: standardEventDefinitions,
|
|
52
|
-
properties: {
|
|
53
|
-
customHeight: { attribute: false },
|
|
54
|
-
previewMode: {
|
|
55
|
-
attribute: false,
|
|
56
|
-
default: false
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
});
|
|
60
34
|
let remoteElementsRegistered = false;
|
|
61
35
|
function createRemoteDomReactWorkerRenderer({ connection }) {
|
|
62
36
|
registerRemoteElements();
|
|
@@ -107,12 +81,19 @@ function registerRemoteElements() {
|
|
|
107
81
|
if (remoteElementsRegistered) return;
|
|
108
82
|
remoteElementsRegistered = true;
|
|
109
83
|
defineRemoteElement(REMOTE_ROOT_TAG_NAME, RemoteRootElement);
|
|
84
|
+
const fluidTagNames = new Set(REMOTE_DOM_UI_COMPONENTS.map(({ tagName }) => tagName));
|
|
110
85
|
for (const tagName of REMOTE_DOM_ALLOWED_TAG_NAMES) {
|
|
111
|
-
if (tagName
|
|
86
|
+
if (fluidTagNames.has(tagName)) continue;
|
|
112
87
|
defineRemoteElement(tagName, tagName === "input" ? FluidRemoteInputElement : FluidRemoteElement);
|
|
113
88
|
}
|
|
114
|
-
defineRemoteElement(
|
|
115
|
-
|
|
89
|
+
for (const definition of REMOTE_DOM_UI_COMPONENTS) defineRemoteElement(definition.tagName, createRemoteUiElementConstructor(definition));
|
|
90
|
+
}
|
|
91
|
+
function createRemoteUiElementConstructor(definition) {
|
|
92
|
+
const properties = Object.fromEntries(Object.keys(definition.properties).map((propertyName) => [propertyName, { attribute: false }]));
|
|
93
|
+
return createRemoteElement({
|
|
94
|
+
events: createRemoteEventDefinitions(definition.events.map(({ eventName }) => eventName)),
|
|
95
|
+
properties
|
|
96
|
+
});
|
|
116
97
|
}
|
|
117
98
|
function defineRemoteElement(tagName, constructor) {
|
|
118
99
|
if (customElements.get(tagName)) return;
|
|
@@ -129,9 +110,8 @@ function createRemoteEventDefinitions(eventNames) {
|
|
|
129
110
|
}]));
|
|
130
111
|
}
|
|
131
112
|
function readHostEventDetail(payload) {
|
|
132
|
-
if (
|
|
133
|
-
|
|
134
|
-
return isRemoteDomSerializableValue(detail) ? detail : void 0;
|
|
113
|
+
if (isObjectRecord(payload) && isRemoteDomSerializableValue(payload.detail)) return payload.detail;
|
|
114
|
+
return isRemoteDomSerializableValue(payload) ? payload : void 0;
|
|
135
115
|
}
|
|
136
116
|
function createRemoteDomReactEvent(eventName, detail) {
|
|
137
117
|
const customDetail = parseCustomEventDetail(eventName, detail);
|
|
@@ -147,8 +127,8 @@ function createRemoteDomReactEvent(eventName, detail) {
|
|
|
147
127
|
if (eventType !== void 0) setObjectProperty(event, "inputType", eventType);
|
|
148
128
|
return event;
|
|
149
129
|
}
|
|
150
|
-
function parseCustomEventDetail(
|
|
151
|
-
if (!
|
|
130
|
+
function parseCustomEventDetail(_eventName, detail) {
|
|
131
|
+
if (!isObjectRecord(detail)) return { ok: false };
|
|
152
132
|
const detailJson = detail.detailJson;
|
|
153
133
|
if (typeof detailJson !== "string") return { ok: false };
|
|
154
134
|
try {
|
|
@@ -161,9 +141,6 @@ function parseCustomEventDetail(eventName, detail) {
|
|
|
161
141
|
return { ok: false };
|
|
162
142
|
}
|
|
163
143
|
}
|
|
164
|
-
function isSearchSortEvent(eventName) {
|
|
165
|
-
return REMOTE_DOM_SEARCH_SORT_EVENTS.some((candidate) => candidate === eventName);
|
|
166
|
-
}
|
|
167
144
|
function readSerializableString(detail, key) {
|
|
168
145
|
const value = detail[key];
|
|
169
146
|
return typeof value === "string" ? value : void 0;
|
|
@@ -182,4 +159,4 @@ function isObjectRecord(value) {
|
|
|
182
159
|
//#endregion
|
|
183
160
|
export { createRemoteDomReactWorkerRenderer };
|
|
184
161
|
|
|
185
|
-
//# sourceMappingURL=worker-react-renderer-
|
|
162
|
+
//# sourceMappingURL=worker-react-renderer-BV6ExKCS.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"worker-react-renderer-BV6ExKCS.mjs","names":[],"sources":["../src/worker-react-renderer.ts"],"sourcesContent":["import {\n BatchingRemoteConnection,\n createRemoteElement,\n RemoteRootElement,\n type RemoteElementEventListenerDefinition,\n type RemoteConnection,\n} from \"@remote-dom/core/elements\";\nimport type { ReactNode } from \"react\";\nimport { flushSync } from \"react-dom\";\nimport { createRoot, type Root } from \"react-dom/client\";\n\nimport {\n isRemoteDomSerializableValue,\n REMOTE_DOM_ALLOWED_TAG_NAMES,\n SUPPORTED_REMOTE_DOM_EVENTS,\n type RemoteDomSerializableValue,\n} from \"./remote-dom-values\";\nimport {\n REMOTE_DOM_UI_COMPONENTS,\n type RemoteDomUiComponentDefinition,\n} from \"./remote-dom-ui-contract\";\n\nexport interface RemoteDomReactWorkerRendererOptions {\n /**\n * The host-backed connection ({@link RemoteConnection}); its `mutate` is the\n * threads-proxied `host.mutate`. The renderer wraps it in a\n * `BatchingRemoteConnection` and flushes explicitly after every commit.\n */\n readonly connection: RemoteConnection;\n}\n\nexport interface RemoteDomReactWorkerRenderer {\n readonly render: (node: ReactNode) => void;\n readonly dispose: () => void;\n}\n\nconst REMOTE_ROOT_TAG_NAME = \"remote-root\";\n\ntype NoRemoteMembers = Record<never, never>;\ntype RemoteEventListeners = Record<string, (payload?: unknown) => unknown>;\n\nconst standardEventDefinitions = createRemoteEventDefinitions(\n SUPPORTED_REMOTE_DOM_EVENTS,\n);\nconst FluidRemoteElement = createRemoteElement<\n NoRemoteMembers,\n NoRemoteMembers,\n NoRemoteMembers,\n RemoteEventListeners\n>({ events: standardEventDefinitions });\n\ninterface RemoteInputProperties {\n readonly checked: boolean;\n readonly type: string;\n readonly value: string;\n}\n\nconst RemoteInputElement = createRemoteElement<\n RemoteInputProperties,\n NoRemoteMembers,\n NoRemoteMembers,\n RemoteEventListeners\n>({\n events: standardEventDefinitions,\n properties: {\n checked: { attribute: false, default: false },\n type: { attribute: true, default: \"text\" },\n value: { attribute: false, default: \"\" },\n },\n});\n\nclass FluidRemoteInputElement extends RemoteInputElement {\n applyHostState(detail: Readonly<Record<string, unknown>>): void {\n // React wraps public input setters with its value tracker. Update Remote\n // DOM's upstream property cache directly so the following native event is\n // extracted, while still synchronizing the host-controlled value.\n const value = readSerializableString(detail, \"value\");\n if (value !== undefined) this.updateRemoteProperty(\"value\", value);\n\n const checked = detail.checked;\n if (typeof checked === \"boolean\") {\n this.updateRemoteProperty(\"checked\", checked);\n }\n }\n}\n\nlet remoteElementsRegistered = false;\n\nexport function createRemoteDomReactWorkerRenderer({\n connection,\n}: RemoteDomReactWorkerRendererOptions): RemoteDomReactWorkerRenderer {\n registerRemoteElements();\n\n const remoteRoot = document.createElement(\n REMOTE_ROOT_TAG_NAME,\n ) as RemoteRootElement;\n const batchedConnection = new BatchingRemoteConnection(connection);\n remoteRoot.connect(batchedConnection);\n const reactRoot: Root = createRoot(remoteRoot);\n // Remote DOM installs bubbling event proxies from custom-element lifecycle\n // callbacks. Keep the remote tree connected to its synthetic document so\n // those callbacks run for every element React mounts.\n try {\n document.body.append(remoteRoot);\n } catch (error) {\n reactRoot.unmount();\n throw error;\n }\n let disposed = false;\n\n return {\n render(node) {\n flushSync(() => {\n reactRoot.render(node);\n });\n // The host must never observe a capability/event side effect before the\n // DOM it references, so force mutations out immediately after commit.\n batchedConnection.flush();\n },\n dispose() {\n if (disposed) return;\n disposed = true;\n const cleanupErrors: unknown[] = [];\n\n try {\n flushSync(() => {\n reactRoot.unmount();\n });\n } catch (error) {\n cleanupErrors.push(error);\n }\n try {\n remoteRoot.remove();\n } catch (error) {\n cleanupErrors.push(error);\n }\n try {\n batchedConnection.flush();\n } catch (error) {\n cleanupErrors.push(error);\n }\n\n if (cleanupErrors.length > 0) {\n throw new AggregateError(\n cleanupErrors,\n \"Remote DOM React session cleanup failed.\",\n );\n }\n },\n };\n}\n\nfunction registerRemoteElements(): void {\n if (remoteElementsRegistered) return;\n remoteElementsRegistered = true;\n\n defineRemoteElement(REMOTE_ROOT_TAG_NAME, RemoteRootElement);\n const fluidTagNames = new Set<string>(\n REMOTE_DOM_UI_COMPONENTS.map(({ tagName }) => tagName),\n );\n for (const tagName of REMOTE_DOM_ALLOWED_TAG_NAMES) {\n if (fluidTagNames.has(tagName)) continue;\n defineRemoteElement(\n tagName,\n tagName === \"input\" ? FluidRemoteInputElement : FluidRemoteElement,\n );\n }\n for (const definition of REMOTE_DOM_UI_COMPONENTS) {\n defineRemoteElement(\n definition.tagName,\n createRemoteUiElementConstructor(definition),\n );\n }\n}\n\nfunction createRemoteUiElementConstructor(\n definition: RemoteDomUiComponentDefinition,\n): CustomElementConstructor {\n const properties = Object.fromEntries(\n Object.keys(definition.properties).map((propertyName) => [\n propertyName,\n { attribute: false },\n ]),\n );\n const events = createRemoteEventDefinitions(\n definition.events.map(({ eventName }) => eventName),\n );\n return createRemoteElement<\n Record<string, RemoteDomSerializableValue | undefined>,\n NoRemoteMembers,\n NoRemoteMembers,\n RemoteEventListeners\n >({ events, properties });\n}\n\nfunction defineRemoteElement(\n tagName: string,\n constructor: CustomElementConstructor,\n): void {\n if (customElements.get(tagName)) return;\n customElements.define(tagName, constructor);\n}\n\nfunction createRemoteEventDefinitions(\n eventNames: readonly string[],\n): Readonly<Record<string, RemoteElementEventListenerDefinition>> {\n return Object.fromEntries(\n eventNames.map((eventName) => [\n eventName,\n {\n bubbles: true,\n dispatchEvent(this: Element, payload?: unknown) {\n const detail = readHostEventDetail(payload);\n if (\n this instanceof FluidRemoteInputElement &&\n isObjectRecord(detail)\n ) {\n this.applyHostState(detail);\n }\n return createRemoteDomReactEvent(eventName, detail);\n },\n },\n ]),\n );\n}\n\nfunction readHostEventDetail(\n payload: unknown,\n): RemoteDomSerializableValue | undefined {\n if (isObjectRecord(payload) && isRemoteDomSerializableValue(payload.detail)) {\n return payload.detail;\n }\n return isRemoteDomSerializableValue(payload) ? payload : undefined;\n}\n\nfunction createRemoteDomReactEvent(\n eventName: string,\n detail: RemoteDomSerializableValue | undefined,\n): Event {\n const customDetail = parseCustomEventDetail(eventName, detail);\n const event = new CustomEvent(eventName, {\n bubbles: true,\n cancelable: true,\n detail: customDetail.ok ? customDetail.value : detail,\n });\n if (!isObjectRecord(detail)) return event;\n\n const key = readSerializableString(detail, \"key\");\n if (key !== undefined) setObjectProperty(event, \"key\", key);\n\n const eventType = readSerializableString(detail, \"type\");\n if (eventType !== undefined) setObjectProperty(event, \"inputType\", eventType);\n\n return event;\n}\n\nfunction parseCustomEventDetail(\n _eventName: string,\n detail: RemoteDomSerializableValue | undefined,\n):\n | { readonly ok: true; readonly value: RemoteDomSerializableValue }\n | { readonly ok: false } {\n if (!isObjectRecord(detail)) {\n return { ok: false };\n }\n const detailJson = detail.detailJson;\n if (typeof detailJson !== \"string\") return { ok: false };\n\n try {\n const value: unknown = JSON.parse(detailJson);\n return isRemoteDomSerializableValue(value)\n ? { ok: true, value }\n : { ok: false };\n } catch {\n return { ok: false };\n }\n}\n\nfunction readSerializableString(\n detail: Readonly<Record<string, unknown>>,\n key: string,\n): string | undefined {\n const value = detail[key];\n return typeof value === \"string\" ? value : undefined;\n}\n\nfunction setObjectProperty(target: object, key: string, value: unknown): void {\n Object.defineProperty(target, key, {\n configurable: true,\n enumerable: true,\n value,\n writable: true,\n });\n}\n\nfunction isObjectRecord(\n value: unknown,\n): value is Readonly<Record<string, unknown>> {\n return typeof value === \"object\" && value !== null && !Array.isArray(value);\n}\n"],"mappings":";;;;;AAoCA,MAAM,uBAAuB;AAK7B,MAAM,2BAA2B,6BAC/B,4BACD;AACD,MAAM,qBAAqB,oBAKzB,EAAE,QAAQ,0BAA0B,CAAC;AAQvC,MAAM,qBAAqB,oBAKzB;CACA,QAAQ;CACR,YAAY;EACV,SAAS;GAAE,WAAW;GAAO,SAAS;GAAO;EAC7C,MAAM;GAAE,WAAW;GAAM,SAAS;GAAQ;EAC1C,OAAO;GAAE,WAAW;GAAO,SAAS;GAAI;EACzC;CACF,CAAC;AAEF,IAAM,0BAAN,cAAsC,mBAAmB;CACvD,eAAe,QAAiD;EAI9D,MAAM,QAAQ,uBAAuB,QAAQ,QAAQ;AACrD,MAAI,UAAU,KAAA,EAAW,MAAK,qBAAqB,SAAS,MAAM;EAElE,MAAM,UAAU,OAAO;AACvB,MAAI,OAAO,YAAY,UACrB,MAAK,qBAAqB,WAAW,QAAQ;;;AAKnD,IAAI,2BAA2B;AAE/B,SAAgB,mCAAmC,EACjD,cACoE;AACpE,yBAAwB;CAExB,MAAM,aAAa,SAAS,cAC1B,qBACD;CACD,MAAM,oBAAoB,IAAI,yBAAyB,WAAW;AAClE,YAAW,QAAQ,kBAAkB;CACrC,MAAM,YAAkB,WAAW,WAAW;AAI9C,KAAI;AACF,WAAS,KAAK,OAAO,WAAW;UACzB,OAAO;AACd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AG7C,SAAS,kBAAkB,QAAgB,KAAa,OAAsB;AAC5E,QAAO,eAAe,QAAQ,KAAK;EACjC,cAAc;EACd,YAAY;EACZ;EACA,UAAU;EACX,CAAC;;AAGJ,SAAS,eACP,OAC4C;AAC5C,QAAO,OAAO,UAAU,YAAY,UAAU,QAAQ,CAAC,MAAM,QAAQ,MAAM"}
|
|
@@ -1,15 +1,11 @@
|
|
|
1
|
-
require("./remote-dom-renderer-
|
|
2
|
-
const require_remote_dom_values = require("./remote-dom-values-
|
|
3
|
-
let _remote_dom_core_elements = require("@remote-dom/core/elements");
|
|
1
|
+
require("./remote-dom-renderer-BlZKfMAA.cjs");
|
|
2
|
+
const require_remote_dom_values = require("./remote-dom-values-B5UZPDRy.cjs");
|
|
4
3
|
let react_dom = require("react-dom");
|
|
5
4
|
let react_dom_client = require("react-dom/client");
|
|
5
|
+
let _remote_dom_core_elements = require("@remote-dom/core/elements");
|
|
6
6
|
//#region src/worker-react-renderer.ts
|
|
7
7
|
const REMOTE_ROOT_TAG_NAME = "remote-root";
|
|
8
8
|
const standardEventDefinitions = createRemoteEventDefinitions(require_remote_dom_values.SUPPORTED_REMOTE_DOM_EVENTS);
|
|
9
|
-
const searchSortEventDefinitions = {
|
|
10
|
-
...standardEventDefinitions,
|
|
11
|
-
...createRemoteEventDefinitions(require_remote_dom_values.REMOTE_DOM_SEARCH_SORT_EVENTS)
|
|
12
|
-
};
|
|
13
9
|
const FluidRemoteElement = (0, _remote_dom_core_elements.createRemoteElement)({ events: standardEventDefinitions });
|
|
14
10
|
const RemoteInputElement = (0, _remote_dom_core_elements.createRemoteElement)({
|
|
15
11
|
events: standardEventDefinitions,
|
|
@@ -36,28 +32,6 @@ var FluidRemoteInputElement = class extends RemoteInputElement {
|
|
|
36
32
|
if (typeof checked === "boolean") this.updateRemoteProperty("checked", checked);
|
|
37
33
|
}
|
|
38
34
|
};
|
|
39
|
-
const FluidRemoteSearchSortElement = (0, _remote_dom_core_elements.createRemoteElement)({
|
|
40
|
-
events: searchSortEventDefinitions,
|
|
41
|
-
properties: {
|
|
42
|
-
placeholder: { attribute: false },
|
|
43
|
-
searchValue: {
|
|
44
|
-
attribute: false,
|
|
45
|
-
default: ""
|
|
46
|
-
},
|
|
47
|
-
sortOptions: { attribute: false },
|
|
48
|
-
sortValue: { attribute: false }
|
|
49
|
-
}
|
|
50
|
-
});
|
|
51
|
-
const FluidRemoteSpacerWidgetElement = (0, _remote_dom_core_elements.createRemoteElement)({
|
|
52
|
-
events: standardEventDefinitions,
|
|
53
|
-
properties: {
|
|
54
|
-
customHeight: { attribute: false },
|
|
55
|
-
previewMode: {
|
|
56
|
-
attribute: false,
|
|
57
|
-
default: false
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
});
|
|
61
35
|
let remoteElementsRegistered = false;
|
|
62
36
|
function createRemoteDomReactWorkerRenderer({ connection }) {
|
|
63
37
|
registerRemoteElements();
|
|
@@ -108,12 +82,19 @@ function registerRemoteElements() {
|
|
|
108
82
|
if (remoteElementsRegistered) return;
|
|
109
83
|
remoteElementsRegistered = true;
|
|
110
84
|
defineRemoteElement(REMOTE_ROOT_TAG_NAME, _remote_dom_core_elements.RemoteRootElement);
|
|
85
|
+
const fluidTagNames = new Set(require_remote_dom_values.REMOTE_DOM_UI_COMPONENTS.map(({ tagName }) => tagName));
|
|
111
86
|
for (const tagName of require_remote_dom_values.REMOTE_DOM_ALLOWED_TAG_NAMES) {
|
|
112
|
-
if (tagName
|
|
87
|
+
if (fluidTagNames.has(tagName)) continue;
|
|
113
88
|
defineRemoteElement(tagName, tagName === "input" ? FluidRemoteInputElement : FluidRemoteElement);
|
|
114
89
|
}
|
|
115
|
-
|
|
116
|
-
|
|
90
|
+
for (const definition of require_remote_dom_values.REMOTE_DOM_UI_COMPONENTS) defineRemoteElement(definition.tagName, createRemoteUiElementConstructor(definition));
|
|
91
|
+
}
|
|
92
|
+
function createRemoteUiElementConstructor(definition) {
|
|
93
|
+
const properties = Object.fromEntries(Object.keys(definition.properties).map((propertyName) => [propertyName, { attribute: false }]));
|
|
94
|
+
return (0, _remote_dom_core_elements.createRemoteElement)({
|
|
95
|
+
events: createRemoteEventDefinitions(definition.events.map(({ eventName }) => eventName)),
|
|
96
|
+
properties
|
|
97
|
+
});
|
|
117
98
|
}
|
|
118
99
|
function defineRemoteElement(tagName, constructor) {
|
|
119
100
|
if (customElements.get(tagName)) return;
|
|
@@ -130,9 +111,8 @@ function createRemoteEventDefinitions(eventNames) {
|
|
|
130
111
|
}]));
|
|
131
112
|
}
|
|
132
113
|
function readHostEventDetail(payload) {
|
|
133
|
-
if (
|
|
134
|
-
|
|
135
|
-
return require_remote_dom_values.isRemoteDomSerializableValue(detail) ? detail : void 0;
|
|
114
|
+
if (isObjectRecord(payload) && require_remote_dom_values.isRemoteDomSerializableValue(payload.detail)) return payload.detail;
|
|
115
|
+
return require_remote_dom_values.isRemoteDomSerializableValue(payload) ? payload : void 0;
|
|
136
116
|
}
|
|
137
117
|
function createRemoteDomReactEvent(eventName, detail) {
|
|
138
118
|
const customDetail = parseCustomEventDetail(eventName, detail);
|
|
@@ -148,8 +128,8 @@ function createRemoteDomReactEvent(eventName, detail) {
|
|
|
148
128
|
if (eventType !== void 0) setObjectProperty(event, "inputType", eventType);
|
|
149
129
|
return event;
|
|
150
130
|
}
|
|
151
|
-
function parseCustomEventDetail(
|
|
152
|
-
if (!
|
|
131
|
+
function parseCustomEventDetail(_eventName, detail) {
|
|
132
|
+
if (!isObjectRecord(detail)) return { ok: false };
|
|
153
133
|
const detailJson = detail.detailJson;
|
|
154
134
|
if (typeof detailJson !== "string") return { ok: false };
|
|
155
135
|
try {
|
|
@@ -162,9 +142,6 @@ function parseCustomEventDetail(eventName, detail) {
|
|
|
162
142
|
return { ok: false };
|
|
163
143
|
}
|
|
164
144
|
}
|
|
165
|
-
function isSearchSortEvent(eventName) {
|
|
166
|
-
return require_remote_dom_values.REMOTE_DOM_SEARCH_SORT_EVENTS.some((candidate) => candidate === eventName);
|
|
167
|
-
}
|
|
168
145
|
function readSerializableString(detail, key) {
|
|
169
146
|
const value = detail[key];
|
|
170
147
|
return typeof value === "string" ? value : void 0;
|
|
@@ -183,4 +160,4 @@ function isObjectRecord(value) {
|
|
|
183
160
|
//#endregion
|
|
184
161
|
exports.createRemoteDomReactWorkerRenderer = createRemoteDomReactWorkerRenderer;
|
|
185
162
|
|
|
186
|
-
//# sourceMappingURL=worker-react-renderer-
|
|
163
|
+
//# sourceMappingURL=worker-react-renderer-CR-TvErh.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"worker-react-renderer-CR-TvErh.cjs","names":["SUPPORTED_REMOTE_DOM_EVENTS","BatchingRemoteConnection","RemoteRootElement","REMOTE_DOM_UI_COMPONENTS","REMOTE_DOM_ALLOWED_TAG_NAMES","isRemoteDomSerializableValue"],"sources":["../src/worker-react-renderer.ts"],"sourcesContent":["import {\n BatchingRemoteConnection,\n createRemoteElement,\n RemoteRootElement,\n type RemoteElementEventListenerDefinition,\n type RemoteConnection,\n} from \"@remote-dom/core/elements\";\nimport type { ReactNode } from \"react\";\nimport { flushSync } from \"react-dom\";\nimport { createRoot, type Root } from \"react-dom/client\";\n\nimport {\n isRemoteDomSerializableValue,\n REMOTE_DOM_ALLOWED_TAG_NAMES,\n SUPPORTED_REMOTE_DOM_EVENTS,\n type RemoteDomSerializableValue,\n} from \"./remote-dom-values\";\nimport {\n REMOTE_DOM_UI_COMPONENTS,\n type RemoteDomUiComponentDefinition,\n} from \"./remote-dom-ui-contract\";\n\nexport interface RemoteDomReactWorkerRendererOptions {\n /**\n * The host-backed connection ({@link RemoteConnection}); its `mutate` is the\n * threads-proxied `host.mutate`. The renderer wraps it in a\n * `BatchingRemoteConnection` and flushes explicitly after every commit.\n */\n readonly connection: RemoteConnection;\n}\n\nexport interface RemoteDomReactWorkerRenderer {\n readonly render: (node: ReactNode) => void;\n readonly dispose: () => void;\n}\n\nconst REMOTE_ROOT_TAG_NAME = \"remote-root\";\n\ntype NoRemoteMembers = Record<never, never>;\ntype RemoteEventListeners = Record<string, (payload?: unknown) => unknown>;\n\nconst standardEventDefinitions = createRemoteEventDefinitions(\n SUPPORTED_REMOTE_DOM_EVENTS,\n);\nconst FluidRemoteElement = createRemoteElement<\n NoRemoteMembers,\n NoRemoteMembers,\n NoRemoteMembers,\n RemoteEventListeners\n>({ events: standardEventDefinitions });\n\ninterface RemoteInputProperties {\n readonly checked: boolean;\n readonly type: string;\n readonly value: string;\n}\n\nconst RemoteInputElement = createRemoteElement<\n RemoteInputProperties,\n NoRemoteMembers,\n NoRemoteMembers,\n RemoteEventListeners\n>({\n events: standardEventDefinitions,\n properties: {\n checked: { attribute: false, default: false },\n type: { attribute: true, default: \"text\" },\n value: { attribute: false, default: \"\" },\n },\n});\n\nclass FluidRemoteInputElement extends RemoteInputElement {\n applyHostState(detail: Readonly<Record<string, unknown>>): void {\n // React wraps public input setters with its value tracker. Update Remote\n // DOM's upstream property cache directly so the following native event is\n // extracted, while still synchronizing the host-controlled value.\n const value = readSerializableString(detail, \"value\");\n if (value !== undefined) this.updateRemoteProperty(\"value\", value);\n\n const checked = detail.checked;\n if (typeof checked === \"boolean\") {\n this.updateRemoteProperty(\"checked\", checked);\n }\n }\n}\n\nlet remoteElementsRegistered = false;\n\nexport function createRemoteDomReactWorkerRenderer({\n connection,\n}: RemoteDomReactWorkerRendererOptions): RemoteDomReactWorkerRenderer {\n registerRemoteElements();\n\n const remoteRoot = document.createElement(\n REMOTE_ROOT_TAG_NAME,\n ) as RemoteRootElement;\n const batchedConnection = new BatchingRemoteConnection(connection);\n remoteRoot.connect(batchedConnection);\n const reactRoot: Root = createRoot(remoteRoot);\n // Remote DOM installs bubbling event proxies from custom-element lifecycle\n // callbacks. Keep the remote tree connected to its synthetic document so\n // those callbacks run for every element React mounts.\n try {\n document.body.append(remoteRoot);\n } catch (error) {\n reactRoot.unmount();\n throw error;\n }\n let disposed = false;\n\n return {\n render(node) {\n flushSync(() => {\n reactRoot.render(node);\n });\n // The host must never observe a capability/event side effect before the\n // DOM it references, so force mutations out immediately after commit.\n batchedConnection.flush();\n },\n dispose() {\n if (disposed) return;\n disposed = true;\n const cleanupErrors: unknown[] = [];\n\n try {\n flushSync(() => {\n reactRoot.unmount();\n });\n } catch (error) {\n cleanupErrors.push(error);\n }\n try {\n remoteRoot.remove();\n } catch (error) {\n cleanupErrors.push(error);\n }\n try {\n batchedConnection.flush();\n } catch (error) {\n cleanupErrors.push(error);\n }\n\n if (cleanupErrors.length > 0) {\n throw new AggregateError(\n cleanupErrors,\n \"Remote DOM React session cleanup failed.\",\n );\n }\n },\n };\n}\n\nfunction registerRemoteElements(): void {\n if (remoteElementsRegistered) return;\n remoteElementsRegistered = true;\n\n defineRemoteElement(REMOTE_ROOT_TAG_NAME, RemoteRootElement);\n const fluidTagNames = new Set<string>(\n REMOTE_DOM_UI_COMPONENTS.map(({ tagName }) => tagName),\n );\n for (const tagName of REMOTE_DOM_ALLOWED_TAG_NAMES) {\n if (fluidTagNames.has(tagName)) continue;\n defineRemoteElement(\n tagName,\n tagName === \"input\" ? FluidRemoteInputElement : FluidRemoteElement,\n );\n }\n for (const definition of REMOTE_DOM_UI_COMPONENTS) {\n defineRemoteElement(\n definition.tagName,\n createRemoteUiElementConstructor(definition),\n );\n }\n}\n\nfunction createRemoteUiElementConstructor(\n definition: RemoteDomUiComponentDefinition,\n): CustomElementConstructor {\n const properties = Object.fromEntries(\n Object.keys(definition.properties).map((propertyName) => [\n propertyName,\n { attribute: false },\n ]),\n );\n const events = createRemoteEventDefinitions(\n definition.events.map(({ eventName }) => eventName),\n );\n return createRemoteElement<\n Record<string, RemoteDomSerializableValue | undefined>,\n NoRemoteMembers,\n NoRemoteMembers,\n RemoteEventListeners\n >({ events, properties });\n}\n\nfunction defineRemoteElement(\n tagName: string,\n constructor: CustomElementConstructor,\n): void {\n if (customElements.get(tagName)) return;\n customElements.define(tagName, constructor);\n}\n\nfunction createRemoteEventDefinitions(\n eventNames: readonly string[],\n): Readonly<Record<string, RemoteElementEventListenerDefinition>> {\n return Object.fromEntries(\n eventNames.map((eventName) => [\n eventName,\n {\n bubbles: true,\n dispatchEvent(this: Element, payload?: unknown) {\n const detail = readHostEventDetail(payload);\n if (\n this instanceof FluidRemoteInputElement &&\n isObjectRecord(detail)\n ) {\n this.applyHostState(detail);\n }\n return createRemoteDomReactEvent(eventName, detail);\n },\n },\n ]),\n );\n}\n\nfunction readHostEventDetail(\n payload: unknown,\n): RemoteDomSerializableValue | undefined {\n if (isObjectRecord(payload) && isRemoteDomSerializableValue(payload.detail)) {\n return payload.detail;\n }\n return isRemoteDomSerializableValue(payload) ? payload : undefined;\n}\n\nfunction createRemoteDomReactEvent(\n eventName: string,\n detail: RemoteDomSerializableValue | undefined,\n): Event {\n const customDetail = parseCustomEventDetail(eventName, detail);\n const event = new CustomEvent(eventName, {\n bubbles: true,\n cancelable: true,\n detail: customDetail.ok ? customDetail.value : detail,\n });\n if (!isObjectRecord(detail)) return event;\n\n const key = readSerializableString(detail, \"key\");\n if (key !== undefined) setObjectProperty(event, \"key\", key);\n\n const eventType = readSerializableString(detail, \"type\");\n if (eventType !== undefined) setObjectProperty(event, \"inputType\", eventType);\n\n return event;\n}\n\nfunction parseCustomEventDetail(\n _eventName: string,\n detail: RemoteDomSerializableValue | undefined,\n):\n | { readonly ok: true; readonly value: RemoteDomSerializableValue }\n | { readonly ok: false } {\n if (!isObjectRecord(detail)) {\n return { ok: false };\n }\n const detailJson = detail.detailJson;\n if (typeof detailJson !== \"string\") return { ok: false };\n\n try {\n const value: unknown = JSON.parse(detailJson);\n return isRemoteDomSerializableValue(value)\n ? { ok: true, value }\n : { ok: false };\n } catch {\n return { ok: false };\n }\n}\n\nfunction readSerializableString(\n detail: Readonly<Record<string, unknown>>,\n key: string,\n): string | undefined {\n const value = detail[key];\n return typeof value === \"string\" ? value : undefined;\n}\n\nfunction setObjectProperty(target: object, key: string, value: unknown): void {\n Object.defineProperty(target, key, {\n configurable: true,\n enumerable: true,\n value,\n writable: true,\n });\n}\n\nfunction isObjectRecord(\n value: unknown,\n): value is Readonly<Record<string, unknown>> {\n return typeof value === \"object\" && value !== null && !Array.isArray(value);\n}\n"],"mappings":";;;;;;AAoCA,MAAM,uBAAuB;AAK7B,MAAM,2BAA2B,6BAC/BA,0BAAAA,4BACD;AACD,MAAM,sBAAA,GAAA,0BAAA,qBAKJ,EAAE,QAAQ,0BAA0B,CAAC;AAQvC,MAAM,sBAAA,GAAA,0BAAA,qBAKJ;CACA,QAAQ;CACR,YAAY;EACV,SAAS;GAAE,WAAW;GAAO,SAAS;GAAO;EAC7C,MAAM;GAAE,WAAW;GAAM,SAAS;GAAQ;EAC1C,OAAO;GAAE,WAAW;GAAO,SAAS;GAAI;EACzC;CACF,CAAC;AAEF,IAAM,0BAAN,cAAsC,mBAAmB;CACvD,eAAe,QAAiD;EAI9D,MAAM,QAAQ,uBAAuB,QAAQ,QAAQ;AACrD,MAAI,UAAU,KAAA,EAAW,MAAK,qBAAqB,SAAS,MAAM;EAElE,MAAM,UAAU,OAAO;AACvB,MAAI,OAAO,YAAY,UACrB,MAAK,qBAAqB,WAAW,QAAQ;;;AAKnD,IAAI,2BAA2B;AAE/B,SAAgB,mCAAmC,EACjD,cACoE;AACpE,yBAAwB;CAExB,MAAM,aAAa,SAAS,cAC1B,qBACD;CACD,MAAM,oBAAoB,IAAIC,0BAAAA,yBAAyB,WAAW;AAClE,YAAW,QAAQ,kBAAkB;CACrC,MAAM,aAAA,GAAA,iBAAA,YAA6B,WAAW;AAI9C,KAAI;AACF,WAAS,KAAK,OAAO,WAAW;UACzB,OAAO;AACd,YAAU,SAAS;AACnB,QAAM;;CAER,IAAI,WAAW;AAEf,QAAO;EACL,OAAO,MAAM;AACX,IAAA,GAAA,UAAA,iBAAgB;AACd,cAAU,OAAO,KAAK;KACtB;AAGF,qBAAkB,OAAO;;EAE3B,UAAU;AACR,OAAI,SAAU;AACd,cAAW;GACX,MAAM,gBAA2B,EAAE;A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A,UAAU;EACX,CAAC;;AAGJ,SAAS,eACP,OAC4C;AAC5C,QAAO,OAAO,UAAU,YAAY,UAAU,QAAQ,CAAC,MAAM,QAAQ,MAAM"}
|
package/dist/worker.cjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
require("./remote-dom-renderer-
|
|
2
|
+
require("./remote-dom-renderer-BlZKfMAA.cjs");
|
|
3
3
|
const require_Thread = require("./Thread-0eUyc0Hw.cjs");
|
|
4
|
-
const require_remote_dom_values = require("./remote-dom-values-
|
|
4
|
+
const require_remote_dom_values = require("./remote-dom-values-B5UZPDRy.cjs");
|
|
5
5
|
let react = require("react");
|
|
6
6
|
//#region src/worker-lockdown.ts
|
|
7
7
|
const DISALLOWED_GLOBAL_NAMES = [
|
|
@@ -246,9 +246,22 @@ function useRemoteDomCapability(name) {
|
|
|
246
246
|
return callCapability(name, method, payload);
|
|
247
247
|
} }), [callCapability, name]);
|
|
248
248
|
}
|
|
249
|
+
/**
|
|
250
|
+
* Starts a worker that serves the supplied Remote DOM widget components.
|
|
251
|
+
*
|
|
252
|
+
* The selected host must support the worker's Fluid UI contract before the
|
|
253
|
+
* component mounts. Portal SDK hosts configure this support automatically.
|
|
254
|
+
*/
|
|
249
255
|
function startRemoteDomWidgetWorker(options) {
|
|
250
256
|
return startRemoteDomWidgetWorkerInternal(options);
|
|
251
257
|
}
|
|
258
|
+
/**
|
|
259
|
+
* Preserves the worker's native fetch implementation before Remote DOM
|
|
260
|
+
* polyfills install browser-like globals.
|
|
261
|
+
*
|
|
262
|
+
* Call this before loading the React worker bootstrap. Widget packages created
|
|
263
|
+
* by the Fluid tooling already call it in the generated worker entry.
|
|
264
|
+
*/
|
|
252
265
|
function prepareRemoteDomWidgetWorker() {
|
|
253
266
|
prepareRemoteDomWorkerNetworkAccess();
|
|
254
267
|
}
|
|
@@ -334,6 +347,7 @@ function startRemoteDomWidgetWorkerInternal(options, testEnvironment) {
|
|
|
334
347
|
if (mounted || renderer || host) throw new Error("Remote DOM widget worker is already mounted.");
|
|
335
348
|
if (init.widgetType.length === 0) throw new Error("Remote DOM widget type cannot be empty.");
|
|
336
349
|
if (!require_remote_dom_values.isRemoteDomSerializableValue(init.props)) throw new Error("Remote DOM widget props must be serializable.");
|
|
350
|
+
if (!init.supportedUiContractVersions?.includes("2")) throw new Error(`Remote DOM widget requires Fluid UI contract 2, which this host does not support.`);
|
|
337
351
|
const selectedEntry = options.widgets[init.widgetType];
|
|
338
352
|
if (!selectedEntry) throw new Error(`Remote DOM worker does not contain widget type ${init.widgetType}.`);
|
|
339
353
|
const selectedWidget = normalizeWidgetEntry(selectedEntry);
|
|
@@ -429,7 +443,7 @@ function assertWorkerActive(disposed) {
|
|
|
429
443
|
function loadRemoteDomWorkerReactRendererModule() {
|
|
430
444
|
if (!remoteDomReactWorkerRendererModulePromise) remoteDomReactWorkerRendererModulePromise = (async () => {
|
|
431
445
|
await Promise.resolve().then(() => require("./worker-react-bootstrap-N8jcWZ3L.cjs"));
|
|
432
|
-
return Promise.resolve().then(() => require("./worker-react-renderer-
|
|
446
|
+
return Promise.resolve().then(() => require("./worker-react-renderer-CR-TvErh.cjs"));
|
|
433
447
|
})().catch((error) => {
|
|
434
448
|
remoteDomReactWorkerRendererModulePromise = void 0;
|
|
435
449
|
throw error;
|
|
@@ -482,6 +496,7 @@ function isObjectRecord(value) {
|
|
|
482
496
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
483
497
|
}
|
|
484
498
|
//#endregion
|
|
499
|
+
exports.REMOTE_DOM_UI_COMPONENTS = require_remote_dom_values.REMOTE_DOM_UI_COMPONENTS;
|
|
485
500
|
exports.RemoteDomCapabilityFunctionError = RemoteDomCapabilityFunctionError;
|
|
486
501
|
exports.defineRemoteDomCapabilityFunction = defineRemoteDomCapabilityFunction;
|
|
487
502
|
exports.getRemoteDomCapabilityFunctionMetadata = getRemoteDomCapabilityFunctionMetadata;
|