@superinterface/react 3.5.1 → 3.5.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.cts CHANGED
@@ -581,7 +581,7 @@ type MarkdownContextType = {
581
581
  };
582
582
  declare const MarkdownContext: react.Context<MarkdownContextType>;
583
583
 
584
- declare const MarkdownProvider: ({ children, components, ...rest }: {
584
+ declare const MarkdownProvider: ({ children, ...rest }: {
585
585
  children: React.ReactNode;
586
586
  } & Partial<MarkdownContextType>) => react_jsx_runtime.JSX.Element;
587
587
 
package/dist/index.d.ts CHANGED
@@ -581,7 +581,7 @@ type MarkdownContextType = {
581
581
  };
582
582
  declare const MarkdownContext: react.Context<MarkdownContextType>;
583
583
 
584
- declare const MarkdownProvider: ({ children, components, ...rest }: {
584
+ declare const MarkdownProvider: ({ children, ...rest }: {
585
585
  children: React.ReactNode;
586
586
  } & Partial<MarkdownContextType>) => react_jsx_runtime.JSX.Element;
587
587
 
package/dist/index.js CHANGED
@@ -912,7 +912,147 @@ import { useState as useState2, useEffect as useEffect2, useMemo as useMemo8 } f
912
912
  import { compile } from "@mdx-js/mdx";
913
913
  import { MDXProvider, useMDXComponents } from "@mdx-js/react";
914
914
  import * as runtime from "react/jsx-runtime";
915
- import recmaMdxEscapeMissingComponents from "recma-mdx-escape-missing-components";
915
+ // src/lib/recma/recmaFallbackComponentPlugin.ts
916
+ import { visit, CONTINUE, SKIP } from "estree-util-visit";
917
+ var recmaFallbackComponentPlugin = function() {
918
+ return function(tree) {
919
+ visit(tree, function(node) {
920
+ if (node.type === "VariableDeclaration" && node.kind === "const") {
921
+ var varDecl = node;
922
+ var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
923
+ try {
924
+ for(var _iterator = varDecl.declarations[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
925
+ var declarator = _step.value;
926
+ var _declarator_init;
927
+ if (declarator.id.type === "ObjectPattern" && ((_declarator_init = declarator.init) === null || _declarator_init === void 0 ? void 0 : _declarator_init.type) === "Identifier" && declarator.init.name === "_components") {
928
+ varDecl.kind = "let";
929
+ return SKIP;
930
+ }
931
+ }
932
+ } catch (err) {
933
+ _didIteratorError = true;
934
+ _iteratorError = err;
935
+ } finally{
936
+ try {
937
+ if (!_iteratorNormalCompletion && _iterator.return != null) {
938
+ _iterator.return();
939
+ }
940
+ } finally{
941
+ if (_didIteratorError) {
942
+ throw _iteratorError;
943
+ }
944
+ }
945
+ }
946
+ }
947
+ return CONTINUE;
948
+ });
949
+ visit(tree, function(node) {
950
+ var _node_id;
951
+ if (node.type === "FunctionDeclaration" && ((_node_id = node.id) === null || _node_id === void 0 ? void 0 : _node_id.type) === "Identifier" && node.id.name === "_missingMdxReference") {
952
+ var funcNode = node;
953
+ funcNode.body = {
954
+ type: "BlockStatement",
955
+ body: [
956
+ {
957
+ type: "IfStatement",
958
+ test: {
959
+ type: "Identifier",
960
+ name: "component"
961
+ },
962
+ consequent: {
963
+ type: "ReturnStatement",
964
+ argument: {
965
+ type: "FunctionExpression",
966
+ id: null,
967
+ params: [
968
+ {
969
+ type: "Identifier",
970
+ name: "props"
971
+ }
972
+ ],
973
+ body: {
974
+ type: "BlockStatement",
975
+ body: [
976
+ {
977
+ type: "ReturnStatement",
978
+ argument: {
979
+ type: "BinaryExpression",
980
+ operator: "+",
981
+ left: {
982
+ type: "BinaryExpression",
983
+ operator: "+",
984
+ left: {
985
+ type: "Literal",
986
+ value: "<"
987
+ },
988
+ right: {
989
+ type: "Identifier",
990
+ name: "id"
991
+ }
992
+ },
993
+ right: {
994
+ type: "BinaryExpression",
995
+ operator: "+",
996
+ left: {
997
+ type: "Literal",
998
+ value: "></"
999
+ },
1000
+ right: {
1001
+ type: "BinaryExpression",
1002
+ operator: "+",
1003
+ left: {
1004
+ type: "Identifier",
1005
+ name: "id"
1006
+ },
1007
+ right: {
1008
+ type: "Literal",
1009
+ value: ">"
1010
+ }
1011
+ }
1012
+ }
1013
+ }
1014
+ }
1015
+ ]
1016
+ },
1017
+ generator: false,
1018
+ async: false
1019
+ }
1020
+ },
1021
+ alternate: null
1022
+ }
1023
+ ]
1024
+ };
1025
+ return SKIP;
1026
+ }
1027
+ return CONTINUE;
1028
+ });
1029
+ visit(tree, function(node) {
1030
+ if (node.type === "IfStatement") {
1031
+ var ifNode = node;
1032
+ if (ifNode.test.type === "UnaryExpression" && ifNode.test.operator === "!" && ifNode.test.argument.type === "Identifier") {
1033
+ var componentName = ifNode.test.argument.name;
1034
+ if (ifNode.consequent.type === "ExpressionStatement" && ifNode.consequent.expression.type === "CallExpression" && ifNode.consequent.expression.callee.type === "Identifier" && ifNode.consequent.expression.callee.name === "_missingMdxReference") {
1035
+ var assignmentExpr = {
1036
+ type: "AssignmentExpression",
1037
+ operator: "=",
1038
+ left: {
1039
+ type: "Identifier",
1040
+ name: componentName
1041
+ },
1042
+ right: ifNode.consequent.expression
1043
+ };
1044
+ ifNode.consequent = {
1045
+ type: "ExpressionStatement",
1046
+ expression: assignmentExpr
1047
+ };
1048
+ return SKIP;
1049
+ }
1050
+ }
1051
+ }
1052
+ return CONTINUE;
1053
+ });
1054
+ };
1055
+ };
916
1056
  // src/hooks/markdown/useMarkdownContext/index.ts
917
1057
  import { useContext as useContext5 } from "react";
918
1058
  // src/contexts/markdown/MarkdownContext/index.ts
@@ -2789,7 +2929,7 @@ var TextContent = function(param) {
2789
2929
  outputFormat: "function-body",
2790
2930
  remarkPlugins: remarkPlugins,
2791
2931
  recmaPlugins: [
2792
- recmaMdxEscapeMissingComponents
2932
+ recmaFallbackComponentPlugin
2793
2933
  ],
2794
2934
  providerImportSource: "@mdx-js/react"
2795
2935
  })
@@ -5602,9 +5742,8 @@ AudioThreadDialog.Content = Content7;
5602
5742
  import { useMemo as useMemo18 } from "react";
5603
5743
  import { jsx as jsx92 } from "react/jsx-runtime";
5604
5744
  var MarkdownProvider = function(_param) {
5605
- var children = _param.children, components2 = _param.components, rest = _object_without_properties(_param, [
5606
- "children",
5607
- "components"
5745
+ var children = _param.children, rest = _object_without_properties(_param, [
5746
+ "children"
5608
5747
  ]);
5609
5748
  var prevMarkdownContext = useMarkdownContext();
5610
5749
  var value = useMemo18(function() {