@xlsx-editor.dev/core 0.0.0-placeholder.0 → 0.1.0-beta.0

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.
Files changed (55) hide show
  1. package/LICENSE +217 -0
  2. package/README.md +254 -2
  3. package/THIRD_PARTY_NOTICES.md +78 -0
  4. package/dist/automation.d.ts +299 -0
  5. package/dist/automation.js +42 -0
  6. package/dist/builtins-nmHrq2Et.d.ts +37 -0
  7. package/dist/cascade.d.ts +196 -0
  8. package/dist/cascade.js +60 -0
  9. package/dist/cell-format-DW8yF-c-.d.ts +226 -0
  10. package/dist/chunk-2DLJYRJC.js +3171 -0
  11. package/dist/chunk-2ZU4337U.js +204 -0
  12. package/dist/chunk-44L37ENZ.js +8219 -0
  13. package/dist/chunk-77N55BLP.js +911 -0
  14. package/dist/chunk-7PV5HQPE.js +84 -0
  15. package/dist/chunk-E4VJJ556.js +756 -0
  16. package/dist/chunk-KG4IL4JI.js +436 -0
  17. package/dist/chunk-PLDK4XO6.js +9125 -0
  18. package/dist/chunk-PRHLYXHL.js +1699 -0
  19. package/dist/chunk-TE4FXG5T.js +3156 -0
  20. package/dist/contracts.d.ts +32 -0
  21. package/dist/contracts.js +0 -0
  22. package/dist/dist-C7NLNUMD.js +2850 -0
  23. package/dist/editor.d.ts +3167 -0
  24. package/dist/editor.js +309 -0
  25. package/dist/harfbuzz-measurer-CkKfsEyu.d.ts +128 -0
  26. package/dist/harfbuzz.wasm +0 -0
  27. package/dist/index.d.ts +11 -0
  28. package/dist/index.js +309 -0
  29. package/dist/layout.d.ts +111 -0
  30. package/dist/layout.js +104 -0
  31. package/dist/merge-commands-DthcNpfw.d.ts +53 -0
  32. package/dist/node-module-shim-LQXGL47O.js +18 -0
  33. package/dist/ops-CfUCjyph.d.ts +629 -0
  34. package/dist/output.d.ts +177 -0
  35. package/dist/output.js +29 -0
  36. package/dist/sheet-index-P5vevMWX.d.ts +52 -0
  37. package/dist/sheet-layout-D9M_4EBn.d.ts +494 -0
  38. package/dist/sheet-protection-D8goxm58.d.ts +209 -0
  39. package/dist/store.d.ts +615 -0
  40. package/dist/store.js +272 -0
  41. package/dist/theme-BprDji6x.d.ts +16 -0
  42. package/dist/units-D6CD_A5I.d.ts +13 -0
  43. package/dist/workbook-index-DsbeR8Kb.d.ts +294 -0
  44. package/licenses/Emscripten-LICENSE.txt +102 -0
  45. package/licenses/HarfBuzz-COPYING.txt +42 -0
  46. package/licenses/HarfBuzz-USE-MIT.txt +21 -0
  47. package/licenses/HarfBuzz-source-notices.txt +4508 -0
  48. package/licenses/README.md +19 -0
  49. package/licenses/Unicode-LICENSE.txt +39 -0
  50. package/licenses/compiler-rt-LICENSE.txt +311 -0
  51. package/licenses/harfbuzz-manifest.json +84 -0
  52. package/licenses/musl-COPYRIGHT.txt +193 -0
  53. package/package.json +79 -6
  54. package/src/styles/editor.css +1933 -0
  55. package/src/styles/editor.css.d.ts +2 -0
