@input/pen-types 0.1.3 → 0.1.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.d.cts CHANGED
@@ -1051,21 +1051,21 @@ interface BlockAuthoring {
1051
1051
  flowCapability?: FlowBlockCapability;
1052
1052
  selectionRole?: BlockSelectionRole;
1053
1053
  }
1054
- interface BlockSchema<Type extends string = string, Props extends Record<string, PropSchema> = Record<string, PropSchema>, Content extends ContentType = "inline"> {
1054
+ interface BlockSchema<Type extends string = string, Props extends Record<string, PropSchema> = Record<string, PropSchema>, Content extends ContentType = ContentType> {
1055
1055
  type: Type;
1056
1056
  propSchema: Props;
1057
1057
  content: Content;
1058
1058
  layout?: LayoutSchema;
1059
1059
  serialize: {
1060
- toMarkdown?: (block: Block<Type, InferProps<Props>>) => string;
1061
- fromMarkdown?: (node: MarkdownNode) => BlockImportMatch<Type, InferProps<Props>> | null;
1062
- toHTML?: (block: Block<Type, InferProps<Props>>) => string;
1063
- fromHTML?: (element: HTMLImportElement) => BlockImportMatch<Type, InferProps<Props>> | null;
1064
- toXML?: (block: Block<Type, InferProps<Props>>) => string;
1065
- fromXML?: (element: XMLElement) => Block<Type, InferProps<Props>> | null;
1060
+ toMarkdown?(block: Block<Type, InferProps<Props>>): string;
1061
+ fromMarkdown?(node: MarkdownNode): BlockImportMatch<Type, InferProps<Props>> | null;
1062
+ toHTML?(block: Block<Type, InferProps<Props>>): string;
1063
+ fromHTML?(element: HTMLImportElement): BlockImportMatch<Type, InferProps<Props>> | null;
1064
+ toXML?(block: Block<Type, InferProps<Props>>): string;
1065
+ fromXML?(element: XMLElement): Block<Type, InferProps<Props>> | null;
1066
1066
  };
1067
- normalize?: (block: Block<Type, InferProps<Props>>) => Block<Type, InferProps<Props>>;
1068
- validateProps?: (raw: Record<string, unknown>) => InferProps<Props>;
1067
+ normalize?(block: Block<Type, InferProps<Props>>): Block<Type, InferProps<Props>>;
1068
+ validateProps?(raw: Record<string, unknown>): InferProps<Props>;
1069
1069
  fieldEditor?: FieldEditorType;
1070
1070
  keyBindings?: readonly KeyBinding[];
1071
1071
  placeholder?: string;
@@ -1084,6 +1084,8 @@ interface InlineSchema<Type extends string = string, Props extends Record<string
1084
1084
  fromMarkdown?: (node: MarkdownNode) => Record<string, unknown> | null;
1085
1085
  toHTML?: (text: string, props: Record<string, unknown>) => string;
1086
1086
  toXML?: (text: string, props: Record<string, unknown>) => string;
1087
+ /** Plain-text interchange for inline atoms (`kind: "node"`). Marks ignore this. */
1088
+ toText?: (props: Record<string, unknown>) => string;
1087
1089
  };
1088
1090
  apply?(content: unknown, range: Range, value: unknown): void;
1089
1091
  remove?(content: unknown, range: Range): void;
@@ -2410,6 +2412,11 @@ interface BlockRenderContext {
2410
2412
  }
2411
2413
  type BlockRenderer<Props = Record<string, unknown>> = (block: BlockHandle, ctx: BlockRenderContext) => unknown;
2412
2414
 
2415
+ /**
2416
+ * Contract-layer block-suggestion shape. Runtime review items use
2417
+ * `PersistentBlockSuggestion` on `@input/pen-ai`, which also admits
2418
+ * `split-block` and `format-text` actions and a `format` previousState.
2419
+ */
2413
2420
  interface BlockSuggestion {
2414
2421
  id: string;
2415
2422
  action: "insert-block" | "delete-block" | "move-block" | "convert-block";
package/dist/index.d.ts CHANGED
@@ -1051,21 +1051,21 @@ interface BlockAuthoring {
1051
1051
  flowCapability?: FlowBlockCapability;
1052
1052
  selectionRole?: BlockSelectionRole;
1053
1053
  }
1054
- interface BlockSchema<Type extends string = string, Props extends Record<string, PropSchema> = Record<string, PropSchema>, Content extends ContentType = "inline"> {
1054
+ interface BlockSchema<Type extends string = string, Props extends Record<string, PropSchema> = Record<string, PropSchema>, Content extends ContentType = ContentType> {
1055
1055
  type: Type;
1056
1056
  propSchema: Props;
1057
1057
  content: Content;
1058
1058
  layout?: LayoutSchema;
1059
1059
  serialize: {
1060
- toMarkdown?: (block: Block<Type, InferProps<Props>>) => string;
1061
- fromMarkdown?: (node: MarkdownNode) => BlockImportMatch<Type, InferProps<Props>> | null;
1062
- toHTML?: (block: Block<Type, InferProps<Props>>) => string;
1063
- fromHTML?: (element: HTMLImportElement) => BlockImportMatch<Type, InferProps<Props>> | null;
1064
- toXML?: (block: Block<Type, InferProps<Props>>) => string;
1065
- fromXML?: (element: XMLElement) => Block<Type, InferProps<Props>> | null;
1060
+ toMarkdown?(block: Block<Type, InferProps<Props>>): string;
1061
+ fromMarkdown?(node: MarkdownNode): BlockImportMatch<Type, InferProps<Props>> | null;
1062
+ toHTML?(block: Block<Type, InferProps<Props>>): string;
1063
+ fromHTML?(element: HTMLImportElement): BlockImportMatch<Type, InferProps<Props>> | null;
1064
+ toXML?(block: Block<Type, InferProps<Props>>): string;
1065
+ fromXML?(element: XMLElement): Block<Type, InferProps<Props>> | null;
1066
1066
  };
1067
- normalize?: (block: Block<Type, InferProps<Props>>) => Block<Type, InferProps<Props>>;
1068
- validateProps?: (raw: Record<string, unknown>) => InferProps<Props>;
1067
+ normalize?(block: Block<Type, InferProps<Props>>): Block<Type, InferProps<Props>>;
1068
+ validateProps?(raw: Record<string, unknown>): InferProps<Props>;
1069
1069
  fieldEditor?: FieldEditorType;
1070
1070
  keyBindings?: readonly KeyBinding[];
1071
1071
  placeholder?: string;
@@ -1084,6 +1084,8 @@ interface InlineSchema<Type extends string = string, Props extends Record<string
1084
1084
  fromMarkdown?: (node: MarkdownNode) => Record<string, unknown> | null;
1085
1085
  toHTML?: (text: string, props: Record<string, unknown>) => string;
1086
1086
  toXML?: (text: string, props: Record<string, unknown>) => string;
1087
+ /** Plain-text interchange for inline atoms (`kind: "node"`). Marks ignore this. */
1088
+ toText?: (props: Record<string, unknown>) => string;
1087
1089
  };
1088
1090
  apply?(content: unknown, range: Range, value: unknown): void;
1089
1091
  remove?(content: unknown, range: Range): void;
@@ -2410,6 +2412,11 @@ interface BlockRenderContext {
2410
2412
  }
2411
2413
  type BlockRenderer<Props = Record<string, unknown>> = (block: BlockHandle, ctx: BlockRenderContext) => unknown;
2412
2414
 
2415
+ /**
2416
+ * Contract-layer block-suggestion shape. Runtime review items use
2417
+ * `PersistentBlockSuggestion` on `@input/pen-ai`, which also admits
2418
+ * `split-block` and `format-text` actions and a `format` previousState.
2419
+ */
2413
2420
  interface BlockSuggestion {
2414
2421
  id: string;
2415
2422
  action: "insert-block" | "delete-block" | "move-block" | "convert-block";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@input/pen-types",
3
- "version": "0.1.3",
3
+ "version": "0.1.5",
4
4
  "description": "Type definitions and lightweight runtime helpers for Pen",
5
5
  "license": "MIT",
6
6
  "homepage": "https://github.com/input-systems/pen#readme",