@opentui/core 0.3.4 → 0.4.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.
Files changed (52) hide show
  1. package/NativeSpanFeed.d.ts +4 -0
  2. package/Renderable.d.ts +7 -1
  3. package/index-07zpr2dg.js +10058 -0
  4. package/index-07zpr2dg.js.map +33 -0
  5. package/index-pcvh9d34.js +15987 -0
  6. package/index-pcvh9d34.js.map +57 -0
  7. package/index.d.ts +1 -1
  8. package/index.js +11296 -116
  9. package/index.js.map +29 -3
  10. package/lib/selection.d.ts +2 -1
  11. package/lib/singleton.d.ts +1 -0
  12. package/lib/tree-sitter/client.d.ts +17 -1
  13. package/lib/tree-sitter/index.d.ts +1 -0
  14. package/lib/tree-sitter/types.d.ts +104 -1
  15. package/lib/tree-sitter/update-assets.js +8 -6
  16. package/lib/tree-sitter/update-assets.js.map +3 -3
  17. package/lib/yoga.options.d.ts +1 -1
  18. package/package.json +32 -36
  19. package/parser.worker.js +452 -78
  20. package/parser.worker.js.map +8 -7
  21. package/platform/ffi.d.ts +6 -3
  22. package/platform/test.d.ts +12 -0
  23. package/platform/worker.d.ts +26 -4
  24. package/platform/worker.node-test.d.ts +1 -0
  25. package/renderer.d.ts +6 -0
  26. package/runtime-plugin-support-configure.js +36 -18
  27. package/runtime-plugin-support-configure.js.map +1 -9
  28. package/runtime-plugin-support-configure.node.js +15 -0
  29. package/runtime-plugin-support.js +4 -19
  30. package/runtime-plugin-support.js.map +1 -10
  31. package/runtime-plugin-support.node.js +15 -0
  32. package/runtime-plugin.js +473 -16
  33. package/runtime-plugin.js.map +1 -9
  34. package/runtime-plugin.node.js +15 -0
  35. package/testing/bun-test-node.d.ts +87 -0
  36. package/testing/mock-tree-sitter-client.d.ts +4 -0
  37. package/testing.js +18 -10
  38. package/testing.js.map +3 -3
  39. package/tests/yoga-upstream/tools/MeasureCounter.d.ts +16 -0
  40. package/tests/yoga-upstream/tools/utils.d.ts +11 -0
  41. package/yoga.d.ts +440 -0
  42. package/yoga.js +193 -0
  43. package/yoga.js.map +9 -0
  44. package/zig.d.ts +62 -2
  45. package/index-0nvgrgam.js +0 -11684
  46. package/index-0nvgrgam.js.map +0 -35
  47. package/index-54s7pk0d.js +0 -25499
  48. package/index-54s7pk0d.js.map +0 -84
  49. package/index-8t841rbx.js +0 -44
  50. package/index-8t841rbx.js.map +0 -10
  51. package/index-r49y8kdq.js +0 -421
  52. package/index-r49y8kdq.js.map +0 -10