@@ -0,0 +1,84 @@
1
+ // src/layout/harfbuzz-wasm-binary.ts
2
+ var overrideUrl = null;
3
+ var readUrl = null;
4
+ function redact(url) {
5
+ try {
6
+ const parsed = new URL(url);
7
+ const carriesSecret = parsed.username !== "" || parsed.password !== "" || parsed.search !== "" || parsed.hash !== "";
8
+ if (!carriesSecret) return url;
9
+ return `${parsed.protocol}//${parsed.host}${parsed.pathname}\u2026`;
10
+ } catch {
11
+ const cut = url.search(/[?#]/);
12
+ return cut === -1 ? url : `${url.slice(0, cut)}\u2026`;
13
+ }
14
+ }
15
+ function redactUrlsIn(text) {
16
+ return text.replace(/[a-z][a-z0-9+.-]*:\/\/[^\s"')]+/gi, (match) => redact(match));
17
+ }
18
+ function normalize(url) {
19
+ if (url instanceof URL) return url.href;
20
+ const base = globalThis.location?.href;
21
+ try {
22
+ return base ? new URL(url, base).href : url;
23
+ } catch {
24
+ return url;
25
+ }
26
+ }
27
+ function setHarfBuzzWasmUrl(url) {
28
+ if (typeof url !== "string" && !(url instanceof URL)) {
29
+ throw new TypeError(`setHarfBuzzWasmUrl: expected a string or URL, received ${typeof url}`);
30
+ }
31
+ if (typeof url === "string" && url.trim() === "") {
32
+ throw new TypeError("setHarfBuzzWasmUrl: expected a non-empty URL");
33
+ }
34
+ const next = normalize(url);
35
+ if (readUrl !== null && readUrl !== next) {
36
+ console.warn(
37
+ `setHarfBuzzWasmUrl: the shaper already read its binary location from ${redact(readUrl)}, so this call has no effect in the current session. Move the call before the first editor is created and reload the page.`
38
+ );
39
+ return;
40
+ }
41
+ if (overrideUrl !== null && overrideUrl !== next) {
42
+ console.warn(
43
+ `setHarfBuzzWasmUrl: replacing ${redact(overrideUrl)} with ${redact(next)}. Two callers are configuring the shaper with different URLs; the later one wins.`
44
+ );
45
+ }
46
+ overrideUrl = next;
47
+ }
48
+ function resolveHarfBuzzWasmBinaryUrl(bundlerResolvedUrl) {
49
+ readUrl = overrideUrl ?? bundlerResolvedUrl;
50
+ return readUrl;
51
+ }
52
+ function isUnsupportedNodeRuntime(cause) {
53
+ return cause instanceof Error && /process\.getBuiltinModule/.test(cause.message);
54
+ }
55
+ function harfBuzzUnsupportedRuntimeDiagnostic(cause) {
56
+ const detail = redactUrlsIn(cause instanceof Error ? cause.message : String(cause));
57
+ return `the text shaper cannot start on this Node version: the ESM build reaches Node builtins through \`process.getBuiltinModule\`, added in Node 20.16.0 and 22.3.0. Upgrade Node; \`setHarfBuzzWasmUrl\` does not apply here. (${detail})`;
58
+ }
59
+ function harfBuzzWasmUnavailableDiagnostic(cause) {
60
+ const detail = redactUrlsIn(cause instanceof Error ? cause.message : String(cause));
61
+ const location = readUrl === null ? "its bundled location" : redact(readUrl);
62
+ const viteDevServer = overrideUrl === null && servedNotWasm(cause) ? " If the Vite 7 dev server answered with HTML, set `optimizeDeps: { exclude: ['@xlsx-editor.dev/core', '@docx-editor.dev/fonts'] }` in the Vite config and restart the server." : "";
63
+ return `the HarfBuzz WASM binary could not be loaded from ${location}. If this bundler does not emit \`new URL(..., import.meta.url)\` assets (esbuild, Bun, and library builds that inline dynamic imports), serve \`@xlsx-editor.dev/core/harfbuzz.wasm\` yourself, point \`setHarfBuzzWasmUrl\` from '@xlsx-editor.dev/core/layout' at it before creating an editor, and reload the page.${viteDevServer} (${detail})`;
64
+ }
65
+ function servedNotWasm(cause) {
66
+ const message = cause instanceof Error ? cause.message : String(cause);
67
+ return /magic|\\0asm|MIME type/i.test(message);
68
+ }
69
+ function harfBuzzVersionMismatchDiagnostic(expected, loaded) {
70
+ const mismatch = `expected HarfBuzz ${expected}, loaded ${loaded}`;
71
+ if (overrideUrl === null) {
72
+ return `${mismatch}. The bundled binary does not match this build of the engine.`;
73
+ }
74
+ return `${mismatch}. The copy served at ${redact(overrideUrl)} is from a different version of \`@xlsx-editor.dev/core\`. Re-copy \`@xlsx-editor.dev/core/harfbuzz.wasm\` from the installed package into your served assets, and reload the page.`;
75
+ }
76
+
77
+ export {
78
+ setHarfBuzzWasmUrl,
79
+ resolveHarfBuzzWasmBinaryUrl,
80
+ isUnsupportedNodeRuntime,
81
+ harfBuzzUnsupportedRuntimeDiagnostic,
82
+ harfBuzzWasmUnavailableDiagnostic,
83
+ harfBuzzVersionMismatchDiagnostic
84
+ };