@radix-ui/primitive 1.2.1-rc.1796411593667 → 1.2.1

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/dist/index.js.map CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../src/index.ts", "../src/can-use-dom.ts", "../src/primitive.tsx", "../src/aria-hidden.ts"],
4
- "sourcesContent": ["export * from './primitive';\nexport * from './can-use-dom';\nexport * from './aria-hidden';\nexport type * from './types';\n", "/* oxlint-disable no-restricted-globals */\nexport const canUseDOM = !!(\n typeof window !== 'undefined' &&\n window.document &&\n window.document.createElement\n);\n", "/* oxlint-disable no-restricted-properties */\nimport { canUseDOM } from './can-use-dom';\n\nexport function composeEventHandlers<E extends { defaultPrevented: boolean }>(\n originalEventHandler?: (event: E) => void,\n ourEventHandler?: (event: E) => void,\n { checkForDefaultPrevented = true }: { checkForDefaultPrevented?: boolean | undefined } = {},\n) {\n return function handleEvent(event: E) {\n originalEventHandler?.(event);\n\n if (checkForDefaultPrevented === false || !event || !event.defaultPrevented) {\n return ourEventHandler?.(event);\n }\n };\n}\n\nexport function getOwnerWindow(element: Node | null | undefined) {\n if (!canUseDOM) {\n throw new Error('Cannot access window outside of the DOM');\n }\n // oxlint-disable-next-line no-restricted-globals\n return element?.ownerDocument?.defaultView ?? window;\n}\n\nexport function getOwnerDocument(element: Node | null | undefined) {\n if (!canUseDOM) {\n throw new Error('Cannot access document outside of the DOM');\n }\n // oxlint-disable-next-line no-restricted-globals\n return element?.ownerDocument ?? document;\n}\n\n/**\n * Lifted from https://github.com/ariakit/ariakit/blob/main/packages/ariakit-core/src/utils/dom.ts#L37\n * MIT License, Copyright (c) AriaKit.\n */\nexport function getActiveElement(\n node: Node | null | undefined,\n activeDescendant = false,\n): HTMLElement | null {\n const { activeElement } = getOwnerDocument(node);\n if (!activeElement?.nodeName) {\n // `activeElement` might be an empty object if we're interacting with elements\n // inside of an iframe.\n return null;\n }\n\n if (isFrame(activeElement) && activeElement.contentDocument) {\n return getActiveElement(activeElement.contentDocument.body, activeDescendant);\n }\n\n if (activeDescendant) {\n const id = activeElement.getAttribute('aria-activedescendant');\n if (id) {\n const element = getOwnerDocument(activeElement).getElementById(id);\n if (element) {\n return element;\n }\n }\n }\n\n return activeElement as HTMLElement | null;\n}\n\nexport function isFrame(element: Element): element is HTMLIFrameElement {\n return element.tagName === 'IFRAME';\n}\n", "/**\n * Fork of `aria-hidden`\n *\n * MIT License\n * Copyright (c) 2017 Anton Korzunov\n */\n\nimport { IS_DEVELOPMENT } from '@radix-ui/env-check/is-development';\n\ntype Undo = () => void;\n\ntype DomParentNode = Element | ShadowRoot;\n\nlet counterMap = /* @__PURE__ */ new WeakMap<Element, number>();\nlet uncontrolledNodes = /* @__PURE__ */ new WeakMap<Element, boolean>();\nlet lockCount = /* @__PURE__ */ 0;\nconst markerMap = /* @__PURE__ */ new Map<string, WeakMap<Element, number>>();\n\n// Elements that are never rendered and are not in the accessibility tree, so\n// marking them is wasted work.\n//\n// See https://html.spec.whatwg.org/multipage/rendering.html#hidden-elements\nconst SKIPPED_ELEMENTS = new Set([\n //\n 'link',\n 'meta',\n 'noscript',\n 'script',\n 'style',\n 'template',\n]);\n\nfunction unwrapHost(node: DomParentNode): Element | null {\n return node && ((node as ShadowRoot).host || unwrapHost(node.parentNode as Element));\n}\n\nfunction correctTargets(parent: DomParentNode, targets: Set<Element>): Set<Element> {\n const correctedTargets = new Set<Element>();\n for (const target of targets) {\n if (parent.contains(target)) {\n correctedTargets.add(target);\n } else {\n const correctedTarget = unwrapHost(target);\n if (correctedTarget && parent.contains(correctedTarget)) {\n correctedTargets.add(correctedTarget);\n } else {\n if (IS_DEVELOPMENT) {\n console.error(\n 'aria-hidden',\n target,\n 'in not contained inside',\n parent,\n '. Doing nothing',\n );\n }\n }\n }\n }\n\n return correctedTargets;\n}\n\n/**\n * Marks everything except given node(or nodes) as aria-hidden\n * @param originalTargets - elements to keep on the page\n * @param parentNode - top element\n * @param markerName - a special attribute to mark every node\n * @param controlAttribute - html Attribute to control\n * @return undo command\n */\nfunction applyAttributeToOthers(\n originalTargets: Set<Element>,\n parentNode: DomParentNode,\n markerName: string,\n controlAttribute: string,\n): Undo {\n const targets = correctTargets(parentNode, originalTargets);\n\n // We should not hide aria-live elements\n //\n // See https://github.com/theKashey/aria-hidden/issues/10\n const additionalTargets = parentNode.querySelectorAll('[aria-live]');\n for (const target of additionalTargets) {\n targets.add(target);\n }\n\n let markerCounter = markerMap.get(markerName);\n if (!markerCounter) {\n markerCounter = new WeakMap();\n markerMap.set(markerName, markerCounter);\n }\n\n const hiddenNodes = new Set<Element>();\n const elementsToKeep = new Set<Node>();\n const elementsToStop = new Set<Node>(targets);\n\n targets.forEach(keep);\n deep(parentNode);\n elementsToKeep.clear();\n lockCount++;\n\n return () => {\n for (const node of hiddenNodes) {\n const counterValue = counterMap.get(node)! - 1;\n const markerValue = markerCounter.get(node)! - 1;\n\n counterMap.set(node, counterValue);\n markerCounter.set(node, markerValue);\n\n if (!counterValue) {\n if (!uncontrolledNodes.has(node)) {\n node.removeAttribute(controlAttribute);\n }\n\n uncontrolledNodes.delete(node);\n }\n\n if (!markerValue) {\n node.removeAttribute(markerName);\n }\n }\n\n lockCount--;\n\n if (!lockCount) {\n // clear\n counterMap = new WeakMap();\n uncontrolledNodes = new WeakMap();\n markerMap.clear();\n }\n };\n\n function keep(el: Node | undefined) {\n if (!el || elementsToKeep.has(el)) {\n return;\n }\n\n elementsToKeep.add(el);\n keep(el.parentNode!);\n }\n\n function deep(parent: DomParentNode | null) {\n if (!parent || elementsToStop.has(parent)) {\n return;\n }\n\n for (const node of parent.children) {\n if (SKIPPED_ELEMENTS.has(node.localName)) {\n continue;\n }\n\n if (elementsToKeep.has(node)) {\n deep(node);\n } else {\n try {\n const attr = node.getAttribute(controlAttribute);\n // `inert` is a boolean attribute, so `inert=\"false\"` is still inert\n const alreadyHidden =\n controlAttribute === 'inert' ? attr !== null : attr !== null && attr !== 'false';\n const counterValue = (counterMap.get(node) || 0) + 1;\n const markerValue = (markerCounter?.get(node) || 0) + 1;\n\n counterMap.set(node, counterValue);\n markerCounter?.set(node, markerValue);\n hiddenNodes.add(node);\n\n if (counterValue === 1 && alreadyHidden) {\n uncontrolledNodes.set(node, true);\n }\n\n if (markerValue === 1) {\n node.setAttribute(markerName, 'true');\n }\n\n if (!alreadyHidden) {\n node.setAttribute(controlAttribute, 'true');\n }\n } catch (e) {\n if (IS_DEVELOPMENT) {\n console.error('aria-hidden: cannot operate on ', node, e);\n }\n }\n }\n }\n }\n}\n\n/**\n * Marks everything except given nodes as aria-hidden\n *\n * @param originalTargets - elements to keep on the page\n * @param parentNode - top element\n * @param markerName - a special attribute to mark every node\n * @return undo command\n */\nfunction hideOthers(\n originalTargets: Set<Element>,\n parentNode: DomParentNode,\n markerName = 'data-aria-hidden',\n): Undo {\n return applyAttributeToOthers(originalTargets, parentNode, markerName, 'aria-hidden');\n}\n\n/**\n * Marks everything except given nodes as inert\n *\n * @param originalTargets - elements to keep on the page\n * @param parentNode - top element\n * @param markerName - a special attribute to mark every node\n * @return undo command\n */\nfunction inertOthers(\n originalTargets: Set<Element>,\n parentNode: DomParentNode,\n markerName = 'data-inert-ed',\n): Undo {\n return applyAttributeToOthers(originalTargets, parentNode, markerName, 'inert');\n}\n\nfunction supportsInert(): boolean {\n return typeof HTMLElement !== 'undefined' && HTMLElement.prototype.hasOwnProperty('inert');\n}\n\n/**\n * Automatic function to \"suppress\" DOM elements - _hide_ or _inert_ in the best\n * possible way.\n *\n * @param originalTargets - elements to keep on the page\n * @param parentNode - top element\n * @param markerName - a special attribute to mark every node\n * @return undo command\n */\nfunction suppressOthers(\n originalTargets: Set<Element>,\n parentNode: DomParentNode,\n markerName = 'data-suppressed',\n): Undo {\n return (supportsInert() ? inertOthers : hideOthers)(originalTargets, parentNode, markerName);\n}\n\nexport { hideOthers, inertOthers, supportsInert, suppressOthers };\nexport type { Undo };\n"],
4
+ "sourcesContent": ["export * from './primitive.js';\nexport * from './can-use-dom.js';\nexport * from './aria-hidden.js';\nexport type * from './types.js';\n", "/* oxlint-disable no-restricted-globals */\nexport const canUseDOM = !!(\n typeof window !== 'undefined' &&\n window.document &&\n window.document.createElement\n);\n", "/* oxlint-disable no-restricted-properties */\nimport { canUseDOM } from './can-use-dom.js';\n\nexport function composeEventHandlers<E extends { defaultPrevented: boolean }>(\n originalEventHandler?: (event: E) => void,\n ourEventHandler?: (event: E) => void,\n { checkForDefaultPrevented = true }: { checkForDefaultPrevented?: boolean | undefined } = {},\n) {\n return function handleEvent(event: E) {\n originalEventHandler?.(event);\n\n if (checkForDefaultPrevented === false || !event || !event.defaultPrevented) {\n return ourEventHandler?.(event);\n }\n };\n}\n\nexport function getOwnerWindow(element: Node | null | undefined) {\n if (!canUseDOM) {\n throw new Error('Cannot access window outside of the DOM');\n }\n // oxlint-disable-next-line no-restricted-globals\n return element?.ownerDocument?.defaultView ?? window;\n}\n\nexport function getOwnerDocument(element: Node | null | undefined) {\n if (!canUseDOM) {\n throw new Error('Cannot access document outside of the DOM');\n }\n // oxlint-disable-next-line no-restricted-globals\n return element?.ownerDocument ?? document;\n}\n\n/**\n * Lifted from https://github.com/ariakit/ariakit/blob/main/packages/ariakit-core/src/utils/dom.ts#L37\n * MIT License, Copyright (c) AriaKit.\n */\nexport function getActiveElement(\n node: Node | null | undefined,\n activeDescendant = false,\n): HTMLElement | null {\n const { activeElement } = getOwnerDocument(node);\n if (!activeElement?.nodeName) {\n // `activeElement` might be an empty object if we're interacting with elements\n // inside of an iframe.\n return null;\n }\n\n if (isFrame(activeElement) && activeElement.contentDocument) {\n return getActiveElement(activeElement.contentDocument.body, activeDescendant);\n }\n\n if (activeDescendant) {\n const id = activeElement.getAttribute('aria-activedescendant');\n if (id) {\n const element = getOwnerDocument(activeElement).getElementById(id);\n if (element) {\n return element;\n }\n }\n }\n\n return activeElement as HTMLElement | null;\n}\n\nexport function isFrame(element: Element): element is HTMLIFrameElement {\n return element.tagName === 'IFRAME';\n}\n", "/**\n * Fork of `aria-hidden`\n *\n * MIT License\n * Copyright (c) 2017 Anton Korzunov\n */\n\nimport { IS_DEVELOPMENT } from '@radix-ui/env-check/is-development';\n\ntype Undo = () => void;\n\ntype DomParentNode = Element | ShadowRoot;\n\nlet counterMap = /* @__PURE__ */ new WeakMap<Element, number>();\nlet uncontrolledNodes = /* @__PURE__ */ new WeakMap<Element, boolean>();\nlet lockCount = /* @__PURE__ */ 0;\nconst markerMap = /* @__PURE__ */ new Map<string, WeakMap<Element, number>>();\n\n// Elements that are never rendered and are not in the accessibility tree, so\n// marking them is wasted work.\n//\n// See https://html.spec.whatwg.org/multipage/rendering.html#hidden-elements\nconst SKIPPED_ELEMENTS = new Set([\n //\n 'link',\n 'meta',\n 'noscript',\n 'script',\n 'style',\n 'template',\n]);\n\nfunction unwrapHost(node: DomParentNode): Element | null {\n return node && ((node as ShadowRoot).host || unwrapHost(node.parentNode as Element));\n}\n\nfunction correctTargets(parent: DomParentNode, targets: Set<Element>): Set<Element> {\n const correctedTargets = new Set<Element>();\n for (const target of targets) {\n if (parent.contains(target)) {\n correctedTargets.add(target);\n } else {\n const correctedTarget = unwrapHost(target);\n if (correctedTarget && parent.contains(correctedTarget)) {\n correctedTargets.add(correctedTarget);\n } else {\n if (IS_DEVELOPMENT) {\n console.error(\n 'aria-hidden',\n target,\n 'in not contained inside',\n parent,\n '. Doing nothing',\n );\n }\n }\n }\n }\n\n return correctedTargets;\n}\n\n/**\n * Marks everything except given node(or nodes) as aria-hidden\n * @param originalTargets - elements to keep on the page\n * @param parentNode - top element\n * @param markerName - a special attribute to mark every node\n * @param controlAttribute - html Attribute to control\n * @return undo command\n */\nfunction applyAttributeToOthers(\n originalTargets: Set<Element>,\n parentNode: DomParentNode,\n markerName: string,\n controlAttribute: string,\n): Undo {\n const targets = correctTargets(parentNode, originalTargets);\n\n // We should not hide aria-live elements\n //\n // See https://github.com/theKashey/aria-hidden/issues/10\n const additionalTargets = parentNode.querySelectorAll('[aria-live]');\n for (const target of additionalTargets) {\n targets.add(target);\n }\n\n let markerCounter = markerMap.get(markerName);\n if (!markerCounter) {\n markerCounter = new WeakMap();\n markerMap.set(markerName, markerCounter);\n }\n\n const hiddenNodes = new Set<Element>();\n const elementsToKeep = new Set<Node>();\n const elementsToStop = new Set<Node>(targets);\n\n targets.forEach(keep);\n deep(parentNode);\n elementsToKeep.clear();\n lockCount++;\n\n return () => {\n for (const node of hiddenNodes) {\n const counterValue = counterMap.get(node)! - 1;\n const markerValue = markerCounter.get(node)! - 1;\n\n counterMap.set(node, counterValue);\n markerCounter.set(node, markerValue);\n\n if (!counterValue) {\n if (!uncontrolledNodes.has(node)) {\n node.removeAttribute(controlAttribute);\n }\n\n uncontrolledNodes.delete(node);\n }\n\n if (!markerValue) {\n node.removeAttribute(markerName);\n }\n }\n\n lockCount--;\n\n if (!lockCount) {\n // clear\n counterMap = new WeakMap();\n uncontrolledNodes = new WeakMap();\n markerMap.clear();\n }\n };\n\n function keep(el: Node | undefined) {\n if (!el || elementsToKeep.has(el)) {\n return;\n }\n\n elementsToKeep.add(el);\n keep(el.parentNode!);\n }\n\n function deep(parent: DomParentNode | null) {\n if (!parent || elementsToStop.has(parent)) {\n return;\n }\n\n for (const node of parent.children) {\n if (SKIPPED_ELEMENTS.has(node.localName)) {\n continue;\n }\n\n if (elementsToKeep.has(node)) {\n deep(node);\n } else {\n try {\n const attr = node.getAttribute(controlAttribute);\n // `inert` is a boolean attribute, so `inert=\"false\"` is still inert\n const alreadyHidden =\n controlAttribute === 'inert' ? attr !== null : attr !== null && attr !== 'false';\n const counterValue = (counterMap.get(node) || 0) + 1;\n const markerValue = (markerCounter?.get(node) || 0) + 1;\n\n counterMap.set(node, counterValue);\n markerCounter?.set(node, markerValue);\n hiddenNodes.add(node);\n\n if (counterValue === 1 && alreadyHidden) {\n uncontrolledNodes.set(node, true);\n }\n\n if (markerValue === 1) {\n node.setAttribute(markerName, 'true');\n }\n\n if (!alreadyHidden) {\n node.setAttribute(controlAttribute, 'true');\n }\n } catch (e) {\n if (IS_DEVELOPMENT) {\n console.error('aria-hidden: cannot operate on ', node, e);\n }\n }\n }\n }\n }\n}\n\n/**\n * Marks everything except given nodes as aria-hidden\n *\n * @param originalTargets - elements to keep on the page\n * @param parentNode - top element\n * @param markerName - a special attribute to mark every node\n * @return undo command\n */\nfunction hideOthers(\n originalTargets: Set<Element>,\n parentNode: DomParentNode,\n markerName = 'data-aria-hidden',\n): Undo {\n return applyAttributeToOthers(originalTargets, parentNode, markerName, 'aria-hidden');\n}\n\n/**\n * Marks everything except given nodes as inert\n *\n * @param originalTargets - elements to keep on the page\n * @param parentNode - top element\n * @param markerName - a special attribute to mark every node\n * @return undo command\n */\nfunction inertOthers(\n originalTargets: Set<Element>,\n parentNode: DomParentNode,\n markerName = 'data-inert-ed',\n): Undo {\n return applyAttributeToOthers(originalTargets, parentNode, markerName, 'inert');\n}\n\nfunction supportsInert(): boolean {\n return typeof HTMLElement !== 'undefined' && HTMLElement.prototype.hasOwnProperty('inert');\n}\n\n/**\n * Automatic function to \"suppress\" DOM elements - _hide_ or _inert_ in the best\n * possible way.\n *\n * @param originalTargets - elements to keep on the page\n * @param parentNode - top element\n * @param markerName - a special attribute to mark every node\n * @return undo command\n */\nfunction suppressOthers(\n originalTargets: Set<Element>,\n parentNode: DomParentNode,\n markerName = 'data-suppressed',\n): Undo {\n return (supportsInert() ? inertOthers : hideOthers)(originalTargets, parentNode, markerName);\n}\n\nexport { hideOthers, inertOthers, supportsInert, suppressOthers };\nexport type { Undo };\n"],
5
5
  "mappings": ";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACCO,IAAM,YAAY,CAAC,EACxB,OAAO,WAAW,eAClB,OAAO,YACP,OAAO,SAAS;;;ACDX,SAAS,qBACd,sBACA,iBACA,EAAE,2BAA2B,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,YAAY,MAAM;AAAA,UACtC;AAEA,cAAI,CAAC,eAAe;AAClB,iBAAK,aAAa,kBAAkB,MAAM;AAAA,UAC5C;AAAA,QACF,SAAS,GAAG;AACV,cAAI,sCAAgB;AAClB,oBAAQ,MAAM,mCAAmC,MAAM,CAAC;AAAA,UAC1D;AAAA,QACF;AAAA,MACF;AAAA,IACF;AAAA,EACF;AA3CS;AA4CX;AAnHS;AA6HT,SAAS,WACP,iBACA,YACA,aAAa,oBACP;AACN,SAAO,uBAAuB,iBAAiB,YAAY,YAAY,aAAa;AACtF;AANS;AAgBT,SAAS,YACP,iBACA,YACA,aAAa,iBACP;AACN,SAAO,uBAAuB,iBAAiB,YAAY,YAAY,OAAO;AAChF;AANS;AAQT,SAAS,gBAAyB;AAChC,SAAO,OAAO,gBAAgB,eAAe,YAAY,UAAU,eAAe,OAAO;AAC3F;AAFS;AAaT,SAAS,eACP,iBACA,YACA,aAAa,mBACP;AACN,UAAQ,cAAc,IAAI,cAAc,YAAY,iBAAiB,YAAY,UAAU;AAC7F;AANS;",
