michangarrito/apps/mcp-server/node_modules/hono/dist/jsx/dom/context.js
rckrdmrd 48dea7a5d0 feat: Initial commit - michangarrito
Marketplace móvil para negocios locales mexicanos.

Estructura inicial:
- apps/backend (NestJS API)
- apps/frontend (React Web)
- apps/mobile (Expo/React Native)
- apps/mcp-server (Claude MCP Server)
- apps/whatsapp-service (WhatsApp Business API)
- database/ (PostgreSQL DDL)
- docs/ (Documentación)

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-07 04:41:02 -06:00

49 lines
1.1 KiB
JavaScript

// src/jsx/dom/context.ts
import { DOM_ERROR_HANDLER } from "../constants.js";
import { globalContexts } from "../context.js";
import { setInternalTagFlag } from "./utils.js";
var createContextProviderFunction = (values) => ({ value, children }) => {
if (!children) {
return void 0;
}
const props = {
children: [
{
tag: setInternalTagFlag(() => {
values.push(value);
}),
props: {}
}
]
};
if (Array.isArray(children)) {
props.children.push(...children.flat());
} else {
props.children.push(children);
}
props.children.push({
tag: setInternalTagFlag(() => {
values.pop();
}),
props: {}
});
const res = { tag: "", props, type: "" };
res[DOM_ERROR_HANDLER] = (err) => {
values.pop();
throw err;
};
return res;
};
var createContext = (defaultValue) => {
const values = [defaultValue];
const context = createContextProviderFunction(values);
context.values = values;
context.Provider = context;
globalContexts.push(context);
return context;
};
export {
createContext,
createContextProviderFunction
};