@paged-media/plugin-sdk 0.2.49-canary.0 → 0.2.50-canary.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/dist/index.d.ts CHANGED
@@ -446,6 +446,20 @@ interface PagesBackend {
446
446
  activePage(): string | null;
447
447
  onDidChangeActivePage(listener: (pageId: string | null) => void): () => void;
448
448
  }
449
+ /**
450
+ * The backend the editor injects to back `host.viewport.revealText`. The
451
+ * editor owns the camera, the page layout and the text selection, so it
452
+ * locates the range on the page, moves there and (optionally) selects it.
453
+ * No backend → `revealText` answers false and
454
+ * `supports("viewport.revealText@1")` is false.
455
+ */
456
+ interface TextRevealBackend {
457
+ revealText(range: {
458
+ storyId: string;
459
+ start: number;
460
+ end: number;
461
+ }, select: boolean): boolean | Promise<boolean>;
462
+ }
449
463
  /** The SHARED cross-plugin data-provider registry (paged.data §7.1 / D-09). The
450
464
  * editor creates ONE (`createDataProviderRegistry`) and injects the SAME
451
465
  * instance into every plugin host, so a provider plugin and a consumer plugin
@@ -704,6 +718,9 @@ interface CreateBundleHostOptions {
704
718
  * `activePage`, `onDidChangeActivePage`). When present,
705
719
  * `supports("viewport.pages@1")` is true. */
706
720
  pages?: PagesBackend;
721
+ /** Text navigation for `host.viewport.revealText`. When present,
722
+ * `supports("viewport.revealText@1")` is true. */
723
+ text?: TextRevealBackend;
707
724
  /** Host-provided WORKER backend (K-3 / S-07 / I-02). When present,
708
725
  * `host.workers.spawn` resolves a declared bundle-relative module +
709
726
  * constructs a host-owned `Worker` through it (capability-gated,
@@ -1580,4 +1597,4 @@ declare function contributeObjectType(host: BundleHost, contribution: ObjectType
1580
1597
  */
1581
1598
  declare function contributeBindingProvider(host: BundleHost, contextType: string, provider: BindingProvider): BindingProviderHandle;
1582
1599
 
