@shadow-js/web
The 119 exports of @shadow-js/web: 36 functions, 35 interfaces, 27 types, 20 components and 1 namespace.
Everything @shadow-js/web exports, from the TSDoc of its entry point.
Functions#
addEventListener: Binds an event handler to an element: the helper compiled templates call foronXand theon:andoncapture:prefixes.anchor: Creates a text anchor: an empty Text node placed beforebefore(appended when null).autoFocus: Focuses an element written withautoFocus(React parity) once it is inserted into the document by a client render or update.chainEvents: Combines several handlers for one event name on one element into one handler that calls them in order with the same event.classList: Toggles individual classes from an object: the helper compiled templates call forclassList.className: Replaces the wholeclassof an element: the helper compiled templates call forclassandclassName.clearDelegatedEvents: Removes the delegated listeners delegateEvents installed ontarget.createComponent: Calls a component untracked, under a new owner that is a child of the current one: cleanups and effects it creates are disposed with the enclosing scope.createDynamic: Function form of Dynamic, for code that is not JSX: renders whatcomponent()returns (a component, a tag name or a falsy value) withprops, and follows it when it changes.delegateEvents: Installs the document listener that runs delegated handlers for each event name, once per document and name; repeated calls do nothing.derived: Wraps a computation as a Derived value that recomputes only when the signals it reads change.effect: Runsfnas a render effect: synchronously when created, and again when the signals it reads change.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.hydrate: Attaches the application to HTML the server already rendered intocontainer.insert: Reactive child insertion: keeps the content of a region in sync withvalue.lazy: Defines a component whose code is loaded on first render.memo: Creates a cached derivation that recomputes only when the signals it reads change.preconnect: Tells the browser to open a connection (DNS, TCP, TLS) to an origin the page will use soon.prefetchDNS: Resolves an origin's DNS ahead of use.preinit: Loads a stylesheet or script now, and keeps it applied or executed (React'spreinit).preinitModule: Loads and runs an ES module now (React'spreinitModule).preload: Starts fetching a resource the page will need, at high priority.preloadModule: Starts loading an ES module the page will import, so the import does not wait for the module graph to be discovered.refTo: Fills a ref of any form the compiler accepts.render: Mountscodeintocontainer.setAttribute: Sets or removes one attribute with the JSX value rules: the helper compiled templates call for a dynamic attribute, also usable on elements you create yourself.setAttributeNS: Sets or removes a namespaced attribute such asxlink:hreforxml:lang, with the value rules and the URL check of setAttribute.setBoolAttribute: Sets or removes a presence (boolean) attribute such asdisabledorhidden: the helper compiled templates call for thebool:prefix.setSelectValue: Selects the options avaluestands for.setStyleProperty: Sets or removes one inline style property: the helper compiled templates call for thestyle:prefix.spread: Applies a whole props object to an element and keeps it in sync: the helper compiled JSX calls for{...props}on an element.startViewTransition: Runsupdateinside a browser view transition, so the change animates from the old screen to the new one, and resolves when the animation has finished.style: Sets the inline style of an element: the helper compiled templates call for astyleattribute.template: Turns a static HTML string into a factory of fresh DOM copies: the helper compiled JSX uses for the static part of every element tree.use: Applies a directive: callsfn(el, arg)untracked, so a directive or a ref never subscribes the surrounding effect to what it reads.useHead: Registers head tags for the lifetime of the current owner.
Interfaces#
ActivityProps: Props of Activity.AriaAttributes: The ARIA attributes.ClientOnlyProps: Props of ClientOnly.CrossOriginOptions: Options of preconnect, preloadModule and preinitModule.CustomEvents: The app's custom events, by name, for theon:andoncapture:prefixes: declaration-merge it soon:toast={...}receives a typed event.Derived: A value the compiler keeps live: the result ofconst x = <expression reading signals>inside a component.Directives: The app's directives, by name, typed by their argument: declaration-merge it souse:name={argument}checks the argument.DynamicProps: Props of Dynamic:componentplus the props of whatever it renders.ErrorBoundaryLooseProps: ErrorBoundaryProps with untyped members, for code that forwards a fallback or children it does not know the shape of.ErrorBoundaryProps: Props of ErrorBoundary.ForKeyedProps: Props of For withkey: rows are matched bykey(item).ForUnkeyedProps: Props of For withoutkey: rows are matched by item reference.FragmentProps: Props of Fragment.HeadAttributeProps: Props of Meta, Link and Base: every prop is an attribute, and a function value is read reactively.HeadTag: Describes one head element.HTMLIntrinsicElements: Attribute maps for every HTML element the DOM library types, keyed by tag name.HydrateOptions: Options of hydrate: the server render it continues, the root's owner, and the error reporters it inherits fromRootErrorOptions(onUncaughtError,onCaughtError,onRecoverableError).IndexProps: Props of Index.LazyComponent: A component made by lazy: call it (or write it in JSX) like any component, and usepreloadto start the load early.ListenerObject: A DOM-style listener object:handleEventplus theaddEventListeneroptions.MatchProps: Props of Match.MathMLIntrinsicElements: Attribute maps for every MathML element, keyed by the MathML tag name.NoHydrationProps: Props of NoHydration.PortalProps: Props of Portal.PreinitOptions: Options of preinit.PreloadOptions: Options of preload: the destination is required, as the browser needs it to pick the right request.ShowLooseProps: The same props with untypedchildren, for code that forwards children it does not know the shape of (a wrapper component's ownprops.children).StyleProps: Props of Style: the CSS text and an optional key that replaces an earlier style with the same key.SuspenseListProps: Props of SuspenseList.SuspenseProps: Props of Suspense.SVGIntrinsicElements: Attribute maps for every SVG element, keyed by the SVG tag name.SwitchProps: Props of Switch.TitleProps: Props of Title.ViewTransitionOptions: Options of startViewTransition.ViewTransitionProps: Props of ViewTransition.
Types#
ActivityMode:visibleshows the children;hiddenkeeps them alive (state, DOM and focus) but out of sight.AriaRole: Every ARIA role of WAI-ARIA 1.2 (plusgenericandsearch, which later ARIA versions use).Booleanish: Booleans written either astrue/falseor as the strings the DOM enumerates: the value type of enumerated attributes such asdraggable,spellcheckand thearia-*flags.BoundEventHandler: Handler and data as a tuple:[(data, event) => void, data].ClassValue: A class value in the clsx style the runtime understands: strings, numbers (0 is dropped), booleans, nested arrays and objects whose truthy keys become class names.Component: A component: a function from props to a JSX element.ComponentProps: The props type of a component, or of an intrinsic element tag name: use it to wrap or forward the props of an element or another component.CSSProperties: Inline style declarations forstyle={...}: every standard CSS property in camelCase or in kebab-case (derived from the DOM library'sCSSStyleProperties, so it tracks the platform), plus CSS custom properties (--name).CustomElementProps: Props of a custom element (a tag name with a hyphen).EventHandler: A plain event handler.EventHandlerProp: What an event attribute accepts: a plain handler, a[handler, data]tuple, or a listener object.FlowComponent: A component that requires children of typeC, such asShow(children are the content it shows) or aForcallback.ForProps: Props of For.HeadAttributeValue: One attribute value: a string is written as is,trueas an empty attribute,falseandundefinedomit it, and a number is written as text.HeadInput: What useHead accepts: one tag, several tags, or nothing (which registers nothing).HeadTagName: Head elements the registry manages.IntrinsicElementMap: The map behindJSX.IntrinsicElements: every element by tag name, plus custom elements matched by the${string}-${string}pattern.JsxChild: Everything a JSX expression can produce or a child can be: DOM nodes, text, numbers, booleans, nothing, accessors (() => child, re-run when their dependencies change) and nested arrays.Maybe: A value that may be absent at runtime.MaybeAccessor: A value or an accessor returning it.ParentComponent: A component that takes optional children, such as aCardor aLayout.ParentProps: Props of a component that takes optional children: addschildren?: JsxChildtoP.ShowProps: Props of Show.TextChild: Children of elements whose content is text only:textarea,option,script,style.ValidComponent: Anything that can be used as a JSX tag: an intrinsic element name or a component function.VoidComponent: A component that takes no children.VoidProps: Props of a component that takes no children: passingchildrenis a type error.
components#
Activity: Keeps its children alive while hidden:mode="hidden"removes them from sight but keeps their state, their DOM nodes and their focus and scroll position.Base: Registers the document<base>.ClientOnly: Renderschildrenin the browser only.Dynamic: Renders a component function or an element chosen by a tag name, and re-renders whencomponentchanges.ErrorBoundary: Renderschildren.For: Renders one row per item.Fragment: A no-op wrapper: returnsprops.childrenuntouched, so the children are created by the caller's getter exactly as if no wrapper existed.Index: Renders one row per position.Link: Registers a<link>.Match: Describes one branch of a Switch.Meta: Registers a<meta>.NoHydration: Content the browser never hydrates: the server renders it without hydration keys, and while the page hydrates the browser leaves that markup exactly as it is (no code runs for it, no event handlers or reactivity are attached).Portal: Renderschildreninto another part of the document, without a wrapper: the content nodes are inserted directly into the mount element (or its shadow root).Show: Showschildrenwhilewhenis truthy, andfallbackotherwise.Style: Registers a<style>with the given CSS text.Suspense: Showsfallbackwhile resources read inside it are loading for the first time.SuspenseList: Coordinates the<Suspense>boundaries below it so a page of independent loads reveals in a calm order instead of popping in at random.Switch: Shows the first Match whosewhenis truthy, or the fallback when none is.Title: Sets the document title.ViewTransition: Gives the first element of its children a view transition name and class, so the browser animates that element between the old and the new screen: it enters (an element that appears with the name), exits (one that disappears), updates (the same name with new content) and shares (the same name on both screens, moved or resized).
namespaces#
JSX: The JSX namespace TypeScript reads throughjsxImportSource.