@stoplight/elements-core 9.0.9 → 9.0.11

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/index.mjs CHANGED
@@ -54,7 +54,6 @@ import omitBy from 'lodash/omitBy.js';
54
54
  import { QueryClient, useQueryClient, QueryClientProvider } from 'react-query';
55
55
  import { StaticRouter } from 'react-router-dom/server.js';
56
56
  import $RefParser from '@stoplight/json-schema-ref-parser';
57
- import * as PropTypes from 'prop-types';
58
57
  import isEqual from 'lodash/isEqual.js';
59
58
  import * as ReactDOM from 'react-dom';
60
59
 
@@ -114,6 +113,8 @@ const isResolvedObjectProxy = (someObject) => {
114
113
  return !!someObject[originalObjectSymbol];
115
114
  };
116
115
  const getOriginalObject = (resolvedObject) => {
116
+ if (!resolvedObject)
117
+ return resolvedObject;
117
118
  const originalObject = resolvedObject[originalObjectSymbol] || resolvedObject;
118
119
  if (!originalObject) {
119
120
  return resolvedObject;
@@ -2739,13 +2740,358 @@ const PanelContent = ({ schemes }) => {
2739
2740
  })));
2740
2741
  };
2741
2742
 
2743
+ const TYPES = ['string', 'integer', 'boolean', 'any', 'number'];
2744
+ function resolvePointer(obj, pointer) {
2745
+ const parts = pointer.replace(/^#\//, '').split('/');
2746
+ return parts.reduce((acc, key) => acc && acc[key], obj);
2747
+ }
2748
+ function detectCircularPath(path) {
2749
+ const ignored = ['properties', 'items'];
2750
+ const parts = path.split('/').filter(part => !ignored.includes(part));
2751
+ for (let i = 0; i < parts.length - 1; i++) {
2752
+ const current = parts[i];
2753
+ const rest = parts.slice(i + 1);
2754
+ if (rest.includes(current)) {
2755
+ return true;
2756
+ }
2757
+ }
2758
+ return false;
2759
+ }
2760
+ function dereference(node, root, visited = new WeakSet(), depth = 0, maxDepth = 10) {
2761
+ if (!node || typeof node !== 'object')
2762
+ return node;
2763
+ if (depth > maxDepth)
2764
+ return node;
2765
+ if (node.$ref || node['x-iata-$ref']) {
2766
+ let refPath = node.$ref || node['x-iata-$ref'];
2767
+ if (refPath.includes('#/%24defs')) {
2768
+ refPath = refPath.replace('#/%24defs', '$defs');
2769
+ }
2770
+ else {
2771
+ refPath = refPath.replace('__bundled__', 'definitions');
2772
+ }
2773
+ if (visited.has(node))
2774
+ return { circular: true, $ref: refPath, title: node.title, type: 'any', description: node.description };
2775
+ visited.add(node);
2776
+ const target = resolvePointer(root, refPath);
2777
+ if (!target)
2778
+ return node;
2779
+ const result = Object.assign({}, target);
2780
+ if ('description' in node)
2781
+ result.description = node.description;
2782
+ if ('title' in node)
2783
+ result.title = node.title;
2784
+ return dereference(result, root, visited, depth + 1, maxDepth);
2785
+ }
2786
+ if (Array.isArray(node)) {
2787
+ return node.map(item => dereference(item, root, visited, depth + 1, maxDepth));
2788
+ }
2789
+ const result = {};
2790
+ for (const key in node) {
2791
+ result[key] = dereference(node[key], root, visited, depth + 1, maxDepth);
2792
+ }
2793
+ return result;
2794
+ }
2795
+ const trimSlashes = (str) => {
2796
+ return str.replace(/^\/|\/$/g, '');
2797
+ };
2798
+ function isPropertiesAllHidden(path, hideData) {
2799
+ const current = trimSlashes(path);
2800
+ const parts = current.split('/');
2801
+ for (let i = parts.length; i >= 2; i--) {
2802
+ if (parts[i - 1] === 'properties') {
2803
+ const ancestorPropPath = parts.slice(0, i).join('/');
2804
+ const block = hideData.find(h => trimSlashes(h.path) === ancestorPropPath && ancestorPropPath.endsWith('/properties'));
2805
+ if (block && block.required === undefined) {
2806
+ return true;
2807
+ }
2808
+ }
2809
+ }
2810
+ return false;
2811
+ }
2812
+ function isRequiredOverride(path, hideData) {
2813
+ const entry = hideData.find(h => trimSlashes(h.path) === trimSlashes(path));
2814
+ return entry && typeof entry.required === 'boolean' ? entry.required : undefined;
2815
+ }
2816
+ function isPathHidden(path, hideData, complexData) {
2817
+ const isComplex = checkIfIsComplex(path, complexData);
2818
+ if (isComplex === null) {
2819
+ return false;
2820
+ }
2821
+ else if (isComplex) {
2822
+ const normalizedPath = trimSlashes(path);
2823
+ const direct = hideData.find(h => trimSlashes(h.path) === normalizedPath);
2824
+ if (direct && direct.required === undefined)
2825
+ return true;
2826
+ if (isPropertiesAllHidden(path, hideData))
2827
+ return true;
2828
+ for (const h of hideData) {
2829
+ const hPath = trimSlashes(h.path);
2830
+ if (h.required !== undefined)
2831
+ continue;
2832
+ if (normalizedPath.length > hPath.length &&
2833
+ normalizedPath.startsWith(hPath) &&
2834
+ (hPath.endsWith('/items') || (hPath.match(/\/items\/[^\/]+$/) && normalizedPath.startsWith(hPath + '/')))) {
2835
+ return true;
2836
+ }
2837
+ }
2838
+ return false;
2839
+ }
2840
+ else {
2841
+ return !hideData.some(h => h.path === path || h.path.startsWith(path + '/'));
2842
+ }
2843
+ }
2844
+ const checkIfIsComplex = (path, complexData) => {
2845
+ let isComplex = null;
2846
+ for (const complex of complexData) {
2847
+ if (path.startsWith(complex.location)) {
2848
+ isComplex = complex === null || complex === void 0 ? void 0 : complex.isComplex;
2849
+ break;
2850
+ }
2851
+ }
2852
+ return isComplex;
2853
+ };
2854
+ const LazySchemaTreePreviewer = ({ schema, root = schema, title, level = 1, path = '', hideData = [], complexData = [], parentRequired, propertyKey, _subType, }) => {
2855
+ var _a, _b, _c, _d;
2856
+ const [expanded, setExpanded] = useState(false);
2857
+ const [selectedSchemaIndex, setSelectedSchemaIndex] = useState(0);
2858
+ const [showSchemaDropdown, setShowSchemaDropdown] = useState(false);
2859
+ const [isHoveringSelector, setIsHoveringSelector] = useState(false);
2860
+ const isRoot = level === 1 && (title === undefined || path === '');
2861
+ useEffect(() => {
2862
+ setSelectedSchemaIndex(0);
2863
+ }, [schema === null || schema === void 0 ? void 0 : schema.anyOf, schema === null || schema === void 0 ? void 0 : schema.oneOf]);
2864
+ const thisNodeRequiredOverride = isRequiredOverride(path, hideData);
2865
+ const shouldHideAllChildren = (isRoot && hideData.some(h => trimSlashes(h.path) === 'properties' && h.required === undefined)) ||
2866
+ (!isRoot && isPropertiesAllHidden(path, hideData));
2867
+ const shouldHideNode = useMemo(() => {
2868
+ if (isRoot)
2869
+ return false;
2870
+ if (isPathHidden(path, hideData, complexData) && thisNodeRequiredOverride === undefined)
2871
+ return true;
2872
+ return false;
2873
+ }, [path, hideData, isRoot, thisNodeRequiredOverride, complexData]);
2874
+ if (!schema || shouldHideNode) {
2875
+ return null;
2876
+ }
2877
+ const displayTitle = level === 1 && (title === undefined || path === '') ? '' : (_a = title !== null && title !== void 0 ? title : schema === null || schema === void 0 ? void 0 : schema.title) !== null && _a !== void 0 ? _a : 'Node';
2878
+ const handleToggle = () => {
2879
+ const circular = detectCircularPath(path);
2880
+ if (!circular) {
2881
+ setExpanded(prev => !prev);
2882
+ }
2883
+ };
2884
+ const renderChildren = () => {
2885
+ var _a, _b, _c, _d;
2886
+ if (shouldHideAllChildren)
2887
+ return null;
2888
+ if (!expanded && !isRoot)
2889
+ return null;
2890
+ const children = [];
2891
+ if ((schema === null || schema === void 0 ? void 0 : schema.type) === 'object' && ((schema === null || schema === void 0 ? void 0 : schema.properties) || (schema === null || schema === void 0 ? void 0 : schema.allOf) || (schema === null || schema === void 0 ? void 0 : schema.anyOf) || (schema === null || schema === void 0 ? void 0 : schema.oneOf))) {
2892
+ let props = schema === null || schema === void 0 ? void 0 : schema.properties;
2893
+ if (schema === null || schema === void 0 ? void 0 : schema.allOf) {
2894
+ schema === null || schema === void 0 ? void 0 : schema.allOf.forEach((item) => {
2895
+ props = Object.assign(Object.assign({}, props), item.properties);
2896
+ });
2897
+ }
2898
+ if ((schema === null || schema === void 0 ? void 0 : schema.anyOf) && (schema === null || schema === void 0 ? void 0 : schema.anyOf.length) > 0) {
2899
+ const selectedSchema = (schema === null || schema === void 0 ? void 0 : schema.anyOf[selectedSchemaIndex]) || (schema === null || schema === void 0 ? void 0 : schema.anyOf[0]);
2900
+ props = Object.assign(Object.assign({}, props), selectedSchema.properties);
2901
+ }
2902
+ if ((schema === null || schema === void 0 ? void 0 : schema.oneOf) && (schema === null || schema === void 0 ? void 0 : schema.oneOf.length) > 0) {
2903
+ const selectedSchema = (schema === null || schema === void 0 ? void 0 : schema.oneOf[selectedSchemaIndex]) || (schema === null || schema === void 0 ? void 0 : schema.oneOf[0]);
2904
+ props = Object.assign(Object.assign({}, props), selectedSchema.properties);
2905
+ }
2906
+ for (const [key, child] of Object.entries(props || {})) {
2907
+ const childPath = `${path}/properties/${key}`;
2908
+ const childRequiredOverride = isRequiredOverride(childPath, hideData);
2909
+ const shouldHideChild = isPathHidden(childPath, hideData, complexData) && childRequiredOverride === undefined;
2910
+ const resolved = dereference(child, root);
2911
+ if (!shouldHideChild) {
2912
+ children.push(React__default.createElement("li", { key: key },
2913
+ React__default.createElement(LazySchemaTreePreviewer, { schema: resolved, root: root, title: key, level: level + 1, path: childPath, hideData: hideData, complexData: complexData, parentRequired: schema === null || schema === void 0 ? void 0 : schema.required, propertyKey: key, _subType: (_a = resolved === null || resolved === void 0 ? void 0 : resolved.items) === null || _a === void 0 ? void 0 : _a.type })));
2914
+ }
2915
+ }
2916
+ }
2917
+ else if ((schema === null || schema === void 0 ? void 0 : schema.type) === 'array' &&
2918
+ (schema === null || schema === void 0 ? void 0 : schema.items) &&
2919
+ Object.keys(schema === null || schema === void 0 ? void 0 : schema.items).length > 0 &&
2920
+ !((_b = schema === null || schema === void 0 ? void 0 : schema.items) === null || _b === void 0 ? void 0 : _b.circular)) {
2921
+ const resolvedItems = dereference(schema === null || schema === void 0 ? void 0 : schema.items, root);
2922
+ const itemsPath = `${path}/items`;
2923
+ if (resolvedItems && resolvedItems.type === 'object' && resolvedItems.properties) {
2924
+ for (const [key, child] of Object.entries(resolvedItems.properties)) {
2925
+ const childPath = `${itemsPath}/properties/${key}`;
2926
+ const childRequiredOverride = isRequiredOverride(childPath, hideData);
2927
+ const shouldHideChild = isPathHidden(childPath, hideData, complexData) && childRequiredOverride === undefined;
2928
+ const resolved = dereference(child, root);
2929
+ if (!shouldHideChild) {
2930
+ children.push(React__default.createElement("li", { key: key },
2931
+ React__default.createElement(LazySchemaTreePreviewer, { schema: resolved, root: root, title: key, level: level + 2, path: childPath, hideData: hideData, complexData: complexData, parentRequired: resolvedItems.required, propertyKey: key, _subType: (_c = resolvedItems === null || resolvedItems === void 0 ? void 0 : resolvedItems.items) === null || _c === void 0 ? void 0 : _c.type })));
2932
+ }
2933
+ }
2934
+ }
2935
+ else if (resolvedItems && resolvedItems.type === 'array' && resolvedItems.items.length > 0) {
2936
+ const childPath = `${path}/items`;
2937
+ const childRequiredOverride = isRequiredOverride(childPath, hideData);
2938
+ const shouldHideChild = isPathHidden(childPath, hideData, complexData) && childRequiredOverride === undefined;
2939
+ if (!shouldHideChild) {
2940
+ children.push(React__default.createElement("li", { key: "items" },
2941
+ React__default.createElement(LazySchemaTreePreviewer, { schema: resolvedItems, root: root, title: "items", level: level + 1, path: childPath, hideData: hideData, complexData: complexData, parentRequired: schema === null || schema === void 0 ? void 0 : schema.required, propertyKey: "items", _subType: (_d = resolvedItems === null || resolvedItems === void 0 ? void 0 : resolvedItems.items) === null || _d === void 0 ? void 0 : _d.type })));
2942
+ }
2943
+ }
2944
+ }
2945
+ return children.length > 0 ? React__default.createElement("ul", { className: "ml-6 border-l border-gray-200 pl-2" }, children) : null;
2946
+ };
2947
+ const combinedSchemaSelector = () => {
2948
+ var _a;
2949
+ return (React__default.createElement(React__default.Fragment, null,
2950
+ React__default.createElement(Box, { pos: "fixed", top: 0, left: 0, right: 0, bottom: 0, bg: "transparent", style: { zIndex: 999 }, onClick: () => setShowSchemaDropdown(false) }),
2951
+ React__default.createElement(Box, { pos: "absolute", bg: "canvas", rounded: true, boxShadow: "md", style: {
2952
+ zIndex: 1000,
2953
+ top: '100%',
2954
+ left: 0,
2955
+ minWidth: '150px',
2956
+ maxWidth: '200px',
2957
+ marginTop: '2px',
2958
+ border: '1px solid rgba(0, 0, 0, 0.1)',
2959
+ }, fontSize: "sm", onClick: (e) => e.stopPropagation() }, (_a = ((schema === null || schema === void 0 ? void 0 : schema.anyOf) || (schema === null || schema === void 0 ? void 0 : schema.oneOf))) === null || _a === void 0 ? void 0 : _a.map((schemaOption, index) => (React__default.createElement(Box, { key: index, px: 3, py: 2, cursor: "pointer", bg: selectedSchemaIndex === index ? 'primary-tint' : 'canvas', fontSize: "xs", display: "flex", alignItems: "center", style: {
2960
+ borderBottom: index < ((schema === null || schema === void 0 ? void 0 : schema.anyOf) || (schema === null || schema === void 0 ? void 0 : schema.oneOf)).length - 1 ? '1px solid rgba(0, 0, 0, 0.1)' : 'none',
2961
+ gap: '8px',
2962
+ }, onMouseEnter: (e) => {
2963
+ if (selectedSchemaIndex !== index) {
2964
+ e.currentTarget.style.backgroundColor = 'var(--sl-color-canvas-tint)';
2965
+ }
2966
+ }, onMouseLeave: (e) => {
2967
+ if (selectedSchemaIndex !== index) {
2968
+ e.currentTarget.style.backgroundColor = 'var(--sl-color-canvas)';
2969
+ }
2970
+ }, onClick: () => {
2971
+ setSelectedSchemaIndex(index);
2972
+ setShowSchemaDropdown(false);
2973
+ } },
2974
+ React__default.createElement(Box, { flex: 1, color: "body" }, schemaOption.type || 'object'),
2975
+ selectedSchemaIndex === index && (React__default.createElement(Box, { color: "primary", fontSize: "xs" }, "\u2713"))))))));
2976
+ };
2977
+ const renderMinEnums = (schema) => {
2978
+ if (!schema || typeof schema !== 'object')
2979
+ return null;
2980
+ const boxStyle = {
2981
+ background: 'rgba(245, 247, 250, 0.5)',
2982
+ border: '1px solid #a0aec0',
2983
+ borderRadius: '4px',
2984
+ padding: '0px 2px',
2985
+ display: 'inline-block',
2986
+ overflowWrap: 'break-word',
2987
+ textAlign: 'left',
2988
+ maxWidth: 'fit-content',
2989
+ maxHeight: 'fit-content',
2990
+ };
2991
+ if ('minItems' in schema) {
2992
+ const schemaWithMinItems = schema;
2993
+ if (typeof schemaWithMinItems.minItems === 'number') {
2994
+ return (React__default.createElement(Box, { className: "sl-text-muted", fontFamily: "ui", fontWeight: "normal", mr: 2, style: boxStyle }, `>=${schemaWithMinItems.minItems} items`));
2995
+ }
2996
+ }
2997
+ if ('enum' in schema && Array.isArray(schema.enum)) {
2998
+ return (React__default.createElement("div", null,
2999
+ "Allowed values:",
3000
+ ' ',
3001
+ schema.enum.map((val, idx) => (React__default.createElement(Box, { key: idx, className: "sl-text-muted", fontFamily: "ui", fontWeight: "normal", mr: 2, style: boxStyle }, val)))));
3002
+ }
3003
+ return null;
3004
+ };
3005
+ const isRequired = parentRequired && propertyKey && parentRequired.includes(propertyKey);
3006
+ let showRequiredLabel = false;
3007
+ const hideDataEntry = hideData.find(hideEntry => trimSlashes(hideEntry.path) === trimSlashes(path));
3008
+ if ((hideDataEntry === null || hideDataEntry === void 0 ? void 0 : hideDataEntry.required) === true || ((hideDataEntry === null || hideDataEntry === void 0 ? void 0 : hideDataEntry.required) === undefined && isRequired)) {
3009
+ showRequiredLabel = true;
3010
+ }
3011
+ if (schema === null || schema === void 0 ? void 0 : schema.$ref) {
3012
+ schema = dereference(schema, root);
3013
+ }
3014
+ return (React__default.createElement("div", { className: "mb-1" },
3015
+ React__default.createElement(Flex, { maxW: "full", pl: 3, py: 2, "data-test": "schema-row", pos: "relative" },
3016
+ React__default.createElement(VStack, { spacing: 1, maxW: "full", className: "w-full" },
3017
+ React__default.createElement(Flex, { onClick: !isRoot ? handleToggle : undefined, className: `w-full ${isRoot ? '' : 'cursor-pointer'}` },
3018
+ !isRoot ? (React__default.createElement(Box, { mr: 2, className: "sl-font-mono sl-font-semibold sl-mr-2" },
3019
+ !TYPES.includes(schema === null || schema === void 0 ? void 0 : schema.type) &&
3020
+ !detectCircularPath(path) &&
3021
+ !((_b = schema === null || schema === void 0 ? void 0 : schema.items) === null || _b === void 0 ? void 0 : _b.circular) &&
3022
+ !(schema === null || schema === void 0 ? void 0 : schema.circular) ? (React__default.createElement("i", { role: "img", "aria-hidden": "true", className: `sl-icon fal ${expanded ? 'fa-chevron-down' : 'fa-chevron-right'} fa-fw fa-sm` })) : (React__default.createElement("span", { className: "sl-icon fal fa-fw fa-sm", "aria-hidden": "true" })),
3023
+ ' ' + displayTitle)) : null,
3024
+ !isRoot ? (React__default.createElement(Box, { mr: 2, pos: "relative" },
3025
+ React__default.createElement(Box, { display: "inline-flex", alignItems: "center", onMouseEnter: () => {
3026
+ if ((schema === null || schema === void 0 ? void 0 : schema.anyOf) || (schema === null || schema === void 0 ? void 0 : schema.oneOf)) {
3027
+ setIsHoveringSelector(true);
3028
+ }
3029
+ }, onMouseLeave: () => {
3030
+ if (!showSchemaDropdown) {
3031
+ setIsHoveringSelector(false);
3032
+ }
3033
+ }, onClick: (e) => {
3034
+ if ((schema === null || schema === void 0 ? void 0 : schema.anyOf) || (schema === null || schema === void 0 ? void 0 : schema.oneOf)) {
3035
+ e.stopPropagation();
3036
+ setShowSchemaDropdown(prev => !prev);
3037
+ }
3038
+ }, style: {
3039
+ cursor: (schema === null || schema === void 0 ? void 0 : schema.anyOf) || (schema === null || schema === void 0 ? void 0 : schema.oneOf) ? 'pointer' : 'default',
3040
+ } },
3041
+ React__default.createElement("span", { className: "sl-truncate sl-text-muted" },
3042
+ (() => {
3043
+ let typeDisplay = (schema === null || schema === void 0 ? void 0 : schema.type) === 'object' && (schema === null || schema === void 0 ? void 0 : schema.title) ? schema === null || schema === void 0 ? void 0 : schema.title : (schema === null || schema === void 0 ? void 0 : schema.type) || (root === null || root === void 0 ? void 0 : root.title);
3044
+ if ((schema === null || schema === void 0 ? void 0 : schema.anyOf) && (schema === null || schema === void 0 ? void 0 : schema.anyOf.length) > 0) {
3045
+ return `any of ${typeDisplay}`;
3046
+ }
3047
+ else if ((schema === null || schema === void 0 ? void 0 : schema.oneOf) && (schema === null || schema === void 0 ? void 0 : schema.oneOf.length) > 0) {
3048
+ return `one of ${typeDisplay}`;
3049
+ }
3050
+ return typeDisplay;
3051
+ })(),
3052
+ (schema === null || schema === void 0 ? void 0 : schema.items) && ((_c = schema === null || schema === void 0 ? void 0 : schema.items) === null || _c === void 0 ? void 0 : _c.title) !== undefined ? ` [${(_d = schema === null || schema === void 0 ? void 0 : schema.items) === null || _d === void 0 ? void 0 : _d.title}] ` : null),
3053
+ ((schema === null || schema === void 0 ? void 0 : schema.anyOf) || (schema === null || schema === void 0 ? void 0 : schema.oneOf)) && (React__default.createElement(Box, { display: "inline-flex", alignItems: "center", ml: 1, style: {
3054
+ opacity: isHoveringSelector ? 1 : 0.6,
3055
+ transition: 'opacity 0.2s',
3056
+ } },
3057
+ React__default.createElement("i", { className: "sl-icon fas fa-chevron-down", style: {
3058
+ fontSize: '10px',
3059
+ opacity: 0.6,
3060
+ } })))),
3061
+ React__default.createElement("span", { className: "text-gray-500" }, (schema === null || schema === void 0 ? void 0 : schema.format) !== undefined ? `<${schema === null || schema === void 0 ? void 0 : schema.format}>` : null),
3062
+ ((schema === null || schema === void 0 ? void 0 : schema.anyOf) || (schema === null || schema === void 0 ? void 0 : schema.oneOf)) && showSchemaDropdown && combinedSchemaSelector())) : null),
3063
+ React__default.createElement(Flex, { pl: 1, w: "full", align: "start", direction: "col", style: { overflow: 'visible', paddingLeft: '20px' } },
3064
+ (schema === null || schema === void 0 ? void 0 : schema.description) && (React__default.createElement(Box, { fontFamily: "ui", fontWeight: "light" },
3065
+ React__default.createElement("span", { className: "sl-prose sl-markdown-viewer", style: { fontSize: '12px' } }, schema === null || schema === void 0 ? void 0 : schema.description))),
3066
+ !isRoot && (schema === null || schema === void 0 ? void 0 : schema.examples) !== undefined && (React__default.createElement(Flex, { align: "center", mb: 1, style: { flexWrap: 'wrap' } },
3067
+ React__default.createElement("span", { className: "text-gray-500", style: { marginRight: 8, flexShrink: 0 } }, "Example"),
3068
+ React__default.createElement(Box, { className: "sl-text-muted", fontFamily: "ui", fontWeight: "normal", mr: 2, style: {
3069
+ background: 'rgba(245, 247, 250, 0.5)',
3070
+ border: '1px solid #a0aec0',
3071
+ borderRadius: '4px',
3072
+ padding: '4px 8px',
3073
+ display: 'inline-block',
3074
+ overflowWrap: 'break-word',
3075
+ textAlign: 'left',
3076
+ maxWidth: '530px',
3077
+ } }, JSON.stringify(schema === null || schema === void 0 ? void 0 : schema.examples))))),
3078
+ React__default.createElement(Flex, { pl: 1, w: "full", align: "start", direction: "col", style: { overflow: 'visible', paddingLeft: '20px' } }, schema &&
3079
+ typeof schema === 'object' &&
3080
+ ('minItems' in schema || 'enum' in schema) &&
3081
+ renderMinEnums(schema))),
3082
+ !isRoot && (React__default.createElement("label", { className: "inline-flex items-top ml-2" },
3083
+ React__default.createElement(Box, { mr: 2, fontFamily: "ui", fontWeight: "normal" }, showRequiredLabel && (React__default.createElement("div", { className: "sl-ml-2 sl-text-warning" },
3084
+ React__default.createElement("span", { style: { marginLeft: '10px' } }, "required"))))))),
3085
+ renderChildren()));
3086
+ };
3087
+
2742
3088
  const isBodyEmpty = (body) => {
2743
3089
  if (!body)
2744
3090
  return true;
2745
3091
  const { contents = [], description } = body;
2746
3092
  return contents.length === 0 && !(description === null || description === void 0 ? void 0 : description.trim());
2747
3093
  };
2748
- const Body = ({ body, onChange, isHttpWebhookOperation = false }) => {
3094
+ const Body = ({ body, onChange, isHttpWebhookOperation = false, disableProps }) => {
2749
3095
  var _a;
2750
3096
  const [refResolver, maxRefDepth] = useSchemaInlineRefResolver();
2751
3097
  const [chosenContent, setChosenContent] = React.useState(0);
@@ -2758,13 +3104,36 @@ const Body = ({ body, onChange, isHttpWebhookOperation = false }) => {
2758
3104
  const { contents = [], description } = body;
2759
3105
  const schema = (_a = contents[chosenContent]) === null || _a === void 0 ? void 0 : _a.schema;
2760
3106
  const descriptionChanged = nodeHasChanged === null || nodeHasChanged === void 0 ? void 0 : nodeHasChanged({ nodeId: body.id, attr: 'description' });
3107
+ const getMaskProperties = () => {
3108
+ const disablePropsConfig = disableProps || [];
3109
+ const absolutePathsToHide = [];
3110
+ disablePropsConfig.forEach(configEntry => {
3111
+ const { location, paths, isComplex } = configEntry;
3112
+ if (paths.length === 0 && !isComplex) {
3113
+ absolutePathsToHide.push({ path: location });
3114
+ }
3115
+ else {
3116
+ paths.forEach((item) => {
3117
+ const fullPath = location === '#' ? item === null || item === void 0 ? void 0 : item.path : `${location}/${item.path}`;
3118
+ let object = { path: fullPath };
3119
+ if (item.hasOwnProperty('required')) {
3120
+ object = Object.assign(Object.assign({}, object), { required: item === null || item === void 0 ? void 0 : item.required });
3121
+ }
3122
+ absolutePathsToHide.push(object);
3123
+ });
3124
+ }
3125
+ });
3126
+ return absolutePathsToHide;
3127
+ };
3128
+ const shouldUseLazySchema = disableProps === null || disableProps === void 0 ? void 0 : disableProps.some(entry => entry.isComplex === true);
3129
+ console.log('!!!!! shouldUseLazySchema body!!!!', shouldUseLazySchema);
2761
3130
  return (React.createElement(VStack, { spacing: 6 },
2762
3131
  React.createElement(SectionSubtitle, { title: "Body", id: "request-body" }, contents.length > 0 && (React.createElement(Flex, { flex: 1, justify: "end" },
2763
3132
  React.createElement(Select, { "aria-label": "Request Body Content Type", value: String(chosenContent), onChange: value => setChosenContent(parseInt(String(value), 10)), options: contents.map((content, index) => ({ label: content.mediaType, value: index })), size: "sm" })))),
2764
3133
  description && (React.createElement(Box, { pos: "relative" },
2765
3134
  React.createElement(MarkdownViewer, { markdown: description }),
2766
3135
  React.createElement(NodeAnnotation, { change: descriptionChanged }))),
2767
- isJSONSchema(schema) && (React.createElement(JsonSchemaViewer, { resolveRef: refResolver, maxRefDepth: maxRefDepth, schema: getOriginalObject(schema), viewMode: isHttpWebhookOperation ? 'standalone' : 'write', renderRootTreeLines: true, nodeHasChanged: nodeHasChanged, renderExtensionAddon: renderExtensionAddon }))));
3136
+ schema && shouldUseLazySchema ? (React.createElement(LazySchemaTreePreviewer, { schema: schema, hideData: getMaskProperties(), complexData: disableProps })) : (isJSONSchema(schema) && (React.createElement(JsonSchemaViewer, { resolveRef: refResolver, maxRefDepth: maxRefDepth, schema: getOriginalObject(schema), viewMode: isHttpWebhookOperation ? 'standalone' : 'write', renderRootTreeLines: true, nodeHasChanged: nodeHasChanged, renderExtensionAddon: renderExtensionAddon })))));
2768
3137
  };
2769
3138
  Body.displayName = 'HttpOperation.Body';
2770
3139
 
@@ -2831,7 +3200,7 @@ const httpOperationParamsToSchema = ({ parameters, parameterType }) => {
2831
3200
  return schema;
2832
3201
  };
2833
3202
 
2834
- const Request = ({ operation: { request, request: { path: pathParams = [], headers: headerParams = [], cookie: cookieParams = [], body, query: queryParams = [], } = {}, security, }, hideSecurityInfo, onChange, isHttpWebhookOperation = false, }) => {
3203
+ const Request = ({ operation: { request, request: { path: pathParams = [], headers: headerParams = [], cookie: cookieParams = [], body, query: queryParams = [], } = {}, security, }, hideSecurityInfo, onChange, isHttpWebhookOperation = false, disableProps, }) => {
2835
3204
  if (!request || typeof request !== 'object')
2836
3205
  return null;
2837
3206
  const bodyIsEmpty = isBodyEmpty(body);
@@ -2859,7 +3228,7 @@ const Request = ({ operation: { request, request: { path: pathParams = [], heade
2859
3228
  cookieParams.length > 0 && (React.createElement(VStack, { spacing: 5 },
2860
3229
  React.createElement(SectionSubtitle, { title: "Cookies", id: "request-cookies" }),
2861
3230
  React.createElement(Parameters, { parameterType: "cookie", parameters: cookieParams }))),
2862
- body && React.createElement(Body, { onChange: onChange, body: body, isHttpWebhookOperation: isHttpWebhookOperation })));
3231
+ body && (React.createElement(Body, { onChange: onChange, body: body, isHttpWebhookOperation: isHttpWebhookOperation, disableProps: disableProps }))));
2863
3232
  };
2864
3233
  Request.displayName = 'HttpOperation.Request';
2865
3234
  const schemeExpandedState = atomWithStorage('HttpOperation_security_expanded', {});
@@ -2890,7 +3259,7 @@ const OptionalMessage$1 = () => {
2890
3259
  return React.createElement(Callout, { appearance: "outline" }, OptionalSecurityMessage);
2891
3260
  };
2892
3261
 
2893
- const Responses = ({ responses: unsortedResponses, onStatusCodeChange, onMediaTypeChange, isCompact, }) => {
3262
+ const Responses = ({ responses: unsortedResponses, onStatusCodeChange, onMediaTypeChange, isCompact, disableProps, }) => {
2894
3263
  var _a, _b;
2895
3264
  const responses = sortBy(uniqBy(unsortedResponses, r => r.code), r => r.code);
2896
3265
  const [activeResponseId, setActiveResponseId] = React.useState((_b = (_a = responses[0]) === null || _a === void 0 ? void 0 : _a.code) !== null && _b !== void 0 ? _b : '');
@@ -2923,11 +3292,12 @@ const Responses = ({ responses: unsortedResponses, onStatusCodeChange, onMediaTy
2923
3292
  const tabResponses = (React.createElement(TabList, { density: "compact" }, responses.map(({ code }) => (React.createElement(Tab, { key: code, id: code, intent: codeToIntentVal(code) }, code)))));
2924
3293
  return (React.createElement(VStack, { spacing: 8, as: Tabs, selectedId: activeResponseId, onChange: setActiveResponseId, appearance: "pill" },
2925
3294
  React.createElement(SectionTitle, { title: "Responses", isCompact: isCompact }, isCompact ? compactResponses : tabResponses),
2926
- isCompact ? (React.createElement(Response, { response: response, onMediaTypeChange: onMediaTypeChange })) : (React.createElement(TabPanels, { p: 0 }, responses.map(response => (React.createElement(TabPanel, { key: response.code, id: response.code },
2927
- React.createElement(Response, { response: response, onMediaTypeChange: onMediaTypeChange }))))))));
3295
+ isCompact ? (React.createElement(Response, { response: response, onMediaTypeChange: onMediaTypeChange, disableProps: disableProps, statusCode: activeResponseId })) : (React.createElement(TabPanels, { p: 0 }, responses.map(response => (React.createElement(TabPanel, { key: response.code, id: response.code },
3296
+ React.createElement(Response, { response: response, onMediaTypeChange: onMediaTypeChange, disableProps: disableProps, statusCode: response.code }))))))));
2928
3297
  };
2929
3298
  Responses.displayName = 'HttpOperation.Responses';
2930
- const Response = ({ response, onMediaTypeChange }) => {
3299
+ const Response = ({ response, onMediaTypeChange, disableProps, statusCode }) => {
3300
+ var _a, _b;
2931
3301
  const { contents = [], headers = [], description } = response;
2932
3302
  const [chosenContent, setChosenContent] = React.useState(0);
2933
3303
  const [refResolver, maxRefDepth] = useSchemaInlineRefResolver();
@@ -2938,6 +3308,29 @@ const Response = ({ response, onMediaTypeChange }) => {
2938
3308
  responseContent && (onMediaTypeChange === null || onMediaTypeChange === void 0 ? void 0 : onMediaTypeChange(responseContent.mediaType));
2939
3309
  }, [responseContent]);
2940
3310
  const descriptionChanged = nodeHasChanged === null || nodeHasChanged === void 0 ? void 0 : nodeHasChanged({ nodeId: response.id, attr: 'description' });
3311
+ const getMaskProperties = () => {
3312
+ if (!disableProps || !statusCode)
3313
+ return [];
3314
+ const configEntries = disableProps[statusCode] || [];
3315
+ const absolutePathsToHide = [];
3316
+ configEntries.forEach(({ location, paths, isComplex }) => {
3317
+ if (paths.length === 0 && !isComplex) {
3318
+ absolutePathsToHide.push({ path: location });
3319
+ }
3320
+ else {
3321
+ paths.forEach((item) => {
3322
+ const fullPath = location === '#' ? item === null || item === void 0 ? void 0 : item.path : `${location}/${item.path}`;
3323
+ let object = { path: fullPath };
3324
+ if (item.hasOwnProperty('required')) {
3325
+ object = Object.assign(Object.assign({}, object), { required: item === null || item === void 0 ? void 0 : item.required });
3326
+ }
3327
+ absolutePathsToHide.push(object);
3328
+ });
3329
+ }
3330
+ });
3331
+ return absolutePathsToHide;
3332
+ };
3333
+ const shouldUseLazySchema = (_b = (statusCode && ((_a = disableProps === null || disableProps === void 0 ? void 0 : disableProps[statusCode]) === null || _a === void 0 ? void 0 : _a.some(entry => entry.isComplex)))) !== null && _b !== void 0 ? _b : false;
2941
3334
  return (React.createElement(VStack, { spacing: 8, pt: 8 },
2942
3335
  description && (React.createElement(Box, { pos: "relative" },
2943
3336
  React.createElement(MarkdownViewer, { markdown: description }),
@@ -2949,7 +3342,7 @@ const Response = ({ response, onMediaTypeChange }) => {
2949
3342
  React.createElement(SectionSubtitle, { title: "Body", id: "response-body" },
2950
3343
  React.createElement(Flex, { flex: 1, justify: "end" },
2951
3344
  React.createElement(Select, { "aria-label": "Response Body Content Type", value: String(chosenContent), onChange: value => setChosenContent(parseInt(String(value), 10)), options: contents.map((content, index) => ({ label: content.mediaType, value: index })), size: "sm" }))),
2952
- schema && (React.createElement(JsonSchemaViewer, { schema: getOriginalObject(schema), resolveRef: refResolver, maxRefDepth: maxRefDepth, viewMode: "read", parentCrumbs: ['responses', response.code], renderRootTreeLines: true, nodeHasChanged: nodeHasChanged, renderExtensionAddon: renderExtensionAddon }))))));
3345
+ schema && shouldUseLazySchema ? (React.createElement(LazySchemaTreePreviewer, { schema: schema, path: "", hideData: getMaskProperties(), complexData: disableProps && statusCode ? disableProps[statusCode] : [] })) : (React.createElement(JsonSchemaViewer, { schema: getOriginalObject(schema), resolveRef: refResolver, maxRefDepth: maxRefDepth, viewMode: "read", parentCrumbs: ['responses', response.code], renderRootTreeLines: true, nodeHasChanged: nodeHasChanged, renderExtensionAddon: renderExtensionAddon }))))));
2953
3346
  };
