Skip to content

Commit eb4dacb

Browse files
authored
Merge pull request #12639 from CesiumGS/sandcastle-react-structure
Solidify new Sandcastle React structure
2 parents 6e3a872 + ebe34ca commit eb4dacb

File tree

8 files changed

+621
-636
lines changed

8 files changed

+621
-636
lines changed

packages/sandcastle/public/Sandcastle-client.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
(function () {
22
"use strict";
3-
window.parent.postMessage("reload", "*");
3+
window.parent.postMessage({ type: "reload" }, "*");
44

55
function defined(value) {
66
return value !== undefined;
@@ -20,6 +20,7 @@
2020
originalLog.apply(console, arguments);
2121
window.parent.postMessage(
2222
{
23+
type: "consoleLog",
2324
log: print(d1),
2425
},
2526
"*",
@@ -31,6 +32,7 @@
3132
originalWarn.apply(console, arguments);
3233
window.parent.postMessage(
3334
{
35+
type: "consoleWarn",
3436
warn: defined(d1) ? d1.toString() : "undefined",
3537
},
3638
"*",
@@ -49,6 +51,7 @@
4951
if (!defined(d1)) {
5052
window.parent.postMessage(
5153
{
54+
type: "consoleError",
5255
error: "undefined",
5356
},
5457
"*",
@@ -93,6 +96,7 @@
9396
if (lineNumber >= 0) {
9497
window.parent.postMessage(
9598
{
99+
type: "consoleError",
96100
error: errorMsg,
97101
lineNumber: lineNumber,
98102
},
@@ -101,6 +105,7 @@
101105
} else {
102106
window.parent.postMessage(
103107
{
108+
type: "consoleError",
104109
error: errorMsg,
105110
},
106111
"*",
@@ -131,6 +136,7 @@
131136
}
132137
window.parent.postMessage(
133138
{
139+
type: "consoleError",
134140
error: errorMsg,
135141
url: url,
136142
lineNumber: lineNumber,
@@ -140,6 +146,7 @@
140146
} else {
141147
window.parent.postMessage(
142148
{
149+
type: "consoleError",
143150
error: errorMsg,
144151
url: url,
145152
},

packages/sandcastle/public/templates/bucket.css

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,27 @@ body {
1515
width: 100%;
1616
height: 100%;
1717
overflow: hidden;
18+
19+
background-color: white;
20+
background-image: var(--_rings), var(--_gradient);
21+
22+
/* TODO: these should pull from the stratakit directly somehow eventually */
23+
--ids-color-border-neutral-muted: oklch(91.52% 0.005 258.33);
24+
--ids-color-bg-page-base: oklch(99.06% 0.002 247.84);
25+
--ids-color-bg-page-depth: oklch(94.86% 0.002 247.84);
26+
27+
--_rings: repeating-radial-gradient(
28+
circle at center,
29+
var(--ids-color-border-neutral-muted) 1px,
30+
var(--ids-color-border-neutral-muted) 3px,
31+
transparent 3px,
32+
transparent 10px
33+
);
34+
--_gradient: linear-gradient(
35+
180deg,
36+
var(--ids-color-bg-page-base) 0%,
37+
var(--ids-color-bg-page-depth) 100%
38+
);
1839
}
1940

2041
.fullSize {

packages/sandcastle/src/App.css

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,11 @@
77
"code viewer"
88
"gallery gallery";
99
grid-template-columns: 50% 50%;
10-
grid-template-rows: max-content auto 150px;
11-
/* TODO: this shouldn't be needed but it works for hacky code */
12-
overflow: hidden;
10+
/* Monaco needs a defined height for dynamic resizing to work */
11+
--toolbar-height: 2.5rem;
12+
grid-template-rows:
13+
var(--toolbar-height) calc(100% - var(--toolbar-height) - 150px)
14+
150px;
1315
}
1416

1517
.toolbar {
@@ -24,11 +26,21 @@
2426
}
2527
}
2628

29+
.tabs {
30+
background: var(--ids-color-bg-page-base);
31+
}
32+
2733
.editor-container {
2834
grid-area: code;
35+
display: flex;
36+
flex-direction: column;
2937

3038
section {
3139
border-top: 1px solid grey;
40+
flex-shrink: 1;
41+
/* Monaco needs a defined height for dynamic resizing to work */
42+
--tabs-height: 1.5rem;
43+
height: calc(100% - var(--tabs-height)) !important;
3244
}
3345
}
3446

0 commit comments

Comments
 (0)