@input/pen-core 0.1.5 → 0.1.6

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
@@ -4254,6 +4254,27 @@ function getProviderRecord(provider) {
4254
4254
  }
4255
4255
 
4256
4256
  // src/facets/coreFacets.ts
4257
+ function isClipboardHandlerTable(value) {
4258
+ return value != null && typeof value === "object" && !Array.isArray(value);
4259
+ }
4260
+ function mergeClipboardHandlers(inputs) {
4261
+ const merged = {};
4262
+ for (const input of inputs) {
4263
+ if (!isClipboardHandlerTable(input)) {
4264
+ continue;
4265
+ }
4266
+ if (input.html !== void 0) {
4267
+ merged.html = input.html;
4268
+ }
4269
+ if (input.markdown !== void 0) {
4270
+ merged.markdown = input.markdown;
4271
+ }
4272
+ if (input.assets !== void 0) {
4273
+ merged.assets = input.assets;
4274
+ }
4275
+ }
4276
+ return merged;
4277
+ }
4257
4278
  var keymapFacet = defineFacet({
4258
4279
  name: "pen.keymap",
4259
4280
  combine: (inputs) => inputs.flat()
@@ -4292,7 +4313,7 @@ var ariaReadOnlyFacet = defineFacet({
4292
4313
  });
4293
4314
  var clipboardFacet = defineFacet({
4294
4315
  name: "pen.clipboard",
4295
- combine: (inputs) => inputs
4316
+ combine: mergeClipboardHandlers
4296
4317
  });
4297
4318
 
4298
4319
  // src/editor/decorations.ts
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, 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, 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 = {
@@ -664,7 +664,11 @@ declare function createFacetRegistry(options?: CreateFacetRegistryOptions): Face
664
664
  type Keymap = readonly KeyBinding[];
665
665
  type BeforeApplyHook = (ops: DocumentOp[], options: ApplyOptions) => DocumentOp[];
666
666
  type DecorationSource = ((state: DocumentState, editor: Editor) => DecorationSet) | DecorationSet;
667
- type ClipboardHandler = unknown;
667
+ type ClipboardHandler = {
668
+ readonly html?: Importer;
669
+ readonly markdown?: Importer;
670
+ readonly assets?: AssetProvider;
671
+ };
668
672
  type CommandHandlerTable = {
669
673
  readonly [commandName: string]: readonly CommandHandlerRegistration[];
670
674
  };
@@ -674,7 +678,7 @@ declare const decorationsFacet: _input_pen_types.Facet<DecorationSource, readonl
674
678
  declare const inputRulesFacet: _input_pen_types.Facet<InputRule, readonly InputRule[]>;
675
679
  declare const commandsFacet: _input_pen_types.Facet<CommandHandlerRegistration<unknown>, CommandHandlerTable>;
676
680
  declare const ariaReadOnlyFacet: _input_pen_types.Facet<boolean, boolean>;
677
- declare const clipboardFacet: _input_pen_types.Facet<unknown, readonly unknown[]>;
681
+ declare const clipboardFacet: _input_pen_types.Facet<ClipboardHandler, ClipboardHandler>;
678
682
 
679
683
  type UrlContext = "link" | "image" | "media" | "download";
680
684
  interface UrlPolicy {
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, 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, 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 = {
@@ -664,7 +664,11 @@ declare function createFacetRegistry(options?: CreateFacetRegistryOptions): Face
664
664
  type Keymap = readonly KeyBinding[];
665
665
  type BeforeApplyHook = (ops: DocumentOp[], options: ApplyOptions) => DocumentOp[];
666
666
  type DecorationSource = ((state: DocumentState, editor: Editor) => DecorationSet) | DecorationSet;
667
- type ClipboardHandler = unknown;
667
+ type ClipboardHandler = {
668
+ readonly html?: Importer;
669
+ readonly markdown?: Importer;
670
+ readonly assets?: AssetProvider;
671
+ };
668
672
  type CommandHandlerTable = {
669
673
  readonly [commandName: string]: readonly CommandHandlerRegistration[];
670
674
  };
@@ -674,7 +678,7 @@ declare const decorationsFacet: _input_pen_types.Facet<DecorationSource, readonl
674
678
  declare const inputRulesFacet: _input_pen_types.Facet<InputRule, readonly InputRule[]>;
675
679
  declare const commandsFacet: _input_pen_types.Facet<CommandHandlerRegistration<unknown>, CommandHandlerTable>;
676
680
  declare const ariaReadOnlyFacet: _input_pen_types.Facet<boolean, boolean>;
677
- declare const clipboardFacet: _input_pen_types.Facet<unknown, readonly unknown[]>;
681
+ declare const clipboardFacet: _input_pen_types.Facet<ClipboardHandler, ClipboardHandler>;
678
682
 
679
683
  type UrlContext = "link" | "image" | "media" | "download";
680
684
  interface UrlPolicy {
package/dist/index.mjs CHANGED
@@ -4022,6 +4022,27 @@ function getProviderRecord(provider) {
4022
4022
  }
4023
4023
 
4024
4024
  // src/facets/coreFacets.ts
4025
+ function isClipboardHandlerTable(value) {
4026
+ return value != null && typeof value === "object" && !Array.isArray(value);
4027
+ }
4028
+ function mergeClipboardHandlers(inputs) {
4029
+ const merged = {};
4030
+ for (const input of inputs) {
4031
+ if (!isClipboardHandlerTable(input)) {
4032
+ continue;
4033
+ }
4034
+ if (input.html !== void 0) {
4035
+ merged.html = input.html;
4036
+ }
4037
+ if (input.markdown !== void 0) {
4038
+ merged.markdown = input.markdown;
4039
+ }
4040
+ if (input.assets !== void 0) {
4041
+ merged.assets = input.assets;
4042
+ }
4043
+ }
4044
+ return merged;
4045
+ }
4025
4046
  var keymapFacet = defineFacet({
4026
4047
  name: "pen.keymap",
4027
4048
  combine: (inputs) => inputs.flat()
@@ -4060,7 +4081,7 @@ var ariaReadOnlyFacet = defineFacet({
4060
4081
  });
4061
4082
  var clipboardFacet = defineFacet({
4062
4083
  name: "pen.clipboard",
4063
- combine: (inputs) => inputs
4084
+ combine: mergeClipboardHandlers
4064
4085
  });
4065
4086
 
4066
4087
  // src/editor/decorations.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@input/pen-core",
3
- "version": "0.1.5",
3
+ "version": "0.1.6",
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.1.5",
47
- "@input/pen-types": "^0.1.5"
46
+ "@input/pen-yjs": "^0.1.6",
47
+ "@input/pen-types": "^0.1.6"
48
48
  },
49
49
  "devDependencies": {
50
50
  "tsup": "^8.4.0",
@@ -54,6 +54,7 @@
54
54
  },
55
55
  "scripts": {
56
56
  "build": "tsup",
57
+ "dev": "tsup --watch --no-clean",
57
58
  "typecheck": "tsc --noEmit",
58
59
  "lint": "eslint .",
59
60
  "catalog:check": "node ../../scripts/catalog-check.mjs",