@web-ppt/edit-core 0.5.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +274 -0
- package/LICENSE +21 -0
- package/README.md +474 -0
- package/dist/animation-catalog.d.ts +21 -0
- package/dist/body-properties.d.ts +8 -0
- package/dist/body-property-schema.d.ts +3 -0
- package/dist/change-classification.d.ts +10 -0
- package/dist/clipboard-binary.d.ts +4 -0
- package/dist/clipboard-links.d.ts +11 -0
- package/dist/clipboard-source.d.ts +23 -0
- package/dist/clipboard.d.ts +4 -0
- package/dist/commands/add-image.d.ts +4 -0
- package/dist/commands/add-shape.d.ts +4 -0
- package/dist/commands/add-slide-identity.d.ts +8 -0
- package/dist/commands/add-slide-template.d.ts +9 -0
- package/dist/commands/add-slide.d.ts +3 -0
- package/dist/commands/add-table.d.ts +4 -0
- package/dist/commands/align-elements.d.ts +4 -0
- package/dist/commands/apply-format.d.ts +4 -0
- package/dist/commands/clipboard-types.d.ts +91 -0
- package/dist/commands/direct-format-patches.d.ts +8 -0
- package/dist/commands/dispatch.d.ts +7 -0
- package/dist/commands/duplicate-slide.d.ts +3 -0
- package/dist/commands/edit-text.d.ts +3 -0
- package/dist/commands/element-effects.d.ts +5 -0
- package/dist/commands/element-fill.d.ts +5 -0
- package/dist/commands/element-image-content.d.ts +17 -0
- package/dist/commands/element-interaction.d.ts +11 -0
- package/dist/commands/element-link.d.ts +5 -0
- package/dist/commands/element-name.d.ts +8 -0
- package/dist/commands/element-order.d.ts +7 -0
- package/dist/commands/element-stroke.d.ts +5 -0
- package/dist/commands/element-text.d.ts +6 -0
- package/dist/commands/element-transform.d.ts +5 -0
- package/dist/commands/element-tree.d.ts +8 -0
- package/dist/commands/fit-text-shape.d.ts +3 -0
- package/dist/commands/format-painter-types.d.ts +17 -0
- package/dist/commands/image-format.d.ts +7 -0
- package/dist/commands/image-resource.d.ts +4 -0
- package/dist/commands/insert-row.d.ts +3 -0
- package/dist/commands/insertion-rect.d.ts +9 -0
- package/dist/commands/paste-elements.d.ts +4 -0
- package/dist/commands/paste-resources.d.ts +18 -0
- package/dist/commands/patch.d.ts +6 -0
- package/dist/commands/remove-slide.d.ts +3 -0
- package/dist/commands/replace-image.d.ts +3 -0
- package/dist/commands/replace-text.d.ts +5 -0
- package/dist/commands/set-animations.d.ts +3 -0
- package/dist/commands/set-body-props.d.ts +3 -0
- package/dist/commands/set-crop.d.ts +3 -0
- package/dist/commands/set-effects.d.ts +3 -0
- package/dist/commands/set-fill.d.ts +3 -0
- package/dist/commands/set-flip.d.ts +4 -0
- package/dist/commands/set-link.d.ts +3 -0
- package/dist/commands/set-para-props.d.ts +3 -0
- package/dist/commands/set-run-props.d.ts +3 -0
- package/dist/commands/set-slide-properties.d.ts +7 -0
- package/dist/commands/set-stroke.d.ts +3 -0
- package/dist/commands/set-xfrm.d.ts +3 -0
- package/dist/commands/set-z.d.ts +5 -0
- package/dist/commands/slide-image.d.ts +4 -0
- package/dist/commands/slide-layout.d.ts +8 -0
- package/dist/commands/slide-notes.d.ts +8 -0
- package/dist/commands/slide-order.d.ts +7 -0
- package/dist/commands/slide-property-types.d.ts +135 -0
- package/dist/commands/slide-property.d.ts +20 -0
- package/dist/commands/slide-tree.d.ts +6 -0
- package/dist/commands/spid.d.ts +4 -0
- package/dist/commands/table-row.d.ts +5 -0
- package/dist/commands/text-target.d.ts +25 -0
- package/dist/commands/types.d.ts +509 -0
- package/dist/commands/xfrm.d.ts +8 -0
- package/dist/data-validation.d.ts +7 -0
- package/dist/document.d.ts +17 -0
- package/dist/dynamic-slide-fields.d.ts +6 -0
- package/dist/edit-core.js +5321 -0
- package/dist/editor.d.ts +38 -0
- package/dist/element-ancestry.d.ts +3 -0
- package/dist/element-name.d.ts +4 -0
- package/dist/element-order.d.ts +7 -0
- package/dist/field-text.d.ts +3 -0
- package/dist/fractional-index.d.ts +10 -0
- package/dist/history.d.ts +50 -0
- package/dist/hyperlink.d.ts +10 -0
- package/dist/image-content.d.ts +7 -0
- package/dist/image-resource-history.d.ts +6 -0
- package/dist/index-D4ZTaYOa.js +706 -0
- package/dist/index.d.ts +46 -0
- package/dist/insertion-DabLme_U.js +5471 -0
- package/dist/insertion-invariants.d.ts +5 -0
- package/dist/layout-assets.d.ts +10 -0
- package/dist/layout-projection.d.ts +24 -0
- package/dist/layout-text-rebase.d.ts +3 -0
- package/dist/model-invariants.d.ts +5 -0
- package/dist/notes-part.d.ts +2 -0
- package/dist/opc/bytes.d.ts +1 -0
- package/dist/opc/crc32.d.ts +1 -0
- package/dist/opc/index.d.ts +3 -0
- package/dist/opc/package-owner.d.ts +4 -0
- package/dist/opc/patch.d.ts +6 -0
- package/dist/opc/types.d.ts +12 -0
- package/dist/opc/zip.d.ts +28 -0
- package/dist/opc-owner-protocol.d.ts +5 -0
- package/dist/opc.js +5 -0
- package/dist/paragraph-properties.d.ts +4 -0
- package/dist/paragraph-property-schema.d.ts +4 -0
- package/dist/patch-DO8497wO.js +322 -0
- package/dist/projection.d.ts +19 -0
- package/dist/recovery-identity.d.ts +35 -0
- package/dist/recovery-types.d.ts +30 -0
- package/dist/recovery.d.ts +28 -0
- package/dist/run-links.d.ts +3 -0
- package/dist/run-properties.d.ts +4 -0
- package/dist/run-property-schema.d.ts +3 -0
- package/dist/save/animation.d.ts +6 -0
- package/dist/save/background-image.d.ts +8 -0
- package/dist/save/clipboard-parts.d.ts +11 -0
- package/dist/save/drawing-color.d.ts +2 -0
- package/dist/save/duplicate-slide-parts.d.ts +15 -0
- package/dist/save/effects.d.ts +6 -0
- package/dist/save/hyperlink.d.ts +18 -0
- package/dist/save/image-content.d.ts +4 -0
- package/dist/save/index.d.ts +5 -0
- package/dist/save/insertion.d.ts +14 -0
- package/dist/save/layout-fallback-source.d.ts +4 -0
- package/dist/save/layout-fallback.d.ts +7 -0
- package/dist/save/materialize.d.ts +5 -0
- package/dist/save/name.d.ts +5 -0
- package/dist/save/notes.d.ts +12 -0
- package/dist/save/order.d.ts +5 -0
- package/dist/save/remove-element.d.ts +4 -0
- package/dist/save/remove-slide-parts.d.ts +11 -0
- package/dist/save/shape-format.d.ts +14 -0
- package/dist/save/slide-parts.d.ts +11 -0
- package/dist/save/slide-properties.d.ts +4 -0
- package/dist/save/table.d.ts +7 -0
- package/dist/save/text-body.d.ts +4 -0
- package/dist/save/text.d.ts +6 -0
- package/dist/save/transition.d.ts +4 -0
- package/dist/save/xfrm.d.ts +22 -0
- package/dist/save/xml-element.d.ts +3 -0
- package/dist/save.js +1559 -0
- package/dist/selection-pane.d.ts +18 -0
- package/dist/selection.d.ts +11 -0
- package/dist/session-assets.d.ts +20 -0
- package/dist/shape-effects.d.ts +6 -0
- package/dist/shape-fill.d.ts +12 -0
- package/dist/shape-stroke.d.ts +9 -0
- package/dist/slide-animation.d.ts +15 -0
- package/dist/slide-background-source.d.ts +13 -0
- package/dist/slide-notes.d.ts +2 -0
- package/dist/slide-properties.d.ts +4 -0
- package/dist/slide-transition.d.ts +19 -0
- package/dist/space.d.ts +47 -0
- package/dist/table-cell.d.ts +10 -0
- package/dist/table-direct-markup.d.ts +3 -0
- package/dist/table-insertion-policy.d.ts +5 -0
- package/dist/table-row-append-validation.d.ts +3 -0
- package/dist/table-rows.d.ts +12 -0
- package/dist/text-model.d.ts +28 -0
- package/dist/text-override-projection.d.ts +8 -0
- package/dist/text-override-validation.d.ts +7 -0
- package/dist/text-position.d.ts +8 -0
- package/dist/text-search-types.d.ts +46 -0
- package/dist/text-search.d.ts +5 -0
- package/dist/transaction-validation.d.ts +5 -0
- package/dist/types.d.ts +519 -0
- package/dist/xml/index.d.ts +9 -0
- package/dist/xml/mutate.d.ts +7 -0
- package/dist/xml/namespace.d.ts +5 -0
- package/dist/xml/nodes.d.ts +22 -0
- package/dist/xml/order.d.ts +15 -0
- package/dist/xml/qname.d.ts +15 -0
- package/dist/xml/query.d.ts +10 -0
- package/dist/xml/state.d.ts +30 -0
- package/dist/xml/tree.d.ts +8 -0
- package/dist/xml/types.d.ts +46 -0
- package/dist/xml.js +19 -0
- package/package.json +67 -0
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { EditDoc, EditableKind, ElementId, SlideId } from './types';
|
|
2
|
+
export interface SelectionPaneItem {
|
|
3
|
+
readonly id: ElementId;
|
|
4
|
+
readonly parentId: ElementId | null;
|
|
5
|
+
readonly depth: number;
|
|
6
|
+
readonly kind: EditDoc['elements'][string]['src']['kind'];
|
|
7
|
+
readonly name: string;
|
|
8
|
+
readonly sourceName: string | null;
|
|
9
|
+
readonly direct: boolean;
|
|
10
|
+
readonly editable: EditableKind;
|
|
11
|
+
readonly locked: boolean;
|
|
12
|
+
readonly ownLocked: boolean;
|
|
13
|
+
readonly hidden: boolean;
|
|
14
|
+
readonly ownHidden: boolean;
|
|
15
|
+
readonly hasChildren: boolean;
|
|
16
|
+
}
|
|
17
|
+
/** 选择窗格与画布共用模型绘制序;逆序只负责把最上层对象放在列表顶部。 */
|
|
18
|
+
export declare function querySelectionPane(doc: EditDoc, slideId: SlideId): SelectionPaneItem[];
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { EditDoc, ElementId } from './types';
|
|
2
|
+
import type { Selection } from './commands/types';
|
|
3
|
+
export declare function cloneSelection(selection: Selection): Selection;
|
|
4
|
+
export declare function isElementDescendantOf(doc: EditDoc, id: ElementId, ancestor: ElementId): boolean;
|
|
5
|
+
/** 选区根只沿每个元素的父链查找,避免大选区用两两后代判断退化为平方复杂度。 */
|
|
6
|
+
export declare function outermostSelectedElementIds(doc: EditDoc, ids: readonly ElementId[]): ElementId[];
|
|
7
|
+
export declare function normalizeSelection(doc: EditDoc, selection: Selection): Selection;
|
|
8
|
+
/** 结构编辑后过滤已删除身份;普通属性事务仍走严格 normalizeSelection。 */
|
|
9
|
+
export declare function selectionAfterStructure(doc: EditDoc, selection: Selection): Selection;
|
|
10
|
+
/** 会话锁定/隐藏不删除模型,只过滤因此失效的活动选区。 */
|
|
11
|
+
export declare function selectionAfterInteractionState(doc: EditDoc, selection: Selection): Selection;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { PresentationEditAsset, SlideElement } from '@web-ppt/core';
|
|
2
|
+
import type { ClipboardResource } from './commands/types';
|
|
3
|
+
import type { EditDoc, ElementInsertionResource } from './types';
|
|
4
|
+
interface DocAsset {
|
|
5
|
+
readonly mime: string;
|
|
6
|
+
readonly bytes: Uint8Array;
|
|
7
|
+
readonly sourcePart?: string;
|
|
8
|
+
hash?: string;
|
|
9
|
+
}
|
|
10
|
+
export declare const insertionResourceToken: (hash: string) => string;
|
|
11
|
+
/** 保存会替换 doc.package;解析期 URL 与字节的对应关系必须在建模时保留下来。 */
|
|
12
|
+
export declare function registerSessionAssets(doc: EditDoc, editAssets?: readonly PresentationEditAsset[]): void;
|
|
13
|
+
export declare function sessionAsset(doc: EditDoc, url: string): DocAsset | undefined;
|
|
14
|
+
export declare function releaseSessionAssets(doc: EditDoc): void;
|
|
15
|
+
export declare function tokenizeElementAssets(doc: EditDoc, source: SlideElement, used: Set<string>, insertionResources?: readonly ClipboardResource[]): SlideElement;
|
|
16
|
+
export declare function createElementAssetHydrator(resources: readonly ClipboardResource[]): (source: SlideElement) => SlideElement;
|
|
17
|
+
/** EditDoc 保留小型资源 token;只有有效投影需要付出 data URI 的字符串成本。 */
|
|
18
|
+
export declare function hydrateElementInsertionAssets(source: SlideElement, resources: readonly ClipboardResource[]): SlideElement;
|
|
19
|
+
export declare function hydrateInsertionResourceSource(source: string, resource: ElementInsertionResource): string;
|
|
20
|
+
export {};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { Effects } from '@web-ppt/core';
|
|
2
|
+
import type { EditDoc, ElementEffectsState, ElementId } from './types';
|
|
3
|
+
export declare function assertEffects(value: unknown, label: string): asserts value is Effects;
|
|
4
|
+
/** 与 core 解析器及 OOXML 整数单位共用一份规范值,避免保存重开后制造脏状态。 */
|
|
5
|
+
export declare function normalizeEffects(effects: Effects): Effects;
|
|
6
|
+
export declare function queryElementEffects(doc: EditDoc, ids: readonly ElementId[]): ElementEffectsState;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { Fill } from '@web-ppt/core';
|
|
2
|
+
import type { EditDoc, ElementFillState, ElementId } from './types';
|
|
3
|
+
export type VectorFill = Exclude<Fill, {
|
|
4
|
+
type: 'image';
|
|
5
|
+
}>;
|
|
6
|
+
export declare const SHAPE_PATTERN_PRESETS: readonly ["pct5", "pct10", "pct20", "pct25", "pct30", "pct40", "pct50", "pct60", "pct70", "pct75", "pct80", "pct90", "ltHorz", "horz", "dkHorz", "ltVert", "vert", "dkVert", "ltUpDiag", "upDiag", "ltDnDiag", "dnDiag", "smGrid", "lgGrid", "cross", "diagCross", "trellis", "wave"];
|
|
7
|
+
export declare function assertDrawingColor(value: unknown, label: string): asserts value is string;
|
|
8
|
+
/** 命令提交时就收敛到 core 解析器的颜色表示,保存/重开不应改变统一 Schema。 */
|
|
9
|
+
export declare function normalizeDrawingColor(value: string): string;
|
|
10
|
+
export declare function normalizeVectorFill(fill: VectorFill): VectorFill;
|
|
11
|
+
export declare function assertVectorFill(value: unknown, label: string): asserts value is VectorFill;
|
|
12
|
+
export declare function queryElementFill(doc: EditDoc, ids: readonly ElementId[]): ElementFillState;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { Stroke } from '@web-ppt/core';
|
|
2
|
+
import type { EditDoc, ElementId, ElementStrokeState } from './types';
|
|
3
|
+
export type StrokeCommandValue = Stroke | {
|
|
4
|
+
readonly type: 'none';
|
|
5
|
+
} | null;
|
|
6
|
+
export declare function assertStroke(value: unknown, label: string): asserts value is Stroke;
|
|
7
|
+
export declare function strokeDashName(stroke: Stroke): string | null;
|
|
8
|
+
export declare function normalizeStroke(stroke: Stroke): Stroke;
|
|
9
|
+
export declare function queryElementStroke(doc: EditDoc, ids: readonly ElementId[]): ElementStrokeState;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { AnimStep } from '@web-ppt/core';
|
|
2
|
+
import type { EditAnimationStep, EditDoc, SlideAnimationState, SlideId } from './types';
|
|
3
|
+
import { ANIMATION_EFFECTS, animationDirections, animationEffectsForKind } from './animation-catalog';
|
|
4
|
+
export { ANIMATION_EFFECTS, animationDirections, animationEffectsForKind };
|
|
5
|
+
/** 128 个最重的规范效果仍能在 core 的 4096 DOM 节点预算内完整回读。 */
|
|
6
|
+
export declare const MAX_ANIMATION_STEPS = 128;
|
|
7
|
+
export declare function normalizeSlideAnimations(doc: EditDoc, slideId: SlideId, value: unknown, label?: string): readonly EditAnimationStep[];
|
|
8
|
+
/** 来源解析结果映射失败时仍原样投影;查询用 sourceReadonly 告知产品不要冒充完整可编辑。 */
|
|
9
|
+
export declare function sourceAnimationSteps(doc: EditDoc, slideId: SlideId, steps: readonly AnimStep[] | undefined): {
|
|
10
|
+
steps: readonly EditAnimationStep[];
|
|
11
|
+
readonly: boolean;
|
|
12
|
+
};
|
|
13
|
+
export declare function projectAnimationSteps(doc: EditDoc, steps: readonly EditAnimationStep[]): AnimStep[] | undefined;
|
|
14
|
+
export declare function querySlideAnimations(doc: EditDoc, ids: readonly SlideId[]): SlideAnimationState;
|
|
15
|
+
export declare function assertStoredSlideAnimations(doc: EditDoc, slideId: SlideId, value: unknown, label: string): asserts value is readonly EditAnimationStep[];
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { ClipboardClosure } from './clipboard-source';
|
|
2
|
+
import type { OpcPackage } from '@web-ppt/core';
|
|
3
|
+
import type { EditDoc, SlideRecord } from './types';
|
|
4
|
+
import type { XmlElement } from './xml/types';
|
|
5
|
+
export interface SourceImageBackground {
|
|
6
|
+
readonly package: OpcPackage;
|
|
7
|
+
readonly part: string;
|
|
8
|
+
readonly background: XmlElement;
|
|
9
|
+
readonly imageRelationshipId: string;
|
|
10
|
+
readonly closure: ClipboardClosure;
|
|
11
|
+
}
|
|
12
|
+
/** 按 slide → layout → master 的继承停止规则定位真正提供当前图片背景的 OPC 宿主。 */
|
|
13
|
+
export declare function sourceImageBackground(doc: EditDoc, record: SlideRecord): SourceImageBackground | null;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { EditDoc, SlideBackgroundState, SlideHiddenState, SlideId, SlideLayoutState } from './types';
|
|
2
|
+
export declare function querySlideBackground(doc: EditDoc, ids: readonly SlideId[]): SlideBackgroundState;
|
|
3
|
+
export declare function querySlideHidden(doc: EditDoc, ids: readonly SlideId[]): SlideHiddenState;
|
|
4
|
+
export declare function querySlideLayout(doc: EditDoc, ids: readonly SlideId[]): SlideLayoutState;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { type Transition, type TransitionType } from '@web-ppt/core';
|
|
2
|
+
import type { EditDoc, SlideId, SlideTransitionState } from './types';
|
|
3
|
+
/** 顺序是公开契约;宿主可以稳定地分组或持久化最近使用项。 */
|
|
4
|
+
export declare const SLIDE_TRANSITION_TYPES: readonly ["none", "fade", "cut", "push", "pull", "cover", "wipe", "split", "zoom", "dissolve", "checker", "blinds", "comb", "wheel", "circle", "diamond", "plus", "wedge", "newsflash", "randomBar", "strips", "vortex", "switch", "flip", "ripple", "honeycomb", "glitter", "warp", "flythrough", "flash", "shred", "reveal", "wheelReverse", "ferris", "gallery", "conveyor", "pan", "doors", "window", "prism", "morph"];
|
|
5
|
+
export declare function transitionDirections(type: TransitionType): readonly string[];
|
|
6
|
+
export type SlideTransitionInput = {
|
|
7
|
+
readonly type: TransitionType;
|
|
8
|
+
/** none 省略;其余省略时采用 750ms。 */
|
|
9
|
+
readonly durationMs?: number;
|
|
10
|
+
readonly dir?: string;
|
|
11
|
+
/** SetTransition 省略时保留当前页面计时;显式传值才更新。 */
|
|
12
|
+
readonly advanceAfterMs?: number;
|
|
13
|
+
readonly morphBy?: Transition['morphBy'];
|
|
14
|
+
};
|
|
15
|
+
/** 命令与恢复 Patch 共用一处严格归一化,避免合法性在不同入口漂移。 */
|
|
16
|
+
export declare function normalizeSlideTransition(value: unknown, label?: string): Transition;
|
|
17
|
+
/** 模型/Patch 必须已经归一化,不能在回放时悄悄补默认值。 */
|
|
18
|
+
export declare function assertStoredSlideTransition(value: unknown, label: string): asserts value is Transition;
|
|
19
|
+
export declare function querySlideTransition(doc: EditDoc, ids: readonly SlideId[]): SlideTransitionState;
|
package/dist/space.d.ts
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import type { EditDoc, ElementId } from './types';
|
|
2
|
+
export interface SpacePoint {
|
|
3
|
+
x: number;
|
|
4
|
+
y: number;
|
|
5
|
+
}
|
|
6
|
+
/** SVG 同口径仿射矩阵:x' = ax + cy + e,y' = bx + dy + f。 */
|
|
7
|
+
export interface AffineMatrix {
|
|
8
|
+
a: number;
|
|
9
|
+
b: number;
|
|
10
|
+
c: number;
|
|
11
|
+
d: number;
|
|
12
|
+
e: number;
|
|
13
|
+
f: number;
|
|
14
|
+
}
|
|
15
|
+
export interface SlideViewport {
|
|
16
|
+
left: number;
|
|
17
|
+
top: number;
|
|
18
|
+
zoom: number;
|
|
19
|
+
}
|
|
20
|
+
export interface ElementFrameTransform {
|
|
21
|
+
x: number;
|
|
22
|
+
y: number;
|
|
23
|
+
w: number;
|
|
24
|
+
h: number;
|
|
25
|
+
rot: number;
|
|
26
|
+
}
|
|
27
|
+
export declare function composeSpaceMatrices(left: AffineMatrix, right: AffineMatrix): AffineMatrix;
|
|
28
|
+
export declare function elementFrameToParentMatrix(element: ElementFrameTransform): AffineMatrix;
|
|
29
|
+
export declare function transformSpacePoint(matrix: AffineMatrix, point: SpacePoint): SpacePoint;
|
|
30
|
+
export declare function transformSpaceVector(matrix: AffineMatrix, vector: SpacePoint): SpacePoint;
|
|
31
|
+
/** 方向没有平移分量,单独求逆可避免误把父空间原点带进角度计算。 */
|
|
32
|
+
export declare function inverseTransformSpaceVector(matrix: AffineMatrix, vector: SpacePoint): SpacePoint;
|
|
33
|
+
/** 反射会让父空间里的正角方向与幻灯片空间相反;旋转连续性必须沿同一手性展开。 */
|
|
34
|
+
export declare function spaceOrientationParity(matrix: AffineMatrix): 1 | -1;
|
|
35
|
+
export declare function invertSpaceMatrix(matrix: AffineMatrix): AffineMatrix;
|
|
36
|
+
export declare function elementFrameToSlideMatrix(doc: EditDoc, id: ElementId): AffineMatrix;
|
|
37
|
+
/** 元素内容坐标还要经过自身翻转;frame 几何本身不含这一步。 */
|
|
38
|
+
export declare function elementContentToSlideMatrix(doc: EditDoc, id: ElementId): AffineMatrix;
|
|
39
|
+
export declare function elementParentToSlideMatrix(doc: EditDoc, id: ElementId): AffineMatrix;
|
|
40
|
+
/** 组的子坐标系包含自身 frame、翻转及 chOff/chExt 缩放,不能等同于组所在父坐标系。 */
|
|
41
|
+
export declare function elementChildrenToSlideMatrix(doc: EditDoc, id: ElementId): AffineMatrix;
|
|
42
|
+
export declare function elementFrameToSlidePoint(doc: EditDoc, id: ElementId, point: SpacePoint): SpacePoint;
|
|
43
|
+
export declare function slideToElementFramePoint(doc: EditDoc, id: ElementId, point: SpacePoint): SpacePoint;
|
|
44
|
+
export declare function elementParentToSlidePoint(doc: EditDoc, id: ElementId, point: SpacePoint): SpacePoint;
|
|
45
|
+
export declare function slideToElementParentPoint(doc: EditDoc, id: ElementId, point: SpacePoint): SpacePoint;
|
|
46
|
+
export declare function slideToScreenPoint(point: SpacePoint, viewport: SlideViewport): SpacePoint;
|
|
47
|
+
export declare function screenToSlidePoint(point: SpacePoint, viewport: SlideViewport): SpacePoint;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { ElementRecord, TableCellAddress, TableCellKey, TableCellRowRef, TableRowId } from './types';
|
|
2
|
+
export declare function tableCellKey(cell: TableCellAddress): TableCellKey;
|
|
3
|
+
export declare function parseTableCellKey(value: string): TableCellAddress | null;
|
|
4
|
+
export declare function tableCellKeyBelongsToRow(key: string, rowId: TableRowId): boolean;
|
|
5
|
+
export declare function tableCellRowRef(record: ElementRecord, cell: TableCellAddress): TableCellRowRef | null;
|
|
6
|
+
export declare function tableCellAddressFromRowRef(record: ElementRecord, row: unknown, column: unknown): TableCellAddress | null;
|
|
7
|
+
export declare function tableCellOverrideKeyFromRowRef(row: TableCellRowRef, column: number): TableCellKey;
|
|
8
|
+
export declare function tableCellOverrideKey(record: ElementRecord, cell: TableCellAddress): TableCellKey;
|
|
9
|
+
export declare function tableCellKeyResolver(record: ElementRecord): (key: string) => TableCellAddress | null;
|
|
10
|
+
export declare function assertTableCellAddress(value: unknown, label: string): asserts value is TableCellAddress;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { EditDoc, ElementId, SlideId } from './types';
|
|
2
|
+
export declare const MAX_TABLE_DIMENSION = 75;
|
|
3
|
+
export declare function assertTableDimension(value: number, label: string): void;
|
|
4
|
+
/** 命令层与公开交互层必须共享同一占位符资格规则,避免 UI 接受而模型拒绝。 */
|
|
5
|
+
export declare function isEmptyContentPlaceholder(doc: EditDoc, slideId: SlideId, id: unknown): id is ElementId;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { TableRow } from '@web-ppt/core';
|
|
2
|
+
import type { ElementRecord, TableRowId, TableRowInsertion } from './types';
|
|
3
|
+
export interface OrderedTableRowInsertion extends TableRowInsertion {
|
|
4
|
+
readonly id: TableRowId;
|
|
5
|
+
}
|
|
6
|
+
export declare function orderedTableRowInsertions(record: ElementRecord): OrderedTableRowInsertion[];
|
|
7
|
+
export declare function lastTableRowOrder(record: ElementRecord): string;
|
|
8
|
+
export declare function tableRowsWithoutTextOverrides(record: ElementRecord): TableRow[];
|
|
9
|
+
export declare function tableRowHeightDelta(record: ElementRecord): number;
|
|
10
|
+
export declare function effectiveTableFrameHeight(record: ElementRecord): number;
|
|
11
|
+
/** SetXfrm 面向当前可见整表;稀疏覆盖保存的是追加前 frame,故需反解同一缩放比例。 */
|
|
12
|
+
export declare function tableBaseFrameHeight(record: ElementRecord, effectiveHeight: number): number;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { TextBody } from '@web-ppt/core';
|
|
2
|
+
import type { TextEditOp, TextRange } from './commands/types';
|
|
3
|
+
import type { ParagraphPropertiesState, ParagraphPropertyOverrides, RunPropertiesState, RunPropertyOverrides, TextFragment, TextMark, TextOverride } from './types';
|
|
4
|
+
export { textBodyFromOverride } from './text-override-projection';
|
|
5
|
+
export declare function flattenTextBody(body: TextBody): Extract<TextOverride, {
|
|
6
|
+
kind: 'flat';
|
|
7
|
+
}>;
|
|
8
|
+
export declare function applyTextEditOps(body: TextBody, ops: readonly TextEditOp[], initial?: Extract<TextOverride, {
|
|
9
|
+
kind: 'flat';
|
|
10
|
+
}>): TextOverride;
|
|
11
|
+
/** 把有效文字选区降成可跨实例传输的格式白名单,不泄漏 OOXML 来源身份。 */
|
|
12
|
+
export declare function textFragmentFromRange(body: TextBody, range: TextRange): TextFragment;
|
|
13
|
+
export declare function applyRunProps(body: TextBody, range: TextRange, props: RunPropertyOverrides, initial?: Extract<TextOverride, {
|
|
14
|
+
kind: 'flat';
|
|
15
|
+
}>): TextOverride;
|
|
16
|
+
export declare function applyParagraphProps(body: TextBody, range: TextRange, props: ParagraphPropertyOverrides, initial?: Extract<TextOverride, {
|
|
17
|
+
kind: 'flat';
|
|
18
|
+
}>): TextOverride;
|
|
19
|
+
export declare function queryTextParagraphProps(body: TextBody, range: TextRange, initial?: Extract<TextOverride, {
|
|
20
|
+
kind: 'flat';
|
|
21
|
+
}>): ParagraphPropertiesState;
|
|
22
|
+
export declare function queryTextRunProps(body: TextBody, range: TextRange, initial?: Extract<TextOverride, {
|
|
23
|
+
kind: 'flat';
|
|
24
|
+
}>): RunPropertiesState;
|
|
25
|
+
/** 链接查询与字符面板复用完全相同的区间/公式边界语义。 */
|
|
26
|
+
export declare function textMarksInRange(body: TextBody, range: TextRange, initial?: Extract<TextOverride, {
|
|
27
|
+
kind: 'flat';
|
|
28
|
+
}>): TextMark[];
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { TextBody } from '@web-ppt/core';
|
|
2
|
+
import type { LinkOverride, TextOverride } from './types';
|
|
3
|
+
/** 用户未触碰的格式每次从当前投影源重基;覆盖层不会冻结旧版式的有效值。 */
|
|
4
|
+
export declare function textBodyFromOverride(override: Extract<TextOverride, {
|
|
5
|
+
kind: 'flat';
|
|
6
|
+
}>, source?: TextBody | null, resolveLink?: (link: Exclude<LinkOverride, {
|
|
7
|
+
kind: 'none';
|
|
8
|
+
}>) => string | undefined): TextBody;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { TextOverride } from './types';
|
|
2
|
+
export declare function validateFlatTextOverride(override: Extract<TextOverride, {
|
|
3
|
+
kind: 'flat';
|
|
4
|
+
}>): void;
|
|
5
|
+
export declare function validateEmptyTextOverride(override: Extract<TextOverride, {
|
|
6
|
+
kind: 'empty';
|
|
7
|
+
}>): void;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { TextBody, TextRun } from '@web-ppt/core';
|
|
2
|
+
import type { TextPosition } from './commands/types';
|
|
3
|
+
/** 公式在编辑字符串里只占一个 UTF-16 位置,不能把光标落进公式树内部。 */
|
|
4
|
+
export declare const TEXT_ATOM = "\uFFFC";
|
|
5
|
+
export declare function textRunEditLength(run: Pick<TextRun, 'text' | 'math'>): number;
|
|
6
|
+
export declare function textBodyEditText(body: TextBody): string;
|
|
7
|
+
export declare function textPositionAtIndex(body: TextBody, index: number): TextPosition;
|
|
8
|
+
export declare function textPositionToIndex(body: TextBody, position: TextPosition): number;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import type { ElementId, SlideId, TableCellAddress } from './types';
|
|
2
|
+
import type { TextRange } from './commands/types';
|
|
3
|
+
export type TextSearchScope = {
|
|
4
|
+
readonly kind: 'document';
|
|
5
|
+
} | {
|
|
6
|
+
readonly kind: 'slide';
|
|
7
|
+
readonly slideId: SlideId;
|
|
8
|
+
} | {
|
|
9
|
+
readonly kind: 'slides';
|
|
10
|
+
readonly slideIds: readonly SlideId[];
|
|
11
|
+
};
|
|
12
|
+
export interface FindTextRequest {
|
|
13
|
+
readonly query: string;
|
|
14
|
+
readonly scope: TextSearchScope;
|
|
15
|
+
readonly matchCase?: boolean;
|
|
16
|
+
readonly wholeWord?: boolean;
|
|
17
|
+
}
|
|
18
|
+
export interface TextSearchMatch {
|
|
19
|
+
/** 同一文档状态下可直接用作列表 key;模型变化后必须重新查询。 */
|
|
20
|
+
readonly key: string;
|
|
21
|
+
readonly slideId: SlideId;
|
|
22
|
+
readonly id: ElementId;
|
|
23
|
+
readonly cell?: TableCellAddress;
|
|
24
|
+
readonly range: TextRange;
|
|
25
|
+
readonly text: string;
|
|
26
|
+
readonly before: string;
|
|
27
|
+
readonly after: string;
|
|
28
|
+
}
|
|
29
|
+
export interface TextSearchTarget {
|
|
30
|
+
readonly slideId: SlideId;
|
|
31
|
+
readonly id: ElementId;
|
|
32
|
+
readonly cell?: TableCellAddress;
|
|
33
|
+
readonly range: TextRange;
|
|
34
|
+
}
|
|
35
|
+
export type ReplaceTextScope = TextSearchScope | {
|
|
36
|
+
readonly kind: 'match';
|
|
37
|
+
readonly match: TextSearchTarget;
|
|
38
|
+
};
|
|
39
|
+
export interface ReplaceTextCommand {
|
|
40
|
+
readonly type: 'ReplaceText';
|
|
41
|
+
readonly scope: ReplaceTextScope;
|
|
42
|
+
readonly from: string;
|
|
43
|
+
readonly to: string;
|
|
44
|
+
readonly matchCase?: boolean;
|
|
45
|
+
readonly wholeWord?: boolean;
|
|
46
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { EditDoc } from './types';
|
|
2
|
+
import type { FindTextRequest, TextSearchMatch } from './text-search-types';
|
|
3
|
+
export declare function assertFindTextRequest(doc: EditDoc, value: unknown): asserts value is FindTextRequest;
|
|
4
|
+
/** 无 DOM、无索引副作用;需要增量缓存的宿主可在此公开结果之上按脏页维护。 */
|
|
5
|
+
export declare function findText(doc: EditDoc, request: FindTextRequest): readonly TextSearchMatch[];
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { Command } from './commands/types';
|
|
2
|
+
import type { EditDoc, ElementId } from './types';
|
|
3
|
+
export declare function shapeTextCommandTarget(command: Command): ElementId | null;
|
|
4
|
+
/** 删除子树与同树属性编辑无法形成无需依赖顺序的双向 patch,必须在任何模型修改前拒绝。 */
|
|
5
|
+
export declare function validateCommandRelations(doc: EditDoc, commands: readonly Command[]): void;
|