jsx-runtime.js 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. var __defProp = Object.defineProperty;
  2. var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
  3. var __getOwnPropNames = Object.getOwnPropertyNames;
  4. var __hasOwnProp = Object.prototype.hasOwnProperty;
  5. var __export = (target, all) => {
  6. for (var name in all)
  7. __defProp(target, name, { get: all[name], enumerable: true });
  8. };
  9. var __copyProps = (to, from, except, desc) => {
  10. if (from && typeof from === "object" || typeof from === "function") {
  11. for (let key of __getOwnPropNames(from))
  12. if (!__hasOwnProp.call(to, key) && key !== except)
  13. __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
  14. }
  15. return to;
  16. };
  17. var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
  18. var jsx_runtime_exports = {};
  19. __export(jsx_runtime_exports, {
  20. Fragment: () => import_jsx_dev_runtime.Fragment,
  21. jsx: () => import_jsx_dev_runtime.jsxDEV,
  22. jsxAttr: () => jsxAttr,
  23. jsxEscape: () => jsxEscape,
  24. jsxTemplate: () => import_html.html,
  25. jsxs: () => import_jsx_dev_runtime2.jsxDEV
  26. });
  27. module.exports = __toCommonJS(jsx_runtime_exports);
  28. var import_jsx_dev_runtime = require("./jsx-dev-runtime");
  29. var import_jsx_dev_runtime2 = require("./jsx-dev-runtime");
  30. var import_html = require("../helper/html");
  31. var import_html2 = require("../utils/html");
  32. var import_utils = require("./utils");
  33. const jsxAttr = (key, v) => {
  34. const buffer = [`${key}="`];
  35. if (key === "style" && typeof v === "object") {
  36. let styleStr = "";
  37. (0, import_utils.styleObjectForEach)(v, (property, value) => {
  38. if (value != null) {
  39. styleStr += `${styleStr ? ";" : ""}${property}:${value}`;
  40. }
  41. });
  42. (0, import_html2.escapeToBuffer)(styleStr, buffer);
  43. buffer[0] += '"';
  44. } else if (typeof v === "string") {
  45. (0, import_html2.escapeToBuffer)(v, buffer);
  46. buffer[0] += '"';
  47. } else if (v === null || v === void 0) {
  48. return (0, import_html.raw)("");
  49. } else if (typeof v === "number" || v.isEscaped) {
  50. buffer[0] += `${v}"`;
  51. } else if (v instanceof Promise) {
  52. buffer.unshift('"', v);
  53. } else {
  54. (0, import_html2.escapeToBuffer)(v.toString(), buffer);
  55. buffer[0] += '"';
  56. }
  57. return buffer.length === 1 ? (0, import_html.raw)(buffer[0]) : (0, import_html2.stringBufferToString)(buffer, void 0);
  58. };
  59. const jsxEscape = (value) => value;
  60. // Annotate the CommonJS export names for ESM import in node:
  61. 0 && (module.exports = {
  62. Fragment,
  63. jsx,
  64. jsxAttr,
  65. jsxEscape,
  66. jsxTemplate,
  67. jsxs
  68. });