Files
SnowLuma/.pnpm-store/v11/files/c0/506e86e5a8e86cc31bbd7c97b02ff102a5fce9ca542d12213ee98ed7454d8d3ae8c8a9a0ab8cfa59ea5933e14131abd04e21c93fe6e944038dc344673c0c8f
TanTan 2a69b23b47
Dev Build / cleanup (push) Waiting to run
Dev Build / typecheck (push) Waiting to run
docs: 仓库链接指向本镜像仓库
2026-11-13 09:27:07 +08:00

32 lines
1.2 KiB
Plaintext

import { escapeToBuffer, raw, stringBufferToString } from "../utils/html.js";
import { html } from "../helper/html/index.js";
import { isValidAttributeName, styleObjectForEach } from "./utils.js";
import { Fragment } from "./base.js";
import { jsxDEV } from "./jsx-dev-runtime.js";
//#region src/jsx/jsx-runtime.ts
const jsxAttr = (key, v) => {
if (!isValidAttributeName(key)) return raw("");
const buffer = [`${key}="`];
if (key === "style" && typeof v === "object") {
let styleStr = "";
styleObjectForEach(v, (property, value) => {
if (value != null) styleStr += `${styleStr ? ";" : ""}${property}:${value}`;
});
escapeToBuffer(styleStr, buffer);
buffer[0] += "\"";
} else if (typeof v === "string") {
escapeToBuffer(v, buffer);
buffer[0] += "\"";
} else if (v === null || v === void 0) return raw("");
else if (typeof v === "number" || v.isEscaped) buffer[0] += `${v}"`;
else if (v instanceof Promise) buffer.unshift("\"", v);
else {
escapeToBuffer(v.toString(), buffer);
buffer[0] += "\"";
}
return buffer.length === 1 ? raw(buffer[0]) : stringBufferToString(buffer, void 0);
};
const jsxEscape = (value) => value;
//#endregion
export { Fragment, jsxDEV as jsx, jsxAttr, jsxEscape, html as jsxTemplate, jsxDEV as jsxs };