@web-ppt/edit-core 0.5.0-beta.1 → 0.5.0-beta.2

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.
Files changed (72) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/README.md +1 -1
  3. package/dist/collaboration-identity.d.ts +3 -0
  4. package/dist/commands/add-slide-identity.d.ts +2 -0
  5. package/dist/commands/convert-to-custom-geometry.d.ts +4 -0
  6. package/dist/commands/element-geometry.d.ts +6 -0
  7. package/dist/commands/element-hierarchy.d.ts +6 -0
  8. package/dist/commands/element-table-style.d.ts +5 -0
  9. package/dist/commands/frame-decomposition.d.ts +10 -0
  10. package/dist/commands/generated-creation-defaults.d.ts +4 -0
  11. package/dist/commands/geometry-types.d.ts +22 -0
  12. package/dist/commands/group-types.d.ts +24 -0
  13. package/dist/commands/group.d.ts +4 -0
  14. package/dist/commands/insertion-host.d.ts +3 -0
  15. package/dist/commands/insertion-rect.d.ts +2 -0
  16. package/dist/commands/patch-invalidation.d.ts +4 -0
  17. package/dist/commands/patch.d.ts +4 -0
  18. package/dist/commands/record-clone.d.ts +3 -0
  19. package/dist/commands/set-geometry.d.ts +4 -0
  20. package/dist/commands/set-table-style.d.ts +3 -0
  21. package/dist/commands/spid.d.ts +1 -0
  22. package/dist/commands/table-style-types.d.ts +28 -0
  23. package/dist/commands/text-target.d.ts +1 -0
  24. package/dist/commands/types.d.ts +29 -4
  25. package/dist/commands/ungroup.d.ts +4 -0
  26. package/dist/custom-geometry-path.d.ts +3 -0
  27. package/dist/custom-geometry.d.ts +12 -0
  28. package/dist/document-B1jjN-QB.js +274 -0
  29. package/dist/edit-core.js +3597 -2639
  30. package/dist/editor.d.ts +6 -1
  31. package/dist/generate/custom-geometry.d.ts +2 -0
  32. package/dist/generate/index.d.ts +12 -0
  33. package/dist/generate/links.d.ts +3 -0
  34. package/dist/generate/materialize.d.ts +2 -0
  35. package/dist/generate/media.d.ts +13 -0
  36. package/dist/generate/table.d.ts +4 -0
  37. package/dist/generate/template.d.ts +3 -0
  38. package/dist/generate.js +744 -0
  39. package/dist/hyperlink.d.ts +2 -0
  40. package/dist/identity-allocation.d.ts +12 -0
  41. package/dist/identity-watermark.d.ts +4 -0
  42. package/dist/image-resource-DbgJS9n-.js +24 -0
  43. package/dist/{index-D4ZTaYOa.js → index-D2JizcOQ.js} +7 -7
  44. package/dist/index.d.ts +11 -3
  45. package/dist/insertion-CGpb504L.js +6152 -0
  46. package/dist/layout-projection.d.ts +2 -0
  47. package/dist/opc/patch.d.ts +2 -0
  48. package/dist/opc.js +1 -1
  49. package/dist/paragraph-level.d.ts +11 -0
  50. package/dist/paragraph-property-schema.d.ts +1 -1
  51. package/dist/{patch-DO8497wO.js → patch-D7lZelRa.js} +111 -94
  52. package/dist/patch-change.d.ts +4 -0
  53. package/dist/patch-events.d.ts +12 -0
  54. package/dist/recovery-identity.d.ts +2 -1
  55. package/dist/run-property-schema.d.ts +1 -1
  56. package/dist/save/geometry.d.ts +5 -0
  57. package/dist/save/insertion.d.ts +3 -0
  58. package/dist/save/notes.d.ts +2 -0
  59. package/dist/save/run-overrides.d.ts +10 -0
  60. package/dist/save/shape-format.d.ts +3 -0
  61. package/dist/save/table-style-part.d.ts +11 -0
  62. package/dist/save/table.d.ts +3 -0
  63. package/dist/save/text-source-less.d.ts +6 -0
  64. package/dist/save.js +468 -1441
  65. package/dist/table-direct-markup.d.ts +7 -1
  66. package/dist/table-style-part-DBtpxmuo.js +1042 -0
  67. package/dist/table-style.d.ts +20 -0
  68. package/dist/text-model.d.ts +1 -1
  69. package/dist/types.d.ts +44 -1
  70. package/dist/xml.js +1 -1
  71. package/package.json +6 -2
  72. package/dist/insertion-DabLme_U.js +0 -5471
