@input/pen-core 0.2.4 → 0.2.5

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.cjs CHANGED
@@ -114,6 +114,7 @@ __export(index_exports, {
114
114
  filterPendingBlocksForDocumentProfile: () => filterPendingBlocksForDocumentProfile,
115
115
  foldAndNormalize: () => foldAndNormalize,
116
116
  getApplyOptionsGroupId: () => getApplyOptionsGroupId,
117
+ getBlockContentRole: () => getBlockContentRole,
117
118
  getBlockSelectionRoleFromSchema: () => getBlockSelectionRoleFromSchema,
118
119
  getBlockSelectionRoleFromType: () => getBlockSelectionRoleFromType,
119
120
  getCellCaretFocus: () => getCellCaretFocus,
@@ -271,6 +272,15 @@ function getBlockSelectionRoleFromSchema(schema) {
271
272
  }
272
273
  return "delegated";
273
274
  }
275
+ function getBlockContentRole(schema) {
276
+ if (!schema) {
277
+ return null;
278
+ }
279
+ if (schema.authoring?.contentRole) {
280
+ return schema.authoring.contentRole;
281
+ }
282
+ return "content";
283
+ }
274
284
  function isLegacyBlockType(value) {
275
285
  return value === "codeBlock" || value === "divider" || value === "image" || value === "subdocument" || value === "table";
276
286
  }
@@ -15248,6 +15258,7 @@ function mapOffsetThroughSplices(splices, offset, assoc) {
15248
15258
  filterPendingBlocksForDocumentProfile,
15249
15259
  foldAndNormalize,
15250
15260
  getApplyOptionsGroupId,
15261
+ getBlockContentRole,
15251
15262
  getBlockSelectionRoleFromSchema,
15252
15263
  getBlockSelectionRoleFromType,
15253
15264
  getCellCaretFocus,
package/dist/index.d.cts CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as _input_pen_types from '@input/pen-types';
2
- import { ImportOptions, DocumentOp, DocumentProfile, FlowBlockCapability, InsertBlockOp, SetPropsOp, ImportResult, SchemaRegistry, BlockAuthoring, BlockSelectionRole, Editor, BlockSchema, InlineSchema, AppSchema, ComposableSchema, LayoutSchema, BlockDisplay, PropSchema, ContentType, BlockA11ySpec, Extension, DocumentState, DecorationSet, CreateEditorOptions, SchemaEngine, PenDocument, CRDTDocument, DiagnosticEvent, AppHandle, BlockHandle, CRDTAdapter, DocumentSession, Unsubscribe, Decoration, InlineCompletionController, DocumentRange, TextSelection, EditorAnchors, Anchor, AnchorTarget, Assoc, AnchorRange, ResolvedAnchorRange, SelectionRecord, SelectionState, SelectionOrigin, ChangeSummary, Point, Affinity, ReadonlySelectionState, CommitEvent, KeyBinding, CellSelection, ModelOperationRangeTarget, Block, FacetSpec, Facet, FacetProvider, FacetOutput, ApplyOptions, Importer, AssetProvider, CommandHandlerRegistration, InputRule, AIRequestFilter, AIRequestContext, ModelAdapter, ModelRequestedOperation, ModelToolChoice, ModelStreamEvent, Command, StructuralOriginTag, SpliceTextOp, CommandHandler, Precedence, OpOrigin, MessageCatalog, A11yLabel, MessageKey, MessageArgs, MutationGroupMetadata, ToolExecutionResult, FieldEditorBehavior, FieldEditorInputMode, A11yMessageKey, TextSplice } from '@input/pen-types';
2
+ import { ImportOptions, DocumentOp, DocumentProfile, FlowBlockCapability, InsertBlockOp, SetPropsOp, ImportResult, SchemaRegistry, BlockAuthoring, BlockContentRole, BlockSelectionRole, Editor, BlockSchema, InlineSchema, AppSchema, ComposableSchema, LayoutSchema, BlockDisplay, PropSchema, ContentType, BlockA11ySpec, Extension, DocumentState, DecorationSet, CreateEditorOptions, SchemaEngine, PenDocument, CRDTDocument, DiagnosticEvent, AppHandle, BlockHandle, CRDTAdapter, DocumentSession, Unsubscribe, Decoration, InlineCompletionController, DocumentRange, TextSelection, EditorAnchors, Anchor, AnchorTarget, Assoc, AnchorRange, ResolvedAnchorRange, SelectionRecord, SelectionState, SelectionOrigin, ChangeSummary, Point, Affinity, ReadonlySelectionState, CommitEvent, KeyBinding, CellSelection, ModelOperationRangeTarget, Block, FacetSpec, Facet, FacetProvider, FacetOutput, ApplyOptions, Importer, AssetProvider, CommandHandlerRegistration, InputRule, AIRequestFilter, AIRequestContext, ModelAdapter, ModelRequestedOperation, ModelToolChoice, ModelStreamEvent, Command, StructuralOriginTag, SpliceTextOp, CommandHandler, Precedence, OpOrigin, MessageCatalog, A11yLabel, MessageKey, MessageArgs, MutationGroupMetadata, ToolExecutionResult, FieldEditorBehavior, FieldEditorInputMode, A11yMessageKey, TextSplice } from '@input/pen-types';
3
3
  export { ImportOptions as ImporterOptions } from '@input/pen-types';
4
4
 
5
5
  type PendingInlineSegment = {
@@ -36,6 +36,18 @@ type BlockSchemaCapabilityLike = {
36
36
  } | null | undefined;
37
37
  declare function getFlowCapabilityFromSchema(schema: BlockSchemaCapabilityLike): FlowBlockCapability | null;
38
38
  declare function getBlockSelectionRoleFromSchema(schema: BlockSchemaCapabilityLike): BlockSelectionRole | null;
39
+ /**
40
+ * Reads `authoring.contentRole` from a resolved block schema.
41
+ *
42
+ * Unset schemas default to `"content"` so only an explicit `"chrome"`
43
+ * declaration is furniture. Missing schemas return `null`.
44
+ *
45
+ * @param schema - Resolved block schema, or `null`/`undefined` when the type
46
+ * is unregistered.
47
+ * @returns The content role, or `null` when `schema` is missing.
48
+ * @throws Never.
49
+ */
50
+ declare function getBlockContentRole(schema: BlockSchemaCapabilityLike): BlockContentRole | null;
39
51
  declare function getFlowCapabilityFromType(blockType: string | null | undefined): FlowBlockCapability | null;
40
52
  declare function shouldForceBlockScopedSelectAll(documentProfile: DocumentProfile, capability: FlowBlockCapability | null): boolean;
41
53
  declare function isContinuousTextFlowCapability(capability: FlowBlockCapability | null): boolean;
@@ -1123,4 +1135,4 @@ declare function affectedBlockIdsFromSummary(summary: Pick<ChangeSummary, "block
1123
1135
  */
1124
1136
  declare function mapOffsetThroughSplices(splices: readonly TextSplice[], offset: number, assoc: Assoc): number;
1125
1137
 
1126
- export { A11Y_MISSING_LABEL_CODE, APPLY_STORM_CODE, APPLY_STORM_QUEUE_LIMIT, type BeforeApplyHook, type BlockDirection, type BlockDirectionResolver, type BlockDirectionSetting, type CaretMotionParam, type CellCaretFocus, type CellCaretWrite, type ClipboardHandler, type CommandDispatchContext, type CommandHandlerTable, type CommandRegistry, type ContentMove, type ConvertBlockParam, type CreateCommandRegistryOptions, type CreateFacetRegistryOptions, type CreateHeadlessEditorOptions, type DecorationSource, type DefaultKeymapBinding, type DefaultKeymapContext, type DefinedBlockSchema, type DeleteGranularity, type DeleteParam, type DocumentMigration, DocumentRangeImpl, type EditorA11yLabelAttrs, EventEmitter, ExtensionManagerImpl, type FacetRegistry, type FacetSettleInput, HOOK_PRIORITIES, type InsertTextParam, type Keymap, type KeymapPlatform, type MigrationReport, type NormalPositionSnapshot, PIPELINE_PHASES, PSEUDO_LOCALE_CLOSE, PSEUDO_LOCALE_OPEN, type PendingBlock, type PendingBlockImportPolicyViolation, type PendingBlockProfilePolicyViolation, type ProfilePolicyViolation, type SchemaA11yAttrs, type SchemaA11yKind, SchemaEngineImpl, type SchemaRegistryConfig, SchemaRegistryImpl, type SelectBlockParam, SelectionAuthorityImpl as SelectionAuthority, type StructureBlockParam, type SuggestionMenuBoundary, type SuggestionMenuTarget, type SuggestionMenuTrigger, type ToggleMarkParam, type UrlContext, type UrlPolicy, type VerticalCaretDirection, type VerticalCaretMeasure, type VerticalCaretMeasureResult, type VerticalCaretPoint, type WordRange, a11yLabelFacet, affectedBlockIdsFromSummary, aiAutocompleteControllerFacet, aiControllerFacet, aiEgressExtension, aiEgressFacet, aiInlineCompletionFacet, aiInlineHistoryFacet, aiReviewControllerFacet, aiSuggestionsControllerFacet, announceEditorA11y, announcerFacet, applyDirectedBinding, applyMergeBlocks, applySplitBlock, ariaReadOnlyFacet, assetProviderFacet, beforeApplyFacet, blockDirectionFacet, blockLogicalText, blocksToOps, buildMergeBlocksRecipe, buildNormalPositionSnapshot, buildSplitBlockRecipe, buildTableChildren, builtinCommandHandlers, caretBlockEnd, caretBlockStart, caretDocEnd, caretDocStart, caretDown, caretLeft, caretLineEnd, caretLineStart, caretRight, caretUp, caretWordLeft, caretWordRight, clipboardFacet, collectEditorKeyBindings, collectToolExecutionOutput, commandHandler, commandsFacet, convertBlock, convertBlockOps, createAppHandle, createBlockHandle, createCommandRegistry, createDecorationSet, createDocumentSession, createEditor, createEmptySchema, createFacetRegistry, createHeadlessEditor, createImportResult, createMutationGroupMetadata, createPseudoLocaleCatalog, createTextSelection, decorationsFacet, deepEqual, defaultDirectionFacet, defaultKeymapBindings, defineBlock, defineCommand, defineExtension, defineFacet, delegatesToGridEditing, deleteAdjacentInlineAtom, deleteBackward, deleteBlock, deleteForward, deriveContentMoves, duplicateBlock, emptyDecorationSet, ensureInlineCompletionController, fieldEditorHostFacet, filterAIRequest, filterOpsForDocumentProfile, filterPendingBlocksForDocumentProfile, foldAndNormalize, getApplyOptionsGroupId, getBlockSelectionRoleFromSchema, getBlockSelectionRoleFromType, getCellCaretFocus, getCommandRegistry, getEditorSelectionRecord, getFlowCapabilityFromSchema, getFlowCapabilityFromType, getInlineCompletionController, getNumberedListItemValue, getOpOriginGroupId, getOpOriginType, getSelectionBlockRange, getVerticalCaretGoalX, getVerticalCaretMeasure, hasFieldEditorSurface, hasIndexedCellSelectionMetadata, historyRedo, historyUndo, hookPriorityToPrecedence, indent, inlineLogicalText, inputRulesEngineFacet, inputRulesFacet, insertLineBreak, insertText, interpolateMessage, isBlockSelected, isCollapsed, isContainerBlock, isContainerBlockType, isContinuousTextFlowCapability, isMultiBlock, isPseudoLocaleText, keyBindingPriorityToPrecedence, keymapFacet, localeFacet, mapOffsetThroughSplices, mergeDecorationSets, mergeSchemas, messagesFacet, moveBlockDown, moveBlockUp, multiplayerControllerFacet, nextGraphemeBoundary, nextWordBoundary, normalizePendingBlocksForImport, orderSlashMenuItemsByGroup, outdent, previousGraphemeBoundary, previousWordBoundary, priorityToPrecedence, prop, renderSelectionTargetBlockText, renderSelectionTargetText, repairAnchor, reportPendingBlockImportViolations, reportPendingBlockProfileViolations, resolveA11yBlockTypeLabel, resolveA11ySpec, resolveBlockDirection, resolveBlockFlowCapability, resolveCellSelectionCoord, resolveCellSelectionMatrix, resolveDefaultKeymap, resolveDirectedBinding, resolveDirectedCommand, resolveEditorA11yLabel, resolveEditorMessage, resolveEditorSchema, resolveFieldEditorBehavior, resolveFieldEditorInputMode, resolveFocusBlockDirection, resolveMessage, resolveSchema, resolveSchemaA11y, resolveSelectionTargetBlockIds, resolveSuggestionMenuTarget, runMigrations, searchControllerFacet, selectAdjacentInlineAtom, selectAll, selectBlock, selectionToRange, setCellCaretFocus, setVerticalCaretGoalX, setVerticalCaretMeasure, shouldAllowDirectBlockPaste, shouldAllowFlowInsertionInSlashMenu, shouldExposeBlockInTooling, shouldForceBlockScopedSelectAll, shouldRenderContainerChildren, shouldShowBlockInDefaultMenus, singleController, slashMenuGroupOf, smoothStreamControllerFacet, snapToNormalPosition, snapshotsControllerFacet, sortDeltaAttributes, spliceDeleteOp, spliceInsertOp, splitBlock, streamThroughEgress, streamingTargetFacet, suggestion, supportsInlineInputRules, supportsInlineMarks, tableCellDown, tableCellNext, tableCellPrev, tableEscapeGrid, toPseudoLocaleText, toggleMark, toolRuntimeFacet, undoManagerFacet, undoMetadataControllerFacet, undoRestoreControllerFacet, urlPolicy, urlPolicyFacet, usesInlineTextSelection, wordRangeAt };
1138
+ export { A11Y_MISSING_LABEL_CODE, APPLY_STORM_CODE, APPLY_STORM_QUEUE_LIMIT, type BeforeApplyHook, type BlockDirection, type BlockDirectionResolver, type BlockDirectionSetting, type CaretMotionParam, type CellCaretFocus, type CellCaretWrite, type ClipboardHandler, type CommandDispatchContext, type CommandHandlerTable, type CommandRegistry, type ContentMove, type ConvertBlockParam, type CreateCommandRegistryOptions, type CreateFacetRegistryOptions, type CreateHeadlessEditorOptions, type DecorationSource, type DefaultKeymapBinding, type DefaultKeymapContext, type DefinedBlockSchema, type DeleteGranularity, type DeleteParam, type DocumentMigration, DocumentRangeImpl, type EditorA11yLabelAttrs, EventEmitter, ExtensionManagerImpl, type FacetRegistry, type FacetSettleInput, HOOK_PRIORITIES, type InsertTextParam, type Keymap, type KeymapPlatform, type MigrationReport, type NormalPositionSnapshot, PIPELINE_PHASES, PSEUDO_LOCALE_CLOSE, PSEUDO_LOCALE_OPEN, type PendingBlock, type PendingBlockImportPolicyViolation, type PendingBlockProfilePolicyViolation, type ProfilePolicyViolation, type SchemaA11yAttrs, type SchemaA11yKind, SchemaEngineImpl, type SchemaRegistryConfig, SchemaRegistryImpl, type SelectBlockParam, SelectionAuthorityImpl as SelectionAuthority, type StructureBlockParam, type SuggestionMenuBoundary, type SuggestionMenuTarget, type SuggestionMenuTrigger, type ToggleMarkParam, type UrlContext, type UrlPolicy, type VerticalCaretDirection, type VerticalCaretMeasure, type VerticalCaretMeasureResult, type VerticalCaretPoint, type WordRange, a11yLabelFacet, affectedBlockIdsFromSummary, aiAutocompleteControllerFacet, aiControllerFacet, aiEgressExtension, aiEgressFacet, aiInlineCompletionFacet, aiInlineHistoryFacet, aiReviewControllerFacet, aiSuggestionsControllerFacet, announceEditorA11y, announcerFacet, applyDirectedBinding, applyMergeBlocks, applySplitBlock, ariaReadOnlyFacet, assetProviderFacet, beforeApplyFacet, blockDirectionFacet, blockLogicalText, blocksToOps, buildMergeBlocksRecipe, buildNormalPositionSnapshot, buildSplitBlockRecipe, buildTableChildren, builtinCommandHandlers, caretBlockEnd, caretBlockStart, caretDocEnd, caretDocStart, caretDown, caretLeft, caretLineEnd, caretLineStart, caretRight, caretUp, caretWordLeft, caretWordRight, clipboardFacet, collectEditorKeyBindings, collectToolExecutionOutput, commandHandler, commandsFacet, convertBlock, convertBlockOps, createAppHandle, createBlockHandle, createCommandRegistry, createDecorationSet, createDocumentSession, createEditor, createEmptySchema, createFacetRegistry, createHeadlessEditor, createImportResult, createMutationGroupMetadata, createPseudoLocaleCatalog, createTextSelection, decorationsFacet, deepEqual, defaultDirectionFacet, defaultKeymapBindings, defineBlock, defineCommand, defineExtension, defineFacet, delegatesToGridEditing, deleteAdjacentInlineAtom, deleteBackward, deleteBlock, deleteForward, deriveContentMoves, duplicateBlock, emptyDecorationSet, ensureInlineCompletionController, fieldEditorHostFacet, filterAIRequest, filterOpsForDocumentProfile, filterPendingBlocksForDocumentProfile, foldAndNormalize, getApplyOptionsGroupId, getBlockContentRole, getBlockSelectionRoleFromSchema, getBlockSelectionRoleFromType, getCellCaretFocus, getCommandRegistry, getEditorSelectionRecord, getFlowCapabilityFromSchema, getFlowCapabilityFromType, getInlineCompletionController, getNumberedListItemValue, getOpOriginGroupId, getOpOriginType, getSelectionBlockRange, getVerticalCaretGoalX, getVerticalCaretMeasure, hasFieldEditorSurface, hasIndexedCellSelectionMetadata, historyRedo, historyUndo, hookPriorityToPrecedence, indent, inlineLogicalText, inputRulesEngineFacet, inputRulesFacet, insertLineBreak, insertText, interpolateMessage, isBlockSelected, isCollapsed, isContainerBlock, isContainerBlockType, isContinuousTextFlowCapability, isMultiBlock, isPseudoLocaleText, keyBindingPriorityToPrecedence, keymapFacet, localeFacet, mapOffsetThroughSplices, mergeDecorationSets, mergeSchemas, messagesFacet, moveBlockDown, moveBlockUp, multiplayerControllerFacet, nextGraphemeBoundary, nextWordBoundary, normalizePendingBlocksForImport, orderSlashMenuItemsByGroup, outdent, previousGraphemeBoundary, previousWordBoundary, priorityToPrecedence, prop, renderSelectionTargetBlockText, renderSelectionTargetText, repairAnchor, reportPendingBlockImportViolations, reportPendingBlockProfileViolations, resolveA11yBlockTypeLabel, resolveA11ySpec, resolveBlockDirection, resolveBlockFlowCapability, resolveCellSelectionCoord, resolveCellSelectionMatrix, resolveDefaultKeymap, resolveDirectedBinding, resolveDirectedCommand, resolveEditorA11yLabel, resolveEditorMessage, resolveEditorSchema, resolveFieldEditorBehavior, resolveFieldEditorInputMode, resolveFocusBlockDirection, resolveMessage, resolveSchema, resolveSchemaA11y, resolveSelectionTargetBlockIds, resolveSuggestionMenuTarget, runMigrations, searchControllerFacet, selectAdjacentInlineAtom, selectAll, selectBlock, selectionToRange, setCellCaretFocus, setVerticalCaretGoalX, setVerticalCaretMeasure, shouldAllowDirectBlockPaste, shouldAllowFlowInsertionInSlashMenu, shouldExposeBlockInTooling, shouldForceBlockScopedSelectAll, shouldRenderContainerChildren, shouldShowBlockInDefaultMenus, singleController, slashMenuGroupOf, smoothStreamControllerFacet, snapToNormalPosition, snapshotsControllerFacet, sortDeltaAttributes, spliceDeleteOp, spliceInsertOp, splitBlock, streamThroughEgress, streamingTargetFacet, suggestion, supportsInlineInputRules, supportsInlineMarks, tableCellDown, tableCellNext, tableCellPrev, tableEscapeGrid, toPseudoLocaleText, toggleMark, toolRuntimeFacet, undoManagerFacet, undoMetadataControllerFacet, undoRestoreControllerFacet, urlPolicy, urlPolicyFacet, usesInlineTextSelection, wordRangeAt };
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as _input_pen_types from '@input/pen-types';
2
- import { ImportOptions, DocumentOp, DocumentProfile, FlowBlockCapability, InsertBlockOp, SetPropsOp, ImportResult, SchemaRegistry, BlockAuthoring, BlockSelectionRole, Editor, BlockSchema, InlineSchema, AppSchema, ComposableSchema, LayoutSchema, BlockDisplay, PropSchema, ContentType, BlockA11ySpec, Extension, DocumentState, DecorationSet, CreateEditorOptions, SchemaEngine, PenDocument, CRDTDocument, DiagnosticEvent, AppHandle, BlockHandle, CRDTAdapter, DocumentSession, Unsubscribe, Decoration, InlineCompletionController, DocumentRange, TextSelection, EditorAnchors, Anchor, AnchorTarget, Assoc, AnchorRange, ResolvedAnchorRange, SelectionRecord, SelectionState, SelectionOrigin, ChangeSummary, Point, Affinity, ReadonlySelectionState, CommitEvent, KeyBinding, CellSelection, ModelOperationRangeTarget, Block, FacetSpec, Facet, FacetProvider, FacetOutput, ApplyOptions, Importer, AssetProvider, CommandHandlerRegistration, InputRule, AIRequestFilter, AIRequestContext, ModelAdapter, ModelRequestedOperation, ModelToolChoice, ModelStreamEvent, Command, StructuralOriginTag, SpliceTextOp, CommandHandler, Precedence, OpOrigin, MessageCatalog, A11yLabel, MessageKey, MessageArgs, MutationGroupMetadata, ToolExecutionResult, FieldEditorBehavior, FieldEditorInputMode, A11yMessageKey, TextSplice } from '@input/pen-types';
2
+ import { ImportOptions, DocumentOp, DocumentProfile, FlowBlockCapability, InsertBlockOp, SetPropsOp, ImportResult, SchemaRegistry, BlockAuthoring, BlockContentRole, BlockSelectionRole, Editor, BlockSchema, InlineSchema, AppSchema, ComposableSchema, LayoutSchema, BlockDisplay, PropSchema, ContentType, BlockA11ySpec, Extension, DocumentState, DecorationSet, CreateEditorOptions, SchemaEngine, PenDocument, CRDTDocument, DiagnosticEvent, AppHandle, BlockHandle, CRDTAdapter, DocumentSession, Unsubscribe, Decoration, InlineCompletionController, DocumentRange, TextSelection, EditorAnchors, Anchor, AnchorTarget, Assoc, AnchorRange, ResolvedAnchorRange, SelectionRecord, SelectionState, SelectionOrigin, ChangeSummary, Point, Affinity, ReadonlySelectionState, CommitEvent, KeyBinding, CellSelection, ModelOperationRangeTarget, Block, FacetSpec, Facet, FacetProvider, FacetOutput, ApplyOptions, Importer, AssetProvider, CommandHandlerRegistration, InputRule, AIRequestFilter, AIRequestContext, ModelAdapter, ModelRequestedOperation, ModelToolChoice, ModelStreamEvent, Command, StructuralOriginTag, SpliceTextOp, CommandHandler, Precedence, OpOrigin, MessageCatalog, A11yLabel, MessageKey, MessageArgs, MutationGroupMetadata, ToolExecutionResult, FieldEditorBehavior, FieldEditorInputMode, A11yMessageKey, TextSplice } from '@input/pen-types';
3
3
  export { ImportOptions as ImporterOptions } from '@input/pen-types';
4
4
 
5
5
  type PendingInlineSegment = {
@@ -36,6 +36,18 @@ type BlockSchemaCapabilityLike = {
36
36
  } | null | undefined;
37
37
  declare function getFlowCapabilityFromSchema(schema: BlockSchemaCapabilityLike): FlowBlockCapability | null;
38
38
  declare function getBlockSelectionRoleFromSchema(schema: BlockSchemaCapabilityLike): BlockSelectionRole | null;
39
+ /**
40
+ * Reads `authoring.contentRole` from a resolved block schema.
41
+ *
42
+ * Unset schemas default to `"content"` so only an explicit `"chrome"`
43
+ * declaration is furniture. Missing schemas return `null`.
44
+ *
45
+ * @param schema - Resolved block schema, or `null`/`undefined` when the type
46
+ * is unregistered.
47
+ * @returns The content role, or `null` when `schema` is missing.
48
+ * @throws Never.
49
+ */
50
+ declare function getBlockContentRole(schema: BlockSchemaCapabilityLike): BlockContentRole | null;
39
51
  declare function getFlowCapabilityFromType(blockType: string | null | undefined): FlowBlockCapability | null;
40
52
  declare function shouldForceBlockScopedSelectAll(documentProfile: DocumentProfile, capability: FlowBlockCapability | null): boolean;
41
53
  declare function isContinuousTextFlowCapability(capability: FlowBlockCapability | null): boolean;
@@ -1123,4 +1135,4 @@ declare function affectedBlockIdsFromSummary(summary: Pick<ChangeSummary, "block
1123
1135
  */
1124
1136
  declare function mapOffsetThroughSplices(splices: readonly TextSplice[], offset: number, assoc: Assoc): number;
1125
1137
 
1126
- export { A11Y_MISSING_LABEL_CODE, APPLY_STORM_CODE, APPLY_STORM_QUEUE_LIMIT, type BeforeApplyHook, type BlockDirection, type BlockDirectionResolver, type BlockDirectionSetting, type CaretMotionParam, type CellCaretFocus, type CellCaretWrite, type ClipboardHandler, type CommandDispatchContext, type CommandHandlerTable, type CommandRegistry, type ContentMove, type ConvertBlockParam, type CreateCommandRegistryOptions, type CreateFacetRegistryOptions, type CreateHeadlessEditorOptions, type DecorationSource, type DefaultKeymapBinding, type DefaultKeymapContext, type DefinedBlockSchema, type DeleteGranularity, type DeleteParam, type DocumentMigration, DocumentRangeImpl, type EditorA11yLabelAttrs, EventEmitter, ExtensionManagerImpl, type FacetRegistry, type FacetSettleInput, HOOK_PRIORITIES, type InsertTextParam, type Keymap, type KeymapPlatform, type MigrationReport, type NormalPositionSnapshot, PIPELINE_PHASES, PSEUDO_LOCALE_CLOSE, PSEUDO_LOCALE_OPEN, type PendingBlock, type PendingBlockImportPolicyViolation, type PendingBlockProfilePolicyViolation, type ProfilePolicyViolation, type SchemaA11yAttrs, type SchemaA11yKind, SchemaEngineImpl, type SchemaRegistryConfig, SchemaRegistryImpl, type SelectBlockParam, SelectionAuthorityImpl as SelectionAuthority, type StructureBlockParam, type SuggestionMenuBoundary, type SuggestionMenuTarget, type SuggestionMenuTrigger, type ToggleMarkParam, type UrlContext, type UrlPolicy, type VerticalCaretDirection, type VerticalCaretMeasure, type VerticalCaretMeasureResult, type VerticalCaretPoint, type WordRange, a11yLabelFacet, affectedBlockIdsFromSummary, aiAutocompleteControllerFacet, aiControllerFacet, aiEgressExtension, aiEgressFacet, aiInlineCompletionFacet, aiInlineHistoryFacet, aiReviewControllerFacet, aiSuggestionsControllerFacet, announceEditorA11y, announcerFacet, applyDirectedBinding, applyMergeBlocks, applySplitBlock, ariaReadOnlyFacet, assetProviderFacet, beforeApplyFacet, blockDirectionFacet, blockLogicalText, blocksToOps, buildMergeBlocksRecipe, buildNormalPositionSnapshot, buildSplitBlockRecipe, buildTableChildren, builtinCommandHandlers, caretBlockEnd, caretBlockStart, caretDocEnd, caretDocStart, caretDown, caretLeft, caretLineEnd, caretLineStart, caretRight, caretUp, caretWordLeft, caretWordRight, clipboardFacet, collectEditorKeyBindings, collectToolExecutionOutput, commandHandler, commandsFacet, convertBlock, convertBlockOps, createAppHandle, createBlockHandle, createCommandRegistry, createDecorationSet, createDocumentSession, createEditor, createEmptySchema, createFacetRegistry, createHeadlessEditor, createImportResult, createMutationGroupMetadata, createPseudoLocaleCatalog, createTextSelection, decorationsFacet, deepEqual, defaultDirectionFacet, defaultKeymapBindings, defineBlock, defineCommand, defineExtension, defineFacet, delegatesToGridEditing, deleteAdjacentInlineAtom, deleteBackward, deleteBlock, deleteForward, deriveContentMoves, duplicateBlock, emptyDecorationSet, ensureInlineCompletionController, fieldEditorHostFacet, filterAIRequest, filterOpsForDocumentProfile, filterPendingBlocksForDocumentProfile, foldAndNormalize, getApplyOptionsGroupId, getBlockSelectionRoleFromSchema, getBlockSelectionRoleFromType, getCellCaretFocus, getCommandRegistry, getEditorSelectionRecord, getFlowCapabilityFromSchema, getFlowCapabilityFromType, getInlineCompletionController, getNumberedListItemValue, getOpOriginGroupId, getOpOriginType, getSelectionBlockRange, getVerticalCaretGoalX, getVerticalCaretMeasure, hasFieldEditorSurface, hasIndexedCellSelectionMetadata, historyRedo, historyUndo, hookPriorityToPrecedence, indent, inlineLogicalText, inputRulesEngineFacet, inputRulesFacet, insertLineBreak, insertText, interpolateMessage, isBlockSelected, isCollapsed, isContainerBlock, isContainerBlockType, isContinuousTextFlowCapability, isMultiBlock, isPseudoLocaleText, keyBindingPriorityToPrecedence, keymapFacet, localeFacet, mapOffsetThroughSplices, mergeDecorationSets, mergeSchemas, messagesFacet, moveBlockDown, moveBlockUp, multiplayerControllerFacet, nextGraphemeBoundary, nextWordBoundary, normalizePendingBlocksForImport, orderSlashMenuItemsByGroup, outdent, previousGraphemeBoundary, previousWordBoundary, priorityToPrecedence, prop, renderSelectionTargetBlockText, renderSelectionTargetText, repairAnchor, reportPendingBlockImportViolations, reportPendingBlockProfileViolations, resolveA11yBlockTypeLabel, resolveA11ySpec, resolveBlockDirection, resolveBlockFlowCapability, resolveCellSelectionCoord, resolveCellSelectionMatrix, resolveDefaultKeymap, resolveDirectedBinding, resolveDirectedCommand, resolveEditorA11yLabel, resolveEditorMessage, resolveEditorSchema, resolveFieldEditorBehavior, resolveFieldEditorInputMode, resolveFocusBlockDirection, resolveMessage, resolveSchema, resolveSchemaA11y, resolveSelectionTargetBlockIds, resolveSuggestionMenuTarget, runMigrations, searchControllerFacet, selectAdjacentInlineAtom, selectAll, selectBlock, selectionToRange, setCellCaretFocus, setVerticalCaretGoalX, setVerticalCaretMeasure, shouldAllowDirectBlockPaste, shouldAllowFlowInsertionInSlashMenu, shouldExposeBlockInTooling, shouldForceBlockScopedSelectAll, shouldRenderContainerChildren, shouldShowBlockInDefaultMenus, singleController, slashMenuGroupOf, smoothStreamControllerFacet, snapToNormalPosition, snapshotsControllerFacet, sortDeltaAttributes, spliceDeleteOp, spliceInsertOp, splitBlock, streamThroughEgress, streamingTargetFacet, suggestion, supportsInlineInputRules, supportsInlineMarks, tableCellDown, tableCellNext, tableCellPrev, tableEscapeGrid, toPseudoLocaleText, toggleMark, toolRuntimeFacet, undoManagerFacet, undoMetadataControllerFacet, undoRestoreControllerFacet, urlPolicy, urlPolicyFacet, usesInlineTextSelection, wordRangeAt };
1138
+ export { A11Y_MISSING_LABEL_CODE, APPLY_STORM_CODE, APPLY_STORM_QUEUE_LIMIT, type BeforeApplyHook, type BlockDirection, type BlockDirectionResolver, type BlockDirectionSetting, type CaretMotionParam, type CellCaretFocus, type CellCaretWrite, type ClipboardHandler, type CommandDispatchContext, type CommandHandlerTable, type CommandRegistry, type ContentMove, type ConvertBlockParam, type CreateCommandRegistryOptions, type CreateFacetRegistryOptions, type CreateHeadlessEditorOptions, type DecorationSource, type DefaultKeymapBinding, type DefaultKeymapContext, type DefinedBlockSchema, type DeleteGranularity, type DeleteParam, type DocumentMigration, DocumentRangeImpl, type EditorA11yLabelAttrs, EventEmitter, ExtensionManagerImpl, type FacetRegistry, type FacetSettleInput, HOOK_PRIORITIES, type InsertTextParam, type Keymap, type KeymapPlatform, type MigrationReport, type NormalPositionSnapshot, PIPELINE_PHASES, PSEUDO_LOCALE_CLOSE, PSEUDO_LOCALE_OPEN, type PendingBlock, type PendingBlockImportPolicyViolation, type PendingBlockProfilePolicyViolation, type ProfilePolicyViolation, type SchemaA11yAttrs, type SchemaA11yKind, SchemaEngineImpl, type SchemaRegistryConfig, SchemaRegistryImpl, type SelectBlockParam, SelectionAuthorityImpl as SelectionAuthority, type StructureBlockParam, type SuggestionMenuBoundary, type SuggestionMenuTarget, type SuggestionMenuTrigger, type ToggleMarkParam, type UrlContext, type UrlPolicy, type VerticalCaretDirection, type VerticalCaretMeasure, type VerticalCaretMeasureResult, type VerticalCaretPoint, type WordRange, a11yLabelFacet, affectedBlockIdsFromSummary, aiAutocompleteControllerFacet, aiControllerFacet, aiEgressExtension, aiEgressFacet, aiInlineCompletionFacet, aiInlineHistoryFacet, aiReviewControllerFacet, aiSuggestionsControllerFacet, announceEditorA11y, announcerFacet, applyDirectedBinding, applyMergeBlocks, applySplitBlock, ariaReadOnlyFacet, assetProviderFacet, beforeApplyFacet, blockDirectionFacet, blockLogicalText, blocksToOps, buildMergeBlocksRecipe, buildNormalPositionSnapshot, buildSplitBlockRecipe, buildTableChildren, builtinCommandHandlers, caretBlockEnd, caretBlockStart, caretDocEnd, caretDocStart, caretDown, caretLeft, caretLineEnd, caretLineStart, caretRight, caretUp, caretWordLeft, caretWordRight, clipboardFacet, collectEditorKeyBindings, collectToolExecutionOutput, commandHandler, commandsFacet, convertBlock, convertBlockOps, createAppHandle, createBlockHandle, createCommandRegistry, createDecorationSet, createDocumentSession, createEditor, createEmptySchema, createFacetRegistry, createHeadlessEditor, createImportResult, createMutationGroupMetadata, createPseudoLocaleCatalog, createTextSelection, decorationsFacet, deepEqual, defaultDirectionFacet, defaultKeymapBindings, defineBlock, defineCommand, defineExtension, defineFacet, delegatesToGridEditing, deleteAdjacentInlineAtom, deleteBackward, deleteBlock, deleteForward, deriveContentMoves, duplicateBlock, emptyDecorationSet, ensureInlineCompletionController, fieldEditorHostFacet, filterAIRequest, filterOpsForDocumentProfile, filterPendingBlocksForDocumentProfile, foldAndNormalize, getApplyOptionsGroupId, getBlockContentRole, getBlockSelectionRoleFromSchema, getBlockSelectionRoleFromType, getCellCaretFocus, getCommandRegistry, getEditorSelectionRecord, getFlowCapabilityFromSchema, getFlowCapabilityFromType, getInlineCompletionController, getNumberedListItemValue, getOpOriginGroupId, getOpOriginType, getSelectionBlockRange, getVerticalCaretGoalX, getVerticalCaretMeasure, hasFieldEditorSurface, hasIndexedCellSelectionMetadata, historyRedo, historyUndo, hookPriorityToPrecedence, indent, inlineLogicalText, inputRulesEngineFacet, inputRulesFacet, insertLineBreak, insertText, interpolateMessage, isBlockSelected, isCollapsed, isContainerBlock, isContainerBlockType, isContinuousTextFlowCapability, isMultiBlock, isPseudoLocaleText, keyBindingPriorityToPrecedence, keymapFacet, localeFacet, mapOffsetThroughSplices, mergeDecorationSets, mergeSchemas, messagesFacet, moveBlockDown, moveBlockUp, multiplayerControllerFacet, nextGraphemeBoundary, nextWordBoundary, normalizePendingBlocksForImport, orderSlashMenuItemsByGroup, outdent, previousGraphemeBoundary, previousWordBoundary, priorityToPrecedence, prop, renderSelectionTargetBlockText, renderSelectionTargetText, repairAnchor, reportPendingBlockImportViolations, reportPendingBlockProfileViolations, resolveA11yBlockTypeLabel, resolveA11ySpec, resolveBlockDirection, resolveBlockFlowCapability, resolveCellSelectionCoord, resolveCellSelectionMatrix, resolveDefaultKeymap, resolveDirectedBinding, resolveDirectedCommand, resolveEditorA11yLabel, resolveEditorMessage, resolveEditorSchema, resolveFieldEditorBehavior, resolveFieldEditorInputMode, resolveFocusBlockDirection, resolveMessage, resolveSchema, resolveSchemaA11y, resolveSelectionTargetBlockIds, resolveSuggestionMenuTarget, runMigrations, searchControllerFacet, selectAdjacentInlineAtom, selectAll, selectBlock, selectionToRange, setCellCaretFocus, setVerticalCaretGoalX, setVerticalCaretMeasure, shouldAllowDirectBlockPaste, shouldAllowFlowInsertionInSlashMenu, shouldExposeBlockInTooling, shouldForceBlockScopedSelectAll, shouldRenderContainerChildren, shouldShowBlockInDefaultMenus, singleController, slashMenuGroupOf, smoothStreamControllerFacet, snapToNormalPosition, snapshotsControllerFacet, sortDeltaAttributes, spliceDeleteOp, spliceInsertOp, splitBlock, streamThroughEgress, streamingTargetFacet, suggestion, supportsInlineInputRules, supportsInlineMarks, tableCellDown, tableCellNext, tableCellPrev, tableEscapeGrid, toPseudoLocaleText, toggleMark, toolRuntimeFacet, undoManagerFacet, undoMetadataControllerFacet, undoRestoreControllerFacet, urlPolicy, urlPolicyFacet, usesInlineTextSelection, wordRangeAt };
package/dist/index.mjs CHANGED
@@ -32,6 +32,15 @@ function getBlockSelectionRoleFromSchema(schema) {
32
32
  }
33
33
  return "delegated";
34
34
  }
35
+ function getBlockContentRole(schema) {
36
+ if (!schema) {
37
+ return null;
38
+ }
39
+ if (schema.authoring?.contentRole) {
40
+ return schema.authoring.contentRole;
41
+ }
42
+ return "content";
43
+ }
35
44
  function isLegacyBlockType(value) {
36
45
  return value === "codeBlock" || value === "divider" || value === "image" || value === "subdocument" || value === "table";
37
46
  }
@@ -15067,6 +15076,7 @@ export {
15067
15076
  filterPendingBlocksForDocumentProfile,
15068
15077
  foldAndNormalize,
15069
15078
  getApplyOptionsGroupId,
15079
+ getBlockContentRole,
15070
15080
  getBlockSelectionRoleFromSchema,
15071
15081
  getBlockSelectionRoleFromType,
15072
15082
  getCellCaretFocus,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@input/pen-core",
3
- "version": "0.2.4",
3
+ "version": "0.2.5",
4
4
  "description": "Headless, extension-first editor engine for human-AI co-authoring",
5
5
  "license": "MIT",
6
6
  "homepage": "https://github.com/input-systems/pen#readme",
@@ -43,8 +43,8 @@
43
43
  },
44
44
  "sideEffects": false,
45
45
  "dependencies": {
46
- "@input/pen-yjs": "^0.2.4",
47
- "@input/pen-types": "^0.2.4"
46
+ "@input/pen-yjs": "^0.2.5",
47
+ "@input/pen-types": "^0.2.5"
48
48
  },
49
49
  "devDependencies": {
50
50
  "tsup": "^8.4.0",