@code-hike/mini-editor
Advanced tools
Comparing version 0.3.0--canary.77.ade5d72.0 to 0.3.0--canary.77.c58a10a.0
@@ -468,3 +468,3 @@ 'use strict'; | ||
style: northStyle, | ||
children: (React__default['default'].createElement(CodeTransition, { codeProps: codeProps, prevFile: prevNorthFile, nextFile: nextNorthFile, t: t })), | ||
children: (React__default['default'].createElement(CodeTransition, { codeProps: codeProps, prevFile: prevNorthFile, nextFile: nextNorthFile, t: t, parentHeight: northStyle.height })), | ||
}, | ||
@@ -474,3 +474,3 @@ southPanel: inputSouthPanel && { | ||
style: southStyle, | ||
children: (React__default['default'].createElement(CodeTransition, { codeProps: codeProps, prevFile: prevSouthFile, nextFile: nextSouthFile, t: t })), | ||
children: (React__default['default'].createElement(CodeTransition, { codeProps: codeProps, prevFile: prevSouthFile, nextFile: nextSouthFile, t: t, parentHeight: southStyle === null || southStyle === void 0 ? void 0 : southStyle.height })), | ||
}, | ||
@@ -484,2 +484,6 @@ }; | ||
var _a = getStepFiles(prev, next, true), prevNorthFile = _a.prevNorthFile, prevSouthFile = _a.prevSouthFile, nextNorthFile = _a.nextNorthFile, nextSouthFile = _a.nextSouthFile; | ||
var northHeight = inputSouthPanel | ||
? "calc((100% - var(--ch-title-bar-height)) * " + inputNorthPanel.heightRatio + ")" | ||
: "100%"; | ||
var southHeight = "calc((100% - var(--ch-title-bar-height)) * " + (inputSouthPanel === null || inputSouthPanel === void 0 ? void 0 : inputSouthPanel.heightRatio) + " + var(--ch-title-bar-height))"; | ||
return { | ||
@@ -493,7 +497,5 @@ northPanel: { | ||
style: { | ||
height: inputSouthPanel | ||
? "calc((100% - var(--ch-title-bar-height)) * " + inputNorthPanel.heightRatio + ")" | ||
: "100%", | ||
height: northHeight, | ||
}, | ||
children: (React__default['default'].createElement(CodeTransition, { codeProps: codeProps, prevFile: prevNorthFile, nextFile: nextNorthFile, t: 0 })), | ||
children: (React__default['default'].createElement(CodeTransition, { codeProps: codeProps, prevFile: prevNorthFile, nextFile: nextNorthFile, t: 0, parentHeight: northHeight })), | ||
}, | ||
@@ -509,3 +511,3 @@ southPanel: inputSouthPanel && { | ||
}, | ||
children: (React__default['default'].createElement(CodeTransition, { codeProps: codeProps, prevFile: prevSouthFile, nextFile: nextSouthFile, t: 0 })), | ||
children: (React__default['default'].createElement(CodeTransition, { codeProps: codeProps, prevFile: prevSouthFile, nextFile: nextSouthFile, t: 0, parentHeight: southHeight })), | ||
}, | ||
@@ -526,2 +528,6 @@ }; | ||
} | ||
var northHeight = inputSouthPanel | ||
? "calc((100% - var(--ch-title-bar-height)) * " + inputNorthPanel.heightRatio + ")" | ||
: "100%"; | ||
var southHeight = "calc((100% - var(--ch-title-bar-height)) * " + (inputSouthPanel === null || inputSouthPanel === void 0 ? void 0 : inputSouthPanel.heightRatio) + " + var(--ch-title-bar-height))"; | ||
return { | ||
@@ -535,7 +541,5 @@ northPanel: { | ||
style: { | ||
height: inputSouthPanel | ||
? "calc((100% - var(--ch-title-bar-height)) * " + inputNorthPanel.heightRatio + ")" | ||
: "100%", | ||
height: northHeight, | ||
}, | ||
children: (React__default['default'].createElement(CodeTransition, { codeProps: codeProps, prevFile: prevNorthFile, nextFile: nextNorthFile, t: 1 })), | ||
children: (React__default['default'].createElement(CodeTransition, { codeProps: codeProps, prevFile: prevNorthFile, nextFile: nextNorthFile, t: 1, parentHeight: northHeight })), | ||
}, | ||
@@ -549,5 +553,5 @@ southPanel: inputSouthPanel && { | ||
style: { | ||
height: "calc((100% - var(--ch-title-bar-height)) * " + inputSouthPanel.heightRatio + " + var(--ch-title-bar-height))", | ||
height: southHeight, | ||
}, | ||
children: (React__default['default'].createElement(CodeTransition, { codeProps: codeProps, prevFile: prevSouthFile, nextFile: nextSouthFile, t: 1 })), | ||
children: (React__default['default'].createElement(CodeTransition, { codeProps: codeProps, prevFile: prevSouthFile, nextFile: nextSouthFile, t: 1, parentHeight: southHeight })), | ||
}, | ||
@@ -557,4 +561,7 @@ }; | ||
function CodeTransition(_a) { | ||
var prevFile = _a.prevFile, nextFile = _a.nextFile, t = _a.t, codeProps = _a.codeProps; | ||
return (React__default['default'].createElement(smoothCode.Code, __assign({}, codeProps, { code: { prev: prevFile.code, next: nextFile.code }, focus: { prev: prevFile.focus, next: nextFile.focus }, progress: t, language: prevFile.lang, parentHeight: t }))); | ||
var prevFile = _a.prevFile, nextFile = _a.nextFile, t = _a.t, codeProps = _a.codeProps, parentHeight = _a.parentHeight; | ||
return (React__default['default'].createElement(smoothCode.Code, __assign({}, codeProps, { code: { prev: prevFile.code, next: nextFile.code }, focus: { prev: prevFile.focus, next: nextFile.focus }, annotations: { | ||
prev: prevFile.annotations, | ||
next: nextFile.annotations, | ||
}, progress: t, language: prevFile.lang, parentHeight: parentHeight }))); | ||
} | ||
@@ -659,6 +666,8 @@ /** | ||
function SingleFileEditor(_a) { | ||
var _b = _a.code, code = _b === void 0 ? "" : _b, _c = _a.lang, lang = _c === void 0 ? "js" : _c, focus = _a.focus, _d = _a.filename, filename = _d === void 0 ? "" : _d, terminal = _a.terminal, springConfig = _a.springConfig, props = __rest(_a, ["code", "lang", "focus", "filename", "terminal", "springConfig"]); | ||
var _b = _a.code, code = _b === void 0 ? "" : _b, _c = _a.lang, lang = _c === void 0 ? "js" : _c, focus = _a.focus, _d = _a.filename, filename = _d === void 0 ? "" : _d, annotations = _a.annotations, terminal = _a.terminal, springConfig = _a.springConfig, props = __rest(_a, ["code", "lang", "focus", "filename", "annotations", "terminal", "springConfig"]); | ||
var step = React__default['default'].useMemo(function () { | ||
var step = { | ||
files: [{ name: filename, code: code, lang: lang, focus: focus }], | ||
files: [ | ||
{ name: filename, code: code, lang: lang, focus: focus, annotations: annotations }, | ||
], | ||
northPanel: { | ||
@@ -665,0 +674,0 @@ active: filename, |
@@ -460,3 +460,3 @@ import React from 'react'; | ||
style: northStyle, | ||
children: (React.createElement(CodeTransition, { codeProps: codeProps, prevFile: prevNorthFile, nextFile: nextNorthFile, t: t })), | ||
children: (React.createElement(CodeTransition, { codeProps: codeProps, prevFile: prevNorthFile, nextFile: nextNorthFile, t: t, parentHeight: northStyle.height })), | ||
}, | ||
@@ -466,3 +466,3 @@ southPanel: inputSouthPanel && { | ||
style: southStyle, | ||
children: (React.createElement(CodeTransition, { codeProps: codeProps, prevFile: prevSouthFile, nextFile: nextSouthFile, t: t })), | ||
children: (React.createElement(CodeTransition, { codeProps: codeProps, prevFile: prevSouthFile, nextFile: nextSouthFile, t: t, parentHeight: southStyle === null || southStyle === void 0 ? void 0 : southStyle.height })), | ||
}, | ||
@@ -476,2 +476,6 @@ }; | ||
var _a = getStepFiles(prev, next, true), prevNorthFile = _a.prevNorthFile, prevSouthFile = _a.prevSouthFile, nextNorthFile = _a.nextNorthFile, nextSouthFile = _a.nextSouthFile; | ||
var northHeight = inputSouthPanel | ||
? "calc((100% - var(--ch-title-bar-height)) * " + inputNorthPanel.heightRatio + ")" | ||
: "100%"; | ||
var southHeight = "calc((100% - var(--ch-title-bar-height)) * " + (inputSouthPanel === null || inputSouthPanel === void 0 ? void 0 : inputSouthPanel.heightRatio) + " + var(--ch-title-bar-height))"; | ||
return { | ||
@@ -485,7 +489,5 @@ northPanel: { | ||
style: { | ||
height: inputSouthPanel | ||
? "calc((100% - var(--ch-title-bar-height)) * " + inputNorthPanel.heightRatio + ")" | ||
: "100%", | ||
height: northHeight, | ||
}, | ||
children: (React.createElement(CodeTransition, { codeProps: codeProps, prevFile: prevNorthFile, nextFile: nextNorthFile, t: 0 })), | ||
children: (React.createElement(CodeTransition, { codeProps: codeProps, prevFile: prevNorthFile, nextFile: nextNorthFile, t: 0, parentHeight: northHeight })), | ||
}, | ||
@@ -501,3 +503,3 @@ southPanel: inputSouthPanel && { | ||
}, | ||
children: (React.createElement(CodeTransition, { codeProps: codeProps, prevFile: prevSouthFile, nextFile: nextSouthFile, t: 0 })), | ||
children: (React.createElement(CodeTransition, { codeProps: codeProps, prevFile: prevSouthFile, nextFile: nextSouthFile, t: 0, parentHeight: southHeight })), | ||
}, | ||
@@ -518,2 +520,6 @@ }; | ||
} | ||
var northHeight = inputSouthPanel | ||
? "calc((100% - var(--ch-title-bar-height)) * " + inputNorthPanel.heightRatio + ")" | ||
: "100%"; | ||
var southHeight = "calc((100% - var(--ch-title-bar-height)) * " + (inputSouthPanel === null || inputSouthPanel === void 0 ? void 0 : inputSouthPanel.heightRatio) + " + var(--ch-title-bar-height))"; | ||
return { | ||
@@ -527,7 +533,5 @@ northPanel: { | ||
style: { | ||
height: inputSouthPanel | ||
? "calc((100% - var(--ch-title-bar-height)) * " + inputNorthPanel.heightRatio + ")" | ||
: "100%", | ||
height: northHeight, | ||
}, | ||
children: (React.createElement(CodeTransition, { codeProps: codeProps, prevFile: prevNorthFile, nextFile: nextNorthFile, t: 1 })), | ||
children: (React.createElement(CodeTransition, { codeProps: codeProps, prevFile: prevNorthFile, nextFile: nextNorthFile, t: 1, parentHeight: northHeight })), | ||
}, | ||
@@ -541,5 +545,5 @@ southPanel: inputSouthPanel && { | ||
style: { | ||
height: "calc((100% - var(--ch-title-bar-height)) * " + inputSouthPanel.heightRatio + " + var(--ch-title-bar-height))", | ||
height: southHeight, | ||
}, | ||
children: (React.createElement(CodeTransition, { codeProps: codeProps, prevFile: prevSouthFile, nextFile: nextSouthFile, t: 1 })), | ||
children: (React.createElement(CodeTransition, { codeProps: codeProps, prevFile: prevSouthFile, nextFile: nextSouthFile, t: 1, parentHeight: southHeight })), | ||
}, | ||
@@ -549,4 +553,7 @@ }; | ||
function CodeTransition(_a) { | ||
var prevFile = _a.prevFile, nextFile = _a.nextFile, t = _a.t, codeProps = _a.codeProps; | ||
return (React.createElement(Code, __assign({}, codeProps, { code: { prev: prevFile.code, next: nextFile.code }, focus: { prev: prevFile.focus, next: nextFile.focus }, progress: t, language: prevFile.lang, parentHeight: t }))); | ||
var prevFile = _a.prevFile, nextFile = _a.nextFile, t = _a.t, codeProps = _a.codeProps, parentHeight = _a.parentHeight; | ||
return (React.createElement(Code, __assign({}, codeProps, { code: { prev: prevFile.code, next: nextFile.code }, focus: { prev: prevFile.focus, next: nextFile.focus }, annotations: { | ||
prev: prevFile.annotations, | ||
next: nextFile.annotations, | ||
}, progress: t, language: prevFile.lang, parentHeight: parentHeight }))); | ||
} | ||
@@ -651,6 +658,8 @@ /** | ||
function SingleFileEditor(_a) { | ||
var _b = _a.code, code = _b === void 0 ? "" : _b, _c = _a.lang, lang = _c === void 0 ? "js" : _c, focus = _a.focus, _d = _a.filename, filename = _d === void 0 ? "" : _d, terminal = _a.terminal, springConfig = _a.springConfig, props = __rest(_a, ["code", "lang", "focus", "filename", "terminal", "springConfig"]); | ||
var _b = _a.code, code = _b === void 0 ? "" : _b, _c = _a.lang, lang = _c === void 0 ? "js" : _c, focus = _a.focus, _d = _a.filename, filename = _d === void 0 ? "" : _d, annotations = _a.annotations, terminal = _a.terminal, springConfig = _a.springConfig, props = __rest(_a, ["code", "lang", "focus", "filename", "annotations", "terminal", "springConfig"]); | ||
var step = React.useMemo(function () { | ||
var step = { | ||
files: [{ name: filename, code: code, lang: lang, focus: focus }], | ||
files: [ | ||
{ name: filename, code: code, lang: lang, focus: focus, annotations: annotations }, | ||
], | ||
northPanel: { | ||
@@ -657,0 +666,0 @@ active: filename, |
/// <reference types="react" /> | ||
import { useSpring } from "use-spring"; | ||
import { EditorStep, StepFile } from "./use-snapshots"; | ||
import { CodeProps } from "@code-hike/smooth-code"; | ||
import { CodeProps, CodeAnnotation } from "@code-hike/smooth-code"; | ||
import { EditorFrameProps } from "./editor-frame"; | ||
@@ -12,2 +12,3 @@ export { MiniEditor, MiniEditorProps }; | ||
focus?: string; | ||
annotations?: CodeAnnotation[]; | ||
filename?: string; | ||
@@ -14,0 +15,0 @@ terminal?: string; |
import React from "react"; | ||
import { Snapshot } from "./editor-frame"; | ||
import { CodeAnnotation } from "@code-hike/smooth-code"; | ||
export { EditorStep, StepFile, useSnapshots }; | ||
@@ -9,2 +10,3 @@ declare type StepFile = { | ||
name: string; | ||
annotations?: CodeAnnotation[]; | ||
}; | ||
@@ -11,0 +13,0 @@ declare type EditorPanel = { |
{ | ||
"name": "@code-hike/mini-editor", | ||
"version": "0.3.0--canary.77.ade5d72.0", | ||
"version": "0.3.0--canary.77.c58a10a.0", | ||
"main": "dist/index.cjs.js", | ||
@@ -15,3 +15,3 @@ "typings": "dist/index.d.ts", | ||
"devDependencies": { | ||
"@code-hike/script": "0.3.0--canary.77.ade5d72.0", | ||
"@code-hike/script": "0.3.0--canary.77.c58a10a.0", | ||
"@types/react": "^16.9.38", | ||
@@ -21,6 +21,6 @@ "react": "^16.13.1" | ||
"dependencies": { | ||
"@code-hike/classer": "0.3.0--canary.77.ade5d72.0", | ||
"@code-hike/mini-frame": "0.3.0--canary.77.ade5d72.0", | ||
"@code-hike/mini-terminal": "0.3.0--canary.77.ade5d72.0", | ||
"@code-hike/smooth-code": "0.3.0--canary.77.ade5d72.0", | ||
"@code-hike/classer": "0.3.0--canary.77.c58a10a.0", | ||
"@code-hike/mini-frame": "0.3.0--canary.77.c58a10a.0", | ||
"@code-hike/mini-terminal": "0.3.0--canary.77.c58a10a.0", | ||
"@code-hike/smooth-code": "0.3.0--canary.77.c58a10a.0", | ||
"use-spring": "^0.2.3" | ||
@@ -45,3 +45,3 @@ }, | ||
}, | ||
"gitHead": "ade5d72c2e84b4893c40b07e576b9aff818d6cec" | ||
"gitHead": "c58a10af94bfbb73197c59ff8331d2b2635c9c29" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
94190
1836
+ Added@code-hike/classer@0.3.0--canary.77.c58a10a.0(transitive)
+ Added@code-hike/code-diff@0.3.0--canary.77.c58a10a.0(transitive)
+ Added@code-hike/mini-frame@0.3.0--canary.77.c58a10a.0(transitive)
+ Added@code-hike/mini-terminal@0.3.0--canary.77.c58a10a.0(transitive)
+ Added@code-hike/smooth-code@0.3.0--canary.77.c58a10a.0(transitive)
+ Added@code-hike/smooth-lines@0.3.0--canary.77.c58a10a.0(transitive)
+ Added@code-hike/utils@0.3.0--canary.77.c58a10a.0(transitive)
- Removed@code-hike/classer@0.3.0--canary.77.ade5d72.0(transitive)
- Removed@code-hike/code-diff@0.3.0--canary.77.ade5d72.0(transitive)
- Removed@code-hike/mini-frame@0.3.0--canary.77.ade5d72.0(transitive)
- Removed@code-hike/mini-terminal@0.3.0--canary.77.ade5d72.0(transitive)
- Removed@code-hike/smooth-code@0.3.0--canary.77.ade5d72.0(transitive)
- Removed@code-hike/smooth-lines@0.3.0--canary.77.ade5d72.0(transitive)
- Removed@code-hike/utils@0.3.0--canary.77.ade5d72.0(transitive)