6
6
  "names": []
7
7
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../src/can-use-dom.ts", "../src/primitive.tsx", "../src/aria-hidden.ts"],
4
- "sourcesContent": ["/* oxlint-disable no-restricted-globals */\nexport const canUseDOM = !!(\n typeof window !== 'undefined' &&\n window.document &&\n window.document.createElement\n);\n", "/* oxlint-disable no-restricted-properties */\nimport { canUseDOM } from './can-use-dom';\n\nexport function composeEventHandlers<E extends { defaultPrevented: boolean }>(\n originalEventHandler?: (event: E) => void,\n ourEventHandler?: (event: E) => void,\n { checkForDefaultPrevented = true }: { checkForDefaultPrevented?: boolean | undefined } = {},\n) {\n return function handleEvent(event: E) {\n originalEventHandler?.(event);\n\n if (checkForDefaultPrevented === false || !event || !event.defaultPrevented) {\n return ourEventHandler?.(event);\n }\n };\n}\n\nexport function getOwnerWindow(element: Node | null | undefined) {\n if (!canUseDOM) {\n throw new Error('Cannot access window outside of the DOM');\n }\n // oxlint-disable-next-line no-restricted-globals\n return element?.ownerDocument?.defaultView ?? window;\n}\n\nexport function getOwnerDocument(element: Node | null | undefined) {\n if (!canUseDOM) {\n throw new Error('Cannot access document outside of the DOM');\n }\n // oxlint-disable-next-line no-restricted-globals\n return element?.ownerDocument ?? document;\n}\n\n/**\n * Lifted from https://github.com/ariakit/ariakit/blob/main/packages/ariakit-core/src/utils/dom.ts#L37\n * MIT License, Copyright (c) AriaKit.\n */\nexport function getActiveElement(\n node: Node | null | undefined,\n activeDescendant = false,\n): HTMLElement | null {\n const { activeElement } = getOwnerDocument(node);\n if (!activeElement?.nodeName) {\n // `activeElement` might be an empty object if we're interacting with elements\n // inside of an iframe.\n return null;\n }\n\n if (isFrame(activeElement) && activeElement.contentDocument) {\n return getActiveElement(activeElement.contentDocument.body, activeDescendant);\n }\n\n if (activeDescendant) {\n const id = activeElement.getAttribute('aria-activedescendant');\n if (id) {\n const element = getOwnerDocument(activeElement).getElementById(id);\n if (element) {\n return element;\n }\n }\n }\n\n return activeElement as HTMLElement | null;\n}\n\nexport function isFrame(element: Element): element is HTMLIFrameElement {\n return element.tagName === 'IFRAME';\n}\n", "/**\n * Fork of `aria-hidden`\n *\n * MIT License\n * Copyright (c) 2017 Anton Korzunov\n */\n\nimport { IS_DEVELOPMENT } from '@radix-ui/env-check/is-development';\n\ntype Undo = () => void;\n\ntype DomParentNode = Element | ShadowRoot;\n\nlet counterMap = /* @__PURE__ */ new WeakMap<Element, number>();\nlet uncontrolledNodes = /* @__PURE__ */ new WeakMap<Element, boolean>();\nlet lockCount = /* @__PURE__ */ 0;\nconst markerMap = /* @__PURE__ */ new Map<string, WeakMap<Element, number>>();\n\n// Elements that are never rendered and are not in the accessibility tree, so\n// marking them is wasted work.\n//\n// See https://html.spec.whatwg.org/multipage/rendering.html#hidden-elements\nconst SKIPPED_ELEMENTS = new Set([\n //\n 'link',\n 'meta',\n 'noscript',\n 'script',\n 'style',\n 'template',\n]);\n\nfunction unwrapHost(node: DomParentNode): Element | null {\n return node && ((node as ShadowRoot).host || unwrapHost(node.parentNode as Element));\n}\n\nfunction correctTargets(parent: DomParentNode, targets: Set<Element>): Set<Element> {\n const correctedTargets = new Set<Element>();\n for (const target of targets) {\n if (parent.contains(target)) {\n correctedTargets.add(target);\n } else {\n const correctedTarget = unwrapHost(target);\n if (correctedTarget && parent.contains(correctedTarget)) {\n correctedTargets.add(correctedTarget);\n } else {\n if (IS_DEVELOPMENT) {\n console.error(\n 'aria-hidden',\n target,\n 'in not contained inside',\n parent,\n '. Doing nothing',\n );\n }\n }\n }\n }\n\n return correctedTargets;\n}\n\n/**\n * Marks everything except given node(or nodes) as aria-hidden\n * @param originalTargets - elements to keep on the page\n * @param parentNode - top element\n * @param markerName - a special attribute to mark every node\n * @param controlAttribute - html Attribute to control\n * @return undo command\n */\nfunction applyAttributeToOthers(\n originalTargets: Set<Element>,\n parentNode: DomParentNode,\n markerName: string,\n controlAttribute: string,\n): Undo {\n const targets = correctTargets(parentNode, originalTargets);\n\n // We should not hide aria-live elements\n //\n // See https://github.com/theKashey/aria-hidden/issues/10\n const additionalTargets = parentNode.querySelectorAll('[aria-live]');\n for (const target of additionalTargets) {\n targets.add(target);\n }\n\n let markerCounter = markerMap.get(markerName);\n if (!markerCounter) {\n markerCounter = new WeakMap();\n markerMap.set(markerName, markerCounter);\n }\n\n const hiddenNodes = new Set<Element>();\n const elementsToKeep = new Set<Node>();\n const elementsToStop = new Set<Node>(targets);\n\n targets.forEach(keep);\n deep(parentNode);\n elementsToKeep.clear();\n lockCount++;\n\n return () => {\n for (const node of hiddenNodes) {\n const counterValue = counterMap.get(node)! - 1;\n const markerValue = markerCounter.get(node)! - 1;\n\n counterMap.set(node, counterValue);\n markerCounter.set(node, markerValue);\n\n if (!counterValue) {\n if (!uncontrolledNodes.has(node)) {\n node.removeAttribute(controlAttribute);\n }\n\n uncontrolledNodes.delete(node);\n }\n\n if (!markerValue) {\n node.removeAttribute(markerName);\n }\n }\n\n lockCount--;\n\n if (!lockCount) {\n // clear\n counterMap = new WeakMap();\n uncontrolledNodes = new WeakMap();\n markerMap.clear();\n }\n };\n\n function keep(el: Node | undefined) {\n if (!el || elementsToKeep.has(el)) {\n return;\n }\n\n elementsToKeep.add(el);\n keep(el.parentNode!);\n }\n\n function deep(parent: DomParentNode | null) {\n if (!parent || elementsToStop.has(parent)) {\n return;\n }\n\n for (const node of parent.children) {\n if (SKIPPED_ELEMENTS.has(node.localName)) {\n continue;\n }\n\n if (elementsToKeep.has(node)) {\n deep(node);\n } else {\n try {\n const attr = node.getAttribute(controlAttribute);\n // `inert` is a boolean attribute, so `inert=\"false\"` is still inert\n const alreadyHidden =\n controlAttribute === 'inert' ? attr !== null : attr !== null && attr !== 'false';\n const counterValue = (counterMap.get(node) || 0) + 1;\n const markerValue = (markerCounter?.get(node) || 0) + 1;\n\n counterMap.set(node, counterValue);\n markerCounter?.set(node, markerValue);\n hiddenNodes.add(node);\n\n if (counterValue === 1 && alreadyHidden) {\n uncontrolledNodes.set(node, true);\n }\n\n if (markerValue === 1) {\n node.setAttribute(markerName, 'true');\n }\n\n if (!alreadyHidden) {\n node.setAttribute(controlAttribute, 'true');\n }\n } catch (e) {\n if (IS_DEVELOPMENT) {\n console.error('aria-hidden: cannot operate on ', node, e);\n }\n }\n }\n }\n }\n}\n\n/**\n * Marks everything except given nodes as aria-hidden\n *\n * @param originalTargets - elements to keep on the page\n * @param parentNode - top element\n * @param markerName - a special attribute to mark every node\n * @return undo command\n */\nfunction hideOthers(\n originalTargets: Set<Element>,\n parentNode: DomParentNode,\n markerName = 'data-aria-hidden',\n): Undo {\n return applyAttributeToOthers(originalTargets, parentNode, markerName, 'aria-hidden');\n}\n\n/**\n * Marks everything except given nodes as inert\n *\n * @param originalTargets - elements to keep on the page\n * @param parentNode - top element\n * @param markerName - a special attribute to mark every node\n * @return undo command\n */\nfunction inertOthers(\n originalTargets: Set<Element>,\n parentNode: DomParentNode,\n markerName = 'data-inert-ed',\n): Undo {\n return applyAttributeToOthers(originalTargets, parentNode, markerName, 'inert');\n}\n\nfunction supportsInert(): boolean {\n return typeof HTMLElement !== 'undefined' && HTMLElement.prototype.hasOwnProperty('inert');\n}\n\n/**\n * Automatic function to \"suppress\" DOM elements - _hide_ or _inert_ in the best\n * possible way.\n *\n * @param originalTargets - elements to keep on the page\n * @param parentNode - top element\n * @param markerName - a special attribute to mark every node\n * @return undo command\n */\nfunction suppressOthers(\n originalTargets: Set<Element>,\n parentNode: DomParentNode,\n markerName = 'data-suppressed',\n): Undo {\n return (supportsInert() ? inertOthers : hideOthers)(originalTargets, parentNode, markerName);\n}\n\nexport { hideOthers, inertOthers, supportsInert, suppressOthers };\nexport type { Undo };\n"],
4
+ "sourcesContent": ["/* oxlint-disable no-restricted-globals */\nexport const canUseDOM = !!(\n typeof window !== 'undefined' &&\n window.document &&\n window.document.createElement\n);\n", "/* oxlint-disable no-restricted-properties */\nimport { canUseDOM } from './can-use-dom.js';\n\nexport function composeEventHandlers<E extends { defaultPrevented: boolean }>(\n originalEventHandler?: (event: E) => void,\n ourEventHandler?: (event: E) => void,\n { checkForDefaultPrevented = true }: { checkForDefaultPrevented?: boolean | undefined } = {},\n) {\n return function handleEvent(event: E) {\n originalEventHandler?.(event);\n\n if (checkForDefaultPrevented === false || !event || !event.defaultPrevented) {\n return ourEventHandler?.(event);\n }\n };\n}\n\nexport function getOwnerWindow(element: Node | null | undefined) {\n if (!canUseDOM) {\n throw new Error('Cannot access window outside of the DOM');\n }\n // oxlint-disable-next-line no-restricted-globals\n return element?.ownerDocument?.defaultView ?? window;\n}\n\nexport function getOwnerDocument(element: Node | null | undefined) {\n if (!canUseDOM) {\n throw new Error('Cannot access document outside of the DOM');\n }\n // oxlint-disable-next-line no-restricted-globals\n return element?.ownerDocument ?? document;\n}\n\n/**\n * Lifted from https://github.com/ariakit/ariakit/blob/main/packages/ariakit-core/src/utils/dom.ts#L37\n * MIT License, Copyright (c) AriaKit.\n */\nexport function getActiveElement(\n node: Node | null | undefined,\n activeDescendant = false,\n): HTMLElement | null {\n const { activeElement } = getOwnerDocument(node);\n if (!activeElement?.nodeName) {\n // `activeElement` might be an empty object if we're interacting with elements\n // inside of an iframe.\n return null;\n }\n\n if (isFrame(activeElement) && activeElement.contentDocument) {\n return getActiveElement(activeElement.contentDocument.body, activeDescendant);\n }\n\n if (activeDescendant) {\n const id = activeElement.getAttribute('aria-activedescendant');\n if (id) {\n const element = getOwnerDocument(activeElement).getElementById(id);\n if (element) {\n return element;\n }\n }\n }\n\n return activeElement as HTMLElement | null;\n}\n\nexport function isFrame(element: Element): element is HTMLIFrameElement {\n return element.tagName === 'IFRAME';\n}\n", "/**\n * Fork of `aria-hidden`\n *\n * MIT License\n * Copyright (c) 2017 Anton Korzunov\n */\n\nimport { IS_DEVELOPMENT } from '@radix-ui/env-check/is-development';\n\ntype Undo = () => void;\n\ntype DomParentNode = Element | ShadowRoot;\n\nlet counterMap = /* @__PURE__ */ new WeakMap<Element, number>();\nlet uncontrolledNodes = /* @__PURE__ */ new WeakMap<Element, boolean>();\nlet lockCount = /* @__PURE__ */ 0;\nconst markerMap = /* @__PURE__ */ new Map<string, WeakMap<Element, number>>();\n\n// Elements that are never rendered and are not in the accessibility tree, so\n// marking them is wasted work.\n//\n// See https://html.spec.whatwg.org/multipage/rendering.html#hidden-elements\nconst SKIPPED_ELEMENTS = new Set([\n //\n 'link',\n 'meta',\n 'noscript',\n 'script',\n 'style',\n 'template',\n]);\n\nfunction unwrapHost(node: DomParentNode): Element | null {\n return node && ((node as ShadowRoot).host || unwrapHost(node.parentNode as Element));\n}\n\nfunction correctTargets(parent: DomParentNode, targets: Set<Element>): Set<Element> {\n const correctedTargets = new Set<Element>();\n for (const target of targets) {\n if (parent.contains(target)) {\n correctedTargets.add(target);\n } else {\n const correctedTarget = unwrapHost(target);\n if (correctedTarget && parent.contains(correctedTarget)) {\n correctedTargets.add(correctedTarget);\n } else {\n if (IS_DEVELOPMENT) {\n console.error(\n 'aria-hidden',\n target,\n 'in not contained inside',\n parent,\n '. Doing nothing',\n );\n }\n }\n }\n }\n\n return correctedTargets;\n}\n\n/**\n * Marks everything except given node(or nodes) as aria-hidden\n * @param originalTargets - elements to keep on the page\n * @param parentNode - top element\n * @param markerName - a special attribute to mark every node\n * @param controlAttribute - html Attribute to control\n * @return undo command\n */\nfunction applyAttributeToOthers(\n originalTargets: Set<Element>,\n parentNode: DomParentNode,\n markerName: string,\n controlAttribute: string,\n): Undo {\n const targets = correctTargets(parentNode, originalTargets);\n\n // We should not hide aria-live elements\n //\n // See https://github.com/theKashey/aria-hidden/issues/10\n const additionalTargets = parentNode.querySelectorAll('[aria-live]');\n for (const target of additionalTargets) {\n targets.add(target);\n }\n\n let markerCounter = markerMap.get(markerName);\n if (!markerCounter) {\n markerCounter = new WeakMap();\n markerMap.set(markerName, markerCounter);\n }\n\n const hiddenNodes = new Set<Element>();\n const elementsToKeep = new Set<Node>();\n const elementsToStop = new Set<Node>(targets);\n\n targets.forEach(keep);\n deep(parentNode);\n elementsToKeep.clear();\n lockCount++;\n\n return () => {\n for (const node of hiddenNodes) {\n const counterValue = counterMap.get(node)! - 1;\n const markerValue = markerCounter.get(node)! - 1;\n\n counterMap.set(node, counterValue);\n markerCounter.set(node, markerValue);\n\n if (!counterValue) {\n if (!uncontrolledNodes.has(node)) {\n node.removeAttribute(controlAttribute);\n }\n\n uncontrolledNodes.delete(node);\n }\n\n if (!markerValue) {\n node.removeAttribute(markerName);\n }\n }\n\n lockCount--;\n\n if (!lockCount) {\n // clear\n counterMap = new WeakMap();\n uncontrolledNodes = new WeakMap();\n markerMap.clear();\n }\n };\n\n function keep(el: Node | undefined) {\n if (!el || elementsToKeep.has(el)) {\n return;\n }\n\n elementsToKeep.add(el);\n keep(el.parentNode!);\n }\n\n function deep(parent: DomParentNode | null) {\n if (!parent || elementsToStop.has(parent)) {\n return;\n }\n\n for (const node of parent.children) {\n if (SKIPPED_ELEMENTS.has(node.localName)) {\n continue;\n }\n\n if (elementsToKeep.has(node)) {\n deep(node);\n } else {\n try {\n const attr = node.getAttribute(controlAttribute);\n // `inert` is a boolean attribute, so `inert=\"false\"` is still inert\n const alreadyHidden =\n controlAttribute === 'inert' ? attr !== null : attr !== null && attr !== 'false';\n const counterValue = (counterMap.get(node) || 0) + 1;\n const markerValue = (markerCounter?.get(node) || 0) + 1;\n\n counterMap.set(node, counterValue);\n markerCounter?.set(node, markerValue);\n hiddenNodes.add(node);\n\n if (counterValue === 1 && alreadyHidden) {\n uncontrolledNodes.set(node, true);\n }\n\n if (markerValue === 1) {\n node.setAttribute(markerName, 'true');\n }\n\n if (!alreadyHidden) {\n node.setAttribute(controlAttribute, 'true');\n }\n } catch (e) {\n if (IS_DEVELOPMENT) {\n console.error('aria-hidden: cannot operate on ', node, e);\n }\n }\n }\n }\n }\n}\n\n/**\n * Marks everything except given nodes as aria-hidden\n *\n * @param originalTargets - elements to keep on the page\n * @param parentNode - top element\n * @param markerName - a special attribute to mark every node\n * @return undo command\n */\nfunction hideOthers(\n originalTargets: Set<Element>,\n parentNode: DomParentNode,\n markerName = 'data-aria-hidden',\n): Undo {\n return applyAttributeToOthers(originalTargets, parentNode, markerName, 'aria-hidden');\n}\n\n/**\n * Marks everything except given nodes as inert\n *\n * @param originalTargets - elements to keep on the page\n * @param parentNode - top element\n * @param markerName - a special attribute to mark every node\n * @return undo command\n */\nfunction inertOthers(\n originalTargets: Set<Element>,\n parentNode: DomParentNode,\n markerName = 'data-inert-ed',\n): Undo {\n return applyAttributeToOthers(originalTargets, parentNode, markerName, 'inert');\n}\n\nfunction supportsInert(): boolean {\n return typeof HTMLElement !== 'undefined' && HTMLElement.prototype.hasOwnProperty('inert');\n}\n\n/**\n * Automatic function to \"suppress\" DOM elements - _hide_ or _inert_ in the best\n * possible way.\n *\n * @param originalTargets - elements to keep on the page\n * @param parentNode - top element\n * @param markerName - a special attribute to mark every node\n * @return undo command\n */\nfunction suppressOthers(\n originalTargets: Set<Element>,\n parentNode: DomParentNode,\n markerName = 'data-suppressed',\n): Undo {\n return (supportsInert() ? inertOthers : hideOthers)(originalTargets, parentNode, markerName);\n}\n\nexport { hideOthers, inertOthers, supportsInert, suppressOthers };\nexport type { Undo };\n"],
5
5
  "mappings": ";;;;AACO,IAAM,YAAY,CAAC,EACxB,OAAO,WAAW,eAClB,OAAO,YACP,OAAO,SAAS;;;ACDX,SAAS,qBACd,sBACA,iBACA,EAAE,2BAA2B,KAAK,IAAwD,CAAC,GAC3F;AACA,SAAO,gCAAS,YAAY,OAAU;AACpC,2BAAuB,KAAK;AAE5B,QAAI,6BAA6B,SAAS,CAAC,SAAS,CAAC,MAAM,kBAAkB;AAC3E,aAAO,kBAAkB,KAAK;AAAA,IAChC;AAAA,EACF,GANO;AAOT;AAZgB;AAcT,SAAS,eAAe,SAAkC;AAC/D,MAAI,CAAC,WAAW;AACd,UAAM,IAAI,MAAM,yCAAyC;AAAA,EAC3D;AAEA,SAAO,SAAS,eAAe,eAAe;AAChD;AANgB;AAQT,SAAS,iBAAiB,SAAkC;AACjE,MAAI,CAAC,WAAW;AACd,UAAM,IAAI,MAAM,2CAA2C;AAAA,EAC7D;AAEA,SAAO,SAAS,iBAAiB;AACnC;AANgB;AAYT,SAAS,iBACd,MACA,mBAAmB,OACC;AACpB,QAAM,EAAE,cAAc,IAAI,iBAAiB,IAAI;AAC/C,MAAI,CAAC,eAAe,UAAU;AAG5B,WAAO;AAAA,EACT;AAEA,MAAI,QAAQ,aAAa,KAAK,cAAc,iBAAiB;AAC3D,WAAO,iBAAiB,cAAc,gBAAgB,MAAM,gBAAgB;AAAA,EAC9E;AAEA,MAAI,kBAAkB;AACpB,UAAM,KAAK,cAAc,aAAa,uBAAuB;AAC7D,QAAI,IAAI;AACN,YAAM,UAAU,iBAAiB,aAAa,EAAE,eAAe,EAAE;AACjE,UAAI,SAAS;AACX,eAAO;AAAA,MACT;AAAA,IACF;AAAA,EACF;AAEA,SAAO;AACT;AA1BgB;AA4BT,SAAS,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W,IAAI,IAAI,KAAK,KAAK;AACnD,gBAAM,eAAe,eAAe,IAAI,IAAI,KAAK,KAAK;AAEtD,qBAAW,IAAI,MAAM,YAAY;AACjC,yBAAe,IAAI,MAAM,WAAW;AACpC,sBAAY,IAAI,IAAI;AAEpB,cAAI,iBAAiB,KAAK,eAAe;AACvC,8BAAkB,IAAI,MAAM,IAAI;AAAA,UAClC;AAEA,cAAI,gBAAgB,GAAG;AACrB,iBAAK,aAAa,YAAY,MAAM;AAAA,UACtC;AAEA,cAAI,CAAC,eAAe;AAClB,iBAAK,aAAa,kBAAkB,MAAM;AAAA,UAC5C;AAAA,QACF,SAAS,GAAG;AACV,cAAI,gBAAgB;AAClB,oBAAQ,MAAM,mCAAmC,MAAM,CAAC;AAAA,UAC1D;AAAA,QACF;AAAA,MACF;AAAA,IACF;AAAA,EACF;AA3CS;AA4CX;AAnHS;AA6HT,SAAS,WACP,iBACA,YACA,aAAa,oBACP;AACN,SAAO,uBAAuB,iBAAiB,YAAY,YAAY,aAAa;AACtF;AANS;AAgBT,SAAS,YACP,iBACA,YACA,aAAa,iBACP;AACN,SAAO,uBAAuB,iBAAiB,YAAY,YAAY,OAAO;AAChF;AANS;AAQT,SAAS,gBAAyB;AAChC,SAAO,OAAO,gBAAgB,eAAe,YAAY,UAAU,eAAe,OAAO;AAC3F;AAFS;AAaT,SAAS,eACP,iBACA,YACA,aAAa,mBACP;AACN,UAAQ,cAAc,IAAI,cAAc,YAAY,iBAAiB,YAAY,UAAU;AAC7F;AANS;",
