@jsxpdf/jsxpdf 0.0.1-alpha.0 → 0.0.1-alpha.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.
@@ -1,5 +1,21 @@
1
- // src/jsx-runtime.ts
2
- import { Fragment, jsx, jsxs, jsxDEV } from "@jsxpdf/core/jsx-runtime";
1
+ // ../core/src/jsx.ts
2
+ var createElement = (type, props, key) => {
3
+ const normalizedProps = props ?? {};
4
+ return {
5
+ type,
6
+ key,
7
+ props: normalizedProps
8
+ };
9
+ };
10
+
11
+ // ../core/src/jsx-runtime.ts
12
+ var Fragment = /* @__PURE__ */ Symbol.for("jsxpdf.fragment");
13
+ function jsx(type, props, key) {
14
+ if (type === Fragment) return props.children;
15
+ return createElement(type, props, key);
16
+ }
17
+ var jsxs = jsx;
18
+ var jsxDEV = jsx;
3
19
  export {
4
20
  Fragment,
5
21
  jsx,
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
- "sources": ["../src/jsx-runtime.ts"],
4
- "sourcesContent": ["/// <reference path=\"./global.d.ts\" />\n\nexport { Fragment, jsx, jsxs, jsxDEV } from \"@jsxpdf/core/jsx-runtime\"\n"],
5
- "mappings": ";AAEA,SAAS,UAAU,KAAK,MAAM,cAAc;",
3
+ "sources": ["../../core/src/jsx.ts", "../../core/src/jsx-runtime.ts"],
4
+ "sourcesContent": ["import { TextInstance } from \"./primitives\"\nimport type { PdfElement, PdfProps, PdfValue } from \"./types\"\n\nconst flattenChildren = (input: PdfValue): PdfValue[] => {\n if (!Array.isArray(input)) return [input]\n // Iterative depth-first flatten that preserves order without flatMap's\n // per-level intermediate arrays and closures.\n const out: PdfValue[] = []\n const pending: PdfValue[] = [input]\n while (pending.length > 0) {\n const current = pending.pop() as PdfValue\n if (Array.isArray(current)) {\n for (let index = current.length - 1; index >= 0; index -= 1) pending.push(current[index])\n } else {\n out.push(current)\n }\n }\n return out\n}\n\nexport const createElement = (type: PdfElement[\"type\"], props: PdfProps, key?: string): PdfElement => {\n const normalizedProps = props ?? {}\n return {\n type,\n key,\n props: normalizedProps\n }\n}\n\nexport const materializeChildren = (children: PdfValue): PdfValue[] => {\n if (!Array.isArray(children)) {\n return children === undefined || children === false || children === null ? [] : [children]\n }\n // Fast path: already-flat arrays are filtered in place without a flatten pass.\n let hasNested = false\n for (let index = 0; index < children.length; index += 1) {\n if (Array.isArray(children[index])) {\n hasNested = true\n break\n }\n }\n if (!hasNested) {\n const out: PdfValue[] = []\n for (let index = 0; index < children.length; index += 1) {\n const value = children[index]\n if (value !== undefined && value !== false && value !== null) out.push(value)\n }\n return out\n }\n return flattenChildren(children).filter((value) => value !== undefined && value !== false && value !== null)\n}\n\nexport const createTextElement = (value: string | number): PdfElement => ({\n type: TextInstance,\n props: {\n children: String(value)\n }\n})\n", "import { createElement } from \"./jsx\"\nimport type { PdfElement, PdfProps, PdfValue } from \"./types\"\n\nexport const Fragment = Symbol.for(\"jsxpdf.fragment\")\n\n// Fragment unwraps to raw children (any PdfValue); every other call builds\n// exactly one PdfElement via createElement. The overloads keep that precision\n// so callers don't inherit a spurious `| PdfValue` union.\nexport function jsx(type: typeof Fragment, props: PdfProps, key?: string): PdfValue\nexport function jsx(type: unknown, props: PdfProps, key?: string): PdfElement\nexport function jsx(type: unknown, props: PdfProps, key?: string): PdfElement | PdfValue {\n if (type === Fragment) return props.children\n return createElement(type as never, props, key)\n}\n\nexport const jsxs = jsx\nexport const jsxDEV = jsx\n"],
5
+ "mappings": ";AAoBO,IAAM,gBAAgB,CAAC,MAA0B,OAAiB,QAA6B;AACpG,QAAM,kBAAkB,SAAS,CAAC;AAClC,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA,OAAO;AAAA,EACT;AACF;;;ACxBO,IAAM,WAAW,uBAAO,IAAI,iBAAiB;AAO7C,SAAS,IAAI,MAAe,OAAiB,KAAqC;AACvF,MAAI,SAAS,SAAU,QAAO,MAAM;AACpC,SAAO,cAAc,MAAe,OAAO,GAAG;AAChD;AAEO,IAAM,OAAO;AACb,IAAM,SAAS;",
6
6
  "names": []
7
7
  }
