@superdoc-dev/cli 0.15.0-next.6 → 0.15.0-next.7

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 (2) hide show
  1. package/dist/index.js +98 -5
  2. package/package.json +7 -7
package/dist/index.js CHANGED
@@ -221759,7 +221759,7 @@ var init_remark_gfm_eZN6yzWQ_es = __esm(() => {
221759
221759
  init_remark_gfm_BhnWr3yf_es();
221760
221760
  });
221761
221761
 
221762
- // ../../packages/superdoc/dist/chunks/src-D1Zc7Jgj.es.js
221762
+ // ../../packages/superdoc/dist/chunks/src-CYzfdR4C.es.js
221763
221763
  function deleteProps(obj, propOrProps) {
221764
221764
  const props = typeof propOrProps === "string" ? [propOrProps] : propOrProps;
221765
221765
  const removeNested = (target, pathParts, index2 = 0) => {
@@ -298386,7 +298386,7 @@ var Node$13 = class Node$14 {
298386
298386
  return false;
298387
298387
  const docs = tr.docs ?? [];
298388
298388
  return tr.steps.some((step3, index2) => stepTouchesTrackedReviewState(step3, docs[index2] ?? state.doc));
298389
- }, cloneExtensionInstance = (extension3) => {
298389
+ }, CONTENT_CONTROL_POINTER_WINDOW_MS = 800, cloneExtensionInstance = (extension3) => {
298390
298390
  const extensionLike = extension3;
298391
298391
  const config2 = extensionLike?.config;
298392
298392
  const ExtensionCtor = extensionLike?.constructor;
@@ -314967,7 +314967,7 @@ menclose::after {
314967
314967
  nextSelection = TextSelection.create(doc$12, hit.pos);
314968
314968
  if (!nextSelection.$from.parent.inlineContent)
314969
314969
  nextSelection = Selection.near(doc$12.resolve(hit.pos), 1);
314970
- let tr = editor.state.tr.setSelection(nextSelection);
314970
+ let tr = editor.state.tr.setSelection(nextSelection).setMeta("uiEvent", "click");
314971
314971
  if (inlineSdtBoundaryPos != null && inlineSdtBoundaryDirection) {
314972
314972
  tr = applyEditableSlotAtInlineBoundary(tr, inlineSdtBoundaryPos, inlineSdtBoundaryDirection);
314973
314973
  nextSelection = tr.selection;
@@ -318943,7 +318943,7 @@ menclose::after {
318943
318943
  return;
318944
318944
  console.log(...args$1);
318945
318945
  }, HEADER_FOOTER_INIT_BUDGET_MS = 200, MAX_ZOOM_WARNING_THRESHOLD = 10, MAX_SELECTION_RECTS_PER_USER = 100, SEMANTIC_RESIZE_DEBOUNCE_MS = 120, MIN_SEMANTIC_CONTENT_WIDTH_PX = 1, GLOBAL_PERFORMANCE, PresentationEditor, ICONS, TEXTS, tableActionsOptions, TRACKED_MARK_NAMES;
318946
- var init_src_D1Zc7Jgj_es = __esm(() => {
318946
+ var init_src_CYzfdR4C_es = __esm(() => {
318947
318947
  init_rolldown_runtime_Bg48TavK_es();
318948
318948
  init_SuperConverter_C6hKp29w_es();
318949
318949
  init_jszip_C49i9kUs_es();
@@ -343143,6 +343143,8 @@ function print() { __p += __j.call(arguments, '') }
343143
343143
  }
343144
343144
  #telemetry = null;
343145
343145
  #documentOpenTracked = false;
343146
+ #lastActiveContentControlRef = null;
343147
+ #lastPointerDownAt = 0;
343146
343148
  #constructorFragment = null;
343147
343149
  constructor(options) {
343148
343150
  super();
@@ -343364,9 +343366,15 @@ function print() { __p += __j.call(arguments, '') }
343364
343366
  this.on("fonts-resolved", this.options.onFontsResolved);
343365
343367
  this.on("exception", this.options.onException);
343366
343368
  this.on("pointerDown", this.options.onPointerDown);
343369
+ this.#trackContentControlPointer();
343367
343370
  this.on("pointerUp", this.options.onPointerUp);
343368
343371
  this.on("rightClick", this.options.onRightClick);
343369
343372
  }
343373
+ #trackContentControlPointer() {
343374
+ this.on("pointerDown", () => {
343375
+ this.#lastPointerDownAt = Date.now();
343376
+ });
343377
+ }
343370
343378
  async#loadDocument(source, options) {
343371
343379
  try {
343372
343380
  const resolvedMode = options?.mode ?? this.options.mode ?? "docx";
@@ -343517,6 +343525,8 @@ function print() { __p += __j.call(arguments, '') }
343517
343525
  this.options.fileSource = null;
343518
343526
  this.options.fragment = null;
343519
343527
  this._state = undefined;
343528
+ this.#lastActiveContentControlRef = null;
343529
+ this.#lastPointerDownAt = 0;
343520
343530
  }
343521
343531
  #initProtectionState() {
343522
343532
  const protStorage = getProtectionStorage(this);
@@ -343576,6 +343586,7 @@ function print() { __p += __j.call(arguments, '') }
343576
343586
  this.on("fonts-resolved", this.options.onFontsResolved);
343577
343587
  this.on("exception", this.options.onException);
343578
343588
  this.on("pointerDown", this.options.onPointerDown);
343589
+ this.#trackContentControlPointer();
343579
343590
  this.on("pointerUp", this.options.onPointerUp);
343580
343591
  this.on("rightClick", this.options.onRightClick);
343581
343592
  if (!shouldMountRenderer)
@@ -343624,6 +343635,7 @@ function print() { __p += __j.call(arguments, '') }
343624
343635
  this.on("locked", this.options.onDocumentLocked);
343625
343636
  this.on("list-definitions-change", this.options.onListDefinitionsChange);
343626
343637
  this.on("pointerDown", this.options.onPointerDown);
343638
+ this.#trackContentControlPointer();
343627
343639
  this.on("pointerUp", this.options.onPointerUp);
343628
343640
  this.on("rightClick", this.options.onRightClick);
343629
343641
  if (!shouldMountRenderer)
@@ -344443,6 +344455,11 @@ function print() { __p += __j.call(arguments, '') }
344443
344455
  editor: this,
344444
344456
  transaction: transactionToApply
344445
344457
  });
344458
+ this.#emitContentControlEvents({
344459
+ transaction: transactionToApply,
344460
+ nextState,
344461
+ selectionHasChanged
344462
+ });
344446
344463
  const focus = transactionToApply.getMeta("focus");
344447
344464
  if (focus)
344448
344465
  this.emit("focus", {
@@ -344471,6 +344488,82 @@ function print() { __p += __j.call(arguments, '') }
344471
344488
  });
344472
344489
  }
344473
344490
  }
344491
+ #emitContentControlEvents({ transaction, nextState, selectionHasChanged }) {
344492
+ const uiEvent = transaction.getMeta("uiEvent");
344493
+ const recentPointerDown = Date.now() - this.#lastPointerDownAt <= CONTENT_CONTROL_POINTER_WINDOW_MS;
344494
+ const source = uiEvent === "click" || recentPointerDown ? "pointer" : "keyboard";
344495
+ const activePath = nextState.selection ? this.#collectActiveSdtRefs(nextState.selection) : [];
344496
+ const activeContentControl = activePath[0] ?? null;
344497
+ if (selectionHasChanged) {
344498
+ const previous3 = this.#lastActiveContentControlRef;
344499
+ if (previous3?.id !== activeContentControl?.id) {
344500
+ if (activeContentControl)
344501
+ this.emit("contentControlFocus", {
344502
+ active: activeContentControl,
344503
+ previous: previous3,
344504
+ activePath,
344505
+ source
344506
+ });
344507
+ else if (previous3)
344508
+ this.emit("contentControlBlur", {
344509
+ active: null,
344510
+ previous: previous3,
344511
+ activePath: [],
344512
+ source
344513
+ });
344514
+ this.#lastActiveContentControlRef = activeContentControl;
344515
+ }
344516
+ }
344517
+ if (uiEvent === "click" && activeContentControl)
344518
+ this.emit("contentControlClick", {
344519
+ target: activeContentControl,
344520
+ source: "pointer"
344521
+ });
344522
+ }
344523
+ #collectActiveSdtRefs(selection) {
344524
+ const refs = [];
344525
+ const seenIds = /* @__PURE__ */ new Set;
344526
+ const selectedNode = selection instanceof NodeSelection ? selection.node : null;
344527
+ if (selectedNode && (selectedNode.type?.name === "structuredContent" || selectedNode.type?.name === "structuredContentBlock")) {
344528
+ const ref$1 = this.#toSdtRef(selectedNode);
344529
+ if (ref$1) {
344530
+ refs.push(ref$1);
344531
+ seenIds.add(ref$1.id);
344532
+ }
344533
+ }
344534
+ const anchor = selection.$anchor;
344535
+ if (anchor && typeof anchor.depth === "number" && typeof anchor.node === "function")
344536
+ for (let depth = anchor.depth;depth >= 0; depth -= 1) {
344537
+ const node3 = anchor.node(depth);
344538
+ if (!node3)
344539
+ continue;
344540
+ const typeName = node3?.type?.name;
344541
+ if (typeName !== "structuredContent" && typeName !== "structuredContentBlock")
344542
+ continue;
344543
+ const ref$1 = this.#toSdtRef(node3);
344544
+ if (!ref$1)
344545
+ continue;
344546
+ if (seenIds.has(ref$1.id))
344547
+ continue;
344548
+ refs.push(ref$1);
344549
+ seenIds.add(ref$1.id);
344550
+ }
344551
+ return refs;
344552
+ }
344553
+ #toSdtRef(node3) {
344554
+ const attrs = node3.attrs;
344555
+ const id2 = attrs?.id;
344556
+ if (typeof id2 !== "string" || id2.length === 0)
344557
+ return null;
344558
+ const scope = node3.type.name === "structuredContent" ? "inline" : "block";
344559
+ return {
344560
+ id: id2,
344561
+ tag: typeof attrs.tag === "string" ? attrs.tag : undefined,
344562
+ alias: typeof attrs.alias === "string" ? attrs.alias : undefined,
344563
+ controlType: typeof attrs.controlType === "string" ? attrs.controlType : "unknown",
344564
+ scope
344565
+ };
344566
+ }
344474
344567
  dispatch(tr) {
344475
344568
  this.#dispatchTransaction(tr);
344476
344569
  }
