@meowdown/core 0.67.0 → 0.67.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -319,6 +319,7 @@ interface PositionRange {
319
319
  //#endregion
320
320
  //#region src/extensions/get-link-unit-at.d.ts
321
321
  interface LinkUnitBase {
322
+ state: EditorState;
322
323
  /**
323
324
  * Whole inline link, reference link, or autolink range.
324
325
  */
@@ -382,7 +383,7 @@ export declare function normalizeHref(raw: string): string;
382
383
  /**
383
384
  * Get a link's plain visible text.
384
385
  */
385
- export declare function getLinkText(state: EditorState, link: LinkUnit): string;
386
+ export declare function getLinkText(link: LinkUnit): string;
386
387
  /**
387
388
  * Whether plain visible link text names the same destination as the link.
388
389
  */
package/dist/index.js CHANGED
@@ -4522,6 +4522,7 @@ function getLinkUnitAt(state, pos) {
4522
4522
  };
4523
4523
  switch (attrs.key) {
4524
4524
  case "link-bare": return {
4525
+ state,
4525
4526
  form: "bare",
4526
4527
  unit: unitRange,
4527
4528
  text: unitRange,
@@ -4529,6 +4530,7 @@ function getLinkUnitAt(state, pos) {
4529
4530
  title: ""
4530
4531
  };
4531
4532
  case "link-angle": return {
4533
+ state,
4532
4534
  form: "angle",
4533
4535
  unit: unitRange,
4534
4536
  text: {
@@ -4541,6 +4543,7 @@ function getLinkUnitAt(state, pos) {
4541
4543
  case "link-reference": {
4542
4544
  const linkText = getMarkRangeAt(state, pos, "mdLinkText");
4543
4545
  return {
4546
+ state,
4544
4547
  form: "reference",
4545
4548
  unit: unitRange,
4546
4549
  text: linkText == null ? unitRange : {
@@ -4560,6 +4563,7 @@ function getLinkUnitAt(state, pos) {
4560
4563
  to: closeBracket
4561
4564
  };
4562
4565
  return {
4566
+ state,
4563
4567
  form: "inline",
4564
4568
  unit: unitRange,
4565
4569
  text: label,
@@ -4613,8 +4617,8 @@ function getVisibleText(state, range) {
4613
4617
  /**
4614
4618
  * Get a link's plain visible text.
4615
4619
  */
4616
- function getLinkText(state, link) {
4617
- return getVisibleText(state, link.text);
4620
+ function getLinkText(link) {
4621
+ return getVisibleText(link.state, link.text);
4618
4622
  }
4619
4623
  /**
4620
4624
  * Whether plain visible link text names the same destination as the link.
@@ -4677,7 +4681,7 @@ function updateLink(attrs) {
4677
4681
  if (!link || link.form === "reference") return false;
4678
4682
  const href = normalizeHref(attrs.href ?? link.href);
4679
4683
  const title = attrs.title ?? link.title;
4680
- const text = attrs.text ?? getLinkText(state, link);
4684
+ const text = attrs.text ?? getLinkText(link);
4681
4685
  const replacingUnit = attrs.text !== void 0 || link.form !== "inline";
4682
4686
  if (dispatch) dispatch((replacingUnit ? state.tr.insertText(`[${linkLabelText(text)}](${destText(href, title)})`, link.unit.from, link.unit.to) : state.tr.insertText(destText(href, title), link.dest.from, link.dest.to)).scrollIntoView());
4683
4687
  return true;
@@ -4691,7 +4695,7 @@ function removeLink() {
4691
4695
  const link = getLinkUnitAt(state, state.selection.from);
4692
4696
  if (!link || link.form === "reference") return false;
4693
4697
  if (dispatch) {
4694
- const text = getLinkText(state, link);
4698
+ const text = getLinkText(link);
4695
4699
  dispatch((link.form === "inline" && !getAutolinkHref(text) ? state.tr.delete(link.label.to, link.unit.to).delete(link.unit.from, link.label.from) : state.tr.insertText(text + formatMagicComment({ noLink: true }), link.unit.from, link.unit.to)).scrollIntoView());
4696
4700
  }
4697
4701
  return true;
@@ -4717,7 +4721,7 @@ function openLinkEdit(onLinkEdit) {
4717
4721
  from,
4718
4722
  to,
4719
4723
  link,
4720
- text: getLinkText(state, link)
4724
+ text: getLinkText(link)
4721
4725
  });
4722
4726
  }
4723
4727
  return true;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@meowdown/core",
3
3
  "type": "module",
4
- "version": "0.67.0",
4
+ "version": "0.67.1",
5
5
  "license": "MIT",
6
6
  "repository": {
7
7
  "type": "git",
@@ -43,7 +43,7 @@
43
43
  "remark-stringify": "^11.0.0",
44
44
  "unicode-by-name": "^0.2.0",
45
45
  "unified": "^11.0.5",
46
- "@meowdown/markdown": "^0.67.0"
46
+ "@meowdown/markdown": "^0.67.1"
47
47
  },
48
48
  "devDependencies": {
49
49
  "@ocavue/tsconfig": "^0.7.1",
@@ -54,7 +54,6 @@
54
54
  "commonmark.json": "^0.31.0",
55
55
  "dedent": "^1.7.2",
56
56
  "diffable-html-snapshot": "^0.3.0",
57
- "fast-check": "^4.9.0",
58
57
  "tsdown": "^0.23.0-beta.2",
59
58
  "vitest": "^4.1.11",
60
59
  "@meowdown/vitest": "0.0.0"