1583
- export { API_VERSION, ASSET_BUDGETS, BLOB_BUDGETS, type BindingProviderBackend, type BlobStore, type BundleAssetProvider, type BundleAssetSource, type BundleHostHandle, type BundleTrust, CANVAS_WASM_PKG, CLICK_DRAG_THRESHOLD_PX, CORE_CATALOG_ROWS, CORE_COMMAND_CREATES, CORE_COMMAND_EXCLUSIONS, CORE_COMMAND_OPS, CORE_COMMAND_PREFIX, CORE_PATHS, CORE_PATH_ALIASES, CORE_WIRE_OPS, type ClipboardBackend, type ConsentBackend, type CoreCatalogRow, type CoreCreatePlan, type CoreObjects, type CorePathRow, type CorePathScope, type CorePlan, type CoreRow71, type CoreWireOpRow, type CreateBundleHostOptions, type CreateCoreObjectsOptions, type CreateObjectRegistryOptions, type DataProviderBackend, type DiagnosticsSink, DisposableStore, type DocumentsBackend, FALLBACK_WIDGETS, FRAME_KIND_WORDS, HOST_FEATURES, type HarnessOptions, type HeadlessCanvasWorker, type HeadlessHost, type HeadlessHostHandle, type HostObjectAnswer, type HostObjectCall, type JournalSink, type LoadBundleWasmOptions, type LoadHeadlessEngineOptions, type LoadedBundle, type LoadedBundleWasm, type LoadedEngine, type NativeDocumentBackend, OBJECT_MODEL_PROTOCOL, type ObjectListRow, type ObjectModelRegistration, type ObjectRegistry, type PageDrag, type PagesBackend, type PanelSchemaIssue, type ParsedSelector, PluginApiNotImplemented, PluginCapabilityError, type PropertyRowOptions, type PublishObjectListOptions, ROW_PATH, type RecordableAssetSource, type RecordedContribution, type RecordedFontFaceRequest, type RegisteredBindingProvider, type ScriptRunResult, type ScriptSend, type SecretStoreBackend, type SeededFace, type SelectorHead, type SelectorPredicate, type SelectorStep, type ShellBackend, type SpawnedWorker, type StorageBacking, type TextCaretBackend, type ToolSettingsBackend, VALUE_TYPE_KINDS, type ValidatePanelSchemaOptions, WASM_BUDGETS, WORKER_BUDGETS, type WillSaveBackend, type WorkerBackend, addressKindOf, answerHostObjects, answerHostObjectsRound, applyDefaults, applyValueEdit, assetFromBytes, beginPageDrag, checkSchemaRows, checkValueType, codeOfEngineError, coerceValue, commitAndSelect, contributeBindingProvider, contributeEditContext, contributeObjectType, contributePanel, contributeSchemaPanel, contributeTool, coreCommandInfos, coreSchema71, createBindingProviderRegistry, createBundleHost, createCoreObjects, createDataProviderRegistry, createHeadlessHost, createObjectRegistry, createRecordableAssetSource, defaultValueOf, defineBundle, editValue, endLocalFor, escapeLabelValue, findRow, formatAddress, fromElementId, inMemoryToolSettings, inMemoryWillSave, isCoreCommand, isPropertyRow, loadBundle, loadBundleWasm, loadHeadlessEngine, makeSchemaPanelComponent, normalizeAddress, normalizeCoreType, parseAddress, parseLength, parseSelector, planValueEdit, propertyRow, propertyRows, propertyRowsOf, protocolFromVersion, publishObjectList, pxToPt, readVendoredWireVersion, resolveCanvasWasm, resolveGate, rowPathOf, runScriptWithObjects, satisfiesApiVersion, selectorKind, toDisposable, toElementId, validatePanelSchema, validateValue };
1600
+ export { API_VERSION, ASSET_BUDGETS, BLOB_BUDGETS, type BindingProviderBackend, type BlobStore, type BundleAssetProvider, type BundleAssetSource, type BundleHostHandle, type BundleTrust, CANVAS_WASM_PKG, CLICK_DRAG_THRESHOLD_PX, CORE_CATALOG_ROWS, CORE_COMMAND_CREATES, CORE_COMMAND_EXCLUSIONS, CORE_COMMAND_OPS, CORE_COMMAND_PREFIX, CORE_PATHS, CORE_PATH_ALIASES, CORE_WIRE_OPS, type ClipboardBackend, type ConsentBackend, type CoreCatalogRow, type CoreCreatePlan, type CoreObjects, type CorePathRow, type CorePathScope, type CorePlan, type CoreRow71, type CoreWireOpRow, type CreateBundleHostOptions, type CreateCoreObjectsOptions, type CreateObjectRegistryOptions, type DataProviderBackend, type DiagnosticsSink, DisposableStore, type DocumentsBackend, FALLBACK_WIDGETS, FRAME_KIND_WORDS, HOST_FEATURES, type HarnessOptions, type HeadlessCanvasWorker, type HeadlessHost, type HeadlessHostHandle, type HostObjectAnswer, type HostObjectCall, type JournalSink, type LoadBundleWasmOptions, type LoadHeadlessEngineOptions, type LoadedBundle, type LoadedBundleWasm, type LoadedEngine, type NativeDocumentBackend, OBJECT_MODEL_PROTOCOL, type ObjectListRow, type ObjectModelRegistration, type ObjectRegistry, type PageDrag, type PagesBackend, type PanelSchemaIssue, type ParsedSelector, PluginApiNotImplemented, PluginCapabilityError, type PropertyRowOptions, type PublishObjectListOptions, ROW_PATH, type RecordableAssetSource, type RecordedContribution, type RecordedFontFaceRequest, type RegisteredBindingProvider, type ScriptRunResult, type ScriptSend, type SecretStoreBackend, type SeededFace, type SelectorHead, type SelectorPredicate, type SelectorStep, type ShellBackend, type SpawnedWorker, type StorageBacking, type TextCaretBackend, type TextRevealBackend, type ToolSettingsBackend, VALUE_TYPE_KINDS, type ValidatePanelSchemaOptions, WASM_BUDGETS, WORKER_BUDGETS, type WillSaveBackend, type WorkerBackend, addressKindOf, answerHostObjects, answerHostObjectsRound, applyDefaults, applyValueEdit, assetFromBytes, beginPageDrag, checkSchemaRows, checkValueType, codeOfEngineError, coerceValue, commitAndSelect, contributeBindingProvider, contributeEditContext, contributeObjectType, contributePanel, contributeSchemaPanel, contributeTool, coreCommandInfos, coreSchema71, createBindingProviderRegistry, createBundleHost, createCoreObjects, createDataProviderRegistry, createHeadlessHost, createObjectRegistry, createRecordableAssetSource, defaultValueOf, defineBundle, editValue, endLocalFor, escapeLabelValue, findRow, formatAddress, fromElementId, inMemoryToolSettings, inMemoryWillSave, isCoreCommand, isPropertyRow, loadBundle, loadBundleWasm, loadHeadlessEngine, makeSchemaPanelComponent, normalizeAddress, normalizeCoreType, parseAddress, parseLength, parseSelector, planValueEdit, propertyRow, propertyRows, propertyRowsOf, protocolFromVersion, publishObjectList, pxToPt, readVendoredWireVersion, resolveCanvasWasm, resolveGate, rowPathOf, runScriptWithObjects, satisfiesApiVersion, selectorKind, toDisposable, toElementId, validatePanelSchema, validateValue };
package/dist/index.js CHANGED
@@ -11717,6 +11717,23 @@ function createBundleHost(getEditor, manifest, options) {
11717
11717
  });