2954
3347
  Response.displayName = 'HttpOperation.Response';
2955
3348
  const codeToIntentVal = (code) => {
@@ -2998,7 +3391,7 @@ const Callback = ({ data, isCompact }) => {
2998
3391
  };
2999
3392
  Callbacks.displayName = 'HttpOperation.Callback';
3000
3393
 
3001
- const HttpOperationComponent = React.memo(({ className, data: unresolvedData, layoutOptions, tryItCredentialsPolicy, tryItCorsProxy }) => {
3394
+ const HttpOperationComponent = React.memo(({ className, data: unresolvedData, layoutOptions, tryItCredentialsPolicy, tryItCorsProxy, disableProps }) => {
3002
3395
  var _a;
3003
3396
  const { nodeHasChanged } = useOptionsCtx();
3004
3397
  const data = useResolvedObject(unresolvedData);
@@ -3029,11 +3422,11 @@ const HttpOperationComponent = React.memo(({ className, data: unresolvedData, la
3029
3422
  React.createElement(MarkdownViewer, { className: "HttpOperation__Description", markdown: data.description }),
3030
3423
  React.createElement(NodeAnnotation, { change: descriptionChanged }))),
3031
3424
  React.createElement(NodeVendorExtensions, { data: data }),
3032
- React.createElement(Request, { onChange: setTextRequestBodyIndex, operation: data, hideSecurityInfo: layoutOptions === null || layoutOptions === void 0 ? void 0 : layoutOptions.hideSecurityInfo, isHttpWebhookOperation: isHttpWebhookOperation(data) }),
3033
- data.responses && (React.createElement(Responses, { responses: data.responses, onMediaTypeChange: setResponseMediaType, onStatusCodeChange: setResponseStatusCode, isCompact: isCompact })),
3425
+ React.createElement(Request, { onChange: setTextRequestBodyIndex, operation: data, hideSecurityInfo: layoutOptions === null || layoutOptions === void 0 ? void 0 : layoutOptions.hideSecurityInfo, isHttpWebhookOperation: isHttpWebhookOperation(data), disableProps: disableProps === null || disableProps === void 0 ? void 0 : disableProps.request }),
3426
+ data.responses && (React.createElement(Responses, { responses: data.responses, onMediaTypeChange: setResponseMediaType, onStatusCodeChange: setResponseStatusCode, isCompact: isCompact, disableProps: disableProps === null || disableProps === void 0 ? void 0 : disableProps.response })),
3034
3427
  ((_a = data.callbacks) === null || _a === void 0 ? void 0 : _a.length) ? React.createElement(Callbacks, { callbacks: data.callbacks, isCompact: isCompact }) : null,
3035
3428
  isCompact && tryItPanel));
3036
- return (React.createElement(TwoColumnLayout, { ref: layoutRef, className: cn('HttpOperation', className), header: header, left: description, right: !isCompact && tryItPanel }));
3429
+ return (React.createElement(TwoColumnLayout, { ref: layoutRef, className: cn('HttpOperation', className), header: header, left: description, right: !(disableProps === null || disableProps === void 0 ? void 0 : disableProps.hideOperationTryIt) && !isCompact && tryItPanel }));
3037
3430
  });
3038
3431
  HttpOperationComponent.displayName = 'HttpOperation.Component';
3039
3432
  const HttpOperation = withErrorBoundary(HttpOperationComponent, {
@@ -3284,7 +3677,7 @@ const HttpServiceComponent = React.memo(({ data: unresolvedData, location = {},
3284
3677
  HttpServiceComponent.displayName = 'HttpService.Component';
3285
3678
  const HttpService = withErrorBoundary(HttpServiceComponent, { recoverableProps: ['data'] });
3286
3679
 
3287
- const ModelComponent = ({ data: unresolvedData, className, nodeTitle, layoutOptions, exportProps, }) => {
3680
+ const ModelComponent = ({ data: unresolvedData, className, nodeTitle, layoutOptions, exportProps, disableProps, }) => {
3288
3681
  var _a, _b;
3289
3682
  const [resolveRef, maxRefDepth] = useSchemaInlineRefResolver();
3290
3683
  const data = useResolvedObject(unresolvedData);
@@ -3307,14 +3700,40 @@ const ModelComponent = ({ data: unresolvedData, className, nodeTitle, layoutOpti
3307
3700
  exportProps && !(layoutOptions === null || layoutOptions === void 0 ? void 0 : layoutOptions.hideExport) && !isCompact && React.createElement(ExportButton, Object.assign({}, exportProps))));
3308
3701
  const modelExamples = !(layoutOptions === null || layoutOptions === void 0 ? void 0 : layoutOptions.hideModelExamples) && React.createElement(ModelExamples, { data: data, isCollapsible: isCompact });
3309
3702
  const descriptionChanged = nodeHasChanged === null || nodeHasChanged === void 0 ? void 0 : nodeHasChanged({ nodeId, attr: 'description' });
3703
+ const getMaskProperties = () => {
3704
+ const disablePropsConfig = disableProps === null || disableProps === void 0 ? void 0 : disableProps.models;
3705
+ const absolutePathsToHide = [];
3706
+ if (disableProps === null || disableProps === void 0 ? void 0 : disableProps.models) {
3707
+ disablePropsConfig.forEach((configEntry) => {
3708
+ const { location, paths, isComplex } = configEntry;
3709
+ if (paths.length === 0 && !isComplex) {
3710
+ absolutePathsToHide.push({ path: location });
3711
+ }
3712
+ else {
3713
+ paths.forEach((item) => {
3714
+ const fullPath = location === '#' ? item === null || item === void 0 ? void 0 : item.path : `${location}/${item.path}`;
3715
+ let object = { path: fullPath };
3716
+ if (item.hasOwnProperty('required')) {
3717
+ object = Object.assign(Object.assign({}, object), { required: item === null || item === void 0 ? void 0 : item.required });
3718
+ }
3719
+ absolutePathsToHide.push(object);
3720
+ });
3721
+ }
3722
+ });
3723
+ }
3724
+ return absolutePathsToHide;
3725
+ };
3726
+ const shouldUseLazySchema = disableProps && (disableProps === null || disableProps === void 0 ? void 0 : disableProps.models)
3727
+ ? disableProps.models.some((entry) => entry.isComplex === true)
3728
+ : false;
3310
3729
  const description = (React.createElement(VStack, { spacing: 10 },
3311
3730
  data.description && data.type === 'object' && (React.createElement(Box, { pos: "relative" },
3312
3731
  React.createElement(MarkdownViewer, { role: "textbox", markdown: data.description }),
3313
3732
  React.createElement(NodeAnnotation, { change: descriptionChanged }))),
3314
3733
  React.createElement(NodeVendorExtensions, { data: data }),
3315
- isCompact && modelExamples,
3316
- React.createElement(JsonSchemaViewer, { resolveRef: resolveRef, maxRefDepth: maxRefDepth, schema: getOriginalObject(data), nodeHasChanged: nodeHasChanged, renderExtensionAddon: renderExtensionAddon, skipTopLevelDescription: true })));
3317
- return (React.createElement(TwoColumnLayout, { ref: layoutRef, className: cn('Model', className), header: header, left: description, right: !isCompact && modelExamples }));
3734
+ !(disableProps === null || disableProps === void 0 ? void 0 : disableProps.hideModelTryIt) && isCompact && modelExamples,
3735
+ data && shouldUseLazySchema ? (React.createElement(LazySchemaTreePreviewer, { schema: data, hideData: getMaskProperties(), complexData: disableProps === null || disableProps === void 0 ? void 0 : disableProps.models })) : (React.createElement(JsonSchemaViewer, { resolveRef: resolveRef, maxRefDepth: maxRefDepth, schema: getOriginalObject(data), nodeHasChanged: nodeHasChanged, renderExtensionAddon: renderExtensionAddon, skipTopLevelDescription: true }))));
3736
+ return (React.createElement(TwoColumnLayout, { ref: layoutRef, className: cn('Model', className), header: header, left: description, right: !(disableProps === null || disableProps === void 0 ? void 0 : disableProps.hideModelTryIt) && !isCompact && modelExamples }));
3318
3737
  };
3319
3738
  const ModelExamples = React.memo(({ data, isCollapsible = false }) => {
3320
3739
  var _a;
@@ -3336,30 +3755,41 @@ const Model = withErrorBoundary(ModelComponent, { recoverableProps: ['data'] });
3336
3755
 
3337
3756
  const Docs = React.memo((_a) => {
3338
3757
  var _b;
3339
- var { nodeType, nodeData, useNodeForRefResolving = false, refResolver, maxRefDepth, nodeHasChanged, renderExtensionAddon } = _a, commonProps = __rest(_a, ["nodeType", "nodeData", "useNodeForRefResolving", "refResolver", "maxRefDepth", "nodeHasChanged", "renderExtensionAddon"]);
3758
+ var { nodeType, nodeData, disableProps, useNodeForRefResolving = false, refResolver, maxRefDepth, nodeHasChanged, renderExtensionAddon } = _a, commonProps = __rest(_a, ["nodeType", "nodeData", "disableProps", "useNodeForRefResolving", "refResolver", "maxRefDepth", "nodeHasChanged", "renderExtensionAddon"]);
3340
3759
  const parsedNode = useParsedData(nodeType, nodeData);
3341
3760
  if (!parsedNode) {
3342
3761
  (_b = commonProps.nodeUnsupported) === null || _b === void 0 ? void 0 : _b.call(commonProps, 'dataEmpty');
3343
3762
  return null;
3344
3763
  }
3345
- let elem = React.createElement(ParsedDocs, Object.assign({ node: parsedNode }, commonProps));
3764
+ let elem = React.createElement(ParsedDocs, Object.assign({ node: parsedNode, disableProps: disableProps }, commonProps));
3346
3765
  if (useNodeForRefResolving) {
3347
3766
  elem = (React.createElement(InlineRefResolverProvider, { document: parsedNode.data, resolver: refResolver, maxRefDepth: maxRefDepth }, elem));
3348
3767
  }
3349
3768
  return (React.createElement(ElementsOptionsProvider, { nodeHasChanged: nodeHasChanged, renderExtensionAddon: renderExtensionAddon }, elem));
3350
3769
  });
3770
+ const getTryItVisibility = (disableProps) => {
3771
+ var _a, _b, _c, _d;
3772
+ if (!disableProps)
3773
+ return { hideOperationTryIt: false, hideModelTryIt: false };
3774
+ const requestHasComplex = (_b = (_a = disableProps.request) === null || _a === void 0 ? void 0 : _a.some(item => item.isComplex)) !== null && _b !== void 0 ? _b : false;
3775
+ const responseHasComplex = Object.values(disableProps.response || {}).some(arr => arr.some(item => item.isComplex));
3776
+ const hideOperationTryIt = requestHasComplex || responseHasComplex;
3777
+ const hideModelTryIt = (_d = (_c = disableProps.models) === null || _c === void 0 ? void 0 : _c.some(item => item.isComplex)) !== null && _d !== void 0 ? _d : false;
3778
+ return { hideOperationTryIt, hideModelTryIt };
3779
+ };
3351
3780
  const ParsedDocs = (_a) => {
3352
- var { node, nodeUnsupported } = _a, commonProps = __rest(_a, ["node", "nodeUnsupported"]);
3781
+ var { node, nodeUnsupported, disableProps } = _a, commonProps = __rest(_a, ["node", "nodeUnsupported", "disableProps"]);
3782
+ const { hideOperationTryIt, hideModelTryIt } = getTryItVisibility(disableProps);
3353
3783
  switch (node.type) {
3354
3784
  case 'article':
3355
3785
  return React.createElement(Article, Object.assign({ data: node.data }, commonProps));
3356
3786
  case 'http_operation':
3357
3787
  case 'http_webhook':
3358
- return React.createElement(HttpOperation, Object.assign({ data: node.data }, commonProps));
3788
+ return React.createElement(HttpOperation, Object.assign({ data: node.data, disableProps: Object.assign(Object.assign({}, disableProps), { hideOperationTryIt }) }, commonProps));
3359
3789
  case 'http_service':
3360
3790
  return React.createElement(HttpService, Object.assign({ data: node.data }, commonProps));
3361
3791
  case 'model':
3362
- return React.createElement(Model, Object.assign({ data: node.data }, commonProps));
3792
+ return React.createElement(Model, Object.assign({ data: node.data, disableProps: Object.assign(Object.assign({}, disableProps), { hideModelTryIt }) }, commonProps));
3363
3793
  default:
3364
3794
  nodeUnsupported === null || nodeUnsupported === void 0 ? void 0 : nodeUnsupported('invalidType');
3365
3795
  return null;
@@ -4105,25 +4535,12 @@ const doBundle = (data, baseUrl) => {
4105
4535
  }
4106
4536
  };
4107
4537
 
4108
- const scopeClassName = 'sl-elements';
4109
- class Styled extends React.Component {
4110
- getChildContext() {
4111
- return {
4112
- blueprintPortalClassName: scopeClassName,
4113
- };
4114
- }
4115
- render() {
4116
- return (React.createElement(Box, { className: "sl-elements sl-antialiased", fontFamily: "ui", fontSize: "base", color: "body", h: "full" }, this.props.children));
4117
- }
4118
- }
4119
- Styled.childContextTypes = {
4120
- blueprintPortalClassName: PropTypes.string,
4538
+ const Styled = ({ children }) => {
4539
+ return (React.createElement(Box, { className: "sl-elements sl-antialiased", fontFamily: "ui", fontSize: "base", color: "body", h: "full" }, children));
4121
4540
  };
4122
4541
  function withStyles(Component) {
4123
- const Inner = props => {
4124
- return (React.createElement(Styled, null,
4125
- React.createElement(Component, Object.assign({}, props))));
4126
- };
4542
+ const Inner = props => (React.createElement(Styled, null,
4543
+ React.createElement(Component, Object.assign({}, props))));
4127
4544
  Inner.displayName = `withStyles(${getDisplayName(Component)})`;
4128
4545
  return Inner;
4129
4546
  }
@@ -4173,7 +4590,7 @@ const createElementClass = (Component, propDescriptors) => {
4173
4590
  }
4174
4591
  disconnectedCallback() {
4175
4592
  if (this._mountPoint) {
4176
- ReactDOM.unmountComponentAtNode(this._mountPoint);
4593
+ ReactDOM.render(null, this._mountPoint);
4177
4594
  this.removeChild(this._mountPoint);
4178
4595
  this._mountPoint = undefined;
4179
4596
  }