@shadow-js/web/extend
The 32 exports of @shadow-js/web/extend: 19 functions, 6 interfaces, 1 type and 6 consts.
Everything @shadow-js/web/extend exports, from the TSDoc of its entry point.
Functions#
bindRegion: Keeps a region in sync withvalue.childScope: Creates a fresh scope for an isolated part of the tree, such as a Suspense boundary's content or fallback, or a portal's content: its keys depend only onkey, not on the siblings around it.claimElement: Adopts the server's element for a hydration key whilehydrate()runs: the step that lets a custom template reuse server markup instead of creating new nodes.claimPortal: Adopts the server block of a portal whilehydrate()runs.createRegion: Creates the state of a region inparent.createRootScope: Creates the scope a render or a hydration starts from: whatrenderToStringandhydrate()put in effect around the app.currentScope: Returns the hydration scope in effect.element: Creates one HTML element from a tag name and a props object, without the generic prop runtime ofspreadandDynamic: for a library that renders one fixed element (a link, a button) and wants to pay only for what it binds.enterComponent: Runs a component call in a scope of its own, so the keys it draws depend only on its position among its parent's calls: whatcreateComponentdoes on the client and on the server.isClaiming: Reports whether ahydrate()pass is claiming server DOM right now: a custom renderer reads it to decide between adopting server nodes and building fresh ones.isUnsafeUrlAttribute: Reports whether writingvalueto the attributenamewould run script: the URL check that setAttribute, the head registry and the server renderer share.nextKey: Draws the key of the next template root in the current scope: whattemplate()andssrHydrationKey()call, in the same order on the server and the client.reconcileNodes: Updates one region ofparent's children from the nodesprevto the nodesnext, keeping every node that stays and moving as few as possible: the list reconciliationinsertperforms for arrays (and so forFor).removeRegion: Removes a region's nodes from its parent.resourceKey: Returns the key a resource's value is stored under in the server data, the same on the server and the client: the explicit key when there is one, else one drawn from the current scope.takeRegion: Adopts the server content of the next region of a claimed parent whilehydrate()runs: the nodes that sat between the region's markers are put back beforeanchorNodeand returned, so a custom region can bind to them instead of inserting new nodes.warnOnce: Prints a development warning as[shadow CODE] detail, at most once per code for the life of the page or process (the same pattern as core'swarn): for a custom renderer that refuses a value the way the built-in ones do.withoutClaiming: Runsfnwith claiming switched off, so the templates it builds are created fresh instead of claimed from the server markup.withScope: Runsfnwithscopein effect, so the keysfndraws come from it.
Interfaces#
Claims: The claiming half of hydration, as a hook.HydrationScope: A hydration scope: the deterministic source of hydration keys shared by the server renderer and the client hydrator.PortalSink: Receives the markup of the portals a server render produces: what PortalContext provides when the render was given aportalscollector.Region: State of one dynamic child region.StreamBoundary: A Suspense boundary whose content was not ready when the shell rendered:renderToStreamcallsrebuildagain each time a resource settles, and streams the markup once it is complete.StreamSink: Receives the boundaries that are still pending during a streaming render: what StreamContext provides.
Types#
WebWarningCode: The diagnostic codes of the DOM runtime:UNSAFE_URL_BLOCKED(a URL attribute that would run script was not written),INVALID_ATTRIBUTE_NAME(a name that cannot appear in markup) andDUPLICATE_CLASS_ATTRIBUTE(one element carriesclassandclassName, so the parser drops one).
Constants#
claims: The claims in effect.HTML_NS: The XHTML namespace URI: thenamespaceURIof ordinary HTML elements.MATHML_NS: The MathML namespace URI, forcreateElementNSandnamespaceURIchecks.PortalContext: The context through which a server render hands portals their collector: the renderers provide it when they are given aportalsoption (seecreateServerPortals).StreamContext: The context through whichrenderToStreamlets a Suspense-like boundary defer its content: a boundary that is pending in the shell renders its fallback between<!--[b:ID-->and<!--]-->and defers a StreamBoundary to the sink.SVG_NS: The SVG namespace URI, forcreateElementNSandnamespaceURIchecks.