11718
11718
  }
11719
11719
  return store.add(toDisposable(pagesBackend.onDidChangeActivePage(listener)));
11720
+ },
11721
+ async revealText(range, opts) {
11722
+ const textBackend = options?.text;
11723
+ if (!textBackend || !range || typeof range.storyId !== "string" || range.storyId === "") {
11724
+ return false;
11725
+ }
11726
+ const start = Math.trunc(Number(range.start));
11727
+ const end = Math.trunc(Number(range.end));
11728
+ if (!Number.isFinite(start) || !Number.isFinite(end) || start < 0 || end < start) {
11729
+ return false;
11730
+ }
11731
+ const select = opts?.select !== false;
11732
+ try {
11733
+ return await textBackend.revealText({ storyId: range.storyId, start, end }, select) === true;
11734
+ } catch {
11735
+ return false;
11736
+ }
11720
11737
  }
11721
11738
  };
11722
11739
  const render = {
@@ -12803,6 +12820,9 @@ function createBundleHost(getEditor, manifest, options) {
12803
12820
  if (options?.pages) {
12804
12821
  featureSet.add("viewport.pages@1");
12805
12822
  }
12823
+ if (options?.text) {
12824
+ featureSet.add("viewport.revealText@1");
12825
+ }
12806
12826
  if (options?.documents) {
12807
12827
  featureSet.add("documents.exportPaged@1");
12808
12828
  featureSet.add("documents.open@1");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@paged-media/plugin-sdk",
3
- "version": "0.2.49-canary.0",
3
+ "version": "0.2.50-canary.0",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
@@ -11,7 +11,7 @@
11
11
  }
12
12
  },
13
13
  "dependencies": {
14
- "@paged-media/plugin-api": "0.2.48-canary.0"
14
+ "@paged-media/plugin-api": "0.2.49-canary.0"
15
15
  },
16
16
  "peerDependencies": {
17
17
  "react": "^18.3.0"