@@ -0,0 +1,20 @@
1
+ import type { TableElement, TableStyleDefinition, TableStyleSettings } from '@web-ppt/core';
2
+ import type { EditDoc, ElementId, SlideId } from './types';
3
+ export interface TableStyleCatalogItem {
4
+ readonly styleId: string;
5
+ readonly name: string;
6
+ readonly source: 'document' | 'builtin';
7
+ readonly preview: TableElement;
8
+ }
9
+ export interface TableStyleState {
10
+ readonly value: TableStyleSettings | null;
11
+ readonly source: TableStyleSettings | null;
12
+ readonly direct: boolean;
13
+ }
14
+ export declare function tableStyleDefinitionForElement(doc: EditDoc, id: ElementId, styleId: string): TableStyleDefinition | undefined;
15
+ /** 目录以页面主题为上下文;返回值不泄露 OOXML,也不要求 UI 复刻样式优先级。 */
16
+ export declare function listTableStyles(doc: EditDoc, slideId: SlideId): readonly TableStyleCatalogItem[];
17
+ export declare function assertTableStyleSettings(doc: EditDoc, id: ElementId, input: unknown, label: string): TableStyleSettings;
18
+ export declare function queryTableStyle(doc: EditDoc, id: ElementId): TableStyleState;
19
+ /** 来源直设基线最后叠加,因此样式切换不会清洗单元格直接格式。 */
20
+ export declare function projectTableStyle(doc: EditDoc, slideId: SlideId, table: TableElement, settings: TableStyleSettings): TableElement;
@@ -15,7 +15,7 @@ export declare function applyRunProps(body: TextBody, range: TextRange, props: R
15
15
  }>): TextOverride;
16
16
  export declare function applyParagraphProps(body: TextBody, range: TextRange, props: ParagraphPropertyOverrides, initial?: Extract<TextOverride, {
17
17
  kind: 'flat';
18
- }>): TextOverride;
18
+ }>, levelTemplate?: TextBody, sourceBody?: TextBody): TextOverride;
19
19
  export declare function queryTextParagraphProps(body: TextBody, range: TextRange, initial?: Extract<TextOverride, {
20
20
  kind: 'flat';
21
21
  }>): ParagraphPropertiesState;
package/dist/types.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import type { Effects, ElementBase, Fill, GeomSpec, ImageElement, OpcPackage, Paragraph, PlaceholderDirectFlags, Presentation, ShapeCreationDefaults, ShapeElement, Slide, Stroke, Transition, TableCreationDefaults, SlideElement, SlideLayoutTemplate, TextBody, TextRun } from '@web-ppt/core';
1
+ import type { CustomGeometry, Effects, ElementBase, Fill, GeomSpec, ImageElement, OpcPackage, Paragraph, PlaceholderDirectFlags, Presentation, ShapeCreationDefaults, ShapeElement, Slide, Stroke, Transition, TableCreationDefaults, SlideElement, SlideLayoutTemplate, TableStyleDefinition, TableStyleSettings, TextBody, TextRun } from '@web-ppt/core';
2
2
  import type { EmphasisAnimationEffect, EntranceExitAnimationEffect } from './animation-catalog';
3
3
  export type ElementId = string;
4
4
  export type SlideId = string;
@@ -18,6 +18,8 @@ export interface ElementInsertionSource {
18
18
  readonly spids: Readonly<Record<string, number>>;
19
19
  readonly relationships?: readonly ElementInsertionRelationship[];
20
20
  readonly resources?: readonly ElementInsertionResource[];
21
+ /** false 表示宿主只是空容器,后代要按当前模型层级分别插入或从来源树移动。 */
22
+ readonly containsDescendants?: false;
21
23
  }