@@ -353198,7 +353291,7 @@ var init_zipper_yaJVJ4z9_es = __esm(() => {
353198
353291
 
353199
353292
  // ../../packages/superdoc/dist/super-editor.es.js
353200
353293
  var init_super_editor_es = __esm(() => {
353201
- init_src_D1Zc7Jgj_es();
353294
+ init_src_CYzfdR4C_es();
353202
353295
  init_SuperConverter_C6hKp29w_es();
353203
353296
  init_jszip_C49i9kUs_es();
353204
353297
  init_xml_js_CqGKpaft_es();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@superdoc-dev/cli",
3
- "version": "0.15.0-next.6",
3
+ "version": "0.15.0-next.7",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "superdoc": "./dist/index.js"
@@ -25,8 +25,8 @@
25
25
  "@types/ws": "^8.5.13",
26
26
  "typescript": "^5.9.2",
27
27
  "@superdoc/document-api": "0.0.1",
28
- "@superdoc/super-editor": "0.0.1",
29
28
  "@superdoc/pm-adapter": "0.0.0",
29
+ "@superdoc/super-editor": "0.0.1",
30
30
  "superdoc": "1.37.0"
31
31
  },
32
32
  "module": "src/index.ts",
@@ -34,11 +34,11 @@
34
34
  "access": "public"
35
35
  },
36
36
  "optionalDependencies": {
37
- "@superdoc-dev/cli-darwin-arm64": "0.15.0-next.6",
38
- "@superdoc-dev/cli-darwin-x64": "0.15.0-next.6",
39
- "@superdoc-dev/cli-linux-x64": "0.15.0-next.6",
40
- "@superdoc-dev/cli-linux-arm64": "0.15.0-next.6",
41
- "@superdoc-dev/cli-windows-x64": "0.15.0-next.6"
37
+ "@superdoc-dev/cli-darwin-arm64": "0.15.0-next.7",
38
+ "@superdoc-dev/cli-linux-x64": "0.15.0-next.7",
39
+ "@superdoc-dev/cli-linux-arm64": "0.15.0-next.7",
40
+ "@superdoc-dev/cli-darwin-x64": "0.15.0-next.7",
41
+ "@superdoc-dev/cli-windows-x64": "0.15.0-next.7"
42
42
  },
43
43
  "scripts": {
44
44
  "predev": "node scripts/ensure-superdoc-build.js",