gwchq-textjam 0.2.30 → 0.2.32

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.js CHANGED
@@ -346790,10 +346790,10 @@ __webpack_require__.r(__webpack_exports__);
346790
346790
 
346791
346791
  // EXPORTS
346792
346792
  __webpack_require__.d(__webpack_exports__, {
346793
- Tab: () => (/* reexport */ Tab),
346794
- TabList: () => (/* reexport */ TabList),
346795
- TabPanel: () => (/* reexport */ TabPanel),
346796
- Tabs: () => (/* reexport */ Tabs),
346793
+ Tab: () => (/* reexport */ components_Tab),
346794
+ TabList: () => (/* reexport */ components_TabList),
346795
+ TabPanel: () => (/* reexport */ components_TabPanel),
346796
+ Tabs: () => (/* reexport */ components_Tabs),
346797
346797
  resetIdCounter: () => (/* reexport */ uuid_reset)
346798
346798
  });
346799
346799
 
@@ -346942,13 +346942,6 @@ function count_getTabsCount(children) {
346942
346942
  });
346943
346943
  return tabCount;
346944
346944
  }
346945
- function count_getPanelsCount(children) {
346946
- var panelCount = 0;
346947
- childrenDeepMap_deepForEach(children, function (child) {
346948
- if (elementTypes_isTabPanel(child)) panelCount++;
346949
- });
346950
- return panelCount;
346951
- }
346952
346945
  ;// ./node_modules/react-tabs/esm/components/UncontrolledTabs.js
346953
346946
  var _excluded = ["children", "className", "disabledTabClassName", "domRef", "focus", "forceRenderTabPanel", "onSelect", "selectedIndex", "selectedTabClassName", "selectedTabPanelClassName", "environment", "disableUpDownKeys"];
346954
346947
 
@@ -346956,10 +346949,6 @@ function UncontrolledTabs_extends() { UncontrolledTabs_extends = Object.assign |
346956
346949
 
346957
346950
  function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
346958
346951
 
346959
- function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); }
346960
-
346961
- function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
346962
-
346963
346952
 
346964
346953
 
346965
346954
 
@@ -346995,219 +346984,135 @@ function determineCanUseActiveElement(environment) {
346995
346984
  // Refer to the following resources:
346996
346985
  // http://stackoverflow.com/a/10982960/369687
346997
346986
  // https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/12733599
346987
+ // istanbul ignore next
346998
346988
  canUseActiveElement = false;
346999
346989
  }
347000
346990
  }
347001
346991
 
