@codecademy/codebytes 1.0.10-alpha.c35c72376b.0 → 1.0.10-alpha.d62cbf49cc.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -28,5 +28,5 @@ export declare const ui: {
28
28
  inactive: string;
29
29
  };
30
30
  };
31
- export type SyntaxColors = typeof syntax;
32
- export type UIColors = typeof ui;
31
+ export declare type SyntaxColors = typeof syntax;
32
+ export declare type UIColors = typeof ui;
@@ -2,6 +2,7 @@
2
2
  // This file is part of the Codebytes MVP and only includes basic configuration around theming for the SimpleMonacoEditor component
3
3
  // We are working on a monaco package in client-modules that has more configuration around themes and languages
4
4
  // Monaco as a shared package RFC https://www.notion.so/codecademy/Monaco-editor-as-a-shared-package-1f4484db165b4abc8394c3556451ef6a
5
+
5
6
  import { colors, editorColors } from '@codecademy/gamut-styles';
6
7
  var darkTheme = {
7
8
  blue: editorColors.blue,
@@ -1,6 +1,6 @@
1
1
  import { EditorProps } from '@monaco-editor/react';
2
2
  import React from 'react';
3
- export type SimpleMonacoEditorProps = {
3
+ export declare type SimpleMonacoEditorProps = {
4
4
  value: string;
5
5
  language: string;
6
6
  onChange?: EditorProps['onChange'];
@@ -2,41 +2,46 @@
2
2
  // This component is part of the Codebytes MVP and only includes basic configuration around theming
3
3
  // We are working on a monaco package in client-modules that has more configuration around themes and languages
4
4
  // Monaco as a shared package RFC https://www.notion.so/codecademy/Monaco-editor-as-a-shared-package-1f4484db165b4abc8394c3556451ef6a
5
+
5
6
  import ReactMonacoEditor from '@monaco-editor/react';
6
7
  import React, { useCallback, useRef } from 'react';
7
8
  import ResizeObserver from 'react-resize-observer';
8
9
  import { dark } from './theme';
10
+ import { jsx as _jsx } from "react/jsx-runtime";
11
+ import { Fragment as _Fragment } from "react/jsx-runtime";
12
+ import { jsxs as _jsxs } from "react/jsx-runtime";
9
13
  export var SimpleMonacoEditor = function SimpleMonacoEditor(_ref) {
10
14
  var value = _ref.value,
11
- language = _ref.language,
12
- onChange = _ref.onChange;
15
+ language = _ref.language,
16
+ onChange = _ref.onChange;
13
17
  var editorRef = useRef(null);
14
18
  var editorWillMount = useCallback(function (editor, monaco) {
15
19
  editorRef.current = editor;
16
20
  monaco.editor.defineTheme('dark', dark);
17
21
  monaco.editor.setTheme('dark');
18
22
  }, []);
19
- return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(ResizeObserver, {
20
- onResize: function onResize(_ref2) {
21
- var _editorRef$current;
22
-
23
- var height = _ref2.height,
23
+ return /*#__PURE__*/_jsxs(_Fragment, {
24
+ children: [/*#__PURE__*/_jsx(ResizeObserver, {
25
+ onResize: function onResize(_ref2) {
26
+ var _editorRef$current;
27
+ var height = _ref2.height,
24
28
  width = _ref2.width;
25
- (_editorRef$current = editorRef.current) === null || _editorRef$current === void 0 ? void 0 : _editorRef$current.layout({
26
- height: height,
27
- width: width
28
- });
29
- }
30
- }), /*#__PURE__*/React.createElement(ReactMonacoEditor, {
31
- onMount: editorWillMount,
32
- onChange: onChange,
33
- options: {
34
- minimap: {
35
- enabled: false
29
+ (_editorRef$current = editorRef.current) === null || _editorRef$current === void 0 ? void 0 : _editorRef$current.layout({
30
+ height: height,
31
+ width: width
32
+ });
36
33
  }
37
- },
38
- theme: "vs-dark",
39
- value: value,
40
- language: language
41
- }));
34
+ }), /*#__PURE__*/_jsx(ReactMonacoEditor, {
35
+ onMount: editorWillMount,
36
+ onChange: onChange,
37
+ options: {
38
+ minimap: {
39
+ enabled: false
40
+ }
41
+ },
42
+ theme: "vs-dark",
43
+ value: value,
44
+ language: language
45
+ })]
46
+ });
42
47
  };
@@ -2,19 +2,19 @@
2
2
  // This file is part of the Codebytes MVP and only includes basic configuration around theming for the SimpleMonacoEditor component
3
3
  // We are working on a monaco package in client-modules that has more configuration around themes and languages
4
4
  // Monaco as a shared package RFC https://www.notion.so/codecademy/Monaco-editor-as-a-shared-package-1f4484db165b4abc8394c3556451ef6a
5
- import * as darkColors from './colorsDark';
6
5
 
6
+ import * as darkColors from './colorsDark';
7
7
  var c = function c(color) {
8
8
  return color.substr(1);
9
9
  };
10
-
11
10
  var theme = function theme(_ref) {
12
11
  var ui = _ref.ui,
13
- syntax = _ref.syntax;
12
+ syntax = _ref.syntax;
14
13
  return {
15
14
  base: 'vs-dark',
16
15
  inherit: true,
17
- rules: [// Base
16
+ rules: [
17
+ // Base
18
18
  {
19
19
  token: '',
20
20
  foreground: c(syntax.basic)
@@ -119,5 +119,4 @@ var theme = function theme(_ref) {
119
119
  }
120
120
  };
121
121
  };
122
-
123
122
  export var dark = theme(darkColors);
@@ -1 +1 @@
1
- export type Monaco = typeof import('monaco-editor');
1
+ export declare type Monaco = typeof import('monaco-editor');
package/dist/api.d.ts CHANGED
@@ -8,5 +8,5 @@ interface PostSnippetData {
8
8
  language: LanguageOption;
9
9
  code: string;
10
10
  }
11
- export declare const postSnippet: (data: PostSnippetData, snippetsBaseUrl?: string) => Promise<Response>;
11
+ export declare const postSnippet: (data: PostSnippetData, snippetsBaseUrl?: string | undefined) => Promise<Response>;
12
12
  export {};
package/dist/api.js CHANGED
@@ -1,40 +1,31 @@
1
1
  function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
2
-
3
- function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return generator._invoke = function (innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; }(innerFn, self, context), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; this._invoke = function (method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); }; } function maybeInvokeDelegate(delegate, context) { var method = delegate.iterator[context.method]; if (undefined === method) { if (context.delegate = null, "throw" === context.method) { if (delegate.iterator.return && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method)) return ContinueSentinel; context.method = "throw", context.arg = new TypeError("The iterator does not provide a 'throw' method"); } return ContinueSentinel; } var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) { if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; } return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, define(Gp, "constructor", GeneratorFunctionPrototype), define(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (object) { var keys = []; for (var key in object) { keys.push(key); } return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) { "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); } }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, catch: function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }
4
-
2
+ function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, defineProperty = Object.defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return defineProperty(generator, "_invoke", { value: makeInvokeMethod(innerFn, self, context) }), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; defineProperty(this, "_invoke", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; } function maybeInvokeDelegate(delegate, context) { var methodName = context.method, method = delegate.iterator[methodName]; if (undefined === method) return context.delegate = null, "throw" === methodName && delegate.iterator.return && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method")), ContinueSentinel; var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (val) { var object = Object(val), keys = []; for (var key in object) keys.push(key); return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, catch: function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }
5
3
  function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
6
-
7
4
  function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
8
-
9
5
  export var postSnippet = /*#__PURE__*/function () {
10
6
  var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(data, snippetsBaseUrl) {
11
7
  var snippetsEndpoint, response;
12
8
  return _regeneratorRuntime().wrap(function _callee$(_context) {
13
- while (1) {
14
- switch (_context.prev = _context.next) {
15
- case 0:
16
- snippetsEndpoint = "https://".concat(snippetsBaseUrl, "/snippets");
17
- _context.next = 3;
18
- return fetch(snippetsEndpoint, {
19
- method: 'POST',
20
- body: JSON.stringify(data),
21
- headers: {
22
- 'x-codecademy-user-id': 'codebytes-anon-user'
23
- }
24
- });
25
-
26
- case 3:
27
- response = _context.sent;
28
- return _context.abrupt("return", response.json());
29
-
30
- case 5:
31
- case "end":
32
- return _context.stop();
33
- }
9
+ while (1) switch (_context.prev = _context.next) {
10
+ case 0:
11
+ snippetsEndpoint = "https://".concat(snippetsBaseUrl, "/snippets");
12
+ _context.next = 3;
13
+ return fetch(snippetsEndpoint, {
14
+ method: 'POST',
15
+ body: JSON.stringify(data),
16
+ headers: {
17
+ 'x-codecademy-user-id': 'codebytes-anon-user'
18
+ }
19
+ });
20
+ case 3:
21
+ response = _context.sent;
22
+ return _context.abrupt("return", response.json());
23
+ case 5:
24
+ case "end":
25
+ return _context.stop();
34
26
  }
35
27
  }, _callee);
36
28
  }));
37
-
38
29
  return function postSnippet(_x, _x2) {
39
30
  return _ref.apply(this, arguments);
40
31
  };
@@ -1,24 +1,19 @@
1
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
1
2
  import _styled from "@emotion/styled/base";
2
3
  var _excluded = ["text", "language", "hideCopyButton", "snippetsBaseUrl", "onEdit", "onLanguageChange", "copyFormatter", "trackingData", "trackFirstEdit"];
3
-
4
- function _extends() { _extends = Object.assign ? Object.assign.bind() : 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 _extends.apply(this, arguments); }
5
-
4
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
5
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
6
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
7
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
8
+ function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
6
9
  function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
7
-
8
10
  function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
9
-
10
11
  function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
11
-
12
- function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
13
-
14
- function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
15
-
12
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
13
+ function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
16
14
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
17
-
18
15
  function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
19
-
20
16
  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; }
21
-
22
17
  import { Box, IconButton } from '@codecademy/gamut';
23
18
  import { FaviconIcon } from '@codecademy/gamut-icons';
24
19
  import { Background, system } from '@codecademy/gamut-styles';
@@ -29,6 +24,8 @@ import { trackClick } from './helpers';
29
24
  import { useEverInView } from './helpers/useEverInView';
30
25
  import { LanguageSelection } from './languageSelection';
31
26
  import { trackUserImpression } from './libs/eventTracking';
27
+ import { jsx as _jsx } from "react/jsx-runtime";
28
+ import { jsxs as _jsxs } from "react/jsx-runtime";
32
29
  var editorBaseStyles = system.css({
33
30
  border: 1,
34
31
  borderColor: 'gray-900',
@@ -36,54 +33,45 @@ var editorBaseStyles = system.css({
36
33
  flexDirection: 'column',
37
34
  minHeight: '25rem'
38
35
  });
39
-
40
36
  var EditorContainer = /*#__PURE__*/_styled(Background, {
41
37
  target: "e1epka4g0",
42
38
  label: "EditorContainer"
43
39
  })(editorBaseStyles, process.env.NODE_ENV === "production" ? "" : "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uL3NyYy9jb2RlQnl0ZUVkaXRvci50c3giXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBdUJ3QiIsImZpbGUiOiIuLi9zcmMvY29kZUJ5dGVFZGl0b3IudHN4Iiwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0IHsgQm94LCBJY29uQnV0dG9uIH0gZnJvbSAnQGNvZGVjYWRlbXkvZ2FtdXQnO1xuaW1wb3J0IHsgRmF2aWNvbkljb24gfSBmcm9tICdAY29kZWNhZGVteS9nYW11dC1pY29ucyc7XG5pbXBvcnQgeyBCYWNrZ3JvdW5kLCBzeXN0ZW0gfSBmcm9tICdAY29kZWNhZGVteS9nYW11dC1zdHlsZXMnO1xuaW1wb3J0IHsgU3R5bGVQcm9wcyB9IGZyb20gJ0Bjb2RlY2FkZW15L3ZhcmlhbmNlJztcbmltcG9ydCBzdHlsZWQgZnJvbSAnQGVtb3Rpb24vc3R5bGVkJztcbmltcG9ydCBSZWFjdCwgeyB1c2VFZmZlY3QsIHVzZVN0YXRlIH0gZnJvbSAncmVhY3QnO1xuXG5pbXBvcnQgeyBoZWxsb1dvcmxkLCBMYW5ndWFnZU9wdGlvbiB9IGZyb20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ydWUpO1xuICAgICAgICAgICAgICB0cmFja0NsaWNrKCdlZGl0JywgdHJhY2tpbmdEYXRhKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICB9fVxuICAgICAgICAgIHNuaXBwZXRzQmFzZVVybD17c25pcHBldHNCYXNlVXJsfVxuICAgICAgICAgIGNvcHlGb3JtYXR0ZXI9e2NvcHlGb3JtYXR0ZXJ9XG4gICAgICAgICAgdHJhY2tpbmdEYXRhPXt0cmFja2luZ0RhdGF9XG4gICAgICAgIC8+XG4gICAgICApIDogKFxuICAgICAgICA8TGFuZ3VhZ2VTZWxlY3Rpb25cbiAgICAgICAgICBvbkNoYW5nZT17KG5ld0xhbmd1YWdlKSA9PiB7XG4gICAgICAgICAgICBjb25zdCBuZXdUZXh0OiBzdHJpbmcgPVxuICAgICAgICAgICAgICB0ZXh0IHx8IChuZXdMYW5ndWFnZSA/IGhlbGxvV29ybGRbbmV3TGFuZ3VhZ2VdIDogJycpO1xuICAgICAgICAgICAgc2V0TGFuZ3VhZ2UobmV3TGFuZ3VhZ2UpO1xuICAgICAgICAgICAgc2V0VGV4dChuZXdUZXh0KTtcbiAgICAgICAgICAgIHRyYWNrQ2xpY2soJ2xhbmdfc2VsZWN0JywgdHJhY2tpbmdEYXRhKTtcbiAgICAgICAgICAgIG9uTGFuZ3VhZ2VDaGFuZ2U/LihuZXdUZXh0LCBuZXdMYW5ndWFnZSk7XG4gICAgICAgICAgfX1cbiAgICAgICAgLz5cbiAgICAgICl9XG4gICAgPC9FZGl0b3JDb250YWluZXI+XG4gICk7XG59O1xuXG5leHBvcnQgZGVmYXVsdCBDb2RlQnl0ZUVkaXRvcjtcbiJdfQ== */");
44
-
45
40
  export var CodeByteEditor = function CodeByteEditor(_ref) {
46
41
  var initialText = _ref.text,
47
- initialLanguage = _ref.language,
48
- _ref$hideCopyButton = _ref.hideCopyButton,
49
- hideCopyButton = _ref$hideCopyButton === void 0 ? false : _ref$hideCopyButton,
50
- snippetsBaseUrl = _ref.snippetsBaseUrl,
51
- onEdit = _ref.onEdit,
52
- onLanguageChange = _ref.onLanguageChange,
53
- copyFormatter = _ref.copyFormatter,
54
- trackingData = _ref.trackingData,
55
- _ref$trackFirstEdit = _ref.trackFirstEdit,
56
- trackFirstEdit = _ref$trackFirstEdit === void 0 ? false : _ref$trackFirstEdit,
57
- rest = _objectWithoutProperties(_ref, _excluded);
58
-
42
+ initialLanguage = _ref.language,
43
+ _ref$hideCopyButton = _ref.hideCopyButton,
44
+ hideCopyButton = _ref$hideCopyButton === void 0 ? false : _ref$hideCopyButton,
45
+ snippetsBaseUrl = _ref.snippetsBaseUrl,
46
+ onEdit = _ref.onEdit,
47
+ onLanguageChange = _ref.onLanguageChange,
48
+ copyFormatter = _ref.copyFormatter,
49
+ trackingData = _ref.trackingData,
50
+ _ref$trackFirstEdit = _ref.trackFirstEdit,
51
+ trackFirstEdit = _ref$trackFirstEdit === void 0 ? false : _ref$trackFirstEdit,
52
+ rest = _objectWithoutProperties(_ref, _excluded);
59
53
  var _useEverInView = useEverInView(),
60
- everInView = _useEverInView.everInView,
61
- ref = _useEverInView.ref;
62
-
54
+ everInView = _useEverInView.everInView,
55
+ ref = _useEverInView.ref;
63
56
  var getInitialText = function getInitialText() {
64
57
  if (initialText !== undefined) return initialText;
65
58
  return initialLanguage ? helloWorld[initialLanguage] : '';
66
59
  };
67
-
68
60
  var _useState = useState(getInitialText()),
69
- _useState2 = _slicedToArray(_useState, 2),
70
- text = _useState2[0],
71
- setText = _useState2[1];
72
-
61
+ _useState2 = _slicedToArray(_useState, 2),
62
+ text = _useState2[0],
63
+ setText = _useState2[1];
73
64
  var _useState3 = useState(initialLanguage !== null && initialLanguage !== void 0 ? initialLanguage : ''),
74
- _useState4 = _slicedToArray(_useState3, 2),
75
- language = _useState4[0],
76
- setLanguage = _useState4[1];
77
-
65
+ _useState4 = _slicedToArray(_useState3, 2),
66
+ language = _useState4[0],
67
+ setLanguage = _useState4[1];
78
68
  var _useState5 = useState(false),
79
- _useState6 = _slicedToArray(_useState5, 2),
80
- hasBeenEdited = _useState6[0],
81
- setHasBeenEdited = _useState6[1];
82
-
69
+ _useState6 = _slicedToArray(_useState5, 2),
70
+ hasBeenEdited = _useState6[0],
71
+ setHasBeenEdited = _useState6[1];
83
72
  useEffect(function () {
84
73
  if (everInView) {
85
74
  var _trackingData$page_na, _trackingData$context;
86
-
87
75
  trackUserImpression({
88
76
  page_name: (_trackingData$page_na = trackingData === null || trackingData === void 0 ? void 0 : trackingData.page_name) !== null && _trackingData$page_na !== void 0 ? _trackingData$page_na : 'Unknown',
89
77
  context: (_trackingData$context = trackingData === null || trackingData === void 0 ? void 0 : trackingData.context) !== null && _trackingData$context !== void 0 ? _trackingData$context : document.referrer,
@@ -91,51 +79,52 @@ export var CodeByteEditor = function CodeByteEditor(_ref) {
91
79
  });
92
80
  }
93
81
  }, [everInView, trackingData]);
94
- return /*#__PURE__*/React.createElement(EditorContainer, _extends({
82
+ return /*#__PURE__*/_jsxs(EditorContainer, _objectSpread(_objectSpread({
95
83
  bg: "black",
96
84
  maxWidth: "43rem"
97
- }, rest, {
85
+ }, rest), {}, {
98
86
  overflow: "hidden",
99
- ref: ref
100
- }), /*#__PURE__*/React.createElement(Box, {
101
- borderBottom: 1,
102
- borderColor: "gray-900",
103
- py: 4,
104
- pl: 8
105
- }, /*#__PURE__*/React.createElement(IconButton, {
106
- icon: FaviconIcon,
107
- variant: "secondary",
108
- href: "https://www.codecademy.com/",
109
- target: "_blank",
110
- rel: "noreferrer",
111
- "aria-label": "visit codecademy.com",
112
- onClick: function onClick() {
113
- return trackClick('logo', trackingData);
114
- }
115
- })), language ? /*#__PURE__*/React.createElement(Editor, {
116
- language: language,
117
- text: text,
118
- hideCopyButton: hideCopyButton,
119
- onChange: function onChange(newText) {
120
- setText(newText);
121
- onEdit === null || onEdit === void 0 ? void 0 : onEdit(newText, language);
122
-
123
- if (trackFirstEdit && hasBeenEdited === false) {
124
- setHasBeenEdited(true);
125
- trackClick('edit', trackingData);
87
+ ref: ref,
88
+ children: [/*#__PURE__*/_jsx(Box, {
89
+ borderBottom: 1,
90
+ borderColor: "gray-900",
91
+ py: 4,
92
+ pl: 8,
93
+ children: /*#__PURE__*/_jsx(IconButton, {
94
+ icon: FaviconIcon,
95
+ variant: "secondary",
96
+ href: "https://www.codecademy.com/",
97
+ target: "_blank",
98
+ rel: "noreferrer",
99
+ "aria-label": "visit codecademy.com",
100
+ onClick: function onClick() {
101
+ return trackClick('logo', trackingData);
102
+ }
103
+ })
104
+ }), language ? /*#__PURE__*/_jsx(Editor, {
105
+ language: language,
106
+ text: text,
107
+ hideCopyButton: hideCopyButton,
108
+ onChange: function onChange(newText) {
109
+ setText(newText);
110
+ onEdit === null || onEdit === void 0 ? void 0 : onEdit(newText, language);
111
+ if (trackFirstEdit && hasBeenEdited === false) {
112
+ setHasBeenEdited(true);
113
+ trackClick('edit', trackingData);
114
+ }
115
+ },
116
+ snippetsBaseUrl: snippetsBaseUrl,
117
+ copyFormatter: copyFormatter,
118
+ trackingData: trackingData
119
+ }) : /*#__PURE__*/_jsx(LanguageSelection, {
120
+ onChange: function onChange(newLanguage) {
121
+ var newText = text || (newLanguage ? helloWorld[newLanguage] : '');
122
+ setLanguage(newLanguage);
123
+ setText(newText);
124
+ trackClick('lang_select', trackingData);
125
+ onLanguageChange === null || onLanguageChange === void 0 ? void 0 : onLanguageChange(newText, newLanguage);
126
126
  }
127
- },
128
- snippetsBaseUrl: snippetsBaseUrl,
129
- copyFormatter: copyFormatter,
130
- trackingData: trackingData
131
- }) : /*#__PURE__*/React.createElement(LanguageSelection, {
132
- onChange: function onChange(newLanguage) {
133
- var newText = text || (newLanguage ? helloWorld[newLanguage] : '');
134
- setLanguage(newLanguage);
135
- setText(newText);
136
- trackClick('lang_select', trackingData);
137
- onLanguageChange === null || onLanguageChange === void 0 ? void 0 : onLanguageChange(newText, newLanguage);
138
- }
127
+ })]
139
128
  }));
140
129
  };
141
130
  export default CodeByteEditor;
package/dist/consts.d.ts CHANGED
@@ -9,7 +9,7 @@ export declare const LanguageOptions: {
9
9
  ruby: string;
10
10
  scheme: string;
11
11
  };
12
- export type LanguageOption = keyof typeof LanguageOptions;
12
+ export declare type LanguageOption = keyof typeof LanguageOptions;
13
13
  export declare const validLanguages: ("cpp" | "csharp" | "golang" | "javascript" | "php" | "python" | "ruby" | "scheme")[];
14
14
  export declare const helloWorld: {
15
15
  readonly cpp: "#include <iostream>\nint main() {\n std::cout << \"Hello world!\";\n return 0;\n}";
package/dist/drawers.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- export type DrawersProps = {
2
+ export declare type DrawersProps = {
3
3
  leftChild: React.ReactNode;
4
4
  rightChild: React.ReactNode;
5
5
  };