silvery 0.17.3 → 0.18.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/README.md +7 -13
- package/dist/{UPNG-AVSMjiFE.mjs → UPNG-DvKjM6wE.mjs} +1 -1
- package/dist/{UPNG-AVSMjiFE.mjs.map → UPNG-DvKjM6wE.mjs.map} +1 -1
- package/dist/{__vite-browser-external-2447137e-D3GdsvS_.mjs → __vite-browser-external-2447137e-DPKHHqQK.mjs} +1 -1
- package/dist/{__vite-browser-external-2447137e-D3GdsvS_.mjs.map → __vite-browser-external-2447137e-DPKHHqQK.mjs.map} +1 -1
- package/dist/{animation-C_PTO0uH.mjs → animation-DhINOJk8.mjs} +1 -1
- package/dist/{animation-C_PTO0uH.mjs.map → animation-DhINOJk8.mjs.map} +1 -1
- package/dist/{ansi-CXLE_pt1.mjs → ansi-C6Qs1Wn2.mjs} +1 -1
- package/dist/{ansi-CXLE_pt1.mjs.map → ansi-C6Qs1Wn2.mjs.map} +1 -1
- package/dist/{ansi-zmNzgkPB.d.mts → ansi-CsjnZtAw.d.mts} +1 -1
- package/dist/{ansi-zmNzgkPB.d.mts.map → ansi-CsjnZtAw.d.mts.map} +1 -1
- package/dist/apng-CvSlLBtc.mjs +3 -0
- package/dist/{apng-ENBAJk-H.mjs → apng-DFFVOItr.mjs} +3 -3
- package/dist/{apng-ENBAJk-H.mjs.map → apng-DFFVOItr.mjs.map} +1 -1
- package/dist/{backend-CkIkIHR-.mjs → backend-DU0Y938U.mjs} +1 -1
- package/dist/{backend-CkIkIHR-.mjs.map → backend-DU0Y938U.mjs.map} +1 -1
- package/dist/{backends-CkvbG3js.mjs → backends-BihMKFY_.mjs} +3 -3
- package/dist/{backends-CkvbG3js.mjs.map → backends-BihMKFY_.mjs.map} +1 -1
- package/dist/backends-Dk_5G_gC.mjs +3 -0
- package/dist/cli-GwJ0S2In.mjs +4 -0
- package/dist/{context-QreF3UHr.mjs → context-BjWgrikx.mjs} +1 -1
- package/dist/{context-QreF3UHr.mjs.map → context-BjWgrikx.mjs.map} +1 -1
- package/dist/{derive-D7bFJdfU.d.mts → derive-O_Kb1Bk_.d.mts} +3 -3
- package/dist/derive-O_Kb1Bk_.d.mts.map +1 -0
- package/dist/{devtools-owvUPfBi.mjs → devtools-CeO9X_uv.mjs} +4 -4
- package/dist/{devtools-owvUPfBi.mjs.map → devtools-CeO9X_uv.mjs.map} +1 -1
- package/dist/devtools-nX4tj6OH.mjs +2 -0
- package/dist/{eta-DLiVPaSD.mjs → eta-BnQSZcWf.mjs} +1 -1
- package/dist/{eta-DLiVPaSD.mjs.map → eta-BnQSZcWf.mjs.map} +1 -1
- package/dist/{flexily-zero-adapter-DmG4Ge8t.mjs → flexily-zero-adapter-BOM0cl8R.mjs} +61 -9
- package/dist/flexily-zero-adapter-BOM0cl8R.mjs.map +1 -0
- package/dist/{flexily-zero-adapter-GHwEW11s.mjs → flexily-zero-adapter-V8R3HQtK.mjs} +1 -1
- package/dist/{gif-Bp6fIyN3.mjs → gif-B9Uq4qZA.mjs} +3 -3
- package/dist/{gif-Bp6fIyN3.mjs.map → gif-B9Uq4qZA.mjs.map} +1 -1
- package/dist/gif-BdrLRBmM.mjs +3 -0
- package/dist/{gifenc-GiVCZ9-3.mjs → gifenc-DfhOb4xr.mjs} +1 -1
- package/dist/{gifenc-GiVCZ9-3.mjs.map → gifenc-DfhOb4xr.mjs.map} +1 -1
- package/dist/{image-Dx7gYjkq.mjs → image-B0zMbVUr.mjs} +136 -5
- package/dist/image-B0zMbVUr.mjs.map +1 -0
- package/dist/index-Bh3U1K09.d.mts +10823 -0
- package/dist/index-Bh3U1K09.d.mts.map +1 -0
- package/dist/{index-p-wBs_wH.d.mts → index-C4vrhbud.d.mts} +1 -1
- package/dist/{index-p-wBs_wH.d.mts.map → index-C4vrhbud.d.mts.map} +1 -1
- package/dist/{index-DCVL3jHo.d.mts → index-dehZ18K-.d.mts} +144 -99
- package/dist/index-dehZ18K-.d.mts.map +1 -0
- package/dist/index.d.mts +7 -7219
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +13 -9343
- package/dist/index.mjs.map +1 -1
- package/dist/{key-mapping-BsUHe_nk.mjs → key-mapping-7k2ufK2b.mjs} +1 -1
- package/dist/{key-mapping-DsyfLEdC.mjs → key-mapping-WLUmxjx1.mjs} +1 -1
- package/dist/{key-mapping-DsyfLEdC.mjs.map → key-mapping-WLUmxjx1.mjs.map} +1 -1
- package/dist/{layout-engine-D_lSR4i9.mjs → layout-engine--drvrWjD.mjs} +1 -1
- package/dist/{layout-engine-B3dsnVLU.mjs → layout-engine-Dr3cY5U4.mjs} +3 -3
- package/dist/{layout-engine-B3dsnVLU.mjs.map → layout-engine-Dr3cY5U4.mjs.map} +1 -1
- package/dist/{multi-progress-CQVB9lES.mjs → multi-progress-CcdqJFlf.mjs} +3 -3
- package/dist/{multi-progress-CQVB9lES.mjs.map → multi-progress-CcdqJFlf.mjs.map} +1 -1
- package/dist/{multi-progress-C0-rkn86.d.mts → multi-progress-DQ-uUzLf.d.mts} +2 -2
- package/dist/{multi-progress-C0-rkn86.d.mts.map → multi-progress-DQ-uUzLf.d.mts.map} +1 -1
- package/dist/{node-Dedx-6xF.mjs → node-CP5WChgr.mjs} +1 -1
- package/dist/{node-Dedx-6xF.mjs.map → node-CP5WChgr.mjs.map} +1 -1
- package/dist/{progress-bar-COPSBlT9.mjs → progress-bar-IrUjkLfU.mjs} +4 -4
- package/dist/{progress-bar-COPSBlT9.mjs.map → progress-bar-IrUjkLfU.mjs.map} +1 -1
- package/dist/{reconciler-B-NaZvbO.mjs → reconciler-B8uxQxaU.mjs} +57 -81
- package/dist/reconciler-B8uxQxaU.mjs.map +1 -0
- package/dist/{render-string-CZKpuKXo.mjs → render-string-BwLG7rIX.mjs} +1 -1
- package/dist/{pipeline-BmfaZb1O.mjs → render-string-DVfgc8xr.mjs} +836 -508
- package/dist/render-string-DVfgc8xr.mjs.map +1 -0
- package/dist/{resvg-js-V6oMi8CY.mjs → resvg-js-Cwipz-_J.mjs} +1 -1
- package/dist/{resvg-js-V6oMi8CY.mjs.map → resvg-js-Cwipz-_J.mjs.map} +1 -1
- package/dist/runtime.d.mts +2 -2
- package/dist/runtime.mjs +3 -3
- package/dist/{spinner-Cgej6Vnb.d.mts → spinner-BRkaJI0N.d.mts} +2 -2
- package/dist/{spinner-Cgej6Vnb.d.mts.map → spinner-BRkaJI0N.d.mts.map} +1 -1
- package/dist/{spinner-DSByknyx.mjs → spinner-BmldKx0M.mjs} +3 -3
- package/dist/{spinner-DSByknyx.mjs.map → spinner-BmldKx0M.mjs.map} +1 -1
- package/dist/{src-C9f3hiVG.mjs → src-C0sOQW-t.mjs} +402 -156
- package/dist/src-C0sOQW-t.mjs.map +1 -0
- package/dist/src-CJPXf3fC.mjs +18348 -0
- package/dist/src-CJPXf3fC.mjs.map +1 -0
- package/dist/{src-fJVbhdn-.mjs → src-D8kLrQBT.mjs} +1 -1
- package/dist/{src-fJVbhdn-.mjs.map → src-D8kLrQBT.mjs.map} +1 -1
- package/dist/{src-9B5k0JmY.mjs → src-D_BS-as7.mjs} +1130 -100
- package/dist/src-D_BS-as7.mjs.map +1 -0
- package/dist/theme.d.mts +45 -30
- package/dist/theme.d.mts.map +1 -1
- package/dist/theme.mjs +3 -3
- package/dist/{types-CDgkE-Rw.d.mts → types-B4A8Ebba.d.mts} +1 -1
- package/dist/{types-CDgkE-Rw.d.mts.map → types-B4A8Ebba.d.mts.map} +1 -1
- package/dist/types-e4dpfbSa.mjs +468 -0
- package/dist/types-e4dpfbSa.mjs.map +1 -0
- package/dist/ui/animation.d.mts +1 -1
- package/dist/ui/animation.mjs +1 -1
- package/dist/ui/ansi.d.mts +1 -1
- package/dist/ui/ansi.mjs +1 -1
- package/dist/ui/cli.d.mts +3 -3
- package/dist/ui/cli.mjs +5 -5
- package/dist/ui/display.d.mts +2 -2
- package/dist/ui/display.mjs +1 -1
- package/dist/ui/display.mjs.map +1 -1
- package/dist/ui/image.d.mts +1 -1
- package/dist/ui/image.mjs +1 -1
- package/dist/ui/input.d.mts +3 -3
- package/dist/ui/input.mjs +2 -2
- package/dist/ui/input.mjs.map +1 -1
- package/dist/ui/progress.d.mts +3 -3
- package/dist/ui/progress.mjs +4 -4
- package/dist/ui/progress.mjs.map +1 -1
- package/dist/ui/react.d.mts +3 -3
- package/dist/ui/react.mjs +4 -4
- package/dist/ui/react.mjs.map +1 -1
- package/dist/ui/utils.mjs +1 -1
- package/dist/ui/wrappers.d.mts +2 -2
- package/dist/ui/wrappers.mjs +1 -1
- package/dist/ui.d.mts +5 -5
- package/dist/ui.mjs +6 -6
- package/dist/{useLatest-BMIYXd6e.d.mts → useLatest-6xqnGIU6.d.mts} +1 -1
- package/dist/{useLatest-BMIYXd6e.d.mts.map → useLatest-6xqnGIU6.d.mts.map} +1 -1
- package/dist/{with-text-input-CmHf_9d6.d.mts → with-text-input-lUh9gYAG.d.mts} +3 -3
- package/dist/{with-text-input-CmHf_9d6.d.mts.map → with-text-input-lUh9gYAG.d.mts.map} +1 -1
- package/dist/{wrapper-Dqh0zi2W.mjs → wrapper-CE6GQ27z.mjs} +1 -1
- package/dist/{wrapper-Dqh0zi2W.mjs.map → wrapper-CE6GQ27z.mjs.map} +1 -1
- package/dist/{wrappers-hhL8EQ_n.mjs → wrappers-JrEYTuKA.mjs} +4 -4
- package/dist/wrappers-JrEYTuKA.mjs.map +1 -0
- package/dist/yoga-adapter-B8LZpQcE.mjs +2 -0
- package/dist/{yoga-adapter-BJ9SOhTY.mjs → yoga-adapter-Bc8XT9cN.mjs} +11 -2
- package/dist/yoga-adapter-Bc8XT9cN.mjs.map +1 -0
- package/package.json +20 -17
- package/dist/apng-DCWY913R.mjs +0 -3
- package/dist/backends-CyJqNLeK.mjs +0 -3
- package/dist/cli-B-k7Bm56.mjs +0 -4
- package/dist/derive-D7bFJdfU.d.mts.map +0 -1
- package/dist/devtools-DS9NseGT.mjs +0 -2
- package/dist/flexily-zero-adapter-DmG4Ge8t.mjs.map +0 -1
- package/dist/gif-BaJNREpP.mjs +0 -3
- package/dist/image-Dx7gYjkq.mjs.map +0 -1
- package/dist/index-CBcSpGSM.d.mts +0 -3416
- package/dist/index-CBcSpGSM.d.mts.map +0 -1
- package/dist/index-DCVL3jHo.d.mts.map +0 -1
- package/dist/pipeline-BmfaZb1O.mjs.map +0 -1
- package/dist/reconciler-B-NaZvbO.mjs.map +0 -1
- package/dist/render-string-Bvh1XzBv.mjs +0 -201
- package/dist/render-string-Bvh1XzBv.mjs.map +0 -1
- package/dist/runtime-PH2xY1DM.mjs +0 -8723
- package/dist/runtime-PH2xY1DM.mjs.map +0 -1
- package/dist/src-9B5k0JmY.mjs.map +0 -1
- package/dist/src-C9f3hiVG.mjs.map +0 -1
- package/dist/types-Bhj5QkIQ.mjs +0 -13
- package/dist/types-Bhj5QkIQ.mjs.map +0 -1
- package/dist/useLayout-BG2cGl15.mjs +0 -139
- package/dist/useLayout-BG2cGl15.mjs.map +0 -1
- package/dist/wrappers-hhL8EQ_n.mjs.map +0 -1
- package/dist/yoga-adapter-BJ9SOhTY.mjs.map +0 -1
- package/dist/yoga-adapter-Daq6-dw1.mjs +0 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"eta-
|
|
1
|
+
{"version":3,"file":"eta-BnQSZcWf.mjs","names":[],"sources":["../packages/ag-react/src/ui/utils/eta.ts"],"sourcesContent":["/**\n * Shared ETA calculation utilities\n */\n\n/** Sample point for ETA calculation */\nexport interface ETASample {\n time: number\n value: number\n}\n\n/** ETA calculation result */\nexport interface ETAResult {\n /** Estimated seconds remaining, or null if insufficient data */\n seconds: number | null\n /** Formatted ETA string (e.g., \"1:30\", \"2:15:30\", \"--:--\") */\n formatted: string\n}\n\n/**\n * Calculate ETA from a buffer of samples\n *\n * @param buffer - Array of {time, value} samples\n * @param current - Current progress value\n * @param total - Total target value\n * @returns ETA in seconds (null if insufficient data)\n *\n * @example\n * ```ts\n * const buffer = [\n * { time: 1000, value: 0 },\n * { time: 2000, value: 10 },\n * ];\n * const eta = calculateETA(buffer, 10, 100);\n * // eta = 9 (9 seconds remaining at 10 items/sec)\n * ```\n */\nexport function calculateETA(buffer: ETASample[], current: number, total: number): number | null {\n if (buffer.length < 2) {\n return null\n }\n\n const first = buffer[0]!\n const last = buffer[buffer.length - 1]!\n\n const elapsed = (last.time - first.time) / 1000 // seconds\n const progress = last.value - first.value\n\n if (elapsed <= 0 || progress <= 0) {\n return null\n }\n\n const rate = progress / elapsed // items per second\n const remaining = total - current\n\n return remaining / rate\n}\n\n/**\n * Format ETA seconds as human-readable string\n *\n * @param eta - ETA in seconds (null for unknown)\n * @returns Formatted string (e.g., \"1:30\", \"2:15:30\", \"--:--\", \">1d\")\n *\n * @example\n * ```ts\n * formatETA(90) // \"1:30\"\n * formatETA(3665) // \"1:01:05\"\n * formatETA(null) // \"--:--\"\n * formatETA(100000) // \">1d\"\n * ```\n */\nexport function formatETA(eta: number | null): string {\n if (eta === null || !isFinite(eta)) {\n return \"--:--\"\n }\n\n if (eta > 86400) {\n // > 24 hours\n return \">1d\"\n }\n\n const hours = Math.floor(eta / 3600)\n const minutes = Math.floor((eta % 3600) / 60)\n const seconds = Math.floor(eta % 60)\n\n if (hours > 0) {\n return `${hours}:${minutes.toString().padStart(2, \"0\")}:${seconds.toString().padStart(2, \"0\")}`\n }\n\n return `${minutes}:${seconds.toString().padStart(2, \"0\")}`\n}\n\n/**\n * Calculate and format ETA in one call\n *\n * @param buffer - Array of {time, value} samples\n * @param current - Current progress value\n * @param total - Total target value\n * @returns Object with seconds (number|null) and formatted string\n */\nexport function getETA(buffer: ETASample[], current: number, total: number): ETAResult {\n const seconds = calculateETA(buffer, current, total)\n return {\n seconds,\n formatted: formatETA(seconds),\n }\n}\n\n/** Default buffer size for ETA smoothing */\nexport const DEFAULT_ETA_BUFFER_SIZE = 10\n\n/**\n * Create an ETA tracker with automatic buffer management\n *\n * @param bufferSize - Number of samples to keep (default: 10)\n * @returns ETA tracker object\n *\n * @example\n * ```ts\n * const tracker = createETATracker();\n * tracker.record(0);\n * // ... later ...\n * tracker.record(50);\n * const eta = tracker.getETA(50, 100);\n * console.log(eta.formatted); // \"0:30\"\n * ```\n */\nexport function createETATracker(bufferSize = DEFAULT_ETA_BUFFER_SIZE) {\n const buffer: ETASample[] = []\n\n return {\n /** Record a new sample */\n record(value: number): void {\n buffer.push({ time: Date.now(), value })\n if (buffer.length > bufferSize) {\n buffer.shift()\n }\n },\n\n /** Get current ETA */\n getETA(current: number, total: number): ETAResult {\n return getETA(buffer, current, total)\n },\n\n /** Reset the buffer */\n reset(): void {\n buffer.length = 0\n },\n\n /** Get buffer for external use */\n getBuffer(): readonly ETASample[] {\n return buffer\n },\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAoCA,SAAgB,aAAa,QAAqB,SAAiB,OAA8B;AAC/F,KAAI,OAAO,SAAS,EAClB,QAAO;CAGT,MAAM,QAAQ,OAAO;CACrB,MAAM,OAAO,OAAO,OAAO,SAAS;CAEpC,MAAM,WAAW,KAAK,OAAO,MAAM,QAAQ;CAC3C,MAAM,WAAW,KAAK,QAAQ,MAAM;AAEpC,KAAI,WAAW,KAAK,YAAY,EAC9B,QAAO;CAGT,MAAM,OAAO,WAAW;AAGxB,SAFkB,QAAQ,WAEP;;;;;;;;;;;;;;;;AAiBrB,SAAgB,UAAU,KAA4B;AACpD,KAAI,QAAQ,QAAQ,CAAC,SAAS,IAAI,CAChC,QAAO;AAGT,KAAI,MAAM,MAER,QAAO;CAGT,MAAM,QAAQ,KAAK,MAAM,MAAM,KAAK;CACpC,MAAM,UAAU,KAAK,MAAO,MAAM,OAAQ,GAAG;CAC7C,MAAM,UAAU,KAAK,MAAM,MAAM,GAAG;AAEpC,KAAI,QAAQ,EACV,QAAO,GAAG,MAAM,GAAG,QAAQ,UAAU,CAAC,SAAS,GAAG,IAAI,CAAC,GAAG,QAAQ,UAAU,CAAC,SAAS,GAAG,IAAI;AAG/F,QAAO,GAAG,QAAQ,GAAG,QAAQ,UAAU,CAAC,SAAS,GAAG,IAAI;;;;;;;;;;AAW1D,SAAgB,OAAO,QAAqB,SAAiB,OAA0B;CACrF,MAAM,UAAU,aAAa,QAAQ,SAAS,MAAM;AACpD,QAAO;EACL;EACA,WAAW,UAAU,QAAQ;EAC9B;;;AAIH,MAAa,0BAA0B;;;;;;;;;;;;;;;;;AAkBvC,SAAgB,iBAAiB,aAAA,IAAsC;CACrE,MAAM,SAAsB,EAAE;AAE9B,QAAO;EAEL,OAAO,OAAqB;AAC1B,UAAO,KAAK;IAAE,MAAM,KAAK,KAAK;IAAE;IAAO,CAAC;AACxC,OAAI,OAAO,SAAS,WAClB,QAAO,OAAO;;EAKlB,OAAO,SAAiB,OAA0B;AAChD,UAAO,OAAO,QAAQ,SAAS,MAAM;;EAIvC,QAAc;AACZ,UAAO,SAAS;;EAIlB,YAAkC;AAChC,UAAO;;EAEV"}
|
|
@@ -169,7 +169,7 @@ function applyMinMax(size, min, max, available) {
|
|
|
169
169
|
let _logger = null;
|
|
170
170
|
async function createFallbackLogger(namespace) {
|
|
171
171
|
try {
|
|
172
|
-
const { default: createDebug } = await import("./src-
|
|
172
|
+
const { default: createDebug } = await import("./src-D8kLrQBT.mjs").then((m) => /* @__PURE__ */ __toESM(m.default, 1));
|
|
173
173
|
const debug = createDebug(namespace);
|
|
174
174
|
return { debug: debug.enabled ? debug : void 0 };
|
|
175
175
|
} catch {
|
|
@@ -898,6 +898,7 @@ function layoutNode(node, availableWidth, availableHeight, offsetX, offsetY, abs
|
|
|
898
898
|
const borderRight = resolveEdgeBorderValue(style.border, 2, style.flexDirection, direction);
|
|
899
899
|
const borderBottom = resolveEdgeBorderValue(style.border, 3, style.flexDirection, direction);
|
|
900
900
|
let nodeWidth;
|
|
901
|
+
const isFitContentWidth = style.width.unit === 4 || style.width.unit === 5;
|
|
901
902
|
if (style.width.unit === 1) nodeWidth = style.width.value;
|
|
902
903
|
else if (style.width.unit === 2) nodeWidth = resolveValue(style.width, availableWidth);
|
|
903
904
|
else if (Number.isNaN(availableWidth)) nodeWidth = NaN;
|
|
@@ -942,13 +943,14 @@ function layoutNode(node, availableWidth, availableHeight, offsetX, offsetY, abs
|
|
|
942
943
|
}
|
|
943
944
|
if (node.hasMeasureFunc() && node.children.length === 0) {
|
|
944
945
|
const widthIsAuto = style.width.unit === 3 || style.width.unit === 0 || Number.isNaN(nodeWidth);
|
|
946
|
+
const widthIsFitContent = isFitContentWidth;
|
|
945
947
|
const heightIsAuto = style.height.unit === 3 || style.height.unit === 0 || Number.isNaN(nodeHeight);
|
|
946
|
-
const widthMode = widthIsAuto ? 2 : 1;
|
|
948
|
+
const widthMode = widthIsAuto || widthIsFitContent ? 2 : 1;
|
|
947
949
|
const heightMode = heightIsAuto ? 0 : 1;
|
|
948
950
|
const measureWidth = Number.isNaN(contentWidth) ? Infinity : contentWidth;
|
|
949
951
|
const measureHeight = Number.isNaN(contentHeight) ? Infinity : contentHeight;
|
|
950
952
|
const measured = node.cachedMeasure(measureWidth, widthMode, measureHeight, heightMode);
|
|
951
|
-
if (widthIsAuto) nodeWidth = measured.width + innerLeft + innerRight;
|
|
953
|
+
if (widthIsAuto || widthIsFitContent) nodeWidth = measured.width + innerLeft + innerRight;
|
|
952
954
|
if (heightIsAuto) nodeHeight = measured.height + innerTop + innerBottom;
|
|
953
955
|
layout.width = Math.round(nodeWidth);
|
|
954
956
|
layout.height = Math.round(nodeHeight);
|
|
@@ -957,7 +959,7 @@ function layoutNode(node, availableWidth, availableHeight, offsetX, offsetY, abs
|
|
|
957
959
|
return;
|
|
958
960
|
}
|
|
959
961
|
if (node.children.length === 0) {
|
|
960
|
-
if (Number.isNaN(nodeWidth)) nodeWidth = innerLeft + innerRight;
|
|
962
|
+
if (Number.isNaN(nodeWidth) || isFitContentWidth) nodeWidth = innerLeft + innerRight;
|
|
961
963
|
if (Number.isNaN(nodeHeight)) nodeHeight = innerTop + innerBottom;
|
|
962
964
|
layout.width = Math.round(nodeWidth);
|
|
963
965
|
layout.height = Math.round(nodeHeight);
|
|
@@ -1044,6 +1046,8 @@ function layoutNode(node, availableWidth, availableHeight, offsetX, offsetY, abs
|
|
|
1044
1046
|
let shrink = childStyle.flexShrink;
|
|
1045
1047
|
if (childStyle.overflow !== 0) shrink = Math.max(shrink, 1);
|
|
1046
1048
|
if (child.hasMeasureFunc() && childStyle.flexGrow > 0) shrink = Math.max(shrink, 1);
|
|
1049
|
+
const mainDim = isRow ? childStyle.width : childStyle.height;
|
|
1050
|
+
if (mainDim.unit === 4 || mainDim.unit === 5) shrink = Math.max(shrink, 1);
|
|
1047
1051
|
cflex.flexShrink = shrink;
|
|
1048
1052
|
cflex.baseSize = baseSize;
|
|
1049
1053
|
cflex.mainSize = baseSize;
|
|
@@ -1357,6 +1361,7 @@ function layoutNode(node, availableWidth, availableHeight, offsetX, offsetY, abs
|
|
|
1357
1361
|
const parentHasDefiniteCross = parentCrossDim.unit === 1 || parentCrossDim.unit === 2 || !Number.isNaN(crossAxisSize);
|
|
1358
1362
|
if (crossDim.unit === 1) childCrossSize = crossDim.value;
|
|
1359
1363
|
else if (crossDim.unit === 2) childCrossSize = resolveValue(crossDim, crossAxisSize);
|
|
1364
|
+
else if (crossDim.unit === 4 || crossDim.unit === 5) childCrossSize = NaN;
|
|
1360
1365
|
else if (parentHasDefiniteCross && alignment === 4) childCrossSize = (numLines > 1 ? savedLineCrossSizes ? savedLineCrossSizes[childLineIdx] : _lineCrossSizes[childLineIdx] : crossAxisSize) - crossMargin;
|
|
1361
1366
|
else childCrossSize = NaN;
|
|
1362
1367
|
const crossMinVal = isRow ? childStyle.minHeight : childStyle.minWidth;
|
|
@@ -1451,12 +1456,13 @@ function layoutNode(node, availableWidth, availableHeight, offsetX, offsetY, abs
|
|
|
1451
1456
|
const childLeft = posRound(fractionalLeft + posOffsetX);
|
|
1452
1457
|
const childTop = posRound(fractionalTop + posOffsetY);
|
|
1453
1458
|
const crossDimForLayoutCall = isRow ? childStyle.height : childStyle.width;
|
|
1454
|
-
const crossIsAutoForLayoutCall = crossDimForLayoutCall.unit === 3 || crossDimForLayoutCall.unit === 0;
|
|
1459
|
+
const crossIsAutoForLayoutCall = crossDimForLayoutCall.unit === 3 || crossDimForLayoutCall.unit === 0 || crossDimForLayoutCall.unit === 4 || crossDimForLayoutCall.unit === 5;
|
|
1455
1460
|
const mainIsPercentForLayoutCall = (isRow ? childStyle.width : childStyle.height).unit === 2;
|
|
1456
1461
|
const crossIsPercentForLayoutCall = crossDimForLayoutCall.unit === 2;
|
|
1457
1462
|
const flexDistChanged = child.flex.mainSize !== child.flex.baseSize;
|
|
1458
1463
|
const hasMeasureLeaf = child.hasMeasureFunc() && child.children.length === 0;
|
|
1459
|
-
|
|
1464
|
+
const crossIsFitContent = crossDimForLayoutCall.unit === 4 || crossDimForLayoutCall.unit === 5;
|
|
1465
|
+
layoutNode(child, isRow && mainIsAutoChild && !hasFlexGrow && !flexDistChanged && !hasMeasureLeaf ? NaN : !isRow && crossIsAutoForLayoutCall && !parentHasDefiniteCross && !crossIsFitContent ? NaN : isRow && mainIsPercentForLayoutCall ? mainAxisSize : !isRow && crossIsPercentForLayoutCall ? crossAxisSize : !isRow && crossIsFitContent ? crossAxisSize : childWidth, !isRow && mainIsAutoChild && !hasFlexGrow && !flexDistChanged && !hasMeasureLeaf ? NaN : isRow && crossIsAutoForLayoutCall && !parentHasDefiniteCross && !crossIsFitContent ? NaN : !isRow && mainIsPercentForLayoutCall ? mainAxisSize : isRow && crossIsPercentForLayoutCall ? crossAxisSize : isRow && crossIsFitContent ? crossAxisSize : childHeight, childLeft, childTop, absChildLeft - childMarginLeft, absChildTop - childMarginTop, direction);
|
|
1460
1466
|
if (childWidth < childMinW) childWidth = childMinW;
|
|
1461
1467
|
if (childHeight < childMinH) childHeight = childMinH;
|
|
1462
1468
|
const hasMeasure = child.hasMeasureFunc() && child.children.length === 0;
|
|
@@ -1469,10 +1475,11 @@ function layoutNode(node, availableWidth, availableHeight, offsetX, offsetY, abs
|
|
|
1469
1475
|
child.layout.height = edgeBasedMainSize;
|
|
1470
1476
|
}
|
|
1471
1477
|
const crossDimForCheck = isRow ? childStyle.height : childStyle.width;
|
|
1472
|
-
const
|
|
1478
|
+
const crossDimIsFitContent = crossDimForCheck.unit === 4 || crossDimForCheck.unit === 5;
|
|
1479
|
+
const crossIsAuto = crossDimForCheck.unit === 3 || crossDimForCheck.unit === 0 || crossDimIsFitContent;
|
|
1473
1480
|
const parentCrossIsAuto = !parentHasDefiniteCross;
|
|
1474
1481
|
const hasCrossMinMax = crossMinVal.unit !== 0 || crossMaxVal.unit !== 0;
|
|
1475
|
-
if (!crossIsAuto || !parentCrossIsAuto && alignment === 4 || hasCrossMinMax && !Number.isNaN(childCrossSize)) if (isRow) child.layout.height = Math.round(childHeight);
|
|
1482
|
+
if (!crossIsAuto || !crossDimIsFitContent && !parentCrossIsAuto && alignment === 4 || hasCrossMinMax && !Number.isNaN(childCrossSize)) if (isRow) child.layout.height = Math.round(childHeight);
|
|
1476
1483
|
else child.layout.width = Math.round(childWidth);
|
|
1477
1484
|
child.layout.left = childLeft;
|
|
1478
1485
|
child.layout.top = childTop;
|
|
@@ -1541,6 +1548,10 @@ function layoutNode(node, availableWidth, availableHeight, offsetX, offsetY, abs
|
|
|
1541
1548
|
if (isRow && style.height.unit !== 1 && style.height.unit !== 2 && Number.isNaN(availableHeight) && !hasAR) nodeHeight = totalCrossSize + innerTop + innerBottom;
|
|
1542
1549
|
if (!isRow && style.width.unit !== 1 && style.width.unit !== 2 && Number.isNaN(availableWidth) && !hasAR) nodeWidth = totalCrossSize + innerLeft + innerRight;
|
|
1543
1550
|
}
|
|
1551
|
+
if (isFitContentWidth && !Number.isNaN(nodeWidth) && !Number.isNaN(availableWidth)) {
|
|
1552
|
+
const availForNode = availableWidth - marginLeft - marginRight;
|
|
1553
|
+
if (availForNode >= 0 && nodeWidth > availForNode) nodeWidth = availForNode;
|
|
1554
|
+
}
|
|
1544
1555
|
nodeWidth = applyMinMax(nodeWidth, style.minWidth, style.maxWidth, availableWidth);
|
|
1545
1556
|
nodeHeight = applyMinMax(nodeHeight, style.minHeight, style.maxHeight, availableHeight);
|
|
1546
1557
|
if (!Number.isNaN(nodeWidth) && nodeWidth < minInnerWidth) nodeWidth = minInnerWidth;
|
|
@@ -2512,6 +2523,38 @@ var Node = class Node {
|
|
|
2512
2523
|
this.markDirty();
|
|
2513
2524
|
}
|
|
2514
2525
|
/**
|
|
2526
|
+
* Set the width to fit-content mode.
|
|
2527
|
+
*
|
|
2528
|
+
* CSS fit-content = min(max-content, max(min-content, available-width)).
|
|
2529
|
+
* For terminals: min(max-content, available-width) since min-content
|
|
2530
|
+
* floor is rarely relevant.
|
|
2531
|
+
*
|
|
2532
|
+
* The layout algorithm measures unconstrained content width (max-content),
|
|
2533
|
+
* then clamps to the available width from the parent.
|
|
2534
|
+
*/
|
|
2535
|
+
setWidthFitContent() {
|
|
2536
|
+
this._style.width = {
|
|
2537
|
+
value: 0,
|
|
2538
|
+
unit: 4
|
|
2539
|
+
};
|
|
2540
|
+
this.markDirty();
|
|
2541
|
+
}
|
|
2542
|
+
/**
|
|
2543
|
+
* Set the width to snug-content mode.
|
|
2544
|
+
*
|
|
2545
|
+
* Like fit-content but signals that the consumer wants the tightest
|
|
2546
|
+
* possible width (binary-search shrinkwrap). The layout engine treats
|
|
2547
|
+
* this identically to fit-content for sizing; the consuming framework
|
|
2548
|
+
* (e.g., silvery) can further tighten via its own binary search.
|
|
2549
|
+
*/
|
|
2550
|
+
setWidthSnugContent() {
|
|
2551
|
+
this._style.width = {
|
|
2552
|
+
value: 0,
|
|
2553
|
+
unit: 5
|
|
2554
|
+
};
|
|
2555
|
+
this.markDirty();
|
|
2556
|
+
}
|
|
2557
|
+
/**
|
|
2515
2558
|
* Set the height to a fixed value in points.
|
|
2516
2559
|
*
|
|
2517
2560
|
* @param value - Height in points
|
|
@@ -3176,6 +3219,9 @@ var FlexilyZeroNodeAdapter = class {
|
|
|
3176
3219
|
markDirty() {
|
|
3177
3220
|
this.node.markDirty();
|
|
3178
3221
|
}
|
|
3222
|
+
isDirty() {
|
|
3223
|
+
return this.node.isDirty();
|
|
3224
|
+
}
|
|
3179
3225
|
measureModeToString(mode) {
|
|
3180
3226
|
if (mode === 1) return "exactly";
|
|
3181
3227
|
if (mode === 2) return "at-most";
|
|
@@ -3190,6 +3236,12 @@ var FlexilyZeroNodeAdapter = class {
|
|
|
3190
3236
|
setWidthAuto() {
|
|
3191
3237
|
this.node.setWidthAuto();
|
|
3192
3238
|
}
|
|
3239
|
+
setWidthFitContent() {
|
|
3240
|
+
this.node.setWidthFitContent();
|
|
3241
|
+
}
|
|
3242
|
+
setWidthSnugContent() {
|
|
3243
|
+
this.node.setWidthSnugContent();
|
|
3244
|
+
}
|
|
3193
3245
|
setHeight(value) {
|
|
3194
3246
|
this.node.setHeight(value);
|
|
3195
3247
|
}
|
|
@@ -3373,4 +3425,4 @@ function createFlexilyZeroEngine() {
|
|
|
3373
3425
|
//#endregion
|
|
3374
3426
|
export { createFlexilyZeroEngine as n, FlexilyZeroLayoutEngine as t };
|
|
3375
3427
|
|
|
3376
|
-
//# sourceMappingURL=flexily-zero-adapter-
|
|
3428
|
+
//# sourceMappingURL=flexily-zero-adapter-BOM0cl8R.mjs.map
|