@graphrefly/graphrefly 0.47.1 → 0.48.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.
- package/dist/base/composition/index.cjs +28 -19
- package/dist/base/composition/index.cjs.map +1 -1
- package/dist/base/composition/index.d.cts +14 -5
- package/dist/base/composition/index.d.ts +14 -5
- package/dist/base/composition/index.js +9 -9
- package/dist/base/index.cjs +294 -164
- package/dist/base/index.cjs.map +1 -1
- package/dist/base/index.d.cts +2 -2
- package/dist/base/index.d.ts +2 -2
- package/dist/base/index.js +77 -72
- package/dist/base/io/index.cjs +145 -85
- package/dist/base/io/index.cjs.map +1 -1
- package/dist/base/io/index.d.cts +32 -5
- package/dist/base/io/index.d.ts +32 -5
- package/dist/base/io/index.js +5 -5
- package/dist/base/mutation/index.cjs +21 -0
- package/dist/base/mutation/index.cjs.map +1 -1
- package/dist/base/mutation/index.d.cts +23 -1
- package/dist/base/mutation/index.d.ts +23 -1
- package/dist/base/mutation/index.js +3 -1
- package/dist/base/sources/browser/index.cjs +18 -12
- package/dist/base/sources/browser/index.cjs.map +1 -1
- package/dist/base/sources/browser/index.d.cts +20 -2
- package/dist/base/sources/browser/index.d.ts +20 -2
- package/dist/base/sources/browser/index.js +18 -12
- package/dist/base/sources/browser/index.js.map +1 -1
- package/dist/base/sources/event/index.cjs +29 -1
- package/dist/base/sources/event/index.cjs.map +1 -1
- package/dist/base/sources/event/index.d.cts +67 -3
- package/dist/base/sources/event/index.d.ts +67 -3
- package/dist/base/sources/event/index.js +5 -2
- package/dist/base/sources/index.cjs +96 -50
- package/dist/base/sources/index.cjs.map +1 -1
- package/dist/base/sources/index.d.cts +1 -1
- package/dist/base/sources/index.d.ts +1 -1
- package/dist/base/sources/index.js +7 -4
- package/dist/base/sources/node/index.cjs +43 -37
- package/dist/base/sources/node/index.cjs.map +1 -1
- package/dist/base/sources/node/index.js +43 -37
- package/dist/base/sources/node/index.js.map +1 -1
- package/dist/{chunk-J5WFUEO4.js → chunk-23MAWVOJ.js} +3 -3
- package/dist/{chunk-YXCPV26R.js → chunk-3REMCHSS.js} +39 -27
- package/dist/chunk-3REMCHSS.js.map +1 -0
- package/dist/{chunk-CEVNQ74M.js → chunk-3YGXPUHW.js} +2 -2
- package/dist/{chunk-CEVNQ74M.js.map → chunk-3YGXPUHW.js.map} +1 -1
- package/dist/{chunk-EVYY4X5A.js → chunk-46X2EFQH.js} +16 -5
- package/dist/chunk-46X2EFQH.js.map +1 -0
- package/dist/{chunk-NY2PYHNC.js → chunk-5UY3PNFY.js} +12 -5
- package/dist/chunk-5UY3PNFY.js.map +1 -0
- package/dist/{chunk-RGMTUZCL.js → chunk-65OM4XLQ.js} +50 -4
- package/dist/chunk-65OM4XLQ.js.map +1 -0
- package/dist/{chunk-3PSLNJDU.js → chunk-6DQYBIHW.js} +314 -49
- package/dist/chunk-6DQYBIHW.js.map +1 -0
- package/dist/{chunk-LDCSZ72P.js → chunk-6YBER5UP.js} +3 -3
- package/dist/{chunk-LDCSZ72P.js.map → chunk-6YBER5UP.js.map} +1 -1
- package/dist/{chunk-7EGRP2VX.js → chunk-7BULJTL6.js} +2 -2
- package/dist/{chunk-7EGRP2VX.js.map → chunk-7BULJTL6.js.map} +1 -1
- package/dist/{chunk-VLAGJZSL.js → chunk-7T7WLEPM.js} +25 -4
- package/dist/chunk-7T7WLEPM.js.map +1 -0
- package/dist/{chunk-PKPO3JTZ.js → chunk-AQAKDE7F.js} +29 -11
- package/dist/chunk-AQAKDE7F.js.map +1 -0
- package/dist/{chunk-2OB3CEJS.js → chunk-B5Y5GPD5.js} +2 -2
- package/dist/{chunk-BXGZFGZ4.js → chunk-C5QD5DQX.js} +22 -1
- package/dist/chunk-C5QD5DQX.js.map +1 -0
- package/dist/{chunk-4XCHZRUJ.js → chunk-D5YGR4TP.js} +58 -7
- package/dist/chunk-D5YGR4TP.js.map +1 -0
- package/dist/{chunk-NPRP3MCV.js → chunk-DHDCOOJU.js} +2 -2
- package/dist/chunk-DHDCOOJU.js.map +1 -0
- package/dist/{chunk-MTTRCEJT.js → chunk-DVTDF5OI.js} +2 -2
- package/dist/{chunk-SOOKUYVM.js → chunk-F7EKHR32.js} +13 -9
- package/dist/chunk-F7EKHR32.js.map +1 -0
- package/dist/{chunk-A7KV5UK4.js → chunk-G7H6PN7P.js} +2 -2
- package/dist/{chunk-OCUDSN63.js → chunk-GGKHHG5Y.js} +110 -64
- package/dist/chunk-GGKHHG5Y.js.map +1 -0
- package/dist/{chunk-RAGGHLCV.js → chunk-GUNIRPEJ.js} +8 -6
- package/dist/{chunk-RAGGHLCV.js.map → chunk-GUNIRPEJ.js.map} +1 -1
- package/dist/{chunk-YJ4U2D2C.js → chunk-J5TBZFBD.js} +9 -7
- package/dist/chunk-J5TBZFBD.js.map +1 -0
- package/dist/{chunk-Y52CS6YA.js → chunk-JA67ZQG2.js} +2 -2
- package/dist/{chunk-Y52CS6YA.js.map → chunk-JA67ZQG2.js.map} +1 -1
- package/dist/{chunk-U225SKB4.js → chunk-K4ZYJ4EM.js} +569 -424
- package/dist/chunk-K4ZYJ4EM.js.map +1 -0
- package/dist/{chunk-Z4YXAUDN.js → chunk-KUFXLAEY.js} +11 -7
- package/dist/{chunk-Z4YXAUDN.js.map → chunk-KUFXLAEY.js.map} +1 -1
- package/dist/{chunk-IHTWQEDR.js → chunk-LTSI7ULC.js} +3 -3
- package/dist/{chunk-IHTWQEDR.js.map → chunk-LTSI7ULC.js.map} +1 -1
- package/dist/{chunk-DKNHAICT.js → chunk-MMHGYX44.js} +25 -9
- package/dist/chunk-MMHGYX44.js.map +1 -0
- package/dist/{chunk-K7PDZYQE.js → chunk-MQMTRKY3.js} +129 -50
- package/dist/chunk-MQMTRKY3.js.map +1 -0
- package/dist/{chunk-42FQ27MQ.js → chunk-MTODGQBR.js} +44 -179
- package/dist/chunk-MTODGQBR.js.map +1 -0
- package/dist/{chunk-O3MT7DYI.js → chunk-N6MNJNHB.js} +2 -2
- package/dist/{chunk-FVINAAKA.js → chunk-NBK6QQMG.js} +14 -13
- package/dist/{chunk-FVINAAKA.js.map → chunk-NBK6QQMG.js.map} +1 -1
- package/dist/{chunk-DM4OMPWK.js → chunk-NSA5K5G2.js} +2 -2
- package/dist/{chunk-MLTPJMH6.js → chunk-QQYULEZL.js} +2 -2
- package/dist/chunk-QSW4DFKE.js +31 -0
- package/dist/chunk-QSW4DFKE.js.map +1 -0
- package/dist/{chunk-PZWISPIQ.js → chunk-S7HN5FHL.js} +17 -11
- package/dist/chunk-S7HN5FHL.js.map +1 -0
- package/dist/{chunk-4S53H2KR.js → chunk-SUNCHMML.js} +2 -2
- package/dist/{chunk-4GYMCUDZ.js → chunk-T2U6N3FV.js} +7 -7
- package/dist/{chunk-RJOG4IJU.js → chunk-T5URUIIY.js} +50 -35
- package/dist/chunk-T5URUIIY.js.map +1 -0
- package/dist/{chunk-B4AKFXGE.js → chunk-TPTZZV25.js} +6 -6
- package/dist/chunk-TPTZZV25.js.map +1 -0
- package/dist/{chunk-BU3SEFA5.js → chunk-V46JWFGV.js} +7 -6
- package/dist/chunk-V46JWFGV.js.map +1 -0
- package/dist/{chunk-IJRR6YAI.js → chunk-VLDRAMP7.js} +18 -12
- package/dist/chunk-VLDRAMP7.js.map +1 -0
- package/dist/{chunk-6XZYT4SW.js → chunk-X6ESZDR6.js} +8 -9
- package/dist/chunk-X6ESZDR6.js.map +1 -0
- package/dist/{chunk-E5OZPDIW.js → chunk-X7BA5PWG.js} +7 -5
- package/dist/chunk-X7BA5PWG.js.map +1 -0
- package/dist/{chunk-CXANAIZU.js → chunk-XEWV254I.js} +3 -3
- package/dist/{chunk-CXANAIZU.js.map → chunk-XEWV254I.js.map} +1 -1
- package/dist/{chunk-V4Y3TM7U.js → chunk-YBJVKMTM.js} +38 -16
- package/dist/chunk-YBJVKMTM.js.map +1 -0
- package/dist/{chunk-7ADWWI2T.js → chunk-ZW32BPXV.js} +17 -6
- package/dist/chunk-ZW32BPXV.js.map +1 -0
- package/dist/compat/index.cjs +52 -5
- package/dist/compat/index.cjs.map +1 -1
- package/dist/compat/index.d.cts +1 -1
- package/dist/compat/index.d.ts +1 -1
- package/dist/compat/index.js +7 -7
- package/dist/compat/nestjs/index.cjs +52 -5
- package/dist/compat/nestjs/index.cjs.map +1 -1
- package/dist/compat/nestjs/index.d.cts +1 -1
- package/dist/compat/nestjs/index.d.ts +1 -1
- package/dist/compat/nestjs/index.js +4 -4
- package/dist/{fallback-Bx46zqky.d.cts → fallback-BROR6ZhO.d.cts} +1 -1
- package/dist/{fallback-pIWW8A2d.d.ts → fallback-DO80aM_3.d.ts} +1 -1
- package/dist/{index-B_p8tnvf.d.cts → index-D1z3XcF9.d.cts} +1 -0
- package/dist/{index-_HDSmPyp.d.ts → index-DZ6yua0Q.d.ts} +1 -0
- package/dist/index.cjs +2387 -1707
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +10 -10
- package/dist/index.d.ts +10 -10
- package/dist/index.js +173 -150
- package/dist/index.js.map +1 -1
- package/dist/presets/ai/index.cjs +88 -26
- package/dist/presets/ai/index.cjs.map +1 -1
- package/dist/presets/ai/index.js +14 -14
- package/dist/presets/harness/index.cjs +183 -51
- package/dist/presets/harness/index.cjs.map +1 -1
- package/dist/presets/harness/index.d.cts +15 -5
- package/dist/presets/harness/index.d.ts +15 -5
- package/dist/presets/harness/index.js +26 -26
- package/dist/presets/index.cjs +298 -101
- package/dist/presets/index.cjs.map +1 -1
- package/dist/presets/index.d.cts +2 -2
- package/dist/presets/index.d.ts +2 -2
- package/dist/presets/index.js +49 -49
- package/dist/presets/inspect/index.cjs +63 -14
- package/dist/presets/inspect/index.cjs.map +1 -1
- package/dist/presets/inspect/index.d.cts +1 -1
- package/dist/presets/inspect/index.d.ts +1 -1
- package/dist/presets/inspect/index.js +6 -6
- package/dist/presets/resilience/index.cjs +64 -44
- package/dist/presets/resilience/index.cjs.map +1 -1
- package/dist/presets/resilience/index.d.cts +12 -8
- package/dist/presets/resilience/index.d.ts +12 -8
- package/dist/presets/resilience/index.js +6 -6
- package/dist/{rate-limiter-DpVbSYdH.d.cts → rate-limiter-DC26FM8J.d.cts} +10 -1
- package/dist/{rate-limiter-CEALq4N1.d.ts → rate-limiter-DyWpwpQP.d.ts} +10 -1
- package/dist/{reactive-layout-fswlBUvX.d.ts → reactive-layout-BBBWH0V_.d.cts} +85 -4
- package/dist/{reactive-layout-fswlBUvX.d.cts → reactive-layout-BBBWH0V_.d.ts} +85 -4
- package/dist/solutions/index.cjs +239 -92
- package/dist/solutions/index.cjs.map +1 -1
- package/dist/solutions/index.d.cts +2 -2
- package/dist/solutions/index.d.ts +2 -2
- package/dist/solutions/index.js +32 -32
- package/dist/{spawnable-5mDY501F.d.cts → spawnable-B2IlW60f.d.cts} +23 -2
- package/dist/{spawnable-D3lR0oQu.d.ts → spawnable-tttFz2Nh.d.ts} +23 -2
- package/dist/testing/index.cjs +94 -0
- package/dist/testing/index.cjs.map +1 -0
- package/dist/testing/index.d.cts +59 -0
- package/dist/testing/index.d.ts +59 -0
- package/dist/testing/index.js +73 -0
- package/dist/testing/index.js.map +1 -0
- package/dist/{timeout-U5O4ESK3.js → timeout-BEABACRP.js} +2 -2
- package/dist/utils/ai/browser.cjs.map +1 -1
- package/dist/utils/ai/browser.d.cts +2 -2
- package/dist/utils/ai/browser.d.ts +2 -2
- package/dist/utils/ai/browser.js +10 -10
- package/dist/utils/ai/browser.js.map +1 -1
- package/dist/utils/ai/index.cjs +291 -191
- package/dist/utils/ai/index.cjs.map +1 -1
- package/dist/utils/ai/index.d.cts +108 -12
- package/dist/utils/ai/index.d.ts +108 -12
- package/dist/utils/ai/index.js +23 -21
- package/dist/utils/ai/node.cjs.map +1 -1
- package/dist/utils/ai/node.d.cts +5 -5
- package/dist/utils/ai/node.d.ts +5 -5
- package/dist/utils/ai/node.js +3 -3
- package/dist/utils/ai/node.js.map +1 -1
- package/dist/utils/cqrs/index.cjs +29 -3
- package/dist/utils/cqrs/index.cjs.map +1 -1
- package/dist/utils/cqrs/index.d.cts +12 -7
- package/dist/utils/cqrs/index.d.ts +12 -7
- package/dist/utils/cqrs/index.js +2 -2
- package/dist/utils/demo-shell/index.cjs +45 -19
- package/dist/utils/demo-shell/index.cjs.map +1 -1
- package/dist/utils/demo-shell/index.d.cts +1 -1
- package/dist/utils/demo-shell/index.d.ts +1 -1
- package/dist/utils/demo-shell/index.js +2 -2
- package/dist/utils/domain-templates/index.cjs +1 -1
- package/dist/utils/domain-templates/index.cjs.map +1 -1
- package/dist/utils/domain-templates/index.js +3 -3
- package/dist/utils/graphspec/index.cjs +1 -1
- package/dist/utils/graphspec/index.cjs.map +1 -1
- package/dist/utils/graphspec/index.js +3 -3
- package/dist/utils/harness/index.cjs +16 -10
- package/dist/utils/harness/index.cjs.map +1 -1
- package/dist/utils/harness/index.js +1 -1
- package/dist/utils/index.cjs +1692 -1192
- package/dist/utils/index.cjs.map +1 -1
- package/dist/utils/index.d.cts +7 -7
- package/dist/utils/index.d.ts +7 -7
- package/dist/utils/index.js +77 -59
- package/dist/utils/inspect/index.cjs +52 -4
- package/dist/utils/inspect/index.cjs.map +1 -1
- package/dist/utils/inspect/index.d.cts +32 -3
- package/dist/utils/inspect/index.d.ts +32 -3
- package/dist/utils/inspect/index.js +4 -4
- package/dist/utils/job-queue/index.cjs +46 -9
- package/dist/utils/job-queue/index.cjs.map +1 -1
- package/dist/utils/job-queue/index.d.cts +33 -3
- package/dist/utils/job-queue/index.d.ts +33 -3
- package/dist/utils/job-queue/index.js +2 -2
- package/dist/utils/memory/index.cjs +570 -425
- package/dist/utils/memory/index.cjs.map +1 -1
- package/dist/utils/memory/index.d.cts +261 -33
- package/dist/utils/memory/index.d.ts +261 -33
- package/dist/utils/memory/index.js +10 -2
- package/dist/utils/messaging/index.cjs.map +1 -1
- package/dist/utils/messaging/index.d.cts +4 -3
- package/dist/utils/messaging/index.d.ts +4 -3
- package/dist/utils/messaging/index.js +2 -2
- package/dist/utils/orchestration/index.cjs +14 -3
- package/dist/utils/orchestration/index.cjs.map +1 -1
- package/dist/utils/orchestration/index.js +3 -3
- package/dist/utils/process/index.cjs +32 -2
- package/dist/utils/process/index.cjs.map +1 -1
- package/dist/utils/process/index.d.cts +4 -3
- package/dist/utils/process/index.d.ts +4 -3
- package/dist/utils/process/index.js +3 -3
- package/dist/utils/reactive-layout/index.cjs +184 -55
- package/dist/utils/reactive-layout/index.cjs.map +1 -1
- package/dist/utils/reactive-layout/index.d.cts +128 -3
- package/dist/utils/reactive-layout/index.d.ts +128 -3
- package/dist/utils/reactive-layout/index.js +16 -8
- package/dist/utils/reduction/index.cjs +1 -1
- package/dist/utils/reduction/index.cjs.map +1 -1
- package/dist/utils/reduction/index.js +2 -2
- package/dist/utils/resilience/index.cjs +64 -43
- package/dist/utils/resilience/index.cjs.map +1 -1
- package/dist/utils/resilience/index.d.cts +1 -1
- package/dist/utils/resilience/index.d.ts +1 -1
- package/dist/utils/resilience/index.js +5 -5
- package/dist/utils/surface/index.cjs +1 -1
- package/dist/utils/surface/index.cjs.map +1 -1
- package/dist/utils/surface/index.js +4 -4
- package/package.json +15 -3
- package/dist/chunk-3PSLNJDU.js.map +0 -1
- package/dist/chunk-42FQ27MQ.js.map +0 -1
- package/dist/chunk-4XCHZRUJ.js.map +0 -1
- package/dist/chunk-6XZYT4SW.js.map +0 -1
- package/dist/chunk-7ADWWI2T.js.map +0 -1
- package/dist/chunk-B4AKFXGE.js.map +0 -1
- package/dist/chunk-BU3SEFA5.js.map +0 -1
- package/dist/chunk-BXGZFGZ4.js.map +0 -1
- package/dist/chunk-DKNHAICT.js.map +0 -1
- package/dist/chunk-E5OZPDIW.js.map +0 -1
- package/dist/chunk-EVYY4X5A.js.map +0 -1
- package/dist/chunk-IJRR6YAI.js.map +0 -1
- package/dist/chunk-K7PDZYQE.js.map +0 -1
- package/dist/chunk-NPRP3MCV.js.map +0 -1
- package/dist/chunk-NY2PYHNC.js.map +0 -1
- package/dist/chunk-OCUDSN63.js.map +0 -1
- package/dist/chunk-PKPO3JTZ.js.map +0 -1
- package/dist/chunk-PZWISPIQ.js.map +0 -1
- package/dist/chunk-RGMTUZCL.js.map +0 -1
- package/dist/chunk-RJOG4IJU.js.map +0 -1
- package/dist/chunk-SOOKUYVM.js.map +0 -1
- package/dist/chunk-U225SKB4.js.map +0 -1
- package/dist/chunk-V4Y3TM7U.js.map +0 -1
- package/dist/chunk-VLAGJZSL.js.map +0 -1
- package/dist/chunk-W2BOPXTI.js +0 -1
- package/dist/chunk-YJ4U2D2C.js.map +0 -1
- package/dist/chunk-YXCPV26R.js.map +0 -1
- package/dist/timeout-U5O4ESK3.js.map +0 -1
- /package/dist/{chunk-J5WFUEO4.js.map → chunk-23MAWVOJ.js.map} +0 -0
- /package/dist/{chunk-2OB3CEJS.js.map → chunk-B5Y5GPD5.js.map} +0 -0
- /package/dist/{chunk-MTTRCEJT.js.map → chunk-DVTDF5OI.js.map} +0 -0
- /package/dist/{chunk-A7KV5UK4.js.map → chunk-G7H6PN7P.js.map} +0 -0
- /package/dist/{chunk-O3MT7DYI.js.map → chunk-N6MNJNHB.js.map} +0 -0
- /package/dist/{chunk-DM4OMPWK.js.map → chunk-NSA5K5G2.js.map} +0 -0
- /package/dist/{chunk-MLTPJMH6.js.map → chunk-QQYULEZL.js.map} +0 -0
- /package/dist/{chunk-4S53H2KR.js.map → chunk-SUNCHMML.js.map} +0 -0
- /package/dist/{chunk-4GYMCUDZ.js.map → chunk-T2U6N3FV.js.map} +0 -0
- /package/dist/{chunk-W2BOPXTI.js.map → timeout-BEABACRP.js.map} +0 -0
|
@@ -3,7 +3,7 @@ import { Graph, GraphOptions } from '@graphrefly/pure-ts/graph';
|
|
|
3
3
|
import { N as NodeOrValue } from '../../_internal-B23BagFd.cjs';
|
|
4
4
|
import { c as RetryState, b as RetryOptions } from '../../retry-DWuhjvsA.cjs';
|
|
5
5
|
import { S as StatusValue } from '../../status-U-rUI79b.cjs';
|
|
6
|
-
import { k as TimeoutState, h as RateLimiterState, e as RateLimiterOptions, B as BudgetConstraint, F as FallbackInput } from '../../rate-limiter-
|
|
6
|
+
import { k as TimeoutState, h as RateLimiterState, e as RateLimiterOptions, B as BudgetConstraint, F as FallbackInput } from '../../rate-limiter-DC26FM8J.cjs';
|
|
7
7
|
import { B as BreakerState, a as CircuitBreakerOptions } from '../../breaker-ugSdq54q.cjs';
|
|
8
8
|
import '../../backoff-Bnb9OoPh.cjs';
|
|
9
9
|
|
|
@@ -65,13 +65,17 @@ interface ResilientPipelineOptions<T> {
|
|
|
65
65
|
* Admission control — at most `maxEvents` `DATA` per `windowNs`. See
|
|
66
66
|
* {@link rateLimiter}.
|
|
67
67
|
*
|
|
68
|
-
*
|
|
69
|
-
*
|
|
70
|
-
*
|
|
68
|
+
* **`maxBuffer` is required in BOTH the value form and the Node form** —
|
|
69
|
+
* forwarded directly to {@link rateLimiter}, which is fail-loud (D4): an
|
|
70
|
+
* un-seeded opts Node, or a value/cached value omitting `maxBuffer`, throws
|
|
71
|
+
* `RangeError` at construction. Pass a finite positive integer for a bounded
|
|
72
|
+
* queue, or the literal `Infinity` to explicitly opt in to unbounded (the
|
|
73
|
+
* silent bounded/unbounded lock is the most common rateLimiter
|
|
74
|
+
* mis-configuration). There is **no value-vs-Node asymmetry and no legacy
|
|
75
|
+
* `?? Infinity` convenience injection** — both forms match the primitive's
|
|
76
|
+
* fail-loud contract (F-B-root, 2026-05-18 smell sweep).
|
|
71
77
|
*/
|
|
72
|
-
rateLimit?: NodeOrValue<
|
|
73
|
-
maxBuffer?: number;
|
|
74
|
-
}>;
|
|
78
|
+
rateLimit?: NodeOrValue<RateLimiterOptions>;
|
|
75
79
|
/** Cost/constraint gate. See {@link budgetGate}. */
|
|
76
80
|
budget?: NodeOrValue<ReadonlyArray<BudgetConstraint>>;
|
|
77
81
|
/** Circuit breaker — fail-fast when the downstream resource is unhealthy. See {@link circuitBreaker}. */
|
|
@@ -187,7 +191,7 @@ declare class ResilientPipelineGraph<T> extends Graph {
|
|
|
187
191
|
* @example
|
|
188
192
|
* ```ts
|
|
189
193
|
* const safeFetch = resilientPipeline(fetchNode, {
|
|
190
|
-
* rateLimit: { maxEvents: 10, windowNs: NS_PER_SEC },
|
|
194
|
+
* rateLimit: { maxEvents: 10, windowNs: NS_PER_SEC, maxBuffer: 100 },
|
|
191
195
|
* breaker: { failureThreshold: 5 },
|
|
192
196
|
* retry: { count: 3, backoff: "exponential" },
|
|
193
197
|
* timeoutMs: 10_000,
|
|
@@ -3,7 +3,7 @@ import { Graph, GraphOptions } from '@graphrefly/pure-ts/graph';
|
|
|
3
3
|
import { N as NodeOrValue } from '../../_internal-B23BagFd.js';
|
|
4
4
|
import { c as RetryState, b as RetryOptions } from '../../retry-BDbRZ_gx.js';
|
|
5
5
|
import { S as StatusValue } from '../../status-U-rUI79b.js';
|
|
6
|
-
import { k as TimeoutState, h as RateLimiterState, e as RateLimiterOptions, B as BudgetConstraint, F as FallbackInput } from '../../rate-limiter-
|
|
6
|
+
import { k as TimeoutState, h as RateLimiterState, e as RateLimiterOptions, B as BudgetConstraint, F as FallbackInput } from '../../rate-limiter-DyWpwpQP.js';
|
|
7
7
|
import { B as BreakerState, a as CircuitBreakerOptions } from '../../breaker-C9skL3d8.js';
|
|
8
8
|
import '../../backoff-Bnb9OoPh.js';
|
|
9
9
|
|
|
@@ -65,13 +65,17 @@ interface ResilientPipelineOptions<T> {
|
|
|
65
65
|
* Admission control — at most `maxEvents` `DATA` per `windowNs`. See
|
|
66
66
|
* {@link rateLimiter}.
|
|
67
67
|
*
|
|
68
|
-
*
|
|
69
|
-
*
|
|
70
|
-
*
|
|
68
|
+
* **`maxBuffer` is required in BOTH the value form and the Node form** —
|
|
69
|
+
* forwarded directly to {@link rateLimiter}, which is fail-loud (D4): an
|
|
70
|
+
* un-seeded opts Node, or a value/cached value omitting `maxBuffer`, throws
|
|
71
|
+
* `RangeError` at construction. Pass a finite positive integer for a bounded
|
|
72
|
+
* queue, or the literal `Infinity` to explicitly opt in to unbounded (the
|
|
73
|
+
* silent bounded/unbounded lock is the most common rateLimiter
|
|
74
|
+
* mis-configuration). There is **no value-vs-Node asymmetry and no legacy
|
|
75
|
+
* `?? Infinity` convenience injection** — both forms match the primitive's
|
|
76
|
+
* fail-loud contract (F-B-root, 2026-05-18 smell sweep).
|
|
71
77
|
*/
|
|
72
|
-
rateLimit?: NodeOrValue<
|
|
73
|
-
maxBuffer?: number;
|
|
74
|
-
}>;
|
|
78
|
+
rateLimit?: NodeOrValue<RateLimiterOptions>;
|
|
75
79
|
/** Cost/constraint gate. See {@link budgetGate}. */
|
|
76
80
|
budget?: NodeOrValue<ReadonlyArray<BudgetConstraint>>;
|
|
77
81
|
/** Circuit breaker — fail-fast when the downstream resource is unhealthy. See {@link circuitBreaker}. */
|
|
@@ -187,7 +191,7 @@ declare class ResilientPipelineGraph<T> extends Graph {
|
|
|
187
191
|
* @example
|
|
188
192
|
* ```ts
|
|
189
193
|
* const safeFetch = resilientPipeline(fetchNode, {
|
|
190
|
-
* rateLimit: { maxEvents: 10, windowNs: NS_PER_SEC },
|
|
194
|
+
* rateLimit: { maxEvents: 10, windowNs: NS_PER_SEC, maxBuffer: 100 },
|
|
191
195
|
* breaker: { failureThreshold: 5 },
|
|
192
196
|
* retry: { count: 3, backoff: "exponential" },
|
|
193
197
|
* timeoutMs: 10_000,
|
|
@@ -2,14 +2,14 @@ import "../../chunk-KRNQ6RGQ.js";
|
|
|
2
2
|
import {
|
|
3
3
|
ResilientPipelineGraph,
|
|
4
4
|
resilientPipeline
|
|
5
|
-
} from "../../chunk-
|
|
6
|
-
import "../../chunk-
|
|
7
|
-
import "../../chunk-
|
|
8
|
-
import "../../chunk-
|
|
9
|
-
import "../../chunk-
|
|
10
|
-
import "../../chunk-Z4YXAUDN.js";
|
|
5
|
+
} from "../../chunk-X6ESZDR6.js";
|
|
6
|
+
import "../../chunk-T5URUIIY.js";
|
|
7
|
+
import "../../chunk-GUNIRPEJ.js";
|
|
8
|
+
import "../../chunk-JA67ZQG2.js";
|
|
9
|
+
import "../../chunk-KUFXLAEY.js";
|
|
11
10
|
import "../../chunk-TSBFTJKM.js";
|
|
12
11
|
import "../../chunk-P5LBT622.js";
|
|
12
|
+
import "../../chunk-FMPF42Q4.js";
|
|
13
13
|
import "../../chunk-AZDQPQ3V.js";
|
|
14
14
|
export {
|
|
15
15
|
ResilientPipelineGraph,
|
|
@@ -532,9 +532,18 @@ type RateLimiterBundle<T> = {
|
|
|
532
532
|
* @param opts - Rate + bounded-buffer configuration. `maxBuffer` is required (use `Infinity` to opt in to unbounded).
|
|
533
533
|
* @returns `{ node, droppedCount }` bundle. Subscribe to `node` for the throttled stream and to `droppedCount` for backpressure pressure.
|
|
534
534
|
*
|
|
535
|
-
* @throws {RangeError} when `maxEvents` / `windowNs` is non-positive, when
|
|
535
|
+
* @throws {RangeError} when `maxEvents` / `windowNs` is non-positive, when
|
|
536
|
+
* `maxBuffer` is omitted, when `maxBuffer` is a finite value < 1, or when
|
|
537
|
+
* `opts` is a Node (reactive form) with **no cached value at construction**
|
|
538
|
+
* (D4 — the mode + initial cap are locked from `.cache` at construction;
|
|
539
|
+
* seed the opts Node with `initial`).
|
|
536
540
|
*
|
|
537
541
|
* @remarks
|
|
542
|
+
* **Reactive opts (Node form) must be seeded.** Mode (bounded vs unbounded)
|
|
543
|
+
* and the initial cap are read from `opts.cache` at construction and the swap
|
|
544
|
+
* handler rejects mode toggles. An un-seeded opts Node therefore throws at
|
|
545
|
+
* construction rather than silently locking bounded `maxBuffer: 1` (D4).
|
|
546
|
+
*
|
|
538
547
|
* **Terminal:** `COMPLETE` / `ERROR` cancel the refill timer, drop the pending queue,
|
|
539
548
|
* reset `droppedCount` to `0`, and propagate.
|
|
540
549
|
*
|
|
@@ -532,9 +532,18 @@ type RateLimiterBundle<T> = {
|
|
|
532
532
|
* @param opts - Rate + bounded-buffer configuration. `maxBuffer` is required (use `Infinity` to opt in to unbounded).
|
|
533
533
|
* @returns `{ node, droppedCount }` bundle. Subscribe to `node` for the throttled stream and to `droppedCount` for backpressure pressure.
|
|
534
534
|
*
|
|
535
|
-
* @throws {RangeError} when `maxEvents` / `windowNs` is non-positive, when
|
|
535
|
+
* @throws {RangeError} when `maxEvents` / `windowNs` is non-positive, when
|
|
536
|
+
* `maxBuffer` is omitted, when `maxBuffer` is a finite value < 1, or when
|
|
537
|
+
* `opts` is a Node (reactive form) with **no cached value at construction**
|
|
538
|
+
* (D4 — the mode + initial cap are locked from `.cache` at construction;
|
|
539
|
+
* seed the opts Node with `initial`).
|
|
536
540
|
*
|
|
537
541
|
* @remarks
|
|
542
|
+
* **Reactive opts (Node form) must be seeded.** Mode (bounded vs unbounded)
|
|
543
|
+
* and the initial cap are read from `opts.cache` at construction and the swap
|
|
544
|
+
* handler rejects mode toggles. An un-seeded opts Node therefore throws at
|
|
545
|
+
* construction rather than silently locking bounded `maxBuffer: 1` (D4).
|
|
546
|
+
*
|
|
538
547
|
* **Terminal:** `COMPLETE` / `ERROR` cancel the refill timer, drop the pending queue,
|
|
539
548
|
* reset `droppedCount` to `0`, and propagate.
|
|
540
549
|
*
|
|
@@ -21,6 +21,73 @@ interface MeasurementAdapter {
|
|
|
21
21
|
/** Optional; adapters may omit for read-only / stateless measurement. */
|
|
22
22
|
clearCache?(): void;
|
|
23
23
|
}
|
|
24
|
+
/**
|
|
25
|
+
* A single segmented piece — the structurally-narrowed common shape across
|
|
26
|
+
* `Intl.Segmenter`'s `Intl.SegmentData` and host-provided polyfills.
|
|
27
|
+
*
|
|
28
|
+
* Drops `input` (redundant — the caller already has the text) and narrows
|
|
29
|
+
* `isWordLike` to "may be missing" so grapheme-granularity callers ignore it
|
|
30
|
+
* cleanly.
|
|
31
|
+
*/
|
|
32
|
+
type SegmentInfo = {
|
|
33
|
+
/** The segmented substring. */
|
|
34
|
+
segment: string;
|
|
35
|
+
/** Code-unit offset of `segment` within the input. */
|
|
36
|
+
index: number;
|
|
37
|
+
/** True if the word-granularity segment looks like a word (letters / kana / etc.). Always undefined for grapheme granularity. */
|
|
38
|
+
isWordLike?: boolean;
|
|
39
|
+
};
|
|
40
|
+
/**
|
|
41
|
+
* Pluggable text-segmentation backend (separate from {@link MeasurementAdapter}
|
|
42
|
+
* because measurement and segmentation are different host concerns —
|
|
43
|
+
* Skia/Canvas measure widths, ICU segments graphemes/words).
|
|
44
|
+
*
|
|
45
|
+
* **Why this exists (DS-2026-05-20 — `optimizations.md` 🟠 (d)).**
|
|
46
|
+
* `reactive-layout`'s default backend uses `new Intl.Segmenter(...)` for word /
|
|
47
|
+
* grapheme iteration. Hermes (iOS 26.5 / RN 0.83) ships **without**
|
|
48
|
+
* `Intl.Segmenter` — `typeof Intl.Segmenter === "undefined"` — and the
|
|
49
|
+
* constructor throws `Cannot read property 'prototype' of undefined`. This
|
|
50
|
+
* interface lets RN/Hermes consumers inject their own segmenter (typically a
|
|
51
|
+
* polyfill wrapper) so the substrate never touches the missing global.
|
|
52
|
+
*
|
|
53
|
+
* **Contract:** sync, pure, idempotent. `segmentWords` must mirror
|
|
54
|
+
* `Intl.Segmenter(undefined, { granularity: "word" }).segment(text)`'s shape
|
|
55
|
+
* (an iterable of `{ segment, index, isWordLike }`); `segmentGraphemes`
|
|
56
|
+
* mirrors `{ granularity: "grapheme" }`. The reference implementation is
|
|
57
|
+
* {@link IntlSegmentAdapter}.
|
|
58
|
+
*
|
|
59
|
+
* **Polyfill recipe (RN/Hermes consumer userland — NOT shipped here per the
|
|
60
|
+
* `bigintJsonCodecFor` userland-binding precedent):**
|
|
61
|
+
*
|
|
62
|
+
* ```ts
|
|
63
|
+
* // Userland — at app entry, before any reactive-layout import:
|
|
64
|
+
* import "intl-segmenter-polyfill/dist/polyfill"; // or @formatjs/intl-segmenter
|
|
65
|
+
* // Then the substrate's default IntlSegmentAdapter works:
|
|
66
|
+
* import { reactiveLayout } from "@graphrefly/graphrefly/utils/reactive-layout";
|
|
67
|
+
* ```
|
|
68
|
+
*
|
|
69
|
+
* Or, without polyfilling the global (preferred — keeps ICU bytes scoped):
|
|
70
|
+
*
|
|
71
|
+
* ```ts
|
|
72
|
+
* // Userland — wrap any segmenter implementation:
|
|
73
|
+
* import { createIntlSegmenterPolyfill } from "intl-segmenter-polyfill";
|
|
74
|
+
* import type { SegmentAdapter, SegmentInfo } from "@graphrefly/graphrefly/utils/reactive-layout";
|
|
75
|
+
*
|
|
76
|
+
* const wordSeg = await createIntlSegmenterPolyfill({ granularity: "word" });
|
|
77
|
+
* const graphemeSeg = await createIntlSegmenterPolyfill({ granularity: "grapheme" });
|
|
78
|
+
* const segmentAdapter: SegmentAdapter = {
|
|
79
|
+
* segmentWords: (text) => wordSeg.segment(text) as Iterable<SegmentInfo>,
|
|
80
|
+
* segmentGraphemes: (text) => graphemeSeg.segment(text) as Iterable<SegmentInfo>,
|
|
81
|
+
* };
|
|
82
|
+
* reactiveLayout({ adapter, segmentAdapter, ... });
|
|
83
|
+
* ```
|
|
84
|
+
*/
|
|
85
|
+
interface SegmentAdapter {
|
|
86
|
+
/** Word-granularity segmentation — yields `{ segment, index, isWordLike }`. */
|
|
87
|
+
segmentWords(text: string): Iterable<SegmentInfo>;
|
|
88
|
+
/** Grapheme-granularity segmentation — yields `{ segment, index }`. `isWordLike` is unused / undefined. */
|
|
89
|
+
segmentGraphemes(text: string): Iterable<SegmentInfo>;
|
|
90
|
+
}
|
|
24
91
|
/** Mutable counters for `analyzeAndMeasure` cache hit ratio (hits / (hits + misses)). */
|
|
25
92
|
type SegmentMeasureStats = {
|
|
26
93
|
hits: number;
|
|
@@ -86,6 +153,13 @@ type LayoutNextLineContext = {
|
|
|
86
153
|
adapter?: MeasurementAdapter;
|
|
87
154
|
font?: string;
|
|
88
155
|
cache?: Map<string, Map<string, number>>;
|
|
156
|
+
/**
|
|
157
|
+
* Optional {@link SegmentAdapter} for grapheme slicing during partial-segment
|
|
158
|
+
* line builds. Defaults to {@link IntlSegmentAdapter} (lazy module shared);
|
|
159
|
+
* Hermes / RN consumers wire their own to avoid the missing-`Intl.Segmenter`
|
|
160
|
+
* runtime throw — see {@link SegmentAdapter} JSDoc.
|
|
161
|
+
*/
|
|
162
|
+
segmentAdapter?: SegmentAdapter;
|
|
89
163
|
};
|
|
90
164
|
/** Result of the reactive layout graph's describe-accessible state. */
|
|
91
165
|
type ReactiveLayoutBundle = {
|
|
@@ -111,7 +185,7 @@ type ReactiveLayoutBundle = {
|
|
|
111
185
|
* Merge segmentation pieces: sticky punctuation, CJK per-grapheme splitting,
|
|
112
186
|
* and produce the final measured segment list.
|
|
113
187
|
*/
|
|
114
|
-
declare function analyzeAndMeasure(text: string, font: string, adapter: MeasurementAdapter, cache: Map<string, Map<string, number>>, stats?: SegmentMeasureStats): PreparedSegment[];
|
|
188
|
+
declare function analyzeAndMeasure(text: string, font: string, adapter: MeasurementAdapter, cache: Map<string, Map<string, number>>, stats?: SegmentMeasureStats, segmentAdapter?: SegmentAdapter): PreparedSegment[];
|
|
115
189
|
/**
|
|
116
190
|
* Greedy line-breaking algorithm.
|
|
117
191
|
*
|
|
@@ -122,7 +196,7 @@ declare function analyzeAndMeasure(text: string, font: string, adapter: Measurem
|
|
|
122
196
|
* - Soft hyphens (break opportunity, adds visible hyphen width)
|
|
123
197
|
* - Hard breaks (forced newline)
|
|
124
198
|
*/
|
|
125
|
-
declare function computeLineBreaks(segments: PreparedSegment[], maxWidth: number, adapter: MeasurementAdapter, font: string, cache: Map<string, Map<string, number
|
|
199
|
+
declare function computeLineBreaks(segments: PreparedSegment[], maxWidth: number, adapter: MeasurementAdapter, font: string, cache: Map<string, Map<string, number>>, segmentAdapter?: SegmentAdapter): LineBreaksResult;
|
|
126
200
|
/**
|
|
127
201
|
* Lay out the next single line starting from `cursor`, fitting into `slotWidth`.
|
|
128
202
|
*
|
|
@@ -160,10 +234,17 @@ declare function layoutNextLine(segments: PreparedSegment[], cursor: LayoutCurso
|
|
|
160
234
|
*/
|
|
161
235
|
declare function carveTextLineSlots(base: Interval, blocked: Interval[], minSlotWidth?: number): Interval[];
|
|
162
236
|
/** Compute per-character x,y positions from line breaks and segments. */
|
|
163
|
-
declare function computeCharPositions(lineBreaks: LineBreaksResult, segments: PreparedSegment[], lineHeight: number): CharPosition[];
|
|
237
|
+
declare function computeCharPositions(lineBreaks: LineBreaksResult, segments: PreparedSegment[], lineHeight: number, segmentAdapter?: SegmentAdapter): CharPosition[];
|
|
164
238
|
type ReactiveLayoutOptions = {
|
|
165
239
|
/** Measurement backend (required). */
|
|
166
240
|
adapter: MeasurementAdapter;
|
|
241
|
+
/**
|
|
242
|
+
* Segmentation backend (optional). Defaults to a lazy {@link IntlSegmentAdapter}
|
|
243
|
+
* (uses platform `Intl.Segmenter`). **Required on Hermes / RN** where
|
|
244
|
+
* `Intl.Segmenter` is undefined — wire a polyfilled {@link SegmentAdapter}
|
|
245
|
+
* here. See {@link SegmentAdapter} JSDoc for the polyfill recipe.
|
|
246
|
+
*/
|
|
247
|
+
segmentAdapter?: SegmentAdapter;
|
|
167
248
|
/** Graph name (default: "reactive-layout"). */
|
|
168
249
|
name?: string;
|
|
169
250
|
/** Initial text. */
|
|
@@ -192,4 +273,4 @@ type ReactiveLayoutOptions = {
|
|
|
192
273
|
*/
|
|
193
274
|
declare function reactiveLayout(opts: ReactiveLayoutOptions): ReactiveLayoutBundle;
|
|
194
275
|
|
|
195
|
-
export { type CharPosition as C, type Interval as I, type LayoutCursor as L, type MeasurementAdapter as M, type PreparedSegment as P, type ReactiveLayoutBundle as R, type
|
|
276
|
+
export { type CharPosition as C, type Interval as I, type LayoutCursor as L, type MeasurementAdapter as M, type PreparedSegment as P, type ReactiveLayoutBundle as R, type SegmentAdapter as S, type LayoutLine as a, type LayoutNextLineContext as b, type LayoutNextLineResult as c, type LineBreaksResult as d, type ReactiveLayoutOptions as e, type SegmentBreakKind as f, type SegmentInfo as g, type SegmentMeasureStats as h, analyzeAndMeasure as i, carveTextLineSlots as j, computeCharPositions as k, computeLineBreaks as l, layoutNextLine as m, reactiveLayout as r };
|
|
@@ -21,6 +21,73 @@ interface MeasurementAdapter {
|
|
|
21
21
|
/** Optional; adapters may omit for read-only / stateless measurement. */
|
|
22
22
|
clearCache?(): void;
|
|
23
23
|
}
|
|
24
|
+
/**
|
|
25
|
+
* A single segmented piece — the structurally-narrowed common shape across
|
|
26
|
+
* `Intl.Segmenter`'s `Intl.SegmentData` and host-provided polyfills.
|
|
27
|
+
*
|
|
28
|
+
* Drops `input` (redundant — the caller already has the text) and narrows
|
|
29
|
+
* `isWordLike` to "may be missing" so grapheme-granularity callers ignore it
|
|
30
|
+
* cleanly.
|
|
31
|
+
*/
|
|
32
|
+
type SegmentInfo = {
|
|
33
|
+
/** The segmented substring. */
|
|
34
|
+
segment: string;
|
|
35
|
+
/** Code-unit offset of `segment` within the input. */
|
|
36
|
+
index: number;
|
|
37
|
+
/** True if the word-granularity segment looks like a word (letters / kana / etc.). Always undefined for grapheme granularity. */
|
|
38
|
+
isWordLike?: boolean;
|
|
39
|
+
};
|
|
40
|
+
/**
|
|
41
|
+
* Pluggable text-segmentation backend (separate from {@link MeasurementAdapter}
|
|
42
|
+
* because measurement and segmentation are different host concerns —
|
|
43
|
+
* Skia/Canvas measure widths, ICU segments graphemes/words).
|
|
44
|
+
*
|
|
45
|
+
* **Why this exists (DS-2026-05-20 — `optimizations.md` 🟠 (d)).**
|
|
46
|
+
* `reactive-layout`'s default backend uses `new Intl.Segmenter(...)` for word /
|
|
47
|
+
* grapheme iteration. Hermes (iOS 26.5 / RN 0.83) ships **without**
|
|
48
|
+
* `Intl.Segmenter` — `typeof Intl.Segmenter === "undefined"` — and the
|
|
49
|
+
* constructor throws `Cannot read property 'prototype' of undefined`. This
|
|
50
|
+
* interface lets RN/Hermes consumers inject their own segmenter (typically a
|
|
51
|
+
* polyfill wrapper) so the substrate never touches the missing global.
|
|
52
|
+
*
|
|
53
|
+
* **Contract:** sync, pure, idempotent. `segmentWords` must mirror
|
|
54
|
+
* `Intl.Segmenter(undefined, { granularity: "word" }).segment(text)`'s shape
|
|
55
|
+
* (an iterable of `{ segment, index, isWordLike }`); `segmentGraphemes`
|
|
56
|
+
* mirrors `{ granularity: "grapheme" }`. The reference implementation is
|
|
57
|
+
* {@link IntlSegmentAdapter}.
|
|
58
|
+
*
|
|
59
|
+
* **Polyfill recipe (RN/Hermes consumer userland — NOT shipped here per the
|
|
60
|
+
* `bigintJsonCodecFor` userland-binding precedent):**
|
|
61
|
+
*
|
|
62
|
+
* ```ts
|
|
63
|
+
* // Userland — at app entry, before any reactive-layout import:
|
|
64
|
+
* import "intl-segmenter-polyfill/dist/polyfill"; // or @formatjs/intl-segmenter
|
|
65
|
+
* // Then the substrate's default IntlSegmentAdapter works:
|
|
66
|
+
* import { reactiveLayout } from "@graphrefly/graphrefly/utils/reactive-layout";
|
|
67
|
+
* ```
|
|
68
|
+
*
|
|
69
|
+
* Or, without polyfilling the global (preferred — keeps ICU bytes scoped):
|
|
70
|
+
*
|
|
71
|
+
* ```ts
|
|
72
|
+
* // Userland — wrap any segmenter implementation:
|
|
73
|
+
* import { createIntlSegmenterPolyfill } from "intl-segmenter-polyfill";
|
|
74
|
+
* import type { SegmentAdapter, SegmentInfo } from "@graphrefly/graphrefly/utils/reactive-layout";
|
|
75
|
+
*
|
|
76
|
+
* const wordSeg = await createIntlSegmenterPolyfill({ granularity: "word" });
|
|
77
|
+
* const graphemeSeg = await createIntlSegmenterPolyfill({ granularity: "grapheme" });
|
|
78
|
+
* const segmentAdapter: SegmentAdapter = {
|
|
79
|
+
* segmentWords: (text) => wordSeg.segment(text) as Iterable<SegmentInfo>,
|
|
80
|
+
* segmentGraphemes: (text) => graphemeSeg.segment(text) as Iterable<SegmentInfo>,
|
|
81
|
+
* };
|
|
82
|
+
* reactiveLayout({ adapter, segmentAdapter, ... });
|
|
83
|
+
* ```
|
|
84
|
+
*/
|
|
85
|
+
interface SegmentAdapter {
|
|
86
|
+
/** Word-granularity segmentation — yields `{ segment, index, isWordLike }`. */
|
|
87
|
+
segmentWords(text: string): Iterable<SegmentInfo>;
|
|
88
|
+
/** Grapheme-granularity segmentation — yields `{ segment, index }`. `isWordLike` is unused / undefined. */
|
|
89
|
+
segmentGraphemes(text: string): Iterable<SegmentInfo>;
|
|
90
|
+
}
|
|
24
91
|
/** Mutable counters for `analyzeAndMeasure` cache hit ratio (hits / (hits + misses)). */
|
|
25
92
|
type SegmentMeasureStats = {
|
|
26
93
|
hits: number;
|
|
@@ -86,6 +153,13 @@ type LayoutNextLineContext = {
|
|
|
86
153
|
adapter?: MeasurementAdapter;
|
|
87
154
|
font?: string;
|
|
88
155
|
cache?: Map<string, Map<string, number>>;
|
|
156
|
+
/**
|
|
157
|
+
* Optional {@link SegmentAdapter} for grapheme slicing during partial-segment
|
|
158
|
+
* line builds. Defaults to {@link IntlSegmentAdapter} (lazy module shared);
|
|
159
|
+
* Hermes / RN consumers wire their own to avoid the missing-`Intl.Segmenter`
|
|
160
|
+
* runtime throw — see {@link SegmentAdapter} JSDoc.
|
|
161
|
+
*/
|
|
162
|
+
segmentAdapter?: SegmentAdapter;
|
|
89
163
|
};
|
|
90
164
|
/** Result of the reactive layout graph's describe-accessible state. */
|
|
91
165
|
type ReactiveLayoutBundle = {
|
|
@@ -111,7 +185,7 @@ type ReactiveLayoutBundle = {
|
|
|
111
185
|
* Merge segmentation pieces: sticky punctuation, CJK per-grapheme splitting,
|
|
112
186
|
* and produce the final measured segment list.
|
|
113
187
|
*/
|
|
114
|
-
declare function analyzeAndMeasure(text: string, font: string, adapter: MeasurementAdapter, cache: Map<string, Map<string, number>>, stats?: SegmentMeasureStats): PreparedSegment[];
|
|
188
|
+
declare function analyzeAndMeasure(text: string, font: string, adapter: MeasurementAdapter, cache: Map<string, Map<string, number>>, stats?: SegmentMeasureStats, segmentAdapter?: SegmentAdapter): PreparedSegment[];
|
|
115
189
|
/**
|
|
116
190
|
* Greedy line-breaking algorithm.
|
|
117
191
|
*
|
|
@@ -122,7 +196,7 @@ declare function analyzeAndMeasure(text: string, font: string, adapter: Measurem
|
|
|
122
196
|
* - Soft hyphens (break opportunity, adds visible hyphen width)
|
|
123
197
|
* - Hard breaks (forced newline)
|
|
124
198
|
*/
|
|
125
|
-
declare function computeLineBreaks(segments: PreparedSegment[], maxWidth: number, adapter: MeasurementAdapter, font: string, cache: Map<string, Map<string, number
|
|
199
|
+
declare function computeLineBreaks(segments: PreparedSegment[], maxWidth: number, adapter: MeasurementAdapter, font: string, cache: Map<string, Map<string, number>>, segmentAdapter?: SegmentAdapter): LineBreaksResult;
|
|
126
200
|
/**
|
|
127
201
|
* Lay out the next single line starting from `cursor`, fitting into `slotWidth`.
|
|
128
202
|
*
|
|
@@ -160,10 +234,17 @@ declare function layoutNextLine(segments: PreparedSegment[], cursor: LayoutCurso
|
|
|
160
234
|
*/
|
|
161
235
|
declare function carveTextLineSlots(base: Interval, blocked: Interval[], minSlotWidth?: number): Interval[];
|
|
162
236
|
/** Compute per-character x,y positions from line breaks and segments. */
|
|
163
|
-
declare function computeCharPositions(lineBreaks: LineBreaksResult, segments: PreparedSegment[], lineHeight: number): CharPosition[];
|
|
237
|
+
declare function computeCharPositions(lineBreaks: LineBreaksResult, segments: PreparedSegment[], lineHeight: number, segmentAdapter?: SegmentAdapter): CharPosition[];
|
|
164
238
|
type ReactiveLayoutOptions = {
|
|
165
239
|
/** Measurement backend (required). */
|
|
166
240
|
adapter: MeasurementAdapter;
|
|
241
|
+
/**
|
|
242
|
+
* Segmentation backend (optional). Defaults to a lazy {@link IntlSegmentAdapter}
|
|
243
|
+
* (uses platform `Intl.Segmenter`). **Required on Hermes / RN** where
|
|
244
|
+
* `Intl.Segmenter` is undefined — wire a polyfilled {@link SegmentAdapter}
|
|
245
|
+
* here. See {@link SegmentAdapter} JSDoc for the polyfill recipe.
|
|
246
|
+
*/
|
|
247
|
+
segmentAdapter?: SegmentAdapter;
|
|
167
248
|
/** Graph name (default: "reactive-layout"). */
|
|
168
249
|
name?: string;
|
|
169
250
|
/** Initial text. */
|
|
@@ -192,4 +273,4 @@ type ReactiveLayoutOptions = {
|
|
|
192
273
|
*/
|
|
193
274
|
declare function reactiveLayout(opts: ReactiveLayoutOptions): ReactiveLayoutBundle;
|
|
194
275
|
|
|
195
|
-
export { type CharPosition as C, type Interval as I, type LayoutCursor as L, type MeasurementAdapter as M, type PreparedSegment as P, type ReactiveLayoutBundle as R, type
|
|
276
|
+
export { type CharPosition as C, type Interval as I, type LayoutCursor as L, type MeasurementAdapter as M, type PreparedSegment as P, type ReactiveLayoutBundle as R, type SegmentAdapter as S, type LayoutLine as a, type LayoutNextLineContext as b, type LayoutNextLineResult as c, type LineBreaksResult as d, type ReactiveLayoutOptions as e, type SegmentBreakKind as f, type SegmentInfo as g, type SegmentMeasureStats as h, analyzeAndMeasure as i, carveTextLineSlots as j, computeCharPositions as k, computeLineBreaks as l, layoutNextLine as m, reactiveLayout as r };
|