/** * Copyright 2026 Adobe. All rights reserved. * This file is licensed to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. You may obtain a copy * of the License at http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software distributed under * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS * OF ANY KIND, either express or implied. See the License for the specific language * governing permissions and limitations under the License. */ /** * Whether dev-mode validation is active: `false` in production builds and in * non-browser (SSR) environments, otherwise mirrors `window.__swc.DEBUG`. * * Use this to guard the *call site* of a warning whose condition or message is * expensive to compute (for example a DOM traversal), so that work is skipped * entirely when validation is off: * * ```ts * if (isDebug()) { * this.warnAboutExpensiveThing(); // only traverses the DOM when validation runs * } * ``` * * For cheap conditions, call `warnIf`/`validateEnum` directly; they already * gate internally. This helper exists only to avoid paying call-site argument * cost in the expensive cases. It checks `process.env.NODE_ENV` first so a * bundler can dead-code-eliminate the guarded block in production, matching the * other helpers in this file, and short-circuits when `window` is undefined so * it is safe to call during server-side rendering. */ export declare function isDebug(): boolean; /** * Warns when `value` is not one of `valid`. Covers union-type/enum property * validation (e.g. `variant`, `size`). * * @param element - The component instance the warning is attributed to. * @param check - The enum check to perform. * @param check.prop - The property name, for the warning message. * @param check.value - The value received. * @param check.valid - The allowed values. * @param check.url - Documentation URL for the component. * @param check.options - Passed through to `window.__swc.warn`. */ export declare function validateEnum(element: HTMLElement, { prop, value, valid, url, options, }: { prop: string; value: string; valid: readonly T[]; url: string; options?: SWCWarningOptions; }): void; /** * Warns when `condition` is true. The general-purpose validation primitive: * covers required properties, conditionally required properties, mutually * exclusive/no-effect property combinations, and any component-specific * quirk that doesn't fit the other helpers here. * * @param element - The component instance the warning is attributed to. * @param condition - Warn when this is true. * @param message - The warning message. * @param url - Documentation URL for the component. * @param options - Passed through to `window.__swc.warn`. */ export declare function warnIf(element: HTMLElement, condition: boolean, message: string, url: string, options?: SWCWarningOptions): void; /** * Warns when a slot has no assigned nodes. Covers required-slot validation. * * @param element - The component instance the warning is attributed to. * @param slot - The slot element to check (`null`/`undefined` counts as empty). * @param slotName - The slot's `name` attribute (or `"default"`), for the message. * @param url - Documentation URL for the component. * @param options - Passed through to `window.__swc.warn`. */ export declare function validateRequiredSlot(element: HTMLElement, slot: HTMLSlotElement | null | undefined, slotName: string, url: string, options?: SWCWarningOptions): void; /** * Warns for each assigned element in `slot` whose tag name is not in * `allowedTagNames`. Covers allowed-children slot validation (e.g. a heading * slot that only accepts `

`-`

`). * * @param element - The component instance the warning is attributed to. * @param slot - The slot element to check. * @param allowedTagNames - Allowed tag names (case-insensitive, e.g. `['h2', 'h3']`). * @param slotName - The slot's `name` attribute (or `"default"`), for the message. * @param url - Documentation URL for the component. * @param options - Passed through to `window.__swc.warn`. */ export declare function validateAllowedChildren(element: HTMLElement, slot: HTMLSlotElement | null | undefined, allowedTagNames: readonly string[], slotName: string, url: string, options?: SWCWarningOptions): void;