Files
hive/frontend/node_modules/@mdx-js/react/lib/index.js
anthonyrawlins e89f2f4b7b Add comprehensive development roadmap via GitHub Issues
Created 10 detailed GitHub issues covering:
- Project activation and management UI (#1-2)
- Worker node coordination and visualization (#3-4)
- Automated GitHub repository scanning (#5)
- Intelligent model-to-issue matching (#6)
- Multi-model task execution system (#7)
- N8N workflow integration (#8)
- Hive-Bzzz P2P bridge (#9)
- Peer assistance protocol (#10)

Each issue includes detailed specifications, acceptance criteria,
technical implementation notes, and dependency mapping.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-07-12 19:41:01 +10:00

84 lines
2.3 KiB
JavaScript

/**
* @import {MDXComponents} from 'mdx/types.js'
* @import {Component, ReactElement, ReactNode} from 'react'
*/
/**
* @callback MergeComponents
* Custom merge function.
* @param {Readonly<MDXComponents>} currentComponents
* Current components from the context.
* @returns {MDXComponents}
* Additional components.
*
* @typedef Props
* Configuration for `MDXProvider`.
* @property {ReactNode | null | undefined} [children]
* Children (optional).
* @property {Readonly<MDXComponents> | MergeComponents | null | undefined} [components]
* Additional components to use or a function that creates them (optional).
* @property {boolean | null | undefined} [disableParentContext=false]
* Turn off outer component context (default: `false`).
*/
import React from 'react'
/** @type {Readonly<MDXComponents>} */
const emptyComponents = {}
const MDXContext = React.createContext(emptyComponents)
/**
* Get current components from the MDX Context.
*
* @param {Readonly<MDXComponents> | MergeComponents | null | undefined} [components]
* Additional components to use or a function that creates them (optional).
* @returns {MDXComponents}
* Current components.
*/
export function useMDXComponents(components) {
const contextComponents = React.useContext(MDXContext)
// Memoize to avoid unnecessary top-level context changes
return React.useMemo(
function () {
// Custom merge via a function prop
if (typeof components === 'function') {
return components(contextComponents)
}
return {...contextComponents, ...components}
},
[contextComponents, components]
)
}
/**
* Provider for MDX context.
*
* @param {Readonly<Props>} properties
* Properties.
* @returns {ReactElement}
* Element.
* @satisfies {Component}
*/
export function MDXProvider(properties) {
/** @type {Readonly<MDXComponents>} */
let allComponents
if (properties.disableParentContext) {
allComponents =
typeof properties.components === 'function'
? properties.components(emptyComponents)
: properties.components || emptyComponents
} else {
allComponents = useMDXComponents(properties.components)
}
return React.createElement(
MDXContext.Provider,
{value: allComponents},
properties.children
)
}