@storybook/addon-docs 10.1.0-alpha.8 → 10.1.0-beta.0

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 (33) hide show
  1. package/dist/_browser-chunks/Color-S5NAVK5F.js +1096 -0
  2. package/dist/_browser-chunks/{DocsRenderer-HT7GNKAR.js → DocsRenderer-GHJI37HO.js} +2 -2
  3. package/dist/_browser-chunks/{chunk-MM7DTO55.js → chunk-A242L54C.js} +10 -16
  4. package/dist/_browser-chunks/chunk-CYSK6WYR.js +7 -0
  5. package/dist/_browser-chunks/chunk-DDRHE7EB.js +949 -0
  6. package/dist/_browser-chunks/{chunk-74ZUTOZN.js → chunk-OATZR77O.js} +9 -22
  7. package/dist/_browser-chunks/chunk-UUESKCKV.js +31 -0
  8. package/dist/_node-chunks/{chunk-QSBD55JK.js → chunk-OGE4GWLB.js} +13 -19
  9. package/dist/_node-chunks/chunk-PRNIBEEO.js +196 -0
  10. package/dist/_node-chunks/chunk-SEBYU7IP.js +168 -0
  11. package/dist/_node-chunks/chunk-SZXCUVK4.js +22630 -0
  12. package/dist/_node-chunks/mdx-plugin-NLBBLG32.js +1032 -0
  13. package/dist/_node-chunks/rehype-external-links-V2D4HT5U.js +121 -0
  14. package/dist/_node-chunks/{rehype-slug-X6WEPBMC.js → rehype-slug-U5W6TP4H.js} +24 -58
  15. package/dist/angular/index.js +3 -5
  16. package/dist/blocks.d.ts +5 -2
  17. package/dist/blocks.js +4658 -6651
  18. package/dist/ember/index.js +3 -5
  19. package/dist/index.js +4 -6
  20. package/dist/manager.js +11 -22
  21. package/dist/mdx-loader.js +13 -19
  22. package/dist/preset.js +160 -453
  23. package/dist/preview.js +2 -2
  24. package/package.json +6 -6
  25. package/dist/_browser-chunks/Color-64QXVMR3.js +0 -1675
  26. package/dist/_browser-chunks/chunk-DMNQCVA2.js +0 -12
  27. package/dist/_browser-chunks/chunk-UZFOWTVP.js +0 -974
  28. package/dist/_browser-chunks/chunk-YDZYZRYC.js +0 -39
  29. package/dist/_node-chunks/chunk-D63L7OCA.js +0 -231
  30. package/dist/_node-chunks/chunk-DB6BS7Z4.js +0 -36332
  31. package/dist/_node-chunks/chunk-Z5MUJETX.js +0 -248
  32. package/dist/_node-chunks/mdx-plugin-KCQDNOVO.js +0 -1654
  33. package/dist/_node-chunks/rehype-external-links-LSUHFLUY.js +0 -168
@@ -1,7 +1,3 @@
1
- import {
2
- __name
3
- } from "./chunk-MM7DTO55.js";
4
-
5
1
  // src/DocsRenderer.tsx
6
2
  import React, { Component } from "react";
7
3
  import { renderElement, unmountElement } from "@storybook/react-dom-shim";
