open-grid 1.2.0 → 1.3.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/CHANGELOG.md +376 -353
- package/README.md +1 -1
- package/dist/OpenGrid-B7m7ei7f.cjs +7385 -0
- package/dist/OpenGrid-CeUdO_fM.js +7398 -0
- package/dist/index-CeJ-0-80.cjs +260 -0
- package/dist/index-DnarQ4eR.js +266 -0
- package/dist/index-DrCPRuYi.js +548 -0
- package/dist/index-JjfWY3Bt.cjs +520 -0
- package/dist/open-grid-base.css +12 -1
- package/dist/open-grid-react.cjs +27 -1
- package/dist/open-grid-react.js +22 -82
- package/dist/open-grid-vue.cjs +31 -1
- package/dist/open-grid-vue.js +29 -79
- package/dist/open-grid.cjs +272 -6
- package/dist/open-grid.js +177 -266
- package/dist/types/bench/perf.d.ts +14 -8
- package/dist/types/core/AppearanceResolver.d.ts +98 -11
- package/dist/types/core/CFRenderBridge.d.ts +13 -0
- package/dist/types/core/CellEditManager.d.ts +73 -0
- package/dist/types/core/CellEventHandler.d.ts +99 -2
- package/dist/types/core/CellTypeRegistry.d.ts +24 -0
- package/dist/types/core/ChartManager.d.ts +51 -3
- package/dist/types/core/ColumnLayout.d.ts +100 -2
- package/dist/types/core/ContextMenu.d.ts +43 -2
- package/dist/types/core/CrossGridController.d.ts +86 -15
- package/dist/types/core/CrossGridMapper.d.ts +43 -5
- package/dist/types/core/CrossGridRegistry.d.ts +36 -2
- package/dist/types/core/DataLayer.d.ts +210 -15
- package/dist/types/core/DetailManager.d.ts +106 -15
- package/dist/types/core/DragVisuals.d.ts +33 -4
- package/dist/types/core/EventEmitter.d.ts +54 -0
- package/dist/types/core/ExportManager.d.ts +66 -1
- package/dist/types/core/ExtensionPointRegistry.d.ts +160 -14
- package/dist/types/core/FilterPanel.d.ts +17 -2
- package/dist/types/core/FilterSelect.d.ts +37 -13
- package/dist/types/core/FindBarManager.d.ts +26 -0
- package/dist/types/core/FlatRowModel.d.ts +54 -11
- package/dist/types/core/FooterManager.d.ts +53 -1
- package/dist/types/core/FormulaController.d.ts +139 -10
- package/dist/types/core/FormulaEngine.d.ts +15 -4
- package/dist/types/core/GridComposer.d.ts +54 -6
- package/dist/types/core/GridRenderer.d.ts +143 -10
- package/dist/types/core/GridShuttle.d.ts +44 -4
- package/dist/types/core/GroupEngine.d.ts +68 -10
- package/dist/types/core/GroupTreeManager.d.ts +86 -2
- package/dist/types/core/IconRegistry.d.ts +56 -9
- package/dist/types/core/KeyboardManager.d.ts +88 -4
- package/dist/types/core/MaskingEngine.d.ts +10 -9
- package/dist/types/core/MathUtils.d.ts +58 -5
- package/dist/types/core/MergeEngine.d.ts +45 -10
- package/dist/types/core/MutationService.d.ts +113 -10
- package/dist/types/core/OGDecimal.d.ts +144 -13
- package/dist/types/core/OpenGrid.d.ts +99 -0
- package/dist/types/core/OrgChart.d.ts +56 -1
- package/dist/types/core/OverrideKernel.d.ts +59 -15
- package/dist/types/core/Pagination.d.ts +38 -4
- package/dist/types/core/PivotEngine.d.ts +37 -0
- package/dist/types/core/RangeSelectionManager.d.ts +121 -7
- package/dist/types/core/RenderController.d.ts +56 -0
- package/dist/types/core/RowDragDrop.d.ts +52 -6
- package/dist/types/core/RowManager.d.ts +55 -0
- package/dist/types/core/SkinRegistry.d.ts +55 -15
- package/dist/types/core/SortFilterManager.d.ts +80 -1
- package/dist/types/core/TreeEngine.d.ts +60 -6
- package/dist/types/core/TriggerManager.d.ts +46 -0
- package/dist/types/core/VirtualScroll.d.ts +64 -0
- package/dist/types/core/WorksheetManager.d.ts +61 -2
- package/dist/types/core/XmlConverter.d.ts +56 -23
- package/dist/types/core/a11y/AccessibilityAdapter.d.ts +103 -0
- package/dist/types/core/a11y/AriaIntent.d.ts +34 -0
- package/dist/types/core/a11y/KeyboardInteractionModel.d.ts +64 -0
- package/dist/types/core/a11y/LiveRegionController.d.ts +89 -0
- package/dist/types/core/a11y/OverlayStack.d.ts +36 -0
- package/dist/types/core/a11y/VisualEquivRegistry.d.ts +37 -0
- package/dist/types/core/a11y/index.d.ts +13 -0
- package/dist/types/core/a11y/ports.d.ts +24 -0
- package/dist/types/core/appearance/Appearance.d.ts +68 -0
- package/dist/types/core/appearance/AppearanceAxis.d.ts +94 -0
- package/dist/types/core/appearance/AppearanceComposer.d.ts +45 -0
- package/dist/types/core/appearance/AppearanceProvider.d.ts +50 -0
- package/dist/types/core/appearance/AppearanceView.d.ts +51 -0
- package/dist/types/core/appearance/DensityRegistry.d.ts +36 -0
- package/dist/types/core/appearance/ResolvedAppearanceSnapshot.d.ts +84 -0
- package/dist/types/core/appearance/TextureRegistry.d.ts +32 -0
- package/dist/types/core/appearance/ThemeMetaRegistry.d.ts +67 -0
- package/dist/types/core/appearance/axisAdapters.d.ts +37 -0
- package/dist/types/core/appearance/defaults.d.ts +10 -0
- package/dist/types/core/appearance/index.d.ts +20 -0
- package/dist/types/core/appearance/tokenCatalog.d.ts +30 -0
- package/dist/types/core/cf/CFEngine.d.ts +56 -0
- package/dist/types/core/cf/CFEvaluator.d.ts +24 -0
- package/dist/types/core/cf/CFRule.d.ts +127 -0
- package/dist/types/core/cf/ColorScale.d.ts +49 -0
- package/dist/types/core/cf/InkResolver.d.ts +33 -0
- package/dist/types/core/cf/appearance.d.ts +20 -0
- package/dist/types/core/cf/encoders.d.ts +61 -0
- package/dist/types/core/cf/eval-types.d.ts +93 -0
- package/dist/types/core/cf/index.d.ts +21 -0
- package/dist/types/core/cf/lineage.d.ts +32 -0
- package/dist/types/core/cf/predicates.d.ts +27 -0
- package/dist/types/core/cf/serialize.d.ts +46 -0
- package/dist/types/core/chart/CanvasAdapter.d.ts +50 -1
- package/dist/types/core/chart/DataExtractor.d.ts +53 -12
- package/dist/types/core/chart/a11y.d.ts +22 -0
- package/dist/types/core/chart/chart-type-registry.d.ts +53 -0
- package/dist/types/core/chart/downsample-report.d.ts +36 -0
- package/dist/types/core/chart/downsample.d.ts +26 -1
- package/dist/types/core/chart/engine/ChartEngineRegistry.d.ts +52 -0
- package/dist/types/core/chart/geometry.d.ts +96 -0
- package/dist/types/core/chart/hittest.d.ts +21 -3
- package/dist/types/core/chart/palette.d.ts +96 -12
- package/dist/types/core/chart/parity.d.ts +12 -0
- package/dist/types/core/chart/provenance.d.ts +47 -0
- package/dist/types/core/chart/scales.d.ts +28 -1
- package/dist/types/core/chart/scene.d.ts +102 -0
- package/dist/types/core/chart/server.d.ts +36 -0
- package/dist/types/core/chart/surfaces/CanvasSurface.d.ts +48 -0
- package/dist/types/core/chart/surfaces/ServerRasterSurface.d.ts +26 -0
- package/dist/types/core/chart/surfaces/SvgSurface.d.ts +24 -0
- package/dist/types/core/chart/surfaces/pattern-overlay.d.ts +24 -0
- package/dist/types/core/chart/types.d.ts +107 -10
- package/dist/types/core/command/CommandBus.d.ts +51 -0
- package/dist/types/core/command/CommandRegistry.d.ts +43 -0
- package/dist/types/core/command/CommandStack.d.ts +38 -0
- package/dist/types/core/command/ICommand.d.ts +110 -0
- package/dist/types/core/command/commands/CellWriteCommand.d.ts +32 -0
- package/dist/types/core/command/commands/CompositeCommand.d.ts +17 -0
- package/dist/types/core/command/commands/RowCommands.d.ts +39 -0
- package/dist/types/core/command/index.d.ts +9 -0
- package/dist/types/core/command/support.d.ts +51 -0
- package/dist/types/core/coordinate/ColumnMetrics.d.ts +30 -0
- package/dist/types/core/coordinate/CoordinateKernel.d.ts +88 -0
- package/dist/types/core/coordinate/FrozenPanes.d.ts +29 -0
- package/dist/types/core/coordinate/MergeSourceAdapter.d.ts +18 -0
- package/dist/types/core/coordinate/NodeBudget.d.ts +33 -0
- package/dist/types/core/coordinate/ResizeGovernor.d.ts +50 -0
- package/dist/types/core/coordinate/RowMetrics.d.ts +37 -0
- package/dist/types/core/coordinate/ViewPermutation.d.ts +23 -0
- package/dist/types/core/coordinate/index.d.ts +10 -0
- package/dist/types/core/coordinate/ports.d.ts +45 -0
- package/dist/types/core/coordinate/types.d.ts +76 -0
- package/dist/types/core/detail/DetailGlyph.d.ts +42 -7
- package/dist/types/core/detail/DetailSplice.d.ts +42 -11
- package/dist/types/core/detail/DetailState.d.ts +80 -11
- package/dist/types/core/detail/SubgridCache.d.ts +72 -10
- package/dist/types/core/detail/index.d.ts +8 -0
- package/dist/types/core/domain/AggregateResult.d.ts +54 -0
- package/dist/types/core/domain/CellAddress.d.ts +61 -0
- package/dist/types/core/domain/CellValueAccess.d.ts +29 -0
- package/dist/types/core/domain/Delta.d.ts +37 -0
- package/dist/types/core/domain/DomainValue.d.ts +80 -0
- package/dist/types/core/domain/Missing.d.ts +65 -0
- package/dist/types/core/domain/Money.d.ts +42 -0
- package/dist/types/core/domain/NormalizationBasis.d.ts +47 -0
- package/dist/types/core/domain/Plain.d.ts +45 -0
- package/dist/types/core/domain/Quantity.d.ts +32 -0
- package/dist/types/core/domain/Ratios.d.ts +100 -0
- package/dist/types/core/domain/ThresholdSet.d.ts +46 -0
- package/dist/types/core/domain/ValueType.d.ts +71 -0
- package/dist/types/core/domain/rounding.d.ts +25 -0
- package/dist/types/core/domain/strategies.d.ts +38 -0
- package/dist/types/core/editors/CellEditor.d.ts +29 -2
- package/dist/types/core/editors/DateEditor.d.ts +18 -0
- package/dist/types/core/editors/SelectEditor.d.ts +29 -0
- package/dist/types/core/export/ChannelRegistry.d.ts +18 -0
- package/dist/types/core/export/ExportManifest.d.ts +13 -0
- package/dist/types/core/export/GridArtifactSource.d.ts +62 -0
- package/dist/types/core/export/Provenance.d.ts +34 -0
- package/dist/types/core/export/StreamPump.d.ts +28 -0
- package/dist/types/core/export/channels/CsvChannel.d.ts +20 -0
- package/dist/types/core/export/channels/JsonChannel.d.ts +18 -0
- package/dist/types/core/export/channels/XlsxChannel.d.ts +53 -0
- package/dist/types/core/export/channels/XmlChannel.d.ts +21 -0
- package/dist/types/core/export/channels/capabilities.d.ts +13 -0
- package/dist/types/core/export/index.d.ts +24 -0
- package/dist/types/core/export/print/OutputChannelAdapter.d.ts +61 -0
- package/dist/types/core/export/print/Paginator.d.ts +48 -0
- package/dist/types/core/export/print/PrintRenderTarget.d.ts +36 -0
- package/dist/types/core/export/sinks.d.ts +40 -0
- package/dist/types/core/export/types.d.ts +211 -0
- package/dist/types/core/extension/DeprecationManager.d.ts +42 -0
- package/dist/types/core/extension/IExtension.d.ts +90 -0
- package/dist/types/core/extension/Registry.d.ts +142 -0
- package/dist/types/core/extension/SlotRegistry.d.ts +46 -0
- package/dist/types/core/extension/adapters.d.ts +44 -0
- package/dist/types/core/extension/conformance.d.ts +47 -0
- package/dist/types/core/extension/index.d.ts +16 -0
- package/dist/types/core/extension/registries.d.ts +31 -0
- package/dist/types/core/extension/reserved.d.ts +10 -0
- package/dist/types/core/format/DisplayFormatter.d.ts +47 -0
- package/dist/types/core/format/FormatCache.d.ts +20 -0
- package/dist/types/core/format/FormatterRegistry.d.ts +22 -0
- package/dist/types/core/format/grammar/AstRenderer.d.ts +10 -0
- package/dist/types/core/format/grammar/FormatCompiler.d.ts +16 -0
- package/dist/types/core/format/index.d.ts +55 -0
- package/dist/types/core/format/pipeline/DomainTypeResolver.d.ts +8 -0
- package/dist/types/core/format/pipeline/LocaleFormat.d.ts +11 -0
- package/dist/types/core/format/pipeline/ValueInterpreter.d.ts +8 -0
- package/dist/types/core/format/policy/MaskPolicy.d.ts +8 -0
- package/dist/types/core/format/policy/NegativePolicy.d.ts +12 -0
- package/dist/types/core/format/policy/NullPolicy.d.ts +10 -0
- package/dist/types/core/format/policy/TruncatePolicy.d.ts +11 -0
- package/dist/types/core/format/types.d.ts +292 -0
- package/dist/types/core/formula/CalcCacheStore.d.ts +89 -0
- package/dist/types/core/formula/CalcProvenance.d.ts +44 -0
- package/dist/types/core/formula/CalcService.d.ts +137 -0
- package/dist/types/core/formula/CyclePathReporter.d.ts +28 -0
- package/dist/types/core/formula/FormulaEvaluator.d.ts +35 -1
- package/dist/types/core/formula/FormulaGraph.d.ts +84 -7
- package/dist/types/core/formula/FormulaParser.d.ts +9 -0
- package/dist/types/core/formula/FormulaStore.d.ts +63 -1
- package/dist/types/core/formula/FunctionRegistry.d.ts +138 -0
- package/dist/types/core/formula/Generation.d.ts +86 -0
- package/dist/types/core/formula/RecalcCoordinator.d.ts +151 -9
- package/dist/types/core/formula/ReferenceRewriter.d.ts +81 -0
- package/dist/types/core/formula/functions/essential.d.ts +3 -0
- package/dist/types/core/formula/functions/extended/index.d.ts +10 -0
- package/dist/types/core/formula/normalizeRefs.d.ts +34 -3
- package/dist/types/core/formula/numericLiteral.d.ts +11 -1
- package/dist/types/core/formula/serializeFormula.d.ts +10 -1
- package/dist/types/core/formula/types.d.ts +71 -8
- package/dist/types/core/host/CapabilityRegistry.d.ts +61 -0
- package/dist/types/core/host/GridHostDriver.d.ts +27 -0
- package/dist/types/core/host/GridHostPort.d.ts +37 -0
- package/dist/types/core/host/SliceOwnershipGuard.d.ts +27 -0
- package/dist/types/core/host/archCheck.d.ts +26 -0
- package/dist/types/core/host/index.d.ts +6 -0
- package/dist/types/core/host/reconcile.d.ts +22 -0
- package/dist/types/core/i18n/LocaleContext.d.ts +40 -0
- package/dist/types/core/i18n/types.d.ts +26 -1
- package/dist/types/core/icons/bootstrap-icons.d.ts +4 -2
- package/dist/types/core/quality/ContrastAuditor.d.ts +64 -0
- package/dist/types/core/quality/DeterminismKernel.d.ts +68 -0
- package/dist/types/core/quality/PerfBaseline.d.ts +23 -0
- package/dist/types/core/quality/PerfSpec.d.ts +95 -0
- package/dist/types/core/quality/RealBrowserGate.d.ts +69 -0
- package/dist/types/core/quality/RegressionJudge.d.ts +35 -0
- package/dist/types/core/quality/ReleaseGate.d.ts +94 -0
- package/dist/types/core/quality/VisualRegression.d.ts +74 -0
- package/dist/types/core/quality/hooks.d.ts +53 -0
- package/dist/types/core/quality/index.d.ts +20 -0
- package/dist/types/core/quality/pixelMetrics.d.ts +24 -0
- package/dist/types/core/range/ClipboardCodec.d.ts +46 -4
- package/dist/types/core/range/FillEngine.d.ts +69 -9
- package/dist/types/core/range/RangeModel.d.ts +100 -13
- package/dist/types/core/range/RangeQuery.d.ts +24 -2
- package/dist/types/core/range/types.d.ts +27 -11
- package/dist/types/core/realtime/BackpressureScheduler.d.ts +0 -0
- package/dist/types/core/realtime/FreshnessClock.d.ts +34 -0
- package/dist/types/core/realtime/IRealtimeSource.d.ts +82 -0
- package/dist/types/core/realtime/LiveStateGuard.d.ts +23 -0
- package/dist/types/core/realtime/PollingSource.d.ts +42 -0
- package/dist/types/core/realtime/RealtimeController.d.ts +54 -0
- package/dist/types/core/realtime/RtAnnouncePolicy.d.ts +53 -0
- package/dist/types/core/realtime/RtApplyCommand.d.ts +29 -0
- package/dist/types/core/realtime/RtChartTargetTrigger.d.ts +26 -0
- package/dist/types/core/realtime/StreamingSource.d.ts +47 -0
- package/dist/types/core/realtime/backoff.d.ts +12 -0
- package/dist/types/core/realtime/index.d.ts +13 -0
- package/dist/types/core/realtime/ports.d.ts +80 -0
- package/dist/types/core/render/CellApplier.d.ts +18 -0
- package/dist/types/core/render/CellErrorBoundary.d.ts +65 -0
- package/dist/types/core/render/CellPipeline.d.ts +39 -0
- package/dist/types/core/render/CellRenderRequest.d.ts +209 -0
- package/dist/types/core/render/CellStageRegistry.d.ts +53 -0
- package/dist/types/core/render/OverlayCompositor.d.ts +38 -0
- package/dist/types/core/render/RenderBudget.d.ts +67 -0
- package/dist/types/core/render/contrast.d.ts +33 -0
- package/dist/types/core/render/index.d.ts +35 -0
- package/dist/types/core/render/stages/BackgroundStage.d.ts +14 -0
- package/dist/types/core/render/stages/DecoratorStage.d.ts +12 -0
- package/dist/types/core/render/stages/OverlayStage.d.ts +12 -0
- package/dist/types/core/render/stages/ValueRendererStage.d.ts +15 -0
- package/dist/types/core/render/stages/index.d.ts +14 -0
- package/dist/types/core/renderers/CellRenderer.d.ts +100 -8
- package/dist/types/core/state/AutosaveController.d.ts +63 -0
- package/dist/types/core/state/IStatePersistence.d.ts +59 -0
- package/dist/types/core/state/MultiTabGuard.d.ts +33 -0
- package/dist/types/core/state/SchemaMigrator.d.ts +33 -0
- package/dist/types/core/state/SemVerPolicy.d.ts +39 -0
- package/dist/types/core/state/StateCodec.d.ts +75 -0
- package/dist/types/core/state/index.d.ts +6 -0
- package/dist/types/core/types.d.ts +17 -0
- package/dist/types/react/OpenGrid.d.ts +54 -0
- package/dist/types/react/index.d.ts +5 -0
- package/dist/types/realtime/index.d.ts +1 -0
- package/dist/types/vue/index.d.ts +5 -0
- package/dist/types/vue/types.d.ts +35 -0
- package/dist/xlsx.min-BQ1o3sB6.cjs +11793 -0
- package/dist/{xlsx.min-Wavxcamn.js → xlsx.min-Bbz2ZypC.js} +453 -566
- package/package.json +112 -110
- package/dist/OpenGrid-B0Spm0rU.js +0 -10404
- package/dist/OpenGrid-CuXj0isp.cjs +0 -97
- package/dist/xlsx.min-Bx-LxWOf.cjs +0 -138
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { FormatInput, InterpretedValue, IValueInterpreter } from '../types.js';
|
|
2
|
+
/**
|
|
3
|
+
* 기본 값객체 해석기. DD-01 값객체는 읽기만, 원시값은 런타임 추론.
|
|
4
|
+
* / Default interpreter. DD-01 value objects are read-only; primitives are inferred at runtime.
|
|
5
|
+
*/
|
|
6
|
+
export declare class ValueInterpreter implements IValueInterpreter {
|
|
7
|
+
interpret(input: FormatInput): InterpretedValue;
|
|
8
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { IMaskPolicy, MaskDef, MaskType } from '../types.js';
|
|
2
|
+
/**
|
|
3
|
+
* 기본 마스킹 정책 — MaskingEngine.applyMask 래퍼(로직 재사용, 재구현 0).
|
|
4
|
+
* / Default mask policy — a thin wrapper over MaskingEngine.applyMask (no reimplementation).
|
|
5
|
+
*/
|
|
6
|
+
export declare class MaskPolicy implements IMaskPolicy {
|
|
7
|
+
mask(value: string, def: MaskType | MaskDef): string;
|
|
8
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { INegativePolicy, NegativePolicy as NegPolicy, Sign } from '../types.js';
|
|
2
|
+
/**
|
|
3
|
+
* 기본 음수 정책. 이미 로케일 서식된 문자열을 받아 부호화 형태로 변환.
|
|
4
|
+
* / Default negative policy; transforms an already locale-formatted string.
|
|
5
|
+
*/
|
|
6
|
+
export declare class NegativePolicy implements INegativePolicy {
|
|
7
|
+
encode(text: string, sign: Sign, p: NegPolicy): {
|
|
8
|
+
text: string;
|
|
9
|
+
aria?: string;
|
|
10
|
+
colorHint?: string;
|
|
11
|
+
};
|
|
12
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { FormatContext, FormatInput, INullPolicy } from '../types.js';
|
|
2
|
+
/**
|
|
3
|
+
* 기본 null 정책. raw 가 null/undefined/'' 이면 기본 표시값(default), 아니면 null(미참여).
|
|
4
|
+
* / Default null policy: raw null/empty → default display; otherwise null (not participating).
|
|
5
|
+
*/
|
|
6
|
+
export declare class NullPolicy implements INullPolicy {
|
|
7
|
+
private readonly defaultText;
|
|
8
|
+
constructor(defaultText?: string);
|
|
9
|
+
render(input: FormatInput, _ctx: FormatContext): string | null;
|
|
10
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { AbbrevPolicy, FormatContext, ITruncatePolicy } from '../types.js';
|
|
2
|
+
/**
|
|
3
|
+
* 기본 축약 정책. threshold(기본 1000) 이상 절대값만 축약. 미만이면 null(미참여) 반환.
|
|
4
|
+
* / Default abbreviation policy; abbreviates only at/above threshold, else null.
|
|
5
|
+
*/
|
|
6
|
+
export declare class TruncatePolicy implements ITruncatePolicy {
|
|
7
|
+
abbreviate(n: number, p: AbbrevPolicy, _ctx: FormatContext): {
|
|
8
|
+
text: string;
|
|
9
|
+
rawText: string;
|
|
10
|
+
} | null;
|
|
11
|
+
}
|
|
@@ -0,0 +1,292 @@
|
|
|
1
|
+
import { ValueKind } from '../domain/DomainValue.js';
|
|
2
|
+
import { MissingReason } from '../domain/Missing.js';
|
|
3
|
+
import { LocaleMeta } from '../i18n/types.js';
|
|
4
|
+
import { MaskType, MaskDef } from '../MaskingEngine.js';
|
|
5
|
+
import { DisplayFormatterFn } from '../types.js';
|
|
6
|
+
export type { MaskType, MaskDef } from '../MaskingEngine.js';
|
|
7
|
+
/**
|
|
8
|
+
* 소비 표면(누가 표시값을 요구하는가). 포맷 정책 분기(예: aria=음수 낭독, export=색코드 제거).
|
|
9
|
+
* / Consumer surface — used to branch policy (e.g. aria spells minus, export strips color).
|
|
10
|
+
*/
|
|
11
|
+
export type FormatConsumer = 'cell' | 'chartAxis' | 'chartTooltip' | 'chartDataLabel' | 'statusbar' | 'export' | 'aria' | 'clipboard' | 'print';
|
|
12
|
+
/** 부호 클래스(이중 부호화·정렬 힌트). / Sign class for dual-encoding & sort hints. */
|
|
13
|
+
export type Sign = 'pos' | 'neg' | 'zero';
|
|
14
|
+
/**
|
|
15
|
+
* 표시(프레젠테이션) 도메인 종류 — **서식 의도**의 판별자(DD-01 ValueKind=데이터 종류와 구분, §2.1).
|
|
16
|
+
* / Presentation domain kind — the "how to render" discriminant (distinct from DD-01 ValueKind).
|
|
17
|
+
*/
|
|
18
|
+
export type DomainKind = 'number' | 'currency' | 'percent' | 'date' | 'datetime' | 'text' | 'money' | 'delta' | 'missing' | 'mask';
|
|
19
|
+
/** 적용된 파이프 단계 식별자(무결성 provenance·계약테스트). / Applied pipeline stage id. */
|
|
20
|
+
export type StageId = 'interpret' | 'domainType' | 'locale' | 'userFormat' | 'null' | 'truncate' | 'negative' | 'mask' | 'customHook';
|
|
21
|
+
/**
|
|
22
|
+
* 파이프 입력 — DD-01 값 객체(또는 원시값)를 정규화한 캐논 입력. raw 는 값 객체 그대로 보존(역참조 금지).
|
|
23
|
+
* / Canonical pipe input; raw holds the value object as-is (no back-reference).
|
|
24
|
+
*/
|
|
25
|
+
export interface FormatInput {
|
|
26
|
+
/** DD-01 값 객체 또는 원시값(number|string|Date|null). / A DD-01 value object or a primitive. */
|
|
27
|
+
readonly raw: unknown;
|
|
28
|
+
/** 값 종류(도메인타입 해석의 1차 힌트). 미상이면 'auto'. / Kind hint; 'auto' when unknown. */
|
|
29
|
+
readonly kind?: DomainKind | 'auto';
|
|
30
|
+
/** 컬럼 field(캐시 키·커스텀 훅 컨텍스트). / Column field (cache key & hook ctx). */
|
|
31
|
+
readonly field?: string;
|
|
32
|
+
/** 행 데이터(커스텀 훅 전용, 읽기전용 취급). / Row data (custom-hook only, read-only). */
|
|
33
|
+
readonly row?: unknown;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* 파이프 최종 산출 — 문자열 + 소비자별 파생 시맨틱 메타.
|
|
37
|
+
* / Final pipe output — string plus per-consumer semantic meta.
|
|
38
|
+
*/
|
|
39
|
+
export interface FormatResult {
|
|
40
|
+
/** 최종 표시 문자열(모든 소비자 공통). / Final display string. */
|
|
41
|
+
readonly text: string;
|
|
42
|
+
/** aria 낭독용 대체 텍스트(괄호 음수 → 마이너스 형태). / Accessible alt text. */
|
|
43
|
+
readonly aria?: string;
|
|
44
|
+
/** 축약/마스킹 시 원값 보존(hover·클립보드·export). / Preserved raw value under abbrev/mask. */
|
|
45
|
+
readonly rawText?: string;
|
|
46
|
+
/** 부호 클래스. / Sign class. */
|
|
47
|
+
readonly sign?: Sign;
|
|
48
|
+
/** AST 색상코드([Red] 등) — DD-05/DD-03 이 형태/부호 병기로 소비. / AST color hint. */
|
|
49
|
+
readonly colorHint?: string;
|
|
50
|
+
/** 적용된 단계 목록(provenance·계약테스트). / Applied stage list. */
|
|
51
|
+
readonly applied: ReadonlyArray<StageId>;
|
|
52
|
+
}
|
|
53
|
+
/** 파이프 실행 컨텍스트 — 로케일/테마 명시 주입(순수성·캐시 키). / Pipe run context (explicitly injected). */
|
|
54
|
+
export interface FormatContext {
|
|
55
|
+
/** 활성 로케일 메타(LocaleRegistry.meta()). intlLocale 로 Intl 포맷. / Active locale meta. */
|
|
56
|
+
readonly locale: LocaleMeta;
|
|
57
|
+
/** 테마 에폭(색코드 무효화용 단조 증가값). / Theme epoch (monotonic; for color invalidation). */
|
|
58
|
+
readonly themeEpoch: number;
|
|
59
|
+
/** 소비 표면(정책 분기). / Consumer surface (policy branch). */
|
|
60
|
+
readonly consumer: FormatConsumer;
|
|
61
|
+
}
|
|
62
|
+
/** 큰수 축약 정책(REQ-T2-013). / Large-number abbreviation policy. */
|
|
63
|
+
export interface AbbrevPolicy {
|
|
64
|
+
/** 축약 스타일: K/M/B(short) 또는 만/억(korean). / Style: K/M/B or 만/억. */
|
|
65
|
+
readonly style: 'short' | 'korean';
|
|
66
|
+
/** 이 절대값 이상에서만 축약(기본 1000). / Abbreviate only at/above this magnitude. */
|
|
67
|
+
readonly threshold?: number;
|
|
68
|
+
/** 축약 표기 소수 자릿수(기본 1). / Fraction digits in abbreviated form. */
|
|
69
|
+
readonly digits?: number;
|
|
70
|
+
}
|
|
71
|
+
/** 음수 이중 부호화 정책(REQ-T2-012). / Negative dual-encoding policy. */
|
|
72
|
+
export interface NegativePolicy {
|
|
73
|
+
/** 회계 괄호 / −기호 / −기호+색. / Accounting parens / minus / minus+color. */
|
|
74
|
+
readonly style: 'parens' | 'minus' | 'minusColor';
|
|
75
|
+
/** minusColor 스타일의 colorHint. / colorHint emitted for the minusColor style. */
|
|
76
|
+
readonly color?: string;
|
|
77
|
+
}
|
|
78
|
+
/** null/빈값 표시 정책. / Null/empty display policy. */
|
|
79
|
+
export interface NullPolicy {
|
|
80
|
+
/** 결측·null 표시 문자열(예 '-' | ''). / Display string for missing/null. */
|
|
81
|
+
readonly text: string;
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* 컬럼 1개의 포맷 명세(ColumnDef.format/currency/mask/type 흡수). specId 로 메모이즈.
|
|
85
|
+
* / Per-column format spec (absorbs ColumnDef.format/currency/mask/type). Memoized by specId.
|
|
86
|
+
*/
|
|
87
|
+
export interface ColumnFormatSpec {
|
|
88
|
+
/** 캐시 안정 식별자(명세 불변 동안 재사용). / Stable cache id. */
|
|
89
|
+
readonly specId: string;
|
|
90
|
+
/** 1차 도메인타입. / Primary domain kind. */
|
|
91
|
+
readonly domain: DomainKind;
|
|
92
|
+
/** ISO 통화코드(currency/money). / ISO currency code. */
|
|
93
|
+
readonly currency?: string;
|
|
94
|
+
/** 컴파일된 사용자 포맷 AST(있으면 최우선 서식). / Compiled user-format AST (top priority). */
|
|
95
|
+
readonly ast?: FormatAst;
|
|
96
|
+
/** 마스킹 정의(mask 도메인). / Masking definition (mask domain). */
|
|
97
|
+
readonly mask?: MaskType | MaskDef;
|
|
98
|
+
/** valueMap(원시 값 → 라벨). 도메인타입보다 우선(열거형). / Value→label map (wins over domain). */
|
|
99
|
+
readonly valueMap?: Readonly<Record<string, string>>;
|
|
100
|
+
/** 큰수 축약 정책. / Abbreviation policy. */
|
|
101
|
+
readonly abbreviate?: AbbrevPolicy;
|
|
102
|
+
/** 음수 이중 부호화 정책. / Negative dual-encoding policy. */
|
|
103
|
+
readonly negative?: NegativePolicy;
|
|
104
|
+
/** null/빈값 표시 정책. / Null/empty policy. */
|
|
105
|
+
readonly nullPolicy?: NullPolicy;
|
|
106
|
+
/** 등록된 커스텀 포맷터 이름 또는 per-instance 훅. / Custom formatter name or per-instance hook. */
|
|
107
|
+
readonly customFormatter?: string | DisplayFormatterFn | null;
|
|
108
|
+
/** 소수 자릿수(precision). / Fraction digits. */
|
|
109
|
+
readonly precision?: number;
|
|
110
|
+
/** 날짜 커스텀 패턴(yyyy/MM/dd 토큰). 미지정 시 로케일 Intl 날짜. / Date pattern; else locale Intl. */
|
|
111
|
+
readonly datePattern?: string;
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* ① 값객체 해석 언랩 결과 — 이후 단계의 순수 입력.
|
|
115
|
+
* / Unwrapped interpretation result — pure input for later stages.
|
|
116
|
+
*/
|
|
117
|
+
export interface InterpretedValue {
|
|
118
|
+
/** 수치 계열 정규화 값(Money.amount 등). 비수치는 undefined. / Normalized numeric magnitude. */
|
|
119
|
+
readonly magnitude?: number;
|
|
120
|
+
/** 부호 클래스. / Sign class. */
|
|
121
|
+
readonly sign: Sign;
|
|
122
|
+
/** 통화코드(ISO). currency/money 도메인만. / Currency code (currency/money only). */
|
|
123
|
+
readonly currency?: string;
|
|
124
|
+
/** DD-01 소유(import). raw 의 데이터 종류(DomainKind 아님). / DD-01-owned data kind. */
|
|
125
|
+
readonly valueKind: ValueKind;
|
|
126
|
+
/** DD-01 Missing.isMissing() 결과. true → null 정책 단락. / Missing flag → short to null policy. */
|
|
127
|
+
readonly isMissing: boolean;
|
|
128
|
+
/** DD-01 Missing.reason(결측 낭독·export 보존). / Missing reason. */
|
|
129
|
+
readonly missingReason?: MissingReason;
|
|
130
|
+
/** 텍스트/마스크/폴백용 문자열 등가물. / String equivalent for text/mask/fallback. */
|
|
131
|
+
readonly text?: string;
|
|
132
|
+
/** 날짜 도메인용 Date. / Date for the date domain. */
|
|
133
|
+
readonly date?: Date;
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* ① 값객체 해석 — raw(DD-01 DomainValue/원시) → 캐논 수치·부호·단위 메타(Money/Delta/Missing 언랩).
|
|
137
|
+
* DD-01 값객체는 읽기만(역참조·재집계 금지, 불변식 2). 반올림·통화 산술은 DD-01 위임.
|
|
138
|
+
* / Interpret raw into a canonical value; DD-01 value objects are read-only.
|
|
139
|
+
*/
|
|
140
|
+
export interface IValueInterpreter {
|
|
141
|
+
interpret(input: FormatInput): InterpretedValue;
|
|
142
|
+
}
|
|
143
|
+
/** 로케일 숫자 서식 지시(자릿수·그룹핑). / Locale number directive. */
|
|
144
|
+
export interface NumberDirective {
|
|
145
|
+
readonly minFraction?: number;
|
|
146
|
+
readonly maxFraction?: number;
|
|
147
|
+
readonly grouping?: boolean;
|
|
148
|
+
}
|
|
149
|
+
/** ② 도메인타입 해석 산출 — 종류 확정 + 서식 지시. / Domain-type directive. */
|
|
150
|
+
export interface DomainDirective {
|
|
151
|
+
readonly domain: DomainKind;
|
|
152
|
+
readonly number?: NumberDirective;
|
|
153
|
+
readonly currency?: string;
|
|
154
|
+
/** valueMap 적중 라벨(있으면 이후 단계 단락). / Value-map label (short-circuits). */
|
|
155
|
+
readonly valueMapped?: string;
|
|
156
|
+
/** mask 도메인 정의. / Mask definition for the mask domain. */
|
|
157
|
+
readonly maskDef?: MaskType | MaskDef;
|
|
158
|
+
}
|
|
159
|
+
/** ② 도메인타입 해석 — 종류 결정 + 기본 서식 의도 산출. / Resolve domain kind + default intent. */
|
|
160
|
+
export interface IDomainTypeResolver {
|
|
161
|
+
resolve(v: InterpretedValue, spec: ColumnFormatSpec): DomainDirective;
|
|
162
|
+
}
|
|
163
|
+
/** ③ 로케일 서식 — Intl 기반 숫자/통화/%/날짜(REQ-T9-001). / Locale (Intl) formatting. */
|
|
164
|
+
export interface ILocaleFormat {
|
|
165
|
+
formatNumber(n: number, d: NumberDirective, ctx: FormatContext): string;
|
|
166
|
+
formatCurrency(n: number, currency: string, d: NumberDirective, ctx: FormatContext): string;
|
|
167
|
+
formatPercent(n: number, d: NumberDirective, ctx: FormatContext): string;
|
|
168
|
+
formatDate(d: Date, pattern: string | undefined, ctx: FormatContext): string;
|
|
169
|
+
}
|
|
170
|
+
/** ④ 사용자 포맷 AST 렌더 산출. / User-format AST render. */
|
|
171
|
+
export interface AstRender {
|
|
172
|
+
readonly text: string;
|
|
173
|
+
readonly colorHint?: string;
|
|
174
|
+
/** 음수 섹션(괄호) aria 대체 — 색·괄호 형태 대신 −기호 낭독(AA, KM-DB016). / Minus-form aria for negative sections. */
|
|
175
|
+
readonly aria?: string;
|
|
176
|
+
}
|
|
177
|
+
/** ④ 사용자 포맷 — 컴파일된 AST 를 로케일 산출 위에 적용(다중섹션·색코드). / Apply compiled AST. */
|
|
178
|
+
export interface IUserFormatSpec {
|
|
179
|
+
apply(ast: FormatAst, v: InterpretedValue, ctx: FormatContext): AstRender;
|
|
180
|
+
}
|
|
181
|
+
/** 좁은 정책(ISP) — null. / Narrow policy — null. */
|
|
182
|
+
export interface INullPolicy {
|
|
183
|
+
/** null=미참여(파이프 계속), 문자열=null 표시값. / null = not participating; string = null display. */
|
|
184
|
+
render(input: FormatInput, ctx: FormatContext): string | null;
|
|
185
|
+
}
|
|
186
|
+
/** 좁은 정책(ISP) — 큰수 축약. / Narrow policy — abbreviation. */
|
|
187
|
+
export interface ITruncatePolicy {
|
|
188
|
+
abbreviate(n: number, p: AbbrevPolicy, ctx: FormatContext): {
|
|
189
|
+
text: string;
|
|
190
|
+
rawText: string;
|
|
191
|
+
} | null;
|
|
192
|
+
}
|
|
193
|
+
/** 좁은 정책(ISP) — 음수 이중 부호화. / Narrow policy — negative dual encoding. */
|
|
194
|
+
export interface INegativePolicy {
|
|
195
|
+
encode(text: string, sign: Sign, p: NegativePolicy): {
|
|
196
|
+
text: string;
|
|
197
|
+
aria?: string;
|
|
198
|
+
colorHint?: string;
|
|
199
|
+
};
|
|
200
|
+
}
|
|
201
|
+
/** 좁은 정책(ISP) — 마스킹(MaskingEngine.applyMask 래퍼). / Narrow policy — masking wrapper. */
|
|
202
|
+
export interface IMaskPolicy {
|
|
203
|
+
mask(value: string, def: MaskType | MaskDef): string;
|
|
204
|
+
}
|
|
205
|
+
/**
|
|
206
|
+
* ★PROVISIONAL — DD-10 확장 아키텍처(IExtension) 미착지. DD-03 이 RuleVerdict 를 임시 정의한 선례와 동일.
|
|
207
|
+
* DD-10 §2.5 착지 시 `import type { IExtension } from '../<dd10>'` 로 교체하고 이 블록 삭제(주석 명시).
|
|
208
|
+
* activate/dispose 자원 대칭·name 만 최소 계약으로 둔다(register 로 획득한 자원의 대칭 해제).
|
|
209
|
+
* / PROVISIONAL: DD-10 IExtension not yet landed (mirrors DD-03's RuleVerdict provisional). Replace
|
|
210
|
+
* with an import when DD-10 §2.5 lands and delete this block.
|
|
211
|
+
*/
|
|
212
|
+
export interface IExtension {
|
|
213
|
+
readonly name: string;
|
|
214
|
+
activate?(ctx?: unknown): void;
|
|
215
|
+
dispose?(): void;
|
|
216
|
+
}
|
|
217
|
+
/**
|
|
218
|
+
* 커스텀 포맷터 Strategy (REQ-T9-002) — format/parse 대칭. DD-04 가 IFormatter 정본(교차리뷰 R.2).
|
|
219
|
+
* ctx 형은 DD-04 FormatContext 로 통일(DD-10 축약 FmtCtx 아님).
|
|
220
|
+
* / Custom formatter strategy (format/parse). DD-04 owns IFormatter; ctx is DD-04 FormatContext.
|
|
221
|
+
*/
|
|
222
|
+
export interface IFormatter extends IExtension {
|
|
223
|
+
/** 예: 'IFormatter@1' — SPI 버저닝(DD-10 conformance 대상). / SPI version tag. */
|
|
224
|
+
readonly spi: string;
|
|
225
|
+
readonly name: string;
|
|
226
|
+
format(value: unknown, ctx: FormatContext): string;
|
|
227
|
+
/** 편집 역변환(에디터 소비). / Inverse for editors. */
|
|
228
|
+
parse?(text: string, ctx: FormatContext): unknown;
|
|
229
|
+
}
|
|
230
|
+
/**
|
|
231
|
+
* 차트·export 등이 주입받는 좁은 포트(공유 커널, REQ-T6-805). 그리드 내부 클래스 import 금지.
|
|
232
|
+
* / Narrow shared-kernel port injected into chart/export (no grid-internal imports).
|
|
233
|
+
*/
|
|
234
|
+
export interface IDisplayFormatPort {
|
|
235
|
+
formatScalar(n: number, spec: ColumnFormatSpec, ctx: FormatContext): string;
|
|
236
|
+
text(input: FormatInput, spec: ColumnFormatSpec, ctx: FormatContext): string;
|
|
237
|
+
}
|
|
238
|
+
/** 포맷 토큰(리터럴·숫자토큰·통화기호·백분율). / Format token. */
|
|
239
|
+
export type FormatToken = {
|
|
240
|
+
readonly t: 'lit';
|
|
241
|
+
readonly s: string;
|
|
242
|
+
} | {
|
|
243
|
+
readonly t: 'int';
|
|
244
|
+
readonly grouping: boolean;
|
|
245
|
+
} | {
|
|
246
|
+
readonly t: 'frac';
|
|
247
|
+
readonly digits: number;
|
|
248
|
+
} | {
|
|
249
|
+
readonly t: 'currencySym';
|
|
250
|
+
} | {
|
|
251
|
+
readonly t: 'percent';
|
|
252
|
+
};
|
|
253
|
+
/** 다중섹션 1개(양수/음수/0/텍스트 중 하나). / One AST section. */
|
|
254
|
+
export interface FormatSection {
|
|
255
|
+
readonly tokens: FormatToken[];
|
|
256
|
+
/** [Red] 등 색코드 — 색 단독 부호화 가드(colorHint). / Color code guard. */
|
|
257
|
+
readonly colorCode?: string;
|
|
258
|
+
/** 조건 어휘(additive, grammarVersion 2+ 예약). / Condition vocabulary (reserved). */
|
|
259
|
+
readonly condition?: {
|
|
260
|
+
readonly op: '<' | '>' | '<=' | '>=' | '=';
|
|
261
|
+
readonly value: number;
|
|
262
|
+
};
|
|
263
|
+
}
|
|
264
|
+
/** 다중섹션 AST + 문법 버전. Excel 포맷 문자열 컴파일 산출(REQ-T2-038·TX-888). / Multi-section AST + grammar version. */
|
|
265
|
+
export interface FormatAst {
|
|
266
|
+
/** additive 진화 — 낮은 버전 AST 는 상위 렌더러가 동일 해석. / Grammar version. */
|
|
267
|
+
readonly grammarVersion: number;
|
|
268
|
+
/** [pos, neg?, zero?, text?]. / Sections. */
|
|
269
|
+
readonly sections: FormatSection[];
|
|
270
|
+
}
|
|
271
|
+
/** 컴파일 진단(throw 아닌 신호). / Compile diagnostic (signal, not throw). */
|
|
272
|
+
export interface FormatDiagnostic {
|
|
273
|
+
readonly severity: 'warn' | 'error';
|
|
274
|
+
readonly message: string;
|
|
275
|
+
}
|
|
276
|
+
/** 컴파일러 — 문자열 → AST(문법 버전 스탬프). 실패는 진단 + 원문 리터럴 폴백. / Format-string compiler. */
|
|
277
|
+
export interface IUserFormatCompiler {
|
|
278
|
+
readonly grammarVersion: number;
|
|
279
|
+
compile(format: string): {
|
|
280
|
+
ast: FormatAst;
|
|
281
|
+
diagnostics: FormatDiagnostic[];
|
|
282
|
+
};
|
|
283
|
+
}
|
|
284
|
+
/** 메모이즈 캐시 키축 — (rawKey|specId|localeId|grammarVer|themeEpoch|consumer). / Memoize cache key axes. */
|
|
285
|
+
export interface FormatCacheKey {
|
|
286
|
+
readonly rawKey: string;
|
|
287
|
+
readonly specId: string;
|
|
288
|
+
readonly localeId: string;
|
|
289
|
+
readonly grammarVer: number;
|
|
290
|
+
readonly themeEpoch: number;
|
|
291
|
+
readonly consumer: FormatConsumer;
|
|
292
|
+
}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { CellKey, CellValue } from './types.js';
|
|
2
|
+
import { EvalOutcome } from './FormulaEvaluator.js';
|
|
3
|
+
/** 캐시 엔트리 1건(직렬화 단위). / One cache entry (serialization unit). */
|
|
4
|
+
export interface CalcCacheEntry {
|
|
5
|
+
/** 마지막 평가 결과. / Last evaluation outcome. */
|
|
6
|
+
readonly outcome: EvalOutcome;
|
|
7
|
+
/** 선행값 구조해시(히트 판정 기준, REQ-T8-845). / Structural hash of precedent inputs (hit criterion). */
|
|
8
|
+
readonly inputsHash: string;
|
|
9
|
+
}
|
|
10
|
+
/** 캐시 직렬화 스냅샷(§2.7 export/import, REQ-T5-049). / Serialized cache snapshot (§2.7). */
|
|
11
|
+
export interface CalcCacheSnapshot {
|
|
12
|
+
/** 스키마 버전 태그(미지 버전은 import 시 skip). / Schema version tag (unknown → skipped on import). */
|
|
13
|
+
readonly version: 1;
|
|
14
|
+
/** (cellKey, value, error, approx, inputsHash) 목록. / List of serialized entries. */
|
|
15
|
+
readonly entries: ReadonlyArray<{
|
|
16
|
+
key: CellKey;
|
|
17
|
+
value: SerializedValue;
|
|
18
|
+
error: EvalOutcome['error'];
|
|
19
|
+
approx: boolean;
|
|
20
|
+
inputsHash: string;
|
|
21
|
+
}>;
|
|
22
|
+
}
|
|
23
|
+
/** 직렬화 값 표현(OGDecimal 은 10진 문자열로). / Serialized value form (OGDecimal as decimal string). */
|
|
24
|
+
type SerializedValue = {
|
|
25
|
+
t: 'dec';
|
|
26
|
+
v: string;
|
|
27
|
+
} | {
|
|
28
|
+
t: 'str';
|
|
29
|
+
v: string;
|
|
30
|
+
} | {
|
|
31
|
+
t: 'bool';
|
|
32
|
+
v: boolean;
|
|
33
|
+
} | {
|
|
34
|
+
t: 'null';
|
|
35
|
+
};
|
|
36
|
+
/**
|
|
37
|
+
* 선행값 배열의 구조해시(§2.7 방어선, REQ-T8-845). 참조가 아니라 값 기준 — 오탐/누락 0 지향.
|
|
38
|
+
* 값 객체(OGDecimal)는 정규 10진 문자열(`toString`)로 구조 동등을 표현한다(DD-01 소유 정의 소비).
|
|
39
|
+
* / Structural hash of a precedent-value array (§2.7). Value-based, not reference-based.
|
|
40
|
+
*
|
|
41
|
+
* @param values - 선행 셀 값 배열(그래프 precedents 순서) / Precedent cell values (graph precedents order)
|
|
42
|
+
* @returns 결정론 해시 문자열 / Deterministic hash string
|
|
43
|
+
*/
|
|
44
|
+
export declare function hashInputs(values: readonly CellValue[]): string;
|
|
45
|
+
/**
|
|
46
|
+
* (cellKey → EvalOutcome) 캐시. 정밀 무효화·LRU 축출·직렬화(§2.7).
|
|
47
|
+
* / (cellKey → EvalOutcome) cache with precise invalidation, LRU eviction, serialization (§2.7).
|
|
48
|
+
*/
|
|
49
|
+
export interface CalcCacheStore {
|
|
50
|
+
/** inputsHash 일치 시에만 히트로 간주할 것 — 저장된 (outcome, inputsHash) 반환. / Returns the stored entry; caller checks inputsHash. */
|
|
51
|
+
get(key: CellKey): CalcCacheEntry | undefined;
|
|
52
|
+
/** 캐시 기록(inputsHash 동반). LRU 최신화. / Record into cache (with inputsHash). Marks most-recently-used. */
|
|
53
|
+
set(key: CellKey, outcome: EvalOutcome, inputsHash: string): void;
|
|
54
|
+
/** 종속 폐포 정밀 무효화. / Precise invalidation of a dependents closure. */
|
|
55
|
+
invalidate(keys: Iterable<CellKey>): void;
|
|
56
|
+
/** 전체 비우기. / Clear everything. */
|
|
57
|
+
clear(): void;
|
|
58
|
+
/** 현재 크기. / Current size. */
|
|
59
|
+
readonly size: number;
|
|
60
|
+
/** LRU 상한. / LRU capacity. */
|
|
61
|
+
readonly capacity: number;
|
|
62
|
+
/** 직렬화(includeCalcModelCache). / Serialize (includeCalcModelCache). */
|
|
63
|
+
export(): CalcCacheSnapshot;
|
|
64
|
+
/** 재로드 재계산 회피 — verify(key, hash) 통과 항목만 신뢰(스테일 캐시 거부). / Import; trust only entries passing verify(key, hash). */
|
|
65
|
+
import(snap: CalcCacheSnapshot, verify: (key: CellKey, inputsHash: string) => boolean): void;
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* LRU 캐시 기본 구현(Map 삽입순 = 접근순). 상한 초과 시 가장 오래된 키 축출(§2.7, REQ-T8-846).
|
|
69
|
+
* / Default LRU cache (Map insertion order = recency). Evicts the oldest key past capacity (§2.7).
|
|
70
|
+
*
|
|
71
|
+
* @example
|
|
72
|
+
* const cache = new LruCalcCacheStore(1000);
|
|
73
|
+
* cache.set('r1:total', outcome, hashInputs([price, qty]));
|
|
74
|
+
* const hit = cache.get('r1:total');
|
|
75
|
+
* if (hit && hit.inputsHash === hashInputs([price, qty])) use(hit.outcome);
|
|
76
|
+
*/
|
|
77
|
+
export declare class LruCalcCacheStore implements CalcCacheStore {
|
|
78
|
+
private readonly _map;
|
|
79
|
+
readonly capacity: number;
|
|
80
|
+
constructor(capacity?: number);
|
|
81
|
+
get size(): number;
|
|
82
|
+
get(key: CellKey): CalcCacheEntry | undefined;
|
|
83
|
+
set(key: CellKey, outcome: EvalOutcome, inputsHash: string): void;
|
|
84
|
+
invalidate(keys: Iterable<CellKey>): void;
|
|
85
|
+
clear(): void;
|
|
86
|
+
export(): CalcCacheSnapshot;
|
|
87
|
+
import(snap: CalcCacheSnapshot, verify: (key: CellKey, inputsHash: string) => boolean): void;
|
|
88
|
+
}
|
|
89
|
+
export {};
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { CellKey, FormulaErrorCode } from './types.js';
|
|
2
|
+
import { FormulaGraph } from './FormulaGraph.js';
|
|
3
|
+
import { FormulaStore } from './FormulaStore.js';
|
|
4
|
+
import { BrokenRef } from './ReferenceRewriter.js';
|
|
5
|
+
/**
|
|
6
|
+
* 셀 값/에러의 계보(§2.6). 툴팁/자연어번역 이전의 도메인 모델.
|
|
7
|
+
* / Provenance of a cell value/error (§2.6): the domain model before tooltip/NL translation.
|
|
8
|
+
*/
|
|
9
|
+
export interface CalcProvenance {
|
|
10
|
+
/** 대상 셀 키. / Target cell key. */
|
|
11
|
+
readonly cell: CellKey;
|
|
12
|
+
/** 상태 분류. / State classification. */
|
|
13
|
+
readonly kind: 'ok' | 'error' | 'cycle' | 'pending';
|
|
14
|
+
/** 에러 코드(있으면). / Error code (when present). */
|
|
15
|
+
readonly error?: FormulaErrorCode;
|
|
16
|
+
/** #REF: 어느 참조가 왜 깨졌나. / #REF: which refs broke and why. */
|
|
17
|
+
readonly brokenRefs?: BrokenRef[];
|
|
18
|
+
/** #CYCLE: 고리 경로(A→B→A, §2.6 고리 지목). / #CYCLE: loop path. */
|
|
19
|
+
readonly cyclePath?: CellKey[];
|
|
20
|
+
/** 직접 선행 셀(수식 추적 트리 데이터원). / Direct precedents (formula-trace tree source). */
|
|
21
|
+
readonly precedents: CellKey[];
|
|
22
|
+
}
|
|
23
|
+
/** buildProvenance 협력자. / Collaborators for buildProvenance. */
|
|
24
|
+
export interface ProvenanceSources {
|
|
25
|
+
/** 의존성 그래프. / Dependency graph. */
|
|
26
|
+
graph: FormulaGraph;
|
|
27
|
+
/** 수식 사이드카 저장소. / Formula sidecar store. */
|
|
28
|
+
store: FormulaStore;
|
|
29
|
+
/** (선택) #CYCLE 시 고리 경로. / (optional) loop path when #CYCLE. */
|
|
30
|
+
cyclePath?: CellKey[];
|
|
31
|
+
/** (선택) #REF 시 깨진 참조 목록. / (optional) broken refs when #REF. */
|
|
32
|
+
brokenRefs?: BrokenRef[];
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* (rowId, field) 셀의 계보를 조립한다(§2.6). error/value 는 store 에서, precedents 는 graph 에서.
|
|
36
|
+
* / Assemble the provenance of the (rowId, field) cell (§2.6): error/value from `store`,
|
|
37
|
+
* precedents from `graph`.
|
|
38
|
+
*
|
|
39
|
+
* @param rowId - 대상 행 stable id / Target row stable id
|
|
40
|
+
* @param field - 대상 컬럼 field / Target column field
|
|
41
|
+
* @param src - 협력자(graph/store + 선택 경로/깨진참조) / Collaborators (graph/store + optional path/broken refs)
|
|
42
|
+
* @returns 계보 모델 / Provenance model
|
|
43
|
+
*/
|
|
44
|
+
export declare function buildProvenance(rowId: string, field: string, src: ProvenanceSources): CalcProvenance;
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
import { CanonicalRef, CanonicalRangeRef, CellKey, CellValue, FormulaErrorCode, FormulaGridAccessor, RefMode } from './types.js';
|
|
2
|
+
import { RecalcCoordinator, RecalcSummary } from './RecalcCoordinator.js';
|
|
3
|
+
import { FunctionRegistry } from './FunctionRegistry.js';
|
|
4
|
+
import { CalcExecutor, Generation } from './Generation.js';
|
|
5
|
+
import { StructuralEdit, RewriteReport } from './ReferenceRewriter.js';
|
|
6
|
+
import { CalcCacheStore, CalcCacheSnapshot } from './CalcCacheStore.js';
|
|
7
|
+
import { CalcProvenance } from './CalcProvenance.js';
|
|
8
|
+
/**
|
|
9
|
+
* 계산 엔진이 그리드/데이터를 보는 유일한 포트(§2.2). 핵심 7메서드는 동결(FormulaGridAccessor),
|
|
10
|
+
* 구조편집·명명범위·시각파생은 옵셔널 확장(미구현 안전 폴백 — 인터페이스 비대화 회피).
|
|
11
|
+
* / The sole port through which the calc engine views the grid (§2.2). Core 7 methods frozen;
|
|
12
|
+
* structural/named-range/derived hooks are optional (safe fallback when unimplemented).
|
|
13
|
+
*/
|
|
14
|
+
export interface CalcHostPort extends FormulaGridAccessor {
|
|
15
|
+
/** (선택) 명명범위 해소(INDIRECT/named-range, §2.2). / (optional) resolve a named range. */
|
|
16
|
+
resolveName?(name: string): CanonicalRangeRef | CanonicalRef | null;
|
|
17
|
+
/** (선택) 구조편집 좌표 델타 환산. / (optional) structural-edit coordinate delta. */
|
|
18
|
+
structuralDelta?(edit: StructuralEdit): {
|
|
19
|
+
dRow: number;
|
|
20
|
+
dCol: number;
|
|
21
|
+
};
|
|
22
|
+
/** (선택) 시각 파생 소비자 등록(REQ-T8-801). / (optional) register a derived visual consumer. */
|
|
23
|
+
registerDerived?(node: unknown): void;
|
|
24
|
+
}
|
|
25
|
+
/** CalcService DI 구성 옵션(§2.1). / CalcService DI options (§2.1). */
|
|
26
|
+
export interface CalcServiceOptions {
|
|
27
|
+
/** 좌표·값 질의 포트(§2.2). / Coordinate/value query port (§2.2). */
|
|
28
|
+
host: CalcHostPort;
|
|
29
|
+
/** 계산 결과를 셀에 반영하는 콜백. / Callback writing a computed value back to a cell. */
|
|
30
|
+
setComputedValue: (rowId: string, field: string, v: CellValue) => void;
|
|
31
|
+
/** (선택) 수식 오류 통지. / (optional) formula-error notification. */
|
|
32
|
+
onFormulaError?: (rowId: string, field: string, e: FormulaErrorCode) => void;
|
|
33
|
+
/** (선택) 함수 레지스트리(미주입 시 빈 레지스트리 — 내장 필수함수는 switch 폴백). / (optional) function registry. */
|
|
34
|
+
functions?: FunctionRegistry;
|
|
35
|
+
/** (선택) 계산 실행기(기본 동기). / (optional) calc executor (default sync). */
|
|
36
|
+
executor?: CalcExecutor;
|
|
37
|
+
/** (선택) 참조 정규화 모드('stable' 기본). / (optional) reference mode ('stable' default). */
|
|
38
|
+
refMode?: RefMode;
|
|
39
|
+
/** (선택) 나눗셈 정밀도(기본 30). / (optional) division precision (default 30). */
|
|
40
|
+
divisionPrecision?: number;
|
|
41
|
+
/** (선택) 결정론 주입 시각(volatile 함수·벤치). / (optional) injected deterministic clock. */
|
|
42
|
+
now?: () => number;
|
|
43
|
+
/** (선택) 캐시 LRU 상한(기본 5000). / (optional) cache LRU capacity (default 5000). */
|
|
44
|
+
cacheCapacity?: number;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* 계산 엔진 바운디드 컨텍스트의 단일 진입점(파사드, §2.1). UI/DOM 무의존, 단독 인스턴스화 가능.
|
|
48
|
+
* RecalcCoordinator 의 CRUD/재계산 API 를 계승하고 DD-08 신설 능력(구조편집 재작성·순환경로·
|
|
49
|
+
* 세대·계보·캐시)을 얹는다.
|
|
50
|
+
* / Single entry point of the calc bounded context (facade, §2.1). Inherits RecalcCoordinator's
|
|
51
|
+
* CRUD/recalc API and adds DD-08 capabilities (structural rewrite, cycle path, generation,
|
|
52
|
+
* provenance, cache).
|
|
53
|
+
*
|
|
54
|
+
* @example
|
|
55
|
+
* const svc = new CalcService({ host, setComputedValue });
|
|
56
|
+
* svc.setCellFormula('r1', 'total', '=[price]*[qty]');
|
|
57
|
+
* svc.getProvenance('r1', 'total'); // { kind, precedents, … }
|
|
58
|
+
*/
|
|
59
|
+
export declare class CalcService {
|
|
60
|
+
private readonly _coord;
|
|
61
|
+
private readonly _host;
|
|
62
|
+
private readonly _registry;
|
|
63
|
+
private readonly _executor;
|
|
64
|
+
private readonly _gen;
|
|
65
|
+
private readonly _rewriter;
|
|
66
|
+
private readonly _cycleReporter;
|
|
67
|
+
private readonly _cache;
|
|
68
|
+
/** 직전 구조편집에서 셀별 #REF 사유(계보 표기용). / Per-cell #REF reasons from the last structural edit. */
|
|
69
|
+
private readonly _brokenByKey;
|
|
70
|
+
constructor(opts: CalcServiceOptions);
|
|
71
|
+
/** @see RecalcCoordinator.setCellFormula */
|
|
72
|
+
setCellFormula(rowId: string, field: string, src: string): RecalcSummary;
|
|
73
|
+
/** @see RecalcCoordinator.getCellFormula */
|
|
74
|
+
getCellFormula(rowId: string, field: string): string | null;
|
|
75
|
+
/** @see RecalcCoordinator.clearCellFormula */
|
|
76
|
+
clearCellFormula(rowId: string, field: string): CellKey[];
|
|
77
|
+
/** @see RecalcCoordinator.hasCellFormula */
|
|
78
|
+
hasCellFormula(rowId: string, field: string): boolean;
|
|
79
|
+
/** @see RecalcCoordinator.getCellError */
|
|
80
|
+
getCellError(rowId: string, field: string): FormulaErrorCode | null;
|
|
81
|
+
/** C2 배치 진입점(증분). / C2 batch entry (incremental). */
|
|
82
|
+
onValuesChanged(keys: CellKey[]): RecalcSummary;
|
|
83
|
+
/** 전체 재계산(증분==전체 오라클). / Full recalculation (incremental==full oracle). */
|
|
84
|
+
recalculateAll(): RecalcSummary;
|
|
85
|
+
/** 정렬/필터 후크(범위-보유 수식 dirty). / Sort/filter hook (dirties range-bearing formulas). */
|
|
86
|
+
recalcRangeBearing(): RecalcSummary;
|
|
87
|
+
/** F1 fill(상대축 오프셋). / F1 fill (relative-axis offset). */
|
|
88
|
+
offsetFormula(srcRowId: string, srcField: string, dRow: number, dCol: number): string;
|
|
89
|
+
/**
|
|
90
|
+
* 저장된 전 수식을 구조편집에 맞춰 순수 재작성하고, deps 가 바뀐 수식을 재계산한다.
|
|
91
|
+
* 대상 소멸 참조는 #REF 정직 전환(RewriteReport.broken). undo 는 호출부(DD-09) 트랜잭션 몫.
|
|
92
|
+
* / Purely rewrite every stored formula for a structural edit, then recalc formulas whose deps
|
|
93
|
+
* changed. Dead refs → #REF (RewriteReport.broken).
|
|
94
|
+
*
|
|
95
|
+
* @param edit - 구조편집(행/열 삽입·삭제·이동) / The structural edit
|
|
96
|
+
* @returns 재작성 리포트(시프트·#REF·불변 집계) / Rewrite report (shifted/#REF/unchanged tallies)
|
|
97
|
+
*/
|
|
98
|
+
rewriteReferences(edit: StructuralEdit): RewriteReport;
|
|
99
|
+
/**
|
|
100
|
+
* (rowId, field) 셀이 순환에 속하면 고리 경로([A,B,A])를, 아니면 null 을 반환한다(지연 복원).
|
|
101
|
+
* / Return the cycle path ([A,B,A]) if the cell is in a cycle, else null (lazy recovery).
|
|
102
|
+
*/
|
|
103
|
+
getCyclePath(rowId: string, field: string): CellKey[] | null;
|
|
104
|
+
/**
|
|
105
|
+
* 이 셀 값/에러가 "왜" 그러한가(§2.6). error/precedents + (순환 시)경로 + (#REF 시)깨진 참조.
|
|
106
|
+
* / Why this cell holds its value/error (§2.6): error/precedents + cycle path + broken refs.
|
|
107
|
+
*/
|
|
108
|
+
getProvenance(rowId: string, field: string): CalcProvenance;
|
|
109
|
+
/** 현재 세대. / Current generation. */
|
|
110
|
+
currentGeneration(): Generation;
|
|
111
|
+
/** 세대를 올려 in-flight(비동기) 결과를 폐기한다. / Bump the generation to discard in-flight async results. */
|
|
112
|
+
invalidateGeneration(): Generation;
|
|
113
|
+
/**
|
|
114
|
+
* 현재 계산 상태를 캐시 스냅샷으로 직렬화한다(includeCalcModelCache). 각 수식 셀의 결과를
|
|
115
|
+
* 선행값 구조해시(inputsHash)와 함께 기록한다.
|
|
116
|
+
* / Serialize the current calc state into a cache snapshot; each formula outcome is recorded with
|
|
117
|
+
* its precedent-value structural hash (inputsHash).
|
|
118
|
+
*/
|
|
119
|
+
exportCache(): CalcCacheSnapshot;
|
|
120
|
+
/**
|
|
121
|
+
* 캐시 스냅샷을 재로드한다. 각 항목은 현재 선행값 해시와 재검증되어 통과분만 신뢰한다
|
|
122
|
+
* (스테일 캐시 거부, REQ-T8-845).
|
|
123
|
+
* / Import a cache snapshot; each entry is re-verified against current precedent-value hashes and
|
|
124
|
+
* only matching entries are trusted (stale-cache rejection, REQ-T8-845).
|
|
125
|
+
*/
|
|
126
|
+
importCache(snap: CalcCacheSnapshot): void;
|
|
127
|
+
/** 캐시 저장소 직접 접근(진단·테스트). / Direct cache access (diagnostics/tests). */
|
|
128
|
+
get cache(): CalcCacheStore;
|
|
129
|
+
/** 선행값 구조해시 — graph precedents 순서로 host 값을 읽어 hashInputs. / Structural hash of precedent values. */
|
|
130
|
+
private _inputsHashOf;
|
|
131
|
+
/** 함수 등록·조회·오버라이드 SPI(§2.3). / Function register/get/override SPI (§2.3). */
|
|
132
|
+
get functions(): FunctionRegistry;
|
|
133
|
+
/** 실행기(진단·테스트). / Executor (diagnostics/tests). */
|
|
134
|
+
get executor(): CalcExecutor;
|
|
135
|
+
/** 내부 코디네이터(진단·고급 배선). / Underlying coordinator (diagnostics/advanced wiring). */
|
|
136
|
+
get coordinator(): RecalcCoordinator;
|
|
137
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { CellKey } from './types.js';
|
|
2
|
+
import { FormulaGraph } from './FormulaGraph.js';
|
|
3
|
+
/**
|
|
4
|
+
* 사이클 멤버 집합에서 대표 고리 경로를 복원하는 리포터(§2.6).
|
|
5
|
+
* / Reporter that recovers representative cycle paths from a set of cycle members (§2.6).
|
|
6
|
+
*/
|
|
7
|
+
export interface CyclePathReporter {
|
|
8
|
+
/**
|
|
9
|
+
* 사이클 멤버 집합 → 각 멤버의 대표 고리 경로(자기 자신으로 되돌아오는 경로).
|
|
10
|
+
* / Cycle members → a representative cycle path per member (a path back to itself).
|
|
11
|
+
*
|
|
12
|
+
* @param cycleMembers - 위상정렬 잔여(사이클 구성원) / Topological-sort remainder (cycle members)
|
|
13
|
+
* @param graph - 의존성 그래프(precedents 조회) / Dependency graph (precedents lookup)
|
|
14
|
+
* @returns 멤버 → 고리 경로(예: [A,B,A]) / member → cycle path (e.g. [A,B,A])
|
|
15
|
+
*/
|
|
16
|
+
recover(cycleMembers: CellKey[], graph: FormulaGraph): Map<CellKey, CellKey[]>;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* DFS back-edge 추적 기본 구현. precedents 방향(내가 읽는 셀)으로 members 내부만 탐색해
|
|
20
|
+
* start 로 되돌아오는 경로를 찾는다. 경로는 [start, …, start] 형태(고리 닫힘).
|
|
21
|
+
* / Default DFS back-edge implementation. Follows the precedents direction within `members` to
|
|
22
|
+
* find a path returning to `start`. The path is [start, …, start] (closed loop).
|
|
23
|
+
*/
|
|
24
|
+
export declare class DefaultCyclePathReporter implements CyclePathReporter {
|
|
25
|
+
recover(cycleMembers: CellKey[], graph: FormulaGraph): Map<CellKey, CellKey[]>;
|
|
26
|
+
/** start 로 되돌아오는 최초 고리 경로(DFS). 미발견 시 [start] 단독(방어적). / First loop back to `start` (DFS); [start] alone if none (defensive). */
|
|
27
|
+
private _findLoop;
|
|
28
|
+
}
|