@@ -1,4 +1,26 @@
1
- export declare const Worker: {
2
- new (scriptURL: string | URL, options?: WorkerOptions): Worker;
3
- prototype: Worker;
4
- };
1
+ export declare const WORKER_UNAVAILABLE = "OpenTUI tree-sitter workers are not available for this runtime yet.";
2
+ export interface WorkerMessageEvent<T = unknown> {
3
+ readonly data: T;
4
+ }
5
+ export interface WorkerErrorEvent {
6
+ readonly error?: unknown;
7
+ readonly message: string;
8
+ }
9
+ export type WorkerMessageHandler<T = unknown> = (event: WorkerMessageEvent<T>) => void | Promise<void>;
10
+ export type WorkerErrorHandler = (event: WorkerErrorEvent) => void;
11
+ export interface PlatformWorkerOptions {
12
+ name?: string;
13
+ }
14
+ export interface PlatformWorkerHandle {
15
+ onmessage: WorkerMessageHandler | null;
16
+ onerror: WorkerErrorHandler | null;
17
+ postMessage(value: unknown): void;
18
+ terminate(): void | Promise<number>;
19
+ addEventListener(type: "message" | "error", listener: WorkerMessageHandler | WorkerErrorHandler): void;
20
+ removeEventListener(type: "message" | "error", listener: WorkerMessageHandler | WorkerErrorHandler): void;
21
+ }
22
+ export type PlatformWorkerConstructor = new (specifier: string | URL, options?: PlatformWorkerOptions) => PlatformWorkerHandle;
23
+ export declare const Worker: PlatformWorkerConstructor;
24
+ export declare const isWorkerRuntime: boolean;
25
+ export declare function postWorkerMessage(value: unknown): void;
26
+ export declare function setWorkerMessageHandler<T>(handler: WorkerMessageHandler<T>): () => void;
@@ -0,0 +1 @@
1
+ export {};
package/renderer.d.ts CHANGED
@@ -332,6 +332,8 @@ export declare class CliRenderer extends EventEmitter implements RenderContext {
332
332
  private _detachFeed;
333
333
  private _detachFeedError;
334
334
  private feedIdleRenderScheduled;
335
+ private ordinaryFrameWaitingForFeed;
336
+ private ordinaryFrameWaitControlState;
335
337
  get controlState(): RendererControlState;
336
338
  /**
337
339
  * Construct a renderer over the given streams.
@@ -379,6 +381,10 @@ export declare class CliRenderer extends EventEmitter implements RenderContext {
379
381
  get frameId(): number;
380
382
  private writeOut;
381
383
  private scheduleRenderAfterFeedIdle;
384
+ private handleNativeRenderRejection;
385
+ private reportNativeRenderFailure;
386
+ private scheduleRenderTimer;
387
+ private scheduleRenderAfterBackpressure;
382
388
  requestRender(): void;
383
389
  private activateFrame;
384
390
  get consoleMode(): ConsoleMode;
@@ -1,18 +1,36 @@
1
- // @bun
2
- import {
3
- ensureRuntimePluginSupport
4
- } from "./index-8t841rbx.js";
5
- import {
6
- createRuntimePlugin,
7
- runtimeModuleIdForSpecifier
8
- } from "./index-r49y8kdq.js";
9
- import"./index-0nvgrgam.js";
10
- import"./index-54s7pk0d.js";
11
- export {
12
- runtimeModuleIdForSpecifier,
13
- ensureRuntimePluginSupport,
14
- createRuntimePlugin
15
- };
16
-
17
- //# debugId=20E180CC53AAFA2A64756E2164756E21
18
- //# sourceMappingURL=runtime-plugin-support-configure.js.map
1
+ import { plugin as registerBunPlugin } from "bun";
2
+ import { createRuntimePlugin } from "./runtime-plugin.js";
3
+ const runtimePluginSupportInstalledKey = "__opentuiCoreRuntimePluginSupportInstalled__";
4
+ function normalizeRewriteKey(rewrite) {
5
+ return `${rewrite?.nodeModulesRuntimeSpecifiers ?? true}:${rewrite?.nodeModulesBareSpecifiers ?? false}`;
6
+ }
7
+ function assertCompatibleInstall(install, options) {
8
+ for (const specifier of Object.keys(options.additional ?? {})) {
9
+ if (!install.additionalSpecifiers.has(specifier)) {
10
+ throw new Error(`OpenTUI Core runtime plugin support is already installed without ${specifier}. Call ensureRuntimePluginSupport({ additional }) from @opentui/core/runtime-plugin-support/configure before importing @opentui/core/runtime-plugin-support.`);
11
+ }
12
+ }
13
+ if (options.core && options.core !== install.core) {
14
+ throw new Error("OpenTUI Core runtime plugin support is already installed with a different core runtime module.");
15
+ }
16
+ if (options.rewrite && normalizeRewriteKey(options.rewrite) !== install.rewriteKey) {
17
+ throw new Error("OpenTUI Core runtime plugin support is already installed with different rewrite options.");
18
+ }
19
+ }
20
+ export function ensureRuntimePluginSupport(options = {}) {
21
+ const state = globalThis;
22
+ const install = state[runtimePluginSupportInstalledKey];
23
+ if (install) {
24
+ assertCompatibleInstall(install, options);
25
+ return false;
26
+ }
27
+ registerBunPlugin(createRuntimePlugin(options));
28
+ state[runtimePluginSupportInstalledKey] = {
29
+ additionalSpecifiers: new Set(Object.keys(options.additional ?? {})),
30
+ core: options.core,
31
+ rewriteKey: normalizeRewriteKey(options.rewrite),
32
+ };
33
+ return true;
34
+ }
35
+ export { createRuntimePlugin, runtimeModuleIdForSpecifier } from "./runtime-plugin.js";
36
+ //# sourceMappingURL=runtime-plugin-support-configure.js.map
@@ -1,9 +1 @@
1
- {
2
- "version": 3,
3
- "sources": [],
4
- "sourcesContent": [
5
- ],
6
- "mappings": "",
7
- "debugId": "20E180CC53AAFA2A64756E2164756E21",
8
- "names": []
9
- }
1
+ {"version":3,"file":"runtime-plugin-support-configure.js","sourceRoot":"","sources":["runtime-plugin-support-configure.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,IAAI,iBAAiB,EAAE,MAAM,KAAK,CAAA;AACjD,OAAO,EAAE,mBAAmB,EAA4D,MAAM,qBAAqB,CAAA;AAEnH,MAAM,gCAAgC,GAAG,8CAA8C,CAAA;AAYvF,SAAS,mBAAmB,CAAC,OAA0D;IACrF,OAAO,GAAG,OAAO,EAAE,4BAA4B,IAAI,IAAI,IAAI,OAAO,EAAE,yBAAyB,IAAI,KAAK,EAAE,CAAA;AAC1G,CAAC;AAED,SAAS,uBAAuB,CAAC,OAAoC,EAAE,OAAmC;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,2BAA2B,EAAE,MAAM,qBAAqB,CAAA"}
@@ -0,0 +1,15 @@
1
+ const errorMessage = "@opentui/core/runtime-plugin-support/configure is Bun-only and is not available in Node.js. Use Bun to import this entrypoint."
2
+
3
+ export function ensureRuntimePluginSupport() {
4
+ throw new Error("@opentui/core/runtime-plugin-support/configure is Bun-only and is not available in Node.js. Use Bun to import this entrypoint.")
5
+ }
6
+
7
+ export function createRuntimePlugin() {
8
+ throw new Error("@opentui/core/runtime-plugin-support/configure is Bun-only and is not available in Node.js. Use Bun to import this entrypoint.")
9
+ }
10
+
11
+ export function runtimeModuleIdForSpecifier() {
12
+ throw new Error("@opentui/core/runtime-plugin-support/configure is Bun-only and is not available in Node.js. Use Bun to import this entrypoint.")
13
+ }
14
+
15
+ throw new Error(errorMessage)
@@ -1,20 +1,5 @@
1
- // @bun
2
- import {
3
- ensureRuntimePluginSupport
4
- } from "./index-8t841rbx.js";
5
- import {
6
- createRuntimePlugin,
7
- runtimeModuleIdForSpecifier
8
- } from "./index-r49y8kdq.js";
9
- import"./index-0nvgrgam.js";
10
- import"./index-54s7pk0d.js";
11
- // src/runtime-plugin-support.ts
1
+ import { ensureRuntimePluginSupport } from "./runtime-plugin-support-configure.js";
2
+ export { ensureRuntimePluginSupport };
3
+ export { createRuntimePlugin, runtimeModuleIdForSpecifier, } from "./runtime-plugin-support-configure.js";
12
4
  ensureRuntimePluginSupport();
13
- export {
14
- runtimeModuleIdForSpecifier,
15
- ensureRuntimePluginSupport,
16
- createRuntimePlugin
17
- };
18
-
19
- //# debugId=77F70D7DCCE5C8F764756E2164756E21
20
- //# sourceMappingURL=runtime-plugin-support.js.map
5
+ //# sourceMappingURL=runtime-plugin-support.js.map
@@ -1,10 +1 @@
1
- {
2
- "version": 3,
3
- "sources": ["../src/runtime-plugin-support.ts"],
4
- "sourcesContent": [
5
- "import { ensureRuntimePluginSupport } from \"./runtime-plugin-support-configure.js\"\n\nexport { ensureRuntimePluginSupport }\nexport {\n createRuntimePlugin,\n runtimeModuleIdForSpecifier,\n type CreateRuntimePluginOptions,\n type RuntimeModuleEntry,\n type RuntimeModuleExports,\n type RuntimeModuleLoader,\n} from \"./runtime-plugin-support-configure.js\"\n\nensureRuntimePluginSupport()\n"
6
- ],
7
- "mappings": ";;;;;;;;;;;AAYA,2BAA2B;",
8
- "debugId": "77F70D7DCCE5C8F764756E2164756E21",
9
- "names": []
10
- }
1
+ {"version":3,"file":"runtime-plugin-support.js","sourceRoot":"","sources":["runtime-plugin-support.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,0BAA0B,EAAE,MAAM,uCAAuC,CAAA;AAElF,OAAO,EAAE,0BAA0B,EAAE,CAAA;AACrC,OAAO,EACL,mBAAmB,EACnB,2BAA2B,GAK5B,MAAM,uCAAuC,CAAA;AAE9C,0BAA0B,EAAE,CAAA"}
@@ -0,0 +1,15 @@
1
+ const errorMessage = "@opentui/core/runtime-plugin-support is Bun-only and is not available in Node.js. Use Bun to import this entrypoint."
2
+
3
+ export function ensureRuntimePluginSupport() {
4
+ throw new Error("@opentui/core/runtime-plugin-support is Bun-only and is not available in Node.js. Use Bun to import this entrypoint.")
5
+ }
6
+
7
+ export function createRuntimePlugin() {
8
+ throw new Error("@opentui/core/runtime-plugin-support is Bun-only and is not available in Node.js. Use Bun to import this entrypoint.")
9
+ }
10
+
11
+ export function runtimeModuleIdForSpecifier() {
12
+ throw new Error("@opentui/core/runtime-plugin-support is Bun-only and is not available in Node.js. Use Bun to import this entrypoint.")
13
+ }
14
+
15
+ throw new Error(errorMessage)