@@ -10,35 +6,29 @@ var defaultComponents = {
10
6
  code: CodeOrSourceMdx,
11
7
  a: AnchorMdx,
12
8
  ...HeadersMdx
13
- };
14
- var _ErrorBoundary = class _ErrorBoundary extends Component {
9
+ }, ErrorBoundary = class extends Component {
15
10
  constructor() {
16
11
  super(...arguments);
17
- this.state = { hasError: false };
12
+ this.state = { hasError: !1 };
18
13
  }
19
14
  static getDerivedStateFromError() {
20
- return { hasError: true };
15
+ return { hasError: !0 };
21
16
  }
22
17
  componentDidCatch(err) {
23
- const { showException } = this.props;
18
+ let { showException } = this.props;
24
19
  showException(err);
25
20
  }
26
21
  render() {
27
- const { hasError } = this.state;
28
- const { children } = this.props;
22
+ let { hasError } = this.state, { children } = this.props;
29
23
  return hasError ? null : React.createElement(React.Fragment, null, children);
30
24
  }
31
- };
32
- __name(_ErrorBoundary, "ErrorBoundary");
33
- var ErrorBoundary = _ErrorBoundary;
34
- var _DocsRenderer = class _DocsRenderer {
25
+ }, DocsRenderer = class {
35
26
  constructor() {
36
27
  this.render = async (context, docsParameter, element) => {
37
- const components = {
28
+ let components = {
38
29
  ...defaultComponents,
39
30
  ...docsParameter?.components
40
- };
41
- const TDocs = Docs;
31
+ }, TDocs = Docs;
42
32
  return new Promise((resolve, reject) => {
43
33
  import("@mdx-js/react").then(
44
34
  ({ MDXProvider }) => (
@@ -50,14 +40,11 @@ var _DocsRenderer = class _DocsRenderer {
50
40
  )
51
41
  ).then(() => resolve());
52
42
  });
53
- };
54
- this.unmount = (element) => {
43
+ }, this.unmount = (element) => {
55
44
  unmountElement(element);
56
45
  };
57
46
  }
58
47
  };
59
- __name(_DocsRenderer, "DocsRenderer");
60
- var DocsRenderer = _DocsRenderer;
61
48
 
62
49
  export {
63
50
  defaultComponents,
@@ -0,0 +1,31 @@
1
+ import {
2
+ __export
3
+ } from "./chunk-A242L54C.js";
4
+
5
+ // src/preview.ts
6
+ var preview_exports = {};
7
+ __export(preview_exports, {
8
+ parameters: () => parameters
9
+ });
10
+ var excludeTags = Object.entries(globalThis.TAGS_OPTIONS ?? {}).reduce(
11
+ (acc, entry) => {
12
+ let [tag, option] = entry;
13
+ return option.excludeFromDocsStories && (acc[tag] = !0), acc;
14
+ },
15
+ {}
16
+ ), parameters = {
17
+ docs: {
18
+ renderer: async () => {
19
+ let { DocsRenderer } = await import("./DocsRenderer-GHJI37HO.js");
20
+ return new DocsRenderer();
21
+ },
22
+ stories: {
23
+ filter: (story) => (story.tags || []).filter((tag) => excludeTags[tag]).length === 0 && !story.parameters.docs?.disable
24
+ }
25
+ }
26
+ };
27
+
28
+ export {
29
+ parameters,
30
+ preview_exports
31
+ };
@@ -1,10 +1,10 @@
1
- import CJS_COMPAT_NODE_URL_ggcqbc9ld7l from 'node:url';
2
- import CJS_COMPAT_NODE_PATH_ggcqbc9ld7l from 'node:path';
3
- import CJS_COMPAT_NODE_MODULE_ggcqbc9ld7l from "node:module";
1
+ import CJS_COMPAT_NODE_URL_2pgro2geduh from 'node:url';
2
+ import CJS_COMPAT_NODE_PATH_2pgro2geduh from 'node:path';
3
+ import CJS_COMPAT_NODE_MODULE_2pgro2geduh from "node:module";
4
4
 
5
- var __filename = CJS_COMPAT_NODE_URL_ggcqbc9ld7l.fileURLToPath(import.meta.url);
6
- var __dirname = CJS_COMPAT_NODE_PATH_ggcqbc9ld7l.dirname(__filename);
7
- var require = CJS_COMPAT_NODE_MODULE_ggcqbc9ld7l.createRequire(import.meta.url);
5
+ var __filename = CJS_COMPAT_NODE_URL_2pgro2geduh.fileURLToPath(import.meta.url);
6
+ var __dirname = CJS_COMPAT_NODE_PATH_2pgro2geduh.dirname(__filename);
7
+ var require = CJS_COMPAT_NODE_MODULE_2pgro2geduh.createRequire(import.meta.url);
8
8
 
9
9
  // ------------------------------------------------------------
10
10
  // end of CJS compatibility banner, injected by Storybook's esbuild configuration
@@ -13,22 +13,17 @@ var __create = Object.create;
13
13
  var __defProp = Object.defineProperty;
14
14
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
15
15
  var __getOwnPropNames = Object.getOwnPropertyNames;
16
- var __getProtoOf = Object.getPrototypeOf;
17
- var __hasOwnProp = Object.prototype.hasOwnProperty;
18
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
19
- var __commonJS = (cb, mod) => function __require() {
16
+ var __getProtoOf = Object.getPrototypeOf, __hasOwnProp = Object.prototype.hasOwnProperty;
17
+ var __commonJS = (cb, mod) => function() {
20
18
  return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
21
19
  };
22
20
  var __export = (target, all) => {
23
21
  for (var name in all)
24
- __defProp(target, name, { get: all[name], enumerable: true });
25
- };
26
- var __copyProps = (to, from, except, desc) => {
27
- if (from && typeof from === "object" || typeof from === "function") {
22
+ __defProp(target, name, { get: all[name], enumerable: !0 });
23
+ }, __copyProps = (to, from, except, desc) => {
24
+ if (from && typeof from == "object" || typeof from == "function")
28
25
  for (let key of __getOwnPropNames(from))
29
- if (!__hasOwnProp.call(to, key) && key !== except)
30
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
31
- }
26
+ !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
32
27
  return to;
33
28
  };
34
29
  var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
@@ -36,12 +31,11 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
36
31
  // file that has been converted to a CommonJS file using a Babel-
37
32
  // compatible transform (i.e. "__esModule" has not been set), then set
38
33
  // "default" to the CommonJS "module.exports" for node compatibility.
39
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
34
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: !0 }) : target,
40
35
  mod
41
36
  ));
