@portabletext/editor 1.48.7 → 1.48.8

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 (128) hide show
  1. package/lib/_chunks-cjs/behavior.core.cjs +20 -8
  2. package/lib/_chunks-cjs/behavior.core.cjs.map +1 -1
  3. package/lib/_chunks-cjs/behavior.markdown.cjs +5 -5
  4. package/lib/_chunks-cjs/behavior.markdown.cjs.map +1 -1
  5. package/lib/_chunks-cjs/editor-provider.cjs +121 -90
  6. package/lib/_chunks-cjs/editor-provider.cjs.map +1 -1
  7. package/lib/_chunks-cjs/selector.get-focus-inline-object.cjs +2 -2
  8. package/lib/_chunks-cjs/selector.get-focus-inline-object.cjs.map +1 -1
  9. package/lib/_chunks-cjs/selector.get-text-before.cjs +7 -4
  10. package/lib/_chunks-cjs/selector.get-text-before.cjs.map +1 -1
  11. package/lib/_chunks-cjs/selector.is-overlapping-selection.cjs +63 -47
  12. package/lib/_chunks-cjs/selector.is-overlapping-selection.cjs.map +1 -1
  13. package/lib/_chunks-cjs/selector.is-selecting-entire-blocks.cjs +29 -23
  14. package/lib/_chunks-cjs/selector.is-selecting-entire-blocks.cjs.map +1 -1
  15. package/lib/_chunks-cjs/util.merge-text-blocks.cjs +3 -3
  16. package/lib/_chunks-cjs/util.merge-text-blocks.cjs.map +1 -1
  17. package/lib/_chunks-cjs/util.selection-point-to-block-offset.cjs +15 -15
  18. package/lib/_chunks-cjs/util.selection-point-to-block-offset.cjs.map +1 -1
  19. package/lib/_chunks-cjs/util.slice-blocks.cjs +258 -38
  20. package/lib/_chunks-cjs/util.slice-blocks.cjs.map +1 -1
  21. package/lib/_chunks-es/behavior.core.js +21 -10
  22. package/lib/_chunks-es/behavior.core.js.map +1 -1
  23. package/lib/_chunks-es/behavior.markdown.js +5 -6
  24. package/lib/_chunks-es/behavior.markdown.js.map +1 -1
  25. package/lib/_chunks-es/editor-provider.js +75 -46
  26. package/lib/_chunks-es/editor-provider.js.map +1 -1
  27. package/lib/_chunks-es/selector.get-focus-inline-object.js +1 -2
  28. package/lib/_chunks-es/selector.get-focus-inline-object.js.map +1 -1
  29. package/lib/_chunks-es/selector.get-text-before.js +7 -4
  30. package/lib/_chunks-es/selector.get-text-before.js.map +1 -1
  31. package/lib/_chunks-es/selector.is-overlapping-selection.js +61 -46
  32. package/lib/_chunks-es/selector.is-overlapping-selection.js.map +1 -1
  33. package/lib/_chunks-es/selector.is-selecting-entire-blocks.js +30 -26
  34. package/lib/_chunks-es/selector.is-selecting-entire-blocks.js.map +1 -1
  35. package/lib/_chunks-es/util.merge-text-blocks.js +1 -1
  36. package/lib/_chunks-es/util.selection-point-to-block-offset.js +15 -16
  37. package/lib/_chunks-es/util.selection-point-to-block-offset.js.map +1 -1
  38. package/lib/_chunks-es/util.slice-blocks.js +258 -38
  39. package/lib/_chunks-es/util.slice-blocks.js.map +1 -1
  40. package/lib/behaviors/index.d.cts +2552 -251
  41. package/lib/behaviors/index.d.ts +2552 -251
  42. package/lib/index.cjs +45 -21
  43. package/lib/index.cjs.map +1 -1
  44. package/lib/index.d.cts +2350 -51
  45. package/lib/index.d.ts +2350 -51
  46. package/lib/index.js +44 -21
  47. package/lib/index.js.map +1 -1
  48. package/lib/plugins/index.cjs +16 -7
  49. package/lib/plugins/index.cjs.map +1 -1
  50. package/lib/plugins/index.d.cts +2324 -24
  51. package/lib/plugins/index.d.ts +2324 -24
  52. package/lib/plugins/index.js +16 -7
  53. package/lib/plugins/index.js.map +1 -1
  54. package/lib/selectors/index.cjs +5 -5
  55. package/lib/selectors/index.cjs.map +1 -1
  56. package/lib/selectors/index.d.cts +2321 -28
  57. package/lib/selectors/index.d.ts +2321 -28
  58. package/lib/selectors/index.js +5 -6
  59. package/lib/selectors/index.js.map +1 -1
  60. package/lib/utils/index.cjs +30 -24
  61. package/lib/utils/index.cjs.map +1 -1
  62. package/lib/utils/index.d.cts +2350 -44
  63. package/lib/utils/index.d.ts +2350 -44
  64. package/lib/utils/index.js +30 -24
  65. package/lib/utils/index.js.map +1 -1
  66. package/package.json +1 -2
  67. package/src/behavior-actions/behavior.action.block.unset.ts +1 -1
  68. package/src/behavior-actions/behavior.action.decorator.add.ts +20 -5
  69. package/src/behaviors/behavior.abstract.decorator.ts +1 -1
  70. package/src/behaviors/behavior.abstract.delete.ts +1 -1
  71. package/src/behaviors/behavior.abstract.insert.ts +2 -2
  72. package/src/behaviors/behavior.abstract.select.ts +16 -4
  73. package/src/behaviors/behavior.abstract.split.ts +9 -6
  74. package/src/behaviors/behavior.core.block-objects.ts +5 -5
  75. package/src/behaviors/behavior.core.insert-break.ts +16 -4
  76. package/src/behaviors/behavior.core.lists.ts +4 -6
  77. package/src/behaviors/behavior.decorator-pair.ts +13 -4
  78. package/src/behaviors/behavior.default.ts +1 -1
  79. package/src/behaviors/behavior.markdown.ts +5 -5
  80. package/src/converters/converter.portable-text.ts +1 -1
  81. package/src/converters/converter.text-html.ts +1 -1
  82. package/src/converters/converter.text-plain.ts +4 -4
  83. package/src/editor/plugins/__tests__/withEditableAPIGetFragment.test.tsx +10 -2
  84. package/src/editor/plugins/createWithSchemaTypes.ts +12 -19
  85. package/src/internal-utils/__tests__/dmpToOperations.test.ts +13 -12
  86. package/src/internal-utils/drag-selection.ts +16 -4
  87. package/src/internal-utils/event-position.ts +20 -8
  88. package/src/internal-utils/parse-blocks.ts +17 -5
  89. package/src/internal-utils/validateValue.ts +6 -6
  90. package/src/plugins/plugin.decorator-shortcut.ts +2 -2
  91. package/src/selectors/selector.get-active-annotations.ts +5 -2
  92. package/src/selectors/selector.get-active-list-item.ts +4 -3
  93. package/src/selectors/selector.get-active-style.ts +4 -3
  94. package/src/selectors/selector.get-anchor-text-block.ts +3 -6
  95. package/src/selectors/selector.get-block-offsets.ts +2 -2
  96. package/src/selectors/selector.get-caret-word-selection.ts +11 -5
  97. package/src/selectors/selector.get-selected-slice.ts +1 -1
  98. package/src/selectors/selector.get-selected-spans.ts +11 -15
  99. package/src/selectors/selector.get-selected-text-blocks.ts +3 -3
  100. package/src/selectors/selector.get-selection-text.ts +3 -3
  101. package/src/selectors/selector.get-text-before.ts +5 -2
  102. package/src/selectors/selector.get-trimmed-selection.ts +20 -14
  103. package/src/selectors/selector.is-active-annotation.ts +4 -2
  104. package/src/selectors/selector.is-active-decorator.test.ts +3 -3
  105. package/src/selectors/selector.is-at-the-end-of-block.ts +4 -1
  106. package/src/selectors/selector.is-at-the-start-of-block.ts +4 -1
  107. package/src/selectors/selector.is-point-after-selection.ts +7 -6
  108. package/src/selectors/selector.is-point-before-selection.ts +7 -6
  109. package/src/selectors/selector.is-selecting-entire-blocks.ts +8 -2
  110. package/src/selectors/selectors.ts +25 -28
  111. package/src/utils/util.block-offset-to-block-selection-point.ts +4 -4
  112. package/src/utils/util.block-offset-to-selection-point.ts +5 -5
  113. package/src/utils/util.block-offset.test.ts +219 -156
  114. package/src/utils/util.block-offset.ts +14 -17
  115. package/src/utils/util.block-offsets-to-selection.ts +5 -5
  116. package/src/utils/util.child-selection-point-to-block-offset.ts +7 -10
  117. package/src/utils/util.get-block-end-point.ts +15 -15
  118. package/src/utils/util.get-block-start-point.ts +13 -12
  119. package/src/utils/util.is-empty-text-block.ts +9 -8
  120. package/src/utils/util.selection-point-to-block-offset.ts +4 -4
  121. package/src/utils/util.slice-blocks.test.ts +178 -121
  122. package/src/utils/util.slice-blocks.ts +25 -24
  123. package/src/utils/util.split-text-block.ts +18 -12
  124. package/lib/_chunks-cjs/parse-blocks.cjs +0 -205
  125. package/lib/_chunks-cjs/parse-blocks.cjs.map +0 -1
  126. package/lib/_chunks-es/parse-blocks.js +0 -206
  127. package/lib/_chunks-es/parse-blocks.js.map +0 -1
  128. package/src/behavior-actions/behavior.guards.ts +0 -24
