open-grid 1.2.1 → 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 -365
- package/dist/{OpenGrid-0r_543Kj.cjs → OpenGrid-B7m7ei7f.cjs} +1222 -1029
- package/dist/{OpenGrid-HmhGVC2V.js → OpenGrid-CeUdO_fM.js} +1613 -1418
- 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 +1 -1
- package/dist/open-grid-react.js +1 -1
- package/dist/open-grid-vue.cjs +7 -7
- package/dist/open-grid-vue.js +2 -2
- package/dist/open-grid.cjs +1 -1
- package/dist/open-grid.js +2 -2
- 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/CellTypeRegistry.d.ts +24 -0
- package/dist/types/core/ColumnLayout.d.ts +100 -2
- package/dist/types/core/CrossGridMapper.d.ts +43 -5
- package/dist/types/core/DataLayer.d.ts +210 -15
- package/dist/types/core/DragVisuals.d.ts +33 -4
- package/dist/types/core/EventEmitter.d.ts +54 -0
- package/dist/types/core/FormulaEngine.d.ts +15 -4
- package/dist/types/core/GridRenderer.d.ts +143 -10
- package/dist/types/core/GroupEngine.d.ts +68 -10
- package/dist/types/core/MathUtils.d.ts +58 -5
- package/dist/types/core/MergeEngine.d.ts +45 -10
- package/dist/types/core/OGDecimal.d.ts +144 -13
- package/dist/types/core/OpenGrid.d.ts +99 -0
- package/dist/types/core/PivotEngine.d.ts +37 -0
- package/dist/types/core/RowDragDrop.d.ts +52 -6
- package/dist/types/core/SkinRegistry.d.ts +4 -0
- package/dist/types/core/TreeEngine.d.ts +60 -6
- package/dist/types/core/VirtualScroll.d.ts +64 -0
- 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/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/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/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/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/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/package.json +112 -111
|
@@ -1,29 +1,76 @@
|
|
|
1
1
|
import { CellKey, CellValue, FormulaCell, FormulaErrorCode, FormulaGridAccessor, RefMode } from './types.js';
|
|
2
|
+
import { FunctionRegistry } from './FunctionRegistry.js';
|
|
2
3
|
import { indexToColLetters } from './normalizeRefs.js';
|
|
3
4
|
import { FormulaStore } from './FormulaStore.js';
|
|
4
5
|
import { FormulaGraph } from './FormulaGraph.js';
|
|
6
|
+
/**
|
|
7
|
+
* 재계산 1회의 요약 결과. / Summary of a single recalculation pass.
|
|
8
|
+
*/
|
|
5
9
|
export interface RecalcSummary {
|
|
10
|
+
/** 이번 패스에서 값이 갱신된 셀 키(위상순서 + 사이클). / Cell keys updated this pass (topological order + cycles). */
|
|
6
11
|
changed: CellKey[];
|
|
12
|
+
/** 사이클(#CYCLE)로 판정된 셀 수. / Number of cells resolved as a cycle (#CYCLE). */
|
|
7
13
|
cycles: number;
|
|
14
|
+
/** 소요 시간(ms). / Elapsed time in ms. */
|
|
8
15
|
ms: number;
|
|
9
16
|
}
|
|
17
|
+
/**
|
|
18
|
+
* RecalcCoordinator 생성 옵션. 그리드가 접근자/콜백을 주입한다.
|
|
19
|
+
* / Construction options for RecalcCoordinator. The grid injects the accessor/callbacks.
|
|
20
|
+
*/
|
|
10
21
|
export interface RecalcCoordinatorOptions {
|
|
22
|
+
/** 그리드 좌표/값 접근자(FlatRowModel·ColumnLayout·DataLayer 경유). / Grid coordinate/value accessor (via FlatRowModel/ColumnLayout/DataLayer). */
|
|
11
23
|
accessor: FormulaGridAccessor;
|
|
24
|
+
/** 계산 결과를 셀에 반영하는 콜백(§4.2 DataLayer.setComputedValue 상당). / Callback that writes a computed value back to a cell (≈ §4.2 DataLayer.setComputedValue). */
|
|
12
25
|
setComputedValue: (rowId: string, field: string, value: CellValue) => void;
|
|
26
|
+
/** (선택) 수식 에러 통지 콜백(§8.3 formulaError 이벤트 재료). / (optional) Formula-error notification callback (source for the §8.3 formulaError event). */
|
|
13
27
|
onFormulaError?: (rowId: string, field: string, error: FormulaErrorCode) => void;
|
|
28
|
+
/** 참조 정규화 모드(§8.1 formula.refMode, 기본 'stable' §3.2). / Reference normalization mode (§8.1 formula.refMode, default 'stable', §3.2). */
|
|
14
29
|
refMode?: RefMode;
|
|
30
|
+
/** 나눗셈 소수점 자리수(§8.1 formula.divisionPrecision, 기본 30). / Division decimal-place precision (§8.1 formula.divisionPrecision, default 30). */
|
|
15
31
|
divisionPrecision?: number;
|
|
32
|
+
/** (선택·additive, DD-08 §2.3) 함수 레지스트리 — 주입 시 override/확장 함수를 평가에 편입(미주입=내장 switch 만). / (optional·additive) Function registry — activates override/extended functions when injected. */
|
|
33
|
+
functions?: FunctionRegistry;
|
|
34
|
+
/** (선택·additive, DD-08 §2.4) 결정론 주입 시각(volatile 함수용). / (optional·additive) Injected deterministic clock (for volatile funcs). */
|
|
35
|
+
now?: () => number;
|
|
16
36
|
}
|
|
37
|
+
/**
|
|
38
|
+
* F3 셀 수식 오케스트레이션: 파싱→정규화→저장→그래프→배치 재계산을 조율한다.
|
|
39
|
+
* 헤드리스 계층으로 DOM/OpenGrid 를 전혀 모르며, 그리드가 accessor·setComputedValue 를
|
|
40
|
+
* 주입한다(§5.3/§8.2). 배선(OpenGrid 연결)은 후속 태스크 몫이다.
|
|
41
|
+
* / F3 cell-formula orchestration: coordinates parse → normalize → store → graph → batch
|
|
42
|
+
* recalculation. A headless layer that knows nothing of DOM/OpenGrid; the grid injects the
|
|
43
|
+
* accessor and setComputedValue (§5.3/§8.2). Wiring into OpenGrid is a follow-up task.
|
|
44
|
+
*
|
|
45
|
+
* @example
|
|
46
|
+
* const coord = new RecalcCoordinator({ accessor, setComputedValue });
|
|
47
|
+
* coord.setCellFormula('r1', 'total', '=[price] * [qty]');
|
|
48
|
+
*/
|
|
17
49
|
export declare class RecalcCoordinator {
|
|
50
|
+
/** 수식 사이드카 저장소. / Formula sidecar store. */
|
|
18
51
|
readonly store: FormulaStore;
|
|
52
|
+
/** 의존성 그래프. / Dependency graph. */
|
|
19
53
|
readonly graph: FormulaGraph;
|
|
20
54
|
private readonly _accessor;
|
|
21
55
|
private readonly _setComputedValue;
|
|
22
56
|
private readonly _onFormulaError;
|
|
23
57
|
private readonly _refMode;
|
|
24
58
|
private readonly _prec;
|
|
59
|
+
private readonly _functions;
|
|
60
|
+
private readonly _now;
|
|
25
61
|
constructor(opts: RecalcCoordinatorOptions);
|
|
26
|
-
/**
|
|
62
|
+
/** DD-08 §2.3: evaluate 옵션에 레지스트리/결정론 시각을 주입(미주입 시 undefined → 기존 동작). / Assemble evaluate options with the injected registry/clock (undefined preserves prior behavior). */
|
|
63
|
+
private _evalOpts;
|
|
64
|
+
/**
|
|
65
|
+
* src("=...")를 파싱+정규화한다. 파싱 자체가 실패하면 #ERR 을 담은 error AST로 폴백한다.
|
|
66
|
+
* setCellFormula 내부 및 단독 검증용.
|
|
67
|
+
* / Parse + normalize `src` ("=..."). On a parse failure, falls back to an error AST holding
|
|
68
|
+
* #ERR. Used inside setCellFormula and for standalone validation.
|
|
69
|
+
*
|
|
70
|
+
* @param src - 수식 원문 / Formula source text
|
|
71
|
+
* @param host - 수식이 저장될 호스트 셀(rowId·field) / Host cell (rowId, field) where the formula is stored
|
|
72
|
+
* @returns 정규화 AST 와 범위참조 포함 여부 / The normalized AST and whether it bears a range reference
|
|
73
|
+
*/
|
|
27
74
|
compile(src: string, host: {
|
|
28
75
|
rowId: string;
|
|
29
76
|
field: string;
|
|
@@ -33,6 +80,13 @@ export declare class RecalcCoordinator {
|
|
|
33
80
|
};
|
|
34
81
|
/**
|
|
35
82
|
* setCellFormula(§8.2) — 저장 후 즉시 평가하고, 기존 dependents 가 있으면 함께 dirty 처리.
|
|
83
|
+
* / setCellFormula (§8.2) — store the formula, evaluate it immediately, and also dirty any
|
|
84
|
+
* existing dependents.
|
|
85
|
+
*
|
|
86
|
+
* @param rowId - 대상 행의 stable id / Stable id of the target row
|
|
87
|
+
* @param field - 컬럼 field 명 / Column field name
|
|
88
|
+
* @param src - 수식 원문(예: "=[price] * [qty]") / Formula source (e.g. "=[price] * [qty]")
|
|
89
|
+
* @returns 이번 재계산 요약 / Summary of the resulting recalculation
|
|
36
90
|
*
|
|
37
91
|
* ⚠️ 순서가 중요하다(사이클 탐지 정합성): 새 수식을 등록하는 바로 그 순간에 사이클이
|
|
38
92
|
* "완성"될 수 있다(예: A1=B1 이미 있고 지금 B1=A1 을 등록). onValuesChanged 의
|
|
@@ -45,12 +99,53 @@ export declare class RecalcCoordinator {
|
|
|
45
99
|
* state)과는 무관하다(§13 f3.perf.closure 는 신규 등록이 아니라 leaf 값 변경 시나리오).
|
|
46
100
|
*/
|
|
47
101
|
setCellFormula(rowId: string, field: string, src: string): RecalcSummary;
|
|
102
|
+
/**
|
|
103
|
+
* (rowId, field) 셀의 수식 원문을 반환한다(없으면 null).
|
|
104
|
+
* / Return the formula source of the (rowId, field) cell (null if none).
|
|
105
|
+
*
|
|
106
|
+
* @param rowId - 대상 행의 stable id / Stable id of the target row
|
|
107
|
+
* @param field - 컬럼 field 명 / Column field name
|
|
108
|
+
* @returns 수식 원문 또는 null / Formula source or null
|
|
109
|
+
*/
|
|
48
110
|
getCellFormula(rowId: string, field: string): string | null;
|
|
111
|
+
/**
|
|
112
|
+
* (rowId, field) 셀에 수식이 있는지 여부.
|
|
113
|
+
* / Whether the (rowId, field) cell has a formula.
|
|
114
|
+
*
|
|
115
|
+
* @param rowId - 대상 행의 stable id / Stable id of the target row
|
|
116
|
+
* @param field - 컬럼 field 명 / Column field name
|
|
117
|
+
* @returns 수식 존재 여부 / Whether a formula exists
|
|
118
|
+
*/
|
|
49
119
|
hasCellFormula(rowId: string, field: string): boolean;
|
|
50
|
-
/**
|
|
120
|
+
/**
|
|
121
|
+
* clearCellFormula(§8.2) — 사이드카+그래프에서 수식을 제거한다. 값(row[field])은 그리드
|
|
122
|
+
* 쪽 책임이라 그대로 유지된다.
|
|
123
|
+
* / clearCellFormula (§8.2) — remove the formula from the sidecar and graph. The value
|
|
124
|
+
* (row[field]) is the grid's responsibility and is kept as-is.
|
|
125
|
+
*
|
|
126
|
+
* @param rowId - 대상 행의 stable id / Stable id of the target row
|
|
127
|
+
* @param field - 컬럼 field 명 / Column field name
|
|
128
|
+
* @returns 재계산이 필요한 (구) dependents 키 배열 / Keys of the former dependents that need recalculation
|
|
129
|
+
*/
|
|
51
130
|
clearCellFormula(rowId: string, field: string): CellKey[];
|
|
131
|
+
/**
|
|
132
|
+
* (rowId, field) 셀의 마지막 평가 에러 코드를 반환한다(에러 없으면 null).
|
|
133
|
+
* / Return the last evaluation error code of the (rowId, field) cell (null if none).
|
|
134
|
+
*
|
|
135
|
+
* @param rowId - 대상 행의 stable id / Stable id of the target row
|
|
136
|
+
* @param field - 컬럼 field 명 / Column field name
|
|
137
|
+
* @returns 에러 코드 또는 null / Error code or null
|
|
138
|
+
*/
|
|
52
139
|
getCellError(rowId: string, field: string): FormulaErrorCode | null;
|
|
53
|
-
/**
|
|
140
|
+
/**
|
|
141
|
+
* 디버깅용(§8.2 getDependents) — flat 좌표가 아니라 (rowId, field) 그대로 반환한다(헤드리스 계층).
|
|
142
|
+
* / For debugging (§8.2 getDependents) — returns (rowId, field) as-is rather than flat
|
|
143
|
+
* coordinates (headless layer).
|
|
144
|
+
*
|
|
145
|
+
* @param rowId - 대상 행의 stable id / Stable id of the target row
|
|
146
|
+
* @param field - 컬럼 field 명 / Column field name
|
|
147
|
+
* @returns 이 셀에 의존하는 셀들의 {rowId, field} 배열 / Array of {rowId, field} for cells depending on this one
|
|
148
|
+
*/
|
|
54
149
|
getDependents(rowId: string, field: string): Array<{
|
|
55
150
|
rowId: string;
|
|
56
151
|
field: string;
|
|
@@ -60,24 +155,71 @@ export declare class RecalcCoordinator {
|
|
|
60
155
|
* 폐포를 구해 Kahn 위상 1패스로 재계산한다. 삭제 무효화(F3-R28)는 별도 특수 로직 없이,
|
|
61
156
|
* 호출부가 "삭제된 rowId/field 를 이미 grid 에서 제거한 뒤" 그 dependents 를 keys 로
|
|
62
157
|
* 넘기면 evaluate 과정에서 accessor.hasRow/hasField 가 false → 자연스럽게 #REF.
|
|
158
|
+
* / C2 batch entry point: from `keys` (leaf cells whose value changed, or formula cells that
|
|
159
|
+
* need re-evaluation) it computes the dependents closure and recalculates in a single Kahn
|
|
160
|
+
* topological pass. Delete invalidation (F3-R28) needs no special logic: if the caller
|
|
161
|
+
* passes the dependents as `keys` after the deleted rowId/field is already removed from the
|
|
162
|
+
* grid, accessor.hasRow/hasField return false during evaluate → naturally #REF.
|
|
163
|
+
*
|
|
164
|
+
* @param keys - 변경 시작 셀 키 배열(seed) / Seed cell keys where the change starts
|
|
165
|
+
* @returns 이번 재계산 요약 / Summary of this recalculation
|
|
63
166
|
*/
|
|
64
167
|
onValuesChanged(keys: CellKey[]): RecalcSummary;
|
|
65
168
|
private _evaluateOne;
|
|
66
|
-
/**
|
|
169
|
+
/**
|
|
170
|
+
* recalculate()(§8.2) — 등록된 전체 수식 노드를 위상정렬 후 평가한다(setData/컬럼 변경 등
|
|
171
|
+
* 광범위 변경 시).
|
|
172
|
+
* / recalculate() (§8.2) — topologically sort and evaluate every registered formula node
|
|
173
|
+
* (for broad changes such as setData or column changes).
|
|
174
|
+
*
|
|
175
|
+
* @returns 이번 재계산 요약 / Summary of this recalculation
|
|
176
|
+
*/
|
|
67
177
|
recalculateAll(): RecalcSummary;
|
|
68
|
-
/**
|
|
178
|
+
/**
|
|
179
|
+
* applySort/applyFilter 후크가 호출할 편의 메서드 — range 보유 수식을 전부 dirty 처리한다(§3.5 P0).
|
|
180
|
+
* / Convenience method for applySort/applyFilter hooks — dirties every range-bearing formula
|
|
181
|
+
* (§3.5 P0).
|
|
182
|
+
*
|
|
183
|
+
* @returns 이번 재계산 요약 / Summary of this recalculation
|
|
184
|
+
*/
|
|
69
185
|
recalcRangeBearing(): RecalcSummary;
|
|
70
|
-
/**
|
|
186
|
+
/**
|
|
187
|
+
* removeRow 후크 편의 메서드 — 이 rowId 를 deps 로 가진 수식들을 재계산한다(자연 #REF, §5.1).
|
|
188
|
+
* / Convenience method for the removeRow hook — recalculates formulas that depend on this
|
|
189
|
+
* rowId (naturally #REF, §5.1).
|
|
190
|
+
*
|
|
191
|
+
* @param rowId - 삭제/무효화된 행의 stable id / Stable id of the deleted/invalidated row
|
|
192
|
+
* @returns 이번 재계산 요약 / Summary of this recalculation
|
|
193
|
+
*/
|
|
71
194
|
invalidateRow(rowId: string): RecalcSummary;
|
|
72
|
-
/**
|
|
195
|
+
/**
|
|
196
|
+
* removeColumn 후크 편의 메서드 — 이 field 를 deps 로 가진 수식들을 재계산한다(자연 #REF).
|
|
197
|
+
* / Convenience method for the removeColumn hook — recalculates formulas that depend on this
|
|
198
|
+
* field (naturally #REF).
|
|
199
|
+
*
|
|
200
|
+
* @param field - 삭제된 컬럼 field 명 / Field name of the deleted column
|
|
201
|
+
* @returns 이번 재계산 요약 / Summary of this recalculation
|
|
202
|
+
*/
|
|
73
203
|
invalidateField(field: string): RecalcSummary;
|
|
74
204
|
/**
|
|
75
205
|
* srcRowId/srcField 의 저장된 수식에서 "상대(비-$) 축만" dRow/dCol 만큼 오프셋한 새
|
|
76
|
-
* 수식 원문을
|
|
77
|
-
* "#REF!" 텍스트로 대체된다(
|
|
206
|
+
* 수식 원문을 만든다(§8.2/C3, F1 fill 전용). 절대($) 축은 불변(C3). 대상 위치가 범위를
|
|
207
|
+
* 벗어나면 해당 참조는 "#REF!" 텍스트로 대체된다(관용 표기, 이 문자열은 재파싱 시 명시적
|
|
78
208
|
* 깨짐을 사용자가 알아볼 수 있게 하기 위한 것 — 실제 파서가 #REF! 토큰 자체를 정식
|
|
79
209
|
* 문법으로 지원하진 않으므로, F1 배선 시 이 반환값을 그대로 setCellFormula 에 넘기면
|
|
80
210
|
* 파싱 실패 → #ERR 로 귀결한다는 점을 후속 배선 태스크가 인지해야 한다).
|
|
211
|
+
* / Build a new formula source from the formula stored at srcRowId/srcField, offsetting only
|
|
212
|
+
* the relative (non-$) axes by dRow/dCol (§8.2/C3, for F1 fill). Absolute ($) axes are
|
|
213
|
+
* unchanged (C3). If a target lands out of range, that reference is replaced with the
|
|
214
|
+
* literal "#REF!" text (a conventional marker so the user sees an explicit break; the parser
|
|
215
|
+
* does not accept a #REF! token as real grammar, so a follow-up wiring task must note that
|
|
216
|
+
* feeding this return value straight into setCellFormula yields a parse failure → #ERR).
|
|
217
|
+
*
|
|
218
|
+
* @param srcRowId - 원본 수식이 있는 행의 stable id / Stable id of the row holding the source formula
|
|
219
|
+
* @param srcField - 원본 수식이 있는 컬럼 field 명 / Field of the column holding the source formula
|
|
220
|
+
* @param dRow - 행 오프셋(표시 순서 기준) / Row offset (in displayed order)
|
|
221
|
+
* @param dCol - 열 오프셋(visibleFields 기준) / Column offset (in visibleFields)
|
|
222
|
+
* @returns 오프셋된 새 수식 원문("=..."), 원본이 없으면 빈 문자열 / Offset formula source ("=..."), or empty string if no source
|
|
81
223
|
*/
|
|
82
224
|
offsetFormula(srcRowId: string, srcField: string, dRow: number, dCol: number): string;
|
|
83
225
|
private _shiftAst;
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { AstNode, FormulaGridAccessor } from './types.js';
|
|
2
|
+
/** 구조편집 종류(행/열 삽입·삭제·이동, §2.5). / Structural edit kinds (row/col insert/delete/move, §2.5). */
|
|
3
|
+
export type StructuralEdit = {
|
|
4
|
+
op: 'insertRows';
|
|
5
|
+
at: number;
|
|
6
|
+
count: number;
|
|
7
|
+
} | {
|
|
8
|
+
op: 'deleteRows';
|
|
9
|
+
at: number;
|
|
10
|
+
count: number;
|
|
11
|
+
} | {
|
|
12
|
+
op: 'moveRows';
|
|
13
|
+
from: number;
|
|
14
|
+
to: number;
|
|
15
|
+
count: number;
|
|
16
|
+
} | {
|
|
17
|
+
op: 'insertCols';
|
|
18
|
+
at: number;
|
|
19
|
+
count: number;
|
|
20
|
+
} | {
|
|
21
|
+
op: 'deleteCols';
|
|
22
|
+
at: number;
|
|
23
|
+
count: number;
|
|
24
|
+
} | {
|
|
25
|
+
op: 'moveCols';
|
|
26
|
+
from: number;
|
|
27
|
+
to: number;
|
|
28
|
+
count: number;
|
|
29
|
+
};
|
|
30
|
+
/** #REF 전환된 참조 1건(원문·사유, §2.5). / One reference turned into #REF (source + reason, §2.5). */
|
|
31
|
+
export interface BrokenRef {
|
|
32
|
+
/** 사유(삭제된 행/열). / Reason (deleted row/col). */
|
|
33
|
+
readonly reason: 'row-deleted' | 'col-deleted';
|
|
34
|
+
/** 사람이 읽을 참조 요약(rowId/field). / Human-readable ref summary. */
|
|
35
|
+
readonly ref: string;
|
|
36
|
+
}
|
|
37
|
+
/** 재작성 리포트(§2.5). / Rewrite report (§2.5). */
|
|
38
|
+
export interface RewriteReport {
|
|
39
|
+
/** 시프트된(dRow 변경) 참조 수. / Count of shifted (dRow-changed) references. */
|
|
40
|
+
readonly rewritten: number;
|
|
41
|
+
/** #REF 전환된 참조. / References turned into #REF. */
|
|
42
|
+
readonly broken: BrokenRef[];
|
|
43
|
+
/** 변경 없는 참조 수. / Count of unchanged references. */
|
|
44
|
+
readonly unchanged: number;
|
|
45
|
+
}
|
|
46
|
+
/** AST 순수 변환기(§2.5). / Pure AST transformer (§2.5). */
|
|
47
|
+
export interface ReferenceRewriter {
|
|
48
|
+
/** 단일 AST 재작성. 대상 소멸 참조는 { t:'error', code:'#REF' } 로 전환(REQ-T8-805). / Rewrite a single AST; dead refs → #REF. */
|
|
49
|
+
rewrite(ast: AstNode, host: {
|
|
50
|
+
rowId: string;
|
|
51
|
+
field: string;
|
|
52
|
+
}, edit: StructuralEdit): AstNode;
|
|
53
|
+
/** 직전 rewrite 의 리포트(undo·사유 표기용). / Report of the most recent rewrite (for undo/reason surfacing). */
|
|
54
|
+
lastReport(): RewriteReport;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* `ReferenceRewriter` 기본 구현. host 좌표(pre-edit)로 참조를 해소해 삭제/시프트를 판정한다.
|
|
58
|
+
* / Default `ReferenceRewriter`. Resolves refs against pre-edit host coordinates to decide
|
|
59
|
+
* deletion/shift.
|
|
60
|
+
*
|
|
61
|
+
* @example
|
|
62
|
+
* const rw = new AstReferenceRewriter(accessor);
|
|
63
|
+
* const ast2 = rw.rewrite(ast, { rowId: 'r5', field: 'total' }, { op: 'deleteRows', at: 2, count: 1 });
|
|
64
|
+
* rw.lastReport(); // { rewritten, broken: [{reason:'row-deleted',…}], unchanged }
|
|
65
|
+
*/
|
|
66
|
+
export declare class AstReferenceRewriter implements ReferenceRewriter {
|
|
67
|
+
private readonly _accessor;
|
|
68
|
+
private _rewritten;
|
|
69
|
+
private _broken;
|
|
70
|
+
private _unchanged;
|
|
71
|
+
constructor(_accessor: FormulaGridAccessor);
|
|
72
|
+
rewrite(ast: AstNode, host: {
|
|
73
|
+
rowId: string;
|
|
74
|
+
field: string;
|
|
75
|
+
}, edit: StructuralEdit): AstNode;
|
|
76
|
+
lastReport(): RewriteReport;
|
|
77
|
+
private _walk;
|
|
78
|
+
/** 단일 참조 재작성. 'deleted' 반환 시 #REF. 불변이면 원 참조 객체를 그대로 반환(구조 공유). */
|
|
79
|
+
private _rewriteRef;
|
|
80
|
+
private _refLabel;
|
|
81
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { FunctionDef, FunctionRegistry } from '../../FunctionRegistry.js';
|
|
2
|
+
/** 확장 함수군(tier:'extended'). 코어 미포함 — 명시 등록 시에만 활성. / Extended set; opt-in only. */
|
|
3
|
+
export declare const EXTENDED_FUNCTIONS: readonly FunctionDef[];
|
|
4
|
+
/**
|
|
5
|
+
* 확장 함수군을 레지스트리에 일괄 등록(지연로딩 진입점). 이미 있는 이름은 override 로 교체.
|
|
6
|
+
* / Batch-register the extended function set (lazy-load entry point). Existing names are overridden.
|
|
7
|
+
*
|
|
8
|
+
* @param reg - 대상 함수 레지스트리 / Target function registry
|
|
9
|
+
*/
|
|
10
|
+
export declare function registerExtendedFunctions(reg: FunctionRegistry): void;
|
|
@@ -1,15 +1,46 @@
|
|
|
1
1
|
import { AstNode, FormulaGridAccessor, RefMode } from './types.js';
|
|
2
|
-
/**
|
|
2
|
+
/**
|
|
3
|
+
* 열문자(A,B,...,Z,AA,...)를 0-based visibleLeaves 인덱스로 변환한다.
|
|
4
|
+
* / Convert column letters (A,B,...,Z,AA,...) to a 0-based visibleLeaves index.
|
|
5
|
+
*
|
|
6
|
+
* @param letters - 열문자 문자열(대소문자 무관) / Column-letter string (case-insensitive)
|
|
7
|
+
* @returns 0-based 열 인덱스 / 0-based column index
|
|
8
|
+
*/
|
|
3
9
|
export declare function colLettersToIndex(letters: string): number;
|
|
4
|
-
/**
|
|
10
|
+
/**
|
|
11
|
+
* 0-based visibleLeaves 인덱스를 열문자(A,B,...,Z,AA,...)로 변환한다.
|
|
12
|
+
* offsetFormula/serializeFormula 가 공유 재사용한다.
|
|
13
|
+
* / Convert a 0-based visibleLeaves index to column letters (A,B,...,Z,AA,...).
|
|
14
|
+
* Shared by offsetFormula/serializeFormula.
|
|
15
|
+
*
|
|
16
|
+
* @param index - 0-based 열 인덱스 / 0-based column index
|
|
17
|
+
* @returns 열문자 문자열(빈 경우 'A') / Column-letter string ('A' when empty)
|
|
18
|
+
*/
|
|
5
19
|
export declare function indexToColLetters(index: number): string;
|
|
6
20
|
/**
|
|
7
21
|
* 파서가 만든 원시 AST(rawRef/rawRange 포함)를 정규화해 ref/range/error 노드로 치환한다.
|
|
8
22
|
* host = 이 수식이 저장된 셀(현재 행 컨텍스트, FieldRef·상대참조 기준점).
|
|
23
|
+
* / Normalize a raw AST (containing rawRef/rawRange) produced by the parser, replacing them
|
|
24
|
+
* with ref/range/error nodes (§3.3 pipeline). `host` is the cell where this formula is
|
|
25
|
+
* stored (current row context; anchor for FieldRef and relative refs).
|
|
26
|
+
*
|
|
27
|
+
* @param ast - 파서가 만든 원시 AST / Raw AST produced by the parser
|
|
28
|
+
* @param host - 수식이 저장된 호스트 셀(rowId·field) / Host cell (rowId, field) where the formula is stored
|
|
29
|
+
* @param accessor - 그리드 좌표/값 접근자 / Grid coordinate/value accessor
|
|
30
|
+
* @param refMode - 참조 정규화 모드('stable' 기본 / 'relative') / Reference normalization mode ('stable' default / 'relative')
|
|
31
|
+
* @returns 정규화된 AST / The normalized AST
|
|
9
32
|
*/
|
|
10
33
|
export declare function normalizeAst(ast: AstNode, host: {
|
|
11
34
|
rowId: string;
|
|
12
35
|
field: string;
|
|
13
36
|
}, accessor: FormulaGridAccessor, refMode?: RefMode): AstNode;
|
|
14
|
-
/**
|
|
37
|
+
/**
|
|
38
|
+
* 이 AST가 범위 참조를 하나라도 포함하는지 판별한다(§3.5 hasRangeRef,
|
|
39
|
+
* applySort/applyFilter 시 dirty 대상 판정에 사용).
|
|
40
|
+
* / Whether this AST contains any range reference (§3.5 hasRangeRef; used to decide the
|
|
41
|
+
* dirty set on applySort/applyFilter).
|
|
42
|
+
*
|
|
43
|
+
* @param ast - 검사할 AST / AST to inspect
|
|
44
|
+
* @returns 범위 참조 포함 여부 / Whether a range reference is present
|
|
45
|
+
*/
|
|
15
46
|
export declare function computeHasRangeRef(ast: AstNode): boolean;
|
|
@@ -1,7 +1,17 @@
|
|
|
1
|
-
/**
|
|
1
|
+
/**
|
|
2
|
+
* 수식 리터럴/셀 텍스트가 산술 가능한 숫자 형태(정수/소수/과학표기)인지 판별하는 정규식.
|
|
3
|
+
* / Regex that tests whether a formula literal or cell text is an arithmetic-capable number
|
|
4
|
+
* form (integer / decimal / scientific notation).
|
|
5
|
+
*/
|
|
2
6
|
export declare const NUMERIC_LITERAL_RE: RegExp;
|
|
3
7
|
/**
|
|
4
8
|
* 과학표기(`1e-5`, `2.5E3`)를 정확한 10진 문자열로 변환한다(부호/자릿수 이동만 사용,
|
|
5
9
|
* 부동소수점 경유 없음). 과학표기가 아니면 trim만 하여 그대로 반환.
|
|
10
|
+
* / Convert scientific notation (`1e-5`, `2.5E3`) into an exact decimal string using only
|
|
11
|
+
* sign/digit shifting (never routed through a floating-point value, per §2.4/F3-R20). Input
|
|
12
|
+
* that is not scientific notation is returned trimmed as-is.
|
|
13
|
+
*
|
|
14
|
+
* @param raw - 변환할 원시 숫자 문자열 / Raw numeric string to convert
|
|
15
|
+
* @returns 정확한 10진 문자열(과학표기가 아니면 trim된 원문) / Exact decimal string (trimmed original if not scientific)
|
|
6
16
|
*/
|
|
7
17
|
export declare function normalizeNumericLiteral(raw: string): string;
|
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
import { AstNode, FormulaGridAccessor } from './types.js';
|
|
2
|
-
/**
|
|
2
|
+
/**
|
|
3
|
+
* 정규화 AST를 다시 "=..." 형태의 A1 원문으로 직렬화한다(offsetFormula 결과물 조립용).
|
|
4
|
+
* / Serialize a normalized AST back into "=..." A1 source text (used to assemble
|
|
5
|
+
* offsetFormula results; see §4.3 / §8.2 / C3).
|
|
6
|
+
*
|
|
7
|
+
* @param ast - 직렬화할 정규화 AST / Normalized AST to serialize
|
|
8
|
+
* @param host - 상대참조 기준점이 되는 호스트 셀(rowId·field) / Host cell (rowId, field) anchoring relative refs
|
|
9
|
+
* @param accessor - 그리드 좌표/값 접근자 / Grid coordinate/value accessor
|
|
10
|
+
* @returns "=" 로 시작하는 A1 원문 문자열 / A1 source string prefixed with "="
|
|
11
|
+
*/
|
|
3
12
|
export declare function astToSource(ast: AstNode, host: {
|
|
4
13
|
rowId: string;
|
|
5
14
|
field: string;
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
export type Priority = 'P0' | 'P1' | 'P2';
|
|
2
|
+
export type AdapterId = 'react' | 'vue' | 'jquery' | 'vanilla';
|
|
3
|
+
/** 코어 능력 선언. / Declared core capability. */
|
|
4
|
+
export interface Capability {
|
|
5
|
+
readonly id: string;
|
|
6
|
+
readonly priority: Priority;
|
|
7
|
+
readonly title?: string;
|
|
8
|
+
}
|
|
9
|
+
/** 어댑터별 노출/동형동작 선언. / Per-adapter conformance declaration. */
|
|
10
|
+
export interface AdapterConformance {
|
|
11
|
+
readonly adapter: AdapterId;
|
|
12
|
+
readonly exposed: ReadonlySet<string>;
|
|
13
|
+
readonly behaviorMatch: ReadonlySet<string>;
|
|
14
|
+
}
|
|
15
|
+
/** 능력×어댑터 격자의 한 셀. / One cell of the capability × adapter grid. */
|
|
16
|
+
export interface ParityCell {
|
|
17
|
+
readonly capabilityId: string;
|
|
18
|
+
readonly adapter: AdapterId;
|
|
19
|
+
readonly exposed: boolean;
|
|
20
|
+
readonly behaviorMatch: boolean;
|
|
21
|
+
}
|
|
22
|
+
export interface AdapterParity {
|
|
23
|
+
readonly adapter: AdapterId;
|
|
24
|
+
readonly exposureRate: number;
|
|
25
|
+
readonly behaviorMatchRate: number;
|
|
26
|
+
}
|
|
27
|
+
export interface ParityMatrix {
|
|
28
|
+
readonly cells: readonly ParityCell[];
|
|
29
|
+
readonly perAdapter: readonly AdapterParity[];
|
|
30
|
+
/** P0 능력이 어느 어댑터에서든 미노출/미일치인 셀 목록. 비어있어야 게이트 통과. */
|
|
31
|
+
readonly p0Gaps: readonly ParityCell[];
|
|
32
|
+
/** P0 100% 게이트 통과 여부. / Whether the P0 100% gate passes. */
|
|
33
|
+
readonly p0Pass: boolean;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* 읽기전용 능력 SSOT. register 는 코어 능력 선언 시점의 내부 조립용(확장 표면 아님).
|
|
37
|
+
* / Read-only capability SSOT. `register` is for internal declaration, not an extension surface.
|
|
38
|
+
*/
|
|
39
|
+
export declare class CapabilityRegistry {
|
|
40
|
+
private readonly _caps;
|
|
41
|
+
register(cap: Capability): this;
|
|
42
|
+
list(): readonly Capability[];
|
|
43
|
+
get(id: string): Capability | undefined;
|
|
44
|
+
snapshot(): CapabilitySnapshot;
|
|
45
|
+
}
|
|
46
|
+
/** 포트가 노출하는 읽기전용 능력 스냅샷(도메인 상태 아님). / Read-only capability probe snapshot. */
|
|
47
|
+
export interface CapabilitySnapshot {
|
|
48
|
+
readonly ids: readonly string[];
|
|
49
|
+
readonly p0Ids: readonly string[];
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* 노출율·일치율 %계량 + P0 미달 항목 리포트. CI 게이트가 소비.
|
|
53
|
+
* / Computes exposure/behavior rates and the P0 gap list. Consumed by the CI gate.
|
|
54
|
+
*/
|
|
55
|
+
export declare function computeParity(caps: readonly Capability[], confs: readonly AdapterConformance[]): ParityMatrix;
|
|
56
|
+
/**
|
|
57
|
+
* 코어 능력 SSOT 싱글턴. 새 코어 능력 추가 시 여기에 등록 → 패리티 매트릭스가
|
|
58
|
+
* 자동으로 4어댑터 커버리지를 요구(고아 능력=미노출 검출).
|
|
59
|
+
* / Core capability SSOT singleton.
|
|
60
|
+
*/
|
|
61
|
+
export declare const CAPABILITY_REGISTRY: CapabilityRegistry;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { GridOptions } from '../types.js';
|
|
2
|
+
import { GridHostPort, GridPropsPatch, Unsubscribe, HostEventHandler } from './GridHostPort.js';
|
|
3
|
+
import { CapabilitySnapshot } from './CapabilityRegistry.js';
|
|
4
|
+
/**
|
|
5
|
+
* 포트를 OpenGrid 파사드로 구동하는 험블 드라이버.
|
|
6
|
+
* CRC: 책임=파사드 생명주기·이벤트·재조정 번역 / 협력자=OpenGrid(파사드)·reconcile·CapabilityRegistry.
|
|
7
|
+
*/
|
|
8
|
+
export declare class GridHostDriver<T extends Record<string, any> = any> implements GridHostPort<T> {
|
|
9
|
+
private _grid;
|
|
10
|
+
private _container;
|
|
11
|
+
private _lastOptions;
|
|
12
|
+
private readonly _subs;
|
|
13
|
+
mount(container: HTMLElement, options: GridOptions<T>): void;
|
|
14
|
+
unmount(): void;
|
|
15
|
+
updateProps(patch: GridPropsPatch<T>): void;
|
|
16
|
+
subscribe(event: string, handler: HostEventHandler): Unsubscribe;
|
|
17
|
+
get capabilities(): CapabilitySnapshot;
|
|
18
|
+
get mounted(): boolean;
|
|
19
|
+
/** 구조 변경 시 원자적 재생성(이벤트 재구독 포함). / Atomic recreate on structural change. */
|
|
20
|
+
private _recreate;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* 코어가 export 하는 유일한 팩토리 — 어댑터는 구현 클래스(GridHostDriver)를 모른다(캡슐화, Abstract Factory).
|
|
24
|
+
* 서버/헤드리스 타깃용 대체 드라이버는 팩토리 뒤에서 교체 가능(REQ-TX-846).
|
|
25
|
+
* / The single factory the core exports; adapters never see the concrete driver class.
|
|
26
|
+
*/
|
|
27
|
+
export declare function createGridHost<T extends Record<string, any> = any>(): GridHostPort<T>;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { GridOptions, ColumnDef } from '../types.js';
|
|
2
|
+
import { CapabilitySnapshot } from './CapabilityRegistry.js';
|
|
3
|
+
/**
|
|
4
|
+
* 프레임워크가 그리드에 반영을 요청하는 최소 옵션 델타(구조/데이터/외관).
|
|
5
|
+
* / Minimal option delta a framework can request the grid to apply.
|
|
6
|
+
*/
|
|
7
|
+
export interface GridPropsPatch<T = any> {
|
|
8
|
+
readonly data?: readonly T[];
|
|
9
|
+
readonly columns?: readonly ColumnDef<T>[];
|
|
10
|
+
readonly theme?: string;
|
|
11
|
+
readonly skin?: string;
|
|
12
|
+
/** props 로 못 덮는 나머지 코어 옵션(부분). 구조 옵션 변경은 재생성 유발(reconcile). */
|
|
13
|
+
readonly options?: Partial<GridOptions<T>>;
|
|
14
|
+
}
|
|
15
|
+
/** subscribe 해지자. 프레임워크 unmount 시 반드시 호출(누수 방지). / Unsubscribe handle. */
|
|
16
|
+
export type Unsubscribe = () => void;
|
|
17
|
+
/** 포트 이벤트 핸들러(프레임워크 무관). / Framework-agnostic event handler. */
|
|
18
|
+
export type HostEventHandler = (payload: any) => void;
|
|
19
|
+
/**
|
|
20
|
+
* 코어↔호스트의 유일한 안정 경계(semver 공개 계약).
|
|
21
|
+
* 어떤 멤버도 React/Vue/jQuery 타입을 참조하지 않는다(DIP 근인 제거, REQ-TX-848).
|
|
22
|
+
* / The single stable seam between core and host. No member references any framework type.
|
|
23
|
+
*/
|
|
24
|
+
export interface GridHostPort<T extends Record<string, any> = any> {
|
|
25
|
+
/** 컨테이너에 그리드를 마운트. 이미 마운트면 no-op+dev 경고. 멱등 계약. */
|
|
26
|
+
mount(container: HTMLElement, options: GridOptions<T>): void;
|
|
27
|
+
/** 마운트 해제 + 모든 리스너 정리(파사드 destroy 위임). 멱등. */
|
|
28
|
+
unmount(): void;
|
|
29
|
+
/** 얕은 diff 로 최소 변이 적용(reconcile 정책). 미마운트 시 dev 경고. */
|
|
30
|
+
updateProps(patch: GridPropsPatch<T>): void;
|
|
31
|
+
/** 코어 이벤트 구독. 반환 해지자를 어댑터가 생명주기에 묶어 반드시 해제. */
|
|
32
|
+
subscribe(event: string, handler: HostEventHandler): Unsubscribe;
|
|
33
|
+
/** (읽기 전용) 능력 프로브 — 패리티 매트릭스가 질의. 도메인 상태 노출 아님. */
|
|
34
|
+
readonly capabilities: CapabilitySnapshot;
|
|
35
|
+
/** 마운트 여부(테스트·어댑터 방어용, 읽기 전용). */
|
|
36
|
+
readonly mounted: boolean;
|
|
37
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { SliceKey } from '../coordinate/ports.js';
|
|
2
|
+
/** REQ-TX-841 위반 — 비소유 모듈이 좌표 슬라이스를 직접 변이하려 함. / Slice-ownership violation. */
|
|
3
|
+
export declare class SliceOwnershipViolation extends Error {
|
|
4
|
+
readonly slice: SliceKey;
|
|
5
|
+
readonly owner: string;
|
|
6
|
+
readonly detail: string;
|
|
7
|
+
constructor(slice: SliceKey, owner: string, detail: string);
|
|
8
|
+
}
|
|
9
|
+
/** 소유자 조회. / Look up the declared owner of a slice. */
|
|
10
|
+
export declare function ownerOf(slice: SliceKey): string;
|
|
11
|
+
/**
|
|
12
|
+
* 소유권 assert — 비소유 액터가 슬라이스를 변이하려 하면 throw.
|
|
13
|
+
* 소유 모듈이 변이 진입점에서 스스로를 신고하는 저비용 가드.
|
|
14
|
+
* / Assert ownership; throws if a non-owner actor attempts to mutate the slice.
|
|
15
|
+
*/
|
|
16
|
+
export declare function assertSliceOwner(slice: SliceKey, actor: string): void;
|
|
17
|
+
/**
|
|
18
|
+
* 좌표 슬라이스를 읽기전용으로 봉인 — 커널은 슬라이스를 read-only 입력으로만 받으므로,
|
|
19
|
+
* 소비 경로에서 어떤 직접 쓰기(프로퍼티 대입·delete·배열 변이 메서드)든 즉시 SliceOwnershipViolation.
|
|
20
|
+
* 비소유 모듈의 우발적 변이를 런타임에서 결정론적으로 탐지한다(dev throw, REQ-TX-841).
|
|
21
|
+
*
|
|
22
|
+
* `owner` 인자가 주어지면 소유자 자신은 변이를 허용(신뢰 경계) — 그 외 전부 차단.
|
|
23
|
+
* / Seal a coordinate slice as read-only. Any direct write throws a SliceOwnershipViolation.
|
|
24
|
+
*/
|
|
25
|
+
export declare function sealSlice<V extends object>(slice: SliceKey, value: V, owner?: string): V;
|
|
26
|
+
/** 전체 슬라이스 키 목록(테스트·게이트 열거용). / All slice keys. */
|
|
27
|
+
export declare const SLICE_KEYS: SliceKey[];
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export type ArchRuleId = 'core-imports-framework' | 'headless-dom-global' | 'a11y-aria-write' | 'getcomputedstyle-scope';
|
|
2
|
+
export interface ArchViolation {
|
|
3
|
+
readonly rule: ArchRuleId;
|
|
4
|
+
readonly path: string;
|
|
5
|
+
readonly line: number;
|
|
6
|
+
readonly detail: string;
|
|
7
|
+
}
|
|
8
|
+
export interface SourceFile {
|
|
9
|
+
readonly path: string;
|
|
10
|
+
readonly content: string;
|
|
11
|
+
}
|
|
12
|
+
export interface ArchCheckOptions {
|
|
13
|
+
/** 헤드리스 순수 dir 접두사(이 안에서 DOM 전역 금지). / Headless-pure dir prefixes. */
|
|
14
|
+
readonly headlessDirs?: readonly string[];
|
|
15
|
+
/** 코어 접두사(이 안에서 프레임워크 import 금지). / Core prefix (no framework imports). */
|
|
16
|
+
readonly coreDir?: string;
|
|
17
|
+
/** 경계 화이트리스트(헤드리스 규칙 예외 — humble shell·boundary). / Boundary whitelist. */
|
|
18
|
+
readonly boundaryDirs?: readonly string[];
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* 정적 적합성 검사. 위반 목록 반환(빈 배열=통과).
|
|
22
|
+
* / Static fitness check. Returns the list of violations (empty = pass).
|
|
23
|
+
*/
|
|
24
|
+
export declare function archCheck(files: readonly SourceFile[], opts?: ArchCheckOptions): ArchViolation[];
|
|
25
|
+
/** 위반을 사람이 읽는 리포트로 직렬화(CLI 소비). / Serialize violations for the CLI. */
|
|
26
|
+
export declare function formatViolations(violations: readonly ArchViolation[]): string;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export type { GridHostPort, GridPropsPatch, Unsubscribe, HostEventHandler, } from './GridHostPort.js';
|
|
2
|
+
export { createGridHost, GridHostDriver } from './GridHostDriver.js';
|
|
3
|
+
export { reconcile, STRUCTURAL_KEYS, type ReconcilePlan, type StructuralKey, } from './reconcile.js';
|
|
4
|
+
export { CapabilityRegistry, CAPABILITY_REGISTRY, computeParity, type Capability, type CapabilitySnapshot, type AdapterConformance, type AdapterId, type Priority, type ParityMatrix, type ParityCell, type AdapterParity, } from './CapabilityRegistry.js';
|
|
5
|
+
export { sealSlice, assertSliceOwner, ownerOf, SliceOwnershipViolation, SLICE_KEYS, } from './SliceOwnershipGuard.js';
|
|
6
|
+
export { archCheck, formatViolations, type ArchViolation, type ArchRuleId, type SourceFile, type ArchCheckOptions, } from './archCheck.js';
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { GridOptions } from '../types.js';
|
|
2
|
+
import { GridPropsPatch } from './GridHostPort.js';
|
|
3
|
+
/**
|
|
4
|
+
* 구조 옵션 키(변경 시 그리드 재생성 필요). / Structural option keys (require recreation).
|
|
5
|
+
* 컬럼 형태·고정열·트리/그룹·페이징 등 조립 위상에 영향을 주는 옵션들.
|
|
6
|
+
*/
|
|
7
|
+
export declare const STRUCTURAL_KEYS: readonly ["columns", "frozenColumns", "frozenRows", "treeMode", "groupBy", "masterDetail", "pagination", "virtualScroll", "multiHeader"];
|
|
8
|
+
export type StructuralKey = (typeof STRUCTURAL_KEYS)[number];
|
|
9
|
+
/** updateProps 재조정 계획. / Reconcile plan for updateProps. */
|
|
10
|
+
export interface ReconcilePlan {
|
|
11
|
+
/** 구조 옵션 변경 → 재생성. / Structural change → recreate. */
|
|
12
|
+
readonly recreate: boolean;
|
|
13
|
+
readonly data: boolean;
|
|
14
|
+
readonly theme: boolean;
|
|
15
|
+
readonly skin: boolean;
|
|
16
|
+
readonly options: boolean;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* 순수 함수(헤드리스·결정론). 구조 vs in-place 를 옵션 키 분류표로 판정.
|
|
20
|
+
* / Pure, deterministic. Classifies structural vs in-place using the key table.
|
|
21
|
+
*/
|
|
22
|
+
export declare function reconcile<T>(prev: GridOptions<T>, patch: GridPropsPatch<T>): ReconcilePlan;
|