22
24
  export interface ElementInsertionRelationship {
23
25
  readonly sourceId: string;
@@ -91,6 +93,8 @@ export interface ElementLinkState {
91
93
  * `id` / `editInfo` 则属于源文件身份,二者都不能进入覆盖层。
92
94
  */
93
95
  export type ElementOverrides = Partial<Pick<ElementBase, BaseOverrideKey>> & {
96
+ /** 自定义几何是 path 的语义来源;path 本身仍保持派生字段,不能写入覆盖层。 */
97
+ geometry?: CustomGeometry;
94
98
  /** 缺少字段表示来源;none 表示明确移除,不能用 undefined 混淆二者。 */
95
99
  link?: LinkOverride;
96
100
  /** 显式无填充用 Fill.none;缺少该字段才表示恢复来源/主题。 */
@@ -108,6 +112,8 @@ export type ElementOverrides = Partial<Pick<ElementBase, BaseOverrideKey>> & {
108
112
  tableCells?: Record<TableCellKey, TableCellOverrides>;
109
113
  /** 表格行使用稳定身份稀疏追加;不复制整张 rows,未来可沿同一身份扩展中间插入。 */
110
114
  tableRows?: Record<TableRowId, TableRowInsertion>;
115
+ /** 缺少字段表示来源;SetTableStyle(null) 删除整份覆盖。 */
116
+ tableStyle?: TableStyleSettings;
111
117
  };
112
118
  export interface ElementFillState {
113
119
  readonly value: Fill | null;
@@ -234,14 +240,19 @@ export interface TextMark {
234
240
  readonly runOverrides?: RunPropertyOverrides;
235
241
  /** 删除直接格式后用于恢复继承所得的有效值;只含字符格式 P0 字段。 */
236
242
  readonly inheritedProps?: RunProperties;
243
+ /** 完整继承字符元数据;改级后不能继续沿用旧层级的非面板字段。 */
244
+ readonly inheritedRunProps?: import('@web-ppt/core').TextRunEditInfo['inheritedRunProps'];
237
245
  /** 继承字体可能分别含 latin/ea/cs,不能为面板的单字体值而丢掉回退栈。 */
238
246
  readonly inheritedFonts?: readonly string[];
247
+ /** 去重字体栈不足以还原脚本槽;清除 font 直设与换级重基必须保留槽位身份。 */
248
+ readonly inheritedFontSlots?: import('@web-ppt/core').TextFontSlots;
239
249
  /** 只说明来源链接不可安全编辑,不携带原始 action 或危险 URL。 */
240
250
  readonly sourceLinkReadonly?: true;
241
251
  }
242
252
  export interface RunProperties {
243
253
  readonly font: string | null;
244
254
  readonly size: number;
255
+ readonly color: string;
245
256
  readonly b: boolean;
246
257
  readonly i: boolean;
247
258
  readonly u: boolean;
@@ -250,6 +261,7 @@ export interface RunProperties {
250
261
  export interface RunPropertyOverrides {
251
262
  readonly font?: string | null;
252
263
  readonly size?: number | null;
264
+ readonly color?: string | null;
253
265
  readonly b?: boolean | null;
254
266
  readonly i?: boolean | null;
255
267
  readonly u?: boolean | null;
@@ -277,6 +289,7 @@ export interface RunPropertyState<T> {
277
289
  export interface RunPropertiesState {
278
290
  readonly font: RunPropertyState<string>;
279
291
  readonly size: RunPropertyState<number>;
292
+ readonly color: RunPropertyState<string>;
280
293
  readonly b: RunPropertyState<boolean>;
281
294
  readonly i: RunPropertyState<boolean>;
282
295
  readonly u: RunPropertyState<boolean>;
@@ -284,6 +297,7 @@ export interface RunPropertiesState {
284
297
  }
285
298
  export type RunLinkState = ElementLinkState;
286
299
  export interface ParagraphPropertyOverrides {
300
+ readonly level?: number | null;
287
301
  readonly align?: Paragraph['align'] | null;
288
302
  readonly lineHeight?: number | null;
289
303
  readonly spaceBefore?: number | null;
@@ -292,6 +306,7 @@ export interface ParagraphPropertyOverrides {
292
306
  readonly indent?: number | null;
293
307
  }
294
308
  export interface ParagraphProperties {
309
+ readonly level: number;
295
310
  readonly align: Paragraph['align'];
296
311
  readonly lineHeight: number | null;
297
312
  readonly spaceBefore: number;
@@ -300,6 +315,7 @@ export interface ParagraphProperties {
300
315
  readonly indent: number;
301
316
  }
302
317
  export interface ParagraphPropertiesState {
318
+ readonly level: RunPropertyState<number>;
303
319
  readonly align: RunPropertyState<Paragraph['align']>;
304
320
  readonly lineHeight: RunPropertyState<number>;
305
321
  readonly spaceBefore: RunPropertyState<number>;
@@ -355,6 +371,7 @@ export type TextOverride = {
355
371
  };
356
372
  export interface ElementMeta {
357
373
  geom?: GeomSpec;
374
+ customGeometry?: CustomGeometry;
358
375
  ph?: {
359
376
  type: string;
360
377
  idx?: string;
@@ -387,6 +404,8 @@ export interface ElementMeta {
387
404
  inherited?: true;
388
405
  /** 来源存在无法安全映射的链接;覆盖层缺失时查询为只读来源。 */
389
406
  sourceLinkReadonly?: true;
407
+ /** 来源 XML 中的直属父级;结构编辑后保存层据此移动原宿主而不是克隆内容。 */
408
+ sourceParent?: SlideId | ElementId;
390
409
  }
391
410
  export interface ElementRecord {
392
411
  id: ElementId;
@@ -444,6 +463,8 @@ export interface SlideRecord {
444
463
  defaultShape?: ShapeCreationDefaults;
445
464
  /** 解析期已在当前页主题/默认表样式上求值,新增表格无需理解 OOXML 样式层。 */
446
465
  defaultTable?: TableCreationDefaults;
466
+ /** 当前页主题求值后的公开表样式目录。 */
467
+ tableStyles?: TableStyleDefinition[];
447
468
  }
448
469
  export interface SlideNotesBinding {
449
470
  readonly sourcePart?: string;
@@ -473,6 +494,27 @@ export interface EditDocMeta {
473
494
  source: Presentation['source'];
474
495
  /** true 表示缺少可靠写回上下文,只能安全查看 */
475
496
  readonly: boolean;
497
+ /** 来源演示文稿的表样式 part;省略表示保存时按需创建标准 part。 */
498
+ tableStylesPart?: string;
499
+ }
500
+ export interface EditIdentityRange {
501
+ /** 划分区间前的全局首值;恢复时据此重算当前 slot 的精确边界。 */
502
+ base: number;
503
+ maximum: number;
504
+ next: number;
505
+ end: number;
506
+ step: number;
507
+ }
508
+ /** 协同分配状态随恢复日志持久化;ranges 是各类 OOXML 数值身份的互斥游标。 */
509
+ export interface EditIdentityAllocation {
510
+ replicaId: string;
511
+ prefix: string;
512
+ slot: number;
513
+ count: number;
514
+ /** 与补丁事务一起进入恢复帧,进程重开后不能复用旧消息序号或 Lamport 时间。 */
515
+ clock: number;
516
+ sequence: number;
517
+ ranges: Record<string, EditIdentityRange>;
476
518
  }
477
519
  /** 会话内身份分配状态必须随文档持久化,否则恢复后会复用旧 id。 */
478
520
  export interface EditIdentity {
@@ -486,6 +528,7 @@ export interface EditIdentity {
486
528
  nextNotesPart?: number;
487
529
  nextPresentationSlideId?: number;
488
530
  nextPresentationRelationship?: number;
531
+ allocation?: EditIdentityAllocation;
489
532
  }
490
533
  /** 只保存首次触碰的 XML part;必须随文档 structuredClone 才能在 Worker 中正确撤销后保存。 */
491
534
  export interface EditSaveState {
package/dist/xml.js CHANGED
@@ -1,4 +1,4 @@
1
- import { w as s, c as l, g as a, f as m, d as t, h as i, u as X, k as d, p as n, r as h, b as C, e as f, y as o, s as b, a as c, x as u } from "./index-D4ZTaYOa.js";
1
+ import { w as s, c as l, g as a, f as m, d as t, h as i, u as X, k as d, p as n, r as h, b as C, e as f, y as o, a as b, s as c, x as u } from "./index-D2JizcOQ.js";
2
2
  export {
3
3
  s as OOXML_CHILD_ORDER,
4
4
  l as createXmlElement,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@web-ppt/edit-core",
3
- "version": "0.5.0-beta.1",
3
+ "version": "0.5.0-beta.2",
4
4
  "description": "Headless, framework-agnostic editing document model and render projection for Web-PPT.",
5
5
  "keywords": [
6
6
  "pptx",
@@ -42,6 +42,10 @@
42
42
  "types": "./dist/save/index.d.ts",
43
43
  "import": "./dist/save.js"
44
44
  },
45
+ "./generate": {
46
+ "types": "./dist/generate/index.d.ts",
47
+ "import": "./dist/generate.js"
48
+ },
45
49
  "./package.json": "./package.json"
46
50
  },
47
51
  "files": [
@@ -56,7 +60,7 @@
56
60
  "prepack": "node ../../tooling/sync-package-docs.mjs"
57
61
  },
58
62
  "peerDependencies": {
59
- "@web-ppt/core": "^0.5.0-beta.1"
63
+ "@web-ppt/core": "^0.5.0-beta.2"
60
64
  },
61
65
  "dependencies": {
62
66
  "fflate": "^0.8.2"