@@ -1,5 +1,4 @@
1
- import { isPortableTextSpan } from "@sanity/types";
2
- import { getFocusChild } from "./selector.is-overlapping-selection.js";
1
+ import { getFocusChild, isPortableTextSpan } from "./selector.is-overlapping-selection.js";
3
2
  const getFocusInlineObject = (snapshot) => {
4
3
  const focusChild = getFocusChild(snapshot);
5
4
  return focusChild && !isPortableTextSpan(focusChild.node) ? {
@@ -1 +1 @@
1
- {"version":3,"file":"selector.get-focus-inline-object.js","sources":["../../src/selectors/selector.get-focus-inline-object.ts"],"sourcesContent":["import {\n isPortableTextSpan,\n type KeyedSegment,\n type PortableTextObject,\n} from '@sanity/types'\nimport type {EditorSelector} from '../editor/editor-selector'\nimport {getFocusChild} from './selectors'\n\n/**\n * @public\n */\nexport const getFocusInlineObject: EditorSelector<\n | {node: PortableTextObject; path: [KeyedSegment, 'children', KeyedSegment]}\n | undefined\n> = (snapshot) => {\n const focusChild = getFocusChild(snapshot)\n\n return focusChild && !isPortableTextSpan(focusChild.node)\n ? {node: focusChild.node, path: focusChild.path}\n : undefined\n}\n"],"names":["getFocusInlineObject","snapshot","focusChild","getFocusChild","isPortableTextSpan","node","path","undefined"],"mappings":";;AAWO,MAAMA,uBAGRC,CAAa,aAAA;AACVC,QAAAA,aAAaC,cAAcF,QAAQ;AAEzC,SAAOC,cAAc,CAACE,mBAAmBF,WAAWG,IAAI,IACpD;AAAA,IAACA,MAAMH,WAAWG;AAAAA,IAAMC,MAAMJ,WAAWI;AAAAA,EAAAA,IACzCC;AACN;"}
1
+ {"version":3,"file":"selector.get-focus-inline-object.js","sources":["../../src/selectors/selector.get-focus-inline-object.ts"],"sourcesContent":["import {\n isPortableTextSpan,\n type KeyedSegment,\n type PortableTextObject,\n} from '@sanity/types'\nimport type {EditorSelector} from '../editor/editor-selector'\nimport {getFocusChild} from './selectors'\n\n/**\n * @public\n */\nexport const getFocusInlineObject: EditorSelector<\n | {node: PortableTextObject; path: [KeyedSegment, 'children', KeyedSegment]}\n | undefined\n> = (snapshot) => {\n const focusChild = getFocusChild(snapshot)\n\n return focusChild && !isPortableTextSpan(focusChild.node)\n ? {node: focusChild.node, path: focusChild.path}\n : undefined\n}\n"],"names":["getFocusInlineObject","snapshot","focusChild","getFocusChild","isPortableTextSpan","node","path","undefined"],"mappings":";AAWO,MAAMA,uBAGRC,CAAa,aAAA;AACVC,QAAAA,aAAaC,cAAcF,QAAQ;AAEzC,SAAOC,cAAc,CAACE,mBAAmBF,WAAWG,IAAI,IACpD;AAAA,IAACA,MAAMH,WAAWG;AAAAA,IAAMC,MAAMJ,WAAWI;AAAAA,EAAAA,IACzCC;AACN;"}
@@ -7,10 +7,13 @@ const getBlockTextBefore = (snapshot) => {
7
7
  if (!block)
8
8
  return "";
9
9
  const startOfBlock = getBlockStartPoint({
10
- node: block,
11
- path: [{
12
- _key: block._key
13
- }]
10
+ context: snapshot.context,
11
+ block: {
12
+ node: block,
13
+ path: [{
14
+ _key: block._key
15
+ }]
16
+ }
14
17
  });
15
18
  return getSelectionText({
16
19
  context: {
@@ -1 +1 @@
1
- {"version":3,"file":"selector.get-text-before.js","sources":["../../src/selectors/selector.get-text-before.ts"],"sourcesContent":["import type {EditorSelector} from '../editor/editor-selector'\nimport {getBlockStartPoint} from '../utils/util.get-block-start-point'\nimport {isKeyedSegment} from '../utils/util.is-keyed-segment'\nimport {reverseSelection} from '../utils/util.reverse-selection'\nimport {getSelectionText} from './selector.get-selection-text'\n\n/**\n * @public\n */\nexport const getBlockTextBefore: EditorSelector<string> = (snapshot) => {\n if (!snapshot.context.selection) {\n return ''\n }\n\n const selection = snapshot.context.selection.backward\n ? reverseSelection(snapshot.context.selection)\n : snapshot.context.selection\n const point = selection.anchor\n const key = isKeyedSegment(point.path[0]) ? point.path[0]._key : undefined\n\n const block = key\n ? snapshot.context.value.find((block) => block._key === key)\n : undefined\n\n if (!block) {\n return ''\n }\n\n const startOfBlock = getBlockStartPoint({\n node: block,\n path: [{_key: block._key}],\n })\n\n return getSelectionText({\n ...snapshot,\n context: {\n ...snapshot.context,\n selection: {\n anchor: startOfBlock,\n focus: point,\n },\n },\n })\n}\n"],"names":["getBlockTextBefore","snapshot","context","selection","point","backward","reverseSelection","anchor","key","isKeyedSegment","path","_key","undefined","block","value","find","startOfBlock","getBlockStartPoint","node","getSelectionText","focus"],"mappings":";;AASO,MAAMA,qBAA8CC,CAAa,aAAA;AAClE,MAAA,CAACA,SAASC,QAAQC;AACb,WAAA;AAMT,QAAMC,SAHYH,SAASC,QAAQC,UAAUE,WACzCC,iBAAiBL,SAASC,QAAQC,SAAS,IAC3CF,SAASC,QAAQC,WACGI,QAClBC,MAAMC,eAAeL,MAAMM,KAAK,CAAC,CAAC,IAAIN,MAAMM,KAAK,CAAC,EAAEC,OAAOC,QAE3DC,QAAQL,MACVP,SAASC,QAAQY,MAAMC,KAAMF,CAAAA,WAAUA,OAAMF,SAASH,GAAG,IACzDI;AAEJ,MAAI,CAACC;AACI,WAAA;AAGT,QAAMG,eAAeC,mBAAmB;AAAA,IACtCC,MAAML;AAAAA,IACNH,MAAM,CAAC;AAAA,MAACC,MAAME,MAAMF;AAAAA,IAAK,CAAA;AAAA,EAAA,CAC1B;AAED,SAAOQ,iBAAiB;AAAA,IAEtBjB,SAAS;AAAA,MACP,GAAGD,SAASC;AAAAA,MACZC,WAAW;AAAA,QACTI,QAAQS;AAAAA,QACRI,OAAOhB;AAAAA,MAAAA;AAAAA,IACT;AAAA,EACF,CACD;AACH;"}
1
+ {"version":3,"file":"selector.get-text-before.js","sources":["../../src/selectors/selector.get-text-before.ts"],"sourcesContent":["import type {EditorSelector} from '../editor/editor-selector'\nimport {getBlockStartPoint} from '../utils/util.get-block-start-point'\nimport {isKeyedSegment} from '../utils/util.is-keyed-segment'\nimport {reverseSelection} from '../utils/util.reverse-selection'\nimport {getSelectionText} from './selector.get-selection-text'\n\n/**\n * @public\n */\nexport const getBlockTextBefore: EditorSelector<string> = (snapshot) => {\n if (!snapshot.context.selection) {\n return ''\n }\n\n const selection = snapshot.context.selection.backward\n ? reverseSelection(snapshot.context.selection)\n : snapshot.context.selection\n const point = selection.anchor\n const key = isKeyedSegment(point.path[0]) ? point.path[0]._key : undefined\n\n const block = key\n ? snapshot.context.value.find((block) => block._key === key)\n : undefined\n\n if (!block) {\n return ''\n }\n\n const startOfBlock = getBlockStartPoint({\n context: snapshot.context,\n block: {\n node: block,\n path: [{_key: block._key}],\n },\n })\n\n return getSelectionText({\n ...snapshot,\n context: {\n ...snapshot.context,\n selection: {\n anchor: startOfBlock,\n focus: point,\n },\n },\n })\n}\n"],"names":["getBlockTextBefore","snapshot","context","selection","point","backward","reverseSelection","anchor","key","isKeyedSegment","path","_key","undefined","block","value","find","startOfBlock","getBlockStartPoint","node","getSelectionText","focus"],"mappings":";;AASO,MAAMA,qBAA8CC,CAAa,aAAA;AAClE,MAAA,CAACA,SAASC,QAAQC;AACb,WAAA;AAMT,QAAMC,SAHYH,SAASC,QAAQC,UAAUE,WACzCC,iBAAiBL,SAASC,QAAQC,SAAS,IAC3CF,SAASC,QAAQC,WACGI,QAClBC,MAAMC,eAAeL,MAAMM,KAAK,CAAC,CAAC,IAAIN,MAAMM,KAAK,CAAC,EAAEC,OAAOC,QAE3DC,QAAQL,MACVP,SAASC,QAAQY,MAAMC,KAAMF,CAAAA,WAAUA,OAAMF,SAASH,GAAG,IACzDI;AAEJ,MAAI,CAACC;AACI,WAAA;AAGT,QAAMG,eAAeC,mBAAmB;AAAA,IACtCf,SAASD,SAASC;AAAAA,IAClBW,OAAO;AAAA,MACLK,MAAML;AAAAA,MACNH,MAAM,CAAC;AAAA,QAACC,MAAME,MAAMF;AAAAA,MAAK,CAAA;AAAA,IAAA;AAAA,EAC3B,CACD;AAED,SAAOQ,iBAAiB;AAAA,IAEtBjB,SAAS;AAAA,MACP,GAAGD,SAASC;AAAAA,MACZC,WAAW;AAAA,QACTI,QAAQS;AAAAA,QACRI,OAAOhB;AAAAA,MAAAA;AAAAA,IACT;AAAA,EACF,CACD;AACH;"}
@@ -1,22 +1,22 @@
1
- import { isSpan, sliceBlocks, spanSelectionPointToBlockOffset, getBlockStartPoint, getBlockEndPoint, blockOffsetToSpanSelectionPoint, isEqualSelectionPoints, reverseSelection } from "./util.slice-blocks.js";
2
- import { isPortableTextTextBlock, isPortableTextListBlock, isPortableTextSpan, isKeySegment } from "@sanity/types";
3
- const isSelectionCollapsed = (snapshot) => snapshot.context.selection ? JSON.stringify(snapshot.context.selection.anchor.path) === JSON.stringify(snapshot.context.selection.focus.path) && snapshot.context.selection?.anchor.offset === snapshot.context.selection?.focus.offset : !1;
4
- function createGuards({
5
- schema
6
- }) {
7
- function isListBlock(block) {
8
- return isPortableTextListBlock(block) && block._type === schema.block.name;
9
- }
10
- function isTextBlock(block) {
11
- return isPortableTextTextBlock(block) && block._type === schema.block.name;
12
- }
13
- return {
14
- isListBlock,
15
- isTextBlock
16
- };
1
+ import { isTextBlock, isSpan, isListBlock, isKeyedSegment, isSpan$1, sliceBlocks, spanSelectionPointToBlockOffset, getBlockStartPoint, getBlockEndPoint, blockOffsetToSpanSelectionPoint, isEqualSelectionPoints, reverseSelection } from "./util.slice-blocks.js";
2
+ const reKeySegment = /_key\s*==\s*['"](.*)['"]/;
3
+ function isKeySegment(segment) {
4
+ return typeof segment == "string" ? reKeySegment.test(segment.trim()) : typeof segment == "object" && "_key" in segment;
5
+ }
6
+ function isRecord$1(value) {
7
+ return !!value && (typeof value == "object" || typeof value == "function");
8
+ }
9
+ function isPortableTextSpan(value) {
10
+ return isRecord$1(value) && value._type === "span" && typeof value.text == "string" && ("marks" in value ? Array.isArray(value.marks) && value.marks.every((mark) => typeof mark == "string") : !0);
11
+ }
12
+ function defineType(schemaDefinition, defineOptions) {
13
+ return schemaDefinition;
17
14
  }
18
- const getFocusBlock = (snapshot) => {
19
- const key = snapshot.context.selection && isKeySegment(snapshot.context.selection.focus.path[0]) ? snapshot.context.selection.focus.path[0]._key : void 0, node = key ? snapshot.context.value.find((block) => block._key === key) : void 0;
15
+ function defineField(schemaField, defineOptions) {
16
+ return schemaField;
17
+ }
18
+ const isSelectionCollapsed = (snapshot) => snapshot.context.selection ? JSON.stringify(snapshot.context.selection.anchor.path) === JSON.stringify(snapshot.context.selection.focus.path) && snapshot.context.selection?.anchor.offset === snapshot.context.selection?.focus.offset : !1, getFocusBlock = (snapshot) => {
19
+ const key = snapshot.context.selection && isKeyedSegment(snapshot.context.selection.focus.path[0]) ? snapshot.context.selection.focus.path[0]._key : void 0, node = key ? snapshot.context.value.find((block) => block._key === key) : void 0;
20
20
  return node && key ? {
21
21
  node,
22
22
  path: [{
@@ -24,20 +24,20 @@ const getFocusBlock = (snapshot) => {
24
24
  }]
25
25
  } : void 0;
26
26
  }, getFocusListBlock = (snapshot) => {
27
- const guards = createGuards(snapshot.context), focusBlock = getFocusBlock(snapshot);
28
- return focusBlock && guards.isListBlock(focusBlock.node) ? {
29
- node: focusBlock.node,
30
- path: focusBlock.path
27
+ const focusTextBlock = getFocusTextBlock(snapshot);
28
+ return focusTextBlock && isListBlock(snapshot.context, focusTextBlock.node) ? {
29
+ node: focusTextBlock.node,
30
+ path: focusTextBlock.path
31
31
  } : void 0;
32
32
  }, getFocusTextBlock = (snapshot) => {
33
33
  const focusBlock = getFocusBlock(snapshot);
34
- return focusBlock && isPortableTextTextBlock(focusBlock.node) ? {
34
+ return focusBlock && isTextBlock(snapshot.context, focusBlock.node) ? {
35
35
  node: focusBlock.node,
36
36
  path: focusBlock.path
37
37
  } : void 0;
38
38
  }, getFocusBlockObject = (snapshot) => {
39
39
  const focusBlock = getFocusBlock(snapshot);
40
- return focusBlock && !isPortableTextTextBlock(focusBlock.node) ? {
40
+ return focusBlock && !isTextBlock(snapshot.context, focusBlock.node) ? {
41
41
  node: focusBlock.node,
42
42
  path: focusBlock.path
43
43
  } : void 0;
@@ -45,7 +45,7 @@ const getFocusBlock = (snapshot) => {
45
45
  const focusBlock = getFocusTextBlock(snapshot);
46
46
  if (!focusBlock)
47
47
  return;
48
- const key = snapshot.context.selection && isKeySegment(snapshot.context.selection.focus.path[2]) ? snapshot.context.selection.focus.path[2]._key : void 0, node = key ? focusBlock.node.children.find((span) => span._key === key) : void 0;
48
+ const key = snapshot.context.selection && isKeyedSegment(snapshot.context.selection.focus.path[2]) ? snapshot.context.selection.focus.path[2]._key : void 0, node = key ? focusBlock.node.children.find((span) => span._key === key) : void 0;
49
49
  return node && key ? {
50
50
  node,
51
51
  path: [...focusBlock.path, "children", {
@@ -54,7 +54,7 @@ const getFocusBlock = (snapshot) => {
54
54
  } : void 0;
55
55
  }, getFocusSpan = (snapshot) => {
56
56
  const focusChild = getFocusChild(snapshot);
57
- return focusChild && isPortableTextSpan(focusChild.node) ? {
57
+ return focusChild && isSpan(snapshot.context, focusChild.node) ? {
58
58
  node: focusChild.node,
59
59
  path: focusChild.path
60
60
  } : void 0;
@@ -77,7 +77,7 @@ const getFocusBlock = (snapshot) => {
77
77
  }, getSelectedBlocks = (snapshot) => {
78
78
  if (!snapshot.context.selection)
79
79
  return [];
80
- const selectedBlocks = [], startKey = snapshot.context.selection.backward ? isKeySegment(snapshot.context.selection.focus.path[0]) ? snapshot.context.selection.focus.path[0]._key : void 0 : isKeySegment(snapshot.context.selection.anchor.path[0]) ? snapshot.context.selection.anchor.path[0]._key : void 0, endKey = snapshot.context.selection.backward ? isKeySegment(snapshot.context.selection.anchor.path[0]) ? snapshot.context.selection.anchor.path[0]._key : void 0 : isKeySegment(snapshot.context.selection.focus.path[0]) ? snapshot.context.selection.focus.path[0]._key : void 0;
80
+ const selectedBlocks = [], startKey = snapshot.context.selection.backward ? isKeyedSegment(snapshot.context.selection.focus.path[0]) ? snapshot.context.selection.focus.path[0]._key : void 0 : isKeyedSegment(snapshot.context.selection.anchor.path[0]) ? snapshot.context.selection.anchor.path[0]._key : void 0, endKey = snapshot.context.selection.backward ? isKeyedSegment(snapshot.context.selection.anchor.path[0]) ? snapshot.context.selection.anchor.path[0]._key : void 0 : isKeyedSegment(snapshot.context.selection.focus.path[0]) ? snapshot.context.selection.focus.path[0]._key : void 0;
81
81
  if (!startKey || !endKey)
82
82
  return selectedBlocks;
83
83
  for (const block of snapshot.context.value) {
@@ -111,7 +111,7 @@ const getFocusBlock = (snapshot) => {
111
111
  }, getSelectionStartBlock = (snapshot) => {
112
112
  if (!snapshot.context.selection)
113
113
  return;
114
- const key = snapshot.context.selection.backward ? isKeySegment(snapshot.context.selection.focus.path[0]) ? snapshot.context.selection.focus.path[0]._key : void 0 : isKeySegment(snapshot.context.selection.anchor.path[0]) ? snapshot.context.selection.anchor.path[0]._key : void 0, node = key ? snapshot.context.value.find((block) => block._key === key) : void 0;
114
+ const key = snapshot.context.selection.backward ? isKeyedSegment(snapshot.context.selection.focus.path[0]) ? snapshot.context.selection.focus.path[0]._key : void 0 : isKeyedSegment(snapshot.context.selection.anchor.path[0]) ? snapshot.context.selection.anchor.path[0]._key : void 0, node = key ? snapshot.context.value.find((block) => block._key === key) : void 0;
115
115
  return node && key ? {
116
116
  node,
117
117
  path: [{
@@ -121,7 +121,7 @@ const getFocusBlock = (snapshot) => {
121
121
  }, getSelectionEndBlock = (snapshot) => {
122
122
  if (!snapshot.context.selection)
123
123
  return;
124
- const key = snapshot.context.selection.backward ? isKeySegment(snapshot.context.selection.anchor.path[0]) ? snapshot.context.selection.anchor.path[0]._key : void 0 : isKeySegment(snapshot.context.selection.focus.path[0]) ? snapshot.context.selection.focus.path[0]._key : void 0, node = key ? snapshot.context.value.find((block) => block._key === key) : void 0;
124
+ const key = snapshot.context.selection.backward ? isKeyedSegment(snapshot.context.selection.anchor.path[0]) ? snapshot.context.selection.anchor.path[0]._key : void 0 : isKeyedSegment(snapshot.context.selection.focus.path[0]) ? snapshot.context.selection.focus.path[0]._key : void 0, node = key ? snapshot.context.value.find((block) => block._key === key) : void 0;
125
125
  return node && key ? {
126
126
  node,
127
127
  path: [{
@@ -187,7 +187,7 @@ const getFocusBlock = (snapshot) => {
187
187
  endPointChildFound = !0;
188
188
  continue;
189
189
  }
190
- if (!isSpan(snapshot.context, child) && endPointChildFound) {
190
+ if (!isSpan$1(snapshot.context, child) && endPointChildFound) {
191
191
  inlineObject = {
192
192
  node: child,
193
193
  path: [...focusTextBlock.path, "children", {
@@ -206,7 +206,7 @@ const getFocusBlock = (snapshot) => {
206
206
  for (const child of focusTextBlock.node.children) {
207
207
  if (child._key === selectionStartPointChildKey)
208
208
  break;
209
- isSpan(snapshot.context, child) || (inlineObject = {
209
+ isSpan$1(snapshot.context, child) || (inlineObject = {
210
210
  node: child,
211
211
  path: [...focusTextBlock.path, "children", {
212
212
  _key: child._key
@@ -215,18 +215,21 @@ const getFocusBlock = (snapshot) => {
215
215
  }
216
216
  return inlineObject;
217
217
  }, getSelectedSlice = (snapshot) => sliceBlocks({
218
- blocks: snapshot.context.value,
219
- selection: snapshot.context.selection
220
- }), getSelectionText = (snapshot) => getSelectedSlice(snapshot).reduce((text, block) => isPortableTextTextBlock(block) ? text + block.children.reduce((text2, child) => isPortableTextSpan(child) ? text2 + child.text : text2, "") : text, ""), isSelectionExpanded = (snapshot) => !isSelectionCollapsed(snapshot), getCaretWordSelection = (snapshot) => {
218
+ context: snapshot.context,
219
+ blocks: snapshot.context.value
220
+ }), getSelectionText = (snapshot) => getSelectedSlice(snapshot).reduce((text, block) => isTextBlock(snapshot.context, block) ? text + block.children.reduce((text2, child) => isSpan(snapshot.context, child) ? text2 + child.text : text2, "") : text, ""), isSelectionExpanded = (snapshot) => !isSelectionCollapsed(snapshot), getCaretWordSelection = (snapshot) => {
221
221
  if (!snapshot.context.selection || !isSelectionCollapsed(snapshot))
222
222
  return null;
223
223
  const focusTextBlock = getFocusTextBlock(snapshot), selectionStartPoint = getSelectionStartPoint(snapshot), selectionStartOffset = selectionStartPoint ? spanSelectionPointToBlockOffset({
224
- value: snapshot.context.value,
224
+ context: snapshot.context,
225
225
  selectionPoint: selectionStartPoint
226
226
  }) : void 0;
227
227
  if (!focusTextBlock || !selectionStartPoint || !selectionStartOffset)
228
228
  return null;
229
- const previousInlineObject = getPreviousInlineObject(snapshot), blockStartPoint = getBlockStartPoint(focusTextBlock), textDirectlyBefore = getSelectionText({
229
+ const previousInlineObject = getPreviousInlineObject(snapshot), blockStartPoint = getBlockStartPoint({
230
+ context: snapshot.context,
231
+ block: focusTextBlock
232
+ }), textDirectlyBefore = getSelectionText({
230
233
  context: {
231
234
  ...snapshot.context,
232
235
  selection: {
@@ -237,7 +240,10 @@ const getFocusBlock = (snapshot) => {
237
240
  focus: selectionStartPoint
238
241
  }
239
242
  }
240
- }).split(/\s+/).at(-1), nextInlineObject = getNextInlineObject(snapshot), blockEndPoint = getBlockEndPoint(focusTextBlock), textDirectlyAfter = getSelectionText({
243
+ }).split(/\s+/).at(-1), nextInlineObject = getNextInlineObject(snapshot), blockEndPoint = getBlockEndPoint({
244
+ context: snapshot.context,
245
+ block: focusTextBlock
246
+ }), textDirectlyAfter = getSelectionText({
241
247
  context: {
242
248
  ...snapshot.context,
243
249
  selection: {
@@ -258,11 +264,11 @@ const getFocusBlock = (snapshot) => {
258
264
  ...selectionStartOffset,
259
265
  offset: selectionStartOffset.offset + textDirectlyAfter.length
260
266
  } : selectionStartOffset, caretWordStartSelectionPoint = blockOffsetToSpanSelectionPoint({
261
- value: snapshot.context.value,
267
+ context: snapshot.context,
262
268
  blockOffset: caretWordStartOffset,
263
269
  direction: "backward"
264
270
  }), caretWordEndSelectionPoint = blockOffsetToSpanSelectionPoint({
265
- value: snapshot.context.value,
271
+ context: snapshot.context,
266
272
  blockOffset: caretWordEndOffset,
267
273
  direction: "forward"
268
274
  });
@@ -283,7 +289,10 @@ function isAtTheEndOfBlock(block) {
283
289
  return (snapshot) => {
284
290
  if (!snapshot.context.selection || !isSelectionCollapsed(snapshot))
285
291
  return !1;
286
- const blockEndPoint = getBlockEndPoint(block);
292
+ const blockEndPoint = getBlockEndPoint({
293
+ context: snapshot.context,
294
+ block
295
+ });
287
296
  return isEqualSelectionPoints(snapshot.context.selection.focus, blockEndPoint);
288
297
  };
289
298
  }
@@ -291,7 +300,10 @@ function isAtTheStartOfBlock(block) {
291
300
  return (snapshot) => {
292
301
  if (!snapshot.context.selection || !isSelectionCollapsed(snapshot))
293
302
  return !1;
294
- const blockStartPoint = getBlockStartPoint(block);
303
+ const blockStartPoint = getBlockStartPoint({
304
+ context: snapshot.context,
305
+ block
306
+ });
295
307
  return isEqualSelectionPoints(snapshot.context.selection.focus, blockStartPoint);
296
308
  };
297
309
  }
@@ -299,7 +311,7 @@ function isPointAfterSelection(point) {
299
311
  return (snapshot) => {
300
312
  if (!snapshot.context.selection)
301
313
  return !1;
302
- const selection = snapshot.context.selection.backward ? reverseSelection(snapshot.context.selection) : snapshot.context.selection, pointBlockKey = isKeySegment(point.path[0]) ? point.path[0]._key : void 0, pointChildKey = isKeySegment(point.path[2]) ? point.path[2]._key : void 0, endBlockKey = isKeySegment(selection.focus.path[0]) ? selection.focus.path[0]._key : void 0, endChildKey = isKeySegment(selection.focus.path[2]) ? selection.focus.path[2]._key : void 0;
314
+ const selection = snapshot.context.selection.backward ? reverseSelection(snapshot.context.selection) : snapshot.context.selection, pointBlockKey = isKeyedSegment(point.path[0]) ? point.path[0]._key : void 0, pointChildKey = isKeyedSegment(point.path[2]) ? point.path[2]._key : void 0, endBlockKey = isKeyedSegment(selection.focus.path[0]) ? selection.focus.path[0]._key : void 0, endChildKey = isKeyedSegment(selection.focus.path[2]) ? selection.focus.path[2]._key : void 0;
303
315
  if (!pointBlockKey || !endBlockKey)
304
316
  return !1;
305
317
  let after = !1;
@@ -309,7 +321,7 @@ function isPointAfterSelection(point) {
309
321
  after = !0;
310
322
  break;
311
323
  }
312
- if (!isPortableTextTextBlock(block) || !pointChildKey || !endChildKey)
324
+ if (!isTextBlock(snapshot.context, block) || !pointChildKey || !endChildKey)
313
325
  break;
314
326
  for (const child of block.children) {
315
327
  if (child._key === endChildKey) {
@@ -334,7 +346,7 @@ function isPointBeforeSelection(point) {
334
346
  return (snapshot) => {
335
347
  if (!snapshot.context.selection)
336
348
  return !1;
337
- const selection = snapshot.context.selection.backward ? reverseSelection(snapshot.context.selection) : snapshot.context.selection, pointBlockKey = isKeySegment(point.path[0]) ? point.path[0]._key : void 0, pointChildKey = isKeySegment(point.path[2]) ? point.path[2]._key : void 0, startBlockKey = isKeySegment(selection.anchor.path[0]) ? selection.anchor.path[0]._key : void 0, startChildKey = isKeySegment(selection.anchor.path[2]) ? selection.anchor.path[2]._key : void 0;
349
+ const selection = snapshot.context.selection.backward ? reverseSelection(snapshot.context.selection) : snapshot.context.selection, pointBlockKey = isKeyedSegment(point.path[0]) ? point.path[0]._key : void 0, pointChildKey = isKeyedSegment(point.path[2]) ? point.path[2]._key : void 0, startBlockKey = isKeyedSegment(selection.anchor.path[0]) ? selection.anchor.path[0]._key : void 0, startChildKey = isKeyedSegment(selection.anchor.path[2]) ? selection.anchor.path[2]._key : void 0;
338
350
  if (!pointBlockKey || !startBlockKey)
339
351
  return !1;
340
352
  let before = !1;
@@ -344,7 +356,7 @@ function isPointBeforeSelection(point) {
344
356
  before = !0;
345
357
  break;
346
358
  }
347
- if (!isPortableTextTextBlock(block) || !pointChildKey || !startChildKey)
359
+ if (!isTextBlock(snapshot.context, block) || !pointChildKey || !startChildKey)
348
360
  break;
349
361
  for (const child of block.children) {
350
362
  if (child._key === pointChildKey) {
@@ -423,7 +435,8 @@ function isOverlappingSelection(selection) {
423
435
  };
424
436
  }
425
437
  export {
426
- createGuards,
438
+ defineField,
439
+ defineType,
427
440
  getCaretWordSelection,
428
441
  getFirstBlock,
429
442
  getFocusBlock,
@@ -446,9 +459,11 @@ export {
446
459
  getSelectionText,
447
460
  isAtTheEndOfBlock,
448
461
  isAtTheStartOfBlock,
462
+ isKeySegment,
449
463
  isOverlappingSelection,
450
464
  isPointAfterSelection,
451
465
  isPointBeforeSelection,
466
+ isPortableTextSpan,
452
467
  isSelectionCollapsed,
453
468
  isSelectionExpanded
454
469
  };
@@ -1 +1 @@
1
- {"version":3,"file":"selector.is-overlapping-selection.js","sources":["../../src/selectors/selector.is-selection-collapsed.ts","../../src/behavior-actions/behavior.guards.ts","../../src/selectors/selectors.ts","../../src/selectors/selector.get-selection-end-point.ts","../../src/selectors/selector.get-selection-start-point.ts","../../src/selectors/selector.get-next-inline-object.ts","../../src/selectors/selector.get-previous-inline-object.ts","../../src/selectors/selector.get-selected-slice.ts","../../src/selectors/selector.get-selection-text.ts","../../src/selectors/selector.is-selection-expanded.ts","../../src/selectors/selector.get-caret-word-selection.ts","../../src/selectors/selector.is-at-the-end-of-block.ts","../../src/selectors/selector.is-at-the-start-of-block.ts","../../src/selectors/selector.is-point-after-selection.ts","../../src/selectors/selector.is-point-before-selection.ts","../../src/selectors/selector.is-overlapping-selection.ts"],"sourcesContent":["import type {EditorSelector} from '../editor/editor-selector'\n\n/**\n * @public\n */\nexport const isSelectionCollapsed: EditorSelector<boolean> = (snapshot) => {\n if (!snapshot.context.selection) {\n return false\n }\n\n return (\n JSON.stringify(snapshot.context.selection.anchor.path) ===\n JSON.stringify(snapshot.context.selection.focus.path) &&\n snapshot.context.selection?.anchor.offset ===\n snapshot.context.selection?.focus.offset\n )\n}\n","import {\n isPortableTextListBlock,\n isPortableTextTextBlock,\n type PortableTextListBlock,\n type PortableTextTextBlock,\n} from '@sanity/types'\nimport type {EditorSchema} from '../editor/editor-schema'\n\n/**\n * @alpha\n */\nexport type BehaviorGuards = ReturnType<typeof createGuards>\n\nexport function createGuards({schema}: {schema: EditorSchema}) {\n function isListBlock(block: unknown): block is PortableTextListBlock {\n return isPortableTextListBlock(block) && block._type === schema.block.name\n }\n\n function isTextBlock(block: unknown): block is PortableTextTextBlock {\n return isPortableTextTextBlock(block) && block._type === schema.block.name\n }\n\n return {isListBlock, isTextBlock}\n}\n","import {\n isKeySegment,\n isPortableTextSpan,\n isPortableTextTextBlock,\n type KeyedSegment,\n type PortableTextBlock,\n type PortableTextListBlock,\n type PortableTextObject,\n type PortableTextSpan,\n type PortableTextTextBlock,\n} from '@sanity/types'\nimport {createGuards} from '../behavior-actions/behavior.guards'\nimport type {EditorSelector} from '../editor/editor-selector'\n\n/**\n * @public\n */\nexport const getFocusBlock: EditorSelector<\n {node: PortableTextBlock; path: [KeyedSegment]} | undefined\n> = (snapshot) => {\n const key = snapshot.context.selection\n ? isKeySegment(snapshot.context.selection.focus.path[0])\n ? snapshot.context.selection.focus.path[0]._key\n : undefined\n : undefined\n\n const node = key\n ? snapshot.context.value.find((block) => block._key === key)\n : undefined\n\n return node && key ? {node, path: [{_key: key}]} : undefined\n}\n\n/**\n * @public\n */\nexport const getFocusListBlock: EditorSelector<\n {node: PortableTextListBlock; path: [KeyedSegment]} | undefined\n> = (snapshot) => {\n const guards = createGuards(snapshot.context)\n const focusBlock = getFocusBlock(snapshot)\n\n return focusBlock && guards.isListBlock(focusBlock.node)\n ? {node: focusBlock.node, path: focusBlock.path}\n : undefined\n}\n\n/**\n * @public\n */\nexport const getFocusTextBlock: EditorSelector<\n {node: PortableTextTextBlock; path: [KeyedSegment]} | undefined\n> = (snapshot) => {\n const focusBlock = getFocusBlock(snapshot)\n\n return focusBlock && isPortableTextTextBlock(focusBlock.node)\n ? {node: focusBlock.node, path: focusBlock.path}\n : undefined\n}\n\n/**\n * @public\n */\nexport const getFocusBlockObject: EditorSelector<\n {node: PortableTextObject; path: [KeyedSegment]} | undefined\n> = (snapshot) => {\n const focusBlock = getFocusBlock(snapshot)\n\n return focusBlock && !isPortableTextTextBlock(focusBlock.node)\n ? {node: focusBlock.node, path: focusBlock.path}\n : undefined\n}\n\n/**\n * @public\n */\nexport const getFocusChild: EditorSelector<\n | {\n node: PortableTextObject | PortableTextSpan\n path: [KeyedSegment, 'children', KeyedSegment]\n }\n | undefined\n> = (snapshot) => {\n const focusBlock = getFocusTextBlock(snapshot)\n\n if (!focusBlock) {\n return undefined\n }\n\n const key = snapshot.context.selection\n ? isKeySegment(snapshot.context.selection.focus.path[2])\n ? snapshot.context.selection.focus.path[2]._key\n : undefined\n : undefined\n\n const node = key\n ? focusBlock.node.children.find((span) => span._key === key)\n : undefined\n\n return node && key\n ? {node, path: [...focusBlock.path, 'children', {_key: key}]}\n : undefined\n}\n\n/**\n * @public\n */\nexport const getFocusSpan: EditorSelector<\n | {node: PortableTextSpan; path: [KeyedSegment, 'children', KeyedSegment]}\n | undefined\n> = (snapshot) => {\n const focusChild = getFocusChild(snapshot)\n\n return focusChild && isPortableTextSpan(focusChild.node)\n ? {node: focusChild.node, path: focusChild.path}\n : undefined\n}\n\n/**\n * @public\n */\nexport const getFirstBlock: EditorSelector<\n {node: PortableTextBlock; path: [KeyedSegment]} | undefined\n> = (snapshot) => {\n const node = snapshot.context.value[0]\n\n return node ? {node, path: [{_key: node._key}]} : undefined\n}\n\n/**\n * @public\n */\nexport const getLastBlock: EditorSelector<\n {node: PortableTextBlock; path: [KeyedSegment]} | undefined\n> = (snapshot) => {\n const node = snapshot.context.value[snapshot.context.value.length - 1]\n ? snapshot.context.value[snapshot.context.value.length - 1]\n : undefined\n\n return node ? {node, path: [{_key: node._key}]} : undefined\n}\n\n/**\n * @public\n */\nexport const getSelectedBlocks: EditorSelector<\n Array<{node: PortableTextBlock; path: [KeyedSegment]}>\n> = (snapshot) => {\n if (!snapshot.context.selection) {\n return []\n }\n\n const selectedBlocks: Array<{node: PortableTextBlock; path: [KeyedSegment]}> =\n []\n const startKey = snapshot.context.selection.backward\n ? isKeySegment(snapshot.context.selection.focus.path[0])\n ? snapshot.context.selection.focus.path[0]._key\n : undefined\n : isKeySegment(snapshot.context.selection.anchor.path[0])\n ? snapshot.context.selection.anchor.path[0]._key\n : undefined\n const endKey = snapshot.context.selection.backward\n ? isKeySegment(snapshot.context.selection.anchor.path[0])\n ? snapshot.context.selection.anchor.path[0]._key\n : undefined\n : isKeySegment(snapshot.context.selection.focus.path[0])\n ? snapshot.context.selection.focus.path[0]._key\n : undefined\n\n if (!startKey || !endKey) {\n return selectedBlocks\n }\n\n for (const block of snapshot.context.value) {\n if (block._key === startKey) {\n selectedBlocks.push({node: block, path: [{_key: block._key}]})\n\n if (startKey === endKey) {\n break\n }\n continue\n }\n\n if (block._key === endKey) {\n selectedBlocks.push({node: block, path: [{_key: block._key}]})\n break\n }\n\n if (selectedBlocks.length > 0) {\n selectedBlocks.push({node: block, path: [{_key: block._key}]})\n }\n }\n\n return selectedBlocks\n}\n\n/**\n * @public\n */\nexport const getSelectionStartBlock: EditorSelector<\n | {\n node: PortableTextBlock\n path: [KeyedSegment]\n }\n | undefined\n> = (snapshot) => {\n if (!snapshot.context.selection) {\n return undefined\n }\n\n const key = snapshot.context.selection.backward\n ? isKeySegment(snapshot.context.selection.focus.path[0])\n ? snapshot.context.selection.focus.path[0]._key\n : undefined\n : isKeySegment(snapshot.context.selection.anchor.path[0])\n ? snapshot.context.selection.anchor.path[0]._key\n : undefined\n\n const node = key\n ? snapshot.context.value.find((block) => block._key === key)\n : undefined\n\n return node && key ? {node, path: [{_key: key}]} : undefined\n}\n\n/**\n * @public\n */\nexport const getSelectionEndBlock: EditorSelector<\n | {\n node: PortableTextBlock\n path: [KeyedSegment]\n }\n | undefined\n> = (snapshot) => {\n if (!snapshot.context.selection) {\n return undefined\n }\n\n const key = snapshot.context.selection.backward\n ? isKeySegment(snapshot.context.selection.anchor.path[0])\n ? snapshot.context.selection.anchor.path[0]._key\n : undefined\n : isKeySegment(snapshot.context.selection.focus.path[0])\n ? snapshot.context.selection.focus.path[0]._key\n : undefined\n\n const node = key\n ? snapshot.context.value.find((block) => block._key === key)\n : undefined\n\n return node && key ? {node, path: [{_key: key}]} : undefined\n}\n\n/**\n * @public\n */\nexport const getPreviousBlock: EditorSelector<\n {node: PortableTextBlock; path: [KeyedSegment]} | undefined\n> = (snapshot) => {\n let previousBlock: {node: PortableTextBlock; path: [KeyedSegment]} | undefined\n const selectionStartBlock = getSelectionStartBlock(snapshot)\n\n if (!selectionStartBlock) {\n return undefined\n }\n\n let foundSelectionStartBlock = false\n\n for (const block of snapshot.context.value) {\n if (block._key === selectionStartBlock.node._key) {\n foundSelectionStartBlock = true\n break\n }\n\n previousBlock = {node: block, path: [{_key: block._key}]}\n }\n\n if (foundSelectionStartBlock && previousBlock) {\n return previousBlock\n }\n\n return undefined\n}\n\n/**\n * @public\n */\nexport const getNextBlock: EditorSelector<\n {node: PortableTextBlock; path: [KeyedSegment]} | undefined\n> = (snapshot) => {\n let nextBlock: {node: PortableTextBlock; path: [KeyedSegment]} | undefined\n const selectionEndBlock = getSelectionEndBlock(snapshot)\n\n if (!selectionEndBlock) {\n return undefined\n }\n\n let foundSelectionEndBlock = false\n\n for (const block of snapshot.context.value) {\n if (block._key === selectionEndBlock.node._key) {\n foundSelectionEndBlock = true\n continue\n }\n\n if (foundSelectionEndBlock) {\n nextBlock = {node: block, path: [{_key: block._key}]}\n break\n }\n }\n\n if (foundSelectionEndBlock && nextBlock) {\n return nextBlock\n }\n\n return undefined\n}\n","import type {EditorSelectionPoint} from '..'\nimport type {EditorSelector} from '../editor/editor-selector'\n\n/**\n * @public\n */\nexport const getSelectionEndPoint: EditorSelector<\n EditorSelectionPoint | undefined\n> = (snapshot) => {\n if (!snapshot.context.selection) {\n return undefined\n }\n\n return snapshot.context.selection.backward\n ? snapshot.context.selection.anchor\n : snapshot.context.selection.focus\n}\n","import type {EditorSelectionPoint} from '..'\nimport type {EditorSelector} from '../editor/editor-selector'\n\n/**\n * @public\n */\nexport const getSelectionStartPoint: EditorSelector<\n EditorSelectionPoint | undefined\n> = (snapshot) => {\n if (!snapshot.context.selection) {\n return undefined\n }\n\n return snapshot.context.selection.backward\n ? snapshot.context.selection.focus\n : snapshot.context.selection.anchor\n}\n","import {\n isKeySegment,\n type KeyedSegment,\n type PortableTextObject,\n} from '@sanity/types'\nimport type {EditorSelector} from '../editor/editor-selector'\nimport {isSpan} from '../utils'\nimport {getSelectionEndPoint} from './selector.get-selection-end-point'\nimport {getFocusTextBlock} from './selectors'\n\n/**\n * @public\n */\nexport const getNextInlineObject: EditorSelector<\n | {\n node: PortableTextObject\n path: [KeyedSegment, 'children', KeyedSegment]\n }\n | undefined\n> = (snapshot) => {\n const focusTextBlock = getFocusTextBlock(snapshot)\n const selectionEndPoint = getSelectionEndPoint(snapshot)\n const selectionEndPointChildKey =\n selectionEndPoint && isKeySegment(selectionEndPoint.path[2])\n ? selectionEndPoint.path[2]._key\n : undefined\n\n if (!focusTextBlock || !selectionEndPointChildKey) {\n return undefined\n }\n\n let endPointChildFound = false\n let inlineObject:\n | {\n node: PortableTextObject\n path: [KeyedSegment, 'children', KeyedSegment]\n }\n | undefined\n\n for (const child of focusTextBlock.node.children) {\n if (child._key === selectionEndPointChildKey) {\n endPointChildFound = true\n continue\n }\n\n if (!isSpan(snapshot.context, child) && endPointChildFound) {\n inlineObject = {\n node: child,\n path: [...focusTextBlock.path, 'children', {_key: child._key}],\n }\n break\n }\n }\n\n return inlineObject\n}\n","import {\n isKeySegment,\n type KeyedSegment,\n type PortableTextObject,\n} from '@sanity/types'\nimport type {EditorSelector} from '../editor/editor-selector'\nimport {isSpan} from '../utils'\nimport {getSelectionStartPoint} from './selector.get-selection-start-point'\nimport {getFocusTextBlock} from './selectors'\n\n/**\n * @public\n */\nexport const getPreviousInlineObject: EditorSelector<\n | {\n node: PortableTextObject\n path: [KeyedSegment, 'children', KeyedSegment]\n }\n | undefined\n> = (snapshot) => {\n const focusTextBlock = getFocusTextBlock(snapshot)\n const selectionStartPoint = getSelectionStartPoint(snapshot)\n const selectionStartPointChildKey =\n selectionStartPoint && isKeySegment(selectionStartPoint.path[2])\n ? selectionStartPoint.path[2]._key\n : undefined\n\n if (!focusTextBlock || !selectionStartPointChildKey) {\n return undefined\n }\n\n let inlineObject:\n | {\n node: PortableTextObject\n path: [KeyedSegment, 'children', KeyedSegment]\n }\n | undefined\n\n for (const child of focusTextBlock.node.children) {\n if (child._key === selectionStartPointChildKey) {\n break\n }\n\n if (!isSpan(snapshot.context, child)) {\n inlineObject = {\n node: child,\n path: [...focusTextBlock.path, 'children', {_key: child._key}],\n }\n }\n }\n\n return inlineObject\n}\n","import type {PortableTextBlock} from '@sanity/types'\nimport type {EditorSelector} from '../editor/editor-selector'\nimport {sliceBlocks} from '../utils'\n\n/**\n * @public\n */\nexport const getSelectedSlice: EditorSelector<Array<PortableTextBlock>> = (\n snapshot,\n) => {\n return sliceBlocks({\n blocks: snapshot.context.value,\n selection: snapshot.context.selection,\n })\n}\n","import {isPortableTextSpan, isPortableTextTextBlock} from '@sanity/types'\nimport type {EditorSelector} from '../editor/editor-selector'\nimport {getSelectedSlice} from './selector.get-selected-slice'\n\n/**\n * @public\n */\nexport const getSelectionText: EditorSelector<string> = (snapshot) => {\n const selectedSlice = getSelectedSlice(snapshot)\n\n return selectedSlice.reduce((text, block) => {\n if (!isPortableTextTextBlock(block)) {\n return text\n }\n\n return (\n text +\n block.children.reduce((text, child) => {\n if (isPortableTextSpan(child)) {\n return text + child.text\n }\n\n return text\n }, '')\n )\n }, '')\n}\n","import type {EditorSelector} from '../editor/editor-selector'\nimport {isSelectionCollapsed} from './selector.is-selection-collapsed'\n\n/**\n * @public\n */\nexport const isSelectionExpanded: EditorSelector<boolean> = (snapshot) => {\n return !isSelectionCollapsed(snapshot)\n}\n","import type {EditorSelector} from '../editor/editor-selector'\nimport type {BlockOffset} from '../types/block-offset'\nimport type {EditorSelection} from '../types/editor'\nimport {\n blockOffsetToSpanSelectionPoint,\n getBlockEndPoint,\n getBlockStartPoint,\n spanSelectionPointToBlockOffset,\n} from '../utils'\nimport {getNextInlineObject} from './selector.get-next-inline-object'\nimport {getPreviousInlineObject} from './selector.get-previous-inline-object'\nimport {getSelectionStartPoint} from './selector.get-selection-start-point'\nimport {getSelectionText} from './selector.get-selection-text'\nimport {isSelectionCollapsed} from './selector.is-selection-collapsed'\nimport {isSelectionExpanded} from './selector.is-selection-expanded'\nimport {getFocusTextBlock} from './selectors'\n\n/**\n * @public\n * Returns the selection of the of the word the caret is placed in.\n * Note: Only returns a word selection if the current selection is collapsed\n */\nexport const getCaretWordSelection: EditorSelector<EditorSelection> = (\n snapshot,\n) => {\n if (!snapshot.context.selection) {\n return null\n }\n\n if (!isSelectionCollapsed(snapshot)) {\n return null\n }\n\n const focusTextBlock = getFocusTextBlock(snapshot)\n const selectionStartPoint = getSelectionStartPoint(snapshot)\n const selectionStartOffset = selectionStartPoint\n ? spanSelectionPointToBlockOffset({\n value: snapshot.context.value,\n selectionPoint: selectionStartPoint,\n })\n : undefined\n\n if (!focusTextBlock || !selectionStartPoint || !selectionStartOffset) {\n return null\n }\n\n const previousInlineObject = getPreviousInlineObject(snapshot)\n const blockStartPoint = getBlockStartPoint(focusTextBlock)\n const textBefore = getSelectionText({\n ...snapshot,\n context: {\n ...snapshot.context,\n selection: {\n anchor: previousInlineObject\n ? {path: previousInlineObject.path, offset: 0}\n : blockStartPoint,\n focus: selectionStartPoint,\n },\n },\n })\n const textDirectlyBefore = textBefore.split(/\\s+/).at(-1)\n\n const nextInlineObject = getNextInlineObject(snapshot)\n const blockEndPoint = getBlockEndPoint(focusTextBlock)\n const textAfter = getSelectionText({\n ...snapshot,\n context: {\n ...snapshot.context,\n selection: {\n anchor: selectionStartPoint,\n focus: nextInlineObject\n ? {path: nextInlineObject.path, offset: 0}\n : blockEndPoint,\n },\n },\n })\n const textDirectlyAfter = textAfter.split(/\\s+/).at(0)\n\n if (\n (textDirectlyBefore === undefined || textDirectlyBefore === '') &&\n (textDirectlyAfter === undefined || textDirectlyAfter === '')\n ) {\n return null\n }\n\n const caretWordStartOffset: BlockOffset = textDirectlyBefore\n ? {\n ...selectionStartOffset,\n offset: selectionStartOffset.offset - textDirectlyBefore.length,\n }\n : selectionStartOffset\n const caretWordEndOffset: BlockOffset = textDirectlyAfter\n ? {\n ...selectionStartOffset,\n offset: selectionStartOffset.offset + textDirectlyAfter.length,\n }\n : selectionStartOffset\n\n const caretWordStartSelectionPoint = blockOffsetToSpanSelectionPoint({\n value: snapshot.context.value,\n blockOffset: caretWordStartOffset,\n direction: 'backward',\n })\n const caretWordEndSelectionPoint = blockOffsetToSpanSelectionPoint({\n value: snapshot.context.value,\n blockOffset: caretWordEndOffset,\n direction: 'forward',\n })\n\n if (!caretWordStartSelectionPoint || !caretWordEndSelectionPoint) {\n return null\n }\n\n const caretWordSelection = {\n anchor: caretWordStartSelectionPoint,\n focus: caretWordEndSelectionPoint,\n }\n\n return isSelectionExpanded({\n ...snapshot,\n context: {\n ...snapshot.context,\n selection: caretWordSelection,\n },\n })\n ? caretWordSelection\n : null\n}\n","import type {KeyedSegment, PortableTextBlock} from '@sanity/types'\nimport type {EditorSelector} from '../editor/editor-selector'\nimport * as utils from '../utils'\nimport {isSelectionCollapsed} from './selector.is-selection-collapsed'\n\n/**\n * @public\n */\nexport function isAtTheEndOfBlock(block: {\n node: PortableTextBlock\n path: [KeyedSegment]\n}): EditorSelector<boolean> {\n return (snapshot) => {\n if (!snapshot.context.selection || !isSelectionCollapsed(snapshot)) {\n return false\n }\n\n const blockEndPoint = utils.getBlockEndPoint(block)\n\n return utils.isEqualSelectionPoints(\n snapshot.context.selection.focus,\n blockEndPoint,\n )\n }\n}\n","import type {KeyedSegment, PortableTextBlock} from '@sanity/types'\nimport type {EditorSelector} from '../editor/editor-selector'\nimport * as utils from '../utils'\nimport {isSelectionCollapsed} from './selector.is-selection-collapsed'\n\n/**\n * @public\n */\nexport function isAtTheStartOfBlock(block: {\n node: PortableTextBlock\n path: [KeyedSegment]\n}): EditorSelector<boolean> {\n return (snapshot) => {\n if (!snapshot.context.selection || !isSelectionCollapsed(snapshot)) {\n return false\n }\n\n const blockStartPoint = utils.getBlockStartPoint(block)\n\n return utils.isEqualSelectionPoints(\n snapshot.context.selection.focus,\n blockStartPoint,\n )\n }\n}\n","import {isKeySegment, isPortableTextTextBlock} from '@sanity/types'\nimport type {EditorSelector} from '../editor/editor-selector'\nimport type {EditorSelectionPoint} from '../types/editor'\nimport {reverseSelection} from '../utils/util.reverse-selection'\n\n/**\n * @public\n */\nexport function isPointAfterSelection(\n point: EditorSelectionPoint,\n): EditorSelector<boolean> {\n return (snapshot) => {\n if (!snapshot.context.selection) {\n return false\n }\n\n const selection = snapshot.context.selection.backward\n ? reverseSelection(snapshot.context.selection)\n : snapshot.context.selection\n\n const pointBlockKey = isKeySegment(point.path[0])\n ? point.path[0]._key\n : undefined\n const pointChildKey = isKeySegment(point.path[2])\n ? point.path[2]._key\n : undefined\n\n const endBlockKey = isKeySegment(selection.focus.path[0])\n ? selection.focus.path[0]._key\n : undefined\n const endChildKey = isKeySegment(selection.focus.path[2])\n ? selection.focus.path[2]._key\n : undefined\n\n if (!pointBlockKey || !endBlockKey) {\n return false\n }\n\n let after = false\n\n for (const block of snapshot.context.value) {\n if (block._key === endBlockKey) {\n if (block._key !== pointBlockKey) {\n after = true\n break\n }\n\n // Both the point and the selection end in this block\n\n if (!isPortableTextTextBlock(block)) {\n break\n }\n\n if (!pointChildKey || !endChildKey) {\n break\n }\n\n for (const child of block.children) {\n if (child._key === endChildKey) {\n if (child._key !== pointChildKey) {\n after = true\n break\n }\n\n // Both the point and the selection end in this child\n\n after = point.offset > selection.focus.offset\n break\n }\n\n if (child._key === pointChildKey) {\n break\n }\n }\n }\n\n if (block._key === pointBlockKey) {\n break\n }\n }\n\n return after\n }\n}\n","import {isKeySegment, isPortableTextTextBlock} from '@sanity/types'\nimport type {EditorSelector} from '../editor/editor-selector'\nimport type {EditorSelectionPoint} from '../types/editor'\nimport {reverseSelection} from '../utils/util.reverse-selection'\n\n/**\n * @public\n */\nexport function isPointBeforeSelection(\n point: EditorSelectionPoint,\n): EditorSelector<boolean> {\n return (snapshot) => {\n if (!snapshot.context.selection) {\n return false\n }\n\n const selection = snapshot.context.selection.backward\n ? reverseSelection(snapshot.context.selection)\n : snapshot.context.selection\n\n const pointBlockKey = isKeySegment(point.path[0])\n ? point.path[0]._key\n : undefined\n const pointChildKey = isKeySegment(point.path[2])\n ? point.path[2]._key\n : undefined\n\n const startBlockKey = isKeySegment(selection.anchor.path[0])\n ? selection.anchor.path[0]._key\n : undefined\n const startChildKey = isKeySegment(selection.anchor.path[2])\n ? selection.anchor.path[2]._key\n : undefined\n\n if (!pointBlockKey || !startBlockKey) {\n return false\n }\n\n let before = false\n\n for (const block of snapshot.context.value) {\n if (block._key === pointBlockKey) {\n if (block._key !== startBlockKey) {\n before = true\n break\n }\n\n // Both the point and the selection start in this block\n\n if (!isPortableTextTextBlock(block)) {\n break\n }\n\n if (!pointChildKey || !startChildKey) {\n break\n }\n\n for (const child of block.children) {\n if (child._key === pointChildKey) {\n if (child._key !== startChildKey) {\n before = true\n break\n }\n\n // Both the point and the selection start in this child\n\n before = point.offset < selection.anchor.offset\n break\n }\n\n if (child._key === startChildKey) {\n break\n }\n }\n }\n\n if (block._key === startBlockKey) {\n break\n }\n }\n\n return before\n }\n}\n","import type {EditorSelection} from '../types/editor'\nimport {isEqualSelectionPoints} from '../utils'\nimport type {EditorSelector} from './../editor/editor-selector'\nimport {getSelectionEndPoint} from './selector.get-selection-end-point'\nimport {getSelectionStartPoint} from './selector.get-selection-start-point'\nimport {isPointAfterSelection} from './selector.is-point-after-selection'\nimport {isPointBeforeSelection} from './selector.is-point-before-selection'\n\n/**\n * @public\n */\nexport function isOverlappingSelection(\n selection: EditorSelection,\n): EditorSelector<boolean> {\n return (snapshot) => {\n if (!selection || !snapshot.context.selection) {\n return false\n }\n\n const selectionStartPoint = getSelectionStartPoint({\n ...snapshot,\n context: {\n ...snapshot.context,\n selection,\n },\n })\n const selectionEndPoint = getSelectionEndPoint({\n ...snapshot,\n context: {\n ...snapshot.context,\n selection,\n },\n })\n\n const originalSelectionStartPoint = getSelectionStartPoint(snapshot)\n const originalSelectionEndPoint = getSelectionEndPoint(snapshot)\n\n if (\n !selectionStartPoint ||\n !selectionEndPoint ||\n !originalSelectionStartPoint ||\n !originalSelectionEndPoint\n ) {\n return false\n }\n\n const startPointBeforeSelection =\n isPointBeforeSelection(selectionStartPoint)(snapshot)\n const startPointAfterSelection =\n isPointAfterSelection(selectionStartPoint)(snapshot)\n const endPointBeforeSelection =\n isPointBeforeSelection(selectionEndPoint)(snapshot)\n const endPointAfterSelection =\n isPointAfterSelection(selectionEndPoint)(snapshot)\n\n const originalStartPointBeforeStartPoint = isPointBeforeSelection(\n originalSelectionStartPoint,\n )({\n ...snapshot,\n context: {\n ...snapshot.context,\n selection: {\n anchor: selectionStartPoint,\n focus: selectionStartPoint,\n },\n },\n })\n const originalStartPointAfterStartPoint = isPointAfterSelection(\n originalSelectionStartPoint,\n )({\n ...snapshot,\n context: {\n ...snapshot.context,\n selection: {\n anchor: selectionStartPoint,\n focus: selectionStartPoint,\n },\n },\n })\n\n const originalEndPointBeforeEndPoint = isPointBeforeSelection(\n originalSelectionEndPoint,\n )({\n ...snapshot,\n context: {\n ...snapshot.context,\n selection: {\n anchor: selectionEndPoint,\n focus: selectionEndPoint,\n },\n },\n })\n const originalEndPointAfterEndPoint = isPointAfterSelection(\n originalSelectionEndPoint,\n )({\n ...snapshot,\n context: {\n ...snapshot.context,\n selection: {\n anchor: selectionEndPoint,\n focus: selectionEndPoint,\n },\n },\n })\n\n const endPointEqualToOriginalStartPoint = isEqualSelectionPoints(\n selectionEndPoint,\n originalSelectionStartPoint,\n )\n const startPointEqualToOriginalEndPoint = isEqualSelectionPoints(\n selectionStartPoint,\n originalSelectionEndPoint,\n )\n\n if (endPointBeforeSelection && !endPointEqualToOriginalStartPoint) {\n return false\n }\n\n if (startPointAfterSelection && !startPointEqualToOriginalEndPoint) {\n return false\n }\n\n if (\n !originalStartPointBeforeStartPoint &&\n originalStartPointAfterStartPoint &&\n !originalEndPointBeforeEndPoint &&\n originalEndPointAfterEndPoint\n ) {\n return !endPointEqualToOriginalStartPoint\n }\n\n if (\n originalStartPointBeforeStartPoint &&\n !originalStartPointAfterStartPoint &&\n originalEndPointBeforeEndPoint &&\n !originalEndPointAfterEndPoint\n ) {\n return !startPointEqualToOriginalEndPoint\n }\n\n if (\n !startPointAfterSelection ||\n !startPointBeforeSelection ||\n !endPointAfterSelection ||\n !endPointBeforeSelection\n ) {\n return true\n }\n\n return false\n }\n}\n"],"names":["isSelectionCollapsed","snapshot","context","selection","JSON","stringify","anchor","path","focus","offset","createGuards","schema","isListBlock","block","isPortableTextListBlock","_type","name","isTextBlock","isPortableTextTextBlock","getFocusBlock","key","isKeySegment","_key","undefined","node","value","find","getFocusListBlock","guards","focusBlock","getFocusTextBlock","getFocusBlockObject","getFocusChild","children","span","getFocusSpan","focusChild","isPortableTextSpan","getFirstBlock","getLastBlock","length","getSelectedBlocks","selectedBlocks","startKey","backward","endKey","push","getSelectionStartBlock","getSelectionEndBlock","getPreviousBlock","previousBlock","selectionStartBlock","foundSelectionStartBlock","getNextBlock","nextBlock","selectionEndBlock","foundSelectionEndBlock","getSelectionEndPoint","getSelectionStartPoint","getNextInlineObject","focusTextBlock","selectionEndPoint","selectionEndPointChildKey","endPointChildFound","inlineObject","child","isSpan","getPreviousInlineObject","selectionStartPoint","selectionStartPointChildKey","getSelectedSlice","sliceBlocks","blocks","getSelectionText","reduce","text","isSelectionExpanded","getCaretWordSelection","selectionStartOffset","spanSelectionPointToBlockOffset","selectionPoint","previousInlineObject","blockStartPoint","getBlockStartPoint","textDirectlyBefore","split","at","nextInlineObject","blockEndPoint","getBlockEndPoint","textDirectlyAfter","caretWordStartOffset","caretWordEndOffset","caretWordStartSelectionPoint","blockOffsetToSpanSelectionPoint","blockOffset","direction","caretWordEndSelectionPoint","caretWordSelection","isAtTheEndOfBlock","utils","isAtTheStartOfBlock","isPointAfterSelection","point","reverseSelection","pointBlockKey","pointChildKey","endBlockKey","endChildKey","after","isPointBeforeSelection","startBlockKey","startChildKey","before","isOverlappingSelection","originalSelectionStartPoint","originalSelectionEndPoint","startPointBeforeSelection","startPointAfterSelection","endPointBeforeSelection","endPointAfterSelection","originalStartPointBeforeStartPoint","originalStartPointAfterStartPoint","originalEndPointBeforeEndPoint","originalEndPointAfterEndPoint","endPointEqualToOriginalStartPoint","isEqualSelectionPoints","startPointEqualToOriginalEndPoint"],"mappings":";;AAKO,MAAMA,uBAAiDC,CAAAA,aACvDA,SAASC,QAAQC,YAKpBC,KAAKC,UAAUJ,SAASC,QAAQC,UAAUG,OAAOC,IAAI,MACnDH,KAAKC,UAAUJ,SAASC,QAAQC,UAAUK,MAAMD,IAAI,KACtDN,SAASC,QAAQC,WAAWG,OAAO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AACD;AAAAA,EAML;AACF;"}
1
+ {"version":3,"file":"selector.is-overlapping-selection.js","sources":["../../../../node_modules/.pnpm/@sanity+types@3.87.0_@types+react@19.1.2_debug@4.4.0/node_modules/@sanity/types/lib/index.mjs","../../src/selectors/selector.is-selection-collapsed.ts","../../src/selectors/selectors.ts","../../src/selectors/selector.get-selection-end-point.ts","../../src/selectors/selector.get-selection-start-point.ts","../../src/selectors/selector.get-next-inline-object.ts","../../src/selectors/selector.get-previous-inline-object.ts","../../src/selectors/selector.get-selected-slice.ts","../../src/selectors/selector.get-selection-text.ts","../../src/selectors/selector.is-selection-expanded.ts","../../src/selectors/selector.get-caret-word-selection.ts","../../src/selectors/selector.is-at-the-end-of-block.ts","../../src/selectors/selector.is-at-the-start-of-block.ts","../../src/selectors/selector.is-point-after-selection.ts","../../src/selectors/selector.is-point-before-selection.ts","../../src/selectors/selector.is-overlapping-selection.ts"],"sourcesContent":["function isObject(obj) {\n return typeof obj == \"object\" && obj !== null && !Array.isArray(obj);\n}\nfunction isReference(reference) {\n return isObject(reference) && typeof reference._ref == \"string\";\n}\nfunction isImage(value) {\n return isObject(value) && isReference(value.asset) && value.asset._ref.startsWith(\"image-\");\n}\nfunction isCrossDatasetReference(reference) {\n return isObject(reference) && typeof reference._ref == \"string\" && typeof reference._dataset == \"string\" && typeof reference._projectId == \"string\";\n}\nfunction isSanityDocument(document) {\n return isObject(document) && typeof document._id == \"string\" && typeof document._type == \"string\";\n}\nfunction isTypedObject(obj) {\n return isObject(obj) && typeof obj._type == \"string\";\n}\nfunction isKeyedObject(obj) {\n return isObject(obj) && typeof obj._key == \"string\";\n}\nfunction isGlobalDocumentReference(reference) {\n return !isObject(reference) || typeof reference._ref != \"string\" ? !1 : reference._ref.split(\":\").length === 3;\n}\nfunction isValidationErrorMarker(marker) {\n return marker.level === \"error\";\n}\nfunction isValidationWarningMarker(marker) {\n return marker.level === \"warning\";\n}\nfunction isValidationInfoMarker(marker) {\n return marker.level === \"info\";\n}\nconst MEDIA_LIBRARY_ASSET_ASPECT_TYPE_NAME = \"sanity.asset.aspect\";\nfunction isAssetAspect(maybeAssetAspect) {\n return typeof maybeAssetAspect == \"object\" && maybeAssetAspect !== null && \"_type\" in maybeAssetAspect && maybeAssetAspect._type === MEDIA_LIBRARY_ASSET_ASPECT_TYPE_NAME;\n}\nfunction defineAssetAspect(definition) {\n const { assetType, name } = definition;\n return {\n _type: MEDIA_LIBRARY_ASSET_ASPECT_TYPE_NAME,\n _id: `${name}`,\n definition,\n ...assetType && {\n assetType: Array.isArray(assetType) ? assetType : [assetType]\n }\n };\n}\nfunction isCreateMutation(mutation) {\n return \"create\" in mutation;\n}\nfunction isCreateIfNotExistsMutation(mutation) {\n return \"createIfNotExists\" in mutation;\n}\nfunction isCreateOrReplaceMutation(mutation) {\n return \"createOrReplace\" in mutation;\n}\nfunction isDeleteMutation(mutation) {\n return \"delete\" in mutation;\n}\nfunction isPatchMutation(mutation) {\n return \"patch\" in mutation;\n}\nconst reKeySegment = /_key\\s*==\\s*['\"](.*)['\"]/, reIndexTuple = /^\\d*:\\d*$/;\nfunction isIndexSegment(segment) {\n return typeof segment == \"number\" || typeof segment == \"string\" && /^\\[\\d+\\]$/.test(segment);\n}\nfunction isKeySegment(segment) {\n return typeof segment == \"string\" ? reKeySegment.test(segment.trim()) : typeof segment == \"object\" && \"_key\" in segment;\n}\nfunction isIndexTuple(segment) {\n if (typeof segment == \"string\" && reIndexTuple.test(segment))\n return !0;\n if (!Array.isArray(segment) || segment.length !== 2)\n return !1;\n const [from, to] = segment;\n return (typeof from == \"number\" || from === \"\") && (typeof to == \"number\" || to === \"\");\n}\nfunction isRecord$1(value) {\n return !!value && (typeof value == \"object\" || typeof value == \"function\");\n}\nfunction isPortableTextTextBlock(value) {\n return isRecord$1(value) && typeof value._type == \"string\" && // block types can be named, so expect anything here.\n Array.isArray(value.children) && value.children.every((child) => isRecord$1(child)) && (\"markDefs\" in value ? Array.isArray(value.markDefs) && value.markDefs.every((def) => isRecord$1(def)) : !0) && (\"style\" in value ? typeof value.style == \"string\" : !0);\n}\nfunction isPortableTextSpan(value) {\n return isRecord$1(value) && value._type === \"span\" && typeof value.text == \"string\" && (\"marks\" in value ? Array.isArray(value.marks) && value.marks.every((mark) => typeof mark == \"string\") : !0);\n}\nfunction isPortableTextListBlock(value) {\n return isPortableTextTextBlock(value) && \"listItem\" in value && typeof value.listItem == \"string\" && \"level\" in value && Number.isInteger(value.level);\n}\nfunction isRecord(value) {\n return !!value && (typeof value == \"object\" || typeof value == \"function\");\n}\nfunction isDocumentSchemaType(type) {\n if (!isObjectSchemaType(type))\n return !1;\n let current = type;\n for (; current; ) {\n if (current.name === \"document\")\n return !0;\n current = current.type;\n }\n return !1;\n}\nfunction isObjectSchemaType(type) {\n return isRecord(type) ? type.jsonType === \"object\" : !1;\n}\nfunction isArraySchemaType(type) {\n return isRecord(type) ? type.jsonType === \"array\" : !1;\n}\nfunction isArrayOfBlocksSchemaType(type) {\n return isArraySchemaType(type) && type.of.some((memberType) => isBlockSchemaType(memberType));\n}\nfunction isArrayOfObjectsSchemaType(type) {\n return isArraySchemaType(type) && type.of.every((memberType) => isObjectSchemaType(memberType));\n}\nfunction isArrayOfPrimitivesSchemaType(type) {\n return isArraySchemaType(type) && type.of.every((memberType) => isPrimitiveSchemaType(memberType));\n}\nfunction isBooleanSchemaType(type) {\n return isRecord(type) ? type.jsonType === \"boolean\" : !1;\n}\nfunction isStringSchemaType(type) {\n return isRecord(type) ? type.jsonType === \"string\" : !1;\n}\nfunction isNumberSchemaType(type) {\n return isRecord(type) ? type.jsonType === \"number\" : !1;\n}\nfunction isPrimitiveSchemaType(type) {\n return isBooleanSchemaType(type) || isStringSchemaType(type) || isNumberSchemaType(type);\n}\nfunction isReferenceSchemaType(type) {\n return isRecord(type) && (type.name === \"reference\" || isReferenceSchemaType(type.type));\n}\nfunction isImageSchemaType(type) {\n return isRecord(type) && (type.name === \"image\" || isImageSchemaType(type.type));\n}\nfunction isFileSchemaType(type) {\n return isRecord(type) && (type.name === \"file\" || isFileSchemaType(type.type));\n}\nfunction isDeprecatedSchemaType(type) {\n return isRecord(type) ? typeof type.deprecated < \"u\" : !1;\n}\nfunction isDeprecationConfiguration(type) {\n return isRecord(type) ? typeof type.deprecated < \"u\" : !1;\n}\nfunction isCrossDatasetReferenceSchemaType(type) {\n return isRecord(type) && (type.name === \"crossDatasetReference\" || isCrossDatasetReferenceSchemaType(type.type));\n}\nfunction isTitledListValue(item) {\n return typeof item == \"object\" && item !== null && \"title\" in item && \"value\" in item;\n}\nfunction isSpanSchemaType(type) {\n return isRecord(type) ? Array.isArray(type.annotations) && Array.isArray(type.decorators) : !1;\n}\nfunction isBlockSchemaType(type) {\n if (!isRecord(type) || !Array.isArray(type.fields)) return !1;\n const maybeSpanChildren = type.fields.find(isBlockChildrenObjectField), maybeStyle = type.fields.find(isBlockStyleObjectField), maybeList = type.fields.find(isBlockListObjectField);\n return isBlockChildrenObjectField(maybeSpanChildren) && isBlockStyleObjectField(maybeStyle) && isBlockListObjectField(maybeList);\n}\nfunction isBlockStyleObjectField(field) {\n return !isRecord(field) || field.name !== \"style\" ? !1 : isRecord(field.type) && field.type.jsonType === \"string\";\n}\nfunction isBlockListObjectField(field) {\n return !isRecord(field) || field.name !== \"listItem\" ? !1 : isRecord(field.type) && field.type.jsonType === \"string\";\n}\nfunction isBlockChildrenObjectField(field) {\n return !isRecord(field) || field.name !== \"children\" || !isArraySchemaType(field.type) ? !1 : field.type.of.some(isSpanSchemaType);\n}\nfunction defineType(schemaDefinition, defineOptions) {\n return schemaDefinition;\n}\nfunction defineField(schemaField, defineOptions) {\n return schemaField;\n}\nfunction defineArrayMember(arrayOfSchema, defineOptions) {\n return arrayOfSchema;\n}\nfunction typed(input) {\n return input;\n}\nconst searchStrategies = [\"groqLegacy\", \"groq2024\"];\nfunction isSearchStrategy(maybeSearchStrategy) {\n return searchStrategies.includes(maybeSearchStrategy);\n}\nfunction isSlug(thing) {\n return isObject(thing) && typeof thing.current == \"string\";\n}\nfunction isCreateSquashedMutation(mutation) {\n return \"createSquashed\" in mutation;\n}\nfunction isValidationError(node) {\n return node.level === \"error\";\n}\nfunction isValidationWarning(node) {\n return node.level === \"warning\";\n}\nfunction isValidationInfo(node) {\n return node.level === \"info\";\n}\nexport {\n MEDIA_LIBRARY_ASSET_ASPECT_TYPE_NAME,\n defineArrayMember,\n defineAssetAspect,\n defineField,\n defineType,\n isArrayOfBlocksSchemaType,\n isArrayOfObjectsSchemaType,\n isArrayOfPrimitivesSchemaType,\n isArraySchemaType,\n isAssetAspect,\n isBlockChildrenObjectField,\n isBlockListObjectField,\n isBlockSchemaType,\n isBlockStyleObjectField,\n isBooleanSchemaType,\n isCreateIfNotExistsMutation,\n isCreateMutation,\n isCreateOrReplaceMutation,\n isCreateSquashedMutation,\n isCrossDatasetReference,\n isCrossDatasetReferenceSchemaType,\n isDeleteMutation,\n isDeprecatedSchemaType,\n isDeprecationConfiguration,\n isDocumentSchemaType,\n isFileSchemaType,\n isGlobalDocumentReference,\n isImage,\n isImageSchemaType,\n isIndexSegment,\n isIndexTuple,\n isKeySegment,\n isKeyedObject,\n isNumberSchemaType,\n isObjectSchemaType,\n isPatchMutation,\n isPortableTextListBlock,\n isPortableTextSpan,\n isPortableTextTextBlock,\n isPrimitiveSchemaType,\n isReference,\n isReferenceSchemaType,\n isSanityDocument,\n isSearchStrategy,\n isSlug,\n isSpanSchemaType,\n isStringSchemaType,\n isTitledListValue,\n isTypedObject,\n isValidationError,\n isValidationErrorMarker,\n isValidationInfo,\n isValidationInfoMarker,\n isValidationWarning,\n isValidationWarningMarker,\n searchStrategies,\n typed\n};\n//# sourceMappingURL=index.mjs.map\n","import type {EditorSelector} from '../editor/editor-selector'\n\n/**\n * @public\n */\nexport const isSelectionCollapsed: EditorSelector<boolean> = (snapshot) => {\n if (!snapshot.context.selection) {\n return false\n }\n\n return (\n JSON.stringify(snapshot.context.selection.anchor.path) ===\n JSON.stringify(snapshot.context.selection.focus.path) &&\n snapshot.context.selection?.anchor.offset ===\n snapshot.context.selection?.focus.offset\n )\n}\n","import type {\n KeyedSegment,\n PortableTextBlock,\n PortableTextListBlock,\n PortableTextObject,\n PortableTextSpan,\n PortableTextTextBlock,\n} from '@sanity/types'\nimport type {EditorSelector} from '../editor/editor-selector'\nimport {isListBlock, isSpan, isTextBlock} from '../internal-utils/parse-blocks'\nimport {isKeyedSegment} from '../utils/util.is-keyed-segment'\n\n/**\n * @public\n */\nexport const getFocusBlock: EditorSelector<\n {node: PortableTextBlock; path: [KeyedSegment]} | undefined\n> = (snapshot) => {\n const key = snapshot.context.selection\n ? isKeyedSegment(snapshot.context.selection.focus.path[0])\n ? snapshot.context.selection.focus.path[0]._key\n : undefined\n : undefined\n\n const node = key\n ? snapshot.context.value.find((block) => block._key === key)\n : undefined\n\n return node && key ? {node, path: [{_key: key}]} : undefined\n}\n\n/**\n * @public\n */\nexport const getFocusListBlock: EditorSelector<\n {node: PortableTextListBlock; path: [KeyedSegment]} | undefined\n> = (snapshot) => {\n const focusTextBlock = getFocusTextBlock(snapshot)\n\n return focusTextBlock && isListBlock(snapshot.context, focusTextBlock.node)\n ? {node: focusTextBlock.node, path: focusTextBlock.path}\n : undefined\n}\n\n/**\n * @public\n */\nexport const getFocusTextBlock: EditorSelector<\n {node: PortableTextTextBlock; path: [KeyedSegment]} | undefined\n> = (snapshot) => {\n const focusBlock = getFocusBlock(snapshot)\n\n return focusBlock && isTextBlock(snapshot.context, focusBlock.node)\n ? {node: focusBlock.node, path: focusBlock.path}\n : undefined\n}\n\n/**\n * @public\n */\nexport const getFocusBlockObject: EditorSelector<\n {node: PortableTextObject; path: [KeyedSegment]} | undefined\n> = (snapshot) => {\n const focusBlock = getFocusBlock(snapshot)\n\n return focusBlock && !isTextBlock(snapshot.context, focusBlock.node)\n ? {node: focusBlock.node, path: focusBlock.path}\n : undefined\n}\n\n/**\n * @public\n */\nexport const getFocusChild: EditorSelector<\n | {\n node: PortableTextObject | PortableTextSpan\n path: [KeyedSegment, 'children', KeyedSegment]\n }\n | undefined\n> = (snapshot) => {\n const focusBlock = getFocusTextBlock(snapshot)\n\n if (!focusBlock) {\n return undefined\n }\n\n const key = snapshot.context.selection\n ? isKeyedSegment(snapshot.context.selection.focus.path[2])\n ? snapshot.context.selection.focus.path[2]._key\n : undefined\n : undefined\n\n const node = key\n ? focusBlock.node.children.find((span) => span._key === key)\n : undefined\n\n return node && key\n ? {node, path: [...focusBlock.path, 'children', {_key: key}]}\n : undefined\n}\n\n/**\n * @public\n */\nexport const getFocusSpan: EditorSelector<\n | {node: PortableTextSpan; path: [KeyedSegment, 'children', KeyedSegment]}\n | undefined\n> = (snapshot) => {\n const focusChild = getFocusChild(snapshot)\n\n return focusChild && isSpan(snapshot.context, focusChild.node)\n ? {node: focusChild.node, path: focusChild.path}\n : undefined\n}\n\n/**\n * @public\n */\nexport const getFirstBlock: EditorSelector<\n {node: PortableTextBlock; path: [KeyedSegment]} | undefined\n> = (snapshot) => {\n const node = snapshot.context.value[0]\n\n return node ? {node, path: [{_key: node._key}]} : undefined\n}\n\n/**\n * @public\n */\nexport const getLastBlock: EditorSelector<\n {node: PortableTextBlock; path: [KeyedSegment]} | undefined\n> = (snapshot) => {\n const node = snapshot.context.value[snapshot.context.value.length - 1]\n ? snapshot.context.value[snapshot.context.value.length - 1]\n : undefined\n\n return node ? {node, path: [{_key: node._key}]} : undefined\n}\n\n/**\n * @public\n */\nexport const getSelectedBlocks: EditorSelector<\n Array<{node: PortableTextBlock; path: [KeyedSegment]}>\n> = (snapshot) => {\n if (!snapshot.context.selection) {\n return []\n }\n\n const selectedBlocks: Array<{node: PortableTextBlock; path: [KeyedSegment]}> =\n []\n const startKey = snapshot.context.selection.backward\n ? isKeyedSegment(snapshot.context.selection.focus.path[0])\n ? snapshot.context.selection.focus.path[0]._key\n : undefined\n : isKeyedSegment(snapshot.context.selection.anchor.path[0])\n ? snapshot.context.selection.anchor.path[0]._key\n : undefined\n const endKey = snapshot.context.selection.backward\n ? isKeyedSegment(snapshot.context.selection.anchor.path[0])\n ? snapshot.context.selection.anchor.path[0]._key\n : undefined\n : isKeyedSegment(snapshot.context.selection.focus.path[0])\n ? snapshot.context.selection.focus.path[0]._key\n : undefined\n\n if (!startKey || !endKey) {\n return selectedBlocks\n }\n\n for (const block of snapshot.context.value) {\n if (block._key === startKey) {\n selectedBlocks.push({node: block, path: [{_key: block._key}]})\n\n if (startKey === endKey) {\n break\n }\n continue\n }\n\n if (block._key === endKey) {\n selectedBlocks.push({node: block, path: [{_key: block._key}]})\n break\n }\n\n if (selectedBlocks.length > 0) {\n selectedBlocks.push({node: block, path: [{_key: block._key}]})\n }\n }\n\n return selectedBlocks\n}\n\n/**\n * @public\n */\nexport const getSelectionStartBlock: EditorSelector<\n | {\n node: PortableTextBlock\n path: [KeyedSegment]\n }\n | undefined\n> = (snapshot) => {\n if (!snapshot.context.selection) {\n return undefined\n }\n\n const key = snapshot.context.selection.backward\n ? isKeyedSegment(snapshot.context.selection.focus.path[0])\n ? snapshot.context.selection.focus.path[0]._key\n : undefined\n : isKeyedSegment(snapshot.context.selection.anchor.path[0])\n ? snapshot.context.selection.anchor.path[0]._key\n : undefined\n\n const node = key\n ? snapshot.context.value.find((block) => block._key === key)\n : undefined\n\n return node && key ? {node, path: [{_key: key}]} : undefined\n}\n\n/**\n * @public\n */\nexport const getSelectionEndBlock: EditorSelector<\n | {\n node: PortableTextBlock\n path: [KeyedSegment]\n }\n | undefined\n> = (snapshot) => {\n if (!snapshot.context.selection) {\n return undefined\n }\n\n const key = snapshot.context.selection.backward\n ? isKeyedSegment(snapshot.context.selection.anchor.path[0])\n ? snapshot.context.selection.anchor.path[0]._key\n : undefined\n : isKeyedSegment(snapshot.context.selection.focus.path[0])\n ? snapshot.context.selection.focus.path[0]._key\n : undefined\n\n const node = key\n ? snapshot.context.value.find((block) => block._key === key)\n : undefined\n\n return node && key ? {node, path: [{_key: key}]} : undefined\n}\n\n/**\n * @public\n */\nexport const getPreviousBlock: EditorSelector<\n {node: PortableTextBlock; path: [KeyedSegment]} | undefined\n> = (snapshot) => {\n let previousBlock: {node: PortableTextBlock; path: [KeyedSegment]} | undefined\n const selectionStartBlock = getSelectionStartBlock(snapshot)\n\n if (!selectionStartBlock) {\n return undefined\n }\n\n let foundSelectionStartBlock = false\n\n for (const block of snapshot.context.value) {\n if (block._key === selectionStartBlock.node._key) {\n foundSelectionStartBlock = true\n break\n }\n\n previousBlock = {node: block, path: [{_key: block._key}]}\n }\n\n if (foundSelectionStartBlock && previousBlock) {\n return previousBlock\n }\n\n return undefined\n}\n\n/**\n * @public\n */\nexport const getNextBlock: EditorSelector<\n {node: PortableTextBlock; path: [KeyedSegment]} | undefined\n> = (snapshot) => {\n let nextBlock: {node: PortableTextBlock; path: [KeyedSegment]} | undefined\n const selectionEndBlock = getSelectionEndBlock(snapshot)\n\n if (!selectionEndBlock) {\n return undefined\n }\n\n let foundSelectionEndBlock = false\n\n for (const block of snapshot.context.value) {\n if (block._key === selectionEndBlock.node._key) {\n foundSelectionEndBlock = true\n continue\n }\n\n if (foundSelectionEndBlock) {\n nextBlock = {node: block, path: [{_key: block._key}]}\n break\n }\n }\n\n if (foundSelectionEndBlock && nextBlock) {\n return nextBlock\n }\n\n return undefined\n}\n","import type {EditorSelectionPoint} from '..'\nimport type {EditorSelector} from '../editor/editor-selector'\n\n/**\n * @public\n */\nexport const getSelectionEndPoint: EditorSelector<\n EditorSelectionPoint | undefined\n> = (snapshot) => {\n if (!snapshot.context.selection) {\n return undefined\n }\n\n return snapshot.context.selection.backward\n ? snapshot.context.selection.anchor\n : snapshot.context.selection.focus\n}\n","import type {EditorSelectionPoint} from '..'\nimport type {EditorSelector} from '../editor/editor-selector'\n\n/**\n * @public\n */\nexport const getSelectionStartPoint: EditorSelector<\n EditorSelectionPoint | undefined\n> = (snapshot) => {\n if (!snapshot.context.selection) {\n return undefined\n }\n\n return snapshot.context.selection.backward\n ? snapshot.context.selection.focus\n : snapshot.context.selection.anchor\n}\n","import {\n isKeySegment,\n type KeyedSegment,\n type PortableTextObject,\n} from '@sanity/types'\nimport type {EditorSelector} from '../editor/editor-selector'\nimport {isSpan} from '../utils'\nimport {getSelectionEndPoint} from './selector.get-selection-end-point'\nimport {getFocusTextBlock} from './selectors'\n\n/**\n * @public\n */\nexport const getNextInlineObject: EditorSelector<\n | {\n node: PortableTextObject\n path: [KeyedSegment, 'children', KeyedSegment]\n }\n | undefined\n> = (snapshot) => {\n const focusTextBlock = getFocusTextBlock(snapshot)\n const selectionEndPoint = getSelectionEndPoint(snapshot)\n const selectionEndPointChildKey =\n selectionEndPoint && isKeySegment(selectionEndPoint.path[2])\n ? selectionEndPoint.path[2]._key\n : undefined\n\n if (!focusTextBlock || !selectionEndPointChildKey) {\n return undefined\n }\n\n let endPointChildFound = false\n let inlineObject:\n | {\n node: PortableTextObject\n path: [KeyedSegment, 'children', KeyedSegment]\n }\n | undefined\n\n for (const child of focusTextBlock.node.children) {\n if (child._key === selectionEndPointChildKey) {\n endPointChildFound = true\n continue\n }\n\n if (!isSpan(snapshot.context, child) && endPointChildFound) {\n inlineObject = {\n node: child,\n path: [...focusTextBlock.path, 'children', {_key: child._key}],\n }\n break\n }\n }\n\n return inlineObject\n}\n","import {\n isKeySegment,\n type KeyedSegment,\n type PortableTextObject,\n} from '@sanity/types'\nimport type {EditorSelector} from '../editor/editor-selector'\nimport {isSpan} from '../utils'\nimport {getSelectionStartPoint} from './selector.get-selection-start-point'\nimport {getFocusTextBlock} from './selectors'\n\n/**\n * @public\n */\nexport const getPreviousInlineObject: EditorSelector<\n | {\n node: PortableTextObject\n path: [KeyedSegment, 'children', KeyedSegment]\n }\n | undefined\n> = (snapshot) => {\n const focusTextBlock = getFocusTextBlock(snapshot)\n const selectionStartPoint = getSelectionStartPoint(snapshot)\n const selectionStartPointChildKey =\n selectionStartPoint && isKeySegment(selectionStartPoint.path[2])\n ? selectionStartPoint.path[2]._key\n : undefined\n\n if (!focusTextBlock || !selectionStartPointChildKey) {\n return undefined\n }\n\n let inlineObject:\n | {\n node: PortableTextObject\n path: [KeyedSegment, 'children', KeyedSegment]\n }\n | undefined\n\n for (const child of focusTextBlock.node.children) {\n if (child._key === selectionStartPointChildKey) {\n break\n }\n\n if (!isSpan(snapshot.context, child)) {\n inlineObject = {\n node: child,\n path: [...focusTextBlock.path, 'children', {_key: child._key}],\n }\n }\n }\n\n return inlineObject\n}\n","import type {PortableTextBlock} from '@sanity/types'\nimport type {EditorSelector} from '../editor/editor-selector'\nimport {sliceBlocks} from '../utils'\n\n/**\n * @public\n */\nexport const getSelectedSlice: EditorSelector<Array<PortableTextBlock>> = (\n snapshot,\n) => {\n return sliceBlocks({\n context: snapshot.context,\n blocks: snapshot.context.value,\n })\n}\n","import type {EditorSelector} from '../editor/editor-selector'\nimport {isSpan, isTextBlock} from '../internal-utils/parse-blocks'\nimport {getSelectedSlice} from './selector.get-selected-slice'\n\n/**\n * @public\n */\nexport const getSelectionText: EditorSelector<string> = (snapshot) => {\n const selectedSlice = getSelectedSlice(snapshot)\n\n return selectedSlice.reduce((text, block) => {\n if (!isTextBlock(snapshot.context, block)) {\n return text\n }\n\n return (\n text +\n block.children.reduce((text, child) => {\n if (isSpan(snapshot.context, child)) {\n return text + child.text\n }\n\n return text\n }, '')\n )\n }, '')\n}\n","import type {EditorSelector} from '../editor/editor-selector'\nimport {isSelectionCollapsed} from './selector.is-selection-collapsed'\n\n/**\n * @public\n */\nexport const isSelectionExpanded: EditorSelector<boolean> = (snapshot) => {\n return !isSelectionCollapsed(snapshot)\n}\n","import type {EditorSelector} from '../editor/editor-selector'\nimport type {BlockOffset} from '../types/block-offset'\nimport type {EditorSelection} from '../types/editor'\nimport {\n blockOffsetToSpanSelectionPoint,\n getBlockEndPoint,\n getBlockStartPoint,\n spanSelectionPointToBlockOffset,\n} from '../utils'\nimport {getNextInlineObject} from './selector.get-next-inline-object'\nimport {getPreviousInlineObject} from './selector.get-previous-inline-object'\nimport {getSelectionStartPoint} from './selector.get-selection-start-point'\nimport {getSelectionText} from './selector.get-selection-text'\nimport {isSelectionCollapsed} from './selector.is-selection-collapsed'\nimport {isSelectionExpanded} from './selector.is-selection-expanded'\nimport {getFocusTextBlock} from './selectors'\n\n/**\n * @public\n * Returns the selection of the of the word the caret is placed in.\n * Note: Only returns a word selection if the current selection is collapsed\n */\nexport const getCaretWordSelection: EditorSelector<EditorSelection> = (\n snapshot,\n) => {\n if (!snapshot.context.selection) {\n return null\n }\n\n if (!isSelectionCollapsed(snapshot)) {\n return null\n }\n\n const focusTextBlock = getFocusTextBlock(snapshot)\n const selectionStartPoint = getSelectionStartPoint(snapshot)\n const selectionStartOffset = selectionStartPoint\n ? spanSelectionPointToBlockOffset({\n context: snapshot.context,\n selectionPoint: selectionStartPoint,\n })\n : undefined\n\n if (!focusTextBlock || !selectionStartPoint || !selectionStartOffset) {\n return null\n }\n\n const previousInlineObject = getPreviousInlineObject(snapshot)\n const blockStartPoint = getBlockStartPoint({\n context: snapshot.context,\n block: focusTextBlock,\n })\n const textBefore = getSelectionText({\n ...snapshot,\n context: {\n ...snapshot.context,\n selection: {\n anchor: previousInlineObject\n ? {path: previousInlineObject.path, offset: 0}\n : blockStartPoint,\n focus: selectionStartPoint,\n },\n },\n })\n const textDirectlyBefore = textBefore.split(/\\s+/).at(-1)\n\n const nextInlineObject = getNextInlineObject(snapshot)\n const blockEndPoint = getBlockEndPoint({\n context: snapshot.context,\n block: focusTextBlock,\n })\n const textAfter = getSelectionText({\n ...snapshot,\n context: {\n ...snapshot.context,\n selection: {\n anchor: selectionStartPoint,\n focus: nextInlineObject\n ? {path: nextInlineObject.path, offset: 0}\n : blockEndPoint,\n },\n },\n })\n const textDirectlyAfter = textAfter.split(/\\s+/).at(0)\n\n if (\n (textDirectlyBefore === undefined || textDirectlyBefore === '') &&\n (textDirectlyAfter === undefined || textDirectlyAfter === '')\n ) {\n return null\n }\n\n const caretWordStartOffset: BlockOffset = textDirectlyBefore\n ? {\n ...selectionStartOffset,\n offset: selectionStartOffset.offset - textDirectlyBefore.length,\n }\n : selectionStartOffset\n const caretWordEndOffset: BlockOffset = textDirectlyAfter\n ? {\n ...selectionStartOffset,\n offset: selectionStartOffset.offset + textDirectlyAfter.length,\n }\n : selectionStartOffset\n\n const caretWordStartSelectionPoint = blockOffsetToSpanSelectionPoint({\n context: snapshot.context,\n blockOffset: caretWordStartOffset,\n direction: 'backward',\n })\n const caretWordEndSelectionPoint = blockOffsetToSpanSelectionPoint({\n context: snapshot.context,\n blockOffset: caretWordEndOffset,\n direction: 'forward',\n })\n\n if (!caretWordStartSelectionPoint || !caretWordEndSelectionPoint) {\n return null\n }\n\n const caretWordSelection = {\n anchor: caretWordStartSelectionPoint,\n focus: caretWordEndSelectionPoint,\n }\n\n return isSelectionExpanded({\n ...snapshot,\n context: {\n ...snapshot.context,\n selection: caretWordSelection,\n },\n })\n ? caretWordSelection\n : null\n}\n","import type {KeyedSegment, PortableTextBlock} from '@sanity/types'\nimport type {EditorSelector} from '../editor/editor-selector'\nimport * as utils from '../utils'\nimport {isSelectionCollapsed} from './selector.is-selection-collapsed'\n\n/**\n * @public\n */\nexport function isAtTheEndOfBlock(block: {\n node: PortableTextBlock\n path: [KeyedSegment]\n}): EditorSelector<boolean> {\n return (snapshot) => {\n if (!snapshot.context.selection || !isSelectionCollapsed(snapshot)) {\n return false\n }\n\n const blockEndPoint = utils.getBlockEndPoint({\n context: snapshot.context,\n block,\n })\n\n return utils.isEqualSelectionPoints(\n snapshot.context.selection.focus,\n blockEndPoint,\n )\n }\n}\n","import type {KeyedSegment, PortableTextBlock} from '@sanity/types'\nimport type {EditorSelector} from '../editor/editor-selector'\nimport * as utils from '../utils'\nimport {isSelectionCollapsed} from './selector.is-selection-collapsed'\n\n/**\n * @public\n */\nexport function isAtTheStartOfBlock(block: {\n node: PortableTextBlock\n path: [KeyedSegment]\n}): EditorSelector<boolean> {\n return (snapshot) => {\n if (!snapshot.context.selection || !isSelectionCollapsed(snapshot)) {\n return false\n }\n\n const blockStartPoint = utils.getBlockStartPoint({\n context: snapshot.context,\n block,\n })\n\n return utils.isEqualSelectionPoints(\n snapshot.context.selection.focus,\n blockStartPoint,\n )\n }\n}\n","import type {EditorSelector} from '../editor/editor-selector'\nimport {isTextBlock} from '../internal-utils/parse-blocks'\nimport type {EditorSelectionPoint} from '../types/editor'\nimport {isKeyedSegment} from '../utils/util.is-keyed-segment'\nimport {reverseSelection} from '../utils/util.reverse-selection'\n\n/**\n * @public\n */\nexport function isPointAfterSelection(\n point: EditorSelectionPoint,\n): EditorSelector<boolean> {\n return (snapshot) => {\n if (!snapshot.context.selection) {\n return false\n }\n\n const selection = snapshot.context.selection.backward\n ? reverseSelection(snapshot.context.selection)\n : snapshot.context.selection\n\n const pointBlockKey = isKeyedSegment(point.path[0])\n ? point.path[0]._key\n : undefined\n const pointChildKey = isKeyedSegment(point.path[2])\n ? point.path[2]._key\n : undefined\n\n const endBlockKey = isKeyedSegment(selection.focus.path[0])\n ? selection.focus.path[0]._key\n : undefined\n const endChildKey = isKeyedSegment(selection.focus.path[2])\n ? selection.focus.path[2]._key\n : undefined\n\n if (!pointBlockKey || !endBlockKey) {\n return false\n }\n\n let after = false\n\n for (const block of snapshot.context.value) {\n if (block._key === endBlockKey) {\n if (block._key !== pointBlockKey) {\n after = true\n break\n }\n\n // Both the point and the selection end in this block\n\n if (!isTextBlock(snapshot.context, block)) {\n break\n }\n\n if (!pointChildKey || !endChildKey) {\n break\n }\n\n for (const child of block.children) {\n if (child._key === endChildKey) {\n if (child._key !== pointChildKey) {\n after = true\n break\n }\n\n // Both the point and the selection end in this child\n\n after = point.offset > selection.focus.offset\n break\n }\n\n if (child._key === pointChildKey) {\n break\n }\n }\n }\n\n if (block._key === pointBlockKey) {\n break\n }\n }\n\n return after\n }\n}\n","import type {EditorSelector} from '../editor/editor-selector'\nimport {isTextBlock} from '../internal-utils/parse-blocks'\nimport type {EditorSelectionPoint} from '../types/editor'\nimport {isKeyedSegment} from '../utils/util.is-keyed-segment'\nimport {reverseSelection} from '../utils/util.reverse-selection'\n\n/**\n * @public\n */\nexport function isPointBeforeSelection(\n point: EditorSelectionPoint,\n): EditorSelector<boolean> {\n return (snapshot) => {\n if (!snapshot.context.selection) {\n return false\n }\n\n const selection = snapshot.context.selection.backward\n ? reverseSelection(snapshot.context.selection)\n : snapshot.context.selection\n\n const pointBlockKey = isKeyedSegment(point.path[0])\n ? point.path[0]._key\n : undefined\n const pointChildKey = isKeyedSegment(point.path[2])\n ? point.path[2]._key\n : undefined\n\n const startBlockKey = isKeyedSegment(selection.anchor.path[0])\n ? selection.anchor.path[0]._key\n : undefined\n const startChildKey = isKeyedSegment(selection.anchor.path[2])\n ? selection.anchor.path[2]._key\n : undefined\n\n if (!pointBlockKey || !startBlockKey) {\n return false\n }\n\n let before = false\n\n for (const block of snapshot.context.value) {\n if (block._key === pointBlockKey) {\n if (block._key !== startBlockKey) {\n before = true\n break\n }\n\n // Both the point and the selection start in this block\n\n if (!isTextBlock(snapshot.context, block)) {\n break\n }\n\n if (!pointChildKey || !startChildKey) {\n break\n }\n\n for (const child of block.children) {\n if (child._key === pointChildKey) {\n if (child._key !== startChildKey) {\n before = true\n break\n }\n\n // Both the point and the selection start in this child\n\n before = point.offset < selection.anchor.offset\n break\n }\n\n if (child._key === startChildKey) {\n break\n }\n }\n }\n\n if (block._key === startBlockKey) {\n break\n }\n }\n\n return before\n }\n}\n","import type {EditorSelection} from '../types/editor'\nimport {isEqualSelectionPoints} from '../utils'\nimport type {EditorSelector} from './../editor/editor-selector'\nimport {getSelectionEndPoint} from './selector.get-selection-end-point'\nimport {getSelectionStartPoint} from './selector.get-selection-start-point'\nimport {isPointAfterSelection} from './selector.is-point-after-selection'\nimport {isPointBeforeSelection} from './selector.is-point-before-selection'\n\n/**\n * @public\n */\nexport function isOverlappingSelection(\n selection: EditorSelection,\n): EditorSelector<boolean> {\n return (snapshot) => {\n if (!selection || !snapshot.context.selection) {\n return false\n }\n\n const selectionStartPoint = getSelectionStartPoint({\n ...snapshot,\n context: {\n ...snapshot.context,\n selection,\n },\n })\n const selectionEndPoint = getSelectionEndPoint({\n ...snapshot,\n context: {\n ...snapshot.context,\n selection,\n },\n })\n\n const originalSelectionStartPoint = getSelectionStartPoint(snapshot)\n const originalSelectionEndPoint = getSelectionEndPoint(snapshot)\n\n if (\n !selectionStartPoint ||\n !selectionEndPoint ||\n !originalSelectionStartPoint ||\n !originalSelectionEndPoint\n ) {\n return false\n }\n\n const startPointBeforeSelection =\n isPointBeforeSelection(selectionStartPoint)(snapshot)\n const startPointAfterSelection =\n isPointAfterSelection(selectionStartPoint)(snapshot)\n const endPointBeforeSelection =\n isPointBeforeSelection(selectionEndPoint)(snapshot)\n const endPointAfterSelection =\n isPointAfterSelection(selectionEndPoint)(snapshot)\n\n const originalStartPointBeforeStartPoint = isPointBeforeSelection(\n originalSelectionStartPoint,\n )({\n ...snapshot,\n context: {\n ...snapshot.context,\n selection: {\n anchor: selectionStartPoint,\n focus: selectionStartPoint,\n },\n },\n })\n const originalStartPointAfterStartPoint = isPointAfterSelection(\n originalSelectionStartPoint,\n )({\n ...snapshot,\n context: {\n ...snapshot.context,\n selection: {\n anchor: selectionStartPoint,\n focus: selectionStartPoint,\n },\n },\n })\n\n const originalEndPointBeforeEndPoint = isPointBeforeSelection(\n originalSelectionEndPoint,\n )({\n ...snapshot,\n context: {\n ...snapshot.context,\n selection: {\n anchor: selectionEndPoint,\n focus: selectionEndPoint,\n },\n },\n })\n const originalEndPointAfterEndPoint = isPointAfterSelection(\n originalSelectionEndPoint,\n )({\n ...snapshot,\n context: {\n ...snapshot.context,\n selection: {\n anchor: selectionEndPoint,\n focus: selectionEndPoint,\n },\n },\n })\n\n const endPointEqualToOriginalStartPoint = isEqualSelectionPoints(\n selectionEndPoint,\n originalSelectionStartPoint,\n )\n const startPointEqualToOriginalEndPoint = isEqualSelectionPoints(\n selectionStartPoint,\n originalSelectionEndPoint,\n )\n\n if (endPointBeforeSelection && !endPointEqualToOriginalStartPoint) {\n return false\n }\n\n if (startPointAfterSelection && !startPointEqualToOriginalEndPoint) {\n return false\n }\n\n if (\n !originalStartPointBeforeStartPoint &&\n originalStartPointAfterStartPoint &&\n !originalEndPointBeforeEndPoint &&\n originalEndPointAfterEndPoint\n ) {\n return !endPointEqualToOriginalStartPoint\n }\n\n if (\n originalStartPointBeforeStartPoint &&\n !originalStartPointAfterStartPoint &&\n originalEndPointBeforeEndPoint &&\n !originalEndPointAfterEndPoint\n ) {\n return !startPointEqualToOriginalEndPoint\n }\n\n if (\n !startPointAfterSelection ||\n !startPointBeforeSelection ||\n !endPointAfterSelection ||\n !endPointBeforeSelection\n ) {\n return true\n }\n\n return false\n }\n}\n"],"names":["isSelectionCollapsed","snapshot","context","selection","JSON","stringify","anchor","path","focus","offset","getFocusBlock","key","isKeyedSegment","_key","undefined","node","value","find","block","getFocusListBlock","focusTextBlock","getFocusTextBlock","isListBlock","focusBlock","isTextBlock","getFocusBlockObject","getFocusChild","children","span","getFocusSpan","focusChild","isSpan","getFirstBlock","getLastBlock","length","getSelectedBlocks","selectedBlocks","startKey","backward","endKey","push","getSelectionStartBlock","getSelectionEndBlock","getPreviousBlock","previousBlock","selectionStartBlock","foundSelectionStartBlock","getNextBlock","nextBlock","selectionEndBlock","foundSelectionEndBlock","getSelectionEndPoint","getSelectionStartPoint","getNextInlineObject","selectionEndPoint","selectionEndPointChildKey","isKeySegment","endPointChildFound","inlineObject","child","getPreviousInlineObject","selectionStartPoint","selectionStartPointChildKey","getSelectedSlice","sliceBlocks","blocks","getSelectionText","reduce","text","isSelectionExpanded","getCaretWordSelection","selectionStartOffset","spanSelectionPointToBlockOffset","selectionPoint","previousInlineObject","blockStartPoint","getBlockStartPoint","textDirectlyBefore","split","at","nextInlineObject","blockEndPoint","getBlockEndPoint","textDirectlyAfter","caretWordStartOffset","caretWordEndOffset","caretWordStartSelectionPoint","blockOffsetToSpanSelectionPoint","blockOffset","direction","caretWordEndSelectionPoint","caretWordSelection","isAtTheEndOfBlock","utils","isAtTheStartOfBlock","isPointAfterSelection","point","reverseSelection","pointBlockKey","pointChildKey","endBlockKey","endChildKey","after","isPointBeforeSelection","startBlockKey","startChildKey","before","isOverlappingSelection","originalSelectionStartPoint","originalSelectionEndPoint","startPointBeforeSelection","startPointAfterSelection","endPointBeforeSelection","endPointAfterSelection","originalStartPointBeforeStartPoint","originalStartPointAfterStartPoint","originalEndPointBeforeEndPoint","originalEndPointAfterEndPoint","endPointEqualToOriginalStartPoint","isEqualSelectionPoints","startPointEqualToOriginalEndPoint"],"mappings":";AA+DK,MAAC,eAAe;AAIrB,SAAS,aAAa,SAAS;AAC7B,SAAO,OAAO,WAAW,WAAW,aAAa,KAAK,QAAQ,KAAI,CAAE,IAAI,OAAO,WAAW,YAAY,UAAU;AAClH;AASA,SAAS,WAAW,OAAO;AACzB,SAAO,CAAC,CAAC,UAAU,OAAO,SAAS,YAAY,OAAO,SAAS;AACjE;AAKA,SAAS,mBAAmB,OAAO;AACjC,SAAO,WAAW,KAAK,KAAK,MAAM,UAAU,UAAU,OAAO,MAAM,QAAQ,aAAa,WAAW,QAAQ,MAAM,QAAQ,MAAM,KAAK,KAAK,MAAM,MAAM,MAAM,CAAC,SAAS,OAAO,QAAQ,QAAQ,IAAI;AAClM;AAmFA,SAAS,WAAW,kBAAkB,eAAe;AACnD,SAAO;AACT;AACA,SAAS,YAAY,aAAa,eAAe;AAC/C,SAAO;AACT;AC1KO,MAAMA,uBAAiDC,CAAAA,aACvDA,SAASC,QAAQC,YAKpBC,KAAKC,UAAUJ,SAASC,QAAQC,UAAUG,OAAOC,IAAI,MACnDH,KAAKC,UAAUJ,SAASC,QAAQC,UAAUK,MAAMD,IAAI,KACtDN,SAASC,QAAQC,WAAWG,OAAOG,WACjCR,SAASC,QAAQC,WAAWK,MAAMC,SAP7B,ICQEC,gBAERT,CAAa,aAAA;AAChB,QAAMU,MAAMV,SAASC,QAAQC,aACzBS,eAAeX,SAASC,QAAQC,UAAUK,MAAMD,KAAK,CAAC,CAAC,I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