6
6
  "names": []
7
7
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@radix-ui/primitive",
3
- "version": "1.2.1-rc.1796411593667",
3
+ "version": "1.2.1",
4
4
  "license": "MIT",
5
5
  "source": "./src/index.ts",
6
6
  "main": "./dist/index.js",
@@ -24,7 +24,7 @@
24
24
  ],
25
25
  "sideEffects": false,
26
26
  "dependencies": {
27
- "@radix-ui/env-check": "0.0.2-rc.1796411593667"
27
+ "@radix-ui/env-check": "0.0.2"
28
28
  },
29
29
  "devDependencies": {
30
30
  "typescript": "^5.9.3",
@@ -44,7 +44,8 @@
44
44
  "lint": "oxlint --max-warnings 0 src",
45
45
  "clean": "rm -rf dist",
46
46
  "reset": "rm -rf dist node_modules",
47
- "typecheck": "tsc --noEmit",
47
+ "types:check:pkg": "tsc --noEmit -p tsconfig.lib.json",
48
+ "types:check:test": "tsc --noEmit -p tsconfig.test.json",
48
49
  "bench": "node bench/aria-hidden.bench.mts",
49
50
  "build": "radix-build"
50
51
  },
package/src/index.ts CHANGED
@@ -1,4 +1,4 @@
1
- export * from './primitive';
2
- export * from './can-use-dom';
3
- export * from './aria-hidden';
4
- export type * from './types';
1
+ export * from './primitive.js';
2
+ export * from './can-use-dom.js';
3
+ export * from './aria-hidden.js';
4
+ export type * from './types.js';
package/src/primitive.tsx CHANGED
@@ -1,5 +1,5 @@
1
1
  /* oxlint-disable no-restricted-properties */
2
- import { canUseDOM } from './can-use-dom';
2
+ import { canUseDOM } from './can-use-dom.js';
3
3
 
4
4
  export function composeEventHandlers<E extends { defaultPrevented: boolean }>(
5
5
  originalEventHandler?: (event: E) => void,