@stoplight/elements-core 9.0.12-beta-0.4 → 9.0.13-beta-0.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/index.esm.js CHANGED
@@ -54,6 +54,7 @@ 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';
57
58
  import isEqual from 'lodash/isEqual.js';
58
59
  import * as ReactDOM from 'react-dom';
59
60
 
@@ -2858,70 +2859,12 @@ const LazySchemaTreePreviewer = ({ schema, root = schema, title, level = 1, path
2858
2859
  const [showSchemaDropdown, setShowSchemaDropdown] = useState(false);
2859
2860
  const [isHoveringSelector, setIsHoveringSelector] = useState(false);
2860
2861
  const isRoot = level === 1 && (title === undefined || path === '');
2861
- console.log("In LazySchemaTreePreviewer Beta 0.2:", { schema, path, isRoot });
2862
2862
  useEffect(() => {
2863
2863
  setSelectedSchemaIndex(0);
2864
2864
  }, [schema === null || schema === void 0 ? void 0 : schema.anyOf, schema === null || schema === void 0 ? void 0 : schema.oneOf]);
2865
2865
  const thisNodeRequiredOverride = isRequiredOverride(path, hideData);
2866
2866
  const shouldHideAllChildren = (isRoot && hideData.some(h => trimSlashes(h.path) === 'properties' && h.required === undefined)) ||
2867
2867
  (!isRoot && isPropertiesAllHidden(path, hideData));
2868
- const hasExpandableChildren = useMemo(() => {
2869
- var _a;
2870
- if (shouldHideAllChildren)
2871
- return false;
2872
- 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))) {
2873
- let props = schema === null || schema === void 0 ? void 0 : schema.properties;
2874
- if (schema === null || schema === void 0 ? void 0 : schema.allOf) {
2875
- schema === null || schema === void 0 ? void 0 : schema.allOf.forEach((item) => {
2876
- props = Object.assign(Object.assign({}, props), item.properties);
2877
- });
2878
- }
2879
- if ((schema === null || schema === void 0 ? void 0 : schema.anyOf) && (schema === null || schema === void 0 ? void 0 : schema.anyOf.length) > 0) {
2880
- const selectedSchema = (schema === null || schema === void 0 ? void 0 : schema.anyOf[selectedSchemaIndex]) || (schema === null || schema === void 0 ? void 0 : schema.anyOf[0]);
2881
- props = Object.assign(Object.assign({}, props), selectedSchema.properties);
2882
- }
2883
- if ((schema === null || schema === void 0 ? void 0 : schema.oneOf) && (schema === null || schema === void 0 ? void 0 : schema.oneOf.length) > 0) {
2884
- const selectedSchema = (schema === null || schema === void 0 ? void 0 : schema.oneOf[selectedSchemaIndex]) || (schema === null || schema === void 0 ? void 0 : schema.oneOf[0]);
2885
- props = Object.assign(Object.assign({}, props), selectedSchema.properties);
2886
- }
2887
- if (props && Object.keys(props).length > 0) {
2888
- for (const [key] of Object.entries(props)) {
2889
- const childPath = `${path}/properties/${key}`;
2890
- const childRequiredOverride = isRequiredOverride(childPath, hideData);
2891
- const shouldHideChild = isPathHidden(childPath, hideData, complexData) && childRequiredOverride === undefined;
2892
- if (!shouldHideChild)
2893
- return true;
2894
- }
2895
- }
2896
- }
2897
- if ((schema === null || schema === void 0 ? void 0 : schema.type) === 'array' &&
2898
- (schema === null || schema === void 0 ? void 0 : schema.items) &&
2899
- Object.keys(schema === null || schema === void 0 ? void 0 : schema.items).length > 0 &&
2900
- !((_a = schema === null || schema === void 0 ? void 0 : schema.items) === null || _a === void 0 ? void 0 : _a.circular)) {
2901
- const resolvedItems = dereference(schema === null || schema === void 0 ? void 0 : schema.items, root);
2902
- const itemsPath = `${path}/items`;
2903
- if (resolvedItems && resolvedItems.type === 'object' && resolvedItems.properties) {
2904
- for (const [key] of Object.entries(resolvedItems.properties)) {
2905
- const childPath = `${itemsPath}/properties/${key}`;
2906
- const childRequiredOverride = isRequiredOverride(childPath, hideData);
2907
- const shouldHideChild = isPathHidden(childPath, hideData, complexData) && childRequiredOverride === undefined;
2908
- if (!shouldHideChild)
2909
- return true;
2910
- }
2911
- }
2912
- else if (resolvedItems &&
2913
- resolvedItems.type === 'array' &&
2914
- resolvedItems.items &&
2915
- resolvedItems.items.length > 0) {
2916
- const childPath = `${path}/items`;
2917
- const childRequiredOverride = isRequiredOverride(childPath, hideData);
2918
- const shouldHideChild = isPathHidden(childPath, hideData, complexData) && childRequiredOverride === undefined;
2919
- if (!shouldHideChild)
2920
- return true;
2921
- }
2922
- }
2923
- return false;
2924
- }, [schema, path, hideData, complexData, shouldHideAllChildren, root, selectedSchemaIndex]);
2925
2868
  const shouldHideNode = useMemo(() => {
2926
2869
  if (isRoot)
2927
2870
  return false;
@@ -3074,8 +3017,7 @@ const LazySchemaTreePreviewer = ({ schema, root = schema, title, level = 1, path
3074
3017
  React__default.createElement(VStack, { spacing: 1, maxW: "full", className: "w-full" },
3075
3018
  React__default.createElement(Flex, { onClick: !isRoot ? handleToggle : undefined, className: `w-full ${isRoot ? '' : 'cursor-pointer'}` },
3076
3019
  !isRoot ? (React__default.createElement(Box, { mr: 2, className: "sl-font-mono sl-font-semibold sl-mr-2" },
3077
- hasExpandableChildren &&
3078
- !TYPES.includes(schema === null || schema === void 0 ? void 0 : schema.type) &&
3020
+ !TYPES.includes(schema === null || schema === void 0 ? void 0 : schema.type) &&
3079
3021
  !detectCircularPath(path) &&
3080
3022
  !((_b = schema === null || schema === void 0 ? void 0 : schema.items) === null || _b === void 0 ? void 0 : _b.circular) &&
3081
3023
  !(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" })),
@@ -4594,12 +4536,25 @@ const doBundle = (data, baseUrl) => {
4594
4536
  }
4595
4537
  };
4596
4538
 
4597
- const Styled = ({ children }) => {
4598
- return (React.createElement(Box, { className: "sl-elements sl-antialiased", fontFamily: "ui", fontSize: "base", color: "body", h: "full" }, children));
4539
+ const scopeClassName = 'sl-elements';
4540
+ class Styled extends React.Component {
4541
+ getChildContext() {
4542
+ return {
4543
+ blueprintPortalClassName: scopeClassName,
4544
+ };
4545
+ }
4546
+ render() {
4547
+ return (React.createElement(Box, { className: "sl-elements sl-antialiased", fontFamily: "ui", fontSize: "base", color: "body", h: "full" }, this.props.children));
4548
+ }
4549
+ }
4550
+ Styled.childContextTypes = {
4551
+ blueprintPortalClassName: PropTypes.string,
4599
4552
  };
4600
4553
  function withStyles(Component) {
4601
- const Inner = props => (React.createElement(Styled, null,
4602
- React.createElement(Component, Object.assign({}, props))));
4554
+ const Inner = props => {
4555
+ return (React.createElement(Styled, null,
4556
+ React.createElement(Component, Object.assign({}, props))));
4557
+ };
4603
4558
  Inner.displayName = `withStyles(${getDisplayName(Component)})`;
4604
4559
  return Inner;
4605
4560
  }
@@ -4649,7 +4604,7 @@ const createElementClass = (Component, propDescriptors) => {
4649
4604
  }
4650
4605
  disconnectedCallback() {
4651
4606
  if (this._mountPoint) {
4652
- ReactDOM.render(null, this._mountPoint);
4607
+ ReactDOM.unmountComponentAtNode(this._mountPoint);
4653
4608
  this.removeChild(this._mountPoint);
4654
4609
  this._mountPoint = undefined;
4655
4610
  }
package/index.js CHANGED
@@ -54,6 +54,7 @@ var omitBy = require('lodash/omitBy.js');
54
54
  var reactQuery = require('react-query');
55
55
  var server_js = require('react-router-dom/server.js');
56
56
  var $RefParser = require('@stoplight/json-schema-ref-parser');
57
+ var PropTypes = require('prop-types');
57
58
  var isEqual = require('lodash/isEqual.js');
58
59
  var ReactDOM = require('react-dom');
59
60
 
@@ -76,6 +77,7 @@ function _interopNamespaceDefault(e) {
76
77
 
77
78
  var React__namespace = /*#__PURE__*/_interopNamespaceDefault(React);
78
79
  var Sampler__namespace = /*#__PURE__*/_interopNamespaceDefault(Sampler);
80
+ var PropTypes__namespace = /*#__PURE__*/_interopNamespaceDefault(PropTypes);
79
81
  var ReactDOM__namespace = /*#__PURE__*/_interopNamespaceDefault(ReactDOM);
80
82
 
81
83
  const defaultResolver = (contextObject) => ({ pointer }, _, currentObject) => {
@@ -2879,70 +2881,12 @@ const LazySchemaTreePreviewer = ({ schema, root = schema, title, level = 1, path
2879
2881
  const [showSchemaDropdown, setShowSchemaDropdown] = React.useState(false);
2880
2882
  const [isHoveringSelector, setIsHoveringSelector] = React.useState(false);
2881
2883
  const isRoot = level === 1 && (title === undefined || path === '');
2882
- console.log("In LazySchemaTreePreviewer Beta 0.2:", { schema, path, isRoot });
2883
2884
  React.useEffect(() => {
2884
2885
  setSelectedSchemaIndex(0);
2885
2886
  }, [schema === null || schema === void 0 ? void 0 : schema.anyOf, schema === null || schema === void 0 ? void 0 : schema.oneOf]);
2886
2887
  const thisNodeRequiredOverride = isRequiredOverride(path, hideData);
2887
2888
  const shouldHideAllChildren = (isRoot && hideData.some(h => trimSlashes(h.path) === 'properties' && h.required === undefined)) ||
2888
2889
  (!isRoot && isPropertiesAllHidden(path, hideData));
2889
- const hasExpandableChildren = React.useMemo(() => {
2890
- var _a;
2891
- if (shouldHideAllChildren)
2892
- return false;
2893
- 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))) {
2894
- let props = schema === null || schema === void 0 ? void 0 : schema.properties;
2895
- if (schema === null || schema === void 0 ? void 0 : schema.allOf) {
2896
- schema === null || schema === void 0 ? void 0 : schema.allOf.forEach((item) => {
2897
- props = Object.assign(Object.assign({}, props), item.properties);
2898
- });
2899
- }
2900
- if ((schema === null || schema === void 0 ? void 0 : schema.anyOf) && (schema === null || schema === void 0 ? void 0 : schema.anyOf.length) > 0) {
2901
- const selectedSchema = (schema === null || schema === void 0 ? void 0 : schema.anyOf[selectedSchemaIndex]) || (schema === null || schema === void 0 ? void 0 : schema.anyOf[0]);
2902
- props = Object.assign(Object.assign({}, props), selectedSchema.properties);
2903
- }
2904
- if ((schema === null || schema === void 0 ? void 0 : schema.oneOf) && (schema === null || schema === void 0 ? void 0 : schema.oneOf.length) > 0) {
2905
- const selectedSchema = (schema === null || schema === void 0 ? void 0 : schema.oneOf[selectedSchemaIndex]) || (schema === null || schema === void 0 ? void 0 : schema.oneOf[0]);
2906
- props = Object.assign(Object.assign({}, props), selectedSchema.properties);
2907
- }
2908
- if (props && Object.keys(props).length > 0) {
2909
- for (const [key] of Object.entries(props)) {
2910
- const childPath = `${path}/properties/${key}`;
2911
- const childRequiredOverride = isRequiredOverride(childPath, hideData);
2912
- const shouldHideChild = isPathHidden(childPath, hideData, complexData) && childRequiredOverride === undefined;
2913
- if (!shouldHideChild)
2914
- return true;
2915
- }
2916
- }
2917
- }
2918
- if ((schema === null || schema === void 0 ? void 0 : schema.type) === 'array' &&
2919
- (schema === null || schema === void 0 ? void 0 : schema.items) &&
2920
- Object.keys(schema === null || schema === void 0 ? void 0 : schema.items).length > 0 &&
2921
- !((_a = schema === null || schema === void 0 ? void 0 : schema.items) === null || _a === void 0 ? void 0 : _a.circular)) {
2922
- const resolvedItems = dereference(schema === null || schema === void 0 ? void 0 : schema.items, root);
2923
- const itemsPath = `${path}/items`;
2924
- if (resolvedItems && resolvedItems.type === 'object' && resolvedItems.properties) {
2925
- for (const [key] of Object.entries(resolvedItems.properties)) {
2926
- const childPath = `${itemsPath}/properties/${key}`;
2927
- const childRequiredOverride = isRequiredOverride(childPath, hideData);
2928
- const shouldHideChild = isPathHidden(childPath, hideData, complexData) && childRequiredOverride === undefined;
2929
- if (!shouldHideChild)
2930
- return true;
2931
- }
2932
- }
2933
- else if (resolvedItems &&
2934
- resolvedItems.type === 'array' &&
2935
- resolvedItems.items &&
2936
- resolvedItems.items.length > 0) {
2937
- const childPath = `${path}/items`;
2938
- const childRequiredOverride = isRequiredOverride(childPath, hideData);
2939
- const shouldHideChild = isPathHidden(childPath, hideData, complexData) && childRequiredOverride === undefined;
2940
- if (!shouldHideChild)
2941
- return true;
2942
- }
2943
- }
2944
- return false;
2945
- }, [schema, path, hideData, complexData, shouldHideAllChildren, root, selectedSchemaIndex]);
2946
2890
  const shouldHideNode = React.useMemo(() => {
2947
2891
  if (isRoot)
2948
2892
  return false;
@@ -3095,8 +3039,7 @@ const LazySchemaTreePreviewer = ({ schema, root = schema, title, level = 1, path
3095
3039
  React.createElement(mosaic.VStack, { spacing: 1, maxW: "full", className: "w-full" },
3096
3040
  React.createElement(mosaic.Flex, { onClick: !isRoot ? handleToggle : undefined, className: `w-full ${isRoot ? '' : 'cursor-pointer'}` },
3097
3041
  !isRoot ? (React.createElement(mosaic.Box, { mr: 2, className: "sl-font-mono sl-font-semibold sl-mr-2" },
3098
- hasExpandableChildren &&
3099
- !TYPES.includes(schema === null || schema === void 0 ? void 0 : schema.type) &&
3042
+ !TYPES.includes(schema === null || schema === void 0 ? void 0 : schema.type) &&
3100
3043
  !detectCircularPath(path) &&
3101
3044
  !((_b = schema === null || schema === void 0 ? void 0 : schema.items) === null || _b === void 0 ? void 0 : _b.circular) &&
3102
3045
  !(schema === null || schema === void 0 ? void 0 : schema.circular) ? (React.createElement("i", { role: "img", "aria-hidden": "true", className: `sl-icon fal ${expanded ? 'fa-chevron-down' : 'fa-chevron-right'} fa-fw fa-sm` })) : (React.createElement("span", { className: "sl-icon fal fa-fw fa-sm", "aria-hidden": "true" })),
@@ -4615,12 +4558,25 @@ const doBundle = (data, baseUrl) => {
4615
4558
  }
4616
4559
  };
4617
4560
 
4618
- const Styled = ({ children }) => {
4619
- return (React__namespace.createElement(mosaic.Box, { className: "sl-elements sl-antialiased", fontFamily: "ui", fontSize: "base", color: "body", h: "full" }, children));
4561
+ const scopeClassName = 'sl-elements';
4562
+ class Styled extends React__namespace.Component {
4563
+ getChildContext() {
4564
+ return {
4565
+ blueprintPortalClassName: scopeClassName,
4566
+ };
4567
+ }
4568
+ render() {
4569
+ return (React__namespace.createElement(mosaic.Box, { className: "sl-elements sl-antialiased", fontFamily: "ui", fontSize: "base", color: "body", h: "full" }, this.props.children));
4570
+ }
4571
+ }
4572
+ Styled.childContextTypes = {
4573
+ blueprintPortalClassName: PropTypes__namespace.string,
4620
4574
  };
4621
4575
  function withStyles(Component) {
4622
- const Inner = props => (React__namespace.createElement(Styled, null,
4623
- React__namespace.createElement(Component, Object.assign({}, props))));
4576
+ const Inner = props => {
4577
+ return (React__namespace.createElement(Styled, null,
4578
+ React__namespace.createElement(Component, Object.assign({}, props))));
4579
+ };
4624
4580
  Inner.displayName = `withStyles(${getDisplayName(Component)})`;
4625
4581
  return Inner;
4626
4582
  }
@@ -4670,7 +4626,7 @@ const createElementClass = (Component, propDescriptors) => {
4670
4626
  }
4671
4627
  disconnectedCallback() {
4672
4628
  if (this._mountPoint) {
4673
- ReactDOM__namespace.render(null, this._mountPoint);
4629
+ ReactDOM__namespace.unmountComponentAtNode(this._mountPoint);
4674
4630
  this.removeChild(this._mountPoint);
4675
4631
  this._mountPoint = undefined;
4676
4632
  }
package/index.mjs CHANGED
@@ -54,6 +54,7 @@ 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';
57
58
  import isEqual from 'lodash/isEqual.js';
58
59
  import * as ReactDOM from 'react-dom';
59
60
 
@@ -2858,70 +2859,12 @@ const LazySchemaTreePreviewer = ({ schema, root = schema, title, level = 1, path
2858
2859
  const [showSchemaDropdown, setShowSchemaDropdown] = useState(false);
2859
2860
  const [isHoveringSelector, setIsHoveringSelector] = useState(false);
2860
2861
  const isRoot = level === 1 && (title === undefined || path === '');
2861
- console.log("In LazySchemaTreePreviewer Beta 0.2:", { schema, path, isRoot });
2862
2862
  useEffect(() => {
2863
2863
  setSelectedSchemaIndex(0);
2864
2864
  }, [schema === null || schema === void 0 ? void 0 : schema.anyOf, schema === null || schema === void 0 ? void 0 : schema.oneOf]);
2865
2865
  const thisNodeRequiredOverride = isRequiredOverride(path, hideData);
2866
2866
  const shouldHideAllChildren = (isRoot && hideData.some(h => trimSlashes(h.path) === 'properties' && h.required === undefined)) ||
2867
2867
  (!isRoot && isPropertiesAllHidden(path, hideData));
2868
- const hasExpandableChildren = useMemo(() => {
2869
- var _a;
2870
- if (shouldHideAllChildren)
2871
- return false;
2872
- 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))) {
2873
- let props = schema === null || schema === void 0 ? void 0 : schema.properties;
2874
- if (schema === null || schema === void 0 ? void 0 : schema.allOf) {
2875
- schema === null || schema === void 0 ? void 0 : schema.allOf.forEach((item) => {
2876
- props = Object.assign(Object.assign({}, props), item.properties);
2877
- });
2878
- }
2879
- if ((schema === null || schema === void 0 ? void 0 : schema.anyOf) && (schema === null || schema === void 0 ? void 0 : schema.anyOf.length) > 0) {
2880
- const selectedSchema = (schema === null || schema === void 0 ? void 0 : schema.anyOf[selectedSchemaIndex]) || (schema === null || schema === void 0 ? void 0 : schema.anyOf[0]);
2881
- props = Object.assign(Object.assign({}, props), selectedSchema.properties);
2882
- }
2883
- if ((schema === null || schema === void 0 ? void 0 : schema.oneOf) && (schema === null || schema === void 0 ? void 0 : schema.oneOf.length) > 0) {
2884
- const selectedSchema = (schema === null || schema === void 0 ? void 0 : schema.oneOf[selectedSchemaIndex]) || (schema === null || schema === void 0 ? void 0 : schema.oneOf[0]);
2885
- props = Object.assign(Object.assign({}, props), selectedSchema.properties);
2886
- }
2887
- if (props && Object.keys(props).length > 0) {
2888
- for (const [key] of Object.entries(props)) {
2889
- const childPath = `${path}/properties/${key}`;
2890
- const childRequiredOverride = isRequiredOverride(childPath, hideData);
2891
- const shouldHideChild = isPathHidden(childPath, hideData, complexData) && childRequiredOverride === undefined;
2892
- if (!shouldHideChild)
2893
- return true;
2894
- }
2895
- }
2896
- }
2897
- if ((schema === null || schema === void 0 ? void 0 : schema.type) === 'array' &&
2898
- (schema === null || schema === void 0 ? void 0 : schema.items) &&
2899
- Object.keys(schema === null || schema === void 0 ? void 0 : schema.items).length > 0 &&
2900
- !((_a = schema === null || schema === void 0 ? void 0 : schema.items) === null || _a === void 0 ? void 0 : _a.circular)) {
2901
- const resolvedItems = dereference(schema === null || schema === void 0 ? void 0 : schema.items, root);
2902
- const itemsPath = `${path}/items`;
2903
- if (resolvedItems && resolvedItems.type === 'object' && resolvedItems.properties) {
2904
- for (const [key] of Object.entries(resolvedItems.properties)) {
2905
- const childPath = `${itemsPath}/properties/${key}`;
2906
- const childRequiredOverride = isRequiredOverride(childPath, hideData);
2907
- const shouldHideChild = isPathHidden(childPath, hideData, complexData) && childRequiredOverride === undefined;
2908
- if (!shouldHideChild)
2909
- return true;
2910
- }
2911
- }
2912
- else if (resolvedItems &&
2913
- resolvedItems.type === 'array' &&
2914
- resolvedItems.items &&
2915
- resolvedItems.items.length > 0) {
2916
- const childPath = `${path}/items`;
2917
- const childRequiredOverride = isRequiredOverride(childPath, hideData);
2918
- const shouldHideChild = isPathHidden(childPath, hideData, complexData) && childRequiredOverride === undefined;
2919
- if (!shouldHideChild)
2920
- return true;
2921
- }
2922
- }
2923
- return false;
2924
- }, [schema, path, hideData, complexData, shouldHideAllChildren, root, selectedSchemaIndex]);
2925
2868
  const shouldHideNode = useMemo(() => {
2926
2869
  if (isRoot)
2927
2870
  return false;
@@ -3074,8 +3017,7 @@ const LazySchemaTreePreviewer = ({ schema, root = schema, title, level = 1, path
3074
3017
  React__default.createElement(VStack, { spacing: 1, maxW: "full", className: "w-full" },
3075
3018
  React__default.createElement(Flex, { onClick: !isRoot ? handleToggle : undefined, className: `w-full ${isRoot ? '' : 'cursor-pointer'}` },
3076
3019
  !isRoot ? (React__default.createElement(Box, { mr: 2, className: "sl-font-mono sl-font-semibold sl-mr-2" },
3077
- hasExpandableChildren &&
3078
- !TYPES.includes(schema === null || schema === void 0 ? void 0 : schema.type) &&
3020
+ !TYPES.includes(schema === null || schema === void 0 ? void 0 : schema.type) &&
3079
3021
  !detectCircularPath(path) &&
3080
3022
  !((_b = schema === null || schema === void 0 ? void 0 : schema.items) === null || _b === void 0 ? void 0 : _b.circular) &&
3081
3023
  !(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" })),
@@ -4594,12 +4536,25 @@ const doBundle = (data, baseUrl) => {
4594
4536
  }
4595
4537
  };
4596
4538
 
4597
- const Styled = ({ children }) => {
4598
- return (React.createElement(Box, { className: "sl-elements sl-antialiased", fontFamily: "ui", fontSize: "base", color: "body", h: "full" }, children));
4539
+ const scopeClassName = 'sl-elements';
4540
+ class Styled extends React.Component {
4541
+ getChildContext() {
4542
+ return {
4543
+ blueprintPortalClassName: scopeClassName,
4544
+ };
4545
+ }
4546
+ render() {
4547
+ return (React.createElement(Box, { className: "sl-elements sl-antialiased", fontFamily: "ui", fontSize: "base", color: "body", h: "full" }, this.props.children));
4548
+ }
4549
+ }
4550
+ Styled.childContextTypes = {
4551
+ blueprintPortalClassName: PropTypes.string,
4599
4552
  };
4600
4553
  function withStyles(Component) {
4601
- const Inner = props => (React.createElement(Styled, null,
4602
- React.createElement(Component, Object.assign({}, props))));
4554
+ const Inner = props => {
4555
+ return (React.createElement(Styled, null,
4556
+ React.createElement(Component, Object.assign({}, props))));
4557
+ };
4603
4558
  Inner.displayName = `withStyles(${getDisplayName(Component)})`;
4604
4559
  return Inner;
4605
4560
  }
@@ -4649,7 +4604,7 @@ const createElementClass = (Component, propDescriptors) => {
4649
4604
  }
4650
4605
  disconnectedCallback() {
4651
4606
  if (this._mountPoint) {
4652
- ReactDOM.render(null, this._mountPoint);
4607
+ ReactDOM.unmountComponentAtNode(this._mountPoint);
4653
4608
  this.removeChild(this._mountPoint);
4654
4609
  this._mountPoint = undefined;
4655
4610
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stoplight/elements-core",
3
- "version": "9.0.12-beta-0.4",
3
+ "version": "9.0.13-beta-0.1",
4
4
  "main": "./index.js",
5
5
  "sideEffects": [
6
6
  "web-components.min.js",
package/styled.d.ts CHANGED
@@ -1,5 +1,12 @@
1
+ import * as PropTypes from 'prop-types';
1
2
  import * as React from 'react';
2
- export declare const Styled: ({ children }: {
3
- children: React.ReactNode;
4
- }) => JSX.Element;
3
+ export declare class Styled extends React.Component {
4
+ static childContextTypes: {
5
+ blueprintPortalClassName: PropTypes.Requireable<string>;
6
+ };
7
+ getChildContext(): {
8
+ blueprintPortalClassName: string;
9
+ };
10
+ render(): JSX.Element;
11
+ }
5
12
  export declare function withStyles<T>(Component: React.ComponentType<T>): React.FC<T>;