@@ -1,5 +1,21 @@
1
- // src/jsx-runtime.ts
2
- import { Fragment, jsx, jsxs, jsxDEV } from "@jsxpdf/core/jsx-runtime";
1
+ // ../core/src/jsx.ts
2
+ var createElement = (type, props, key) => {
3
+ const normalizedProps = props ?? {};
4
+ return {
5
+ type,
6
+ key,
7
+ props: normalizedProps
8
+ };
9
+ };
10
+
11
+ // ../core/src/jsx-runtime.ts
12
+ var Fragment = /* @__PURE__ */ Symbol.for("jsxpdf.fragment");
13
+ function jsx(type, props, key) {
14
+ if (type === Fragment) return props.children;
15
+ return createElement(type, props, key);
16
+ }
17
+ var jsxs = jsx;
18
+ var jsxDEV = jsx;
3
19
  export {
4
20
  Fragment,
5
21
  jsx,
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
- "sources": ["../src/jsx-runtime.ts"],
4
- "sourcesContent": ["/// <reference path=\"./global.d.ts\" />\n\nexport { Fragment, jsx, jsxs, jsxDEV } from \"@jsxpdf/core/jsx-runtime\"\n"],
5
- "mappings": ";AAEA,SAAS,UAAU,KAAK,MAAM,cAAc;",
3
+ "sources": ["../../core/src/jsx.ts", "../../core/src/jsx-runtime.ts"],
4
+ "sourcesContent": ["import { TextInstance } from \"./primitives\"\nimport type { PdfElement, PdfProps, PdfValue } from \"./types\"\n\nconst flattenChildren = (input: PdfValue): PdfValue[] => {\n if (!Array.isArray(input)) return [input]\n // Iterative depth-first flatten that preserves order without flatMap's\n // per-level intermediate arrays and closures.\n const out: PdfValue[] = []\n const pending: PdfValue[] = [input]\n while (pending.length > 0) {\n const current = pending.pop() as PdfValue\n if (Array.isArray(current)) {\n for (let index = current.length - 1; index >= 0; index -= 1) pending.push(current[index])\n } else {\n out.push(current)\n }\n }\n return out\n}\n\nexport const createElement = (type: PdfElement[\"type\"], props: PdfProps, key?: string): PdfElement => {\n const normalizedProps = props ?? {}\n return {\n type,\n key,\n props: normalizedProps\n }\n}\n\nexport const materializeChildren = (children: PdfValue): PdfValue[] => {\n if (!Array.isArray(children)) {\n return children === undefined || children === false || children === null ? [] : [children]\n }\n // Fast path: already-flat arrays are filtered in place without a flatten pass.\n let hasNested = false\n for (let index = 0; index < children.length; index += 1) {\n if (Array.isArray(children[index])) {\n hasNested = true\n break\n }\n }\n if (!hasNested) {\n const out: PdfValue[] = []\n for (let index = 0; index < children.length; index += 1) {\n const value = children[index]\n if (value !== undefined && value !== false && value !== null) out.push(value)\n }\n return out\n }\n return flattenChildren(children).filter((value) => value !== undefined && value !== false && value !== null)\n}\n\nexport const createTextElement = (value: string | number): PdfElement => ({\n type: TextInstance,\n props: {\n children: String(value)\n }\n})\n", "import { createElement } from \"./jsx\"\nimport type { PdfElement, PdfProps, PdfValue } from \"./types\"\n\nexport const Fragment = Symbol.for(\"jsxpdf.fragment\")\n\n// Fragment unwraps to raw children (any PdfValue); every other call builds\n// exactly one PdfElement via createElement. The overloads keep that precision\n// so callers don't inherit a spurious `| PdfValue` union.\nexport function jsx(type: typeof Fragment, props: PdfProps, key?: string): PdfValue\nexport function jsx(type: unknown, props: PdfProps, key?: string): PdfElement\nexport function jsx(type: unknown, props: PdfProps, key?: string): PdfElement | PdfValue {\n if (type === Fragment) return props.children\n return createElement(type as never, props, key)\n}\n\nexport const jsxs = jsx\nexport const jsxDEV = jsx\n"],
5
+ "mappings": ";AAoBO,IAAM,gBAAgB,CAAC,MAA0B,OAAiB,QAA6B;AACpG,QAAM,kBAAkB,SAAS,CAAC;AAClC,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA,OAAO;AAAA,EACT;AACF;;;ACxBO,IAAM,WAAW,uBAAO,IAAI,iBAAiB;AAO7C,SAAS,IAAI,MAAe,OAAiB,KAAqC;AACvF,MAAI,SAAS,SAAU,QAAO,MAAM;AACpC,SAAO,cAAc,MAAe,OAAO,GAAG;AAChD;AAEO,IAAM,OAAO;AACb,IAAM,SAAS;",
6
6
  "names": []
7
7
  }