347002
- var UncontrolledTabs = /*#__PURE__*/function (_Component) {
347003
- _inheritsLoose(UncontrolledTabs, _Component);
347004
-
347005
- function UncontrolledTabs() {
347006
- var _this;
347007
-
347008
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
347009
- args[_key] = arguments[_key];
347010
- }
347011
-
347012
- _this = _Component.call.apply(_Component, [this].concat(args)) || this;
347013
- _this.tabNodes = [];
347014
-
347015
- _this.handleKeyDown = function (e) {
347016
- var _this$props = _this.props,
347017
- direction = _this$props.direction,
347018
- disableUpDownKeys = _this$props.disableUpDownKeys;
347019
-
347020
- if (_this.isTabFromContainer(e.target)) {
347021
- var index = _this.props.selectedIndex;
347022
- var preventDefault = false;
347023
- var useSelectedIndex = false;
347024
-
347025
- if (e.keyCode === 32 || e.keyCode === 13) {
347026
- preventDefault = true;
347027
- useSelectedIndex = false;
347028
-
347029
- _this.handleClick(e);
347030
- }
347031
-
347032
- if (e.keyCode === 37 || !disableUpDownKeys && e.keyCode === 38) {
347033
- // Select next tab to the left, validate if up arrow is not disabled
347034
- if (direction === 'rtl') {
347035
- index = _this.getNextTab(index);
347036
- } else {
347037
- index = _this.getPrevTab(index);
347038
- }
347039
-
347040
- preventDefault = true;
347041
- useSelectedIndex = true;
347042
- } else if (e.keyCode === 39 || !disableUpDownKeys && e.keyCode === 40) {
347043
- // Select next tab to the right, validate if down arrow is not disabled
347044
- if (direction === 'rtl') {
347045
- index = _this.getPrevTab(index);
347046
- } else {
347047
- index = _this.getNextTab(index);
347048
- }
347049
-
347050
- preventDefault = true;
347051
- useSelectedIndex = true;
347052
- } else if (e.keyCode === 35) {
347053
- // Select last tab (End key)
347054
- index = _this.getLastTab();
347055
- preventDefault = true;
347056
- useSelectedIndex = true;
347057
- } else if (e.keyCode === 36) {
347058
- // Select first tab (Home key)
347059
- index = _this.getFirstTab();
347060
- preventDefault = true;
347061
- useSelectedIndex = true;
347062
- } // This prevents scrollbars from moving around
347063
-
347064
-
347065
- if (preventDefault) {
347066
- e.preventDefault();
347067
- } // Only use the selected index in the state if we're not using the tabbed index
347068
-
347069
-
347070
- if (useSelectedIndex) {
347071
- _this.setSelected(index, e);
347072
- }
347073
- }
347074
- };
347075
-
347076
- _this.handleClick = function (e) {
347077
- var node = e.target;
347078
-
347079
- do {
347080
- if (_this.isTabFromContainer(node)) {
347081
- if (isTabDisabled(node)) {
347082
- return;
347083
- }
347084
-
347085
- var index = [].slice.call(node.parentNode.children).filter(isTabNode).indexOf(node);
347086
-
347087
- _this.setSelected(index, e);
347088
-
347089
- return;
347090
- }
347091
- } while ((node = node.parentNode) != null);
347092
- };
346992
+ var defaultProps = {
346993
+ className: 'react-tabs',
346994
+ focus: false
346995
+ };
346996
+ var propTypes = false ? 0 : {};
347093
346997
 
347094
- return _this;
347095
- }
346998
+ var UncontrolledTabs = function UncontrolledTabs(props) {
346999
+ var tabNodes = (0,external_react_.useRef)([]);
347000
+ var tabIds = (0,external_react_.useRef)([]);
347001
+ var panelIds = (0,external_react_.useRef)([]);
347096
347002
 
347097
- var _proto = UncontrolledTabs.prototype;
347003
+ var _ref = (0,external_react_.useRef)();
347098
347004
 
347099
- _proto.setSelected = function setSelected(index, event) {
347005
+ function setSelected(index, event) {
347100
347006
  // Check index boundary
347101
- if (index < 0 || index >= this.getTabsCount()) return;
347102
- var _this$props2 = this.props,
347103
- onSelect = _this$props2.onSelect,
347104
- selectedIndex = _this$props2.selectedIndex; // Call change event handler
347007
+ if (index < 0 || index >= getTabsCount()) return;
347008
+ var onSelect = props.onSelect,
347009
+ selectedIndex = props.selectedIndex; // Call change event handler
347105
347010
 
347106
347011
  onSelect(index, selectedIndex, event);
347107
- };
347012
+ }
347108
347013
 
347109
- _proto.getNextTab = function getNextTab(index) {
347110
- var count = this.getTabsCount(); // Look for non-disabled tab from index to the last tab on the right
347014
+ function getNextTab(index) {
347015
+ var count = getTabsCount(); // Look for non-disabled tab from index to the last tab on the right
347111
347016
 
347112
347017
  for (var i = index + 1; i < count; i++) {
347113
- if (!isTabDisabled(this.getTab(i))) {
347018
+ if (!isTabDisabled(getTab(i))) {
347114
347019
  return i;
347115
347020
  }
347116
347021
  } // If no tab found, continue searching from first on left to index
347117
347022
 
347118
347023
 
347119
347024
  for (var _i = 0; _i < index; _i++) {
347120
- if (!isTabDisabled(this.getTab(_i))) {
347025
+ if (!isTabDisabled(getTab(_i))) {
347121
347026
  return _i;
347122
347027
  }
347123
- } // No tabs are disabled, return index
347028
+ } // All tabs are disabled, return index
347029
+
347030
+ /* istanbul ignore next */
347124
347031
 
347125
347032
 
347126
347033
  return index;
347127
- };
347034
+ }
347128
347035
 
347129
- _proto.getPrevTab = function getPrevTab(index) {
347036
+ function getPrevTab(index) {
347130
347037
  var i = index; // Look for non-disabled tab from index to first tab on the left
347131
347038
 
347132
347039
  while (i--) {
347133
- if (!isTabDisabled(this.getTab(i))) {
347040
+ if (!isTabDisabled(getTab(i))) {
347134
347041
  return i;
347135
347042
  }
347136
347043
  } // If no tab found, continue searching from last tab on right to index
347137
347044
 
347138
347045
 
347139
- i = this.getTabsCount();
347046
+ i = getTabsCount();
347140
347047
 
347141
347048
  while (i-- > index) {
347142
- if (!isTabDisabled(this.getTab(i))) {
347049
+ if (!isTabDisabled(getTab(i))) {
347143
347050
  return i;
347144
347051
  }
347145
- } // No tabs are disabled, return index
347052
+ } // All tabs are disabled, return index
347053
+
347054
+ /* istanbul ignore next */
347146
347055
 
347147
347056
 
347148
347057
  return index;
347149
- };
347058
+ }
347150
347059
 
347151
- _proto.getFirstTab = function getFirstTab() {
347152
- var count = this.getTabsCount(); // Look for non disabled tab from the first tab
347060
+ function getFirstTab() {
347061
+ var count = getTabsCount(); // Look for non disabled tab from the first tab
347153
347062
 
347154
347063
  for (var i = 0; i < count; i++) {
347155
- if (!isTabDisabled(this.getTab(i))) {
347064
+ if (!isTabDisabled(getTab(i))) {
347156
347065
  return i;
347157
347066
  }
347158
347067
  }
347068
+ /* istanbul ignore next */
347069
+
347159
347070
 
347160
347071
  return null;
347161
- };
347072
+ }
347162
347073
 
347163
- _proto.getLastTab = function getLastTab() {
347164
- var i = this.getTabsCount(); // Look for non disabled tab from the last tab
347074
+ function getLastTab() {
347075
+ var i = getTabsCount(); // Look for non disabled tab from the last tab
347165
347076
 
347166
347077
  while (i--) {
347167
- if (!isTabDisabled(this.getTab(i))) {
347078
+ if (!isTabDisabled(getTab(i))) {
347168
347079
  return i;
347169
347080
  }
347170
347081
  }
347082
+ /* istanbul ignore next */
347083
+
347171
347084
 
347172
347085
  return null;
347173
- };
347086
+ }
347174
347087
 
347175
- _proto.getTabsCount = function getTabsCount() {
347176
- var children = this.props.children;
347088
+ function getTabsCount() {
347089
+ var children = props.children;
347177
347090
  return count_getTabsCount(children);
347178
- };
347179
-
347180
- _proto.getPanelsCount = function getPanelsCount() {
347181
- var children = this.props.children;
347182
- return count_getPanelsCount(children);
347183
- };
347184
-
347185
- _proto.getTab = function getTab(index) {
347186
- return this.tabNodes["tabs-" + index];
347187
- };
347091
+ }
347188
347092
 
347189
- _proto.getChildren = function getChildren() {
347190
- var _this2 = this;
347093
+ function getTab(index) {
347094
+ return tabNodes.current["tabs-" + index];
347095
+ }
347191
347096
 
347097
+ function getChildren() {
347192
347098
  var index = 0;
347193
- var _this$props3 = this.props,
347194
- children = _this$props3.children,
347195
- disabledTabClassName = _this$props3.disabledTabClassName,
347196
- focus = _this$props3.focus,
347197
- forceRenderTabPanel = _this$props3.forceRenderTabPanel,
347198
- selectedIndex = _this$props3.selectedIndex,
347199
- selectedTabClassName = _this$props3.selectedTabClassName,
347200
- selectedTabPanelClassName = _this$props3.selectedTabPanelClassName,
347201
- environment = _this$props3.environment;
347202
- this.tabIds = this.tabIds || [];
347203
- this.panelIds = this.panelIds || [];
347204
- var diff = this.tabIds.length - this.getTabsCount(); // Add ids if new tabs have been added
347099
+ var children = props.children,
347100
+ disabledTabClassName = props.disabledTabClassName,
347101
+ focus = props.focus,
347102
+ forceRenderTabPanel = props.forceRenderTabPanel,
347103
+ selectedIndex = props.selectedIndex,
347104
+ selectedTabClassName = props.selectedTabClassName,
347105
+ selectedTabPanelClassName = props.selectedTabPanelClassName,
347106
+ environment = props.environment;
347107
+ tabIds.current = tabIds.current || [];
347108
+ panelIds.current = panelIds.current || [];
347109
+ var diff = tabIds.current.length - getTabsCount(); // Add ids if new tabs have been added
347205
347110
  // Don't bother removing ids, just keep them in case they are added again
347206
347111
  // This is more efficient, and keeps the uuid counter under control
347207
347112
 
347208
347113
  while (diff++ < 0) {
347209
- this.tabIds.push(uuid());
347210
- this.panelIds.push(uuid());
347114
+ tabIds.current.push(uuid());
347115
+ panelIds.current.push(uuid());
347211
347116
  } // Map children to dynamically setup refs
347212
347117
 
347213
347118
 
@@ -347224,10 +347129,11 @@ var UncontrolledTabs = /*#__PURE__*/function (_Component) {
347224
347129
  determineCanUseActiveElement(environment);
347225
347130
  }
347226
347131
 
347227
- if (canUseActiveElement) {
347132
+ var env = environment || (typeof window !== 'undefined' ? window : undefined);
347133
+
347134
+ if (canUseActiveElement && env) {
347228
347135
  wasTabFocused = external_react_["default"].Children.toArray(child.props.children).filter(elementTypes_isTab).some(function (tab, i) {
347229
- var env = environment || (typeof window !== 'undefined' ? window : undefined);
347230
- return env && env.document.activeElement === _this2.getTab(i);
347136
+ return env.document.activeElement === getTab(i);
347231
347137
  });
347232
347138
  }
347233
347139
 
@@ -347237,10 +347143,10 @@ var UncontrolledTabs = /*#__PURE__*/function (_Component) {
347237
347143
  var selected = selectedIndex === listIndex;
347238
347144
  var props = {
347239
347145
  tabRef: function tabRef(node) {
347240
- _this2.tabNodes[key] = node;
347146
+ tabNodes.current[key] = node;
347241
347147
  },
347242
- id: _this2.tabIds[listIndex],
347243
- panelId: _this2.panelIds[listIndex],
347148
+ id: tabIds.current[listIndex],
347149
+ panelId: panelIds.current[listIndex],
347244
347150
  selected: selected,
347245
347151
  focus: selected && (focus || wasTabFocused)
347246
347152
  };
@@ -347251,27 +347157,116 @@ var UncontrolledTabs = /*#__PURE__*/function (_Component) {
347251
347157
  })
347252
347158
  });
347253
347159
  } else if (elementTypes_isTabPanel(child)) {
347254
- var props = {
347255
- id: _this2.panelIds[index],
347256
- tabId: _this2.tabIds[index],
347160
+ var _props = {
347161
+ id: panelIds.current[index],
347162
+ tabId: tabIds.current[index],
347257
347163
  selected: selectedIndex === index
347258
347164
  };
347259
- if (forceRenderTabPanel) props.forceRender = forceRenderTabPanel;
347260
- if (selectedTabPanelClassName) props.selectedClassName = selectedTabPanelClassName;
347165
+ if (forceRenderTabPanel) _props.forceRender = forceRenderTabPanel;
347166
+ if (selectedTabPanelClassName) _props.selectedClassName = selectedTabPanelClassName;
347261
347167
  index++;
347262
- result = /*#__PURE__*/(0,external_react_.cloneElement)(child, props);
347168
+ result = /*#__PURE__*/(0,external_react_.cloneElement)(child, _props);
347263
347169
  }
347264
347170
 
347265
347171
  return result;
347266
347172
  });
347267
- };
347173
+ }
347174
+
347175
+ function handleKeyDown(e) {
347176
+ var direction = props.direction,
347177
+ disableUpDownKeys = props.disableUpDownKeys;
347178
+
347179
+ if (isTabFromContainer(e.target)) {
347180
+ var index = props.selectedIndex;
347181
+ var preventDefault = false;
347182
+ var useSelectedIndex = false;
347183
+
347184
+ if (e.code === 'Space' || e.keyCode === 32
347185
+ /* space */
347186
+ || e.code === 'Enter' || e.keyCode === 13
347187
+ /* enter */
347188
+ ) {
347189
+ preventDefault = true;
347190
+ useSelectedIndex = false;
347191
+ handleClick(e);
347192
+ } // keyCode is deprecated and only used here for IE
347193
+
347194
+
347195
+ if (e.code === 'ArrowLeft' || e.keyCode === 37
347196
+ /* arrow left */
347197
+ || !disableUpDownKeys && (e.keyCode === 38 || e.code === 'ArrowUp')
347198
+ /* arrow up */
347199
+ ) {
347200
+ // Select next tab to the left, validate if up arrow is not disabled
347201
+ if (direction === 'rtl') {
347202
+ index = getNextTab(index);
347203
+ } else {
347204
+ index = getPrevTab(index);
347205
+ }
347206
+
347207
+ preventDefault = true;
347208
+ useSelectedIndex = true;
347209
+ } else if (e.code === 'ArrowRight' || e.keyCode === 39
347210
+ /* arrow right */
347211
+ || !disableUpDownKeys && (e.keyCode === 40 || e.code === 'ArrowDown')
347212
+ /* arrow down */
347213
+ ) {
347214
+ // Select next tab to the right, validate if down arrow is not disabled
347215
+ if (direction === 'rtl') {
347216
+ index = getPrevTab(index);
347217
+ } else {
347218
+ index = getNextTab(index);
347219
+ }
347220
+
347221
+ preventDefault = true;
347222
+ useSelectedIndex = true;
347223
+ } else if (e.keyCode === 35 || e.code === 'End') {
347224
+ // Select last tab (End key)
347225
+ index = getLastTab();
347226
+ preventDefault = true;
347227
+ useSelectedIndex = true;
347228
+ } else if (e.keyCode === 36 || e.code === 'Home') {
347229
+ // Select first tab (Home key)
347230
+ index = getFirstTab();
347231
+ preventDefault = true;
347232
+ useSelectedIndex = true;
347233
+ } // This prevents scrollbars from moving around
347234
+
347268
347235
 
347236
+ if (preventDefault) {
347237
+ e.preventDefault();
347238
+ } // Only use the selected index in the state if we're not using the tabbed index
347239
+
347240
+
347241
+ if (useSelectedIndex) {
347242
+ setSelected(index, e);
347243
+ }
347244
+ }
347245
+ }
347246
+
347247
+ function handleClick(e) {
347248
+ var node = e.target;
347249
+
347250
+ do {
347251
+ if (isTabFromContainer(node)) {
347252
+ if (isTabDisabled(node)) {
347253
+ return;
347254
+ }
347255
+
347256
+ var index = [].slice.call(node.parentNode.children).filter(isTabNode).indexOf(node);
347257
+ setSelected(index, e);
347258
+ return;
347259
+ }
347260
+ } while ((node = node.parentNode) != null);
347261
+ }
347269
347262
  /**
347270
347263
  * Determine if a node from event.target is a Tab element for the current Tabs container.
347271
347264
  * If the clicked element is not a Tab, it returns false.
347272
347265
  * If it finds another Tabs container between the Tab and `this`, it returns false.
347273
347266
  */
347274
- _proto.isTabFromContainer = function isTabFromContainer(node) {
347267
+
347268
+
347269
+ function isTabFromContainer(node) {
347275
347270
  // return immediately if the clicked element is not a Tab.
347276
347271
  if (!isTabNode(node)) {
347277
347272
  return false;
@@ -347281,62 +347276,45 @@ var UncontrolledTabs = /*#__PURE__*/function (_Component) {
347281
347276
  var nodeAncestor = node.parentElement;
347282
347277
 
347283
347278
  do {
347284
- if (nodeAncestor === this.node) return true;
347279
+ if (nodeAncestor === _ref.current) return true;
347285
347280
  if (nodeAncestor.getAttribute('data-rttabs')) break;
347286
347281
  nodeAncestor = nodeAncestor.parentElement;
347287
347282
  } while (nodeAncestor);
347288
347283
 
347289
347284
  return false;
347290
- };
347291
-
347292
- _proto.render = function render() {
347293
- var _this3 = this;
347294
-
347295
- // Delete all known props, so they don't get added to DOM
347296
- var _this$props4 = this.props,
347297
- children = _this$props4.children,
347298
- className = _this$props4.className,
347299
- disabledTabClassName = _this$props4.disabledTabClassName,
347300
- domRef = _this$props4.domRef,
347301
- focus = _this$props4.focus,
347302
- forceRenderTabPanel = _this$props4.forceRenderTabPanel,
347303
- onSelect = _this$props4.onSelect,
347304
- selectedIndex = _this$props4.selectedIndex,
347305
- selectedTabClassName = _this$props4.selectedTabClassName,
347306
- selectedTabPanelClassName = _this$props4.selectedTabPanelClassName,
347307
- environment = _this$props4.environment,
347308
- disableUpDownKeys = _this$props4.disableUpDownKeys,
347309
- attributes = _objectWithoutPropertiesLoose(_this$props4, _excluded);
347310
-
347311
- return /*#__PURE__*/external_react_["default"].createElement("div", UncontrolledTabs_extends({}, attributes, {
347312
- className: (0,clsx_m/* default */.A)(className),
347313
- onClick: this.handleClick,
347314
- onKeyDown: this.handleKeyDown,
347315
- ref: function ref(node) {
347316
- _this3.node = node;
347317
- if (domRef) domRef(node);
347318
- },
347319
- "data-rttabs": true
347320
- }), this.getChildren());
347321
- };
347322
-
347323
- return UncontrolledTabs;
347324
- }(external_react_.Component);
347285
+ }
347325
347286
 
347326
- UncontrolledTabs.defaultProps = {
347327
- className: 'react-tabs',
347328
- focus: false
347287
+ var children = props.children,
347288
+ className = props.className,
347289
+ disabledTabClassName = props.disabledTabClassName,
347290
+ domRef = props.domRef,
347291
+ focus = props.focus,
347292
+ forceRenderTabPanel = props.forceRenderTabPanel,
347293
+ onSelect = props.onSelect,
347294
+ selectedIndex = props.selectedIndex,
347295
+ selectedTabClassName = props.selectedTabClassName,
347296
+ selectedTabPanelClassName = props.selectedTabPanelClassName,
347297
+ environment = props.environment,
347298
+ disableUpDownKeys = props.disableUpDownKeys,
347299
+ attributes = _objectWithoutPropertiesLoose(props, _excluded);
347300
+
347301
+ return /*#__PURE__*/external_react_["default"].createElement("div", UncontrolledTabs_extends({}, attributes, {
347302
+ className: (0,clsx_m/* default */.A)(className),
347303
+ onClick: handleClick,
347304
+ onKeyDown: handleKeyDown,
347305
+ ref: function ref(node) {
347306
+ _ref.current = node;
347307
+ if (domRef) domRef(node);
347308
+ },
347309
+ "data-rttabs": true
347310
+ }), getChildren());
347329
347311
  };
347330
347312
 
347313
+ UncontrolledTabs.defaultProps = defaultProps;
347331
347314
  UncontrolledTabs.propTypes = false ? 0 : {};
347315
+ /* harmony default export */ const components_UncontrolledTabs = (UncontrolledTabs);
347332
347316
  ;// ./node_modules/react-tabs/esm/components/Tabs.js
347333
- var Tabs_excluded = ["children", "defaultIndex", "defaultFocus"];
347334
-
347335
- function Tabs_objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
347336
-
347337
- function Tabs_inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; Tabs_setPrototypeOf(subClass, superClass); }
347338
-
347339
- function Tabs_setPrototypeOf(o, p) { Tabs_setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return Tabs_setPrototypeOf(o, p); }
347317
+ function Tabs_extends() { Tabs_extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return Tabs_extends.apply(this, arguments); }
347340
347318
 
347341
347319
 
347342
347320
 
@@ -347345,115 +347323,106 @@ function Tabs_setPrototypeOf(o, p) { Tabs_setPrototypeOf = Object.setPrototypeOf
347345
347323
 
347346
347324
  var MODE_CONTROLLED = 0;
347347
347325
  var MODE_UNCONTROLLED = 1;
347326
+ var Tabs_propTypes = false ? 0 : {};
347327
+ var Tabs_defaultProps = {
347328
+ defaultFocus: false,
347329
+ focusTabOnClick: true,
347330
+ forceRenderTabPanel: false,
347331
+ selectedIndex: null,
347332
+ defaultIndex: null,
347333
+ environment: null,
347334
+ disableUpDownKeys: false
347335
+ };
347348
347336
 
347349
- var Tabs = /*#__PURE__*/function (_Component) {
347350
- Tabs_inheritsLoose(Tabs, _Component);
347337
+ var getModeFromProps = function getModeFromProps(props) {
347338
+ return props.selectedIndex === null ? MODE_UNCONTROLLED : MODE_CONTROLLED;
347339
+ };
347351
347340
 
347352
- function Tabs(props) {
347353
- var _this;
347341
+ var checkForIllegalModeChange = function checkForIllegalModeChange(props, mode) {
347342
+ if (false) {}
347343
+ };
347344
+ /**
347345
+ * State:
347346
+ * mode: Initialized only once from props and never changes
347347
+ * selectedIndex: null if controlled mode, otherwise initialized with prop defaultIndex, changed on selection of tabs, has effect to ensure it never gets out of bound
347348
+ * focus: Because we never remove focus from the Tabs this state is only used to indicate that we should focus the current tab.
347349
+ * It is initialized from the prop defaultFocus, and after the first render it is reset back to false. Later it can become true again when using keys to navigate the tabs.
347350
+ */
347354
347351
 
347355
- _this = _Component.call(this, props) || this;
347356
347352
 
347357
- _this.handleSelected = function (index, last, event) {
347358
- var onSelect = _this.props.onSelect;
347359
- var mode = _this.state.mode; // Call change event handler
347353
+ var Tabs = function Tabs(props) {
347354
+ var children = props.children,
347355
+ defaultFocus = props.defaultFocus,
347356
+ defaultIndex = props.defaultIndex,
347357
+ focusTabOnClick = props.focusTabOnClick,
347358
+ onSelect = props.onSelect;
347360
347359
 
347361
- if (typeof onSelect === 'function') {
347362
- // Check if the change event handler cancels the tab change
347363
- if (onSelect(index, last, event) === false) return;
347364
- }
347360
+ var _useState = (0,external_react_.useState)(defaultFocus),
347361
+ focus = _useState[0],
347362
+ setFocus = _useState[1];
347365
347363
 
347366
- var state = {
347367
- // Set focus if the change was triggered from the keyboard
347368
- focus: event.type === 'keydown'
347369
- };
347364
+ var _useState2 = (0,external_react_.useState)(getModeFromProps(props)),
347365
+ mode = _useState2[0];
347370
347366
 
347371
- if (mode === MODE_UNCONTROLLED) {
347372
- // Update selected index
347373
- state.selectedIndex = index;
347374
- }
347367
+ var _useState3 = (0,external_react_.useState)(mode === MODE_UNCONTROLLED ? defaultIndex || 0 : null),
347368
+ selectedIndex = _useState3[0],
347369
+ setSelectedIndex = _useState3[1];
347375
347370
 
347376
- _this.setState(state);
347377
- };
347371
+ (0,external_react_.useEffect)(function () {
347372
+ // Reset focus after initial render, see comment above
347373
+ setFocus(false);
347374
+ }, []);
347378
347375
 
347379
- _this.state = Tabs.copyPropsToState(_this.props, {}, props.defaultFocus);
347380
- return _this;
347376
+ if (mode === MODE_UNCONTROLLED) {
347377
+ // Ensure that we handle removed tabs and don't let selectedIndex get out of bounds
347378
+ var tabsCount = count_getTabsCount(children);
347379
+ (0,external_react_.useEffect)(function () {
347380
+ if (selectedIndex != null) {
347381
+ var maxTabIndex = Math.max(0, tabsCount - 1);
347382
+ setSelectedIndex(Math.min(selectedIndex, maxTabIndex));
347383
+ }
347384
+ }, [tabsCount]);
347381
347385
  }
347382
347386
 
347383
- Tabs.getDerivedStateFromProps = function getDerivedStateFromProps(props, state) {
347384
- return Tabs.copyPropsToState(props, state);
347385
- };
347387
+ checkForIllegalModeChange(props, mode);
347386
347388
 
347387
- Tabs.getModeFromProps = function getModeFromProps(props) {
347388
- return props.selectedIndex === null ? MODE_UNCONTROLLED : MODE_CONTROLLED;
347389
- };
347389
+ var handleSelected = function handleSelected(index, last, event) {
347390
+ // Call change event handler
347391
+ if (typeof onSelect === 'function') {
347392
+ // Check if the change event handler cancels the tab change
347393
+ if (onSelect(index, last, event) === false) return;
347394
+ } // Always set focus on tabs unless it is disabled
347390
347395
 
347391
- // preserve the existing selectedIndex from state.
347392
- // If the state has not selectedIndex, default to the defaultIndex or 0
347393
- Tabs.copyPropsToState = function copyPropsToState(props, state, focus) {
347394
- if (focus === void 0) {
347395
- focus = false;
347396
- }
347397
-
347398
- if (false) {}
347399
347396
 
347400
- var newState = {
347401
- focus: focus,
347402
- mode: Tabs.getModeFromProps(props)
347403
- };
347404
-
347405
- if (newState.mode === MODE_UNCONTROLLED) {
347406
- var maxTabIndex = Math.max(0, count_getTabsCount(props.children) - 1);
347407
- var selectedIndex = null;
347408
-
347409
- if (state.selectedIndex != null) {
347410
- selectedIndex = Math.min(state.selectedIndex, maxTabIndex);
347411
- } else {
347412
- selectedIndex = props.defaultIndex || 0;
347413
- }
347414
-
347415
- newState.selectedIndex = selectedIndex;
347397
+ if (focusTabOnClick) {
347398
+ setFocus(true);
347416
347399
  }
347417
347400
 
347418
- return newState;
347401
+ if (mode === MODE_UNCONTROLLED) {
347402
+ // Update selected index
347403
+ setSelectedIndex(index);
347404
+ }
347419
347405
  };
347420
347406
 
347421
- var _proto = Tabs.prototype;
347422
-
347423
- _proto.render = function render() {
347424
- var _this$props = this.props,
347425
- children = _this$props.children,
347426
- defaultIndex = _this$props.defaultIndex,
347427
- defaultFocus = _this$props.defaultFocus,
347428
- props = Tabs_objectWithoutPropertiesLoose(_this$props, Tabs_excluded);
347407
+ var subProps = Tabs_extends({}, props);
347429
347408
 
347430
- var _this$state = this.state,
347431
- focus = _this$state.focus,
347432
- selectedIndex = _this$state.selectedIndex;
347433
- props.focus = focus;
347434
- props.onSelect = this.handleSelected;
347435
-
347436
- if (selectedIndex != null) {
347437
- props.selectedIndex = selectedIndex;
347438
- }
347409
+ subProps.focus = focus;
347410
+ subProps.onSelect = handleSelected;
347439
347411
 
347440
- return /*#__PURE__*/external_react_["default"].createElement(UncontrolledTabs, props, children);
347441
- };
347442
-
347443
- return Tabs;
347444
- }(external_react_.Component);
347412
+ if (selectedIndex != null) {
347413
+ subProps.selectedIndex = selectedIndex;
347414
+ }
347445
347415
 
347446
- Tabs.defaultProps = {
347447
- defaultFocus: false,
347448
- forceRenderTabPanel: false,
347449
- selectedIndex: null,
347450
- defaultIndex: null,
347451
- environment: null,
347452
- disableUpDownKeys: false
347416
+ delete subProps.defaultFocus;
347417
+ delete subProps.defaultIndex;
347418
+ delete subProps.focusTabOnClick;
347419
+ return /*#__PURE__*/external_react_["default"].createElement(components_UncontrolledTabs, subProps, children);
347453
347420
  };
347454
347421
 
347455
347422
  Tabs.propTypes = false ? 0 : {};
347423
+ Tabs.defaultProps = Tabs_defaultProps;
347456
347424
  Tabs.tabsRole = 'Tabs';
347425
+ /* harmony default export */ const components_Tabs = (Tabs);
347457
347426
  ;// ./node_modules/react-tabs/esm/components/TabList.js
347458
347427
  var TabList_excluded = ["children", "className"];
347459
347428
 
@@ -347461,44 +347430,29 @@ function TabList_extends() { TabList_extends = Object.assign || function (target
347461
347430
 
347462
347431
  function TabList_objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
347463
347432
 
347464
- function TabList_inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; TabList_setPrototypeOf(subClass, superClass); }
347465
-
347466
- function TabList_setPrototypeOf(o, p) { TabList_setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return TabList_setPrototypeOf(o, p); }
347467
-
347468
-
347469
-
347470
-
347471
-
347472
- var TabList = /*#__PURE__*/function (_Component) {
347473
- TabList_inheritsLoose(TabList, _Component);
347474
-
347475
- function TabList() {
347476
- return _Component.apply(this, arguments) || this;
347477
- }
347478
347433
 
347479
- var _proto = TabList.prototype;
347480
347434
 
347481
- _proto.render = function render() {
347482
- var _this$props = this.props,
347483
- children = _this$props.children,
347484
- className = _this$props.className,
347485
- attributes = TabList_objectWithoutPropertiesLoose(_this$props, TabList_excluded);
347486
347435
 
347487
- return /*#__PURE__*/external_react_["default"].createElement("ul", TabList_extends({}, attributes, {
347488
- className: (0,clsx_m/* default */.A)(className),
347489
- role: "tablist"
347490
- }), children);
347491
- };
347436
+ var TabList_defaultProps = {
347437
+ className: 'react-tabs__tab-list'
347438
+ };
347439
+ var TabList_propTypes = false ? 0 : {};
347492
347440
 
347493
- return TabList;
347494
- }(external_react_.Component);
347441
+ var TabList = function TabList(props) {
347442
+ var children = props.children,
347443
+ className = props.className,
347444
+ attributes = TabList_objectWithoutPropertiesLoose(props, TabList_excluded);
347495
347445
 
347496
- TabList.defaultProps = {
347497
- className: 'react-tabs__tab-list'
347446
+ return /*#__PURE__*/external_react_["default"].createElement("ul", TabList_extends({}, attributes, {
347447
+ className: (0,clsx_m/* default */.A)(className),
347448
+ role: "tablist"
347449
+ }), children);
347498
347450
  };
347499
347451
 
347500
- TabList.propTypes = false ? 0 : {};
347501
347452
  TabList.tabsRole = 'TabList';
347453
+ TabList.propTypes = false ? 0 : {};
347454
+ TabList.defaultProps = TabList_defaultProps;
347455
+ /* harmony default export */ const components_TabList = (TabList);
347502
347456
  ;// ./node_modules/react-tabs/esm/components/Tab.js
347503
347457
  var Tab_excluded = ["children", "className", "disabled", "disabledClassName", "focus", "id", "panelId", "selected", "selectedClassName", "tabIndex", "tabRef"];
347504
347458
 
@@ -347506,80 +347460,11 @@ function Tab_extends() { Tab_extends = Object.assign || function (target) { for
347506
347460
 
347507
347461
  function Tab_objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
347508
347462
 
347509
- function Tab_inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; Tab_setPrototypeOf(subClass, superClass); }
347510
-
347511
- function Tab_setPrototypeOf(o, p) { Tab_setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return Tab_setPrototypeOf(o, p); }
347512
-
347513
347463
 
347514
347464
 
347515
347465
 
347516
347466
  var DEFAULT_CLASS = 'react-tabs__tab';
347517
-
347518
- var Tab = /*#__PURE__*/function (_Component) {
347519
- Tab_inheritsLoose(Tab, _Component);
347520
-
347521
- function Tab() {
347522
- return _Component.apply(this, arguments) || this;
347523
- }
347524
-
347525
- var _proto = Tab.prototype;
347526
-
347527
- _proto.componentDidMount = function componentDidMount() {
347528
- this.checkFocus();
347529
- };
347530
-
347531
- _proto.componentDidUpdate = function componentDidUpdate() {
347532
- this.checkFocus();
347533
- };
347534
-
347535
- _proto.checkFocus = function checkFocus() {
347536
- var _this$props = this.props,
347537
- selected = _this$props.selected,
347538
- focus = _this$props.focus;
347539
-
347540
- if (selected && focus) {
347541
- this.node.focus();
347542
- }
347543
- };
347544
-
347545
- _proto.render = function render() {
347546
- var _cx,
347547
- _this = this;
347548
-
347549
- var _this$props2 = this.props,
347550
- children = _this$props2.children,
347551
- className = _this$props2.className,
347552
- disabled = _this$props2.disabled,
347553
- disabledClassName = _this$props2.disabledClassName,
347554
- focus = _this$props2.focus,
347555
- id = _this$props2.id,
347556
- panelId = _this$props2.panelId,
347557
- selected = _this$props2.selected,
347558
- selectedClassName = _this$props2.selectedClassName,
347559
- tabIndex = _this$props2.tabIndex,
347560
- tabRef = _this$props2.tabRef,
347561
- attributes = Tab_objectWithoutPropertiesLoose(_this$props2, Tab_excluded);
347562
-
347563
- return /*#__PURE__*/external_react_["default"].createElement("li", Tab_extends({}, attributes, {
347564
- className: (0,clsx_m/* default */.A)(className, (_cx = {}, _cx[selectedClassName] = selected, _cx[disabledClassName] = disabled, _cx)),
347565
- ref: function ref(node) {
347566
- _this.node = node;
347567
- if (tabRef) tabRef(node);
347568
- },
347569
- role: "tab",
347570
- id: id,
347571
- "aria-selected": selected ? 'true' : 'false',
347572
- "aria-disabled": disabled ? 'true' : 'false',
347573
- "aria-controls": panelId,
347574
- tabIndex: tabIndex || (selected ? '0' : null),
347575
- "data-rttab": true
347576
- }), children);
347577
- };
347578
-
347579
- return Tab;
347580
- }(external_react_.Component);
347581
-
347582
- Tab.defaultProps = {
347467
+ var DEFAULT_PROPS = {
347583
347468
  className: DEFAULT_CLASS,
347584
347469
  disabledClassName: DEFAULT_CLASS + "--disabled",
347585
347470
  focus: false,
@@ -347588,9 +347473,51 @@ Tab.defaultProps = {
347588
347473
  selected: false,
347589
347474
  selectedClassName: DEFAULT_CLASS + "--selected"
347590
347475
  };
347476
+ var Tab_propTypes = false ? 0 : {};
347477
+
347478
+ var Tab = function Tab(props) {
347479
+ var _cx;
347480
+
347481
+ var nodeRef = (0,external_react_.useRef)();
347482
+
347483
+ var children = props.children,
347484
+ className = props.className,
347485
+ disabled = props.disabled,
347486
+ disabledClassName = props.disabledClassName,
347487
+ focus = props.focus,
347488
+ id = props.id,
347489
+ panelId = props.panelId,
347490
+ selected = props.selected,
347491
+ selectedClassName = props.selectedClassName,
347492
+ tabIndex = props.tabIndex,
347493
+ tabRef = props.tabRef,
347494
+ attributes = Tab_objectWithoutPropertiesLoose(props, Tab_excluded);
347495
+
347496
+ (0,external_react_.useEffect)(function () {
347497
+ if (selected && focus) {
347498
+ nodeRef.current.focus();
347499
+ }
347500
+ }, [selected, focus]);
347501
+ return /*#__PURE__*/external_react_["default"].createElement("li", Tab_extends({}, attributes, {
347502
+ className: (0,clsx_m/* default */.A)(className, (_cx = {}, _cx[selectedClassName] = selected, _cx[disabledClassName] = disabled, _cx)),
347503
+ ref: function ref(node) {
347504
+ nodeRef.current = node;
347505
+ if (tabRef) tabRef(node);
347506
+ },
347507
+ role: "tab",
347508
+ id: id,
347509
+ "aria-selected": selected ? 'true' : 'false',
347510
+ "aria-disabled": disabled ? 'true' : 'false',
347511
+ "aria-controls": panelId,
347512
+ tabIndex: tabIndex || (selected ? '0' : null),
347513
+ "data-rttab": true
347514
+ }), children);
347515
+ };
347591
347516
 
347592
347517
  Tab.propTypes = false ? 0 : {};
347593
347518
  Tab.tabsRole = 'Tab';
347519
+ Tab.defaultProps = DEFAULT_PROPS;
347520
+ /* harmony default export */ const components_Tab = (Tab);
347594
347521
  ;// ./node_modules/react-tabs/esm/components/TabPanel.js
347595
347522
  var TabPanel_excluded = ["children", "className", "forceRender", "id", "selected", "selectedClassName", "tabId"];
347596
347523
 
@@ -347598,56 +347525,41 @@ function TabPanel_extends() { TabPanel_extends = Object.assign || function (targ
347598
347525
 
347599
347526
  function TabPanel_objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
347600
347527
 
347601
- function TabPanel_inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; TabPanel_setPrototypeOf(subClass, superClass); }
347602
-
347603
- function TabPanel_setPrototypeOf(o, p) { TabPanel_setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return TabPanel_setPrototypeOf(o, p); }
347604
-
347605
347528
 
347606
347529
 
347607
347530
 
347608
347531
  var TabPanel_DEFAULT_CLASS = 'react-tabs__tab-panel';
347609
-
347610
- var TabPanel = /*#__PURE__*/function (_Component) {
347611
- TabPanel_inheritsLoose(TabPanel, _Component);
347612
-
347613
- function TabPanel() {
347614
- return _Component.apply(this, arguments) || this;
347615
- }
347616
-
347617
- var _proto = TabPanel.prototype;
347618
-
347619
- _proto.render = function render() {
347620
- var _cx;
347621
-
347622
- var _this$props = this.props,
347623
- children = _this$props.children,
347624
- className = _this$props.className,
347625
- forceRender = _this$props.forceRender,
347626
- id = _this$props.id,
347627
- selected = _this$props.selected,
347628
- selectedClassName = _this$props.selectedClassName,
347629
- tabId = _this$props.tabId,
347630
- attributes = TabPanel_objectWithoutPropertiesLoose(_this$props, TabPanel_excluded);
347631
-
347632
- return /*#__PURE__*/external_react_["default"].createElement("div", TabPanel_extends({}, attributes, {
347633
- className: (0,clsx_m/* default */.A)(className, (_cx = {}, _cx[selectedClassName] = selected, _cx)),
347634
- role: "tabpanel",
347635
- id: id,
347636
- "aria-labelledby": tabId
347637
- }), forceRender || selected ? children : null);
347638
- };
347639
-
347640
- return TabPanel;
347641
- }(external_react_.Component);
347642
-
347643
- TabPanel.defaultProps = {
347532
+ var TabPanel_defaultProps = {
347644
347533
  className: TabPanel_DEFAULT_CLASS,
347645
347534
  forceRender: false,
347646
347535
  selectedClassName: TabPanel_DEFAULT_CLASS + "--selected"
347647
347536
  };
347537
+ var TabPanel_propTypes = false ? 0 : {};
347538
+
347539
+ var TabPanel = function TabPanel(props) {
347540
+ var _cx;
347541
+
347542
+ var children = props.children,
347543
+ className = props.className,
347544
+ forceRender = props.forceRender,
347545
+ id = props.id,
347546
+ selected = props.selected,
347547
+ selectedClassName = props.selectedClassName,
347548
+ tabId = props.tabId,
347549
+ attributes = TabPanel_objectWithoutPropertiesLoose(props, TabPanel_excluded);
347550
+
347551
+ return /*#__PURE__*/external_react_["default"].createElement("div", TabPanel_extends({}, attributes, {
347552
+ className: (0,clsx_m/* default */.A)(className, (_cx = {}, _cx[selectedClassName] = selected, _cx)),
347553
+ role: "tabpanel",
347554
+ id: id,
347555
+ "aria-labelledby": tabId
347556
+ }), forceRender || selected ? children : null);
347557
+ };
347648
347558
 
347649
- TabPanel.propTypes = false ? 0 : {};
347650
347559
  TabPanel.tabsRole = 'TabPanel';
347560
+ TabPanel.propTypes = false ? 0 : {};
347561
+ TabPanel.defaultProps = TabPanel_defaultProps;
347562
+ /* harmony default export */ const components_TabPanel = (TabPanel);
347651
347563
  ;// ./node_modules/react-tabs/esm/index.js
347652
347564
 
347653
347565
 
@@ -369325,6 +369237,7 @@ function HtmlRunner() {
369325
369237
  const [searchParams, setSearchParams] = (0, react_router_dom_1.useSearchParams)();
369326
369238
  // Using BroadcastChannel to communicate between the main app and the preview tab
369327
369239
  const broadcastChannel = (0, react_1.useRef)(null);
369240
+ const [iframeKey, setIframeKey] = (0, react_1.useState)(0);
369328
369241
  (0, react_1.useEffect)(() => {
369329
369242
  broadcastChannel.current = new BroadcastChannel(BROADCAST_CHANNEL);
369330
369243
  return () => {
@@ -369421,6 +369334,8 @@ function HtmlRunner() {
369421
369334
  }, []);
369422
369335
  (0, react_1.useEffect)(() => {
369423
369336
  if (codeRunTriggered) {
369337
+ // Set unique key to force iframe remount
369338
+ setIframeKey((prev) => prev + 1);
369424
369339
  runCode();
369425
369340
  if (!isPreviewMode) {
369426
369341
  broadcastChannel.current?.postMessage({
@@ -369462,8 +369377,11 @@ function HtmlRunner() {
369462
369377
  body.insertAdjacentHTML("afterbegin", scripts_1.disableLocalStorageScript);
369463
369378
  htmlRoot.insertAdjacentHTML("afterbegin", scripts_1.consoleOverrideScript);
369464
369379
  const { content } = await (0, fileParsers_1.resolveAndRewriteHtmlImports)(indexPage.toString(), projectComponents, entryPoint.path, page ?? entryPoint.path);
369465
- if (output.current) {
369466
- output.current.srcdoc = content;
369380
+ if (output.current?.contentWindow?.document) {
369381
+ const doc = output.current.contentWindow.document;
369382
+ doc.open();
369383
+ doc.write(content);
369384
+ doc.close();
369467
369385
  }
369468
369386
  if (codeRunTriggered) {
369469
369387
  dispatch((0, EditorSlice_1.codeRunHandled)());
@@ -369512,7 +369430,7 @@ function HtmlRunner() {
369512
369430
  const iframeClasses = (0, classnames_1.default)(styles_module_scss_1.default.iframe, {
369513
369431
  [styles_module_scss_1.default.codeHasBeenRun]: codeHasBeenRun,
369514
369432
  });
369515
- return ((0, jsx_runtime_1.jsxs)("div", { className: styles_module_scss_1.default.htmlrunnerContainer, children: [(0, jsx_runtime_1.jsx)(OutputTabPanel_1.OutputTabPanel, { title: "Preview", icon: preview_svg_1.default, readOnly: readOnly, extraTabContent: codeHasBeenRun && openInNewTabLink, tabPanelClassName: styles_module_scss_1.default.previewHtml, children: error ? ((0, jsx_runtime_1.jsx)("div", { className: iframeClasses, children: (0, jsx_runtime_1.jsx)(NotFoundPage_1.NotFoundPage, {}) })) : ((0, jsx_runtime_1.jsx)("iframe", { className: iframeClasses, sandbox: "allow-scripts allow-same-origin allow-modals allow-popups", referrerPolicy: "strict-origin-when-cross-origin", allow: "\n accelerometer 'none';\n camera 'none';\n encrypted-media;\n fullscreen;\n picture-in-picture;\n geolocation 'none';\n gyroscope 'none';\n magnetometer 'none';\n microphone 'none';\n midi 'none';\n payment 'none';\n usb 'none';\n ", id: "output-frame", title: "HTML Output Preview", ref: output, onLoad: iframeReload })) }), !isPreviewMode && ((0, jsx_runtime_1.jsx)(ResizableWithHandle_1.default, { "data-testid": "proj-console-container", handleDirection: "top", defaultHeight: "50%", className: styles_module_scss_1.default.resizeContainer, handleClassName: styles_module_scss_1.default.resizeHandleContainer, children: (0, jsx_runtime_1.jsx)(OutputTabPanel_1.OutputTabPanel, { title: "Console", icon: console_svg_1.default, readOnly: readOnly, children: (0, jsx_runtime_1.jsx)(HtmlConsole_1.default, { consoleLogs: consoleLogs }) }) }))] }));
369433
+ return ((0, jsx_runtime_1.jsxs)("div", { className: styles_module_scss_1.default.htmlrunnerContainer, children: [(0, jsx_runtime_1.jsx)(OutputTabPanel_1.OutputTabPanel, { title: "Preview", icon: preview_svg_1.default, readOnly: readOnly, extraTabContent: codeHasBeenRun && openInNewTabLink, tabPanelClassName: styles_module_scss_1.default.previewHtml, children: error ? ((0, jsx_runtime_1.jsx)("div", { className: iframeClasses, children: (0, jsx_runtime_1.jsx)(NotFoundPage_1.NotFoundPage, {}) })) : ((0, jsx_runtime_1.jsx)("iframe", { className: iframeClasses, sandbox: "allow-scripts allow-same-origin allow-modals allow-popups", referrerPolicy: "strict-origin-when-cross-origin", allow: "\n accelerometer 'none';\n camera 'none';\n encrypted-media;\n fullscreen;\n picture-in-picture;\n geolocation 'none';\n gyroscope 'none';\n magnetometer 'none';\n microphone 'none';\n midi 'none';\n payment 'none';\n usb 'none';\n ", id: "output-frame", title: "HTML Output Preview", ref: output, onLoad: iframeReload, src: "about:blank" }, iframeKey)) }), !isPreviewMode && ((0, jsx_runtime_1.jsx)(ResizableWithHandle_1.default, { "data-testid": "proj-console-container", handleDirection: "top", defaultHeight: "50%", className: styles_module_scss_1.default.resizeContainer, handleClassName: styles_module_scss_1.default.resizeHandleContainer, children: (0, jsx_runtime_1.jsx)(OutputTabPanel_1.OutputTabPanel, { title: "Console", icon: console_svg_1.default, readOnly: readOnly, children: (0, jsx_runtime_1.jsx)(HtmlConsole_1.default, { consoleLogs: consoleLogs }) }) }))] }));
369516
369434
  }
369517
369435
  exports["default"] = HtmlRunner;
369518
369436
 
package/dist/style.css CHANGED
@@ -33,13 +33,11 @@
33
33
  }
34
34
 
35
35
  .react-tabs__tab:focus {
36
- box-shadow: 0 0 5px hsl(208, 99%, 50%);
37
- border-color: hsl(208, 99%, 50%);
38
36
  outline: none;
39
37
  }
40
38
 
41
39
  .react-tabs__tab:focus:after {
42
- content: "";
40
+ content: '';
43
41
  position: absolute;
44
42
  height: 5px;
45
43
  left: -4px;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "gwchq-textjam",
3
3
  "description": "Embeddable React editor used in Raspberry Pi text-based projects.",
4
- "version": "0.2.30",
4
+ "version": "0.2.32",
5
5
  "license": "Apache-2.0",
6
6
  "homepage": "https://github.com/GirlsFirst/gwchq-textjam",
7
7
  "author": "Girls Who Code HQ",