42
37
 
43
38
  export {
44
- __name,
45
39
  __commonJS,
46
40
  __export,
47
41
  __toESM
@@ -0,0 +1,196 @@
1
+ import CJS_COMPAT_NODE_URL_2pgro2geduh from 'node:url';
2
+ import CJS_COMPAT_NODE_PATH_2pgro2geduh from 'node:path';
3
+ import CJS_COMPAT_NODE_MODULE_2pgro2geduh from "node:module";
4
+
5
+ var __filename = CJS_COMPAT_NODE_URL_2pgro2geduh.fileURLToPath(import.meta.url);
6
+ var __dirname = CJS_COMPAT_NODE_PATH_2pgro2geduh.dirname(__filename);
7
+ var require = CJS_COMPAT_NODE_MODULE_2pgro2geduh.createRequire(import.meta.url);
8
+
9
+ // ------------------------------------------------------------
10
+ // end of CJS compatibility banner, injected by Storybook's esbuild configuration
11
+ // ------------------------------------------------------------
12
+
13
+ // ../../node_modules/@ungap/structured-clone/esm/deserialize.js
14
+ var env = typeof self == "object" ? self : globalThis, deserializer = ($, _) => {
15
+ let as = (out, index) => ($.set(index, out), out), unpair = (index) => {
16
+ if ($.has(index))
17
+ return $.get(index);
18
+ let [type, value] = _[index];
19
+ switch (type) {
20
+ case 0:
21
+ case -1:
22
+ return as(value, index);
23
+ case 1: {
24
+ let arr = as([], index);
25
+ for (let index2 of value)
26
+ arr.push(unpair(index2));
27
+ return arr;
28
+ }
29
+ case 2: {
30
+ let object = as({}, index);
31
+ for (let [key, index2] of value)
32
+ object[unpair(key)] = unpair(index2);
33
+ return object;
34
+ }
35
+ case 3:
36
+ return as(new Date(value), index);
37
+ case 4: {
38
+ let { source, flags } = value;
39
+ return as(new RegExp(source, flags), index);
40
+ }
41
+ case 5: {
42
+ let map = as(/* @__PURE__ */ new Map(), index);
43
+ for (let [key, index2] of value)
44
+ map.set(unpair(key), unpair(index2));
45
+ return map;
46
+ }
47
+ case 6: {
48
+ let set = as(/* @__PURE__ */ new Set(), index);
49
+ for (let index2 of value)
50
+ set.add(unpair(index2));
51
+ return set;
52
+ }
53
+ case 7: {
54
+ let { name, message } = value;
55
+ return as(new env[name](message), index);
56
+ }
57
+ case 8:
58
+ return as(BigInt(value), index);
59
+ case "BigInt":
60
+ return as(Object(BigInt(value)), index);
61
+ case "ArrayBuffer":
62
+ return as(new Uint8Array(value).buffer, value);
63
+ case "DataView": {
64
+ let { buffer } = new Uint8Array(value);
65
+ return as(new DataView(buffer), value);
66
+ }
67
+ }
68
+ return as(new env[type](value), index);
69
+ };
70
+ return unpair;
71
+ }, deserialize = (serialized) => deserializer(/* @__PURE__ */ new Map(), serialized)(0);
72
+
73
+ // ../../node_modules/@ungap/structured-clone/esm/serialize.js
74
+ var EMPTY = "", { toString } = {}, { keys } = Object, typeOf = (value) => {
75
+ let type = typeof value;
76
+ if (type !== "object" || !value)
77
+ return [0, type];
78
+ let asString = toString.call(value).slice(8, -1);
79
+ switch (asString) {
80
+ case "Array":
81
+ return [1, EMPTY];
82
+ case "Object":
83
+ return [2, EMPTY];
84
+ case "Date":
85
+ return [3, EMPTY];
86
+ case "RegExp":
87
+ return [4, EMPTY];
88
+ case "Map":
89
+ return [5, EMPTY];
90
+ case "Set":
91
+ return [6, EMPTY];
92
+ case "DataView":
93
+ return [1, asString];
94
+ }
95
+ return asString.includes("Array") ? [1, asString] : asString.includes("Error") ? [7, asString] : [2, asString];
96
+ }, shouldSkip = ([TYPE, type]) => TYPE === 0 && (type === "function" || type === "symbol"), serializer = (strict, json, $, _) => {
97
+ let as = (out, value) => {
98
+ let index = _.push(out) - 1;
99
+ return $.set(value, index), index;
100
+ }, pair = (value) => {
101
+ if ($.has(value))
102
+ return $.get(value);
103
+ let [TYPE, type] = typeOf(value);
104
+ switch (TYPE) {
105
+ case 0: {
106
+ let entry = value;
107
+ switch (type) {
108
+ case "bigint":
109
+ TYPE = 8, entry = value.toString();
110
+ break;
111
+ case "function":
112
+ case "symbol":
113
+ if (strict)
114
+ throw new TypeError("unable to serialize " + type);
115
+ entry = null;
116
+ break;
117
+ case "undefined":
118
+ return as([-1], value);
119
+ }
120
+ return as([TYPE, entry], value);
121
+ }
122
+ case 1: {
123
+ if (type) {
124
+ let spread = value;
125
+ return type === "DataView" ? spread = new Uint8Array(value.buffer) : type === "ArrayBuffer" && (spread = new Uint8Array(value)), as([type, [...spread]], value);
126
+ }
127
+ let arr = [], index = as([TYPE, arr], value);
128
+ for (let entry of value)
129
+ arr.push(pair(entry));
130
+ return index;
131
+ }
132
+ case 2: {
133
+ if (type)
134
+ switch (type) {
135
+ case "BigInt":
136
+ return as([type, value.toString()], value);
137
+ case "Boolean":
138
+ case "Number":
139
+ case "String":
140
+ return as([type, value.valueOf()], value);
141
+ }
142
+ if (json && "toJSON" in value)
143
+ return pair(value.toJSON());
144
+ let entries = [], index = as([TYPE, entries], value);
145
+ for (let key of keys(value))
146
+ (strict || !shouldSkip(typeOf(value[key]))) && entries.push([pair(key), pair(value[key])]);
147
+ return index;
148
+ }
149
+ case 3:
150
+ return as([TYPE, value.toISOString()], value);
151
+ case 4: {
152
+ let { source, flags } = value;
153
+ return as([TYPE, { source, flags }], value);
154
+ }
155
+ case 5: {
156
+ let entries = [], index = as([TYPE, entries], value);
157
+ for (let [key, entry] of value)
158
+ (strict || !(shouldSkip(typeOf(key)) || shouldSkip(typeOf(entry)))) && entries.push([pair(key), pair(entry)]);
159
+ return index;
160
+ }
161
+ case 6: {
162
+ let entries = [], index = as([TYPE, entries], value);
163
+ for (let entry of value)
164
+ (strict || !shouldSkip(typeOf(entry))) && entries.push(pair(entry));
165
+ return index;
166
+ }
167
+ }
168
+ let { message } = value;
169
+ return as([TYPE, { name: type, message }], value);
170
+ };
171
+ return pair;
172
+ }, serialize = (value, { json, lossy } = {}) => {
173
+ let _ = [];
174
+ return serializer(!(json || lossy), !!json, /* @__PURE__ */ new Map(), _)(value), _;
175
+ };
176
+
177
+ // ../../node_modules/@ungap/structured-clone/esm/index.js
178
+ var esm_default = typeof structuredClone == "function" ? (
179
+ /* c8 ignore start */
180
+ (any, options) => options && ("json" in options || "lossy" in options) ? deserialize(serialize(any, options)) : structuredClone(any)
181
+ ) : (any, options) => deserialize(serialize(any, options));
182
+
183
+ // ../../node_modules/space-separated-tokens/index.js
184
+ function parse(value) {
185
+ let input = String(value || "").trim();
186
+ return input ? input.split(/[ \t\n\r\f]+/g) : [];
187
+ }
188
+ function stringify(values) {
189
+ return values.join(" ").trim();
190
+ }
191
+
192
+ export {
193
+ esm_default,
194
+ parse,
195
+ stringify
196
+ };
@@ -0,0 +1,168 @@
1
+ import CJS_COMPAT_NODE_URL_2pgro2geduh from 'node:url';
2
+ import CJS_COMPAT_NODE_PATH_2pgro2geduh from 'node:path';
3
+ import CJS_COMPAT_NODE_MODULE_2pgro2geduh from "node:module";
4
+
5
+ var __filename = CJS_COMPAT_NODE_URL_2pgro2geduh.fileURLToPath(import.meta.url);
6
+ var __dirname = CJS_COMPAT_NODE_PATH_2pgro2geduh.dirname(__filename);
7
+ var require = CJS_COMPAT_NODE_MODULE_2pgro2geduh.createRequire(import.meta.url);
8
+
9
+ // ------------------------------------------------------------
10
+ // end of CJS compatibility banner, injected by Storybook's esbuild configuration
11
+ // ------------------------------------------------------------
12
+
13
+ // ../../node_modules/unist-util-is/lib/index.js
14
+ var convert = (
15
+ // Note: overloads in JSDoc can’t yet use different `@template`s.
16
+ /**
17
+ * @type {(
18
+ * (<Condition extends string>(test: Condition) => (node: unknown, index?: number | null | undefined, parent?: Parent | null | undefined, context?: unknown) => node is Node & {type: Condition}) &
19
+ * (<Condition extends Props>(test: Condition) => (node: unknown, index?: number | null | undefined, parent?: Parent | null | undefined, context?: unknown) => node is Node & Condition) &
20
+ * (<Condition extends TestFunction>(test: Condition) => (node: unknown, index?: number | null | undefined, parent?: Parent | null | undefined, context?: unknown) => node is Node & Predicate<Condition, Node>) &
21
+ * ((test?: null | undefined) => (node?: unknown, index?: number | null | undefined, parent?: Parent | null | undefined, context?: unknown) => node is Node) &
22
+ * ((test?: Test) => Check)
23
+ * )}
24
+ */
25
+ /**
26
+ * @param {Test} [test]
27
+ * @returns {Check}
28
+ */
29
+ (function(test) {
30
+ if (test == null)
31
+ return ok;
32
+ if (typeof test == "function")
33
+ return castFactory(test);
34
+ if (typeof test == "object")
35
+ return Array.isArray(test) ? anyFactory(test) : (
36
+ // Cast because `ReadonlyArray` goes into the above but `isArray`
37
+ // narrows to `Array`.
38
+ propertiesFactory(
39
+ /** @type {Props} */
40
+ test
41
+ )
42
+ );
43
+ if (typeof test == "string")
44
+ return typeFactory(test);
45
+ throw new Error("Expected function, string, or object as test");
46
+ })
47
+ );
48
+ function anyFactory(tests) {
49
+ let checks = [], index = -1;
50
+ for (; ++index < tests.length; )
51
+ checks[index] = convert(tests[index]);
52
+ return castFactory(any);
53
+ function any(...parameters) {
54
+ let index2 = -1;
55
+ for (; ++index2 < checks.length; )
56
+ if (checks[index2].apply(this, parameters)) return !0;
57
+ return !1;
58
+ }
59
+ }
60
+ function propertiesFactory(check) {
61
+ let checkAsRecord = (
62
+ /** @type {Record<string, unknown>} */
63
+ check
64
+ );
65
+ return castFactory(all);
66
+ function all(node) {
67
+ let nodeAsRecord = (
68
+ /** @type {Record<string, unknown>} */
69
+ /** @type {unknown} */
70
+ node
71
+ ), key;
72
+ for (key in check)
73
+ if (nodeAsRecord[key] !== checkAsRecord[key]) return !1;
74
+ return !0;
75
+ }
76
+ }
77
+ function typeFactory(check) {
78
+ return castFactory(type);
79
+ function type(node) {
80
+ return node && node.type === check;
81
+ }
82
+ }
83
+ function castFactory(testFunction) {
84
+ return check;
85
+ function check(value, index, parent) {
86
+ return !!(looksLikeANode(value) && testFunction.call(
87
+ this,
88
+ value,
89
+ typeof index == "number" ? index : void 0,
90
+ parent || void 0
91
+ ));
92
+ }
93
+ }
94
+ function ok() {
95
+ return !0;
96
+ }
97
+ function looksLikeANode(value) {
98
+ return value !== null && typeof value == "object" && "type" in value;
99
+ }
100
+
101
+ // ../../node_modules/unist-util-visit-parents/lib/color.node.js
102
+ function color(d) {
103
+ return "\x1B[33m" + d + "\x1B[39m";
104
+ }
105
+
106
+ // ../../node_modules/unist-util-visit-parents/lib/index.js
107
+ var empty = [], CONTINUE = !0, EXIT = !1, SKIP = "skip";
108
+ function visitParents(tree, test, visitor, reverse) {
109
+ let check;
110
+ typeof test == "function" && typeof visitor != "function" ? (reverse = visitor, visitor = test) : check = test;
111
+ let is2 = convert(check), step = reverse ? -1 : 1;
112
+ factory(tree, void 0, [])();
113
+ function factory(node, index, parents) {
114
+ let value = (
115
+ /** @type {Record<string, unknown>} */
116
+ node && typeof node == "object" ? node : {}
117
+ );
118
+ if (typeof value.type == "string") {
119
+ let name = (
120
+ // `hast`
121
+ typeof value.tagName == "string" ? value.tagName : (
122
+ // `xast`
123
+ typeof value.name == "string" ? value.name : void 0
124
+ )
125
+ );
126
+ Object.defineProperty(visit2, "name", {
127
+ value: "node (" + color(node.type + (name ? "<" + name + ">" : "")) + ")"
128
+ });
129
+ }
130
+ return visit2;
131
+ function visit2() {
132
+ let result = empty, subresult, offset, grandparents;
133
+ if ((!test || is2(node, index, parents[parents.length - 1] || void 0)) && (result = toResult(visitor(node, parents)), result[0] === EXIT))
134
+ return result;
135
+ if ("children" in node && node.children) {
136
+ let nodeAsParent = (
137
+ /** @type {UnistParent} */
138
+ node
139
+ );
140
+ if (nodeAsParent.children && result[0] !== SKIP)
141
+ for (offset = (reverse ? nodeAsParent.children.length : -1) + step, grandparents = parents.concat(nodeAsParent); offset > -1 && offset < nodeAsParent.children.length; ) {
142
+ let child = nodeAsParent.children[offset];
143
+ if (subresult = factory(child, offset, grandparents)(), subresult[0] === EXIT)
144
+ return subresult;
145
+ offset = typeof subresult[1] == "number" ? subresult[1] : offset + step;
146
+ }
147
+ }
148
+ return result;
149
+ }
150
+ }
151
+ }
152
+ function toResult(value) {
153
+ return Array.isArray(value) ? value : typeof value == "number" ? [CONTINUE, value] : value == null ? empty : [value];
154
+ }
155
+
156
+ // ../../node_modules/unist-util-visit/lib/index.js
157
+ function visit(tree, testOrVisitor, visitorOrReverse, maybeReverse) {
158
+ let reverse, test, visitor;
159
+ typeof testOrVisitor == "function" && typeof visitorOrReverse != "function" ? (test = void 0, visitor = testOrVisitor, reverse = visitorOrReverse) : (test = testOrVisitor, visitor = visitorOrReverse, reverse = maybeReverse), visitParents(tree, test, overload, reverse);
160
+ function overload(node, parents) {
161
+ let parent = parents[parents.length - 1], index = parent ? parent.children.indexOf(node) : void 0;
162
+ return visitor(node, index, parent);
163
+ }
164
+ }
165
+
166
+ export {
167
+ visit
168
+ };